From 038cb3c95f0148e44fbf21347176a97e59d42440 Mon Sep 17 00:00:00 2001 From: Ryzom Date: Fri, 4 Mar 2016 11:45:44 +0100 Subject: [PATCH] nel_tex_gen_10b --- src/tex_gen/basics.cpp | 350 ++++ src/tex_gen/basics.h | 288 +++ src/tex_gen/bitmap_f.cpp | 119 ++ src/tex_gen/bitmap_float.cpp | 445 +++++ src/tex_gen/bitmap_float.h | 164 ++ src/tex_gen/op_angular_gradient.cpp | 170 ++ src/tex_gen/op_angular_gradient.h | 87 + src/tex_gen/op_background.cpp | 59 + src/tex_gen/op_background.h | 75 + src/tex_gen/op_bars.cpp | 102 + src/tex_gen/op_bars.h | 85 + src/tex_gen/op_blur.cpp | 141 ++ src/tex_gen/op_blur.h | 88 + src/tex_gen/op_cellular.cpp | 477 +++++ src/tex_gen/op_cellular.h | 83 + src/tex_gen/op_clouds.cpp | 175 ++ src/tex_gen/op_clouds.h | 80 + src/tex_gen/op_color.cpp | 136 ++ src/tex_gen/op_color.h | 91 + src/tex_gen/op_contrast_luminosity.cpp | 71 + src/tex_gen/op_contrast_luminosity.h | 82 + src/tex_gen/op_deform.cpp | 46 + src/tex_gen/op_deform.h | 80 + src/tex_gen/op_fill_color.cpp | 57 + src/tex_gen/op_fill_color.h | 77 + src/tex_gen/op_font.cpp | 291 +++ src/tex_gen/op_font.h | 94 + src/tex_gen/op_gradient.cpp | 144 ++ src/tex_gen/op_gradient.h | 83 + src/tex_gen/op_hue_saturation.cpp | 91 + src/tex_gen/op_hue_saturation.h | 83 + src/tex_gen/op_layer.cpp | 67 + src/tex_gen/op_layer.h | 89 + src/tex_gen/op_light.cpp | 105 + src/tex_gen/op_light.h | 83 + src/tex_gen/op_linear_gradient.cpp | 172 ++ src/tex_gen/op_linear_gradient.cpp.bak | 172 ++ src/tex_gen/op_linear_gradient.cpp.filtered | 128 ++ src/tex_gen/op_linear_gradient.h | 85 + src/tex_gen/op_mix.cpp | 56 + src/tex_gen/op_mix.h | 78 + src/tex_gen/op_noise.cpp | 171 ++ src/tex_gen/op_noise.h | 89 + src/tex_gen/op_normalize.cpp | 82 + src/tex_gen/op_normalize.h | 81 + src/tex_gen/op_quad.cpp | 98 + src/tex_gen/op_quad.h | 93 + src/tex_gen/op_radial_gradient.cpp | 163 ++ src/tex_gen/op_radial_gradient.h | 84 + src/tex_gen/op_root.cpp | 59 + src/tex_gen/op_root.h | 77 + src/tex_gen/op_sinus.cpp | 105 + src/tex_gen/op_sinus.h | 82 + src/tex_gen/op_solid.cpp | 57 + src/tex_gen/op_solid.h | 75 + src/tex_gen/op_transform.cpp | 211 ++ src/tex_gen/op_transform.h | 89 + src/tex_gen/stdtex_gen.cpp | 2 + src/tex_gen/stdtex_gen.h | 38 + src/tex_gen/tex_gen_document.cpp | 64 + src/tex_gen/tex_gen_document.h | 60 + src/tex_gen/tex_gen_op.cpp | 331 ++++ src/tex_gen/tex_gen_op.h | 249 +++ src/tex_gen/todo.txt | 95 + src/tex_gen/transform_float.cpp | 473 +++++ src/tex_gen/transform_float.h | 1714 +++++++++++++++++ tools/build_sources.bat | 20 + tools/compilation_notes.txt | 10 + tools/tex_gen_3dsmax3/DllEntry.cpp | 78 + tools/tex_gen_3dsmax3/clean_all.bat | 1 + .../tex_gen_3dsmax3/make_tex_gen_3dsmax3.bat | 4 + tools/tex_gen_3dsmax3/resource.h | 29 + tools/tex_gen_3dsmax3/tex_gen_3dsmax3.cpp | 220 +++ tools/tex_gen_3dsmax3/tex_gen_3dsmax3.def | 8 + tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dep | 338 ++++ tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dsp | 155 ++ tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dsw | 29 + tools/tex_gen_3dsmax3/tex_gen_3dsmax3.h | 28 + tools/tex_gen_3dsmax3/tex_gen_3dsmax3.mak | 316 +++ tools/tex_gen_3dsmax3/tex_gen_3dsmax3.rc | 158 ++ tools/tex_gen_3dsmax5/DllEntry.cpp | 78 + tools/tex_gen_3dsmax5/clean_all.bat | 1 + tools/tex_gen_3dsmax5/compilation_notes.txt | 3 + tools/tex_gen_3dsmax5/resource.h | 29 + tools/tex_gen_3dsmax5/tex_gen_3dsmax5.cpp | 220 +++ tools/tex_gen_3dsmax5/tex_gen_3dsmax5.def | 8 + tools/tex_gen_3dsmax5/tex_gen_3dsmax5.dsp | 155 ++ tools/tex_gen_3dsmax5/tex_gen_3dsmax5.h | 28 + tools/tex_gen_3dsmax5/tex_gen_3dsmax5.rc | 158 ++ tools/tex_gen_editor/Resource.h | 55 + tools/tex_gen_editor/StdAfx.cpp | 8 + tools/tex_gen_editor/StdAfx.h | 66 + tools/tex_gen_editor/action.cpp | 203 ++ tools/tex_gen_editor/action.h | 208 ++ tools/tex_gen_editor/bitmap_wnd.cpp | 287 +++ tools/tex_gen_editor/bitmap_wnd.h | 111 ++ tools/tex_gen_editor/child_frm.cpp | 90 + tools/tex_gen_editor/child_frm.h | 57 + tools/tex_gen_editor/color_box.cpp | 167 ++ tools/tex_gen_editor/color_box.h | 70 + tools/tex_gen_editor/color_picker.cpp | 360 ++++ tools/tex_gen_editor/color_picker.h | 80 + .../tex_gen_editor/color_picker_color_wnd.cpp | 102 + tools/tex_gen_editor/color_picker_color_wnd.h | 62 + .../tex_gen_editor/color_picker_hue_panel.cpp | 153 ++ tools/tex_gen_editor/color_picker_hue_panel.h | 74 + .../tex_gen_editor/color_picker_rgb_panel.cpp | 187 ++ tools/tex_gen_editor/color_picker_rgb_panel.h | 87 + tools/tex_gen_editor/dib_wnd.cpp | 189 ++ tools/tex_gen_editor/dib_wnd.h | 93 + tools/tex_gen_editor/gradient_cursor_wnd.cpp | 280 +++ tools/tex_gen_editor/gradient_cursor_wnd.h | 80 + tools/tex_gen_editor/gradient_dlg.cpp | 78 + tools/tex_gen_editor/gradient_dlg.h | 60 + tools/tex_gen_editor/gradient_rect_wnd.cpp | 131 ++ tools/tex_gen_editor/gradient_rect_wnd.h | 73 + tools/tex_gen_editor/gradient_wnd.cpp | 402 ++++ tools/tex_gen_editor/gradient_wnd.h | 93 + tools/tex_gen_editor/history.txt | 96 + tools/tex_gen_editor/main_frm.cpp | 367 ++++ tools/tex_gen_editor/main_frm.h | 73 + tools/tex_gen_editor/my_edit.cpp | 65 + tools/tex_gen_editor/my_edit.h | 52 + tools/tex_gen_editor/nel_tex_gen.cpp | 552 ++++++ tools/tex_gen_editor/nel_tex_gen.dsp | 393 ++++ tools/tex_gen_editor/nel_tex_gen.dsw | 134 ++ tools/tex_gen_editor/nel_tex_gen.h | 122 ++ tools/tex_gen_editor/nel_tex_gen.rc | 653 +++++++ tools/tex_gen_editor/nel_tex_gen.reg | 14 + tools/tex_gen_editor/nel_tex_gen_doc.cpp | 879 +++++++++ tools/tex_gen_editor/nel_tex_gen_doc.h | 198 ++ tools/tex_gen_editor/nel_tex_gen_view.cpp | 749 +++++++ tools/tex_gen_editor/nel_tex_gen_view.h | 166 ++ tools/tex_gen_editor/op_property_dlg.cpp | 755 ++++++++ tools/tex_gen_editor/op_property_dlg.h | 87 + tools/tex_gen_editor/operator_win.cpp | 434 +++++ tools/tex_gen_editor/operator_win.h | 125 ++ tools/tex_gen_editor/port.cpp | 164 ++ tools/tex_gen_editor/port.h | 63 + tools/tex_gen_editor/res/Toolbar.bmp | Bin 0 -> 2166 bytes tools/tex_gen_editor/res/app.ico | Bin 0 -> 7078 bytes tools/tex_gen_editor/res/arrow_in.bmp | Bin 0 -> 1418 bytes tools/tex_gen_editor/res/bitmap1.bmp | Bin 0 -> 118 bytes tools/tex_gen_editor/res/bmp00001.bmp | Bin 0 -> 1418 bytes tools/tex_gen_editor/res/button.bmp | Bin 0 -> 2102 bytes tools/tex_gen_editor/res/button_hole.bmp | Bin 0 -> 1142 bytes tools/tex_gen_editor/res/button_hole_mask.bmp | Bin 0 -> 94 bytes tools/tex_gen_editor/res/button_mask.bmp | Bin 0 -> 190 bytes tools/tex_gen_editor/res/doc.ico | Bin 0 -> 6766 bytes tools/tex_gen_editor/res/nel_tex_gen.rc2 | 13 + tools/tex_gen_editor/res/nel_tex_gen_doc.ico | Bin 0 -> 1078 bytes tools/tex_gen_editor/res/quadrati.bmp | Bin 0 -> 118 bytes tools/tex_gen_editor/res/toolbar1.bmp | Bin 0 -> 238 bytes tools/tex_gen_editor/rot_button.cpp | 380 ++++ tools/tex_gen_editor/rot_button.h | 93 + tools/tex_gen_editor/samples/cells.texgen | Bin 0 -> 488 bytes tools/tex_gen_editor/samples/cement.texgen | Bin 0 -> 577 bytes .../tex_gen_editor/samples/green_rocks.texgen | Bin 0 -> 477 bytes .../samples/ground_futur.texgen | Bin 0 -> 1113 bytes .../tex_gen_editor/samples/ground_gold.texgen | Bin 0 -> 288 bytes .../samples/ground_tiles.texgen | Bin 0 -> 798 bytes tools/tex_gen_editor/samples/lightning.texgen | Bin 0 -> 257 bytes tools/tex_gen_editor/samples/logo.texgen | Bin 0 -> 795 bytes tools/tex_gen_editor/samples/marble.texgen | Bin 0 -> 351 bytes .../samples/metal_button.texgen | Bin 0 -> 487 bytes .../tex_gen_editor/samples/metal_lines.texgen | Bin 0 -> 641 bytes tools/tex_gen_editor/samples/moon.texgen | Bin 0 -> 286 bytes tools/tex_gen_editor/samples/new_wood.texgen | Bin 0 -> 392 bytes tools/tex_gen_editor/samples/planet.texgen | Bin 0 -> 1366 bytes tools/tex_gen_editor/samples/road.texgen | Bin 0 -> 1100 bytes .../tex_gen_editor/samples/rough_coats.texgen | Bin 0 -> 296 bytes tools/tex_gen_editor/samples/splash.texgen | Bin 0 -> 643 bytes tools/tex_gen_install/adni18-installer-B.ico | Bin 0 -> 22486 bytes tools/tex_gen_install/adni18-uninstall-B.ico | Bin 0 -> 22486 bytes tools/tex_gen_install/nel_tex_gen.nsi | 200 ++ tools/tex_gen_install/options.ini | 38 + tools/tex_gen_install/plugin_max3.ini | 20 + tools/tex_gen_install/plugin_max5.ini | 20 + tools/tex_gen_install/tex_gen_install.dsp | 62 + tools/tex_gen_thumbnail/ExtractImageApp.cpp | 136 ++ tools/tex_gen_thumbnail/ExtractImageApp.h | 31 + tools/tex_gen_thumbnail/IExtractImage.h | 55 + tools/tex_gen_thumbnail/Resource.h | 17 + tools/tex_gen_thumbnail/StdAfx.cpp | 13 + tools/tex_gen_thumbnail/StdAfx.h | 85 + .../tex_gen_thumbnail/TexGenThumbnailDoc.cpp | 215 +++ tools/tex_gen_thumbnail/TexGenThumbnailDoc.h | 51 + .../TexGenThumbnailExtractor.cpp | 65 + .../TexGenThumbnailExtractor.h | 80 + .../ThumbTexGenThumbnail.idl | 38 + .../ThumbTexGenThumbnail_i.c | 50 + .../ThumbTexGenThumbnail_i.h | 202 ++ .../ThumbTexGenThumbnail_p.c | 207 ++ tools/tex_gen_thumbnail/dlldata.c | 38 + .../res/tex_gen_thumbnail.rc2 | 13 + tools/tex_gen_thumbnail/tex_gen_thumbnail.def | 11 + tools/tex_gen_thumbnail/tex_gen_thumbnail.dsp | 199 ++ tools/tex_gen_thumbnail/tex_gen_thumbnail.rc | 161 ++ tools/tex_gen_thumbnail/tex_gen_thumbnail.rgs | 35 + .../tex_gen_thumbnailApp.cpp | 137 ++ .../tex_gen_thumbnail/tex_gen_thumbnailApp.h | 54 + 201 files changed, 24931 insertions(+) create mode 100644 src/tex_gen/basics.cpp create mode 100644 src/tex_gen/basics.h create mode 100644 src/tex_gen/bitmap_f.cpp create mode 100644 src/tex_gen/bitmap_float.cpp create mode 100644 src/tex_gen/bitmap_float.h create mode 100644 src/tex_gen/op_angular_gradient.cpp create mode 100644 src/tex_gen/op_angular_gradient.h create mode 100644 src/tex_gen/op_background.cpp create mode 100644 src/tex_gen/op_background.h create mode 100644 src/tex_gen/op_bars.cpp create mode 100644 src/tex_gen/op_bars.h create mode 100644 src/tex_gen/op_blur.cpp create mode 100644 src/tex_gen/op_blur.h create mode 100644 src/tex_gen/op_cellular.cpp create mode 100644 src/tex_gen/op_cellular.h create mode 100644 src/tex_gen/op_clouds.cpp create mode 100644 src/tex_gen/op_clouds.h create mode 100644 src/tex_gen/op_color.cpp create mode 100644 src/tex_gen/op_color.h create mode 100644 src/tex_gen/op_contrast_luminosity.cpp create mode 100644 src/tex_gen/op_contrast_luminosity.h create mode 100644 src/tex_gen/op_deform.cpp create mode 100644 src/tex_gen/op_deform.h create mode 100644 src/tex_gen/op_fill_color.cpp create mode 100644 src/tex_gen/op_fill_color.h create mode 100644 src/tex_gen/op_font.cpp create mode 100644 src/tex_gen/op_font.h create mode 100644 src/tex_gen/op_gradient.cpp create mode 100644 src/tex_gen/op_gradient.h create mode 100644 src/tex_gen/op_hue_saturation.cpp create mode 100644 src/tex_gen/op_hue_saturation.h create mode 100644 src/tex_gen/op_layer.cpp create mode 100644 src/tex_gen/op_layer.h create mode 100644 src/tex_gen/op_light.cpp create mode 100644 src/tex_gen/op_light.h create mode 100644 src/tex_gen/op_linear_gradient.cpp create mode 100644 src/tex_gen/op_linear_gradient.cpp.bak create mode 100644 src/tex_gen/op_linear_gradient.cpp.filtered create mode 100644 src/tex_gen/op_linear_gradient.h create mode 100644 src/tex_gen/op_mix.cpp create mode 100644 src/tex_gen/op_mix.h create mode 100644 src/tex_gen/op_noise.cpp create mode 100644 src/tex_gen/op_noise.h create mode 100644 src/tex_gen/op_normalize.cpp create mode 100644 src/tex_gen/op_normalize.h create mode 100644 src/tex_gen/op_quad.cpp create mode 100644 src/tex_gen/op_quad.h create mode 100644 src/tex_gen/op_radial_gradient.cpp create mode 100644 src/tex_gen/op_radial_gradient.h create mode 100644 src/tex_gen/op_root.cpp create mode 100644 src/tex_gen/op_root.h create mode 100644 src/tex_gen/op_sinus.cpp create mode 100644 src/tex_gen/op_sinus.h create mode 100644 src/tex_gen/op_solid.cpp create mode 100644 src/tex_gen/op_solid.h create mode 100644 src/tex_gen/op_transform.cpp create mode 100644 src/tex_gen/op_transform.h create mode 100644 src/tex_gen/stdtex_gen.cpp create mode 100644 src/tex_gen/stdtex_gen.h create mode 100644 src/tex_gen/tex_gen_document.cpp create mode 100644 src/tex_gen/tex_gen_document.h create mode 100644 src/tex_gen/tex_gen_op.cpp create mode 100644 src/tex_gen/tex_gen_op.h create mode 100644 src/tex_gen/todo.txt create mode 100644 src/tex_gen/transform_float.cpp create mode 100644 src/tex_gen/transform_float.h create mode 100644 tools/build_sources.bat create mode 100644 tools/compilation_notes.txt create mode 100644 tools/tex_gen_3dsmax3/DllEntry.cpp create mode 100644 tools/tex_gen_3dsmax3/clean_all.bat create mode 100644 tools/tex_gen_3dsmax3/make_tex_gen_3dsmax3.bat create mode 100644 tools/tex_gen_3dsmax3/resource.h create mode 100644 tools/tex_gen_3dsmax3/tex_gen_3dsmax3.cpp create mode 100644 tools/tex_gen_3dsmax3/tex_gen_3dsmax3.def create mode 100644 tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dep create mode 100644 tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dsp create mode 100644 tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dsw create mode 100644 tools/tex_gen_3dsmax3/tex_gen_3dsmax3.h create mode 100644 tools/tex_gen_3dsmax3/tex_gen_3dsmax3.mak create mode 100644 tools/tex_gen_3dsmax3/tex_gen_3dsmax3.rc create mode 100644 tools/tex_gen_3dsmax5/DllEntry.cpp create mode 100644 tools/tex_gen_3dsmax5/clean_all.bat create mode 100644 tools/tex_gen_3dsmax5/compilation_notes.txt create mode 100644 tools/tex_gen_3dsmax5/resource.h create mode 100644 tools/tex_gen_3dsmax5/tex_gen_3dsmax5.cpp create mode 100644 tools/tex_gen_3dsmax5/tex_gen_3dsmax5.def create mode 100644 tools/tex_gen_3dsmax5/tex_gen_3dsmax5.dsp create mode 100644 tools/tex_gen_3dsmax5/tex_gen_3dsmax5.h create mode 100644 tools/tex_gen_3dsmax5/tex_gen_3dsmax5.rc create mode 100644 tools/tex_gen_editor/Resource.h create mode 100644 tools/tex_gen_editor/StdAfx.cpp create mode 100644 tools/tex_gen_editor/StdAfx.h create mode 100644 tools/tex_gen_editor/action.cpp create mode 100644 tools/tex_gen_editor/action.h create mode 100644 tools/tex_gen_editor/bitmap_wnd.cpp create mode 100644 tools/tex_gen_editor/bitmap_wnd.h create mode 100644 tools/tex_gen_editor/child_frm.cpp create mode 100644 tools/tex_gen_editor/child_frm.h create mode 100644 tools/tex_gen_editor/color_box.cpp create mode 100644 tools/tex_gen_editor/color_box.h create mode 100644 tools/tex_gen_editor/color_picker.cpp create mode 100644 tools/tex_gen_editor/color_picker.h create mode 100644 tools/tex_gen_editor/color_picker_color_wnd.cpp create mode 100644 tools/tex_gen_editor/color_picker_color_wnd.h create mode 100644 tools/tex_gen_editor/color_picker_hue_panel.cpp create mode 100644 tools/tex_gen_editor/color_picker_hue_panel.h create mode 100644 tools/tex_gen_editor/color_picker_rgb_panel.cpp create mode 100644 tools/tex_gen_editor/color_picker_rgb_panel.h create mode 100644 tools/tex_gen_editor/dib_wnd.cpp create mode 100644 tools/tex_gen_editor/dib_wnd.h create mode 100644 tools/tex_gen_editor/gradient_cursor_wnd.cpp create mode 100644 tools/tex_gen_editor/gradient_cursor_wnd.h create mode 100644 tools/tex_gen_editor/gradient_dlg.cpp create mode 100644 tools/tex_gen_editor/gradient_dlg.h create mode 100644 tools/tex_gen_editor/gradient_rect_wnd.cpp create mode 100644 tools/tex_gen_editor/gradient_rect_wnd.h create mode 100644 tools/tex_gen_editor/gradient_wnd.cpp create mode 100644 tools/tex_gen_editor/gradient_wnd.h create mode 100644 tools/tex_gen_editor/history.txt create mode 100644 tools/tex_gen_editor/main_frm.cpp create mode 100644 tools/tex_gen_editor/main_frm.h create mode 100644 tools/tex_gen_editor/my_edit.cpp create mode 100644 tools/tex_gen_editor/my_edit.h create mode 100644 tools/tex_gen_editor/nel_tex_gen.cpp create mode 100644 tools/tex_gen_editor/nel_tex_gen.dsp create mode 100644 tools/tex_gen_editor/nel_tex_gen.dsw create mode 100644 tools/tex_gen_editor/nel_tex_gen.h create mode 100644 tools/tex_gen_editor/nel_tex_gen.rc create mode 100644 tools/tex_gen_editor/nel_tex_gen.reg create mode 100644 tools/tex_gen_editor/nel_tex_gen_doc.cpp create mode 100644 tools/tex_gen_editor/nel_tex_gen_doc.h create mode 100644 tools/tex_gen_editor/nel_tex_gen_view.cpp create mode 100644 tools/tex_gen_editor/nel_tex_gen_view.h create mode 100644 tools/tex_gen_editor/op_property_dlg.cpp create mode 100644 tools/tex_gen_editor/op_property_dlg.h create mode 100644 tools/tex_gen_editor/operator_win.cpp create mode 100644 tools/tex_gen_editor/operator_win.h create mode 100644 tools/tex_gen_editor/port.cpp create mode 100644 tools/tex_gen_editor/port.h create mode 100644 tools/tex_gen_editor/res/Toolbar.bmp create mode 100644 tools/tex_gen_editor/res/app.ico create mode 100644 tools/tex_gen_editor/res/arrow_in.bmp create mode 100644 tools/tex_gen_editor/res/bitmap1.bmp create mode 100644 tools/tex_gen_editor/res/bmp00001.bmp create mode 100644 tools/tex_gen_editor/res/button.bmp create mode 100644 tools/tex_gen_editor/res/button_hole.bmp create mode 100644 tools/tex_gen_editor/res/button_hole_mask.bmp create mode 100644 tools/tex_gen_editor/res/button_mask.bmp create mode 100644 tools/tex_gen_editor/res/doc.ico create mode 100644 tools/tex_gen_editor/res/nel_tex_gen.rc2 create mode 100644 tools/tex_gen_editor/res/nel_tex_gen_doc.ico create mode 100644 tools/tex_gen_editor/res/quadrati.bmp create mode 100644 tools/tex_gen_editor/res/toolbar1.bmp create mode 100644 tools/tex_gen_editor/rot_button.cpp create mode 100644 tools/tex_gen_editor/rot_button.h create mode 100644 tools/tex_gen_editor/samples/cells.texgen create mode 100644 tools/tex_gen_editor/samples/cement.texgen create mode 100644 tools/tex_gen_editor/samples/green_rocks.texgen create mode 100644 tools/tex_gen_editor/samples/ground_futur.texgen create mode 100644 tools/tex_gen_editor/samples/ground_gold.texgen create mode 100644 tools/tex_gen_editor/samples/ground_tiles.texgen create mode 100644 tools/tex_gen_editor/samples/lightning.texgen create mode 100644 tools/tex_gen_editor/samples/logo.texgen create mode 100644 tools/tex_gen_editor/samples/marble.texgen create mode 100644 tools/tex_gen_editor/samples/metal_button.texgen create mode 100644 tools/tex_gen_editor/samples/metal_lines.texgen create mode 100644 tools/tex_gen_editor/samples/moon.texgen create mode 100644 tools/tex_gen_editor/samples/new_wood.texgen create mode 100644 tools/tex_gen_editor/samples/planet.texgen create mode 100644 tools/tex_gen_editor/samples/road.texgen create mode 100644 tools/tex_gen_editor/samples/rough_coats.texgen create mode 100644 tools/tex_gen_editor/samples/splash.texgen create mode 100644 tools/tex_gen_install/adni18-installer-B.ico create mode 100644 tools/tex_gen_install/adni18-uninstall-B.ico create mode 100644 tools/tex_gen_install/nel_tex_gen.nsi create mode 100644 tools/tex_gen_install/options.ini create mode 100644 tools/tex_gen_install/plugin_max3.ini create mode 100644 tools/tex_gen_install/plugin_max5.ini create mode 100644 tools/tex_gen_install/tex_gen_install.dsp create mode 100644 tools/tex_gen_thumbnail/ExtractImageApp.cpp create mode 100644 tools/tex_gen_thumbnail/ExtractImageApp.h create mode 100644 tools/tex_gen_thumbnail/IExtractImage.h create mode 100644 tools/tex_gen_thumbnail/Resource.h create mode 100644 tools/tex_gen_thumbnail/StdAfx.cpp create mode 100644 tools/tex_gen_thumbnail/StdAfx.h create mode 100644 tools/tex_gen_thumbnail/TexGenThumbnailDoc.cpp create mode 100644 tools/tex_gen_thumbnail/TexGenThumbnailDoc.h create mode 100644 tools/tex_gen_thumbnail/TexGenThumbnailExtractor.cpp create mode 100644 tools/tex_gen_thumbnail/TexGenThumbnailExtractor.h create mode 100644 tools/tex_gen_thumbnail/ThumbTexGenThumbnail.idl create mode 100644 tools/tex_gen_thumbnail/ThumbTexGenThumbnail_i.c create mode 100644 tools/tex_gen_thumbnail/ThumbTexGenThumbnail_i.h create mode 100644 tools/tex_gen_thumbnail/ThumbTexGenThumbnail_p.c create mode 100644 tools/tex_gen_thumbnail/dlldata.c create mode 100644 tools/tex_gen_thumbnail/res/tex_gen_thumbnail.rc2 create mode 100644 tools/tex_gen_thumbnail/tex_gen_thumbnail.def create mode 100644 tools/tex_gen_thumbnail/tex_gen_thumbnail.dsp create mode 100644 tools/tex_gen_thumbnail/tex_gen_thumbnail.rc create mode 100644 tools/tex_gen_thumbnail/tex_gen_thumbnail.rgs create mode 100644 tools/tex_gen_thumbnail/tex_gen_thumbnailApp.cpp create mode 100644 tools/tex_gen_thumbnail/tex_gen_thumbnailApp.h diff --git a/src/tex_gen/basics.cpp b/src/tex_gen/basics.cpp new file mode 100644 index 0000000..df19e65 --- /dev/null +++ b/src/tex_gen/basics.cpp @@ -0,0 +1,350 @@ +/** \file basics.cpp + * Basic types + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdtex_gen.h" +#include "basics.h" +#include "op_fill_color.h" +#include "op_root.h" +#include "op_gradient.h" +#include "op_linear_gradient.h" +#include "op_radial_gradient.h" +#include "op_angular_gradient.h" +#include "op_noise.h" +#include "op_blur.h" +#include "op_mix.h" +#include "op_contrast_luminosity.h" +#include "op_hue_saturation.h" +#include "op_normalize.h" +#include "op_light.h" +#include "op_transform.h" +#include "op_sinus.h" +#include "op_background.h" +#include "op_bars.h" +#include "op_clouds.h" +#include "op_font.h" +#include "op_quad.h" +#include "op_cellular.h" +#include "transform_float.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +namespace NLTEXGEN +{ + +// *************************************************************************** + +const char *NLTEXGEN::BlendModeName[NumBlendMode]= +{ + "Normal", + "Multiply", + "Additive", + "Substractive", + "Reverse substractive", + "Screen", + "Darken", + "Lighten", + "Difference", + "Negation", + "Exclusion", + "Overlay", + "Hard light", + "Soft light", + "Color dodge", + "Reverse color dodge", + "Color burn", + "Reverse color burn", + "Invert", +}; + +// *************************************************************************** + +CParameter::CParameter(TType type, const char *name, const char *category, sint firstVersion, sint lastVersion) +{ + Name = name; + Type = type; + Category = category; + replaceConstRGBA (Color, ColorBlack, 1); + EnumString = NULL; + Integer = 0; + IntegerMin = 0; + Value = 0; + IntegerMax = INT_MAX; + Setup.Unit = NULL; + FirstVersion = firstVersion; + LastVersion = lastVersion; +} + +// *************************************************************************** + +CParameter::CParameter(const char *name, const char *category, const char **enumString, int numString, sint firstVersion, sint lastVersion) +{ + this->CParameter::CParameter(TypeEnum, name, category, firstVersion, lastVersion); + EnumString = enumString; + IntegerMax = numString; +} + +// *************************************************************************** + +CParameter::CParameter(const char *name, const char *category, sint min, sint max, sint firstVersion, sint lastVersion) +{ + this->CParameter::CParameter(TypeInt, name, category, firstVersion, lastVersion); + IntegerMin = min; + IntegerMax = max; +} + +// *************************************************************************** + +CParameter::CParameter(const char *name, const char *category, const CFloatValueSetup &setup, sint firstVersion, sint lastVersion) +{ + this->CParameter::CParameter(TypeFloat, name, category, firstVersion, lastVersion); + Setup = setup; +} + +// *************************************************************************** + +CParameter::CParameter(const char *name, const char *category, bool value, sint firstVersion, sint lastVersion) +{ + this->CParameter::CParameter(TypeBool, name, category, firstVersion, lastVersion); + Integer = value ? 1 : 0; +} + +// *************************************************************************** + +CParameter::CParameter(const char *name, const char *category, const char *initValue, bool multiLine, sint firstVersion, sint lastVersion) +{ + this->CParameter::CParameter(TypeString, name, category, firstVersion, lastVersion); + StringValue = initValue; + Integer = (sint32)multiLine; +} + +// *************************************************************************** + +#define NLMISC_REGISTER_CLASS2(_class_, _name_) NLMISC::CClassRegistry::registerClass(#_name_, _class_::creator, typeid(_class_).name()); + +void NLTEXGEN::registerTypes() +{ + ITexGenOperator::DefaultBitmap.resize (256, 256); + float *pixels = ITexGenOperator::DefaultBitmap.getPixels(); + memset (pixels, 0, 256*256*4*sizeof(float)); + NLMISC_REGISTER_CLASS2(COpRoot, Rt); + NLMISC_REGISTER_CLASS2(COpFillColor, FC); + NLMISC_REGISTER_CLASS2(COpGradient, Gr); + NLMISC_REGISTER_CLASS2(COpLinearGradient, LG); + NLMISC_REGISTER_CLASS2(COpRadialGradient, RG); + NLMISC_REGISTER_CLASS2(COpAngularGradient, AG); + NLMISC_REGISTER_CLASS2(COpNoise, Ns); + NLMISC_REGISTER_CLASS2(COpBlur, Bl); + NLMISC_REGISTER_CLASS2(COpMix, Mi); + NLMISC_REGISTER_CLASS2(COpContrastLuminosity, CL); + NLMISC_REGISTER_CLASS2(COpHueSaturation, HS); + NLMISC_REGISTER_CLASS2(COpNormalize, No); + NLMISC_REGISTER_CLASS2(COpLight, Li); + NLMISC_REGISTER_CLASS2(COpTransform, Tr); + NLMISC_REGISTER_CLASS2(COpSinus, Si); + NLMISC_REGISTER_CLASS2(COpBackground, Bg); + NLMISC_REGISTER_CLASS2(COpBars, Ba); + NLMISC_REGISTER_CLASS2(COpClouds, Cl); + NLMISC_REGISTER_CLASS2(COpFont, Ft); + NLMISC_REGISTER_CLASS2(COpQuad, Qd); + NLMISC_REGISTER_CLASS2(COpCellular, Cr); +} + +// *************************************************************************** + +void CParameter::serial(NLMISC::IStream &s) +{ + uint8 value = (uint8)Type; + s.serial (value); + Type = (TType)value; + + switch (Type) + { + case TypeEnum: + case TypeBool: + { + value = (uint8)Integer; + s.serial (value); + Integer = (sint32)value; + } + break; + case TypeInt: + s.serial (Integer); + break; + case TypeColor: + s.serial (Color[0]); + s.serial (Color[1]); + s.serial (Color[2]); + s.serial (Color[3]); + break; + case TypeFloat: + s.serial (Value); + break; + case TypeGradient: + s.serialCont (Gradient); + break; + case TypeString: + s.serial (StringValue); + break; + } +} + +// *************************************************************************** + +void CGradientColor::serial(NLMISC::IStream &s) +{ + s.serial (Color[0]); + s.serial (Color[1]); + s.serial (Color[2]); + s.serial (Color[3]); + s.serial (RightPos); + s.serial (RightQuadratic); + + s.serial (Pos); +} + +// *************************************************************************** + +CGradientColor::CGradientColor () +{ + RightPos = 0.5f; + RightQuadratic = false; +} + +// *************************************************************************** + +CFloatValueSetup::CFloatValueSetup (TFormula formula, const char *unit, float valueOrigine, float valueTour, float epsilon, bool multitour, bool centered, + const float *snapedValues, uint snapedValuesCount, float valueLeft, float valueRight) +{ + Formula = formula; + Unit = unit; + ValueOrigine = valueOrigine; + ValueTour = valueTour; + Epsilon = epsilon; + MultiTour = multitour; + CenterOrigine = centered; + SnapedValues = snapedValues; + SnapedValuesCount = snapedValuesCount; + ValueLeft = valueLeft; + ValueRight = valueRight; +} + +// *************************************************************************** + +const float SnapAngles[17]= +{ + 0, + 45, + 90, + 135, + 180, + 225, + 270, + 315, + 360, + -45, + -90, + -135, + -180, + -225, + -270, + -315, + -360, +}; + +const float SnapScale[17]= +{ + 1, + 2, + 4, + 8, + 16, + 32, + 64, + 127, + 256, + 1.f/2.f, + 1.f/4.f, + 1.f/8.f, + 1.f/16.f, + 1.f/32.f, + 1.f/64.f, + 1.f/128.f, + 1.f/256.f, +}; + +const float SnapPixel[9]= +{ + 0, + 0.25f, + 0.5f, + 0.75f, + 1.f, + -0.25f, + -0.5f, + -0.75f, + -1.f, +}; + +const float Snap1[9] = +{ + 0, + 0.5f, + 1.f, + 1.5f, + 2.f, + -0.5f, + -1.f, + -1.5f, + -2.f, +}; + +const float Snap10[9] = +{ + 0, + 5, + 10, + 15, + 20, + -5, + -10, + -15, + -20, +}; + +CFloatValueSetup PercentSetup (CFloatValueSetup::Linear, "%", 0, 100, 0.001f, false, false, NULL, 0, 0, 100); +CFloatValueSetup RandomSetup (CFloatValueSetup::Linear, "", 0, 1, 0.001f, false, false, NULL, 0, 0, 1); +CFloatValueSetup CenteredMT1_1Setup (CFloatValueSetup::Linear, "", 0, 1, 0.001f, true, true, Snap1, 9); +CFloatValueSetup CenteredMT10_10Setup (CFloatValueSetup::Linear, "", 0, 20, 0.001f, true, true, Snap10, 9); +CFloatValueSetup AngleSetup (CFloatValueSetup::Linear, "°", 0, 360, 0.001f, true, true, SnapAngles, 17); +CFloatValueSetup ScaleSetup (CFloatValueSetup::TwoPower, "times", 0, 2, 0.001f, true, true, SnapScale, 17); +CFloatValueSetup PixelSetup (CFloatValueSetup::Linear, "times", 0, 1, 0.001f, true, true, SnapPixel, 9); + +sint FileVersion; + +} + +/* End of basics.cpp */ diff --git a/src/tex_gen/basics.h b/src/tex_gen/basics.h new file mode 100644 index 0000000..a52a8f6 --- /dev/null +++ b/src/tex_gen/basics.h @@ -0,0 +1,288 @@ +/** \file basics.h + * Basic types + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_BASICS +#define NL_BASICS + +#include "nel/misc/types_nl.h" + +namespace NLTEXGEN +{ + +#define NLTEXGEN_SIZE_MIN 1 +#define NLTEXGEN_SIZE_MAX 2048 + +// *************************************************************************** + +enum TBlendMode +{ + Replace = 0, + Mul, + Add, + Sub, + RSub, + Screen, + Darken, + Lighten, + Difference, + Negation, + Exclusion, + Overlay, + HardLight, + SoftLight, + ColorDodge, + RColorDodge, + ColorBurn, + RColorBurn, + Invert, + + NumBlendMode +}; + +// *************************************************************************** + +extern const char *BlendModeName[NumBlendMode]; + +// *************************************************************************** + +class CGradientColor +{ +public: + CGradientColor (); + + // The color + float Color[4]; + + // The color position + float Pos; + + // The tangeant position + float RightPos; + bool RightQuadratic; + + // Operators + bool operator<(const CGradientColor &other) const + { + return Pos < other.Pos; + } + + bool operator==(const CGradientColor &other) const + { + return (Pos == other.Pos) && (RightPos == other.RightPos) && (RightQuadratic && other.RightQuadratic) && + (Color[0] == other.Color[0]) && (Color[1] == other.Color[1]) && (Color[2] == other.Color[2]) && + (Color[3] == other.Color[3]); + } + + // Serial this parameter + void serial(NLMISC::IStream &s); +}; + +// *************************************************************************** + +class CFloatValueSetup +{ +public: + + enum TFormula + { + Linear, + TwoPower, + } Formula; + + CFloatValueSetup () {} + CFloatValueSetup (TFormula formula, const char *unit, float valueOrigine, float valueTour, float epsilon, bool multitour, bool centered, + const float *snapedValues = NULL, uint SnapedValuesCount = 0, float valueLeft=-FLT_MAX, float valueRight=FLT_MAX); + + // Snaped value + const char *Unit; + bool MultiTour; + bool CenterOrigine; + float ValueOrigine; + float ValueLeft; + float ValueRight; + float ValueTour; + float Epsilon; + + const float *SnapedValues; + uint SnapedValuesCount; +}; + +// *************************************************************************** + +/// A parameter +class CParameter +{ +public: + enum TType + { + TypeEnum = 0, // Blend mode parameter, result in Integer + TypeColor, // A simple color, result in Floats + TypeFloat, // 0 ~ 1 float edited with a slider, no value feedback, result in Floats[0] + TypeInt, // An integer value to set with an edit box and spinners + TypeGradient, // A color gradient + TypeBool, // A Boolean + TypeString, // A String + } Type; + + CParameter() {}; + + // Generic constructor + CParameter(TType type, const char *name, const char *category, sint firstVersion=0, sint lastVersion=0x7fffffff); + + // Enum constructor + CParameter(const char *name, const char *category, const char **enumString, int numString, sint firstVersion=0, sint lastVersion=0x7fffffff); + + // Integer constructor + CParameter(const char *name, const char *category, sint min, sint max, sint firstVersion=0, sint lastVersion=0x7fffffff); + + // Float constructor + CParameter(const char *name, const char *category, const CFloatValueSetup &setup, sint firstVersion=0, sint lastVersion=0x7fffffff); + + // Bool constructor + CParameter(const char *name, const char *category, bool value, sint firstVersion=0, sint lastVersion=0x7fffffff); + + // String constructor + CParameter(const char *name, const char *category, const char *value, bool multiLine, sint firstVersion=0, sint lastVersion=0x7fffffff); + + // Parameter name + const char *Name; + + // Parameter category + const char *Category; + + // Color + float Color[4]; + + // Floats + float Value; + + // The setup for float value + CFloatValueSetup Setup; + + // Gradiant + std::vector Gradient; + + // Integer + sint32 Integer; + sint32 IntegerMin; + sint32 IntegerMax; + + // Enum strings + const char **EnumString; + + // The string + std::string StringValue; + + // Version where this parameter exist + sint FirstVersion; + sint LastVersion; + + // Serial this parameter + void serial(NLMISC::IStream &s); +}; + +// *************************************************************************** + +/// An input descriptor +class CInput +{ +public: + + CInput(const char* name) + { + Name = name; + } + + std::string Name; +}; + +// *************************************************************************** + +enum TChannel +{ + ChannelNone = 0, + ChannelRGB = 1, + ChannelAlpha = 2, + ChannelAll = -1, +}; + +// *************************************************************************** + +#define NL_DECLARE_COPY_OPERATOR(type,parent_type) \ + parent_type *copy() const \ + { \ + type *newObject = new type; \ + *newObject = *this; \ + return newObject; \ + } + +// *************************************************************************** + +void registerTypes(); + +// *************************************************************************** + +const float ColorBlack[4] = {0, 0, 0, 1}; +const float ColorRed[4] = {1, 0, 0, 1}; +const float ColorGreen[4] = {0, 1, 0, 1}; +const float ColorYellow[4] = {1, 1, 0, 1}; +const float ColorBlue[4] = {0, 0, 1, 1}; +const float ColorMagenta[4] = {1, 0, 1, 1}; +const float ColorCyan[4] = {0, 1, 1, 1}; +const float ColorWhite[4] = {1, 1, 1, 1}; + +// *************************************************************************** + +class CRenderParameter +{ +public: + CRenderParameter (bool cache, bool draft, bool showHelpers) + { + Cache = cache; + Draft = draft; + ShowHelpers = showHelpers; + } + bool Cache; // Render the operator in a cash + bool Draft; // Render in draft mode + bool ShowHelpers; // Show helpers +}; + +// *************************************************************************** + +// Some setup +extern CFloatValueSetup PercentSetup; +extern CFloatValueSetup RandomSetup; +extern CFloatValueSetup CenteredMT1_1Setup; +extern CFloatValueSetup CenteredMT10_10Setup; +extern CFloatValueSetup AngleSetup; +extern CFloatValueSetup ScaleSetup; +extern CFloatValueSetup PixelSetup; +extern sint FileVersion; + +} // NLTEXGEN + +#endif // NL_BASICS + +/* End of basics.h */ diff --git a/src/tex_gen/bitmap_f.cpp b/src/tex_gen/bitmap_f.cpp new file mode 100644 index 0000000..16df637 --- /dev/null +++ b/src/tex_gen/bitmap_f.cpp @@ -0,0 +1,119 @@ +/** \file bitmap_float.cpp + * Float bitmap + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdtex_gen.h" +#include "bitmap_float.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** + +friend void operator=(NLMISC::CBitmap &bitmap, const CFloatBitmap &bitmapF) +{ + // Erase ghost copy + _GhostCopy = NULL; + + // Resize the dest bitmap + bitmap.resize(bitmapF._Width, bitmapF._Height, CBitmpa::RGBA); + + // Copy the pixels + const uint count = bitmapF._Width*bitmapF._Height*4; + uint i; + const float *src = &(bitmapF._Pixels[0]); + uint8 *dest = &(bitmap.getPixels()[0]); + for (i=0; i_Width, copy->_Height, CBitmap::RGBA); + + // Copy the pixels + const uint count = copy->_Width*copy->_Height*4; + uint i; + if (count) + { + const float *src = &(copy->_Pixels[0]); + uint8 *dest = &(bitmap.getPixels()[0]); + for (i=0; i_Width*copy->_Height*4; + uint i; + if (count) + { + const float *src = &(copy->_Pixels[0]); + uint8 *dest = &(bitmap.getPixels()[0]); + for (i=0; i_Width; + _Height = copy->_Height; + _Pixels = copy->_Pixels; + _MipMapsBuilded = copy->_MipMapsBuilded; + if (_MipMapsBuilded) + _MipMaps = copy->_MipMaps; + + // Erase ghost copy + _GhostCopy = NULL; +} + +// *************************************************************************** + +void CFloatBitmap::ghostCopy(const CFloatBitmap *bitmap) +{ + if (bitmap->_GhostCopy) + _GhostCopy = bitmap->_GhostCopy; + else + _GhostCopy = bitmap; +} + +// *************************************************************************** + +void CFloatBitmap::resample (uint width, uint height) +{ + // Erase ghost copy + const CFloatBitmap *copy; + if (_GhostCopy) + copy = _GhostCopy; + else + copy = this; + if ((copy->_Width != width) || (copy->_Height != height)) + { + _MipMapsBuilded = false; + + uint originalWidth = copy->_Width; + uint originalHeight = copy->_Height; + + bool bXMag=(width>=originalWidth); + bool bYMag=(height>=originalHeight); + bool bXEq=(width==originalWidth); + bool bYEq=(height==originalHeight); + std::vector pIterm (width*originalHeight); + CFloatBitmap temp; + temp = *this; + + // Erase ghost copy + _GhostCopy = NULL; + + float *pSrc = &(temp._Pixels[0]); + resize(width, height); + float *pDest = &(_Pixels[0]); + + if (bXMag) + { + float fXdelta=(float)(originalWidth)/(float)(width); + NLMISC::CRGBAF *pItermPtr=&*pIterm.begin(); + uint nY; + for (nY=0; nY=0.f); + NLMISC::CRGBAF vColor; + const uint index = 4*(uint)floor(fX); + if (fVirgule>=0.5f) + { + if (fX<(float)(originalWidth-1)) + { + NLMISC::CRGBAF vColor1 (pSrcLine[index], pSrcLine[index+1], + pSrcLine[index+2], pSrcLine[index+3]); + NLMISC::CRGBAF vColor2 (pSrcLine[index+4], pSrcLine[index+5], + pSrcLine[index+6], pSrcLine[index+7]); + vColor=vColor1*(1.5f-fVirgule)+vColor2*(fVirgule-0.5f); + } + else + vColor.set(pSrcLine[index], pSrcLine[index+1], + pSrcLine[index+2], pSrcLine[index+3]); + } + else + { + if (fX>=1.f) + { + NLMISC::CRGBAF vColor1 (pSrcLine[index], pSrcLine[index+1], + pSrcLine[index+2], pSrcLine[index+3]); + NLMISC::CRGBAF vColor2 (pSrcLine[index-4], pSrcLine[index-3], + pSrcLine[index-2], pSrcLine[index-1]); + vColor=vColor1*(0.5f+fVirgule)+vColor2*(0.5f-fVirgule); + } + else + vColor.set(pSrcLine[index], pSrcLine[index+1], + pSrcLine[index+2], pSrcLine[index+3]); + } + *(pItermPtr++)=vColor; + fX+=fXdelta; + } + pSrc+=4*originalWidth; + } + } + else if (bXEq) + { + NLMISC::CRGBAF *pItermPtr=&*pIterm.begin(); + for (uint nY=0; nYset (pSrcLine[x4], pSrcLine[x4+1], pSrcLine[x4+2], pSrcLine[x4+3]); + } + pSrc+=4*originalWidth; + } + } + else + { + double fXdelta=(double)(originalWidth)/(double)(width); + nlassert (fXdelta>1.f); + NLMISC::CRGBAF *pItermPtr=&*pIterm.begin(); + uint nY; + for (nY=0; nYfFinal) + fNext=fFinal; + const uint index = 4*(uint)floor(fX); + vColor+=((float)(fNext-fX))*NLMISC::CRGBAF (pSrcLine[index], pSrcLine[index+1], pSrcLine[index+2], pSrcLine[index+3]); + fX=fNext; + } + nlassert (fX==fFinal); + vColor/=(float)fXdelta; + *(pItermPtr++)=vColor; + } + pSrc+=4*originalWidth; + } + } + + if (bYMag) + { + double fYdelta=(double)(originalHeight)/(double)(height); + uint nX; + for (nX=0; nX=0.f); + NLMISC::CRGBAF vColor; + if (fVirgule>=0.5f) + { + if (fY<(double)(originalHeight-1)) + { + NLMISC::CRGBAF vColor1=pIterm[((uint)floor(fY))*width+nX]; + NLMISC::CRGBAF vColor2=pIterm[(((uint)floor(fY))+1)*width+nX]; + vColor=vColor1*(1.5f-(float)fVirgule)+vColor2*((float)fVirgule-0.5f); + } + else + vColor=pIterm[((uint)floor(fY))*width+nX]; + } + else + { + if (fY>=1.f) + { + NLMISC::CRGBAF vColor1=pIterm[((uint)floor(fY))*width+nX]; + NLMISC::CRGBAF vColor2=pIterm[(((uint)floor(fY))-1)*width+nX]; + vColor=vColor1*(0.5f+(float)fVirgule)+vColor2*(0.5f-(float)fVirgule); + } + else + vColor=pIterm[((uint)floor(fY))*width+nX]; + } + const uint index = 4*(nX+nY*width); + pDest[index]=vColor.R; + pDest[index+1]=vColor.G; + pDest[index+2]=vColor.B; + pDest[index+3]=vColor.A; + fY+=fYdelta; + } + } + } + else if (bYEq) + { + for (uint nX=0; nX1.f); + uint nX; + for (nX=0; nXfFinal) + fNext=fFinal; + vColor+=((float)(fNext-fY))*pIterm[((uint)floor(fY))*width+nX]; + fY=fNext; + } + vColor/=(float)fYdelta; + const uint index = 4*(nX+nY*width); + pDest[index]=vColor.R; + pDest[index+1]=vColor.G; + pDest[index+2]=vColor.B; + pDest[index+3]=vColor.A; + } + } + } + + } +} + +// *************************************************************************** + +void CFloatBitmap::buildMipMaps () const +{ + // Should not be a ghost copy + nlassert (_GhostCopy==NULL); + + // Number of mipmaps + if (_Width && _Height) + { + uint mipMapCount = getMipMapCount() - 1; + + // Resize the array, never destroy bitmaps + _MipMaps.resize (mipMapCount); + + // Previous pixels + const float *previous = &(_Pixels[0]); + uint previousWidth = _Width; + uint previousHeight = _Height; + uint i; + for (i=0; i>1, (uint)1); + uint height = std::max (previousHeight>>1, (uint)1); + _MipMaps[i].resize (width*height*4); + + // Destination pointer + float *dst = &(_MipMaps[i][0]); + + uint x, y; + uint previousLineSize = previousWidth << 2; + for (y=0; y_Pixels.empty()) + return NULL; + return &(bitmap->_Pixels[0]); + } + else + { + // Mipmaps builded ? + if (!bitmap->_MipMapsBuilded) + bitmap->buildMipMaps(); + + nlassert ((mipMap-1) < bitmap->_MipMaps.size ()); + return &(bitmap->_MipMaps[mipMap-1][0]); + } + } + + // Resize the bitmap + void resize(uint width, uint height); + + // Get the width + uint getWidth() const + { + if (_GhostCopy) + return _GhostCopy->_Width; + else + return _Width; + } + + // Get the height + uint getHeight() const + { + if (_GhostCopy) + return _GhostCopy->_Height; + else + return _Height; + } + + // Get the size of the bitmap in pixels. + uint size() const + { + return getWidth()*getHeight(); + } + + // Get number of mipmap + uint getMipMapCount() const + { + const CFloatBitmap *bitmap = _GhostCopy ? _GhostCopy : this; + return std::max(NLMISC::getPowerOf2 (bitmap->_Width), NLMISC::getPowerOf2(bitmap->_Height)) + 1; + } + + // Ghost copy + void ghostCopy(const CFloatBitmap *bitmap); + + // Export to a NLMISC::CBitmap + void export(NLMISC::CBitmap &bitmap) const; + + // Export alpha to a NLMISC::CBitmap : warning you should have ccalled export before call this + void exportAlpha(NLMISC::CBitmap &bitmap) const; + + // Copy from a NLMISC::CBitmap + void operator=(const NLMISC::CBitmap &bitmap); + + // Hard copy + void operator=(const CFloatBitmap &bitmap); + + // Resample + void resample (uint width, uint height); + +protected: + + // Build the mipmaps + void buildMipMaps () const; + + // The pixels + const CFloatBitmap *_GhostCopy; + + // The pixels + std::vector _Pixels; + + // The mipmaps + mutable std::vector > _MipMaps; + + // The size + uint _Width; + uint _Height; + + // Mipmaps builded ? + mutable bool _MipMapsBuilded; +}; + +// *************************************************************************** + +} // NLTEXGEN + +#endif // NL_FLOAT_BITMAP + +/* End of bitmap_float.h */ diff --git a/src/tex_gen/op_angular_gradient.cpp b/src/tex_gen/op_angular_gradient.cpp new file mode 100644 index 0000000..19552a4 --- /dev/null +++ b/src/tex_gen/op_angular_gradient.cpp @@ -0,0 +1,170 @@ +/** \file op_angular_gradient.cpp + * Angular gradient operator + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdtex_gen.h" +#include "op_angular_gradient.h" +#include "transform_float.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** + +COpAngularGradient::COpAngularGradient() +{ + // One input + _Inputs.push_back(CInput("offset")); + + // Parameters + _Parameters.push_back (CParameter("mirror", "gradient", false)); + _Parameters.push_back (CParameter("tile", "gradient", true)); + _Parameters.push_back (CParameter("invert", "gradient", false)); + _Parameters.push_back (CParameter("scale", "gradient", ScaleSetup, 1)); + _Parameters.push_back (CParameter("rotation", "gradient", AngleSetup)); + _Parameters.push_back (CParameter(CParameter::TypeGradient, "gradient", "gradient")); + + // Default gradient + CGradientColor black; + CGradientColor white; + NLTEXGEN::copy (black.Color, ColorBlack); + black.Pos = 0; + NLTEXGEN::copy (white.Color, ColorWhite); + white.Pos = 1; + _Parameters[Gradient].Gradient.push_back (black); + _Parameters[Gradient].Gradient.push_back (white); + _Parameters[Scale].Value = 1; +} + +// *************************************************************************** + +TChannel COpAngularGradient::modifyLayer (CFloatBitmap &output, const CRenderParameter &renderParameters) +{ + const uint width = output.getWidth(); + const uint height = output.getHeight(); + const float fWidth = (float)width; + const float fHeight = (float)height; + + // Eval the mask + const float *offsetPixels = NULL; + CFloatBitmap offsetBitmap; + if (const_cast(this)->getBindedOp(OffsetInput)) + { + evalSubOp (offsetBitmap, OffsetInput, renderParameters); + offsetBitmap.resample (output.getWidth(), output.getHeight()); + offsetPixels = const_cast(&offsetBitmap)->getPixels(); + } + + const float dY = 2.f / fHeight; + const float dX = 2.f / fWidth; + const float offset = -_Parameters[Offset].Value/360; + const bool tile = _Parameters[Tile].Integer != 0; + const bool invert = _Parameters[Invert].Integer != 0; + float *dst = output.getPixels(); + const float oo2pi = 1.f / (_Parameters[Scale].Value * 2.f * (float)NLMISC::Pi); + if (dst) + { + // Build a gradient + float gradients[2048*4]; + uint i; + for (i=0; i<2048; i++) + gradient (gradients+i*4, _Parameters[Gradient].Gradient, (float)i/2048.f); + + if (_Parameters[Mirror].Integer) + { + // Mirror + + uint x, y; + float fy = -1.f + dY / 2.f; + for (y=0; y=0.5f) + tmp = 1.f - tmp; + int index = (int)(4196.f * tmp); + clamp (index, 0, 2047); + if (invert) + index = 2047 - index; + const uint tmpI = index*4; + dst[0] = gradients[tmpI]; + dst[1] = gradients[tmpI+1]; + dst[2] = gradients[tmpI+2]; + } + } + } + else + { + // No mirror + + uint x, y; + float fy = -1.f + dY / 2.f; + for (y=0; y= heightMax) && (gradient < (GRADIENT_COUNT-1))) + { + gradient++; + heightMaxFloat += _Parameters[Height0+2*gradient].Value / 100.f; + heightMax = (uint)floor(0.5f + heightMaxFloat*(float)width); + } + + memcpy (dst, gradients + gradient*2048*4, width*4*sizeof(float)); + } + + return ChannelRGB; +} + +// *************************************************************************** + +/* End of op_bars.cpp */ diff --git a/src/tex_gen/op_bars.h b/src/tex_gen/op_bars.h new file mode 100644 index 0000000..a7237ff --- /dev/null +++ b/src/tex_gen/op_bars.h @@ -0,0 +1,85 @@ +/** \file op_bars.h + * Bars operator. + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_OP_BARS +#define NL_OP_BARS + +#include "tex_gen/tex_gen_op.h" +#include "tex_gen/op_layer.h" + + +namespace NLTEXGEN +{ + +/** + * Bars operator. + * + * \author Cyril 'Hulud' Corvazier + * \author DIGITAL MURDER + * \date 2003 + */ +class COpBars : public IOpLayer +{ +public: + + enum TInput + { + LastInput, + }; + + enum TParameter + { + Gradient0 = IOpLayer::LastParameter, + Height0, + Gradient1, + Height1, + Gradient2, + Height2, + Gradient3, + Height3, + LastParameter, + }; + + // Ctor. Init inputs and parameters + COpBars(); + + // \from IOpLayer + virtual TChannel modifyLayer (CFloatBitmap &output, const CRenderParameter &renderParameters); + + // Streamable + NLMISC_DECLARE_CLASS2(COpBars, Ba); + + // Clone operator + NL_DECLARE_COPY_OPERATOR(COpBars, ITexGenOperator); +}; + +// *************************************************************************** + +} // NLTEXGEN + + +#endif // NL_OP_BARS + +/* End of op_bars.h */ diff --git a/src/tex_gen/op_blur.cpp b/src/tex_gen/op_blur.cpp new file mode 100644 index 0000000..0c4d836 --- /dev/null +++ b/src/tex_gen/op_blur.cpp @@ -0,0 +1,141 @@ +/** \file op_blur.cpp + * Gaussian blur + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdtex_gen.h" +#include "op_blur.h" +#include "transform_float.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** + +COpBlur::COpBlur() +{ + // Parameters + CFloatValueSetup radius (CFloatValueSetup::Linear, "pixels", 0.01f, 10, 0.001f, false, false, NULL, 0, 0.01f, 10); + _Parameters.push_back (CParameter("radius", "blur", radius)); + CFloatValueSetup quality (CFloatValueSetup::Linear, "times the radius", 0.01f, 5, 0.001f, false, false, NULL, 0, 0.01f, 5); + _Parameters.push_back (CParameter("quality", "blur", quality)); + CFloatValueSetup intensity (CFloatValueSetup::Linear, "times", 0, 5, 0.001f, false, false, NULL, 0); + _Parameters.push_back (CParameter("intensity", "blur", intensity)); + _Parameters.push_back (CParameter("up", "blur", true, 2)); + _Parameters.push_back (CParameter("down", "blur", true, 2)); + _Parameters.push_back (CParameter("left", "blur", true, 2)); + _Parameters.push_back (CParameter("right", "blur", true, 2)); + _Parameters[Intensity].Value = 1; + _Parameters[Radius].Value = 0.01f; + _Parameters[Quality].Value = 1; +} + +// *************************************************************************** + +TChannel COpBlur::modifyColor (CFloatBitmap &output, const CFloatBitmap &input, const CRenderParameter &renderParameters) +{ + // Blend the input and output + output.resize (input.getWidth(), input.getHeight()); + float *out = output.getPixels(); + const float *in = input.getPixels(); + + // Random + const float intensity = _Parameters[Intensity].Value; + const float radius = _Parameters[Radius].Value; + const float quality = _Parameters[Quality].Value; + const uint iradius = 2*((uint)(quality*radius) + 1); + + // Init the gaussian + vector gaussian; + gaussian.resize (iradius); + sint i; + for (i=0; i<(sint)iradius; i++) + gaussian[i] = (float)(exp(-(double)(i*i)/(2*(double)radius*(double)radius)) * ((double)radius * sqrt(2.0*NLMISC::Pi))); + float sum = 0; + for (i=1-iradius; i<(sint)iradius; i++) + sum += gaussian[abs(i)]; + for (i=0; i<(sint)iradius; i++) + { + gaussian[i] *= intensity; + gaussian[i] /= sum; + } + float *gaussianPixels = &(gaussian[0]); + + CFloatBitmap tempBitmap; + tempBitmap.resize (output.getWidth(), output.getHeight()); + float *temp = tempBitmap.getPixels(); + memset (temp, 0, tempBitmap.size()*4*sizeof(float)); + + const uint width = output.getWidth(); + const uint height = output.getHeight(); + const uint widthMask = width-1; + const uint heightMask = height-1; + + const sint up = _Parameters[Up].Integer ? iradius:1; + const sint down = _Parameters[Down].Integer ? 1-iradius:0; + const sint left = _Parameters[Left].Integer ? iradius:1; + const sint right = _Parameters[Right].Integer ? 1-iradius:0; + + uint x, y; + for (y=0; y 0.5f) + dx = 1.f - dx; + if (dy > 0.5f) + dy = 1.f - dy; + float temp = r1 + r0; + return (dx*dx+dy*dy) < (temp*temp); +} + +// *************************************************************************** + +inline float wrap (float value) +{ + if (value < -0.5f) + return - 1.f - value; + else if (value > 0.5f) + return 1.f - value; + else + return value; +} + +// *************************************************************************** + +class CSphereTree +{ +public: + CSphereTree (float x0, float y0, float x1, float y1) + { + X0 = x0; + Y0 = y0; + X1 = x1; + Y1 = y1; + Child0 = NULL; + Child1 = NULL; + Radius = 0; + } + + ~CSphereTree() + { + if (Child0) + delete Child0; + if (Child1) + delete Child1; + } + + void addPoint (float x, float y) + { + CSphereTree *parent; + if (findLeave (x, y, parent)) + parent->Child0 = new CSphereTree (parent->X0, parent->Y0, x, y); + else + parent->Child1 = new CSphereTree (parent->X1, parent->Y1, x, y); + } + + void balanceRadius () + { + if (Child0) + Child0->balanceRadius (); + + if (Child1) + Child1->balanceRadius (); + + if (Child0) + { + if (Child1) + { + addSphere (Xc, Yc, Radius, Child0->Xc, Child0->Yc, Child0->Radius, + Child1->Xc, Child1->Yc, Child1->Radius); + } + else + { + addSphere (Xc, Yc, Radius, Child0->Xc, Child0->Yc, Child0->Radius, + X1, Y1, 0); + } + } + else + { + if (Child1) + { + addSphere (Xc, Yc, Radius, Child1->Xc, Child1->Yc, Child1->Radius, + X0, Y0, 0); + } + else + { + addSphere (Xc, Yc, Radius, X0, Y0, 0, X1, Y1, 0); + } + } + } + + class CFindStruct + { + public: + CFindStruct (CSphereTree &root, float x, float y) + { + X = x; + Y = y; + float dx = wrap (X - root.X0); + float dy = wrap (Y - root.Y0); + RadiusSq = dx*dx+dy*dy; + Radius = (float)sqrt(RadiusSq); + RadiusSq2 = FLT_MAX; + Radius2 = FLT_MAX; + } + float X; + float Y; + float Radius; + float RadiusSq; + float Radius2; + float RadiusSq2; + }; + + void findCloser (CFindStruct &find) + { + // Intersect ? + if (sphereIntersect (find.X, find.Y, find.Radius, Xc, Yc, Radius)) + { + // Check the new point + float dx = wrap (X1 - find.X); + float dy = wrap (Y1 - find.Y); + const float dist = dx*dx+dy*dy; + if (dist < find.RadiusSq) + { + find.RadiusSq = dist; + find.Radius = (float)sqrt(dist); + + if (Child1) + Child1->findCloser (find); + if (Child0) + Child0->findCloser (find); + } + else + { + if (Child0) + Child0->findCloser (find); + if (Child1) + Child1->findCloser (find); + } + } + } + + void find2Closers (CFindStruct &find) + { + // Intersect ? + if (sphereIntersect (find.X, find.Y, find.Radius2, Xc, Yc, Radius)) + { + // Check the new point + float dx = wrap (X1 - find.X); + float dy = wrap (Y1 - find.Y); + const float dist = dx*dx+dy*dy; + if (dist < find.RadiusSq) + { + find.RadiusSq2 = find.RadiusSq; + find.Radius2 = find.Radius; + find.RadiusSq = dist; + find.Radius = (float)sqrt(dist); + + if (Child1) + Child1->find2Closers (find); + if (Child0) + Child0->find2Closers (find); + } + else + { + if (dist < find.RadiusSq2) + { + find.RadiusSq2 = dist; + find.Radius2 = (float)sqrt(dist); + } + + if (Child0) + Child0->find2Closers (find); + if (Child1) + Child1->find2Closers (find); + } + } + } + +public: + // Returns true for point 0, false for point 1 + bool findLeave (float x, float y, CSphereTree *&parent) + { + CSphereTree *node = this; + bool left; + while (node) + { + parent = node; + // todo tile here + float x0 = node->X0-x; + float y0 = node->Y0-y; + float x1 = node->X1-x; + float y1 = node->Y1-y; + if ((x0*x0+y0*y0) < (x1*x1+y1*y1)) + { + node = node->Child0; + left = true; + } + else + { + node = node->Child1; + left = false; + } + } + return left; + } + + float X0, Y0; + float X1, Y1; + float Xc, Yc; + float Radius; + CSphereTree *Child0; + CSphereTree *Child1; +}; + +TChannel COpCellular::modifyLayer (CFloatBitmap &output, const CRenderParameter &renderParameters) +{ + // Blend the input and output + float *out = output.getPixels(); + + // Random + TRandomValue random = getRandomValue (_Parameters[Seed].Value); + + // Build the data structure + float t0 = getNextRandomValue(random); + float t1 = getNextRandomValue(random); + float t2 = getNextRandomValue(random); + float t3 = getNextRandomValue(random); + CSphereTree root (t0, t1, t2, t3); + + // Add the points + uint i; + const uint count = (uint)_Parameters[Points].Value; + for (i=2; i maxValue) + maxValue = value; + + out[0] = value; + } + } + const uint count2 = output.size(); + out = output.getPixels(); + const float delta = 1.f / (maxValue - minValue); + for (i=0; i noisePattern; + std::vector tempPattern; + noisePattern.resize (width*height); + tempPattern.resize (width*height); + uint i; + const uint count = output.size(); + for (i=0; i>(level-_Parameters[FirstHarmonic].Integer); + uint patternHeight2 = height>>(level-_Parameters[FirstHarmonic].Integer); + uint patternWidthMask = patternWidth2-1; + uint patternHeightMask = patternHeight2-1; + float normalize = 0; + while (level >= (uint)_Parameters[FirstHarmonic].Integer) + { + uint exp = level; + float expf = 1; + while (exp--) + expf *= persistence; + normalize += expf; + if (level <= (uint)_Parameters[FirstHarmonic].Integer) + break; + level--; + } + + // Intensity + normalize /= _Parameters[Intensity].Value; + + uint levelEnd = getPowerOf2 (std::min(patternWidth, patternHeight)); + level = _Parameters[FirstHarmonic].Integer; + uint zoomFactor = 1 << (levelEnd-1-_Parameters[FirstHarmonic].Integer); + float *src = &(tempPattern[0]); + while (level < levelEnd) + { + // Zoom the noise pattern + const float oo_zoomfactor = 1.f / (float)zoomFactor; + float *patternNoise = &(noisePattern[0]); + const uint lineSize = patternWidth*zoomFactor; + uint x,y; + for (y=0; y>=1; + } + + return ChannelRGB; +} + +// *************************************************************************** + +/* End of op_clouds.cpp */ diff --git a/src/tex_gen/op_clouds.h b/src/tex_gen/op_clouds.h new file mode 100644 index 0000000..36ad133 --- /dev/null +++ b/src/tex_gen/op_clouds.h @@ -0,0 +1,80 @@ +/** \file op_clouds.h + * Clouds operator. + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_OP_CLOUDS +#define NL_OP_CLOUDS + +#include "tex_gen/tex_gen_op.h" +#include "tex_gen/op_layer.h" + +namespace NLTEXGEN +{ + +/** + * Clouds operator. + * + * \author Cyril 'Hulud' Corvazier + * \author DIGITAL MURDER + * \date 2003 + */ +class COpClouds : public IOpLayer +{ +public: + + enum TInput + { + LastInput, + }; + + enum TParameter + { + Persistence = IOpLayer::LastParameter, + FirstHarmonic, + Seed, + Intensity, + LastParameter, + }; + + // Ctor. Init inputs and parameters + COpClouds(); + + // \from IOpLayer + virtual TChannel modifyLayer (CFloatBitmap &output, const CRenderParameter &renderParameters); + + // Streamable + NLMISC_DECLARE_CLASS2(COpClouds, Cl); + + // Clone operator + NL_DECLARE_COPY_OPERATOR(COpClouds, ITexGenOperator); +}; + +// *************************************************************************** + +} // NLTEXGEN + + +#endif // NL_OP_CLOUDS + +/* End of op_clouds.h */ diff --git a/src/tex_gen/op_color.cpp b/src/tex_gen/op_color.cpp new file mode 100644 index 0000000..93dafb6 --- /dev/null +++ b/src/tex_gen/op_color.cpp @@ -0,0 +1,136 @@ +/** \file op_color.cpp + * Color operator + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdtex_gen.h" +#include "op_color.h" +#include "transform_float.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** + +IOpColor::IOpColor() +{ + // Two inputs + _Inputs.push_back(CInput("source")); + _Inputs.push_back(CInput("mask")); + + // Parameters + _Parameters.push_back (CParameter("effect overlay", "effect", BlendModeName, NumBlendMode)); + _Parameters.push_back (CParameter("effect level", "effect", PercentSetup)); + _Parameters.push_back (CParameter("normalize (for normals)", "effect", false)); + _Parameters[Alpha].Value = 100.f; +} + +// *************************************************************************** + +TChannel IOpColor::evalInternal (CFloatBitmap &output, const CRenderParameter &renderParameters) +{ + TChannel channels; + + const float alpha = _Parameters[Alpha].Value / 100.f; + + // Alpha is 0 ? + if (alpha <= 0.f) + { + // Eval the first entry + channels = evalSubOp (output, 0, renderParameters); + } + else + { + // User mask ? + bool userMask = outputMask (); + + // Alpha is 1 with Replace ? + const ITexGenOperator *mask = const_cast(this)->getBindedOp(Mask); + if ( (alpha >= 1.f) && (_Parameters[BlendMode].Integer == Replace) && + (mask == NULL) && !userMask) + { + // Eval the first entry + CFloatBitmap temp; + channels = evalSubOp (temp, 0, renderParameters); + channels = (TChannel)(channels | modifyColor (output, temp, renderParameters)); + } + else + { + // Eval 1st argument + channels = evalSubOp (output, 0, renderParameters); + + // Eval the mask + CFloatBitmap maskBitmap; + if (mask) + { + evalSubOp (maskBitmap, Mask, renderParameters); + maskBitmap.resample (output.getWidth(), output.getHeight()); + } + + // Modify colors by the operator + CFloatBitmap effect; + channels = (TChannel)(channels | modifyColor (effect, output, renderParameters)); + nlassert (output.size() == effect.size()); + + // Blend the input and output + const float *in = const_cast(&effect)->getPixels(); + float *out = output.getPixels(); + + // Blend the pixels + if (userMask) + { + transformBlendSrc0Alpha (out, in, out, mask?const_cast(&maskBitmap)->getPixels():NULL, output.size()*4, (TBlendMode)_Parameters[BlendMode].Integer, + alpha); + } + else + { + transformBlend (out, in, out, mask?const_cast(&maskBitmap)->getPixels():NULL, output.size()*4, (TBlendMode)_Parameters[BlendMode].Integer, + channels, alpha); + } + } + } + + // Normalize ? + if (_Parameters[Normalize].Integer != 0) + { + float *out = output.getPixels(); + const uint count = output.size(); + uint i; + for (i=0; i + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** +const float SnapPixel[9]= +{ + 0, + 0.25f, + 0.5f, + 0.75f, + 1.f, + -0.25f, + -0.5f, + -0.75f, + -1.f, +}; + +const char *FontFileName[]= +{ + "arial.ttf", + "ariblk.ttf", + "arialbd.ttf", + "arialbi.ttf", + "ariali.ttf", + "comic.ttf", + "comicdb.ttf", + "cour.ttf", + "courdb.ttf", + "courbi.ttf", + "couri.ttf", + "georgia.ttf", + "georgiab.ttf", + "georgiaz.ttf", + "georgiai.ttf", + "impact.ttf", + "lucon.ttf", + "micross.ttf", + "symbol.ttf", + "tahoma.ttf", + "tahomabd.ttf", + "times.ttf", + "timesbd.ttf", + "timesbi.ttf", + "timesi.ttf", + "verdana.ttf", + "verdanab.ttf", + "verdanaz.ttf", + "verdanai.ttf", + "wingdings.ttf", +}; + +const char *FontName[]= +{ + "Arial", + "Arial Black", + "Arial Bold", + "Arial Bold Italic", + "Arial Italic", + "Comic", + "Comic Bold", + "Courier", + "Courier Bold", + "Courier Bold Italic", + "Courier", + "Georgia", + "Georgia Bold", + "Georgia Bold Italic", + "Georgia Italic", + "Impact", + "Lucon", + "Microsoft Sans Sherif", + "Symbol", + "Tahoma", + "Tahoma Bold", + "Times New Roman", + "Times New Roman Bold", + "Times New Roman Bold Italic", + "Times New Roman Italic", + "Verdana", + "Verdana Bold", + "Verdana Bold Italic", + "Verdana Italic", + "Wingdings", +}; + +#define NLTEXGEN_FONT_COUNT (sizeof(FontName)/sizeof(const char*)) + +COpFont::COpFont() +{ + CFloatValueSetup PixelPositiveSetup (CFloatValueSetup::Linear, "times", 0, 1, 0.001f, true, true, SnapPixel, 9, 0.0001f); + _Parameters.push_back (CParameter("text", "text", "", true)); + _Parameters.push_back (CParameter("font", "text", FontName, NLTEXGEN_FONT_COUNT)); + _Parameters.push_back (CParameter("height", "text", PixelPositiveSetup)); + _Parameters.push_back (CParameter("width factor", "text", ScaleSetup)); + _Parameters.push_back (CParameter("letter space", "text", PixelSetup)); + _Parameters.push_back (CParameter("line space", "text", ScaleSetup)); + _Parameters.push_back (CParameter(CParameter::TypeColor, "color", "text")); + _Parameters.push_back (CParameter("tile x", "text", true)); + _Parameters.push_back (CParameter("tile y", "text", true)); + _Parameters.push_back (CParameter("x", "text", PixelSetup)); + _Parameters.push_back (CParameter("y", "text", PixelSetup)); + + _Parameters[Height].Value = 0.1f; + _Parameters[WidthFactor].Value = 1; + _Parameters[LetterSpace].Value = 0; + _Parameters[LineSpace].Value = 1; + NLTEXGEN::copy(_Parameters[Foreground].Color, ColorWhite); + _Parameters[PositionX].Value = 0.5f; + _Parameters[PositionY].Value = 0.5f; +} + +// *************************************************************************** + +TChannel COpFont::modifyLayer (CFloatBitmap &output, const CRenderParameter &renderParameters) +{ + FT_Error error; + FT_Library library; + + // Parameters + + // todo set parameters + string &text = _Parameters[Text].StringValue; + string fontFileName; + if (_Parameters[Font].Integer < NLTEXGEN_FONT_COUNT) + { +#ifdef NL_OS_WINDOWS + char buffer[512]; + GetWindowsDirectory (buffer, 512); + fontFileName = buffer + string ("\\fonts\\"); +#endif NL_OS_WINDOWS + fontFileName += FontFileName[_Parameters[Font].Integer]; + } + uint32 charWidth = (uint32)floor(0.5f+(float)output.getHeight() * _Parameters[Height].Value * _Parameters[WidthFactor].Value); + uint32 charHeight = (uint32)floor(0.5f+(float)output.getHeight() * _Parameters[Height].Value); + float *foreground = _Parameters[Foreground].Color; + bool tileX = _Parameters[TileU].Integer != 0; + bool tileY = _Parameters[TileV].Integer != 0; + sint dstX = (sint)floor(0.5f+(float)output.getWidth() * _Parameters[PositionX].Value); + sint dstY = (sint)floor(0.5f+(float)output.getHeight() * _Parameters[PositionY].Value); + sint dstXBackup = dstX; + + // Fill the bitmap + foreground[3] = 0; + replaceConst (output.getPixels(), foreground, 4*output.size(), ChannelAll); + + CFloatBitmap tempBitmap; + + if ((charWidth != 0) && (charHeight != 0)) + { + error = FT_Init_FreeType (&library); + if (!error) + { + FT_Face face; + error = FT_New_Face (library, fontFileName.c_str(), 0, &face); + if (!error) + { + string fontEx; + + // try to see if the ex filename exists based on the fontExFileName + fontEx = CPath::lookup(CFile::getFilenameWithoutExtension (fontFileName)+".afm", false, false); + + if (fontEx != "") + { + FT_Attach_File (face, fontEx.c_str ()); + } + + error = FT_Select_Charmap (face, ft_encoding_unicode); + if (!error) + { + error = FT_Set_Pixel_Sizes (face, charWidth, charHeight); + if (!error) + { + uint i; + for (i=0; i=32) + { + // retrieve glyph index from character code + FT_UInt glyph_index = FT_Get_Char_Index (face, text[i]); + + // load glyph image into the slot (erase previous one) + error = FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT); + if (!error) + { + // convert to an anti-aliased bitmap + error = FT_Render_Glyph (face->glyph, ft_render_mode_normal); + if (!error) + { + uint width = face->glyph->bitmap.width; + uint height = face->glyph->bitmap.rows; + uint pitch = face->glyph->bitmap.pitch; + tempBitmap.resize (width, height); + + int left = face->glyph->bitmap_left; + int top = face->glyph->bitmap_top; + + int advx = face->glyph->advance.x; + + // Kerning + int kernx = 0; + if (i < (text.size()-1) && FT_HAS_KERNING(face)) + { + FT_Vector kerning; + FT_Error error = FT_Get_Kerning (face, text[i], text[i+1], ft_kerning_default, &kerning); + if (!error) + kernx = kerning.x; + } + + int glyphIndex = glyph_index; + + // Build the bitmap + uint8 *pixels = (uint8*)face->glyph->bitmap.buffer; + uint j; + const uint count = tempBitmap.size(); + float *dst = tempBitmap.getPixels(); + for (j=0; j>6)/* - kernx*/; + } + } + } + } + } + } + } + } + } + } + + + + return ChannelRGB; +} + +// *************************************************************************** + +/* End of op_font.cpp */ diff --git a/src/tex_gen/op_font.h b/src/tex_gen/op_font.h new file mode 100644 index 0000000..82749ed --- /dev/null +++ b/src/tex_gen/op_font.h @@ -0,0 +1,94 @@ +/** \file op_font.h + * Gradient operator + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_OP_FONT +#define NL_OP_FONT + +#include "tex_gen/tex_gen_op.h" +#include "tex_gen/op_layer.h" + + +namespace NLTEXGEN +{ + +/** + * Font operator. + * + * \author Cyril 'Hulud' Corvazier + * \author DIGITAL MURDER + * \date 2003 + */ +class COpFont : public IOpLayer +{ +public: + + enum TInput + { + LastInput = IOpColor::LastInput, + }; + + enum TParameter + { + Text = IOpColor::LastParameter, + Font, + Height, + WidthFactor, + LetterSpace, + LineSpace, + Foreground, + TileU, + TileV, + PositionX, + PositionY, + LastParameter, + }; + + // Ctor. Init inputs and parameters + COpFont(); + + // \from IOpLayer + virtual TChannel modifyLayer (CFloatBitmap &output, const CRenderParameter &renderParameters); + + // \from IOpColor + virtual bool outputMask () const + { + return true; + } + + // Streamable + NLMISC_DECLARE_CLASS2(COpFont, Ft); + + // Clone operator + NL_DECLARE_COPY_OPERATOR(COpFont, ITexGenOperator); +}; + +// *************************************************************************** + +} // NLTEXGEN + + +#endif // NL_OP_FONT + +/* End of op_font.h */ diff --git a/src/tex_gen/op_gradient.cpp b/src/tex_gen/op_gradient.cpp new file mode 100644 index 0000000..3e5afcd --- /dev/null +++ b/src/tex_gen/op_gradient.cpp @@ -0,0 +1,144 @@ +/** \file op_gradient.cpp + * Gradient operator + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdtex_gen.h" +#include "op_gradient.h" +#include "transform_float.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** + +COpGradient::COpGradient() +{ + // One input + _Inputs.push_back(CInput("offset")); + + // Parameters + _Parameters.push_back (CParameter("mirror", "gradient", false)); + _Parameters.push_back (CParameter("tile", "gradient", true)); + _Parameters.push_back (CParameter("invert", "gradient", false)); + _Parameters.push_back (CParameter("offset", "gradient", CenteredMT1_1Setup)); + _Parameters.push_back (CParameter(CParameter::TypeGradient, "gradient", "gradient")); + + // Default gradient + CGradientColor black; + CGradientColor white; + NLTEXGEN::copy (black.Color, ColorBlack); + black.Pos = 0; + NLTEXGEN::copy (white.Color, ColorWhite); + white.Pos = 1; + _Parameters[Gradient].Gradient.push_back (black); + _Parameters[Gradient].Gradient.push_back (white); +} + +// *************************************************************************** + +TChannel COpGradient::modifyColor (CFloatBitmap &output, const CFloatBitmap &input, const CRenderParameter &renderParameters) +{ + const uint count = input.size(); + output.resize (input.getWidth(), input.getHeight()); + + // Eval the mask + const float *offsetPixels = NULL; + CFloatBitmap offsetBitmap; + if (const_cast(this)->getBindedOp(OffsetInput)) + { + evalSubOp (offsetBitmap, OffsetInput, renderParameters); + offsetBitmap.resample (output.getWidth(), output.getHeight()); + offsetPixels = const_cast(&offsetBitmap)->getPixels(); + } + + const float offset = _Parameters[Offset].Value; + const bool tile = _Parameters[Tile].Integer != 0; + const bool invert = _Parameters[Invert].Integer != 0; + float *dst = output.getPixels(); + const float *src = input.getPixels(); + + if (dst) + { + // Build a gradient + float gradients[2048*4]; + uint i; + for (i=0; i<2048; i++) + gradient (gradients+i*4, _Parameters[Gradient].Gradient, (float)i/2048.f); + + if (_Parameters[Mirror].Integer) + { + for (i=0; i=0.5f) + tmp = 1.f - tmp; + int index = (int)(4196.f * tmp); + clamp (index, 0, 2047); + if (invert) + index = 2047 - index; + const uint tmpI = index*4; + dst[0] = gradients[tmpI]; + dst[1] = gradients[tmpI+1]; + dst[2] = gradients[tmpI+2]; + } + } + else + { + for (i=0; i 6.f) + h -= 6.f; + if (h < 0.f) + h += 6.f; + + // Add saturation + s += saturation; + clamp (s, 0.f ,1.f); + + // Add value + v += value; + + HVS2RGB (h, v, s, out); + } + + return ChannelRGB; +} + +// *************************************************************************** + +/* End of op_hue_saturation.cpp */ diff --git a/src/tex_gen/op_hue_saturation.h b/src/tex_gen/op_hue_saturation.h new file mode 100644 index 0000000..a567a92 --- /dev/null +++ b/src/tex_gen/op_hue_saturation.h @@ -0,0 +1,83 @@ +/** \file op_hue_saturation.h + * Correct hue saturation + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_OP_HUE_SATURATION +#define NL_OP_HUE_SATURATION + +#include "tex_gen_op.h" +#include "op_color.h" + + +namespace NLTEXGEN +{ + +/** + * Contrast luminosity operator. + * + * \author Cyril 'Hulud' Corvazier + * \author DIGITAL MURDER + * \date 2003 + */ +class COpHueSaturation : public IOpColor +{ +public: + + enum TInput + { + LastInput, + }; + + enum TParameter + { + Hue = IOpColor::LastParameter, // The gradient color to use + Saturation, + Luminosity, + LastParameter, + }; + + // Ctor. Init inputs and parameters + COpHueSaturation(); + + // \from IOpColor + virtual TChannel modifyColor (CFloatBitmap &output, const CFloatBitmap &input, const CRenderParameter &renderParameters); + + // Streamable + NLMISC_DECLARE_CLASS2(COpHueSaturation, HS); + + // Clone operator + NL_DECLARE_COPY_OPERATOR(COpHueSaturation, ITexGenOperator); + +protected: + +}; + +// *************************************************************************** + +} // NLTEXGEN + + +#endif // NL_OP_HUE_SATURATION + +/* End of op_hue_saturation.h */ diff --git a/src/tex_gen/op_layer.cpp b/src/tex_gen/op_layer.cpp new file mode 100644 index 0000000..8ef1f12 --- /dev/null +++ b/src/tex_gen/op_layer.cpp @@ -0,0 +1,67 @@ +/** \file op_layer.cpp + * Layer operator + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdtex_gen.h" +#include "op_layer.h" +#include "transform_float.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** + +IOpLayer::IOpLayer() +{ +} + +// *************************************************************************** + +TChannel IOpLayer::modifyColor (CFloatBitmap &output, const CFloatBitmap &input, const CRenderParameter &renderParameters) +{ + // Evaluate the layer + output.resize (input.getWidth(), input.getHeight()); + TChannel channels = modifyLayer (output, renderParameters); + + if (renderParameters.Cache) + { + // Copy the output into the cache + _LayerCache = output; + } + + // return the modified channels + return channels; +} + +// *************************************************************************** + +const CFloatBitmap &IOpLayer::getCachedLayer () const +{ + return _LayerCache; +} + +// *************************************************************************** + +/* End of op_layer.cpp */ diff --git a/src/tex_gen/op_layer.h b/src/tex_gen/op_layer.h new file mode 100644 index 0000000..339972b --- /dev/null +++ b/src/tex_gen/op_layer.h @@ -0,0 +1,89 @@ +/** \file op_layer.h + * Layer operator + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_OP_LAYER +#define NL_OP_LAYER + +#include "tex_gen/op_color.h" + + +namespace NLTEXGEN +{ + +/** + * Simple color modificator operator. + * Derived operator must use only one input and must return a bitmap of same size than the input. + * + * \author Cyril 'Hulud' Corvazier + * \author DIGITAL MURDER + * \date 2003 + */ +class IOpLayer : public IOpColor +{ +public: + + enum TInput + { + LastInput = IOpColor::LastInput, + }; + + enum TParameter + { + LastParameter = IOpColor::LastParameter, + }; + + // Ctor. Init inputs and parameters + IOpLayer(); + + // \from IOpLayer + virtual TChannel modifyColor (CFloatBitmap &output, const CFloatBitmap &input, const CRenderParameter &renderParameters); + + /** + * Interface to implement by the layer operator. + * This operator must change the size of output with the size of input. + * output and input can be the same object sometimes. + * + * This method must returns the modifed channels. + */ + virtual TChannel modifyLayer (CFloatBitmap &output, const CRenderParameter &renderParameters) = 0; + + // Get the layer cached bitmap + const CFloatBitmap &getCachedLayer () const; + +private: + + // The cash bitmap + CFloatBitmap _LayerCache; + +}; + +// *************************************************************************** + +} // NLTEXGEN + + +#endif // NL_OP_LAYER + +/* End of op_layer.h */ diff --git a/src/tex_gen/op_light.cpp b/src/tex_gen/op_light.cpp new file mode 100644 index 0000000..c91fc44 --- /dev/null +++ b/src/tex_gen/op_light.cpp @@ -0,0 +1,105 @@ +/** \file op_light.cpp + * Light a normal map + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdtex_gen.h" +#include "op_light.h" +#include "transform_float.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** + +COpLight::COpLight() +{ + // Two inputs + _Inputs.push_back(CInput("normal map")); + + // Parameters + _Parameters.push_back (CParameter("horizontal angle", "light properties", AngleSetup)); + _Parameters.push_back (CParameter("vertical angle", "light properties", AngleSetup)); + _Parameters.push_back (CParameter(CParameter::TypeGradient, "gradient", "light properties")); + _Parameters[ZAxis].Value = 0; + _Parameters[XAxis].Value = 90; + + // Default gradient + CGradientColor black; + CGradientColor white; + NLTEXGEN::copy (black.Color, ColorBlack); + black.Pos = 0; + _Parameters[Gradient].Gradient.push_back (black); + black.Pos = 0.5f; + _Parameters[Gradient].Gradient.push_back (black); + NLTEXGEN::copy (white.Color, ColorWhite); + white.Pos = 1; + _Parameters[Gradient].Gradient.push_back (white); +} + +// *************************************************************************** + +TChannel COpLight::evalInternal (class CFloatBitmap &output, const CRenderParameter &renderParameters) +{ + // Get input + + // Eval 1st argument + evalSubOp (output, NormalMap, renderParameters); + + // Blend the input and output + float *out = output.getPixels(); + + const uint width = output.getWidth(); + const uint height = output.getHeight(); + const uint widthMask = width-1; + const uint heightMask = height-1; + + const float az = _Parameters[ZAxis].Value * (float)NLMISC::Pi / 180; + const float ax = _Parameters[XAxis].Value * (float)NLMISC::Pi / 180; + const float dx = (float)(sin(az) * sin(ax)); + const float dy = (float)(cos(az) * sin(ax)); + const float dz = (float)cos(ax); + + // Build a gradient + float gradients[2048*4]; + uint i; + for (i=0; i<2048; i++) + gradient (gradients+i*4, _Parameters[Gradient].Gradient, (float)i/2048.f); + + const uint count = output.size(); + for (i=0; i(this)->getBindedOp(OffsetInput)) + { + evalSubOp (offsetBitmap, OffsetInput, renderParameters); + offsetBitmap.resample (output.getWidth(), output.getHeight()); + offsetPixels = const_cast(&offsetBitmap)->getPixels(); + } + + const float scaleFactor = 1.f / _Parameters[Scale].Value; + const float fY = -(float)sin(-_Parameters[Rotation].Value*Pi/180) * scaleFactor; + const float fX = (float)cos(-_Parameters[Rotation].Value*Pi/180) * scaleFactor; + const float dY = 1.f / fHeight; + const float dX = 1.f / fWidth; + const float offset = _Parameters[Offset].Value - 0.5f; + const bool tile = _Parameters[Tile].Integer != 0; + const bool invert = _Parameters[Invert].Integer != 0; + float *dst = output.getPixels(); + if (dst) + { + if (_Parameters[Mirror].Integer) + { + // Mirror + + // Build a gradient + float gradients[2048*4]; + uint i; + for (i=0; i<2048; i++) + gradient (gradients+i*4, _Parameters[Gradient].Gradient, (float)i/2048.f); + + uint x, y; + float fy = -0.5f + dX / 2.f; + for (y=0; y=0.5f) + tmp = 1.f - tmp; + int index = (int)(4196.f * tmp); + clamp (index, 0, 2047); + if (invert) + index = 2047 - index; + const uint tmpI = index*4; + dst[0] = gradients[tmpI]; + dst[1] = gradients[tmpI+1]; + dst[2] = gradients[tmpI+2]; + } + } + } + else + { + // No mirror + + // Build a gradient + float gradients[2048*4]; + uint i; + for (i=0; i<2048; i++) + gradient (gradients+i*4, _Parameters[Gradient].Gradient, (float)i/2048.f); + + uint x, y; + float fy = -0.5f + dX / 2.f; + for (y=0; y(this)->getBindedOp(OffsetInput)) + { + evalSubOp (offsetBitmap, OffsetInput, renderParameters); + offsetBitmap.resample (output.getWidth(), output.getHeight()); + offsetPixels = const_cast(&offsetBitmap)->getPixels(); + } + + const float scaleFactor = 1.f / _Parameters[Scale].Value; + const float fY = -(float)sin(-_Parameters[Rotation].Value*Pi/180) * scaleFactor; + const float fX = (float)cos(-_Parameters[Rotation].Value*Pi/180) * scaleFactor; + const float dY = 1.f / fHeight; + const float dX = 1.f / fWidth; + const float offset = _Parameters[Offset].Value - 0.5f; + const bool tile = _Parameters[Tile].Integer != 0; + const bool invert = _Parameters[Invert].Integer != 0; + float *dst = output.getPixels(); + if (dst) + { + if (_Parameters[Mirror].Integer) + { + // Mirror + + // Build a gradient + float gradients[2048*4]; + uint i; + for (i=0; i<2048; i++) + gradient (gradients+i*4, _Parameters[Gradient].Gradient, (float)i/2048.f); + + uint x, y; + float fy = -0.5f + dX / 2.f; + for (y=0; y=0.5f) + tmp = 1.f - tmp; + int index = (int)(4196.f * tmp); + clamp (index, 0, 2047); + if (invert) + index = 2047 - index; + const uint tmpI = index*4; + dst[0] = gradients[tmpI]; + dst[1] = gradients[tmpI+1]; + dst[2] = gradients[tmpI+2]; + } + } + } + else + { + // No mirror + + // Build a gradient + float gradients[2048*4]; + uint i; + for (i=0; i<2048; i++) + gradient (gradients+i*4, _Parameters[Gradient].Gradient, (float)i/2048.f); + + uint x, y; + float fy = -0.5f + dX / 2.f; + for (y=0; y(this)->getBindedOp(OffsetInput)) + { + evalSubOp (offsetBitmap, OffsetInput, renderParameters); + offsetBitmap.resample (output.getWidth(), output.getHeight()); + offsetPixels = const_cast(&offsetBitmap)->getPixels(); + } + + const float scaleFactor = 1.f / _Parameters[Scale].Value; + const float fY = -(float)sin(-_Parameters[Rotation].Value*Pi/180) * scaleFactor; + const float fX = (float)cos(-_Parameters[Rotation].Value*Pi/180) * scaleFactor; + const float dY = 1.f / fHeight; + const float dX = 1.f / fWidth; + const float offset = _Parameters[Offset].Value - 0.5f; + const bool tile = _Parameters[Tile].Integer != 0; + const bool invert = _Parameters[Invert].Integer != 0; + if (output.getPixels()) + { + // No mirror + float *gradientPixels = new float[output.size()]; + + uint x, y; + float *dst = gradientPixels; + float fy = -0.5f + dX / 2.f; + for (y=0; y &gradient = _Parameters[Gradient].Gradient; + + // Eval the mask + const float *maskPixels = NULL; + CFloatBitmap densityBitmap; + const ITexGenOperator *mask = const_cast(this)->getBindedOp(DensityInput); + if (mask) + { + evalSubOp (densityBitmap, DensityInput, renderParameters); + densityBitmap.resample (output.getWidth(), output.getHeight()); + maskPixels = const_cast(&densityBitmap)->getPixels(); + } + + // Eval the sprite + const float *spritePixels = NULL; + CFloatBitmap spriteBitmap; + const ITexGenOperator *sprite = const_cast(this)->getBindedOp(SpriteInput); + if (sprite) + { + evalSubOp (spriteBitmap, SpriteInput, renderParameters); + spritePixels = const_cast(&spriteBitmap)->getPixels(); + } + + const bool tileU = _Parameters[TileU].Integer != 0; + const bool tileV = _Parameters[TileV].Integer != 0; + + // Is a sprite is used, fill with background + if (sprite) + { + replaceConstRGBA (out, background, output.size()*4); + + uint x, y, i; + const uint width = output.getWidth(); + const uint height = output.getHeight(); + const uint srcWidth = spriteBitmap.getWidth(); + const uint srcHeight = spriteBitmap.getHeight(); + if ((srcWidth<=width) && (srcHeight<=height)) + { + for (y=0, i=0; y>1); + if (xOut < 0) + xOut += srcWidth; + sint yOut = (sint)y - (srcHeight>>1); + if (yOut < 0) + yOut += srcHeight; + CMul mul; + addPixels (out, width, height, xOut, yOut, spritePixels, srcWidth, srcHeight, tileU, tileV, color, mul); + } + } + } + } + else + { + uint i; + const uint count = output.size(); + for (i=0; i threshold) + { + // Copy the background + NLTEXGEN::copy (out+i*4, background); + } + else if (threshold < 1.f) + { + // Copy the background + NLTEXGEN::copy (out+i*4, background); + } + else + { + // Get a value from the gradient + NLTEXGEN::gradient (out+i*4, gradient, intensity); + } + } + } + + return ChannelRGB; +} + +// *************************************************************************** + +/* End of op_noise.cpp */ diff --git a/src/tex_gen/op_noise.h b/src/tex_gen/op_noise.h new file mode 100644 index 0000000..4da0572 --- /dev/null +++ b/src/tex_gen/op_noise.h @@ -0,0 +1,89 @@ +/** \file op_noise.h + * Fill with noise + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_OP_NOISE +#define NL_OP_NOISE + +#include "tex_gen_op.h" +#include "tex_gen/op_layer.h" + + +namespace NLTEXGEN +{ + +/** + * Noise operator. + * Fill the bitmap with a noisy color + * + * \author Cyril 'Hulud' Corvazier + * \author DIGITAL MURDER + * \date 2003 + */ +class COpNoise : public IOpLayer +{ +public: + + enum TInput + { + DensityInput = IOpLayer::LastInput, // The gradient color to use + SpriteInput, + LastInput, + }; + + enum TParameter + { + Density = IOpLayer::LastParameter, // The gradient color to use + Seed, + Gradient, + Background, + TileU, // Tile on / off + TileV, // Tile on / off + LastParameter, + }; + + // Ctor. Init inputs and parameters + COpNoise(); + + // \from IOpLayer + virtual TChannel modifyLayer (CFloatBitmap &output, const CRenderParameter &renderParameters); + + // Streamable + NLMISC_DECLARE_CLASS2(COpNoise, Ns); + + // Clone operator + NL_DECLARE_COPY_OPERATOR(COpNoise, ITexGenOperator); + +protected: + +}; + +// *************************************************************************** + +} // NLTEXGEN + + +#endif // NL_OP_NOISE + +/* End of op_noise.h */ diff --git a/src/tex_gen/op_normalize.cpp b/src/tex_gen/op_normalize.cpp new file mode 100644 index 0000000..16ac0d6 --- /dev/null +++ b/src/tex_gen/op_normalize.cpp @@ -0,0 +1,82 @@ +/** \file op_normalize.cpp + * Convert RGB to normal + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdtex_gen.h" +#include "op_normalize.h" +#include "transform_float.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** + +COpNormalize::COpNormalize() +{ + // Parameters + _Parameters.push_back (CParameter("height", "convert to normal", CenteredMT1_1Setup)); + _Parameters[Height].Value = 1; + _Parameters[IOpColor::Normalize].Integer = 1; +} + +// *************************************************************************** + +TChannel COpNormalize::modifyColor (CFloatBitmap &output, const CFloatBitmap &input, const CRenderParameter &renderParameters) +{ + // Blend the input and output + output.resize (input.getWidth(), input.getHeight()); + float *out = output.getPixels(); + const float *in = input.getPixels(); + + const uint width = output.getWidth(); + const uint height = output.getHeight(); + const uint widthMask = width-1; + const uint heightMask = height-1; + + const float heightMap = _Parameters[Height].Value*1024; + const float mul = 1.f / (heightMap + 0.0001f); + + uint x, y, yWidth; + for (y=0, yWidth=0; y(this)->getBindedOp(OffsetInput)) + { + evalSubOp (offsetBitmap, OffsetInput, renderParameters); + offsetBitmap.resample (output.getWidth(), output.getHeight()); + offsetPixels = const_cast(&offsetBitmap)->getPixels(); + } + + const float scaleFactor = 1.f / _Parameters[Scale].Value; + const float dY = 2.f / fHeight; + const float dX = 2.f / fWidth; + const float offset = _Parameters[Offset].Value; + const bool tile = _Parameters[Tile].Integer != 0; + const bool invert = _Parameters[Invert].Integer != 0; + float *dst = output.getPixels(); + if (dst) + { + // Build a gradient + float gradients[2048*4]; + uint i; + for (i=0; i<2048; i++) + gradient (gradients+i*4, _Parameters[Gradient].Gradient, (float)i/2048.f); + + if (_Parameters[Mirror].Integer) + { + // Mirror + + uint x, y; + float fy = -1.f + dY / 2.f; + for (y=0; y=0.5f) + tmp = 1.f - tmp; + int index = (int)(4196.f * tmp); + clamp (index, 0, 2047); + if (invert) + index = 2047 - index; + const uint tmpI = index*4; + dst[0] = gradients[tmpI]; + dst[1] = gradients[tmpI+1]; + dst[2] = gradients[tmpI+2]; + } + } + } + else + { + // No mirror + + uint x, y; + float fy = -1.f + dY / 2.f; + for (y=0; y0.f); + float deltaFloor; + float delta_minus; + const float *mipMap0; + const float *mipMap1; + float mipXFactor0; + float mipYFactor0; + float mipXFactor1; + float mipYFactor1; + uint mipWidthMask0; + uint mipHeightMask0; + uint mipWidthShift0; + uint mipWidthMask1; + uint mipHeightMask1; + uint mipWidthShift1; + if (useMipMaps) + { + deltaFloor = (float)floor(delta); + delta -= deltaFloor; + delta_minus = 1.f - delta; + + // The mipmap + const uint mipMapCount = input.getMipMapCount(); + const uint mipMapBaseLevel0 = std::min((uint)deltaFloor, mipMapCount); + const uint mipMapBaseLevel1 = std::min(mipMapBaseLevel0+1, mipMapCount); + + // Pixels + mipMap0 = input.getPixels(mipMapBaseLevel0); + mipMap1 = input.getPixels(mipMapBaseLevel1); + + // Size + mipWidthMask0 = std::max(width>>mipMapBaseLevel0, (uint)1) - 1; + mipWidthShift0 = getPowerOf2 (mipWidthMask0+1); + mipHeightMask0 = std::max(height>>mipMapBaseLevel0, (uint)1) - 1; + mipWidthMask1 = std::max(width>>mipMapBaseLevel1, (uint)1) - 1; + mipWidthShift1 = getPowerOf2 (mipWidthMask1+1); + mipHeightMask1 = std::max(height>>mipMapBaseLevel1, (uint)1) - 1; + + // Factors + mipXFactor0 = (float)(mipWidthMask0+1) / (float)width; + mipYFactor0 = (float)(mipHeightMask0+1) / (float)height; + mipXFactor1 = (float)(mipWidthMask1+1) / (float)width; + mipYFactor1 = (float)(mipHeightMask1+1) / (float)height; + } + + uint x, y; + for (y=0; y +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nel/misc/common.h" +#include "nel/misc/debug.h" + +#include "nel/misc/stream.h" +#include "nel/misc/time_nl.h" +#include "nel/misc/vector.h" +#include "nel/misc/matrix.h" +#include "nel/misc/bitmap.h" +#include "nel/misc/rgba.h" + +#include "3d/transform.h" +#include "3d/mot.h" +#include "3d/quad_grid.h" + +#ifdef NL_OS_WINDOWS +#include +#undef min +#undef max +#endif // NL_OS_WINDOWS diff --git a/src/tex_gen/tex_gen_document.cpp b/src/tex_gen/tex_gen_document.cpp new file mode 100644 index 0000000..c45aa58 --- /dev/null +++ b/src/tex_gen/tex_gen_document.cpp @@ -0,0 +1,64 @@ +/** \file tex_gen_document.cpp + * Texture generator document + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdtex_gen.h" +#include "tex_gen_op.h" +#include "tex_gen_document.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +namespace NLTEXGEN +{ + +// *************************************************************************** + +CTexGenDocument::~CTexGenDocument() +{ + uint i; + for (i=0; i Operators; +}; + +// *************************************************************************** + +} // NLTEXGEN + +#endif // NL_TEX_GEN_DOCUMENT + +/* End of tex_gen_document.h */ diff --git a/src/tex_gen/tex_gen_op.cpp b/src/tex_gen/tex_gen_op.cpp new file mode 100644 index 0000000..1855978 --- /dev/null +++ b/src/tex_gen/tex_gen_op.cpp @@ -0,0 +1,331 @@ +/** \file tex_gen_op.cpp + * Texture operator interface + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdtex_gen.h" +#include "tex_gen_op.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** + +CFloatBitmap ITexGenOperator::DefaultBitmap; + +// *************************************************************************** + +void ITexGenOperator::operator=(const ITexGenOperator &other) +{ + clear (); + + // Copy + // _Inputs = other._Inputs; + _Parameters = other._Parameters; + + // Clone sub operators + /*uint i; + _BindedOperators.resize (other._BindedOperators.size(), NULL); + for (i=0 ;i<_BindedOperators.size(); i++) + { + if(other._BindedOperators[i]) + _BindedOperators[i] = other._BindedOperators[i]->copy(); + }*/ + + invalidate (); +} + +// *************************************************************************** + +ITexGenOperator::ITexGenOperator() +{ + _Enabled = true; + invalidate (); +} + +// *************************************************************************** + +ITexGenOperator::~ITexGenOperator() +{ + clear (); +} + +// *************************************************************************** + +TChannel ITexGenOperator::eval(CFloatBitmap &dest, const CRenderParameter &renderParameters) +{ + // Operator invalidated ? + if (_Invalidated) + { + // Operator enabled ? + TChannel modifedChannels = ChannelNone; + + if (_Enabled) + { + // Eval the bitmap + modifedChannels = evalInternal (dest, renderParameters); + } + else + { + // Eval the first child + modifedChannels = evalSubOp (dest, 0, renderParameters); + } + + // Cache ? + // Cache if cache is forced or if we have more than 1 parent : the evaluation can be called several times + if (renderParameters.Cache || (_Parents.size()>1)) + { + // Copy in the bitmap cache + _Cache = dest; + + // Validate it + _Invalidated = false; + } + + // + return modifedChannels; + } + else + { + // Operator is valid, return the cache + dest.ghostCopy (&_Cache); + + // Nothing modified + return ChannelAll; + } +} + +// *************************************************************************** + +void ITexGenOperator::clear() +{ + _BindedOperators.clear (); +} + +// *************************************************************************** + +void ITexGenOperator::bindOp(uint i, ITexGenOperator *op) +{ + if (i>=_BindedOperators.size ()) + _BindedOperators.resize (i+1, NULL); + + // Must be removed first + nlassert(_BindedOperators[i] == NULL); + + _BindedOperators[i]=op; + op->_Parents.push_back (this); + invalidate (); +} + +// *************************************************************************** + +void ITexGenOperator::removeOp(uint i) +{ + uint j; + for (j=0; j<_BindedOperators[i]->_Parents.size(); j++) + { + if (_BindedOperators[i]->_Parents[j] == this) + { + _BindedOperators[i]->_Parents.erase (_BindedOperators[i]->_Parents.begin()+j); + break; + } + } + _BindedOperators[i] = NULL; + while (_BindedOperators.size() && (_BindedOperators[_BindedOperators.size()-1]==NULL)) + _BindedOperators.resize (_BindedOperators.size()-1); + invalidate (); +} + +// *************************************************************************** + +TChannel ITexGenOperator::evalSubOp (CFloatBitmap &output, uint op, const CRenderParameter &cache) +{ + ITexGenOperator *op0 = getBindedOp(op); + if (op0) + return op0->eval(output, cache); + else + output.ghostCopy(&ITexGenOperator::DefaultBitmap); + return ChannelAll; +} + +// *************************************************************************** + +void ITexGenOperator::setParameter(uint i, float value) +{ + if (i<_Parameters.size()) + { + // Alpha value ? + _Parameters[i].Value = value; + } + + // Modify operator ? + invalidate (); +} + +// *************************************************************************** + +void ITexGenOperator::setParameter(uint i, int value) +{ + if (i<_Parameters.size()) + { + // Alpha value ? + clamp (value, _Parameters[i].IntegerMin, _Parameters[i].IntegerMax); + _Parameters[i].Integer = value; + } + + // Modify operator ? + invalidate (); +} + +// *************************************************************************** + +void ITexGenOperator::setParameter(uint i, const NLMISC::CRGBAF &value) +{ + if (i<_Parameters.size()) + { + // Alpha value ? + _Parameters[i].Color[0] = value.R; + _Parameters[i].Color[1] = value.G; + _Parameters[i].Color[2] = value.B; + _Parameters[i].Color[3] = value.A; + } + + // Modify operator ? + invalidate (); +} + +// *************************************************************************** + +void ITexGenOperator::setParameter(uint i, const std::vector &value) +{ + if (i<_Parameters.size()) + { + // Alpha value ? + _Parameters[i].Gradient = value; + } + + // Modify operator ? + invalidate (); +} + +// *************************************************************************** + +void ITexGenOperator::setParameter(uint i, const std::string &value) +{ + if (i<_Parameters.size()) + { + _Parameters[i].StringValue = value; + } + + // Modify operator ? + invalidate (); +} + +// *************************************************************************** + +bool ITexGenOperator::isEnable() const +{ + return _Enabled; +} + +// *************************************************************************** + +void ITexGenOperator::setEnable(bool enable) +{ + _Enabled = enable; + invalidate (); +} + +// *************************************************************************** + +void ITexGenOperator::serial(NLMISC::IStream &s) +{ + s.serial (_Enabled); + + // Serial parameters + uint i; + for (i=0; i<_Parameters.size(); i++) + { + sint toto = FileVersion; + if ((FileVersion >= _Parameters[i].FirstVersion) && (FileVersion <= _Parameters[i].LastVersion)) + s.serial (_Parameters[i]); + } + + // Serial the child operator + s.serialContPolyPtr (_BindedOperators); + + // If reading, relink operators + if (s.isReading()) + { + uint i; + for (i=0; i<_BindedOperators.size (); i++) + { + if (_BindedOperators[i]) + { + // Backup + ITexGenOperator *temp = _BindedOperators[i]; + _BindedOperators[i] = NULL; + bindOp(i, temp); + } + } + } +} + +// *************************************************************************** + +bool ITexGenOperator::canBindOp(const ITexGenOperator *op) const +{ + return !op->findChildren (this); +} + +// *************************************************************************** + +bool ITexGenOperator::findChildren (const ITexGenOperator *op) const +{ + if (this == op) + return true; + uint i; + for (i=0; i<_BindedOperators.size(); i++) + { + if (_BindedOperators[i] && _BindedOperators[i]->findChildren (op)) + return true; + } + return false; +} + +// *************************************************************************** + +void ITexGenOperator::invalidate () +{ + _Invalidated = true; + uint i; + for (i=0; i<_Parents.size(); i++) + { + _Parents[i]->invalidate(); + } +} + +// *************************************************************************** + +/* End of tex_gen_op.cpp */ diff --git a/src/tex_gen/tex_gen_op.h b/src/tex_gen/tex_gen_op.h new file mode 100644 index 0000000..25aa367 --- /dev/null +++ b/src/tex_gen/tex_gen_op.h @@ -0,0 +1,249 @@ +/** \file tex_gen_op.h + * Texture operator interface + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_TEX_GEN_OP +#define NL_TEX_GEN_OP + +#include "basics.h" +#include "bitmap_float.h" + +namespace NLTEXGEN +{ + +/** + * Texture operator interface. + * \author Cyril 'Hulud' Corvazier + * \author DIGITAL MURDER + * \date 2003 + */ +class ITexGenOperator : public NLMISC::IStreamable +{ +public: + + /** + * Eval the operator in the destination bitmap. Returns the channels that have been modified. + * If renderParameters.Cash is true, the result will be saved by the operator. + */ + TChannel eval(class CFloatBitmap &dest, const CRenderParameter &renderParameters); + + /// \name Operator modification methods + + /** + * This method returns the number of bitmap needed by the operator to work + */ + uint getNumInputBitmap () const + { + return _Inputs.size(); + } + + /** + * This method returns an input descriptor + */ + const CInput &getInputBitmapDescriptor (uint i) const + { + return _Inputs[i]; + } + + /// \name Parameters methods + + /** + * This method returns the number of parameters used by this operator + */ + uint getNumParameter() const + { + return _Parameters.size(); + } + + /** + * This method returns the number of parameters used by this operator + */ + const CParameter &getParameter(uint i) const + { + return _Parameters[i]; + } + + /** + * This method modify a parameter used by this operator + */ + void setParameter(uint i, float value); + void setParameter(uint i, int value); + void setParameter(uint i, const NLMISC::CRGBAF &value); + void setParameter(uint i, const std::vector &value); + void setParameter(uint i, const std::string &value); + + /// \name Binding input operators + + // Get the binded operators + const std::vector &getBindedOp() const + { + return _BindedOperators; + } + + // Get the binded operators + const ITexGenOperator *getBindedOp(uint i) const + { + if (i<_BindedOperators.size()) + return _BindedOperators[i]; + else + return NULL; + } + + // Get the parent operators + const std::vector &getParents () const + { + return _Parents; + } + + // Get the parent operators + std::vector &getParents () + { + return _Parents; + } + + // Can bind an operator ? + bool canBindOp(const ITexGenOperator *op) const; + + // Bind an operator + void bindOp(uint i, ITexGenOperator *op); + + // Remove an operator + void removeOp(uint i); + + // Where is bind the operator + uint whereIsBindOp(ITexGenOperator *op) const + { + uint i; + for (i=0; i<_BindedOperators.size(); i++) + { + if (_BindedOperators[i] == op) + return i; + } + // Not found ! + nlstop; + return 0; + } + + // Eval an operator + TChannel evalSubOp (CFloatBitmap &output, uint op, const CRenderParameter &cache); + + /// \name Gloabal properties + + // The operator is enable or not. If not enable, it returns it's first entry as output. + bool isEnable() const; + + // The operator is enable or not. If not enable, it returns it's first entry as output. + void setEnable(bool enable); + + // The operator name (not serialized) + // std::string Name; + + // Selection flag (not serialized) + bool Selected; + + // The operator position (not serialized) + sint32 X, Y; + + /// \name Class management + + /// Constructor + ITexGenOperator(); + + /// Destructor + virtual ~ITexGenOperator(); + + /// Copy + void operator=(const ITexGenOperator &other); + + /// Clone + virtual ITexGenOperator *copy() const = 0; + + // Default bitmap + static CFloatBitmap DefaultBitmap; + +protected: + + /// Clear the content + void clear(); + + /** + * Internal eval method. + * + * This method must modify the input bitmaps and put the result in the output bitmap + */ + virtual TChannel evalInternal (CFloatBitmap &output, const CRenderParameter &renderParameters) = 0; + + // Serial this operator + virtual void serial(NLMISC::IStream &s); + + // Inputs + std::vector _Inputs; + + // Parameters + std::vector _Parameters; + +private: + + // Invaliate operator + void invalidate (); + + // Find a child operator + bool findChildren (const ITexGenOperator *op) const; + + // Get the binded operators + ITexGenOperator *getBindedOp(uint i) + { + if (i<_BindedOperators.size()) + return _BindedOperators[i]; + else + return NULL; + } + + // The cash bitmap + CFloatBitmap _Cache; + + // Invalidate flag + bool _Invalidated; + + // Enabled + bool _Enabled; + + // Parent operator + std::vector _Parents; + + // Inputs + std::vector _BindedOperators; +}; + +#define NLMISC_DECLARE_CLASS2(_class_, name) \ + virtual std::string getClassName() {return #name;} \ + static NLMISC::IClassable *creator() {return new _class_;} + +// *************************************************************************** + +} // NLTEXGEN + +#endif // NL_TEX_GEN_OP + +/* End of tex_gen_op.h */ diff --git a/src/tex_gen/todo.txt b/src/tex_gen/todo.txt new file mode 100644 index 0000000..03a638c --- /dev/null +++ b/src/tex_gen/todo.txt @@ -0,0 +1,95 @@ +--- v0.1 + ++ radial gradient ++ multi output ++ mix operator ++ noise operator ++ color transform operator + + Contrast / luminosity / color balance + + Hue / saturation + + RGB ++ normal operator ++ lighting operator ++ transform operator + + move + + rotate + + shear + + scale ++ filtered deformation ++ sinus deformation ++ background operators ++ sprites (modify noise) + sprite modulation ++ gradient bars (bricks) ++ clouds operator ++ filter sorted in folder ++ load / save / export ++ operator selection + + remove the edit for the operator name + + selection + + show first selected + + delete operator ++ widget for float + + Button + + Value range and fomula type for plugin + + Value range, fomula and unit to display (Editbox) + + Predefined marks (disabled with ctrl or shift) + + Default value (Dbl click) ++ color picker + + Basic color slots + + RGB edit box + + HSL edit box + + RGB picker ++ bilinera filter should use easein method before sampling ++ larger gradient window ++ add easeinout in gradients ++ tiling / zoom previous ++ preview an operator output ++ check all parameters are relative at image size ++ output alpha ++ texture samples + +--- v? + ++ windows explorer thumbnal plug-in ++ 3dsmax 3 plug-in ++ 3dsmax 5 plug-in ++ installer with components ++ view operator layer result or not ++ program icons + +FEATURES +-------- + +- files + - history file + - digital murder web site +- install + - install icon on the desktop + - install menu + - open the directory + - run the application +- bug file +- font operator +- scale in AngularGradient +- operator cellular +- clouds + - add low frequencies attenuation + - add intensity +- anti aliase gradient +- operator inverse +- vertical sinus +- vertical bars +- smooth normaliser +- color slot memorized in registry +- gradient continuity parameter +- interactive previous by auto divide texture size (option) +- anisotropic filter for sinus and tranformation +? file operator + +--- v1.0b + +BUGS +---- + +- refresh part of overlapped operators +- edition crash (not reproducted) diff --git a/src/tex_gen/transform_float.cpp b/src/tex_gen/transform_float.cpp new file mode 100644 index 0000000..1e06156 --- /dev/null +++ b/src/tex_gen/transform_float.cpp @@ -0,0 +1,473 @@ +/** \file transform_float.cpp + * Blend operations + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdtex_gen.h" +#include "transform_float.h" + +using namespace NLMISC; + +namespace NLTEXGEN +{ + +// *************************************************************************** + + +// *************************************************************************** + +void addPixels (float *dst, uint dstWidth, uint dstHeight, uint dstX, uint dstY, const float *src, uint srcWidth, + uint srcHeight, bool tileX, bool tileY) +{ + // ********* + // * 0 * 2 * + // ********* + // * 1 * 3 * + // ********* + + uint width_2_3 = (uint)std::min(std::max((sint)0, (sint)(dstX + srcWidth) - (sint)dstWidth), (sint)dstWidth); + uint height_1_3 = (uint)std::min(std::max((sint)0, (sint)(dstY + srcHeight) - (sint)dstHeight), (sint)dstHeight); + + CAdd add; + + // Copy 0 + uint y; + uint lastX = dstX + srcWidth - width_2_3; + uint lastY = dstY + srcHeight - height_1_3; + for (y=dstY; y 6) + h -= 6; +} + +// *************************************************************************** + +void gradient (float *dst, float *gradientPixels, uint width, uint height, const std::vector &_gradient, bool filter, bool tile, bool mirror, bool invert, bool wrapFilter) +{ + const uint count = width*height; + const double log2 = log (2.f); + if (filter) + { + const uint widthMask = width-1; + const uint heightMask = height-1; + + // Build the gradient mipmaps + float gradients0[2048*4]; + float gradients1[1024*4]; + float gradients2[512*4]; + float gradients3[256*4]; + float gradients4[128*4]; + float gradients5[64*4]; + float gradients6[32*4]; + float gradients7[16*4]; + float gradients8[8*4]; + float gradients9[4*4]; + float gradients10[2*4]; + float gradients11[1*4]; + float *gradients[12]= + { + gradients0, + gradients1, + gradients2, + gradients3, + gradients4, + gradients5, + gradients6, + gradients7, + gradients8, + gradients9, + gradients10, + gradients11, + }; + + // Build the first gradient + uint i; + for (i=0; i<2048; i++) + gradient (gradients0+i*4, _gradient, (float)i/2048.f); + + // Build the mipmaps + uint j; + for (j=1; j<12; j++) + { + float *_prev = gradients[j-1]; + float *_cur = gradients[j]; + const uint size = 2048>>j; + for (i=0; i=0.5f) + tmp = 1.f - tmp; + tmp *= 4196.f; + } + else + { + tmp *= 2048.f; + } + clamp (tmp, 0.f, 2047.9f); + tempDst[i] = tmp; + } + + // Gradient the image to get the final gradient value + tempDst = gradientPixels; + uint x, y; + for (y=0; y 0) + dg = (float)fabs(tempDst[(x-1)%widthMask+y*width]-cur); + if (x < (width-1)) + dg = std::max ((float)fabs(tempDst[(x-1)%widthMask+y*width]-cur), dg); + if (y > 0) + dg = std::max ((float)fabs(tempDst[x+((y-1)&heightMask)*width]-cur), dg); + if (y < (height-1)) + dg = std::max ((float)fabs(tempDst[x+((y+1)&heightMask)*width]-cur), dg); + } + + // Compute the delta + float delta = (float)(log (dg) / log2); + if (delta>0.f) + { + float deltaFloor = (float)floor(delta); + delta -= deltaFloor; + float delta_minus = 1.f - delta; + + // The mipmap + const uint mipMapBaseLevel0 = std::min((uint)deltaFloor, (uint)11); + const uint mipMapBaseLevel1 = std::min(mipMapBaseLevel0+1, (uint)11); + + // Pixels + float *mipMap0 = gradients[mipMapBaseLevel0]; + float *mipMap1 = gradients[mipMapBaseLevel1]; + + // Size + uint mipWidthMask0 = std::max((uint)(2048>>mipMapBaseLevel0), (uint)1) - 1; + uint mipWidthMask1 = std::max((uint)(2048>>mipMapBaseLevel1), (uint)1) - 1; + + // Factors + float mipXFactor0 = (float)(mipWidthMask0+1) / (float)2048; + float mipXFactor1 = (float)(mipWidthMask1+1) / (float)2048; + + float mip0[4]; + float mip1[4]; + + // Trilinear filtering + bilinearSampleTileRGB (mip0, mipMap0, cur*mipXFactor0, mipWidthMask0, tile); + bilinearSampleTileRGB (mip1, mipMap1, cur*mipXFactor1, mipWidthMask1, tile); + + dst[0] = mip0[0] * delta_minus + mip1[0] * delta; + dst[1] = mip0[1] * delta_minus + mip1[1] * delta; + dst[2] = mip0[2] * delta_minus + mip1[2] * delta; + } + else + { + bilinearSampleTileRGB (dst, gradients0, cur, widthMask, tile); + } + } + } + else + { + // Build a gradient + float gradients[2048*4]; + uint i; + for (i=0; i<2048; i++) + gradient (gradients+i*4, _gradient, (float)i/2048.f); + + // Gradient the image + for (i=0; i=0.5f) + tmp = 1.f - tmp; + index = (int)(4196.f * tmp); + clamp (index, 0, 2047); + } + else + { + index = (int)(2048.f * (tmp)); + clamp (index, 0, 2047); + } + if (invert) + index = 2047 - index; + const uint tmpI = index<<2; + dst[0] = gradients[tmpI]; + dst[1] = gradients[tmpI+1]; + dst[2] = gradients[tmpI+2]; + } + } +} + +// *************************************************************************** + +void drawQuad (float *dst, sint dstX, sint dstY, uint width, uint height, uint quadwidth, uint quadheight, const float *color, bool tileU, bool tileV) +{ + const uint widthShift = getPowerOf2 (width); + const uint widthMask = width-1; + const uint heightMask = height-1; + + sint y; + for (y=dstY; y=0) && (y<(sint)height))) + { + sint x; + const uint limitX = dstX+quadwidth; + for (x=dstX; x<(sint)limitX; x++) + { + if (tileU || ((x>=0) && (x<(sint)width))) + { + const uint index = ((x&widthMask)+((y&heightMask)<f1)?f0:f1; + } + NLTEXGEN_TRANSFORM_MACRO +}; + +class CDifference +{ +public: + static inline float transform (float f0, float f1) + { + return (float)fabs(f0-f1); + } + NLTEXGEN_TRANSFORM_MACRO +}; + +class CNegation +{ +public: + static inline float transform (float f0, float f1) + { + return 1.f - (float)(1.f - f0 - f1); + } + NLTEXGEN_TRANSFORM_MACRO +}; + +class CExclusion +{ +public: + static inline float transform (float f0, float f1) + { + return f0 + f1 - 2.f * f0 * f1; + } + NLTEXGEN_TRANSFORM_MACRO +}; + +class COverlay +{ +public: + static inline float transform (float f0, float f1) + { + return (f1<0.5f)?2.f*f0*f1:1.f-2.f*(1-f0)*(1-f1); + } + NLTEXGEN_TRANSFORM_MACRO +}; + +class CHardLight +{ +public: + static inline float transform (float f0, float f1) + { + return (f0<0.5f)?2.f*f0*f1:1.f-2.f*(1-f0)*(1-f1); + } + NLTEXGEN_TRANSFORM_MACRO +}; + +class CSoftLight +{ +public: + static inline float transform (float f0, float f1) + { + if (f0<0.5f) + return f1-(0.5f-f0)*(0.5f-(0.5f-f1)*(0.5f-f1)); + else + return f1+(f0-0.5f)*(0.5f-(0.5f-f1)*(0.5f-f1)); + } + NLTEXGEN_TRANSFORM_MACRO +}; + +class CColorDodge +{ +public: + static inline float transform (float f0, float f1) + { + float div = (1.f == f0)?1.f/256.f:1.f-f0; + float tt = f1 / div; + return tt; + } + NLTEXGEN_TRANSFORM_MACRO +}; + +class CRColorDodge +{ +public: + static inline float transform (float f0, float f1) + { + float div = (1.f == f1)?1.f/256.f:1.f-f1; + float tt = f0 / div; + return tt; + } + NLTEXGEN_TRANSFORM_MACRO +}; + +class CColorBurn +{ +public: + static inline float transform (float f0, float f1) + { + float div = (0.f == f0)?1.f/256.f:f0; + return 1.f - (1.f - f1) / div; + } + NLTEXGEN_TRANSFORM_MACRO +}; + +class CRColorBurn +{ +public: + static inline float transform (float f0, float f1) + { + float div = (0.f == f1)?1.f/256.f:f1; + return 1.f - (1.f - f0) / div; + } + NLTEXGEN_TRANSFORM_MACRO +}; + +inline void copy(float *dst, const float *src0); +inline void add(float *dst, const float *src0); +inline void sub(float *dst, const float *src0); +inline void rsub(float *dst, const float *src0); +inline void mul(float *dst, const float *src0); +inline void screen(float *dst, const float *src0); +inline void mul(float *dst, const float factor); +inline void div(float *dst, const float factor); + +inline void replaceRGBA (float *dst, const float *src0, const uint size); +inline void replaceRGB (float *dst, const float *src0, const uint size); +inline void replaceA (float *dst, const float *src0, const uint size); +inline void replaceBlendRGBA (float *dst, const float *src0, const uint size, const float alpha); +inline void replaceBlendRGB (float *dst, const float *src0, const uint size, const float alpha); +inline void replaceBlendA (float *dst, const float *src0, const uint size, const float alpha); +inline void replaceBlendMaskRGBA (float *dst, const float *src0, const uint size, const float alpha); +inline void replaceBlendMaskRGB (float *dst, const float *src0, const uint size, const float alpha); +inline void replaceBlendMaskA (float *dst, const float *src0, const uint size, const float alpha); +inline void replaceConstRGBA (float *dst, const float *color, const uint size); +inline void replaceConstRGB (float *dst, const float *color, const uint size); +inline void replaceConstA (float *dst, const float alpha, const uint size); +inline void replaceBlendConstRGBA (float *dst, const float *color, const uint size, const float alpha); +inline void replaceBlendConstRGB (float *dst, const float *color, const uint size, const float alpha); +inline void replaceBlendConstA (float *dst, const float alphaColor, const uint size, const float alpha); +// For i in [0~size] : dst[i].channel = src0[i].channel +inline void replace (float *dst, const float *src0, const uint size, const TChannel channel); +// For i in [0~size] : dst[i].channel = src0[i].channel * alpha + dst[i].channel * (1-alpha) +inline void replaceBlend (float *dst, const float *src0, const uint size, const TChannel channel, const float alpha); +inline void replaceBlendMask (float *dst, const float *src0, const float *mask, const uint size, const TChannel channel, const float alpha); +// For i in [0~size] : dst[i].channel = color.channel +inline void replaceConst (float *dst, const float *color, const uint size, const TChannel channel); +// For i in [0~size] : dst[i].channel = color.channel * alpha + dst[i].channel * (1 - alpha) +inline void replaceBlendConst (float *dst, const float *color, const uint size, const TChannel channel, const float alpha); +// For i in [0~size] : dst[i].channel = blendMode(src0[i].channel, src1[i].channel) +inline void transform (float *dst, const float *src0, const float *src1, uint size, TBlendMode mode, TChannel channel); +// For i in [0~size] : dst[i].channel = blendMode(src0[i].channel, src0[i].channel) * (alpha*mask[i]) + dst[i].channel * (1-(alpha*mask[i])) +inline void transformBlend (float *dst, const float *src0, const float *src1, const float *mask, uint size, TBlendMode mode, TChannel channel, float alpha); +// For i in [0~size] : dst[i].channel = blendMode(src[i].channel, color.channel) +inline void transformConst (float *dst, const float *src, const float *color, uint size, TBlendMode mode, TChannel channel); +// For i in [0~size] : dst[i].channel = blendMode(src[i].channel, color.channel) * alpha + dst[i].channel * (1-alpha) +inline void transformBlendConst (float *dst, const float *src, const float *color, uint size, TBlendMode mode, TChannel channel, float alpha); + +// Get the gradient value +inline void gradient (float *dst, const std::vector &gradient, float offset); + +// Gradient a gray scale bitmap (use the R component) +void gradient (float *dst, float *gradientPixels, uint width, uint height, const std::vector &_gradient, bool filter, bool tile, bool mirror, bool invert, bool wrapFilter); + +// Init the gaussian +inline void initGaussian (float radius, float *values, uint size); + +// Bilinear +inline void bilinearRGB (float *dst, const float *p00, const float *p01, const float *p10, const float *p11, + const float x, const float y); +inline void bilinearSampleTileRGB (float *dst, const float *src, float x, float y, uint widthMask, + uint heightMask, uint widthShift, bool tileX, bool tileY); + +template +inline void copyPixels (float *dst, uint dstWidth, uint dstHeight, sint dstX, sint dstY, const float *src, uint srcWidth, + uint srcHeight, bool tileX, bool tileY, const A &transfo); + +template +inline void addPixels (float *dst, uint dstWidth, uint dstHeight, sint dstX, sint dstY, const float *src, uint srcWidth, + uint srcHeight, bool tileX, bool tileY, float *colorToTransform, const A &transfo); + +void HVS2RGB (float h, float v, float s, float *color); +void RGB2HVS (const float *color, float &h, float &v, float &s); +float easineasout(float x); + +// Draw a constant color quad +void drawQuad (float *dst, sint x, sint y, uint width, uint height, uint quadwidth, uint quadheight, const float *color, bool tileU, bool tileV); + +// *************************************************************************** +// Random +// *************************************************************************** + +typedef uint32 TRandomValue; +inline TRandomValue getRandomValue (float value); +inline float getNextRandomValue (TRandomValue &previous); + +// *************************************************************************** +// Simple RGBA operators +// *************************************************************************** + +inline void copy(float *dst, const float *src) +{ + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; +} + +// *************************************************************************** + +inline void add(float *dst, const float *src) +{ + dst[0] += src[0]; + dst[1] += src[1]; + dst[2] += src[2]; + dst[3] += src[3]; +} + +// *************************************************************************** + +inline void sub(float *dst, const float *src) +{ + dst[0] -= src[0]; + dst[1] -= src[1]; + dst[2] -= src[2]; + dst[3] -= src[3]; +} + +// *************************************************************************** + +inline void rsub(float *dst, const float *src) +{ + dst[0] = src[0] - dst[0]; + dst[1] = src[1] - dst[1]; + dst[2] = src[2] - dst[2]; + dst[3] = src[3] - dst[3]; +} + +// *************************************************************************** + +inline void mul(float *dst, const float *src) +{ + dst[0] *= src[0]; + dst[1] *= src[1]; + dst[2] *= src[2]; + dst[3] *= src[3]; +} + +// *************************************************************************** + +inline void mul(float *dst, const float factor) +{ + dst[0] *= factor; + dst[1] *= factor; + dst[2] *= factor; + dst[3] *= factor; +} + +// *************************************************************************** + +inline void screen(float *dst, const float *src) +{ + uint i; + for (i=0; i<4; i++) + dst[i] = 1.f - (1.f - dst[i]) * (1.f - src[i]); +} + +// *************************************************************************** + +inline void div(float *dst, const float factor) +{ + dst[0] /= factor; + dst[1] /= factor; + dst[2] /= factor; + dst[3] /= factor; +} + +// *************************************************************************** +// RGBA manipulators +// *************************************************************************** + +inline void replaceRGBA (float *dst, const float *src0, const uint size) +{ + memcpy (dst, src0, size*sizeof(float)); +} + +// *************************************************************************** + +template +inline void templateTransfoRGBA (float *dst, const float *src0, const float *src1, const uint size, const A &transfo) +{ + uint i; + for (i=0; i +inline void templateTransfoRGB (float *dst, const float *src0, const float *src1, const uint size, const A &transfo) +{ + uint i; + for (i=0; i +inline void templateTransfoA (float *dst, const float *src0, const float *src1, const uint size, const A &transfo) +{ + uint i; + for (i=3; i +inline void templateBlendRGBA (float *dst, const float *src0, const float *src1, const uint size, const float alpha, const A &transfo) +{ + const float alphaMinus = 1.f - alpha; + uint i; + for (i=0; i +inline void templateBlendMaskRGBA (float *dst, const float *src0, const float *src1, const float *mask, const uint size, const float alpha, const A &transfo) +{ + uint i; + for (i=0; i +inline void templateBlendRGB (float *dst, const float *src0, const float *src1, const uint size, const float alpha, const A &transfo) +{ + const float alphaMinus = 1.f - alpha; + uint i; + for (i=0; i +inline void templateBlendMaskRGB (float *dst, const float *src0, const float *src1, const float *mask, const uint size, const float alpha, const A &transfo) +{ + uint i; + for (i=0; i +inline void templateBlendRGBSrc0Alpha (float *dst, const float *src0, const float *src1, const uint size, const float alpha, const A &transfo) +{ + uint i; + for (i=0; i +inline void templateBlendMaskRGBSrc0Alpha (float *dst, const float *src0, const float *src1, const float *mask, const uint size, const float alpha, const A &transfo) +{ + uint i; + for (i=0; i +inline void templateBlendA (float *dst, const float *src0, const float *src1, const uint size, const float alpha, const A &transfo) +{ + const float alphaMinus = 1.f - alpha; + uint i; + for (i=3; i +inline void templateBlendMaskA (float *dst, const float *src0, const float *src1, const float *mask, const uint size, const float alpha, const A &transfo) +{ + uint i; + for (i=3; i +inline void templateConstRGBA (float *dst, const float *src, const float *color, const uint size, const A &transfo) +{ + uint i; + for (i=0; i +inline void templateConstAddRGBA (float *dst, const float *src, const float *color, const uint size, const A &transfo) +{ + uint i; + for (i=0; i +inline void templateConstRGB (float *dst, const float *src, const float *color, const uint size, const A &transfo) +{ + uint i; + for (i=0; i +inline void templateConstA (float *dst, const float *src, const float alpha, const uint size, const A &transfo) +{ + uint i; + for (i=3; i +inline void templateBlendConstRGBA (float *dst, const float *src, const float *color, const uint size, const float alpha, const A &transfo) +{ + const float alphaMinus = 1.f - alpha; + uint i; + for (i=0; i +inline void templateBlendConstRGB (float *dst, const float *src, const float *color, const uint size, const float alpha, const A &transfo) +{ + const float alphaMinus = 1.f - alpha; + uint i; + for (i=0; i +inline void templateBlendConstA (float *dst, const float *src, const float alphaColor, const uint size, const float alpha, const A &transfo) +{ + const float alphaMinus = 1.f - alpha; + uint i; + for (i=3; i +inline void templateTransfo (float *dst, const float *src0, const float *src1, const uint size, const TChannel channel, const A &transfo) +{ + switch (channel) + { + case ChannelAll: + templateTransfoRGBA (dst, src0, src1, size, transfo); + return; + case ChannelRGB: + templateTransfoRGB (dst, src0, src1, size, transfo); + return; + case ChannelAlpha: + templateTransfoA (dst, src0, src1, size, transfo); + return; + default: + break; + } +} + +// *************************************************************************** +// Blend manipulators +// *************************************************************************** + +// For i in [0~size] : dst[i].channel = src0[i].channel * alpha + dst[i].channel * (1-alpha) +inline void replaceBlend (float *dst, const float *src0, const uint size, const TChannel channel, const float alpha) +{ + switch (channel) + { + case ChannelAll: + replaceBlendRGBA(dst, src0, size, alpha); + return; + case ChannelRGB: + replaceBlendRGB(dst, src0, size, alpha); + return; + case ChannelAlpha: + replaceBlendA(dst, src0, size, alpha); + return; + } +} + +// *************************************************************************** + +// For i in [0~size] : dst[i].channel = src0[i].channel * (alpha*mask[i]) + dst[i].channel * (1-(alpha*mask[i])) +inline void replaceBlendMask (float *dst, const float *src0, const float *mask, const uint size, const TChannel channel, const float alpha) +{ + switch (channel) + { + case ChannelAll: + replaceBlendMaskRGBA(dst, src0, mask, size, alpha); + return; + case ChannelRGB: + replaceBlendMaskRGB(dst, src0, mask, size, alpha); + return; + case ChannelAlpha: + replaceBlendMaskA(dst, src0, mask, size, alpha); + return; + } +} + +// *************************************************************************** + +template +inline void templateBlend (float *dst, const float *src0, const float *src1, const uint size, const TChannel channel, const float alpha, const A &transfo) +{ + switch (channel) + { + case ChannelAll: + templateBlendRGBA (dst, src0, src1, size, alpha, transfo); + return; + case ChannelRGB: + templateBlendRGB (dst, src0, src1, size, alpha, transfo); + return; + case ChannelAlpha: + templateBlendA (dst, src0, src1, size, alpha, transfo); + return; + } +} + +// *************************************************************************** + +template +inline void templateBlendMask (float *dst, const float *src0, const float *src1, const float *mask, const uint size, const TChannel channel, const float alpha, const A &transfo) +{ + switch (channel) + { + case ChannelAll: + templateBlendMaskRGBA (dst, src0, src1, mask, size, alpha, transfo); + return; + case ChannelRGB: + templateBlendMaskRGB (dst, src0, src1, mask, size, alpha, transfo); + return; + case ChannelAlpha: + templateBlendMaskA (dst, src0, src1, mask, size, alpha, transfo); + return; + } +} + +// *************************************************************************** +// Blend Src0 Alpha manipulators +// *************************************************************************** + +// For i in [0~size] : dst[i].channel = src0[i].channel * alpha + dst[i].channel * (1-alpha) +inline void replaceBlendSrc0Alpha (float *dst, const float *src0, const uint size, const float alpha) +{ + replaceBlendRGBSrc0Alpha (dst, src0, size, alpha); +} + +// *************************************************************************** + +// For i in [0~size] : dst[i].channel = src0[i].channel * (alpha*mask[i]) + dst[i].channel * (1-(alpha*mask[i])) +inline void replaceBlendMaskSrc0Alpha (float *dst, const float *src0, const float *mask, const uint size, const float alpha) +{ + replaceBlendMaskRGBSrc0Alpha (dst, src0, mask, size, alpha); +} + +// *************************************************************************** + +template +inline void templateBlendSrc0Alpha (float *dst, const float *src0, const float *src1, const uint size, const float alpha, const A &transfo) +{ + templateBlendRGBSrc0Alpha (dst, src0, src1, size, alpha, transfo); +} + +// *************************************************************************** + +template +inline void templateBlendMaskSrc0Alpha (float *dst, const float *src0, const float *src1, const float *mask, const uint size, const float alpha, const A &transfo) +{ + templateBlendMaskRGBSrc0Alpha (dst, src0, src1, mask, size, alpha, transfo); +} + +// *************************************************************************** +// Const manipulators +// *************************************************************************** + +// For i in [0~size] : dst[i].channel = color.channel +inline void replaceConst (float *dst, const float *color, const uint size, const TChannel channel) +{ + switch (channel) + { + case ChannelAll: + replaceConstRGBA(dst, color, size); + return; + case ChannelRGB: + replaceConstRGB(dst, color, size); + return; + case ChannelAlpha: + replaceConstA(dst, color[3], size); + return; + } +} + +// *************************************************************************** + +template +inline void templateConst (float *dst, const float *src, const float *color, const uint size, const TChannel channel, const A &transfo) +{ + switch (channel) + { + case ChannelAll: + templateConstRGBA (dst, src, color, size, transfo); + return; + case ChannelRGB: + templateConstRGB (dst, src, color, size, transfo); + return; + case ChannelAlpha: + templateConstA (dst, src, color[3], size, transfo); + return; + default: + break; + } +} + +// *************************************************************************** +// Blend const manipulators +// *************************************************************************** + +// For i in [0~size] : dst[i].channel = color.channel * alpha + dst[i].channel * (1 - alpha) +inline void replaceBlendConst (float *dst, const float *color, const uint size, const TChannel channel, const float alpha) +{ + switch (channel) + { + case ChannelAll: + replaceBlendConstRGBA(dst, color, size, alpha); + return; + case ChannelRGB: + replaceBlendConstRGB(dst, color, size, alpha); + return; + case ChannelAlpha: + replaceBlendConstA(dst, color[3], size, alpha); + return; + } +} + +// *************************************************************************** + +template +inline void templateBlendConst (float *dst, const float *src, const float *color, const uint size, const TChannel channel, const float alpha, const A &transfo) +{ + switch (channel) + { + case ChannelAll: + templateBlendConstRGBA (dst, src, color, size, alpha, transfo); + return; + case ChannelRGB: + templateBlendConstRGB (dst, src, color, size, alpha, transfo); + return; + case ChannelAlpha: + templateBlendConstA (dst, src, color[3], size, alpha, transfo); + return; + } +} + +// *************************************************************************** +// Mode manipulators +// *************************************************************************** + +#define TRANSFORM(a) \ + case a:\ + {\ + templateTransfo (dst, src0, src1, size, channel, C##a());\ + return;\ + } + +// For i in [0~size] : dst[i].channel = blendMode(src0[i].channel, src1[i].channel) +inline void transform (float *dst, const float *src0, const float *src1, uint size, TBlendMode mode, TChannel channel) +{ + switch (mode) + { + case Replace: + { + replace(dst, src0, size, channel); + return; + } + TRANSFORM (Mul) + TRANSFORM (Add) + TRANSFORM (Sub) + TRANSFORM (RSub) + TRANSFORM (Screen) + TRANSFORM (Darken) + TRANSFORM (Lighten) + TRANSFORM (Difference) + TRANSFORM (Negation) + TRANSFORM (Exclusion) + TRANSFORM (Overlay) + TRANSFORM (HardLight) + TRANSFORM (SoftLight) + TRANSFORM (ColorDodge) + TRANSFORM (RColorDodge) + TRANSFORM (ColorBurn) + TRANSFORM (RColorBurn) + TRANSFORM (Invert) + } +} + +// *************************************************************************** + +#define TRANSFORM_BLEND(a) \ + case a:\ + {\ + if (mask) \ + templateBlendMask (dst, src0, src1, mask, size, channel, alpha, C##a());\ + else \ + templateBlend (dst, src0, src1, size, channel, alpha, C##a());\ + return;\ + } + +// For i in [0~size] : dst[i].channel = blendMode(src0[i].channel, src0[i].channel) * alpha + dst[i].channel * (1-alpha) +inline void transformBlend (float *dst, const float *src0, const float *src1, const float *mask, uint size, TBlendMode mode, TChannel channel, float alpha) +{ + if ((alpha >= (1.f-FLT_EPSILON)) && (mask == NULL)) + { + transform (dst, src0, src1, size, mode, channel); + } + else if ((alpha > FLT_EPSILON) || (mask != NULL)) + { + switch (mode) + { + case Replace: + { + if (mask) + replaceBlendMask (dst, src0, mask, size, channel, alpha); + else + replaceBlend (dst, src0, size, channel, alpha); + return; + } + TRANSFORM_BLEND (Mul) + TRANSFORM_BLEND (Add) + TRANSFORM_BLEND (Sub) + TRANSFORM_BLEND (RSub) + TRANSFORM_BLEND (Screen) + TRANSFORM_BLEND (Darken) + TRANSFORM_BLEND (Lighten) + TRANSFORM_BLEND (Difference) + TRANSFORM_BLEND (Negation) + TRANSFORM_BLEND (Exclusion) + TRANSFORM_BLEND (Overlay) + TRANSFORM_BLEND (HardLight) + TRANSFORM_BLEND (SoftLight) + TRANSFORM_BLEND (ColorDodge) + TRANSFORM_BLEND (RColorDodge) + TRANSFORM_BLEND (ColorBurn) + TRANSFORM_BLEND (RColorBurn) + TRANSFORM_BLEND (Invert) + } + } +} + +// *************************************************************************** + +#define TRANSFORM_BLEND_SRC0_ALPHA(a) \ + case a:\ + {\ + if (mask) \ + templateBlendMaskSrc0Alpha (dst, src0, src1, mask, size, alpha, C##a());\ + else \ + templateBlendSrc0Alpha (dst, src0, src1, size, alpha, C##a());\ + return;\ + } + +// For i in [0~size] : dst[i].RGB = blendMode(src0[i].RGB, src0[i].RGB) * (alpha * src0[i].A) + dst[i].RGB * (1-(alpha * src0[i].A)) +inline void transformBlendSrc0Alpha (float *dst, const float *src0, const float *src1, const float *mask, uint size, TBlendMode mode, float alpha) +{ + switch (mode) + { + case Replace: + { + if (mask) + replaceBlendMaskSrc0Alpha (dst, src0, mask, size, alpha); + else + replaceBlendSrc0Alpha (dst, src0, size, alpha); + return; + } + TRANSFORM_BLEND_SRC0_ALPHA (Mul) + TRANSFORM_BLEND_SRC0_ALPHA (Add) + TRANSFORM_BLEND_SRC0_ALPHA (Sub) + TRANSFORM_BLEND_SRC0_ALPHA (RSub) + TRANSFORM_BLEND_SRC0_ALPHA (Screen) + TRANSFORM_BLEND_SRC0_ALPHA (Darken) + TRANSFORM_BLEND_SRC0_ALPHA (Lighten) + TRANSFORM_BLEND_SRC0_ALPHA (Difference) + TRANSFORM_BLEND_SRC0_ALPHA (Negation) + TRANSFORM_BLEND_SRC0_ALPHA (Exclusion) + TRANSFORM_BLEND_SRC0_ALPHA (Overlay) + TRANSFORM_BLEND_SRC0_ALPHA (HardLight) + TRANSFORM_BLEND_SRC0_ALPHA (SoftLight) + TRANSFORM_BLEND_SRC0_ALPHA (ColorDodge) + TRANSFORM_BLEND_SRC0_ALPHA (RColorDodge) + TRANSFORM_BLEND_SRC0_ALPHA (ColorBurn) + TRANSFORM_BLEND_SRC0_ALPHA (RColorBurn) + TRANSFORM_BLEND_SRC0_ALPHA (Invert) + } +} + +// *************************************************************************** + +#define TRANSFORM_CONST(a) \ + case a:\ + {\ + templateConst (dst, src, color, size, channel, C##a());\ + return;\ + } + +// For i in [0~size] : dst[i].channel = blendMode(src[i].channel, color.channel) +inline void transformConst (float *dst, const float *src, const float *color, uint size, TBlendMode mode, TChannel channel) +{ + switch (mode) + { + case Replace: + { + replaceConst(dst, color, size, channel); + return; + } + TRANSFORM_CONST (Mul) + TRANSFORM_CONST (Add) + TRANSFORM_CONST (Sub) + TRANSFORM_CONST (RSub) + TRANSFORM_CONST (Screen) + TRANSFORM_CONST (Darken) + TRANSFORM_CONST (Lighten) + TRANSFORM_CONST (Difference) + TRANSFORM_CONST (Negation) + TRANSFORM_CONST (Exclusion) + TRANSFORM_CONST (Overlay) + TRANSFORM_CONST (HardLight) + TRANSFORM_CONST (SoftLight) + TRANSFORM_CONST (ColorDodge) + TRANSFORM_CONST (RColorDodge) + TRANSFORM_CONST (ColorBurn) + TRANSFORM_CONST (RColorBurn) + TRANSFORM_CONST (Invert) + } +} + +// *************************************************************************** + +#define TRANSFORM_BLEND_CONST(a) \ + case a:\ + {\ + templateBlendConst (dst, src, color, size, channel, alpha, C##a());\ + return;\ + } + +// For i in [0~size] : dst[i].channel = blendMode(src[i].channel, color.channel) * alpha + dst[i].channel * (1-alpha) +inline void transformBlendConst (float *dst, const float *src, const float *color, uint size, TBlendMode mode, TChannel channel, float alpha) +{ + if (alpha >= (1.f-FLT_EPSILON)) + { + transformConst (dst, src, color, size, mode, channel); + } + else if (alpha > FLT_EPSILON) + { + switch (mode) + { + case Replace: + { + replaceBlendConst (dst, src, size, channel, alpha); + return; + } + TRANSFORM_BLEND_CONST (Mul) + TRANSFORM_BLEND_CONST (Add) + TRANSFORM_BLEND_CONST (Sub) + TRANSFORM_BLEND_CONST (RSub) + TRANSFORM_BLEND_CONST (Screen) + TRANSFORM_BLEND_CONST (Darken) + TRANSFORM_BLEND_CONST (Lighten) + TRANSFORM_BLEND_CONST (Difference) + TRANSFORM_BLEND_CONST (Negation) + TRANSFORM_BLEND_CONST (Exclusion) + TRANSFORM_BLEND_CONST (Overlay) + TRANSFORM_BLEND_CONST (HardLight) + TRANSFORM_BLEND_CONST (SoftLight) + TRANSFORM_BLEND_CONST (ColorDodge) + TRANSFORM_BLEND_CONST (RColorDodge) + TRANSFORM_BLEND_CONST (ColorBurn) + TRANSFORM_BLEND_CONST (RColorBurn) + TRANSFORM_BLEND_CONST (Invert) + } + } +} + +// *************************************************************************** + +inline void gradient (float *dst, const std::vector &gradient, float offset) +{ + // Find left and right bounds + std::vector::const_iterator left = gradient.end(); + std::vector::const_iterator right = gradient.begin(); + while ((right != gradient.end()) && (right->Pos < offset)) + { + left = right; + right++; + } + + // Left ? + if (left == gradient.end()) + { + if (right == gradient.end()) + copy(dst, ColorBlack); + else + copy(dst, right->Color); + } + else + { + if (right == gradient.end()) + copy(dst, left->Color); + else + { + if (right->Pos == left->Pos) + copy(dst, left->Color); + else + { + float blend = (offset - left->Pos) / (right->Pos - left->Pos); + float blend_inv = 1.f - blend; + float tangent = 1.f - left->RightPos; + const float ab = tangent * blend; + const float bc = tangent * blend_inv + blend; + blend = ab * blend_inv + bc * blend; + if (left->RightQuadratic) + blend = easineasout (blend); + blend_inv = 1.f - blend; + dst[0] = left->Color[0] * blend_inv + right->Color[0] * blend; + dst[1] = left->Color[1] * blend_inv + right->Color[1] * blend; + dst[2] = left->Color[2] * blend_inv + right->Color[2] * blend; + dst[3] = left->Color[3] * blend_inv + right->Color[3] * blend; + } + } + } +} + +// *************************************************************************** +// Random +// *************************************************************************** + +inline TRandomValue getRandomValue (float value) +{ + return (TRandomValue)(value*32767.f); +} + +// *************************************************************************** + +inline float getNextRandomValue (TRandomValue &previous) +{ + return (float)(((previous = previous * 214013L + 2531011L) >> 16) & 0x7fff)/32767.f; +} + +// *************************************************************************** +// Gaussian +// *************************************************************************** + +inline void initGaussian (float radius, float *values, uint size) +{ + uint dx, dy; + double sd, c1, c2; + + /* This formula isn't really correct, but it'll do */ + sd = radius / 3.329042969; + c1 = 1.0 / sqrt(2.0 * NLMISC::Pi * sd); + c2 = -2.0 * (sd * sd); + + for (dy=0; dy +inline void copyPixels (float *dst, uint dstWidth, uint dstHeight, sint dstX, sint dstY, const float *src, uint srcWidth, + uint srcHeight, bool tileX, bool tileY, const A &transfo) +{ + // ********* + // * 0 * 2 * + // ********* + // * 1 * 3 * + // ********* + + const uint dstWidthMask = dstWidth-1; + const uint dstHeightMask = dstHeight-1; + + uint srcHeightLeft = srcHeight; + sint y = dstY; + sint srcY = 0; + while (srcHeightLeft) + { + const uint heightToCopy = std::min(srcHeightLeft, dstHeight - (y&dstHeightMask)); + + if (tileY || ((y>=0) && (y<(sint)dstHeight))) + { + uint srcWidthLeft = srcWidth; + sint x = dstX; + sint srcX = 0; + while (srcWidthLeft) + { + const uint widthToCopy = std::min(srcWidthLeft, dstWidth - (x&dstWidthMask)); + + if (tileX || ((x>=0) && (x<(sint)dstWidth))) + { + uint i; + for (i=0; i +inline void addPixels (float *dst, uint dstWidth, uint dstHeight, sint dstX, sint dstY, const float *src, uint srcWidth, + uint srcHeight, bool tileX, bool tileY, float *colorToTransform, const A &transfo) +{ + // ********* + // * 0 * 2 * + // ********* + // * 1 * 3 * + // ********* + + const uint dstWidthMask = dstWidth-1; + const uint dstHeightMask = dstHeight-1; + + uint srcHeightLeft = srcHeight; + sint y = dstY; + sint srcY = 0; + while (srcHeightLeft) + { + const uint heightToCopy = std::min(srcHeightLeft, dstHeight - (y&dstHeightMask)); + + if (tileY || ((y>=0) && (y<(sint)dstHeight))) + { + uint srcWidthLeft = srcWidth; + sint x = dstX; + sint srcX = 0; + while (srcWidthLeft) + { + const uint widthToCopy = std::min(srcWidthLeft, dstWidth - (x&dstWidthMask)); + + if (tileX || ((x>=0) && (x<(sint)dstWidth))) + { + uint i; + for (i=0; i Copyright (c) 1997, All Rights Reserved. + **********************************************************************/ +#include "tex_gen_3dsmax3.h" + +extern ClassDesc2* Gettex_gen_3dsmax3Desc(); + +HINSTANCE hInstance; +int controlsInit = FALSE; + +// This function is called by Windows when the DLL is loaded. This +// function may also be called many times during time critical operations +// like rendering. Therefore developers need to be careful what they +// do inside this function. In the code below, note how after the DLL is +// loaded the first time only a few statements are executed. + +BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) +{ + hInstance = hinstDLL; // Hang on to this DLL's instance handle. + + if (!controlsInit) { + controlsInit = TRUE; + InitCustomControls(hInstance); // Initialize MAX's custom controls + InitCommonControls(); // Initialize Win95 controls + } + + return (TRUE); +} + +// This function returns a string that describes the DLL and where the user +// could purchase the DLL if they don't have it. +__declspec( dllexport ) const TCHAR* LibDescription() +{ + return GetString(IDS_LIBDESCRIPTION); +} + +// This function returns the number of plug-in classes this DLL +//TODO: Must change this number when adding a new class +__declspec( dllexport ) int LibNumberClasses() +{ + return 1; +} + +// This function returns the number of plug-in classes this DLL +__declspec( dllexport ) ClassDesc* LibClassDesc(int i) +{ + switch(i) { + case 0: return Gettex_gen_3dsmax3Desc(); + default: return 0; + } +} + +// This function returns a pre-defined constant indicating the version of +// the system under which it was compiled. It is used to allow the system +// to catch obsolete DLLs. +__declspec( dllexport ) ULONG LibVersion() +{ + return VERSION_3DSMAX; +} + +TCHAR *GetString(int id) +{ + static TCHAR buf[256]; + + if (hInstance) + return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL; + return NULL; +} + diff --git a/tools/tex_gen_3dsmax3/clean_all.bat b/tools/tex_gen_3dsmax3/clean_all.bat new file mode 100644 index 0000000..8f0237c --- /dev/null +++ b/tools/tex_gen_3dsmax3/clean_all.bat @@ -0,0 +1 @@ +del *.exe;*.obj;*.dll;*.pch;*.ilk;*.pdb;*.sbr;*.idb;*.plg;*.ncb;*.opt /S \ No newline at end of file diff --git a/tools/tex_gen_3dsmax3/make_tex_gen_3dsmax3.bat b/tools/tex_gen_3dsmax3/make_tex_gen_3dsmax3.bat new file mode 100644 index 0000000..4f6c4a0 --- /dev/null +++ b/tools/tex_gen_3dsmax3/make_tex_gen_3dsmax3.bat @@ -0,0 +1,4 @@ +call "C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat" +set INCLUDE=C:\LIB\STLPORT\STLPORT;C:\Program Files\Microsoft SDK\include;r:\code\nel\src;r:\code\nel\include;C:\Program Files\3dsmax3_1\Maxsdk\Include;%INCLUDE% +set LIB=C:\LIB\STLPORT\LIB;C:\Program Files\Microsoft SDK\lib;r:\code\nel\lib;C:\Program Files\3dsmax3_1\Maxsdk\lib;%LIB% +msdev ../tex_gen_editor/nel_tex_gen.dsw /MAKE "tex_gen_3dsmax3 - Win32 Release" /USEENV diff --git a/tools/tex_gen_3dsmax3/resource.h b/tools/tex_gen_3dsmax3/resource.h new file mode 100644 index 0000000..dcce621 --- /dev/null +++ b/tools/tex_gen_3dsmax3/resource.h @@ -0,0 +1,29 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by tex_gen_3dsmax3.rc +// + +#define IDS_LIBDESCRIPTION 1 +#define IDS_CATEGORY 2 +#define IDS_CLASS_NAME 3 +#define IDS_PARAMS 4 +#define IDS_SPIN 5 + + +#define IDD_PANEL 101 +#define IDC_CLOSEBUTTON 1000 +#define IDC_DOSTUFF 1000 +#define IDC_COLOR 1456 +#define IDC_EDIT 1490 +#define IDC_SPIN 1496 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.cpp b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.cpp new file mode 100644 index 0000000..48ae5fe --- /dev/null +++ b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.cpp @@ -0,0 +1,220 @@ +/********************************************************************** + *< + FILE: tex_gen_3dsmax3.cpp + + DESCRIPTION: Appwizard generated plugin + + CREATED BY: + + HISTORY: + + *> Copyright (c) 1997, All Rights Reserved. + **********************************************************************/ + +#include "tex_gen_3dsmax3.h" + +#undef max +#undef min + +#include "nel/misc/rgba.h" +#include "nel/misc/file.h" +#include "tex_gen/basics.h" +#include "tex_gen/tex_gen_document.h" +#include "tex_gen/bitmap_float.h" +#include "tex_gen/tex_gen_op.h" + +#define _tex_gen_3dsmax3_CLASS_ID Class_ID(0x391acadf, 0x48bfce7c) + +#define PBLOCK_REF 0 + +using namespace NLMISC; +using namespace NLTEXGEN; + + + +class _tex_gen_3dsmax3 : public BitmapIO { + public: + // Parameter block + IParamBlock2 *pblock; //ref 0 + + // Loading/Saving + IOResult Load(ILoad *iload); + IOResult Save(ISave *isave); + + //From Animatable + Class_ID ClassID() {return _tex_gen_3dsmax3_CLASS_ID;} + SClass_ID SuperClassID() { return BMM_IO_CLASS_ID; } + void GetClassName(TSTR& s) {s = GetString(IDS_CLASS_NAME);} + + RefTargetHandle Clone( RemapDir &remap ); + RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, + PartID& partID, RefMessage message); + + int NumSubs() { return 1; } + TSTR SubAnimName(int i) { return GetString(IDS_PARAMS); } + Animatable* SubAnim(int i) { return pblock; } + int NumRefs() { return 1; } + RefTargetHandle GetReference(int i) { return pblock; } + void SetReference(int i, RefTargetHandle rtarg) { pblock=(IParamBlock2*)rtarg; } + + int NumParamBlocks() { return 1; } // return number of ParamBlocks in this instance + IParamBlock2* GetParamBlock(int i) { return pblock; } // return i'th ParamBlock + IParamBlock2* GetParamBlockByID(BlockID id) { return (pblock->ID() == id) ? pblock : NULL; } // return id'd ParamBlock + void DeleteThis() { delete this; } + + // Implementation + int ExtCount() { return 1; } + const TCHAR *Ext( int n ) { return "texgen"; } + const TCHAR *LongDesc( ) { return "NeL Texture Generator Image File"; } + const TCHAR *ShortDesc() { return "NeL Tex Gen"; } + const TCHAR *AuthorName() { return "Cyril \"Hulud\" Corvazier"; } + const TCHAR *CopyrightMessage() { return "This code is released under GNU GPL, Digital Murder 2003"; } + UINT Version() { return 1; } + int Capability() { return BMMIO_READER | BMMIO_EXTENSION; } + void ShowAbout( HWND hWnd ) { MessageBox (hWnd, "NeL TexGen Image Loader by Cyril \"Hulud\" Corvazier for Digital Murder 2003\nRelease under GNU GPL", "About NeL TexGen For 3dsmax", MB_OK|MB_ICONINFORMATION); } + DWORD EvaluateConfigure( ) { return 0; } + BOOL LoadConfigure( void *ptr ) { return TRUE; } + BOOL SaveConfigure( void *ptr ) { return TRUE; } + BMMRES GetImageInfo( BitmapInfo *bi ) + { + bi->SetWidth(256); + bi->SetHeight(256); + bi->SetType(BMM_TRUE_64); + bi->SetAspect(1.0f); + bi->SetGamma(1.0f); + bi->SetFirstFrame(0); + bi->SetLastFrame(0); + return BMMRES_SUCCESS; + } + BitmapStorage *Load( BitmapInfo *bi, Bitmap *map, BMMRES *status ) + { + openMode = BMM_OPEN_R; + + CIFile file; + if (file.open (bi->Filename())) + { + try + { + NLTEXGEN::CTexGenDocument doc; + file.serial(doc); + + CFloatBitmap bitmap; + CRenderParameter renderParameters (false, false, false); + doc.Operators[0]->eval (bitmap, renderParameters); + if ((bitmap.getWidth() != 0) && (bitmap.getHeight() != 0)) + { + const float *pixels = bitmap.getPixels(); + bi->SetWidth(bitmap.getWidth()); + bi->SetHeight(bitmap.getHeight()); + bi->SetType(BMM_TRUE_64); + bi->SetAspect(1.0f); + bi->SetGamma(1.0f); + bi->SetFirstFrame(0); + bi->SetLastFrame(0); + + BitmapStorage *s = BMMCreateStorage(map->Manager(), BMM_TRUE_32); + if (s->Allocate(bi,map->Manager(), BMM_OPEN_R)==0) + { + if(s) + { + delete s; + s = NULL; + } + return NULL; + } + + uint y; + BMM_Color_64 *line = new BMM_Color_64[bitmap.getWidth()]; + for (y=0; yPutPixels(0, y, bitmap.getWidth(), line); + } + delete line; + + s->bi.CopyImageInfo(bi); + + return s; + } + else + { + *status = BMMRES_INVALIDFORMAT; + } + } + catch (Exception &) + { + *status = BMMRES_CORRUPTFILE; + } + } + else + { + *status = BMMRES_FILENOTFOUND; + } + return NULL; + } + + //Constructor/Destructor + _tex_gen_3dsmax3() + { + static bool initialized = false; + if (!initialized) + { + registerTypes(); + initialized = true; + } + }; + ~_tex_gen_3dsmax3() {}; +}; + + +class _tex_gen_3dsmax3ClassDesc:public ClassDesc2 { + public: + int IsPublic() {return 1;} + void * Create(BOOL loading = FALSE) {return new _tex_gen_3dsmax3();} + const TCHAR * ClassName() {return GetString(IDS_CLASS_NAME);} + SClass_ID SuperClassID() {return BMM_IO_CLASS_ID;} + Class_ID ClassID() {return _tex_gen_3dsmax3_CLASS_ID;} + const TCHAR* Category() {return GetString(IDS_CATEGORY);} + const TCHAR* InternalName() { return _T("_tex_gen_3dsmax3"); } // returns fixed parsable name (scripter-visible name) + HINSTANCE HInstance() { return hInstance; } // returns owning module handle +}; + +static _tex_gen_3dsmax3ClassDesc _tex_gen_3dsmax3Desc; +ClassDesc2* Gettex_gen_3dsmax3Desc() {return &_tex_gen_3dsmax3Desc;} + +enum { _tex_gen_3dsmax3_params }; + +//TODO: Add enums for various parameters +enum { + pb_spin, +}; + +static ParamBlockDesc2 _tex_gen_3dsmax3_param_blk ( _tex_gen_3dsmax3_params, _T("params"), 0, &_tex_gen_3dsmax3Desc, + P_AUTO_CONSTRUCT + P_AUTO_UI, PBLOCK_REF, + //rollout + IDD_PANEL, IDS_PARAMS, 0, 0, NULL, + // params + pb_spin, _T("spin"), TYPE_FLOAT, P_ANIMATABLE, IDS_SPIN, + p_default, 0.1f, + p_range, 0.0f,1000.0f, + p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_EDIT, IDC_SPIN, 0.01f, + end, + end + ); + + diff --git a/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.def b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.def new file mode 100644 index 0000000..faf6e1a --- /dev/null +++ b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.def @@ -0,0 +1,8 @@ +LIBRARY tex_gen_3dsmax3 +EXPORTS + LibDescription @1 + LibNumberClasses @2 + LibClassDesc @3 + LibVersion @4 +SECTIONS + .data READ WRITE diff --git a/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dep b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dep new file mode 100644 index 0000000..0522afe --- /dev/null +++ b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dep @@ -0,0 +1,338 @@ +# Microsoft Developer Studio Generated Dependency File, included by tex_gen_3dsmax3.mak + +.\DllEntry.cpp : \ + ".\tex_gen_3dsmax3.h"\ + "c:\lib\stlport\stlport\config\_epilog.h"\ + "c:\lib\stlport\stlport\config\_msvc_warnings_off.h"\ + "c:\lib\stlport\stlport\config\_prolog.h"\ + "c:\lib\stlport\stlport\config\stl_confix.h"\ + "c:\lib\stlport\stlport\config\stl_msvc.h"\ + "c:\lib\stlport\stlport\config\stl_select_lib.h"\ + "c:\lib\stlport\stlport\config\stlcomp.h"\ + "c:\lib\stlport\stlport\config\vc_select_lib.h"\ + "c:\lib\stlport\stlport\stl\_config.h"\ + "c:\lib\stlport\stlport\stl\_config_compat.h"\ + "c:\lib\stlport\stlport\stl\_config_compat_post.h"\ + "c:\lib\stlport\stlport\stl\_epilog.h"\ + "c:\lib\stlport\stlport\stl\_limits.c"\ + "c:\lib\stlport\stlport\stl\_limits.h"\ + "c:\lib\stlport\stlport\stl\_prolog.h"\ + "c:\lib\stlport\stlport\stl\_site_config.h"\ + "c:\lib\stlport\stlport\stl_user_config.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\acolor.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\animtbl.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\appio.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\assert1.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\bitarray.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\bitmap.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\bmmlib.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\box2.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\box3.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\buildver.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\captypes.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\channels.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\cmdmode.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\color.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\coreexp.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\custcont.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\dbgprint.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\dpoint3.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\euler.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\evuser.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\export.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\gbuf.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\gencam.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\genhier.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\genlight.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\genshape.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\geom.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\geomlib.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\gfloat.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\gfx.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\gfxlib.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\gutil.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\hitdata.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\hold.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\impapi.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\impexp.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\imtl.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\inode.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\interval.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\ioapi.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\iparamb.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\iparamb2.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\iparamm.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\iparamm2.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\ipoint2.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\ipoint3.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\istdplug.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\linklist.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\lockid.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\log.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\matrix2.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\matrix3.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\max.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\maxapi.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\maxcom.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\maxtess.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\maxtypes.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\mesh.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\meshlib.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\mouseman.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\mtl.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\namesel.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\nametab.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\object.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\objmode.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\palutil.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\patch.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\patchlib.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\patchobj.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\plugapi.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\plugin.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\point2.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\point3.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\point4.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\polyshp.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\ptrvec.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\quat.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\random.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\ref.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\render.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\rtclick.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\sbmtlapi.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\sceneapi.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\shape.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\shphier.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\shpsels.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\snap.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\soundobj.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\spline3d.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\stack.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\stack3.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\strbasic.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\strclass.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\svcore.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\tab.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\templt.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\trig.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\triobj.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\units.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\utilexp.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\utillib.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\vedge.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\winutil.h"\ + "c:\program files\microsoft visual studio\vc98\include\basetsd.h"\ + + +.\tex_gen_3dsmax3.cpp : \ + "..\..\..\include\nel\memory\memory_manager.h"\ + "..\..\..\include\nel\misc\class_registry.h"\ + "..\..\..\include\nel\misc\common.h"\ + "..\..\..\include\nel\misc\debug.h"\ + "..\..\..\include\nel\misc\displayer.h"\ + "..\..\..\include\nel\misc\file.h"\ + "..\..\..\include\nel\misc\log.h"\ + "..\..\..\include\nel\misc\mem_displayer.h"\ + "..\..\..\include\nel\misc\mutex.h"\ + "..\..\..\include\nel\misc\rgba.h"\ + "..\..\..\include\nel\misc\stream.h"\ + "..\..\..\include\nel\misc\stream_inline.h"\ + "..\..\..\include\nel\misc\time_nl.h"\ + "..\..\..\include\nel\misc\types_nl.h"\ + "..\..\..\include\nel\misc\ucstring.h"\ + "..\..\..\src\tex_gen\basics.h"\ + "..\..\..\src\tex_gen\bitmap_float.h"\ + "..\..\..\src\tex_gen\tex_gen_document.h"\ + "..\..\..\src\tex_gen\tex_gen_op.h"\ + ".\tex_gen_3dsmax3.h"\ + "c:\lib\stlport\stlport\config\_epilog.h"\ + "c:\lib\stlport\stlport\config\_msvc_warnings_off.h"\ + "c:\lib\stlport\stlport\config\_prolog.h"\ + "c:\lib\stlport\stlport\config\stl_confix.h"\ + "c:\lib\stlport\stlport\config\stl_msvc.h"\ + "c:\lib\stlport\stlport\config\stl_select_lib.h"\ + "c:\lib\stlport\stlport\config\stlcomp.h"\ + "c:\lib\stlport\stlport\config\vc_select_lib.h"\ + "c:\lib\stlport\stlport\stl\_algo.c"\ + "c:\lib\stlport\stlport\stl\_algo.h"\ + "c:\lib\stlport\stlport\stl\_algobase.c"\ + "c:\lib\stlport\stlport\stl\_algobase.h"\ + "c:\lib\stlport\stlport\stl\_alloc.h"\ + "c:\lib\stlport\stlport\stl\_auto_ptr.h"\ + "c:\lib\stlport\stlport\stl\_bvector.h"\ + "c:\lib\stlport\stlport\stl\_config.h"\ + "c:\lib\stlport\stlport\stl\_config_compat.h"\ + "c:\lib\stlport\stlport\stl\_config_compat_post.h"\ + "c:\lib\stlport\stlport\stl\_construct.h"\ + "c:\lib\stlport\stlport\stl\_ctraits_fns.h"\ + "c:\lib\stlport\stlport\stl\_ctype.h"\ + "c:\lib\stlport\stlport\stl\_deque.c"\ + "c:\lib\stlport\stlport\stl\_deque.h"\ + "c:\lib\stlport\stlport\stl\_epilog.h"\ + "c:\lib\stlport\stlport\stl\_function.h"\ + "c:\lib\stlport\stlport\stl\_function_base.h"\ + "c:\lib\stlport\stlport\stl\_hash_fun.h"\ + "c:\lib\stlport\stlport\stl\_heap.c"\ + "c:\lib\stlport\stlport\stl\_heap.h"\ + "c:\lib\stlport\stlport\stl\_ios.c"\ + "c:\lib\stlport\stlport\stl\_ios.h"\ + "c:\lib\stlport\stlport\stl\_ios_base.h"\ + "c:\lib\stlport\stlport\stl\_iosfwd.h"\ + "c:\lib\stlport\stlport\stl\_istream.c"\ + "c:\lib\stlport\stlport\stl\_istream.h"\ + "c:\lib\stlport\stlport\stl\_istreambuf_iterator.h"\ + "c:\lib\stlport\stlport\stl\_iterator.h"\ + "c:\lib\stlport\stlport\stl\_iterator_base.h"\ + "c:\lib\stlport\stlport\stl\_iterator_old.h"\ + "c:\lib\stlport\stlport\stl\_limits.c"\ + "c:\lib\stlport\stlport\stl\_limits.h"\ + "c:\lib\stlport\stlport\stl\_list.c"\ + "c:\lib\stlport\stlport\stl\_list.h"\ + "c:\lib\stlport\stlport\stl\_locale.h"\ + "c:\lib\stlport\stlport\stl\_map.h"\ + "c:\lib\stlport\stlport\stl\_num_get.c"\ + "c:\lib\stlport\stlport\stl\_num_get.h"\ + "c:\lib\stlport\stlport\stl\_num_put.c"\ + "c:\lib\stlport\stlport\stl\_num_put.h"\ + "c:\lib\stlport\stlport\stl\_numpunct.h"\ + "c:\lib\stlport\stlport\stl\_ostream.c"\ + "c:\lib\stlport\stlport\stl\_ostream.h"\ + "c:\lib\stlport\stlport\stl\_ostreambuf_iterator.h"\ + "c:\lib\stlport\stlport\stl\_pair.h"\ + "c:\lib\stlport\stlport\stl\_prolog.h"\ + "c:\lib\stlport\stlport\stl\_range_errors.h"\ + "c:\lib\stlport\stlport\stl\_raw_storage_iter.h"\ + "c:\lib\stlport\stlport\stl\_relops_cont.h"\ + "c:\lib\stlport\stlport\stl\_set.h"\ + "c:\lib\stlport\stlport\stl\_site_config.h"\ + "c:\lib\stlport\stlport\stl\_sstream.c"\ + "c:\lib\stlport\stlport\stl\_sstream.h"\ + "c:\lib\stlport\stlport\stl\_stdio_file.h"\ + "c:\lib\stlport\stlport\stl\_streambuf.c"\ + "c:\lib\stlport\stlport\stl\_streambuf.h"\ + "c:\lib\stlport\stlport\stl\_string.c"\ + "c:\lib\stlport\stlport\stl\_string.h"\ + "c:\lib\stlport\stlport\stl\_string_fwd.c"\ + "c:\lib\stlport\stlport\stl\_string_fwd.h"\ + "c:\lib\stlport\stlport\stl\_string_hash.h"\ + "c:\lib\stlport\stlport\stl\_string_io.c"\ + "c:\lib\stlport\stlport\stl\_string_io.h"\ + "c:\lib\stlport\stlport\stl\_tempbuf.c"\ + "c:\lib\stlport\stlport\stl\_tempbuf.h"\ + "c:\lib\stlport\stlport\stl\_threads.c"\ + "c:\lib\stlport\stlport\stl\_threads.h"\ + "c:\lib\stlport\stlport\stl\_tree.c"\ + "c:\lib\stlport\stlport\stl\_tree.h"\ + "c:\lib\stlport\stlport\stl\_uninitialized.h"\ + "c:\lib\stlport\stlport\stl\_vector.c"\ + "c:\lib\stlport\stlport\stl\_vector.h"\ + "c:\lib\stlport\stlport\stl\c_locale.h"\ + "c:\lib\stlport\stlport\stl\char_traits.h"\ + "c:\lib\stlport\stlport\stl\type_traits.h"\ + "c:\lib\stlport\stlport\stl_user_config.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\acolor.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\animtbl.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\appio.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\assert1.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\bitarray.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\bitmap.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\bmmlib.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\box2.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\box3.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\buildver.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\captypes.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\channels.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\cmdmode.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\color.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\coreexp.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\custcont.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\dbgprint.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\dpoint3.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\euler.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\evuser.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\export.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\gbuf.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\gencam.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\genhier.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\genlight.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\genshape.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\geom.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\geomlib.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\gfloat.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\gfx.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\gfxlib.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\gutil.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\hitdata.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\hold.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\impapi.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\impexp.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\imtl.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\inode.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\interval.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\ioapi.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\iparamb.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\iparamb2.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\iparamm.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\iparamm2.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\ipoint2.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\ipoint3.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\istdplug.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\linklist.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\lockid.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\log.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\matrix2.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\matrix3.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\max.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\maxapi.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\maxcom.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\maxtess.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\maxtypes.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\mesh.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\meshlib.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\mouseman.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\mtl.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\namesel.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\nametab.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\object.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\objmode.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\palutil.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\patch.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\patchlib.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\patchobj.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\plugapi.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\plugin.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\point2.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\point3.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\point4.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\polyshp.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\ptrvec.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\quat.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\random.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\ref.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\render.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\rtclick.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\sbmtlapi.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\sceneapi.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\shape.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\shphier.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\shpsels.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\snap.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\soundobj.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\spline3d.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\stack.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\stack3.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\strbasic.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\strclass.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\svcore.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\tab.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\templt.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\trig.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\triobj.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\units.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\utilexp.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\utillib.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\vedge.h"\ + "c:\program files\3dsmax3_1\maxsdk\include\winutil.h"\ + "c:\program files\microsoft visual studio\vc98\include\basetsd.h"\ + diff --git a/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dsp b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dsp new file mode 100644 index 0000000..6339bf2 --- /dev/null +++ b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dsp @@ -0,0 +1,155 @@ +# Microsoft Developer Studio Project File - Name="tex_gen_3dsmax3" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=tex_gen_3dsmax3 - Win32 Hybrid +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "tex_gen_3dsmax3.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "tex_gen_3dsmax3.mak" CFG="tex_gen_3dsmax3 - Win32 Hybrid" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "tex_gen_3dsmax3 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "tex_gen_3dsmax3 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "tex_gen_3dsmax3 - Win32 Hybrid" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /G6 /MD /W3 /GR /GX /O2 /I "C:\3dsmax3_1\Maxsdk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "NDEBUG" +# ADD RSC /l 0x40c /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib bmm.lib core.lib maxutil.lib maxscrpt.lib paramblk2.lib freetype214MT.lib /nologo /base:"0x105b0000" /subsystem:windows /dll /machine:I386 /out:"C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.bmi" /libpath:"C:\3dsmax3_1\Maxsdk\lib" /release + +!ELSEIF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MDd /W3 /Gm /GR /GX /ZI /Od /I "C:\3dsmax3_1\Maxsdk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__STL_DEBUG" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "_DEBUG" +# ADD RSC /l 0x40c /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib bmm.lib core.lib maxutil.lib maxscrpt.lib paramblk2.lib freetype214MT.lib /nologo /base:"0x105b0000" /subsystem:windows /dll /debug /machine:I386 /out:"C:\3dsmax3_1 debug\exe\Plugins\tex_gen_3dsmax3.bmi" /pdbtype:sept /libpath:"C:\3dsmax3_1\Maxsdk\lib" + +!ELSEIF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Hybrid" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "tex_gen_3dsmax3___Win32_Hybrid" +# PROP BASE Intermediate_Dir "tex_gen_3dsmax3___Win32_Hybrid" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "tex_gen_3dsmax3___Win32_Hybrid" +# PROP Intermediate_Dir "tex_gen_3dsmax3___Win32_Hybrid" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MD /W3 /Gm /GR /GX /ZI /Od /I "C:\3dsmax3_1\Maxsdk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "_DEBUG" +# ADD RSC /l 0x40c /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib bmm.lib core.lib maxutil.lib maxscrpt.lib paramblk2.lib freetype214MT.lib /nologo /base:"0x105b0000" /subsystem:windows /dll /debug /machine:I386 /out:"C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.bmi" /pdbtype:sept /libpath:"C:\3dsmax3_1\Maxsdk\lib" + +!ENDIF + +# Begin Target + +# Name "tex_gen_3dsmax3 - Win32 Release" +# Name "tex_gen_3dsmax3 - Win32 Debug" +# Name "tex_gen_3dsmax3 - Win32 Hybrid" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\DllEntry.cpp +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_3dsmax3.cpp +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_3dsmax3.def +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_3dsmax3.rc +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_3dsmax3.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dsw b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dsw new file mode 100644 index 0000000..9a93e51 --- /dev/null +++ b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "tex_gen_3dsmax3"=.\tex_gen_3dsmax3.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.h b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.h new file mode 100644 index 0000000..dc7f421 --- /dev/null +++ b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.h @@ -0,0 +1,28 @@ +/********************************************************************** + *< + FILE: tex_gen_3dsmax3.h + + DESCRIPTION: Template Utility + + CREATED BY: + + HISTORY: + + *> Copyright (c) 1997, All Rights Reserved. + **********************************************************************/ + +#ifndef __tex_gen_3dsmax3__H +#define __tex_gen_3dsmax3__H + +#include "Max.h" +#include "resource.h" +#include "istdplug.h" +#include "iparamb2.h" +#include "iparamm2.h" + + +extern TCHAR *GetString(int id); + +extern HINSTANCE hInstance; + +#endif // __tex_gen_3dsmax3__H diff --git a/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.mak b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.mak new file mode 100644 index 0000000..5545a86 --- /dev/null +++ b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.mak @@ -0,0 +1,316 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on tex_gen_3dsmax3.dsp +!IF "$(CFG)" == "" +CFG=tex_gen_3dsmax3 - Win32 Hybrid +!MESSAGE No configuration specified. Defaulting to tex_gen_3dsmax3 - Win32 Hybrid. +!ENDIF + +!IF "$(CFG)" != "tex_gen_3dsmax3 - Win32 Release" && "$(CFG)" != "tex_gen_3dsmax3 - Win32 Debug" && "$(CFG)" != "tex_gen_3dsmax3 - Win32 Hybrid" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "tex_gen_3dsmax3.mak" CFG="tex_gen_3dsmax3 - Win32 Hybrid" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "tex_gen_3dsmax3 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "tex_gen_3dsmax3 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "tex_gen_3dsmax3 - Win32 Hybrid" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release + +!IF "$(RECURSE)" == "0" + +ALL : "C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.bmi" + +!ELSE + +ALL : "tex_gen - Win32 Release" "misc - Win32 Release" "C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.bmi" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"misc - Win32 ReleaseCLEAN" "tex_gen - Win32 ReleaseCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\DllEntry.obj" + -@erase "$(INTDIR)\tex_gen_3dsmax3.obj" + -@erase "$(INTDIR)\tex_gen_3dsmax3.res" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\tex_gen_3dsmax3.exp" + -@erase "$(OUTDIR)\tex_gen_3dsmax3.lib" + -@erase "C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.bmi" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /G6 /MD /W3 /GR /GX /O2 /I "C:\3dsmax3_1\Maxsdk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\tex_gen_3dsmax3.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x40c /fo"$(INTDIR)\tex_gen_3dsmax3.res" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\tex_gen_3dsmax3.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib bmm.lib core.lib maxutil.lib maxscrpt.lib paramblk2.lib /nologo /base:"0x105b0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\tex_gen_3dsmax3.pdb" /machine:I386 /def:".\tex_gen_3dsmax3.def" /out:"C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.bmi" /implib:"$(OUTDIR)\tex_gen_3dsmax3.lib" /libpath:"C:\3dsmax3_1\Maxsdk\lib" /release +DEF_FILE= \ + ".\tex_gen_3dsmax3.def" +LINK32_OBJS= \ + "$(INTDIR)\DllEntry.obj" \ + "$(INTDIR)\tex_gen_3dsmax3.obj" \ + "$(INTDIR)\tex_gen_3dsmax3.res" \ + "..\..\..\lib\nlmisc_r.lib" \ + "..\..\..\lib\nltex_gen_r.lib" + +"C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.bmi" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug + +!IF "$(RECURSE)" == "0" + +ALL : "C:\3dsmax3_1 debug\exe\Plugins\tex_gen_3dsmax3.bmi" + +!ELSE + +ALL : "tex_gen - Win32 Debug" "misc - Win32 Debug" "C:\3dsmax3_1 debug\exe\Plugins\tex_gen_3dsmax3.bmi" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"misc - Win32 DebugCLEAN" "tex_gen - Win32 DebugCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\DllEntry.obj" + -@erase "$(INTDIR)\tex_gen_3dsmax3.obj" + -@erase "$(INTDIR)\tex_gen_3dsmax3.res" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\tex_gen_3dsmax3.exp" + -@erase "$(OUTDIR)\tex_gen_3dsmax3.lib" + -@erase "$(OUTDIR)\tex_gen_3dsmax3.pdb" + -@erase "C:\3dsmax3_1 debug\exe\Plugins\tex_gen_3dsmax3.bmi" + -@erase "C:\3dsmax3_1 debug\exe\Plugins\tex_gen_3dsmax3.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /G6 /MDd /W3 /Gm /GR /GX /ZI /Od /I "C:\3dsmax3_1\Maxsdk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__STL_DEBUG" /Fp"$(INTDIR)\tex_gen_3dsmax3.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x40c /fo"$(INTDIR)\tex_gen_3dsmax3.res" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\tex_gen_3dsmax3.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib bmm.lib core.lib maxutil.lib maxscrpt.lib paramblk2.lib /nologo /base:"0x105b0000" /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\tex_gen_3dsmax3.pdb" /debug /machine:I386 /def:".\tex_gen_3dsmax3.def" /out:"C:\3dsmax3_1 debug\exe\Plugins\tex_gen_3dsmax3.bmi" /implib:"$(OUTDIR)\tex_gen_3dsmax3.lib" /pdbtype:sept /libpath:"C:\3dsmax3_1\Maxsdk\lib" +DEF_FILE= \ + ".\tex_gen_3dsmax3.def" +LINK32_OBJS= \ + "$(INTDIR)\DllEntry.obj" \ + "$(INTDIR)\tex_gen_3dsmax3.obj" \ + "$(INTDIR)\tex_gen_3dsmax3.res" \ + "..\..\..\lib\nlmisc_d.lib" \ + "..\..\..\lib\nltex_gen_d.lib" + +"C:\3dsmax3_1 debug\exe\Plugins\tex_gen_3dsmax3.bmi" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Hybrid" + +OUTDIR=.\tex_gen_3dsmax3___Win32_Hybrid +INTDIR=.\tex_gen_3dsmax3___Win32_Hybrid + +!IF "$(RECURSE)" == "0" + +ALL : "C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.bmi" + +!ELSE + +ALL : "C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.bmi" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN : +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\DllEntry.obj" + -@erase "$(INTDIR)\tex_gen_3dsmax3.obj" + -@erase "$(INTDIR)\tex_gen_3dsmax3.res" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\tex_gen_3dsmax3.exp" + -@erase "$(OUTDIR)\tex_gen_3dsmax3.lib" + -@erase "$(OUTDIR)\tex_gen_3dsmax3.pdb" + -@erase "C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.bmi" + -@erase "C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /G6 /MD /W3 /Gm /GR /GX /ZI /Od /I "C:\3dsmax3_1\Maxsdk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\tex_gen_3dsmax3.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x40c /fo"$(INTDIR)\tex_gen_3dsmax3.res" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\tex_gen_3dsmax3.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib bmm.lib core.lib maxutil.lib maxscrpt.lib paramblk2.lib /nologo /base:"0x105b0000" /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\tex_gen_3dsmax3.pdb" /debug /machine:I386 /def:".\tex_gen_3dsmax3.def" /out:"C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.bmi" /implib:"$(OUTDIR)\tex_gen_3dsmax3.lib" /pdbtype:sept /libpath:"C:\3dsmax3_1\Maxsdk\lib" +DEF_FILE= \ + ".\tex_gen_3dsmax3.def" +LINK32_OBJS= \ + "$(INTDIR)\DllEntry.obj" \ + "$(INTDIR)\tex_gen_3dsmax3.obj" \ + "$(INTDIR)\tex_gen_3dsmax3.res" + +"C:\program files\3dsmax3_1\Plugins\tex_gen_3dsmax3.bmi" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("tex_gen_3dsmax3.dep") +!INCLUDE "tex_gen_3dsmax3.dep" +!ELSE +!MESSAGE Warning: cannot find "tex_gen_3dsmax3.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Release" || "$(CFG)" == "tex_gen_3dsmax3 - Win32 Debug" || "$(CFG)" == "tex_gen_3dsmax3 - Win32 Hybrid" +SOURCE=.\DllEntry.cpp + +"$(INTDIR)\DllEntry.obj" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\tex_gen_3dsmax3.cpp + +"$(INTDIR)\tex_gen_3dsmax3.obj" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\tex_gen_3dsmax3.rc + +"$(INTDIR)\tex_gen_3dsmax3.res" : $(SOURCE) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +!IF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Release" + +"misc - Win32 Release" : + cd "\code\nel\src" + $(MAKE) /$(MAKEFLAGS) /F .\misc.mak CFG="misc - Win32 Release" + cd "..\tools\tex_gen\tex_gen_3dsmax3" + +"misc - Win32 ReleaseCLEAN" : + cd "\code\nel\src" + $(MAKE) /$(MAKEFLAGS) /F .\misc.mak CFG="misc - Win32 Release" RECURSE=1 CLEAN + cd "..\tools\tex_gen\tex_gen_3dsmax3" + +!ELSEIF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Debug" + +"misc - Win32 Debug" : + cd "\code\nel\src" + $(MAKE) /$(MAKEFLAGS) /F .\misc.mak CFG="misc - Win32 Debug" + cd "..\tools\tex_gen\tex_gen_3dsmax3" + +"misc - Win32 DebugCLEAN" : + cd "\code\nel\src" + $(MAKE) /$(MAKEFLAGS) /F .\misc.mak CFG="misc - Win32 Debug" RECURSE=1 CLEAN + cd "..\tools\tex_gen\tex_gen_3dsmax3" + +!ELSEIF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Hybrid" + +!ENDIF + +!IF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Release" + +"tex_gen - Win32 Release" : + cd "\code\nel\src" + $(MAKE) /$(MAKEFLAGS) /F .\tex_gen.mak CFG="tex_gen - Win32 Release" + cd "..\tools\tex_gen\tex_gen_3dsmax3" + +"tex_gen - Win32 ReleaseCLEAN" : + cd "\code\nel\src" + $(MAKE) /$(MAKEFLAGS) /F .\tex_gen.mak CFG="tex_gen - Win32 Release" RECURSE=1 CLEAN + cd "..\tools\tex_gen\tex_gen_3dsmax3" + +!ELSEIF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Debug" + +"tex_gen - Win32 Debug" : + cd "\code\nel\src" + $(MAKE) /$(MAKEFLAGS) /F .\tex_gen.mak CFG="tex_gen - Win32 Debug" + cd "..\tools\tex_gen\tex_gen_3dsmax3" + +"tex_gen - Win32 DebugCLEAN" : + cd "\code\nel\src" + $(MAKE) /$(MAKEFLAGS) /F .\tex_gen.mak CFG="tex_gen - Win32 Debug" RECURSE=1 CLEAN + cd "..\tools\tex_gen\tex_gen_3dsmax3" + +!ELSEIF "$(CFG)" == "tex_gen_3dsmax3 - Win32 Hybrid" + +!ENDIF + + +!ENDIF + diff --git a/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.rc b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.rc new file mode 100644 index 0000000..5ecf28e --- /dev/null +++ b/tools/tex_gen_3dsmax3/tex_gen_3dsmax3.rc @@ -0,0 +1,158 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// +IDD_PANEL DIALOG DISCARDABLE 0, 0, 108, 156 +STYLE WS_CHILD | WS_VISIBLE +FONT 8, "MS Sans Serif" +BEGIN + CTEXT "Generated by Plugin AppWizard\nCode && design by\nRavi Karra - Kinetix", + IDC_STATIC,7,7,94,36 + CONTROL "",IDC_EDIT,"CustEdit",WS_TABSTOP,29,114,35,10 + CONTROL "",IDC_SPIN,"SpinnerControl",0x0,65,114,7,10 + LTEXT "Spinner Cust Control:",IDC_STATIC,20,102,67,8 + CTEXT "TODO: Place panel controls here.",IDC_STATIC,15,63,78, + 19 +END + + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_PANEL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 101 + TOPMARGIN, 7 + BOTTOMMARGIN, 149 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 3,0,0,0 + PRODUCTVERSION 3,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileVersion", "3.0.0.0\0" + VALUE "InternalName", "3ds_test\0" + VALUE "LegalCopyright", "\0" + VALUE "OriginalFilename", "3ds_test.bmi\0" + VALUE "ProductName", "3D Studio MAX\0" + VALUE "ProductVersion", "3.0.0.0\0" + VALUE "FileDescription", "Read nel texgen textures\0" + VALUE "Comments", "TECH: \0" + VALUE "LegalTrademarks", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LIBDESCRIPTION "Read nel texgen textures" + IDS_CATEGORY "nel" + IDS_CLASS_NAME "3ds_test" + IDS_PARAMS "Parameters" + IDS_SPIN "Spin" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/tools/tex_gen_3dsmax5/DllEntry.cpp b/tools/tex_gen_3dsmax5/DllEntry.cpp new file mode 100644 index 0000000..3281c9e --- /dev/null +++ b/tools/tex_gen_3dsmax5/DllEntry.cpp @@ -0,0 +1,78 @@ +/********************************************************************** + *< + FILE: DllEntry.cpp + + DESCRIPTION:Contains the Dll Entry stuff + + CREATED BY: + + HISTORY: + + *> Copyright (c) 1997, All Rights Reserved. + **********************************************************************/ +#include "tex_gen_3dsmax5.h" + +extern ClassDesc2* Gettex_gen_3dsmax5Desc(); + +HINSTANCE hInstance; +int controlsInit = FALSE; + +// This function is called by Windows when the DLL is loaded. This +// function may also be called many times during time critical operations +// like rendering. Therefore developers need to be careful what they +// do inside this function. In the code below, note how after the DLL is +// loaded the first time only a few statements are executed. + +BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) +{ + hInstance = hinstDLL; // Hang on to this DLL's instance handle. + + if (!controlsInit) { + controlsInit = TRUE; + InitCustomControls(hInstance); // Initialize MAX's custom controls + InitCommonControls(); // Initialize Win95 controls + } + + return (TRUE); +} + +// This function returns a string that describes the DLL and where the user +// could purchase the DLL if they don't have it. +__declspec( dllexport ) const TCHAR* LibDescription() +{ + return GetString(IDS_LIBDESCRIPTION); +} + +// This function returns the number of plug-in classes this DLL +//TODO: Must change this number when adding a new class +__declspec( dllexport ) int LibNumberClasses() +{ + return 1; +} + +// This function returns the number of plug-in classes this DLL +__declspec( dllexport ) ClassDesc* LibClassDesc(int i) +{ + switch(i) { + case 0: return Gettex_gen_3dsmax5Desc(); + default: return 0; + } +} + +// This function returns a pre-defined constant indicating the version of +// the system under which it was compiled. It is used to allow the system +// to catch obsolete DLLs. +__declspec( dllexport ) ULONG LibVersion() +{ + return VERSION_3DSMAX; +} + +TCHAR *GetString(int id) +{ + static TCHAR buf[256]; + + if (hInstance) + return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL; + return NULL; +} + diff --git a/tools/tex_gen_3dsmax5/clean_all.bat b/tools/tex_gen_3dsmax5/clean_all.bat new file mode 100644 index 0000000..8f0237c --- /dev/null +++ b/tools/tex_gen_3dsmax5/clean_all.bat @@ -0,0 +1 @@ +del *.exe;*.obj;*.dll;*.pch;*.ilk;*.pdb;*.sbr;*.idb;*.plg;*.ncb;*.opt /S \ No newline at end of file diff --git a/tools/tex_gen_3dsmax5/compilation_notes.txt b/tools/tex_gen_3dsmax5/compilation_notes.txt new file mode 100644 index 0000000..3b1092d --- /dev/null +++ b/tools/tex_gen_3dsmax5/compilation_notes.txt @@ -0,0 +1,3 @@ +With Visual C++ 6 SP1 + Processor Pack + +-> You need to download and install the Platform SDK and put the include / lib directories before the visual original ones. \ No newline at end of file diff --git a/tools/tex_gen_3dsmax5/resource.h b/tools/tex_gen_3dsmax5/resource.h new file mode 100644 index 0000000..eb649cd --- /dev/null +++ b/tools/tex_gen_3dsmax5/resource.h @@ -0,0 +1,29 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by tex_gen_3dsmax5.rc +// + +#define IDS_LIBDESCRIPTION 1 +#define IDS_CATEGORY 2 +#define IDS_CLASS_NAME 3 +#define IDS_PARAMS 4 +#define IDS_SPIN 5 + + +#define IDD_PANEL 101 +#define IDC_CLOSEBUTTON 1000 +#define IDC_DOSTUFF 1000 +#define IDC_COLOR 1456 +#define IDC_EDIT 1490 +#define IDC_SPIN 1496 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.cpp b/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.cpp new file mode 100644 index 0000000..339a452 --- /dev/null +++ b/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.cpp @@ -0,0 +1,220 @@ +/********************************************************************** + *< + FILE: tex_gen_3dsmax5.cpp + + DESCRIPTION: Appwizard generated plugin + + CREATED BY: + + HISTORY: + + *> Copyright (c) 1997, All Rights Reserved. + **********************************************************************/ + +#include "tex_gen_3dsmax5.h" + +#undef max +#undef min + +#include "nel/misc/rgba.h" +#include "nel/misc/file.h" +#include "tex_gen/basics.h" +#include "tex_gen/tex_gen_document.h" +#include "tex_gen/bitmap_float.h" +#include "tex_gen/tex_gen_op.h" + +#define _tex_gen_3dsmax5_CLASS_ID Class_ID(0x391acadf, 0x48bfce7c) + +#define PBLOCK_REF 0 + +using namespace NLMISC; +using namespace NLTEXGEN; + + + +class _tex_gen_3dsmax5 : public BitmapIO { + public: + // Parameter block + IParamBlock2 *pblock; //ref 0 + + // Loading/Saving + IOResult Load(ILoad *iload); + IOResult Save(ISave *isave); + + //From Animatable + Class_ID ClassID() {return _tex_gen_3dsmax5_CLASS_ID;} + SClass_ID SuperClassID() { return BMM_IO_CLASS_ID; } + void GetClassName(TSTR& s) {s = GetString(IDS_CLASS_NAME);} + + RefTargetHandle Clone( RemapDir &remap ); + RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, + PartID& partID, RefMessage message); + + int NumSubs() { return 1; } + TSTR SubAnimName(int i) { return GetString(IDS_PARAMS); } + Animatable* SubAnim(int i) { return pblock; } + int NumRefs() { return 1; } + RefTargetHandle GetReference(int i) { return pblock; } + void SetReference(int i, RefTargetHandle rtarg) { pblock=(IParamBlock2*)rtarg; } + + int NumParamBlocks() { return 1; } // return number of ParamBlocks in this instance + IParamBlock2* GetParamBlock(int i) { return pblock; } // return i'th ParamBlock + IParamBlock2* GetParamBlockByID(BlockID id) { return (pblock->ID() == id) ? pblock : NULL; } // return id'd ParamBlock + void DeleteThis() { delete this; } + + // Implementation + int ExtCount() { return 1; } + const TCHAR *Ext( int n ) { return "texgen"; } + const TCHAR *LongDesc( ) { return "NeL Texture Generator Image File"; } + const TCHAR *ShortDesc() { return "NeL Tex Gen"; } + const TCHAR *AuthorName() { return "Cyril \"Hulud\" Corvazier"; } + const TCHAR *CopyrightMessage() { return "This code is released under GNU GPL, Digital Murder 2003"; } + UINT Version() { return 1; } + int Capability() { return BMMIO_READER | BMMIO_EXTENSION; } + void ShowAbout( HWND hWnd ) { MessageBox (hWnd, "NeL TexGen Image Loader by Cyril \"Hulud\" Corvazier for Digital Murder 2003\nRelease under GNU GPL", "About NeL TexGen For 3dsmax", MB_OK|MB_ICONINFORMATION); } + DWORD EvaluateConfigure( ) { return 0; } + BOOL LoadConfigure( void *ptr ) { return TRUE; } + BOOL SaveConfigure( void *ptr ) { return TRUE; } + BMMRES GetImageInfo( BitmapInfo *bi ) + { + bi->SetWidth(256); + bi->SetHeight(256); + bi->SetType(BMM_TRUE_64); + bi->SetAspect(1.0f); + bi->SetGamma(1.0f); + bi->SetFirstFrame(0); + bi->SetLastFrame(0); + return BMMRES_SUCCESS; + } + BitmapStorage *Load( BitmapInfo *bi, Bitmap *map, BMMRES *status ) + { + openMode = BMM_OPEN_R; + + CIFile file; + if (file.open (bi->Filename())) + { + try + { + NLTEXGEN::CTexGenDocument doc; + file.serial(doc); + + CFloatBitmap bitmap; + CRenderParameter renderParameters (false, false, false); + doc.Operators[0]->eval (bitmap, renderParameters); + if ((bitmap.getWidth() != 0) && (bitmap.getHeight() != 0)) + { + const float *pixels = bitmap.getPixels(); + bi->SetWidth(bitmap.getWidth()); + bi->SetHeight(bitmap.getHeight()); + bi->SetType(BMM_TRUE_64); + bi->SetAspect(1.0f); + bi->SetGamma(1.0f); + bi->SetFirstFrame(0); + bi->SetLastFrame(0); + + BitmapStorage *s = BMMCreateStorage(map->Manager(), BMM_TRUE_32); + if (s->Allocate(bi,map->Manager(), BMM_OPEN_R)==0) + { + if(s) + { + delete s; + s = NULL; + } + return NULL; + } + + uint y; + BMM_Color_64 *line = new BMM_Color_64[bitmap.getWidth()]; + for (y=0; yPutPixels(0, y, bitmap.getWidth(), line); + } + delete line; + + s->bi.CopyImageInfo(bi); + + return s; + } + else + { + *status = BMMRES_INVALIDFORMAT; + } + } + catch (Exception &) + { + *status = BMMRES_CORRUPTFILE; + } + } + else + { + *status = BMMRES_FILENOTFOUND; + } + return NULL; + } + + //Constructor/Destructor + _tex_gen_3dsmax5() + { + static bool initialized = false; + if (!initialized) + { + registerTypes(); + initialized = true; + } + }; + ~_tex_gen_3dsmax5() {}; +}; + + +class _tex_gen_3dsmax5ClassDesc:public ClassDesc2 { + public: + int IsPublic() {return 1;} + void * Create(BOOL loading = FALSE) {return new _tex_gen_3dsmax5();} + const TCHAR * ClassName() {return GetString(IDS_CLASS_NAME);} + SClass_ID SuperClassID() {return BMM_IO_CLASS_ID;} + Class_ID ClassID() {return _tex_gen_3dsmax5_CLASS_ID;} + const TCHAR* Category() {return GetString(IDS_CATEGORY);} + const TCHAR* InternalName() { return _T("_tex_gen_3dsmax5"); } // returns fixed parsable name (scripter-visible name) + HINSTANCE HInstance() { return hInstance; } // returns owning module handle +}; + +static _tex_gen_3dsmax5ClassDesc _tex_gen_3dsmax5Desc; +ClassDesc2* Gettex_gen_3dsmax5Desc() {return &_tex_gen_3dsmax5Desc;} + +enum { _tex_gen_3dsmax5_params }; + +//TODO: Add enums for various parameters +enum { + pb_spin, +}; + +static ParamBlockDesc2 _tex_gen_3dsmax5_param_blk ( _tex_gen_3dsmax5_params, _T("params"), 0, &_tex_gen_3dsmax5Desc, + P_AUTO_CONSTRUCT + P_AUTO_UI, PBLOCK_REF, + //rollout + IDD_PANEL, IDS_PARAMS, 0, 0, NULL, + // params + pb_spin, _T("spin"), TYPE_FLOAT, P_ANIMATABLE, IDS_SPIN, + p_default, 0.1f, + p_range, 0.0f,1000.0f, + p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_EDIT, IDC_SPIN, 0.01f, + end, + end + ); + + diff --git a/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.def b/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.def new file mode 100644 index 0000000..ff07fc2 --- /dev/null +++ b/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.def @@ -0,0 +1,8 @@ +LIBRARY tex_gen_3dsmax5 +EXPORTS + LibDescription @1 + LibNumberClasses @2 + LibClassDesc @3 + LibVersion @4 +SECTIONS + .data READ WRITE diff --git a/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.dsp b/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.dsp new file mode 100644 index 0000000..2384043 --- /dev/null +++ b/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.dsp @@ -0,0 +1,155 @@ +# Microsoft Developer Studio Project File - Name="tex_gen_3dsmax5" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=tex_gen_3dsmax5 - Win32 Hybrid +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "tex_gen_3dsmax5.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "tex_gen_3dsmax5.mak" CFG="tex_gen_3dsmax5 - Win32 Hybrid" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "tex_gen_3dsmax5 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "tex_gen_3dsmax5 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "tex_gen_3dsmax5 - Win32 Hybrid" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "tex_gen_3dsmax5 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /G6 /MD /W3 /GR /GX /O2 /I "C:\3dsmax3_1\Maxsdk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "NDEBUG" +# ADD RSC /l 0x40c /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib bmm.lib core.lib maxutil.lib maxscrpt.lib paramblk2.lib freetype214MT.lib /nologo /base:"0x105b0000" /subsystem:windows /dll /machine:I386 /out:"C:\program files\3dsmax5\Plugins\tex_gen_3dsmax5.bmi" /libpath:"C:\3dsmax3_1\Maxsdk\lib" /release + +!ELSEIF "$(CFG)" == "tex_gen_3dsmax5 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MDd /W3 /Gm /GR /GX /ZI /Od /I "C:\3dsmax3_1\Maxsdk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__STL_DEBUG" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "_DEBUG" +# ADD RSC /l 0x40c /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib bmm.lib core.lib maxutil.lib maxscrpt.lib paramblk2.lib freetype214MT.lib /nologo /base:"0x105b0000" /subsystem:windows /dll /debug /machine:I386 /out:"C:\3dsmax5 debug\exe\Plugins\tex_gen_3dsmax5.bmi" /pdbtype:sept /libpath:"C:\3dsmax3_1\Maxsdk\lib" + +!ELSEIF "$(CFG)" == "tex_gen_3dsmax5 - Win32 Hybrid" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "tex_gen_3dsmax5___Win32_Hybrid" +# PROP BASE Intermediate_Dir "tex_gen_3dsmax5___Win32_Hybrid" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "tex_gen_3dsmax5___Win32_Hybrid" +# PROP Intermediate_Dir "tex_gen_3dsmax5___Win32_Hybrid" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MD /W3 /Gm /GR /GX /ZI /Od /I "C:\3dsmax3_1\Maxsdk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "_DEBUG" +# ADD RSC /l 0x40c /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib bmm.lib core.lib maxutil.lib maxscrpt.lib paramblk2.lib freetype214MT.lib /nologo /base:"0x105b0000" /subsystem:windows /dll /debug /machine:I386 /out:"C:\program files\3dsmax5\Plugins\tex_gen_3dsmax5.bmi" /pdbtype:sept /libpath:"C:\3dsmax3_1\Maxsdk\lib" + +!ENDIF + +# Begin Target + +# Name "tex_gen_3dsmax5 - Win32 Release" +# Name "tex_gen_3dsmax5 - Win32 Debug" +# Name "tex_gen_3dsmax5 - Win32 Hybrid" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\DllEntry.cpp +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_3dsmax5.cpp +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_3dsmax5.def +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_3dsmax5.rc +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_3dsmax5.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.h b/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.h new file mode 100644 index 0000000..90db687 --- /dev/null +++ b/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.h @@ -0,0 +1,28 @@ +/********************************************************************** + *< + FILE: tex_gen_3dsmax5.h + + DESCRIPTION: Template Utility + + CREATED BY: + + HISTORY: + + *> Copyright (c) 1997, All Rights Reserved. + **********************************************************************/ + +#ifndef __tex_gen_3dsmax5__H +#define __tex_gen_3dsmax5__H + +#include "Max.h" +#include "resource.h" +#include "istdplug.h" +#include "iparamb2.h" +#include "iparamm2.h" + + +extern TCHAR *GetString(int id); + +extern HINSTANCE hInstance; + +#endif // __tex_gen_3dsmax5__H diff --git a/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.rc b/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.rc new file mode 100644 index 0000000..5ecf28e --- /dev/null +++ b/tools/tex_gen_3dsmax5/tex_gen_3dsmax5.rc @@ -0,0 +1,158 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// +IDD_PANEL DIALOG DISCARDABLE 0, 0, 108, 156 +STYLE WS_CHILD | WS_VISIBLE +FONT 8, "MS Sans Serif" +BEGIN + CTEXT "Generated by Plugin AppWizard\nCode && design by\nRavi Karra - Kinetix", + IDC_STATIC,7,7,94,36 + CONTROL "",IDC_EDIT,"CustEdit",WS_TABSTOP,29,114,35,10 + CONTROL "",IDC_SPIN,"SpinnerControl",0x0,65,114,7,10 + LTEXT "Spinner Cust Control:",IDC_STATIC,20,102,67,8 + CTEXT "TODO: Place panel controls here.",IDC_STATIC,15,63,78, + 19 +END + + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_PANEL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 101 + TOPMARGIN, 7 + BOTTOMMARGIN, 149 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 3,0,0,0 + PRODUCTVERSION 3,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileVersion", "3.0.0.0\0" + VALUE "InternalName", "3ds_test\0" + VALUE "LegalCopyright", "\0" + VALUE "OriginalFilename", "3ds_test.bmi\0" + VALUE "ProductName", "3D Studio MAX\0" + VALUE "ProductVersion", "3.0.0.0\0" + VALUE "FileDescription", "Read nel texgen textures\0" + VALUE "Comments", "TECH: \0" + VALUE "LegalTrademarks", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LIBDESCRIPTION "Read nel texgen textures" + IDS_CATEGORY "nel" + IDS_CLASS_NAME "3ds_test" + IDS_PARAMS "Parameters" + IDS_SPIN "Spin" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/tools/tex_gen_editor/Resource.h b/tools/tex_gen_editor/Resource.h new file mode 100644 index 0000000..29f655d --- /dev/null +++ b/tools/tex_gen_editor/Resource.h @@ -0,0 +1,55 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by nel_tex_gen.rc +// +#define IDD_ABOUTBOX 100 +#define IDR_MAINFRAME 128 +#define IDR_TEX_GETYPE 129 +#define IDR_DIALOG 129 +#define IDR_VIEW_MENU 130 +#define IDR_GRADIENT_CURSOR 131 +#define IDR_OPERATOR_MENU 132 +#define IDD_OP_PROPERTY 135 +#define IDB_ARROW_INPUT 136 +#define IDB_ARROW_OUTPUT 137 +#define IDB_BUTTON_MASK 143 +#define IDB_BUTTON_HOLE 144 +#define IDB_BUTTON_HOLE_MASK 145 +#define IDB_BUTTON 146 +#define IDD_COLOR_PICKER 148 +#define IDD_GRADIENT 149 +#define IDB_LINEAR 149 +#define IDB_QUADRATIC 150 +#define IDR_FULLSCREEN 151 +#define ID_VUE_TEXTURE 32772 +#define ID_VIEW_ZOOM_IN 32774 +#define ID_VIEW_ZOOM_OUT 32775 +#define ID_EDIT_ADD_OPERATOR 32776 +#define ID_EDIT_DELETE 32877 +#define ID_GRADIENT_CURSOR_DUPLICATE 32878 +#define ID_GRADIENT_CURSOR_DELETE 32879 +#define ID_FILE_EXPORT 32880 +#define ID_VIEW_AUTO_ARRANGE 32881 +#define ID_VIEW_TILE 32883 +#define ID_VIEW_ALPHA 32884 +#define ID_VIEW_RGB 32885 +#define ID_VIEW_OPERATOR 32886 +#define ID_VIEW_LAYER_RESULT 32887 +#define ID_HELP_HISTORY 32889 +#define ID_HELP_DIGITAL_MURDER_WEB 32890 +#define ID_HELP_EMAIL 32891 +#define ID_VIEW_MENUBAR 32892 +#define ID_VIEW_FULLSCREEN 32893 +#define ID_VIEW_FULL_SCREEN 32894 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_3D_CONTROLS 1 +#define _APS_NEXT_RESOURCE_VALUE 153 +#define _APS_NEXT_COMMAND_VALUE 32895 +#define _APS_NEXT_CONTROL_VALUE 1007 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/tools/tex_gen_editor/StdAfx.cpp b/tools/tex_gen_editor/StdAfx.cpp new file mode 100644 index 0000000..3ce6b5f --- /dev/null +++ b/tools/tex_gen_editor/StdAfx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// nel_tex_gen.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + + diff --git a/tools/tex_gen_editor/StdAfx.h b/tools/tex_gen_editor/StdAfx.h new file mode 100644 index 0000000..485671d --- /dev/null +++ b/tools/tex_gen_editor/StdAfx.h @@ -0,0 +1,66 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__2C2EAC09_CFE7_464F_9DD2_8BA8BA172A0C__INCLUDED_) +#define AFX_STDAFX_H__2C2EAC09_CFE7_464F_9DD2_8BA8BA172A0C__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include // MFC core and standard components +#include // MFC extensions +#include // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +// Pro UI +#include "prof-uis.h" + +#undef min +#undef max + +#include "nel/misc/types_nl.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nel/misc/common.h" +#include "nel/misc/debug.h" + +#include "nel/misc/stream.h" +#include "nel/misc/time_nl.h" +#include "nel/misc/vector.h" +#include "nel/misc/matrix.h" +#include "nel/misc/bitmap.h" +#include "nel/misc/rgba.h" +#include "nel/misc/file.h" +#include "nel/misc/bitmap.h" +#include "nel/misc/path.h" + +#include "3d/transform.h" +#include "3d/mot.h" +#include "3d/quad_grid.h" + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__2C2EAC09_CFE7_464F_9DD2_8BA8BA172A0C__INCLUDED_) diff --git a/tools/tex_gen_editor/action.cpp b/tools/tex_gen_editor/action.cpp new file mode 100644 index 0000000..b49abe7 --- /dev/null +++ b/tools/tex_gen_editor/action.cpp @@ -0,0 +1,203 @@ +/** \file action.cpp + * Action definition + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdafx.h" +#include "action.h" +#include "nel_tex_gen.h" +#include "nel_tex_gen_doc.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** + +IAction::~IAction() +{ +} + +// *************************************************************************** + +CActionEnable::CActionEnable (uint opId, bool enable) +{ + _Enable = enable; + _OperatorId = opId; +} + +// *************************************************************************** + +void CActionEnable::undo(CNelTexGenDoc *doc) +{ + redo(doc); +} + +// *************************************************************************** + +bool CActionEnable::redo(CNelTexGenDoc *doc) +{ + NLTEXGEN::ITexGenOperator *op = doc->getOperator(_OperatorId); + bool enable = op->isEnable(); + if (enable != _Enable) + { + std::swap (enable, _Enable); + op->setEnable(enable); + doc->modifyOperator(op, true); + return true; + } + return false; +} + +// *************************************************************************** + +CActionAddOperator::CActionAddOperator (const COperatorDesc *operatorDesc, sint x, sint y) +{ + _OperatorDesc = operatorDesc; + _OperatorId = (uint)-1; + _X = x; + _Y = y; +} + +// *************************************************************************** + +void CActionAddOperator::undo(CNelTexGenDoc *doc) +{ + _X = doc->getOperator(_OperatorId)->X; + _Y = doc->getOperator(_OperatorId)->Y; + doc->remove (doc->getOperator(_OperatorId)); +} + +// *************************************************************************** + +bool CActionAddOperator::redo(CNelTexGenDoc *doc) +{ + // Create a new class + ITexGenOperator* op = (ITexGenOperator*)CClassRegistry::create(_OperatorDesc->ClassName); + op->X = _X; + op->Y = _Y; + _OperatorId = doc->add (op, _OperatorId); + return true; +} + +// *************************************************************************** + +CActionDeleteOperator::CActionDeleteOperator (uint operatorId, CNelTexGenDoc *doc) +{ + // Get the operator + _OperatorId = operatorId; + ITexGenOperator *op = doc->getOperator(_OperatorId); + _ClassName = op->getClassName().c_str(); + _X = op->X; + _Y = op->Y; + _Clone = op->copy(); +} + +// *************************************************************************** + +void CActionDeleteOperator::undo(CNelTexGenDoc *doc) +{ + // Create a new class + ITexGenOperator* op = (ITexGenOperator*)CClassRegistry::create(_ClassName); + op->X = _X; + op->Y = _Y; + _OperatorId = doc->add (op, _OperatorId); + *(doc->getOperator(_OperatorId)) = *_Clone; +} + +// *************************************************************************** + +bool CActionDeleteOperator::redo(CNelTexGenDoc *doc) +{ + doc->remove (doc->getOperator(_OperatorId)); + return true; +} + +// *************************************************************************** + +CActionLink::CActionLink (uint inputId, uint input, uint outputId) +{ + _InputId = inputId; + _OutputId = outputId; + _Input = input; +} + +// *************************************************************************** + +void CActionLink::undo(CNelTexGenDoc *doc) +{ + doc->getOperator(_InputId)->removeOp(_Input); + doc->modifyGraph (); + doc->modifyOperator(doc->getOperator(_InputId), true); + doc->modifyOperator(doc->getOperator(_OutputId), true); +} + +// *************************************************************************** + +bool CActionLink::redo(CNelTexGenDoc *doc) +{ + if (doc->getOperator(_InputId)->canBindOp(doc->getOperator(_OutputId))) + { + doc->getOperator(_InputId)->bindOp(_Input, doc->getOperator(_OutputId)); + doc->modifyGraph (); + doc->modifyOperator(doc->getOperator(_InputId), true); + doc->modifyOperator(doc->getOperator(_OutputId), true); + return true; + } + return false; +} + +// *************************************************************************** + +CActionUnlink::CActionUnlink (uint inputId, uint input, uint outputId) +{ + _InputId = inputId; + _OutputId = outputId; + _Input = input; +} + +// *************************************************************************** + +void CActionUnlink::undo(CNelTexGenDoc *doc) +{ + nlassert(doc->getOperator(_InputId)->canBindOp(doc->getOperator(_OutputId))); + doc->getOperator(_InputId)->bindOp(_Input, doc->getOperator(_OutputId)); + doc->modifyGraph (); + doc->modifyOperator(doc->getOperator(_InputId), true); + doc->modifyOperator(doc->getOperator(_OutputId), true); +} + +// *************************************************************************** + +bool CActionUnlink::redo(CNelTexGenDoc *doc) +{ + doc->getOperator(_InputId)->removeOp(_Input); + doc->modifyGraph (); + doc->modifyOperator(doc->getOperator(_InputId), true); + doc->modifyOperator(doc->getOperator(_OutputId), true); + return true; +} + +// *************************************************************************** + +/* End of action.cpp */ diff --git a/tools/tex_gen_editor/action.h b/tools/tex_gen_editor/action.h new file mode 100644 index 0000000..49a87ab --- /dev/null +++ b/tools/tex_gen_editor/action.h @@ -0,0 +1,208 @@ +/** \file action.h + * Action definition + * + * $Id: $ + */ + +/* Copyright, 2003 DIGITAL MURDER. + * + * This file is part of DIGITAL MURDER NEL. + * DIGITAL MURDER NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * DIGITAL MURDER NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with DIGITAL MURDER NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_ACTION +#define NL_ACTION + +// *************************************************************************** + +#include "tex_gen/basics.h" + +namespace NLTEXGEN +{ + class ITexGenOperator; +}; + +/** + * Action interface + * + * \author Cyril 'Hulud' Corvazier + * \author DIGITAL MURDER + * \date 2003 + */ +class IAction +{ +public: + + virtual ~IAction(); + + // Return true if something has been modified + virtual void undo(class CNelTexGenDoc *doc) = 0; + virtual bool redo(CNelTexGenDoc *doc) = 0; + + // Return true if the modification are accumulative (move), false if they are absolute (set a value) + virtual bool accum(const IAction &action) { return false; } +}; + +// Action to change the enable flag of an operator +class CActionEnable : public IAction +{ +public: + CActionEnable (uint opId, bool enable); + +protected: + + uint _OperatorId; + bool _Enable; + + virtual void undo(CNelTexGenDoc *doc); + virtual bool redo(CNelTexGenDoc *doc); +}; + +// Action to add an operator +class CActionAddOperator : public IAction +{ +public: + CActionAddOperator (const class COperatorDesc *operatorDesc, sint x, sint y); + +protected: + + const COperatorDesc *_OperatorDesc; + uint _OperatorId; + sint _X; + sint _Y; + + virtual void undo(CNelTexGenDoc *doc); + virtual bool redo(CNelTexGenDoc *doc); +}; + +// Action to delete an operator +class CActionDeleteOperator : public IAction +{ +public: + CActionDeleteOperator (uint operatorId, CNelTexGenDoc *doc); + +protected: + + std::string _ClassName; + uint _OperatorId; + sint _X; + sint _Y; + NLTEXGEN::ITexGenOperator *_Clone; + + virtual void undo(CNelTexGenDoc *doc); + virtual bool redo(CNelTexGenDoc *doc); +}; + +// Action to link two operator +class CActionLink : public IAction +{ +public: + CActionLink (uint inputId, uint input, uint outputId); + +protected: + + uint _InputId; + uint _Input; + uint _OutputId; + + virtual void undo(CNelTexGenDoc *doc); + virtual bool redo(CNelTexGenDoc *doc); +}; + +// Action to unlink two operators +class CActionUnlink : public IAction +{ +public: + CActionUnlink (uint inputId, uint input, uint outputId); + +protected: + + uint _InputId; + uint _Input; + uint _OutputId; + + virtual void undo(CNelTexGenDoc *doc); + virtual bool redo(CNelTexGenDoc *doc); +}; + +// Action to set an operators parameter +template +class CActionSetParameter : public IAction +{ +public: + CActionSetParameter (uint opId, uint paramId, const _A &oldValue, const _A &newValue) + { + _OperatorId = opId; + _ParamId = paramId; + _OldValue = oldValue; + _NewValue = newValue; + } + +protected: + + uint _OperatorId; + uint _ParamId; + _A _OldValue; + _A _NewValue; + + virtual void undo(CNelTexGenDoc *doc) + { + NLTEXGEN::ITexGenOperator *op = doc->getOperator(_OperatorId); + op->setParameter(_ParamId, _OldValue); + doc->modifyBitmap (); + doc->modifyOperator(doc->getOperator(_OperatorId), true); + } + virtual bool redo(CNelTexGenDoc *doc) + { + if (_OldValue != _NewValue) + { + NLTEXGEN::ITexGenOperator *op = doc->getOperator(_OperatorId); + op->setParameter(_ParamId, _NewValue); + doc->modifyBitmap (); + doc->modifyOperator(doc->getOperator(_OperatorId), true); + return true; + } + else + return false; + } + + virtual bool accum(const IAction &action) + { + const CActionSetParameter *other = dynamic_cast(&action); + if (other) + { + if ((_OperatorId == other->_OperatorId) && + (_ParamId == other->_ParamId)) + { + _OldValue = other->_OldValue; + return true; + } + } + return false; + } +}; + +typedef CActionSetParameter CActionSetParameterInt; +typedef CActionSetParameter CActionSetParameterString; +typedef CActionSetParameter CActionSetParameterFloat; +typedef CActionSetParameter CActionSetParameterCRGBAF; +typedef CActionSetParameter > CActionSetParameterGradient; + +// *************************************************************************** + +#endif // NL_ACTION + +/* End of action.h */ diff --git a/tools/tex_gen_editor/bitmap_wnd.cpp b/tools/tex_gen_editor/bitmap_wnd.cpp new file mode 100644 index 0000000..2f96a5a --- /dev/null +++ b/tools/tex_gen_editor/bitmap_wnd.cpp @@ -0,0 +1,287 @@ +// bitmap_wnd.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "nel_tex_gen_view.h" +#include "nel_tex_gen_doc.h" +#include "bitmap_wnd.h" +#include "tex_gen/tex_gen_op.h" +#include "tex_gen/bitmap_float.h" +#include "tex_gen/op_layer.h" + +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** +// CBitmapWnd +// *************************************************************************** + +CBitmapWnd::CBitmapWnd() +{ + _Dib = NULL; + _Ddb = NULL; + _ZoomFactor = 1; + _Op = NULL; + _Validated = false; +} + +// *************************************************************************** + +CBitmapWnd::~CBitmapWnd() +{ +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CBitmapWnd, CWnd) + //{{AFX_MSG_MAP(CBitmapWnd) + ON_WM_PAINT() + ON_WM_MOVE() + ON_WM_FONTCHANGE() + ON_WM_ERASEBKGND() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CBitmapWnd message handlers + +void CBitmapWnd::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + // Invalidated ? + updateBitmap(); + + // Dib here ? + if (_Ddb) + { + ::CBitmap *temp = ::CBitmap::FromHandle(_Ddb); + CDC dc2; + dc2.CreateCompatibleDC(&dc); + dc2.SelectObject (temp); + nlverify (dc.BitBlt(0, 0, _DibWidth, _DibHeight, &dc2, 0, 0, SRCCOPY)); + } +} + +// *************************************************************************** + +BOOL CBitmapWnd::Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, + NLTEXGEN::ITexGenOperator *op, bool fixedSize, CCreateContext *pContext) +{ + _Op = op; + _FixedSize = fixedSize; + if (_FixedSize) + { + _DibWidth = rect.right - rect.left; + _DibHeight = rect.bottom - rect.top; + } + LPCTSTR className = AfxRegisterWndClass (0, 0, (HBRUSH)COLOR_WINDOW, 0); + return CWnd::Create(className, "", dwStyle, rect, pParentWnd, nID, pContext); +} + +// *************************************************************************** + +void CBitmapWnd::OnMove(int x, int y) +{ + CWnd::OnMove(x, y); +} + +// *************************************************************************** + +void CBitmapWnd::setZoomFactor (uint zoomFactor) +{ + _ZoomFactor = zoomFactor; + SetWindowPos(NULL, 0, 0, _DibWidth*_ZoomFactor, _DibHeight*_ZoomFactor, SWP_NOZORDER|SWP_NOMOVE); +} + +// *************************************************************************** + +BOOL CBitmapWnd::OnEraseBkgnd(CDC* pDC) +{ + return FALSE; // CWnd::OnEraseBkgnd(pDC); +} + +// *************************************************************************** + +void CBitmapWnd::updateBitmap() +{ + if (!_Validated) + { + CDC *dc = GetDesktopWindow()->GetDC(); + + // Eval the bitmap with cache + CRenderParameter renderParameters (true, Draft, false); + _Op->eval (_Bitmap, renderParameters); + CNelTexGenDoc* pDoc = ((CNelTexGenView*)GetParent ()->GetParent ())->GetDocument (); + IOpLayer *layer = dynamic_cast(_Op); + bool showAlphaLayer = false; + if (!pDoc->getLayerResult() && layer) + { + _Bitmap.ghostCopy (&(layer->getCachedLayer())); + showAlphaLayer = layer->outputMask (); + } + + // Dib section exist ? + if (_Dib) + { + // Not the good size ? + if (!_FixedSize && ((_DibWidth != _Bitmap.getWidth()) || (_DibHeight != _Bitmap.getHeight()))) + { + // Erase the dib + nlverify(DeleteObject(_Dib)); + + // todo bitmap cache nlverify(DeleteObject(Bitmap)); + _Dib = NULL; + + // Resize the window + SetWindowPos(NULL, 0, 0, _Bitmap.getWidth()*_ZoomFactor, _Bitmap.getHeight()*_ZoomFactor, SWP_NOZORDER|SWP_NOMOVE); + } + } + + if (!_FixedSize) + { + // Get the bitmap size + _DibWidth = _Bitmap.getWidth(); + _DibHeight = _Bitmap.getHeight(); + } + + // Bitmap NULL + if ((_DibWidth==0) || (_DibHeight==0)) + { + if (_Dib) + { + nlverify(DeleteObject(_Dib)); + _Dib = NULL; + } + } + else + { + // _Dib section doesn't exist ? + if (!_Dib) + { + _DibBitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFO); + _DibBitmapInfo.bmiHeader.biWidth = _DibWidth; + _DibBitmapInfo.bmiHeader.biHeight = _DibHeight; + _DibBitmapInfo.bmiHeader.biPlanes = 1; + _DibBitmapInfo.bmiHeader.biBitCount = 32; + _DibBitmapInfo.bmiHeader.biCompression = BI_RGB; + _DibBitmapInfo.bmiHeader.biSizeImage = 0; + _DibBitmapInfo.bmiHeader.biXPelsPerMeter = 0; + _DibBitmapInfo.bmiHeader.biYPelsPerMeter = 0; + _DibBitmapInfo.bmiHeader.biClrUsed = 0; + _DibBitmapInfo.bmiHeader.biClrImportant = 0; + nlverify(_Dib = CreateDIBSection(*dc, &_DibBitmapInfo, DIB_RGB_COLORS, (void**)&_DibBits, NULL, 0)); + } + } + + // Fill the dib + if (!_FixedSize) + { + nlassert ((_Bitmap.getWidth() == _DibWidth) && (_Bitmap.getHeight() == _DibHeight)); + const float *pixels = _Bitmap.getPixels(); + if (pixels) + { + const uint height = _DibHeight; + uint y; + for (y=0; y>2)^y)&8)!=0)?alpha_minus*0.75f:alpha_minus*0.25f; + r = (int)((pixels[i+0]*alpha + background)*255.f); + g = (int)((pixels[i+1]*alpha + background)*255.f); + b = (int)((pixels[i+2]*alpha + background)*255.f); + } + else + { + r = (int)(pixels[i+0] * 255.f); + g = (int)(pixels[i+1] * 255.f); + b = (int)(pixels[i+2] * 255.f); + } + clamp (r, 0, 255); + clamp (g, 0, 255); + clamp (b, 0, 255); + _DibBits[j+0] = b; + _DibBits[j+1] = g; + _DibBits[j+2] = r; + } + } + } + } + else + { + const float *pixels = _Bitmap.getPixels(); + if (pixels) + { + const bitmapWidth = _Bitmap.getWidth(); + const bitmapHeight = _Bitmap.getHeight(); + const uint heightDest = _DibHeight; + const uint deltaYSrc = (bitmapHeight<<8)/_DibHeight; + uint yDest; + uint ySrc = deltaYSrc>>1; + for (yDest=0; yDest>8; + const uint widthDest = _DibWidth*4 + (heightDest-yDest-1)*_DibWidth*4; + const uint deltaXSrc = (bitmapWidth<<8)/_DibWidth; + uint xSrc = ((yFinal*bitmapWidth)<<8) + (deltaXSrc>>1); + uint xDest = (heightDest-yDest-1)*_DibWidth*4; + for (;xDest>8)*4; + int r; + int g; + int b; + if (showAlphaLayer) + { + const float alpha = pixels[xFinal+3]; + const float alpha_minus = 1.f - alpha; + const float background = (((yDest^(xDest>>2))&8)!=0)?alpha_minus*0.75f:alpha_minus*0.25f; + r = (int)((pixels[xFinal+0]*alpha + background)*255.f); + g = (int)((pixels[xFinal+1]*alpha + background)*255.f); + b = (int)((pixels[xFinal+2]*alpha + background)*255.f); + } + else + { + r = (int)(pixels[xFinal+0] * 255.f); + g = (int)(pixels[xFinal+1] * 255.f); + b = (int)(pixels[xFinal+2] * 255.f); + } + clamp (r, 0, 255); + clamp (g, 0, 255); + clamp (b, 0, 255); + _DibBits[xDest+0] = b; + _DibBits[xDest+1] = g; + _DibBits[xDest+2] = r; + } + } + } + } + + // Convert in DDB + if (_Ddb) + { + nlverify(DeleteObject (_Ddb)); + _Ddb = NULL; + } + nlverify (_Ddb = CreateDIBitmap(*dc, &(_DibBitmapInfo.bmiHeader), CBM_INIT, + _DibBits, &_DibBitmapInfo, DIB_RGB_COLORS)); + + GetDesktopWindow()->ReleaseDC(dc); + _Validated = true; + } +} + +// *************************************************************************** + diff --git a/tools/tex_gen_editor/bitmap_wnd.h b/tools/tex_gen_editor/bitmap_wnd.h new file mode 100644 index 0000000..cd938ae --- /dev/null +++ b/tools/tex_gen_editor/bitmap_wnd.h @@ -0,0 +1,111 @@ +#if !defined(AFX_BITMAP_WND_H__8A358DA0_EAE4_44A7_8B32_6FE4824D4297__INCLUDED_) +#define AFX_BITMAP_WND_H__8A358DA0_EAE4_44A7_8B32_6FE4824D4297__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// bitmap_wnd.h : header file +// + +#include "tex_gen/bitmap_float.h" + +namespace NLTEXGEN +{ + class CFloatBitmap; + class ITexGenOperator; +} + +// *************************************************************************** +// CBitmapWnd window +// *************************************************************************** + +class CBitmapWnd : public CWnd +{ +// Construction +public: + CBitmapWnd(); + +// Attributes +public: + +private: + + NLTEXGEN::CFloatBitmap _Bitmap; + HBITMAP _Dib; + HBITMAP _Ddb; + // todo bitmap cache CBitmap Bitmap; + uint _DibWidth; + uint _DibHeight; + BITMAPINFO _DibBitmapInfo; + uint8 *_DibBits; + + // Zoom factor + sint _ZoomFactor; + + // The operator + NLTEXGEN::ITexGenOperator *_Op; + + // Fixed size + bool _FixedSize; + + // Bitmap valid + bool _Validated; + +// Operations +public: + + // Create + BOOL Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, NLTEXGEN::ITexGenOperator *op, bool fixedSize, CCreateContext *pContext = NULL); + + // Invalidate bitmap + void invalidate() + { + _Validated = false; + Invalidate(); + } + + // Update the bitmap part now + void updateBitmap(); + + // Set the operator + void setOperator (NLTEXGEN::ITexGenOperator *op) + { + _Op = op; + } + + // Get the size + uint getWidth() const { return _Dib?_DibWidth*_ZoomFactor:0; } + uint getHeight() const { return _Dib?_DibHeight*_ZoomFactor:0; } + + // Zoom factor + void setZoomFactor (uint zoomFactor); + uint getZoomFactor () const + { + return _ZoomFactor; + } + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CBitmapWnd) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CBitmapWnd(); + + // Generated message map functions +protected: + //{{AFX_MSG(CBitmapWnd) + afx_msg void OnPaint(); + afx_msg void OnMove(int x, int y); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_BITMAP_WND_H__8A358DA0_EAE4_44A7_8B32_6FE4824D4297__INCLUDED_) diff --git a/tools/tex_gen_editor/child_frm.cpp b/tools/tex_gen_editor/child_frm.cpp new file mode 100644 index 0000000..20fe5b9 --- /dev/null +++ b/tools/tex_gen_editor/child_frm.cpp @@ -0,0 +1,90 @@ +// child_frm.cpp : implementation of the CChildFrame class +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "nel_tex_gen_view.h" + +#include "child_frm.h" + +///////////////////////////////////////////////////////////////////////////// +// CChildFrame + +IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) + +BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) + //{{AFX_MSG_MAP(CChildFrame) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CChildFrame construction/destruction + +CChildFrame::CChildFrame() +{ + // TODO: add member initialization code here + +} + +CChildFrame::~CChildFrame() +{ +} + +BOOL CChildFrame::OnCreateClient( LPCREATESTRUCT lpcs, + CCreateContext* pContext) +{ + if (m_wndSplitter.CreateStatic(this, 1, 2)) + { + CMyCreateContext myContext; + myContext.m_pCurrentDoc = pContext->m_pCurrentDoc; + myContext.m_pCurrentFrame = pContext->m_pCurrentFrame; + myContext.m_pLastView = pContext->m_pLastView; + myContext.m_pNewDocTemplate = pContext->m_pNewDocTemplate; + myContext.m_pNewViewClass = pContext->m_pNewViewClass; + myContext.Vue = CNelTexGenView::VueTexture; + if (m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CNelTexGenView), CSize( 550, 550 ), &myContext)) + { + myContext.Vue = CNelTexGenView::VueGraph; + if (m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CNelTexGenView), CSize( 800, 550 ), &myContext)) + { + return TRUE; + } + } + } + return FALSE; +} + +BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + cs.cx = 900; + + if( !CMDIChildWnd::PreCreateWindow(cs) ) + return FALSE; + + return TRUE; +} + + + +///////////////////////////////////////////////////////////////////////////// +// CChildFrame diagnostics + +#ifdef _DEBUG +void CChildFrame::AssertValid() const +{ + CMDIChildWnd::AssertValid(); +} + +void CChildFrame::Dump(CDumpContext& dc) const +{ + CMDIChildWnd::Dump(dc); +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CChildFrame message handlers diff --git a/tools/tex_gen_editor/child_frm.h b/tools/tex_gen_editor/child_frm.h new file mode 100644 index 0000000..c0d9e76 --- /dev/null +++ b/tools/tex_gen_editor/child_frm.h @@ -0,0 +1,57 @@ +// child_frm.h : interface of the CChildFrame class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CHILD_FRM_H__F5422192_FC29_4BB8_BD0E_8395090E3AB8__INCLUDED_) +#define AFX_CHILD_FRM_H__F5422192_FC29_4BB8_BD0E_8395090E3AB8__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +class CChildFrame : public CMDIChildWnd +{ + DECLARE_DYNCREATE(CChildFrame) +public: + CChildFrame(); + +// Attributes +protected: + CSplitterWnd m_wndSplitter; +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CChildFrame) + public: + virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext); + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CChildFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +// Generated message map functions +protected: + //{{AFX_MSG(CChildFrame) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_CHILD_FRM_H__F5422192_FC29_4BB8_BD0E_8395090E3AB8__INCLUDED_) diff --git a/tools/tex_gen_editor/color_box.cpp b/tools/tex_gen_editor/color_box.cpp new file mode 100644 index 0000000..4a0e636 --- /dev/null +++ b/tools/tex_gen_editor/color_box.cpp @@ -0,0 +1,167 @@ +// color_box.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "color_box.h" + +// *************************************************************************** +// CColorBox +// *************************************************************************** + +CColorBox::CColorBox() +{ + _Color = RGB(0,0,0); +} + +// *************************************************************************** + +CColorBox::~CColorBox() +{ +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CColorBox, CWnd) + //{{AFX_MSG_MAP(CColorBox) + ON_WM_PAINT() + ON_WM_LBUTTONDBLCLK() + ON_WM_LBUTTONDOWN() + ON_WM_KILLFOCUS() + ON_WM_SETFOCUS() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CColorBox message handlers +// *************************************************************************** + +void CColorBox::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + // Create a brush + CBrush brush(_Color); + + // Get the client rect + RECT rect; + GetClientRect(&rect); + + // Draw with a fill color + dc.FillRect( &rect, &brush); + + // If selected, draw a selection square + if (GetFocus() == this) + dc.DrawFocusRect(&rect); +} + +// *************************************************************************** + +void CColorBox::OnLButtonDblClk(UINT nFlags, CPoint point) +{ + selectColor(); + + CWnd::OnLButtonDblClk(nFlags, point); +} + +// *************************************************************************** + +void CColorBox::selectColor() +{ + float color[4]; + ::setColor(color, _Color); + theApp.ColorPicker.setInitialColor (color); + theApp.ColorPicker.ShowWindow (SW_SHOW); + theApp.ColorPicker.WndToInform = this->m_hWnd; +} + +// *************************************************************************** + +BOOL CColorBox::Create (DWORD dwStyle, RECT &rect, CWnd *parent, UINT nID) +{ + LPCTSTR className = AfxRegisterWndClass (CS_DBLCLKS, 0, 0, 0); + return CWnd::Create (className, "", dwStyle, rect, parent, nID); +} + +// *************************************************************************** + +void CColorBox::setColor(COLORREF color) +{ + _Color = color; + Invalidate(); +} + +// *************************************************************************** + +void CColorBox::OnLButtonDown(UINT nFlags, CPoint point) +{ + // Get focus + SetFocus(); + selectColor(); + + CWnd::OnLButtonDown(nFlags, point); +} + +// *************************************************************************** + +void CColorBox::OnKillFocus(CWnd* pNewWnd) +{ + CWnd::OnKillFocus(pNewWnd); + Invalidate(); +} + +// *************************************************************************** + +void CColorBox::OnSetFocus(CWnd* pOldWnd) +{ + CWnd::OnSetFocus(pOldWnd); + Invalidate(); +} + +// *************************************************************************** + +BOOL CColorBox::PreTranslateMessage(MSG* pMsg) +{ + if ((pMsg->message == WM_KEYDOWN) && (int) pMsg->wParam == VK_RETURN) + { + selectColor(); + return TRUE; + } + + return CWnd::PreTranslateMessage(pMsg); +} + +// *************************************************************************** + +BOOL CColorBox::OnCommand(WPARAM wParam, LPARAM lParam) +{ + // Get parameters + uint idWidget = (int) LOWORD(wParam); // identifier of combo box + HWND hwndWidget = (HWND) lParam; // handle to combo box + WORD command = HIWORD(wParam); + + if (command == CP_COLOR_CHANGE) + { + float color[4]; + theApp.ColorPicker.getColor (color); + setColor (::getColorRef(color)); + + Invalidate(); + + // Notify parent + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (COB_COLOR_CHANGED<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + } + else if (command == CP_COLOR_END) + { + // Notify parent + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (COB_COLOR_END<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + } + + return CWnd::OnCommand(wParam, lParam); +} + +// *************************************************************************** diff --git a/tools/tex_gen_editor/color_box.h b/tools/tex_gen_editor/color_box.h new file mode 100644 index 0000000..4b6911a --- /dev/null +++ b/tools/tex_gen_editor/color_box.h @@ -0,0 +1,70 @@ +#if !defined(AFX_COLOR_BOX_H__F0E9B8EB_4371_46C8_8140_32436256E3C8__INCLUDED_) +#define AFX_COLOR_BOX_H__F0E9B8EB_4371_46C8_8140_32436256E3C8__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// color_box.h : header file +// + +#define COB_COLOR_CHANGED 0x1112 +#define COB_COLOR_END 0x1122 + +// *************************************************************************** +// CColorBox window +// *************************************************************************** + +class CColorBox : public CWnd +{ +// Construction +public: + CColorBox(); + +// Attributes +public: + +// Operations +public: + + BOOL Create (DWORD dwStyle, RECT &rect, CWnd *parent, UINT nID); + void selectColor(); + COLORREF getColor() const + { + return _Color; + } + void setColor(COLORREF color); + +protected: + COLORREF _Color; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CColorBox) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CColorBox(); + + // Generated message map functions +protected: + //{{AFX_MSG(CColorBox) + afx_msg void OnPaint(); + afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnKillFocus(CWnd* pNewWnd); + afx_msg void OnSetFocus(CWnd* pOldWnd); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +// *************************************************************************** + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_COLOR_BOX_H__F0E9B8EB_4371_46C8_8140_32436256E3C8__INCLUDED_) diff --git a/tools/tex_gen_editor/color_picker.cpp b/tools/tex_gen_editor/color_picker.cpp new file mode 100644 index 0000000..21cf77d --- /dev/null +++ b/tools/tex_gen_editor/color_picker.cpp @@ -0,0 +1,360 @@ +// color_picker.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "color_picker.h" +#include "tex_gen/transform_float.h" + +using namespace NLTEXGEN; + +#define RGB_PANEL_ID 0 +#define HUE_PANEL_ID 1 +#define R_ID 2 +#define G_ID 3 +#define B_ID 4 +#define H_ID 5 +#define V_ID 6 +#define S_ID 7 +#define MEMORY_ID 8 + +// *************************************************************************** +// CColorPicker dialog +// *************************************************************************** + +CColorPicker::CColorPicker(CWnd* pParent /*=NULL*/) + : CDialog(CColorPicker::IDD, pParent) +{ + //{{AFX_DATA_INIT(CColorPicker) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + WndToInform = NULL; +} + +// *************************************************************************** + +void CColorPicker::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CColorPicker) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CColorPicker, CDialog) + //{{AFX_MSG_MAP(CColorPicker) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CColorPicker message handlers +// *************************************************************************** + +#define MARGE 5 +#define PANEL_X MARGE +#define PANEL_Y MARGE +#define HUE_PANEL_X (PANEL_X+MARGE+PANEL_WIDTH) +#define COLOR_PANEL_X (HUE_PANEL_X+MARGE+HUE_PANEL_WIDTH) +#define COLOR_WIDTH 40 +#define COLOR_HEIGHT 34 +#define MEMORY_W 16 +#define MEMORY_H 16 + +CFloatValueSetup CenteredMT256_256Setup (CFloatValueSetup::Linear, "", 0, 256, 0.001f, true, true, NULL, 0); + +void createButton (CRect &rect, CFloatValueSetup &setup, UINT id, const char *label, + CRotButton &rotButton, CExtEdit &edit, CStatic &labelStatic, CWnd *parent, float value) +{ + CRect rect2 = rect; + rect2.right = rect2.left + 32; + rotButton.Create (WS_CHILD|WS_TABSTOP|WS_VISIBLE, rect2, parent, id); + rotButton.init (setup); + + // Label + rect2.top --; + rect2.left = rect2.right + MARGE; + rect2.right = rect2.left + 2*COLOR_WIDTH - 1 - 32 - MARGE; + rect2.bottom = rect2.top + 16; + labelStatic.Create (label, WS_CHILD|SS_LEFT|SS_CENTERIMAGE|WS_VISIBLE, rect2, parent); + labelStatic.SetFont (parent->GetFont()); + + // Edit + rect2.top = rect2.bottom; + rect2.bottom = rect2.top + 20; + edit.Create (WS_TABSTOP|ES_LEFT|WS_VISIBLE|WS_CHILD, rect2, parent, id); + edit.SetFont (parent->GetFont()); + rotButton.setEditBox (&edit); + rotButton.setValue (value); +} + +BOOL CColorPicker::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Create the panel + CRect rect (PANEL_X, PANEL_Y, PANEL_X+PANEL_WIDTH, PANEL_Y+PANEL_HEIGHT); + _PickerRGBPanel.Create (WS_CHILD|WS_VISIBLE, rect, this, RGB_PANEL_ID); + + CRect rect2 (HUE_PANEL_X, PANEL_Y, HUE_PANEL_X+HUE_PANEL_WIDTH, PANEL_Y+PANEL_HEIGHT); + _PickerHuePanel.Create (WS_CHILD|WS_VISIBLE, rect2, this, HUE_PANEL_ID); + + CRect rect3 (COLOR_PANEL_X, PANEL_Y, COLOR_PANEL_X+COLOR_WIDTH, PANEL_Y+COLOR_HEIGHT); + _NewColor.Create (WS_CHILD|WS_VISIBLE, rect3, this, HUE_PANEL_ID); + rect3.left += COLOR_WIDTH-1; + rect3.right += COLOR_WIDTH-1; + _OldColor.Create (WS_CHILD|WS_VISIBLE, rect3, this, HUE_PANEL_ID); + + hvsChanged (); + + rect3.left = COLOR_PANEL_X; + rect3.top = rect3.bottom + MARGE; + rect3.bottom = rect3.top + 32; + createButton (rect3, CenteredMT256_256Setup, R_ID, "Red", _R, _REdit, _RLabel, this, 0); + + rect3.top += MARGE + 32; + rect3.bottom += MARGE + 32; + createButton (rect3, CenteredMT256_256Setup, G_ID, "Green", _G, _GEdit, _GLabel, this, 0); + + rect3.top += MARGE + 32; + rect3.bottom += MARGE + 32; + createButton (rect3, CenteredMT256_256Setup, B_ID, "Blue", _B, _BEdit, _BLabel, this, 0); + + rect3.top += MARGE + 32; + rect3.bottom += MARGE + 32; + createButton (rect3, AngleSetup, H_ID, "Hue", _H, _HEdit, _HLabel, this, 0); + + rect3.top += MARGE + 32; + rect3.bottom += MARGE + 32; + createButton (rect3, CenteredMT1_1Setup, S_ID, "Sat", _S, _SEdit, _SLabel, this, 0); + + rect3.top += MARGE + 32; + rect3.bottom += MARGE + 32; + createButton (rect3, CenteredMT1_1Setup, V_ID, "Value", _V, _VEdit, _VLabel, this, 0); + + int left = rect3.right + MARGE; + + uint x, y; + for (y=0; y>2); + _Memory[i].setColor (RGB(value, value, value)); + } + for (; i<128; i++) + { + _Memory[i].setColor (RGB(255, 255, 255)); + } + + + RECT window; + GetWindowRect (&window); + RECT client; + GetClientRect (&client); + + int width = MARGE + 256 + MARGE + HUE_PANEL_WIDTH + MARGE + COLOR_WIDTH * 2 + MARGE + MEMORY_W*MEMORY_COUNT_W + MARGE; + int height = MARGE + 256 + MARGE; + SetWindowPos (NULL, 0, 0, window.right - window.left - client.right + client.left + width, + window.bottom - window.top - client.bottom + client.top + height, SWP_NOMOVE|SWP_NOZORDER); + + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +// *************************************************************************** + +BOOL CColorPicker::OnCommand(WPARAM wParam, LPARAM lParam) +{ + // Get parameters + uint idWidget = (int) LOWORD(wParam); // identifier of combo box + HWND hwndWidget = (HWND) lParam; // handle to combo box + + if ((HIWORD(wParam) == EN_RETURN) || (HIWORD(wParam) == EN_KILLFOCUS)) + { + // Get current colors + char number[100]; + ::GetWindowText (hwndWidget, number, 100); + + float newValue = (float)atof(number); + switch (idWidget) + { + case R_ID: + _R.setValue (newValue); + rgbChanged (); + break; + case G_ID: + _G.setValue (newValue); + rgbChanged (); + break; + case B_ID: + _B.setValue (newValue); + rgbChanged (); + break; + case H_ID: + _H.setValue (newValue); + hvsChanged (); + break; + case V_ID: + _V.setValue (newValue); + hvsChanged (); + break; + case S_ID: + _S.setValue (newValue); + hvsChanged (); + break; + } + } + else if ((HIWORD(wParam) == CW_LBUTTON) && (idWidget >= MEMORY_ID) && (idWidget < MEMORY_ID+128)) + { + COLORREF ref = _Memory[idWidget-MEMORY_ID].getColor (); + _R.setValue (GetRValue(ref)); + _G.setValue (GetGValue(ref)); + _B.setValue (GetBValue(ref)); + rgbChanged (); + } + else if ((HIWORD(wParam) == CW_RBUTTON) && (idWidget >= MEMORY_ID) && (idWidget < MEMORY_ID+128)) + { + _Memory[idWidget-MEMORY_ID].setColor (RGB((int)_R.getValue(), (int)_G.getValue(), (int)_B.getValue())); + } + switch (idWidget) + { + case HUE_PANEL_ID: + _H.setValue (_PickerHuePanel.getHue()); + hvsChanged (); + break; + case RGB_PANEL_ID: + _S.setValue (_PickerRGBPanel.getSat()); + _V.setValue (_PickerRGBPanel.getValue()); + hvsChanged (); + break; + case H_ID: + case S_ID: + case V_ID: + if (HIWORD(wParam) == ROB_VALUE_CHANGED) + hvsChanged (); + break; + case R_ID: + case G_ID: + case B_ID: + if (HIWORD(wParam) == ROB_VALUE_CHANGED) + rgbChanged (); + break; + } + + return CDialog::OnCommand(wParam, lParam); +} + +// *************************************************************************** + +void CColorPicker::hvsChanged () +{ + _PickerRGBPanel.setHue (_H.getValue()); + _PickerRGBPanel.setSat (_S.getValue()); + _PickerRGBPanel.setValue (_V.getValue()); + CDC *dc = _PickerRGBPanel.GetDC(); + _PickerRGBPanel.SendMessage (WM_PAINT, (WPARAM)(HDC)*dc, 0); + _PickerRGBPanel.ReleaseDC (dc); + _PickerHuePanel.setHue (_H.getValue()); + dc = _PickerHuePanel.GetDC(); + _PickerHuePanel.SendMessage (WM_PAINT, (WPARAM)(HDC)*dc, 0); + _PickerHuePanel.ReleaseDC (dc); + float rgb[3]; + HVS2RGB (_H.getValue()*6.f/360.f, _V.getValue(), _S.getValue(), rgb); + _NewColor.setColor (getColorRef(rgb)); + dc = _NewColor.GetDC(); + _NewColor.SendMessage (WM_PAINT, (WPARAM)(HDC)*dc, 0); + _NewColor.ReleaseDC (dc); + if (IsWindow (_R)) + { + _R.setValue (rgb[0]*255.f); + _G.setValue (rgb[1]*255.f); + _B.setValue (rgb[2]*255.f); + } + + // Notify WndToInform + if (WndToInform) + ::PostMessage(WndToInform, WM_COMMAND, (CP_COLOR_CHANGE<<16)|GetDlgCtrlID(), (LONG)m_hWnd); +} + +// *************************************************************************** + +void CColorPicker::rgbChanged () +{ + float rgb[3] = {_R.getValue()/255.f, _G.getValue()/255.f, _B.getValue()/255.f}; + float h, v, s; + RGB2HVS (rgb, h, v, s); + h *= 360.f / 6.f; + if (IsWindow (_H)) + { + _H.setValue (h); + _V.setValue (v); + _S.setValue (s); + } + _PickerRGBPanel.setHue (h); + _PickerRGBPanel.setSat (s); + _PickerRGBPanel.setValue (v); + _PickerHuePanel.setHue (h); + _NewColor.setColor (getColorRef(rgb)); + + // Notify WndToInform + if (WndToInform) + ::PostMessage(WndToInform, WM_COMMAND, (CP_COLOR_CHANGE<<16)|GetDlgCtrlID(), (LONG)m_hWnd); +} + +// *************************************************************************** + +LRESULT CColorPicker::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) +{ + if ((message == WM_ACTIVATE) && (LOWORD(wParam) == WA_INACTIVE)) + { + ShowWindow (SW_HIDE); + + // Notify WndToInform + if (WndToInform) + ::PostMessage(WndToInform, WM_COMMAND, (CP_COLOR_END<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + + WndToInform = NULL; + } + + return CDialog::WindowProc(message, wParam, lParam); +} + +// *************************************************************************** + +void CColorPicker::setInitialColor (float *color) +{ + _R.setValue (color[0] * 255.f); + _G.setValue (color[1] * 255.f); + _B.setValue (color[2] * 255.f); + rgbChanged (); + _OldColor.setColor (getColorRef(color)); +} + +// *************************************************************************** + +void CColorPicker::getColor (float *color) const +{ + color[0] = _R.getValue() / 255.f; + color[1] = _G.getValue() / 255.f; + color[2] = _B.getValue() / 255.f; +} + +// *************************************************************************** diff --git a/tools/tex_gen_editor/color_picker.h b/tools/tex_gen_editor/color_picker.h new file mode 100644 index 0000000..84eb53e --- /dev/null +++ b/tools/tex_gen_editor/color_picker.h @@ -0,0 +1,80 @@ +#if !defined(AFX_COLOR_PICKER_H__043936BD_51C7_4117_8850_63D9523EC0AF__INCLUDED_) +#define AFX_COLOR_PICKER_H__043936BD_51C7_4117_8850_63D9523EC0AF__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// color_picker.h : header file +// + +#include "color_picker_rgb_panel.h" +#include "color_picker_hue_panel.h" +#include "color_picker_color_wnd.h" +#include "rot_button.h" +#include "my_edit.h" + +#define MEMORY_COUNT_W 8 +#define MEMORY_COUNT_H 16 + +#define CP_COLOR_CHANGE 0x1121 +#define CP_COLOR_END 0x1125 + +///////////////////////////////////////////////////////////////////////////// +// CColorPicker dialog + +class CColorPicker : public CDialog +{ +// Construction +public: + CColorPicker(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CColorPicker) + enum { IDD = IDD_COLOR_PICKER }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + void setInitialColor (float *color); + void getColor (float *color) const; + + // Window to inform + HWND WndToInform; + +private: + + CColorPickerRGBPanel _PickerRGBPanel; + CColorPickerHUEPanel _PickerHuePanel; + CColorPickerColorWnd _OldColor; + CColorPickerColorWnd _NewColor; + CColorPickerColorWnd _Memory[MEMORY_COUNT_W*MEMORY_COUNT_H]; + + CRotButton _R, _G, _B, _H, _V, _S; + CMyEdit _REdit, _GEdit, _BEdit, _HEdit, _VEdit, _SEdit; + CStatic _RLabel, _GLabel, _BLabel, _HLabel, _VLabel, _SLabel; + + void hvsChanged (); + void rgbChanged (); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CColorPicker) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); + virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CColorPicker) + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_COLOR_PICKER_H__043936BD_51C7_4117_8850_63D9523EC0AF__INCLUDED_) diff --git a/tools/tex_gen_editor/color_picker_color_wnd.cpp b/tools/tex_gen_editor/color_picker_color_wnd.cpp new file mode 100644 index 0000000..e685c47 --- /dev/null +++ b/tools/tex_gen_editor/color_picker_color_wnd.cpp @@ -0,0 +1,102 @@ +// color_picker_color_wnd.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "color_picker_color_wnd.h" + +// *************************************************************************** +// CColorPickerColorWnd +// *************************************************************************** + +CColorPickerColorWnd::CColorPickerColorWnd() +{ +} + +// *************************************************************************** + +CColorPickerColorWnd::~CColorPickerColorWnd() +{ +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CColorPickerColorWnd, CWnd) + //{{AFX_MSG_MAP(CColorPickerColorWnd) + ON_WM_PAINT() + ON_WM_LBUTTONDOWN() + ON_WM_RBUTTONDOWN() + ON_WM_KILLFOCUS() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CColorPickerColorWnd message handlers +// *************************************************************************** + +// *************************************************************************** + +BOOL CColorPickerColorWnd::Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID) +{ + LPCTSTR className = AfxRegisterWndClass (0, 0, 0, 0); + return CWnd::Create(className, "", dwStyle, rect, pParentWnd, nID); +} + +// *************************************************************************** + +void CColorPickerColorWnd::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + RECT rect; + GetClientRect (&rect); + + CBrush brush; + brush.CreateSolidBrush (RGB(0,0,0)); + dc.FrameRect (&rect, &brush); + rect.left++; + rect.right--; + rect.top++; + rect.bottom--; + dc.FillSolidRect(&rect, _Color); +} + +// *************************************************************************** + +void CColorPickerColorWnd::setColor (COLORREF color) +{ + _Color = color; + Invalidate(); +} + +// *************************************************************************** + +void CColorPickerColorWnd::OnLButtonDown(UINT nFlags, CPoint point) +{ + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (CW_LBUTTON<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + + CWnd::OnLButtonDown(nFlags, point); +} + +// *************************************************************************** + +void CColorPickerColorWnd::OnRButtonDown(UINT nFlags, CPoint point) +{ + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (CW_RBUTTON<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + + CWnd::OnRButtonDown(nFlags, point); +} + +// *************************************************************************** + +void CColorPickerColorWnd::OnKillFocus(CWnd* pNewWnd) +{ + CWnd::OnKillFocus(pNewWnd); + + // TODO: Add your message handler code here + +} diff --git a/tools/tex_gen_editor/color_picker_color_wnd.h b/tools/tex_gen_editor/color_picker_color_wnd.h new file mode 100644 index 0000000..5a4d015 --- /dev/null +++ b/tools/tex_gen_editor/color_picker_color_wnd.h @@ -0,0 +1,62 @@ +#if !defined(AFX_COLOR_PICKER_COLOR_WND_H__92ED06F3_C70E_4D78_9AC5_1E25B4ECF3E9__INCLUDED_) +#define AFX_COLOR_PICKER_COLOR_WND_H__92ED06F3_C70E_4D78_9AC5_1E25B4ECF3E9__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// color_picker_color_wnd.h : header file +// + +#define CW_LBUTTON 0x1119 +#define CW_RBUTTON 0x1120 + +///////////////////////////////////////////////////////////////////////////// +// CColorPickerColorWnd window + +class CColorPickerColorWnd : public CWnd +{ +// Construction +public: + CColorPickerColorWnd(); + +// Attributes +public: + + BOOL Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID); + void setColor (COLORREF color); + COLORREF getColor () const + { + return _Color; + } + +// Operations +public: + + COLORREF _Color; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CColorPickerColorWnd) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CColorPickerColorWnd(); + + // Generated message map functions +protected: + //{{AFX_MSG(CColorPickerColorWnd) + afx_msg void OnPaint(); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnRButtonDown(UINT nFlags, CPoint point); + afx_msg void OnKillFocus(CWnd* pNewWnd); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_COLOR_PICKER_COLOR_WND_H__92ED06F3_C70E_4D78_9AC5_1E25B4ECF3E9__INCLUDED_) diff --git a/tools/tex_gen_editor/color_picker_hue_panel.cpp b/tools/tex_gen_editor/color_picker_hue_panel.cpp new file mode 100644 index 0000000..ff07d2a --- /dev/null +++ b/tools/tex_gen_editor/color_picker_hue_panel.cpp @@ -0,0 +1,153 @@ +// color_picker_rgb_panel.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "color_picker_hue_panel.h" +#include "tex_gen/transform_float.h" + +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** +// CColorPickerHUEPanel +// *************************************************************************** + +CColorPickerHUEPanel::CColorPickerHUEPanel() +{ +} + +// *************************************************************************** + +CColorPickerHUEPanel::~CColorPickerHUEPanel() +{ +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CColorPickerHUEPanel, CWnd) + //{{AFX_MSG_MAP(CColorPickerHUEPanel) + ON_WM_PAINT() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CColorPickerHUEPanel message handlers +// *************************************************************************** + +#define HUE_WIDTH 25 +#define HUE_X ((HUE_PANEL_WIDTH - HUE_WIDTH)/2) + +BOOL CColorPickerHUEPanel::Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID) +{ + LPCTSTR className = AfxRegisterWndClass (0, 0, 0, 0); + if (CWnd::Create(className, "", dwStyle, rect, pParentWnd, nID)) + { + // Create the panel + _Panel.setSize (HUE_WIDTH-2, HUE_PANEL_HEIGHT-2); + + uint8 *pixels = _Panel.getPixels (); + + uint y; + for (y=0; y<256; y++) + { + float hue = (float)y * 6.f / 256.f; + float color[3]; + HVS2RGB (hue, 1, 1, color); + + sint r = (sint)(color[0]*255); + sint g = (sint)(color[1]*255); + sint b = (sint)(color[2]*255); + uint x; + for (x=0; xmessage == WM_MOUSEMOVE) || (pMsg->message == WM_LBUTTONDOWN)) + { + if (pMsg->wParam & MK_LBUTTON) + { + _Hue = 360.f * (256 - (sint16)HIWORD(pMsg->lParam)) / 256.f; + clamp (_Hue, 0.f, 359.f); + CRect rect2 (0, 0, HUE_X, HUE_PANEL_HEIGHT); + InvalidateRect (&rect2); + + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (HUE_CHANGED<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + + if (pMsg->message == WM_LBUTTONDOWN) + { + SetCapture (); + } + } + return TRUE; + } + if (pMsg->message == WM_LBUTTONUP) + { + ReleaseCapture (); + return TRUE; + } + + return CWnd::PreTranslateMessage(pMsg); +} + +// *************************************************************************** + +void CColorPickerHUEPanel::setHue (float hue) +{ + _Hue = hue; + CRect rect2 (0, 0, HUE_X, HUE_PANEL_HEIGHT); + InvalidateRect (&rect2); +} + +// *************************************************************************** diff --git a/tools/tex_gen_editor/color_picker_hue_panel.h b/tools/tex_gen_editor/color_picker_hue_panel.h new file mode 100644 index 0000000..4d1dc03 --- /dev/null +++ b/tools/tex_gen_editor/color_picker_hue_panel.h @@ -0,0 +1,74 @@ +#if !defined(AFX_COLOR_PICKER_HUE_PANEL_H__0BCF92D0_B0C1_4E87_B2A4_39EB81851E27__INCLUDED_) +#define AFX_COLOR_PICKER_HUE_PANEL_H__0BCF92D0_B0C1_4E87_B2A4_39EB81851E27__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// color_picker_rgb_panel.h : header file +// + +#include "dib_wnd.h" + +#define HUE_PANEL_WIDTH 40 +#define HUE_PANEL_HEIGHT 258 + +#define HUE_CHANGED 0x1117 + +// *************************************************************************** +// CColorPickerHUEPanel window +// *************************************************************************** + +class CColorPickerHUEPanel : public CWnd +{ +// Construction +public: + CColorPickerHUEPanel(); + +// Attributes +public: + + // Create + BOOL Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID); + + void setHue (float hue); + float getHue () const + { + return _Hue; + } + +private: + + // The hue value + float _Hue; + + // Color panel + CDibWnd _Panel; + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CColorPickerHUEPanel) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CColorPickerHUEPanel(); + + // Generated message map functions +protected: + //{{AFX_MSG(CColorPickerHUEPanel) + afx_msg void OnPaint(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +// *************************************************************************** + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_COLOR_PICKER_HUE_PANEL_H__0BCF92D0_B0C1_4E87_B2A4_39EB81851E27__INCLUDED_) diff --git a/tools/tex_gen_editor/color_picker_rgb_panel.cpp b/tools/tex_gen_editor/color_picker_rgb_panel.cpp new file mode 100644 index 0000000..b10c401 --- /dev/null +++ b/tools/tex_gen_editor/color_picker_rgb_panel.cpp @@ -0,0 +1,187 @@ +// color_picker_rgb_panel.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "color_picker_rgb_panel.h" +#include "tex_gen/transform_float.h" + +using namespace NLTEXGEN; + +// *************************************************************************** +// CColorPickerRGBPanel +// *************************************************************************** + +CColorPickerRGBPanel::CColorPickerRGBPanel() +{ +} + +// *************************************************************************** + +CColorPickerRGBPanel::~CColorPickerRGBPanel() +{ +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CColorPickerRGBPanel, CWnd) + //{{AFX_MSG_MAP(CColorPickerRGBPanel) + ON_WM_PAINT() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CColorPickerRGBPanel message handlers +// *************************************************************************** + +BOOL CColorPickerRGBPanel::Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID) +{ + LPCTSTR className = AfxRegisterWndClass (0, 0, 0, 0); + if (CWnd::Create(className, "", dwStyle, rect, pParentWnd, nID)) + { + // Create the panel + _Panel.setSize (PANEL_WIDTH-2, PANEL_HEIGHT-2); + return TRUE; + } + return FALSE; +} + +// *************************************************************************** + +#define CROSS_CENTER 5 +#define CROSS_RECT_HEIGHT 1 +#define CROSS_RECT_WIDTH 10 + +void CColorPickerRGBPanel::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + _Panel.draw (&dc, 1, 1, 0); + + RECT rect; + GetClientRect (&rect); + CBrush brush; + brush.CreateSolidBrush (RGB(0,0,0)); + dc.FrameRect (&rect, &brush); + + sint x,y; + getCursorPos (x, y); + + dc.FillSolidRect (x-CROSS_CENTER-CROSS_RECT_WIDTH, y-CROSS_RECT_HEIGHT, CROSS_RECT_WIDTH, 3*CROSS_RECT_HEIGHT, RGB(255,255,255)); + dc.FillSolidRect (x+CROSS_CENTER+1, y-CROSS_RECT_HEIGHT, CROSS_RECT_WIDTH, 3*CROSS_RECT_HEIGHT, RGB(255,255,255)); + dc.FillSolidRect (x-CROSS_RECT_HEIGHT, y-CROSS_CENTER-CROSS_RECT_WIDTH, 3*CROSS_RECT_HEIGHT, CROSS_RECT_WIDTH, RGB(255,255,255)); + dc.FillSolidRect (x-CROSS_RECT_HEIGHT, y+CROSS_CENTER+1, 3*CROSS_RECT_HEIGHT, CROSS_RECT_WIDTH, RGB(255,255,255)); +} + +// *************************************************************************** + +void CColorPickerRGBPanel::setHue (float hue) +{ + uint8 *pixels = _Panel.getPixels (); + + hue *= 6.f/360.f; + float color[3]; + + HVS2RGB (hue, 1, 1, color); + + sint r0 = 255<<8; + sint g0 = 255<<8; + sint b0 = 255<<8; + sint r1 = (sint)(color[0]*255)<<8; + sint g1 = (sint)(color[1]*255)<<8; + sint b1 = (sint)(color[2]*255)<<8; + uint y; + for (y=0; y<256; y++) + { + sint r = (r0*y)>>8; + sint g = (g0*y)>>8; + sint b = (b0*y)>>8; + sint dr = (((r1*y)>>8) - r)>>8; + sint dg = (((g1*y)>>8) - g)>>8; + sint db = (((b1*y)>>8) - b)>>8; + uint x; + for (x=0; x<256; x++, pixels += 4) + { + pixels[0] = b>>8; + pixels[1] = g>>8; + pixels[2] = r>>8; + b += db; + g += dg; + r += dr; + } + } + + Invalidate(); +} + +// *************************************************************************** + +void CColorPickerRGBPanel::setSat (float sat) +{ + _Sat = sat; + invalidateCursor (); +} + +// *************************************************************************** + +void CColorPickerRGBPanel::setValue (float val) +{ + _Val = val; + invalidateCursor (); +} + +// *************************************************************************** + +BOOL CColorPickerRGBPanel::PreTranslateMessage(MSG* pMsg) +{ + if ((pMsg->message == WM_MOUSEMOVE) || (pMsg->message == WM_LBUTTONDOWN)) + { + if (pMsg->wParam & MK_LBUTTON) + { + invalidateCursor (); + _Sat = (float)((sint16)LOWORD(pMsg->lParam) - 1) / (float)(PANEL_WIDTH-2); + _Val = 1.f - (float)((sint16)HIWORD(pMsg->lParam) - 1) / (float)(PANEL_WIDTH-2); + NLMISC::clamp (_Sat, 0.f, 1.f); + NLMISC::clamp (_Val, 0.f, 1.f); + invalidateCursor (); + + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (RGB_CHANGED<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + + if (pMsg->message == WM_LBUTTONDOWN) + { + SetCapture (); + } + } + return TRUE; + } + if (pMsg->message == WM_LBUTTONUP) + { + ReleaseCapture (); + return TRUE; + } + return CWnd::PreTranslateMessage(pMsg); +} + +// *************************************************************************** + +void CColorPickerRGBPanel::invalidateCursor () +{ + sint x,y; + getCursorPos (x, y); + CRect rect (x-CROSS_CENTER-CROSS_RECT_WIDTH, y-CROSS_CENTER-CROSS_RECT_WIDTH, + x+CROSS_CENTER+CROSS_RECT_WIDTH, y+CROSS_CENTER+CROSS_RECT_WIDTH); + InvalidateRect (&rect); +} + +// *************************************************************************** + +void CColorPickerRGBPanel::getCursorPos (sint &x, sint &y) +{ + x = 1 + (sint)floor(0.5f+(_Sat * (float)(PANEL_WIDTH-2))); + y = 1 + (sint)floor(0.5f+((1.f-_Val) * (float)(PANEL_HEIGHT-2))); +} + +// *************************************************************************** + diff --git a/tools/tex_gen_editor/color_picker_rgb_panel.h b/tools/tex_gen_editor/color_picker_rgb_panel.h new file mode 100644 index 0000000..8476b4f --- /dev/null +++ b/tools/tex_gen_editor/color_picker_rgb_panel.h @@ -0,0 +1,87 @@ +#if !defined(AFX_COLOR_PICKER_RGB_PANEL_H__0BCF92D0_B0C1_4E87_B2A4_39EB81851E27__INCLUDED_) +#define AFX_COLOR_PICKER_RGB_PANEL_H__0BCF92D0_B0C1_4E87_B2A4_39EB81851E27__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// color_picker_rgb_panel.h : header file +// + +#include "dib_wnd.h" + +#define PANEL_WIDTH 258 +#define PANEL_HEIGHT 258 + +#define RGB_CHANGED 0x1118 + +// *************************************************************************** +// CColorPickerRGBPanel window +// *************************************************************************** + +class CColorPickerRGBPanel : public CWnd +{ +// Construction +public: + CColorPickerRGBPanel(); + +// Attributes +public: + + // Set the hue + void setHue (float hue); + void setSat (float sat); + void setValue (float val); + + // Get the Sat and Value + float getSat () const + { + return _Sat; + } + float getValue () const + { + return _Val; + } + + // Create + BOOL Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID); + +private: + + // Color panel + CDibWnd _Panel; + + // Sat and value + float _Sat; + float _Val; + + void invalidateCursor (); + void getCursorPos (sint &x, sint &y); + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CColorPickerRGBPanel) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CColorPickerRGBPanel(); + + // Generated message map functions +protected: + //{{AFX_MSG(CColorPickerRGBPanel) + afx_msg void OnPaint(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +// *************************************************************************** + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_COLOR_PICKER_RGB_PANEL_H__0BCF92D0_B0C1_4E87_B2A4_39EB81851E27__INCLUDED_) diff --git a/tools/tex_gen_editor/dib_wnd.cpp b/tools/tex_gen_editor/dib_wnd.cpp new file mode 100644 index 0000000..0016479 --- /dev/null +++ b/tools/tex_gen_editor/dib_wnd.cpp @@ -0,0 +1,189 @@ +// dib_wnd.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "dib_wnd.h" +#include "tex_gen/bitmap_float.h" + +using namespace NLMISC; + +// *************************************************************************** +// CDibWnd +// *************************************************************************** + +CDibWnd::CDibWnd() +{ + _Invalidated = true; + _Width = 256; + _Height = 256; + _DibBits = NULL; + _Dib = NULL; + _Ddb = NULL; + _DibBitmapInfo.bmiHeader.biWidth = 0; + _DibBitmapInfo.bmiHeader.biHeight = 0; +} + +// *************************************************************************** + +CDibWnd::~CDibWnd() +{ + if (_Dib) + nlverify(DeleteObject (_Dib)); + if (_Ddb) + nlverify(DeleteObject (_Ddb)); +} + +// *************************************************************************** +// CDibWnd message handlers +// *************************************************************************** + +void CDibWnd::updateDIB () +{ + // No dib or wrong size ? + if ((_DibBits == NULL) || ((uint)_DibBitmapInfo.bmiHeader.biWidth != _Width) || ((uint)_DibBitmapInfo.bmiHeader.biHeight != _Height)) + { + // Create the dib + _DibBitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFO); + _DibBitmapInfo.bmiHeader.biWidth = _Width; + _DibBitmapInfo.bmiHeader.biHeight = _Height; + _DibBitmapInfo.bmiHeader.biPlanes = 1; + _DibBitmapInfo.bmiHeader.biBitCount = 32; + _DibBitmapInfo.bmiHeader.biCompression = BI_RGB; + _DibBitmapInfo.bmiHeader.biSizeImage = 0; + _DibBitmapInfo.bmiHeader.biXPelsPerMeter = 0; + _DibBitmapInfo.bmiHeader.biYPelsPerMeter = 0; + _DibBitmapInfo.bmiHeader.biClrUsed = 0; + _DibBitmapInfo.bmiHeader.biClrImportant = 0; + HWND desktop = ::GetDesktopWindow(); + HDC dc = ::GetDC(desktop); + nlverify(_Dib = CreateDIBSection(dc, &_DibBitmapInfo, DIB_RGB_COLORS, (void**)&_DibBits, NULL, 0)); + ::ReleaseDC(desktop, dc); + _Invalidated = true; + } +} + +// *************************************************************************** + +uint8 *CDibWnd::getPixels() +{ + updateDIB (); + _Invalidated = true; + return _DibBits; +} + +// *************************************************************************** + +const uint8 *CDibWnd::getConstPixels() +{ + updateDIB (); + return _DibBits; +} + +// *************************************************************************** + +void CDibWnd::draw (CDC *pDC, sint x, sint y, sint zoomFactor) +{ + updateDIB (); + + // Build the bitmap ? + if (_Invalidated) + { + if (_Ddb) + { + nlverify(DeleteObject (_Ddb)); + _Ddb = NULL; + } + + nlverify (_Ddb = CreateDIBitmap(*pDC, &(_DibBitmapInfo.bmiHeader), CBM_INIT, + _DibBits, &_DibBitmapInfo, DIB_RGB_COLORS)); + _Invalidated = false; + } + + // Draw the bitmap + ::CBitmap *temp = ::CBitmap::FromHandle(_Ddb); + CDC dc2; + dc2.CreateCompatibleDC(pDC); + dc2.SelectObject (temp); + + if (zoomFactor == 0) + { + nlverify (pDC->BitBlt(x, y, _Width, _Height, &dc2, 0, 0, SRCCOPY)); + } + else + { + int bmWidth = (zoomFactor>0)?_Width<>-zoomFactor; + int bmHeight = (zoomFactor>0)?_Height<>-zoomFactor; + nlverify (pDC->StretchBlt(x, y, bmWidth, bmHeight, &dc2, 0, 0, _Width, _Height, SRCCOPY)); + } +} + +// *************************************************************************** + +void CDibWnd::setSize (uint width, uint height) +{ + _Width = width; + _Height = height; + _Invalidated = true; +} + +// *************************************************************************** + +void CDibWnd::setPixels (const NLTEXGEN::CFloatBitmap &bitmap, TDisplayMode mode) +{ + const float *pixels = bitmap.getPixels(); + if (pixels) + { + setSize (bitmap.getWidth(), bitmap.getHeight()); + uint8 *dst = getPixels(); + const uint height = _Height; + uint y; + for (y=0; y>2)^y)&8)!=0)?alpha_minus*0.75f:alpha_minus*0.25f; + r = (int)((pixels[i+0]*alpha + background)*255.f); + g = (int)((pixels[i+1]*alpha + background)*255.f); + b = (int)((pixels[i+2]*alpha + background)*255.f); + } + else + { + r = (int)(pixels[i+0] * 255.f); + g = (int)(pixels[i+1] * 255.f); + b = (int)(pixels[i+2] * 255.f); + } + clamp (r, 0, 255); + clamp (g, 0, 255); + clamp (b, 0, 255); + dst[j+0] = b; + dst[j+1] = g; + dst[j+2] = r; + } + } + } + _Invalidated = true; + } +} + +// *************************************************************************** diff --git a/tools/tex_gen_editor/dib_wnd.h b/tools/tex_gen_editor/dib_wnd.h new file mode 100644 index 0000000..564a126 --- /dev/null +++ b/tools/tex_gen_editor/dib_wnd.h @@ -0,0 +1,93 @@ +#if !defined(AFX_DIB_WND_H__06433841_EFC9_4B62_8827_3AD7F4398426__INCLUDED_) +#define AFX_DIB_WND_H__06433841_EFC9_4B62_8827_3AD7F4398426__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// dib_wnd.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CDibWnd window + +namespace NLTEXGEN +{ + class CFloatBitmap; +} + +class CDibWnd +{ +// Construction +public: + CDibWnd(); + + enum TDisplayMode + { + Normal, + Alpha, + AlphaPremultiplied, + }; + +// Attributes +public: + +// Operations +public: + + // Acces pixels + const uint8 *getConstPixels(); + uint8 *getPixels(); + void setPixels (const NLTEXGEN::CFloatBitmap &bitmap, TDisplayMode mode); + + // Set the size + void setSize (uint width, uint height); + + // Get bitmap + void draw (CDC *pDC, sint x, sint y, sint zoomFactor); + + // Get size + uint getWidth() const + { + return _Width; + } + uint getHeight() const + { + return _Height; + } + +private: + + // Bitmap invalidated + bool _Invalidated; + + // Size + uint _Width; + uint _Height; + + // DIB info + HBITMAP _Dib; + BITMAPINFO _DibBitmapInfo; + uint8 *_DibBits; + + // DDB info + HBITMAP _Ddb; + + // Internal methods + void updateDIB (); + +// Overrides + +// Implementation +public: + virtual ~CDibWnd(); + + // Generated message map functions +protected: +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_DIB_WND_H__06433841_EFC9_4B62_8827_3AD7F4398426__INCLUDED_) diff --git a/tools/tex_gen_editor/gradient_cursor_wnd.cpp b/tools/tex_gen_editor/gradient_cursor_wnd.cpp new file mode 100644 index 0000000..d6dc60b --- /dev/null +++ b/tools/tex_gen_editor/gradient_cursor_wnd.cpp @@ -0,0 +1,280 @@ +// gradient_cursor_wnd.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "gradient_cursor_wnd.h" +#include "gradient_wnd.h" +#include "tex_gen/transform_float.h" + +#define CURSOR_TANGENT_SIZE 18 + +// *************************************************************************** +// CGradientCursorWnd +// *************************************************************************** + +CGradientCursorWnd::CGradientCursorWnd() +{ + NotifyMove = false; +} + +// *************************************************************************** + +CGradientCursorWnd::~CGradientCursorWnd() +{ +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CGradientCursorWnd, CWnd) + //{{AFX_MSG_MAP(CGradientCursorWnd) + ON_WM_PAINT() + ON_WM_NCHITTEST() + ON_WM_MOVING() + ON_WM_MOVE() + ON_WM_NCLBUTTONDBLCLK() + ON_WM_NCLBUTTONDOWN() + ON_WM_NCMOUSEMOVE() + ON_WM_NCRBUTTONDOWN() + ON_COMMAND(ID_GRADIENT_CURSOR_DELETE, OnGradientCursorDelete) + ON_COMMAND(ID_GRADIENT_CURSOR_DUPLICATE, OnGradientCursorDuplicate) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CGradientCursorWnd message handlers +// *************************************************************************** + +void CGradientCursorWnd::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + RECT client; + GetClientRect (&client); + dc.DrawEdge( &client, EDGE_RAISED, BF_RECT); + client.left += 2; + client.right -= 2; + client.top += 2; + client.bottom -= 2; + + if (_IsColor) + { + CBrush color(getColorRef(_Color)); + dc.FillRect(&client, &color); + } + else + { + CBrush color; + color.CreateSysColorBrush (COLOR_3DFACE); + dc.FillRect(&client, &color); + CDC dc2; + dc2.CreateCompatibleDC(&dc); + dc2.SelectObject (_Quadratic?&Quadratic:&Linear); + dc.MaskBlt (client.left, client.top, client.right-client.left, client.bottom-client.top, &dc2, 0, 0, _Quadratic?Quadratic:Linear, 0, 0, MAKEROP4 (SRCAND, BLACKNESS)); + } +} + +// *************************************************************************** + +BOOL CGradientCursorWnd::Create (DWORD dwStyle, uint x, uint y, class CWnd *parent, UINT nID, const float *color) +{ + LPCTSTR className = AfxRegisterWndClass (CS_DBLCLKS, 0, 0, 0); + RECT rect; + rect.left = x; + rect.top = y; + rect.right = x + CURSOR_WIDTH; + rect.bottom = y + CURSOR_HEIGHT; + NLTEXGEN::copy (_Color, color); + _IsColor = true; + if (CWnd::CreateEx (0, className, "", dwStyle, rect, parent, nID)) + { + NotifyMove = true; + return TRUE; + } + return FALSE; +} + +// *************************************************************************** + +BOOL CGradientCursorWnd::Create (DWORD dwStyle, uint x, uint y, class CWnd *parent, UINT nID, bool quadratic) +{ + LPCTSTR className = AfxRegisterWndClass (CS_DBLCLKS, 0, 0, 0); + RECT rect; + rect.left = x; + rect.top = y; + rect.right = x + CURSOR_TANGENT_SIZE; + rect.bottom = y + CURSOR_TANGENT_SIZE; + _Quadratic = quadratic; + _IsColor = false; + if (CWnd::CreateEx (0, className, "", dwStyle, rect, parent, nID)) + { + NotifyMove = true; + return TRUE; + } + return FALSE; +} + +// *************************************************************************** + +void CGradientCursorWnd::setColor(const float *color) +{ + NLTEXGEN::copy (_Color, color); + Invalidate(); +} + +// *************************************************************************** + +void CGradientCursorWnd::setQuadratic(bool quadratic) +{ + _Quadratic = quadratic; + Invalidate(); +} + +// *************************************************************************** + +UINT CGradientCursorWnd::OnNcHitTest(CPoint point) +{ + CRect r; + GetClientRect(&r); + ClientToScreen(&r); + + if(r.PtInRect(point)) + return HTCAPTION ; + + return CWnd::OnNcHitTest(point); +} + +// *************************************************************************** + +void CGradientCursorWnd::OnMoving(UINT fwSide, LPRECT pRect) +{ + if (NotifyMove) + { + RECT minMax; + CGradientWnd *parent = (CGradientWnd*)GetParent(); + parent->getCursorMinMax(minMax); + RECT window; + GetWindowRect (&window); + parent->ScreenToClient(&window); + parent->ScreenToClient(pRect); + pRect->top = window.top; + pRect->bottom = window.bottom; + if (pRect->left < minMax.left) + { + pRect->right += minMax.left - pRect->left; + pRect->left = minMax.left; + } + if (pRect->left > minMax.right) + { + pRect->right -= pRect->left - minMax.right; + pRect->left = minMax.right; + } + parent->ClientToScreen(pRect); + } + CWnd::OnMoving(fwSide, pRect); +} + +// *************************************************************************** + +void CGradientCursorWnd::OnMove(int x, int y) +{ + CWnd::OnMove(x, y); + if (NotifyMove) + { + CGradientWnd *parent = (CGradientWnd*)GetParent(); + if (_IsColor) + parent->cursorChanged(); + else + parent->tangentChanged(); + } +} + +// *************************************************************************** + +void CGradientCursorWnd::OnNcLButtonDblClk(UINT nHitTest, CPoint point) +{ + if (_IsColor) + { + theApp.ColorPicker.setInitialColor (_Color); + theApp.ColorPicker.ShowWindow (SW_SHOW); + theApp.ColorPicker.WndToInform = this->m_hWnd; + } + else + { + _Quadratic ^= true; + CGradientWnd *parent = (CGradientWnd*)GetParent(); + parent->tangentChanged(); + } + + CWnd::OnNcLButtonDblClk(nHitTest, point); +} + +// *************************************************************************** + +void CGradientCursorWnd::OnNcLButtonDown(UINT nHitTest, CPoint point) +{ + CWnd::OnNcLButtonDown(nHitTest, point); +} + +// *************************************************************************** + +void CGradientCursorWnd::OnNcMouseMove(UINT nHitTest, CPoint point) +{ + CWnd::OnNcMouseMove(nHitTest, point); +} + +// *************************************************************************** + +void CGradientCursorWnd::OnNcRButtonDown(UINT nHitTest, CPoint point) +{ + if (_IsColor) + { + // Check the sub menu + CExtPopupMenuWnd * pPopupWnd = new CExtPopupMenuWnd; + VERIFY(pPopupWnd->LoadMenu(*this, IDR_GRADIENT_CURSOR)); + VERIFY(pPopupWnd->TrackPopupMenu(0, point.x, point.y)); + } + + CWnd::OnNcRButtonDown(nHitTest, point); +} + +// *************************************************************************** + +void CGradientCursorWnd::OnGradientCursorDelete() +{ + CGradientWnd *parent = (CGradientWnd*)GetParent(); + parent->cursorDeleted(GetDlgCtrlID()); +} + +// *************************************************************************** + +void CGradientCursorWnd::OnGradientCursorDuplicate() +{ + CGradientWnd *parent = (CGradientWnd*)GetParent(); + parent->cursorDuplicate(GetDlgCtrlID()); +} + +// *************************************************************************** + +BOOL CGradientCursorWnd::OnCommand(WPARAM wParam, LPARAM lParam) +{ + // Get parameters + uint idWidget = (int) LOWORD(wParam); // identifier of combo box + HWND hwndWidget = (HWND) lParam; // handle to combo box + WORD command = HIWORD(wParam); + + if (command == CP_COLOR_CHANGE) + { + float color[4]; + theApp.ColorPicker.getColor (color); + setColor (color); + + Invalidate(); + + // Notify parent + CGradientWnd *parent = (CGradientWnd*)GetParent(); + parent->cursorChanged(); + } + + return CWnd::OnCommand(wParam, lParam); +} diff --git a/tools/tex_gen_editor/gradient_cursor_wnd.h b/tools/tex_gen_editor/gradient_cursor_wnd.h new file mode 100644 index 0000000..81bad27 --- /dev/null +++ b/tools/tex_gen_editor/gradient_cursor_wnd.h @@ -0,0 +1,80 @@ +#if !defined(AFX_GRADIENT_CURSOR_WND_H__DC354872_BFAB_4ABF_A496_20FC2868986F__INCLUDED_) +#define AFX_GRADIENT_CURSOR_WND_H__DC354872_BFAB_4ABF_A496_20FC2868986F__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// gradient_cursor_wnd.h : header file +// + +// *************************************************************************** +// CGradientCursorWnd window +// *************************************************************************** + +class CGradientCursorWnd : public CWnd +{ +// Construction +public: + CGradientCursorWnd(); + +// Attributes +public: + + bool NotifyMove; + +private: + + float _Color[4]; + bool _Quadratic; + bool _IsColor; + +// Operations +public: + + BOOL Create (DWORD dwStyle, uint x, uint y, class CWnd *parent, UINT nID, const float *color); + BOOL Create (DWORD dwStyle, uint x, uint y, class CWnd *parent, UINT nID, bool quadratic); + void setColor(const float *); + const float *getColor() const + { + return _Color; + } + void setQuadratic(bool quadratic); + bool getQuadratic() const + { + return _Quadratic; + } + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CGradientCursorWnd) + protected: + virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CGradientCursorWnd(); + + // Generated message map functions +protected: + //{{AFX_MSG(CGradientCursorWnd) + afx_msg void OnPaint(); + afx_msg UINT OnNcHitTest(CPoint point); + afx_msg void OnMoving(UINT fwSide, LPRECT pRect); + afx_msg void OnMove(int x, int y); + afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point); + afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point); + afx_msg void OnNcMouseMove(UINT nHitTest, CPoint point); + afx_msg void OnNcRButtonDown(UINT nHitTest, CPoint point); + afx_msg void OnGradientCursorDelete(); + afx_msg void OnGradientCursorDuplicate(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GRADIENT_CURSOR_WND_H__DC354872_BFAB_4ABF_A496_20FC2868986F__INCLUDED_) diff --git a/tools/tex_gen_editor/gradient_dlg.cpp b/tools/tex_gen_editor/gradient_dlg.cpp new file mode 100644 index 0000000..e6e36e0 --- /dev/null +++ b/tools/tex_gen_editor/gradient_dlg.cpp @@ -0,0 +1,78 @@ +// gradient_dlg.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "gradient_dlg.h" + +// *************************************************************************** +// CGradientDlg dialog +// *************************************************************************** + +CGradientDlg::CGradientDlg(CWnd* pParent /*=NULL*/) + : CDialog(CGradientDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(CGradientDlg) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + _CanHide = true; +} + +// *************************************************************************** + +void CGradientDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CGradientDlg) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CGradientDlg, CDialog) + //{{AFX_MSG_MAP(CGradientDlg) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CGradientDlg message handlers +// *************************************************************************** + +BOOL CGradientDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + RECT rect; + GetClientRect (&rect); + + nlverify (Gradient.Create (WS_CHILD|WS_VISIBLE, rect, this, 0)); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +// *************************************************************************** + +BOOL CGradientDlg::OnCommand(WPARAM wParam, LPARAM lParam) +{ + // Get parameters + uint idWidget = (int) LOWORD(wParam); // identifier of combo box + HWND hwndWidget = (HWND) lParam; // handle to combo box + + if (HIWORD(wParam) == CGW_GRADIENT_CHANGED) + { + // Notify parent + if (WndToInform) + ::PostMessage(WndToInform, WM_COMMAND, (GDD_GRADIENT_CHANGED<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + } + + return CDialog::OnCommand(wParam, lParam); +} + +BOOL CGradientDlg::PreTranslateMessage(MSG* pMsg) +{ + theApp.m_pMainWnd->PreTranslateMessage(pMsg); + + return CDialog::PreTranslateMessage(pMsg); +} diff --git a/tools/tex_gen_editor/gradient_dlg.h b/tools/tex_gen_editor/gradient_dlg.h new file mode 100644 index 0000000..d8ada2e --- /dev/null +++ b/tools/tex_gen_editor/gradient_dlg.h @@ -0,0 +1,60 @@ +#if !defined(AFX_GRADIENT_DLG_H__C386D4C1_EC3B_4DCC_9127_E8D9B9D1857A__INCLUDED_) +#define AFX_GRADIENT_DLG_H__C386D4C1_EC3B_4DCC_9127_E8D9B9D1857A__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// gradient_dlg.h : header file +// + +#include "gradient_wnd.h" + +#define GDD_GRADIENT_CHANGED 0x1124 + +///////////////////////////////////////////////////////////////////////////// +// CGradientDlg dialog + +class CGradientDlg : public CDialog +{ +// Construction +public: + CGradientDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CGradientDlg) + enum { IDD = IDD_GRADIENT }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + CGradientWnd Gradient; + + // Window to inform + HWND WndToInform; + +private: + bool _CanHide; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CGradientDlg) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CGradientDlg) + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GRADIENT_DLG_H__C386D4C1_EC3B_4DCC_9127_E8D9B9D1857A__INCLUDED_) diff --git a/tools/tex_gen_editor/gradient_rect_wnd.cpp b/tools/tex_gen_editor/gradient_rect_wnd.cpp new file mode 100644 index 0000000..e3bcd9c --- /dev/null +++ b/tools/tex_gen_editor/gradient_rect_wnd.cpp @@ -0,0 +1,131 @@ +// gradient_rect_wnd.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "gradient_rect_wnd.h" +#include "gradient_dlg.h" +#include "tex_gen\transform_float.h" + +using namespace NLTEXGEN; + + +// *************************************************************************** +// CGradientRectWnd +// *************************************************************************** + +CGradientRectWnd::CGradientRectWnd(bool editable) +{ + _GradientDlg = NULL; + _Editable = editable; +} + +// *************************************************************************** + +CGradientRectWnd::~CGradientRectWnd() +{ + if (_GradientDlg) + delete _GradientDlg; +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CGradientRectWnd, CWnd) + //{{AFX_MSG_MAP(CGradientRectWnd) + ON_WM_PAINT() + ON_WM_LBUTTONDOWN() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CGradientRectWnd message handlers +// *************************************************************************** + +void CGradientRectWnd::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + // The client rect + RECT client; + GetClientRect (&client); + + // Draw the gradient + uint x; + const uint limitX = client.right; + const uint limitY = client.bottom; + const float delta = 1.f / (float)(limitX-1); + for (x=0; xCreate (IDD_GRADIENT, theApp.m_pMainWnd); + _GradientDlg->WndToInform = *this; + _GradientDlg->Gradient.setGradient (getGradient()); + } + _GradientDlg->ShowWindow (SW_SHOW); + } + + CWnd::OnLButtonDown(nFlags, point); +} + +// *************************************************************************** + +void CGradientRectWnd::setGradient (const std::vector &gradient) +{ + _Gradient = gradient; + Invalidate (); + if (_GradientDlg) + { + _GradientDlg->Gradient.setGradient (gradient); + } +} + +// *************************************************************************** + +BOOL CGradientRectWnd::OnCommand(WPARAM wParam, LPARAM lParam) +{ + // Get parameters + uint idWidget = (int) LOWORD(wParam); // identifier of combo box + HWND hwndWidget = (HWND) lParam; // handle to combo box + + if (HIWORD(wParam) == GDD_GRADIENT_CHANGED) + { + setGradient (_GradientDlg->Gradient.getGradient()); + + // Notify parent + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (GDR_GRADIENT_CHANGED<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + } + + return CWnd::OnCommand(wParam, lParam); +} diff --git a/tools/tex_gen_editor/gradient_rect_wnd.h b/tools/tex_gen_editor/gradient_rect_wnd.h new file mode 100644 index 0000000..4206eb7 --- /dev/null +++ b/tools/tex_gen_editor/gradient_rect_wnd.h @@ -0,0 +1,73 @@ +#if !defined(AFX_GRADIENT_RECT_WND_H__FE011E92_24E8_4CA8_997C_5663B2F9AB9B__INCLUDED_) +#define AFX_GRADIENT_RECT_WND_H__FE011E92_24E8_4CA8_997C_5663B2F9AB9B__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// gradient_rect_wnd.h : header file +// + +#define GDR_GRADIENT_CHANGED 0x1123 + +// *************************************************************************** +// CGradientRectWnd window +// *************************************************************************** + +class CGradientRectWnd : public CWnd +{ +// Construction +public: + CGradientRectWnd(bool editable); + +// Attributes +public: + + BOOL Create (DWORD dwStyle, RECT &rect, class CWnd *parent, UINT nID); + void setGradient (const std::vector &gradient); + const std::vector &getGradient () const + { + return _Gradient; + } + std::vector &getGradient () + { + Invalidate (); + return _Gradient; + } + + // The gradient dialog + class CGradientDlg *_GradientDlg; + +private: + + bool _Editable; + std::vector _Gradient; + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CGradientRectWnd) + protected: + virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CGradientRectWnd(); + + // Generated message map functions +protected: + //{{AFX_MSG(CGradientRectWnd) + afx_msg void OnPaint(); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GRADIENT_RECT_WND_H__FE011E92_24E8_4CA8_997C_5663B2F9AB9B__INCLUDED_) diff --git a/tools/tex_gen_editor/gradient_wnd.cpp b/tools/tex_gen_editor/gradient_wnd.cpp new file mode 100644 index 0000000..b3f4815 --- /dev/null +++ b/tools/tex_gen_editor/gradient_wnd.cpp @@ -0,0 +1,402 @@ +// gradient_wnd.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "gradient_wnd.h" +#include "gradient_cursor_wnd.h" +#include "tex_gen\transform_float.h" + +using namespace NLTEXGEN; + +// *************************************************************************** +// CGradientWnd +// *************************************************************************** + +CGradientWnd::CGradientWnd() : _GradientWnd (false) +{ +} + +// *************************************************************************** + +CGradientWnd::~CGradientWnd() +{ + uint i; + for (i=0; i<_CursorsWnd.size(); i++) + delete _CursorsWnd[i]; + for (i=0; i<_CursorsTangentWnd.size(); i++) + delete _CursorsTangentWnd[i]; +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CGradientWnd, CWnd) + //{{AFX_MSG_MAP(CGradientWnd) + ON_WM_PAINT() + ON_WM_KILLFOCUS() + ON_WM_SETFOCUS() + ON_WM_SIZE() + ON_WM_LBUTTONDOWN() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CGradientWnd message handlers +// *************************************************************************** + +#define BORDER_LEFT 5 +#define BORDER_RIGHT 6 +#define BORDER_TOP 2 +#define CURSOR_TOP 18 +#define CURSOR_TANG_TOP 18 +#define BORDER_BOTTOM (1+CURSOR_TOP+CURSOR_TANG_TOP) +#define CURSOR_MIN_LEFT 2 +#define CURSOR_MAX_RIGHT 10 + +void CGradientWnd::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + // The client rect + RECT client; + GetClientRect (&client); + + // Create a brush + CBrush brush(RGB(0,0,0)); + dc.SelectObject(&brush); + + // Draw the border + RECT border; + border.left = BORDER_LEFT; + border.right = client.right - client.left - BORDER_RIGHT; + border.top= BORDER_TOP; + border.bottom = client.bottom - client.top - BORDER_BOTTOM; + dc.FrameRect(&border, &brush); + + // If selected, draw a selection square + if (GetFocus() == this) + dc.DrawFocusRect(&client); +} + +// *************************************************************************** + +BOOL CGradientWnd::Create (DWORD dwStyle, RECT &rect, CWnd *parent, UINT nID) +{ + LPCTSTR className = AfxRegisterWndClass (CS_DBLCLKS, 0, (HBRUSH)COLOR_WINDOW, 0); + if (CWnd::Create (className, "", dwStyle|WS_CLIPCHILDREN, rect, parent, nID)) + { + RECT rect; + rect.top = 0; + rect.bottom = 100; + rect.left= 0; + rect.right= 100; + if (_GradientWnd.Create (WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rect, this, Gradient)) + { + resizeChildren(); + return TRUE; + } + } + return FALSE; +} + +// *************************************************************************** + +void CGradientWnd::setGradient(const std::vector &gradient) +{ + _GradientWnd.setGradient (gradient); + gradientChanged(false); + _GradientWnd.Invalidate(); +} + +// *************************************************************************** + +void CGradientWnd::gradientChanged(bool notifyParent) +{ + std::vector &gradient = _GradientWnd.getGradient(); + // Renormalize the grandient + std::sort (gradient.begin(), gradient.end()); + + // The client rect + RECT client; + GetClientRect (&client); + + // Create / delete children + uint i=0; + std::vector::const_iterator ite = gradient.begin(); + while (ite != gradient.end()) + { + // Create the window ? + if (i>=_CursorsWnd.size()) + { + _CursorsWnd.push_back (new CGradientCursorWnd); + _CursorsWnd.back()->Create (WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, getClientX(ite->Pos), client.bottom-CURSOR_TOP-CURSOR_TANG_TOP, this, FirstCursor+i, ite->Color); + } + else + { + // Set the position + _CursorsWnd[i]->NotifyMove = false; + _CursorsWnd[i]->SetWindowPos(NULL, getClientX(ite->Pos), client.bottom-CURSOR_TOP-CURSOR_TANG_TOP, 0, 0, SWP_NOSIZE|SWP_NOZORDER); + _CursorsWnd[i]->NotifyMove = true; + _CursorsWnd[i]->setColor (ite->Color); + } + + if ((ite+1) != gradient.end()) + { + // Create the window ? + if (i>=_CursorsTangentWnd.size()) + { + _CursorsTangentWnd.push_back (new CGradientCursorWnd); + float pos = ite->Pos * (1.f - ite->RightPos) + (ite+1)->Pos * ite->RightPos; + _CursorsTangentWnd.back()->Create (WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, getClientX(pos), client.bottom-CURSOR_TOP, this, FirstCursor+i, ite->RightQuadratic); + } + else + { + // Set the position + _CursorsTangentWnd[i]->NotifyMove = false; + float pos = ite->Pos * (1.f - ite->RightPos) + (ite+1)->Pos * ite->RightPos; + _CursorsTangentWnd[i]->SetWindowPos(NULL, getClientX(pos), client.bottom-CURSOR_TOP, 0, 0, SWP_NOSIZE|SWP_NOZORDER); + _CursorsTangentWnd[i]->NotifyMove = true; + _CursorsTangentWnd[i]->setQuadratic(ite->RightQuadratic); + } + } + + + i++; + ite++; + } + + // Erase others.. + uint finalSize = i; + for (;i<_CursorsWnd.size(); i++) + { + _CursorsWnd[i]->DestroyWindow(); + delete _CursorsWnd[i]; + } + _CursorsWnd.resize (finalSize); + + // Erase others.. + i--; + finalSize = i; + for (;i<_CursorsTangentWnd.size(); i++) + { + _CursorsTangentWnd[i]->DestroyWindow(); + delete _CursorsTangentWnd[i]; + } + _CursorsTangentWnd.resize (finalSize); + + if (notifyParent) + { + // Notify parent + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (CGW_GRADIENT_CHANGED<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + } +} + +// *************************************************************************** + +void CGradientWnd::OnKillFocus(CWnd* pNewWnd) +{ + CWnd::OnKillFocus(pNewWnd); + Invalidate(); +} + +// *************************************************************************** + +void CGradientWnd::OnSetFocus(CWnd* pOldWnd) +{ + CWnd::OnSetFocus(pOldWnd); + Invalidate(); +} + +// *************************************************************************** + +void CGradientWnd::OnSize(UINT nType, int cx, int cy) +{ + CWnd::OnSize(nType, cx, cy); + + resizeChildren(); +} + +// *************************************************************************** + +void CGradientWnd::resizeChildren() +{ + // The client rect + RECT client; + GetClientRect (&client); + + if (IsWindow(_GradientWnd)) + { + + _GradientWnd.SetWindowPos(&wndBottom, BORDER_LEFT+1, BORDER_TOP+1, + client.right - client.left - BORDER_RIGHT - 1 - BORDER_LEFT - 1, + client.bottom - client.top - BORDER_BOTTOM - 1 - BORDER_TOP - 1, SWP_SHOWWINDOW); + } +} + +// *************************************************************************** + +void CGradientWnd::getCursorMinMax(RECT &rect) const +{ + // The client rect + GetClientRect (&rect); + rect.right -= CURSOR_MAX_RIGHT; + rect.left += CURSOR_MIN_LEFT; +} + +// *************************************************************************** + +void CGradientWnd::cursorChanged() +{ + std::vector &gradient = _GradientWnd.getGradient(); + std::vector::iterator ite = gradient.begin(); + uint i = 0; + while (ite != gradient.end()) + { + if (i<_CursorsWnd.size()) + { + RECT child; + _CursorsWnd[i]->GetWindowRect(&child); + ScreenToClient (&child); + ite->Pos = getPos(child.left); + NLTEXGEN::copy (ite->Color, _CursorsWnd[i]->getColor()); + } + + ite++; + i++; + } + + uint j; + for (i=0; iSetDlgCtrlID (i+FirstCursor); + + // Resort windows + for (i=0; i<_CursorsTangentWnd.size(); i++) + _CursorsTangentWnd[i]->SetDlgCtrlID (i+FirstCursor); + + // Notify parent + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (CGW_GRADIENT_CHANGED<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + _GradientWnd.Invalidate (); +} + +// *************************************************************************** + +void CGradientWnd::tangentChanged() +{ + std::vector &gradient = _GradientWnd.getGradient(); + std::vector::iterator ite = gradient.begin(); + uint i = 0; + while (ite != gradient.end()) + { + if (i<_CursorsTangentWnd.size()) + { + if ((ite+1) != gradient.end()) + { + RECT child; + _CursorsTangentWnd[i]->GetWindowRect(&child); + ScreenToClient (&child); + ite->RightPos = (getPos(child.left) - ite->Pos) / ((ite+1)->Pos - ite->Pos); + ite->RightQuadratic = _CursorsTangentWnd[i]->getQuadratic(); + } + } + + ite++; + i++; + } + + // Notify parent + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (CGW_GRADIENT_CHANGED<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + _GradientWnd.Invalidate (); +} + +// *************************************************************************** + +void CGradientWnd::OnLButtonDown(UINT nFlags, CPoint point) +{ + // The client rect + RECT client; + GetClientRect (&client); + + if ( (point.x >= CURSOR_MIN_LEFT + CURSOR_WIDTH/2) && + (point.x <= client.right - CURSOR_MAX_RIGHT - CURSOR_WIDTH/2) && + (point.y >= client.bottom - BORDER_BOTTOM)) + { + CGradientColor color; + color.Pos = getPos(point.x - CURSOR_WIDTH/2); + std::vector &_gradient = _GradientWnd.getGradient(); + gradient (color.Color, _gradient, color.Pos); + _gradient.push_back (color); + + gradientChanged(true); + } + + CWnd::OnLButtonDown(nFlags, point); +} + +// *************************************************************************** + +float CGradientWnd::getPos(int clientX) const +{ + RECT minMax; + getCursorMinMax(minMax); + + return (float)(clientX-minMax.left)/(float)(minMax.right-minMax.left); +} + +// *************************************************************************** + +int CGradientWnd::getClientX(float pos) const +{ + RECT minMax; + getCursorMinMax(minMax); + + return minMax.left + (int)floor(0.5f + pos * (float)(minMax.right - minMax.left)); +} + +// *************************************************************************** + +void CGradientWnd::cursorDeleted(uint child) +{ + child -= FirstCursor; + + std::vector &gradient = _GradientWnd.getGradient(); + nlassert (child < gradient.size()); + + gradient.erase(gradient.begin()+child); + + gradientChanged(true); +} + +// *************************************************************************** + +void CGradientWnd::cursorDuplicate(uint child) +{ + child -= FirstCursor; + std::vector &gradient = _GradientWnd.getGradient(); + nlassert (child < gradient.size()); + + gradient.insert(gradient.begin()+child, *(gradient.begin()+child)); + + gradientChanged(true); +} + +// *************************************************************************** diff --git a/tools/tex_gen_editor/gradient_wnd.h b/tools/tex_gen_editor/gradient_wnd.h new file mode 100644 index 0000000..92771ce --- /dev/null +++ b/tools/tex_gen_editor/gradient_wnd.h @@ -0,0 +1,93 @@ +#if !defined(AFX_GRADIENT_WND_H__29589CA6_057F_494E_8453_29BD5670C74E__INCLUDED_) +#define AFX_GRADIENT_WND_H__29589CA6_057F_494E_8453_29BD5670C74E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// gradient_wnd.h : header file +// + +#include "gradient_rect_wnd.h" +#include "tex_gen\basics.h" + +#define CURSOR_WIDTH 9 +#define CURSOR_HEIGHT 18 + +#define CGW_GRADIENT_CHANGED 0x1113 + +// *************************************************************************** +// CGradientWnd window +// *************************************************************************** + +class CGradientWnd : public CWnd +{ + friend class CGradientRectWnd; + friend class CGradientCursorWnd; +// Construction +public: + CGradientWnd(); + +// Attributes +public: + + void setGradient(const std::vector &gradient); + const std::vector &getGradient() const + { + return _GradientWnd.getGradient(); + } + BOOL Create (DWORD dwStyle, RECT &rect, CWnd *parent, UINT nID); + void getCursorMinMax(RECT &rect) const; + + float getPos(int clientX) const; + int getClientX(float pos) const; + +private: + + void resizeChildren(); + void cursorChanged(); + void tangentChanged(); + void gradientChanged(bool notifyParent); + void cursorDeleted(uint child); + void cursorDuplicate(uint child); + + enum + { + Gradient, + FirstCursor + }; + + // The windows + CGradientRectWnd _GradientWnd; + std::vector _CursorsWnd; + std::vector _CursorsTangentWnd; + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CGradientWnd) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CGradientWnd(); + + // Generated message map functions +protected: + //{{AFX_MSG(CGradientWnd) + afx_msg void OnPaint(); + afx_msg void OnKillFocus(CWnd* pNewWnd); + afx_msg void OnSetFocus(CWnd* pOldWnd); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +// *************************************************************************** + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GRADIENT_WND_H__29589CA6_057F_494E_8453_29BD5670C74E__INCLUDED_) diff --git a/tools/tex_gen_editor/history.txt b/tools/tex_gen_editor/history.txt new file mode 100644 index 0000000..9b3f1e1 --- /dev/null +++ b/tools/tex_gen_editor/history.txt @@ -0,0 +1,96 @@ +NeL Texture Generator History + +--- Known bugs + +- part of overlapped operators window are not refreshed +- edition crash (not reproducted) + +version 1.0b: + + + windows explorer thumbnail plug-in + + 3dsmax 3 plug-in + + 3dsmax 5 plug-in + + view operator layer result or not + + program icons + + files + + history file + + digital murder web site + + install + + install components added + + install icon on the desktop added + + install menu added + + register the document added + + open the history file added + + run the application added + + text operator + + pre translate special hotkey in dialog + + scale in AngularGradient + + clouds + + add low frequencies attenuation + + add intensity + + operator quad + + shematic window debuged + + debug auto arrange + + blur directions added + + blur intensity in not more limited to 5 + + invert blend mode + + cellular operator + + use pro ui library + + save windows and control bars setup + +version 0.1: + + + radial gradient + + multi output + + mix operator + + noise operator + + color transform operator + + Contrast / luminosity / color balance + + Hue / saturation + + RGB + + normal operator + + lighting operator + + transform operator + + move + + rotate + + shear + + scale + + filtered deformation + + sinus deformation + + background operators + + sprites (modify noise) + sprite modulation + + gradient bars (bricks) + + clouds operator + + filter sorted in folder + + load / save / export + + operator selection + + remove the edit for the operator name + + selection + + show first selected + + delete operator + + widget for float + + Button + + Value range and fomula type for plugin + + Value range, fomula and unit to display (Editbox) + + Predefined marks (disabled with ctrl or shift) + + Default value (Dbl click) + + color picker + + Basic color slots + + RGB edit box + + HSL edit box + + RGB picker + + bilinera filter should use easein method before sampling + + larger gradient window + + add easeinout in gradients + + tiling / zoom previous + + preview an operator output + + check all parameters are relative at image size + + output alpha + + texture samples + + gradient continuity parameter + +left to do : +------------ + +- merger un project + diff --git a/tools/tex_gen_editor/main_frm.cpp b/tools/tex_gen_editor/main_frm.cpp new file mode 100644 index 0000000..d306253 --- /dev/null +++ b/tools/tex_gen_editor/main_frm.cpp @@ -0,0 +1,367 @@ +// main_frm.cpp : implementation of the CMainFrame class +// + +#include "stdafx.h" +#include "nel_tex_gen.h" + +#include "main_frm.h" + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame + +IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) + +BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) + //{{AFX_MSG_MAP(CMainFrame) + ON_WM_CREATE() + ON_COMMAND(ID_VIEW_FULL_SCREEN, OnViewFullScreen) + ON_UPDATE_COMMAND_UI(ID_VIEW_FULL_SCREEN, OnUpdateViewFullScreen) + ON_WM_CLOSE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +static UINT indicators[] = +{ + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, +}; + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame construction/destruction + +CMainFrame::CMainFrame() +{ + m_bFullScreen = FALSE; +} + +CMainFrame::~CMainFrame() +{ +} + +int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + /*if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP + | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) + { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + }*/ + +CWinApp * pApp = ::AfxGetApp(); + ASSERT( pApp != NULL ); + ASSERT( pApp->m_pszRegistryKey != NULL ); + ASSERT( pApp->m_pszRegistryKey[0] != _T('\0') ); + ASSERT( pApp->m_pszProfileName != NULL ); + ASSERT( pApp->m_pszProfileName[0] != _T('\0') ); + + ASSERT( pApp->m_pszProfileName != NULL ); + g_CmdManager->ProfileSetup( + pApp->m_pszProfileName, + GetSafeHwnd() + ); + VERIFY( + g_CmdManager->UpdateFromMenu( + pApp->m_pszProfileName, + IDR_MAINFRAME + ) + ); + VERIFY( + g_CmdManager->UpdateFromMenu( + pApp->m_pszProfileName, + IDR_TEX_GETYPE + ) + ); + + m_wndMenuBar.SetMdiWindowPopupName( _T("Window") ); + if( !m_wndMenuBar.Create( + NULL, // _T("Menu Bar"), + this, + ID_VIEW_MENUBAR + ) + ) + { + TRACE0("Failed to create menubar\n"); + return -1; // failed to create + } + + if( !m_wndToolBar.Create( + _T("ToolBar"), + this, + AFX_IDW_TOOLBAR + ) + || + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME) + ) + { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + if( !m_wndToolBar2.Create( + _T("ToolBar 2"), + this, + IDR_FULLSCREEN + ) + || + !m_wndToolBar2.LoadToolBar(IDR_FULLSCREEN) + ) + { + TRACE0("Failed to create toolbar3\n"); + return -1; // fail to create + } + + if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators)/sizeof(UINT))) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + + m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + m_wndToolBar2.EnableDocking(CBRS_ALIGN_ANY); + + if( !CExtControlBar::FrameEnableDocking(this) ) + { + ASSERT( FALSE ); + return -1; + } + + /*if( !CExtControlBar::ProfileBarStateLoad( + this, + pApp->m_pszRegistryKey, + pApp->m_pszProfileName, + pApp->m_pszProfileName, + &m_dataFrameWP + ) + ) + {*/ + DockControlBar(&m_wndMenuBar); + DockControlBar(&m_wndToolBar); + RecalcLayout(); + CRect wrAlredyDockedBar; + m_wndToolBar.GetWindowRect( &wrAlredyDockedBar ); + wrAlredyDockedBar.OffsetRect( 1, 0); + DockControlBar(&m_wndToolBar2, (UINT)0, &wrAlredyDockedBar); + RecalcLayout(); + //} + + g_CmdManager->SerializeState( + pApp->m_pszProfileName, + pApp->m_pszRegistryKey, + pApp->m_pszProfileName, + false + ); + + /*if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators)/sizeof(UINT))) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + + // TODO: Delete these three lines if you don't want the toolbar to + // be dockable + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar);*/ + + // Register operators + + UINT id = ID_EDIT_ADD_OPERATOR; + theApp.AddFolder (id++, "Inputs"); + theApp.AddOperator (id++, "Bg", "Background"); + theApp.AddFolder (id++, "Mixing"); + theApp.AddOperator (id++, "Mi", "Merge"); + theApp.AddFolder (id++, "Shapes"); + theApp.AddOperator (id++, "Ft", "Text"); + theApp.AddOperator (id++, "Qd", "Rectangle"); + theApp.AddFolder (id++, "Color fillers"); + theApp.AddOperator (id++, "FC", "Solid color"); + theApp.AddSeparator (id++); + theApp.AddOperator (id++, "LG", "Linear gradient"); + theApp.AddOperator (id++, "RG", "Radial gradient"); + theApp.AddOperator (id++, "AG", "Angular gradient"); + theApp.AddOperator (id++, "Ba", "Bars gradient"); + theApp.AddFolder (id++, "Image modification"); + theApp.AddOperator (id++, "CL", "Contrast / luminosity"); + theApp.AddOperator (id++, "HS", "Hue / saturation"); + theApp.AddOperator (id++, "Bl", "Blur"); + theApp.AddOperator (id++, "Gr", "Gradient image"); + theApp.AddFolder (id++, "Image deformation"); + theApp.AddOperator (id++, "Tr", "Transform"); + theApp.AddOperator (id++, "Si", "Sinus"); + theApp.AddFolder (id++, "Noise fillers"); + theApp.AddOperator (id++, "Ns", "Noise"); + theApp.AddOperator (id++, "Cl", "Clouds"); + theApp.AddOperator (id++, "Cr", "Cellular"); + theApp.AddFolder (id++, "Lighting"); + theApp.AddOperator (id++, "No", "Convert to normal"); + theApp.AddOperator (id++, "Li", "Directionnal light"); + + VERIFY( doBarStateSerialization(false,false,true) ); + + return 0; +} + +BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + if( !CMDIFrameWnd::PreCreateWindow(cs) ) + return FALSE; + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + cs.x = 0; + cs.y = 0; + cs.cx = 1024; + cs.cy = 768; + + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame diagnostics + +#ifdef _DEBUG +void CMainFrame::AssertValid() const +{ + CMDIFrameWnd::AssertValid(); +} + +void CMainFrame::Dump(CDumpContext& dc) const +{ + CMDIFrameWnd::Dump(dc); +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame message handlers + +void CMainFrame::OnViewFullScreen() +{ + doViewFullScreen( true ); +} + +void CMainFrame::OnUpdateViewFullScreen(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck (m_bFullScreen); +} + +void CMainFrame::doViewFullScreen( bool bSavePrevLayout ) +{ + if( m_bFullScreen ) + { + m_bFullScreen = false; + if( bSavePrevLayout ) + { + VERIFY( doBarStateSerialization(true,true) ); + } + SetWindowPlacement( &m_wpSavedBeforeFullScreen ); + VERIFY( doBarStateSerialization(false,false) ); + } // if( m_bFullScreen ) + else + { + GetWindowPlacement( &m_wpSavedBeforeFullScreen ); + CRect rcDesktop; + ::GetWindowRect( ::GetDesktopWindow(), &rcDesktop ); + CRect rcMdiClient; + GetClientRect( &rcMdiClient ); + ClientToScreen( &rcMdiClient ); + CRect rcMdiFrame; + GetWindowRect( &rcMdiFrame ); + rcMdiFrame.InflateRect( + rcMdiClient.left-rcDesktop.left, + rcMdiClient.top-rcDesktop.top, + rcDesktop.right-rcMdiClient.right, + rcDesktop.bottom-rcMdiClient.bottom + ); + WINDOWPLACEMENT wpFullScreen; + ::memcpy( &wpFullScreen, &m_wpSavedBeforeFullScreen, sizeof(WINDOWPLACEMENT) ); + wpFullScreen.showCmd = SW_SHOWNORMAL; + wpFullScreen.rcNormalPosition = rcMdiFrame; + wpFullScreen.ptMaxPosition = rcMdiFrame.TopLeft(); + m_sizeFullScreenDesktopDifference = + rcMdiFrame.Size() - rcDesktop.Size(); + m_bFullScreen = true; + if( bSavePrevLayout ) + { + VERIFY( doBarStateSerialization(false,true) ); + } + SetWindowPlacement( &wpFullScreen ); + VERIFY( doBarStateSerialization(true,false) ); + } // else from if( m_bFullScreen ) +} + +bool CMainFrame::doBarStateSerialization( + bool bFullScreenState, + bool bSaveState, + bool bInitialLoad // = false + ) +{ +CWinApp * pApp = ::AfxGetApp(); + ASSERT( pApp != NULL ); + ASSERT( pApp->m_pszRegistryKey != NULL ); + ASSERT( pApp->m_pszRegistryKey[0] != _T('\0') ); + ASSERT( pApp->m_pszProfileName != NULL ); + ASSERT( pApp->m_pszProfileName[0] != _T('\0') ); +CString sSpan = pApp->m_pszProfileName; + sSpan += _T("\\"); + sSpan += + bFullScreenState + ? _T("BarPos-FullScreen") + : _T("BarPos-Normal") + ; + RecalcLayout(); +bool bRetVal = false; + if( bSaveState ) + bRetVal = + CExtControlBar::ProfileBarStateSave( + this, + pApp->m_pszRegistryKey, + pApp->m_pszProfileName, + sSpan + ); + else + bRetVal = + CExtControlBar::ProfileBarStateLoad( + this, + pApp->m_pszRegistryKey, + pApp->m_pszProfileName, + sSpan, + &m_wpInitial + ); + if( !bSaveState ) + { + if( !bRetVal ) + { + // doInitialDock( bFullScreenState ); + bRetVal = true; + } + else if( (!bInitialLoad) && (!m_bFullScreen) ) + { + ActivateFrame( m_wpInitial.showCmd ); + RedrawWindow( NULL, NULL, + RDW_INVALIDATE|RDW_UPDATENOW + |RDW_ERASE|RDW_ERASENOW + |RDW_FRAME|RDW_ALLCHILDREN + ); + } + m_wpInitial.showCmd = SW_HIDE; + } + return bRetVal; +} + +void CMainFrame::OnClose() +{ + VERIFY( doBarStateSerialization(m_bFullScreen!=0,true) ); + + CMDIFrameWnd::OnClose(); +} diff --git a/tools/tex_gen_editor/main_frm.h b/tools/tex_gen_editor/main_frm.h new file mode 100644 index 0000000..1a08c2f --- /dev/null +++ b/tools/tex_gen_editor/main_frm.h @@ -0,0 +1,73 @@ +// main_frm.h : interface of the CMainFrame class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAIN_FRM_H__277CC08A_74CD_488F_80DA_9FF40550274F__INCLUDED_) +#define AFX_MAIN_FRM_H__277CC08A_74CD_488F_80DA_9FF40550274F__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CMainFrame : public CMDIFrameWnd +{ + DECLARE_DYNAMIC(CMainFrame) +public: + CMainFrame(); + +// Attributes +public: + +// Operations +public: + + // window placement persistence + WINDOWPLACEMENT m_wpInitial; + // Fullscreen + BOOL m_bFullScreen; + WINDOWPLACEMENT m_wpSavedBeforeFullScreen; + + // persistent size for OnGetMinMaxInfo() in full-screen mode + CSize m_sizeFullScreenDesktopDifference; + + void doViewFullScreen( bool bSavePrevLayout ); + bool doBarStateSerialization( bool bFullScreenState, bool bSaveState, bool bInitialLoad = false); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMainFrame) + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CMainFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +public: // for child frame + CExtMenuControlBar m_wndMenuBar; +protected: // control bar embedded members + CExtStatusControlBar m_wndStatusBar; + CExtToolControlBar m_wndToolBar; + CExtToolControlBar m_wndToolBar2; + +// Generated message map functions +protected: + //{{AFX_MSG(CMainFrame) + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg void OnViewFullScreen(); + afx_msg void OnUpdateViewFullScreen(CCmdUI* pCmdUI); + afx_msg void OnClose(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAIN_FRM_H__277CC08A_74CD_488F_80DA_9FF40550274F__INCLUDED_) diff --git a/tools/tex_gen_editor/my_edit.cpp b/tools/tex_gen_editor/my_edit.cpp new file mode 100644 index 0000000..3f020bf --- /dev/null +++ b/tools/tex_gen_editor/my_edit.cpp @@ -0,0 +1,65 @@ +// my_edit.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "my_edit.h" + +// *************************************************************************** +// CMyEdit +// *************************************************************************** + +CMyEdit::CMyEdit() +{ +} + +// *************************************************************************** + +CMyEdit::~CMyEdit() +{ +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CMyEdit, CExtEdit) + //{{AFX_MSG_MAP(CMyEdit) + ON_WM_KEYDOWN() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CMyEdit message handlers +// *************************************************************************** + +void CMyEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +{ + // Return ? + if (nChar == VK_RETURN) + { + // Notify parent + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (EN_RETURN<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + } + + CExtEdit::OnKeyDown(nChar, nRepCnt, nFlags); +} + +// *************************************************************************** + +BOOL CMyEdit::PreTranslateMessage(MSG* pMsg) +{ + if ((pMsg->message == WM_KEYDOWN) && (int) pMsg->wParam == VK_RETURN) + { + // Notify parent + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (EN_RETURN<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + return TRUE; + } + + return CExtEdit::PreTranslateMessage(pMsg); +} + +// *************************************************************************** + diff --git a/tools/tex_gen_editor/my_edit.h b/tools/tex_gen_editor/my_edit.h new file mode 100644 index 0000000..ad65378 --- /dev/null +++ b/tools/tex_gen_editor/my_edit.h @@ -0,0 +1,52 @@ +#if !defined(AFX_MY_EDIT_H__AC41D702_EE92_41EB_B2AF_40DA6DEB1E99__INCLUDED_) +#define AFX_MY_EDIT_H__AC41D702_EE92_41EB_B2AF_40DA6DEB1E99__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// my_edit.h : header file +// + +#define EN_RETURN 0x1111 + +///////////////////////////////////////////////////////////////////////////// +// CMyEdit window + +class CMyEdit : public CExtEdit +{ +// Construction +public: + CMyEdit(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMyEdit) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CMyEdit(); + + // Generated message map functions +protected: + //{{AFX_MSG(CMyEdit) + afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MY_EDIT_H__AC41D702_EE92_41EB_B2AF_40DA6DEB1E99__INCLUDED_) diff --git a/tools/tex_gen_editor/nel_tex_gen.cpp b/tools/tex_gen_editor/nel_tex_gen.cpp new file mode 100644 index 0000000..e2ac7df --- /dev/null +++ b/tools/tex_gen_editor/nel_tex_gen.cpp @@ -0,0 +1,552 @@ +// nel_tex_gen.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "nel_tex_gen.h" + +#include "main_frm.h" +#include "child_frm.h" +#include "nel_tex_gen_doc.h" +#include "nel_tex_gen_view.h" + +#include "tex_gen/basics.h" +#include "tex_gen/transform_float.h" + +// Operators +#include "tex_gen/op_fill_color.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +::CBitmap Button; +::CBitmap ButtonMask; +::CBitmap ButtonHole; +::CBitmap ButtonHoleMask; +::CBitmap Linear; +::CBitmap Quadratic; +HACCEL DialogShortcut; +// *************************************************************************** +// CNelTexGenApp +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CNelTexGenApp, CWinApp) + //{{AFX_MSG_MAP(CNelTexGenApp) + ON_COMMAND(ID_APP_ABOUT, OnAppAbout) + ON_COMMAND(ID_HELP_DIGITAL_MURDER_WEB, OnHelpDigitalMurderWeb) + ON_COMMAND(ID_HELP_HISTORY, OnHelpHistory) + ON_COMMAND(ID_HELP_EMAIL, OnHelpEmail) + //}}AFX_MSG_MAP + // Standard file based document commands + ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) + ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) +END_MESSAGE_MAP() + +// *************************************************************************** +// CNelTexGenApp construction +// *************************************************************************** + +CNelTexGenApp::CNelTexGenApp() +{ +} + +// *************************************************************************** +// The one and only CNelTexGenApp object +// *************************************************************************** + +CNelTexGenApp theApp; + +HBITMAP ArrowBitmapInput; +HBITMAP ArrowBitmapOutput; + +CPortWnd *Drag[2] = { NULL, NULL }; +POINT DragPos; +POINT MenuPos; +CVector DragBezier[4]; +bool DragValid = false; +bool Draft = false; + +void SetNull(CRect &rect) +{ + rect.left = 0; + rect.right = 0; + rect.top = 0; + rect.bottom = 0; +} + +void ExpandRect(CRect &rect, POINT &pt) +{ + if (rect.IsRectNull()) + { + rect.left = pt.x; + rect.right = pt.x; + rect.top = pt.y; + rect.bottom = pt.y; + } + else + { + rect.left = std::min(pt.x, rect.left); + rect.right = std::max(pt.x, rect.right); + rect.top = std::min(pt.y, rect.top); + rect.bottom = std::max(pt.y, rect.bottom); + } +} + +// *************************************************************************** +// CNelTexGenApp initialization +// *************************************************************************** + +BOOL CNelTexGenApp::InitInstance() +{ + VERIFY( + g_PaintManager.InstallPaintManager( + // new CExtPaintManagerOffice2003 + new CExtPaintManagerXP + ) + ); + CExtPopupMenuWnd::g_bMenuExpanding = false; + + ExePath = GetCommandLine (); + if (ExePath.size()>0) + { + if (ExePath[0] == '\"') + { + uint end=ExePath.find ('\"', 1); + if (end != string::npos) + { + ExePath = ExePath.substr (1, end-1); + } + else + { + nlassert (0); // no! + } + } + else + { + uint end=ExePath.find (' ', 1); + ExePath = ExePath.substr (0, end); + } + } + ExePath = NLMISC::CFile::getPath (ExePath); + + // Register classes + registerTypes(); + + // Create bitmaps + nlverify (Button.LoadBitmap(IDB_BUTTON)); + nlverify (ButtonMask.LoadBitmap(IDB_BUTTON_MASK)); + nlverify (ButtonHole.LoadBitmap(IDB_BUTTON_HOLE)); + nlverify (ButtonHoleMask.LoadBitmap(IDB_BUTTON_HOLE_MASK)); + nlverify (Linear.LoadBitmap(IDB_LINEAR)); + nlverify (Quadratic.LoadBitmap(IDB_QUADRATIC)); + nlverify (DialogShortcut = LoadAccelerators (m_hInstance, MAKEINTRESOURCE(IDR_DIALOG))); + + // Init the default bitmap + ITexGenOperator::DefaultBitmap.resize (256, 256); + + unsigned char bitmaps[8*8]={ + 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, + 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, + }; + float *pixels = ITexGenOperator::DefaultBitmap.getPixels(); + for (uint y=0; y<8; y++) + { + for (uint x=0; x<7; x++) + { + for (uint sy=0; sy<32; sy++) + { + for (uint sx=0; sx<32; sx++) + { + replaceConstRGBA (pixels+(16+x*32+y*256*32+sx+sy*256)*4, bitmaps[x+y*8]?ColorWhite:ColorBlack, 1); + } + } + } + } + + for (y=0; y<256; y++) + { + for (uint x=0; x<256; x++) + { + replaceBlendConstRGBA (pixels+(x+y*256)*4, (((x+y)&7) == 0)?ColorWhite:ColorBlack, 1, 0.75); + } + } + + // Load a bitmap + nlverify (ArrowBitmapInput = LoadBitmap (m_hInstance, MAKEINTRESOURCE(IDB_ARROW_INPUT))); + nlverify (ArrowBitmapOutput = LoadBitmap (m_hInstance, MAKEINTRESOURCE(IDB_ARROW_OUTPUT))); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +/*#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif*/ + + // Change the registry key under which our settings are stored. + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization. + SetRegistryKey(_T("Nel TexGen")); + + LoadStdProfileSettings(16); // Load standard INI file options (including MRU) + + // Register the application's document templates. Document templates + // serve as the connection between documents, frame windows and views. + + CMultiDocTemplate* pDocTemplate; + pDocTemplate = new CMultiDocTemplate( + IDR_TEX_GETYPE, + RUNTIME_CLASS(CNelTexGenDoc), + RUNTIME_CLASS(CChildFrame), // custom MDI child frame + RUNTIME_CLASS(CNelTexGenView)); + AddDocTemplate(pDocTemplate); + + // create main MDI Frame window + CMainFrame* pMainFrame = new CMainFrame; + if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) + return FALSE; + m_pMainWnd = pMainFrame; + + // Enable drag/drop open + m_pMainWnd->DragAcceptFiles(); + + // Enable DDE Execute open + EnableShellOpen(); + // RegisterShellFileTypes(TRUE); + + // Parse command line for standard shell commands, DDE, file open + CCommandLineInfo cmdInfo; + ParseCommandLine(cmdInfo); + + // Dispatch commands specified on the command line + if (!ProcessShellCommand(cmdInfo)) + return FALSE; + + // The main window has been initialized, so show and update it. + pMainFrame->ShowWindow(m_nCmdShow); + pMainFrame->UpdateWindow(); + + // Create the color picker + nlverify (ColorPicker.CDialog::Create (IDD_COLOR_PICKER, m_pMainWnd)); + + return TRUE; +} + +// *************************************************************************** +// CAboutDlg dialog used for App About +// *************************************************************************** + +class CAboutDlg : public CDialog +{ +public: + CAboutDlg(); + +// Dialog Data + //{{AFX_DATA(CAboutDlg) + enum { IDD = IDD_ABOUTBOX }; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAboutDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + //{{AFX_MSG(CAboutDlg) + // No message handlers + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +// *************************************************************************** + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +{ + //{{AFX_DATA_INIT(CAboutDlg) + //}}AFX_DATA_INIT +} + +// *************************************************************************** + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAboutDlg) + //}}AFX_DATA_MAP +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) + //{{AFX_MSG_MAP(CAboutDlg) + // No message handlers + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** + +// App command to run the dialog +void CNelTexGenApp::OnAppAbout() +{ + CAboutDlg aboutDlg; + aboutDlg.DoModal(); +} + +// *************************************************************************** +// CNelTexGenApp message handlers +// *************************************************************************** + +COLORREF getColorRef(const float *floatColor) +{ + float R = floatColor[0]*255.f; + float G = floatColor[1]*255.f; + float B = floatColor[2]*255.f; + float A = floatColor[3]*255.f; + clamp(R, 0.f, 255.f); + clamp(G, 0.f, 255.f); + clamp(B, 0.f, 255.f); + clamp(A, 0.f, 255.f); + return RGB((int)R, (int)G, (int)B); +} + +// *************************************************************************** + +NLMISC::CRGBAF getCRGBAF(COLORREF color) +{ + return CRGBAF(CRGBA (GetRValue(color), GetGValue(color), GetBValue(color))); +} + +// *************************************************************************** + +void setColor(float *dst, COLORREF color) +{ + dst[0] = (float)GetRValue(color) / 255.f; + dst[1] = (float)GetGValue(color) / 255.f; + dst[2] = (float)GetBValue(color) / 255.f; +} + +// *************************************************************************** + +const char *CNelTexGenApp::getOperatorName (const char *className) const +{ + uint i; + if (strcmp (className, "Rt") == 0) + return "Output"; + for (i=0; i<_Operators.size(); i++) + { + if (_Operators[i].ClassName == className) + return _Operators[i].OperatorName.c_str (); + } + return "Unknwon"; +} + +// *************************************************************************** + +bool CNelTexGenApp::yesNoMessage (const char *format, ... ) +{ + // Make a buffer string + va_list args; + va_start( args, format ); + char buffer[1024]; + sint ret = vsnprintf( buffer, 1024, format, args ); + va_end( args ); + + return MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, buffer, "NeL TexGen", MB_YESNO|MB_ICONQUESTION) == IDYES; +} + +// *************************************************************************** + +void CNelTexGenApp::errorMessage (const char *format, ... ) +{ + // Make a buffer string + va_list args; + va_start( args, format ); + char buffer[1024]; + sint ret = vsnprintf( buffer, 1024, format, args ); + va_end( args ); + + MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, buffer, "NeL TexGen", MB_OK|MB_ICONEXCLAMATION); +} + +// *************************************************************************** + +void CNelTexGenApp::addOperatorsCreatorToMenu (CExtPopupMenuWnd &menu) +{ + const std::vector &operators = getOperators(); + uint i; + CExtPopupMenuWnd *subMenu = &menu; + for (i=0; iItemInsert( (UINT)CExtPopupMenuWnd::TYPE_SEPARATOR)); + } + else if (operators[i].Folder) + { + menu.ItemInsert((UINT)CExtPopupMenuWnd::TYPE_POPUP, -1, operators[i].OperatorName.c_str()); + subMenu = menu.ItemGetPopup(menu.ItemGetCount()-1); + } + else + { + nlverify(subMenu->ItemInsert(ID_EDIT_ADD_OPERATOR+i)); + } + } +} + +// *************************************************************************** + +LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata) +{ + HKEY hkey; + LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey); + + if (retval == ERROR_SUCCESS) + { + long datasize = MAX_PATH; + TCHAR data[MAX_PATH]; + RegQueryValue(hkey, NULL, data, &datasize); + lstrcpy(retdata,data); + RegCloseKey(hkey); + } + + return retval; +} + +// *************************************************************************** + +bool openDocument (LPCTSTR filename, LPCTSTR ext) +{ + TCHAR key[MAX_PATH + MAX_PATH]; + + // First try ShellExecute() + // HINSTANCE result = ShellExecute(NULL, "open", filename, NULL,NULL, showcmd); + + // If it failed, get the .htm regkey and lookup the program + // if ((UINT)result <= HINSTANCE_ERROR) + { + if (GetRegKey(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS) + { + lstrcat(key, "\\shell\\open\\command"); + + if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) + { + TCHAR *pos; + pos = strstr(key, "\"%1\""); + if (pos == NULL) { // No quotes found + pos = strstr(key, "%1"); // Check for %1, without quotes + if (pos == NULL) // No parameter at all... + pos = key+lstrlen(key)-1; + else + *pos = '\0'; // Remove the parameter + } + else + *pos = '\0'; // Remove the parameter + + lstrcat(pos, " "); + lstrcat(pos, filename); + int res = WinExec(key, SW_SHOWDEFAULT); + return (res>31); + } + } + } + + return false; +} + +// *************************************************************************** + +bool openFile (LPCTSTR filename) +{ + string ext = "." + NLMISC::CFile::getExtension (filename); + return openDocument (filename, ext.c_str()); +} + +// *************************************************************************** + +bool openURL (LPCTSTR filename) +{ + return openDocument (filename, ".html"); +} + +// *************************************************************************** + +void CNelTexGenApp::OnHelpDigitalMurderWeb() +{ + openURL ("http://www.digital-murder.org"); +} + +// *************************************************************************** + +void CNelTexGenApp::OnHelpHistory() +{ + openFile ((ExePath+"history.txt").c_str()); +} + +// *************************************************************************** + +void CNelTexGenApp::OnHelpEmail() +{ + openURL ("mailto:hulud@digital-murder.org"); +} + +// *************************************************************************** + +void CNelTexGenApp::AddSeparator (UINT id) +{ + COperatorDesc desc; + desc.Folder = false; + desc.Separator = true; + _Operators.push_back (desc); + + CWinApp * pApp = ::AfxGetApp(); + CExtCmdItem item (id); + item.m_sMenuText = ""; + g_CmdManager->CmdSetup (pApp->m_pszProfileName, item); +} + +// *************************************************************************** + +void CNelTexGenApp::AddFolder (UINT id, const char *folderName) +{ + COperatorDesc desc; + desc.OperatorName = folderName; + desc.Folder = true; + desc.Separator = false; + _Operators.push_back (desc); + + CWinApp * pApp = ::AfxGetApp(); + CExtCmdItem item (id); + item.m_sMenuText = folderName; + g_CmdManager->CmdSetup (pApp->m_pszProfileName, item); +} + +// *************************************************************************** + +void CNelTexGenApp::AddOperator (UINT id, const char *className, const char *operatorName) +{ + COperatorDesc desc; + desc.ClassName = className; + desc.OperatorName = operatorName; + desc.Folder = false; + desc.Separator = false; + _Operators.push_back (desc); + + CWinApp * pApp = ::AfxGetApp(); + CExtCmdItem item (id); + item.m_sMenuText = operatorName; + g_CmdManager->CmdSetup (pApp->m_pszProfileName, item); +} + +// *************************************************************************** + diff --git a/tools/tex_gen_editor/nel_tex_gen.dsp b/tools/tex_gen_editor/nel_tex_gen.dsp new file mode 100644 index 0000000..4417b03 --- /dev/null +++ b/tools/tex_gen_editor/nel_tex_gen.dsp @@ -0,0 +1,393 @@ +# Microsoft Developer Studio Project File - Name="nel_tex_gen" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=nel_tex_gen - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "nel_tex_gen.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "nel_tex_gen.mak" CFG="nel_tex_gen - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "nel_tex_gen - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "nel_tex_gen - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "nel_tex_gen - Win32 ReleaseDebug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "nel_tex_gen - Win32 Release" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GR /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 freetype214MT.lib /nologo /subsystem:windows /debug /machine:I386 + +!ELSEIF "$(CFG)" == "nel_tex_gen - Win32 Debug" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "__STL_DEBUG" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 freetype214MT.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "nel_tex_gen - Win32 ReleaseDebug" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "nel_tex_gen___Win32_ReleaseDebug" +# PROP BASE Intermediate_Dir "nel_tex_gen___Win32_ReleaseDebug" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseDebug" +# PROP Intermediate_Dir "ReleaseDebug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GR /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GR /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 freetype214MT.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 freetype214MT.lib /nologo /subsystem:windows /debug /machine:I386 + +!ENDIF + +# Begin Target + +# Name "nel_tex_gen - Win32 Release" +# Name "nel_tex_gen - Win32 Debug" +# Name "nel_tex_gen - Win32 ReleaseDebug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\action.cpp +# End Source File +# Begin Source File + +SOURCE=.\bitmap_wnd.cpp +# End Source File +# Begin Source File + +SOURCE=.\child_frm.cpp +# End Source File +# Begin Source File + +SOURCE=.\color_box.cpp +# End Source File +# Begin Source File + +SOURCE=.\color_picker.cpp +# End Source File +# Begin Source File + +SOURCE=.\color_picker_color_wnd.cpp +# End Source File +# Begin Source File + +SOURCE=.\color_picker_hue_panel.cpp +# End Source File +# Begin Source File + +SOURCE=.\color_picker_rgb_panel.cpp +# End Source File +# Begin Source File + +SOURCE=.\dib_wnd.cpp +# End Source File +# Begin Source File + +SOURCE=.\gradient_cursor_wnd.cpp +# End Source File +# Begin Source File + +SOURCE=.\gradient_dlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\gradient_rect_wnd.cpp +# End Source File +# Begin Source File + +SOURCE=.\gradient_wnd.cpp +# End Source File +# Begin Source File + +SOURCE=.\main_frm.cpp +# End Source File +# Begin Source File + +SOURCE=.\my_edit.cpp +# End Source File +# Begin Source File + +SOURCE=.\nel_tex_gen.cpp +# End Source File +# Begin Source File + +SOURCE=.\nel_tex_gen.rc +# End Source File +# Begin Source File + +SOURCE=.\nel_tex_gen_doc.cpp +# End Source File +# Begin Source File + +SOURCE=.\nel_tex_gen_view.cpp +# End Source File +# Begin Source File + +SOURCE=.\op_property_dlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\operator_win.cpp +# End Source File +# Begin Source File + +SOURCE=.\port.cpp +# End Source File +# Begin Source File + +SOURCE=.\rot_button.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\action.h +# End Source File +# Begin Source File + +SOURCE=.\bitmap_wnd.h +# End Source File +# Begin Source File + +SOURCE=.\child_frm.h +# End Source File +# Begin Source File + +SOURCE=.\color_box.h +# End Source File +# Begin Source File + +SOURCE=.\color_picker.h +# End Source File +# Begin Source File + +SOURCE=.\color_picker_color_wnd.h +# End Source File +# Begin Source File + +SOURCE=.\color_picker_hue_panel.h +# End Source File +# Begin Source File + +SOURCE=.\color_picker_rgb_panel.h +# End Source File +# Begin Source File + +SOURCE=.\dib_wnd.h +# End Source File +# Begin Source File + +SOURCE=.\gradient_cursor_wnd.h +# End Source File +# Begin Source File + +SOURCE=.\gradient_dlg.h +# End Source File +# Begin Source File + +SOURCE=.\gradient_rect_wnd.h +# End Source File +# Begin Source File + +SOURCE=.\gradient_wnd.h +# End Source File +# Begin Source File + +SOURCE=.\main_frm.h +# End Source File +# Begin Source File + +SOURCE=.\my_edit.h +# End Source File +# Begin Source File + +SOURCE=.\nel_tex_gen.h +# End Source File +# Begin Source File + +SOURCE=.\nel_tex_gen_doc.h +# End Source File +# Begin Source File + +SOURCE=.\nel_tex_gen_view.h +# End Source File +# Begin Source File + +SOURCE=.\op_property_dlg.h +# End Source File +# Begin Source File + +SOURCE=.\operator_win.h +# End Source File +# Begin Source File + +SOURCE=.\port.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\rot_button.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\app.ico +# End Source File +# Begin Source File + +SOURCE=.\res\arrow_in.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\bitmap1.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\bmp00001.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\button.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\button_hole.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\button_hole_mask.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\button_mask.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\doc.ico +# End Source File +# Begin Source File + +SOURCE=.\res\nel_tex_gen.rc2 +# End Source File +# Begin Source File + +SOURCE=.\res\nel_tex_gen_doc.ico +# End Source File +# Begin Source File + +SOURCE=.\res\quadrati.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\Toolbar.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\toolbar1.bmp +# End Source File +# End Group +# Begin Source File + +SOURCE=.\history.txt +# End Source File +# Begin Source File + +SOURCE=.\nel_tex_gen.reg +# End Source File +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/tools/tex_gen_editor/nel_tex_gen.dsw b/tools/tex_gen_editor/nel_tex_gen.dsw new file mode 100644 index 0000000..07e586e --- /dev/null +++ b/tools/tex_gen_editor/nel_tex_gen.dsw @@ -0,0 +1,134 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "misc"=..\..\..\src\misc.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "nel_tex_gen"=.\nel_tex_gen.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name misc + End Project Dependency + Begin Project Dependency + Project_Dep_Name tex_gen + End Project Dependency +}}} + +############################################################################### + +Project: "tex_gen"=..\..\..\src\tex_gen.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "tex_gen_3dsmax3"=..\tex_gen_3dsmax3\tex_gen_3dsmax3.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name misc + End Project Dependency + Begin Project Dependency + Project_Dep_Name tex_gen + End Project Dependency +}}} + +############################################################################### + +Project: "tex_gen_3dsmax5"=..\tex_gen_3dsmax5\tex_gen_3dsmax5.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name misc + End Project Dependency + Begin Project Dependency + Project_Dep_Name tex_gen + End Project Dependency +}}} + +############################################################################### + +Project: "tex_gen_install"=..\tex_gen_install\tex_gen_install.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name nel_tex_gen + End Project Dependency + Begin Project Dependency + Project_Dep_Name tex_gen_thumbnail + End Project Dependency + Begin Project Dependency + Project_Dep_Name tex_gen_3dsmax5 + End Project Dependency +}}} + +############################################################################### + +Project: "tex_gen_thumbnail"=..\tex_gen_thumbnail\tex_gen_thumbnail.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name misc + End Project Dependency + Begin Project Dependency + Project_Dep_Name tex_gen + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/tools/tex_gen_editor/nel_tex_gen.h b/tools/tex_gen_editor/nel_tex_gen.h new file mode 100644 index 0000000..914fbb3 --- /dev/null +++ b/tools/tex_gen_editor/nel_tex_gen.h @@ -0,0 +1,122 @@ +// nel_tex_gen.h : main header file for the NEL_TEX_GEN application +// + +#if !defined(AFX_NEL_TEX_GEN_H__5D279AC8_3B94_4F4C_8949_76FD94AE64A0__INCLUDED_) +#define AFX_NEL_TEX_GEN_H__5D279AC8_3B94_4F4C_8949_76FD94AE64A0__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols +#include "color_picker.h" + +///////////////////////////////////////////////////////////////////////////// +// CNelTexGenApp: +// See nel_tex_gen.cpp for the implementation of this class +// + +#define OPERATOR_WIN_WIDTH 179 +#define OPERATOR_WIN_HEIGHT 50 + +class COperatorDesc +{ +public: + bool Folder; + bool Separator; + std::string ClassName; + std::string OperatorName; +}; + +class CNelTexGenApp : public CWinApp +{ +public: + CNelTexGenApp(); + +private: + std::vector _Operators; + +public: + + // Helpers + bool yesNoMessage (const char *format, ... ); + void errorMessage (const char *format, ... ); + + // Exe path + std::string ExePath; + + // Register an operator + void AddSeparator (UINT id); + void AddFolder (UINT id, const char *folderName); + void AddOperator (UINT id, const char *className, const char *operatorName); + + // Acces operators + const std::vector &getOperators() const + { + return _Operators; + } + + // Get the operator name + const char *getOperatorName (const char *className) const; + + // Add submenu to create operators + void addOperatorsCreatorToMenu (CExtPopupMenuWnd &menu); + + // Color picker + CColorPicker ColorPicker; + +private: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CNelTexGenApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + +// Implementation + //{{AFX_MSG(CNelTexGenApp) + afx_msg void OnAppAbout(); + afx_msg void OnHelpDigitalMurderWeb(); + afx_msg void OnHelpHistory(); + afx_msg void OnHelpEmail(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +extern CNelTexGenApp theApp; +extern HBITMAP ArrowBitmapInput; +extern HBITMAP ArrowBitmapOutput; +extern class CPortWnd *Drag[2]; +extern POINT DragPos; +extern POINT MenuPos; +extern NLMISC::CVector DragBezier[4]; +extern bool DragValid; +extern bool Draft; +extern CBitmap Button; +extern CBitmap ButtonMask; +extern CBitmap ButtonHole; +extern CBitmap ButtonHoleMask; +extern CBitmap Linear; +extern CBitmap Quadratic; +extern HACCEL DialogShortcut; + +void ExpandRect(CRect &rect, POINT &pt); +void SetNull(CRect &rect); +COLORREF getColorRef(const float *floatColor); +NLMISC::CRGBAF getCRGBAF(COLORREF color); +void setColor(float *dst, COLORREF color); +bool openFile (LPCTSTR filename); +bool openDocument (LPCTSTR filename, LPCTSTR ext); +bool openURL (LPCTSTR filename); + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_NEL_TEX_GEN_H__5D279AC8_3B94_4F4C_8949_76FD94AE64A0__INCLUDED_) diff --git a/tools/tex_gen_editor/nel_tex_gen.rc b/tools/tex_gen_editor/nel_tex_gen.rc new file mode 100644 index 0000000..10a34d2 --- /dev/null +++ b/tools/tex_gen_editor/nel_tex_gen.rc @@ -0,0 +1,653 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_TEX_GETYPE ICON DISCARDABLE "res\\doc.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp" +IDB_ARROW_INPUT BITMAP DISCARDABLE "res\\arrow_in.bmp" +IDB_ARROW_OUTPUT BITMAP DISCARDABLE "res\\bmp00001.bmp" +IDR_FULLSCREEN BITMAP DISCARDABLE "res\\toolbar1.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Toolbar +// + +IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 16 +BEGIN + BUTTON ID_FILE_NEW + BUTTON ID_FILE_OPEN + BUTTON ID_FILE_SAVE + SEPARATOR + BUTTON ID_EDIT_CUT + BUTTON ID_EDIT_COPY + BUTTON ID_EDIT_PASTE + SEPARATOR + BUTTON ID_APP_ABOUT + SEPARATOR + BUTTON ID_EDIT_UNDO + BUTTON ID_EDIT_REDO + SEPARATOR + BUTTON ID_VIEW_ZOOM_IN + BUTTON ID_VIEW_ZOOM_OUT + SEPARATOR + BUTTON ID_VIEW_TILE + SEPARATOR + BUTTON ID_VIEW_LAYER_RESULT + SEPARATOR + BUTTON ID_VIEW_OPERATOR + BUTTON ID_VIEW_RGB + BUTTON ID_VIEW_ALPHA +END + +IDR_FULLSCREEN TOOLBAR DISCARDABLE 16, 15 +BEGIN + BUTTON ID_VIEW_FULL_SCREEN +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINFRAME MENU PRELOAD DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM SEPARATOR + MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_APP_EXIT + END + POPUP "&View" + BEGIN + MENUITEM "&Menu Bar", ID_VIEW_MENUBAR + MENUITEM "&Toolbar", ID_VIEW_TOOLBAR + MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR + MENUITEM SEPARATOR + MENUITEM "Full Screen Mode\tCtrl+F", ID_VIEW_FULL_SCREEN + END + POPUP "&Help" + BEGIN + MENUITEM "&About NeL Texture Generator...", ID_APP_ABOUT + MENUITEM "&History file", ID_HELP_HISTORY + MENUITEM "&Digital Murder on the web", ID_HELP_DIGITAL_MURDER_WEB + MENUITEM "&Email the author", ID_HELP_EMAIL + END +END + +IDR_TEX_GETYPE MENU PRELOAD DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM "&Close", ID_FILE_CLOSE + MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE + MENUITEM "Save &As...", ID_FILE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "&Export...\tCtrl+E", ID_FILE_EXPORT + MENUITEM SEPARATOR + MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_APP_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO + MENUITEM SEPARATOR + MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + MENUITEM "&Delete\tDelete", ID_EDIT_DELETE + END + POPUP "&View" + BEGIN + MENUITEM "&Menu Bar", ID_VIEW_MENUBAR + MENUITEM "&Toolbar", ID_VIEW_TOOLBAR + MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR + MENUITEM SEPARATOR + MENUITEM "Zoom in\tCtrl+Alt+""+""", ID_VIEW_ZOOM_IN + MENUITEM "Zoom out\tCtrl+Alt+""-""", ID_VIEW_ZOOM_OUT + MENUITEM SEPARATOR + MENUITEM "&Auto arrange\tCtrl+A", ID_VIEW_AUTO_ARRANGE + MENUITEM "Tile\tCtrl+T", ID_VIEW_TILE + MENUITEM "View layer result\tCtrl+L", ID_VIEW_LAYER_RESULT + MENUITEM "Full Screen Mode\tCtrl+F", ID_VIEW_FULL_SCREEN + MENUITEM SEPARATOR + MENUITEM "View operator\tF2", ID_VIEW_OPERATOR + MENUITEM "View RGB\tF3", ID_VIEW_RGB + MENUITEM "View alpha\tF4", ID_VIEW_ALPHA + END + POPUP "&Window" + BEGIN + MENUITEM "&New Window", ID_WINDOW_NEW + MENUITEM "&Cascade", ID_WINDOW_CASCADE + MENUITEM "&Tile", ID_WINDOW_TILE_HORZ + MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE + MENUITEM "S&plit", ID_WINDOW_SPLIT + END + POPUP "&Help" + BEGIN + MENUITEM "&About NeL Texture Generator...", ID_APP_ABOUT + MENUITEM "&History file", ID_HELP_HISTORY + MENUITEM "&Digital Murder on the web", ID_HELP_DIGITAL_MURDER_WEB + MENUITEM "&Email the author", ID_HELP_EMAIL + END +END + +IDR_GRADIENT_CURSOR MENU DISCARDABLE +BEGIN + POPUP "Graph" + BEGIN + MENUITEM "&Delete", ID_GRADIENT_CURSOR_DELETE + MENUITEM "&Duplicate", ID_GRADIENT_CURSOR_DUPLICATE + END +END + +IDR_OPERATOR_MENU MENU DISCARDABLE +BEGIN + POPUP "Graph" + BEGIN + MENUITEM "Delete", ID_EDIT_DELETE + MENUITEM SEPARATOR + END +END + +IDR_VIEW_MENU MENU DISCARDABLE +BEGIN + POPUP "Graph" + BEGIN + MENUITEM "&Auto Arrange\tA", ID_VIEW_AUTO_ARRANGE + MENUITEM SEPARATOR + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE +BEGIN + "A", ID_VIEW_AUTO_ARRANGE, VIRTKEY, CONTROL, NOINVERT + "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "E", ID_FILE_EXPORT, VIRTKEY, CONTROL, NOINVERT + "F", ID_VIEW_FULL_SCREEN, VIRTKEY, CONTROL, NOINVERT + "L", ID_VIEW_LAYER_RESULT, VIRTKEY, CONTROL, NOINVERT + "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "T", ID_VIEW_TILE, VIRTKEY, CONTROL, NOINVERT + "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + VK_ADD, ID_VIEW_ZOOM_IN, VIRTKEY, CONTROL, NOINVERT + VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT + VK_DELETE, ID_EDIT_DELETE, VIRTKEY, NOINVERT + VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT + VK_F2, ID_VIEW_OPERATOR, VIRTKEY, NOINVERT + VK_F3, ID_VIEW_RGB, VIRTKEY, NOINVERT + VK_F4, ID_VIEW_ALPHA, VIRTKEY, NOINVERT + VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT + VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT + VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT + VK_SUBTRACT, ID_VIEW_ZOOM_OUT, VIRTKEY, CONTROL, NOINVERT + "X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "Y", ID_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT + "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT +END + +IDR_DIALOG ACCELERATORS PRELOAD MOVEABLE PURE +BEGIN + "E", ID_FILE_EXPORT, VIRTKEY, CONTROL, NOINVERT + "F", ID_VIEW_FULL_SCREEN, VIRTKEY, CONTROL, NOINVERT + "L", ID_VIEW_LAYER_RESULT, VIRTKEY, CONTROL, NOINVERT + "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "T", ID_VIEW_TILE, VIRTKEY, CONTROL, NOINVERT + "V", 57637, VIRTKEY, CONTROL, NOINVERT + VK_ADD, ID_VIEW_ZOOM_IN, VIRTKEY, CONTROL, NOINVERT + VK_F2, ID_VIEW_OPERATOR, VIRTKEY, NOINVERT + VK_F3, ID_VIEW_RGB, VIRTKEY, NOINVERT + VK_F4, ID_VIEW_ALPHA, VIRTKEY, NOINVERT + VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT + VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT + VK_SUBTRACT, ID_VIEW_ZOOM_OUT, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About NeL Texture Generator" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 + LTEXT "NeL Texture Generator Version 1.0 b",IDC_STATIC,40,10, + 119,8,SS_NOPREFIX | SS_CENTERIMAGE + LTEXT "Hulud / Digital Murder 2003",IDC_STATIC,40,25,119,8 + DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP +END + +IDD_OP_PROPERTY DIALOGEX 0, 0, 186, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,1,0,0 + PRODUCTVERSION 0,1,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Digital Murder\0" + VALUE "FileDescription", "NeL Texture Generator Editor\0" + VALUE "FileVersion", "0, 1, 0, 0\0" + VALUE "InternalName", "NeL TexGen Editor\0" + VALUE "LegalCopyright", "Hulud / Digital Murder 2003\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "nel_tex_gen.EXE\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "NeL Texture Generator Editor\0" + VALUE "ProductVersion", "0, 1, 0, 0\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 228 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END + + IDD_OP_PROPERTY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + IDR_MAINFRAME "NeL Tex Gen" + IDR_TEX_GETYPE "\ntex_ge\nnew\nNeL Tex Gen Files (*.texgen)\n.texgen\nNeltexgen.Document\nNeL Tex Gen" +END + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + AFX_IDS_APP_TITLE "nel_tex_gen" + AFX_IDS_IDLEMESSAGE "Ready" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_INDICATOR_EXT "EXT" + ID_INDICATOR_CAPS "CAP" + ID_INDICATOR_NUM "NUM" + ID_INDICATOR_SCRL "SCRL" + ID_INDICATOR_OVR "OVR" + ID_INDICATOR_REC "REC" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_NEW "Create a new document\nNew (Ctrl+N)" + ID_FILE_OPEN "Open an existing document\nOpen (Ctrl+O)" + ID_FILE_CLOSE "Close the active document\nClose" + ID_FILE_SAVE "Save the active document\nSave (Ctrl+S)" + ID_FILE_SAVE_AS "Save the active document with a new name\nSave As" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_APP_ABOUT "Display program information, version number and copyright\nAbout" + ID_APP_EXIT "Quit the application; prompts to save documents\nExit" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_MRU_FILE1 "Open this document" + ID_FILE_MRU_FILE2 "Open this document" + ID_FILE_MRU_FILE3 "Open this document" + ID_FILE_MRU_FILE4 "Open this document" + ID_FILE_MRU_FILE5 "Open this document" + ID_FILE_MRU_FILE6 "Open this document" + ID_FILE_MRU_FILE7 "Open this document" + ID_FILE_MRU_FILE8 "Open this document" + ID_FILE_MRU_FILE9 "Open this document" + ID_FILE_MRU_FILE10 "Open this document" + ID_FILE_MRU_FILE11 "Open this document" + ID_FILE_MRU_FILE12 "Open this document" + ID_FILE_MRU_FILE13 "Open this document" + ID_FILE_MRU_FILE14 "Open this document" + ID_FILE_MRU_FILE15 "Open this document" + ID_FILE_MRU_FILE16 "Open this document" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_NEXT_PANE "Switch to the next window pane\nNext Pane" + ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_WINDOW_NEW "Open another window for the active document\nNew Window" + ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons" + ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows" + ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows" + ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows" + ID_WINDOW_SPLIT "Split the active window into panes\nSplit" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_EDIT_CLEAR "Erase the selection\nErase" + ID_EDIT_CLEAR_ALL "Erase everything\nErase All" + ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy" + ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut" + ID_EDIT_FIND "Find the specified text\nFind" + ID_EDIT_PASTE "Insert Clipboard contents\nPaste" + ID_EDIT_REPEAT "Repeat the last action\nRepeat" + ID_EDIT_REPLACE "Replace specific text with different text\nReplace" + ID_EDIT_SELECT_ALL "Select the entire document\nSelect All" + ID_EDIT_UNDO "Undo the last action\tCTRL Z\nUndo (CTRL Z)" + ID_EDIT_REDO "Redo the previously undone action\tCTRL Y\nRedo (CTRL Y)" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar" + ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCSIZE "Change the window size" + AFX_IDS_SCMOVE "Change the window position" + AFX_IDS_SCMINIMIZE "Reduce the window to an icon" + AFX_IDS_SCMAXIMIZE "Enlarge the window to full size" + AFX_IDS_SCNEXTWINDOW "Switch to the next document window" + AFX_IDS_SCPREVWINDOW "Switch to the previous document window" + AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCRESTORE "Restore the window to normal size" + AFX_IDS_SCTASKLIST "Activate Task List" + AFX_IDS_MDICHILD "Activate this window" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_VIEW_ZOOM_IN "Zoom in active view\nZoom in (Ctrl+""+"")" + ID_VIEW_ZOOM_OUT "Zoom out active view\nZoom out (Ctrl+""-"")" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_EXPORT "Export the active document\nExport (Ctrl+E)" + ID_VIEW_AUTO_ARRANGE "Auto arrange operators in the layout\tAuto arrange (Ctrl+A)" + ID_VIEW_TILE "Tile the bitmap view\nTile (Ctrl+T)" + ID_VIEW_ALPHA "View the bitmap alpha\nAlpha (F4)" + ID_VIEW_RGB "View the bitmap rgb\nRGB (F3)" + ID_VIEW_OPERATOR "View the current operator\nOperator (F2)" + ID_VIEW_LAYER_RESULT "View the layer result\nLayer result (Ctrl+L)" + ID_VIEW_MENUBAR "Show or hide the menubar\nToggle MenuBar" + ID_VIEW_FULLSCREEN "Toggle Full Screen Mode\nToggle Full Screen Mode" + ID_VIEW_FULL_SCREEN "Toggle Full Screen Mode\nToggle Full Screen Mode" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_EDIT_DELETE "Delete the current selection\nDelete (Delete)" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// French (France) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\app.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BUTTON_MASK BITMAP DISCARDABLE "res\\button_mask.bmp" +IDB_BUTTON_HOLE BITMAP DISCARDABLE "res\\button_hole.bmp" +IDB_BUTTON_HOLE_MASK BITMAP DISCARDABLE "res\\button_hole_mask.bmp" +IDB_BUTTON BITMAP DISCARDABLE "res\\button.bmp" +IDB_LINEAR BITMAP DISCARDABLE "res\\bitmap1.bmp" +IDB_QUADRATIC BITMAP DISCARDABLE "res\\quadrati.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_COLOR_PICKER DIALOGEX 0, 0, 350, 228 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Color Picker" +FONT 8, "MS Sans Serif" +BEGIN +END + +IDD_GRADIENT DIALOGEX 0, 0, 451, 47 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Gradient" +FONT 8, "MS Sans Serif" +BEGIN +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_COLOR_PICKER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 343 + TOPMARGIN, 7 + BOTTOMMARGIN, 221 + END + + IDD_GRADIENT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 444 + TOPMARGIN, 7 + BOTTOMMARGIN, 40 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif //_WIN32\r\n" + "#include ""res\\nel_tex_gen.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + ID_VIEW_FULLSCREEN "Toggle Full Screen Mode\nToggle Full Screen Mode" + ID_VIEW_FULL_SCREEN "Toggle Full Screen Mode\nToggle Full Screen Mode" +END + +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif //_WIN32 +#include "res\nel_tex_gen.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/tools/tex_gen_editor/nel_tex_gen.reg b/tools/tex_gen_editor/nel_tex_gen.reg new file mode 100644 index 0000000..410c4de --- /dev/null +++ b/tools/tex_gen_editor/nel_tex_gen.reg @@ -0,0 +1,14 @@ +REGEDIT +; This .REG file may be used by your SETUP program. +; If a SETUP program is not available, the entries below will be +; registered in your InitInstance automatically with a call to +; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll. + +HKEY_CLASSES_ROOT\.texgen = Neltexgen.Document +HKEY_CLASSES_ROOT\Neltexgen.Document\shell\open\command = NEL_TEX_GEN.EXE %1 +HKEY_CLASSES_ROOT\Neltexgen.Document\shell\open\ddeexec = [open("%1")] +HKEY_CLASSES_ROOT\Neltexgen.Document\shell\open\ddeexec\application = NEL_TEX_GEN + ; note: the application is optional + ; (it defaults to the app name in "command") + +HKEY_CLASSES_ROOT\Neltexgen.Document = NeL Tex Gen diff --git a/tools/tex_gen_editor/nel_tex_gen_doc.cpp b/tools/tex_gen_editor/nel_tex_gen_doc.cpp new file mode 100644 index 0000000..5fd89d2 --- /dev/null +++ b/tools/tex_gen_editor/nel_tex_gen_doc.cpp @@ -0,0 +1,879 @@ +// nel_tex_gen_doc.cpp : implementation of the CNelTexGenDoc class +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "action.h" + +#include "nel_tex_gen_doc.h" +#include "nel_tex_gen_view.h" + +#include "tex_gen/op_layer.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +#define MARGIN_OPERATOR 10 +#define SPACE_BETWEEN_OPERATORS 20 + +///////////////////////////////////////////////////////////////////////////// +// CNelTexGenDoc + +IMPLEMENT_DYNCREATE(CNelTexGenDoc, CDocument) + +BEGIN_MESSAGE_MAP(CNelTexGenDoc, CDocument) + //{{AFX_MSG_MAP(CNelTexGenDoc) + ON_COMMAND(ID_EDIT_REDO, OnEditRedo) + ON_UPDATE_COMMAND_UI(ID_EDIT_REDO, OnUpdateEditRedo) + ON_COMMAND(ID_EDIT_UNDO, OnEditUndo) + ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateEditUndo) + ON_COMMAND(ID_VIEW_ZOOM_IN, OnViewZoomIn) + ON_UPDATE_COMMAND_UI(ID_VIEW_ZOOM_IN, OnUpdateViewZoomIn) + ON_COMMAND(ID_VIEW_ZOOM_OUT, OnViewZoomOut) + ON_UPDATE_COMMAND_UI(ID_VIEW_ZOOM_OUT, OnUpdateViewZoomOut) + ON_COMMAND(ID_FILE_EXPORT, OnFileExport) + ON_COMMAND(ID_EDIT_DELETE, OnEditDelete) + ON_UPDATE_COMMAND_UI(ID_EDIT_DELETE, OnUpdateEditDelete) + ON_COMMAND(ID_VIEW_AUTO_ARRANGE, OnViewAutoArrange) + ON_COMMAND(ID_VIEW_TILE, OnViewTile) + ON_UPDATE_COMMAND_UI(ID_VIEW_TILE, OnUpdateViewTile) + ON_COMMAND(ID_VIEW_OPERATOR, OnViewOperator) + ON_UPDATE_COMMAND_UI(ID_VIEW_OPERATOR, OnUpdateViewOperator) + ON_COMMAND(ID_VIEW_ALPHA, OnViewAlpha) + ON_UPDATE_COMMAND_UI(ID_VIEW_ALPHA, OnUpdateViewAlpha) + ON_COMMAND(ID_VIEW_RGB, OnViewRgb) + ON_UPDATE_COMMAND_UI(ID_VIEW_RGB, OnUpdateViewRgb) + ON_COMMAND(ID_VIEW_LAYER_RESULT, OnViewLayerResult) + ON_UPDATE_COMMAND_UI(ID_VIEW_LAYER_RESULT, OnUpdateViewLayerResult) + //}}AFX_MSG_MAP + ON_COMMAND_RANGE(ID_EDIT_ADD_OPERATOR, (ID_EDIT_ADD_OPERATOR+100), OnAddOperator) +END_MESSAGE_MAP() + +// *************************************************************************** +// CNelTexGenDoc construction/destruction +// *************************************************************************** + +CNelTexGenDoc::CNelTexGenDoc() +{ + // TODO: add one-time construction code here + _OperatorIndex = 0; + _BitmapModified = true; + _GraphModified = true; + _Tile = false; + _LayerResult = true; + _ViewMode = ViewModeOperator; +} + +// *************************************************************************** + +uint CNelTexGenDoc::addInternal (NLTEXGEN::ITexGenOperator *op, int index) +{ + if (index == -1) + index = _OperatorIndex++; + _OperatorMap.insert (TOpMap::value_type(op, index)); + _OperatorMapInv.insert (TOpMapInv::value_type(index, op)); + op->Selected = false; + + modifyOperator (op, true); + return index; +} + +// *************************************************************************** + +uint CNelTexGenDoc::add (NLTEXGEN::ITexGenOperator *op, int index) +{ + index = addInternal (op, index); + NeLDoc.Operators.push_back (op); + return index; +} + +// *************************************************************************** + +void CNelTexGenDoc::remove (NLTEXGEN::ITexGenOperator *op) +{ + // Unselect + setSelection(op, false); + + // Remove from view + POSITION pos = GetFirstViewPosition(); + while (pos != NULL) + { + CNelTexGenView *pView = (CNelTexGenView*)GetNextView(pos); + pView->removeOperator(op); + } + + TOpMap::iterator ite = _OperatorMap.find (op); + nlassert (ite != _OperatorMap.end()); + _OperatorMapInv.erase (ite->second); + _OperatorMap.erase (ite); + _ModifiedOperators.erase (op); + + // Remove from nel array + uint i; + for (i=0; iredo(this)) + { + // Action added + bool added = false; + + // Action is not accumulative ? + if (!_Modifications.empty()) + { + // The same type ? + class IAction *back = _Modifications.back(); + if (typeid(*back) == typeid(*action)) + { + if (action->accum(*back)) + { + // Replace the last one + delete (back); + _Modifications.back() = action; + added = true; + } + } + } + + if (!added) + { + // Add a new modification + _Modifications.push_back(action); + } + } + else + { + delete action; + } +} + +// *************************************************************************** + +void CNelTexGenDoc::endModification() +{ + // If modification array not empty + if (!_Modifications.empty()) + { + // Add to undo list + _Undo.push_back (_Modifications); + + // End of modifications + _Modifications.clear (); + + // No more redo + erase(_Redo); + + // Modify the document + SetModifiedFlag (); + } +} + +// *************************************************************************** + +void CNelTexGenDoc::undo() +{ + // Something to undo ? + if (!_Undo.empty()) + { + TModifications &toUndo = _Undo.back(); + TModifications::reverse_iterator ite = toUndo.rbegin(); + while (ite != toUndo.rend()) + { + (*ite)->undo(this); + + ite++; + } + + // Add to redo + _Redo.push_back(toUndo); + _Undo.pop_back(); + + // Modify the document + SetModifiedFlag (); + } +} + +// *************************************************************************** + +void CNelTexGenDoc::redo() +{ + // Something to redo ? + if (!_Redo.empty()) + { + TModifications &toRedo = _Redo.back(); + TModifications::iterator ite = toRedo.begin(); + while (ite != toRedo.end()) + { + (*ite)->redo(this); + + ite++; + } + + // Add to redo + _Undo.push_back(toRedo); + _Redo.pop_back(); + + // Modify the document + SetModifiedFlag (); + } +} + +// *************************************************************************** + +void CNelTexGenDoc::OnEditRedo() +{ + redo(); + updateData(); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnUpdateEditRedo(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(_Redo.empty()?FALSE:TRUE); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnEditUndo() +{ + undo(); + updateData(); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnUpdateEditUndo(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(_Undo.empty()?FALSE:TRUE); +} + +// *************************************************************************** + +void CNelTexGenDoc::updateData () +{ + TOpSet::iterator ite = _ModifiedOperators.begin(); + while (ite != _ModifiedOperators.end()) + { + POSITION pos = GetFirstViewPosition(); + while (pos != NULL) + { + CNelTexGenView *pView = (CNelTexGenView*)GetNextView(pos); + pView->updateOperator(*ite); + } + ite++; + } + + // Clear the modified list + _ModifiedOperators.clear(); + + // Bitmap modified ? + if (_BitmapModified) + { + POSITION pos = GetFirstViewPosition(); + while (pos != NULL) + { + CNelTexGenView *pView = (CNelTexGenView*)GetNextView(pos); + pView->updateBitmap(); + } + + _BitmapModified = false; + } + + // Graph modified ? + if (_GraphModified) + { + POSITION pos = GetFirstViewPosition(); + while (pos != NULL) + { + CNelTexGenView *pView = (CNelTexGenView*)GetNextView(pos); + pView->updateGraph(); + } + _GraphModified = true; + } +} + +// *************************************************************************** + +void CNelTexGenDoc::modifyOperator (NLTEXGEN::ITexGenOperator *op, bool parent) +{ + _ModifiedOperators.insert(op); + if (parent) + { + const vector parentOp = op->getParents(); + uint i; + for (i=0; iupdateOperator(ite->first); + ite++; + } + + // Update the bitmap + view->updateBitmap(); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnViewZoomIn() +{ + POSITION pos = GetFirstViewPosition(); + while (pos != NULL) + { + CNelTexGenView *pView = (CNelTexGenView*)GetNextView(pos); + pView->zoomIn(true); + } +} + +// *************************************************************************** + +void CNelTexGenDoc::OnUpdateViewZoomIn(CCmdUI* pCmdUI) +{ +} + +// *************************************************************************** + +void CNelTexGenDoc::OnViewZoomOut() +{ + POSITION pos = GetFirstViewPosition(); + while (pos != NULL) + { + CNelTexGenView *pView = (CNelTexGenView*)GetNextView(pos); + pView->zoomOut(true); + } +} + +// *************************************************************************** + +void CNelTexGenDoc::OnUpdateViewZoomOut(CCmdUI* pCmdUI) +{ +} + +// *************************************************************************** + +afx_msg void CNelTexGenDoc::OnAddOperator(UINT nID) +{ + // Add an operator + const COperatorDesc &desc = theApp.getOperators()[nID-ID_EDIT_ADD_OPERATOR]; + addModification(new CActionAddOperator(&desc, MenuPos.x, MenuPos.y)); + endModification(); + updateData(); +} + +// *************************************************************************** + +BOOL CNelTexGenDoc::OnOpenDocument(LPCTSTR lpszPathName) +{ + // File object + CIFile file; + if (file.open (lpszPathName)) + { + try + { + // Read the document + NeLDoc.serial (file); + + // Add the operators + uint i; + for (i=0; iX = 10; + NeLDoc.Operators[i]->Y = 10; + addInternal (NeLDoc.Operators[i]); + } + + // Place operators + placeOperators (); + + return TRUE; + } + catch (Exception &e) + { + theApp.errorMessage (e.what()); + } + } + else + { + theApp.errorMessage ("Can't open the file %s for reading", lpszPathName); + } + + return FALSE; +} + +// *************************************************************************** + +BOOL CNelTexGenDoc::OnSaveDocument(LPCTSTR lpszPathName) +{ + // File object + COFile file; + if (file.open (lpszPathName)) + { + try + { + // Read the document + NeLDoc.serial (file); + + // Doc no more modified + SetModifiedFlag (FALSE); + + return TRUE; + } + catch (Exception &e) + { + theApp.errorMessage (e.what()); + } + } + else + { + theApp.errorMessage ("Can't open the file %s for writing", lpszPathName); + } + + return FALSE; +} + +// *************************************************************************** + +void CNelTexGenDoc::placeOperatorY (ITexGenOperator *op, sint &y) +{ + op->Y = max (y, (sint)op->Y); + y = op->Y; + + // For each children + const std::vector &binded = op->getBindedOp(); + uint i; + for (i=0; iX = 0; + NeLDoc.Operators[i]->Y = 0; + } + + sint y = 0; + for (i=0; igetParents().size() == 0) + placeOperatorY (NeLDoc.Operators[i], y); + } + + // Set X + uint8 firstX[256]; + memset (firstX, 0, 256); + set placed; + for (i=0; igetParents().size() == 0) + placeOperatorX (NeLDoc.Operators[i], firstX, 0); + } + + // Set Y + for (i=0; iY = (SPACE_BETWEEN_OPERATORS+OPERATOR_WIN_HEIGHT) * NeLDoc.Operators[i]->Y + MARGIN_OPERATOR; + } +} + +// *************************************************************************** + +void CNelTexGenDoc::placeOperatorX (ITexGenOperator *op, uint8 *firstX, uint xParent) +{ + // Compute the x coordinate + sint y = op->Y; + sint x = std::max ((sint)firstX[y], (sint)xParent); + firstX[y] = x+1; + op->X = (SPACE_BETWEEN_OPERATORS+OPERATOR_WIN_WIDTH) * x + MARGIN_OPERATOR; + + // For each children + const std::vector &binded = op->getBindedOp(); + uint i; + for (i=0; iX == 0)) + { + placeOperatorX (binded[i], firstX, xParent++); + } + } + y++; +} + +// *************************************************************************** + +void CNelTexGenDoc::OnFileExport() +{ + // Eval the document + CFloatBitmap floatBitmap; + CRenderParameter renderParameters (true, false, false); + NeLDoc.Operators[0]->eval (floatBitmap, renderParameters); + NLMISC::CBitmap bitmap; + floatBitmap.export (bitmap); + ((COpRoot*)NeLDoc.Operators[0])->evalAlpha (floatBitmap, renderParameters); + floatBitmap.exportAlpha (bitmap); + + // Save the document + static char BASED_CODE szFilter[] = "Targa Files (*.tga)|*.tga|All Files (*.*)|*.*||"; + + string docName = (const char*)GetPathName (); + docName = NLMISC::CFile::getFilenameWithoutExtension(docName); + + CFileDialog outputFile ( FALSE, "tga", (docName+".tga").c_str(), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, theApp.m_pMainWnd); + if (outputFile.DoModal() == IDOK) + { + // Save the file + COFile file; + if (file.open ((const char*)outputFile.GetPathName())) + { + try + { + // Write the bitmap + bitmap.writeTGA (file, 32); + } + catch (Exception &e) + { + theApp.errorMessage (e.what()); + } + } + else + { + theApp.errorMessage ("Can't open the file %s for writing", (const char*)outputFile.GetPathName()); + } + } +} + +// *************************************************************************** + +void CNelTexGenDoc::unSelectAll() +{ + uint i; + for (i=0; iSelected != select) + { + op->Selected = select; + + // Notify view + POSITION pos = GetFirstViewPosition(); + while (pos != NULL) + { + CNelTexGenView *pView = (CNelTexGenView*)GetNextView(pos); + pView->selectionChange(op); + modifyBitmap (); + } + } +} + +// *************************************************************************** + +void CNelTexGenDoc::OnEditDelete() +{ + // Delete the operators + uint i; + for (i=1; iSelected) + { + // Id + uint id = getOperatorId (NeLDoc.Operators[i]); + + // Unlink from parent + std::vector &parents = NeLDoc.Operators[i]->getParents (); + while (parents.size()) + { + addModification(new CActionUnlink (getOperatorId (parents[0]), parents[0]->whereIsBindOp(NeLDoc.Operators[i]), id)); + } + + // Unlink children + uint j; + const std::vector &children = NeLDoc.Operators[i]->getBindedOp(); + for (j=0; jwhereIsBindOp(children[j]), getOperatorId (children[j]))); + } + + addModification(new CActionDeleteOperator (id, this)); + } + } + + // One undo step + endModification(); + + // Update data + updateData(); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnUpdateEditDelete(CCmdUI* pCmdUI) +{ + // TODO: Add your command update UI handler code here + pCmdUI->Enable(isSomethingDeletableSelected()); +} + +// *************************************************************************** + +bool CNelTexGenDoc::isSomethingDeletableSelected() const +{ + uint i; + for (i=1; iSelected) + return true; + } + return false; +} + +// *************************************************************************** + +void CNelTexGenDoc::OnViewAutoArrange() +{ + placeOperators (); + + // Update data + updateOperatorsView (); +} + +// *************************************************************************** + +void CNelTexGenDoc::updateOperatorsView () +{ + uint i; + for (i=0; iupdateOperator(NeLDoc.Operators[i]); + } + } +} + +// *************************************************************************** + +void CNelTexGenDoc::OnViewTile() +{ + _Tile ^= true; + POSITION pos = GetFirstViewPosition(); + while (pos != NULL) + { + CNelTexGenView *pView = (CNelTexGenView*)GetNextView(pos); + pView->invalidateBitmap (); + } +} + +// *************************************************************************** + +void CNelTexGenDoc::OnUpdateViewTile(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck (_Tile?1:0); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnViewRgb() +{ + _ViewMode = ViewModeRGB; + modifyBitmap (); + updateData (); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnUpdateViewRgb(CCmdUI* pCmdUI) +{ + pCmdUI->SetRadio (_ViewMode == ViewModeRGB); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnViewAlpha() +{ + _ViewMode = ViewModeAlpha; + modifyBitmap (); + updateData (); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnUpdateViewAlpha(CCmdUI* pCmdUI) +{ + pCmdUI->SetRadio (_ViewMode == ViewModeAlpha); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnViewOperator() +{ + _ViewMode = ViewModeOperator; + modifyBitmap (); + updateData (); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnUpdateViewOperator(CCmdUI* pCmdUI) +{ + pCmdUI->SetRadio (_ViewMode == ViewModeOperator); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnViewLayerResult() +{ + _LayerResult ^= true; + POSITION pos = GetFirstViewPosition(); + while (pos != NULL) + { + CNelTexGenView *pView = (CNelTexGenView*)GetNextView(pos); + pView->updateBitmap (); + } + updateOperatorsView (); +} + +// *************************************************************************** + +void CNelTexGenDoc::OnUpdateViewLayerResult(CCmdUI* pCmdUI) +{ + if (_ViewMode == ViewModeOperator) + { + ITexGenOperator *op = NULL; + uint i; + for (i=0; iSelected) + { + op = NeLDoc.Operators[i]; + break; + } + } + + if (!op) + op = NeLDoc.Operators[0]; + + pCmdUI->Enable (dynamic_cast(op) != NULL); + } + else + pCmdUI->Enable (FALSE); + pCmdUI->SetCheck (_LayerResult?1:0); +} + +// *************************************************************************** diff --git a/tools/tex_gen_editor/nel_tex_gen_doc.h b/tools/tex_gen_editor/nel_tex_gen_doc.h new file mode 100644 index 0000000..c692688 --- /dev/null +++ b/tools/tex_gen_editor/nel_tex_gen_doc.h @@ -0,0 +1,198 @@ +// nel_tex_gen_doc.h : interface of the CNelTexGenDoc class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_NEL_TEX_GEN_DOC_H__929F0A1B_F137_4189_A73B_70FFBEEC3C0C__INCLUDED_) +#define AFX_NEL_TEX_GEN_DOC_H__929F0A1B_F137_4189_A73B_70FFBEEC3C0C__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "tex_gen/op_root.h" +#include "tex_gen/tex_gen_document.h" +#include "action.h" + +class CNelTexGenDoc : public CDocument +{ + friend CActionEnable; + friend CActionAddOperator; + friend CActionDeleteOperator; + friend CActionLink; + friend CActionUnlink; + friend CActionSetParameterInt; + friend CActionSetParameterString; + friend CActionSetParameterFloat; + friend CActionSetParameterCRGBAF; + friend CActionSetParameterGradient; +public: + typedef std::map TOpMap; + + enum TViewMode + { + ViewModeOperator, + ViewModeRGB, + ViewModeAlpha, + }; + + // The nel tex gen document + NLTEXGEN::CTexGenDocument NeLDoc; + + // Tile output ? + bool getTile() const + { + return _Tile; + } + bool getLayerResult() const + { + return _LayerResult; + } + TViewMode getViewMode() const + { + return _ViewMode; + } + +protected: // create from serialization only + CNelTexGenDoc(); + DECLARE_DYNCREATE(CNelTexGenDoc) + + // Set of the operator + typedef std::map TOpMapInv; + uint32 _OperatorIndex; + TOpMap _OperatorMap; + TOpMapInv _OperatorMapInv; + uint add (NLTEXGEN::ITexGenOperator*, int index = -1); + void remove (NLTEXGEN::ITexGenOperator*); + +private: + uint addInternal (NLTEXGEN::ITexGenOperator *op, int index = -1); + void placeOperators (); + void placeOperatorY (NLTEXGEN::ITexGenOperator *op, sint &y); + void placeOperatorX (NLTEXGEN::ITexGenOperator *op, uint8 *firstX, uint xParent); +protected: + NLTEXGEN::ITexGenOperator *getOperator(uint opId) + { + TOpMapInv::iterator ite = _OperatorMapInv.find (opId); + nlassert (ite != _OperatorMapInv.end()); + return ite->second; + } + + + // \name Modification + typedef std::set TOpSet; + typedef std::vector TModifications; + typedef std::list > TUndoList; + TModifications _Modifications; + TUndoList _Undo; + TUndoList _Redo; + TOpSet _ModifiedOperators; + void erase (TModifications &modif); + void erase (TUndoList &modif); + void modifyOperator (NLTEXGEN::ITexGenOperator *op, bool parent); + void modifyBitmap () { _BitmapModified = true; } + void modifyGraph () { _GraphModified = true; modifyBitmap (); } + bool _BitmapModified; + bool _GraphModified; + bool _Tile; + bool _LayerResult; + TViewMode _ViewMode; +// Attributes +public: + +// Operations +public: + + // \name Modification + void addModification(class IAction *action); + void endModification(); + void undo(); + void redo(); + void updateData (); + void updateOperatorsView (); + + // \name Selection + void unSelectAll(); + void setSelection(NLTEXGEN::ITexGenOperator *op, bool select); + bool isSomethingDeletableSelected() const; + + // Get the operator set + /* const TOpMap &getOperatorMap() const + { + return _OperatorMap; + }*/ + + // Get the operator id + uint getOperatorId(const NLTEXGEN::ITexGenOperator *op) + { + TOpMap::iterator ite = _OperatorMap.find ((NLTEXGEN::ITexGenOperator*)op); + nlassert (ite != _OperatorMap.end()); + return ite->second; + } + + // Get the operator with the id + const NLTEXGEN::ITexGenOperator *getOperator(uint opId) const + { + TOpMapInv::const_iterator ite = _OperatorMapInv.find (opId); + nlassert (ite != _OperatorMapInv.end()); + return ite->second; + } + + // Update the view + void updateView(class CNelTexGenView *view); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CNelTexGenDoc) + public: + virtual BOOL OnNewDocument(); + virtual BOOL OnOpenDocument(LPCTSTR lpszPathName); + virtual BOOL OnSaveDocument(LPCTSTR lpszPathName); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CNelTexGenDoc(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: +public: + //{{AFX_MSG(CNelTexGenDoc) + afx_msg void OnEditRedo(); + afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI); + afx_msg void OnEditUndo(); + afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI); + afx_msg void OnViewZoomIn(); + afx_msg void OnUpdateViewZoomIn(CCmdUI* pCmdUI); + afx_msg void OnViewZoomOut(); + afx_msg void OnUpdateViewZoomOut(CCmdUI* pCmdUI); + afx_msg void OnFileExport(); + afx_msg void OnEditDelete(); + afx_msg void OnUpdateEditDelete(CCmdUI* pCmdUI); + afx_msg void OnViewAutoArrange(); + afx_msg void OnViewTile(); + afx_msg void OnUpdateViewTile(CCmdUI* pCmdUI); + afx_msg void OnViewOperator(); + afx_msg void OnUpdateViewOperator(CCmdUI* pCmdUI); + afx_msg void OnViewAlpha(); + afx_msg void OnUpdateViewAlpha(CCmdUI* pCmdUI); + afx_msg void OnViewRgb(); + afx_msg void OnUpdateViewRgb(CCmdUI* pCmdUI); + afx_msg void OnViewLayerResult(); + afx_msg void OnUpdateViewLayerResult(CCmdUI* pCmdUI); + //}}AFX_MSG + afx_msg void OnAddOperator(UINT nID); + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_NEL_TEX_GEN_DOC_H__929F0A1B_F137_4189_A73B_70FFBEEC3C0C__INCLUDED_) diff --git a/tools/tex_gen_editor/nel_tex_gen_view.cpp b/tools/tex_gen_editor/nel_tex_gen_view.cpp new file mode 100644 index 0000000..7fbd819 --- /dev/null +++ b/tools/tex_gen_editor/nel_tex_gen_view.cpp @@ -0,0 +1,749 @@ +// nel_tex_gen_view.cpp : implementation of the CNelTexGenView class +// + +#include "stdafx.h" +#include "nel_tex_gen.h" + +#include "nel_tex_gen_doc.h" +#include "nel_tex_gen_view.h" +#include "operator_win.h" +#include "tex_gen/tex_gen_op.h" +#include "tex_gen/op_layer.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +#define TANG_Y_MIN 50 +#define LINK_COLOR_COUNT 20 + +COLORREF LinkColors[LINK_COLOR_COUNT]= +{ + RGB (128, 0, 0), + RGB (128, 128, 0), + RGB (0, 128, 0), + RGB (0, 128, 128), + RGB (0, 0, 128), + RGB (128, 0, 128), + RGB (64, 0, 0), + RGB (64, 64, 0), + RGB (0, 64, 0), + RGB (0, 64, 64), + RGB (0, 0, 64), + RGB (64, 0, 64), + RGB (128, 64, 0), + RGB (0, 128, 64), + RGB (64, 0, 128), + RGB (64, 128, 0), + RGB (0, 64, 128), + RGB (128, 0, 64), +}; + +// *************************************************************************** +// CNelTexGenView +// *************************************************************************** + +IMPLEMENT_DYNCREATE(CNelTexGenView, CScrollView) + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CNelTexGenView, CScrollView) + //{{AFX_MSG_MAP(CNelTexGenView) + ON_WM_RBUTTONDOWN() + ON_WM_SHOWWINDOW() + ON_WM_SIZE() + ON_WM_ERASEBKGND() + ON_WM_LBUTTONDOWN() + ON_COMMAND(ID_EDIT_DELETE, OnEditDelete) + ON_UPDATE_COMMAND_UI(ID_EDIT_DELETE, OnUpdateEditDelete) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CNelTexGenView construction/destruction +// *************************************************************************** + +CNelTexGenView::CNelTexGenView() +{ + Vue = VueGraph; + nlverify(OperatorFont.CreateFont(12, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, NULL)); + _ZoomFactor = 0; +} + +// *************************************************************************** + +CNelTexGenView::~CNelTexGenView() +{ + uninit(); +} + +// *************************************************************************** + +BOOL CNelTexGenView::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + CMyCreateContext *pContext=(CMyCreateContext*)cs.lpCreateParams; + Vue = pContext->Vue; + if (Vue == VueGraph) + cs.style |= WS_CLIPCHILDREN; + + return CScrollView::PreCreateWindow(cs); +} + +// *************************************************************************** +// CNelTexGenView drawing +// *************************************************************************** + +void CNelTexGenView::updateOperator(NLTEXGEN::ITexGenOperator *op) +{ + if (Vue == VueGraph) + { + // Window exist ? + std::map::iterator iteMap = _OpWinMap.find(op); + if (iteMap == _OpWinMap.end()) + { + // Create a window + COperator opView; + opView.Win = new COperatorWin; + nlverify (opView.Win->Create (this, op) != FALSE); + opView.Win->SetFont(&OperatorFont); + + // Add one entry + iteMap = _OpWinMap.insert (std::map::value_type (op, opView)).first; + } + + iteMap->second.Win->updateData(op); + } +} + +// *************************************************************************** + +void CNelTexGenView::removeOperator(NLTEXGEN::ITexGenOperator *op) +{ + std::map::iterator ite = _OpWinMap.find (op); + if (ite != _OpWinMap.end()) + { + // Clear the window + ite->second.erase(); + + // Remove the iterator from the map + _OpWinMap.erase(ite); + } +} + +// *************************************************************************** + +void toVector (CVector &vect, const CPoint &point) +{ + vect.x = (float)point.x; + vect.y = (float)point.y; +} + +// *************************************************************************** + +void CNelTexGenView::OnDraw(CDC* pDC) +{ + CNelTexGenDoc* pDoc = GetDocument(); + ASSERT_VALID(pDoc); + + CPoint scrollPos = GetDeviceScrollPosition(); + + if (Vue == VueGraph) + { + // Need to delete a drag ? + if (DragValid) + { + CPen pen(PS_SOLID, 1, GetSysColor(COLOR_WINDOW)); + pDC->SelectObject(&pen); + drawBezier (*pDC, DragBezier[0], DragBezier[1], DragBezier[2], DragBezier[3], 5); + DragValid = false; + } + + // Need a bezier for drag ? + if (Drag[0] || Drag[1]) + { + POINT p0, p1, p2, p3; + + if (Drag[0]) + Drag[0]->getBezierPos(p0); + else + { + p0 = DragPos; + } + if (Drag[1]) + Drag[1]->getBezierPos(p3); + else + { + p3 = DragPos; + } + getBezierTang (p0, p1, p2, p3); + + ScreenToClient(&p0); + ScreenToClient(&p1); + ScreenToClient(&p2); + ScreenToClient(&p3); + p0.x += scrollPos.x; + p0.y += scrollPos.y; + p1.x += scrollPos.x; + p1.y += scrollPos.y; + p2.x += scrollPos.x; + p2.y += scrollPos.y; + p3.x += scrollPos.x; + p3.y += scrollPos.y; + toVector (DragBezier[0], p0); + toVector (DragBezier[1], p1); + toVector (DragBezier[2], p2); + toVector (DragBezier[3], p3); + + CPen pen(PS_SOLID, 1, RGB(0,0,0)); + pDC->SelectObject(&pen); + drawBezier (*pDC, DragBezier[0], DragBezier[1], DragBezier[2], DragBezier[3], 5); + DragValid = true; + } + + // Draw links + sint linkColor = 0; + std::map::const_iterator ite = _OpWinMap.begin(); + while (ite != _OpWinMap.end()) + { + const ITexGenOperator *op = ite->first; + uint i; + for (i=0; igetNumInputBitmap(); i++) + { + const CPortWnd *input = ite->second.Win->getInputPort (i); + if (input) + { + const ITexGenOperator *outputOp = op->getBindedOp(i); + if (outputOp) + { + std::map::const_iterator iteOutput = _OpWinMap.find((NLTEXGEN::ITexGenOperator*)outputOp); + nlassert (iteOutput != _OpWinMap.end()); + const CPortWnd *output = iteOutput->second.Win->getOutputPort (); + if (output) + { + POINT p0, p1, p2, p3; + CVector v[4]; + input->getBezierPos(p0); + output->getBezierPos(p3); + getBezierTang (p0, p1, p2, p3); + + ScreenToClient(&p0); + ScreenToClient(&p1); + ScreenToClient(&p2); + ScreenToClient(&p3); + p0.x += scrollPos.x; + p0.y += scrollPos.y; + p1.x += scrollPos.x; + p1.y += scrollPos.y; + p2.x += scrollPos.x; + p2.y += scrollPos.y; + p3.x += scrollPos.x; + p3.y += scrollPos.y; + toVector (v[0], p0); + toVector (v[1], p1); + toVector (v[2], p2); + toVector (v[3], p3); + + CPen pen(PS_SOLID, 2, LinkColors[(linkColor++)%LINK_COLOR_COUNT]); + pDC->SelectObject(&pen); + drawBezier (*pDC, v[0], v[1], v[2], v[3], 5); + } + } + } + } + ite++; + } + } + else + { + RECT client; + GetClientRect (&client); + int width = client.right-client.left; + int height = client.bottom-client.top; + + int bmWidth = (_ZoomFactor>0)?Texture.getWidth()<<_ZoomFactor:Texture.getWidth()>>-_ZoomFactor; + int bmHeight = (_ZoomFactor>0)?Texture.getHeight()<<_ZoomFactor:Texture.getHeight()>>-_ZoomFactor; + + int x = (width-(int)bmWidth)/2; + int y = (height-(int)bmHeight)/2; + if (width < (int)bmWidth) + x = 0; + if (height < (int)bmHeight) + y = 0; + + if (pDoc->getTile()) + { + sint yStart = (sint)y-(((y-1)/bmHeight)+1)*bmHeight; + sint xStart = (sint)x-(((x-1)/bmWidth)+1)*bmWidth; + while (yStart < client.bottom) + { + sint x2 = xStart; + while (x2 < client.right) + { + Texture.draw (pDC, x2, yStart, _ZoomFactor); + x2 += bmWidth; + } + yStart += bmHeight; + } + } + else + { + // Draw the bitmap + Texture.draw (pDC, x, y, _ZoomFactor); + } + } +} + +// *************************************************************************** +// CNelTexGenView diagnostics +// *************************************************************************** + +#ifdef _DEBUG +void CNelTexGenView::AssertValid() const +{ + CScrollView::AssertValid(); +} + +// *************************************************************************** + +void CNelTexGenView::Dump(CDumpContext& dc) const +{ + CScrollView::Dump(dc); +} + +// *************************************************************************** + +CNelTexGenDoc* CNelTexGenView::GetDocument() // non-debug version is inline +{ + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CNelTexGenDoc))); + return (CNelTexGenDoc*)m_pDocument; +} +#endif //_DEBUG + +// *************************************************************************** +// CNelTexGenView message handlers +// *************************************************************************** + +void CNelTexGenView::OnRButtonDown(UINT nFlags, CPoint point) +{ + if (Vue == VueGraph) + { + CNelTexGenDoc* pDoc = GetDocument(); + if ((nFlags & MK_CONTROL) == 0) + pDoc->unSelectAll(); + + MenuPos = point; + ClientToScreen (&point); + + // Check the sub menu + CExtPopupMenuWnd * pPopupWnd = new CExtPopupMenuWnd; + VERIFY(pPopupWnd->LoadMenu(*theApp.m_pMainWnd, IDR_VIEW_MENU)); + theApp.addOperatorsCreatorToMenu (*pPopupWnd); + VERIFY(pPopupWnd->TrackPopupMenu(0, point.x, point.y)); + } + + CScrollView::OnRButtonDown(nFlags, point); +} + +// *************************************************************************** + +void CNelTexGenView::OnVueGraph() +{ + Vue = VueGraph; +} + +// *************************************************************************** + +void CNelTexGenView::OnVueTexture() +{ + Vue = VueTexture; +} + +// *************************************************************************** + +void toPoint (CPoint &point, const CVector &vect) +{ + point.x = (int)floor(vect.x+0.5f); + point.y = (int)floor(vect.y+0.5f); +} + +// *************************************************************************** + +void drawBezier(CDC &dc, NLMISC::CVector &p0, NLMISC::CVector &p1, NLMISC::CVector &p2, NLMISC::CVector &p3, int steps) +{ + if (steps == 0) + { + CPoint p; + toPoint (p, p0); + dc.MoveTo(p); + toPoint (p, p1); + dc.LineTo(p); + toPoint (p, p2); + dc.LineTo(p); + toPoint (p, p3); + dc.LineTo(p); + } + else + { + CVector p01 = (p0+p1)/2; + CVector p12 = (p1+p2)/2; + CVector p23 = (p2+p3)/2; + CVector p0112 = (p01+p12)/2; + CVector p1223 = (p12+p23)/2; + CVector p01121223 = (p0112+p1223)/2; + drawBezier(dc, p0, p01, p0112, p01121223, steps-1); + drawBezier(dc, p01121223, p1223, p23, p3, steps-1); + } +} + +// *************************************************************************** + +void getBezierTang (const POINT &p0, POINT &p1, POINT &p2, const POINT &p3) +{ + p1.x = p0.x; + p1.y = (p3.y - p0.y) / 3; + if (p1.y < TANG_Y_MIN) + p1.y = TANG_Y_MIN; + p1.y += p0.y; + p2.x = p3.x; + p2.y = (p0.y - p3.y) / 3; + if (p2.y > -TANG_Y_MIN) + p2.y = -TANG_Y_MIN; + p2.y += p3.y; +} + +// *************************************************************************** + +void CNelTexGenView::init() +{ + if (Vue == VueGraph) + { + } + else if (Vue == VueTexture) + { + } +} + +// *************************************************************************** + +void CNelTexGenView::uninit() +{ +} + +// *************************************************************************** + +void CNelTexGenView::COperator::erase() +{ + Win->DestroyWindow(); +} + +// *************************************************************************** + +void CNelTexGenView::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CScrollView::OnShowWindow(bShow, nStatus); + +} + +// *************************************************************************** + +void CNelTexGenView::OnInitialUpdate() +{ + CScrollView::OnInitialUpdate(); + + uninit(); + init(); + + // Update from document + GetDocument()->updateView(this); +} + +// *************************************************************************** + +void CNelTexGenView::updateSize() +{ + if (Vue == VueTexture) + { + SIZE size; + + size.cx = (_ZoomFactor>0)?Texture.getWidth()<<_ZoomFactor:Texture.getWidth()>>-_ZoomFactor; + size.cy = (_ZoomFactor>0)?Texture.getHeight()<<_ZoomFactor:Texture.getHeight()>>-_ZoomFactor; + + /* RECT rect; + Texture.GetWindowRect(&rect); + ScreenToClient(&rect); + + POINT pt; + pt.x = -rect.left; + pt.y = -rect.top; */ + + // Update view size + SetScrollSizes (MM_TEXT, size); + // ScrollToPosition (pt); + } + if (Vue == VueGraph) + { + SIZE size; + size.cx = 0; + size.cy = 0; + std::map::iterator ite = _OpWinMap.begin(); + while (ite != _OpWinMap.end()) + { + // + RECT rect; + ite->second.Win->GetWindowRect (&rect); + ScreenToClient (&rect); + rect.right += 10; + rect.bottom += 10; + size.cx = std::max(rect.right, size.cx); + size.cy = std::max(rect.bottom, size.cy); + + ite++; + } + + // Update view size + SetScrollSizes (MM_TEXT, size); + } +} + +// *************************************************************************** + +void CNelTexGenView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) +{ + updateSize(); +} + +// *************************************************************************** + +void CNelTexGenView::OnSize(UINT nType, int cx, int cy) +{ + CScrollView::OnSize(nType, cx, cy); + + // centerTexture(); +} + +// *************************************************************************** +/* +void CNelTexGenView::centerTexture() +{ + RECT client; + GetClientRect(&client); + + // Texture ? + if (Vue == VueTexture) + { + } +}*/ + +// *************************************************************************** + +BOOL CNelTexGenView::OnEraseBkgnd(CDC* pDC) +{ + // TODO: Add your message handler code here and/or call default + //if (Vue == VueGraph) + return CScrollView::OnEraseBkgnd(pDC); + /*else + return FALSE;*/ +} + +// *************************************************************************** + +void CNelTexGenView::invalidateBitmap() +{ + if (Vue == VueTexture) + { + Invalidate (); + } +} + +// *************************************************************************** + +void CNelTexGenView::updateBitmap() +{ + if (Vue == VueTexture) + { + NLTEXGEN::CFloatBitmap bitmap; + CRenderParameter renderParameters (true, Draft, false); + + // Get the first selected operator + CNelTexGenDoc* pDoc = GetDocument(); + + bool alphaPremultiplied = false; + + if (pDoc->getViewMode() == CNelTexGenDoc::ViewModeOperator) + { + uint i; + ITexGenOperator *op = NULL; + for (i=0; iNeLDoc.Operators.size(); i++) + { + if (pDoc->NeLDoc.Operators[i]->Selected) + { + op = pDoc->NeLDoc.Operators[i]; + break; + } + } + + if (!op) + op = pDoc->NeLDoc.Operators[0]; + + // Update the texture + + // Eval the bitmap with cache + op->eval (bitmap, renderParameters); + + // Layer ? + IOpLayer *layer = dynamic_cast(op); + if (!pDoc->getLayerResult() && layer) + { + bitmap.ghostCopy (&(layer->getCachedLayer())); + alphaPremultiplied = layer->outputMask(); + } + } + else + { + if (pDoc->getViewMode() == CNelTexGenDoc::ViewModeRGB) + pDoc->NeLDoc.Operators[0]->eval (bitmap, renderParameters); + else + ((COpRoot*)(pDoc->NeLDoc.Operators[0]))->evalAlpha (bitmap, renderParameters); + } + + // Set the texture size + Texture.setPixels (bitmap, (pDoc->getViewMode() == CNelTexGenDoc::ViewModeAlpha) ? CDibWnd::Alpha : alphaPremultiplied ? CDibWnd::AlphaPremultiplied : CDibWnd::Normal); + Invalidate(); + + // Update size + updateSize(); + // centerTexture(); + } +} + +// *************************************************************************** + +void CNelTexGenView::updateGraph() +{ + if (Vue == VueGraph) + { + Invalidate(); + } +} + +// *************************************************************************** + +void CNelTexGenView::zoomIn(bool resizeLayout) +{ + if (Vue == VueTexture) + { + if (_ZoomFactor < 6) + { + _ZoomFactor++; + Invalidate(); + updateSize(); + } + } +} + +// *************************************************************************** + +void CNelTexGenView::zoomOut(bool resizeLayout) +{ + if (Vue == VueTexture) + { + _ZoomFactor--; + Invalidate(); + updateSize(); + } +} + +// *************************************************************************** + +void CNelTexGenView::validateChildren() +{ + std::map::iterator ite = _OpWinMap.begin(); + while (ite != _OpWinMap.end()) + { + RECT rect; + ite->second.Win->GetWindowRect (&rect); + ScreenToClient(&rect); + ValidateRect(&rect); + ite++; + } +} + +// *************************************************************************** + +CPortWnd *CNelTexGenView::getPort (const POINT &point) +{ + std::map::const_iterator ite = _OpWinMap.begin(); + while (ite != _OpWinMap.end()) + { + CPortWnd *port; + if (port = ite->second.Win->getPort (point)) + return port; + ite++; + } + return NULL; +} + +// *************************************************************************** + +COperatorWin *CNelTexGenView::getOperatorWin (const NLTEXGEN::ITexGenOperator *op) +{ + std::map::iterator ite = _OpWinMap.find((NLTEXGEN::ITexGenOperator*)op); + nlassert(ite != _OpWinMap.end()); + return ite->second.Win; +} + +// *************************************************************************** + +void CNelTexGenView::selectionChange(const NLTEXGEN::ITexGenOperator *op) +{ + if (Vue == VueGraph) + { + class COperatorWin *opWin = getOperatorWin (op); + opWin->Invalidate(); + } +} + +// *************************************************************************** + +void CNelTexGenView::OnLButtonDown(UINT nFlags, CPoint point) +{ + if (Vue == VueGraph) + { + CNelTexGenDoc* pDoc = GetDocument(); + if ((nFlags & MK_CONTROL) == 0) + pDoc->unSelectAll(); + + pDoc->updateData(); + } + + CScrollView::OnLButtonDown(nFlags, point); +} + +// *************************************************************************** + +void CNelTexGenView::OnEditDelete() +{ + CNelTexGenDoc* pDoc = GetDocument(); + pDoc->OnEditDelete(); +} + +// *************************************************************************** + +void CNelTexGenView::OnUpdateEditDelete(CCmdUI* pCmdUI) +{ + CNelTexGenDoc* pDoc = GetDocument(); + pDoc->OnUpdateEditDelete(pCmdUI); +} + +// *************************************************************************** + +void CNelTexGenView::setTopMost (CWnd *wnd) +{ + //GetTopWindow() +} + +// *************************************************************************** diff --git a/tools/tex_gen_editor/nel_tex_gen_view.h b/tools/tex_gen_editor/nel_tex_gen_view.h new file mode 100644 index 0000000..231031c --- /dev/null +++ b/tools/tex_gen_editor/nel_tex_gen_view.h @@ -0,0 +1,166 @@ +// nel_tex_gen_view.h : interface of the CNelTexGenView class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_NEL_TEX_GEN_VIEW_H__DF56FC40_A0C1_4FE9_904C_583545DCF21C__INCLUDED_) +#define AFX_NEL_TEX_GEN_VIEW_H__DF56FC40_A0C1_4FE9_904C_583545DCF21C__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "bitmap_wnd.h" + +namespace NLTEXGEN +{ + class ITexGenOperator; +}; + +class CNelTexGenView : public CScrollView +{ + friend class CChildFrame; +protected: // create from serialization only + CNelTexGenView(); + DECLARE_DYNCREATE(CNelTexGenView) + +// Attributes +public: + class CNelTexGenDoc* GetDocument(); + + // Set operator window top + void setTopMost (CWnd *wnd); + + // Remove an operator + void removeOperator(NLTEXGEN::ITexGenOperator *op); + + // An operator as been modified + void updateOperator(NLTEXGEN::ITexGenOperator *op); + + // Update view size + void updateSize(); + + // Update the bitmap + void updateBitmap(); + + // Invalidate the bitmap view (do not recompute the bitmap) + void invalidateBitmap(); + + // Update the graph + void updateGraph(); + + // The selection state of an operator has changed + void selectionChange(const NLTEXGEN::ITexGenOperator *op); + + // Font used by the opertors + CFont OperatorFont; + + // Zoom + void zoomIn (bool resizeLayout); + void zoomOut (bool resizeLayout); + + enum TVue + { + VueTexture, + VueGraph, + }; + + // Validate all operator windows + void validateChildren(); + + // Hit test with ports + CPortWnd *getPort (const POINT &point); + + // Get the operator wnd + class COperatorWin *getOperatorWin (const NLTEXGEN::ITexGenOperator *op); + +// *************************************************************************** + + +private: + + TVue Vue; + + // Init / uninit the view + void init(); + void uninit(); + + // \name Graph part + class COperator + { + public: + class COperatorWin *Win; + + void erase(); + }; + + std::map _OpWinMap; + + // \name Texture part + + CDibWnd Texture; + + // void centerTexture (); + + // Zoom factor + sint _ZoomFactor; + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CNelTexGenView) + public: + virtual void OnDraw(CDC* pDC); // overridden to draw this view + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + virtual void OnInitialUpdate(); + protected: + virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CNelTexGenView(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + //{{AFX_MSG(CNelTexGenView) + afx_msg void OnRButtonDown(UINT nFlags, CPoint point); + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnEditDelete(); + afx_msg void OnUpdateEditDelete(CCmdUI* pCmdUI); + //}}AFX_MSG + afx_msg void OnVueGraph(); + afx_msg void OnVueTexture(); + DECLARE_MESSAGE_MAP() +}; + +class CMyCreateContext : public CCreateContext +{ +public: + CNelTexGenView::TVue Vue; +}; + +#ifndef _DEBUG // debug version in nel_tex_gen_view.cpp +inline CNelTexGenDoc* CNelTexGenView::GetDocument() + { return (CNelTexGenDoc*)m_pDocument; } +#endif + +void drawBezier(CDC &dc, NLMISC::CVector &p0, NLMISC::CVector &p1, NLMISC::CVector &p2, NLMISC::CVector &p3, int steps); +void getBezierTang (const POINT &p0, POINT &p1, POINT &p2, const POINT &p3); + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_NEL_TEX_GEN_VIEW_H__DF56FC40_A0C1_4FE9_904C_583545DCF21C__INCLUDED_) diff --git a/tools/tex_gen_editor/op_property_dlg.cpp b/tools/tex_gen_editor/op_property_dlg.cpp new file mode 100644 index 0000000..da0a6ec --- /dev/null +++ b/tools/tex_gen_editor/op_property_dlg.cpp @@ -0,0 +1,755 @@ +// op_property_dlg.cpp : implementation file +// + +#include "stdafx.h" +#include "action.h" +#include "nel_tex_gen.h" +#include "nel_tex_gen_view.h" +#include "nel_tex_gen_doc.h" +#include "operator_win.h" +#include "op_property_dlg.h" +#include "my_edit.h" +#include "color_box.h" +#include "gradient_rect_wnd.h" +#include "rot_button.h" +#include "tex_gen/tex_gen_op.h" + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +#define DIALOG_CLIENT_WIDTH 150 +#define DIALOG_MARGIN 4 +#define WIDGET_LEFT (DIALOG_MARGIN+GROUPBOX_WIDTH) +#define WIDGET_RIGHT (DIALOG_CLIENT_WIDTH-(DIALOG_MARGIN+GROUPBOX_WIDTH)) +#define WIDGET_SPACE 5 + +#define GROUPBOX_WIDTH 8 +#define GROUPBOX_HEIGHT 16 +#define GROUPBOX_HEIGHT_END 8 + +#define COMBO_HEIGHT 24 +#define COMBO_WINDOW_HEIGHT 200 + +#define LABEL_WIDTH 100 +#define LABEL_HEIGHT 16 + +#define COLOR_HEIGHT 16 + +#define SLIDER_HEIGHT 32 + +#define EDIT_WIDTH 50 +#define EDIT_HEIGHT 20 +#define EDIT_MULTI_LINE_HEIGHT 48 + +#define SPIN_WIDTH 16 + +#define CHECKBOX_HEIGHT 16 + +#define SPINNER_WIDTH 16 + +#define SPINNER_MIN 0 +#define SPINNER_MAX 1000 + +#define GRADIENT_HEIGHT 16 + +#define ROT_BUTTON_WIDTH 32 +#define ROT_BUTTON_HEIGHT 32 +#define ROT_BUTTON_LEFT_MARGIN 10 +#define ROT_BUTTON_LABEL_MARGIN 5 + +// *************************************************************************** +// COpPropertyDlg dialog +// *************************************************************************** + +COpPropertyDlg::COpPropertyDlg(CWnd* pParent /*=NULL*/) + : CDialog(COpPropertyDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(COpPropertyDlg) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + _Initialized = false; +} + +// *************************************************************************** + +COpPropertyDlg::~COpPropertyDlg() +{ + uint j; + for (j=0; jCreate (tmp.c_str(), WS_CHILD|SS_LEFT|SS_CENTERIMAGE|WS_VISIBLE, client, this); + label->SetFont (GetFont()); + Others.push_back(label); +} + +// *************************************************************************** + +void COpPropertyDlg::beginCategory(RECT &client) +{ + _CategoryTop = client.top; + client.top += GROUPBOX_HEIGHT; + client.left = WIDGET_LEFT; +} + +// *************************************************************************** + +void COpPropertyDlg::endCategory(RECT &client, const char *name) +{ + RECT clientBox; + clientBox.bottom = client.top+GROUPBOX_HEIGHT_END; + clientBox.top = _CategoryTop; + clientBox.left = DIALOG_MARGIN; + clientBox.right = DIALOG_CLIENT_WIDTH - DIALOG_MARGIN; + CExtBtnOnFlat *button = new CExtBtnOnFlat (); + string tmp = name; + tmp[0] = toupper (tmp[0]); + button->Create (tmp.c_str(), BS_GROUPBOX|WS_CHILD|WS_VISIBLE, clientBox, this, 0xffff); + button->SetFont (GetFont()); + Others.push_back(button); + client.top = clientBox.bottom; +} + +// *************************************************************************** + +BOOL COpPropertyDlg::Create (COperatorWin *opWindow, const NLTEXGEN::ITexGenOperator *op) +{ + // Save operator parameters + _OpWindow = opWindow; + _Op = op; + + // Create the dialog + if (CDialog::Create (IDD_OP_PROPERTY, theApp.m_pMainWnd)) + { + // The client RECT + RECT client; + GetClientRect (&client); + client.top = DIALOG_MARGIN; + client.left = DIALOG_MARGIN; + + // Create each widget + uint i; + std::string currentCategory; + for (i=0; i<_Op->getNumParameter(); i++) + { + // The parameter + const CParameter ¶m = _Op->getParameter(i); + + // New category ? + if ((i == 0) || (currentCategory != param.Category)) + { + if (i != 0) + endCategory (client, currentCategory.c_str ()); + currentCategory = param.Category; + beginCategory (client); + } + else + { + client.top += WIDGET_SPACE; + } + + + // Type ? + switch (param.Type) + { + case CParameter::TypeEnum: + { + if (param.EnumString) + { + // Add label + client.bottom = client.top + LABEL_HEIGHT; + client.right = client.left + LABEL_WIDTH; + addLabel(client, (param.Name+string(":")).c_str()); + + client.right = WIDGET_RIGHT; + client.top = client.bottom; + client.bottom = client.top + COMBO_WINDOW_HEIGHT; + CExtComboBox *comboBox = new CExtComboBox; + comboBox->Create (WS_TABSTOP|CBS_DROPDOWNLIST|WS_VISIBLE|WS_CHILD|WS_VSCROLL|CBS_DISABLENOSCROLL, client, this, i+FirstID); + client.bottom = client.top + COMBO_HEIGHT; + comboBox->SetFont (GetFont()); + Widgets.push_back(comboBox); + int j; + for (j=0; jAddString(param.EnumString[j]); + } + else + Widgets.push_back (NULL); + } + break; + case CParameter::TypeColor: + { + // Add label + client.bottom = client.top + LABEL_HEIGHT; + client.right = client.left + LABEL_WIDTH; + addLabel(client, (param.Name+string(":")).c_str()); + + client.top = client.bottom; + client.bottom += COLOR_HEIGHT; + client.right = WIDGET_RIGHT; + CColorBox *colorBox = new CColorBox; + colorBox->Create (WS_TABSTOP|WS_VISIBLE|WS_CHILD, client, this, i+FirstID); + colorBox->SetFont (GetFont()); + Widgets.push_back(colorBox); + } + break; + case CParameter::TypeGradient: + { + // Add label + client.bottom = client.top + LABEL_HEIGHT; + client.right = client.left + LABEL_WIDTH; + addLabel(client, (param.Name+string(":")).c_str()); + + client.right = WIDGET_RIGHT; + client.top = client.bottom; + client.bottom = client.top+GRADIENT_HEIGHT; + CGradientRectWnd *gradient = new CGradientRectWnd (true); + gradient->Create (WS_TABSTOP|WS_VISIBLE|WS_CHILD|/*WS_BORDER*/0, client, this, i+FirstID); + Widgets.push_back(gradient); + } + break; + /*case CParameter::TypeFloat: + { + // Add label + client.bottom = client.top + LABEL_HEIGHT; + client.right = client.left + LABEL_WIDTH; + addLabel(client, (param.Name+string(":")).c_str()); + + client.right = WIDGET_RIGHT; + client.top = client.bottom; + client.bottom = client.top+SLIDER_HEIGHT; + CSliderCtrl *slider = new CSliderCtrl; + slider->Create (WS_TABSTOP|TBS_HORZ|WS_VISIBLE|WS_CHILD, client, this, i+FirstID); + slider->SetRange(SPINNER_MIN, SPINNER_MAX); + slider->SetFont (GetFont()); + Widgets.push_back(slider); + } + break;*/ + case CParameter::TypeFloat: + { + client.right = client.left + ROT_BUTTON_WIDTH; + client.bottom = client.top+ROT_BUTTON_HEIGHT; + CRotButton *rotButton = new CRotButton; + rotButton->Create (WS_TABSTOP|WS_VISIBLE|WS_CHILD, client, this, i+FirstID); + rotButton->init (param.Setup); + Widgets.push_back(rotButton); + + // Add label + RECT clientBox = client; + clientBox.top --; + clientBox.left = clientBox.right + ROT_BUTTON_LEFT_MARGIN; + clientBox.bottom = clientBox.top + LABEL_HEIGHT; + clientBox.right = clientBox.left + LABEL_WIDTH; + addLabel(clientBox, (param.Name+string(":")).c_str()); + + clientBox = client; + clientBox.left = clientBox.right + ROT_BUTTON_LEFT_MARGIN; + clientBox.right = clientBox.left + EDIT_WIDTH; + clientBox.top = clientBox.bottom - EDIT_HEIGHT; + CMyEdit *edit = new CMyEdit; + edit->Create (/*WS_BORDER*/0|WS_TABSTOP|ES_LEFT|WS_VISIBLE|WS_CHILD, clientBox, this, i+FirstID); + edit->SetFont (GetFont()); + Others.push_back(edit); + rotButton->setEditBox (edit); + + clientBox.left = clientBox.right + ROT_BUTTON_LABEL_MARGIN; + clientBox.right = clientBox.left + LABEL_WIDTH; + clientBox.top = clientBox.bottom - EDIT_HEIGHT; + addLabel(clientBox, param.Setup.Unit); + } + break; + case CParameter::TypeInt: + { + // Add label + client.bottom = client.top + LABEL_HEIGHT; + client.right = client.left + LABEL_WIDTH; + addLabel(client, (param.Name+string(":")).c_str()); + + client.top = client.bottom; + client.bottom += EDIT_HEIGHT; + client.right = client.left+EDIT_WIDTH; + CMyEdit *edit = new CMyEdit; + edit->Create (/*WS_BORDER*/0|WS_TABSTOP|ES_LEFT|ES_NUMBER|WS_VISIBLE|WS_CHILD, client, this, i+FirstID); + edit->SetFont (GetFont()); + Widgets.push_back(edit); + + RECT clientBox = client; + clientBox.left = clientBox.right; + clientBox.right = clientBox.left+SPIN_WIDTH; + CSpinButtonCtrl *spin = new CSpinButtonCtrl; + spin->Create (/*WS_BORDER*/0|WS_TABSTOP|UDS_WRAP|UDS_ARROWKEYS|WS_VISIBLE|WS_CHILD, clientBox, this, i+FirstID); + spin->SetRange32( param.IntegerMin, param.IntegerMax); + Others.push_back(spin); + } + break; + case CParameter::TypeString: + { + // Add label + client.bottom = client.top + LABEL_HEIGHT; + client.right = client.left + LABEL_WIDTH; + addLabel(client, (param.Name+string(":")).c_str()); + + client.top = client.bottom; + client.bottom += param.Integer?EDIT_MULTI_LINE_HEIGHT:EDIT_HEIGHT; + client.right = WIDGET_RIGHT; + CExtEdit *edit; + if (param.Integer) + { + edit = new CExtEdit; + edit->Create (WS_VSCROLL|ES_OEMCONVERT|ES_MULTILINE|ES_WANTRETURN|WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL|ES_AUTOVSCROLL, client, this, i+FirstID); + } + else + { + edit = new CMyEdit; + edit->Create (/*WS_BORDER*/0|WS_TABSTOP|ES_LEFT|WS_VISIBLE|WS_CHILD, client, this, i+FirstID); + } + edit->SetFont (GetFont()); + Widgets.push_back(edit); + } + break; + case CParameter::TypeBool: + { + client.right = WIDGET_RIGHT; + client.bottom = client.top+CHECKBOX_HEIGHT; + CExtBtnOnFlat *edit = new CExtBtnOnFlat; + string tmp = param.Name; + tmp[0] = toupper (tmp[0]); + edit->Create (tmp.c_str(), WS_TABSTOP|BS_AUTOCHECKBOX|WS_VISIBLE|WS_CHILD, client, this, i+FirstID); + //edit->SetFlat (FALSE); + edit->SetFont (GetFont()); + Widgets.push_back(edit); + } + break; + default: + Widgets.push_back (NULL); + } + + client.top = client.bottom; + } + + if (_Op->getNumParameter()) + endCategory (client, currentCategory.c_str ()); + client.bottom = client.top + DIALOG_MARGIN; + client.top = 0; + client.left = 0; + client.right = DIALOG_CLIENT_WIDTH; + + // Resize the client window + RECT window; + RECT realClient; + GetWindowRect (&window); + GetClientRect (&realClient); + SetWindowPos (NULL, 0, 0, + (window.right-window.left)+(client.right-client.left)-(realClient.right-realClient.left), + (window.bottom-window.top)+(client.bottom-client.top)-(realClient.bottom-realClient.top), + SWP_NOMOVE|SWP_NOZORDER); + + _Initialized = true; + + // Set the name + updateData(); + + return TRUE; + } + return FALSE; +} + +// *************************************************************************** + +void COpPropertyDlg::updateData () +{ + // Operator name + SetWindowText (theApp.getOperatorName (const_cast(_Op)->getClassName().c_str())); + + // Update each widget + // Create each widget + uint i; + for (i=0; i<_Op->getNumParameter(); i++) + { + // The parameter + const CParameter ¶m = _Op->getParameter(i); + + // Type ? + if (Widgets[i]) + { + switch (param.Type) + { + case CParameter::TypeEnum: + { + if (param.EnumString) + { + CExtComboBox *comboBox = (CExtComboBox*)Widgets[i]; + comboBox->SetCurSel(param.Integer); + } + } + break; + case CParameter::TypeColor: + { + CColorBox *colorBox = (CColorBox*)Widgets[i]; + colorBox->setColor(getColorRef(param.Color)); + } + break; + case CParameter::TypeGradient: + { + CGradientRectWnd *gradientWnd = (CGradientRectWnd*)Widgets[i]; + gradientWnd->setGradient(param.Gradient); + } + break; + case CParameter::TypeFloat: + { + /* CSliderCtrl *spinner = (CSliderCtrl*)Widgets[i]; + spinner->SetPos((int)(param.Color[0]*(float)SPINNER_MAX)); */ + + CRotButton *rotButton = (CRotButton*)Widgets[i]; + rotButton->setValue (param.Value); + } + break; + case CParameter::TypeInt: + { + char number[100]; + Widgets[i]->GetWindowText (number, 100); + int oldValue = atoi(number); + if ((oldValue != param.Integer) || (number[0] == 0)) + { + itoa(param.Integer, number, 10); + Widgets[i]->SendMessage(WM_SETTEXT, 0, (LPARAM)number); + } + + uint j; + for (j=0; jGetDlgCtrlID() == (sint)(i + FirstID)) + { + CSpinButtonCtrl *spin = (CSpinButtonCtrl*)Others[j]; + spin->SetPos (param.Integer); + } + } + } + break; + case CParameter::TypeBool: + { + ((CExtBtnOnFlat*)(Widgets[i]))->SetCheck(param.Integer); + } + break; + case CParameter::TypeString: + { + CString text; + Widgets[i]->GetWindowText (text); + if ((const char*)text != param.StringValue) + { + Widgets[i]->SendMessage(WM_SETTEXT, 0, (LPARAM)param.StringValue.c_str()); + } + } + break; + } + } + } + + // Update + UpdateData (FALSE); +} + +// *************************************************************************** + +BOOL COpPropertyDlg::OnCommand(WPARAM wParam, LPARAM lParam) +{ + bool done = false; + + // Window initialized ? + if (_Initialized && IsWindow(_OpWindow->m_hWnd)) + { + // Get parameters + uint idWidget = (int) LOWORD(wParam)-FirstID; // identifier of combo box + HWND hwndWidget = (HWND) lParam; // handle to combo box + + // Change the document + CNelTexGenView *view = (CNelTexGenView*)(_OpWindow->GetParent()); + CNelTexGenDoc *doc = view->GetDocument(); + + switch (HIWORD(wParam)) + { + case CBN_SELCHANGE: + { + // Get current selection + int newSelection = ::SendMessage (hwndWidget, CB_GETCURSEL, 0, 0); + + // Add an action + int oldSelection = _Op->getParameter (idWidget).Integer; + + doc->addModification (new CActionSetParameterInt (doc->getOperatorId(_Op), idWidget, + oldSelection, newSelection)); + doc->endModification(); + doc->updateData(); + done = true; + } + break; + case COB_COLOR_CHANGED: + { + // Get current colors + CRGBAF newColor = getCRGBAF(((CColorBox*)(Widgets[idWidget]))->getColor()); + + // Add an action + const CParameter ¶m = _Op->getParameter (idWidget); + CRGBAF oldColor (param.Color[0], param.Color[1], param.Color[2], param.Color[3]); + + doc->addModification (new CActionSetParameterCRGBAF (doc->getOperatorId(_Op), idWidget, + oldColor, newColor)); + doc->updateData(); + done = true; + } + break; + case COB_COLOR_END: + { + doc->endModification(); + done = true; + } + break; + case GDR_GRADIENT_CHANGED: + { + // Get current colors + const std::vector &newGradient = + ((CGradientRectWnd*)(Widgets[idWidget]))->getGradient(); + + // Add an action + const CParameter ¶m = _Op->getParameter (idWidget); + const std::vector &oldGradient = param.Gradient; + + doc->addModification (new CActionSetParameterGradient (doc->getOperatorId(_Op), idWidget, + oldGradient, newGradient)); + doc->endModification(); + doc->updateData(); + done = true; + } + break; + case ROB_VALUE_CHANGED: + { + const CParameter ¶m = _Op->getParameter (idWidget); + float oldValue = param.Value; + float newValue = ((CRotButton*)(Widgets[idWidget]))->getValue(); + + doc->addModification (new CActionSetParameterFloat (doc->getOperatorId(_Op), Widgets[idWidget]->GetDlgCtrlID()-FirstID, + oldValue, newValue)); + doc->updateData(); + } + break; + case ROB_CAPTURED: + ((CFrameWnd*)(theApp.m_pMainWnd))->SetMessageText ("Hold Ctrl or Shift to disable the snap"); + break; + case ROB_RELEASED: + ((CFrameWnd*)(theApp.m_pMainWnd))->SetMessageText (""); + doc->endModification(); + break; + case EN_RETURN: + case EN_KILLFOCUS: + { + // Add an action + const CParameter ¶m = _Op->getParameter (idWidget); + if (param.Type == CParameter::TypeFloat) + { + // Get current colors + char number[100]; + ::GetWindowText (hwndWidget, number, 100); + + float newValue = (float)atof(number); + CRotButton *rot = (CRotButton*)(Widgets[idWidget]); + newValue = rot->angleToValue (rot->valueToAngle (newValue)); + + float oldValue = param.Value; + + doc->addModification (new CActionSetParameterFloat (doc->getOperatorId(_Op), idWidget, + oldValue, newValue)); + done = true; + } + else if (param.Type == CParameter::TypeInt) + { + // Get current colors + char number[100]; + ::GetWindowText (hwndWidget, number, 100); + int newValue = atoi(number); + + int oldValue = param.Integer; + + doc->addModification (new CActionSetParameterInt (doc->getOperatorId(_Op), idWidget, + oldValue, newValue)); + done = true; + } + else // if (param.Type == CParameter::TypeString) + { + if ((HIWORD(wParam) != EN_RETURN) || !param.Integer) + { + // Get current colors + CString newValue; + CExtEdit *edit = (CExtEdit*)(Widgets[idWidget]); + edit->GetWindowText (newValue); + string oldValue = param.StringValue; + + doc->addModification (new CActionSetParameterString (doc->getOperatorId(_Op), idWidget, + oldValue.c_str(), (const char*)newValue)); + done = true; + } + } + if (done) + { + doc->endModification(); + doc->updateData(); + } + } + break; + case BN_CLICKED: + { + if (idWidget < Widgets.size()) + { + const CParameter ¶m = _Op->getParameter (idWidget); + int oldValue = param.Integer; + int newValue = ((CExtBtnOnFlat*)(Widgets[idWidget]))->GetCheck(); + + doc->addModification (new CActionSetParameterInt (doc->getOperatorId(_Op), idWidget, + oldValue, newValue)); + doc->endModification(); + doc->updateData(); + done = true; + } + } + break; + } + } + + return done ? TRUE : CDialog::OnCommand(wParam, lParam); +} + +// *************************************************************************** + +BOOL COpPropertyDlg::PreTranslateMessage(MSG* pMsg) +{ + if (TranslateAccelerator(*(theApp.m_pMainWnd), DialogShortcut, pMsg)) + return TRUE; + + return CDialog::PreTranslateMessage(pMsg); +} + +// *************************************************************************** + +void COpPropertyDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + // Window initialized ? + if (_Initialized) + { + Draft = true; + nPos = ((CSliderCtrl*)pScrollBar)->GetPos(); + + // Change the document + CNelTexGenView *view = (CNelTexGenView*)(_OpWindow->GetParent()); + CNelTexGenDoc *doc = view->GetDocument(); + + // Get current colors + float newValue = (float)nPos/(float)SPINNER_MAX; + + // Add an action + const CParameter ¶m = _Op->getParameter (pScrollBar->GetDlgCtrlID()-FirstID); + + float oldValue = param.Value; + + ((CFrameWnd*)(theApp.m_pMainWnd))->SetMessageText + (((string)param.Name+" : "+toString(newValue)+(param.Setup.Unit?param.Setup.Unit:"")).c_str()); + + doc->addModification (new CActionSetParameterFloat (doc->getOperatorId(_Op), pScrollBar->GetDlgCtrlID()-FirstID, + oldValue, newValue)); + doc->updateData(); + } + + // CDialog::OnHScroll(nSBCode, nPos, pScrollBar); +} + +// *************************************************************************** + +BOOL COpPropertyDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) +{ + NMHDR *pNMHDR =(NMHDR*)lParam; + switch (pNMHDR->code) + { + case NM_RELEASEDCAPTURE: + { + if ((wParam<_Op->getNumParameter()) && (_Op->getParameter(wParam-FirstID).Type == CParameter::TypeFloat)) + { + Draft = false; + // Change the document + CNelTexGenView *view = (CNelTexGenView*)(_OpWindow->GetParent()); + CNelTexGenDoc *doc = view->GetDocument(); + + doc->endModification(); + doc->updateData(); + } + } + break; + } + + return CDialog::OnNotify(wParam, lParam, pResult); +} + +// *************************************************************************** + +void COpPropertyDlg::OnDestroy() +{ + CDialog::OnDestroy(); + + delete this; +} + +// *************************************************************************** + +void COpPropertyDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + // TODO: Add your message handler code here and/or call default + if (pScrollBar && (nSBCode==SB_THUMBPOSITION)) + { + CNelTexGenView *view = (CNelTexGenView*)(_OpWindow->GetParent()); + CNelTexGenDoc *doc = view->GetDocument(); + uint idWidget = pScrollBar->GetDlgCtrlID()-FirstID; + + // Add an action + const CParameter ¶m = _Op->getParameter (idWidget); + doc->addModification (new CActionSetParameterInt (doc->getOperatorId(_Op), idWidget, + param.Integer, nPos)); + + doc->updateData (); + } + CDialog::OnVScroll(nSBCode, nPos, pScrollBar); +} + +// *************************************************************************** diff --git a/tools/tex_gen_editor/op_property_dlg.h b/tools/tex_gen_editor/op_property_dlg.h new file mode 100644 index 0000000..44fc8d5 --- /dev/null +++ b/tools/tex_gen_editor/op_property_dlg.h @@ -0,0 +1,87 @@ +#if !defined(AFX_OP_PROPERTY_DLG_H__FE0FB30B_7E46_4EA4_8C14_4C12675BD77C__INCLUDED_) +#define AFX_OP_PROPERTY_DLG_H__FE0FB30B_7E46_4EA4_8C14_4C12675BD77C__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// op_property_dlg.h : header file +// + +#include "exdlgbase.h" + +namespace NLTEXGEN +{ + class ITexGenOperator; +} + +///////////////////////////////////////////////////////////////////////////// +// COpPropertyDlg dialog + +class COpPropertyDlg : public CDialog +{ +// Construction +public: + COpPropertyDlg(CWnd* pParent = NULL); // standard constructor + ~COpPropertyDlg(); // standard destructor + + enum + { + FirstID = 3 + }; + +// Dialog Data + //{{AFX_DATA(COpPropertyDlg) + enum { IDD = IDD_OP_PROPERTY }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + // Create the dialog + BOOL Create (class COperatorWin *opWindow, const NLTEXGEN::ITexGenOperator *op); + + // Add a label window + void addLabel(RECT &client, const std::string &str); + + // Category helpers + void beginCategory(RECT &client); + void endCategory(RECT &client, const char *name); + + // Update data of the dialog + void updateData (); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(COpPropertyDlg) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + //}}AFX_VIRTUAL + +// Implementation +protected: + + COperatorWin *_OpWindow; + const NLTEXGEN::ITexGenOperator *_Op; + bool _Initialized; + + // Top of the last category + int _CategoryTop; + + std::vector Widgets; + std::vector Others; + + // Generated message map functions + //{{AFX_MSG(COpPropertyDlg) + afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + afx_msg void OnDestroy(); + afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_OP_PROPERTY_DLG_H__FE0FB30B_7E46_4EA4_8C14_4C12675BD77C__INCLUDED_) diff --git a/tools/tex_gen_editor/operator_win.cpp b/tools/tex_gen_editor/operator_win.cpp new file mode 100644 index 0000000..eecea40 --- /dev/null +++ b/tools/tex_gen_editor/operator_win.cpp @@ -0,0 +1,434 @@ +// operator_win.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "action.h" +#include "operator_win.h" +#include "nel_tex_gen_view.h" +#include "nel_tex_gen_doc.h" +#include "tex_gen/tex_gen_op.h" +#include "tex_gen/op_root.h" +#include "op_property_dlg.h" + +#define OPERATOR_ENABLE_X 0 +#define OPERATOR_ENABLE_WIDTH 15 +#define OPERATOR_ENABLE_HEIGHT 17 +#define OPERATOR_ENABLE_Y (-1) + +#define OPERATOR_EDIT_WIDTH 83 +#define OPERATOR_EDIT_HEIGHT 17 +#define OPERATOR_EDIT_X 15 +#define OPERATOR_EDIT_Y (-1) + +#define OPERATOR_OUTPUT_WIDTH 17 +#define OPERATOR_OUTPUT_HEIGHT 17 +#define OPERATOR_OUTPUT_X 105 +#define OPERATOR_OUTPUT_Y (-1) + +#define OPERATOR_INPUT_WIDTH 17 +#define OPERATOR_INPUT_HEIGHT 17 +#define OPERATOR_INPUT_X 8 +#define OPERATOR_INPUT_Y 33 +#define OPERATOR_INPUT_SPACE 15 + +#define OPERATOR_INPUT_NAME_WIDTH 32 +#define OPERATOR_INPUT_NAME_HEIGHT 10 +#define OPERATOR_INPUT_NAME_X 0 +#define OPERATOR_INPUT_NAME_Y 23 + +#define OPERATOR_PREVIEW_WIDTH 48 +#define OPERATOR_PREVIEW_HEIGHT 48 +#define OPERATOR_PREVIEW_X 129 +#define OPERATOR_PREVIEW_Y 0 + +#define OPERATOR_TITLE_LEFT_MARGIN 4 + +using namespace std; +using namespace NLMISC; +using namespace NLTEXGEN; + +// *************************************************************************** +// COperatorWin +// *************************************************************************** + +COperatorWin::COperatorWin() +{ + _Moving = false; +} + +// *************************************************************************** + +COperatorWin::~COperatorWin() +{ +} + +// *************************************************************************** + +BOOL COperatorWin::Create (CWnd *parent, NLTEXGEN::ITexGenOperator *op) +{ + COpRoot *rootOp = dynamic_cast(op); + _Op = op; + LPCTSTR className = AfxRegisterWndClass (CS_DBLCLKS, 0, (HBRUSH)COLOR_WINDOW, 0); + RECT rect; + rect.top = op->Y; + rect.left = op->X; + rect.right = rect.left + OPERATOR_WIN_WIDTH; + rect.bottom = rect.top + OPERATOR_WIN_HEIGHT; + if (CWnd::Create(className, "", WS_BORDER|WS_OVERLAPPED|WS_VISIBLE, rect, parent, 0, NULL)) + { + SetFont(&(((CNelTexGenView*)GetParent())->OperatorFont)); + + // Create a check box + rect.left = OPERATOR_ENABLE_X; + rect.top = OPERATOR_ENABLE_Y; + rect.right = OPERATOR_ENABLE_X+OPERATOR_ENABLE_WIDTH; + rect.bottom = OPERATOR_ENABLE_Y+OPERATOR_ENABLE_HEIGHT; + + if (_Enable.Create("", BS_AUTOCHECKBOX|WS_CHILD|(rootOp?0:WS_VISIBLE), rect, this, EnableID)) + { + // Support output ? + if (typeid(*op) != typeid(COpRoot)) + { + rect.left = OPERATOR_OUTPUT_X; + rect.top = OPERATOR_OUTPUT_Y; + rect.right = OPERATOR_OUTPUT_X+OPERATOR_OUTPUT_WIDTH; + rect.bottom = OPERATOR_OUTPUT_Y+OPERATOR_OUTPUT_HEIGHT; + _Output.Create("", WS_VISIBLE|WS_CHILD, rect, this, OutputID, true, 0); + } + + uint i; + _NumInputs = std::min((uint)MAX_INPUT, op->getNumInputBitmap ()); + for (i=0; i<_NumInputs; i++) + { + rect.left = OPERATOR_INPUT_X + (OPERATOR_INPUT_WIDTH+OPERATOR_INPUT_SPACE) * i; + rect.top = OPERATOR_INPUT_Y; + rect.right = OPERATOR_INPUT_X+OPERATOR_INPUT_WIDTH + (OPERATOR_INPUT_WIDTH+OPERATOR_INPUT_SPACE) * i; + rect.bottom = OPERATOR_INPUT_Y+OPERATOR_INPUT_HEIGHT; + _Inputs[i].Create("", WS_VISIBLE|WS_CHILD, rect, this, InputID+i, false, i); + + rect.left = OPERATOR_INPUT_NAME_X + OPERATOR_INPUT_NAME_WIDTH * i; + rect.top = OPERATOR_INPUT_NAME_Y; + rect.right = rect.left + OPERATOR_INPUT_NAME_WIDTH; + rect.bottom = rect.top + OPERATOR_INPUT_NAME_HEIGHT; + string name = op->getInputBitmapDescriptor (i).Name; + name[0] = toupper (name[0]); + _InputsName[i].Create(name.c_str(), WS_VISIBLE|WS_CHILD|SS_CENTER, + rect, this, InputName+i); + _InputsName[i].SetFont(&(((CNelTexGenView*)GetParent())->OperatorFont)); + } + + // Create the dialog + _Dialog = new COpPropertyDlg; + if (_Dialog->Create (this, _Op)) + { + // Create the preview window + rect.left = OPERATOR_PREVIEW_X; + rect.top = OPERATOR_PREVIEW_Y; + rect.right = OPERATOR_PREVIEW_X + OPERATOR_PREVIEW_WIDTH; + rect.bottom = OPERATOR_PREVIEW_Y + OPERATOR_PREVIEW_HEIGHT; + _Preview.Create (WS_CHILD|WS_VISIBLE, rect, this, PreviewID, + const_cast(_Op), true); + return TRUE; + } + } + } + + return FALSE; +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(COperatorWin, CWnd) + //{{AFX_MSG_MAP(COperatorWin) + ON_WM_NCHITTEST() + ON_WM_MOVE() + ON_WM_NCLBUTTONDBLCLK() + ON_WM_DESTROY() + ON_WM_PAINT() + ON_WM_NCLBUTTONDOWN() + ON_WM_NCRBUTTONDOWN() + ON_WM_NCLBUTTONUP() + ON_WM_KEYDOWN() + ON_WM_MOVING() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// COperatorWin message handlers +// *************************************************************************** + +UINT COperatorWin::OnNcHitTest(CPoint point) +{ + CRect r; + GetClientRect(&r); + ClientToScreen(&r); + + if(r.PtInRect(point)) + return HTCAPTION ; + + return CWnd::OnNcHitTest(point); +} + +// *************************************************************************** + +void COperatorWin::OnMove(int x, int y) +{ + CWnd::OnMove(x, y); + + // Update parent size + // ((CNelTexGenView*)GetParent())->updateSize(); + + GetParent()->Invalidate(TRUE); + + // Force position + RECT rect; + GetWindowRect (&rect); + GetParent()->ScreenToClient (&rect); + + ((NLTEXGEN::ITexGenOperator*)_Op)->X = rect.left; + ((NLTEXGEN::ITexGenOperator*)_Op)->Y = rect.top; + // ((CNelTexGenView*)(GetParent()))->validateChildren(); +} + +// *************************************************************************** + +BOOL COperatorWin::OnCommand(WPARAM wParam, LPARAM lParam) +{ + CNelTexGenDoc *doc = ((CNelTexGenView*)GetParent())->GetDocument(); + // Change the name ? + switch (HIWORD(wParam)) + { + case BN_CLICKED: + // Enable ? + if (LOWORD(wParam) == EnableID) + { + doc->addModification(new CActionEnable(doc->getOperatorId(_Op), _Enable.GetCheck()!=0)); + doc->endModification(); + doc->updateData (); + } + break; + case EN_KILLFOCUS: + case EN_RETURN: + // Name ? + break; + } + + return CWnd::OnCommand(wParam, lParam); +} + +// *************************************************************************** + +void COperatorWin::updateData (NLTEXGEN::ITexGenOperator *op) +{ + _Enable.SetCheck(op->isEnable()?1:0); + SetWindowPos (NULL, op->X, op->Y, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + _Dialog->updateData (); + _Preview.invalidate (); +} + +// *************************************************************************** + +void COperatorWin::link (uint input, COperatorWin *output) +{ + // Is linked ? + if(_Op->getBindedOp(input) != NULL) + unlink (input); + + // Is linked ? +/* const NLTEXGEN::ITexGenOperator *outputOp = output->_Op; + const vector outputParentOp = outputOp->getParents(); + if (outputParentOp.size()) + { + uint j; + uint i; + for (j=0; jgetNumInputBitmap(); i++) + { + if (((const NLTEXGEN::ITexGenOperator *)(outputParentOp[j]))->getBindedOp(i) == outputOp) + break; + } + if (igetNumInputBitmap()) + break; + } + + nlassert (jgetNumInputBitmap()); + + class COperatorWin *parentOp = ((CNelTexGenView*)GetParent())->getOperatorWin (outputParentOp[j]); + parentOp->unlink (i); + }*/ + + CNelTexGenDoc *doc = ((CNelTexGenView*)GetParent())->GetDocument(); + doc->addModification (new CActionLink (doc->getOperatorId(_Op), input, doc->getOperatorId(output->_Op))); +} + +// *************************************************************************** + +void COperatorWin::unlink (uint input) +{ + const ITexGenOperator *target = ((const ITexGenOperator*)_Op)->getBindedOp(input); + if (target) + { + CNelTexGenDoc *doc = ((CNelTexGenView*)GetParent())->GetDocument(); + doc->addModification (new CActionUnlink (doc->getOperatorId(_Op), input, doc->getOperatorId(target))); + } +} + +// *************************************************************************** + +CPortWnd *COperatorWin::getPort (const POINT &point) +{ + if (IsWindow(_Output)) + { + CRect rect; + _Output.GetWindowRect(rect); + if (rect.PtInRect (point) != FALSE) + return &_Output; + } + uint i; + for (i=0; i<_NumInputs; i++) + { + CRect rect; + _Inputs[i].GetWindowRect(rect); + if (rect.PtInRect (point) != FALSE) + return _Inputs+i; + } + return NULL; +} + +// *************************************************************************** + +void COperatorWin::OnNcLButtonDblClk(UINT nHitTest, CPoint point) +{ + // Show the property dialog + if (_Dialog->IsWindowVisible ()) + { + _Dialog->FlashWindow(TRUE); + _Dialog->SetWindowPos (&wndTop, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE); + } + else + _Dialog->SetWindowPos (&wndTop, point.x, point.y, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE); + + CWnd::OnNcLButtonDblClk(nHitTest, point); +} + +// *************************************************************************** + +void COperatorWin::OnDestroy() +{ + CWnd::OnDestroy(); + _Dialog->PostMessage(WM_DESTROY, 0, 0); + delete this; +} + +// *************************************************************************** + +void COperatorWin::OnPaint() +{ + CPaintDC dc(this); // device context for painting + if (_Op) + { + const COpRoot *rootOp = dynamic_cast(_Op); + + // Draw the label box + RECT rect; + rect.left = rootOp?-1:OPERATOR_EDIT_X; + rect.top = OPERATOR_EDIT_Y; + rect.right = rect.left+OPERATOR_EDIT_WIDTH; + rect.bottom = OPERATOR_EDIT_Y+OPERATOR_EDIT_HEIGHT; + + // Select the font + dc.SelectObject (&(((CNelTexGenView*)GetParent())->OperatorFont)); + + // Draw the box + CBrush brush (GetSysColor(_Op->Selected?COLOR_ACTIVECAPTION:COLOR_INACTIVECAPTION)); + dc.FillRect (&rect, &brush); + + // Draw the title + const char *name = theApp.getOperatorName (const_cast(_Op)->getClassName().c_str()); + dc.SetTextColor (GetSysColor(_Op->Selected?COLOR_CAPTIONTEXT:COLOR_INACTIVECAPTIONTEXT)); + dc.SetBkMode(TRANSPARENT); + rect.left += OPERATOR_TITLE_LEFT_MARGIN; + dc.DrawText( name, strlen(name), &rect, DT_SINGLELINE|DT_VCENTER|DT_LEFT); + } +} + +// *************************************************************************** + +void COperatorWin::OnNcLButtonDown(UINT nFlags, CPoint point) +{ + CNelTexGenDoc *doc = ((CNelTexGenView*)GetParent())->GetDocument(); + + // Unselect ? + bool ctrl = (GetAsyncKeyState (VK_CONTROL)&0x8000)!=0; + if (ctrl) + { + doc->setSelection(const_cast(_Op), !_Op->Selected); + } + else + { + doc->unSelectAll(); + doc->setSelection(const_cast(_Op), true); + } + + // Set the window topmost + // ((CNelTexGenView*)GetParent ())->setTopMost (this); + SetWindowPos (&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); +// SetWindowPos (&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); + Invalidate (); + + doc->updateData(); + + CWnd::OnLButtonDown(nFlags, point); +} + +// *************************************************************************** + +void COperatorWin::OnNcRButtonDown(UINT nHitTest, CPoint point) +{ + CNelTexGenDoc *doc = ((CNelTexGenView*)GetParent())->GetDocument(); + + // Unselect ? + bool ctrl = (GetAsyncKeyState (VK_CONTROL)&0x8000)!=0; + if (!ctrl && !_Op->Selected) + doc->unSelectAll(); + + // Force selection of this one + doc->setSelection(const_cast(_Op), true); + + MenuPos = point; + // ClientToScreen (&point); + + // Check the sub menu + CExtPopupMenuWnd * pPopupWnd = new CExtPopupMenuWnd; + VERIFY(pPopupWnd->LoadMenu(*theApp.m_pMainWnd, IDR_OPERATOR_MENU)); + theApp.addOperatorsCreatorToMenu (*pPopupWnd); + VERIFY(pPopupWnd->TrackPopupMenu(0, point.x, point.y)); + + doc->updateData(); + + CWnd::OnNcRButtonDown(nHitTest, point); +} + +// *************************************************************************** + +void COperatorWin::OnNcLButtonUp(UINT nHitTest, CPoint point) +{ + // TODO: Add your message handler code here and/or call default + + CWnd::OnNcLButtonUp(nHitTest, point); +} + +// *************************************************************************** + +void COperatorWin::OnMoving(UINT fwSide, LPRECT pRect) +{ + CWnd::OnMoving(fwSide, pRect); + + ((CNelTexGenView*)GetParent())->updateSize(); +} + +// *************************************************************************** diff --git a/tools/tex_gen_editor/operator_win.h b/tools/tex_gen_editor/operator_win.h new file mode 100644 index 0000000..66e0b73 --- /dev/null +++ b/tools/tex_gen_editor/operator_win.h @@ -0,0 +1,125 @@ +#if !defined(AFX_OPERATOR_WIN_H__D220DCE5_8589_43FA_8F3D_AACD6C5ED5DB__INCLUDED_) +#define AFX_OPERATOR_WIN_H__D220DCE5_8589_43FA_8F3D_AACD6C5ED5DB__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// operator_win.h : header file +// + +#include "my_edit.h" +#include "port.h" +#include "bitmap_wnd.h" + +namespace NLTEXGEN +{ +class ITexGenOperator; +} + +#define MAX_INPUT 4 + +///////////////////////////////////////////////////////////////////////////// +// COperatorWin window + +class COperatorWin : public CWnd +{ + friend class CPortWnd; +// Construction +public: + COperatorWin(); + +// Attributes +public: + +// Operations +public: + + enum + { + NameID = 0, + EnableID, + OutputID, + InputID, + InputName = InputID + 4, + PreviewID = InputName + 4, + }; + + // Create an operator window + BOOL Create (CWnd *parent, class NLTEXGEN::ITexGenOperator *op); + + // Update an operator window + void updateData (NLTEXGEN::ITexGenOperator *op); + + // Link this input with output + void link (uint input, COperatorWin *output); + + // Link this input with output + void unlink (uint input); + + // Hit test with ports + CPortWnd *getPort (const POINT &point); + + // Get the output port + const CPortWnd *getOutputPort () const { return &_Output; } + + // Get an intput port + const CPortWnd *getInputPort (uint port) const { return _Inputs+port; } + +private: + + // The related dialog + class COpPropertyDlg *_Dialog; + + // The operator + const NLTEXGEN::ITexGenOperator *_Op; + + // Handle move + bool _Moving; + CPoint _MoveOrigine; + CPoint _WindowPos; + + // Enable button + CExtBtnOnFlat _Enable; + + // Output port + CPortWnd _Output; + CPortWnd _Inputs[MAX_INPUT]; + CStatic _InputsName[MAX_INPUT]; + uint _NumInputs; + + // The preview window + CBitmapWnd _Preview; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(COperatorWin) + protected: + virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~COperatorWin(); + + // Generated message map functions +protected: + //{{AFX_MSG(COperatorWin) + afx_msg UINT OnNcHitTest(CPoint point); + afx_msg void OnMove(int x, int y); + afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point); + afx_msg void OnDestroy(); + afx_msg void OnPaint(); + afx_msg void OnNcLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnNcRButtonDown(UINT nHitTest, CPoint point); + afx_msg void OnNcLButtonUp(UINT nHitTest, CPoint point); + afx_msg void OnMoving(UINT fwSide, LPRECT pRect); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_OPERATOR_WIN_H__D220DCE5_8589_43FA_8F3D_AACD6C5ED5DB__INCLUDED_) diff --git a/tools/tex_gen_editor/port.cpp b/tools/tex_gen_editor/port.cpp new file mode 100644 index 0000000..427e0bc --- /dev/null +++ b/tools/tex_gen_editor/port.cpp @@ -0,0 +1,164 @@ +// port.cpp : implementation file +// + +#include "stdafx.h" +#include "nel_tex_gen.h" +#include "nel_tex_gen_doc.h" +#include "operator_win.h" +#include "tex_gen/tex_gen_op.h" +#include "nel_tex_gen_view.h" +#include "port.h" + +using namespace NLTEXGEN; + +// *************************************************************************** +// CPortWnd +// *************************************************************************** + +CPortWnd::CPortWnd() +{ + _Drag = false; +} + +// *************************************************************************** + +CPortWnd::~CPortWnd() +{ +} + +// *************************************************************************** + +BEGIN_MESSAGE_MAP(CPortWnd, CWnd) + //{{AFX_MSG_MAP(CPortWnd) + ON_WM_LBUTTONUP() + ON_WM_LBUTTONDOWN() + ON_WM_MOUSEMOVE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// *************************************************************************** +// CPortWnd message handlers +// *************************************************************************** + +BOOL CPortWnd::Create(const char *name, DWORD style, RECT &rect, CWnd *parent, UINT nID, bool output, uint input) +{ + _Output = output; + _Input = input; + LPCTSTR className = AfxRegisterWndClass (0, 0, (HBRUSH)COLOR_WINDOW, 0); + if (CWnd::Create (className, name, style, rect, parent, nID)) + { + rect.bottom = rect.bottom-rect.top; + rect.right = rect.right-rect.left; + rect.top = 0; + rect.left = 0; + Label.Create ("", WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE, rect, this, 0); + Label.SetBitmap(output?ArrowBitmapOutput:ArrowBitmapInput); + return TRUE; + } + return FALSE; +} + +// *************************************************************************** + +void CPortWnd::OnLButtonUp(UINT nFlags, CPoint point) +{ + // Drop.. + if (_Drag) + { + // Get the drop port + CNelTexGenView *view = (CNelTexGenView*)(GetParent()->GetParent()); + ClientToScreen (&point); + CPortWnd *dropPort = view->getPort (point); + if (dropPort) + { + Drag[(int)dropPort->_Output] = dropPort; + + // Link two operators + if ((Drag[0] && Drag[1]) && (Drag[0] != Drag[1])) + { + COperatorWin *input = (COperatorWin*)(Drag[0]->GetParent()); + COperatorWin *output = (COperatorWin*)(Drag[1]->GetParent()); + input->link(Drag[0]->_Input, output); + } + } + + CNelTexGenDoc *doc = view->GetDocument(); + doc->endModification (); + doc->updateData(); + + view->Invalidate(FALSE); + // view->validateChildren(); + ReleaseCapture(); + Drag[0] = NULL; + Drag[1] = NULL; + _Drag = false; + } + + CWnd::OnLButtonUp(nFlags, point); +} + +// *************************************************************************** + +void CPortWnd::OnLButtonDown(UINT nFlags, CPoint point) +{ + // Drag.. + SetCapture(); + _Drag = true; + Drag[(int)_Output] = this; + Drag[(int)(!_Output)] = NULL; + ClientToScreen(&point); + DragPos = point; + + if (!_Output) + { + COperatorWin *wnd = (COperatorWin*)(GetParent()); + const ITexGenOperator *target = wnd->_Op->getBindedOp(_Input); + if (target) + { + COperatorWin *opTarget = ((CNelTexGenView*)(GetParent()->GetParent()))->getOperatorWin (target); + Drag[1] = (CPortWnd*)(opTarget->getOutputPort()); + Drag[0] = NULL; + wnd->unlink(_Input); + } + } + + + CWnd::OnLButtonDown(nFlags, point); +} + +// *************************************************************************** + +void CPortWnd::OnMouseMove(UINT nFlags, CPoint point) +{ + if (_Drag) + { + ClientToScreen(&point); + DragPos = point; + GetParent()->GetParent()->Invalidate(FALSE); + ((CNelTexGenView*)(GetParent()->GetParent()))->validateChildren(); + } + + CWnd::OnMouseMove(nFlags, point); +} + +// *************************************************************************** + +void CPortWnd::getBezierPos (POINT &pt) const +{ + RECT rect; + if (_Output) + { + GetWindowRect (&rect); + pt.x = (rect.right + rect.left)/2; + pt.y = rect.top+1; + } + else + { + GetWindowRect (&rect); + pt.x = (rect.right + rect.left)/2; + pt.y = rect.bottom-1; + } +} + +// *************************************************************************** + diff --git a/tools/tex_gen_editor/port.h b/tools/tex_gen_editor/port.h new file mode 100644 index 0000000..605cf0e --- /dev/null +++ b/tools/tex_gen_editor/port.h @@ -0,0 +1,63 @@ +#if !defined(AFX_PORT_H__237E4B69_C55C_4B8E_AF6D_EEB1635F9513__INCLUDED_) +#define AFX_PORT_H__237E4B69_C55C_4B8E_AF6D_EEB1635F9513__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// port.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CPortWnd window + +class CPortWnd : public CWnd +{ +// Construction +public: + CPortWnd(); + +// Attributes +public: + + BOOL Create(const char *name, DWORD style, RECT &rect, CWnd *parent, UINT nID, bool output, uint input); + + bool isOutput() const { return _Output; } + + uint getInput() const { return _Input; } + + void getBezierPos (POINT &pt) const; + +private: + + CStatic Label; + bool _Output; + bool _Drag; + uint _Input; + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPortWnd) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CPortWnd(); + + // Generated message map functions +protected: + //{{AFX_MSG(CPortWnd) + afx_msg void OnLButtonUp(UINT nFlags, CPoint point); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnMouseMove(UINT nFlags, CPoint point); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PORT_H__237E4B69_C55C_4B8E_AF6D_EEB1635F9513__INCLUDED_) diff --git a/tools/tex_gen_editor/res/Toolbar.bmp b/tools/tex_gen_editor/res/Toolbar.bmp new file mode 100644 index 0000000000000000000000000000000000000000..fbded2f8090dfdf2fd9a0122d1cd9870902f57a2 GIT binary patch literal 2166 zcmb_dJ!|7Y5S=3i1surzj4K1VBK0A#iyZe?wh$Q=7c8*B>aNaTxXQf?yYm%+D^vL| z94Z73B(V41tX7gg2q`j=cUL>R^XAQm^6mTGxtQEx{KC~Ik-vRy-{baS z8Q+g)J1vQ7HagH{DFl12HFj`7-EH8V-_CpZ2(z!^(TE?6_+4}_dg-p|>>2P!nGy|- z7_P_wc51v27to%R!5?nt|A0Th9anYy;R?|j{#-Wra1^V_GriW*E80KSU(25=m}~RT2I%9zK#)Io z#bb=WDhK0#nWoG?`hZ)Z{*j#)e`NT&vs?MET?x}xeIoD1UqKdo_|~F<|Bn&!PXU6s zB@-}WcZU2EJ)2<9@U<-GNBDB_2+^mGKN^7L-^Tw1S%%#nf9Ha__C8fNWqPJ)&_xnI z0BO2Gx7#-f_`8UogZ?3Zy?FiWU+=f4@d?a+M78(ug^lK_%K=N>kva$90^Pmq;&W_ZEyr9;`z?( N(JJB}Dmwh2`43o#;#~j$ literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/res/app.ico b/tools/tex_gen_editor/res/app.ico new file mode 100644 index 0000000000000000000000000000000000000000..dec4a26f446a83c5707682b7ad71bc88f54db801 GIT binary patch literal 7078 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 literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/res/bitmap1.bmp b/tools/tex_gen_editor/res/bitmap1.bmp new file mode 100644 index 0000000000000000000000000000000000000000..636ecb3a597d50fa7be2539c24afba7fbc826b4b GIT binary patch literal 118 zcmZ?rEn|QHJ0PV2#C%Z9$iN7eumF>o#Q*>Q8UBA@VEF$4h>rkq4-m^RF#NM&VE9wR Z!0_V_1H(rkehkFNfw&)t<$>59hyfX>8w>yd literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/res/bmp00001.bmp b/tools/tex_gen_editor/res/bmp00001.bmp new file mode 100644 index 0000000000000000000000000000000000000000..c9f4f1f2782ce92f1e1056e288e9176908c77afa GIT binary patch literal 1418 zcmcJOu}fS*5Qj&&a3VGbhm}pNVm%PBJ?jIDSPK?|_ZQftxXL1hgb2cR7D*sQ8jDmG zSEYzkYZEIA;S_SG2N6s>L+K z&<)+t4c*Y|vVvaF3zLFg&>6(h9o^9#!O??xFb_{>rC0owM9LzSkhG^$7!(GDL19QF z7!(GDL19oB5)%f6L19oB6oy2HL19oB6b6Ms0}T#^Ln}u_Rse;u{tC@$=yl7m80LnN zkAnq_UEwOUPoJRw}2Q1%zw72-un@a!0Wys&SC+hbbhcqJZ literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/res/button.bmp b/tools/tex_gen_editor/res/button.bmp new file mode 100644 index 0000000000000000000000000000000000000000..7268bfb82bcb5e7e342c2ca2695e138e2893834e GIT binary patch literal 2102 zcmZvcUuYav6vn@qo!#!v&Tg~wCz;(WnP`dxDIt{-S}7&gAVs1NQq3ZZ1PMM!kWzvh zq!tN9MT#~W1w)WUsz_Oi*iukZP1CI)6d$DcP=ali7!yf-kR_&VFn)9I>>pwdduQg% z`Q7uKd+yyi@=RY8!um9zn@^p=P!I(8e!FR^hSL+LF>qu6<@qx9JiG_zK0k+%mq)Nv zS%PianEG%E$DTWe{g3U(rEe}_?8F#u{&Ex5zpF5G183elgTbcuvD4j21^wm*h zGg-_`&mjL|9)})3gxT+Aaq^9mSh%%-8$aK`+MjFK{C5*tg!*q&|0(MKNc~5s|0VTb z8G+qO?N6xv0=4_7eVN*?Q~OtHuTwio?f0quEVX;6eSzAqQM-fMpHcfIY9FTd_tZW` z?cWx#_SYIPyb5gOfdab`T>)4FES=66PULbJ!aVLznj-w}^H(wS(Pi9Usi06OU>w)k z&0TOTg}jU00p5QHCYjE+xwpD-@y!RgYb|nq0dp9{MdrH;nQu$UV~alM3+tZ(%4Jw) z;O9D_`hiIqR=PWZgM7B7f4tW~^cvupN%5jMG0spg94yl>pfodx^1XSOLB7&D({EC3 zQG~JGA1|^6%1slZtc3+?9!Z6D8Wj~@{cOi038nN{<8Fyi36Nua7a5_E~30@*VkWkqbPlF6;6c(Q-3B~!o5%#=25wTQLfJ7 z`fB@q_Q@(9!U$IIfOr90N{;*A%CW&wK)13*p~k4NzkhK46T$f?;xJ11n5*L^lK+<1 z3dbr{{B~SXVz>?V2Q9+?LFp!GAlPn9lL>JQa0t_KJP>>`g98@4_HUZj8f|H5deQu7 zSz2prG)iD6A|AImo50TDblmbyqmgM&E1uKoIDb|o5^-JrwiBwFPV1KAI0S^bT5}Dm zsj6-w!FU~UBMm?|O*P@0Baw(qQ?J6*&Gz@5u-7o>)YLHNhO9|c8+Z07< zSN=!HzYrH>GhPGgNfJ()TLucXrBW#+;|Alx1VTt!B9Zpvj+2SSVmlHl zcZ-Ym;|)X#i7bpql|*}}txXc!)0o^)BNk>{n9R~7#kiKWL!ofEE!-gLSyDQ;I~z)R z;X2?`Qp+!xaSOY$UNUSG@hNFB$+&5YE%bJKp6y#RA_ymL#Tln11rQLmEDEo(Opqm(}fc|vYBwqKjdztDbRTI MysV*cdgBf7A4=^ns z3Mx8C5JX8-Mo?_E>2&DOB|1v!Y?%w$X|dL}>_78P^zp#+KJR~?@8@}E`|e}4gw!S3 zrduLnE4)E6)c$*{TfdHn4<3@Y;l>>(J^^M#}TtiA0=fLqL_2J+Zm?+?= zo`ABql`o@w-;A1BjilE6oy(EJNcbCXIlO)1^O6Myg5v~MJvssFv1}vFM;Q&-Uz3f zsRN6KD>(N6U7^ySNN*3O^0g! z$9qS>?@_!N$IK%eW>-8z`GWj4yJ#Jx*`;;)2I@v zO!BYsXIqhl)?wz6xYtU2qE`Kwe5s(fg!+59JRHd);`Y zqWU-S53Na%zwm-4-@L!;KS!z5c-ZZxfy3&~QGdVpJ-nk#3kR9yd-xs}t(5k^TKrAy z(q=6x*&p^f!YBD}i{8f}wvy*EO=yX-f2`9Nmy{(K$5X40_xgWIG=})OH5*z+>*ktl zg1>90IHcN?7OI literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/res/button_mask.bmp b/tools/tex_gen_editor/res/button_mask.bmp new file mode 100644 index 0000000000000000000000000000000000000000..f31b605e76c3f2884c3819619977d0112ffc63a9 GIT binary patch literal 190 zcmaitu?>JQ3$cNbsNK2#x(W?9_VO) literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/res/doc.ico b/tools/tex_gen_editor/res/doc.ico new file mode 100644 index 0000000000000000000000000000000000000000..a0c98fa455d2739b70df27e66bc722a901868fa5 GIT binary patch literal 6766 zcmeI0J*XSY702hshBabYU46NbmiR?g)IC@TxO&0r))<}&*G{#as=Z(Y0jqKyZon|z zEt2q3q;ai6Ab3T*wcW&U!Nm*uK&uaALqaCMGrOyg>l+>^LLl+nJ3BjP&d2|pnUT(s zQfKOp`s%B5CGD?2QR)|rUw>_<>N`)VpWacd=kt3?eP2=P=S+q4OZu6*%TuW#vbVP( zi>wTX*}#)mH6D){Wx?2gWsJPh`4f^nzO?`A2yh1et4+?iT!mlJ&lHEBHZ0lUmdB7q z$ed|A@Z{B=^YLHCD*f{x)ZM#x)xCT7l_wOs;_f@;yR-H~qJ$?FAJ$dp( zJ$m#=J$(334S#Lax8EA|TlH3%d7{35yHsy~_(A>VkAK2YK#%B}o@CPiS^zD876^?y zBrFm1h?fX@1U-T-Vj8-Ju9;})8ajhYpeN81=m~@bx?ygZo5WfUcm^mBP!u2(aBr=7 z9sw8vFa%%-z+fSPApk=Fh5!r!7%WUM1Yiij5P%^7gM|);01N>b0x$$%2n;lE1mFk+ z2cHq3vM3^+5m+LyL}0NlgC)XvgrNwf5m;;(Sd4gyz!HJQh6NlEI3jRF;E2FsLj{fq z3=tS2Fi7Yka718;z>wHatRxE|cCtU_HoOuYP+?ocXG4u`4JM6IjR6fNjcv`M#_ z7^_=&BK0%%d-d$uGxhxWbM^A&OZDp2EA{5h8}<72YxVBkJN5qkd-dVN2Q{5e)oQg; zpFVw3>EDd{-PINMct~{R4#=q*zeaWH#HvSj*!AH}o%O8}8^^gkb)r17nl|Yu z1qBU62hlY#aB9aEy1N{~7EVELMR>D9YY9Z!JqUQyDzjguANk9mtG-InJqH>r>xm*Gjc}Ox>L(fhZ`;yPT_!M+Da>gxA`_~=K0Y$pDh;4 z(LNyTmoRUS0+fl4@_la1<_o@>mJX+7bri^hiQH7?fm@%={l&sxjtKsV(whQXYrqR* z-^aozZEa7y0Mp)y91$UML$JiLzihU4H`qTHz(8HMT6#Y7b#w9=I|40~6dQWX;ULNrcx8;ote8HJ~TfgUJB?IL`QY>9Nb`$6p<`(T{;lV4~w*FODao zf7d#>q-ocUCzD<~3}F~(eU(|zgMqf{cP)K#a!2Q-Q1{w7ey5$Q#EM8LcmR z8GCU|wu|h-SUA1Bg<+%HsAI3!3wvna;Y*HhJIgMlm#u;->~z}Jq>EFXcq@)KX)SAF z7iJgU?T9jXJ8j`E*ZTcgeBn1?29*Zfs3`*5;xn#|0a4vsRY_%NB;RGt%Oi!>j9i ze!FRIyQlSh+Bo-I*TWbsjGL2IGq#7(50AghJdca1{aIZwdX?~TkK;rjc9VH%(au{ zLN+~8=I=_CB{#ZO$~hj%nEGZWL}I9luBh@K8)8gca%CA`CVcx^qb?E z5dSl6ENanjN9s_rMI;qH7ay+T08LM^-G;fO+tx6|5B%ZsZ*&X|Htc8uUoHH zYmI;LRZ+fNWjWfS{&^keRi%`$^~S~-t(^W1C4I?T))dhzY6nT$4pkA~E#1peu3MID z8_f=-UjvCvN}*y~ww|s=`@CarNz^Y=!Ppv)GHq?vxrU0Q+Q)6XT5Y6un%b{5Z?-(i zJ%y8MjORz2ICba#C`+!7?F-k&)-5453pFhDWv1pxnL`w$DkC^(sx%oW=X~jBU@bZ8UhF&GMpVcTa1}v1h0@T2vXif*px)mj3UHiz(|=2_$}! zj%$)(emFAQeVJPAPAF1j{YtXiK`e>)&PKEk31mNC`-C=O&^oZNFS2rNLN47#_-UsjEvWG(S_c!=oUM4Ytvkp%|8Kwh%25H@>BZ{KJV|_dD9_G1MV<{5a&-}7^W%4AM)k- zx&P*V(j}a@*Y~UhksXTAK!NRyiYN-8NMyKz<)2v9@tUao7A!g+SzkAcsHvdq6!0vQ z#-rA6>0BAr)4*u6Y57EdkamnXf Uh-a7VEuQ2KJb_2>o71HC3-%7w@Bjb+ literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/res/quadrati.bmp b/tools/tex_gen_editor/res/quadrati.bmp new file mode 100644 index 0000000000000000000000000000000000000000..1e26d1a6a46cda7a0addaf1b810190d2ef79b07d GIT binary patch literal 118 zcmZ?rEn|QHJ0PV2#C%Z9$iN7eumF>o#Q*>Q8U7z&VEEqv#5N2J|7sxk&mRT`Wc(Az O2jR~^%nro-KnwsO)En~v literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/res/toolbar1.bmp b/tools/tex_gen_editor/res/toolbar1.bmp new file mode 100644 index 0000000000000000000000000000000000000000..b45da68d4be1303bd0e5707057bd82f2151c76c2 GIT binary patch literal 238 zcmZvV!3~8l3`32Cl-q|fn1egJ NLMISC::Pi) + newAngle -= (float)NLMISC::Pi*2.f; + while ((previousAngle - newAngle) > NLMISC::Pi) + newAngle += (float)NLMISC::Pi*2.f; + + return valueToAngle (angleToValue (newAngle)); +} + +// *************************************************************************** + +void CRotButton::OnLButtonDown(UINT nFlags, CPoint point) +{ + SetCapture (); + SetFocus (); + + // Notify parent + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (ROB_CAPTURED<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + + CWnd::OnLButtonDown(nFlags, point); +} + +// *************************************************************************** + +void CRotButton::OnMouseMove(UINT nFlags, CPoint point) +{ + if (GetCapture () == this) + { + RECT rect; + + // Previous angle + float previousAngle = valueToAngle (_Value); + + invalidateCursor (); + + // Compute angle + GetClientRect (&rect); + float dx = (float)(point.x - (rect.right + rect.left) / 2); + float dy = -(float)(point.y - (rect.bottom + rect.top) / 2); + + // Snaped angle ? + float angle = getNextAngle (previousAngle, -(float)atan2 (dx, dy)); + + // Snaped ? + float value; + if ((nFlags&(MK_CONTROL|MK_SHIFT))==0) + { + uint i; + for (i=0; i<_Setup.SnapedValuesCount; i++) + { + // Good ? + if (fabs(angle-_AngleSnaped[i])<=SNAP_ANGLE) + { + value = _Setup.SnapedValues[i]; + break; + } + } + if (i==_Setup.SnapedValuesCount) + value = angleToValue (angle); + } + else + value = angleToValue (angle); + + _Value = value; + valueAsBeenChanged (true); + } + + CWnd::OnMouseMove(nFlags, point); +} + +// *************************************************************************** + +void CRotButton::OnLButtonUp(UINT nFlags, CPoint point) +{ + ReleaseCapture (); + + // Notify parent + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (ROB_RELEASED<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + + CWnd::OnLButtonUp(nFlags, point); +} + +// *************************************************************************** + +void CRotButton::OnSetFocus(CWnd* pOldWnd) +{ + CWnd::OnSetFocus(pOldWnd); + + Invalidate (); +} + +// *************************************************************************** + +void CRotButton::OnKillFocus(CWnd* pNewWnd) +{ + CWnd::OnKillFocus(pNewWnd); + + Invalidate (); +} + +// *************************************************************************** + +void CRotButton::getCursorPos (float value, sint &x, sint &y) const +{ + RECT rect; + GetClientRect (&rect); + sint width = rect.right-rect.left; + sint height = rect.bottom-rect.top; + + const float angle = valueToAngle (value); + const float sa = (float)sin(angle); + const float ca = (float)cos(angle); + + x = (sint)floor(0.5 - sa*(RADIUS_CURSOR)) + RADIUS_CURSOR - SIZE_CURSOR/2 + (width/2-RADIUS_CURSOR); + y = (-(sint)floor(0.5 + ca*(RADIUS_CURSOR)) + RADIUS_CURSOR) - SIZE_CURSOR/2 + (height/2-RADIUS_CURSOR); +} + +// *************************************************************************** + +void CRotButton::updateEditBox () +{ + if (_Edit) + { + _Edit->SetWindowText(toString(_Value).c_str()); + CDC *dc = _Edit->GetDC(); + _Edit->SendMessage (WM_PAINT, (WPARAM)(HDC)*dc, 0); + _Edit->ReleaseDC (dc); + } +} + +// *************************************************************************** + +void CRotButton::setEditBox (CExtEdit *edit) +{ + _Edit = edit; + updateEditBox (); +} + +// *************************************************************************** + +void CRotButton::OnLButtonDblClk(UINT nFlags, CPoint point) +{ + invalidateCursor (); + + switch (_Setup.Formula) + { + case NLTEXGEN::CFloatValueSetup::TwoPower: + _Value = (float)pow(2, _Setup.ValueOrigine); + break; + case NLTEXGEN::CFloatValueSetup::Linear: + _Value = _Setup.ValueOrigine; + break; + } + + valueAsBeenChanged (true); + + CWnd::OnLButtonDblClk(nFlags, point); +} + +// *************************************************************************** + +void CRotButton::valueAsBeenChanged(bool notify) +{ + invalidateCursor(); + + CDC *dc = GetDC(); + SendMessage (WM_PAINT, (WPARAM)(HDC)*dc, 0); + ReleaseDC (dc); + + // Change the edit box + updateEditBox (); + + // Notify parent + if (notify) + { + CWnd *parent = GetParent(); + if (parent) + parent->PostMessage(WM_COMMAND, (ROB_VALUE_CHANGED<<16)|GetDlgCtrlID(), (LONG)m_hWnd); + } +} + +// *************************************************************************** + +void CRotButton::invalidateCursor() +{ + sint x,y; + getCursorPos (_Value, x, y); + RECT rect; + rect.left = x; + rect.top = y; + rect.right = rect.left+SIZE_CURSOR; + rect.bottom = rect.top+SIZE_CURSOR; + InvalidateRect (&rect, FALSE); +} + +// *************************************************************************** + +void CRotButton::setValue (float value) +{ + invalidateCursor (); + + _Value = value; + + valueAsBeenChanged (false); +} + +// *************************************************************************** + +BOOL CRotButton::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) +{ + invalidateCursor (); + + float angle = valueToAngle (_Value); + angle = (float)floor(0.5f + angle / WHEEL_ANGLE) * WHEEL_ANGLE; + angle += (float)zDelta*WHEEL_ANGLE/(float)WHEEL_DELTA; + _Value = angleToValue (angle); + + valueAsBeenChanged (true); + + return CWnd::OnMouseWheel(nFlags, zDelta, pt); +} diff --git a/tools/tex_gen_editor/rot_button.h b/tools/tex_gen_editor/rot_button.h new file mode 100644 index 0000000..00346ca --- /dev/null +++ b/tools/tex_gen_editor/rot_button.h @@ -0,0 +1,93 @@ +#if !defined(AFX_ROT_BUTTON_H__2D00274D_BADA_47F5_A9DF_3DD276B96651__INCLUDED_) +#define AFX_ROT_BUTTON_H__2D00274D_BADA_47F5_A9DF_3DD276B96651__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// rot_button.h : header file +// + +#include "tex_gen/basics.h" + +#define ROB_VALUE_CHANGED 0x1114 +#define ROB_RELEASED 0x1115 +#define ROB_CAPTURED 0x1116 + +// *************************************************************************** +// CRotButton window +// *************************************************************************** + +class CRotButton : public CWnd +{ +// Construction +public: + CRotButton(); + +// Attributes +public: + +// Operations +public: + + BOOL Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID); + + void init (const NLTEXGEN::CFloatValueSetup &setup); + void getCursorPos (float value, sint &x, sint &y) const; + void setEditBox (CExtEdit *edit); + void setValue (float value); + float getValue () const + { + return _Value; + } + + // Conversion + float valueToAngle (float value) const; + float angleToValue (float angle, bool doClamp = true) const; + +private: + + // The current value + float _Value; + NLTEXGEN::CFloatValueSetup _Setup; + std::vector _AngleSnaped; + // Edit box + CExtEdit *_Edit; + + // Delta + float CRotButton::getNextAngle (float previousAngle, float newAngle) const; + + // Update + void updateEditBox (); + void valueAsBeenChanged (bool notify); + void invalidateCursor (); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CRotButton) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CRotButton(); + + // Generated message map functions +protected: + //{{AFX_MSG(CRotButton) + afx_msg void OnPaint(); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnMouseMove(UINT nFlags, CPoint point); + afx_msg void OnLButtonUp(UINT nFlags, CPoint point); + afx_msg void OnSetFocus(CWnd* pOldWnd); + afx_msg void OnKillFocus(CWnd* pNewWnd); + afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); + afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +// *************************************************************************** + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_ROT_BUTTON_H__2D00274D_BADA_47F5_A9DF_3DD276B96651__INCLUDED_) diff --git a/tools/tex_gen_editor/samples/cells.texgen b/tools/tex_gen_editor/samples/cells.texgen new file mode 100644 index 0000000000000000000000000000000000000000..378d022c53491f8fd4cc151d9b599ebb27fd2ff9 GIT binary patch literal 488 zcmeYZiEwA)U|?Vn5ZVYN85o#=IH-h?5lCg^YzB#dh1`pPB0#wlPOJ+%|zUgRS+=WMp7tvWYJRS_`u3#s!2coqZ5aVzTITv}5}6_sU+72^m{# zK?ZM=Z<7VQ2XV>{l&<1RAGZH$TcvJ!@LG_I!qj90L*c)K!n91 E07~Ui&;S4c literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/samples/cement.texgen b/tools/tex_gen_editor/samples/cement.texgen new file mode 100644 index 0000000000000000000000000000000000000000..47e96537dd442ba00822039d23ce288291df9518 GIT binary patch literal 577 zcmeYZiEwA)U|?YIIJOZ;GB7X!aZm{(Bam{?+yoK<3;AX;GB7d;GmAN~GB5+hH2xvv z+>3y!f%;AW<$#cp6|94S1*8rYG}r_AAk4tP$PjNYcp%80ah8Dn+10!5fF*KUGJvum zRmd2uqro2JBmp6WD}6Eig!19YcNXDLZuQbJlLPW3X_)50pR#P+r~TR0yY7G`Jf5)IGrkJ2 zXJja{KQuiRArV@X57Y+Ij*P)ZH2_rug^f3ZOa(jIFCQoZbixTIRz@bPEgrTY1sPjx z;R>9K;0i$M7J%Ff1biTMH=ZE8>XgpN%n1|&6Cg<>0CEQcJn%$V@8izMzyz_Lft3*m uL3T9QgY5tlEMO9$8OUm|cQa%Fdj!nE=}nj~U^L9NF#BP_0E-k@!~pMH8fh!Ee&OgCQ zlr$D8L{K+^;nce>kS4{E`~!j(3I=`O+kLyULgtvaGw*vpzV~M4>a%lI`-q4hTph9` zvOF8h#_(s|QN4Q08pc{tSxm^@{#-eLF~M};I`@9Pn46Xu+qj1rd)(dPFoN9_{fvD) z@HxdQ|8lHW&104g|Hxi=F9Od0{76W6klpD%ACs5V`MUS}@7UhHIoa6;7JeDO4BKCj63u*43kFAi`&A_f7eGkioV$0Ixk?Gu}`T;2u7vSlsNE;+>CWN+9 z$HtumpqaGc@=$z0XjY;hkF0P((ryDS@-Zz}h%OgRAE=LdcbsrjwVbT&A8Q1*({3NY zO1r3~?Y@jzn*_u?LSA$QcO{HsKwv@l%Ex^G z%y)uYkW2t)qeDK`H)jgX$~?4T%3ag79DcRMtYhCI5A2J>Vf8y43wR|qHLeuc73thRSl?B=t)%4bJRZrJ=cx& zHG8N~nf(G?Zy@KJ%^4tAeD=2;V{S_ZP@n+~Gk|n7*n=$Ffn>j5K2QW`(+MY5Mkc3( zr+YvOZoEUd#<>Wt0Hp4h3y=T;K9D*GQ-nIFbVg=Qpct3{Ng@G|TM(wgbitef^E&{_ C;VcIL literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/samples/ground_tiles.texgen b/tools/tex_gen_editor/samples/ground_tiles.texgen new file mode 100644 index 0000000000000000000000000000000000000000..adc81645ababc65d77a92726ecb5733e87833def GIT binary patch literal 798 zcmeYZiEwA)VPIeo5ZVYN85o#=IH-h?5lB`1+YAx`3;AX;GB7gn>vB4=GB5+her(=^ zCYLWX%@HCeaRVXelgS7)af=g>FmYl5=|lw$_CP)eGcYh#DA;v+2H7z(%(FYYdeIBtU|20Mo&+_pSptA~gOX z+=Cv@u#kZ1e&C6SH0Kb+7~+ph6bPtWDL~N{5aAcWNpS4 vTd;1BOPrCc1@ad-f&_s8r0&HHg!7!z8JRhOVqgL!i3C8_AWVhnf_V-ASDh%I literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/samples/logo.texgen b/tools/tex_gen_editor/samples/logo.texgen new file mode 100644 index 0000000000000000000000000000000000000000..d0bd799950267ade40a7b8df02b9442dd61d6a6e GIT binary patch literal 795 zcmeYZiEwA&Vqjo6utgt8GB7X!aZm{(BapIae*+SM2)Q#dFaqUHII%K-A&App4^qv* z0wzH$IB2jxa`>9@!NmX%%nG@5&QxAcbAb>_7!c3n`My9^$I}b9&@~1jMJ%CUN z2@#+>-3%G*SFh3nV?;0k!|l|eGPJk^c^{|)9&URP@#&WjcN!y8IG-*!U=)H83W9)< wiWIO6tc223rd%W}bV2qaW2hTIo`Izs2dGIO6EI?qv2n%#roWqhm0DIMR#Q*>R literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/samples/marble.texgen b/tools/tex_gen_editor/samples/marble.texgen new file mode 100644 index 0000000000000000000000000000000000000000..402184ea0f542206f487b27aa648a12b23fba0de GIT binary patch literal 351 zcmeYZiEw9NWnf?s&|3#285o#=IH-h?5lCGKMF=_j07ZauC!AOrn2stK*fKF`x7&hL zMT8+#xfdZ+u`;kS0@VUlFtC6uU|?vlN5u^G3=x+nThEy-Z9iqQFc^aryj|37$GDmO zjNREYXY96a*<#n%%L~?7w05f<W10;JWt34%K{+eLy?*TUObF9C{)K x;ZWxsghQDa86G%*-3d~~kcd#_l+MV^2^0boU`dby2ml)nHxm{JFx{}A0|1tYLP!7r literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/samples/metal_button.texgen b/tools/tex_gen_editor/samples/metal_button.texgen new file mode 100644 index 0000000000000000000000000000000000000000..a97e291434e4536d436342ffdc01a5ea29112611 GIT binary patch literal 487 zcmeYZiEw9NV_;xda7Q0VGB7X!aZm{(BaoWGy$&P-7V^zxWMBo#op54hU=~K3!tAF^7Pf!&;)UJ4J260& z4fYTI*V{23k4d)&aZoXXJ;Miq5_^yfe;~QSFCQoZaUmm9huBS9kb(k!gfoNO;R+a7 z8CiiCsJg)(NH8$4fJqPw4jSx>=l-_?83F`Y+yD`TNP|d$zlZ>3*y?4CYO2Ky6ep*=$-Zz`InK@I>)fGh<$3FdK_|6qJr Kw7?t#i$VY!*i1tJ literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/samples/metal_lines.texgen b/tools/tex_gen_editor/samples/metal_lines.texgen new file mode 100644 index 0000000000000000000000000000000000000000..0ec30b8049e711e7995d556497419ff0bd7f343f GIT binary patch literal 641 zcmeYZiEwA&U|?V{sCQ-rQVdK$98|&xVjtM-0vGbhWMq1hdew>Pl2YCw7LX!T&|nYb zgD?nyILH_*(O?fUOk<)G+)TfGAQNcR2`5%YChqHttwAyZPaWY3+>77}7+ArOiIL%e zJqt6)5){y2zl-~y9ixSNydA354faW=r0f~rMlix02h|61AJAPzj&5LgH3%TNs~BM| z(0L7ZOs5yN+Ce>y>@TPp=r%(5K*K=*>=`f%Of=ZDGO{wV0NE2ZAp+bfospRnC zgHYg{16RPnbmwP}Bhxnx8?dS${}8I2(ixdKfkuM~kR3<>GnEI@T2^)L)FWP9#yJBHJeN39qcIP4hJZrU<3%miC|s~2c`RGYNjpBQudb#kWm zob^TsYrkJthZ_Sj4#PbeTWrC$fqdkggYYfWi)wQxW{?!v$4r-*V;w>6fAA9Fey4Os aW=^0Om;gy40g&q%7+|KubisTN3u6FPpG#l> literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/samples/planet.texgen b/tools/tex_gen_editor/samples/planet.texgen new file mode 100644 index 0000000000000000000000000000000000000000..0e0fb3c9537e6c40e548789a57790be18146554b GIT binary patch literal 1366 zcmZ`(O=wd=5T4!l-a$kZLC~8As|OL{#UChdn-@q5ra?*$z4%L82~-N!f`Z@!B?s+A zv|dE56x2g&8>k??n4%K(q@oq27pZ~=rP6~m9>kf+o9w3Q!ff((W@o{=cwGT_pvc-r|?j0eI-z7gZ>N!^x-g&#zCThHu*OZt~KHYqW+71Txk8kTx@r!XU0-rRPzg^pV*Q9B|(W z$P6?CKtJ1hC9Ut?*v3(v>uj&l3FWQ9lsqvJT!AM-VMo>3l{;l~2N0-$A%P!Y_~gVy zNLF7t6B6*z!Fs6bm!`t&qnixb`}uixoU6SJ)#g$y{Qhkqym-MgmFW~ahF-TBRXpjh zA|f{9BS^-RuI+z0u&iZCNZ9bww)sE6jYFbFtyS){8~8n*4HrKhGh!4lHtZR=_wFWw zbO-Ik^2fVpLn2VhSC<}e6p1X8w|wd1Vp~XyK+%u-EXZs|f!5`nS5aGPu3BwJLd=)X zy^M~6Q~frW#J2oqF0Bu(?~8oSM>(4#LG^h5FXq&35MwM`oes#|gkn%Q#inIy=$8~TLsupFr2c*^SjzG_OBp3&iE*Z6!#{hb zD@2)a5CN_wJ=2NH1>iWGI?mgB6}i_2;97^?bNHjtx0ZHr;)7*-1cf0B5gQpxb2kYt zw>14v%C}-_IvQdSJop4- literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/samples/road.texgen b/tools/tex_gen_editor/samples/road.texgen new file mode 100644 index 0000000000000000000000000000000000000000..3fa2c92f03b729c58100fe71bd4640f536fc6d17 GIT binary patch literal 1100 zcmZ`(K}eKQ5T1FvKe0p-NU4Dx7C{JtB?~eA|EIsuLfDcb@^=VSsznf_(u)f2p$>a6 zI(QJIOQ(en355qQ3oX)u3LYamh(&nw;KhsK%zOXr+f95hZ+GXLH*dag=51~?%Bm&+ zD792*2T)`qvxxN3-?7CW<9alOpa`pm9wf+j*y_R=Lv^@tKgOa?hYd|3ow^&+_BBj$ za)kH3*zTvzUma_6nr|UsJrHAnTnrR6*Am@wIde1Qv9+N3oSmR_RM5R|wA*5{uWA9{ zfrp-<07;KyN#l&6k&}4{|;(AzVVQXE7XjE zu6Mr!94+T99nNW1LFX&~_>P##ZO3GA+7+r0G6RVO9buJti{mpcKFnhxMWESC)f{RU z*W%WG-KmS@;Ja}8lJ>8qh-6wb2Xfgw2$Q;WbwXp`xC4$ZbL0d4^kbk=wL73zY)noH z*;C)mSEgh~=tNBQ*Ss$Lo1-kualFy|(9wayG4YcXoU$RsO}_fO@?Cv*=T^ zdEg+5`LC|H8NNsdjz?Ie7FlB*#{PT>@c88_IhQng^TuidUEe5kLm~Q)ZuQjliYGsJ zfT4Q4d~-0#S~o7!uZEt*xC02~AN2-&!Vbns+EHtG5)vQ+OO^75+yO+EvaShz$0 literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/samples/rough_coats.texgen b/tools/tex_gen_editor/samples/rough_coats.texgen new file mode 100644 index 0000000000000000000000000000000000000000..8dba5a60698fd8f5cdf5009bf18b51469b272040 GIT binary patch literal 296 zcmeYZiEw9PWnf?s5ZVYN85o#=IH-h?5lB^>LkRg~GJ<44(p#KZn1QVI>(<%9Fatw_ zJx~aQ85lNhFtCSVxWuQ!zwIC#kV+T^>u9hCS$5+B!ZN>npa{^W6HcrkTOkTEw%CG= z2RXwz2d;pDiIL%e1IR%POy4wY?BVKP+&~!Ul+MV^2~+_lK(-+PkXslSV5(uZz?=gM F0{}{3GeH0V literal 0 HcmV?d00001 diff --git a/tools/tex_gen_editor/samples/splash.texgen b/tools/tex_gen_editor/samples/splash.texgen new file mode 100644 index 0000000000000000000000000000000000000000..168b7939a85036752cfc8ae658182240951e2b19 GIT binary patch literal 643 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 J_Z@!!e*lp-<@5jm literal 0 HcmV?d00001 diff --git a/tools/tex_gen_install/adni18-uninstall-B.ico b/tools/tex_gen_install/adni18-uninstall-B.ico new file mode 100644 index 0000000000000000000000000000000000000000..3e3cd4a86fbf361af467b54439b2d4ed76bff341 GIT binary patch literal 22486 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

((S<|QXkRY(F>ha@s*k>?QayB79d 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 AjQ{`u literal 0 HcmV?d00001 diff --git a/tools/tex_gen_install/nel_tex_gen.nsi b/tools/tex_gen_install/nel_tex_gen.nsi new file mode 100644 index 0000000..016e03a --- /dev/null +++ b/tools/tex_gen_install/nel_tex_gen.nsi @@ -0,0 +1,200 @@ +; nel_tex_gen.nsi + +!define VER_MAJOR 1 +!define VER_MINOR 0b + +;-------------------------------- + +; The name of the installer +Name "NeL Texture Generator v${VER_MAJOR}.${VER_MINOR}" +Caption "NeL Texture Generator v${VER_MAJOR}.${VER_MINOR}" +Icon "..\tex_gen_editor\res\app.ico" +UninstallIcon "..\tex_gen_editor\res\app.ico" + +Page components +Page directory +Page custom plugin_max3_begin ": 3dsmax3 directory" +Page custom plugin_max5_begin ": 3dsmax5 directory" +Page custom installation_options ": installation options" +Page instfiles + +ShowInstDetails show +XPStyle on + +ComponentText "Select the components you want to install." + +; The file to write +OutFile nel_tex_gen_${VER_MAJOR}${VER_MINOR}.exe + +; The default installation directory +InstallDir "$PROGRAMFILES\Digital Murder\nel_tex_gen" + +; The text to prompt the user to enter a directory +DirText "Choose a directory to install the NeL Texture Generator files." + +;-------------------------------- + +InstType "Full" + +;-------------------------------- + +Section "" + SetOutPath $INSTDIR + WriteUninstaller Uninst.exe + + ; Set output path to the installation directory. + File "..\tex_gen_editor\history.txt" +SectionEnd + +; The stuff to install +SubSection "Texture Generator Editor" + +Section "Executable" +SectionIn 1 + ; Set output path to the installation directory. + SetOutPath $INSTDIR + + ; Put file there + File ..\tex_gen_editor\Release\nel_tex_gen.exe + File C:\Lib\STLport\lib\stlport_vc645.dll + File C:\bin\ProfUIS221m.dll + + WriteRegStr HKCR ".texgen" "" "NeLTexGen" + WriteRegStr HKCR "NeLTexGen" "" "NeL Texture Generator File" + WriteRegStr HKCR "NeLTexGen\shell" "" "open" + WriteRegStr HKCR "NeLTexGen\DefaultIcon" "" $INSTDIR\nel_tex_gen.exe,1 + WriteRegStr HKCR "NeLTexGen\shell\open\command" "" '$INSTDIR\nel_tex_gen.exe "%1"' + +SectionEnd + +Section "Sample Textures" +SectionIn 1 + SetOutPath $INSTDIR\samples + File ..\tex_gen_editor\samples\*.texgen +SectionEnd + +SubSectionEnd + +Section "Windows Explorer Thumbnail Plug-in" +SectionIn 1 + ; Set output path to the installation directory. + SetOutPath $INSTDIR + + ; Put file there + File ..\tex_gen_thumbnail\Release\tex_gen_thumbnail.dll + File C:\Lib\STLport\lib\stlport_vc645.dll + RegDll $INSTDIR\tex_gen_thumbnail.dll + +SectionEnd + +Section "3dsmax3 Plug-in" pluginmax3 +SectionIn 1 + ; Set output path to the installation directory. + ReadINIStr $1 $0 "Field 2" "State" + + SetOutPath $1\plugins + + ; Put file there + File "c:\program files\3dsmax3_1\plugins\tex_gen_3dsmax3.bmi" + + SetOutPath $1 + File C:\Lib\STLport\lib\stlport_vc645.dll + +SectionEnd + +Section "3dsmax5 Plug-in" pluginmax5 +SectionIn 1 + ; Set output path to the installation directory. + ReadINIStr $1 $4 "Field 2" "State" + + SetOutPath $1\plugins + + ; Put file there + File "c:\program files\3dsmax5\plugins\tex_gen_3dsmax5.bmi" + + SetOutPath $1 + File C:\Lib\STLport\lib\stlport_vc645.dll + +SectionEnd + +Section "Uninstall" + UnRegDLL $INSTDIR\tex_gen_thumbnail.dll + Delete $INSTDIR\Uninst.exe ; delete self (see explanation below why this works) + Delete $INSTDIR\tex_gen_thumbnail.dll + Delete $INSTDIR\nel_tex_gen.exe + Delete $INSTDIR\log.log + Delete $INSTDIR\stlport_vc645.dll + Delete $INSTDIR\ProfUIS221m.dll + Delete $INSTDIR\history.txt + Delete $INSTDIR\samples\*.texgen + Delete "$DESKTOP\NeL TexGen Editor.lnk" + RMDir /r "$SMPROGRAMS\NeL Texture Generator" + RMDir $INSTDIR\samples + RMDir $INSTDIR + + DeleteRegKey HKCR ".texgen" + DeleteRegKey HKCR "NeLTexGen" + DeleteRegKey HKCR "Neltexgen.Document" +SectionEnd + +Function installation_options + GetTempFileName $5 + File /oname=$5 options.ini + InstallOptions::dialog $5 +FunctionEnd + +Function plugin_max3_begin + SectionGetFlags ${pluginmax3} $R1 + IntOp $R2 $R1 & 1 + StrCmp $R2 1 continue + Abort +continue: + GetTempFileName $0 + File /oname=$0 plugin_max3.ini + InstallOptions::dialog $0 +FunctionEnd + +Function plugin_max5_begin + SectionGetFlags ${pluginmax5} $R1 + IntOp $R2 $R1 & 1 + StrCmp $R2 1 continue2 + Abort +continue2: + GetTempFileName $4 + File /oname=$4 plugin_max5.ini + InstallOptions::dialog $4 +FunctionEnd + +Function .onInstSuccess + + ; Menu shortcuts + ReadINIStr $1 $5 "Field 2" "State" + StrCmp $1 0 abort_menu + IfFileExists "$INSTDIR\nel_tex_gen.exe" "" +3 + CreateDirectory "$SMPROGRAMS\NeL Texture Generator" + CreateShortCut "$SMPROGRAMS\NeL Texture Generator\NeL TexGen Editor.lnk" "$INSTDIR\nel_tex_gen.exe" + IfFileExists "$INSTDIR\Uninst.exe" "" +3 + CreateDirectory "$SMPROGRAMS\NeL Texture Generator" + CreateShortCut "$SMPROGRAMS\NeL Texture Generator\Uninstall NeL Texture Generator.lnk" "$INSTDIR\Uninst.exe" +abort_menu: + + ; Desktop shortcut + ReadINIStr $1 $5 "Field 1" "State" + StrCmp $1 0 abort_desktop + IfFileExists "$INSTDIR\nel_tex_gen.exe" "" +2 + CreateShortCut "$DESKTOP\NeL TexGen Editor.lnk" "$INSTDIR\nel_tex_gen.exe" +abort_desktop: + + ReadINIStr $1 $5 "Field 4" "State" + StrCmp $1 0 abort_view_history + IfFileExists "$INSTDIR\nel_tex_gen.exe" "" +2 + Exec "$INSTDIR\nel_tex_gen.exe" + +abort_view_history: + ReadINIStr $1 $5 "Field 3" "State" + StrCmp $1 0 abort_run + IfFileExists "$INSTDIR\history.txt" "" +2 + Exec "notepad.exe $INSTDIR\history.txt" +abort_run: + +FunctionEnd diff --git a/tools/tex_gen_install/options.ini b/tools/tex_gen_install/options.ini new file mode 100644 index 0000000..d9012fd --- /dev/null +++ b/tools/tex_gen_install/options.ini @@ -0,0 +1,38 @@ +[Settings] +NumFields=4 + +[Field 1] +Type=CheckBox +Left=10 +Right=-10 +Top=10 +Bottom=25 +Text=Install a shortcut on the desktop +State=1 + +[Field 2] +Type=CheckBox +Left=10 +Right=-10 +Top=25 +Bottom=40 +Text=Install a shortcut in the start menu +State=1 + +[Field 3] +Type=CheckBox +Left=10 +Right=-10 +Top=40 +Bottom=55 +Text=View the history file +State=1 + +[Field 4] +Type=CheckBox +Left=10 +Right=-10 +Top=55 +Bottom=70 +Text=Run NeL Texture Generator +State=1 diff --git a/tools/tex_gen_install/plugin_max3.ini b/tools/tex_gen_install/plugin_max3.ini new file mode 100644 index 0000000..acdc022 --- /dev/null +++ b/tools/tex_gen_install/plugin_max3.ini @@ -0,0 +1,20 @@ +[Settings] +NumFields=2 + +[Field 1] +Type=Label +Left=10 +Right=-10 +Top=10 +Bottom=25 +Text=Select the 3dsmax3 directory... + +[Field 2] +Type=DirRequest +Left=10 +Right=-10 +Top=25 +Bottom=37 +Text= +State=C:\3dsmax3_1 + diff --git a/tools/tex_gen_install/plugin_max5.ini b/tools/tex_gen_install/plugin_max5.ini new file mode 100644 index 0000000..f441539 --- /dev/null +++ b/tools/tex_gen_install/plugin_max5.ini @@ -0,0 +1,20 @@ +[Settings] +NumFields=2 + +[Field 1] +Type=Label +Left=10 +Right=-10 +Top=10 +Bottom=25 +Text=Select the 3dsmax5 directory... + +[Field 2] +Type=DirRequest +Left=10 +Right=-10 +Top=25 +Bottom=37 +Text= +State=C:\3dsmax5 + diff --git a/tools/tex_gen_install/tex_gen_install.dsp b/tools/tex_gen_install/tex_gen_install.dsp new file mode 100644 index 0000000..7698426 --- /dev/null +++ b/tools/tex_gen_install/tex_gen_install.dsp @@ -0,0 +1,62 @@ +# Microsoft Developer Studio Project File - Name="tex_gen_install" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Generic Project" 0x010a + +CFG=tex_gen_install - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "tex_gen_install.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "tex_gen_install.mak" CFG="tex_gen_install - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "tex_gen_install - Win32 Release" (based on "Win32 (x86) Generic Project") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +MTL=midl.exe +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# Begin Target + +# Name "tex_gen_install - Win32 Release" +# Begin Source File + +SOURCE=.\nel_tex_gen.nsi +# Begin Custom Build - Build install +InputPath=.\nel_tex_gen.nsi + +"toto" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + call ../tex_gen_3dsmax3/make_tex_gen_3dsmax3.bat + makensis $(InputPath) + +# End Custom Build +# End Source File +# Begin Source File + +SOURCE=.\plugin_max3.ini +# End Source File +# Begin Source File + +SOURCE=.\plugin_max5.ini +# End Source File +# End Target +# End Project diff --git a/tools/tex_gen_thumbnail/ExtractImageApp.cpp b/tools/tex_gen_thumbnail/ExtractImageApp.cpp new file mode 100644 index 0000000..d8caff7 --- /dev/null +++ b/tools/tex_gen_thumbnail/ExtractImageApp.cpp @@ -0,0 +1,136 @@ +// ExtractImageApp.cpp: implementation of the CExtractImageApp class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "tex_gen_thumbnailApp.h" +#include "ExtractImageApp.h" +#include "TexGenThumbnailDoc.h" + +using namespace NLMISC; + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CExtractImageApp::CExtractImageApp() +{ + m_pDoc = NULL; + +} + +CExtractImageApp::~CExtractImageApp() +{ + +} + +////////////////// +// This helper fn determines if I can open a document. It searches the doc +// templates for one whose file name extension matches the requested file. +// (copied from an article of MSJ magazine) +CDocTemplate* CExtractImageApp::CanOpenDocument(LPCTSTR lpszPath) +{ + CDocument* pDoc=NULL; + POSITION pos = m_pDocManager->GetFirstDocTemplatePosition(); + while (pos != NULL) { + CDocTemplate* pdt = m_pDocManager->GetNextDocTemplate(pos); + if (pdt->MatchDocType(lpszPath,pDoc) >= CDocTemplate::yesAttemptNative) + return pdt; + } + if (!pDoc) { + // If you got here, you may have forgotten to set the string(s) + // describing your document types + //CString sErr; sErr.Format("***Can't find doc template for %s\n", lpszPath); + //AfxMessageBox(sErr); + } + return NULL; +} + +////////////////// +// Load document. This function is responsible for opening the document +// and setting m_pOpenDoc to the document loaded. +BOOL CExtractImageApp::LoadDoc(LPCTSTR lpFileName) +{ + ASSERT(lpFileName!=NULL); + CString sFileName = lpFileName; + CDocTemplate* pDocTemplate = CanOpenDocument(sFileName); + if (pDocTemplate) + { + if(!m_pDoc) + { + m_pDoc = pDocTemplate->CreateNewDocument(); + m_pDoc->m_bAutoDelete = TRUE; + } + if (m_pDoc) + { + // load content of file, code taken from MFC OnOpenDocument and modified + /*CFileException fe; + ::CFile* pFile = m_pDoc->GetFile(sFileName, ::CFile::modeRead, &fe); + if (pFile == NULL) + return FALSE;*/ + + m_pDoc->DeleteContents(); + return m_pDoc->OnOpenDocument(sFileName); + /*CArchive loadArchive(pFile, CArchive::load | CArchive::bNoFlushOnDelete); + loadArchive.m_pDocument = m_pDoc; + loadArchive.m_bForceFlat = FALSE; + try + { + if (pFile->GetLength() != 0) + m_pDoc->Serialize(loadArchive); // load me + loadArchive.Close(); + m_pDoc->ReleaseFile(pFile, FALSE); + } + catch(CException *e) + { + //e->ReportError(); + m_pDoc->ReleaseFile(pFile, TRUE); + m_pDoc->DeleteContents(); // remove failed contents + e->Delete(); + return FALSE; + }*/ + // return TRUE; + //delete pDoc; + } + } + return FALSE; +} + +HBITMAP CExtractImageApp::CreateThumbnail(const SIZE bmSize) +{ + // HBITMAP hThumb; ::CBitmap bmpThumb; + if(!m_pDoc) return NULL; +/* + CSize bmDocSize = GetDocSize(); // derived class knows it + // Create memory DC, create a color bitmap, and draw on it + CDC memdc; + memdc.CreateCompatibleDC(NULL); + bmpThumb.CreateBitmap(bmSize.cx,bmSize.cy, + memdc.GetDeviceCaps(PLANES), memdc.GetDeviceCaps(BITSPIXEL),NULL); + ::CBitmap* pOldBm = memdc.SelectObject(&bmpThumb); + + memdc.PatBlt(0,0,bmSize.cx,bmSize.cy,WHITENESS); + + // TODO: You may choose to change the mapping here + memdc.SetMapMode(MM_ISOTROPIC); + memdc.SetViewportExt(bmSize.cx,-bmSize.cy); + memdc.SetWindowExt(bmDocSize.cx,bmDocSize.cy); + OnDraw(&memdc); //let the derived class to handle it + memdc.SelectObject(pOldBm); + hThumb = (HBITMAP)bmpThumb.Detach(); */ + return ((CTexGenThumbnailDoc*)m_pDoc)->CreateBitmap (); + // return hThumb; +} + +void CExtractImageApp::DeleteOpenDoc() +{ + if(m_pDoc != NULL) { + m_pDoc->OnCloseDocument(); //will delete m_pDoc + } +} + +int CExtractImageApp::ExitInstance() +{ + DeleteOpenDoc(); + return CWinApp::ExitInstance(); +} diff --git a/tools/tex_gen_thumbnail/ExtractImageApp.h b/tools/tex_gen_thumbnail/ExtractImageApp.h new file mode 100644 index 0000000..ac7286f --- /dev/null +++ b/tools/tex_gen_thumbnail/ExtractImageApp.h @@ -0,0 +1,31 @@ +// ExtractImageApp.h: interface for the CExtractImageApp class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_EXTRACTIMAGEAPP_H__49EA73DA_8B07_4EB8_9378_0662CFE4D5C5__INCLUDED_) +#define AFX_EXTRACTIMAGEAPP_H__49EA73DA_8B07_4EB8_9378_0662CFE4D5C5__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CExtractImageApp : public CWinApp +{ +protected: + CDocument* m_pDoc; // open doc + +public: + + CExtractImageApp(); + virtual ~CExtractImageApp(); + + virtual CDocTemplate* CanOpenDocument(LPCTSTR lpszPath); + virtual BOOL LoadDoc(LPCTSTR lpFileName); + virtual HBITMAP CreateThumbnail(const SIZE bmSize); + virtual void DeleteOpenDoc(); + virtual int ExitInstance(); + virtual void OnDraw(CDC *pDC) {}; + virtual CSize GetDocSize() { return CSize(100,100); } +}; + +#endif // !defined(AFX_EXTRACTIMAGEAPP_H__49EA73DA_8B07_4EB8_9378_0662CFE4D5C5__INCLUDED_) diff --git a/tools/tex_gen_thumbnail/IExtractImage.h b/tools/tex_gen_thumbnail/IExtractImage.h new file mode 100644 index 0000000..25a4f77 --- /dev/null +++ b/tools/tex_gen_thumbnail/IExtractImage.h @@ -0,0 +1,55 @@ +// IExtractImage.h +// content taken by shobjidl.h +// Philip Sakellaropoulos 2002 + +#ifndef __IExtractImage_FWD_DEFINED__ +#define __IExtractImage_FWD_DEFINED__ + +//BB2E617C-0920-11d1-9A0B-00C04FC2D6C1 +DEFINE_GUID(IID_IExtractImage, +0xBB2E617C, 0x0920, 0x11d1, 0x9A, 0x0B, 0x00, 0xC0, 0x4F, 0xC2, 0xD6, 0xC1); + +#define IEIFLAG_ASYNC 0x0001 // ask the extractor if it supports ASYNC extract (free threaded) +#define IEIFLAG_CACHE 0x0002 // returned from the extractor if it does NOT cache the thumbnail +#define IEIFLAG_ASPECT 0x0004 // passed to the extractor to beg it to render to the aspect ratio of the supplied rect +#define IEIFLAG_OFFLINE 0x0008 // if the extractor shouldn't hit the net to get any content neede for the rendering +#define IEIFLAG_GLEAM 0x0010 // does the image have a gleam ? this will be returned if it does +#define IEIFLAG_SCREEN 0x0020 // render as if for the screen (this is exlusive with IEIFLAG_ASPECT ) +#define IEIFLAG_ORIGSIZE 0x0040 // render to the approx size passed, but crop if neccessary +#define IEIFLAG_NOSTAMP 0x0080 // returned from the extractor if it does NOT want an icon stamp on the thumbnail +#define IEIFLAG_NOBORDER 0x0100 // returned from the extractor if it does NOT want an a border around the thumbnail +#define IEIFLAG_QUALITY 0x0200 // passed to the Extract method to indicate that a slower, higher quality image is desired, re-compute the thumbnail +#define IEIFLAG_REFRESH 0x0400 // returned from the extractor if it would like to have Refresh Thumbnail available + +//#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BB2E617C-0920-11d1-9A0B-00C04FC2D6C1") + IExtractImage : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetLocation( + /* [size_is][out] */ LPWSTR pszPathBuffer, + /* [in] */ DWORD cch, + /* [unique][out][in] */ DWORD *pdwPriority, + /* [in] */ const SIZE *prgSize, + /* [in] */ DWORD dwRecClrDepth, + /* [in] */ DWORD *pdwFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE Extract( + /* [out] */ HBITMAP *phBmpThumbnail) = 0; + + }; + + DEFINE_GUID(IID_IExtractImage2, + 0x953BB1EE, 0x93B4, 0x11d1, 0x98, 0xA3, 0x00, 0xC0, 0x4F, 0xB6, 0x87, 0xDA); + + MIDL_INTERFACE("953BB1EE-93B4-11d1-98A3-00C04FB687DA") + IExtractImage2 : public IExtractImage + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDateStamp( + /* [out] */ FILETIME *pDateStamp) = 0; + + }; + +#endif \ No newline at end of file diff --git a/tools/tex_gen_thumbnail/Resource.h b/tools/tex_gen_thumbnail/Resource.h new file mode 100644 index 0000000..f703a65 --- /dev/null +++ b/tools/tex_gen_thumbnail/Resource.h @@ -0,0 +1,17 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by tex_gen_thumbnail.rc +// +#define IDR_TEXGEN_TYPE 100 +#define IDR_THUMBSCB 2000 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 2007 +#define _APS_NEXT_COMMAND_VALUE 32772 +#define _APS_NEXT_CONTROL_VALUE 2000 +#define _APS_NEXT_SYMED_VALUE 2001 +#endif +#endif diff --git a/tools/tex_gen_thumbnail/StdAfx.cpp b/tools/tex_gen_thumbnail/StdAfx.cpp new file mode 100644 index 0000000..8b642e9 --- /dev/null +++ b/tools/tex_gen_thumbnail/StdAfx.cpp @@ -0,0 +1,13 @@ +// stdafx.cpp : source file that includes just the standard includes +// tex_gen_thumbnail.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + + + #ifdef _ATL_STATIC_REGISTRY +#include +#endif +#include + diff --git a/tools/tex_gen_thumbnail/StdAfx.h b/tools/tex_gen_thumbnail/StdAfx.h new file mode 100644 index 0000000..f233c7a --- /dev/null +++ b/tools/tex_gen_thumbnail/StdAfx.h @@ -0,0 +1,85 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__BA56C57E_75FC_4E34_A374_AEA259EB50FA__INCLUDED_) +#define AFX_STDAFX_H__BA56C57E_75FC_4E34_A374_AEA259EB50FA__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include // MFC core and standard components +#include // MFC extensions +#include // MFC templates + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC OLE classes +#include // MFC OLE dialog classes +#include // MFC Automation classes +#endif // _AFX_NO_OLE_SUPPORT + + +#ifndef _AFX_NO_DB_SUPPORT +#include // MFC ODBC database classes +#endif // _AFX_NO_DB_SUPPORT + +#ifndef _AFX_NO_DAO_SUPPORT +#include // MFC DAO database classes +#endif // _AFX_NO_DAO_SUPPORT + +#include // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + + + #define _ATL_APARTMENT_THREADED +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include + + +#undef min +#undef max + +#include "nel/misc/types_nl.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nel/misc/common.h" +#include "nel/misc/debug.h" + +#include "nel/misc/stream.h" +#include "nel/misc/time_nl.h" +#include "nel/misc/vector.h" +#include "nel/misc/matrix.h" +#include "nel/misc/bitmap.h" +#include "nel/misc/rgba.h" +#include "nel/misc/file.h" +#include "nel/misc/bitmap.h" +#include "nel/misc/path.h" + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__BA56C57E_75FC_4E34_A374_AEA259EB50FA__INCLUDED_) diff --git a/tools/tex_gen_thumbnail/TexGenThumbnailDoc.cpp b/tools/tex_gen_thumbnail/TexGenThumbnailDoc.cpp new file mode 100644 index 0000000..57e152d --- /dev/null +++ b/tools/tex_gen_thumbnail/TexGenThumbnailDoc.cpp @@ -0,0 +1,215 @@ +// TexGenThumbnailDoc.cpp : implementation of the CTexGenThumbnailDoc class +// +// This is a part of the Microsoft Foundation Classes C++ library. +// Copyright (C) 1992-1998 Microsoft Corporation +// All rights reserved. +// +// This source code is only intended as a supplement to the +// Microsoft Foundation Classes Reference and related +// electronic documentation provided with the library. +// See these sources for detailed information regarding the +// Microsoft Foundation Classes product. + +#include "stdafx.h" +//#include "TexGenThumbnail.h" + +#include "TexGenThumbnailDoc.h" + +#include "tex_gen/basics.h" +#include "tex_gen/bitmap_float.h" +#include "tex_gen/tex_gen_op.h" +#include "tex_gen_thumbnailapp.h" + +#include "tex_gen/tex_gen_document.h" + +using namespace NLMISC; +using namespace NLTEXGEN; + + +///////////////////////////////////////////////////////////////////////////// +// CTexGenThumbnailDoc + +IMPLEMENT_DYNCREATE(CTexGenThumbnailDoc, CDocument) + +BEGIN_MESSAGE_MAP(CTexGenThumbnailDoc, CDocument) + //{{AFX_MSG_MAP(CTexGenThumbnailDoc) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTexGenThumbnailDoc construction/destruction + +CTexGenThumbnailDoc::CTexGenThumbnailDoc() +{ + _Dib = NULL; + _DibBits = NULL; + // _Ddb = NULL; +} + +CTexGenThumbnailDoc::~CTexGenThumbnailDoc() +{ + if (_Dib) + nlverify(DeleteObject (_Dib)); + /* if (_Ddb) + nlverify(DeleteObject (_Ddb));*/ +} + +BOOL CTexGenThumbnailDoc::OnNewDocument() +{ + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// CTexGenThumbnailDoc serialization + +void CTexGenThumbnailDoc::Serialize(CArchive& ar) +{ + // TODO: Serialize your document here + if (ar.IsStoring()) + { + // ar << m_sizeDoc; + } + else + { + // ar >> m_sizeDoc; + } +} + +///////////////////////////////////////////////////////////////////////////// +// CTexGenThumbnailDoc diagnostics + +#ifdef _DEBUG +void CTexGenThumbnailDoc::AssertValid() const +{ + CDocument::AssertValid(); +} + +void CTexGenThumbnailDoc::Dump(CDumpContext& dc) const +{ + CDocument::Dump(dc); +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CTexGenThumbnailDoc commands + +BOOL CTexGenThumbnailDoc::OnOpenDocument(LPCTSTR lpszPathName) +{ + CIFile file; + if (file.open (lpszPathName)) + { + try + { + NLTEXGEN::CTexGenDocument doc; + file.serial(doc); + + CFloatBitmap bitmap; + CRenderParameter renderParameters (false, false, false); + doc.Operators[0]->eval (bitmap, renderParameters); + if ((bitmap.getWidth() != 0) && (bitmap.getHeight() != 0)) + { + bitmap.resample (m_sizeDoc.cx, m_sizeDoc.cy); + + _DibBitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFO); + _DibBitmapInfo.bmiHeader.biWidth = m_sizeDoc.cx; + _DibBitmapInfo.bmiHeader.biHeight = m_sizeDoc.cy; + _DibBitmapInfo.bmiHeader.biPlanes = 1; + _DibBitmapInfo.bmiHeader.biBitCount = 32; + _DibBitmapInfo.bmiHeader.biCompression = BI_RGB; + _DibBitmapInfo.bmiHeader.biSizeImage = 0; + _DibBitmapInfo.bmiHeader.biXPelsPerMeter = 0; + _DibBitmapInfo.bmiHeader.biYPelsPerMeter = 0; + _DibBitmapInfo.bmiHeader.biClrUsed = 0; + _DibBitmapInfo.bmiHeader.biClrImportant = 0; + HWND desktop = ::GetDesktopWindow(); + HDC dc = ::GetDC (desktop); + nlverify(_Dib = CreateDIBSection(dc, &_DibBitmapInfo, DIB_RGB_COLORS, (void**)&_DibBits, NULL, 0)); + + const float *pixels = bitmap.getPixels(); + if (pixels) + { + uint8 *dst = _DibBits; + const uint height = m_sizeDoc.cy; + uint y; + for (y=0; yEllipse(0,0,100,-100); + + // Draw the bitmap + if (_Ddb) + { + ::CBitmap *temp = ::CBitmap::FromHandle(_Ddb); + CDC dc2; + dc2.CreateCompatibleDC(pDC); + dc2.SelectObject (temp); + nlverify (pDC->BitBlt(0, 0, m_sizeDoc.cx, m_sizeDoc.cy, &dc2, 0, 0, SRCCOPY)); + } +}*/ + +HBITMAP CTexGenThumbnailDoc::CreateBitmap () +{ + // Create the bitmap + HWND desktop = ::GetDesktopWindow(); + HDC dc = ::GetDC (desktop); + HBITMAP hbmp; + nlverify (hbmp = CreateDIBitmap(dc, &(_DibBitmapInfo.bmiHeader), CBM_INIT, + _DibBits, &_DibBitmapInfo, DIB_RGB_COLORS)); + ::ReleaseDC (desktop, dc); + return hbmp; +} \ No newline at end of file diff --git a/tools/tex_gen_thumbnail/TexGenThumbnailDoc.h b/tools/tex_gen_thumbnail/TexGenThumbnailDoc.h new file mode 100644 index 0000000..9e96150 --- /dev/null +++ b/tools/tex_gen_thumbnail/TexGenThumbnailDoc.h @@ -0,0 +1,51 @@ +// TexGenThumbnailDoc.h : interface of the CTexGenThumbnailDoc class +// + +class CTexGenThumbnailDoc : public CDocument +{ +protected: // create from serialization only + CTexGenThumbnailDoc(); + DECLARE_DYNCREATE(CTexGenThumbnailDoc) + +protected: + CSize m_sizeDoc; +public: + virtual CSize GetDocSize() { return m_sizeDoc; } + // virtual void OnDraw(CDC* pDC); + HBITMAP CreateBitmap (); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTexGenThumbnailDoc) + public: + virtual BOOL OnNewDocument(); + virtual void Serialize(CArchive& ar); + virtual BOOL OnOpenDocument(LPCTSTR lpszPathName); + virtual void DeleteContents(); + //}}AFX_VIRTUAL + +// Implementation +protected: + + // DIB info + HBITMAP _Dib; + BITMAPINFO _DibBitmapInfo; + uint8 *_DibBits; + + // DDB info + // HBITMAP _Ddb; + +public: + virtual ~CTexGenThumbnailDoc(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + + +// Generated message map functions +protected: + //{{AFX_MSG(CTexGenThumbnailDoc) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; diff --git a/tools/tex_gen_thumbnail/TexGenThumbnailExtractor.cpp b/tools/tex_gen_thumbnail/TexGenThumbnailExtractor.cpp new file mode 100644 index 0000000..f00e43f --- /dev/null +++ b/tools/tex_gen_thumbnail/TexGenThumbnailExtractor.cpp @@ -0,0 +1,65 @@ +// TexGenThumbnailExtractor.cpp : Implementation of CTexGenThumbnailExtractor +#include "stdafx.h" +#include "tex_gen_thumbnailApp.h" +#include "ThumbTexGenThumbnail_i.h" +#include "TexGenThumbnailExtractor.h" +#include + +extern CTex_gen_thumbnailApp theApp; +///////////////////////////////////////////////////////////////////////////// +// CTexGenThumbnailExtractor + +HRESULT CTexGenThumbnailExtractor::GetLocation(LPWSTR pszPathBuffer, + DWORD cchMax, DWORD *pdwPriority, + const SIZE *prgSize, DWORD dwRecClrDepth, + DWORD *pdwFlags) +{ + AFX_MANAGE_STATE(AfxGetStaticModuleState()); + //*pdwFlags &= ~IEIFLAG_ASYNC; + // if (*pdwFlags & IEIFLAG_ASYNC) MessageBox(0,"async",0,0); + // if (*pdwFlags & IEIFLAG_ASPECT) MessageBox(0,"aspect",0,0); + //if (*pdwFlags & IEIFLAG_SCREEN) MessageBox(0,"screen",0,0); + + //*pdwFlags &= IEIFLAG_REFRESH; + m_bmSize = *prgSize; + if (*pdwFlags & IEIFLAG_ASYNC) return E_PENDING; + return NOERROR; +} + +HRESULT CTexGenThumbnailExtractor::Load(LPCOLESTR wszFile, DWORD dwMode) +{ + AFX_MANAGE_STATE(AfxGetStaticModuleState()); + + USES_CONVERSION; + _tcscpy(m_szFile, OLE2T((WCHAR*)wszFile)); + //MessageBox(0,m_szFile,0,0); + return S_OK; +}; + + // IExtractImage::Extract +HRESULT CTexGenThumbnailExtractor::Extract(HBITMAP* phBmpThumbnail) +{ + AFX_MANAGE_STATE(AfxGetStaticModuleState()); + + theApp.LoadDoc(m_szFile); + m_hPreview = theApp.CreateThumbnail(m_bmSize); + //::LoadBitmap(_Module.GetModuleInstance(),MAKEINTRESOURCE(IDB_BITMAP2)); + *phBmpThumbnail = m_hPreview; + return NOERROR; +} + +HRESULT CTexGenThumbnailExtractor::GetDateStamp(FILETIME *pDateStamp) +{ + AFX_MANAGE_STATE(AfxGetStaticModuleState()); + + FILETIME ftCreationTime,ftLastAccessTime,ftLastWriteTime; + // open the file and get last write time + HANDLE hFile = CreateFile(m_szFile,GENERIC_READ,FILE_SHARE_READ,NULL, + OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); + if(!hFile) return E_FAIL; + GetFileTime(hFile,&ftCreationTime,&ftLastAccessTime,&ftLastWriteTime); + CloseHandle(hFile); + *pDateStamp = ftLastWriteTime; + return NOERROR; +} + diff --git a/tools/tex_gen_thumbnail/TexGenThumbnailExtractor.h b/tools/tex_gen_thumbnail/TexGenThumbnailExtractor.h new file mode 100644 index 0000000..20d66d3 --- /dev/null +++ b/tools/tex_gen_thumbnail/TexGenThumbnailExtractor.h @@ -0,0 +1,80 @@ +// TexGenThumbnailExtractor.h : Declaration of the CTexGenThumbnailExtractor + +#ifndef __SCRIBBLEEXTRACTOR_H_ +#define __SCRIBBLEEXTRACTOR_H_ + +#include "resource.h" // main symbols +#include +#include +#include +//#include +#include "IExtractImage.h" + +///////////////////////////////////////////////////////////////////////////// +// CTexGenThumbnailExtractor +class ATL_NO_VTABLE CTexGenThumbnailExtractor : + public CComObjectRootEx, + public CComCoClass, + public IPersistFile, + public IExtractImage2 +{ +public: + CTexGenThumbnailExtractor() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_THUMBSCB) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CTexGenThumbnailExtractor) + COM_INTERFACE_ENTRY(IPersistFile) + COM_INTERFACE_ENTRY(IExtractImage) + COM_INTERFACE_ENTRY(IExtractImage2) +END_COM_MAP() + +// IExtractImage +public: + + STDMETHOD(GetLocation)(LPWSTR pszPathBuffer, + DWORD cchMax, + DWORD *pdwPriority, + const SIZE *prgSize, + DWORD dwRecClrDepth, + DWORD *pdwFlags); + STDMETHOD(Extract)(HBITMAP*); +// IExtractImage2 + STDMETHOD(GetDateStamp)(FILETIME *pDateStamp); + +// IPersistFile + STDMETHOD(Load)(LPCOLESTR wszFile, DWORD dwMode); + + STDMETHOD(GetClassID)(LPCLSID clsid) + { MessageBox(0,"GetClassID",0,0); + + return E_NOTIMPL; } + + STDMETHOD(IsDirty)(VOID) + { MessageBox(0,"IsDirty",0,0); + return E_NOTIMPL; } + + STDMETHOD(Save)(LPCOLESTR, BOOL) + { MessageBox(0,"Save",0,0); + return E_NOTIMPL; } + + STDMETHOD(SaveCompleted)(LPCOLESTR) + { + MessageBox(0,"SaveCompleted",0,0); + return E_NOTIMPL; } + + STDMETHOD(GetCurFile)(LPOLESTR FAR*) + { MessageBox(0,"GetCurFile",0,0); + return E_NOTIMPL; } + +private: + SIZE m_bmSize; + HBITMAP m_hPreview; + TCHAR m_szFile[500]; +}; + +#endif //__ICONEXTRACTOR_H_ diff --git a/tools/tex_gen_thumbnail/ThumbTexGenThumbnail.idl b/tools/tex_gen_thumbnail/ThumbTexGenThumbnail.idl new file mode 100644 index 0000000..06362ad --- /dev/null +++ b/tools/tex_gen_thumbnail/ThumbTexGenThumbnail.idl @@ -0,0 +1,38 @@ + + // ThumbTexGenThumbnail.idl : IDL source for tex_gen_thumbnail.exe +// +// This file will be processed by the MIDL tool to +// produce the type library (tex_gen_thumbnail.tlb) and marshalling code. +import "oaidl.idl"; +import "ocidl.idl"; + + [ + object, + uuid(D7580208-50CD-4F2D-B3EC-8F5C939A5B9F), + dual, + helpstring("ITexGenThumbnailExtractor Interface"), + pointer_default(unique) + ] + interface ITexGenThumbnailExtractor : IDispatch + { + }; + +[ + uuid(D16D4DBB-F1D7-43D2-8F83-89044C1A8006), + version(1.0), + helpstring("ThumbTexGenThumbnail 1.0 Type Library") +] +library THUMBTEXGENTHUMBNAILLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(CC651487-D734-49E4-9BFC-6E6D2D8AF9F7), + helpstring("TexGenThumbnailExtractor Class") + ] + coclass TexGenThumbnailExtractor + { + [default] interface ITexGenThumbnailExtractor; + }; +}; diff --git a/tools/tex_gen_thumbnail/ThumbTexGenThumbnail_i.c b/tools/tex_gen_thumbnail/ThumbTexGenThumbnail_i.c new file mode 100644 index 0000000..d5e3ac4 --- /dev/null +++ b/tools/tex_gen_thumbnail/ThumbTexGenThumbnail_i.c @@ -0,0 +1,50 @@ +/* this file contains the actual definitions of */ +/* the IIDs and CLSIDs */ + +/* link this file in with the server and any clients */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Tue Aug 05 01:54:00 2003 + */ +/* Compiler settings for R:\code\nel\tools\tex_gen\tex_gen_thumbnail\ThumbTexGenThumbnail.idl: + Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data +*/ +//@@MIDL_FILE_HEADING( ) +#ifdef __cplusplus +extern "C"{ +#endif + + +#ifndef __IID_DEFINED__ +#define __IID_DEFINED__ + +typedef struct _IID +{ + unsigned long x; + unsigned short s1; + unsigned short s2; + unsigned char c[8]; +} IID; + +#endif // __IID_DEFINED__ + +#ifndef CLSID_DEFINED +#define CLSID_DEFINED +typedef IID CLSID; +#endif // CLSID_DEFINED + +const IID IID_ITexGenThumbnailExtractor = {0xD7580208,0x50CD,0x4F2D,{0xB3,0xEC,0x8F,0x5C,0x93,0x9A,0x5B,0x9F}}; + + +const IID LIBID_THUMBTEXGENTHUMBNAILLib = {0xD16D4DBB,0xF1D7,0x43D2,{0x8F,0x83,0x89,0x04,0x4C,0x1A,0x80,0x06}}; + + +const CLSID CLSID_TexGenThumbnailExtractor = {0xCC651487,0xD734,0x49E4,{0x9B,0xFC,0x6E,0x6D,0x2D,0x8A,0xF9,0xF7}}; + + +#ifdef __cplusplus +} +#endif + diff --git a/tools/tex_gen_thumbnail/ThumbTexGenThumbnail_i.h b/tools/tex_gen_thumbnail/ThumbTexGenThumbnail_i.h new file mode 100644 index 0000000..13fa6c7 --- /dev/null +++ b/tools/tex_gen_thumbnail/ThumbTexGenThumbnail_i.h @@ -0,0 +1,202 @@ +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Tue Aug 05 01:54:00 2003 + */ +/* Compiler settings for R:\code\nel\tools\tex_gen\tex_gen_thumbnail\ThumbTexGenThumbnail.idl: + Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __ThumbTexGenThumbnail_i_h__ +#define __ThumbTexGenThumbnail_i_h__ + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +#ifndef __ITexGenThumbnailExtractor_FWD_DEFINED__ +#define __ITexGenThumbnailExtractor_FWD_DEFINED__ +typedef interface ITexGenThumbnailExtractor ITexGenThumbnailExtractor; +#endif /* __ITexGenThumbnailExtractor_FWD_DEFINED__ */ + + +#ifndef __TexGenThumbnailExtractor_FWD_DEFINED__ +#define __TexGenThumbnailExtractor_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class TexGenThumbnailExtractor TexGenThumbnailExtractor; +#else +typedef struct TexGenThumbnailExtractor TexGenThumbnailExtractor; +#endif /* __cplusplus */ + +#endif /* __TexGenThumbnailExtractor_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + +#ifndef __ITexGenThumbnailExtractor_INTERFACE_DEFINED__ +#define __ITexGenThumbnailExtractor_INTERFACE_DEFINED__ + +/* interface ITexGenThumbnailExtractor */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ITexGenThumbnailExtractor; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D7580208-50CD-4F2D-B3EC-8F5C939A5B9F") + ITexGenThumbnailExtractor : public IDispatch + { + public: + }; + +#else /* C style interface */ + + typedef struct ITexGenThumbnailExtractorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITexGenThumbnailExtractor __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITexGenThumbnailExtractor __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITexGenThumbnailExtractor __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITexGenThumbnailExtractor __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITexGenThumbnailExtractor __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITexGenThumbnailExtractor __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITexGenThumbnailExtractor __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + END_INTERFACE + } ITexGenThumbnailExtractorVtbl; + + interface ITexGenThumbnailExtractor + { + CONST_VTBL struct ITexGenThumbnailExtractorVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITexGenThumbnailExtractor_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITexGenThumbnailExtractor_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITexGenThumbnailExtractor_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITexGenThumbnailExtractor_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITexGenThumbnailExtractor_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITexGenThumbnailExtractor_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITexGenThumbnailExtractor_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ITexGenThumbnailExtractor_INTERFACE_DEFINED__ */ + + + +#ifndef __THUMBTEXGENTHUMBNAILLib_LIBRARY_DEFINED__ +#define __THUMBTEXGENTHUMBNAILLib_LIBRARY_DEFINED__ + +/* library THUMBTEXGENTHUMBNAILLib */ +/* [helpstring][version][uuid] */ + + +EXTERN_C const IID LIBID_THUMBTEXGENTHUMBNAILLib; + +EXTERN_C const CLSID CLSID_TexGenThumbnailExtractor; + +#ifdef __cplusplus + +class DECLSPEC_UUID("CC651487-D734-49E4-9BFC-6E6D2D8AF9F7") +TexGenThumbnailExtractor; +#endif +#endif /* __THUMBTEXGENTHUMBNAILLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/tex_gen_thumbnail/ThumbTexGenThumbnail_p.c b/tools/tex_gen_thumbnail/ThumbTexGenThumbnail_p.c new file mode 100644 index 0000000..0531e34 --- /dev/null +++ b/tools/tex_gen_thumbnail/ThumbTexGenThumbnail_p.c @@ -0,0 +1,207 @@ +/* this ALWAYS GENERATED file contains the proxy stub code */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Tue Aug 05 01:54:00 2003 + */ +/* Compiler settings for R:\code\nel\tools\tex_gen\tex_gen_thumbnail\ThumbTexGenThumbnail.idl: + Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data +*/ +//@@MIDL_FILE_HEADING( ) + +#define USE_STUBLESS_PROXY + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REDQ_RPCPROXY_H_VERSION__ +#define __REQUIRED_RPCPROXY_H_VERSION__ 440 +#endif + + +#include "rpcproxy.h" +#ifndef __RPCPROXY_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCPROXY_H_VERSION__ + + +#include "ThumbTexGenThumbnail_i.h" + +#define TYPE_FORMAT_STRING_SIZE 3 +#define PROC_FORMAT_STRING_SIZE 1 + +typedef struct _MIDL_TYPE_FORMAT_STRING + { + short Pad; + unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; + } MIDL_TYPE_FORMAT_STRING; + +typedef struct _MIDL_PROC_FORMAT_STRING + { + short Pad; + unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; + } MIDL_PROC_FORMAT_STRING; + + +extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString; +extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString; + + +/* Object interface: IUnknown, ver. 0.0, + GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ + + +/* Object interface: IDispatch, ver. 0.0, + GUID={0x00020400,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ + + +/* Object interface: ITexGenThumbnailExtractor, ver. 0.0, + GUID={0xD7580208,0x50CD,0x4F2D,{0xB3,0xEC,0x8F,0x5C,0x93,0x9A,0x5B,0x9F}} */ + + +extern const MIDL_STUB_DESC Object_StubDesc; + + +#pragma code_seg(".orpc") + +static const MIDL_STUB_DESC Object_StubDesc = + { + 0, + NdrOleAllocate, + NdrOleFree, + 0, + 0, + 0, + 0, + 0, + __MIDL_TypeFormatString.Format, + 1, /* -error bounds_check flag */ + 0x20000, /* Ndr library version */ + 0, + 0x50100a4, /* MIDL Version 5.1.164 */ + 0, + 0, + 0, /* notify & notify_flag routine table */ + 1, /* Flags */ + 0, /* Reserved3 */ + 0, /* Reserved4 */ + 0 /* Reserved5 */ + }; + +CINTERFACE_PROXY_VTABLE(7) _ITexGenThumbnailExtractorProxyVtbl = +{ + 0, + &IID_ITexGenThumbnailExtractor, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ , + 0 /* (void *)-1 /* IDispatch::GetTypeInfo */ , + 0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ , + 0 /* IDispatch_Invoke_Proxy */ +}; + + +static const PRPC_STUB_FUNCTION ITexGenThumbnailExtractor_table[] = +{ + STUB_FORWARDING_FUNCTION, + STUB_FORWARDING_FUNCTION, + STUB_FORWARDING_FUNCTION, + STUB_FORWARDING_FUNCTION +}; + +CInterfaceStubVtbl _ITexGenThumbnailExtractorStubVtbl = +{ + &IID_ITexGenThumbnailExtractor, + 0, + 7, + &ITexGenThumbnailExtractor_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + +#pragma data_seg(".rdata") + +#if !defined(__RPC_WIN32__) +#error Invalid build platform for this stub. +#endif + +#if !(TARGET_IS_NT40_OR_LATER) +#error You need a Windows NT 4.0 or later to run this stub because it uses these features: +#error -Oif or -Oicf, more than 32 methods in the interface. +#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems. +#error This app will die there with the RPC_X_WRONG_STUB_VERSION error. +#endif + + +static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString = + { + 0, + { + + 0x0 + } + }; + +static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString = + { + 0, + { + NdrFcShort( 0x0 ), /* 0 */ + + 0x0 + } + }; + +const CInterfaceProxyVtbl * _ThumbTexGenThumbnail_ProxyVtblList[] = +{ + ( CInterfaceProxyVtbl *) &_ITexGenThumbnailExtractorProxyVtbl, + 0 +}; + +const CInterfaceStubVtbl * _ThumbTexGenThumbnail_StubVtblList[] = +{ + ( CInterfaceStubVtbl *) &_ITexGenThumbnailExtractorStubVtbl, + 0 +}; + +PCInterfaceName const _ThumbTexGenThumbnail_InterfaceNamesList[] = +{ + "ITexGenThumbnailExtractor", + 0 +}; + +const IID * _ThumbTexGenThumbnail_BaseIIDList[] = +{ + &IID_IDispatch, + 0 +}; + + +#define _ThumbTexGenThumbnail_CHECK_IID(n) IID_GENERIC_CHECK_IID( _ThumbTexGenThumbnail, pIID, n) + +int __stdcall _ThumbTexGenThumbnail_IID_Lookup( const IID * pIID, int * pIndex ) +{ + + if(!_ThumbTexGenThumbnail_CHECK_IID(0)) + { + *pIndex = 0; + return 1; + } + + return 0; +} + +const ExtendedProxyFileInfo ThumbTexGenThumbnail_ProxyFileInfo = +{ + (PCInterfaceProxyVtblList *) & _ThumbTexGenThumbnail_ProxyVtblList, + (PCInterfaceStubVtblList *) & _ThumbTexGenThumbnail_StubVtblList, + (const PCInterfaceName * ) & _ThumbTexGenThumbnail_InterfaceNamesList, + (const IID ** ) & _ThumbTexGenThumbnail_BaseIIDList, + & _ThumbTexGenThumbnail_IID_Lookup, + 1, + 2, + 0, /* table of [async_uuid] interfaces */ + 0, /* Filler1 */ + 0, /* Filler2 */ + 0 /* Filler3 */ +}; diff --git a/tools/tex_gen_thumbnail/dlldata.c b/tools/tex_gen_thumbnail/dlldata.c new file mode 100644 index 0000000..2d77cb5 --- /dev/null +++ b/tools/tex_gen_thumbnail/dlldata.c @@ -0,0 +1,38 @@ +/********************************************************* + DllData file -- generated by MIDL compiler + + DO NOT ALTER THIS FILE + + This file is regenerated by MIDL on every IDL file compile. + + To completely reconstruct this file, delete it and rerun MIDL + on all the IDL files in this DLL, specifying this file for the + /dlldata command line option + +*********************************************************/ + +#define PROXY_DELEGATION + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_PROXY_FILE( ThumbTexGenThumbnail ) + + +PROXYFILE_LIST_START +/* Start of list */ + REFERENCE_PROXY_FILE( ThumbTexGenThumbnail ), +/* End of list */ +PROXYFILE_LIST_END + + +DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) + +#ifdef __cplusplus +} /*extern "C" */ +#endif + +/* end of generated dlldata file */ diff --git a/tools/tex_gen_thumbnail/res/tex_gen_thumbnail.rc2 b/tools/tex_gen_thumbnail/res/tex_gen_thumbnail.rc2 new file mode 100644 index 0000000..799b7aa --- /dev/null +++ b/tools/tex_gen_thumbnail/res/tex_gen_thumbnail.rc2 @@ -0,0 +1,13 @@ +// +// TEX_GEN_THUMBNAIL.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/tools/tex_gen_thumbnail/tex_gen_thumbnail.def b/tools/tex_gen_thumbnail/tex_gen_thumbnail.def new file mode 100644 index 0000000..c48a0a8 --- /dev/null +++ b/tools/tex_gen_thumbnail/tex_gen_thumbnail.def @@ -0,0 +1,11 @@ +; tex_gen_thumbnail.def : Declares the module parameters for the DLL. + +LIBRARY "tex_gen_thumbnail" +DESCRIPTION 'ThumbScb Windows Dynamic Link Library' + +EXPORTS + ; Explicit exports can go here + DllCanUnloadNow @1 PRIVATE + DllGetClassObject @2 PRIVATE + DllRegisterServer @3 PRIVATE + DllUnregisterServer @4 PRIVATE diff --git a/tools/tex_gen_thumbnail/tex_gen_thumbnail.dsp b/tools/tex_gen_thumbnail/tex_gen_thumbnail.dsp new file mode 100644 index 0000000..7e7727d --- /dev/null +++ b/tools/tex_gen_thumbnail/tex_gen_thumbnail.dsp @@ -0,0 +1,199 @@ +# Microsoft Developer Studio Project File - Name="tex_gen_thumbnail" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=tex_gen_thumbnail - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "tex_gen_thumbnail.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "tex_gen_thumbnail.mak" CFG="tex_gen_thumbnail - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "tex_gen_thumbnail - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "tex_gen_thumbnail - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "tex_gen_thumbnail - Win32 Release" + +# PROP BASE Use_MFC 2 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GR /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 freetype214MT.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing Registration on $(InputPath) +OutDir=.\Release +TargetPath=.\Release\tex_gen_thumbnail.dll +InputPath=.\Release\tex_gen_thumbnail.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "tex_gen_thumbnail - Win32 Debug" + +# PROP BASE Use_MFC 2 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /D "__STL_DEBUG" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 freetype214MT.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Performing Registration on $(InputPath) +OutDir=.\Debug +TargetPath=.\Debug\tex_gen_thumbnail.dll +InputPath=.\Debug\tex_gen_thumbnail.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "tex_gen_thumbnail - Win32 Release" +# Name "tex_gen_thumbnail - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\ExtractImageApp.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_thumbnail.def +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_thumbnail.rc +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_thumbnailApp.cpp +# End Source File +# Begin Source File + +SOURCE=.\TexGenThumbnailDoc.cpp +# End Source File +# Begin Source File + +SOURCE=.\TexGenThumbnailExtractor.cpp +# End Source File +# Begin Source File + +SOURCE=.\ThumbTexGenThumbnail.idl +# ADD MTL /tlb "./ThumbTexGenThumbnail.tlb" /h "ThumbTexGenThumbnail_i.h" /iid "ThumbTexGenThumbnail_i.c" /Oicf +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\ExtractImageApp.h +# End Source File +# Begin Source File + +SOURCE=.\IExtractImage.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_thumbnailApp.h +# End Source File +# Begin Source File + +SOURCE=.\TexGenThumbnailDoc.h +# End Source File +# Begin Source File + +SOURCE=.\TexGenThumbnailExtractor.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\tex_gen_thumbnail.rc2 +# End Source File +# Begin Source File + +SOURCE=.\tex_gen_thumbnail.rgs +# End Source File +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/tools/tex_gen_thumbnail/tex_gen_thumbnail.rc b/tools/tex_gen_thumbnail/tex_gen_thumbnail.rc new file mode 100644 index 0000000..f55947f --- /dev/null +++ b/tools/tex_gen_thumbnail/tex_gen_thumbnail.rc @@ -0,0 +1,161 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "ThumbTexGenThumbnail DLL\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "ThumbTexGenThumbnail\0" + VALUE "LegalCopyright", "Copyright (C) 2002\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "ThumbTexGenThumbnail.DLL\0" + VALUE "ProductName", "ThumbTexGenThumbnail Dynamic Link Library\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Greek resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ELL) +#ifdef _WIN32 +LANGUAGE LANG_GREEK, SUBLANG_DEFAULT +#pragma code_page(1253) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif //_WIN32\r\n" + "#include ""res\\tex_gen_thumbnail.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "1 TYPELIB ""ThumbTexGenThumbnail.tlb""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_THUMBSCB REGISTRY DISCARDABLE "tex_gen_thumbnail.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDR_TEXGEN_TYPE "\nTexGenThumbnail\nTexGenThumbnail\nTexGenThumbnail Files (*.texgen)\n.TEXGEN\nTexGenThumbnail.Document\nTexGenThumbnail Document" +END + +#endif // Greek resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif //_WIN32 +#include "res\tex_gen_thumbnail.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif +1 TYPELIB "ThumbTexGenThumbnail.tlb" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/tools/tex_gen_thumbnail/tex_gen_thumbnail.rgs b/tools/tex_gen_thumbnail/tex_gen_thumbnail.rgs new file mode 100644 index 0000000..8a50c23 --- /dev/null +++ b/tools/tex_gen_thumbnail/tex_gen_thumbnail.rgs @@ -0,0 +1,35 @@ +HKCR +{ + Thumbtex_gen_thumbnail.Extractor.1 = s 'tex_gen_thumbnail Thumbnail Extractor Class' + { + CLSID = s '{CC651487-D734-49E4-9BFC-6E6D2D8AF9F7}' + } + Thumbtex_gen_thumbnail.Extractor = s 'tex_gen_thumbnail Thumbnail Extractor Class' + { + CLSID = s '{CC651487-D734-49E4-9BFC-6E6D2D8AF9F7}' + CurVer = s 'Thumbtex_gen_thumbnail.Extractor.1' + } + NoRemove CLSID + { + ForceRemove {CC651487-D734-49E4-9BFC-6E6D2D8AF9F7} = s 'Extractor Class' + { + ProgID = s 'Thumbtex_gen_thumbnail.Extractor.1' + VersionIndependentProgID = s 'Thumbtex_gen_thumbnail.Extractor' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{D16D4DBB-F1D7-43D2-8F83-89044C1A8006}' + } + } + + NoRemove .texgen + { + shellex + { + {BB2E617C-0920-11d1-9A0B-00C04FC2D6C1} = s '{CC651487-D734-49E4-9BFC-6E6D2D8AF9F7}' + } + } + +} diff --git a/tools/tex_gen_thumbnail/tex_gen_thumbnailApp.cpp b/tools/tex_gen_thumbnail/tex_gen_thumbnailApp.cpp new file mode 100644 index 0000000..b722daf --- /dev/null +++ b/tools/tex_gen_thumbnail/tex_gen_thumbnailApp.cpp @@ -0,0 +1,137 @@ +// tex_gen_thumbnail.cpp : Defines the initialization routines for the DLL. +// + +#include "stdafx.h" +#include "tex_gen_thumbnailApp.h" +#include +#include "ThumbTexGenThumbnail_i.c" +#include "TexGenThumbnailExtractor.h" + +#include "TexGenThumbnailDoc.h" + +#include "tex_gen/basics.h" + +// +// Note! +// +// If this DLL is dynamically linked against the MFC +// DLLs, any functions exported from this DLL which +// call into MFC must have the AFX_MANAGE_STATE macro +// added at the very beginning of the function. +// +// For example: +// +// extern "C" BOOL PASCAL EXPORT ExportedFunction() +// { +// AFX_MANAGE_STATE(AfxGetStaticModuleState()); +// // normal function body here +// } +// +// It is very important that this macro appear in each +// function, prior to any calls into MFC. This means that +// it must appear as the first statement within the +// function, even before any object variable declarations +// as their constructors may generate calls into the MFC +// DLL. +// +// Please see MFC Technical Notes 33 and 58 for additional +// details. +// + +///////////////////////////////////////////////////////////////////////////// +// CTex_gen_thumbnailApp + +BEGIN_MESSAGE_MAP(CTex_gen_thumbnailApp, CWinApp) + //{{AFX_MSG_MAP(CTex_gen_thumbnailApp) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTex_gen_thumbnailApp construction + +CTex_gen_thumbnailApp::CTex_gen_thumbnailApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CTex_gen_thumbnailApp object + +CTex_gen_thumbnailApp theApp; + +BOOL CTex_gen_thumbnailApp::InitInstance() +{ + if (!InitATL()) + return FALSE; + + // Register texgen + NLTEXGEN::registerTypes(); + + // Create document template + AddDocTemplate(new CMultiDocTemplate( IDR_TEXGEN_TYPE, + RUNTIME_CLASS(CTexGenThumbnailDoc),RUNTIME_CLASS(CMDIChildWnd), RUNTIME_CLASS(CView))); + + return CWinApp::InitInstance(); +} + +void CTex_gen_thumbnailApp::OnDraw(CDC *pDC) +{ + /*CTexGenThumbnailDoc *mydoc = (CTexGenThumbnailDoc *)m_pDoc; + mydoc->OnDraw(pDC);*/ +} + +CSize CTex_gen_thumbnailApp::GetDocSize() +{ + CTexGenThumbnailDoc *mydoc = (CTexGenThumbnailDoc *)m_pDoc; + return mydoc->GetDocSize(); +} + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) + OBJECT_ENTRY(CLSID_TexGenThumbnailExtractor, CTexGenThumbnailExtractor) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry +STDAPI DllUnregisterServer(void) +{ + _Module.UnregisterServer(TRUE); //TRUE indicates that typelib is unreg'd + return S_OK; +} + +int CTex_gen_thumbnailApp::ExitInstance() +{ + _Module.Term(); + return CExtractImageApp::ExitInstance(); +} + +BOOL CTex_gen_thumbnailApp::InitATL() +{ + _Module.Init(ObjectMap, AfxGetInstanceHandle(),&LIBID_THUMBTEXGENTHUMBNAILLib); + return TRUE; +} diff --git a/tools/tex_gen_thumbnail/tex_gen_thumbnailApp.h b/tools/tex_gen_thumbnail/tex_gen_thumbnailApp.h new file mode 100644 index 0000000..77041ef --- /dev/null +++ b/tools/tex_gen_thumbnail/tex_gen_thumbnailApp.h @@ -0,0 +1,54 @@ +// tex_gen_thumbnail.h : main header file for the TEX_GEN_THUMBNAIL DLL +// + +#if !defined(AFX_THUMBSCB_H__4CCAB995_C650_42B1_ABBC_F85BBFC0D265__INCLUDED_) +#define AFX_THUMBSCB_H__4CCAB995_C650_42B1_ABBC_F85BBFC0D265__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols +#include "ThumbTexGenThumbnail_i.h" + +///////////////////////////////////////////////////////////////////////////// +// CTex_gen_thumbnailApp +// See tex_gen_thumbnail.cpp for the implementation of this class +// +#include "ExtractImageApp.h" + +class CTex_gen_thumbnailApp : public CExtractImageApp +{ +public: + CTex_gen_thumbnailApp(); + virtual void OnDraw(CDC *pDC); + virtual CSize GetDocSize(); +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTex_gen_thumbnailApp) + public: + virtual BOOL InitInstance(); + virtual int ExitInstance(); + //}}AFX_VIRTUAL + + //{{AFX_MSG(CTex_gen_thumbnailApp) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +private: + BOOL InitATL(); +}; + +extern CTex_gen_thumbnailApp theApp; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_THUMBSCB_H__4CCAB995_C650_42B1_ABBC_F85BBFC0D265__INCLUDED_)