Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/WolfireGames/overgrowth.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml1
-rw-r--r--Data/BlenderScript/2.49/phxbn_import.py284
-rw-r--r--Data/BlenderScript/2.71/test.py101
-rw-r--r--Data/BlenderScript/addons/export_physics.py85
-rw-r--r--Data/BlenderScript/addons/fixedconstraint.py72
-rw-r--r--Data/BlenderScript/addons/genericconstraint.py102
-rw-r--r--Data/BlenderScript/addons/hingeconstraint.py74
-rw-r--r--Data/BlenderScript/addons/io_anm/__init__.py38
-rw-r--r--Data/BlenderScript/addons/io_anm/anm_types.py64
-rw-r--r--Data/BlenderScript/addons/io_anm/export_anm.py822
-rw-r--r--Data/BlenderScript/addons/io_anm/import_anm.py433
-rw-r--r--Data/BlenderScript/addons/io_canm/__init__.py29
-rw-r--r--Data/BlenderScript/addons/io_canm/export_canm.py136
-rw-r--r--Data/BlenderScript/addons/io_obj_shape/__init__.py38
-rw-r--r--Data/BlenderScript/addons/io_obj_shape/export_obj_shape.py26
-rw-r--r--Data/BlenderScript/addons/io_obj_shape/import_obj_shape.py47
-rw-r--r--Data/BlenderScript/addons/io_phxbn/__init__.py38
-rw-r--r--Data/BlenderScript/addons/io_phxbn/export_phxbn.py608
-rw-r--r--Data/BlenderScript/addons/io_phxbn/import_phxbn.py560
-rw-r--r--Data/BlenderScript/addons/io_phxbn/phxbn_types.py42
-rw-r--r--Data/BlenderScript/addons/symmetricalize.py79
-rw-r--r--Data/BlenderScript/io/export_obj.py989
-rw-r--r--Data/BlenderScript/lipsyncbatch.au340
-rw-r--r--Libraries/FL/Enumerations.H959
-rw-r--r--Libraries/FL/Fl.H1174
-rw-r--r--Libraries/FL/Fl_Adjuster.H82
-rw-r--r--Libraries/FL/Fl_BMP_Image.H50
-rw-r--r--Libraries/FL/Fl_Bitmap.H85
-rw-r--r--Libraries/FL/Fl_Box.H69
-rw-r--r--Libraries/FL/Fl_Browser.H324
-rw-r--r--Libraries/FL/Fl_Browser_.H378
-rw-r--r--Libraries/FL/Fl_Button.H180
-rw-r--r--Libraries/FL/Fl_Cairo.H97
-rw-r--r--Libraries/FL/Fl_Cairo_Window.H92
-rw-r--r--Libraries/FL/Fl_Chart.H160
-rw-r--r--Libraries/FL/Fl_Check_Browser.H122
-rw-r--r--Libraries/FL/Fl_Check_Button.H60
-rw-r--r--Libraries/FL/Fl_Choice.H108
-rw-r--r--Libraries/FL/Fl_Clock.H137
-rw-r--r--Libraries/FL/Fl_Color_Chooser.H199
-rw-r--r--Libraries/FL/Fl_Counter.H124
-rw-r--r--Libraries/FL/Fl_Device.H558
-rw-r--r--Libraries/FL/Fl_Dial.H97
-rw-r--r--Libraries/FL/Fl_Double_Window.H81
-rw-r--r--Libraries/FL/Fl_Export.H49
-rw-r--r--Libraries/FL/Fl_File_Browser.H120
-rw-r--r--Libraries/FL/Fl_File_Chooser.H247
-rw-r--r--Libraries/FL/Fl_File_Icon.H168
-rw-r--r--Libraries/FL/Fl_File_Input.H106
-rw-r--r--Libraries/FL/Fl_Fill_Dial.H48
-rw-r--r--Libraries/FL/Fl_Fill_Slider.H47
-rw-r--r--Libraries/FL/Fl_Float_Input.H62
-rw-r--r--Libraries/FL/Fl_FormsBitmap.H56
-rw-r--r--Libraries/FL/Fl_FormsPixmap.H63
-rw-r--r--Libraries/FL/Fl_Free.H89
-rw-r--r--Libraries/FL/Fl_GIF_Image.H51
-rw-r--r--Libraries/FL/Fl_Gl_Window.H240
-rw-r--r--Libraries/FL/Fl_Group.H230
-rw-r--r--Libraries/FL/Fl_Help_Dialog.H95
-rw-r--r--Libraries/FL/Fl_Help_View.H396
-rw-r--r--Libraries/FL/Fl_Hold_Browser.H65
-rw-r--r--Libraries/FL/Fl_Hor_Fill_Slider.H46
-rw-r--r--Libraries/FL/Fl_Hor_Nice_Slider.H46
-rw-r--r--Libraries/FL/Fl_Hor_Slider.H60
-rw-r--r--Libraries/FL/Fl_Hor_Value_Slider.H46
-rw-r--r--Libraries/FL/Fl_Image.H215
-rw-r--r--Libraries/FL/Fl_Input.H277
-rw-r--r--Libraries/FL/Fl_Input_.H497
-rw-r--r--Libraries/FL/Fl_Input_Choice.H222
-rw-r--r--Libraries/FL/Fl_Int_Input.H61
-rw-r--r--Libraries/FL/Fl_JPEG_Image.H53
-rw-r--r--Libraries/FL/Fl_Light_Button.H59
-rw-r--r--Libraries/FL/Fl_Line_Dial.H46
-rw-r--r--Libraries/FL/Fl_Menu.H33
-rw-r--r--Libraries/FL/Fl_Menu_.H168
-rw-r--r--Libraries/FL/Fl_Menu_Bar.H89
-rw-r--r--Libraries/FL/Fl_Menu_Button.H86
-rw-r--r--Libraries/FL/Fl_Menu_Item.H443
-rw-r--r--Libraries/FL/Fl_Menu_Window.H68
-rw-r--r--Libraries/FL/Fl_Multi_Browser.H66
-rw-r--r--Libraries/FL/Fl_Multi_Label.H47
-rw-r--r--Libraries/FL/Fl_Multiline_Input.H75
-rw-r--r--Libraries/FL/Fl_Multiline_Output.H70
-rw-r--r--Libraries/FL/Fl_Native_File_Chooser.H305
-rw-r--r--Libraries/FL/Fl_Nice_Slider.H46
-rw-r--r--Libraries/FL/Fl_Object.H36
-rw-r--r--Libraries/FL/Fl_Output.H77
-rw-r--r--Libraries/FL/Fl_Overlay_Window.H79
-rw-r--r--Libraries/FL/Fl_PNG_Image.H55
-rw-r--r--Libraries/FL/Fl_PNM_Image.H52
-rw-r--r--Libraries/FL/Fl_Pack.H84
-rw-r--r--Libraries/FL/Fl_Paged_Device.H153
-rw-r--r--Libraries/FL/Fl_Pixmap.H99
-rw-r--r--Libraries/FL/Fl_Plugin.H104
-rw-r--r--Libraries/FL/Fl_Positioner.H103
-rw-r--r--Libraries/FL/Fl_PostScript.H253
-rw-r--r--Libraries/FL/Fl_Preferences.H276
-rw-r--r--Libraries/FL/Fl_Printer.H214
-rw-r--r--Libraries/FL/Fl_Progress.H81
-rw-r--r--Libraries/FL/Fl_RGB_Image.H35
-rw-r--r--Libraries/FL/Fl_Radio_Button.H46
-rw-r--r--Libraries/FL/Fl_Radio_Light_Button.H46
-rw-r--r--Libraries/FL/Fl_Radio_Round_Button.H46
-rw-r--r--Libraries/FL/Fl_Repeat_Button.H63
-rw-r--r--Libraries/FL/Fl_Return_Button.H60
-rw-r--r--Libraries/FL/Fl_Roller.H56
-rw-r--r--Libraries/FL/Fl_Round_Button.H57
-rw-r--r--Libraries/FL/Fl_Round_Clock.H48
-rw-r--r--Libraries/FL/Fl_Scroll.H199
-rw-r--r--Libraries/FL/Fl_Scrollbar.H120
-rw-r--r--Libraries/FL/Fl_Secret_Input.H64
-rw-r--r--Libraries/FL/Fl_Select_Browser.H64
-rw-r--r--Libraries/FL/Fl_Shared_Image.H114
-rw-r--r--Libraries/FL/Fl_Simple_Counter.H50
-rw-r--r--Libraries/FL/Fl_Single_Window.H67
-rw-r--r--Libraries/FL/Fl_Slider.H120
-rw-r--r--Libraries/FL/Fl_Spinner.H268
-rw-r--r--Libraries/FL/Fl_Sys_Menu_Bar.H80
-rw-r--r--Libraries/FL/Fl_Table.H1081
-rw-r--r--Libraries/FL/Fl_Table_Row.H211
-rw-r--r--Libraries/FL/Fl_Tabs.H92
-rw-r--r--Libraries/FL/Fl_Text_Buffer.H781
-rw-r--r--Libraries/FL/Fl_Text_Display.H480
-rw-r--r--Libraries/FL/Fl_Text_Editor.H141
-rw-r--r--Libraries/FL/Fl_Tile.H102
-rw-r--r--Libraries/FL/Fl_Tiled_Image.H70
-rw-r--r--Libraries/FL/Fl_Timer.H87
-rw-r--r--Libraries/FL/Fl_Toggle_Button.H60
-rw-r--r--Libraries/FL/Fl_Toggle_Light_Button.H37
-rw-r--r--Libraries/FL/Fl_Toggle_Round_Button.H37
-rw-r--r--Libraries/FL/Fl_Tooltip.H114
-rw-r--r--Libraries/FL/Fl_Tree.H1016
-rw-r--r--Libraries/FL/Fl_Tree_Item.H337
-rw-r--r--Libraries/FL/Fl_Tree_Item_Array.H90
-rw-r--r--Libraries/FL/Fl_Tree_Prefs.H343
-rw-r--r--Libraries/FL/Fl_Valuator.H144
-rw-r--r--Libraries/FL/Fl_Value_Input.H139
-rw-r--r--Libraries/FL/Fl_Value_Output.H95
-rw-r--r--Libraries/FL/Fl_Value_Slider.H69
-rw-r--r--Libraries/FL/Fl_Widget.H1006
-rw-r--r--Libraries/FL/Fl_Window.H465
-rw-r--r--Libraries/FL/Fl_Wizard.H70
-rw-r--r--Libraries/FL/Fl_XBM_Image.H50
-rw-r--r--Libraries/FL/Fl_XPM_Image.H51
-rw-r--r--Libraries/FL/Xutf8.h189
-rw-r--r--Libraries/FL/dirent.h34
-rw-r--r--Libraries/FL/filename.H180
-rw-r--r--Libraries/FL/fl_ask.H83
-rw-r--r--Libraries/FL/fl_draw.H784
-rw-r--r--Libraries/FL/fl_message.H32
-rw-r--r--Libraries/FL/fl_show_colormap.H58
-rw-r--r--Libraries/FL/fl_show_input.H32
-rw-r--r--Libraries/FL/fl_types.h66
-rw-r--r--Libraries/FL/fl_utf8.h263
-rw-r--r--Libraries/FL/forms.H845
-rw-r--r--Libraries/FL/gl.h112
-rw-r--r--Libraries/FL/gl2opengl.h35
-rw-r--r--Libraries/FL/gl_draw.H35
-rw-r--r--Libraries/FL/glu.h60
-rw-r--r--Libraries/FL/glut.H491
-rw-r--r--Libraries/FL/mac.H237
-rw-r--r--Libraries/FL/math.h71
-rw-r--r--Libraries/FL/names.h123
-rw-r--r--Libraries/FL/win32.H165
-rw-r--r--Libraries/FL/x.H199
-rw-r--r--Libraries/crunch-ea9b8d/CHANGELOG.md17
-rw-r--r--Libraries/crunch-ea9b8d/CMakeLists.txt219
-rw-r--r--Libraries/crunch-ea9b8d/README.md307
-rw-r--r--Libraries/crunch-ea9b8d/crn.2008.sln55
-rw-r--r--Libraries/crunch-ea9b8d/crn.workspace9
-rw-r--r--Libraries/crunch-ea9b8d/crn_examples.2008.sln74
-rw-r--r--Libraries/crunch-ea9b8d/crn_linux.workspace9
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/Makefile96
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_arealist.cpp698
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_arealist.h74
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_assert.cpp69
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_assert.h61
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_atomics.h208
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_buffer_stream.h196
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_cfile_stream.h241
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_checksum.cpp63
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_checksum.h13
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_clusterizer.h764
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_color.h994
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_colorized_console.cpp119
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_colorized_console.h19
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_command_line_params.cpp472
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_command_line_params.h86
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_comp.cpp2178
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_comp.h181
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_console.cpp222
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_console.h128
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_core.cpp14
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_core.h178
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_data_stream.cpp128
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_data_stream.h89
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_data_stream_serializer.h468
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dds_comp.cpp259
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dds_comp.h48
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_decomp.cpp6
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt.cpp386
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt.h361
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt1.cpp2171
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt1.h352
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt5a.cpp209
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt5a.h66
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt_endpoint_refiner.cpp362
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt_endpoint_refiner.h62
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt_fast.cpp916
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt_fast.h21
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc.cpp2544
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc.h439
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc_common.cpp47
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc_common.h43
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt_image.cpp1683
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dxt_image.h248
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dynamic_stream.h206
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dynamic_string.cpp668
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_dynamic_string.h173
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_etc.cpp1481
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_etc.h609
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_file_utils.cpp578
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_file_utils.h43
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_find_files.cpp287
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_find_files.h60
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_freeimage_image_utils.h158
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_hash.cpp68
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_hash.h34
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_hash_map.cpp155
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_hash_map.h876
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_helpers.h64
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_huffman_codes.cpp387
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_huffman_codes.h14
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_image.h723
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_image_utils.cpp1367
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_image_utils.h193
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_intersect.h123
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_jpgd.cpp3172
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_jpgd.h319
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_jpge.cpp1044
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_jpge.h169
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_ktx_texture.cpp920
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_ktx_texture.h244
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_lzma_codec.cpp142
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_lzma_codec.h60
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_math.cpp76
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_math.h237
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_matrix.h565
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_mem.cpp379
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_mem.h209
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_miniz.cpp3948
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_miniz.h893
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_mipmapped_texture.cpp3374
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_mipmapped_texture.h339
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_packed_uint.h91
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_pixel_format.cpp280
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_pixel_format.h284
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_platform.cpp92
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_platform.h96
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_prefix_coding.cpp356
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_prefix_coding.h116
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_qdxt1.cpp910
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_qdxt1.h185
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_qdxt5.cpp827
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_qdxt5.h194
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_radix_sort.h345
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_rand.cpp385
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_rand.h119
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_ray.h52
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_rect.h186
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_resample_filters.cpp337
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_resample_filters.h21
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_resampler.cpp884
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_resampler.h173
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_rg_etc1.cpp2449
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_rg_etc1.h80
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_ryg_dxt.cpp609
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_ryg_dxt.hpp29
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_ryg_types.hpp114
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_sparse_array.h399
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_sparse_bit_array.cpp538
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_sparse_bit_array.h176
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_stb_image.cpp3979
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_strutils.cpp613
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_strutils.h35
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_symbol_codec.cpp1901
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_symbol_codec.h519
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_texture_comp.cpp521
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_texture_comp.h33
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_texture_conversion.cpp772
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_texture_conversion.h115
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_texture_file_types.cpp105
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_texture_file_types.h68
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_threaded_clusterizer.h362
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_threaded_resampler.cpp322
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_threaded_resampler.h87
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_threading.h10
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_threading_null.h192
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_threading_pthreads.cpp408
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_threading_pthreads.h346
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_threading_win32.cpp428
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_threading_win32.h417
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_timer.cpp155
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_timer.h63
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_traits.h124
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_tree_clusterizer.h463
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_types.h62
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_utils.cpp72
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_utils.h275
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_value.cpp22
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_value.h1025
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_vec.h838
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_vec_interval.h35
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_vector.cpp83
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_vector.h708
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_vector2d.h155
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_winhdr.h19
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_zeng.cpp289
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crn_zeng.h10
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crnlib.2008.vcproj1635
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crnlib.cbp237
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crnlib.cpp459
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/crnlib_linux.cbp235
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzham_timer.cpp147
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzham_timer.h99
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzham_win32_threading.cpp220
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzham_win32_threading.h368
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_7zBuf.cpp41
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_7zBuf.h35
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_7zBuf2.cpp50
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_7zCrc.cpp40
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_7zCrc.h28
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_7zFile.cpp267
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_7zFile.h78
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_7zStream.cpp173
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_7zVersion.h7
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_Alloc.cpp131
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_Alloc.h36
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_Bcj2.cpp136
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_Bcj2.h34
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_Bra.cpp137
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_Bra.h64
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_Bra86.cpp89
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_BraIA64.cpp71
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_CpuArch.h69
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_LzFind.cpp755
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_LzFind.h111
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_LzFindMt.cpp797
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_LzFindMt.h101
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_LzHash.h54
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_LzmaDec.cpp1011
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_LzmaDec.h227
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_LzmaEnc.cpp2282
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_LzmaEnc.h76
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_LzmaLib.cpp50
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_LzmaLib.h146
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_MyVersion.h8
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_Threads.cpp116
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_Threads.h72
-rw-r--r--Libraries/crunch-ea9b8d/crnlib/lzma_Types.h214
-rw-r--r--Libraries/crunch-ea9b8d/crunch/corpus_gen.cpp357
-rw-r--r--Libraries/crunch-ea9b8d/crunch/corpus_gen.h20
-rw-r--r--Libraries/crunch-ea9b8d/crunch/corpus_test.cpp404
-rw-r--r--Libraries/crunch-ea9b8d/crunch/corpus_test.h28
-rw-r--r--Libraries/crunch-ea9b8d/crunch/crunch.2008.vcproj389
-rw-r--r--Libraries/crunch-ea9b8d/crunch/crunch.cbp58
-rw-r--r--Libraries/crunch-ea9b8d/crunch/crunch.cpp1352
-rw-r--r--Libraries/crunch-ea9b8d/crunch/crunch_linux.cbp83
-rw-r--r--Libraries/crunch-ea9b8d/emscripten/crunch_lib.cpp110
-rw-r--r--Libraries/crunch-ea9b8d/example1/example1.2008.vcproj716
-rw-r--r--Libraries/crunch-ea9b8d/example1/example1.cpp579
-rw-r--r--Libraries/crunch-ea9b8d/example1/stb_image.h3942
-rw-r--r--Libraries/crunch-ea9b8d/example2/example2.2008.vcproj712
-rw-r--r--Libraries/crunch-ea9b8d/example2/example2.cpp284
-rw-r--r--Libraries/crunch-ea9b8d/example2/timer.cpp153
-rw-r--r--Libraries/crunch-ea9b8d/example2/timer.h41
-rw-r--r--Libraries/crunch-ea9b8d/example3/example3.2008.vcproj716
-rw-r--r--Libraries/crunch-ea9b8d/example3/example3.cpp283
-rw-r--r--Libraries/crunch-ea9b8d/example3/stb_image.h3942
-rw-r--r--Libraries/crunch-ea9b8d/inc/crn_decomp.h4839
-rw-r--r--Libraries/crunch-ea9b8d/inc/crnlib.h642
-rw-r--r--Libraries/crunch-ea9b8d/inc/dds_defs.h152
-rw-r--r--Libraries/crunch-ea9b8d/license.txt22
-rw-r--r--Libraries/glew-urkle-core/CMakeLists.txt20
-rw-r--r--Libraries/glew-urkle-core/include/GL/glew.h19356
-rw-r--r--Libraries/glew-urkle-core/include/GL/glxew.h1776
-rw-r--r--Libraries/glew-urkle-core/include/GL/wglew.h1457
-rw-r--r--Libraries/glew-urkle-core/src/glew.c19764
-rw-r--r--Libraries/macogg/include/ogg/config_types.h1
-rw-r--r--Libraries/nvidia-texture-tools-read-only/CMakeLists.txt31
-rw-r--r--Libraries/nvidia-texture-tools-read-only/ChangeLog86
-rw-r--r--Libraries/nvidia-texture-tools-read-only/NVIDIA_Texture_Tools_LICENSE.txt24
-rw-r--r--Libraries/nvidia-texture-tools-read-only/NVIDIA_Texture_Tools_README.txt167
-rw-r--r--Libraries/nvidia-texture-tools-read-only/VERSION1
-rw-r--r--Libraries/nvidia-texture-tools-read-only/bin/nvcompress.exebin65536 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/bin/nvtt.dllbin110592 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/buildpkg7
-rw-r--r--Libraries/nvidia-texture-tools-read-only/cmake/DetermineProcessor.cmake34
-rw-r--r--Libraries/nvidia-texture-tools-read-only/cmake/FindCUDA.cmake164
-rw-r--r--Libraries/nvidia-texture-tools-read-only/cmake/FindCg.cmake172
-rw-r--r--Libraries/nvidia-texture-tools-read-only/cmake/FindDirectX.cmake38
-rw-r--r--Libraries/nvidia-texture-tools-read-only/cmake/FindFreeImage.cmake51
-rw-r--r--Libraries/nvidia-texture-tools-read-only/cmake/FindGLEW.cmake59
-rw-r--r--Libraries/nvidia-texture-tools-read-only/cmake/FindMaya.cmake67
-rw-r--r--Libraries/nvidia-texture-tools-read-only/cmake/FindOpenEXR.cmake79
-rw-r--r--Libraries/nvidia-texture-tools-read-only/cmake/OptimalOptions.cmake60
-rw-r--r--Libraries/nvidia-texture-tools-read-only/configure72
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/FreeImage/FreeImage.dllbin1937408 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/FreeImage/FreeImage.h1046
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/FreeImage/FreeImage.libbin58628 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/FreeImage/Whatsnew.txt898
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/FreeImage/license-fi.txt142
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/FreeImage/license-gpl.txt342
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/CMakeLists.txt7
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/jpeg62.dllbin127488 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/libpng12.dllbin161792 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/libtiff3.dllbin376832 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/zlib1.dllbin75264 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jconfig.h58
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jerror.h303
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jmorecfg.h426
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jpeglib.h1110
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/png.h3551
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/pngconf.h1481
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiff.h647
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiffconf.h101
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiffio.h549
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiffvers.h9
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/zconf.h332
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/zlib.h1357
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/jpeg.def103
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/jpeg.libbin24220 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libpng.def372
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libpng.libbin51878 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libpng12.def239
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libtiff.def154
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/tiff.libbin33502 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/zlib.def75
-rw-r--r--Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/zlib.libbin14778 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/include/nvtt/nvtt.h408
-rw-r--r--Libraries/nvidia-texture-tools-read-only/include/nvtt/nvtt_wrapper.h242
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvcore.abin54936 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvimage.abin225646 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvmath.abin91954 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvtt.abin163998 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/linux32/libposh.abin6180 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/linux32/libsquish.abin52208 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvcore.abin72202 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvimage.abin289042 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvmath.abin122680 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvtt.abin207694 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/linux64/libposh.abin8460 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/linux64/libsquish.abin59396 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/mac/libnvcore.abin42096 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/mac/libnvimage.abin160416 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/mac/libnvmath.abin77568 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/mac/libnvtt.abin120328 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/mac/libposh.abin4496 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/mac/libsquish.abin41400 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvcore.libbin295528 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvimage.libbin899306 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvmath.libbin613952 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvtt.libbin601712 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/win32debug/posh.libbin27674 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/win32debug/squish.libbin340710 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/win32release/nvcore.libbin1158830 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/win32release/nvimage.libbin2583186 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/win32release/nvmath.libbin2129348 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/win32release/nvtt.libbin2681722 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/win32release/posh.libbin30796 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/lib/win32release/squish.libbin1219580 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/Nvidia.TextureTools/Nvidia.TextureTools.csproj47
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/Nvidia.TextureTools/Properties/AssemblyInfo.cs35
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/Nvidia.TextureTools/TextureTools.cs526
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/PhotoshopExporter/PhotoshopExporter.cpp76
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/PhotoshopExporter/PhotoshopExporter.h27
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/PhotoshopExporter/PhotoshopExporter.vcproj234
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/nvassemble.rcbin3130 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/nvassemble.vcproj352
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/nvidia.icobin15086 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/resource.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/nvcompress.rcbin3130 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/nvcompress.vcproj688
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/nvidia.icobin15086 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/resource.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvconfig.h17
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvcore/nvcore.vcproj374
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/nvddsinfo.rcbin3130 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/nvddsinfo.vcproj351
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/nvidia.icobin15086 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/resource.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/nvdecompress.rcbin3130 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/nvdecompress.vcproj381
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/nvidia.icobin15086 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/resource.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvimage/nvimage.vcproj382
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/nvidia.icobin15086 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/nvimgdiff.rcbin3130 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/nvimgdiff.vcproj381
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/resource.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvmath/nvmath.vcproj330
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt.sln359
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt/nvtt.rc102
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt/nvtt.vcproj949
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt/resource.h14
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/nvidia.icobin15086 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/nvzoom.rcbin3130 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/nvzoom.vcproj381
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/resource.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/squish/squish.vcproj358
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc8/stress/stress.vcproj205
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/Nvidia.TextureTools/Nvidia.TextureTools.csproj53
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/Nvidia.TextureTools/Properties/AssemblyInfo.cs35
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/Nvidia.TextureTools/TextureTools.cs526
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/nvassemble.rcbin3130 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/nvassemble.vcproj353
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/nvidia.icobin15086 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/resource.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/nvcompress.rcbin3130 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/nvcompress.vcproj683
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/nvidia.icobin15086 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/resource.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvconfig.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvcore/nvcore.vcproj363
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/nvddsinfo.rcbin3130 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/nvddsinfo.vcproj352
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/nvidia.icobin15086 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/resource.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/nvdecompress.rcbin3130 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/nvdecompress.vcproj377
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/nvidia.icobin15086 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/resource.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvimage/nvimage.vcproj385
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/nvidia.icobin15086 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/nvimgdiff.rcbin3130 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/nvimgdiff.vcproj377
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/resource.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvmath/nvmath.vcproj319
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt.sln451
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt/nvtt.rc102
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt/nvtt.vcproj957
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt/resource.h14
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/nvidia.icobin15086 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/nvzoom.rcbin3130 -> 0 bytes
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/nvzoom.vcproj377
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/resource.h16
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/squish/squish.vcproj359
-rw-r--r--Libraries/nvidia-texture-tools-read-only/project/vc9/stress/stress.vcproj201
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/CMakeLists.txt136
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvconfig.h.in18
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Algorithms.h154
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/BitArray.h168
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/CMakeLists.txt88
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Constraints.h59
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Containers.h1011
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/CpuInfo.cpp162
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/CpuInfo.h109
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Debug.cpp537
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Debug.h130
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsGnucDarwin.h66
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsGnucLinux.h65
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsGnucWin32.h59
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsVcWin32.h78
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/FileSystem.cpp47
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/FileSystem.h21
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Library.cpp41
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Library.h50
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Memory.cpp119
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Memory.h60
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Prefetch.h30
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Ptr.h267
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Radix.cpp484
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Radix.h73
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/RefCounted.cpp9
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/RefCounted.h114
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/StdStream.h369
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/StrLib.cpp586
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/StrLib.h352
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Stream.h160
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/TextReader.cpp86
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/TextReader.h38
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/TextWriter.cpp45
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/TextWriter.h65
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/ThreadLocalStorage.h73
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Timer.h22
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Tokenizer.cpp259
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/Tokenizer.h99
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/nvcore.h172
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/poshlib/CMakeLists.txt7
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/poshlib/posh.c1006
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/poshlib/posh.h1007
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvcore/vsscanf_proxy_win64.masm124
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/BlockDXT.cpp625
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/BlockDXT.h224
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/CMakeLists.txt74
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorBlock.cpp429
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorBlock.h96
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorSpace.cpp70
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorSpace.h21
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/ConeMap.cpp122
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/ConeMap.h39
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/DirectDrawSurface.cpp1405
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/DirectDrawSurface.h159
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/Filter.cpp605
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/Filter.h219
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/FloatImage.cpp960
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/FloatImage.h274
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/HoleFilling.cpp849
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/HoleFilling.h98
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/Image.cpp151
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/Image.h83
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/ImageIO.cpp1825
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/ImageIO.h64
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMap.cpp141
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMap.h55
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMipmap.cpp99
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMipmap.h17
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/PixelFormat.h82
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/PsdFile.h70
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/Quantize.cpp219
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/Quantize.h31
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/TgaFile.h105
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvimage/nvimage.h22
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Basis.cpp228
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Basis.h81
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Bezier.cpp97
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Bezier.h33
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Box.h145
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/CMakeLists.txt42
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Color.h179
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Fitting.cpp168
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Fitting.h21
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Frustum.cpp76
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Frustum.h34
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Half.cpp563
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Half.h9
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/KahanSum.h38
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Matrix.h1017
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Montecarlo.cpp135
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Montecarlo.h103
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Plane.cpp17
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Plane.h77
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Polygon.cpp168
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Polygon.h45
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Quaternion.h179
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Random.cpp54
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Random.h368
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Solver.cpp739
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Solver.h20
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Sparse.cpp862
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Sparse.h200
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/SphericalHarmonic.cpp243
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/SphericalHarmonic.h420
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/TriBox.cpp226
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Triangle.cpp168
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Triangle.h81
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/TypeSerialization.cpp87
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/TypeSerialization.h34
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/Vector.h872
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvmath/nvmath.h146
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/CMakeLists.txt120
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressDXT.cpp649
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressDXT.h91
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressRGB.cpp239
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressRGB.h41
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressionOptions.cpp171
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressionOptions.h67
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/Compressor.cpp1148
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/Compressor.h79
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/InputOptions.cpp555
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/InputOptions.h123
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/OptimalCompressDXT.cpp445
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/OptimalCompressDXT.h52
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/OutputOptions.cpp109
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/OutputOptions.h77
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/QuickCompressDXT.cpp635
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/QuickCompressDXT.h50
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/SingleColorLookup.h580
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/Texture.cpp132
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/Texture.h47
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/Bitmaps.h1886
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CompressKernel.cu1733
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/ConvolveKernel.cu264
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaCompressDXT.cpp709
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaCompressDXT.h66
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaMath.h393
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaUtils.cpp195
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaUtils.h41
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/experimental/nvtt_experimental.cpp60
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/experimental/nvtt_experimental.h103
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/experimental/test.cpp61
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt.cpp57
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt.h408
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt_wrapper.cpp208
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt_wrapper.h242
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/CMakeLists.txt28
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/ChangeLog38
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/Doxyfile223
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/README35
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/alpha.cpp326
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/alpha.h41
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/clusterfit.cpp493
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/clusterfit.h83
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourblock.cpp278
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourblock.h43
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourfit.cpp59
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourfit.h55
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourset.cpp153
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourset.h69
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/config22
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/config.h55
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishgen.cpp158
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishgen2.cpp113
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishpng.cpp603
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishtest.cpp205
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/fastclusterfit.cpp600
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/fastclusterfit.h76
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/fastclusterlookup.inl1135
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/maths.cpp247
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/maths.h239
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/rangefit.cpp202
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/rangefit.h54
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd.h45
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd_3dnow.h213
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd_sse.h193
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd_ve.h178
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlechannelfit.cpp144
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlechannelfit.h53
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlecolourfit.cpp172
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlecolourfit.h58
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlecolourlookup.inl1040
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/squish.cpp225
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/squish.h244
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/weightedclusterfit.cpp593
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/weightedclusterfit.h78
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tests/ctest.c35
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tests/filtertest.cpp80
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tests/stress.cpp373
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/assemble.cpp189
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/benchmark.cpp374
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/cmdline.h68
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/compress.cpp536
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ddsinfo.cpp57
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/decompress.cpp175
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/imgdiff.cpp296
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/mpegenc.cpp344
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/resize.cpp183
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/configdialog.cpp170
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/configdialog.h69
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/configdialog.ui1043
-rw-r--r--Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/main.cpp34
-rw-r--r--Libraries/tinyxml/tinyxml.cpp1
-rw-r--r--Projects/CMakeLists.txt35
-rw-r--r--Source/Compat/Linux/linux_compat.cpp1
-rw-r--r--Source/Compat/Mac/mac_time.cpp35
-rw-r--r--Source/Compat/UNIX/unix_compat.cpp1
-rw-r--r--Source/Compat/UNIX/unix_filepath.cpp1
-rw-r--r--Source/Compat/Win/win_compat.cpp1
-rw-r--r--Source/Compat/Win/win_filepath.cpp1
-rw-r--r--Source/Compat/compat.h1
-rw-r--r--Source/Compat/platform.h (renamed from Source/Compat/Win/win_time.cpp)44
-rw-r--r--Source/Compat/platformsetup.h4
-rw-r--r--Source/Compat/time.cpp (renamed from Source/Compat/Linux/linux_time.cpp)19
-rw-r--r--Source/GUI/IMUI/imui.cpp76
-rw-r--r--Source/GUI/IMUI/imui.h3
-rw-r--r--Source/GUI/dimgui/dimgui_impl.cpp35
-rw-r--r--Source/Graphics/geometry.cpp330
-rw-r--r--Source/Graphics/geometry.h12
-rw-r--r--Source/Graphics/texturepack.cpp264
-rw-r--r--Source/Graphics/texturepack.h70
-rw-r--r--Source/Internal/error.cpp1
-rw-r--r--Source/Logging/logdata.h1
-rw-r--r--Source/Main/scenegraph.h1
-rw-r--r--Source/Timing/timestamp.h2
-rw-r--r--Source/Utility/stacktrace.h1
-rw-r--r--Source/Utility/timing.h1
776 files changed, 4782 insertions, 246570 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 7fa3d75c..00f7700a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -10,6 +10,7 @@ jobs:
matrix:
docker:
- 'registry.fedoraproject.org/fedora:latest'
+ - 'quay.io/centoshyperscale/centos:stream8'
fail-fast: false
container: ${{ matrix.docker }}
diff --git a/Data/BlenderScript/2.49/phxbn_import.py b/Data/BlenderScript/2.49/phxbn_import.py
new file mode 100644
index 00000000..4f6d8d0d
--- /dev/null
+++ b/Data/BlenderScript/2.49/phxbn_import.py
@@ -0,0 +1,284 @@
+#!BPY
+
+"""
+Name: 'Phoenix bones (.phxbn)...'
+Blender: 249
+Group: 'Import'
+Tip: 'Import a (.phxbn) skeleton file'
+"""
+
+__author__ = "Campbell Barton"
+__url__ = ("blender.org", "blenderartists.org")
+__version__ = "1.90 06/08/01"
+
+__bpydoc__ = """\
+This script imports PHXBN skeleton files to Blender.
+"""
+
+import Blender
+import bpy
+import BPyMessages
+import array
+Vector= Blender.Mathutils.Vector
+Euler= Blender.Mathutils.Euler
+Matrix= Blender.Mathutils.Matrix
+RotationMatrix = Blender.Mathutils.RotationMatrix
+TranslationMatrix= Blender.Mathutils.TranslationMatrix
+
+DEG2RAD = 0.017453292519943295
+
+class PHXBNdata:
+ def __init__(self):
+ self.vertices = []
+ self.bones = []
+ self.parents = []
+ self.bone_parents = []
+ self.bone_weights = array.array('f')
+ self.bone_ids = array.array('f')
+
+def ReadPHXBN(file_path, mesh_obj):
+ # File loading stuff
+ # Open the file for importing
+ file = open(file_path, 'rb')
+
+ print "\nLoading phxbn file: ", file_path
+ version = array.array('l')
+ version.fromfile(file, 1)
+ print 'Version: ', version[0], '\n'
+
+ rigging_stage = array.array('l')
+ rigging_stage.fromfile(file, 1)
+ #print 'Rigging stage: ', rigging_stage[0], '\n'
+
+ num_points = array.array('l')
+ num_points.fromfile(file, 1)
+ #print 'Num points: ', num_points[0], '\n'
+
+ data = PHXBNdata();
+
+ for i in range(0,num_points[0]):
+ vertex = array.array('f')
+ vertex.fromfile(file, 3)
+ data.vertices.append(vertex)
+
+ for i in range(0,num_points[0]):
+ parent = array.array('l')
+ parent.fromfile(file, 1)
+ data.parents.append(parent[0])
+
+ num_bones = array.array('l')
+ num_bones.fromfile(file, 1)
+ #print 'Num bones: ', num_bones[0], '\n'
+
+ for i in range(0,num_bones[0]):
+ bone = array.array('l')
+ bone.fromfile(file, 2)
+ data.bones.append(bone)
+
+ for i in range(0,num_bones[0]):
+ bone_parent = array.array('l')
+ bone_parent.fromfile(file, 1)
+ data.bone_parents.append(bone_parent[0])
+
+ bone_mass = array.array('f')
+ bone_mass.fromfile(file, num_bones[0])
+
+ bone_com = array.array('f')
+ bone_com.fromfile(file, num_bones[0]*3)
+
+ print bone_com[0]
+
+ mesh = mesh_obj.getData()
+
+ if rigging_stage[0] == 1:
+ num_faces = len(mesh.faces)
+ num_verts = num_faces * 3
+ print "Loading ", num_verts, " bone weights and ids"
+ file_bone_weights = array.array('f')
+ file_bone_ids = array.array('f')
+ file_bone_weights.fromfile(file, num_verts*4)
+ file_bone_ids.fromfile(file, num_verts*4)
+
+ num_verts = len(mesh.verts)
+ data.bone_weights = [0 for i in xrange(num_verts*4)]
+ data.bone_ids = [0 for i in xrange(num_verts*4)]
+ for face_id in xrange(num_faces):
+ for face_vert_num in xrange(3):
+ for i in xrange(4):
+ data.bone_weights[mesh.faces[face_id].v[face_vert_num].index*4+i] =file_bone_weights[face_id*12 + face_vert_num * 4 + i]
+ data.bone_ids[mesh.faces[face_id].v[face_vert_num].index*4+i] =file_bone_ids[face_id*12 + face_vert_num * 4 + i]
+
+ #print 'Vertices: ', data.vertices, '\n'
+
+ min_vec = Vector(mesh.verts[0].co)
+ max_vec = Vector(mesh.verts[0].co)
+ for vert in mesh.verts:
+ min_vec[0] = min(min_vec[0], vert.co[0])
+ min_vec[1] = min(min_vec[1], vert.co[1])
+ min_vec[2] = min(min_vec[2], vert.co[2])
+ max_vec[0] = max(max_vec[0], vert.co[0])
+ max_vec[1] = max(max_vec[1], vert.co[1])
+ max_vec[2] = max(max_vec[2], vert.co[2])
+
+ Blender.Window.EditMode(0)
+ center = (min_vec + max_vec)*0.5
+ print min_vec
+ print max_vec
+ print center
+ for vert in mesh.verts:
+ vert.co[0] = vert.co[0] - center[0]
+ vert.co[1] = vert.co[1] - center[1]
+ vert.co[2] = vert.co[2] - center[2]
+ mesh.update()
+
+ return data
+
+
+#=============#
+# TESTING #
+#=============#
+
+#('/metavr/mocap/bvh/boxer.bvh')
+#('/d/staggered_walk.bvh')
+#('/metavr/mocap/bvh/dg-306-g.bvh') # Incompleate EOF
+#('/metavr/mocap/bvh/wa8lk.bvh') # duplicate joint names, \r line endings.
+#('/metavr/mocap/bvh/walk4.bvh') # 0 channels
+
+'''
+import os
+DIR = '/metavr/mocap/bvh/'
+for f in ('/d/staggered_walk.bvh',):
+ #for f in os.listdir(DIR)[5:6]:
+ #for f in os.listdir(DIR):
+ if f.endswith('.bvh'):
+ s = Blender.Scene.New(f)
+ s.makeCurrent()
+ #file= DIR + f
+ file= f
+ print f
+ bvh_nodes= read_bvh(file, 1.0)
+ bvh_node_dict2armature(bvh_nodes, 1)
+'''
+
+def UI(file, PREF_UI= True):
+
+ if BPyMessages.Error_NoFile(file):
+ return
+
+ Draw= Blender.Draw
+
+ print 'Attempting import PHXBN:\n', file, '\n'
+
+ Blender.Window.WaitCursor(1)
+ # Get the BVH data and act on it.
+ t1= Blender.sys.time()
+ print 'Parsing phxbn...\n',
+ data = ReadPHXBN(file)
+ print '%.4f' % (Blender.sys.time()-t1)
+ t1= Blender.sys.time()
+ '''
+ print '\timporting to blender...',
+ if IMPORT_AS_ARMATURE: bvh_node_dict2armature(bvh_nodes, IMPORT_START_FRAME, IMPORT_LOOP)
+ if IMPORT_AS_EMPTIES: bvh_node_dict2objects(bvh_nodes, IMPORT_START_FRAME, IMPORT_LOOP)
+ '''
+ print 'Done in %.4f\n' % (Blender.sys.time()-t1)
+ Blender.Window.WaitCursor(0)
+
+def AddArmature(data, mesh_obj):
+ scn = bpy.data.scenes.active
+ arm_data = bpy.data.armatures.new()
+ arm_obj = scn.objects.new(arm_data)
+ arm_data.makeEditable()
+
+ num = 0
+ for data_bone in data.bones:
+ bone = Blender.Armature.Editbone()
+ bone.head = Vector(data.vertices[data_bone[0]][0],
+ data.vertices[data_bone[0]][1],
+ data.vertices[data_bone[0]][2])
+ bone.tail = Vector(data.vertices[data_bone[1]][0],
+ data.vertices[data_bone[1]][1],
+ data.vertices[data_bone[1]][2])
+ arm_data.bones["Bone_"+str(num)] = bone
+ num = num + 1
+
+
+ num = 0
+ for bone_parent in data.bone_parents:
+ name = "Bone_"+str(num);
+ parent_name = "Bone_"+str(bone_parent)
+ if bone_parent != -1:
+ arm_data.bones[name].parent = arm_data.bones[parent_name]
+ num = num + 1
+
+ arm_data.update()
+ arm_obj.link(arm_data)
+
+ vertgroup_created=[]
+ for bone in data.bones:
+ vertgroup_created.append(0)
+
+ mesh = mesh_obj.getData()
+ index = 0
+ vert_index = 0
+ for vert in mesh.verts:
+ for bone_num in range(0,4):
+ bone_id = int(data.bone_ids[index])
+ bone_weight = data.bone_weights[index]
+ name = "Bone_"+str(bone_id);
+ if vertgroup_created[bone_id]==0:
+ vertgroup_created[bone_id]=1
+ mesh.addVertGroup(name)
+ #assign the weight for this vertex
+ mesh.assignVertsToGroup(name, [vert_index], bone_weight, 'replace')
+ index = index + 1
+ vert_index = vert_index + 1
+ mesh.update()
+
+ arm_obj.makeParentDeform([mesh_obj], 0, 0)
+ arm_obj.drawMode = Blender.Object.DrawModes.XRAY
+
+def ReadObj(path):
+ name = path.split('\\')[-1].split('/')[-1]
+ mesh = Blender.NMesh.New( name )
+ file = open(path, 'r')
+ num_verts = 0;
+ for line in file:
+ words = line.split()
+ if len(words) == 0 or words[0].startswith('#'):
+ pass
+ elif words[0] == 'v':
+ x, y, z = float(words[1]), float(words[2]), float(words[3])
+ mesh.verts.append(Blender.NMesh.Vert(x, y, z))
+ num_verts = num_verts + 1
+ elif words[0] == 'f':
+ is_good = True;
+ faceVertList = []
+ for index_group in words[1:]:
+ index = index_group.split('/')[0]
+ if(int(index) > num_verts):
+ is_good = False
+ else:
+ faceVert = mesh.verts[int(index)-1]
+ faceVertList.append(faceVert)
+ if is_good:
+ newFace = Blender.NMesh.Face(faceVertList)
+ mesh.addFace(newFace)
+ ob = Blender.Object.New('Mesh', name)
+ ob.link(mesh) # tell the object to use the mesh we just made
+ scn = Blender.Scene.GetCurrent()
+ scn.link(ob)
+
+ return ob
+
+def main():
+ mesh_obj = ReadObj("C:\\Users\\David\\Desktop\\Wolfire SVN\\Project\\Data\\Models\\Characters\\IGF_Guard\\IGF_Guard.obj");
+ phxbn_data = ReadPHXBN("C:\\Users\\David\\Desktop\\Wolfire SVN\\Project\\Data\\Skeletons\\test.phxbn", mesh_obj);
+ AddArmature(phxbn_data, mesh_obj)
+
+ Blender.Redraw()
+ #Blender.Window.FileSelector(UI, 'Import PHXBN', '*.phxbn')
+
+if __name__ == '__main__':
+ #def foo():
+ main() \ No newline at end of file
diff --git a/Data/BlenderScript/2.71/test.py b/Data/BlenderScript/2.71/test.py
new file mode 100644
index 00000000..2d32dfe6
--- /dev/null
+++ b/Data/BlenderScript/2.71/test.py
@@ -0,0 +1,101 @@
+import bpy
+from xml.etree import cElementTree as ET
+
+print("\nRunning character loader:")
+
+working_dir = "C:/Users/David/Desktop/WolfireSVN/"
+
+actor_xml_path = working_dir + 'Data/Objects/IGF_Characters/IGF_GuardActor.xml'
+print("Loading actor file: "+actor_xml_path)
+xml_root = ET.parse(actor_xml_path).getroot()
+
+character_xml_path = None
+for element in xml_root:
+ if element.tag == "Character":
+ character_xml_path = element.text
+
+object_xml_path = None
+skeleton_xml_path = None
+if character_xml_path:
+ print("Loading character file: "+working_dir+character_xml_path)
+ xml_root = ET.parse(working_dir+character_xml_path).getroot()
+ for element in xml_root:
+ if(element.tag == "appearance"):
+ object_xml_path = element.get("obj_path")
+ skeleton_xml_path = element.get("skeleton")
+
+model_path = None
+color_path = None
+normal_path = None
+palette_map_path = None
+shader_name = None
+if object_xml_path:
+ print("Loading object file: "+working_dir+object_xml_path)
+ xml_root = ET.parse(working_dir+object_xml_path).getroot()
+ for element in xml_root:
+ if(element.tag == "Model"):
+ model_path = element.text
+ if(element.tag == "ColorMap"):
+ color_path = element.text
+ if(element.tag == "NormalMap"):
+ normal_path = element.text
+ if(element.tag == "PaletteMap"):
+ palette_map_path = element.text
+ if(element.tag == "ShaderName"):
+ shader_name = element.text
+
+bone_path = None
+if skeleton_xml_path:
+ print("Loading skeleton file: "+working_dir+skeleton_xml_path)
+ xml_root = ET.parse(working_dir+skeleton_xml_path).getroot()
+ print(xml_root)
+ model_path = xml_root.get("model_path")
+ bone_path = xml_root.get("bone_path")
+
+'''if model_path:
+ print("Model path: "+working_dir+model_path)
+ bpy.ops.import_scene.obj(filepath=(working_dir+model_path))
+'''
+
+_min_skeleton_version = 6
+
+import struct
+if bone_path:
+ print("Bone path: "+working_dir+bone_path)
+ with open(working_dir+bone_path, mode='rb') as file:
+ contents = file.read()
+ file.close()
+ cursor = 0;
+ temp_read = struct.unpack("i", contents[cursor:cursor+4])
+ cursor += 4
+ version = 5
+ if temp_read[0] >= _min_skeleton_version:
+ version = temp_read[0];
+ temp_read = struct.unpack("i", contents[cursor:cursor+4])
+ cursor += 4
+ print("Version: "+str(version))
+ print("Rigging stage: "+str(temp_read[0]))
+ num_points = struct.unpack("i", contents[cursor:cursor+4])[0]
+ cursor += 4
+ print("Num points: "+str(num_points))
+ points = []
+ for i in range(0, num_points):
+ points += struct.unpack("fff", contents[cursor:cursor+12])
+ cursor += 12
+
+ point_parents = []
+ if version >= 8:
+ for i in range(0, num_points):
+ point_parents += struct.unpack("i", contents[cursor:cursor+4])
+ cursor += 4
+
+ num_bones = struct.unpack("i", contents[cursor:cursor+4])[0]
+ cursor += 4
+ print("Num bones: "+str(num_bones))
+ bone_ends = []
+ bone_mats = []
+ for i in range(0, num_bones):
+ bone_ends += struct.unpack("ii", contents[cursor:cursor+8])
+ cursor += 8
+
+ print(bone_ends) \ No newline at end of file
diff --git a/Data/BlenderScript/addons/export_physics.py b/Data/BlenderScript/addons/export_physics.py
new file mode 100644
index 00000000..efb8fa16
--- /dev/null
+++ b/Data/BlenderScript/addons/export_physics.py
@@ -0,0 +1,85 @@
+import bpy
+import struct
+from bpy.props import *
+
+def GetWriteStream():
+ file_bytes = []
+ for obj in bpy.data.objects:
+ if obj.select:
+ obj_bytes = bytes()
+ obj_bytes += struct.pack("i",len(obj.name))
+ for c in obj.name:
+ obj_bytes += struct.pack("c", c)
+ obj.rotation_mode = 'QUATERNION'
+ q = obj.rotation_quaternion
+ obj_bytes += struct.pack("ffff", q[0], q[1], q[2], q[3])
+ l = obj.location
+ obj_bytes += struct.pack("fff", l[0], l[1], l[2])
+ s = obj.scale
+ obj_bytes += struct.pack("fff", s[0], s[1], s[2])
+ file_bytes.append(obj_bytes)
+
+ write_file_bytes = bytes()
+ write_file_bytes += struct.pack("BBBBBBBB", 211, ord('F'), ord('Z'), ord('X'), ord('\r'), ord('\n'), 32, ord('\n')) #Add file identification
+ write_file_bytes += struct.pack("i", 1) #Add version
+ write_file_bytes += struct.pack("i", len(file_bytes)) #Add number of objects
+ for obj_bytes in file_bytes:
+ write_file_bytes += obj_bytes #Add contents
+ write_file_bytes += struct.pack("i", len(write_file_bytes)) #Add size of file
+ write_file_bytes += struct.pack("BBB", ord('F'), ord('Z'), ord('X')) #Add file end marker
+ return write_file_bytes
+
+def WriteFZX(filepath, data):
+ file = open(filepath, "wb")
+ file.write(data)
+ file.close()
+
+def Save(filepath):
+ data = GetWriteStream()
+ if not data:
+ return
+ WriteFZX(filepath, data)
+
+class WolfireFZXExporter(bpy.types.Operator):
+ '''Save Phoenix bone physics primitives'''
+ bl_idname = "export_physics.fzx"
+ bl_label = "Export FZX"
+
+ filepath = StringProperty(name="File Path", description="Filepath used for exporting the FZX file", maxlen= 1024, default= "")
+
+ check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
+
+ def execute(self, context):
+ Save(self.properties.filepath)
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.add_fileselect(self)
+ return {'RUNNING_MODAL'}
+
+bl_addon_info = {
+ 'name': 'Import/Export: Phoenix collision physics (.fzx)...',
+ 'author': 'David Rosen',
+ 'version': '0.1',
+ 'blender': (2, 5, 5),
+ 'location': 'File > Import/Export > FZX',
+ 'description': 'Export Phoenix collision physics (.fzx format)',
+ 'warning': '', # used for warning icon and text in addons panel
+ 'category': 'Import/Export'}
+
+import bpy
+
+def menu_export(self, context):
+ import os
+ default_path = os.path.splitext(bpy.data.filepath)[0] + ".fzx"
+ self.layout.operator(WolfireFZXExporter.bl_idname, text="Phoenix Collision Physics (.fzx)").filepath = default_path
+
+def register():
+ bpy.types.INFO_MT_file_export.append(menu_export)
+
+def unregister():
+ bpy.types.INFO_MT_file_export.remove(menu_export)
+
+if __name__ == "__main__":
+ register()
diff --git a/Data/BlenderScript/addons/fixedconstraint.py b/Data/BlenderScript/addons/fixedconstraint.py
new file mode 100644
index 00000000..dbbb50cb
--- /dev/null
+++ b/Data/BlenderScript/addons/fixedconstraint.py
@@ -0,0 +1,72 @@
+from mathutils import Matrix, Vector
+import math
+
+"""
+This script adds a Phoenix fixed constraint
+"""
+
+bl_addon_info = {
+ 'name': 'Armature: Add fixed constraint',
+ 'author': 'David Rosen',
+ 'version': '1',
+ 'blender': (2, 5, 4),
+ 'location': 'Armature > Fixed constraint',
+ 'description': 'This script adds a Phoenix fixed constraint',
+ 'warning': '', # used for warning icon and text in addons panel
+ 'wiki_url': '',
+ 'tracker_url': '',
+ 'category': 'Armature'}
+
+import bpy
+
+def FixBoneRoll(context):
+ obj = bpy.context.scene.objects.active
+ bone = obj.data.edit_bones.active
+ if not bone:
+ print("Need to select a bone first...")
+ return
+
+ name = bone.name
+
+ bone = obj.data.edit_bones[name]
+ pose_bone = obj.pose.bones[bone.name]
+
+ constraint = pose_bone.constraints.new('LIMIT_ROTATION')
+ constraint.min_x = 0
+ constraint.max_x = 0
+ constraint.min_y = 0
+ constraint.max_y = 0
+ constraint.min_z = 0
+ constraint.max_z = 0
+ constraint.use_limit_x = True
+ constraint.use_limit_y = True
+ constraint.use_limit_z = True
+ constraint.name = "RGDL_Limit Rotation"
+ constraint.influence = 0.0
+ constraint.owner_space = 'LOCAL'
+
+class FixedConstraintOp(bpy.types.Operator):
+ '''Add fixed constraint'''
+ bl_idname = 'armature.fixedconstraint'
+ bl_label = 'Add fixed constraint'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ @classmethod
+ def poll(self, context):
+ obj = context.active_object
+ return (obj and obj.type == 'ARMATURE')
+
+ def execute(self, context):
+ FixBoneRoll(context)
+ return {'FINISHED'}
+
+menu_func = (lambda self, context: self.layout.operator(FixedConstraintOp.bl_idname, text="Fixed constraint"))
+
+def register():
+ bpy.types.VIEW3D_MT_edit_armature.append(menu_func)
+
+def unregister():
+ bpy.types.VIEW3D_MT_edit_armature.remove(menu_func)
+
+if __name__ == "__main__":
+ register()
diff --git a/Data/BlenderScript/addons/genericconstraint.py b/Data/BlenderScript/addons/genericconstraint.py
new file mode 100644
index 00000000..afe39153
--- /dev/null
+++ b/Data/BlenderScript/addons/genericconstraint.py
@@ -0,0 +1,102 @@
+from mathutils import Matrix, Vector
+import math
+
+"""
+This script adds a Phoenix generic rotation constraint
+"""
+
+bl_addon_info = {
+ 'name': 'Armature: Add generic constraint',
+ 'author': 'David Rosen',
+ 'version': '1',
+ 'blender': (2, 5, 4),
+ 'location': 'Armature > Generic constraint',
+ 'description': 'This script adds a Phoenix generic rotation constraint',
+ 'warning': '', # used for warning icon and text in addons panel
+ 'wiki_url': '',
+ 'tracker_url': '',
+ 'category': 'Armature'}
+
+import bpy
+
+def GetD6Mat(edit_bone):
+ vec = (edit_bone.tail - edit_bone.head).normalize()
+ vec = Vector((vec[0], vec[2], -vec[1]))
+ right = Vector((0.0001,1.0001,0.000003))
+ up = vec.cross(right).normalize()
+ right = up.cross(vec).normalize()
+
+ return [right[0], right[1], right[2], 0,
+ up[0], up[1], up[2], 0,
+ vec[0],vec[1], vec[2], 0,
+ 0,0,0,1]
+
+def FixBoneRoll(context):
+ obj = bpy.context.scene.objects.active
+ bone = obj.data.edit_bones.active
+ if not bone:
+ print("Need to select a bone first...")
+ return
+
+ name = bone.name
+
+ bpy.ops.object.mode_set(mode='POSE')
+ bpy.ops.object.mode_set(mode='EDIT')
+
+ bone = obj.data.edit_bones[name]
+
+ matrix = GetD6Mat(bone)
+ joint_axis = Vector((matrix[0], -matrix[2], matrix[1]))
+
+ pose_bone = obj.pose.bones[bone.name]
+
+ mat = obj.matrix_world * pose_bone.matrix
+ x_axis = Vector((mat[0][0], mat[0][1], mat[0][2])).normalize()
+ y_axis = Vector((mat[2][0], mat[2][1], mat[2][2])).normalize()
+ joint_conv = Vector((-x_axis.dot(joint_axis), -y_axis.dot(joint_axis), 0)).normalize()
+ roll = math.atan2(joint_conv[0], joint_conv[1])
+
+ print("Changing "+bone.name+" roll from "+str(bone.roll)+" to "+str(bone.roll+roll))
+ bone.roll += roll
+
+ pose_bone.rotation_mode = 'YXZ'
+
+ constraint = pose_bone.constraints.new('LIMIT_ROTATION')
+ constraint.min_x = -0.01745
+ constraint.max_x = 0.01745
+ constraint.min_y = -0.01745
+ constraint.max_y = 0.01745
+ constraint.min_z = -0.01745
+ constraint.max_z = 0.01745
+ constraint.name = "RGDL_Limit Rotation"
+ constraint.use_limit_x = True
+ constraint.use_limit_y = True
+ constraint.use_limit_z = True
+ constraint.influence = 0.0
+ constraint.owner_space = 'LOCAL'
+
+class BoneRollOp(bpy.types.Operator):
+ '''Add generic rotation constraint'''
+ bl_idname = 'armature.genericconstraint'
+ bl_label = 'Add generic rotation constraint'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ @classmethod
+ def poll(self, context):
+ obj = context.active_object
+ return (obj and obj.type == 'ARMATURE')
+
+ def execute(self, context):
+ FixBoneRoll(context)
+ return {'FINISHED'}
+
+menu_func = (lambda self, context: self.layout.operator(BoneRollOp.bl_idname, text="Rotation constraint"))
+
+def register():
+ bpy.types.VIEW3D_MT_edit_armature.append(menu_func)
+
+def unregister():
+ bpy.types.VIEW3D_MT_edit_armature.remove(menu_func)
+
+if __name__ == "__main__":
+ register()
diff --git a/Data/BlenderScript/addons/hingeconstraint.py b/Data/BlenderScript/addons/hingeconstraint.py
new file mode 100644
index 00000000..979ef88e
--- /dev/null
+++ b/Data/BlenderScript/addons/hingeconstraint.py
@@ -0,0 +1,74 @@
+from mathutils import Matrix, Vector
+import math
+
+"""
+This script adds a Phoenix hinge constraint
+"""
+
+bl_addon_info = {
+ 'name': 'Armature: Add hinge constraint',
+ 'author': 'David Rosen',
+ 'version': '1',
+ 'blender': (2, 5, 4),
+ 'location': 'Armature > Hinge constraint',
+ 'description': 'This script adds a Phoenix hinge constraint',
+ 'warning': '', # used for warning icon and text in addons panel
+ 'wiki_url': '',
+ 'tracker_url': '',
+ 'category': 'Armature'}
+
+import bpy
+
+def FixBoneRoll(context):
+ obj = bpy.context.scene.objects.active
+ bone = obj.data.edit_bones.active
+ if not bone:
+ print("Need to select a bone first...")
+ return
+
+ name = bone.name
+
+ bone = obj.data.edit_bones[name]
+ pose_bone = obj.pose.bones[bone.name]
+
+ pose_bone.rotation_mode = 'XYZ'
+
+ constraint = pose_bone.constraints.new('LIMIT_ROTATION')
+ constraint.min_x = -0.01745
+ constraint.max_x = 0.01745
+ constraint.min_y = 0
+ constraint.max_y = 0
+ constraint.min_z = 0
+ constraint.max_z = 0
+ constraint.name = "RGDL_Limit Rotation"
+ constraint.use_limit_x = True
+ constraint.use_limit_y = True
+ constraint.use_limit_z = True
+ constraint.influence = 0.0
+ constraint.owner_space = 'LOCAL'
+
+class HingeConstraintOp(bpy.types.Operator):
+ '''Add hinge constraint'''
+ bl_idname = 'armature.hingeconstraint'
+ bl_label = 'Add hinge constraint'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ @classmethod
+ def poll(self, context):
+ obj = context.active_object
+ return (obj and obj.type == 'ARMATURE')
+
+ def execute(self, context):
+ FixBoneRoll(context)
+ return {'FINISHED'}
+
+menu_func = (lambda self, context: self.layout.operator(HingeConstraintOp.bl_idname, text="Hinge constraint"))
+
+def register():
+ bpy.types.VIEW3D_MT_edit_armature.append(menu_func)
+
+def unregister():
+ bpy.types.VIEW3D_MT_edit_armature.remove(menu_func)
+
+if __name__ == "__main__":
+ register()
diff --git a/Data/BlenderScript/addons/io_anm/__init__.py b/Data/BlenderScript/addons/io_anm/__init__.py
new file mode 100644
index 00000000..5fd0af04
--- /dev/null
+++ b/Data/BlenderScript/addons/io_anm/__init__.py
@@ -0,0 +1,38 @@
+bl_addon_info = {
+ 'name': 'Import/Export: Phoenix animation (.anm)...',
+ 'author': 'David Rosen',
+ 'version': '0.1',
+ 'blender': (2, 5, 4),
+ 'location': 'File > Import/Export > ANM',
+ 'description': 'Import Phoenix animation (.anm format)',
+ 'warning': '', # used for warning icon and text in addons panel
+ 'category': 'Import/Export'}
+
+import bpy
+
+def menu_import(self, context):
+ from io_anm import import_anm
+ self.layout.operator(import_anm.ANMImporter.bl_idname, text="Phoenix Animation (.anm)").filepath = "*.anm"
+
+def menu_export(self, context):
+ from io_anm import export_anm
+ import os
+ default_path = os.path.splitext(bpy.data.filepath)[0] + ".anm"
+ self.layout.operator(export_anm.ANMExporter.bl_idname, text="Phoenix Animation (.anm)").filepath = default_path
+
+def register():
+ from io_anm import import_anm, export_anm
+ bpy.types.register(import_anm.ANMImporter)
+ bpy.types.register(export_anm.ANMExporter)
+ bpy.types.INFO_MT_file_import.append(menu_import)
+ bpy.types.INFO_MT_file_export.append(menu_export)
+
+def unregister():
+ from io_anm import import_anm, export_anm
+ #bpy.types.unregister(import_anm.ANMImporter)
+ #bpy.types.unregister(export_anm.ANMExporter)
+ bpy.types.INFO_MT_file_import.remove(menu_import)
+ bpy.types.INFO_MT_file_export.remove(menu_export)
+
+if __name__ == "__main__":
+ register()
diff --git a/Data/BlenderScript/addons/io_anm/anm_types.py b/Data/BlenderScript/addons/io_anm/anm_types.py
new file mode 100644
index 00000000..50abdc6e
--- /dev/null
+++ b/Data/BlenderScript/addons/io_anm/anm_types.py
@@ -0,0 +1,64 @@
+import array
+
+def Get4ByteIntArray():
+ var = array.array('l')
+ if var.itemsize != 4:
+ var = array.array('i')
+ return var
+
+class ShapeKey:
+ def __init__(self):
+ self.weight = 0.0
+ self.string = "null"
+ def __repr__(self):
+ return "(\""+self.string+"\", "+str(self.weight)+")"
+
+class StatusKey:
+ def __init__(self):
+ self.weight = 0.0
+ self.string = "null"
+ def __repr__(self):
+ return "(\""+self.string+"\", "+str(self.weight)+")"
+
+class IKBone:
+ def __init__(self):
+ self.start = array.array('f')
+ self.end = array.array('f')
+ self.bone_path = Get4ByteIntArray()
+ self.string = "null"
+ def __repr__(self):
+ return "(\""+self.string+"\", "+str(self.bone_path)+")"
+
+class Event:
+ def __init__(self):
+ self.which_bone = 0
+ self.string = ""
+ def __repr__(self):
+ return "(\""+self.string+"\", "+str(self.which_bone)+")"
+
+
+class Keyframe:
+ def __init__(self):
+ self.time = 0
+ self.weights = array.array('f')
+ self.mobility_mat = array.array('f')
+ self.mats = []
+ self.weapon_mats = []
+ self.weap_relative_ids = []
+ self.weap_relative_weights = []
+ self.events = []
+ self.ik_bones = []
+ self.shape_keys = []
+ self.status_keys = []
+ def __repr__(self):
+ return "("+str(self.time)+", "+str(len(self.mats))+")"
+
+class ANMdata:
+ def __init__(self):
+ self.version = 0
+ self.looping = 0
+ self.start = 0
+ self.end = 0
+ self.keyframes = []
+ self.name = ""
+
diff --git a/Data/BlenderScript/addons/io_anm/export_anm.py b/Data/BlenderScript/addons/io_anm/export_anm.py
new file mode 100644
index 00000000..493a7ff0
--- /dev/null
+++ b/Data/BlenderScript/addons/io_anm/export_anm.py
@@ -0,0 +1,822 @@
+import array
+import bpy
+from bpy.props import *
+from io_anm import anm_types
+import operator
+from mathutils import Matrix, Euler, Vector, Quaternion
+
+BONE_DEF_LAYER = 29
+MOBILITY_LAYER = 25
+WEAPON_DEF_LAYER = 24
+WEAPON_VIEW_LAYER = 16
+NUM_LAYERS = 32
+
+def Get4ByteIntArray(): # Creates an array with 4-byte components,
+ var = array.array('l') # regardless of whether that means 'l' or 'i'
+ if var.itemsize != 4:
+ var = array.array('i')
+ return var
+
+def AddConnectingBones(arm_data): # Add a bone between disconnected parent-child pairs,
+ for bone in arm_data.edit_bones: # such as the head and the ears.
+ if not bone.parent or \
+ bone.name == "root" or \
+ bone.parent.name == "root" or \
+ bone.layers[BONE_DEF_LAYER] == False or \
+ bone.parent.layers[BONE_DEF_LAYER] == False or \
+ bone.head == bone.parent.tail:
+ continue
+ bpy.ops.armature.bone_primitive_add(name="connector")
+ new_bone = arm_data.edit_bones[-1]
+ new_bone.head = bone.parent.tail
+ new_bone.tail = bone.head
+ new_bone.parent = bone.parent
+ for i in range(NUM_LAYERS):
+ new_bone.layers[i] = False
+ new_bone.layers[BONE_DEF_LAYER] = True
+ bone.parent = new_bone
+
+ bpy.context.scene.update()
+ bpy.ops.object.mode_set(mode='OBJECT')
+ bpy.ops.object.mode_set(mode='EDIT')
+
+class BoneNameTranslator():
+ def __init__(self, arm_data):
+ bone_labels = {} # {int bone_id, bool exists}
+ self.to_bone_map = {} # {string desc_label, string bone_id_label}
+ self.from_bone_map = {} # {string bone_id_label, string desc_label}
+ self.num_weapons = 0
+
+ for bone in arm_data.bones: # Handle bones that are already named "Bone_#"
+ if bone.name == "root" or bone.layers[BONE_DEF_LAYER] == False:
+ continue
+ if bone.name.split("_")[0] == "Bone":
+ bone_id = int(bone.name.split("_")[-1])
+ bone_labels[bone_id] = True
+ self.to_bone_map[bone.name] = bone.name
+ self.from_bone_map[bone.name] = bone.name
+
+ unused_bone_id = 0
+ for bone in arm_data.bones: # Rename and record all skeleton bones
+ if bone.name == "root" or bone.layers[BONE_DEF_LAYER] == False:
+ continue
+ if bone.name.split("_")[0] != "Bone":
+ while unused_bone_id in bone_labels:
+ unused_bone_id = unused_bone_id + 1
+ self.from_bone_map["Bone_"+str(unused_bone_id)] = bone.name
+ self.to_bone_map[bone.name] = "Bone_"+str(unused_bone_id)
+ bone.name = "Bone_"+str(unused_bone_id)
+ unused_bone_id = unused_bone_id+1
+
+ unused_weapon_id = 0
+ for bone in arm_data.bones: # Rename and record all weapon bones
+ if bone.name == "root" or \
+ bone.layers[WEAPON_DEF_LAYER] == False or \
+ bone.name.split('.')[0] == "connector":
+ continue
+ if bone.name.split("_")[0] != "Weap":
+ while unused_weapon_id in bone_labels:
+ unused_weapon_id = unused_weapon_id + 1
+ self.from_bone_map["Weap_"+str(unused_weapon_id)] = bone.name
+ self.to_bone_map[bone.name] = "Weap_"+str(unused_weapon_id)
+ bone.name = "Weap_"+str(unused_weapon_id)
+ unused_weapon_id += 1
+ self.num_weapons += 1
+ def ToBoneName(self,name):
+ return self.to_bone_map.get(name)
+ def FromBoneName(self,name):
+ return self.from_bone_map.get(name)
+
+def to_array(array, idarray): #Populate an array with elements from a list or dictionary
+ for item in idarray:
+ array.append(item)
+
+def GetInitialBoneMatZ(edit_bone): #Get initial bone matrix that is facing the z axis
+ z_vec = (edit_bone.tail - edit_bone.head).normalize()
+ x_vec = Vector((0,0,1))
+ y_vec = x_vec.cross(z_vec).normalize()
+ x_vec = y_vec.cross(z_vec).normalize()
+
+ return [x_vec[0], x_vec[2], -x_vec[1], 0,
+ y_vec[0], y_vec[2], -y_vec[1], 0,
+ z_vec[0], z_vec[2], -z_vec[1], 0,
+ 0,0,0,1]
+
+
+def GetInitialBoneMat(edit_bone): #Get initial bone matrix that is facing the y axis (or z if needed)
+ z_vec = (edit_bone.tail - edit_bone.head).normalize()
+ y_vec = Vector((0,1,0))
+ if abs(z_vec.dot(y_vec)) > 0.95:
+ return GetInitialBoneMatZ(edit_bone)
+ x_vec = z_vec.cross(y_vec).normalize()
+ y_vec = z_vec.cross(x_vec).normalize()
+
+ return [x_vec[0], x_vec[2], -x_vec[1], 0,
+ y_vec[0], y_vec[2], -y_vec[1], 0,
+ z_vec[0], z_vec[2], -z_vec[1], 0,
+ 0,0,0,1]
+
+initial_bone_mats = {} # { string name, float mat[16] }
+def CalcInitialBoneMats(data): # Calculate initial bone matrices if they are not already provided
+ for bone in data.edit_bones:
+ if not bone.get("mat"):
+ initial_bone_mats[bone.name] = GetInitialBoneMat(bone)
+ else:
+ initial_bone_mats[bone.name] = bone["mat"]
+
+def GetBoneMatrixRotation(arm_data, num, rotations, rotation_modes):
+ bone = arm_data.bones["Bone_"+str(num)]
+ if rotation_modes[num] == 'QUATERNION':
+ matrix = Quaternion(rotations[num]).normalize().to_matrix()
+ else:
+ matrix = Euler(rotations[num][0:3],rotation_modes[num]).to_matrix()
+
+ # Convert matrix to bone space
+ matrix = bone.matrix_local.to_3x3() * matrix * bone.matrix_local.copy().to_3x3().invert()
+
+ # Convert matrix to parent space by applying initial bone rotation
+ if initial_bone_mats[bone.name]:
+ mat = array.array('f')
+ to_array(mat, initial_bone_mats[bone.name])
+ initial_matrix = Matrix([mat[0], -mat[2], mat[1], mat[3]],
+ [mat[4], -mat[6], mat[5], mat[7]],
+ [mat[8], -mat[10], mat[9], mat[11]],
+ [mat[12], -mat[14], mat[13], mat[15]])
+ matrix = matrix.to_4x4() * initial_matrix
+ else:
+ print("Could not find: " + bone.name)
+
+ # Convert matrix to world space by recursively applying all parent rotations
+ parent = bone.parent
+ if not parent or parent.name == "root" or parent.layers[BONE_DEF_LAYER] == False or bone.layers[BONE_DEF_LAYER] == False:
+ return matrix
+ if initial_bone_mats.get(parent.name):
+ mat = array.array('f')
+ to_array(mat, initial_bone_mats[parent.name])
+ parent_initial_matrix = Matrix([mat[0], -mat[2], mat[1], mat[3]],
+ [mat[4], -mat[6], mat[5], mat[7]],
+ [mat[8], -mat[10], mat[9], mat[11]],
+ [mat[12], -mat[14], mat[13], mat[15]])
+
+ parent_num = int(parent.name.split("_")[-1])
+ parent_matrix = GetBoneMatrixRotation(arm_data, parent_num, rotations, rotation_modes)
+
+ matrix = parent_matrix * parent_initial_matrix.copy().invert() * matrix
+ return matrix
+
+def GetBoneMatrixTranslation(arm_data, num, rotations, rotation_modes):
+ bone = arm_data.bones["Bone_"+str(num)]
+
+ if rotation_modes[num] == 'QUATERNION':
+ matrix = Quaternion(rotations[num]).normalize().to_matrix()
+ else:
+ matrix = Euler(rotations[num][0:3],rotation_modes[num]).to_matrix()
+ matrix = bone.matrix_local * matrix.resize4x4()
+
+ # Convert matrix to world space by recursively applying all parent rotations
+ parent = bone.parent
+ if not parent or parent.name == "root" or parent.layers[BONE_DEF_LAYER] == False or bone.layers[BONE_DEF_LAYER] == False:
+ return matrix
+
+ parent_num = int(parent.name.split("_")[-1])
+ parent_matrix = GetBoneMatrixTranslation(arm_data, parent_num, rotations, rotation_modes) * parent.matrix_local.copy().invert()
+
+ matrix = parent_matrix * matrix
+
+ return matrix
+
+def GetNumJoints(arm_obj):
+ num = 0
+ for bone in arm_obj.pose.bones:
+ for constraint in bone.constraints:
+ if constraint.type == 'LIMIT_ROTATION' and constraint.owner_space == 'LOCAL':
+ num += 1
+ return num
+
+def KeyframeFromPose(arm_obj, rotations, rotation_modes, translation, num_joints):
+ arm_data = arm_obj.data
+ matrices = []
+
+ keyframe = anm_types.Keyframe()
+ for num in range(len(rotations)):
+ # Get rotation matrix, then set translation
+ matrix = GetBoneMatrixRotation(arm_data, num, rotations, rotation_modes)
+ trans_matrix = GetBoneMatrixTranslation(arm_data, num, rotations, rotation_modes)
+
+ bone = arm_data.bones["Bone_"+str(num)]
+ matrix[3] = trans_matrix * Vector((0,bone.length*0.5,0,1));
+ #matrix[3] = matrix[3] + Vector((translation[1], -translation[0], translation[2], 0))
+ matrix[3] = matrix[3] + Vector((translation[0], translation[1], translation[2], 0))
+ '''bpy.ops.object.add(type='EMPTY', location=(matrix[3][0]+3,matrix[3][1],matrix[3][2]))
+ ob = bpy.context.scene.objects.active
+ ob.empty_draw_type = 'ARROWS'
+ ob.empty_draw_size = 0.1
+ ob.rotation_mode = 'QUATERNION'
+ ob.rotation_quaternion = matrix.rotation_part().to_quat()'''
+
+ mat = array.array('f')
+ mat.fromlist([matrix[0][0], matrix[0][2], -matrix[0][1], matrix[0][3],
+ matrix[1][0], matrix[1][2], -matrix[1][1], matrix[1][3],
+ matrix[2][0], matrix[2][2], -matrix[2][1], matrix[2][3],
+ matrix[3][0], matrix[3][2], -matrix[3][1], matrix[3][3]])
+ keyframe.mats.append(mat)
+
+ return keyframe
+
+
+class KeyframeInfo:
+ def __init__(self):
+ self.weap_relative_weight = {}
+ self.weap_relative_id = {}
+ self.weap_translations = {}
+ self.weap_rotations = {}
+ self.mobility_translation = {}
+ self.mobility_rotation = {}
+ self.rotations = {}
+ self.rotation_modes = {}
+ self.weights = {}
+ self.translation = array.array('f')
+ self.translation.fromlist([0,0,0])
+ self.translation_offset = array.array('f')
+ self.translation_offset.fromlist([0,0,0])
+ self.ik_bones = []
+ self.shape_keys = []
+ self.status_keys = []
+ self.events = []
+ def __repr__(self):
+ string = ""
+ for bone_id in self.rotations:
+ string = string + "Bone " + str(bone_id) + ": \n"
+ string = string + str(self.rotations[bone_id])
+ string = string + "\n"
+ return string
+
+old_trans = {} # {string, Vector()} Initial translation of each bone
+
+# We are at a specific frame, so read back the bone matrix info
+def BakeBoneConstraints(bone,obj,old_obj,parent_matrix):
+ pose_bone = old_obj.pose.bones[bone.name]
+
+ inv_bone_matrix = bone.matrix_local.copy().invert()
+ inv_parent_matrix = parent_matrix.copy().invert()
+
+ matrix_local = inv_bone_matrix * inv_parent_matrix * pose_bone.matrix
+
+ # Set keyframes for local translation and rotation values
+ new_pose_bone = obj.pose.bones[bone.name]
+ new_pose_bone.location = matrix_local.translation_part()
+ new_pose_bone.keyframe_insert("location")
+
+ if new_pose_bone.rotation_mode == 'QUATERNION':
+ new_pose_bone.rotation_quaternion = matrix_local.to_quat().normalize()
+ new_pose_bone.keyframe_insert("rotation_quaternion")
+ else:
+ new_pose_bone.rotation_euler = matrix_local.to_euler(pose_bone.rotation_mode)
+ new_pose_bone.keyframe_insert("rotation_euler")
+
+ matrix = parent_matrix * bone.matrix_local * new_pose_bone.matrix_local * inv_bone_matrix
+
+ if bone.name != "root" and bone.layers[BONE_DEF_LAYER] == True:
+ mat = pose_bone.matrix
+ new_trans = mat.translation_part()
+ new_pose_bone.location = new_trans - old_trans[bone.name]*2
+ new_pose_bone.keyframe_insert("location")
+
+ if bone.layers[WEAPON_DEF_LAYER] == True or bone.name == "mobility":
+ old_pose_bone = old_obj.pose.bones[bone.name]
+ new_pose_bone = obj.pose.bones[bone.name]
+ new_pose_bone.location = (old_pose_bone.matrix[3][0],old_pose_bone.matrix[3][1],old_pose_bone.matrix[3][2])
+ new_pose_bone.keyframe_insert("location")
+ new_pose_bone.rotation_quaternion = old_pose_bone.matrix.to_quat().normalize()
+ new_pose_bone.keyframe_insert("rotation_quaternion")
+
+ for child in bone.children:
+ BakeBoneConstraints(child,obj,old_obj,matrix)
+
+#stretch_amount = 600
+stretch_amount = 1
+
+# Walk through each keyframe and bake all constraints
+def BakeConstraints(obj):
+ action = obj.animation_data.action
+
+ times = {}
+
+ for fcurve in action.fcurves:
+ for key in fcurve.keyframe_points:
+ key.co[0] = int(key.co[0]*stretch_amount)
+ key.handle_left[0] = int(key.handle_left[0]*stretch_amount)
+ key.handle_right[0] = int(key.handle_right[0]*stretch_amount)
+ times[key.co[0]] = True
+
+ sorted_times = []
+ for time in times:
+ sorted_times.append(time)
+ sorted_times.sort()
+
+ bpy.ops.object.duplicate()
+ new_obj = bpy.context.scene.objects.active
+
+ # Go to each frame in sequence so Blender calculates the bone matrices
+ frame = bpy.context.scene.frame_current
+ for time in sorted_times:
+ num = int(time)
+ bpy.context.scene.frame_set(num)
+ BakeBoneConstraints(obj.data.bones["root"], obj, new_obj, Matrix())
+ bpy.context.scene.frame_set(frame)
+ '''
+ action = new_obj.animation_data.action
+
+ bpy.ops.object.mode_set(mode='OBJECT')
+ bpy.ops.object.select_all(action = 'DESELECT')
+ bpy.context.scene.objects.active = new_obj
+ bpy.context.scene.objects.active.select = True'''
+ bpy.ops.object.delete()
+ bpy.context.scene.objects.active = obj
+
+ action.user_clear()
+
+ for fcurve in action.fcurves:
+ for key in fcurve.keyframe_points:
+ key.co[0] /= stretch_amount
+ key.handle_left[0] /= stretch_amount
+ key.handle_right[0] /= stretch_amount
+
+ bpy.ops.object.mode_set(mode='EDIT')
+ for bone in obj.data.edit_bones:
+ if bone.layers[BONE_DEF_LAYER] == False:
+ continue
+ while bone.parent and bone.parent.layers[BONE_DEF_LAYER] == False and bone.parent.parent:
+ bone.parent = bone.parent.parent
+ bpy.context.scene.update()
+ bpy.ops.object.mode_set(mode='OBJECT')
+ bpy.ops.object.mode_set(mode='EDIT')
+
+def GetAnimation(filepath):
+ old_arm_obj = bpy.context.scene.objects.active
+
+ if old_arm_obj.type != 'ARMATURE':
+ print("PHXBN armature must be selected")
+ return
+
+ #Create a copy of the armature object so we don't mess up the original
+ bpy.ops.object.mode_set(mode='OBJECT')
+ bpy.ops.object.duplicate()
+ arm_obj = bpy.context.scene.objects.active
+
+ #Add connecting bones between parent-child pairs that are not connected
+ bpy.ops.object.mode_set(mode='EDIT')
+ AddConnectingBones(arm_obj.data)
+
+ #Rename relevant bones to Bone_0, Bone_1, etc
+ tbr = BoneNameTranslator(arm_obj.data)
+
+ #txt_file = open(filepath+".txt", "w")
+ #for num in range(100):
+ # name = "Bone_"+str(num)
+ # if tbr.from_bone_map.get(name):
+ # txt_file.write(name+": "+tbr.from_bone_map.get(name)+'\n')
+
+ #Get initial root translation of each bone
+ for bone in arm_obj.data.edit_bones:
+ old_trans[bone.name] = bone.head - arm_obj.data.edit_bones["root"].head
+
+ #Get initial bone rotation of each bone (using OG Bullet physics orientations)
+ CalcInitialBoneMats(arm_obj.data)
+
+ #Bake the constraints into the bone matrices
+ bpy.ops.object.mode_set(mode='OBJECT')
+ BakeConstraints(arm_obj)
+
+ action = arm_obj.animation_data.action
+ if not action:
+ print("Armature must have an action")
+ return
+
+ #Create animation data structure and start extracting the easy data
+ data = anm_types.ANMdata()
+
+ if action.get("Looping"):
+ data.looping = action["Looping"]
+ else:
+ data.looping = False
+
+ if action.get("Start"):
+ data.start = action["Start"]
+ else:
+ data.start = int(bpy.context.scene.frame_start*1000/bpy.context.scene.render.fps)
+
+ if action.get("End"):
+ data.end = action["End"]
+ else:
+ data.end = int(bpy.context.scene.frame_end*1000/bpy.context.scene.render.fps)
+
+ if action.get("Version"):
+ data.version = action["Version"]
+ else:
+ data.version = 4
+
+ keyframes = {}
+
+ # Record all of the times that have keyframes on them
+ pose_bones = arm_obj.pose.bones
+ for fcurve in action.fcurves:
+ for keyframe in fcurve.keyframe_points:
+ time = round(keyframe.co[0]*1000/bpy.context.scene.render.fps)
+ if not time in keyframes:
+ keyframes[time] = KeyframeInfo()
+
+ # Get an ordered list of all the keyframe times
+ keyframe_times = []
+ for time in keyframes:
+ keyframe_times.append(time)
+ keyframe_times.sort()
+
+ # Sample each fcurve at each keyframe time
+ for fcurve in action.fcurves:
+ quote_split = fcurve.data_path.split("\"")
+ if len(quote_split) < 2:
+ continue
+ event_split = fcurve.data_path.split("event_")
+ if len(event_split) == 2:
+ event_name = event_split[1].split("\"")[0]
+ for keyframe in fcurve.keyframe_points:
+ time = round(keyframe.co[0]*1000/bpy.context.scene.render.fps)
+ key_info = keyframes[time]
+ event = []
+ event.append(event_name)
+ bone_name = quote_split[1]
+ bone_id = int(bone_name.split("_")[-1])
+ event.append(bone_id)
+ key_info.events.append(event)
+ continue
+ weight_split = fcurve.data_path.split("weight")
+ if len(weight_split) == 2:
+ for time in keyframes:
+ key_info = keyframes[time]
+ bone_name = quote_split[1]
+ bone_id = int(bone_name.split("_")[-1])
+ key_info.weights[bone_id] = fcurve.evaluate(time/1000*bpy.context.scene.render.fps)
+ continue
+ shape_split = fcurve.data_path.split("shape_")
+ if len(shape_split) == 2:
+ shape_name = shape_split[1].split("\"")[0]
+ for time in keyframes:
+ key_info = keyframes[time]
+ shape_key = []
+ shape_key.append(shape_name)
+ shape_key.append(fcurve.evaluate(time/1000*bpy.context.scene.render.fps))
+ key_info.shape_keys.append(shape_key)
+ continue
+ status_split = fcurve.data_path.split("status_")
+ if len(status_split) == 2:
+ status_name = status_split[1].split("\"")[0]
+ for time in keyframes:
+ key_info = keyframes[time]
+ status = []
+ status.append(status_name)
+ status.append(fcurve.evaluate(time/1000*bpy.context.scene.render.fps))
+ key_info.status_keys.append(status)
+ continue
+ if quote_split[1] == "root":
+ if fcurve.data_path.split(".")[-1] == "location":
+ array_index = fcurve.array_index
+ for time in keyframes:
+ key_info = keyframes[time]
+ key_info.translation[array_index] = fcurve.evaluate(time/1000*bpy.context.scene.render.fps)
+ continue
+ bone_name =quote_split[1]
+ if bone_name.split("_")[0] == "Weap":
+ weap_id = int(bone_name.split("_")[-1])
+ array_index = fcurve.array_index
+ path_end = fcurve.data_path.split(".")[-1]
+ if path_end == "location":
+ print("Handling weap location "+str(weap_id))
+ for time in keyframe_times:
+ val = fcurve.evaluate(time/1000*bpy.context.scene.render.fps)
+ key_info = keyframes[time]
+ if not weap_id in key_info.weap_translations:
+ key_info.weap_translations[weap_id] = [0,0,0]
+ key_info.weap_translations[weap_id][array_index] = val
+ continue
+ if path_end == "influence":
+ name = quote_split[3]
+ constraint = pose_bones[bone_name].constraints[name]
+ if constraint.type == 'CHILD_OF':
+ #print("Child of detected")
+ #print(fcurve.data_path)
+ #print(constraint.target)
+ #print(constraint.subtarget)
+
+ for time in keyframe_times:
+ val = fcurve.evaluate(time/1000*bpy.context.scene.render.fps)
+ key_info = keyframes[time]
+ key_info.weap_relative_id[weap_id] = int(constraint.subtarget.split("_")[-1])
+ key_info.weap_relative_weight[weap_id] = val
+ #print(str(time) + " " + str(key_info.weap_relative_id[weap_id]) + " " + str(key_info.weap_relative_weight[weap_id]))
+ continue
+ if path_end != "rotation_quaternion":
+ continue
+ for time in keyframe_times:
+ val = fcurve.evaluate(time/1000*bpy.context.scene.render.fps)
+ key_info = keyframes[time]
+ if not weap_id in key_info.weap_rotations:
+ key_info.weap_rotations[weap_id] = [0,0,0,0]
+ key_info.weap_rotations[weap_id][array_index] = val
+ if bone_name == "mobility":
+ array_index = fcurve.array_index
+ path_end = fcurve.data_path.split(".")[-1]
+ if path_end == "location":
+ print("Handling mobility location "+str(array_index))
+ for time in keyframe_times:
+ val = fcurve.evaluate(time/1000*bpy.context.scene.render.fps)
+ key_info = keyframes[time]
+ key_info.mobility_translation[array_index] = val
+ continue
+ if path_end == "rotation_quaternion":
+ print("Handling mobility rotation "+str(array_index))
+ for time in keyframe_times:
+ val = fcurve.evaluate(time/1000*bpy.context.scene.render.fps)
+ key_info = keyframes[time]
+ key_info.mobility_rotation[array_index] = val
+ if not bone_name.split("_")[0] == "Bone":
+ continue
+ bone_id = int(bone_name.split("_")[-1])
+ array_index = fcurve.array_index
+ path_end = fcurve.data_path.split(".")[-1]
+ if path_end == "influence":
+ name = quote_split[3]
+ constraint = pose_bones["Bone_"+str(bone_id)].constraints[name]
+ if constraint.type != 'IK' or constraint.target:
+ continue
+ ik_bone_data = []
+ ik_bone_data.append(name)
+ ik_bone_data.append(bone_id)
+ for time in keyframe_times:
+ if fcurve.evaluate(time/1000*bpy.context.scene.render.fps)>0.5 :
+ key_info = keyframes[time]
+ key_info.ik_bones.append(ik_bone_data)
+ if path_end == "location":
+ if pose_bones["Bone_"+str(bone_id)].parent.name == "root":
+ for time in keyframe_times:
+ key_info = keyframes[time]
+ key_info.translation_offset[array_index] = fcurve.evaluate(time/1000*bpy.context.scene.render.fps)
+ continue
+ if path_end != "rotation_euler" and path_end != "rotation_quaternion":
+ continue
+ for time in keyframe_times:
+ key_info = keyframes[time]
+ key_info.rotation_modes[bone_id] = pose_bones["Bone_"+str(bone_id)].rotation_mode
+ if not bone_id in key_info.rotations:
+ key_info.rotations[bone_id] = []
+ while array_index >= len(key_info.rotations[bone_id]):
+ key_info.rotations[bone_id].append(0)
+ key_info.rotations[bone_id][array_index] = fcurve.evaluate(time/1000*bpy.context.scene.render.fps)
+
+ num_joints = GetNumJoints(arm_obj)
+
+ if not arm_obj.data.layers[WEAPON_VIEW_LAYER]:
+ print("Not exporting weapons because weapon layer is hidden")
+ tbr.num_weapons = 0
+ print("Num weapons: "+str(tbr.num_weapons))
+ for time in keyframe_times:
+ rotations = keyframes[time].rotations
+ rotation_modes = keyframes[time].rotation_modes
+ keyframes[time].translation[0] = keyframes[time].translation_offset[0]
+ keyframes[time].translation[1] = keyframes[time].translation_offset[1]
+ keyframes[time].translation[2] = keyframes[time].translation_offset[2]
+ translation = keyframes[time].translation
+ # Get bone matrices from joint rotations and root translation
+ keyframe = KeyframeFromPose(arm_obj, rotations, rotation_modes, translation, num_joints)
+ keyframe.time = time
+
+ if len(keyframes[time].mobility_translation) == 3 and \
+ len(keyframes[time].mobility_rotation) == 4:
+ m_translation = keyframes[time].mobility_translation
+ m_rotation = keyframes[time].mobility_rotation
+ quat = Quaternion()
+ quat[0] = m_rotation[0]
+ quat[1] = m_rotation[1]
+ quat[2] = m_rotation[2]
+ quat[3] = m_rotation[3]
+ matrix = quat.to_matrix().to_4x4()
+ matrix[3][0] = m_translation[0]
+ matrix[3][1] = m_translation[1]
+ matrix[3][2] = m_translation[2]
+ mat = array.array('f')
+ mat.fromlist([matrix[0][0], matrix[0][2], -matrix[0][1], matrix[0][3],
+ matrix[1][0], matrix[1][2], -matrix[1][1], matrix[1][3],
+ matrix[2][0], matrix[2][2], -matrix[2][1], matrix[2][3],
+ matrix[3][0], matrix[3][2], -matrix[3][1], matrix[3][3]])
+ keyframe.mobility_mat = mat
+
+ for i in range(len(rotations)):
+ if i in keyframes[time].weights:
+ keyframe.weights.append(keyframes[time].weights[i])
+ else:
+ keyframe.weights.append(0.0)
+ for i in range(tbr.num_weapons):
+ w_translation = keyframes[time].weap_translations[i]
+ rotation = keyframes[time].weap_rotations[i]
+ quat = Quaternion()
+ quat[0] = rotation[0]
+ quat[1] = rotation[1]
+ quat[2] = rotation[2]
+ quat[3] = rotation[3]
+ matrix = quat.to_matrix().to_4x4()
+ matrix[3][0] = w_translation[0]
+ matrix[3][1] = w_translation[1] - 0.03
+ matrix[3][2] = w_translation[2] - 0.69
+ mat = array.array('f')
+ mat.fromlist([matrix[0][0], matrix[0][2], -matrix[0][1], matrix[0][3],
+ matrix[1][0], matrix[1][2], -matrix[1][1], matrix[1][3],
+ matrix[2][0], matrix[2][2], -matrix[2][1], matrix[2][3],
+ matrix[3][0], matrix[3][2], -matrix[3][1], matrix[3][3]])
+ keyframe.weapon_mats.append(mat)
+ if i in keyframes[time].weap_relative_id:
+ keyframe.weap_relative_ids.append(keyframes[time].weap_relative_id[i])
+ else:
+ keyframe.weap_relative_ids.append(-1)
+ if i in keyframes[time].weap_relative_weight:
+ keyframe.weap_relative_weights.append(keyframes[time].weap_relative_weight[i])
+ else:
+ keyframe.weap_relative_weights.append(0.0)
+ for shape_key_data in keyframes[time].shape_keys:
+ shape_key = anm_types.ShapeKey()
+ shape_key.string = shape_key_data[0]
+ shape_key.weight = shape_key_data[1]
+ keyframe.shape_keys.append(shape_key)
+ for status_key_data in keyframes[time].status_keys:
+ status_key = anm_types.StatusKey()
+ status_key.string = status_key_data[0]
+ status_key.weight = status_key_data[1]
+ keyframe.status_keys.append(status_key)
+ for event_data in keyframes[time].events:
+ event = anm_types.Event()
+ event.string = event_data[0]
+ event.which_bone = event_data[1]
+ keyframe.events.append(event)
+ for ik_bone_data in keyframes[time].ik_bones:
+ #print("Adding an IK bone")
+ ik_bone = anm_types.IKBone()
+ ik_bone.string = ik_bone_data[0]
+ bone_id = ik_bone_data[1]
+ constraint = pose_bones["Bone_"+str(bone_id)].constraints[ik_bone.string]
+ path_length = constraint.chain_count
+ ik_bone.bone_path.append(bone_id)
+ index = bone_id
+ for i in range(path_length-1):
+ index = int(pose_bones["Bone_"+str(index)].parent.name.split("_")[-1])
+ ik_bone.bone_path.append(index)
+ ik_bone.bone_path.reverse()
+ vec = pose_bones["Bone_"+str(ik_bone.bone_path[0])].head
+ ik_bone.start.fromlist([vec[0],vec[1],vec[2]])
+ vec = pose_bones["Bone_"+str(ik_bone.bone_path[-1])].tail
+ ik_bone.end.fromlist([vec[0],vec[1],vec[2]])
+ keyframe.ik_bones.append(ik_bone)
+
+ data.keyframes.append(keyframe)
+
+ bpy.ops.object.mode_set(mode='OBJECT')
+ bpy.ops.object.select_all(action = 'DESELECT')
+ bpy.context.scene.objects.active = arm_obj
+ bpy.context.scene.objects.active.select = True
+ bpy.ops.object.delete()
+ bpy.context.scene.objects.active = old_arm_obj
+
+ action.user_clear()
+
+ #data.keyframes.sort(key=operator.attrgetter('time'))
+ #print(data.keyframes)
+
+ return data
+
+def WriteFloat(file, val):
+ int_loader = array.array('f')
+ int_loader.append(val)
+ int_loader.tofile(file)
+
+def WriteInt(file, val):
+ int_loader = Get4ByteIntArray()
+ int_loader.append(val)
+ int_loader.tofile(file)
+
+def WriteBool(file, val):
+ bool_loader = array.array('B')
+ bool_loader.append(val)
+ bool_loader.tofile(file)
+
+def WriteANM(filepath, data):
+
+ #print(data.keyframes[0])
+ file = open(filepath, "wb")
+
+ data.version = 10
+ num_keyframes = len(data.keyframes)
+ WriteInt(file, data.version)
+ WriteBool(file, False)
+ WriteBool(file, data.looping)
+ WriteInt(file, int(data.start))
+ WriteInt(file, int(data.end))
+ WriteInt(file, num_keyframes)
+
+ '''print("\nItem sizes:")
+ print(array.array('B').itemsize)
+ print(array.array('l').itemsize)
+ print(array.array('h').itemsize)
+ print(array.array('i').itemsize)
+ print(array.array('L').itemsize)
+ print(array.array('f').itemsize)'''
+ '''
+ print("\n")
+ print(data.version)
+ print(data.looping)
+ print(data.start)
+ print(data.end)
+ print(num_keyframes)'''
+
+ for i in range(num_keyframes):
+ keyframe = data.keyframes[i]
+ WriteInt(file, keyframe.time)
+ num_weights = len(keyframe.weights)
+ WriteInt(file, num_weights)
+ keyframe.weights.tofile(file)
+ num_bone_mats = len(keyframe.mats)
+ WriteInt(file, num_bone_mats)
+ for j in range(num_bone_mats):
+ keyframe.mats[j].tofile(file)
+ num_weapon_mats = len(keyframe.weapon_mats)
+ WriteInt(file, num_weapon_mats)
+ for j in range(num_weapon_mats):
+ keyframe.weapon_mats[j].tofile(file)
+ WriteInt(file,keyframe.weap_relative_ids[j])
+ WriteFloat(file,keyframe.weap_relative_weights[j])
+ if len(keyframe.mobility_mat) > 0:
+ WriteBool(file, True)
+ keyframe.mobility_mat.tofile(file)
+ else :
+ WriteBool(file, False)
+ num_events = len(keyframe.events)
+ WriteInt(file, num_events)
+ for event in keyframe.events:
+ WriteInt(file, event.which_bone)
+ string_array = array.array("B")
+ string_array.fromstring(event.string.encode("utf-8"))
+ WriteInt(file, len(string_array))
+ string_array.tofile(file)
+ num_ik_bones = len(keyframe.ik_bones)
+ WriteInt(file, num_ik_bones)
+ for ik_bone in keyframe.ik_bones:
+ ik_bone.start.tofile(file)
+ ik_bone.end.tofile(file)
+ WriteInt(file, len(ik_bone.bone_path))
+ ik_bone.bone_path.tofile(file)
+ string_array = array.array("B")
+ string_array.fromstring(ik_bone.string.encode("utf-8"))
+ WriteInt(file, len(string_array))
+ string_array.tofile(file)
+ num_shape_keys = len(keyframe.shape_keys)
+ WriteInt(file, num_shape_keys)
+ for shape_key in keyframe.shape_keys:
+ WriteFloat(file, shape_key.weight)
+ string_array = array.array("B")
+ string_array.fromstring(shape_key.string.encode("utf-8"))
+ WriteInt(file, len(string_array))
+ string_array.tofile(file)
+ num_status_keys = len(keyframe.status_keys)
+ WriteInt(file, num_status_keys)
+ for status_key in keyframe.status_keys:
+ WriteFloat(file, status_key.weight)
+ string_array = array.array("B")
+ string_array.fromstring(status_key.string.encode("utf-8"))
+ WriteInt(file, len(string_array))
+ string_array.tofile(file)
+
+def Save(filepath):
+ data = GetAnimation(filepath)
+ if not data:
+ return
+ WriteANM(filepath, data)
+
+class ANMExporter(bpy.types.Operator):
+ '''Save Phoenix Bones armature'''
+ bl_idname = "export_mesh.anm"
+ bl_label = "Export ANM"
+
+ filepath = StringProperty(name="File Path", description="Filepath used for exporting the ANM file", maxlen= 1024, default= "")
+
+ check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
+
+ def execute(self, context):
+ Save(self.properties.filepath)
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.add_fileselect(self)
+ return {'RUNNING_MODAL'}
+
+#Save("C:\\Users\\David\\Desktop\\export.anm")
+#Save("Desktop/export.anm")
+#BakeConstraints(bpy.context.scene.objects.active)
+#Save("C:\\Users\\David\\Desktop\\WolfireSVN\\Project\\Data\\Animations\\r_bigdogswordattackover.anm")
diff --git a/Data/BlenderScript/addons/io_anm/import_anm.py b/Data/BlenderScript/addons/io_anm/import_anm.py
new file mode 100644
index 00000000..391dc13e
--- /dev/null
+++ b/Data/BlenderScript/addons/io_anm/import_anm.py
@@ -0,0 +1,433 @@
+import bpy
+from bpy.props import *
+import array
+import mathutils
+from mathutils import Vector, Matrix
+from io_anm import anm_types
+
+def Get4ByteIntArray():
+ var = array.array('l')
+ if var.itemsize != 4:
+ var = array.array('i')
+ return var
+
+class BoneNameTranslator():
+ def __init__(self, arm_data):
+ bone_labels = {}
+ self.to_bone_map = {}
+ self.from_bone_map = {}
+ num = 0
+ for bone in arm_data.bones:
+ if bone.name == "root" or bone.layers[0] == False:
+ continue
+ if bone.name.split("_")[0] == "Bone":
+ bone_id = int(bone.name.split("_")[-1])
+ bone_labels[bone_id] = True
+ self.to_bone_map[bone.name] = bone.name
+ self.from_bone_map[bone.name] = bone.name
+ num = num+1
+
+ index = 0
+ for bone in arm_data.bones:
+ if bone.name == "root" or bone.layers[0] == False:
+ continue
+ if bone.name.split("_")[0] != "Bone":
+ while index in bone_labels:
+ index = index + 1
+ self.from_bone_map["Bone_"+str(index)] = bone.name
+ self.to_bone_map[bone.name] = "Bone_"+str(index)
+ index = index+1
+ def ToBoneName(self,name):
+ return self.to_bone_map.get(name)
+ def FromBoneName(self,name):
+ return self.from_bone_map.get(name)
+
+def LoadInt(file):
+ int_loader = Get4ByteIntArray()
+ int_loader.fromfile(file, 1)
+ return int_loader[0]
+
+def LoadFloat(file):
+ float_loader = array.array('f')
+ float_loader.fromfile(file, 1)
+ return float_loader[0]
+
+def LoadBool(file):
+ bool_loader = array.array('B')
+ bool_loader.fromfile(file, 1)
+ return bool_loader[0]
+
+def GetBoneMatZ(edit_bone):
+ z_vec = (edit_bone.tail - edit_bone.head).normalize()
+ x_vec = Vector((0,0,1))
+ y_vec = x_vec.cross(z_vec).normalize()
+ x_vec = y_vec.cross(z_vec).normalize()
+
+ return [x_vec[0], x_vec[2], -x_vec[1], 0,
+ y_vec[0], y_vec[2], -y_vec[1], 0,
+ z_vec[0], z_vec[2], -z_vec[1], 0,
+ 0,0,0,1]
+
+
+def GetBoneMat(edit_bone):
+ z_vec = (edit_bone.tail - edit_bone.head).normalize()
+ y_vec = Vector((0,1,0))
+ if abs(z_vec.dot(y_vec)) > 0.95:
+ return GetBoneMatZ(edit_bone)
+ x_vec = z_vec.cross(y_vec).normalize()
+ y_vec = z_vec.cross(x_vec).normalize()
+
+ return [x_vec[0], x_vec[2], -x_vec[1], 0,
+ y_vec[0], y_vec[2], -y_vec[1], 0,
+ z_vec[0], z_vec[2], -z_vec[1], 0,
+ 0,0,0,1]
+
+def CalcBoneMats(data):
+ for bone in data.edit_bones:
+ if not bone.get("mat"):
+ bone["mat"] = GetBoneMat(bone)
+
+def ReadANM(filepath):
+ file = open(filepath, "rb")
+
+ data = anm_types.ANMdata()
+ data.name = filepath.split("\\")[-1]
+ data.version = LoadInt(file)
+ data.looping = LoadBool(file)
+ if data.version > 0:
+ data.start = LoadInt(file)
+ data.end = LoadInt(file)
+ num_keyframes = LoadInt(file)
+
+ for i in range(num_keyframes):
+ keyframe = anm_types.Keyframe()
+ keyframe.time = LoadInt(file)
+ if data.version >= 4:
+ num_weights = LoadInt(file)
+ keyframe.weights.fromfile(file, num_weights)
+ num_bone_mats = LoadInt(file)
+ for j in range(num_bone_mats):
+ mat = array.array('f')
+ mat.fromfile(file, 16)
+ keyframe.mats.append(mat)
+ if data.version >= 2:
+ num_events = LoadInt(file)
+ for j in range(num_events):
+ event = anm_types.Event()
+ event.which_bone = LoadInt(file)
+ string_size = LoadInt(file)
+ string_array = array.array("B")
+ string_array.fromfile(file, string_size)
+ event.string = string_array.tostring().decode("utf-8")
+ keyframe.events.append(event)
+ if data.version >= 3:
+ num_ik_bones = LoadInt(file)
+ for j in range(num_ik_bones):
+ ik_bone = anm_types.IKBone()
+ ik_bone.start.fromfile(file, 3)
+ ik_bone.end.fromfile(file, 3)
+ path_length = LoadInt(file)
+ ik_bone.bone_path.fromfile(file, path_length)
+ string_size = LoadInt(file)
+ string_array = array.array("B")
+ string_array.fromfile(file, string_size)
+ ik_bone.string = string_array.tostring().decode("utf-8")
+ keyframe.ik_bones.append(ik_bone)
+ #print(ik_bone)
+ if data.version >= 5:
+ num_shape_keys = LoadInt(file)
+ for j in range(num_shape_keys):
+ shape_key = anm_types.ShapeKey()
+ shape_key.weight = LoadFloat(file)
+ string_size = LoadInt(file)
+ string_array = array.array("B")
+ string_array.fromfile(file, string_size)
+ shape_key.string = string_array.tostring().decode("utf-8")
+ keyframe.shape_keys.append(shape_key)
+ if data.version >= 6:
+ num_status_keys = LoadInt(file)
+ for j in range(num_status_keys):
+ status_key = anm_types.StatusKey()
+ status_key.weight = LoadFloat(file)
+ string_size = LoadInt(file)
+ string_array = array.array("B")
+ string_array.fromfile(file, string_size)
+ status_key.string = string_array.tostring().decode("utf-8")
+ keyframe.status_keys.append(status_key)
+ data.keyframes.append(keyframe)
+
+
+ '''
+ print("Version: ", data.version)
+ print("Looping: ", data.looping)
+ print("Start: ", data.start)
+ print("End: ", data.end)
+ print("Num keyframes: ", len(data.keyframes))
+ id = 0
+ for keyframe in data.keyframes:
+ print("Keyframe ", id, ":")
+ print(" Time: ", keyframe.time)
+ print(" Weights: ", keyframe.weights)
+ print(" Mats: ", len(keyframe.mats))
+ print(" Events: ", keyframe.events)
+ print(" IKBones: ", keyframe.ik_bones)
+ '''
+ return data
+
+def to_array(array, idarray):
+ for item in idarray:
+ array.append(item)
+
+
+def PoseFromKeyframe(data, key_id, arm_obj):
+ arm_data = arm_obj.data
+ translation = []
+ matrices = []
+ for mat in data.keyframes[key_id].mats:
+ matrix = Matrix([mat[0], -mat[2], mat[1], mat[3]],
+ [mat[4], -mat[6], mat[5], mat[7]],
+ [mat[8], -mat[10], mat[9], mat[11]],
+ [mat[12], -mat[14], mat[13], mat[15]])
+
+ '''bpy.ops.object.add(type='EMPTY', location=(mat[12]+2, -mat[14], mat[13]))
+ ob = bpy.context.scene.objects.active
+ ob.empty_draw_type = 'ARROWS'
+ ob.empty_draw_size = 0.1
+ ob.rotation_mode = 'QUATERNION'
+ ob.rotation_quaternion = matrix.rotation_part().to_quat()'''
+ translation.append(matrix.translation_part())
+ matrices.append(matrix.rotation_part())
+
+ bpy.context.scene.objects.active = arm_obj
+
+ bnt = BoneNameTranslator(arm_data)
+ for bone in arm_data.bones:
+ if bnt.ToBoneName(bone.name):
+ bone.name = bnt.ToBoneName(bone.name)
+
+ initial_translation = []
+ initial_matrices = []
+ bone_matrices = []
+ inv_bone_matrices = []
+ num = 0
+ for iter_bone in arm_data.bones:
+ if iter_bone.name == "root" or iter_bone.layers[0] == False:
+ continue
+ name = "Bone_"+str(num)
+ bone = arm_data.bones[name]
+ bone.use_hinge
+ mat = array.array('f')
+ to_array(mat, bone["mat"])
+ matrix = Matrix([mat[0], -mat[2], mat[1], mat[3]],
+ [mat[4], -mat[6], mat[5], mat[7]],
+ [mat[8], -mat[10], mat[9], mat[11]],
+ [mat[12], -mat[14], mat[13], mat[15]])
+
+ initial_translation.append(matrix.translation_part())
+ initial_matrices.append(matrix.rotation_part())
+ bone_matrices.append(bone.matrix_local.rotation_part())
+ inv_bone_matrices.append(bone_matrices[-1].copy().invert())
+ '''
+ bpy.ops.object.add(type='EMPTY', location=(mat[12]+4, -mat[14], mat[13]))
+ ob = bpy.context.scene.objects.active
+ ob.empty_draw_type = 'ARROWS'
+ ob.empty_draw_size = 0.1
+ ob.rotation_mode = 'QUATERNION'
+ ob.rotation_quaternion = matrix.rotation_part().to_quat()
+
+ bpy.ops.object.add(type='EMPTY', location=(mat[12]+6, -mat[14], mat[13]))
+ ob = bpy.context.scene.objects.active
+ ob.empty_draw_type = 'ARROWS'
+ ob.empty_draw_size = 0.1
+ ob.rotation_mode = 'QUATERNION'
+ ob.rotation_quaternion = (matrices[num]*initial_matrices[num].copy().invert()).rotation_part().to_quat()'''
+ num = num + 1
+ bpy.context.scene.objects.active = arm_obj
+
+ #for num in range(len(matrices)):
+ #matrices[num] = inv_bone_matrices[num] * matrices[num] * bone_matrices[num]
+ #initial_matrices[num] = inv_abone_matrices[num] * initial_matrices[num] * bone_matrices[num]
+
+ initial_inv_matrices = []
+ for mat in initial_matrices:
+ matrix = mat.copy()
+ matrix.invert()
+ initial_inv_matrices.append(matrix)
+
+ ident = Matrix([1,0,0],[0,1,0],[0,0,1])
+ local_matrices = []
+ num = 0
+ root_translation = Vector((0,0,0))
+ for matrix in matrices:
+ name = "Bone_"+str(num)
+ bone = arm_data.bones[name]
+ parent_bone = bone.parent
+ if not parent_bone or parent_bone.name == "root":
+ local_matrices.append(matrix*initial_inv_matrices[num])
+ curr_translation = translation[num] - initial_translation[num]
+ #offset = matrix * initial_inv_matrices[num] * inv_bone_matrices[num] * Vector((0,bone.length*0.5,0));
+ #curr_translation = curr_translation + Vector((offset[0], offset[1], offset[2]))
+ root_translation = curr_translation
+ root_translation[1] = root_translation[1]*-1
+ root_translation[0] = root_translation[0]*-1
+ offset = inv_bone_matrices[num] * local_matrices[num] * bone_matrices[num] * Vector((0,bone.length*0.5,0));
+ offset[1],offset[2] = offset[2], offset[1]
+ offset[2] *= -1
+ offset[1] *= -1
+ root_translation += offset
+ else:
+ parent_id = int(parent_bone.name.split("_")[-1])
+ inv_mat = (matrices[parent_id]*initial_inv_matrices[parent_id]).invert()
+ local_matrices.append(inv_mat*matrix*initial_inv_matrices[num])
+ num = num + 1
+
+ #straight up = [1,0,0][0,0,-1],[0,1,0]
+ #straight right = [0,-1,0][1,0,0][0,0,1]
+ #straight left = [0,1,0][-1,0,0][0,0,1]
+ #local_matrices now contains local rotation matrices in world space
+ #time to convert them to bone space
+ num = 0
+ for matrix in local_matrices:
+ local_matrices[num] = inv_bone_matrices[num] * local_matrices[num] * bone_matrices[num]
+ num = num + 1
+
+ local_quats = []
+ for matrix in local_matrices:
+ local_quats.append(matrix.to_quat())
+
+ bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+ bpy.ops.object.mode_set(mode='POSE', toggle=False)
+
+ pose = arm_obj.pose
+ pose_bones = pose.bones
+
+ num = 0
+ for quat in local_quats:
+ name = "Bone_"+str(num)
+ bone = pose_bones[name]
+ if bone.rotation_mode == 'QUATERNION':
+ bone.rotation_quaternion = quat
+ else:
+ mode = bone.rotation_mode
+ euler = quat.to_euler(mode)
+ bone.rotation_euler = euler
+ num = num + 1
+
+ pose_bones["root"].location = root_translation
+
+ for bone in arm_data.bones:
+ if bnt.FromBoneName(bone.name):
+ bone.name = bnt.FromBoneName(bone.name)
+
+def ApplyAnimation(data):
+ arm_obj = bpy.context.scene.objects.active
+ if arm_obj.type != 'ARMATURE':
+ print("PHXBN armature must be selected")
+ return
+
+ bpy.ops.object.mode_set(mode='EDIT')
+ CalcBoneMats(arm_obj.data)
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+ action = bpy.data.actions.new(data.name)
+ if not arm_obj.animation_data:
+ arm_obj.animation_data_create()
+ arm_obj.animation_data.action = action
+
+ '''pose_bones = arm_obj.pose.bones
+ for bone in pose_bones:
+ group = action.groups.add(bone.name)
+ for j in range(3):
+ action.fcurves.new("rotation_euler",j,bone.name)'''
+
+ action["Version"] = data.version
+ action["Looping"] = data.looping
+ action["Start"] = data.start
+ action["End"] = data.end
+
+ ik_bones = {}
+ ik_bone_keys = {}
+ for keyframe in data.keyframes:
+ for bone in keyframe.ik_bones:
+ if not bone.string in ik_bones:
+ ik_bones[bone.string] = bone
+ ik_bone_keys[bone.string] = {}
+ ik_bone_keys[bone.string][keyframe.time] = True
+
+ #print("IK Bones:\n",ik_bones)
+
+ pose_bones = arm_obj.pose.bones
+ index = 0
+ for bone in pose_bones:
+ for constraint in bone.constraints:
+ if constraint.type == 'IK' and not constraint.target:
+ bone.constraints.remove(constraint)
+ else:
+ index = index + 1
+
+ ik_constraints = []
+ for bone_string in ik_bones:
+ bone = ik_bones[bone_string]
+ constraint = pose_bones["Bone_"+str(bone.bone_path[-1])].constraints.new('IK')
+ constraint.chain_count = len(bone.bone_path)
+ constraint.name = bone_string
+ ik_constraints.append(constraint)
+
+ bone_quat = {}
+ for i in range(len(data.keyframes)):
+ the_frame = data.keyframes[i].time/1000*bpy.context.scene.render.fps
+ PoseFromKeyframe(data, i, arm_obj)
+ for bone in pose_bones:
+ if bone.rotation_mode == 'QUATERNION':
+ if bone.name in bone_quat:
+ if bone.rotation_quaternion.dot(bone_quat[bone.name]) < 0:
+ bone.rotation_quaternion.negate()
+ bone.keyframe_insert("rotation_quaternion", frame = the_frame)
+ bone_quat[bone.name] = bone.rotation_quaternion.copy()
+ else:
+ bone.keyframe_insert("rotation_euler", frame = the_frame)
+ for constraint in ik_constraints:
+ if data.keyframes[i].time in ik_bone_keys[constraint.name]:
+ constraint.influence = 1
+ else:
+ constraint.influence = 0
+ constraint.keyframe_insert("influence", frame = the_frame)
+ pose_bones["root"].keyframe_insert("location", frame = the_frame)
+ for shape_key in data.keyframes[i].shape_keys:
+ arm_obj[shape_key.string] = shape_key.weight
+ arm_obj.keyframe_insert("[\""+shape_key.string+"\"]", frame = the_frame)
+
+def Load(filepath):
+ data = ReadANM(filepath)
+ if not data:
+ return
+ ApplyAnimation(data)
+
+class ANMImporter(bpy.types.Operator):
+ '''Load Phoenix Animation'''
+ bl_idname = "import_armature.anm"
+ bl_label = "Import ANM"
+
+ filepath = StringProperty(name="File Path", description="Filepath used for importing the ANM file", maxlen=1024, default="")
+
+ def execute(self, context):
+ print("Filepath:",self.properties.filepath)
+ Load(self.properties.filepath)
+
+ filename = self.properties.filepath.split("\\")[-1]
+ #convert the filename to an object name
+ objName = bpy.path.display_name(filename)
+ print("Filename:",filename)
+
+ #mesh = readMesh(self.properties.filepath, objName)
+ #addMeshObj(mesh, objName)
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.add_fileselect(self)
+ return {'RUNNING_MODAL'}
+
+#Load("C:\\Users\\David\\Desktop\\Wolfire SVN\\Project\\Data\\Animations\\run.anm")
+#Load("C:\\Users\\David\\Desktop\\export.anm")
diff --git a/Data/BlenderScript/addons/io_canm/__init__.py b/Data/BlenderScript/addons/io_canm/__init__.py
new file mode 100644
index 00000000..989abb02
--- /dev/null
+++ b/Data/BlenderScript/addons/io_canm/__init__.py
@@ -0,0 +1,29 @@
+bl_addon_info = {
+ 'name': 'Import/Export: Phoenix camera animation (.canm)...',
+ 'author': 'David Rosen',
+ 'version': '0.1',
+ 'blender': (2, 5, 4),
+ 'location': 'File > Import/Export > CANM',
+ 'description': 'Export Phoenix camera animation (.canm format)',
+ 'warning': '', # used for warning icon and text in addons panel
+ 'category': 'Import/Export'}
+
+import bpy
+
+def menu_export(self, context):
+ from io_canm import export_canm
+ import os
+ default_path = os.path.splitext(bpy.data.filepath)[0] + ".canm"
+ self.layout.operator(export_canm.CANMExporter.bl_idname, text="Phoenix Camera Animation (.canm)").filepath = default_path
+
+def register():
+ from io_canm import export_canm
+ bpy.types.register(export_canm.CANMExporter)
+ bpy.types.INFO_MT_file_export.append(menu_export)
+
+def unregister():
+ from io_canm import export_canm
+ bpy.types.INFO_MT_file_export.remove(menu_export)
+
+if __name__ == "__main__":
+ register()
diff --git a/Data/BlenderScript/addons/io_canm/export_canm.py b/Data/BlenderScript/addons/io_canm/export_canm.py
new file mode 100644
index 00000000..0cf5b68e
--- /dev/null
+++ b/Data/BlenderScript/addons/io_canm/export_canm.py
@@ -0,0 +1,136 @@
+import bpy
+import array
+from bpy.props import *
+from mathutils import Matrix, Euler, Vector, Quaternion
+
+class dfcurvekeyclass:
+ def __init__(self):
+ self.co = array.array('f')
+ self.handle_left = array.array('f')
+ self.handle_right = array.array('f')
+
+class fcurveclass:
+ def __init__(self):
+ self.data_path = ""
+ self.fcurvekey = []
+ self.array_index = 0
+
+class CANMdata:
+ def __init__(self):
+ self.version = 0
+ self.rotation_mode = ""
+ self.fcurves = []
+ self.fps = 0
+
+def WriteFloat(file, val):
+ int_loader = array.array('f')
+ int_loader.append(val)
+ int_loader.tofile(file)
+
+def Get4ByteIntArray():
+ var = array.array('l')
+ if var.itemsize != 4:
+ var = array.array('i')
+ return var
+
+def WriteInt(file, val):
+ int_loader = Get4ByteIntArray()
+ int_loader.append(val)
+ int_loader.tofile(file)
+
+def WriteBool(file, val):
+ bool_loader = array.array('B')
+ bool_loader.append(val)
+ bool_loader.tofile(file)
+
+def WriteString(file, str):
+ string_array = array.array("B")
+ string_array.fromstring(str.encode("utf-8"))
+ WriteInt(file, len(str))
+ string_array.tofile(file)
+
+def WriteCANM(filepath, data):
+ file = open(filepath, "wb")
+
+ data.version = 1
+ num_fcurves = len(data.fcurves)
+ WriteInt(file, data.version)
+ WriteInt(file, data.fps)
+ WriteString(file, data.rotation_mode)
+ WriteInt(file, num_fcurves)
+
+ for fcurve in data.fcurves:
+ WriteString(file, fcurve.data_path)
+ WriteInt(file, fcurve.array_index)
+ WriteInt(file, len(fcurve.fcurvekey))
+ for key in fcurve.fcurvekey:
+ key.co.tofile(file)
+ key.handle_left.tofile(file)
+ key.handle_right.tofile(file)
+
+def GetAnimation():
+ cam_obj = bpy.context.scene.objects.active
+ if cam_obj and cam_obj.type != 'CAMERA':
+ print("Camera must be selected")
+ return 0
+ fcurves = []
+ if cam_obj.animation_data.action:
+ for fcurve in cam_obj.animation_data.action.fcurves:
+ fcurves.append(fcurve)
+ if cam_obj.data.animation_data.action:
+ for fcurve in cam_obj.data.animation_data.action.fcurves:
+ fcurves.append(fcurve)
+
+ fcurves_c = []
+ for fcurve in fcurves:
+ #print(fcurve.data_path)
+ fcurve_c = fcurveclass()
+ fcurve_c.data_path = fcurve.data_path
+ fcurve_c.array_index = fcurve.array_index
+ for keyframe in fcurve.keyframe_points:
+ keyframe_c = dfcurvekeyclass()
+ keyframe_c.co.append(keyframe.co[0])
+ keyframe_c.co.append(keyframe.co[1])
+ keyframe_c.handle_left.append(keyframe.handle_left[0])
+ keyframe_c.handle_left.append(keyframe.handle_left[1])
+ keyframe_c.handle_right.append(keyframe.handle_right[0])
+ keyframe_c.handle_right.append(keyframe.handle_right[1])
+ fcurve_c.fcurvekey.append(keyframe_c)
+ fcurves_c.append(fcurve_c)
+
+ data = CANMdata()
+ data.fcurves = fcurves_c
+ data.rotation_mode = cam_obj.rotation_mode
+ data.fps = bpy.context.scene.render.fps
+
+ return data
+
+def Save(filepath):
+ data = GetAnimation()
+ if not data:
+ return
+ WriteCANM(filepath, data)
+
+class CANMExporter(bpy.types.Operator):
+ '''Save Phoenix Bones armature'''
+ bl_idname = "export_mesh.canm"
+ bl_label = "Export CANM"
+
+ filepath = StringProperty(name="File Path", description="Filepath used for exporting the CANM file", maxlen= 1024, default= "")
+
+ check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
+
+ def execute(self, context):
+ Save(self.properties.filepath)
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.add_fileselect(self)
+ return {'RUNNING_MODAL'}
+
+#Save("C:\\Users\\David\\Desktop\\export.anm")
+#Save("Desktop/export.anm")
+#BakeConstraints(bpy.context.scene.objects.active)
+data = GetAnimation()
+WriteCANM("C:\\Users\\David\\Desktop\\test.canm", data) \ No newline at end of file
diff --git a/Data/BlenderScript/addons/io_obj_shape/__init__.py b/Data/BlenderScript/addons/io_obj_shape/__init__.py
new file mode 100644
index 00000000..b0b38c38
--- /dev/null
+++ b/Data/BlenderScript/addons/io_obj_shape/__init__.py
@@ -0,0 +1,38 @@
+bl_addon_info = {
+ 'name': 'Import/Export: Objects as shape keys(.obj)...',
+ 'author': 'David Rosen',
+ 'version': '0.1',
+ 'blender': (2, 5, 4),
+ 'location': 'File > Import/Export > OBJ shape key',
+ 'description': 'Import shape key (.obj format)',
+ 'warning': '', # used for warning icon and text in addons panel
+ 'category': 'Import/Export'}
+
+import bpy
+
+def menu_import(self, context):
+ from io_obj_shape import import_obj_shape
+ self.layout.operator(import_obj_shape.ObjShapeImporter.bl_idname, text="Shape key (.obj)").filepath = "*.obj"
+
+def menu_export(self, context):
+ from io_obj_shape import export_obj_shape
+ import os
+ default_path = os.path.splitext(bpy.data.filepath)[0] + ".obj"
+ self.layout.operator(export_obj_shape.ObjShapeExporter.bl_idname, text="Shape key (.obj)").filepath = default_path
+
+def register():
+ from io_obj_shape import import_obj_shape, export_obj_shape
+ bpy.types.register(import_obj_shape.ObjShapeImporter)
+ #bpy.types.register(export_obj_shape.ObjShapeExporter)
+ bpy.types.INFO_MT_file_import.append(menu_import)
+ #bpy.types.INFO_MT_file_export.append(menu_export)
+
+def unregister():
+ from io_obj_shape import import_obj_shape, export_obj_shape
+ #bpy.types.unregister(import_obj_shape.ObjShapeImporter)
+ #bpy.types.unregister(export_obj_shape.ObjShapeExporter)
+ bpy.types.INFO_MT_file_import.remove(menu_import)
+ #bpy.types.INFO_MT_file_export.remove(menu_export)
+
+if __name__ == "__main__":
+ register()
diff --git a/Data/BlenderScript/addons/io_obj_shape/export_obj_shape.py b/Data/BlenderScript/addons/io_obj_shape/export_obj_shape.py
new file mode 100644
index 00000000..d1d77f9a
--- /dev/null
+++ b/Data/BlenderScript/addons/io_obj_shape/export_obj_shape.py
@@ -0,0 +1,26 @@
+import bpy
+from bpy.props import *
+
+def Save(filepath):
+ return
+
+class ObjShapeExporter(bpy.types.Operator):
+ '''Save shape key as OBJ'''
+ bl_idname = "export_obj_shape.obj"
+ bl_label = "Export shape key as OBJ"
+
+ filepath = StringProperty(name="File Path", description="Filepath used for exporting the OBJ file", maxlen= 1024, default= "")
+
+ check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
+
+ def execute(self, context):
+ Save(self.properties.filepath)
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.add_fileselect(self)
+ return {'RUNNING_MODAL'}
+
+#Save("C:\\Users\\David\\Desktop\\export.anm")
+#BakeConstraints(bpy.context.scene.objects.active)
diff --git a/Data/BlenderScript/addons/io_obj_shape/import_obj_shape.py b/Data/BlenderScript/addons/io_obj_shape/import_obj_shape.py
new file mode 100644
index 00000000..5e8df89d
--- /dev/null
+++ b/Data/BlenderScript/addons/io_obj_shape/import_obj_shape.py
@@ -0,0 +1,47 @@
+import bpy
+from bpy.props import *
+from io_scene_obj.import_obj import load as load_obj
+
+def Load(filepath):
+ obj = bpy.context.scene.objects.active
+
+ obj_dict = {}
+ for object in bpy.context.scene.objects:
+ obj_dict[object.name] = True
+
+ load_obj(None, bpy.context, filepath)
+
+ new_obj = []
+ for object in bpy.context.scene.objects:
+ if not object.name in obj_dict:
+ new_obj.append(object)
+
+ new_obj[0].name = filepath.split('\\')[-1].split('.')[0]
+ new_obj[0].select = True
+ bpy.ops.object.join_shapes()
+
+ bpy.ops.object.select_all(action = 'DESELECT')
+ for object in new_obj:
+ object.select = True
+ bpy.ops.object.delete()
+
+class ObjShapeImporter(bpy.types.Operator):
+ '''Load a Wavefront OBJ file as a shape key'''
+ bl_idname = "import_obj_shape.obj"
+ bl_label = "Import OBJ shape key"
+
+ filepath = StringProperty(name="File Path", description="Filepath used for importing the OBJ file", maxlen=1024, default="")
+
+ def execute(self, context):
+ print("Filepath:",self.properties.filepath)
+ Load(self.properties.filepath)
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.add_fileselect(self)
+ return {'RUNNING_MODAL'}
+
+#Load("C:\\Users\\David\\Desktop\\Wolfire SVN\\Project\\Data\\Animations\\run.anm")
+#Load("C:\\Users\\David\\Desktop\\export.anm")
diff --git a/Data/BlenderScript/addons/io_phxbn/__init__.py b/Data/BlenderScript/addons/io_phxbn/__init__.py
new file mode 100644
index 00000000..6f40a4ae
--- /dev/null
+++ b/Data/BlenderScript/addons/io_phxbn/__init__.py
@@ -0,0 +1,38 @@
+bl_addon_info = {
+ 'name': 'Import/Export: Phoenix bones (.phxbn)...',
+ 'author': 'David Rosen',
+ 'version': '0.1',
+ 'blender': (2, 5, 4),
+ 'location': 'File > Import/Export > PHXBN',
+ 'description': 'Import Phoenix Bones (.phxbn format)',
+ 'warning': '', # used for warning icon and text in addons panel
+ 'category': 'Import/Export'}
+
+import bpy
+
+def menu_import(self, context):
+ from io_phxbn import import_phxbn
+ self.layout.operator(import_phxbn.PHXBNImporter.bl_idname, text="Phoenix Bones (.phxbn)").filepath = "*.phxbn"
+
+def menu_export(self, context):
+ from io_phxbn import export_phxbn
+ import os
+ default_path = os.path.splitext(bpy.data.filepath)[0] + ".phxbn"
+ self.layout.operator(export_phxbn.PHXBNExporter.bl_idname, text="Phoenix Bones (.phxbn)").filepath = default_path
+
+def register():
+ from io_phxbn import import_phxbn, export_phxbn
+ bpy.types.register(import_phxbn.PHXBNImporter)
+ bpy.types.register(export_phxbn.PHXBNExporter)
+ bpy.types.INFO_MT_file_import.append(menu_import)
+ bpy.types.INFO_MT_file_export.append(menu_export)
+
+def unregister():
+ from io_phxbn import import_phxbn, export_phxbn
+ #bpy.types.unregister(import_phxbn.PHXBNImporter)
+ #bpy.types.unregister(export_phxbn.PHXBNExporter)
+ bpy.types.INFO_MT_file_import.remove(menu_import)
+ bpy.types.INFO_MT_file_export.remove(menu_export)
+
+if __name__ == "__main__":
+ register()
diff --git a/Data/BlenderScript/addons/io_phxbn/export_phxbn.py b/Data/BlenderScript/addons/io_phxbn/export_phxbn.py
new file mode 100644
index 00000000..1b758f58
--- /dev/null
+++ b/Data/BlenderScript/addons/io_phxbn/export_phxbn.py
@@ -0,0 +1,608 @@
+import array
+import bpy
+from bpy.props import *
+from io_phxbn import phxbn_types
+from mathutils import Vector, Matrix
+import operator
+
+def Get4ByteIntArray():
+ var = array.array('l')
+ if var.itemsize != 4:
+ var = array.array('i')
+ return var
+
+def UnCenterArmatureInMesh(data, mesh_obj):
+ mesh = mesh_obj.data
+
+ min_point = array.array('f')
+ max_point = array.array('f')
+
+ for i in range(3):
+ min_point.append(mesh.vertices[0].co[i])
+ max_point.append(mesh.vertices[0].co[i])
+
+ for vert in mesh.vertices:
+ for i in range(3):
+ min_point[i] = min(min_point[i], vert.co[i])
+ max_point[i] = max(max_point[i], vert.co[i])
+
+ mid_point = Vector();
+ for i in range(3):
+ mid_point[i] = ((min_point[i] + max_point[i]) * 0.5)
+
+ mid_point = mesh_obj.matrix_world * mid_point;
+
+ #print("Midpoint: ",mid_point)
+
+ for vert in data.vertices:
+ for i in range(3):
+ vert[i] = vert[i] - mid_point[i]
+
+def to_array(array, idarray):
+ for item in idarray:
+ array.append(item)
+
+class BoneWeight:
+ def __init__(self, id, weight):
+ self.id = id
+ self.weight = weight
+
+def AddConnectingBones(arm_obj):
+ new_bones = []
+ arm_data = arm_obj.data
+ for bone in arm_data.edit_bones:
+ if bone.name == "root" or bone.layers[29] == False or not bone.parent or bone.parent.name == "root" or bone.parent.layers[29] == False:
+ continue
+ if bone.head != bone.parent.tail:
+ bpy.ops.armature.bone_primitive_add(name="connector")
+ new_bone = arm_data.edit_bones[-1]
+ new_bone.head = bone.parent.tail
+ new_bone.tail = bone.head
+ new_bone.parent = bone.parent
+ new_bone["Mass"] = 0.01
+ for i in range(32):
+ new_bone.layers[i] = False
+ new_bone.layers[29] = True
+ bone.parent = new_bone
+ new_bones.append(new_bone.name)
+
+ bpy.context.scene.update()
+ bpy.ops.object.mode_set(mode='OBJECT')
+ bpy.ops.object.mode_set(mode='EDIT')
+
+def EnforceBoneNaming(arm_data):
+ name_shift = {}
+ bone_labels = {}
+ for bone in arm_data.edit_bones:
+ if bone.name == "root" or bone.layers[29] == False:
+ continue
+ if bone.name.split("_")[0] == "Bone":
+ bone_id = int(bone.name.split("_")[-1])
+ bone_labels[bone_id] = True
+ name_shift[bone.name] = bone.name
+
+ index = 0
+ for bone in arm_data.edit_bones:
+ if bone.name == "root" or bone.layers[29] == False:
+ continue
+ if bone.name.split("_")[0] != "Bone":
+ while index in bone_labels:
+ index = index + 1
+ name_shift[bone.name] = "Bone_"+str(index)
+ bone.name = name_shift[bone.name]
+ index = index+1
+ return name_shift
+
+
+def GetClosestRealChildren(bone):
+ list = []
+ for child in bone.children:
+ if not child.layers[29]:
+ new_list = GetClosestRealChildren(child)
+ for line in new_list:
+ list.append(line)
+ continue
+ list.append(child)
+ return list
+
+class Point():
+ def __init__(self):
+ self.head_of = []
+ self.tail_of = []
+ self.id = -1
+
+bone_dict = {}
+
+#Create a dictionary like this: bone_dict["Bone_0"] = {"Point IDs",[point, point]}
+def CreateBonePointDictionary(bones):
+ point_head = {}
+ point_tail = {}
+
+ first_point = Point()
+ first_point.head_of = GetClosestRealChildren(bones["root"])
+
+ points = [first_point]
+
+ to_process = GetClosestRealChildren(bones["root"])
+
+ while len(to_process) > 0:
+ bone = to_process.pop(0)
+ point = Point()
+ point.tail_of.append(bone)
+ new_list = GetClosestRealChildren(bone)
+ for line in new_list:
+ point.head_of.append(line)
+ to_process.append(line)
+ points.append(point)
+
+ for point in points:
+ for bone in point.head_of:
+ point_head[bone] = point
+ for bone in point.tail_of:
+ point_tail[bone] = point
+
+ index = 0
+ for point in points:
+ if point.id != -1:
+ continue
+ point.id = index
+ index += 1
+
+ for bone in bones:
+ if not bone in point_head or not bone in point_tail:
+ continue
+ point_ids = Get4ByteIntArray()
+ point_ids.append(point_head[bone].id)
+ point_ids.append(point_tail[bone].id)
+ if not bone.name in bone_dict:
+ bone_dict[bone.name] = {}
+ #print("Added ", bone.name)
+ bone_dict[bone.name]["Point IDs"] = point_ids
+
+ #print("Created bone dict")
+ #print(bone_dict)
+
+def GetParentIDs(data):
+ parent_ids = Get4ByteIntArray()
+ for bone in data.edit_bones:
+ if bone.name.split("_")[0] != "Bone":
+ continue
+ bone_id = int(bone.name.split("_")[-1])
+ while bone_id >= len(parent_ids):
+ parent_ids.append(-1)
+ if not bone.parent or bone.parent.name == "root" or bone.parent.layers[29] == False:
+ continue
+ parent_bone_id = int(bone.parent.name.split("_")[-1])
+ parent_ids[bone_id] = parent_bone_id
+
+ data["parent_ids"] = parent_ids
+
+def GetParents(data):
+ parents = Get4ByteIntArray()
+ for bone in data.edit_bones:
+ if not bone_dict.get(bone.name) or not bone_dict[bone.name].get("Point IDs"):
+ continue
+ point_ids = bone_dict[bone.name]["Point IDs"]
+ while len(parents) <= point_ids[1]:
+ parents.append(-1)
+ parents[point_ids[1]] = point_ids[0]
+ data["parents"] = parents
+
+def GetBoneMatZ(edit_bone):
+ z_vec = (edit_bone.tail - edit_bone.head).normalize()
+ x_vec = Vector((0,0,1))
+ y_vec = x_vec.cross(z_vec).normalize()
+ x_vec = y_vec.cross(z_vec).normalize()
+
+ return [x_vec[0], x_vec[2], -x_vec[1], 0,
+ y_vec[0], y_vec[2], -y_vec[1], 0,
+ z_vec[0], z_vec[2], -z_vec[1], 0,
+ 0,0,0,1]
+
+
+def GetBoneMat(edit_bone):
+ z_vec = (edit_bone.tail - edit_bone.head).normalize()
+ y_vec = Vector((0,1,0))
+ if abs(z_vec.dot(y_vec)) > 0.95:
+ return GetBoneMatZ(edit_bone)
+ x_vec = z_vec.cross(y_vec).normalize()
+ y_vec = z_vec.cross(x_vec).normalize()
+
+ return [x_vec[0], x_vec[2], -x_vec[1], 0,
+ y_vec[0], y_vec[2], -y_vec[1], 0,
+ z_vec[0], z_vec[2], -z_vec[1], 0,
+ 0,0,0,1]
+
+def GetJoints(arm_obj, name_shift):
+ joints = []
+ for bone in arm_obj.pose.bones:
+ for constraint in bone.constraints:
+ name_parts = constraint.name.split("_")
+ if constraint.type == 'LIMIT_ROTATION' and constraint.owner_space == 'LOCAL' and name_parts[0] == "RGDL":
+ freedom = 0
+ if constraint.min_x != constraint.max_x:
+ freedom += 1
+ if constraint.min_y != constraint.max_y:
+ freedom += 1
+ if constraint.min_z != constraint.max_z:
+ freedom += 1
+
+ joint = phxbn_types.Joint()
+ joint.bone_ids.append(int(bone.name.split("_")[1]))
+ if bone.parent and len(bone.parent.name.split("_")) > 1:
+ joint.bone_ids.append(int(bone.parent.name.split("_")[1]))
+ else:
+ joint.bone_ids.append(0)
+
+ if name_parts[1] != "Limit Rotation":
+ #print("Trying to find: "+name_parts[1])
+ if name_shift.get(name_parts[1]) and \
+ arm_obj.pose.bones.get(name_shift[name_parts[1]]):
+ #print("Constraint name: "+name_parts[1])
+ #print("Constraint name shift: "+name_shift[name_parts[1]])
+ #print("Constraint name suffix: "+name_shift[name_parts[1]].split("_")[1])
+ joint.bone_ids[1] = int(name_shift[name_parts[1]].split("_")[1])
+ else :
+ print("Could not find: "+name_parts[1])
+
+ if freedom == 0:
+ joint.type.append(phxbn_types._fixed_joint)
+ joints.append(joint)
+ if freedom == 1:
+ joint.type.append(phxbn_types._hinge_joint)
+ mat = arm_obj.matrix_world * bone.matrix
+ axis = Vector((mat[0][0], mat[0][1], mat[0][2])).normalize()
+ joint.axis.append(axis[0])
+ joint.axis.append(axis[2])
+ joint.axis.append(-axis[1])
+ joint.stop_angles.append(constraint.min_x)
+ joint.stop_angles.append(constraint.max_x)
+ joints.append(joint)
+ if freedom > 1:
+ joint.type.append(phxbn_types._amotor_joint)
+ joint.stop_angles.append(constraint.min_y)
+ joint.stop_angles.append(constraint.max_y)
+ joint.stop_angles.append(constraint.min_x)
+ joint.stop_angles.append(constraint.max_x)
+ joint.stop_angles.append(constraint.min_z)
+ joint.stop_angles.append(constraint.max_z)
+ joints.append(joint)
+
+ return joints
+ '''if not arm_data.get("num_special_joints"):
+ arm_data["num_special_joints"] = 0
+ num_joints = arm_data["num_special_joints"]
+ for num in range(num_joints):
+ joint = phxbn_types.Joint()
+ name = "joint_" + str(num)
+ joint.type.append(arm_data[name + "_type"])
+ if joint.type[0] == phxbn_types._amotor_joint:
+ to_array(joint.stop_angles, arm_data[name + "_angles"])
+ elif joint.type[0] == phxbn_types._hinge_joint:
+ to_array(joint.stop_angles, arm_data[name + "_angles"])
+ to_array(joint.bone_ids, arm_data[name + "_bone_ids"])
+ if joint.type[0] == phxbn_types._hinge_joint:
+ to_array(joint.axis, arm_data[name+"_axis"])
+ data.joints.append(joint)'''
+
+def GetIKBones(arm_obj, name_shift):
+ ik_bones = []
+ for bone in arm_obj.pose.bones:
+ if arm_obj.data.edit_bones[bone.name].layers[29] == False:
+ continue
+ for constraint in bone.constraints:
+ if constraint.type == 'IK' and not constraint.target:
+ bone_id = int(bone.name.split("_")[-1])
+ ik_length = constraint.chain_count
+ #print("IK bone "+constraint.name+": bone_"+str(bone_id)+" with chain count: "+str(ik_length))
+ ik_bone = phxbn_types.IKBone()
+ ik_bone.name = constraint.name
+ ik_bone.bone = bone_id
+ ik_bone.chain = ik_length
+ ik_bones.append(ik_bone)
+ return ik_bones
+
+def PHXBNFromArmature():
+ scene = bpy.context.scene
+ old_armature_object = scene.objects.active
+
+ if not old_armature_object or old_armature_object.type != 'ARMATURE':
+ print ("Must select armature before exporting PHXBN")
+ return
+
+ if len(old_armature_object.children) == 0 or old_armature_object.children[0].type != 'MESH':
+ print("Armature must be the parent of a mesh.")
+ return
+
+ #Make a copy of the object so we don't mess up the original
+ bpy.ops.object.mode_set(mode='OBJECT')
+ bpy.ops.object.duplicate()
+ arm_obj = scene.objects.active
+ print ("Reading PHXBN from armature: ", arm_obj.name)
+
+ #Set to edit mode so we can add connecting bones
+ bpy.ops.object.mode_set(mode='EDIT')
+ AddConnectingBones(arm_obj)
+
+ #Extract metadata from armature object
+ arm_data = arm_obj.data
+ data = phxbn_types.PHXBNdata()
+
+ if arm_data.get("version"):
+ data.version.append(arm_data["version"])
+ else:
+ data.version.append(11)
+
+ if arm_data.get("rigging_stage"):
+ data.rigging_stage.append(arm_data["rigging_stage"])
+ else:
+ data.rigging_stage.append(1)
+
+ #Rename all bones to "root" or "Bone_X" where X is bone number
+ name_shift = EnforceBoneNaming(arm_data)
+
+ #Make an easy way to look up the points attached to each bone
+ CreateBonePointDictionary(arm_data.edit_bones)
+
+ #Count the number of points and bones
+ num_points = 0
+ num_bones = 0
+ for bone in arm_data.edit_bones:
+ if bone.name == "root" or bone.layers[29] == False:
+ continue
+ points = Get4ByteIntArray()
+ to_array(points, bone_dict[bone.name]["Point IDs"])
+ num_points = max(num_points, points[0]+1)
+ num_points = max(num_points, points[1]+1)
+ num_bones = num_bones + 1
+
+ #Create storage space for bone information
+ for i in range(num_bones):
+ points = Get4ByteIntArray()
+ data.bones.append(points)
+ data.bone_mass.append(0)
+ data.bone_com.append(0)
+ data.bone_com.append(0)
+ data.bone_com.append(0)
+ data.bone_parents.append(-1)
+ data.bone_swap.append(0)
+ for j in range(16):
+ data.bone_mat.append(0)
+
+ #Create space for point spatial information
+ vertices = array.array('f')
+ for i in range(num_points*3):
+ vertices.append(0)
+
+ #Fill in the bone information
+ num = 0
+ for bone in arm_data.edit_bones:
+ if bone.name == "root" or bone.layers[29] == False:
+ continue
+ points = Get4ByteIntArray()
+ to_array(points, bone_dict[bone.name]["Point IDs"])
+ bone_id = int(bone.name.split('_')[-1])
+ data.bones[bone_id].append(points[0])
+ data.bones[bone_id].append(points[1])
+ vertices[points[0]*3+0] = bone.head[0]
+ vertices[points[0]*3+1] = bone.head[1]
+ vertices[points[0]*3+2] = bone.head[2]
+ vertices[points[1]*3+0] = bone.tail[0]
+ vertices[points[1]*3+1] = bone.tail[1]
+ vertices[points[1]*3+2] = bone.tail[2]
+ mass = 0.1
+ if bone.get("Mass"):
+ mass = bone["Mass"]
+ data.bone_mass[bone_id] = mass
+ COM = [0.0,0.0,0.0]
+ if bone.get("COM"):
+ COM = bone["COM"]
+ data.bone_com[bone_id*3+0] = COM[0]
+ data.bone_com[bone_id*3+1] = COM[1]
+ data.bone_com[bone_id*3+2] = COM[2]
+ mat = GetBoneMat(bone)
+ if bone.get("mat"):
+ mat = bone["mat"]
+ for j in range(16):
+ data.bone_mat[bone_id*16+j] = mat[j]
+ swap = False
+ if bone.get("Swap"):
+ swap = bone["Swap"]
+ data.bone_swap[bone_id] = swap
+ if(data.bone_swap[bone_id]):
+ data.bones[bone_id][0], data.bones[bone_id][1] = \
+ data.bones[bone_id][1], data.bones[bone_id][0]
+ if not bone.parent or bone.parent.name == "root" or bone.parent.layers[29] == False:
+ data.bone_parents[bone_id] = -1
+ else:
+ parent = int(bone.parent.name.split('_')[-1])
+ data.bone_parents[bone_id] = parent
+ num = num + 1
+
+ #Store the position of each point
+ for i in range(num_points):
+ vertex = array.array('f')
+ vertex.append(vertices[i*3+0])
+ vertex.append(vertices[i*3+1])
+ vertex.append(vertices[i*3+2])
+ data.vertices.append(vertex)
+
+ #Extract joint and IK bone info
+ data.joints = GetJoints(arm_obj, name_shift)
+ data.ik_bones = GetIKBones(arm_obj, name_shift)
+
+ #Get the mesh object and subtract its midpoint from each skeleton point position
+ mesh_obj = old_armature_object.children[0]
+ print("Uncentering armature in mesh")
+ UnCenterArmatureInMesh(data, mesh_obj)
+
+ #Convert Blender coordinates back to Phoenix coordinates
+ for vertex in data.vertices:
+ vertex[1], vertex[2] = vertex[2], -vertex[1]
+
+ #Calculate the parent hierarchies for each bone and point
+ if not arm_data.get("parent_ids") or len(arm_data["parent_ids"]) != num_bones:
+ GetParentIDs(arm_data)
+ to_array(data.parent_ids, arm_data["parent_ids"])
+ if not arm_data.get("parents") or len(arm_data["parents"]) != num_points:
+ GetParents(arm_data)
+ to_array(data.parents, arm_data["parents"])
+
+ #Extract the bone ids and weights for each mesh vertex
+ mesh = mesh_obj.data
+ num_verts = len(mesh.vertices)
+ bone_ids = []
+ bone_weights = []
+ count = 0;
+ for vert in mesh.vertices:
+ new_bone_weights = []
+ #For each vertex group, check if that bone is a real deformation bone.
+ #If so, record bone id and weight for this vertex
+ for i in range(len(vert.groups)):
+ temp_name = mesh_obj.vertex_groups[vert.groups[i].group].name
+ if not temp_name in name_shift:
+ continue
+ group_name = name_shift[temp_name]
+ new_bone_weights.append(BoneWeight(int(group_name.split('_')[-1]), \
+ vert.groups[i].weight))
+ #Sort bone weights, and keep the four greatest
+ new_bone_weights.sort(key=operator.attrgetter('weight'), reverse=True)
+ new_bone_weights = new_bone_weights[0:4]
+ while len(new_bone_weights)<4:
+ new_bone_weights.append(BoneWeight(0,0.0))
+ #Normalize the bone weights
+ total = 0.0
+ for i in range(4):
+ total = total + new_bone_weights[i].weight
+ for i in range(4):
+ if total != 0:
+ new_bone_weights[i].weight = new_bone_weights[i].weight / total
+ else:
+ print("Error: vertex ",count," has no weights!")
+ #Record weights and id in list
+ for bone_weight in new_bone_weights:
+ bone_ids.append(bone_weight.id)
+ bone_weights.append(bone_weight.weight)
+ #if count > 100 and count < 130:
+ # print("Vertex ",count,": ",new_bone_weights[0].weight,", ",new_bone_weights[1].weight,", ",new_bone_weights[2].weight,", ",new_bone_weights[3].weight)
+ count = count + 1
+
+ #Store the vertex weights in the form of an array of face vertices
+ for face in mesh.faces:
+ for j in range(3):
+ for i in range(4):
+ index = face.vertices[j]*4+i
+ data.bone_ids.append(bone_ids[index])
+ data.bone_weights.append(bone_weights[index])
+
+ print("Num faces: ", len(mesh.faces))
+ print("Num bone weights: ", len(data.bone_weights))
+
+ bpy.ops.object.mode_set(mode='OBJECT')
+ bpy.ops.object.delete()
+ scene.objects.active = old_armature_object
+
+ return data
+
+def WriteInt(file, val):
+ int_loader = Get4ByteIntArray()
+ int_loader.append(val)
+ int_loader.tofile(file)
+
+def WritePHXBN(file_path, data):
+ file = open(file_path, 'wb')
+
+ print ("Saving phxbn file: ", file_path)
+ data.version.tofile(file)
+ print ('Version: ', data.version[0])
+
+ data.rigging_stage.tofile(file)
+ print ('Rigging stage: ', data.rigging_stage[0])
+
+ num_points = Get4ByteIntArray()
+ num_points.append(len(data.vertices))
+ num_points.tofile(file)
+ print ('Num points: ', num_points[0])
+
+ for vertex in data.vertices:
+ #print(vertex)
+ vertex.tofile(file)
+
+ data.parents.tofile(file)
+
+ num_bones = Get4ByteIntArray()
+ num_bones.append(len(data.bones))
+ num_bones.tofile(file)
+ print ('Num bones: ', num_bones[0])
+
+ for bone in data.bones:
+ bone.tofile(file)
+
+ data.bone_parents.tofile(file)
+
+ data.bone_mass.tofile(file)
+ data.bone_com.tofile(file)
+ data.bone_mat.tofile(file)
+
+ num_vertices = Get4ByteIntArray()
+ num_vertices.append(len(data.bone_weights)//4)
+ num_vertices.tofile(file)
+
+ data.bone_weights.tofile(file)
+ data.bone_ids.tofile(file)
+
+ data.parent_ids.tofile(file)
+
+ num_joints = Get4ByteIntArray()
+ num_joints.append(len(data.joints))
+ num_joints.tofile(file)
+
+ print("Saving ", num_joints[0], " joints")
+
+ for joint in data.joints:
+ joint.type.tofile(file)
+ if joint.type[0] == phxbn_types._amotor_joint:
+ joint.stop_angles.tofile(file)
+ elif joint.type[0] == phxbn_types._hinge_joint:
+ joint.stop_angles.tofile(file)
+ joint.bone_ids.tofile(file)
+ if joint.type[0] == phxbn_types._hinge_joint:
+ joint.axis.tofile(file)
+
+ num_ik_bones = len(data.ik_bones)
+ WriteInt(file, num_ik_bones)
+ for ik_bone in data.ik_bones:
+ WriteInt(file, ik_bone.bone)
+ WriteInt(file, ik_bone.chain)
+ string_array = array.array("B")
+ string_array.fromstring(ik_bone.name.encode("utf-8"))
+ WriteInt(file, len(string_array))
+ string_array.tofile(file)
+
+ file.close()
+
+def Save(filepath):
+ data = PHXBNFromArmature()
+ if not data:
+ return
+ WritePHXBN(filepath, data)
+
+class PHXBNExporter(bpy.types.Operator):
+ '''Save Phoenix Bones armature'''
+ bl_idname = "export_mesh.phxbn"
+ bl_label = "Export PHXBN"
+
+ filepath = StringProperty(name="File Path", description="Filepath used for exporting the PHXBN file", maxlen= 1024, default= "")
+
+ check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
+
+ def execute(self, context):
+ Save(self.properties.filepath)
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.add_fileselect(self)
+ return {'RUNNING_MODAL'}
+
+#Save("C:\\Users\\David\\Desktop\\export.phxbn")
diff --git a/Data/BlenderScript/addons/io_phxbn/import_phxbn.py b/Data/BlenderScript/addons/io_phxbn/import_phxbn.py
new file mode 100644
index 00000000..42cf757a
--- /dev/null
+++ b/Data/BlenderScript/addons/io_phxbn/import_phxbn.py
@@ -0,0 +1,560 @@
+import bpy
+from bpy.props import *
+import array
+import mathutils
+import math
+from mathutils import Vector
+from io_phxbn import phxbn_types
+
+def Get4ByteIntArray():
+ var = array.array('l')
+ if var.itemsize != 4:
+ var = array.array('i')
+ return var
+
+def WriteToTextFile(file_path, data):
+ file = open(file_path, 'w')
+ file.write('Version: '+str(data.version[0])+'\n')
+ file.write('Rigging stage: '+str(data.rigging_stage[0])+'\n')
+ file.write('Num points: '+str(len(data.vertices))+'\n')
+
+ file.write('\nVertices:\n')
+ for vertex in data.vertices:
+ file.write(str(vertex)+'\n')
+
+ file.write('\nParents:\n')
+ for parent in data.parents:
+ file.write(str(parent)+'\n')
+
+ file.write('\nNum bones: '+str(len(data.bones))+'\n')
+
+ file.write('\nBones:\n')
+ for bone in data.bones:
+ file.write(str(bone)+'\n')
+
+ file.write('\nBone parents:\n')
+ for bone_parent in data.bone_parents:
+ file.write(str(bone_parent)+'\n')
+
+ file.write('\nBone mass:\n')
+ for bone_mass in data.bone_mass:
+ file.write(str(bone_mass)+'\n')
+
+ file.write('\nBone COM:\n')
+ for bone_com in data.bone_com:
+ file.write(str(bone_com)+'\n')
+
+ file.write('Parent IDs:\n')
+ for parent_id in data.parent_ids:
+ file.write(str(parent_id)+'\n')
+
+ file.write('\nNum joints: '+str(len(data.joints))+'\n')
+
+ i = 0
+ for joint in data.joints:
+ file.write('\nJoint '+str(i)+':\n')
+ file.write('Joint type: '+str(joint.type)+'\n')
+ file.write('Stop angles: '+str(joint.stop_angles)+'\n')
+ file.write('Bone ids: '+str(joint.bone_ids)+'\n')
+ file.write('Axis: '+str(joint.axis)+'\n')
+ i = i + 1
+
+ file.close()
+
+def ReadPHXBN(file_path, mesh_obj):
+ # File loading stuff
+ # Open the file for importing
+ file = open(file_path, 'rb')
+
+ data = phxbn_types.PHXBNdata();
+
+ print ("\nLoading phxbn file: ", file_path)
+ data.version.fromfile(file, 1)
+ print ('Version: ', data.version[0], '\n')
+
+ if data.version[0] < 8:
+ print('PHXBN must be at least version 8.')
+ return
+
+ data.rigging_stage.fromfile(file, 1)
+ print ('Rigging stage: ', data.rigging_stage[0], '\n')
+
+ if data.rigging_stage[0] != 1:
+ print('Rigging stage should be 1')
+ return
+
+ num_points = Get4ByteIntArray()
+ num_points.fromfile(file, 1)
+ print ('Num points: ', num_points[0], '\n')
+
+ for i in range(0,num_points[0]):
+ vertex = array.array('f')
+ vertex.fromfile(file, 3)
+ #print(vertex)
+ #Convert Phoenix coordinates to Blender coordinates
+ vertex[1], vertex[2] = -vertex[2], vertex[1]
+ data.vertices.append(vertex)
+
+ for i in range(0,num_points[0]):
+ parent = Get4ByteIntArray()
+ parent.fromfile(file, 1)
+ data.parents.append(parent[0])
+
+ num_bones = Get4ByteIntArray()
+ num_bones.fromfile(file, 1)
+ print ('Num bones: ', num_bones[0], '\n')
+
+ for i in range(0,num_bones[0]):
+ bone = Get4ByteIntArray()
+ bone.fromfile(file, 2)
+ if data.parents[bone[0]]==bone[1]:
+ temp = bone[0]
+ bone[0] = bone[1]
+ bone[1] = temp
+ data.bone_swap.append(1)
+ else:
+ data.bone_swap.append(0)
+ data.bones.append(bone)
+
+ for i in range(0,num_bones[0]):
+ bone_parent = Get4ByteIntArray()
+ bone_parent.fromfile(file, 1)
+ data.bone_parents.append(bone_parent[0])
+
+ data.bone_mass.fromfile(file, num_bones[0])
+ data.bone_com.fromfile(file, num_bones[0]*3)
+ data.bone_mat.fromfile(file, num_bones[0]*16)
+
+ mesh = mesh_obj.data
+
+ num_faces = len(mesh.faces)
+ num_verts = num_faces * 3
+ #print ("Loading ", num_verts, " bone weights and ids")
+ file_bone_weights = array.array('f')
+ file_bone_ids = array.array('f')
+ file_bone_weights.fromfile(file, num_verts*4)
+ file_bone_ids.fromfile(file, num_verts*4)
+
+ num_verts = len(mesh.vertices)
+ data.bone_weights = [0 for i in range(num_verts*4)]
+ data.bone_ids = [0 for i in range(num_verts*4)]
+ for face_id in range(num_faces):
+ for face_vert_num in range(3):
+ for i in range(4):
+ data.bone_weights[mesh.faces[face_id].vertices[face_vert_num]*4+i] =file_bone_weights[face_id*12 + face_vert_num * 4 + i]
+ data.bone_ids[mesh.faces[face_id].vertices[face_vert_num]*4+i] =file_bone_ids[face_id*12 + face_vert_num * 4 + i]
+
+ data.parent_ids.fromfile(file, num_bones[0])
+
+ num_joints = Get4ByteIntArray()
+ num_joints.fromfile(file, 1)
+
+ #print("Loading ", num_joints, " joints")
+
+ for i in range(num_joints[0]):
+ joint = phxbn_types.Joint()
+ joint.type.fromfile(file, 1)
+ if joint.type[0] == phxbn_types._amotor_joint:
+ joint.stop_angles.fromfile(file, 6)
+ elif joint.type[0] == phxbn_types._hinge_joint:
+ joint.stop_angles.fromfile(file, 2)
+ joint.bone_ids.fromfile(file, 2)
+ if joint.type[0] == phxbn_types._hinge_joint:
+ joint.axis.fromfile(file, 3)
+ data.joints.append(joint)
+
+ file.close()
+
+ #WriteToTextFile(file_path+"_text.txt", data)
+ return data
+
+def GetMeshObj():
+ for obj in bpy.context.selected_objects:
+ if obj.type == 'MESH':
+ return obj
+
+def GetMeshMidpoint(data, mesh_obj):
+ mesh = mesh_obj.data
+
+ min_point = array.array('f')
+ max_point = array.array('f')
+
+ for i in range(3):
+ min_point.append(mesh.vertices[0].co[i])
+ max_point.append(mesh.vertices[0].co[i])
+
+ for vert in mesh.vertices:
+ for i in range(3):
+ min_point[i] = min(min_point[i], vert.co[i])
+ max_point[i] = max(max_point[i], vert.co[i])
+
+ mid_point = array.array('f')
+ for i in range(3):
+ mid_point.append((min_point[i] + max_point[i]) * 0.5)
+
+ return mid_point
+ #for vert in data.vertices:
+ # for i in range(3):
+ # vert[i] = vert[i] + mid_point[i]
+
+def GetD6Mat(edit_bone):
+ vec = (edit_bone.tail - edit_bone.head).normalize()
+ vec = Vector((vec[0], vec[2], -vec[1]))
+ right = Vector((0.0001,1.0001,0.000003))
+ up = vec.cross(right).normalize()
+ right = up.cross(vec).normalize()
+
+ return [right[0], right[1], right[2], 0,
+ up[0], up[1], up[2], 0,
+ vec[0],vec[1], vec[2], 0,
+ 0,0,0,1]
+
+def AddFixedJoint(arm_obj,joint):
+ joint_bones = []
+ joint_bones.append(arm_obj.pose.bones["Bone_"+str(joint.bone_ids[0])])
+ joint_bones.append(arm_obj.pose.bones["Bone_"+str(joint.bone_ids[1])])
+
+ if joint_bones[0].parent == joint_bones[1]:
+ child = joint_bones[0]
+ parented = True
+ elif joint_bones[1].parent == joint_bones[0]:
+ child = joint_bones[1]
+ parented = True
+ else:
+ child = joint_bones[1]
+ parented = False
+
+ constraint = child.constraints.new('LIMIT_ROTATION')
+ constraint.use_limit_x = True
+ constraint.use_limit_y = True
+ constraint.use_limit_z = True
+ constraint.influence = 0.0
+ constraint.owner_space = 'LOCAL'
+
+ if parented == False:
+ constraint.name = joint_bones[0].name
+
+def AddAmotorJoint(arm_obj,joint):
+ joint_bones = []
+ joint_bones.append(arm_obj.pose.bones["Bone_"+str(joint.bone_ids[0])])
+ joint_bones.append(arm_obj.pose.bones["Bone_"+str(joint.bone_ids[1])])
+
+ if joint_bones[0].parent == joint_bones[1]:
+ child = joint_bones[0]
+ parented = True
+ elif joint_bones[1].parent == joint_bones[0]:
+ child = joint_bones[1]
+ parented = True
+ else:
+ child = joint_bones[1]
+ parented = False
+
+ constraint = child.constraints.new('LIMIT_ROTATION')
+ constraint.min_x = joint.stop_angles[2]
+ constraint.max_x = joint.stop_angles[3]
+ constraint.min_y = joint.stop_angles[0]
+ constraint.max_y = joint.stop_angles[1]
+ constraint.min_z = joint.stop_angles[4]
+ constraint.max_z = joint.stop_angles[5]
+ constraint.use_limit_x = True
+ constraint.use_limit_y = True
+ constraint.use_limit_z = True
+ constraint.influence = 0.0
+ constraint.owner_space = 'LOCAL'
+
+ if parented == False:
+ constraint.name = joint_bones[0].name
+
+ matrix = GetD6Mat(arm_obj.data.edit_bones[child.name])
+ joint_axis = Vector((matrix[0], -matrix[2], matrix[1]))
+
+ mat = arm_obj.matrix_world * child.matrix
+ x_axis = Vector((mat[0][0], mat[0][1], mat[0][2])).normalize()
+ y_axis = Vector((mat[2][0], mat[2][1], mat[2][2])).normalize()
+ joint_conv = Vector((-x_axis.dot(joint_axis), -y_axis.dot(joint_axis), 0)).normalize()
+ roll = math.atan2(joint_conv[0], joint_conv[1])
+ arm_obj.data.edit_bones[child.name].roll += roll
+
+ child.rotation_mode = 'YXZ'
+
+
+ '''mat = arm_obj.matrix_world * child.matrix
+ bpy.ops.object.add(type='EMPTY', location=(mat[3][0], mat[3][1], mat[3][2]))
+ ob = bpy.context.scene.objects.active
+ ob.empty_draw_type = 'ARROWS'
+ ob.empty_draw_size = 0.1
+
+ mat = arm_obj.matrix_world * child.matrix
+ bpy.ops.object.add(type='EMPTY', location=(mat[3][0] + y_axis[0]*0.1, mat[3][1] + y_axis[1]*0.1, mat[3][2] + y_axis[2]*0.1))
+ ob = bpy.context.scene.objects.active
+ ob.empty_draw_type = 'ARROWS'
+ ob.empty_draw_size = 0.1
+
+ bpy.context.scene.objects.active = arm_obj
+ bpy.ops.object.mode_set(mode='EDIT')'''
+
+def AddHingeJoint(arm_obj,joint):
+ joint_bones = []
+ joint_bones.append(arm_obj.pose.bones["Bone_"+str(joint.bone_ids[0])])
+ joint_bones.append(arm_obj.pose.bones["Bone_"+str(joint.bone_ids[1])])
+ joint_axis = Vector((joint.axis[0], -joint.axis[2], joint.axis[1]))
+
+ if joint_bones[0].parent == joint_bones[1]:
+ child = joint_bones[0]
+ joint_axis *= -1
+ parented = True
+ elif joint_bones[1].parent == joint_bones[0]:
+ child = joint_bones[1]
+ parented = True
+ else:
+ child = joint_bones[1]
+ parented = False
+
+ constraint = child.constraints.new('LIMIT_ROTATION')
+ constraint.min_x = joint.stop_angles[0]
+ constraint.max_x = joint.stop_angles[1]
+ constraint.use_limit_x = True
+ constraint.use_limit_y = True
+ constraint.use_limit_z = True
+ constraint.influence = 0.0
+ constraint.owner_space = 'LOCAL'
+
+ if parented == False:
+ constraint.name = joint_bones[0].name
+
+ mat = arm_obj.matrix_world * child.matrix
+ x_axis = Vector((mat[0][0], mat[0][1], mat[0][2])).normalize()
+ y_axis = Vector((mat[2][0], mat[2][1], mat[2][2])).normalize()
+ joint_conv = Vector((x_axis.dot(joint_axis), y_axis.dot(joint_axis), 0)).normalize()
+ roll = math.atan2(joint_conv[0], joint_conv[1]) + math.pi / 2
+ arm_obj.data.edit_bones[child.name].roll += roll
+
+ child.rotation_mode = 'XYZ'
+
+ '''mat = arm_obj.matrix_world * child.matrix
+ bpy.ops.object.add(type='EMPTY', location=(mat[3][0], mat[3][1], mat[3][2]))
+ ob = bpy.context.scene.objects.active
+ ob.empty_draw_type = 'ARROWS'
+ ob.empty_draw_size = 0.1'''
+
+ '''mat = arm_obj.matrix_world * child.matrix
+ bpy.ops.object.add(type='EMPTY', location=(mat[3][0] + y_axis[0]*0.1, mat[3][1] + y_axis[1]*0.1, mat[3][2] + y_axis[2]*0.1))
+ ob = bpy.context.scene.objects.active
+ ob.empty_draw_type = 'ARROWS'
+ ob.empty_draw_size = 0.1
+
+ mat = arm_obj.matrix_world * child.matrix
+ x_axis = Vector((mat[0][0], mat[0][1], mat[0][2])) * 0.1
+ bpy.ops.object.add(type='EMPTY', location=(mat[3][0]+x_axis[0], mat[3][1]+x_axis[1], mat[3][2]+x_axis[2]))
+ ob = bpy.context.scene.objects.active
+ ob.empty_draw_type = 'ARROWS'
+ ob.empty_draw_size = 0.1'''
+
+ '''mat = arm_obj.matrix_world * child.matrix
+ x_axis = Vector((joint.axis[0], -joint.axis[2], joint.axis[1])) * 0.1
+ bpy.ops.object.add(type='EMPTY', location=(mat[3][0]+x_axis[0], mat[3][1]+x_axis[1], mat[3][2]+x_axis[2]))
+ ob = bpy.context.scene.objects.active
+ ob.empty_draw_type = 'ARROWS'
+ ob.empty_draw_size = 0.1
+
+ bpy.context.scene.objects.active = arm_obj
+ bpy.ops.object.mode_set(mode='EDIT')'''
+
+def AddArmature(data, mesh_obj):
+ scn = bpy.context.scene
+ for ob in scn.objects:
+ ob.select = False
+
+ mid_point = GetMeshMidpoint(data, mesh_obj)
+
+ arm_data = bpy.data.armatures.new("MyPHXBN")
+ arm_data.use_auto_ik = True
+ arm_obj = bpy.data.objects.new("MyPHXBN",arm_data)
+ scn.objects.link(arm_obj)
+ arm_obj.select = True
+ arm_obj.location = mid_point
+ scn.objects.active = arm_obj
+
+ arm_data["version"] = data.version[0]
+ arm_data["rigging_stage"] = data.rigging_stage[0]
+
+ bpy.ops.object.mode_set(mode='EDIT')
+
+ bpy.ops.armature.delete()
+ bpy.ops.armature.select_all()
+ bpy.ops.armature.delete()
+
+ mesh = mesh_obj.data
+ min_point = array.array('f')
+ max_point = array.array('f')
+
+ for i in range(3):
+ min_point.append(mesh.vertices[0].co[i])
+ max_point.append(mesh.vertices[0].co[i])
+
+ for vert in mesh.vertices:
+ for i in range(3):
+ min_point[i] = min(min_point[i], vert.co[i])
+ max_point[i] = max(max_point[i], vert.co[i])
+
+ num = 0
+ for data_bone in data.bones:
+ bpy.ops.armature.bone_primitive_add(name="Bone_"+str(num))
+ bone = arm_data.edit_bones[-1]
+ bone.use_connect = True
+ bone["Point IDs"] = data_bone
+ bone["Swap"] = data.bone_swap[num]
+ #print (data_bone)
+ bone.head = Vector((data.vertices[data_bone[0]][0],
+ data.vertices[data_bone[0]][1],
+ data.vertices[data_bone[0]][2]))
+ bone.tail = Vector((data.vertices[data_bone[1]][0],
+ data.vertices[data_bone[1]][1],
+ data.vertices[data_bone[1]][2]))
+ bone["Mass"] = data.bone_mass[num]
+ bone["COM"] = [data.bone_com[num*3+0],
+ data.bone_com[num*3+1],
+ data.bone_com[num*3+2]]
+ bone["mat"] = data.bone_mat[num*16:num*16+16]
+ num = num + 1
+
+ #print("Bones: ", data.bones)
+
+
+ bpy.ops.armature.bone_primitive_add(name="root")
+ bone = arm_data.edit_bones[-1]
+ bone.head = Vector(((min_point[0]+max_point[0])*0.5,
+ (min_point[1]+max_point[1])*0.5+0.5,
+ -mid_point[2]))
+ bone.tail = Vector(((min_point[0]+max_point[0])*0.5,
+ (min_point[1]+max_point[1])*0.5+0.25,
+ -mid_point[2]))
+
+ num = 0
+ for bone_parent in data.bone_parents:
+ name = "Bone_"+str(num);
+ parent_name = "Bone_"+str(bone_parent)
+ if bone_parent != -1:
+ arm_data.edit_bones[name].parent = arm_data.edit_bones[bone_parent]
+ else:
+ arm_data.edit_bones[name].use_connect = False
+ arm_data.edit_bones[name].parent = arm_data.edit_bones["root"]
+ num = num + 1
+
+ bpy.context.scene.update()
+
+ bpy.ops.object.mode_set(mode='OBJECT')
+ bpy.context.scene.objects.active = mesh_obj
+ bpy.ops.object.vertex_group_remove(all=True)
+
+ vertgroup_created=[]
+ for bone in data.bones:
+ vertgroup_created.append(0)
+
+ mesh = mesh_obj.data
+ index = 0
+ vert_index = 0
+ for vert in mesh.vertices:
+ for bone_num in range(0,4):
+ bone_id = int(data.bone_ids[index])
+ bone_weight = data.bone_weights[index]
+ name = "Bone_"+str(bone_id);
+ if vertgroup_created[bone_id]==0:
+ vertgroup_created[bone_id]=1
+ mesh_obj.vertex_groups.new(name)
+ #assign the weight for this vertex
+ mesh_obj.vertex_groups.assign([vert_index],
+ mesh_obj.vertex_groups[name],
+ bone_weight,
+ 'REPLACE')
+ index = index + 1
+ vert_index = vert_index + 1
+ mesh.update()
+
+ mesh_obj.select = True
+ scn.objects.active = arm_obj
+ bpy.ops.object.parent_set(type='ARMATURE')
+ #arm_obj.makeParentDeform([mesh_obj], 0, 0)
+ arm_obj.show_x_ray = True
+
+ def ncr(n, r):
+ return math.factorial(n) / \
+ (math.factorial(r) * math.factorial(n - r))
+
+ def CountJoints(bone):
+ num_children = len(bone.children)
+ if num_children == 0:
+ return 0
+ if bone.name != "root":
+ num_children += 1
+ count = ncr(num_children, 2)
+ for child in bone.children:
+ count += CountJoints(child)
+ return int(count)
+
+ '''arm_data["num_joints"] = CountJoints(arm_data.bones["root"])
+ arm_data["num_special_joints"] = len(data.joints)
+ num = 0
+ for joint in data.joints:
+ name = "joint_" + str(num)
+ arm_data[name + "_type"] = joint.type[0]
+ if joint.type[0] == phxbn_types._amotor_joint:
+ arm_data[name + "_angles"] = joint.stop_angles
+ elif joint.type[0] == phxbn_types._hinge_joint:
+ arm_data[name + "_angles"] = joint.stop_angles
+ arm_data[name + "_bone_ids"] = joint.bone_ids
+ if joint.type[0] == phxbn_types._hinge_joint:
+ arm_data[name+"_axis"] = joint.axis
+ num = num + 1'''
+ arm_data["parents"] = data.parents
+ arm_data["parent_ids"] = data.parent_ids
+
+ bpy.ops.object.mode_set(mode='EDIT')
+ for joint in data.joints:
+ if joint.type[0] == phxbn_types._hinge_joint:
+ AddHingeJoint(arm_obj, joint)
+ if joint.type[0] == phxbn_types._amotor_joint:
+ AddAmotorJoint(arm_obj, joint)
+ if joint.type[0] == phxbn_types._fixed_joint:
+ AddFixedJoint(arm_obj, joint)
+
+def Load(filepath):
+ mesh_obj = GetMeshObj()
+ if not mesh_obj:
+ print("No mesh is selected")
+ return
+
+ data = ReadPHXBN(filepath, mesh_obj)
+ if not data:
+ return
+
+ AddArmature(data, mesh_obj)
+
+class PHXBNImporter(bpy.types.Operator):
+ '''Load Phoenix Bones armature'''
+ bl_idname = "import_armature.phxbn"
+ bl_label = "Import PHXBN"
+
+ filepath = StringProperty(name="File Path", description="Filepath used for importing the PHXBN file", maxlen=1024, default="")
+
+ def execute(self, context):
+ print("Filepath:",self.properties.filepath)
+ Load(self.properties.filepath)
+
+ filename = self.properties.filepath.split("\\")[-1]
+ #convert the filename to an object name
+ objName = bpy.path.display_name(filename)
+ print("Filename:",filename)
+
+ #mesh = readMesh(self.properties.filepath, objName)
+ #addMeshObj(mesh, objName)
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.add_fileselect(self)
+ return {'RUNNING_MODAL'}
+
+#Load("C:\\Users\\David\\Desktop\\Wolfire SVN\\Project\\Data\\Skeletons\\basic-attached-guard-joints.phxbn")
+#Load("C:\\Users\\David\\Desktop\\export.phxbn")
diff --git a/Data/BlenderScript/addons/io_phxbn/phxbn_types.py b/Data/BlenderScript/addons/io_phxbn/phxbn_types.py
new file mode 100644
index 00000000..ad52b0b5
--- /dev/null
+++ b/Data/BlenderScript/addons/io_phxbn/phxbn_types.py
@@ -0,0 +1,42 @@
+import array
+
+_hinge_joint = 0
+_amotor_joint = 1
+_fixed_joint = 2
+
+class IKBone:
+ def __init__(self):
+ self.name = ""
+ self.bone = 0
+ self.chain = 0
+
+def Get4ByteIntArray():
+ var = array.array('l')
+ if var.itemsize != 4:
+ var = array.array('i')
+ return var
+
+class Joint:
+ def __init__(self):
+ self.type = Get4ByteIntArray()
+ self.stop_angles = array.array('f')
+ self.bone_ids = Get4ByteIntArray()
+ self.axis = array.array('f')
+
+class PHXBNdata:
+ def __init__(self):
+ self.vertices = []
+ self.bones = []
+ self.parents = Get4ByteIntArray()
+ self.bone_parents = Get4ByteIntArray()
+ self.bone_weights = array.array('f')
+ self.bone_ids = array.array('f')
+ self.bone_swap = Get4ByteIntArray()
+ self.bone_mass = array.array('f')
+ self.bone_com = array.array('f')
+ self.rigging_stage = Get4ByteIntArray()
+ self.version = Get4ByteIntArray()
+ self.parent_ids = Get4ByteIntArray()
+ self.joints = []
+ self.bone_mat = array.array('f')
+ self.ik_bones = []
diff --git a/Data/BlenderScript/addons/symmetricalize.py b/Data/BlenderScript/addons/symmetricalize.py
new file mode 100644
index 00000000..5c779050
--- /dev/null
+++ b/Data/BlenderScript/addons/symmetricalize.py
@@ -0,0 +1,79 @@
+"""
+This script makes meshes symmetrical if they are nearly symmetrical
+"""
+
+bl_addon_info = {
+ 'name': 'Mesh: Symmetricalize',
+ 'author': 'David Rosen',
+ 'version': '1',
+ 'blender': (2, 5, 4),
+ 'location': 'View3D > Specials > Symmetricalize',
+ 'description': 'This script makes meshes symmetrical if they are nearly symmetrical',
+ 'warning': '', # used for warning icon and text in addons panel
+ 'wiki_url': '',
+ 'tracker_url': '',
+ 'category': 'Mesh'}
+
+import bpy
+
+def SymmetricalizeFunc(context):
+ print("Symmetricalizing...")
+ obj = context.scene.objects.active
+ mesh = obj.data
+
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+ min_coord = mesh.vertices[0].co[0]
+ for vert in mesh.vertices:
+ if(abs(vert.co[0])<abs(min_coord)):
+ min_coord = vert.co[0]
+
+ print("Old center point was: ", min_coord)
+
+ for vert in mesh.vertices:
+ vert.co[0] = vert.co[0] - min_coord
+
+ bucket_scale = 100000
+
+ vert_buckets = {}
+ for vert in mesh.vertices:
+ if vert.co[0] > 0:
+ vert_buckets[int(round(vert.co[0] * bucket_scale))] = vert.index
+
+ for vert in mesh.vertices:
+ if(vert.co[0] < 0):
+ index = int(round(-vert.co[0] * bucket_scale))
+ if index in vert_buckets:
+ vert.co[0] = mesh.vertices[vert_buckets[index]].co[0] * -1
+
+ bpy.ops.object.mode_set(mode='EDIT')
+
+class Symmetricalize(bpy.types.Operator):
+ '''Makes meshes symmetrical if they are nearly symmetrical'''
+ bl_idname = 'mesh.symmetricalize'
+ bl_label = 'Symmetricalize'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ @classmethod
+ def poll(self, context):
+ obj = context.active_object
+ return (obj and obj.type == 'MESH')
+
+ def execute(self, context):
+ SymmetricalizeFunc(context)
+ return {'FINISHED'}
+
+menu_func = (lambda self, context: self.layout.operator(Symmetricalize.bl_idname, text="Symmetricalize"))
+
+def register():
+ #bpy.types.register(Symmetricalize)
+ bpy.types.VIEW3D_MT_edit_mesh_specials.append(menu_func)
+ bpy.types.VIEW3D_MT_edit_mesh_vertices.append(menu_func)
+
+def unregister():
+ #bpy.types.unregister(Symmetricalize)
+ bpy.types.VIEW3D_MT_edit_mesh_specials.remove(menu_func)
+ bpy.types.VIEW3D_MT_edit_mesh_vertices.remove(menu_func)
+
+if __name__ == "__main__":
+ register()
diff --git a/Data/BlenderScript/io/export_obj.py b/Data/BlenderScript/io/export_obj.py
new file mode 100644
index 00000000..53e1f1f6
--- /dev/null
+++ b/Data/BlenderScript/io/export_obj.py
@@ -0,0 +1,989 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program 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
+# of the License, or (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+"""
+Name: 'Wavefront (.obj)...'
+Blender: 248
+Group: 'Export'
+Tooltip: 'Save a Wavefront OBJ File'
+"""
+
+__author__ = "Campbell Barton, Jiri Hnidek, Paolo Ciccone"
+__url__ = ['http://wiki.blender.org/index.php/Scripts/Manual/Export/wavefront_obj', 'www.blender.org', 'blenderartists.org']
+__version__ = "1.21"
+
+__bpydoc__ = """\
+This script is an exporter to OBJ file format.
+
+Usage:
+
+Select the objects you wish to export and run this script from "File->Export" menu.
+Selecting the default options from the popup box will be good in most cases.
+All objects that can be represented as a mesh (mesh, curve, metaball, surface, text3d)
+will be exported as mesh data.
+"""
+
+# import math and other in functions that use them for the sake of fast Blender startup
+# import math
+import os
+import time
+import shutil
+
+import bpy
+import mathutils
+
+
+# Returns a tuple - path,extension.
+# 'hello.obj' > ('hello', '.obj')
+def splitExt(path):
+ dotidx = path.rfind('.')
+ if dotidx == -1:
+ return path, ''
+ else:
+ return path[:dotidx], path[dotidx:]
+
+def fixName(name):
+ if name == None:
+ return 'None'
+ else:
+ return name.replace(' ', '_')
+
+def write_mtl(scene, filepath, copy_images, mtl_dict):
+
+ world = scene.world
+ worldAmb = world.ambient_color
+
+ dest_dir = os.path.dirname(filepath)
+
+ def copy_image(image):
+ fn = bpy.utils.expandpath(image.filepath)
+ fn_strip = os.path.basename(fn)
+ if copy_images:
+ rel = fn_strip
+ fn_abs_dest = os.path.join(dest_dir, fn_strip)
+ if not os.path.exists(fn_abs_dest):
+ shutil.copy(fn, fn_abs_dest)
+ else:
+ rel = fn
+
+ return rel
+
+
+ file = open(filepath, "w")
+ # XXX
+# file.write('# Blender MTL File: %s\n' % Blender.Get('filepath').split('\\')[-1].split('/')[-1])
+ file.write('# Material Count: %i\n' % len(mtl_dict))
+ # Write material/image combinations we have used.
+ for key, (mtl_mat_name, mat, img) in mtl_dict.items():
+
+ # Get the Blender data for the material and the image.
+ # Having an image named None will make a bug, dont do it :)
+
+ file.write('newmtl %s\n' % mtl_mat_name) # Define a new material: matname_imgname
+
+ if mat:
+ file.write('Ns %.6f\n' % ((mat.specular_hardness-1) * 1.9607843137254901) ) # Hardness, convert blenders 1-511 to MTL's
+ file.write('Ka %.6f %.6f %.6f\n' % tuple([c*mat.ambient for c in worldAmb]) ) # Ambient, uses mirror colour,
+ file.write('Kd %.6f %.6f %.6f\n' % tuple([c*mat.diffuse_intensity for c in mat.diffuse_color]) ) # Diffuse
+ file.write('Ks %.6f %.6f %.6f\n' % tuple([c*mat.specular_intensity for c in mat.specular_color]) ) # Specular
+ if hasattr(mat, "ior"):
+ file.write('Ni %.6f\n' % mat.ior) # Refraction index
+ else:
+ file.write('Ni %.6f\n' % 1.0)
+ file.write('d %.6f\n' % mat.alpha) # Alpha (obj uses 'd' for dissolve)
+
+ # 0 to disable lighting, 1 for ambient & diffuse only (specular color set to black), 2 for full lighting.
+ if mat.shadeless:
+ file.write('illum 0\n') # ignore lighting
+ elif mat.specular_intensity == 0:
+ file.write('illum 1\n') # no specular.
+ else:
+ file.write('illum 2\n') # light normaly
+
+ else:
+ #write a dummy material here?
+ file.write('Ns 0\n')
+ file.write('Ka %.6f %.6f %.6f\n' % tuple([c for c in worldAmb]) ) # Ambient, uses mirror colour,
+ file.write('Kd 0.8 0.8 0.8\n')
+ file.write('Ks 0.8 0.8 0.8\n')
+ file.write('d 1\n') # No alpha
+ file.write('illum 2\n') # light normaly
+
+ # Write images!
+ if img: # We have an image on the face!
+ # write relative image path
+ rel = copy_image(img)
+ file.write('map_Kd %s\n' % rel) # Diffuse mapping image
+# file.write('map_Kd %s\n' % img.filepath.split('\\')[-1].split('/')[-1]) # Diffuse mapping image
+
+ elif mat: # No face image. if we havea material search for MTex image.
+ for mtex in mat.texture_slots:
+ if mtex and mtex.texture.type == 'IMAGE':
+ try:
+ filepath = copy_image(mtex.texture.image)
+# filepath = mtex.texture.image.filepath.split('\\')[-1].split('/')[-1]
+ file.write('map_Kd %s\n' % filepath) # Diffuse mapping image
+ break
+ except:
+ # Texture has no image though its an image type, best ignore.
+ pass
+
+ file.write('\n\n')
+
+ file.close()
+
+# XXX not used
+def copy_file(source, dest):
+ file = open(source, 'rb')
+ data = file.read()
+ file.close()
+
+ file = open(dest, 'wb')
+ file.write(data)
+ file.close()
+
+
+# XXX not used
+def copy_images(dest_dir):
+ if dest_dir[-1] != os.sep:
+ dest_dir += os.sep
+# if dest_dir[-1] != sys.sep:
+# dest_dir += sys.sep
+
+ # Get unique image names
+ uniqueImages = {}
+ for matname, mat, image in mtl_dict.values(): # Only use image name
+ # Get Texface images
+ if image:
+ uniqueImages[image] = image # Should use sets here. wait until Python 2.4 is default.
+
+ # Get MTex images
+ if mat:
+ for mtex in mat.texture_slots:
+ if mtex and mtex.texture.type == 'IMAGE':
+ image_tex = mtex.texture.image
+ if image_tex:
+ try:
+ uniqueImages[image_tex] = image_tex
+ except:
+ pass
+
+ # Now copy images
+ copyCount = 0
+
+# for bImage in uniqueImages.values():
+# image_path = bpy.utils.expandpath(bImage.filepath)
+# if bpy.sys.exists(image_path):
+# # Make a name for the target path.
+# dest_image_path = dest_dir + image_path.split('\\')[-1].split('/')[-1]
+# if not bpy.utils.exists(dest_image_path): # Image isnt already there
+# print('\tCopying "%s" > "%s"' % (image_path, dest_image_path))
+# copy_file(image_path, dest_image_path)
+# copyCount+=1
+
+# paths= bpy.util.copy_images(uniqueImages.values(), dest_dir)
+
+ print('\tCopied %d images' % copyCount)
+# print('\tCopied %d images' % copyCount)
+
+# XXX not converted
+def test_nurbs_compat(ob):
+ if ob.type != 'Curve':
+ return False
+
+ for nu in ob.data:
+ if (not nu.knotsV) and nu.type != 1: # not a surface and not bezier
+ return True
+
+ return False
+
+
+# XXX not converted
+def write_nurb(file, ob, ob_mat):
+ tot_verts = 0
+ cu = ob.data
+
+ # use negative indices
+ Vector = Blender.mathutils.Vector
+ for nu in cu:
+
+ if nu.type==0: DEG_ORDER_U = 1
+ else: DEG_ORDER_U = nu.orderU-1 # Tested to be correct
+
+ if nu.type==1:
+ print("\tWarning, bezier curve:", ob.name, "only poly and nurbs curves supported")
+ continue
+
+ if nu.knotsV:
+ print("\tWarning, surface:", ob.name, "only poly and nurbs curves supported")
+ continue
+
+ if len(nu) <= DEG_ORDER_U:
+ print("\tWarning, orderU is lower then vert count, skipping:", ob.name)
+ continue
+
+ pt_num = 0
+ do_closed = (nu.flagU & 1)
+ do_endpoints = (do_closed==0) and (nu.flagU & 2)
+
+ for pt in nu:
+ pt = Vector(pt[0], pt[1], pt[2]) * ob_mat
+ file.write('v %.6f %.6f %.6f\n' % (pt[0], pt[1], pt[2]))
+ pt_num += 1
+ tot_verts += pt_num
+
+ file.write('g %s\n' % (fixName(ob.name))) # fixName(ob.getData(1)) could use the data name too
+ file.write('cstype bspline\n') # not ideal, hard coded
+ file.write('deg %d\n' % DEG_ORDER_U) # not used for curves but most files have it still
+
+ curve_ls = [-(i+1) for i in range(pt_num)]
+
+ # 'curv' keyword
+ if do_closed:
+ if DEG_ORDER_U == 1:
+ pt_num += 1
+ curve_ls.append(-1)
+ else:
+ pt_num += DEG_ORDER_U
+ curve_ls = curve_ls + curve_ls[0:DEG_ORDER_U]
+
+ file.write('curv 0.0 1.0 %s\n' % (' '.join( [str(i) for i in curve_ls] ))) # Blender has no U and V values for the curve
+
+ # 'parm' keyword
+ tot_parm = (DEG_ORDER_U + 1) + pt_num
+ tot_parm_div = float(tot_parm-1)
+ parm_ls = [(i/tot_parm_div) for i in range(tot_parm)]
+
+ if do_endpoints: # end points, force param
+ for i in range(DEG_ORDER_U+1):
+ parm_ls[i] = 0.0
+ parm_ls[-(1+i)] = 1.0
+
+ file.write('parm u %s\n' % ' '.join( [str(i) for i in parm_ls] ))
+
+ file.write('end\n')
+
+ return tot_verts
+
+def write(filepath, objects, scene,
+ EXPORT_TRI=False,
+ EXPORT_EDGES=False,
+ EXPORT_NORMALS=False,
+ EXPORT_NORMALS_HQ=False,
+ EXPORT_UV=True,
+ EXPORT_MTL=True,
+ EXPORT_COPY_IMAGES=False,
+ EXPORT_APPLY_MODIFIERS=True,
+ EXPORT_ROTX90=True,
+ EXPORT_BLEN_OBS=True,
+ EXPORT_GROUP_BY_OB=False,
+ EXPORT_GROUP_BY_MAT=False,
+ EXPORT_KEEP_VERT_ORDER=False,
+ EXPORT_POLYGROUPS=False,
+ EXPORT_CURVE_AS_NURBS=True):
+ '''
+ Basic write function. The context and options must be already set
+ This can be accessed externaly
+ eg.
+ write( 'c:\\test\\foobar.obj', Blender.Object.GetSelected() ) # Using default options.
+ '''
+
+ # XXX
+ import math
+
+ def veckey3d(v):
+ return round(v.x, 6), round(v.y, 6), round(v.z, 6)
+
+ def veckey2d(v):
+ return round(v[0], 6), round(v[1], 6)
+ # return round(v.x, 6), round(v.y, 6)
+
+ def findVertexGroupName(face, vWeightMap):
+ """
+ Searches the vertexDict to see what groups is assigned to a given face.
+ We use a frequency system in order to sort out the name because a given vetex can
+ belong to two or more groups at the same time. To find the right name for the face
+ we list all the possible vertex group names with their frequency and then sort by
+ frequency in descend order. The top element is the one shared by the highest number
+ of vertices is the face's group
+ """
+ weightDict = {}
+ for vert_index in face.verts:
+# for vert in face:
+ vWeights = vWeightMap[vert_index]
+# vWeights = vWeightMap[vert]
+ for vGroupName, weight in vWeights:
+ weightDict[vGroupName] = weightDict.get(vGroupName, 0) + weight
+
+ if weightDict:
+ alist = [(weight,vGroupName) for vGroupName, weight in weightDict.items()] # sort least to greatest amount of weight
+ alist.sort()
+ return(alist[-1][1]) # highest value last
+ else:
+ return '(null)'
+
+ # TODO: implement this in C? dunno how it should be called...
+ def getVertsFromGroup(me, group_index):
+ ret = []
+
+ for i, v in enumerate(me.verts):
+ for g in v.groups:
+ if g.group == group_index:
+ ret.append((i, g.weight))
+
+ return ret
+
+
+ print('OBJ Export path: "%s"' % filepath)
+ temp_mesh_name = '~tmp-mesh'
+
+ time1 = time.clock()
+# time1 = sys.time()
+# scn = Scene.GetCurrent()
+
+ file = open(filepath, "w")
+
+ # Write Header
+ file.write('# Blender v%s OBJ File: %s\n' % (bpy.app.version_string, bpy.data.filepath.split('/')[-1].split('\\')[-1] ))
+ file.write('# www.blender.org\n')
+
+ # Tell the obj file what material file to use.
+ if EXPORT_MTL:
+ mtlfilepath = '%s.mtl' % '.'.join(filepath.split('.')[:-1])
+ file.write('mtllib %s\n' % ( mtlfilepath.split('\\')[-1].split('/')[-1] ))
+
+ if EXPORT_ROTX90:
+ mat_xrot90= mathutils.RotationMatrix(-math.pi/2, 4, 'X')
+
+ # Initialize totals, these are updated each object
+ totverts = totuvco = totno = 1
+
+ face_vert_index = 1
+
+ globalNormals = {}
+
+ # A Dict of Materials
+ # (material.name, image.name):matname_imagename # matname_imagename has gaps removed.
+ mtl_dict = {}
+
+ # Get all meshes
+ for ob_main in objects:
+
+ # ignore dupli children
+ if ob_main.parent and ob_main.parent.dupli_type != 'NONE':
+ # XXX
+ print(ob_main.name, 'is a dupli child - ignoring')
+ continue
+
+ obs = []
+ if ob_main.dupli_type != 'NONE':
+ # XXX
+ print('creating dupli_list on', ob_main.name)
+ ob_main.create_dupli_list(scene)
+
+ obs = [(dob.object, dob.matrix) for dob in ob_main.dupli_list]
+
+ # XXX debug print
+ print(ob_main.name, 'has', len(obs), 'dupli children')
+ else:
+ obs = [(ob_main, ob_main.matrix_world)]
+
+ for ob, ob_mat in obs:
+
+ # XXX postponed
+# # Nurbs curve support
+# if EXPORT_CURVE_AS_NURBS and test_nurbs_compat(ob):
+# if EXPORT_ROTX90:
+# ob_mat = ob_mat * mat_xrot90
+
+# totverts += write_nurb(file, ob, ob_mat)
+
+# continue
+# end nurbs
+
+ if ob.type != 'MESH':
+ continue
+
+ me = ob.create_mesh(scene, EXPORT_APPLY_MODIFIERS, 'PREVIEW')
+
+ if EXPORT_ROTX90:
+ me.transform(mat_xrot90 * ob_mat)
+ else:
+ me.transform(ob_mat)
+
+# # Will work for non meshes now! :)
+# me= BPyMesh.getMeshFromObject(ob, containerMesh, EXPORT_APPLY_MODIFIERS, EXPORT_POLYGROUPS, scn)
+# if not me:
+# continue
+
+ if EXPORT_UV:
+ faceuv = len(me.uv_textures) > 0
+ else:
+ faceuv = False
+
+ # XXX - todo, find a better way to do triangulation
+ # ...removed convert_to_triface because it relies on editmesh
+ '''
+ # We have a valid mesh
+ if EXPORT_TRI and me.faces:
+ # Add a dummy object to it.
+ has_quads = False
+ for f in me.faces:
+ if f.verts[3] != 0:
+ has_quads = True
+ break
+
+ if has_quads:
+ newob = bpy.data.objects.new('temp_object', me)
+ # if we forget to set Object.data - crash
+ scene.objects.link(newob)
+ newob.convert_to_triface(scene)
+ # mesh will still be there
+ scene.objects.unlink(newob)
+ '''
+
+ # Make our own list so it can be sorted to reduce context switching
+ face_index_pairs = [ (face, index) for index, face in enumerate(me.faces)]
+ # faces = [ f for f in me.faces ]
+
+ if EXPORT_EDGES:
+ edges = me.edges
+ else:
+ edges = []
+
+ if not (len(face_index_pairs)+len(edges)+len(me.verts)): # Make sure there is somthing to write
+
+ # clean up
+ bpy.data.meshes.remove(me)
+
+ continue # dont bother with this mesh.
+
+ # XXX
+ # High Quality Normals
+ if EXPORT_NORMALS and face_index_pairs:
+ me.calc_normals()
+# if EXPORT_NORMALS_HQ:
+# BPyMesh.meshCalcNormals(me)
+# else:
+# # transforming normals is incorrect
+# # when the matrix is scaled,
+# # better to recalculate them
+# me.calcNormals()
+
+ materials = me.materials
+
+ materialNames = []
+ materialItems = [m for m in materials]
+ if materials:
+ for mat in materials:
+ if mat: # !=None
+ materialNames.append(mat.name)
+ else:
+ materialNames.append(None)
+ # Cant use LC because some materials are None.
+ # materialNames = map(lambda mat: mat.name, materials) # Bug Blender, dosent account for null materials, still broken.
+
+ # Possible there null materials, will mess up indicies
+ # but at least it will export, wait until Blender gets fixed.
+ materialNames.extend((16-len(materialNames)) * [None])
+ materialItems.extend((16-len(materialItems)) * [None])
+
+ # Sort by Material, then images
+ # so we dont over context switch in the obj file.
+ if EXPORT_KEEP_VERT_ORDER:
+ pass
+ elif faceuv:
+ # XXX update
+ tface = me.active_uv_texture.data
+
+ face_index_pairs.sort(key=lambda a: (a[0].material_index, hash(tface[a[1]].image), a[0].smooth))
+ elif len(materials) > 1:
+ face_index_pairs.sort(key = lambda a: (a[0].material_index, a[0].smooth))
+ else:
+ # no materials
+ face_index_pairs.sort(key = lambda a: a[0].smooth)
+# if EXPORT_KEEP_VERT_ORDER:
+# pass
+# elif faceuv:
+# try: faces.sort(key = lambda a: (a.mat, a.image, a.smooth))
+# except: faces.sort(lambda a,b: cmp((a.mat, a.image, a.smooth), (b.mat, b.image, b.smooth)))
+# elif len(materials) > 1:
+# try: faces.sort(key = lambda a: (a.mat, a.smooth))
+# except: faces.sort(lambda a,b: cmp((a.mat, a.smooth), (b.mat, b.smooth)))
+# else:
+# # no materials
+# try: faces.sort(key = lambda a: a.smooth)
+# except: faces.sort(lambda a,b: cmp(a.smooth, b.smooth))
+
+ faces = [pair[0] for pair in face_index_pairs]
+
+ # Set the default mat to no material and no image.
+ contextMat = (0, 0) # Can never be this, so we will label a new material teh first chance we get.
+ contextSmooth = None # Will either be true or false, set bad to force initialization switch.
+
+ if EXPORT_BLEN_OBS or EXPORT_GROUP_BY_OB:
+ name1 = ob.name
+ name2 = ob.data.name
+ if name1 == name2:
+ obnamestring = fixName(name1)
+ else:
+ obnamestring = '%s_%s' % (fixName(name1), fixName(name2))
+
+ if EXPORT_BLEN_OBS:
+ file.write('o %s\n' % obnamestring) # Write Object name
+ else: # if EXPORT_GROUP_BY_OB:
+ file.write('g %s\n' % obnamestring)
+
+
+ # Vert
+ for v in me.verts:
+ file.write('v %.6f %.6f %.6f\n' % tuple(v.co))
+
+ # UV
+ if faceuv:
+ uv_face_mapping = [[0,0,0,0] for f in faces] # a bit of a waste for tri's :/
+
+ uv_dict = {} # could use a set() here
+ uv_layer = me.active_uv_texture
+ for f, f_index in face_index_pairs:
+
+ tface = uv_layer.data[f_index]
+
+ # workaround, since tface.uv iteration is wrong atm
+ uvs = tface.uv
+ # uvs = [tface.uv1, tface.uv2, tface.uv3]
+
+ # # add another UV if it's a quad
+ # if len(f.verts) == 4:
+ # uvs.append(tface.uv4)
+
+ for uv_index, uv in enumerate(uvs):
+ uvkey = veckey2d(uv)
+ try:
+ uv_face_mapping[f_index][uv_index] = uv_dict[uvkey]
+ except:
+ uv_face_mapping[f_index][uv_index] = uv_dict[uvkey] = len(uv_dict)
+ file.write('vt %.6f %.6f\n' % tuple(uv))
+
+# uv_dict = {} # could use a set() here
+# for f_index, f in enumerate(faces):
+
+# for uv_index, uv in enumerate(f.uv):
+# uvkey = veckey2d(uv)
+# try:
+# uv_face_mapping[f_index][uv_index] = uv_dict[uvkey]
+# except:
+# uv_face_mapping[f_index][uv_index] = uv_dict[uvkey] = len(uv_dict)
+# file.write('vt %.6f %.6f\n' % tuple(uv))
+
+ uv_unique_count = len(uv_dict)
+# del uv, uvkey, uv_dict, f_index, uv_index
+ # Only need uv_unique_count and uv_face_mapping
+
+ # NORMAL, Smooth/Non smoothed.
+ if EXPORT_NORMALS:
+ for f in faces:
+ if f.smooth:
+ for vIdx in f.verts:
+ v = me.verts[vIdx]
+ noKey = veckey3d(v.normal)
+ if noKey not in globalNormals:
+ globalNormals[noKey] = totno
+ totno +=1
+ file.write('vn %.6f %.6f %.6f\n' % noKey)
+ else:
+ # Hard, 1 normal from the face.
+ noKey = veckey3d(f.normal)
+ if noKey not in globalNormals:
+ globalNormals[noKey] = totno
+ totno +=1
+ file.write('vn %.6f %.6f %.6f\n' % noKey)
+
+ if not faceuv:
+ f_image = None
+
+ # XXX
+ if EXPORT_POLYGROUPS:
+ # Retrieve the list of vertex groups
+# vertGroupNames = me.getVertGroupNames()
+
+ currentVGroup = ''
+ # Create a dictionary keyed by face id and listing, for each vertex, the vertex groups it belongs to
+ vgroupsMap = [[] for _i in range(len(me.verts))]
+# vgroupsMap = [[] for _i in xrange(len(me.verts))]
+ for g in ob.vertex_groups:
+# for vertexGroupName in vertGroupNames:
+ for vIdx, vWeight in getVertsFromGroup(me, g.index):
+# for vIdx, vWeight in me.getVertsFromGroup(vertexGroupName, 1):
+ vgroupsMap[vIdx].append((g.name, vWeight))
+
+ for f_index, f in enumerate(faces):
+ f_v = [{"index": index, "vertex": me.verts[index]} for index in f.verts]
+
+ # if f.verts[3] == 0:
+ # f_v.pop()
+
+# f_v= f.v
+ f_smooth= f.smooth
+ f_mat = min(f.material_index, len(materialNames)-1)
+# f_mat = min(f.mat, len(materialNames)-1)
+ if faceuv:
+
+ tface = me.active_uv_texture.data[face_index_pairs[f_index][1]]
+
+ f_image = tface.image
+ f_uv = tface.uv
+ # f_uv= [tface.uv1, tface.uv2, tface.uv3]
+ # if len(f.verts) == 4:
+ # f_uv.append(tface.uv4)
+# f_image = f.image
+# f_uv= f.uv
+
+ # MAKE KEY
+ if faceuv and f_image: # Object is always true.
+ key = materialNames[f_mat], f_image.name
+ else:
+ key = materialNames[f_mat], None # No image, use None instead.
+
+ # Write the vertex group
+ if EXPORT_POLYGROUPS:
+ if len(ob.vertex_groups):
+ # find what vertext group the face belongs to
+ theVGroup = findVertexGroupName(f,vgroupsMap)
+ if theVGroup != currentVGroup:
+ currentVGroup = theVGroup
+ file.write('g %s\n' % theVGroup)
+# # Write the vertex group
+# if EXPORT_POLYGROUPS:
+# if vertGroupNames:
+# # find what vertext group the face belongs to
+# theVGroup = findVertexGroupName(f,vgroupsMap)
+# if theVGroup != currentVGroup:
+# currentVGroup = theVGroup
+# file.write('g %s\n' % theVGroup)
+
+ # CHECK FOR CONTEXT SWITCH
+ if key == contextMat:
+ pass # Context already switched, dont do anything
+ else:
+ if key[0] == None and key[1] == None:
+ # Write a null material, since we know the context has changed.
+ if EXPORT_GROUP_BY_MAT:
+ # can be mat_image or (null)
+ file.write('g %s_%s\n' % (fixName(ob.name), fixName(ob.data.name)) ) # can be mat_image or (null)
+ file.write('usemtl (null)\n') # mat, image
+
+ else:
+ mat_data= mtl_dict.get(key)
+ if not mat_data:
+ # First add to global dict so we can export to mtl
+ # Then write mtl
+
+ # Make a new names from the mat and image name,
+ # converting any spaces to underscores with fixName.
+
+ # If none image dont bother adding it to the name
+ if key[1] == None:
+ mat_data = mtl_dict[key] = ('%s'%fixName(key[0])), materialItems[f_mat], f_image
+ else:
+ mat_data = mtl_dict[key] = ('%s_%s' % (fixName(key[0]), fixName(key[1]))), materialItems[f_mat], f_image
+
+ if EXPORT_GROUP_BY_MAT:
+ file.write('g %s_%s_%s\n' % (fixName(ob.name), fixName(ob.data.name), mat_data[0]) ) # can be mat_image or (null)
+
+ file.write('usemtl %s\n' % mat_data[0]) # can be mat_image or (null)
+
+ contextMat = key
+ if f_smooth != contextSmooth:
+ if f_smooth: # on now off
+ file.write('s 1\n')
+ contextSmooth = f_smooth
+ else: # was off now on
+ file.write('s off\n')
+ contextSmooth = f_smooth
+
+ file.write('f')
+ if faceuv:
+ if EXPORT_NORMALS:
+ if f_smooth: # Smoothed, use vertex normals
+ for vi, v in enumerate(f_v):
+ file.write( ' %d/%d/%d' % \
+ (v["index"] + totverts,
+ totuvco + uv_face_mapping[f_index][vi],
+ globalNormals[ veckey3d(v["vertex"].normal) ]) ) # vert, uv, normal
+
+ else: # No smoothing, face normals
+ no = globalNormals[ veckey3d(f.normal) ]
+ for vi, v in enumerate(f_v):
+ file.write( ' %d/%d/%d' % \
+ (v["index"] + totverts,
+ totuvco + uv_face_mapping[f_index][vi],
+ no) ) # vert, uv, normal
+ else: # No Normals
+ for vi, v in enumerate(f_v):
+ file.write( ' %d/%d' % (\
+ v["index"] + totverts,\
+ totuvco + uv_face_mapping[f_index][vi])) # vert, uv
+
+ face_vert_index += len(f_v)
+
+ else: # No UV's
+ if EXPORT_NORMALS:
+ if f_smooth: # Smoothed, use vertex normals
+ for v in f_v:
+ file.write( ' %d//%d' %
+ (v["index"] + totverts, globalNormals[ veckey3d(v["vertex"].normal) ]) )
+ else: # No smoothing, face normals
+ no = globalNormals[ veckey3d(f.normal) ]
+ for v in f_v:
+ file.write( ' %d//%d' % (v["index"] + totverts, no) )
+ else: # No Normals
+ for v in f_v:
+ file.write( ' %d' % (v["index"] + totverts) )
+
+ file.write('\n')
+
+ # Write edges.
+ if EXPORT_EDGES:
+ for ed in edges:
+ if ed.loose:
+ file.write('f %d %d\n' % (ed.verts[0] + totverts, ed.verts[1] + totverts))
+
+ # Make the indicies global rather then per mesh
+ totverts += len(me.verts)
+ if faceuv:
+ totuvco += uv_unique_count
+
+ # clean up
+ bpy.data.meshes.remove(me)
+
+ if ob_main.dupli_type != 'NONE':
+ ob_main.free_dupli_list()
+
+ file.close()
+
+
+ # Now we have all our materials, save them
+ if EXPORT_MTL:
+ write_mtl(scene, mtlfilepath, EXPORT_COPY_IMAGES, mtl_dict)
+# if EXPORT_COPY_IMAGES:
+# dest_dir = os.path.basename(filepath)
+# # dest_dir = filepath
+# # # Remove chars until we are just the path.
+# # while dest_dir and dest_dir[-1] not in '\\/':
+# # dest_dir = dest_dir[:-1]
+# if dest_dir:
+# copy_images(dest_dir, mtl_dict)
+# else:
+# print('\tError: "%s" could not be used as a base for an image path.' % filepath)
+
+ print("OBJ Export time: %.2f" % (time.clock() - time1))
+# print "OBJ Export time: %.2f" % (sys.time() - time1)
+
+def do_export(filepath, context,
+ EXPORT_APPLY_MODIFIERS = True, # not used
+ EXPORT_ROTX90 = True, # wrong
+ EXPORT_TRI = False, # ok
+ EXPORT_EDGES = False,
+ EXPORT_NORMALS = False, # not yet
+ EXPORT_NORMALS_HQ = False, # not yet
+ EXPORT_UV = True, # ok
+ EXPORT_MTL = True,
+ EXPORT_SEL_ONLY = True, # ok
+ EXPORT_ALL_SCENES = False, # XXX not working atm
+ EXPORT_ANIMATION = False,
+ EXPORT_COPY_IMAGES = False,
+ EXPORT_BLEN_OBS = True,
+ EXPORT_GROUP_BY_OB = False,
+ EXPORT_GROUP_BY_MAT = False,
+ EXPORT_KEEP_VERT_ORDER = False,
+ EXPORT_POLYGROUPS = False,
+ EXPORT_CURVE_AS_NURBS = True):
+
+ base_name, ext = splitExt(filepath)
+ context_name = [base_name, '', '', ext] # Base name, scene name, frame number, extension
+
+ orig_scene = context.scene
+
+ # Exit edit mode before exporting, so current object states are exported properly.
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+# if EXPORT_ALL_SCENES:
+# export_scenes = bpy.data.scenes
+# else:
+# export_scenes = [orig_scene]
+
+ # XXX only exporting one scene atm since changing
+ # current scene is not possible.
+ # Brecht says that ideally in 2.5 we won't need such a function,
+ # allowing multiple scenes open at once.
+ export_scenes = [orig_scene]
+
+ # Export all scenes.
+ for scn in export_scenes:
+ # scn.makeCurrent() # If already current, this is not slow.
+ # context = scn.getRenderingContext()
+ orig_frame = scn.frame_current
+
+ if EXPORT_ALL_SCENES: # Add scene name into the context_name
+ context_name[1] = '_%s' % bpy.utils.clean_name(scn.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
+
+ # Export an animation?
+ if EXPORT_ANIMATION:
+ scene_frames = range(scn.frame_start, context.frame_end + 1) # Up to and including the end frame.
+ else:
+ scene_frames = [orig_frame] # Dont export an animation.
+
+ # Loop through all frames in the scene and export.
+ for frame in scene_frames:
+ if EXPORT_ANIMATION: # Add frame to the filepath.
+ context_name[2] = '_%.6d' % frame
+
+ scn.frame_current = frame
+ if EXPORT_SEL_ONLY:
+ export_objects = context.selected_objects
+ else:
+ export_objects = scn.objects
+
+ full_path= ''.join(context_name)
+
+ # erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
+ # EXPORT THE FILE.
+ write(full_path, export_objects, scn,
+ EXPORT_TRI, EXPORT_EDGES, EXPORT_NORMALS,
+ EXPORT_NORMALS_HQ, EXPORT_UV, EXPORT_MTL,
+ EXPORT_COPY_IMAGES, EXPORT_APPLY_MODIFIERS,
+ EXPORT_ROTX90, EXPORT_BLEN_OBS,
+ EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER,
+ EXPORT_POLYGROUPS, EXPORT_CURVE_AS_NURBS)
+
+
+ scn.frame_current = orig_frame
+
+ # Restore old active scene.
+# orig_scene.makeCurrent()
+# Window.WaitCursor(0)
+
+
+'''
+Currently the exporter lacks these features:
+* nurbs
+* multiple scene export (only active scene is written)
+* particles
+'''
+
+from bpy.props import *
+
+class ExportOBJ(bpy.types.Operator):
+ '''Save a Wavefront OBJ File'''
+
+ bl_idname = "export.obj"
+ bl_label = 'Export OBJ'
+
+ # List of operator properties, the attributes will be assigned
+ # to the class instance from the operator settings before calling.
+
+ filepath = StringProperty(name="File Path", description="Filepath used for exporting the OBJ file", maxlen= 1024, default= "")
+ check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
+
+ # context group
+ use_selection = BoolProperty(name="Selection Only", description="", default= True)
+ use_all_scenes = BoolProperty(name="All Scenes", description="", default= False)
+ use_animation = BoolProperty(name="All Animation", description="", default= False)
+
+ # object group
+ use_modifiers = BoolProperty(name="Apply Modifiers", description="", default= True)
+ use_rotate90 = BoolProperty(name="Rotate X90", description="", default= True)
+
+ # extra data group
+ use_edges = BoolProperty(name="Edges", description="", default= True)
+ use_normals = BoolProperty(name="Normals", description="", default= False)
+ use_hq_normals = BoolProperty(name="High Quality Normals", description="", default= True)
+ use_uvs = BoolProperty(name="UVs", description="", default= True)
+ use_materials = BoolProperty(name="Materials", description="", default=False)
+ copy_images = BoolProperty(name="Copy Images", description="", default= False)
+ use_triangles = BoolProperty(name="Triangulate", description="", default= False)
+ use_vertex_groups = BoolProperty(name="Polygroups", description="", default= False)
+ use_nurbs = BoolProperty(name="Nurbs", description="", default= False)
+
+ # grouping group
+ use_blen_objects = BoolProperty(name="Objects as OBJ Objects", description="", default= True)
+ group_by_object = BoolProperty(name="Objects as OBJ Groups ", description="", default= False)
+ group_by_material = BoolProperty(name="Material Groups", description="", default= False)
+ keep_vertex_order = BoolProperty(name="Keep Vertex Order", description="", default= False)
+
+
+ def execute(self, context):
+
+ filepath = self.properties.filepath
+ if not filepath.lower().endswith(".obj"):
+ filepath += ".obj"
+
+ do_export(filepath, context,
+ EXPORT_TRI=self.properties.use_triangles,
+ EXPORT_EDGES=self.properties.use_edges,
+ EXPORT_NORMALS=self.properties.use_normals,
+ EXPORT_NORMALS_HQ=self.properties.use_hq_normals,
+ EXPORT_UV=self.properties.use_uvs,
+ EXPORT_MTL=self.properties.use_materials,
+ EXPORT_COPY_IMAGES=self.properties.copy_images,
+ EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
+ EXPORT_ROTX90=self.properties.use_rotate90,
+ EXPORT_BLEN_OBS=self.properties.use_blen_objects,
+ EXPORT_GROUP_BY_OB=self.properties.group_by_object,
+ EXPORT_GROUP_BY_MAT=self.properties.group_by_material,
+ EXPORT_KEEP_VERT_ORDER=self.properties.keep_vertex_order,
+ EXPORT_POLYGROUPS=self.properties.use_vertex_groups,
+ EXPORT_CURVE_AS_NURBS=self.properties.use_nurbs,
+ EXPORT_SEL_ONLY=self.properties.use_selection,
+ EXPORT_ALL_SCENES=self.properties.use_all_scenes)
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.manager
+ wm.add_fileselect(self)
+ return {'RUNNING_MODAL'}
+
+
+def menu_func(self, context):
+ default_path = os.path.splitext(bpy.data.filepath)[0] + ".obj"
+ self.layout.operator(ExportOBJ.bl_idname, text="Wavefront (.obj)").filepath = default_path
+
+
+def register():
+ bpy.types.register(ExportOBJ)
+ bpy.types.INFO_MT_file_export.append(menu_func)
+
+def unregister():
+ bpy.types.unregister(ExportOBJ)
+ bpy.types.INFO_MT_file_export.remove(menu_func)
+
+
+# CONVERSION ISSUES
+# - matrix problem
+# - duplis - only tested dupliverts
+# - NURBS - needs API additions
+# - all scenes export
+# + normals calculation
+
+if __name__ == "__main__":
+ register()
+
diff --git a/Data/BlenderScript/lipsyncbatch.au3 b/Data/BlenderScript/lipsyncbatch.au3
new file mode 100644
index 00000000..874f5667
--- /dev/null
+++ b/Data/BlenderScript/lipsyncbatch.au3
@@ -0,0 +1,40 @@
+HotKeySet("{PAUSE}", "TogglePause")
+
+Run("C:/Program Files (x86)/Annosoft/Lipsync Tool 4.0/LipsyncTool4.0.exe")
+WinWaitActive("Reminder")
+Send("{ENTER}")
+WinWaitActive("The Lipsync Tool!")
+$size = WinGetPos("The Lipsync Tool!")
+;MsgBox(0,"Size","Position = " & $size[0] & " " & $size[1])
+Dim $click_pos[2]
+$click_pos[0] = 746 + $size[0]
+$click_pos[1] = 435 + $size[1]
+For $i = 10 to 0 Step -1
+ ProcessSound($i)
+Next
+dim $done = False
+While $done == False
+ MouseClick("primary", $click_pos[0], $click_pos[1], 1, 0)
+ MouseWheel("down", 3)
+ For $i = 10 to 2 Step -1
+ ProcessSound($i)
+ Next
+WEnd
+
+Func TogglePause()
+ $rc = msgbox(1,"Paused","Click Ok to continue or Cancel to stop program")
+ if $rc = 2 then exit
+EndFunc
+
+Func ProcessSound($val)
+ MouseClick("primary", $click_pos[0], $click_pos[1]+$val*18, 2, 0)
+ WinWaitActive("Progress")
+ WinWaitClose("Progress")
+ MouseClick("primary", 389 + $size[0],63 + $size[1], 1, 0)
+ Send("^e")
+ WinWaitActive("Export format")
+ Send("{ENTER}")
+ WinWaitActive("Save As")
+ Send("!s")
+ WinWaitClose("Save As")
+EndFunc \ No newline at end of file
diff --git a/Libraries/FL/Enumerations.H b/Libraries/FL/Enumerations.H
deleted file mode 100644
index 093422bf..00000000
--- a/Libraries/FL/Enumerations.H
+++ /dev/null
@@ -1,959 +0,0 @@
-//
-// "$Id: Enumerations.H 8710 2011-05-21 21:55:59Z manolo $"
-//
-// Enumerations for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/** \file
- This file contains type definitions and general enumerations.
- */
-
-#ifndef Fl_Enumerations_H
-#define Fl_Enumerations_H
-
-# include "Fl_Export.H"
-# include "fl_types.h"
-
-/** \name Version Numbers
-
- FLTK defines some constants to help the programmer to
- find out, for which FLTK version a program is compiled.
-
- The following constants are defined:
- */
-/*@{*/
-
-/**
- The major release version of this FLTK library.
- \sa FL_VERSION
- */
-#define FL_MAJOR_VERSION 1
-
-/**
- The minor release version for this library.
-
- FLTK remains mostly source-code compatible between minor version changes.
- */
-#define FL_MINOR_VERSION 3
-
-/**
- The patch version for this library.
-
- FLTK remains binary compatible between patches.
- */
-#define FL_PATCH_VERSION 0
-
-/**
- The FLTK version number as a \em double.
-
- FL_VERSION is a double that describes the major and minor version numbers.
- Version 1.1 is actually stored as 1.01 to allow for more than 9 minor
- releases.
-
- The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants
- give the integral values for the major, minor, and patch releases
- respectively.
- */
-#define FL_VERSION ((double)FL_MAJOR_VERSION + \
- (double)FL_MINOR_VERSION * 0.01 + \
- (double)FL_PATCH_VERSION * 0.0001)
-
-/*@}*/ // group: Version Numbers
-
-/**
- Every time a user moves the mouse pointer, clicks a button,
- or presses a key, an event is generated and sent to your
- application. Events can also come from other programs like the
- window manager.
-
- Events are identified by the integer argument passed to the
- Fl_Widget::handle() virtual method. Other information about the
- most recent event is stored in static locations and acquired by
- calling the Fl::event_*() methods. This static information remains
- valid until the next event is read from the window system, so it
- is ok to look at it outside of the handle() method.
-
- \sa Fl::event_text(), Fl::event_key(), class Fl::
- */
-enum Fl_Event { // events
- /** No event. */
- FL_NO_EVENT = 0,
-
- /** A mouse button has gone down with the mouse pointing at this
- widget. You can find out what button by calling Fl::event_button().
- You find out the mouse position by calling Fl::event_x() and
- Fl::event_y().
-
- A widget indicates that it "wants" the mouse click by returning non-zero
- from its Fl_Widget::handle() method. It will then become the
- Fl::pushed() widget and will get FL_DRAG and the matching FL_RELEASE events.
- If Fl_Widget::handle() returns zero then FLTK will try sending the FL_PUSH
- to another widget.
- */
- FL_PUSH = 1,
-
- /** A mouse button has been released. You can find out what button by
- calling Fl::event_button().
-
- In order to receive the FL_RELEASE event, the widget must return
- non-zero when handling FL_PUSH.
- */
- FL_RELEASE = 2,
-
- /** The mouse has been moved to point at this widget. This can
- be used for highlighting feedback. If a widget wants to
- highlight or otherwise track the mouse, it indicates this by
- returning non-zero from its handle() method. It then
- becomes the Fl::belowmouse() widget and will receive
- FL_MOVE and FL_LEAVE events.
- */
- FL_ENTER = 3,
-
- /** The mouse has moved out of the widget.
- In order to receive the FL_LEAVE event, the widget must
- return non-zero when handling FL_ENTER.
- */
- FL_LEAVE = 4,
-
- /** The mouse has moved with a button held down. The current button state
- is in Fl::event_state(). The mouse position is in Fl::event_x() and
- Fl::event_y().
-
- In order to receive FL_DRAG events, the widget must return non-zero
- when handling FL_PUSH.
- */
- FL_DRAG = 5,
-
- /** This indicates an <I>attempt</I> to give a widget the keyboard focus.
-
- If a widget wants the focus, it should change itself to display the
- fact that it has the focus, and return non-zero from its handle() method.
- It then becomes the Fl::focus() widget and gets FL_KEYDOWN, FL_KEYUP,
- and FL_UNFOCUS events.
-
- The focus will change either because the window manager changed which
- window gets the focus, or because the user tried to navigate using tab,
- arrows, or other keys. You can check Fl::event_key() to figure out why
- it moved. For navigation it will be the key pressed and for interaction
- with the window manager it will be zero.
- */
- FL_FOCUS = 6,
-
- /** This event is sent to the previous Fl::focus() widget when another
- widget gets the focus or the window loses focus.
- */
- FL_UNFOCUS = 7,
-
- /** A key was pressed (FL_KEYDOWN) or released (FL_KEYUP).
- Fl_KEYBOARD is a synonym for FL_KEYDOWN.
- The key can be found in Fl::event_key().
- The text that the key should insert can be found with Fl::event_text()
- and its length is in Fl::event_length(). If you use the key handle()
- should return 1. If you return zero then FLTK assumes you ignored the
- key and will then attempt to send it to a parent widget. If none of
- them want it, it will change the event into a FL_SHORTCUT event.
-
- To receive FL_KEYBOARD events you must also respond to the FL_FOCUS
- and FL_UNFOCUS events.
-
- If you are writing a text-editing widget you may also want to call
- the Fl::compose() function to translate individual keystrokes into
- non-ASCII characters.
-
- FL_KEYUP events are sent to the widget that currently has focus. This
- is not necessarily the same widget that received the corresponding
- FL_KEYDOWN event because focus may have changed between events.
- */
- FL_KEYDOWN = 8,
-
- /** Equivalent to FL_KEYDOWN.
- \see FL_KEYDOWN
- */
- FL_KEYBOARD = 8,
-
- /** Key release event.
- \see FL_KEYDOWN
- */
- FL_KEYUP = 9,
-
- /** The user clicked the close button of a window.
- This event is used internally only to trigger the callback of
- Fl_Window derived classed. The default callback closes the
- window calling Fl_Window::hide().
- */
- FL_CLOSE = 10,
-
- /** The mouse has moved without any mouse buttons held down.
- This event is sent to the Fl::belowmouse() widget.
-
- In order to receive FL_MOVE events, the widget must return
- non-zero when handling FL_ENTER.
- */
- FL_MOVE = 11,
-
- /** If the Fl::focus() widget is zero or ignores an FL_KEYBOARD
- event then FLTK tries sending this event to every widget it
- can, until one of them returns non-zero. FL_SHORTCUT is first
- sent to the Fl::belowmouse() widget, then its parents and siblings,
- and eventually to every widget in the window, trying to find an
- object that returns non-zero. FLTK tries really hard to not to ignore
- any keystrokes!
-
- You can also make "global" shortcuts by using Fl::add_handler(). A
- global shortcut will work no matter what windows are displayed or
- which one has the focus.
- */
- FL_SHORTCUT = 12,
-
- /** This widget is no longer active, due to Fl_Widget::deactivate()
- being called on it or one of its parents. Fl_Widget::active() may
- still be true after this, the widget is only active if Fl_Widget::active()
- is true on it and all its parents (use Fl_Widget::active_r() to check this).
- */
- FL_DEACTIVATE = 13,
-
- /** This widget is now active, due to Fl_Widget::activate() being
- called on it or one of its parents.
- */
- FL_ACTIVATE = 14,
-
- /** This widget is no longer visible, due to Fl_Widget::hide() being
- called on it or one of its parents, or due to a parent window being
- minimized. Fl_Widget::visible() may still be true after this, but the
- widget is visible only if visible() is true for it and all its
- parents (use Fl_Widget::visible_r() to check this).
- */
- FL_HIDE = 15,
-
- /** This widget is visible again, due to Fl_Widget::show() being called on
- it or one of its parents, or due to a parent window being restored.
- Child Fl_Windows respond to this by actually creating the window if not
- done already, so if you subclass a window, be sure to pass FL_SHOW
- to the base class Fl_Widget::handle() method!
- */
- FL_SHOW = 16,
-
- /** You should get this event some time after you call Fl::paste().
- The contents of Fl::event_text() is the text to insert and the number
- of characters is in Fl::event_length().
- */
- FL_PASTE = 17,
-
- /** The Fl::selection_owner() will get this event before the selection is
- moved to another widget. This indicates that some other widget or program
- has claimed the selection. Motif programs used this to clear the selection
- indication. Most modern programs ignore this.
- */
- FL_SELECTIONCLEAR = 18,
-
- /** The user has moved the mouse wheel. The Fl::event_dx() and Fl::event_dy()
- methods can be used to find the amount to scroll horizontally and vertically.
- */
- FL_MOUSEWHEEL = 19,
-
- /** The mouse has been moved to point at this widget. A widget that is
- interested in receiving drag'n'drop data must return 1 to receive
- FL_DND_DRAG, FL_DND_LEAVE and FL_DND_RELEASE events.
- */
- FL_DND_ENTER = 20,
-
- /** The mouse has been moved inside a widget while dragging data. A
- widget that is interested in receiving drag'n'drop data should
- indicate the possible drop position.
- */
- FL_DND_DRAG = 21,
-
- /** The mouse has moved out of the widget.
- */
- FL_DND_LEAVE = 22,
-
- /** The user has released the mouse button dropping data into the widget.
- If the widget returns 1, it will receive the data in the immediately
- following FL_PASTE event.
- */
- FL_DND_RELEASE = 23
-};
-
-/** \name When Conditions */
-/*@{*/
-/** These constants determine when a callback is performed.
-
- \sa Fl_Widget::when();
- \todo doxygen comments for values are incomplete and maybe wrong or unclear
- */
-enum Fl_When { // Fl_Widget::when():
- FL_WHEN_NEVER = 0, ///< Never call the callback
- FL_WHEN_CHANGED = 1, ///< Do the callback only when the widget value changes
- FL_WHEN_NOT_CHANGED = 2, ///< Do the callback whenever the user interacts with the widget
- FL_WHEN_RELEASE = 4, ///< Do the callback when the button or key is released and the value changes
- FL_WHEN_RELEASE_ALWAYS= 6, ///< Do the callback when the button or key is released, even if the value doesn't change
- FL_WHEN_ENTER_KEY = 8, ///< Do the callback when the user presses the ENTER key and the value changes
- FL_WHEN_ENTER_KEY_ALWAYS=10, ///< Do the callback when the user presses the ENTER key, even if the value doesn't change
- FL_WHEN_ENTER_KEY_CHANGED=11 ///< ?
-};
-
-/*@}*/ // group: When Conditions
-
-/** \name Mouse and Keyboard Events
-
- This and the following constants define the non-ASCII keys on the
- keyboard for FL_KEYBOARD and FL_SHORTCUT events.
-
- \todo FL_Button and FL_key... constants could be structured better
- (use an enum or some doxygen grouping ?)
-
- \sa Fl::event_key() and Fl::get_key(int) (use ascii letters for all other keys):
- */
-
-/*@{*/
-
-// FIXME: These codes collide with valid Unicode keys
-
-#define FL_Button 0xfee8 ///< A mouse button; use Fl_Button + n for mouse button n.
-#define FL_BackSpace 0xff08 ///< The backspace key.
-#define FL_Tab 0xff09 ///< The tab key.
-#define FL_Enter 0xff0d ///< The enter key.
-#define FL_Pause 0xff13 ///< The pause key.
-#define FL_Scroll_Lock 0xff14 ///< The scroll lock key.
-#define FL_Escape 0xff1b ///< The escape key.
-#define FL_Home 0xff50 ///< The home key.
-#define FL_Left 0xff51 ///< The left arrow key.
-#define FL_Up 0xff52 ///< The up arrow key.
-#define FL_Right 0xff53 ///< The right arrow key.
-#define FL_Down 0xff54 ///< The down arrow key.
-#define FL_Page_Up 0xff55 ///< The page-up key.
-#define FL_Page_Down 0xff56 ///< The page-down key.
-#define FL_End 0xff57 ///< The end key.
-#define FL_Print 0xff61 ///< The print (or print-screen) key.
-#define FL_Insert 0xff63 ///< The insert key.
-#define FL_Menu 0xff67 ///< The menu key.
-#define FL_Help 0xff68 ///< The 'help' key on Mac keyboards
-#define FL_Num_Lock 0xff7f ///< The num lock key.
-#define FL_KP 0xff80 ///< One of the keypad numbers; use FL_KP + n for number n.
-#define FL_KP_Enter 0xff8d ///< The enter key on the keypad, same as Fl_KP+'\\r'.
-#define FL_KP_Last 0xffbd ///< The last keypad key; use to range-check keypad.
-#define FL_F 0xffbd ///< One of the function keys; use FL_F + n for function key n.
-#define FL_F_Last 0xffe0 ///< The last function key; use to range-check function keys.
-#define FL_Shift_L 0xffe1 ///< The lefthand shift key.
-#define FL_Shift_R 0xffe2 ///< The righthand shift key.
-#define FL_Control_L 0xffe3 ///< The lefthand control key.
-#define FL_Control_R 0xffe4 ///< The righthand control key.
-#define FL_Caps_Lock 0xffe5 ///< The caps lock key.
-#define FL_Meta_L 0xffe7 ///< The left meta/Windows key.
-#define FL_Meta_R 0xffe8 ///< The right meta/Windows key.
-#define FL_Alt_L 0xffe9 ///< The left alt key.
-#define FL_Alt_R 0xffea ///< The right alt key.
-#define FL_Delete 0xffff ///< The delete key.
-
-// These use the Private Use Area (PUA) of the Basic Multilingual Plane
-// of Unicode. Guaranteed not to conflict with a proper Unicode character.
-
-// These primarily map to the XFree86 keysym range
-#define FL_Volume_Down 0xEF11 /* Volume control down */
-#define FL_Volume_Mute 0xEF12 /* Mute sound from the system */
-#define FL_Volume_Up 0xEF13 /* Volume control up */
-#define FL_Media_Play 0xEF14 /* Start playing of audio */
-#define FL_Media_Stop 0xEF15 /* Stop playing audio */
-#define FL_Media_Prev 0xEF16 /* Previous track */
-#define FL_Media_Next 0xEF17 /* Next track */
-#define FL_Home_Page 0xEF18 /* Display user's home page */
-#define FL_Mail 0xEF19 /* Invoke user's mail program */
-#define FL_Search 0xEF1B /* Search */
-#define FL_Back 0xEF26 /* Like back on a browser */
-#define FL_Forward 0xEF27 /* Like forward on a browser */
-#define FL_Stop 0xEF28 /* Stop current operation */
-#define FL_Refresh 0xEF29 /* Refresh the page */
-#define FL_Sleep 0xEF2F /* Put system to sleep */
-#define FL_Favorites 0xEF30 /* Show favorite locations */
-
-/*@}*/ // group: Mouse and Keyboard Events
-
-/** \name Mouse Buttons
-
- These constants define the button numbers for FL_PUSH and FL_RELEASE events.
-
- \sa Fl::event_button()
-*/
-
-/*@{*/
-
-#define FL_LEFT_MOUSE 1 ///< The left mouse button
-#define FL_MIDDLE_MOUSE 2 ///< The middle mouse button
-#define FL_RIGHT_MOUSE 3 ///< The right mouse button
-
-/*@}*/ // group: Mouse Buttons
-
-
-/** \name Event States
-
- The following constants define bits in the Fl::event_state() value.
-*/
-
-/*@{*/ // group: Event States
-
-// FIXME: it would be nice to have the modifiers in the upper 8 bit so that
-// a unicode ke (24bit) can be sent as an unsigned with the modifiers.
-
-#define FL_SHIFT 0x00010000 ///< One of the shift keys is down
-#define FL_CAPS_LOCK 0x00020000 ///< The caps lock is on
-#define FL_CTRL 0x00040000 ///< One of the ctrl keys is down
-#define FL_ALT 0x00080000 ///< One of the alt keys is down
-#define FL_NUM_LOCK 0x00100000 ///< The num lock is on
- // most X servers do this?
-#define FL_META 0x00400000 ///< One of the meta/Windows keys is down
- // correct for XFree86
-#define FL_SCROLL_LOCK 0x00800000 ///< The scroll lock is on
- // correct for XFree86
-#define FL_BUTTON1 0x01000000 ///< Mouse button 1 is pushed
-#define FL_BUTTON2 0x02000000 ///< Mouse button 2 is pushed
-#define FL_BUTTON3 0x04000000 ///< Mouse button 3 is pushed
-#define FL_BUTTONS 0x7f000000 ///< Any mouse button is pushed
-#define FL_BUTTON(n) (0x00800000<<(n)) ///< Mouse button n (n > 0) is pushed
-
-#define FL_KEY_MASK 0x0000ffff ///< All keys are 16 bit for now
- // FIXME: Unicode needs 24 bits!
-
-#ifdef __APPLE__
-# define FL_COMMAND FL_META ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
-# define FL_CONTROL FL_CTRL ///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X
-#else
-# define FL_COMMAND FL_CTRL ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
-# define FL_CONTROL FL_META ///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X
-#endif // __APPLE__
-
-/*@}*/ // group: Event States
-
-/** \name Box Types
- \brief FLTK standard box types
-
- This enum defines the standard box types included with FLTK.
-
- FL_NO_BOX means nothing is drawn at all, so whatever is already
- on the screen remains. The FL_..._FRAME types only draw their edges,
- leaving the interior unchanged. The blue color in Figure 1
- is the area that is not drawn by the frame types.
-
- \image html boxtypes.png "Figure 1: FLTK standard box types"
- \image latex boxtypes.png "FLTK standard box types" width=10cm
- \todo Description of boxtypes is incomplete.
- See below for the defined enum Fl_Boxtype.
- \see src/Fl_get_system_colors.cxx
-*/
-/*@{*/
-enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C):
-
- FL_NO_BOX = 0, ///< nothing is drawn at all, this box is invisible
- FL_FLAT_BOX, ///< a flat box
- FL_UP_BOX, ///< see figure 1
- FL_DOWN_BOX, ///< see figure 1
- FL_UP_FRAME, ///< see figure 1
- FL_DOWN_FRAME, ///< see figure 1
- FL_THIN_UP_BOX, ///< see figure 1
- FL_THIN_DOWN_BOX, ///< see figure 1
- FL_THIN_UP_FRAME, ///< see figure 1
- FL_THIN_DOWN_FRAME, ///< see figure 1
- FL_ENGRAVED_BOX, ///< see figure 1
- FL_EMBOSSED_BOX, ///< see figure 1
- FL_ENGRAVED_FRAME, ///< see figure 1
- FL_EMBOSSED_FRAME, ///< see figure 1
- FL_BORDER_BOX, ///< see figure 1
- _FL_SHADOW_BOX, ///< see figure 1
- FL_BORDER_FRAME, ///< see figure 1
- _FL_SHADOW_FRAME, ///< see figure 1
- _FL_ROUNDED_BOX, ///< see figure 1
- _FL_RSHADOW_BOX, ///< see figure 1
- _FL_ROUNDED_FRAME, ///< see figure 1
- _FL_RFLAT_BOX, ///< see figure 1
- _FL_ROUND_UP_BOX, ///< see figure 1
- _FL_ROUND_DOWN_BOX, ///< see figure 1
- _FL_DIAMOND_UP_BOX, ///< see figure 1
- _FL_DIAMOND_DOWN_BOX, ///< see figure 1
- _FL_OVAL_BOX, ///< see figure 1
- _FL_OSHADOW_BOX, ///< see figure 1
- _FL_OVAL_FRAME, ///< see figure 1
- _FL_OFLAT_BOX, ///< see figure 1
- _FL_PLASTIC_UP_BOX, ///< plastic version of FL_UP_BOX
- _FL_PLASTIC_DOWN_BOX, ///< plastic version of FL_DOWN_BOX
- _FL_PLASTIC_UP_FRAME, ///< plastic version of FL_UP_FRAME
- _FL_PLASTIC_DOWN_FRAME, ///< plastic version of FL_DOWN_FRAME
- _FL_PLASTIC_THIN_UP_BOX, ///< plastic version of FL_THIN_UP_BOX
- _FL_PLASTIC_THIN_DOWN_BOX, ///< plastic version of FL_THIN_DOWN_BOX
- _FL_PLASTIC_ROUND_UP_BOX, ///< plastic version of FL_ROUND_UP_BOX
- _FL_PLASTIC_ROUND_DOWN_BOX, ///< plastic version of FL_ROUND_DOWN_BOX
- _FL_GTK_UP_BOX, ///< gtk+ version of FL_UP_BOX
- _FL_GTK_DOWN_BOX, ///< gtk+ version of FL_DOWN_BOX
- _FL_GTK_UP_FRAME, ///< gtk+ version of FL_UP_FRAME
- _FL_GTK_DOWN_FRAME, ///< gtk+ version of FL_DOWN_RAME
- _FL_GTK_THIN_UP_BOX, ///< gtk+ version of FL_THIN_UP_BOX
- _FL_GTK_THIN_DOWN_BOX, ///< gtk+ version of FL_THIN_DOWN_BOX
- _FL_GTK_THIN_UP_FRAME, ///< gtk+ version of FL_UP_FRAME
- _FL_GTK_THIN_DOWN_FRAME, ///< gtk+ version of FL_THIN_DOWN_FRAME
- _FL_GTK_ROUND_UP_BOX, ///< gtk+ version of FL_ROUND_UP_BOX
- _FL_GTK_ROUND_DOWN_BOX, ///< gtk+ version of FL_ROUND_DOWN_BOX
- FL_FREE_BOXTYPE ///< the first free box type for creation of new box types
-};
-extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX();
-#define FL_ROUND_UP_BOX fl_define_FL_ROUND_UP_BOX()
-#define FL_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_ROUND_UP_BOX()+1)
-extern FL_EXPORT Fl_Boxtype fl_define_FL_SHADOW_BOX();
-#define FL_SHADOW_BOX fl_define_FL_SHADOW_BOX()
-#define FL_SHADOW_FRAME (Fl_Boxtype)(fl_define_FL_SHADOW_BOX()+2)
-extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUNDED_BOX();
-#define FL_ROUNDED_BOX fl_define_FL_ROUNDED_BOX()
-#define FL_ROUNDED_FRAME (Fl_Boxtype)(fl_define_FL_ROUNDED_BOX()+2)
-extern FL_EXPORT Fl_Boxtype fl_define_FL_RFLAT_BOX();
-#define FL_RFLAT_BOX fl_define_FL_RFLAT_BOX()
-extern FL_EXPORT Fl_Boxtype fl_define_FL_RSHADOW_BOX();
-#define FL_RSHADOW_BOX fl_define_FL_RSHADOW_BOX()
-extern FL_EXPORT Fl_Boxtype fl_define_FL_DIAMOND_BOX();
-#define FL_DIAMOND_UP_BOX fl_define_FL_DIAMOND_BOX()
-#define FL_DIAMOND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_DIAMOND_BOX()+1)
-extern FL_EXPORT Fl_Boxtype fl_define_FL_OVAL_BOX();
-#define FL_OVAL_BOX fl_define_FL_OVAL_BOX()
-#define FL_OSHADOW_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+1)
-#define FL_OVAL_FRAME (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+2)
-#define FL_OFLAT_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+3)
-
-extern FL_EXPORT Fl_Boxtype fl_define_FL_PLASTIC_UP_BOX();
-#define FL_PLASTIC_UP_BOX fl_define_FL_PLASTIC_UP_BOX()
-#define FL_PLASTIC_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+1)
-#define FL_PLASTIC_UP_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+2)
-#define FL_PLASTIC_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+3)
-#define FL_PLASTIC_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+4)
-#define FL_PLASTIC_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+5)
-#define FL_PLASTIC_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+6)
-#define FL_PLASTIC_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+7)
-
-extern FL_EXPORT Fl_Boxtype fl_define_FL_GTK_UP_BOX();
-#define FL_GTK_UP_BOX fl_define_FL_GTK_UP_BOX()
-#define FL_GTK_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+1)
-#define FL_GTK_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+2)
-#define FL_GTK_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+3)
-#define FL_GTK_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+4)
-#define FL_GTK_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+5)
-#define FL_GTK_THIN_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+6)
-#define FL_GTK_THIN_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+7)
-#define FL_GTK_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+8)
-#define FL_GTK_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+9)
-
-// conversions of box types to other boxtypes:
-/**
- Get the filled version of a frame.
- If no filled version of a given frame exists, the behavior of this function
- is undefined and some random box or frame is returned.
- */
-inline Fl_Boxtype fl_box(Fl_Boxtype b) {
- return (Fl_Boxtype)((b<FL_UP_BOX||b%4>1)?b:(b-2));
-}
-/**
- Get the "pressed" or "down" version of a box.
- If no "down" version of a given box exists, the behavior of this function
- is undefined and some random box or frame is returned.
- */
-inline Fl_Boxtype fl_down(Fl_Boxtype b) {
- return (Fl_Boxtype)((b<FL_UP_BOX)?b:(b|1));
-}
-/**
- Get the unfilled, frame only version of a box.
- If no frame version of a given box exists, the behavior of this function
- is undefined and some random box or frame is returned.
- */
-inline Fl_Boxtype fl_frame(Fl_Boxtype b) {
- return (Fl_Boxtype)((b%4<2)?b:(b+2));
-}
-
-// back-compatibility box types:
-#define FL_FRAME FL_ENGRAVED_FRAME
-#define FL_FRAME_BOX FL_ENGRAVED_BOX
-#define FL_CIRCLE_BOX FL_ROUND_DOWN_BOX
-#define FL_DIAMOND_BOX FL_DIAMOND_DOWN_BOX
-
-/*@}*/ // group: Box Types
-
-/**
- The labeltype() method sets the type of the label.
-
- The following standard label types are included:
-
- \todo The doxygen comments are incomplete, and some labeltypes
- are starting with an underscore. Also, there are three
- external functions undocumented (yet):
- - fl_define_FL_SHADOW_LABEL()
- - fl_define_FL_ENGRAVED_LABEL()
- - fl_define_FL_EMBOSSED_LABEL()
-*/
-enum Fl_Labeltype { // labeltypes:
- FL_NORMAL_LABEL = 0, ///< draws the text (0)
- FL_NO_LABEL, ///< does nothing
- _FL_SHADOW_LABEL, ///< draws a drop shadow under the text
- _FL_ENGRAVED_LABEL, ///< draws edges as though the text is engraved
- _FL_EMBOSSED_LABEL, ///< draws edges as though the text is raised
- _FL_MULTI_LABEL, ///< ?
- _FL_ICON_LABEL, ///< draws the icon associated with the text
- _FL_IMAGE_LABEL, ///< ?
-
- FL_FREE_LABELTYPE ///< first free labeltype to use for creating own labeltypes
-};
-
-/**
- Sets the current label type and return its corresponding Fl_Labeltype value.
- @{
-*/
-#define FL_SYMBOL_LABEL FL_NORMAL_LABEL
-extern Fl_Labeltype FL_EXPORT fl_define_FL_SHADOW_LABEL();
-#define FL_SHADOW_LABEL fl_define_FL_SHADOW_LABEL()
-extern Fl_Labeltype FL_EXPORT fl_define_FL_ENGRAVED_LABEL();
-#define FL_ENGRAVED_LABEL fl_define_FL_ENGRAVED_LABEL()
-extern Fl_Labeltype FL_EXPORT fl_define_FL_EMBOSSED_LABEL();
-#define FL_EMBOSSED_LABEL fl_define_FL_EMBOSSED_LABEL()
-/** @} */
-
-/** \name Alignment Flags
- Flags to control the label alignment.
- This controls how the label is displayed next to or inside the widget.
- The default value is FL_ALIGN_CENTER for most widgets, which centers the label
- inside the widget.
-
- Flags can be or'd to achieve a combination of alignments.
-
- \code
- Outside alignments:
- TOP_LEFT TOP TOP_RIGHT
- LEFT_TOP+---------------------------------+RIGHT_TOP
- | |
- LEFT| |RIGHT
- | |
- LEFT_BOTTOM+---------------------------------+RIGHT_BOTTOM
- BOTTOM_RIGHT BOTTOM BOTTOM_LEFT
-
- Inside alignments:
- +---------------------------------+
- |TOP_LEFT TOP TOP_RIGHT|
- | |
- |LEFT RIGHT|
- | |
- |BOTTOM_RIGHT BOTTOM BOTTOM_LEFT|
- +---------------------------------+
- \endcode
- \see #FL_ALIGN_CENTER, etc.
- */
-/*@{*/
-/** FLTK type for alignment control */
-typedef unsigned Fl_Align;
- /** Align the label horizontally in the middle. */
-const Fl_Align FL_ALIGN_CENTER = (Fl_Align)0;
- /** Align the label at the top of the widget. Inside labels appear below the top,
- outside labels are drawn on top of the widget. */
-const Fl_Align FL_ALIGN_TOP = (Fl_Align)1;
- /** Align the label at the bottom of the widget. */
-const Fl_Align FL_ALIGN_BOTTOM = (Fl_Align)2;
- /** Align the label at the left of the widget. Inside labels appear left-justified
- starting at the left side of the widget, outside labels are right-justified and
- drawn to the left of the widget. */
-const Fl_Align FL_ALIGN_LEFT = (Fl_Align)4;
- /** Align the label to the right of the widget. */
-const Fl_Align FL_ALIGN_RIGHT = (Fl_Align)8;
- /** Draw the label inside of the widget. */
-const Fl_Align FL_ALIGN_INSIDE = (Fl_Align)16;
- /** If the label contains an image, draw the text on top of the image. */
-const Fl_Align FL_ALIGN_TEXT_OVER_IMAGE = (Fl_Align)0x0020;
- /** If the label contains an image, draw the text below the image. */
-const Fl_Align FL_ALIGN_IMAGE_OVER_TEXT = (Fl_Align)0x0000;
- /** All parts of the label that are lager than the widget will not be drawn . */
-const Fl_Align FL_ALIGN_CLIP = (Fl_Align)64;
- /** Wrap text that does not fit the width of the widget. */
-const Fl_Align FL_ALIGN_WRAP = (Fl_Align)128;
- /** If the label contains an image, draw the text to the right of the image. */
-const Fl_Align FL_ALIGN_IMAGE_NEXT_TO_TEXT = (Fl_Align)0x0100;
- /** If the label contains an image, draw the text to the left of the image. */
-const Fl_Align FL_ALIGN_TEXT_NEXT_TO_IMAGE = (Fl_Align)0x0120;
-/** If the label contains an image, draw the image or deimage in the background. */
-const Fl_Align FL_ALIGN_IMAGE_BACKDROP = (Fl_Align)0x0200;
-const Fl_Align FL_ALIGN_TOP_LEFT = FL_ALIGN_TOP | FL_ALIGN_LEFT;
-const Fl_Align FL_ALIGN_TOP_RIGHT = FL_ALIGN_TOP | FL_ALIGN_RIGHT;
-const Fl_Align FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_BOTTOM | FL_ALIGN_LEFT;
-const Fl_Align FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT;
-const Fl_Align FL_ALIGN_LEFT_TOP = 0x0007; // magic value
-const Fl_Align FL_ALIGN_RIGHT_TOP = 0x000b; // magic value
-const Fl_Align FL_ALIGN_LEFT_BOTTOM = 0x000d; // magic value
-const Fl_Align FL_ALIGN_RIGHT_BOTTOM = 0x000e; // magic value
-const Fl_Align FL_ALIGN_NOWRAP = (Fl_Align)0; // for back compatibility
-const Fl_Align FL_ALIGN_POSITION_MASK = 0x000f; // left, right, top, bottom
-const Fl_Align FL_ALIGN_IMAGE_MASK = 0x0320; // l/r, t/b, backdrop
-/*@}*/
-
-
-/** \name Font Numbers
- The following constants define the standard FLTK fonts:
- */
-/*@{*/
-/** A font number is an index into the internal font table. */
-typedef int Fl_Font;
-
-const Fl_Font FL_HELVETICA = 0; ///< Helvetica (or Arial) normal (0)
-const Fl_Font FL_HELVETICA_BOLD = 1; ///< Helvetica (or Arial) bold
-const Fl_Font FL_HELVETICA_ITALIC = 2; ///< Helvetica (or Arial) oblique
-const Fl_Font FL_HELVETICA_BOLD_ITALIC = 3; ///< Helvetica (or Arial) bold-oblique
-const Fl_Font FL_COURIER = 4; ///< Courier normal
-const Fl_Font FL_COURIER_BOLD = 5; ///< Courier bold
-const Fl_Font FL_COURIER_ITALIC = 6; ///< Courier italic
-const Fl_Font FL_COURIER_BOLD_ITALIC = 7; ///< Courier bold-italic
-const Fl_Font FL_TIMES = 8; ///< Times roman
-const Fl_Font FL_TIMES_BOLD = 9; ///< Times roman bold
-const Fl_Font FL_TIMES_ITALIC = 10; ///< Times roman italic
-const Fl_Font FL_TIMES_BOLD_ITALIC = 11; ///< Times roman bold-italic
-const Fl_Font FL_SYMBOL = 12; ///< Standard symbol font
-const Fl_Font FL_SCREEN = 13; ///< Default monospaced screen font
-const Fl_Font FL_SCREEN_BOLD = 14; ///< Default monospaced bold screen font
-const Fl_Font FL_ZAPF_DINGBATS = 15; ///< Zapf-dingbats font
-
-const Fl_Font FL_FREE_FONT = 16; ///< first one to allocate
-const Fl_Font FL_BOLD = 1; ///< add this to helvetica, courier, or times
-const Fl_Font FL_ITALIC = 2; ///< add this to helvetica, courier, or times
-const Fl_Font FL_BOLD_ITALIC = 3; ///< add this to helvetica, courier, or times
-
-/*@}*/
-
-/** Size of a font in pixels.
- This is the approximate height of a font in pixels.
- */
-typedef int Fl_Fontsize;
-
-extern FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE; ///< normal font size
-
-/** \name Colors
- The Fl_Color type holds an FLTK color value.
-
- Colors are either 8-bit indexes into a virtual colormap
- or 24-bit RGB color values.
-
- Color indices occupy the lower 8 bits of the value, while
- RGB colors occupy the upper 24 bits, for a byte organization of RGBI.
-
-<pre>
- Fl_Color => 0xrrggbbii
- | | | |
- | | | +--- index between 0 and 255
- | | +----- blue color component (8 bit)
- | +------- green component (8 bit)
- +--------- red component (8 bit)
- </pre>
-
- A color can have either an index or an rgb value. Colors with rgb set
- and an index >0 are reserved for special use.
-
- */
-/*@{*/
-/** an FLTK color value */
-typedef unsigned int Fl_Color;
-
-// Standard colors. These are used as default colors in widgets and altered as necessary
-const Fl_Color FL_FOREGROUND_COLOR = 0; ///< the default foreground color (0) used for labels and text
-const Fl_Color FL_BACKGROUND2_COLOR = 7; ///< the default background color for text, list, and valuator widgets
-const Fl_Color FL_INACTIVE_COLOR = 8; ///< the inactive foreground color
-const Fl_Color FL_SELECTION_COLOR = 15; ///< the default selection/highlight color
-
- // boxtypes generally limit themselves to these colors so
- // the whole ramp is not allocated:
-
-const Fl_Color FL_GRAY0 = 32; // 'A'
-const Fl_Color FL_DARK3 = 39; // 'H'
-const Fl_Color FL_DARK2 = 45; // 'N'
-const Fl_Color FL_DARK1 = 47; // 'P'
-const Fl_Color FL_BACKGROUND_COLOR = 49; // 'R' default background color
-const Fl_Color FL_LIGHT1 = 50; // 'S'
-const Fl_Color FL_LIGHT2 = 52; // 'U'
-const Fl_Color FL_LIGHT3 = 54; // 'W'
-
- // FLTK provides a 5x8x5 color cube that is used with colormap visuals
-
-const Fl_Color FL_BLACK = 56;
-const Fl_Color FL_RED = 88;
-const Fl_Color FL_GREEN = 63;
-const Fl_Color FL_YELLOW = 95;
-const Fl_Color FL_BLUE = 216;
-const Fl_Color FL_MAGENTA = 248;
-const Fl_Color FL_CYAN = 223;
-const Fl_Color FL_DARK_RED = 72;
-
-const Fl_Color FL_DARK_GREEN = 60;
-const Fl_Color FL_DARK_YELLOW = 76;
-const Fl_Color FL_DARK_BLUE = 136;
-const Fl_Color FL_DARK_MAGENTA = 152;
-const Fl_Color FL_DARK_CYAN = 140;
-
-const Fl_Color FL_WHITE = 255;
-
-
-#define FL_FREE_COLOR (Fl_Color)16
-#define FL_NUM_FREE_COLOR 16
-#define FL_GRAY_RAMP (Fl_Color)32
-#define FL_NUM_GRAY 24
-#define FL_GRAY FL_BACKGROUND_COLOR
-#define FL_COLOR_CUBE (Fl_Color)56
-#define FL_NUM_RED 5
-#define FL_NUM_GREEN 8
-#define FL_NUM_BLUE 5
-
-FL_EXPORT Fl_Color fl_inactive(Fl_Color c);
-
-FL_EXPORT Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg);
-
-FL_EXPORT Fl_Color fl_color_average(Fl_Color c1, Fl_Color c2, float weight);
-
-/** Returns a lighter version of the specified color. */
-inline Fl_Color fl_lighter(Fl_Color c) { return fl_color_average(c, FL_WHITE, .67f); }
-
-/** Returns a darker version of the specified color. */
-inline Fl_Color fl_darker(Fl_Color c) { return fl_color_average(c, FL_BLACK, .67f); }
-
-/** Returns the 24-bit color value closest to \p r, \p g, \p b. */
-inline Fl_Color fl_rgb_color(uchar r, uchar g, uchar b) {
- if (!r && !g && !b) return FL_BLACK;
- else return (Fl_Color)(((((r << 8) | g) << 8) | b) << 8);
-}
-
-/** Returns the 24-bit color value closest to \p g (grayscale). */
-inline Fl_Color fl_rgb_color(uchar g) {
- if (!g) return FL_BLACK;
- else return (Fl_Color)(((((g << 8) | g) << 8) | g) << 8);
-}
-
-/** Returns a gray color value from black (i == 0) to white (i == FL_NUM_GRAY - 1).
- FL_NUM_GRAY is defined to be 24 in the current FLTK release.
- To get the closest FLTK gray value to an 8-bit grayscale color 'I' use:
-
- \code
- fl_gray_ramp(I * (FL_NUM_GRAY - 1) / 255)
- \endcode
-*/
-inline Fl_Color fl_gray_ramp(int i) {return (Fl_Color)(i+FL_GRAY_RAMP);}
-
-/** Returns a color out of the color cube.
-
- \p r must be in the range 0 to FL_NUM_RED (5) minus 1,
- \p g must be in the range 0 to FL_NUM_GREEN (8) minus 1,
- \p b must be in the range 0 to FL_NUM_BLUE (5) minus 1.
-
- To get the closest color to a 8-bit set of R,G,B values use:
-
- \code
- fl_color_cube(R * (FL_NUM_RED - 1) / 255,
- G * (FL_NUM_GREEN - 1) / 255,
- B * (FL_NUM_BLUE - 1) / 255);
- \endcode
- */
-inline Fl_Color fl_color_cube(int r, int g, int b) {
- return (Fl_Color)((b*FL_NUM_RED + r) * FL_NUM_GREEN + g + FL_COLOR_CUBE);}
-
-/*@}*/ // group: Colors
-
-/** \name Cursors */
-/*@{*/
-
-/** The following constants define the mouse cursors that are available in FLTK.
-
- The double-headed arrows are bitmaps provided by FLTK on X, the others
- are provided by system-defined cursors.
-
- \todo enum Fl_Cursor needs maybe an image.
-*/
-enum Fl_Cursor {
- FL_CURSOR_DEFAULT = 0, /**< the default cursor, usually an arrow. */
- FL_CURSOR_ARROW = 35, /**< an arrow pointer. */
- FL_CURSOR_CROSS = 66, /**< crosshair. */
- FL_CURSOR_WAIT = 76, /**< watch or hourglass. */
- FL_CURSOR_INSERT = 77, /**< I-beam. */
- FL_CURSOR_HAND = 31, /**< hand (uparrow on MSWindows). */
- FL_CURSOR_HELP = 47, /**< question mark. */
- FL_CURSOR_MOVE = 27, /**< 4-pointed arrow. */
- // fltk provides bitmaps for these:
- FL_CURSOR_NS = 78, /**< up/down arrow. */
- FL_CURSOR_WE = 79, /**< left/right arrow. */
- FL_CURSOR_NWSE = 80, /**< diagonal arrow. */
- FL_CURSOR_NESW = 81, /**< diagonal arrow. */
- FL_CURSOR_NONE =255, /**< invisible. */
- // for back compatibility (non MSWindows ones):
- FL_CURSOR_N = 70, /**< for back compatibility. */
- FL_CURSOR_NE = 69, /**< for back compatibility. */
- FL_CURSOR_E = 49, /**< for back compatibility. */
- FL_CURSOR_SE = 8, /**< for back compatibility. */
- FL_CURSOR_S = 9, /**< for back compatibility. */
- FL_CURSOR_SW = 7, /**< for back compatibility. */
- FL_CURSOR_W = 36, /**< for back compatibility. */
- FL_CURSOR_NW = 68 /**< for back compatibility. */
-};
-/*@}*/ // group: Cursors
-
-/** FD "when" conditions */
-enum { // values for "when" passed to Fl::add_fd()
- FL_READ = 1, /**< Call the callback when there is data to be read. */
- FL_WRITE = 4, /**< Call the callback when data can be written without blocking. */
- FL_EXCEPT = 8 /**< Call the callback if an exception occurs on the file. */
-};
-
-/** visual types and Fl_Gl_Window::mode() (values match Glut) */
-enum Fl_Mode {
- FL_RGB = 0,
- FL_INDEX = 1,
- FL_SINGLE = 0,
- FL_DOUBLE = 2,
- FL_ACCUM = 4,
- FL_ALPHA = 8,
- FL_DEPTH = 16,
- FL_STENCIL = 32,
- FL_RGB8 = 64,
- FL_MULTISAMPLE= 128,
- FL_STEREO = 256,
- FL_FAKE_SINGLE = 512 // Fake single buffered windows using double-buffer
-};
-
-// image alpha blending
-
-#define FL_IMAGE_WITH_ALPHA 0x40000000
-
-/** Damage masks */
-enum Fl_Damage {
- FL_DAMAGE_CHILD = 0x01, /**< A child needs to be redrawn. */
- FL_DAMAGE_EXPOSE = 0x02, /**< The window was exposed. */
- FL_DAMAGE_SCROLL = 0x04, /**< The Fl_Scroll widget was scrolled. */
- FL_DAMAGE_OVERLAY = 0x08, /**< The overlay planes need to be redrawn. */
- FL_DAMAGE_USER1 = 0x10, /**< First user-defined damage bit. */
- FL_DAMAGE_USER2 = 0x20, /**< Second user-defined damage bit. */
- FL_DAMAGE_ALL = 0x80 /**< Everything needs to be redrawn. */
-};
-
-// FLTK 1.0.x compatibility definitions...
-# ifdef FLTK_1_0_COMPAT
-# define contrast fl_contrast
-# define down fl_down
-# define frame fl_frame
-# define inactive fl_inactive
-# endif // FLTK_1_0_COMPAT
-
-#endif
-
-//
-// End of "$Id: Enumerations.H 8710 2011-05-21 21:55:59Z manolo $".
-//
diff --git a/Libraries/FL/Fl.H b/Libraries/FL/Fl.H
deleted file mode 100644
index 9aaa1edd..00000000
--- a/Libraries/FL/Fl.H
+++ /dev/null
@@ -1,1174 +0,0 @@
-//
-// "$Id: Fl.H 8724 2011-05-23 18:01:29Z manolo $"
-//
-// Main header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/** \file
- Fl static class.
- */
-
-#ifndef Fl_H
-# define Fl_H
-
-#ifdef FLTK_HAVE_CAIRO
-# include <FL/Fl_Cairo.H>
-#endif
-
-# include "fl_utf8.h"
-# include "Enumerations.H"
-# ifndef Fl_Object
-# define Fl_Object Fl_Widget /**< for back compatibility - use Fl_Widget! */
-# endif
-
-# ifdef check
-# undef check
-# endif
-
-
-class Fl_Widget;
-class Fl_Window;
-class Fl_Image;
-struct Fl_Label;
-
-
-/** \defgroup callback_functions Callback function typedefs
- \brief Typedefs defined in <FL/Fl.H> for callback or handler functions passed as function parameters.
-
- FLTK uses callback functions as parameters for some function calls, e.g. to
- set up global event handlers (Fl::add_handler()), to add a timeout handler
- (Fl::add_timeout()), and many more.
-
- The typedefs defined in this group describe the function parameters used to set
- up or clear the callback functions and should also be referenced to define the
- callback function to handle such events in the user's code.
-
- \see Fl::add_handler(), Fl::add_timeout(), Fl::repeat_timeout(),
- Fl::remove_timeout() and others
- @{ */
-
-/** Signature of some label drawing functions passed as parameters */
-typedef void (Fl_Label_Draw_F)(const Fl_Label *label, int x, int y, int w, int h, Fl_Align align);
-
-/** Signature of some label measurement functions passed as parameters */
-typedef void (Fl_Label_Measure_F)(const Fl_Label *label, int &width, int &height);
-
-/** Signature of some box drawing functions passed as parameters */
-typedef void (Fl_Box_Draw_F)(int x, int y, int w, int h, Fl_Color color);
-
-/** Signature of some timeout callback functions passed as parameters */
-typedef void (*Fl_Timeout_Handler)(void *data);
-
-/** Signature of some wakeup callback functions passed as parameters */
-typedef void (*Fl_Awake_Handler)(void *data);
-
-/** Signature of add_idle callback functions passed as parameters */
-typedef void (*Fl_Idle_Handler)(void *data);
-
-/** Signature of set_idle callback functions passed as parameters */
-typedef void (*Fl_Old_Idle_Handler)();
-
-/** Signature of add_fd functions passed as parameters */
-typedef void (*Fl_FD_Handler)(int fd, void *data);
-
-/** Signature of add_handler functions passed as parameters */
-typedef int (*Fl_Event_Handler)(int event);
-
-/** Signature of set_abort functions passed as parameters */
-typedef void (*Fl_Abort_Handler)(const char *format,...);
-
-/** Signature of set_atclose functions passed as parameters */
-typedef void (*Fl_Atclose_Handler)(Fl_Window *window, void *data);
-
-/** Signature of args functions passed as parameters */
-typedef int (*Fl_Args_Handler)(int argc, char **argv, int &i);
-
-/** Signature of event_dispatch functions passed as parameters.
- \see Fl::event_dispatch(Fl_Event_Dispatch) */
-typedef int (*Fl_Event_Dispatch)(int event, Fl_Window *w);
-
-/** @} */ /* group callback_functions */
-
-
-/**
- The Fl is the FLTK global (static) class containing
- state information and global methods for the current application.
-*/
-class FL_EXPORT Fl {
- Fl() {}; // no constructor!
-
-public: // should be private!
-#ifndef FL_DOXYGEN
- static int e_number;
- static int e_x;
- static int e_y;
- static int e_x_root;
- static int e_y_root;
- static int e_dx;
- static int e_dy;
- static int e_state;
- static int e_clicks;
- static int e_is_click;
- static int e_keysym;
- static char* e_text;
- static int e_length;
- static Fl_Event_Dispatch e_dispatch;
- static Fl_Widget* belowmouse_;
- static Fl_Widget* pushed_;
- static Fl_Widget* focus_;
- static int damage_;
- static Fl_Widget* selection_owner_;
- static Fl_Window* modal_;
- static Fl_Window* grab_;
- static int compose_state;
-#endif
- /**
- If true then flush() will do something.
- */
- static void damage(int d) {damage_ = d;}
-
-public:
- /** Enumerator for global FLTK options.
- These options can be set system wide, per user, or for the running
- application only.
- \see Fl::option(Fl_Option, bool)
- \see Fl::option(Fl_Option)
- */
- typedef enum {
- /// When switched on, moving the text cursor beyond the start or end of
- /// a text in a text widget will change focus to the next text widget.
- /// When switched off, the cursor will stop at the end of the text.
- /// Pressing Tab or Ctrl-Tab will advance the keyboard focus.
- OPTION_ARROW_FOCUS = 0,
- // When switched on, FLTK will use the file chooser dialog that comes
- // with your operating system whenever possible. When switched off, FLTK
- // will present its own file chooser.
- // \todo implement me
- // OPTION_NATIVE_FILECHOOSER,
- // When Filechooser Preview is enabled, the FLTK or native file chooser
- // will show a preview of a selected file (if possible) before the user
- // decides to choose the file.
- // \todo implement me
- //OPTION_FILECHOOSER_PREVIEW,
- /// If visible focus is switched on, FLTK will draw a dotted rectangle
- /// inside the widget that will receive the next keystroke. If switched
- /// off, no such indicator will be drawn and keyboard navigation
- /// is disabled.
- OPTION_VISIBLE_FOCUS,
- /// If text drag-and-drop is enabled, the user can select and drag text
- /// from any text widget. If disabled, no dragging is possible, however
- /// dropping text from other applications still works.
- OPTION_DND_TEXT,
- /// If tooltips are enabled, hovering the mouse over a widget with a
- /// tooltip text will open a little tooltip window until the mouse leaves
- /// the widget. If disabled, no tooltip is shown.
- OPTION_SHOW_TOOLTIPS,
- // don't change this, leave it always as the last element
- /// For internal use only.
- OPTION_LAST
- } Fl_Option;
-
-private:
- static unsigned char options_[OPTION_LAST];
- static unsigned char options_read_;
-
-public:
- /*
- Return a global setting for all FLTK applications, possibly overridden
- by a setting specifically for this application.
- */
- static bool option(Fl_Option opt);
-
- /*
- Override an option while the application is running.
- */
- static void option(Fl_Option opt, bool val);
-
- /**
- The currently executing idle callback function: DO NOT USE THIS DIRECTLY!
-
- This is now used as part of a higher level system allowing multiple
- idle callback functions to be called.
- \see add_idle(), remove_idle()
- */
- static void (*idle)();
-
-#ifndef FL_DOXYGEN
- static Fl_Awake_Handler *awake_ring_;
- static void **awake_data_;
- static int awake_ring_size_;
- static int awake_ring_head_;
- static int awake_ring_tail_;
- static const char* scheme_;
- static Fl_Image* scheme_bg_;
-
- static int e_original_keysym; // late addition
- static int scrollbar_size_;
-#endif
-
-
- static int add_awake_handler_(Fl_Awake_Handler, void*);
- static int get_awake_handler_(Fl_Awake_Handler&, void*&);
-
-public:
-
- // API version number
- static double version();
-
- // argument parsers:
- static int arg(int argc, char **argv, int& i);
- static int args(int argc, char **argv, int& i, Fl_Args_Handler cb = 0);
- static void args(int argc, char **argv);
- /**
- Usage string displayed if Fl::args() detects an invalid argument.
- This may be changed to point to customized text at run-time.
- */
- static const char* const help;
-
- // things called by initialization:
- static void display(const char*);
- static int visual(int);
- /**
- This does the same thing as Fl::visual(int) but also requires OpenGL
- drawing to work. This <I>must</I> be done if you want to draw in
- normal windows with OpenGL with gl_start() and gl_end().
- It may be useful to call this so your X windows use the same visual
- as an Fl_Gl_Window, which on some servers will reduce colormap flashing.
-
- See Fl_Gl_Window for a list of additional values for the argument.
- */
- static int gl_visual(int, int *alist=0); // platform dependent
- static void own_colormap();
- static void get_system_colors();
- static void foreground(uchar, uchar, uchar);
- static void background(uchar, uchar, uchar);
- static void background2(uchar, uchar, uchar);
-
- // schemes:
- static int scheme(const char*);
- /** See void scheme(const char *name) */
- static const char* scheme() {return scheme_;}
- /**
- Called by scheme according to scheme name.
- Loads or reloads the current scheme selection.
- See void scheme(const char *name)
- */
- static int reload_scheme(); // platform dependent
- static int scrollbar_size();
- static void scrollbar_size(int W);
-
- // execution:
- static int wait();
- static double wait(double time);
- static int check();
- static int ready();
- static int run();
- static Fl_Widget* readqueue();
- /**
- Adds a one-shot timeout callback. The function will be called by
- Fl::wait() at <i>t</i> seconds after this function is called.
- The optional void* argument is passed to the callback.
-
- You can have multiple timeout callbacks. To remove a timeout
- callback use Fl::remove_timeout().
-
- If you need more accurate, repeated timeouts, use Fl::repeat_timeout() to
- reschedule the subsequent timeouts.
-
- The following code will print "TICK" each second on
- stdout with a fair degree of accuracy:
-
- \code
- void callback(void*) {
- puts("TICK");
- Fl::repeat_timeout(1.0, callback);
- }
-
- int main() {
- Fl::add_timeout(1.0, callback);
- return Fl::run();
- }
- \endcode
- */
- static void add_timeout(double t, Fl_Timeout_Handler,void* = 0); // platform dependent
- /**
- Repeats a timeout callback from the expiration of the
- previous timeout, allowing for more accurate timing. You may only call
- this method inside a timeout callback.
-
- The following code will print "TICK" each second on
- stdout with a fair degree of accuracy:
-
- \code
- void callback(void*) {
- puts("TICK");
- Fl::repeat_timeout(1.0, callback);
- }
-
- int main() {
- Fl::add_timeout(1.0, callback);
- return Fl::run();
- }
- \endcode
- */
- static void repeat_timeout(double t, Fl_Timeout_Handler, void* = 0); // platform dependent
- static int has_timeout(Fl_Timeout_Handler, void* = 0);
- static void remove_timeout(Fl_Timeout_Handler, void* = 0);
- static void add_check(Fl_Timeout_Handler, void* = 0);
- static int has_check(Fl_Timeout_Handler, void* = 0);
- static void remove_check(Fl_Timeout_Handler, void* = 0);
- /**
- Adds file descriptor fd to listen to.
-
- When the fd becomes ready for reading Fl::wait() will call the
- callback and then return. The callback is passed the fd and the
- arbitrary void* argument.
-
- The second version takes a when bitfield, with the bits
- FL_READ, FL_WRITE, and FL_EXCEPT defined,
- to indicate when the callback should be done.
-
- There can only be one callback of each type for a file descriptor.
- Fl::remove_fd() gets rid of <I>all</I> the callbacks for a given
- file descriptor.
-
- Under UNIX <I>any</I> file descriptor can be monitored (files,
- devices, pipes, sockets, etc.). Due to limitations in Microsoft Windows,
- WIN32 applications can only monitor sockets.
- */
- static void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0); // platform dependent
- /** See void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0) */
- static void add_fd(int fd, Fl_FD_Handler cb, void* = 0); // platform dependent
- /** Removes a file descriptor handler. */
- static void remove_fd(int, int when); // platform dependent
- /** Removes a file descriptor handler. */
- static void remove_fd(int); // platform dependent
-
- static void add_idle(Fl_Idle_Handler cb, void* data = 0);
- static int has_idle(Fl_Idle_Handler cb, void* data = 0);
- static void remove_idle(Fl_Idle_Handler cb, void* data = 0);
- /** If true then flush() will do something. */
- static int damage() {return damage_;}
- static void redraw();
- static void flush();
- /** \addtogroup group_comdlg
- @{ */
- /**
- FLTK calls Fl::warning() to output a warning message.
-
- The default version on Windows returns \e without printing a warning
- message, because Windows programs normally don't have stderr (a console
- window) enabled.
-
- The default version on all other platforms prints the warning message to stderr.
-
- You can override the behavior by setting the function pointer to your
- own routine.
-
- Fl::warning() means that there was a recoverable problem, the display may
- be messed up, but the user can probably keep working - all X protocol
- errors call this, for example. The default implementation returns after
- displaying the message.
- \note \#include <FL/Fl.H>
- */
- static void (*warning)(const char*, ...);
- /**
- FLTK calls Fl::error() to output a normal error message.
-
- The default version on Windows displays the error message in a MessageBox window.
-
- The default version on all other platforms prints the error message to stderr.
-
- You can override the behavior by setting the function pointer to your
- own routine.
-
- Fl::error() means there is a recoverable error such as the inability to read
- an image file. The default implementation returns after displaying the message.
- \note \#include <FL/Fl.H>
- */
- static void (*error)(const char*, ...);
- /**
- FLTK calls Fl::fatal() to output a fatal error message.
-
- The default version on Windows displays the error message in a MessageBox window.
-
- The default version on all other platforms prints the error message to stderr.
-
- You can override the behavior by setting the function pointer to your
- own routine.
-
- Fl::fatal() must not return, as FLTK is in an unusable state, however your
- version may be able to use longjmp or an exception to continue, as long as
- it does not call FLTK again. The default implementation exits with status 1
- after displaying the message.
- \note \#include <FL/Fl.H>
- */
- static void (*fatal)(const char*, ...);
- /** @} */
-
- /** \defgroup fl_windows Windows handling functions
- \brief Windows and standard dialogs handling declared in <FL/Fl.H>
- @{ */
- static Fl_Window* first_window();
- static void first_window(Fl_Window*);
- static Fl_Window* next_window(const Fl_Window*);
-
- /**
- Returns the top-most modal() window currently shown.
-
- This is the most recently shown() window with modal() true, or NULL
- if there are no modal() windows shown().
- The modal() window has its handle() method called
- for all events, and no other windows will have handle()
- called (grab() overrides this).
- */
- static Fl_Window* modal() {return modal_;}
- /** Returns the window that currently receives all events.
-
- \return The window that currently receives all events,
- or NULL if event grabbing is currently OFF.
- */
- static Fl_Window* grab() {return grab_;}
- /** Selects the window to grab.
- This is used when pop-up menu systems are active.
-
- Send all events to the passed window no matter where the pointer or
- focus is (including in other programs). The window <I>does not have
- to be shown()</I> , this lets the handle() method of a
- "dummy" window override all event handling and allows you to
- map and unmap a complex set of windows (under both X and WIN32
- <I>some</I> window must be mapped because the system interface needs a
- window id).
-
- If grab() is on it will also affect show() of windows by doing
- system-specific operations (on X it turns on override-redirect).
- These are designed to make menus popup reliably
- and faster on the system.
-
- To turn off grabbing do Fl::grab(0).
-
- <I>Be careful that your program does not enter an infinite loop
- while grab() is on. On X this will lock up your screen!</I>
- To avoid this potential lockup, all newer operating systems seem to
- limit mouse pointer grabbing to the time during which a mouse button
- is held down. Some OS's may not support grabbing at all.
- */
- static void grab(Fl_Window*); // platform dependent
- /** @} */
-
- /** \defgroup fl_events Events handling functions
- Fl class events handling API declared in <FL/Fl.H>
- @{
- */
- // event information:
- /**
- Returns the last event that was processed. This can be used
- to determine if a callback is being done in response to a
- keypress, mouse click, etc.
- */
- static int event() {return e_number;}
- /**
- Returns the mouse position of the event relative to the Fl_Window
- it was passed to.
- */
- static int event_x() {return e_x;}
- /**
- Returns the mouse position of the event relative to the Fl_Window
- it was passed to.
- */
- static int event_y() {return e_y;}
- /**
- Returns the mouse position on the screen of the event. To find the
- absolute position of an Fl_Window on the screen, use the
- difference between event_x_root(),event_y_root() and
- event_x(),event_y().
- */
- static int event_x_root() {return e_x_root;}
- /**
- Returns the mouse position on the screen of the event. To find the
- absolute position of an Fl_Window on the screen, use the
- difference between event_x_root(),event_y_root() and
- event_x(),event_y().
- */
- static int event_y_root() {return e_y_root;}
- /**
- Returns the current horizontal mouse scrolling associated with the
- FL_MOUSEWHEEL event. Right is positive.
- */
- static int event_dx() {return e_dx;}
- /**
- Returns the current vertical mouse scrolling associated with the
- FL_MOUSEWHEEL event. Down is positive.
- */
- static int event_dy() {return e_dy;}
- /**
- Return where the mouse is on the screen by doing a round-trip query to
- the server. You should use Fl::event_x_root() and
- Fl::event_y_root() if possible, but this is necessary if you are
- not sure if a mouse event has been processed recently (such as to
- position your first window). If the display is not open, this will
- open it.
- */
- static void get_mouse(int &,int &); // platform dependent
- /**
- Returns non zero if we had a double click event.
- \retval Non-zero if the most recent FL_PUSH or FL_KEYBOARD was a "double click".
- \retval N-1 for N clicks.
- A double click is counted if the same button is pressed
- again while event_is_click() is true.
-
- */
- static int event_clicks() {return e_clicks;}
- /**
- Manually sets the number returned by Fl::event_clicks().
- This can be used to set it to zero so that
- later code does not think an item was double-clicked.
- \param[in] i corresponds to no double-click if 0, i+1 mouse clicks otherwise
- \see int event_clicks()
- */
- static void event_clicks(int i) {e_clicks = i;}
- /**
- Returns non-zero if the mouse has not moved far enough
- and not enough time has passed since the last FL_PUSH or
- FL_KEYBOARD event for it to be considered a "drag" rather than a
- "click". You can test this on FL_DRAG, FL_RELEASE,
- and FL_MOVE events.
- */
- static int event_is_click() {return e_is_click;}
- /**
- Clears the value returned by Fl::event_is_click().
- Useful to prevent the <I>next</I>
- click from being counted as a double-click or to make a popup menu
- pick an item with a single click. Don't pass non-zero to this.
- */
- static void event_is_click(int i) {e_is_click = i;}
- /**
- Gets which particular mouse button caused the current event.
- This returns garbage if the most recent event was not a FL_PUSH or FL_RELEASE event.
- \retval FL_LEFT_MOUSE \retval FL_MIDDLE_MOUSE \retval FL_RIGHT_MOUSE.
- \see Fl::event_buttons()
- */
- static int event_button() {return e_keysym-FL_Button;}
- /**
- This is a bitfield of what shift states were on and what mouse buttons
- were held down during the most recent event. The second version
- returns non-zero if any of the passed bits are turned on.
- The legal bits are:
-
- \li FL_SHIFT
- \li FL_CAPS_LOCK
- \li FL_CTRL
- \li FL_ALT
- \li FL_NUM_LOCK
- \li FL_META
- \li FL_SCROLL_LOCK
- \li FL_BUTTON1
- \li FL_BUTTON2
- \li FL_BUTTON3
-
- X servers do not agree on shift states, and FL_NUM_LOCK, FL_META, and
- FL_SCROLL_LOCK may not work. The values were selected to match the
- XFree86 server on Linux. In addition there is a bug in the way X works
- so that the shift state is not correctly reported until the first event
- <I>after</I> the shift key is pressed or released.
- */
- static int event_state() {return e_state;}
- /** See int event_state() */
- static int event_state(int i) {return e_state&i;}
- /**
- Gets which key on the keyboard was last pushed.
-
- The returned integer 'key code' is not necessarily a text
- equivalent for the keystroke. For instance: if someone presses '5' on the
- numeric keypad with numlock on, Fl::event_key() may return the 'key code'
- for this key, and NOT the character '5'. To always get the '5', use Fl::event_text() instead.
-
- \returns an integer 'key code', or 0 if the last event was not a key press or release.
- \see int event_key(int), event_text(), compose(int&).
- */
- static int event_key() {return e_keysym;}
- /**
- Returns the keycode of the last key event, regardless of the NumLock state.
-
- If NumLock is deactivated, FLTK translates events from the
- numeric keypad into the corresponding arrow key events.
- event_key() returns the translated key code, whereas
- event_original_key() returns the keycode before NumLock translation.
- */
- static int event_original_key(){return e_original_keysym;}
- /**
- Returns true if the given \p key was held
- down (or pressed) <I>during</I> the last event. This is constant until
- the next event is read from the server.
-
- Fl::get_key(int) returns true if the given key is held down <I>now</I>.
- Under X this requires a round-trip to the server and is <I>much</I>
- slower than Fl::event_key(int).
-
- Keys are identified by the <I>unshifted</I> values. FLTK defines a
- set of symbols that should work on most modern machines for every key
- on the keyboard:
-
- \li All keys on the main keyboard producing a printable ASCII
- character use the value of that ASCII character (as though shift,
- ctrl, and caps lock were not on). The space bar is 32.
- \li All keys on the numeric keypad producing a printable ASCII
- character use the value of that ASCII character plus FL_KP.
- The highest possible value is FL_KP_Last so you can
- range-check to see if something is on the keypad.
- \li All numbered function keys use the number on the function key plus
- FL_F. The highest possible number is FL_F_Last, so you
- can range-check a value.
- \li Buttons on the mouse are considered keys, and use the button
- number (where the left button is 1) plus FL_Button.
- \li All other keys on the keypad have a symbol: FL_Escape,
- FL_BackSpace, FL_Tab, FL_Enter, FL_Print, FL_Scroll_Lock, FL_Pause,
- FL_Insert, FL_Home, FL_Page_Up, FL_Delete, FL_End, FL_Page_Down,
- FL_Left, FL_Up, FL_Right, FL_Down, FL_Shift_L, FL_Shift_R,
- FL_Control_L, FL_Control_R, FL_Caps_Lock, FL_Alt_L, FL_Alt_R,
- FL_Meta_L, FL_Meta_R, FL_Menu, FL_Num_Lock, FL_KP_Enter. Be
- careful not to confuse these with the very similar, but all-caps,
- symbols used by Fl::event_state().
-
- On X Fl::get_key(FL_Button+n) does not work.
-
- On WIN32 Fl::get_key(FL_KP_Enter) and Fl::event_key(FL_KP_Enter) do not work.
- */
- static int event_key(int key);
- /**
- Returns true if the given \p key is held down <I>now</I>.
- Under X this requires a round-trip to the server and is <I>much</I>
- slower than Fl::event_key(int). \see event_key(int)
- */
- static int get_key(int key); // platform dependent
- /**
- Returns the text associated with the current event, including FL_PASTE or FL_DND_RELEASE events.
- This can be used in response to FL_KEYUP, FL_KEYDOWN, FL_PASTE, FL_DND_RELEASE.
-
- When responding to FL_KEYUP/FL_KEYDOWN, use this function instead of Fl::event_key()
- to get the text equivalent of keystrokes suitable for inserting into strings
- and text widgets.
-
- The returned string is guaranteed to be be NULL terminated.
- However, see Fl::event_length() for the actual length of the string,
- in case the string itself contains NULLs that are part of the text data.
-
- \returns A NULL terminated text string equivalent of the last keystroke.
- */
- static const char* event_text() {return e_text;}
- /**
- Returns the length of the text in Fl::event_text(). There
- will always be a nul at this position in the text. However there may
- be a nul before that if the keystroke translates to a nul character or
- you paste a nul character.
- */
- static int event_length() {return e_length;}
-
- static int compose(int &del);
- static void compose_reset();
- static int event_inside(int,int,int,int);
- static int event_inside(const Fl_Widget*);
- static int test_shortcut(Fl_Shortcut);
-
- // event destinations:
- static int handle(int, Fl_Window*);
- static int handle_(int, Fl_Window*);
- /** Gets the widget that is below the mouse.
- \see belowmouse(Fl_Widget*) */
- static Fl_Widget* belowmouse() {return belowmouse_;}
- static void belowmouse(Fl_Widget*);
- /** Gets the widget that is being pushed.
- \see void pushed(Fl_Widget*) */
- static Fl_Widget* pushed() {return pushed_;}
- static void pushed(Fl_Widget*);
- /** Gets the current Fl::focus() widget. \sa Fl::focus(Fl_Widget*) */
- static Fl_Widget* focus() {return focus_;}
- static void focus(Fl_Widget*);
- static void add_handler(Fl_Event_Handler h);
- static void remove_handler(Fl_Event_Handler h);
- static void event_dispatch(Fl_Event_Dispatch d);
- static Fl_Event_Dispatch event_dispatch();
- /** @} */
-
- /** \defgroup fl_clipboard Selection & Clipboard functions
- FLTK global copy/cut/paste functions declared in <FL/Fl.H>
- @{ */
- // cut/paste:
- /**
- Copies the data pointed to by \p stuff to the selection buffer
- (\p destination is 0) or
- the clipboard (\p destination is 1); \p len is the number of relevant
- bytes in \p stuff.
- The selection buffer is used for
- middle-mouse pastes and for drag-and-drop selections. The
- clipboard is used for traditional copy/cut/paste operations.
- */
- static void copy(const char* stuff, int len, int destination = 0); // platform dependent
- /**
- Pastes the data from the selection buffer (\p source is 0) or the clipboard
- (\p source is 1) into \p receiver.
- Set things up so the receiver widget will be called with an FL_PASTE event some
- time in the future with the data from the specified \p source in Fl::event_text()
- and the number of characters in Fl::event_length().
- The receiver
- should be prepared to be called \e directly by this, or for
- it to happen \e later, or possibly <i>not at all</i>. This
- allows the window system to take as long as necessary to retrieve
- the paste buffer (or even to screw up completely) without complex
- and error-prone synchronization code in FLTK.
-
- The selection buffer is used for middle-mouse pastes and for
- drag-and-drop selections. The clipboard is used for traditional
- copy/cut/paste operations.
- */
- static void paste(Fl_Widget &receiver, int source /*=0*/); // platform dependent
- /**
- Initiate a Drag And Drop operation. The selection buffer should be
- filled with relevant data before calling this method. FLTK will
- then initiate the system wide drag and drop handling. Dropped data
- will be marked as <i>text</i>.
-
- Create a selection first using:
- Fl::copy(const char *stuff, int len, 0)
- */
- static int dnd(); // platform dependent
-
- // These are for back-compatibility only:
- /** back-compatibility only: Gets the widget owning the current selection
- \see Fl_Widget* selection_owner(Fl_Widget*) */
- static Fl_Widget* selection_owner() {return selection_owner_;}
- static void selection_owner(Fl_Widget*);
- static void selection(Fl_Widget &owner, const char*, int len);
- static void paste(Fl_Widget &receiver);
-/** @} */
-/** \defgroup fl_screen Screen functions
- fl global screen functions declared in <FL/Fl.H>
- @{ */
- // screen size:
- /** Returns the origin of the current screen work area, where 0 indicates the left side of the screen. */
- static int x(); // platform dependent
- /** Returns the origin of the current screen work area, where 0 indicates the top edge of the screen. */
- static int y(); // platform dependent
- /** Returns the width of the screen work area in pixels. */
- static int w(); // platform dependent
- /** Returns the height of the screen work area in pixels. */
- static int h(); // platform dependent
-
- // multi-head support:
- static int screen_count();
- /**
- Gets the bounding box of a screen that contains the mouse pointer.
- \param[out] X,Y,W,H the corresponding screen bounding box
- \see void screen_xywh(int &x, int &y, int &w, int &h, int mx, int my)
- */
- static void screen_xywh(int &X, int &Y, int &W, int &H) {
- screen_xywh(X, Y, W, H, e_x_root, e_y_root);
- }
- static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my);
- static void screen_xywh(int &X, int &Y, int &W, int &H, int n);
- static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh);
- static void screen_dpi(float &h, float &v, int n=0);
-
- /** @} */
-
- /** \defgroup fl_attributes Color & Font functions
- fl global color, font functions.
- These functions are declared in <FL/Fl.H> or <FL/fl_draw.H>.
- @{ */
-
- // color map:
- static void set_color(Fl_Color, uchar, uchar, uchar);
- /**
- Sets an entry in the fl_color index table. You can set it to any
- 8-bit RGB color. The color is not allocated until fl_color(i) is used.
- */
- static void set_color(Fl_Color i, unsigned c); // platform dependent
- static unsigned get_color(Fl_Color i);
- static void get_color(Fl_Color i, uchar &red, uchar &green, uchar &blue);
- /**
- Frees the specified color from the colormap, if applicable.
- If overlay is non-zero then the color is freed from the
- overlay colormap.
- */
- static void free_color(Fl_Color i, int overlay = 0); // platform dependent
-
- // fonts:
- static const char* get_font(Fl_Font);
- /**
- Get a human-readable string describing the family of this face. This
- is useful if you are presenting a choice to the user. There is no
- guarantee that each face has a different name. The return value points
- to a static buffer that is overwritten each call.
-
- The integer pointed to by \p attributes (if the pointer is not
- zero) is set to zero, FL_BOLD or FL_ITALIC or
- FL_BOLD | FL_ITALIC. To locate a "family" of fonts, search
- forward and back for a set with non-zero attributes, these faces along
- with the face with a zero attribute before them constitute a family.
- */
- static const char* get_font_name(Fl_Font, int* attributes = 0);
- /**
- Return an array of sizes in \p sizep. The return value is the
- length of this array. The sizes are sorted from smallest to largest
- and indicate what sizes can be given to fl_font() that will
- be matched exactly (fl_font() will pick the closest size for
- other sizes). A zero in the first location of the array indicates a
- scalable font, where any size works, although the array may list sizes
- that work "better" than others. Warning: the returned array
- points at a static buffer that is overwritten each call. Under X this
- will open the display.
- */
- static int get_font_sizes(Fl_Font, int*& sizep);
- static void set_font(Fl_Font, const char*);
- static void set_font(Fl_Font, Fl_Font);
- /**
- FLTK will open the display, and add every fonts on the server to the
- face table. It will attempt to put "families" of faces together, so
- that the normal one is first, followed by bold, italic, and bold
- italic.
-
- The optional argument is a string to describe the set of fonts to
- add. Passing NULL will select only fonts that have the
- ISO8859-1 character set (and are thus usable by normal text). Passing
- "-*" will select all fonts with any encoding as long as they have
- normal X font names with dashes in them. Passing "*" will list every
- font that exists (on X this may produce some strange output). Other
- values may be useful but are system dependent. With WIN32 NULL
- selects fonts with ISO8859-1 encoding and non-NULL selects
- all fonts.
-
- The return value is how many faces are in the table after this is done.
- */
- static Fl_Font set_fonts(const char* = 0); // platform dependent
-
- /** @} */
- /** \defgroup fl_drawings Drawing functions
- FLTK global graphics and GUI drawing functions.
- These functions are declared in <FL/fl_draw.H>,
- and in <FL/x.H> for offscreen buffer-related ones.
- @{ */
- // <Hack to re-order the 'Drawing functions' group>
- /** @} */
-
- // labeltypes:
- static void set_labeltype(Fl_Labeltype,Fl_Label_Draw_F*,Fl_Label_Measure_F*);
- /** Sets the functions to call to draw and measure a specific labeltype. */
- static void set_labeltype(Fl_Labeltype, Fl_Labeltype from); // is it defined ?
-
- // boxtypes:
- static Fl_Box_Draw_F *get_boxtype(Fl_Boxtype);
- static void set_boxtype(Fl_Boxtype, Fl_Box_Draw_F*,uchar,uchar,uchar,uchar);
- static void set_boxtype(Fl_Boxtype, Fl_Boxtype from);
- static int box_dx(Fl_Boxtype);
- static int box_dy(Fl_Boxtype);
- static int box_dw(Fl_Boxtype);
- static int box_dh(Fl_Boxtype);
- static int draw_box_active();
-
- // back compatibility:
- /** \addtogroup fl_windows
- @{ */
- /** For back compatibility, sets the void Fl::fatal handler callback */
- static void set_abort(Fl_Abort_Handler f) {fatal = f;}
- static void (*atclose)(Fl_Window*,void*);
- static void default_atclose(Fl_Window*,void*);
- /** For back compatibility, sets the Fl::atclose handler callback. You
- can now simply change the callback for the window instead.
- \see Fl_Window::callback(Fl_Callback*) */
- static void set_atclose(Fl_Atclose_Handler f) {atclose = f;}
- /** @} */
-
- /** \addtogroup fl_events
- @{ */
- /** Returns non-zero if the Shift key is pressed. */
- static int event_shift() {return e_state&FL_SHIFT;}
- /** Returns non-zero if the Control key is pressed. */
- static int event_ctrl() {return e_state&FL_CTRL;}
- /** Returns non-zero if the FL_COMMAND key is pressed, either FL_CTRL or on OSX FL_META. */
- static int event_command() {return e_state&FL_COMMAND;}
- /** Returns non-zero if the Alt key is pressed. */
- static int event_alt() {return e_state&FL_ALT;}
- /**
- Returns the mouse buttons state bits; if non-zero, then at least one
- button is pressed now. This function returns the button state at the
- time of the event. During an FL_RELEASE event, the state
- of the released button will be 0. To find out, which button
- caused an FL_RELEASE event, you can use Fl::event_button() instead.
- \return a bit mask value like { [FL_BUTTON1] | [FL_BUTTON2] | [FL_BUTTON3] }
- */
- static int event_buttons() {return e_state&0x7f000000;}
- /**
- Returns non-zero if mouse button 1 is currently held down.
- For more details, see Fl::event_buttons().
- */
- static int event_button1() {return e_state&FL_BUTTON1;}
- /**
- Returns non-zero if button 2 is currently held down.
- For more details, see Fl::event_buttons().
- */
- static int event_button2() {return e_state&FL_BUTTON2;}
- /**
- Returns non-zero if button 3 is currently held down.
- For more details, see Fl::event_buttons().
- */
- static int event_button3() {return e_state&FL_BUTTON3;}
- /** @} */
-
- /**
- Sets an idle callback.
-
- \deprecated This method is obsolete - use the add_idle() method instead.
- */
- static void set_idle(Fl_Old_Idle_Handler cb) {idle = cb;}
- /** See grab(Fl_Window*) */
- static void grab(Fl_Window& win) {grab(&win);}
- /** Releases the current grabbed window, equals grab(0).
- \deprecated Use Fl::grab(0) instead.
- \see grab(Fl_Window*) */
- static void release() {grab(0);}
-
- // Visible focus methods...
- /**
- Gets or sets the visible keyboard focus on buttons and other
- non-text widgets. The default mode is to enable keyboard focus
- for all widgets.
- */
- static void visible_focus(int v) { option(OPTION_VISIBLE_FOCUS, (v!=0)); }
- /**
- Gets or sets the visible keyboard focus on buttons and other
- non-text widgets. The default mode is to enable keyboard focus
- for all widgets.
- */
- static int visible_focus() { return option(OPTION_VISIBLE_FOCUS); }
-
- // Drag-n-drop text operation methods...
- /**
- Gets or sets whether drag and drop text operations are supported.
- This specifically affects whether selected text can
- be dragged from text fields or dragged within a text field as a
- cut/paste shortcut.
- */
- static void dnd_text_ops(int v) { option(OPTION_DND_TEXT, (v!=0)); }
- /**
- Gets or sets whether drag and drop text operations are
- supported. This specifically affects whether selected text can
- be dragged from text fields or dragged within a text field as a
- cut/paste shortcut.
- */
- static int dnd_text_ops() { return option(OPTION_DND_TEXT); }
- /** \defgroup fl_multithread Multithreading support functions
- fl multithreading support functions declared in <FL/Fl.H>
- @{ */
-
- // Multithreading support:
- static int lock();
- static void unlock();
- static void awake(void* message = 0);
- /** See void awake(void* message=0). */
- static int awake(Fl_Awake_Handler cb, void* message = 0);
- /**
- The thread_message() method returns the last message
- that was sent from a child by the awake() method.
-
- See also: \ref advanced_multithreading
- */
- static void* thread_message(); // platform dependent
- /** @} */
-
- /** \defgroup fl_del_widget Safe widget deletion support functions
-
- These functions, declared in <FL/Fl.H>, support deletion of widgets inside callbacks.
-
- Fl::delete_widget() should be called when deleting widgets
- or complete widget trees (Fl_Group, Fl_Window, ...) inside
- callbacks.
-
- The other functions are intended for internal use. The preferred
- way to use them is by using the helper class Fl_Widget_Tracker.
-
- The following is to show how it works ...
-
- There are three groups of related methods:
-
- -# scheduled widget deletion
- - Fl::delete_widget() schedules widgets for deletion
- - Fl::do_widget_deletion() deletes all scheduled widgets
- -# widget watch list ("smart pointers")
- - Fl::watch_widget_pointer() adds a widget pointer to the watch list
- - Fl::release_widget_pointer() removes a widget pointer from the watch list
- - Fl::clear_widget_pointer() clears a widget pointer \e in the watch list
- -# the class Fl_Widget_Tracker:
- - the constructor calls Fl::watch_widget_pointer()
- - the destructor calls Fl::release_widget_pointer()
- - the access methods can be used to test, if a widget has been deleted
- \see Fl_Widget_Tracker.
-
- @{ */
- // Widget deletion:
- static void delete_widget(Fl_Widget *w);
- static void do_widget_deletion();
- static void watch_widget_pointer(Fl_Widget *&w);
- static void release_widget_pointer(Fl_Widget *&w);
- static void clear_widget_pointer(Fl_Widget const *w);
- /** @} */
-
-#ifdef FLTK_HAVE_CAIRO
- /** \defgroup group_cairo Cairo support functions and classes
- @{
- */
-public:
- // Cairo support API
- static cairo_t * cairo_make_current(Fl_Window* w);
- /** when FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true,
- any current window dc is linked to a current context.
- This is not the default, because it may not be necessary
- to add cairo support to all fltk supported windows.
- When you wish to associate a cairo context in this mode,
- you need to call explicitly in your draw() overridden method,
- FL::cairo_make_current(Fl_Window*). This will create a cairo context
- but only for this Window.
- Still in custom cairo application it is possible to handle
- completely this process automatically by setting \p alink to true.
- In this last case, you don't need anymore to call Fl::cairo_make_current().
- You can use Fl::cairo_cc() to get the current cairo context anytime.
- \note Only available when configure has the --enable-cairo option
- */
- static void cairo_autolink_context(bool alink) {cairo_state_.autolink(alink);}
- /**
- Gets the current autolink mode for cairo support.
- \retval false if no cairo context autolink is made for each window.
- \retval true if any fltk window is attached a cairo context when it
- is current. \see void cairo_autolink_context(bool alink)
- \note Only available when configure has the --enable-cairo option
- */
- static bool cairo_autolink_context() {return cairo_state_.autolink();}
- /** Gets the current cairo context linked with a fltk window. */
- static cairo_t * cairo_cc() { return cairo_state_.cc(); }
- /** Sets the current cairo context to \p c.
- Set \p own to true if you want fltk to handle this cc deletion.
- \note Only available when configure has the --enable-cairo option
-*/
- static void cairo_cc(cairo_t * c, bool own=false){ cairo_state_.cc(c, own); }
-
-private:
- static cairo_t * cairo_make_current(void* gc);
- static cairo_t * cairo_make_current(void* gc, int W, int H);
- static Fl_Cairo_State cairo_state_;
-public:
- /** @} */
-
-#endif // FLTK_HAVE_CAIRO
-
-};
-
-/**
- This class should be used to control safe widget deletion.
-
- You can use an Fl_Widget_Tracker object to watch another widget, if you
- need to know, if this widget has been deleted during a callback.
-
- This simplifies the use of the "safe widget deletion" methods
- Fl::watch_widget_pointer() and Fl::release_widget_pointer() and
- makes their use more reliable, because the destructor autmatically
- releases the widget pointer from the widget watch list.
-
- It is intended to be used as an automatic (local/stack) variable,
- such that the automatic destructor is called when the object's
- scope is left. This ensures that no stale widget pointers are
- left in the widget watch list (see example below).
-
- You can also create Fl_Widget_Tracker objects with \c new, but then it
- is your responsibility to delete the object (and thus remove the
- widget pointer from the watch list) when it is not needed any more.
-
- Example:
-
- \code
- int MyClass::handle (int event) {
-
- if (...) {
- Fl_Widget_Tracker wp(this); // watch myself
- do_callback(); // call the callback
-
- if (wp.deleted()) return 1; // exit, if deleted
-
- // Now we are sure that the widget has not been deleted.
- // It is safe to access the widget
-
- clear_changed(); // access the widget
- }
- }
- \endcode
-
-*/
-class FL_EXPORT Fl_Widget_Tracker {
-
- Fl_Widget* wp_;
-
-public:
-
- Fl_Widget_Tracker(Fl_Widget *wi);
- ~Fl_Widget_Tracker();
-
- /**
- Returns a pointer to the watched widget.
-
- This pointer is \c NULL, if the widget has been deleted.
- */
- Fl_Widget *widget() {return wp_;}
-
- /**
- Returns 1, if the watched widget has been deleted.
-
- This is a convenience method. You can also use something like
-
- <tt> if (wp.widget() == 0) // ...</tt>
-
- where \p wp is an Fl_Widget_Tracker object.
- */
- int deleted() {return wp_ == 0;}
-
- /**
- Returns 1, if the watched widget exists (has not been deleted).
-
- This is a convenience method. You can also use something like
-
- <tt> if (wp.widget() != 0) // ...</tt>
-
- where \p wp is an Fl_Widget_Tracker object.
- */
- int exists() {return wp_ != 0;}
-
-};
-
- /** \defgroup fl_unicode Unicode and UTF-8 functions
- fl global Unicode and UTF-8 handling functions declared in <FL/fl_utf8.h>
- @{ */
- /** @} */
-
-#endif // !Fl_H
-
-//
-// End of "$Id: Fl.H 8724 2011-05-23 18:01:29Z manolo $".
-//
diff --git a/Libraries/FL/Fl_Adjuster.H b/Libraries/FL/Fl_Adjuster.H
deleted file mode 100644
index d0c66173..00000000
--- a/Libraries/FL/Fl_Adjuster.H
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// "$Id: Fl_Adjuster.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Adjuster widget header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Adjuster widget . */
-
-// 3-button "slider", made for Nuke
-
-#ifndef Fl_Adjuster_H
-#define Fl_Adjuster_H
-
-#ifndef Fl_Valuator_H
-#include "Fl_Valuator.H"
-#endif
-
-/**
- The Fl_Adjuster widget was stolen from Prisms, and has proven
- to be very useful for values that need a large dynamic range.
- \image html adjuster1.png
- \image latex adjuster1.png "Fl_Adjuster" width=4cm
- <P>When you press a button and drag to the right the value increases.
- When you drag to the left it decreases. The largest button adjusts by
- 100 * step(), the next by 10 * step() and that
- smallest button by step(). Clicking on the buttons
- increments by 10 times the amount dragging by a pixel does. Shift +
- click decrements by 10 times the amount.
-*/
-class FL_EXPORT Fl_Adjuster : public Fl_Valuator {
- int drag;
- int ix;
- int soft_;
-protected:
- void draw();
- int handle(int);
- void value_damage();
-public:
- Fl_Adjuster(int X,int Y,int W,int H,const char *l=0);
- /**
- If "soft" is turned on, the user is allowed to drag the value outside
- the range. If they drag the value to one of the ends, let go, then
- grab again and continue to drag, they can get to any value. Default is
- one.
- */
- void soft(int s) {soft_ = s;}
- /**
- If "soft" is turned on, the user is allowed to drag the value outside
- the range. If they drag the value to one of the ends, let go, then
- grab again and continue to drag, they can get to any value. Default is
- one.
- */
- int soft() const {return soft_;}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Adjuster.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_BMP_Image.H b/Libraries/FL/Fl_BMP_Image.H
deleted file mode 100644
index 2204dc06..00000000
--- a/Libraries/FL/Fl_BMP_Image.H
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// "$Id: Fl_BMP_Image.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// BMP image header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_BMP_Image widget . */
-
-#ifndef Fl_BMP_Image_H
-#define Fl_BMP_Image_H
-# include "Fl_Image.H"
-
-/**
- The Fl_BMP_Image class supports loading, caching,
- and drawing of Windows Bitmap (BMP) image files.
-*/
-class FL_EXPORT Fl_BMP_Image : public Fl_RGB_Image {
-
- public:
-
- Fl_BMP_Image(const char* filename);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_BMP_Image.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Bitmap.H b/Libraries/FL/Fl_Bitmap.H
deleted file mode 100644
index 35256c74..00000000
--- a/Libraries/FL/Fl_Bitmap.H
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// "$Id: Fl_Bitmap.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Bitmap header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Bitmap widget . */
-
-#ifndef Fl_Bitmap_H
-#define Fl_Bitmap_H
-# include "Fl_Image.H"
-
-class Fl_Widget;
-struct Fl_Menu_Item;
-
-/**
- The Fl_Bitmap class supports caching and drawing of mono-color
- (bitmap) images. Images are drawn using the current color.
-*/
-class FL_EXPORT Fl_Bitmap : public Fl_Image {
- friend class Fl_Quartz_Graphics_Driver;
- friend class Fl_GDI_Graphics_Driver;
- friend class Fl_Xlib_Graphics_Driver;
-public:
-
- /** pointer to raw bitmap data */
- const uchar *array;
- /** Non-zero if array points to bitmap data allocated internally */
- int alloc_array;
-
- private:
-
-#if defined(__APPLE__) || defined(WIN32)
- /** for internal use */
- void *id_;
-#else
- /** for internal use */
- unsigned id_;
-#endif // __APPLE__ || WIN32
-
- public:
-
- /** The constructors create a new bitmap from the specified bitmap data */
- Fl_Bitmap(const uchar *bits, int W, int H) :
- Fl_Image(W,H,0), array(bits), alloc_array(0), id_(0) {data((const char **)&array, 1);}
- /** The constructors create a new bitmap from the specified bitmap data */
- Fl_Bitmap(const char *bits, int W, int H) :
- Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id_(0) {data((const char **)&array, 1);}
- virtual ~Fl_Bitmap();
- virtual Fl_Image *copy(int W, int H);
- Fl_Image *copy() { return copy(w(), h()); }
- virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
- void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
- virtual void label(Fl_Widget*w);
- virtual void label(Fl_Menu_Item*m);
- virtual void uncache();
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Bitmap.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Box.H b/Libraries/FL/Fl_Box.H
deleted file mode 100644
index 9de875df..00000000
--- a/Libraries/FL/Fl_Box.H
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// "$Id: Fl_Box.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Box header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Box widget . */
-
-#ifndef Fl_Box_H
-#define Fl_Box_H
-
-#ifndef Fl_Widget_H
-#include "Fl_Widget.H"
-#endif
-
-/**
- This widget simply draws its box, and possibly it's label. Putting it
- before some other widgets and making it big enough to surround them
- will let you draw a frame around them.
-*/
-class FL_EXPORT Fl_Box : public Fl_Widget {
-protected:
- void draw();
-public:
- /**
- - The first constructor sets box() to FL_NO_BOX, which
- means it is invisible. However such widgets are useful as placeholders
- or Fl_Group::resizable()
- values. To change the box to something visible, use box(n).
- - The second form of the constructor sets the box to the specified box
- type.
- <P>The destructor removes the box.
- */
- Fl_Box(int X, int Y, int W, int H, const char *l=0)
- : Fl_Widget(X,Y,W,H,l) {}
- /** See Fl_Box::Fl_Box(int x, int y, int w, int h, const char * = 0) */
- Fl_Box(Fl_Boxtype b, int X, int Y, int W, int H, const char *l)
- : Fl_Widget(X,Y,W,H,l) {box(b);}
-
- virtual int handle(int);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Box.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Browser.H b/Libraries/FL/Fl_Browser.H
deleted file mode 100644
index b7cc0656..00000000
--- a/Libraries/FL/Fl_Browser.H
+++ /dev/null
@@ -1,324 +0,0 @@
-//
-// "$Id: Fl_Browser.H 8623 2011-04-24 17:09:41Z AlbrechtS $"
-//
-// Browser header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Browser widget . */
-
-// Forms-compatible browser. Probably useful for other
-// lists of textual data. Notice that the line numbers
-// start from 1, and 0 means "no line".
-
-#ifndef Fl_Browser_H
-#define Fl_Browser_H
-
-#include "Fl_Browser_.H"
-#include "Fl_Image.H"
-
-struct FL_BLINE;
-
-/**
- The Fl_Browser widget displays a scrolling list of text
- lines, and manages all the storage for the text. This is not a text
- editor or spreadsheet! But it is useful for showing a vertical list of
- named objects to the user.
-
- Each line in the browser is identified by number. <I>The numbers
- start at one</I> (this is so that zero can be reserved for "no line" in
- the selective browsers). <I>Unless otherwise noted, the methods do not
- check to see if the passed line number is in range and legal. It must
- always be greater than zero and &lt;= size().</I>
-
- Each line contains a null-terminated string of text and a void *
- data pointer. The text string is displayed, the void *
- pointer can be used by the callbacks to reference the object the text
- describes.
-
- The base class does nothing when the user clicks on it. The
- subclasses
- Fl_Select_Browser,
- Fl_Hold_Browser, and
- Fl_Multi_Browser react to user clicks to select lines in
- the browser and do callbacks.
-
- The base class
- Fl_Browser_ provides the scrolling and selection mechanisms of
- this and all the subclasses, but the dimensions and appearance of each
- item are determined by the subclass. You can use Fl_Browser_
- to display information other than text, or text that is dynamically
- produced from your own data structures. If you find that loading the
- browser is a lot of work or is inefficient, you may want to make a
- subclass of Fl_Browser_.
-
- Some common coding patterns used for working with Fl_Browser:
- \code
- // How to loop through all the items in the browser
- for ( int t=1; t<=browser->size(); t++ ) { // index 1 based..!
- printf("item #%d, label='%s'\n", t, browser->text(t));
- }
- \endcode
-
- Note: If you are <I>subclassing</I> Fl_Browser, it's more efficient
- to use the protected methods item_first() and item_next(), since
- Fl_Browser internally uses linked lists to manage the browser's items.
- For more info, see find_item(int).
-*/
-class FL_EXPORT Fl_Browser : public Fl_Browser_ {
-
- FL_BLINE *first; // the array of lines
- FL_BLINE *last;
- FL_BLINE *cache;
- int cacheline; // line number of cache
- int lines; // Number of lines
- int full_height_;
- const int* column_widths_;
- char format_char_; // alternative to @-sign
- char column_char_; // alternative to tab
-
-protected:
-
- // required routines for Fl_Browser_ subclass:
- void* item_first() const ;
- void* item_next(void* item) const ;
- void* item_prev(void* item) const ;
- void* item_last()const ;
- int item_selected(void* item) const ;
- void item_select(void* item, int val);
- int item_height(void* item) const ;
- int item_width(void* item) const ;
- void item_draw(void* item, int X, int Y, int W, int H) const ;
- int full_height() const ;
- int incr_height() const ;
- const char *item_text(void *item) const;
- /** Swap the items \p a and \p b.
- You must call redraw() to make any changes visible.
- \param[in] a,b the items to be swapped.
- \see swap(int,int), item_swap()
- */
- void item_swap(void *a, void *b) { swap((FL_BLINE*)a, (FL_BLINE*)b); }
- /** Return the item at specified \p line.
- \param[in] line The line of the item to return. (1 based)
- \returns The item, or NULL if line out of range.
- \see item_at(), find_line(), lineno()
- */
- void *item_at(int line) const { return (void*)find_line(line); }
-
- FL_BLINE* find_line(int line) const ;
- FL_BLINE* _remove(int line) ;
- void insert(int line, FL_BLINE* item);
- int lineno(void *item) const ;
- void swap(FL_BLINE *a, FL_BLINE *b);
-
-public:
-
- void remove(int line);
- void add(const char* newtext, void* d = 0);
- void insert(int line, const char* newtext, void* d = 0);
- void move(int to, int from);
- int load(const char* filename);
- void swap(int a, int b);
- void clear();
-
- /**
- Returns how many lines are in the browser.
- The last line number is equal to this.
- Returns 0 if browser is empty.
- */
- int size() const { return lines; }
- void size(int W, int H) { Fl_Widget::size(W, H); }
-
- int topline() const ;
- /** For internal use only? */
- enum Fl_Line_Position { TOP, BOTTOM, MIDDLE };
- void lineposition(int line, Fl_Line_Position pos);
- /**
- Scrolls the browser so the top item in the browser
- is showing the specified \p line.
- \param[in] line The line to be displayed at the top.
- \see topline(), middleline(), bottomline(), displayed(), lineposition()
- */
- void topline(int line) { lineposition(line, TOP); }
- /**
- Scrolls the browser so the bottom item in the browser
- is showing the specified \p line.
- \param[in] line The line to be displayed at the bottom.
- \see topline(), middleline(), bottomline(), displayed(), lineposition()
- */
- void bottomline(int line) { lineposition(line, BOTTOM); }
- /**
- Scrolls the browser so the middle item in the browser
- is showing the specified \p line.
- \param[in] line The line to be displayed in the middle.
- \see topline(), middleline(), bottomline(), displayed(), lineposition()
- */
- void middleline(int line) { lineposition(line, MIDDLE); }
-
- int select(int line, int val=1);
- int selected(int line) const ;
- void show(int line);
- /** Shows the entire Fl_Browser widget -- opposite of hide(). */
- void show() { Fl_Widget::show(); }
- void hide(int line);
- /** Hides the entire Fl_Browser widget -- opposite of show(). */
- void hide() { Fl_Widget::hide(); }
- int visible(int line) const ;
-
- int value() const ;
- /**
- Sets the browser's value(), which selects the specified \p line.
- This is the same as calling select(line).
- \see select(), selected(), value(), item_select(), item_selected()
- */
- void value(int line) { select(line); }
- const char* text(int line) const ;
- void text(int line, const char* newtext);
- void* data(int line) const ;
- void data(int line, void* d);
-
- Fl_Browser(int X, int Y, int W, int H, const char *L = 0);
- /**
- The destructor deletes all list items and destroys the browser.
- */
- ~Fl_Browser() { clear(); }
-
- /**
- Gets the current format code prefix character, which by default is '\@'.
- A string of formatting codes at the start of each column are stripped off
- and used to modify how the rest of the line is printed:
-
- \li <tt>'\@.'</tt> Print rest of line, don't look for more '\@' signs
- \li <tt>'\@\@'</tt> Print rest of line starting with '\@'
- \li <tt>'\@l'</tt> Use a LARGE (24 point) font
- \li <tt>'\@m'</tt> Use a medium large (18 point) font
- \li <tt>'\@s'</tt> Use a <SMALL>small</SMALL> (11 point) font
- \li <tt>'\@b'</tt> Use a <B>bold</B> font (adds FL_BOLD to font)
- \li <tt>'\@i'</tt> Use an <I>italic</I> font (adds FL_ITALIC to font)
- \li <tt>'\@f' or '\@t'</tt> Use a fixed-pitch
- font (sets font to FL_COURIER)
- \li <tt>'\@c'</tt> Center the line horizontally
- \li <tt>'\@r'</tt> Right-justify the text
- \li <tt>'\@B0', '\@B1', ... '\@B255'</tt> Fill the backgound with
- fl_color(n)
- \li <tt>'\@C0', '\@C1', ... '\@C255'</tt> Use fl_color(n) to draw the text
- \li <tt>'\@F0', '\@F1', ...</tt> Use fl_font(n) to draw the text
- \li <tt>'\@S1', '\@S2', ...</tt> Use point size n to draw the text
- \li <tt>'\@u' or '\@_'</tt> Underline the text.
- \li <tt>'\@-'</tt> draw an engraved line through the middle.
-
- Notice that the '\@.' command can be used to reliably
- terminate the parsing. To print a random string in a random color, use
- <tt>sprintf("@C%d@.%s", color, string)</tt> and it will work even if the
- string starts with a digit or has the format character in it.
- */
- char format_char() const { return format_char_; }
- /**
- Sets the current format code prefix character to \p c.
- The default prefix is '\@'. Set the prefix to 0 to disable formatting.
- \see format_char() for list of '\@' codes
- */
- void format_char(char c) { format_char_ = c; }
- /**
- Gets the current column separator character.
- The default is '\\t' (tab).
- \see column_char(), column_widths()
- */
- char column_char() const { return column_char_; }
- /**
- Sets the column separator to c.
- This will only have an effect if you also set column_widths().
- The default is '\\t' (tab).
- \see column_char(), column_widths()
- */
- void column_char(char c) { column_char_ = c; }
- /**
- Gets the current column width array.
- This array is zero-terminated and specifies the widths in pixels of
- each column. The text is split at each column_char() and each part is
- formatted into it's own column. After the last column any remaining
- text is formatted into the space between the last column and the
- right edge of the browser, even if the text contains instances of
- column_char() . The default value is a one-element array of just
- a zero, which means there are no columns.
-
- Example:
- \code
- Fl_Browser *b = new Fl_Browser(..);
- int widths[] = { 50, 50, 50, 70, 70, 40, 40, 70, 70, 50, 0 }; // widths for each column
- b->column_widths(widths); // assign array to widget
- b->column_char('\t'); // use tab as the column character
- b->add("USER\tPID\tCPU\tMEM\tVSZ\tRSS\tTTY\tSTAT\tSTART\tTIME\tCOMMAND");
- b->add("root\t2888\t0.0\t0.0\t1352\t0\ttty3\tSW\tAug15\t0:00\t@b@f/sbin/mingetty tty3");
- b->add("root\t13115\t0.0\t0.0\t1352\t0\ttty2\tSW\tAug30\t0:00\t@b@f/sbin/mingetty tty2");
- [..]
- \endcode
- \see column_char(), column_widths()
- */
- const int* column_widths() const { return column_widths_; }
- /**
- Sets the current array to \p arr. Make sure the last entry is zero.
- \see column_char(), column_widths()
- */
- void column_widths(const int* arr) { column_widths_ = arr; }
-
- /**
- Returns non-zero if \p line has been scrolled to a position where it is being displayed.
- Checks to see if the item's vertical position is within the top and bottom
- edges of the display window. This does NOT take into account the hide()/show()
- status of the widget or item.
- \param[in] line The line to be checked
- \returns 1 if visible, 0 if not visible.
- \see topline(), middleline(), bottomline(), displayed(), lineposition()
- */
- int displayed(int line) const { return Fl_Browser_::displayed(find_line(line)); }
-
- /**
- Make the item at the specified \p line visible().
- Functionally similar to show(int line).
- If \p line is out of range, redisplay top or bottom of list as appropriate.
- \param[in] line The line to be made visible.
- \see show(int), hide(int), display(), visible(), make_visible()
- */
- void make_visible(int line) {
- if (line < 1) Fl_Browser_::display(find_line(1));
- else if (line > lines) Fl_Browser_::display(find_line(lines));
- else Fl_Browser_::display(find_line(line));
- }
-
- // icon support
- void icon(int line, Fl_Image* icon);
- Fl_Image* icon(int line) const;
- void remove_icon(int line);
-
- /** For back compatibility only. */
- void replace(int a, const char* b) { text(a, b); }
- void display(int line, int val=1);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Browser.H 8623 2011-04-24 17:09:41Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Browser_.H b/Libraries/FL/Fl_Browser_.H
deleted file mode 100644
index 5bcf7e16..00000000
--- a/Libraries/FL/Fl_Browser_.H
+++ /dev/null
@@ -1,378 +0,0 @@
-//
-// "$Id: Fl_Browser_.H 8275 2011-01-13 22:07:31Z manolo $"
-//
-// Common browser header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Browser_ widget . */
-
-// Yes, I know this should be a template...
-
-#ifndef Fl_Browser__H
-#define Fl_Browser__H
-
-#ifndef Fl_Group_H
-#include "Fl_Group.H"
-#endif
-#include "Fl_Scrollbar.H"
-#include <FL/Fl.H> // Fl::scrollbar_size()
-
-#define FL_NORMAL_BROWSER 0 /**< type() of Fl_Browser */
-#define FL_SELECT_BROWSER 1 /**< type() of FL_Select_Browser */
-#define FL_HOLD_BROWSER 2 /**< type() of Fl_Hold_Browser */
-#define FL_MULTI_BROWSER 3 /**< type() of Fl_Multi_Browser */
-
-#define FL_SORT_ASCENDING 0 /**< sort browser items in ascending alphabetic order. */
-#define FL_SORT_DESCENDING 1 /**< sort in descending order */
-
-/**
- This is the base class for browsers. To be useful it must be
- subclassed and several virtual functions defined. The Forms-compatible
- browser and the file chooser's browser are subclassed off of this.
-
- This has been designed so that the subclass has complete control
- over the storage of the data, although because next() and
- prev() functions are used to index, it works best as a linked list
- or as a large block of characters in which the line breaks must be
- searched for.
-
- A great deal of work has been done so that the "height" of a data
- object does not need to be determined until it is drawn. This is
- useful if actually figuring out the size of an object requires
- accessing image data or doing stat() on a file or doing some
- other slow operation.
-*/
-class FL_EXPORT Fl_Browser_ : public Fl_Group {
- int position_; // where user wants it scrolled to
- int real_position_; // the current vertical scrolling position
- int hposition_; // where user wants it panned to
- int real_hposition_; // the current horizontal scrolling position
- int offset_; // how far down top_ item the real_position is
- int max_width; // widest object seen so far
- uchar has_scrollbar_; // which scrollbars are enabled
- Fl_Font textfont_;
- Fl_Fontsize textsize_;
- Fl_Color textcolor_;
- void* top_; // which item scrolling position is in
- void* selection_; // which is selected (except for FL_MULTI_BROWSER)
- void *redraw1,*redraw2; // minimal update pointers
- void* max_width_item; // which item has max_width_
- int scrollbar_size_; // size of scrollbar trough
-
- void update_top();
-
-protected:
-
- // All of the following must be supplied by the subclass:
- /**
- This method must be provided by the subclass
- to return the first item in the list.
- \see item_first(), item_next(), item_last(), item_prev()
- */
- virtual void *item_first() const = 0;
- /**
- This method must be provided by the subclass
- to return the item in the list after \p item.
- \see item_first(), item_next(), item_last(), item_prev()
- */
- virtual void *item_next(void *item) const = 0;
- /**
- This method must be provided by the subclass
- to return the item in the list before \p item.
- \see item_first(), item_next(), item_last(), item_prev()
- */
- virtual void *item_prev(void *item) const = 0;
- /**
- This method must be provided by the subclass
- to return the last item in the list.
- \see item_first(), item_next(), item_last(), item_prev()
- */
- virtual void *item_last() const { return 0L; }
- /**
- This method must be provided by the subclass to return
- the height of \p item in pixels.
- Allow for two additional pixels for the list selection box.
- \param[in] item The item whose height is returned.
- \returns The height of the specified \p item in pixels.
- \see item_height(), item_width(), item_quick_height()
- */
- virtual int item_height(void *item) const = 0;
- /**
- This method must be provided by the subclass to return the width of the
- \p item in pixels. Allow for two additional pixels for the list
- selection box.
- \param[in] item The item whose width is returned.
- \returns The width of the item in pixels.
- */
- virtual int item_width(void *item) const = 0;
- virtual int item_quick_height(void *item) const ;
- /**
- This method must be provided by the subclass to draw the \p item
- in the area indicated by \p X, \p Y, \p W, \p H.
- */
- virtual void item_draw(void *item,int X,int Y,int W,int H) const = 0;
- /**
- This optional method returns a string (label) that may be used for sorting.
- \param[in] item The item whose label text is returned.
- \returns The item's text label. (Can be NULL if blank)
- */
- virtual const char *item_text(void *item) const { (void)item; return 0L; }
- /**
- This optional method should be provided by the subclass
- to efficiently swap browser items \p a and \p b, such as for sorting.
- \param[in] a,b The two items to be swapped.
- */
- virtual void item_swap(void *a,void *b) { (void)a; (void)b; }
- /**
- This method must be provided by the subclass
- to return the item for the specified \p index.
- \param[in] index The \p index of the item to be returned
- \returns The item at the specified \p index.
- */
- virtual void *item_at(int index) const { (void)index; return 0L; }
- // you don't have to provide these but it may help speed it up:
- virtual int full_width() const ; // current width of all items
- virtual int full_height() const ; // current height of all items
- virtual int incr_height() const ; // average height of an item
- // These only need to be done by subclass if you want a multi-browser:
- virtual void item_select(void *item,int val=1);
- virtual int item_selected(void *item) const ;
-
- // things the subclass may want to call:
- /**
- Returns the item that appears at the top of the list.
- */
- void *top() const { return top_; }
- /**
- Returns the item currently selected, or NULL if there is no selection.
-
- For multiple selection browsers this call returns the currently focused item,
- even if it is not selected. To find all selected items, call
- Fl_Multi_Browser::selected() for every item in question.
- */
- void *selection() const { return selection_; }
- void new_list(); // completely clobber all data, as though list replaced
- void deleting(void *item); // get rid of any pointers to item
- void replacing(void *a,void *b); // change a pointers to b
- void swapping(void *a,void *b); // exchange pointers a and b
- void inserting(void *a,void *b); // insert b near a
- int displayed(void *item) const ; // true if this item is visible
- void redraw_line(void *item); // minimal update, no change in size
- /**
- This method will cause the entire list to be redrawn.
- \see redraw_lines(), redraw_line()
- */
- void redraw_lines() { damage(FL_DAMAGE_SCROLL); } // redraw all of them
- void bbox(int &X,int &Y,int &W,int &H) const;
- int leftedge() const; // x position after scrollbar & border
- void *find_item(int ypos); // item under mouse
-
- void draw();
- Fl_Browser_(int X,int Y,int W,int H,const char *L=0);
-
-public:
-
- /**
- Vertical scrollbar. Public, so that it can be accessed directly.
- */
- Fl_Scrollbar scrollbar;
- /**
- Horizontal scrollbar. Public, so that it can be accessed directly.
- */
- Fl_Scrollbar hscrollbar;
-
- int handle(int event);
- void resize(int X,int Y,int W,int H);
-
- int select(void *item,int val=1,int docallbacks=0);
- int select_only(void *item,int docallbacks=0);
- int deselect(int docallbacks=0);
- /**
- Gets the vertical scroll position of the list as a pixel position \p pos.
- The position returned is how many pixels of the list are scrolled off the top edge
- of the screen. Example: A position of '3' indicates the top 3 pixels of
- the list are scrolled off the top edge of the screen.
- \see position(), hposition()
- */
- int position() const { return position_; }
- void position(int pos); // scroll to here
- /**
- Gets the horizontal scroll position of the list as a pixel position \p pos.
- The position returned is how many pixels of the list are scrolled off the left edge
- of the screen. Example: A position of '18' indicates the left 18 pixels of
- the list are scrolled off the left edge of the screen.
- \see position(), hposition()
- */
- int hposition() const { return hposition_; }
- void hposition(int); // pan to here
- void display(void *item); // scroll so this item is shown
-
- /**
- Values for has_scrollbar().
- */
- /** Anonymous enum bit flags for has_scrollbar().
- - bit 0: horizontal
- - bit 1: vertical
- - bit 2: 'always' (to be combined with bits 0 and 1)
- - bit 3-31: reserved for future use
- */
- enum { // values for has_scrollbar()
- HORIZONTAL = 1, ///< Only show horizontal scrollbar.
- VERTICAL = 2, ///< Only show vertical scrollbar.
- BOTH = 3, ///< Show both scrollbars. (default)
- ALWAYS_ON = 4, ///< Specified scrollbar(s) should 'always' be shown (to be used with HORIZONTAL/VERTICAL)
- HORIZONTAL_ALWAYS = 5, ///< Horizontal scrollbar always on.
- VERTICAL_ALWAYS = 6, ///< Vertical scrollbar always on.
- BOTH_ALWAYS = 7 ///< Both scrollbars always on.
- };
- /**
- Returns the current scrollbar mode, see Fl_Browser_::has_scrollbar(uchar)
- */
- uchar has_scrollbar() const { return has_scrollbar_; }
- /**
- Sets whether the widget should have scrollbars or not (default Fl_Browser_::BOTH).
- By default you can scroll in both directions, and the scrollbars
- disappear if the data will fit in the widget.
- has_scrollbar() changes this based on the value of \p mode:
-
- - 0 - No scrollbars.
-
- - Fl_Browser_::HORIZONTAL - Only a horizontal scrollbar.
-
- - Fl_Browser_::VERTICAL - Only a vertical scrollbar.
-
- - Fl_Browser_::BOTH - The default is both scrollbars.
-
- - Fl_Browser_::HORIZONTAL_ALWAYS - Horizontal scrollbar always on,
- vertical always off.
-
- - Fl_Browser_::VERTICAL_ALWAYS - Vertical scrollbar always on,
- horizontal always off.
-
- - Fl_Browser_::BOTH_ALWAYS - Both always on.
- */
- void has_scrollbar(uchar mode) { has_scrollbar_ = mode; }
-
- /**
- Gets the default text font for the lines in the browser.
- \see textfont(), textsize(), textcolor()
- */
- Fl_Font textfont() const { return textfont_; }
- /**
- Sets the default text font for the lines in the browser to \p font.
- */
- void textfont(Fl_Font font) { textfont_ = font; }
-
- /**
- Gets the default text size (in pixels) for the lines in the browser.
- */
- Fl_Fontsize textsize() const { return textsize_; }
- /**
- Sets the default text size (in pixels) for the lines in the browser to \p size.
- */
- void textsize(Fl_Fontsize size) { textsize_ = size; }
-
- /**
- Gets the default text color for the lines in the browser.
- */
- Fl_Color textcolor() const { return textcolor_; }
- /**
- Sets the default text color for the lines in the browser to color \p col.
- */
- void textcolor(Fl_Color col) { textcolor_ = col; }
-
- /**
- Gets the current size of the scrollbars' troughs, in pixels.
-
- If this value is zero (default), this widget will use the
- Fl::scrollbar_size() value as the scrollbar's width.
-
- \returns Scrollbar size in pixels, or 0 if the global Fl::scrollsize() is being used.
- \see Fl::scrollbar_size(int)
- */
- int scrollbar_size() const {
- return(scrollbar_size_);
- }
- /**
- Sets the pixel size of the scrollbars' troughs to the \p size, in pixels.
-
- Normally you should not need this method, and should use
- Fl::scrollbar_size(int) instead to manage the size of ALL
- your widgets' scrollbars. This ensures your application
- has a consistent UI, is the default behavior, and is normally
- what you want.
-
- Only use THIS method if you really need to override the global
- scrollbar size. The need for this should be rare.
-
- Setting \p size to the special value of 0 causes the widget to
- track the global Fl::scrollbar_size(), which is the default.
-
- \param[in] size Sets the scrollbar size in pixels.\n
- If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()
- \see Fl::scrollbar_size()
- */
- void scrollbar_size(int size) {
- scrollbar_size_ = size;
- }
- /**
- This method has been deprecated, existing for backwards compatibility only.
- Use scrollbar_size() instead.
- This method always returns the global value Fl::scrollbar_size().
- \returns Always returns the global value Fl::scrollbar_size().
- \todo This method should eventually be removed in 1.4+
- */
- int scrollbar_width() const {
- return(Fl::scrollbar_size());
- }
- /**
- This method has been deprecated, existing for backwards compatibility only.
- Use scrollbar_size(int) instead.
- This method sets the global Fl::scrollbar_size(), and forces this
- instance of the widget to use it.
- \todo This method should eventually be removed in 1.4+
- */
- void scrollbar_width(int width) {
- Fl::scrollbar_size(width);
- scrollbar_size_ = 0;
- }
- /**
- Moves the vertical scrollbar to the righthand side of the list.
- For back compatibility.
- */
- void scrollbar_right() { scrollbar.align(FL_ALIGN_RIGHT); }
- /**
- Moves the vertical scrollbar to the lefthand side of the list.
- For back compatibility.
- */
- void scrollbar_left() { scrollbar.align(FL_ALIGN_LEFT); }
- void sort(int flags=0);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Browser_.H 8275 2011-01-13 22:07:31Z manolo $".
-//
diff --git a/Libraries/FL/Fl_Button.H b/Libraries/FL/Fl_Button.H
deleted file mode 100644
index 39050dc4..00000000
--- a/Libraries/FL/Fl_Button.H
+++ /dev/null
@@ -1,180 +0,0 @@
-//
-// "$Id: Fl_Button.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Button widget . */
-
-#ifndef Fl_Button_H
-#define Fl_Button_H
-
-#ifndef Fl_Widget_H
-#include "Fl_Widget.H"
-#endif
-
-// values for type()
-#define FL_NORMAL_BUTTON 0 /**< value() will be set to 1 during the press of the button and
- reverts back to 0 when the button is released */
-#define FL_TOGGLE_BUTTON 1 ///< value() toggles between 0 and 1 at every click of the button
-#define FL_RADIO_BUTTON (FL_RESERVED_TYPE+2) /**< is set to 1 at button press, and all other
- buttons in the same group with <tt>type() == FL_RADIO_BUTTON</tt>
- are set to zero.*/
-#define FL_HIDDEN_BUTTON 3 ///< for Forms compatibility
-
-extern FL_EXPORT Fl_Shortcut fl_old_shortcut(const char*);
-
-class Fl_Widget_Tracker;
-
-/**
- \class Fl_Button
- \brief Buttons generate callbacks when they are clicked by the user.
-
- You control exactly when and how by changing the values for type() and
- when(). Buttons can also generate callbacks in response to \c FL_SHORTCUT
- events. The button can either have an explicit shortcut(int s) value or a
- letter shortcut can be indicated in the label() with an '\&' character
- before it. For the label shortcut it does not matter if \e Alt is held
- down, but if you have an input field in the same window, the user will have
- to hold down the \e Alt key so that the input field does not eat the event
- first as an \c FL_KEYBOARD event.
-
- \todo Refactor the doxygen comments for Fl_Button type() documentation.
-
- For an Fl_Button object, the type() call returns one of:
- \li \c FL_NORMAL_BUTTON (0): value() remains unchanged after button press.
- \li \c FL_TOGGLE_BUTTON: value() is inverted after button press.
- \li \c FL_RADIO_BUTTON: value() is set to 1 after button press, and all other
- buttons in the current group with <tt>type() == FL_RADIO_BUTTON</tt>
- are set to zero.
-
- \todo Refactor the doxygen comments for Fl_Button when() documentation.
-
- For an Fl_Button object, the following when() values are useful, the default
- being \c FL_WHEN_RELEASE:
- \li \c 0: The callback is not done, instead changed() is turned on.
- \li \c FL_WHEN_RELEASE: The callback is done after the user successfully
- clicks the button, or when a shortcut is typed.
- \li \c FL_WHEN_CHANGED: The callback is done each time the value() changes
- (when the user pushes and releases the button, and as the mouse is
- dragged around in and out of the button).
-*/
-class FL_EXPORT Fl_Button : public Fl_Widget {
-
- int shortcut_;
- char value_;
- char oldval;
- uchar down_box_;
-
-protected:
-
- static Fl_Widget_Tracker *key_release_tracker;
- static void key_release_timeout(void*);
- void simulate_key_action();
-
- virtual void draw();
-
-public:
-
- virtual int handle(int);
-
- Fl_Button(int X, int Y, int W, int H, const char *L = 0);
-
- int value(int v);
-
- /**
- Returns the current value of the button (0 or 1).
- */
- char value() const {return value_;}
-
- /**
- Same as \c value(1).
- \see value(int v)
- */
- int set() {return value(1);}
-
- /**
- Same as \c value(0).
- \see value(int v)
- */
- int clear() {return value(0);}
-
- void setonly(); // this should only be called on FL_RADIO_BUTTONs
-
- /**
- Returns the current shortcut key for the button.
- \retval int
- */
- int shortcut() const {return shortcut_;}
-
- /**
- Sets the shortcut key to \c s.
- Setting this overrides the use of '\&' in the label().
- The value is a bitwise OR of a key and a set of shift flags, for example:
- <tt>FL_ALT | 'a'</tt>, or
- <tt>FL_ALT | (FL_F + 10)</tt>, or just
- <tt>'a'</tt>.
- A value of 0 disables the shortcut.
-
- The key can be any value returned by Fl::event_key(), but will usually be
- an ASCII letter. Use a lower-case letter unless you require the shift key
- to be held down.
-
- The shift flags can be any set of values accepted by Fl::event_state().
- If the bit is on, that shift key must be pushed. Meta, Alt, Ctrl, and
- Shift must be off if they are not in the shift flags (zero for the other
- bits indicates a "don't care" setting).
- \param[in] s bitwise OR of key and shift flags
- */
- void shortcut(int s) {shortcut_ = s;}
-
- /**
- Returns the current down box type, which is drawn when value() is non-zero.
- \retval Fl_Boxtype
- */
- Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
-
- /**
- Sets the down box type. The default value of 0 causes FLTK to figure out
- the correct matching down version of box().
- \param[in] b down box type
- */
- void down_box(Fl_Boxtype b) {down_box_ = b;}
-
- /// (for backwards compatibility)
- void shortcut(const char *s) {shortcut(fl_old_shortcut(s));}
-
- /// (for backwards compatibility)
- Fl_Color down_color() const {return selection_color();}
-
- /// (for backwards compatibility)
- void down_color(unsigned c) {selection_color(c);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Button.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Cairo.H b/Libraries/FL/Fl_Cairo.H
deleted file mode 100644
index 4f3b5232..00000000
--- a/Libraries/FL/Fl_Cairo.H
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-// "$Id: Fl_Cairo.H 8198 2011-01-06 10:24:58Z manolo $"
-//
-// Main header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Handling transparently platform dependent cairo include files
-*/
-
-#ifndef FL_CAIRO_H
-# define FL_CAIRO_H
-# ifdef FLTK_HAVE_CAIRO
-
-// Cairo is currently supported for the following platforms:
-// Win32, Apple Quartz, X11
-
-# include <FL/Fl_Export.H>
-
-# if defined(USE_X11) // X11
-# include <cairo-xlib.h>
-# elif defined(WIN32)
-# include <cairo-win32.h>
-# elif defined(__APPLE_QUARTZ__)
-# include <cairo-quartz.h>
-# else
-# error Cairo is not supported on that platform.
-# endif
-
-/**
- \addtogroup group_cairo
- @{
-*/
-
-/**
- Contains all the necessary info on the current cairo context.
- A private internal & unique corresponding object is created to
- permit cairo context state handling while keeping it opaque.
- For internal use only.
- \note Only available when configure has the --enable-cairo option
-*/
-class FL_EXPORT Fl_Cairo_State {
-public:
- Fl_Cairo_State() : cc_(0), own_cc_(false), autolink_(false), window_(0), gc_(0) {}
-
- // access attributes
- cairo_t* cc() const {return cc_;} ///< Gets the current cairo context
- bool autolink() const {return autolink_;} ///< Gets the autolink option. See Fl::cairo_autolink_context(bool)
- /** Sets the current cairo context, \p own indicates cc deletion is handle externally by user */
- void cc(cairo_t* c, bool own=true) {
- if (cc_ && own_cc_) cairo_destroy(cc_);
- cc_=c;
- if (!cc_) window_=0;
- own_cc_=own;
- }
- void autolink(bool b); ///< Sets the autolink option, only available with --enable-cairoext
- void window(void* w) {window_=w;} ///< Sets the window \p w to keep track on
- void* window() const {return window_;} ///< Gets the last window attached to a cc
- void gc(void* c) {gc_=c;} ///< Sets the gc \p c to keep track on
- void* gc() const {return gc_;} ///< Gets the last gc attached to a cc
-
-private:
- cairo_t * cc_; // contains the unique autoupdated cairo context
- bool own_cc_; // indicates whether we must delete the cc, useful for internal cleanup
- bool autolink_; // true by default, permits to prevent the automatic cairo mapping on fltk windows for custom cairo implementations
- void* window_, *gc_; // for keeping track internally of last win+gc treated
-};
-
-/** @} */
-
-# endif // FLTK_HAVE_CAIRO
-#endif // FL_CAIRO_H
-
-//
-// End of "$Id: Fl_Cairo.H 8198 2011-01-06 10:24:58Z manolo $" .
-//
diff --git a/Libraries/FL/Fl_Cairo_Window.H b/Libraries/FL/Fl_Cairo_Window.H
deleted file mode 100644
index e8bc75c0..00000000
--- a/Libraries/FL/Fl_Cairo_Window.H
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// "$Id: Fl_Cairo_Window.H 8198 2011-01-06 10:24:58Z manolo $"
-//
-// Main header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Cairo_Window Handling transparently a fltk window incorporte a cairo draw callback.
-*/
-
-#ifndef FL_CAIRO_WINDOW_H
-# define FL_CAIRO_WINDOW_H
-# ifdef FLTK_HAVE_CAIRO
-
-// Cairo is currently supported for the following platforms:
-// Win32, Apple Quartz, X11
-# include <FL/Fl.H>
-# include <FL/Fl_Double_Window.H>
-
-/**
- \addtogroup group_cairo
- @{
-*/
-
-/**
- This defines a pre-configured cairo fltk window.
- This class overloads the virtual draw() method for you,
- so that the only thing you have to do is to provide your cairo code.
- All cairo context handling is achieved transparently.
- \note You can alternatively define your custom cairo fltk window,
- and thus at least override the draw() method to provide custom cairo
- support. In this case you will probably use Fl::cairo_make_current(Fl_Window*)
- to attach a context to your window. You should do it only when your window is
- the current window. \see Fl_Window::current()
-*/
-class FL_EXPORT Fl_Cairo_Window : public Fl_Double_Window {
-
-public:
- Fl_Cairo_Window(int w, int h) : Fl_Double_Window(w,h),draw_cb_(0) {}
-
-protected:
- /** Overloaded to provide cairo callback support */
- void draw() {
- Fl_Double_Window::draw();
- // manual method ? if yes explicitly get a cairo_context here
- if (!Fl::cairo_autolink_context())
- Fl::cairo_make_current(this);
- if (draw_cb_) draw_cb_(this, Fl::cairo_cc());
- }
-
-public:
- /** This defines the cairo draw callback prototype that you must further */
- typedef void (*cairo_draw_cb) (Fl_Cairo_Window* self, cairo_t* def);
- /**
- You must provide a draw callback which will implement your cairo rendering.
- This method will permit you to set your cairo callback to \p cb.
- */
- void set_draw_cb(cairo_draw_cb cb){draw_cb_=cb;}
-private:
- cairo_draw_cb draw_cb_;
-};
-
-
-/** @} */
-
-# endif // FLTK_HAVE_CAIRO
-#endif // FL_CAIRO_WINDOW_H
-
-//
-// End of "$Id: Fl_Cairo_Window.H 8198 2011-01-06 10:24:58Z manolo $" .
-//
diff --git a/Libraries/FL/Fl_Chart.H b/Libraries/FL/Fl_Chart.H
deleted file mode 100644
index 97bd8eeb..00000000
--- a/Libraries/FL/Fl_Chart.H
+++ /dev/null
@@ -1,160 +0,0 @@
-//
-// "$Id: Fl_Chart.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Forms chart header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Chart widget . */
-
-#ifndef Fl_Chart_H
-#define Fl_Chart_H
-
-#ifndef Fl_Widget_H
-#include "Fl_Widget.H"
-#endif
-
-// values for type()
-#define FL_BAR_CHART 0 /**< type() for Bar Chart variant */
-#define FL_HORBAR_CHART 1 /**< type() for Horizontal Bar Chart variant */
-#define FL_LINE_CHART 2 /**< type() for Line Chart variant */
-#define FL_FILL_CHART 3 /**< type() for Fill Line Chart variant */
-#define FL_SPIKE_CHART 4 /**< type() for Spike Chart variant */
-#define FL_PIE_CHART 5 /**< type() for Pie Chart variant */
-#define FL_SPECIALPIE_CHART 6 /**< type() for Special Pie Chart variant */
-
-#define FL_FILLED_CHART FL_FILL_CHART /**< for compatibility */
-
-#define FL_CHART_MAX 128 /**< max entries per chart */
-#define FL_CHART_LABEL_MAX 18 /**< max label length for entry */
-
-/** For internal use only */
-struct FL_CHART_ENTRY {
- float val; /**< For internal use only. */
- unsigned col; /**< For internal use only. */
- char str[FL_CHART_LABEL_MAX+1]; /**< For internal use only. */
-};
-
-/**
- \class Fl_Chart
- \brief Fl_Chart displays simple charts.
- It is provided for Forms compatibility.
-
- \image html charts.png
- \image latex charts.png "Fl_Chart" width=10cm
- \todo Refactor Fl_Chart::type() information.
-
- The type of an Fl_Chart object can be set using type(uchar t) to:
- \li \c FL_BAR_CHART: Each sample value is drawn as a vertical bar.
- \li \c FL_FILLED_CHART: The chart is filled from the bottom of the graph
- to the sample values.
- \li \c FL_HORBAR_CHART: Each sample value is drawn as a horizontal bar.
- \li \c FL_LINE_CHART: The chart is drawn as a polyline with vertices at
- each sample value.
- \li \c FL_PIE_CHART: A pie chart is drawn with each sample value being
- drawn as a proportionate slice in the circle.
- \li \c FL_SPECIALPIE_CHART: Like \c FL_PIE_CHART, but the first slice is
- separated from the pie.
- \li \c FL_SPIKE_CHART: Each sample value is drawn as a vertical line.
- */
-class FL_EXPORT Fl_Chart : public Fl_Widget {
- int numb;
- int maxnumb;
- int sizenumb;
- FL_CHART_ENTRY *entries;
- double min,max;
- uchar autosize_;
- Fl_Font textfont_;
- Fl_Fontsize textsize_;
- Fl_Color textcolor_;
-protected:
- void draw();
-public:
- Fl_Chart(int X, int Y, int W, int H, const char *L = 0);
-
- ~Fl_Chart();
-
- void clear();
-
- void add(double val, const char *str = 0, unsigned col = 0);
-
- void insert(int ind, double val, const char *str = 0, unsigned col = 0);
-
- void replace(int ind, double val, const char *str = 0, unsigned col = 0);
-
- /**
- Gets the lower and upper bounds of the chart values.
- \param[out] a, b are set to lower, upper
- */
- void bounds(double *a,double *b) const {*a = min; *b = max;}
-
- void bounds(double a,double b);
-
- /**
- Returns the number of data values in the chart.
- */
- int size() const {return numb;}
-
- void size(int W, int H) { Fl_Widget::size(W, H); }
-
- /**
- Gets the maximum number of data values for a chart.
- */
- int maxsize() const {return maxnumb;}
-
- void maxsize(int m);
-
- /** Gets the chart's text font */
- Fl_Font textfont() const {return textfont_;}
- /** Sets the chart's text font to \p s. */
- void textfont(Fl_Font s) {textfont_ = s;}
-
- /** Gets the chart's text size */
- Fl_Fontsize textsize() const {return textsize_;}
- /** gets the chart's text size to \p s. */
- void textsize(Fl_Fontsize s) {textsize_ = s;}
-
- /** Gets the chart's text color */
- Fl_Color textcolor() const {return textcolor_;}
- /** gets the chart's text color to \p n. */
- void textcolor(Fl_Color n) {textcolor_ = n;}
-
- /**
- Get whether the chart will automatically adjust the bounds of the chart.
- \returns non-zero if auto-sizing is enabled and zero if disabled.
- */
- uchar autosize() const {return autosize_;}
-
- /**
- Set whether the chart will automatically adjust the bounds of the chart.
- \param[in] n non-zero to enable automatic resizing, zero to disable.
- */
- void autosize(uchar n) {autosize_ = n;}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Chart.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Check_Browser.H b/Libraries/FL/Fl_Check_Browser.H
deleted file mode 100644
index 57cd9618..00000000
--- a/Libraries/FL/Fl_Check_Browser.H
+++ /dev/null
@@ -1,122 +0,0 @@
-//
-// "$Id: Fl_Check_Browser.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Check_Browser widget . */
-
-#ifndef Fl_Check_Browser_H
-#define Fl_Check_Browser_H
-
-#include "Fl.H"
-#include "Fl_Browser_.H"
-
-/**
- The Fl_Check_Browser widget displays a scrolling list of text
- lines that may be selected and/or checked by the user.
-*/
-class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
- /* required routines for Fl_Browser_ subclass: */
-
- void *item_first() const;
- void *item_next(void *) const;
- void *item_prev(void *) const;
- int item_height(void *) const;
- int item_width(void *) const;
- void item_draw(void *, int, int, int, int) const;
- void item_select(void *, int);
- int item_selected(void *) const;
-
- /* private data */
-
- public: // IRIX 5.3 C++ compiler doesn't support private structures...
-
-#ifndef FL_DOXYGEN
- /** For internal use only. */
- struct cb_item {
- cb_item *next; /**< For internal use only. */
- cb_item *prev; /**< For internal use only. */
- char checked; /**< For internal use only. */
- char selected; /**< For internal use only. */
- char *text; /**< For internal use only. */
- };
-#endif // !FL_DOXYGEN
-
- private:
-
- cb_item *first;
- cb_item *last;
- cb_item *cache;
- int cached_item;
- int nitems_;
- int nchecked_;
- cb_item *find_item(int) const;
- int lineno(cb_item *) const;
-
- public:
-
- Fl_Check_Browser(int x, int y, int w, int h, const char *l = 0);
- /** The destructor deletes all list items and destroys the browser. */
- ~Fl_Check_Browser() { clear(); }
- int add(char *s); // add an (unchecked) item
- int add(char *s, int b); // add an item and set checked
- // both return the new nitems()
- int remove(int item); // delete an item. Returns nitems()
-
- // inline const char * methods to avoid breaking binary compatibility...
- /** See int Fl_Check_Browser::add(char *s) */
- int add(const char *s) { return add((char *)s); }
- /** See int Fl_Check_Browser::add(char *s) */
- int add(const char *s, int b) { return add((char *)s, b); }
-
- void clear(); // delete all items
- /**
- Returns how many lines are in the browser. The last line number is equal to
- this.
- */
- int nitems() const { return nitems_; }
- /** Returns how many items are currently checked. */
- int nchecked() const { return nchecked_; }
- int checked(int item) const;
- void checked(int item, int b);
- /** Equivalent to Fl_Check_Browser::checked(item, 1). */
- void set_checked(int item) { checked(item, 1); }
- void check_all();
- void check_none();
- int value() const; // currently selected item
- char *text(int item) const; // returns pointer to internal buffer
-
- protected:
-
- int handle(int);
-};
-
-#endif // Fl_Check_Browser_H
-
-//
-// End of "$Id: Fl_Check_Browser.H 7903 2010-11-28 21:06:39Z matt $".
-//
-
diff --git a/Libraries/FL/Fl_Check_Button.H b/Libraries/FL/Fl_Check_Button.H
deleted file mode 100644
index 67fb0131..00000000
--- a/Libraries/FL/Fl_Check_Button.H
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// "$Id: Fl_Check_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Check button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Check_Button widget . */
-
-#ifndef Fl_Check_Button_H
-#define Fl_Check_Button_H
-
-#include "Fl_Light_Button.H"
-
-/**
- \class Fl_Check_Button
- \brief A button with an "checkmark" to show its status.
-
- \image html Fl_Check_Button.png
- \image latex Fl_Check_Button.png "Fl_Check_Button" width=4cm
- Buttons generate callbacks when they are clicked by the user. You control
- exactly when and how by changing the values for type() and when().
-
- The Fl_Check_Button subclass displays its "ON" state by showing a "checkmark"
- rather than drawing itself pushed in.
-
- \todo Refactor Fl_Check_Button doxygen comments (add color() info etc?)
- \todo Generate Fl_Check_Button.gif with visible checkmark.
- */
-class FL_EXPORT Fl_Check_Button : public Fl_Light_Button {
-public:
- Fl_Check_Button(int X, int Y, int W, int H, const char *L = 0);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Check_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Choice.H b/Libraries/FL/Fl_Choice.H
deleted file mode 100644
index 006364f3..00000000
--- a/Libraries/FL/Fl_Choice.H
+++ /dev/null
@@ -1,108 +0,0 @@
-//
-// "$Id: Fl_Choice.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Choice header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Choice widget . */
-
-#ifndef Fl_Choice_H
-#define Fl_Choice_H
-
-#include "Fl_Menu_.H"
-
-/**
- \class Fl_Choice
- \brief A button that is used to pop up a menu.
-
- This is a button that, when pushed, pops up a menu (or hierarchy of menus)
- defined by an array of Fl_Menu_Item objects.
- Motif calls this an OptionButton.
-
- The only difference between this and a Fl_Menu_Button is that the name of
- the most recent chosen menu item is displayed inside the box, while the
- label is displayed outside the box. However, since the use of this is most
- often to control a single variable rather than do individual callbacks,
- some of the Fl_Menu_Button methods are redescribed here in those terms.
-
- When the user picks an item off the menu the value() is set to that item
- and then the item's callback is done with the menu_button as the
- \c Fl_Widget* argument. If the item does not have a callback the
- menu_button's callback is done instead.
-
- All three mouse buttons pop up the menu. The Forms behavior of the first
- two buttons to increment/decrement the choice is not implemented. This
- could be added with a subclass, however.
-
- The menu will also pop up in response to shortcuts indicated by putting
- a '\&' character in the label(). See Fl_Button::shortcut(int s) for a
- description of this.
-
- Typing the shortcut() of any of the items will do exactly the same as when
- you pick the item with the mouse. The '\&' character in item names are
- only looked at when the menu is popped up, however.
-
- \image html choice.png
- \image latex choice.png "Fl_Choice" width=4cm
- \todo Refactor the doxygen comments for Fl_Choice changed() documentation.
-
- \li <tt>int Fl_Widget::changed() const</tt>
- This value is true the user picks a different value. <em>It is turned
- off by value() and just before doing a callback (the callback can turn
- it back on if desired).</em>
- \li <tt>void Fl_Widget::set_changed()</tt>
- This method sets the changed() flag.
- \li <tt>void Fl_Widget::clear_changed()</tt>
- This method clears the changed() flag.
- \li <tt>Fl_Boxtype Fl_Choice::down_box() const</tt>
- Gets the current down box, which is used when the menu is popped up.
- The default down box type is \c FL_DOWN_BOX.
- \li <tt>void Fl_Choice::down_box(Fl_Boxtype b)</tt>
- Sets the current down box type to \p b.
- */
-class FL_EXPORT Fl_Choice : public Fl_Menu_ {
-protected:
- void draw();
-public:
- int handle(int);
-
- Fl_Choice(int X, int Y, int W, int H, const char *L = 0);
-
- /**
- Gets the index of the last item chosen by the user.
- The index is zero initially.
- */
- int value() const {return Fl_Menu_::value();}
-
- int value(int v);
-
- int value(const Fl_Menu_Item* v);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Choice.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Clock.H b/Libraries/FL/Fl_Clock.H
deleted file mode 100644
index 0b631a8b..00000000
--- a/Libraries/FL/Fl_Clock.H
+++ /dev/null
@@ -1,137 +0,0 @@
-//
-// "$Id: Fl_Clock.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Clock header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Clock, Fl_Clock_Output widgets . */
-
-#ifndef Fl_Clock_H
-#define Fl_Clock_H
-
-#ifndef Fl_Widget_H
-#include "Fl_Widget.H"
-#endif
-
-// values for type:
-#define FL_SQUARE_CLOCK 0 /**< type() of Square Clock variant */
-#define FL_ROUND_CLOCK 1 /**< type() of Round Clock variant */
-#define FL_ANALOG_CLOCK FL_SQUARE_CLOCK /**< An analog clock is square */
-#define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK /**< Not yet implemented */
-
-// fabien: Please keep the horizontal formatting of both images in class desc,
-// don't lose vert. space for nothing!
-
-/**
- \class Fl_Clock_Output
- \brief This widget can be used to display a program-supplied time.
-
- The time shown on the clock is not updated. To display the current time,
- use Fl_Clock instead.
-
- \htmlonly <BR> <table align=CENTER border=1 cellpadding=5 >
- <caption align=bottom>type() FL_SQUARE_CLOCK and FL_ROUND_CLOCK </caption> <TR><TD> \endhtmlonly
- \image html clock.png
- \htmlonly </TD> <TD> \endhtmlonly
- \image html round_clock.png
- \htmlonly </TD> </TR> </table> \endhtmlonly
- \image latex clock.png "FL_SQUARE_CLOCK type" width=4cm
- \image latex round_clock.png "FL_ROUND_CLOCK type" width=4cm
- */
-class FL_EXPORT Fl_Clock_Output : public Fl_Widget {
- int hour_, minute_, second_;
- ulong value_;
- void drawhands(Fl_Color,Fl_Color); // part of draw
-protected:
- void draw();
- void draw(int X, int Y, int W, int H);
-public:
-
- Fl_Clock_Output(int X, int Y, int W, int H, const char *L = 0);
-
- void value(ulong v); // set to this Unix time
-
- void value(int H, int m, int s);
-
- /**
- Returns the displayed time.
- Returns the time in seconds since the UNIX epoch (January 1, 1970).
- \see value(ulong)
- */
- ulong value() const {return value_;}
-
- /**
- Returns the displayed hour (0 to 23).
- \see value(), minute(), second()
- */
- int hour() const {return hour_;}
-
- /**
- Returns the displayed minute (0 to 59).
- \see value(), hour(), second()
- */
- int minute() const {return minute_;}
-
- /**
- Returns the displayed second (0 to 60, 60=leap second).
- \see value(), hour(), minute()
- */
- int second() const {return second_;}
-};
-
-// a Fl_Clock displays the current time always by using a timeout:
-
-/**
- \class Fl_Clock
- \brief This widget provides a round analog clock display.
-
- Fl_Clock is provided for Forms compatibility.
- It installs a 1-second timeout callback using Fl::add_timeout().
- You can choose the rounded or square type of the clock with type(), see below.
- \htmlonly <BR> <table align=CENTER border=1 cellpadding=5 >
- <caption align=bottom>type() FL_SQUARE_CLOCK and FL_ROUND_CLOCK </caption> <TR><TD> \endhtmlonly
- \image html clock.png
- \htmlonly </TD> <TD> \endhtmlonly
- \image html round_clock.png
- \htmlonly </TD> </TR> </table> \endhtmlonly
- \image latex clock.png "FL_SQUARE_CLOCK type" width=4cm
- \image latex round_clock.png "FL_ROUND_CLOCK type" width=4cm
- */
-class FL_EXPORT Fl_Clock : public Fl_Clock_Output {
-public:
- int handle(int);
-
- Fl_Clock(int X, int Y, int W, int H, const char *L = 0);
-
- Fl_Clock(uchar t, int X, int Y, int W, int H, const char *L);
-
- ~Fl_Clock();
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Clock.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Color_Chooser.H b/Libraries/FL/Fl_Color_Chooser.H
deleted file mode 100644
index 180ee002..00000000
--- a/Libraries/FL/Fl_Color_Chooser.H
+++ /dev/null
@@ -1,199 +0,0 @@
-//
-// "$Id: Fl_Color_Chooser.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Color chooser header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/** \file
- Fl_Color_Chooser widget . */
-
-// The color chooser object and the color chooser popup. The popup
-// is just a window containing a single color chooser and some boxes
-// to indicate the current and cancelled color.
-
-#ifndef Fl_Color_Chooser_H
-#define Fl_Color_Chooser_H
-
-#include <FL/Fl_Group.H>
-#include <FL/Fl_Box.H>
-#include <FL/Fl_Return_Button.H>
-#include <FL/Fl_Choice.H>
-#include <FL/Fl_Value_Input.H>
-
-#ifndef FL_DOXYGEN
-
-/** For internal use only */
-class FL_EXPORT Flcc_HueBox : public Fl_Widget {
- int px, py;
-protected:
- void draw();
- int handle_key(int);
-public:
- int handle(int);
- Flcc_HueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
- px = py = 0;}
-};
-
-/** For internal use only */
-class FL_EXPORT Flcc_ValueBox : public Fl_Widget {
- int py;
-protected:
- void draw();
- int handle_key(int);
-public:
- int handle(int);
- Flcc_ValueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
- py = 0;}
-};
-
-/** For internal use only */
-class FL_EXPORT Flcc_Value_Input : public Fl_Value_Input {
-public:
- int format(char*);
- Flcc_Value_Input(int X, int Y, int W, int H) : Fl_Value_Input(X,Y,W,H) {}
-};
-
-#endif // !FL_DOXYGEN
-
-/** \addtogroup group_comdlg
- @{ */
-
-/**
- \class Fl_Color_Chooser
- \brief The Fl_Color_Chooser widget provides a standard RGB color chooser.
-
- \image html fl_color_chooser.jpg
- \image latex fl_color_chooser.jpg "fl_color_chooser()" width=5cm
-
- You can place any number of the widgets into a panel of your own design.
- The diagram shows the widget as part of a color chooser dialog created by
- the fl_color_chooser() function. The Fl_Color_Chooser widget contains the
- hue box, value slider, and rgb input fields from the above diagram (it
- does not have the color chips or the Cancel or OK buttons).
- The callback is done every time the user changes the rgb value. It is not
- done if they move the hue control in a way that produces the \e same rgb
- value, such as when saturation or value is zero.
-
- The fl_color_chooser() function pops up a window to let the user pick an
- arbitrary RGB color. They can pick the hue and saturation in the "hue box"
- on the left (hold down CTRL to just change the saturation), and the
- brightness using the vertical slider. Or they can type the 8-bit numbers
- into the RGB Fl_Value_Input fields, or drag the mouse across them to adjust
- them. The pull-down menu lets the user set the input fields to show RGB,
- HSV, or 8-bit RGB (0 to 255).
-
- fl_color_chooser() returns non-zero if the user picks ok, and updates the
- RGB values. If the user picks cancel or closes the window this returns
- zero and leaves RGB unchanged.
-
- If you use the color chooser on an 8-bit screen, it will allocate all the
- available colors, leaving you no space to exactly represent the color the
- user picks! You can however use fl_rectf() to fill a region with a simulated
- color using dithering.
- */
-/** @} */
-class FL_EXPORT Fl_Color_Chooser : public Fl_Group {
- Flcc_HueBox huebox;
- Flcc_ValueBox valuebox;
- Fl_Choice choice;
- Flcc_Value_Input rvalue;
- Flcc_Value_Input gvalue;
- Flcc_Value_Input bvalue;
- Fl_Box resize_box;
- double hue_, saturation_, value_;
- double r_, g_, b_;
- void set_valuators();
- static void rgb_cb(Fl_Widget*, void*);
- static void mode_cb(Fl_Widget*, void*);
-public:
-
- /**
- Returns which Fl_Color_Chooser variant is currently active
- \return color modes are rgb(0), byte(1), hex(2), or hsv(3)
- */
- int mode() {return choice.value();}
-
- /**
- Set which Fl_Color_Chooser variant is currently active
- \param[in] newMode color modes are rgb(0), byte(1), hex(2), or hsv(3)
- */
- void mode(int newMode);
-
- /**
- Returns the current hue.
- 0 <= hue < 6. Zero is red, one is yellow, two is green, etc.
- <em>This value is convenient for the internal calculations - some other
- systems consider hue to run from zero to one, or from 0 to 360.</em>
- */
- double hue() const {return hue_;}
-
- /**
- Returns the saturation.
- 0 <= saturation <= 1.
- */
- double saturation() const {return saturation_;}
-
- /**
- Returns the value/brightness.
- 0 <= value <= 1.
- */
- double value() const {return value_;}
-
- /**
- Returns the current red value.
- 0 <= r <= 1.
- */
- double r() const {return r_;}
-
- /**
- Returns the current green value.
- 0 <= g <= 1.
- */
- double g() const {return g_;}
-
- /**
- Returns the current blue value.
- 0 <= b <= 1.
- */
- double b() const {return b_;}
-
- int hsv(double H, double S, double V);
-
- int rgb(double R, double G, double B);
-
- static void hsv2rgb(double H, double S, double V, double& R, double& G, double& B);
-
- static void rgb2hsv(double R, double G, double B, double& H, double& S, double& V);
-
- Fl_Color_Chooser(int X, int Y, int W, int H, const char *L = 0);
-};
-
-FL_EXPORT int fl_color_chooser(const char* name, double& r, double& g, double& b, int m=-1);
-FL_EXPORT int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b, int m=-1);
-
-#endif
-
-//
-// End of "$Id: Fl_Color_Chooser.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Counter.H b/Libraries/FL/Fl_Counter.H
deleted file mode 100644
index 419715be..00000000
--- a/Libraries/FL/Fl_Counter.H
+++ /dev/null
@@ -1,124 +0,0 @@
-//
-// "$Id: Fl_Counter.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Counter header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Counter widget . */
-
-// A numerical value with up/down step buttons. From Forms.
-
-#ifndef Fl_Counter_H
-#define Fl_Counter_H
-
-#ifndef Fl_Valuator_H
-#include "Fl_Valuator.H"
-#endif
-
-// values for type():
-#define FL_NORMAL_COUNTER 0 /**< type() for counter with fast buttons */
-#define FL_SIMPLE_COUNTER 1 /**< type() for counter without fast buttons */
-
-/**
- Controls a single floating point value with button (or keyboard) arrows.
- Double arrows buttons achieve larger steps than simple arrows.
- \see Fl_Spinner for value input with vertical step arrows.
- <P align=center>\image html counter.png</P>
- \image latex counter.png "Fl_Counter" width=4cm
-
- \todo Refactor the doxygen comments for Fl_Counter type() documentation.
-
- The type of an Fl_Counter object can be set using type(uchar t) to:
- \li \c FL_NORMAL_COUNTER: Displays a counter with 4 arrow buttons.
- \li \c FL_SIMPLE_COUNTER: Displays a counter with only 2 arrow buttons.
-*/
-class FL_EXPORT Fl_Counter : public Fl_Valuator {
-
- Fl_Font textfont_;
- Fl_Fontsize textsize_;
- Fl_Color textcolor_;
- double lstep_;
- uchar mouseobj;
- static void repeat_callback(void *);
- int calc_mouseobj();
- void increment_cb();
-
-protected:
-
- void draw();
-
-public:
-
- int handle(int);
-
- Fl_Counter(int X, int Y, int W, int H, const char* L = 0);
- ~Fl_Counter();
-
- /**
- Sets the increment for the large step buttons.
- The default value is 1.0.
- \param[in] a large step increment.
- */
- void lstep(double a) {lstep_ = a;}
-
- /**
- Sets the increments for the normal and large step buttons.
- \param[in] a, b normal and large step increments.
- */
- void step(double a,double b) {Fl_Valuator::step(a); lstep_ = b;}
-
- /**
- Sets the increment for the normal step buttons.
- \param[in] a normal step increment.
- */
- void step(double a) {Fl_Valuator::step(a);}
-
- /**
- Returns the increment for normal step buttons.
- */
- double step() const {return Fl_Valuator::step();}
-
- /** Gets the text font */
- Fl_Font textfont() const {return textfont_;}
- /** Sets the text font to \p s */
- void textfont(Fl_Font s) {textfont_ = s;}
-
- /** Gets the font size */
- Fl_Fontsize textsize() const {return textsize_;}
- /** Sets the font size to \p s */
- void textsize(Fl_Fontsize s) {textsize_ = s;}
-
- /** Gets the font color */
- Fl_Color textcolor() const {return textcolor_;}
- /** Sets the font color to \p s */
- void textcolor(Fl_Color s) {textcolor_ = s;}
-
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Counter.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Device.H b/Libraries/FL/Fl_Device.H
deleted file mode 100644
index 5b96dc8b..00000000
--- a/Libraries/FL/Fl_Device.H
+++ /dev/null
@@ -1,558 +0,0 @@
-//
-// "$Id: Fl_Device.H 8529 2011-03-23 12:49:30Z AlbrechtS $"
-//
-// Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
-// for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 2010-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-/** \file Fl_Device.H
- \brief declaration of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device,
- Fl_Display_Device, Fl_Device_Plugin.
-*/
-
-#ifndef Fl_Device_H
-#define Fl_Device_H
-
-#include <FL/x.H>
-#include <FL/Fl_Plugin.H>
-#include <FL/Fl_Image.H>
-#include <FL/Fl_Bitmap.H>
-#include <FL/Fl_Pixmap.H>
-#include <FL/Fl_RGB_Image.H>
-
-class Fl_Graphics_Driver;
-class Fl_Font_Descriptor;
-/** \brief Points to the driver that currently receives all graphics requests */
-FL_EXPORT extern Fl_Graphics_Driver *fl_graphics_driver;
-
-/**
- signature of image generation callback function.
- \param[in] data user data passed to function
- \param[in] x,y,w position and width of scan line in image
- \param[out] buf buffer for generated image data. You must copy \p w
- pixels from scanline \p y, starting at pixel \p x
- to this buffer.
- */
-typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf);
-
-// typedef what the x,y fields in a point are:
-#ifdef WIN32
-typedef int COORD_T;
-# define XPOINT XPoint
-#elif defined(__APPLE__)
-typedef float COORD_T;
-typedef struct { float x; float y; } QPoint;
-# define XPOINT QPoint
-extern float fl_quartz_line_width_;
-#else
-typedef short COORD_T;
-# define XPOINT XPoint
-#endif
-
-/**
- \brief All graphical output devices and all graphics systems.
- */
-class FL_EXPORT Fl_Device {
-public:
- /** A string that identifies each subclass of Fl_Device.
- Function class_name() applied to a device of this class returns this string.
- */
- static const char *class_id;
- /**
- Returns the name of the class of this object.
- The class of an instance of an Fl_Device subclass can be checked with code such as:
- \code
- if ( instance->class_name() == Fl_Printer::class_id ) { ... }
- \endcode
- */
- virtual const char *class_name() {return class_id;};
- /**
- Virtual destructor.
-
- The destructor of Fl_Device must be virtual to make the destructors of
- derived classes being called correctly on destruction.
- */
- virtual ~Fl_Device() {};
-};
-
-#define FL_REGION_STACK_SIZE 10
-#define FL_MATRIX_STACK_SIZE 32
-/**
- \brief A virtual class subclassed for each graphics driver FLTK uses.
- *
- The virtual methods of this class are those that a graphics driver should implement to
- support all of FLTK drawing functions.
- <br> The public API for drawing operations is functionally presented in \ref drawing and as function lists
- in the \ref fl_drawings and \ref fl_attributes modules.
- */
-class FL_EXPORT Fl_Graphics_Driver : public Fl_Device {
-public:
- /** A 2D coordinate transformation matrix
- */
- struct matrix {double a, b, c, d, x, y;};
-private:
- static const matrix m0;
- Fl_Font font_; // current font
- Fl_Fontsize size_; // current font size
- Fl_Color color_; // current color
- enum {LINE, LOOP, POLYGON, POINT_};
- int sptr;
- static const int matrix_stack_size = FL_MATRIX_STACK_SIZE;
- matrix stack[FL_MATRIX_STACK_SIZE];
- matrix m;
- int n, p_size, gap_;
- XPOINT *p;
- int what;
- int fl_clip_state_number;
- int rstackptr;
- static const int region_stack_max = FL_REGION_STACK_SIZE - 1;
- Fl_Region rstack[FL_REGION_STACK_SIZE];
-#ifdef WIN32
- int numcount;
- int counts[20];
-#endif
- Fl_Font_Descriptor *font_descriptor_;
- void transformed_vertex0(COORD_T x, COORD_T y);
- void fixloop();
-
-protected:
-/* ** \brief red color for background and/or mixing if device does not support masking or alpha *
- uchar bg_r_;
- ** \brief green color for background and/or mixing if device does not support masking or alpha *
- uchar bg_g_;
- ** \brief blue color for background and/or mixing if device does not support masking or alpha *
- uchar bg_b_; */
- friend class Fl_Pixmap;
- friend class Fl_Bitmap;
- friend class Fl_RGB_Image;
- friend void fl_rect(int x, int y, int w, int h);
- friend void fl_rectf(int x, int y, int w, int h);
- friend void fl_line_style(int style, int width, char* dashes);
- friend void fl_xyline(int x, int y, int x1);
- friend void fl_xyline(int x, int y, int x1, int y2);
- friend void fl_xyline(int x, int y, int x1, int y2, int x3);
- friend void fl_yxline(int x, int y, int y1);
- friend void fl_yxline(int x, int y, int y1, int x2);
- friend void fl_yxline(int x, int y, int y1, int x2, int y3);
- friend void fl_line(int x, int y, int x1, int y1);
- friend void fl_line(int x, int y, int x1, int y1, int x2, int y2);
- friend void fl_draw(const char *str, int n, int x, int y);
-#ifdef __APPLE__
- friend void fl_draw(const char *str, int n, float x, float y);
-#endif
- friend void fl_draw(int angle, const char *str, int n, int x, int y);
- friend void fl_rtl_draw(const char *str, int n, int x, int y);
- friend void fl_font(Fl_Font face, Fl_Fontsize size);
- friend void fl_color(Fl_Color c);
- friend void fl_color(uchar r, uchar g, uchar b);
- friend void fl_point(int x, int y);
- friend void fl_loop(int x0, int y0, int x1, int y1, int x2, int y2);
- friend void fl_loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
- friend void fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2);
- friend void fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
- friend void fl_begin_points();
- friend void fl_begin_line();
- friend void fl_begin_loop();
- friend void fl_begin_polygon();
- friend void fl_vertex(double x, double y);
- friend void fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3);
- friend void fl_circle(double x, double y, double r);
- friend void fl_arc(double x, double y, double r, double start, double end);
- friend void fl_arc(int x, int y, int w, int h, double a1, double a2);
- friend void fl_pie(int x, int y, int w, int h, double a1, double a2);
- friend void fl_end_points();
- friend void fl_end_line();
- friend void fl_end_loop();
- friend void fl_end_polygon();
- friend void fl_transformed_vertex(double xf, double yf);
- friend void fl_push_clip(int x, int y, int w, int h);
- friend int fl_clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
- friend int fl_not_clipped(int x, int y, int w, int h);
- friend void fl_push_no_clip();
- friend void fl_pop_clip();
- friend void fl_begin_complex_polygon();
- friend void fl_gap();
- friend void fl_end_complex_polygon();
- friend void fl_push_matrix();
- friend void fl_pop_matrix();
- friend void fl_mult_matrix(double a, double b, double c, double d, double x, double y);
- friend void fl_scale(double x, double y);
- friend void fl_scale(double x);
- friend void fl_translate(double x, double y);
- friend void fl_rotate(double d);
- friend double fl_transform_x(double x, double y);
- friend double fl_transform_y(double x, double y);
- friend double fl_transform_dx(double x, double y);
- friend double fl_transform_dy(double x, double y);
- friend Fl_Region fl_clip_region();
- friend void fl_clip_region(Fl_Region r);
- friend void fl_restore_clip();
-
- friend void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L);
- friend void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L);
- friend void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D);
- friend FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D);
- friend FL_EXPORT void gl_start();
-
- matrix *fl_matrix; /**< Points to the current coordinate transformation matrix */
-
- /** \brief The constructor. */
- Fl_Graphics_Driver();
- /** \brief see fl_rect(int x, int y, int w, int h). */
- virtual void rect(int x, int y, int w, int h);
- /** \brief see fl_rectf(int x, int y, int w, int h). */
- virtual void rectf(int x, int y, int w, int h);
- /** \brief see fl_line_style(int style, int width, char* dashes). */
- virtual void line_style(int style, int width=0, char* dashes=0);
- /** \brief see fl_xyline(int x, int y, int x1). */
- virtual void xyline(int x, int y, int x1);
- /** \brief see fl_xyline(int x, int y, int x1, int y2). */
- virtual void xyline(int x, int y, int x1, int y2);
- /** \brief see fl_xyline(int x, int y, int x1, int y2, int x3). */
- virtual void xyline(int x, int y, int x1, int y2, int x3);
- /** \brief see fl_yxline(int x, int y, int y1). */
- virtual void yxline(int x, int y, int y1);
- /** \brief see fl_yxline(int x, int y, int y1, int x2). */
- virtual void yxline(int x, int y, int y1, int x2);
- /** \brief see fl_yxline(int x, int y, int y1, int x2, int y3). */
- virtual void yxline(int x, int y, int y1, int x2, int y3);
- /** \brief see fl_line(int x, int y, int x1, int y1). */
- virtual void line(int x, int y, int x1, int y1);
- /** \brief see fl_line(int x, int y, int x1, int y1, int x2, int y2). */
- virtual void line(int x, int y, int x1, int y1, int x2, int y2);
- /** \brief see fl_draw(const char *str, int n, int x, int y). */
- virtual void draw(const char *str, int n, int x, int y) = 0;
-#ifdef __APPLE__
- virtual void draw(const char *str, int n, float x, float y) = 0;
-#endif
- /** \brief see fl_draw(int angle, const char *str, int n, int x, int y). */
- virtual void draw(int angle, const char *str, int n, int x, int y) = 0;
- /** \brief see fl_rtl_draw(const char *str, int n, int x, int y). */
- virtual void rtl_draw(const char *str, int n, int x, int y) = 0;
- /** \brief see fl_color(Fl_Color c). */
- virtual void color(Fl_Color c) {color_ = c;}
- /** \brief see fl_color(uchar r, uchar g, uchar b). */
- virtual void color(uchar r, uchar g, uchar b) = 0;
- /** \brief see fl_point(int x, int y). */
- virtual void point(int x, int y);
- /** \brief see fl_loop(int x0, int y0, int x1, int y1, int x2, int y2). */
- virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2);
- /** \brief see fl_loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3). */
- virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
- /** \brief see fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2). */
- virtual void polygon(int x0, int y0, int x1, int y1, int x2, int y2);
- /** \brief see fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3). */
- virtual void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
- /** \brief see fl_begin_points(). */
- virtual void begin_points();
- /** \brief see fl_begin_line(). */
- virtual void begin_line();
- /** \brief see fl_begin_loop(). */
- virtual void begin_loop();
- /** \brief see fl_begin_polygon(). */
- virtual void begin_polygon();
- /** \brief see fl_vertex(double x, double y). */
- virtual void vertex(double x, double y);
- /** \brief see fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3). */
- virtual void curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3);
- /** \brief see fl_circle(double x, double y, double r). */
- virtual void circle(double x, double y, double r);
- /** \brief see fl_arc(double x, double y, double r, double start, double end). */
- virtual void arc(double x, double y, double r, double start, double end);
- /** \brief see fl_arc(int x, int y, int w, int h, double a1, double a2). */
- virtual void arc(int x, int y, int w, int h, double a1, double a2);
- /** \brief see fl_pie(int x, int y, int w, int h, double a1, double a2). */
- virtual void pie(int x, int y, int w, int h, double a1, double a2);
- /** \brief see fl_end_points(). */
- virtual void end_points();
- /** \brief see fl_end_line(). */
- virtual void end_line();
- /** \brief see fl_end_loop(). */
- virtual void end_loop();
- /** \brief see fl_end_polygon(). */
- virtual void end_polygon();
- /** \brief see fl_begin_complex_polygon(). */
- virtual void begin_complex_polygon();
- /** \brief see fl_gap(). */
- virtual void gap();
- /** \brief see fl_end_complex_polygon(). */
- virtual void end_complex_polygon();
- /** \brief see fl_transformed_vertex(double xf, double yf). */
- virtual void transformed_vertex(double xf, double yf);
- /** \brief see fl_push_clip(int x, int y, int w, int h). */
- virtual void push_clip(int x, int y, int w, int h);
- /** \brief see fl_clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H). */
- virtual int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
- /** \brief see fl_not_clipped(int x, int y, int w, int h). */
- virtual int not_clipped(int x, int y, int w, int h);
- /** \brief see fl_push_no_clip(). */
- virtual void push_no_clip();
- /** \brief see fl_pop_clip(). */
- virtual void pop_clip();
-
- /** \brief see fl_push_matrix(). */
- void push_matrix();
- /** \brief see fl_pop_matrix(). */
- void pop_matrix();
- /** \brief see fl_mult_matrix(double a, double b, double c, double d, double x, double y). */
- void mult_matrix(double a, double b, double c, double d, double x, double y);
- /** \brief see fl_scale(double x, double y). */
- inline void scale(double x, double y) { mult_matrix(x,0,0,y,0,0); }
- /** \brief see fl_scale(double x). */
- inline void scale(double x) { mult_matrix(x,0,0,x,0,0); }
- /** \brief see fl_translate(double x, double y). */
- inline void translate(double x,double y) { mult_matrix(1,0,0,1,x,y); }
- /** \brief see fl_rotate(double d). */
- void rotate(double d);
- /** \brief see fl_transform_x(double x, double y). */
- double transform_x(double x, double y);
- /** \brief see fl_transform_y(double x, double y). */
- double transform_y(double x, double y);
- /** \brief see fl_transform_dx(double x, double y). */
- double transform_dx(double x, double y);
- /** \brief see fl_transform_dy(double x, double y). */
- double transform_dy(double x, double y);
- /** \brief see fl_clip_region(). */
- Fl_Region clip_region();
- /** \brief see fl_clip_region(Fl_Region r). */
- void clip_region(Fl_Region r);
- /** \brief see fl_restore_clip(). */
- void restore_clip();
-
- // Images
- /** \brief see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L). */
- virtual void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0) = 0;
- /** \brief see fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L). */
- virtual void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0) = 0;
- /** \brief see fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D). */
- virtual void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3) = 0;
- /** \brief see fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D). */
- virtual void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1) = 0;
- // Image classes
- /** \brief Draws an Fl_RGB_Image object to the device.
- *
- Specifies a bounding box for the image, with the origin (upper left-hand corner) of
- the image offset by the cx and cy arguments.
- */
- virtual void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy) = 0;
- /** \brief Draws an Fl_Pixmap object to the device.
- *
- Specifies a bounding box for the image, with the origin (upper left-hand corner) of
- the image offset by the cx and cy arguments.
- */
- virtual void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy) = 0;
- /** \brief Draws an Fl_Bitmap object to the device.
- *
- Specifies a bounding box for the image, with the origin (upper left-hand corner) of
- the image offset by the cx and cy arguments.
- */
- virtual void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) = 0;
-
-public:
- static const char *class_id;
- virtual const char *class_name() {return class_id;};
- /** \brief see fl_font(Fl_Font face, Fl_Fontsize size). */
- virtual void font(Fl_Font face, Fl_Fontsize size) {font_ = face; size_ = size;}
- /** \brief see fl_font(void). */
- Fl_Font font() {return font_; }
- /** \brief see fl_size(). */
- Fl_Fontsize size() {return size_; }
- /** \brief see fl_width(const char *str, int n). */
- virtual double width(const char *str, int n) = 0;
- /** \brief see fl_width(unsigned int n). */
- virtual inline double width(unsigned int c) { char ch = (char)c; return width(&ch, 1); }
- /** \brief see fl_text_extents(const char*, int n, int& dx, int& dy, int& w, int& h). */
- virtual void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
- /** \brief see fl_height(). */
- virtual int height() = 0;
- /** \brief see fl_descent(). */
- virtual int descent() = 0;
- /** \brief see fl_color(void). */
- Fl_Color color() {return color_;}
- /** Returns a pointer to the current Fl_Font_Descriptor for the graphics driver */
- inline Fl_Font_Descriptor *font_descriptor() { return font_descriptor_;}
- /** Sets the current Fl_Font_Descriptor for the graphics driver */
- inline void font_descriptor(Fl_Font_Descriptor *d) { font_descriptor_ = d;}
- /** \brief The destructor */
- virtual ~Fl_Graphics_Driver() {};
-};
-
-#if defined(__APPLE__) || defined(FL_DOXYGEN)
-/**
- \brief The Mac OS X-specific graphics class.
- *
- This class is implemented only on the Mac OS X platform.
- */
-class FL_EXPORT Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver {
-public:
- static const char *class_id;
- const char *class_name() {return class_id;};
- void color(Fl_Color c);
- void color(uchar r, uchar g, uchar b);
- void draw(const char* str, int n, int x, int y);
-#ifdef __APPLE__
- void draw(const char *str, int n, float x, float y);
-#endif
- void draw(int angle, const char *str, int n, int x, int y);
- void rtl_draw(const char* str, int n, int x, int y);
- void font(Fl_Font face, Fl_Fontsize size);
- void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
- void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
- void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
- void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
- double width(const char *str, int n);
- double width(unsigned int c);
- void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
- int height();
- int descent();
-};
-#endif
-#if defined(WIN32) || defined(FL_DOXYGEN)
-/**
- \brief The MSWindows-specific graphics class.
- *
- This class is implemented only on the MSWindows platform.
- */
-class FL_EXPORT Fl_GDI_Graphics_Driver : public Fl_Graphics_Driver {
-public:
- static const char *class_id;
- const char *class_name() {return class_id;};
- void color(Fl_Color c);
- void color(uchar r, uchar g, uchar b);
- void draw(const char* str, int n, int x, int y);
- void draw(int angle, const char *str, int n, int x, int y);
- void rtl_draw(const char* str, int n, int x, int y);
- void font(Fl_Font face, Fl_Fontsize size);
- void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
- void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
- void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
- void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
- double width(const char *str, int n);
- double width(unsigned int c);
- void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
- int height();
- int descent();
-};
-#endif
-#if !(defined(__APPLE__) || defined(WIN32))
-/**
- \brief The Xlib-specific graphics class.
- *
- This class is implemented only on the Xlib platform.
- */
-class Fl_Xlib_Graphics_Driver : public Fl_Graphics_Driver {
-public:
- static const char *class_id;
- const char *class_name() {return class_id;};
- void color(Fl_Color c);
- void color(uchar r, uchar g, uchar b);
- void draw(const char* str, int n, int x, int y);
- void draw(int angle, const char *str, int n, int x, int y);
- void rtl_draw(const char* str, int n, int x, int y);
- void font(Fl_Font face, Fl_Fontsize size);
- void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
- void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
- void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
- void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
- void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
- double width(const char *str, int n);
- double width(unsigned int c);
- void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
- int height();
- int descent();
-};
-#endif
-
-/**
- \brief A surface that's susceptible to receive graphical output.
- */
-class FL_EXPORT Fl_Surface_Device : public Fl_Device {
- /** \brief The graphics driver in use by this surface. */
- Fl_Graphics_Driver *_driver;
- static Fl_Surface_Device *_surface; // the surface that currently receives graphics output
-protected:
- /** \brief Constructor that sets the graphics driver to use for the created surface. */
- Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver) {_driver = graphics_driver; };
-public:
- static const char *class_id;
- const char *class_name() {return class_id;};
- virtual void set_current(void);
- /** \brief Sets the graphics driver of this drawing surface. */
- inline void driver(Fl_Graphics_Driver *graphics_driver) {_driver = graphics_driver;};
- /** \brief Returns the graphics driver of this drawing surface. */
- inline Fl_Graphics_Driver *driver() {return _driver; };
- /** \brief the surface that currently receives graphics output */
- static inline Fl_Surface_Device *surface() {return _surface; };
- /** \brief The destructor. */
- virtual ~Fl_Surface_Device() {}
-};
-
-/**
- \brief A display to which the computer can draw.
- */
-class FL_EXPORT Fl_Display_Device : public Fl_Surface_Device {
- static Fl_Display_Device *_display; // the platform display device
-public:
- static const char *class_id;
- const char *class_name() {return class_id;};
- /** \brief A constructor that sets the graphics driver used by the display */
- Fl_Display_Device(Fl_Graphics_Driver *graphics_driver);
- /** Returns the platform display device. */
- static inline Fl_Display_Device *display_device() {return _display;};
-};
-
-/**
- This plugin socket allows the integration of new device drivers for special
- window or screen types. It is currently used to provide an automated printing
- service for OpenGL windows, if linked with fltk_gl.
- */
-class FL_EXPORT Fl_Device_Plugin : public Fl_Plugin {
-public:
- /** \brief The constructor */
- Fl_Device_Plugin(const char *name)
- : Fl_Plugin(klass(), name) { }
- /** \brief Returns the class name */
- virtual const char *klass() { return "fltk:device"; }
- /** \brief Returns the plugin name */
- virtual const char *name() = 0;
- /** \brief Prints a widget
- \param w the widget
- \param x,y offsets where to print relatively to coordinates origin
- \param height height of the current drawing area
- */
- virtual int print(Fl_Widget* w, int x, int y, int height) = 0;
-};
-
-#endif // Fl_Device_H
-
-//
-// End of "$Id: Fl_Device.H 8529 2011-03-23 12:49:30Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Dial.H b/Libraries/FL/Fl_Dial.H
deleted file mode 100644
index 96de59fc..00000000
--- a/Libraries/FL/Fl_Dial.H
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-// "$Id: Fl_Dial.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Dial header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Dial widget . */
-
-#ifndef Fl_Dial_H
-#define Fl_Dial_H
-
-#ifndef Fl_Valuator_H
-#include "Fl_Valuator.H"
-#endif
-
-// values for type():
-#define FL_NORMAL_DIAL 0 /**< type() for dial variant with dot */
-#define FL_LINE_DIAL 1 /**< type() for dial variant with line */
-#define FL_FILL_DIAL 2 /**< type() for dial variant with filled arc */
-
-/**
- The Fl_Dial widget provides a circular dial to control a
- single floating point value.
- <P ALIGN=CENTER>\image html dial.png
- \image latex dial.png "Fl_Dial" width=4cm
- Use type() to set the type of the dial to:
- <UL>
- <LI>FL_NORMAL_DIAL - Draws a normal dial with a knob. </LI>
- <LI>FL_LINE_DIAL - Draws a dial with a line. </LI>
- <LI>FL_FILL_DIAL - Draws a dial with a filled arc. </LI>
- </UL>
-
-*/
-class FL_EXPORT Fl_Dial : public Fl_Valuator {
-
- short a1,a2;
-
-protected:
-
- // these allow subclasses to put the dial in a smaller area:
- void draw(int X, int Y, int W, int H);
- int handle(int event, int X, int Y, int W, int H);
- void draw();
-
-public:
-
- int handle(int);
- /**
- Creates a new Fl_Dial widget using the given position, size,
- and label string. The default type is FL_NORMAL_DIAL.
- */
- Fl_Dial(int x,int y,int w,int h, const char *l = 0);
- /**
- Sets Or gets the angles used for the minimum and maximum values. The default
- values are 45 and 315 (0 degrees is straight down and the angles
- progress clockwise). Normally angle1 is less than angle2, but if you
- reverse them the dial moves counter-clockwise.
- */
- short angle1() const {return a1;}
- /** See short angle1() const */
- void angle1(short a) {a1 = a;}
- /** See short angle1() const */
- short angle2() const {return a2;}
- /** See short angle1() const */
- void angle2(short a) {a2 = a;}
- /** See short angle1() const */
- void angles(short a, short b) {a1 = a; a2 = b;}
-
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Dial.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Double_Window.H b/Libraries/FL/Fl_Double_Window.H
deleted file mode 100644
index 20ab25b3..00000000
--- a/Libraries/FL/Fl_Double_Window.H
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// "$Id: Fl_Double_Window.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Double-buffered window header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Double_Window widget . */
-
-#ifndef Fl_Double_Window_H
-#define Fl_Double_Window_H
-
-#include "Fl_Window.H"
-
-/**
- The Fl_Double_Window provides a double-buffered window.
- If possible this will use the X double buffering extension (Xdbe). If
- not, it will draw the window data into an off-screen pixmap, and then
- copy it to the on-screen window.
- <P>It is highly recommended that you put the following code before the
- first show() of <I>any</I> window in your program: </P>
- \code
- Fl::visual(FL_DOUBLE|FL_INDEX)
- \endcode
- This makes sure you can use Xdbe on servers where double buffering
- does not exist for every visual.
-*/
-class FL_EXPORT Fl_Double_Window : public Fl_Window {
-protected:
- void flush(int eraseoverlay);
- /**
- Force double buffering, even if the OS already buffers windows
- (overlays need that on MacOS and Windows2000)
- */
- char force_doublebuffering_;
-public:
- void show();
- void show(int a, char **b) {Fl_Window::show(a,b);}
- void flush();
- void resize(int,int,int,int);
- void hide();
- ~Fl_Double_Window();
- /**
- Creates a new Fl_Double_Window widget using the given
- position, size, and label (title) string.
- */
- Fl_Double_Window(int W, int H, const char *l = 0)
- : Fl_Window(W,H,l), force_doublebuffering_(0) { type(FL_DOUBLE_WINDOW); }
- /**
- See Fl_Double_Window::Fl_Double_Window(int w, int h, const char *label = 0)
- */
- Fl_Double_Window(int X, int Y, int W, int H, const char *l = 0)
- : Fl_Window(X,Y,W,H,l), force_doublebuffering_(0) { type(FL_DOUBLE_WINDOW); }
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Double_Window.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Export.H b/Libraries/FL/Fl_Export.H
deleted file mode 100644
index 875a2789..00000000
--- a/Libraries/FL/Fl_Export.H
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * "$Id: Fl_Export.H 7903 2010-11-28 21:06:39Z matt $"
- *
- * WIN32 DLL export .
- *
- * Copyright 1998-2010 by Bill Spitzak and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- * Please report all bugs and problems on the following page:
- *
- * http://www.fltk.org/str.php
- */
-
-#ifndef Fl_Export_H
-# define Fl_Export_H
-
-/*
- * The following is only used when building DLLs under WIN32...
- */
-
-# if defined(FL_DLL)
-# ifdef FL_LIBRARY
-# define FL_EXPORT __declspec(dllexport)
-# else
-# define FL_EXPORT __declspec(dllimport)
-# endif /* FL_LIBRARY */
-# else
-# define FL_EXPORT
-# endif /* FL_DLL */
-
-#endif /* !Fl_Export_H */
-
-/*
- * End of "$Id: Fl_Export.H 7903 2010-11-28 21:06:39Z matt $".
- */
diff --git a/Libraries/FL/Fl_File_Browser.H b/Libraries/FL/Fl_File_Browser.H
deleted file mode 100644
index cc7fc96f..00000000
--- a/Libraries/FL/Fl_File_Browser.H
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// "$Id: Fl_File_Browser.H 8306 2011-01-24 17:04:22Z matt $"
-//
-// FileBrowser definitions.
-//
-// Copyright 1999-2010 by Michael Sweet.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_File_Browser widget . */
-
-//
-// Include necessary header files...
-//
-
-#ifndef _Fl_File_Browser_H_
-# define _Fl_File_Browser_H_
-
-# include "Fl_Browser.H"
-# include "Fl_File_Icon.H"
-# include "filename.H"
-
-
-//
-// Fl_File_Browser class...
-//
-
-/** The Fl_File_Browser widget displays a list of filenames, optionally with file-specific icons. */
-class FL_EXPORT Fl_File_Browser : public Fl_Browser {
-
- int filetype_;
- const char *directory_;
- uchar iconsize_;
- const char *pattern_;
-
- int full_height() const;
- int item_height(void *) const;
- int item_width(void *) const;
- void item_draw(void *, int, int, int, int) const;
- int incr_height() const { return (item_height(0)); }
-
-public:
- enum { FILES, DIRECTORIES };
-
- /**
- The constructor creates the Fl_File_Browser widget at the specified position and size.
- The destructor destroys the widget and frees all memory that has been allocated.
- */
- Fl_File_Browser(int, int, int, int, const char * = 0);
-
- /** Sets or gets the size of the icons. The default size is 20 pixels. */
- uchar iconsize() const { return (iconsize_); };
- /** Sets or gets the size of the icons. The default size is 20 pixels. */
- void iconsize(uchar s) { iconsize_ = s; redraw(); };
-
- /**
- Sets or gets the filename filter. The pattern matching uses
- the fl_filename_match()
- function in FLTK.
- */
- void filter(const char *pattern);
- /**
- Sets or gets the filename filter. The pattern matching uses
- the fl_filename_match()
- function in FLTK.
- */
- const char *filter() const { return (pattern_); };
-
- /**
- Loads the specified directory into the browser. If icons have been
- loaded then the correct icon is associated with each file in the list.
-
- <P>The sort argument specifies a sort function to be used with
- fl_filename_list().
- */
- int load(const char *directory, Fl_File_Sort_F *sort = fl_numericsort);
-
- Fl_Fontsize textsize() const { return Fl_Browser::textsize(); };
- void textsize(Fl_Fontsize s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); };
-
- /**
- Sets or gets the file browser type, FILES or
- DIRECTORIES. When set to FILES, both
- files and directories are shown. Otherwise only directories are
- shown.
- */
- int filetype() const { return (filetype_); };
- /**
- Sets or gets the file browser type, FILES or
- DIRECTORIES. When set to FILES, both
- files and directories are shown. Otherwise only directories are
- shown.
- */
- void filetype(int t) { filetype_ = t; };
-};
-
-#endif // !_Fl_File_Browser_H_
-
-//
-// End of "$Id: Fl_File_Browser.H 8306 2011-01-24 17:04:22Z matt $".
-//
diff --git a/Libraries/FL/Fl_File_Chooser.H b/Libraries/FL/Fl_File_Chooser.H
deleted file mode 100644
index 3816621c..00000000
--- a/Libraries/FL/Fl_File_Chooser.H
+++ /dev/null
@@ -1,247 +0,0 @@
-//
-// "$Id: Fl_File_Chooser.H 8786 2011-06-07 11:41:36Z manolo $"
-//
-// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-// generated by Fast Light User Interface Designer (fluid) version 1.0300
-
-#ifndef Fl_File_Chooser_H
-#define Fl_File_Chooser_H
-#include <FL/Fl.H>
-#include <FL/Fl_Double_Window.H>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <FL/Fl_Group.H>
-#include <FL/Fl_Choice.H>
-#include <FL/Fl_Menu_Button.H>
-#include <FL/Fl_Button.H>
-#include <FL/Fl_Preferences.H>
-#include <FL/Fl_Tile.H>
-#include <FL/Fl_File_Browser.H>
-#include <FL/Fl_Box.H>
-#include <FL/Fl_Check_Button.H>
-#include <FL/Fl_File_Input.H>
-#include <FL/Fl_Return_Button.H>
-#include <FL/fl_ask.H>
-
-class FL_EXPORT Fl_File_Chooser {
-public:
- enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };
-private:
- static Fl_Preferences prefs_;
- void (*callback_)(Fl_File_Chooser*, void *);
- void *data_;
- char directory_[FL_PATH_MAX];
- char pattern_[FL_PATH_MAX];
- char preview_text_[2048];
- int type_;
- void favoritesButtonCB();
- void favoritesCB(Fl_Widget *w);
- void fileListCB();
- void fileNameCB();
- void newdir();
- static void previewCB(Fl_File_Chooser *fc);
- void showChoiceCB();
- void update_favorites();
- void update_preview();
-public:
- Fl_File_Chooser(const char *d, const char *p, int t, const char *title);
-private:
- Fl_Double_Window *window;
- void cb_window_i(Fl_Double_Window*, void*);
- static void cb_window(Fl_Double_Window*, void*);
- Fl_Choice *showChoice;
- void cb_showChoice_i(Fl_Choice*, void*);
- static void cb_showChoice(Fl_Choice*, void*);
- Fl_Menu_Button *favoritesButton;
- void cb_favoritesButton_i(Fl_Menu_Button*, void*);
- static void cb_favoritesButton(Fl_Menu_Button*, void*);
-public:
- Fl_Button *newButton;
-private:
- void cb_newButton_i(Fl_Button*, void*);
- static void cb_newButton(Fl_Button*, void*);
- void cb__i(Fl_Tile*, void*);
- static void cb_(Fl_Tile*, void*);
- Fl_File_Browser *fileList;
- void cb_fileList_i(Fl_File_Browser*, void*);
- static void cb_fileList(Fl_File_Browser*, void*);
- Fl_Box *previewBox;
-public:
- Fl_Check_Button *previewButton;
-private:
- void cb_previewButton_i(Fl_Check_Button*, void*);
- static void cb_previewButton(Fl_Check_Button*, void*);
-public:
- Fl_Check_Button *showHiddenButton;
-private:
- void cb_showHiddenButton_i(Fl_Check_Button*, void*);
- static void cb_showHiddenButton(Fl_Check_Button*, void*);
- Fl_File_Input *fileName;
- void cb_fileName_i(Fl_File_Input*, void*);
- static void cb_fileName(Fl_File_Input*, void*);
- Fl_Return_Button *okButton;
- void cb_okButton_i(Fl_Return_Button*, void*);
- static void cb_okButton(Fl_Return_Button*, void*);
- Fl_Button *cancelButton;
- void cb_cancelButton_i(Fl_Button*, void*);
- static void cb_cancelButton(Fl_Button*, void*);
- Fl_Double_Window *favWindow;
- Fl_File_Browser *favList;
- void cb_favList_i(Fl_File_Browser*, void*);
- static void cb_favList(Fl_File_Browser*, void*);
- Fl_Button *favUpButton;
- void cb_favUpButton_i(Fl_Button*, void*);
- static void cb_favUpButton(Fl_Button*, void*);
- Fl_Button *favDeleteButton;
- void cb_favDeleteButton_i(Fl_Button*, void*);
- static void cb_favDeleteButton(Fl_Button*, void*);
- Fl_Button *favDownButton;
- void cb_favDownButton_i(Fl_Button*, void*);
- static void cb_favDownButton(Fl_Button*, void*);
- Fl_Button *favCancelButton;
- void cb_favCancelButton_i(Fl_Button*, void*);
- static void cb_favCancelButton(Fl_Button*, void*);
- Fl_Return_Button *favOkButton;
- void cb_favOkButton_i(Fl_Return_Button*, void*);
- static void cb_favOkButton(Fl_Return_Button*, void*);
-public:
- ~Fl_File_Chooser();
- void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0);
- void color(Fl_Color c);
- Fl_Color color();
- int count();
- void directory(const char *d);
- char * directory();
- void filter(const char *p);
- const char * filter();
- int filter_value();
- void filter_value(int f);
- void hide();
- void iconsize(uchar s);
- uchar iconsize();
- void label(const char *l);
- const char * label();
- void ok_label(const char *l);
- const char * ok_label();
- void preview(int e);
- int preview() const { return previewButton->value(); };
-private:
- void showHidden(int e);
- void remove_hidden_files();
-public:
- void rescan();
- void rescan_keep_filename();
- void show();
- int shown();
- void textcolor(Fl_Color c);
- Fl_Color textcolor();
- void textfont(Fl_Font f);
- Fl_Font textfont();
- void textsize(Fl_Fontsize s);
- Fl_Fontsize textsize();
- void type(int t);
- int type();
- void * user_data() const;
- void user_data(void *d);
- const char *value(int f = 1);
- void value(const char *filename);
- int visible();
- /**
- [standard text may be customized at run-time]
- */
- static const char *add_favorites_label;
- /**
- [standard text may be customized at run-time]
- */
- static const char *all_files_label;
- /**
- [standard text may be customized at run-time]
- */
- static const char *custom_filter_label;
- /**
- [standard text may be customized at run-time]
- */
- static const char *existing_file_label;
- /**
- [standard text may be customized at run-time]
- */
- static const char *favorites_label;
- /**
- [standard text may be customized at run-time]
- */
- static const char *filename_label;
- /**
- [standard text may be customized at run-time]
- */
- static const char *filesystems_label;
- /**
- [standard text may be customized at run-time]
- */
- static const char *manage_favorites_label;
- /**
- [standard text may be customized at run-time]
- */
- static const char *new_directory_label;
- /**
- [standard text may be customized at run-time]
- */
- static const char *new_directory_tooltip;
- /**
- [standard text may be customized at run-time]
- */
- static const char *preview_label;
- /**
- [standard text may be customized at run-time]
- */
- static const char *save_label;
- /**
- [standard text may be customized at run-time]
- */
- static const char *show_label;
- /**
- [standard text may be customized at run-time]
- */
- static const char *hidden_label;
- /**
- the sort function that is used when loading
- the contents of a directory.
- */
- static Fl_File_Sort_F *sort;
-private:
- Fl_Widget* ext_group;
-public:
- Fl_Widget* add_extra(Fl_Widget* gr);
-};
-FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);
-FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);
-FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));
-FL_EXPORT void fl_file_chooser_ok_label(const char*l);
-#endif
-
-//
-// End of "$Id: Fl_File_Chooser.H 8786 2011-06-07 11:41:36Z manolo $".
-//
diff --git a/Libraries/FL/Fl_File_Icon.H b/Libraries/FL/Fl_File_Icon.H
deleted file mode 100644
index 7e67f027..00000000
--- a/Libraries/FL/Fl_File_Icon.H
+++ /dev/null
@@ -1,168 +0,0 @@
-//
-// "$Id: Fl_File_Icon.H 8306 2011-01-24 17:04:22Z matt $"
-//
-// Fl_File_Icon definitions.
-//
-// Copyright 1999-2010 by Michael Sweet.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_File_Icon widget . */
-
-//
-// Include necessary header files...
-//
-
-#ifndef _Fl_Fl_File_Icon_H_
-# define _Fl_Fl_File_Icon_H_
-
-# include "Fl.H"
-
-
-//
-// Special color value for the icon color.
-//
-
-# define FL_ICON_COLOR (Fl_Color)0xffffffff /**< icon color [background?]*/
-
-
-//
-// Fl_File_Icon class...
-//
-
-/**
- The Fl_File_Icon class manages icon images that can be used
- as labels in other widgets and as icons in the FileBrowser widget.
-*/
-class FL_EXPORT Fl_File_Icon { //// Icon data
-
- static Fl_File_Icon *first_; // Pointer to first icon/filetype
- Fl_File_Icon *next_; // Pointer to next icon/filetype
- const char *pattern_; // Pattern string
- int type_; // Match only if directory or file?
- int num_data_; // Number of data elements
- int alloc_data_; // Number of allocated elements
- short *data_; // Icon data
-
- public:
-
- enum // File types
- {
- ANY, // Any kind of file
- PLAIN, // Only plain files
- FIFO, // Only named pipes
- DEVICE, // Only character and block devices
- LINK, // Only symbolic links
- DIRECTORY // Only directories
- };
-
- enum // Data opcodes
- {
- END, // End of primitive/icon
- COLOR, // Followed by color value (2 shorts)
- LINE, // Start of line
- CLOSEDLINE, // Start of closed line
- POLYGON, // Start of polygon
- OUTLINEPOLYGON, // Followed by outline color (2 shorts)
- VERTEX // Followed by scaled X,Y
- };
-
- Fl_File_Icon(const char *p, int t, int nd = 0, short *d = 0);
- ~Fl_File_Icon();
-
- short *add(short d);
-
- /**
- Adds a color value to the icon array, returning a pointer to it.
- \param[in] c color value
- */
- short *add_color(Fl_Color c)
- { short *d = add((short)COLOR); add((short)(c >> 16)); add((short)c); return (d); }
-
- /**
- Adds a vertex value to the icon array, returning a pointer to it.
- The integer version accepts coordinates from 0 to 10000.
- The origin (0.0) is in the lower-lefthand corner of the icon.
- \param[in] x, y vertex coordinates
- */
- short *add_vertex(int x, int y)
- { short *d = add((short)VERTEX); add((short)x); add((short)y); return (d); }
-
- /**
- Adds a vertex value to the icon array, returning a pointer to it.
- The floating point version goes from 0.0 to 1.0.
- The origin (0.0) is in the lower-lefthand corner of the icon.
- \param[in] x, y vertex coordinates
- */
- short *add_vertex(float x, float y)
- { short *d = add((short)VERTEX); add((short)(x * 10000.0));
- add((short)(y * 10000.0)); return (d); }
-
- /** Clears all icon data from the icon.*/
- void clear() { num_data_ = 0; }
-
- void draw(int x, int y, int w, int h, Fl_Color ic, int active = 1);
-
- void label(Fl_Widget *w);
-
- static void labeltype(const Fl_Label *o, int x, int y, int w, int h, Fl_Align a);
- void load(const char *f);
- int load_fti(const char *fti);
- int load_image(const char *i);
-
- /** Returns next file icon object. See Fl_File_Icon::first() */
- Fl_File_Icon *next() { return (next_); }
-
- /** Returns the filename matching pattern for the icon.*/
- const char *pattern() { return (pattern_); }
-
- /** Returns the number of words of data used by the icon.*/
- int size() { return (num_data_); }
-
- /**
- Returns the filetype associated with the icon, which can be one of the
- following:
-
- \li Fl_File_Icon::ANY, any kind of file.
- \li Fl_File_Icon::PLAIN, plain files.
- \li Fl_File_Icon::FIFO, named pipes.
- \li Fl_File_Icon::DEVICE, character and block devices.
- \li Fl_File_Icon::LINK, symbolic links.
- \li Fl_File_Icon::DIRECTORY, directories.
- */
- int type() { return (type_); }
-
- /** Returns the data array for the icon.*/
- short *value() { return (data_); }
-
- static Fl_File_Icon *find(const char *filename, int filetype = ANY);
-
- /** Returns a pointer to the first icon in the list.*/
- static Fl_File_Icon *first() { return (first_); }
- static void load_system_icons(void);
-};
-
-#endif // !_Fl_Fl_File_Icon_H_
-
-//
-// End of "$Id: Fl_File_Icon.H 8306 2011-01-24 17:04:22Z matt $".
-//
diff --git a/Libraries/FL/Fl_File_Input.H b/Libraries/FL/Fl_File_Input.H
deleted file mode 100644
index e3d27fab..00000000
--- a/Libraries/FL/Fl_File_Input.H
+++ /dev/null
@@ -1,106 +0,0 @@
-//
-// "$Id: Fl_File_Input.H 8712 2011-05-22 09:45:40Z AlbrechtS $"
-//
-// File_Input header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-// Original version Copyright 1998 by Curtis Edwards.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_File_Input widget . */
-
-#ifndef Fl_File_Input_H
-# define Fl_File_Input_H
-
-# include <FL/Fl_Input.H>
-
-/**
- \class Fl_File_Input
- \brief This widget displays a pathname in a text input field.
-
- A navigation bar located above the input field allows the user to
- navigate upward in the directory tree.
- You may want to handle FL_WHEN_CHANGED events for tracking text changes
- and also FL_WHEN_RELEASE for button release when changing to parent dir.
- FL_WHEN_RELEASE callback won't be called if the directory clicked
- is the same as the current one.
-
- <P align=CENTER> \image html Fl_File_Input.png </P>
- \image latex Fl_File_Input.png "Fl_File_Input" width=6cm
-
- \note As all Fl_Input derived objects, Fl_File_Input may call its callback
- when losing focus (see FL_UNFOCUS) to update its state like its cursor shape.
- One resulting side effect is that you should call clear_changed() early in your callback
- to avoid reentrant calls if you plan to show another window or dialog box in the callback.
-*/
-class FL_EXPORT Fl_File_Input : public Fl_Input {
-
- Fl_Color errorcolor_;
- char ok_entry_;
- uchar down_box_;
- short buttons_[200];
- short pressed_;
-
- void draw_buttons();
- int handle_button(int event);
- void update_buttons();
-
-public:
-
- Fl_File_Input(int X, int Y, int W, int H, const char *L=0);
-
- virtual int handle(int event);
-
-protected:
- virtual void draw();
-
-public:
- /** Gets the box type used for the navigation bar. */
- Fl_Boxtype down_box() const { return (Fl_Boxtype)down_box_; }
- /** Sets the box type to use for the navigation bar. */
- void down_box(Fl_Boxtype b) { down_box_ = b; }
-
- /**
- Gets the current error color.
- \todo Better docs for Fl_File_Input::errorcolor() - is it even used?
- */
- Fl_Color errorcolor() const { return errorcolor_; }
- /** Sets the current error color to \p c */
- void errorcolor(Fl_Color c) { errorcolor_ = c; }
-
- int value(const char *str);
- int value(const char *str, int len);
-
- /**
- Returns the current value, which is a pointer to an internal buffer
- and is valid only until the next event is handled.
- */
- const char *value() { return Fl_Input_::value(); }
-};
-
-#endif // !Fl_File_Input_H
-
-
-//
-// End of "$Id: Fl_File_Input.H 8712 2011-05-22 09:45:40Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Fill_Dial.H b/Libraries/FL/Fl_Fill_Dial.H
deleted file mode 100644
index e3b8444c..00000000
--- a/Libraries/FL/Fl_Fill_Dial.H
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// "$Id: Fl_Fill_Dial.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// Filled dial header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Fill_Dial widget . */
-
-#ifndef Fl_Fill_Dial_H
-#define Fl_Fill_Dial_H
-
-#include "Fl_Dial.H"
-
-/** Draws a dial with a filled arc */
-class FL_EXPORT Fl_Fill_Dial : public Fl_Dial {
-public:
- /** Creates a filled dial, also setting its type to FL_FILL_DIAL. */
- Fl_Fill_Dial(int x,int y,int w,int h, const char *l = 0)
- : Fl_Dial(x,y,w,h,l) {type(FL_FILL_DIAL);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Fill_Dial.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Fill_Slider.H b/Libraries/FL/Fl_Fill_Slider.H
deleted file mode 100644
index 05e22b19..00000000
--- a/Libraries/FL/Fl_Fill_Slider.H
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// "$Id: Fl_Fill_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// Filled slider header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Fill_Slider widget . */
-
-#ifndef Fl_Fill_Slider_H
-#define Fl_Fill_Slider_H
-
-#include "Fl_Slider.H"
-/** Widget that draws a filled horizontal slider, useful as a progress or value meter*/
-class FL_EXPORT Fl_Fill_Slider : public Fl_Slider {
-public:
- /** Creates the slider from its position,size and optional title. */
- Fl_Fill_Slider(int x,int y,int w,int h,const char *l=0)
- : Fl_Slider(x,y,w,h,l) {type(FL_VERT_FILL_SLIDER);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Fill_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Float_Input.H b/Libraries/FL/Fl_Float_Input.H
deleted file mode 100644
index f774dd37..00000000
--- a/Libraries/FL/Fl_Float_Input.H
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// "$Id: Fl_Float_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
-//
-// Floating point input header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Float_Input widget . */
-
-
-#ifndef Fl_Float_Input_H
-#define Fl_Float_Input_H
-
-#include "Fl_Input.H"
-
-/**
- The Fl_Float_Input class is a subclass of Fl_Input
- that only allows the user to type floating point numbers (sign,
- digits, decimal point, more digits, 'E' or 'e', sign, digits).
-*/
-class FL_EXPORT Fl_Float_Input : public Fl_Input {
-public:
- /**
- Creates a new Fl_Float_Input widget using the given position,
- size, and label string. The default boxtype is FL_DOWN_BOX.
-
- Inherited destructor destroys the widget and any value associated with it.
- */
-#if defined(FL_DLL) // implementation in src/Fl_Input.cxx
- Fl_Float_Input(int X,int Y,int W,int H,const char *l = 0);
-#else
- Fl_Float_Input(int X,int Y,int W,int H,const char *l = 0)
- : Fl_Input(X,Y,W,H,l) {type(FL_FLOAT_INPUT);}
-#endif
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Float_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_FormsBitmap.H b/Libraries/FL/Fl_FormsBitmap.H
deleted file mode 100644
index 55582629..00000000
--- a/Libraries/FL/Fl_FormsBitmap.H
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// "$Id: Fl_FormsBitmap.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Forms bitmap header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_FormsBitmap widget . */
-
-#ifndef Fl_FormsBitmap_H
-#define Fl_FormsBitmap_H
-
-#include "Fl_Bitmap.H"
-
-/**
- Forms compatibility Bitmap Image Widget
-*/
-class FL_EXPORT Fl_FormsBitmap : public Fl_Widget {
- Fl_Bitmap *b;
-protected:
- void draw();
-public:
- Fl_FormsBitmap(Fl_Boxtype, int, int, int, int, const char * = 0);
- void set(int W, int H, const uchar *bits);
- /** Sets a new bitmap. */
- void bitmap(Fl_Bitmap *B) {b = B;}
- /** Gets a the current associated Fl_Bitmap objects. */
- Fl_Bitmap *bitmap() const {return b;}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_FormsBitmap.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_FormsPixmap.H b/Libraries/FL/Fl_FormsPixmap.H
deleted file mode 100644
index 1eb01dee..00000000
--- a/Libraries/FL/Fl_FormsPixmap.H
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// "$Id: Fl_FormsPixmap.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Forms pixmap header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_FormsPixmap widget . */
-
-#ifndef Fl_FormsPixmap_H
-#define Fl_FormsPixmap_H
-
-#include "Fl_Pixmap.H"
-
-/**
- \class Fl_FormsPixmap
- \brief Forms pixmap drawing routines
-*/
-class FL_EXPORT Fl_FormsPixmap : public Fl_Widget {
- Fl_Pixmap *b;
-protected:
- void draw();
-public:
- Fl_FormsPixmap(Fl_Boxtype t, int X, int Y, int W, int H, const char *L= 0);
-
- void set(/*const*/char * const * bits);
-
- /**
- Set the internal pixmap pointer to an existing pixmap.
- \param[in] B existing pixmap
- */
- void Pixmap(Fl_Pixmap *B) {b = B;}
-
- /** Get the internal pixmap pointer. */
- Fl_Pixmap *Pixmap() const {return b;}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_FormsPixmap.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Free.H b/Libraries/FL/Fl_Free.H
deleted file mode 100644
index 367443ca..00000000
--- a/Libraries/FL/Fl_Free.H
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// "$Id: Fl_Free.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Forms free header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Free widget . */
-
-#ifndef Fl_Free_H
-#define Fl_Free_H
-
-#ifndef Fl_Widget_H
-#include "Fl_Widget.H"
-#endif
-
-#define FL_NORMAL_FREE 1 /**< normal event handling */
-#define FL_SLEEPING_FREE 2 /**< deactivate event handling */
-#define FL_INPUT_FREE 3 /**< accepts FL_FOCUS events */
-#define FL_CONTINUOUS_FREE 4 /**< repeated timeout handling */
-#define FL_ALL_FREE 5 /**< FL_INPUT_FREE and FL_CONTINOUS_FREE */
-
-/** appropriate signature for handle function */
-typedef int (*FL_HANDLEPTR)(Fl_Widget *, int , float, float, char);
-
-/**
- Emulation of the Forms "free" widget.
-
- This emulation allows the free demo to run, and appears to be useful for
- porting programs written in Forms which use the free widget or make
- subclasses of the Forms widgets.
-
- There are five types of free, which determine when the handle function
- is called:
-
- \li \c FL_NORMAL_FREE normal event handling.
- \li \c FL_SLEEPING_FREE deactivates event handling (widget is inactive).
- \li \c FL_INPUT_FREE accepts FL_FOCUS events.
- \li \c FL_CONTINUOUS_FREE sets a timeout callback 100 times a second and
- provides an FL_STEP event. This has obvious
- detrimental effects on machine performance.
- \li \c FL_ALL_FREE same as FL_INPUT_FREE and FL_CONTINUOUS_FREE.
-
-*/
-class FL_EXPORT Fl_Free : public Fl_Widget {
- FL_HANDLEPTR hfunc;
- static void step(void *);
-protected:
- void draw();
-public:
- int handle(int e);
- Fl_Free(uchar t,int X,int Y,int W,int H,const char *L,FL_HANDLEPTR hdl);
- ~Fl_Free();
-};
-
-// old event names for compatibility:
-#define FL_MOUSE FL_DRAG /**< for backward compatibility */
-#define FL_DRAW 100 /**< for backward compatibility [UNUSED]*/
-#define FL_STEP 101 /**< for backward compatibility */
-#define FL_FREEMEM 102 /**< for backward compatibility [UNUSED]*/
-#define FL_FREEZE 103 /**< for backward compatibility [UNUSED]*/
-#define FL_THAW 104 /**< for backward compatibility [UNUSED]*/
-
-#endif
-
-//
-// End of "$Id: Fl_Free.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_GIF_Image.H b/Libraries/FL/Fl_GIF_Image.H
deleted file mode 100644
index 69f055b0..00000000
--- a/Libraries/FL/Fl_GIF_Image.H
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// "$Id: Fl_GIF_Image.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// GIF image header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_GIF_Image widget . */
-
-#ifndef Fl_GIF_Image_H
-#define Fl_GIF_Image_H
-# include "Fl_Pixmap.H"
-
-/**
- The Fl_GIF_Image class supports loading, caching,
- and drawing of Compuserve GIF<SUP>SM</SUP> images. The class
- loads the first image and supports transparency.
-*/
-class FL_EXPORT Fl_GIF_Image : public Fl_Pixmap {
-
- public:
-
- Fl_GIF_Image(const char* filename);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_GIF_Image.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Gl_Window.H b/Libraries/FL/Fl_Gl_Window.H
deleted file mode 100644
index 02c5eb8f..00000000
--- a/Libraries/FL/Fl_Gl_Window.H
+++ /dev/null
@@ -1,240 +0,0 @@
-//
-// "$Id: Fl_Gl_Window.H 8157 2011-01-01 14:01:53Z AlbrechtS $"
-//
-// OpenGL header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Gl_Window widget . */
-
-#ifndef Fl_Gl_Window_H
-#define Fl_Gl_Window_H
-
-#include "Fl_Window.H"
-
-#ifndef GLContext
-/**
- Opaque pointer type to hide system specific implementation.
-*/
-typedef void* GLContext; // actually a GLXContext or HGLDC
-#endif
-
-class Fl_Gl_Choice; // structure to hold result of glXChooseVisual
-
-/**
- The Fl_Gl_Window widget sets things up so OpenGL works.
-
- It also keeps an OpenGL "context" for that window, so that changes to the
- lighting and projection may be reused between redraws. Fl_Gl_Window
- also flushes the OpenGL streams and swaps buffers after draw() returns.
-
- OpenGL hardware typically provides some overlay bit planes, which
- are very useful for drawing UI controls atop your 3D graphics. If the
- overlay hardware is not provided, FLTK tries to simulate the overlay.
- This works pretty well if your graphics are double buffered, but not
- very well for single-buffered.
-
- Please note that the FLTK drawing and clipping functions
- will not work inside an Fl_Gl_Window. All drawing
- should be done using OpenGL calls exclusively.
- Even though Fl_Gl_Window is derived from Fl_Group,
- it is not useful to add other FLTK Widgets as children,
- unless those widgets are modified to draw using OpenGL calls.
-*/
-class FL_EXPORT Fl_Gl_Window : public Fl_Window {
-
- int mode_;
- const int *alist;
- Fl_Gl_Choice *g;
- GLContext context_;
- char valid_f_;
- char damage1_; // damage() of back buffer
- virtual void draw_overlay();
- void init();
-
- void *overlay;
- void make_overlay();
- friend class _Fl_Gl_Overlay;
-
- static int can_do(int, const int *);
- int mode(int, const int *);
-
-public:
-
- void show();
- void show(int a, char **b) {Fl_Window::show(a,b);}
- void flush();
- void hide();
- void resize(int,int,int,int);
- int handle(int);
-
- /**
- Is turned off when FLTK creates a new context for this window or
- when the window resizes, and is turned on \e after draw() is called.
- You can use this inside your draw() method to avoid unnecessarily
- initializing the OpenGL context. Just do this:
- \code
- void mywindow::draw() {
- if (!valid()) {
- glViewport(0,0,w(),h());
- glFrustum(...);
- ...other initialization...
- }
- if (!context_valid()) {
- ...load textures, etc. ...
- }
- ... draw your geometry here ...
- }
- \endcode
-
- You can turn valid() on by calling valid(1). You
- should only do this after fixing the transformation inside a draw()
- or after make_current(). This is done automatically after
- draw() returns.
- */
- char valid() const {return valid_f_ & 1;}
- /**
- See char Fl_Gl_Window::valid() const
- */
- void valid(char v) {if (v) valid_f_ |= 1; else valid_f_ &= 0xfe;}
- void invalidate();
-
- /**
- Will only be set if the
- OpenGL context is created or recreated. It differs from
- Fl_Gl_Window::valid() which is also set whenever the context
- changes size.
- */
- char context_valid() const {return valid_f_ & 2;}
- /**
- See char Fl_Gl_Window::context_valid() const
- */
- void context_valid(char v) {if (v) valid_f_ |= 2; else valid_f_ &= 0xfd;}
-
- /** Returns non-zero if the hardware supports the given or current OpenGL mode. */
- static int can_do(int m) {return can_do(m,0);}
- /** Returns non-zero if the hardware supports the given or current OpenGL mode. */
- static int can_do(const int *m) {return can_do(0, m);}
- /** Returns non-zero if the hardware supports the given or current OpenGL mode. */
- int can_do() {return can_do(mode_,alist);}
- /**
- Set or change the OpenGL capabilites of the window. The value can be
- any of the following OR'd together:
-
- - \c FL_RGB - RGB color (not indexed)
- - \c FL_RGB8 - RGB color with at least 8 bits of each color
- - \c FL_INDEX - Indexed mode
- - \c FL_SINGLE - not double buffered
- - \c FL_DOUBLE - double buffered
- - \c FL_ACCUM - accumulation buffer
- - \c FL_ALPHA - alpha channel in color
- - \c FL_DEPTH - depth buffer
- - \c FL_STENCIL - stencil buffer
- - \c FL_MULTISAMPLE - multisample antialiasing
-
- FL_RGB and FL_SINGLE have a value of zero, so they
- are "on" unless you give FL_INDEX or FL_DOUBLE.
-
- If the desired combination cannot be done, FLTK will try turning off
- FL_MULTISAMPLE. If this also fails the show() will call
- Fl::error() and not show the window.
-
- You can change the mode while the window is displayed. This is most
- useful for turning double-buffering on and off. Under X this will
- cause the old X window to be destroyed and a new one to be created. If
- this is a top-level window this will unfortunately also cause the
- window to blink, raise to the top, and be de-iconized, and the xid()
- will change, possibly breaking other code. It is best to make the GL
- window a child of another window if you wish to do this!
-
- mode() must not be called within draw() since it
- changes the current context.
- */
- Fl_Mode mode() const {return (Fl_Mode)mode_;}
- /** See Fl_Mode mode() const */
- int mode(int a) {return mode(a,0);}
- /** See Fl_Mode mode() const */
- int mode(const int *a) {return mode(0, a);}
- /** void See void context(void* v, int destroy_flag) */
- void* context() const {return context_;}
- void context(void*, int destroy_flag = 0);
- void make_current();
- void swap_buffers();
- void ortho();
-
- /**
- Returns true if the hardware overlay is possible. If this is false,
- FLTK will try to simulate the overlay, with significant loss of update
- speed. Calling this will cause FLTK to open the display.
- */
- int can_do_overlay();
- /**
- This method causes draw_overlay() to be called at a later time.
- Initially the overlay is clear. If you want the window to display
- something in the overlay when it first appears, you must call this
- immediately after you show() your window.
- */
- void redraw_overlay();
- void hide_overlay();
- /**
- The make_overlay_current() method selects the OpenGL context
- for the widget's overlay. It is called automatically prior to the
- draw_overlay() method being called and can also be used to
- implement feedback and/or selection within the handle()
- method.
- */
- void make_overlay_current();
-
- // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
- virtual Fl_Gl_Window* as_gl_window() {return this;}
-
- ~Fl_Gl_Window();
- /**
- Creates a new Fl_Gl_Window widget using the given size, and label string.
- The default boxtype is FL_NO_BOX. The default mode is FL_RGB|FL_DOUBLE|FL_DEPTH.
- */
- Fl_Gl_Window(int W, int H, const char *l=0) : Fl_Window(W,H,l) {init();}
- /**
- Creates a new Fl_Gl_Window widget using the given position,
- size, and label string. The default boxtype is FL_NO_BOX. The
- default mode is FL_RGB|FL_DOUBLE|FL_DEPTH.
- */
-
- Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0)
- : Fl_Window(X,Y,W,H,l) {init();}
-
-protected:
- /**
- Draws the Fl_Gl_Window.
-
- You \e \b must override the draw() method.
- */
- virtual void draw();
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Gl_Window.H 8157 2011-01-01 14:01:53Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Group.H b/Libraries/FL/Fl_Group.H
deleted file mode 100644
index 0056e103..00000000
--- a/Libraries/FL/Fl_Group.H
+++ /dev/null
@@ -1,230 +0,0 @@
-//
-// "$Id: Fl_Group.H 8157 2011-01-01 14:01:53Z AlbrechtS $"
-//
-// Group header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Group, Fl_End classes . */
-
-#ifndef Fl_Group_H
-#define Fl_Group_H
-
-#ifndef Fl_Widget_H
-#include "Fl_Widget.H"
-#endif
-
-/**
- The Fl_Group class is the FLTK container widget. It maintains
- an array of child widgets. These children can themselves be any widget
- including Fl_Group. The most important subclass of Fl_Group
- is Fl_Window, however groups can also be used to control radio buttons
- or to enforce resize behavior.
-*/
-class FL_EXPORT Fl_Group : public Fl_Widget {
-
- Fl_Widget** array_;
- Fl_Widget* savedfocus_;
- Fl_Widget* resizable_;
- int children_;
- int *sizes_; // remembered initial sizes of children
-
- int navigation(int);
- static Fl_Group *current_;
-
- // unimplemented copy ctor and assignment operator
- Fl_Group(const Fl_Group&);
- Fl_Group& operator=(const Fl_Group&);
-
-protected:
- void draw();
- void draw_child(Fl_Widget& widget) const;
- void draw_children();
- void draw_outside_label(const Fl_Widget& widget) const ;
- void update_child(Fl_Widget& widget) const;
- int *sizes();
-
-public:
-
- int handle(int);
- void begin();
- void end();
- static Fl_Group *current();
- static void current(Fl_Group *g);
-
- /**
- Returns how many child widgets the group has.
- */
- int children() const {return children_;}
- /**
- Returns array()[n]. <i>No range checking is done!</i>
- */
- Fl_Widget* child(int n) const {return array()[n];}
- int find(const Fl_Widget*) const;
- /**
- See int Fl_Group::find(const Fl_Widget *w) const
- */
- int find(const Fl_Widget& o) const {return find(&o);}
- Fl_Widget* const* array() const;
-
- void resize(int,int,int,int);
- /**
- Creates a new Fl_Group widget using the given position, size,
- and label string. The default boxtype is FL_NO_BOX.
- */
- Fl_Group(int,int,int,int, const char * = 0);
- virtual ~Fl_Group();
- void add(Fl_Widget&);
- /**
- See void Fl_Group::add(Fl_Widget &w)
- */
- void add(Fl_Widget* o) {add(*o);}
- void insert(Fl_Widget&, int i);
- /**
- This does insert(w, find(before)). This will append the
- widget if \p before is not in the group.
- */
- void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));}
- void remove(int index);
- void remove(Fl_Widget&);
- /**
- Removes the widget \p o from the group.
- \sa void remove(Fl_Widget&)
- */
- void remove(Fl_Widget* o) {remove(*o);}
- void clear();
-
- /**
- See void Fl_Group::resizable(Fl_Widget *box)
- */
- void resizable(Fl_Widget& o) {resizable_ = &o;}
- /**
- The resizable widget defines the resizing box for the group. When the
- group is resized it calculates a new size and position for all of its
- children. Widgets that are horizontally or vertically inside the
- dimensions of the box are scaled to the new size. Widgets outside the
- box are moved.
-
- In these examples the gray area is the resizable:
-
- \image html resizebox1.png
-
- \image html resizebox2.png
-
- \image latex resizebox1.png "before resize" width=4cm
-
- \image latex resizebox2.png "after resize" width=4cm
-
- The resizable may be set to the group itself, in which case all the
- contents are resized. This is the default value for Fl_Group,
- although NULL is the default for Fl_Window and Fl_Pack.
-
- If the resizable is NULL then all widgets remain a fixed size
- and distance from the top-left corner.
-
- It is possible to achieve any type of resize behavior by using an
- invisible Fl_Box as the resizable and/or by using a hierarchy
- of child Fl_Group's.
- */
- void resizable(Fl_Widget* o) {resizable_ = o;}
- /**
- See void Fl_Group::resizable(Fl_Widget *box)
- */
- Fl_Widget* resizable() const {return resizable_;}
- /**
- Adds a widget to the group and makes it the resizable widget.
- */
- void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);}
- void init_sizes();
-
- /**
- Controls whether the group widget clips the drawing of
- child widgets to its bounding box.
-
- Set \p c to 1 if you want to clip the child widgets to the
- bounding box.
-
- The default is to not clip (0) the drawing of child widgets.
- */
- void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else clear_flag(CLIP_CHILDREN); }
- /**
- Returns the current clipping mode.
-
- \return true, if clipping is enabled, false otherwise.
-
- \see void Fl_Group::clip_children(int c)
- */
- unsigned int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }
-
- // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
- virtual Fl_Group* as_group() { return this; }
-
- // back compatibility functions:
-
- /**
- \deprecated This is for backwards compatibility only. You should use
- \e W->%take_focus() instead.
- \sa Fl_Widget::take_focus();
- */
- void focus(Fl_Widget* W) {W->take_focus();}
-
- /** This is for forms compatibility only */
- Fl_Widget* & _ddfdesign_kludge() {return resizable_;}
-
- /** This is for forms compatibility only */
- void forms_end();
-};
-
-// dummy class used to end child groups in constructors for complex
-// subclasses of Fl_Group:
-/**
- This is a dummy class that allows you to end a Fl_Group in a constructor list of a
- class:
- \code
- class MyClass {
- Fl_Group group;
- Fl_Button button_in_group;
- Fl_End end;
- Fl_Button button_outside_group;
- MyClass();
- };
- MyClass::MyClass() :
- group(10,10,100,100),
- button_in_group(20,20,60,30),
- end(),
- button_outside_group(10,120,60,30)
- {}
- \endcode
-*/
-class FL_EXPORT Fl_End {
-public:
- /** All it does is calling Fl_Group::current()->end() */
- Fl_End() {Fl_Group::current()->end();}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Group.H 8157 2011-01-01 14:01:53Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Help_Dialog.H b/Libraries/FL/Fl_Help_Dialog.H
deleted file mode 100644
index 7cb2aef5..00000000
--- a/Libraries/FL/Fl_Help_Dialog.H
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// "$Id: Fl_Help_Dialog.H 8063 2010-12-19 21:20:10Z matt $"
-//
-// Fl_Help_Dialog dialog for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Help_Dialog widget . */
-
-// generated by Fast Light User Interface Designer (fluid) version 1.0108
-
-#ifndef Fl_Help_Dialog_H
-#define Fl_Help_Dialog_H
-#include <FL/Fl.H>
-#include <FL/Fl_Double_Window.H>
-#include <FL/Fl_Group.H>
-#include <FL/Fl_Button.H>
-#include <FL/Fl_Input.H>
-#include <FL/Fl_Box.H>
-#include <FL/Fl_Help_View.H>
-
-class FL_EXPORT Fl_Help_Dialog {
- int index_;
- int max_;
- int line_[100]; // FIXME: we must remove those static numbers
- char file_[100][FL_PATH_MAX]; // FIXME: we must remove those static numbers
- int find_pos_;
-public:
- Fl_Help_Dialog();
-private:
- Fl_Double_Window *window_;
- Fl_Button *back_;
- void cb_back__i(Fl_Button*, void*);
- static void cb_back_(Fl_Button*, void*);
- Fl_Button *forward_;
- void cb_forward__i(Fl_Button*, void*);
- static void cb_forward_(Fl_Button*, void*);
- Fl_Button *smaller_;
- void cb_smaller__i(Fl_Button*, void*);
- static void cb_smaller_(Fl_Button*, void*);
- Fl_Button *larger_;
- void cb_larger__i(Fl_Button*, void*);
- static void cb_larger_(Fl_Button*, void*);
- Fl_Input *find_;
- void cb_find__i(Fl_Input*, void*);
- static void cb_find_(Fl_Input*, void*);
- Fl_Help_View *view_;
- void cb_view__i(Fl_Help_View*, void*);
- static void cb_view_(Fl_Help_View*, void*);
-public:
- ~Fl_Help_Dialog();
- int h();
- void hide();
- void load(const char *f);
- void position(int xx, int yy);
- void resize(int xx, int yy, int ww, int hh);
- void show();
- void show(int argc, char **argv);
- void textsize(Fl_Fontsize s);
- Fl_Fontsize textsize();
- void topline(const char *n);
- void topline(int n);
- void value(const char *f);
- const char * value() const;
- int visible();
- int w();
- int x();
- int y();
-};
-#endif
-
-//
-// End of "$Id: Fl_Help_Dialog.H 8063 2010-12-19 21:20:10Z matt $".
-//
diff --git a/Libraries/FL/Fl_Help_View.H b/Libraries/FL/Fl_Help_View.H
deleted file mode 100644
index c0ee66db..00000000
--- a/Libraries/FL/Fl_Help_View.H
+++ /dev/null
@@ -1,396 +0,0 @@
-//
-// "$Id: Fl_Help_View.H 8306 2011-01-24 17:04:22Z matt $"
-//
-// Help Viewer widget definitions.
-//
-// Copyright 1997-2010 by Easy Software Products.
-// Image support by Matthias Melcher, Copyright 2000-2009.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Help_View widget . */
-
-#ifndef Fl_Help_View_H
-# define Fl_Help_View_H
-
-//
-// Include necessary header files...
-//
-
-# include <stdio.h>
-# include "Fl.H"
-# include "Fl_Group.H"
-# include "Fl_Scrollbar.H"
-# include "fl_draw.H"
-# include "Fl_Shared_Image.H"
-# include "filename.H"
-
-
-//
-// Fl_Help_Func type - link callback function for files...
-//
-
-
-typedef const char *(Fl_Help_Func)(Fl_Widget *, const char *);
-
-
-//
-// Fl_Help_Block structure...
-//
-
-struct Fl_Help_Block {
- const char *start, // Start of text
- *end; // End of text
- uchar border; // Draw border?
- Fl_Color bgcolor; // Background color
- int x, // Indentation/starting X coordinate
- y, // Starting Y coordinate
- w, // Width
- h; // Height
- int line[32]; // Left starting position for each line
-};
-
-//
-// Fl_Help_Link structure...
-//
-/** Definition of a link for the html viewer. */
-struct Fl_Help_Link {
- char filename[192], ///< Reference filename
- name[32]; ///< Link target (blank if none)
- int x, ///< X offset of link text
- y, ///< Y offset of link text
- w, ///< Width of link text
- h; ///< Height of link text
-};
-
-/*
- * Fl_Help_View font stack opaque implementation
- */
-
-/** Fl_Help_View font stack element definition. */
-struct FL_EXPORT Fl_Help_Font_Style {
- Fl_Font f; ///< Font
- Fl_Fontsize s; ///< Font Size
- Fl_Color c; ///< Font Color
- void get(Fl_Font &afont, Fl_Fontsize &asize, Fl_Color &acolor) {afont=f; asize=s; acolor=c;} ///< Gets current font attributes
- void set(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {f=afont; s=asize; c=acolor;} ///< Sets current font attributes
- Fl_Help_Font_Style(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {set(afont, asize, acolor);}
- Fl_Help_Font_Style(){} // For in table use
-};
-
-/** Fl_Help_View font stack definition. */
-const size_t MAX_FL_HELP_FS_ELTS = 100;
-
-struct FL_EXPORT Fl_Help_Font_Stack {
- /** font stack construction, initialize attributes. */
- Fl_Help_Font_Stack() {
- nfonts_ = 0;
- }
-
- void init(Fl_Font f, Fl_Fontsize s, Fl_Color c) {
- nfonts_ = 0;
- elts_[nfonts_].set(f, s, c);
- fl_font(f, s);
- fl_color(c);
- }
- /** Gets the top (current) element on the stack. */
- void top(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) { elts_[nfonts_].get(f, s, c); }
- /** Pushes the font style triplet on the stack, also calls fl_font() & fl_color() adequately */
- void push(Fl_Font f, Fl_Fontsize s, Fl_Color c) {
- if (nfonts_ < MAX_FL_HELP_FS_ELTS-1) nfonts_ ++;
- elts_[nfonts_].set(f, s, c);
- fl_font(f, s); fl_color(c);
- }
- /** Pops from the stack the font style triplet and calls fl_font() & fl_color() adequately */
- void pop(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) {
- if (nfonts_ > 0) nfonts_ --;
- top(f, s, c);
- fl_font(f, s); fl_color(c);
- }
- /** Gets the current count of font style elements in the stack. */
- size_t count() const {return nfonts_;} // Gets the current number of fonts in the stack
-
-protected:
- size_t nfonts_; ///< current number of fonts in stack
- Fl_Help_Font_Style elts_[100]; ///< font elements
-};
-
-/** Fl_Help_Target structure */
-
-struct Fl_Help_Target {
- char name[32]; ///< Target name
- int y; ///< Y offset of target
-};
-
-/**
- The Fl_Help_View widget displays HTML text. Most HTML 2.0
- elements are supported, as well as a primitive implementation of tables.
- GIF, JPEG, and PNG images are displayed inline.
-
- Supported HTML tags:
- - A: HREF/NAME
- - B
- - BODY: BGCOLOR/TEXT/LINK
- - BR
- - CENTER
- - CODE
- - DD
- - DL
- - DT
- - EM
- - FONT: COLOR/SIZE/FACE=(helvetica/arial/sans/times/serif/symbol/courier)
- - H1/H2/H3/H4/H5/H6
- - HEAD
- - HR
- - I
- - IMG: SRC/WIDTH/HEIGHT/ALT
- - KBD
- - LI
- - OL
- - P
- - PRE
- - STRONG
- - TABLE: TH/TD/TR/BORDER/BGCOLOR/COLSPAN/ALIGN=CENTER|RIGHT|LEFT
- - TITLE
- - TT
- - U
- - UL
- - VAR
-
- Supported color names:
- - black,red,green,yellow,blue,magenta,fuchsia,cyan,aqua,white,gray,grey,lime,maroon,navy,olive,purple,silver,teal.
-
- Supported urls:
- - Internal: file:
- - External: http: ftp: https: ipp: mailto: news:
-
- Quoted char names:
- - Aacute aacute Acirc acirc acute AElig aelig Agrave agrave amp Aring aring Atilde atilde Auml auml
- - brvbar bull
- - Ccedil ccedil cedil cent copy curren
- - deg divide
- - Eacute eacute Ecirc ecirc Egrave egrave ETH eth Euml euml euro
- - frac12 frac14 frac34
- - gt
- - Iacute iacute Icirc icirc iexcl Igrave igrave iquest Iuml iuml
- - laquo lt
- - macr micro middot
- - nbsp not Ntilde ntilde
- - Oacute oacute Ocirc ocirc Ograve ograve ordf ordm Oslash oslash Otilde otilde Ouml ouml
- - para premil plusmn pound
- - quot
- - raquo reg
- - sect shy sup1 sup2 sup3 szlig
- - THORN thorn times trade
- - Uacute uacute Ucirc ucirc Ugrave ugrave uml Uuml uuml
- - Yacute yacute
- - yen Yuml yuml
-
-*/
-class FL_EXPORT Fl_Help_View : public Fl_Group { // Help viewer widget
-
- enum { RIGHT = -1, CENTER, LEFT }; ///< Alignments
-
- char title_[1024]; ///< Title string
- Fl_Color defcolor_, ///< Default text color
- bgcolor_, ///< Background color
- textcolor_, ///< Text color
- linkcolor_; ///< Link color
- Fl_Font textfont_; ///< Default font for text
- Fl_Fontsize textsize_; ///< Default font size
- const char *value_; ///< HTML text value
- Fl_Help_Font_Stack fstack_; ///< font stack management
- int nblocks_, ///< Number of blocks/paragraphs
- ablocks_; ///< Allocated blocks
- Fl_Help_Block *blocks_; ///< Blocks
-
- Fl_Help_Func *link_; ///< Link transform function
-
- int nlinks_, ///< Number of links
- alinks_; ///< Allocated links
- Fl_Help_Link *links_; ///< Links
-
- int ntargets_, ///< Number of targets
- atargets_; ///< Allocated targets
- Fl_Help_Target *targets_; ///< Targets
-
- char directory_[FL_PATH_MAX];///< Directory for current file
- char filename_[FL_PATH_MAX]; ///< Current filename
- int topline_, ///< Top line in document
- leftline_, ///< Lefthand position
- size_, ///< Total document length
- hsize_, ///< Maximum document width
- scrollbar_size_; ///< Size for both scrollbars
- Fl_Scrollbar scrollbar_, ///< Vertical scrollbar for document
- hscrollbar_; ///< Horizontal scrollbar
-
- static int selection_first;
- static int selection_last;
- static int selection_push_first;
- static int selection_push_last;
- static int selection_drag_first;
- static int selection_drag_last;
- static int selected;
- static int draw_mode;
- static int mouse_x;
- static int mouse_y;
- static int current_pos;
- static Fl_Help_View *current_view;
- static Fl_Color hv_selection_color;
- static Fl_Color hv_selection_text_color;
-
-
- void initfont(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) { f = textfont_; s = textsize_; c = textcolor_; fstack_.init(f, s, c); }
- void pushfont(Fl_Font f, Fl_Fontsize s) {fstack_.push(f, s, textcolor_);}
- void pushfont(Fl_Font f, Fl_Fontsize s, Fl_Color c) {fstack_.push(f, s, c);}
- void popfont(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) {fstack_.pop(f, s, c);}
-
- Fl_Help_Block *add_block(const char *s, int xx, int yy, int ww, int hh, uchar border = 0);
- void add_link(const char *n, int xx, int yy, int ww, int hh);
- void add_target(const char *n, int yy);
- static int compare_targets(const Fl_Help_Target *t0, const Fl_Help_Target *t1);
- int do_align(Fl_Help_Block *block, int line, int xx, int a, int &l);
- void draw();
- void format();
- void format_table(int *table_width, int *columns, const char *table);
- void free_data();
- int get_align(const char *p, int a);
- const char *get_attr(const char *p, const char *n, char *buf, int bufsize);
- Fl_Color get_color(const char *n, Fl_Color c);
- Fl_Shared_Image *get_image(const char *name, int W, int H);
- int get_length(const char *l);
- int handle(int);
-
- void hv_draw(const char *t, int x, int y);
- char begin_selection();
- char extend_selection();
- void end_selection(int c=0);
- void clear_global_selection();
- Fl_Help_Link *find_link(int, int);
- void follow_link(Fl_Help_Link*);
-
-public:
-
- Fl_Help_View(int xx, int yy, int ww, int hh, const char *l = 0);
- ~Fl_Help_View();
- /** Returns the current directory for the text in the buffer. */
- const char *directory() const { if (directory_[0]) return (directory_);
- else return ((const char *)0); }
- /** Returns the current filename for the text in the buffer. */
- const char *filename() const { if (filename_[0]) return (filename_);
- else return ((const char *)0); }
- int find(const char *s, int p = 0);
- /**
- This method assigns a callback function to use when a link is
- followed or a file is loaded (via Fl_Help_View::load()) that
- requires a different file or path.
-
- The callback function receives a pointer to the Fl_Help_View
- widget and the URI or full pathname for the file in question.
- It must return a pathname that can be opened as a local file or NULL:
-
- \code
- const char *fn(Fl_Widget *w, const char *uri);
- \endcode
-
- The link function can be used to retrieve remote or virtual
- documents, returning a temporary file that contains the actual
- data. If the link function returns NULL, the value of
- the Fl_Help_View widget will remain unchanged.
-
- If the link callback cannot handle the URI scheme, it should
- return the uri value unchanged or set the value() of the widget
- before returning NULL.
- */
- void link(Fl_Help_Func *fn) { link_ = fn; }
- int load(const char *f);
- void resize(int,int,int,int);
- /** Gets the size of the help view. */
- int size() const { return (size_); }
- void size(int W, int H) { Fl_Widget::size(W, H); }
- /** Sets the default text color. */
- void textcolor(Fl_Color c) { if (textcolor_ == defcolor_) textcolor_ = c; defcolor_ = c; }
- /** Returns the current default text color. */
- Fl_Color textcolor() const { return (defcolor_); }
- /** Sets the default text font. */
- void textfont(Fl_Font f) { textfont_ = f; format(); }
- /** Returns the current default text font. */
- Fl_Font textfont() const { return (textfont_); }
- /** Sets the default text size. */
- void textsize(Fl_Fontsize s) { textsize_ = s; format(); }
- /** Gets the default text size. */
- Fl_Fontsize textsize() const { return (textsize_); }
- /** Returns the current document title, or NULL if there is no title. */
- const char *title() { return (title_); }
- void topline(const char *n);
- void topline(int);
- /** Returns the current top line in pixels. */
- int topline() const { return (topline_); }
- void leftline(int);
- /** Gets the left position in pixels. */
- int leftline() const { return (leftline_); }
- void value(const char *val);
- /** Returns the current buffer contents. */
- const char *value() const { return (value_); }
- void clear_selection();
- void select_all();
- /**
- Gets the current size of the scrollbars' troughs, in pixels.
-
- If this value is zero (default), this widget will use the
- Fl::scrollbar_size() value as the scrollbar's width.
-
- \returns Scrollbar size in pixels, or 0 if the global Fl::scrollbar_size() is being used.
- \see Fl::scrollbar_size(int)
- */
- int scrollbar_size() const {
- return(scrollbar_size_);
- }
- /**
- Sets the pixel size of the scrollbars' troughs to the \p size, in pixels.
-
- Normally you should not need this method, and should use
- Fl::scrollbar_size(int) instead to manage the size of ALL
- your widgets' scrollbars. This ensures your application
- has a consistent UI, is the default behavior, and is normally
- what you want.
-
- Only use THIS method if you really need to override the global
- scrollbar size. The need for this should be rare.
-
- Setting \p size to the special value of 0 causes the widget to
- track the global Fl::scrollbar_size(), which is the default.
-
- \param[in] size Sets the scrollbar size in pixels.\n
- If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()
- \see Fl::scrollbar_size()
- */
- void scrollbar_size(int size) {
- scrollbar_size_ = size;
- }
-};
-
-#endif // !Fl_Help_View_H
-
-//
-// End of "$Id: Fl_Help_View.H 8306 2011-01-24 17:04:22Z matt $".
-//
diff --git a/Libraries/FL/Fl_Hold_Browser.H b/Libraries/FL/Fl_Hold_Browser.H
deleted file mode 100644
index 37d05b5a..00000000
--- a/Libraries/FL/Fl_Hold_Browser.H
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// "$Id: Fl_Hold_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $"
-//
-// Hold browser header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Hold_Browser widget . */
-
-#ifndef Fl_Hold_Browser_H
-#define Fl_Hold_Browser_H
-
-#include "Fl_Browser.H"
-
-/**
- The Fl_Hold_Browser is a subclass of Fl_Browser
- which lets the user select a single item, or no items by clicking on
- the empty space. As long as the mouse button is held down the item
- pointed to by it is highlighted, and this highlighting remains on when
- the mouse button is released. Normally the callback is done when the
- user releases the mouse, but you can change this with when().
- <P>See Fl_Browser for methods to add and remove lines from the browser.
-*/
-class FL_EXPORT Fl_Hold_Browser : public Fl_Browser {
-public:
- /**
- Creates a new Fl_Hold_Browser widget using the given
- position, size, and label string. The default boxtype is FL_DOWN_BOX.
- The constructor specializes Fl_Browser() by setting the type to FL_HOLD_BROWSER.
- The destructor destroys the widget and frees all memory that has been allocated.
- */
-#if defined(FL_DLL) // implementation in src/Fl_Browser.cxx
- Fl_Hold_Browser(int X,int Y,int W,int H,const char *L=0);
-#else
- Fl_Hold_Browser(int X,int Y,int W,int H,const char *L=0)
- : Fl_Browser(X,Y,W,H,L) {type(FL_HOLD_BROWSER);}
-#endif
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Hold_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Hor_Fill_Slider.H b/Libraries/FL/Fl_Hor_Fill_Slider.H
deleted file mode 100644
index 3c5a0631..00000000
--- a/Libraries/FL/Fl_Hor_Fill_Slider.H
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// "$Id: Fl_Hor_Fill_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// Horizontal fill slider header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Hor_Fill_Slider widget . */
-
-#ifndef Fl_Hor_Fill_Slider_H
-#define Fl_Hor_Fill_Slider_H
-
-#include "Fl_Slider.H"
-
-class FL_EXPORT Fl_Hor_Fill_Slider : public Fl_Slider {
-public:
- Fl_Hor_Fill_Slider(int x,int y,int w,int h,const char *l=0)
- : Fl_Slider(x,y,w,h,l) {type(FL_HOR_FILL_SLIDER);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Hor_Fill_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Hor_Nice_Slider.H b/Libraries/FL/Fl_Hor_Nice_Slider.H
deleted file mode 100644
index 1305a54e..00000000
--- a/Libraries/FL/Fl_Hor_Nice_Slider.H
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// "$Id: Fl_Hor_Nice_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// Horizontal "nice" slider header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Hor_Nice_Slider widget . */
-
-#ifndef Fl_Hor_Nice_Slider_H
-#define Fl_Hor_Nice_Slider_H
-
-#include "Fl_Slider.H"
-
-class FL_EXPORT Fl_Hor_Nice_Slider : public Fl_Slider {
-public:
- Fl_Hor_Nice_Slider(int x,int y,int w,int h,const char *l=0)
- : Fl_Slider(x,y,w,h,l) {type(FL_HOR_NICE_SLIDER); box(FL_FLAT_BOX);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Hor_Nice_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Hor_Slider.H b/Libraries/FL/Fl_Hor_Slider.H
deleted file mode 100644
index 82a88cbc..00000000
--- a/Libraries/FL/Fl_Hor_Slider.H
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// "$Id: Fl_Hor_Slider.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
-//
-// Horizontal slider header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Hor_Slider widget . */
-
-#ifndef Fl_Hor_Slider_H
-#define Fl_Hor_Slider_H
-
-#include "Fl_Slider.H"
-
-/** Horizontal Slider class.
-
- \see class Fl_Slider.
-*/
-class FL_EXPORT Fl_Hor_Slider : public Fl_Slider {
-public:
-
- /**
- Creates a new Fl_Hor_Slider widget using the given position,
- size, and label string.
- */
-
-#if defined(FL_DLL) // implementation in src/Fl_Slider.cxx
- Fl_Hor_Slider(int X,int Y,int W,int H,const char *l=0);
-#else
- Fl_Hor_Slider(int X,int Y,int W,int H,const char *l=0)
- : Fl_Slider(X,Y,W,H,l) { type(FL_HOR_SLIDER); }
-#endif
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Hor_Slider.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Hor_Value_Slider.H b/Libraries/FL/Fl_Hor_Value_Slider.H
deleted file mode 100644
index 29994484..00000000
--- a/Libraries/FL/Fl_Hor_Value_Slider.H
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// "$Id: Fl_Hor_Value_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// Horizontal value slider header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Hor_Value_Slider widget . */
-
-#ifndef Fl_Hor_Value_Slider_H
-#define Fl_Hor_Value_Slider_H
-
-#include "Fl_Value_Slider.H"
-
-class FL_EXPORT Fl_Hor_Value_Slider : public Fl_Value_Slider {
-public:
- Fl_Hor_Value_Slider(int X,int Y,int W,int H,const char *l=0)
- : Fl_Value_Slider(X,Y,W,H,l) {type(FL_HOR_SLIDER);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Hor_Value_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Image.H b/Libraries/FL/Fl_Image.H
deleted file mode 100644
index eb1e7e3f..00000000
--- a/Libraries/FL/Fl_Image.H
+++ /dev/null
@@ -1,215 +0,0 @@
-//
-// "$Id: Fl_Image.H 8338 2011-01-30 09:24:40Z manolo $"
-//
-// Image header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Image, Fl_RGB_Image classes . */
-
-#ifndef Fl_Image_H
-# define Fl_Image_H
-
-# include "Enumerations.H"
-
-class Fl_Widget;
-struct Fl_Menu_Item;
-struct Fl_Label;
-
-/**
- Fl_Image is the base class used for caching and
- drawing all kinds of images in FLTK. This class keeps track of
- common image data such as the pixels, colormap, width, height,
- and depth. Virtual methods are used to provide type-specific
- image handling.</P>
-
- <P>Since the Fl_Image class does not support image
- drawing by itself, calling the draw() method results in
- a box with an X in it being drawn instead.
-*/
-class FL_EXPORT Fl_Image {
- int w_, h_, d_, ld_, count_;
- const char * const *data_;
-
- // Forbid use of copy contructor and assign operator
- Fl_Image & operator=(const Fl_Image &);
- Fl_Image(const Fl_Image &);
-
- protected:
-
- /**
- Sets the current image width in pixels.
- */
- void w(int W) {w_ = W;}
- /**
- Sets the current image height in pixels.
- */
- void h(int H) {h_ = H;}
- /**
- Sets the current image depth.
- */
- void d(int D) {d_ = D;}
- /**
- Sets the current line data size in bytes.
- */
- void ld(int LD) {ld_ = LD;}
- /**
- Sets the current array pointer and count of pointers in the array.
- */
- void data(const char * const *p, int c) {data_ = p; count_ = c;}
- void draw_empty(int X, int Y);
-
- static void labeltype(const Fl_Label *lo, int lx, int ly, int lw, int lh, Fl_Align la);
- static void measure(const Fl_Label *lo, int &lw, int &lh);
-
- public:
-
- /**
- Returns the current image width in pixels.
- */
- int w() const {return w_;}
- /** Returns the current image height in pixels.
- */
- int h() const {return h_;}
- /**
- Returns the current image depth.
- The return value will be 0 for bitmaps, 1 for
- pixmaps, and 1 to 4 for color images.</P>
- */
- int d() const {return d_;}
- /**
- Returns the current line data size in bytes.
- Line data is extra data that is included
- after each line of color image data and is normally not present.
- */
- int ld() const {return ld_;}
- /**
- The count() method returns the number of data values
- associated with the image. The value will be 0 for images with
- no associated data, 1 for bitmap and color images, and greater
- than 2 for pixmap images.
- */
- int count() const {return count_;}
- /**
- Returns a pointer to the current image data array.
- Use the count() method to find the size of the data array.
- */
- const char * const *data() const {return data_;}
-
- /**
- The constructor creates an empty image with the specified
- width, height, and depth. The width and height are in pixels.
- The depth is 0 for bitmaps, 1 for pixmap (colormap) images, and
- 1 to 4 for color images.
- */
- Fl_Image(int W, int H, int D) {w_ = W; h_ = H; d_ = D; ld_ = 0; count_ = 0; data_ = 0;}
- virtual ~Fl_Image();
- virtual Fl_Image *copy(int W, int H);
- /**
- The copy() method creates a copy of the specified
- image. If the width and height are provided, the image is
- resized to the specified size. The image should be deleted (or in
- the case of Fl_Shared_Image, released) when you are done
- with it.
- */
- Fl_Image *copy() { return copy(w(), h()); }
- virtual void color_average(Fl_Color c, float i);
- /**
- The inactive() method calls
- color_average(FL_BACKGROUND_COLOR, 0.33f) to produce
- an image that appears grayed out. <I>This method does not
- alter the original image data.</I>
- */
- void inactive() { color_average(FL_GRAY, .33f); }
- virtual void desaturate();
- virtual void label(Fl_Widget*w);
- virtual void label(Fl_Menu_Item*m);
- /**
- Draws the image with a bounding box.
- This form specifies
- a bounding box for the image, with the origin
- (upper-lefthand corner) of the image offset by the cx
- and cy arguments.
- */
- virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); // platform dependent
- /**
- Draws the image.
- This form specifies the upper-lefthand corner of the image.
- */
- void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} // platform dependent
- virtual void uncache();
-};
-
-/**
- The Fl_RGB_Image class supports caching and drawing
- of full-color images with 1 to 4 channels of color information.
- Images with an even number of channels are assumed to contain
- alpha information, which is used to blend the image with the
- contents of the screen.</P>
-
- <P>Fl_RGB_Image is defined in
- &lt;FL/Fl_Image.H&gt;, however for compatibility reasons
- &lt;FL/Fl_RGB_Image.H&gt; should be included.
-*/
-class FL_EXPORT Fl_RGB_Image : public Fl_Image {
- friend class Fl_Quartz_Graphics_Driver;
- friend class Fl_GDI_Graphics_Driver;
- friend class Fl_Xlib_Graphics_Driver;
-public:
-
- const uchar *array;
- int alloc_array; // Non-zero if array was allocated
-
- private:
-
-#if defined(__APPLE__) || defined(WIN32)
- void *id_; // for internal use
- void *mask_; // for internal use (mask bitmap)
-#else
- unsigned id_; // for internal use
- unsigned mask_; // for internal use (mask bitmap)
-#endif // __APPLE__ || WIN32
-
- public:
-
-/** The constructor creates a new image from the specified data. */
- Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) :
- Fl_Image(W,H,D), array(bits), alloc_array(0), id_(0), mask_(0) {data((const char **)&array, 1); ld(LD);}
- virtual ~Fl_RGB_Image();
- virtual Fl_Image *copy(int W, int H);
- Fl_Image *copy() { return copy(w(), h()); }
- virtual void color_average(Fl_Color c, float i);
- virtual void desaturate();
- virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
- void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
- virtual void label(Fl_Widget*w);
- virtual void label(Fl_Menu_Item*m);
- virtual void uncache();
-};
-
-#endif // !Fl_Image_H
-
-//
-// End of "$Id: Fl_Image.H 8338 2011-01-30 09:24:40Z manolo $".
-//
diff --git a/Libraries/FL/Fl_Input.H b/Libraries/FL/Fl_Input.H
deleted file mode 100644
index 3f6c49e9..00000000
--- a/Libraries/FL/Fl_Input.H
+++ /dev/null
@@ -1,277 +0,0 @@
-//
-// "$Id: Fl_Input.H 8111 2010-12-23 08:13:18Z manolo $"
-//
-// Input header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Input widget . */
-
-#ifndef Fl_Input_H
-#define Fl_Input_H
-
-#include "Fl_Input_.H"
-
-/**
- This is the FLTK text input widget. It displays a single line
- of text and lets the user edit it. Normally it is drawn with an
- inset box and a white background. The text may contain any
- characters, and will correctly display any UTF text, using
- ^X notation for unprintable control characters. It assumes the
- font can draw any characters of the used scripts, which is true
- for standard fonts under MSWindows and Mac OS X.
- Characters can be input using the keyboard or the character palette/map.
- Character composition is done using dead keys and/or a compose
- key as defined by the operating system.
- <P>
- <TABLE WIDTH=90% BORDER=1 SUMMARY="Fl_Input keyboard and mouse bindings.">
- <CAPTION ALIGN=TOP>Fl_Input keyboard and mouse bindings.</CAPTION>
- <TR><TD NOWRAP="NOWRAP" WIDTH="1%">
- <B>Mouse button 1</B>
- </TD><TD>
- Moves the cursor to this point.
- Drag selects characters.
- Double click selects words.
- Triple click selects all line.
- Shift+click extends the selection.
- When you select text it is automatically copied to the selection buffer.
- </TD></TR><TR><TD NOWRAP="NOWRAP">
- <B>Mouse button 2</B>
- </TD><TD>
- Insert the selection buffer at the point clicked.
- You can also select a region and replace it with the selection buffer
- by selecting the region with mouse button 2.
- </TD></TR><TR><TD NOWRAP="NOWRAP">
- <B>Mouse button 3</B>
- </TD><TD>
- Currently acts like button 1.
- </TD></TR><TR><TD NOWRAP="NOWRAP">
- <B>Backspace</B>
- </TD><TD>
- Deletes one character to the left, or deletes the selected region.
- </TD></TR><TR><TD NOWRAP="NOWRAP">
- <B>Delete</B>
- </TD><TD>
- Deletes one character to the right, or deletes the selected region.
- Combine with Shift for equivalent of ^X (copy+cut).
- </TD></TR><TR><TD NOWRAP="NOWRAP">
- <B>Enter</b>
- </TD><TD>
- May cause the callback, see when().
- </TD></TR></TABLE>
-
- <P>
-
- <TABLE WIDTH="90%" BORDER="1" SUMMARY="Fl_Input platform specific keyboard bindings.">
- <CAPTION ALIGN=TOP>Fl_Input platform specific keyboard bindings.</CAPTION>
- <TR>
- <TD NOWRAP="NOWRAP" WIDTH="1%"><B> Windows/Linux </B></TD>
- <TD NOWRAP="NOWRAP" WIDTH="1%"><B> Mac </B></TD>
- <TD NOWRAP="NOWRAP" ><B> Function </B></TD>
-
- </TR><TR>
- <TD NOWRAP="NOWRAP"><B> ^A </B></TD>
- <TD NOWRAP="NOWRAP"><B> Command-A </B></TD>
- <TD>
- <B>Selects all text in the widget.</B>
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> ^C </B></TD>
- <TD NOWRAP="NOWRAP"><B> Command-C </B></TD>
- <TD>
- <B>Copy the current selection to the clipboard.</B>
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> ^I </B></TD>
- <TD NOWRAP="NOWRAP"><B> ^I </B></TD>
- <TD>
- <B>Insert a tab.</B>
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> ^J </B></TD>
- <TD NOWRAP="NOWRAP"><B> ^J </B></TD>
- <TD>
- <B>Insert a Line Feed.</B> <BR>
- (Similar to literal 'Enter' character)
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> ^L </B></TD>
- <TD NOWRAP="NOWRAP"><B> ^L </B></TD>
- <TD>
- <B>Insert a Form Feed.</B>
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> ^M </B></TD>
- <TD NOWRAP="NOWRAP"><B> ^M </B></TD>
- <TD>
- <B>Insert a Carriage Return.</B>
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> ^V,<BR>Shift-Insert </B></TD>
- <TD NOWRAP="NOWRAP"><B> Command-V </B></TD>
- <TD>
- <B>Paste the clipboard.</B> <BR>
- (Macs keyboards don't have "Insert" keys,
- but if they did, Shift-Insert would work)
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> ^X,<BR>Shift-Delete </B></TD>
- <TD NOWRAP="NOWRAP"><B> Command-X,<BR>Shift-Delete </B></TD>
- <TD>
- <B>Cut.</B> <BR>
- Copy the selection to the clipboard and delete it.
- (If there's no selection, Shift-Delete acts like Delete)
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> ^Z </B></TD>
- <TD NOWRAP="NOWRAP"><B> Command-Z </B></TD>
- <TD>
- <B>Undo.</B> <BR>
- This is a single-level undo mechanism, but all adjacent
- deletions and insertions are concatenated into a single "undo".
- Often this will undo a lot more than you expected.
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> Shift-^Z </B></TD>
- <TD NOWRAP="NOWRAP"><B> Shift-Command-Z </B></TD>
- <TD>
- <B>Redo.</B> <BR>
- Currently same behavior as ^Z.
- Reserved for future multilevel undo/redo.
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> Arrow Keys </B></TD>
- <TD NOWRAP="NOWRAP"><B> Arrow Keys </B></TD>
- <TD>
- <B>Standard cursor movement.</B> <BR>
- Can be combined with Shift to extend selection.
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> Home </B></TD>
- <TD NOWRAP="NOWRAP"><B> Command-Up,<BR>Command-Left </B></TD>
- <TD>
- <B>Move to start of line.</B> <BR>
- Can be combined with Shift to extend selection.
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> End </B></TD>
- <TD NOWRAP="NOWRAP"><B> Command-Down,<BR>Command-Right </B></TD>
- <TD>
- <B>Move to end of line.</B> <BR>
- Can be combined with Shift to extend selection.
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B>Ctrl-Home</B></TD>
- <TD NOWRAP="NOWRAP"><B>Command-Up,<BR>Command-PgUp,<BR>Ctrl-Left</B></TD>
- <TD>
- <B>Move to top of document/field.</B> <BR>
- In single line input, moves to start of line.
- In multiline input, moves to start of top line.
- Can be combined with Shift to extend selection.
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> Ctrl-End </B></TD>
- <TD NOWRAP="NOWRAP"><B> Command-End,<BR>Command-PgDn,<BR>Ctrl-Right</B></TD>
- <TD>
- <B>Move to bottom of document/field.</B> <BR>
- In single line input, moves to end of line.
- In multiline input, moves to end of last line.
- Can be combined with Shift to extend selection.
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> Ctrl-Left </B></TD>
- <TD NOWRAP="NOWRAP"><B> Alt-Left </B></TD>
- <TD>
- <B>Word left.</B> <BR>
- Can be combined with Shift to extend selection.
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> Ctrl-Right </B></TD>
- <TD NOWRAP="NOWRAP"><B> Alt-Right </B></TD>
- <TD>
- <B>Word right.</B> <BR>
- Can be combined with Shift to extend selection.
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> Ctrl-Backspace </B></TD>
- <TD NOWRAP="NOWRAP"><B> Alt-Backspace </B></TD>
- <TD>
- <B>Delete word left.</B>
-
- </TD></TR><TR>
- <TD NOWRAP="NOWRAP"><B> Ctrl-Delete </B></TD>
- <TD NOWRAP="NOWRAP"><B> Alt-Delete </B></TD>
- <TD>
- <B>Delete word right.</B>
-
- </TD></TR></TABLE>
- */
-class FL_EXPORT Fl_Input : public Fl_Input_ {
- int handle_key();
- int shift_position(int p);
- int shift_up_down_position(int p);
- void handle_mouse(int keepmark=0);
-
- // Private keyboard functions
- int kf_lines_up(int repeat_num);
- int kf_lines_down(int repeat_num);
- int kf_page_up();
- int kf_page_down();
- int kf_insert_toggle();
- int kf_delete_word_right();
- int kf_delete_word_left();
- int kf_delete_sol();
- int kf_delete_eol();
- int kf_delete_char_right();
- int kf_delete_char_left();
- int kf_move_sol();
- int kf_move_eol();
- int kf_clear_eol();
- int kf_move_char_left();
- int kf_move_char_right();
- int kf_move_word_left();
- int kf_move_word_right();
- int kf_move_up_and_sol();
- int kf_move_down_and_eol();
- int kf_top();
- int kf_bottom();
- int kf_select_all();
- int kf_undo();
- int kf_redo();
- int kf_copy();
- int kf_paste();
- int kf_copy_cut();
-
-protected:
- void draw();
-public:
- int handle(int);
- Fl_Input(int,int,int,int,const char * = 0);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Input.H 8111 2010-12-23 08:13:18Z manolo $".
-//
diff --git a/Libraries/FL/Fl_Input_.H b/Libraries/FL/Fl_Input_.H
deleted file mode 100644
index 1638436a..00000000
--- a/Libraries/FL/Fl_Input_.H
+++ /dev/null
@@ -1,497 +0,0 @@
-//
-// "$Id: Fl_Input_.H 8068 2010-12-20 07:48:59Z greg.ercolano $"
-//
-// Input base class header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Input_ widget . */
-
-#ifndef Fl_Input__H
-#define Fl_Input__H
-
-#ifndef Fl_Widget_H
-#include "Fl_Widget.H"
-#endif
-
-#define FL_NORMAL_INPUT 0
-#define FL_FLOAT_INPUT 1
-#define FL_INT_INPUT 2
-#define FL_HIDDEN_INPUT 3
-#define FL_MULTILINE_INPUT 4
-#define FL_SECRET_INPUT 5
-#define FL_INPUT_TYPE 7
-#define FL_INPUT_READONLY 8
-#define FL_NORMAL_OUTPUT (FL_NORMAL_INPUT | FL_INPUT_READONLY)
-#define FL_MULTILINE_OUTPUT (FL_MULTILINE_INPUT | FL_INPUT_READONLY)
-#define FL_INPUT_WRAP 16
-#define FL_MULTILINE_INPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_WRAP)
-#define FL_MULTILINE_OUTPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_READONLY | FL_INPUT_WRAP)
-
-/**
- This class provides a low-overhead text input field.
-
- This is a virtual base class below Fl_Input. It has all
- the same interfaces, but lacks the handle() and
- draw() method. You may want to subclass it if you are
- one of those people who likes to change how the editing keys
- work. It may also be useful for adding scrollbars
- to the input field.
-
- This can act like any of the subclasses of Fl_Input, by
- setting type() to one of the following values:
-
- \code
- #define FL_NORMAL_INPUT 0
- #define FL_FLOAT_INPUT 1
- #define FL_INT_INPUT 2
- #define FL_MULTILINE_INPUT 4
- #define FL_SECRET_INPUT 5
- #define FL_INPUT_TYPE 7
- #define FL_INPUT_READONLY 8
- #define FL_NORMAL_OUTPUT (FL_NORMAL_INPUT | FL_INPUT_READONLY)
- #define FL_MULTILINE_OUTPUT (FL_MULTILINE_INPUT | FL_INPUT_READONLY)
- #define FL_INPUT_WRAP 16
- #define FL_MULTILINE_INPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_WRAP)
- #define FL_MULTILINE_OUTPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_READONLY | FL_INPUT_WRAP)
- \endcode
-
- All variables that represent an index into a text buffer are byte-oriented,
- not character oriented. Since UTF-8 characters can be up to six bytes long,
- simply incrementing such an index will not reliably advance to the next character
- in the text buffer.
-
- Indices and pointers into the text buffer should always point at a 7 bit ASCII
- character or the beginning of a UTF-8 character sequence. Behavior for false
- UTF-8 sequences and pointers into the middle of a sequence are undefined.
-
- \see Fl_Text_Display, Fl_Text_Editor for more powerful text handling widgets
-
- \internal
- When porting this widget from ASCII to UTF-8, previously legal pointers into
- the text of this widget can become illegal by pointing into the middle of
- a UTF-8 sequence. This is not a big problem for Fl_Input_ because all code
- in this module is quite tolerant. It could be problematic though when deriving
- from this class because no feedback for illegal pointers is given. Additionally,
- a careless "copy" call can put partial UTF-8 sequences into the clipboard.
-
- None of these issues should be disastrous. Nevertheless, we should
- discuss how FLTK should handle false UTF-8 sequences and pointers.
-*/
-class FL_EXPORT Fl_Input_ : public Fl_Widget {
-
- /** \internal Storage for the text field. */
- const char* value_;
-
- /** \internal Buffer memory for expanded text. \see expand() */
- char* buffer;
-
- /** \internal Size of text in bytes in the \p value_ field. */
- int size_;
-
- /** \internal \todo Please document me! */
- int bufsize;
-
- /** \internal Position of the cursor in the document. */
- int position_;
-
- /** \internal Position of the other end of the selected text. If \p position_ equals
- \p mark_, no text is selected */
- int mark_;
-
- /** \internal Behavior of Tab key in multiline input widget.
- If enabled (default) Tab causes focus nav, otherwise Tab is inserted
- as a character. */
- int tab_nav_;
-
- /** \internal Offset to text origin within widget bounds */
- int xscroll_, yscroll_;
-
- /** \internal Minimal update pointer. Display requires redraw from here to the end
- of the buffer. */
- int mu_p;
-
- /** \internal Maximum size of buffer. \todo Is this really needed? */
- int maximum_size_;
-
- /** \internal Shortcut key that will fetch focus for this widget. */
- int shortcut_;
-
- /** \internal This is set if no text but only the cursor needs updating. */
- uchar erase_cursor_only;
-
- /** \internal The font used for the entire text. */
- Fl_Font textfont_;
-
- /** \internal Height of the font used for the entire text. */
- Fl_Fontsize textsize_;
-
- /** \internal color of the entire text */
- Fl_Color textcolor_;
-
- /** \internal color of the text cursor */
- Fl_Color cursor_color_;
-
- /** \internal Horizontal cursor position in pixels while moving up or down. */
- static double up_down_pos;
-
- /** \internal Flag to remember last cursor move. */
- static int was_up_down;
-
- /* Convert a given text segment into the text that will be rendered on screen. */
- const char* expand(const char*, char*) const;
-
- /* Calculates the width in pixels of part of a text buffer. */
- double expandpos(const char*, const char*, const char*, int*) const;
-
- /* Mark a range of characters for update. */
- void minimal_update(int, int);
-
- /* Mark a range of characters for update. */
- void minimal_update(int p);
-
- /* Copy the value from a possibly static entry into the internal buffer. */
- void put_in_buffer(int newsize);
-
- /* Set the current font and font size. */
- void setfont() const;
-
-protected:
-
- /* Find the start of a word. */
- int word_start(int i) const;
-
- /* Find the end of a word. */
- int word_end(int i) const;
-
- /* Find the start of a line. */
- int line_start(int i) const;
-
- /* Find the end of a line. */
- int line_end(int i) const;
-
- /* Draw the text in the passed bounding box. */
- void drawtext(int, int, int, int);
-
- /* Move the cursor to the column given by up_down_pos. */
- int up_down_position(int, int keepmark=0);
-
- /* Handle mouse clicks and mouse moves. */
- void handle_mouse(int, int, int, int, int keepmark=0);
-
- /* Handle all kinds of text field related events. */
- int handletext(int e, int, int, int, int);
-
- /* Check the when() field and do a callback if indicated. */
- void maybe_do_callback();
-
- /** \internal Horizontal offset of text to left edge of widget. */
- int xscroll() const {return xscroll_;}
-
- /** \internal Vertical offset of text to top edge of widget. */
- int yscroll() const {return yscroll_;}
- void yscroll(int y) { yscroll_ = y; damage(FL_DAMAGE_EXPOSE);}
-
- /* Return the number of lines displayed on a single page. */
- int linesPerPage();
-
-public:
-
- /* Change the size of the widget. */
- void resize(int, int, int, int);
-
- /* Constructor */
- Fl_Input_(int, int, int, int, const char* = 0);
-
- /* Destructor */
- ~Fl_Input_();
-
- /* Changes the widget text. */
- int value(const char*);
-
- /* Changes the widget text. */
- int value(const char*, int);
-
- /* Changes the widget text. */
- int static_value(const char*);
-
- /* Changes the widget text. */
- int static_value(const char*, int);
-
- /**
- Returns the text displayed in the widget.
-
- This function returns the current value, which is a pointer
- to the internal buffer and is valid only until the next event is
- handled.
-
- \return pointer to an internal buffer - do not free() this
- \see Fl_Input_::value(const char*)
- */
- const char* value() const {return value_;}
-
- /* Returns the character at index \p i. */
- Fl_Char index(int i) const;
-
- /**
- Returns the number of bytes in value().
-
- This may be greater than <tt>strlen(value())</tt> if there are
- \c nul characters in the text.
-
- \return number of bytes in the text
- */
- int size() const {return size_;}
-
- /** Sets the width and height of this widget.
- \param [in] W, H new width and height
- \see Fl_Widget::size(int, int) */
- void size(int W, int H) { Fl_Widget::size(W, H); }
-
- /** Gets the maximum length of the input field.
- \todo It is not clear if this function is actually required */
- int maximum_size() const {return maximum_size_;}
-
- /** Sets the maximum length of the input field.
- \todo It is not clear if this function is actually required */
- void maximum_size(int m) {maximum_size_ = m;}
-
- /** Gets the position of the text cursor.
- \return the cursor position as an index
- \see position(int, int)
- */
- int position() const {return position_;}
-
- /** Gets the current selection mark.
- \return index into the text */
- int mark() const {return mark_;}
-
- /* Sets the index for the cursor and mark. */
- int position(int p, int m);
-
- /** Set the cursor position and mark.
- position(n) is the same as <tt>position(n, n)</tt>.
- \param p new index for cursor and mark
- \return 0 if no positions changed
- \see position(int, int), position(), mark(int)
- */
- int position(int p) {return position(p, p);}
-
- /** Sets the current selection mark.
- mark(n) is the same as <tt>position(position(),n)</tt>.
- \param m new index of the mark
- \return 0 if the mark did not change
- \see position(), position(int, int) */
- int mark(int m) {return position(position(), m);}
-
- /* Deletes text from b to e and inserts the new string text. */
- int replace(int, int, const char*, int=0);
-
- /**
- Deletes the current selection.
-
- This function deletes the currently selected text
- \e without storing it in the clipboard. To use the clipboard,
- you may call copy() first or copy_cuts() after
- this call.
-
- \return 0 if no data was copied
- */
- int cut() {return replace(position(), mark(), 0);}
-
- /**
- Deletes the next \p n bytes rounded to characters before or after the cursor.
-
- This function deletes the currently selected text
- \e without storing it in the clipboard. To use the clipboard,
- you may call copy() first or copy_cuts() after
- this call.
-
- \param n number of bytes rounded to full characters and clamped to the buffer.
- A negative number will cut characters to the left of the cursor.
- \return 0 if no data was copied
- */
- int cut(int n) {return replace(position(), position()+n, 0);}
-
- /**
- Deletes all characters between index \p a and \p b.
-
- This function deletes the currently selected text
- \e without storing it in the clipboard. To use the clipboard,
- you may call copy() first or copy_cuts() after
- this call.
-
- \param a, b range of bytes rounded to full characters and clamped to the buffer
- \return 0 if no data was copied
- */
- int cut(int a, int b) {return replace(a, b, 0);}
-
- /**
- Inserts text at the cursor position.
-
- This function inserts the string in \p t at the cursor
- position() and moves the new position and mark to
- the end of the inserted text.
-
- \param [in] t text that will be inserted
- \param [in] l length of text, or 0 if the string is terminated by \c nul.
- \return 0 if no text was inserted
- */
- int insert(const char* t, int l=0){return replace(position_, mark_, t, l);}
-
- /* Put the current selection into the clipboard. */
- int copy(int clipboard);
-
- /* Undo previous changes to the text buffer. */
- int undo();
-
- /* Copy the yank buffer to the clipboard. */
- int copy_cuts();
-
- /** Return the shortcut key associated with this widget.
- \return shortcut keystroke
- \see Fl_Button::shortcut() */
- int shortcut() const {return shortcut_;}
-
- /**
- Sets the shortcut key associated with this widget.
- Pressing the shortcut key gives text editing focus to this widget.
- \param [in] s new shortcut keystroke
- \see Fl_Button::shortcut()
- */
- void shortcut(int s) {shortcut_ = s;}
-
- /** Gets the font of the text in the input field.
- \return the current Fl_Font index */
- Fl_Font textfont() const {return textfont_;}
-
- /** Sets the font of the text in the input field.
- The text font defaults to \c FL_HELVETICA.
- \param [in] s the new text font */
- void textfont(Fl_Font s) {textfont_ = s;}
-
- /** Gets the size of the text in the input field.
- \return the text height in pixels */
- Fl_Fontsize textsize() const {return textsize_;}
-
- /** Sets the size of the text in the input field.
- The text height defaults to \c FL_NORMAL_SIZE.
- \param [in] s the new font height in pixel units */
- void textsize(Fl_Fontsize s) {textsize_ = s;}
-
- /** Gets the color of the text in the input field.
- \return the text color
- \see textcolor(Fl_Color) */
- Fl_Color textcolor() const {return textcolor_;}
-
- /** Sets the color of the text in the input field.
- The text color defaults to \c FL_FOREGROUND_COLOR.
- \param [in] n new text color
- \see textcolor() */
- void textcolor(Fl_Color n) {textcolor_ = n;}
-
- /** Gets the color of the cursor.
- \return the current cursor color */
- Fl_Color cursor_color() const {return cursor_color_;}
-
- /** Sets the color of the cursor.
- The default color for the cursor is \c FL_BLACK.
- \param [in] n the new cursor color */
- void cursor_color(Fl_Color n) {cursor_color_ = n;}
-
- /** Gets the input field type.
- \return the current input type */
- int input_type() const {return type() & FL_INPUT_TYPE; }
-
- /** Sets the input field type.
- A redraw() is required to reformat the input field.
- \param [in] t new input type */
- void input_type(int t) { type((uchar)(t | readonly())); }
-
- /** Gets the read-only state of the input field.
- \return non-zero if this widget is read-only */
- int readonly() const { return type() & FL_INPUT_READONLY; }
-
- /** Sets the read-only state of the input field.
- \param [in] b if \p b is 0, the text in this widget can be edited by the user */
- void readonly(int b) { if (b) type((uchar)(type() | FL_INPUT_READONLY));
- else type((uchar)(type() & ~FL_INPUT_READONLY)); }
-
- /**
- Gets the word wrapping state of the input field.
- Word wrap is only functional with multi-line input fields.
- */
- int wrap() const { return type() & FL_INPUT_WRAP; }
-
- /**
- Sets the word wrapping state of the input field.
- Word wrap is only functional with multi-line input fields.
- */
- void wrap(int b) { if (b) type((uchar)(type() | FL_INPUT_WRAP));
- else type((uchar)(type() & ~FL_INPUT_WRAP)); }
-
- /**
- Sets whether the Tab key does focus navigation,
- or inserts tab characters into Fl_Multiline_Input.
-
- By default this flag is enabled to provide the 'normal' behavior
- most users expect; Tab navigates focus to the next widget.
- To inserting an actual Tab character, users can use Ctrl-I
- or copy/paste.
-
- Disabling this flag gives the old FLTK behavior where Tab
- inserts a tab character into the text field, in which case
- only the mouse can be used to navigate to the next field.
-
- History: This flag was provided for backwards support of FLTK's old 1.1.x
- behavior where Tab inserts a tab character instead of navigating
- focus to the next widget. This behavior was unique to Fl_Multiline_Input.
- With the advent of Fl_Text_Editor, this old behavior has been deprecated.
-
- \param [in] val If \p val is 1, Tab advances focus (default).<BR>
- If \p val is 0, Tab inserts a tab character (old FLTK behavior).
- */
- void tab_nav(int val) {
- tab_nav_ = val;
- }
-
- /**
- Gets whether the Tab key causes focus navigation in multiline input fields or not.
-
- If enabled (default), hitting Tab causes focus navigation to the next widget.
-
- If disabled, hitting Tab inserts a tab character into the text field.
- \returns 1 if Tab advances focus (default), 0 if Tab inserts tab characters.
- \see tab_nav(int)
- */
- int tab_nav() const {
- return tab_nav_;
- }
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Input_.H 8068 2010-12-20 07:48:59Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Input_Choice.H b/Libraries/FL/Fl_Input_Choice.H
deleted file mode 100644
index 843e7495..00000000
--- a/Libraries/FL/Fl_Input_Choice.H
+++ /dev/null
@@ -1,222 +0,0 @@
-//
-// "$Id: Fl_Input_Choice.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// An input/chooser widget.
-// ______________ ____
-// | || __ |
-// | input area || \/ |
-// |______________||____|
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-// Copyright 2004 by Greg Ercolano.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Input_Choice widget . */
-
-
-
-#ifndef Fl_Input_Choice_H
-#define Fl_Input_Choice_H
-
-#include <FL/Fl.H>
-#include <FL/Fl_Group.H>
-#include <FL/Fl_Input.H>
-#include <FL/Fl_Menu_Button.H>
-#include <FL/fl_draw.H>
-#include <string.h>
-
-/**
- A combination of the input widget and a menu button.
- The user can either type into the input area, or use the
- menu button chooser on the right, which loads the input area
- with predefined text. Normally it is drawn with an inset box
- and a white background.
- <P>
- The application can directly access both the input and menu
- widgets directly, using the menubutton()
- and input() accessor methods.
-*/
-class FL_EXPORT Fl_Input_Choice : public Fl_Group {
- // Private class to handle slightly 'special' behavior of menu button
- class InputMenuButton : public Fl_Menu_Button {
- void draw() {
- draw_box(FL_UP_BOX, color());
- fl_color(active_r() ? labelcolor() : fl_inactive(labelcolor()));
- int xc = x()+w()/2, yc=y()+h()/2;
- fl_polygon(xc-5,yc-3,xc+5,yc-3,xc,yc+3);
- if (Fl::focus() == this) draw_focus();
- }
- public:
- InputMenuButton(int x,int y,int w,int h,const char*l=0) :
- Fl_Menu_Button(x,y,w,h,l) { box(FL_UP_BOX); }
- };
-
- Fl_Input *inp_;
- InputMenuButton *menu_;
-
- static void menu_cb(Fl_Widget*, void *data) {
- Fl_Input_Choice *o=(Fl_Input_Choice *)data;
- Fl_Widget_Tracker wp(o);
- const Fl_Menu_Item *item = o->menubutton()->mvalue();
- if (item && item->flags & (FL_SUBMENU|FL_SUBMENU_POINTER)) return; // ignore submenus
- if (!strcmp(o->inp_->value(), o->menu_->text()))
- {
- o->Fl_Widget::clear_changed();
- if (o->when() & FL_WHEN_NOT_CHANGED)
- o->do_callback();
- }
- else
- {
- o->inp_->value(o->menu_->text());
- o->inp_->set_changed();
- o->Fl_Widget::set_changed();
- if (o->when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE))
- o->do_callback();
- }
-
- if (wp.deleted()) return;
-
- if (o->callback() != default_callback)
- {
- o->Fl_Widget::clear_changed();
- o->inp_->clear_changed();
- }
- }
-
- static void inp_cb(Fl_Widget*, void *data) {
- Fl_Input_Choice *o=(Fl_Input_Choice *)data;
- Fl_Widget_Tracker wp(o);
- if (o->inp_->changed()) {
- o->Fl_Widget::set_changed();
- if (o->when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE))
- o->do_callback();
- } else {
- o->Fl_Widget::clear_changed();
- if (o->when() & FL_WHEN_NOT_CHANGED)
- o->do_callback();
- }
-
- if (wp.deleted()) return;
-
- if (o->callback() != default_callback)
- o->Fl_Widget::clear_changed();
- }
-
- // Custom resize behavior -- input stretches, menu button doesn't
- inline int inp_x() { return(x() + Fl::box_dx(box())); }
- inline int inp_y() { return(y() + Fl::box_dy(box())); }
- inline int inp_w() { return(w() - Fl::box_dw(box()) - 20); }
- inline int inp_h() { return(h() - Fl::box_dh(box())); }
-
- inline int menu_x() { return(x() + w() - 20 - Fl::box_dx(box())); }
- inline int menu_y() { return(y() + Fl::box_dy(box())); }
- inline int menu_w() { return(20); }
- inline int menu_h() { return(h() - Fl::box_dh(box())); }
-
-public:
- /**
- Creates a new Fl_Input_Choice widget using the given position, size,
- and label string.
- <P> Inherited destructor Destroys the widget and any value associated with it.
- */
- Fl_Input_Choice (int x,int y,int w,int h,const char*l=0) : Fl_Group(x,y,w,h,l) {
- Fl_Group::box(FL_DOWN_BOX);
- align(FL_ALIGN_LEFT); // default like Fl_Input
- inp_ = new Fl_Input(inp_x(), inp_y(),
- inp_w(), inp_h());
- inp_->callback(inp_cb, (void*)this);
- inp_->box(FL_FLAT_BOX); // cosmetic
- inp_->when(FL_WHEN_CHANGED|FL_WHEN_NOT_CHANGED);
- menu_ = new InputMenuButton(menu_x(), menu_y(),
- menu_w(), menu_h());
- menu_->callback(menu_cb, (void*)this);
- menu_->box(FL_FLAT_BOX); // cosmetic
- end();
- }
-
- /** Adds an item to the menu.*/
- void add(const char *s) { menu_->add(s); }
- int changed() const { return inp_->changed() | Fl_Widget::changed();}
- void clear_changed() {
- inp_->clear_changed();
- Fl_Widget::clear_changed();
- }
- void set_changed() {
- inp_->set_changed();
- // no need to call Fl_Widget::set_changed()
- }
- /** Removes all items from the menu. */
- void clear() { menu_->clear(); }
- /** Gets the box type of the menu button */
- Fl_Boxtype down_box() const { return (menu_->down_box()); }
- /** Sets the box type of the menu button */
- void down_box(Fl_Boxtype b) { menu_->down_box(b); }
- /** Gets the Fl_Menu_Item array used for the menu. */
- const Fl_Menu_Item *menu() { return (menu_->menu()); }
- /** Sets the Fl_Menu_Item array used for the menu. */
- void menu(const Fl_Menu_Item *m) { menu_->menu(m); }
- void resize(int X, int Y, int W, int H) {
- Fl_Group::resize(X,Y,W,H);
- inp_->resize(inp_x(), inp_y(), inp_w(), inp_h());
- menu_->resize(menu_x(), menu_y(), menu_w(), menu_h());
- }
- /** Gets the encapsulated input text color attributes */
- Fl_Color textcolor() const { return (inp_->textcolor());}
- /** Sets the encapsulated input text color attributes */
- void textcolor(Fl_Color c) { inp_->textcolor(c);}
- /** Gets the encapsulated input text font attributes */
- Fl_Font textfont() const { return (inp_->textfont());}
- /** Sets the encapsulated input text font attributes */
- void textfont(Fl_Font f) { inp_->textfont(f);}
- /** Gets the encapsulated input size attributes */
- Fl_Fontsize textsize() const { return (inp_->textsize()); }
- /** Sets the encapsulated input size attributes */
- void textsize(Fl_Fontsize s) { inp_->textsize(s); }
- /** See void Fl_Input_Choice::value(const char *s) */
- const char* value() const { return (inp_->value()); }
- /**
- Sets or returns the input widget's current contents. The
- second form sets the contents using the index into the menu
- which you can set as an integer. Setting the value effectively
- 'chooses' this menu item, and sets it as the new input text,
- deleting the previous text.
- */
- void value(const char *val) { inp_->value(val); }
- /** See void Fl_Input_Choice::value(const char *s) */
- void value(int val) {
- menu_->value(val);
- inp_->value(menu_->text(val));
- }
- /** Returns a reference to the internal Fl_Menu_Button widget. */
- Fl_Menu_Button *menubutton() { return menu_; }
- /**
- Returns a reference to the internal Fl_Input widget.</p>
- */
- Fl_Input *input() { return inp_; }
-};
-
-#endif // !Fl_Input_Choice_H
-
-//
-// End of "$Id: Fl_Input_Choice.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Int_Input.H b/Libraries/FL/Fl_Int_Input.H
deleted file mode 100644
index 9bc94778..00000000
--- a/Libraries/FL/Fl_Int_Input.H
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// "$Id: Fl_Int_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
-//
-// Integer input header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Int_Input widget . */
-
-#ifndef Fl_Int_Input_H
-#define Fl_Int_Input_H
-
-#include "Fl_Input.H"
-
-/**
- The Fl_Int_Input class is a subclass of Fl_Input that only allows
- the user to type decimal digits (or hex numbers of the form 0xaef).
-*/
-class FL_EXPORT Fl_Int_Input : public Fl_Input {
-public:
- /**
- Creates a new Fl_Int_Input widget using the given position,
- size, and label string. The default boxtype is FL_DOWN_BOX.
-
- Inherited destructor destroys the widget and any value associated with it.
- */
-
-#if defined(FL_DLL) // implementation in src/Fl_Input.cxx
- Fl_Int_Input(int X,int Y,int W,int H,const char *l = 0);
-#else
- Fl_Int_Input(int X,int Y,int W,int H,const char *l = 0)
- : Fl_Input(X,Y,W,H,l) {type(FL_INT_INPUT);}
-#endif
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Int_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_JPEG_Image.H b/Libraries/FL/Fl_JPEG_Image.H
deleted file mode 100644
index 06f3a4c0..00000000
--- a/Libraries/FL/Fl_JPEG_Image.H
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// "$Id: Fl_JPEG_Image.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// JPEG image header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_JPEG_Image class . */
-
-#ifndef Fl_JPEG_Image_H
-#define Fl_JPEG_Image_H
-# include "Fl_Image.H"
-
-/**
- The Fl_JPEG_Image class supports loading, caching,
- and drawing of Joint Photographic Experts Group (JPEG) File
- Interchange Format (JFIF) images. The class supports grayscale
- and color (RGB) JPEG image files.
-*/
-class FL_EXPORT Fl_JPEG_Image : public Fl_RGB_Image {
-
-public:
-
- Fl_JPEG_Image(const char *filename);
- Fl_JPEG_Image(const char *name, const unsigned char *data);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_JPEG_Image.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Light_Button.H b/Libraries/FL/Fl_Light_Button.H
deleted file mode 100644
index a5786c27..00000000
--- a/Libraries/FL/Fl_Light_Button.H
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// "$Id: Fl_Light_Button.H 8178 2011-01-04 14:09:37Z manolo $"
-//
-// Lighted button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Light_Button widget . */
-
-#ifndef Fl_Light_Button_H
-#define Fl_Light_Button_H
-
-#include "Fl_Button.H"
-
-/**
- This subclass displays the "on" state by turning on a light,
- rather than drawing pushed in. The shape of the "light"
- is initially set to FL_DOWN_BOX. The color of the light when
- on is controlled with selection_color(), which defaults to FL_YELLOW.
-
- Buttons generate callbacks when they are clicked by the user. You
- control exactly when and how by changing the values for type() and when().
- <P ALIGN=CENTER>\image html Fl_Light_Button.png</P>
- \image latex Fl_Light_Button.png "Fl_Light_Button" width=4cm
-*/
-class FL_EXPORT Fl_Light_Button : public Fl_Button {
-protected:
- virtual void draw();
-public:
- virtual int handle(int);
- Fl_Light_Button(int x,int y,int w,int h,const char *l = 0);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Light_Button.H 8178 2011-01-04 14:09:37Z manolo $".
-//
diff --git a/Libraries/FL/Fl_Line_Dial.H b/Libraries/FL/Fl_Line_Dial.H
deleted file mode 100644
index ade856c1..00000000
--- a/Libraries/FL/Fl_Line_Dial.H
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// "$Id: Fl_Line_Dial.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// Line dial header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Line_Dial widget . */
-
-#ifndef Fl_Line_Dial_H
-#define Fl_Line_Dial_H
-
-#include "Fl_Dial.H"
-
-class FL_EXPORT Fl_Line_Dial : public Fl_Dial {
-public:
- Fl_Line_Dial(int x,int y,int w,int h, const char *l = 0)
- : Fl_Dial(x,y,w,h,l) {type(FL_LINE_DIAL);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Line_Dial.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Menu.H b/Libraries/FL/Fl_Menu.H
deleted file mode 100644
index a35dd4a8..00000000
--- a/Libraries/FL/Fl_Menu.H
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// "$Id: Fl_Menu.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Old menu header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-// this include file is for back compatibility only
-#include "Fl_Menu_Item.H"
-
-//
-// End of "$Id: Fl_Menu.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Menu_.H b/Libraries/FL/Fl_Menu_.H
deleted file mode 100644
index 278ad8ca..00000000
--- a/Libraries/FL/Fl_Menu_.H
+++ /dev/null
@@ -1,168 +0,0 @@
-//
-// "$Id: Fl_Menu_.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Menu base class header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Menu_ widget . */
-
-#ifndef Fl_Menu__H
-#define Fl_Menu__H
-
-#ifndef Fl_Widget_H
-#include "Fl_Widget.H"
-#endif
-#include "Fl_Menu_Item.H"
-
-/**
- Base class of all widgets that have a menu in FLTK.
- Currently FLTK provides you with
- Fl_Menu_Button, Fl_Menu_Bar, and Fl_Choice.
-
- <P>The class contains a pointer to an array of structures of type Fl_Menu_Item. The
- array may either be supplied directly by the user program, or it may
- be "private": a dynamically allocated array managed by the Fl_Menu_.
-*/
-class FL_EXPORT Fl_Menu_ : public Fl_Widget {
-
- Fl_Menu_Item *menu_;
- const Fl_Menu_Item *value_;
-
-protected:
-
- uchar alloc; // flag indicates if menu_ is a dynamic copy (=1) or not (=0)
- uchar down_box_;
- Fl_Font textfont_;
- Fl_Fontsize textsize_;
- Fl_Color textcolor_;
-
-public:
- Fl_Menu_(int,int,int,int,const char * =0);
- ~Fl_Menu_();
-
- int item_pathname(char *name, int namelen, const Fl_Menu_Item *finditem=0) const;
- const Fl_Menu_Item* picked(const Fl_Menu_Item*);
- const Fl_Menu_Item* find_item(const char *name);
- const Fl_Menu_Item* find_item(Fl_Callback*);
- int find_index(const char *name) const;
- int find_index(const Fl_Menu_Item *item) const;
- int find_index(Fl_Callback *cb) const;
-
- /**
- Returns the menu item with the entered shortcut (key value).
-
- This searches the complete menu() for a shortcut that matches the
- entered key value. It must be called for a FL_KEYBOARD or FL_SHORTCUT
- event.
-
- If a match is found, the menu's callback will be called.
-
- \return matched Fl_Menu_Item or NULL.
- */
- const Fl_Menu_Item* test_shortcut() {return picked(menu()->test_shortcut());}
- void global();
-
- /**
- Returns a pointer to the array of Fl_Menu_Items. This will either be
- the value passed to menu(value) or the private copy.
- */
- const Fl_Menu_Item *menu() const {return menu_;}
- void menu(const Fl_Menu_Item *m);
- void copy(const Fl_Menu_Item *m, void* user_data = 0);
- int insert(int index, const char*, int shortcut, Fl_Callback*, void* = 0, int = 0);
- int add(const char*, int shortcut, Fl_Callback*, void* = 0, int = 0);
- /** See int Fl_Menu_::add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0) */
- int add(const char* a, const char* b, Fl_Callback* c, void* d = 0, int e = 0) {
- return add(a,fl_old_shortcut(b),c,d,e);
- }
- /** See int Fl_Menu_::insert(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0) */
- int insert(int index, const char* a, const char* b, Fl_Callback* c, void* d = 0, int e = 0) {
- return insert(index,a,fl_old_shortcut(b),c,d,e);
- }
- int add(const char *);
- int size() const ;
- void size(int W, int H) { Fl_Widget::size(W, H); }
- void clear();
- int clear_submenu(int index);
- void replace(int,const char *);
- void remove(int);
- /** Changes the shortcut of item i to n. */
- void shortcut(int i, int s) {menu_[i].shortcut(s);}
- /** Sets the flags of item i. For a list of the flags, see Fl_Menu_Item. */
- void mode(int i,int fl) {menu_[i].flags = fl;}
- /** Gets the flags of item i. For a list of the flags, see Fl_Menu_Item. */
- int mode(int i) const {return menu_[i].flags;}
-
- /** Returns a pointer to the last menu item that was picked. */
- const Fl_Menu_Item *mvalue() const {return value_;}
- /** Returns the index into menu() of the last item chosen by the user. It is zero initially. */
- int value() const {return value_ ? (int)(value_-menu_) : -1;}
- int value(const Fl_Menu_Item*);
- /**
- The value is the index into menu() of the last item chosen by
- the user. It is zero initially. You can set it as an integer, or set
- it with a pointer to a menu item. The set routines return non-zero if
- the new value is different than the old one.
- */
- int value(int i) {return value(menu_+i);}
- /** Returns the title of the last item chosen. */
- const char *text() const {return value_ ? value_->text : 0;}
- /** Returns the title of item i. */
- const char *text(int i) const {return menu_[i].text;}
-
- /** Gets the current font of menu item labels. */
- Fl_Font textfont() const {return textfont_;}
- /** Sets the current font of menu item labels. */
- void textfont(Fl_Font c) {textfont_=c;}
- /** Gets the font size of menu item labels. */
- Fl_Fontsize textsize() const {return textsize_;}
- /** Sets the font size of menu item labels. */
- void textsize(Fl_Fontsize c) {textsize_=c;}
- /** Get the current color of menu item labels. */
- Fl_Color textcolor() const {return textcolor_;}
- /** Sets the current color of menu item labels. */
- void textcolor(Fl_Color c) {textcolor_=c;}
-
- /**
- This box type is used to surround the currently-selected items in the
- menus. If this is FL_NO_BOX then it acts like
- FL_THIN_UP_BOX and selection_color() acts like
- FL_WHITE, for back compatibility.
- */
- Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
- /** See Fl_Boxtype Fl_Menu_::down_box() const */
- void down_box(Fl_Boxtype b) {down_box_ = b;}
-
- /** For back compatibility, same as selection_color() */
- Fl_Color down_color() const {return selection_color();}
- /** For back compatibility, same as selection_color() */
- void down_color(unsigned c) {selection_color(c);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Menu_.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Menu_Bar.H b/Libraries/FL/Fl_Menu_Bar.H
deleted file mode 100644
index 5e522f6a..00000000
--- a/Libraries/FL/Fl_Menu_Bar.H
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// "$Id: Fl_Menu_Bar.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Menu bar header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Menu_Bar widget . */
-
-#ifndef Fl_Menu_Bar_H
-#define Fl_Menu_Bar_H
-
-#include "Fl_Menu_.H"
-
-/**
- This widget provides a standard menubar interface. Usually you will
- put this widget along the top edge of your window. The height of the
- widget should be 30 for the menu titles to draw correctly with the
- default font.
- <P>The items on the bar and the menus they bring up are defined by a
- single Fl_Menu_Item
- array. Because a Fl_Menu_Item array defines a hierarchy, the
- top level menu defines the items in the menubar, while the submenus
- define the pull-down menus. Sub-sub menus and lower pop up to the right
- of the submenus. </P>
- <P ALIGN=CENTER>\image html menubar.png</P>
- \image latex menubar.png " menubar" width=12cm
- <P>If there is an item in the top menu that is not a title of a
- submenu, then it acts like a "button" in the menubar. Clicking on it
- will pick it. </P>
- <P>When the user picks an item off the menu, the item's callback is
- done with the menubar as the Fl_Widget* argument. If the item
- does not have a callback the menubar's callback is done instead. </P>
- <P>Submenus will also pop up in response to shortcuts indicated by
- putting a '&' character in the name field of the menu item. If you put a
- '&' character in a top-level "button" then the shortcut picks it. The
- '&' character in submenus is ignored until the menu is popped up. </P>
- <P>Typing the shortcut() of any of the menu items will cause
- callbacks exactly the same as when you pick the item with the mouse.
-*/
-class FL_EXPORT Fl_Menu_Bar : public Fl_Menu_ {
-protected:
- void draw();
-public:
- int handle(int);
- /**
- Creates a new Fl_Menu_Bar widget using the given position,
- size, and label string. The default boxtype is FL_UP_BOX.
- <P>The constructor sets menu() to NULL. See
- Fl_Menu_ for the methods to set or change the menu. </P>
- <P>labelsize(), labelfont(), and labelcolor()
- are used to control how the menubar items are drawn. They are
- initialized from the Fl_Menu static variables, but you can
- change them if desired. </P>
- <P>label() is ignored unless you change align() to
- put it outside the menubar.
- <P>The destructor removes the Fl_Menu_Bar widget and all of its
- menu items.
- */
- Fl_Menu_Bar(int X, int Y, int W, int H,const char *l=0)
- : Fl_Menu_(X,Y,W,H,l) {}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Menu_Bar.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Menu_Button.H b/Libraries/FL/Fl_Menu_Button.H
deleted file mode 100644
index a5ff5d89..00000000
--- a/Libraries/FL/Fl_Menu_Button.H
+++ /dev/null
@@ -1,86 +0,0 @@
-//
-// "$Id: Fl_Menu_Button.H 8016 2010-12-12 11:19:12Z manolo $"
-//
-// Menu button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Menu_Button widget . */
-
-#ifndef Fl_Menu_Button_H
-#define Fl_Menu_Button_H
-
-#include "Fl_Menu_.H"
-
-/**
- This is a button that when pushed pops up a menu (or hierarchy of
- menus) defined by an array of
- Fl_Menu_Item objects.
- <P ALIGN=CENTER>\image html menu_button.png</P>
- \image latex menu_button.png " menu_button" width=5cm
- <P>Normally any mouse button will pop up a menu and it is lined up
- below the button as shown in the picture. However an Fl_Menu_Button
- may also control a pop-up menu. This is done by setting the type().
- If type() is zero a normal menu button is produced.
- If it is nonzero then this is a pop-up menu. The bits in type() indicate
- what mouse buttons pop up the menu (see Fl_Menu_Button::popup_buttons). </P>
- <P>The menu will also pop up in response to shortcuts indicated by
- putting a '&' character in the label(). </P>
- <P>Typing the shortcut() of any of the menu items will cause
- callbacks exactly the same as when you pick the item with the mouse.
- The '&' character in menu item names are only looked at when the menu is
- popped up, however. </P>
- <P>When the user picks an item off the menu, the item's callback is
- done with the menu_button as the Fl_Widget* argument. If the
- item does not have a callback the menu_button's callback is done
- instead.
-*/
-class FL_EXPORT Fl_Menu_Button : public Fl_Menu_ {
-protected:
- void draw();
-public:
- /**
- \brief indicate what mouse buttons pop up the menu.
-
- Values for type() used to indicate what mouse buttons pop up the menu.
- Fl_Menu_Button::POPUP3 is usually what you want.
- */
- enum popup_buttons {POPUP1 = 1, /**< pops up with the mouse 1st button. */
- POPUP2, /**< pops up with the mouse 2nd button. */
- POPUP12, /**< pops up with the mouse 1st or 2nd buttons. */
- POPUP3, /**< pops up with the mouse 3rd button. */
- POPUP13, /**< pops up with the mouse 1st or 3rd buttons. */
- POPUP23, /**< pops up with the mouse 2nd or 3rd buttons. */
- POPUP123 /**< pops up with any mouse button. */
- };
- int handle(int);
- const Fl_Menu_Item* popup();
- Fl_Menu_Button(int,int,int,int,const char * =0);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Menu_Button.H 8016 2010-12-12 11:19:12Z manolo $".
-//
diff --git a/Libraries/FL/Fl_Menu_Item.H b/Libraries/FL/Fl_Menu_Item.H
deleted file mode 100644
index 4d586993..00000000
--- a/Libraries/FL/Fl_Menu_Item.H
+++ /dev/null
@@ -1,443 +0,0 @@
-//
-// "$Id: Fl_Menu_Item.H 7983 2010-12-09 00:04:06Z AlbrechtS $"
-//
-// Menu item header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-#ifndef Fl_Menu_Item_H
-#define Fl_Menu_Item_H
-
-# include "Fl_Widget.H"
-# include "Fl_Image.H"
-
-# if defined(__APPLE__) && defined(check)
-# undef check
-# endif
-
-enum { // values for flags:
- FL_MENU_INACTIVE = 1, ///< Deactivate menu item (gray out)
- FL_MENU_TOGGLE= 2, ///< Item is a checkbox toggle (shows checkbox for on/off state)
- FL_MENU_VALUE = 4, ///< The on/off state for checkbox/radio buttons (if set, state is 'on')
- FL_MENU_RADIO = 8, ///< Item is a radio button (one checkbox of many can be on)
- FL_MENU_INVISIBLE = 0x10, ///< Item will not show up (shortcut will work)
- FL_SUBMENU_POINTER = 0x20, ///< Indicates user_data() is a pointer to another menu array
- FL_SUBMENU = 0x40, ///< This item is a submenu to other items
- FL_MENU_DIVIDER = 0x80, ///< Creates divider line below this item. Also ends a group of radio buttons.
- FL_MENU_HORIZONTAL = 0x100 ///< ??? -- reserved
-};
-
-extern FL_EXPORT Fl_Shortcut fl_old_shortcut(const char*);
-
-class Fl_Menu_;
-
-/**
- The Fl_Menu_Item structure defines a single menu item that
- is used by the Fl_Menu_ class.
- \code
- struct Fl_Menu_Item {
- const char* text; // label()
- ulong shortcut_;
- Fl_Callback* callback_;
- void* user_data_;
- int flags;
- uchar labeltype_;
- uchar labelfont_;
- uchar labelsize_;
- uchar labelcolor_;
- };
-
- enum { // values for flags:
- FL_MENU_INACTIVE = 1, // Deactivate menu item (gray out)
- FL_MENU_TOGGLE = 2, // Item is a checkbox toggle (shows checkbox for on/off state)
- FL_MENU_VALUE = 4, // The on/off state for checkbox/radio buttons (if set, state is 'on')
- FL_MENU_RADIO = 8, // Item is a radio button (one checkbox of many can be on)
- FL_MENU_INVISIBLE = 0x10, // Item will not show up (shortcut will work)
- FL_SUBMENU_POINTER = 0x20, // Indicates user_data() is a pointer to another menu array
- FL_SUBMENU = 0x40, // This item is a submenu to other items
- FL_MENU_DIVIDER = 0x80, // Creates divider line below this item. Also ends a group of radio buttons.
- FL_MENU_HORIZONTAL = 0x100 // ??? -- reserved
- };
- \endcode
- Typically menu items are statically defined; for example:
- \code
- Fl_Menu_Item popup[] = {
- {"&alpha", FL_ALT+'a', the_cb, (void*)1},
- {"&beta", FL_ALT+'b', the_cb, (void*)2},
- {"gamma", FL_ALT+'c', the_cb, (void*)3, FL_MENU_DIVIDER},
- {"&strange", 0, strange_cb},
- {"&charm", 0, charm_cb},
- {"&truth", 0, truth_cb},
- {"b&eauty", 0, beauty_cb},
- {"sub&menu", 0, 0, 0, FL_SUBMENU},
- {"one"},
- {"two"},
- {"three"},
- {0},
- {"inactive", FL_ALT+'i', 0, 0, FL_MENU_INACTIVE|FL_MENU_DIVIDER},
- {"invisible",FL_ALT+'i', 0, 0, FL_MENU_INVISIBLE},
- {"check", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE|FL_MENU_VALUE},
- {"box", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE},
- {0}};
- \endcode
- produces:
-
- \image html menu.png
- \image latex menu.png "menu" width=10cm
-
- A submenu title is identified by the bit FL_SUBMENU in the
- flags field, and ends with a label() that is NULL.
- You can nest menus to any depth. A pointer to the first item in the
- submenu can be treated as an Fl_Menu array itself. It is also
- possible to make separate submenu arrays with FL_SUBMENU_POINTER flags.
-
- You should use the method functions to access structure members and
- not access them directly to avoid compatibility problems with future
- releases of FLTK.
-*/
-struct FL_EXPORT Fl_Menu_Item {
- const char *text; ///< menu item text, returned by label()
- int shortcut_; ///< menu item shortcut
- Fl_Callback *callback_; ///< menu item callback
- void *user_data_; ///< menu item user_data for the menu's callback
- int flags; ///< menu item flags like FL_MENU_TOGGLE, FL_MENU_RADIO
- uchar labeltype_; ///< how the menu item text looks like
- Fl_Font labelfont_; ///< which font for this menu item text
- Fl_Fontsize labelsize_; ///< size of menu item text
- Fl_Color labelcolor_; ///< menu item text color
-
- // advance N items, skipping submenus:
- const Fl_Menu_Item *next(int=1) const;
-
- /**
- Advances a pointer by n items through a menu array, skipping
- the contents of submenus and invisible items. There are two calls so
- that you can advance through const and non-const data.
- */
- Fl_Menu_Item *next(int i=1) {
- return (Fl_Menu_Item*)(((const Fl_Menu_Item*)this)->next(i));}
-
- /** Returns the first menu item, same as next(0). */
- const Fl_Menu_Item *first() const { return next(0); }
-
- /** Returns the first menu item, same as next(0). */
- Fl_Menu_Item *first() { return next(0); }
-
- // methods on menu items:
- /**
- Returns the title of the item.
- A NULL here indicates the end of the menu (or of a submenu).
- A '&' in the item will print an underscore under the next letter,
- and if the menu is popped up that letter will be a "shortcut" to pick
- that item. To get a real '&' put two in a row.
- */
- const char* label() const {return text;}
-
- /** See const char* Fl_Menu_Item::label() const */
- void label(const char* a) {text=a;}
-
- /** See const char* Fl_Menu_Item::label() const */
- void label(Fl_Labeltype a,const char* b) {labeltype_ = a; text = b;}
-
- /**
- Returns the menu item's labeltype.
- A labeltype identifies a routine that draws the label of the
- widget. This can be used for special effects such as emboss, or to use
- the label() pointer as another form of data such as a bitmap.
- The value FL_NORMAL_LABEL prints the label as text.
- */
- Fl_Labeltype labeltype() const {return (Fl_Labeltype)labeltype_;}
-
- /**
- Sets the menu item's labeltype.
- A labeltype identifies a routine that draws the label of the
- widget. This can be used for special effects such as emboss, or to use
- the label() pointer as another form of data such as a bitmap.
- The value FL_NORMAL_LABEL prints the label as text.
- */
- void labeltype(Fl_Labeltype a) {labeltype_ = a;}
-
- /**
- Gets the menu item's label color.
- This color is passed to the labeltype routine, and is typically the
- color of the label text. This defaults to FL_BLACK. If this
- color is not black fltk will \b not use overlay bitplanes to draw
- the menu - this is so that images put in the menu draw correctly.
- */
- Fl_Color labelcolor() const {return labelcolor_;}
-
- /**
- Sets the menu item's label color.
- \see Fl_Color Fl_Menu_Item::labelcolor() const
- */
- void labelcolor(Fl_Color a) {labelcolor_ = a;}
- /**
- Gets the menu item's label font.
- Fonts are identified by small 8-bit indexes into a table. See the
- enumeration list for predefined fonts. The default value is a
- Helvetica font. The function Fl::set_font() can define new fonts.
- */
- Fl_Font labelfont() const {return labelfont_;}
-
- /**
- Sets the menu item's label font.
- Fonts are identified by small 8-bit indexes into a table. See the
- enumeration list for predefined fonts. The default value is a
- Helvetica font. The function Fl::set_font() can define new fonts.
- */
- void labelfont(Fl_Font a) {labelfont_ = a;}
-
- /** Gets the label font pixel size/height. */
- Fl_Fontsize labelsize() const {return labelsize_;}
-
- /** Sets the label font pixel size/height.*/
- void labelsize(Fl_Fontsize a) {labelsize_ = a;}
-
- /**
- Returns the callback function that is set for the menu item.
- Each item has space for a callback function and an argument for that
- function. Due to back compatibility, the Fl_Menu_Item itself
- is not passed to the callback, instead you have to get it by calling
- ((Fl_Menu_*)w)->mvalue() where w is the widget argument.
- */
- Fl_Callback_p callback() const {return callback_;}
-
- /**
- Sets the menu item's callback function and userdata() argument.
- \see Fl_Callback_p Fl_MenuItem::callback() const
- */
- void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;}
-
- /**
- Sets the menu item's callback function.
- This method does not set the userdata() argument.
- \see Fl_Callback_p Fl_MenuItem::callback() const
- */
- void callback(Fl_Callback* c) {callback_=c;}
-
- /**
- Sets the menu item's callback function.
- This method does not set the userdata() argument.
- \see Fl_Callback_p Fl_MenuItem::callback() const
- */
- void callback(Fl_Callback0*c) {callback_=(Fl_Callback*)c;}
-
- /**
- Sets the menu item's callback function and userdata() argument.
- This method does not set the userdata() argument.
- The argument \p is cast to void* and stored as the userdata()
- for the menu item's callback function.
- \see Fl_Callback_p Fl_MenuItem::callback() const
- */
- void callback(Fl_Callback1*c, long p=0) {callback_=(Fl_Callback*)c; user_data_=(void*)p;}
-
- /**
- Gets the user_data() argument that is sent to the callback function.
- */
- void* user_data() const {return user_data_;}
- /**
- Sets the user_data() argument that is sent to the callback function.
- */
- void user_data(void* v) {user_data_ = v;}
- /**
- Gets the user_data() argument that is sent to the callback function.
- For convenience you can also define the callback as taking a long
- argument. This method casts the stored userdata() argument to long
- and returns it as a \e long value.
- */
- long argument() const {return (long)(fl_intptr_t)user_data_;}
- /**
- Sets the user_data() argument that is sent to the callback function.
- For convenience you can also define the callback as taking a long
- argument. This method casts the given argument \p v to void*
- and stores it in the menu item's userdata() member.
- This may not be portable to some machines.
- */
- void argument(long v) {user_data_ = (void*)v;}
-
- /** Gets what key combination shortcut will trigger the menu item. */
- int shortcut() const {return shortcut_;}
-
- /**
- Sets exactly what key combination will trigger the menu item. The
- value is a logical 'or' of a key and a set of shift flags, for instance
- FL_ALT+'a' or FL_ALT+FL_F+10 or just 'a'. A value of
- zero disables the shortcut.
-
- The key can be any value returned by Fl::event_key(), but will usually
- be an ASCII letter. Use a lower-case letter unless you require the shift
- key to be held down.
-
- The shift flags can be any set of values accepted by Fl::event_state().
- If the bit is on that shift key must be pushed. Meta, Alt, Ctrl,
- and Shift must be off if they are not in the shift flags (zero for the
- other bits indicates a "don't care" setting).
- */
- void shortcut(int s) {shortcut_ = s;}
- /**
- Returns true if either FL_SUBMENU or FL_SUBMENU_POINTER
- is on in the flags. FL_SUBMENU indicates an embedded submenu
- that goes from the next item through the next one with a NULL
- label(). FL_SUBMENU_POINTER indicates that user_data()
- is a pointer to another menu array.
- */
- int submenu() const {return flags&(FL_SUBMENU|FL_SUBMENU_POINTER);}
- /**
- Returns true if a checkbox will be drawn next to this item.
- This is true if FL_MENU_TOGGLE or FL_MENU_RADIO is set in the flags.
- */
- int checkbox() const {return flags&FL_MENU_TOGGLE;}
- /**
- Returns true if this item is a radio item.
- When a radio button is selected all "adjacent" radio buttons are
- turned off. A set of radio items is delimited by an item that has
- radio() false, or by an item with FL_MENU_DIVIDER turned on.
- */
- int radio() const {return flags&FL_MENU_RADIO;}
- /** Returns the current value of the check or radio item. */
- int value() const {return flags&FL_MENU_VALUE;}
- /**
- Turns the check or radio item "on" for the menu item. Note that this
- does not turn off any adjacent radio items like set_only() does.
- */
- void set() {flags |= FL_MENU_VALUE;}
-
- /** Turns the check or radio item "off" for the menu item. */
- void clear() {flags &= ~FL_MENU_VALUE;}
-
- void setonly();
-
- /** Gets the visibility of an item. */
- int visible() const {return !(flags&FL_MENU_INVISIBLE);}
-
- /** Makes an item visible in the menu. */
- void show() {flags &= ~FL_MENU_INVISIBLE;}
-
- /** Hides an item in the menu. */
- void hide() {flags |= FL_MENU_INVISIBLE;}
-
- /** Gets whether or not the item can be picked. */
- int active() const {return !(flags&FL_MENU_INACTIVE);}
-
- /** Allows a menu item to be picked. */
- void activate() {flags &= ~FL_MENU_INACTIVE;}
- /**
- Prevents a menu item from being picked. Note that this will also cause
- the menu item to appear grayed-out.
- */
- void deactivate() {flags |= FL_MENU_INACTIVE;}
- /** Returns non 0 if FL_INACTIVE and FL_INVISIBLE are cleared, 0 otherwise. */
- int activevisible() const {return !(flags & (FL_MENU_INACTIVE|FL_MENU_INVISIBLE));}
-
- // compatibility for FLUID so it can set the image of a menu item...
-
- /** compatibility api for FLUID, same as a->label(this) */
- void image(Fl_Image* a) {a->label(this);}
-
- /** compatibility api for FLUID, same as a.label(this) */
- void image(Fl_Image& a) {a.label(this);}
-
- // used by menubar:
- int measure(int* h, const Fl_Menu_*) const;
- void draw(int x, int y, int w, int h, const Fl_Menu_*, int t=0) const;
-
- // popup menus without using an Fl_Menu_ widget:
- const Fl_Menu_Item* popup(
- int X, int Y,
- const char *title = 0,
- const Fl_Menu_Item* picked=0,
- const Fl_Menu_* = 0) const;
- const Fl_Menu_Item* pulldown(
- int X, int Y, int W, int H,
- const Fl_Menu_Item* picked = 0,
- const Fl_Menu_* = 0,
- const Fl_Menu_Item* title = 0,
- int menubar=0) const;
- const Fl_Menu_Item* test_shortcut() const;
- const Fl_Menu_Item* find_shortcut(int *ip=0, const bool require_alt = false) const;
-
- /**
- Calls the Fl_Menu_Item item's callback, and provides the Fl_Widget argument.
- The callback is called with the stored user_data() as its second argument.
- You must first check that callback() is non-zero before calling this.
- */
- void do_callback(Fl_Widget* o) const {callback_(o, user_data_);}
-
- /**
- Calls the Fl_Menu_Item item's callback, and provides the Fl_Widget argument.
- This call overrides the callback's second argument with the given value \p arg.
- You must first check that callback() is non-zero before calling this.
- */
- void do_callback(Fl_Widget* o,void* arg) const {callback_(o, arg);}
-
- /**
- Calls the Fl_Menu_Item item's callback, and provides the Fl_Widget argument.
- This call overrides the callback's second argument with the
- given value \p arg. long \p arg is cast to void* when calling
- the callback.
- You must first check that callback() is non-zero before calling this.
- */
- void do_callback(Fl_Widget* o,long arg) const {callback_(o, (void*)arg);}
-
- // back-compatibility, do not use:
-
- /** back compatibility only \deprecated. */
- int checked() const {return flags&FL_MENU_VALUE;}
-
- /** back compatibility only \deprecated. */
- void check() {flags |= FL_MENU_VALUE;}
-
- /** back compatibility only \deprecated. */
- void uncheck() {flags &= ~FL_MENU_VALUE;}
-
- int insert(int,const char*,int,Fl_Callback*,void* =0, int =0);
- int add(const char*, int shortcut, Fl_Callback*, void* =0, int = 0);
-
- /** See int add(const char*, int shortcut, Fl_Callback*, void*, int) */
- int add(const char*a, const char* b, Fl_Callback* c,
- void* d = 0, int e = 0) {
- return add(a,fl_old_shortcut(b),c,d,e);}
-
- int size() const ;
-};
-
-typedef Fl_Menu_Item Fl_Menu; // back compatibility
-
-enum { // back-compatibility enum:
- FL_PUP_NONE = 0,
- FL_PUP_GREY = FL_MENU_INACTIVE,
- FL_PUP_GRAY = FL_MENU_INACTIVE,
- FL_MENU_BOX = FL_MENU_TOGGLE,
- FL_PUP_BOX = FL_MENU_TOGGLE,
- FL_MENU_CHECK = FL_MENU_VALUE,
- FL_PUP_CHECK = FL_MENU_VALUE,
- FL_PUP_RADIO = FL_MENU_RADIO,
- FL_PUP_INVISIBLE = FL_MENU_INVISIBLE,
- FL_PUP_SUBMENU = FL_SUBMENU_POINTER
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Menu_Item.H 7983 2010-12-09 00:04:06Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Menu_Window.H b/Libraries/FL/Fl_Menu_Window.H
deleted file mode 100644
index cca5a97d..00000000
--- a/Libraries/FL/Fl_Menu_Window.H
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// "$Id: Fl_Menu_Window.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Menu window header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Menu_Window widget . */
-
-#ifndef Fl_Menu_Window_H
-#define Fl_Menu_Window_H
-
-#include "Fl_Single_Window.H"
-
-/**
- The Fl_Menu_Window widget is a window type used for menus. By
- default the window is drawn in the hardware overlay planes if they are
- available so that the menu don't force the rest of the window to
- redraw.
-*/
-class FL_EXPORT Fl_Menu_Window : public Fl_Single_Window {
-public:
- void show();
- void erase();
- void flush();
- void hide();
- /** Tells if hardware overlay mode is set */
- unsigned int overlay() {return !(flags()&NO_OVERLAY);}
- /** Tells FLTK to use hardware overlay planes if they are available. */
- void set_overlay() {clear_flag(NO_OVERLAY);}
- /** Tells FLTK to use normal drawing planes instead of overlay planes.
- This is usually necessary if your menu contains multi-color pixmaps. */
- void clear_overlay() {set_flag(NO_OVERLAY);}
- ~Fl_Menu_Window();
- /** Creates a new Fl_Menu_Window widget using the given size, and label string. */
- Fl_Menu_Window(int W, int H, const char *l = 0)
- : Fl_Single_Window(W,H,l) { image(0); }
- /** Creates a new Fl_Menu_Window widget using the given position, size, and label string. */
- Fl_Menu_Window(int X, int Y, int W, int H, const char *l = 0)
- : Fl_Single_Window(X,Y,W,H,l) { image(0); }
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Menu_Window.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Multi_Browser.H b/Libraries/FL/Fl_Multi_Browser.H
deleted file mode 100644
index 6a866111..00000000
--- a/Libraries/FL/Fl_Multi_Browser.H
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// "$Id: Fl_Multi_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $"
-//
-// Multi browser header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Multi_Browser widget . */
-
-#ifndef Fl_Multi_Browser_H
-#define Fl_Multi_Browser_H
-
-#include "Fl_Browser.H"
-
-/**
- The Fl_Multi_Browser class is a subclass of Fl_Browser
- which lets the user select any set of the lines. The user interface
- is Macintosh style: clicking an item turns off all the others and
- selects that one, dragging selects all the items the mouse moves over,
- and shift + click toggles the items. This is different then how forms
- did it. Normally the callback is done when the user releases the
- mouse, but you can change this with when().
- <P>See Fl_Browser for methods to add and remove lines from the browser.
-*/
-class FL_EXPORT Fl_Multi_Browser : public Fl_Browser {
-public:
- /**
- Creates a new Fl_Multi_Browser widget using the given
- position, size, and label string. The default boxtype is FL_DOWN_BOX.
- The constructor specializes Fl_Browser() by setting the type to FL_MULTI_BROWSER.
- The destructor destroys the widget and frees all memory that has been allocated.
- */
-#if defined(FL_DLL) // implementation in src/Fl_Browser.cxx
- Fl_Multi_Browser(int X,int Y,int W,int H,const char *L=0);
-#else
- Fl_Multi_Browser(int X,int Y,int W,int H,const char *L=0)
- : Fl_Browser(X,Y,W,H,L) {type(FL_MULTI_BROWSER);}
-#endif
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Multi_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Multi_Label.H b/Libraries/FL/Fl_Multi_Label.H
deleted file mode 100644
index 0b160d13..00000000
--- a/Libraries/FL/Fl_Multi_Label.H
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// "$Id: Fl_Multi_Label.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Multi-label header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-#ifndef Fl_Multi_Label_H
-#define Fl_Multi_Label_H
-
-class Fl_Widget;
-struct Fl_Menu_Item;
-
-struct FL_EXPORT Fl_Multi_Label {
- const char* labela;
- const char* labelb;
- uchar typea;
- uchar typeb;
- void label(Fl_Widget*);
- void label(Fl_Menu_Item*);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Multi_Label.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Multiline_Input.H b/Libraries/FL/Fl_Multiline_Input.H
deleted file mode 100644
index a22bfaa3..00000000
--- a/Libraries/FL/Fl_Multiline_Input.H
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// "$Id: Fl_Multiline_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
-//
-// Multiline input header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Multiline_Input widget . */
-
-
-#ifndef Fl_Multiline_Input_H
-#define Fl_Multiline_Input_H
-
-#include "Fl_Input.H"
-
-/**
- This input field displays '\n' characters as new lines rather than ^J,
- and accepts the Return, Tab, and up and down arrow keys. This is for
- editing multiline text.
-
- This is far from the nirvana of text editors, and is probably only
- good for small bits of text, 10 lines at most. Note that this widget
- does not support scrollbars or per-character color control.
-
- If you are presenting large amounts of text and need scrollbars
- or full color control of characters, you probably want Fl_Text_Editor
- instead.
-
- In FLTK 1.3.x, the default behavior of the 'Tab' key was changed
- to support consistent focus navigation. To get the older FLTK 1.1.x
- behavior, set Fl_Input_::tab_nav() to 0. Newer programs should consider using
- Fl_Text_Editor.
-*/
-class FL_EXPORT Fl_Multiline_Input : public Fl_Input {
-public:
- /**
- Creates a new Fl_Multiline_Input widget using the given
- position, size, and label string. The default boxtype is FL_DOWN_BOX.
-
- Inherited destructor destroys the widget and any value associated with it.
- */
-#if defined(FL_DLL) // implementation in src/Fl_Input.cxx
- Fl_Multiline_Input(int X,int Y,int W,int H,const char *l = 0);
-#else
- Fl_Multiline_Input(int X,int Y,int W,int H,const char *l = 0)
- : Fl_Input(X,Y,W,H,l) {type(FL_MULTILINE_INPUT);}
-#endif
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Multiline_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Multiline_Output.H b/Libraries/FL/Fl_Multiline_Output.H
deleted file mode 100644
index 087d6ed6..00000000
--- a/Libraries/FL/Fl_Multiline_Output.H
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// "$Id: Fl_Multiline_Output.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
-//
-// Multi line output header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Multiline_Output widget . */
-
-#ifndef Fl_Multiline_Output_H
-#define Fl_Multiline_Output_H
-
-#include "Fl_Output.H"
-
-/**
- This widget is a subclass of Fl_Output that displays multiple
- lines of text. It also displays tab characters as whitespace to the
- next column.
-
- Note that this widget does not support scrollbars, or per-character
- color control.
-
- If you are presenting large amounts of read-only text
- and need scrollbars, or full color control of characters,
- then use Fl_Text_Display. If you want to display HTML text,
- use Fl_Help_View.
-*/
-class FL_EXPORT Fl_Multiline_Output : public Fl_Output {
-public:
-
- /**
- Creates a new Fl_Multiline_Output widget using the given position,
- size, and label string. The default boxtype is FL_DOWN_BOX.
-
- Inherited destructor destroys the widget and any value associated with it.
- */
-#if defined(FL_DLL) // implementation in src/Fl_Input.cxx
- Fl_Multiline_Output(int X,int Y,int W,int H,const char *l = 0);
-#else
- Fl_Multiline_Output(int X,int Y,int W,int H,const char *l = 0)
- : Fl_Output(X,Y,W,H,l) {type(FL_MULTILINE_OUTPUT);}
-#endif
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Multiline_Output.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Native_File_Chooser.H b/Libraries/FL/Fl_Native_File_Chooser.H
deleted file mode 100644
index ad76c68d..00000000
--- a/Libraries/FL/Fl_Native_File_Chooser.H
+++ /dev/null
@@ -1,305 +0,0 @@
-//
-// "$Id: Fl_Native_File_Chooser.H 8380 2011-02-06 10:07:28Z manolo $"
-//
-// FLTK native OS file chooser widget
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-// Copyright 2004 Greg Ercolano.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/** \file
- Fl_Native_File_Chooser widget. */
-
-/**
- \class Fl_Native_File_Chooser
-
- This class lets an FLTK application easily and consistently access
- the operating system's native file chooser. Some operating systems
- have very complex and specific file choosers that many users want
- access to specifically, instead of FLTK's default file chooser(s).
-
- In cases where there is no native file browser, FLTK's own file browser
- is used instead.
-
- To use this widget correctly, use the following include in your code:
- \code
- #include <FL/Fl_Native_File_Chooser.H>
- \endcode
- Do not include the other Fl_Native_File_Choser_XXX.H files in your code;
- those are platform specific files that will be included automatically
- depending on your build platform.
-
- The following example shows how to pick a single file:
- \code
- // Create and post the local native file chooser
- #include <FL/Fl_Native_File_Chooser.H>
- [..]
- Fl_Native_File_Chooser fnfc;
- fnfc.title("Pick a file");
- fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE);
- fnfc.filter("Text\t*.txt\n"
- "C Files\t*.{cxx,h,c}");
- fnfc.directory("/var/tmp"); // default directory to use
- // Show native chooser
- switch ( fnfc.show() ) {
- case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR
- case 1: printf("CANCEL\n"); break; // CANCEL
- default: printf("PICKED: %s\n", fnfc.filename()); break; // FILE CHOSEN
- }
- \endcode
-
- <B>Platform Specific Caveats</B>
-
- - Under X windows, it's best if you call Fl_File_Icon::load_system_icons()
- at the start of main(), to enable the nicer looking file browser widgets.
- Use the static public attributes of class Fl_File_Chooser to localize
- the browser.
- - Some operating systems support certain OS specific options; see
- Fl_Native_File_Chooser::options() for a list.
-
- \image html Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms."
- \image latex Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms" width=14cm
-
-*/
-#ifndef FL_NATIVE_FILE_CHOOSER_H
-#define FL_NATIVE_FILE_CHOOSER_H
-
-/* \file
- Fl_Native_File_Chooser widget. */
-
-// Use Windows' chooser
-#ifdef WIN32
-// #define _WIN32_WINNT 0x0501 // needed for OPENFILENAME's 'FlagsEx'
-#include <stdio.h>
-#include <stdlib.h> // malloc
-#include <windows.h>
-#include <commdlg.h> // OPENFILENAME, GetOpenFileName()
-#include <shlobj.h> // BROWSEINFO, SHBrowseForFolder()
-#endif
-
-// Use Apple's chooser
-#ifdef __APPLE__
-#include <FL/filename.H>
-#define MAXFILTERS 80
-#endif
-
-// All else falls back to FLTK's own chooser
-#if ! defined(__APPLE__) && !defined(WIN32)
-#include <FL/Fl_File_Chooser.H>
-#include <unistd.h> // _POSIX_NAME_MAX
-#endif
-
-
-/**
- This class lets an FLTK application easily and consistently access
- the operating system's native file chooser. Some operating systems
- have very complex and specific file choosers that many users want
- access to specifically, instead of FLTK's default file chooser(s).
-
- In cases where there is no native file browser, FLTK's own file browser
- is used instead.
-
- To use this widget, use the following include in your code:
- \code
- #include <FL/Fl_Native_File_Chooser.H>
- \endcode
-
- The following example shows how to pick a single file:
- \code
- // Create and post the local native file chooser
- #include <FL/Fl_Native_File_Chooser.H>
- [..]
- Fl_Native_File_Chooser fnfc;
- fnfc.title("Pick a file");
- fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE);
- fnfc.filter("Text\t*.txt\n"
- "C Files\t*.{cxx,h,c}");
- fnfc.directory("/var/tmp"); // default directory to use
- // Show native chooser
- switch ( fnfc.show() ) {
- case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR
- case 1: printf("CANCEL\n"); break; // CANCEL
- default: printf("PICKED: %s\n", fnfc.filename()); break; // FILE CHOSEN
- }
- \endcode
-
- <B>Platform Specific Caveats</B>
-
- - Under X windows, it's best if you call Fl_File_Icon::load_system_icons()
- at the start of main(), to enable the nicer looking file browser widgets.
- Use the static public attributes of class Fl_File_Chooser to localize
- the browser.
- - Some operating systems support certain OS specific options; see
- Fl_Native_File_Chooser::options() for a list.
-
- \image html Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms."
- \image latex Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms" width=14cm
-
- */
-class FL_EXPORT Fl_Native_File_Chooser {
-public:
- enum Type {
- BROWSE_FILE = 0, ///< browse files (lets user choose one file)
- BROWSE_DIRECTORY, ///< browse directories (lets user choose one directory)
- BROWSE_MULTI_FILE, ///< browse files (lets user choose multiple files)
- BROWSE_MULTI_DIRECTORY, ///< browse directories (lets user choose multiple directories)
- BROWSE_SAVE_FILE, ///< browse to save a file
- BROWSE_SAVE_DIRECTORY ///< browse to save a directory
- };
- enum Option {
- NO_OPTIONS = 0x0000, ///< no options enabled
- SAVEAS_CONFIRM = 0x0001, ///< Show native 'Save As' overwrite confirm dialog (if supported)
- NEW_FOLDER = 0x0002, ///< Show 'New Folder' icon (if supported)
- PREVIEW = 0x0004 ///< enable preview mode
- };
- /** Localizable message */
- static const char *file_exists_message;
-
-public:
- Fl_Native_File_Chooser(int val=BROWSE_FILE);
- ~Fl_Native_File_Chooser();
-
- // Public methods
- void type(int);
- int type() const;
- void options(int);
- int options() const;
- int count() const;
- const char *filename() const;
- const char *filename(int i) const;
- void directory(const char *val);
- const char *directory() const;
- void title(const char *);
- const char* title() const;
- const char *filter() const;
- void filter(const char *);
- int filters() const;
- void filter_value(int i);
- int filter_value() const;
- void preset_file(const char*);
- const char* preset_file() const;
- const char *errmsg() const;
- int show();
-
-#ifdef WIN32
-private:
- int _btype; // kind-of browser to show()
- int _options; // general options
- OPENFILENAMEW _ofn; // GetOpenFileName() & GetSaveFileName() struct
- BROWSEINFO _binf; // SHBrowseForFolder() struct
- char **_pathnames; // array of pathnames
- int _tpathnames; // total pathnames
- char *_directory; // default pathname to use
- char *_title; // title for window
- char *_filter; // user-side search filter
- char *_parsedfilt; // filter parsed for Windows dialog
- int _nfilters; // number of filters parse_filter counted
- char *_preset_file; // the file to preselect
- char *_errmsg; // error message
-
- // Private methods
- void errmsg(const char *msg);
-
- void clear_pathnames();
- void set_single_pathname(const char *s);
- void add_pathname(const char *s);
-
- void FreePIDL(ITEMIDLIST *pidl);
- void ClearOFN();
- void ClearBINF();
- void Win2Unix(char *s);
- void Unix2Win(char *s);
- int showfile();
- static int CALLBACK Dir_CB(HWND win, UINT msg, LPARAM param, LPARAM data);
- int showdir();
-
- void parse_filter(const char *);
- void clear_filters();
- void add_filter(const char *, const char *);
-#endif
-
-#ifdef __APPLE__
-private:
- int _btype; // kind-of browser to show()
- int _options; // general options
- void *_panel;
- char **_pathnames; // array of pathnames
- int _tpathnames; // total pathnames
- char *_directory; // default pathname to use
- char *_title; // title for window
- char *_preset_file; // the 'save as' filename
-
- char *_filter; // user-side search filter, eg:
- // C Files\t*.[ch]\nText Files\t*.txt"
-
- char *_filt_names; // filter names (tab delimited)
- // eg. "C Files\tText Files"
-
- char *_filt_patt[MAXFILTERS];
- // array of filter patterns, eg:
- // _filt_patt[0]="*.{cxx,h}"
- // _filt_patt[1]="*.txt"
-
- int _filt_total; // parse_filter() # of filters loaded
- int _filt_value; // index of the selected filter
- char *_errmsg; // error message
-
- // Private methods
- void errmsg(const char *msg);
- void clear_pathnames();
- void set_single_pathname(const char *s);
- int get_saveas_basename(void);
- void clear_filters();
- void add_filter(const char *, const char *);
- void parse_filter(const char *from);
- int post();
-#endif
-
-#if ! defined(__APPLE__) && !defined(WIN32)
-private:
- int _btype; // kind-of browser to show()
- int _options; // general options
- int _nfilters;
- char *_filter; // user supplied filter
- char *_parsedfilt; // parsed filter
- int _filtvalue; // selected filter
- char *_preset_file;
- char *_prevvalue; // Returned filename
- char *_directory;
- char *_errmsg; // error message
- Fl_File_Chooser *_file_chooser;
-
- // Private methods
- void errmsg(const char *msg);
- int type_fl_file(int);
- void parse_filter();
- void keeplocation();
- int exist_dialog();
-#endif
-};
-
-
-#endif /*FL_NATIVE_FILE_CHOOSER_H*/
-
-//
-// End of "$Id: Fl_Native_File_Chooser.H 8380 2011-02-06 10:07:28Z manolo $".
-//
diff --git a/Libraries/FL/Fl_Nice_Slider.H b/Libraries/FL/Fl_Nice_Slider.H
deleted file mode 100644
index 591a8333..00000000
--- a/Libraries/FL/Fl_Nice_Slider.H
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// "$Id: Fl_Nice_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// "Nice" slider header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Nice_Slider widget . */
-
-#ifndef Fl_Nice_Slider_H
-#define Fl_Nice_Slider_H
-
-#include "Fl_Slider.H"
-
-class FL_EXPORT Fl_Nice_Slider : public Fl_Slider {
-public:
- Fl_Nice_Slider(int x,int y,int w,int h,const char *l=0)
- : Fl_Slider(x,y,w,h,l) {type(FL_VERT_NICE_SLIDER); box(FL_FLAT_BOX);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Nice_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Object.H b/Libraries/FL/Fl_Object.H
deleted file mode 100644
index c743999f..00000000
--- a/Libraries/FL/Fl_Object.H
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// "$Id: Fl_Object.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Old Fl_Object header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-// This file is provided for back compatibility only. Please use Fl_Widget
-#ifndef Fl_Object
-#define Fl_Object Fl_Widget
-#endif
-#include "Fl_Widget.H"
-
-//
-// End of "$Id: Fl_Object.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Output.H b/Libraries/FL/Fl_Output.H
deleted file mode 100644
index 51cc0348..00000000
--- a/Libraries/FL/Fl_Output.H
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// "$Id: Fl_Output.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
-//
-// Output header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Output widget . */
-
-#ifndef Fl_Output_H
-#define Fl_Output_H
-
-#include "Fl_Input.H"
-/**
- This widget displays a piece of text.
-
- When you set the value() , Fl_Output does a strcpy() to its own storage,
- which is useful for program-generated values. The user may select
- portions of the text using the mouse and paste the contents into other
- fields or programs.
-
- <P align=CENTER>\image html text.png</P>
- \image latex text.png "Fl_Output" width=8cm
-
- There is a single subclass, Fl_Multiline_Output, which allows you to
- display multiple lines of text. Fl_Multiline_Output does not provide
- scroll bars. If a more complete text editing widget is needed, use
- Fl_Text_Display instead.
-
- The text may contain any characters except \\0, and will correctly
- display anything, using ^X notation for unprintable control characters
- and \\nnn notation for unprintable characters with the high bit set. It
- assumes the font can draw any characters in the ISO-Latin1 character set.
-*/
-class FL_EXPORT Fl_Output : public Fl_Input {
-public:
- /**
- Creates a new Fl_Output widget using the given position,
- size, and label string. The default boxtype is FL_DOWN_BOX.
-
- Inherited destructor destroys the widget and any value associated with it.
- */
-
-#if defined(FL_DLL) // implementation in src/Fl_Input.cxx
- Fl_Output(int X,int Y,int W,int H, const char *l = 0);
-#else
- Fl_Output(int X,int Y,int W,int H, const char *l = 0)
- : Fl_Input(X, Y, W, H, l) {type(FL_NORMAL_OUTPUT);}
-#endif
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Output.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Overlay_Window.H b/Libraries/FL/Fl_Overlay_Window.H
deleted file mode 100644
index 918b6710..00000000
--- a/Libraries/FL/Fl_Overlay_Window.H
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// "$Id: Fl_Overlay_Window.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Overlay window header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Overlay_Window class . */
-
-#ifndef Fl_Overlay_Window_H
-#define Fl_Overlay_Window_H
-
-#include "Fl_Double_Window.H"
-
-/**
- This window provides double buffering and also the ability to draw the
- "overlay" which is another picture placed on top of the main image. The
- overlay is designed to be a rapidly-changing but simple graphic such as
- a mouse selection box. Fl_Overlay_Window uses the overlay
- planes provided by your graphics hardware if they are available.
- <P>If no hardware support is found the overlay is simulated by drawing
- directly into the on-screen copy of the double-buffered window, and
- "erased" by copying the backbuffer over it again. This means the
- overlay will blink if you change the image in the window.
-*/
-class FL_EXPORT Fl_Overlay_Window : public Fl_Double_Window {
- friend class _Fl_Overlay;
- virtual void draw_overlay() = 0;
- Fl_Window *overlay_;
-public:
- void show();
- void flush();
- void hide();
- void resize(int,int,int,int);
- ~Fl_Overlay_Window();
- int can_do_overlay();
- void redraw_overlay();
- /**
- Creates a new Fl_Overlay_Window widget using the given
- position, size, and label (title) string. If the
- positions (x,y) are not given, then the window manager
- will choose them.
- */
- Fl_Overlay_Window(int W, int H, const char *l=0)
- : Fl_Double_Window(W,H,l) {overlay_ = 0; force_doublebuffering_=1; image(0); }
- /**
- See Fl_Overlay_Window::Fl_Overlay_Window(int W, int H, const char *l=0)
- */
- Fl_Overlay_Window(int X, int Y, int W, int H, const char *l=0)
- : Fl_Double_Window(X,Y,W,H,l) {overlay_ = 0; force_doublebuffering_=1; image(0); }
- void show(int a, char **b) {Fl_Double_Window::show(a,b);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Overlay_Window.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_PNG_Image.H b/Libraries/FL/Fl_PNG_Image.H
deleted file mode 100644
index 995b8017..00000000
--- a/Libraries/FL/Fl_PNG_Image.H
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// "$Id: Fl_PNG_Image.H 8287 2011-01-17 20:51:12Z manolo $"
-//
-// PNG image header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_PNG_Image class . */
-
-#ifndef Fl_PNG_Image_H
-#define Fl_PNG_Image_H
-# include "Fl_Image.H"
-
-/**
- The Fl_PNG_Image class supports loading, caching,
- and drawing of Portable Network Graphics (PNG) image files. The
- class loads colormapped and full-color images and handles color-
- and alpha-based transparency.
-*/
-class FL_EXPORT Fl_PNG_Image : public Fl_RGB_Image {
-
-public:
-
- Fl_PNG_Image(const char* filename);
- Fl_PNG_Image (const char *name_png, const unsigned char *buffer, int datasize);
-private:
- void load_png_(const char *name_png, const unsigned char *buffer_png, int datasize);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_PNG_Image.H 8287 2011-01-17 20:51:12Z manolo $".
-//
diff --git a/Libraries/FL/Fl_PNM_Image.H b/Libraries/FL/Fl_PNM_Image.H
deleted file mode 100644
index 739fc07e..00000000
--- a/Libraries/FL/Fl_PNM_Image.H
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// "$Id: Fl_PNM_Image.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// PNM image header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_PNM_Image class . */
-
-#ifndef Fl_PNM_Image_H
-#define Fl_PNM_Image_H
-# include "Fl_Image.H"
-
-/**
- The Fl_PNM_Image class supports loading, caching,
- and drawing of Portable Anymap (PNM, PBM, PGM, PPM) image files. The class
- loads bitmap, grayscale, and full-color images in both ASCII and
- binary formats.
-*/
-class FL_EXPORT Fl_PNM_Image : public Fl_RGB_Image {
-
- public:
-
- Fl_PNM_Image(const char* filename);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_PNM_Image.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Pack.H b/Libraries/FL/Fl_Pack.H
deleted file mode 100644
index 4ff3ae44..00000000
--- a/Libraries/FL/Fl_Pack.H
+++ /dev/null
@@ -1,84 +0,0 @@
-//
-// "$Id: Fl_Pack.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Pack header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Pack widget . */
-
-#ifndef Fl_Pack_H
-#define Fl_Pack_H
-
-#include <FL/Fl_Group.H>
-
-/**
- This widget was designed to add the functionality of compressing and
- aligning widgets.
- <P>If type() is Fl_Pack::HORIZONTAL all the children are
- resized to the height of the Fl_Pack, and are moved next to
- each other horizontally. If type() is not Fl_Pack::HORIZONTAL
- then the children are resized to the width and are stacked below each
- other. Then the Fl_Pack resizes itself to surround the child
- widgets.
- <P>This widget is needed for the Fl_Tabs.
- In addition you may want to put the Fl_Pack inside an
- Fl_Scroll.
-
- <P>The resizable for Fl_Pack is set to NULL by default.</p>
- <P>See also: Fl_Group::resizable()
-*/
-class FL_EXPORT Fl_Pack : public Fl_Group {
- int spacing_;
-
-public:
- enum { // values for type(int)
- VERTICAL = 0,
- HORIZONTAL = 1
- };
-
-protected:
- void draw();
-
-public:
- Fl_Pack(int x,int y,int w ,int h,const char *l = 0);
- /**
- Gets the number of extra pixels of blank space that are added
- between the children.
- */
- int spacing() const {return spacing_;}
- /**
- Sets the number of extra pixels of blank space that are added
- between the children.
- */
- void spacing(int i) {spacing_ = i;}
- /** Same as Fl_Group::type() */
- uchar horizontal() const {return type();}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Pack.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Paged_Device.H b/Libraries/FL/Fl_Paged_Device.H
deleted file mode 100644
index f65da3a9..00000000
--- a/Libraries/FL/Fl_Paged_Device.H
+++ /dev/null
@@ -1,153 +0,0 @@
-//
-// "$Id: Fl_Paged_Device.H 8699 2011-05-20 16:39:06Z manolo $"
-//
-// Printing support for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/** \file Fl_Paged_Device.H
- \brief declaration of class Fl_Paged_Device.
- */
-
-#ifndef Fl_Paged_Device_H
-#define Fl_Paged_Device_H
-
-#include <FL/Fl_Device.H>
-#include <FL/Fl_Window.H>
-
-/** \brief Number of elements in enum Page_Format */
-#define NO_PAGE_FORMATS 30 /* MSVC6 compilation fix */
-
-/**
- \brief Represents page-structured drawing surfaces.
- *
- This class has no public constructor: don't instantiate it; use Fl_Printer
- or Fl_PostScript_File_Device instead.
- */
-class FL_EXPORT Fl_Paged_Device : public Fl_Surface_Device {
-public:
- /**
- \brief Possible page formats.
-
- All paper formats with pre-defined width and height.
- */
- enum Page_Format {
- A0 = 0, /**< A0 format */
- A1,
- A2,
- A3,
- A4, /**< A4 format */
- A5,
- A6,
- A7,
- A8,
- A9,
- B0,
- B1,
- B2,
- B3,
- B4,
- B5,
- B6,
- B7,
- B8,
- B9,
- B10,
- C5E,
- DLE,
- EXECUTIVE,
- FOLIO,
- LEDGER,
- LEGAL,
- LETTER, /**< Letter format */
- TABLOID,
- ENVELOPE,
- MEDIA = 0x1000
- };
- /**
- \brief Possible page layouts.
- */
- enum Page_Layout {
- PORTRAIT = 0, /**< Portrait orientation */
- LANDSCAPE = 0x100, /**< Landscape orientation */
- REVERSED = 0x200, /**< Reversed orientation */
- ORIENTATION = 0x300 /**< orientation */
- };
-
- /** \brief width, height and name of a page format
- */
- typedef struct {
- /** \brief width in points */
- int width;
- /** \brief height in points */
- int height;
- /** \brief format name */
- const char *name;
- } page_format;
- /** \brief width, height and name of all elements of the enum \ref Page_Format.
- */
- static const page_format page_formats[NO_PAGE_FORMATS];
-private:
- void traverse(Fl_Widget *widget); // finds subwindows of widget and prints them
-protected:
- /** \brief horizontal offset to the origin of graphics coordinates */
- int x_offset;
- /** \brief vertical offset to the origin of graphics coordinates */
- int y_offset;
- /** \brief The constructor */
- Fl_Paged_Device() : Fl_Surface_Device(NULL) {};
- /** \brief The destructor */
- virtual ~Fl_Paged_Device() {};
-public:
- static const char *class_id;
- const char *class_name() {return class_id;};
- virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
- virtual int start_page(void);
- virtual int printable_rect(int *w, int *h);
- virtual void margins(int *left, int *top, int *right, int *bottom);
- virtual void origin(int x, int y);
- virtual void origin(int *x, int *y);
- virtual void scale(float scale_x, float scale_y = 0.);
- virtual void rotate(float angle);
- virtual void translate(int x, int y);
- virtual void untranslate(void);
- virtual void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
- /** Prints a window with its title bar and frame if any.
-
- \p x_offset and \p y_offset are optional coordinates of where to position the window top left.
- Equivalent to print_widget() if \p win is a subwindow or has no border.
- Use Fl_Window::decorated_w() and Fl_Window::decorated_h() to get the size of the
- printed window.
- */
- void print_window(Fl_Window *win, int x_offset = 0, int y_offset = 0);
- virtual void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0);
- virtual int end_page (void);
- virtual void end_job (void);
-};
-
-#endif // Fl_Paged_Device_H
-
-//
-// End of "$Id: Fl_Paged_Device.H 8699 2011-05-20 16:39:06Z manolo $"
-//
-
diff --git a/Libraries/FL/Fl_Pixmap.H b/Libraries/FL/Fl_Pixmap.H
deleted file mode 100644
index bc6438b7..00000000
--- a/Libraries/FL/Fl_Pixmap.H
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// "$Id: Fl_Pixmap.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Pixmap header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Pixmap widget . */
-
-#ifndef Fl_Pixmap_H
-#define Fl_Pixmap_H
-# include "Fl_Image.H"
-
-class Fl_Widget;
-struct Fl_Menu_Item;
-
-// Older C++ compilers don't support the explicit keyword... :(
-# if defined(__sgi) && !defined(_COMPILER_VERSION)
-# define explicit
-# endif // __sgi && !_COMPILER_VERSION
-
-/**
- The Fl_Pixmap class supports caching and drawing of colormap
- (pixmap) images, including transparency.
-*/
-class FL_EXPORT Fl_Pixmap : public Fl_Image {
- friend class Fl_Quartz_Graphics_Driver;
- friend class Fl_GDI_Graphics_Driver;
- friend class Fl_Xlib_Graphics_Driver;
- void copy_data();
- void delete_data();
- void set_data(const char * const *p);
-
- protected:
-
- void measure();
-
- public:
-
- int alloc_data; // Non-zero if data was allocated
-
- private:
-
-#if defined(__APPLE__) || defined(WIN32)
- void *id_; // for internal use
- void *mask_; // for internal use (mask bitmap)
-#else
- unsigned id_; // for internal use
- unsigned mask_; // for internal use (mask bitmap)
-#endif // __APPLE__ || WIN32
-
- public:
-
- /** The constructors create a new pixmap from the specified XPM data. */
- explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
- /** The constructors create a new pixmap from the specified XPM data. */
- explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
- /** The constructors create a new pixmap from the specified XPM data. */
- explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
- /** The constructors create a new pixmap from the specified XPM data. */
- explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
- virtual ~Fl_Pixmap();
- virtual Fl_Image *copy(int W, int H);
- Fl_Image *copy() { return copy(w(), h()); }
- virtual void color_average(Fl_Color c, float i);
- virtual void desaturate();
- virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
- void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
- virtual void label(Fl_Widget*w);
- virtual void label(Fl_Menu_Item*m);
- virtual void uncache();
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Pixmap.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Plugin.H b/Libraries/FL/Fl_Plugin.H
deleted file mode 100644
index 62da3a23..00000000
--- a/Libraries/FL/Fl_Plugin.H
+++ /dev/null
@@ -1,104 +0,0 @@
-//
-// "$Id: Fl_Plugin.H 6995 2010-01-12 08:48:55Z matt $"
-//
-// A Plugin system for FLTK, implemented in Fl_Preferences.cxx.
-//
-// Copyright 2002-2010 by Matthias Melcher.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Plugin class . */
-
-#ifndef Fl_Plugin_H
-# define Fl_Plugin_H
-
-# include "Fl_Preferences.H"
-
-
-/**
- \brief Fl_Plugin allows link-time and run-time integration of binary modules.
-
- Fl_Plugin and Fl_Plugin_Manager provide a small and simple solution for
- linking C++ classes at run-time, or optionally linking modules at compile
- time without the need to change the main application.
-
- Fl_Plugin_Manager uses static initialisation to create the plugin interface
- early during startup. Plugins are stored in a temporary database, organized
- in classes.
-
- Plugins should derive a new class from Fl_Plugin as a base:
- \code
- class My_Plugin : public Fl_Plugin {
- public:
- My_Plugin() : Fl_Plugin("effects", "blur") { }
- void do_something(...);
- };
- My_Plugin blur_plugin();
- \endcode
-
- Plugins can be put into modules and either linked before distribution, or loaded
- from dynamically linkable files. An Fl_Plugin_Manager is used to list and
- access all currently loaded plugins.
- \code
- Fl_Plugin_Manager mgr("effects");
- int i, n = mgr.plugins();
- for (i=0; i<n; i++) {
- My_Plugin *pin = (My_Plugin*)mgr.plugin(i);
- pin->do_something();
- }
- \endcode
- */
-class FL_EXPORT Fl_Plugin {
- Fl_Preferences::ID id;
-public:
- Fl_Plugin(const char *klass, const char *name);
- virtual ~Fl_Plugin();
-};
-
-
-/**
- \brief Fl_Plugin_Manager manages link-time and run-time plugin binaries.
- \see Fl_Plugin
- */
-class FL_EXPORT Fl_Plugin_Manager : public Fl_Preferences {
-public:
- Fl_Plugin_Manager(const char *klass);
- ~Fl_Plugin_Manager();
-
- /** \brief Return the number of plugins in the klass.
- */
- int plugins() { return groups(); }
- Fl_Plugin *plugin(int index);
- Fl_Plugin *plugin(const char *name);
- Fl_Preferences::ID addPlugin(const char *name, Fl_Plugin *plugin);
-
- static void removePlugin(Fl_Preferences::ID id);
- static int load(const char *filename);
- static int loadAll(const char *filepath, const char *pattern=0);
-};
-
-
-#endif // !Fl_Preferences_H
-
-//
-// End of "$Id: Fl_Preferences.H 6995 2010-01-12 08:48:55Z matt $".
-//
diff --git a/Libraries/FL/Fl_Positioner.H b/Libraries/FL/Fl_Positioner.H
deleted file mode 100644
index c8b31a62..00000000
--- a/Libraries/FL/Fl_Positioner.H
+++ /dev/null
@@ -1,103 +0,0 @@
-//
-// "$Id: Fl_Positioner.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Positioner header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Positioner widget . */
-
-#ifndef Fl_Positioner_H
-#define Fl_Positioner_H
-
-#ifndef Fl_Widget_H
-#include "Fl_Widget.H"
-#endif
-
-/**
- This class is provided for Forms compatibility. It provides 2D input.
- It would be useful if this could be put atop another widget so that the
- crosshairs are on top, but this is not implemented. The color of the
- crosshairs is selection_color().
- <P ALIGN=CENTER>\image html positioner.png </P>
- \image latex positioner.png " Fl_Positioner" width=4cm
-*/
-class FL_EXPORT Fl_Positioner : public Fl_Widget {
-
- double xmin, ymin;
- double xmax, ymax;
- double xvalue_, yvalue_;
- double xstep_, ystep_;
-
-protected:
-
- // these allow subclasses to put the dial in a smaller area:
- void draw(int, int, int, int);
- int handle(int, int, int, int, int);
- void draw();
-
-public:
-
- int handle(int);
- /**
- Creates a new Fl_Positioner widget using the given position,
- size, and label string. The default boxtype is FL_NO_BOX.
- */
- Fl_Positioner(int x,int y,int w,int h, const char *l=0);
- /** Gets the X axis coordinate.*/
- double xvalue() const {return xvalue_;}
- /** Gets the Y axis coordinate.*/
- double yvalue() const {return yvalue_;}
- int xvalue(double);
- int yvalue(double);
- int value(double,double);
- void xbounds(double, double);
- /** Gets the X axis minimum */
- double xminimum() const {return xmin;}
- /** Same as xbounds(a, xmaximum()) */
- void xminimum(double a) {xbounds(a,xmax);}
- /** Gets the X axis maximum */
- double xmaximum() const {return xmax;}
- /** Same as xbounds(xminimum(), a) */
- void xmaximum(double a) {xbounds(xmin,a);}
- void ybounds(double, double);
- /** Gets the Y axis minimum */
- double yminimum() const {return ymin;}
- /** Same as ybounds(a, ymaximum()) */
- void yminimum(double a) {ybounds(a, ymax);}
- /** Gets the Y axis maximum */
- double ymaximum() const {return ymax;}
- /** Same as ybounds(ymininimum(), a) */
- void ymaximum(double a) {ybounds(ymin, a);}
- /** Sets the stepping value for the X axis.*/
- void xstep(double a) {xstep_ = a;}
- /** Sets the stepping value for the Y axis.*/
- void ystep(double a) {ystep_ = a;}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Positioner.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_PostScript.H b/Libraries/FL/Fl_PostScript.H
deleted file mode 100644
index fe1ee01b..00000000
--- a/Libraries/FL/Fl_PostScript.H
+++ /dev/null
@@ -1,253 +0,0 @@
-//
-// "$Id: Fl_PostScript.H 8699 2011-05-20 16:39:06Z manolo $"
-//
-// Support for graphics output to PostScript file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 2010-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-/** \file Fl_PostScript.H
- \brief declaration of classes Fl_PostScript_Graphics_Driver, Fl_PostScript_File_Device.
- */
-
-
-#ifndef Fl_PostScript_H
-#define Fl_PostScript_H
-
-#include <FL/Fl_Paged_Device.H>
-#include <FL/fl_draw.H>
-
-/**
- \brief PostScript graphical backend.
- *
- PostScript text uses vectorial fonts for the latin alphabet (exactly: all unicode
- characters between U+0020 and U+017F, that is, ASCII, Latin-1 Supplement and Latin Extended-A charts)
- plus a few other characters:
- <table>
- <tr> <th>Char</th><th>Codepoint</th><th>Name</th> <th>Char</th><th>Codepoint</th><th>Name</th> <th>Char</th><th>Codepoint</th><th>Name</th></tr>
- <tr><td>ƒ</td><td>U+0192</td><td>florin</td><td>‚</td><td>U+201A</td><td>quotesinglbase</td><td>™</td><td>U+2122</td><td>trademark</td></tr>
- <tr><td>ˆ</td><td>U+02C6</td><td>circumflex</td><td>“</td><td>U+201C</td><td>quotedblleft</td><td>∂</td><td>U+2202</td><td>partialdiff</td></tr>
- <tr><td>ˇ</td><td>U+02C7</td><td>caron</td><td>â€</td><td>U+201D</td><td>quotedblright</td><td>Δ</td><td>U+2206</td><td>Delta</td></tr>
- <tr><td>˘</td><td>U+02D8</td><td>breve</td><td>„</td><td>U+201E</td><td>quotedblbase</td><td>∑</td><td>U+2211</td><td>summation</td></tr>
- <tr><td>˙</td><td>U+02D9</td><td>dotaccent</td><td>†</td><td>U+2020</td><td>dagger</td><td>√</td><td>U+221A</td><td>radical</td></tr>
- <tr><td>˚</td><td>U+02DA</td><td>ring</td><td>‡</td><td>U+2021</td><td>daggerdbl</td><td>∞</td><td>U+221E</td><td>infinity</td></tr>
- <tr><td>˛</td><td>U+02DB</td><td>ogonek</td><td>•</td><td>U+2022</td><td>bullet</td><td>≠</td><td>U+2260</td><td>notequal</td></tr>
- <tr><td>˜</td><td>U+02DC</td><td>tilde</td><td>…</td><td>U+2026</td><td>ellipsis</td><td>≤</td><td>U+2264</td><td>lessequal</td></tr>
- <tr><td>Ë</td><td>U+02DD</td><td>hungarumlaut</td><td>‰</td><td>U+2030</td><td>perthousand</td><td>≥</td><td>U+2265</td><td>greaterequal</td></tr>
- <tr><td>–</td><td>U+2013</td><td>endash</td><td>‹</td><td>U+2039</td><td>guilsinglleft</td><td>◊</td><td>U+25CA</td><td>lozenge</td></tr>
- <tr><td>—</td><td>U+2014</td><td>emdash</td><td>›</td><td>U+203A</td><td>guilsinglright</td><td>ï¬</td><td>U+FB01</td><td>fi</td></tr>
- <tr><td>‘</td><td>U+2018</td><td>quoteleft</td><td>/</td><td>U+2044</td><td>fraction</td><td>fl</td><td>U+FB02</td><td>fl</td></tr>
- <tr><td>’</td><td>U+2019</td><td>quoteright</td><td>€</td><td>U+20AC</td><td>Euro</td><td></td><td>U+F8FF</td><td>apple (Mac OS only)</td></tr>
- </table>
- <br> All other unicode characters are output as a bitmap.
- <br> FLTK standard fonts are output using PostScript standard fonts: Helvetica, Courier,
- Times (and their bold, oblique, italic variants).
- */
-class FL_EXPORT Fl_PostScript_Graphics_Driver : public Fl_Graphics_Driver {
-public:
- static const char *class_id;
- const char *class_name() {return class_id;};
- Fl_PostScript_Graphics_Driver();
-#ifndef FL_DOXYGEN
- enum SHAPE{NONE=0, LINE, LOOP, POLYGON, POINTS};
-
-class Clip {
- public:
- int x, y, w, h;
- Clip *prev;
- };
- Clip * clip_;
-
- int lang_level_;
- int gap_;
- int pages_;
-
- double width_;
- double height_;
-
- int shape_;
- int linewidth_;// need for clipping, lang level 1-2
- int linestyle_;//
- int interpolate_; //interpolation of images
- unsigned char cr_,cg_,cb_;
- char linedash_[256];//should be enough
- void concat(); // transform ror scalable dradings...
- void reconcat(); //invert
- void recover(); //recovers the state after grestore (such as line styles...)
- void reset();
-
- uchar * mask;
- int mx; // width of mask;
- int my; // mask lines
- //Fl_Color bg_;
- int (*close_cmd_)(FILE *);
- int page_policy_;
- int nPages;
- int orientation_;
-
- float scale_x;
- float scale_y;
- float angle;
- int left_margin;
- int top_margin;
-
- FILE *output;
- double pw_, ph_;
-
- uchar bg_r, bg_g, bg_b;
- int start_postscript (int pagecount, enum Fl_Paged_Device::Page_Format format, enum Fl_Paged_Device::Page_Layout layout);
- /* int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
- */
- void transformed_draw(const char* s, int n, double x, double y); //precise text placing
- void transformed_draw(const char* s, double x, double y);
- int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
-
- enum Fl_Paged_Device::Page_Format page_format_;
- char *ps_filename_;
-
- void page_policy(int p);
- int page_policy(){return page_policy_;};
- void close_command( int (*cmd)(FILE *)){close_cmd_=cmd;};
- FILE * file() {return output;};
- //void orientation (int o);
- //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int pages = 0); // ps (also multi-page) constructor
- //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int x, int y, int w, int h); //eps constructor
- void interpolate(int i){interpolate_=i;};
- int interpolate(){return interpolate_;}
-
- void page(double pw, double ph, int media = 0);
- void page(int format);
-#endif // FL_DOXYGEN
-
- // implementation of drawing methods
- void color(Fl_Color c);
- void color(uchar r, uchar g, uchar b);
-
- void push_clip(int x, int y, int w, int h);
- int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
- int not_clipped(int x, int y, int w, int h);
- void push_no_clip();
- void pop_clip();
-
- void line_style(int style, int width=0, char* dashes=0);
-
- void rect(int x, int y, int w, int h);
- void rectf(int x, int y, int w, int h);
-
- void xyline(int x, int y, int x1);
- void xyline(int x, int y, int x1, int y2);
- void xyline(int x, int y, int x1, int y2, int x3);
-
- void yxline(int x, int y, int y1);
- void yxline(int x, int y, int y1, int x2);
- void yxline(int x, int y, int y1, int x2, int y3);
-
- void line(int x1, int y1, int x2, int y2);
- void line(int x1, int y1, int x2, int y2, int x3, int y3);
-
- void loop(int x0, int y0, int x1, int y1, int x2, int y2);
- void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
- void polygon(int x0, int y0, int x1, int y1, int x2, int y2);
- void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
- void point(int x, int y);
-
- void begin_points();
- void begin_line();
- void begin_loop();
- void begin_polygon();
- void vertex(double x, double y);
- void curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3);
- void circle(double x, double y, double r);
- void arc(double x, double y, double r, double start, double a);
- void arc(int x, int y, int w, int h, double a1, double a2);
- void pie(int x, int y, int w, int h, double a1, double a2);
- void end_points();
- void end_line();
- void end_loop();
- void end_polygon();
- void begin_complex_polygon(){begin_polygon();};
- void gap(){gap_=1;};
- void end_complex_polygon(){end_polygon();};
- void transformed_vertex(double x, double y);
-
- void draw_image(const uchar* d, int x,int y,int w,int h, int delta=3, int ldelta=0);
- void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0);
- void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3);
- void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1);
-
- void draw(const char* s, int n, int x, int y) {transformed_draw(s,n,x,y); };
-#ifdef __APPLE__
- void draw(const char* s, int n, float x, float y) {transformed_draw(s,n,x,y); };
-#endif
- void draw(int angle, const char *str, int n, int x, int y);
- void rtl_draw(const char* s, int n, int x, int y);
- void font(int face, int size);
- double width(const char *, int);
- void text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h);
- int height();
- int descent();
- void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy);
- ~Fl_PostScript_Graphics_Driver();
-};
-
-/**
- \brief To send graphical output to a PostScript file.
- */
-class FL_EXPORT Fl_PostScript_File_Device : public Fl_Paged_Device {
-#ifdef __APPLE__
- Fl_CGContextRef gc;
-#endif
-protected:
- Fl_PostScript_Graphics_Driver *driver();
-public:
- static const char *class_id;
- const char *class_name() {return class_id;};
- Fl_PostScript_File_Device();
- ~Fl_PostScript_File_Device();
- int start_job(int pagecount, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
- enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT);
- int start_job(FILE *ps_output, int pagecount, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
- enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT);
- int start_page (void);
- int printable_rect(int *w, int *h);
- void margins(int *left, int *top, int *right, int *bottom);
- void origin(int *x, int *y);
- void origin(int x, int y);
- void scale (float scale_x, float scale_y = 0.);
- void rotate(float angle);
- void translate(int x, int y);
- void untranslate(void);
- int end_page (void);
- void end_job(void);
-#ifdef __APPLE__
- void set_current() { fl_gc = gc; Fl_Paged_Device::set_current(); }
-#endif
-
- static const char *file_chooser_title;
-};
-
-#endif // Fl_PostScript_H
-
-//
-// End of "$Id: Fl_PostScript.H 8699 2011-05-20 16:39:06Z manolo $"
-//
diff --git a/Libraries/FL/Fl_Preferences.H b/Libraries/FL/Fl_Preferences.H
deleted file mode 100644
index 8fa3f04c..00000000
--- a/Libraries/FL/Fl_Preferences.H
+++ /dev/null
@@ -1,276 +0,0 @@
-//
-// "$Id: Fl_Preferences.H 7949 2010-12-05 00:38:16Z greg.ercolano $"
-//
-// Preferences .
-//
-// Copyright 2002-2010 by Matthias Melcher.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Preferences class . */
-
-#ifndef Fl_Preferences_H
-# define Fl_Preferences_H
-
-# include <stdio.h>
-# include "Fl_Export.H"
-
-/**
- \brief Fl_Preferences provides methods to store user
- settings between application starts.
-
- It is similar to the
- Registry on WIN32 and Preferences on MacOS, and provides a
- simple configuration mechanism for UNIX.
-
- Fl_Preferences uses a hierarchy to store data. It
- bundles similar data into groups and manages entries into those
- groups as name/value pairs.
-
- Preferences are stored in text files that can be edited
- manually. The file format is easy to read and relatively
- forgiving. Preferences files are the same on all platforms. User
- comments in preference files are preserved. Filenames are unique
- for each application by using a vendor/application naming
- scheme. The user must provide default values for all entries to
- ensure proper operation should preferences be corrupted or not
- yet exist.
-
- Entries can be of any length. However, the size of each
- preferences file should be kept small for performance
- reasons. One application can have multiple preferences files.
- Extensive binary data however should be stored in separate
- files: see getUserdataPath().
-
- \note Starting with FLTK 1.3, preference databases are expected to
- be in utf8 encoding. Previous databases were stored in the
- current chracter set or code page which renders them incompatible
- for text entries using international characters.
- */
-class FL_EXPORT Fl_Preferences {
-
-public:
- /**
- Define the scope of the preferences.
- */
- enum Root {
- SYSTEM=0, ///< Preferences are used system-wide
- USER ///< Preferences apply only to the current user
- };
-
- /**
- Every Fl_Preferences-Group has a uniqe ID.
-
- ID's can be retrieved from an Fl_Preferences-Group and can then be used
- to create more Fl_Preference references to the same data set, as long as the
- database remains open.
- */
- typedef void *ID;
-
- static const char *newUUID();
-
- Fl_Preferences( Root root, const char *vendor, const char *application );
- Fl_Preferences( const char *path, const char *vendor, const char *application );
- Fl_Preferences( Fl_Preferences &parent, const char *group );
- Fl_Preferences( Fl_Preferences *parent, const char *group );
- Fl_Preferences( Fl_Preferences &parent, int groupIndex );
- Fl_Preferences( Fl_Preferences *parent, int groupIndex );
- Fl_Preferences(const Fl_Preferences&);
- Fl_Preferences( ID id );
- virtual ~Fl_Preferences();
-
- /** Return an ID that can later be reused to open more references to this dataset.
- */
- ID id() { return (ID)node; }
-
- /** Remove the group with this ID from a database.
- */
- static char remove(ID id_) { return ((Node*)id_)->remove(); }
-
- /** Return the name of this entry.
- */
- const char *name() { return node->name(); }
-
- /** Return the the full path to this entry.
- */
- const char *path() { return node->path(); }
-
- int groups();
- const char *group( int num_group );
- char groupExists( const char *key );
- char deleteGroup( const char *group );
- char deleteAllGroups();
-
- int entries();
- const char *entry( int index );
- char entryExists( const char *key );
- char deleteEntry( const char *entry );
- char deleteAllEntries();
-
- char clear();
-
- char set( const char *entry, int value );
- char set( const char *entry, float value );
- char set( const char *entry, float value, int precision );
- char set( const char *entry, double value );
- char set( const char *entry, double value, int precision );
- char set( const char *entry, const char *value );
- char set( const char *entry, const void *value, int size );
-
- char get( const char *entry, int &value, int defaultValue );
- char get( const char *entry, float &value, float defaultValue );
- char get( const char *entry, double &value, double defaultValue );
- char get( const char *entry, char *&value, const char *defaultValue );
- char get( const char *entry, char *value, const char *defaultValue, int maxSize );
- char get( const char *entry, void *&value, const void *defaultValue, int defaultSize );
- char get( const char *entry, void *value, const void *defaultValue, int defaultSize, int maxSize );
-
- int size( const char *entry );
-
- char getUserdataPath( char *path, int pathlen );
-
- void flush();
-
- // char export( const char *filename, Type fileFormat );
- // char import( const char *filename );
-
- /**
- 'Name' provides a simple method to create numerical or more complex
- procedural names for entries and groups on the fly.
-
- Example: prefs.set(Fl_Preferences::Name("File%d",i),file[i]);.
-
- See test/preferences.cxx as a sample for writing arrays into preferences.<p>
- 'Name' is actually implemented as a class inside Fl_Preferences. It casts
- into const char* and gets automatically destroyed after the enclosing call
- ends.
- */
- class FL_EXPORT Name {
-
- char *data_;
-
- public:
- Name( unsigned int n );
- Name( const char *format, ... );
-
- /**
- Return the Name as a "C" string.
- \internal
- */
- operator const char *() { return data_; }
- ~Name();
- };
-
- /** \internal An entry associates a preference name to its corresponding value */
- struct Entry {
- char *name, *value;
- };
-
-private:
- Fl_Preferences() : node(0), rootNode(0) { }
- Fl_Preferences &operator=(const Fl_Preferences&);
-
- static char nameBuffer[128];
- static char uuidBuffer[40];
- static Fl_Preferences *runtimePrefs;
-
- class RootNode;
-
- class FL_EXPORT Node { // a node contains a list to all its entries
- // and all means to manage the tree structure
- Node *child_, *next_;
- union { // these two are mutually exclusive
- Node *parent_; // top_ bit clear
- RootNode *root_; // top_ bit set
- };
- char *path_;
- Entry *entry_;
- int nEntry_, NEntry_;
- unsigned char dirty_:1;
- unsigned char top_:1;
- unsigned char indexed_:1;
- // indexing routines
- Node **index_;
- int nIndex_, NIndex_;
- void createIndex();
- void updateIndex();
- void deleteIndex();
- public:
- static int lastEntrySet;
- public:
- Node( const char *path );
- ~Node();
- // node methods
- int write( FILE *f );
- const char *name();
- const char *path() { return path_; }
- Node *find( const char *path );
- Node *search( const char *path, int offset=0 );
- Node *childNode( int ix );
- Node *addChild( const char *path );
- void setParent( Node *parent );
- Node *parent() { return top_?0L:parent_; }
- void setRoot(RootNode *r) { root_ = r; top_ = 1; }
- RootNode *findRoot();
- char remove();
- char dirty();
- void deleteAllChildren();
- // entry methods
- int nChildren();
- const char *child( int ix );
- void set( const char *name, const char *value );
- void set( const char *line );
- void add( const char *line );
- const char *get( const char *name );
- int getEntry( const char *name );
- char deleteEntry( const char *name );
- void deleteAllEntries();
- int nEntry() { return nEntry_; }
- Entry &entry(int i) { return entry_[i]; }
- };
- friend class Node;
-
- class FL_EXPORT RootNode { // the root node manages file paths and basic reading and writing
- Fl_Preferences *prefs_;
- char *filename_;
- char *vendor_, *application_;
- public:
- RootNode( Fl_Preferences *, Root root, const char *vendor, const char *application );
- RootNode( Fl_Preferences *, const char *path, const char *vendor, const char *application );
- RootNode( Fl_Preferences * );
- ~RootNode();
- int read();
- int write();
- char getPath( char *path, int pathlen );
- };
- friend class RootNode;
-
-protected:
- Node *node;
- RootNode *rootNode;
-};
-
-#endif // !Fl_Preferences_H
-
-//
-// End of "$Id: Fl_Preferences.H 7949 2010-12-05 00:38:16Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Printer.H b/Libraries/FL/Fl_Printer.H
deleted file mode 100644
index 6e8d0efc..00000000
--- a/Libraries/FL/Fl_Printer.H
+++ /dev/null
@@ -1,214 +0,0 @@
-//
-// "$Id: Fl_Printer.H 8699 2011-05-20 16:39:06Z manolo $"
-//
-// Printing support for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-/** \file Fl_Printer.H
- \brief declaration of classes Fl_Printer, Fl_System_Printer and Fl_PostScript_Printer.
- */
-
-#ifndef Fl_Printer_H
-#define Fl_Printer_H
-
-#include <FL/x.H>
-#include <FL/Fl_Paged_Device.H>
-#include <FL/fl_draw.H>
-#include <FL/Fl_Pixmap.H>
-#include <FL/Fl_RGB_Image.H>
-#include <FL/Fl_Bitmap.H>
-#include <stdio.h>
-#if !(defined(__APPLE__) || defined(WIN32))
-#include <FL/Fl_PostScript.H>
-#elif defined(WIN32)
-#include <commdlg.h>
-#endif
-
-#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN)
-/**
- Print support under MSWindows and Mac OS.
-
- Class Fl_System_Printer is implemented only on the MSWindows and Mac OS platforms.
- It has no public constructor.
- Use Fl_Printer instead that is cross-platform and has the same API.
- */
-class Fl_System_Printer : public Fl_Paged_Device {
- friend class Fl_Printer;
-private:
- /** \brief the printer's graphics context, if there's one, NULL otherwise */
- void *gc;
- void set_current(void);
-#ifdef __APPLE__
- float scale_x;
- float scale_y;
- float angle; // rotation angle in radians
- Fl_PMPrintSession printSession;
- Fl_PMPageFormat pageFormat;
- Fl_PMPrintSettings printSettings;
-#elif defined(WIN32)
- int abortPrint;
- PRINTDLG pd;
- HDC hPr;
- int prerr;
- int left_margin;
- int top_margin;
- void absolute_printable_rect(int *x, int *y, int *w, int *h);
-#endif
-protected:
- /** \brief The constructor */
- Fl_System_Printer(void);
-public:
- static const char *class_id;
- const char *class_name() {return class_id;};
- int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
- int start_page (void);
- int printable_rect(int *w, int *h);
- void margins(int *left, int *top, int *right, int *bottom);
- void origin(int *x, int *y);
- void origin(int x, int y);
- void scale (float scale_x, float scale_y = 0.);
- void rotate(float angle);
- void translate(int x, int y);
- void untranslate(void);
- int end_page (void);
- void end_job (void);
- /** \brief The destructor */
- ~Fl_System_Printer(void);
-}; // class Fl_System_Printer
-
-#endif
-
-#if !(defined(__APPLE__) || defined(WIN32) )
-/**
- Print support under Unix/Linux.
-
- Class Fl_PostScript_Printer is implemented only on the Unix/Linux platform.
- It has no public constructor.
- Use Fl_Printer instead that is cross-platform and has the same API.
- */
-class Fl_PostScript_Printer : public Fl_PostScript_File_Device {
- friend class Fl_Printer;
-protected:
- /** The constructor */
- Fl_PostScript_Printer(void) {};
-public:
- static const char *class_id;
- const char *class_name() {return class_id;};
- int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL);
-};
-
-#endif
-
-/**
- * \brief OS-independent print support.
- *
- Fl_Printer allows to use all FLTK drawing, color, text, and clip functions, and to have them operate
- on printed page(s). There are two main, non exclusive, ways to use it.
- <ul><li>Print any widget (standard, custom, Fl_Window, Fl_Gl_Window) as it appears
- on screen, with optional translation, scaling and rotation. This is done by calling print_widget()
- or print_window_part().
- <li>Use a series of FLTK graphics commands (e.g., font, text, lines, colors, clip, image) to
- compose a page appropriately shaped for printing.
- </ul>
- In both cases, begin by start_job(), start_page(), printable_rect() and origin() calls
- and finish by end_page() and end_job() calls.
- <p><b>Platform specifics</b>
- <ul>
- <li>Unix/Linux platforms:
- Class Fl_RGB_Image prints but loses its transparency if it has one.
- See class Fl_PostScript_Graphics_Driver for a description of how UTF-8 strings appear in print.
- Use the static public attributes of this class to set the print dialog to other languages
- than English. For example, the "Printer:" dialog item Fl_Printer::dialog_printer can be set to French with:
- \code
- Fl_Printer::dialog_printer = "Imprimante:";
- \endcode
- before creation of the Fl_Printer object.
- Use Fl_PostScript_File_Device::file_chooser_title to customize the title of the file chooser dialog that opens
- when using the "Print To File" option of the print dialog.
- <li>MSWindows platform: Transparent Fl_RGB_Image 's don't print with exact transparency on most printers.
- Fl_RGB_Image 's don't rotate() well.
- A workaround is to use the print_window_part() call.
- <li>Mac OS X platform: all graphics requests print as on display.
- </ul>
- */
-class FL_EXPORT Fl_Printer : public Fl_Paged_Device {
-public:
- static const char *class_id;
- const char *class_name() {return class_id;};
- /** \brief The constructor */
- Fl_Printer(void);
- int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
- int start_page(void);
- int printable_rect(int *w, int *h);
- void margins(int *left, int *top, int *right, int *bottom);
- void origin(int *x, int *y);
- void origin(int x, int y);
- void scale(float scale_x, float scale_y = 0.);
- void rotate(float angle);
- void translate(int x, int y);
- void untranslate(void);
- int end_page (void);
- void end_job (void);
- void print_widget(Fl_Widget* widget, int delta_x=0, int delta_y=0);
- void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0);
- void set_current(void);
- Fl_Graphics_Driver* driver(void);
- /** \brief The destructor */
- ~Fl_Printer(void);
-
- /** \name These attributes are effective under the Xlib platform only.
- \{
- */
- static const char *dialog_title;
- static const char *dialog_printer;
- static const char *dialog_range;
- static const char *dialog_copies;
- static const char *dialog_all;
- static const char *dialog_pages;
- static const char *dialog_from;
- static const char *dialog_to;
- static const char *dialog_properties;
- static const char *dialog_copyNo;
- static const char *dialog_print_button;
- static const char *dialog_cancel_button;
- static const char *dialog_print_to_file;
- static const char *property_title;
- static const char *property_pagesize;
- static const char *property_mode;
- static const char *property_use;
- static const char *property_save;
- static const char *property_cancel;
- /** \} */
-private:
-#if defined(WIN32) || defined(__APPLE__)
- Fl_System_Printer *printer;
-#else
- Fl_PostScript_Printer *printer;
-#endif
-};
-
-#endif // Fl_Printer_H
-
-//
-// End of "$Id: Fl_Printer.H 8699 2011-05-20 16:39:06Z manolo $"
-//
diff --git a/Libraries/FL/Fl_Progress.H b/Libraries/FL/Fl_Progress.H
deleted file mode 100644
index ce506d5a..00000000
--- a/Libraries/FL/Fl_Progress.H
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// "$Id: Fl_Progress.H 8306 2011-01-24 17:04:22Z matt $"
-//
-// Progress bar widget definitions.
-//
-// Copyright 2000-2010 by Michael Sweet.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Progress widget . */
-
-#ifndef _Fl_Progress_H_
-# define _Fl_Progress_H_
-
-//
-// Include necessary headers.
-//
-
-#include "Fl_Widget.H"
-
-
-//
-// Progress class...
-//
-/**
- Displays a progress bar for the user.
-*/
-class FL_EXPORT Fl_Progress : public Fl_Widget {
-
- float value_,
- minimum_,
- maximum_;
-
- protected:
-
- virtual void draw();
-
- public:
-
- Fl_Progress(int x, int y, int w, int h, const char *l = 0);
-
- /** Sets the maximum value in the progress widget. */
- void maximum(float v) { maximum_ = v; redraw(); }
- /** Gets the maximum value in the progress widget. */
- float maximum() const { return (maximum_); }
-
- /** Sets the minimum value in the progress widget. */
- void minimum(float v) { minimum_ = v; redraw(); }
- /** Gets the minimum value in the progress widget. */
- float minimum() const { return (minimum_); }
-
- /** Sets the current value in the progress widget. */
- void value(float v) { value_ = v; redraw(); }
- /** Gets the current value in the progress widget. */
- float value() const { return (value_); }
-};
-
-#endif // !_Fl_Progress_H_
-
-//
-// End of "$Id: Fl_Progress.H 8306 2011-01-24 17:04:22Z matt $".
-//
diff --git a/Libraries/FL/Fl_RGB_Image.H b/Libraries/FL/Fl_RGB_Image.H
deleted file mode 100644
index bf1285eb..00000000
--- a/Libraries/FL/Fl_RGB_Image.H
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// "$Id: Fl_RGB_Image.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// RGB Image header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-#ifndef Fl_RGB_Image_H
-# define Fl_RGB_Image_H
-# include "Fl_Image.H"
-#endif // !Fl_RGB_Image_H
-
-//
-// End of "$Id: Fl_RGB_Image.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Radio_Button.H b/Libraries/FL/Fl_Radio_Button.H
deleted file mode 100644
index 979e3301..00000000
--- a/Libraries/FL/Fl_Radio_Button.H
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// "$Id: Fl_Radio_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// Radio button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Radio_Button widget . */
-
-#ifndef Fl_Radio_Button_H
-#define Fl_Radio_Button_H
-
-#include "Fl_Button.H"
-
-class FL_EXPORT Fl_Radio_Button : public Fl_Button {
-public:
- Fl_Radio_Button(int x,int y,int w,int h,const char *l=0)
- : Fl_Button(x,y,w,h,l) {type(FL_RADIO_BUTTON);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Radio_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Radio_Light_Button.H b/Libraries/FL/Fl_Radio_Light_Button.H
deleted file mode 100644
index 6286dbd7..00000000
--- a/Libraries/FL/Fl_Radio_Light_Button.H
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// "$Id: Fl_Radio_Light_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// Radio light button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Radio_Light_Button widget . */
-
-#ifndef Fl_Radio_Light_Button_H
-#define Fl_Radio_Light_Button_H
-
-#include "Fl_Light_Button.H"
-
-class FL_EXPORT Fl_Radio_Light_Button : public Fl_Light_Button {
-public:
- Fl_Radio_Light_Button(int X,int Y,int W,int H,const char *l=0)
- : Fl_Light_Button(X,Y,W,H,l) {type(FL_RADIO_BUTTON);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Radio_Light_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Radio_Round_Button.H b/Libraries/FL/Fl_Radio_Round_Button.H
deleted file mode 100644
index b1505afd..00000000
--- a/Libraries/FL/Fl_Radio_Round_Button.H
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// "$Id: Fl_Radio_Round_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// Radio round button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Radio_Round_Button widget . */
-
-#ifndef Fl_Radio_Round_Button_H
-#define Fl_Radio_Round_Button_H
-
-#include "Fl_Round_Button.H"
-
-class FL_EXPORT Fl_Radio_Round_Button : public Fl_Round_Button {
-public:
- Fl_Radio_Round_Button(int x,int y,int w,int h,const char *l=0)
- : Fl_Round_Button(x,y,w,h,l) {type(FL_RADIO_BUTTON);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Radio_Round_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Repeat_Button.H b/Libraries/FL/Fl_Repeat_Button.H
deleted file mode 100644
index dc6d42eb..00000000
--- a/Libraries/FL/Fl_Repeat_Button.H
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// "$Id: Fl_Repeat_Button.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Repeat button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Repeat_Button widget . */
-
-#ifndef Fl_Repeat_Button_H
-#define Fl_Repeat_Button_H
-#include "Fl.H"
-#include "Fl_Button.H"
-
-/**
- The Fl_Repeat_Button is a subclass of Fl_Button that
- generates a callback when it is pressed and then repeatedly generates
- callbacks as long as it is held down. The speed of the repeat is fixed
- and depends on the implementation.
-*/
-class FL_EXPORT Fl_Repeat_Button : public Fl_Button {
- static void repeat_callback(void *);
-public:
- int handle(int);
- /**
- Creates a new Fl_Repeat_Button widget using the given
- position, size, and label string. The default boxtype is FL_UP_BOX.
- Deletes the button.
- */
- Fl_Repeat_Button(int X,int Y,int W,int H,const char *l=0)
- : Fl_Button(X,Y,W,H,l) {}
- void deactivate() {
- Fl::remove_timeout(repeat_callback,this);
- Fl_Button::deactivate();
- }
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Repeat_Button.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Return_Button.H b/Libraries/FL/Fl_Return_Button.H
deleted file mode 100644
index eb8d6c4e..00000000
--- a/Libraries/FL/Fl_Return_Button.H
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// "$Id: Fl_Return_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Return button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Return_Button widget . */
-
-#ifndef Fl_Return_Button_H
-#define Fl_Return_Button_H
-#include "Fl_Button.H"
-
-/**
- The Fl_Return_Button is a subclass of Fl_Button that
- generates a callback when it is pressed or when the user presses the
- Enter key. A carriage-return symbol is drawn next to the button label.
- <P ALIGN=CENTER>\image html Fl_Return_Button.png
- \image latex Fl_Return_Button.png "Fl_Return_Button" width=4cm
-*/
-class FL_EXPORT Fl_Return_Button : public Fl_Button {
-protected:
- void draw();
-public:
- int handle(int);
- /**
- Creates a new Fl_Return_Button widget using the given
- position, size, and label string. The default boxtype is FL_UP_BOX.
- <P> The inherited destructor deletes the button.
- */
- Fl_Return_Button(int X, int Y, int W, int H,const char *l=0)
- : Fl_Button(X,Y,W,H,l) {}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Return_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Roller.H b/Libraries/FL/Fl_Roller.H
deleted file mode 100644
index a22d6433..00000000
--- a/Libraries/FL/Fl_Roller.H
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// "$Id: Fl_Roller.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Roller header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Roller widget . */
-
-#ifndef Fl_Roller_H
-#define Fl_Roller_H
-
-#ifndef Fl_Valuator_H
-#include "Fl_Valuator.H"
-#endif
-
-/**
- The Fl_Roller widget is a "dolly" control commonly used to
- move 3D objects.
- <P ALIGN=CENTER>\image html Fl_Roller.png
- \image latex Fl_Roller.png "Fl_Roller" width=4cm
-*/
-class FL_EXPORT Fl_Roller : public Fl_Valuator {
-protected:
- void draw();
-public:
- int handle(int);
- Fl_Roller(int X,int Y,int W,int H,const char* L=0);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Roller.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Round_Button.H b/Libraries/FL/Fl_Round_Button.H
deleted file mode 100644
index f11123ec..00000000
--- a/Libraries/FL/Fl_Round_Button.H
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// "$Id: Fl_Round_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Round button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Round_Button widget . */
-
-#ifndef Fl_Round_Button_H
-#define Fl_Round_Button_H
-
-#include "Fl_Light_Button.H"
-
-/**
- Buttons generate callbacks when they are clicked by the user. You
- control exactly when and how by changing the values for type()
- and when().
- <P ALIGN=CENTER>\image html Fl_Round_Button.png</P>
- \image latex Fl_Round_Button.png " Fl_Round_Button" width=4cm
- <P>The Fl_Round_Button subclass display the "on" state by
- turning on a light, rather than drawing pushed in. The shape of the
- "light" is initially set to FL_ROUND_DOWN_BOX. The color of the light
- when on is controlled with selection_color(), which defaults to
- FL_RED.
-*/
-class FL_EXPORT Fl_Round_Button : public Fl_Light_Button {
-public:
- Fl_Round_Button(int x,int y,int w,int h,const char *l = 0);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Round_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Round_Clock.H b/Libraries/FL/Fl_Round_Clock.H
deleted file mode 100644
index 2d420bae..00000000
--- a/Libraries/FL/Fl_Round_Clock.H
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// "$Id: Fl_Round_Clock.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// Round clock header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Round_Clock widget . */
-
-#ifndef Fl_Round_Clock_H
-#define Fl_Round_Clock_H
-
-#include "Fl_Clock.H"
-
-/** A clock widget of type FL_ROUND_CLOCK. Has no box. */
-class FL_EXPORT Fl_Round_Clock : public Fl_Clock {
-public:
- /** Creates the clock widget, setting his type and box. */
- Fl_Round_Clock(int x,int y,int w,int h, const char *l = 0)
- : Fl_Clock(x,y,w,h,l) {type(FL_ROUND_CLOCK); box(FL_NO_BOX);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Round_Clock.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Scroll.H b/Libraries/FL/Fl_Scroll.H
deleted file mode 100644
index c649497e..00000000
--- a/Libraries/FL/Fl_Scroll.H
+++ /dev/null
@@ -1,199 +0,0 @@
-//
-// "$Id: Fl_Scroll.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Scroll header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Scroll widget . */
-
-#ifndef Fl_Scroll_H
-#define Fl_Scroll_H
-
-#include "Fl_Group.H"
-#include "Fl_Scrollbar.H"
-
-/**
- This container widget lets you maneuver around a set of widgets much
- larger than your window. If the child widgets are larger than the size
- of this object then scrollbars will appear so that you can scroll over
- to them:
- \image html Fl_Scroll.png
- \image latex Fl_Scroll.png "Fl_Scroll" width=4cm
-
- If all of the child widgets are packed together into a solid
- rectangle then you want to set box() to FL_NO_BOX or
- one of the _FRAME types. This will result in the best output.
- However, if the child widgets are a sparse arrangement you must
- set box() to a real _BOX type. This can result in some
- blinking during redrawing, but that can be solved by using a
- Fl_Double_Window.
-
- By default you can scroll in both directions, and the scrollbars
- disappear if the data will fit in the area of the scroll.
-
- Use Fl_Scroll::type() to change this as follows :
- <UL>
- <LI>0 - No scrollbars </LI>
- <LI>Fl_Scroll::HORIZONTAL - Only a horizontal scrollbar. </LI>
- <LI>Fl_Scroll::VERTICAL - Only a vertical scrollbar. </LI>
- <LI>Fl_Scroll::BOTH - The default is both scrollbars. </LI>
- <LI>Fl_Scroll::HORIZONTAL_ALWAYS - Horizontal scrollbar always on, vertical always off. </LI>
- <LI>Fl_Scroll::VERTICAL_ALWAYS - Vertical scrollbar always on, horizontal always off. </LI>
- <LI>Fl_Scroll::BOTH_ALWAYS - Both always on. </LI>
- </UL>
-
- Use <B> scrollbar.align(int) ( see void Fl_Widget::align(Fl_Align) ) :</B>
- to change what side the scrollbars are drawn on.
-
- If the FL_ALIGN_LEFT bit is on, the vertical scrollbar is on the left.
- If the FL_ALIGN_TOP bit is on, the horizontal scrollbar is on
- the top. Note that only the alignment flags in scrollbar are
- considered. The flags in hscrollbar however are ignored.
-
- This widget can also be used to pan around a single child widget
- "canvas". This child widget should be of your own class, with a
- draw() method that draws the contents. The scrolling is done by
- changing the x() and y() of the widget, so this child
- must use the x() and y() to position its drawing.
- To speed up drawing it should test fl_push_clip().
-
- Another very useful child is a single Fl_Pack, which is itself a group
- that packs its children together and changes size to surround them.
- Filling the Fl_Pack with Fl_Tabs groups (and then putting
- normal widgets inside those) gives you a very powerful scrolling list
- of individually-openable panels.
-
- Fluid lets you create these, but you can only lay out objects that
- fit inside the Fl_Scroll without scrolling. Be sure to leave
- space for the scrollbars, as Fluid won't show these either.
-
- <I>You cannot use Fl_Window as a child of this since the
- clipping is not conveyed to it when drawn, and it will draw over the
- scrollbars and neighboring objects.</I>
-*/
-class FL_EXPORT Fl_Scroll : public Fl_Group {
-
- int xposition_, yposition_;
- int oldx, oldy;
- int scrollbar_size_;
- static void hscrollbar_cb(Fl_Widget*, void*);
- static void scrollbar_cb(Fl_Widget*, void*);
- void fix_scrollbar_order();
- static void draw_clip(void*,int,int,int,int);
-
-private:
-
- //
- // Structure to manage scrollbar and widget interior sizes.
- //
- // Private for now -- we'd like to expose some of this at
- // some point to solve STR#1895.)
- //
- typedef struct {
- int scrollsize; // the scrollsize (global|local)
- int innerbox_x, innerbox_y, innerbox_w, innerbox_h; // widget's inner box (excludes scrollbars)
- int innerchild_x, innerchild_y, innerchild_w, innerchild_h; // widget's inner box including scrollbars
- int child_l, child_r, child_b, child_t; // child bounding box: left/right/bottom/top
- int hneeded, vneeded; // hor + ver scrollbar visibility
- int hscroll_x, hscroll_y, hscroll_w, hscroll_h; // hor scrollbar size/position
- int vscroll_x, vscroll_y, vscroll_w, vscroll_h; // ver scrollbar size/position
- int hpos, hsize, hfirst, htotal; // hor scrollbar values (pos/size/first/total)
- int vpos, vsize, vfirst, vtotal; // ver scrollbar values (pos/size/first/total)
- } ScrollInfo;
- void recalc_scrollbars(ScrollInfo &si);
-
-protected:
-
- void bbox(int&,int&,int&,int&);
- void draw();
-
-public:
-
- Fl_Scrollbar scrollbar;
- Fl_Scrollbar hscrollbar;
-
- void resize(int,int,int,int);
- int handle(int);
-
- Fl_Scroll(int X,int Y,int W,int H,const char*l=0);
-
- enum { // values for type()
- HORIZONTAL = 1,
- VERTICAL = 2,
- BOTH = 3,
- ALWAYS_ON = 4,
- HORIZONTAL_ALWAYS = 5,
- VERTICAL_ALWAYS = 6,
- BOTH_ALWAYS = 7
- };
-
- /** Gets the current horizontal scrolling position. */
- int xposition() const {return xposition_;}
- /** Gets the current vertical scrolling position. */
- int yposition() const {return yposition_;}
- void scroll_to(int, int);
- void clear();
- /**
- Gets the current size of the scrollbars' troughs, in pixels.
-
- If this value is zero (default), this widget will use the
- Fl::scrollbar_size() value as the scrollbar's width.
-
- \returns Scrollbar size in pixels, or 0 if the global Fl::scrollsize() is being used.
- \see Fl::scrollbar_size(int)
- */
- int scrollbar_size() const {
- return(scrollbar_size_);
- }
- /**
- Sets the pixel size of the scrollbars' troughs to the \p size, in pixels.
-
- Normally you should not need this method, and should use
- Fl::scrollbar_size(int) instead to manage the size of ALL
- your widgets' scrollbars. This ensures your application
- has a consistent UI, is the default behavior, and is normally
- what you want.
-
- Only use THIS method if you really need to override the global
- scrollbar size. The need for this should be rare.
-
- Setting \p size to the special value of 0 causes the widget to
- track the global Fl::scrollbar_size(), which is the default.
-
- \param[in] size Sets the scrollbar size in pixels.\n
- If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()
- \see Fl::scrollbar_size()
- */
- void scrollbar_size(int size) {
- if ( size != scrollbar_size_ ) redraw();
- scrollbar_size_ = size;
- }
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Scroll.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Scrollbar.H b/Libraries/FL/Fl_Scrollbar.H
deleted file mode 100644
index 96aa4330..00000000
--- a/Libraries/FL/Fl_Scrollbar.H
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// "$Id: Fl_Scrollbar.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Scroll bar header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Scrollbar widget . */
-
-#ifndef Fl_Scrollbar_H
-#define Fl_Scrollbar_H
-
-#include "Fl_Slider.H"
-
-/**
- The Fl_Scrollbar widget displays a slider with arrow buttons at
- the ends of the scrollbar. Clicking on the arrows move up/left and
- down/right by linesize(). Scrollbars also accept FL_SHORTCUT events:
- the arrows move by linesize(), and vertical scrollbars take Page
- Up/Down (they move by the page size minus linesize()) and Home/End
- (they jump to the top or bottom).
-
- Scrollbars have step(1) preset (they always return integers). If
- desired you can set the step() to non-integer values. You will then
- have to use casts to get at the floating-point versions of value()
- from Fl_Slider.
-
- \image html scrollbar.png
- \image latex scrollbar.png "Fl_Scrollbar" width=4cm
-*/
-class FL_EXPORT Fl_Scrollbar : public Fl_Slider {
-
- int linesize_;
- int pushed_;
- static void timeout_cb(void*);
- void increment_cb();
-protected:
- void draw();
-
-public:
-
- Fl_Scrollbar(int X,int Y,int W,int H, const char *L = 0);
- ~Fl_Scrollbar();
- int handle(int);
-
- /**
- Gets the integer value (position) of the slider in the scrollbar.
- You can get the floating point value with Fl_Slider::value().
-
- \see Fl_Scrollbar::value(int p)
- \see Fl_Scrollbar::value(int pos, int size, int first, int total)
- */
- int value() const {return int(Fl_Slider::value());}
-
- /**
- Sets the value (position) of the slider in the scrollbar.
-
- \see Fl_Scrollbar::value()
- \see Fl_Scrollbar::value(int pos, int size, int first, int total)
- */
- int value(int p) {return int(Fl_Slider::value((double)p));}
-
- /**
- Sets the position, size and range of the slider in the scrollbar.
- \param[in] pos position, first line displayed
- \param[in] size window size, number of lines displayed
- \param[in] first number of first line
- \param[in] total total number of lines
-
- You should call this every time your window changes size, your data
- changes size, or your scroll position changes (even if in response
- to a callback from this scrollbar).
- All necessary calls to redraw() are done.
-
- Calls Fl_Slider::scrollvalue(int pos, int size, int first, int total).
- */
- int value(int pos, int size, int first, int total) {
- return scrollvalue(pos, size, first, total);
- }
-
- /**
- Get the size of step, in lines, that the arror keys move.
- */
- int linesize() const {return linesize_;}
-
- /**
- This number controls how big the steps are that the arrow keys do.
- In addition page up/down move by the size last sent to value()
- minus one linesize(). The default is 16.
- */
- void linesize(int i) {linesize_ = i;}
-
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Scrollbar.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Secret_Input.H b/Libraries/FL/Fl_Secret_Input.H
deleted file mode 100644
index 2c100362..00000000
--- a/Libraries/FL/Fl_Secret_Input.H
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// "$Id: Fl_Secret_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
-//
-// Secret input header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Secret_Input widget . */
-
-#ifndef Fl_Secret_Input_H
-#define Fl_Secret_Input_H
-
-#include "Fl_Input.H"
-
-/**
- The Fl_Secret_Input class is a subclass of Fl_Input that displays its
- input as a string of placeholders. Depending on the platform this
- placeholder is either the asterisk ('*') or the Unicode bullet
- character (U+2022).
-
- This subclass is usually used to receive passwords and other "secret" information.
-*/
-class FL_EXPORT Fl_Secret_Input : public Fl_Input {
-public:
- /**
- Creates a new Fl_Secret_Input widget using the given
- position, size, and label string. The default boxtype is FL_DOWN_BOX.
-
- Inherited destructor destroys the widget and any value associated with it.
- */
-#if defined(FL_DLL) // implementation in src/Fl_Input.cxx
- Fl_Secret_Input(int X,int Y,int W,int H,const char *l = 0);
-#else
- Fl_Secret_Input(int X,int Y,int W,int H,const char *l = 0)
- : Fl_Input(X,Y,W,H,l) {type(FL_SECRET_INPUT);}
-#endif
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Secret_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Select_Browser.H b/Libraries/FL/Fl_Select_Browser.H
deleted file mode 100644
index 82e68da2..00000000
--- a/Libraries/FL/Fl_Select_Browser.H
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// "$Id: Fl_Select_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $"
-//
-// Select browser header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Select_Browser widget . */
-
-#ifndef Fl_Select_Browser_H
-#define Fl_Select_Browser_H
-
-#include "Fl_Browser.H"
-
-/**
- The class is a subclass of Fl_Browser
- which lets the user select a single item, or no items by clicking on
- the empty space. As long as the mouse button is held down on an
- unselected item it is highlighted. Normally the callback is done when the
- user presses the mouse, but you can change this with when().
- <P>See Fl_Browser for methods to add and remove lines from the browser.
-*/
-class FL_EXPORT Fl_Select_Browser : public Fl_Browser {
-public:
- /**
- Creates a new Fl_Select_Browser widget using the given
- position, size, and label string. The default boxtype is FL_DOWN_BOX.
- The constructor specializes Fl_Browser() by setting the type to FL_SELECT_BROWSER.
- The destructor destroys the widget and frees all memory that has been allocated.
- */
-#if defined(FL_DLL) // implementation in src/Fl_Browser.cxx
- Fl_Select_Browser(int X,int Y,int W,int H,const char *L=0);
-#else
- Fl_Select_Browser(int X,int Y,int W,int H,const char *L=0)
- : Fl_Browser(X,Y,W,H,L) {type(FL_SELECT_BROWSER);}
-#endif
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Select_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Shared_Image.H b/Libraries/FL/Fl_Shared_Image.H
deleted file mode 100644
index a6beb0dd..00000000
--- a/Libraries/FL/Fl_Shared_Image.H
+++ /dev/null
@@ -1,114 +0,0 @@
-//
-// "$Id: Fl_Shared_Image.H 8306 2011-01-24 17:04:22Z matt $"
-//
-// Shared image header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/** \file
- Fl_Shared_Image class. */
-
-#ifndef Fl_Shared_Image_H
-# define Fl_Shared_Image_H
-
-# include "Fl_Image.H"
-
-
-// Test function for adding new formats
-typedef Fl_Image *(*Fl_Shared_Handler)(const char *name, uchar *header,
- int headerlen);
-
-// Shared images class.
-/**
- This class supports caching, loading,
- and drawing of image files. Most applications will also want to
- link against the fltk_images library and call the
- fl_register_images()
- function to support standard image formats such as BMP, GIF, JPEG, and PNG.
-*/
-class FL_EXPORT Fl_Shared_Image : public Fl_Image {
-
- friend class Fl_JPEG_Image;
- friend class Fl_PNG_Image;
-
-protected:
-
- static Fl_Shared_Image **images_; // Shared images
- static int num_images_; // Number of shared images
- static int alloc_images_; // Allocated shared images
- static Fl_Shared_Handler *handlers_; // Additional format handlers
- static int num_handlers_; // Number of format handlers
- static int alloc_handlers_; // Allocated format handlers
-
- const char *name_; // Name of image file
- int original_; // Original image?
- int refcount_; // Number of times this image has been used
- Fl_Image *image_; // The image that is shared
- int alloc_image_; // Was the image allocated?
-
- static int compare(Fl_Shared_Image **i0, Fl_Shared_Image **i1);
-
- // Use get() and release() to load/delete images in memory...
- Fl_Shared_Image();
- Fl_Shared_Image(const char *n, Fl_Image *img = 0);
- virtual ~Fl_Shared_Image();
- void add();
- void update();
-
- public:
- /** Returns the filename of the shared image */
- const char *name() { return name_; }
- /** Returns the number of references of this shared image. When reference is below 1, the image is deleted. */
- int refcount() { return refcount_; }
- void release();
- void reload();
-
- virtual Fl_Image *copy(int W, int H);
- Fl_Image *copy() { return copy(w(), h()); }
- virtual void color_average(Fl_Color c, float i);
- virtual void desaturate();
- virtual void draw(int X, int Y, int W, int H, int cx, int cy);
- void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); }
- virtual void uncache();
-
- static Fl_Shared_Image *find(const char *n, int W = 0, int H = 0);
- static Fl_Shared_Image *get(const char *n, int W = 0, int H = 0);
- static Fl_Shared_Image **images();
- static int num_images();
- static void add_handler(Fl_Shared_Handler f);
- static void remove_handler(Fl_Shared_Handler f);
-};
-
-//
-// The following function is provided in the fltk_images library and
-// registers all of the "extra" image file formats that are not part
-// of the core FLTK library...
-//
-
-FL_EXPORT extern void fl_register_images();
-
-#endif // !Fl_Shared_Image_H
-
-//
-// End of "$Id: Fl_Shared_Image.H 8306 2011-01-24 17:04:22Z matt $"
-//
diff --git a/Libraries/FL/Fl_Simple_Counter.H b/Libraries/FL/Fl_Simple_Counter.H
deleted file mode 100644
index dbcebdba..00000000
--- a/Libraries/FL/Fl_Simple_Counter.H
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// "$Id: Fl_Simple_Counter.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// Simple counter header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Simple_Counter widget . */
-
-#ifndef Fl_Simple_Counter_H
-#define Fl_Simple_Counter_H
-
-#include "Fl_Counter.H"
-/**
- This widget creates a counter with only 2 arrow buttons
- <P align=center>\image html counter.png</P>
- \image latex counter.png "Fl_Simple_Counter" width=4cm
-*/
-class FL_EXPORT Fl_Simple_Counter : public Fl_Counter {
-public:
- Fl_Simple_Counter(int x,int y,int w,int h, const char *l = 0)
- : Fl_Counter(x,y,w,h,l) {type(FL_SIMPLE_COUNTER);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Simple_Counter.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Single_Window.H b/Libraries/FL/Fl_Single_Window.H
deleted file mode 100644
index 9bebc4ea..00000000
--- a/Libraries/FL/Fl_Single_Window.H
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// "$Id: Fl_Single_Window.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Single-buffered window header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Single_Window class . */
-
-#ifndef Fl_Single_Window_H
-#define Fl_Single_Window_H
-
-#include "Fl_Window.H"
-
-/**
- This is the same as Fl_Window. However, it is possible that
- some implementations will provide double-buffered windows by default.
- This subcan be used to force single-buffering. This may be
- useful for modifying existing programs that use incremental update, or
- for some types of image data, such as a movie flipbook.
-*/
-class FL_EXPORT Fl_Single_Window : public Fl_Window {
-public:
- void show();
- void show(int a, char **b) {Fl_Window::show(a,b);}
- void flush();
- /**
- Creates a new Fl_Single_Window widget using the given
- size, and label (title) string.
- */
- Fl_Single_Window(int W, int H, const char *l=0)
- : Fl_Window(W,H,l) {}
- /**
- Creates a new Fl_Single_Window widget using the given
- position, size, and label (title) string.
- */
- Fl_Single_Window(int X, int Y, int W, int H, const char *l=0)
- : Fl_Window(X,Y,W,H,l) {}
- int make_current();
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Single_Window.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Slider.H b/Libraries/FL/Fl_Slider.H
deleted file mode 100644
index e16e2d6d..00000000
--- a/Libraries/FL/Fl_Slider.H
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// "$Id: Fl_Slider.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Slider header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Slider widget . */
-
-#ifndef Fl_Slider_H
-#define Fl_Slider_H
-
-#ifndef Fl_Valuator_H
-#include "Fl_Valuator.H"
-#endif
-
-// values for type(), lowest bit indicate horizontal:
-#define FL_VERT_SLIDER 0
-#define FL_HOR_SLIDER 1
-#define FL_VERT_FILL_SLIDER 2
-#define FL_HOR_FILL_SLIDER 3
-#define FL_VERT_NICE_SLIDER 4
-#define FL_HOR_NICE_SLIDER 5
-
-/**
- The Fl_Slider widget contains a sliding knob inside a box. It if
- often used as a scrollbar. Moving the box all the way to the
- top/left sets it to the minimum(), and to the bottom/right to the
- maximum(). The minimum() may be greater than the maximum() to
- reverse the slider direction.
-
- Use void Fl_Widget::type(int) to set how the slider is drawn,
- which can be one of the following:
-
- \li FL_VERTICAL - Draws a vertical slider (this is the default).
- \li FL_HORIZONTAL - Draws a horizontal slider.
- \li FL_VERT_FILL_SLIDER - Draws a filled vertical slider,
- useful as a progress or value meter.
- \li FL_HOR_FILL_SLIDER - Draws a filled horizontal slider,
- useful as a progress or value meter.
- \li FL_VERT_NICE_SLIDER - Draws a vertical slider with a nice
- looking control knob.
- \li FL_HOR_NICE_SLIDER - Draws a horizontal slider with a
- nice looking control knob.
-
- \image html slider.png
- \image latex slider.png "Fl_Slider" width=4cm
-*/
-class FL_EXPORT Fl_Slider : public Fl_Valuator {
-
- float slider_size_;
- uchar slider_;
- void _Fl_Slider();
- void draw_bg(int, int, int, int);
-
-protected:
-
- // these allow subclasses to put the slider in a smaller area:
- void draw(int, int, int, int);
- int handle(int, int, int, int, int);
- void draw();
-
-public:
-
- int handle(int);
- Fl_Slider(int X,int Y,int W,int H, const char *L = 0);
- Fl_Slider(uchar t,int X,int Y,int W,int H, const char *L);
-
- int scrollvalue(int pos,int size,int first,int total);
- void bounds(double a, double b);
-
- /**
- Get the dimensions of the moving piece of slider.
- */
- float slider_size() const {return slider_size_;}
-
- /**
- Set the dimensions of the moving piece of slider. This is
- the fraction of the size of the entire widget. If you set this
- to 1 then the slider cannot move. The default value is .08.
-
- For the "fill" sliders this is the size of the area around the
- end that causes a drag effect rather than causing the slider to
- jump to the mouse.
- */
- void slider_size(double v);
-
- /** Gets the slider box type. */
- Fl_Boxtype slider() const {return (Fl_Boxtype)slider_;}
-
- /** Sets the slider box type. */
- void slider(Fl_Boxtype c) {slider_ = c;}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Slider.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Spinner.H b/Libraries/FL/Fl_Spinner.H
deleted file mode 100644
index 5d141bd3..00000000
--- a/Libraries/FL/Fl_Spinner.H
+++ /dev/null
@@ -1,268 +0,0 @@
-//
-// "$Id: Fl_Spinner.H 8339 2011-01-30 12:50:19Z ianmacarthur $"
-//
-// Spinner widget for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Spinner widget . */
-
-#ifndef Fl_Spinner_H
-# define Fl_Spinner_H
-
-//
-// Include necessary headers...
-//
-
-# include <FL/Enumerations.H>
-# include <FL/Fl_Group.H>
-# include <FL/Fl_Input.H>
-# include <FL/Fl_Repeat_Button.H>
-# include <stdio.h>
-# include <stdlib.h>
-
-
-/**
- This widget is a combination of the input
- widget and repeat buttons. The user can either type into the
- input area or use the buttons to change the value.
-*/
-class FL_EXPORT Fl_Spinner : public Fl_Group {
-
- double value_; // Current value
- double minimum_; // Minimum value
- double maximum_; // Maximum value
- double step_; // Amount to add/subtract for up/down
- const char *format_; // Format string
-
- Fl_Input input_; // Input field for the value
- Fl_Repeat_Button
- up_button_, // Up button
- down_button_; // Down button
-
-
- static void sb_cb(Fl_Widget *w, Fl_Spinner *sb) {
- double v; // New value
-
- if (w == &(sb->input_)) {
- // Something changed in the input field...
- v = atof(sb->input_.value());
-
- if (v < sb->minimum_) {
- sb->value_ = sb->minimum_;
- sb->update();
- } else if (v > sb->maximum_) {
- sb->value_ = sb->maximum_;
- sb->update();
- } else sb->value_ = v;
- } else if (w == &(sb->up_button_)) {
- // Up button pressed...
- v = sb->value_ + sb->step_;
-
- if (v > sb->maximum_) sb->value_ = sb->minimum_;
- else sb->value_ = v;
-
- sb->update();
- } else if (w == &(sb->down_button_)) {
- // Down button pressed...
- v = sb->value_ - sb->step_;
-
- if (v < sb->minimum_) sb->value_ = sb->maximum_;
- else sb->value_ = v;
-
- sb->update();
- }
-
- sb->do_callback();
- }
- void update() {
- char s[255]; // Value string
-
- if (format_[0]=='%'&&format_[1]=='.'&&format_[2]=='*') { // precision argument
- // this code block is a simplified version of
- // Fl_Valuator::format() and works well (but looks ugly)
- int c = 0;
- char temp[64], *sp = temp;
- sprintf(temp, "%.12f", step_);
- while (*sp) sp++;
- sp--;
- while (sp>temp && *sp=='0') sp--;
- while (sp>temp && (*sp>='0' && *sp<='9')) { sp--; c++; }
- sprintf(s, format_, c, value_);
- } else {
- sprintf(s, format_, value_);
- }
- input_.value(s);
- }
-
- public:
-
- /**
- Creates a new Fl_Spinner widget using the given position, size,
- and label string.
- <P>Inherited destructor Destroys the widget and any value associated with it.
- */
- Fl_Spinner(int X, int Y, int W, int H, const char *L = 0)
- : Fl_Group(X, Y, W, H, L),
- input_(X, Y, W - H / 2 - 2, H),
- up_button_(X + W - H / 2 - 2, Y, H / 2 + 2, H / 2, "@-42<"),
- down_button_(X + W - H / 2 - 2, Y + H - H / 2,
- H / 2 + 2, H / 2, "@-42>") {
- end();
-
- value_ = 1.0;
- minimum_ = 1.0;
- maximum_ = 100.0;
- step_ = 1.0;
- format_ = "%g";
-
- align(FL_ALIGN_LEFT);
-
- input_.value("1");
- input_.type(FL_INT_INPUT);
- input_.when(FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE);
- input_.callback((Fl_Callback *)sb_cb, this);
-
- up_button_.callback((Fl_Callback *)sb_cb, this);
-
- down_button_.callback((Fl_Callback *)sb_cb, this);
- }
-
- /** Sets or returns the format string for the value. */
- const char *format() { return (format_); }
- /** Sets or returns the format string for the value. */
- void format(const char *f) { format_ = f; update(); }
-
- int handle(int event) {
- switch (event) {
- case FL_KEYDOWN :
- case FL_SHORTCUT :
- if (Fl::event_key() == FL_Up) {
- up_button_.do_callback();
- return 1;
- } else if (Fl::event_key() == FL_Down) {
- down_button_.do_callback();
- return 1;
- } else return 0;
-
- case FL_FOCUS :
- if (input_.take_focus()) return 1;
- else return 0;
- }
-
- return Fl_Group::handle(event);
- }
-
- /** Speling mistakes retained for source compatibility \deprecated */
- double maxinum() const { return (maximum_); }
- /** Gets the maximum value of the widget. */
- double maximum() const { return (maximum_); }
- /** Sets the maximum value of the widget. */
- void maximum(double m) { maximum_ = m; }
- /** Speling mistakes retained for source compatibility \deprecated */
- double mininum() const { return (minimum_); }
- /** Gets the minimum value of the widget. */
- double minimum() const { return (minimum_); }
- /** Sets the minimum value of the widget. */
- void minimum(double m) { minimum_ = m; }
- /** Sets the minimum and maximum values for the widget. */
- void range(double a, double b) { minimum_ = a; maximum_ = b; }
- void resize(int X, int Y, int W, int H) {
- Fl_Group::resize(X,Y,W,H);
-
- input_.resize(X, Y, W - H / 2 - 2, H);
- up_button_.resize(X + W - H / 2 - 2, Y, H / 2 + 2, H / 2);
- down_button_.resize(X + W - H / 2 - 2, Y + H - H / 2,
- H / 2 + 2, H / 2);
- }
- /**
- Sets or returns the amount to change the value when the user clicks a button.
- Before setting step to a non-integer value, the spinner
- type() should be changed to floating point.
- */
- double step() const { return (step_); }
- /** See double Fl_Spinner::step() const */
- void step(double s) {
- step_ = s;
- if (step_ != (int)step_) input_.type(FL_FLOAT_INPUT);
- else input_.type(FL_INT_INPUT);
- update();
- }
- /** Gets the color of the text in the input field. */
- Fl_Color textcolor() const {
- return (input_.textcolor());
- }
- /** Sets the color of the text in the input field. */
- void textcolor(Fl_Color c) {
- input_.textcolor(c);
- }
- /** Gets the font of the text in the input field. */
- Fl_Font textfont() const {
- return (input_.textfont());
- }
- /** Sets the font of the text in the input field. */
- void textfont(Fl_Font f) {
- input_.textfont(f);
- }
- /** Gets the size of the text in the input field. */
- Fl_Fontsize textsize() const {
- return (input_.textsize());
- }
- /** Sets the size of the text in the input field. */
- void textsize(Fl_Fontsize s) {
- input_.textsize(s);
- }
- /** Gets the numeric representation in the input field.
- \see Fl_Spinner::type(uchar)
- */
- uchar type() const { return (input_.type()); }
- /** Sets the numeric representation in the input field.
- Valid values are FL_INT_INPUT and FL_FLOAT_INPUT.
- Also changes the format() template.
- Setting a new spinner type via a superclass pointer will not work.
- \note type is not a virtual function.
- */
- void type(uchar v) {
- if (v==FL_FLOAT_INPUT) {
- format("%.*f");
- } else {
- format("%.0f");
- }
- input_.type(v);
- }
- /** Gets the current value of the widget. */
- double value() const { return (value_); }
- /**
- Sets the current value of the widget.
- Before setting value to a non-integer value, the spinner
- type() should be changed to floating point.
- */
- void value(double v) { value_ = v; update(); }
-};
-
-#endif // !Fl_Spinner_H
-
-//
-// End of "$Id: Fl_Spinner.H 8339 2011-01-30 12:50:19Z ianmacarthur $".
-//
diff --git a/Libraries/FL/Fl_Sys_Menu_Bar.H b/Libraries/FL/Fl_Sys_Menu_Bar.H
deleted file mode 100644
index da70c92c..00000000
--- a/Libraries/FL/Fl_Sys_Menu_Bar.H
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-// "$Id: Fl_Sys_Menu_Bar.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// MacOS system menu bar header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-#ifndef Fl_Sys_Menu_Bar_H
-#define Fl_Sys_Menu_Bar_H
-
-#include "Fl_Menu_Bar.H"
-#include "x.H"
-
-#if defined(__APPLE__) || defined(FL_DOXYGEN)
-
-/**
- @brief A class to create, modify and delete menus that appear on Mac OS X in the menu bar at the top of the screen.
- *
- * On other than Mac OS X platforms, Fl_Sys_Menu_Bar is a synonym of class Fl_Menu_Bar.
- */
-class FL_EXPORT Fl_Sys_Menu_Bar : public Fl_Menu_Bar {
-protected:
- void draw();
-public:
- /**
- @brief The constructor.
- *
- * On Mac OS X, all arguments are unused. On other platforms they are used as by Fl_Menu_Bar::Fl_Menu_Bar().
- */
- Fl_Sys_Menu_Bar(int x,int y,int w,int h,const char *l=0)
- : Fl_Menu_Bar(x,y,w,h,l) {
- deactivate(); // don't let the old area take events
- fl_sys_menu_bar = this;
- }
- void menu(const Fl_Menu_Item *m);
- int add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0);
- int insert(int index, const char* label, int shortcut, Fl_Callback *cb, void *user_data=0, int flags=0);
- void remove(int n);
- void replace(int rank, const char *name);
- void clear();
- int clear_submenu(int index);
-#if ! defined(FL_DOXYGEN)
- enum menuOrItemOperation { itemAtIndex, setKeyEquivalent, setKeyEquivalentModifierMask, setState, initWithTitle,
- numberOfItems, setSubmenu, setEnabled, addSeparatorItem, setTitle, removeItem, addNewItem, renameItem };
- // function doMenuOrItemOperation is in file Fl_cocoa.mm because it contains objective-c code
- static void *doMenuOrItemOperation( menuOrItemOperation operation, ...);
-#endif
-};
-
-#else
-
-typedef Fl_Menu_Bar Fl_Sys_Menu_Bar;
-
-#endif // defined(__APPLE__) || defined(FL_DOXYGEN)
-
-#endif // Fl_Sys_Menu_Bar_H
-
-//
-// End of "$Id: Fl_Sys_Menu_Bar.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Table.H b/Libraries/FL/Fl_Table.H
deleted file mode 100644
index 55c06fdd..00000000
--- a/Libraries/FL/Fl_Table.H
+++ /dev/null
@@ -1,1081 +0,0 @@
-//
-// "$Id: Fl_Table.H 8301 2011-01-22 22:40:11Z AlbrechtS $"
-//
-// Fl_Table -- A table widget
-//
-// Copyright 2002 by Greg Ercolano.
-// Copyright (c) 2004 O'ksi'D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems to "erco at seriss dot com".
-//
-// TODO:
-// o Auto scroll during dragged selection
-// o Keyboard navigation (up/down/left/right arrow)
-//
-
-#ifndef _FL_TABLE_H
-#define _FL_TABLE_H
-
-#include <sys/types.h>
-#include <string.h> // memcpy
-#ifdef WIN32
-#include <malloc.h> // WINDOWS: malloc/realloc
-#else /*WIN32*/
-#include <stdlib.h> // UNIX: malloc/realloc
-#endif /*WIN32*/
-
-#include <FL/Fl.H>
-#include <FL/Fl_Group.H>
-#include <FL/Fl_Scroll.H>
-#include <FL/Fl_Box.H>
-#include <FL/Fl_Scrollbar.H>
-
-/**
- A table of widgets or other content.
-
- This is the base class for table widgets.
-
- To be useful it must be subclassed and several virtual functions defined.
- Normally applications use widgets derived from this widget, and do not use this
- widget directly; this widget is usually too low level to be used directly by
- applications.
-
- This widget does \em not handle the data in the table. The draw_cell()
- method must be overridden by a subclass to manage drawing the contents of
- the cells.
-
- This widget can be used in several ways:
-
- - As a custom widget; see examples/table-simple.cxx and test/table.cxx.
- Very optimal for even extremely large tables.
- - As a table made up of a single FLTK widget instanced all over the table,
- simulating a numeric spreadsheet. See examples/table-spreadsheet.cxx and
- examples/table-spreadsheet-with-keyboard-nav.cxx. Optimal for large tables.
- - As a regular container of FLTK widgets, one widget per cell.
- See examples/table-as-container.cxx. \em Not recommended for large tables.
-
- \image html table-simple.png
- \image latex table-simple.png "table-simple example" width=6cm
-
- \image html table-as-container.png
- \image latex table-as-container.png "table-as-container example" width=6cm
-
- When acting as part of a custom widget, events on the cells and/or headings
- generate callbacks when they are clicked by the user. You control when events
- are generated based on the setting for Fl_Table::when().
-
- When acting as a container for FLTK widgets, the FLTK widgets maintain
- themselves. Although the draw_cell() method must be overridden, its contents
- can be very simple. See the draw_cell() code in examples/table-simple.cxx.
-
- The following variables are available to classes deriving from Fl_Table:
-
- \image html table-dimensions.png
- \image latex table-dimensions.png "Fl_Table Dimensions" width=6cm
-
- <table border=0>
- <tr><td>x()/y()/w()/h()</td>
- <td>Fl_Table widget's outer dimension. The outer edge of the border of the
- Fl_Table. (Red in the diagram above)</td></tr>
-
- <tr><td>wix/wiy/wiw/wih</td>
- <td>Fl_Table widget's inner dimension. The inner edge of the border of the
- Fl_Table. eg. if the Fl_Table's box() is FL_NO_BOX, these values are the same
- as x()/y()/w()/h(). (Yellow in the diagram above)</td></tr>
-
- <tr><td>tox/toy/tow/toh</td>
- <td>The table's outer dimension. The outer edge of the border around the cells,
- but inside the row/col headings and scrollbars. (Green in the diagram above)
- </td></tr>
-
- <tr><td>tix/tiy/tiw/tih</td>
- <td>The table's inner dimension. The inner edge of the border around the cells,
- but inside the row/col headings and scrollbars. AKA the table's clip region.
- eg. if the table_box() is FL_NO_BOX, these values are the same as
- tox/toyy/tow/toh. (Blue in the diagram above)
- </td></tr></table>
-
- CORE DEVELOPERS
-
- - Greg Ercolano : 12/16/2002 - initial implementation 12/16/02. Fl_Table, Fl_Table_Row, docs.
- - Jean-Marc Lienher : 02/22/2004 - added keyboard nav + mouse selection, and ported Fl_Table into fltk-utf8-1.1.4
-
- OTHER CONTRIBUTORS
-
- - Inspired by the Feb 2000 version of FLVW's Flvw_Table widget. Mucho thanks to those folks.
- - Mister Satan : 04/07/2003 - MinGW porting mods, and singleinput.cxx; a cool Fl_Input oriented spreadsheet example
- - Marek Paliwoda : 01/08/2003 - Porting mods for Borland
- - Ori Berger : 03/16/2006 - Optimizations for >500k rows/cols
-
- LICENSE
-
- Greg added the following license to the original distribution of Fl_Table. He
- kindly gave his permission to integrate Fl_Table and Fl_Table_Row into FLTK,
- allowing FLTK license to apply while his widgets are part of the library.
-
- If used on its own, this is the license that applies:
-
- \verbatim
- Fl_Table License
- December 16, 2002
-
- The Fl_Table library and included programs are provided under the terms
- of the GNU Library General Public License (LGPL) with the following
- exceptions:
-
- 1. Modifications to the Fl_Table configure script, config
- header file, and makefiles by themselves to support
- a specific platform do not constitute a modified or
- derivative work.
-
- The authors do request that such modifications be
- contributed to the Fl_Table project - send all
- contributions to "erco at seriss dot com".
-
- 2. Widgets that are subclassed from Fl_Table widgets do not
- constitute a derivative work.
-
- 3. Static linking of applications and widgets to the
- Fl_Table library does not constitute a derivative work
- and does not require the author to provide source
- code for the application or widget, use the shared
- Fl_Table libraries, or link their applications or
- widgets against a user-supplied version of Fl_Table.
-
- If you link the application or widget to a modified
- version of Fl_Table, then the changes to Fl_Table must be
- provided under the terms of the LGPL in sections
- 1, 2, and 4.
-
- 4. You do not have to provide a copy of the Fl_Table license
- with programs that are linked to the Fl_Table library, nor
- do you have to identify the Fl_Table license in your
- program or documentation as required by section 6
- of the LGPL.
-
- However, programs must still identify their use of Fl_Table.
- The following example statement can be included in user
- documentation to satisfy this requirement:
-
- [program/widget] is based in part on the work of
- the Fl_Table project http://seriss.com/people/erco/fltk/Fl_Table/
- \endverbatim
-
-
- */
-class FL_EXPORT Fl_Table : public Fl_Group {
-public:
- /**
- The context bit flags for Fl_Table related callbacks (eg. draw_cell(), callback(), etc)
- */
- enum TableContext {
- CONTEXT_NONE = 0, ///< no known context
- CONTEXT_STARTPAGE = 0x01, ///< before a page is redrawn
- CONTEXT_ENDPAGE = 0x02, ///< after a page is redrawn
- CONTEXT_ROW_HEADER = 0x04, ///< in the row header
- CONTEXT_COL_HEADER = 0x08, ///< in the col header
- CONTEXT_CELL = 0x10, ///< in one of the cells
- CONTEXT_TABLE = 0x20, ///< in a dead zone of table
- CONTEXT_RC_RESIZE = 0x40 ///< column or row being resized
- };
-
-private:
- int _rows, _cols; // total rows/cols
- int _row_header_w; // width of row header
- int _col_header_h; // height of column header
- int _row_position; // last row_position set (not necessarily == toprow!)
- int _col_position; // last col_position set (not necessarily == leftcol!)
-
- char _row_header; // row header enabled?
- char _col_header; // col header enabled?
- char _row_resize; // row resizing enabled?
- char _col_resize; // col resizing enabled?
- int _row_resize_min; // row minimum resizing height (default=1)
- int _col_resize_min; // col minimum resizing width (default=1)
-
- // OPTIMIZATION: partial row/column redraw variables
- int _redraw_toprow;
- int _redraw_botrow;
- int _redraw_leftcol;
- int _redraw_rightcol;
- Fl_Color _row_header_color;
- Fl_Color _col_header_color;
-
- int _auto_drag;
- int _selecting;
-
- // An STL-ish vector without templates
- class FL_EXPORT IntVector {
- int *arr;
- unsigned int _size;
- void init() {
- arr = NULL;
- _size = 0;
- }
- void copy(int *newarr, unsigned int newsize) {
- size(newsize);
- memcpy(arr, newarr, newsize * sizeof(int));
- }
- public:
- IntVector() { init(); } // CTOR
- ~IntVector() { if ( arr ) free(arr); arr = NULL; } // DTOR
- IntVector(IntVector&o) { init(); copy(o.arr, o._size); } // COPY CTOR
- IntVector& operator=(IntVector&o) { // ASSIGN
- init();
- copy(o.arr, o._size);
- return(*this);
- }
- int operator[](int x) const { return(arr[x]); }
- int& operator[](int x) { return(arr[x]); }
- unsigned int size() { return(_size); }
- void size(unsigned int count) {
- if ( count != _size ) {
- arr = (int*)realloc(arr, count * sizeof(int));
- _size = count;
- }
- }
- int pop_back() { int tmp = arr[_size-1]; _size--; return(tmp); }
- void push_back(int val) { unsigned int x = _size; size(_size+1); arr[x] = val; }
- int back() { return(arr[_size-1]); }
- };
-
- IntVector _colwidths; // column widths in pixels
- IntVector _rowheights; // row heights in pixels
-
- Fl_Cursor _last_cursor; // last mouse cursor before changed to 'resize' cursor
-
- // EVENT CALLBACK DATA
- TableContext _callback_context; // event context
- int _callback_row, _callback_col; // event row/col
-
- // handle() state variables.
- // Put here instead of local statics in handle(), so more
- // than one Fl_Table can exist without crosstalk between them.
- //
- int _resizing_col; // column being dragged
- int _resizing_row; // row being dragged
- int _dragging_x; // starting x position for horiz drag
- int _dragging_y; // starting y position for vert drag
- int _last_row; // last row we FL_PUSH'ed
-
- // Redraw single cell
- void _redraw_cell(TableContext context, int R, int C);
-
- void _start_auto_drag();
- void _stop_auto_drag();
- void _auto_drag_cb();
- static void _auto_drag_cb2(void *d);
-
-protected:
- enum ResizeFlag {
- RESIZE_NONE = 0,
- RESIZE_COL_LEFT = 1,
- RESIZE_COL_RIGHT = 2,
- RESIZE_ROW_ABOVE = 3,
- RESIZE_ROW_BELOW = 4
- };
-
- int table_w, table_h; // table's virtual size (in pixels)
- int toprow, botrow, leftcol, rightcol; // four corners of viewable table
-
- // selection
- int current_row, current_col;
- int select_row, select_col;
-
- // OPTIMIZATION: Precomputed scroll positions for the toprow/leftcol
- int toprow_scrollpos;
- int leftcol_scrollpos;
-
- // Dimensions
- int tix, tiy, tiw, tih; // data table inner dimension xywh
- int tox, toy, tow, toh; // data table outer dimension xywh
- int wix, wiy, wiw, wih; // widget inner dimension xywh
-
- Fl_Scroll *table; // container for child fltk widgets (if any)
- Fl_Scrollbar *vscrollbar; // vertical scrollbar
- Fl_Scrollbar *hscrollbar; // horizontal scrollbar
-
- // Fltk
- int handle(int e); // fltk handle() override
-
- // Class maintenance
- void recalc_dimensions();
- void table_resized(); // table resized; recalc
- void table_scrolled(); // table scrolled; recalc
- void get_bounds(TableContext context, // return x/y/w/h bounds for context
- int &X, int &Y, int &W, int &H);
- void change_cursor(Fl_Cursor newcursor); // change mouse cursor to some other shape
- TableContext cursor2rowcol(int &R, int &C, ResizeFlag &resizeflag);
- // find r/c given current x/y event
- int find_cell(TableContext context, // find cell's x/y/w/h given r/c
- int R, int C, int &X, int &Y, int &W, int &H);
- int row_col_clamp(TableContext context, int &R, int &C);
- // clamp r/c to known universe
-
- /**
- Subclass should override this method to handle drawing the cells.
-
- This method will be called whenever the table is redrawn, once per cell.
-
- Only cells that are completely (or partially) visible will be told to draw.
-
- \p context will be one of the following:
-
- <table border=1>
- <tr>
- <td>\p Fl_Table::CONTEXT_STARTPAGE</td>
- <td>When table, or parts of the table, are about to be redrawn.<br>
- Use to initialize static data, such as font selections.<p>
- R/C will be zero,<br>
- X/Y/W/H will be the dimensions of the table's entire data area.<br>
- (Useful for locking a database before accessing; see
- also visible_cells())</td>
- </tr><tr>
- <td>\p Fl_Table::CONTEXT_ENDPAGE</td>
- <td>When table has completed being redrawn.<br>
- R/C will be zero, X/Y/W/H dimensions of table's data area.<br>
- (Useful for unlocking a database after accessing)</td>
- </tr><tr>
- <td>\p Fl_Table::CONTEXT_ROW_HEADER</td>
- <td>Whenever a row header cell needs to be drawn.<br>
- R will be the row number of the header being redrawn,<br>
- C will be zero,<br>
- X/Y/W/H will be the fltk drawing area of the row header in the window </td>
- </tr><tr>
- <td>\p Fl_Table::CONTEXT_COL_HEADER</td>
- <td>Whenever a column header cell needs to be drawn.<br>
- R will be zero, <br>
- C will be the column number of the header being redrawn,<br>
- X/Y/W/H will be the fltk drawing area of the column header in the window </td>
- </tr><tr>
- <td>\p Fl_Table::CONTEXT_CELL</td>
- <td>Whenever a data cell in the table needs to be drawn.<br>
- R/C will be the row/column of the cell to be drawn,<br>
- X/Y/W/H will be the fltk drawing area of the cell in the window </td>
- </tr><tr>
- <td>\p Fl_Table::CONTEXT_RC_RESIZE</td>
- <td>Whenever table or row/column is resized or scrolled,
- either interactively or via col_width() or row_height().<br>
- R/C/X/Y/W/H will all be zero.
- <p>
- Useful for fltk containers that need to resize or move
- the child fltk widgets.</td>
- </tr>
- </table>
-
- \p row and \p col will be set to the row and column number
- of the cell being drawn. In the case of row headers, \p col will be \a 0.
- In the case of column headers, \p row will be \a 0.
-
- <tt>x/y/w/h</tt> will be the position and dimensions of where the cell
- should be drawn.
-
- In the case of custom widgets, a minimal draw_cell() override might
- look like the following. With custom widgets it is up to the caller to handle
- drawing everything within the dimensions of the cell, including handling the
- selection color. Note all clipping must be handled as well; this allows drawing
- outside the dimensions of the cell if so desired for 'custom effects'.
-
- \code
- // This is called whenever Fl_Table wants you to draw a cell
- void MyTable::draw_cell(TableContext context, int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0) {
- static char s[40];
- sprintf(s, "%d/%d", R, C); // text for each cell
- switch ( context ) {
- case CONTEXT_STARTPAGE: // Fl_Table telling us its starting to draw page
- fl_font(FL_HELVETICA, 16);
- return;
-
- case CONTEXT_ROW_HEADER: // Fl_Table telling us it's draw row/col headers
- case CONTEXT_COL_HEADER:
- fl_push_clip(X, Y, W, H);
- {
- fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, color());
- fl_color(FL_BLACK);
- fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
- }
- fl_pop_clip();
- return;
-
- case CONTEXT_CELL: // Fl_Table telling us to draw cells
- fl_push_clip(X, Y, W, H);
- {
- // BG COLOR
- fl_color( row_selected(R) ? selection_color() : FL_WHITE);
- fl_rectf(X, Y, W, H);
-
- // TEXT
- fl_color(FL_BLACK);
- fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
-
- // BORDER
- fl_color(FL_LIGHT2);
- fl_rect(X, Y, W, H);
- }
- fl_pop_clip();
- return;
-
- default:
- return;
- }
- //NOTREACHED
- }
- \endcode
- */
- virtual void draw_cell(TableContext context, int R=0, int C=0,
- int X=0, int Y=0, int W=0, int H=0)
- { } // overridden by deriving class
-
- long row_scroll_position(int row); // find scroll position of row (in pixels)
- long col_scroll_position(int col); // find scroll position of col (in pixels)
-
- int is_fltk_container() { // does table contain fltk widgets?
- return( Fl_Group::children() > 3 ); // (ie. more than box and 2 scrollbars?)
- }
-
- static void scroll_cb(Fl_Widget*,void*); // h/v scrollbar callback
-
- void damage_zone(int r1, int c1, int r2, int c2, int r3 = 0, int c3 = 0);
-
- void redraw_range(int toprow, int botrow, int leftcol, int rightcol) {
- if ( _redraw_toprow == -1 ) {
- // Initialize redraw range
- _redraw_toprow = toprow;
- _redraw_botrow = botrow;
- _redraw_leftcol = leftcol;
- _redraw_rightcol = rightcol;
- } else {
- // Extend redraw range
- if ( toprow < _redraw_toprow ) _redraw_toprow = toprow;
- if ( botrow > _redraw_botrow ) _redraw_botrow = botrow;
- if ( leftcol < _redraw_leftcol ) _redraw_leftcol = leftcol;
- if ( rightcol > _redraw_rightcol ) _redraw_rightcol = rightcol;
- }
-
- // Indicate partial redraw needed of some cells
- damage(FL_DAMAGE_CHILD);
- }
-
-public:
- /**
- The constructor for the Fl_Table.
- This creates an empty table with no rows or columns,
- with headers and row/column resize behavior disabled.
- */
- Fl_Table(int X, int Y, int W, int H, const char *l=0);
-
- /**
- The destructor for the Fl_Table.
- Destroys the table and its associated widgets.
- */
- ~Fl_Table();
-
- /**
- Clears the table to zero rows, zero columns.
- Same as rows(0); cols(0);
- \see rows(int), cols(int)
- */
- virtual void clear() { rows(0); cols(0); }
-
- // \todo: add topline(), middleline(), bottomline()
-
- /**
- Sets the kind of box drawn around the data table,
- the default being FL_NO_BOX. Changing this value will cause the table
- to redraw.
- */
- inline void table_box(Fl_Boxtype val) {
- table->box(val);
- table_resized();
- }
-
- /**
- Returns the current box type used for the data table.
- */
- inline Fl_Boxtype table_box( void ) {
- return(table->box());
- }
-
- /**
- Sets the number of rows in the table, and the table is redrawn.
- */
- virtual void rows(int val); // set/get number of rows
-
- /**
- Returns the number of rows in the table.
- */
- inline int rows() {
- return(_rows);
- }
-
- /**
- Set the number of columns in the table and redraw.
- */
- virtual void cols(int val); // set/get number of columns
-
- /**
- Get the number of columns in the table.
- */
- inline int cols() {
- return(_cols);
- }
-
- /**
- Returns the range of row and column numbers for all visible
- and partially visible cells in the table.
-
- These values can be used e.g. by your draw_cell() routine during
- CONTEXT_STARTPAGE to figure out what cells are about to be redrawn
- for the purposes of locking the data from a database before it's drawn.
-
- \code
- leftcol rightcol
- : :
- toprow .. .-------------------.
- | |
- | V I S I B L E |
- | |
- | T A B L E |
- | |
- botrow .. '-------------------`
- \endcode
-
- e.g. in a table where the visible rows are 5-20, and the
- visible columns are 100-120, then those variables would be:
-
- - toprow = 5
- - botrow = 20
- - leftcol = 100
- - rightcol = 120
- */
- inline void visible_cells(int& r1, int& r2, int& c1, int& c2) {
- r1 = toprow;
- r2 = botrow;
- c1 = leftcol;
- c2 = rightcol;
- }
-
- /**
- Returns 1 if someone is interactively resizing a row or column.
- You can currently call this only from within your callback().
- */
- int is_interactive_resize() {
- return(_resizing_row != -1 || _resizing_col != -1);
- }
-
- /**
- Returns the current value of this flag.
- */
- inline int row_resize() {
- return(_row_resize);
- }
-
- /**
- Allows/disallows row resizing by the user.
- 1=allow interactive resizing, 0=disallow interactive resizing.
- Since interactive resizing is done via the row headers,
- row_header() must also be enabled to allow resizing.
- */
- void row_resize(int flag) { // enable row resizing
- _row_resize = flag;
- }
-
- /**
- Returns the current value of this flag.
- */
- inline int col_resize() {
- return(_col_resize);
- }
- /**
- Allows/disallows column resizing by the user.
- 1=allow interactive resizing, 0=disallow interactive resizing.
- Since interactive resizing is done via the column headers,
- \p col_header() must also be enabled to allow resizing.
- */
- void col_resize(int flag) { // enable col resizing
- _col_resize = flag;
- }
-
- /**
- Sets the current column minimum resize value.
- This is used to prevent the user from interactively resizing
- any column to be smaller than 'pixels'. Must be a value >=1.
- */
- inline int col_resize_min() { // column minimum resizing width
- return(_col_resize_min);
- }
-
- /**
- Returns the current column minimum resize value.
- */
- void col_resize_min(int val) {
- _col_resize_min = ( val < 1 ) ? 1 : val;
- }
-
- /**
- Returns the current row minimum resize value.
- */
- inline int row_resize_min() { // column minimum resizing width
- return(_row_resize_min);
- }
-
- /**
- Sets the current row minimum resize value.
- This is used to prevent the user from interactively resizing
- any row to be smaller than 'pixels'. Must be a value >=1.
- */
- void row_resize_min(int val) {
- _row_resize_min = ( val < 1 ) ? 1 : val;
- }
-
- /**
- Returns the value of this flag.
- */
- inline int row_header() { // set/get row header enable flag
- return(_row_header);
- }
-
- /**
- Enables/disables showing the row headers. 1=enabled, 0=disabled.
- If changed, the table is redrawn.
- */
- void row_header(int flag) {
- _row_header = flag;
- table_resized();
- redraw();
- }
-
- /**
- Returns if column headers are enabled or not.
- */
- inline int col_header() { // set/get col header enable flag
- return(_col_header);
- }
-
- /**
- Enable or disable column headers.
- If changed, the table is redrawn.
- */
- void col_header(int flag) {
- _col_header = flag;
- table_resized();
- redraw();
- }
-
- /**
- Sets the height in pixels for column headers and redraws the table.
- */
- inline void col_header_height(int height) { // set/get col header height
- _col_header_h = height;
- table_resized();
- redraw();
- }
-
- /**
- Gets the column header height.
- */
- inline int col_header_height() {
- return(_col_header_h);
- }
-
- /**
- Sets the row header width to n and causes the screen to redraw.
- */
- inline void row_header_width(int width) { // set/get row header width
- _row_header_w = width;
- table_resized();
- redraw();
- }
-
- /**
- Returns the current row header width (in pixels).
- */
- inline int row_header_width() {
- return(_row_header_w);
- }
-
- /**
- Sets the row header color and causes the screen to redraw.
- */
- inline void row_header_color(Fl_Color val) { // set/get row header color
- _row_header_color = val;
- redraw();
- }
-
- /**
- Returns the current row header color.
- */
- inline Fl_Color row_header_color() {
- return(_row_header_color);
- }
-
- /**
- Sets the color for column headers and redraws the table.
- */
- inline void col_header_color(Fl_Color val) { // set/get col header color
- _col_header_color = val;
- redraw();
- }
-
- /**
- Gets the color for column headers.
- */
- inline Fl_Color col_header_color() {
- return(_col_header_color);
- }
-
- /**
- Sets the height of the specified row in pixels,
- and the table is redrawn.
- callback() will be invoked with CONTEXT_RC_RESIZE
- if the row's height was actually changed, and when() is FL_WHEN_CHANGED.
- */
- void row_height(int row, int height); // set/get row height
-
- /**
- Returns the current height of the specified row as a value in pixels.
- */
- inline int row_height(int row) {
- return((row<0 || row>=(int)_rowheights.size()) ? 0 : _rowheights[row]);
- }
-
- /**
- Sets the width of the specified column in pixels, and the table is redrawn.
- callback() will be invoked with CONTEXT_RC_RESIZE
- if the column's width was actually changed, and when() is FL_WHEN_CHANGED.
- */
- void col_width(int col, int width); // set/get a column's width
-
- /**
- Returns the current width of the specified column in pixels.
- */
- inline int col_width(int col) {
- return((col<0 || col>=(int)_colwidths.size()) ? 0 : _colwidths[col]);
- }
-
- /**
- Convenience method to set the height of all rows to the
- same value, in pixels. The screen is redrawn.
- */
- void row_height_all(int height) { // set all row/col heights
- for ( int r=0; r<rows(); r++ ) {
- row_height(r, height);
- }
- }
-
- /**
- Convenience method to set the width of all columns to the
- same value, in pixels. The screen is redrawn.
- */
- void col_width_all(int width) {
- for ( int c=0; c<cols(); c++ ) {
- col_width(c, width);
- }
- }
-
- /**
- Sets the row scroll position to 'row', and causes the screen to redraw.
- */
- void row_position(int row); // set/get table's current scroll position
-
- /**
- Sets the column scroll position to column 'col', and causes the screen to redraw.
- */
- void col_position(int col);
-
- /**
- Returns the current row scroll position as a row number.
- */
- int row_position() { // current row position
- return(_row_position);
- }
-
- /**
- Returns the current column scroll position as a column number.
- */
- int col_position() { // current col position
- return(_col_position);
- }
-
- /**
- Sets which row should be at the top of the table,
- scrolling as necessary, and the table is redrawn. If the table
- cannot be scrolled that far, it is scrolled as far as possible.
- */
- inline void top_row(int row) { // set/get top row (deprecated)
- row_position(row);
- }
-
- /**
- Returns the current top row shown in the table.
- This row may be partially obscured.
- */
- inline int top_row() {
- return(row_position());
- }
- int is_selected(int r, int c); // selected cell
- void get_selection(int &row_top, int &col_left, int &row_bot, int &col_right);
- void set_selection(int row_top, int col_left, int row_bot, int col_right);
- int move_cursor(int R, int C);
-
- /**
- Changes the size of the Fl_Table, causing it to redraw.
- */
- void resize(int X, int Y, int W, int H); // fltk resize() override
- void draw(void); // fltk draw() override
-
- // This crashes sortapp() during init.
- // void box(Fl_Boxtype val) {
- // Fl_Group::box(val);
- // if ( table ) {
- // resize(x(), y(), w(), h());
- // }
- // }
- // Fl_Boxtype box(void) const {
- // return(Fl_Group::box());
- // }
-
- // Child group
- void init_sizes() {
- table->init_sizes();
- table->redraw();
- }
- void add(Fl_Widget& w) {
- table->add(w);
- }
- void add(Fl_Widget* w) {
- table->add(w);
- }
- void insert(Fl_Widget& w, int n) {
- table->insert(w,n);
- }
- void insert(Fl_Widget& w, Fl_Widget* w2) {
- table->insert(w,w2);
- }
- void remove(Fl_Widget& w) {
- table->remove(w);
- }
- void begin() {
- table->begin();
- }
- void end() {
- table->end();
- // HACK: Avoid showing Fl_Scroll; seems to erase screen
- // causing unnecessary flicker, even if its box() is FL_NO_BOX.
- //
- if ( table->children() > 2 ) {
- table->show();
- } else {
- table->hide();
- }
- Fl_Group::current(Fl_Group::parent());
- }
- Fl_Widget * const *array() {
- return(table->array());
- }
-
- /**
- Returns the child widget by an index.
-
- When using the Fl_Table as a container for FLTK widgets, this method returns
- the widget pointer from the internal array of widgets in the container.
-
- Typically used in loops, eg:
- \code
- for ( int i=0; i<children(); i++ ) {
- Fl_Widget *w = child(i);
- [..]
- }
- \endcode
- */
- Fl_Widget *child(int n) const {
- return(table->child(n));
- }
-
- /**
- Returns the number of children in the table.
-
- When using the Fl_Table as a container for FLTK widgets, this method returns
- how many child widgets the table has.
-
- \see child(int)
- */
- int children() const {
- return(table->children()-2); // -2: skip Fl_Scroll's h/v scrollbar widgets
- }
- int find(const Fl_Widget *w) const {
- return(table->find(w));
- }
- int find(const Fl_Widget &w) const {
- return(table->find(w));
- }
- // CALLBACKS
-
- /**
- * Returns the current row the event occurred on.
- *
- * This function should only be used from within the user's callback function
- */
- int callback_row() {
- return(_callback_row);
- }
-
- /**
- * Returns the current column the event occurred on.
- *
- * This function should only be used from within the user's callback function
- */
- int callback_col() {
- return(_callback_col);
- }
-
- /**
- * Returns the current 'table context'.
- *
- * This function should only be used from within the user's callback function
- */
- TableContext callback_context() {
- return(_callback_context);
- }
-
- void do_callback(TableContext context, int row, int col) {
- _callback_context = context;
- _callback_row = row;
- _callback_col = col;
- Fl_Widget::do_callback();
- }
-
-#if FL_DOXYGEN
- /**
- The Fl_Widget::when() function is used to set a group of flags, determining
- when the widget callback is called:
-
- <table border=1>
- <tr>
- <td>\p FL_WHEN_CHANGED</td>
- <td>
- callback() will be called when rows or columns are resized (interactively or
- via col_width() or row_height()), passing CONTEXT_RC_RESIZE via
- callback_context().
- </td>
- </tr><tr>
- <td>\p FL_WHEN_RELEASE</td>
- <td>
- callback() will be called during FL_RELEASE events, such as when someone
- releases a mouse button somewhere on the table.
- </td>
- </tr>
- </table>
-
- The callback() routine is sent a TableContext that indicates the context the
- event occurred in, such as in a cell, in a header, or elsewhere on the table.
- When an event occurs in a cell or header, callback_row() and
- callback_col() can be used to determine the row and column. The callback can
- also look at the regular fltk event values (ie. Fl::event() and Fl::button())
- to determine what kind of event is occurring.
- */
- void when(Fl_When flags);
-#endif
-
-#if FL_DOXYGEN
- /**
- Callbacks will be called depending on the setting of Fl_Widget::when().
-
- Callback functions should use the following functions to determine the
- context/row/column:
-
- * Fl_Table::callback_row() returns current row
- * Fl_Table::callback_col() returns current column
- * Fl_Table::callback_context() returns current table context
-
- callback_row() and callback_col() will be set to the row and column number the
- event occurred on. If someone clicked on a row header, \p col will be \a 0.
- If someone clicked on a column header, \p row will be \a 0.
-
- callback_context() will return one of the following:
-
- <table border=1>
- <tr><td><tt>Fl_Table::CONTEXT_ROW_HEADER</tt></td>
- <td>Someone clicked on a row header. Excludes resizing.</td>
- </tr><tr>
- <td><tt>Fl_Table::CONTEXT_COL_HEADER</tt></td>
- <td>Someone clicked on a column header. Excludes resizing.</td>
- </tr><tr>
- <td><tt>Fl_Table::CONTEXT_CELL</tt></td>
- <td>
- Someone clicked on a cell.
-
- To receive callbacks for FL_RELEASE events, you must set
- when(FL_WHEN_RELEASE).
- </td>
- </tr><tr>
- <td><tt>Fl_Table::CONTEXT_RC_RESIZE</tt></td>
- <td>
- Someone is resizing rows/columns either interactively,
- or via the col_width() or row_height() API.
-
- Use is_interactive_resize()
- to determine interactive resizing.
-
- If resizing a column, R=0 and C=column being resized.
-
- If resizing a row, C=0 and R=row being resized.
-
- NOTE: To receive resize events, you must set when(FL_WHEN_CHANGED).
- </td>
- </tr>
- </table>
-
- \code
- class MyTable : public Fl_Table {
- [..]
- private:
- // Handle events that happen on the table
- void event_callback2() {
- int R = callback_row(), // row where event occurred
- C = callback_col(); // column where event occurred
- TableContext context = callback_context(); // which part of table
- fprintf(stderr, "callback: Row=%d Col=%d Context=%d Event=%d\n",
- R, C, (int)context, (int)Fl::event());
- }
-
- // Actual static callback
- static void event_callback(Fl_Widget*, void* data) {
- MyTable *o = (MyTable*)data;
- o-&gt;event_callback2();
- }
-
- public:
- // Constructor
- MyTable() {
- [..]
- table.callback(&event_callback, (void*)this); // setup callback
- table.when(FL_WHEN_CHANGED|FL_WHEN_RELEASE); // when to call it
- }
- };
- \endcode
- */
- void callback(Fl_Widget*, void*);
-#endif
-};
-
-#endif /*_FL_TABLE_H*/
-
-//
-// End of "$Id: Fl_Table.H 8301 2011-01-22 22:40:11Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Table_Row.H b/Libraries/FL/Fl_Table_Row.H
deleted file mode 100644
index f2c3f25c..00000000
--- a/Libraries/FL/Fl_Table_Row.H
+++ /dev/null
@@ -1,211 +0,0 @@
-//
-// "$Id: Fl_Table_Row.H 8301 2011-01-22 22:40:11Z AlbrechtS $"
-//
-
-#ifndef _FL_TABLE_ROW_H
-#define _FL_TABLE_ROW_H
-
-//
-// Fl_Table_Row -- A row oriented table widget
-//
-// A class specializing in a table of rows.
-// Handles row-specific selection behavior.
-//
-// Copyright 2002 by Greg Ercolano.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems to "erco at seriss dot com".
-//
-//
-
-#include "Fl_Table.H"
-
-/**
- A table with row selection capabilities.
-
- This class implements a simple table with the ability to select
- rows. This widget is similar to an Fl_Browser with columns. Most
- methods of importance will be found in the Fl_Table widget, such
- as Fl_Table::rows() and Fl_Table::cols().
-
- To be useful it must be subclassed and at minimum the draw_cell()
- method must be overridden to provide the content of the cells. This widget
- does \em not manage the cell's data content; it is up to the parent
- class's draw_cell() method override to provide this.
-
- Events on the cells and/or headings generate callbacks when they are
- clicked by the user. You control when events are generated based on
- the values you supply for Fl_Table::when().
- */
-class FL_EXPORT Fl_Table_Row : public Fl_Table {
-public:
- enum TableRowSelectMode {
- SELECT_NONE, // no selection allowed
- SELECT_SINGLE, // single row selection
- SELECT_MULTI // multiple row selection (default)
- };
-private:
- // An STL-ish vector without templates
- class FL_EXPORT CharVector {
- char *arr;
- int _size;
- void init() {
- arr = NULL;
- _size = 0;
- }
- void copy(char *newarr, int newsize) {
- size(newsize);
- memcpy(arr, newarr, newsize * sizeof(char));
- }
- public:
- CharVector() { // CTOR
- init();
- }
- ~CharVector() { // DTOR
- if ( arr ) free(arr);
- arr = NULL;
- }
- CharVector(CharVector&o) { // COPY CTOR
- init();
- copy(o.arr, o._size);
- }
- CharVector& operator=(CharVector&o) { // ASSIGN
- init();
- copy(o.arr, o._size);
- return(*this);
- }
- char operator[](int x) const {
- return(arr[x]);
- }
- char& operator[](int x) {
- return(arr[x]);
- }
- int size() {
- return(_size);
- }
- void size(int count) {
- if ( count != _size ) {
- arr = (char*)realloc(arr, count * sizeof(char));
- _size = count;
- }
- }
- char pop_back() {
- char tmp = arr[_size-1];
- _size--;
- return(tmp);
- }
- void push_back(char val) {
- int x = _size;
- size(_size+1);
- arr[x] = val;
- }
- char back() {
- return(arr[_size-1]);
- }
- };
- CharVector _rowselect; // selection flag for each row
-
- // handle() state variables.
- // Put here instead of local statics in handle(), so more
- // than one instance can exist without crosstalk between.
- //
- int _dragging_select; // dragging out a selection?
- int _last_row;
- int _last_y; // last event's Y position
- int _last_push_x; // last PUSH event's X position
- int _last_push_y; // last PUSH event's Y position
-
- TableRowSelectMode _selectmode;
-
-protected:
- int handle(int event);
- int find_cell(TableContext context, // find cell's x/y/w/h given r/c
- int R, int C, int &X, int &Y, int &W, int &H) {
- return(Fl_Table::find_cell(context, R, C, X, Y, W, H));
- }
-
-public:
- /**
- The constructor for the Fl_Table_Row.
- This creates an empty table with no rows or columns,
- with headers and row/column resize behavior disabled.
- */
- Fl_Table_Row(int X, int Y, int W, int H, const char *l=0) : Fl_Table(X,Y,W,H,l) {
- _dragging_select = 0;
- _last_row = -1;
- _last_y = -1;
- _last_push_x = -1;
- _last_push_y = -1;
- _selectmode = SELECT_MULTI;
- }
-
- /**
- The destructor for the Fl_Table_Row.
- Destroys the table and its associated widgets.
- */
- ~Fl_Table_Row() { }
-
- void rows(int val); // set number of rows
- int rows() { // get number of rows
- return(Fl_Table::rows());
- }
-
- /**
- Sets the table selection mode.
-
- - \p Fl_Table_Row::SELECT_NONE - No selection allowed
- - \p Fl_Table_Row::SELECT_SINGLE - Only single rows can be selected
- - \p Fl_Table_Row::SELECT_MULTI - Multiple rows can be selected
- */
- void type(TableRowSelectMode val); // set selection mode
-
- TableRowSelectMode type() const { // get selection mode
- return(_selectmode);
- }
-
- /**
- Checks to see if 'row' is selected. Returns 1 if selected, 0 if not. You can
- change the selection of a row by clicking on it, or by using
- select_row(row, flag)
- */
- int row_selected(int row); // is row selected? (0=no, 1=yes, -1=range err)
-
- /**
- Changes the selection state for 'row', depending on the value
- of 'flag'. 0=deselected, 1=select, 2=toggle existing state.
- */
- int select_row(int row, int flag=1); // select state for row: flag:0=off, 1=on, 2=toggle
- // returns: 0=no change, 1=changed, -1=range err
-
- /**
- This convenience function changes the selection state
- for \em all rows based on 'flag'. 0=deselect, 1=select, 2=toggle existing state.
- */
- void select_all_rows(int flag=1); // all rows to a known state
-
- void clear() {
- rows(0); // implies clearing selection
- cols(0);
- Fl_Table::clear(); // clear the table
- }
-};
-
-#endif /*_FL_TABLE_ROW_H*/
-
-//
-// End of "$Id: Fl_Table_Row.H 8301 2011-01-22 22:40:11Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Tabs.H b/Libraries/FL/Fl_Tabs.H
deleted file mode 100644
index 66b4d3be..00000000
--- a/Libraries/FL/Fl_Tabs.H
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// "$Id: Fl_Tabs.H 8101 2010-12-22 13:06:03Z AlbrechtS $"
-//
-// Tab header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Tabs widget . */
-
-#ifndef Fl_Tabs_H
-#define Fl_Tabs_H
-
-#include "Fl_Group.H"
-
-/**
- The Fl_Tabs widget is the "file card tabs"
- interface that allows you to put lots and lots of buttons and
- switches in a panel, as popularized by many toolkits.
-
- \image html tabs.png
- \image latex tabs.png "Fl_Tabs" width=8cm
-
- Clicking the tab makes a child visible() by calling
- show() on it, and all other children are made invisible
- by calling hide() on them. Usually the children are Fl_Group widgets
- containing several widgets themselves.
-
- Each child makes a card, and its label() is printed
- on the card tab, including the label font and style. The
- selection color of that child is used to color the tab, while
- the color of the child determines the background color of the pane.
-
- The size of the tabs is controlled by the bounding box of the
- children (there should be some space between the children and
- the edge of the Fl_Tabs), and the tabs may be placed
- "inverted" on the bottom - this is determined by which
- gap is larger. It is easiest to lay this out in fluid, using the
- fluid browser to select each child group and resize them until
- the tabs look the way you want them to.
-*/
-class FL_EXPORT Fl_Tabs : public Fl_Group {
- Fl_Widget *value_;
- Fl_Widget *push_;
- int *tab_pos; // array of x-offsets of tabs per child + 1
- int *tab_width; // array of widths of tabs per child + 1
- int tab_count; // array size
- int tab_positions(); // allocate and calculate tab positions
- void clear_tab_positions();
- int tab_height();
- void draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int sel=0);
-protected:
- void redraw_tabs();
- void draw();
-
-public:
- int handle(int);
- Fl_Widget *value();
- int value(Fl_Widget *);
- Fl_Widget *push() const {return push_;}
- int push(Fl_Widget *);
- Fl_Tabs(int,int,int,int,const char * = 0);
- Fl_Widget *which(int event_x, int event_y);
- ~Fl_Tabs();
- void client_area(int &rx, int &ry, int &rw, int &rh, int tabh=0);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Tabs.H 8101 2010-12-22 13:06:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Text_Buffer.H b/Libraries/FL/Fl_Text_Buffer.H
deleted file mode 100644
index 630fccbb..00000000
--- a/Libraries/FL/Fl_Text_Buffer.H
+++ /dev/null
@@ -1,781 +0,0 @@
-//
-// "$Id: Fl_Text_Buffer.H 8148 2010-12-31 22:38:03Z matt $"
-//
-// Header file for Fl_Text_Buffer class.
-//
-// Copyright 2001-2010 by Bill Spitzak and others.
-// Original code Copyright Mark Edel. Permission to distribute under
-// the LGPL for the FLTK library granted by Mark Edel.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Text_Buffer, Fl_Text_Selection widget . */
-
-#ifndef FL_TEXT_BUFFER_H
-#define FL_TEXT_BUFFER_H
-
-
-#undef ASSERT_UTF8
-
-#ifdef ASSERT_UTF8
-# include <assert.h>
-# define IS_UTF8_ALIGNED(a) if (a && *a) assert(fl_utf8len(*(a))>0);
-# define IS_UTF8_ALIGNED2(a, b) if (b>=0 && b<a->length()) assert(fl_utf8len(a->byte_at(b))>0);
-#else
-# define IS_UTF8_ALIGNED(a)
-# define IS_UTF8_ALIGNED2(a, b)
-#endif
-
-
-/*
- "character size" is the size of a UTF-8 character in bytes
- "character width" is the width of a Unicode character in pixels
- "column" was orginally defined as a character offset from the left margin.
- It was identical to the byte offset. In UTF-8, we have neither a byte offset
- nor truly fixed width fonts (*). Column could be a pixel value multiplied with
- an average character width (which is a bearable approximation).
-
- * in Unicode, there are no fixed width fonts! Even if the ASCII characters may
- happen to be all the same width in pixels, chinese charcaters surely are not.
- There are plenty of exceptions, like ligatures, that make special handling of
- "fixed" character widths a nightmare. I decided to remove all references to
- fixed fonts and see "columns" as a multiple of the average width of a
- character in the main font.
- - Matthias
- */
-
-
-/* Maximum length in characters of a tab or control character expansion
- of a single buffer character */
-#define FL_TEXT_MAX_EXP_CHAR_LEN 20
-
-#include "Fl_Export.H"
-
-
-/**
- \class Fl_Text_Selection
- \brief This is an internal class for Fl_Text_Buffer to manage text selections.
- This class works correctly with utf-8 strings assuming that the parameters
- for all calls are on character boundaries.
- */
-class FL_EXPORT Fl_Text_Selection {
- friend class Fl_Text_Buffer;
-
-public:
-
- /**
- \brief Set the selection range.
- \param start byte offset to first selected character
- \param end byte offset pointing after last selected character
- */
- void set(int start, int end);
-
- /**
- \brief Updates a selection afer text was modified.
- Updates an individual selection for changes in the corresponding text
- \param pos byte offset into text buffer at which the change occured
- \param nDeleted number of bytes deleted from the buffer
- \param nInserted number of bytes inserted into the buffer
- */
- void update(int pos, int nDeleted, int nInserted);
-
- /**
- \brief Return the byte offset to the first selected character.
- \return byte offset
- */
- int start() const { return mStart; }
-
- /**
- \brief Return the byte ofsset to the character after the last selected character.
- \return byte offset
- */
- int end() const { return mEnd; }
-
- /**
- \brief Returns true if any text is selected.
- \return a non-zero number if any text has been selected, or 0
- if no text is selected.
- */
- bool selected() const { return mSelected; }
-
- /**
- \brief Modify the 'selected' flag.
- \param b new flag
- */
- void selected(bool b) { mSelected = b; }
-
- /**
- Return true if position \p pos with indentation \p dispIndex is in
- the Fl_Text_Selection.
- */
- int includes(int pos) const;
-
- /**
- \brief Return the positions of this selection.
- \param start retrun byte offset to first selected character
- \param end retrun byte offset pointing after last selected character
- \return true if selected
- */
- int position(int* start, int* end) const;
-
-protected:
-
- int mStart; ///< byte offset to the first selected character
- int mEnd; ///< byte offset to the character after the last selected character
- bool mSelected; ///< this flag is set if any text is selected
-};
-
-
-typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted,
- int nRestyled, const char* deletedText,
- void* cbArg);
-
-
-typedef void (*Fl_Text_Predelete_Cb)(int pos, int nDeleted, void* cbArg);
-
-
-/**
- \brief This class manages unicode displayed in one or more Fl_Text_Display widgets.
-
- All text in Fl_Text_Buffermust be encoded in UTF-8. All indices used in the
- function calls must be aligned to the start of a UTF-8 sequence. All indices
- and pointers returned will be aligned. All functions that return a single
- character will return that in an unsiged int in UCS-4 encoding.
-
- The Fl_Text_Buffer class is used by the Fl_Text_Display
- and Fl_Text_Editor to manage complex text data and is based upon the
- excellent NEdit text editor engine - see http://www.nedit.org/.
- */
-class FL_EXPORT Fl_Text_Buffer {
-public:
-
- /**
- Create an empty text buffer of a pre-determined size.
- \param requestedSize use this to avoid unnecessary re-allocation
- if you know exactly how much the buffer will need to hold
- \param preferredGapSize Initial size for the buffer gap (empty space
- in the buffer where text might be inserted
- if the user is typing sequential chars)
- */
- Fl_Text_Buffer(int requestedSize = 0, int preferredGapSize = 1024);
-
- /**
- Frees a text buffer
- */
- ~Fl_Text_Buffer();
-
- /**
- \brief Returns the number of bytes in the buffer.
- \return size of text in bytes
- */
- int length() const { return mLength; }
-
- /**
- \brief Get a copy of the entire contents of the text buffer.
- Memory is allocated to contain the returned string, which the caller
- must free.
- \return newly allocated text buffer - must be free'd, text is utf8
- */
- char* text() const;
-
- /**
- Replaces the entire contents of the text buffer.
- \param text Text must be valid utf8.
- */
- void text(const char* text);
-
- /**
- \brief Get a copy of a part of the text buffer.
- Return a copy of the text between \p start and \p end character positions
- from text buffer \p buf. Positions start at 0, and the range does not
- include the character pointed to by \p end.
- When you are done with the text, free it using the free() function.
- \param start byte offset to first character
- \param end byte offset after last character in range
- \return newly allocated text buffer - must be free'd, text is utf8
- */
- char* text_range(int start, int end) const;
-
- /**
- Returns the character at the specified position pos in the buffer.
- Positions start at 0
- \param pos byte offset into buffer, pos must be at acharacter boundary
- \return Unicode UCS-4 encoded character
- */
- unsigned int char_at(int pos) const;
-
- /**
- Returns the raw byte at the specified position pos in the buffer.
- Positions start at 0
- \param pos byte offset into buffer
- \return unencoded raw byte
- */
- char byte_at(int pos) const;
-
- /**
- Convert a byte offset in buffer into a memory address.
- \param pos byte offset into buffer
- \return byte offset converted to a memory address
- */
- const char *address(int pos) const
- { return (pos < mGapStart) ? mBuf+pos : mBuf+pos+mGapEnd-mGapStart; }
-
- /**
- Convert a byte offset in buffer into a memory address.
- \param pos byte offset into buffer
- \return byte offset converted to a memory address
- */
- char *address(int pos)
- { return (pos < mGapStart) ? mBuf+pos : mBuf+pos+mGapEnd-mGapStart; }
-
- /**
- Inserts null-terminated string \p text at position \p pos.
- \param pos insertion position as byte offset (must be utf-8 character aligned)
- \param text utf-8 encoded and nul terminated text
- */
- void insert(int pos, const char* text);
-
- /**
- Appends the text string to the end of the buffer.
- \param t utf-8 encoded and nul terminated text
- */
- void append(const char* t) { insert(length(), t); }
-
- /**
- Deletes a range of characters in the buffer.
- \param start byte offset to first character to be removed
- \param end byte offset to charcatre after last character to be removed
- */
- void remove(int start, int end);
-
- /**
- Deletes the characters between \p start and \p end, and inserts the null-terminated string \p text in their place in the buffer.
- \param start byte offset to first character to be removed and new insert position
- \param end byte offset to charcatre after last character to be removed
- \param text utf-8 encoded and nul terminated text
- */
- void replace(int start, int end, const char *text);
-
- /**
- Copies text from one buffer to this one.
- \param fromBuf source text buffer may be the same as this
- \param fromStart byte offset into buffer
- \param fromEnd byte offset into buffer
- \param toPos destination byte offset into buffer
- */
- void copy(Fl_Text_Buffer* fromBuf, int fromStart, int fromEnd, int toPos);
-
- /**
- Undo text modification according to the undo variables or insert text
- from the undo buffer
- */
- int undo(int *cp=0);
-
- /**
- Lets the undo system know if we can undo changes
- */
- void canUndo(char flag=1);
-
- /**
- Inserts a file at the specified position. Returns 0 on success,
- non-zero on error (strerror() contains reason). 1 indicates open
- for read failed (no data loaded). 2 indicates error occurred
- while reading data (data was partially loaded).
- File can be UTF-8 or CP1252-encoded.
- If the input file is not UTF-8-encoded, the Fl_Text_Buffer widget will contain
- UTF-8-transcoded data. By default, the message Fl_Text_Buffer::file_encoding_warning_message
- will warn the user about this.
- \see input_file_was_transcoded and transcoding_warning_action.
- */
- int insertfile(const char *file, int pos, int buflen = 128*1024);
-
- /**
- Appends the named file to the end of the buffer. See also insertfile().
- */
- int appendfile(const char *file, int buflen = 128*1024)
- { return insertfile(file, length(), buflen); }
-
- /**
- Loads a text file into the buffer. See also insertfile().
- */
- int loadfile(const char *file, int buflen = 128*1024)
- { select(0, length()); remove_selection(); return appendfile(file, buflen); }
-
- /**
- Writes the specified portions of the file to a file. Returns 0 on success, non-zero
- on error (strerror() contains reason). 1 indicates open for write failed
- (no data saved). 2 indicates error occurred while writing data
- (data was partially saved).
- */
- int outputfile(const char *file, int start, int end, int buflen = 128*1024);
-
- /**
- Saves a text file from the current buffer
- */
- int savefile(const char *file, int buflen = 128*1024)
- { return outputfile(file, 0, length(), buflen); }
-
- /**
- Gets the tab width.
- */
- int tab_distance() const { return mTabDist; }
-
- /**
- Set the hardware tab distance (width) used by all displays for this buffer,
- and used in computing offsets for rectangular selection operations.
- */
- void tab_distance(int tabDist);
-
- /**
- Selects a range of characters in the buffer.
- */
- void select(int start, int end);
-
- /**
- Returns a non 0 value if text has been selected, 0 otherwise
- */
- int selected() const { return mPrimary.selected(); }
-
- /**
- Cancels any previous selection on the primary text selection object
- */
- void unselect();
-
- /**
- Gets the selection position
- */
- int selection_position(int* start, int* end);
-
- /**
- Returns the currently selected text. When you are done with
- the text, free it using the free() function.
- */
- char* selection_text();
-
- /**
- Removes the text in the primary selection.
- */
- void remove_selection();
-
- /**
- Replaces the text in the primary selection.
- */
- void replace_selection(const char* text);
-
- /**
- Selects a range of characters in the secondary selection.
- */
- void secondary_select(int start, int end);
-
- /**
- Returns a non 0 value if text has been selected in the secondary
- text selection, 0 otherwise
- */
- int secondary_selected() { return mSecondary.selected(); }
-
- /**
- Clears any selection in the secondary text selection object.
- */
- void secondary_unselect();
-
- /**
- Returns the current selection in the secondary text selection object.
- */
- int secondary_selection_position(int* start, int* end);
-
- /**
- Returns the text in the secondary selection. When you are
- done with the text, free it using the free() function.
- */
- char* secondary_selection_text();
-
- /**
- Removes the text from the buffer corresponding to the secondary text selection object.
- */
- void remove_secondary_selection();
-
- /**
- Replaces the text from the buffer corresponding to the secondary
- text selection object with the new string \p text.
- */
- void replace_secondary_selection(const char* text);
-
- /**
- Highlights the specified text within the buffer.
- */
- void highlight(int start, int end);
-
- /**
- Returns the highlighted text. When you are done with the
- text, free it using the free() function.
- */
- int highlight() { return mHighlight.selected(); }
-
- /**
- Unhighlights text in the buffer.
- */
- void unhighlight();
-
- /**
- Highlights the specified text between \p start and \p end within the buffer.
- */
- int highlight_position(int* start, int* end);
-
- /**
- Returns the highlighted text. When you are done with the
- text, free it using the free() function.
- */
- char* highlight_text();
-
- /**
- Adds a callback function that is called whenever the text buffer is
- modified. The callback function is declared as follows:
-
- \code
- typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted,
- int nRestyled, const char* deletedText,
- void* cbArg);
- \endcode
- */
- void add_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
-
- /**
- Removes a modify callback.
- */
- void remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
-
- /**
- Calls all modify callbacks that have been registered using
- the add_modify_callback()
- method.
- */
- void call_modify_callbacks() { call_modify_callbacks(0, 0, 0, 0, 0); }
-
- /**
- Adds a callback routine to be called before text is deleted from the buffer.
- */
- void add_predelete_callback(Fl_Text_Predelete_Cb bufPredelCB, void* cbArg);
-
- /**
- Removes a callback routine \p bufPreDeleteCB associated with argument \p cbArg
- to be called before text is deleted from the buffer.
- */
- void remove_predelete_callback(Fl_Text_Predelete_Cb predelCB, void* cbArg);
-
- /**
- Calls the stored pre-delete callback procedure(s) for this buffer to update
- the changed area(s) on the screen and any other listeners.
- */
- void call_predelete_callbacks() { call_predelete_callbacks(0, 0); }
-
- /**
- Returns the text from the entire line containing the specified
- character position. When you are done with the text, free it
- using the free() function.
- \param pos byte index into buffer
- \return copy of utf8 text, must be free'd
- */
- char* line_text(int pos) const;
-
- /**
- Returns the position of the start of the line containing position \p pos.
- \param pos byte index into buffer
- \return byte offset to line start
- */
- int line_start(int pos) const;
-
- /**
- Finds and returns the position of the end of the line containing position \p pos
- (which is either a pointer to the newline character ending the line,
- or a pointer to one character beyond the end of the buffer)
- \param pos byte index into buffer
- \return byte offset to line end
- */
- int line_end(int pos) const;
-
- /**
- Returns the position corresponding to the start of the word
- \param pos byte index into buffer
- \return byte offset to word start
- */
- int word_start(int pos) const;
-
- /**
- Returns the position corresponding to the end of the word.
- \param pos byte index into buffer
- \return byte offset to word end
- */
- int word_end(int pos) const;
-
- /**
- Count the number of displayed characters between buffer position
- \p lineStartPos and \p targetPos. (displayed characters are the characters
- shown on the screen to represent characters in the buffer, where tabs and
- control characters are expanded)
- */
- int count_displayed_characters(int lineStartPos, int targetPos) const;
-
- /**
- Count forward from buffer position \p startPos in displayed characters
- (displayed characters are the characters shown on the screen to represent
- characters in the buffer, where tabs and control characters are expanded)
- \param lineStartPos byte offset into buffer
- \param nChars number of bytes that are sent to the display
- \return byte offset in input after all output bytes are sent
- */
- int skip_displayed_characters(int lineStartPos, int nChars);
-
- /**
- Counts the number of newlines between \p startPos and \p endPos in buffer.
- The character at position \p endPos is not counted.
- */
- int count_lines(int startPos, int endPos) const;
-
- /**
- Finds the first character of the line \p nLines forward from \p startPos
- in the buffer and returns its position
- */
- int skip_lines(int startPos, int nLines);
-
- /**
- Finds and returns the position of the first character of the line \p nLines backwards
- from \p startPos (not counting the character pointed to by \p startpos if
- that is a newline) in the buffer. \p nLines == 0 means find the beginning of the line
- */
- int rewind_lines(int startPos, int nLines);
-
- /**
- Finds the next occurrence of the specified character.
- Search forwards in buffer for character \p searchChar, starting
- with the character \p startPos, and returning the result in \p foundPos
- returns 1 if found, 0 if not. (The difference between this and
- BufSearchForward is that it's optimized for single characters. The
- overall performance of the text widget is dependent on its ability to
- count lines quickly, hence searching for a single character: newline)
- \param startPos byte offset to start position
- \param searchChar UCS-4 character that we want to find
- \param foundPos byte offset where the character was found
- \return 1 if found, 0 if not
- */
- int findchar_forward(int startPos, unsigned searchChar, int* foundPos) const;
-
- /**
- Search backwards in buffer \p buf for character \p searchChar, starting
- with the character BEFORE \p startPos, returning the result in \p foundPos
- returns 1 if found, 0 if not. (The difference between this and
- BufSearchBackward is that it's optimized for single characters. The
- overall performance of the text widget is dependent on its ability to
- count lines quickly, hence searching for a single character: newline)
- \param startPos byte offset to start position
- \param searchChar UCS-4 character that we want to find
- \param foundPos byte offset where the character was found
- \return 1 if found, 0 if not
- */
- int findchar_backward(int startPos, unsigned int searchChar, int* foundPos) const;
-
- /**
- Search forwards in buffer for string \p searchString, starting with the
- character \p startPos, and returning the result in \p foundPos
- returns 1 if found, 0 if not.
- \param startPos byte offset to start position
- \param searchString utf8 string that we want to find
- \param foundPos byte offset where the string was found
- \param matchCase if set, match character case
- \return 1 if found, 0 if not
- */
- int search_forward(int startPos, const char* searchString, int* foundPos,
- int matchCase = 0) const;
-
- /**
- Search backwards in buffer for string <i>searchCharssearchString</i>, starting with the
- character BEFORE \p startPos, returning the result in \p foundPos
- returns 1 if found, 0 if not.
- \param startPos byte offset to start position
- \param searchString utf8 string that we want to find
- \param foundPos byte offset where the string was found
- \param matchCase if set, match character case
- \return 1 if found, 0 if not
- */
- int search_backward(int startPos, const char* searchString, int* foundPos,
- int matchCase = 0) const;
-
- /**
- Returns the primary selection.
- */
- const Fl_Text_Selection* primary_selection() const { return &mPrimary; }
-
- /**
- Returns the primary selection.
- */
- Fl_Text_Selection* primary_selection() { return &mPrimary; }
-
- /**
- Returns the secondary selection.
- */
- const Fl_Text_Selection* secondary_selection() const { return &mSecondary; }
-
- /**
- Returns the current highlight selection.
- */
- const Fl_Text_Selection* highlight_selection() const { return &mHighlight; }
-
- /**
- Returns the index of the previous character.
- \param ix index to the current char
- */
- int prev_char(int ix) const;
- int prev_char_clipped(int ix) const;
-
- /**
- Returns the index of the next character.
- \param ix index to the current char
- */
- int next_char(int ix) const;
- int next_char_clipped(int ix) const;
-
- /**
- Align an index into the buffer to the current or previous utf8 boundary.
- */
- int utf8_align(int) const;
-
- /**
- \brief true iff the loaded file has been transcoded to UTF-8
- */
- int input_file_was_transcoded;
-
- /** This message may be displayed using the fl_alert() function when a file
- which was not UTF-8 encoded is input.
- */
- static const char* file_encoding_warning_message;
-
- /**
- \brief Pointer to a function called after reading a non UTF-8 encoded file.
-
- This function is called after reading a file if the file content
- was transcoded to UTF-8. Its default implementation calls fl_alert()
- with the text of \ref file_encoding_warning_message. No warning message is
- displayed if this pointer is set to NULL. Use \ref input_file_was_transcoded
- to be informed if file input required transcoding to UTF-8.
- */
- void (*transcoding_warning_action)(Fl_Text_Buffer*);
-
-protected:
-
- /**
- Calls the stored modify callback procedure(s) for this buffer to update the
- changed area(s) on the screen and any other listeners.
- */
- void call_modify_callbacks(int pos, int nDeleted, int nInserted,
- int nRestyled, const char* deletedText) const;
-
- /**
- Calls the stored pre-delete callback procedure(s) for this buffer to update
- the changed area(s) on the screen and any other listeners.
- */
- void call_predelete_callbacks(int pos, int nDeleted) const;
-
- /**
- Internal (non-redisplaying) version of BufInsert. Returns the length of
- text inserted (this is just strlen(\p text), however this calculation can be
- expensive and the length will be required by any caller who will continue
- on to call redisplay). \p pos must be contiguous with the existing text in
- the buffer (i.e. not past the end).
- \return the number of bytes inserted
- */
- int insert_(int pos, const char* text);
-
- /**
- Internal (non-redisplaying) version of BufRemove. Removes the contents
- of the buffer between start and end (and moves the gap to the site of
- the delete).
- */
- void remove_(int start, int end);
-
- /**
- Calls the stored redisplay procedure(s) for this buffer to update the
- screen for a change in a selection.
- */
- void redisplay_selection(Fl_Text_Selection* oldSelection,
- Fl_Text_Selection* newSelection) const;
-
- /**
- Move the gap to start at a new position.
- */
- void move_gap(int pos);
-
- /**
- Reallocates the text storage in the buffer to have a gap starting at \p newGapStart
- and a gap size of \p newGapLen, preserving the buffer's current contents.
- */
- void reallocate_with_gap(int newGapStart, int newGapLen);
-
- char* selection_text_(Fl_Text_Selection* sel) const;
-
- /**
- Removes the text from the buffer corresponding to \p sel.
- */
- void remove_selection_(Fl_Text_Selection* sel);
-
- /**
- Replaces the \p text in selection \p sel.
- */
- void replace_selection_(Fl_Text_Selection* sel, const char* text);
-
- /**
- Updates all of the selections in the buffer for changes in the buffer's text
- */
- void update_selections(int pos, int nDeleted, int nInserted);
-
- Fl_Text_Selection mPrimary; /**< highlighted areas */
- Fl_Text_Selection mSecondary; /**< highlighted areas */
- Fl_Text_Selection mHighlight; /**< highlighted areas */
- int mLength; /**< length of the text in the buffer (the length
- of the buffer itself must be calculated:
- gapEnd - gapStart + length) */
- char* mBuf; /**< allocated memory where the text is stored */
- int mGapStart; /**< points to the first character of the gap */
- int mGapEnd; /**< points to the first char after the gap */
- // The hardware tab distance used by all displays for this buffer,
- // and used in computing offsets for rectangular selection operations.
- int mTabDist; /**< equiv. number of characters in a tab */
- int mNModifyProcs; /**< number of modify-redisplay procs attached */
- Fl_Text_Modify_Cb *mModifyProcs;/**< procedures to call when buffer is
- modified to redisplay contents */
- void** mCbArgs; /**< caller arguments for modifyProcs above */
- int mNPredeleteProcs; /**< number of pre-delete procs attached */
- Fl_Text_Predelete_Cb *mPredeleteProcs; /**< procedure to call before text is deleted
- from the buffer; at most one is supported. */
- void **mPredeleteCbArgs; /**< caller argument for pre-delete proc above */
- int mCursorPosHint; /**< hint for reasonable cursor position after
- a buffer modification operation */
- char mCanUndo; /**< if this buffer is used for attributes, it must
- not do any undo calls */
- int mPreferredGapSize; /**< the default allocation for the text gap is 1024
- bytes and should only be increased if frequent
- and large changes in buffer size are expected */
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Text_Buffer.H 8148 2010-12-31 22:38:03Z matt $".
-//
diff --git a/Libraries/FL/Fl_Text_Display.H b/Libraries/FL/Fl_Text_Display.H
deleted file mode 100644
index c9b91f1f..00000000
--- a/Libraries/FL/Fl_Text_Display.H
+++ /dev/null
@@ -1,480 +0,0 @@
-//
-// "$Id: Fl_Text_Display.H 8306 2011-01-24 17:04:22Z matt $"
-//
-// Header file for Fl_Text_Display class.
-//
-// Copyright 2001-2010 by Bill Spitzak and others.
-// Original code Copyright Mark Edel. Permission to distribute under
-// the LGPL for the FLTK library granted by Mark Edel.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Text_Display widget . */
-
-#ifndef FL_TEXT_DISPLAY_H
-#define FL_TEXT_DISPLAY_H
-
-#include "fl_draw.H"
-#include "Fl_Group.H"
-#include "Fl_Widget.H"
-#include "Fl_Scrollbar.H"
-#include "Fl_Text_Buffer.H"
-
-/**
- \brief Rich text display widget.
-
- This is the FLTK text display widget. It allows the user to view multiple lines
- of text and supports highlighting and scrolling. The buffer that is displayed
- in the widget is managed by the Fl_Text_Buffer class. A single Text Buffer
- can be displayed by multiple Text Displays.
- */
-class FL_EXPORT Fl_Text_Display: public Fl_Group {
-
-public:
-
- /**
- text display cursor shapes enumeration
- */
- enum {
- NORMAL_CURSOR, /**< I-beam */
- CARET_CURSOR, /**< caret under the text */
- DIM_CURSOR, /**< dim I-beam */
- BLOCK_CURSOR, /**< unfille box under the current character */
- HEAVY_CURSOR /**< thick I-beam */
- };
-
- /**
- the character position is the left edge of a character, whereas
- the cursor is thought to be between the centers of two consecutive
- characters.
- */
- enum {
- CURSOR_POS,
- CHARACTER_POS
- };
-
- /**
- drag types - they match Fl::event_clicks() so that single clicking to
- start a collection selects by character, double clicking selects by
- word and triple clicking selects by line.
- */
- enum {
- DRAG_NONE = -2,
- DRAG_START_DND = -1,
- DRAG_CHAR = 0,
- DRAG_WORD = 1,
- DRAG_LINE = 2
- };
-
- /**
- wrap types - used in wrap_mode()
- */
- enum {
- WRAP_NONE, /**< don't wrap text at all */
- WRAP_AT_COLUMN, /**< wrap text at the given text column */
- WRAP_AT_PIXEL, /**< wrap text at a pixel position */
- WRAP_AT_BOUNDS /**< wrap text so that it fits into the widget width */
- };
-
- friend void fl_text_drag_me(int pos, Fl_Text_Display* d);
-
- typedef void (*Unfinished_Style_Cb)(int, void *);
-
- /**
- This structure associates the color, font, andsize of a string to draw
- with an attribute mask matching attr
- */
- struct Style_Table_Entry {
- Fl_Color color;
- Fl_Font font;
- Fl_Fontsize size;
- unsigned attr;
- };
-
- Fl_Text_Display(int X, int Y, int W, int H, const char *l = 0);
- ~Fl_Text_Display();
-
- virtual int handle(int e);
-
- void buffer(Fl_Text_Buffer* buf);
-
- /**
- Sets the current text buffer associated with the text widget.
- Multiple text widgets can be associated with the same text buffer.
- \param buf new text buffer
- */
- void buffer(Fl_Text_Buffer& buf) { buffer(&buf); }
-
- /**
- Gets the current text buffer associated with the text widget.
- Multiple text widgets can be associated with the same text buffer.
- \return current text buffer
- */
- Fl_Text_Buffer* buffer() const { return mBuffer; }
-
- void redisplay_range(int start, int end);
- void scroll(int topLineNum, int horizOffset);
- void insert(const char* text);
- void overstrike(const char* text);
- void insert_position(int newPos);
-
- /**
- Gets the position of the text insertion cursor for text display.
- \return insert position index into text buffer
- */
- int insert_position() const { return mCursorPos; }
- int position_to_xy(int pos, int* x, int* y) const;
-
- int in_selection(int x, int y) const;
- void show_insert_position();
-
- int move_right();
- int move_left();
- int move_up();
- int move_down();
- int count_lines(int start, int end, bool start_pos_is_line_start) const;
- int line_start(int pos) const;
- int line_end(int startPos, bool startPosIsLineStart) const;
- int skip_lines(int startPos, int nLines, bool startPosIsLineStart);
- int rewind_lines(int startPos, int nLines);
- void next_word(void);
- void previous_word(void);
-
- void show_cursor(int b = 1);
-
- /**
- Hides the text cursor.
- */
- void hide_cursor() { show_cursor(0); }
-
- void cursor_style(int style);
-
- /**
- Gets the text cursor color.
- \return cursor color
- */
- Fl_Color cursor_color() const {return mCursor_color;}
-
- /**
- Sets the text cursor color.
- \param n new cursor color
- */
- void cursor_color(Fl_Color n) {mCursor_color = n;}
-
- /**
- Gets the width/height of the scrollbars.
- /return width of scrollbars
- */
- int scrollbar_width() const { return scrollbar_width_; }
-
- /**
- Sets the width/height of the scrollbars.
- \param W width of scrollbars
- */
- void scrollbar_width(int W) { scrollbar_width_ = W; }
-
- /**
- Gets the scrollbar alignment type.
- \return scrollbar alignment
- */
- Fl_Align scrollbar_align() const { return scrollbar_align_; }
-
- /**
- Sets the scrollbar alignment type.
- \param a new scrollbar alignment
- */
- void scrollbar_align(Fl_Align a) { scrollbar_align_ = a; }
-
- /**
- Moves the insert position to the beginning of the current word.
- \param pos start calculation at this index
- \return beginning of the words
- */
- int word_start(int pos) const { return buffer()->word_start(pos); }
-
- /**
- Moves the insert position to the end of the current word.
- \param pos start calculation at this index
- \return index of first character after the end of the word
- */
- int word_end(int pos) const { return buffer()->word_end(pos); }
-
-
- void highlight_data(Fl_Text_Buffer *styleBuffer,
- const Style_Table_Entry *styleTable,
- int nStyles, char unfinishedStyle,
- Unfinished_Style_Cb unfinishedHighlightCB,
- void *cbArg);
-
- int position_style(int lineStartPos, int lineLen, int lineIndex) const;
-
- /**
- \todo FIXME : get set methods pointing on shortcut_
- have no effects as shortcut_ is unused in this class and derived!
- \return the current shortcut key
- */
- int shortcut() const {return shortcut_;}
-
- /**
- \todo FIXME : get set methods pointing on shortcut_
- have no effects as shortcut_ is unused in this class and derived!
- \param s the new shortcut key
- */
- void shortcut(int s) {shortcut_ = s;}
-
- /**
- Gets the default font used when drawing text in the widget.
- \return current text font face unless overridden by a style
- */
- Fl_Font textfont() const {return textfont_;}
-
- /**
- Sets the default font used when drawing text in the widget.
- \param s default text font face
- */
- void textfont(Fl_Font s) {textfont_ = s; mColumnScale = 0;}
-
- /**
- Gets the default size of text in the widget.
- \return current text height unless overridden by a style
- */
- Fl_Fontsize textsize() const {return textsize_;}
-
- /**
- Sets the default size of text in the widget.
- \param s new text size
- */
- void textsize(Fl_Fontsize s) {textsize_ = s; mColumnScale = 0;}
-
- /**
- Gets the default color of text in the widget.
- \return text color unless overridden by a style
- */
- Fl_Color textcolor() const {return textcolor_;}
-
- /**
- Sets the default color of text in the widget.
- \param n new text color
- */
- void textcolor(Fl_Color n) {textcolor_ = n;}
-
- int wrapped_column(int row, int column) const;
- int wrapped_row(int row) const;
- void wrap_mode(int wrap, int wrap_margin);
-
- virtual void resize(int X, int Y, int W, int H);
-
- /**
- Convert an x pixel position into a column number.
- \param x number of pixels from the left margin
- \return an approximate column number based on the main font
- */
- double x_to_col(double x) const;
-
- /**
- Convert a column number into an x pixel position.
- \param col an approximate column number based on the main font
- \return number of pixels from the left margin to the left of an
- average sized character
- */
- double col_to_x(double col) const;
-
-protected:
- // Most (all?) of this stuff should only be called from resize() or
- // draw().
- // Anything with "vline" indicates thats it deals with currently
- // visible lines.
-
- virtual void draw();
- void draw_text(int X, int Y, int W, int H);
- void draw_range(int start, int end);
- void draw_cursor(int, int);
-
- void draw_string(int style, int x, int y, int toX, const char *string,
- int nChars) const;
-
- void draw_vline(int visLineNum, int leftClip, int rightClip,
- int leftCharIndex, int rightCharIndex);
-
- int find_x(const char *s, int len, int style, int x) const;
-
- enum {
- DRAW_LINE,
- FIND_INDEX,
- FIND_INDEX_FROM_ZERO,
- GET_WIDTH
- };
-
- int handle_vline(int mode,
- int lineStart, int lineLen, int leftChar, int rightChar,
- int topClip, int bottomClip,
- int leftClip, int rightClip) const;
-
- void draw_line_numbers(bool clearAll);
-
- void clear_rect(int style, int x, int y, int width, int height) const;
- void display_insert();
-
- void offset_line_starts(int newTopLineNum);
-
- void calc_line_starts(int startLine, int endLine);
-
- void update_line_starts(int pos, int charsInserted, int charsDeleted,
- int linesInserted, int linesDeleted, int *scrolled);
-
- void calc_last_char();
-
- int position_to_line( int pos, int* lineNum ) const;
- double string_width(const char* string, int length, int style) const;
-
- static void scroll_timer_cb(void*);
-
- static void buffer_predelete_cb(int pos, int nDeleted, void* cbArg);
- static void buffer_modified_cb(int pos, int nInserted, int nDeleted,
- int nRestyled, const char* deletedText,
- void* cbArg);
-
- static void h_scrollbar_cb(Fl_Scrollbar* w, Fl_Text_Display* d);
- static void v_scrollbar_cb( Fl_Scrollbar* w, Fl_Text_Display* d);
- void update_v_scrollbar();
- void update_h_scrollbar();
- int measure_vline(int visLineNum) const;
- int longest_vline() const;
- int empty_vlines() const;
- int vline_length(int visLineNum) const;
- int xy_to_position(int x, int y, int PosType = CHARACTER_POS) const;
-
- void xy_to_rowcol(int x, int y, int* row, int* column,
- int PosType = CHARACTER_POS) const;
- void maintain_absolute_top_line_number(int state);
- int get_absolute_top_line_number() const;
- void absolute_top_line_number(int oldFirstChar);
- int maintaining_absolute_top_line_number() const;
- void reset_absolute_top_line_number();
- int position_to_linecol(int pos, int* lineNum, int* column) const;
- int scroll_(int topLineNum, int horizOffset);
-
- void extend_range_for_styles(int* start, int* end);
-
- void find_wrap_range(const char *deletedText, int pos, int nInserted,
- int nDeleted, int *modRangeStart, int *modRangeEnd,
- int *linesInserted, int *linesDeleted);
- void measure_deleted_lines(int pos, int nDeleted);
- void wrapped_line_counter(Fl_Text_Buffer *buf, int startPos, int maxPos,
- int maxLines, bool startPosIsLineStart,
- int styleBufOffset, int *retPos, int *retLines,
- int *retLineStart, int *retLineEnd,
- bool countLastLineMissingNewLine = true) const;
- void find_line_end(int pos, bool start_pos_is_line_start, int *lineEnd,
- int *nextLineStart) const;
- double measure_proportional_character(const char *s, int colNum, int pos) const;
- int wrap_uses_character(int lineEndPos) const;
-
- int damage_range1_start, damage_range1_end;
- int damage_range2_start, damage_range2_end;
- int mCursorPos;
- int mCursorOn;
- int mCursorOldY; /* Y pos. of cursor for blanking */
- int mCursorToHint; /* Tells the buffer modified callback
- where to move the cursor, to reduce
- the number of redraw calls */
- int mCursorStyle; /* One of enum cursorStyles above */
- int mCursorPreferredXPos; /* Pixel position for vert. cursor movement */
- int mNVisibleLines; /* # of visible (displayed) lines */
- int mNBufferLines; /* # of newlines in the buffer */
- Fl_Text_Buffer* mBuffer; /* Contains text to be displayed */
- Fl_Text_Buffer* mStyleBuffer; /* Optional parallel buffer containing
- color and font information */
- int mFirstChar, mLastChar; /* Buffer positions of first and last
- displayed character (lastChar points
- either to a newline or one character
- beyond the end of the buffer) */
- int mContinuousWrap; /* Wrap long lines when displaying */
- int mWrapMarginPix; /* Margin in # of pixels for
- wrapping in continuousWrap mode */
- int* mLineStarts;
- int mTopLineNum; /* Line number of top displayed line
- of file (first line of file is 1) */
- int mAbsTopLineNum; /* In continuous wrap mode, the line
- number of the top line if the text
- were not wrapped (note that this is
- only maintained as needed). */
- int mNeedAbsTopLineNum; /* Externally settable flag to continue
- maintaining absTopLineNum even if
- it isn't needed for line # display */
- int mHorizOffset; /* Horizontal scroll pos. in pixels */
- int mTopLineNumHint; /* Line number of top displayed line
- of file (first line of file is 1) */
- int mHorizOffsetHint; /* Horizontal scroll pos. in pixels */
- int mNStyles; /* Number of entries in styleTable */
- const Style_Table_Entry *mStyleTable; /* Table of fonts and colors for
- coloring/syntax-highlighting */
- char mUnfinishedStyle; /* Style buffer entry which triggers
- on-the-fly reparsing of region */
- Unfinished_Style_Cb mUnfinishedHighlightCB; /* Callback to parse "unfinished" */
- /* regions */
- void* mHighlightCBArg; /* Arg to unfinishedHighlightCB */
-
- int mMaxsize;
-
- int mSuppressResync; /* Suppress resynchronization of line
- starts during buffer updates */
- int mNLinesDeleted; /* Number of lines deleted during
- buffer modification (only used
- when resynchronization is suppressed) */
- int mModifyingTabDistance; /* Whether tab distance is being
- modified */
-
- mutable double mColumnScale; /* Width in pixels of an average character. This
- value is calculated as needed (lazy eval); it
- needs to be mutable so that it can be calculated
- within a method marked as "const" */
-
- Fl_Color mCursor_color;
-
- Fl_Scrollbar* mHScrollBar;
- Fl_Scrollbar* mVScrollBar;
- int scrollbar_width_;
- Fl_Align scrollbar_align_;
- int dragPos, dragType, dragging;
- int display_insert_position_hint;
- struct { int x, y, w, h; } text_area;
-
- int shortcut_;
-
- Fl_Font textfont_;
- Fl_Fontsize textsize_;
- Fl_Color textcolor_;
-
- // The following are not presently used from the original NEdit code,
- // but are being put here so that future versions of Fl_Text_Display
- // can implement line numbers without breaking binary compatibility.
-
- /* Line number margin and width */
- int mLineNumLeft, mLineNumWidth;
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Text_Display.H 8306 2011-01-24 17:04:22Z matt $".
-//
diff --git a/Libraries/FL/Fl_Text_Editor.H b/Libraries/FL/Fl_Text_Editor.H
deleted file mode 100644
index 40f9e6be..00000000
--- a/Libraries/FL/Fl_Text_Editor.H
+++ /dev/null
@@ -1,141 +0,0 @@
-//
-// "$Id: Fl_Text_Editor.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Header file for Fl_Text_Editor class.
-//
-// Copyright 2001-2010 by Bill Spitzak and others.
-// Original code Copyright Mark Edel. Permission to distribute under
-// the LGPL for the FLTK library granted by Mark Edel.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Text_Editor widget . */
-
-
-#ifndef FL_TEXT_EDITOR_H
-#define FL_TEXT_EDITOR_H
-
-#include "Fl_Text_Display.H"
-
-// key will match in any state
-#define FL_TEXT_EDITOR_ANY_STATE (-1L)
-
-/**
- This is the FLTK text editor widget. It allows the user to
- edit multiple lines of text and supports highlighting and
- scrolling. The buffer that is displayed in the widget is managed
- by the Fl_Text_Buffer
- class.
-*/
-class FL_EXPORT Fl_Text_Editor : public Fl_Text_Display {
- public:
- /** Key function binding callback type */
- typedef int (*Key_Func)(int key, Fl_Text_Editor* editor);
-
- /** Simple linked list associating a key/state to a function */
- struct Key_Binding {
- int key; ///< the key pressed
- int state; ///< the state of key modifiers
- Key_Func function; ///< associated function
- Key_Binding* next; ///< next key binding in the list
- };
-
- Fl_Text_Editor(int X, int Y, int W, int H, const char* l = 0);
- ~Fl_Text_Editor() { remove_all_key_bindings(); }
- virtual int handle(int e);
- /**
- Sets the current insert mode; if non-zero, new text
- is inserted before the current cursor position. Otherwise, new
- text replaces text at the current cursor position.
- */
- void insert_mode(int b) { insert_mode_ = b; }
- /**
- Gets the current insert mode; if non-zero, new text
- is inserted before the current cursor position. Otherwise, new
- text replaces text at the current cursor position.
- */
- int insert_mode() { return insert_mode_; }
-
- void add_key_binding(int key, int state, Key_Func f, Key_Binding** list);
- /** Adds a key of state "state" with the function "function" */
- void add_key_binding(int key, int state, Key_Func f)
- { add_key_binding(key, state, f, &key_bindings); }
- void remove_key_binding(int key, int state, Key_Binding** list);
- /** Removes the key binding associated with the key "key" of state "state". */
- void remove_key_binding(int key, int state)
- { remove_key_binding(key, state, &key_bindings); }
- void remove_all_key_bindings(Key_Binding** list);
- /** Removes all of the key bindings associated with the text editor or list. */
- void remove_all_key_bindings() { remove_all_key_bindings(&key_bindings); }
- void add_default_key_bindings(Key_Binding** list);
- Key_Func bound_key_function(int key, int state, Key_Binding* list);
- /** Returns the function associated with a key binding. */
- Key_Func bound_key_function(int key, int state)
- { return bound_key_function(key, state, key_bindings); }
- /** Sets the default key function for unassigned keys. */
- void default_key_function(Key_Func f) { default_key_function_ = f; }
-
- // functions for the built in default bindings
- static int kf_default(int c, Fl_Text_Editor* e);
- static int kf_ignore(int c, Fl_Text_Editor* e);
- static int kf_backspace(int c, Fl_Text_Editor* e);
- static int kf_enter(int c, Fl_Text_Editor* e);
- static int kf_move(int c, Fl_Text_Editor* e);
- static int kf_shift_move(int c, Fl_Text_Editor* e);
- static int kf_ctrl_move(int c, Fl_Text_Editor* e);
- static int kf_c_s_move(int c, Fl_Text_Editor* e);
- static int kf_meta_move(int c, Fl_Text_Editor* e);
- static int kf_m_s_move(int c, Fl_Text_Editor* e);
- static int kf_home(int, Fl_Text_Editor* e);
- static int kf_end(int c, Fl_Text_Editor* e);
- static int kf_left(int c, Fl_Text_Editor* e);
- static int kf_up(int c, Fl_Text_Editor* e);
- static int kf_right(int c, Fl_Text_Editor* e);
- static int kf_down(int c, Fl_Text_Editor* e);
- static int kf_page_up(int c, Fl_Text_Editor* e);
- static int kf_page_down(int c, Fl_Text_Editor* e);
- static int kf_insert(int c, Fl_Text_Editor* e);
- static int kf_delete(int c, Fl_Text_Editor* e);
- static int kf_copy(int c, Fl_Text_Editor* e);
- static int kf_cut(int c, Fl_Text_Editor* e);
- static int kf_paste(int c, Fl_Text_Editor* e);
- static int kf_select_all(int c, Fl_Text_Editor* e);
- static int kf_undo(int c, Fl_Text_Editor* e);
-
- protected:
- int handle_key();
- void maybe_do_callback();
-
-#ifndef FL_DOXYGEN
- int insert_mode_;
- Key_Binding* key_bindings;
- static Key_Binding* global_key_bindings;
- Key_Func default_key_function_;
-#endif
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Text_Editor.H 7903 2010-11-28 21:06:39Z matt $".
-//
-
diff --git a/Libraries/FL/Fl_Tile.H b/Libraries/FL/Fl_Tile.H
deleted file mode 100644
index c83d2ec1..00000000
--- a/Libraries/FL/Fl_Tile.H
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// "$Id: Fl_Tile.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Tile header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Tile widget . */
-
-#ifndef Fl_Tile_H
-#define Fl_Tile_H
-
-#include "Fl_Group.H"
-
-/**
- The Fl_Tile class lets you resize the children by dragging
- the border between them:
-
- <P ALIGN=CENTER>\image html Fl_Tile.png </P>
- \image latex Fl_Tile.png "Fl_Tile" width=4cm
-
- <P>For the tiling to work correctly, the children of an
- Fl_Tile must cover the entire area of the widget, but not
- overlap. This means that all children must touch each
- other at their edges, and no gaps can't be left inside the
- Fl_Tile.
-
- <P>Fl_Tile does not normailly draw any graphics of its own.
- The "borders" which can be seen in the snapshot above
- are actually part of the children. Their boxtypes have been set
- to FL_DOWN_BOX creating the impression of
- "ridges" where the boxes touch. What you see are
- actually two adjacent FL_DOWN_BOX's drawn next to each
- other. All neighboring widgets share the same edge - the widget's
- thick borders make it appear as though the widgets aren't actually
- touching, but they are. If the edges of adjacent widgets do not
- touch, then it will be impossible to drag the corresponding
- edges.</P>
-
- <P>Fl_Tile allows objects to be resized to zero dimensions.
- To prevent this you can use the resizable() to limit where
- corners can be dragged to.</P>
-
- <P>Even though objects can be resized to zero sizes, they must
- initially have non-zero sizes so the Fl_Tile can figure out
- their layout. If desired, call position() after creating the
- children but before displaying the window to set the borders where you
- want.
-
- <P>Note on resizable(Fl_Widget &w) :
- The "resizable" child widget (which should be invisible) limits where the
- border can be dragged to. If you don't set it, it will be possible to
- drag the borders right to the edge, and thus resize objects on the edge
- to zero width or height. The resizable() widget is not
- resized by dragging any borders. See also void Fl_Group::resizable(Fl_Widget &w)
-
-*/
-class FL_EXPORT Fl_Tile : public Fl_Group {
-public:
- int handle(int);
- /**
- Creates a new Fl_Tile widget using the given position, size,
- and label string. The default boxtype is FL_NO_BOX.
-
- <P>The destructor <I>also deletes all the children</I>. This allows a
- whole tree to be deleted at once, without having to keep a pointer to
- all the children in the user code. A kludge has been done so the
- Fl_Tile and all of it's children can be automatic (local)
- variables, but you must declare the Fl_Tile <I>first</I>, so
- that it is destroyed last.
- */
- Fl_Tile(int X,int Y,int W,int H,const char*l=0) : Fl_Group(X,Y,W,H,l) {}
- void resize(int, int, int, int);
- void position(int, int, int, int);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Tile.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Tiled_Image.H b/Libraries/FL/Fl_Tiled_Image.H
deleted file mode 100644
index d1693798..00000000
--- a/Libraries/FL/Fl_Tiled_Image.H
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// "$Id: Fl_Tiled_Image.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Tiled image header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Tiled_Image widget . */
-
-#ifndef Fl_Tiled_Image_H
-# define Fl_Tiled_Image_H
-
-# include "Fl_Image.H"
-
-
-/**
- This class supports tiling of images
- over a specified area. The source (tile) image is <B>not</B>
- copied unless you call the color_average(),
- desaturate(),
- or inactive()
- methods.
-*/
-class FL_EXPORT Fl_Tiled_Image : public Fl_Image {
- protected:
-
- Fl_Image *image_; // The image that is shared
- int alloc_image_; // Did we allocate this image?
-
- public:
-
- Fl_Tiled_Image(Fl_Image *i, int W = 0, int H = 0);
- virtual ~Fl_Tiled_Image();
-
- virtual Fl_Image *copy(int W, int H);
- Fl_Image *copy() { return copy(w(), h()); }
- virtual void color_average(Fl_Color c, float i);
- virtual void desaturate();
- virtual void draw(int X, int Y, int W, int H, int cx, int cy);
- void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); }
- /** Gets The image that is shared */
- Fl_Image *image() { return image_; }
-};
-
-#endif // !Fl_Tiled_Image_H
-
-//
-// End of "$Id: Fl_Tiled_Image.H 7903 2010-11-28 21:06:39Z matt $"
-//
diff --git a/Libraries/FL/Fl_Timer.H b/Libraries/FL/Fl_Timer.H
deleted file mode 100644
index 952273ff..00000000
--- a/Libraries/FL/Fl_Timer.H
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// "$Id: Fl_Timer.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Timer header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Timer widget . */
-
-#ifndef Fl_Timer_H
-#define Fl_Timer_H
-
-#ifndef Fl_Widget_H
-#include "Fl_Widget.H"
-#endif
-
-// values for type():
-#define FL_NORMAL_TIMER 0
-#define FL_VALUE_TIMER 1
-#define FL_HIDDEN_TIMER 2
-
-/**
- This is provided only to emulate the Forms Timer widget. It works by
- making a timeout callback every 1/5 second. This is wasteful and
- inaccurate if you just want something to happen a fixed time in the
- future. You should directly call
- Fl::add_timeout() instead.
-*/
-class FL_EXPORT Fl_Timer : public Fl_Widget {
- static void stepcb(void *);
- void step();
- char on, direction_;
- double delay, total;
- long lastsec,lastusec;
-protected:
- void draw();
-public:
- int handle(int);
- Fl_Timer(uchar t,int x,int y,int w,int h, const char *l);
- ~Fl_Timer();
- void value(double);
- /** See void Fl_Timer::value(double) */
- double value() const {return delay>0.0?delay:0.0;}
- /**
- Gets or sets the direction of the timer. If the direction is zero
- then the timer will count up, otherwise it will count down from the
- initial value().
- */
- char direction() const {return direction_;}
- /**
- Gets or sets the direction of the timer. If the direction is zero
- then the timer will count up, otherwise it will count down from the
- initial value().
- */
- void direction(char d) {direction_ = d;}
- /** Gets or sets whether the timer is suspended. */
- char suspended() const {return !on;}
- void suspended(char d);
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Timer.H 7903 2010-11-28 21:06:39Z matt $".
-//
-
diff --git a/Libraries/FL/Fl_Toggle_Button.H b/Libraries/FL/Fl_Toggle_Button.H
deleted file mode 100644
index eaf821b4..00000000
--- a/Libraries/FL/Fl_Toggle_Button.H
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// "$Id: Fl_Toggle_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
-//
-// Toggle button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Toggle_Button widget . */
-
-#ifndef Fl_Toggle_Button_H
-#define Fl_Toggle_Button_H
-
-#include "Fl_Button.H"
-
-/**
- The toggle button is a push button that needs to be clicked once
- to toggle on, and one more time to toggle off.
- The Fl_Toggle_Button subclass displays the "on" state by
- drawing a pushed-in button.</P>
- <P>Buttons generate callbacks when they are clicked by the user. You
- control exactly when and how by changing the values for type()
- and when().
-*/
-class FL_EXPORT Fl_Toggle_Button : public Fl_Button {
-public:
- /**
- Creates a new Fl_Toggle_Button widget using the given
- position, size, and label string.
- <P>The inherited destructor deletes the toggle button.
- */
- Fl_Toggle_Button(int X,int Y,int W,int H,const char *l=0)
- : Fl_Button(X,Y,W,H,l) {type(FL_TOGGLE_BUTTON);}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Toggle_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Toggle_Light_Button.H b/Libraries/FL/Fl_Toggle_Light_Button.H
deleted file mode 100644
index 8d446d8e..00000000
--- a/Libraries/FL/Fl_Toggle_Light_Button.H
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// "$Id: Fl_Toggle_Light_Button.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Toggle light button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-// provided for back-compatibility only
-
-#ifndef Fl_Toggle_Light_Button
-#include "Fl_Light_Button.H"
-#define Fl_Toggle_Light_Button Fl_Light_Button
-#endif
-
-//
-// End of "$Id: Fl_Toggle_Light_Button.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Toggle_Round_Button.H b/Libraries/FL/Fl_Toggle_Round_Button.H
deleted file mode 100644
index 3fd892bc..00000000
--- a/Libraries/FL/Fl_Toggle_Round_Button.H
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// "$Id: Fl_Toggle_Round_Button.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Toggle round button header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-// provided for back-compatibility only
-
-#ifndef Fl_Toggle_Round_Button
-#include "Fl_Round_Button.H"
-#define Fl_Toggle_Round_Button Fl_Round_Button
-#endif
-
-//
-// End of "$Id: Fl_Toggle_Round_Button.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Tooltip.H b/Libraries/FL/Fl_Tooltip.H
deleted file mode 100644
index 71153791..00000000
--- a/Libraries/FL/Fl_Tooltip.H
+++ /dev/null
@@ -1,114 +0,0 @@
-//
-// "$Id: Fl_Tooltip.H 8405 2011-02-08 20:59:46Z manolo $"
-//
-// Tooltip header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Tooltip widget . */
-
-#ifndef Fl_Tooltip_H
-#define Fl_Tooltip_H
-
-#include <FL/Fl.H>
-#include <FL/Fl_Widget.H>
-
-/**
- The Fl_Tooltip class provides tooltip support for
- all FLTK widgets. It contains only static methods.
-*/
-class FL_EXPORT Fl_Tooltip {
-public:
- /** Gets the tooltip delay. The default delay is 1.0 seconds. */
- static float delay() { return delay_; }
- /** Sets the tooltip delay. The default delay is 1.0 seconds. */
- static void delay(float f) { delay_ = f; }
- /**
- Gets the tooltip hover delay, the delay between tooltips.
- The default delay is 0.2 seconds.
- */
- static float hoverdelay() { return hoverdelay_; }
- /**
- Sets the tooltip hover delay, the delay between tooltips.
- The default delay is 0.2 seconds.
- */
- static void hoverdelay(float f) { hoverdelay_ = f; }
- /** Returns non-zero if tooltips are enabled. */
- static int enabled() { return Fl::option(Fl::OPTION_SHOW_TOOLTIPS); }
- /** Enables tooltips on all widgets (or disables if <i>b</i> is false). */
- static void enable(int b = 1) { Fl::option(Fl::OPTION_SHOW_TOOLTIPS, (b!=0));}
- /** Same as enable(0), disables tooltips on all widgets. */
- static void disable() { enable(0); }
- static void (*enter)(Fl_Widget* w);
- static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
- static void (*exit)(Fl_Widget *w);
- /** Gets the current widget target */
- static Fl_Widget* current() {return widget_;}
- static void current(Fl_Widget*);
-
- /** Gets the typeface for the tooltip text. */
- static Fl_Font font() { return font_; }
- /** Sets the typeface for the tooltip text. */
- static void font(Fl_Font i) { font_ = i; }
- /** Gets the size of the tooltip text. */
- static Fl_Fontsize size() { return (size_ == -1 ? FL_NORMAL_SIZE : size_); }
- /** Sets the size of the tooltip text. */
- static void size(Fl_Fontsize s) { size_ = s; }
- /** Gets the background color for tooltips. The default background color is a pale yellow. */
- static Fl_Color color() { return color_; }
- /** Sets the background color for tooltips. The default background color is a pale yellow. */
- static void color(Fl_Color c) { color_ = c; }
- /** Gets the color of the text in the tooltip. The default is black. */
- static Fl_Color textcolor() { return textcolor_; }
- /** Sets the color of the text in the tooltip. The default is black. */
- static void textcolor(Fl_Color c) { textcolor_ = c; }
-#ifdef __APPLE__
- // the unique tooltip window
- static Fl_Window* current_window(void);
-#endif
-
- // These should not be public, but Fl_Widget::tooltip() needs them...
- // fabien: made it private with only a friend function access
-private:
- friend void Fl_Widget::tooltip(const char *);
- friend void Fl_Widget::copy_tooltip(const char *);
- static void enter_(Fl_Widget* w);
- static void exit_(Fl_Widget *w);
- static void set_enter_exit_once_();
-
-private:
- static float delay_; //!< delay before a tooltip is shown
- static float hoverdelay_; //!< delay between tooltips
- static Fl_Color color_;
- static Fl_Color textcolor_;
- static Fl_Font font_;
- static Fl_Fontsize size_;
- static Fl_Widget* widget_; //!< Keeps track of the current target widget
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Tooltip.H 8405 2011-02-08 20:59:46Z manolo $".
-//
diff --git a/Libraries/FL/Fl_Tree.H b/Libraries/FL/Fl_Tree.H
deleted file mode 100644
index cce11e72..00000000
--- a/Libraries/FL/Fl_Tree.H
+++ /dev/null
@@ -1,1016 +0,0 @@
-//
-// "$Id: Fl_Tree.H 8632 2011-05-04 02:59:50Z greg.ercolano $"
-//
-
-#ifndef FL_TREE_H
-#define FL_TREE_H
-
-#include <FL/Fl.H>
-#include <FL/Fl_Group.H>
-#include <FL/Fl_Scrollbar.H>
-#include <FL/fl_draw.H>
-
-#include <FL/Fl_Tree_Item.H>
-#include <FL/Fl_Tree_Prefs.H>
-
-//////////////////////
-// FL/Fl_Tree.H
-//////////////////////
-//
-// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
-// Copyright (C) 2009-2010 by Greg Ercolano.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-
-///
-/// \file
-/// \brief This file contains the definitions of the Fl_Tree class
-///
-
-/// \class Fl_Tree
-///
-/// \brief Tree widget.
-///
-/// \image html tree-simple.png "Fl_Tree example program"
-/// \image latex tree-simple.png "Fl_Tree example program" width=4cm
-///
-/// \code
-/// Fl_Tree // Top level widget
-/// |--- Fl_Tree_Item // Items in the tree
-/// |--- Fl_Tree_Prefs // Preferences for the tree
-/// |--- Fl_Tree_Connector (enum) // Connection modes
-/// |--- Fl_Tree_Select (enum) // Selection modes
-/// |--- Fl_Tree_Sort (enum) // Sort behavior
-/// \endcode
-///
-/// Similar to Fl_Browser, Fl_Tree is a browser of Fl_Tree_Item's, which is arranged
-/// in a parented hierarchy, or 'tree'. Subtrees can be expanded or closed. Items can be
-/// added, deleted, inserted, sorted and re-ordered.
-///
-/// The tree items may also contain other FLTK widgets, like buttons, input fields,
-/// or even "custom" widgets.
-///
-/// The callback() is invoked depending on the value of when():
-///
-/// - FL_WHEN_RELEASE -- callback invoked when left mouse button is released on an item
-/// - FL_WHEN_CHANGED -- callback invoked when left mouse changes selection state
-///
-/// The simple way to define a tree:
-/// \code
-/// #include <FL/Fl_Tree.H>
-/// [..]
-/// Fl_Tree tree(X,Y,W,H);
-/// tree.begin();
-/// tree.add("Flintstones/Fred");
-/// tree.add("Flintstones/Wilma");
-/// tree.add("Flintstones/Pebbles");
-/// tree.add("Simpsons/Homer");
-/// tree.add("Simpsons/Marge");
-/// tree.add("Simpsons/Bart");
-/// tree.add("Simpsons/Lisa");
-/// tree.end();
-/// \endcode
-///
-/// Items can be added with add(),
-/// removed with remove(),
-/// completely cleared with clear(),
-/// inserted with insert() and insert_above(),
-/// selected/deselected with select() and deselect(),
-/// open/closed with open() and closed().
-/// Children of an item can be swapped around with Fl_Tree_Item::swap_children(),
-/// sorting can be controlled when items are add()ed via sortorder().
-/// You can walk the entire tree with first() and next().
-/// You can walk selected items with first_selected_item() and
-/// next_selected_item().
-/// Items can be found by their pathname using find_item(const char*),
-/// and an item's pathname can be found with item_pathname().
-/// The selected items' colors are controlled by selection_color() (inherited from Fl_Widget).
-///
-/// The tree can have different selection behaviors controlled by selectmode().
-///
-/// FLTK widgets (including custom widgets) can be assigned to tree items via
-/// Fl_Tree_Item::widget().
-///
-/// Icons for individual items can be changed with
-/// Fl_Tree_Item::openicon(),
-/// Fl_Tree_Item::closeicon(),
-/// Fl_Tree_Item::usericon().
-///
-/// Various default preferences can be globally manipulated via Fl_Tree_Prefs,
-/// including colors, margins, icons, connection lines.
-///
-/// The tree's callback() will be invoked when items change state or are open/closed.
-/// when() controls when mouse/keyboard events invoke the callback.
-/// callback_item() and callback_reason() can be used to determine the cause of the callback. eg:
-///
-/// \code
-/// void MyTreeCallback(Fl_Widget *w, void *data) {
-/// Fl_Tree *tree = (Fl_Tree*)w;
-/// Fl_Tree_Item *item = (Fl_Tree_Item*)tree->callback_item(); // get selected item
-/// switch ( tree->callback_reason() ) {
-/// case FL_TREE_REASON_SELECTED: [..]
-/// case FL_TREE_REASON_DESELECTED: [..]
-/// case FL_TREE_REASON_OPENED: [..]
-/// case FL_TREE_REASON_CLOSED: [..]
-/// }
-/// \endcode
-///
-/// To get the item's full menu pathname, you can use Fl_Tree_Item::item_pathname(), eg:
-///
-/// \code
-/// char pathname[256] = "???";
-/// tree->item_pathname(pathname, sizeof(pathname), item); // eg. "Parent/Child/Item"
-/// \endcode
-///
-/// To walk all the items of the tree from top to bottom:
-/// \code
-/// // Walk all the items in the tree, and print their labels
-/// for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) {
-/// printf("Item: %s\n", item->label());
-/// }
-/// \endcode
-///
-/// To recursively walk all the children of a particular item,
-/// define a function that uses recursion:
-/// \code
-/// // Find all of the item's children and print an indented report of their labels
-/// void my_print_all_children(Fl_Tree_Item *item, int indent=0) {
-/// for ( int t=0; t<item->children(); t++ ) {
-/// printf("%*s Item: %s\n", indent, "", item->child(t)->label());
-/// my_print_all_children(item->child(t), indent+4); // recurse
-/// }
-/// }
-/// \endcode
-///
-/// To change the default label font and color for creating new items:
-/// \code
-/// tree = new Fl_Tree(..);
-/// tree->item_labelfont(FL_COURIER); // Use Courier font for all new items
-/// tree->item_labelfgcolor(FL_RED); // Use red color for labels of all new items
-/// [..]
-/// // Now create the items in the tree using the above defaults.
-/// tree->add("Aaa");
-/// tree->add("Bbb");
-/// [..]
-/// \endcode
-///
-/// To change the font and color of all items in the tree:
-/// \code
-/// // Change the font and color of all items currently in the tree
-/// for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) {
-/// item->labelfont(FL_COURIER);
-/// item->labelcolor(FL_RED);
-/// }
-/// \endcode
-///
-/// The following image shows the tree's various visual elements
-/// and the methods that control them:
-///
-/// \image html tree-elements.png
-/// \image latex tree-elements.png "Fl_Tree dimensions" width=6cm
-///
-
-/// \enum Fl_Tree_Reason
-/// The reason the callback was invoked.
-///
-enum Fl_Tree_Reason {
- FL_TREE_REASON_NONE=0, ///< unknown reason
- FL_TREE_REASON_SELECTED, ///< an item was selected
- FL_TREE_REASON_DESELECTED, ///< an item was de-selected
- FL_TREE_REASON_OPENED, ///< an item was opened
- FL_TREE_REASON_CLOSED ///< an item was closed
-};
-
-
-class FL_EXPORT Fl_Tree : public Fl_Group {
- Fl_Tree_Item *_root; // can be null!
- Fl_Tree_Item *_item_focus; // item that has focus box
- Fl_Tree_Item *_callback_item; // item invoked during callback (can be NULL)
- Fl_Tree_Reason _callback_reason; // reason for the callback
- Fl_Tree_Prefs _prefs; // all the tree's settings
- int _scrollbar_size; // size of scrollbar trough
-
-protected:
- /// Vertical scrollbar
- Fl_Scrollbar *_vscroll;
-
-protected:
- void item_clicked(Fl_Tree_Item* val);
- /// Do the callback for the item, setting the item and reason
- void do_callback_for_item(Fl_Tree_Item* item, Fl_Tree_Reason reason) {
- callback_reason(reason);
- callback_item(item);
- do_callback((Fl_Widget*)this, user_data());
- }
- Fl_Tree_Item *next_visible_item(Fl_Tree_Item *start, int dir);
-
-public:
- Fl_Tree(int X, int Y, int W, int H, const char *L=0);
- ~Fl_Tree();
- int handle(int e);
- void draw();
-
- ///////////////////////
- // root methods
- ///////////////////////
-
- /// Set the label for the root item.
- ///
- /// Makes an internally managed copy of 'new_label'.
- ///
- void root_label(const char *new_label) {
- if ( ! _root ) return;
- _root->label(new_label);
- }
- /// Returns the root item.
- Fl_Tree_Item* root() {
- return(_root);
- }
-
- ////////////////////////////////
- // Item creation/removal methods
- ////////////////////////////////
- Fl_Tree_Item *add(const char *path);
- Fl_Tree_Item* add(Fl_Tree_Item *item, const char *name);
- Fl_Tree_Item *insert_above(Fl_Tree_Item *above, const char *name);
- Fl_Tree_Item* insert(Fl_Tree_Item *item, const char *name, int pos);
-
- /// Remove the specified \p item from the tree.
- /// \p item may not be NULL.
- /// If it has children, all those are removed too.
- /// \returns 0 if done, -1 if 'item' not found.
- ///
- int remove(Fl_Tree_Item *item) {
- if ( item == _root ) {
- clear();
- } else {
- Fl_Tree_Item *parent = item->parent(); // find item's parent
- if ( ! parent ) return(-1);
- parent->remove_child(item); // remove child + children
- }
- return(0);
- }
- /// Clear all children from the tree.
- /// The tree will be left completely empty.
- ///
- void clear() {
- if ( ! _root ) return;
- _root->clear_children();
- delete _root; _root = 0;
- }
- /// Clear all the children of a particular node in the tree specified by \p item.
- /// Item may not be NULL.
- ///
- void clear_children(Fl_Tree_Item *item) {
- if ( item->has_children() ) {
- item->clear_children();
- redraw(); // redraw only if there were children to clear
- }
- }
-
- ////////////////////////
- // Item lookup methods
- ////////////////////////
- Fl_Tree_Item *find_item(const char *path);
- const Fl_Tree_Item *find_item(const char *path) const;
- int item_pathname(char *pathname, int pathnamelen, const Fl_Tree_Item *item) const;
-
- const Fl_Tree_Item *find_clicked() const;
-
- /// Return the item that was last clicked.
- ///
- /// Valid only from within the callback().
- ///
- /// Deprecated: use callback_item() instead.
- ///
- /// \returns the item clicked, or 0 if none.
- /// 0 may also be used to indicate several items were clicked/changed.
- ///
- Fl_Tree_Item *item_clicked() {
- return(_callback_item);
- }
- Fl_Tree_Item *first();
- Fl_Tree_Item *next(Fl_Tree_Item *item=0);
- Fl_Tree_Item *prev(Fl_Tree_Item *item=0);
- Fl_Tree_Item *last();
- Fl_Tree_Item *first_selected_item();
- Fl_Tree_Item *next_selected_item(Fl_Tree_Item *item=0);
-
- //////////////////////////
- // Item open/close methods
- //////////////////////////
-
- /// Open the specified 'item'.
- /// This causes the item's children (if any) to be shown.
- /// Handles redrawing if anything was actually changed.
- /// Invokes the callback depending on the value of optional parameter \p docallback.
- ///
- /// The callback can use callback_item() and callback_reason() respectively to determine
- /// the item changed and the reason the callback was called.
- ///
- /// \param[in] item -- the item to be opened. Must not be NULL.
- /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
- /// - 0 - callback() is not invoked
- /// - 1 - callback() is invoked if item changed,
- /// callback_reason() will be FL_TREE_REASON_OPENED
- /// \returns
- /// - 1 -- item was opened
- /// - 0 -- item was already open, no change
- ///
- /// \see open(), close(), is_open(), is_close(), callback_item(), callback_reason()
- ///
- int open(Fl_Tree_Item *item, int docallback=1) {
- if ( item->is_open() ) return(0);
- item->open();
- redraw();
- if ( docallback ) {
- do_callback_for_item(item, FL_TREE_REASON_OPENED);
- }
- return(1);
- }
- /// Opens the item specified by \p path (eg: "Parent/child/item").
- /// This causes the item's children (if any) to be shown.
- /// Handles redrawing if anything was actually changed.
- /// Invokes the callback depending on the value of optional parameter \p docallback.
- ///
- /// Items or submenus that themselves contain slashes ('/' or '\')
- /// should be escaped, e.g. open("Holidays/12\\/25\//2010").
- ///
- /// The callback can use callback_item() and callback_reason() respectively to determine
- /// the item changed and the reason the callback was called.
- ///
- /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
- /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
- /// - 0 - callback() is not invoked
- /// - 1 - callback() is invoked if item changed,
- /// callback_reason() will be FL_TREE_REASON_OPENED
- /// \returns
- /// - 1 -- OK: item opened
- /// - 0 -- OK: item was already open, no change
- /// - -1 -- ERROR: item was not found
- ///
- /// \see open(), close(), is_open(), is_close(), callback_item(), callback_reason()
- ///
- int open(const char *path, int docallback=1) {
- Fl_Tree_Item *item = find_item(path);
- if ( ! item ) return(-1);
- return(open(item, docallback));
- }
- /// Toggle the open state of \p item.
- /// Handles redrawing if anything was actually changed.
- /// Invokes the callback depending on the value of optional parameter \p docallback.
- ///
- /// The callback can use callback_item() and callback_reason() respectively to determine
- /// the item changed and the reason the callback was called.
- ///
- /// \param[in] item -- the item whose open state is to be toggled. Must not be NULL.
- /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
- /// - 0 - callback() is not invoked
- /// - 1 - callback() is invoked, callback_reason() will be either
- /// FL_TREE_REASON_OPENED or FL_TREE_REASON_CLOSED
- ///
- /// \see open(), close(), is_open(), is_close(), callback_item(), callback_reason()
- ///
- void open_toggle(Fl_Tree_Item *item, int docallback=1) {
- if ( item->is_open() ) {
- close(item, docallback);
- } else {
- open(item, docallback);
- }
- }
- /// Closes the specified \p item.
- /// Handles redrawing if anything was actually changed.
- /// Invokes the callback depending on the value of optional parameter \p docallback.
- ///
- /// The callback can use callback_item() and callback_reason() respectively to determine
- /// the item changed and the reason the callback was called.
- ///
- /// \param[in] item -- the item to be closed. Must not be NULL.
- /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
- /// - 0 - callback() is not invoked
- /// - 1 - callback() is invoked if item changed,
- /// callback_reason() will be FL_TREE_REASON_CLOSED
- /// \returns
- /// - 1 -- item was closed
- /// - 0 -- item was already closed, no change
- ///
- /// \see open(), close(), is_open(), is_close(), callback_item(), callback_reason()
- ///
- int close(Fl_Tree_Item *item, int docallback=1) {
- if ( item->is_close() ) return(0);
- item->close();
- redraw();
- if ( docallback ) {
- do_callback_for_item(item, FL_TREE_REASON_CLOSED);
- }
- return(1);
- }
- /// Closes the item specified by \p path, eg: "Parent/child/item".
- /// Handles redrawing if anything was actually changed.
- /// Invokes the callback depending on the value of optional parameter \p docallback.
- ///
- /// Items or submenus that themselves contain slashes ('/' or '\')
- /// should be escaped, e.g. close("Holidays/12\\/25\//2010").
- ///
- /// The callback can use callback_item() and callback_reason() respectively to determine
- /// the item changed and the reason the callback was called.
- ///
- /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
- /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
- /// - 0 - callback() is not invoked
- /// - 1 - callback() is invoked if item changed,
- /// callback_reason() will be FL_TREE_REASON_CLOSED
- /// \returns
- /// - 1 -- OK: item closed
- /// - 0 -- OK: item was already closed, no change
- /// - -1 -- ERROR: item was not found
- ///
- /// \see open(), close(), is_open(), is_close(), callback_item(), callback_reason()
- ///
- int close(const char *path, int docallback=1) {
- Fl_Tree_Item *item = find_item(path);
- if ( ! item ) return(-1);
- return(close(item, docallback));
- }
- /// See if \p item is open.
- ///
- /// Items that are 'open' are themselves not necessarily visible;
- /// one of the item's parents might be closed.
- ///
- /// \param[in] item -- the item to be tested. Must not be NULL.
- /// \returns
- /// - 1 : item is open
- /// - 0 : item is closed
- ///
- int is_open(Fl_Tree_Item *item) const {
- return(item->is_open()?1:0);
- }
- /// See if item specified by \p path (eg: "Parent/child/item") is open.
- ///
- /// Items or submenus that themselves contain slashes ('/' or '\')
- /// should be escaped, e.g. is_open("Holidays/12\\/25\//2010").
- ///
- /// Items that are 'open' are themselves not necessarily visible;
- /// one of the item's parents might be closed.
- ///
- /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
- /// \returns
- /// - 1 - OK: item is open
- /// - 0 - OK: item is closed
- /// - -1 - ERROR: item was not found
- ///
- int is_open(const char *path) const {
- const Fl_Tree_Item *item = find_item(path);
- if ( ! item ) return(-1);
- return(item->is_open()?1:0);
- }
- /// See if the specified \p item is closed.
- ///
- /// \param[in] item -- the item to be tested. Must not be NULL.
- /// \returns
- /// - 1 : item is open
- /// - 0 : item is closed
- ///
- int is_close(Fl_Tree_Item *item) const {
- return(item->is_close());
- }
- /// See if item specified by \p path (eg: "Parent/child/item") is closed.
- ///
- /// Items or submenus that themselves contain slashes ('/' or '\')
- /// should be escaped, e.g. is_close("Holidays/12\\/25\//2010").
- ///
- /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
- /// \returns
- /// - 1 - OK: item is closed
- /// - 0 - OK: item is open
- /// - -1 - ERROR: item was not found
- ///
- int is_close(const char *path) const {
- const Fl_Tree_Item *item = find_item(path);
- if ( ! item ) return(-1);
- return(item->is_close()?1:0);
- }
-
- /// Select the specified \p item. Use 'deselect()' to de-select it.
- /// Handles redrawing if anything was actually changed.
- /// Invokes the callback depending on the value of optional parameter \p docallback.
- ///
- /// The callback can use callback_item() and callback_reason() respectively to determine
- /// the item changed and the reason the callback was called.
- ///
- /// \param[in] item -- the item to be selected. Must not be NULL.
- /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
- /// - 0 - the callback() is not invoked
- /// - 1 - the callback() is invoked if item changed state,
- /// callback_reason() will be FL_TREE_REASON_SELECTED
- /// \returns
- /// - 1 - item's state was changed
- /// - 0 - item was already selected, no change was made
- ///
- int select(Fl_Tree_Item *item, int docallback=1) {
- if ( ! item->is_selected() ) {
- item->select();
- set_changed();
- if ( docallback ) {
- do_callback_for_item(item, FL_TREE_REASON_SELECTED);
- }
- redraw();
- return(1);
- }
- return(0);
- }
- /// Select the item specified by \p path (eg: "Parent/child/item").
- /// Handles redrawing if anything was actually changed.
- /// Invokes the callback depending on the value of optional parameter \p docallback.
- ///
- /// Items or submenus that themselves contain slashes ('/' or '\')
- /// should be escaped, e.g. select("Holidays/12\\/25\//2010").
- ///
- /// The callback can use callback_item() and callback_reason() respectively to determine
- /// the item changed and the reason the callback was called.
- ///
- /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
- /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
- /// - 0 - the callback() is not invoked
- /// - 1 - the callback() is invoked if item changed state,
- /// callback_reason() will be FL_TREE_REASON_SELECTED
- /// \returns
- /// - 1 : OK: item's state was changed
- /// - 0 : OK: item was already selected, no change was made
- /// - -1 : ERROR: item was not found
- ///
- int select(const char *path, int docallback=1) {
- Fl_Tree_Item *item = find_item(path);
- if ( ! item ) return(-1);
- return(select(item, docallback));
- }
- /// Toggle the select state of the specified \p item.
- /// Handles redrawing if anything was actually changed.
- /// Invokes the callback depending on the value of optional parameter \p docallback.
- ///
- /// The callback can use callback_item() and callback_reason() respectively to determine
- /// the item changed and the reason the callback was called.
- ///
- /// \param[in] item -- the item to be selected. Must not be NULL.
- /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
- /// - 0 - the callback() is not invoked
- /// - 1 - the callback() is invoked, callback_reason() will be
- /// either FL_TREE_REASON_SELECTED or FL_TREE_REASON_DESELECTED
- ///
- void select_toggle(Fl_Tree_Item *item, int docallback=1) {
- item->select_toggle();
- set_changed();
- if ( docallback ) {
- do_callback_for_item(item, item->is_selected() ? FL_TREE_REASON_SELECTED
- : FL_TREE_REASON_DESELECTED);
- }
- redraw();
- }
- /// De-select the specified \p item.
- /// Handles redrawing if anything was actually changed.
- /// Invokes the callback depending on the value of optional parameter \p docallback.
- ///
- /// The callback can use callback_item() and callback_reason() respectively to determine
- /// the item changed and the reason the callback was called.
- ///
- /// \param[in] item -- the item to be selected. Must not be NULL.
- /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
- /// - 0 - the callback() is not invoked
- /// - 1 - the callback() is invoked if item changed state,
- /// callback_reason() will be FL_TREE_REASON_DESELECTED
- /// \returns
- /// - 0 - item was already deselected, no change was made
- /// - 1 - item's state was changed
- ///
- int deselect(Fl_Tree_Item *item, int docallback=1) {
- if ( item->is_selected() ) {
- item->deselect();
- set_changed();
- if ( docallback ) {
- do_callback_for_item(item, FL_TREE_REASON_DESELECTED);
- }
- redraw();
- return(1);
- }
- return(0);
- }
- /// Deselect an item specified by \p path (eg: "Parent/child/item").
- /// Handles redrawing if anything was actually changed.
- /// Invokes the callback depending on the value of optional parameter \p docallback.
- ///
- /// Items or submenus that themselves contain slashes ('/' or '\')
- /// should be escaped, e.g. deselect("Holidays/12\\/25\//2010").
- ///
- /// The callback can use callback_item() and callback_reason() respectively to determine
- /// the item changed and the reason the callback was called.
- ///
- /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
- /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
- /// - 0 - the callback() is not invoked
- /// - 1 - the callback() is invoked if item changed state,
- /// callback_reason() will be FL_TREE_REASON_DESELECTED
- /// \returns
- /// - 1 - OK: item's state was changed
- /// - 0 - OK: item was already deselected, no change was made
- /// - -1 - ERROR: item was not found
- ///
- int deselect(const char *path, int docallback=1) {
- Fl_Tree_Item *item = find_item(path);
- if ( ! item ) return(-1);
- return(deselect(item, docallback));
- }
-
- int deselect_all(Fl_Tree_Item *item=0, int docallback=1);
- int select_only(Fl_Tree_Item *selitem, int docallback=1);
- int select_all(Fl_Tree_Item *item=0, int docallback=1);
- void set_item_focus(Fl_Tree_Item *o);
-
- /// See if the specified \p item is selected.
- ///
- /// \param[in] item -- the item to be tested. Must not be NULL.
- ///
- /// \return
- /// - 1 : item selected
- /// - 0 : item deselected
- ///
- int is_selected(Fl_Tree_Item *item) const {
- return(item->is_selected()?1:0);
- }
- /// See if item specified by \p path (eg: "Parent/child/item") is selected.
- ///
- /// Items or submenus that themselves contain slashes ('/' or '\')
- /// should be escaped, e.g. is_selected("Holidays/12\\/25\//2010").
- ///
- /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
- /// \returns
- /// - 1 : item selected
- /// - 0 : item deselected
- /// - -1 : item was not found
- ///
- int is_selected(const char *path) {
- Fl_Tree_Item *item = find_item(path);
- if ( ! item ) return(-1);
- return(is_selected(item));
- }
- /// Print the tree as 'ascii art' to stdout.
- /// Used mainly for debugging.
- ///
- void show_self() {
- if ( ! _root ) return;
- _root->show_self();
- }
-
- /////////////////////////////////
- // Item attribute related methods
- /////////////////////////////////
-
- /// Get the default label fontsize used for creating new items.
- Fl_Fontsize item_labelsize() const {
- return(_prefs.labelsize());
- }
- /// Set the default label font size used for creating new items.
- /// To change the font size on a per-item basis, use Fl_Tree_Item::labelsize(Fl_Fontsize)
- ///
- void item_labelsize(Fl_Fontsize val) {
- _prefs.labelsize(val);
- }
- /// Get the default font face used for creating new items.
- Fl_Font item_labelfont() const {
- return(_prefs.labelfont());
- }
- /// Set the default font face used for creating new items.
- /// To change the font face on a per-item basis, use Fl_Tree_Item::labelfont(Fl_Font)
- ///
- void item_labelfont(Fl_Font val) {
- _prefs.labelfont(val);
- }
- /// Get the default label foreground color used for creating new items.
- Fl_Color item_labelfgcolor(void) const {
- return(_prefs.labelfgcolor());
- }
- /// Set the default label foreground color used for creating new items.
- /// To change the foreground color on a per-item basis, use Fl_Tree_Item::labelfgcolor(Fl_Color)
- ///
- void item_labelfgcolor(Fl_Color val) {
- _prefs.labelfgcolor(val);
- }
- /// Get the default label background color used for creating new items.
- Fl_Color item_labelbgcolor(void) const {
- return(_prefs.labelbgcolor());
- }
- /// Set the default label background color used for creating new items.
- /// To change the background color on a per-item basis, use Fl_Tree_Item::labelbgcolor(Fl_Color)
- ///
- void item_labelbgcolor(Fl_Color val) {
- _prefs.labelbgcolor(val);
- }
- /// Get the connector color used for tree connection lines.
- Fl_Color connectorcolor() const {
- return(_prefs.connectorcolor());
- }
- /// Set the connector color used for tree connection lines.
- void connectorcolor(Fl_Color val) {
- _prefs.connectorcolor(val);
- }
- /// Get the amount of white space (in pixels) that should appear
- /// between the widget's left border and the tree's contents.
- ///
- int marginleft() const {
- return(_prefs.marginleft());
- }
- /// Set the amount of white space (in pixels) that should appear
- /// between the widget's left border and the left side of the tree's contents.
- ///
- void marginleft(int val) {
- _prefs.marginleft(val);
- redraw();
- }
- /// Get the amount of white space (in pixels) that should appear
- /// between the widget's top border and the top of the tree's contents.
- ///
- int margintop() const {
- return(_prefs.margintop());
- }
- /// Sets the amount of white space (in pixels) that should appear
- /// between the widget's top border and the top of the tree's contents.
- ///
- void margintop(int val) {
- _prefs.margintop(val);
- redraw();
- }
- /// Get the amount of white space (in pixels) that should appear
- /// below an open child tree's contents.
- ///
- int openchild_marginbottom() const {
- return(_prefs.openchild_marginbottom());
- }
- /// Set the amount of white space (in pixels) that should appear
- /// below an open child tree's contents.
- ///
- void openchild_marginbottom(int val) {
- _prefs.openchild_marginbottom(val);
- redraw();
- }
- /// Gets the width of the horizontal connection lines (in pixels)
- /// that appear to the left of each tree item's label.
- ///
- int connectorwidth() const {
- return(_prefs.connectorwidth());
- }
- /// Sets the width of the horizontal connection lines (in pixels)
- /// that appear to the left of each tree item's label.
- ///
- void connectorwidth(int val) {
- _prefs.connectorwidth(val);
- redraw();
- }
- /// Returns the Fl_Image being used as the default user icon for all
- /// newly created items.
- /// Returns zero if no icon has been set, which is the default.
- ///
- Fl_Image *usericon() const {
- return(_prefs.usericon());
- }
- /// Sets the Fl_Image to be used as the default user icon for all
- /// newly created items.
- ///
- /// If you want to specify user icons on a per-item basis,
- /// use Fl_Tree_Item::usericon() instead.
- ///
- /// \param[in] val -- The new image to be used, or
- /// zero to disable user icons.
- ///
- void usericon(Fl_Image *val) {
- _prefs.usericon(val);
- redraw();
- }
- /// Returns the icon to be used as the 'open' icon.
- /// If none was set, the internal default is returned,
- /// a simple '[+]' icon.
- ///
- Fl_Image *openicon() const {
- return(_prefs.openicon());
- }
- /// Sets the icon to be used as the 'open' icon.
- /// This overrides the built in default '[+]' icon.
- ///
- /// \param[in] val -- The new image, or zero to use the default [+] icon.
- ///
- void openicon(Fl_Image *val) {
- _prefs.openicon(val);
- redraw();
- }
- /// Returns the icon to be used as the 'close' icon.
- /// If none was set, the internal default is returned,
- /// a simple '[-]' icon.
- ///
- Fl_Image *closeicon() const {
- return(_prefs.closeicon());
- }
- /// Sets the icon to be used as the 'close' icon.
- /// This overrides the built in default '[-]' icon.
- ///
- /// \param[in] val -- The new image, or zero to use the default [-] icon.
- ///
- void closeicon(Fl_Image *val) {
- _prefs.closeicon(val);
- redraw();
- }
- /// Returns 1 if the collapse icon is enabled, 0 if not.
- int showcollapse() const {
- return(_prefs.showcollapse());
- }
- /// Set if we should show the collapse icon or not.
- /// If collapse icons are disabled, the user will not be able
- /// to interactively collapse items in the tree, unless the application
- /// provides some other means via open() and close().
- ///
- /// \param[in] val 1: shows collapse icons (default),\n
- /// 0: hides collapse icons.
- ///
- void showcollapse(int val) {
- _prefs.showcollapse(val);
- redraw();
- }
- /// Returns 1 if the root item is to be shown, or 0 if not.
- int showroot() const {
- return(_prefs.showroot());
- }
- /// Set if the root item should be shown or not.
- /// \param[in] val 1 -- show the root item (default)\n
- /// 0 -- hide the root item.
- ///
- void showroot(int val) {
- _prefs.showroot(val);
- redraw();
- }
- /// Returns the line drawing style for inter-connecting items.
- Fl_Tree_Connector connectorstyle() const {
- return(_prefs.connectorstyle());
- }
- /// Sets the line drawing style for inter-connecting items.
- void connectorstyle(Fl_Tree_Connector val) {
- _prefs.connectorstyle(val);
- redraw();
- }
- /// Set the default sort order used when items are added to the tree.
- /// See Fl_Tree_Sort for possible values.
- ///
- Fl_Tree_Sort sortorder() const {
- return(_prefs.sortorder());
- }
- /// Gets the sort order used to add items to the tree.
- void sortorder(Fl_Tree_Sort val) {
- _prefs.sortorder(val);
- // no redraw().. only affects new add()itions
- }
- /// Sets the style of box used to draw selected items.
- /// This is an fltk Fl_Boxtype.
- /// The default is influenced by FLTK's current Fl::scheme()
- ///
- Fl_Boxtype selectbox() const {
- return(_prefs.selectbox());
- }
- /// Gets the style of box used to draw selected items.
- /// This is an fltk Fl_Boxtype.
- /// The default is influenced by FLTK's current Fl::scheme()
- ///
- void selectbox(Fl_Boxtype val) {
- _prefs.selectbox(val);
- redraw();
- }
- /// Gets the tree's current selection mode.
- Fl_Tree_Select selectmode() const {
- return(_prefs.selectmode());
- }
- /// Sets the tree's selection mode.
- void selectmode(Fl_Tree_Select val) {
- _prefs.selectmode(val);
- }
- int displayed(Fl_Tree_Item *item);
- void show_item(Fl_Tree_Item *item, int yoff);
- void show_item(Fl_Tree_Item *item);
- void show_item_bottom(Fl_Tree_Item *item);
- void show_item_middle(Fl_Tree_Item *item);
- void show_item_top(Fl_Tree_Item *item);
- void display(Fl_Tree_Item *item);
- int vposition() const;
- void vposition(int ypos);
-
- /// See if widget \p w is one of the Fl_Tree widget's scrollbars.
- /// Use this to skip over the scrollbars when walking the child() array. Example:
- /// \code
- /// for ( int i=0; i<tree->children(); i++ ) { // walk children
- /// Fl_Widget *w= tree->child(i);
- /// if ( brow->is_scrollbar(w) ) continue; // skip scrollbars
- /// ..do work here..
- /// }
- /// \endcode
- /// \param[in] w Widget to test
- /// \returns 1 if \p w is a scrollbar, 0 if not.
- ///
- int is_scrollbar(Fl_Widget *w) {
- return( ( w == _vscroll ) ? 1 : 0 );
- }
- /// Gets the current size of the scrollbars' troughs, in pixels.
- ///
- /// If this value is zero (default), this widget will use the global
- /// Fl::scrollbar_size() value as the scrollbar's width.
- ///
- /// \returns Scrollbar size in pixels, or 0 if the global Fl::scrollsize() is being used.
- /// \see Fl::scrollbar_size(int)
- ///
- int scrollbar_size() const {
- return(_scrollbar_size);
- }
- /// Sets the pixel size of the scrollbars' troughs to the \p size, in pixels.
- ///
- /// Normally you should not need this method, and should use the global
- /// Fl::scrollbar_size(int) instead to manage the size of ALL
- /// your widgets' scrollbars. This ensures your application
- /// has a consistent UI, is the default behavior, and is normally
- /// what you want.
- ///
- /// Only use THIS method if you really need to override the global
- /// scrollbar size. The need for this should be rare.
- ///
- /// Setting \p size to the special value of 0 causes the widget to
- /// track the global Fl::scrollbar_size(), which is the default.
- ///
- /// \param[in] size Sets the scrollbar size in pixels.\n
- /// If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()
- /// \see Fl::scrollbar_size()
- ///
- void scrollbar_size(int size) {
- _scrollbar_size = size;
- int scrollsize = _scrollbar_size ? _scrollbar_size : Fl::scrollbar_size();
- if ( _vscroll->w() != scrollsize ) {
- _vscroll->resize(x()+w()-scrollsize, h(), scrollsize, _vscroll->h());
- }
- }
-
- ///////////////////////
- // callback related
- ///////////////////////
-
- /// Sets the item that was changed for this callback.
- /// Used internally to pass the item that invoked the callback.
- ///
- void callback_item(Fl_Tree_Item* item) {
- _callback_item = item;
- }
- /// Gets the item that caused the callback.
- /// The callback() can use this value to see which item changed.
- ///
- Fl_Tree_Item* callback_item() {
- return(_callback_item);
- }
- /// Sets the reason for this callback.
- /// Used internally to pass the reason the callback was invoked.
- ///
- void callback_reason(Fl_Tree_Reason reason) {
- _callback_reason = reason;
- }
- /// Gets the reason for this callback.
- ///
- /// The callback() can use this value to see why it was called. Example:
- /// \code
- /// void MyTreeCallback(Fl_Widget *w, void *userdata) {
- /// Fl_Tree *tree = (Fl_Tree*)w;
- /// Fl_Tree_Item *item = tree->callback_item(); // the item changed (can be NULL if more than one item was changed!)
- /// switch ( tree->callback_reason() ) { // reason callback was invoked
- /// case FL_TREE_REASON_OPENED: ..item was opened..
- /// case FL_TREE_REASON_CLOSED: ..item was closed..
- /// case FL_TREE_REASON_SELECTED: ..item was selected..
- /// case FL_TREE_REASON_DESELECTED: ..item was deselected..
- /// }
- /// }
- /// \endcode
- ///
- Fl_Tree_Reason callback_reason() const {
- return(_callback_reason);
- }
-
- /// Load FLTK preferences
- void load(class Fl_Preferences&);
-};
-
-#endif /*FL_TREE_H*/
-
-//
-// End of "$Id: Fl_Tree.H 8632 2011-05-04 02:59:50Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Tree_Item.H b/Libraries/FL/Fl_Tree_Item.H
deleted file mode 100644
index 3c579faf..00000000
--- a/Libraries/FL/Fl_Tree_Item.H
+++ /dev/null
@@ -1,337 +0,0 @@
-//
-// "$Id: Fl_Tree_Item.H 8340 2011-01-30 20:22:06Z greg.ercolano $"
-//
-
-#ifndef FL_TREE_ITEM_H
-#define FL_TREE_ITEM_H
-
-#include <FL/Fl.H>
-#include <FL/Fl_Widget.H>
-#include <FL/Fl_Image.H>
-#include <FL/fl_draw.H>
-
-#include <FL/Fl_Tree_Item_Array.H>
-#include <FL/Fl_Tree_Prefs.H>
-
-//////////////////////
-// FL/Fl_Tree_Item.H
-//////////////////////
-//
-// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
-// Copyright (C) 2009-2010 by Greg Ercolano.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-
-///
-/// \file
-/// \brief This file contains the definitions for Fl_Tree_Item
-///
-
-/// \brief Tree item
-///
-/// This class is a single tree item, and manages all of the item's attributes.
-/// Fl_Tree_Item is used by Fl_Tree, which is comprised of many instances of Fl_Tree_Item.
-///
-/// Fl_Tree_Item is hierarchical; it dynamically manages an Fl_Tree_Item_Array of children
-/// that are themselves instances of Fl_Tree_Item. Each item can have zero or more children.
-/// When an item has children, close() and open() can be used to hide or show them.
-///
-/// Items have their own attributes; font size, face, color.
-/// Items maintain their own hierarchy of children.
-///
-/// When you make changes to items, you'll need to tell the tree to redraw()
-/// for the changes to show up.
-///
-class FL_EXPORT Fl_Tree_Item {
- const char *_label; // label (memory managed)
- Fl_Font _labelfont; // label's font face
- Fl_Fontsize _labelsize; // label's font size
- Fl_Color _labelfgcolor; // label's fg color
- Fl_Color _labelbgcolor; // label's bg color
- char _open; // item is open?
- char _visible; // item is visible?
- char _active; // item activated?
- char _selected; // item selected?
- int _xywh[4]; // xywh of this widget (if visible)
- int _collapse_xywh[4]; // xywh of collapse icon (if any)
- int _label_xywh[4]; // xywh of label
- Fl_Widget *_widget; // item's label widget (optional)
- Fl_Image *_usericon; // item's user-specific icon (optional)
- Fl_Tree_Item_Array _children; // array of child items
- Fl_Tree_Item *_parent; // parent item (=0 if root)
- void *_userdata; // user data that can be associated with an item
-protected:
- void show_widgets();
- void hide_widgets();
- void draw_vertical_connector(int x, int y1, int y2, const Fl_Tree_Prefs &prefs);
- void draw_horizontal_connector(int x1, int x2, int y, const Fl_Tree_Prefs &prefs);
-public:
- Fl_Tree_Item(const Fl_Tree_Prefs &prefs); // CTOR
- ~Fl_Tree_Item(); // DTOR
- Fl_Tree_Item(const Fl_Tree_Item *o); // COPY CTOR
- int x() const { return(_xywh[0]); }
- int y() const { return(_xywh[1]); }
- int w() const { return(_xywh[2]); }
- int h() const { return(_xywh[3]); }
- void draw(int X, int &Y, int W, Fl_Widget *tree, Fl_Tree_Item *itemfocus, const Fl_Tree_Prefs &prefs, int lastchild=1);
- void show_self(const char *indent = "") const;
- void label(const char *val);
- const char *label() const;
-
- /// Set a user-data value for the item.
- inline void user_data( void* data ) { _userdata = data; }
-
- /// Retrieve the user-data value that has been assigned to the item.
- inline void* user_data() const { return _userdata; }
-
- /// Set item's label font face.
- void labelfont(Fl_Font val) {
- _labelfont = val;
- }
- /// Get item's label font face.
- Fl_Font labelfont() const {
- return(_labelfont);
- }
- /// Set item's label font size.
- void labelsize(Fl_Fontsize val) {
- _labelsize = val;
- }
- /// Get item's label font size.
- Fl_Fontsize labelsize() const {
- return(_labelsize);
- }
- /// Set item's label foreground text color.
- void labelfgcolor(Fl_Color val) {
- _labelfgcolor = val;
- }
- /// Set item's label text color.
- void labelcolor(Fl_Color val) {
- _labelfgcolor = val;
- }
- /// Return item's label text color.
- Fl_Color labelcolor() const {
- return(_labelfgcolor);
- }
- /// Return item's label foreground text color.
- Fl_Color labelfgcolor() const {
- return(_labelfgcolor);
- }
- /// Set item's label background color.
- void labelbgcolor(Fl_Color val) {
- _labelbgcolor = val;
- }
- /// Return item's background text color.
- Fl_Color labelbgcolor() const {
- return(_labelbgcolor);
- }
- /// Assign an FLTK widget to this item.
- void widget(Fl_Widget *val) {
- _widget = val;
- }
- /// Return FLTK widget assigned to this item.
- Fl_Widget *widget() const {
- return(_widget);
- }
- /// Return the number of children this item has.
- int children() const {
- return(_children.total());
- }
- /// Return the child item for the given 'index'.
- Fl_Tree_Item *child(int index) {
- return(_children[index]);
- }
- /// Return the const child item for the given 'index'.
- const Fl_Tree_Item *child(int t) const;
- /// See if this item has children.
- int has_children() const {
- return(children());
- }
- int find_child(const char *name);
- int find_child(Fl_Tree_Item *item);
- int remove_child(Fl_Tree_Item *item);
- int remove_child(const char *new_label);
- void clear_children();
- void swap_children(int ax, int bx);
- int swap_children(Fl_Tree_Item *a, Fl_Tree_Item *b);
- const Fl_Tree_Item *find_child_item(char **arr) const; // const
- Fl_Tree_Item *find_child_item(char **arr); // non-const
- const Fl_Tree_Item *find_item(char **arr) const; // const
- Fl_Tree_Item *find_item(char **arr); // non-const
- //////////////////
- // Adding items
- //////////////////
- Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs, const char *new_label);
- Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs, char **arr);
- Fl_Tree_Item *insert(const Fl_Tree_Prefs &prefs, const char *new_label, int pos=0);
- Fl_Tree_Item *insert_above(const Fl_Tree_Prefs &prefs, const char *new_label);
- int depth() const;
- Fl_Tree_Item *prev();
- Fl_Tree_Item *next();
- Fl_Tree_Item *next_sibling();
- Fl_Tree_Item *prev_sibling();
- Fl_Tree_Item *next_displayed(Fl_Tree_Prefs &prefs);
- Fl_Tree_Item *prev_displayed(Fl_Tree_Prefs &prefs);
-
- /// Return the parent for this item. Returns NULL if we are the root.
- Fl_Tree_Item *parent() {
- return(_parent);
- }
- /// Return the const parent for this item. Returns NULL if we are the root.
- const Fl_Tree_Item *parent() const {
- return(_parent);
- }
- /// Set the parent for this item.
- /// Should only be used by Fl_Tree's internals.
- ///
- void parent(Fl_Tree_Item *val) {
- _parent = val;
- }
- //////////////////
- // State
- //////////////////
- void open();
- void close();
- /// See if the item is 'open'.
- int is_open() const {
- return(_open?1:0);
- }
- /// See if the item is 'closed'.
- int is_close() const {
- return(_open?0:1);
- }
- /// Toggle the item's open/closed state.
- void open_toggle() {
- _open?close():open();
- }
- /// Change the item's selection state to the optionally specified 'val'.
- /// If 'val' is not specified, the item will be selected.
- ///
- void select(int val=1) {
- _selected = val;
- }
- /// Toggle the item's selection state.
- void select_toggle() {
- if ( is_selected() ) {
- deselect(); // deselect if selected
- } else {
- select(); // select if deselected
- }
- }
- /// Select self and all children
- /// Returns count of how many items were in the 'deselected' state,
- /// ie. how many items were "changed".
- ///
- int select_all() {
- int count = 0;
- if ( ! is_selected() ) {
- select();
- ++count;
- }
- for ( int t=0; t<children(); t++ ) {
- count += child(t)->select_all();
- }
- return(count);
- }
- /// Disable the item's selection state.
- void deselect() {
- _selected = 0;
- }
- /// Deselect self and all children
- /// Returns count of how many items were in the 'selected' state,
- /// ie. how many items were "changed".
- ///
- int deselect_all() {
- int count = 0;
- if ( is_selected() ) {
- deselect();
- ++count;
- }
- for ( int t=0; t<children(); t++ ) {
- count += child(t)->deselect_all();
- }
- return(count);
- }
- /// See if the item is selected.
- char is_selected() const {
- return(_selected);
- }
- /// Change the item's activation state to the optionally specified 'val'.
- ///
- /// When deactivated, the item will be 'grayed out'; the callback()
- /// won't be invoked if the user clicks on the label. If the item
- /// has a widget() associated with the item, its activation state
- /// will be changed as well.
- ///
- /// If 'val' is not specified, the item will be activated.
- ///
- void activate(int val=1) {
- _active = val;
- if ( _widget && val != (int)_widget->active() ) {
- if ( val ) {
- _widget->activate();
- } else {
- _widget->deactivate();
- }
- _widget->redraw();
- }
- }
- /// Deactivate the item; the callback() won't be invoked when clicked.
- /// Same as activate(0)
- ///
- void deactivate() {
- activate(0);
- }
- /// See if the item is activated.
- char is_activated() const {
- return(_active);
- }
- /// See if the item is activated.
- char is_active() const {
- return(_active);
- }
- /// See if the item is visible.
- int visible() const {
- return(_visible ? 1 : 0);
- }
- int visible_r() const;
-
- /// Set the user icon's image. '0' will disable.
- void usericon(Fl_Image *val) {
- _usericon = val;
- }
- /// Get the user icon. Returns '0' if disabled.
- Fl_Image *usericon() const {
- return(_usericon);
- }
- //////////////////
- // Events
- //////////////////
- const Fl_Tree_Item *find_clicked(const Fl_Tree_Prefs &prefs) const;
- Fl_Tree_Item *find_clicked(const Fl_Tree_Prefs &prefs);
- int event_on_collapse_icon(const Fl_Tree_Prefs &prefs) const;
- int event_on_label(const Fl_Tree_Prefs &prefs) const;
- /// Is this item the root of the tree?
- int is_root() const {
- return(_parent==0?1:0);
- }
-};
-
-#endif /*FL_TREE_ITEM_H*/
-
-//
-// End of "$Id: Fl_Tree_Item.H 8340 2011-01-30 20:22:06Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Tree_Item_Array.H b/Libraries/FL/Fl_Tree_Item_Array.H
deleted file mode 100644
index 5a91dee1..00000000
--- a/Libraries/FL/Fl_Tree_Item_Array.H
+++ /dev/null
@@ -1,90 +0,0 @@
-//
-// "$Id: Fl_Tree_Item_Array.H 7903 2010-11-28 21:06:39Z matt $"
-//
-
-#ifndef _FL_TREE_ITEM_ARRAY_H
-#define _FL_TREE_ITEM_ARRAY_H
-
-#include "Fl_Export.H"
-
-class FL_EXPORT Fl_Tree_Item; // forward decl must *precede* first doxygen comment block
- // or doxygen will not document our class..
-
-//////////////////////////
-// FL/Fl_Tree_Item_Array.H
-//////////////////////////
-//
-// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
-// Copyright (C) 2009-2010 by Greg Ercolano.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-
-///
-/// \file
-/// \brief This file defines a class that manages an array of Fl_Tree_Item pointers.
-///
-
-/// \brief Manages an array of Fl_Tree_Item pointers.
-///
-/// Because FLTK 1.x.x. has mandated that templates and STL not be used,
-/// we use this class to dynamically manage the arrays.
-///
-/// None of the methods do range checking on index values; the caller
-/// must be sure that index values are within the range 0<index<total()
-/// (unless otherwise noted).
-///
-
-class FL_EXPORT Fl_Tree_Item_Array {
- Fl_Tree_Item **_items; // items array
- int _total; // #items in array
- int _size; // #items *allocated* for array
- int _chunksize; // #items to enlarge mem allocation
- void enlarge(int count);
-public:
- Fl_Tree_Item_Array(int new_chunksize = 10); // CTOR
- ~Fl_Tree_Item_Array(); // DTOR
- Fl_Tree_Item_Array(const Fl_Tree_Item_Array *o); // COPY CTOR
- /// Return the item and index \p i.
- Fl_Tree_Item *operator[](int i) {
- return(_items[i]);
- }
- /// Const version of operator[](int i)
- const Fl_Tree_Item *operator[](int i) const {
- return(_items[i]);
- }
- /// Return the total items in the array, or 0 if empty.
- int total() const {
- return(_total);
- }
- /// Swap the two items at index positions \p ax and \p bx.
- void swap(int ax, int bx) {
- Fl_Tree_Item *asave = _items[ax];
- _items[ax] = _items[bx];
- _items[bx] = asave;
- }
- void clear();
- void add(Fl_Tree_Item *val);
- void insert(int pos, Fl_Tree_Item *new_item);
- void remove(int index);
- int remove(Fl_Tree_Item *item);
-};
-
-#endif /*_FL_TREE_ITEM_ARRAY_H*/
-
-//
-// End of "$Id: Fl_Tree_Item_Array.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_Tree_Prefs.H b/Libraries/FL/Fl_Tree_Prefs.H
deleted file mode 100644
index 57d72e38..00000000
--- a/Libraries/FL/Fl_Tree_Prefs.H
+++ /dev/null
@@ -1,343 +0,0 @@
-//
-// "$Id: Fl_Tree_Prefs.H 8340 2011-01-30 20:22:06Z greg.ercolano $"
-//
-
-#ifndef FL_TREE_PREFS_H
-#define FL_TREE_PREFS_H
-
-//////////////////////
-// FL/Fl_Tree_Prefs.H
-//////////////////////
-//
-// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
-// Copyright (C) 2009-2010 by Greg Ercolano.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-
-///
-/// \file
-/// \brief This file contains the definitions for Fl_Tree's preferences.
-///
-/// \code
-/// Fl_Tree_Prefs
-/// :
-/// .....:.......
-/// : :
-/// Fl_Tree :
-/// |_____ Fl_Tree_Item
-///
-/// \endcode
-///
-
-/// \class Fl_Tree_Prefs
-/// \brief Tree widget's preferences.
-
-/// \enum Fl_Tree_Sort
-/// Sort order options for items added to the tree
-///
-enum Fl_Tree_Sort {
- FL_TREE_SORT_NONE=0, ///< No sorting; items are added in the order defined (default).
- FL_TREE_SORT_ASCENDING=1, ///< Add items in ascending sort order.
- FL_TREE_SORT_DESCENDING=2 ///< Add items in descending sort order.
-};
-
-/// \enum Fl_Tree_Connector
-/// Defines the style of connection lines between items.
-///
-enum Fl_Tree_Connector {
- FL_TREE_CONNECTOR_NONE=0, ///< Use no lines connecting items
- FL_TREE_CONNECTOR_DOTTED=1, ///< Use dotted lines connecting items (default)
- FL_TREE_CONNECTOR_SOLID=2 ///< Use solid lines connecting items
-};
-
-/// \enum Fl_Tree_Select
-/// Tree selection style.
-///
-enum Fl_Tree_Select {
- FL_TREE_SELECT_NONE=0, ///< Nothing selected when items are clicked
- FL_TREE_SELECT_SINGLE=1, ///< Single item selected when item is clicked (default)
- FL_TREE_SELECT_MULTI=2 ///< Multiple items can be selected by clicking with
- ///< SHIFT or CTRL or mouse drags.
-};
-
-/// \class Fl_Tree_Prefs
-///
-/// \brief Fl_Tree's Preferences class.
-///
-/// This class manages the Fl_Tree's defaults.
-/// You should probably be using the methods in Fl_Tree
-/// instead of trying to accessing tree's preferences settings directly.
-///
-class FL_EXPORT Fl_Tree_Prefs {
- Fl_Font _labelfont; // label's font face
- Fl_Fontsize _labelsize; // label's font size
- int _margintop; // --
- int _marginleft; // |- tree's margins
- //int _marginright; // |
- //int _marginbottom; // --
- int _openchild_marginbottom; // extra space below an open child tree
- int _usericonmarginleft; // space to left of user icon (if any)
- int _labelmarginleft; // space to left of label
- int _connectorwidth; // connector width (right of open/close icon)
- int _linespacing; // vertical space between lines
- // Colors
- Fl_Color _labelfgcolor; // label's foreground color
- Fl_Color _labelbgcolor; // background color
- Fl_Color _connectorcolor; // connector dotted line color
- Fl_Tree_Connector _connectorstyle; // connector line style
- Fl_Image *_openimage; // the 'open' icon [+]
- Fl_Image *_closeimage; // the 'close' icon [-]
- Fl_Image *_userimage; // user's own icon
- char _showcollapse; // 1=show collapse icons, 0=don't
- char _showroot; // show the root item as part of the tree
- Fl_Tree_Sort _sortorder; // none, ascening, descending, etc.
- Fl_Boxtype _selectbox; // selection box type
- Fl_Tree_Select _selectmode; // selection mode
-public:
- Fl_Tree_Prefs();
-
- ////////////////////////////
- // Labels
- ////////////////////////////
- /// Return the label's font.
- inline Fl_Font labelfont() const {
- return(_labelfont);
- }
- /// Set the label's font to \p val.
- inline void labelfont(Fl_Font val) {
- _labelfont = val;
- }
- /// Return the label's size in pixels.
- inline Fl_Fontsize labelsize() const {
- return(_labelsize);
- }
- /// Set the label's size in pixels to \p val.
- inline void labelsize(Fl_Fontsize val) {
- _labelsize = val;
- }
-
- ////////////////////////////
- // Margins
- ////////////////////////////
- /// Get the left margin's value in pixels
- inline int marginleft() const {
- return(_marginleft);
- }
- /// Set the left margin's value in pixels
- inline void marginleft(int val) {
- _marginleft = val;
- }
- /// Get the top margin's value in pixels
- inline int margintop() const {
- return(_margintop);
- }
- /// Set the top margin's value in pixels
- inline void margintop(int val) {
- _margintop = val;
- }
- /// Get the margin below an open child in pixels
- inline int openchild_marginbottom() const {
- return(_openchild_marginbottom);
- }
- /// Set the margin below an open child in pixels
- inline void openchild_marginbottom(int val) {
- _openchild_marginbottom = val;
- }
-
- /****** NOT IMPLEMENTED
- inline int marginright() const {
- return(_marginright);
- }
- inline void marginright(int val) {
- _marginright = val;
- }
- inline int marginbottom() const {
- return(_marginbottom);
- }
- inline void marginbottom(int val) {
- _marginbottom = val;
- }
- *******/
-
- /// Get the user icon's left margin value in pixels
- inline int usericonmarginleft() const {
- return(_usericonmarginleft);
- }
- /// Set the user icon's left margin value in pixels
- inline void usericonmarginleft(int val) {
- _usericonmarginleft = val;
- }
- /// Get the label's left margin value in pixels
- inline int labelmarginleft() const {
- return(_labelmarginleft);
- }
- /// Set the label's left margin value in pixels
- inline void labelmarginleft(int val) {
- _labelmarginleft = val;
- }
- /// Get the line spacing value in pixels
- inline int linespacing() const {
- return(_linespacing);
- }
- /// Set the line spacing value in pixels
- inline void linespacing(int val) {
- _linespacing = val;
- }
-
- ////////////////////////////
- // Colors and Styles
- ////////////////////////////
- /// Get the default label foreground color
- inline Fl_Color labelfgcolor() const {
- return(_labelfgcolor);
- }
- /// Set the default label foreground color
- inline void labelfgcolor(Fl_Color val) {
- _labelfgcolor = val;
- }
- /// Get the default label background color
- inline Fl_Color labelbgcolor() const {
- return(_labelbgcolor);
- }
- /// Set the default label background color
- inline void labelbgcolor(Fl_Color val) {
- _labelbgcolor = val;
- }
- /// Get the connector color used for tree connection lines.
- inline Fl_Color connectorcolor() const {
- return(_connectorcolor);
- }
- /// Set the connector color used for tree connection lines.
- inline void connectorcolor(Fl_Color val) {
- _connectorcolor = val;
- }
- /// Get the connector style.
- inline Fl_Tree_Connector connectorstyle() const {
- return(_connectorstyle);
- }
- /// Set the connector style.
- inline void connectorstyle(Fl_Tree_Connector val) {
- _connectorstyle = val;
- }
- /// Set the connector style [integer].
- inline void connectorstyle(int val) {
- _connectorstyle = Fl_Tree_Connector(val);
- }
- /// Get the tree connection line's width.
- inline int connectorwidth() const {
- return(_connectorwidth);
- }
- /// Set the tree connection line's width.
- inline void connectorwidth(int val) {
- _connectorwidth = val;
- }
-
- ////////////////////////////
- // Icons
- ////////////////////////////
- /// Get the current default 'open' icon.
- /// Returns the Fl_Image* of the icon, or 0 if none.
- ///
- inline Fl_Image *openicon() const {
- return(_openimage);
- }
- void openicon(Fl_Image *val);
- /// Gets the default 'close' icon
- /// Returns the Fl_Image* of the icon, or 0 if none.
- ///
- inline Fl_Image *closeicon() const {
- return(_closeimage);
- }
- void closeicon(Fl_Image *val);
- /// Gets the default 'user icon' (default is 0)
- inline Fl_Image *usericon() const {
- return(_userimage);
- }
- /// Sets the default 'user icon'
- /// Returns the Fl_Image* of the icon, or 0 if none (default).
- ///
- inline void usericon(Fl_Image *val) {
- _userimage = val;
- }
-
- ////////////////////////////
- // Options
- ////////////////////////////
- /// Returns 1 if the collapse icon is enabled, 0 if not.
- inline char showcollapse() const {
- return(_showcollapse);
- }
- /// Set if we should show the collapse icon or not.
- /// If collapse icons are disabled, the user will not be able
- /// to interactively collapse items in the tree, unless the application
- /// provides some other means via open() and close().
- ///
- /// \param[in] val 1: shows collapse icons (default),\n
- /// 0: hides collapse icons.
- ///
- inline void showcollapse(int val) {
- _showcollapse = val;
- }
- /// Get the default sort order value
- inline Fl_Tree_Sort sortorder() const {
- return(_sortorder);
- }
- /// Set the default sort order value.
- /// Defines the order new items appear when add()ed to the tree.
- /// See Fl_Tree_Sort for possible values.
- ///
- inline void sortorder(Fl_Tree_Sort val) {
- _sortorder = val;
- }
- /// Get the default selection box's box drawing style as an Fl_Boxtype.
- inline Fl_Boxtype selectbox() const {
- return(_selectbox);
- }
- /// Set the default selection box's box drawing style to \p val.
- inline void selectbox(Fl_Boxtype val) {
- _selectbox = val;
- }
- /// Returns 1 if the root item is to be shown, or 0 if not.
- inline int showroot() const {
- return(int(_showroot));
- }
- /// Set if the root item should be shown or not.
- /// \param[in] val 1 -- show the root item (default)\n
- /// 0 -- hide the root item.
- ///
- inline void showroot(int val) {
- _showroot = char(val);
- }
- /// Get the selection mode used for the tree
- inline Fl_Tree_Select selectmode() const {
- return(_selectmode);
- }
- /// Set the selection mode used for the tree to \p val.
- /// This affects how items in the tree are selected
- /// when clicked on and dragged over by the mouse.
- /// See Fl_Tree_Select for possible values.
- ///
- inline void selectmode(Fl_Tree_Select val) {
- _selectmode = val;
- }
-};
-
-#endif /*FL_TREE_PREFS_H*/
-
-//
-// End of "$Id: Fl_Tree_Prefs.H 8340 2011-01-30 20:22:06Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Valuator.H b/Libraries/FL/Fl_Valuator.H
deleted file mode 100644
index 73af078b..00000000
--- a/Libraries/FL/Fl_Valuator.H
+++ /dev/null
@@ -1,144 +0,0 @@
-//
-// "$Id: Fl_Valuator.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Valuator header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Valuator widget . */
-
-#ifndef Fl_Valuator_H
-#define Fl_Valuator_H
-
-#ifndef Fl_Widget_H
-#include "Fl_Widget.H"
-#endif
-
-// shared type() values for classes that work in both directions:
-#define FL_VERTICAL 0 ///< The valuator can work vertically
-#define FL_HORIZONTAL 1 ///< The valuator can work horizontally
-
-/**
- The Fl_Valuator class controls a single floating-point value
- and provides a consistent interface to set the value, range, and step,
- and insures that callbacks are done the same for every object.
- <P>There are probably more of these classes in FLTK than any others:
- <P ALIGN=CENTER>\image html valuators.png</P>
- \image latex valuators.png "Valuators derived from Fl_Valuators" width=10cm
- <P>In the above diagram each box surrounds an actual subclass. These
- are further differentiated by setting the type() of the widget t
- o the symbolic value labeling the widget.
- The ones labelled "0" are the default versions with a type(0).
- For consistency the symbol FL_VERTICAL is defined as zero.
-*/
-class FL_EXPORT Fl_Valuator : public Fl_Widget {
-
- double value_;
- double previous_value_;
- double min, max; // truncates to this range *after* rounding
- double A; int B; // rounds to multiples of A/B, or no rounding if A is zero
-
-protected:
- /** Tells if the valuator is an FL_HORIZONTAL one */
- int horizontal() const {return type()& FL_HORIZONTAL;}
- Fl_Valuator(int X, int Y, int W, int H, const char* L);
-
- /** Gets the previous floating point value before an event changed it */
- double previous_value() const {return previous_value_;}
- /** Stores the current value in the previous value */
- void handle_push() {previous_value_ = value_;}
- double softclamp(double);
- void handle_drag(double newvalue);
- void handle_release(); // use drag() value
- virtual void value_damage(); // cause damage() due to value() changing
- /** Sets the current floating point value. */
- void set_value(double v) {value_ = v;}
-
-public:
-
- /** Sets the minimum (a) and maximum (b) values for the valuator widget. */
- void bounds(double a, double b) {min=a; max=b;}
- /** Gets the minimum value for the valuator. */
- double minimum() const {return min;}
- /** Sets the minimum value for the valuator. */
- void minimum(double a) {min = a;}
- /** Gets the maximum value for the valuator. */
- double maximum() const {return max;}
- /** Sets the maximum value for the valuator. */
- void maximum(double a) {max = a;}
- /**
- Sets the minimum and maximum values for the valuator. When
- the user manipulates the widget, the value is limited to this
- range. This clamping is done <I>after</I> rounding to the step
- value (this makes a difference if the range is not a multiple of
- the step).
-
- <P>The minimum may be greater than the maximum. This has the
- effect of "reversing" the object so the larger values
- are in the opposite direction. This also switches which end of
- the filled sliders is filled.</P>
-
- <P>Some widgets consider this a "soft" range. This
- means they will stop at the range, but if the user releases and
- grabs the control again and tries to move it further, it is
- allowed.</P>
-
- <P>The range may affect the display. You must redraw()
- the widget after changing the range.
- */
- void range(double a, double b) {min = a; max = b;}
- /** See double Fl_Valuator::step() const */
- void step(int a) {A = a; B = 1;}
- /** See double Fl_Valuator::step() const */
- void step(double a, int b) {A = a; B = b;}
- void step(double s);
- /**
- Gets or sets the step value. As the user moves the mouse the
- value is rounded to the nearest multiple of the step value. This
- is done <I>before</I> clamping it to the range. For most widgets
- the default step is zero.
-
- <P>For precision the step is stored as the ratio of two
- integers, A/B. You can set these integers directly. Currently
- setting a floating point value sets the nearest A/1 or 1/B value
- possible.
- */
- double step() const {return A/B;}
- void precision(int);
-
- /** Gets the floating point(double) value. See int value(double) */
- double value() const {return value_;}
- int value(double);
-
- virtual int format(char*);
- double round(double); // round to nearest multiple of step
- double clamp(double); // keep in range
- double increment(double, int); // add n*step to value
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Valuator.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Value_Input.H b/Libraries/FL/Fl_Value_Input.H
deleted file mode 100644
index 47ffcf33..00000000
--- a/Libraries/FL/Fl_Value_Input.H
+++ /dev/null
@@ -1,139 +0,0 @@
-//
-// "$Id: Fl_Value_Input.H 8337 2011-01-30 09:04:59Z manolo $"
-//
-// Value input header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Value_Input widget . */
-
-#ifndef Fl_Value_Input_H
-#define Fl_Value_Input_H
-
-#include "Fl_Valuator.H"
-#include "Fl_Input.H"
-
-/**
- The Fl_Value_Input widget displays a numeric value.
- The user can click in the text field and edit it - there is in
- fact a hidden Fl_Input widget with
- type(FL_FLOAT_INPUT) or type(FL_INT_INPUT) in
- there - and when they hit return or tab the value updates to
- what they typed and the callback is done.
-
- <P>If step() is non-zero and integral, then the range of numbers
- is limited to integers instead of floating point numbers. As
- well as displaying the value as an integer, typed input is also
- limited to integer values, even if the hidden Fl_Input widget
- is of type(FL_FLOAT_INPUT).</P>
-
- <P>If step() is non-zero, the user can also drag the
- mouse across the object and thus slide the value. The left
- button moves one step() per pixel, the middle by 10
- * step(), and the right button by 100 * step(). It
- is therefore impossible to select text by dragging across it,
- although clicking can still move the insertion cursor.</P>
-
- <P>If step() is non-zero and integral, then the range
- of numbers are limited to integers instead of floating point
- values.
-
- <P ALIGN="CENTER">\image html Fl_Value_Input.png
- \image latex Fl_Value_Input.png "Fl_Value_Input" width=4cm
-*/
-class FL_EXPORT Fl_Value_Input : public Fl_Valuator {
-public:
- /* This is the encapsulated Fl_input attribute to which
- this class delegates the value font, color and shortcut */
- Fl_Input input;
-private:
- char soft_;
- static void input_cb(Fl_Widget*,void*);
- virtual void value_damage(); // cause damage() due to value() changing
-public:
- int handle(int);
-protected:
- void draw();
-public:
- void resize(int,int,int,int);
- Fl_Value_Input(int x,int y,int w,int h,const char *l=0);
- ~Fl_Value_Input();
-
- /** See void Fl_Value_Input::soft(char s) */
- void soft(char s) {soft_ = s;}
- /**
- If "soft" is turned on, the user is allowed to drag
- the value outside the range. If they drag the value to one of
- the ends, let go, then grab again and continue to drag, they can
- get to any value. The default is true.
- */
- char soft() const {return soft_;}
- /**
- Returns the current shortcut key for the Input.
- \see Fl_Value_Input::shortcut(int)
- */
- int shortcut() const {return input.shortcut();}
- /**
- Sets the shortcut key to \p s. Setting this
- overrides the use of '&' in the label(). The value is a bitwise
- OR of a key and a set of shift flags, for example FL_ALT | 'a'
- , FL_ALT | (FL_F + 10), or just 'a'. A value
- of 0 disables the shortcut.
-
- The key can be any value returned by
- Fl::event_key(), but will usually be an ASCII letter. Use
- a lower-case letter unless you require the shift key to be held down.
-
- The shift flags can be any set of values accepted by
- Fl::event_state(). If the bit is on that shift key must
- be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in
- the shift flags (zero for the other bits indicates a "don't care"
- setting).
- */
- void shortcut(int s) {input.shortcut(s);}
-
- /** Gets the typeface of the text in the value box. */
- Fl_Font textfont() const {return input.textfont();}
- /** Sets the typeface of the text in the value box. */
- void textfont(Fl_Font s) {input.textfont(s);}
- /** Gets the size of the text in the value box. */
- Fl_Fontsize textsize() const {return input.textsize();}
- /** Sets the size of the text in the value box. */
- void textsize(Fl_Fontsize s) {input.textsize(s);}
- /** Gets the color of the text in the value box. */
- Fl_Color textcolor() const {return input.textcolor();}
- /** Sets the color of the text in the value box.*/
- void textcolor(Fl_Color n) {input.textcolor(n);}
- /** Gets the color of the text cursor. The text cursor is black by default. */
- Fl_Color cursor_color() const {return input.cursor_color();}
- /** Sets the color of the text cursor. The text cursor is black by default. */
- void cursor_color(Fl_Color n) {input.cursor_color(n);}
-
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Value_Input.H 8337 2011-01-30 09:04:59Z manolo $".
-//
diff --git a/Libraries/FL/Fl_Value_Output.H b/Libraries/FL/Fl_Value_Output.H
deleted file mode 100644
index afae308a..00000000
--- a/Libraries/FL/Fl_Value_Output.H
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// "$Id: Fl_Value_Output.H 7989 2010-12-09 12:19:03Z greg.ercolano $"
-//
-// Value output header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Value_Output widget . */
-
-#ifndef Fl_Value_Output_H
-#define Fl_Value_Output_H
-
-#ifndef Fl_Valuator_H
-#include "Fl_Valuator.H"
-#endif
-
-/**
- The Fl_Value_Output widget displays a floating point value.
- If step() is not zero, the user can adjust the value by
- dragging the mouse left and right. The left button moves one step()
- per pixel, the middle by 10 * step(), and the right button by
- 100 * step().
- <P>This is much lighter-weight than
- Fl_Value_Input because it contains no text editing code or
- character buffer. </P>
- <P ALIGN=CENTER>\image html Fl_Value_Output.png
- \image latex Fl_Value_Output.png "Fl_Value_Output" width=4cm
-*/
-class FL_EXPORT Fl_Value_Output : public Fl_Valuator {
- Fl_Font textfont_;
- Fl_Fontsize textsize_;
- uchar soft_;
- Fl_Color textcolor_;
-
-protected:
- void draw();
-
-public:
- int handle(int);
- Fl_Value_Output(int x,int y,int w,int h,const char *l=0);
-
- /**
- If "soft" is turned on, the user is allowed to drag the value outside
- the range. If they drag the value to one of the ends, let go, then
- grab again and continue to drag, they can get to any value. Default is
- one.
- */
- void soft(uchar s) {soft_ = s;}
- /**
- If "soft" is turned on, the user is allowed to drag the value outside
- the range. If they drag the value to one of the ends, let go, then
- grab again and continue to drag, they can get to any value. Default is
- one.
- */
- uchar soft() const {return soft_;}
-
- /** Gets the typeface of the text in the value box. */
- Fl_Font textfont() const {return textfont_;}
- /** Sets the typeface of the text in the value box. */
- void textfont(Fl_Font s) {textfont_ = s;}
- /** Gets the size of the text in the value box. */
- Fl_Fontsize textsize() const {return textsize_;}
- void textsize(Fl_Fontsize s) {textsize_ = s;}
- /** Sets the color of the text in the value box. */
- Fl_Color textcolor() const {return textcolor_;}
- /** Gets the color of the text in the value box. */
- void textcolor(Fl_Color s) {textcolor_ = s;}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Value_Output.H 7989 2010-12-09 12:19:03Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Value_Slider.H b/Libraries/FL/Fl_Value_Slider.H
deleted file mode 100644
index 21a42ff7..00000000
--- a/Libraries/FL/Fl_Value_Slider.H
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// "$Id: Fl_Value_Slider.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
-//
-// Value slider header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Value_Slider widget . */
-
-#ifndef Fl_Value_Slider_H
-#define Fl_Value_Slider_H
-
-#include "Fl_Slider.H"
-
-/**
- The Fl_Value_Slider widget is a Fl_Slider widget
- with a box displaying the current value.
- <P ALIGN=CENTER>\image html value_slider.png
- \image latex value_slider.png "Fl_Value_Slider" width=4cm
-*/
-class FL_EXPORT Fl_Value_Slider : public Fl_Slider {
- Fl_Font textfont_;
- Fl_Fontsize textsize_;
- Fl_Color textcolor_;
-protected:
- void draw();
-public:
- int handle(int);
- Fl_Value_Slider(int x,int y,int w,int h, const char *l = 0);
- /** Gets the typeface of the text in the value box. */
- Fl_Font textfont() const {return textfont_;}
- /** Sets the typeface of the text in the value box. */
- void textfont(Fl_Font s) {textfont_ = s;}
- /** Gets the size of the text in the value box. */
- Fl_Fontsize textsize() const {return textsize_;}
- /** Sets the size of the text in the value box. */
- void textsize(Fl_Fontsize s) {textsize_ = s;}
- /** Gets the color of the text in the value box. */
- Fl_Color textcolor() const {return textcolor_;}
- /** Sets the color of the text in the value box. */
- void textcolor(Fl_Color s) {textcolor_ = s;}
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Value_Slider.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
-//
diff --git a/Libraries/FL/Fl_Widget.H b/Libraries/FL/Fl_Widget.H
deleted file mode 100644
index 780c6cba..00000000
--- a/Libraries/FL/Fl_Widget.H
+++ /dev/null
@@ -1,1006 +0,0 @@
-//
-// "$Id: Fl_Widget.H 8623 2011-04-24 17:09:41Z AlbrechtS $"
-//
-// Widget header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/** \file
- Fl_Widget, Fl_Label classes . */
-
-#ifndef Fl_Widget_H
-#define Fl_Widget_H
-
-#include "Enumerations.H"
-
-/**
- \todo typedef's fl_intptr_t and fl_uintptr_t should be documented.
-*/
-#ifdef _WIN64
-#ifdef __GNUC__
-#include <stdint.h>
-#else
-#include <stddef.h> // M$VC
-#endif
-typedef intptr_t fl_intptr_t;
-typedef uintptr_t fl_uintptr_t;
-#else
-typedef long fl_intptr_t;
-typedef unsigned long fl_uintptr_t;
-#endif
-
-class Fl_Widget;
-class Fl_Window;
-class Fl_Group;
-class Fl_Image;
-
-/** Default callback type definition for all fltk widgets (by far the most used) */
-typedef void (Fl_Callback )(Fl_Widget*, void*);
-/** Default callback type pointer definition for all fltk widgets */
-typedef Fl_Callback* Fl_Callback_p; // needed for BORLAND
-/** One parameter callback type definition passing only the widget */
-typedef void (Fl_Callback0)(Fl_Widget*);
-/** Callback type definition passing the widget and a long data value */
-typedef void (Fl_Callback1)(Fl_Widget*, long);
-
-/** This struct stores all information for a text or mixed graphics label.
-
- \todo For FLTK 1.3, the Fl_Label type will become a widget by itself. That way
- we will be avoiding a lot of code duplication by handling labels in
- a similar fashion to widgets containing text. We also provide an easy
- interface for very complex labels, containing html or vector graphics.
- */
-struct FL_EXPORT Fl_Label {
- /** label text */
- const char* value;
- /** optional image for an active label */
- Fl_Image* image;
- /** optional image for a deactivated label */
- Fl_Image* deimage;
- /** label font used in text */
- Fl_Font font;
- /** size of label font */
- Fl_Fontsize size;
- /** text color */
- Fl_Color color;
- /** alignment of label */
- Fl_Align align_;
- /** type of label. \see Fl_Labeltype */
- uchar type;
-
- /** Draws the label aligned to the given box */
- void draw(int,int,int,int, Fl_Align) const ;
- void measure(int &w, int &h) const ;
-};
-
-
-/** Fl_Widget is the base class for all widgets in FLTK.
-
- You can't create one of these because the constructor is not public.
- However you can subclass it.
-
- All "property" accessing methods, such as color(), parent(), or argument()
- are implemented as trivial inline functions and thus are as fast and small
- as accessing fields in a structure. Unless otherwise noted, the property
- setting methods such as color(n) or label(s) are also trivial inline
- functions, even if they change the widget's appearance. It is up to the
- user code to call redraw() after these.
- */
-class FL_EXPORT Fl_Widget {
- friend class Fl_Group;
-
- Fl_Group* parent_;
- Fl_Callback* callback_;
- void* user_data_;
- int x_,y_,w_,h_;
- Fl_Label label_;
- unsigned int flags_;
- Fl_Color color_;
- Fl_Color color2_;
- uchar type_;
- uchar damage_;
- uchar box_;
- uchar when_;
-
- const char *tooltip_;
-
- /** unimplemented copy ctor */
- Fl_Widget(const Fl_Widget &);
- /** unimplemented assignment operator */
- Fl_Widget& operator=(const Fl_Widget &);
-
-protected:
-
- /** Creates a widget at the given position and size.
-
- The Fl_Widget is a protected constructor, but all derived widgets have a
- matching public constructor. It takes a value for x(), y(), w(), h(), and
- an optional value for label().
-
- \param[in] x, y the position of the widget relative to the enclosing window
- \param[in] w, h size of the widget in pixels
- \param[in] label optional text for the widget label
- */
- Fl_Widget(int x, int y, int w, int h, const char *label=0L);
-
- /** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */
- void x(int v) {x_ = v;}
- /** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */
- void y(int v) {y_ = v;}
- /** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */
- void w(int v) {w_ = v;}
- /** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */
- void h(int v) {h_ = v;}
- /** Gets the widget flags mask */
- unsigned int flags() const {return flags_;}
- /** Sets a flag in the flags mask */
- void set_flag(unsigned int c) {flags_ |= c;}
- /** Clears a flag in the flags mask */
- void clear_flag(unsigned int c) {flags_ &= ~c;}
- /** flags possible values enumeration.
- See activate(), output(), visible(), changed(), set_visible_focus()
- */
- enum {
- INACTIVE = 1<<0, ///< the widget can't receive focus, and is disabled but potentially visible
- INVISIBLE = 1<<1, ///< the widget is not drawn, but can receive a few special events
- OUTPUT = 1<<2, ///< for output only
- NOBORDER = 1<<3, ///< don't draw a decoration (Fl_Window)
- FORCE_POSITION = 1<<4, ///< don't let the window manager position the window (Fl_Window)
- NON_MODAL = 1<<5, ///< this is a hovering toolbar window (Fl_Window)
- SHORTCUT_LABEL = 1<<6, ///< the label contains a shortcut we need to draw
- CHANGED = 1<<7, ///< the widget value changed
- OVERRIDE = 1<<8, ///< position window on top (Fl_Window)
- VISIBLE_FOCUS = 1<<9, ///< accepts keyboard focus navigation if the widget can have the focus
- COPIED_LABEL = 1<<10, ///< the widget label is internally copied, its destruction is handled by the widget
- CLIP_CHILDREN = 1<<11, ///< all drawing within this widget will be clipped (Fl_Group)
- MENU_WINDOW = 1<<12, ///< a temporary popup window, dismissed by clicking outside (Fl_Window)
- TOOLTIP_WINDOW = 1<<13, ///< a temporary popup, transparent to events, and dismissed easily (Fl_Window)
- MODAL = 1<<14, ///< a window blocking input to all other winows (Fl_Window)
- NO_OVERLAY = 1<<15, ///< window not using a hardware overlay plane (Fl_Menu_Window)
- GROUP_RELATIVE = 1<<16, ///< position this widget relative to the parent group, not to the window
- COPIED_TOOLTIP = 1<<17, ///< the widget tooltip is internally copied, its destruction is handled by the widget
- // (space for more flags)
- USERFLAG3 = 1<<29, ///< reserved for 3rd party extensions
- USERFLAG2 = 1<<30, ///< reserved for 3rd party extensions
- USERFLAG1 = 1<<31 ///< reserved for 3rd party extensions
- };
- void draw_box() const;
- void draw_box(Fl_Boxtype t, Fl_Color c) const;
- void draw_box(Fl_Boxtype t, int x,int y,int w,int h, Fl_Color c) const;
- void draw_backdrop() const;
- /** draws a focus rectangle around the widget */
- void draw_focus() {draw_focus(box(),x(),y(),w(),h());}
- void draw_focus(Fl_Boxtype t, int x,int y,int w,int h) const;
- void draw_label() const;
- void draw_label(int, int, int, int) const;
-
-public:
-
- /** Destroys the widget.
- Destroying single widgets is not very common. You almost always want to
- destroy the parent group instead, which will destroy all of the child widgets
- and groups in that group.
-
- \since FLTK 1.3, the widget's destructor removes the widget from its parent
- group, if it is member of a group.
- */
- virtual ~Fl_Widget();
-
- /** Draws the widget.
- Never call this function directly. FLTK will schedule redrawing whenever
- needed. If your widget must be redrawn as soon as possible, call redraw()
- instead.
-
- Override this function to draw your own widgets.
-
- If you ever need to call another widget's draw method <I>from within your
- own draw() method</I>, e.g. for an embedded scrollbar, you can do it
- (because draw() is virtual) like this:
-
- \code
- Fl_Widget *s = &scroll; // scroll is an embedded Fl_Scrollbar
- s->draw(); // calls Fl_Scrollbar::draw()
- \endcode
- */
- virtual void draw() = 0;
-
- /** Handles the specified event.
- You normally don't call this method directly, but instead let FLTK do
- it when the user interacts with the widget.
-
- When implemented in a widget, this function must return 0 if the
- widget does not use the event or 1 otherwise.
-
- Most of the time, you want to call the inherited handle() method in
- your overridden method so that you don't short-circuit events that you
- don't handle. In this last case you should return the callee retval.
-
- \param[in] event the kind of event received
- \retval 0 if the event was not used or understood
- \retval 1 if the event was used and can be deleted
- \see Fl_Event
- */
- virtual int handle(int event);
-
- /** Returns a pointer to the parent widget.
- Usually this is a Fl_Group or Fl_Window.
- \retval NULL if the widget has no parent
- \see Fl_Group::add(Fl_Widget*)
- */
- Fl_Group* parent() const {return parent_;}
-
- /** Internal use only - "for hacks only".
-
- It is \em \b STRONGLY recommended not to use this method, because it
- short-circuits Fl_Group's normal widget adding and removing methods,
- if the widget is already a child widget of another Fl_Group.
-
- Use Fl_Group::add(Fl_Widget*) and/or Fl_Group::remove(Fl_Widget*) instead.
- */
- void parent(Fl_Group* p) {parent_ = p;} // for hacks only, use Fl_Group::add()
-
- /** Gets the widget type.
- Returns the widget type value, which is used for Forms compatibility
- and to simulate RTTI.
-
- \todo Explain "simulate RTTI" (currently only used to decide if a widget
- is a window, i.e. type()>=FL_WINDOW ?). Is type() really used in a way
- that ensures "Forms compatibility" ?
- */
- uchar type() const {return type_;}
-
- /** Sets the widget type.
- This is used for Forms compatibility.
- */
- void type(uchar t) {type_ = t;}
-
- /** Gets the widget position in its window.
- \return the x position relative to the window
- */
- int x() const {return x_;}
-
- /** Gets the widget position in its window.
- \return the y position relative to the window
- */
- int y() const {return y_;}
-
- /** Gets the widget width.
- \return the width of the widget in pixels.
- */
- int w() const {return w_;}
-
- /** Gets the widget height.
- \return the height of the widget in pixels.
- */
- int h() const {return h_;}
-
- /** Changes the size or position of the widget.
-
- This is a virtual function so that the widget may implement its
- own handling of resizing. The default version does \e not
- call the redraw() method, but instead relies on the parent widget
- to do so because the parent may know a faster way to update the
- display, such as scrolling from the old position.
-
- Some window managers under X11 call resize() a lot more often
- than needed. Please verify that the position or size of a widget
- did actually change before doing any extensive calculations.
-
- position(X, Y) is a shortcut for resize(X, Y, w(), h()),
- and size(W, H) is a shortcut for resize(x(), y(), W, H).
-
- \param[in] x, y new position relative to the parent window
- \param[in] w, h new size
- \see position(int,int), size(int,int)
- */
- virtual void resize(int x, int y, int w, int h);
-
- /** Internal use only. */
- int damage_resize(int,int,int,int);
-
- /** Repositions the window or widget.
-
- position(X, Y) is a shortcut for resize(X, Y, w(), h()).
-
- \param[in] X, Y new position relative to the parent window
- \see resize(int,int,int,int), size(int,int)
- */
- void position(int X,int Y) {resize(X,Y,w_,h_);}
-
- /** Changes the size of the widget.
-
- size(W, H) is a shortcut for resize(x(), y(), W, H).
-
- \param[in] W, H new size
- \see position(int,int), resize(int,int,int,int)
- */
- void size(int W,int H) {resize(x_,y_,W,H);}
-
- /** Gets the label alignment.
-
- \return label alignment
- \see label(), align(Fl_Align), Fl_Align
- */
- Fl_Align align() const {return label_.align_;}
-
- /** Sets the label alignment.
- This controls how the label is displayed next to or inside the widget.
- The default value is FL_ALIGN_CENTER, which centers the label inside
- the widget.
- \param[in] alignment new label alignment
- \see align(), Fl_Align
- */
- void align(Fl_Align alignment) {label_.align_ = alignment;}
-
- /** Gets the box type of the widget.
- \return the current box type
- \see box(Fl_Boxtype), Fl_Boxtype
- */
- Fl_Boxtype box() const {return (Fl_Boxtype)box_;}
-
- /** Sets the box type for the widget.
- This identifies a routine that draws the background of the widget.
- See Fl_Boxtype for the available types. The default depends on the
- widget, but is usually FL_NO_BOX or FL_UP_BOX.
- \param[in] new_box the new box type
- \see box(), Fl_Boxtype
- */
- void box(Fl_Boxtype new_box) {box_ = new_box;}
-
- /** Gets the background color of the widget.
- \return current background color
- \see color(Fl_Color), color(Fl_Color, Fl_Color)
- */
- Fl_Color color() const {return color_;}
-
- /** Sets the background color of the widget.
- The color is passed to the box routine. The color is either an index into
- an internal table of RGB colors or an RGB color value generated using
- fl_rgb_color().
-
- The default for most widgets is FL_BACKGROUND_COLOR. Use Fl::set_color()
- to redefine colors in the color map.
- \param[in] bg background color
- \see color(), color(Fl_Color, Fl_Color), selection_color(Fl_Color)
- */
- void color(Fl_Color bg) {color_ = bg;}
-
- /** Gets the selection color.
- \return the current selection color
- \see selection_color(Fl_Color), color(Fl_Color, Fl_Color)
- */
- Fl_Color selection_color() const {return color2_;}
-
- /** Sets the selection color.
- The selection color is defined for Forms compatibility and is usually
- used to color the widget when it is selected, although some widgets
- use this color for other purposes. You can set both colors at once
- with color(Fl_Color bg, Fl_Color sel).
- \param[in] a the new selection color
- \see selection_color(), color(Fl_Color, Fl_Color)
- */
- void selection_color(Fl_Color a) {color2_ = a;}
-
- /** Sets the background and selection color of the widget.
-
- The two color form sets both the background and selection colors.
- \param[in] bg background color
- \param[in] sel selection color
- \see color(unsigned), selection_color(unsigned)
- */
- void color(Fl_Color bg, Fl_Color sel) {color_=bg; color2_=sel;}
-
- /** Gets the current label text.
- \return a pointer to the current label text
- \see label(const char *), copy_label(const char *)
- */
- const char* label() const {return label_.value;}
-
- /** Sets the current label pointer.
-
- The label is shown somewhere on or next to the widget. The passed pointer
- is stored unchanged in the widget (the string is \em not copied), so if
- you need to set the label to a formatted value, make sure the buffer is
- static, global, or allocated. The copy_label() method can be used
- to make a copy of the label string automatically.
- \param[in] text pointer to new label text
- \see copy_label()
- */
- void label(const char* text);
-
- /** Sets the current label.
- Unlike label(), this method allocates a copy of the label
- string instead of using the original string pointer.
-
- The internal copy will automatically be freed whenever you assign
- a new label or when the widget is destroyed.
-
- \param[in] new_label the new label text
- \see label()
- */
- void copy_label(const char *new_label);
-
- /** Shortcut to set the label text and type in one call.
- \see label(const char *), labeltype(Fl_Labeltype)
- */
- void label(Fl_Labeltype a, const char* b) {label_.type = a; label_.value = b;}
-
- /** Gets the label type.
- \return the current label type.
- \see Fl_Labeltype
- */
- Fl_Labeltype labeltype() const {return (Fl_Labeltype)label_.type;}
-
- /** Sets the label type.
- The label type identifies the function that draws the label of the widget.
- This is generally used for special effects such as embossing or for using
- the label() pointer as another form of data such as an icon. The value
- FL_NORMAL_LABEL prints the label as plain text.
- \param[in] a new label type
- \see Fl_Labeltype
- */
- void labeltype(Fl_Labeltype a) {label_.type = a;}
-
- /** Gets the label color.
- The default color is FL_FOREGROUND_COLOR.
- \return the current label color
- */
- Fl_Color labelcolor() const {return label_.color;}
-
- /** Sets the label color.
- The default color is FL_FOREGROUND_COLOR.
- \param[in] c the new label color
- */
- void labelcolor(Fl_Color c) {label_.color=c;}
-
- /** Gets the font to use.
- Fonts are identified by indexes into a table. The default value
- uses a Helvetica typeface (Arial for Microsoft&reg; Windows&reg;).
- The function Fl::set_font() can define new typefaces.
- \return current font used by the label
- \see Fl_Font
- */
- Fl_Font labelfont() const {return label_.font;}
-
- /** Sets the font to use.
- Fonts are identified by indexes into a table. The default value
- uses a Helvetica typeface (Arial for Microsoft&reg; Windows&reg;).
- The function Fl::set_font() can define new typefaces.
- \param[in] f the new font for the label
- \see Fl_Font
- */
- void labelfont(Fl_Font f) {label_.font=f;}
-
- /** Gets the font size in pixels.
- The default size is 14 pixels.
- \return the current font size
- */
- Fl_Fontsize labelsize() const {return label_.size;}
-
- /** Sets the font size in pixels.
- \param[in] pix the new font size
- \see Fl_Fontsize labelsize()
- */
- void labelsize(Fl_Fontsize pix) {label_.size=pix;}
-
- /** Gets the image that is used as part of the widget label.
- This image is used when drawing the widget in the active state.
- \return the current image
- */
- Fl_Image* image() {return label_.image;}
- const Fl_Image* image() const {return label_.image;}
-
- /** Sets the image to use as part of the widget label.
- This image is used when drawing the widget in the active state.
- \param[in] img the new image for the label
- */
- void image(Fl_Image* img) {label_.image=img;}
-
- /** Sets the image to use as part of the widget label.
- This image is used when drawing the widget in the active state.
- \param[in] img the new image for the label
- */
- void image(Fl_Image& img) {label_.image=&img;}
-
- /** Gets the image that is used as part of the widget label.
- This image is used when drawing the widget in the inactive state.
- \return the current image for the deactivated widget
- */
- Fl_Image* deimage() {return label_.deimage;}
- const Fl_Image* deimage() const {return label_.deimage;}
-
- /** Sets the image to use as part of the widget label.
- This image is used when drawing the widget in the inactive state.
- \param[in] img the new image for the deactivated widget
- */
- void deimage(Fl_Image* img) {label_.deimage=img;}
-
- /** Sets the image to use as part of the widget label.
- This image is used when drawing the widget in the inactive state.
- \param[in] img the new image for the deactivated widget
- */
- void deimage(Fl_Image& img) {label_.deimage=&img;}
-
- /** Gets the current tooltip text.
- \return a pointer to the tooltip text or NULL
- \see tooltip(const char*), copy_tooltip(const char*)
- */
- const char *tooltip() const {return tooltip_;}
-
- void tooltip(const char *text); // see Fl_Tooltip
- void copy_tooltip(const char *text); // see Fl_Tooltip
-
- /** Gets the current callback function for the widget.
- Each widget has a single callback.
- \return current callback
- */
- Fl_Callback_p callback() const {return callback_;}
-
- /** Sets the current callback function for the widget.
- Each widget has a single callback.
- \param[in] cb new callback
- \param[in] p user data
- */
- void callback(Fl_Callback* cb, void* p) {callback_=cb; user_data_=p;}
-
- /** Sets the current callback function for the widget.
- Each widget has a single callback.
- \param[in] cb new callback
- */
- void callback(Fl_Callback* cb) {callback_=cb;}
-
- /** Sets the current callback function for the widget.
- Each widget has a single callback.
- \param[in] cb new callback
- */
- void callback(Fl_Callback0*cb) {callback_=(Fl_Callback*)cb;}
-
- /** Sets the current callback function for the widget.
- Each widget has a single callback.
- \param[in] cb new callback
- \param[in] p user data
- */
- void callback(Fl_Callback1*cb, long p=0) {callback_=(Fl_Callback*)cb; user_data_=(void*)p;}
-
- /** Gets the user data for this widget.
- Gets the current user data (void *) argument that is passed to the callback function.
- \return user data as a pointer
- */
- void* user_data() const {return user_data_;}
-
- /** Sets the user data for this widget.
- Sets the new user data (void *) argument that is passed to the callback function.
- \param[in] v new user data
- */
- void user_data(void* v) {user_data_ = v;}
-
- /** Gets the current user data (long) argument that is passed to the callback function.
- */
- long argument() const {return (long)(fl_intptr_t)user_data_;}
-
- /** Sets the current user data (long) argument that is passed to the callback function.
- \todo The user data value must be implemented using \em intptr_t or similar
- to avoid 64-bit machine incompatibilities.
- */
- void argument(long v) {user_data_ = (void*)v;}
-
- /** Returns the conditions under which the callback is called.
-
- You can set the flags with when(uchar), the default value is
- FL_WHEN_RELEASE.
-
- \return set of flags
- \see when(uchar)
- */
- Fl_When when() const {return (Fl_When)when_;}
-
- /** Sets the flags used to decide when a callback is called.
-
- This controls when callbacks are done. The following values are useful,
- the default value is FL_WHEN_RELEASE:
-
- \li 0: The callback is not done, but changed() is turned on.
- \li FL_WHEN_CHANGED: The callback is done each time the text is
- changed by the user.
- \li FL_WHEN_RELEASE: The callback will be done when this widget loses
- the focus, including when the window is unmapped. This is a useful
- value for text fields in a panel where doing the callback on every
- change is wasteful. However the callback will also happen if the
- mouse is moved out of the window, which means it should not do
- anything visible (like pop up an error message).
- You might do better setting this to zero, and scanning all the
- items for changed() when the OK button on a panel is pressed.
- \li FL_WHEN_ENTER_KEY: If the user types the Enter key, the entire
- text is selected, and the callback is done if the text has changed.
- Normally the Enter key will navigate to the next field (or insert
- a newline for a Fl_Multiline_Input) - this changes the behavior.
- \li FL_WHEN_ENTER_KEY|FL_WHEN_NOT_CHANGED: The Enter key will do the
- callback even if the text has not changed. Useful for command fields.
- Fl_Widget::when() is a set of bitflags used by subclasses of
- Fl_Widget to decide when to do the callback.
-
- If the value is zero then the callback is never done. Other values
- are described in the individual widgets. This field is in the base
- class so that you can scan a panel and do_callback() on all the ones
- that don't do their own callbacks in response to an "OK" button.
- \param[in] i set of flags
- */
- void when(uchar i) {when_ = i;}
-
- /** Returns whether a widget is visible.
- \retval 0 if the widget is not drawn and hence invisible.
- \see show(), hide(), visible_r()
- */
- unsigned int visible() const {return !(flags_&INVISIBLE);}
-
- /** Returns whether a widget and all its parents are visible.
- \retval 0 if the widget or any of its parents are invisible.
- \see show(), hide(), visible()
- */
- int visible_r() const;
-
- /** Makes a widget visible.
-
- An invisible widget never gets redrawn and does not get keyboard
- or mouse events, but can receive a few other events like FL_SHOW.
-
- The visible() method returns true if the widget is set to be
- visible. The visible_r() method returns true if the widget and
- all of its parents are visible. A widget is only visible if
- visible() is true on it <I>and all of its parents</I>.
-
- Changing it will send FL_SHOW or FL_HIDE events to the widget.
- <I>Do not change it if the parent is not visible, as this
- will send false FL_SHOW or FL_HIDE events to the widget</I>.
- redraw() is called if necessary on this or the parent.
-
- \see hide(), visible(), visible_r()
- */
- virtual void show();
-
- /** Makes a widget invisible.
- \see show(), visible(), visible_r()
- */
- virtual void hide();
-
- /** Makes the widget visible.
- You must still redraw the parent widget to see a change in the
- window. Normally you want to use the show() method instead.
- */
- void set_visible() {flags_ &= ~INVISIBLE;}
-
- /** Hides the widget.
- You must still redraw the parent to see a change in the window.
- Normally you want to use the hide() method instead.
- */
- void clear_visible() {flags_ |= INVISIBLE;}
-
- /** Returns whether the widget is active.
- \retval 0 if the widget is inactive
- \see active_r(), activate(), deactivate()
- */
- unsigned int active() const {return !(flags_&INACTIVE);}
-
- /** Returns whether the widget and all of its parents are active.
- \retval 0 if this or any of the parent widgets are inactive
- \see active(), activate(), deactivate()
- */
- int active_r() const;
-
- /** Activates the widget.
- Changing this value will send FL_ACTIVATE to the widget if
- active_r() is true.
- \see active(), active_r(), deactivate()
- */
- void activate();
-
- /** Deactivates the widget.
- Inactive widgets will be drawn "grayed out", e.g. with less contrast
- than the active widget. Inactive widgets will not receive any keyboard
- or mouse button events. Other events (including FL_ENTER, FL_MOVE,
- FL_LEAVE, FL_SHORTCUT, and others) will still be sent. A widget is
- only active if active() is true on it <I>and all of its parents</I>.
-
- Changing this value will send FL_DEACTIVATE to the widget if
- active_r() is true.
-
- Currently you cannot deactivate Fl_Window widgets.
-
- \see activate(), active(), active_r()
- */
- void deactivate();
-
- /** Returns if a widget is used for output only.
- output() means the same as !active() except it does not change how the
- widget is drawn. The widget will not receive any events. This is useful
- for making scrollbars or buttons that work as displays rather than input
- devices.
- \retval 0 if the widget is used for input and output
- \see set_output(), clear_output()
- */
- unsigned int output() const {return (flags_&OUTPUT);}
-
- /** Sets a widget to output only.
- \see output(), clear_output()
- */
- void set_output() {flags_ |= OUTPUT;}
-
- /** Sets a widget to accept input.
- \see set_output(), output()
- */
- void clear_output() {flags_ &= ~OUTPUT;}
-
- /** Returns if the widget is able to take events.
- This is the same as (active() && !output() && visible())
- but is faster.
- \retval 0 if the widget takes no events
- */
- unsigned int takesevents() const {return !(flags_&(INACTIVE|INVISIBLE|OUTPUT));}
-
- /**
- Checks if the widget value changed since the last callback.
-
- "Changed" is a flag that is turned on when the user changes the value
- stored in the widget. This is only used by subclasses of Fl_Widget that
- store values, but is in the base class so it is easier to scan all the
- widgets in a panel and do_callback() on the changed ones in response
- to an "OK" button.
-
- Most widgets turn this flag off when they do the callback, and when
- the program sets the stored value.
-
- \retval 0 if the value did not change
- \see set_changed(), clear_changed()
- */
- unsigned int changed() const {return flags_&CHANGED;}
-
- /** Marks the value of the widget as changed.
- \see changed(), clear_changed()
- */
- void set_changed() {flags_ |= CHANGED;}
-
- /** Marks the value of the widget as unchanged.
- \see changed(), set_changed()
- */
- void clear_changed() {flags_ &= ~CHANGED;}
-
- /** Gives the widget the keyboard focus.
- Tries to make this widget be the Fl::focus() widget, by first sending
- it an FL_FOCUS event, and if it returns non-zero, setting
- Fl::focus() to this widget. You should use this method to
- assign the focus to a widget.
- \return true if the widget accepted the focus.
- */
- int take_focus();
-
- /** Enables keyboard focus navigation with this widget.
- Note, however, that this will not necessarily mean that the widget
- will accept focus, but for widgets that can accept focus, this method
- enables it if it has been disabled.
- \see visible_focus(), clear_visible_focus(), visible_focus(int)
- */
- void set_visible_focus() { flags_ |= VISIBLE_FOCUS; }
-
- /** Disables keyboard focus navigation with this widget.
- Normally, all widgets participate in keyboard focus navigation.
- \see set_visible_focus(), visible_focus(), visible_focus(int)
- */
- void clear_visible_focus() { flags_ &= ~VISIBLE_FOCUS; }
-
- /** Modifies keyboard focus navigation.
- \param[in] v set or clear visible focus
- \see set_visible_focus(), clear_visible_focus(), visible_focus()
- */
- void visible_focus(int v) { if (v) set_visible_focus(); else clear_visible_focus(); }
-
- /** Checks whether this widget has a visible focus.
- \retval 0 if this widget has no visible focus.
- \see visible_focus(int), set_visible_focus(), clear_visible_focus()
- */
- unsigned int visible_focus() { return flags_ & VISIBLE_FOCUS; }
-
- /** Sets the default callback for all widgets.
- Sets the default callback, which puts a pointer to the widget on the queue
- returned by Fl::readqueue(). You may want to call this from your own callback.
- \param[in] cb the new callback
- \param[in] d user data associated with that callback
- \see callback(), do_callback(), Fl::readqueue()
- */
- static void default_callback(Fl_Widget *cb, void *d);
-
- /** Calls the widget callback.
- Causes a widget to invoke its callback function with default arguments.
- \see callback()
- */
- void do_callback() {do_callback(this,user_data_);}
-
- /** Calls the widget callback.
- Causes a widget to invoke its callback function with arbitrary arguments.
- \param[in] o call the callback with \p o as the widget argument
- \param[in] arg call the callback with \p arg as the user data argument
- \see callback()
- */
- void do_callback(Fl_Widget* o,long arg) {do_callback(o,(void*)arg);}
-
- // Causes a widget to invoke its callback function with arbitrary arguments.
- // Documentation and implementation in Fl_Widget.cxx
- void do_callback(Fl_Widget* o,void* arg=0);
-
- /* Internal use only. */
- int test_shortcut();
- /* Internal use only. */
- static unsigned int label_shortcut(const char *t);
- /* Internal use only. */
- static int test_shortcut(const char*, const bool require_alt = false);
-
- /** Checks if w is a child of this widget.
- \param[in] w potential child widget
- \return Returns 1 if \p w is a child of this widget, or is
- equal to this widget. Returns 0 if \p w is NULL.
- */
- int contains(const Fl_Widget *w) const ;
-
- /** Checks if this widget is a child of w.
- Returns 1 if this widget is a child of \p w, or is
- equal to \p w. Returns 0 if \p w is NULL.
- \param[in] w the possible parent widget.
- \see contains()
- */
- int inside(const Fl_Widget* w) const {return w ? w->contains(this) : 0;}
-
- /** Schedules the drawing of the widget.
- Marks the widget as needing its draw() routine called.
- */
- void redraw();
-
- /** Schedules the drawing of the label.
- Marks the widget or the parent as needing a redraw for the label area
- of a widget.
- */
- void redraw_label();
-
- /** Returns non-zero if draw() needs to be called.
- The damage value is actually a bit field that the widget
- subclass can use to figure out what parts to draw.
- \return a bitmap of flags describing the kind of damage to the widget
- \see damage(uchar), clear_damage(uchar)
- */
- uchar damage() const {return damage_;}
-
- /** Clears or sets the damage flags.
- Damage flags are cleared when parts of the widget drawing is repaired.
-
- The optional argument \p c specifies the bits that <b>are set</b>
- after the call (default: 0) and \b not the bits that are cleared!
-
- \note Therefore it is possible to set damage bits with this method, but
- this should be avoided. Use damage(uchar) instead.
-
- \param[in] c new bitmask of damage flags (default: 0)
- \see damage(uchar), damage()
- */
- void clear_damage(uchar c = 0) {damage_ = c;}
-
- /** Sets the damage bits for the widget.
- Setting damage bits will schedule the widget for the next redraw.
- \param[in] c bitmask of flags to set
- \see damage(), clear_damage(uchar)
- */
- void damage(uchar c);
-
- /** Sets the damage bits for an area inside the widget.
- Setting damage bits will schedule the widget for the next redraw.
- \param[in] c bitmask of flags to set
- \param[in] x, y, w, h size of damaged area
- \see damage(), clear_damage(uchar)
- */
- void damage(uchar c, int x, int y, int w, int h);
-
- void draw_label(int, int, int, int, Fl_Align) const;
-
- /** Sets width ww and height hh accordingly with the label size.
- Labels with images will return w() and h() of the image.
- */
- void measure_label(int& ww, int& hh) const {label_.measure(ww, hh);}
-
- /** Returns a pointer to the primary Fl_Window widget.
- \retval NULL if no window is associated with this widget.
- \note for an Fl_Window widget, this returns its <I>parent</I> window
- (if any), not <I>this</I> window.
- */
- Fl_Window* window() const ;
-
- /** Returns an Fl_Group pointer if this widget is an Fl_Group.
-
- Use this method if you have a widget (pointer) and need to
- know whether this widget is derived from Fl_Group. If it returns
- non-NULL, then the widget in question is derived from Fl_Group,
- and you can use the returned pointer to access its children
- or other Fl_Group-specific methods.
-
- Example:
- \code
- void my_callback (Fl_Widget *w, void *) {
- Fl_Group *g = w->as_group();
- if (g)
- printf ("This group has %d children\n",g->children());
- else
- printf ("This widget is not a group!\n");
- }
- \endcode
-
- \retval NULL if this widget is not derived from Fl_Group.
- \note This method is provided to avoid dynamic_cast.
- \see Fl_Widget::as_window(), Fl_Widget::as_gl_window()
- */
- virtual Fl_Group* as_group() {return 0;}
-
- /** Returns an Fl_Window pointer if this widget is an Fl_Window.
-
- Use this method if you have a widget (pointer) and need to
- know whether this widget is derived from Fl_Window. If it returns
- non-NULL, then the widget in question is derived from Fl_Window,
- and you can use the returned pointer to access its children
- or other Fl_Window-specific methods.
-
- \retval NULL if this widget is not derived from Fl_Window.
- \note This method is provided to avoid dynamic_cast.
- \see Fl_Widget::as_group(), Fl_Widget::as_gl_window()
- */
- virtual Fl_Window* as_window() {return 0;}
-
- /** Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window.
-
- Use this method if you have a widget (pointer) and need to
- know whether this widget is derived from Fl_Gl_Window. If it returns
- non-NULL, then the widget in question is derived from Fl_Gl_Window.
-
- \retval NULL if this widget is not derived from Fl_Gl_Window.
- \note This method is provided to avoid dynamic_cast.
- \see Fl_Widget::as_group(), Fl_Widget::as_window()
- */
- virtual class Fl_Gl_Window* as_gl_window() {return 0;}
-
- /** For back compatibility only.
- \deprecated Use selection_color() instead.
- */
- Fl_Color color2() const {return (Fl_Color)color2_;}
-
- /** For back compatibility only.
- \deprecated Use selection_color(unsigned) instead.
- */
- void color2(unsigned a) {color2_ = a;}
-};
-
-/**
- Reserved type numbers (necessary for my cheapo RTTI) start here.
- Grep the header files for "RESERVED_TYPE" to find the next available
- number.
-*/
-#define FL_RESERVED_TYPE 100
-
-#endif
-
-//
-// End of "$Id: Fl_Widget.H 8623 2011-04-24 17:09:41Z AlbrechtS $".
-//
diff --git a/Libraries/FL/Fl_Window.H b/Libraries/FL/Fl_Window.H
deleted file mode 100644
index 8317fb4a..00000000
--- a/Libraries/FL/Fl_Window.H
+++ /dev/null
@@ -1,465 +0,0 @@
-//
-// "$Id: Fl_Window.H 8593 2011-04-15 21:38:05Z manolo $"
-//
-// Window header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Window widget . */
-
-#ifndef Fl_Window_H
-#define Fl_Window_H
-
-#include "Fl_Group.H"
-
-#define FL_WINDOW 0xF0 ///< window type id all subclasses have type() >= this
-#define FL_DOUBLE_WINDOW 0xF1 ///< double window type id
-
-class Fl_X;
-
-/**
- This widget produces an actual window. This can either be a main
- window, with a border and title and all the window management controls,
- or a "subwindow" inside a window. This is controlled by whether or not
- the window has a parent().
-
- Once you create a window, you usually add children Fl_Widget
- 's to it by using window->add(child) for each new widget.
- See Fl_Group for more information on how to add and remove children.
-
- There are several subclasses of Fl_Window that provide
- double-buffering, overlay, menu, and OpenGL support.
-
- The window's callback is done if the user tries to close a window
- using the window manager and Fl::modal() is zero or equal to the
- window. Fl_Window has a default callback that calls Fl_Window::hide().
-*/
-class FL_EXPORT Fl_Window : public Fl_Group {
-
- static char *default_xclass_;
-
- friend class Fl_X;
- Fl_X *i; // points at the system-specific stuff
-
- const char* iconlabel_;
- char* xclass_;
- const void* icon_;
- // size_range stuff:
- int minw, minh, maxw, maxh;
- int dw, dh, aspect;
- uchar size_range_set;
- // cursor stuff
- Fl_Cursor cursor_default;
- Fl_Color cursor_fg, cursor_bg;
- void size_range_();
- void _Fl_Window(); // constructor innards
-
- // unimplemented copy ctor and assignment operator
- Fl_Window(const Fl_Window&);
- Fl_Window& operator=(const Fl_Window&);
-
-protected:
-
- /** Stores the last window that was made current. See current() const */
- static Fl_Window *current_;
- virtual void draw();
- /** Forces the window to be drawn, this window is also made current and calls draw(). */
- virtual void flush();
-
- /**
- Sets an internal flag that tells FLTK and the window manager to
- honor position requests.
-
- This is used internally and should not be needed by user code.
-
- \param[in] force 1 to set the FORCE_POSITION flag, 0 to clear it
- */
- void force_position(int force) {
- if (force) set_flag(FORCE_POSITION);
- else clear_flag(FORCE_POSITION);
- }
- /**
- Returns the internal state of the window's FORCE_POSITION flag.
-
- \retval 1 if flag is set
- \retval 0 otherwise
-
- \see force_position(int)
- */
- int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
-
-public:
-
- /**
- Creates a window from the given size and title.
- If Fl_Group::current() is not NULL, the window is created as a
- subwindow of the parent window.
-
- The (w,h) form of the constructor creates a top-level window
- and asks the window manager to position the window. The (x,y,w,h)
- form of the constructor either creates a subwindow or a
- top-level window at the specified location (x,y) , subject to window
- manager configuration. If you do not specify the position of the
- window, the window manager will pick a place to show the window
- or allow the user to pick a location. Use position(x,y)
- or hotspot() before calling show() to request a
- position on the screen. See Fl_Window::resize()
- for some more details on positioning windows.
-
- Top-level windows initially have visible() set to 0
- and parent() set to NULL. Subwindows initially
- have visible() set to 1 and parent() set to
- the parent window pointer.
-
- Fl_Widget::box() defaults to FL_FLAT_BOX. If you plan to
- completely fill the window with children widgets you should
- change this to FL_NO_BOX. If you turn the window border off
- you may want to change this to FL_UP_BOX.
-
- \see Fl_Window(int x, int y, int w, int h, const char* title)
- */
- Fl_Window(int w, int h, const char* title= 0);
- /** Creates a window from the given position, size and title.
-
- \see Fl_Window(int w, int h, const char *title)
- */
- Fl_Window(int x, int y, int w, int h, const char* title = 0);
- /**
- The destructor <I>also deletes all the children</I>. This allows a
- whole tree to be deleted at once, without having to keep a pointer to
- all the children in the user code. A kludge has been done so the
- Fl_Window and all of its children can be automatic (local)
- variables, but you must declare the Fl_Window <I>first</I> so
- that it is destroyed last.
- */
- virtual ~Fl_Window();
-
- virtual int handle(int);
-
- /**
- Changes the size and position of the window. If shown() is true,
- these changes are communicated to the window server (which may
- refuse that size and cause a further resize). If shown() is
- false, the size and position are used when show() is called.
- See Fl_Group for the effect of resizing on the child widgets.
-
- You can also call the Fl_Widget methods size(x,y) and position(w,h),
- which are inline wrappers for this virtual function.
-
- A top-level window can not force, but merely suggest a position and
- size to the operating system. The window manager may not be willing or
- able to display a window at the desired position or with the given
- dimensions. It is up to the application developer to verify window
- parameters after the resize request.
- */
- virtual void resize(int,int,int,int);
- /**
- Sets whether or not the window manager border is around the
- window. The default value is true. void border(int) can be
- used to turn the border on and off. <I>Under most X window
- managers this does not work after show() has been called,
- although SGI's 4DWM does work.</I>
- */
- void border(int b);
- /**
- Fast inline function to turn the window manager border
- off. It only works before show() is called.
- */
- void clear_border() {set_flag(NOBORDER);}
- /** See void Fl_Window::border(int) */
- unsigned int border() const {return !(flags() & NOBORDER);}
- /** Activates the flags NOBORDER|FL_OVERRIDE */
- void set_override() {set_flag(NOBORDER|OVERRIDE);}
- /** Returns non zero if FL_OVERRIDE flag is set, 0 otherwise. */
- unsigned int override() const { return flags()&OVERRIDE; }
- /**
- A "modal" window, when shown(), will prevent any events from
- being delivered to other windows in the same program, and will also
- remain on top of the other windows (if the X window manager supports
- the "transient for" property). Several modal windows may be shown at
- once, in which case only the last one shown gets events. You can see
- which window (if any) is modal by calling Fl::modal().
- */
- void set_modal() {set_flag(MODAL);}
- /** Returns true if this window is modal. */
- unsigned int modal() const {return flags() & MODAL;}
- /**
- A "non-modal" window (terminology borrowed from Microsoft Windows)
- acts like a modal() one in that it remains on top, but it has
- no effect on event delivery. There are <I>three</I> states for a
- window: modal, non-modal, and normal.
- */
- void set_non_modal() {set_flag(NON_MODAL);}
- /** Returns true if this window is modal or non-modal. */
- unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);}
-
- /**
- Marks the window as a menu window.
-
- This is intended for internal use, but it can also be used if you
- write your own menu handling. However, this is not recommended.
-
- This flag is used for correct "parenting" of windows in communication
- with the windowing system. Modern X window managers can use different
- flags to distinguish menu and tooltip windows from normal windows.
-
- This must be called before the window is shown and cannot be changed
- later.
- */
- void set_menu_window() {set_flag(MENU_WINDOW);}
-
- /** Returns true if this window is a menu window. */
- unsigned int menu_window() const {return flags() & MENU_WINDOW;}
-
- /**
- Marks the window as a tooltip window.
-
- This is intended for internal use, but it can also be used if you
- write your own tooltip handling. However, this is not recommended.
-
- This flag is used for correct "parenting" of windows in communication
- with the windowing system. Modern X window managers can use different
- flags to distinguish menu and tooltip windows from normal windows.
-
- This must be called before the window is shown and cannot be changed
- later.
-
- \note Since Fl_Tooltip_Window is derived from Fl_Menu_Window, this
- also \b clears the menu_window() state.
- */
- void set_tooltip_window() { set_flag(TOOLTIP_WINDOW);
- clear_flag(MENU_WINDOW); }
- /** Returns true if this window is a tooltip window. */
- unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
-
- /**
- Positions the window so that the mouse is pointing at the given
- position, or at the center of the given widget, which may be the
- window itself. If the optional offscreen parameter is
- non-zero, then the window is allowed to extend off the screen (this
- does not work with some X window managers). \see position()
- */
- void hotspot(int x, int y, int offscreen = 0);
- /** See void Fl_Window::hotspot(int x, int y, int offscreen = 0) */
- void hotspot(const Fl_Widget*, int offscreen = 0);
- /** See void Fl_Window::hotspot(int x, int y, int offscreen = 0) */
- void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
-
- /**
- Undoes the effect of a previous resize() or show() so that the next time
- show() is called the window manager is free to position the window.
-
- This is for Forms compatibility only.
-
- \deprecated please use force_position(0) instead
- */
- void free_position() {clear_flag(FORCE_POSITION);}
- /**
- Sets the allowable range the user can resize this window to.
- This only works for top-level windows.
- <UL>
- <LI>minw and minh are the smallest the window can be.
- Either value must be greater than 0.</LI>
- <LI>maxw and maxh are the largest the window can be. If either is
- <I>equal</I> to the minimum then you cannot resize in that direction.
- If either is zero then FLTK picks a maximum size in that direction
- such that the window will fill the screen.</LI>
- <LI>dw and dh are size increments. The window will be constrained
- to widths of minw + N * dw, where N is any non-negative integer.
- If these are less or equal to 1 they are ignored (this is ignored
- on WIN32).</LI>
- <LI>aspect is a flag that indicates that the window should preserve its
- aspect ratio. This only works if both the maximum and minimum have
- the same aspect ratio (ignored on WIN32 and by many X window managers).
- </LI>
- </UL>
-
- If this function is not called, FLTK tries to figure out the range
- from the setting of resizable():
- <UL>
- <LI>If resizable() is NULL (this is the default) then the window cannot
- be resized and the resize border and max-size control will not be
- displayed for the window.</LI>
- <LI>If either dimension of resizable() is less than 100, then that is
- considered the minimum size. Otherwise the resizable() has a minimum
- size of 100.</LI>
- <LI>If either dimension of resizable() is zero, then that is also the
- maximum size (so the window cannot resize in that direction).</LI>
- </UL>
-
- It is undefined what happens if the current size does not fit in the
- constraints passed to size_range().
- */
- void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0) {
- minw=a; minh=b; maxw=c; maxh=d; dw=e; dh=f; aspect=g; size_range_();}
-
- /** See void Fl_Window::label(const char*) */
- const char* label() const {return Fl_Widget::label();}
- /** See void Fl_Window::iconlabel(const char*) */
- const char* iconlabel() const {return iconlabel_;}
- /** Sets the window title bar label. */
- void label(const char*);
- /** Sets the icon label. */
- void iconlabel(const char*);
- /** Sets the icon label. */
- void label(const char* label, const char* iconlabel); // platform dependent
- void copy_label(const char* a);
-
- static void default_xclass(const char*);
- static const char *default_xclass();
- const char* xclass() const;
- void xclass(const char* c);
- const void* icon() const;
- void icon(const void * ic);
-
- /**
- Returns non-zero if show() has been called (but not hide()
- ). You can tell if a window is iconified with (w->shown()
- && !w->visible()).
- */
- int shown() {return i != 0;}
- /**
- Puts the window on the screen. Usually (on X) this has the side
- effect of opening the display.
-
- If the window is already shown then it is restored and raised to the
- top. This is really convenient because your program can call show()
- at any time, even if the window is already up. It also means that
- show() serves the purpose of raise() in other toolkits.
-
- Fl_Window::show(int argc, char **argv) is used for top-level
- windows and allows standard arguments to be parsed from the
- command-line.
-
- \see Fl_Window::show(int argc, char **argv)
- */
- virtual void show();
- /**
- Removes the window from the screen. If the window is already hidden or
- has not been shown then this does nothing and is harmless.
- */
- virtual void hide();
- /**
- Puts the window on the screen and parses command-line arguments.
-
- Usually (on X) this has the side effect of opening the display.
-
- This form should be used for top-level windows, at least for the
- first (main) window. It allows standard arguments to be parsed
- from the command-line. You can use \p argc and \p argv from
- main(int argc, char **argv) for this call.
-
- The first call also sets up some system-specific internal
- variables like the system colors.
-
- \todo explain which system parameters are set up.
-
- \param argc command-line argument count, usually from main()
- \param argv command-line argument vector, usually from main()
-
- \see virtual void Fl_Window::show()
- */
- void show(int argc, char **argv);
- /**
- Makes the window completely fill the screen, without any window
- manager border visible. You must use fullscreen_off() to undo
- this. This may not work with all window managers.
- */
- void fullscreen();
- /**
- Turns off any side effects of fullscreen() and does
- resize(x,y,w,h).
- */
- void fullscreen_off(int,int,int,int);
- /**
- Iconifies the window. If you call this when shown() is false
- it will show() it as an icon. If the window is already
- iconified this does nothing.
-
- Call show() to restore the window.
-
- When a window is iconified/restored (either by these calls or by the
- user) the handle() method is called with FL_HIDE and
- FL_SHOW events and visible() is turned on and off.
-
- There is no way to control what is drawn in the icon except with the
- string passed to Fl_Window::xclass(). You should not rely on
- window managers displaying the icons.
- */
- void iconize();
-
- int x_root() const ;
- int y_root() const ;
-
- static Fl_Window *current();
- /**
- Sets things up so that the drawing functions in <FL/fl_draw.H> will go
- into this window. This is useful for incremental update of windows, such
- as in an idle callback, which will make your program behave much better
- if it draws a slow graphic. <B>Danger: incremental update is very hard to
- debug and maintain!</B>
-
- This method only works for the Fl_Window and Fl_Gl_Window derived classes.
- */
- void make_current();
-
- // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
- virtual Fl_Window* as_window() { return this; }
-
- /**
- Changes the cursor for this window. This always calls the system, if
- you are changing the cursor a lot you may want to keep track of how
- you set it in a static variable and call this only if the new cursor
- is different.
-
- The type Fl_Cursor is an enumeration defined in <FL/Enumerations.H>.
- (Under X you can get any XC_cursor value by passing
- Fl_Cursor((XC_foo/2)+1)). The colors only work on X, they are
- not implemented on WIN32.
-
- For back compatibility only.
- */
- void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent
- void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
- static void default_callback(Fl_Window*, void* v);
-
- /** Returns the window width including any frame added by the window manager.
-
- Same as w() if applied to a subwindow.
- */
- int decorated_w();
- /** Returns the window height including any window title bar and any frame
- added by the window manager.
-
- Same as h() if applied to a subwindow.
- */
- int decorated_h();
-
-};
-
-#endif
-
-//
-// End of "$Id: Fl_Window.H 8593 2011-04-15 21:38:05Z manolo $".
-//
diff --git a/Libraries/FL/Fl_Wizard.H b/Libraries/FL/Fl_Wizard.H
deleted file mode 100644
index 2dcf3151..00000000
--- a/Libraries/FL/Fl_Wizard.H
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// "$Id: Fl_Wizard.H 8306 2011-01-24 17:04:22Z matt $"
-//
-// Fl_Wizard widget definitions.
-//
-// Copyright 1999-2010 by Easy Software Products.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_Wizard widget . */
-
-//
-// Include necessary header files...
-//
-
-#ifndef _Fl_Wizard_H_
-# define _Fl_Wizard_H_
-
-# include <FL/Fl_Group.H>
-
-
-/**
- This widget is based off the Fl_Tabs
- widget, but instead of displaying tabs it only changes "tabs" under
- program control. Its primary purpose is to support "wizards" that
- step a user through configuration or troubleshooting tasks.
-
- <P>As with Fl_Tabs, wizard panes are composed of child (usually
- Fl_Group) widgets. Navigation buttons must be added separately.
-*/
-class FL_EXPORT Fl_Wizard : public Fl_Group {
-
- Fl_Widget *value_;
-
- void draw();
-
- public:
-
- Fl_Wizard(int, int, int, int, const char * = 0);
-
- void next();
- void prev();
- Fl_Widget *value();
- void value(Fl_Widget *);
-};
-
-#endif // !_Fl_Wizard_H_
-
-//
-// End of "$Id: Fl_Wizard.H 8306 2011-01-24 17:04:22Z matt $".
-//
diff --git a/Libraries/FL/Fl_XBM_Image.H b/Libraries/FL/Fl_XBM_Image.H
deleted file mode 100644
index 53081ebd..00000000
--- a/Libraries/FL/Fl_XBM_Image.H
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// "$Id: Fl_XBM_Image.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// XBM image header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
- Fl_XBM_Image class . */
-
-#ifndef Fl_XBM_Image_H
-#define Fl_XBM_Image_H
-# include "Fl_Bitmap.H"
-
-/**
- The Fl_XBM_Image class supports loading, caching,
- and drawing of X Bitmap (XBM) bitmap files.
-*/
-class FL_EXPORT Fl_XBM_Image : public Fl_Bitmap {
-
- public:
-
- Fl_XBM_Image(const char* filename);
-};
-
-#endif // !Fl_XBM_Image_H
-
-//
-// End of "$Id: Fl_XBM_Image.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Fl_XPM_Image.H b/Libraries/FL/Fl_XPM_Image.H
deleted file mode 100644
index 2f1a18ac..00000000
--- a/Libraries/FL/Fl_XPM_Image.H
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// "$Id: Fl_XPM_Image.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// XPM image header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/* \file
-
- Fl_XPM_Image class . */
-
-#ifndef Fl_XPM_Image_H
-#define Fl_XPM_Image_H
-# include "Fl_Pixmap.H"
-
-/**
- The Fl_XPM_Image class supports loading, caching,
- and drawing of X Pixmap (XPM) images, including transparency.
-*/
-class FL_EXPORT Fl_XPM_Image : public Fl_Pixmap {
-
- public:
-
- Fl_XPM_Image(const char* filename);
-};
-
-#endif // !Fl_XPM_Image
-
-//
-// End of "$Id: Fl_XPM_Image.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/Xutf8.h b/Libraries/FL/Xutf8.h
deleted file mode 100644
index b122d2e0..00000000
--- a/Libraries/FL/Xutf8.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* "$Id: Xutf8.h 8399 2011-02-07 22:22:16Z ianmacarthur $"
- *
- * Author: Jean-Marc Lienher ( http://oksid.ch )
- * Copyright 2000-2010 by O'ksi'D.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- * Please report all bugs and problems on the following page:
- *
- * http://www.fltk.org/str.php
- */
-
-#ifndef _Xutf8_h
-#define _Xutf8_h
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/Xlocale.h>
-#include <X11/Xutil.h>
-
-typedef struct {
- int nb_font;
- char **font_name_list;
- int *encodings;
- XFontStruct **fonts;
- Font fid;
- int ascent;
- int descent;
- int *ranges;
-} XUtf8FontStruct;
-
-XUtf8FontStruct *
-XCreateUtf8FontStruct (
- Display *dpy,
- const char *base_font_name_list);
-
-void
-XUtf8DrawString(
- Display *display,
- Drawable d,
- XUtf8FontStruct *font_set,
- GC gc,
- int x,
- int y,
- const char *string,
- int num_bytes);
-
-void
-XUtf8_measure_extents(
- Display *display,
- Drawable d,
- XUtf8FontStruct *font_set,
- GC gc,
- int *xx,
- int *yy,
- int *ww,
- int *hh,
- const char *string,
- int num_bytes);
-
-void
-XUtf8DrawRtlString(
- Display *display,
- Drawable d,
- XUtf8FontStruct *font_set,
- GC gc,
- int x,
- int y,
- const char *string,
- int num_bytes);
-
-void
-XUtf8DrawImageString(
- Display *display,
- Drawable d,
- XUtf8FontStruct *font_set,
- GC gc,
- int x,
- int y,
- const char *string,
- int num_bytes);
-
-int
-XUtf8TextWidth(
- XUtf8FontStruct *font_set,
- const char *string,
- int num_bytes);
-int
-XUtf8UcsWidth(
- XUtf8FontStruct *font_set,
- unsigned int ucs);
-
-int
-XGetUtf8FontAndGlyph(
- XUtf8FontStruct *font_set,
- unsigned int ucs,
- XFontStruct **fnt,
- unsigned short *id);
-
-void
-XFreeUtf8FontStruct(
- Display *dpy,
- XUtf8FontStruct *font_set);
-
-
-int
-XConvertUtf8ToUcs(
- const unsigned char *buf,
- int len,
- unsigned int *ucs);
-
-int
-XConvertUcsToUtf8(
- unsigned int ucs,
- char *buf);
-
-int
-XUtf8CharByteLen(
- const unsigned char *buf,
- int len);
-
-int
-XCountUtf8Char(
- const unsigned char *buf,
- int len);
-
-int
-XFastConvertUtf8ToUcs(
- const unsigned char *buf,
- int len,
- unsigned int *ucs);
-
-long
-XKeysymToUcs(
- KeySym keysym);
-
-int
-XUtf8LookupString(
- XIC ic,
- XKeyPressedEvent* event,
- char* buffer_return,
- int bytes_buffer,
- KeySym* keysym,
- Status* status_return);
-
-unsigned short
-XUtf8IsNonSpacing(
- unsigned int ucs);
-
-unsigned short
-XUtf8IsRightToLeft(
- unsigned int ucs);
-
-
-int
-XUtf8Tolower(
- int ucs);
-
-int
-XUtf8Toupper(
- int ucs);
-
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/*
- * End of "$Id: Xutf8.h 8399 2011-02-07 22:22:16Z ianmacarthur $".
- */
diff --git a/Libraries/FL/dirent.h b/Libraries/FL/dirent.h
deleted file mode 100644
index 7b68cd16..00000000
--- a/Libraries/FL/dirent.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// "$Id: dirent.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
-//
-// Directory header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-
-// this file is for back-compatibility only
-#include "filename.H"
-
-//
-// End of "$Id: dirent.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
-//
diff --git a/Libraries/FL/filename.H b/Libraries/FL/filename.H
deleted file mode 100644
index 3acae578..00000000
--- a/Libraries/FL/filename.H
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * "$Id: filename.H 8073 2010-12-20 13:35:43Z ianmacarthur $"
- *
- * Filename header file for the Fast Light Tool Kit (FLTK).
- *
- * Copyright 1998-2010 by Bill Spitzak and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- * Please report all bugs and problems on the following page:
- *
- * http://www.fltk.org/str.php
- */
-
-/* Xcode on OS X includes files by recursing down into directories.
- * This code catches the cycle and directly includes the required file.
- */
-#ifdef fl_dirent_h_cyclic_include
-# include "/usr/include/dirent.h"
-#endif
-
-#ifndef FL_FILENAME_H
-# define FL_FILENAME_H
-
-# include "Fl_Export.H"
-
-/** \addtogroup filenames File names and URI utility functions
- File names and URI functions defined in <FL/filename.H>
- @{ */
-
-# define FL_PATH_MAX 2048 /**< all path buffers should use this length */
-/** Gets the file name from a path.
- Similar to basename(3), exceptions shown below.
- \code
- #include <FL/filename.H>
- [..]
- const char *out;
- out = fl_filename_name("/usr/lib"); // out="lib"
- out = fl_filename_name("/usr/"); // out="" (basename(3) returns "usr" instead)
- out = fl_filename_name("/usr"); // out="usr"
- out = fl_filename_name("/"); // out="" (basename(3) returns "/" instead)
- out = fl_filename_name("."); // out="."
- out = fl_filename_name(".."); // out=".."
- \endcode
- \return a pointer to the char after the last slash, or to \p filename if there is none.
- */
-FL_EXPORT const char *fl_filename_name(const char * filename);
-FL_EXPORT const char *fl_filename_ext(const char *buf);
-FL_EXPORT char *fl_filename_setext(char *to, int tolen, const char *ext);
-FL_EXPORT int fl_filename_expand(char *to, int tolen, const char *from);
-FL_EXPORT int fl_filename_absolute(char *to, int tolen, const char *from);
-FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from);
-FL_EXPORT int fl_filename_match(const char *name, const char *pattern);
-FL_EXPORT int fl_filename_isdir(const char *name);
-
-# if defined(__cplusplus) && !defined(FL_DOXYGEN)
-/*
- * Under WIN32, we include filename.H from numericsort.c; this should probably change...
- */
-
-inline char *fl_filename_setext(char *to, const char *ext) { return fl_filename_setext(to, FL_PATH_MAX, ext); }
-inline int fl_filename_expand(char *to, const char *from) { return fl_filename_expand(to, FL_PATH_MAX, from); }
-inline int fl_filename_absolute(char *to, const char *from) { return fl_filename_absolute(to, FL_PATH_MAX, from); }
-FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from, const char *cwd);
-inline int fl_filename_relative(char *to, const char *from) { return fl_filename_relative(to, FL_PATH_MAX, from); }
-# endif /* __cplusplus */
-
-
-# if defined(WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)
-
-struct dirent {char d_name[1];};
-
-# elif defined(__WATCOMC__)
-# include <sys/types.h>
-# include <direct.h>
-
-# else
-/*
- * WARNING: on some systems (very few nowadays?) <dirent.h> may not exist.
- * The correct information is in one of these files:
- *
- * #include <sys/ndir.h>
- * #include <sys/dir.h>
- * #include <ndir.h>
- *
- * plus you must do the following #define:
- *
- * #define dirent direct
- *
- * It would be best to create a <dirent.h> file that does this...
- */
-# include <sys/types.h>
-# define fl_dirent_h_cyclic_include
-# include <dirent.h>
-# undef fl_dirent_h_cyclic_include
-# endif
-
-# if defined (__cplusplus)
-extern "C" {
-# endif /* __cplusplus */
-
-# if !defined(FL_DOXYGEN)
-FL_EXPORT int fl_alphasort(struct dirent **, struct dirent **);
-FL_EXPORT int fl_casealphasort(struct dirent **, struct dirent **);
-FL_EXPORT int fl_casenumericsort(struct dirent **, struct dirent **);
-FL_EXPORT int fl_numericsort(struct dirent **, struct dirent **);
-# endif
-
- typedef int (Fl_File_Sort_F)(struct dirent **, struct dirent **); /**< File sorting function. \see fl_filename_list() */
-
-# if defined(__cplusplus)
-}
-
-/*
- * Portable "scandir" function. Ugly but necessary...
- */
-
-FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l,
- Fl_File_Sort_F *s = fl_numericsort);
-FL_EXPORT void fl_filename_free_list(struct dirent ***l, int n);
-
-/*
- * Generic function to open a Uniform Resource Identifier (URI) using a
- * system-defined program (added in FLTK 1.1.8)
- */
-
-FL_EXPORT int fl_open_uri(const char *uri, char *msg = (char *)0,
- int msglen = 0);
-
-# ifndef FL_DOXYGEN
-/*
- * _fl_filename_isdir_quick() is a private function that checks for a
- * trailing slash and assumes that the passed name is a directory if
- * it finds one. This function is used by Fl_File_Browser and
- * Fl_File_Chooser to avoid extra stat() calls, but is not supported
- * outside of FLTK...
- */
-int _fl_filename_isdir_quick(const char *name);
-# endif
-
-# endif /* __cplusplus */
-
-/*
- * FLTK 1.0.x compatibility definitions...
- */
-
-# ifdef FLTK_1_0_COMPAT
-# define filename_absolute fl_filename_absolute
-# define filename_expand fl_filename_expand
-# define filename_ext fl_filename_ext
-# define filename_isdir fl_filename_isdir
-# define filename_list fl_filename_list
-# define filename_match fl_filename_match
-# define filename_name fl_filename_name
-# define filename_relative fl_filename_relative
-# define filename_setext fl_filename_setext
-# define numericsort fl_numericsort
-# endif /* FLTK_1_0_COMPAT */
-
-
-#endif /* FL_FILENAME_H */
-
-/** @} */
-
-/*
- * End of "$Id: filename.H 8073 2010-12-20 13:35:43Z ianmacarthur $".
- */
diff --git a/Libraries/FL/fl_ask.H b/Libraries/FL/fl_ask.H
deleted file mode 100644
index 98e7f396..00000000
--- a/Libraries/FL/fl_ask.H
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// "$Id: fl_ask.H 8441 2011-02-18 08:52:48Z AlbrechtS $"
-//
-// Standard dialog header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-#ifndef fl_ask_H
-# define fl_ask_H
-
-# include "Enumerations.H"
-
-class Fl_Widget;
-/** Different system beeps available. \relatesalso fl_beep(int) */
-enum {
- FL_BEEP_DEFAULT = 0,
- FL_BEEP_MESSAGE,
- FL_BEEP_ERROR,
- FL_BEEP_QUESTION,
- FL_BEEP_PASSWORD,
- FL_BEEP_NOTIFICATION
-};
-
-# ifdef __GNUC__
-# define __fl_attr(x) __attribute__ (x)
-# else
-# define __fl_attr(x)
-# endif // __GNUC__
-
-FL_EXPORT void fl_beep(int type = FL_BEEP_DEFAULT);
-FL_EXPORT void fl_message(const char *,...) __fl_attr((__format__ (__printf__, 1, 2)));
-FL_EXPORT void fl_alert(const char *,...) __fl_attr((__format__ (__printf__, 1, 2)));
-// fl_ask() is deprecated since it uses "Yes" and "No" for the buttons,
-// which does not conform to the current FLTK Human Interface Guidelines.
-// Use fl_choice() instead with the appropriate verbs instead.
-FL_EXPORT int fl_ask(const char *,...) __fl_attr((__format__ (__printf__, 1, 2), __deprecated__));
-FL_EXPORT int fl_choice(const char *q,const char *b0,const char *b1,const char *b2,...) __fl_attr((__format__ (__printf__, 1, 5)));
-FL_EXPORT const char *fl_input(const char *label, const char *deflt = 0, ...) __fl_attr((__format__ (__printf__, 1, 3)));
-FL_EXPORT const char *fl_password(const char *label, const char *deflt = 0, ...) __fl_attr((__format__ (__printf__, 1, 3)));
-
-FL_EXPORT Fl_Widget *fl_message_icon();
-extern FL_EXPORT Fl_Font fl_message_font_;
-extern FL_EXPORT Fl_Fontsize fl_message_size_;
-inline void fl_message_font(Fl_Font f, Fl_Fontsize s) {
- fl_message_font_ = f; fl_message_size_ = s;}
-
-FL_EXPORT void fl_message_hotspot(int enable);
-FL_EXPORT int fl_message_hotspot(void);
-
-FL_EXPORT void fl_message_title(const char *title);
-FL_EXPORT void fl_message_title_default(const char *title);
-
-// pointers you can use to change FLTK to a foreign language:
-extern FL_EXPORT const char* fl_no;
-extern FL_EXPORT const char* fl_yes;
-extern FL_EXPORT const char* fl_ok;
-extern FL_EXPORT const char* fl_cancel;
-extern FL_EXPORT const char* fl_close;
-#endif // !fl_ask_H
-
-//
-// End of "$Id: fl_ask.H 8441 2011-02-18 08:52:48Z AlbrechtS $".
-//
diff --git a/Libraries/FL/fl_draw.H b/Libraries/FL/fl_draw.H
deleted file mode 100644
index 93c0ce1a..00000000
--- a/Libraries/FL/fl_draw.H
+++ /dev/null
@@ -1,784 +0,0 @@
-//
-// "$Id: fl_draw.H 8772 2011-06-02 08:06:09Z manolo $"
-//
-// Portable drawing function header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/**
- \file fl_draw.H
- \brief utility header to pull drawing functions together
-*/
-
-#ifndef fl_draw_H
-#define fl_draw_H
-
-#include <FL/x.H> // for Fl_Region
-#include <FL/Enumerations.H> // for the color names
-#include <FL/Fl_Window.H> // for fl_set_spot()
-#include <FL/Fl_Device.H> // for fl_graphics_driver
-
-// Image class...
-class Fl_Image;
-
-// Label flags...
-FL_EXPORT extern char fl_draw_shortcut;
-
-/** \addtogroup fl_attributes
- @{
-*/
-
-// Colors:
-/**
- Sets the color for all subsequent drawing operations.
- For colormapped displays, a color cell will be allocated out of
- \p fl_colormap the first time you use a color. If the colormap fills up
- then a least-squares algorithm is used to find the closest color.
- If no valid graphical context (fl_gc) is available,
- the foreground is not set for the current window.
- \param[in] c color
- */
-inline void fl_color(Fl_Color c) {fl_graphics_driver->color(c); } // select indexed color
-/** for back compatibility - use fl_color(Fl_Color c) instead */
-inline void fl_color(int c) {fl_color((Fl_Color)c);}
-/**
- Sets the color for all subsequent drawing operations.
- The closest possible match to the RGB color is used.
- The RGB color is used directly on TrueColor displays.
- For colormap visuals the nearest index in the gray
- ramp or color cube is used.
- If no valid graphical context (fl_gc) is available,
- the foreground is not set for the current window.
- \param[in] r,g,b color components
- */
-inline void fl_color(uchar r, uchar g, uchar b) {fl_graphics_driver->color(r,g,b); } // select actual color
-/**
- Returns the last fl_color() that was set.
- This can be used for state save/restore.
-*/
-inline Fl_Color fl_color() {return fl_graphics_driver->color();}
-/** @} */
-
-/** \addtogroup fl_drawings
- @{
-*/
-// clip:
-/**
- Intersects the current clip region with a rectangle and pushes this
- new region onto the stack.
- \param[in] x,y,w,h position and size
- */
-inline void fl_push_clip(int x, int y, int w, int h) {fl_graphics_driver->push_clip(x,y,w,h); }
-/**
- Intersects the current clip region with a rectangle and pushes this
- new region onto the stack (deprecated).
- \param[in] x,y,w,h position and size
- \deprecated
- fl_clip(int, int, int, int) is deprecated and will be removed from future releases.
- Please use fl_push_clip(int x, int y, int w, int h) instead.
- */
-#define fl_clip fl_push_clip
-/**
- Pushes an empty clip region onto the stack so nothing will be clipped.
- */
-inline void fl_push_no_clip() {fl_graphics_driver->push_no_clip(); }
-/**
- Restores the previous clip region.
-
- You must call fl_pop_clip() once for every time you call fl_push_clip().
- Unpredictable results may occur if the clip stack is not empty when
- you return to FLTK.
- */
-inline void fl_pop_clip() {fl_graphics_driver->pop_clip(); }
-/**
- Does the rectangle intersect the current clip region?
- \param[in] x,y,w,h position and size of rectangle
- \returns non-zero if any of the rectangle intersects the current clip
- region. If this returns 0 you don't have to draw the object.
-
- \note
- Under X this returns 2 if the rectangle is partially clipped,
- and 1 if it is entirely inside the clip region.
- */
-inline int fl_not_clipped(int x, int y, int w, int h) {return fl_graphics_driver->not_clipped(x,y,w,h); }
-/**
- Intersects the rectangle with the current clip region and returns the
- bounding box of the result.
-
- Returns non-zero if the resulting rectangle is different to the original.
- This can be used to limit the necessary drawing to a rectangle.
- \p W and \p H are set to zero if the rectangle is completely outside the region.
- \param[in] x,y,w,h position and size of rectangle
- \param[out] X,Y,W,H position and size of resulting bounding box.
- \returns Non-zero if the resulting rectangle is different to the original.
- */
-inline int fl_clip_box(int x , int y, int w, int h, int& X, int& Y, int& W, int& H)
- {return fl_graphics_driver->clip_box(x,y,w,h,X,Y,W,H); }
-/** Undoes any clobbering of clip done by your program */
-inline void fl_restore_clip() { fl_graphics_driver->restore_clip(); }
-/**
- Replaces the top of the clipping stack with a clipping region of any shape.
-
- Fl_Region is an operating system specific type.
- \param[in] r clipping region
- */
-inline void fl_clip_region(Fl_Region r) { fl_graphics_driver->clip_region(r); }
-/**
- Returns the current clipping region.
- */
-inline Fl_Region fl_clip_region() { return fl_graphics_driver->clip_region(); }
-
-
-// points:
-/**
- Draws a single pixel at the given coordinates
- */
-inline void fl_point(int x, int y) { fl_graphics_driver->point(x,y); }
-
-// line type:
-/**
- Sets how to draw lines (the "pen").
- If you change this it is your responsibility to set it back to the default
- using \c fl_line_style(0).
-
- \param[in] style A bitmask which is a bitwise-OR of a line style, a cap
- style, and a join style. If you don't specify a dash type you
- will get a solid line. If you don't specify a cap or join type
- you will get a system-defined default of whatever value is
- fastest.
- \param[in] width The thickness of the lines in pixels. Zero results in the
- system defined default, which on both X and Windows is somewhat
- different and nicer than 1.
- \param[in] dashes A pointer to an array of dash lengths, measured in pixels.
- The first location is how long to draw a solid portion, the next
- is how long to draw the gap, then the solid, etc. It is terminated
- with a zero-length entry. A \c NULL pointer or a zero-length
- array results in a solid line. Odd array sizes are not supported
- and result in undefined behavior.
-
- \note Because of how line styles are implemented on Win32 systems,
- you \e must set the line style \e after setting the drawing
- color. If you set the color after the line style you will lose
- the line style settings.
- \note The \p dashes array does not work under Windows 95, 98 or Me,
- since those operating systems do not support complex line styles.
- */
-inline void fl_line_style(int style, int width=0, char* dashes=0) {fl_graphics_driver->line_style(style,width,dashes); }
-enum {
- FL_SOLID = 0, ///< line style: <tt>___________</tt>
- FL_DASH = 1, ///< line style: <tt>_ _ _ _ _ _</tt>
- FL_DOT = 2, ///< line style: <tt>. . . . . .</tt>
- FL_DASHDOT = 3, ///< line style: <tt>_ . _ . _ .</tt>
- FL_DASHDOTDOT = 4, ///< line style: <tt>_ . . _ . .</tt>
-
- FL_CAP_FLAT = 0x100, ///< cap style: end is flat
- FL_CAP_ROUND = 0x200, ///< cap style: end is round
- FL_CAP_SQUARE = 0x300, ///< cap style: end wraps end point
-
- FL_JOIN_MITER = 0x1000, ///< join style: line join extends to a point
- FL_JOIN_ROUND = 0x2000, ///< join style: line join is rounded
- FL_JOIN_BEVEL = 0x3000 ///< join style: line join is tidied
-};
-
-// rectangles tweaked to exactly fill the pixel rectangle:
-
-/**
- Draws a 1-pixel border \e inside the given bounding box.
- This function is meant for quick drawing of simple boxes. The behavior is
- undefined for line widths that are not 1.
- */
-inline void fl_rect(int x, int y, int w, int h) { fl_graphics_driver->rect(x,y,w,h); }
-
-/** Draws with passed color a 1-pixel border \e inside the given bounding box */
-inline void fl_rect(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_rect(x,y,w,h);}
-/** Colors with current color a rectangle that exactly fills the given bounding box */
-inline void fl_rectf(int x, int y, int w, int h) { fl_graphics_driver->rectf(x,y,w,h); }
-/** Colors with passed color a rectangle that exactly fills the given bounding box */
-inline void fl_rectf(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_rectf(x,y,w,h);}
-
-/**
- Colors a rectangle with "exactly" the passed <tt>r,g,b</tt> color.
- On screens with less than 24 bits of color this is done by drawing a
- solid-colored block using fl_draw_image() so that the correct color
- shade is produced.
- */
-/* note: doxygen comment here to avoid triplication in os-speciic files */
-FL_EXPORT void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b);
-
-// line segments:
-/**
- Draws a line from (x,y) to (x1,y1)
- */
-inline void fl_line(int x, int y, int x1, int y1) {fl_graphics_driver->line(x,y,x1,y1); }
-/**
- Draws a line from (x,y) to (x1,y1) and another from (x1,y1) to (x2,y2)
- */
-inline void fl_line(int x, int y, int x1, int y1, int x2, int y2) {fl_graphics_driver->line(x,y,x1,y1,x2,y2); }
-
-// closed line segments:
-/**
- Outlines a 3-sided polygon with lines
- */
-inline void fl_loop(int x, int y, int x1, int y1, int x2, int y2) {fl_graphics_driver->loop(x,y,x1,y1,x2,y2); }
-/**
- Outlines a 4-sided polygon with lines
- */
-inline void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3)
- {fl_graphics_driver->loop(x,y,x1,y1,x2,y2,x3,y3); }
-
-// filled polygons
-/**
- Fills a 3-sided polygon. The polygon must be convex.
- */
-inline void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) {fl_graphics_driver->polygon(x,y,x1,y1,x2,y2); }
-/**
- Fills a 4-sided polygon. The polygon must be convex.
- */
-inline void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3)
- { fl_graphics_driver->polygon(x,y,x1,y1,x2,y2,x3,y3); }
-
-// draw rectilinear lines, horizontal segment first:
-/**
- Draws a horizontal line from (x,y) to (x1,y)
- */
-inline void fl_xyline(int x, int y, int x1) {fl_graphics_driver->xyline(x,y,x1);}
-/**
- Draws a horizontal line from (x,y) to (x1,y), then vertical from (x1,y) to (x1,y2)
- */
-inline void fl_xyline(int x, int y, int x1, int y2) {fl_graphics_driver->xyline(x,y,x1,y2);}
-/**
- Draws a horizontal line from (x,y) to (x1,y), then a vertical from (x1,y) to (x1,y2)
- and then another horizontal from (x1,y2) to (x3,y2)
- */
-inline void fl_xyline(int x, int y, int x1, int y2, int x3) {fl_graphics_driver->xyline(x,y,x1,y2,x3);}
-
-// draw rectilinear lines, vertical segment first:
-/**
- Draws a vertical line from (x,y) to (x,y1)
- */
-inline void fl_yxline(int x, int y, int y1) {fl_graphics_driver->yxline(x,y,y1);}
-/**
- Draws a vertical line from (x,y) to (x,y1), then a horizontal from (x,y1) to (x2,y1)
- */
-inline void fl_yxline(int x, int y, int y1, int x2) {fl_graphics_driver->yxline(x,y,y1,x2);}
-/**
- Draws a vertical line from (x,y) to (x,y1) then a horizontal from (x,y1)
- to (x2,y1), then another vertical from (x2,y1) to (x2,y3)
- */
-inline void fl_yxline(int x, int y, int y1, int x2, int y3) {fl_graphics_driver->yxline(x,y,y1,x2,y3);}
-
-// circular lines and pie slices (code in fl_arci.C):
-/**
- Draw ellipse sections using integer coordinates.
-
- These functions match the rather limited circle drawing code provided by X
- and WIN32. The advantage over using fl_arc with floating point coordinates
- is that they are faster because they often use the hardware, and they draw
- much nicer small circles, since the small sizes are often hard-coded bitmaps.
-
- If a complete circle is drawn it will fit inside the passed bounding box.
- The two angles are measured in degrees counter-clockwise from 3 o'clock and
- are the starting and ending angle of the arc, \p a2 must be greater or equal
- to \p a1.
-
- fl_arc() draws a series of lines to approximate the arc. Notice that the
- integer version of fl_arc() has a different number of arguments than the
- double version fl_arc(double x, double y, double r, double start, double end)
-
- \param[in] x,y,w,h bounding box of complete circle
- \param[in] a1,a2 start and end angles of arc measured in degrees
- counter-clockwise from 3 o'clock. \p a2 must be greater
- than or equal to \p a1.
- */
-inline void fl_arc(int x, int y, int w, int h, double a1, double a2) {fl_graphics_driver->arc(x,y,w,h,a1,a2); }
-/**
- Draw filled ellipse sections using integer coordinates.
-
- Like fl_arc(), but fl_pie() draws a filled-in pie slice.
- This slice may extend outside the line drawn by fl_arc();
- to avoid this use w - 1 and h - 1.
-
- \param[in] x,y,w,h bounding box of complete circle
- \param[in] a1,a2 start and end angles of arc measured in degrees
- counter-clockwise from 3 o'clock. \p a2 must be greater
- than or equal to \p a1.
- */
-inline void fl_pie(int x, int y, int w, int h, double a1, double a2) {fl_graphics_driver->pie(x,y,w,h,a1,a2); }
-/** fl_chord declaration is a place holder - the function does not yet exist */
-FL_EXPORT void fl_chord(int x, int y, int w, int h, double a1, double a2); // nyi
-
-// scalable drawing code (code in fl_vertex.C and fl_arc.C):
-/**
- Saves the current transformation matrix on the stack.
- The maximum depth of the stack is 32.
- */
-inline void fl_push_matrix() { fl_graphics_driver->push_matrix(); }
-/**
- Restores the current transformation matrix from the stack.
- */
-inline void fl_pop_matrix() { fl_graphics_driver->pop_matrix(); }
-/**
- Concatenates scaling transformation onto the current one.
- \param[in] x,y scale factors in x-direction and y-direction
- */
-inline void fl_scale(double x, double y) { fl_graphics_driver->scale(x, y); }
-/**
- Concatenates scaling transformation onto the current one.
- \param[in] x scale factor in both x-direction and y-direction
- */
-inline void fl_scale(double x) { fl_graphics_driver->scale(x, x); }
-/**
- Concatenates translation transformation onto the current one.
- \param[in] x,y translation factor in x-direction and y-direction
- */
-inline void fl_translate(double x, double y) { fl_graphics_driver->translate(x, y); }
-/**
- Concatenates rotation transformation onto the current one.
- \param[in] d - rotation angle, counter-clockwise in degrees (not radians)
- */
-inline void fl_rotate(double d) { fl_graphics_driver->rotate(d); }
-/**
- Concatenates another transformation onto the current one.
-
- \param[in] a,b,c,d,x,y transformation matrix elements such that
- <tt> X' = aX + cY + x </tt> and <tt> Y' = bX +dY + y </tt>
- */
-inline void fl_mult_matrix(double a, double b, double c, double d, double x,double y)
- { fl_graphics_driver->mult_matrix(a, b, c, d, x, y); }
-/**
- Starts drawing a list of points. Points are added to the list with fl_vertex()
- */
-inline void fl_begin_points() {fl_graphics_driver->begin_points(); }
-/**
- Starts drawing a list of lines.
- */
-inline void fl_begin_line() {fl_graphics_driver->begin_line(); }
-/**
- Starts drawing a closed sequence of lines.
- */
-inline void fl_begin_loop() {fl_graphics_driver->begin_loop(); }
-/**
- Starts drawing a convex filled polygon.
- */
-inline void fl_begin_polygon() {fl_graphics_driver->begin_polygon(); }
-/**
- Adds a single vertex to the current path.
- \param[in] x,y coordinate
- */
-inline void fl_vertex(double x, double y) {fl_graphics_driver->vertex(x,y); }
-/**
- Adds a series of points on a Bezier curve to the path.
- The curve ends (and two of the points) are at X0,Y0 and X3,Y3.
- \param[in] X0,Y0 curve start point
- \param[in] X1,Y1 curve control point
- \param[in] X2,Y2 curve control point
- \param[in] X3,Y3 curve end point
- */
-inline void fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3)
- {fl_graphics_driver->curve(X0,Y0,X1,Y1,X2,Y2,X3,Y3); }
-/**
- Adds a series of points to the current path on the arc of a circle.
- You can get elliptical paths by using scale and rotate before calling fl_arc().
- \param[in] x,y,r center and radius of circular arc
- \param[in] start,end angles of start and end of arc measured in degrees
- counter-clockwise from 3 o'clock. If \p end is less than \p start
- then it draws the arc in a clockwise direction.
- */
-inline void fl_arc(double x, double y, double r, double start, double end) {fl_graphics_driver->arc(x,y,r,start,end); }
-/**
- fl_circle() is equivalent to fl_arc(x,y,r,0,360), but may be faster.
-
- It must be the \e only thing in the path: if you want a circle as part of
- a complex polygon you must use fl_arc()
- \param[in] x,y,r center and radius of circle
- */
-inline void fl_circle(double x, double y, double r) {fl_graphics_driver->circle(x,y,r); }
-/**
- Ends list of points, and draws.
- */
-inline void fl_end_points() {fl_graphics_driver->end_points(); }
-/**
- Ends list of lines, and draws.
- */
-inline void fl_end_line() {fl_graphics_driver->end_line(); }
-/**
- Ends closed sequence of lines, and draws.
- */
-inline void fl_end_loop() {fl_graphics_driver->end_loop(); }
-/**
- Ends convex filled polygon, and draws.
- */
-inline void fl_end_polygon() {fl_graphics_driver->end_polygon(); }
-/**
- Starts drawing a complex filled polygon.
-
- The polygon may be concave, may have holes in it, or may be several
- disconnected pieces. Call fl_gap() to separate loops of the path.
-
- To outline the polygon, use fl_begin_loop() and replace each fl_gap()
- with fl_end_loop();fl_begin_loop() pairs.
-
- \note
- For portability, you should only draw polygons that appear the same
- whether "even/odd" or "non-zero" winding rules are used to fill them.
- Holes should be drawn in the opposite direction to the outside loop.
- */
-inline void fl_begin_complex_polygon() {fl_graphics_driver->begin_complex_polygon(); }
-/**
- Call fl_gap() to separate loops of the path.
-
- It is unnecessary but harmless to call fl_gap() before the first vertex,
- after the last vertex, or several times in a row.
- */
-inline void fl_gap() {fl_graphics_driver->gap(); }
-/**
- Ends complex filled polygon, and draws.
- */
-inline void fl_end_complex_polygon() {fl_graphics_driver->end_complex_polygon(); }
-// get and use transformed positions:
-/**
- Transforms coordinate using the current transformation matrix.
- \param[in] x,y coordinate
- */
-inline double fl_transform_x(double x, double y) {return fl_graphics_driver->transform_x(x, y); }
-/**
- Transforms coordinate using the current transformation matrix.
- \param[in] x,y coordinate
- */
-inline double fl_transform_y(double x, double y) {return fl_graphics_driver->transform_y(x, y); }
-/**
- Transforms distance using current transformation matrix.
- \param[in] x,y coordinate
- */
-inline double fl_transform_dx(double x, double y) {return fl_graphics_driver->transform_dx(x, y); }
-/**
- Transforms distance using current transformation matrix.
- \param[in] x,y coordinate
- */
-inline double fl_transform_dy(double x, double y) {return fl_graphics_driver->transform_dy(x, y); }
-/**
- Adds coordinate pair to the vertex list without further transformations.
- \param[in] xf,yf transformed coordinate
- */
-inline void fl_transformed_vertex(double xf, double yf) {fl_graphics_driver->transformed_vertex(xf,yf); }
-/** @} */
-
-/** \addtogroup fl_attributes
- @{ */
-/* NOTE: doxygen comments here to avoid triplication in os-specific sources */
-
-// Fonts:
-/**
- Sets the current font, which is then used in various drawing routines.
- You may call this outside a draw context if necessary to call fl_width(),
- but on X this will open the display.
-
- The font is identified by a \p face and a \p size.
- The size of the font is measured in pixels and not "points".
- Lines should be spaced \p size pixels apart or more.
-*/
-inline void fl_font(Fl_Font face, Fl_Fontsize size) { fl_graphics_driver->font(face,size); }
-
-/**
- Returns the \p face set by the most recent call to fl_font().
- This can be used to save/restore the font.
-*/
-inline Fl_Font fl_font() {return fl_graphics_driver->font();}
-/**
- Returns the \p size set by the most recent call to fl_font().
- This can be used to save/restore the font.
-*/
-inline Fl_Fontsize fl_size() {return fl_graphics_driver->size();}
-
-// information you can get about the current font:
-/**
- Returns the recommended minimum line spacing for the current font.
- You can also use the value of \p size passed to fl_font()
-*/
-inline int fl_height() {return fl_graphics_driver->height();}
-FL_EXPORT int fl_height(int font, int size);
-/**
- Returns the recommended distance above the bottom of a fl_height() tall box to
- draw the text at so it looks centered vertically in that box.
-*/
-inline int fl_descent() {return fl_graphics_driver->descent();}
-/** Returns the typographical width of a nul-terminated string */
-FL_EXPORT double fl_width(const char* txt);
-/** Returns the typographical width of a sequence of \p n characters */
-inline double fl_width(const char* txt, int n) {return fl_graphics_driver->width(txt, n);}
-/** Returns the typographical width of a single character.
- \note if a valid fl_gc is NOT found then it uses the first window gc,
- or the screen gc if no fltk window is available when called. */
-inline double fl_width(unsigned int c) {return fl_graphics_driver->width(c);}
-/** Determines the minimum pixel dimensions of a nul-terminated string.
-
- Usage: given a string "txt" drawn using fl_draw(txt, x, y) you would determine
- its pixel extents on the display using fl_text_extents(txt, dx, dy, wo, ho)
- such that a bounding box that exactly fits around the text could be drawn with
- fl_rect(x+dx, y+dy, wo, ho). Note the dx, dy values hold the offset of the first
- "colored in" pixel of the string, from the draw origin.
-*/
-FL_EXPORT void fl_text_extents(const char*, int& dx, int& dy, int& w, int& h); // NO fltk symbol expansion will be performed
-/** Determines the minimum pixel dimensions of a sequence of \p n characters.
-\see fl_text_extents(const char*, int& dx, int& dy, int& w, int& h)
-*/
-inline void fl_text_extents(const char *t, int n, int& dx, int& dy, int& w, int& h)
- {fl_graphics_driver->text_extents(t, n, dx, dy, w, h);}
-
-// font encoding:
-// Note: doxygen comments here to avoid duplication for os-sepecific cases
-/**
- Converts text from Windows/X11 latin1 character set to local encoding.
- \param[in] t character string (latin1 encoding)
- \param[in] n optional number of characters to convert (default is all)
- \returns pointer to internal buffer containing converted characters
- */
-FL_EXPORT const char *fl_latin1_to_local(const char *t, int n=-1);
-/**
- Converts text from local encoding to Windowx/X11 latin1 character set.
- \param[in] t character string (local encoding)
- \param[in] n optional number of characters to convert (default is all)
- \returns pointer to internal buffer containing converted characters
- */
-FL_EXPORT const char *fl_local_to_latin1(const char *t, int n=-1);
-/**
- Converts text from Mac Roman character set to local encoding.
- \param[in] t character string (Mac Roman encoding)
- \param[in] n optional number of characters to convert (default is all)
- \returns pointer to internal buffer containing converted characters
- */
-FL_EXPORT const char *fl_mac_roman_to_local(const char *t, int n=-1);
-/**
- Converts text from local encoding to Mac Roman character set.
- \param[in] t character string (local encoding)
- \param[in] n optional number of characters to convert (default is all)
- \returns pointer to internal buffer containing converted characters
- */
-FL_EXPORT const char *fl_local_to_mac_roman(const char *t, int n=-1);
-/** @} */
-
-/** \addtogroup fl_drawings
- @{ */
-/**
- Draws a nul-terminated string starting at the given location.
-
- Text is aligned to the left and to the baseline of the font.
- To align to the bottom, subtract fl_descent() from \p y.
- To align to the top, subtract fl_descent() and add fl_height().
- This version of fl_draw provides direct access to the text drawing
- function of the underlying OS. It does not apply any special handling
- to control characters.
-*/
-FL_EXPORT void fl_draw(const char* str, int x, int y);
-/**
- Draws a nul-terminated string starting at the given location and
- rotating \p angle degrees counter-clockwise.
- This version of fl_draw provides direct access to the text drawing
- function of the underlying OS and is supported by Xft, Win32 and MacOS
- fltk subsets.
-*/
-FL_EXPORT void fl_draw(int angle, const char* str, int x, int y);
-/**
- Draws an array of \p n characters starting at the given location.
-*/
-inline void fl_draw(const char* str, int n, int x, int y) {fl_graphics_driver->draw(str,n,x,y); }
-/**
- Draws an array of \p n characters starting at the given location,
- rotating \p angle degrees counter-clockwise.
-*/
-inline void fl_draw(int angle,const char* str, int n, int x, int y) {fl_graphics_driver->draw(angle,str,n,x,y); }
-/**
- Draws an array of \p n characters right to left starting at given location.
-*/
-inline void fl_rtl_draw(const char* str, int n, int x, int y) {fl_graphics_driver->rtl_draw(str,n,x,y); }
-FL_EXPORT void fl_measure(const char* str, int& x, int& y,
- int draw_symbols = 1);
-FL_EXPORT void fl_draw(const char* str, int x, int y, int w, int h,
- Fl_Align align,
- Fl_Image* img=0, int draw_symbols = 1);
-FL_EXPORT void fl_draw(const char* str, int x, int y, int w, int h,
- Fl_Align align,
- void (*callthis)(const char *,int,int,int),
- Fl_Image* img=0, int draw_symbols = 1);
-
-// boxtypes:
-FL_EXPORT void fl_frame(const char* s, int x, int y, int w, int h);
-FL_EXPORT void fl_frame2(const char* s, int x, int y, int w, int h);
-FL_EXPORT void fl_draw_box(Fl_Boxtype, int x, int y, int w, int h, Fl_Color);
-
-// images:
-
-/**
- Draws an 8-bit per color RGB or luminance image.
- \param[in] buf points at the "r" data of the top-left pixel.
- Color data must be in <tt>r,g,b</tt> order.
- Luminance data is only one <tt>gray</tt> byte.
- \param[in] X,Y position where to put top-left corner of image
- \param[in] W,H size of the image
- \param[in] D delta to add to the pointer between pixels. It may be
- any value greater than or equal to 1, or it can be
- negative to flip the image horizontally
- \param[in] L delta to add to the pointer between lines (if 0 is
- passed it uses \p W * \p D), and may be larger than
- \p W * \p D to crop data, or negative to flip the
- image vertically
-
- It is highly recommended that you put the following code before the
- first <tt>show()</tt> of \e any window in your program to get rid of
- the dithering if possible:
- \code
- Fl::visual(FL_RGB);
- \endcode
-
- Gray scale (1-channel) images may be drawn. This is done if
- <tt>abs(D)</tt> is less than 3, or by calling fl_draw_image_mono().
- Only one 8-bit sample is used for each pixel, and on screens with
- different numbers of bits for red, green, and blue only gray colors
- are used. Setting \p D greater than 1 will let you display one channel
- of a color image.
-
- \par Note:
- The X version does not support all possible visuals. If FLTK cannot
- draw the image in the current visual it will abort. FLTK supports
- any visual of 8 bits or less, and all common TrueColor visuals up
- to 32 bits.
- */
-inline void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0)
- { fl_graphics_driver->draw_image(buf, X, Y, W, H, D, L); }
-
-/**
- Draws a gray-scale (1 channel) image.
- \see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L)
- */
-inline void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0)
- { fl_graphics_driver->draw_image_mono(buf, X, Y, W, H, D, L); }
-
-/**
- Draws an image using a callback function to generate image data.
-
- You can generate the image as it is being drawn, or do arbitrary
- decompression of stored data, provided it can be decompressed to
- individual scan lines easily.
- \param[in] cb callback function to generate scan line data
- \param[in] data user data passed to callback function
- \param[in] X,Y screen position of top left pixel
- \param[in] W,H image width and height
- \param[in] D data size in bytes (must be greater than 0)
- \see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L)
-
- The callback function \p cb is called with the <tt>void*</tt> \p data
- user data pointer to allow access to a structure of information about
- the image, and the \p x, \p y, and \p w of the scan line desired from
- the image. 0,0 is the upper-left corner of the image, not \p x, \p y.
- A pointer to a buffer to put the data into is passed. You must copy
- \p w pixels from scanline \p y, starting at pixel \p x, to this buffer.
-
- Due to cropping, less than the whole image may be requested. So \p x
- may be greater than zero, the first \p y may be greater than zero,
- and \p w may be less than \p W. The buffer is long enough to store
- the entire \p W * \p D pixels, this is for convenience with some
- decompression schemes where you must decompress the entire line at
- once: decompress it into the buffer, and then if \p x is not zero,
- copy the data over so the \p x'th pixel is at the start of the buffer.
-
- You can assume the \p y's will be consecutive, except the first one
- may be greater than zero.
-
- If \p D is 4 or more, you must fill in the unused bytes with zero.
- */
-inline void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3)
- { fl_graphics_driver->draw_image(cb, data, X, Y, W, H, D); }
-
-/**
- Draws a gray-scale image using a callback function to generate image data.
- \see fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D)
- */
-FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
-
-/**
- Checks whether platform supports true alpha blending for RGBA images.
- \returns 1 if true alpha blending supported by platform
- \returns 0 not supported so FLTK will use screen door transparency
- */
-/* note: doxygen comment here to avoid triplication in os-speciic files */
-FL_EXPORT char fl_can_do_alpha_blending();
-
-/**
- Reads an RGB(A) image from the current window or off-screen buffer.
- \param[in] p pixel buffer, or NULL to allocate one
- \param[in] X,Y position of top-left of image to read
- \param[in] W,H width and height of image to read
- \param[in] alpha alpha value for image (0 for none)
- \returns pointer to pixel buffer, or NULL if allocation failed.
-
- The \p p argument points to a buffer that can hold the image and must
- be at least \p W*H*3 bytes when reading RGB images, or \p W*H*4 bytes
- when reading RGBA images. If NULL, fl_read_image() will create an
- array of the proper size which can be freed using <tt>delete[]</tt>.
-
- The \p alpha parameter controls whether an alpha channel is created
- and the value that is placed in the alpha channel. If 0, no alpha
- channel is generated.
- */
-/* note: doxygen comment here to avoid triplication in os-speciic files */
-FL_EXPORT uchar *fl_read_image(uchar *p,int X,int Y,int W,int H,int alpha=0);
-
-// pixmaps:
-FL_EXPORT int fl_draw_pixmap(/*const*/ char* const* data, int x,int y,Fl_Color=FL_GRAY);
-FL_EXPORT int fl_draw_pixmap(const char* const* cdata, int x,int y,Fl_Color=FL_GRAY);
-FL_EXPORT int fl_measure_pixmap(/*const*/ char* const* data, int &w, int &h);
-FL_EXPORT int fl_measure_pixmap(const char* const* cdata, int &w, int &h);
-
-// other:
-FL_EXPORT void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
- void (*draw_area)(void*, int,int,int,int), void* data);
-FL_EXPORT const char* fl_shortcut_label(unsigned int shortcut);
-FL_EXPORT const char* fl_shortcut_label(unsigned int shortcut, const char **eom);
-FL_EXPORT unsigned int fl_old_shortcut(const char* s);
-FL_EXPORT void fl_overlay_rect(int x,int y,int w,int h);
-FL_EXPORT void fl_overlay_clear();
-FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color fg=FL_BLACK, Fl_Color bg=FL_WHITE);
-FL_EXPORT const char* fl_expand_text(const char* from, char* buf, int maxbuf,
- double maxw, int& n, double &width,
- int wrap, int draw_symbols = 0);
-
-// XIM:
-/** \todo provide user documentation for fl_set_status function */
-FL_EXPORT void fl_set_status(int X, int Y, int W, int H);
-/** \todo provide user documentation for fl_set_spot function */
-FL_EXPORT void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win=0);
-/** \todo provide user documentation for fl_reset_spot function*/
-FL_EXPORT void fl_reset_spot(void);
-
-
-
-// XForms symbols:
-FL_EXPORT int fl_draw_symbol(const char* label,int x,int y,int w,int h, Fl_Color);
-FL_EXPORT int fl_add_symbol(const char* name, void (*drawit)(Fl_Color), int scalable);
-/** @} */
-
-#endif
-
-//
-// End of "$Id: fl_draw.H 8772 2011-06-02 08:06:09Z manolo $".
-//
diff --git a/Libraries/FL/fl_message.H b/Libraries/FL/fl_message.H
deleted file mode 100644
index d07949e9..00000000
--- a/Libraries/FL/fl_message.H
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// "$Id: fl_message.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Standard message header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-#include "fl_ask.H"
-
-//
-// End of "$Id: fl_message.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/fl_show_colormap.H b/Libraries/FL/fl_show_colormap.H
deleted file mode 100644
index 762a3b4c..00000000
--- a/Libraries/FL/fl_show_colormap.H
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// "$Id: fl_show_colormap.H 8621 2011-04-23 15:46:30Z AlbrechtS $"
-//
-// Colormap picker header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/** \file
- The fl_show_colormap() function hides the implementation classes used
- to provide the popup window and color selection mechanism.
-*/
-
-#ifndef fl_show_colormap_H
-#define fl_show_colormap_H
-
-/* doxygen comment here to avoid exposing ColorMenu in fl_show_colormap.cxx
-*/
-
-/** \addtogroup fl_attributes
- @{ */
-
-/**
- \brief Pops up a window to let the user pick a colormap entry.
- \image html fl_show_colormap.png
- \image latex fl_show_colormap.png "fl_show_colormap" height=10cm
- \param[in] oldcol color to be highlighted when grid is shown.
- \retval Fl_Color value of the chosen colormap entry.
- \see Fl_Color_Chooser
-*/
-FL_EXPORT Fl_Color fl_show_colormap(Fl_Color oldcol);
-
-/** @} */
-
-#endif
-
-//
-// End of "$Id: fl_show_colormap.H 8621 2011-04-23 15:46:30Z AlbrechtS $".
-//
diff --git a/Libraries/FL/fl_show_input.H b/Libraries/FL/fl_show_input.H
deleted file mode 100644
index 2d931a41..00000000
--- a/Libraries/FL/fl_show_input.H
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// "$Id: fl_show_input.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// Standard input dialog header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-#include "fl_ask.H"
-
-//
-// End of "$Id: fl_show_input.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/fl_types.h b/Libraries/FL/fl_types.h
deleted file mode 100644
index c019821a..00000000
--- a/Libraries/FL/fl_types.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * "$Id: fl_types.h 7903 2010-11-28 21:06:39Z matt $"
- *
- * Simple "C"-style types for the Fast Light Tool Kit (FLTK).
- *
- * Copyright 1998-2010 by Bill Spitzak and others.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- * Please report all bugs and problems on the following page:
- *
- * http://www.fltk.org/str.php
- */
-
-/** \file
- * This file contains simple "C"-style type definitions.
- */
-
-#ifndef FL_TYPES_H
-#define FL_TYPES_H
-
-/** \name Miscellaneous */
-/*@{*/ /* group: Miscellaneous */
-
-/** unsigned char */
-typedef unsigned char uchar;
-/** unsigned long */
-typedef unsigned long ulong;
-
-/** Flexible length utf8 Unicode text
- *
- * \todo FIXME: temporary (?) typedef to mark UTF8 and Unicode conversions
- */
-typedef char *Fl_String;
-
-/** Flexible length utf8 Unicode read-only string
- * \sa Fl_String
- */
-typedef const char *Fl_CString;
-
-/** 24-bit Unicode character + 8-bit indicator for keyboard flags */
-typedef unsigned int Fl_Shortcut;
-
-/** 24-bit Unicode character - upper 8-bits are unused */
-typedef unsigned int Fl_Char;
-
-/*@}*/ /* group: Miscellaneous */
-
-#endif
-
-/*
- * End of "$Id: fl_types.h 7903 2010-11-28 21:06:39Z matt $".
- */
diff --git a/Libraries/FL/fl_utf8.h b/Libraries/FL/fl_utf8.h
deleted file mode 100644
index 311683eb..00000000
--- a/Libraries/FL/fl_utf8.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/* "$Id: fl_utf8.h 8585 2011-04-13 15:43:22Z ianmacarthur $"
- *
- * Author: Jean-Marc Lienher ( http://oksid.ch )
- * Copyright 2000-2010 by O'ksi'D.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- * Please report all bugs and problems on the following page:
- *
- * http://www.fltk.org/str.php
- */
-
-/* Merged in some functionality from the fltk-2 version. IMM.
- * The following code is an attempt to merge the functions incorporated in FLTK2
- * with the functions provided in OksiD's fltk-1.1.6-utf8 port
- */
-
-/**
- \file fl_utf8.h
- \brief header for Unicode and UTF8 chracter handling
-*/
-
-#ifndef _HAVE_FL_UTF8_HDR_
-#define _HAVE_FL_UTF8_HDR_
-
-#include "Fl_Export.H"
-#include "fl_types.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef WIN32
-# include <sys/types.h>
-# include <sys/stat.h>
-# include <locale.h>
-# include <ctype.h>
-# define xchar wchar_t
-# if !defined(FL_DLL) && !defined(__CYGWIN__)
-# undef strdup
-# define strdup _strdup
-# undef putenv
-# define putenv _putenv
-# undef stricmp
-# define stricmp _stricmp
-# undef strnicmp
-# define strnicmp _strnicmp
-# undef hypot
-# define hypot _hypot
-# undef chdir
-# define chdir _chdir
-# endif
-#elif defined(__APPLE__)
-# include <wchar.h>
-# include <sys/stat.h>
-# define xchar wchar_t
-#else /* X11 */
-# include <sys/types.h>
-# include <sys/stat.h>
-# include "Xutf8.h"
-# include <X11/Xlocale.h>
-# include <X11/Xlib.h>
-# include <locale.h>
-# define xchar unsigned short
-#endif
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-/** \addtogroup fl_unicode
- @{
-*/
-
-/* F2: comes from FLTK2 */
-/* OD: comes from OksiD */
-
-/**
- Return the number of bytes needed to encode the given UCS4 character in UTF8.
- \param [in] ucs UCS4 encoded character
- \return number of bytes required
- */
-FL_EXPORT int fl_utf8bytes(unsigned ucs);
-
-/* OD: returns the byte length of the first UTF-8 char sequence (returns -1 if not valid) */
-FL_EXPORT int fl_utf8len(char c);
-
-/* OD: returns the byte length of the first UTF-8 char sequence (returns +1 if not valid) */
-FL_EXPORT int fl_utf8len1(char c);
-
-/* OD: returns the number of Unicode chars in the UTF-8 string */
-FL_EXPORT int fl_utf_nb_char(const unsigned char *buf, int len);
-
-/* F2: Convert the next UTF8 char-sequence into a Unicode value (and say how many bytes were used) */
-FL_EXPORT unsigned fl_utf8decode(const char* p, const char* end, int* len);
-
-/* F2: Encode a Unicode value into a UTF8 sequence, return the number of bytes used */
-FL_EXPORT int fl_utf8encode(unsigned ucs, char* buf);
-
-/* F2: Move forward to the next valid UTF8 sequence start betwen start and end */
-FL_EXPORT const char* fl_utf8fwd(const char* p, const char* start, const char* end);
-
-/* F2: Move backward to the previous valid UTF8 sequence start */
-FL_EXPORT const char* fl_utf8back(const char* p, const char* start, const char* end);
-
-/* XX: Convert a single 32-bit Unicode value into UTF16 */
-FL_EXPORT unsigned fl_ucs_to_Utf16(const unsigned ucs, unsigned short *dst, const unsigned dstlen);
-
-/* F2: Convert a UTF8 string into UTF16 */
-FL_EXPORT unsigned fl_utf8toUtf16(const char* src, unsigned srclen, unsigned short* dst, unsigned dstlen);
-
-/* F2: Convert a UTF8 string into a wide character string - makes UTF16 on win32, "UCS4" elsewhere */
-FL_EXPORT unsigned fl_utf8towc(const char *src, unsigned srclen, wchar_t *dst, unsigned dstlen);
-
-/* F2: Convert a wide character string to UTF8 - takes in UTF16 on win32, "UCS4" elsewhere */
-FL_EXPORT unsigned fl_utf8fromwc(char *dst, unsigned dstlen, const wchar_t *src, unsigned srclen);
-
-/* F2: Convert a UTF8 string into ASCII, eliding untranslatable glyphs */
-FL_EXPORT unsigned fl_utf8toa (const char *src, unsigned srclen, char *dst, unsigned dstlen);
-/* OD: convert UTF-8 string to latin1 */
-/* FL_EXPORT int fl_utf2latin1(const unsigned char *src, int srclen, char *dst); */
-
-/* F2: Convert 8859-1 string to UTF8 */
-FL_EXPORT unsigned fl_utf8froma (char *dst, unsigned dstlen, const char *src, unsigned srclen);
-/* OD: convert latin1 str to UTF-8 */
-/* FL_EXPORT int fl_latin12utf(const unsigned char *src, int srclen, char *dst); */
-
-/* F2: Returns true if the current O/S locale is UTF8 */
-FL_EXPORT int fl_utf8locale();
-
-/* F2: Examine the first len characters of src, to determine if the input text is UTF8 or not
- * NOTE: The value returned is not simply boolean - it contains information about the probable
- * type of the src text. */
-FL_EXPORT int fl_utf8test(const char *src, unsigned len);
-
-/* XX: return width of "raw" ucs character in columns.
- * for internal use only */
-FL_EXPORT int fl_wcwidth_(unsigned int ucs);
-
-/* XX: return width of utf-8 character string in columns.
- * NOTE: this may also do C1 control character (0x80 to 0x9f) to CP1252 mapping,
- * depending on original build options */
-FL_EXPORT int fl_wcwidth(const char *src);
-
-/* OD: Return true if the character is non-spacing */
-FL_EXPORT unsigned int fl_nonspacing(unsigned int ucs);
-
-/* F2: Convert UTF8 to a local multi-byte encoding - mainly for win32? */
-FL_EXPORT unsigned fl_utf8to_mb(const char *src, unsigned srclen, char *dst, unsigned dstlen);
-/* OD: Convert UTF8 to a local multi-byte encoding */
-FL_EXPORT char* fl_utf2mbcs(const char *src);
-
-/* F2: Convert a local multi-byte encoding to UTF8 - mainly for win32? */
-FL_EXPORT unsigned fl_utf8from_mb(char *dst, unsigned dstlen, const char *src, unsigned srclen);
-/* OD: Convert a local multi-byte encoding to UTF8 */
-/* FL_EXPORT char* fl_mbcs2utf(const char *src); */
-
-/*****************************************************************************/
-#ifdef WIN32
-/* OD: Attempt to convert the UTF8 string to the current locale */
-FL_EXPORT char *fl_utf8_to_locale(const char *s, int len, unsigned int codepage);
-
-/* OD: Attempt to convert a string in the current locale to UTF8 */
-FL_EXPORT char *fl_locale_to_utf8(const char *s, int len, unsigned int codepage);
-#endif
-
-/*****************************************************************************
- * The following functions are intended to provide portable, UTF8 aware
- * versions of standard functions
- */
-
-/* OD: UTF8 aware strncasecmp - converts to lower case Unicode and tests */
-FL_EXPORT int fl_utf_strncasecmp(const char *s1, const char *s2, int n);
-
-/* OD: UTF8 aware strcasecmp - converts to Unicode and tests */
-FL_EXPORT int fl_utf_strcasecmp(const char *s1, const char *s2);
-
-/* OD: return the Unicode lower case value of ucs */
-FL_EXPORT int fl_tolower(unsigned int ucs);
-
-/* OD: return the Unicode upper case value of ucs */
-FL_EXPORT int fl_toupper(unsigned int ucs);
-
-/* OD: converts the UTF8 string to the lower case equivalent */
-FL_EXPORT int fl_utf_tolower(const unsigned char *str, int len, char *buf);
-
-/* OD: converts the UTF8 string to the upper case equivalent */
-FL_EXPORT int fl_utf_toupper(const unsigned char *str, int len, char *buf);
-
-/* OD: Portable UTF8 aware chmod wrapper */
-FL_EXPORT int fl_chmod(const char* f, int mode);
-
-/* OD: Portable UTF8 aware access wrapper */
-FL_EXPORT int fl_access(const char* f, int mode);
-
-/* OD: Portable UTF8 aware stat wrapper */
-FL_EXPORT int fl_stat( const char *path, struct stat *buffer );
-
-/* OD: Portable UTF8 aware getcwd wrapper */
-FL_EXPORT char* fl_getcwd( char *buf, int maxlen);
-
-/* OD: Portable UTF8 aware fopen wrapper */
-FL_EXPORT FILE *fl_fopen(const char *f, const char *mode);
-
-/* OD: Portable UTF8 aware system wrapper */
-FL_EXPORT int fl_system(const char* f);
-
-/* OD: Portable UTF8 aware execvp wrapper */
-FL_EXPORT int fl_execvp(const char *file, char *const *argv);
-
-/* OD: Portable UTF8 aware open wrapper */
-FL_EXPORT int fl_open(const char* f, int o, ...);
-
-/* OD: Portable UTF8 aware unlink wrapper */
-FL_EXPORT int fl_unlink(const char *f);
-
-/* OD: Portable UTF8 aware rmdir wrapper */
-FL_EXPORT int fl_rmdir(const char *f);
-
-/* OD: Portable UTF8 aware getenv wrapper */
-FL_EXPORT char* fl_getenv(const char *name);
-
-/* OD: Portable UTF8 aware execvp wrapper */
-FL_EXPORT int fl_mkdir(const char* f, int mode);
-
-/* OD: Portable UTF8 aware rename wrapper */
-FL_EXPORT int fl_rename(const char* f, const char *t);
-
-
-/* OD: Given a full pathname, this will create the directory path needed to hold the file named */
-FL_EXPORT void fl_make_path_for_file( const char *path );
-
-/* OD: recursively create a path in the file system */
-FL_EXPORT char fl_make_path( const char *path );
-
-
-/** @} */
-
-/*****************************************************************************/
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* _HAVE_FL_UTF8_HDR_ */
-
-/*
- * End of "$Id: fl_utf8.h 8585 2011-04-13 15:43:22Z ianmacarthur $".
- */
diff --git a/Libraries/FL/forms.H b/Libraries/FL/forms.H
deleted file mode 100644
index 3357fbc3..00000000
--- a/Libraries/FL/forms.H
+++ /dev/null
@@ -1,845 +0,0 @@
-//
-// "$Id: forms.H 8623 2011-04-24 17:09:41Z AlbrechtS $"
-//
-// Forms emulation header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-#ifndef __FORMS_H__
-#define __FORMS_H__
-
-#include "Fl.H"
-#include "Fl_Group.H"
-#include "Fl_Window.H"
-#include "fl_draw.H"
-
-typedef Fl_Widget FL_OBJECT;
-typedef Fl_Window FL_FORM;
-
-////////////////////////////////////////////////////////////////
-// Random constants & symbols defined by forms.h file:
-
-#ifndef NULL
-#define NULL 0
-#endif
-#ifndef FALSE
-#define FALSE 0
-#define TRUE 1
-#endif
-
-#define FL_ON 1
-#define FL_OK 1
-#define FL_VALID 1
-#define FL_PREEMPT 1
-#define FL_AUTO 2
-#define FL_WHEN_NEEDED FL_AUTO
-#define FL_OFF 0
-#define FL_NONE 0
-#define FL_CANCEL 0
-#define FL_INVALID 0
-#define FL_IGNORE -1
-//#define FL_CLOSE -2 // this variable is never used in FLTK Forms. It is removed becaus it conflicts with the window FL_CLOSE event
-
-#define FL_LCOL FL_BLACK
-#define FL_COL1 FL_GRAY
-#define FL_MCOL FL_LIGHT1
-#define FL_LEFT_BCOL FL_LIGHT3 // 53 is better match
-#define FL_TOP_BCOL FL_LIGHT2 // 51
-#define FL_BOTTOM_BCOL FL_DARK2 // 40
-#define FL_RIGHT_BCOL FL_DARK3 // 36
-#define FL_INACTIVE FL_INACTIVE_COLOR
-#define FL_INACTIVE_COL FL_INACTIVE_COLOR
-#define FL_FREE_COL1 FL_FREE_COLOR
-#define FL_FREE_COL2 ((Fl_Color)(FL_FREE_COLOR+1))
-#define FL_FREE_COL3 ((Fl_Color)(FL_FREE_COLOR+2))
-#define FL_FREE_COL4 ((Fl_Color)(FL_FREE_COLOR+3))
-#define FL_FREE_COL5 ((Fl_Color)(FL_FREE_COLOR+4))
-#define FL_FREE_COL6 ((Fl_Color)(FL_FREE_COLOR+5))
-#define FL_FREE_COL7 ((Fl_Color)(FL_FREE_COLOR+6))
-#define FL_FREE_COL8 ((Fl_Color)(FL_FREE_COLOR+7))
-#define FL_FREE_COL9 ((Fl_Color)(FL_FREE_COLOR+8))
-#define FL_FREE_COL10 ((Fl_Color)(FL_FREE_COLOR+9))
-#define FL_FREE_COL11 ((Fl_Color)(FL_FREE_COLOR+10))
-#define FL_FREE_COL12 ((Fl_Color)(FL_FREE_COLOR+11))
-#define FL_FREE_COL13 ((Fl_Color)(FL_FREE_COLOR+12))
-#define FL_FREE_COL14 ((Fl_Color)(FL_FREE_COLOR+13))
-#define FL_FREE_COL15 ((Fl_Color)(FL_FREE_COLOR+14))
-#define FL_FREE_COL16 ((Fl_Color)(FL_FREE_COLOR+15))
-#define FL_TOMATO ((Fl_Color)(131))
-#define FL_INDIANRED ((Fl_Color)(164))
-#define FL_SLATEBLUE ((Fl_Color)(195))
-#define FL_DARKGOLD ((Fl_Color)(84))
-#define FL_PALEGREEN ((Fl_Color)(157))
-#define FL_ORCHID ((Fl_Color)(203))
-#define FL_DARKCYAN ((Fl_Color)(189))
-#define FL_DARKTOMATO ((Fl_Color)(113))
-#define FL_WHEAT ((Fl_Color)(174))
-
-#define FL_ALIGN_BESIDE FL_ALIGN_INSIDE
-
-#define FL_PUP_TOGGLE 2 // FL_MENU_TOGGLE
-#define FL_PUP_INACTIVE 1 // FL_MENU_INACTIVE
-#define FL_NO_FRAME FL_NO_BOX
-#define FL_ROUNDED3D_UPBOX FL_ROUND_UP_BOX
-#define FL_ROUNDED3D_DOWNBOX FL_ROUND_DOWN_BOX
-#define FL_OVAL3D_UPBOX FL_ROUND_UP_BOX
-#define FL_OVAL3D_DOWNBOX FL_ROUND_DOWN_BOX
-
-#define FL_MBUTTON1 1
-#define FL_LEFTMOUSE 1
-#define FL_MBUTTON2 2
-#define FL_MIDDLEMOUSE 2
-#define FL_MBUTTON3 3
-#define FL_RIGHTMOUSE 3
-#define FL_MBUTTON4 4
-#define FL_MBUTTON5 5
-
-#define FL_INVALID_STYLE 255
-#define FL_NORMAL_STYLE FL_HELVETICA
-#define FL_BOLD_STYLE FL_HELVETICA_BOLD
-#define FL_ITALIC_STYLE FL_HELVETICA_ITALIC
-#define FL_BOLDITALIC_STYLE FL_HELVETICA_BOLD_ITALIC
-#define FL_FIXED_STYLE FL_COURIER
-#define FL_FIXEDBOLD_STYLE FL_COURIER_BOLD
-#define FL_FIXEDITALIC_STYLE FL_COURIER_ITALIC
-#define FL_FIXEDBOLDITALIC_STYLE FL_COURIER_BOLD_ITALIC
-#define FL_TIMES_STYLE FL_TIMES
-#define FL_TIMESBOLD_STYLE FL_TIMES_BOLD
-#define FL_TIMESITALIC_STYLE FL_TIMES_ITALIC
-#define FL_TIMESBOLDITALIC_STYLE FL_TIMES_BOLD_ITALIC
-
-// hacks to change the labeltype() when passed to fl_set_object_lstyle():
-#define FL_SHADOW_STYLE (FL_SHADOW_LABEL<<8)
-#define FL_ENGRAVED_STYLE (FL_ENGRAVED_LABEL<<8)
-#define FL_EMBOSSED_STYLE (FL_EMBOSSED_LABEL<<0)
-
-// size values are different from XForms, match older Forms:
-#define FL_TINY_SIZE 8
-#define FL_SMALL_SIZE 11 // 10
-//#define FL_NORMAL_SIZE 14 // 12
-#define FL_MEDIUM_SIZE 18 // 14
-#define FL_LARGE_SIZE 24 // 18
-#define FL_HUGE_SIZE 32 // 24
-#define FL_DEFAULT_SIZE FL_SMALL_SIZE
-#define FL_TINY_FONT FL_TINY_SIZE
-#define FL_SMALL_FONT FL_SMALL_SIZE
-#define FL_NORMAL_FONT FL_NORMAL_SIZE
-#define FL_MEDIUM_FONT FL_MEDIUM_SIZE
-#define FL_LARGE_FONT FL_LARGE_SIZE
-#define FL_HUGE_FONT FL_HUGE_SIZE
-#define FL_NORMAL_FONT1 FL_SMALL_FONT
-#define FL_NORMAL_FONT2 FL_NORMAL_FONT
-#define FL_DEFAULT_FONT FL_SMALL_FONT
-
-#define FL_RETURN_END_CHANGED FL_WHEN_RELEASE
-#define FL_RETURN_CHANGED FL_WHEN_CHANGED
-#define FL_RETURN_END FL_WHEN_RELEASE_ALWAYS
-#define FL_RETURN_ALWAYS (FL_WHEN_CHANGED|FL_WHEN_NOT_CHANGED)
-
-#define FL_BOUND_WIDTH 3
-
-typedef int FL_Coord;
-typedef int FL_COLOR;
-
-////////////////////////////////////////////////////////////////
-// fltk interaction:
-
-#define FL_CMD_OPT void
-extern FL_EXPORT void fl_initialize(int*, char*[], const char*, FL_CMD_OPT*, int);
-inline void fl_finish() {}
-
-typedef void (*FL_IO_CALLBACK) (int, void*);
-inline void fl_add_io_callback(int fd, short w, FL_IO_CALLBACK cb, void* v) {
- Fl::add_fd(fd,w,cb,v);}
-inline void fl_remove_io_callback(int fd, short, FL_IO_CALLBACK) {
- Fl::remove_fd(fd);} // removes all the callbacks!
-
-// type of callback is different and no "id" number is returned:
-inline void fl_add_timeout(long msec, void (*cb)(void*), void* v) {
- Fl::add_timeout(msec*.001, cb, v);}
-inline void fl_remove_timeout(int) {}
-
-// type of callback is different!
-inline void fl_set_idle_callback(void (*cb)()) {Fl::set_idle(cb);}
-
-FL_EXPORT Fl_Widget* fl_do_forms(void);
-FL_EXPORT Fl_Widget* fl_check_forms();
-inline Fl_Widget* fl_do_only_forms(void) {return fl_do_forms();}
-inline Fl_Widget* fl_check_only_forms(void) {return fl_check_forms();}
-
-// because of new redraw behavior, these are no-ops:
-inline void fl_freeze_object(Fl_Widget*) {}
-inline void fl_unfreeze_object(Fl_Widget*) {}
-inline void fl_freeze_form(Fl_Window*) {}
-inline void fl_unfreeze_form(Fl_Window*) {}
-inline void fl_freeze_all_forms() {}
-inline void fl_unfreeze_all_forms() {}
-
-inline void fl_set_focus_object(Fl_Window*, Fl_Widget* o) {Fl::focus(o);}
-inline void fl_reset_focus_object(Fl_Widget* o) {Fl::focus(o);}
-#define fl_set_object_focus fl_set_focus_object
-
-// void fl_set_form_atclose(Fl_Window*w,int (*cb)(Fl_Window*,void*),void* v)
-// void fl_set_atclose(int (*cb)(Fl_Window*,void*),void*)
-// fl_set_form_atactivate/atdeactivate not implemented!
-
-////////////////////////////////////////////////////////////////
-// Fl_Widget:
-
-inline void fl_set_object_boxtype(Fl_Widget* o, Fl_Boxtype a) {o->box(a);}
-inline void fl_set_object_lsize(Fl_Widget* o,int s) {o->labelsize(s);}
-
-/* forms lib font indexes must be byte sized - extract correct byte from style word */
-inline void fl_set_object_lstyle(Fl_Widget* o,int a) {
- o->labelfont((Fl_Font)(a&0xff)); o->labeltype((Fl_Labeltype)(a>>8));}
-inline void fl_set_object_lcol(Fl_Widget* o, Fl_Color a) {o->labelcolor(a);}
-#define fl_set_object_lcolor fl_set_object_lcol
-inline void fl_set_object_lalign(Fl_Widget* o, Fl_Align a) {o->align(a);}
-#define fl_set_object_align fl_set_object_lalign
-inline void fl_set_object_color(Fl_Widget* o,Fl_Color a,Fl_Color b) {o->color(a,b);}
-inline void fl_set_object_label(Fl_Widget* o, const char* a) {o->label(a); o->redraw();}
-inline void fl_set_object_position(Fl_Widget*o,int x,int y) {o->position(x,y);}
-inline void fl_set_object_size(Fl_Widget* o, int w, int h) {o->size(w,h);}
-inline void fl_set_object_geometry(Fl_Widget* o,int x,int y,int w,int h) {o->resize(x,y,w,h);}
-
-inline void fl_get_object_geometry(Fl_Widget* o,int*x,int*y,int*w,int*h) {
- *x = o->x(); *y = o->y(); *w = o->w(); *h = o->h();}
-inline void fl_get_object_position(Fl_Widget* o,int*x,int*y) {
- *x = o->x(); *y = o->y();}
-
-typedef void (*Forms_CB)(Fl_Widget*, long);
-inline void fl_set_object_callback(Fl_Widget*o,Forms_CB c,long a) {o->callback(c,a);}
-#define fl_set_call_back fl_set_object_callback
-inline void fl_call_object_callback(Fl_Widget* o) {o->do_callback();}
-inline void fl_trigger_object(Fl_Widget* o) {o->do_callback();}
-inline void fl_set_object_return(Fl_Widget* o, int v) {
- o->when((Fl_When)(v|FL_WHEN_RELEASE));}
-
-inline void fl_redraw_object(Fl_Widget* o) {o->redraw();}
-inline void fl_show_object(Fl_Widget* o) {o->show();}
-inline void fl_hide_object(Fl_Widget* o) {o->hide();}
-inline void fl_free_object(Fl_Widget* x) {delete x;}
-inline void fl_delete_object(Fl_Widget* o) {o->parent()->remove(*o);}
-inline void fl_activate_object(Fl_Widget* o) {o->activate();}
-inline void fl_deactivate_object(Fl_Widget* o) {o->deactivate();}
-
-inline void fl_add_object(Fl_Window* f, Fl_Widget* x) {f->add(x);}
-inline void fl_insert_object(Fl_Widget* o, Fl_Widget* b) {b->parent()->insert(*o,b);}
-
-inline Fl_Window* FL_ObjWin(Fl_Widget* o) {return o->window();}
-
-////////////////////////////////////////////////////////////////
-// things that appered in the demos a lot that I don't emulate, but
-// I did not want to edit out of all the demos...
-
-inline int fl_get_border_width() {return 3;}
-inline void fl_set_border_width(int) {}
-inline void fl_set_object_dblbuffer(Fl_Widget*, int) {}
-inline void fl_set_form_dblbuffer(Fl_Window*, int) {}
-
-////////////////////////////////////////////////////////////////
-// Fl_Window:
-
-inline void fl_free_form(Fl_Window* x) {delete x;}
-inline void fl_redraw_form(Fl_Window* f) {f->redraw();}
-
-inline Fl_Window* fl_bgn_form(Fl_Boxtype b,int w,int h) {
- Fl_Window* g = new Fl_Window(w,h,0);
- g->box(b);
- return g;
-}
-FL_EXPORT void fl_end_form();
-inline void fl_addto_form(Fl_Window* f) {f->begin();}
-inline Fl_Group* fl_bgn_group() {return new Fl_Group(0,0,0,0,0);}
-inline void fl_end_group() {Fl_Group::current()->forms_end();}
-inline void fl_addto_group(Fl_Widget* o) {((Fl_Group* )o)->begin();}
-#define resizebox _ddfdesign_kludge()
-
-inline void fl_scale_form(Fl_Window* f, double x, double y) {
- f->resizable(f); f->size(int(f->w()*x),int(f->h()*y));}
-inline void fl_set_form_position(Fl_Window* f,int x,int y) {f->position(x,y);}
-inline void fl_set_form_size(Fl_Window* f, int w, int h) {f->size(w,h);}
-inline void fl_set_form_geometry(Fl_Window* f,int x,int y,int w,int h) {
- f->resize(x,y,w,h);}
-#define fl_set_initial_placement fl_set_form_geometry
-inline void fl_adjust_form_size(Fl_Window*) {}
-
-FL_EXPORT void fl_show_form(Fl_Window* f,int p,int b,const char* n);
-enum { // "p" argument values:
- FL_PLACE_FREE = 0, // make resizable
- FL_PLACE_MOUSE = 1, // mouse centered on form
- FL_PLACE_CENTER = 2, // center of the screen
- FL_PLACE_POSITION = 4,// fixed position, resizable
- FL_PLACE_SIZE = 8, // fixed size, normal fltk behavior
- FL_PLACE_GEOMETRY =16,// fixed size and position
- FL_PLACE_ASPECT = 32, // keep aspect ratio (ignored)
- FL_PLACE_FULLSCREEN=64,// fill screen
- FL_PLACE_HOTSPOT = 128,// enables hotspot
- FL_PLACE_ICONIC = 256,// iconic (ignored)
- FL_FREE_SIZE=(1<<14), // force resizable
- FL_FIX_SIZE =(1<<15) // force off resizable
-};
-#define FL_PLACE_FREE_CENTER (FL_PLACE_CENTER|FL_FREE_SIZE)
-#define FL_PLACE_CENTERFREE (FL_PLACE_CENTER|FL_FREE_SIZE)
-enum { // "b" arguement values:
- FL_NOBORDER = 0,
- FL_FULLBORDER,
- FL_TRANSIENT
-//FL_MODAL = (1<<8) // not implemented yet in Forms
-};
-inline void fl_set_form_hotspot(Fl_Window* w,int x,int y) {w->hotspot(x,y);}
-inline void fl_set_form_hotobject(Fl_Window* w, Fl_Widget* o) {w->hotspot(o);}
-extern FL_EXPORT char fl_flip; // in forms.C
-inline void fl_flip_yorigin() {fl_flip = 1;}
-
-#define fl_prepare_form_window fl_show_form
-inline void fl_show_form_window(Fl_Window*) {}
-
-inline void fl_raise_form(Fl_Window* f) {f->show();}
-
-inline void fl_hide_form(Fl_Window* f) {f->hide();}
-inline void fl_pop_form(Fl_Window* f) {f->show();}
-
-extern FL_EXPORT char fl_modal_next; // in forms.C
-inline void fl_activate_all_forms() {}
-inline void fl_deactivate_all_forms() {fl_modal_next = 1;}
-inline void fl_deactivate_form(Fl_Window*w) {w->deactivate();}
-inline void fl_activate_form(Fl_Window*w) {w->activate();}
-
-inline void fl_set_form_title(Fl_Window* f, const char* s) {f->label(s);}
-inline void fl_title_form(Fl_Window* f, const char* s) {f->label(s);}
-
-typedef void (*Forms_FormCB)(Fl_Widget*);
-inline void fl_set_form_callback(Fl_Window* f,Forms_FormCB c) {f->callback(c);}
-#define fl_set_form_call_back fl_set_form_callback
-
-inline void fl_init() {}
-FL_EXPORT void fl_set_graphics_mode(int,int);
-
-inline int fl_form_is_visible(Fl_Window* f) {return f->visible();}
-
-inline int fl_mouse_button() {return Fl::event_button();}
-#define fl_mousebutton fl_mouse_button
-
-#define fl_free free
-#define fl_malloc malloc
-#define fl_calloc calloc
-#define fl_realloc realloc
-
-////////////////////////////////////////////////////////////////
-// Drawing functions. Only usable inside an Fl_Free object?
-
-inline void fl_drw_box(Fl_Boxtype b,int x,int y,int w,int h,Fl_Color bgc,int=3) {
- fl_draw_box(b,x,y,w,h,bgc);}
-inline void fl_drw_frame(Fl_Boxtype b,int x,int y,int w,int h,Fl_Color bgc,int=3) {
- fl_draw_box(b,x,y,w,h,bgc);}
-
-inline void fl_drw_text(Fl_Align align, int x, int y, int w, int h,
- Fl_Color fgcolor, int size, Fl_Font style,
- const char* s) {
- fl_font(style,size);
- fl_color(fgcolor);
- fl_draw(s,x,y,w,h,align);
-}
-
-// this does not work except for CENTER...
-inline void fl_drw_text_beside(Fl_Align align, int x, int y, int w, int h,
- Fl_Color fgcolor, int size, Fl_Font style,
- const char* s) {
- fl_font(style,size);
- fl_color(fgcolor);
- fl_draw(s,x,y,w,h,align);
-}
-
-inline void fl_set_font_name(Fl_Font n,const char* s) {Fl::set_font(n,s);}
-
-inline void fl_mapcolor(Fl_Color c, uchar r, uchar g, uchar b) {Fl::set_color(c,r,g,b);}
-
-#define fl_set_clipping(x,y,w,h) fl_push_clip(x,y,w,h)
-#define fl_unset_clipping() fl_pop_clip()
-
-////////////////////////////////////////////////////////////////
-// Forms classes:
-
-inline Fl_Widget* fl_add_new(Fl_Widget* p) {return p;}
-inline Fl_Widget* fl_add_new(uchar t,Fl_Widget* p) {p->type(t); return p;}
-
-#define forms_constructor(type,name) \
-inline type* name(uchar t,int x,int y,int w,int h,const char* l) { \
- return (type*)(fl_add_new(t, new type(x,y,w,h,l)));}
-#define forms_constructort(type,name) \
-inline type* name(uchar t,int x,int y,int w,int h,const char* l) { \
- return (type*)(fl_add_new(new type(t,x,y,w,h,l)));}
-#define forms_constructorb(type,name) \
-inline type* name(Fl_Boxtype t,int x,int y,int w,int h,const char* l) { \
- return (type*)(fl_add_new(new type(t,x,y,w,h,l)));}
-
-#include "Fl_FormsBitmap.H"
-#define FL_NORMAL_BITMAP FL_NO_BOX
-forms_constructorb(Fl_FormsBitmap, fl_add_bitmap)
-inline void fl_set_bitmap_data(Fl_Widget* o, int w, int h, const uchar* b) {
- ((Fl_FormsBitmap*)o)->set(w,h,b);
-}
-
-#include "Fl_FormsPixmap.H"
-#define FL_NORMAL_PIXMAP FL_NO_BOX
-forms_constructorb(Fl_FormsPixmap, fl_add_pixmap)
-inline void fl_set_pixmap_data(Fl_Widget* o, char*const* b) {
- ((Fl_FormsPixmap*)o)->set(b);
-}
-//inline void fl_set_pixmap_file(Fl_Widget*, const char*);
-inline void fl_set_pixmap_align(Fl_Widget* o,Fl_Align a,int,int) {o->align(a);}
-//inline void fl_set_pixmap_colorcloseness(int, int, int);
-
-#include "Fl_Box.H"
-forms_constructorb(Fl_Box, fl_add_box)
-
-#include "Fl_Browser.H"
-forms_constructor(Fl_Browser, fl_add_browser)
-
-inline void fl_clear_browser(Fl_Widget* o) {
- ((Fl_Browser*)o)->clear();}
-inline void fl_add_browser_line(Fl_Widget* o, const char* s) {
- ((Fl_Browser*)o)->add(s);}
-inline void fl_addto_browser(Fl_Widget* o, const char* s) {
- ((Fl_Browser*)o)->add(s);} /* should also scroll to bottom */
-//inline void fl_addto_browser_chars(Fl_Widget*, const char*)
-//#define fl_append_browser fl_addto_browser_chars
-inline void fl_insert_browser_line(Fl_Widget* o, int n, const char* s) {
- ((Fl_Browser*)o)->insert(n,s);}
-inline void fl_delete_browser_line(Fl_Widget* o, int n) {
- ((Fl_Browser*)o)->remove(n);}
-inline void fl_replace_browser_line(Fl_Widget* o, int n, const char* s) {
- ((Fl_Browser*)o)->replace(n,s);}
-inline char* fl_get_browser_line(Fl_Widget* o, int n) {
- return (char*)(((Fl_Browser*)o)->text(n));}
-inline int fl_load_browser(Fl_Widget* o, const char* f) {
- return ((Fl_Browser*)o)->load(f);}
-inline void fl_select_browser_line(Fl_Widget* o, int n) {
- ((Fl_Browser*)o)->select(n,1);}
-inline void fl_deselect_browser_line(Fl_Widget* o, int n) {
- ((Fl_Browser*)o)->select(n,0);}
-inline void fl_deselect_browser(Fl_Widget* o) {
- ((Fl_Browser*)o)->deselect();}
-inline int fl_isselected_browser_line(Fl_Widget* o, int n) {
- return ((Fl_Browser*)o)->selected(n);}
-inline int fl_get_browser_topline(Fl_Widget* o) {
- return ((Fl_Browser*)o)->topline();}
-inline int fl_get_browser(Fl_Widget* o) {
- return ((Fl_Browser*)o)->value();}
-inline int fl_get_browser_maxline(Fl_Widget* o) {
- return ((Fl_Browser*)o)->size();}
-//linline int fl_get_browser_screenlines(Fl_Widget*);
-inline void fl_set_browser_topline(Fl_Widget* o, int n) {
- ((Fl_Browser*)o)->topline(n);}
-inline void fl_set_browser_fontsize(Fl_Widget* o, int s) {
- ((Fl_Browser*)o)->textsize(s);}
-inline void fl_set_browser_fontstyle(Fl_Widget* o, Fl_Font s) {
- ((Fl_Browser*)o)->textfont(s);}
-inline void fl_set_browser_specialkey(Fl_Widget* o, char c) {
- ((Fl_Browser*)o)->format_char(c);}
-//inline void fl_set_browser_vscrollbar(Fl_Widget*, int);
-//inline void fl_set_browser_hscrollbar(Fl_Widget*, int);
-//inline void fl_set_browser_leftslider(Fl_Widget*, int);
-//#define fl_set_browser_leftscrollbar fl_set_browser_leftslider
-//inline void fl_set_browser_line_selectable(Fl_Widget*, int, int);
-//inline void fl_get_browser_dimension(Fl_Widget*,int*,int*,int*,int*);
-//inline void fl_set_browser_dblclick_callback(Fl_Widget*,FL_CALLBACKPTR,long);
-//inline void fl_set_browser_xoffset(Fl_Widget*, FL_Coord);
-//inline void fl_set_browser_scrollbarsize(Fl_Widget*, int, int);
-inline void fl_setdisplayed_browser_line(Fl_Widget* o, int n, int i) {
- ((Fl_Browser*)o)->display(n,i);}
-inline int fl_isdisplayed_browser_line(Fl_Widget* o, int n) {
- return ((Fl_Browser*)o)->displayed(n);}
-
-#include "Fl_Button.H"
-
-#define FL_NORMAL_BUTTON 0
-#define FL_TOUCH_BUTTON 4
-#define FL_INOUT_BUTTON 5
-#define FL_RETURN_BUTTON 6
-#define FL_HIDDEN_RET_BUTTON 7
-#define FL_PUSH_BUTTON FL_TOGGLE_BUTTON
-#define FL_MENU_BUTTON 9
-
-FL_EXPORT Fl_Button* fl_add_button(uchar t,int x,int y,int w,int h,const char* l);
-inline int fl_get_button(Fl_Widget* b) {return ((Fl_Button*)b)->value();}
-inline void fl_set_button(Fl_Widget* b, int v) {((Fl_Button*)b)->value(v);}
-inline int fl_get_button_numb(Fl_Widget*) {return Fl::event_button();}
-inline void fl_set_button_shortcut(Fl_Widget* b, const char* s,int=0) {
- ((Fl_Button*)b)->shortcut(s);}
-//#define fl_set_object_shortcut(b,s) fl_set_button_shortcut(b,s)
-
-#include "Fl_Light_Button.H"
-forms_constructor(Fl_Light_Button, fl_add_lightbutton)
-
-#include "Fl_Round_Button.H"
-forms_constructor(Fl_Round_Button, fl_add_roundbutton)
-forms_constructor(Fl_Round_Button, fl_add_round3dbutton)
-
-#include "Fl_Check_Button.H"
-forms_constructor(Fl_Check_Button, fl_add_checkbutton)
-
-inline Fl_Widget* fl_add_bitmapbutton(int t,int x,int y,int w,int h,const char* l) {Fl_Widget* o = fl_add_button(t,x,y,w,h,l); return o;}
-inline void fl_set_bitmapbutton_data(Fl_Widget* o,int a,int b,uchar* c) {
- (new Fl_Bitmap(c,a,b))->label(o);} // does not delete old Fl_Bitmap!
-
-inline Fl_Widget* fl_add_pixmapbutton(int t,int x,int y,int w,int h,const char* l) {Fl_Widget* o = fl_add_button(t,x,y,w,h,l); return o;}
-inline void fl_set_pixmapbutton_data(Fl_Widget* o, const char*const* c) {
- (new Fl_Pixmap(c))->label(o);} // does not delete old Fl_Pixmap!
-
-// Fl_Canvas object not yet implemented!
-
-#include "Fl_Chart.H"
-
-forms_constructor(Fl_Chart, fl_add_chart)
-inline void fl_clear_chart(Fl_Widget* o) {
- ((Fl_Chart*)o)->clear();}
-inline void fl_add_chart_value(Fl_Widget* o,double v,const char* s,uchar c){
- ((Fl_Chart*)o)->add(v,s,c);}
-inline void fl_insert_chart_value(Fl_Widget* o, int i, double v, const char* s, uchar c) {
- ((Fl_Chart*)o)->insert(i,v,s,c);}
-inline void fl_replace_chart_value(Fl_Widget* o, int i, double v, const char* s, uchar c) {
- ((Fl_Chart*)o)->replace(i,v,s,c);}
-inline void fl_set_chart_bounds(Fl_Widget* o, double a, double b) {
- ((Fl_Chart*)o)->bounds(a,b);}
-inline void fl_set_chart_maxnumb(Fl_Widget* o, int v) {
- ((Fl_Chart*)o)->maxsize(v);}
-inline void fl_set_chart_autosize(Fl_Widget* o, int v) {
- ((Fl_Chart*)o)->autosize(v);}
-inline void fl_set_chart_lstyle(Fl_Widget* o, Fl_Font v) {
- ((Fl_Chart*)o)->textfont(v);}
-inline void fl_set_chart_lsize(Fl_Widget* o, int v) {
- ((Fl_Chart*)o)->textsize(v);}
-inline void fl_set_chart_lcolor(Fl_Widget* o, Fl_Color v) {
- ((Fl_Chart*)o)->textcolor(v);}
-#define fl_set_chart_lcol fl_set_chart_lcolor
-
-#include "Fl_Choice.H"
-
-#define FL_NORMAL_CHOICE 0
-#define FL_NORMAL_CHOICE2 0
-#define FL_DROPLIST_CHOICE 0
-
-forms_constructor(Fl_Choice, fl_add_choice)
-inline void fl_clear_choice(Fl_Widget* o) {
- ((Fl_Choice*)o)->clear();}
-inline void fl_addto_choice(Fl_Widget* o, const char* s) {
- ((Fl_Choice*)o)->add(s);}
-inline void fl_replace_choice(Fl_Widget* o, int i, const char* s) {
- ((Fl_Choice*)o)->replace(i-1,s);}
-inline void fl_delete_choice(Fl_Widget* o, int i) {
- ((Fl_Choice*)o)->remove(i-1);}
-inline void fl_set_choice(Fl_Widget* o, int i) {
- ((Fl_Choice*)o)->value(i-1);}
-// inline void fl_set_choice_text(Fl_Widget*, const char*);
-inline int fl_get_choice(Fl_Widget* o) {
- return ((Fl_Choice*)o)->value()+1;}
-// inline const char* fl_get_choice_item_text(Fl_Widget*, int);
-// inline int fl_get_choice_maxitems(Fl_Widget*);
-inline const char* fl_get_choice_text(Fl_Widget* o) {
- return ((Fl_Choice*)o)->text();}
-inline void fl_set_choice_fontsize(Fl_Widget* o, int x) {
- ((Fl_Choice*)o)->textsize(x);}
-inline void fl_set_choice_fontstyle(Fl_Widget* o, Fl_Font x) {
- ((Fl_Choice*)o)->textfont(x);}
-// inline void fl_set_choice_item_mode(Fl_Widget*, int, unsigned);
-// inline void fl_set_choice_item_shortcut(Fl_Widget*, int, const char*);
-
-#include "Fl_Clock.H"
-forms_constructort(Fl_Clock, fl_add_clock)
-inline void fl_get_clock(Fl_Widget* o, int* h, int* m, int* s) {
- *h = ((Fl_Clock*)o)->hour();
- *m = ((Fl_Clock*)o)->minute();
- *s = ((Fl_Clock*)o)->second();
-}
-
-#include "Fl_Counter.H"
-forms_constructor(Fl_Counter, fl_add_counter)
-inline void fl_set_counter_value(Fl_Widget* o, double v) {
- ((Fl_Counter*)o)->value(v);}
-inline void fl_set_counter_bounds(Fl_Widget* o, double a, double b) {
- ((Fl_Counter*)o)->bounds(a,b);}
-inline void fl_set_counter_step(Fl_Widget* o, double a, double b) {
- ((Fl_Counter*)o)->step(a,b);}
-inline void fl_set_counter_precision(Fl_Widget* o, int v) {
- ((Fl_Counter*)o)->precision(v);}
-inline void fl_set_counter_return(Fl_Widget* o, int v) {
- ((Fl_Counter*)o)->when((Fl_When)(v|FL_WHEN_RELEASE));}
-inline double fl_get_counter_value(Fl_Widget* o) {
- return ((Fl_Counter*)o)->value();}
-inline void fl_get_counter_bounds(Fl_Widget* o, float* a, float* b) {
- *a = float(((Fl_Counter*)o)->minimum());
- *b = float(((Fl_Counter*)o)->maximum());
-}
-//inline void fl_set_counter_filter(Fl_Widget*,const char* (*)(Fl_Widget*,double,int));
-
-// Cursor stuff cannot be emulated because it uses X stuff
-inline void fl_set_cursor(Fl_Window* w, Fl_Cursor c) {w->cursor(c);}
-#define FL_INVISIBLE_CURSOR FL_CURSOR_NONE
-#define FL_DEFAULT_CURSOR FL_CURSOR_DEFAULT
-
-#include "Fl_Dial.H"
-
-#define FL_DIAL_COL1 FL_GRAY
-#define FL_DIAL_COL2 37
-
-forms_constructor(Fl_Dial, fl_add_dial)
-inline void fl_set_dial_value(Fl_Widget* o, double v) {
- ((Fl_Dial*)o)->value(v);}
-inline double fl_get_dial_value(Fl_Widget* o) {
- return ((Fl_Dial*)o)->value();}
-inline void fl_set_dial_bounds(Fl_Widget* o, double a, double b) {
- ((Fl_Dial*)o)->bounds(a, b);}
-inline void fl_get_dial_bounds(Fl_Widget* o, float* a, float* b) {
- *a = float(((Fl_Dial*)o)->minimum());
- *b = float(((Fl_Dial*)o)->maximum());
-}
-inline void fl_set_dial_return(Fl_Widget* o, int i) {
- ((Fl_Dial*)o)->when((Fl_When)(i|FL_WHEN_RELEASE));}
-inline void fl_set_dial_angles(Fl_Widget* o, int a, int b) {
- ((Fl_Dial*)o)->angles((short)a, (short)b);}
-//inline void fl_set_dial_cross(Fl_Widget* o, int);
-// inline void fl_set_dial_direction(Fl_Widget* o, uchar d) {
-// ((Fl_Dial*)o)->direction(d);}
-inline void fl_set_dial_step(Fl_Widget* o, double v) {
- ((Fl_Dial*)o)->step(v);}
-
-// Frames:
-
-inline Fl_Widget* fl_add_frame(Fl_Boxtype i,int x,int y,int w,int h,const char* l) {
- return fl_add_box(i,x-3,y-3,w+6,h+6,l);}
-
-// labelframe nyi
-inline Fl_Widget* fl_add_labelframe(Fl_Boxtype i,int x,int y,int w,int h,const char* l) {
- Fl_Widget* o = fl_add_box(i,x-3,y-3,w+6,h+6,l);
- o->align(FL_ALIGN_TOP_LEFT);
- return o;
-}
-
-#include "Fl_Free.H"
-inline Fl_Free*
-fl_add_free(int t,double x,double y,double w,double h,const char* l,
- FL_HANDLEPTR hdl) {
- return (Fl_Free*)(fl_add_new(
- new Fl_Free(t,int(x),int(y),int(w),int(h),l,hdl)));
-}
-
-#include "fl_ask.H"
-#include "fl_show_colormap.H"
-
-inline int fl_show_question(const char* c, int = 0) {return fl_choice("%s",fl_no,fl_yes,0L,c);}
-FL_EXPORT void fl_show_message(const char *,const char *,const char *);
-FL_EXPORT void fl_show_alert(const char *,const char *,const char *,int=0);
-FL_EXPORT int fl_show_question(const char *,const char *,const char *);
-inline const char *fl_show_input(const char *l,const char*d=0) {return fl_input("%s",d,l);}
-FL_EXPORT /*const*/ char *fl_show_simple_input(const char *label, const char *deflt = 0);
-FL_EXPORT int fl_show_choice(
- const char *m1,
- const char *m2,
- const char *m3,
- int numb,
- const char *b0,
- const char *b1,
- const char *b2);
-
-inline void fl_set_goodies_font(Fl_Font a, Fl_Fontsize b) {fl_message_font(a,b);}
-#define fl_show_messages fl_message
-inline int fl_show_choices(const char* c,int n,const char* b1,const char* b2,
- const char* b3, int) {
- return fl_show_choice(0,c,0,n,b1,b2,b3);
-}
-
-#include "filename.H"
-#include "Fl_File_Chooser.H"
-inline int do_matching(char* a, const char* b) {return fl_filename_match(a,b);}
-
-// Forms-compatible file chooser (implementation in fselect.C):
-FL_EXPORT char* fl_show_file_selector(const char* message,const char* dir,
- const char* pat,const char* fname);
-FL_EXPORT char* fl_get_directory();
-FL_EXPORT char* fl_get_pattern();
-FL_EXPORT char* fl_get_filename();
-
-#include "Fl_Input.H"
-forms_constructor(Fl_Input, fl_add_input)
-inline void fl_set_input(Fl_Widget* o, const char* v) {
- ((Fl_Input*)o)->value(v);}
-inline void fl_set_input_return(Fl_Widget* o, int x) {
- ((Fl_Input*)o)->when((Fl_When)(x | FL_WHEN_RELEASE));}
-inline void fl_set_input_color(Fl_Widget* o, Fl_Color a, Fl_Color b) {
- ((Fl_Input*)o)->textcolor(a);
- ((Fl_Input*)o)->cursor_color(b);
-}
-// inline void fl_set_input_scroll(Fl_Widget*, int);
-inline void fl_set_input_cursorpos(Fl_Widget* o, int x, int /*y*/) {
- ((Fl_Input*)o)->position(x);}
-// inline void fl_set_input_selected(Fl_Widget*, int);
-// inline void fl_set_input_selected_range(Fl_Widget*, int, int);
-// inline void fl_set_input_maxchars(Fl_Widget*, int);
-// inline void fl_set_input_format(Fl_Widget*, int, int);
-// inline void fl_set_input_hscrollbar(Fl_Widget*, int);
-// inline void fl_set_input_vscrollbar(Fl_Widget*, int);
-// inline void fl_set_input_xoffset(Fl_Widget*, int);
-// inline void fl_set_input_topline(Fl_Widget*, int);
-// inline void fl_set_input_scrollbarsize(Fl_Widget*, int, int);
-// inline int fl_get_input_topline(Fl_Widget*);
-// inline int fl_get_input_screenlines(Fl_Widget*);
-inline int fl_get_input_cursorpos(Fl_Widget* o, int*x, int*y) {
- *x = ((Fl_Input*)o)->position(); *y = 0; return *x;}
-// inline int fl_get_input_numberoflines(Fl_Widget*);
-// inline void fl_get_input_format(Fl_Widget*, int*, int*);
-inline const char* fl_get_input(Fl_Widget* o) {return ((Fl_Input*)o)->value();}
-
-#include "Fl_Menu_Button.H"
-
-// types are not implemented, they all act like FL_PUSH_MENU:
-#define FL_TOUCH_MENU 0
-#define FL_PUSH_MENU 1
-#define FL_PULLDOWN_MENU 2
-forms_constructor(Fl_Menu_Button, fl_add_menu)
-
-inline void fl_clear_menu(Fl_Widget* o) {
- ((Fl_Menu_Button*)o)->clear();}
-inline void fl_set_menu(Fl_Widget* o, const char* s) {
- ((Fl_Menu_Button*)o)->clear(); ((Fl_Menu_Button*)o)->add(s);}
-inline void fl_addto_menu(Fl_Widget* o, const char* s) {
- ((Fl_Menu_Button*)o)->add(s);}
-inline void fl_replace_menu_item(Fl_Widget* o, int i, const char* s) {
- ((Fl_Menu_Button*)o)->replace(i-1,s);}
-inline void fl_delete_menu_item(Fl_Widget* o, int i) {
- ((Fl_Menu_Button*)o)->remove(i-1);}
-inline void fl_set_menu_item_shortcut(Fl_Widget* o, int i, const char* s) {
- ((Fl_Menu_Button*)o)->shortcut(i-1,fl_old_shortcut(s));}
-inline void fl_set_menu_item_mode(Fl_Widget* o, int i, long x) {
- ((Fl_Menu_Button*)o)->mode(i-1,x);}
-inline void fl_show_menu_symbol(Fl_Widget*, int ) {
-/* ((Fl_Menu_Button*)o)->show_menu_symbol(i); */}
-// inline void fl_set_menu_popup(Fl_Widget*, int);
-inline int fl_get_menu(Fl_Widget* o) {
- return ((Fl_Menu_Button*)o)->value()+1;}
-inline const char* fl_get_menu_item_text(Fl_Widget* o, int i) {
- return ((Fl_Menu_Button*)o)->text(i);}
-inline int fl_get_menu_maxitems(Fl_Widget* o) {
- return ((Fl_Menu_Button*)o)->size();}
-inline int fl_get_menu_item_mode(Fl_Widget* o, int i) {
- return ((Fl_Menu_Button*)o)->mode(i);}
-inline const char* fl_get_menu_text(Fl_Widget* o) {
- return ((Fl_Menu_Button*)o)->text();}
-
-#include "Fl_Positioner.H"
-#define FL_NORMAL_POSITIONER 0
-forms_constructor(Fl_Positioner, fl_add_positioner)
-inline void fl_set_positioner_xvalue(Fl_Widget* o, double v) {
- ((Fl_Positioner*)o)->xvalue(v);}
-inline double fl_get_positioner_xvalue(Fl_Widget* o) {
- return ((Fl_Positioner*)o)->xvalue();}
-inline void fl_set_positioner_xbounds(Fl_Widget* o, double a, double b) {
- ((Fl_Positioner*)o)->xbounds(a,b);}
-inline void fl_get_positioner_xbounds(Fl_Widget* o, float* a, float* b) {
- *a = float(((Fl_Positioner*)o)->xminimum());
- *b = float(((Fl_Positioner*)o)->xmaximum());
-}
-inline void fl_set_positioner_yvalue(Fl_Widget* o, double v) {
- ((Fl_Positioner*)o)->yvalue(v);}
-inline double fl_get_positioner_yvalue(Fl_Widget* o) {
- return ((Fl_Positioner*)o)->yvalue();}
-inline void fl_set_positioner_ybounds(Fl_Widget* o, double a, double b) {
- ((Fl_Positioner*)o)->ybounds(a,b);}
-inline void fl_get_positioner_ybounds(Fl_Widget* o, float* a, float* b) {
- *a = float(((Fl_Positioner*)o)->yminimum());
- *b = float(((Fl_Positioner*)o)->ymaximum());
-}
-inline void fl_set_positioner_xstep(Fl_Widget* o, double v) {
- ((Fl_Positioner*)o)->xstep(v);}
-inline void fl_set_positioner_ystep(Fl_Widget* o, double v) {
- ((Fl_Positioner*)o)->ystep(v);}
-inline void fl_set_positioner_return(Fl_Widget* o, int v) {
- ((Fl_Positioner*)o)->when((Fl_When)(v|FL_WHEN_RELEASE));}
-
-#include "Fl_Slider.H"
-
-#define FL_HOR_BROWSER_SLIDER FL_HOR_SLIDER
-#define FL_VERT_BROWSER_SLIDER FL_VERT_SLIDER
-
-forms_constructort(Fl_Slider, fl_add_slider)
-#define FL_SLIDER_COL1 FL_GRAY
-inline void fl_set_slider_value(Fl_Widget* o, double v) {
- ((Fl_Slider*)o)->value(v);}
-inline double fl_get_slider_value(Fl_Widget* o) {
- return ((Fl_Slider*)o)->value();}
-inline void fl_set_slider_bounds(Fl_Widget* o, double a, double b) {
- ((Fl_Slider*)o)->bounds(a, b);}
-inline void fl_get_slider_bounds(Fl_Widget* o, float* a, float* b) {
- *a = float(((Fl_Slider*)o)->minimum());
- *b = float(((Fl_Slider*)o)->maximum());
-}
-inline void fl_set_slider_return(Fl_Widget* o, int i) {
- ((Fl_Slider*)o)->when((Fl_When)(i|FL_WHEN_RELEASE));}
-inline void fl_set_slider_step(Fl_Widget* o, double v) {
- ((Fl_Slider*)o)->step(v);}
-// inline void fl_set_slider_increment(Fl_Widget* o, double v, double);
-inline void fl_set_slider_size(Fl_Widget* o, double v) {
- ((Fl_Slider*)o)->slider_size(v);}
-
-#include "Fl_Value_Slider.H"
-forms_constructor(Fl_Value_Slider, fl_add_valslider)
-
-inline void fl_set_slider_precision(Fl_Widget* o, int i) {
- ((Fl_Value_Slider*)o)->precision(i);}
-// filter function!
-
-// The forms text object was the same as an Fl_Box except it inverted the
-// meaning of FL_ALIGN_INSIDE. Implementation in forms.cxx
-class FL_EXPORT Fl_FormsText : public Fl_Widget {
-protected:
- void draw();
-public:
- Fl_FormsText(Fl_Boxtype b, int X, int Y, int W, int H, const char* l=0)
- : Fl_Widget(X,Y,W,H,l) {box(b); align(FL_ALIGN_LEFT);}
-};
-#define FL_NORMAL_TEXT FL_NO_BOX
-forms_constructorb(Fl_FormsText, fl_add_text)
-
-#include "Fl_Timer.H"
-forms_constructort(Fl_Timer, fl_add_timer)
-inline void fl_set_timer(Fl_Widget* o, double v) {((Fl_Timer*)o)->value(v);}
-inline double fl_get_timer(Fl_Widget* o) {return ((Fl_Timer*)o)->value();}
-inline void fl_suspend_timer(Fl_Widget* o) {((Fl_Timer*)o)->suspended(1);}
-inline void fl_resume_timer(Fl_Widget* o) {((Fl_Timer*)o)->suspended(0);}
-inline void fl_set_timer_countup(Fl_Widget* o,char d) {((Fl_Timer*)o)->direction(d);}
-void fl_gettime(long* sec, long* usec);
-
-// Fl_XYPlot nyi
-
-
-// stuff from DDForms:
-
-inline int fl_double_click() {return Fl::event_clicks();}
-inline void fl_draw() {Fl::flush();}
-
-#endif /* define __FORMS_H__ */
-
-//
-// End of "$Id: forms.H 8623 2011-04-24 17:09:41Z AlbrechtS $".
-//
diff --git a/Libraries/FL/gl.h b/Libraries/FL/gl.h
deleted file mode 100644
index ecf37a48..00000000
--- a/Libraries/FL/gl.h
+++ /dev/null
@@ -1,112 +0,0 @@
-//
-// "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
-//
-// OpenGL header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// You must include this instead of GL/gl.h to get the Microsoft
-// APIENTRY stuff included (from <windows.h>) prior to the OpenGL
-// header files.
-//
-// This file also provides "missing" OpenGL functions, and
-// gl_start() and gl_finish() to allow OpenGL to be used in any window
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-/** \file gl.h
- * This file defines wrapper functions for OpenGL in FLTK
- *
- * To use OpenGL from within an FLTK application you MUST use gl_visual()
- * to select the default visual before doing show() on any windows. Mesa
- * will crash if yoy try to use a visual not returned by glxChooseVidual.
- *
- * This does not work with Fl_Double_Window's! It will try to draw
- * into the front buffer. Depending on the system this will either
- * crash or do nothing (when pixmaps are being used as back buffer
- * and GL is being done by hardware), work correctly (when GL is done
- * with software, such as Mesa), or draw into the front buffer and
- * be erased when the buffers are swapped (when double buffer hardware
- * is being used)
- */
-
-#ifndef FL_gl_H
-# define FL_gl_H
-
-# include "Enumerations.H" // for color names
-# ifdef WIN32
-# include <windows.h>
-# endif
-# ifndef APIENTRY
-# if defined(__CYGWIN__)
-# define APIENTRY __attribute__ ((__stdcall__))
-# else
-# define APIENTRY
-# endif
-# endif
-
-# ifdef __APPLE__
-# include <OpenGL/gl.h>
-# else
-# include <GL/gl.h>
-# endif
-
-FL_EXPORT void gl_start();
-FL_EXPORT void gl_finish();
-
-FL_EXPORT void gl_color(Fl_Color i);
-/** back compatibility */
-inline void gl_color(int c) {gl_color((Fl_Color)c);}
-
-FL_EXPORT void gl_rect(int x,int y,int w,int h);
-/**
- Fills the given rectangle with the current color.
- \see gl_rect(int x, int y, int w, int h)
- */
-inline void gl_rectf(int x,int y,int w,int h) {glRecti(x,y,x+w,y+h);}
-
-FL_EXPORT void gl_font(int fontid, int size);
-FL_EXPORT int gl_height();
-FL_EXPORT int gl_descent();
-FL_EXPORT double gl_width(const char *);
-FL_EXPORT double gl_width(const char *, int n);
-FL_EXPORT double gl_width(uchar);
-
-FL_EXPORT void gl_draw(const char*);
-FL_EXPORT void gl_draw(const char*, int n);
-FL_EXPORT void gl_draw(const char*, int x, int y);
-FL_EXPORT void gl_draw(const char*, float x, float y);
-FL_EXPORT void gl_draw(const char*, int n, int x, int y);
-FL_EXPORT void gl_draw(const char*, int n, float x, float y);
-FL_EXPORT void gl_draw(const char*, int x, int y, int w, int h, Fl_Align);
-FL_EXPORT void gl_measure(const char*, int& x, int& y);
-#ifdef __APPLE__
-extern FL_EXPORT void gl_texture_pile_height(int max);
-extern FL_EXPORT int gl_texture_pile_height();
-#endif
-
-FL_EXPORT void gl_draw_image(const uchar *, int x,int y,int w,int h, int d=3, int ld=0);
-
-#endif // !FL_gl_H
-
-//
-// End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
-//
diff --git a/Libraries/FL/gl2opengl.h b/Libraries/FL/gl2opengl.h
deleted file mode 100644
index b89614e0..00000000
--- a/Libraries/FL/gl2opengl.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* gl.h
-
- GL to OpenGL translator.
- If you include this, you might be able to port old GL programs.
- There are also much better emulators available on the net.
-
-*/
-
-#include <FL/gl.h>
-#include "gl_draw.H"
-
-inline void clear() {glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);}
-#define RGBcolor(r,g,b) glColor3ub(r,g,b)
-#define bgnline() glBegin(GL_LINE_STRIP)
-#define bgnpolygon() glBegin(GL_POLYGON)
-#define bgnclosedline() glBegin(GL_LINE_LOOP)
-#define endline() glEnd()
-#define endpolygon() glEnd()
-#define endclosedline() glEnd()
-#define v2f(v) glVertex2fv(v)
-#define v2s(v) glVertex2sv(v)
-#define cmov(x,y,z) glRasterPos3f(x,y,z)
-#define charstr(s) gl_draw(s)
-#define fmprstr(s) gl_draw(s)
-typedef float Matrix[4][4];
-inline void pushmatrix() {glPushMatrix();}
-inline void popmatrix() {glPopMatrix();}
-inline void multmatrix(Matrix m) {glMultMatrixf((float *)m);}
-inline void color(int n) {glIndexi(n);}
-inline void rect(int x,int y,int r,int t) {gl_rect(x,y,r-x,t-y);}
-inline void rectf(int x,int y,int r,int t) {glRectf(x,y,r+1,t+1);}
-inline void recti(int x,int y,int r,int t) {gl_rect(x,y,r-x,t-y);}
-inline void rectfi(int x,int y,int r,int t) {glRecti(x,y,r+1,t+1);}
-inline void rects(int x,int y,int r,int t) {gl_rect(x,y,r-x,t-y);}
-inline void rectfs(int x,int y,int r,int t) {glRects(x,y,r+1,t+1);}
diff --git a/Libraries/FL/gl_draw.H b/Libraries/FL/gl_draw.H
deleted file mode 100644
index ad0f819b..00000000
--- a/Libraries/FL/gl_draw.H
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// "$Id: gl_draw.H 7903 2010-11-28 21:06:39Z matt $"
-//
-// OpenGL header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-#include "gl.h"
-
-extern FL_EXPORT void gl_remove_displaylist_fonts();
-
-
-//
-// End of "$Id: gl_draw.H 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/glu.h b/Libraries/FL/glu.h
deleted file mode 100644
index 9156198d..00000000
--- a/Libraries/FL/glu.h
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// "$Id: glu.h 7903 2010-11-28 21:06:39Z matt $"
-//
-// GLu header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// You must include this instead of GL/gl.h to get the Microsoft
-// APIENTRY stuff included (from <windows.h>) prior to the OpenGL
-// header files.
-//
-// This file also provides "missing" OpenGL functions, and
-// gl_start() and gl_finish() to allow OpenGL to be used in any window
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-#ifndef FL_glu_H
-# define FL_glu_H
-
-# include "Enumerations.H" // for color names
-# ifdef WIN32
-# include <windows.h>
-# endif
-# ifndef APIENTRY
-# if defined(__CYGWIN__)
-# define APIENTRY __attribute__ ((__stdcall__))
-# else
-# define APIENTRY
-# endif
-# endif
-
-# ifdef __APPLE__
-# include <OpenGL/glu.h>
-# else
-# include <GL/glu.h>
-# endif
-
-#endif // !FL_glu_H
-
-//
-// End of "$Id: glu.h 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/glut.H b/Libraries/FL/glut.H
deleted file mode 100644
index 98674871..00000000
--- a/Libraries/FL/glut.H
+++ /dev/null
@@ -1,491 +0,0 @@
-//
-// "$Id: glut.H 8623 2011-04-24 17:09:41Z AlbrechtS $"
-//
-// GLUT emulation header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-// Emulation of GLUT using fltk.
-
-// GLUT is Copyright (c) Mark J. Kilgard, 1994, 1995, 1996:
-// "This program is freely distributable without licensing fees and is
-// provided without guarantee or warrantee expressed or implied. This
-// program is -not- in the public domain."
-
-// Although I have copied the GLUT API, none of my code is based on
-// any GLUT implementation details and is therefore covered by the LGPL.
-
-// Commented out lines indicate parts of GLUT that are not emulated.
-
-#ifndef Fl_glut_H
-# define Fl_glut_H
-
-# include "gl.h"
-
-
-# include "Fl.H"
-# include "Fl_Gl_Window.H"
-
-/**
- GLUT is emulated using this window class and these static variables
- (plus several more static variables hidden in glut_compatability.cxx):
-*/
-class FL_EXPORT Fl_Glut_Window : public Fl_Gl_Window {
- void _init();
- int mouse_down;
-protected:
- void draw();
- void draw_overlay();
- int handle(int);
-public: // so the inline functions work
- int number;
- int menu[3];
- void make_current();
- void (*display)();
- void (*overlaydisplay)();
- void (*reshape)(int w, int h);
- void (*keyboard)(uchar, int x, int y);
- void (*mouse)(int b, int state, int x, int y);
- void (*motion)(int x, int y);
- void (*passivemotion)(int x, int y);
- void (*entry)(int);
- void (*visibility)(int);
- void (*special)(int, int x, int y);
- Fl_Glut_Window(int w, int h, const char *);
- Fl_Glut_Window(int x, int y, int w, int h, const char *);
- ~Fl_Glut_Window();
-};
-
-extern FL_EXPORT Fl_Glut_Window *glut_window; // the current window
-extern FL_EXPORT int glut_menu; // the current menu
-
-// function pointers that are not per-window:
-extern FL_EXPORT void (*glut_idle_function)();
-extern FL_EXPORT void (*glut_menustate_function)(int);
-extern FL_EXPORT void (*glut_menustatus_function)(int,int,int);
-
-////////////////////////////////////////////////////////////////
-
-//# define GLUT_API_VERSION This does not match any version of GLUT exactly...
-
-FL_EXPORT void glutInit(int *argcp, char **argv); // creates first window
-
-FL_EXPORT void glutInitDisplayMode(unsigned int mode);
-// the FL_ symbols have the same value as the GLUT ones:
-# define GLUT_RGB FL_RGB
-# define GLUT_RGBA FL_RGB
-# define GLUT_INDEX FL_INDEX
-# define GLUT_SINGLE FL_SINGLE
-# define GLUT_DOUBLE FL_DOUBLE
-# define GLUT_ACCUM FL_ACCUM
-# define GLUT_ALPHA FL_ALPHA
-# define GLUT_DEPTH FL_DEPTH
-# define GLUT_STENCIL FL_STENCIL
-# define GLUT_MULTISAMPLE FL_MULTISAMPLE
-# define GLUT_STEREO FL_STEREO
-// # define GLUT_LUMINANCE 512
-
-FL_EXPORT void glutInitWindowPosition(int x, int y);
-
-FL_EXPORT void glutInitWindowSize(int w, int h);
-
-FL_EXPORT void glutMainLoop();
-
-FL_EXPORT int glutCreateWindow(char *title);
-FL_EXPORT int glutCreateWindow(const char *title);
-
-FL_EXPORT int glutCreateSubWindow(int win, int x, int y, int width, int height);
-
-FL_EXPORT void glutDestroyWindow(int win);
-
-inline void glutPostRedisplay() {glut_window->redraw();}
-
-FL_EXPORT void glutPostWindowRedisplay(int win);
-
-FL_EXPORT void glutSwapBuffers();
-
-inline int glutGetWindow() {return glut_window->number;}
-
-FL_EXPORT void glutSetWindow(int win);
-
-inline void glutSetWindowTitle(char *t) {glut_window->label(t);}
-
-inline void glutSetIconTitle(char *t) {glut_window->iconlabel(t);}
-
-inline void glutPositionWindow(int x, int y) {glut_window->position(x,y);}
-
-inline void glutReshapeWindow(int w, int h) {glut_window->size(w,h);}
-
-inline void glutPopWindow() {glut_window->show();}
-
-inline void glutPushWindow() { /* do nothing */ }
-
-inline void glutIconifyWindow() {glut_window->iconize();}
-
-inline void glutShowWindow() {glut_window->show();}
-
-inline void glutHideWindow() {glut_window->hide();}
-
-inline void glutFullScreen() {glut_window->fullscreen();}
-
-inline void glutSetCursor(Fl_Cursor cursor) {glut_window->cursor(cursor);}
-// notice that the numeric values are different than glut:
-# define GLUT_CURSOR_RIGHT_ARROW ((Fl_Cursor)2)
-# define GLUT_CURSOR_LEFT_ARROW ((Fl_Cursor)67)
-# define GLUT_CURSOR_INFO FL_CURSOR_HAND
-# define GLUT_CURSOR_DESTROY ((Fl_Cursor)45)
-# define GLUT_CURSOR_HELP FL_CURSOR_HELP
-# define GLUT_CURSOR_CYCLE ((Fl_Cursor)26)
-# define GLUT_CURSOR_SPRAY ((Fl_Cursor)63)
-# define GLUT_CURSOR_WAIT FL_CURSOR_WAIT
-# define GLUT_CURSOR_TEXT FL_CURSOR_INSERT
-# define GLUT_CURSOR_CROSSHAIR FL_CURSOR_CROSS
-# define GLUT_CURSOR_UP_DOWN FL_CURSOR_NS
-# define GLUT_CURSOR_LEFT_RIGHT FL_CURSOR_WE
-# define GLUT_CURSOR_TOP_SIDE FL_CURSOR_N
-# define GLUT_CURSOR_BOTTOM_SIDE FL_CURSOR_S
-# define GLUT_CURSOR_LEFT_SIDE FL_CURSOR_W
-# define GLUT_CURSOR_RIGHT_SIDE FL_CURSOR_E
-# define GLUT_CURSOR_TOP_LEFT_CORNER FL_CURSOR_NW
-# define GLUT_CURSOR_TOP_RIGHT_CORNER FL_CURSOR_NE
-# define GLUT_CURSOR_BOTTOM_RIGHT_CORNER FL_CURSOR_SE
-# define GLUT_CURSOR_BOTTOM_LEFT_CORNER FL_CURSOR_SW
-# define GLUT_CURSOR_INHERIT FL_CURSOR_DEFAULT
-# define GLUT_CURSOR_NONE FL_CURSOR_NONE
-# define GLUT_CURSOR_FULL_CROSSHAIR FL_CURSOR_CROSS
-
-inline void glutWarpPointer(int, int) { /* do nothing */ }
-
-inline void glutEstablishOverlay() {glut_window->make_overlay_current();}
-
-inline void glutRemoveOverlay() {glut_window->hide_overlay();}
-
-inline void glutUseLayer(GLenum layer) {
- layer ? glut_window->make_overlay_current() : glut_window->make_current();}
-enum {GLUT_NORMAL, GLUT_OVERLAY};
-
-inline void glutPostOverlayRedisplay() {glut_window->redraw_overlay();}
-
-inline void glutShowOverlay() {glut_window->redraw_overlay();}
-
-inline void glutHideOverlay() {glut_window->hide_overlay();}
-
-FL_EXPORT int glutCreateMenu(void (*)(int));
-
-FL_EXPORT void glutDestroyMenu(int menu);
-
-inline int glutGetMenu() {return glut_menu;}
-
-inline void glutSetMenu(int m) {glut_menu = m;}
-
-FL_EXPORT void glutAddMenuEntry(char *label, int value);
-
-FL_EXPORT void glutAddSubMenu(char *label, int submenu);
-
-FL_EXPORT void glutChangeToMenuEntry(int item, char *labela, int value);
-
-FL_EXPORT void glutChangeToSubMenu(int item, char *label, int submenu);
-
-FL_EXPORT void glutRemoveMenuItem(int item);
-
-inline void glutAttachMenu(int b) {glut_window->menu[b] = glut_menu;}
-
-inline void glutDetachMenu(int b) {glut_window->menu[b] = 0;}
-
-inline void glutDisplayFunc(void (*f)()) {glut_window->display = f;}
-
-inline void glutReshapeFunc(void (*f)(int w, int h)) {glut_window->reshape=f;}
-
-inline void glutKeyboardFunc(void (*f)(uchar key, int x, int y)) {
- glut_window->keyboard = f;}
-
-inline void glutMouseFunc(void (*f)(int b, int state, int x, int y)) {
- glut_window->mouse = f;}
-# define GLUT_LEFT_BUTTON 0
-# define GLUT_MIDDLE_BUTTON 1
-# define GLUT_RIGHT_BUTTON 2
-# define GLUT_DOWN 0
-# define GLUT_UP 1
-
-inline void glutMotionFunc(void (*f)(int x, int y)) {glut_window->motion= f;}
-
-inline void glutPassiveMotionFunc(void (*f)(int x, int y)) {
- glut_window->passivemotion= f;}
-
-inline void glutEntryFunc(void (*f)(int s)) {glut_window->entry = f;}
-enum {GLUT_LEFT, GLUT_ENTERED};
-
-inline void glutVisibilityFunc(void (*f)(int s)) {glut_window->visibility=f;}
-enum {GLUT_NOT_VISIBLE, GLUT_VISIBLE};
-
-FL_EXPORT void glutIdleFunc(void (*f)());
-
-// Warning: this cast may not work on all machines:
-inline void glutTimerFunc(unsigned int msec, void (*f)(int), int value) {
- Fl::add_timeout(msec*.001, (void (*)(void *))f, (void *)value);
-}
-
-inline void glutMenuStateFunc(void (*f)(int state)) {
- glut_menustate_function = f;}
-
-inline void glutMenuStatusFunc(void (*f)(int status, int x, int y)) {
- glut_menustatus_function = f;}
-enum {GLUT_MENU_NOT_IN_USE, GLUT_MENU_IN_USE};
-
-inline void glutSpecialFunc(void (*f)(int key, int x, int y)) {
- glut_window->special = f;}
-# define GLUT_KEY_F1 1
-# define GLUT_KEY_F2 2
-# define GLUT_KEY_F3 3
-# define GLUT_KEY_F4 4
-# define GLUT_KEY_F5 5
-# define GLUT_KEY_F6 6
-# define GLUT_KEY_F7 7
-# define GLUT_KEY_F8 8
-# define GLUT_KEY_F9 9
-# define GLUT_KEY_F10 10
-# define GLUT_KEY_F11 11
-# define GLUT_KEY_F12 12
-// WARNING: Different values than GLUT uses:
-# define GLUT_KEY_LEFT FL_Left
-# define GLUT_KEY_UP FL_Up
-# define GLUT_KEY_RIGHT FL_Right
-# define GLUT_KEY_DOWN FL_Down
-# define GLUT_KEY_PAGE_UP FL_Page_Up
-# define GLUT_KEY_PAGE_DOWN FL_Page_Down
-# define GLUT_KEY_HOME FL_Home
-# define GLUT_KEY_END FL_End
-# define GLUT_KEY_INSERT FL_Insert
-
-//inline void glutSpaceballMotionFunc(void (*)(int x, int y, int z));
-
-//inline void glutSpaceballRotateFunc(void (*)(int x, int y, int z));
-
-//inline void glutSpaceballButtonFunc(void (*)(int button, int state));
-
-//inline void glutButtonBoxFunc(void (*)(int button, int state));
-
-//inline void glutDialsFunc(void (*)(int dial, int value));
-
-//inline void glutTabletMotionFunc(void (*)(int x, int y));
-
-//inline void glutTabletButtonFunc(void (*)(int button, int state, int x, int y));
-
-inline void glutOverlayDisplayFunc(void (*f)()) {
- glut_window->overlaydisplay = f;}
-
-//inline void glutWindowStatusFunc(void (*)(int state));
-//enum {GLUT_HIDDEN, GLUT_FULLY_RETAINED, GLUT_PARTIALLY_RETAINED,
-// GLUT_FULLY_COVERED};
-
-//inline void glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
-
-//inline GLfloat glutGetColor(int ndx, int component);
-//#define GLUT_RED 0
-//#define GLUT_GREEN 1
-//#define GLUT_BLUE 2
-
-//inline void glutCopyColormap(int win);
-
-// Warning: values are changed from GLUT!
-// Also relies on the GL_ symbols having values greater than 100
-FL_EXPORT int glutGet(GLenum type);
-enum {
- GLUT_RETURN_ZERO = 0,
- GLUT_WINDOW_X,
- GLUT_WINDOW_Y,
- GLUT_WINDOW_WIDTH,
- GLUT_WINDOW_HEIGHT,
- GLUT_WINDOW_PARENT,
- GLUT_SCREEN_WIDTH,
- GLUT_SCREEN_HEIGHT,
- GLUT_MENU_NUM_ITEMS,
- GLUT_DISPLAY_MODE_POSSIBLE,
- GLUT_INIT_WINDOW_X,
- GLUT_INIT_WINDOW_Y,
- GLUT_INIT_WINDOW_WIDTH,
- GLUT_INIT_WINDOW_HEIGHT,
- GLUT_INIT_DISPLAY_MODE,
- GLUT_WINDOW_BUFFER_SIZE,
- GLUT_VERSION
-//GLUT_WINDOW_NUM_CHILDREN,
-//GLUT_WINDOW_CURSOR,
-//GLUT_SCREEN_WIDTH_MM,
-//GLUT_SCREEN_HEIGHT_MM,
-//GLUT_ELAPSED_TIME,
-};
-
-# define GLUT_WINDOW_STENCIL_SIZE GL_STENCIL_BITS
-# define GLUT_WINDOW_DEPTH_SIZE GL_DEPTH_BITS
-# define GLUT_WINDOW_RED_SIZE GL_RED_BITS
-# define GLUT_WINDOW_GREEN_SIZE GL_GREEN_BITS
-# define GLUT_WINDOW_BLUE_SIZE GL_BLUE_BITS
-# define GLUT_WINDOW_ALPHA_SIZE GL_ALPHA_BITS
-# define GLUT_WINDOW_ACCUM_RED_SIZE GL_ACCUM_RED_BITS
-# define GLUT_WINDOW_ACCUM_GREEN_SIZE GL_ACCUM_GREEN_BITS
-# define GLUT_WINDOW_ACCUM_BLUE_SIZE GL_ACCUM_BLUE_BITS
-# define GLUT_WINDOW_ACCUM_ALPHA_SIZE GL_ACCUM_ALPHA_BITS
-# define GLUT_WINDOW_DOUBLEBUFFER GL_DOUBLEBUFFER
-# define GLUT_WINDOW_RGBA GL_RGBA
-# define GLUT_WINDOW_COLORMAP_SIZE GL_INDEX_BITS
-# ifdef GL_SAMPLES_SGIS
-# define GLUT_WINDOW_NUM_SAMPLES GL_SAMPLES_SGIS
-# else
-# define GLUT_WINDOW_NUM_SAMPLES GLUT_RETURN_ZERO
-# endif
-# define GLUT_WINDOW_STEREO GL_STEREO
-
-# define GLUT_HAS_KEYBOARD 600
-# define GLUT_HAS_MOUSE 601
-# define GLUT_HAS_SPACEBALL 602
-# define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
-# define GLUT_HAS_TABLET 604
-# define GLUT_NUM_MOUSE_BUTTONS 605
-# define GLUT_NUM_SPACEBALL_BUTTONS 606
-# define GLUT_NUM_BUTTON_BOX_BUTTONS 607
-# define GLUT_NUM_DIALS 608
-# define GLUT_NUM_TABLET_BUTTONS 609
-FL_EXPORT int glutDeviceGet(GLenum type);
-
-// WARNING: these values are different than GLUT uses:
-# define GLUT_ACTIVE_SHIFT FL_SHIFT
-# define GLUT_ACTIVE_CTRL FL_CTRL
-# define GLUT_ACTIVE_ALT FL_ALT
-inline int glutGetModifiers() {return Fl::event_state() & (GLUT_ACTIVE_SHIFT | GLUT_ACTIVE_CTRL | GLUT_ACTIVE_ALT);}
-
-FL_EXPORT int glutLayerGet(GLenum);
-# define GLUT_OVERLAY_POSSIBLE 800
-//#define GLUT_LAYER_IN_USE 801
-//#define GLUT_HAS_OVERLAY 802
-# define GLUT_TRANSPARENT_INDEX 803
-# define GLUT_NORMAL_DAMAGED 804
-# define GLUT_OVERLAY_DAMAGED 805
-
-extern "C" {
-typedef void (*GLUTproc)();
-}
-
-FL_EXPORT GLUTproc glutGetProcAddress(const char *procName);
-
-//inline int glutVideoResizeGet(GLenum param);
-//#define GLUT_VIDEO_RESIZE_POSSIBLE 900
-//#define GLUT_VIDEO_RESIZE_IN_USE 901
-//#define GLUT_VIDEO_RESIZE_X_DELTA 902
-//#define GLUT_VIDEO_RESIZE_Y_DELTA 903
-//#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
-//#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
-//#define GLUT_VIDEO_RESIZE_X 906
-//#define GLUT_VIDEO_RESIZE_Y 907
-//#define GLUT_VIDEO_RESIZE_WIDTH 908
-//#define GLUT_VIDEO_RESIZE_HEIGHT 909
-
-//inline void glutSetupVideoResizing();
-
-//inline void glutStopVideoResizing();
-
-//inline void glutVideoResize(int x, int y, int width, int height);
-
-//inline void glutVideoPan(int x, int y, int width, int height);
-
-// Font argument must be a void* for compatibility, so...
-/** fltk glut font/size attributes used in the glutXXX functions */
-struct Fl_Glut_Bitmap_Font {Fl_Font font; Fl_Fontsize size;};
-
-extern FL_EXPORT struct Fl_Glut_Bitmap_Font
- glutBitmap9By15, glutBitmap8By13, glutBitmapTimesRoman10,
- glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12,
- glutBitmapHelvetica18;
-# define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
-# define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
-# define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
-# define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
-# define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
-# define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
-# define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
-
-FL_EXPORT void glutBitmapCharacter(void *font, int character);
-FL_EXPORT int glutBitmapHeight(void *font);
-FL_EXPORT int glutBitmapLength(void *font, const unsigned char *string);
-FL_EXPORT void glutBitmapString(void *font, const unsigned char *string);
-FL_EXPORT int glutBitmapWidth(void *font, int character);
-
-FL_EXPORT int glutExtensionSupported(char *name);
-
-/* GLUT stroked font sub-API */
-struct Fl_Glut_StrokeVertex {
- GLfloat X, Y;
-};
-
-struct Fl_Glut_StrokeStrip {
- int Number;
- const Fl_Glut_StrokeVertex* Vertices;
-};
-
-struct Fl_Glut_StrokeChar {
- GLfloat Right;
- int Number;
- const Fl_Glut_StrokeStrip* Strips;
-};
-
-struct Fl_Glut_StrokeFont {
- char* Name; // The source font name
- int Quantity; // Number of chars in font
- GLfloat Height; // Height of the characters
- const Fl_Glut_StrokeChar** Characters;// The characters mapping
-};
-extern FL_EXPORT Fl_Glut_StrokeFont glutStrokeRoman;
-extern FL_EXPORT Fl_Glut_StrokeFont glutStrokeMonoRoman;
-# define GLUT_STROKE_ROMAN (&glutStrokeRoman)
-# define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
-
-FL_EXPORT void glutStrokeCharacter(void *font, int character);
-FL_EXPORT GLfloat glutStrokeHeight(void *font);
-FL_EXPORT int glutStrokeLength(void *font, const unsigned char *string);
-FL_EXPORT void glutStrokeString(void *font, const unsigned char *string);
-FL_EXPORT int glutStrokeWidth(void *font, int character);
-
-/* GLUT pre-built models sub-API */
-FL_EXPORT void glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
-FL_EXPORT void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
-FL_EXPORT void glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
-FL_EXPORT void glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
-FL_EXPORT void glutWireCube(GLdouble size);
-FL_EXPORT void glutSolidCube(GLdouble size);
-FL_EXPORT void glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
-FL_EXPORT void glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
-FL_EXPORT void glutWireDodecahedron();
-FL_EXPORT void glutSolidDodecahedron();
-FL_EXPORT void glutWireTeapot(GLdouble size);
-FL_EXPORT void glutSolidTeapot(GLdouble size);
-FL_EXPORT void glutWireOctahedron();
-FL_EXPORT void glutSolidOctahedron();
-FL_EXPORT void glutWireTetrahedron();
-FL_EXPORT void glutSolidTetrahedron();
-FL_EXPORT void glutWireIcosahedron();
-FL_EXPORT void glutSolidIcosahedron();
-
-#endif // !Fl_glut_H
-
-//
-// End of "$Id: glut.H 8623 2011-04-24 17:09:41Z AlbrechtS $".
-//
diff --git a/Libraries/FL/mac.H b/Libraries/FL/mac.H
deleted file mode 100644
index 704f521d..00000000
--- a/Libraries/FL/mac.H
+++ /dev/null
@@ -1,237 +0,0 @@
-//
-// "$Id: mac.H 8657 2011-05-12 11:50:43Z manolo $"
-//
-// Mac header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-// Do not directly include this file, instead use <FL/x.H>. It will
-// include this file if "__APPLE__" is defined. This is to encourage
-// portability of even the system-specific code...
-#ifndef FL_DOXYGEN
-
-#if !defined(Fl_X_H)
-# error "Never use <FL/mac.H> directly; include <FL/x.H> instead."
-#endif // !Fl_X_H
-#include <FL/Fl_Widget.H>
-
-typedef void* Window; // this is really a pointer to the subclass FLWindow of NSWindow
-typedef void* Fl_Offscreen; // this is really a CGContextRef
-typedef void* Fl_Bitmask; // this is really a CGImageRef
-
-#include <AvailabilityMacros.h>
-#ifndef MAC_OS_X_VERSION_10_3
-#define MAC_OS_X_VERSION_10_3 1030
-#endif
-#ifndef MAC_OS_X_VERSION_10_4
-#define MAC_OS_X_VERSION_10_4 1040
-#endif
-#ifndef MAC_OS_X_VERSION_10_5
-#define MAC_OS_X_VERSION_10_5 1050
-#endif
-#ifndef MAC_OS_X_VERSION_10_6
-#define MAC_OS_X_VERSION_10_6 1060
-#endif
-
-#if !(defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part is used when compiling an application program
-
-typedef void* Fl_Region;
-typedef void* Fl_CGContextRef;
-typedef void* Fl_PMPrintSettings;
-typedef void* Fl_PMPageFormat;
-typedef void* Fl_PMPrintSession;
-
-#else // this part must be compiled when building the FLTK libraries
-
-// Standard MacOS C/C++ includes...
-#include <ApplicationServices/ApplicationServices.h>
-#undef check // because of Fl::check()
-
-typedef CGContextRef Fl_CGContextRef;
-typedef PMPrintSettings Fl_PMPrintSettings;
-typedef PMPageFormat Fl_PMPageFormat;
-typedef PMPrintSession Fl_PMPrintSession;
-
-typedef struct flCocoaRegion {
- int count;
- CGRect *rects;
-} *Fl_Region; // a region is the union of a series of rectangles
-
-# include "Fl_Window.H"
-
-// Some random X equivalents
-struct XPoint { int x, y; };
-struct XRectangle {int x, y, width, height;};
-#ifndef CGFLOAT_DEFINED //appears with 10.5 in CGBase.h
-#if defined(__LP64__) && __LP64__
-typedef double CGFloat;
-#else
-typedef float CGFloat;
-#endif
-#endif // CGFLOAT_DEFINED
-
-extern CGRect fl_cgrectmake_cocoa(int x, int y, int w, int h);
-inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
- Fl_Region R = (Fl_Region)malloc(sizeof(*R));
- R->count = 1;
- R->rects = (CGRect *)malloc(sizeof(CGRect));
- *(R->rects) = fl_cgrectmake_cocoa(x, y, w, h);
- return R;
-}
-inline void XDestroyRegion(Fl_Region r) {
- if(r) {
- free(r->rects);
- free(r);
- }
-}
-extern void *fl_system_menu;
-extern void *fl_default_cursor;
-
-// This object contains all mac-specific stuff about a window:
-// WARNING: this object is highly subject to change!
-class Fl_X {
-
-public:
- Window xid; // pointer to the Cocoa window object (FLWindow*)
- Fl_Offscreen other_xid; // pointer for offscreen bitmaps (overlay window)
- Fl_Window *w; // FLTK window for
- Fl_Region region;
- Fl_Region subRegion; // region for this specific subwindow
- Fl_X *next; // linked tree to support subwindows
- Fl_X *xidChildren, *xidNext; // more subwindow tree
- int wait_for_expose;
- void *cursor; // is really NSCursor*
- static Fl_X* first;
- static Fl_X* i(const Fl_Window* w) {return w->i;}
- static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&);
- static void make(Fl_Window*);
- void flush();
- // Quartz additions:
- CGContextRef gc; // graphics context (NULL when using QD)
- static void q_fill_context(); // fill a Quartz context with current FLTK state
- static void q_clear_clipping(); // remove all clipping from a Quartz context
- static void q_release_context(Fl_X *x=0); // free all resources associated with fl_gc
- static void q_begin_image(CGRect&, int x, int y, int w, int h);
- static void q_end_image();
- // Cocoa additions
- void destroy(void);
- void map(void);
- void unmap(void);
- int unlink(Fl_X* start = NULL);
- void collapse(void);
- WindowRef window_ref(void);
- void set_key_window(void);
- void set_cursor(Fl_Cursor);
- static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h);
- static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel);
- static Fl_Region intersect_region_and_rect(Fl_Region current, int x,int y,int w, int h);
- static CGContextRef watch_cursor_image(void);
- static CGContextRef help_cursor_image(void);
- static CGContextRef nesw_cursor_image(void);
- static CGContextRef nwse_cursor_image(void);
- static CGContextRef none_cursor_image(void);
- static void *get_carbon_function(const char *name);
-private:
- static void relink(Fl_Window*, Fl_Window*);
- bool subwindow;
-};
-
-extern struct Fl_XMap {
- RGBColor rgb;
- ulong pen;
-} *fl_current_xmap;
-extern FL_EXPORT Window fl_window;
-
-#endif // FL_LIBRARY || FL_INTERNALS
-
-extern FL_EXPORT Fl_CGContextRef fl_gc;
-extern FL_EXPORT class Fl_Sys_Menu_Bar *fl_sys_menu_bar;
-
-extern Window fl_xid(const Fl_Window*);
-void fl_clip_region(Fl_Region);
-
-extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
-extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
-extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
-extern Fl_Offscreen fl_create_offscreen(int w, int h);
-extern void fl_copy_offscreen(int x,int y,int w,int h, Fl_Offscreen gWorld, int srcx,int srcy);
-extern void fl_delete_offscreen(Fl_Offscreen gWorld);
-extern void fl_begin_offscreen(Fl_Offscreen gWorld);
-extern void fl_end_offscreen();
-
-extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
-extern void fl_open_display();
-
-#endif // FL_DOXYGEN
-
-/** \defgroup group_macosx Mac OS X-specific symbols
- Mac OS X-specific symbols declared in <FL/x.H> or <FL/gl.h>
- @{ */
-
-/** @brief Register a function called for each file dropped onto an application icon.
- \e cb will be called with a single Unix-style file name and path.
- If multiple files were dropped, \e cb will be called multiple times.
- */
-extern void fl_open_callback(void (*cb)(const char *));
-
-/**
- * \brief Attaches a callback to the "About myprog" item of the system application menu.
- *
- * \param cb a callback that will be called by "About myprog" menu item
- * with NULL 1st argument.
- * \param user_data a pointer transmitted as 2nd argument to the callback.
- * \param shortcut optional shortcut to attach to the "About myprog" menu item (e.g., FL_META+'a')
- */
-extern void fl_mac_set_about( Fl_Callback *cb, void *user_data, int shortcut = 0);
-
-/** \brief The version number of the running Mac OS X (e.g., 100604 for 10.6.4)
- */
-extern int fl_mac_os_version;
-
-class Fl_Mac_App_Menu {
-public:
- /** Localizable text for the "About xxx" application menu item */
- static const char *about;
- /** Localizable text for the "Print Front Window" application menu item.
- This menu item won't be displayed if Fl_Mac_App_Menu::print
- is set to an empty string.
- */
- static const char *print;
- /** Localizable text for the "Services" application menu item */
- static const char *services;
- /** Localizable text for the "Hide xxx" application menu item */
- static const char *hide;
- /** Localizable text for the "Hide Others" application menu item */
- static const char *hide_others;
- /** Localizable text for the "Show All" application menu item */
- static const char *show;
- /** Localizable text for the "Quit xxx" application menu item */
- static const char *quit;
-};
-
-/** @} */
-
-//
-// End of "$Id: mac.H 8657 2011-05-12 11:50:43Z manolo $".
-//
-
diff --git a/Libraries/FL/math.h b/Libraries/FL/math.h
deleted file mode 100644
index e0f1d405..00000000
--- a/Libraries/FL/math.h
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// "$Id: math.h 7903 2010-11-28 21:06:39Z matt $"
-//
-// Math header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-// Xcode on OS X includes files by recursing down into directories.
-// This code catches the cycle and directly includes the required file.
-#ifdef fl_math_h_cyclic_include
-# include "/usr/include/math.h"
-#endif
-
-#ifndef fl_math_h
-# define fl_math_h
-
-# define fl_math_h_cyclic_include
-# include <math.h>
-# undef fl_math_h_cyclic_include
-
-# ifdef __EMX__
-# include <float.h>
-# endif
-
-
-# ifndef M_PI
-# define M_PI 3.14159265358979323846
-# define M_PI_2 1.57079632679489661923
-# define M_PI_4 0.78539816339744830962
-# define M_1_PI 0.31830988618379067154
-# define M_2_PI 0.63661977236758134308
-# endif // !M_PI
-
-# ifndef M_SQRT2
-# define M_SQRT2 1.41421356237309504880
-# define M_SQRT1_2 0.70710678118654752440
-# endif // !M_SQRT2
-
-# if (defined(WIN32) || defined(CRAY)) && !defined(__MINGW32__) && !defined(__MWERKS__)
-
-inline double rint(double v) {return floor(v+.5);}
-inline double copysign(double a, double b) {return b<0 ? -a : a;}
-
-# endif // (WIN32 || CRAY) && !__MINGW32__ && !__MWERKS__
-
-#endif // !fl_math_h
-
-
-//
-// End of "$Id: math.h 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/names.h b/Libraries/FL/names.h
deleted file mode 100644
index 952acc02..00000000
--- a/Libraries/FL/names.h
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// "$Id: names.h 7903 2010-11-28 21:06:39Z matt $"
-//
-// Event names header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-// Thanks to Greg Ercolano for this addition.
-
-#ifndef FL_NAMES_H
-#define FL_NAMES_H
-
-/** \defgroup fl_events Events handling functions
- @{
- */
-
-/**
- This is an array of event names you can use to convert event numbers into names.
-
- The array gets defined inline wherever your '\#include <FL/names.h>' appears.
-
- \b Example:
- \code
- #include <FL/names.h> // array will be defined here
- int MyClass::handle(int e) {
- printf("Event was %s (%d)\n", fl_eventnames[e], e);
- // ..resulting output might be e.g. "Event was FL_PUSH (1)"..
- [..]
- }
- \endcode
- */
-const char * const fl_eventnames[] =
-{
- "FL_NO_EVENT",
- "FL_PUSH",
- "FL_RELEASE",
- "FL_ENTER",
- "FL_LEAVE",
- "FL_DRAG",
- "FL_FOCUS",
- "FL_UNFOCUS",
- "FL_KEYDOWN",
- "FL_KEYUP",
- "FL_CLOSE",
- "FL_MOVE",
- "FL_SHORTCUT",
- "FL_DEACTIVATE",
- "FL_ACTIVATE",
- "FL_HIDE",
- "FL_SHOW",
- "FL_PASTE",
- "FL_SELECTIONCLEAR",
- "FL_MOUSEWHEEL",
- "FL_DND_ENTER",
- "FL_DND_DRAG",
- "FL_DND_LEAVE",
- "FL_DND_RELEASE",
-};
-
-/**
- This is an array of font names you can use to convert font numbers into names.
-
- The array gets defined inline wherever your '\#include <FL/names.h>' appears.
-
- \b Example:
- \code
- #include <FL/names.h> // array will be defined here
- int MyClass::my_callback(Fl_Widget *w, void*) {
- int fnum = w->labelfont();
- // Resulting output might be e.g. "Label's font is FL_HELVETICA (0)"
- printf("Label's font is %s (%d)\n", fl_fontnames[fnum], fnum);
- // ..resulting output might be e.g. "Label's font is FL_HELVETICA (0)"..
- [..]
- }
- \endcode
- */
-const char * const fl_fontnames[] =
-{
- "FL_HELVETICA",
- "FL_HELVETICA_BOLD",
- "FL_HELVETICA_ITALIC",
- "FL_HELVETICA_BOLD_ITALIC",
- "FL_COURIER",
- "FL_COURIER_BOLD",
- "FL_COURIER_ITALIC",
- "FL_COURIER_BOLD_ITALIC",
- "FL_TIMES",
- "FL_TIMES_BOLD",
- "FL_TIMES_ITALIC",
- "FL_TIMES_BOLD_ITALIC",
- "FL_SYMBOL",
- "FL_SCREEN",
- "FL_SCREEN_BOLD",
- "FL_ZAPF_DINGBATS",
-};
-
-/** @} */
-
-#endif /* FL_NAMES_H */
-
-//
-// End of "$Id: names.h 7903 2010-11-28 21:06:39Z matt $".
-//
diff --git a/Libraries/FL/win32.H b/Libraries/FL/win32.H
deleted file mode 100644
index 2150505a..00000000
--- a/Libraries/FL/win32.H
+++ /dev/null
@@ -1,165 +0,0 @@
-//
-// "$Id: win32.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
-//
-// WIN32 header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-// Do not directly include this file, instead use <FL/x.H>. It will
-// include this file if WIN32 is defined. This is to encourage
-// portability of even the system-specific code...
-
-#ifndef FL_DOXYGEN
-#ifndef Fl_X_H
-# error "Never use <FL/win32.H> directly; include <FL/x.H> instead."
-#endif // !Fl_X_H
-
-#include <windows.h>
-typedef HRGN Fl_Region;
-typedef HWND Window;
-typedef POINT XPoint;
-
-#include <FL/Fl_Window.H>
-
-// this part is included only when compiling the FLTK library or if requested explicitly
-#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
-
-// In some of the distributions, the gcc header files are missing some stuff:
-#ifndef LPMINMAXINFO
-#define LPMINMAXINFO MINMAXINFO*
-#endif
-#ifndef VK_LWIN
-#define VK_LWIN 0x5B
-#define VK_RWIN 0x5C
-#define VK_APPS 0x5D
-#endif
-
-// some random X equivalents
-struct XRectangle {int x, y, width, height;};
-extern Fl_Region XRectangleRegion(int x, int y, int w, int h);
-inline void XDestroyRegion(Fl_Region r) {DeleteObject(r);}
-inline void XClipBox(Fl_Region r,XRectangle* rect) {
- RECT win_rect; GetRgnBox(r,&win_rect);
- rect->x=win_rect.left;
- rect->y=win_rect.top;
- rect->width=win_rect.right-win_rect.left;
- rect->height=win_rect.bottom-win_rect.top;
-}
-#define XDestroyWindow(a,b) DestroyWindow(b)
-#define XMapWindow(a,b) ShowWindow(b, SW_RESTORE)
-#define XUnmapWindow(a,b) ShowWindow(b, SW_HIDE)
-
-// this object contains all win32-specific stuff about a window:
-// Warning: this object is highly subject to change!
-class FL_EXPORT Fl_X {
-public:
- // member variables - add new variables only at the end of this block
- Window xid;
- HBITMAP other_xid; // for double-buffered windows
- Fl_Window* w;
- Fl_Region region;
- Fl_X *next;
- int wait_for_expose;
- HDC private_dc; // used for OpenGL
- HCURSOR cursor;
- HDC saved_hdc; // saves the handle of the DC currently loaded
- // static variables, static functions and member functions
- static Fl_X* first;
- static Fl_X* i(const Fl_Window* w) {return w->i;}
- static int fake_X_wm(const Fl_Window* w,int &X, int &Y,
- int &bt,int &bx,int &by);
- void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
- void flush() {w->flush();}
- void set_minmax(LPMINMAXINFO minmax);
- void mapraise();
- static Fl_X* make(Fl_Window*);
-};
-extern FL_EXPORT HCURSOR fl_default_cursor;
-extern FL_EXPORT UINT fl_wake_msg;
-extern FL_EXPORT char fl_override_redirect; // hack into Fl_Window::make_xid()
-extern FL_EXPORT int fl_background_pixel; // hack into Fl_Window::make_xid()
-extern FL_EXPORT HPALETTE fl_palette; // non-zero only on 8-bit displays!
-extern FL_EXPORT void fl_release_dc(HWND w, HDC dc);
-extern FL_EXPORT void fl_save_dc( HWND w, HDC dc);
-
-inline Window fl_xid(const Fl_Window* w) { Fl_X *temp = Fl_X::i(w); return temp ? temp->xid : 0; }
-
-#else
-FL_EXPORT Window fl_xid_(const Fl_Window* w);
-#define fl_xid(w) fl_xid_(w)
-#endif // FL_LIBRARY || FL_INTERNALS
-
-FL_EXPORT Fl_Window* fl_find(Window xid);
-void fl_clip_region(Fl_Region);
-
-// most recent fl_color() or fl_rgbcolor() points at one of these:
-extern FL_EXPORT struct Fl_XMap {
- COLORREF rgb; // this should be the type the RGB() macro returns
- HPEN pen; // pen, 0 if none created yet
- int brush; // ref to solid brush, 0 if none created yet
-} *fl_current_xmap;
-inline COLORREF fl_RGB() {return fl_current_xmap->rgb;}
-inline HPEN fl_pen() {return fl_current_xmap->pen;}
-FL_EXPORT HBRUSH fl_brush(); // allocates a brush if necessary
-FL_EXPORT HBRUSH fl_brush_action(int); // now does the real work
-
-extern FL_EXPORT HINSTANCE fl_display;
-extern FL_EXPORT Window fl_window;
-extern FL_EXPORT HDC fl_gc;
-extern FL_EXPORT MSG fl_msg;
-extern FL_EXPORT HDC fl_GetDC(Window);
-extern FL_EXPORT HDC fl_makeDC(HBITMAP);
-
-// off-screen pixmaps: create, destroy, draw into, copy to window
-typedef HBITMAP Fl_Offscreen;
-#define fl_create_offscreen(w, h) \
- CreateCompatibleBitmap( (fl_gc ? fl_gc : fl_GetDC(0) ) , w, h)
-
-# define fl_begin_offscreen(b) \
- HDC _sgc=fl_gc; Window _sw=fl_window; \
- Fl_Surface_Device *_ss = Fl_Surface_Device::surface(); Fl_Display_Device::display_device()->set_current(); \
- fl_gc=fl_makeDC(b); int _savedc = SaveDC(fl_gc); fl_window=(HWND)b; fl_push_no_clip()
-
-# define fl_end_offscreen() \
- fl_pop_clip(); RestoreDC(fl_gc, _savedc); DeleteDC(fl_gc); _ss->set_current(); fl_window=_sw; fl_gc = _sgc
-
-
-FL_EXPORT void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
-FL_EXPORT void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
-#define fl_delete_offscreen(bitmap) DeleteObject(bitmap)
-
-// Bitmap masks
-typedef HBITMAP Fl_Bitmask;
-
-extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
-extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
-extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
-
-// Dummy function to register a function for opening files via the window manager...
-inline void fl_open_callback(void (*)(const char *)) {}
-
-extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
-#endif // FL_DOXYGEN
-//
-// End of "$Id: win32.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
-//
diff --git a/Libraries/FL/x.H b/Libraries/FL/x.H
deleted file mode 100644
index 002e429f..00000000
--- a/Libraries/FL/x.H
+++ /dev/null
@@ -1,199 +0,0 @@
-//
-// "$Id: x.H 8706 2011-05-21 10:05:19Z AlbrechtS $"
-//
-// X11 header file for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2011 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library 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
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-// These are internal fltk symbols that are necessary or useful for
-// calling Xlib. You should include this file if (and ONLY if) you
-// need to call Xlib directly. These symbols may not exist on non-X
-// systems.
-
-/** \class Fl_Mac_App_Menu
- Mac OS-specific class allowing to localize the application menu.
-
- These character strings are used to build the application menu. They can be localized
- at run time to any UTF-8 text by placing instructions such as this \e very
- early in the program:
- \verbatim
- Fl_Mac_App_Menu::print = "Imprimer la fenêtre";
- \endverbatim
-*/
-
-#if !defined(Fl_X_H) && !defined(FL_DOXYGEN)
-# define Fl_X_H
-
-# include "Enumerations.H"
-
-# ifdef WIN32
-# include "win32.H"
-# elif defined(__APPLE__)
-# include "mac.H"
-# else
-# if defined(_ABIN32) || defined(_ABI64) // fix for broken SGI Irix X .h files
-# pragma set woff 3322
-# endif
-# include <X11/Xlib.h>
-# include <X11/Xutil.h>
-# if defined(_ABIN32) || defined(_ABI64)
-# pragma reset woff 3322
-# endif
-# include <X11/Xatom.h>
-# include "Fl_Window.H"
-# include "Xutf8.h"
-// Mirror X definition of Region to Fl_Region, for portability...
-typedef Region Fl_Region;
-
-FL_EXPORT void fl_open_display();
-FL_EXPORT void fl_open_display(Display*);
-FL_EXPORT void fl_close_display();
-
-// constant info about the X server connection:
-extern FL_EXPORT Display *fl_display;
-extern FL_EXPORT int fl_screen;
-extern FL_EXPORT XVisualInfo *fl_visual;
-extern FL_EXPORT Colormap fl_colormap;
-
-
-// drawing functions:
-extern FL_EXPORT GC fl_gc;
-extern FL_EXPORT Window fl_window;
-FL_EXPORT ulong fl_xpixel(Fl_Color i);
-FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b);
-FL_EXPORT void fl_clip_region(Fl_Region);
-FL_EXPORT Fl_Region fl_clip_region();
-
-// feed events into fltk:
-FL_EXPORT int fl_handle(const XEvent&);
-
-// you can use these in Fl::add_handler() to look at events:
-extern FL_EXPORT const XEvent* fl_xevent;
-extern FL_EXPORT ulong fl_event_time;
-
-// off-screen pixmaps: create, destroy, draw into, copy to window:
-typedef ulong Fl_Offscreen;
-# define fl_create_offscreen(w,h) \
- XCreatePixmap(fl_display, \
- (Fl_Surface_Device::surface()->class_name() == Fl_Display_Device::class_id ? \
- fl_window : fl_xid(Fl::first_window()) ) , \
- w, h, fl_visual->depth)
-// begin/end are macros that save the old state in local variables:
-# define fl_begin_offscreen(pixmap) \
- Window _sw=fl_window; fl_window=pixmap; \
- Fl_Surface_Device *_ss = Fl_Surface_Device::surface(); Fl_Display_Device::display_device()->set_current(); \
- fl_push_no_clip()
-# define fl_end_offscreen() \
- fl_pop_clip(); fl_window = _sw; _ss->set_current()
-
-extern void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
-# define fl_delete_offscreen(pixmap) XFreePixmap(fl_display, pixmap)
-
-// Bitmap masks
-typedef ulong Fl_Bitmask;
-
-extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
-extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
-extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
-
-#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
-extern FL_EXPORT Window fl_message_window;
-extern FL_EXPORT void *fl_xftfont;
-FL_EXPORT Fl_Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.cxx
-
-// access to core fonts:
-// This class provides a "smart pointer" that returns a pointer to an XFontStruct.
-// The global variable fl_xfont can be called wherever a bitmap "core" font is
-// needed, e.g. when rendering to a GL context under X11.
-// With Xlib / X11 fonts, fl_xfont will return the current selected font.
-// With XFT / X11 fonts, fl_xfont will attempt to return the bitmap "core" font most
-// similar to (usually the same as) the current XFT font.
-class Fl_XFont_On_Demand
-{
-public:
- Fl_XFont_On_Demand(XFontStruct* p = NULL) : ptr(p) { }
- Fl_XFont_On_Demand& operator=(const Fl_XFont_On_Demand& x)
- { ptr = x.ptr; return *this; }
- Fl_XFont_On_Demand& operator=(XFontStruct* p)
- { ptr = p; return *this; }
- XFontStruct* value();
- operator XFontStruct*() { return value(); }
- XFontStruct& operator*() { return *value(); }
- XFontStruct* operator->() { return value(); }
- bool operator==(const Fl_XFont_On_Demand& x) { return ptr == x.ptr; }
- bool operator!=(const Fl_XFont_On_Demand& x) { return ptr != x.ptr; }
-private:
- XFontStruct *ptr;
-};
-extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
-
-// this object contains all X-specific stuff about a window:
-// Warning: this object is highly subject to change!
-// FL_LIBRARY or FL_INTERNALS must be defined to access this class.
-class FL_EXPORT Fl_X {
-public:
- Window xid;
- Window other_xid;
- Fl_Window *w;
- Fl_Region region;
- Fl_X *next;
- char wait_for_expose;
- char backbuffer_bad; // used for XDBE
- static Fl_X* first;
- static Fl_X* i(const Fl_Window* wi) {return wi->i;}
- void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
- void sendxjunk();
- static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);
- static Fl_X* set_xid(Fl_Window*, Window);
- // kludges to get around protection:
- void flush() {w->flush();}
- static void x(Fl_Window* wi, int X) {wi->x(X);}
- static void y(Fl_Window* wi, int Y) {wi->y(Y);}
-};
-
-extern FL_EXPORT char fl_override_redirect; // hack into Fl_X::make_xid()
-extern FL_EXPORT int fl_background_pixel; // hack into Fl_X::make_xid()
-
-inline Window fl_xid(const Fl_Window* w) { Fl_X *temp = Fl_X::i(w); return temp ? temp->xid : 0; }
-
-#else
-
-extern Window fl_xid_(const Fl_Window* w);
-#define fl_xid(w) fl_xid_(w)
-
-#endif // FL_LIBRARY || FL_INTERNALS
-
-FL_EXPORT Fl_Window* fl_find(Window xid);
-
-
-// Dummy function to register a function for opening files via the window manager...
-inline void fl_open_callback(void (*)(const char *)) {}
-
-extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
-
-# endif
-#endif
-
-//
-// End of "$Id: x.H 8706 2011-05-21 10:05:19Z AlbrechtS $".
-//
diff --git a/Libraries/crunch-ea9b8d/CHANGELOG.md b/Libraries/crunch-ea9b8d/CHANGELOG.md
deleted file mode 100644
index a6286af9..00000000
--- a/Libraries/crunch-ea9b8d/CHANGELOG.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# Change Log
-
-## [0.1.4] - 2012-11-24
-### Added
-* KTX file format
-* Basic ETC1 support
-* Simple makefile
-
-### Fixed
-* Various DDS format fixes
-
-## [0.1.3] - 2012-04-26
-### Added
-* Ported to Linux (tested on Ubuntu x86 w/Codeblocks). Note that a few features of the cmd line tool don't work yet (eg. -timestamp)
-
-[0.1.4]: https://github.com/BinomialLLC/crunch
-[0.1.3]: https://github.com/BinomialLLC/crunch \ No newline at end of file
diff --git a/Libraries/crunch-ea9b8d/CMakeLists.txt b/Libraries/crunch-ea9b8d/CMakeLists.txt
deleted file mode 100644
index 938863ef..00000000
--- a/Libraries/crunch-ea9b8d/CMakeLists.txt
+++ /dev/null
@@ -1,219 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
-SET(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
-PROJECT(crnlib)
-
-SET(SRCDIR "${CMAKE_CURRENT_SOURCE_DIR}/crnlib")
-SET(LIBDIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib
- ${CMAKE_CURRENT_SOURCE_DIR}/inc
- ${LIBDIR}/boost_1_52_0
-)
-
-FILE(GLOB SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt_endpoint_refiner.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt_fast.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt_hc.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt_hc_common.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt_image.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt1.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt5a.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dynamic_stream.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dynamic_string.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_etc.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_file_utils.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_find_files.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_freeimage_image_utils.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_hash.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_hash_map.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_helpers.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_huffman_codes.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_image.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_image_utils.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_intersect.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_jpgd.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_jpge.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_ktx_texture.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_lzma_codec.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_math.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_matrix.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_mem.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_miniz.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_mipmapped_texture.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_packed_uint.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_pixel_format.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_platform.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_prefix_coding.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_qdxt1.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_qdxt5.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_radix_sort.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_rand.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_ray.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_rect.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_resample_filters.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_resampler.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_rg_etc1.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_ryg_dxt.hpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_ryg_types.hpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_sparse_array.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_sparse_bit_array.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_strutils.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_symbol_codec.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_texture_comp.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_texture_conversion.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_texture_file_types.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_threaded_clusterizer.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_threaded_resampler.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_threading.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_threading_null.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_threading_pthreads.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_timer.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_traits.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_tree_clusterizer.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_types.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_utils.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_value.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_vec.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_vec_interval.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_vector.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_vector2d.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_winhdr.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_zeng.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_7zBuf.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_7zCrc.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_7zFile.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_7zVersion.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_Alloc.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_Bcj2.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_Bra.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_CpuArch.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_LzFind.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_LzHash.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_LzmaDec.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_LzmaEnc.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_LzmaLib.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_MyVersion.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_Types.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_arealist.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_assert.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_checksum.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_colorized_console.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_command_line_params.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_comp.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_console.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_core.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_data_stream.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dds_comp.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_decomp.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt_endpoint_refiner.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt_fast.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt_hc.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt_hc_common.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt_image.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt1.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt5a.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dynamic_string.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_etc.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_file_utils.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_find_files.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_hash.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_hash_map.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_huffman_codes.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_image_utils.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_jpgd.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_jpge.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_ktx_texture.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_lzma_codec.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_math.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_mem.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_miniz.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_mipmapped_texture.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_pixel_format.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_platform.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_prefix_coding.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_qdxt1.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_qdxt5.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_rand.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_resample_filters.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_resampler.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_rg_etc1.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_ryg_dxt.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_sparse_bit_array.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_stb_image.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_strutils.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_symbol_codec.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_texture_comp.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_texture_conversion.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_texture_file_types.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_threaded_resampler.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_threading_pthreads.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_timer.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_utils.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_value.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_vector.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_zeng.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crnlib.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_7zBuf.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_7zBuf2.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_7zCrc.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_7zFile.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_7zStream.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_Alloc.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_Bcj2.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_Bra.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_Bra86.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_BraIA64.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_LzFind.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_LzmaDec.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_LzmaEnc.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_LzmaLib.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_arealist.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_assert.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_atomics.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_buffer_stream.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_cfile_stream.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_checksum.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_clusterizer.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_color.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_colorized_console.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_command_line_params.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_comp.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_console.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_core.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_data_stream.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_data_stream_serializer.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dds_comp.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_dxt.h
- ${CMAKE_CURRENT_SOURCE_DIR}/inc/crn_decomp.h
- ${CMAKE_CURRENT_SOURCE_DIR}/inc/crnlib.h
- ${CMAKE_CURRENT_SOURCE_DIR}/inc/dds_defs.h
-)
-
-IF(WIN32)
-FILE(GLOB SOURCE_FILES_WIN32 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_LzFindMt.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_LzFindMt.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_Threads.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/lzma_Threads.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_threading_win32.h
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/crn_threading_win32.cpp
-)
-LIST(APPEND SOURCE_FILES ${SOURCE_FILES_WIN32})
-ENDIF()
-
-IF(APPLE)
-FILE(GLOB SOURCE_FILES_APPLE RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/crnlib/osx_pthread_spinlock_shim.h
-)
-LIST(APPEND SOURCE_FILES ${SOURCE_FILES_APPLE})
-ENDIF()
-
-ADD_LIBRARY(crnlib STATIC ${SOURCE_FILES})
-IF(APPLE)
- SET_TARGET_PROPERTIES(crnlib PROPERTIES
- COMPILE_FLAGS "-O3 -fomit-frame-pointer -ffast-math -fno-math-errno -g -fno-strict-aliasing -Wall -Wno-unused-value -Wno-unused -march=core2"
- )
- TARGET_LINK_LIBRARIES(crnlib pthread)
-ENDIF()
diff --git a/Libraries/crunch-ea9b8d/README.md b/Libraries/crunch-ea9b8d/README.md
deleted file mode 100644
index 248cb2cd..00000000
--- a/Libraries/crunch-ea9b8d/README.md
+++ /dev/null
@@ -1,307 +0,0 @@
-crunch/crnlib v1.04 - Advanced DXTn texture compression library
-Copyright (C) 2010-2017 Richard Geldreich, Jr. and Binomial LLC http://binomial.info
-
-For bugs or support contact Binomial <info@binomial.info>.
-
-This software uses the ZLIB license, which is located in license.txt.
-http://opensource.org/licenses/Zlib
-
-Portions of this software make use of public domain code originally
-written by Igor Pavlov (LZMA), RYG (crn_ryg_dxt*), and Sean Barrett (stb_image.c).
-
-If you use this software in a product, an acknowledgment in the product
-documentation would be highly appreciated but is not required.
-
-Note: crunch originally used to live on Google Code: https://code.google.com/p/crunch/
-
-## Overview
-
-crnlib is a lossy texture compression library for developers that ship
-content using the DXT1/5/N or 3DC compressed color/normal map/cubemap
-mipmapped texture formats. It was written by the same author as the open
-source [LZHAM compression library](http://code.google.com/p/lzham/).
-
-It can compress mipmapped 2D textures, normal maps, and cubemaps to
-approx. 1-1.25 bits/texel, and normal maps to 1.75-2 bits/texel. The
-actual bitrate depends on the complexity of the texture itself, the
-specified quality factor/target bitrate, and ultimately on the desired
-quality needed for a particular texture.
-
-crnlib's differs significantly from other approaches because its
-compressed texture data format was carefully designed to be quickly
-transcodable directly to DXTn with no intermediate recompression step.
-The typical (single threaded) transcode to DXTn rate is generally
-between 100-250 megatexels/sec. The current library supports PC
-(Win32/x64) and Xbox 360. Fast random access to individual mipmap levels
-is supported.
-
-crnlib can also generates standard .DDS files at specified quality
-setting, which results in files that are much more compressible by
-LZMA/Deflate/etc. compared to files generated by standard DXTn texture
-tools (see below). This feature allows easy integration into any engine
-or graphics library that already supports .DDS files.
-
-The .CRN file format supports the following core DXTn texture formats:
-DXT1 (but not DXT1A), DXT5, DXT5A, and DXN/3DC
-
-It also supports several popular swizzled variants (several are
-also supported by AMD's Compressonator):
-DXT5_XGBR, DXT5_xGxR, DXT5_AGBR, and DXT5_CCxY (experimental luma-chroma YCoCg).
-
-## Recommended Software
-
-AMD's [Compressonator tool](https://github.com/GPUOpen-Tools/Compressonator)
-is recommended to view the .DDS files created by the crunch tool and the included example projects.
-
-Note: Some of the swizzled DXTn .DDS output formats (such as DXT5_xGBR)
-read/written by the crunch tool or examples deviate from the DX9 DDS
-standard, so DXSDK tools such as DXTEX.EXE won't load them at all or
-they won't be properly displayed.
-
-## Compression Algorithm Details
-
-The compression process employed in creating both .CRN and
-clustered .DDS files utilizes a very high quality, scalable DXTn
-endpoint optimizer capable of processing any number of pixels (instead
-of the typical hard coded 16), optional adaptive switching between
-several macroblock sizes/configurations (currently any combination of
-4x4, 8x4, 4x8, and 8x8 pixel blocks), endpoint clusterization using
-top-down cluster analysis, vector quantization (VQ) of the selector
-indices, and several custom algorithms for compressing the resulting
-endpoint/selector codebooks and macroblock indices. Multiple feedback
-passes are performed between the clusterization and VQ steps to optimize
-quality, and several steps use a brute force refinement approach to improve
-quality. The majority of compression steps are multithreaded.
-
-The .CRN format currently utilizes canonical Huffman coding for speed
-(similar to Deflate but with much larger tables), but the next major
-version will also utilize adaptive binary arithmetic coding and higher
-order context modeling using already developed tech from the my LZHAM
-compression library.
-
-## Supported File Formats
-
-crnlib supports two compressed texture file formats. The first
-format (clustered .DDS) is simple to integrate into an existing project
-(typically, no code changes are required), but it doesn't offer the
-highest quality/compression ratio that crnlib is capable of. Integrating
-the second, higher quality custom format (.CRN) requires a few
-typically straightforward engine modifications to integrate the
-.CRN->DXTn transcoder header file library into your tools/engine.
-
-### .DDS
-
-crnlib can compress textures to standard DX9-style .DDS files using
-clustered DXTn compression, which is a subset of the approach used to
-create .CRN files.(For completeness, crnlib also supports vanilla, block
-by block DXTn compression too, but that's not very interesting.)
-Clustered DXTn compressed .DDS files are much more compressible than
-files created by other libraries/tools. Apart from increased
-compressibility, the .DDS files generated by this process are completely
-standard so they should be fairly easy to add to a project with little
-to no code changes.
-
-To actually benefit from clustered DXTn .DDS files, your engine needs to
-further losslessly compress the .DDS data generated by crnlib using a
-lossless codec such as zlib, lzo, LZMA, LZHAM, etc. Most likely, your
-engine does this already. (If not, you definitely should because DXTn
-compressed textures generally contain a large amount of highly redundant
-data.)
-
-Clustered .DDS files are intended to be the simplest/fastest way to
-integrate crnlib's tech into a project.
-
-### .CRN
-
-The second, better, option is to compress your textures to .CRN files
-using crnlib. To read the resulting .CRN data, you must add the .CRN
-transcoder library (located in the included single file, stand-alone
-header file library inc/crn_decomp.h) into your application. .CRN files
-provide noticeably higher quality at the same effective bitrate compared
-to clustered DXTn compressed .DDS files. Also, .CRN files don't require
-further lossless compression because they're already highly compressed.
-
-.CRN files are a bit more difficult/risky to integrate into a project, but
-the resulting compression ratio and quality is superior vs. clustered .DDS files.
-
-### .KTX
-
-crnlib and crunch can read/write the .KTX file format in various pixel formats.
-Rate distortion optimization (clustered DXTc compression) is not yet supported
-when writing .KTX files.
-
-The .KTX file format is just like .DDS, except it's a fairly well specified
-standard created by the Khronos Group. Unfortunately, almost all of the tools I've
-found that support .KTX are fairly (to very) buggy, or are limited to only a handful
-of pixel formats, so there's no guarantee that the .KTX files written by crnlib can
-be reliably read by other tools.
-
-## Building the Examples
-
-This release contains the source code and projects for three simple
-example projects:
-
-crn_examples.2008.sln is a Visual Studio 2008 (VC9) solution file
-containing projects for Win32 and x64. crnlib itself also builds with
-VS2005, VS2010, and gcc 4.5.0 (TDM GCC+MinGW). A codeblocks 10.05
-workspace and project file is also included, but compiling crnlib this
-way hasn't been tested much.
-
-### example1
-
-Demonstrates how to use crnlib's high-level C-helper
-compression/decompression/transcoding functions in inc/crnlib.h. It's a
-fairly complete example of crnlib's functionality.
-
-### example2
-Shows how to transcodec .CRN files to .DDS using **only**
-the functionality in inc/crn_decomp.h. It does not link against against
-crnlib.lib or depend on it in any way. (Note: The complete source code,
-approx. 4800 lines, to the CRN transcoder is included in inc/crn_decomp.h.)
-
-example2 is intended to show how simple it is to integrate CRN textures
-into your application.
-
-### example3
-Shows how to use the regular, low-level DXTn block compressor
-functions in inc/crnlib.h. This functionality is included for
-completeness. (Your engine or toolchain most likely already has its own
-DXTn compressor. crnlib's compressor is typically very competitive or
-superior to most available closed and open source CPU-based
-compressors.)
-
-## Creating Compressed Textures from the Command Line (crunch.exe)
-
-The simplest way to create compressed textures using crnlib is to
-integrate the bin\crunch.exe or bin\crunch_x64.exe) command line tool
-into your texture build toolchain or export process. It can write DXTn
-compressed 2D/cubemap textures to regular DXTn compressed .DDS,
-clustered (or reduced entropy) DXTn compressed .DDS, or .CRN files. It
-can also transcode or decompress files to several standard image
-formats, such as TGA or BMP. Run crunch.exe with no options for help.
-
-The .CRN files created by crunch.exe can be efficiently transcoded to
-DXTn using the included CRN transcoding library, located in full source
-form under inc/crn_decomp.h.
-
-Here are a few example crunch.exe command lines:
-
-1. Compress blah.tga to blah.dds using normal DXT1 compression:
- * `crunch -file blah.tga -fileformat dds -dxt1`
-
-2. Compress blah.tga to blah.dds using clustered DXT1 at an effective bitrate of 1.5 bits/texel, display image statistic:
- * `crunch -file blah.tga -fileformat dds -dxt1 -bitrate 1.5 -imagestats`
-
-3. Compress blah.tga to blah.dds using clustered DXT1 at quality level 100 (from [0,255]), with no mipmaps, display LZMA statistics:
- * `crunch -file blah.tga -fileformat dds -dxt1 -quality 100 -mipmode none -lzmastats`
-
-3. Compress blah.tga to blah.crn using clustered DXT1 at a bitrate of 1.2 bits/texel, no mipmaps:
- * `crunch -file blah.tga -dxt1 -bitrate 1.2 -mipmode none`
-
-4. Decompress blah.dds to a .tga file:
- * `crunch -file blah.dds -fileformat tga`
-
-5. Transcode blah.crn to a .dds file:
- * `crunch -file blah.crn`
-
-6. Decompress blah.crn, writing each mipmap level to a separate .tga file:
- * `crunch -split -file blah.crn -fileformat tga`
-
-crunch.exe can do a lot more, like rescale/crop images before
-compression, convert images from one file format to another, compare
-images, process multiple images, etc.
-
-Note: I would have included the full source to crunch.exe, but it still
-has some low-level dependencies to crnlib internals which I didn't have
-time to address. This version of crunch.exe has some reduced
-functionality compared to an earlier eval release. For example, XML file
-support is not included in this version.
-
-## Using crnlib
-
-The most flexible and powerful way of using crnlib is to integrate the
-library into your editor/toolchain/etc. and directly supply it your
-raw/source texture bits. See the C-style API's and comments in
-inc/crnlib.h.
-
-To compress, you basically fill in a few structs in and call one function:
-
-```c
-void *crn_compress( const crn_comp_params &comp_params,
- crn_uint32 &compressed_size,
- crn_uint32 *pActual_quality_level = NULL,
- float *pActual_bitrate = NULL);
-```
-
-Or, if you want crnlib to also generate mipmaps, you call this function:
-
-```c
-void *crn_compress( const crn_comp_params &comp_params,
- const crn_mipmap_params &mip_params,
- crn_uint32 &compressed_size,
- crn_uint32 *pActual_quality_level = NULL,
- float *pActual_bitrate = NULL);
-```
-
-You can also transcode/uncompress .DDS/.CRN files to raw 32bpp images
-using `crn_decompress_crn_to_dds()` and `crn_decompress_dds_to_images()`.
-
-Internally, crnlib just uses inc/crn_decomp.h to transcode textures to
-DXTn. If you only need to transcode .CRN format files to raw DXTn bits
-at runtime (and not compress), you don't actually need to compile or
-link against crnlib at all. Just include inc/crn_decomp.h, which
-contains a completely self-contained CRN transcoder in the "crnd"
-namespace. The `crnd_get_texture_info()`, `crnd_unpack_begin()`,
-`crnd_unpack_level()`, etc. functions are all you need to efficiently get
-at the raw DXTn bits, which can be directly supplied to whatever API or
-GPU you're using. (See example2.)
-
-Important note: When compiling under native client, be sure to define
-the `PLATFORM_NACL` macro before including the `inc/crn_decomp.h` header file library.
-
-## Known Issues/Bugs
-
-* crnlib currently assumes you'll be further losslessly compressing its
-output .DDS files using LZMA. However, some engines use weaker codecs
-such as LZO, zlib, or custom codecs, so crnlib's bitrate measurements
-will be inaccurate. It should be easy to allow the caller to plug-in
-custom lossless compressors for bitrate measurement.
-
-* Compressing to a desired bitrate can be time consuming, especially when
-processing large (2k or 4k) images to the .CRN format. There are several
-high-level optimizations employed when compressing to clustered DXTn .DDS
-files using multiple trials, but not so for .CRN.
-
-* The .CRN compressor does not currently use 3 color (transparent) DXT1
-blocks at all, only 4 color blocks. So it doesn't support DXT1A
-transparency, and its output quality suffers a little due to this
-limitation. (Note that the clustered DXTn compressor used when
-writing clustered .DDS files does *not* have this limitation.)
-
-* Clustered DXT5/DXT5A compressor is able to group DXT5A blocks into
-clusters only if they use absolute (black/white) selector indices. This
-hurts performance at very low bitrates, because too many bits are
-effectively given to alpha.
-
-* DXT3 is not supported when writing .CRN or clustered DXTn DDS files.
-(DXT3 is supported by crnlib's when compressing to regular DXTn DDS
-files.) You'll get DXT5 files if you request DXT3. However, DXT3 is
-supported by the regular DXTn block compressor. (DXT3's 4bpp fixed alpha
-sucks verses DXT5 alpha blocks, so I don't see this as a bug deal.)
-
-* The DXT5_CCXY format uses a simple YCoCg encoding that is workable but
-hasn't been tuned for max. quality yet.
-
-* Clustered (or rate distortion optimized) DXTc compression is only
-supported when writing to .DDS, not .KTX. Also, only plain block by block
-compression is supported when writing to ETC1, and .CRN does not support ETC1.
-
-## Compile to Javascript with Emscripten
-
-Download and install Emscripten:
- http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html
-
-From the root directory, run:
-```c
- emcc -O3 emscripten/crn.cpp -I./inc -s EXPORTED_FUNCTIONS="['_malloc', '_free', '_crn_get_width', '_crn_get_height', '_crn_get_levels', '_crn_get_dxt_format', '_crn_get_bytes_per_block', '_crn_get_uncompressed_size', '_crn_decompress']" -s NO_EXIT_RUNTIME=1 -s NO_FILESYSTEM=1 -s ELIMINATE_DUPLICATE_FUNCTIONS=1 -s ALLOW_MEMORY_GROWTH=1 --memory-init-file 0 -o crunch.js
-```
diff --git a/Libraries/crunch-ea9b8d/crn.2008.sln b/Libraries/crunch-ea9b8d/crn.2008.sln
deleted file mode 100644
index 64576f82..00000000
--- a/Libraries/crunch-ea9b8d/crn.2008.sln
+++ /dev/null
@@ -1,55 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "crunch", "crunch\crunch.2008.vcproj", "{8F645BA1-B996-49EB-859B-970A671DE05D}"
- ProjectSection(ProjectDependencies) = postProject
- {CF2E70E8-7133-4D96-92C7-68BB406C0664} = {CF2E70E8-7133-4D96-92C7-68BB406C0664}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "crnlib", "crnlib\crnlib.2008.vcproj", "{CF2E70E8-7133-4D96-92C7-68BB406C0664}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug_DLL|Win32 = Debug_DLL|Win32
- Debug_DLL|x64 = Debug_DLL|x64
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release_DLL|Win32 = Release_DLL|Win32
- Release_DLL|x64 = Release_DLL|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {8F645BA1-B996-49EB-859B-970A671DE05D}.Debug_DLL|Win32.ActiveCfg = Debug|Win32
- {8F645BA1-B996-49EB-859B-970A671DE05D}.Debug_DLL|x64.ActiveCfg = Debug|x64
- {8F645BA1-B996-49EB-859B-970A671DE05D}.Debug|Win32.ActiveCfg = Debug|Win32
- {8F645BA1-B996-49EB-859B-970A671DE05D}.Debug|Win32.Build.0 = Debug|Win32
- {8F645BA1-B996-49EB-859B-970A671DE05D}.Debug|x64.ActiveCfg = Debug|x64
- {8F645BA1-B996-49EB-859B-970A671DE05D}.Debug|x64.Build.0 = Debug|x64
- {8F645BA1-B996-49EB-859B-970A671DE05D}.Release_DLL|Win32.ActiveCfg = Release|Win32
- {8F645BA1-B996-49EB-859B-970A671DE05D}.Release_DLL|x64.ActiveCfg = Release|x64
- {8F645BA1-B996-49EB-859B-970A671DE05D}.Release|Win32.ActiveCfg = Release|Win32
- {8F645BA1-B996-49EB-859B-970A671DE05D}.Release|Win32.Build.0 = Release|Win32
- {8F645BA1-B996-49EB-859B-970A671DE05D}.Release|x64.ActiveCfg = Release|x64
- {8F645BA1-B996-49EB-859B-970A671DE05D}.Release|x64.Build.0 = Release|x64
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Debug_DLL|Win32.ActiveCfg = Debug_DLL|Win32
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Debug_DLL|Win32.Build.0 = Debug_DLL|Win32
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Debug_DLL|x64.ActiveCfg = Debug_DLL|x64
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Debug_DLL|x64.Build.0 = Debug_DLL|x64
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Debug|Win32.ActiveCfg = Debug|Win32
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Debug|Win32.Build.0 = Debug|Win32
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Debug|x64.ActiveCfg = Debug|x64
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Debug|x64.Build.0 = Debug|x64
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Release_DLL|Win32.Build.0 = Release_DLL|Win32
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Release_DLL|x64.ActiveCfg = Release_DLL|x64
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Release_DLL|x64.Build.0 = Release_DLL|x64
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Release|Win32.ActiveCfg = Release|Win32
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Release|Win32.Build.0 = Release|Win32
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Release|x64.ActiveCfg = Release|x64
- {CF2E70E8-7133-4D96-92C7-68BB406C0664}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Libraries/crunch-ea9b8d/crn.workspace b/Libraries/crunch-ea9b8d/crn.workspace
deleted file mode 100644
index dcc08dfa..00000000
--- a/Libraries/crunch-ea9b8d/crn.workspace
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_workspace_file>
- <Workspace title="Workspace">
- <Project filename="crunch/crunch.cbp" active="1">
- <Depends filename="crnlib/crnlib.cbp" />
- </Project>
- <Project filename="crnlib/crnlib.cbp" />
- </Workspace>
-</CodeBlocks_workspace_file>
diff --git a/Libraries/crunch-ea9b8d/crn_examples.2008.sln b/Libraries/crunch-ea9b8d/crn_examples.2008.sln
deleted file mode 100644
index 9e68ef0d..00000000
--- a/Libraries/crunch-ea9b8d/crn_examples.2008.sln
+++ /dev/null
@@ -1,74 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example1", "example1\example1.2008.vcproj", "{8F745B42-F996-49EB-859B-970A671DE05D}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example2", "example2\example2.2008.vcproj", "{AF745B42-F996-49EB-859B-970A671DEF5E}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example3", "example3\example3.2008.vcproj", "{AF745B42-E296-46EB-859B-970A671DEF5E}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug_DLL|Win32 = Debug_DLL|Win32
- Debug_DLL|x64 = Debug_DLL|x64
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release_DLL|Win32 = Release_DLL|Win32
- Release_DLL|x64 = Release_DLL|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {8F745B42-F996-49EB-859B-970A671DE05D}.Debug_DLL|Win32.ActiveCfg = Debug_DLL|Win32
- {8F745B42-F996-49EB-859B-970A671DE05D}.Debug_DLL|Win32.Build.0 = Debug_DLL|Win32
- {8F745B42-F996-49EB-859B-970A671DE05D}.Debug_DLL|x64.ActiveCfg = Debug_DLL|x64
- {8F745B42-F996-49EB-859B-970A671DE05D}.Debug_DLL|x64.Build.0 = Debug_DLL|x64
- {8F745B42-F996-49EB-859B-970A671DE05D}.Debug|Win32.ActiveCfg = Debug|Win32
- {8F745B42-F996-49EB-859B-970A671DE05D}.Debug|Win32.Build.0 = Debug|Win32
- {8F745B42-F996-49EB-859B-970A671DE05D}.Debug|x64.ActiveCfg = Debug|x64
- {8F745B42-F996-49EB-859B-970A671DE05D}.Debug|x64.Build.0 = Debug|x64
- {8F745B42-F996-49EB-859B-970A671DE05D}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32
- {8F745B42-F996-49EB-859B-970A671DE05D}.Release_DLL|Win32.Build.0 = Release_DLL|Win32
- {8F745B42-F996-49EB-859B-970A671DE05D}.Release_DLL|x64.ActiveCfg = Release_DLL|x64
- {8F745B42-F996-49EB-859B-970A671DE05D}.Release_DLL|x64.Build.0 = Release_DLL|x64
- {8F745B42-F996-49EB-859B-970A671DE05D}.Release|Win32.ActiveCfg = Release|Win32
- {8F745B42-F996-49EB-859B-970A671DE05D}.Release|Win32.Build.0 = Release|Win32
- {8F745B42-F996-49EB-859B-970A671DE05D}.Release|x64.ActiveCfg = Release|x64
- {8F745B42-F996-49EB-859B-970A671DE05D}.Release|x64.Build.0 = Release|x64
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Debug_DLL|Win32.ActiveCfg = Debug_DLL|Win32
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Debug_DLL|Win32.Build.0 = Debug_DLL|Win32
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Debug_DLL|x64.ActiveCfg = Debug_DLL|x64
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Debug_DLL|x64.Build.0 = Debug_DLL|x64
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Debug|Win32.ActiveCfg = Debug|Win32
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Debug|Win32.Build.0 = Debug|Win32
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Debug|x64.ActiveCfg = Debug|x64
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Debug|x64.Build.0 = Debug|x64
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Release_DLL|Win32.Build.0 = Release_DLL|Win32
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Release_DLL|x64.ActiveCfg = Release_DLL|x64
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Release_DLL|x64.Build.0 = Release_DLL|x64
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Release|Win32.ActiveCfg = Release|Win32
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Release|Win32.Build.0 = Release|Win32
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Release|x64.ActiveCfg = Release|x64
- {AF745B42-F996-49EB-859B-970A671DEF5E}.Release|x64.Build.0 = Release|x64
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Debug_DLL|Win32.ActiveCfg = Debug_DLL|Win32
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Debug_DLL|Win32.Build.0 = Debug_DLL|Win32
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Debug_DLL|x64.ActiveCfg = Debug_DLL|x64
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Debug_DLL|x64.Build.0 = Debug_DLL|x64
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Debug|Win32.ActiveCfg = Debug|Win32
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Debug|Win32.Build.0 = Debug|Win32
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Debug|x64.ActiveCfg = Debug|x64
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Debug|x64.Build.0 = Debug|x64
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Release_DLL|Win32.Build.0 = Release_DLL|Win32
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Release_DLL|x64.ActiveCfg = Release_DLL|x64
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Release_DLL|x64.Build.0 = Release_DLL|x64
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Release|Win32.ActiveCfg = Release|Win32
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Release|Win32.Build.0 = Release|Win32
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Release|x64.ActiveCfg = Release|x64
- {AF745B42-E296-46EB-859B-970A671DEF5E}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Libraries/crunch-ea9b8d/crn_linux.workspace b/Libraries/crunch-ea9b8d/crn_linux.workspace
deleted file mode 100644
index af9107b1..00000000
--- a/Libraries/crunch-ea9b8d/crn_linux.workspace
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_workspace_file>
- <Workspace title="Workspace">
- <Project filename="crunch/crunch_linux.cbp" active="1">
- <Depends filename="crnlib/crnlib_linux.cbp" />
- </Project>
- <Project filename="crnlib/crnlib_linux.cbp" />
- </Workspace>
-</CodeBlocks_workspace_file>
diff --git a/Libraries/crunch-ea9b8d/crnlib/Makefile b/Libraries/crunch-ea9b8d/crnlib/Makefile
deleted file mode 100644
index 9a9de187..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/Makefile
+++ /dev/null
@@ -1,96 +0,0 @@
-COMPILE_OPTIONS = -O3 -fomit-frame-pointer -ffast-math -fno-math-errno -g -fno-strict-aliasing -Wall -Wno-unused-value -Wno-unused -march=core2
-LINKER_OPTIONS = -lpthread -g
-
-OBJECTS = \
- crn_arealist.o \
- crn_assert.o \
- crn_checksum.o \
- crn_colorized_console.o \
- crn_command_line_params.o \
- crn_comp.o \
- crn_console.o \
- crn_core.o \
- crn_data_stream.o \
- crn_mipmapped_texture.o \
- crn_decomp.o \
- crn_dxt1.o \
- crn_dxt5a.o \
- crn_dxt.o \
- crn_dxt_endpoint_refiner.o \
- crn_dxt_fast.o \
- crn_dxt_hc_common.o \
- crn_dxt_hc.o \
- crn_dxt_image.o \
- crn_dynamic_string.o \
- crn_file_utils.o \
- crn_find_files.o \
- crn_hash.o \
- crn_hash_map.o \
- crn_huffman_codes.o \
- crn_image_utils.o \
- crnlib.o \
- crn_math.o \
- crn_mem.o \
- crn_pixel_format.o \
- crn_platform.o \
- crn_prefix_coding.o \
- crn_qdxt1.o \
- crn_qdxt5.o \
- crn_rand.o \
- crn_resample_filters.o \
- crn_resampler.o \
- crn_ryg_dxt.o \
- crn_sparse_bit_array.o \
- crn_stb_image.o \
- crn_strutils.o \
- crn_symbol_codec.o \
- crn_texture_file_types.o \
- crn_threaded_resampler.o \
- crn_threading_pthreads.o \
- crn_timer.o \
- crn_utils.o \
- crn_value.o \
- crn_vector.o \
- crn_zeng.o \
- crn_texture_comp.o \
- crn_texture_conversion.o \
- crn_dds_comp.o \
- crn_lzma_codec.o \
- crn_ktx_texture.o \
- crn_etc.o \
- crn_rg_etc1.o \
- crn_miniz.o \
- crn_jpge.o \
- crn_jpgd.o \
- lzma_7zBuf2.o \
- lzma_7zBuf.o \
- lzma_7zCrc.o \
- lzma_7zFile.o \
- lzma_7zStream.o \
- lzma_Alloc.o \
- lzma_Bcj2.o \
- lzma_Bra86.o \
- lzma_Bra.o \
- lzma_BraIA64.o \
- lzma_LzFind.o \
- lzma_LzmaDec.o \
- lzma_LzmaEnc.o \
- lzma_LzmaLib.o
-
-all: crunch
-
-%.o: %.cpp
- g++ $< -o $@ -c $(COMPILE_OPTIONS)
-
-crunch.o: ../crunch/crunch.cpp
- g++ $< -o $@ -c -I../inc -I../crnlib $(COMPILE_OPTIONS)
-
-corpus_gen.o: ../crunch/corpus_gen.cpp
- g++ $< -o $@ -c -I../inc -I../crnlib $(COMPILE_OPTIONS)
-
-corpus_test.o: ../crunch/corpus_test.cpp
- g++ $< -o $@ -c -I../inc -I../crnlib $(COMPILE_OPTIONS)
-
-crunch: $(OBJECTS) crunch.o corpus_gen.o corpus_test.o
- g++ $(OBJECTS) crunch.o corpus_gen.o corpus_test.o -o crunch $(LINKER_OPTIONS)
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_arealist.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_arealist.cpp
deleted file mode 100644
index a68780d2..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_arealist.cpp
+++ /dev/null
@@ -1,698 +0,0 @@
-// File: crn_arealist.cpp - 2D shape algebra (currently unused)
-// See Copyright Notice and license at the end of inc/crnlib.h
-// Ported from the PowerView DOS image viewer, a product I wrote back in 1993. Not currently used in the open source release of crnlib.
-#include "crn_core.h"
-#include "crn_arealist.h"
-
-#define RECT_DEBUG
-
-namespace crnlib
-{
-
- static void area_fatal_error(const char* pFunc, const char* pMsg, ...)
- {
- pFunc;
- va_list args;
- va_start(args, pMsg);
-
- char buf[512];
-#ifdef _MSC_VER
- _vsnprintf_s(buf, sizeof(buf), pMsg, args);
-#else
- vsnprintf(buf, sizeof(buf), pMsg, args);
-#endif
-
- va_end(args);
-
- CRNLIB_FAIL(buf);
- }
-
- static Area * delete_area(Area_List *Plist, Area *Parea)
- {
- Area *p, *q;
-
- #ifdef RECT_DEBUG
- if ((Parea == Plist->Phead) || (Parea == Plist->Ptail))
- area_fatal_error("delete_area", "tried to remove head or tail");
- #endif
-
- p = Parea->Pprev;
- q = Parea->Pnext;
- p->Pnext = q;
- q->Pprev = p;
-
- Parea->Pnext = Plist->Pfree;
- Parea->Pprev = NULL;
- Plist->Pfree = Parea;
-
- return (q);
- }
-
- static Area * alloc_area(Area_List *Plist)
- {
- Area *p = Plist->Pfree;
-
- if (p == NULL)
- {
- if (Plist->next_free == Plist->total_areas)
- area_fatal_error("alloc_area", "Out of areas!");
-
- p = Plist->Phead + Plist->next_free;
- Plist->next_free++;
- }
- else
- Plist->Pfree = p->Pnext;
-
- return (p);
- }
-
- static Area * insert_area_before(Area_List *Plist, Area *Parea,
- int x1, int y1, int x2, int y2)
- {
- Area *p, *Pnew_area = alloc_area(Plist);
-
- p = Parea->Pprev;
-
- p->Pnext = Pnew_area;
-
- Pnew_area->Pprev = p;
- Pnew_area->Pnext = Parea;
-
- Parea->Pprev = Pnew_area;
-
- Pnew_area->x1 = x1;
- Pnew_area->y1 = y1;
- Pnew_area->x2 = x2;
- Pnew_area->y2 = y2;
-
- return (Pnew_area);
- }
-
- static Area * insert_area_after(Area_List *Plist, Area *Parea,
- int x1, int y1, int x2, int y2)
- {
- Area *p, *Pnew_area = alloc_area(Plist);
-
- p = Parea->Pnext;
-
- p->Pprev = Pnew_area;
-
- Pnew_area->Pnext = p;
- Pnew_area->Pprev = Parea;
-
- Parea->Pnext = Pnew_area;
-
- Pnew_area->x1 = x1;
- Pnew_area->y1 = y1;
- Pnew_area->x2 = x2;
- Pnew_area->y2 = y2;
-
- return (Pnew_area);
- }
-
- void Area_List_deinit(Area_List* Pobj_base)
- {
- Area_List *Plist = (Area_List *)Pobj_base;
-
- if (!Plist)
- return;
-
- if (Plist->Phead)
- {
- crnlib_free(Plist->Phead);
- Plist->Phead = NULL;
- }
-
- crnlib_free(Plist);
- }
-
- Area_List * Area_List_init(int max_areas)
- {
- Area_List *Plist = (Area_List*)crnlib_calloc(1, sizeof(Area_List));
-
- Plist->total_areas = max_areas + 2;
-
- Plist->Phead = (Area *)crnlib_calloc(max_areas + 2, sizeof(Area));
- Plist->Ptail = Plist->Phead + 1;
-
- Plist->Phead->Pprev = NULL;
- Plist->Phead->Pnext = Plist->Ptail;
-
- Plist->Ptail->Pprev = Plist->Phead;
- Plist->Ptail->Pnext = NULL;
-
- Plist->Pfree = NULL;
- Plist->next_free = 2;
-
- return (Plist);
- }
-
- void Area_List_print(Area_List *Plist)
- {
- Area *Parea = Plist->Phead->Pnext;
-
- while (Parea != Plist->Ptail)
- {
- printf("%04i %04i : %04i %04i\n", Parea->x1, Parea->y1, Parea->x2, Parea->y2);
-
- Parea = Parea->Pnext;
- }
- }
-
- Area_List * Area_List_dup_new(Area_List *Plist,
- int x_ofs, int y_ofs)
- {
- int i;
- Area_List *Pnew_list = (Area_List*)crnlib_calloc(1, sizeof(Area_List));
-
- Pnew_list->total_areas = Plist->total_areas;
-
- Pnew_list->Phead = (Area *)crnlib_malloc(sizeof(Area) * Plist->total_areas);
- Pnew_list->Ptail = Pnew_list->Phead + 1;
-
- Pnew_list->Pfree = (Plist->Pfree) ? ((Plist->Pfree - Plist->Phead) + Pnew_list->Phead) : NULL;
-
- Pnew_list->next_free = Plist->next_free;
-
- memcpy(Pnew_list->Phead, Plist->Phead, sizeof(Area) * Plist->total_areas);
-
- for (i = 0; i < Plist->total_areas; i++)
- {
- Pnew_list->Phead[i].Pnext = (Plist->Phead[i].Pnext == NULL) ? NULL : (Plist->Phead[i].Pnext - Plist->Phead) + Pnew_list->Phead;
- Pnew_list->Phead[i].Pprev = (Plist->Phead[i].Pprev == NULL) ? NULL : (Plist->Phead[i].Pprev - Plist->Phead) + Pnew_list->Phead;
-
- Pnew_list->Phead[i].x1 += x_ofs;
- Pnew_list->Phead[i].y1 += y_ofs;
- Pnew_list->Phead[i].x2 += x_ofs;
- Pnew_list->Phead[i].y2 += y_ofs;
- }
-
- return (Pnew_list);
- }
-
- uint Area_List_get_num(Area_List* Plist)
- {
- uint num = 0;
-
- Area *Parea = Plist->Phead->Pnext;
-
- while (Parea != Plist->Ptail)
- {
- num++;
-
- Parea = Parea->Pnext;
- }
-
- return num;
- }
-
- void Area_List_dup(Area_List *Psrc_list, Area_List *Pdst_list,
- int x_ofs, int y_ofs)
- {
- int i;
-
- if (Psrc_list->total_areas != Pdst_list->total_areas)
- area_fatal_error("Area_List_dup", "Src and Dst total_areas must be equal!");
-
- Pdst_list->Pfree = (Psrc_list->Pfree) ? ((Psrc_list->Pfree - Psrc_list->Phead) + Pdst_list->Phead) : NULL;
-
- Pdst_list->next_free = Psrc_list->next_free;
-
- memcpy(Pdst_list->Phead, Psrc_list->Phead, sizeof(Area) * Psrc_list->total_areas);
-
- if ((x_ofs) || (y_ofs))
- {
- for (i = 0; i < Psrc_list->total_areas; i++)
- {
- Pdst_list->Phead[i].Pnext = (Psrc_list->Phead[i].Pnext == NULL) ? NULL : (Psrc_list->Phead[i].Pnext - Psrc_list->Phead) + Pdst_list->Phead;
- Pdst_list->Phead[i].Pprev = (Psrc_list->Phead[i].Pprev == NULL) ? NULL : (Psrc_list->Phead[i].Pprev - Psrc_list->Phead) + Pdst_list->Phead;
-
- Pdst_list->Phead[i].x1 += x_ofs;
- Pdst_list->Phead[i].y1 += y_ofs;
- Pdst_list->Phead[i].x2 += x_ofs;
- Pdst_list->Phead[i].y2 += y_ofs;
- }
- }
- else
- {
- for (i = 0; i < Psrc_list->total_areas; i++)
- {
- Pdst_list->Phead[i].Pnext = (Psrc_list->Phead[i].Pnext == NULL) ? NULL : (Psrc_list->Phead[i].Pnext - Psrc_list->Phead) + Pdst_list->Phead;
- Pdst_list->Phead[i].Pprev = (Psrc_list->Phead[i].Pprev == NULL) ? NULL : (Psrc_list->Phead[i].Pprev - Psrc_list->Phead) + Pdst_list->Phead;
- }
- }
- }
-
- void Area_List_copy(
- Area_List *Psrc_list, Area_List *Pdst_list,
- int x_ofs, int y_ofs)
- {
- Area *Parea = Psrc_list->Phead->Pnext;
-
- Area_List_clear(Pdst_list);
-
- if ((x_ofs) || (y_ofs))
- {
- Area *Pprev_area = Pdst_list->Phead;
-
- while (Parea != Psrc_list->Ptail)
- {
- // Area *p, *Pnew_area;
- Area *Pnew_area;
-
- if (Pdst_list->next_free == Pdst_list->total_areas)
- area_fatal_error("Area_List_copy", "Out of areas!");
-
- Pnew_area = Pdst_list->Phead + Pdst_list->next_free;
- Pdst_list->next_free++;
-
- Pnew_area->Pprev = Pprev_area;
- Pprev_area->Pnext = Pnew_area;
-
- Pnew_area->x1 = Parea->x1 + x_ofs;
- Pnew_area->y1 = Parea->y1 + y_ofs;
- Pnew_area->x2 = Parea->x2 + x_ofs;
- Pnew_area->y2 = Parea->y2 + y_ofs;
-
- Pprev_area = Pnew_area;
-
- Parea = Parea->Pnext;
- }
-
- Pprev_area->Pnext = Pdst_list->Ptail;
- }
- else
- {
- #if 0
- while (Parea != Psrc_list->Ptail)
- {
- insert_area_after(Pdst_list, Pdst_list->Phead,
- Parea->x1,
- Parea->y1,
- Parea->x2,
- Parea->y2);
-
- Parea = Parea->Pnext;
- }
- #endif
-
- Area *Pprev_area = Pdst_list->Phead;
-
- while (Parea != Psrc_list->Ptail)
- {
- // Area *p, *Pnew_area;
- Area *Pnew_area;
-
- if (Pdst_list->next_free == Pdst_list->total_areas)
- area_fatal_error("Area_List_copy", "Out of areas!");
-
- Pnew_area = Pdst_list->Phead + Pdst_list->next_free;
- Pdst_list->next_free++;
-
- Pnew_area->Pprev = Pprev_area;
- Pprev_area->Pnext = Pnew_area;
-
- Pnew_area->x1 = Parea->x1;
- Pnew_area->y1 = Parea->y1;
- Pnew_area->x2 = Parea->x2;
- Pnew_area->y2 = Parea->y2;
-
- Pprev_area = Pnew_area;
-
- Parea = Parea->Pnext;
- }
-
- Pprev_area->Pnext = Pdst_list->Ptail;
- }
- }
-
- void Area_List_clear(Area_List *Plist)
- {
- Plist->Phead->Pnext = Plist->Ptail;
- Plist->Ptail->Pprev = Plist->Phead;
- Plist->Pfree = NULL;
- Plist->next_free = 2;
- }
-
- void Area_List_set(Area_List *Plist, int x1, int y1, int x2, int y2)
- {
- Plist->Pfree = NULL;
-
- Plist->Phead[2].x1 = x1;
- Plist->Phead[2].y1 = y1;
- Plist->Phead[2].x2 = x2;
- Plist->Phead[2].y2 = y2;
-
- Plist->Phead[2].Pprev = Plist->Phead;
- Plist->Phead->Pnext = Plist->Phead + 2;
-
- Plist->Phead[2].Pnext = Plist->Ptail;
- Plist->Ptail->Pprev = Plist->Phead + 2;
-
- Plist->next_free = 3;
- }
-
- void Area_List_remove(Area_List *Plist,
- int x1, int y1, int x2, int y2)
- {
- int l, h;
- Area *Parea = Plist->Phead->Pnext;
-
- #ifdef RECT_DEBUG
- if ((x1 > x2) || (y1 > y2))
- area_fatal_error("area_list_remove", "invalid coords: %i %i %i %i", x1, y1, x2, y2);
- #endif
-
- while (Parea != Plist->Ptail)
- {
- // Not touching
- if ((x2 < Parea->x1) || (x1 > Parea->x2) ||
- (y2 < Parea->y1) || (y1 > Parea->y2))
- {
- Parea = Parea->Pnext;
- continue;
- }
-
- // Completely covers
- if ((x1 <= Parea->x1) && (x2 >= Parea->x2) &&
- (y1 <= Parea->y1) && (y2 >= Parea->y2))
- {
- if ((x1 == Parea->x1) && (x2 == Parea->x2) &&
- (y1 == Parea->y1) && (y2 == Parea->y2))
- {
- delete_area(Plist, Parea);
- return;
- }
-
- Parea = delete_area(Plist, Parea);
-
- continue;
- }
-
- // top
- if (y1 > Parea->y1)
- {
- insert_area_before(Plist, Parea,
- Parea->x1, Parea->y1,
- Parea->x2, y1 - 1);
- }
-
- // bottom
- if (y2 < Parea->y2)
- {
- insert_area_before(Plist, Parea,
- Parea->x1, y2 + 1,
- Parea->x2, Parea->y2);
- }
-
- l = math::maximum(y1, Parea->y1);
- h = math::minimum(y2, Parea->y2);
-
- // left middle
- if (x1 > Parea->x1)
- {
- insert_area_before(Plist, Parea,
- Parea->x1, l,
- x1 - 1, h);
- }
-
- // right middle
- if (x2 < Parea->x2)
- {
- insert_area_before(Plist, Parea,
- x2 + 1, l,
- Parea->x2, h);
- }
-
- // early out - we know there's nothing else to remove, as areas can
- // never overlap
- if ((x1 >= Parea->x1) && (x2 <= Parea->x2) &&
- (y1 >= Parea->y1) && (y2 <= Parea->y2))
- {
- delete_area(Plist, Parea);
- return;
- }
-
- Parea = delete_area(Plist, Parea);
- }
- }
-
- void Area_List_insert(Area_List *Plist,
- int x1, int y1, int x2, int y2,
- bool combine)
- {
- Area *Parea = Plist->Phead->Pnext;
-
- #ifdef RECT_DEBUG
- if ((x1 > x2) || (y1 > y2))
- area_fatal_error("Area_List_insert", "invalid coords: %i %i %i %i", x1, y1, x2, y2);
- #endif
-
- while (Parea != Plist->Ptail)
- {
- // totally covers
- if ((x1 <= Parea->x1) && (x2 >= Parea->x2) &&
- (y1 <= Parea->y1) && (y2 >= Parea->y2))
- {
- Parea = delete_area(Plist, Parea);
- continue;
- }
-
- // intersects
- if ((x2 >= Parea->x1) && (x1 <= Parea->x2) &&
- (y2 >= Parea->y1) && (y1 <= Parea->y2))
- {
- int ax1, ay1, ax2, ay2;
-
- ax1 = Parea->x1;
- ay1 = Parea->y1;
- ax2 = Parea->x2;
- ay2 = Parea->y2;
-
- if (x1 < ax1)
- Area_List_insert(Plist, x1, math::maximum(y1, ay1), ax1 - 1, math::minimum(y2, ay2), combine);
-
- if (x2 > ax2)
- Area_List_insert(Plist, ax2 + 1, math::maximum(y1, ay1), x2, math::minimum(y2, ay2), combine);
-
- if (y1 < ay1)
- Area_List_insert(Plist, x1, y1, x2, ay1 - 1, combine);
-
- if (y2 > ay2)
- Area_List_insert(Plist, x1, ay2 + 1, x2, y2, combine);
-
- return;
- }
-
- if (combine)
- {
- if ((x1 == Parea->x1) && (x2 == Parea->x2))
- {
- if ((y2 == Parea->y1 - 1) || (y1 == Parea->y2 + 1))
- {
- delete_area(Plist, Parea);
- Area_List_insert(Plist, x1, math::minimum(y1, Parea->y1), x2, math::maximum(y2, Parea->y2), CRNLIB_TRUE);
- return;
- }
- }
- else if ((y1 == Parea->y1) && (y2 == Parea->y2))
- {
- if ((x2 == Parea->x1 - 1) || (x1 == Parea->x2 + 1))
- {
- delete_area(Plist, Parea);
- Area_List_insert(Plist, math::minimum(x1, Parea->x1), y1, math::maximum(x2, Parea->x2), y2, CRNLIB_TRUE);
- return;
- }
- }
- }
-
- Parea = Parea->Pnext;
- }
-
- insert_area_before(Plist, Parea, x1, y1, x2, y2);
- }
-
- void Area_List_intersect_area(Area_List *Plist,
- int x1, int y1, int x2, int y2)
- {
- Area *Parea = Plist->Phead->Pnext;
-
- while (Parea != Plist->Ptail)
- {
- // doesn't cover
- if ((x2 < Parea->x1) || (x1 > Parea->x2) ||
- (y2 < Parea->y1) || (y1 > Parea->y2))
- {
- Parea = delete_area(Plist, Parea);
- continue;
- }
-
- // totally covers
- if ((x1 <= Parea->x1) && (x2 >= Parea->x2) &&
- (y1 <= Parea->y1) && (y2 >= Parea->y2))
- {
- Parea = Parea->Pnext;
- continue;
- }
-
- // Oct 21- should insert after, because deleted area will access the NEXT area!
- // insert_area_after(Plist, Parea,
- // math::maximum(x1, Parea->x1),
- // math::maximum(y1, Parea->y1),
- // math::minimum(x2, Parea->x2),
- // math::minimum(y2, Parea->y2));
-
- insert_area_before(Plist, Parea,
- math::maximum(x1, Parea->x1),
- math::maximum(y1, Parea->y1),
- math::minimum(x2, Parea->x2),
- math::minimum(y2, Parea->y2));
-
- Parea = delete_area(Plist, Parea);
- }
- }
-
- #if 0
- void Area_List_intersect_Area_List(
- Area_List *Pouter_list,
- Area_List *Pinner_list,
- Area_List *Pdst_list)
- {
- Area *Parea1 = Pouter_list->Phead->Pnext;
-
- while (Parea1 != Pouter_list->Ptail)
- {
- Area *Parea2 = Pinner_list->Phead->Pnext;
- int x1, y1, x2, y2;
-
- x1 = Parea1->x1; x2 = Parea1->x2;
- y1 = Parea1->y1; y2 = Parea1->y2;
-
- while (Parea2 != Pinner_list->Ptail)
- {
- if ((x1 <= Parea2->x2) && (x2 >= Parea2->x1) &&
- (y1 <= Parea2->y2) && (y2 >= Parea2->y1))
- {
- insert_area_after(Pdst_list, Pdst_list->Phead,
- math::maximum(x1, Parea2->x1),
- math::maximum(y1, Parea2->y1),
- math::minimum(x2, Parea2->x2),
- math::minimum(y2, Parea2->y2));
- }
-
- Parea2 = Parea2->Pnext;
- }
-
- Parea1 = Parea1->Pnext;
- }
- }
- #endif
-
- #if 1
- void Area_List_intersect_Area_List(Area_List *Pouter_list,
- Area_List *Pinner_list,
- Area_List *Pdst_list)
- {
- Area *Parea1 = Pouter_list->Phead->Pnext;
-
- while (Parea1 != Pouter_list->Ptail)
- {
- Area *Parea2 = Pinner_list->Phead->Pnext;
- int x1, y1, x2, y2;
-
- x1 = Parea1->x1; x2 = Parea1->x2;
- y1 = Parea1->y1; y2 = Parea1->y2;
-
- while (Parea2 != Pinner_list->Ptail)
- {
- if ((x1 <= Parea2->x2) && (x2 >= Parea2->x1) &&
- (y1 <= Parea2->y2) && (y2 >= Parea2->y1))
- {
- int nx1, ny1, nx2, ny2;
-
- nx1 = math::maximum(x1, Parea2->x1);
- ny1 = math::maximum(y1, Parea2->y1);
- nx2 = math::minimum(x2, Parea2->x2);
- ny2 = math::minimum(y2, Parea2->y2);
-
- if (Pdst_list->Phead->Pnext == Pdst_list->Ptail)
- {
- insert_area_after(Pdst_list, Pdst_list->Phead,
- nx1, ny1, nx2, ny2);
- }
- else
- {
- Area_Ptr Ptemp = Pdst_list->Phead->Pnext;
- if ((Ptemp->x1 == nx1) && (Ptemp->x2 == nx2))
- {
- if (Ptemp->y1 == (ny2+1))
- {
- Ptemp->y1 = ny1;
- goto next;
- }
- else if (Ptemp->y2 == (ny1-1))
- {
- Ptemp->y2 = ny2;
- goto next;
- }
- }
- else if ((Ptemp->y1 == ny1) && (Ptemp->y2 == ny2))
- {
- if (Ptemp->x1 == (nx2+1))
- {
- Ptemp->x1 = nx1;
- goto next;
- }
- else if (Ptemp->x2 == (nx1-1))
- {
- Ptemp->x2 = nx2;
- goto next;
- }
- }
-
- insert_area_after(Pdst_list, Pdst_list->Phead,
- nx1, ny1, nx2, ny2);
- }
- }
-
- next:
-
- Parea2 = Parea2->Pnext;
- }
-
- Parea1 = Parea1->Pnext;
- }
- }
- #endif
-
- Area_List_Ptr Area_List_create_optimal(Area_List_Ptr Plist)
- {
- Area_Ptr Parea = Plist->Phead->Pnext, Parea_after;
- int num = 2;
- Area_List_Ptr Pnew_list;
-
- while (Parea != Plist->Ptail)
- {
- num++;
- Parea = Parea->Pnext;
- }
-
- Pnew_list = Area_List_init(num);
-
- Parea = Plist->Phead->Pnext;
-
- Parea_after = Pnew_list->Phead;
-
- while (Parea != Plist->Ptail)
- {
- Parea_after = insert_area_after(Pnew_list, Parea_after,
- Parea->x1, Parea->y1,
- Parea->x2, Parea->y2);
-
- Parea = Parea->Pnext;
- }
-
- return (Pnew_list);
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_arealist.h b/Libraries/crunch-ea9b8d/crnlib/crn_arealist.h
deleted file mode 100644
index 3b9aea92..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_arealist.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// File: crn_arealist.h - 2D shape algebra
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- struct Area
- {
- struct Area *Pprev, *Pnext;
-
- int x1, y1, x2, y2;
-
- uint get_width() const { return x2 - x1 + 1; }
- uint get_height() const { return y2 - y1 + 1; }
- uint get_area() const { return get_width() * get_height(); }
- };
-
- typedef Area * Area_Ptr;
-
- struct Area_List
- {
- int total_areas;
- int next_free;
-
- Area *Phead, *Ptail, *Pfree;
- };
-
- typedef Area_List * Area_List_Ptr;
-
- Area_List * Area_List_init(int max_areas);
- void Area_List_deinit(Area_List* Pobj_base);
-
- void Area_List_print(Area_List *Plist);
-
- Area_List * Area_List_dup_new(Area_List *Plist,
- int x_ofs, int y_ofs);
-
- uint Area_List_get_num(Area_List* Plist);
-
- // src and dst area lists must have the same number of total areas.
- void Area_List_dup(Area_List *Psrc_list,
- Area_List *Pdst_list,
- int x_ofs, int y_ofs);
-
- void Area_List_copy(Area_List *Psrc_list,
- Area_List *Pdst_list,
- int x_ofs, int y_ofs);
-
- void Area_List_clear(Area_List *Plist);
-
- void Area_List_set(Area_List *Plist,
- int x1, int y1, int x2, int y2);
-
- // logical: x and (not y)
- void Area_List_remove(Area_List *Plist,
- int x1, int y1, int x2, int y2);
-
- // logical: x or y
- void Area_List_insert(Area_List *Plist,
- int x1, int y1, int x2, int y2,
- bool combine);
-
- // logical: x and y
- void Area_List_intersect_area(Area_List *Plist,
- int x1, int y1, int x2, int y2);
-
- // logical: x and y
- void Area_List_intersect_Area_List(Area_List *Pouter_list,
- Area_List *Pinner_list,
- Area_List *Pdst_list);
-
- Area_List_Ptr Area_List_create_optimal(Area_List_Ptr Plist);
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_assert.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_assert.cpp
deleted file mode 100644
index 5900a4e6..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_assert.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// File: crn_assert.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#if CRNLIB_USE_WIN32_API
-#include "crn_winhdr.h"
-#endif
-
-static bool g_fail_exceptions;
-static bool g_exit_on_failure = true;
-
-void crnlib_enable_fail_exceptions(bool enabled)
-{
- g_fail_exceptions = enabled;
-}
-
-void crnlib_assert(const char* pExp, const char* pFile, unsigned line)
-{
- char buf[512];
-
- sprintf_s(buf, sizeof(buf), "%s(%u): Assertion failed: \"%s\"\n", pFile, line, pExp);
-
- crnlib_output_debug_string(buf);
-
- fputs(buf, stderr);
-
- if (crnlib_is_debugger_present())
- crnlib_debug_break();
-}
-
-void crnlib_fail(const char* pExp, const char* pFile, unsigned line)
-{
- char buf[512];
-
- sprintf_s(buf, sizeof(buf), "%s(%u): Failure: \"%s\"\n", pFile, line, pExp);
-
- crnlib_output_debug_string(buf);
-
- fputs(buf, stderr);
-
- if (crnlib_is_debugger_present())
- crnlib_debug_break();
-
-#if CRNLIB_USE_WIN32_API
- if (g_fail_exceptions)
- RaiseException(CRNLIB_FAIL_EXCEPTION_CODE, 0, 0, NULL);
- else
-#endif
- if (g_exit_on_failure)
- exit(EXIT_FAILURE);
-}
-
-void trace(const char* pFmt, va_list args)
-{
- if (crnlib_is_debugger_present())
- {
- char buf[512];
- vsprintf_s(buf, sizeof(buf), pFmt, args);
-
- crnlib_output_debug_string(buf);
- }
-};
-
-void trace(const char* pFmt, ...)
-{
- va_list args;
- va_start(args, pFmt);
- trace(pFmt, args);
- va_end(args);
-};
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_assert.h b/Libraries/crunch-ea9b8d/crnlib/crn_assert.h
deleted file mode 100644
index 44513695..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_assert.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// File: crn_assert.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-const unsigned int CRNLIB_FAIL_EXCEPTION_CODE = 256U;
-void crnlib_enable_fail_exceptions(bool enabled);
-
-void crnlib_assert(const char* pExp, const char* pFile, unsigned line);
-void crnlib_fail(const char* pExp, const char* pFile, unsigned line);
-
-#ifdef NDEBUG
- #define CRNLIB_ASSERT(x) ((void)0)
- #undef CRNLIB_ASSERTS_ENABLED
-#else
- #define CRNLIB_ASSERT(_exp) (void)( (!!(_exp)) || (crnlib_assert(#_exp, __FILE__, __LINE__), 0) )
- #define CRNLIB_ASSERTS_ENABLED
-#endif
-
-#define CRNLIB_VERIFY(_exp) (void)( (!!(_exp)) || (crnlib_assert(#_exp, __FILE__, __LINE__), 0) )
-
-#define CRNLIB_FAIL(msg) do { crnlib_fail(#msg, __FILE__, __LINE__); } while(0)
-
-#define CRNLIB_ASSERT_OPEN_RANGE(x, l, h) CRNLIB_ASSERT((x >= l) && (x < h))
-#define CRNLIB_ASSERT_CLOSED_RANGE(x, l, h) CRNLIB_ASSERT((x >= l) && (x <= h))
-
-void trace(const char* pFmt, va_list args);
-void trace(const char* pFmt, ...);
-
-// Borrowed from boost libraries.
-template <bool x> struct crnlib_assume_failure;
-template <> struct crnlib_assume_failure<true> { enum { blah = 1 }; };
-template<int x> struct crnlib_assume_try { };
-
-#define CRNLIB_JOINER_FINAL(a, b) a##b
-#define CRNLIB_JOINER(a, b) CRNLIB_JOINER_FINAL(a, b)
-#define CRNLIB_JOIN(a, b) CRNLIB_JOINER(a, b)
-#define CRNLIB_ASSUME(p) typedef crnlib_assume_try < sizeof(crnlib_assume_failure< (bool)(p) > ) > CRNLIB_JOIN(crnlib_assume_typedef, __COUNTER__)
-
-#ifdef NDEBUG
-template<typename T> inline T crnlib_assert_range(T i, T m)
-{
- m;
- return i;
-}
-template<typename T> inline T crnlib_assert_range_incl(T i, T m)
-{
- m;
- return i;
-}
-#else
-template<typename T> inline T crnlib_assert_range(T i, T m)
-{
- CRNLIB_ASSERT((i >= 0) && (i < m));
- return i;
-}
-template<typename T> inline T crnlib_assert_range_incl(T i, T m)
-{
- CRNLIB_ASSERT((i >= 0) && (i <= m));
- return i;
-}
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_atomics.h b/Libraries/crunch-ea9b8d/crnlib/crn_atomics.h
deleted file mode 100644
index 6eeedb5c..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_atomics.h
+++ /dev/null
@@ -1,208 +0,0 @@
-// File: crn_atomics.h
-#ifndef CRN_ATOMICS_H
-#define CRN_ATOMICS_H
-
-#ifdef WIN32
-#pragma once
-#endif
-
-#ifdef WIN32
-#include "crn_winhdr.h"
-#endif
-
-#if defined(__GNUC__) && CRNLIB_PLATFORM_PC
-extern __inline__ __attribute__((__always_inline__,__gnu_inline__)) void crnlib_yield_processor()
-{
- __asm__ __volatile__("pause");
-}
-#else
-CRNLIB_FORCE_INLINE void crnlib_yield_processor()
-{
-#if CRNLIB_USE_MSVC_INTRINSICS
- #if CRNLIB_PLATFORM_PC_X64
- _mm_pause();
- #else
- YieldProcessor();
- #endif
-#else
- // No implementation
-#endif
-}
-#endif
-
-#if CRNLIB_USE_WIN32_ATOMIC_FUNCTIONS
- extern "C" __int64 _InterlockedCompareExchange64(__int64 volatile * Destination, __int64 Exchange, __int64 Comperand);
- #if defined(_MSC_VER)
- #pragma intrinsic(_InterlockedCompareExchange64)
- #endif
-#endif // CRNLIB_USE_WIN32_ATOMIC_FUNCTIONS
-
-namespace crnlib
-{
-#if CRNLIB_USE_WIN32_ATOMIC_FUNCTIONS
- typedef LONG atomic32_t;
- typedef LONGLONG atomic64_t;
-
- // Returns the original value.
- inline atomic32_t atomic_compare_exchange32(atomic32_t volatile *pDest, atomic32_t exchange, atomic32_t comparand)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return InterlockedCompareExchange(pDest, exchange, comparand);
- }
-
- // Returns the original value.
- inline atomic64_t atomic_compare_exchange64(atomic64_t volatile *pDest, atomic64_t exchange, atomic64_t comparand)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 7) == 0);
- return _InterlockedCompareExchange64(pDest, exchange, comparand);
- }
-
- // Returns the resulting incremented value.
- inline atomic32_t atomic_increment32(atomic32_t volatile *pDest)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return InterlockedIncrement(pDest);
- }
-
- // Returns the resulting decremented value.
- inline atomic32_t atomic_decrement32(atomic32_t volatile *pDest)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return InterlockedDecrement(pDest);
- }
-
- // Returns the original value.
- inline atomic32_t atomic_exchange32(atomic32_t volatile *pDest, atomic32_t val)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return InterlockedExchange(pDest, val);
- }
-
- // Returns the resulting value.
- inline atomic32_t atomic_add32(atomic32_t volatile *pDest, atomic32_t val)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return InterlockedExchangeAdd(pDest, val) + val;
- }
-
- // Returns the original value.
- inline atomic32_t atomic_exchange_add32(atomic32_t volatile *pDest, atomic32_t val)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return InterlockedExchangeAdd(pDest, val);
- }
-#elif CRNLIB_USE_GCC_ATOMIC_BUILTINS
- typedef long atomic32_t;
- typedef long long atomic64_t;
-
- // Returns the original value.
- inline atomic32_t atomic_compare_exchange32(atomic32_t volatile *pDest, atomic32_t exchange, atomic32_t comparand)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return __sync_val_compare_and_swap(pDest, comparand, exchange);
- }
-
- // Returns the original value.
- inline atomic64_t atomic_compare_exchange64(atomic64_t volatile *pDest, atomic64_t exchange, atomic64_t comparand)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 7) == 0);
- return __sync_val_compare_and_swap(pDest, comparand, exchange);
- }
-
- // Returns the resulting incremented value.
- inline atomic32_t atomic_increment32(atomic32_t volatile *pDest)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return __sync_add_and_fetch(pDest, 1);
- }
-
- // Returns the resulting decremented value.
- inline atomic32_t atomic_decrement32(atomic32_t volatile *pDest)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return __sync_sub_and_fetch(pDest, 1);
- }
-
- // Returns the original value.
- inline atomic32_t atomic_exchange32(atomic32_t volatile *pDest, atomic32_t val)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return __sync_lock_test_and_set(pDest, val);
- }
-
- // Returns the resulting value.
- inline atomic32_t atomic_add32(atomic32_t volatile *pDest, atomic32_t val)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return __sync_add_and_fetch(pDest, val);
- }
-
- // Returns the original value.
- inline atomic32_t atomic_exchange_add32(atomic32_t volatile *pDest, atomic32_t val)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return __sync_fetch_and_add(pDest, val);
- }
-#else
- #define CRNLIB_NO_ATOMICS 1
-
- // Atomic ops not supported - but try to do something reasonable. Assumes no threading at all.
- typedef long atomic32_t;
- typedef long long atomic64_t;
-
- inline atomic32_t atomic_compare_exchange32(atomic32_t volatile *pDest, atomic32_t exchange, atomic32_t comparand)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- atomic32_t cur = *pDest;
- if (cur == comparand)
- *pDest = exchange;
- return cur;
- }
-
- inline atomic64_t atomic_compare_exchange64(atomic64_t volatile *pDest, atomic64_t exchange, atomic64_t comparand)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 7) == 0);
- atomic64_t cur = *pDest;
- if (cur == comparand)
- *pDest = exchange;
- return cur;
- }
-
- inline atomic32_t atomic_increment32(atomic32_t volatile *pDest)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return (*pDest += 1);
- }
-
- inline atomic32_t atomic_decrement32(atomic32_t volatile *pDest)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return (*pDest -= 1);
- }
-
- inline atomic32_t atomic_exchange32(atomic32_t volatile *pDest, atomic32_t val)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- atomic32_t cur = *pDest;
- *pDest = val;
- return cur;
- }
-
- inline atomic32_t atomic_add32(atomic32_t volatile *pDest, atomic32_t val)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- return (*pDest += val);
- }
-
- inline atomic32_t atomic_exchange_add32(atomic32_t volatile *pDest, atomic32_t val)
- {
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(pDest) & 3) == 0);
- atomic32_t cur = *pDest;
- *pDest += val;
- return cur;
- }
-#endif
-
-} // namespace crnlib
-
-#endif // CRN_ATOMICS_H
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_buffer_stream.h b/Libraries/crunch-ea9b8d/crnlib/crn_buffer_stream.h
deleted file mode 100644
index 26e2532a..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_buffer_stream.h
+++ /dev/null
@@ -1,196 +0,0 @@
-// File: crn_buffer_stream.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_data_stream.h"
-
-namespace crnlib
-{
- class buffer_stream : public data_stream
- {
- public:
- buffer_stream() :
- data_stream(),
- m_pBuf(NULL),
- m_size(0),
- m_ofs(0)
- {
- }
-
- buffer_stream(void* p, uint size) :
- data_stream(),
- m_pBuf(NULL),
- m_size(0),
- m_ofs(0)
- {
- open(p, size);
- }
-
- buffer_stream(const void* p, uint size) :
- data_stream(),
- m_pBuf(NULL),
- m_size(0),
- m_ofs(0)
- {
- open(p, size);
- }
-
- virtual ~buffer_stream()
- {
- }
-
- bool open(const void* p, uint size)
- {
- CRNLIB_ASSERT(p);
-
- close();
-
- if ((!p) || (!size))
- return false;
-
- m_opened = true;
- m_pBuf = (uint8*)(p);
- m_size = size;
- m_ofs = 0;
- m_attribs = cDataStreamSeekable | cDataStreamReadable;
- return true;
- }
-
- bool open(void* p, uint size)
- {
- CRNLIB_ASSERT(p);
-
- close();
-
- if ((!p) || (!size))
- return false;
-
- m_opened = true;
- m_pBuf = static_cast<uint8*>(p);
- m_size = size;
- m_ofs = 0;
- m_attribs = cDataStreamSeekable | cDataStreamWritable | cDataStreamReadable;
- return true;
- }
-
- virtual bool close()
- {
- if (m_opened)
- {
- m_opened = false;
- m_pBuf = NULL;
- m_size = 0;
- m_ofs = 0;
- return true;
- }
-
- return false;
- }
-
- const void* get_buf() const { return m_pBuf; }
- void* get_buf() { return m_pBuf; }
-
- virtual const void* get_ptr() const { return m_pBuf; }
-
- virtual uint read(void* pBuf, uint len)
- {
- CRNLIB_ASSERT(pBuf && (len <= 0x7FFFFFFF));
-
- if ((!m_opened) || (!is_readable()) || (!len))
- return 0;
-
- CRNLIB_ASSERT(m_ofs <= m_size);
-
- uint bytes_left = m_size - m_ofs;
-
- len = math::minimum<uint>(len, bytes_left);
-
- if (len)
- memcpy(pBuf, &m_pBuf[m_ofs], len);
-
- m_ofs += len;
-
- return len;
- }
-
- virtual uint write(const void* pBuf, uint len)
- {
- CRNLIB_ASSERT(pBuf && (len <= 0x7FFFFFFF));
-
- if ((!m_opened) || (!is_writable()) || (!len))
- return 0;
-
- CRNLIB_ASSERT(m_ofs <= m_size);
-
- uint bytes_left = m_size - m_ofs;
-
- len = math::minimum<uint>(len, bytes_left);
-
- if (len)
- memcpy(&m_pBuf[m_ofs], pBuf, len);
-
- m_ofs += len;
-
- return len;
- }
-
- virtual bool flush()
- {
- if (!m_opened)
- return false;
-
- return true;
- }
-
- virtual uint64 get_size()
- {
- if (!m_opened)
- return 0;
-
- return m_size;
- }
-
- virtual uint64 get_remaining()
- {
- if (!m_opened)
- return 0;
-
- CRNLIB_ASSERT(m_ofs <= m_size);
-
- return m_size - m_ofs;
- }
-
- virtual uint64 get_ofs()
- {
- if (!m_opened)
- return 0;
-
- return m_ofs;
- }
-
- virtual bool seek(int64 ofs, bool relative)
- {
- if ((!m_opened) || (!is_seekable()))
- return false;
-
- int64 new_ofs = relative ? (m_ofs + ofs) : ofs;
-
- if (new_ofs < 0)
- return false;
- else if (new_ofs > m_size)
- return false;
-
- m_ofs = static_cast<uint>(new_ofs);
-
- post_seek();
-
- return true;
- }
-
- private:
- uint8* m_pBuf;
- uint m_size;
- uint m_ofs;
- };
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_cfile_stream.h b/Libraries/crunch-ea9b8d/crnlib/crn_cfile_stream.h
deleted file mode 100644
index cd62c943..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_cfile_stream.h
+++ /dev/null
@@ -1,241 +0,0 @@
-// File: crn_cfile_stream.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_data_stream.h"
-
-namespace crnlib
-{
- class cfile_stream : public data_stream
- {
- public:
- cfile_stream() : data_stream(), m_pFile(NULL), m_size(0), m_ofs(0), m_has_ownership(false)
- {
- }
-
- cfile_stream(FILE* pFile, const char* pFilename, uint attribs, bool has_ownership) :
- data_stream(), m_pFile(NULL), m_size(0), m_ofs(0), m_has_ownership(false)
- {
- open(pFile, pFilename, attribs, has_ownership);
- }
-
- cfile_stream(const char* pFilename, uint attribs = cDataStreamReadable | cDataStreamSeekable, bool open_existing = false) :
- data_stream(), m_pFile(NULL), m_size(0), m_ofs(0), m_has_ownership(false)
- {
- open(pFilename, attribs, open_existing);
- }
-
- virtual ~cfile_stream()
- {
- close();
- }
-
- virtual bool close()
- {
- clear_error();
-
- if (m_opened)
- {
- bool status = true;
- if (m_has_ownership)
- {
- if (EOF == fclose(m_pFile))
- status = false;
- }
-
- m_pFile = NULL;
- m_opened = false;
- m_size = 0;
- m_ofs = 0;
- m_has_ownership = false;
-
- return status;
- }
-
- return false;
- }
-
- bool open(FILE* pFile, const char* pFilename, uint attribs, bool has_ownership)
- {
- CRNLIB_ASSERT(pFile);
- CRNLIB_ASSERT(pFilename);
-
- close();
-
- set_name(pFilename);
- m_pFile = pFile;
- m_has_ownership = has_ownership;
- m_attribs = static_cast<uint16>(attribs);
-
- m_ofs = crn_ftell(m_pFile);
- crn_fseek(m_pFile, 0, SEEK_END);
- m_size = crn_ftell(m_pFile);
- crn_fseek(m_pFile, m_ofs, SEEK_SET);
-
- m_opened = true;
-
- return true;
- }
-
- bool open(const char* pFilename, uint attribs = cDataStreamReadable | cDataStreamSeekable, bool open_existing = false)
- {
- CRNLIB_ASSERT(pFilename);
-
- close();
-
- m_attribs = static_cast<uint16>(attribs);
-
- const char* pMode;
- if ((is_readable()) && (is_writable()))
- pMode = open_existing ? "r+b" : "w+b";
- else if (is_writable())
- pMode = open_existing ? "ab" : "wb";
- else if (is_readable())
- pMode = "rb";
- else
- {
- set_error();
- return false;
- }
-
- FILE* pFile = NULL;
- crn_fopen(&pFile, pFilename, pMode);
- m_has_ownership = true;
-
- if (!pFile)
- {
- set_error();
- return false;
- }
-
- // TODO: Change stream class to support UCS2 filenames.
-
- return open(pFile, pFilename, attribs, true);
- }
-
- FILE* get_file() const { return m_pFile; }
-
- virtual uint read(void* pBuf, uint len)
- {
- CRNLIB_ASSERT(pBuf && (len <= 0x7FFFFFFF));
-
- if (!m_opened || (!is_readable()) || (!len))
- return 0;
-
- len = static_cast<uint>(math::minimum<uint64>(len, get_remaining()));
-
- if (fread(pBuf, 1, len, m_pFile) != len)
- {
- set_error();
- return 0;
- }
-
- m_ofs += len;
- return len;
- }
-
- virtual uint write(const void* pBuf, uint len)
- {
- CRNLIB_ASSERT(pBuf && (len <= 0x7FFFFFFF));
-
- if (!m_opened || (!is_writable()) || (!len))
- return 0;
-
- if (fwrite(pBuf, 1, len, m_pFile) != len)
- {
- set_error();
- return 0;
- }
-
- m_ofs += len;
- m_size = math::maximum(m_size, m_ofs);
-
- return len;
- }
-
- virtual bool flush()
- {
- if ((!m_opened) || (!is_writable()))
- return false;
-
- if (EOF == fflush(m_pFile))
- {
- set_error();
- return false;
- }
-
- return true;
- }
-
- virtual uint64 get_size()
- {
- if (!m_opened)
- return 0;
-
- return m_size;
- }
-
- virtual uint64 get_remaining()
- {
- if (!m_opened)
- return 0;
-
- CRNLIB_ASSERT(m_ofs <= m_size);
- return m_size - m_ofs;
- }
-
- virtual uint64 get_ofs()
- {
- if (!m_opened)
- return 0;
-
- return m_ofs;
- }
-
- virtual bool seek(int64 ofs, bool relative)
- {
- if ((!m_opened) || (!is_seekable()))
- return false;
-
- int64 new_ofs = relative ? (m_ofs + ofs) : ofs;
- if (new_ofs < 0)
- return false;
- else if (static_cast<uint64>(new_ofs) > m_size)
- return false;
-
- if (static_cast<uint64>(new_ofs) != m_ofs)
- {
- if (crn_fseek(m_pFile, new_ofs, SEEK_SET) != 0)
- {
- set_error();
- return false;
- }
-
- m_ofs = new_ofs;
- }
-
- return true;
- }
-
- static bool read_file_into_array(const char* pFilename, vector<uint8>& buf)
- {
- cfile_stream in_stream(pFilename);
- if (!in_stream.is_opened())
- return false;
- return in_stream.read_array(buf);
- }
-
- static bool write_array_to_file(const char* pFilename, const vector<uint8>& buf)
- {
- cfile_stream out_stream(pFilename, cDataStreamWritable|cDataStreamSeekable);
- if (!out_stream.is_opened())
- return false;
- return out_stream.write_array(buf);
- }
-
- private:
- FILE* m_pFile;
- uint64 m_size, m_ofs;
- bool m_has_ownership;
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_checksum.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_checksum.cpp
deleted file mode 100644
index 5dcb6f41..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_checksum.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-// File: crn_checksum.cpp
-#include "crn_core.h"
-
-namespace crnlib
-{
- // From the public domain stb.h header.
- uint adler32(const void* pBuf, size_t buflen, uint adler32)
- {
- const uint8* buffer = static_cast<const uint8*>(pBuf);
-
- const unsigned long ADLER_MOD = 65521;
- unsigned long s1 = adler32 & 0xffff, s2 = adler32 >> 16;
- size_t blocklen;
- unsigned long i;
-
- blocklen = buflen % 5552;
- while (buflen) {
- for (i=0; i + 7 < blocklen; i += 8) {
- s1 += buffer[0], s2 += s1;
- s1 += buffer[1], s2 += s1;
- s1 += buffer[2], s2 += s1;
- s1 += buffer[3], s2 += s1;
- s1 += buffer[4], s2 += s1;
- s1 += buffer[5], s2 += s1;
- s1 += buffer[6], s2 += s1;
- s1 += buffer[7], s2 += s1;
-
- buffer += 8;
- }
-
- for (; i < blocklen; ++i)
- s1 += *buffer++, s2 += s1;
-
- s1 %= ADLER_MOD, s2 %= ADLER_MOD;
- buflen -= blocklen;
- blocklen = 5552;
- }
- return (s2 << 16) + s1;
- }
-
- uint16 crc16(const void* pBuf, size_t len, uint16 crc)
- {
- crc = ~crc;
-
- const uint8* p = reinterpret_cast<const uint8*>(pBuf);
- while (len)
- {
- const uint16 q = *p++ ^ (crc >> 8);
- crc <<= 8U;
- uint16 r = (q >> 4) ^ q;
- crc ^= r;
- r <<= 5U;
- crc ^= r;
- r <<= 7U;
- crc ^= r;
- len--;
- }
-
- return static_cast<uint16>(~crc);
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_checksum.h b/Libraries/crunch-ea9b8d/crnlib/crn_checksum.h
deleted file mode 100644
index 12817a81..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_checksum.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// File: crn_checksum.h
-#pragma once
-
-namespace crnlib
-{
- const uint cInitAdler32 = 1U;
- uint adler32(const void* pBuf, size_t buflen, uint adler32 = cInitAdler32);
-
- // crc16() intended for small buffers - doesn't use an acceleration table.
- const uint cInitCRC16 = 0;
- uint16 crc16(const void* pBuf, size_t len, uint16 crc = cInitCRC16);
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_clusterizer.h b/Libraries/crunch-ea9b8d/crnlib/crn_clusterizer.h
deleted file mode 100644
index 2333e45c..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_clusterizer.h
+++ /dev/null
@@ -1,764 +0,0 @@
-// File: crn_clusterizer.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_matrix.h"
-
-namespace crnlib
-{
- template<typename VectorType>
- class clusterizer
- {
- public:
- clusterizer() :
- m_overall_variance(0.0f),
- m_split_index(0),
- m_heap_size(0),
- m_quick(false)
- {
- }
-
- void clear()
- {
- m_training_vecs.clear();
- m_codebook.clear();
- m_nodes.clear();
- m_overall_variance = 0.0f;
- m_split_index = 0;
- m_heap_size = 0;
- m_quick = false;
- }
-
- void reserve_training_vecs(uint num_expected)
- {
- m_training_vecs.reserve(num_expected);
- }
-
- void add_training_vec(const VectorType& v, uint weight)
- {
- m_training_vecs.push_back( std::make_pair(v, weight) );
- }
-
- typedef bool (*progress_callback_func_ptr)(uint percentage_completed, void* pData);
-
- bool generate_codebook(uint max_size, progress_callback_func_ptr pProgress_callback = NULL, void* pProgress_data = NULL, bool quick = false)
- {
- if (m_training_vecs.empty())
- return false;
-
- m_quick = quick;
-
- double ttsum = 0.0f;
-
- vq_node root;
- root.m_vectors.reserve(m_training_vecs.size());
-
- for (uint i = 0; i < m_training_vecs.size(); i++)
- {
- const VectorType& v = m_training_vecs[i].first;
- const uint weight = m_training_vecs[i].second;
-
- root.m_centroid += (v * (float)weight);
- root.m_total_weight += weight;
- root.m_vectors.push_back(i);
-
- ttsum += v.dot(v) * weight;
- }
-
- root.m_variance = (float)(ttsum - (root.m_centroid.dot(root.m_centroid) / root.m_total_weight));
-
- root.m_centroid *= (1.0f / root.m_total_weight);
-
- m_nodes.clear();
- m_nodes.reserve(max_size * 2 + 1);
-
- m_nodes.push_back(root);
-
- m_heap.resize(max_size + 1);
- m_heap[1] = 0;
- m_heap_size = 1;
-
- m_split_index = 0;
-
- uint total_leaves = 1;
-
- m_left_children.reserve(m_training_vecs.size() + 1);
- m_right_children.reserve(m_training_vecs.size() + 1);
-
- int prev_percentage = -1;
- while ((total_leaves < max_size) && (m_heap_size))
- {
- int worst_node_index = m_heap[1];
-
- m_heap[1] = m_heap[m_heap_size];
- m_heap_size--;
- if (m_heap_size)
- down_heap(1);
-
- split_node(worst_node_index);
- total_leaves++;
-
- if ((pProgress_callback) && ((total_leaves & 63) == 0) && (max_size))
- {
- int cur_percentage = (total_leaves * 100U + (max_size / 2U)) / max_size;
- if (cur_percentage != prev_percentage)
- {
- if (!(*pProgress_callback)(cur_percentage, pProgress_data))
- return false;
-
- prev_percentage = cur_percentage;
- }
- }
- }
-
- m_codebook.clear();
-
- m_overall_variance = 0.0f;
-
- for (uint i = 0; i < m_nodes.size(); i++)
- {
- vq_node& node = m_nodes[i];
- if (node.m_left != -1)
- {
- CRNLIB_ASSERT(node.m_right != -1);
- continue;
- }
-
- CRNLIB_ASSERT((node.m_left == -1) && (node.m_right == -1));
-
- node.m_codebook_index = m_codebook.size();
- m_codebook.push_back(node.m_centroid);
-
- m_overall_variance += node.m_variance;
- }
-
- m_heap.clear();
- m_left_children.clear();
- m_right_children.clear();
-
- return true;
- }
-
- inline uint get_num_training_vecs() const { return m_training_vecs.size(); }
- const VectorType& get_training_vec(uint index) const { return m_training_vecs[index].first; }
- uint get_training_vec_weight(uint index) const { return m_training_vecs[index].second; }
-
- typedef crnlib::vector< std::pair<VectorType, uint> > training_vec_array;
-
- const training_vec_array& get_training_vecs() const { return m_training_vecs; }
- training_vec_array& get_training_vecs() { return m_training_vecs; }
-
- inline float get_overall_variance() const { return m_overall_variance; }
-
- inline uint get_codebook_size() const
- {
- return m_codebook.size();
- }
-
- inline const VectorType& get_codebook_entry(uint index) const
- {
- return m_codebook[index];
- }
-
- VectorType& get_codebook_entry(uint index)
- {
- return m_codebook[index];
- }
-
- typedef crnlib::vector<VectorType> vector_vec_type;
- inline const vector_vec_type& get_codebook() const
- {
- return m_codebook;
- }
-
- uint find_best_codebook_entry(const VectorType& v) const
- {
- uint cur_node_index = 0;
-
- for ( ; ; )
- {
- const vq_node& cur_node = m_nodes[cur_node_index];
-
- if (cur_node.m_left == -1)
- return cur_node.m_codebook_index;
-
- const vq_node& left_node = m_nodes[cur_node.m_left];
- const vq_node& right_node = m_nodes[cur_node.m_right];
-
- float left_dist = left_node.m_centroid.squared_distance(v);
- float right_dist = right_node.m_centroid.squared_distance(v);
-
- if (left_dist < right_dist)
- cur_node_index = cur_node.m_left;
- else
- cur_node_index = cur_node.m_right;
- }
- }
-
- const VectorType& find_best_codebook_entry(const VectorType& v, uint max_codebook_size) const
- {
- uint cur_node_index = 0;
-
- for ( ; ; )
- {
- const vq_node& cur_node = m_nodes[cur_node_index];
-
- if ((cur_node.m_left == -1) || ((cur_node.m_codebook_index + 1) >= (int)max_codebook_size))
- return cur_node.m_centroid;
-
- const vq_node& left_node = m_nodes[cur_node.m_left];
- const vq_node& right_node = m_nodes[cur_node.m_right];
-
- float left_dist = left_node.m_centroid.squared_distance(v);
- float right_dist = right_node.m_centroid.squared_distance(v);
-
- if (left_dist < right_dist)
- cur_node_index = cur_node.m_left;
- else
- cur_node_index = cur_node.m_right;
- }
- }
-
- uint find_best_codebook_entry_fs(const VectorType& v) const
- {
- float best_dist = math::cNearlyInfinite;
- uint best_index = 0;
-
- for (uint i = 0; i < m_codebook.size(); i++)
- {
- float dist = m_codebook[i].squared_distance(v);
- if (dist < best_dist)
- {
- best_dist = dist;
- best_index = i;
- if (best_dist == 0.0f)
- break;
- }
- }
-
- return best_index;
- }
-
- void retrieve_clusters(uint max_clusters, crnlib::vector< crnlib::vector<uint> >& clusters) const
- {
- clusters.resize(0);
- clusters.reserve(max_clusters);
-
- crnlib::vector<uint> stack;
- stack.reserve(512);
-
- uint cur_node_index = 0;
-
- for ( ; ; )
- {
- const vq_node& cur_node = m_nodes[cur_node_index];
-
- if ( (cur_node.is_leaf()) || ((cur_node.m_codebook_index + 2) > (int)max_clusters) )
- {
- clusters.resize(clusters.size() + 1);
- clusters.back() = cur_node.m_vectors;
-
- if (stack.empty())
- break;
- cur_node_index = stack.back();
- stack.pop_back();
- continue;
- }
-
- cur_node_index = cur_node.m_left;
- stack.push_back(cur_node.m_right);
- }
- }
-
- private:
- training_vec_array m_training_vecs;
-
- struct vq_node
- {
- vq_node() : m_centroid(cClear), m_total_weight(0), m_left(-1), m_right(-1), m_codebook_index(-1), m_unsplittable(false) { }
-
- VectorType m_centroid;
- uint64 m_total_weight;
-
- float m_variance;
-
- crnlib::vector<uint> m_vectors;
-
- int m_left;
- int m_right;
-
- int m_codebook_index;
-
- bool m_unsplittable;
-
- bool is_leaf() const { return m_left < 0; }
- };
-
- typedef crnlib::vector<vq_node> node_vec_type;
-
- node_vec_type m_nodes;
-
- vector_vec_type m_codebook;
-
- float m_overall_variance;
-
- uint m_split_index;
-
- crnlib::vector<uint> m_heap;
- uint m_heap_size;
-
- bool m_quick;
-
- void insert_heap(uint node_index)
- {
- const float variance = m_nodes[node_index].m_variance;
- uint pos = ++m_heap_size;
-
- if (m_heap_size >= m_heap.size())
- m_heap.resize(m_heap_size + 1);
-
- for ( ; ; )
- {
- uint parent = pos >> 1;
- if (!parent)
- break;
-
- float parent_variance = m_nodes[m_heap[parent]].m_variance;
- if (parent_variance > variance)
- break;
-
- m_heap[pos] = m_heap[parent];
-
- pos = parent;
- }
-
- m_heap[pos] = node_index;
- }
-
- void down_heap(uint pos)
- {
- uint child;
- uint orig = m_heap[pos];
-
- const float orig_variance = m_nodes[orig].m_variance;
-
- while ((child = (pos << 1)) <= m_heap_size)
- {
- if (child < m_heap_size)
- {
- if (m_nodes[m_heap[child]].m_variance < m_nodes[m_heap[child + 1]].m_variance)
- child++;
- }
-
- if (orig_variance > m_nodes[m_heap[child]].m_variance)
- break;
-
- m_heap[pos] = m_heap[child];
-
- pos = child;
- }
-
- m_heap[pos] = orig;
- }
-
- void compute_split_estimate(VectorType& left_child_res, VectorType& right_child_res, const vq_node& parent_node)
- {
- VectorType furthest(0);
- double furthest_dist = -1.0f;
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const VectorType& v = m_training_vecs[parent_node.m_vectors[i]].first;
-
- double dist = v.squared_distance(parent_node.m_centroid);
- if (dist > furthest_dist)
- {
- furthest_dist = dist;
- furthest = v;
- }
- }
-
- VectorType opposite(0);
- double opposite_dist = -1.0f;
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const VectorType& v = m_training_vecs[parent_node.m_vectors[i]].first;
-
- double dist = v.squared_distance(furthest);
- if (dist > opposite_dist)
- {
- opposite_dist = dist;
- opposite = v;
- }
- }
-
- left_child_res = (furthest + parent_node.m_centroid) * .5f;
- right_child_res = (opposite + parent_node.m_centroid) * .5f;
- }
-
- void compute_split_pca(VectorType& left_child_res, VectorType& right_child_res, const vq_node& parent_node)
- {
- if (parent_node.m_vectors.size() == 2)
- {
- left_child_res = m_training_vecs[parent_node.m_vectors[0]].first;
- right_child_res = m_training_vecs[parent_node.m_vectors[1]].first;
- return;
- }
-
- const uint N = VectorType::num_elements;
-
- matrix<N, N, float> covar;
- covar.clear();
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const VectorType v(m_training_vecs[parent_node.m_vectors[i]].first - parent_node.m_centroid);
- const VectorType w(v * (float)m_training_vecs[parent_node.m_vectors[i]].second);
-
- for (uint x = 0; x < N; x++)
- for (uint y = x; y < N; y++)
- covar[x][y] = covar[x][y] + v[x] * w[y];
- }
-
- float one_over_total_weight = 1.0f / parent_node.m_total_weight;
-
- for (uint x = 0; x < N; x++)
- for (uint y = x; y < N; y++)
- covar[x][y] *= one_over_total_weight;
-
- for (uint x = 0; x < (N - 1); x++)
- for (uint y = x + 1; y < N; y++)
- covar[y][x] = covar[x][y];
-
- VectorType axis;//(1.0f);
- if (N == 1)
- axis.set(1.0f);
- else
- {
- for (uint i = 0; i < N; i++)
- axis[i] = math::lerp(.75f, 1.25f, i * (1.0f / math::maximum<int>(N - 1, 1)));
- }
-
- VectorType prev_axis(axis);
-
- for (uint iter = 0; iter < 10; iter++)
- {
- VectorType x;
-
- double max_sum = 0;
-
- for (uint i = 0; i < N; i++)
- {
- double sum = 0;
-
- for (uint j = 0; j < N; j++)
- sum += axis[j] * covar[i][j];
-
- x[i] = static_cast<float>(sum);
-
- max_sum = math::maximum(max_sum, fabs(sum));
- }
-
- if (max_sum != 0.0f)
- x *= static_cast<float>(1.0f / max_sum);
-
- VectorType delta_axis(prev_axis - x);
-
- prev_axis = axis;
- axis = x;
-
- if (delta_axis.norm() < .0025f)
- break;
- }
-
- axis.normalize();
-
- VectorType left_child(0.0f);
- VectorType right_child(0.0f);
-
- double left_weight = 0.0f;
- double right_weight = 0.0f;
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const float weight = (float)m_training_vecs[parent_node.m_vectors[i]].second;
-
- const VectorType& v = m_training_vecs[parent_node.m_vectors[i]].first;
-
- double t = (v - parent_node.m_centroid) * axis;
- if (t < 0.0f)
- {
- left_child += v * weight;
- left_weight += weight;
- }
- else
- {
- right_child += v * weight;
- right_weight += weight;
- }
- }
-
- if ((left_weight > 0.0f) && (right_weight > 0.0f))
- {
- left_child_res = left_child * (float)(1.0f / left_weight);
- right_child_res = right_child * (float)(1.0f / right_weight);
- }
- else
- {
- compute_split_estimate(left_child_res, right_child_res, parent_node);
- }
- }
-
-#if 0
- void compute_split_pca2(VectorType& left_child_res, VectorType& right_child_res, const vq_node& parent_node)
- {
- if (parent_node.m_vectors.size() == 2)
- {
- left_child_res = m_training_vecs[parent_node.m_vectors[0]].first;
- right_child_res = m_training_vecs[parent_node.m_vectors[1]].first;
- return;
- }
-
- const uint N = VectorType::num_elements;
-
- VectorType furthest;
- double furthest_dist = -1.0f;
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const VectorType& v = m_training_vecs[parent_node.m_vectors[i]].first;
-
- double dist = v.squared_distance(parent_node.m_centroid);
- if (dist > furthest_dist)
- {
- furthest_dist = dist;
- furthest = v;
- }
- }
-
- VectorType opposite;
- double opposite_dist = -1.0f;
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const VectorType& v = m_training_vecs[parent_node.m_vectors[i]].first;
-
- double dist = v.squared_distance(furthest);
- if (dist > opposite_dist)
- {
- opposite_dist = dist;
- opposite = v;
- }
- }
-
- VectorType axis(opposite - furthest);
- if (axis.normalize() < .000125f)
- {
- left_child_res = (furthest + parent_node.m_centroid) * .5f;
- right_child_res = (opposite + parent_node.m_centroid) * .5f;
- return;
- }
-
- for (uint iter = 0; iter < 2; iter++)
- {
- double next_axis[N];
- utils::zero_object(next_axis);
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const double weight = m_training_vecs[parent_node.m_vectors[i]].second;
-
- VectorType v(m_training_vecs[parent_node.m_vectors[i]].first - parent_node.m_centroid);
-
- double dot = (v * axis) * weight;
-
- for (uint j = 0; j < N; j++)
- next_axis[j] += dot * v[j];
- }
-
- double w = 0.0f;
- for (uint j = 0; j < N; j++)
- w += next_axis[j] * next_axis[j];
-
- if (w > 0.0f)
- {
- w = 1.0f / sqrt(w);
- for (uint j = 0; j < N; j++)
- axis[j] = static_cast<float>(next_axis[j] * w);
- }
- else
- break;
- }
-
- VectorType left_child(0.0f);
- VectorType right_child(0.0f);
-
- double left_weight = 0.0f;
- double right_weight = 0.0f;
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const float weight = (float)m_training_vecs[parent_node.m_vectors[i]].second;
-
- const VectorType& v = m_training_vecs[parent_node.m_vectors[i]].first;
-
- double t = (v - parent_node.m_centroid) * axis;
- if (t < 0.0f)
- {
- left_child += v * weight;
- left_weight += weight;
- }
- else
- {
- right_child += v * weight;
- right_weight += weight;
- }
- }
-
- if ((left_weight > 0.0f) && (right_weight > 0.0f))
- {
- left_child_res = left_child * (float)(1.0f / left_weight);
- right_child_res = right_child * (float)(1.0f / right_weight);
- }
- else
- {
- left_child_res = (furthest + parent_node.m_centroid) * .5f;
- right_child_res = (opposite + parent_node.m_centroid) * .5f;
- }
- }
-#endif
-
- // thread safety warning: shared state!
- crnlib::vector<uint> m_left_children;
- crnlib::vector<uint> m_right_children;
-
- void split_node(uint index)
- {
- vq_node& parent_node = m_nodes[index];
-
- if (parent_node.m_vectors.size() == 1)
- return;
-
- VectorType left_child, right_child;
- if (m_quick)
- compute_split_estimate(left_child, right_child, parent_node);
- else
- compute_split_pca(left_child, right_child, parent_node);
-
- uint64 left_weight = 0;
- uint64 right_weight = 0;
-
- float prev_total_variance = 1e+10f;
-
- float left_variance = 0.0f;
- float right_variance = 0.0f;
-
- const uint cMaxLoops = m_quick ? 2 : 8;
- for (uint total_loops = 0; total_loops < cMaxLoops; total_loops++)
- {
- m_left_children.resize(0);
- m_right_children.resize(0);
-
- VectorType new_left_child(cClear);
- VectorType new_right_child(cClear);
-
- double left_ttsum = 0.0f;
- double right_ttsum = 0.0f;
-
- left_weight = 0;
- right_weight = 0;
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const VectorType& v = m_training_vecs[parent_node.m_vectors[i]].first;
- const uint weight = m_training_vecs[parent_node.m_vectors[i]].second;
-
- double left_dist2 = left_child.squared_distance(v);
- double right_dist2 = right_child.squared_distance(v);
-
- if (left_dist2 < right_dist2)
- {
- m_left_children.push_back(parent_node.m_vectors[i]);
-
- new_left_child += (v * (float)weight);
- left_weight += weight;
-
- left_ttsum += v.dot(v) * weight;
- }
- else
- {
- m_right_children.push_back(parent_node.m_vectors[i]);
-
- new_right_child += (v * (float)weight);
- right_weight += weight;
-
- right_ttsum += v.dot(v) * weight;
- }
- }
-
- if ((!left_weight) || (!right_weight))
- {
- parent_node.m_unsplittable = true;
- return;
- }
-
- left_variance = (float)(left_ttsum - (new_left_child.dot(new_left_child) / left_weight));
- right_variance = (float)(right_ttsum - (new_right_child.dot(new_right_child) / right_weight));
-
- new_left_child *= (1.0f / left_weight);
- new_right_child *= (1.0f / right_weight);
-
- left_child = new_left_child;
- left_weight = left_weight;
-
- right_child = new_right_child;
- right_weight = right_weight;
-
- float total_variance = left_variance + right_variance;
- if (total_variance < .00001f)
- break;
-
- //const float variance_delta_thresh = .00001f;
- const float variance_delta_thresh = .00125f;
- if (((prev_total_variance - total_variance) / total_variance) < variance_delta_thresh)
- break;
-
- prev_total_variance = total_variance;
- }
-
- const uint left_child_index = m_nodes.size();
- const uint right_child_index = m_nodes.size() + 1;
-
- parent_node.m_left = m_nodes.size();
- parent_node.m_right = m_nodes.size() + 1;
- parent_node.m_codebook_index = m_split_index;
- m_split_index++;
-
- m_nodes.resize(m_nodes.size() + 2);
-
- // parent_node is invalid now, because m_nodes has been changed
-
- vq_node& left_child_node = m_nodes[left_child_index];
- vq_node& right_child_node = m_nodes[right_child_index];
-
- left_child_node.m_centroid = left_child;
- left_child_node.m_total_weight = left_weight;
- left_child_node.m_vectors.swap(m_left_children);
- left_child_node.m_variance = left_variance;
- if ((left_child_node.m_vectors.size() > 1) && (left_child_node.m_variance > 0.0f))
- insert_heap(left_child_index);
-
- right_child_node.m_centroid = right_child;
- right_child_node.m_total_weight = right_weight;
- right_child_node.m_vectors.swap(m_right_children);
- right_child_node.m_variance = right_variance;
- if ((right_child_node.m_vectors.size() > 1) && (right_child_node.m_variance > 0.0f))
- insert_heap(right_child_index);
- }
-
- };
-
-} // namespace crnlib
-
-
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_color.h b/Libraries/crunch-ea9b8d/crnlib/crn_color.h
deleted file mode 100644
index 127ca042..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_color.h
+++ /dev/null
@@ -1,994 +0,0 @@
-// File: crn_color.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_core.h"
-
-namespace crnlib
-{
- template<typename component_type> struct color_quad_component_traits
- {
- enum
- {
- cSigned = false,
- cFloat = false,
- cMin = cUINT8_MIN,
- cMax = cUINT8_MAX
- };
- };
-
- template<> struct color_quad_component_traits<int8>
- {
- enum
- {
- cSigned = true,
- cFloat = false,
- cMin = cINT8_MIN,
- cMax = cINT8_MAX
- };
- };
-
- template<> struct color_quad_component_traits<int16>
- {
- enum
- {
- cSigned = true,
- cFloat = false,
- cMin = cINT16_MIN,
- cMax = cINT16_MAX
- };
- };
-
- template<> struct color_quad_component_traits<uint16>
- {
- enum
- {
- cSigned = false,
- cFloat = false,
- cMin = cUINT16_MIN,
- cMax = cUINT16_MAX
- };
- };
-
- template<> struct color_quad_component_traits<int32>
- {
- enum
- {
- cSigned = true,
- cFloat = false,
- cMin = cINT32_MIN,
- cMax = cINT32_MAX
- };
- };
-
- template<> struct color_quad_component_traits<uint32>
- {
- enum
- {
- cSigned = false,
- cFloat = false,
- cMin = cUINT32_MIN,
- cMax = cUINT32_MAX
- };
- };
-
- template<> struct color_quad_component_traits<float>
- {
- enum
- {
- cSigned = false,
- cFloat = true,
- cMin = cINT32_MIN,
- cMax = cINT32_MAX
- };
- };
-
- template<> struct color_quad_component_traits<double>
- {
- enum
- {
- cSigned = false,
- cFloat = true,
- cMin = cINT32_MIN,
- cMax = cINT32_MAX
- };
- };
-
- template<typename component_type, typename parameter_type>
- class color_quad : public helpers::rel_ops<color_quad<component_type, parameter_type> >
- {
- template<typename T>
- static inline parameter_type clamp(T v)
- {
- parameter_type result = static_cast<parameter_type>(v);
- if (!component_traits::cFloat)
- {
- if (v < component_traits::cMin)
- result = static_cast<parameter_type>(component_traits::cMin);
- else if (v > component_traits::cMax)
- result = static_cast<parameter_type>(component_traits::cMax);
- }
- return result;
- }
-
-#ifdef _MSC_VER
- template<>
- static inline parameter_type clamp(int v)
- {
- if (!component_traits::cFloat)
- {
- if ((!component_traits::cSigned) && (component_traits::cMin == 0) && (component_traits::cMax == 0xFF))
- {
- if (v & 0xFFFFFF00U)
- v = (~(static_cast<int>(v) >> 31)) & 0xFF;
- }
- else
- {
- if (v < component_traits::cMin)
- v = component_traits::cMin;
- else if (v > component_traits::cMax)
- v = component_traits::cMax;
- }
- }
- return static_cast<parameter_type>(v);
- }
-#endif
-
- public:
- typedef component_type component_t;
- typedef parameter_type parameter_t;
- typedef color_quad_component_traits<component_type> component_traits;
-
- enum { cNumComps = 4 };
-
- union
- {
- struct
- {
- component_type r;
- component_type g;
- component_type b;
- component_type a;
- };
-
- component_type c[cNumComps];
-
- uint32 m_u32;
- };
-
- inline color_quad()
- {
- }
-
- inline color_quad(eClear) :
- r(0), g(0), b(0), a(0)
- {
- }
-
- inline color_quad(const color_quad& other) :
- r(other.r), g(other.g), b(other.b), a(other.a)
- {
- }
-
- explicit inline color_quad(parameter_type y, parameter_type alpha = component_traits::cMax)
- {
- set(y, alpha);
- }
-
- inline color_quad(parameter_type red, parameter_type green, parameter_type blue, parameter_type alpha = component_traits::cMax)
- {
- set(red, green, blue, alpha);
- }
-
- explicit inline color_quad(eNoClamp, parameter_type y, parameter_type alpha = component_traits::cMax)
- {
- set_noclamp_y_alpha(y, alpha);
- }
-
- inline color_quad(eNoClamp, parameter_type red, parameter_type green, parameter_type blue, parameter_type alpha = component_traits::cMax)
- {
- set_noclamp_rgba(red, green, blue, alpha);
- }
-
- template<typename other_component_type, typename other_parameter_type>
- inline color_quad(const color_quad<other_component_type, other_parameter_type>& other) :
- r(static_cast<component_type>(clamp(other.r))), g(static_cast<component_type>(clamp(other.g))), b(static_cast<component_type>(clamp(other.b))), a(static_cast<component_type>(clamp(other.a)))
- {
- }
-
- inline void clear()
- {
- r = 0;
- g = 0;
- b = 0;
- a = 0;
- }
-
- inline color_quad& operator= (const color_quad& other)
- {
- r = other.r;
- g = other.g;
- b = other.b;
- a = other.a;
- return *this;
- }
-
- inline color_quad& set_rgb(const color_quad& other)
- {
- r = other.r;
- g = other.g;
- b = other.b;
- return *this;
- }
-
- template<typename other_component_type, typename other_parameter_type>
- inline color_quad& operator=(const color_quad<other_component_type, other_parameter_type>& other)
- {
- r = static_cast<component_type>(clamp(other.r));
- g = static_cast<component_type>(clamp(other.g));
- b = static_cast<component_type>(clamp(other.b));
- a = static_cast<component_type>(clamp(other.a));
- return *this;
- }
-
- inline color_quad& operator= (parameter_type y)
- {
- set(y, component_traits::cMax);
- return *this;
- }
-
- inline color_quad& set(parameter_type y, parameter_type alpha = component_traits::cMax)
- {
- y = clamp(y);
- alpha = clamp(alpha);
- r = static_cast<component_type>(y);
- g = static_cast<component_type>(y);
- b = static_cast<component_type>(y);
- a = static_cast<component_type>(alpha);
- return *this;
- }
-
- inline color_quad& set_noclamp_y_alpha(parameter_type y, parameter_type alpha = component_traits::cMax)
- {
- CRNLIB_ASSERT( (y >= component_traits::cMin) && (y <= component_traits::cMax) );
- CRNLIB_ASSERT( (alpha >= component_traits::cMin) && (alpha <= component_traits::cMax) );
-
- r = static_cast<component_type>(y);
- g = static_cast<component_type>(y);
- b = static_cast<component_type>(y);
- a = static_cast<component_type>(alpha);
- return *this;
- }
-
- inline color_quad& set(parameter_type red, parameter_type green, parameter_type blue, parameter_type alpha = component_traits::cMax)
- {
- r = static_cast<component_type>(clamp(red));
- g = static_cast<component_type>(clamp(green));
- b = static_cast<component_type>(clamp(blue));
- a = static_cast<component_type>(clamp(alpha));
- return *this;
- }
-
- inline color_quad& set_noclamp_rgba(parameter_type red, parameter_type green, parameter_type blue, parameter_type alpha)
- {
- CRNLIB_ASSERT( (red >= component_traits::cMin) && (red <= component_traits::cMax) );
- CRNLIB_ASSERT( (green >= component_traits::cMin) && (green <= component_traits::cMax) );
- CRNLIB_ASSERT( (blue >= component_traits::cMin) && (blue <= component_traits::cMax) );
- CRNLIB_ASSERT( (alpha >= component_traits::cMin) && (alpha <= component_traits::cMax) );
-
- r = static_cast<component_type>(red);
- g = static_cast<component_type>(green);
- b = static_cast<component_type>(blue);
- a = static_cast<component_type>(alpha);
- return *this;
- }
-
- inline color_quad& set_noclamp_rgb(parameter_type red, parameter_type green, parameter_type blue)
- {
- CRNLIB_ASSERT( (red >= component_traits::cMin) && (red <= component_traits::cMax) );
- CRNLIB_ASSERT( (green >= component_traits::cMin) && (green <= component_traits::cMax) );
- CRNLIB_ASSERT( (blue >= component_traits::cMin) && (blue <= component_traits::cMax) );
-
- r = static_cast<component_type>(red);
- g = static_cast<component_type>(green);
- b = static_cast<component_type>(blue);
- return *this;
- }
-
- static inline parameter_type get_min_comp() { return component_traits::cMin; }
- static inline parameter_type get_max_comp() { return component_traits::cMax; }
- static inline bool get_comps_are_signed() { return component_traits::cSigned; }
-
- inline component_type operator[] (uint i) const { CRNLIB_ASSERT(i < cNumComps); return c[i]; }
- inline component_type& operator[] (uint i) { CRNLIB_ASSERT(i < cNumComps); return c[i]; }
-
- inline color_quad& set_component(uint i, parameter_type f)
- {
- CRNLIB_ASSERT(i < cNumComps);
-
- c[i] = static_cast<component_type>(clamp(f));
-
- return *this;
- }
-
- inline color_quad& set_grayscale(parameter_t l)
- {
- component_t x = static_cast<component_t>(clamp(l));
- c[0] = x;
- c[1] = x;
- c[2] = x;
- return *this;
- }
-
- inline color_quad& clamp(const color_quad& l, const color_quad& h)
- {
- for (uint i = 0; i < cNumComps; i++)
- c[i] = static_cast<component_type>(math::clamp<parameter_type>(c[i], l[i], h[i]));
- return *this;
- }
-
- inline color_quad& clamp(parameter_type l, parameter_type h)
- {
- for (uint i = 0; i < cNumComps; i++)
- c[i] = static_cast<component_type>(math::clamp<parameter_type>(c[i], l, h));
- return *this;
- }
-
- // Returns CCIR 601 luma (consistent with color_utils::RGB_To_Y).
- inline parameter_type get_luma() const
- {
- return static_cast<parameter_type>((19595U * r + 38470U * g + 7471U * b + 32768U) >> 16U);
- }
-
- // Returns REC 709 luma.
- inline parameter_type get_luma_rec709() const
- {
- return static_cast<parameter_type>((13938U * r + 46869U * g + 4729U * b + 32768U) >> 16U);
- }
-
- // Beware of endianness!
- inline uint32 get_uint32() const
- {
- CRNLIB_ASSERT(sizeof(*this) == sizeof(uint32));
- return *reinterpret_cast<const uint32*>(this);
- }
-
- // Beware of endianness!
- inline uint64 get_uint64() const
- {
- CRNLIB_ASSERT(sizeof(*this) == sizeof(uint64));
- return *reinterpret_cast<const uint64*>(this);
- }
-
- inline uint squared_distance(const color_quad& c, bool alpha = true) const
- {
- return math::square(r - c.r) + math::square(g - c.g) + math::square(b - c.b) + (alpha ? math::square(a - c.a) : 0);
- }
-
- inline bool rgb_equals(const color_quad& rhs) const
- {
- return (r == rhs.r) && (g == rhs.g) && (b == rhs.b);
- }
-
- inline bool operator== (const color_quad& rhs) const
- {
- if (sizeof(color_quad) == sizeof(uint32))
- return m_u32 == rhs.m_u32;
- else
- return (r == rhs.r) && (g == rhs.g) && (b == rhs.b) && (a == rhs.a);
- }
-
- inline bool operator< (const color_quad& rhs) const
- {
- for (uint i = 0; i < cNumComps; i++)
- {
- if (c[i] < rhs.c[i])
- return true;
- else if (!(c[i] == rhs.c[i]))
- return false;
- }
- return false;
- }
-
- color_quad& operator+= (const color_quad& other)
- {
- for (uint i = 0; i < 4; i++)
- c[i] = static_cast<component_type>(clamp(c[i] + other.c[i]));
- return *this;
- }
-
- color_quad& operator-= (const color_quad& other)
- {
- for (uint i = 0; i < 4; i++)
- c[i] = static_cast<component_type>(clamp(c[i] - other.c[i]));
- return *this;
- }
-
- color_quad& operator*= (parameter_type v)
- {
- for (uint i = 0; i < 4; i++)
- c[i] = static_cast<component_type>(clamp(c[i] * v));
- return *this;
- }
-
- color_quad& operator/= (parameter_type v)
- {
- for (uint i = 0; i < 4; i++)
- c[i] = static_cast<component_type>(c[i] / v);
- return *this;
- }
-
- color_quad get_swizzled(uint x, uint y, uint z, uint w) const
- {
- CRNLIB_ASSERT((x | y | z | w) < 4);
- return color_quad(c[x], c[y], c[z], c[w]);
- }
-
- friend color_quad operator+ (const color_quad& lhs, const color_quad& rhs)
- {
- color_quad result(lhs);
- result += rhs;
- return result;
- }
-
- friend color_quad operator- (const color_quad& lhs, const color_quad& rhs)
- {
- color_quad result(lhs);
- result -= rhs;
- return result;
- }
-
- friend color_quad operator* (const color_quad& lhs, parameter_type v)
- {
- color_quad result(lhs);
- result *= v;
- return result;
- }
-
- friend color_quad operator/ (const color_quad& lhs, parameter_type v)
- {
- color_quad result(lhs);
- result /= v;
- return result;
- }
-
- friend color_quad operator* (parameter_type v, const color_quad& rhs)
- {
- color_quad result(rhs);
- result *= v;
- return result;
- }
-
- inline bool is_grayscale() const
- {
- return (c[0] == c[1]) && (c[1] == c[2]);
- }
-
- uint get_min_component_index(bool alpha = true) const
- {
- uint index = 0;
- uint limit = alpha ? cNumComps : (cNumComps - 1);
- for (uint i = 1; i < limit; i++)
- if (c[i] < c[index])
- index = i;
- return index;
- }
-
- uint get_max_component_index(bool alpha = true) const
- {
- uint index = 0;
- uint limit = alpha ? cNumComps : (cNumComps - 1);
- for (uint i = 1; i < limit; i++)
- if (c[i] > c[index])
- index = i;
- return index;
- }
-
- operator size_t() const
- {
- return (size_t)fast_hash(this, sizeof(*this));
- }
-
- void get_float4(float* pDst)
- {
- for (uint i = 0; i < 4; i++)
- pDst[i] = ((*this)[i] - component_traits::cMin) / float(component_traits::cMax - component_traits::cMin);
- }
-
- void get_float3(float* pDst)
- {
- for (uint i = 0; i < 3; i++)
- pDst[i] = ((*this)[i] - component_traits::cMin) / float(component_traits::cMax - component_traits::cMin);
- }
-
- static color_quad component_min(const color_quad& a, const color_quad& b)
- {
- color_quad result;
- for (uint i = 0; i < 4; i++)
- result[i] = static_cast<component_type>(math::minimum(a[i], b[i]));
- return result;
- }
-
- static color_quad component_max(const color_quad& a, const color_quad& b)
- {
- color_quad result;
- for (uint i = 0; i < 4; i++)
- result[i] = static_cast<component_type>(math::maximum(a[i], b[i]));
- return result;
- }
-
- static color_quad make_black()
- {
- return color_quad(0, 0, 0, component_traits::cMax);
- }
-
- static color_quad make_white()
- {
- return color_quad(component_traits::cMax, component_traits::cMax, component_traits::cMax, component_traits::cMax);
- }
- }; // class color_quad
-
- template<typename c, typename q>
- struct scalar_type< color_quad<c, q> >
- {
- enum { cFlag = true };
- static inline void construct(color_quad<c, q>* p) { }
- static inline void construct(color_quad<c, q>* p, const color_quad<c, q>& init) { memcpy(p, &init, sizeof(color_quad<c, q>)); }
- static inline void construct_array(color_quad<c, q>* p, uint n) { p, n; }
- static inline void destruct(color_quad<c, q>* p) { p; }
- static inline void destruct_array(color_quad<c, q>* p, uint n) { p, n; }
- };
-
- typedef color_quad<uint8, int> color_quad_u8;
- typedef color_quad<int8, int> color_quad_i8;
- typedef color_quad<int16, int> color_quad_i16;
- typedef color_quad<uint16, int> color_quad_u16;
- typedef color_quad<int32, int> color_quad_i32;
- typedef color_quad<uint32, uint> color_quad_u32;
- typedef color_quad<float, float> color_quad_f;
- typedef color_quad<double, double> color_quad_d;
-
- namespace color
- {
- inline uint elucidian_distance(uint r0, uint g0, uint b0, uint r1, uint g1, uint b1)
- {
- int dr = (int)r0 - (int)r1;
- int dg = (int)g0 - (int)g1;
- int db = (int)b0 - (int)b1;
-
- return static_cast<uint>(dr * dr + dg * dg + db * db);
- }
-
- inline uint elucidian_distance(uint r0, uint g0, uint b0, uint a0, uint r1, uint g1, uint b1, uint a1)
- {
- int dr = (int)r0 - (int)r1;
- int dg = (int)g0 - (int)g1;
- int db = (int)b0 - (int)b1;
- int da = (int)a0 - (int)a1;
-
- return static_cast<uint>(dr * dr + dg * dg + db * db + da * da);
- }
-
- inline uint elucidian_distance(const color_quad_u8& c0, const color_quad_u8& c1, bool alpha)
- {
- if (alpha)
- return elucidian_distance(c0.r, c0.g, c0.b, c0.a, c1.r, c1.g, c1.b, c1.a);
- else
- return elucidian_distance(c0.r, c0.g, c0.b, c1.r, c1.g, c1.b);
- }
-
- inline uint weighted_elucidian_distance(uint r0, uint g0, uint b0, uint r1, uint g1, uint b1, uint wr, uint wg, uint wb)
- {
- int dr = (int)r0 - (int)r1;
- int dg = (int)g0 - (int)g1;
- int db = (int)b0 - (int)b1;
-
- return static_cast<uint>((wr * dr * dr) + (wg * dg * dg) + (wb * db * db));
- }
-
- inline uint weighted_elucidian_distance(
- uint r0, uint g0, uint b0, uint a0,
- uint r1, uint g1, uint b1, uint a1,
- uint wr, uint wg, uint wb, uint wa)
- {
- int dr = (int)r0 - (int)r1;
- int dg = (int)g0 - (int)g1;
- int db = (int)b0 - (int)b1;
- int da = (int)a0 - (int)a1;
-
- return static_cast<uint>((wr * dr * dr) + (wg * dg * dg) + (wb * db * db) + (wa * da * da));
- }
-
- inline uint weighted_elucidian_distance(const color_quad_u8& c0, const color_quad_u8& c1, uint wr, uint wg, uint wb, uint wa)
- {
- return weighted_elucidian_distance(c0.r, c0.g, c0.b, c0.a, c1.r, c1.g, c1.b, c1.a, wr, wg, wb, wa);
- }
-
- //const uint cRWeight = 8;//24;
- //const uint cGWeight = 24;//73;
- //const uint cBWeight = 1;//3;
-
- const uint cRWeight = 8;//24;
- const uint cGWeight = 25;//73;
- const uint cBWeight = 1;//3;
-
- inline uint color_distance(bool perceptual, const color_quad_u8& e1, const color_quad_u8& e2, bool alpha)
- {
- if (perceptual)
- {
- if (alpha)
- return weighted_elucidian_distance(e1, e2, cRWeight, cGWeight, cBWeight, cRWeight+cGWeight+cBWeight);
- else
- return weighted_elucidian_distance(e1, e2, cRWeight, cGWeight, cBWeight, 0);
- }
- else
- return elucidian_distance(e1, e2, alpha);
- }
-
- inline uint peak_color_error(const color_quad_u8& e1, const color_quad_u8& e2)
- {
- return math::maximum<uint>(labs(e1[0] - e2[0]), labs(e1[1] - e2[1]), labs(e1[2] - e2[2]));
- //return math::square<int>(e1[0] - e2[0]) + math::square<int>(e1[1] - e2[1]) + math::square<int>(e1[2] - e2[2]);
- }
-
- // y - [0,255]
- // co - [-127,127]
- // cg - [-126,127]
- inline void RGB_to_YCoCg(int r, int g, int b, int& y, int& co, int& cg)
- {
- y = (r >> 2) + (g >> 1) + (b >> 2);
- co = (r >> 1) - (b >> 1);
- cg = -(r >> 2) + (g >> 1) - (b >> 2);
- }
-
- inline void YCoCg_to_RGB(int y, int co, int cg, int& r, int& g, int& b)
- {
- int tmp = y - cg;
- g = y + cg;
- r = tmp + co;
- b = tmp - co;
- }
-
- static inline uint8 clamp_component(int i) { if (static_cast<uint>(i) > 255U) { if (i < 0) i = 0; else if (i > 255) i = 255; } return static_cast<uint8>(i); }
-
- // RGB->YCbCr constants, scaled by 2^16
- const int YR = 19595, YG = 38470, YB = 7471, CB_R = -11059, CB_G = -21709, CB_B = 32768, CR_R = 32768, CR_G = -27439, CR_B = -5329;
- // YCbCr->RGB constants, scaled by 2^16
- const int R_CR = 91881, B_CB = 116130, G_CR = -46802, G_CB = -22554;
-
- inline int RGB_to_Y(const color_quad_u8& rgb)
- {
- const int r = rgb[0], g = rgb[1], b = rgb[2];
- return (r * YR + g * YG + b * YB + 32768) >> 16;
- }
-
- // RGB to YCbCr (same as JFIF JPEG).
- // Odd default biases account for 565 endpoint packing.
- inline void RGB_to_YCC(color_quad_u8& ycc, const color_quad_u8& rgb, int cb_bias = 123, int cr_bias = 125)
- {
- const int r = rgb[0], g = rgb[1], b = rgb[2];
- ycc.a = static_cast<uint8>((r * YR + g * YG + b * YB + 32768) >> 16);
- ycc.r = clamp_component(cb_bias + ((r * CB_R + g * CB_G + b * CB_B + 32768) >> 16));
- ycc.g = clamp_component(cr_bias + ((r * CR_R + g * CR_G + b * CR_B + 32768) >> 16));
- ycc.b = 0;
- }
-
- // YCbCr to RGB.
- // Odd biases account for 565 endpoint packing.
- inline void YCC_to_RGB(color_quad_u8& rgb, const color_quad_u8& ycc, int cb_bias = 123, int cr_bias = 125)
- {
- const int y = ycc.a;
- const int cb = ycc.r - cb_bias;
- const int cr = ycc.g - cr_bias;
- rgb.r = clamp_component(y + ((R_CR * cr + 32768) >> 16));
- rgb.g = clamp_component(y + ((G_CR * cr + G_CB * cb + 32768) >> 16));
- rgb.b = clamp_component(y + ((B_CB * cb + 32768) >> 16));
- rgb.a = 255;
- }
-
- // Float RGB->YCbCr constants
- const float S = 1.0f/65536.0f;
- const float F_YR = S*YR, F_YG = S*YG, F_YB = S*YB, F_CB_R = S*CB_R, F_CB_G = S*CB_G, F_CB_B = S*CB_B, F_CR_R = S*CR_R, F_CR_G = S*CR_G, F_CR_B = S*CR_B;
- // Float YCbCr->RGB constants
- const float F_R_CR = S*R_CR, F_B_CB = S*B_CB, F_G_CR = S*G_CR, F_G_CB = S*G_CB;
-
- inline void RGB_to_YCC_float(color_quad_f& ycc, const color_quad_u8& rgb)
- {
- const int r = rgb[0], g = rgb[1], b = rgb[2];
- ycc.a = r * F_YR + g * F_YG + b * F_YB;
- ycc.r = r * F_CB_R + g * F_CB_G + b * F_CB_B;
- ycc.g = r * F_CR_R + g * F_CR_G + b * F_CR_B;
- ycc.b = 0;
- }
-
- inline void YCC_float_to_RGB(color_quad_u8& rgb, const color_quad_f& ycc)
- {
- float y = ycc.a, cb = ycc.r, cr = ycc.g;
- rgb.r = color::clamp_component(static_cast<int>(.5f + y + F_R_CR * cr));
- rgb.g = color::clamp_component(static_cast<int>(.5f + y + F_G_CR * cr + F_G_CB * cb));
- rgb.b = color::clamp_component(static_cast<int>(.5f + y + F_B_CB * cb));
- rgb.a = 255;
- }
-
- } // namespace color
-
- // This class purposely trades off speed for extremely flexibility. It can handle any component swizzle, any pixel type from 1-4 components and 1-32 bits/component,
- // any pixel size between 1-16 bytes/pixel, any pixel stride, any color_quad data type (signed/unsigned/float 8/16/32 bits/component), and scaled/non-scaled components.
- // On the downside, it's freaking slow.
- class pixel_packer
- {
- public:
- pixel_packer()
- {
- clear();
- }
-
- pixel_packer(uint num_comps, uint bits_per_comp, int pixel_stride = -1, bool reversed = false)
- {
- init(num_comps, bits_per_comp, pixel_stride, reversed);
- }
-
- pixel_packer(const char* pComp_map, int pixel_stride = -1, int force_comp_size = -1)
- {
- init(pComp_map, pixel_stride, force_comp_size);
- }
-
- void clear()
- {
- utils::zero_this(this);
- }
-
- inline bool is_valid() const { return m_pixel_stride > 0; }
-
- inline uint get_pixel_stride() const { return m_pixel_stride; }
- void set_pixel_stride(uint n) { m_pixel_stride = n; }
-
- uint get_num_comps() const { return m_num_comps; }
- uint get_comp_size(uint index) const { CRNLIB_ASSERT(index < 4); return m_comp_size[index]; }
- uint get_comp_ofs(uint index) const { CRNLIB_ASSERT(index < 4); return m_comp_ofs[index]; }
- uint get_comp_max(uint index) const { CRNLIB_ASSERT(index < 4); return m_comp_max[index]; }
- bool get_rgb_is_luma() const { return m_rgb_is_luma; }
-
- template<typename color_quad_type>
- const void* unpack(const void* p, color_quad_type& color, bool rescale = true) const
- {
- const uint8* pSrc = static_cast<const uint8*>(p);
-
- for (uint i = 0; i < 4; i++)
- {
- const uint comp_size = m_comp_size[i];
- if (!comp_size)
- {
- if (color_quad_type::component_traits::cFloat)
- color[i] = static_cast< typename color_quad_type::parameter_t >((i == 3) ? 1 : 0);
- else
- color[i] = static_cast< typename color_quad_type::parameter_t >((i == 3) ? color_quad_type::component_traits::cMax : 0);
- continue;
- }
-
- uint n = 0, dst_bit_ofs = 0;
- uint src_bit_ofs = m_comp_ofs[i];
- while (dst_bit_ofs < comp_size)
- {
- const uint byte_bit_ofs = src_bit_ofs & 7;
- n |= ((pSrc[src_bit_ofs >> 3] >> byte_bit_ofs) << dst_bit_ofs);
-
- const uint bits_read = 8 - byte_bit_ofs;
- src_bit_ofs += bits_read;
- dst_bit_ofs += bits_read;
- }
-
- const uint32 mx = m_comp_max[i];
- n &= mx;
-
- const uint32 h = static_cast<uint32>(color_quad_type::component_traits::cMax);
-
- if (color_quad_type::component_traits::cFloat)
- color.set_component(i, static_cast<typename color_quad_type::parameter_t>(n));
- else if (rescale)
- color.set_component(i, static_cast<typename color_quad_type::parameter_t>( (static_cast<uint64>(n) * h + (mx >> 1U)) / mx ) );
- else if (color_quad_type::component_traits::cSigned)
- color.set_component(i, static_cast<typename color_quad_type::parameter_t>(math::minimum<uint32>(n, h)));
- else
- color.set_component(i, static_cast<typename color_quad_type::parameter_t>(n));
- }
-
- if (m_rgb_is_luma)
- {
- color[0] = color[1];
- color[2] = color[1];
- }
-
- return pSrc + m_pixel_stride;
- }
-
- template<typename color_quad_type>
- void* pack(const color_quad_type& color, void* p, bool rescale = true) const
- {
- uint8* pDst = static_cast<uint8*>(p);
-
- for (uint i = 0; i < 4; i++)
- {
- const uint comp_size = m_comp_size[i];
- if (!comp_size)
- continue;
-
- uint32 mx = m_comp_max[i];
-
- uint32 n;
- if (color_quad_type::component_traits::cFloat)
- {
- typename color_quad_type::parameter_t t = color[i];
- if (t < 0.0f)
- n = 0;
- else if (t > static_cast<typename color_quad_type::parameter_t>(mx))
- n = mx;
- else
- n = math::minimum<uint32>(static_cast<uint32>(floor(t + .5f)), mx);
- }
- else if (rescale)
- {
- if (color_quad_type::component_traits::cSigned)
- n = math::maximum<int>(static_cast<int>(color[i]), 0);
- else
- n = static_cast<uint32>(color[i]);
-
- const uint32 h = static_cast<uint32>(color_quad_type::component_traits::cMax);
- n = static_cast<uint32>((static_cast<uint64>(n) * mx + (h >> 1)) / h);
- }
- else
- {
- if (color_quad_type::component_traits::cSigned)
- n = math::minimum<uint32>(static_cast<uint32>(math::maximum<int>(static_cast<int>(color[i]), 0)), mx);
- else
- n = math::minimum<uint32>(static_cast<uint32>(color[i]), mx);
- }
-
- uint src_bit_ofs = 0;
- uint dst_bit_ofs = m_comp_ofs[i];
- while (src_bit_ofs < comp_size)
- {
- const uint cur_byte_bit_ofs = (dst_bit_ofs & 7);
- const uint cur_byte_bits = 8 - cur_byte_bit_ofs;
-
- uint byte_val = pDst[dst_bit_ofs >> 3];
- uint bit_mask = (mx << cur_byte_bit_ofs) & 0xFF;
- byte_val &= ~bit_mask;
- byte_val |= (n << cur_byte_bit_ofs);
- pDst[dst_bit_ofs >> 3] = static_cast<uint8>(byte_val);
-
- mx >>= cur_byte_bits;
- n >>= cur_byte_bits;
-
- dst_bit_ofs += cur_byte_bits;
- src_bit_ofs += cur_byte_bits;
- }
- }
-
- return pDst + m_pixel_stride;
- }
-
- bool init(uint num_comps, uint bits_per_comp, int pixel_stride = -1, bool reversed = false)
- {
- clear();
-
- if ((num_comps < 1) || (num_comps > 4) || (bits_per_comp < 1) || (bits_per_comp > 32))
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- for (uint i = 0; i < num_comps; i++)
- {
- m_comp_size[i] = bits_per_comp;
- m_comp_ofs[i] = i * bits_per_comp;
- if (reversed)
- m_comp_ofs[i] = ((num_comps - 1) * bits_per_comp) - m_comp_ofs[i];
- }
-
- for (uint i = 0; i < 4; i++)
- m_comp_max[i] = static_cast<uint32>((1ULL << m_comp_size[i]) - 1ULL);
-
- m_pixel_stride = (pixel_stride >= 0) ? pixel_stride : (num_comps * bits_per_comp + 7) / 8;
-
- return true;
- }
-
- // Format examples:
- // R16G16B16
- // B5G6R5
- // B5G5R5x1
- // Y8A8
- // A8R8G8B8
- // First component is at LSB in memory. Assumes unsigned integer components, 1-32bits each.
- bool init(const char* pComp_map, int pixel_stride = -1, int force_comp_size = -1)
- {
- clear();
-
- uint cur_bit_ofs = 0;
-
- while (*pComp_map)
- {
- char c = *pComp_map++;
-
- int comp_index = -1;
- if (c == 'R')
- comp_index = 0;
- else if (c == 'G')
- comp_index = 1;
- else if (c == 'B')
- comp_index = 2;
- else if (c == 'A')
- comp_index = 3;
- else if (c == 'Y')
- comp_index = 4;
- else if (c != 'x')
- return false;
-
- uint comp_size = 0;
-
- uint n = *pComp_map;
- if ((n >= '0') && (n <= '9'))
- {
- comp_size = n - '0';
- pComp_map++;
-
- n = *pComp_map;
- if ((n >= '0') && (n <= '9'))
- {
- comp_size = (comp_size * 10) + (n - '0');
- pComp_map++;
- }
- }
-
- if (force_comp_size != -1)
- comp_size = force_comp_size;
-
- if ((!comp_size) || (comp_size > 32))
- return false;
-
- if (comp_index == 4)
- {
- if (m_comp_size[0] || m_comp_size[1] || m_comp_size[2])
- return false;
-
- //m_comp_ofs[0] = m_comp_ofs[1] = m_comp_ofs[2] = cur_bit_ofs;
- //m_comp_size[0] = m_comp_size[1] = m_comp_size[2] = comp_size;
- m_comp_ofs[1] = cur_bit_ofs;
- m_comp_size[1] = comp_size;
- m_rgb_is_luma = true;
- m_num_comps++;
- }
- else if (comp_index >= 0)
- {
- if (m_comp_size[comp_index])
- return false;
-
- m_comp_ofs[comp_index] = cur_bit_ofs;
- m_comp_size[comp_index] = comp_size;
- m_num_comps++;
- }
-
- cur_bit_ofs += comp_size;
- }
-
- for (uint i = 0; i < 4; i++)
- m_comp_max[i] = static_cast<uint32>((1ULL << m_comp_size[i]) - 1ULL);
-
- if (pixel_stride >= 0)
- m_pixel_stride = pixel_stride;
- else
- m_pixel_stride = (cur_bit_ofs + 7) / 8;
- return true;
- }
-
- private:
- uint m_pixel_stride;
- uint m_num_comps;
- uint m_comp_size[4];
- uint m_comp_ofs[4];
- uint m_comp_max[4];
- bool m_rgb_is_luma;
- };
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_colorized_console.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_colorized_console.cpp
deleted file mode 100644
index a55c84e6..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_colorized_console.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-// File: crn_colorized_console.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_colorized_console.h"
-#ifdef CRNLIB_USE_WIN32_API
-#include "crn_winhdr.h"
-#endif
-
-namespace crnlib
-{
- void colorized_console::init()
- {
- console::init();
- console::add_console_output_func(console_output_func, NULL);
- }
-
- void colorized_console::deinit()
- {
- console::remove_console_output_func(console_output_func);
- console::deinit();
- }
-
- void colorized_console::tick()
- {
- }
-
-#ifdef CRNLIB_USE_WIN32_API
- bool colorized_console::console_output_func(eConsoleMessageType type, const char* pMsg, void* pData)
- {
- pData;
-
- if (console::get_output_disabled())
- return true;
-
- HANDLE cons = GetStdHandle(STD_OUTPUT_HANDLE);
-
- DWORD attr = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
- switch (type)
- {
- case cDebugConsoleMessage: attr = FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
- case cMessageConsoleMessage: attr = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
- case cWarningConsoleMessage: attr = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY; break;
- case cErrorConsoleMessage: attr = FOREGROUND_RED | FOREGROUND_INTENSITY; break;
- default: break;
- }
-
- if (INVALID_HANDLE_VALUE != cons)
- SetConsoleTextAttribute(cons, (WORD)attr);
-
- if ((console::get_prefixes()) && (console::get_at_beginning_of_line()))
- {
- switch (type)
- {
- case cDebugConsoleMessage:
- printf("Debug: %s", pMsg);
- break;
- case cWarningConsoleMessage:
- printf("Warning: %s", pMsg);
- break;
- case cErrorConsoleMessage:
- printf("Error: %s", pMsg);
- break;
- default:
- printf("%s", pMsg);
- break;
- }
- }
- else
- {
- printf("%s", pMsg);
- }
-
- if (console::get_crlf())
- printf("\n");
-
- if (INVALID_HANDLE_VALUE != cons)
- SetConsoleTextAttribute(cons, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
-
- return true;
- }
-#else
- bool colorized_console::console_output_func(eConsoleMessageType type, const char* pMsg, void* pData)
- {
- pData;
- if (console::get_output_disabled())
- return true;
-
- if ((console::get_prefixes()) && (console::get_at_beginning_of_line()))
- {
- switch (type)
- {
- case cDebugConsoleMessage:
- printf("Debug: %s", pMsg);
- break;
- case cWarningConsoleMessage:
- printf("Warning: %s", pMsg);
- break;
- case cErrorConsoleMessage:
- printf("Error: %s", pMsg);
- break;
- default:
- printf("%s", pMsg);
- break;
- }
- }
- else
- {
- printf("%s", pMsg);
- }
-
- if (console::get_crlf())
- printf("\n");
-
- return true;
- }
-#endif
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_colorized_console.h b/Libraries/crunch-ea9b8d/crnlib/crn_colorized_console.h
deleted file mode 100644
index 57c3a466..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_colorized_console.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// File: crn_colorized_console.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_console.h"
-
-namespace crnlib
-{
- class colorized_console
- {
- public:
- static void init();
- static void deinit();
- static void tick();
-
- private:
- static bool console_output_func(eConsoleMessageType type, const char* pMsg, void* pData);
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_command_line_params.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_command_line_params.cpp
deleted file mode 100644
index 97e364bb..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_command_line_params.cpp
+++ /dev/null
@@ -1,472 +0,0 @@
-// File: crn_command_line_params.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_command_line_params.h"
-#include "crn_console.h"
-#include "crn_cfile_stream.h"
-
-#ifdef WIN32
- #define CRNLIB_CMD_LINE_ALLOW_SLASH_PARAMS 1
-#endif
-
-#if CRNLIB_USE_WIN32_API
-#include "crn_winhdr.h"
-#endif
-namespace crnlib
-{
- void get_command_line_as_single_string(dynamic_string& cmd_line, int argc, char *argv[])
- {
- argc, argv;
-#if CRNLIB_USE_WIN32_API
- cmd_line.set(GetCommandLineA());
-#else
- cmd_line.clear();
- for (int i = 0; i < argc; i++)
- {
- dynamic_string tmp(argv[i]);
- if ((tmp.front() != '"') && (tmp.front() != '-') && (tmp.front() != '@'))
- tmp = "\"" + tmp + "\"";
- if (cmd_line.get_len())
- cmd_line += " ";
- cmd_line += tmp;
- }
-#endif
- }
-
- command_line_params::command_line_params()
- {
- }
-
- void command_line_params::clear()
- {
- m_params.clear();
-
- m_param_map.clear();
- }
-
- bool command_line_params::split_params(const char* p, dynamic_string_array& params)
- {
- bool within_param = false;
- bool within_quote = false;
-
- uint ofs = 0;
- dynamic_string str;
-
- while (p[ofs])
- {
- const char c = p[ofs];
-
- if (within_param)
- {
- if (within_quote)
- {
- if (c == '"')
- within_quote = false;
-
- str.append_char(c);
- }
- else if ((c == ' ') || (c == '\t'))
- {
- if (!str.is_empty())
- {
- params.push_back(str);
- str.clear();
- }
- within_param = false;
- }
- else
- {
- if (c == '"')
- within_quote = true;
-
- str.append_char(c);
- }
- }
- else if ((c != ' ') && (c != '\t'))
- {
- within_param = true;
-
- if (c == '"')
- within_quote = true;
-
- str.append_char(c);
- }
-
- ofs++;
- }
-
- if (within_quote)
- {
- console::error("Unmatched quote in command line \"%s\"", p);
- return false;
- }
-
- if (!str.is_empty())
- params.push_back(str);
-
- return true;
- }
-
- bool command_line_params::load_string_file(const char* pFilename, dynamic_string_array& strings)
- {
- cfile_stream in_stream;
- if (!in_stream.open(pFilename, cDataStreamReadable | cDataStreamSeekable))
- {
- console::error("Unable to open file \"%s\" for reading!", pFilename);
- return false;
- }
-
- dynamic_string ansi_str;
-
- for ( ; ; )
- {
- if (!in_stream.read_line(ansi_str))
- break;
-
- ansi_str.trim();
- if (ansi_str.is_empty())
- continue;
-
- strings.push_back(dynamic_string(ansi_str.get_ptr()));
- }
-
- return true;
- }
-
- bool command_line_params::parse(const dynamic_string_array& params, uint n, const param_desc* pParam_desc)
- {
- CRNLIB_ASSERT(n && pParam_desc);
-
- m_params = params;
-
- uint arg_index = 0;
- while (arg_index < params.size())
- {
- const uint cur_arg_index = arg_index;
- const dynamic_string& src_param = params[arg_index++];
-
- if (src_param.is_empty())
- continue;
-#if CRNLIB_CMD_LINE_ALLOW_SLASH_PARAMS
- if ((src_param[0] == '/') || (src_param[0] == '-'))
-#else
- if (src_param[0] == '-')
-#endif
- {
- if (src_param.get_len() < 2)
- {
- console::error("Invalid command line parameter: \"%s\"", src_param.get_ptr());
- return false;
- }
-
- dynamic_string key_str(src_param);
-
- key_str.right(1);
-
- int modifier = 0;
- char c = key_str[key_str.get_len() - 1];
- if (c == '+')
- modifier = 1;
- else if (c == '-')
- modifier = -1;
-
- if (modifier)
- key_str.left(key_str.get_len() - 1);
-
- uint param_index;
- for (param_index = 0; param_index < n; param_index++)
- if (key_str == pParam_desc[param_index].m_pName)
- break;
-
- if (param_index == n)
- {
- console::error("Unrecognized command line parameter: \"%s\"", src_param.get_ptr());
- return false;
- }
-
- const param_desc& desc = pParam_desc[param_index];
-
- const uint cMaxValues = 16;
- dynamic_string val_str[cMaxValues];
- uint num_val_strs = 0;
- if (desc.m_num_values)
- {
- CRNLIB_ASSERT(desc.m_num_values <= cMaxValues);
-
- if ((arg_index + desc.m_num_values) > params.size())
- {
- console::error("Expected %u value(s) after command line parameter: \"%s\"", desc.m_num_values, src_param.get_ptr());
- return false;
- }
-
- for (uint v = 0; v < desc.m_num_values; v++)
- val_str[num_val_strs++] = params[arg_index++];
- }
-
- dynamic_string_array strings;
-
- if ((desc.m_support_listing_file) && (val_str[0].get_len() >= 2) && (val_str[0][0] == '@'))
- {
- dynamic_string filename(val_str[0]);
- filename.right(1);
- filename.unquote();
-
- if (!load_string_file(filename.get_ptr(), strings))
- {
- console::error("Failed loading listing file \"%s\"!", filename.get_ptr());
- return false;
- }
- }
- else
- {
- for (uint v = 0; v < num_val_strs; v++)
- {
- val_str[v].unquote();
- strings.push_back(val_str[v]);
- }
- }
-
- param_value pv;
- pv.m_values.swap(strings);
- pv.m_index = cur_arg_index;
- pv.m_modifier = (int8)modifier;
- m_param_map.insert(std::make_pair(key_str, pv));
- }
- else
- {
- param_value pv;
- pv.m_values.push_back(src_param);
- pv.m_values.back().unquote();
- pv.m_index = cur_arg_index;
- m_param_map.insert(std::make_pair(g_empty_dynamic_string, pv));
- }
- }
-
- return true;
- }
-
- bool command_line_params::parse(const char* pCmd_line, uint n, const param_desc* pParam_desc, bool skip_first_param)
- {
- CRNLIB_ASSERT(n && pParam_desc);
-
- dynamic_string_array p;
- if (!split_params(pCmd_line, p))
- return 0;
-
- if (p.empty())
- return 0;
-
- if (skip_first_param)
- p.erase(0U);
-
- return parse(p, n, pParam_desc);
- }
-
- bool command_line_params::is_param(uint index) const
- {
- CRNLIB_ASSERT(index < m_params.size());
- if (index >= m_params.size())
- return false;
-
- const dynamic_string& w = m_params[index];
- if (w.is_empty())
- return false;
-
-#if CRNLIB_CMD_LINE_ALLOW_SLASH_PARAMS
- return (w.get_len() >= 2) && ((w[0] == '-') || (w[0] == '/'));
-#else
- return (w.get_len() >= 2) && (w[0] == '-');
-#endif
- }
-
- uint command_line_params::find(uint num_keys, const char** ppKeys, crnlib::vector<param_map_const_iterator>* pIterators, crnlib::vector<uint>* pUnmatched_indices) const
- {
- CRNLIB_ASSERT(ppKeys);
-
- if (pUnmatched_indices)
- {
- pUnmatched_indices->resize(m_params.size());
- for (uint i = 0; i < m_params.size(); i++)
- (*pUnmatched_indices)[i] = i;
- }
-
- uint n = 0;
- for (uint i = 0; i < num_keys; i++)
- {
- const char* pKey = ppKeys[i];
-
- param_map_const_iterator begin, end;
- find(pKey, begin, end);
-
- while (begin != end)
- {
- if (pIterators)
- pIterators->push_back(begin);
-
- if (pUnmatched_indices)
- {
- int k = pUnmatched_indices->find(begin->second.m_index);
- if (k >= 0)
- pUnmatched_indices->erase_unordered(k);
- }
-
- n++;
- begin++;
- }
- }
-
- return n;
- }
-
- void command_line_params::find(const char* pKey, param_map_const_iterator& begin, param_map_const_iterator& end) const
- {
- dynamic_string key(pKey);
- begin = m_param_map.lower_bound(key);
- end = m_param_map.upper_bound(key);
- }
-
- uint command_line_params::get_count(const char* pKey) const
- {
- param_map_const_iterator begin, end;
- find(pKey, begin, end);
-
- uint n = 0;
-
- while (begin != end)
- {
- n++;
- begin++;
- }
-
- return n;
- }
-
- command_line_params::param_map_const_iterator command_line_params::get_param(const char* pKey, uint index) const
- {
- param_map_const_iterator begin, end;
- find(pKey, begin, end);
-
- if (begin == end)
- return m_param_map.end();
-
- uint n = 0;
-
- while ((begin != end) && (n != index))
- {
- n++;
- begin++;
- }
-
- if (begin == end)
- return m_param_map.end();
-
- return begin;
- }
-
- bool command_line_params::has_value(const char* pKey, uint index) const
- {
- return get_num_values(pKey, index) != 0;
- }
-
- uint command_line_params::get_num_values(const char* pKey, uint index) const
- {
- param_map_const_iterator it = get_param(pKey, index);
-
- if (it == end())
- return 0;
-
- return it->second.m_values.size();
- }
-
- bool command_line_params::get_value_as_bool(const char* pKey, uint index, bool def) const
- {
- param_map_const_iterator it = get_param(pKey, index);
- if (it == end())
- return def;
-
- if (it->second.m_modifier)
- return it->second.m_modifier > 0;
- else
- return true;
- }
-
- int command_line_params::get_value_as_int(const char* pKey, uint index, int def, int l, int h, uint value_index) const
- {
- param_map_const_iterator it = get_param(pKey, index);
- if ((it == end()) || (value_index >= it->second.m_values.size()))
- return def;
-
- int val;
- const char* p = it->second.m_values[value_index].get_ptr();
- if (!string_to_int(p, val))
- {
- crnlib::console::warning("Invalid value specified for parameter \"%s\", using default value of %i", pKey, def);
- return def;
- }
-
- if (val < l)
- {
- crnlib::console::warning("Value %i for parameter \"%s\" is out of range, clamping to %i", val, pKey, l);
- val = l;
- }
- else if (val > h)
- {
- crnlib::console::warning("Value %i for parameter \"%s\" is out of range, clamping to %i", val, pKey, h);
- val = h;
- }
-
- return val;
- }
-
- float command_line_params::get_value_as_float(const char* pKey, uint index, float def, float l, float h, uint value_index) const
- {
- param_map_const_iterator it = get_param(pKey, index);
- if ((it == end()) || (value_index >= it->second.m_values.size()))
- return def;
-
- float val;
- const char* p = it->second.m_values[value_index].get_ptr();
- if (!string_to_float(p, val))
- {
- crnlib::console::warning("Invalid value specified for float parameter \"%s\", using default value of %f", pKey, def);
- return def;
- }
-
- if (val < l)
- {
- crnlib::console::warning("Value %f for parameter \"%s\" is out of range, clamping to %f", val, pKey, l);
- val = l;
- }
- else if (val > h)
- {
- crnlib::console::warning("Value %f for parameter \"%s\" is out of range, clamping to %f", val, pKey, h);
- val = h;
- }
-
- return val;
- }
-
- bool command_line_params::get_value_as_string(const char* pKey, uint index, dynamic_string& value, uint value_index) const
- {
- param_map_const_iterator it = get_param(pKey, index);
- if ((it == end()) || (value_index >= it->second.m_values.size()))
- {
- value.empty();
- return false;
- }
-
- value = it->second.m_values[value_index];
- return true;
- }
-
- const dynamic_string& command_line_params::get_value_as_string_or_empty(const char* pKey, uint index, uint value_index) const
- {
- param_map_const_iterator it = get_param(pKey, index);
- if ((it == end()) || (value_index >= it->second.m_values.size()))
- return g_empty_dynamic_string;
-
- return it->second.m_values[value_index];
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_command_line_params.h b/Libraries/crunch-ea9b8d/crnlib/crn_command_line_params.h
deleted file mode 100644
index 726b706d..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_command_line_params.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// File: crn_command_line_params.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_value.h"
-#include <map>
-
-namespace crnlib
-{
- // Returns the command line passed to the app as a string.
- // On systems where this isn't trivial, this function combines together the separate arguments, quoting and adding spaces as needed.
- void get_command_line_as_single_string(dynamic_string& cmd_line, int argc, char *argv[]);
-
- class command_line_params
- {
- public:
- struct param_value
- {
- inline param_value() : m_index(0), m_modifier(0) { }
-
- dynamic_string_array m_values;
- uint m_index;
- int8 m_modifier;
- };
-
- typedef std::multimap<dynamic_string, param_value> param_map;
- typedef param_map::const_iterator param_map_const_iterator;
- typedef param_map::iterator param_map_iterator;
-
- command_line_params();
-
- void clear();
-
- static bool split_params(const char* p, dynamic_string_array& params);
-
- struct param_desc
- {
- const char* m_pName;
- uint m_num_values;
- bool m_support_listing_file;
- };
-
- bool parse(const dynamic_string_array& params, uint n, const param_desc* pParam_desc);
- bool parse(const char* pCmd_line, uint n, const param_desc* pParam_desc, bool skip_first_param = true);
-
- const dynamic_string_array& get_array() const { return m_params; }
-
- bool is_param(uint index) const;
-
- const param_map& get_map() const { return m_param_map; }
-
- uint get_num_params() const { return static_cast<uint>(m_param_map.size()); }
-
- param_map_const_iterator begin() const { return m_param_map.begin(); }
- param_map_const_iterator end() const { return m_param_map.end(); }
-
- uint find(uint num_keys, const char** ppKeys, crnlib::vector<param_map_const_iterator>* pIterators, crnlib::vector<uint>* pUnmatched_indices) const;
-
- void find(const char* pKey, param_map_const_iterator& begin, param_map_const_iterator& end) const;
-
- uint get_count(const char* pKey) const;
-
- // Returns end() if param cannot be found, or index is out of range.
- param_map_const_iterator get_param(const char* pKey, uint index) const;
-
- bool has_key(const char* pKey) const { return get_param(pKey, 0) != end(); }
-
- bool has_value(const char* pKey, uint index) const;
- uint get_num_values(const char* pKey, uint index) const;
-
- bool get_value_as_bool(const char* pKey, uint index = 0, bool def = false) const;
-
- int get_value_as_int(const char* pKey, uint index, int def, int l = INT_MIN, int h = INT_MAX, uint value_index = 0) const;
- float get_value_as_float(const char* pKey, uint index, float def = 0.0f, float l = -math::cNearlyInfinite, float h = math::cNearlyInfinite, uint value_index = 0) const;
-
- bool get_value_as_string(const char* pKey, uint index, dynamic_string& value, uint value_index = 0) const;
- const dynamic_string& get_value_as_string_or_empty(const char* pKey, uint index = 0, uint value_index = 0) const;
-
- private:
- dynamic_string_array m_params;
-
- param_map m_param_map;
-
- static bool load_string_file(const char* pFilename, dynamic_string_array& strings);
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_comp.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_comp.cpp
deleted file mode 100644
index 1a51edf7..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_comp.cpp
+++ /dev/null
@@ -1,2178 +0,0 @@
-// File: crn_comp.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_console.h"
-#include "crn_comp.h"
-#include "crn_zeng.h"
-#include "crn_checksum.h"
-
-#define CRNLIB_CREATE_DEBUG_IMAGES 0
-#define CRNLIB_ENABLE_DEBUG_MESSAGES 0
-
-namespace crnlib
-{
- static const uint cEncodingMapNumChunksPerCode = 3;
-
- crn_comp::crn_comp() :
- m_pParams(NULL)
- {
- }
-
- crn_comp::~crn_comp()
- {
- }
-
- float crn_comp::color_endpoint_similarity_func(uint index_a, uint index_b, void* pContext)
- {
- dxt_hc& hvq = *static_cast<dxt_hc*>(pContext);
-
- uint endpoint_a = hvq.get_color_endpoint(index_a);
- uint endpoint_b = hvq.get_color_endpoint(index_b);
-
- color_quad_u8 a[2];
- a[0] = dxt1_block::unpack_color((uint16)(endpoint_a & 0xFFFF), true);
- a[1] = dxt1_block::unpack_color((uint16)((endpoint_a >> 16) & 0xFFFF), true);
-
- color_quad_u8 b[2];
- b[0] = dxt1_block::unpack_color((uint16)(endpoint_b & 0xFFFF), true);
- b[1] = dxt1_block::unpack_color((uint16)((endpoint_b >> 16) & 0xFFFF), true);
-
- uint total_error = color::elucidian_distance(a[0], b[0], false) + color::elucidian_distance(a[1], b[1], false);
-
- float weight = 1.0f - math::clamp(total_error * 1.0f/8000.0f, 0.0f, 1.0f);
- return weight;
- }
-
- float crn_comp::alpha_endpoint_similarity_func(uint index_a, uint index_b, void* pContext)
- {
- dxt_hc& hvq = *static_cast<dxt_hc*>(pContext);
-
- uint endpoint_a = hvq.get_alpha_endpoint(index_a);
- int endpoint_a_lo = dxt5_block::unpack_endpoint(endpoint_a, 0);
- int endpoint_a_hi = dxt5_block::unpack_endpoint(endpoint_a, 1);
-
- uint endpoint_b = hvq.get_alpha_endpoint(index_b);
- int endpoint_b_lo = dxt5_block::unpack_endpoint(endpoint_b, 0);
- int endpoint_b_hi = dxt5_block::unpack_endpoint(endpoint_b, 1);
-
- int total_error = math::square(endpoint_a_lo - endpoint_b_lo) + math::square(endpoint_a_hi - endpoint_b_hi);
-
- float weight = 1.0f - math::clamp(total_error * 1.0f/256.0f, 0.0f, 1.0f);
- return weight;
- }
-
- void crn_comp::sort_color_endpoint_codebook(crnlib::vector<uint>& remapping, const crnlib::vector<uint>& endpoints)
- {
- remapping.resize(endpoints.size());
-
- uint lowest_energy = UINT_MAX;
- uint lowest_energy_index = 0;
-
- for (uint i = 0; i < endpoints.size(); i++)
- {
- color_quad_u8 a(dxt1_block::unpack_color(static_cast<uint16>(endpoints[i] & 0xFFFF), true));
- color_quad_u8 b(dxt1_block::unpack_color(static_cast<uint16>((endpoints[i] >> 16) & 0xFFFF), true));
-
- uint total = a.r + a.g + a.b + b.r + b.g + b.b;
-
- if (total < lowest_energy)
- {
- lowest_energy = total;
- lowest_energy_index = i;
- }
- }
-
- uint cur_index = lowest_energy_index;
-
- crnlib::vector<bool> chosen_flags(endpoints.size());
-
- uint n = 0;
- for ( ; ; )
- {
- chosen_flags[cur_index] = true;
-
- remapping[cur_index] = n;
- n++;
- if (n == endpoints.size())
- break;
-
- uint lowest_error = UINT_MAX;
- uint lowest_error_index = 0;
-
- color_quad_u8 a(dxt1_block::unpack_endpoint(endpoints[cur_index], 0, true));
- color_quad_u8 b(dxt1_block::unpack_endpoint(endpoints[cur_index], 1, true));
-
- for (uint i = 0; i < endpoints.size(); i++)
- {
- if (chosen_flags[i])
- continue;
-
- color_quad_u8 c(dxt1_block::unpack_endpoint(endpoints[i], 0, true));
- color_quad_u8 d(dxt1_block::unpack_endpoint(endpoints[i], 1, true));
-
- uint total = color::elucidian_distance(a, c, false) + color::elucidian_distance(b, d, false);
-
- if (total < lowest_error)
- {
- lowest_error = total;
- lowest_error_index = i;
- }
- }
-
- cur_index = lowest_error_index;
- }
- }
-
- void crn_comp::sort_alpha_endpoint_codebook(crnlib::vector<uint>& remapping, const crnlib::vector<uint>& endpoints)
- {
- remapping.resize(endpoints.size());
-
- uint lowest_energy = UINT_MAX;
- uint lowest_energy_index = 0;
-
- for (uint i = 0; i < endpoints.size(); i++)
- {
- uint a = dxt5_block::unpack_endpoint(endpoints[i], 0);
- uint b = dxt5_block::unpack_endpoint(endpoints[i], 1);
-
- uint total = a + b;
-
- if (total < lowest_energy)
- {
- lowest_energy = total;
- lowest_energy_index = i;
- }
- }
-
- uint cur_index = lowest_energy_index;
-
- crnlib::vector<bool> chosen_flags(endpoints.size());
-
- uint n = 0;
- for ( ; ; )
- {
- chosen_flags[cur_index] = true;
-
- remapping[cur_index] = n;
- n++;
- if (n == endpoints.size())
- break;
-
- uint lowest_error = UINT_MAX;
- uint lowest_error_index = 0;
-
- const int a = dxt5_block::unpack_endpoint(endpoints[cur_index], 0);
- const int b = dxt5_block::unpack_endpoint(endpoints[cur_index], 1);
-
- for (uint i = 0; i < endpoints.size(); i++)
- {
- if (chosen_flags[i])
- continue;
-
- const int c = dxt5_block::unpack_endpoint(endpoints[i], 0);
- const int d = dxt5_block::unpack_endpoint(endpoints[i], 1);
-
- uint total = math::square(a - c) + math::square(b - d);
-
- if (total < lowest_error)
- {
- lowest_error = total;
- lowest_error_index = i;
- }
- }
-
- cur_index = lowest_error_index;
- }
- }
-
- // The indices are only used for statistical purposes.
- bool crn_comp::pack_color_endpoints(
- crnlib::vector<uint8>& data,
- const crnlib::vector<uint>& remapping,
- const crnlib::vector<uint>& endpoint_indices,
- uint trial_index)
- {
- trial_index;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("pack_color_endpoints: %u", trial_index);
-#endif
-
- crnlib::vector<uint> remapped_endpoints(m_hvq.get_color_endpoint_codebook_size());
-
- for (uint i = 0; i < m_hvq.get_color_endpoint_codebook_size(); i++)
- remapped_endpoints[remapping[i]] = m_hvq.get_color_endpoint(i);
-
- const uint component_limits[6] = { 31, 63, 31, 31, 63, 31 };
-
- symbol_histogram hist[2];
- hist[0].resize(32);
- hist[1].resize(64);
-
-#if CRNLIB_CREATE_DEBUG_IMAGES
- image_u8 endpoint_image(2, m_hvq.get_color_endpoint_codebook_size());
- image_u8 endpoint_residual_image(2, m_hvq.get_color_endpoint_codebook_size());
-#endif
-
- crnlib::vector<uint> residual_syms;
- residual_syms.reserve(m_hvq.get_color_endpoint_codebook_size()*2*3);
-
- color_quad_u8 prev[2];
- prev[0].clear();
- prev[1].clear();
-
- int total_residuals = 0;
-
- for (uint endpoint_index = 0; endpoint_index < m_hvq.get_color_endpoint_codebook_size(); endpoint_index++)
- {
- const uint endpoint = remapped_endpoints[endpoint_index];
-
- color_quad_u8 cur[2];
- cur[0] = dxt1_block::unpack_color((uint16)(endpoint & 0xFFFF), false);
- cur[1] = dxt1_block::unpack_color((uint16)((endpoint >> 16) & 0xFFFF), false);
-
-#if CRNLIB_CREATE_DEBUG_IMAGES
- endpoint_image(0, endpoint_index) = dxt1_block::unpack_color((uint16)(endpoint & 0xFFFF), true);
- endpoint_image(1, endpoint_index) = dxt1_block::unpack_color((uint16)((endpoint >> 16) & 0xFFFF), true);
-#endif
-
- for (uint j = 0; j < 2; j++)
- {
- for (uint k = 0; k < 3; k++)
- {
- int delta = cur[j][k] - prev[j][k];
- total_residuals += delta*delta;
-
- int sym = delta & component_limits[j*3+k];
- int table = (k == 1) ? 1 : 0;
-
- hist[table].inc_freq(sym);
-
- residual_syms.push_back(sym);
-
-#if CRNLIB_CREATE_DEBUG_IMAGES
- endpoint_residual_image(j, endpoint_index)[k] = static_cast<uint8>(sym);
-#endif
- }
- }
-
- prev[0] = cur[0];
- prev[1] = cur[1];
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Total endpoint residuals: %i", total_residuals);
-#endif
-
- if (endpoint_indices.size() > 1)
- {
- uint prev_index = remapping[endpoint_indices[0]];
- int64 total_delta = 0;
- for (uint i = 1; i < endpoint_indices.size(); i++)
- {
- uint cur_index = remapping[endpoint_indices[i]];
- int delta = cur_index - prev_index;
- prev_index = cur_index;
- total_delta += delta * delta;
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Total endpoint index delta: " CRNLIB_INT64_FORMAT_SPECIFIER, total_delta);
-#endif
- }
-
-#if CRNLIB_CREATE_DEBUG_IMAGES
- image_utils::write_to_file(dynamic_string(cVarArg, "color_endpoint_residuals_%u.tga", trial_index).get_ptr(), endpoint_residual_image);
- image_utils::write_to_file(dynamic_string(cVarArg, "color_endpoints_%u.tga", trial_index).get_ptr(), endpoint_image);
-#endif
-
- static_huffman_data_model residual_dm[2];
-
- symbol_codec codec;
- codec.start_encoding(1024*1024);
-
- // Transmit residuals
- for (uint i = 0; i < 2; i++)
- {
- if (!residual_dm[i].init(true, hist[i], 15))
- return false;
-
- if (!codec.encode_transmit_static_huffman_data_model(residual_dm[i], false))
- return false;
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Wrote %u bits for color endpoint residual Huffman tables", codec.encode_get_total_bits_written());
-#endif
-
- uint start_bits = codec.encode_get_total_bits_written();
- start_bits;
-
- for (uint i = 0; i < residual_syms.size(); i++)
- {
- const uint sym = residual_syms[i];
- const uint table = ((i % 3) == 1) ? 1 : 0;
- codec.encode(sym, residual_dm[table]);
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Wrote %u bits for color endpoint residuals", codec.encode_get_total_bits_written() - start_bits);
-#endif
-
- codec.stop_encoding(false);
-
- data.swap(codec.get_encoding_buf());
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- {
- console::debug("Wrote a total of %u bits for color endpoint codebook", codec.encode_get_total_bits_written());
-
- console::debug("Wrote %f bits per each color endpoint", data.size() * 8.0f / m_hvq.get_color_endpoint_codebook_size());
- }
-#endif
-
- return true;
- }
-
- // The indices are only used for statistical purposes.
- bool crn_comp::pack_alpha_endpoints(
- crnlib::vector<uint8>& data,
- const crnlib::vector<uint>& remapping,
- const crnlib::vector<uint>& endpoint_indices,
- uint trial_index)
- {
- trial_index;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("pack_alpha_endpoints: %u", trial_index);
-#endif
-
- crnlib::vector<uint> remapped_endpoints(m_hvq.get_alpha_endpoint_codebook_size());
-
- for (uint i = 0; i < m_hvq.get_alpha_endpoint_codebook_size(); i++)
- remapped_endpoints[remapping[i]] = m_hvq.get_alpha_endpoint(i);
-
- symbol_histogram hist;
- hist.resize(256);
-
-#if CRNLIB_CREATE_DEBUG_IMAGES
- image_u8 endpoint_image(2, m_hvq.get_alpha_endpoint_codebook_size());
- image_u8 endpoint_residual_image(2, m_hvq.get_alpha_endpoint_codebook_size());
-#endif
-
- crnlib::vector<uint> residual_syms;
- residual_syms.reserve(m_hvq.get_alpha_endpoint_codebook_size()*2*3);
-
- uint prev[2];
- utils::zero_object(prev);
-
- int total_residuals = 0;
-
- for (uint endpoint_index = 0; endpoint_index < m_hvq.get_alpha_endpoint_codebook_size(); endpoint_index++)
- {
- const uint endpoint = remapped_endpoints[endpoint_index];
-
- uint cur[2];
- cur[0] = dxt5_block::unpack_endpoint(endpoint, 0);
- cur[1] = dxt5_block::unpack_endpoint(endpoint, 1);
-
-#if CRNLIB_CREATE_DEBUG_IMAGES
- endpoint_image(0, endpoint_index) = cur[0];
- endpoint_image(1, endpoint_index) = cur[1];
-#endif
-
- for (uint j = 0; j < 2; j++)
- {
- int delta = cur[j] - prev[j];
- total_residuals += delta*delta;
-
- int sym = delta & 255;
-
- hist.inc_freq(sym);
-
- residual_syms.push_back(sym);
-
-#if CRNLIB_CREATE_DEBUG_IMAGES
- endpoint_residual_image(j, endpoint_index) = static_cast<uint8>(sym);
-#endif
- }
-
- prev[0] = cur[0];
- prev[1] = cur[1];
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Total endpoint residuals: %i", total_residuals);
-#endif
-
- if (endpoint_indices.size() > 1)
- {
- uint prev_index = remapping[endpoint_indices[0]];
- int64 total_delta = 0;
- for (uint i = 1; i < endpoint_indices.size(); i++)
- {
- uint cur_index = remapping[endpoint_indices[i]];
- int delta = cur_index - prev_index;
- prev_index = cur_index;
- total_delta += delta * delta;
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Total endpoint index delta: " CRNLIB_INT64_FORMAT_SPECIFIER, total_delta);
-#endif
- }
-
-#if CRNLIB_CREATE_DEBUG_IMAGES
- image_utils::write_to_file(dynamic_string(cVarArg, "alpha_endpoint_residuals_%u.tga", trial_index).get_ptr(), endpoint_residual_image);
- image_utils::write_to_file(dynamic_string(cVarArg, "alpha_endpoints_%u.tga", trial_index).get_ptr(), endpoint_image);
-#endif
-
- static_huffman_data_model residual_dm;
-
- symbol_codec codec;
- codec.start_encoding(1024*1024);
-
- // Transmit residuals
- if (!residual_dm.init(true, hist, 15))
- return false;
-
- if (!codec.encode_transmit_static_huffman_data_model(residual_dm, false))
- return false;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Wrote %u bits for alpha endpoint residual Huffman tables", codec.encode_get_total_bits_written());
-#endif
-
- uint start_bits = codec.encode_get_total_bits_written();
- start_bits;
-
- for (uint i = 0; i < residual_syms.size(); i++)
- {
- const uint sym = residual_syms[i];
- codec.encode(sym, residual_dm);
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Wrote %u bits for alpha endpoint residuals", codec.encode_get_total_bits_written() - start_bits);
-#endif
-
- codec.stop_encoding(false);
-
- data.swap(codec.get_encoding_buf());
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- {
- console::debug("Wrote a total of %u bits for alpha endpoint codebook", codec.encode_get_total_bits_written());
-
- console::debug("Wrote %f bits per each alpha endpoint", data.size() * 8.0f / m_hvq.get_alpha_endpoint_codebook_size());
- }
-#endif
-
- return true;
- }
-
- float crn_comp::color_selector_similarity_func(uint index_a, uint index_b, void* pContext)
- {
- const crnlib::vector<dxt_hc::selectors>& selectors = *static_cast< const crnlib::vector<dxt_hc::selectors>* >(pContext);
-
- const dxt_hc::selectors& selectors_a = selectors[index_a];
- const dxt_hc::selectors& selectors_b = selectors[index_b];
-
- int total = 0;
- for (uint i = 0; i < 16; i++)
- {
- int a = g_dxt1_to_linear[selectors_a.get_by_index(i)];
- int b = g_dxt1_to_linear[selectors_b.get_by_index(i)];
-
- int delta = a - b;
- total += delta*delta;
- }
-
- float weight = 1.0f - math::clamp(total * 1.0f/20.0f, 0.0f, 1.0f);
- return weight;
- }
-
- float crn_comp::alpha_selector_similarity_func(uint index_a, uint index_b, void* pContext)
- {
- const crnlib::vector<dxt_hc::selectors>& selectors = *static_cast< const crnlib::vector<dxt_hc::selectors>* >(pContext);
-
- const dxt_hc::selectors& selectors_a = selectors[index_a];
- const dxt_hc::selectors& selectors_b = selectors[index_b];
-
- int total = 0;
- for (uint i = 0; i < 16; i++)
- {
- int a = g_dxt5_to_linear[selectors_a.get_by_index(i)];
- int b = g_dxt5_to_linear[selectors_b.get_by_index(i)];
-
- int delta = a - b;
- total += delta*delta;
- }
-
- float weight = 1.0f - math::clamp(total * 1.0f/100.0f, 0.0f, 1.0f);
- return weight;
- }
-
- void crn_comp::sort_selector_codebook(crnlib::vector<uint>& remapping, const crnlib::vector<dxt_hc::selectors>& selectors, const uint8* pTo_linear)
- {
- remapping.resize(selectors.size());
-
- uint lowest_energy = UINT_MAX;
- uint lowest_energy_index = 0;
-
- for (uint i = 0; i < selectors.size(); i++)
- {
- uint total = 0;
- for (uint j = 0; j < 16; j++)
- {
- int a = pTo_linear[selectors[i].get_by_index(j)];
-
- total += a*a;
- }
-
- if (total < lowest_energy)
- {
- lowest_energy = total;
- lowest_energy_index = i;
- }
- }
-
- uint cur_index = lowest_energy_index;
-
- crnlib::vector<bool> chosen_flags(selectors.size());
-
- uint n = 0;
- for ( ; ; )
- {
- chosen_flags[cur_index] = true;
-
- remapping[cur_index] = n;
- n++;
- if (n == selectors.size())
- break;
-
- uint lowest_error = UINT_MAX;
- uint lowest_error_index = 0;
-
- for (uint i = 0; i < selectors.size(); i++)
- {
- if (chosen_flags[i])
- continue;
-
- uint total = 0;
- for (uint j = 0; j < 16; j++)
- {
- int a = pTo_linear[selectors[cur_index].get_by_index(j)];
- int b = pTo_linear[selectors[i].get_by_index(j)];
-
- int delta = a - b;
- total += delta*delta;
- }
-
- if (total < lowest_error)
- {
- lowest_error = total;
- lowest_error_index = i;
- }
- }
-
- cur_index = lowest_error_index;
- }
- }
-
- // The indices are only used for statistical purposes.
- bool crn_comp::pack_selectors(
- crnlib::vector<uint8>& packed_data,
- const crnlib::vector<uint>& selector_indices,
- const crnlib::vector<dxt_hc::selectors>& selectors,
- const crnlib::vector<uint>& remapping,
- uint max_selector_value,
- const uint8* pTo_linear,
- uint trial_index)
- {
- trial_index;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("pack_selectors: %u", trial_index);
-#endif
-
- crnlib::vector<dxt_hc::selectors> remapped_selectors(selectors.size());
-
- for (uint i = 0; i < selectors.size(); i++)
- remapped_selectors[remapping[i]] = selectors[i];
-
-#if CRNLIB_CREATE_DEBUG_IMAGES
- image_u8 residual_image(16, selectors.size());;
- image_u8 selector_image(16, selectors.size());;
-#endif
-
- crnlib::vector<uint> residual_syms;
- residual_syms.reserve(selectors.size() * 8);
-
- const uint num_baised_selector_values = (max_selector_value * 2 + 1);
- symbol_histogram hist(num_baised_selector_values * num_baised_selector_values);
-
- dxt_hc::selectors prev_selectors;
- utils::zero_object(prev_selectors);
- int total_residuals = 0;
- for (uint selector_index = 0; selector_index < selectors.size(); selector_index++)
- {
- const dxt_hc::selectors& s = remapped_selectors[selector_index];
-
- uint prev_sym = 0;
- for (uint i = 0; i < 16; i++)
- {
- int p = pTo_linear[crnlib_assert_range_incl<uint>(prev_selectors.get_by_index(i), max_selector_value)];
-
- int r = pTo_linear[crnlib_assert_range_incl<uint>(s.get_by_index(i), max_selector_value)] - p;
-
- total_residuals += r*r;
-
- uint sym = r + max_selector_value;
-
- CRNLIB_ASSERT(sym < num_baised_selector_values);
- if (i & 1)
- {
- uint paired_sym = (sym * num_baised_selector_values) + prev_sym;
- residual_syms.push_back(paired_sym);
- hist.inc_freq(paired_sym);
- }
- else
- prev_sym = sym;
-
-#if CRNLIB_CREATE_DEBUG_IMAGES
- selector_image(i, selector_index) = (pTo_linear[crnlib_assert_range_incl<uint>(s.get_by_index(i), max_selector_value)] * 255) / max_selector_value;
- residual_image(i, selector_index) = sym;
-#endif
- }
-
- prev_selectors = s;
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Total selector endpoint residuals: %u", total_residuals);
-#endif
-
- if (selector_indices.size() > 1)
- {
- uint prev_index = remapping[selector_indices[1]];
- int64 total_delta = 0;
- for (uint i = 1; i < selector_indices.size(); i++)
- {
- uint cur_index = remapping[selector_indices[i]];
- int delta = cur_index - prev_index;
- prev_index = cur_index;
- total_delta += delta * delta;
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Total selector index delta: " CRNLIB_INT64_FORMAT_SPECIFIER, total_delta);
-#endif
- }
-
-#if CRNLIB_CREATE_DEBUG_IMAGES
- image_utils::write_to_file(dynamic_string(cVarArg, "selectors_%u_%u.tga", trial_index, max_selector_value).get_ptr(), selector_image);
- image_utils::write_to_file(dynamic_string(cVarArg, "selector_residuals_%u_%u.tga", trial_index, max_selector_value).get_ptr(), residual_image);
-#endif
-
- static_huffman_data_model residual_dm;
-
- symbol_codec codec;
- codec.start_encoding(1024*1024);
-
- // Transmit residuals
- if (!residual_dm.init(true, hist, 15))
- return false;
-
- if (!codec.encode_transmit_static_huffman_data_model(residual_dm, false))
- return false;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Wrote %u bits for selector residual Huffman tables", codec.encode_get_total_bits_written());
-#endif
-
- uint start_bits = codec.encode_get_total_bits_written();
- start_bits;
-
- for (uint i = 0; i < residual_syms.size(); i++)
- {
- const uint sym = residual_syms[i];
- codec.encode(sym, residual_dm);
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Wrote %u bits for selector residuals", codec.encode_get_total_bits_written() - start_bits);
-#endif
-
- codec.stop_encoding(false);
-
- packed_data.swap(codec.get_encoding_buf());
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- {
- console::debug("Wrote a total of %u bits for selector codebook", codec.encode_get_total_bits_written());
-
- console::debug("Wrote %f bits per each selector codebook entry", packed_data.size() * 8.0f / selectors.size());
- }
-#endif
-
- return true;
- }
-
- bool crn_comp::pack_chunks(
- uint first_chunk, uint num_chunks,
- bool clear_histograms,
- symbol_codec* pCodec,
- const crnlib::vector<uint>* pColor_endpoint_remap,
- const crnlib::vector<uint>* pColor_selector_remap,
- const crnlib::vector<uint>* pAlpha_endpoint_remap,
- const crnlib::vector<uint>* pAlpha_selector_remap)
- {
- if (!pCodec)
- {
- m_chunk_encoding_hist.resize(1 << (3 * cEncodingMapNumChunksPerCode));
- if (clear_histograms)
- m_chunk_encoding_hist.set_all(0);
-
- if (pColor_endpoint_remap)
- {
- CRNLIB_ASSERT(pColor_endpoint_remap->size() == m_hvq.get_color_endpoint_codebook_size());
- m_endpoint_index_hist[0].resize(pColor_endpoint_remap->size());
- if (clear_histograms)
- m_endpoint_index_hist[0].set_all(0);
- }
-
- if (pColor_selector_remap)
- {
- CRNLIB_ASSERT(pColor_selector_remap->size() == m_hvq.get_color_selector_codebook_size());
- m_selector_index_hist[0].resize(pColor_selector_remap->size());
- if (clear_histograms)
- m_selector_index_hist[0].set_all(0);
- }
-
- if (pAlpha_endpoint_remap)
- {
- CRNLIB_ASSERT(pAlpha_endpoint_remap->size() == m_hvq.get_alpha_endpoint_codebook_size());
- m_endpoint_index_hist[1].resize(pAlpha_endpoint_remap->size());
- if (clear_histograms)
- m_endpoint_index_hist[1].set_all(0);
- }
-
- if (pAlpha_selector_remap)
- {
- CRNLIB_ASSERT(pAlpha_selector_remap->size() == m_hvq.get_alpha_selector_codebook_size());
- m_selector_index_hist[1].resize(pAlpha_selector_remap->size());
- if (clear_histograms)
- m_selector_index_hist[1].set_all(0);
- }
- }
-
- uint prev_endpoint_index[cNumComps];
- utils::zero_object(prev_endpoint_index);
-
- uint prev_selector_index[cNumComps];
- utils::zero_object(prev_selector_index);
-
- uint num_encodings_left = 0;
-
- for (uint chunk_index = first_chunk; chunk_index < (first_chunk + num_chunks); chunk_index++)
- {
- if (!num_encodings_left)
- {
- uint index = 0;
- for (uint i = 0; i < cEncodingMapNumChunksPerCode; i++)
- if ((chunk_index + i) < (first_chunk + num_chunks))
- index |= (m_hvq.get_chunk_encoding(chunk_index + i).m_encoding_index << (i * 3));
-
- if (pCodec)
- pCodec->encode(index, m_chunk_encoding_dm);
- else
- m_chunk_encoding_hist.inc_freq(index);
-
- num_encodings_left = cEncodingMapNumChunksPerCode;
- }
- num_encodings_left--;
-
- const dxt_hc::chunk_encoding& encoding = m_hvq.get_chunk_encoding(chunk_index);
- const chunk_detail& details = m_chunk_details[chunk_index];
-
- const uint comp_order[3] = { cAlpha0, cAlpha1, cColor };
- for (uint c = 0; c < 3; c++)
- {
- const uint comp_index = comp_order[c];
- if (!m_has_comp[comp_index])
- continue;
-
- // endpoints
- if (comp_index == cColor)
- {
- if (pColor_endpoint_remap)
- {
- for (uint i = 0; i < encoding.m_num_tiles; i++)
- {
- uint cur_endpoint_index = (*pColor_endpoint_remap)[ m_endpoint_indices[cColor][details.m_first_endpoint_index + i] ];
- int endpoint_delta = cur_endpoint_index - prev_endpoint_index[cColor];
-
- int sym = endpoint_delta;
- if (sym < 0)
- sym += pColor_endpoint_remap->size();
-
- CRNLIB_ASSERT(sym >= 0 && sym < (int)pColor_endpoint_remap->size());
-
- if (!pCodec)
- m_endpoint_index_hist[cColor].inc_freq(sym);
- else
- pCodec->encode(sym, m_endpoint_index_dm[0]);
-
- prev_endpoint_index[cColor] = cur_endpoint_index;
- }
- }
- }
- else
- {
- if (pAlpha_endpoint_remap)
- {
- for (uint i = 0; i < encoding.m_num_tiles; i++)
- {
- uint cur_endpoint_index = (*pAlpha_endpoint_remap)[m_endpoint_indices[comp_index][details.m_first_endpoint_index + i]];
- int endpoint_delta = cur_endpoint_index - prev_endpoint_index[comp_index];
-
- int sym = endpoint_delta;
- if (sym < 0)
- sym += pAlpha_endpoint_remap->size();
-
- CRNLIB_ASSERT(sym >= 0 && sym < (int)pAlpha_endpoint_remap->size());
-
- if (!pCodec)
- m_endpoint_index_hist[1].inc_freq(sym);
- else
- pCodec->encode(sym, m_endpoint_index_dm[1]);
-
- prev_endpoint_index[comp_index] = cur_endpoint_index;
- }
- }
- }
- } // c
-
- // selectors
- for (uint y = 0; y < 2; y++)
- {
- for (uint x = 0; x < 2; x++)
- {
- for (uint c = 0; c < 3; c++)
- {
- const uint comp_index = comp_order[c];
- if (!m_has_comp[comp_index])
- continue;
-
- if (comp_index == cColor)
- {
- if (pColor_selector_remap)
- {
- uint cur_selector_index = (*pColor_selector_remap)[ m_selector_indices[cColor][details.m_first_selector_index + x + y * 2] ];
- int selector_delta = cur_selector_index - prev_selector_index[cColor];
-
- int sym = selector_delta;
- if (sym < 0)
- sym += pColor_selector_remap->size();
-
- CRNLIB_ASSERT(sym >= 0 && sym < (int)pColor_selector_remap->size());
-
- if (!pCodec)
- m_selector_index_hist[cColor].inc_freq(sym);
- else
- pCodec->encode(sym, m_selector_index_dm[cColor]);
-
- prev_selector_index[cColor] = cur_selector_index;
- }
- }
- else if (pAlpha_selector_remap)
- {
- uint cur_selector_index = (*pAlpha_selector_remap)[ m_selector_indices[comp_index][details.m_first_selector_index + x + y * 2] ];
- int selector_delta = cur_selector_index - prev_selector_index[comp_index];
-
- int sym = selector_delta;
- if (sym < 0)
- sym += pAlpha_selector_remap->size();
-
- CRNLIB_ASSERT(sym >= 0 && sym < (int)pAlpha_selector_remap->size());
-
- if (!pCodec)
- m_selector_index_hist[1].inc_freq(sym);
- else
- pCodec->encode(sym, m_selector_index_dm[1]);
-
- prev_selector_index[comp_index] = cur_selector_index;
- }
-
- } // c
-
- } // x
- } // y
-
- } // chunk_index
-
- return true;
- }
-
- bool crn_comp::pack_chunks_simulation(
- uint first_chunk, uint num_chunks,
- uint& total_bits,
- const crnlib::vector<uint>* pColor_endpoint_remap,
- const crnlib::vector<uint>* pColor_selector_remap,
- const crnlib::vector<uint>* pAlpha_endpoint_remap,
- const crnlib::vector<uint>* pAlpha_selector_remap)
- {
- if (!pack_chunks(first_chunk, num_chunks, true, NULL, pColor_endpoint_remap, pColor_selector_remap, pAlpha_endpoint_remap, pAlpha_selector_remap))
- return false;
-
- symbol_codec codec;
- codec.start_encoding(2*1024*1024);
- codec.encode_enable_simulation(true);
-
- m_chunk_encoding_dm.init(true, m_chunk_encoding_hist, 16);
-
- for (uint i = 0; i < 2; i++)
- {
- if (m_endpoint_index_hist[i].size())
- {
- m_endpoint_index_dm[i].init(true, m_endpoint_index_hist[i], 16);
-
- codec.encode_transmit_static_huffman_data_model(m_endpoint_index_dm[i], false);
- }
-
- if (m_selector_index_hist[i].size())
- {
- m_selector_index_dm[i].init(true, m_selector_index_hist[i], 16);
-
- codec.encode_transmit_static_huffman_data_model(m_selector_index_dm[i], false);
- }
- }
-
- if (!pack_chunks(first_chunk, num_chunks, false, &codec, pColor_endpoint_remap, pColor_selector_remap, pAlpha_endpoint_remap, pAlpha_selector_remap))
- return false;
-
- codec.stop_encoding(false);
-
- total_bits = codec.encode_get_total_bits_written();
-
- return true;
- }
-
- void crn_comp::append_vec(crnlib::vector<uint8>& a, const void* p, uint size)
- {
- if (size)
- {
- uint ofs = a.size();
- a.resize(ofs + size);
-
- memcpy(&a[ofs], p, size);
- }
- }
-
- void crn_comp::append_vec(crnlib::vector<uint8>& a, const crnlib::vector<uint8>& b)
- {
- if (!b.empty())
- {
- uint ofs = a.size();
- a.resize(ofs + b.size());
-
- memcpy(&a[ofs], &b[0], b.size());
- }
- }
-
-#if 0
- bool crn_comp::init_chunk_encoding_dm()
- {
- symbol_histogram hist(1 << (3 * cEncodingMapNumChunksPerCode));
-
- for (uint chunk_index = 0; chunk_index < m_hvq.get_num_chunks(); chunk_index += cEncodingMapNumChunksPerCode)
- {
- uint index = 0;
- for (uint i = 0; i < cEncodingMapNumChunksPerCode; i++)
- {
- if ((chunk_index + i) >= m_hvq.get_num_chunks())
- break;
- const dxt_hc::chunk_encoding& encoding = m_hvq.get_chunk_encoding(chunk_index + i);
-
- index |= (encoding.m_encoding_index << (i * 3));
- }
-
- hist.inc_freq(index);
- }
-
- if (!m_chunk_encoding_dm.init(true, hist, 16))
- return false;
-
- return true;
- }
-#endif
-
- bool crn_comp::alias_images()
- {
- for (uint face_index = 0; face_index < m_pParams->m_faces; face_index++)
- {
- for (uint level_index = 0; level_index < m_pParams->m_levels; level_index++)
- {
- const uint width = math::maximum(1U, m_pParams->m_width >> level_index);
- const uint height = math::maximum(1U, m_pParams->m_height >> level_index);
-
- if (!m_pParams->m_pImages[face_index][level_index])
- return false;
-
- m_images[face_index][level_index].alias((color_quad_u8*)m_pParams->m_pImages[face_index][level_index], width, height);
- }
- }
-
- image_utils::conversion_type conv_type = image_utils::get_image_conversion_type_from_crn_format((crn_format)m_pParams->m_format);
- if (conv_type != image_utils::cConversion_Invalid)
- {
- for (uint face_index = 0; face_index < m_pParams->m_faces; face_index++)
- {
- for (uint level_index = 0; level_index < m_pParams->m_levels; level_index++)
- {
- image_u8 cooked_image(m_images[face_index][level_index]);
-
- image_utils::convert_image(cooked_image, conv_type);
-
- m_images[face_index][level_index].swap(cooked_image);
- }
- }
- }
-
- m_mip_groups.clear();
- m_mip_groups.resize(m_pParams->m_levels);
-
- utils::zero_object(m_levels);
-
- uint mip_group = 0;
- uint chunk_index = 0;
- uint mip_group_chunk_index = 0; (void)mip_group_chunk_index;
- for (uint level_index = 0; level_index < m_pParams->m_levels; level_index++)
- {
- const uint width = math::maximum(1U, m_pParams->m_width >> level_index);
- const uint height = math::maximum(1U, m_pParams->m_height >> level_index);
- const uint chunk_width = math::align_up_value(width, cChunkPixelWidth) / cChunkPixelWidth;
- const uint chunk_height = math::align_up_value(height, cChunkPixelHeight) / cChunkPixelHeight;
- const uint num_chunks = m_pParams->m_faces * chunk_width * chunk_height;
-
- m_mip_groups[mip_group].m_first_chunk = chunk_index;
- mip_group_chunk_index = 0;
-
- m_mip_groups[mip_group].m_num_chunks += num_chunks;
-
- m_levels[level_index].m_width = width;
- m_levels[level_index].m_height = height;
- m_levels[level_index].m_chunk_width = chunk_width;
- m_levels[level_index].m_chunk_height = chunk_height;
- m_levels[level_index].m_first_chunk = chunk_index;
- m_levels[level_index].m_num_chunks = num_chunks;
- m_levels[level_index].m_group_index = mip_group;
- m_levels[level_index].m_group_first_chunk = 0;
-
- chunk_index += num_chunks;
-
- mip_group++;
- }
-
- m_total_chunks = chunk_index;
-
- return true;
- }
-
- void crn_comp::append_chunks(const image_u8& img, uint num_chunks_x, uint num_chunks_y, dxt_hc::pixel_chunk_vec& chunks, float weight)
- {
- for (uint y = 0; y < num_chunks_y; y++)
- {
- int x_start = 0;
- int x_end = num_chunks_x;
- int x_dir = 1;
- if (y & 1)
- {
- x_start = num_chunks_x - 1;
- x_end = -1;
- x_dir = -1;
- }
-
- for (int x = x_start; x != x_end; x += x_dir)
- {
- chunks.resize(chunks.size() + 1);
-
- dxt_hc::pixel_chunk& chunk = chunks.back();
- chunk.m_weight = weight;
-
- for (uint cy = 0; cy < cChunkPixelHeight; cy++)
- {
- uint py = y * cChunkPixelHeight + cy;
- py = math::minimum(py, img.get_height() - 1);
-
- for (uint cx = 0; cx < cChunkPixelWidth; cx++)
- {
- uint px = x * cChunkPixelWidth + cx;
- px = math::minimum(px, img.get_width() - 1);
-
- chunk(cx, cy) = img(px, py);
- }
- }
- }
- }
- }
-
- void crn_comp::create_chunks()
- {
- m_chunks.reserve(m_total_chunks);
- m_chunks.resize(0);
-
- for (uint level = 0; level < m_pParams->m_levels; level++)
- {
- for (uint face = 0; face < m_pParams->m_faces; face++)
- {
- if (!face)
- {
- CRNLIB_ASSERT(m_levels[level].m_first_chunk == m_chunks.size());
- }
-
- float mip_weight = math::minimum(12.0f, powf( 1.3f, static_cast<float>(level) ) );
- //float mip_weight = 1.0f;
-
- append_chunks(m_images[face][level], m_levels[level].m_chunk_width, m_levels[level].m_chunk_height, m_chunks, mip_weight);
- }
- }
-
- CRNLIB_ASSERT(m_chunks.size() == m_total_chunks);
- }
-
- void crn_comp::clear()
- {
- m_pParams = NULL;
-
- for (uint f = 0; f < cCRNMaxFaces; f++)
- for (uint l = 0; l < cCRNMaxLevels; l++)
- m_images[f][l].clear();
-
- utils::zero_object(m_levels);
-
- m_mip_groups.clear();
-
- utils::zero_object(m_has_comp);
-
- m_chunk_details.clear();
-
- for (uint i = 0; i < cNumComps; i++)
- {
- m_endpoint_indices[i].clear();
- m_selector_indices[i].clear();
- }
-
- m_total_chunks = 0;
-
- m_chunks.clear();
-
- utils::zero_object(m_crn_header);
-
- m_comp_data.clear();
-
- m_hvq.clear();
-
- m_chunk_encoding_hist.clear();
- m_chunk_encoding_dm.clear();
- for (uint i = 0; i < 2; i++)
- {
- m_endpoint_index_hist[i].clear();
- m_endpoint_index_dm[i].clear();
- m_selector_index_hist[i].clear();
- m_selector_index_dm[i].clear();
- }
-
- for (uint i = 0; i < cCRNMaxLevels; i++)
- m_packed_chunks[i].clear();
-
- m_packed_data_models.clear();
-
- m_packed_color_endpoints.clear();
- m_packed_color_selectors.clear();
- m_packed_alpha_endpoints.clear();
- m_packed_alpha_selectors.clear();
- }
-
- bool crn_comp::quantize_chunks()
- {
- dxt_hc::params params;
-
- params.m_adaptive_tile_alpha_psnr_derating = m_pParams->m_crn_adaptive_tile_alpha_psnr_derating;
- params.m_adaptive_tile_color_psnr_derating = m_pParams->m_crn_adaptive_tile_color_psnr_derating;
-
- if (m_pParams->m_flags & cCRNCompFlagManualPaletteSizes)
- {
- params.m_color_endpoint_codebook_size = math::clamp<int>(m_pParams->m_crn_color_endpoint_palette_size, cCRNMinPaletteSize, cCRNMaxPaletteSize);
- params.m_color_selector_codebook_size = math::clamp<int>(m_pParams->m_crn_color_selector_palette_size, cCRNMinPaletteSize, cCRNMaxPaletteSize);
- params.m_alpha_endpoint_codebook_size = math::clamp<int>(m_pParams->m_crn_alpha_endpoint_palette_size, cCRNMinPaletteSize, cCRNMaxPaletteSize);
- params.m_alpha_selector_codebook_size = math::clamp<int>(m_pParams->m_crn_alpha_selector_palette_size, cCRNMinPaletteSize, cCRNMaxPaletteSize);
- }
- else
- {
- uint max_codebook_entries = ((m_pParams->m_width + 3) / 4) * ((m_pParams->m_height + 3) / 4);
-
- max_codebook_entries = math::clamp<uint>(max_codebook_entries, cCRNMinPaletteSize, cCRNMaxPaletteSize);
-
- float quality = math::clamp<float>((float)m_pParams->m_quality_level / cCRNMaxQualityLevel, 0.0f, 1.0f);
- float color_quality_power_mul = 1.0f;
- float alpha_quality_power_mul = 1.0f;
- if (m_pParams->m_format == cCRNFmtDXT5_CCxY)
- {
- color_quality_power_mul = 3.5f;
- alpha_quality_power_mul = .35f;
- params.m_adaptive_tile_color_psnr_derating = 5.0f;
- }
- else if (m_pParams->m_format == cCRNFmtDXT5)
- color_quality_power_mul = .75f;
-
- float color_endpoint_quality = powf(quality, 1.8f * color_quality_power_mul);
- float color_selector_quality = powf(quality, 1.65f * color_quality_power_mul);
- params.m_color_endpoint_codebook_size = math::clamp<uint>(math::float_to_uint(.5f + math::lerp<float>(math::maximum<float>(64, cCRNMinPaletteSize), (float)max_codebook_entries, color_endpoint_quality)), cCRNMinPaletteSize, cCRNMaxPaletteSize);
- params.m_color_selector_codebook_size = math::clamp<uint>(math::float_to_uint(.5f + math::lerp<float>(math::maximum<float>(96, cCRNMinPaletteSize), (float)max_codebook_entries, color_selector_quality)), cCRNMinPaletteSize, cCRNMaxPaletteSize);
-
- float alpha_endpoint_quality = powf(quality, 2.1f * alpha_quality_power_mul);
- float alpha_selector_quality = powf(quality, 1.65f * alpha_quality_power_mul);
- params.m_alpha_endpoint_codebook_size = math::clamp<uint>(math::float_to_uint(.5f + math::lerp<float>(math::maximum<float>(24, cCRNMinPaletteSize), (float)max_codebook_entries, alpha_endpoint_quality)), cCRNMinPaletteSize, cCRNMaxPaletteSize);;
- params.m_alpha_selector_codebook_size = math::clamp<uint>(math::float_to_uint(.5f + math::lerp<float>(math::maximum<float>(48, cCRNMinPaletteSize), (float)max_codebook_entries, alpha_selector_quality)), cCRNMinPaletteSize, cCRNMaxPaletteSize);;
- }
-
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- {
- console::debug("Color endpoints: %u", params.m_color_endpoint_codebook_size);
- console::debug("Color selectors: %u", params.m_color_selector_codebook_size);
- console::debug("Alpha endpoints: %u", params.m_alpha_endpoint_codebook_size);
- console::debug("Alpha selectors: %u", params.m_alpha_selector_codebook_size);
- }
-
- params.m_hierarchical = (m_pParams->m_flags & cCRNCompFlagHierarchical) != 0;
- params.m_perceptual = (m_pParams->m_flags & cCRNCompFlagPerceptual) != 0;
-
- params.m_pProgress_func = m_pParams->m_pProgress_func;
- params.m_pProgress_func_data = m_pParams->m_pProgress_func_data;
-
- switch (m_pParams->m_format)
- {
- case cCRNFmtDXT1:
- {
- params.m_format = cDXT1;
- m_has_comp[cColor] = true;
- break;
- }
- case cCRNFmtDXT3:
- {
- m_has_comp[cAlpha0] = true;
- return false;
- }
- case cCRNFmtDXT5:
- {
- params.m_format = cDXT5;
- params.m_alpha_component_indices[0] = m_pParams->m_alpha_component;
- m_has_comp[cColor] = true;
- m_has_comp[cAlpha0] = true;
- break;
- }
- case cCRNFmtDXT5_CCxY:
- {
- params.m_format = cDXT5;
- params.m_alpha_component_indices[0] = 3;
- m_has_comp[cColor] = true;
- m_has_comp[cAlpha0] = true;
- params.m_perceptual = false;
-
- //params.m_adaptive_tile_color_alpha_weighting_ratio = 1.0f;
- params.m_adaptive_tile_color_alpha_weighting_ratio = 1.5f;
- break;
- }
- case cCRNFmtDXT5_xGBR:
- case cCRNFmtDXT5_AGBR:
- case cCRNFmtDXT5_xGxR:
- {
- params.m_format = cDXT5;
- params.m_alpha_component_indices[0] = 3;
- m_has_comp[cColor] = true;
- m_has_comp[cAlpha0] = true;
- params.m_perceptual = false;
- break;
- }
- case cCRNFmtDXN_XY:
- {
- params.m_format = cDXN_XY;
- params.m_alpha_component_indices[0] = 0;
- params.m_alpha_component_indices[1] = 1;
- m_has_comp[cAlpha0] = true;
- m_has_comp[cAlpha1] = true;
- params.m_perceptual = false;
- break;
- }
- case cCRNFmtDXN_YX:
- {
- params.m_format = cDXN_YX;
- params.m_alpha_component_indices[0] = 1;
- params.m_alpha_component_indices[1] = 0;
- m_has_comp[cAlpha0] = true;
- m_has_comp[cAlpha1] = true;
- params.m_perceptual = false;
- break;
- }
- case cCRNFmtDXT5A:
- {
- params.m_format = cDXT5A;
- params.m_alpha_component_indices[0] = m_pParams->m_alpha_component;
- m_has_comp[cAlpha0] = true;
- params.m_perceptual = false;
- break;
- }
- case cCRNFmtETC1:
- {
- console::warning("crn_comp::quantize_chunks: This class does not support ETC1");
- return false;
- }
- default:
- {
- return false;
- }
- }
- params.m_debugging = (m_pParams->m_flags & cCRNCompFlagDebugging) != 0;
-
- params.m_num_levels = m_pParams->m_levels;
- for (uint i = 0; i < m_pParams->m_levels; i++)
- {
- params.m_levels[i].m_first_chunk = m_levels[i].m_first_chunk;
- params.m_levels[i].m_num_chunks = m_levels[i].m_num_chunks;
- }
-
- if (!m_hvq.compress(params, m_total_chunks, &m_chunks[0], m_task_pool))
- return false;
-
-#if CRNLIB_CREATE_DEBUG_IMAGES
- if (params.m_debugging)
- {
- const dxt_hc::pixel_chunk_vec& pixel_chunks = m_hvq.get_compressed_chunk_pixels_final();
-
- image_u8 img;
- dxt_hc::create_debug_image_from_chunks((m_pParams->m_width+7)>>3, (m_pParams->m_height+7)>>3, pixel_chunks, &m_hvq.get_chunk_encoding_vec(), img, true, -1);
- image_utils::write_to_file("quantized_chunks.tga", img);
- }
-#endif
-
- return true;
- }
-
- void crn_comp::create_chunk_indices()
- {
- m_chunk_details.resize(m_total_chunks);
-
- for (uint i = 0; i < cNumComps; i++)
- {
- m_endpoint_indices[i].clear();
- m_selector_indices[i].clear();
- }
-
- for (uint chunk_index = 0; chunk_index < m_total_chunks; chunk_index++)
- {
- const dxt_hc::chunk_encoding& chunk_encoding = m_hvq.get_chunk_encoding(chunk_index);
-
- for (uint i = 0; i < cNumComps; i++)
- {
- if (m_has_comp[i])
- {
- m_chunk_details[chunk_index].m_first_endpoint_index = m_endpoint_indices[i].size();
- m_chunk_details[chunk_index].m_first_selector_index = m_selector_indices[i].size();
- break;
- }
- }
-
- for (uint i = 0; i < cNumComps; i++)
- {
- if (!m_has_comp[i])
- continue;
-
- for (uint tile_index = 0; tile_index < chunk_encoding.m_num_tiles; tile_index++)
- m_endpoint_indices[i].push_back(chunk_encoding.m_endpoint_indices[i][tile_index]);
-
- for (uint y = 0; y < cChunkBlockHeight; y++)
- for (uint x = 0; x < cChunkBlockWidth; x++)
- m_selector_indices[i].push_back(chunk_encoding.m_selector_indices[i][y][x]);
- }
- }
- }
-
- struct optimize_color_endpoint_codebook_params
- {
- crnlib::vector<uint>* m_pTrial_color_endpoint_remap;
- uint m_iter_index;
- uint m_max_iter_index;
- };
-
- void crn_comp::optimize_color_endpoint_codebook_task(uint64 data, void* pData_ptr)
- {
- data;
- optimize_color_endpoint_codebook_params* pParams = reinterpret_cast<optimize_color_endpoint_codebook_params*>(pData_ptr);
-
- if (pParams->m_iter_index == pParams->m_max_iter_index)
- {
- sort_color_endpoint_codebook(*pParams->m_pTrial_color_endpoint_remap, m_hvq.get_color_endpoint_vec());
- }
- else
- {
- float f = pParams->m_iter_index / static_cast<float>(pParams->m_max_iter_index - 1);
-
- create_zeng_reorder_table(
- m_hvq.get_color_endpoint_codebook_size(),
- m_endpoint_indices[cColor].size(),
- &m_endpoint_indices[cColor][0],
- *pParams->m_pTrial_color_endpoint_remap,
- pParams->m_iter_index ? color_endpoint_similarity_func : NULL,
- &m_hvq,
- f);
- }
-
- crnlib_delete(pParams);
- }
-
- bool crn_comp::optimize_color_endpoint_codebook(crnlib::vector<uint>& remapping)
- {
- if (m_pParams->m_flags & cCRNCompFlagQuick)
- {
- remapping.resize(m_hvq.get_color_endpoint_vec().size());
- for (uint i = 0; i < m_hvq.get_color_endpoint_vec().size(); i++)
- remapping[i] = i;
-
- if (!pack_color_endpoints(m_packed_color_endpoints, remapping, m_endpoint_indices[cColor], 0))
- return false;
-
- return true;
- }
-
- const uint cMaxEndpointRemapIters = 3;
-
- uint best_bits = UINT_MAX;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("----- Begin optimization of color endpoint codebook");
-#endif
-
- crnlib::vector<uint> trial_color_endpoint_remaps[cMaxEndpointRemapIters + 1];
-
- for (uint i = 0; i <= cMaxEndpointRemapIters; i++)
- {
- optimize_color_endpoint_codebook_params* pParams = crnlib_new<optimize_color_endpoint_codebook_params>();
- pParams->m_iter_index = i;
- pParams->m_max_iter_index = cMaxEndpointRemapIters;
- pParams->m_pTrial_color_endpoint_remap = &trial_color_endpoint_remaps[i];
-
- m_task_pool.queue_object_task(this, &crn_comp::optimize_color_endpoint_codebook_task, 0, pParams);
- }
-
- m_task_pool.join();
-
- for (uint i = 0; i <= cMaxEndpointRemapIters; i++)
- {
- if (!update_progress(20, i, cMaxEndpointRemapIters+1))
- return false;
-
- crnlib::vector<uint>& trial_color_endpoint_remap = trial_color_endpoint_remaps[i];
-
- crnlib::vector<uint8> packed_data;
- if (!pack_color_endpoints(packed_data, trial_color_endpoint_remap, m_endpoint_indices[cColor], i))
- return false;
-
- uint total_packed_chunk_bits;
- if (!pack_chunks_simulation(0, m_total_chunks, total_packed_chunk_bits, &trial_color_endpoint_remap, NULL, NULL, NULL))
- return false;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Pack chunks simulation: %u bits", total_packed_chunk_bits);
-#endif
-
- uint total_bits = packed_data.size() * 8 + total_packed_chunk_bits;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Total bits: %u", total_bits);
-#endif
-
- if (total_bits < best_bits)
- {
- m_packed_color_endpoints.swap(packed_data);
- remapping.swap(trial_color_endpoint_remap);
- best_bits = total_bits;
- }
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("End optimization of color endpoint codebook");
-#endif
-
- return true;
- }
-
- struct optimize_color_selector_codebook_params
- {
- crnlib::vector<uint>* m_pTrial_color_selector_remap;
- uint m_iter_index;
- uint m_max_iter_index;
- };
-
- void crn_comp::optimize_color_selector_codebook_task(uint64 data, void* pData_ptr)
- {
- data;
- optimize_color_selector_codebook_params* pParams = reinterpret_cast<optimize_color_selector_codebook_params*>(pData_ptr);
-
- if (pParams->m_iter_index == pParams->m_max_iter_index)
- {
- sort_selector_codebook(*pParams->m_pTrial_color_selector_remap, m_hvq.get_color_selectors_vec(), g_dxt1_to_linear);
- }
- else
- {
- float f = pParams->m_iter_index / static_cast<float>(pParams->m_max_iter_index - 1);
- create_zeng_reorder_table(
- m_hvq.get_color_selector_codebook_size(),
- m_selector_indices[cColor].size(),
- &m_selector_indices[cColor][0],
- *pParams->m_pTrial_color_selector_remap,
- pParams->m_iter_index ? color_selector_similarity_func : NULL,
- (void*)&m_hvq.get_color_selectors_vec(),
- f);
- }
-
- crnlib_delete(pParams);
- }
-
- bool crn_comp::optimize_color_selector_codebook(crnlib::vector<uint>& remapping)
- {
- if (m_pParams->m_flags & cCRNCompFlagQuick)
- {
- remapping.resize(m_hvq.get_color_selectors_vec().size());
- for (uint i = 0; i < m_hvq.get_color_selectors_vec().size(); i++)
- remapping[i] = i;
-
- if (!pack_selectors(
- m_packed_color_selectors,
- m_selector_indices[cColor],
- m_hvq.get_color_selectors_vec(),
- remapping,
- 3,
- g_dxt1_to_linear, 0))
- {
- return false;
- }
-
- return true;
- }
-
- const uint cMaxSelectorRemapIters = 3;
-
- uint best_bits = UINT_MAX;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("----- Begin optimization of color selector codebook");
-#endif
-
- crnlib::vector<uint> trial_color_selector_remaps[cMaxSelectorRemapIters + 1];
-
- for (uint i = 0; i <= cMaxSelectorRemapIters; i++)
- {
- optimize_color_selector_codebook_params* pParams = crnlib_new<optimize_color_selector_codebook_params>();
- pParams->m_iter_index = i;
- pParams->m_max_iter_index = cMaxSelectorRemapIters;
- pParams->m_pTrial_color_selector_remap = &trial_color_selector_remaps[i];
-
- m_task_pool.queue_object_task(this, &crn_comp::optimize_color_selector_codebook_task, 0, pParams);
- }
-
- m_task_pool.join();
-
- for (uint i = 0; i <= cMaxSelectorRemapIters; i++)
- {
- if (!update_progress(21, i, cMaxSelectorRemapIters+1))
- return false;
-
- crnlib::vector<uint>& trial_color_selector_remap = trial_color_selector_remaps[i];
-
- crnlib::vector<uint8> packed_data;
- if (!pack_selectors(
- packed_data,
- m_selector_indices[cColor],
- m_hvq.get_color_selectors_vec(),
- trial_color_selector_remap,
- 3,
- g_dxt1_to_linear, i))
- {
- return false;
- }
-
- uint total_packed_chunk_bits;
- if (!pack_chunks_simulation(0, m_total_chunks, total_packed_chunk_bits, NULL, &trial_color_selector_remap, NULL, NULL))
- return false;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Pack chunks simulation: %u bits", total_packed_chunk_bits);
-#endif
-
- uint total_bits = packed_data.size() * 8 + total_packed_chunk_bits;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Total bits: %u", total_bits);
-#endif
- if (total_bits < best_bits)
- {
- m_packed_color_selectors.swap(packed_data);
- remapping.swap(trial_color_selector_remap);
- best_bits = total_bits;
- }
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("End optimization of color selector codebook");
-#endif
-
- return true;
- }
-
- struct optimize_alpha_endpoint_codebook_params
- {
- crnlib::vector<uint>* m_pAlpha_indices;
- crnlib::vector<uint>* m_pTrial_alpha_endpoint_remap;
- uint m_iter_index;
- uint m_max_iter_index;
- };
-
- void crn_comp::optimize_alpha_endpoint_codebook_task(uint64 data, void* pData_ptr)
- {
- data;
- optimize_alpha_endpoint_codebook_params* pParams = reinterpret_cast<optimize_alpha_endpoint_codebook_params*>(pData_ptr);
-
- if (pParams->m_iter_index == pParams->m_max_iter_index)
- {
- sort_alpha_endpoint_codebook(*pParams->m_pTrial_alpha_endpoint_remap, m_hvq.get_alpha_endpoint_vec());
- }
- else
- {
- float f = pParams->m_iter_index / static_cast<float>(pParams->m_max_iter_index - 1);
-
- create_zeng_reorder_table(
- m_hvq.get_alpha_endpoint_codebook_size(),
- pParams->m_pAlpha_indices->size(),
- &(*pParams->m_pAlpha_indices)[0],
- *pParams->m_pTrial_alpha_endpoint_remap,
- pParams->m_iter_index ? alpha_endpoint_similarity_func : NULL,
- &m_hvq,
- f);
- }
-
- crnlib_delete(pParams);
- }
-
- bool crn_comp::optimize_alpha_endpoint_codebook(crnlib::vector<uint>& remapping)
- {
- crnlib::vector<uint> alpha_indices;
- alpha_indices.reserve(m_endpoint_indices[cAlpha0].size() + m_endpoint_indices[cAlpha1].size());
- for (uint i = 0; i < m_endpoint_indices[cAlpha0].size(); i++)
- alpha_indices.push_back(m_endpoint_indices[cAlpha0][i]);
- for (uint i = 0; i < m_endpoint_indices[cAlpha1].size(); i++)
- alpha_indices.push_back(m_endpoint_indices[cAlpha1][i]);
-
- if (m_pParams->m_flags & cCRNCompFlagQuick)
- {
- remapping.resize(m_hvq.get_alpha_endpoint_vec().size());
- for (uint i = 0; i < m_hvq.get_alpha_endpoint_vec().size(); i++)
- remapping[i] = i;
-
- if (!pack_alpha_endpoints(m_packed_alpha_endpoints, remapping, alpha_indices, 0))
- return false;
-
- return true;
- }
-
- const uint cMaxEndpointRemapIters = 3;
- uint best_bits = UINT_MAX;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("----- Begin optimization of alpha endpoint codebook");
-#endif
-
- crnlib::vector<uint> trial_alpha_endpoint_remaps[cMaxEndpointRemapIters + 1];
-
- for (uint i = 0; i <= cMaxEndpointRemapIters; i++)
- {
- optimize_alpha_endpoint_codebook_params* pParams = crnlib_new<optimize_alpha_endpoint_codebook_params>();
- pParams->m_pAlpha_indices = &alpha_indices;
- pParams->m_iter_index = i;
- pParams->m_max_iter_index = cMaxEndpointRemapIters;
- pParams->m_pTrial_alpha_endpoint_remap = &trial_alpha_endpoint_remaps[i];
-
- m_task_pool.queue_object_task(this, &crn_comp::optimize_alpha_endpoint_codebook_task, 0, pParams);
- }
-
- m_task_pool.join();
-
- for (uint i = 0; i <= cMaxEndpointRemapIters; i++)
- {
- if (!update_progress(22, i, cMaxEndpointRemapIters+1))
- return false;
-
- crnlib::vector<uint>& trial_alpha_endpoint_remap = trial_alpha_endpoint_remaps[i];
-
- crnlib::vector<uint8> packed_data;
- if (!pack_alpha_endpoints(packed_data, trial_alpha_endpoint_remap, alpha_indices, i))
- return false;
-
- uint total_packed_chunk_bits;
- if (!pack_chunks_simulation(0, m_total_chunks, total_packed_chunk_bits, NULL, NULL, &trial_alpha_endpoint_remap, NULL))
- return false;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Pack chunks simulation: %u bits", total_packed_chunk_bits);
-#endif
-
- uint total_bits = packed_data.size() * 8 + total_packed_chunk_bits;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Total bits: %u", total_bits);
-#endif
-
- if (total_bits < best_bits)
- {
- m_packed_alpha_endpoints.swap(packed_data);
- remapping.swap(trial_alpha_endpoint_remap);
- best_bits = total_bits;
- }
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("End optimization of alpha endpoint codebook");
-#endif
-
- return true;
- }
-
- struct optimize_alpha_selector_codebook_params
- {
- crnlib::vector<uint>* m_pAlpha_indices;
- crnlib::vector<uint>* m_pTrial_alpha_selector_remap;
- uint m_iter_index;
- uint m_max_iter_index;
- };
-
- void crn_comp::optimize_alpha_selector_codebook_task(uint64 data, void* pData_ptr)
- {
- data;
- optimize_alpha_selector_codebook_params* pParams = reinterpret_cast<optimize_alpha_selector_codebook_params*>(pData_ptr);
-
- if (pParams->m_iter_index == pParams->m_max_iter_index)
- {
- sort_selector_codebook(*pParams->m_pTrial_alpha_selector_remap, m_hvq.get_alpha_selectors_vec(), g_dxt5_to_linear);
- }
- else
- {
- float f = pParams->m_iter_index / static_cast<float>(pParams->m_max_iter_index - 1);
- create_zeng_reorder_table(
- m_hvq.get_alpha_selector_codebook_size(),
- pParams->m_pAlpha_indices->size(),
- &(*pParams->m_pAlpha_indices)[0],
- *pParams->m_pTrial_alpha_selector_remap,
- pParams->m_iter_index ? alpha_selector_similarity_func : NULL,
- (void*)&m_hvq.get_alpha_selectors_vec(),
- f);
- }
- }
-
- bool crn_comp::optimize_alpha_selector_codebook(crnlib::vector<uint>& remapping)
- {
- crnlib::vector<uint> alpha_indices;
- alpha_indices.reserve(m_selector_indices[cAlpha0].size() + m_selector_indices[cAlpha1].size());
- for (uint i = 0; i < m_selector_indices[cAlpha0].size(); i++)
- alpha_indices.push_back(m_selector_indices[cAlpha0][i]);
- for (uint i = 0; i < m_selector_indices[cAlpha1].size(); i++)
- alpha_indices.push_back(m_selector_indices[cAlpha1][i]);
-
- if (m_pParams->m_flags & cCRNCompFlagQuick)
- {
- remapping.resize(m_hvq.get_alpha_selectors_vec().size());
- for (uint i = 0; i < m_hvq.get_alpha_selectors_vec().size(); i++)
- remapping[i] = i;
-
- if (!pack_selectors(
- m_packed_alpha_selectors,
- alpha_indices,
- m_hvq.get_alpha_selectors_vec(),
- remapping,
- 7,
- g_dxt5_to_linear, 0))
- {
- return false;
- }
-
- return true;
- }
-
- const uint cMaxSelectorRemapIters = 3;
-
- uint best_bits = UINT_MAX;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("----- Begin optimization of alpha selector codebook");
-#endif
-
- crnlib::vector<uint> trial_alpha_selector_remaps[cMaxSelectorRemapIters + 1];
-
- for (uint i = 0; i <= cMaxSelectorRemapIters; i++)
- {
- optimize_alpha_selector_codebook_params* pParams = crnlib_new<optimize_alpha_selector_codebook_params>();
- pParams->m_pAlpha_indices = &alpha_indices;
- pParams->m_iter_index = i;
- pParams->m_max_iter_index = cMaxSelectorRemapIters;
- pParams->m_pTrial_alpha_selector_remap = &trial_alpha_selector_remaps[i];
-
- m_task_pool.queue_object_task(this, &crn_comp::optimize_alpha_selector_codebook_task, 0, pParams);
- }
-
- m_task_pool.join();
-
- for (uint i = 0; i <= cMaxSelectorRemapIters; i++)
- {
- if (!update_progress(23, i, cMaxSelectorRemapIters+1))
- return false;
-
- crnlib::vector<uint>& trial_alpha_selector_remap = trial_alpha_selector_remaps[i];
-
- crnlib::vector<uint8> packed_data;
- if (!pack_selectors(
- packed_data,
- alpha_indices,
- m_hvq.get_alpha_selectors_vec(),
- trial_alpha_selector_remap,
- 7,
- g_dxt5_to_linear, i))
- {
- return false;
- }
-
- uint total_packed_chunk_bits;
- if (!pack_chunks_simulation(0, m_total_chunks, total_packed_chunk_bits, NULL, NULL, NULL, &trial_alpha_selector_remap))
- return false;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Pack chunks simulation: %u bits", total_packed_chunk_bits);
-#endif
-
- uint total_bits = packed_data.size() * 8 + total_packed_chunk_bits;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("Total bits: %u", total_bits);
-#endif
- if (total_bits < best_bits)
- {
- m_packed_alpha_selectors.swap(packed_data);
-
- remapping.swap(trial_alpha_selector_remap);
- best_bits = total_bits;
- }
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- console::debug("End optimization of alpha selector codebook");
-#endif
-
- return true;
- }
-
- bool crn_comp::pack_data_models()
- {
- symbol_codec codec;
- codec.start_encoding(1024*1024);
-
- if (!codec.encode_transmit_static_huffman_data_model(m_chunk_encoding_dm, false))
- return false;
-
- for (uint i = 0; i < 2; i++)
- {
- if (m_endpoint_index_dm[i].get_total_syms())
- {
- if (!codec.encode_transmit_static_huffman_data_model(m_endpoint_index_dm[i], false))
- return false;
- }
-
- if (m_selector_index_dm[i].get_total_syms())
- {
- if (!codec.encode_transmit_static_huffman_data_model(m_selector_index_dm[i], false))
- return false;
- }
- }
-
- codec.stop_encoding(false);
-
- m_packed_data_models.swap(codec.get_encoding_buf());
-
- return true;
- }
-
- bool crn_comp::create_comp_data()
- {
- utils::zero_object(m_crn_header);
-
- m_crn_header.m_width = static_cast<uint16>(m_pParams->m_width);
- m_crn_header.m_height = static_cast<uint16>(m_pParams->m_height);
- m_crn_header.m_levels = static_cast<uint8>(m_pParams->m_levels);
- m_crn_header.m_faces = static_cast<uint8>(m_pParams->m_faces);
- m_crn_header.m_format = static_cast<uint8>(m_pParams->m_format);
- m_crn_header.m_userdata0 = m_pParams->m_userdata0;
- m_crn_header.m_userdata1 = m_pParams->m_userdata1;
-
- m_comp_data.clear();
- m_comp_data.reserve(2*1024*1024);
- append_vec(m_comp_data, &m_crn_header, sizeof(m_crn_header));
- // tack on the rest of the variable size m_level_ofs array
- m_comp_data.resize( m_comp_data.size() + sizeof(m_crn_header.m_level_ofs[0]) * (m_pParams->m_levels - 1) );
-
- if (m_packed_color_endpoints.size())
- {
- m_crn_header.m_color_endpoints.m_num = static_cast<uint16>(m_hvq.get_color_endpoint_codebook_size());
- m_crn_header.m_color_endpoints.m_size = m_packed_color_endpoints.size();
- m_crn_header.m_color_endpoints.m_ofs = m_comp_data.size();
- append_vec(m_comp_data, m_packed_color_endpoints);
- }
-
- if (m_packed_color_selectors.size())
- {
- m_crn_header.m_color_selectors.m_num = static_cast<uint16>(m_hvq.get_color_selector_codebook_size());
- m_crn_header.m_color_selectors.m_size = m_packed_color_selectors.size();
- m_crn_header.m_color_selectors.m_ofs = m_comp_data.size();
- append_vec(m_comp_data, m_packed_color_selectors);
- }
-
- if (m_packed_alpha_endpoints.size())
- {
- m_crn_header.m_alpha_endpoints.m_num = static_cast<uint16>(m_hvq.get_alpha_endpoint_codebook_size());
- m_crn_header.m_alpha_endpoints.m_size = m_packed_alpha_endpoints.size();
- m_crn_header.m_alpha_endpoints.m_ofs = m_comp_data.size();
- append_vec(m_comp_data, m_packed_alpha_endpoints);
- }
-
- if (m_packed_alpha_selectors.size())
- {
- m_crn_header.m_alpha_selectors.m_num = static_cast<uint16>(m_hvq.get_alpha_selector_codebook_size());
- m_crn_header.m_alpha_selectors.m_size = m_packed_alpha_selectors.size();
- m_crn_header.m_alpha_selectors.m_ofs = m_comp_data.size();
- append_vec(m_comp_data, m_packed_alpha_selectors);
- }
-
- m_crn_header.m_tables_ofs = m_comp_data.size();
- m_crn_header.m_tables_size = m_packed_data_models.size();
- append_vec(m_comp_data, m_packed_data_models);
-
- uint level_ofs[cCRNMaxLevels];
- for (uint i = 0; i < m_mip_groups.size(); i++)
- {
- level_ofs[i] = m_comp_data.size();
- append_vec(m_comp_data, m_packed_chunks[i]);
- }
-
- crnd::crn_header& dst_header = *(crnd::crn_header*)&m_comp_data[0];
- // don't change the m_comp_data vector - or dst_header will be invalidated!
-
- memcpy(&dst_header, &m_crn_header, sizeof(dst_header));
-
- for (uint i = 0; i < m_mip_groups.size(); i++)
- dst_header.m_level_ofs[i] = level_ofs[i];
-
- const uint actual_header_size = sizeof(crnd::crn_header) + sizeof(dst_header.m_level_ofs[0]) * (m_mip_groups.size() - 1);
-
- dst_header.m_sig = crnd::crn_header::cCRNSigValue;
-
- dst_header.m_data_size = m_comp_data.size();
- dst_header.m_data_crc16 = crc16(&m_comp_data[actual_header_size], m_comp_data.size() - actual_header_size);
-
- dst_header.m_header_size = actual_header_size;
- dst_header.m_header_crc16 = crc16(&dst_header.m_data_size, actual_header_size - (uint)((uint8*)&dst_header.m_data_size - (uint8*)&dst_header));
-
- return true;
- }
-
- bool crn_comp::update_progress(uint phase_index, uint subphase_index, uint subphase_total)
- {
- if (!m_pParams->m_pProgress_func)
- return true;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- return true;
-#endif
-
- return (*m_pParams->m_pProgress_func)(phase_index, cTotalCompressionPhases, subphase_index, subphase_total, m_pParams->m_pProgress_func_data) != 0;
- }
-
- bool crn_comp::compress_internal()
- {
- if (!alias_images())
- return false;
-
- create_chunks();
-
- if (!quantize_chunks())
- return false;
-
- create_chunk_indices();
-
- crnlib::vector<uint> endpoint_remap[2];
- crnlib::vector<uint> selector_remap[2];
-
- if (m_has_comp[cColor])
- {
- if (!optimize_color_endpoint_codebook(endpoint_remap[0]))
- return false;
- if (!optimize_color_selector_codebook(selector_remap[0]))
- return false;
- }
-
- if (m_has_comp[cAlpha0])
- {
- if (!optimize_alpha_endpoint_codebook(endpoint_remap[1]))
- return false;
- if (!optimize_alpha_selector_codebook(selector_remap[1]))
- return false;
- }
-
- m_chunk_encoding_hist.clear();
- for (uint i = 0; i < 2; i++)
- {
- m_endpoint_index_hist[i].clear();
- m_endpoint_index_dm[i].clear();
- m_selector_index_hist[i].clear();
- m_selector_index_dm[i].clear();
- }
-
- for (uint pass = 0; pass < 2; pass++)
- {
- for (uint mip_group = 0; mip_group < m_mip_groups.size(); mip_group++)
- {
- symbol_codec codec;
- codec.start_encoding(2*1024*1024);
-
- if (!pack_chunks(
- m_mip_groups[mip_group].m_first_chunk, m_mip_groups[mip_group].m_num_chunks,
- !pass && !mip_group, pass ? &codec : NULL,
- m_has_comp[cColor] ? &endpoint_remap[0] : NULL, m_has_comp[cColor] ? &selector_remap[0] : NULL,
- m_has_comp[cAlpha0] ? &endpoint_remap[1] : NULL, m_has_comp[cAlpha0] ? &selector_remap[1] : NULL))
- {
- return false;
- }
-
- codec.stop_encoding(false);
-
- if (pass)
- m_packed_chunks[mip_group].swap(codec.get_encoding_buf());
- }
-
- if (!pass)
- {
- m_chunk_encoding_dm.init(true, m_chunk_encoding_hist, 16);
-
- for (uint i = 0; i < 2; i++)
- {
- if (m_endpoint_index_hist[i].size())
- m_endpoint_index_dm[i].init(true, m_endpoint_index_hist[i], 16);
-
- if (m_selector_index_hist[i].size())
- m_selector_index_dm[i].init(true, m_selector_index_hist[i], 16);
- }
- }
- }
-
- if (!pack_data_models())
- return false;
-
- if (!create_comp_data())
- return false;
-
- if (!update_progress(24, 1, 1))
- return false;
-
- if (m_pParams->m_flags & cCRNCompFlagDebugging)
- {
- crnlib_print_mem_stats();
- }
-
- return true;
- }
-
- bool crn_comp::compress_init(const crn_comp_params& params)
- {
- params;
- return true;
- }
-
- bool crn_comp::compress_pass(const crn_comp_params& params, float *pEffective_bitrate)
- {
- clear();
-
- if (pEffective_bitrate) *pEffective_bitrate = 0.0f;
-
- m_pParams = &params;
-
- if ((math::minimum(m_pParams->m_width, m_pParams->m_height) < 1) || (math::maximum(m_pParams->m_width, m_pParams->m_height) > cCRNMaxLevelResolution))
- return false;
-
- if (!m_task_pool.init(params.m_num_helper_threads))
- return false;
-
- bool status = compress_internal();
-
- m_task_pool.deinit();
-
- if ((status) && (pEffective_bitrate))
- {
- uint total_pixels = 0;
-
- for (uint f = 0; f < m_pParams->m_faces; f++)
- for (uint l = 0; l < m_pParams->m_levels; l++)
- total_pixels += m_images[f][l].get_total_pixels();
-
- *pEffective_bitrate = (m_comp_data.size() * 8.0f) / total_pixels;
- }
-
- return status;
- }
-
- void crn_comp::compress_deinit()
- {
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_comp.h b/Libraries/crunch-ea9b8d/crnlib/crn_comp.h
deleted file mode 100644
index 5823494a..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_comp.h
+++ /dev/null
@@ -1,181 +0,0 @@
-// File: crn_comp.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-#define CRND_HEADER_FILE_ONLY
-#include "../inc/crn_decomp.h"
-#undef CRND_HEADER_FILE_ONLY
-
-#include "../inc/crnlib.h"
-#include "crn_symbol_codec.h"
-#include "crn_dxt_hc.h"
-#include "crn_image.h"
-#include "crn_image_utils.h"
-#include "crn_texture_comp.h"
-
-namespace crnlib
-{
- class crn_comp : public itexture_comp
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(crn_comp);
-
- public:
- crn_comp();
- virtual ~crn_comp();
-
- virtual const char *get_ext() const { return "CRN"; }
-
- virtual bool compress_init(const crn_comp_params& params);
- virtual bool compress_pass(const crn_comp_params& params, float *pEffective_bitrate);
- virtual void compress_deinit();
-
- virtual const crnlib::vector<uint8>& get_comp_data() const { return m_comp_data; }
- virtual crnlib::vector<uint8>& get_comp_data() { return m_comp_data; }
-
- uint get_comp_data_size() const { return m_comp_data.size(); }
- const uint8* get_comp_data_ptr() const { return m_comp_data.size() ? &m_comp_data[0] : NULL; }
-
- private:
- task_pool m_task_pool;
- const crn_comp_params* m_pParams;
-
- image_u8 m_images[cCRNMaxFaces][cCRNMaxLevels];
-
- struct level_tag
- {
- uint m_width, m_height;
- uint m_chunk_width, m_chunk_height;
- uint m_group_index;
- uint m_num_chunks;
- uint m_first_chunk;
- uint m_group_first_chunk;
- } m_levels[cCRNMaxLevels];
-
- struct mip_group
- {
- mip_group() : m_first_chunk(0), m_num_chunks(0) { }
-
- uint m_first_chunk;
- uint m_num_chunks;
- };
- crnlib::vector<mip_group> m_mip_groups;
-
- enum comp
- {
- cColor,
- cAlpha0,
- cAlpha1,
- cNumComps
- };
-
- bool m_has_comp[cNumComps];
-
- struct chunk_detail
- {
- chunk_detail() { utils::zero_object(*this); }
-
- uint m_first_endpoint_index;
- uint m_first_selector_index;
- };
- typedef crnlib::vector<chunk_detail> chunk_detail_vec;
- chunk_detail_vec m_chunk_details;
-
- crnlib::vector<uint> m_endpoint_indices[cNumComps];
- crnlib::vector<uint> m_selector_indices[cNumComps];
-
- uint m_total_chunks;
- dxt_hc::pixel_chunk_vec m_chunks;
-
- crnd::crn_header m_crn_header;
- crnlib::vector<uint8> m_comp_data;
-
- dxt_hc m_hvq;
-
- symbol_histogram m_chunk_encoding_hist;
- static_huffman_data_model m_chunk_encoding_dm;
-
- symbol_histogram m_endpoint_index_hist[2];
- static_huffman_data_model m_endpoint_index_dm[2]; // color, alpha
-
- symbol_histogram m_selector_index_hist[2];
- static_huffman_data_model m_selector_index_dm[2]; // color, alpha
-
- crnlib::vector<uint8> m_packed_chunks[cCRNMaxLevels];
- crnlib::vector<uint8> m_packed_data_models;
- crnlib::vector<uint8> m_packed_color_endpoints;
- crnlib::vector<uint8> m_packed_color_selectors;
- crnlib::vector<uint8> m_packed_alpha_endpoints;
- crnlib::vector<uint8> m_packed_alpha_selectors;
-
- void clear();
-
- void append_chunks(const image_u8& img, uint num_chunks_x, uint num_chunks_y, dxt_hc::pixel_chunk_vec& chunks, float weight);
-
- static float color_endpoint_similarity_func(uint index_a, uint index_b, void* pContext);
- static float alpha_endpoint_similarity_func(uint index_a, uint index_b, void* pContext);
- void sort_color_endpoint_codebook(crnlib::vector<uint>& remapping, const crnlib::vector<uint>& endpoints);
- void sort_alpha_endpoint_codebook(crnlib::vector<uint>& remapping, const crnlib::vector<uint>& endpoints);
-
- bool pack_color_endpoints(crnlib::vector<uint8>& data, const crnlib::vector<uint>& remapping, const crnlib::vector<uint>& endpoint_indices, uint trial_index);
- bool pack_alpha_endpoints(crnlib::vector<uint8>& data, const crnlib::vector<uint>& remapping, const crnlib::vector<uint>& endpoint_indices, uint trial_index);
-
- static float color_selector_similarity_func(uint index_a, uint index_b, void* pContext);
- static float alpha_selector_similarity_func(uint index_a, uint index_b, void* pContext);
- void sort_selector_codebook(crnlib::vector<uint>& remapping, const crnlib::vector<dxt_hc::selectors>& selectors, const uint8* pTo_linear);
-
- bool pack_selectors(
- crnlib::vector<uint8>& packed_data,
- const crnlib::vector<uint>& selector_indices,
- const crnlib::vector<dxt_hc::selectors>& selectors,
- const crnlib::vector<uint>& remapping,
- uint max_selector_value,
- const uint8* pTo_linear,
- uint trial_index);
-
- bool alias_images();
- void create_chunks();
- bool quantize_chunks();
- void create_chunk_indices();
-
- bool pack_chunks(
- uint first_chunk, uint num_chunks,
- bool clear_histograms,
- symbol_codec* pCodec,
- const crnlib::vector<uint>* pColor_endpoint_remap,
- const crnlib::vector<uint>* pColor_selector_remap,
- const crnlib::vector<uint>* pAlpha_endpoint_remap,
- const crnlib::vector<uint>* pAlpha_selector_remap);
-
- bool pack_chunks_simulation(
- uint first_chunk, uint num_chunks,
- uint& total_bits,
- const crnlib::vector<uint>* pColor_endpoint_remap,
- const crnlib::vector<uint>* pColor_selector_remap,
- const crnlib::vector<uint>* pAlpha_endpoint_remap,
- const crnlib::vector<uint>* pAlpha_selector_remap);
-
- void optimize_color_endpoint_codebook_task(uint64 data, void* pData_ptr);
- bool optimize_color_endpoint_codebook(crnlib::vector<uint>& remapping);
-
- void optimize_color_selector_codebook_task(uint64 data, void* pData_ptr);
- bool optimize_color_selector_codebook(crnlib::vector<uint>& remapping);
-
- void optimize_alpha_endpoint_codebook_task(uint64 data, void* pData_ptr);
- bool optimize_alpha_endpoint_codebook(crnlib::vector<uint>& remapping);
-
- void optimize_alpha_selector_codebook_task(uint64 data, void* pData_ptr);
- bool optimize_alpha_selector_codebook(crnlib::vector<uint>& remapping);
-
- bool create_comp_data();
-
- bool pack_data_models();
-
- bool update_progress(uint phase_index, uint subphase_index, uint subphase_total);
-
- bool compress_internal();
-
- static void append_vec(crnlib::vector<uint8>& a, const void* p, uint size);
- static void append_vec(crnlib::vector<uint8>& a, const crnlib::vector<uint8>& b);
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_console.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_console.cpp
deleted file mode 100644
index da57125a..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_console.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-// File: crn_console.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_console.h"
-#include "crn_data_stream.h"
-#include "crn_threading.h"
-
-namespace crnlib
-{
- eConsoleMessageType console::m_default_category = cInfoConsoleMessage;
- crnlib::vector<console::console_func> console::m_output_funcs;
- bool console::m_crlf = true;
- bool console::m_prefixes = true;
- bool console::m_output_disabled;
- data_stream* console::m_pLog_stream;
- mutex* console::m_pMutex;
- uint console::m_num_messages[cCMTTotal];
- bool console::m_at_beginning_of_line = true;
-
- const uint cConsoleBufSize = 4096;
-
- void console::init()
- {
- if (!m_pMutex)
- {
- m_pMutex = crnlib_new<mutex>();
- }
- }
-
- void console::deinit()
- {
- if (m_pMutex)
- {
- crnlib_delete(m_pMutex);
- m_pMutex = NULL;
- }
- }
-
- void console::disable_crlf()
- {
- init();
-
- m_crlf = false;
- }
-
- void console::enable_crlf()
- {
- init();
-
- m_crlf = true;
- }
-
- void console::vprintf(eConsoleMessageType type, const char* p, va_list args)
- {
- init();
-
- scoped_mutex lock(*m_pMutex);
-
- m_num_messages[type]++;
-
- char buf[cConsoleBufSize];
- vsprintf_s(buf, cConsoleBufSize, p, args);
-
- bool handled = false;
-
- if (m_output_funcs.size())
- {
- for (uint i = 0; i < m_output_funcs.size(); i++)
- if (m_output_funcs[i].m_func(type, buf, m_output_funcs[i].m_pData))
- handled = true;
- }
-
- const char* pPrefix = NULL;
- if ((m_prefixes) && (m_at_beginning_of_line))
- {
- switch (type)
- {
- case cDebugConsoleMessage: pPrefix = "Debug: "; break;
- case cWarningConsoleMessage: pPrefix = "Warning: "; break;
- case cErrorConsoleMessage: pPrefix = "Error: "; break;
- default: break;
- }
- }
-
- if ((!m_output_disabled) && (!handled))
- {
- if (pPrefix)
- ::printf("%s", pPrefix);
- ::printf(m_crlf ? "%s\n" : "%s", buf);
- }
-
- uint n = strlen(buf);
- m_at_beginning_of_line = (m_crlf) || ((n) && (buf[n - 1] == '\n'));
-
- if ((type != cProgressConsoleMessage) && (m_pLog_stream))
- {
- // Yes this is bad.
- dynamic_string tmp_buf(buf);
-
- tmp_buf.translate_lf_to_crlf();
-
- m_pLog_stream->printf(m_crlf ? "%s\r\n" : "%s", tmp_buf.get_ptr());
- m_pLog_stream->flush();
- }
- }
-
- void console::printf(eConsoleMessageType type, const char* p, ...)
- {
- va_list args;
- va_start(args, p);
- vprintf(type, p, args);
- va_end(args);
- }
-
- void console::printf(const char* p, ...)
- {
- va_list args;
- va_start(args, p);
- vprintf(m_default_category, p, args);
- va_end(args);
- }
-
- void console::set_default_category(eConsoleMessageType category)
- {
- init();
-
- m_default_category = category;
- }
-
- eConsoleMessageType console::get_default_category()
- {
- init();
-
- return m_default_category;
- }
-
- void console::add_console_output_func(console_output_func pFunc, void* pData)
- {
- init();
-
- scoped_mutex lock(*m_pMutex);
-
- m_output_funcs.push_back(console_func(pFunc, pData));
- }
-
- void console::remove_console_output_func(console_output_func pFunc)
- {
- init();
-
- scoped_mutex lock(*m_pMutex);
-
- for (int i = m_output_funcs.size() - 1; i >= 0; i--)
- {
- if (m_output_funcs[i].m_func == pFunc)
- {
- m_output_funcs.erase(m_output_funcs.begin() + i);
- }
- }
-
- if (!m_output_funcs.size())
- {
- m_output_funcs.clear();
- }
- }
-
- void console::progress(const char* p, ...)
- {
- va_list args;
- va_start(args, p);
- vprintf(cProgressConsoleMessage, p, args);
- va_end(args);
- }
-
- void console::info(const char* p, ...)
- {
- va_list args;
- va_start(args, p);
- vprintf(cInfoConsoleMessage, p, args);
- va_end(args);
- }
-
- void console::message(const char* p, ...)
- {
- va_list args;
- va_start(args, p);
- vprintf(cMessageConsoleMessage, p, args);
- va_end(args);
- }
-
- void console::cons(const char* p, ...)
- {
- va_list args;
- va_start(args, p);
- vprintf(cConsoleConsoleMessage, p, args);
- va_end(args);
- }
-
- void console::debug(const char* p, ...)
- {
- va_list args;
- va_start(args, p);
- vprintf(cDebugConsoleMessage, p, args);
- va_end(args);
- }
-
- void console::warning(const char* p, ...)
- {
- va_list args;
- va_start(args, p);
- vprintf(cWarningConsoleMessage, p, args);
- va_end(args);
- }
-
- void console::error(const char* p, ...)
- {
- va_list args;
- va_start(args, p);
- vprintf(cErrorConsoleMessage, p, args);
- va_end(args);
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_console.h b/Libraries/crunch-ea9b8d/crnlib/crn_console.h
deleted file mode 100644
index aa4cc8e1..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_console.h
+++ /dev/null
@@ -1,128 +0,0 @@
-// File: crn_console.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_dynamic_string.h"
-
-#ifdef WIN32
-#include <tchar.h>
-#include <conio.h>
-#endif
-namespace crnlib
-{
- class dynamic_string;
- class data_stream;
- class mutex;
-
- enum eConsoleMessageType
- {
- cDebugConsoleMessage, // debugging messages
- cProgressConsoleMessage, // progress messages
- cInfoConsoleMessage, // ordinary messages
- cConsoleConsoleMessage, // user console output
- cMessageConsoleMessage, // high importance messages
- cWarningConsoleMessage, // warnings
- cErrorConsoleMessage, // errors
-
- cCMTTotal
- };
-
- typedef bool (*console_output_func)(eConsoleMessageType type, const char* pMsg, void* pData);
-
- class console
- {
- public:
- static void init();
- static void deinit();
-
- static bool is_initialized() { return m_pMutex != NULL; }
-
- static void set_default_category(eConsoleMessageType category);
- static eConsoleMessageType get_default_category();
-
- static void add_console_output_func(console_output_func pFunc, void* pData);
- static void remove_console_output_func(console_output_func pFunc);
-
- static void printf(const char* p, ...);
-
- static void vprintf(eConsoleMessageType type, const char* p, va_list args);
- static void printf(eConsoleMessageType type, const char* p, ...);
-
- static void cons(const char* p, ...);
- static void debug(const char* p, ...);
- static void progress(const char* p, ...);
- static void info(const char* p, ...);
- static void message(const char* p, ...);
- static void warning(const char* p, ...);
- static void error(const char* p, ...);
-
- // FIXME: All console state is currently global!
- static void disable_prefixes();
- static void enable_prefixes();
- static bool get_prefixes() { return m_prefixes; }
- static bool get_at_beginning_of_line() { return m_at_beginning_of_line; }
-
- static void disable_crlf();
- static void enable_crlf();
- static bool get_crlf() { return m_crlf; }
-
- static void disable_output() { m_output_disabled = true; }
- static void enable_output() { m_output_disabled = false; }
- static bool get_output_disabled() { return m_output_disabled; }
-
- static void set_log_stream(data_stream* pStream) { m_pLog_stream = pStream; }
- static data_stream* get_log_stream() { return m_pLog_stream; }
-
- static uint get_num_messages(eConsoleMessageType type) { return m_num_messages[type]; }
-
- private:
- static eConsoleMessageType m_default_category;
-
- struct console_func
- {
- console_func(console_output_func func = NULL, void* pData = NULL) : m_func(func), m_pData(pData) { }
-
- console_output_func m_func;
- void* m_pData;
- };
- static crnlib::vector<console_func> m_output_funcs;
-
- static bool m_crlf, m_prefixes, m_output_disabled;
-
- static data_stream* m_pLog_stream;
-
- static mutex* m_pMutex;
-
- static uint m_num_messages[cCMTTotal];
-
- static bool m_at_beginning_of_line;
- };
-
-#if defined(WIN32)
- inline int crn_getch()
- {
- return _getch();
- }
-#elif defined(__GNUC__)
- #include <termios.h>
- #include <unistd.h>
- inline int crn_getch()
- {
- struct termios oldt, newt;
- int ch;
- tcgetattr(STDIN_FILENO, &oldt);
- newt = oldt;
- newt.c_lflag &= ~(ICANON | ECHO);
- tcsetattr(STDIN_FILENO, TCSANOW, &newt);
- ch = getchar();
- tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
- return ch;
- }
-#else
- inline int crn_getch()
- {
- printf("crn_getch: Unimplemented");
- return 0;
- }
-#endif
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_core.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_core.cpp
deleted file mode 100644
index 8dca8c5b..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_core.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// File: crn_core.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-
-#if CRNLIB_USE_WIN32_API
-#include "crn_winhdr.h"
-#endif
-
-namespace crnlib
-{
- const char *g_copyright_str = "Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC";
- const char *g_sig_str = "C8cfRlaorj0wLtnMSxrBJxTC85rho2L9hUZKHcBL";
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_core.h b/Libraries/crunch-ea9b8d/crnlib/crn_core.h
deleted file mode 100644
index 6c8c7f06..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_core.h
+++ /dev/null
@@ -1,178 +0,0 @@
-// File: crn_core.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-#if defined(WIN32) && defined(_MSC_VER)
- #pragma warning (disable: 4201) // nonstandard extension used : nameless struct/union
- #pragma warning (disable: 4127) // conditional expression is constant
- #pragma warning (disable: 4793) // function compiled as native
- #pragma warning (disable: 4324) // structure was padded due to __declspec(align())
-#endif
-
-#if defined(WIN32) && !defined(CRNLIB_ANSI_CPLUSPLUS)
- // MSVC or MinGW, x86 or x64, Win32 API's for threading and Win32 Interlocked API's or GCC built-ins for atomic ops.
- #ifdef NDEBUG
- // Ensure checked iterators are disabled. Note: Be sure anything else that links against this lib also #define's this stuff, or remove this crap!
- #define _SECURE_SCL 0
- #define _HAS_ITERATOR_DEBUGGING 0
- #endif
- #ifndef _DLL
- // If we're using the DLL form of the run-time libs, we're also going to be enabling exceptions because we'll be building CLR apps.
- // Otherwise, we disable exceptions for a small speed boost.
- #define _HAS_EXCEPTIONS 0
- #endif
- #define NOMINMAX
-
- #define CRNLIB_USE_WIN32_API 1
-
- #if defined(__MINGW32__) || defined(__MINGW64__)
- #define CRNLIB_USE_GCC_ATOMIC_BUILTINS 1
- #else
- #define CRNLIB_USE_WIN32_ATOMIC_FUNCTIONS 1
- #endif
-
- #define CRNLIB_PLATFORM_PC 1
-
- #if defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__)
- #define CRNLIB_PLATFORM_PC_X64 1
- #define CRNLIB_64BIT_POINTERS 1
- #define CRNLIB_CPU_HAS_64BIT_REGISTERS 1
- #define CRNLIB_LITTLE_ENDIAN_CPU 1
- #else
- #define CRNLIB_PLATFORM_PC_X86 1
- #define CRNLIB_64BIT_POINTERS 0
- #define CRNLIB_CPU_HAS_64BIT_REGISTERS 0
- #define CRNLIB_LITTLE_ENDIAN_CPU 1
- #endif
-
- #define CRNLIB_USE_UNALIGNED_INT_LOADS 1
- #define CRNLIB_RESTRICT __restrict
- #define CRNLIB_FORCE_INLINE __forceinline
-
- #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
- #define CRNLIB_USE_MSVC_INTRINSICS 1
- #endif
-
- #define CRNLIB_INT64_FORMAT_SPECIFIER "%I64i"
- #define CRNLIB_UINT64_FORMAT_SPECIFIER "%I64u"
-
- #define CRNLIB_STDCALL __stdcall
- #define CRNLIB_MEMORY_IMPORT_BARRIER
- #define CRNLIB_MEMORY_EXPORT_BARRIER
-#elif defined(__GNUC__) && !defined(CRNLIB_ANSI_CPLUSPLUS)
- // GCC x86 or x64, pthreads for threading and GCC built-ins for atomic ops.
- #define CRNLIB_PLATFORM_PC 1
-
- #if defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__)
- #define CRNLIB_PLATFORM_PC_X64 1
- #define CRNLIB_64BIT_POINTERS 1
- #define CRNLIB_CPU_HAS_64BIT_REGISTERS 1
- #else
- #define CRNLIB_PLATFORM_PC_X86 1
- #define CRNLIB_64BIT_POINTERS 0
- #define CRNLIB_CPU_HAS_64BIT_REGISTERS 0
- #endif
-
- #define CRNLIB_USE_UNALIGNED_INT_LOADS 1
-
- #define CRNLIB_LITTLE_ENDIAN_CPU 1
-
- #define CRNLIB_USE_PTHREADS_API 1
- #define CRNLIB_USE_GCC_ATOMIC_BUILTINS 1
-
- #define CRNLIB_RESTRICT
-
- #define CRNLIB_FORCE_INLINE inline __attribute__((__always_inline__,__gnu_inline__))
-
- #define CRNLIB_INT64_FORMAT_SPECIFIER "%lli"
- #define CRNLIB_UINT64_FORMAT_SPECIFIER "%llu"
-
- #define CRNLIB_STDCALL
- #define CRNLIB_MEMORY_IMPORT_BARRIER
- #define CRNLIB_MEMORY_EXPORT_BARRIER
-#else
- // Vanilla ANSI-C/C++
- // No threading support, unaligned loads are NOT okay.
- #if defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__)
- #define CRNLIB_64BIT_POINTERS 1
- #define CRNLIB_CPU_HAS_64BIT_REGISTERS 1
- #else
- #define CRNLIB_64BIT_POINTERS 0
- #define CRNLIB_CPU_HAS_64BIT_REGISTERS 0
- #endif
-
- #define CRNLIB_USE_UNALIGNED_INT_LOADS 0
-
- #if __BIG_ENDIAN__
- #define CRNLIB_BIG_ENDIAN_CPU 1
- #else
- #define CRNLIB_LITTLE_ENDIAN_CPU 1
- #endif
-
- #define CRNLIB_USE_GCC_ATOMIC_BUILTINS 0
- #define CRNLIB_USE_WIN32_ATOMIC_FUNCTIONS 0
-
- #define CRNLIB_RESTRICT
- #define CRNLIB_FORCE_INLINE inline
-
- #define CRNLIB_INT64_FORMAT_SPECIFIER "%I64i"
- #define CRNLIB_UINT64_FORMAT_SPECIFIER "%I64u"
-
- #define CRNLIB_STDCALL
- #define CRNLIB_MEMORY_IMPORT_BARRIER
- #define CRNLIB_MEMORY_EXPORT_BARRIER
-#endif
-
-#define CRNLIB_SLOW_STRING_LEN_CHECKS 1
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <limits.h>
-#include <math.h>
-#include <stdarg.h>
-#include <string.h>
-#include <algorithm>
-#include <locale>
-#include <memory.h>
-#include <limits.h>
-#include <algorithm>
-#include <errno.h>
-
-#ifdef min
- #undef min
-#endif
-
-#ifdef max
- #undef max
-#endif
-
-#define CRNLIB_FALSE (0)
-#define CRNLIB_TRUE (1)
-#define CRNLIB_MAX_PATH (260)
-
-#ifdef _DEBUG
- #define CRNLIB_BUILD_DEBUG
-#else
- #define CRNLIB_BUILD_RELEASE
-
- #ifndef NDEBUG
- #define NDEBUG
- #endif
-
- #ifdef DEBUG
- #error DEBUG cannot be defined in CRNLIB_BUILD_RELEASE
- #endif
-#endif
-
-#include "crn_types.h"
-#include "crn_assert.h"
-#include "crn_platform.h"
-#include "crn_helpers.h"
-#include "crn_traits.h"
-#include "crn_mem.h"
-#include "crn_math.h"
-#include "crn_utils.h"
-#include "crn_hash.h"
-#include "crn_vector.h"
-#include "crn_timer.h"
-#include "crn_dynamic_string.h"
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_data_stream.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_data_stream.cpp
deleted file mode 100644
index 538085e6..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_data_stream.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-// File: crn_data_stream.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_data_stream.h"
-
-namespace crnlib
-{
- data_stream::data_stream() :
- m_attribs(0),
- m_opened(false), m_error(false), m_got_cr(false)
- {
- }
-
- data_stream::data_stream(const char* pName, uint attribs) :
- m_name(pName),
- m_attribs(static_cast<uint16>(attribs)),
- m_opened(false), m_error(false), m_got_cr(false)
- {
- }
-
- uint64 data_stream::skip(uint64 len)
- {
- uint64 total_bytes_read = 0;
-
- const uint cBufSize = 1024;
- uint8 buf[cBufSize];
-
- while (len)
- {
- const uint64 bytes_to_read = math::minimum<uint64>(sizeof(buf), len);
- const uint64 bytes_read = read(buf, static_cast<uint>(bytes_to_read));
- total_bytes_read += bytes_read;
-
- if (bytes_read != bytes_to_read)
- break;
-
- len -= bytes_read;
- }
-
- return total_bytes_read;
- }
-
- bool data_stream::read_line(dynamic_string& str)
- {
- str.empty();
-
- for ( ; ; )
- {
- const int c = read_byte();
-
- const bool prev_got_cr = m_got_cr;
- m_got_cr = false;
-
- if (c < 0)
- {
- if (!str.is_empty())
- break;
-
- return false;
- }
- else if ((26 == c) || (!c))
- continue;
- else if (13 == c)
- {
- m_got_cr = true;
- break;
- }
- else if (10 == c)
- {
- if (prev_got_cr)
- continue;
-
- break;
- }
-
- str.append_char(static_cast<char>(c));
- }
-
- return true;
- }
-
- bool data_stream::printf(const char* p, ...)
- {
- va_list args;
-
- va_start(args, p);
- dynamic_string buf;
- buf.format_args(p, args);
- va_end(args);
-
- return write(buf.get_ptr(), buf.get_len() * sizeof(char)) == buf.get_len() * sizeof(char);
- }
-
- bool data_stream::write_line(const dynamic_string& str)
- {
- if (!str.is_empty())
- return write(str.get_ptr(), str.get_len()) == str.get_len();
-
- return true;
- }
-
- bool data_stream::read_array(vector<uint8>& buf)
- {
- if (buf.size() < get_remaining())
- {
- if (get_remaining() > 1024U*1024U*1024U)
- return false;
-
- buf.resize((uint)get_remaining());
- }
-
- if (!get_remaining())
- {
- buf.resize(0);
- return true;
- }
-
- return read(&buf[0], buf.size()) == buf.size();
- }
-
- bool data_stream::write_array(const vector<uint8>& buf)
- {
- if (!buf.empty())
- return write(&buf[0], buf.size()) == buf.size();
- return true;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_data_stream.h b/Libraries/crunch-ea9b8d/crnlib/crn_data_stream.h
deleted file mode 100644
index aa6d7561..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_data_stream.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// File: crn_data_stream.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- enum data_stream_attribs
- {
- cDataStreamReadable = 1,
- cDataStreamWritable = 2,
- cDataStreamSeekable = 4
- };
-
- const int64 DATA_STREAM_SIZE_UNKNOWN = cINT64_MAX;
- const int64 DATA_STREAM_SIZE_INFINITE = cUINT64_MAX;
-
- class data_stream
- {
- data_stream(const data_stream&);
- data_stream& operator= (const data_stream&);
-
- public:
- data_stream();
- data_stream(const char* pName, uint attribs);
-
- virtual ~data_stream() { }
-
- virtual data_stream *get_parent() { return NULL; }
-
- virtual bool close() { m_opened = false; m_error = false; m_got_cr = false; return true; }
-
- typedef uint16 attribs_t;
- inline attribs_t get_attribs() const { return m_attribs; }
-
- inline bool is_opened() const { return m_opened; }
-
- inline bool is_readable() const { return utils::is_bit_set(m_attribs, cDataStreamReadable); }
- inline bool is_writable() const { return utils::is_bit_set(m_attribs, cDataStreamWritable); }
- inline bool is_seekable() const { return utils::is_bit_set(m_attribs, cDataStreamSeekable); }
-
- inline bool get_error() const { return m_error; }
-
- inline const dynamic_string& get_name() const { return m_name; }
- inline void set_name(const char* pName) { m_name.set(pName); }
-
- virtual uint read(void* pBuf, uint len) = 0;
- virtual uint64 skip(uint64 len);
-
- virtual uint write(const void* pBuf, uint len) = 0;
- virtual bool flush() = 0;
-
- virtual bool is_size_known() const { return true; }
-
- // Returns DATA_STREAM_SIZE_UNKNOWN if size hasn't been determined yet, or DATA_STREAM_SIZE_INFINITE for infinite streams.
- virtual uint64 get_size() = 0;
- virtual uint64 get_remaining() = 0;
-
- virtual uint64 get_ofs() = 0;
- virtual bool seek(int64 ofs, bool relative) = 0;
-
- virtual const void* get_ptr() const { return NULL; }
-
- inline int read_byte() { uint8 c; if (read(&c, 1) != 1) return -1; return c; }
- inline bool write_byte(uint8 c) { return write(&c, 1) == 1; }
-
- bool read_line(dynamic_string& str);
- bool printf(const char* p, ...);
- bool write_line(const dynamic_string& str);
- bool write_bom() { uint16 bom = 0xFEFF; return write(&bom, sizeof(bom)) == sizeof(bom); }
-
- bool read_array(vector<uint8>& buf);
- bool write_array(const vector<uint8>& buf);
-
- protected:
- dynamic_string m_name;
-
- attribs_t m_attribs;
- bool m_opened : 1;
- bool m_error : 1;
- bool m_got_cr : 1;
-
- inline void set_error() { m_error = true; }
- inline void clear_error() { m_error = false; }
-
- inline void post_seek() { m_got_cr = false; }
- };
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_data_stream_serializer.h b/Libraries/crunch-ea9b8d/crnlib/crn_data_stream_serializer.h
deleted file mode 100644
index c249f9a5..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_data_stream_serializer.h
+++ /dev/null
@@ -1,468 +0,0 @@
-// File: data_stream_serializer.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_data_stream.h"
-
-namespace crnlib
-{
- // Defaults to little endian mode.
- class data_stream_serializer
- {
- public:
- data_stream_serializer() : m_pStream(NULL), m_little_endian(true) { }
- data_stream_serializer(data_stream* pStream) : m_pStream(pStream), m_little_endian(true) { }
- data_stream_serializer(data_stream& stream) : m_pStream(&stream), m_little_endian(true) { }
- data_stream_serializer(const data_stream_serializer& other) : m_pStream(other.m_pStream), m_little_endian(other.m_little_endian) { }
-
- data_stream_serializer& operator= (const data_stream_serializer& rhs) { m_pStream = rhs.m_pStream; m_little_endian = rhs.m_little_endian; return *this; }
-
- data_stream* get_stream() const { return m_pStream; }
- void set_stream(data_stream* pStream) { m_pStream = pStream; }
-
- const dynamic_string& get_name() const { return m_pStream ? m_pStream->get_name() : g_empty_dynamic_string; }
-
- bool get_error() { return m_pStream ? m_pStream->get_error() : false; }
-
- bool get_little_endian() const { return m_little_endian; }
- void set_little_endian(bool little_endian) { m_little_endian = little_endian; }
-
- bool write(const void* pBuf, uint len)
- {
- return m_pStream->write(pBuf, len) == len;
- }
-
- bool read(void* pBuf, uint len)
- {
- return m_pStream->read(pBuf, len) == len;
- }
-
- // size = size of each element, count = number of elements, returns actual count of elements written
- uint write(const void* pBuf, uint size, uint count)
- {
- uint actual_size = size * count;
- if (!actual_size)
- return 0;
- uint n = m_pStream->write(pBuf, actual_size);
- if (n == actual_size)
- return count;
- return n / size;
- }
-
- // size = size of each element, count = number of elements, returns actual count of elements read
- uint read(void* pBuf, uint size, uint count)
- {
- uint actual_size = size * count;
- if (!actual_size)
- return 0;
- uint n = m_pStream->read(pBuf, actual_size);
- if (n == actual_size)
- return count;
- return n / size;
- }
-
- bool write_chars(const char* pBuf, uint len)
- {
- return write(pBuf, len);
- }
-
- bool read_chars(char* pBuf, uint len)
- {
- return read(pBuf, len);
- }
-
- bool skip(uint len)
- {
- return m_pStream->skip(len) == len;
- }
-
- template<typename T>
- bool write_object(const T& obj)
- {
- if (m_little_endian == c_crnlib_little_endian_platform)
- return write(&obj, sizeof(obj));
- else
- {
- uint8 buf[sizeof(T)];
- uint buf_size = sizeof(T);
- void* pBuf = buf;
- utils::write_obj(obj, pBuf, buf_size, m_little_endian);
-
- return write(buf, sizeof(T));
- }
- }
-
- template<typename T>
- bool read_object(T& obj)
- {
- if (m_little_endian == c_crnlib_little_endian_platform)
- return read(&obj, sizeof(obj));
- else
- {
- uint8 buf[sizeof(T)];
- if (!read(buf, sizeof(T)))
- return false;
-
- uint buf_size = sizeof(T);
- const void* pBuf = buf;
- utils::read_obj(obj, pBuf, buf_size, m_little_endian);
-
- return true;
- }
- }
-
- template<typename T>
- bool write_value(T value)
- {
- return write_object(value);
- }
-
- template<typename T>
- T read_value(const T& on_error_value = T())
- {
- T result;
- if (!read_object(result))
- result = on_error_value;
- return result;
- }
-
- template<typename T>
- bool write_enum(T e)
- {
- int val = static_cast<int>(e);
- return write_object(val);
- }
-
- template<typename T>
- T read_enum()
- {
- return static_cast<T>(read_value<int>());
- }
-
- // Writes uint using a simple variable length code (VLC).
- bool write_uint_vlc(uint val)
- {
- do
- {
- uint8 c = static_cast<uint8>(val) & 0x7F;
- if (val <= 0x7F)
- c |= 0x80;
-
- if (!write_value(c))
- return false;
-
- val >>= 7;
- } while (val);
-
- return true;
- }
-
- // Reads uint using a simple variable length code (VLC).
- bool read_uint_vlc(uint& val)
- {
- val = 0;
- uint shift = 0;
-
- for ( ; ; )
- {
- if (shift >= 32)
- return false;
-
- uint8 c;
- if (!read_object(c))
- return false;
-
- val |= ((c & 0x7F) << shift);
- shift += 7;
-
- if (c & 0x80)
- break;
- }
-
- return true;
- }
-
- bool write_c_str(const char* p)
- {
- uint len = static_cast<uint>(strlen(p));
- if (!write_uint_vlc(len))
- return false;
-
- return write_chars(p, len);
- }
-
- bool read_c_str(char* pBuf, uint buf_size)
- {
- uint len;
- if (!read_uint_vlc(len))
- return false;
- if ((len + 1) > buf_size)
- return false;
-
- pBuf[len] = '\0';
-
- return read_chars(pBuf, len);
- }
-
- bool write_string(const dynamic_string& str)
- {
- if (!write_uint_vlc(str.get_len()))
- return false;
-
- return write_chars(str.get_ptr(), str.get_len());
- }
-
- bool read_string(dynamic_string& str)
- {
- uint len;
- if (!read_uint_vlc(len))
- return false;
-
- if (!str.set_len(len))
- return false;
-
- if (len)
- {
- if (!read_chars(str.get_ptr_raw(), len))
- return false;
-
- if (memchr(str.get_ptr(), 0, len) != NULL)
- {
- str.truncate(0);
- return false;
- }
- }
-
- return true;
- }
-
- template<typename T>
- bool write_vector(const T& vec)
- {
- if (!write_uint_vlc(vec.size()))
- return false;
-
- for (uint i = 0; i < vec.size(); i++)
- {
- *this << vec[i];
- if (get_error())
- return false;
- }
-
- return true;
- };
-
- template<typename T>
- bool read_vector(T& vec, uint num_expected = UINT_MAX)
- {
- uint size;
- if (!read_uint_vlc(size))
- return false;
-
- if ((size * sizeof(T::value_type)) >= 2U*1024U*1024U*1024U)
- return false;
-
- if ((num_expected != UINT_MAX) && (size != num_expected))
- return false;
-
- vec.resize(size);
- for (uint i = 0; i < vec.size(); i++)
- {
- *this >> vec[i];
-
- if (get_error())
- return false;
- }
-
- return true;
- }
-
- bool read_entire_file(crnlib::vector<uint8>& buf)
- {
- return m_pStream->read_array(buf);
- }
-
- bool write_entire_file(const crnlib::vector<uint8>& buf)
- {
- return m_pStream->write_array(buf);
- }
-
- // Got this idea from the Molly Rocket forums.
- // fmt may contain the characters "1", "2", or "4".
- bool writef(char *fmt, ...)
- {
- va_list v;
- va_start(v, fmt);
-
- while (*fmt)
- {
- switch (*fmt++)
- {
- case '1':
- {
- const uint8 x = static_cast<uint8>(va_arg(v, uint));
- if (!write_value(x))
- return false;
- }
- case '2':
- {
- const uint16 x = static_cast<uint16>(va_arg(v, uint));
- if (!write_value(x))
- return false;
- }
- case '4':
- {
- const uint32 x = static_cast<uint32>(va_arg(v, uint));
- if (!write_value(x))
- return false;
- }
- case ' ':
- case ',':
- {
- break;
- }
- default:
- {
- CRNLIB_ASSERT(0);
- return false;
- }
- }
- }
-
- va_end(v);
- return true;
- }
-
- // Got this idea from the Molly Rocket forums.
- // fmt may contain the characters "1", "2", or "4".
- bool readf(char *fmt, ...)
- {
- va_list v;
- va_start(v, fmt);
-
- while (*fmt)
- {
- switch (*fmt++)
- {
- case '1':
- {
- uint8* x = va_arg(v, uint8*);
- CRNLIB_ASSERT(x);
- if (!read_object(*x))
- return false;
- }
- case '2':
- {
- uint16* x = va_arg(v, uint16*);
- CRNLIB_ASSERT(x);
- if (!read_object(*x))
- return false;
- }
- case '4':
- {
- uint32* x = va_arg(v, uint32*);
- CRNLIB_ASSERT(x);
- if (!read_object(*x))
- return false;
- }
- case ' ':
- case ',':
- {
- break;
- }
- default:
- {
- CRNLIB_ASSERT(0);
- return false;
- }
- }
- }
-
- va_end(v);
- return true;
- }
-
- private:
- data_stream* m_pStream;
-
- bool m_little_endian;
- };
-
- // Write operators
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, bool val) { serializer.write_value(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, int8 val) { serializer.write_value(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, uint8 val) { serializer.write_value(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, int16 val) { serializer.write_value(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, uint16 val) { serializer.write_value(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, int32 val) { serializer.write_value(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, uint32 val) { serializer.write_uint_vlc(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, int64 val) { serializer.write_value(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, uint64 val) { serializer.write_value(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, long val) { serializer.write_value(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, unsigned long val) { serializer.write_value(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, float val) { serializer.write_value(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, double val) { serializer.write_value(val); return serializer; }
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, const char* p) { serializer.write_c_str(p); return serializer; }
-
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, const dynamic_string& str)
- {
- serializer.write_string(str);
- return serializer;
- }
-
- template<typename T>
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, const crnlib::vector<T>& vec)
- {
- serializer.write_vector(vec);
- return serializer;
- }
-
- template<typename T>
- inline data_stream_serializer& operator<< (data_stream_serializer& serializer, const T* p)
- {
- serializer.write_object(*p);
- return serializer;
- }
-
- // Read operators
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, bool& val) { serializer.read_object(val); return serializer; }
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, int8& val) { serializer.read_object(val); return serializer; }
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, uint8& val) { serializer.read_object(val); return serializer; }
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, int16& val) { serializer.read_object(val); return serializer; }
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, uint16& val) { serializer.read_object(val); return serializer; }
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, int32& val) { serializer.read_object(val); return serializer; }
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, uint32& val) { serializer.read_uint_vlc(val); return serializer; }
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, int64& val) { serializer.read_object(val); return serializer; }
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, uint64& val) { serializer.read_object(val); return serializer; }
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, long& val) { serializer.read_object(val); return serializer; }
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, unsigned long& val) { serializer.read_object(val); return serializer; }
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, float& val) { serializer.read_object(val); return serializer; }
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, double& val) { serializer.read_object(val); return serializer; }
-
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, dynamic_string& str)
- {
- serializer.read_string(str);
- return serializer;
- }
-
- template<typename T>
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, crnlib::vector<T>& vec)
- {
- serializer.read_vector(vec);
- return serializer;
- }
-
- template<typename T>
- inline data_stream_serializer& operator>> (data_stream_serializer& serializer, T* p)
- {
- serializer.read_object(*p);
- return serializer;
- }
-
-} // namespace crnlib
-
-
-
-
-
-
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dds_comp.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_dds_comp.cpp
deleted file mode 100644
index d988714f..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dds_comp.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-// File: crn_dds_comp.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_dds_comp.h"
-#include "crn_dynamic_stream.h"
-#include "crn_lzma_codec.h"
-
-namespace crnlib
-{
- dds_comp::dds_comp() :
- m_pParams(NULL),
- m_pixel_fmt(PIXEL_FMT_INVALID),
- m_pQDXT_state(NULL)
- {
- }
-
- dds_comp::~dds_comp()
- {
- crnlib_delete(m_pQDXT_state);
- }
-
- void dds_comp::clear()
- {
- m_src_tex.clear();
- m_packed_tex.clear();
- m_comp_data.clear();
- m_pParams = NULL;
- m_pixel_fmt = PIXEL_FMT_INVALID;
- m_task_pool.deinit();
- if (m_pQDXT_state)
- {
- crnlib_delete(m_pQDXT_state);
- m_pQDXT_state = NULL;
- }
- }
-
- bool dds_comp::create_dds_tex(mipmapped_texture &dds_tex)
- {
- image_u8 images[cCRNMaxFaces][cCRNMaxLevels];
-
- bool has_alpha = false;
- for (uint face_index = 0; face_index < m_pParams->m_faces; face_index++)
- {
- for (uint level_index = 0; level_index < m_pParams->m_levels; level_index++)
- {
- const uint width = math::maximum(1U, m_pParams->m_width >> level_index);
- const uint height = math::maximum(1U, m_pParams->m_height >> level_index);
-
- if (!m_pParams->m_pImages[face_index][level_index])
- return false;
-
- images[face_index][level_index].alias((color_quad_u8*)m_pParams->m_pImages[face_index][level_index], width, height);
- if (!has_alpha)
- has_alpha = image_utils::has_alpha(images[face_index][level_index]);
- }
- }
-
- for (uint face_index = 0; face_index < m_pParams->m_faces; face_index++)
- for (uint level_index = 0; level_index < m_pParams->m_levels; level_index++)
- images[face_index][level_index].set_component_valid(3, has_alpha);
-
- image_utils::conversion_type conv_type = image_utils::get_image_conversion_type_from_crn_format((crn_format)m_pParams->m_format);
- if (conv_type != image_utils::cConversion_Invalid)
- {
- for (uint face_index = 0; face_index < m_pParams->m_faces; face_index++)
- {
- for (uint level_index = 0; level_index < m_pParams->m_levels; level_index++)
- {
- image_u8 cooked_image(images[face_index][level_index]);
-
- image_utils::convert_image(cooked_image, conv_type);
-
- images[face_index][level_index].swap(cooked_image);
- }
- }
- }
-
- face_vec faces(m_pParams->m_faces);
-
- for (uint face_index = 0; face_index < m_pParams->m_faces; face_index++)
- {
- for (uint level_index = 0; level_index < m_pParams->m_levels; level_index++)
- {
- mip_level *pMip = crnlib_new<mip_level>();
-
- image_u8 *pImage = crnlib_new<image_u8>();
- pImage->swap(images[face_index][level_index]);
- pMip->assign(pImage);
-
- faces[face_index].push_back(pMip);
- }
- }
-
- dds_tex.assign(faces);
-#ifdef CRNLIB_BUILD_DEBUG
- CRNLIB_ASSERT(dds_tex.check());
-#endif
-
- return true;
- }
-
- static bool progress_callback_func(uint percentage_complete, void* pUser_data_ptr)
- {
- const crn_comp_params& params = *(const crn_comp_params*)pUser_data_ptr;
- return params.m_pProgress_func(0, 1, percentage_complete, 100, params.m_pProgress_func_data) != 0;
- }
-
- static bool progress_callback_func_phase_0(uint percentage_complete, void* pUser_data_ptr)
- {
- const crn_comp_params& params = *(const crn_comp_params*)pUser_data_ptr;
- return params.m_pProgress_func(0, 2, percentage_complete, 100, params.m_pProgress_func_data) != 0;
- }
-
- static bool progress_callback_func_phase_1(uint percentage_complete, void* pUser_data_ptr)
- {
- const crn_comp_params& params = *(const crn_comp_params*)pUser_data_ptr;
- return params.m_pProgress_func(1, 2, percentage_complete, 100, params.m_pProgress_func_data) != 0;
- }
-
- bool dds_comp::convert_to_dxt(const crn_comp_params& params)
- {
- if ((params.m_quality_level == cCRNMaxQualityLevel) || (params.m_format == cCRNFmtDXT3))
- {
- m_packed_tex = m_src_tex;
- if (!m_packed_tex.convert(m_pixel_fmt, false, m_pack_params))
- return false;
- }
- else
- {
- const bool hierarchical = (params.m_flags & cCRNCompFlagHierarchical) != 0;
-
- m_q1_params.m_quality_level = params.m_quality_level;
- m_q1_params.m_hierarchical = hierarchical;
-
- m_q5_params.m_quality_level = params.m_quality_level;
- m_q5_params.m_hierarchical = hierarchical;
-
- if (!m_pQDXT_state)
- {
- m_pQDXT_state = crnlib_new<mipmapped_texture::qdxt_state>(m_task_pool);
-
- if (params.m_pProgress_func)
- {
- m_q1_params.m_pProgress_func = progress_callback_func_phase_0;
- m_q1_params.m_pProgress_data = (void*)&params;
- m_q5_params.m_pProgress_func = progress_callback_func_phase_0;
- m_q5_params.m_pProgress_data = (void*)&params;
- }
-
- if (!m_src_tex.qdxt_pack_init(*m_pQDXT_state, m_packed_tex, m_q1_params, m_q5_params, m_pixel_fmt, false))
- return false;
-
- if (params.m_pProgress_func)
- {
- m_q1_params.m_pProgress_func = progress_callback_func_phase_1;
- m_q5_params.m_pProgress_func = progress_callback_func_phase_1;
- }
- }
- else
- {
- if (params.m_pProgress_func)
- {
- m_q1_params.m_pProgress_func = progress_callback_func;
- m_q1_params.m_pProgress_data = (void*)&params;
- m_q5_params.m_pProgress_func = progress_callback_func;
- m_q5_params.m_pProgress_data = (void*)&params;
- }
- }
-
- if (!m_src_tex.qdxt_pack(*m_pQDXT_state, m_packed_tex, m_q1_params, m_q5_params))
- return false;
- }
-
- return true;
- }
-
- bool dds_comp::compress_init(const crn_comp_params& params)
- {
- clear();
-
- m_pParams = &params;
-
- if ((math::minimum(m_pParams->m_width, m_pParams->m_height) < 1) || (math::maximum(m_pParams->m_width, m_pParams->m_height) > cCRNMaxLevelResolution))
- return false;
-
- if (math::minimum(m_pParams->m_faces, m_pParams->m_levels) < 1)
- return false;
-
- if (!create_dds_tex(m_src_tex))
- return false;
-
- m_pack_params.init(*m_pParams);
- if (params.m_pProgress_func)
- {
- m_pack_params.m_pProgress_callback = progress_callback_func;
- m_pack_params.m_pProgress_callback_user_data_ptr = (void*)&params;
- }
-
- m_pixel_fmt = pixel_format_helpers::convert_crn_format_to_pixel_format(static_cast<crn_format>(m_pParams->m_format));
- if (m_pixel_fmt == PIXEL_FMT_INVALID)
- return false;
- if ((m_pixel_fmt == PIXEL_FMT_DXT1) && (m_src_tex.has_alpha()) && (m_pack_params.m_use_both_block_types) && (m_pParams->m_flags & cCRNCompFlagDXT1AForTransparency))
- m_pixel_fmt = PIXEL_FMT_DXT1A;
-
- if (!m_task_pool.init(m_pParams->m_num_helper_threads))
- return false;
- m_pack_params.m_pTask_pool = &m_task_pool;
-
- const bool hierarchical = (params.m_flags & cCRNCompFlagHierarchical) != 0;
- m_q1_params.init(m_pack_params, params.m_quality_level, hierarchical);
- m_q5_params.init(m_pack_params, params.m_quality_level, hierarchical);
-
- return true;
- }
-
- bool dds_comp::compress_pass(const crn_comp_params& params, float *pEffective_bitrate)
- {
- if (pEffective_bitrate) *pEffective_bitrate = 0.0f;
-
- if (!m_pParams)
- return false;
-
- if (!convert_to_dxt(params))
- return false;
-
- dynamic_stream out_stream;
- out_stream.reserve(512*1024);
- data_stream_serializer serializer(out_stream);
-
- if (!m_packed_tex.write_dds(serializer))
- return false;
- out_stream.reserve(0);
-
- m_comp_data.swap(out_stream.get_buf());
-
- if (pEffective_bitrate)
- {
- lzma_codec lossless_codec;
-
- crnlib::vector<uint8> cmp_tex_bytes;
- if (lossless_codec.pack(m_comp_data.get_ptr(), m_comp_data.size(), cmp_tex_bytes))
- {
- uint comp_size = cmp_tex_bytes.size();
- if (comp_size)
- {
- *pEffective_bitrate = (comp_size * 8.0f) / m_src_tex.get_total_pixels_in_all_faces_and_mips();
- }
- }
- }
-
- return true;
- }
-
- void dds_comp::compress_deinit()
- {
- clear();
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dds_comp.h b/Libraries/crunch-ea9b8d/crnlib/crn_dds_comp.h
deleted file mode 100644
index a98ce24a..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dds_comp.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// File: crn_comp.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_comp.h"
-#include "crn_mipmapped_texture.h"
-#include "crn_texture_comp.h"
-
-namespace crnlib
-{
- class dds_comp : public itexture_comp
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(dds_comp);
-
- public:
- dds_comp();
- virtual ~dds_comp();
-
- virtual const char *get_ext() const { return "DDS"; }
-
- virtual bool compress_init(const crn_comp_params& params);
- virtual bool compress_pass(const crn_comp_params& params, float *pEffective_bitrate);
- virtual void compress_deinit();
-
- virtual const crnlib::vector<uint8>& get_comp_data() const { return m_comp_data; }
- virtual crnlib::vector<uint8>& get_comp_data() { return m_comp_data; }
-
- private:
- mipmapped_texture m_src_tex;
- mipmapped_texture m_packed_tex;
-
- crnlib::vector<uint8> m_comp_data;
-
- const crn_comp_params* m_pParams;
-
- pixel_format m_pixel_fmt;
- dxt_image::pack_params m_pack_params;
-
- task_pool m_task_pool;
- qdxt1_params m_q1_params;
- qdxt5_params m_q5_params;
- mipmapped_texture::qdxt_state *m_pQDXT_state;
-
- void clear();
- bool create_dds_tex(mipmapped_texture &dds_tex);
- bool convert_to_dxt(const crn_comp_params& params);
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_decomp.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_decomp.cpp
deleted file mode 100644
index a8562255..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_decomp.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-// File: crn_decomp.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-
-// Include the single-file header library with no defines, which brings in the full CRN decompressor.
-#include "../inc/crn_decomp.h"
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_dxt.cpp
deleted file mode 100644
index bb8c6163..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt.cpp
+++ /dev/null
@@ -1,386 +0,0 @@
-// File: crn_dxt.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_dxt.h"
-#include "crn_dxt1.h"
-#include "crn_ryg_dxt.hpp"
-#include "crn_dxt_fast.h"
-#include "crn_intersect.h"
-
-namespace crnlib
-{
- const uint8 g_dxt5_from_linear[cDXT5SelectorValues] = { 0U, 2U, 3U, 4U, 5U, 6U, 7U, 1U };
- const uint8 g_dxt5_to_linear[cDXT5SelectorValues] = { 0U, 7U, 1U, 2U, 3U, 4U, 5U, 6U };
-
- const uint8 g_dxt5_alpha6_to_linear[cDXT5SelectorValues] = { 0U, 5U, 1U, 2U, 3U, 4U, 0U, 0U };
-
- const uint8 g_dxt1_from_linear[cDXT1SelectorValues] = { 0U, 2U, 3U, 1U };
- const uint8 g_dxt1_to_linear[cDXT1SelectorValues] = { 0U, 3U, 1U, 2U };
-
- const uint8 g_six_alpha_invert_table[cDXT5SelectorValues] = { 1, 0, 5, 4, 3, 2, 6, 7 };
- const uint8 g_eight_alpha_invert_table[cDXT5SelectorValues] = { 1, 0, 7, 6, 5, 4, 3, 2 };
-
- const char* get_dxt_format_string(dxt_format fmt)
- {
- switch (fmt)
- {
- case cDXT1: return "DXT1";
- case cDXT1A: return "DXT1A";
- case cDXT3: return "DXT3";
- case cDXT5: return "DXT5";
- case cDXT5A: return "DXT5A";
- case cDXN_XY: return "DXN_XY";
- case cDXN_YX: return "DXN_YX";
- case cETC1: return "ETC1";
- default: break;
- }
- CRNLIB_ASSERT(false);
- return "?";
- }
-
- const char* get_dxt_compressor_name(crn_dxt_compressor_type c)
- {
- switch (c)
- {
- case cCRNDXTCompressorCRN: return "CRN";
- case cCRNDXTCompressorCRNF: return "CRNF";
- case cCRNDXTCompressorRYG: return "RYG";
-#if CRNLIB_SUPPORT_ATI_COMPRESS
- case cCRNDXTCompressorATI: return "ATI";
-#endif
- default: break;
- }
- CRNLIB_ASSERT(false);
- return "?";
- }
-
- uint get_dxt_format_bits_per_pixel(dxt_format fmt)
- {
- switch (fmt)
- {
- case cDXT1:
- case cDXT1A:
- case cDXT5A:
- case cETC1:
- return 4;
- case cDXT3:
- case cDXT5:
- case cDXN_XY:
- case cDXN_YX:
- return 8;
- default: break;
- }
- CRNLIB_ASSERT(false);
- return 0;
- }
-
- bool get_dxt_format_has_alpha(dxt_format fmt)
- {
- switch (fmt)
- {
- case cDXT1A:
- case cDXT3:
- case cDXT5:
- case cDXT5A:
- return true;
- default: break;
- }
- return false;
- }
-
- uint16 dxt1_block::pack_color(const color_quad_u8& color, bool scaled, uint bias)
- {
- uint r = color.r;
- uint g = color.g;
- uint b = color.b;
-
- if (scaled)
- {
- r = (r * 31U + bias) / 255U;
- g = (g * 63U + bias) / 255U;
- b = (b * 31U + bias) / 255U;
- }
-
- r = math::minimum(r, 31U);
- g = math::minimum(g, 63U);
- b = math::minimum(b, 31U);
-
- return static_cast<uint16>(b | (g << 5U) | (r << 11U));
- }
-
- uint16 dxt1_block::pack_color(uint r, uint g, uint b, bool scaled, uint bias)
- {
- return pack_color(color_quad_u8(r, g, b, 0), scaled, bias);
- }
-
- color_quad_u8 dxt1_block::unpack_color(uint16 packed_color, bool scaled, uint alpha)
- {
- uint b = packed_color & 31U;
- uint g = (packed_color >> 5U) & 63U;
- uint r = (packed_color >> 11U) & 31U;
-
- if (scaled)
- {
- b = (b << 3U) | (b >> 2U);
- g = (g << 2U) | (g >> 4U);
- r = (r << 3U) | (r >> 2U);
- }
-
- return color_quad_u8(cNoClamp, r, g, b, math::minimum(alpha, 255U));
- }
-
- void dxt1_block::unpack_color(uint& r, uint& g, uint& b, uint16 packed_color, bool scaled)
- {
- color_quad_u8 c(unpack_color(packed_color, scaled, 0));
- r = c.r;
- g = c.g;
- b = c.b;
- }
-
- void dxt1_block::get_block_colors_NV5x(color_quad_u8* pDst, uint16 packed_col0, uint16 packed_col1, bool color4)
- {
- color_quad_u8 col0(unpack_color(packed_col0, false));
- color_quad_u8 col1(unpack_color(packed_col1, false));
-
- pDst[0].r = (3 * col0.r * 22) / 8;
- pDst[0].b = (3 * col0.b * 22) / 8;
- pDst[0].g = (col0.g << 2) | (col0.g >> 4);
- pDst[0].a = 0xFF;
-
- pDst[1].r = (3 * col1.r * 22) / 8;
- pDst[1].g = (col1.g << 2) | (col1.g >> 4);
- pDst[1].b = (3 * col1.b * 22) / 8;
- pDst[1].a = 0xFF;
-
- int gdiff = pDst[1].g - pDst[0].g;
-
- if (color4) //(packed_col0 > packed_col1)
- {
- pDst[2].r = static_cast<uint8>(((2 * col0.r + col1.r) * 22) / 8);
- pDst[2].g = static_cast<uint8>((256 * pDst[0].g + gdiff/4 + 128 + gdiff * 80) / 256);
- pDst[2].b = static_cast<uint8>(((2 * col0.b + col1.b) * 22) / 8);
- pDst[2].a = 0xFF;
-
- pDst[3].r = static_cast<uint8>(((2 * col1.r + col0.r) * 22) / 8);
- pDst[3].g = static_cast<uint8>((256 * pDst[1].g - gdiff/4 + 128 - gdiff * 80) / 256);
- pDst[3].b = static_cast<uint8>(((2 * col1.b + col0.b) * 22) / 8);
- pDst[3].a = 0xFF;
- }
- else {
- pDst[2].r = static_cast<uint8>(((col0.r + col1.r) * 33) / 8);
- pDst[2].g = static_cast<uint8>((256 * pDst[0].g + gdiff/4 + 128 + gdiff * 128) / 256);
- pDst[2].b = static_cast<uint8>(((col0.b + col1.b) * 33) / 8);
- pDst[2].a = 0xFF;
-
- pDst[3].r = 0x00;
- pDst[3].g = 0x00;
- pDst[3].b = 0x00;
- pDst[3].a = 0x00;
- }
- }
-
- uint dxt1_block::get_block_colors3(color_quad_u8* pDst, uint16 color0, uint16 color1)
- {
- color_quad_u8 c0(unpack_color(color0, true));
- color_quad_u8 c1(unpack_color(color1, true));
-
- pDst[0] = c0;
- pDst[1] = c1;
- pDst[2].set_noclamp_rgba( (c0.r + c1.r) >> 1U, (c0.g + c1.g) >> 1U, (c0.b + c1.b) >> 1U, 255U);
- pDst[3].set_noclamp_rgba(0, 0, 0, 0);
-
- return 3;
- }
-
- uint dxt1_block::get_block_colors4(color_quad_u8* pDst, uint16 color0, uint16 color1)
- {
- color_quad_u8 c0(unpack_color(color0, true));
- color_quad_u8 c1(unpack_color(color1, true));
-
- pDst[0] = c0;
- pDst[1] = c1;
-
- // The compiler changes the div3 into a mul by recip+shift.
- pDst[2].set_noclamp_rgba( (c0.r * 2 + c1.r) / 3, (c0.g * 2 + c1.g) / 3, (c0.b * 2 + c1.b) / 3, 255U);
- pDst[3].set_noclamp_rgba( (c1.r * 2 + c0.r) / 3, (c1.g * 2 + c0.g) / 3, (c1.b * 2 + c0.b) / 3, 255U);
-
- return 4;
- }
-
- uint dxt1_block::get_block_colors3_round(color_quad_u8* pDst, uint16 color0, uint16 color1)
- {
- color_quad_u8 c0(unpack_color(color0, true));
- color_quad_u8 c1(unpack_color(color1, true));
-
- pDst[0] = c0;
- pDst[1] = c1;
- pDst[2].set_noclamp_rgba( (c0.r + c1.r + 1) >> 1U, (c0.g + c1.g + 1) >> 1U, (c0.b + c1.b + 1) >> 1U, 255U);
- pDst[3].set_noclamp_rgba(0, 0, 0, 0);
-
- return 3;
- }
-
- uint dxt1_block::get_block_colors4_round(color_quad_u8* pDst, uint16 color0, uint16 color1)
- {
- color_quad_u8 c0(unpack_color(color0, true));
- color_quad_u8 c1(unpack_color(color1, true));
-
- pDst[0] = c0;
- pDst[1] = c1;
-
- // 12/14/08 - Supposed to round according to DX docs, but this conflicts with the OpenGL S3TC spec. ?
- // The compiler changes the div3 into a mul by recip+shift.
- pDst[2].set_noclamp_rgba( (c0.r * 2 + c1.r + 1) / 3, (c0.g * 2 + c1.g + 1) / 3, (c0.b * 2 + c1.b + 1) / 3, 255U);
- pDst[3].set_noclamp_rgba( (c1.r * 2 + c0.r + 1) / 3, (c1.g * 2 + c0.g + 1) / 3, (c1.b * 2 + c0.b + 1) / 3, 255U);
-
- return 4;
- }
-
- uint dxt1_block::get_block_colors(color_quad_u8* pDst, uint16 color0, uint16 color1)
- {
- if (color0 > color1)
- return get_block_colors4(pDst, color0, color1);
- else
- return get_block_colors3(pDst, color0, color1);
- }
-
- uint dxt1_block::get_block_colors_round(color_quad_u8* pDst, uint16 color0, uint16 color1)
- {
- if (color0 > color1)
- return get_block_colors4_round(pDst, color0, color1);
- else
- return get_block_colors3_round(pDst, color0, color1);
- }
-
- color_quad_u8 dxt1_block::unpack_endpoint(uint32 endpoints, uint index, bool scaled, uint alpha)
- {
- CRNLIB_ASSERT(index < 2);
- return unpack_color( static_cast<uint16>((endpoints >> (index * 16U)) & 0xFFFFU), scaled, alpha );
- }
-
- uint dxt1_block::pack_endpoints(uint lo, uint hi)
- {
- CRNLIB_ASSERT((lo <= 0xFFFFU) && (hi <= 0xFFFFU));
- return lo | (hi << 16U);
- }
-
- void dxt3_block::set_alpha(uint x, uint y, uint value, bool scaled)
- {
- CRNLIB_ASSERT((x < cDXTBlockSize) && (y < cDXTBlockSize));
-
- if (scaled)
- {
- CRNLIB_ASSERT(value <= 0xFF);
- value = (value * 15U + 128U) / 255U;
- }
- else
- {
- CRNLIB_ASSERT(value <= 0xF);
- }
-
- uint ofs = (y << 1U) + (x >> 1U);
- uint c = m_alpha[ofs];
-
- c &= ~(0xF << ((x & 1U) << 2U));
- c |= (value << ((x & 1U) << 2U));
-
- m_alpha[ofs] = static_cast<uint8>(c);
- }
-
- uint dxt3_block::get_alpha(uint x, uint y, bool scaled) const
- {
- CRNLIB_ASSERT((x < cDXTBlockSize) && (y < cDXTBlockSize));
-
- uint value = m_alpha[(y << 1U) + (x >> 1U)];
- if (x & 1)
- value >>= 4;
- value &= 0xF;
-
- if (scaled)
- value = (value << 4U) | value;
-
- return value;
- }
-
- uint dxt5_block::get_block_values6(color_quad_u8* pDst, uint l, uint h)
- {
- pDst[0].a = static_cast<uint8>(l);
- pDst[1].a = static_cast<uint8>(h);
- pDst[2].a = static_cast<uint8>((l * 4 + h ) / 5);
- pDst[3].a = static_cast<uint8>((l * 3 + h * 2) / 5);
- pDst[4].a = static_cast<uint8>((l * 2 + h * 3) / 5);
- pDst[5].a = static_cast<uint8>((l + h * 4) / 5);
- pDst[6].a = 0;
- pDst[7].a = 255;
- return 6;
- }
-
- uint dxt5_block::get_block_values8(color_quad_u8* pDst, uint l, uint h)
- {
- pDst[0].a = static_cast<uint8>(l);
- pDst[1].a = static_cast<uint8>(h);
- pDst[2].a = static_cast<uint8>((l * 6 + h ) / 7);
- pDst[3].a = static_cast<uint8>((l * 5 + h * 2) / 7);
- pDst[4].a = static_cast<uint8>((l * 4 + h * 3) / 7);
- pDst[5].a = static_cast<uint8>((l * 3 + h * 4) / 7);
- pDst[6].a = static_cast<uint8>((l * 2 + h * 5) / 7);
- pDst[7].a = static_cast<uint8>((l + h * 6) / 7);
- return 8;
- }
-
- uint dxt5_block::get_block_values(color_quad_u8* pDst, uint l, uint h)
- {
- if (l > h)
- return get_block_values8(pDst, l, h);
- else
- return get_block_values6(pDst, l, h);
- }
-
- uint dxt5_block::get_block_values6(uint* pDst, uint l, uint h)
- {
- pDst[0] = l;
- pDst[1] = h;
- pDst[2] = (l * 4 + h ) / 5;
- pDst[3] = (l * 3 + h * 2) / 5;
- pDst[4] = (l * 2 + h * 3) / 5;
- pDst[5] = (l + h * 4) / 5;
- pDst[6] = 0;
- pDst[7] = 255;
- return 6;
- }
-
- uint dxt5_block::get_block_values8(uint* pDst, uint l, uint h)
- {
- pDst[0] = l;
- pDst[1] = h;
- pDst[2] = (l * 6 + h ) / 7;
- pDst[3] = (l * 5 + h * 2) / 7;
- pDst[4] = (l * 4 + h * 3) / 7;
- pDst[5] = (l * 3 + h * 4) / 7;
- pDst[6] = (l * 2 + h * 5) / 7;
- pDst[7] = (l + h * 6) / 7;
- return 8;
- }
-
- uint dxt5_block::unpack_endpoint(uint packed, uint index)
- {
- CRNLIB_ASSERT(index < 2);
- return (packed >> (8 * index)) & 0xFF;
- }
-
- uint dxt5_block::pack_endpoints(uint lo, uint hi)
- {
- CRNLIB_ASSERT((lo <= 0xFF) && (hi <= 0xFF));
- return lo | (hi << 8U);
- }
-
- uint dxt5_block::get_block_values(uint* pDst, uint l, uint h)
- {
- if (l > h)
- return get_block_values8(pDst, l, h);
- else
- return get_block_values6(pDst, l, h);
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt.h b/Libraries/crunch-ea9b8d/crnlib/crn_dxt.h
deleted file mode 100644
index f95349c3..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt.h
+++ /dev/null
@@ -1,361 +0,0 @@
-// File: crn_dxt.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "../inc/crnlib.h"
-#include "crn_color.h"
-#include "crn_vec.h"
-#include "crn_rand.h"
-#include "crn_sparse_bit_array.h"
-#include "crn_hash_map.h"
-#include <map>
-
-#define CRNLIB_DXT_ALT_ROUNDING 1
-
-namespace crnlib
-{
- enum dxt_constants
- {
- cDXT1BytesPerBlock = 8U,
- cDXT5NBytesPerBlock = 16U,
-
- cDXT5SelectorBits = 3U,
- cDXT5SelectorValues = 1U << cDXT5SelectorBits,
- cDXT5SelectorMask = cDXT5SelectorValues - 1U,
-
- cDXT1SelectorBits = 2U,
- cDXT1SelectorValues = 1U << cDXT1SelectorBits,
- cDXT1SelectorMask = cDXT1SelectorValues - 1U,
-
- cDXTBlockShift = 2U,
- cDXTBlockSize = 1U << cDXTBlockShift
- };
-
- enum dxt_format
- {
- cDXTInvalid = -1,
-
- // cDXT1/1A must appear first!
- cDXT1,
- cDXT1A,
-
- cDXT3,
- cDXT5,
- cDXT5A,
-
- cDXN_XY, // inverted relative to standard ATI2, 360's DXN
- cDXN_YX, // standard ATI2,
-
- cETC1 // Ericsson texture compression (color only, 4x4 blocks, 4bpp, 64-bits/block)
- };
-
- const float cDXT1MaxLinearValue = 3.0f;
- const float cDXT1InvMaxLinearValue = 1.0f/3.0f;
-
- const float cDXT5MaxLinearValue = 7.0f;
- const float cDXT5InvMaxLinearValue = 1.0f/7.0f;
-
- // Converts DXT1 raw color selector index to a linear value.
- extern const uint8 g_dxt1_to_linear[cDXT1SelectorValues];
-
- // Converts DXT5 raw alpha selector index to a linear value.
- extern const uint8 g_dxt5_to_linear[cDXT5SelectorValues];
-
- // Converts DXT1 linear color selector index to a raw value (inverse of g_dxt1_to_linear).
- extern const uint8 g_dxt1_from_linear[cDXT1SelectorValues];
-
- // Converts DXT5 linear alpha selector index to a raw value (inverse of g_dxt5_to_linear).
- extern const uint8 g_dxt5_from_linear[cDXT5SelectorValues];
-
- extern const uint8 g_dxt5_alpha6_to_linear[cDXT5SelectorValues];
-
- extern const uint8 g_six_alpha_invert_table[cDXT5SelectorValues];
- extern const uint8 g_eight_alpha_invert_table[cDXT5SelectorValues];
-
- const char* get_dxt_format_string(dxt_format fmt);
- uint get_dxt_format_bits_per_pixel(dxt_format fmt);
- bool get_dxt_format_has_alpha(dxt_format fmt);
-
- const char* get_dxt_quality_string(crn_dxt_quality q);
-
- const char* get_dxt_compressor_name(crn_dxt_compressor_type c);
-
- struct dxt1_block
- {
- uint8 m_low_color[2];
- uint8 m_high_color[2];
-
- enum { cNumSelectorBytes = 4 };
- uint8 m_selectors[cNumSelectorBytes];
-
- inline void clear()
- {
- utils::zero_this(this);
- }
-
- // These methods assume the in-memory rep is in LE byte order.
- inline uint get_low_color() const
- {
- return m_low_color[0] | (m_low_color[1] << 8U);
- }
-
- inline uint get_high_color() const
- {
- return m_high_color[0] | (m_high_color[1] << 8U);
- }
-
- inline void set_low_color(uint16 c)
- {
- m_low_color[0] = static_cast<uint8>(c & 0xFF);
- m_low_color[1] = static_cast<uint8>((c >> 8) & 0xFF);
- }
-
- inline void set_high_color(uint16 c)
- {
- m_high_color[0] = static_cast<uint8>(c & 0xFF);
- m_high_color[1] = static_cast<uint8>((c >> 8) & 0xFF);
- }
-
- inline bool is_constant_color_block() const { return get_low_color() == get_high_color(); }
- inline bool is_alpha_block() const { return get_low_color() <= get_high_color(); }
- inline bool is_non_alpha_block() const { return !is_alpha_block(); }
-
- inline uint get_selector(uint x, uint y) const
- {
- CRNLIB_ASSERT((x < 4U) && (y < 4U));
- return (m_selectors[y] >> (x * cDXT1SelectorBits)) & cDXT1SelectorMask;
- }
-
- inline void set_selector(uint x, uint y, uint val)
- {
- CRNLIB_ASSERT((x < 4U) && (y < 4U) && (val < 4U));
-
- m_selectors[y] &= (~(cDXT1SelectorMask << (x * cDXT1SelectorBits)));
- m_selectors[y] |= (val << (x * cDXT1SelectorBits));
- }
-
- inline void flip_x(uint w = 4, uint h = 4)
- {
- for (uint x = 0; x < (w / 2); x++)
- {
- for (uint y = 0; y < h; y++)
- {
- const uint c = get_selector(x, y);
- set_selector(x, y, get_selector((w - 1) - x, y));
- set_selector((w - 1) - x, y, c);
- }
- }
- }
-
- inline void flip_y(uint w = 4, uint h = 4)
- {
- for (uint y = 0; y < (h / 2); y++)
- {
- for (uint x = 0; x < w; x++)
- {
- const uint c = get_selector(x, y);
- set_selector(x, y, get_selector(x, (h - 1) - y));
- set_selector(x, (h - 1) - y, c);
- }
- }
- }
-
- static uint16 pack_color(const color_quad_u8& color, bool scaled, uint bias = 127U);
- static uint16 pack_color(uint r, uint g, uint b, bool scaled, uint bias = 127U);
-
- static color_quad_u8 unpack_color(uint16 packed_color, bool scaled, uint alpha = 255U);
- static void unpack_color(uint& r, uint& g, uint& b, uint16 packed_color, bool scaled);
-
- static uint get_block_colors3(color_quad_u8* pDst, uint16 color0, uint16 color1);
- static uint get_block_colors3_round(color_quad_u8* pDst, uint16 color0, uint16 color1);
-
- static uint get_block_colors4(color_quad_u8* pDst, uint16 color0, uint16 color1);
- static uint get_block_colors4_round(color_quad_u8* pDst, uint16 color0, uint16 color1);
-
- // pDst must point to an array at least cDXT1SelectorValues long.
- static uint get_block_colors(color_quad_u8* pDst, uint16 color0, uint16 color1);
-
- static uint get_block_colors_round(color_quad_u8* pDst, uint16 color0, uint16 color1);
-
- static color_quad_u8 unpack_endpoint(uint32 endpoints, uint index, bool scaled, uint alpha = 255U);
- static uint pack_endpoints(uint lo, uint hi);
-
- static void get_block_colors_NV5x(color_quad_u8* pDst, uint16 packed_col0, uint16 packed_col1, bool color4);
- };
-
- CRNLIB_DEFINE_BITWISE_COPYABLE(dxt1_block);
-
- struct dxt3_block
- {
- enum { cNumAlphaBytes = 8 };
- uint8 m_alpha[cNumAlphaBytes];
-
- void set_alpha(uint x, uint y, uint value, bool scaled);
- uint get_alpha(uint x, uint y, bool scaled) const;
-
- inline void flip_x(uint w = 4, uint h = 4)
- {
- for (uint x = 0; x < (w / 2); x++)
- {
- for (uint y = 0; y < h; y++)
- {
- const uint c = get_alpha(x, y, false);
- set_alpha(x, y, get_alpha((w - 1) - x, y, false), false);
- set_alpha((w - 1) - x, y, c, false);
- }
- }
- }
-
- inline void flip_y(uint w = 4, uint h = 4)
- {
- for (uint y = 0; y < (h / 2); y++)
- {
- for (uint x = 0; x < w; x++)
- {
- const uint c = get_alpha(x, y, false);
- set_alpha(x, y, get_alpha(x, (h - 1) - y, false), false);
- set_alpha(x, (h - 1) - y, c, false);
- }
- }
- }
- };
-
- CRNLIB_DEFINE_BITWISE_COPYABLE(dxt3_block);
-
- struct dxt5_block
- {
- uint8 m_endpoints[2];
-
- enum { cNumSelectorBytes = 6 };
- uint8 m_selectors[cNumSelectorBytes];
-
- inline void clear()
- {
- utils::zero_this(this);
- }
-
- inline uint get_low_alpha() const
- {
- return m_endpoints[0];
- }
-
- inline uint get_high_alpha() const
- {
- return m_endpoints[1];
- }
-
- inline void set_low_alpha(uint i)
- {
- CRNLIB_ASSERT(i <= cUINT8_MAX);
- m_endpoints[0] = static_cast<uint8>(i);
- }
-
- inline void set_high_alpha(uint i)
- {
- CRNLIB_ASSERT(i <= cUINT8_MAX);
- m_endpoints[1] = static_cast<uint8>(i);
- }
-
- inline bool is_alpha6_block() const { return get_low_alpha() <= get_high_alpha(); }
-
- uint get_endpoints_as_word() const { return m_endpoints[0] | (m_endpoints[1] << 8); }
- uint get_selectors_as_word(uint index) { CRNLIB_ASSERT(index < 3); return m_selectors[index * 2] | (m_selectors[index * 2 + 1] << 8); }
-
- inline uint get_selector(uint x, uint y) const
- {
- CRNLIB_ASSERT((x < 4U) && (y < 4U));
-
- uint selector_index = (y * 4) + x;
- uint bit_index = selector_index * cDXT5SelectorBits;
-
- uint byte_index = bit_index >> 3;
- uint bit_ofs = bit_index & 7;
-
- uint v = m_selectors[byte_index];
- if (byte_index < (cNumSelectorBytes - 1))
- v |= (m_selectors[byte_index + 1] << 8);
-
- return (v >> bit_ofs) & 7;
- }
-
- inline void set_selector(uint x, uint y, uint val)
- {
- CRNLIB_ASSERT((x < 4U) && (y < 4U) && (val < 8U));
-
- uint selector_index = (y * 4) + x;
- uint bit_index = selector_index * cDXT5SelectorBits;
-
- uint byte_index = bit_index >> 3;
- uint bit_ofs = bit_index & 7;
-
- uint v = m_selectors[byte_index];
- if (byte_index < (cNumSelectorBytes - 1))
- v |= (m_selectors[byte_index + 1] << 8);
-
- v &= (~(7 << bit_ofs));
- v |= (val << bit_ofs);
-
- m_selectors[byte_index] = static_cast<uint8>(v);
- if (byte_index < (cNumSelectorBytes - 1))
- m_selectors[byte_index + 1] = static_cast<uint8>(v >> 8);
- }
-
- inline void flip_x(uint w = 4, uint h = 4)
- {
- for (uint x = 0; x < (w / 2); x++)
- {
- for (uint y = 0; y < h; y++)
- {
- const uint c = get_selector(x, y);
- set_selector(x, y, get_selector((w - 1) - x, y));
- set_selector((w - 1) - x, y, c);
- }
- }
- }
-
- inline void flip_y(uint w = 4, uint h = 4)
- {
- for (uint y = 0; y < (h / 2); y++)
- {
- for (uint x = 0; x < w; x++)
- {
- const uint c = get_selector(x, y);
- set_selector(x, y, get_selector(x, (h - 1) - y));
- set_selector(x, (h - 1) - y, c);
- }
- }
- }
-
- enum { cMaxSelectorValues = 8 };
-
- // Results written to alpha channel.
- static uint get_block_values6(color_quad_u8* pDst, uint l, uint h);
- static uint get_block_values8(color_quad_u8* pDst, uint l, uint h);
- static uint get_block_values(color_quad_u8* pDst, uint l, uint h);
-
- static uint get_block_values6(uint* pDst, uint l, uint h);
- static uint get_block_values8(uint* pDst, uint l, uint h);
- // pDst must point to an array at least cDXT5SelectorValues long.
- static uint get_block_values(uint* pDst, uint l, uint h);
-
- static uint unpack_endpoint(uint packed, uint index);
- static uint pack_endpoints(uint lo, uint hi);
- };
-
- CRNLIB_DEFINE_BITWISE_COPYABLE(dxt5_block);
-
- struct dxt_pixel_block
- {
- color_quad_u8 m_pixels[cDXTBlockSize][cDXTBlockSize]; // [y][x]
-
- inline void clear()
- {
- utils::zero_object(*this);
- }
- };
-
- CRNLIB_DEFINE_BITWISE_COPYABLE(dxt_pixel_block);
-
-} // namespace crnlib
-
-
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt1.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_dxt1.cpp
deleted file mode 100644
index 34dcf94d..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt1.cpp
+++ /dev/null
@@ -1,2171 +0,0 @@
-// File: crn_dxt1.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-//
-// Notes:
-// This class is not optimized for performance on small blocks, unlike typical DXT1 compressors. It's optimized for scalability and quality:
-// - Very high quality in terms of avg. RMSE or Luma RMSE. Goal is to always match or beat every other known offline DXTc compressor: ATI_Compress, squish, NVidia texture tools, nvdxt.exe, etc.
-// - Reasonable scalability and stability with hundreds to many thousands of input colors (including inputs with many thousands of equal/nearly equal colors).
-// - Any quality optimization which results in even a tiny improvement is worth it -- as long as it's either a constant or linear slowdown.
-// Tiny quality improvements can be extremely valuable in large clusters.
-// - Quality should scale well vs. CPU time cost, i.e. the more time you spend the higher the quality.
-#include "crn_core.h"
-#include "crn_dxt1.h"
-#include "crn_ryg_dxt.hpp"
-#include "crn_dxt_fast.h"
-#include "crn_intersect.h"
-#include "crn_vec_interval.h"
-
-namespace crnlib
-{
- //-----------------------------------------------------------------------------------------------------------------------------------------
-
- static const int16 g_fast_probe_table[] = { 0, 1, 2, 3 };
- static const uint cFastProbeTableSize = sizeof(g_fast_probe_table) / sizeof(g_fast_probe_table[0]);
-
- static const int16 g_normal_probe_table[] = { 0, 1, 3, 5, 7 };
- static const uint cNormalProbeTableSize = sizeof(g_normal_probe_table) / sizeof(g_normal_probe_table[0]);
-
- static const int16 g_better_probe_table[] = { 0, 1, 2, 3, 5, 9, 15, 19, 27, 43 };
- static const uint cBetterProbeTableSize = sizeof(g_better_probe_table) / sizeof(g_better_probe_table[0]);
-
- static const int16 g_uber_probe_table[] = { 0, 1, 2, 3, 5, 7, 9, 10, 13, 15, 19, 27, 43, 59, 91 };
- static const uint cUberProbeTableSize = sizeof(g_uber_probe_table) / sizeof(g_uber_probe_table[0]);
-
- //-----------------------------------------------------------------------------------------------------------------------------------------
-
- dxt1_endpoint_optimizer::dxt1_endpoint_optimizer() :
- m_pParams(NULL),
- m_pResults(NULL),
- m_pSolutions(NULL),
- m_perceptual(false),
- m_has_color_weighting(false),
- m_all_pixels_grayscale(false)
- {
- m_low_coords.reserve(512);
- m_high_coords.reserve(512);
-
- m_unique_colors.reserve(512);
- m_temp_unique_colors.reserve(512);
- m_unique_packed_colors.reserve(512);
-
- m_norm_unique_colors.reserve(512);
- m_norm_unique_colors_weighted.reserve(512);
-
- m_lo_cells.reserve(128);
- m_hi_cells.reserve(128);
- }
-
- void dxt1_endpoint_optimizer::clear()
- {
- m_pParams = NULL;
- m_pResults = NULL;
- m_pSolutions = NULL;
-
- if (m_unique_color_hash_map.get_table_size() > 8192)
- m_unique_color_hash_map.clear();
- else
- m_unique_color_hash_map.reset();
-
- if (m_solutions_tried.get_table_size() > 8192)
- m_solutions_tried.clear();
-
- m_unique_colors.resize(0);
-
- m_has_transparent_pixels = false;
- m_total_unique_color_weight = 0;
-
- m_norm_unique_colors.resize(0);
- m_mean_norm_color.clear();
-
- m_norm_unique_colors_weighted.resize(0);
- m_mean_norm_color_weighted.clear();
-
- m_principle_axis.clear();
-
- m_total_evals = 0;
- m_all_pixels_grayscale = false;
- m_has_color_weighting = false;
- m_perceptual = false;
- }
-
- bool dxt1_endpoint_optimizer::handle_all_transparent_block()
- {
- m_pResults->m_low_color = 0;
- m_pResults->m_high_color = 0;
- m_pResults->m_alpha_block = true;
-
- memset(m_pResults->m_pSelectors, 3, m_pParams->m_num_pixels);
-
- return true;
- }
-
- // All selectors are equal. Try compressing as if it was solid, using the block's average color, using ryg's optimal single color compression tables.
- bool dxt1_endpoint_optimizer::try_average_block_as_solid()
- {
- uint64 tot_r = 0;
- uint64 tot_g = 0;
- uint64 tot_b = 0;
-
- uint total_weight = 0;
- for (uint i = 0; i < m_unique_colors.size(); i++)
- {
- uint weight = m_unique_colors[i].m_weight;
- total_weight += weight;
-
- tot_r += m_unique_colors[i].m_color.r * static_cast<uint64>(weight);
- tot_g += m_unique_colors[i].m_color.g * static_cast<uint64>(weight);
- tot_b += m_unique_colors[i].m_color.b * static_cast<uint64>(weight);
- }
-
- const uint half_total_weight = total_weight >> 1;
- uint ave_r = static_cast<uint>((tot_r + half_total_weight) / total_weight);
- uint ave_g = static_cast<uint>((tot_g + half_total_weight) / total_weight);
- uint ave_b = static_cast<uint>((tot_b + half_total_weight) / total_weight);
-
- uint low_color = (ryg_dxt::OMatch5[ave_r][0]<<11) | (ryg_dxt::OMatch6[ave_g][0]<<5) | ryg_dxt::OMatch5[ave_b][0];
- uint high_color = (ryg_dxt::OMatch5[ave_r][1]<<11) | (ryg_dxt::OMatch6[ave_g][1]<<5) | ryg_dxt::OMatch5[ave_b][1];
- bool improved = evaluate_solution(dxt1_solution_coordinates((uint16)low_color, (uint16)high_color), true, &m_best_solution);
-
- if ((m_pParams->m_use_alpha_blocks) && (m_best_solution.m_error))
- {
- low_color = (ryg_dxt::OMatch5_3[ave_r][0]<<11) | (ryg_dxt::OMatch6_3[ave_g][0]<<5) | ryg_dxt::OMatch5_3[ave_b][0];
- high_color = (ryg_dxt::OMatch5_3[ave_r][1]<<11) | (ryg_dxt::OMatch6_3[ave_g][1]<<5) | ryg_dxt::OMatch5_3[ave_b][1];
- improved |= evaluate_solution(dxt1_solution_coordinates((uint16)low_color, (uint16)high_color), true, &m_best_solution);
- }
-
- if (m_pParams->m_quality == cCRNDXTQualityUber)
- {
- // Try compressing as all-solid using the other (non-average) colors in the block in uber.
- for (uint i = 0; i < m_unique_colors.size(); i++)
- {
- uint r = m_unique_colors[i].m_color[0];
- uint g = m_unique_colors[i].m_color[1];
- uint b = m_unique_colors[i].m_color[2];
- if ((r == ave_r) && (g == ave_g) && (b == ave_b))
- continue;
-
- uint low_color = (ryg_dxt::OMatch5[r][0]<<11) | (ryg_dxt::OMatch6[g][0]<<5) | ryg_dxt::OMatch5[b][0];
- uint high_color = (ryg_dxt::OMatch5[r][1]<<11) | (ryg_dxt::OMatch6[g][1]<<5) | ryg_dxt::OMatch5[b][1];
- improved |= evaluate_solution(dxt1_solution_coordinates((uint16)low_color, (uint16)high_color), true, &m_best_solution);
-
- if ((m_pParams->m_use_alpha_blocks) && (m_best_solution.m_error))
- {
- low_color = (ryg_dxt::OMatch5_3[r][0]<<11) | (ryg_dxt::OMatch6_3[g][0]<<5) | ryg_dxt::OMatch5_3[b][0];
- high_color = (ryg_dxt::OMatch5_3[r][1]<<11) | (ryg_dxt::OMatch6_3[g][1]<<5) | ryg_dxt::OMatch5_3[b][1];
- improved |= evaluate_solution(dxt1_solution_coordinates((uint16)low_color, (uint16)high_color), true, &m_best_solution);
- }
- }
- }
-
- return improved;
- }
-
- // Block is solid, trying using ryg's optimal single color tables.
- bool dxt1_endpoint_optimizer::handle_solid_block()
- {
- int r = m_unique_colors[0].m_color.r;
- int g = m_unique_colors[0].m_color.g;
- int b = m_unique_colors[0].m_color.b;
-
- //uint packed_color = dxt1_block::pack_color(r, g, b, true);
- //evaluate_solution(dxt1_solution_coordinates((uint16)packed_color, (uint16)packed_color), false, &m_best_solution);
-
- uint low_color = (ryg_dxt::OMatch5[r][0]<<11) | (ryg_dxt::OMatch6[g][0]<<5) | ryg_dxt::OMatch5[b][0];
- uint high_color = (ryg_dxt::OMatch5[r][1]<<11) | (ryg_dxt::OMatch6[g][1]<<5) | ryg_dxt::OMatch5[b][1];
- evaluate_solution(dxt1_solution_coordinates((uint16)low_color, (uint16)high_color), false, &m_best_solution);
-
- if ((m_pParams->m_use_alpha_blocks) && (m_best_solution.m_error))
- {
- low_color = (ryg_dxt::OMatch5_3[r][0]<<11) | (ryg_dxt::OMatch6_3[g][0]<<5) | ryg_dxt::OMatch5_3[b][0];
- high_color = (ryg_dxt::OMatch5_3[r][1]<<11) | (ryg_dxt::OMatch6_3[g][1]<<5) | ryg_dxt::OMatch5_3[b][1];
- evaluate_solution(dxt1_solution_coordinates((uint16)low_color, (uint16)high_color), true, &m_best_solution);
- }
-
- return_solution(*m_pResults, m_best_solution);
-
- return true;
- }
-
- void dxt1_endpoint_optimizer::compute_vectors(const vec3F& perceptual_weights)
- {
- m_norm_unique_colors.resize(0);
- m_norm_unique_colors_weighted.resize(0);
-
- m_mean_norm_color.clear();
- m_mean_norm_color_weighted.clear();
-
- for (uint i = 0; i < m_unique_colors.size(); i++)
- {
- const color_quad_u8& color = m_unique_colors[i].m_color;
- const uint weight = m_unique_colors[i].m_weight;
-
- vec3F norm_color(color.r * 1.0f/255.0f, color.g * 1.0f/255.0f, color.b * 1.0f/255.0f);
- vec3F norm_color_weighted(vec3F::mul_components(perceptual_weights, norm_color));
-
- m_norm_unique_colors.push_back(norm_color);
- m_norm_unique_colors_weighted.push_back(norm_color_weighted);
-
- m_mean_norm_color += norm_color * (float)weight;
- m_mean_norm_color_weighted += norm_color_weighted * (float)weight;
- }
-
- if (m_total_unique_color_weight)
- {
- m_mean_norm_color *= (1.0f / m_total_unique_color_weight);
- m_mean_norm_color_weighted *= (1.0f / m_total_unique_color_weight);
- }
-
- for (uint i = 0; i < m_unique_colors.size(); i++)
- {
- m_norm_unique_colors[i] -= m_mean_norm_color;
- m_norm_unique_colors_weighted[i] -= m_mean_norm_color_weighted;
- }
- }
-
- // Compute PCA (principle axis, i.e. direction of largest variance) of input vectors.
- void dxt1_endpoint_optimizer::compute_pca(vec3F& axis, const vec3F_array& norm_colors, const vec3F& def)
- {
-#if 0
- axis.clear();
-
- CRNLIB_ASSERT(m_unique_colors.size() == norm_colors.size());
-
- // Incremental PCA
- bool first = true;
- for (uint i = 0; i < norm_colors.size(); i++)
- {
- const uint weight = m_unique_colors[i].m_weight;
-
- for (uint j = 0; j < weight; j++)
- {
- vec3F x(norm_colors[i] * norm_colors[i][0]);
- vec3F y(norm_colors[i] * norm_colors[i][1]);
- vec3F z(norm_colors[i] * norm_colors[i][2]);
-
- vec3F v(first ? norm_colors[0] : axis);
- first = false;
-
- v.normalize(&def);
-
- axis[0] += (x * v);
- axis[1] += (y * v);
- axis[2] += (z * v);
- }
- }
-
- axis.normalize(&def);
-#else
- double cov[6] = { 0, 0, 0, 0, 0, 0 };
-
- //vec3F lo(math::cNearlyInfinite);
- //vec3F hi(-math::cNearlyInfinite);
-
- for(uint i = 0; i < norm_colors.size(); i++)
- {
- const vec3F& v = norm_colors[i];
-
- //if (v[0] < lo[0]) lo[0] = v[0];
- //if (v[1] < lo[1]) lo[1] = v[1];
- //if (v[2] < lo[2]) lo[2] = v[2];
- //if (v[0] > hi[0]) hi[0] = v[0];
- //if (v[1] > hi[1]) hi[1] = v[1];
- //if (v[2] > hi[2]) hi[2] = v[2];
-
- float r = v[0];
- float g = v[1];
- float b = v[2];
-
- if (m_unique_colors[i].m_weight > 1)
- {
- const double weight = m_unique_colors[i].m_weight;
-
- cov[0] += r*r*weight;
- cov[1] += r*g*weight;
- cov[2] += r*b*weight;
- cov[3] += g*g*weight;
- cov[4] += g*b*weight;
- cov[5] += b*b*weight;
- }
- else
- {
- cov[0] += r*r;
- cov[1] += r*g;
- cov[2] += r*b;
- cov[3] += g*g;
- cov[4] += g*b;
- cov[5] += b*b;
- }
- }
-
- double vfr, vfg, vfb;
- //vfr = hi[0] - lo[0];
- //vfg = hi[1] - lo[1];
- //vfb = hi[2] - lo[2];
- // This is more stable.
- vfr = .9f;
- vfg = 1.0f;
- vfb = .7f;
-
- const uint cNumIters = 8;
-
- for (uint iter = 0; iter < cNumIters; iter++)
- {
- double r = vfr*cov[0] + vfg*cov[1] + vfb*cov[2];
- double g = vfr*cov[1] + vfg*cov[3] + vfb*cov[4];
- double b = vfr*cov[2] + vfg*cov[4] + vfb*cov[5];
-
- double m = math::maximum(fabs(r), fabs(g), fabs(b));
- if (m > 1e-10)
- {
- m = 1.0f / m;
- r *= m;
- g *= m;
- b *= m;
- }
-
- double delta = math::square(vfr-r) + math::square(vfg-g) + math::square(vfb-b);
-
- vfr = r;
- vfg = g;
- vfb = b;
-
- if ((iter > 2) && (delta < 1e-8))
- break;
- }
-
- double len = vfr*vfr + vfg*vfg + vfb*vfb;
-
- if (len < 1e-10)
- {
- axis = def;
- }
- else
- {
- len = 1.0f / sqrt(len);
- vfr *= len;
- vfg *= len;
- vfb *= len;
-
- axis.set(static_cast<float>(vfr), static_cast<float>(vfg), static_cast<float>(vfb));
- }
-#endif
- }
-
- static const uint8 g_invTableNull[4] = { 0, 1, 2, 3 };
- static const uint8 g_invTableAlpha[4] = { 1, 0, 2, 3 };
- static const uint8 g_invTableColor[4] = { 1, 0, 3, 2 };
-
- // Computes a valid (encodable) DXT1 solution (low/high colors, swizzled selectors) from input.
- void dxt1_endpoint_optimizer::return_solution(results& res, const potential_solution& solution)
- {
- bool invert_selectors;
-
- if (solution.m_alpha_block)
- invert_selectors = (solution.m_coords.m_low_color > solution.m_coords.m_high_color);
- else
- {
- CRNLIB_ASSERT(solution.m_coords.m_low_color != solution.m_coords.m_high_color);
-
- invert_selectors = (solution.m_coords.m_low_color < solution.m_coords.m_high_color);
- }
-
- if (invert_selectors)
- {
- res.m_low_color = solution.m_coords.m_high_color;
- res.m_high_color = solution.m_coords.m_low_color;
- }
- else
- {
- res.m_low_color = solution.m_coords.m_low_color;
- res.m_high_color = solution.m_coords.m_high_color;
- }
-
- const uint8* pInvert_table = g_invTableNull;
- if (invert_selectors)
- pInvert_table = solution.m_alpha_block ? g_invTableAlpha : g_invTableColor;
-
- const uint alpha_thresh = m_pParams->m_pixels_have_alpha ? (m_pParams->m_dxt1a_alpha_threshold << 24U) : 0;
-
- const uint32* pSrc_pixels = reinterpret_cast<const uint32*>(m_pParams->m_pPixels);
- uint8* pDst_selectors = res.m_pSelectors;
-
- if ((m_unique_colors.size() == 1) && (!m_pParams->m_pixels_have_alpha))
- {
- uint32 c = utils::read_le32(pSrc_pixels);
-
- CRNLIB_ASSERT(c >= alpha_thresh);
-
- c |= 0xFF000000U;
-
- unique_color_hash_map::const_iterator it(m_unique_color_hash_map.find(c));
- CRNLIB_ASSERT(it != m_unique_color_hash_map.end());
-
- uint unique_color_index = it->second;
-
- uint selector = pInvert_table[solution.m_selectors[unique_color_index]];
-
- memset(pDst_selectors, selector, m_pParams->m_num_pixels);
- }
- else
- {
- uint8* pDst_selectors_end = pDst_selectors + m_pParams->m_num_pixels;
-
- uint8 prev_selector = 0;
- uint32 prev_color = 0;
-
- do
- {
- uint32 c = utils::read_le32(pSrc_pixels);
- pSrc_pixels++;
-
- uint8 selector = 3;
-
- if (c >= alpha_thresh)
- {
- c |= 0xFF000000U;
-
- if (c == prev_color)
- selector = prev_selector;
- else
- {
- unique_color_hash_map::const_iterator it(m_unique_color_hash_map.find(c));
-
- CRNLIB_ASSERT(it != m_unique_color_hash_map.end());
-
- uint unique_color_index = it->second;
-
- selector = pInvert_table[solution.m_selectors[unique_color_index]];
-
- prev_color = c;
- prev_selector = selector;
- }
- }
-
- *pDst_selectors++ = selector;
-
- } while (pDst_selectors != pDst_selectors_end);
- }
-
- res.m_alpha_block = solution.m_alpha_block;
- res.m_error = solution.m_error;
- }
-
- inline vec3F dxt1_endpoint_optimizer::unpack_to_vec3F(uint16 packed_color)
- {
- color_quad_u8 c(dxt1_block::unpack_color(packed_color, false));
-
- return vec3F(c.r * 1.0f/31.0f, c.g * 1.0f/63.0f, c.b * 1.0f/31.0f);
- }
-
- inline vec3F dxt1_endpoint_optimizer::unpack_to_vec3F_raw(uint16 packed_color)
- {
- color_quad_u8 c(dxt1_block::unpack_color(packed_color, false));
-
- return vec3F(c.r, c.g, c.b);
- }
-
- // Per-component 1D endpoint optimization.
- void dxt1_endpoint_optimizer::optimize_endpoint_comps()
- {
- if ((m_best_solution.m_alpha_block) || (!m_best_solution.m_error))
- return;
-
- //color_quad_u8 orig_l(dxt1_block::unpack_color(m_best_solution.m_coords.m_low_color, false));
- //color_quad_u8 orig_h(dxt1_block::unpack_color(m_best_solution.m_coords.m_high_color, false));
- //uint orig_error = m_best_solution.m_error;
-
- color_quad_u8 orig_l_scaled(dxt1_block::unpack_color(m_best_solution.m_coords.m_low_color, true));
- color_quad_u8 orig_h_scaled(dxt1_block::unpack_color(m_best_solution.m_coords.m_high_color, true));
-
- color_quad_u8 min_color(0xFF, 0xFF, 0xFF, 0xFF);
- color_quad_u8 max_color(0, 0, 0, 0);
- for (uint i = 0; i < m_unique_colors.size(); i++)
- {
- min_color = color_quad_u8::component_min(min_color, m_unique_colors[i].m_color);
- max_color = color_quad_u8::component_max(max_color, m_unique_colors[i].m_color);
- }
-
- // Try to separately optimize each component. This is a 1D problem so it's easy to compute accurate per-component error bounds.
- for (uint comp_index = 0; comp_index < 3; comp_index++)
- {
- uint ll[4];
- ll[0] = orig_l_scaled[comp_index];
- ll[1] = orig_h_scaled[comp_index];
- ll[2] = (ll[0]*2+ll[1])/3;
- ll[3] = (ll[0]+ll[1]*2)/3;
-
- uint64 error_to_beat = 0;
- uint min_color_weight = 0;
- uint max_color_weight = 0;
- for (uint i = 0; i < m_unique_colors.size(); i++)
- {
- uint c = m_unique_colors[i].m_color[comp_index];
- uint w = m_unique_colors[i].m_weight;
-
- int delta = ll[m_best_solution.m_selectors[i]] - c;
- error_to_beat += static_cast<int64>(w) * (delta * delta);
-
- if (c == min_color[comp_index])
- min_color_weight += w;
- if (c == max_color[comp_index])
- max_color_weight += w;
- }
-
- if (!error_to_beat)
- continue;
-
- CRNLIB_ASSERT((min_color_weight > 0) && (max_color_weight > 0));
- const uint error_to_beat_div_min_color_weight = min_color_weight ? ((error_to_beat + min_color_weight - 1) / min_color_weight) : 0;
- const uint error_to_beat_div_max_color_weight = max_color_weight ? ((error_to_beat + max_color_weight - 1) / max_color_weight) : 0;
-
- const uint m = (comp_index == 1) ? 63 : 31;
- const uint m_shift = (comp_index == 1) ? 3 : 2;
-
- for (uint o = 0; o <= m; o++)
- {
- uint tl[4];
-
- tl[0] = (comp_index == 1) ? ((o << 2) | (o >> 4)) : ((o << 3) | (o >> 2));
-
- for (uint h = 0; h < 8; h++)
- {
- const uint pl = h << m_shift;
- const uint ph = ((h + 1) << m_shift) - 1;
-
- uint tl_l = (comp_index == 1) ? ((pl << 2) | (pl >> 4)) : ((pl << 3) | (pl >> 2));
- uint tl_h = (comp_index == 1) ? ((ph << 2) | (ph >> 4)) : ((ph << 3) | (ph >> 2));
-
- tl_l = math::minimum(tl_l, tl[0]);
- tl_h = math::maximum(tl_h, tl[0]);
-
- uint c_l = min_color[comp_index];
- uint c_h = max_color[comp_index];
-
- if (c_h < tl_l)
- {
- uint min_possible_error = math::square<int>(tl_l - c_l);
- if (min_possible_error > error_to_beat_div_min_color_weight)
- continue;
- }
- else if (c_l > tl_h)
- {
- uint min_possible_error = math::square<int>(c_h - tl_h);
- if (min_possible_error > error_to_beat_div_max_color_weight)
- continue;
- }
-
- for (uint p = pl; p <= ph; p++)
- {
- tl[1] = (comp_index == 1) ? ((p << 2) | (p >> 4)) : ((p << 3) | (p >> 2));
-
- tl[2] = (tl[0]*2+tl[1])/3;
- tl[3] = (tl[0]+tl[1]*2)/3;
-
- uint64 trial_error = 0;
- for (uint i = 0; i < m_unique_colors.size(); i++)
- {
- int delta = tl[m_best_solution.m_selectors[i]] - m_unique_colors[i].m_color[comp_index];
- trial_error += static_cast<int64>(m_unique_colors[i].m_weight) * (delta * delta);
- if (trial_error >= error_to_beat)
- break;
- }
-
- //CRNLIB_ASSERT(trial_error >= min_possible_error);
-
- if (trial_error < error_to_beat)
- {
- color_quad_u8 l(dxt1_block::unpack_color(m_best_solution.m_coords.m_low_color, false));
- color_quad_u8 h(dxt1_block::unpack_color(m_best_solution.m_coords.m_high_color, false));
- l[comp_index] = static_cast<uint8>(o);
- h[comp_index] = static_cast<uint8>(p);
-
- bool better = evaluate_solution(
- dxt1_solution_coordinates(dxt1_block::pack_color(l, false), dxt1_block::pack_color(h, false)),
- true, &m_best_solution);
- better;
-
- if (better)
- {
-#if 0
- printf("comp: %u, orig: %u %u, new: %u %u, orig_error: %u, new_error: %u\n", comp_index,
- orig_l[comp_index], orig_h[comp_index],
- l[comp_index], h[comp_index],
- orig_error, m_best_solution.m_error);
-#endif
- if (!m_best_solution.m_error)
- return;
-
- error_to_beat = 0;
- for (uint i = 0; i < m_unique_colors.size(); i++)
- {
- int delta = tl[m_best_solution.m_selectors[i]] - m_unique_colors[i].m_color[comp_index];
- error_to_beat += static_cast<int64>(m_unique_colors[i].m_weight) * (delta * delta);
- }
-
- } // better
-
- //goto early_out;
- } // if (trial_error < error_to_beat)
-
- } // for (uint p = 0; p <= m; p++)
- }
-
- } // for (uint o = 0; o <= m; o++)
-
- } // comp_index
- }
-
- // Voxel adjacency delta coordinations.
- static const struct adjacent_coords
- {
- int8 x, y, z;
- } g_adjacency[26] = {
- {-1, -1, -1},
- {0, -1, -1},
- {1, -1, -1},
- {-1, 0, -1},
- {0, 0, -1},
- {1, 0, -1},
- {-1, 1, -1},
- {0, 1, -1},
-
- {1, 1, -1},
- {-1, -1, 0},
- {0, -1, 0},
- {1, -1, 0},
- {-1, 0, 0},
- {1, 0, 0},
- {-1, 1, 0},
- {0, 1, 0},
-
- {1, 1, 0},
- {-1, -1, 1},
- {0, -1, 1},
- {1, -1, 1},
- {-1, 0, 1},
- {0, 0, 1},
- {1, 0, 1},
- {-1, 1, 1},
-
- {0, 1, 1},
- {1, 1, 1}
- };
-
- // Attempt to refine current solution's endpoints given the current selectors using least squares.
- bool dxt1_endpoint_optimizer::refine_solution(int refinement_level)
- {
- CRNLIB_ASSERT(m_best_solution.m_valid);
-
- static const int w1Tab[4] = { 3,0,2,1 };
-
- static const int prods_0[4] = { 0x00,0x00,0x02,0x02 };
- static const int prods_1[4] = { 0x00,0x09,0x01,0x04 };
- static const int prods_2[4] = { 0x09,0x00,0x04,0x01 };
-
- double akku_0 = 0;
- double akku_1 = 0;
- double akku_2 = 0;
- double At1_r, At1_g, At1_b;
- double At2_r, At2_g, At2_b;
-
- At1_r = At1_g = At1_b = 0;
- At2_r = At2_g = At2_b = 0;
- for(uint i = 0; i < m_unique_colors.size(); i++)
- {
- const color_quad_u8& c = m_unique_colors[i].m_color;
- const double weight = m_unique_colors[i].m_weight;
-
- double r = c.r*weight;
- double g = c.g*weight;
- double b = c.b*weight;
- int step = m_best_solution.m_selectors[i]^1;
-
- int w1 = w1Tab[step];
-
- akku_0 += prods_0[step]*weight;
- akku_1 += prods_1[step]*weight;
- akku_2 += prods_2[step]*weight;
- At1_r += w1*r;
- At1_g += w1*g;
- At1_b += w1*b;
- At2_r += r;
- At2_g += g;
- At2_b += b;
- }
-
- At2_r = 3*At2_r - At1_r;
- At2_g = 3*At2_g - At1_g;
- At2_b = 3*At2_b - At1_b;
-
- double xx = akku_2;
- double yy = akku_1;
- double xy = akku_0;
-
- double t = xx * yy - xy * xy;
- if (!yy || !xx || (fabs(t) < .0000125f))
- return false;
-
- double frb = (3.0f * 31.0f / 255.0f) / t;
- double fg = frb * (63.0f / 31.0f);
-
- bool improved = false;
-
- if (refinement_level == 0)
- {
- uint max16;
- max16 = math::clamp<int>(static_cast<int>((At1_r*yy - At2_r*xy)*frb+0.5f),0,31) << 11;
- max16 |= math::clamp<int>(static_cast<int>((At1_g*yy - At2_g*xy)*fg +0.5f),0,63) << 5;
- max16 |= math::clamp<int>(static_cast<int>((At1_b*yy - At2_b*xy)*frb+0.5f),0,31) << 0;
-
- uint min16;
- min16 = math::clamp<int>(static_cast<int>((At2_r*xx - At1_r*xy)*frb+0.5f),0,31) << 11;
- min16 |= math::clamp<int>(static_cast<int>((At2_g*xx - At1_g*xy)*fg +0.5f),0,63) << 5;
- min16 |= math::clamp<int>(static_cast<int>((At2_b*xx - At1_b*xy)*frb+0.5f),0,31) << 0;
-
- dxt1_solution_coordinates nc((uint16)min16, (uint16)max16);
- nc.canonicalize();
- improved |= evaluate_solution(nc, true, &m_best_solution, false);
- }
- else if (refinement_level == 1)
- {
- // Try exploring the local lattice neighbors of the least squares optimized result.
- color_quad_u8 e[2];
-
- e[0].clear();
- e[0][0] = (uint8)math::clamp<int>(static_cast<int>((At1_r*yy - At2_r*xy)*frb+0.5f),0,31);
- e[0][1] = (uint8)math::clamp<int>(static_cast<int>((At1_g*yy - At2_g*xy)*fg +0.5f),0,63);
- e[0][2] = (uint8)math::clamp<int>(static_cast<int>((At1_b*yy - At2_b*xy)*frb+0.5f),0,31);
-
- e[1].clear();
- e[1][0] = (uint8)math::clamp<int>(static_cast<int>((At2_r*xx - At1_r*xy)*frb+0.5f),0,31);
- e[1][1] = (uint8)math::clamp<int>(static_cast<int>((At2_g*xx - At1_g*xy)*fg +0.5f),0,63);
- e[1][2] = (uint8)math::clamp<int>(static_cast<int>((At2_b*xx - At1_b*xy)*frb+0.5f),0,31);
-
- for (uint i = 0; i < 2; i++)
- {
- for (int rr = -1; rr <= 1; rr++)
- {
- for (int gr = -1; gr <= 1; gr++)
- {
- for (int br = -1; br <= 1; br++)
- {
- dxt1_solution_coordinates nc;
-
- color_quad_u8 c[2];
- c[0] = e[0];
- c[1] = e[1];
-
- c[i][0] = (uint8)math::clamp<int>(c[i][0] + rr, 0, 31);
- c[i][1] = (uint8)math::clamp<int>(c[i][1] + gr, 0, 63);
- c[i][2] = (uint8)math::clamp<int>(c[i][2] + br, 0, 31);
-
- nc.m_low_color = dxt1_block::pack_color(c[0], false);
- nc.m_high_color = dxt1_block::pack_color(c[1], false);
-
- nc.canonicalize();
-
- if ((nc.m_low_color != m_best_solution.m_coords.m_low_color) || (nc.m_high_color != m_best_solution.m_coords.m_high_color))
- {
- improved |= evaluate_solution(nc, true, &m_best_solution, false);
- }
- }
- }
- }
- }
- }
- else
- {
- // Try even harder to explore the local lattice neighbors of the least squares optimized result.
- color_quad_u8 e[2];
- e[0].clear();
- e[0][0] = (uint8)math::clamp<int>(static_cast<int>((At1_r*yy - At2_r*xy)*frb+0.5f),0,31);
- e[0][1] = (uint8)math::clamp<int>(static_cast<int>((At1_g*yy - At2_g*xy)*fg +0.5f),0,63);
- e[0][2] = (uint8)math::clamp<int>(static_cast<int>((At1_b*yy - At2_b*xy)*frb+0.5f),0,31);
-
- e[1].clear();
- e[1][0] = (uint8)math::clamp<int>(static_cast<int>((At2_r*xx - At1_r*xy)*frb+0.5f),0,31);
- e[1][1] = (uint8)math::clamp<int>(static_cast<int>((At2_g*xx - At1_g*xy)*fg +0.5f),0,63);
- e[1][2] = (uint8)math::clamp<int>(static_cast<int>((At2_b*xx - At1_b*xy)*frb+0.5f),0,31);
-
- for (int orr = -1; orr <= 1; orr++)
- {
- for (int ogr = -1; ogr <= 1; ogr++)
- {
- for (int obr = -1; obr <= 1; obr++)
- {
- dxt1_solution_coordinates nc;
-
- color_quad_u8 c[2];
- c[0] = e[0];
- c[1] = e[1];
-
- c[0][0] = (uint8)math::clamp<int>(c[0][0] + orr, 0, 31);
- c[0][1] = (uint8)math::clamp<int>(c[0][1] + ogr, 0, 63);
- c[0][2] = (uint8)math::clamp<int>(c[0][2] + obr, 0, 31);
-
- for (int rr = -1; rr <= 1; rr++)
- {
- for (int gr = -1; gr <= 1; gr++)
- {
- for (int br = -1; br <= 1; br++)
- {
- c[1][0] = (uint8)math::clamp<int>(c[1][0] + rr, 0, 31);
- c[1][1] = (uint8)math::clamp<int>(c[1][1] + gr, 0, 63);
- c[1][2] = (uint8)math::clamp<int>(c[1][2] + br, 0, 31);
-
- nc.m_low_color = dxt1_block::pack_color(c[0], false);
- nc.m_high_color = dxt1_block::pack_color(c[1], false);
- nc.canonicalize();
-
- improved |= evaluate_solution(nc, true, &m_best_solution, false);
- }
- }
- }
- }
- }
- }
- }
-
- return improved;
- }
-
- //-----------------------------------------------------------------------------------------------------------------------------------------
-
- // Primary endpoint optimization entrypoint.
- bool dxt1_endpoint_optimizer::optimize_endpoints(vec3F& low_color, vec3F& high_color)
- {
- vec3F orig_low_color(low_color);
- vec3F orig_high_color(high_color);
-
- m_trial_solution.clear();
-
- uint num_passes;
- const int16* pProbe_table = g_uber_probe_table;
- uint probe_range;
- float dist_per_trial = .015625f;
-
- // How many probes, and the distance between each probe depends on the quality level.
- switch (m_pParams->m_quality)
- {
- case cCRNDXTQualitySuperFast:
- pProbe_table = g_fast_probe_table;
- probe_range = cFastProbeTableSize;
- dist_per_trial = .027063293f;
- num_passes = 1;
- break;
- case cCRNDXTQualityFast:
- pProbe_table = g_fast_probe_table;
- probe_range = cFastProbeTableSize;
- dist_per_trial = .027063293f;
- num_passes = 2;
- break;
- case cCRNDXTQualityNormal:
- pProbe_table = g_normal_probe_table;
- probe_range = cNormalProbeTableSize;
- dist_per_trial = .027063293f;
- num_passes = 2;
- break;
- case cCRNDXTQualityBetter:
- pProbe_table = g_better_probe_table;
- probe_range = cBetterProbeTableSize;
- num_passes = 2;
- break;
- default:
- pProbe_table = g_uber_probe_table;
- probe_range = cUberProbeTableSize;
- num_passes = 4;
- break;
- }
-
- m_solutions_tried.reset();
-
- if (m_pParams->m_endpoint_caching)
- {
- // Try the previous X winning endpoints. This may not give us optimal results, but it may increase the probability of early outs while evaluating potential solutions.
- const uint num_prev_results = math::minimum<uint>(cMaxPrevResults, m_num_prev_results);
- for (uint i = 0; i < num_prev_results; i++)
- {
- const dxt1_solution_coordinates& coords = m_prev_results[i];
-
- solution_hash_map::insert_result solution_res(m_solutions_tried.insert(coords.m_low_color | (coords.m_high_color << 16U)));
- if (!solution_res.second)
- continue;
-
- evaluate_solution(coords, true, &m_best_solution);
- }
-
- if (!m_best_solution.m_error)
- {
- // Got lucky - one of the previous endpoints is optimal.
- return_solution(*m_pResults, m_best_solution);
- return true;
- }
- }
-
- if (m_pParams->m_quality >= cCRNDXTQualityBetter)
- {
- //evaluate_solution(dxt1_solution_coordinates(low_color, high_color), true, &m_best_solution);
- //refine_solution();
-
- try_median4(orig_low_color, orig_high_color);
- }
-
- uint probe_low[cUberProbeTableSize * 2 + 1];
- uint probe_high[cUberProbeTableSize * 2 + 1];
-
- vec3F scaled_principle_axis[2];
-
- scaled_principle_axis[1] = m_principle_axis * dist_per_trial;
- scaled_principle_axis[1][0] *= 31.0f;
- scaled_principle_axis[1][1] *= 63.0f;
- scaled_principle_axis[1][2] *= 31.0f;
-
- scaled_principle_axis[0] = -scaled_principle_axis[1];
-
- //vec3F initial_ofs(scaled_principle_axis * (float)-probe_range);
- //initial_ofs[0] += .5f;
- //initial_ofs[1] += .5f;
- //initial_ofs[2] += .5f;
-
- low_color[0] = math::clamp(low_color[0] * 31.0f, 0.0f, 31.0f);
- low_color[1] = math::clamp(low_color[1] * 63.0f, 0.0f, 63.0f);
- low_color[2] = math::clamp(low_color[2] * 31.0f, 0.0f, 31.0f);
-
- high_color[0] = math::clamp(high_color[0] * 31.0f, 0.0f, 31.0f);
- high_color[1] = math::clamp(high_color[1] * 63.0f, 0.0f, 63.0f);
- high_color[2] = math::clamp(high_color[2] * 31.0f, 0.0f, 31.0f);
-
- for (uint pass = 0; pass < num_passes; pass++)
- {
- // Now separately sweep or probe the low and high colors along the principle axis, both positively and negatively.
- // This results in two arrays of candidate low/high endpoints. Every unique combination of candidate endpoints is tried as a potential solution.
- // In higher quality modes, the various nearby lattice neighbors of each candidate endpoint are also explored, which allows the current solution to "wobble" or "migrate"
- // to areas with lower error.
- // This entire process can be repeated up to X times (depending on the quality level) until a local minimum is established.
- // This method is very stable and scalable. It could be implemented more elegantly, but I'm now very cautious of touching this code.
- if (pass)
- {
- low_color = unpack_to_vec3F_raw(m_best_solution.m_coords.m_low_color);
- high_color = unpack_to_vec3F_raw(m_best_solution.m_coords.m_high_color);
- }
-
- const uint64 prev_best_error = m_best_solution.m_error;
- if (!prev_best_error)
- break;
-
- // Sweep low endpoint along principle axis, record positions
- int prev_packed_color[2] = { -1, -1 };
- uint num_low_trials = 0;
- vec3F initial_probe_low_color(low_color + vec3F(.5f));
- for (uint i = 0; i < probe_range; i++)
- {
- const int ls = i ? 0 : 1;
- int x = pProbe_table[i];
-
- for (int s = ls; s < 2; s++)
- {
- vec3F probe_low_color(initial_probe_low_color + scaled_principle_axis[s] * (float)x);
-
- int r = math::clamp((int)floor(probe_low_color[0]), 0, 31);
- int g = math::clamp((int)floor(probe_low_color[1]), 0, 63);
- int b = math::clamp((int)floor(probe_low_color[2]), 0, 31);
-
- int packed_color = b | (g << 5U) | (r << 11U);
- if (packed_color != prev_packed_color[s])
- {
- probe_low[num_low_trials++] = packed_color;
- prev_packed_color[s] = packed_color;
- }
- }
- }
-
- prev_packed_color[0] = -1;
- prev_packed_color[1] = -1;
-
- // Sweep high endpoint along principle axis, record positions
- uint num_high_trials = 0;
- vec3F initial_probe_high_color(high_color + vec3F(.5f));
- for (uint i = 0; i < probe_range; i++)
- {
- const int ls = i ? 0 : 1;
- int x = pProbe_table[i];
-
- for (int s = ls; s < 2; s++)
- {
- vec3F probe_high_color(initial_probe_high_color + scaled_principle_axis[s] * (float)x);
-
- int r = math::clamp((int)floor(probe_high_color[0]), 0, 31);
- int g = math::clamp((int)floor(probe_high_color[1]), 0, 63);
- int b = math::clamp((int)floor(probe_high_color[2]), 0, 31);
-
- int packed_color = b | (g << 5U) | (r << 11U);
- if (packed_color != prev_packed_color[s])
- {
- probe_high[num_high_trials++] = packed_color;
- prev_packed_color[s] = packed_color;
- }
- }
- }
-
- // Now try all unique combinations.
- for (uint i = 0; i < num_low_trials; i++)
- {
- for (uint j = 0; j < num_high_trials; j++)
- {
- dxt1_solution_coordinates coords((uint16)probe_low[i], (uint16)probe_high[j]);
- coords.canonicalize();
-
- solution_hash_map::insert_result solution_res(m_solutions_tried.insert(coords.m_low_color | (coords.m_high_color << 16U)));
- if (!solution_res.second)
- continue;
-
- evaluate_solution(coords, true, &m_best_solution);
- }
- }
-
- if (m_pParams->m_quality >= cCRNDXTQualityNormal)
- {
- // Generate new candidates by exploring the low color's direct lattice neighbors
- color_quad_u8 lc(dxt1_block::unpack_color(m_best_solution.m_coords.m_low_color, false));
-
- for (int i = 0; i < 26; i++)
- {
- int r = lc.r + g_adjacency[i].x;
- if ((r < 0) || (r > 31)) continue;
-
- int g = lc.g + g_adjacency[i].y;
- if ((g < 0) || (g > 63)) continue;
-
- int b = lc.b + g_adjacency[i].z;
- if ((b < 0) || (b > 31)) continue;
-
- dxt1_solution_coordinates coords(dxt1_block::pack_color(r, g, b, false), m_best_solution.m_coords.m_high_color);
- coords.canonicalize();
-
- solution_hash_map::insert_result solution_res(m_solutions_tried.insert(coords.m_low_color | (coords.m_high_color << 16U)));
- if (solution_res.second)
- evaluate_solution(coords, true, &m_best_solution);
- }
-
- if (m_pParams->m_quality == cCRNDXTQualityUber)
- {
- // Generate new candidates by exploring the low color's direct lattice neighbors - this time, explore much further separately on each axis.
- lc = dxt1_block::unpack_color(m_best_solution.m_coords.m_low_color, false);
-
- for (int a = 0; a < 3; a++)
- {
- int limit = (a == 1) ? 63 : 31;
-
- for (int s = -2; s <= 2; s += 4)
- {
- color_quad_u8 c(lc);
- int q = c[a] + s;
- if ((q < 0) || (q > limit)) continue;
-
- c[a] = (uint8)q;
-
- dxt1_solution_coordinates coords(dxt1_block::pack_color(c, false), m_best_solution.m_coords.m_high_color);
- coords.canonicalize();
-
- solution_hash_map::insert_result solution_res(m_solutions_tried.insert(coords.m_low_color | (coords.m_high_color << 16U)));
- if (solution_res.second)
- evaluate_solution(coords, true, &m_best_solution);
- }
- }
- }
-
- // Generate new candidates by exploring the high color's direct lattice neighbors
- color_quad_u8 hc(dxt1_block::unpack_color(m_best_solution.m_coords.m_high_color, false));
-
- for (int i = 0; i < 26; i++)
- {
- int r = hc.r + g_adjacency[i].x;
- if ((r < 0) || (r > 31)) continue;
-
- int g = hc.g + g_adjacency[i].y;
- if ((g < 0) || (g > 63)) continue;
-
- int b = hc.b + g_adjacency[i].z;
- if ((b < 0) || (b > 31)) continue;
-
- dxt1_solution_coordinates coords(m_best_solution.m_coords.m_low_color, dxt1_block::pack_color(r, g, b, false));
- coords.canonicalize();
-
- solution_hash_map::insert_result solution_res(m_solutions_tried.insert(coords.m_low_color | (coords.m_high_color << 16U)));
- if (solution_res.second)
- evaluate_solution(coords, true, &m_best_solution);
- }
-
- if (m_pParams->m_quality == cCRNDXTQualityUber)
- {
- // Generate new candidates by exploring the high color's direct lattice neighbors - this time, explore much further separately on each axis.
- hc = dxt1_block::unpack_color(m_best_solution.m_coords.m_high_color, false);
-
- for (int a = 0; a < 3; a++)
- {
- int limit = (a == 1) ? 63 : 31;
-
- for (int s = -2; s <= 2; s += 4)
- {
- color_quad_u8 c(hc);
- int q = c[a] + s;
- if ((q < 0) || (q > limit)) continue;
-
- c[a] = (uint8)q;
-
- dxt1_solution_coordinates coords(m_best_solution.m_coords.m_low_color, dxt1_block::pack_color(c, false));
- coords.canonicalize();
-
- solution_hash_map::insert_result solution_res(m_solutions_tried.insert(coords.m_low_color | (coords.m_high_color << 16U)));
- if (solution_res.second)
- evaluate_solution(coords, true, &m_best_solution);
- }
- }
- }
- }
-
- if ((!m_best_solution.m_error) || ((pass) && (m_best_solution.m_error == prev_best_error)))
- break;
-
- if (m_pParams->m_quality >= cCRNDXTQualityUber)
- {
- // Attempt to refine current solution's endpoints given the current selectors using least squares.
- refine_solution(1);
- }
- }
-
- if (m_pParams->m_quality >= cCRNDXTQualityNormal)
- {
- if ((m_best_solution.m_error) && (!m_pParams->m_pixels_have_alpha))
- {
- bool choose_solid_block = false;
- if (m_best_solution.are_selectors_all_equal())
- {
- // All selectors equal - try various solid-block optimizations
- choose_solid_block = try_average_block_as_solid();
- }
-
- if ((!choose_solid_block) && (m_pParams->m_quality == cCRNDXTQualityUber))
- {
- // Per-component 1D endpoint optimization.
- optimize_endpoint_comps();
- }
- }
-
- if (m_pParams->m_quality == cCRNDXTQualityUber)
- {
- if (m_best_solution.m_error)
- {
- // The pixels may have already been DXTc compressed by another compressor.
- // It's usually possible to recover the endpoints used to previously pack the block.
- try_combinatorial_encoding();
- }
- }
- }
-
- return_solution(*m_pResults, m_best_solution);
-
- if (m_pParams->m_endpoint_caching)
- {
- // Remember result for later reruse.
- m_prev_results[m_num_prev_results & (cMaxPrevResults - 1)] = m_best_solution.m_coords;
- m_num_prev_results++;
- }
-
- return true;
- }
-
- static inline int mul_8bit(int a, int b)
- {
- int t = a * b + 128;
- return (t + (t >> 8)) >> 8;
- }
-
- bool dxt1_endpoint_optimizer::handle_multicolor_block()
- {
- uint num_passes = 1;
- vec3F perceptual_weights(1.0f);
-
- if (m_perceptual)
- {
- // Compute RGB weighting for use in perceptual mode.
- // The more saturated the block, the more the weights deviate from (1,1,1).
- float ave_redness = 0;
- float ave_blueness = 0;
- float ave_l = 0;
-
- for (uint i = 0; i < m_unique_colors.size(); i++)
- {
- const color_quad_u8& c = m_unique_colors[i].m_color;
- const float weight = (float)m_unique_colors[i].m_weight;
-
- int l = mul_8bit(c.r + c.g + c.b, 0x55); // /3
- ave_l += l;
- l = math::maximum(1, l);
-
- float scale = weight / static_cast<float>(l);
-
- ave_redness += scale * c.r;
- ave_blueness += scale * c.b;
- }
-
- ave_redness /= m_total_unique_color_weight;
- ave_blueness /= m_total_unique_color_weight;
- ave_l /= m_total_unique_color_weight;
-
- ave_l = math::minimum(1.0f, ave_l * 16.0f / 255.0f);
-
- //float r = ave_l * powf(math::saturate(ave_redness / 3.0f), 5.0f);
- //float b = ave_l * powf(math::saturate(ave_blueness / 3.0f), 5.0f);
-
- float p = ave_l * powf(math::saturate(math::maximum(ave_redness, ave_blueness) * 1.0f/3.0f), 2.75f);
-
- if (p >= 1.0f)
- num_passes = 1;
- else
- {
- num_passes = 2;
- perceptual_weights = vec3F::lerp(vec3F(.212f, .72f, .072f), perceptual_weights, p);
- }
- }
-
- for (uint pass_index = 0; pass_index < num_passes; pass_index++)
- {
- compute_vectors(perceptual_weights);
-
- compute_pca(m_principle_axis, m_norm_unique_colors_weighted, vec3F(.2837149f, 0.9540631f, 0.096277453f));
-
-#if 0
- matrix44F m(matrix44F::make_scale_matrix(perceptual_weights[0], perceptual_weights[1], perceptual_weights[2]));
- matrix44F im(m.get_inverse());
- im.transpose_in_place();
- m_principle_axis = m_principle_axis * im;
-#else
- // Purposely scale the components of the principle axis by the perceptual weighting.
- // There's probably a cleaner way to go about this, but it works (more competitive in perceptual mode against nvdxt.exe or ATI_Compress).
- m_principle_axis[0] /= perceptual_weights[0];
- m_principle_axis[1] /= perceptual_weights[1];
- m_principle_axis[2] /= perceptual_weights[2];
-#endif
- m_principle_axis.normalize_in_place();
-
- if (num_passes > 1)
- {
- // Check for obviously wild principle axes and try to compensate by backing off the component weightings.
- if (fabs(m_principle_axis[0]) >= .795f)
- perceptual_weights.set(.424f, .6f, .072f);
- else if (fabs(m_principle_axis[2]) >= .795f)
- perceptual_weights.set(.212f, .6f, .212f);
- else
- break;
- }
- }
-
- // Find bounds of projection onto (potentially skewed) principle axis.
- float l = 1e+9;
- float h = -1e+9;
-
- for (uint i = 0; i < m_norm_unique_colors.size(); i++)
- {
- float d = m_norm_unique_colors[i] * m_principle_axis;
- l = math::minimum(l, d);
- h = math::maximum(h, d);
- }
-
- vec3F low_color(m_mean_norm_color + l * m_principle_axis);
- vec3F high_color(m_mean_norm_color + h * m_principle_axis);
-
- if (!low_color.is_within_bounds(0.0f, 1.0f))
- {
- // Low color is outside the lattice, so bring it back in by casting a ray.
- vec3F coord;
- float t;
- aabb3F bounds(vec3F(0.0f), vec3F(1.0f));
- intersection::result res = intersection::ray_aabb(coord, t, ray3F(low_color, m_principle_axis), bounds);
- if (res == intersection::cSuccess)
- low_color = coord;
- }
-
- if (!high_color.is_within_bounds(0.0f, 1.0f))
- {
- // High color is outside the lattice, so bring it back in by casting a ray.
- vec3F coord;
- float t;
- aabb3F bounds(vec3F(0.0f), vec3F(1.0f));
- intersection::result res = intersection::ray_aabb(coord, t, ray3F(high_color, -m_principle_axis), bounds);
- if (res == intersection::cSuccess)
- high_color = coord;
- }
-
- // Now optimize the endpoints using the projection bounds on the (potentially skewed) principle axis as a starting point.
- if (!optimize_endpoints(low_color, high_color))
- return false;
-
- return true;
- }
-
- bool dxt1_endpoint_optimizer::handle_grayscale_block()
- {
- // TODO
- return true;
- }
-
- // Tries quantizing the block to 4 colors using vanilla LBG. It tries all combinations of the quantized results as potential endpoints.
- bool dxt1_endpoint_optimizer::try_median4(const vec3F& low_color, const vec3F& high_color)
- {
- vec3F means[4];
-
- if (m_unique_colors.size() <= 4)
- {
- for (uint i = 0; i < 4; i++)
- means[i] = m_norm_unique_colors[math::minimum<int>(m_norm_unique_colors.size() - 1, i)];
- }
- else
- {
- means[0] = low_color - m_mean_norm_color;
- means[3] = high_color - m_mean_norm_color;
- means[1] = vec3F::lerp(means[0], means[3], 1.0f/3.0f);
- means[2] = vec3F::lerp(means[0], means[3], 2.0f/3.0f);
-
- fast_random rm;
-
- const uint cMaxIters = 8;
- uint reassign_rover = 0;
- float prev_total_dist = math::cNearlyInfinite;
- for (uint iter = 0; iter < cMaxIters; iter++)
- {
- vec3F new_means[4];
- float new_weights[4];
- utils::zero_object(new_means);
- utils::zero_object(new_weights);
-
- float total_dist = 0;
-
- for (uint i = 0; i < m_unique_colors.size(); i++)
- {
- const vec3F& v = m_norm_unique_colors[i];
-
- float best_dist = means[0].squared_distance(v);
- int best_index = 0;
-
- for (uint j = 1; j < 4; j++)
- {
- float dist = means[j].squared_distance(v);
- if (dist < best_dist)
- {
- best_dist = dist;
- best_index = j;
- }
- }
-
- total_dist += best_dist;
-
- new_means[best_index] += v * (float)m_unique_colors[i].m_weight;
- new_weights[best_index] += (float)m_unique_colors[i].m_weight;
- }
-
- uint highest_index = 0;
- float highest_weight = 0;
- bool empty_cell = false;
- for (uint j = 0; j < 4; j++)
- {
- if (new_weights[j] > 0.0f)
- {
- means[j] = new_means[j] / new_weights[j];
- if (new_weights[j] > highest_weight)
- {
- highest_weight = new_weights[j];
- highest_index = j;
- }
- }
- else
- empty_cell = true;
- }
-
- if (!empty_cell)
- {
- if (fabs(total_dist - prev_total_dist) < .00001f)
- break;
-
- prev_total_dist = total_dist;
- }
- else
- prev_total_dist = math::cNearlyInfinite;
-
- if ((empty_cell) && (iter != (cMaxIters - 1)))
- {
- const uint ri = (highest_index + reassign_rover) & 3;
- reassign_rover++;
-
- for (uint j = 0; j < 4; j++)
- {
- if (new_weights[j] == 0.0f)
- {
- means[j] = means[ri];
- means[j] += vec3F::make_random(rm, -.00196f, .00196f);
- }
- }
- }
- }
- }
-
- bool improved = false;
-
- for (uint i = 0; i < 3; i++)
- {
- for (uint j = i + 1; j < 4; j++)
- {
- const vec3F v0(means[i] + m_mean_norm_color);
- const vec3F v1(means[j] + m_mean_norm_color);
-
- dxt1_solution_coordinates sc(
- color_quad_u8((int)floor(.5f + v0[0] * 31.0f), (int)floor(.5f + v0[1] * 63.0f), (int)floor(.5f + v0[2] * 31.0f), 255),
- color_quad_u8((int)floor(.5f + v1[0] * 31.0f), (int)floor(.5f + v1[1] * 63.0f), (int)floor(.5f + v1[2] * 31.0f), 255), false );
-
- sc.canonicalize();
-
- improved |= evaluate_solution(sc, true, &m_best_solution, false);
- }
- }
-
- improved |= refine_solution((m_pParams->m_quality == cCRNDXTQualityUber) ? 1 : 0);
-
- return improved;
- }
-
- // Given candidate low/high endpoints, find the optimal selectors for 3 and 4 color blocks, compute the resulting error,
- // and use the candidate if it results in less error than the best found result so far.
- bool dxt1_endpoint_optimizer::evaluate_solution(
- const dxt1_solution_coordinates& coords,
- bool early_out,
- potential_solution* pBest_solution,
- bool alternate_rounding)
- {
- m_total_evals++;
-
- if ((!m_pSolutions) || (alternate_rounding))
- {
- if (m_pParams->m_quality >= cCRNDXTQualityBetter)
- return evaluate_solution_uber(m_trial_solution, coords, early_out, pBest_solution, alternate_rounding);
- else
- return evaluate_solution_fast(m_trial_solution, coords, early_out, pBest_solution, alternate_rounding);
- }
-
- evaluate_solution_uber(m_trial_solution, coords, false, NULL, alternate_rounding);
-
- CRNLIB_ASSERT(m_trial_solution.m_valid);
-
- // Caller has requested all considered candidate solutions for later analysis.
- m_pSolutions->resize(m_pSolutions->size() + 1);
- solution& new_solution = m_pSolutions->back();
- new_solution.m_selectors.resize(m_pParams->m_num_pixels);
- new_solution.m_results.m_pSelectors = &new_solution.m_selectors[0];
-
- return_solution(new_solution.m_results, m_trial_solution);
-
- if ((pBest_solution) && (m_trial_solution.m_error < m_best_solution.m_error))
- {
- *pBest_solution = m_trial_solution;
- return true;
- }
-
- return false;
- }
-
- inline uint dxt1_endpoint_optimizer::color_distance(bool perceptual, const color_quad_u8& e1, const color_quad_u8& e2, bool alpha)
- {
- if (perceptual)
- {
- return color::color_distance(true, e1, e2, alpha);
- }
- else if (m_pParams->m_grayscale_sampling)
- {
- // Computes error assuming shader will be converting the result to grayscale.
- int y0 = color::RGB_to_Y(e1);
- int y1 = color::RGB_to_Y(e2);
- int yd = y0 - y1;
- if (alpha)
- {
- int da = (int)e1[3] - (int)e2[3];
- return yd * yd + da * da;
- }
- else
- {
- return yd * yd;
- }
- }
- else if (m_has_color_weighting)
- {
- // Compute error using user provided color component weights.
- int dr = (int)e1[0] - (int)e2[0];
- int dg = (int)e1[1] - (int)e2[1];
- int db = (int)e1[2] - (int)e2[2];
-
- dr = (dr * dr) * m_pParams->m_color_weights[0];
- dg = (dg * dg) * m_pParams->m_color_weights[1];
- db = (db * db) * m_pParams->m_color_weights[2];
-
- if (alpha)
- {
- int da = (int)e1[3] - (int)e2[3];
- da = (da * da) * (m_pParams->m_color_weights[0] + m_pParams->m_color_weights[1] + m_pParams->m_color_weights[2]);
- return dr + dg + db + da;
- }
- else
- {
- return dr + dg + db;
- }
- }
- else
- {
- return color::color_distance(false, e1, e2, alpha);
- }
- }
-
- bool dxt1_endpoint_optimizer::evaluate_solution_uber(
- potential_solution& solution,
- const dxt1_solution_coordinates& coords,
- bool early_out,
- potential_solution* pBest_solution,
- bool alternate_rounding)
- {
- solution.m_coords = coords;
- solution.m_selectors.resize(m_unique_colors.size());
-
- if ((pBest_solution) && (early_out))
- solution.m_error = pBest_solution->m_error;
- else
- solution.m_error = cUINT64_MAX;
-
- solution.m_alpha_block = false;
- solution.m_valid = false;
-
- uint first_block_type = 0;
- uint last_block_type = 1;
-
- if ((m_pParams->m_pixels_have_alpha) || (m_pParams->m_force_alpha_blocks))
- first_block_type = 1;
- else if (!m_pParams->m_use_alpha_blocks)
- last_block_type = 0;
-
- m_trial_selectors.resize(m_unique_colors.size());
-
- color_quad_u8 colors[cDXT1SelectorValues];
-
- colors[0] = dxt1_block::unpack_color(coords.m_low_color, true);
- colors[1] = dxt1_block::unpack_color(coords.m_high_color, true);
-
- for (uint block_type = first_block_type; block_type <= last_block_type; block_type++)
- {
- uint64 trial_error = 0;
-
- if (!block_type)
- {
- colors[2].set_noclamp_rgba( (colors[0].r * 2 + colors[1].r + alternate_rounding) / 3, (colors[0].g * 2 + colors[1].g + alternate_rounding) / 3, (colors[0].b * 2 + colors[1].b + alternate_rounding) / 3, 0);
- colors[3].set_noclamp_rgba( (colors[1].r * 2 + colors[0].r + alternate_rounding) / 3, (colors[1].g * 2 + colors[0].g + alternate_rounding) / 3, (colors[1].b * 2 + colors[0].b + alternate_rounding) / 3, 0);
-
- if (m_perceptual)
- {
- for (int unique_color_index = (int)m_unique_colors.size() - 1; unique_color_index >= 0; unique_color_index--)
- {
- const color_quad_u8& c = m_unique_colors[unique_color_index].m_color;
-
- uint best_error = color_distance(true, c, colors[0], false);
- uint best_color_index = 0;
-
- uint err = color_distance(true, c, colors[1], false);
- if (err < best_error) { best_error = err; best_color_index = 1; }
-
- err = color_distance(true, c, colors[2], false);
- if (err < best_error) { best_error = err; best_color_index = 2; }
-
- err = color_distance(true, c, colors[3], false);
- if (err < best_error) { best_error = err; best_color_index = 3; }
-
- trial_error += best_error * static_cast<uint64>(m_unique_colors[unique_color_index].m_weight);
- if (trial_error >= solution.m_error)
- break;
-
- m_trial_selectors[unique_color_index] = static_cast<uint8>(best_color_index);
- }
- }
- else
- {
- for (int unique_color_index = (int)m_unique_colors.size() - 1; unique_color_index >= 0; unique_color_index--)
- {
- const color_quad_u8& c = m_unique_colors[unique_color_index].m_color;
-
- uint best_error = color_distance(false, c, colors[0], false);
- uint best_color_index = 0;
-
- uint err = color_distance(false, c, colors[1], false);
- if (err < best_error) { best_error = err; best_color_index = 1; }
-
- err = color_distance(false, c, colors[2], false);
- if (err < best_error) { best_error = err; best_color_index = 2; }
-
- err = color_distance(false, c, colors[3], false);
- if (err < best_error) { best_error = err; best_color_index = 3; }
-
- trial_error += best_error * static_cast<uint64>(m_unique_colors[unique_color_index].m_weight);
- if (trial_error >= solution.m_error)
- break;
-
- m_trial_selectors[unique_color_index] = static_cast<uint8>(best_color_index);
- }
- }
- }
- else
- {
- colors[2].set_noclamp_rgba( (colors[0].r + colors[1].r + alternate_rounding) >> 1, (colors[0].g + colors[1].g + alternate_rounding) >> 1, (colors[0].b + colors[1].b + alternate_rounding) >> 1, 255U);
-
- if (m_perceptual)
- {
- for (int unique_color_index = (int)m_unique_colors.size() - 1; unique_color_index >= 0; unique_color_index--)
- {
- const color_quad_u8& c = m_unique_colors[unique_color_index].m_color;
-
- uint best_error = color_distance(true, c, colors[0], false);
- uint best_color_index = 0;
-
- uint err = color_distance(true, c, colors[1], false);
- if (err < best_error) { best_error = err; best_color_index = 1; }
-
- err = color_distance(true, c, colors[2], false);
- if (err < best_error) { best_error = err; best_color_index = 2; }
-
- trial_error += best_error * static_cast<uint64>(m_unique_colors[unique_color_index].m_weight);
- if (trial_error >= solution.m_error)
- break;
-
- m_trial_selectors[unique_color_index] = static_cast<uint8>(best_color_index);
- }
- }
- else
- {
- for (int unique_color_index = (int)m_unique_colors.size() - 1; unique_color_index >= 0; unique_color_index--)
- {
- const color_quad_u8& c = m_unique_colors[unique_color_index].m_color;
-
- uint best_error = color_distance(false, c, colors[0], false);
- uint best_color_index = 0;
-
- uint err = color_distance(false, c, colors[1], false);
- if (err < best_error) { best_error = err; best_color_index = 1; }
-
- err = color_distance(false, c, colors[2], false);
- if (err < best_error) { best_error = err; best_color_index = 2; }
-
- trial_error += best_error * static_cast<uint64>(m_unique_colors[unique_color_index].m_weight);
- if (trial_error >= solution.m_error)
- break;
-
- m_trial_selectors[unique_color_index] = static_cast<uint8>(best_color_index);
- }
- }
- }
-
- if (trial_error < solution.m_error)
- {
- solution.m_error = trial_error;
- solution.m_alpha_block = (block_type != 0);
- solution.m_selectors = m_trial_selectors;
- solution.m_valid = true;
- }
- }
-
- if ((!solution.m_alpha_block) && (solution.m_coords.m_low_color == solution.m_coords.m_high_color))
- {
- uint s;
- if ((solution.m_coords.m_low_color & 31) != 31)
- {
- solution.m_coords.m_low_color++;
- s = 1;
- }
- else
- {
- solution.m_coords.m_high_color--;
- s = 0;
- }
-
- for (uint i = 0; i < m_unique_colors.size(); i++)
- solution.m_selectors[i] = static_cast<uint8>(s);
- }
-
- if ((pBest_solution) && (solution.m_error < pBest_solution->m_error))
- {
- *pBest_solution = solution;
- return true;
- }
-
- return false;
- }
-
- bool dxt1_endpoint_optimizer::evaluate_solution_fast(
- potential_solution& solution,
- const dxt1_solution_coordinates& coords,
- bool early_out,
- potential_solution* pBest_solution,
- bool alternate_rounding)
- {
- solution.m_coords = coords;
- solution.m_selectors.resize(m_unique_colors.size());
-
- if ((pBest_solution) && (early_out))
- solution.m_error = pBest_solution->m_error;
- else
- solution.m_error = cUINT64_MAX;
-
- solution.m_alpha_block = false;
- solution.m_valid = false;
-
- uint first_block_type = 0;
- uint last_block_type = 1;
-
- if ((m_pParams->m_pixels_have_alpha) || (m_pParams->m_force_alpha_blocks))
- first_block_type = 1;
- else if (!m_pParams->m_use_alpha_blocks)
- last_block_type = 0;
-
- m_trial_selectors.resize(m_unique_colors.size());
-
- color_quad_u8 colors[cDXT1SelectorValues];
- colors[0] = dxt1_block::unpack_color(coords.m_low_color, true);
- colors[1] = dxt1_block::unpack_color(coords.m_high_color, true);
-
- int vr = colors[1].r - colors[0].r;
- int vg = colors[1].g - colors[0].g;
- int vb = colors[1].b - colors[0].b;
- if (m_perceptual)
- {
- vr *= 8;
- vg *= 24;
- }
-
- int stops[4];
- stops[0] = colors[0].r*vr + colors[0].g*vg + colors[0].b*vb;
- stops[1] = colors[1].r*vr + colors[1].g*vg + colors[1].b*vb;
-
- int dirr = vr * 2;
- int dirg = vg * 2;
- int dirb = vb * 2;
-
- for (uint block_type = first_block_type; block_type <= last_block_type; block_type++)
- {
- uint64 trial_error = 0;
-
- if (!block_type)
- {
- colors[2].set_noclamp_rgba( (colors[0].r * 2 + colors[1].r + alternate_rounding) / 3, (colors[0].g * 2 + colors[1].g + alternate_rounding) / 3, (colors[0].b * 2 + colors[1].b + alternate_rounding) / 3, 255U);
- colors[3].set_noclamp_rgba( (colors[1].r * 2 + colors[0].r + alternate_rounding) / 3, (colors[1].g * 2 + colors[0].g + alternate_rounding) / 3, (colors[1].b * 2 + colors[0].b + alternate_rounding) / 3, 255U);
-
- stops[2] = colors[2].r*vr + colors[2].g*vg + colors[2].b*vb;
- stops[3] = colors[3].r*vr + colors[3].g*vg + colors[3].b*vb;
-
- // 0 2 3 1
- int c0Point = stops[1] + stops[3];
- int halfPoint = stops[3] + stops[2];
- int c3Point = stops[2] + stops[0];
-
- for (int unique_color_index = (int)m_unique_colors.size() - 1; unique_color_index >= 0; unique_color_index--)
- {
- const color_quad_u8& c = m_unique_colors[unique_color_index].m_color;
-
- int dot = c.r*dirr + c.g*dirg + c.b*dirb;
-
- uint8 best_color_index;
- if (dot < halfPoint)
- best_color_index = (dot < c3Point) ? 0 : 2;
- else
- best_color_index = (dot < c0Point) ? 3 : 1;
-
- uint best_error = color_distance(m_perceptual, c, colors[best_color_index], false);
-
- trial_error += best_error * static_cast<uint64>(m_unique_colors[unique_color_index].m_weight);
- if (trial_error >= solution.m_error)
- break;
-
- m_trial_selectors[unique_color_index] = static_cast<uint8>(best_color_index);
- }
- }
- else
- {
- colors[2].set_noclamp_rgba( (colors[0].r + colors[1].r + alternate_rounding) >> 1, (colors[0].g + colors[1].g + alternate_rounding) >> 1, (colors[0].b + colors[1].b + alternate_rounding) >> 1, 255U);
-
- stops[2] = colors[2].r*vr + colors[2].g*vg + colors[2].b*vb;
-
- // 0 2 1
- int c02Point = stops[0] + stops[2];
- int c21Point = stops[2] + stops[1];
-
- for (int unique_color_index = (int)m_unique_colors.size() - 1; unique_color_index >= 0; unique_color_index--)
- {
- const color_quad_u8& c = m_unique_colors[unique_color_index].m_color;
-
- int dot = c.r*dirr + c.g*dirg + c.b*dirb;
-
- uint8 best_color_index;
- if (dot < c02Point)
- best_color_index = 0;
- else if (dot < c21Point)
- best_color_index = 2;
- else
- best_color_index = 1;
-
- uint best_error = color_distance(m_perceptual, c, colors[best_color_index], false);
-
- trial_error += best_error * static_cast<uint64>(m_unique_colors[unique_color_index].m_weight);
- if (trial_error >= solution.m_error)
- break;
-
- m_trial_selectors[unique_color_index] = static_cast<uint8>(best_color_index);
- }
- }
-
- if (trial_error < solution.m_error)
- {
- solution.m_error = trial_error;
- solution.m_alpha_block = (block_type != 0);
- solution.m_selectors = m_trial_selectors;
- solution.m_valid = true;
- }
- }
-
- if ((!solution.m_alpha_block) && (solution.m_coords.m_low_color == solution.m_coords.m_high_color))
- {
- uint s;
- if ((solution.m_coords.m_low_color & 31) != 31)
- {
- solution.m_coords.m_low_color++;
- s = 1;
- }
- else
- {
- solution.m_coords.m_high_color--;
- s = 0;
- }
-
- for (uint i = 0; i < m_unique_colors.size(); i++)
- solution.m_selectors[i] = static_cast<uint8>(s);
- }
-
- if ((pBest_solution) && (solution.m_error < pBest_solution->m_error))
- {
- *pBest_solution = solution;
- return true;
- }
-
- return false;
- }
-
- unique_color dxt1_endpoint_optimizer::lerp_color(const color_quad_u8& a, const color_quad_u8& b, float f, int rounding)
- {
- color_quad_u8 res;
-
- float r = rounding ? 1.0f : 0.0f;
- res[0] = static_cast<uint8>(math::clamp(math::float_to_int(r + math::lerp<float>(a[0], b[0], f)), 0, 255));
- res[1] = static_cast<uint8>(math::clamp(math::float_to_int(r + math::lerp<float>(a[1], b[1], f)), 0, 255));
- res[2] = static_cast<uint8>(math::clamp(math::float_to_int(r + math::lerp<float>(a[2], b[2], f)), 0, 255));
- res[3] = 255;
-
- return unique_color(res, 1);
- }
-
- // The block may have been already compressed using another DXTc compressor, such as squish, ATI_Compress, ryg_dxt, etc.
- // Attempt to recover the endpoints used by that block compressor.
- void dxt1_endpoint_optimizer::try_combinatorial_encoding()
- {
- if ((m_unique_colors.size() < 2) || (m_unique_colors.size() > 4))
- return;
-
- m_temp_unique_colors = m_unique_colors;
-
- if (m_temp_unique_colors.size() == 2)
- {
- // a b c d
- // 0.0 1/3 2/3 1.0
-
- for (uint k = 0; k < 2; k++)
- {
- for (uint q = 0; q < 2; q++)
- {
- const uint r = q ^ 1;
-
- // a b
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[q].m_color, m_temp_unique_colors[r].m_color, 2.0f, k));
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[q].m_color, m_temp_unique_colors[r].m_color, 3.0f, k));
-
- // a c
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[q].m_color, m_temp_unique_colors[r].m_color, .5f, k));
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[q].m_color, m_temp_unique_colors[r].m_color, 1.5f, k));
-
- // a d
-
- // b c
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[q].m_color, m_temp_unique_colors[r].m_color, -1.0f, k));
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[q].m_color, m_temp_unique_colors[r].m_color, 2.0f, k));
-
- // b d
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[q].m_color, m_temp_unique_colors[r].m_color, -.5f, k));
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[q].m_color, m_temp_unique_colors[r].m_color, .5f, k));
-
- // c d
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[q].m_color, m_temp_unique_colors[r].m_color, -2.0f, k));
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[q].m_color, m_temp_unique_colors[r].m_color, -1.0f, k));
- }
- }
- }
- else if (m_temp_unique_colors.size() == 3)
- {
- // a b c d
- // 0.0 1/3 2/3 1.0
-
- for (uint i = 0; i <= 2; i++)
- {
- for (uint j = 0; j <= 2; j++)
- {
- if (i == j)
- continue;
-
- // a b c
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[i].m_color, m_temp_unique_colors[j].m_color, 1.5f));
-
- // a b d
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[i].m_color, m_temp_unique_colors[j].m_color, 2.0f/3.0f));
-
- // a c d
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[i].m_color, m_temp_unique_colors[j].m_color, 1.0f/3.0f));
-
- // b c d
- m_temp_unique_colors.push_back(lerp_color(m_temp_unique_colors[i].m_color, m_temp_unique_colors[j].m_color, -.5f));
- }
- }
- }
-
- m_unique_packed_colors.resize(0);
-
- for (uint i = 0; i < m_temp_unique_colors.size(); i++)
- {
- const color_quad_u8& unique_color = m_temp_unique_colors[i].m_color;
- const uint16 packed_color = dxt1_block::pack_color(unique_color, true);
-
- if (std::find(m_unique_packed_colors.begin(), m_unique_packed_colors.end(), packed_color) != m_unique_packed_colors.end())
- continue;
-
- m_unique_packed_colors.push_back(packed_color);
- }
-
- if (m_unique_packed_colors.size() < 2)
- return;
-
- for (uint alt_rounding = 0; alt_rounding < 2; alt_rounding++)
- {
- for (uint i = 0; i < m_unique_packed_colors.size() - 1; i++)
- {
- for (uint j = i + 1; j < m_unique_packed_colors.size(); j++)
- {
- evaluate_solution(
- dxt1_solution_coordinates(m_unique_packed_colors[i], m_unique_packed_colors[j]),
- true,
- (alt_rounding == 0) ? &m_best_solution : NULL,
- (alt_rounding != 0));
-
- if (m_trial_solution.m_error == 0)
- {
- if (alt_rounding)
- m_best_solution = m_trial_solution;
-
- return;
- }
- }
- }
- }
-
- return;
- }
-
- // The fourth (transparent) color in 3 color "transparent" blocks is black, which can be optionally exploited for small gains in DXT1 mode if the caller
- // doesn't actually use alpha. (But not in DXT5 mode, because 3-color blocks aren't permitted by GPU's for DXT5.)
- bool dxt1_endpoint_optimizer::try_alpha_as_black_optimization()
- {
- const params* pOrig_params = m_pParams;
- pOrig_params;
- results* pOrig_results = m_pResults;
-
- uint num_dark_colors = 0;
-
- for (uint i = 0; i < m_unique_colors.size(); i++)
- if ( (m_unique_colors[i].m_color[0] <= 4) && (m_unique_colors[i].m_color[1] <= 4) && (m_unique_colors[i].m_color[2] <= 4) )
- num_dark_colors++;
-
- if ( (!num_dark_colors) || (num_dark_colors == m_unique_colors.size()) )
- return true;
-
- params trial_params(*m_pParams);
- crnlib::vector<color_quad_u8> trial_colors;
- trial_colors.insert(0, m_pParams->m_pPixels, m_pParams->m_num_pixels);
-
- trial_params.m_pPixels = trial_colors.get_ptr();
- trial_params.m_pixels_have_alpha = true;
-
- for (uint i = 0; i < trial_colors.size(); i++)
- if ( (trial_colors[i][0] <= 4) && (trial_colors[i][1] <= 4) && (trial_colors[i][2] <= 4) )
- trial_colors[i][3] = 0;
-
- results trial_results;
-
- crnlib::vector<uint8> trial_selectors(m_pParams->m_num_pixels);
- trial_results.m_pSelectors = trial_selectors.get_ptr();
-
- if (!compute_internal(trial_params, trial_results, NULL))
- return false;
-
- CRNLIB_ASSERT(trial_results.m_alpha_block);
-
- color_quad_u8 c[4];
- dxt1_block::get_block_colors3(c, trial_results.m_low_color, trial_results.m_high_color);
-
- uint64 trial_error = 0;
-
- for (uint i = 0; i < trial_colors.size(); i++)
- {
- if (trial_colors[i][3] == 0)
- {
- CRNLIB_ASSERT(trial_selectors[i] == 3);
- }
- else
- {
- CRNLIB_ASSERT(trial_selectors[i] != 3);
- }
-
- trial_error += color_distance(m_perceptual, trial_colors[i], c[trial_selectors[i]], false);
- }
-
- if (trial_error < pOrig_results->m_error)
- {
- pOrig_results->m_error = trial_error;
-
- pOrig_results->m_low_color = trial_results.m_low_color;
- pOrig_results->m_high_color = trial_results.m_high_color;
-
- if (pOrig_results->m_pSelectors)
- memcpy(pOrig_results->m_pSelectors, trial_results.m_pSelectors, m_pParams->m_num_pixels);
-
- pOrig_results->m_alpha_block = true;
- }
-
- return true;
- }
-
- bool dxt1_endpoint_optimizer::compute_internal(const params& p, results& r, solution_vec* pSolutions)
- {
- clear();
-
- m_pParams = &p;
- m_pResults = &r;
- m_pSolutions = pSolutions;
-
- m_has_color_weighting = (m_pParams->m_color_weights[0] != 1) || (m_pParams->m_color_weights[1] != 1) || (m_pParams->m_color_weights[2] != 1);
- m_perceptual = m_pParams->m_perceptual && !m_has_color_weighting && !m_pParams->m_grayscale_sampling;
-
- find_unique_colors();
-
- m_best_solution.clear();
-
- if (m_unique_colors.empty())
- return handle_all_transparent_block();
- else if ((m_unique_colors.size() == 1) && (!m_has_transparent_pixels))
- return handle_solid_block();
- else
- {
- if (!handle_multicolor_block())
- return false;
-
- if ((m_all_pixels_grayscale) && (m_best_solution.m_error))
- {
- if (!handle_grayscale_block())
- return false;
- }
- }
-
- return true;
- }
-
- bool dxt1_endpoint_optimizer::compute(const params& p, results& r, solution_vec* pSolutions)
- {
- if (!p.m_pPixels)
- return false;
-
- bool status = compute_internal(p, r, pSolutions);
- if (!status)
- return false;
-
- if ( (m_pParams->m_use_alpha_blocks) && (m_pParams->m_use_transparent_indices_for_black) && (!m_pParams->m_pixels_have_alpha) && (!pSolutions) )
- {
- if (!try_alpha_as_black_optimization())
- return false;
- }
-
- return true;
- }
-
- // Build array of unique colors and their weights.
- void dxt1_endpoint_optimizer::find_unique_colors()
- {
- m_has_transparent_pixels = false;
-
- uint num_opaque_pixels = 0;
-
- const uint alpha_thresh = m_pParams->m_pixels_have_alpha ? (m_pParams->m_dxt1a_alpha_threshold << 24U) : 0;
-
- const uint32* pSrc_pixels = reinterpret_cast<const uint32*>(m_pParams->m_pPixels);
- const uint32* pSrc_pixels_end = pSrc_pixels + m_pParams->m_num_pixels;
-
- m_unique_colors.resize(m_pParams->m_num_pixels);
- uint num_unique_colors = 0;
-
- m_all_pixels_grayscale = true;
-
- do
- {
- uint32 c = utils::read_le32(pSrc_pixels);
- pSrc_pixels++;
-
- if (c < alpha_thresh)
- {
- m_has_transparent_pixels = true;
- continue;
- }
-
- if (m_all_pixels_grayscale)
- {
- uint r = c & 0xFF;
- uint g = (c >> 8) & 0xFF;
- uint b = (c >> 16) & 0xFF;
- if ((r != g) || (r != b))
- m_all_pixels_grayscale = false;
- }
-
- c |= 0xFF000000U;
-
- unique_color_hash_map::insert_result ins_result(m_unique_color_hash_map.insert(c, num_unique_colors));
-
- if (ins_result.second)
- {
- utils::write_le32(&m_unique_colors[num_unique_colors].m_color.m_u32, c);
- m_unique_colors[num_unique_colors].m_weight = 1;
- num_unique_colors++;
- }
- else
- m_unique_colors[ins_result.first->second].m_weight++;
-
- num_opaque_pixels++;
-
- } while (pSrc_pixels != pSrc_pixels_end);
-
- m_unique_colors.resize(num_unique_colors);
-
- m_total_unique_color_weight = num_opaque_pixels;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt1.h b/Libraries/crunch-ea9b8d/crnlib/crn_dxt1.h
deleted file mode 100644
index 9a747ca3..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt1.h
+++ /dev/null
@@ -1,352 +0,0 @@
-// File: crn_dxt1.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_dxt.h"
-
-namespace crnlib
-{
- struct dxt1_solution_coordinates
- {
- inline dxt1_solution_coordinates() : m_low_color(0), m_high_color(0){ }
-
- inline dxt1_solution_coordinates(uint16 l, uint16 h) : m_low_color(l), m_high_color(h) { }
-
- inline dxt1_solution_coordinates(const color_quad_u8& l, const color_quad_u8& h, bool scaled = true) :
- m_low_color(dxt1_block::pack_color(l, scaled)),
- m_high_color(dxt1_block::pack_color(h, scaled))
- {
- }
-
- inline dxt1_solution_coordinates(vec3F nl, vec3F nh)
- {
-#if CRNLIB_DXT_ALT_ROUNDING
- // Umm, wtf?
- nl.clamp(0.0f, .999f);
- nh.clamp(0.0f, .999f);
- color_quad_u8 l( (int)floor(nl[0] * 32.0f), (int)floor(nl[1] * 64.0f), (int)floor(nl[2] * 32.0f), 255);
- color_quad_u8 h( (int)floor(nh[0] * 32.0f), (int)floor(nh[1] * 64.0f), (int)floor(nh[2] * 32.0f), 255);
-#else
- // Fixes the bins
- color_quad_u8 l( (int)floor(.5f + nl[0] * 31.0f), (int)floor(.5f + nl[1] * 63.0f), (int)floor(.5f + nl[2] * 31.0f), 255);
- color_quad_u8 h( (int)floor(.5f + nh[0] * 31.0f), (int)floor(.5f + nh[1] * 63.0f), (int)floor(.5f + nh[2] * 31.0f), 255);
-#endif
-
- m_low_color = dxt1_block::pack_color(l, false);
- m_high_color = dxt1_block::pack_color(h, false);
- }
-
- uint16 m_low_color;
- uint16 m_high_color;
-
- inline void clear()
- {
- m_low_color = 0;
- m_high_color = 0;
- }
-
- inline dxt1_solution_coordinates& canonicalize()
- {
- if (m_low_color < m_high_color)
- utils::swap(m_low_color, m_high_color);
- return *this;
- }
-
- inline operator size_t() const { return fast_hash(this, sizeof(*this)); }
-
- inline bool operator== (const dxt1_solution_coordinates& other) const
- {
- uint16 l0 = math::minimum(m_low_color, m_high_color);
- uint16 h0 = math::maximum(m_low_color, m_high_color);
-
- uint16 l1 = math::minimum(other.m_low_color, other.m_high_color);
- uint16 h1 = math::maximum(other.m_low_color, other.m_high_color);
-
- return (l0 == l1) && (h0 == h1);
- }
-
- inline bool operator!= (const dxt1_solution_coordinates& other) const
- {
- return !(*this == other);
- }
-
- inline bool operator< (const dxt1_solution_coordinates& other) const
- {
- uint16 l0 = math::minimum(m_low_color, m_high_color);
- uint16 h0 = math::maximum(m_low_color, m_high_color);
-
- uint16 l1 = math::minimum(other.m_low_color, other.m_high_color);
- uint16 h1 = math::maximum(other.m_low_color, other.m_high_color);
-
- if (l0 < l1)
- return true;
- else if (l0 == l1)
- {
- if (h0 < h1)
- return true;
- }
-
- return false;
- }
- };
-
- typedef crnlib::vector<dxt1_solution_coordinates> dxt1_solution_coordinates_vec;
-
- CRNLIB_DEFINE_BITWISE_COPYABLE(dxt1_solution_coordinates);
-
- struct unique_color
- {
- inline unique_color() { }
- inline unique_color(const color_quad_u8& color, uint weight) : m_color(color), m_weight(weight) { }
-
- color_quad_u8 m_color;
- uint m_weight;
-
- inline bool operator< (const unique_color& c) const
- {
- return *reinterpret_cast<const uint32*>(&m_color) < *reinterpret_cast<const uint32*>(&c.m_color);
- }
-
- inline bool operator== (const unique_color& c) const
- {
- return *reinterpret_cast<const uint32*>(&m_color) == *reinterpret_cast<const uint32*>(&c.m_color);
- }
- };
-
- CRNLIB_DEFINE_BITWISE_COPYABLE(unique_color);
-
- class dxt1_endpoint_optimizer
- {
- public:
- dxt1_endpoint_optimizer();
-
- struct params
- {
- params() :
- m_block_index(0),
- m_pPixels(NULL),
- m_num_pixels(0),
- m_dxt1a_alpha_threshold(128U),
- m_quality(cCRNDXTQualityUber),
- m_pixels_have_alpha(false),
- m_use_alpha_blocks(true),
- m_perceptual(true),
- m_grayscale_sampling(false),
- m_endpoint_caching(true),
- m_use_transparent_indices_for_black(false),
- m_force_alpha_blocks(false)
- {
- m_color_weights[0] = 1;
- m_color_weights[1] = 1;
- m_color_weights[2] = 1;
- }
-
- uint m_block_index;
-
- const color_quad_u8* m_pPixels;
- uint m_num_pixels;
- uint m_dxt1a_alpha_threshold;
-
- crn_dxt_quality m_quality;
-
- bool m_pixels_have_alpha;
- bool m_use_alpha_blocks;
- bool m_perceptual;
- bool m_grayscale_sampling;
- bool m_endpoint_caching;
- bool m_use_transparent_indices_for_black;
- bool m_force_alpha_blocks;
- int m_color_weights[3];
- };
-
- struct results
- {
- inline results() : m_pSelectors(NULL) { }
-
- uint64 m_error;
-
- uint16 m_low_color;
- uint16 m_high_color;
-
- uint8* m_pSelectors;
- bool m_alpha_block;
- };
-
- struct solution
- {
- solution() { }
-
- solution(const solution& other)
- {
- m_results = other.m_results;
- m_selectors = other.m_selectors;
- m_results.m_pSelectors = m_selectors.begin();
- }
-
- solution& operator= (const solution& rhs)
- {
- if (this == &rhs)
- return *this;
-
- m_results = rhs.m_results;
- m_selectors = rhs.m_selectors;
- m_results.m_pSelectors = m_selectors.begin();
-
- return *this;
- }
-
- results m_results;
- crnlib::vector<uint8> m_selectors;
-
- inline bool operator< (const solution& other) const
- {
- return m_results.m_error < other.m_results.m_error;
- }
- static inline bool coords_equal(const solution& lhs, const solution& rhs)
- {
- return (lhs.m_results.m_low_color == rhs.m_results.m_low_color) && (lhs.m_results.m_high_color == rhs.m_results.m_high_color);
- }
- };
- typedef crnlib::vector<solution> solution_vec;
-
- bool compute(const params& p, results& r, solution_vec* pSolutions = NULL);
-
- private:
- const params* m_pParams;
- results* m_pResults;
- solution_vec* m_pSolutions;
-
- bool m_perceptual;
- bool m_has_color_weighting;
-
- typedef crnlib::vector<unique_color> unique_color_vec;
-
- //typedef crnlib::hash_map<uint32, uint32, bit_hasher<uint32> > unique_color_hash_map;
- typedef crnlib::hash_map<uint32, uint32> unique_color_hash_map;
- unique_color_hash_map m_unique_color_hash_map;
-
- unique_color_vec m_unique_colors; // excludes transparent colors!
- unique_color_vec m_temp_unique_colors;
-
- uint m_total_unique_color_weight;
-
- bool m_has_transparent_pixels;
-
- vec3F_array m_norm_unique_colors;
- vec3F m_mean_norm_color;
-
- vec3F_array m_norm_unique_colors_weighted;
- vec3F m_mean_norm_color_weighted;
-
- vec3F m_principle_axis;
-
- bool m_all_pixels_grayscale;
-
- crnlib::vector<uint16> m_unique_packed_colors;
- crnlib::vector<uint8> m_trial_selectors;
-
- crnlib::vector<vec3F> m_low_coords;
- crnlib::vector<vec3F> m_high_coords;
-
- enum { cMaxPrevResults = 4 };
- dxt1_solution_coordinates m_prev_results[cMaxPrevResults];
- uint m_num_prev_results;
-
- crnlib::vector<vec3I> m_lo_cells;
- crnlib::vector<vec3I> m_hi_cells;
-
- uint m_total_evals;
-
- struct potential_solution
- {
- potential_solution() : m_coords(), m_error(cUINT64_MAX), m_alpha_block(false), m_valid(false)
- {
- }
-
- dxt1_solution_coordinates m_coords;
- crnlib::vector<uint8> m_selectors;
- uint64 m_error;
- bool m_alpha_block;
- bool m_valid;
-
- void clear()
- {
- m_coords.clear();
- m_selectors.resize(0);
- m_error = cUINT64_MAX;
- m_alpha_block = false;
- m_valid = false;
- }
-
- bool are_selectors_all_equal() const
- {
- if (m_selectors.empty())
- return false;
- const uint s = m_selectors[0];
- for (uint i = 1; i < m_selectors.size(); i++)
- if (m_selectors[i] != s)
- return false;
- return true;
- }
- };
-
- potential_solution m_trial_solution;
- potential_solution m_best_solution;
-
- typedef crnlib::hash_map<uint, empty_type> solution_hash_map;
- solution_hash_map m_solutions_tried;
-
- bool refine_solution(int refinement_level = 0);
-
- bool evaluate_solution(
- const dxt1_solution_coordinates& coords,
- bool early_out,
- potential_solution* pBest_solution,
- bool alternate_rounding = false);
-
- bool evaluate_solution_uber(
- potential_solution& solution,
- const dxt1_solution_coordinates& coords,
- bool early_out,
- potential_solution* pBest_solution,
- bool alternate_rounding = false);
-
- bool evaluate_solution_fast(
- potential_solution& solution,
- const dxt1_solution_coordinates& coords,
- bool early_out,
- potential_solution* pBest_solution,
- bool alternate_rounding = false);
-
- void clear();
- void find_unique_colors();
- bool handle_all_transparent_block();
- bool handle_solid_block();
- bool handle_multicolor_block();
- bool handle_grayscale_block();
- void compute_pca(vec3F& axis, const vec3F_array& norm_colors, const vec3F& def);
- void compute_vectors(const vec3F& perceptual_weights);
- void return_solution(results& results, const potential_solution& solution);
- void try_combinatorial_encoding();
- void optimize_endpoint_comps();
- bool optimize_endpoints(vec3F& low_color, vec3F& high_color);
- bool try_alpha_as_black_optimization();
- bool try_average_block_as_solid();
- bool try_median4(const vec3F& low_color, const vec3F& high_color);
-
- bool compute_internal(const params& p, results& r, solution_vec* pSolutions);
-
- unique_color lerp_color(const color_quad_u8& a, const color_quad_u8& b, float f, int rounding = 1);
-
- inline uint color_distance(bool perceptual, const color_quad_u8& e1, const color_quad_u8& e2, bool alpha);
-
- static inline vec3F unpack_to_vec3F_raw(uint16 packed_color);
- static inline vec3F unpack_to_vec3F(uint16 packed_color);
- };
-
- inline void swap(dxt1_endpoint_optimizer::solution& a, dxt1_endpoint_optimizer::solution& b)
- {
- std::swap(a.m_results, b.m_results);
- a.m_selectors.swap(b.m_selectors);
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt5a.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_dxt5a.cpp
deleted file mode 100644
index 9901a66e..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt5a.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-// File: crn_dxt5a.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_dxt5a.h"
-#include "crn_ryg_dxt.hpp"
-#include "crn_dxt_fast.h"
-#include "crn_intersect.h"
-
-namespace crnlib
-{
- dxt5_endpoint_optimizer::dxt5_endpoint_optimizer() :
- m_pParams(NULL),
- m_pResults(NULL)
- {
- m_unique_values.reserve(16);
- m_unique_value_weights.reserve(16);
- }
-
- bool dxt5_endpoint_optimizer::compute(const params& p, results& r)
- {
- m_pParams = &p;
- m_pResults = &r;
-
- if ((!p.m_num_pixels) || (!p.m_pPixels))
- return false;
-
- m_unique_values.resize(0);
- m_unique_value_weights.resize(0);
-
- for (uint i = 0; i < 256; i++)
- m_unique_value_map[i] = -1;
-
- for (uint i = 0; i < p.m_num_pixels; i++)
- {
- uint alpha = p.m_pPixels[i][p.m_comp_index];
-
- int index = m_unique_value_map[alpha];
-
- if (index == -1)
- {
- index = m_unique_values.size();
-
- m_unique_value_map[alpha] = index;
-
- m_unique_values.push_back(static_cast<uint8>(alpha));
- m_unique_value_weights.push_back(0);
- }
-
- m_unique_value_weights[index]++;
- }
-
- if (m_unique_values.size() == 1)
- {
- r.m_block_type = 0;
- r.m_error = 0;
- r.m_first_endpoint = m_unique_values[0];
- r.m_second_endpoint = m_unique_values[0];
- memset(r.m_pSelectors, 0, p.m_num_pixels);
- return true;
- }
-
- m_trial_selectors.resize(m_unique_values.size());
- m_best_selectors.resize(m_unique_values.size());
-
- r.m_error = cUINT64_MAX;
-
- for (uint i = 0; i < m_unique_values.size() - 1; i++)
- {
- const uint low_endpoint = m_unique_values[i];
-
- for (uint j = i + 1; j < m_unique_values.size(); j++)
- {
- const uint high_endpoint = m_unique_values[j];
-
- evaluate_solution(low_endpoint, high_endpoint);
- }
- }
-
- if ((m_pParams->m_quality >= cCRNDXTQualityBetter) && (m_pResults->m_error))
- {
- m_flags.resize(256 * 256);
- m_flags.clear_all_bits();
-
- const int cProbeAmount = (m_pParams->m_quality == cCRNDXTQualityUber) ? 16 : 8;
-
- for (int l_delta = -cProbeAmount; l_delta <= cProbeAmount; l_delta++)
- {
- const int l = m_pResults->m_first_endpoint + l_delta;
- if (l < 0)
- continue;
- else if (l > 255)
- break;
-
- const uint bit_index = l * 256;
-
- for (int h_delta = -cProbeAmount; h_delta <= cProbeAmount; h_delta++)
- {
- const int h = m_pResults->m_second_endpoint + h_delta;
- if (h < 0)
- continue;
- else if (h > 255)
- break;
-
- //if (m_flags.get_bit(bit_index + h))
- // continue;
- if ((m_flags.get_bit(bit_index + h)) || (m_flags.get_bit(h * 256 + l)))
- continue;
- m_flags.set_bit(bit_index + h);
-
- evaluate_solution(static_cast<uint>(l), static_cast<uint>(h));
- }
- }
- }
-
- if (m_pResults->m_first_endpoint == m_pResults->m_second_endpoint)
- {
- for (uint i = 0; i < m_best_selectors.size(); i++)
- m_best_selectors[i] = 0;
- }
- else if (m_pResults->m_block_type)
- {
- //if (l > h)
- // eight alpha
- // else
- // six alpha
-
- if (m_pResults->m_first_endpoint > m_pResults->m_second_endpoint)
- {
- utils::swap(m_pResults->m_first_endpoint, m_pResults->m_second_endpoint);
- for (uint i = 0; i < m_best_selectors.size(); i++)
- m_best_selectors[i] = g_six_alpha_invert_table[m_best_selectors[i]];
- }
- }
- else if (!(m_pResults->m_first_endpoint > m_pResults->m_second_endpoint))
- {
- utils::swap(m_pResults->m_first_endpoint, m_pResults->m_second_endpoint);
- for (uint i = 0; i < m_best_selectors.size(); i++)
- m_best_selectors[i] = g_eight_alpha_invert_table[m_best_selectors[i]];
- }
-
- for (uint i = 0; i < m_pParams->m_num_pixels; i++)
- {
- uint alpha = m_pParams->m_pPixels[i][m_pParams->m_comp_index];
-
- int index = m_unique_value_map[alpha];
-
- m_pResults->m_pSelectors[i] = m_best_selectors[index];
- }
-
- return true;
- }
-
- void dxt5_endpoint_optimizer::evaluate_solution(uint low_endpoint, uint high_endpoint)
- {
- for (uint block_type = 0; block_type < (m_pParams->m_use_both_block_types ? 2U : 1U); block_type++)
- {
- uint selector_values[8];
-
- if (!block_type)
- dxt5_block::get_block_values8(selector_values, low_endpoint, high_endpoint);
- else
- dxt5_block::get_block_values6(selector_values, low_endpoint, high_endpoint);
-
- uint64 trial_error = 0;
-
- for (uint i = 0; i < m_unique_values.size(); i++)
- {
- const uint val = m_unique_values[i];
- const uint weight = m_unique_value_weights[i];
-
- uint best_selector_error = UINT_MAX;
- uint best_selector = 0;
-
- for (uint j = 0; j < 8; j++)
- {
- int selector_error = val - selector_values[j];
- selector_error = selector_error * selector_error * (int)weight;
-
- if (static_cast<uint>(selector_error) < best_selector_error)
- {
- best_selector_error = selector_error;
- best_selector = j;
- if (!best_selector_error)
- break;
- }
- }
-
- m_trial_selectors[i] = static_cast<uint8>(best_selector);
- trial_error += best_selector_error;
-
- if (trial_error > m_pResults->m_error)
- break;
- }
-
- if (trial_error < m_pResults->m_error)
- {
- m_pResults->m_error = trial_error;
- m_pResults->m_first_endpoint = static_cast<uint8>(low_endpoint);
- m_pResults->m_second_endpoint = static_cast<uint8>(high_endpoint);
- m_pResults->m_block_type = static_cast<uint8>(block_type);
- m_best_selectors.swap(m_trial_selectors);
-
- if (!trial_error)
- break;
- }
- }
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt5a.h b/Libraries/crunch-ea9b8d/crnlib/crn_dxt5a.h
deleted file mode 100644
index a10f7724..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt5a.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// File: crn_dxt5a.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_dxt.h"
-
-namespace crnlib
-{
- class dxt5_endpoint_optimizer
- {
- public:
- dxt5_endpoint_optimizer();
-
- struct params
- {
- params() :
- m_block_index(0),
- m_pPixels(NULL),
- m_num_pixels(0),
- m_comp_index(3),
- m_quality(cCRNDXTQualityUber),
- m_use_both_block_types(true)
- {
- }
-
- uint m_block_index;
-
- const color_quad_u8* m_pPixels;
- uint m_num_pixels;
- uint m_comp_index;
-
- crn_dxt_quality m_quality;
-
- bool m_use_both_block_types;
- };
-
- struct results
- {
- uint8* m_pSelectors;
-
- uint64 m_error;
-
- uint8 m_first_endpoint;
- uint8 m_second_endpoint;
-
- uint8 m_block_type; // 1 if 6-alpha, otherwise 8-alpha
- };
-
- bool compute(const params& p, results& r);
-
- private:
- const params* m_pParams;
- results* m_pResults;
-
- crnlib::vector<uint8> m_unique_values;
- crnlib::vector<uint> m_unique_value_weights;
-
- crnlib::vector<uint8> m_trial_selectors;
- crnlib::vector<uint8> m_best_selectors;
- int m_unique_value_map[256];
-
- sparse_bit_array m_flags;
-
- void evaluate_solution(uint low_endpoint, uint high_endpoint);
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_endpoint_refiner.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_dxt_endpoint_refiner.cpp
deleted file mode 100644
index a78b7dff..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_endpoint_refiner.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-// File: crn_dxt_endpoint_refiner.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_dxt_endpoint_refiner.h"
-#include "crn_dxt1.h"
-
-namespace crnlib
-{
- dxt_endpoint_refiner::dxt_endpoint_refiner() :
- m_pParams(NULL),
- m_pResults(NULL)
- {
- }
-
- bool dxt_endpoint_refiner::refine(const params& p, results& r)
- {
- if (!p.m_num_pixels)
- return false;
-
- m_pParams = &p;
- m_pResults = &r;
-
- r.m_error = cUINT64_MAX;
- r.m_low_color = 0;
- r.m_high_color = 0;
-
- double alpha2_sum = 0.0f;
- double beta2_sum = 0.0f;
- double alphabeta_sum = 0.0f;
-
- vec<3, double> alphax_sum( 0.0f );
- vec<3, double> betax_sum( 0.0f );
-
- vec<3, double> first_color( 0.0f );
-
- // This linear solver is from Squish.
- for( uint i = 0; i < p.m_num_pixels; ++i )
- {
- uint8 c = p.m_pSelectors[i];
-
- double k;
- if (p.m_dxt1_selectors)
- k = g_dxt1_to_linear[c] * 1.0f/3.0f;
- else
- k = g_dxt5_to_linear[c] * 1.0f/7.0f;
-
- double alpha = 1.0f - k;
- double beta = k;
-
- vec<3, double> x;
-
- if (p.m_dxt1_selectors)
- x.set( p.m_pPixels[i][0] * 1.0f/255.0f, p.m_pPixels[i][1] * 1.0f/255.0f, p.m_pPixels[i][2] * 1.0f/255.0f );
- else
- x.set( p.m_pPixels[i][p.m_alpha_comp_index]/255.0f );
-
- if (!i)
- first_color = x;
-
- alpha2_sum += alpha*alpha;
- beta2_sum += beta*beta;
- alphabeta_sum += alpha*beta;
- alphax_sum += alpha*x;
- betax_sum += beta*x;
- }
-
- // zero where non-determinate
- vec<3, double> a, b;
- if( beta2_sum == 0.0f )
- {
- a = alphax_sum / alpha2_sum;
- b.clear();
- }
- else if( alpha2_sum == 0.0f )
- {
- a.clear();
- b = betax_sum / beta2_sum;
- }
- else
- {
- double factor = alpha2_sum*beta2_sum - alphabeta_sum*alphabeta_sum;
- if (factor != 0.0f)
- {
- a = ( alphax_sum*beta2_sum - betax_sum*alphabeta_sum ) / factor;
- b = ( betax_sum*alpha2_sum - alphax_sum*alphabeta_sum ) / factor;
- }
- else
- {
- a = first_color;
- b = first_color;
- }
- }
-
- vec3F l(0.0f), h(0.0f);
- l = a;
- h = b;
-
- l.clamp(0.0f, 1.0f);
- h.clamp(0.0f, 1.0f);
-
- if (p.m_dxt1_selectors)
- optimize_dxt1(l, h);
- else
- optimize_dxt5(l, h);
-
- //if (r.m_low_color < r.m_high_color)
- // utils::swap(r.m_low_color, r.m_high_color);
-
- return r.m_error < p.m_error_to_beat;
- }
-
- void dxt_endpoint_refiner::optimize_dxt5(vec3F low_color, vec3F high_color)
- {
- float nl = low_color[0];
- float nh = high_color[0];
-
-#if CRNLIB_DXT_ALT_ROUNDING
- nl = math::clamp(nl, 0.0f, .999f);
- nh = math::clamp(nh, 0.0f, .999f);
- uint il = (int)floor(nl * 256.0f);
- uint ih = (int)floor(nh * 256.0f);
-#else
- uint il = (int)floor(.5f + math::clamp(nl, 0.0f, 1.0f) * 255.0f);
- uint ih = (int)floor(.5f + math::clamp(nh, 0.0f, 1.0f) * 255.0f);
-#endif
-
- crnlib::vector<uint> trial_solutions;
- trial_solutions.reserve(256);
- trial_solutions.push_back(il | (ih << 8));
-
- sparse_bit_array flags;
- flags.resize(256 * 256);
-
- flags.set_bit((il * 256) + ih);
-
- const int cProbeAmount = 11;
-
- for (int l_delta = -cProbeAmount; l_delta <= cProbeAmount; l_delta++)
- {
- const int l = il + l_delta;
- if (l < 0)
- continue;
- else if (l > 255)
- break;
-
- const uint bit_index = l * 256;
-
- for (int h_delta = -cProbeAmount; h_delta <= cProbeAmount; h_delta++)
- {
- const int h = ih + h_delta;
- if (h < 0)
- continue;
- else if (h > 255)
- break;
-
- if ((flags.get_bit(bit_index + h)) || (flags.get_bit(h * 256 + l)))
- continue;
-
- flags.set_bit(bit_index + h);
-
- trial_solutions.push_back(l | (h << 8));
- }
- }
-
- for (uint trial = 0; trial < trial_solutions.size(); trial++)
- {
- uint l = trial_solutions[trial] & 0xFF;
- uint h = trial_solutions[trial] >> 8;
-
- if (l == h)
- {
- if (h)
- h--;
- else
- l++;
- }
- else if (l < h)
- {
- utils::swap(l, h);
- }
-
- CRNLIB_ASSERT(l > h);
-
- uint values[cDXT5SelectorValues];
- dxt5_block::get_block_values8(values, l, h);
-
- uint total_error = 0;
-
- for (uint j = 0; j < m_pParams->m_num_pixels; j++)
- {
- int p = m_pParams->m_pPixels[j][m_pParams->m_alpha_comp_index];
- int c = values[m_pParams->m_pSelectors[j]];
-
- int error = p - c;
- error *= error;
-
- total_error += error;
-
- if (total_error > m_pResults->m_error)
- break;
- }
-
- if (total_error < m_pResults->m_error)
- {
- m_pResults->m_error = total_error;
- m_pResults->m_low_color = static_cast<uint16>(l);
- m_pResults->m_high_color = static_cast<uint16>(h);
-
- if (m_pResults->m_error == 0)
- return;
- }
- }
- }
-
- void dxt_endpoint_refiner::optimize_dxt1(vec3F low_color, vec3F high_color)
- {
- uint selector_hist[4];
- utils::zero_object(selector_hist);
- for (uint i = 0; i < m_pParams->m_num_pixels; i++)
- selector_hist[m_pParams->m_pSelectors[i]]++;
-
- dxt1_solution_coordinates c(low_color, high_color);
-
- for (uint pass = 0; pass < 8; pass++)
- {
- const uint64 initial_error = m_pResults->m_error;
-
- dxt1_solution_coordinates_vec coords_to_try;
-
- coords_to_try.resize(0);
-
- color_quad_u8 lc(dxt1_block::unpack_color(c.m_low_color, false));
- color_quad_u8 hc(dxt1_block::unpack_color(c.m_high_color, false));
-
- for (int i = 0; i < 27; i++)
- {
- if (13 == i) continue;
-
- const int ir = (i % 3) - 1;
- const int ig = ((i / 3) % 3) - 1;
- const int ib = ((i / 9) % 3) - 1;
-
- int r = lc.r + ir;
- int g = lc.g + ig;
- int b = lc.b + ib;
- if ((r < 0) || (r > 31)|| (g < 0) || (g > 63) || (b < 0) || (b > 31)) continue;
-
- coords_to_try.push_back(
- dxt1_solution_coordinates(dxt1_block::pack_color(r, g, b, false), c.m_high_color)
- );
- }
-
- for (int i = 0; i < 27; i++)
- {
- if (13 == i) continue;
-
- const int ir = (i % 3) - 1;
- const int ig = ((i / 3) % 3) - 1;
- const int ib = ((i / 9) % 3) - 1;
-
- int r = hc.r + ir;
- int g = hc.g + ig;
- int b = hc.b + ib;
- if ((r < 0) || (r > 31)|| (g < 0) || (g > 63) || (b < 0) || (b > 31)) continue;
-
- coords_to_try.push_back(dxt1_solution_coordinates(c.m_low_color, dxt1_block::pack_color(r, g, b, false)));
- }
-
- std::sort(coords_to_try.begin(), coords_to_try.end());
-
- dxt1_solution_coordinates_vec::const_iterator p_last = std::unique(coords_to_try.begin(), coords_to_try.end());
- uint num_coords_to_try = (uint)(p_last - coords_to_try.begin());
-
- for (uint i = 0; i < num_coords_to_try; i++)
- {
- color_quad_u8 block_colors[4];
- uint16 l = coords_to_try[i].m_low_color;
- uint16 h = coords_to_try[i].m_high_color;
- if (l < h)
- utils::swap(l, h);
- else if (l == h)
- {
- color_quad_u8 lc(dxt1_block::unpack_color(l, false));
- color_quad_u8 hc(dxt1_block::unpack_color(h, false));
-
- bool retry = false;
- if ((selector_hist[0] + selector_hist[2]) > (selector_hist[1] + selector_hist[3]))
- {
- // l affects the output more than h, so muck with h
- if (hc[2] != 0)
- hc[2]--;
- else if (hc[0] != 0)
- hc[0]--;
- else if (hc[1] != 0)
- hc[1]--;
- else
- retry = true;
- }
- else
- {
- // h affects the output more than l, so muck with l
- if (lc[2] != 31)
- lc[2]++;
- else if (lc[0] != 31)
- lc[0]++;
- else if (lc[1] != 63)
- lc[1]++;
- else
- retry = true;
- }
-
- if (retry)
- {
- if (l == 0)
- l++;
- else
- h--;
- }
- else
- {
- l = dxt1_block::pack_color(lc, false);
- h = dxt1_block::pack_color(hc, false);
- }
-
- CRNLIB_ASSERT(l > h);
- }
-
- dxt1_block::get_block_colors4(block_colors, l, h);
-
- uint total_error = 0;
-
- for (uint j = 0; j < m_pParams->m_num_pixels; j++)
- {
- const color_quad_u8& c = block_colors[m_pParams->m_pSelectors[j]];
- total_error += color::color_distance(m_pParams->m_perceptual, c, m_pParams->m_pPixels[j], false);
-
- if (total_error > m_pResults->m_error)
- break;
- }
-
- if (total_error < m_pResults->m_error)
- {
- m_pResults->m_error = total_error;
- m_pResults->m_low_color = l;
- m_pResults->m_high_color = h;
- CRNLIB_ASSERT(l > h);
- if (m_pResults->m_error == 0)
- return;
- }
- }
-
- if (m_pResults->m_error == initial_error)
- break;
-
- c.m_low_color = m_pResults->m_low_color;
- c.m_high_color = m_pResults->m_high_color;
- }
-
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_endpoint_refiner.h b/Libraries/crunch-ea9b8d/crnlib/crn_dxt_endpoint_refiner.h
deleted file mode 100644
index 131f904c..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_endpoint_refiner.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// File: crn_dxt_endpoint_refiner.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_dxt.h"
-
-namespace crnlib
-{
- // TODO: Experimental/Not fully implemented
- class dxt_endpoint_refiner
- {
- public:
- dxt_endpoint_refiner();
-
- struct params
- {
- params() :
- m_block_index(0),
- m_pPixels(NULL),
- m_num_pixels(0),
- m_pSelectors(NULL),
- m_alpha_comp_index(0),
- m_error_to_beat(cUINT64_MAX),
- m_dxt1_selectors(true),
- m_perceptual(true),
- m_highest_quality(true)
- {
- }
-
- uint m_block_index;
-
- const color_quad_u8* m_pPixels;
- uint m_num_pixels;
-
- const uint8* m_pSelectors;
-
- uint m_alpha_comp_index;
-
- uint64 m_error_to_beat;
-
- bool m_dxt1_selectors;
- bool m_perceptual;
- bool m_highest_quality;
- };
-
- struct results
- {
- uint16 m_low_color;
- uint16 m_high_color;
- uint64 m_error;
- };
-
- bool refine(const params& p, results& r);
-
- private:
- const params* m_pParams;
- results* m_pResults;
-
- void optimize_dxt1(vec3F low_color, vec3F high_color);
- void optimize_dxt5(vec3F low_color, vec3F high_color);
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_fast.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_dxt_fast.cpp
deleted file mode 100644
index e698a73e..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_fast.cpp
+++ /dev/null
@@ -1,916 +0,0 @@
-// File: crn_dxt_fast.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-// Parts of this module are derived from RYG's excellent public domain DXTx compressor.
-#include "crn_core.h"
-#include "crn_dxt_fast.h"
-#include "crn_ryg_dxt.hpp"
-
-namespace crnlib
-{
- namespace dxt_fast
- {
- static inline int mul_8bit(int a, int b)
- {
- int t = a * b + 128;
- return (t + (t >> 8)) >> 8;
- }
-
- static inline color_quad_u8& unpack_color(color_quad_u8& c, uint v)
- {
- uint rv = (v & 0xf800) >> 11;
- uint gv = (v & 0x07e0) >> 5;
- uint bv = (v & 0x001f) >> 0;
-
- c.r = ryg_dxt::Expand5[rv];
- c.g = ryg_dxt::Expand6[gv];
- c.b = ryg_dxt::Expand5[bv];
- c.a = 0;
-
- return c;
- }
-
- static inline uint pack_color(const color_quad_u8& c)
- {
- return (mul_8bit(c.r, 31) << 11) + (mul_8bit(c.g, 63) << 5) + mul_8bit(c.b, 31);
- }
-
- static inline void lerp_color(color_quad_u8& result, const color_quad_u8& p1, const color_quad_u8& p2, uint f)
- {
- CRNLIB_ASSERT(f <= 255);
-
- result.r = static_cast<uint8>(p1.r + mul_8bit(p2.r - p1.r, f));
- result.g = static_cast<uint8>(p1.g + mul_8bit(p2.g - p1.g, f));
- result.b = static_cast<uint8>(p1.b + mul_8bit(p2.b - p1.b, f));
- }
-
- static inline void eval_colors(color_quad_u8* pColors, uint c0, uint c1)
- {
- unpack_color(pColors[0], c0);
- unpack_color(pColors[1], c1);
-
-#if 0
- lerp_color(pColors[2], pColors[0], pColors[1], 0x55);
- lerp_color(pColors[3], pColors[0], pColors[1], 0xAA);
-#else
- pColors[2].r = (pColors[0].r*2+pColors[1].r)/3;
- pColors[2].g = (pColors[0].g*2+pColors[1].g)/3;
- pColors[2].b = (pColors[0].b*2+pColors[1].b)/3;
-
- pColors[3].r = (pColors[1].r*2+pColors[0].r)/3;
- pColors[3].g = (pColors[1].g*2+pColors[0].g)/3;
- pColors[3].b = (pColors[1].b*2+pColors[0].b)/3;
-#endif
- }
-
- // false if all selectors equal
- static bool match_block_colors(uint n, const color_quad_u8* pBlock, const color_quad_u8* pColors, uint8* pSelectors)
- {
- int dirr = pColors[0].r - pColors[1].r;
- int dirg = pColors[0].g - pColors[1].g;
- int dirb = pColors[0].b - pColors[1].b;
-
- int stops[4];
- for(int i = 0; i < 4; i++)
- stops[i] = pColors[i].r*dirr + pColors[i].g*dirg + pColors[i].b*dirb;
-
- // 0 2 3 1
- int c0Point = stops[1] + stops[3];
- int halfPoint = stops[3] + stops[2];
- int c3Point = stops[2] + stops[0];
-
- //dirr *= 2;
- //dirg *= 2;
- //dirb *= 2;
- c0Point >>= 1;
- halfPoint >>= 1;
- c3Point >>= 1;
-
- bool status = false;
- for (uint i = 0; i < n; i++)
- {
- int dot = pBlock[i].r*dirr + pBlock[i].g*dirg + pBlock[i].b*dirb;
-
- uint8 s;
- if (dot < halfPoint)
- s = (dot < c0Point) ? 1 : 3;
- else
- s = (dot < c3Point) ? 2 : 0;
-
- pSelectors[i] = s;
-
- if (s != pSelectors[0])
- status = true;
- }
-
- return status;
- }
-
- static bool optimize_block_colors(uint n, const color_quad_u8* block, uint& max16, uint& min16, uint ave_color[3], float axis[3])
- {
- int min[3], max[3];
-
- for(uint ch = 0; ch < 3; ch++)
- {
- const uint8 *bp = ((const uint8 *) block) + ch;
- int minv, maxv;
-
- int64 muv = bp[0];
- minv = maxv = bp[0];
-
- const uint l = n << 2;
- for (uint i = 4; i < l; i += 4)
- {
- muv += bp[i];
- minv = math::minimum<int>(minv, bp[i]);
- maxv = math::maximum<int>(maxv, bp[i]);
- }
-
- ave_color[ch] = static_cast<int>((muv + (n / 2)) / n);
- min[ch] = minv;
- max[ch] = maxv;
- }
-
- if ((min[0] == max[0]) && (min[1] == max[1]) && (min[2] == max[2]))
- return false;
-
- // determine covariance matrix
- double cov[6];
- for(int i=0;i<6;i++)
- cov[i] = 0;
-
- for(uint i=0;i<n;i++)
- {
- double r = (int)block[i].r - (int)ave_color[0];
- double g = (int)block[i].g - (int)ave_color[1];
- double b = (int)block[i].b - (int)ave_color[2];
-
- cov[0] += r*r;
- cov[1] += r*g;
- cov[2] += r*b;
- cov[3] += g*g;
- cov[4] += g*b;
- cov[5] += b*b;
- }
-
- double covf[6],vfr,vfg,vfb;
- for(int i=0;i<6;i++)
- covf[i] = cov[i] * (1.0f/255.0f);
-
- vfr = max[0] - min[0];
- vfg = max[1] - min[1];
- vfb = max[2] - min[2];
-
- static const uint nIterPower = 4;
- for(uint iter = 0; iter < nIterPower; iter++)
- {
- double r = vfr*covf[0] + vfg*covf[1] + vfb*covf[2];
- double g = vfr*covf[1] + vfg*covf[3] + vfb*covf[4];
- double b = vfr*covf[2] + vfg*covf[4] + vfb*covf[5];
-
- vfr = r;
- vfg = g;
- vfb = b;
- }
-
- double magn = math::maximum(math::maximum(fabs(vfr),fabs(vfg)),fabs(vfb));
- int v_r, v_g, v_b;
-
- if (magn < 4.0f) // too small, default to luminance
- {
- v_r = 148;
- v_g = 300;
- v_b = 58;
-
- axis[0] = (float)v_r;
- axis[1] = (float)v_g;
- axis[2] = (float)v_b;
- }
- else
- {
- magn = 512.0f / magn;
- vfr *= magn;
- vfg *= magn;
- vfb *= magn;
- v_r = static_cast<int>(vfr);
- v_g = static_cast<int>(vfg);
- v_b = static_cast<int>(vfb);
-
- axis[0] = (float)vfr;
- axis[1] = (float)vfg;
- axis[2] = (float)vfb;
- }
-
- int mind = block[0].r * v_r + block[0].g * v_g + block[0].b * v_b;
- int maxd = mind;
- color_quad_u8 minp(block[0]);
- color_quad_u8 maxp(block[0]);
-
- for(uint i = 1; i < n; i++)
- {
- int dot = block[i].r * v_r + block[i].g * v_g + block[i].b * v_b;
-
- if (dot < mind)
- {
- mind = dot;
- minp = block[i];
- }
-
- if (dot > maxd)
- {
- maxd = dot;
- maxp = block[i];
- }
- }
-
- max16 = pack_color(maxp);
- min16 = pack_color(minp);
-
- return true;
- }
-
- // The refinement function. (Clever code, part 2)
- // Tries to optimize colors to suit block contents better.
- // (By solving a least squares system via normal equations+Cramer's rule)
- static bool refine_block(uint n, const color_quad_u8 *block, uint &max16, uint &min16, const uint8* pSelectors)
- {
- static const int w1Tab[4] = { 3,0,2,1 };
-
- static const int prods_0[4] = { 0x00,0x00,0x02,0x02 };
- static const int prods_1[4] = { 0x00,0x09,0x01,0x04 };
- static const int prods_2[4] = { 0x09,0x00,0x04,0x01 };
-
- double akku_0 = 0;
- double akku_1 = 0;
- double akku_2 = 0;
- double At1_r, At1_g, At1_b;
- double At2_r, At2_g, At2_b;
-
- At1_r = At1_g = At1_b = 0;
- At2_r = At2_g = At2_b = 0;
- for(uint i = 0; i < n; i++)
- {
- double r = block[i].r;
- double g = block[i].g;
- double b = block[i].b;
- int step = pSelectors[i];
-
- int w1 = w1Tab[step];
-
- akku_0 += prods_0[step];
- akku_1 += prods_1[step];
- akku_2 += prods_2[step];
- At1_r += w1*r;
- At1_g += w1*g;
- At1_b += w1*b;
- At2_r += r;
- At2_g += g;
- At2_b += b;
- }
-
- At2_r = 3*At2_r - At1_r;
- At2_g = 3*At2_g - At1_g;
- At2_b = 3*At2_b - At1_b;
-
- double xx = akku_2;
- double yy = akku_1;
- double xy = akku_0;
-
- double t = xx * yy - xy * xy;
- if (!yy || !xx || (fabs(t) < .0000125f))
- return false;
-
- double frb = (3.0f * 31.0f / 255.0f) / t;
- double fg = frb * (63.0f / 31.0f);
-
- uint oldMin = min16;
- uint oldMax = max16;
-
- // solve.
- max16 = math::clamp<int>(static_cast<int>((At1_r*yy - At2_r*xy)*frb+0.5f),0,31) << 11;
- max16 |= math::clamp<int>(static_cast<int>((At1_g*yy - At2_g*xy)*fg +0.5f),0,63) << 5;
- max16 |= math::clamp<int>(static_cast<int>((At1_b*yy - At2_b*xy)*frb+0.5f),0,31) << 0;
-
- min16 = math::clamp<int>(static_cast<int>((At2_r*xx - At1_r*xy)*frb+0.5f),0,31) << 11;
- min16 |= math::clamp<int>(static_cast<int>((At2_g*xx - At1_g*xy)*fg +0.5f),0,63) << 5;
- min16 |= math::clamp<int>(static_cast<int>((At2_b*xx - At1_b*xy)*frb+0.5f),0,31) << 0;
-
- return (oldMin != min16) || (oldMax != max16);
- }
-
- // false if all selectors equal
- static bool determine_selectors(uint n, const color_quad_u8* block, uint min16, uint max16, uint8* pSelectors)
- {
- color_quad_u8 color[4];
-
- if (max16 != min16)
- {
- eval_colors(color, min16, max16);
-
- return match_block_colors(n, block, color, pSelectors);
- }
-
- memset(pSelectors, 0, n);
- return false;
- }
-
- static uint64 determine_error(uint n, const color_quad_u8* block, uint min16, uint max16, uint64 early_out_error)
- {
- color_quad_u8 color[4];
-
- eval_colors(color, min16, max16);
-
- int dirr = color[0].r - color[1].r;
- int dirg = color[0].g - color[1].g;
- int dirb = color[0].b - color[1].b;
-
- int stops[4];
- for(int i = 0; i < 4; i++)
- stops[i] = color[i].r*dirr + color[i].g*dirg + color[i].b*dirb;
-
- // 0 2 3 1
- int c0Point = stops[1] + stops[3];
- int halfPoint = stops[3] + stops[2];
- int c3Point = stops[2] + stops[0];
-
- c0Point >>= 1;
- halfPoint >>= 1;
- c3Point >>= 1;
-
- uint64 total_error = 0;
-
- for (uint i = 0; i < n; i++)
- {
- const color_quad_u8& a = block[i];
-
- uint s = 0;
- if (min16 != max16)
- {
- int dot = a.r*dirr + a.g*dirg + a.b*dirb;
-
- if (dot < halfPoint)
- s = (dot < c0Point) ? 1 : 3;
- else
- s = (dot < c3Point) ? 2 : 0;
- }
-
- const color_quad_u8& b = color[s];
-
- int e = a[0] - b[0];
- total_error += e * e;
-
- e = a[1] - b[1];
- total_error += e * e;
-
- e = a[2] - b[2];
- total_error += e * e;
-
- if (total_error >= early_out_error)
- break;
- }
-
- return total_error;
- }
-
- static bool refine_endpoints(uint n, const color_quad_u8* pBlock, uint& low16, uint& high16, uint8* pSelectors)
- {
- bool optimized = false;
-
- const int limits[3] = { 31, 63, 31 };
-
- for (uint trial = 0; trial < 2; trial++)
- {
- color_quad_u8 color[4];
- eval_colors(color, low16, high16);
-
- uint64 total_error[3] = { 0, 0, 0 };
-
- for (uint i = 0; i < n; i++)
- {
- const color_quad_u8& a = pBlock[i];
-
- const uint s = pSelectors[i];
- const color_quad_u8& b = color[s];
-
- int e = a[0] - b[0];
- total_error[0] += e * e;
-
- e = a[1] - b[1];
- total_error[1] += e * e;
-
- e = a[2] - b[2];
- total_error[2] += e * e;
- }
-
- color_quad_u8 endpoints[2];
- endpoints[0] = dxt1_block::unpack_color((uint16)low16, false);
- endpoints[1] = dxt1_block::unpack_color((uint16)high16, false);
-
- color_quad_u8 expanded_endpoints[2];
- expanded_endpoints[0] = dxt1_block::unpack_color((uint16)low16, true);
- expanded_endpoints[1] = dxt1_block::unpack_color((uint16)high16, true);
-
- bool trial_optimized = false;
-
- for (uint axis = 0; axis < 3; axis++)
- {
- if (!total_error[axis])
- continue;
-
- const sU8* const pExpand = (axis == 1) ? ryg_dxt::Expand6 : ryg_dxt::Expand5;
-
- for (uint e = 0; e < 2; e++)
- {
- uint v[4];
- v[e^1] = expanded_endpoints[e^1][axis];
-
- for (int t = -1; t <= 1; t += 2)
- {
- int a = endpoints[e][axis] + t;
- if ((a < 0) || (a > limits[axis]))
- continue;
-
- v[e] = pExpand[a];
-
- //int delta = v[1] - v[0];
- //v[2] = v[0] + mul_8bit(delta, 0x55);
- //v[3] = v[0] + mul_8bit(delta, 0xAA);
-
- v[2] = (v[0] * 2 + v[1]) / 3;
- v[3] = (v[0] + v[1] * 2) / 3;
-
- uint64 axis_error = 0;
-
- for (uint i = 0; i < n; i++)
- {
- const color_quad_u8& p = pBlock[i];
-
- int e = v[pSelectors[i]] - p[axis];
-
- axis_error += e * e;
-
- if (axis_error >= total_error[axis])
- break;
- }
-
- if (axis_error < total_error[axis])
- {
- //total_error[axis] = axis_error;
-
- endpoints[e][axis] = (uint8)a;
- expanded_endpoints[e][axis] = (uint8)v[e];
-
- if (e)
- high16 = dxt1_block::pack_color(endpoints[1], false);
- else
- low16 = dxt1_block::pack_color(endpoints[0], false);
-
- determine_selectors(n, pBlock, low16, high16, pSelectors);
-
- eval_colors(color, low16, high16);
-
- utils::zero_object(total_error);
-
- for (uint i = 0; i < n; i++)
- {
- const color_quad_u8& a = pBlock[i];
-
- const uint s = pSelectors[i];
- const color_quad_u8& b = color[s];
-
- int e = a[0] - b[0];
- total_error[0] += e * e;
-
- e = a[1] - b[1];
- total_error[1] += e * e;
-
- e = a[2] - b[2];
- total_error[2] += e * e;
- }
-
- trial_optimized = true;
- }
-
- } // t
-
- } // e
- } // axis
-
- if (!trial_optimized)
- break;
-
- optimized = true;
-
- } // for ( ; ; )
-
- return optimized;
- }
-
- static void refine_endpoints2(uint n, const color_quad_u8* pBlock, uint& low16, uint& high16, uint8* pSelectors, float axis[3])
- {
- uint64 orig_error = determine_error(n, pBlock, low16, high16, cUINT64_MAX);
- if (!orig_error)
- return;
-
- float l = 1.0f / sqrt(axis[0]*axis[0] + axis[1]*axis[1] + axis[2]*axis[2]);
- vec3F principle_axis(axis[0] * l, axis[1] * l, axis[2] * l);
-
- const float dist_per_trial = 0.027063293f;
-
- const uint cMaxProbeRange = 8;
- uint probe_low[cMaxProbeRange * 2 + 1];
- uint probe_high[cMaxProbeRange * 2 + 1];
-
- int probe_range = 8;
- uint num_iters = 4;
-
- const uint num_trials = probe_range * 2 + 1;
-
- vec3F scaled_principle_axis(principle_axis * dist_per_trial);
- scaled_principle_axis[0] *= 31.0f;
- scaled_principle_axis[1] *= 63.0f;
- scaled_principle_axis[2] *= 31.0f;
- vec3F initial_ofs(scaled_principle_axis * (float)-probe_range);
- initial_ofs[0] += .5f;
- initial_ofs[1] += .5f;
- initial_ofs[2] += .5f;
-
- uint64 cur_error = orig_error;
-
- for (uint iter = 0; iter < num_iters; iter++)
- {
- color_quad_u8 endpoints[2];
-
- endpoints[0] = dxt1_block::unpack_color((uint16)low16, false);
- endpoints[1] = dxt1_block::unpack_color((uint16)high16, false);
-
- vec3F low_color(endpoints[0][0], endpoints[0][1], endpoints[0][2]);
- vec3F high_color(endpoints[1][0], endpoints[1][1], endpoints[1][2]);
-
- vec3F probe_low_color(low_color + initial_ofs);
- for (uint i = 0; i < num_trials; i++)
- {
- int r = math::clamp((int)floor(probe_low_color[0]), 0, 31);
- int g = math::clamp((int)floor(probe_low_color[1]), 0, 63);
- int b = math::clamp((int)floor(probe_low_color[2]), 0, 31);
- probe_low[i] = b | (g << 5U) | (r << 11U);
-
- probe_low_color += scaled_principle_axis;
- }
-
- vec3F probe_high_color(high_color + initial_ofs);
- for (uint i = 0; i < num_trials; i++)
- {
- int r = math::clamp((int)floor(probe_high_color[0]), 0, 31);
- int g = math::clamp((int)floor(probe_high_color[1]), 0, 63);
- int b = math::clamp((int)floor(probe_high_color[2]), 0, 31);
- probe_high[i] = b | (g << 5U) | (r << 11U);
-
- probe_high_color += scaled_principle_axis;
- }
-
- uint best_l = low16;
- uint best_h = high16;
-
- enum { cMaxHash = 4 };
- uint64 hash[cMaxHash];
- for (uint i = 0; i < cMaxHash; i++)
- hash[i] = 0;
-
- uint c = best_l | (best_h << 16);
- c = fast_hash(&c, sizeof(c));
- hash[(c >> 6) & 3] = 1ULL << (c & 63);
-
- for (uint i = 0; i < num_trials; i++)
- {
- for (uint j = 0; j < num_trials; j++)
- {
- uint l = probe_low[i];
- uint h = probe_high[j];
- if (l < h)
- utils::swap(l, h);
-
- uint c = l | (h << 16);
- c = fast_hash(&c, sizeof(c));
- uint64 mask = 1ULL << (c & 63);
- uint ofs = (c >> 6) & 3;
- if (hash[ofs] & mask)
- continue;
-
- hash[ofs] |= mask;
-
- uint64 new_error = determine_error(n, pBlock, l, h, cur_error);
- if (new_error < cur_error)
- {
- best_l = l;
- best_h = h;
- cur_error = new_error;
- }
- }
- }
-
- bool improved = false;
-
- if ((best_l != low16) || (best_h != high16))
- {
- low16 = best_l;
- high16 = best_h;
-
- determine_selectors(n, pBlock, low16, high16, pSelectors);
- improved = true;
- }
-
- if (refine_endpoints(n, pBlock, low16, high16, pSelectors))
- {
- improved = true;
-
- uint64 cur_error = determine_error(n, pBlock, low16, high16, cUINT64_MAX);
- if (!cur_error)
- return;
- }
-
- if (!improved)
- break;
-
- } // iter
-
- //uint64 end_error = determine_error(n, pBlock, low16, high16, UINT64_MAX);
- //if (end_error > orig_error) DebugBreak();
- }
-
- static void compress_solid_block(uint n, uint ave_color[3], uint& low16, uint& high16, uint8* pSelectors)
- {
- uint r = ave_color[0];
- uint g = ave_color[1];
- uint b = ave_color[2];
-
- memset(pSelectors, 2, n);
-
- low16 = (ryg_dxt::OMatch5[r][0]<<11) | (ryg_dxt::OMatch6[g][0]<<5) | ryg_dxt::OMatch5[b][0];
- high16 = (ryg_dxt::OMatch5[r][1]<<11) | (ryg_dxt::OMatch6[g][1]<<5) | ryg_dxt::OMatch5[b][1];
- }
-
- void compress_color_block(uint n, const color_quad_u8* block, uint& low16, uint& high16, uint8* pSelectors, bool refine)
- {
- CRNLIB_ASSERT((n & 15) == 0);
-
- uint ave_color[3];
- float axis[3];
-
- if (!optimize_block_colors(n, block, low16, high16, ave_color, axis))
- {
- compress_solid_block(n, ave_color, low16, high16, pSelectors);
- }
- else
- {
- if (!determine_selectors(n, block, low16, high16, pSelectors))
- compress_solid_block(n, ave_color, low16, high16, pSelectors);
- else
- {
- if (refine_block(n, block, low16, high16, pSelectors))
- determine_selectors(n, block, low16, high16, pSelectors);
-
- if (refine)
- refine_endpoints2(n, block, low16, high16, pSelectors, axis);
- }
- }
-
- if (low16 < high16)
- {
- utils::swap(low16, high16);
- for (uint i = 0; i < n; i++)
- pSelectors[i] ^= 1;
- }
- }
-
- void compress_color_block(dxt1_block* pDXT1_block, const color_quad_u8* pBlock, bool refine)
- {
- uint8 color_selectors[16];
- uint low16, high16;
- dxt_fast::compress_color_block(16, pBlock, low16, high16, color_selectors, refine);
-
- pDXT1_block->set_low_color(static_cast<uint16>(low16));
- pDXT1_block->set_high_color(static_cast<uint16>(high16));
-
- uint mask = 0;
- for (int i = 15; i >= 0; i--)
- {
- mask <<= 2;
- mask |= color_selectors[i];
- }
-
- pDXT1_block->m_selectors[0] = (uint8)(mask & 0xFF);
- pDXT1_block->m_selectors[1] = (uint8)((mask >> 8) & 0xFF);
- pDXT1_block->m_selectors[2] = (uint8)((mask >> 16) & 0xFF);
- pDXT1_block->m_selectors[3] = (uint8)((mask >> 24) & 0xFF);
- }
-
- void compress_alpha_block(uint n, const color_quad_u8* block, uint& low8, uint& high8, uint8* pSelectors, uint comp_index)
- {
- int min, max;
- min = max = block[0][comp_index];
-
- for (uint i = 1; i < n; i++)
- {
- min = math::minimum<int>(min, block[i][comp_index]);
- max = math::maximum<int>(max, block[i][comp_index]);
- }
-
- low8 = max;
- high8 = min;
-
- int dist = max-min;
- int bias = min*7 - (dist >> 1);
- int dist4 = dist*4;
- int dist2 = dist*2;
-
- for (uint i = 0; i < n; i++)
- {
- int a = block[i][comp_index]*7 - bias;
- int ind,t;
-
- t = (dist4 - a) >> 31; ind = t & 4; a -= dist4 & t;
- t = (dist2 - a) >> 31; ind += t & 2; a -= dist2 & t;
- t = (dist - a) >> 31; ind += t & 1;
-
- ind = -ind & 7;
- ind ^= (2 > ind);
-
- pSelectors[i] = static_cast<uint8>(ind);
- }
- }
-
- void compress_alpha_block(dxt5_block* pDXT5_block, const color_quad_u8* pBlock, uint comp_index)
- {
- uint8 selectors[16];
- uint low8, high8;
-
- compress_alpha_block(16, pBlock, low8, high8, selectors, comp_index);
-
- pDXT5_block->set_low_alpha(low8);
- pDXT5_block->set_high_alpha(high8);
-
- uint mask = 0;
- uint bits = 0;
- uint8* pDst = pDXT5_block->m_selectors;
-
- for (uint i = 0; i < 16; i++)
- {
- mask |= (selectors[i] << bits);
-
- if ((bits += 3) >= 8)
- {
- *pDst++ = static_cast<uint8>(mask);
- mask >>= 8;
- bits -= 8;
- }
- }
- }
-
- void find_representative_colors(uint n, const color_quad_u8* pBlock, color_quad_u8& lo, color_quad_u8& hi)
- {
- uint64 ave64[3];
- ave64[0] = 0;
- ave64[1] = 0;
- ave64[2] = 0;
-
- for (uint i = 0; i < n; i++)
- {
- ave64[0] += pBlock[i].r;
- ave64[1] += pBlock[i].g;
- ave64[2] += pBlock[i].b;
- }
-
- uint ave[3];
- ave[0] = static_cast<uint>((ave64[0] + (n / 2)) / n);
- ave[1] = static_cast<uint>((ave64[1] + (n / 2)) / n);
- ave[2] = static_cast<uint>((ave64[2] + (n / 2)) / n);
-
- int furthest_dist = -1;
- uint furthest_index = 0;
- for (uint i = 0; i < n; i++)
- {
- int r = pBlock[i].r - ave[0];
- int g = pBlock[i].g - ave[1];
- int b = pBlock[i].b - ave[2];
- int dist = r*r + g*g + b*b;
- if (dist > furthest_dist)
- {
- furthest_dist = dist;
- furthest_index = i;
- }
- }
-
- color_quad_u8 lo_color(pBlock[furthest_index]);
-
- int opp_dist = -1;
- uint opp_index = 0;
- for (uint i = 0; i < n; i++)
- {
- int r = pBlock[i].r - lo_color.r;
- int g = pBlock[i].g - lo_color.g;
- int b = pBlock[i].b - lo_color.b;
- int dist = r*r + g*g + b*b;
- if (dist > opp_dist)
- {
- opp_dist = dist;
- opp_index = i;
- }
- }
-
- color_quad_u8 hi_color(pBlock[opp_index]);
-
- for (uint i = 0; i < 3; i++)
- {
- lo_color[i] = static_cast<uint8>((lo_color[i] + ave[i]) >> 1);
- hi_color[i] = static_cast<uint8>((hi_color[i] + ave[i]) >> 1);
- }
-
- const uint cMaxIters = 4;
- for (uint iter_index = 0; iter_index < cMaxIters; iter_index++)
- {
- if ((lo_color[0] == hi_color[0]) && (lo_color[1] == hi_color[1]) && (lo_color[2] == hi_color[2]))
- break;
-
- uint64 new_color[2][3];
- uint weight[2];
-
- utils::zero_object(new_color);
- utils::zero_object(weight);
-
- int vec_r = hi_color[0] - lo_color[0];
- int vec_g = hi_color[1] - lo_color[1];
- int vec_b = hi_color[2] - lo_color[2];
-
- int lo_dot = vec_r * lo_color[0] + vec_g * lo_color[1] + vec_b * lo_color[2];
- int hi_dot = vec_r * hi_color[0] + vec_g * hi_color[1] + vec_b * hi_color[2];
- int mid_dot = lo_dot + hi_dot;
-
- vec_r *= 2;
- vec_g *= 2;
- vec_b *= 2;
-
- for (uint i = 0; i < n; i++)
- {
- const color_quad_u8& c = pBlock[i];
-
- const int dot = c[0] * vec_r + c[1] * vec_g + c[2] * vec_b;
- const uint match_index = (dot > mid_dot);
-
- new_color[match_index][0] += c.r;
- new_color[match_index][1] += c.g;
- new_color[match_index][2] += c.b;
- weight[match_index]++;
- }
-
- if ((!weight[0]) || (!weight[1]))
- break;
-
- uint8 new_color8[2][3];
-
- for (uint j = 0; j < 2; j++)
- for (uint i = 0; i < 3; i++)
- new_color8[j][i] = static_cast<uint8>((new_color[j][i] + (weight[j] / 2)) / weight[j]);
-
- if ((new_color8[0][0] == lo_color[0]) && (new_color8[0][1] == lo_color[1]) && (new_color8[0][2] == lo_color[2]) &&
- (new_color8[1][0] == hi_color[0]) && (new_color8[1][1] == hi_color[1]) && (new_color8[1][2] == hi_color[2]))
- break;
-
- for (uint i = 0; i < 3; i++)
- {
- lo_color[i] = new_color8[0][i];
- hi_color[i] = new_color8[1][i];
- }
- }
-
- uint energy[2] = { 0, 0 };
- for (uint i = 0; i < 3; i++)
- {
- energy[0] += lo_color[i] * lo_color[i];
- energy[1] += hi_color[i] * hi_color[i];
- }
-
- if (energy[0] > energy[1])
- utils::swap(lo_color, hi_color);
-
- lo = lo_color;
- hi = hi_color;
- }
-
- } // namespace dxt_fast
-
-} // namespace crnlib
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_fast.h b/Libraries/crunch-ea9b8d/crnlib/crn_dxt_fast.h
deleted file mode 100644
index 07346a3f..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_fast.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// File: crn_dxt_fast.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_color.h"
-#include "crn_dxt.h"
-
-namespace crnlib
-{
- namespace dxt_fast
- {
- void compress_color_block(uint n, const color_quad_u8* block, uint& low16, uint& high16, uint8* pSelectors, bool refine = false);
- void compress_color_block(dxt1_block* pDXT1_block, const color_quad_u8* pBlock, bool refine = false);
-
- void compress_alpha_block(uint n, const color_quad_u8* block, uint& low8, uint& high8, uint8* pSelectors, uint comp_index);
- void compress_alpha_block(dxt5_block* pDXT5_block, const color_quad_u8* pBlock, uint comp_index);
-
- void find_representative_colors(uint n, const color_quad_u8* pBlock, color_quad_u8& lo, color_quad_u8& hi);
-
- } // namespace dxt_fast
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc.cpp
deleted file mode 100644
index 0c1cd39c..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc.cpp
+++ /dev/null
@@ -1,2544 +0,0 @@
-// File: crn_dxt_hc.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_dxt_hc.h"
-#include "crn_image_utils.h"
-#include "crn_console.h"
-#include "crn_dxt_fast.h"
-
-#define CRNLIB_USE_FAST_DXT 1
-#define CRNLIB_ENABLE_DEBUG_MESSAGES 0
-
-namespace crnlib
-{
- static color_quad_u8 g_tile_layout_colors[cNumChunkTileLayouts] =
- {
- color_quad_u8(255,90,32,255),
- color_quad_u8(64,210,192,255),
- color_quad_u8(128,16,225,255),
- color_quad_u8(255,192,200,255),
-
- color_quad_u8(255,128,200,255),
-
- color_quad_u8(255,0,0,255),
- color_quad_u8(0,255,0,255),
- color_quad_u8(0,0,255,255),
- color_quad_u8(255,0,255,255)
- };
-
- dxt_hc::dxt_hc() :
- m_num_chunks(0),
- m_pChunks(NULL),
- m_num_alpha_blocks(0),
- m_has_color_blocks(false),
- m_has_alpha0_blocks(false),
- m_has_alpha1_blocks(false),
- m_main_thread_id(crn_get_current_thread_id()),
- m_canceled(false),
- m_pTask_pool(NULL),
- m_prev_phase_index(-1),
- m_prev_percentage_complete(-1)
- {
- utils::zero_object(m_encoding_hist);
- }
-
- dxt_hc::~dxt_hc()
- {
- }
-
- void dxt_hc::clear()
- {
- m_num_chunks = 0;
- m_pChunks = NULL;
-
- m_chunk_encoding.clear();
-
- m_num_alpha_blocks = 0;
- m_has_color_blocks = false;
- m_has_alpha0_blocks = false;
- m_has_alpha1_blocks = false;
-
- m_color_selectors.clear();
-
- m_alpha_selectors.clear();
- for (uint i = 0; i < cNumCompressedChunkVecs; i++)
- m_compressed_chunks[i].clear();
-
- utils::zero_object(m_encoding_hist);
-
- m_total_tiles = 0;
-
- m_color_clusters.clear();
- m_alpha_clusters.clear();
- m_color_selectors.clear();
- m_alpha_selectors.clear();
-
- m_chunk_blocks_using_color_selectors.clear();
- m_chunk_blocks_using_alpha_selectors.clear();
-
- m_color_endpoints.clear();
- m_alpha_endpoints.clear();
-
- m_dbg_chunk_pixels.clear();
- m_dbg_chunk_pixels_tile_vis.clear();
- m_dbg_chunk_pixels_color_quantized.clear();
- m_dbg_chunk_pixels_alpha_quantized.clear();
-
- m_dbg_chunk_pixels_quantized_color_selectors.clear();
- m_dbg_chunk_pixels_orig_color_selectors.clear();
- m_dbg_chunk_pixels_final_color_selectors.clear();
- m_dbg_chunk_pixels_final_alpha_selectors.clear();
-
- m_dbg_chunk_pixels_quantized_alpha_selectors.clear();
- m_dbg_chunk_pixels_orig_alpha_selectors.clear();
- m_dbg_chunk_pixels_final_alpha_selectors.clear();
-
- m_dbg_chunk_pixels_final.clear();
-
- m_canceled = false;
-
- m_prev_phase_index = -1;
- m_prev_percentage_complete = -1;
- }
-
- bool dxt_hc::compress(const params& p, uint num_chunks, const pixel_chunk* pChunks, task_pool& task_pool)
- {
- m_pTask_pool = &task_pool;
- m_main_thread_id = crn_get_current_thread_id();
-
- bool result = compress_internal(p, num_chunks, pChunks);
-
- m_pTask_pool = NULL;
-
- return result;
- }
-
- bool dxt_hc::compress_internal(const params& p, uint num_chunks, const pixel_chunk* pChunks)
- {
- if ((!num_chunks) || (!pChunks))
- return false;
- if ((m_params.m_format == cDXT1A) || (m_params.m_format == cDXT3))
- return false;
-
- clear();
-
- m_params = p;
-
- m_num_chunks = num_chunks;
- m_pChunks = pChunks;
-
- switch (m_params.m_format)
- {
- case cDXT1:
- {
- m_has_color_blocks = true;
- break;
- }
- case cDXT5:
- {
- m_has_color_blocks = true;
- m_has_alpha0_blocks = true;
- m_num_alpha_blocks = 1;
- break;
- }
- case cDXT5A:
- {
- m_has_alpha0_blocks = true;
- m_num_alpha_blocks = 1;
- break;
- }
- case cDXN_XY:
- case cDXN_YX:
- {
- m_has_alpha0_blocks = true;
- m_has_alpha1_blocks = true;
- m_num_alpha_blocks = 2;
- break;
- }
- default:
- {
- return false;
- }
- }
-
- determine_compressed_chunks();
-
- if (m_has_color_blocks)
- {
- if (!determine_color_endpoint_clusters())
- return false;
- if (!determine_color_endpoint_codebook())
- return false;
- }
-
- if (m_num_alpha_blocks)
- {
- if (!determine_alpha_endpoint_clusters())
- return false;
- if (!determine_alpha_endpoint_codebook())
- return false;
- }
-
- create_quantized_debug_images();
-
- if (m_has_color_blocks)
- {
- if (!create_selector_codebook(false))
- return false;
- }
-
- if (m_num_alpha_blocks)
- {
- if (!create_selector_codebook(true))
- return false;
- }
-
- if (m_has_color_blocks)
- {
- if (!refine_quantized_color_selectors())
- return false;
-
- if (!refine_quantized_color_endpoints())
- return false;
- }
-
- if (m_num_alpha_blocks)
- {
- if (!refine_quantized_alpha_endpoints())
- return false;
-
- if (!refine_quantized_alpha_selectors())
- return false;
- }
-
- create_final_debug_image();
-
- if (!create_chunk_encodings())
- return false;
-
- return true;
- }
-
- void dxt_hc::compress_dxt1_block(
- dxt1_endpoint_optimizer::results& results,
- uint chunk_index, const image_u8& chunk, uint x_ofs, uint y_ofs, uint width, uint height,
- uint8* pColor_Selectors)
- {
- chunk_index;
-
- color_quad_u8 pixels[cChunkPixelWidth * cChunkPixelHeight];
-
- for (uint y = 0; y < height; y++)
- for (uint x = 0; x < width; x++)
- pixels[x + y * width] = chunk(x_ofs + x, y_ofs + y);
-
- //double s = image_utils::compute_std_dev(width * height, pixels, 0, 3);
-
-#if CRNLIB_USE_FAST_DXT
- uint low16, high16;
- dxt_fast::compress_color_block(width * height, pixels, low16, high16, pColor_Selectors);
- results.m_low_color = static_cast<uint16>(low16);
- results.m_high_color = static_cast<uint16>(high16);
- results.m_alpha_block = false;
- results.m_error = INT_MAX;
- results.m_pSelectors = pColor_Selectors;
-#else
- dxt1_endpoint_optimizer optimizer;
-
- dxt1_endpoint_optimizer::params params;
- params.m_block_index = chunk_index;
- params.m_pPixels = pixels;
- params.m_num_pixels = width * height;
- params.m_pixels_have_alpha = false;
- params.m_use_alpha_blocks = false;
- params.m_perceptual = m_params.m_perceptual;
- params.m_highest_quality = false;//false;
- params.m_endpoint_caching = false;
-
- results.m_pSelectors = pColor_Selectors;
-
- optimizer.compute(params, results);
-#endif
- }
-
- void dxt_hc::compress_dxt5_block(
- dxt5_endpoint_optimizer::results& results,
- uint chunk_index, const image_u8& chunk, uint x_ofs, uint y_ofs, uint width, uint height, uint component_index,
- uint8* pAlpha_selectors)
- {
- chunk_index;
-
- color_quad_u8 pixels[cChunkPixelWidth * cChunkPixelHeight];
-
- for (uint y = 0; y < height; y++)
- for (uint x = 0; x < width; x++)
- pixels[x + y * width] = chunk(x_ofs + x, y_ofs + y);
-
-#if 0 //CRNLIB_USE_FAST_DXT
- uint low, high;
- dxt_fast::compress_alpha_block(width * height, pixels, low, high, pAlpha_selectors, component_index);
- results.m_pSelectors = pAlpha_selectors;
- results.m_error = INT_MAX;
- results.m_first_endpoint = static_cast<uint8>(low);
- results.m_second_endpoint = static_cast<uint8>(high);
- results.m_block_type = 0;
-#else
- dxt5_endpoint_optimizer optimizer;
- dxt5_endpoint_optimizer::params params;
- params.m_block_index = chunk_index;
- params.m_pPixels = pixels;
- params.m_num_pixels = width * height;
- params.m_comp_index = component_index;
- params.m_use_both_block_types = false;
- params.m_quality = cCRNDXTQualityNormal;
-
- results.m_pSelectors = pAlpha_selectors;
-
- optimizer.compute(params, results);
-#endif
- }
-
- void dxt_hc::determine_compressed_chunks_task(uint64 data, void* pData_ptr)
- {
- pData_ptr;
- const uint thread_index = static_cast<uint>(data);
-
- image_u8 orig_chunk;
- image_u8 decomp_chunk[cNumChunkEncodings];
-
- orig_chunk.resize(cChunkPixelWidth, cChunkPixelHeight);
- for (uint i = 0; i < cNumChunkEncodings; i++)
- decomp_chunk[i].resize(cChunkPixelWidth, cChunkPixelHeight);
-
- image_utils::error_metrics color_error_metrics[cNumChunkEncodings];
- dxt1_endpoint_optimizer::results color_optimizer_results[cNumChunkTileLayouts];
- uint8 layout_color_selectors[cNumChunkTileLayouts][cChunkPixelWidth * cChunkPixelHeight];
-
- image_utils::error_metrics alpha_error_metrics[2][cNumChunkEncodings];
- dxt5_endpoint_optimizer::results alpha_optimizer_results[2][cNumChunkTileLayouts];
- uint8 layout_alpha_selectors[2][cNumChunkTileLayouts][cChunkPixelWidth * cChunkPixelHeight];
-
- uint first_layout = 0;
- uint last_layout = cNumChunkTileLayouts;
-
- uint first_encoding = 0;
- uint last_encoding = cNumChunkEncodings;
-
- if (!m_params.m_hierarchical)
- {
- first_layout = cFirst4x4ChunkTileLayout;
- first_encoding = cNumChunkEncodings - 1;
- }
-
- for (uint chunk_index = 0; chunk_index < m_num_chunks; chunk_index++)
- {
- if (m_canceled)
- return;
-
- if ((crn_get_current_thread_id() == m_main_thread_id) && ((chunk_index & 511) == 0))
- {
- if (!update_progress(0, chunk_index, m_num_chunks))
- return;
- }
-
- if (m_pTask_pool->get_num_threads())
- {
- if ((chunk_index % (m_pTask_pool->get_num_threads() + 1)) != thread_index)
- continue;
- }
-
- uint level_index = 0;
- for (uint i = 0; i < m_params.m_num_levels; i++)
- {
- if ((chunk_index >= m_params.m_levels[i].m_first_chunk) && (chunk_index < m_params.m_levels[i].m_first_chunk + m_params.m_levels[i].m_num_chunks))
- {
- level_index = i;
- break;
- }
- }
-
- for (uint cy = 0; cy < cChunkPixelHeight; cy++)
- for (uint cx = 0; cx < cChunkPixelWidth; cx++)
- orig_chunk(cx, cy) = m_pChunks[chunk_index](cx, cy);
-
- if (m_has_color_blocks)
- {
- for (uint l = first_layout; l < last_layout; l++)
- {
- utils::zero_object(layout_color_selectors[l]);
-
- compress_dxt1_block(
- color_optimizer_results[l], chunk_index,
- orig_chunk,
- g_chunk_tile_layouts[l].m_x_ofs, g_chunk_tile_layouts[l].m_y_ofs,
- g_chunk_tile_layouts[l].m_width, g_chunk_tile_layouts[l].m_height,
- layout_color_selectors[l]);
- }
- }
-
- float alpha_layout_std_dev[2][cNumChunkTileLayouts];
- utils::zero_object(alpha_layout_std_dev);
-
- for (uint a = 0; a < m_num_alpha_blocks; a++)
- {
- for (uint l = first_layout; l < last_layout; l++)
- {
- utils::zero_object(layout_alpha_selectors[a][l]);
-
- compress_dxt5_block(
- alpha_optimizer_results[a][l], chunk_index,
- orig_chunk,
- g_chunk_tile_layouts[l].m_x_ofs, g_chunk_tile_layouts[l].m_y_ofs,
- g_chunk_tile_layouts[l].m_width, g_chunk_tile_layouts[l].m_height,
- m_params.m_alpha_component_indices[a],
- layout_alpha_selectors[a][l]);
-
- for (uint a = 0; a < m_num_alpha_blocks; a++)
- {
- float mean = 0.0f;
- float variance = 0.0f;
-
- for (uint cy = 0; cy < g_chunk_tile_layouts[l].m_height; cy++)
- {
- for (uint cx = 0; cx < g_chunk_tile_layouts[l].m_width; cx++)
- {
- uint s = orig_chunk(cx + g_chunk_tile_layouts[l].m_x_ofs, cy + g_chunk_tile_layouts[l].m_y_ofs)[m_params.m_alpha_component_indices[a]];
-
- mean += s;
- variance += s * s;
- } // cx
- } //cy
-
- float scale = 1.0f / (g_chunk_tile_layouts[l].m_width * g_chunk_tile_layouts[l].m_height);
-
- mean *= scale;
- variance *= scale;
-
- variance -= mean * mean;
-
- alpha_layout_std_dev[a][l] = sqrt(variance);
-
- } //a
- }
- }
-
- for (uint e = first_encoding; e < last_encoding; e++)
- {
- for (uint t = 0; t < g_chunk_encodings[e].m_num_tiles; t++)
- {
- const uint layout_index = g_chunk_encodings[e].m_tiles[t].m_layout_index;
- CRNLIB_ASSERT( (layout_index >= first_layout) && (layout_index < last_layout) );
-
- if (m_has_color_blocks)
- {
- const dxt1_endpoint_optimizer::results& color_results = color_optimizer_results[layout_index];
- const uint8* pColor_selectors = layout_color_selectors[layout_index];
-
- color_quad_u8 block_colors[cDXT1SelectorValues];
- CRNLIB_ASSERT(color_results.m_low_color >= color_results.m_high_color);
- // it's okay if color_results.m_low_color == color_results.m_high_color, because in this case only selector 0 should be used
- dxt1_block::get_block_colors4(block_colors, color_results.m_low_color, color_results.m_high_color);
-
- for (uint cy = 0; cy < g_chunk_encodings[e].m_tiles[t].m_height; cy++)
- {
- for (uint cx = 0; cx < g_chunk_encodings[e].m_tiles[t].m_width; cx++)
- {
- uint s = pColor_selectors[cx + cy * g_chunk_encodings[e].m_tiles[t].m_width];
- CRNLIB_ASSERT(s < cDXT1SelectorValues);
-
- decomp_chunk[e](cx + g_chunk_encodings[e].m_tiles[t].m_x_ofs, cy + g_chunk_encodings[e].m_tiles[t].m_y_ofs) = block_colors[s];
- }
- }
- }
-
- for (uint a = 0; a < m_num_alpha_blocks; a++)
- {
- const dxt5_endpoint_optimizer::results& alpha_results = alpha_optimizer_results[a][layout_index];
- const uint8* pAlpha_selectors = layout_alpha_selectors[a][layout_index];
-
- uint block_values[cDXT5SelectorValues];
- CRNLIB_ASSERT(alpha_results.m_first_endpoint >= alpha_results.m_second_endpoint);
- dxt5_block::get_block_values8(block_values, alpha_results.m_first_endpoint, alpha_results.m_second_endpoint);
-
- for (uint cy = 0; cy < g_chunk_encodings[e].m_tiles[t].m_height; cy++)
- {
- for (uint cx = 0; cx < g_chunk_encodings[e].m_tiles[t].m_width; cx++)
- {
- uint s = pAlpha_selectors[cx + cy * g_chunk_encodings[e].m_tiles[t].m_width];
- CRNLIB_ASSERT(s < cDXT5SelectorValues);
-
- decomp_chunk[e](cx + g_chunk_encodings[e].m_tiles[t].m_x_ofs, cy + g_chunk_encodings[e].m_tiles[t].m_y_ofs)[m_params.m_alpha_component_indices[a]] =
- static_cast<uint8>(block_values[s]);
- }
- }
-
- }
- } // t
-
- if (m_params.m_hierarchical)
- {
- if (m_has_color_blocks)
- color_error_metrics[e].compute(decomp_chunk[e], orig_chunk, 0, 3);
-
- for (uint a = 0; a < m_num_alpha_blocks; a++)
- alpha_error_metrics[a][e].compute(decomp_chunk[e], orig_chunk, m_params.m_alpha_component_indices[a], 1);
- }
- } // e
-
- uint best_encoding = cNumChunkEncodings - 1;
-
- if (m_params.m_hierarchical)
- {
- float quality[cNumChunkEncodings];
- utils::zero_object(quality);
-
- float best_quality = 0.0f;
-
- best_encoding = 0;
-
- for (uint e = 0; e < cNumChunkEncodings; e++)
- {
- if (m_has_color_blocks)
- {
- float adaptive_tile_color_psnr_derating = m_params.m_adaptive_tile_color_psnr_derating;
- if ((level_index) && (adaptive_tile_color_psnr_derating > .25f))
- {
- //adaptive_tile_color_psnr_derating = math::lerp(adaptive_tile_color_psnr_derating * .5f, .3f, (level_index - 1) / math::maximum(1.0f, float(m_params.m_num_levels - 2)));
- adaptive_tile_color_psnr_derating = math::maximum(.25f, adaptive_tile_color_psnr_derating / powf(3.0f, static_cast<float>(level_index)));
- }
-
- float color_derating = math::lerp( 0.0f, adaptive_tile_color_psnr_derating, (g_chunk_encodings[e].m_num_tiles - 1) / 3.0f );
- quality[e] = (float)math::maximum<double>(color_error_metrics[e].mPeakSNR - color_derating, 0.0f);
- }
-
- if (m_num_alpha_blocks)
- {
- quality[e] *= m_params.m_adaptive_tile_color_alpha_weighting_ratio;
- float alpha_derating = math::lerp( 0.0f, m_params.m_adaptive_tile_alpha_psnr_derating, (g_chunk_encodings[e].m_num_tiles - 1) / 3.0f );
-
- float max_std_dev = 0.0f;
-
- for (uint a = 0; a < m_num_alpha_blocks; a++)
- {
- quality[e] += (float)math::maximum<double>(alpha_error_metrics[a][e].mPeakSNR - alpha_derating, 0.0f);
-
- for (uint t = 0; t < g_chunk_encodings[e].m_num_tiles; t++)
- {
- float std_dev = alpha_layout_std_dev[a][ g_chunk_encodings[e].m_tiles[t].m_layout_index ];
- max_std_dev = math::maximum(max_std_dev, std_dev);
- }
- }
-
-#if 0
-// rg [4/28/09] - disabling this because it's fucking up dxt5_xgbr normal maps
- const float l = 6.0f;
- const float k = .5f;
-
- if (max_std_dev > l)
- {
- float s = max_std_dev - l;
- quality[e] -= (k * s);
- }
-#endif
- }
-
- if (quality[e] > best_quality)
- {
- best_quality = quality[e];
- best_encoding = e;
- }
- }
- }
-
- atomic_increment32(&m_encoding_hist[best_encoding]);
-
- atomic_exchange_add32(&m_total_tiles, g_chunk_encodings[best_encoding].m_num_tiles);
-
- for (uint q = 0; q < cNumCompressedChunkVecs; q++)
- {
- if (q == cColorChunks)
- {
- if (!m_has_color_blocks)
- continue;
- }
- else if (q > m_num_alpha_blocks)
- continue;
-
- compressed_chunk& output = m_compressed_chunks[q][chunk_index];
-
- output.m_encoding_index = static_cast<uint8>(best_encoding);
- output.m_num_tiles = static_cast<uint8>(g_chunk_encodings[best_encoding].m_num_tiles);
-
- for (uint t = 0; t < g_chunk_encodings[best_encoding].m_num_tiles; t++)
- {
- const uint layout_index = g_chunk_encodings[best_encoding].m_tiles[t].m_layout_index;
-
- output.m_tiles[t].m_layout_index = static_cast<uint8>(layout_index);
- output.m_tiles[t].m_pixel_width = static_cast<uint8>(g_chunk_encodings[best_encoding].m_tiles[t].m_width);
- output.m_tiles[t].m_pixel_height = static_cast<uint8>(g_chunk_encodings[best_encoding].m_tiles[t].m_height);
-
- if (q == cColorChunks)
- {
- const dxt1_endpoint_optimizer::results& color_results = color_optimizer_results[layout_index];
- const uint8* pColor_selectors = layout_color_selectors[layout_index];
-
- output.m_tiles[t].m_endpoint_cluster_index = 0;
- output.m_tiles[t].m_first_endpoint = color_results.m_low_color;
- output.m_tiles[t].m_second_endpoint = color_results.m_high_color;
-
- memcpy(output.m_tiles[t].m_selectors, pColor_selectors, cChunkPixelWidth * cChunkPixelHeight);
- output.m_tiles[t].m_alpha_encoding = color_results.m_alpha_block;
- }
- else
- {
- const uint a = q - cAlpha0Chunks;
-
- const dxt5_endpoint_optimizer::results& alpha_results = alpha_optimizer_results[a][layout_index];
- const uint8* pAlpha_selectors = layout_alpha_selectors[a][layout_index];
-
- output.m_tiles[t].m_endpoint_cluster_index = 0;
- output.m_tiles[t].m_first_endpoint = alpha_results.m_first_endpoint;
- output.m_tiles[t].m_second_endpoint = alpha_results.m_second_endpoint;
-
- memcpy(output.m_tiles[t].m_selectors, pAlpha_selectors, cChunkPixelWidth * cChunkPixelHeight);
- output.m_tiles[t].m_alpha_encoding = alpha_results.m_block_type != 0;
- }
- } // t
- } // q
-
- if (m_params.m_debugging)
- {
- for (uint y = 0; y < cChunkPixelHeight; y++)
- for (uint x = 0; x < cChunkPixelWidth; x++)
- m_dbg_chunk_pixels[chunk_index](x, y) = decomp_chunk[best_encoding](x, y);
-
- for (uint t = 0; t < g_chunk_encodings[best_encoding].m_num_tiles; t++)
- {
- const uint layout_index = g_chunk_encodings[best_encoding].m_tiles[t].m_layout_index;
-
- const chunk_tile_desc& tile_desc = g_chunk_tile_layouts[layout_index];
-
- for (uint ty = 0; ty < tile_desc.m_height; ty++)
- for (uint tx = 0; tx < tile_desc.m_width; tx++)
- m_dbg_chunk_pixels_tile_vis[chunk_index](tile_desc.m_x_ofs + tx, tile_desc.m_y_ofs + ty) = g_tile_layout_colors[layout_index];
- }
- }
-
- } // chunk_index
- }
-
- bool dxt_hc::determine_compressed_chunks()
- {
- utils::zero_object(m_encoding_hist);
-
- for (uint i = 0; i < cNumCompressedChunkVecs; i++)
- m_compressed_chunks[i].clear();
-
- if (m_has_color_blocks)
- m_compressed_chunks[cColorChunks].resize(m_num_chunks);
-
- for (uint a = 0; a < m_num_alpha_blocks; a++)
- m_compressed_chunks[cAlpha0Chunks + a].resize(m_num_chunks);
-
- if (m_params.m_debugging)
- {
- m_dbg_chunk_pixels.resize(m_num_chunks);
- m_dbg_chunk_pixels_tile_vis.resize(m_num_chunks);
-
- for (uint i = 0; i < m_num_chunks; i++)
- {
- m_dbg_chunk_pixels[i].clear();
- m_dbg_chunk_pixels_tile_vis[i].clear();
- }
- }
-
- m_total_tiles = 0;
-
- for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
- m_pTask_pool->queue_object_task(this, &dxt_hc::determine_compressed_chunks_task, i);
-
- m_pTask_pool->join();
- if (m_canceled)
- return false;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- {
- console::info("Total Pixels: %u, Chunks: %u, Blocks: %u, Adapted Tiles: %u", m_num_chunks * cChunkPixelWidth * cChunkPixelHeight, m_num_chunks, m_num_chunks * cChunkBlockWidth * cChunkBlockHeight, m_total_tiles);
-
- console::info("Chunk encoding type symbol_histogram: ");
- for (uint e = 0; e < cNumChunkEncodings; e++)
- console::info("%u ", m_encoding_hist[e]);
-
- console::info("Blocks per chunk encoding type: ");
- for (uint e = 0; e < cNumChunkEncodings; e++)
- console::info("%u ", m_encoding_hist[e] * cChunkBlockWidth * cChunkBlockHeight);
- }
-#endif
-
- return true;
- }
-
- void dxt_hc::assign_color_endpoint_clusters_task(uint64 data, void* pData_ptr)
- {
- const uint thread_index = (uint)data;
- assign_color_endpoint_clusters_state& state = *static_cast<assign_color_endpoint_clusters_state*>(pData_ptr);
-
- for (uint chunk_index = 0; chunk_index < m_num_chunks; chunk_index++)
- {
- if (m_canceled)
- return;
-
- if ((crn_get_current_thread_id() == m_main_thread_id) && ((chunk_index & 63) == 0))
- {
- if (!update_progress(2, chunk_index, m_num_chunks))
- return;
- }
-
- if (m_pTask_pool->get_num_threads())
- {
- if ((chunk_index % (m_pTask_pool->get_num_threads() + 1)) != thread_index)
- continue;
- }
-
- compressed_chunk& chunk = m_compressed_chunks[cColorChunks][chunk_index];
-
- for (uint tile_index = 0; tile_index < chunk.m_num_tiles; tile_index++)
- {
- uint cluster_index = state.m_vq.find_best_codebook_entry_fs(state.m_training_vecs[chunk_index][tile_index]);
-
- chunk.m_endpoint_cluster_index[tile_index] = static_cast<uint16>(cluster_index);
- }
- }
- }
-
- bool dxt_hc::determine_color_endpoint_clusters()
- {
- if (!m_has_color_blocks)
- return true;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Generating color training vectors");
-#endif
-
- const float r_scale = .5f;
- const float b_scale = .25f;
-
- vec6F_tree_vq vq;
-
- crnlib::vector< crnlib::vector<vec6F> > training_vecs;
-
- training_vecs.resize(m_num_chunks);
-
- for (uint chunk_index = 0; chunk_index < m_num_chunks; chunk_index++)
- {
- if ((chunk_index & 255) == 0)
- {
- if (!update_progress(1, chunk_index, m_num_chunks))
- return false;
- }
-
- const compressed_chunk& chunk = m_compressed_chunks[cColorChunks][chunk_index];
-
- training_vecs[chunk_index].resize(chunk.m_num_tiles);
-
- for (uint tile_index = 0; tile_index < chunk.m_num_tiles; tile_index++)
- {
- const compressed_tile& tile = chunk.m_tiles[tile_index];
-
- const chunk_tile_desc& layout = g_chunk_tile_layouts[tile.m_layout_index];
-
- tree_clusterizer<vec3F> palettizer;
- for (uint y = 0; y < layout.m_height; y++)
- {
- for (uint x = 0; x < layout.m_width; x++)
- {
- const color_quad_u8& c = m_pChunks[chunk_index](layout.m_x_ofs + x, layout.m_y_ofs + y);
-
- vec3F v;
- if (m_params.m_perceptual)
- {
- v.set(c[0] * 1.0f/255.0f, c[1] * 1.0f/255.0f, c[2] * 1.0f/255.0f);
- v[0] *= r_scale;
- v[2] *= b_scale;
- }
- else
- {
- v.set(c[0] * 1.0f/255.0f, c[1] * 1.0f/255.0f, c[2] * 1.0f/255.0f);
- }
-
- palettizer.add_training_vec(v, 1);
- }
- }
-
- palettizer.generate_codebook(2);
-
- uint tile_weight = tile.m_pixel_width * tile.m_pixel_height;
- tile_weight = static_cast<uint>(tile_weight * m_pChunks[chunk_index].m_weight);
-
- vec3F v[2];
- utils::zero_object(v);
-
- for (uint i = 0; i < palettizer.get_codebook_size(); i++)
- v[i] = palettizer.get_codebook_entry(i);
-
- if (palettizer.get_codebook_size() == 1)
- v[1] = v[0];
- if (v[0].length() > v[1].length())
- utils::swap(v[0], v[1]);
-
- vec6F vv;
- for (uint i = 0; i < 2; i++)
- {
- vv[i*3+0] = v[i][0];
- vv[i*3+1] = v[i][1];
- vv[i*3+2] = v[i][2];
- }
-
- vq.add_training_vec(vv, tile_weight);
-
- training_vecs[chunk_index][tile_index] = vv;
- }
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Begin color cluster analysis");
- timer t;
- t.start();
-#endif
-
- uint codebook_size = math::minimum<uint>(m_total_tiles, m_params.m_color_endpoint_codebook_size);
- vq.generate_codebook(codebook_size);
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- {
- double total_time = t.get_elapsed_secs();
- console::info("Codebook gen time: %3.3fs, Total color clusters: %u", total_time, vq.get_codebook_size());
- }
-#endif
-
- m_color_clusters.resize(vq.get_codebook_size());
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Begin color cluster assignment");
-#endif
-
- assign_color_endpoint_clusters_state state(vq, training_vecs);
-
- for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
- m_pTask_pool->queue_object_task(this, &dxt_hc::assign_color_endpoint_clusters_task, i, &state);
-
- m_pTask_pool->join();
- if (m_canceled)
- return false;
-
- for (uint chunk_index = 0; chunk_index < m_num_chunks; chunk_index++)
- {
- compressed_chunk& chunk = m_compressed_chunks[cColorChunks][chunk_index];
-
- for (uint tile_index = 0; tile_index < chunk.m_num_tiles; tile_index++)
- {
- uint cluster_index = chunk.m_endpoint_cluster_index[tile_index];
-
- m_color_clusters[cluster_index].m_tiles.push_back( std::make_pair(chunk_index, tile_index) );
- }
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Completed color cluster assignment");
-#endif
-
- return true;
- }
-
- void dxt_hc::determine_alpha_endpoint_clusters_task(uint64 data, void* pData_ptr)
- {
- const uint thread_index = static_cast<uint>(data);
- const determine_alpha_endpoint_clusters_state& state = *static_cast<determine_alpha_endpoint_clusters_state*>(pData_ptr);
-
- for (uint a = 0; a < m_num_alpha_blocks; a++)
- {
- for (uint chunk_index = 0; chunk_index < m_num_chunks; chunk_index++)
- {
- if (m_canceled)
- return;
-
- if ((crn_get_current_thread_id() == m_main_thread_id) && ((chunk_index & 63) == 0))
- {
- if (!update_progress(7, m_num_chunks * a + chunk_index, m_num_chunks * m_num_alpha_blocks))
- return;
- }
-
- if (m_pTask_pool->get_num_threads())
- {
- if ((chunk_index % (m_pTask_pool->get_num_threads() + 1)) != thread_index)
- continue;
- }
-
- compressed_chunk& chunk = m_compressed_chunks[cAlpha0Chunks + a][chunk_index];
-
- for (uint tile_index = 0; tile_index < chunk.m_num_tiles; tile_index++)
- {
- uint cluster_index = state.m_vq.find_best_codebook_entry_fs(state.m_training_vecs[a][chunk_index][tile_index]);
-
- chunk.m_endpoint_cluster_index[tile_index] = static_cast<uint16>(cluster_index);
- }
- }
- }
- }
-
- bool dxt_hc::determine_alpha_endpoint_clusters()
- {
- if (!m_num_alpha_blocks)
- return true;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Generating alpha training vectors");
-#endif
-
- determine_alpha_endpoint_clusters_state state;
-
- for (uint a = 0; a < m_num_alpha_blocks; a++)
- {
- state.m_training_vecs[a].resize(m_num_chunks);
-
- for (uint chunk_index = 0; chunk_index < m_num_chunks; chunk_index++)
- {
- if ((chunk_index & 63) == 0)
- {
- if (!update_progress(6, m_num_chunks * a + chunk_index, m_num_chunks * m_num_alpha_blocks))
- return false;
- }
-
- const compressed_chunk& chunk = m_compressed_chunks[cAlpha0Chunks + a][chunk_index];
-
- state.m_training_vecs[a][chunk_index].resize(chunk.m_num_tiles);
-
- for (uint tile_index = 0; tile_index < chunk.m_num_tiles; tile_index++)
- {
- const compressed_tile& tile = chunk.m_tiles[tile_index];
-
- const chunk_tile_desc& layout = g_chunk_tile_layouts[tile.m_layout_index];
-
- tree_clusterizer<vec1F> palettizer;
-
- for (uint y = 0; y < layout.m_height; y++)
- {
- for (uint x = 0; x < layout.m_width; x++)
- {
- uint c = m_pChunks[chunk_index](layout.m_x_ofs + x, layout.m_y_ofs + y)[m_params.m_alpha_component_indices[a]];
-
- vec1F v(c * 1.0f/255.0f);
-
- palettizer.add_training_vec(v, 1);
- }
- }
- palettizer.generate_codebook(2);
-
- const uint tile_weight = tile.m_pixel_width * tile.m_pixel_height;
-
- vec1F v[2];
- utils::zero_object(v);
-
- for (uint i = 0; i < palettizer.get_codebook_size(); i++)
- v[i] = palettizer.get_codebook_entry(i);
-
- if (palettizer.get_codebook_size() == 1)
- v[1] = v[0];
- if (v[0] > v[1])
- utils::swap(v[0], v[1]);
-
- vec2F vv(v[0][0], v[1][0]);
-
- state.m_vq.add_training_vec(vv, tile_weight);
-
- state.m_training_vecs[a][chunk_index][tile_index] = vv;
-
- } // tile_index
- } // chunk_index
- } // a
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Begin alpha cluster analysis");
- timer t;
- t.start();
-#endif
-
- uint codebook_size = math::minimum<uint>(m_total_tiles, m_params.m_alpha_endpoint_codebook_size);
- state.m_vq.generate_codebook(codebook_size);
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- {
- double total_time = t.get_elapsed_secs();
- console::info("Codebook gen time: %3.3fs, Total alpha clusters: %u", total_time, state.m_vq.get_codebook_size());
- }
-#endif
-
- m_alpha_clusters.resize(state.m_vq.get_codebook_size());
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Begin alpha cluster assignment");
-#endif
-
- for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
- m_pTask_pool->queue_object_task(this, &dxt_hc::determine_alpha_endpoint_clusters_task, i, &state);
-
- m_pTask_pool->join();
- if (m_canceled)
- return false;
-
- for (uint a = 0; a < m_num_alpha_blocks; a++)
- {
- for (uint chunk_index = 0; chunk_index < m_num_chunks; chunk_index++)
- {
- compressed_chunk& chunk = m_compressed_chunks[cAlpha0Chunks + a][chunk_index];
-
- for (uint tile_index = 0; tile_index < chunk.m_num_tiles; tile_index++)
- {
- const uint cluster_index = chunk.m_endpoint_cluster_index[tile_index];
-
- m_alpha_clusters[cluster_index].m_tiles.push_back( std::make_pair(chunk_index, tile_index | (a << 16)) );
- }
- }
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Completed alpha cluster assignment");
-#endif
-
- return true;
- }
-
- void dxt_hc::determine_color_endpoint_codebook_task(uint64 data, void* pData_ptr)
- {
- pData_ptr;
- const uint thread_index = static_cast<uint>(data);
-
- if (!m_has_color_blocks)
- return;
-
- crnlib::vector<color_quad_u8> pixels;
- pixels.reserve(512);
-
- crnlib::vector<uint8> selectors;
-
- uint total_pixels = 0;
-
- uint total_empty_clusters = 0;
- for (uint cluster_index = 0; cluster_index < m_color_clusters.size(); cluster_index++)
- {
- if (m_canceled)
- return;
-
- if ((crn_get_current_thread_id() == m_main_thread_id) && ((cluster_index & 63) == 0))
- {
- if (!update_progress(3, cluster_index, m_color_clusters.size()))
- return;
- }
-
- if (m_pTask_pool->get_num_threads())
- {
- if ((cluster_index % (m_pTask_pool->get_num_threads() + 1)) != thread_index)
- continue;
- }
-
- tile_cluster& cluster = m_color_clusters[cluster_index];
- if (cluster.m_tiles.empty())
- {
- total_empty_clusters++;
- continue;
- }
-
- pixels.resize(0);
-
- for (uint t = 0; t < cluster.m_tiles.size(); t++)
- {
- const uint chunk_index = cluster.m_tiles[t].first;
- const uint tile_index = cluster.m_tiles[t].second;
- CRNLIB_ASSERT(chunk_index < m_num_chunks);
- CRNLIB_ASSERT(tile_index < cChunkMaxTiles);
-
- const compressed_chunk& chunk = m_compressed_chunks[cColorChunks][chunk_index];
-
- CRNLIB_ASSERT(tile_index < chunk.m_num_tiles);
- const compressed_tile& tile = chunk.m_tiles[tile_index];
-
- const chunk_tile_desc& layout = g_chunk_tile_layouts[tile.m_layout_index];
-
- for (uint y = 0; y < layout.m_height; y++)
- for (uint x = 0; x < layout.m_width; x++)
- pixels.push_back( m_pChunks[chunk_index](layout.m_x_ofs + x, layout.m_y_ofs + y) );
- }
-
- total_pixels += pixels.size();
-
- selectors.resize(pixels.size());
-
- dxt1_endpoint_optimizer::params params;
- params.m_block_index = cluster_index;
- params.m_pPixels = &pixels[0];
- params.m_num_pixels = pixels.size();
- params.m_pixels_have_alpha = false;
- params.m_use_alpha_blocks = false;
- params.m_perceptual = m_params.m_perceptual;
- params.m_quality = cCRNDXTQualityUber;
- params.m_endpoint_caching = false;
-
- dxt1_endpoint_optimizer::results results;
- results.m_pSelectors = &selectors[0];
-
- dxt1_endpoint_optimizer optimizer;
- const bool all_transparent = optimizer.compute(params, results);
- all_transparent;
-
- cluster.m_first_endpoint = results.m_low_color;
- cluster.m_second_endpoint = results.m_high_color;
- cluster.m_alpha_encoding = results.m_alpha_block;
- cluster.m_error = results.m_error;
-
- uint pixel_index = 0;
-
- for (uint t = 0; t < cluster.m_tiles.size(); t++)
- {
- const uint chunk_index = cluster.m_tiles[t].first;
- const uint tile_index = cluster.m_tiles[t].second;
-
- CRNLIB_ASSERT(chunk_index < m_num_chunks);
-
- compressed_chunk& chunk = m_compressed_chunks[cColorChunks][chunk_index];
-
- CRNLIB_ASSERT(tile_index < chunk.m_num_tiles);
-
- CRNLIB_ASSERT(chunk.m_endpoint_cluster_index[tile_index] == cluster_index);
-
- const compressed_tile& tile = chunk.m_tiles[tile_index];
-
- const chunk_tile_desc& layout = g_chunk_tile_layouts[tile.m_layout_index];
- layout;
-
- compressed_tile& quantized_tile = chunk.m_quantized_tiles[tile_index];
-
- const uint total_pixels = tile.m_pixel_width * tile.m_pixel_height;
-
- quantized_tile.m_endpoint_cluster_index = cluster_index;
- quantized_tile.m_first_endpoint = results.m_low_color;
- quantized_tile.m_second_endpoint = results.m_high_color;
- //quantized_tile.m_error = results.m_error;
- quantized_tile.m_alpha_encoding = results.m_alpha_block;
- quantized_tile.m_pixel_width = tile.m_pixel_width;
- quantized_tile.m_pixel_height = tile.m_pixel_height;
- quantized_tile.m_layout_index = tile.m_layout_index;
-
- memcpy(quantized_tile.m_selectors, &selectors[pixel_index], total_pixels);
-
- pixel_index += total_pixels;
- }
- }
-
- //CRNLIB_ASSERT(total_pixels == (m_num_chunks * cChunkPixelWidth * cChunkPixelHeight));
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- {
- if (total_empty_clusters)
- console::warning("Total empty color clusters: %u", total_empty_clusters);
- }
-#endif
- }
-
- bool dxt_hc::determine_color_endpoint_codebook()
- {
- if (!m_has_color_blocks)
- return true;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Computing optimal color cluster endpoints");
-#endif
-
- for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
- m_pTask_pool->queue_object_task(this, &dxt_hc::determine_color_endpoint_codebook_task, i, NULL);
-
- m_pTask_pool->join();
-
- return !m_canceled;
- }
-
- void dxt_hc::determine_alpha_endpoint_codebook_task(uint64 data, void* pData_ptr)
- {
- pData_ptr;
-
- const uint thread_index = static_cast<uint>(data);
-
- crnlib::vector<color_quad_u8> pixels;
- pixels.reserve(512);
-
- crnlib::vector<uint8> selectors;
- selectors.reserve(512);
-
- uint total_empty_clusters = 0;
- for (uint cluster_index = 0; cluster_index < m_alpha_clusters.size(); cluster_index++)
- {
- if (m_canceled)
- return;
-
- if ((crn_get_current_thread_id() == m_main_thread_id) && ((cluster_index & 63) == 0))
- {
- if (!update_progress(8, cluster_index, m_alpha_clusters.size()))
- return;
- }
-
- if (m_pTask_pool->get_num_threads())
- {
- if ((cluster_index % (m_pTask_pool->get_num_threads() + 1)) != thread_index)
- continue;
- }
-
- tile_cluster& cluster = m_alpha_clusters[cluster_index];
- if (cluster.m_tiles.empty())
- {
- total_empty_clusters++;
- continue;
- }
-
- pixels.resize(0);
-
- for (uint tile_iter = 0; tile_iter < cluster.m_tiles.size(); tile_iter++)
- {
- const uint chunk_index = cluster.m_tiles[tile_iter].first;
- const uint tile_index = cluster.m_tiles[tile_iter].second & 0xFFFFU;
- const uint alpha_index = cluster.m_tiles[tile_iter].second >> 16U;
-
- CRNLIB_ASSERT(chunk_index < m_num_chunks);
- CRNLIB_ASSERT(tile_index < cChunkMaxTiles);
- CRNLIB_ASSERT(alpha_index < m_num_alpha_blocks);
-
- const compressed_chunk& chunk = m_compressed_chunks[cAlpha0Chunks + alpha_index][chunk_index];
-
- CRNLIB_ASSERT(chunk.m_endpoint_cluster_index[tile_index] == cluster_index);
-
- CRNLIB_ASSERT(tile_index < chunk.m_num_tiles);
- const compressed_tile& tile = chunk.m_tiles[tile_index];
-
- const chunk_tile_desc& layout = g_chunk_tile_layouts[tile.m_layout_index];
-
- color_quad_u8 c(cClear);
-
- for (uint y = 0; y < layout.m_height; y++)
- {
- for (uint x = 0; x < layout.m_width; x++)
- {
- c[0] = m_pChunks[chunk_index](layout.m_x_ofs + x, layout.m_y_ofs + y)[ m_params.m_alpha_component_indices[alpha_index] ];
-
- pixels.push_back(c);
- }
- }
- }
-
- selectors.resize(pixels.size());
-
- dxt5_endpoint_optimizer::params params;
- params.m_block_index = cluster_index;
- params.m_pPixels = &pixels[0];
- params.m_num_pixels = pixels.size();
- params.m_comp_index = 0;
- params.m_quality = cCRNDXTQualityUber;
- params.m_use_both_block_types = false;
-
- dxt5_endpoint_optimizer::results results;
- results.m_pSelectors = &selectors[0];
-
- dxt5_endpoint_optimizer optimizer;
- const bool all_transparent = optimizer.compute(params, results);
- all_transparent;
-
- cluster.m_first_endpoint = results.m_first_endpoint;
- cluster.m_second_endpoint = results.m_second_endpoint;
- cluster.m_alpha_encoding = results.m_block_type != 0;
- cluster.m_error = results.m_error;
-
- uint pixel_index = 0;
-
- for (uint tile_iter = 0; tile_iter < cluster.m_tiles.size(); tile_iter++)
- {
- const uint chunk_index = cluster.m_tiles[tile_iter].first;
- const uint tile_index = cluster.m_tiles[tile_iter].second & 0xFFFFU;
- const uint alpha_index = cluster.m_tiles[tile_iter].second >> 16U;
- CRNLIB_ASSERT(chunk_index < m_num_chunks);
- CRNLIB_ASSERT(tile_index < cChunkMaxTiles);
- CRNLIB_ASSERT(alpha_index < m_num_alpha_blocks);
-
- compressed_chunk& chunk = m_compressed_chunks[cAlpha0Chunks + alpha_index][chunk_index];
-
- CRNLIB_ASSERT(chunk.m_endpoint_cluster_index[tile_index] == cluster_index);
-
- CRNLIB_ASSERT(tile_index < chunk.m_num_tiles);
- const compressed_tile& tile = chunk.m_tiles[tile_index];
-
- const chunk_tile_desc& layout = g_chunk_tile_layouts[tile.m_layout_index];
- layout;
-
- compressed_tile& quantized_tile = chunk.m_quantized_tiles[tile_index];
-
- const uint total_pixels = tile.m_pixel_width * tile.m_pixel_height;
-
- quantized_tile.m_endpoint_cluster_index = cluster_index;
- quantized_tile.m_first_endpoint = results.m_first_endpoint;
- quantized_tile.m_second_endpoint = results.m_second_endpoint;
- //quantized_tile.m_error = results.m_error;
- quantized_tile.m_alpha_encoding = results.m_block_type != 0;
- quantized_tile.m_pixel_width = tile.m_pixel_width;
- quantized_tile.m_pixel_height = tile.m_pixel_height;
- quantized_tile.m_layout_index = tile.m_layout_index;
-
- memcpy(quantized_tile.m_selectors, &selectors[pixel_index], total_pixels);
-
- pixel_index += total_pixels;
- }
- } // cluster_index
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- {
- if (total_empty_clusters)
- console::warning("Total empty alpha clusters: %u", total_empty_clusters);
- }
-#endif
- }
-
- bool dxt_hc::determine_alpha_endpoint_codebook()
- {
- if (!m_num_alpha_blocks)
- return true;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Computing optimal alpha cluster endpoints");
-#endif
-
- for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
- m_pTask_pool->queue_object_task(this, &dxt_hc::determine_alpha_endpoint_codebook_task, i, NULL);
-
- m_pTask_pool->join();
-
- return !m_canceled;
- }
-
- void dxt_hc::create_quantized_debug_images()
- {
- if (!m_params.m_debugging)
- return;
-
- if (m_has_color_blocks)
- {
- m_dbg_chunk_pixels_color_quantized.resize(m_num_chunks);
- m_dbg_chunk_pixels_quantized_color_selectors.resize(m_num_chunks);
- m_dbg_chunk_pixels_orig_color_selectors.resize(m_num_chunks);
-
- for (uint i = 0; i < m_num_chunks; i++)
- {
- m_dbg_chunk_pixels_color_quantized[i].clear();
- m_dbg_chunk_pixels_quantized_color_selectors[i].clear();
- m_dbg_chunk_pixels_orig_color_selectors[i].clear();
- }
- }
-
- if (m_num_alpha_blocks)
- {
- m_dbg_chunk_pixels_alpha_quantized.resize(m_num_chunks);
- m_dbg_chunk_pixels_quantized_alpha_selectors.resize(m_num_chunks);
- m_dbg_chunk_pixels_orig_alpha_selectors.resize(m_num_chunks);
-
- for (uint i = 0; i < m_num_chunks; i++)
- {
- m_dbg_chunk_pixels_alpha_quantized[i].clear();
- m_dbg_chunk_pixels_quantized_alpha_selectors[i].clear();
- m_dbg_chunk_pixels_orig_alpha_selectors[i].clear();
- }
- }
-
- for (uint chunk_index = 0; chunk_index < m_num_chunks; chunk_index++)
- {
- if (m_has_color_blocks)
- {
- pixel_chunk& output_chunk_color_quantized = m_dbg_chunk_pixels_color_quantized[chunk_index];
- pixel_chunk& output_chunk_selectors = m_dbg_chunk_pixels_quantized_color_selectors[chunk_index];
- pixel_chunk& output_chunk_orig_selectors = m_dbg_chunk_pixels_orig_color_selectors[chunk_index];
-
- const compressed_chunk& color_chunk = m_compressed_chunks[cColorChunks][chunk_index];
-
- for (uint tile_index = 0; tile_index < color_chunk.m_num_tiles; tile_index++)
- {
- const compressed_tile& quantized_tile = color_chunk.m_quantized_tiles[tile_index];
-
- const chunk_tile_desc& layout = g_chunk_tile_layouts[quantized_tile.m_layout_index];
-
- const uint8* pColor_Selectors = quantized_tile.m_selectors;
-
- color_quad_u8 block_colors[cDXT1SelectorValues];
- CRNLIB_ASSERT(quantized_tile.m_first_endpoint >= quantized_tile.m_second_endpoint);
- dxt1_block::get_block_colors(block_colors, static_cast<uint16>(quantized_tile.m_first_endpoint), static_cast<uint16>(quantized_tile.m_second_endpoint));
-
- for (uint y = 0; y < layout.m_height; y++)
- {
- for (uint x = 0; x < layout.m_width; x++)
- {
- const uint selector = pColor_Selectors[x + y * layout.m_width];
-
- output_chunk_selectors(x + layout.m_x_ofs, y + layout.m_y_ofs) = selector*255/(cDXT1SelectorValues-1);
-
- output_chunk_orig_selectors(x + layout.m_x_ofs, y + layout.m_y_ofs) = color_chunk.m_tiles[tile_index].m_selectors[x + y * layout.m_width] * 255 / (cDXT1SelectorValues-1);
-
- output_chunk_color_quantized(x + layout.m_x_ofs, y + layout.m_y_ofs) = block_colors[selector];
- }
- }
- }
- }
-
- for (uint a = 0; a < m_num_alpha_blocks; a++)
- {
- pixel_chunk& output_chunk_alpha_quantized = m_dbg_chunk_pixels_alpha_quantized[chunk_index];
- pixel_chunk& output_chunk_selectors = m_dbg_chunk_pixels_quantized_alpha_selectors[chunk_index];
- pixel_chunk& output_chunk_orig_selectors = m_dbg_chunk_pixels_orig_alpha_selectors[chunk_index];
-
- const compressed_chunk& alpha_chunk = m_compressed_chunks[cAlpha0Chunks + a][chunk_index];
-
- for (uint tile_index = 0; tile_index < alpha_chunk.m_num_tiles; tile_index++)
- {
- const compressed_tile& quantized_tile = alpha_chunk.m_quantized_tiles[tile_index];
-
- const chunk_tile_desc& layout = g_chunk_tile_layouts[quantized_tile.m_layout_index];
-
- const uint8* pAlpha_selectors = quantized_tile.m_selectors;
-
- uint block_values[cDXT5SelectorValues];
- CRNLIB_ASSERT(quantized_tile.m_first_endpoint >= quantized_tile.m_second_endpoint);
- dxt5_block::get_block_values(block_values, quantized_tile.m_first_endpoint, quantized_tile.m_second_endpoint);
-
- for (uint y = 0; y < layout.m_height; y++)
- {
- for (uint x = 0; x < layout.m_width; x++)
- {
- const uint selector = pAlpha_selectors[x + y * layout.m_width];
-
- CRNLIB_ASSERT(selector < cDXT5SelectorValues);
-
- output_chunk_selectors(x + layout.m_x_ofs, y + layout.m_y_ofs)[m_params.m_alpha_component_indices[a]] = static_cast<uint8>(selector*255/(cDXT5SelectorValues-1));
-
- output_chunk_orig_selectors(x + layout.m_x_ofs, y + layout.m_y_ofs)[m_params.m_alpha_component_indices[a]] = static_cast<uint8>(alpha_chunk.m_tiles[tile_index].m_selectors[x + y * layout.m_width]*255/(cDXT5SelectorValues-1));
-
- output_chunk_alpha_quantized(x + layout.m_x_ofs, y + layout.m_y_ofs)[m_params.m_alpha_component_indices[a]] = static_cast<uint8>(block_values[selector]);
- }
- }
- }
- } // a
-
- }
- }
-
- void dxt_hc::create_selector_codebook_task(uint64 data, void* pData_ptr)
- {
- const uint thread_index = static_cast<uint>(data);
- const create_selector_codebook_state& state = *static_cast<create_selector_codebook_state*>(pData_ptr);
-
- for (uint comp_chunk_index = state.m_comp_index_start; comp_chunk_index <= state.m_comp_index_end; comp_chunk_index++)
- {
- const uint alpha_index = state.m_alpha_blocks ? (comp_chunk_index - cAlpha0Chunks) : 0;
- const uint alpha_pixel_comp = state.m_alpha_blocks ? m_params.m_alpha_component_indices[alpha_index] : 0;
-
- for (uint chunk_index = 0; chunk_index < m_num_chunks; chunk_index++)
- {
- if (m_canceled)
- return;
-
- if ((crn_get_current_thread_id() == m_main_thread_id) && ((chunk_index & 127) == 0))
- {
- if (!update_progress(12 + comp_chunk_index, chunk_index, m_num_chunks))
- return;
- }
-
- if (m_pTask_pool->get_num_threads())
- {
- if ((chunk_index % (m_pTask_pool->get_num_threads() + 1)) != thread_index)
- continue;
- }
-
- compressed_chunk& chunk = m_compressed_chunks[comp_chunk_index][chunk_index];
-
- for (uint tile_index = 0; tile_index < chunk.m_num_tiles; tile_index++)
- {
- compressed_tile& quantized_tile = chunk.m_quantized_tiles[tile_index];
-
- const chunk_tile_desc& layout = g_chunk_tile_layouts[quantized_tile.m_layout_index];
-
- const uint tile_blocks_x = layout.m_width >> 2;
- const uint tile_blocks_y = layout.m_height >> 2;
-
- const uint tile_block_ofs_x = layout.m_x_ofs >> 2;
- const uint tile_block_ofs_y = layout.m_y_ofs >> 2;
-
- if (state.m_alpha_blocks)
- {
- uint block_values[cDXT5SelectorValues];
- dxt5_block::get_block_values(block_values, quantized_tile.m_first_endpoint, quantized_tile.m_second_endpoint);
-
- for (uint by = 0; by < tile_blocks_y; by++)
- {
- for (uint bx = 0; bx < tile_blocks_x; bx++)
- {
- #if 0
- uint best_index = selector_vq.find_best_codebook_entry_fs(training_vecs[comp_chunk_index][(tile_block_ofs_x+bx)+(tile_block_ofs_y+by)*2][chunk_index]);
- #else
- const dxt_pixel_block& block = m_pChunks[chunk_index].m_blocks[tile_block_ofs_y + by][tile_block_ofs_x + bx];
-
- uint best_error = UINT_MAX;
- uint best_index = 0;
-
- for (uint i = 0; i < state.m_selectors_cb.size(); i++)
- {
- const selectors& s = state.m_selectors_cb[i];
-
- uint total_error = 0;
-
- for (uint y = 0; y < cBlockPixelHeight; y++)
- {
- for (uint x = 0; x < cBlockPixelWidth; x++)
- {
- int a = block.m_pixels[y][x][alpha_pixel_comp];
- int b = block_values[s.m_selectors[y][x]];
- int error = a - b;
- error *= error;
-
- total_error += error;
- if (total_error > best_error)
- goto early_out;
- } // x
- } //y
-
- early_out:
- if (total_error < best_error)
- {
- best_error = total_error;
- best_index = i;
-
- if (best_error == 0)
- break;
- }
- } // i
- #endif
-
- CRNLIB_ASSERT( (tile_block_ofs_x + bx) < 2 );
- CRNLIB_ASSERT( (tile_block_ofs_y + by) < 2 );
-
- chunk.m_selector_cluster_index[tile_block_ofs_y + by][tile_block_ofs_x + bx] = static_cast<uint16>(best_index);
-
- {
- scoped_spinlock lock(state.m_chunk_blocks_using_selectors_lock);
- state.m_chunk_blocks_using_selectors[best_index].push_back( block_id(chunk_index, alpha_index, tile_index, tile_block_ofs_x + bx, tile_block_ofs_y + by ) );
- }
- // std::make_pair(chunk_index, (tile_index << 16) | ((tile_block_ofs_y + by) << 8) | (tile_block_ofs_x + bx) ) );
-
- } // bx
- } // by
-
- }
- else
- {
- color_quad_u8 block_colors[cDXT1SelectorValues];
- dxt1_block::get_block_colors4(block_colors, static_cast<uint16>(quantized_tile.m_first_endpoint), static_cast<uint16>(quantized_tile.m_second_endpoint));
-
- const bool block_with_alpha = quantized_tile.m_first_endpoint == quantized_tile.m_second_endpoint;
-
- for (uint by = 0; by < tile_blocks_y; by++)
- {
- for (uint bx = 0; bx < tile_blocks_x; bx++)
- {
- const dxt_pixel_block& block = m_pChunks[chunk_index].m_blocks[tile_block_ofs_y + by][tile_block_ofs_x + bx];
-
- uint best_error = UINT_MAX;
- uint best_index = 0;
-
- for (uint i = 0; i < state.m_selectors_cb.size(); i++)
- {
- const selectors& s = state.m_selectors_cb[i];
-
- uint total_error = 0;
-
- for (uint y = 0; y < cBlockPixelHeight; y++)
- {
- for (uint x = 0; x < cBlockPixelWidth; x++)
- {
- const color_quad_u8& a = block.m_pixels[y][x];
-
- uint selector_index = s.m_selectors[y][x];
- if ((block_with_alpha) && (selector_index == 3))
- total_error += 999999;
-
- const color_quad_u8& b = block_colors[selector_index];
-
- uint error = color::color_distance(m_params.m_perceptual, a, b, false);
-
- total_error += error;
- if (total_error > best_error)
- goto early_out2;
- } // x
- } //y
-
- early_out2:
- if (total_error < best_error)
- {
- best_error = total_error;
- best_index = i;
-
- if (best_error == 0)
- break;
- }
- } // i
-
- CRNLIB_ASSERT( (tile_block_ofs_x + bx) < 2 );
- CRNLIB_ASSERT( (tile_block_ofs_y + by) < 2 );
-
- chunk.m_selector_cluster_index[tile_block_ofs_y + by][tile_block_ofs_x + bx] = static_cast<uint16>(best_index);
-
- {
- scoped_spinlock lock(state.m_chunk_blocks_using_selectors_lock);
- state.m_chunk_blocks_using_selectors[best_index].push_back( block_id(chunk_index, 0, tile_index, tile_block_ofs_x + bx, tile_block_ofs_y + by ) );
- }
- // std::make_pair(chunk_index, (tile_index << 16) | ((tile_block_ofs_y + by) << 8) | (tile_block_ofs_x + bx) ) );
-
- } // bx
- } // by
-
- } // if alpha_blocks
-
- } // tile_index
-
- } // chunk_index
-
- } // comp_chunk_index
- }
-
- bool dxt_hc::create_selector_codebook(bool alpha_blocks)
- {
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Computing selector training vectors");
-#endif
-
- const uint cColorDistToWeight = 2000;
- const uint cAlphaErrorToWeight = 8;
-
- vec16F_tree_vq selector_vq;
-
- uint comp_index_start = cColorChunks;
- uint comp_index_end = cColorChunks;
- if (alpha_blocks)
- {
- comp_index_start = cAlpha0Chunks;
- comp_index_end = cAlpha0Chunks + m_num_alpha_blocks - 1;
- }
-
- crnlib::vector<vec16F> training_vecs[cNumCompressedChunkVecs][4];
-
- for (uint comp_chunk_index = comp_index_start; comp_chunk_index <= comp_index_end; comp_chunk_index++)
- {
- for (uint i = 0; i < 4; i++)
- training_vecs[comp_chunk_index][i].resize(m_num_chunks);
-
- for (uint chunk_index = 0; chunk_index < m_num_chunks; chunk_index++)
- {
- if ((chunk_index & 63) == 0)
- {
- if (!update_progress(9 + comp_chunk_index, chunk_index, m_num_chunks))
- return false;
- }
-
- const compressed_chunk& chunk = m_compressed_chunks[comp_chunk_index][chunk_index];
-
- uint8 block_selectors[cChunkBlockWidth][cChunkBlockHeight][cBlockPixelWidth * cBlockPixelHeight];
- uint block_weight[cChunkBlockWidth][cChunkBlockHeight];
-
- for (uint tile_index = 0; tile_index < chunk.m_num_tiles; tile_index++)
- {
- const compressed_tile& quantized_tile = chunk.m_quantized_tiles[tile_index];
-
- uint weight;
- if (comp_chunk_index == cColorChunks)
- {
- const color_quad_u8 first_color(dxt1_block::unpack_color(static_cast<uint16>(quantized_tile.m_first_endpoint), true));
- const color_quad_u8 second_color(dxt1_block::unpack_color(static_cast<uint16>(quantized_tile.m_second_endpoint), true));
- const uint dist = color::color_distance(m_params.m_perceptual, first_color, second_color, false);
-
- weight = dist / cColorDistToWeight;
-
- weight = static_cast<uint>(weight * m_pChunks[chunk_index].m_weight);
- }
- else
- {
- int first_endpoint = quantized_tile.m_first_endpoint;
- int second_endpoint = quantized_tile.m_second_endpoint;
- int error = first_endpoint - second_endpoint;
- error = error * error;
-
- weight = static_cast<uint>(error / cAlphaErrorToWeight);
- }
-
- const uint cMaxWeight = 2048;
-
- weight = math::clamp<uint>(weight, 1U, cMaxWeight);
-
- // umm, this is a hack
- float f = math::lerp(1.15f, 1.0f, chunk.m_encoding_index / float(cNumChunkEncodings - 1));
- weight = (uint)(weight * f);
-
- const chunk_tile_desc& layout = g_chunk_tile_layouts[quantized_tile.m_layout_index];
-
- for (uint y = 0; y < (layout.m_height >> 2); y++)
- for (uint x = 0; x < (layout.m_width >> 2); x++)
- block_weight[x + (layout.m_x_ofs >> 2)][y + (layout.m_y_ofs >> 2)] = weight;
-
- const uint8* pSelectors = quantized_tile.m_selectors;
-
- for (uint y = 0; y < layout.m_height; y++)
- {
- const uint cy = y + layout.m_y_ofs;
-
- for (uint x = 0; x < layout.m_width; x++)
- {
- const uint selector = pSelectors[x + y * layout.m_width];
-
- if (comp_chunk_index == cColorChunks)
- CRNLIB_ASSERT(selector < cDXT1SelectorValues);
- else
- CRNLIB_ASSERT(selector < cDXT5SelectorValues);
-
- const uint cx = x + layout.m_x_ofs;
-
- block_selectors[cx >> 2][cy >> 2][(cx & 3) + (cy & 3) * 4] = static_cast<uint8>(selector);
- } // x
- } // y
- } // tile_index
-
- vec16F v;
- for (uint y = 0; y < cChunkBlockHeight; y++)
- {
- for (uint x = 0; x < cChunkBlockWidth; x++)
- {
- for (uint i = 0; i < cBlockPixelWidth * cBlockPixelHeight; i++)
- {
- uint s = block_selectors[x][y][i];
-
- float f;
-
- if (comp_chunk_index == cColorChunks)
- {
- CRNLIB_ASSERT(s < cDXT1SelectorValues);
- f = (g_dxt1_to_linear[s] + .5f) * 1.0f/4.0f;
- }
- else
- {
- CRNLIB_ASSERT(s < cDXT5SelectorValues);
- f = (g_dxt5_to_linear[s] + .5f) * 1.0f/8.0f;
- }
-
- CRNLIB_ASSERT((f >= 0.0f) && (f <= 1.0f));
-
- v[i] = f;
- } // i
-
- selector_vq.add_training_vec(v, block_weight[x][y]);
-
- training_vecs[comp_chunk_index][x+y*2][chunk_index] = v;
- } // x
- } // y
-
- } // chunk_index
-
- } // comp_chunk_index
-
- timer t;
- t.start();
-
- selector_vq.generate_codebook(alpha_blocks ? m_params.m_alpha_selector_codebook_size : m_params.m_color_selector_codebook_size);
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- {
- double total_time = t.get_elapsed_secs();
- console::info("Codebook gen time: %3.3fs, Selector codebook size: %u", total_time, selector_vq.get_codebook_size());
- }
-#endif
-
- selectors_vec& selectors_cb = alpha_blocks ? m_alpha_selectors : m_color_selectors;
-
- selectors_cb.resize(selector_vq.get_codebook_size());
-
- for (uint i = 0; i < selector_vq.get_codebook_size(); i++)
- {
- const vec16F& v = selector_vq.get_codebook_entry(i);
-
- for (uint j = 0; j < cBlockPixelWidth * cBlockPixelHeight; j++)
- {
- int s;
- if (alpha_blocks)
- {
- s = math::clamp<int>(static_cast<int>(v[j] * 8.0f), 0, 7);
- s = g_dxt5_from_linear[s];
- }
- else
- {
- s = math::clamp<int>(static_cast<int>(v[j] * 4.0f), 0, 3);
- s = g_dxt1_from_linear[s];
- }
-
- selectors_cb[i].m_selectors[j >> 2][j & 3] = static_cast<uint8>(s);
- } // j
- } // i
-
- chunk_blocks_using_selectors_vec& chunk_blocks_using_selectors = alpha_blocks ? m_chunk_blocks_using_alpha_selectors : m_chunk_blocks_using_color_selectors;
-
- chunk_blocks_using_selectors.clear();
- chunk_blocks_using_selectors.resize(selectors_cb.size());
-
- create_selector_codebook_state state(*this, alpha_blocks, comp_index_start, comp_index_end, selector_vq, chunk_blocks_using_selectors, selectors_cb);
-
- for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
- m_pTask_pool->queue_object_task(this, &dxt_hc::create_selector_codebook_task, i, &state);
-
- m_pTask_pool->join();
-
- return !m_canceled;
- }
-
- bool dxt_hc::refine_quantized_color_selectors()
- {
- if (!m_has_color_blocks)
- return true;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Refining quantized color selectors");
-#endif
-
- uint total_refined_selectors = 0;
- uint total_refined_pixels = 0;
- uint total_selectors = 0;
-
- for (uint selector_index = 0; selector_index < m_color_selectors.size(); selector_index++)
- {
- if ((selector_index & 255) == 0)
- {
- if (!update_progress(15, selector_index, m_color_selectors.size()))
- return false;
- }
-
- if (m_chunk_blocks_using_color_selectors[selector_index].empty())
- continue;
-
- selectors& sel = m_color_selectors[selector_index];
-
- for (uint y = 0; y < cBlockPixelHeight; y++)
- {
- for (uint x = 0; x < cBlockPixelWidth; x++)
- {
- uint best_s = 0;
- uint best_error = UINT_MAX;
-
- for (uint s = 0; s < cDXT1SelectorValues; s++)
- {
- uint total_error = 0;
-
- for (uint block_iter = 0; block_iter < m_chunk_blocks_using_color_selectors[selector_index].size(); block_iter++)
- {
- const block_id& id = m_chunk_blocks_using_color_selectors[selector_index][block_iter];
- const uint chunk_index = id.m_chunk_index;
- const uint tile_index = id.m_tile_index;
- const uint chunk_block_x = id.m_block_x;
- const uint chunk_block_y = id.m_block_y;
-
- CRNLIB_ASSERT((chunk_block_x < cChunkBlockWidth) && (chunk_block_y < cChunkBlockHeight));
-
- const compressed_chunk& chunk = m_compressed_chunks[cColorChunks][chunk_index];
- CRNLIB_ASSERT(tile_index < chunk.m_num_tiles);
-
- CRNLIB_ASSERT(chunk.m_selector_cluster_index[chunk_block_y][chunk_block_x] == selector_index);
-
- const compressed_tile& tile = chunk.m_quantized_tiles[tile_index];
-
- //const chunk_tile_desc& tile_desc = g_chunk_tile_layouts[tile.m_layout_index];
-
- color_quad_u8 block_colors[cDXT1SelectorValues];
- CRNLIB_ASSERT(tile.m_first_endpoint >= tile.m_second_endpoint);
- dxt1_block::get_block_colors4(block_colors, static_cast<uint16>(tile.m_first_endpoint), static_cast<uint16>(tile.m_second_endpoint));
-
- if ((tile.m_first_endpoint == tile.m_second_endpoint) && (s == 3))
- total_error += 999999;
-
- const color_quad_u8& orig_pixel = m_pChunks[chunk_index](chunk_block_x * cBlockPixelWidth + x, chunk_block_y * cBlockPixelHeight + y);
- const color_quad_u8& quantized_pixel = block_colors[s];
-
- const uint error = color::color_distance(m_params.m_perceptual, orig_pixel, quantized_pixel, false);
- total_error += error;
-
- } // block_iter
-
- if (total_error < best_error)
- {
- best_error = total_error;
- best_s = s;
- }
-
- } // s
-
- if (sel.m_selectors[y][x] != best_s)
- {
- total_refined_selectors++;
- total_refined_pixels += m_chunk_blocks_using_color_selectors[selector_index].size();
- sel.m_selectors[y][x] = static_cast<uint8>(best_s);
- }
-
- total_selectors++;
-
- } //x
-
- } //y
-
- } // selector_index
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Total refined pixels: %u, selectors: %u out of %u", total_refined_pixels, total_refined_selectors, total_selectors);
-#endif
-
- return true;
- }
-
- bool dxt_hc::refine_quantized_alpha_selectors()
- {
- if (!m_num_alpha_blocks)
- return true;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Refining quantized alpha selectors");
-#endif
-
- uint total_refined_selectors = 0;
- uint total_refined_pixels = 0;
- uint total_selectors = 0;
-
- for (uint selector_index = 0; selector_index < m_alpha_selectors.size(); selector_index++)
- {
- if ((selector_index & 255) == 0)
- {
- if (!update_progress(16, selector_index, m_alpha_selectors.size()))
- return false;
- }
-
- if (m_chunk_blocks_using_alpha_selectors[selector_index].empty())
- continue;
-
- selectors& sel = m_alpha_selectors[selector_index];
-
- for (uint y = 0; y < cBlockPixelHeight; y++)
- {
- for (uint x = 0; x < cBlockPixelWidth; x++)
- {
- uint best_s = 0;
- uint best_error = UINT_MAX;
-
- for (uint s = 0; s < cDXT5SelectorValues; s++)
- {
- uint total_error = 0;
-
- for (uint block_iter = 0; block_iter < m_chunk_blocks_using_alpha_selectors[selector_index].size(); block_iter++)
- {
- const block_id& id = m_chunk_blocks_using_alpha_selectors[selector_index][block_iter];
- const uint chunk_index = id.m_chunk_index;
- const uint tile_index = id.m_tile_index;
- const uint chunk_block_x = id.m_block_x;
- const uint chunk_block_y = id.m_block_y;
- const uint alpha_index = id.m_alpha_index;
- CRNLIB_ASSERT(alpha_index < m_num_alpha_blocks);
-
- CRNLIB_ASSERT((chunk_block_x < cChunkBlockWidth) && (chunk_block_y < cChunkBlockHeight));
-
- const compressed_chunk& chunk = m_compressed_chunks[alpha_index + cAlpha0Chunks][chunk_index];
- CRNLIB_ASSERT(tile_index < chunk.m_num_tiles);
-
- CRNLIB_ASSERT(chunk.m_selector_cluster_index[chunk_block_y][chunk_block_x] == selector_index);
-
- const compressed_tile& tile = chunk.m_quantized_tiles[tile_index];
-
- //const chunk_tile_desc& tile_desc = g_chunk_tile_layouts[tile.m_layout_index];
-
- uint block_values[cDXT5SelectorValues];
- CRNLIB_ASSERT(tile.m_first_endpoint >= tile.m_second_endpoint);
- dxt5_block::get_block_values(block_values, tile.m_first_endpoint, tile.m_second_endpoint);
-
- int orig_value = m_pChunks[chunk_index](chunk_block_x * cBlockPixelWidth + x, chunk_block_y * cBlockPixelHeight + y)[m_params.m_alpha_component_indices[alpha_index]];
- int quantized_value = block_values[s];
-
- int error = (orig_value - quantized_value);
- error *= error;
-
- total_error += error;
-
- } // block_iter
-
- if (total_error < best_error)
- {
- best_error = total_error;
- best_s = s;
- }
-
- } // s
-
- if (sel.m_selectors[y][x] != best_s)
- {
- total_refined_selectors++;
- total_refined_pixels += m_chunk_blocks_using_alpha_selectors[selector_index].size();
- sel.m_selectors[y][x] = static_cast<uint8>(best_s);
- }
-
- total_selectors++;
-
- } //x
-
- } //y
-
- } // selector_index
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Total refined pixels: %u, selectors: %u out of %u", total_refined_pixels, total_refined_selectors, total_selectors);
-#endif
-
- return true;
- }
-
- bool dxt_hc::refine_quantized_color_endpoints()
- {
- if (!m_has_color_blocks)
- return true;
-
- uint total_refined_tiles = 0;
- uint total_refined_pixels = 0;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Refining quantized color endpoints");
-#endif
-
- for (uint cluster_index = 0; cluster_index < m_color_clusters.size(); cluster_index++)
- {
- if ((cluster_index & 255) == 0)
- {
- if (!update_progress(17, cluster_index, m_color_clusters.size()))
- return false;
- }
-
- tile_cluster& cluster = m_color_clusters[cluster_index];
-
- uint total_pixels = 0;
- for (uint tile_iter = 0; tile_iter < cluster.m_tiles.size(); tile_iter++)
- {
- const uint chunk_index = cluster.m_tiles[tile_iter].first;
- const uint tile_index = cluster.m_tiles[tile_iter].second;
-
- compressed_chunk& chunk = m_compressed_chunks[cColorChunks][chunk_index];
- compressed_tile& tile = chunk.m_quantized_tiles[tile_index];
-
- CRNLIB_ASSERT(tile.m_first_endpoint == cluster.m_first_endpoint);
- CRNLIB_ASSERT(tile.m_second_endpoint == cluster.m_second_endpoint);
-
- total_pixels += (tile.m_pixel_width * tile.m_pixel_height);
- }
-
- if (!total_pixels)
- continue;
-
- crnlib::vector<color_quad_u8> pixels;
- crnlib::vector<uint8> selectors;
-
- pixels.reserve(total_pixels);
- selectors.reserve(total_pixels);
-
- for (uint tile_iter = 0; tile_iter < cluster.m_tiles.size(); tile_iter++)
- {
- const uint chunk_index = cluster.m_tiles[tile_iter].first;
- const uint tile_index = cluster.m_tiles[tile_iter].second;
-
- compressed_chunk& chunk = m_compressed_chunks[cColorChunks][chunk_index];
- compressed_tile& tile = chunk.m_quantized_tiles[tile_index];
-
- const pixel_chunk& src_pixels = m_pChunks[chunk_index];
-
- CRNLIB_ASSERT(tile.m_first_endpoint == cluster.m_first_endpoint);
- CRNLIB_ASSERT(tile.m_second_endpoint == cluster.m_second_endpoint);
-
- const chunk_tile_desc& tile_layout = g_chunk_tile_layouts[tile.m_layout_index];
-
- for (uint y = 0; y < tile.m_pixel_height; y++)
- {
- for (uint x = 0; x < tile.m_pixel_width; x++)
- {
- selectors.push_back(tile.m_selectors[x + y * tile.m_pixel_width]);
-
- pixels.push_back(src_pixels(x + tile_layout.m_x_ofs, y + tile_layout.m_y_ofs));
- }
- }
- }
-
- dxt_endpoint_refiner refiner;
- dxt_endpoint_refiner::params p;
- dxt_endpoint_refiner::results r;
-
- p.m_perceptual = m_params.m_perceptual;
- p.m_pSelectors = &selectors[0];
- p.m_pPixels = &pixels[0];
- p.m_num_pixels = total_pixels;
- p.m_dxt1_selectors = true;
- p.m_error_to_beat = cluster.m_error;
- p.m_block_index = cluster_index;
-
- if (!refiner.refine(p, r))
- continue;
-
- total_refined_tiles++;
- total_refined_pixels += total_pixels;
-
- cluster.m_error = r.m_error;
-
- cluster.m_first_endpoint = r.m_low_color;
- cluster.m_second_endpoint = r.m_high_color;
-
- for (uint tile_iter = 0; tile_iter < cluster.m_tiles.size(); tile_iter++)
- {
- const uint chunk_index = cluster.m_tiles[tile_iter].first;
- const uint tile_index = cluster.m_tiles[tile_iter].second;
-
- compressed_chunk& chunk = m_compressed_chunks[cColorChunks][chunk_index];
- compressed_tile& tile = chunk.m_quantized_tiles[tile_index];
-
- tile.m_first_endpoint = r.m_low_color;
- tile.m_second_endpoint = r.m_high_color;
- }
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Total refined pixels: %u, endpoints: %u out of %u", total_refined_pixels, total_refined_tiles, m_color_clusters.size());
-#endif
-
- return true;
- }
-
- bool dxt_hc::refine_quantized_alpha_endpoints()
- {
- if (!m_num_alpha_blocks)
- return true;
-
- uint total_refined_tiles = 0;
- uint total_refined_pixels = 0;
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Refining quantized alpha endpoints");
-#endif
-
- for (uint cluster_index = 0; cluster_index < m_alpha_clusters.size(); cluster_index++)
- {
- if ((cluster_index & 255) == 0)
- {
- if (!update_progress(18, cluster_index, m_alpha_clusters.size()))
- return false;
- }
-
- tile_cluster& cluster = m_alpha_clusters[cluster_index];
-
- uint total_pixels = 0;
- for (uint tile_iter = 0; tile_iter < cluster.m_tiles.size(); tile_iter++)
- {
- const uint chunk_index = cluster.m_tiles[tile_iter].first;
- const uint tile_index = cluster.m_tiles[tile_iter].second & 0xFFFFU;
- const uint alpha_index = cluster.m_tiles[tile_iter].second >> 16U;
-
- compressed_chunk& chunk = m_compressed_chunks[cAlpha0Chunks + alpha_index][chunk_index];
- compressed_tile& tile = chunk.m_quantized_tiles[tile_index];
-
- CRNLIB_ASSERT(tile.m_first_endpoint == cluster.m_first_endpoint);
- CRNLIB_ASSERT(tile.m_second_endpoint == cluster.m_second_endpoint);
-
- total_pixels += (tile.m_pixel_width * tile.m_pixel_height);
- }
-
- if (!total_pixels)
- continue;
-
- crnlib::vector<color_quad_u8> pixels;
- crnlib::vector<uint8> selectors;
-
- pixels.reserve(total_pixels);
- selectors.reserve(total_pixels);
-
- for (uint tile_iter = 0; tile_iter < cluster.m_tiles.size(); tile_iter++)
- {
- const uint chunk_index = cluster.m_tiles[tile_iter].first;
- const uint tile_index = cluster.m_tiles[tile_iter].second & 0xFFFFU;
- const uint alpha_index = cluster.m_tiles[tile_iter].second >> 16U;
-
- compressed_chunk& chunk = m_compressed_chunks[cAlpha0Chunks + alpha_index][chunk_index];
- compressed_tile& tile = chunk.m_quantized_tiles[tile_index];
-
- const pixel_chunk& src_pixels = m_pChunks[chunk_index];
-
- CRNLIB_ASSERT(tile.m_first_endpoint == cluster.m_first_endpoint);
- CRNLIB_ASSERT(tile.m_second_endpoint == cluster.m_second_endpoint);
-
- const chunk_tile_desc& tile_layout = g_chunk_tile_layouts[tile.m_layout_index];
-
- for (uint y = 0; y < tile.m_pixel_height; y++)
- {
- for (uint x = 0; x < tile.m_pixel_width; x++)
- {
- selectors.push_back(tile.m_selectors[x + y * tile.m_pixel_width]);
-
- pixels.push_back(color_quad_u8(src_pixels(x + tile_layout.m_x_ofs, y + tile_layout.m_y_ofs)[m_params.m_alpha_component_indices[alpha_index]]));
- }
- }
- }
-
- dxt_endpoint_refiner refiner;
- dxt_endpoint_refiner::params p;
- dxt_endpoint_refiner::results r;
-
- p.m_perceptual = m_params.m_perceptual;
- p.m_pSelectors = &selectors[0];
- p.m_pPixels = &pixels[0];
- p.m_num_pixels = total_pixels;
- p.m_dxt1_selectors = false;
- p.m_error_to_beat = cluster.m_error;
- p.m_block_index = cluster_index;
-
- if (!refiner.refine(p, r))
- continue;
-
- total_refined_tiles++;
- total_refined_pixels += total_pixels;
-
- cluster.m_error = r.m_error;
-
- cluster.m_first_endpoint = r.m_low_color;
- cluster.m_second_endpoint = r.m_high_color;
-
- for (uint tile_iter = 0; tile_iter < cluster.m_tiles.size(); tile_iter++)
- {
- const uint chunk_index = cluster.m_tiles[tile_iter].first;
- const uint tile_index = cluster.m_tiles[tile_iter].second & 0xFFFFU;
- const uint alpha_index = cluster.m_tiles[tile_iter].second >> 16U;
-
- compressed_chunk& chunk = m_compressed_chunks[cAlpha0Chunks + alpha_index][chunk_index];
- compressed_tile& tile = chunk.m_quantized_tiles[tile_index];
-
- tile.m_first_endpoint = r.m_low_color;
- tile.m_second_endpoint = r.m_high_color;
- }
- }
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- console::info("Total refined pixels: %u, endpoints: %u out of %u", total_refined_pixels, total_refined_tiles, m_alpha_clusters.size());
-#endif
-
- return true;
- }
-
- void dxt_hc::create_final_debug_image()
- {
- if (!m_params.m_debugging)
- return;
-
- m_dbg_chunk_pixels_final.resize(m_num_chunks);
- for (uint i = 0; i < m_num_chunks; i++)
- m_dbg_chunk_pixels_final[i].clear();
-
- if (m_has_color_blocks)
- {
- m_dbg_chunk_pixels_final_color_selectors.resize(m_num_chunks);
- for (uint i = 0; i < m_num_chunks; i++)
- m_dbg_chunk_pixels_final_color_selectors[i].clear();
- }
-
- if (m_num_alpha_blocks)
- {
- m_dbg_chunk_pixels_final_alpha_selectors.resize(m_num_chunks);
- for (uint i = 0; i < m_num_chunks; i++)
- m_dbg_chunk_pixels_final_alpha_selectors[i].clear();
- }
-
- for (uint chunk_index = 0; chunk_index < m_num_chunks; chunk_index++)
- {
- pixel_chunk& output_chunk_final = m_dbg_chunk_pixels_final[chunk_index];
-
- if (m_has_color_blocks)
- {
- const compressed_chunk& chunk = m_compressed_chunks[cColorChunks][chunk_index];
-
- pixel_chunk& output_chunk_quantized_color_selectors = m_dbg_chunk_pixels_final_color_selectors[chunk_index];
-
- for (uint tile_index = 0; tile_index < chunk.m_num_tiles; tile_index++)
- {
- const compressed_tile& quantized_tile = chunk.m_quantized_tiles[tile_index];
-
- const chunk_tile_desc& layout = g_chunk_tile_layouts[quantized_tile.m_layout_index];
-
- color_quad_u8 block_colors[cDXT1SelectorValues];
- dxt1_block::get_block_colors(block_colors, static_cast<uint16>(quantized_tile.m_first_endpoint), static_cast<uint16>(quantized_tile.m_second_endpoint));
-
- for (uint y = 0; y < layout.m_height; y++)
- {
- for (uint x = 0; x < layout.m_width; x++)
- {
- const uint chunk_x_ofs = x + layout.m_x_ofs;
- const uint chunk_y_ofs = y + layout.m_y_ofs;
- const uint block_x = chunk_x_ofs >> 2;
- const uint block_y = chunk_y_ofs >> 2;
- const selectors& s = m_color_selectors[chunk.m_selector_cluster_index[block_y][block_x]];
-
- uint selector = s.m_selectors[chunk_y_ofs & 3][chunk_x_ofs & 3];
-
- output_chunk_final(x + layout.m_x_ofs, y + layout.m_y_ofs) = block_colors[selector];
- output_chunk_quantized_color_selectors(x + layout.m_x_ofs, y + layout.m_y_ofs) = g_tile_layout_colors[selector];
- }
- }
- }
- }
-
- if (m_num_alpha_blocks)
- {
- pixel_chunk& output_chunk_quantized_alpha_selectors = m_dbg_chunk_pixels_final_alpha_selectors[chunk_index];
-
- for (uint a = 0; a < m_num_alpha_blocks; a++)
- {
- const compressed_chunk& chunk = m_compressed_chunks[cAlpha0Chunks + a][chunk_index];
-
- for (uint tile_index = 0; tile_index < chunk.m_num_tiles; tile_index++)
- {
- const compressed_tile& quantized_tile = chunk.m_quantized_tiles[tile_index];
-
- const chunk_tile_desc& layout = g_chunk_tile_layouts[quantized_tile.m_layout_index];
-
- uint block_values[cDXT5SelectorValues];
-
- // purposely call the general version to debug single color alpah6 blocks
- CRNLIB_ASSERT(quantized_tile.m_first_endpoint >= quantized_tile.m_second_endpoint);
- dxt5_block::get_block_values(block_values, quantized_tile.m_first_endpoint, quantized_tile.m_second_endpoint);
-
- for (uint y = 0; y < layout.m_height; y++)
- {
- for (uint x = 0; x < layout.m_width; x++)
- {
- const uint chunk_x_ofs = x + layout.m_x_ofs;
- const uint chunk_y_ofs = y + layout.m_y_ofs;
- const uint block_x = chunk_x_ofs >> 2;
- const uint block_y = chunk_y_ofs >> 2;
- const selectors& s = m_alpha_selectors[chunk.m_selector_cluster_index[block_y][block_x]];
-
- uint selector = s.m_selectors[chunk_y_ofs & 3][chunk_x_ofs & 3];
-
- CRNLIB_ASSERT(selector < cDXT5SelectorValues);
-
- output_chunk_final(x + layout.m_x_ofs, y + layout.m_y_ofs)[m_params.m_alpha_component_indices[a]] = static_cast<uint8>(block_values[selector]);
-
- output_chunk_quantized_alpha_selectors(x + layout.m_x_ofs, y + layout.m_y_ofs)[m_params.m_alpha_component_indices[a]] = static_cast<uint8>(selector*255/(cDXT5SelectorValues-1));
- } //x
- } // y
- } // tile_index
-
- } // a
- }
- } // chunk_index
-
- }
-
- bool dxt_hc::create_chunk_encodings()
- {
- m_chunk_encoding.resize(m_num_chunks);
-
- for (uint chunk_index = 0; chunk_index < m_num_chunks; chunk_index++)
- {
- if ((chunk_index & 255) == 0)
- {
- if (!update_progress(19, chunk_index, m_num_chunks))
- return false;
- }
-
- chunk_encoding& encoding = m_chunk_encoding[chunk_index];
-
- for (uint q = 0; q < cNumCompressedChunkVecs; q++)
- {
- bool skip = true;
- if (q == cColorChunks)
- {
- if (m_has_color_blocks)
- skip = false;
- }
- else if (q <= m_num_alpha_blocks)
- skip = false;
-
- if (skip)
- continue;
-
- CRNLIB_ASSERT(!m_compressed_chunks[q].empty());
- const compressed_chunk& chunk = m_compressed_chunks[q][chunk_index];
-
- CRNLIB_ASSERT(chunk.m_encoding_index < cNumChunkEncodings);
- encoding.m_encoding_index = static_cast<uint8>(chunk.m_encoding_index);
-
- CRNLIB_ASSERT(chunk.m_num_tiles <= cChunkMaxTiles);
- encoding.m_num_tiles = static_cast<uint8>(chunk.m_num_tiles);
-
- for (uint tile_index = 0; tile_index < chunk.m_num_tiles; tile_index++)
- {
- const compressed_tile& quantized_tile = chunk.m_quantized_tiles[tile_index];
-
- if (!q)
- {
- CRNLIB_ASSERT(quantized_tile.m_endpoint_cluster_index < m_color_clusters.size());
- }
- else
- {
- CRNLIB_ASSERT(quantized_tile.m_endpoint_cluster_index < m_alpha_clusters.size());
- }
-
- encoding.m_endpoint_indices[q][tile_index] = static_cast<uint16>(quantized_tile.m_endpoint_cluster_index);
- }
-
- for (uint y = 0; y < cChunkBlockHeight; y++)
- {
- for (uint x = 0; x < cChunkBlockWidth; x++)
- {
- const uint selector_index = chunk.m_selector_cluster_index[y][x];
-
- if (!q)
- {
- CRNLIB_ASSERT(selector_index < m_color_selectors.size());
- }
- else
- {
- CRNLIB_ASSERT(selector_index < m_alpha_selectors.size());
- }
-
- encoding.m_selector_indices[q][y][x] = static_cast<uint16>(selector_index);
- }
- }
-
- } // q
-
- } // chunk_index
-
- if (m_has_color_blocks)
- {
- m_color_endpoints.resize(m_color_clusters.size());
- for (uint i = 0; i < m_color_clusters.size(); i++)
- m_color_endpoints[i] = dxt1_block::pack_endpoints(m_color_clusters[i].m_first_endpoint, m_color_clusters[i].m_second_endpoint);
- }
-
- if (m_num_alpha_blocks)
- {
- m_alpha_endpoints.resize(m_alpha_clusters.size());
- for (uint i = 0; i < m_alpha_clusters.size(); i++)
- m_alpha_endpoints[i] = dxt5_block::pack_endpoints(m_alpha_clusters[i].m_first_endpoint, m_alpha_clusters[i].m_second_endpoint);
- }
-
- return true;
- }
-
- void dxt_hc::create_debug_image_from_chunks(uint num_chunks_x, uint num_chunks_y, const pixel_chunk_vec& chunks, const chunk_encoding_vec *pChunk_encodings, image_u8& img, bool serpentine_scan, int comp_index)
- {
- if (chunks.empty())
- {
- img.set_all(color_quad_u8::make_black());
- return;
- }
-
- img.resize(num_chunks_x * cChunkPixelWidth, num_chunks_y * cChunkPixelHeight);
-
- for (uint y = 0; y < num_chunks_y; y++)
- {
- for (uint x = 0; x < num_chunks_x; x++)
- {
- uint c = x + y * num_chunks_x;
- if ((serpentine_scan) && (y & 1))
- c = (num_chunks_x - 1 - x) + y * num_chunks_x;
-
- if (comp_index >= 0)
- {
- for (uint cy = 0; cy < cChunkPixelHeight; cy++)
- for (uint cx = 0; cx < cChunkPixelWidth; cx++)
- img(x * cChunkPixelWidth + cx, y * cChunkPixelHeight + cy) = chunks[c](cx, cy)[comp_index];
- }
- else
- {
- for (uint cy = 0; cy < cChunkPixelHeight; cy++)
- for (uint cx = 0; cx < cChunkPixelWidth; cx++)
- img(x * cChunkPixelWidth + cx, y * cChunkPixelHeight + cy) = chunks[c](cx, cy);
- }
-
- if (pChunk_encodings)
- {
- const chunk_encoding& chunk = (*pChunk_encodings)[c];
- const chunk_encoding_desc &encoding_desc = g_chunk_encodings[chunk.m_encoding_index];
- CRNLIB_ASSERT(chunk.m_num_tiles == encoding_desc.m_num_tiles);
- for (uint t = 0; t < chunk.m_num_tiles; t++)
- {
- const chunk_tile_desc &tile_desc = encoding_desc.m_tiles[t];
-
- img.unclipped_fill_box(
- x*8 + tile_desc.m_x_ofs, y*8 + tile_desc.m_y_ofs,
- tile_desc.m_width + 1, tile_desc.m_height + 1, color_quad_u8(128, 128, 128, 255));
- }
- }
- }
- }
- }
-
- bool dxt_hc::update_progress(uint phase_index, uint subphase_index, uint subphase_total)
- {
- CRNLIB_ASSERT(crn_get_current_thread_id() == m_main_thread_id);
-
- if (!m_params.m_pProgress_func)
- return true;
-
-#if CRNLIB_ENABLE_DEBUG_MESSAGES
- if (m_params.m_debugging)
- return true;
-#endif
-
- const int percentage_complete = (subphase_total > 1) ? ((100 * subphase_index) / (subphase_total - 1)) : 100;
- if (((int)phase_index == m_prev_phase_index) && (m_prev_percentage_complete == percentage_complete))
- return !m_canceled;
-
- m_prev_percentage_complete = percentage_complete;
-
- bool status = (*m_params.m_pProgress_func)(phase_index, cTotalCompressionPhases, subphase_index, subphase_total, m_params.m_pProgress_func_data) != 0;
- if (!status)
- {
- m_canceled = true;
- return false;
- }
-
- return true;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc.h b/Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc.h
deleted file mode 100644
index a421a4b1..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc.h
+++ /dev/null
@@ -1,439 +0,0 @@
-// File: crn_dxt_hc.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_dxt1.h"
-#include "crn_dxt5a.h"
-#include "crn_dxt_endpoint_refiner.h"
-#include "crn_image.h"
-#include "crn_dxt.h"
-#include "crn_image.h"
-#include "crn_dxt_hc_common.h"
-#include "crn_tree_clusterizer.h"
-#include "crn_threading.h"
-
-#define CRN_NO_FUNCTION_DEFINITIONS
-#include "../inc/crnlib.h"
-
-namespace crnlib
-{
- const uint cTotalCompressionPhases = 25;
-
- class dxt_hc
- {
- public:
- dxt_hc();
- ~dxt_hc();
-
- struct pixel_chunk
- {
- pixel_chunk() { clear(); }
-
- dxt_pixel_block m_blocks[cChunkBlockHeight][cChunkBlockWidth];
-
- const color_quad_u8& operator() (uint cx, uint cy) const
- {
- CRNLIB_ASSERT((cx < cChunkPixelWidth) && (cy < cChunkPixelHeight));
-
- return m_blocks[cy >> cBlockPixelHeightShift][cx >> cBlockPixelWidthShift].m_pixels
- [cy & (cBlockPixelHeight - 1)][cx & (cBlockPixelWidth - 1)];
- }
-
- color_quad_u8& operator() (uint cx, uint cy)
- {
- CRNLIB_ASSERT((cx < cChunkPixelWidth) && (cy < cChunkPixelHeight));
-
- return m_blocks[cy >> cBlockPixelHeightShift][cx >> cBlockPixelWidthShift].m_pixels
- [cy & (cBlockPixelHeight - 1)][cx & (cBlockPixelWidth - 1)];
- }
-
- inline void clear()
- {
- utils::zero_object(*this);
- m_weight = 1.0f;
- }
-
- float m_weight;
- };
-
- typedef crnlib::vector<pixel_chunk> pixel_chunk_vec;
-
- struct params
- {
- params() :
- m_color_endpoint_codebook_size(3072),
- m_color_selector_codebook_size(3072),
- m_alpha_endpoint_codebook_size(3072),
- m_alpha_selector_codebook_size(3072),
- m_adaptive_tile_color_psnr_derating(2.0f), // was 3.4f
- m_adaptive_tile_alpha_psnr_derating(2.0f),
- m_adaptive_tile_color_alpha_weighting_ratio(3.0f),
- m_num_levels(0),
- m_format(cDXT1),
- m_hierarchical(true),
- m_perceptual(true),
- m_debugging(false),
- m_pProgress_func(NULL),
- m_pProgress_func_data(NULL)
- {
- m_alpha_component_indices[0] = 3;
- m_alpha_component_indices[1] = 0;
-
- for (uint i = 0; i < cCRNMaxLevels; i++)
- {
- m_levels[i].m_first_chunk = 0;
- m_levels[i].m_num_chunks = 0;
- }
- }
-
- // Valid range for codebook sizes: [32,8192] (non-power of two values are okay)
- uint m_color_endpoint_codebook_size;
- uint m_color_selector_codebook_size;
-
- uint m_alpha_endpoint_codebook_size;
- uint m_alpha_selector_codebook_size;
-
- // Higher values cause fewer 8x4, 4x8, and 4x4 blocks to be utilized less often (lower quality/smaller files).
- // Lower values cause the encoder to use large tiles less often (better quality/larger files).
- // Valid range: [0.0,100.0].
- // A value of 0 will cause the encoder to only use tiles larger than 4x4 if doing so would incur to quality loss.
- float m_adaptive_tile_color_psnr_derating;
-
- float m_adaptive_tile_alpha_psnr_derating;
-
- float m_adaptive_tile_color_alpha_weighting_ratio;
-
- uint m_alpha_component_indices[2];
-
- struct miplevel_desc
- {
- uint m_first_chunk;
- uint m_num_chunks;
- };
- // The mip level data is optional!
- miplevel_desc m_levels[cCRNMaxLevels];
- uint m_num_levels;
-
- dxt_format m_format;
-
- // If m_hierarchical is false, only 4x4 blocks will be used by the encoder (leading to higher quality/larger files).
- bool m_hierarchical;
-
- // If m_perceptual is true, perceptual color metrics will be used by the encoder.
- bool m_perceptual;
-
- bool m_debugging;
-
- crn_progress_callback_func m_pProgress_func;
- void* m_pProgress_func_data;
- };
-
- void clear();
-
- // Main compression function
- bool compress(const params& p, uint num_chunks, const pixel_chunk* pChunks, task_pool& task_pool);
-
- // Output accessors
- inline uint get_num_chunks() const { return m_num_chunks; }
-
- struct chunk_encoding
- {
- chunk_encoding() { utils::zero_object(*this); };
-
- // Index into g_chunk_encodings.
- uint8 m_encoding_index;
-
- // Number of tiles, endpoint indices.
- uint8 m_num_tiles;
-
- // Color, alpha0, alpha1
- enum { cColorIndex = 0, cAlpha0Index = 1, cAlpha1Index = 2 };
- uint16 m_endpoint_indices[3][cChunkMaxTiles];
- uint16 m_selector_indices[3][cChunkBlockHeight][cChunkBlockWidth]; // [block_y][block_x]
- };
-
- typedef crnlib::vector<chunk_encoding> chunk_encoding_vec;
-
- inline const chunk_encoding& get_chunk_encoding(uint chunk_index) const { return m_chunk_encoding[chunk_index]; }
- inline const chunk_encoding_vec& get_chunk_encoding_vec() const { return m_chunk_encoding; }
-
- struct selectors
- {
- selectors() { utils::zero_object(*this); }
-
- uint8 m_selectors[cBlockPixelHeight][cBlockPixelWidth];
-
- uint8 get_by_index(uint i) const { CRNLIB_ASSERT(i < (cBlockPixelWidth * cBlockPixelHeight)); const uint8* p = (const uint8*)m_selectors; return *(p + i); }
- void set_by_index(uint i, uint v) { CRNLIB_ASSERT(i < (cBlockPixelWidth * cBlockPixelHeight)); uint8* p = (uint8*)m_selectors; *(p + i) = static_cast<uint8>(v); }
- };
- typedef crnlib::vector<selectors> selectors_vec;
-
- // Color endpoints
- inline uint get_color_endpoint_codebook_size() const { return m_color_endpoints.size(); }
- inline uint get_color_endpoint(uint codebook_index) const { return m_color_endpoints[codebook_index]; }
- const crnlib::vector<uint>& get_color_endpoint_vec() const { return m_color_endpoints; }
-
- // Color selectors
- uint get_color_selector_codebook_size() const { return m_color_selectors.size(); }
- const selectors& get_color_selectors(uint codebook_index) const { return m_color_selectors[codebook_index]; }
- const crnlib::vector<selectors>& get_color_selectors_vec() const { return m_color_selectors; }
-
- // Alpha endpoints
- inline uint get_alpha_endpoint_codebook_size() const { return m_alpha_endpoints.size(); }
- inline uint get_alpha_endpoint(uint codebook_index) const { return m_alpha_endpoints[codebook_index]; }
- const crnlib::vector<uint>& get_alpha_endpoint_vec() const { return m_alpha_endpoints; }
-
- // Alpha selectors
- uint get_alpha_selector_codebook_size() const { return m_alpha_selectors.size(); }
- const selectors& get_alpha_selectors(uint codebook_index) const { return m_alpha_selectors[codebook_index]; }
- const crnlib::vector<selectors>& get_alpha_selectors_vec() const { return m_alpha_selectors; }
-
- // Debug images
- const pixel_chunk_vec& get_compressed_chunk_pixels() const { return m_dbg_chunk_pixels; }
- const pixel_chunk_vec& get_compressed_chunk_pixels_tile_vis() const { return m_dbg_chunk_pixels_tile_vis; }
- const pixel_chunk_vec& get_compressed_chunk_pixels_color_quantized() const { return m_dbg_chunk_pixels_color_quantized; }
- const pixel_chunk_vec& get_compressed_chunk_pixels_alpha_quantized() const { return m_dbg_chunk_pixels_alpha_quantized; }
- const pixel_chunk_vec& get_compressed_chunk_pixels_final() const { return m_dbg_chunk_pixels_final; }
-
- const pixel_chunk_vec& get_compressed_chunk_pixels_orig_color_selectors() const { return m_dbg_chunk_pixels_orig_color_selectors; }
- const pixel_chunk_vec& get_compressed_chunk_pixels_quantized_color_selectors() const { return m_dbg_chunk_pixels_quantized_color_selectors; }
- const pixel_chunk_vec& get_compressed_chunk_pixels_final_color_selectors() const { return m_dbg_chunk_pixels_final_color_selectors; }
-
- const pixel_chunk_vec& get_compressed_chunk_pixels_orig_alpha_selectors() const { return m_dbg_chunk_pixels_orig_alpha_selectors; }
- const pixel_chunk_vec& get_compressed_chunk_pixels_quantized_alpha_selectors() const { return m_dbg_chunk_pixels_quantized_alpha_selectors; }
- const pixel_chunk_vec& get_compressed_chunk_pixels_final_alpha_selectors() const { return m_dbg_chunk_pixels_final_alpha_selectors; }
-
- static void create_debug_image_from_chunks(uint num_chunks_x, uint num_chunks_y, const pixel_chunk_vec& chunks, const chunk_encoding_vec *pChunk_encodings, image_u8& img, bool serpentine_scan, int comp_index = -1);
-
- private:
- params m_params;
-
- uint m_num_chunks;
- const pixel_chunk* m_pChunks;
-
- chunk_encoding_vec m_chunk_encoding;
-
- uint m_num_alpha_blocks; // 0, 1, or 2
- bool m_has_color_blocks;
- bool m_has_alpha0_blocks;
- bool m_has_alpha1_blocks;
-
- struct compressed_tile
- {
- uint m_endpoint_cluster_index;
- uint m_first_endpoint;
- uint m_second_endpoint;
-
- uint8 m_selectors[cChunkPixelWidth * cChunkPixelHeight];
-
- void set_selector(uint x, uint y, uint s)
- {
- CRNLIB_ASSERT((x < m_pixel_width) && (y < m_pixel_height));
- m_selectors[x + y * m_pixel_width] = static_cast<uint8>(s);
- }
-
- uint get_selector(uint x, uint y) const
- {
- CRNLIB_ASSERT((x < m_pixel_width) && (y < m_pixel_height));
- return m_selectors[x + y * m_pixel_width];
- }
-
- uint8 m_pixel_width;
- uint8 m_pixel_height;
-
- uint8 m_layout_index;
-
- bool m_alpha_encoding;
- };
-
- struct compressed_chunk
- {
- compressed_chunk() { utils::zero_object(*this); }
-
- uint8 m_encoding_index;
-
- uint8 m_num_tiles;
-
- compressed_tile m_tiles[cChunkMaxTiles];
- compressed_tile m_quantized_tiles[cChunkMaxTiles];
-
- uint16 m_endpoint_cluster_index[cChunkMaxTiles];
- uint16 m_selector_cluster_index[cChunkBlockHeight][cChunkBlockWidth];
- };
-
- typedef crnlib::vector<compressed_chunk> compressed_chunk_vec;
- enum
- {
- cColorChunks = 0,
- cAlpha0Chunks = 1,
- cAlpha1Chunks = 2,
-
- cNumCompressedChunkVecs = 3
- };
- compressed_chunk_vec m_compressed_chunks[cNumCompressedChunkVecs];
-
- volatile atomic32_t m_encoding_hist[cNumChunkEncodings];
-
- atomic32_t m_total_tiles;
-
- void compress_dxt1_block(
- dxt1_endpoint_optimizer::results& results,
- uint chunk_index, const image_u8& chunk, uint x_ofs, uint y_ofs, uint width, uint height,
- uint8* pSelectors);
-
- void compress_dxt5_block(
- dxt5_endpoint_optimizer::results& results,
- uint chunk_index, const image_u8& chunk, uint x_ofs, uint y_ofs, uint width, uint height, uint component_index,
- uint8* pAlpha_selectors);
-
- void determine_compressed_chunks_task(uint64 data, void* pData_ptr);
- bool determine_compressed_chunks();
-
- struct tile_cluster
- {
- tile_cluster() : m_first_endpoint(0), m_second_endpoint(0), m_error(0), m_alpha_encoding(false) { }
-
- // first = chunk, second = tile
- // if an alpha tile, second's upper 16 bits contains the alpha index (0 or 1)
- crnlib::vector< std::pair<uint, uint> > m_tiles;
-
- uint m_first_endpoint;
- uint m_second_endpoint;
- uint64 m_error;
-
- bool m_alpha_encoding;
- };
-
- typedef crnlib::vector<tile_cluster> tile_cluster_vec;
-
- tile_cluster_vec m_color_clusters;
- tile_cluster_vec m_alpha_clusters;
-
- selectors_vec m_color_selectors;
- selectors_vec m_alpha_selectors;
-
- // For each selector, this array indicates every chunk/tile/tile block that use this color selector.
- struct block_id
- {
- block_id() { utils::zero_object(*this); }
-
- block_id(uint chunk_index, uint alpha_index, uint tile_index, uint block_x, uint block_y) :
- m_chunk_index(chunk_index), m_alpha_index((uint8)alpha_index), m_tile_index((uint8)tile_index), m_block_x((uint8)block_x), m_block_y((uint8)block_y) { }
-
- uint m_chunk_index;
- uint8 m_alpha_index;
- uint8 m_tile_index;
- uint8 m_block_x;
- uint8 m_block_y;
- };
-
- typedef crnlib::vector< crnlib::vector< block_id > > chunk_blocks_using_selectors_vec;
- chunk_blocks_using_selectors_vec m_chunk_blocks_using_color_selectors;
- chunk_blocks_using_selectors_vec m_chunk_blocks_using_alpha_selectors; // second's upper 16 bits contain alpha index!
-
- crnlib::vector<uint> m_color_endpoints; // not valid until end, only for user access
- crnlib::vector<uint> m_alpha_endpoints; // not valid until end, only for user access
-
- // Debugging
- pixel_chunk_vec m_dbg_chunk_pixels;
- pixel_chunk_vec m_dbg_chunk_pixels_tile_vis;
- pixel_chunk_vec m_dbg_chunk_pixels_color_quantized;
- pixel_chunk_vec m_dbg_chunk_pixels_alpha_quantized;
-
- pixel_chunk_vec m_dbg_chunk_pixels_orig_color_selectors;
- pixel_chunk_vec m_dbg_chunk_pixels_quantized_color_selectors;
- pixel_chunk_vec m_dbg_chunk_pixels_final_color_selectors;
-
- pixel_chunk_vec m_dbg_chunk_pixels_orig_alpha_selectors;
- pixel_chunk_vec m_dbg_chunk_pixels_quantized_alpha_selectors;
- pixel_chunk_vec m_dbg_chunk_pixels_final_alpha_selectors;
-
- pixel_chunk_vec m_dbg_chunk_pixels_final;
-
- crn_thread_id_t m_main_thread_id;
- bool m_canceled;
- task_pool* m_pTask_pool;
-
- int m_prev_phase_index;
- int m_prev_percentage_complete;
-
- typedef vec<6, float> vec6F;
- typedef vec<16, float> vec16F;
- typedef tree_clusterizer<vec2F> vec2F_tree_vq;
- typedef tree_clusterizer<vec6F> vec6F_tree_vq;
- typedef tree_clusterizer<vec16F> vec16F_tree_vq;
-
- struct assign_color_endpoint_clusters_state
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(assign_color_endpoint_clusters_state);
-
- assign_color_endpoint_clusters_state(vec6F_tree_vq& vq, crnlib::vector< crnlib::vector<vec6F> >& training_vecs) :
- m_vq(vq), m_training_vecs(training_vecs) { }
-
- vec6F_tree_vq& m_vq;
- crnlib::vector< crnlib::vector<vec6F> >& m_training_vecs;
- };
-
- struct create_selector_codebook_state
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(create_selector_codebook_state);
-
- create_selector_codebook_state(dxt_hc& hc, bool alpha_blocks, uint comp_index_start, uint comp_index_end, vec16F_tree_vq& selector_vq, chunk_blocks_using_selectors_vec& chunk_blocks_using_selectors, selectors_vec& selectors_cb) :
- m_hc(hc),
- m_alpha_blocks(alpha_blocks),
- m_comp_index_start(comp_index_start),
- m_comp_index_end(comp_index_end),
- m_selector_vq(selector_vq),
- m_chunk_blocks_using_selectors(chunk_blocks_using_selectors),
- m_selectors_cb(selectors_cb)
- {
- }
-
- dxt_hc& m_hc;
- bool m_alpha_blocks;
- uint m_comp_index_start;
- uint m_comp_index_end;
- vec16F_tree_vq& m_selector_vq;
- chunk_blocks_using_selectors_vec& m_chunk_blocks_using_selectors;
- selectors_vec& m_selectors_cb;
-
- mutable spinlock m_chunk_blocks_using_selectors_lock;
- };
-
- void assign_color_endpoint_clusters_task(uint64 data, void* pData_ptr);
- bool determine_color_endpoint_clusters();
-
- struct determine_alpha_endpoint_clusters_state
- {
- vec2F_tree_vq m_vq;
- crnlib::vector< crnlib::vector<vec2F> > m_training_vecs[2];
- };
-
- void determine_alpha_endpoint_clusters_task(uint64 data, void* pData_ptr);
- bool determine_alpha_endpoint_clusters();
-
- void determine_color_endpoint_codebook_task(uint64 data, void* pData_ptr);
- bool determine_color_endpoint_codebook();
-
- void determine_alpha_endpoint_codebook_task(uint64 data, void* pData_ptr);
- bool determine_alpha_endpoint_codebook();
-
- void create_quantized_debug_images();
-
- void create_selector_codebook_task(uint64 data, void* pData_ptr);
- bool create_selector_codebook(bool alpha_blocks);
-
- bool refine_quantized_color_endpoints();
- bool refine_quantized_color_selectors();
- bool refine_quantized_alpha_endpoints();
- bool refine_quantized_alpha_selectors();
- void create_final_debug_image();
- bool create_chunk_encodings();
- bool update_progress(uint phase_index, uint subphase_index, uint subphase_total);
- bool compress_internal(const params& p, uint num_chunks, const pixel_chunk* pChunks);
- };
-
- CRNLIB_DEFINE_BITWISE_COPYABLE(dxt_hc::pixel_chunk);
- CRNLIB_DEFINE_BITWISE_COPYABLE(dxt_hc::chunk_encoding);
- CRNLIB_DEFINE_BITWISE_COPYABLE(dxt_hc::selectors);
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc_common.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc_common.cpp
deleted file mode 100644
index 980f82bb..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc_common.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// File: crn_dxt_hc_common.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_dxt_hc_common.h"
-
-namespace crnlib
-{
- chunk_encoding_desc g_chunk_encodings[cNumChunkEncodings] =
- {
- { 1, { { 0, 0, 8, 8, 0 } } },
-
- { 2, { { 0, 0, 8, 4, 1 }, { 0, 4, 8, 4, 2 } } },
- { 2, { { 0, 0, 4, 8, 3 }, { 4, 0, 4, 8, 4 } } },
-
- { 3, { { 0, 0, 8, 4, 1 }, { 0, 4, 4, 4, 7 }, { 4, 4, 4, 4, 8 } } },
- { 3, { { 0, 4, 8, 4, 2 }, { 0, 0, 4, 4, 5 }, { 4, 0, 4, 4, 6 } } },
-
- { 3, { { 0, 0, 4, 8, 3 }, { 4, 0, 4, 4, 6 }, { 4, 4, 4, 4, 8 } } },
- { 3, { { 4, 0, 4, 8, 4 }, { 0, 0, 4, 4, 5 }, { 0, 4, 4, 4, 7 } } },
-
- { 4, { { 0, 0, 4, 4, 5 }, { 4, 0, 4, 4, 6 }, { 0, 4, 4, 4, 7 }, { 4, 4, 4, 4, 8 } } }
- };
-
- chunk_tile_desc g_chunk_tile_layouts[cNumChunkTileLayouts] =
- {
- // 2x2
- { 0, 0, 8, 8, 0 },
-
- // 2x1
- { 0, 0, 8, 4, 1 },
- { 0, 4, 8, 4, 2 },
-
- // 1x2
- { 0, 0, 4, 8, 3 },
- { 4, 0, 4, 8, 4 },
-
- // 1x1
- { 0, 0, 4, 4, 5 },
- { 4, 0, 4, 4, 6 },
- { 0, 4, 4, 4, 7 },
- { 4, 4, 4, 4, 8 }
- };
-
-} // namespace crnlib
-
-
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc_common.h b/Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc_common.h
deleted file mode 100644
index 808278fa..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_hc_common.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// File: crn_dxt_hc_common.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- struct chunk_tile_desc
- {
- // These values are in pixels, and always a multiple of cBlockPixelWidth/cBlockPixelHeight.
- uint m_x_ofs;
- uint m_y_ofs;
- uint m_width;
- uint m_height;
- uint m_layout_index;
- };
-
- struct chunk_encoding_desc
- {
- uint m_num_tiles;
- chunk_tile_desc m_tiles[4];
- };
-
- const uint cChunkPixelWidth = 8;
- const uint cChunkPixelHeight = 8;
- const uint cChunkBlockWidth = 2;
- const uint cChunkBlockHeight = 2;
-
- const uint cChunkMaxTiles = 4;
-
- const uint cBlockPixelWidthShift = 2;
- const uint cBlockPixelHeightShift = 2;
-
- const uint cBlockPixelWidth = 4;
- const uint cBlockPixelHeight = 4;
-
- const uint cNumChunkEncodings = 8;
- extern chunk_encoding_desc g_chunk_encodings[cNumChunkEncodings];
-
- const uint cNumChunkTileLayouts = 9;
- const uint cFirst4x4ChunkTileLayout = 5;
- extern chunk_tile_desc g_chunk_tile_layouts[cNumChunkTileLayouts];
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_image.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_dxt_image.cpp
deleted file mode 100644
index e6bd8bbd..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_image.cpp
+++ /dev/null
@@ -1,1683 +0,0 @@
-// File: crn_dxt_image.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_dxt_image.h"
-#if CRNLIB_SUPPORT_SQUISH
-#include "squish\squish.h"
-#endif
-#include "crn_ryg_dxt.hpp"
-#include "crn_dxt_fast.h"
-#include "crn_console.h"
-#include "crn_threading.h"
-
-#if CRNLIB_SUPPORT_ATI_COMPRESS
- #ifdef _DLL
- #pragma comment(lib, "ATI_Compress_MT_DLL_VC8.lib")
- #else
- #pragma comment(lib, "ATI_Compress_MT_VC8.lib")
- #endif
- #include "..\ext\ATI_Compress\ATI_Compress.h"
-#endif
-
-#include "crn_rg_etc1.h"
-#include "crn_etc.h"
-#define CRNLIB_USE_RG_ETC1 1
-
-namespace crnlib
-{
- dxt_image::dxt_image() :
- m_pElements(NULL),
- m_width(0),
- m_height(0),
- m_blocks_x(0),
- m_blocks_y(0),
- m_total_blocks(0),
- m_total_elements(0),
- m_num_elements_per_block(0),
- m_bytes_per_block(0),
- m_format(cDXTInvalid)
- {
- utils::zero_object(m_element_type);
- utils::zero_object(m_element_component_index);
- }
-
- dxt_image::dxt_image(const dxt_image& other) :
- m_pElements(NULL)
- {
- *this = other;
- }
-
- dxt_image& dxt_image::operator= (const dxt_image& rhs)
- {
- if (this == &rhs)
- return *this;
-
- clear();
-
- m_width = rhs.m_width;
- m_height = rhs.m_height;
- m_blocks_x = rhs.m_blocks_x;
- m_blocks_y = rhs.m_blocks_y;
- m_num_elements_per_block = rhs.m_num_elements_per_block;
- m_bytes_per_block = rhs.m_bytes_per_block;
- m_format = rhs.m_format;
- m_total_blocks = rhs.m_total_blocks;
- m_total_elements = rhs.m_total_elements;
- m_pElements = NULL;
- memcpy(m_element_type, rhs.m_element_type, sizeof(m_element_type));
- memcpy(m_element_component_index, rhs.m_element_component_index, sizeof(m_element_component_index));
-
- if (rhs.m_pElements)
- {
- m_elements.resize(m_total_elements);
- memcpy(&m_elements[0], rhs.m_pElements, sizeof(element) * m_total_elements);
- m_pElements = &m_elements[0];
- }
-
- return *this;
- }
-
- void dxt_image::clear()
- {
- m_elements.clear();
- m_width = 0;
- m_height = 0;
- m_blocks_x = 0;
- m_blocks_y = 0;
- m_num_elements_per_block = 0;
- m_bytes_per_block = 0;
- m_format = cDXTInvalid;
- utils::zero_object(m_element_type);
- utils::zero_object(m_element_component_index);
- m_total_blocks = 0;
- m_total_elements = 0;
- m_pElements = NULL;
- }
-
- bool dxt_image::init_internal(dxt_format fmt, uint width, uint height)
- {
- CRNLIB_ASSERT((fmt != cDXTInvalid) && (width > 0) && (height > 0));
-
- clear();
-
- m_width = width;
- m_height = height;
-
- m_blocks_x = (m_width + 3) >> cDXTBlockShift;
- m_blocks_y = (m_height + 3) >> cDXTBlockShift;
-
- m_num_elements_per_block = 2;
- if ((fmt == cDXT1) || (fmt == cDXT1A) || (fmt == cDXT5A) || (fmt == cETC1))
- m_num_elements_per_block = 1;
-
- m_total_blocks = m_blocks_x * m_blocks_y;
- m_total_elements = m_total_blocks * m_num_elements_per_block;
-
- CRNLIB_ASSUME((uint)cDXT1BytesPerBlock == (uint)cETC1BytesPerBlock);
- m_bytes_per_block = cDXT1BytesPerBlock * m_num_elements_per_block;
-
- m_format = fmt;
-
- switch (m_format)
- {
- case cDXT1:
- case cDXT1A:
- {
- m_element_type[0] = cColorDXT1;
- m_element_component_index[0] = -1;
- break;
- }
- case cDXT3:
- {
- m_element_type[0] = cAlphaDXT3;
- m_element_type[1] = cColorDXT1;
- m_element_component_index[0] = 3;
- m_element_component_index[1] = -1;
- break;
- }
- case cDXT5:
- {
- m_element_type[0] = cAlphaDXT5;
- m_element_type[1] = cColorDXT1;
- m_element_component_index[0] = 3;
- m_element_component_index[1] = -1;
- break;
- }
- case cDXT5A:
- {
- m_element_type[0] = cAlphaDXT5;
- m_element_component_index[0] = 3;
- break;
- }
- case cDXN_XY:
- {
- m_element_type[0] = cAlphaDXT5;
- m_element_type[1] = cAlphaDXT5;
- m_element_component_index[0] = 0;
- m_element_component_index[1] = 1;
- break;
- }
- case cDXN_YX:
- {
- m_element_type[0] = cAlphaDXT5;
- m_element_type[1] = cAlphaDXT5;
- m_element_component_index[0] = 1;
- m_element_component_index[1] = 0;
- break;
- }
- case cETC1:
- {
- m_element_type[0] = cColorETC1;
- m_element_component_index[0] = -1;
- break;
- }
- default:
- {
- CRNLIB_ASSERT(0);
- clear();
- return false;
- }
- }
-
- return true;
- }
-
- bool dxt_image::init(dxt_format fmt, uint width, uint height, bool clear_elements)
- {
- if (!init_internal(fmt, width, height))
- return false;
-
- m_elements.resize(m_total_elements);
- m_pElements = &m_elements[0];
-
- if (clear_elements)
- memset(m_pElements, 0, sizeof(element) * m_total_elements);
-
- return true;
- }
-
- bool dxt_image::init(dxt_format fmt, uint width, uint height, uint num_elements, element* pElements, bool create_copy)
- {
- CRNLIB_ASSERT(num_elements && pElements);
-
- if (!init_internal(fmt, width, height))
- return false;
-
- if (num_elements != m_total_elements)
- {
- clear();
- return false;
- }
-
- if (create_copy)
- {
- m_elements.resize(m_total_elements);
- m_pElements = &m_elements[0];
-
- memcpy(m_pElements, pElements, m_total_elements * sizeof(element));
- }
- else
- m_pElements = pElements;
-
- return true;
- }
-
- struct init_task_params
- {
- dxt_format m_fmt;
- const image_u8* m_pImg;
- const dxt_image::pack_params* m_pParams;
- crn_thread_id_t m_main_thread;
- atomic32_t m_canceled;
- };
-
- void dxt_image::init_task(uint64 data, void* pData_ptr)
- {
- const uint thread_index = static_cast<uint>(data);
- init_task_params* pInit_params = static_cast<init_task_params*>(pData_ptr);
-
- const image_u8& img = *pInit_params->m_pImg;
- const pack_params& p = *pInit_params->m_pParams;
- const bool is_main_thread = (crn_get_current_thread_id() == pInit_params->m_main_thread);
-
- uint block_index = 0;
-
- set_block_pixels_context optimizer_context;
- int prev_progress_percentage = -1;
-
- for (uint block_y = 0; block_y < m_blocks_y; block_y++)
- {
- const uint pixel_ofs_y = block_y * cDXTBlockSize;
-
- for (uint block_x = 0; block_x < m_blocks_x; block_x++, block_index++)
- {
- if (pInit_params->m_canceled)
- return;
-
- if (p.m_pProgress_callback && is_main_thread && ((block_index & 63) == 63))
- {
- const uint progress_percentage = p.m_progress_start + ((block_index * p.m_progress_range + get_total_blocks() / 2) / get_total_blocks());
- if ((int)progress_percentage != prev_progress_percentage)
- {
- prev_progress_percentage = progress_percentage;
- if (!(p.m_pProgress_callback)(progress_percentage, p.m_pProgress_callback_user_data_ptr))
- {
- atomic_exchange32(&pInit_params->m_canceled, CRNLIB_TRUE);
- return;
- }
- }
- }
-
- if (p.m_num_helper_threads)
- {
- if ((block_index % (p.m_num_helper_threads + 1)) != thread_index)
- continue;
- }
-
- color_quad_u8 pixels[cDXTBlockSize * cDXTBlockSize];
-
- const uint pixel_ofs_x = block_x * cDXTBlockSize;
-
- for (uint y = 0; y < cDXTBlockSize; y++)
- {
- const uint iy = math::minimum(pixel_ofs_y + y, img.get_height() - 1);
-
- for (uint x = 0; x < cDXTBlockSize; x++)
- {
- const uint ix = math::minimum(pixel_ofs_x + x, img.get_width() - 1);
-
- pixels[x + y * cDXTBlockSize] = img(ix, iy);
- }
- }
-
- set_block_pixels(block_x, block_y, pixels, p, optimizer_context);
- }
- }
- }
-
-#if CRNLIB_SUPPORT_ATI_COMPRESS
- bool dxt_image::init_ati_compress(dxt_format fmt, const image_u8& img, const pack_params& p)
- {
- image_u8 tmp_img(img);
- for (uint y = 0; y < img.get_height(); y++)
- {
- for (uint x = 0; x < img.get_width(); x++)
- {
- color_quad_u8 c(img(x, y));
- std::swap(c.r, c.b);
- tmp_img(x, y) = c;
- }
- }
-
- ATI_TC_Texture src_tex;
- utils::zero_object(src_tex);
- src_tex.dwSize = sizeof(ATI_TC_Texture);
- src_tex.dwWidth = tmp_img.get_width();
- src_tex.dwHeight = tmp_img.get_height();
- src_tex.dwPitch = tmp_img.get_pitch_in_bytes();
- src_tex.format = ATI_TC_FORMAT_ARGB_8888;
- src_tex.dwDataSize = src_tex.dwPitch * tmp_img.get_height();
- src_tex.pData = (ATI_TC_BYTE*)tmp_img.get_ptr();
-
- ATI_TC_Texture dst_tex;
- utils::zero_object(dst_tex);
- dst_tex.dwSize = sizeof(ATI_TC_Texture);
- dst_tex.dwWidth = tmp_img.get_width();
- dst_tex.dwHeight = tmp_img.get_height();
- dst_tex.dwDataSize = get_size_in_bytes();
- dst_tex.pData = (ATI_TC_BYTE*)get_element_ptr();
-
- switch (fmt)
- {
- case cDXT1:
- case cDXT1A:
- dst_tex.format = ATI_TC_FORMAT_DXT1;
- break;
- case cDXT3:
- dst_tex.format = ATI_TC_FORMAT_DXT3;
- break;
- case cDXT5:
- dst_tex.format = ATI_TC_FORMAT_DXT5;
- break;
- case cDXT5A:
- dst_tex.format = ATI_TC_FORMAT_ATI1N;
- break;
- case cDXN_XY:
- dst_tex.format = ATI_TC_FORMAT_ATI2N_XY;
- break;
- case cDXN_YX:
- dst_tex.format = ATI_TC_FORMAT_ATI2N;
- break;
- default:
- {
- CRNLIB_ASSERT(false);
- return false;
- }
- }
-
- ATI_TC_CompressOptions options;
- utils::zero_object(options);
- options.dwSize = sizeof(ATI_TC_CompressOptions);
-
- if (fmt == cDXT1A)
- {
- options.bDXT1UseAlpha = true;
- options.nAlphaThreshold = (ATI_TC_BYTE)p.m_dxt1a_alpha_threshold;
- }
- options.bDisableMultiThreading = (p.m_num_helper_threads == 0);
- switch (p.m_quality)
- {
- case cCRNDXTQualityFast:
- options.nCompressionSpeed = ATI_TC_Speed_Fast;
- break;
- case cCRNDXTQualitySuperFast:
- options.nCompressionSpeed = ATI_TC_Speed_SuperFast;
- break;
- default:
- options.nCompressionSpeed = ATI_TC_Speed_Normal;
- break;
- }
-
- if (p.m_perceptual)
- {
- options.bUseChannelWeighting = true;
- options.fWeightingRed = .212671f;
- options.fWeightingGreen = .715160f;
- options.fWeightingBlue = .072169f;
- }
-
- ATI_TC_ERROR err = ATI_TC_ConvertTexture(&src_tex, &dst_tex, &options, NULL, NULL, NULL);
- return err == ATI_TC_OK;
- }
-#endif
-
- bool dxt_image::init(dxt_format fmt, const image_u8& img, const pack_params& p)
- {
- if (!init(fmt, img.get_width(), img.get_height(), false))
- return false;
-
-#if CRNLIB_SUPPORT_ATI_COMPRESS
- if (p.m_compressor == cCRNDXTCompressorATI)
- return init_ati_compress(fmt, img, p);
-#endif
-
- task_pool *pPool = p.m_pTask_pool;
-
- task_pool tmp_pool;
- if (!pPool)
- {
- if (!tmp_pool.init(p.m_num_helper_threads))
- return false;
- pPool = &tmp_pool;
- }
-
- init_task_params init_params;
- init_params.m_fmt = fmt;
- init_params.m_pImg = &img;
- init_params.m_pParams = &p;
- init_params.m_main_thread = crn_get_current_thread_id();
- init_params.m_canceled = false;
-
- for (uint i = 0; i <= p.m_num_helper_threads; i++)
- pPool->queue_object_task(this, &dxt_image::init_task, i, &init_params);
-
- pPool->join();
-
- if (init_params.m_canceled)
- return false;
-
- return true;
- }
-
- bool dxt_image::unpack(image_u8& img) const
- {
- if (!m_total_elements)
- return false;
-
- img.resize(m_width, m_height);
-
- color_quad_u8 pixels[cDXTBlockSize * cDXTBlockSize];
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- pixels[i].set(0, 0, 0, 255);
-
- bool all_blocks_valid = true;
- for (uint block_y = 0; block_y < m_blocks_y; block_y++)
- {
- const uint pixel_ofs_y = block_y * cDXTBlockSize;
- const uint limit_y = math::minimum<uint>(cDXTBlockSize, img.get_height() - pixel_ofs_y);
-
- for (uint block_x = 0; block_x < m_blocks_x; block_x++)
- {
- if (!get_block_pixels(block_x, block_y, pixels))
- all_blocks_valid = false;
-
- const uint pixel_ofs_x = block_x * cDXTBlockSize;
-
- const uint limit_x = math::minimum<uint>(cDXTBlockSize, img.get_width() - pixel_ofs_x);
-
- for (uint y = 0; y < limit_y; y++)
- {
- const uint iy = pixel_ofs_y + y;
-
- for (uint x = 0; x < limit_x; x++)
- {
- const uint ix = pixel_ofs_x + x;
-
- img(ix, iy) = pixels[x + (y << cDXTBlockShift)];
- }
- }
- }
- }
-
- if (!all_blocks_valid)
- console::error("dxt_image::unpack: One or more invalid blocks encountered!");
-
- img.reset_comp_flags();
- img.set_component_valid(0, false);
- img.set_component_valid(1, false);
- img.set_component_valid(2, false);
- for (uint i = 0; i < m_num_elements_per_block; i++)
- {
- if (m_element_component_index[i] < 0)
- {
- img.set_component_valid(0, true);
- img.set_component_valid(1, true);
- img.set_component_valid(2, true);
- }
- else
- img.set_component_valid(m_element_component_index[i], true);
- }
-
- img.set_component_valid(3, get_dxt_format_has_alpha(m_format));
-
- return true;
- }
-
- void dxt_image::endian_swap()
- {
- utils::endian_switch_words(reinterpret_cast<uint16*>(m_elements.get_ptr()), m_elements.size_in_bytes() / sizeof(uint16));
- }
-
- const dxt_image::element& dxt_image::get_element(uint block_x, uint block_y, uint element_index) const
- {
- CRNLIB_ASSERT((block_x < m_blocks_x) && (block_y < m_blocks_y) && (element_index < m_num_elements_per_block));
- return m_pElements[(block_x + block_y * m_blocks_x) * m_num_elements_per_block + element_index];
- }
-
- dxt_image::element& dxt_image::get_element(uint block_x, uint block_y, uint element_index)
- {
- CRNLIB_ASSERT((block_x < m_blocks_x) && (block_y < m_blocks_y) && (element_index < m_num_elements_per_block));
- return m_pElements[(block_x + block_y * m_blocks_x) * m_num_elements_per_block + element_index];
- }
-
- bool dxt_image::has_alpha() const
- {
- switch (m_format)
- {
- case cDXT1:
- {
- for (uint i = 0; i < m_total_elements; i++)
- {
- const dxt1_block& blk = *(dxt1_block*)&m_pElements[i];
-
- if (blk.get_low_color() <= blk.get_high_color())
- {
- for (uint y = 0; y < cDXTBlockSize; y++)
- for (uint x = 0; x < cDXTBlockSize; x++)
- if (blk.get_selector(x, y) == 3)
- return true;
- }
- }
-
- break;
- }
- case cDXT1A:
- case cDXT3:
- case cDXT5:
- case cDXT5A:
- return true;
- default: break;
- }
-
- return false;
- }
-
- color_quad_u8 dxt_image::get_pixel(uint x, uint y) const
- {
- CRNLIB_ASSERT((x < m_width) && (y < m_height));
-
- const uint block_x = x >> cDXTBlockShift;
- const uint block_y = y >> cDXTBlockShift;
-
- const element* pElement = reinterpret_cast<const element*>(&get_element(block_x, block_y, 0));
-
- color_quad_u8 result(0, 0, 0, 255);
-
- for (uint element_index = 0; element_index < m_num_elements_per_block; element_index++, pElement++)
- {
- switch (m_element_type[element_index])
- {
- case cColorETC1:
- {
- const etc1_block& block = *reinterpret_cast<const etc1_block*>(&get_element(block_x, block_y, element_index));
-
- const bool diff_flag = block.get_diff_bit();
- const bool flip_flag = block.get_flip_bit();
- const uint table_index0 = block.get_inten_table(0);
- const uint table_index1 = block.get_inten_table(1);
- color_quad_u8 subblock_colors0[4], subblock_colors1[4];
-
- if (diff_flag)
- {
- const uint16 base_color5 = block.get_base5_color();
- const uint16 delta_color3 = block.get_delta3_color();
- etc1_block::get_diff_subblock_colors(subblock_colors0, base_color5, table_index0);
- etc1_block::get_diff_subblock_colors(subblock_colors1, base_color5, delta_color3, table_index1);
- }
- else
- {
- const uint16 base_color4_0 = block.get_base4_color(0);
- etc1_block::get_abs_subblock_colors(subblock_colors0, base_color4_0, table_index0);
- const uint16 base_color4_1 = block.get_base4_color(1);
- etc1_block::get_abs_subblock_colors(subblock_colors1, base_color4_1, table_index1);
- }
-
- const uint bx = x & 3;
- const uint by = y & 3;
-
- const uint selector_index = block.get_selector(bx, by);
- if (flip_flag)
- {
- if (by <= 2)
- result = subblock_colors0[selector_index];
- else
- result = subblock_colors1[selector_index];
- }
- else
- {
- if (bx <= 2)
- result = subblock_colors0[selector_index];
- else
- result = subblock_colors1[selector_index];
- }
-
- break;
- }
- case cColorDXT1:
- {
- const dxt1_block* pBlock = reinterpret_cast<const dxt1_block*>(&get_element(block_x, block_y, element_index));
-
- const uint l = pBlock->get_low_color();
- const uint h = pBlock->get_high_color();
-
- color_quad_u8 c0(dxt1_block::unpack_color(static_cast<uint16>(l), true));
- color_quad_u8 c1(dxt1_block::unpack_color(static_cast<uint16>(h), true));
-
- const uint s = pBlock->get_selector(x & 3, y & 3);
-
- if (l > h)
- {
- switch (s)
- {
- case 0: result.set_noclamp_rgb(c0.r, c0.g, c0.b); break;
- case 1: result.set_noclamp_rgb(c1.r, c1.g, c1.b); break;
- case 2: result.set_noclamp_rgb( (c0.r * 2 + c1.r) / 3, (c0.g * 2 + c1.g) / 3, (c0.b * 2 + c1.b) / 3); break;
- case 3: result.set_noclamp_rgb( (c1.r * 2 + c0.r) / 3, (c1.g * 2 + c0.g) / 3, (c1.b * 2 + c0.b) / 3); break;
- }
- }
- else
- {
- switch (s)
- {
- case 0: result.set_noclamp_rgb(c0.r, c0.g, c0.b); break;
- case 1: result.set_noclamp_rgb(c1.r, c1.g, c1.b); break;
- case 2: result.set_noclamp_rgb( (c0.r + c1.r) >> 1U, (c0.g + c1.g) >> 1U, (c0.b + c1.b) >> 1U); break;
- case 3:
- {
- if (m_format <= cDXT1A)
- result.set_noclamp_rgba(0, 0, 0, 0);
- else
- result.set_noclamp_rgb(0, 0, 0);
- break;
- }
- }
- }
-
- break;
- }
- case cAlphaDXT5:
- {
- const int comp_index = m_element_component_index[element_index];
-
- const dxt5_block* pBlock = reinterpret_cast<const dxt5_block*>(&get_element(block_x, block_y, element_index));
-
- const uint l = pBlock->get_low_alpha();
- const uint h = pBlock->get_high_alpha();
-
- const uint s = pBlock->get_selector(x & 3, y & 3);
-
- if (l > h)
- {
- switch (s)
- {
- case 0: result[comp_index] = static_cast<uint8>(l); break;
- case 1: result[comp_index] = static_cast<uint8>(h); break;
- case 2: result[comp_index] = static_cast<uint8>((l * 6 + h ) / 7); break;
- case 3: result[comp_index] = static_cast<uint8>((l * 5 + h * 2) / 7); break;
- case 4: result[comp_index] = static_cast<uint8>((l * 4 + h * 3) / 7); break;
- case 5: result[comp_index] = static_cast<uint8>((l * 3 + h * 4) / 7); break;
- case 6: result[comp_index] = static_cast<uint8>((l * 2 + h * 5) / 7); break;
- case 7: result[comp_index] = static_cast<uint8>((l + h * 6) / 7); break;
- }
- }
- else
- {
- switch (s)
- {
- case 0: result[comp_index] = static_cast<uint8>(l); break;
- case 1: result[comp_index] = static_cast<uint8>(h); break;
- case 2: result[comp_index] = static_cast<uint8>((l * 4 + h ) / 5); break;
- case 3: result[comp_index] = static_cast<uint8>((l * 3 + h * 2) / 5); break;
- case 4: result[comp_index] = static_cast<uint8>((l * 2 + h * 3) / 5); break;
- case 5: result[comp_index] = static_cast<uint8>((l + h * 4) / 5); break;
- case 6: result[comp_index] = 0; break;
- case 7: result[comp_index] = 255; break;
- }
- }
-
- break;
- }
- case cAlphaDXT3:
- {
- const int comp_index = m_element_component_index[element_index];
-
- const dxt3_block* pBlock = reinterpret_cast<const dxt3_block*>(&get_element(block_x, block_y, element_index));
-
- result[comp_index] = static_cast<uint8>(pBlock->get_alpha(x & 3, y & 3, true));
-
- break;
- }
- default: break;
- }
- }
-
- return result;
- }
-
- uint dxt_image::get_pixel_alpha(uint x, uint y, uint element_index) const
- {
- CRNLIB_ASSERT((x < m_width) && (y < m_height) && (element_index < m_num_elements_per_block));
-
- const uint block_x = x >> cDXTBlockShift;
- const uint block_y = y >> cDXTBlockShift;
-
- switch (m_element_type[element_index])
- {
- case cColorDXT1:
- {
- if (m_format <= cDXT1A)
- {
- const dxt1_block* pBlock = reinterpret_cast<const dxt1_block*>(&get_element(block_x, block_y, element_index));
-
- const uint l = pBlock->get_low_color();
- const uint h = pBlock->get_high_color();
-
- if (l <= h)
- {
- uint s = pBlock->get_selector(x & 3, y & 3);
-
- return (s == 3) ? 0 : 255;
- }
- else
- {
- return 255;
- }
- }
-
- break;
- }
- case cAlphaDXT5:
- {
- const dxt5_block* pBlock = reinterpret_cast<const dxt5_block*>(&get_element(block_x, block_y, element_index));
-
- const uint l = pBlock->get_low_alpha();
- const uint h = pBlock->get_high_alpha();
-
- const uint s = pBlock->get_selector(x & 3, y & 3);
-
- if (l > h)
- {
- switch (s)
- {
- case 0: return l;
- case 1: return h;
- case 2: return (l * 6 + h ) / 7;
- case 3: return (l * 5 + h * 2) / 7;
- case 4: return (l * 4 + h * 3) / 7;
- case 5: return (l * 3 + h * 4) / 7;
- case 6: return (l * 2 + h * 5) / 7;
- case 7: return (l + h * 6) / 7;
- }
- }
- else
- {
- switch (s)
- {
- case 0: return l;
- case 1: return h;
- case 2: return (l * 4 + h ) / 5;
- case 3: return (l * 3 + h * 2) / 5;
- case 4: return (l * 2 + h * 3) / 5;
- case 5: return (l + h * 4) / 5;
- case 6: return 0;
- case 7: return 255;
- }
- }
- }
- case cAlphaDXT3:
- {
- const dxt3_block* pBlock = reinterpret_cast<const dxt3_block*>(&get_element(block_x, block_y, element_index));
-
- return pBlock->get_alpha(x & 3, y & 3, true);
- }
- default: break;
- }
-
- return 255;
- }
-
- void dxt_image::set_pixel(uint x, uint y, const color_quad_u8& c, bool perceptual)
- {
- CRNLIB_ASSERT((x < m_width) && (y < m_height));
-
- const uint block_x = x >> cDXTBlockShift;
- const uint block_y = y >> cDXTBlockShift;
-
- element* pElement = &get_element(block_x, block_y, 0);
-
- for (uint element_index = 0; element_index < m_num_elements_per_block; element_index++, pElement++)
- {
- switch (m_element_type[element_index])
- {
- case cColorETC1:
- {
- etc1_block& block = *reinterpret_cast<etc1_block*>(&get_element(block_x, block_y, element_index));
-
- const bool diff_flag = block.get_diff_bit();
- const bool flip_flag = block.get_flip_bit();
- const uint table_index0 = block.get_inten_table(0);
- const uint table_index1 = block.get_inten_table(1);
- color_quad_u8 subblock_colors0[4], subblock_colors1[4];
-
- if (diff_flag)
- {
- const uint16 base_color5 = block.get_base5_color();
- const uint16 delta_color3 = block.get_delta3_color();
- etc1_block::get_diff_subblock_colors(subblock_colors0, base_color5, table_index0);
- etc1_block::get_diff_subblock_colors(subblock_colors1, base_color5, delta_color3, table_index1);
- }
- else
- {
- const uint16 base_color4_0 = block.get_base4_color(0);
- etc1_block::get_abs_subblock_colors(subblock_colors0, base_color4_0, table_index0);
- const uint16 base_color4_1 = block.get_base4_color(1);
- etc1_block::get_abs_subblock_colors(subblock_colors1, base_color4_1, table_index1);
- }
-
- const uint bx = x & 3;
- const uint by = y & 3;
-
- color_quad_u8* pColors = subblock_colors1;
- if (flip_flag)
- {
- if (by <= 2)
- pColors = subblock_colors0;
- }
- else
- {
- if (bx <= 2)
- pColors = subblock_colors0;
- }
-
- uint best_error = UINT_MAX;
- uint best_selector = 0;
-
- for (uint i = 0; i < 4; i++)
- {
- uint error = color::color_distance(perceptual, pColors[i], c, false);
- if (error < best_error)
- {
- best_error = error;
- best_selector = i;
- }
- }
-
- block.set_selector(bx, by, best_selector);
- break;
- }
- case cColorDXT1:
- {
- dxt1_block* pDXT1_block = reinterpret_cast<dxt1_block*>(pElement);
-
- color_quad_u8 colors[cDXT1SelectorValues];
- const uint n = pDXT1_block->get_block_colors(colors, static_cast<uint16>(pDXT1_block->get_low_color()), static_cast<uint16>(pDXT1_block->get_high_color()));
-
- if ((m_format == cDXT1A) && (c.a < 128))
- pDXT1_block->set_selector(x & 3, y & 3, 3);
- else
- {
- uint best_error = UINT_MAX;
- uint best_selector = 0;
-
- for (uint i = 0; i < n; i++)
- {
- uint error = color::color_distance(perceptual, colors[i], c, false);
- if (error < best_error)
- {
- best_error = error;
- best_selector = i;
- }
- }
-
- pDXT1_block->set_selector(x & 3, y & 3, best_selector);
- }
-
- break;
- }
- case cAlphaDXT5:
- {
- dxt5_block* pDXT5_block = reinterpret_cast<dxt5_block*>(pElement);
-
- uint values[cDXT5SelectorValues];
- dxt5_block::get_block_values(values, pDXT5_block->get_low_alpha(), pDXT5_block->get_high_alpha());
-
- const int comp_index = m_element_component_index[element_index];
-
- uint best_error = UINT_MAX;
- uint best_selector = 0;
-
- for (uint i = 0; i < cDXT5SelectorValues; i++)
- {
- uint error = labs(values[i] - c[comp_index]); // no need to square
-
- if (error < best_error)
- {
- best_error = error;
- best_selector = i;
- }
- }
-
- pDXT5_block->set_selector(x & 3, y & 3, best_selector);
-
- break;
- }
- case cAlphaDXT3:
- {
- const int comp_index = m_element_component_index[element_index];
-
- dxt3_block* pDXT3_block = reinterpret_cast<dxt3_block*>(pElement);
-
- pDXT3_block->set_alpha(x & 3, y & 3, c[comp_index], true);
-
- break;
- }
- default: break;
- }
- } // element_index
- }
-
- bool dxt_image::get_block_pixels(uint block_x, uint block_y, color_quad_u8* pPixels) const
- {
- bool success = true;
- const element* pElement = &get_element(block_x, block_y, 0);
-
- for (uint element_index = 0; element_index < m_num_elements_per_block; element_index++, pElement++)
- {
- switch (m_element_type[element_index])
- {
- case cColorETC1:
- {
- const etc1_block& block = *reinterpret_cast<const etc1_block*>(&get_element(block_x, block_y, element_index));
- // Preserve alpha if the format is something weird (like ETC1 for color and DXT5A for alpha) - which isn't currently supported.
-#if CRNLIB_USE_RG_ETC1
- if (!rg_etc1::unpack_etc1_block(&block, (uint32*)pPixels, m_format != cETC1))
- success = false;
-#else
- if (!unpack_etc1(block, pPixels, m_format != cETC1))
- success = false;
-#endif
-
- break;
- }
- case cColorDXT1:
- {
- const dxt1_block* pDXT1_block = reinterpret_cast<const dxt1_block*>(pElement);
-
- color_quad_u8 colors[cDXT1SelectorValues];
- pDXT1_block->get_block_colors(colors, static_cast<uint16>(pDXT1_block->get_low_color()), static_cast<uint16>(pDXT1_block->get_high_color()));
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- uint s = pDXT1_block->get_selector(i & 3, i >> 2);
-
- pPixels[i].r = colors[s].r;
- pPixels[i].g = colors[s].g;
- pPixels[i].b = colors[s].b;
-
- if (m_format <= cDXT1A)
- pPixels[i].a = colors[s].a;
- }
-
- break;
- }
- case cAlphaDXT5:
- {
- const dxt5_block* pDXT5_block = reinterpret_cast<const dxt5_block*>(pElement);
-
- uint values[cDXT5SelectorValues];
- dxt5_block::get_block_values(values, pDXT5_block->get_low_alpha(), pDXT5_block->get_high_alpha());
-
- const int comp_index = m_element_component_index[element_index];
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- uint s = pDXT5_block->get_selector(i & 3, i >> 2);
-
- pPixels[i][comp_index] = static_cast<uint8>(values[s]);
- }
-
- break;
- }
- case cAlphaDXT3:
- {
- const dxt3_block* pDXT3_block = reinterpret_cast<const dxt3_block*>(pElement);
-
- const int comp_index = m_element_component_index[element_index];
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- uint a = pDXT3_block->get_alpha(i & 3, i >> 2, true);
-
- pPixels[i][comp_index] = static_cast<uint8>(a);
- }
-
- break;
- }
- default: break;
- }
- } // element_index
- return success;
- }
-
- void dxt_image::set_block_pixels(uint block_x, uint block_y, const color_quad_u8* pPixels, const pack_params& p)
- {
- set_block_pixels_context context;
- set_block_pixels(block_x, block_y, pPixels, p, context);
- }
-
- void dxt_image::set_block_pixels(
- uint block_x, uint block_y, const color_quad_u8* pPixels, const pack_params& p,
- set_block_pixels_context& context)
- {
- element* pElement = &get_element(block_x, block_y, 0);
-
- if (m_format == cETC1)
- {
- etc1_block &dst_block = *reinterpret_cast<etc1_block*>(pElement);
-
-#if CRNLIB_USE_RG_ETC1
- rg_etc1::etc1_quality etc_quality = rg_etc1::cHighQuality;
- if (p.m_quality <= cCRNDXTQualityFast)
- etc_quality = rg_etc1::cLowQuality;
- else if (p.m_quality <= cCRNDXTQualityNormal)
- etc_quality = rg_etc1::cMediumQuality;
-
- rg_etc1::etc1_pack_params pack_params;
- pack_params.m_dithering = p.m_dithering;
- //pack_params.m_perceptual = p.m_perceptual;
- pack_params.m_quality = etc_quality;
- rg_etc1::pack_etc1_block(&dst_block, (uint32*)pPixels, pack_params);
-#else
- crn_etc_quality etc_quality = cCRNETCQualitySlow;
- if (p.m_quality <= cCRNDXTQualityFast)
- etc_quality = cCRNETCQualityFast;
- else if (p.m_quality <= cCRNDXTQualityNormal)
- etc_quality = cCRNETCQualityMedium;
-
- crn_etc1_pack_params pack_params;
- pack_params.m_perceptual = p.m_perceptual;
- pack_params.m_quality = etc_quality;
- pack_params.m_dithering = p.m_dithering;
-
- pack_etc1_block(dst_block, pPixels, pack_params, context.m_etc1_optimizer);
-#endif
- }
- else
-#if CRNLIB_SUPPORT_SQUISH
- if ((p.m_compressor == cCRNDXTCompressorSquish) && ((m_format == cDXT1) || (m_format == cDXT1A) || (m_format == cDXT3) || (m_format == cDXT5) || (m_format == cDXT5A)))
- {
- uint squish_flags = 0;
- if ((m_format == cDXT1) || (m_format == cDXT1A))
- squish_flags = squish::kDxt1;
- else if (m_format == cDXT3)
- squish_flags = squish::kDxt3;
- else if (m_format == cDXT5A)
- squish_flags = squish::kDxt5A;
- else
- squish_flags = squish::kDxt5;
-
- if (p.m_perceptual)
- squish_flags |= squish::kColourMetricPerceptual;
- else
- squish_flags |= squish::kColourMetricUniform;
-
- if (p.m_quality >= cCRNDXTQualityBetter)
- squish_flags |= squish::kColourIterativeClusterFit;
- else if (p.m_quality == cCRNDXTQualitySuperFast)
- squish_flags |= squish::kColourRangeFit;
-
- color_quad_u8 pixels[cDXTBlockSize * cDXTBlockSize];
-
- memcpy(pixels, pPixels, sizeof(color_quad_u8) * cDXTBlockSize * cDXTBlockSize);
-
- if (m_format == cDXT1)
- {
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- pixels[i].a = 255;
- }
- else if (m_format == cDXT1A)
- {
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- if (pixels[i].a < p.m_dxt1a_alpha_threshold)
- pixels[i].a = 0;
- else
- pixels[i].a = 255;
- }
-
- squish::Compress(reinterpret_cast<const squish::u8*>(pixels), pElement, squish_flags);
- }
-
- else
-#endif // CRNLIB_SUPPORT_SQUISH
- // RYG doesn't support DXT1A
- if ((p.m_compressor == cCRNDXTCompressorRYG) && ((m_format == cDXT1) || (m_format == cDXT5) || (m_format == cDXT5A)))
- {
- color_quad_u8 pixels[cDXTBlockSize * cDXTBlockSize];
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- pixels[i].r = pPixels[i].b;
- pixels[i].g = pPixels[i].g;
- pixels[i].b = pPixels[i].r;
-
- if (m_format == cDXT1)
- pixels[i].a = 255;
- else
- pixels[i].a = pPixels[i].a;
- }
-
- if (m_format == cDXT5A)
- ryg_dxt::sCompressDXT5ABlock((sU8*)pElement, (const sU32*)pixels, 0);
- else
- ryg_dxt::sCompressDXTBlock((sU8*)pElement, (const sU32*)pixels, m_format == cDXT5, 0);
- }
- else if ((p.m_compressor == cCRNDXTCompressorCRNF) && (m_format != cDXT1A))
- {
- for (uint element_index = 0; element_index < m_num_elements_per_block; element_index++, pElement++)
- {
- switch (m_element_type[element_index])
- {
- case cColorDXT1:
- {
- dxt1_block* pDXT1_block = reinterpret_cast<dxt1_block*>(pElement);
- dxt_fast::compress_color_block(pDXT1_block, pPixels, p.m_quality >= cCRNDXTQualityNormal);
-
- break;
- }
- case cAlphaDXT5:
- {
- dxt5_block* pDXT5_block = reinterpret_cast<dxt5_block*>(pElement);
- dxt_fast::compress_alpha_block(pDXT5_block, pPixels, m_element_component_index[element_index]);
-
- break;
- }
- case cAlphaDXT3:
- {
- const int comp_index = m_element_component_index[element_index];
-
- dxt3_block* pDXT3_block = reinterpret_cast<dxt3_block*>(pElement);
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- pDXT3_block->set_alpha(i & 3, i >> 2, pPixels[i][comp_index], true);
-
- break;
- }
- default: break;
- }
- }
- }
- else
- {
- dxt1_endpoint_optimizer& dxt1_optimizer = context.m_dxt1_optimizer;
- dxt5_endpoint_optimizer& dxt5_optimizer = context.m_dxt5_optimizer;
-
- for (uint element_index = 0; element_index < m_num_elements_per_block; element_index++, pElement++)
- {
- switch (m_element_type[element_index])
- {
- case cColorDXT1:
- {
- dxt1_block* pDXT1_block = reinterpret_cast<dxt1_block*>(pElement);
-
- bool pixels_have_alpha = false;
- if (m_format == cDXT1A)
- {
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- if (pPixels[i].a < p.m_dxt1a_alpha_threshold)
- {
- pixels_have_alpha = true;
- break;
- }
- }
-
- dxt1_endpoint_optimizer::results results;
- uint8 selectors[cDXTBlockSize * cDXTBlockSize];
- results.m_pSelectors = selectors;
-
- dxt1_endpoint_optimizer::params params;
- params.m_block_index = block_x + block_y * m_blocks_x;
- params.m_quality = p.m_quality;
- params.m_perceptual = p.m_perceptual;
- params.m_grayscale_sampling = p.m_grayscale_sampling;
- params.m_pixels_have_alpha = pixels_have_alpha;
- params.m_use_alpha_blocks = p.m_use_both_block_types;
- params.m_use_transparent_indices_for_black = p.m_use_transparent_indices_for_black;
- params.m_dxt1a_alpha_threshold = p.m_dxt1a_alpha_threshold;
- params.m_pPixels = pPixels;
- params.m_num_pixels = cDXTBlockSize * cDXTBlockSize;
- params.m_endpoint_caching = p.m_endpoint_caching;
- params.m_color_weights[0] = p.m_color_weights[0];
- params.m_color_weights[1] = p.m_color_weights[1];
- params.m_color_weights[2] = p.m_color_weights[2];
-
- if ((m_format != cDXT1) && (m_format != cDXT1A))
- params.m_use_alpha_blocks = false;
-
- if (!dxt1_optimizer.compute(params, results))
- {
- CRNLIB_ASSERT(0);
- break;
- }
-
- pDXT1_block->set_low_color(results.m_low_color);
- pDXT1_block->set_high_color(results.m_high_color);
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- pDXT1_block->set_selector(i & 3, i >> 2, selectors[i]);
-
- break;
- }
- case cAlphaDXT5:
- {
- dxt5_block* pDXT5_block = reinterpret_cast<dxt5_block*>(pElement);
-
- dxt5_endpoint_optimizer::results results;
-
- uint8 selectors[cDXTBlockSize * cDXTBlockSize];
- results.m_pSelectors = selectors;
-
- dxt5_endpoint_optimizer::params params;
- params.m_block_index = block_x + block_y * m_blocks_x;
- params.m_pPixels = pPixels;
- params.m_num_pixels = cDXTBlockSize * cDXTBlockSize;
- params.m_comp_index = m_element_component_index[element_index];
- params.m_quality = p.m_quality;
- params.m_use_both_block_types = p.m_use_both_block_types;
-
- if (!dxt5_optimizer.compute(params, results))
- {
- CRNLIB_ASSERT(0);
- break;
- }
-
- pDXT5_block->set_low_alpha(results.m_first_endpoint);
- pDXT5_block->set_high_alpha(results.m_second_endpoint);
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- pDXT5_block->set_selector(i & 3, i >> 2, selectors[i]);
-
- break;
- }
- case cAlphaDXT3:
- {
- const int comp_index = m_element_component_index[element_index];
-
- dxt3_block* pDXT3_block = reinterpret_cast<dxt3_block*>(pElement);
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- pDXT3_block->set_alpha(i & 3, i >> 2, pPixels[i][comp_index], true);
-
- break;
- }
- default: break;
- }
- }
- }
- }
-
- void dxt_image::get_block_endpoints(uint block_x, uint block_y, uint element_index, uint& packed_low_endpoint, uint& packed_high_endpoint) const
- {
- const element& block = get_element(block_x, block_y, element_index);
-
- switch (m_element_type[element_index])
- {
- case cColorETC1:
- {
- const etc1_block& src_block = *reinterpret_cast<const etc1_block*>(&block);
- if (src_block.get_diff_bit())
- {
- packed_low_endpoint = src_block.get_base5_color();
- packed_high_endpoint = src_block.get_delta3_color();
- }
- else
- {
- packed_low_endpoint = src_block.get_base4_color(0);
- packed_high_endpoint = src_block.get_base4_color(1);
- }
-
- break;
- }
- case cColorDXT1:
- {
- const dxt1_block& block1 = *reinterpret_cast<const dxt1_block*>(&block);
-
- packed_low_endpoint = block1.get_low_color();
- packed_high_endpoint = block1.get_high_color();
-
- break;
- }
- case cAlphaDXT5:
- {
- const dxt5_block& block5 = *reinterpret_cast<const dxt5_block*>(&block);
-
- packed_low_endpoint = block5.get_low_alpha();
- packed_high_endpoint = block5.get_high_alpha();
-
- break;
- }
- case cAlphaDXT3:
- {
- packed_low_endpoint = 0;
- packed_high_endpoint = 255;
-
- break;
- }
- default: break;
- }
- }
-
- int dxt_image::get_block_endpoints(uint block_x, uint block_y, uint element_index, color_quad_u8& low_endpoint, color_quad_u8& high_endpoint, bool scaled) const
- {
- uint l = 0, h = 0;
- get_block_endpoints(block_x, block_y, element_index, l, h);
-
- switch (m_element_type[element_index])
- {
- case cColorETC1:
- {
- const etc1_block& src_block = *reinterpret_cast<const etc1_block*>(&get_element(block_x, block_y, element_index));
- if (src_block.get_diff_bit())
- {
- low_endpoint = etc1_block::unpack_color5(static_cast<uint16>(l), scaled);
- etc1_block::unpack_color5(high_endpoint, static_cast<uint16>(l), static_cast<uint16>(h), scaled);
- }
- else
- {
- low_endpoint = etc1_block::unpack_color4(static_cast<uint16>(l), scaled);
- high_endpoint = etc1_block::unpack_color4(static_cast<uint16>(h), scaled);
- }
-
- return -1;
- }
- case cColorDXT1:
- {
- uint r, g, b;
-
- dxt1_block::unpack_color(r, g, b, static_cast<uint16>(l), scaled);
- low_endpoint.r = static_cast<uint8>(r);
- low_endpoint.g = static_cast<uint8>(g);
- low_endpoint.b = static_cast<uint8>(b);
-
- dxt1_block::unpack_color(r, g, b, static_cast<uint16>(h), scaled);
- high_endpoint.r = static_cast<uint8>(r);
- high_endpoint.g = static_cast<uint8>(g);
- high_endpoint.b = static_cast<uint8>(b);
-
- return -1;
- }
- case cAlphaDXT5:
- {
- const int component = m_element_component_index[element_index];
-
- low_endpoint[component] = static_cast<uint8>(l);
- high_endpoint[component] = static_cast<uint8>(h);
-
- return component;
- }
- case cAlphaDXT3:
- {
- const int component = m_element_component_index[element_index];
-
- low_endpoint[component] = static_cast<uint8>(l);
- high_endpoint[component] = static_cast<uint8>(h);
-
- return component;
- }
- default: break;
- }
-
- return 0;
- }
-
- uint dxt_image::get_block_colors(uint block_x, uint block_y, uint element_index, color_quad_u8* pColors, uint subblock_index)
- {
- const element& block = get_element(block_x, block_y, element_index);
-
- switch (m_element_type[element_index])
- {
- case cColorETC1:
- {
- const etc1_block& src_block = *reinterpret_cast<const etc1_block*>(&get_element(block_x, block_y, element_index));
- const uint table_index0 = src_block.get_inten_table(0);
- const uint table_index1 = src_block.get_inten_table(1);
- if (src_block.get_diff_bit())
- {
- const uint16 base_color5 = src_block.get_base5_color();
- const uint16 delta_color3 = src_block.get_delta3_color();
- if (subblock_index)
- etc1_block::get_diff_subblock_colors(pColors, base_color5, delta_color3, table_index1);
- else
- etc1_block::get_diff_subblock_colors(pColors, base_color5, table_index0);
- }
- else
- {
- if (subblock_index)
- {
- const uint16 base_color4_1 = src_block.get_base4_color(1);
- etc1_block::get_abs_subblock_colors(pColors, base_color4_1, table_index1);
- }
- else
- {
- const uint16 base_color4_0 = src_block.get_base4_color(0);
- etc1_block::get_abs_subblock_colors(pColors, base_color4_0, table_index0);
- }
- }
-
- break;
- }
- case cColorDXT1:
- {
- const dxt1_block& block1 = *reinterpret_cast<const dxt1_block*>(&block);
- return dxt1_block::get_block_colors(pColors, static_cast<uint16>(block1.get_low_color()), static_cast<uint16>(block1.get_high_color()));
- }
- case cAlphaDXT5:
- {
- const dxt5_block& block5 = *reinterpret_cast<const dxt5_block*>(&block);
-
- uint values[cDXT5SelectorValues];
-
- const uint n = dxt5_block::get_block_values(values, block5.get_low_alpha(), block5.get_high_alpha());
-
- const int comp_index = m_element_component_index[element_index];
- for (uint i = 0; i < n; i++)
- pColors[i][comp_index] = static_cast<uint8>(values[i]);
-
- return n;
- }
- case cAlphaDXT3:
- {
- const int comp_index = m_element_component_index[element_index];
- for (uint i = 0; i < 16; i++)
- pColors[i][comp_index] = static_cast<uint8>((i << 4) | i);
-
- return 16;
- }
- default: break;
- }
-
- return 0;
- }
-
- uint dxt_image::get_subblock_index(uint x, uint y, uint element_index) const
- {
- if (m_element_type[element_index] != cColorETC1)
- return 0;
-
- const uint block_x = x >> cDXTBlockShift;
- const uint block_y = y >> cDXTBlockShift;
-
- const element& block = get_element(block_x, block_y, element_index);
-
- const etc1_block& src_block = *reinterpret_cast<const etc1_block*>(&block);
- if (src_block.get_flip_bit())
- {
- return ((y & 3) >= 2) ? 1 : 0;
- }
- else
- {
- return ((x & 3) >= 2) ? 1 : 0;
- }
- }
-
- uint dxt_image::get_total_subblocks(uint element_index) const
- {
- return (m_element_type[element_index] == cColorETC1) ? 2 : 0;
- }
-
- uint dxt_image::get_selector(uint x, uint y, uint element_index) const
- {
- CRNLIB_ASSERT((x < m_width) && (y < m_height));
-
- const uint block_x = x >> cDXTBlockShift;
- const uint block_y = y >> cDXTBlockShift;
-
- const element& block = get_element(block_x, block_y, element_index);
-
- switch (m_element_type[element_index])
- {
- case cColorETC1:
- {
- const etc1_block& src_block = *reinterpret_cast<const etc1_block*>(&block);
- return src_block.get_selector(x & 3, y & 3);
- }
- case cColorDXT1:
- {
- const dxt1_block& block1 = *reinterpret_cast<const dxt1_block*>(&block);
- return block1.get_selector(x & 3, y & 3);
- }
- case cAlphaDXT5:
- {
- const dxt5_block& block5 = *reinterpret_cast<const dxt5_block*>(&block);
- return block5.get_selector(x & 3, y & 3);
- }
- case cAlphaDXT3:
- {
- const dxt3_block& block3 = *reinterpret_cast<const dxt3_block*>(&block);
- return block3.get_alpha(x & 3, y & 3, false);
- }
- default: break;
- }
-
- return 0;
- }
-
- void dxt_image::change_dxt1_to_dxt1a()
- {
- if (m_format == cDXT1)
- m_format = cDXT1A;
- }
-
- void dxt_image::flip_col(uint x)
- {
- const uint other_x = (m_blocks_x - 1) - x;
- for (uint y = 0; y < m_blocks_y; y++)
- {
- for (uint e = 0; e < get_elements_per_block(); e++)
- {
- element tmp[2] = { get_element(x, y, e), get_element(other_x, y, e) };
-
- for (uint i = 0; i < 2; i++)
- {
- switch (get_element_type(e))
- {
- case cColorDXT1: reinterpret_cast<dxt1_block*>(&tmp[i])->flip_x(); break;
- case cAlphaDXT3: reinterpret_cast<dxt3_block*>(&tmp[i])->flip_x(); break;
- case cAlphaDXT5: reinterpret_cast<dxt5_block*>(&tmp[i])->flip_x(); break;
- default: CRNLIB_ASSERT(0); break;
- }
- }
-
- get_element(x, y, e) = tmp[1];
- get_element(other_x, y, e) = tmp[0];
- }
- }
- }
-
- void dxt_image::flip_row(uint y)
- {
- const uint other_y = (m_blocks_y - 1) - y;
- for (uint x = 0; x < m_blocks_x; x++)
- {
- for (uint e = 0; e < get_elements_per_block(); e++)
- {
- element tmp[2] = { get_element(x, y, e), get_element(x, other_y, e) };
-
- for (uint i = 0; i < 2; i++)
- {
- switch (get_element_type(e))
- {
- case cColorDXT1: reinterpret_cast<dxt1_block*>(&tmp[i])->flip_y(); break;
- case cAlphaDXT3: reinterpret_cast<dxt3_block*>(&tmp[i])->flip_y(); break;
- case cAlphaDXT5: reinterpret_cast<dxt5_block*>(&tmp[i])->flip_y(); break;
- default: CRNLIB_ASSERT(0); break;
- }
- }
-
- get_element(x, y, e) = tmp[1];
- get_element(x, other_y, e) = tmp[0];
- }
- }
- }
-
- bool dxt_image::can_flip(uint axis_index)
- {
- if (m_format == cETC1)
- {
- // Can't reliably flip ETC1 textures (because of asymmetry in the 555/333 differential coding of subblock colors).
- return false;
- }
-
- uint d;
- if (axis_index)
- d = m_height;
- else
- d = m_width;
-
- if (d & 3)
- {
- if (d > 4)
- return false;
- }
-
- return true;
- }
-
- bool dxt_image::flip_x()
- {
- if (m_format == cETC1)
- {
- // Can't reliably flip ETC1 textures (because of asymmetry in the 555/333 differential coding of subblock colors).
- return false;
- }
-
- if ((m_width & 3) && (m_width > 4))
- return false;
-
- if (m_width == 1)
- return true;
-
- const uint mid_x = m_blocks_x / 2;
-
- for (uint x = 0; x < mid_x; x++)
- flip_col(x);
-
- if (m_blocks_x & 1)
- {
- const uint w = math::minimum(m_width, 4U);
- for (uint y = 0; y < m_blocks_y; y++)
- {
- for (uint e = 0; e < get_elements_per_block(); e++)
- {
- element tmp(get_element(mid_x, y, e));
- switch (get_element_type(e))
- {
- case cColorDXT1: reinterpret_cast<dxt1_block*>(&tmp)->flip_x(w, 4); break;
- case cAlphaDXT3: reinterpret_cast<dxt3_block*>(&tmp)->flip_x(w, 4); break;
- case cAlphaDXT5: reinterpret_cast<dxt5_block*>(&tmp)->flip_x(w, 4); break;
- default: CRNLIB_ASSERT(0); break;
- }
- get_element(mid_x, y, e) = tmp;
- }
- }
- }
-
- return true;
- }
-
- bool dxt_image::flip_y()
- {
- if (m_format == cETC1)
- {
- // Can't reliably flip ETC1 textures (because of asymmetry in the 555/333 differential coding of subblock colors).
- return false;
- }
-
- if ((m_height & 3) && (m_height > 4))
- return false;
-
- if (m_height == 1)
- return true;
-
- const uint mid_y = m_blocks_y / 2;
-
- for (uint y = 0; y < mid_y; y++)
- flip_row(y);
-
- if (m_blocks_y & 1)
- {
- const uint h = math::minimum(m_height, 4U);
- for (uint x = 0; x < m_blocks_x; x++)
- {
- for (uint e = 0; e < get_elements_per_block(); e++)
- {
- element tmp(get_element(x, mid_y, e));
- switch (get_element_type(e))
- {
- case cColorDXT1: reinterpret_cast<dxt1_block*>(&tmp)->flip_y(4, h); break;
- case cAlphaDXT3: reinterpret_cast<dxt3_block*>(&tmp)->flip_y(4, h); break;
- case cAlphaDXT5: reinterpret_cast<dxt5_block*>(&tmp)->flip_y(4, h); break;
- default: CRNLIB_ASSERT(0); break;
- }
- get_element(x, mid_y, e) = tmp;
- }
- }
- }
-
- return true;
- }
-
-} // namespace crnlib
-
-
-
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_image.h b/Libraries/crunch-ea9b8d/crnlib/crn_dxt_image.h
deleted file mode 100644
index 50b4838d..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dxt_image.h
+++ /dev/null
@@ -1,248 +0,0 @@
-// File: crn_dxt_image.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_dxt1.h"
-#include "crn_dxt5a.h"
-#include "crn_etc.h"
-#if CRNLIB_SUPPORT_ETC_A1
-#include "crn_etc_a1.h"
-#endif
-#include "crn_image.h"
-
-#define CRNLIB_SUPPORT_ATI_COMPRESS 0
-
-namespace crnlib
-{
- class task_pool;
-
- class dxt_image
- {
- public:
- dxt_image();
- dxt_image(const dxt_image& other);
- dxt_image& operator= (const dxt_image& rhs);
-
- void clear();
-
- inline bool is_valid() const { return m_blocks_x > 0; }
-
- uint get_width() const { return m_width; }
- uint get_height() const { return m_height; }
-
- uint get_blocks_x() const { return m_blocks_x; }
- uint get_blocks_y() const { return m_blocks_y; }
- uint get_total_blocks() const { return m_blocks_x * m_blocks_y; }
-
- uint get_elements_per_block() const { return m_num_elements_per_block; }
- uint get_bytes_per_block() const { return m_bytes_per_block; }
-
- dxt_format get_format() const { return m_format; }
-
- bool has_color() const { return (m_format == cDXT1) || (m_format == cDXT1A) || (m_format == cDXT3) || (m_format == cDXT5) || (m_format == cETC1); }
-
- // Will be pretty slow if the image is DXT1, as this method scans for alpha blocks/selectors.
- bool has_alpha() const;
-
- enum element_type
- {
- cUnused = 0,
-
- cColorDXT1, // DXT1 color block
-
- cAlphaDXT3, // DXT3 alpha block (only)
- cAlphaDXT5, // DXT5 alpha block (only)
-
- cColorETC1, // ETC1 color block
- };
-
- element_type get_element_type(uint element_index) const { CRNLIB_ASSERT(element_index < m_num_elements_per_block); return m_element_type[element_index]; }
-
- //Returns -1 for RGB, or [0,3]
- int8 get_element_component_index(uint element_index) const { CRNLIB_ASSERT(element_index < m_num_elements_per_block); return m_element_component_index[element_index]; }
-
- struct element
- {
- uint8 m_bytes[8];
-
- uint get_le_word(uint index) const { CRNLIB_ASSERT(index < 4); return m_bytes[index*2] | (m_bytes[index * 2 + 1] << 8); }
- uint get_be_word(uint index) const { CRNLIB_ASSERT(index < 4); return m_bytes[index*2 + 1] | (m_bytes[index * 2] << 8); }
-
- void set_le_word(uint index, uint val) { CRNLIB_ASSERT((index < 4) && (val <= cUINT16_MAX)); m_bytes[index*2] = static_cast<uint8>(val & 0xFF); m_bytes[index * 2 + 1] = static_cast<uint8>((val >> 8) & 0xFF); }
- void set_be_word(uint index, uint val) { CRNLIB_ASSERT((index < 4) && (val <= cUINT16_MAX)); m_bytes[index*2+1] = static_cast<uint8>(val & 0xFF); m_bytes[index * 2] = static_cast<uint8>((val >> 8) & 0xFF); }
-
- void clear()
- {
- memset(this, 0, sizeof(*this));
- }
- };
-
- typedef crnlib::vector<element> element_vec;
-
- bool init(dxt_format fmt, uint width, uint height, bool clear_elements);
- bool init(dxt_format fmt, uint width, uint height, uint num_elements, element* pElements, bool create_copy);
-
- struct pack_params
- {
- pack_params()
- {
- clear();
- }
-
- void clear()
- {
- m_quality = cCRNDXTQualityUber;
- m_perceptual = true;
- m_dithering = false;
- m_grayscale_sampling = false;
- m_use_both_block_types = true;
- m_endpoint_caching = true;
- m_compressor = cCRNDXTCompressorCRN;
- m_pProgress_callback = NULL;
- m_pProgress_callback_user_data_ptr = NULL;
- m_dxt1a_alpha_threshold = 128;
- m_num_helper_threads = 0;
- m_progress_start = 0;
- m_progress_range = 100;
- m_use_transparent_indices_for_black = false;
- m_pTask_pool = NULL;
- m_color_weights[0] = 1;
- m_color_weights[1] = 1;
- m_color_weights[2] = 1;
- }
-
- void init(const crn_comp_params &params)
- {
- m_perceptual = (params.m_flags & cCRNCompFlagPerceptual) != 0;
- m_num_helper_threads = params.m_num_helper_threads;
- m_use_both_block_types = (params.m_flags & cCRNCompFlagUseBothBlockTypes) != 0;
- m_use_transparent_indices_for_black = (params.m_flags & cCRNCompFlagUseTransparentIndicesForBlack) != 0;
- m_dxt1a_alpha_threshold = params.m_dxt1a_alpha_threshold;
- m_quality = params.m_dxt_quality;
- m_endpoint_caching = (params.m_flags & cCRNCompFlagDisableEndpointCaching) == 0;
- m_grayscale_sampling = (params.m_flags & cCRNCompFlagGrayscaleSampling) != 0;
- m_compressor = params.m_dxt_compressor_type;
- }
-
- uint m_dxt1a_alpha_threshold;
-
- uint m_num_helper_threads;
-
- crn_dxt_quality m_quality;
-
- crn_dxt_compressor_type m_compressor;
-
- bool m_perceptual;
- bool m_dithering;
- bool m_grayscale_sampling;
- bool m_use_both_block_types;
- bool m_endpoint_caching;
- bool m_use_transparent_indices_for_black;
-
- typedef bool (*progress_callback_func)(uint percentage_complete, void* pUser_data_ptr);
- progress_callback_func m_pProgress_callback;
- void* m_pProgress_callback_user_data_ptr;
-
- uint m_progress_start;
- uint m_progress_range;
-
- task_pool *m_pTask_pool;
-
- int m_color_weights[3];
- };
-
- bool init(dxt_format fmt, const image_u8& img, const pack_params& p = dxt_image::pack_params());
-
- bool unpack(image_u8& img) const;
-
- void endian_swap();
-
- uint get_total_elements() const { return m_elements.size(); }
-
- const element_vec& get_element_vec() const { return m_elements; }
- element_vec& get_element_vec() { return m_elements; }
-
- const element& get_element(uint block_x, uint block_y, uint element_index) const;
- element& get_element(uint block_x, uint block_y, uint element_index);
-
- const element* get_element_ptr() const { return m_pElements; }
- element* get_element_ptr() { return m_pElements; }
-
- uint get_size_in_bytes() const { return m_elements.size() * sizeof(element); }
- uint get_row_pitch_in_bytes() const { return m_blocks_x * m_bytes_per_block; }
-
- color_quad_u8 get_pixel(uint x, uint y) const;
- uint get_pixel_alpha(uint x, uint y, uint element_index) const;
-
- void set_pixel(uint x, uint y, const color_quad_u8& c, bool perceptual = true);
-
- // get_block_pixels() only sets those components stored in the image!
- bool get_block_pixels(uint block_x, uint block_y, color_quad_u8* pPixels) const;
-
- struct set_block_pixels_context
- {
- dxt1_endpoint_optimizer m_dxt1_optimizer;
- dxt5_endpoint_optimizer m_dxt5_optimizer;
- pack_etc1_block_context m_etc1_optimizer;
-#if CRNLIB_SUPPORT_ETC_A1
- etc_a1::pack_etc1_block_context m_etc1_a1_optimizer;
-#endif
- };
-
- void set_block_pixels(uint block_x, uint block_y, const color_quad_u8* pPixels, const pack_params& p, set_block_pixels_context& context);
- void set_block_pixels(uint block_x, uint block_y, const color_quad_u8* pPixels, const pack_params& p);
-
- void get_block_endpoints(uint block_x, uint block_y, uint element_index, uint& packed_low_endpoint, uint& packed_high_endpoint) const;
-
- // Returns a value representing the component(s) that where actually set, where -1 = RGB.
- // This method does not always set every component!
- int get_block_endpoints(uint block_x, uint block_y, uint element_index, color_quad_u8& low_endpoint, color_quad_u8& high_endpoint, bool scaled = true) const;
-
- // pColors should point to a 16 entry array, to handle DXT3.
- // Returns the number of block colors: 3, 4, 6, 8, or 16.
- uint get_block_colors(uint block_x, uint block_y, uint element_index, color_quad_u8* pColors, uint subblock_index = 0);
-
- uint get_subblock_index(uint x, uint y, uint element_index) const;
- uint get_total_subblocks(uint element_index) const;
-
- uint get_selector(uint x, uint y, uint element_index) const;
-
- void change_dxt1_to_dxt1a();
-
- bool can_flip(uint axis_index);
-
- // Returns true if the texture can actually be flipped.
- bool flip_x();
- bool flip_y();
-
- private:
- element_vec m_elements;
- element* m_pElements;
-
- uint m_width;
- uint m_height;
-
- uint m_blocks_x;
- uint m_blocks_y;
- uint m_total_blocks;
- uint m_total_elements;
-
- uint m_num_elements_per_block; // 1 or 2
- uint m_bytes_per_block; // 8 or 16
-
- int8 m_element_component_index[2];
- element_type m_element_type[2];
-
- dxt_format m_format; // DXT1, 1A, 3, 5, N/3DC, or 5A
-
- bool init_internal(dxt_format fmt, uint width, uint height);
- void init_task(uint64 data, void* pData_ptr);
-
-#if CRNLIB_SUPPORT_ATI_COMPRESS
- bool init_ati_compress(dxt_format fmt, const image_u8& img, const pack_params& p);
-#endif
-
- void flip_col(uint x);
- void flip_row(uint y);
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dynamic_stream.h b/Libraries/crunch-ea9b8d/crnlib/crn_dynamic_stream.h
deleted file mode 100644
index f134b213..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dynamic_stream.h
+++ /dev/null
@@ -1,206 +0,0 @@
-// File: crn_dynamic_stream.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_data_stream.h"
-
-namespace crnlib
-{
- class dynamic_stream : public data_stream
- {
- public:
- dynamic_stream(uint initial_size, const char* pName = "dynamic_stream", uint attribs = cDataStreamSeekable | cDataStreamWritable | cDataStreamReadable) :
- data_stream(pName, attribs),
- m_ofs(0)
- {
- open(initial_size, pName, attribs);
- }
-
- dynamic_stream(const void* pBuf, uint size, const char* pName = "dynamic_stream", uint attribs = cDataStreamSeekable | cDataStreamWritable | cDataStreamReadable) :
- data_stream(pName, attribs),
- m_ofs(0)
- {
- open(pBuf, size, pName, attribs);
- }
-
- dynamic_stream() :
- data_stream(),
- m_ofs(0)
- {
- open();
- }
-
- virtual ~dynamic_stream()
- {
- }
-
- bool open(uint initial_size = 0, const char* pName = "dynamic_stream", uint attribs = cDataStreamSeekable | cDataStreamWritable | cDataStreamReadable)
- {
- close();
-
- m_opened = true;
- m_buf.clear();
- m_buf.resize(initial_size);
- m_ofs = 0;
- m_name.set(pName ? pName : "dynamic_stream");
- m_attribs = static_cast<attribs_t>(attribs);
- return true;
- }
-
- bool reopen(const char* pName, uint attribs)
- {
- if (!m_opened)
- {
- return open(0, pName, attribs);
- }
-
- m_name.set(pName ? pName : "dynamic_stream");
- m_attribs = static_cast<attribs_t>(attribs);
- return true;
- }
-
- bool open(const void* pBuf, uint size, const char* pName = "dynamic_stream", uint attribs = cDataStreamSeekable | cDataStreamWritable | cDataStreamReadable)
- {
- if (!m_opened)
- {
- m_opened = true;
- m_buf.resize(size);
- if (size)
- {
- CRNLIB_ASSERT(pBuf);
- memcpy(&m_buf[0], pBuf, size);
- }
- m_ofs = 0;
- m_name.set(pName ? pName : "dynamic_stream");
- m_attribs = static_cast<attribs_t>(attribs);
- return true;
- }
-
- return false;
- }
-
- virtual bool close()
- {
- if (m_opened)
- {
- m_opened = false;
- m_buf.clear();
- m_ofs = 0;
- return true;
- }
-
- return false;
- }
-
- const crnlib::vector<uint8>& get_buf() const { return m_buf; }
- crnlib::vector<uint8>& get_buf() { return m_buf; }
-
- void reserve(uint size)
- {
- if (m_opened)
- {
- m_buf.reserve(size);
- }
- }
-
- virtual const void* get_ptr() const { return m_buf.empty() ? NULL : &m_buf[0]; }
-
- virtual uint read(void* pBuf, uint len)
- {
- CRNLIB_ASSERT(pBuf && (len <= 0x7FFFFFFF));
-
- if ((!m_opened) || (!is_readable()) || (!len))
- return 0;
-
- CRNLIB_ASSERT(m_ofs <= m_buf.size());
-
- uint bytes_left = m_buf.size() - m_ofs;
-
- len = math::minimum<uint>(len, bytes_left);
-
- if (len)
- memcpy(pBuf, &m_buf[m_ofs], len);
-
- m_ofs += len;
-
- return len;
- }
-
- virtual uint write(const void* pBuf, uint len)
- {
- CRNLIB_ASSERT(pBuf && (len <= 0x7FFFFFFF));
-
- if ((!m_opened) || (!is_writable()) || (!len))
- return 0;
-
- CRNLIB_ASSERT(m_ofs <= m_buf.size());
-
- uint new_ofs = m_ofs + len;
- if (new_ofs > m_buf.size())
- m_buf.resize(new_ofs);
-
- memcpy(&m_buf[m_ofs], pBuf, len);
- m_ofs = new_ofs;
-
- return len;
- }
-
- virtual bool flush()
- {
- if (!m_opened)
- return false;
-
- return true;
- }
-
- virtual uint64 get_size()
- {
- if (!m_opened)
- return 0;
-
- return m_buf.size();
- }
-
- virtual uint64 get_remaining()
- {
- if (!m_opened)
- return 0;
-
- CRNLIB_ASSERT(m_ofs <= m_buf.size());
-
- return m_buf.size() - m_ofs;
- }
-
- virtual uint64 get_ofs()
- {
- if (!m_opened)
- return 0;
-
- return m_ofs;
- }
-
- virtual bool seek(int64 ofs, bool relative)
- {
- if ((!m_opened) || (!is_seekable()))
- return false;
-
- int64 new_ofs = relative ? (m_ofs + ofs) : ofs;
-
- if (new_ofs < 0)
- return false;
- else if (new_ofs > m_buf.size())
- return false;
-
- m_ofs = static_cast<uint>(new_ofs);
-
- post_seek();
-
- return true;
- }
-
- private:
- crnlib::vector<uint8> m_buf;
- uint m_ofs;
- };
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dynamic_string.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_dynamic_string.cpp
deleted file mode 100644
index e3e76bde..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dynamic_string.cpp
+++ /dev/null
@@ -1,668 +0,0 @@
-// File: crn_dynamic_string.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_strutils.h"
-
-namespace crnlib
-{
- dynamic_string g_empty_dynamic_string;
-
- dynamic_string::dynamic_string(eVarArg dummy, const char* p, ...) :
- m_buf_size(0), m_len(0), m_pStr(NULL)
- {
- dummy;
-
- CRNLIB_ASSERT(p);
-
- va_list args;
- va_start(args, p);
- format_args(p, args);
- va_end(args);
- }
-
- dynamic_string::dynamic_string(const char* p) :
- m_buf_size(0), m_len(0), m_pStr(NULL)
- {
- CRNLIB_ASSERT(p);
- set(p);
- }
-
- dynamic_string::dynamic_string(const char* p, uint len) :
- m_buf_size(0), m_len(0), m_pStr(NULL)
- {
- CRNLIB_ASSERT(p);
- set_from_buf(p, len);
- }
-
- dynamic_string::dynamic_string(const dynamic_string& other) :
- m_buf_size(0), m_len(0), m_pStr(NULL)
- {
- set(other);
- }
-
- void dynamic_string::clear()
- {
- check();
-
- if (m_pStr)
- {
- crnlib_delete_array(m_pStr);
- m_pStr = NULL;
-
- m_len = 0;
- m_buf_size = 0;
- }
- }
-
- void dynamic_string::empty()
- {
- truncate(0);
- }
-
- void dynamic_string::optimize()
- {
- if (!m_len)
- clear();
- else
- {
- uint min_buf_size = math::next_pow2((uint)m_len + 1);
- if (m_buf_size > min_buf_size)
- {
- char* p = crnlib_new_array<char>(min_buf_size);
- memcpy(p, m_pStr, m_len + 1);
-
- crnlib_delete_array(m_pStr);
- m_pStr = p;
-
- m_buf_size = static_cast<uint16>(min_buf_size);
-
- check();
- }
- }
- }
-
- int dynamic_string::compare(const char* p, bool case_sensitive) const
- {
- CRNLIB_ASSERT(p);
-
- const int result = (case_sensitive ? strcmp : crn_stricmp)(get_ptr_priv(), p);
-
- if (result < 0)
- return -1;
- else if (result > 0)
- return 1;
-
- return 0;
- }
-
- int dynamic_string::compare(const dynamic_string& rhs, bool case_sensitive) const
- {
- return compare(rhs.get_ptr_priv(), case_sensitive);
- }
-
- dynamic_string& dynamic_string::set(const char* p, uint max_len)
- {
- CRNLIB_ASSERT(p);
-
- const uint len = math::minimum<uint>(max_len, static_cast<uint>(strlen(p)));
- CRNLIB_ASSERT(len < cUINT16_MAX);
-
- if ((!len) || (len >= cUINT16_MAX))
- clear();
- else if ((m_pStr) && (p >= m_pStr) && (p < (m_pStr + m_buf_size)))
- {
- if (m_pStr != p)
- memmove(m_pStr, p, len);
- m_pStr[len] = '\0';
- m_len = static_cast<uint16>(len);
- }
- else if (ensure_buf(len, false))
- {
- m_len = static_cast<uint16>(len);
- memcpy(m_pStr, p, m_len + 1);
- }
-
- check();
-
- return *this;
- }
-
- dynamic_string& dynamic_string::set(const dynamic_string& other, uint max_len)
- {
- if (this == &other)
- {
- if (max_len < m_len)
- {
- m_pStr[max_len] = '\0';
- m_len = static_cast<uint16>(max_len);
- }
- }
- else
- {
- const uint len = math::minimum<uint>(max_len, other.m_len);
-
- if (!len)
- clear();
- else if (ensure_buf(len, false))
- {
- m_len = static_cast<uint16>(len);
- memcpy(m_pStr, other.get_ptr_priv(), m_len);
- m_pStr[len] = '\0';
- }
- }
-
- check();
-
- return *this;
- }
-
- bool dynamic_string::set_len(uint new_len, char fill_char)
- {
- if ((new_len >= cUINT16_MAX) || (!fill_char))
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- uint cur_len = m_len;
-
- if (ensure_buf(new_len, true))
- {
- if (new_len > cur_len)
- memset(m_pStr + cur_len, fill_char, new_len - cur_len);
-
- m_pStr[new_len] = 0;
-
- m_len = static_cast<uint16>(new_len);
-
- check();
- }
-
- return true;
- }
-
- dynamic_string& dynamic_string::set_from_raw_buf_and_assume_ownership(char *pBuf, uint buf_size_in_chars, uint len_in_chars)
- {
- CRNLIB_ASSERT(buf_size_in_chars <= cUINT16_MAX);
- CRNLIB_ASSERT(math::is_power_of_2(buf_size_in_chars) || (buf_size_in_chars == cUINT16_MAX));
- CRNLIB_ASSERT((len_in_chars + 1) <= buf_size_in_chars);
-
- clear();
-
- m_pStr = pBuf;
- m_buf_size = static_cast<uint16>(buf_size_in_chars);
- m_len = static_cast<uint16>(len_in_chars);
-
- check();
-
- return *this;
- }
-
- dynamic_string& dynamic_string::set_from_buf(const void* pBuf, uint buf_size)
- {
- CRNLIB_ASSERT(pBuf);
-
- if (buf_size >= cUINT16_MAX)
- {
- clear();
- return *this;
- }
-
-#ifdef CRNLIB_BUILD_DEBUG
- if ((buf_size) && (memchr(pBuf, 0, buf_size) != NULL))
- {
- CRNLIB_ASSERT(0);
- clear();
- return *this;
- }
-#endif
-
- if (ensure_buf(buf_size, false))
- {
- if (buf_size)
- memcpy(m_pStr, pBuf, buf_size);
-
- m_pStr[buf_size] = 0;
-
- m_len = static_cast<uint16>(buf_size);
-
- check();
- }
-
- return *this;
- }
-
- dynamic_string& dynamic_string::set_char(uint index, char c)
- {
- CRNLIB_ASSERT(index <= m_len);
-
- if (!c)
- truncate(index);
- else if (index < m_len)
- {
- m_pStr[index] = c;
-
- check();
- }
- else if (index == m_len)
- append_char(c);
-
- return *this;
- }
-
- dynamic_string& dynamic_string::append_char(char c)
- {
- if (ensure_buf(m_len + 1))
- {
- m_pStr[m_len] = c;
- m_pStr[m_len + 1] = '\0';
- m_len++;
- check();
- }
-
- return *this;
- }
-
- dynamic_string& dynamic_string::truncate(uint new_len)
- {
- if (new_len < m_len)
- {
- m_pStr[new_len] = '\0';
- m_len = static_cast<uint16>(new_len);
- check();
- }
- return *this;
- }
-
- dynamic_string& dynamic_string::tolower()
- {
- if (m_len)
- {
-#ifdef _MSC_VER
- _strlwr_s(get_ptr_priv(), m_buf_size);
-#else
- strlwr(get_ptr_priv());
-#endif
- }
- return *this;
- }
-
- dynamic_string& dynamic_string::toupper()
- {
- if (m_len)
- {
-#ifdef _MSC_VER
- _strupr_s(get_ptr_priv(), m_buf_size);
-#else
- strupr(get_ptr_priv());
-#endif
- }
- return *this;
- }
-
- dynamic_string& dynamic_string::append(const char* p)
- {
- CRNLIB_ASSERT(p);
-
- uint len = static_cast<uint>(strlen(p));
- uint new_total_len = m_len + len;
- if ((new_total_len) && ensure_buf(new_total_len))
- {
- memcpy(m_pStr + m_len, p, len + 1);
- m_len = static_cast<uint16>(m_len + len);
- check();
- }
-
- return *this;
- }
-
- dynamic_string& dynamic_string::append(const dynamic_string& other)
- {
- uint len = other.m_len;
- uint new_total_len = m_len + len;
- if ((new_total_len) && ensure_buf(new_total_len))
- {
- memcpy(m_pStr + m_len, other.get_ptr_priv(), len + 1);
- m_len = static_cast<uint16>(m_len + len);
- check();
- }
-
- return *this;
- }
-
- dynamic_string operator+ (const char* p, const dynamic_string& a)
- {
- return dynamic_string(p).append(a);
- }
-
- dynamic_string operator+ (const dynamic_string& a, const char* p)
- {
- return dynamic_string(a).append(p);
- }
-
- dynamic_string operator+ (const dynamic_string& a, const dynamic_string& b)
- {
- return dynamic_string(a).append(b);
- }
-
- dynamic_string& dynamic_string::format_args(const char* p, va_list args)
- {
- CRNLIB_ASSERT(p);
-
- const uint cBufSize = 4096;
- char buf[cBufSize];
-
-#ifdef _MSC_VER
- int l = vsnprintf_s(buf, cBufSize, _TRUNCATE, p, args);
-#else
- int l = vsnprintf(buf, cBufSize, p, args);
-#endif
- if (l <= 0)
- clear();
- else if (ensure_buf(l, false))
- {
- memcpy(m_pStr, buf, l + 1);
-
- m_len = static_cast<uint16>(l);
-
- check();
- }
-
- return *this;
- }
-
- dynamic_string& dynamic_string::format(const char* p, ...)
- {
- CRNLIB_ASSERT(p);
-
- va_list args;
- va_start(args, p);
- format_args(p, args);
- va_end(args);
- return *this;
- }
-
- dynamic_string& dynamic_string::crop(uint start, uint len)
- {
- if (start >= m_len)
- {
- clear();
- return *this;
- }
-
- len = math::minimum<uint>(len, m_len - start);
-
- if (start)
- memmove(get_ptr_priv(), get_ptr_priv() + start, len);
-
- m_pStr[len] = '\0';
-
- m_len = static_cast<uint16>(len);
-
- check();
-
- return *this;
- }
-
- dynamic_string& dynamic_string::substring(uint start, uint end)
- {
- CRNLIB_ASSERT(start <= end);
- if (start > end)
- return *this;
- return crop(start, end - start);
- }
-
- dynamic_string& dynamic_string::left(uint len)
- {
- return substring(0, len);
- }
-
- dynamic_string& dynamic_string::mid(uint start, uint len)
- {
- return crop(start, len);
- }
-
- dynamic_string& dynamic_string::right(uint start)
- {
- return substring(start, get_len());
- }
-
- dynamic_string& dynamic_string::tail(uint num)
- {
- return substring(math::maximum<int>(static_cast<int>(get_len()) - static_cast<int>(num), 0), get_len());
- }
-
- dynamic_string& dynamic_string::unquote()
- {
- if (m_len >= 2)
- {
- if ( ((*this)[0] == '\"') && ((*this)[m_len - 1] == '\"') )
- {
- return mid(1, m_len - 2);
- }
- }
-
- return *this;
- }
-
- int dynamic_string::find_left(const char* p, bool case_sensitive) const
- {
- CRNLIB_ASSERT(p);
-
- const int p_len = (int)strlen(p);
-
- for (int i = 0; i <= (m_len - p_len); i++)
- if ((case_sensitive ? strncmp : _strnicmp)(p, &m_pStr[i], p_len) == 0)
- return i;
-
- return -1;
- }
-
- bool dynamic_string::contains(const char* p, bool case_sensitive) const
- {
- return find_left(p, case_sensitive) >= 0;
- }
-
- uint dynamic_string::count_char(char c) const
- {
- uint count = 0;
- for (uint i = 0; i < m_len; i++)
- if (m_pStr[i] == c)
- count++;
- return count;
- }
-
- int dynamic_string::find_left(char c) const
- {
- for (uint i = 0; i < m_len; i++)
- if (m_pStr[i] == c)
- return i;
- return -1;
- }
-
- int dynamic_string::find_right(char c) const
- {
- for (int i = (int)m_len - 1; i >= 0; i--)
- if (m_pStr[i] == c)
- return i;
- return -1;
- }
-
- int dynamic_string::find_right(const char* p, bool case_sensitive) const
- {
- CRNLIB_ASSERT(p);
- const int p_len = (int)strlen(p);
-
- for (int i = m_len - p_len; i >= 0; i--)
- if ((case_sensitive ? strncmp : _strnicmp)(p, &m_pStr[i], p_len) == 0)
- return i;
-
- return -1;
- }
-
- dynamic_string& dynamic_string::trim()
- {
- int s, e;
- for (s = 0; s < (int)m_len; s++)
- if (!isspace(m_pStr[s]))
- break;
-
- for (e = m_len - 1; e > s; e--)
- if (!isspace(m_pStr[e]))
- break;
-
- return crop(s, e - s + 1);
- }
-
- dynamic_string& dynamic_string::trim_crlf()
- {
- int s = 0, e;
-
- for (e = m_len - 1; e > s; e--)
- if ((m_pStr[e] != 13) && (m_pStr[e] != 10))
- break;
-
- return crop(s, e - s + 1);
- }
-
- dynamic_string& dynamic_string::remap(int from_char, int to_char)
- {
- for (uint i = 0; i < m_len; i++)
- if (m_pStr[i] == from_char)
- m_pStr[i] = (char)to_char;
- return *this;
- }
-
-#ifdef CRNLIB_BUILD_DEBUG
- void dynamic_string::check() const
- {
- if (!m_pStr)
- {
- CRNLIB_ASSERT(!m_buf_size && !m_len);
- }
- else
- {
- CRNLIB_ASSERT(m_buf_size);
- CRNLIB_ASSERT((m_buf_size == cUINT16_MAX) || math::is_power_of_2((uint32)m_buf_size));
- CRNLIB_ASSERT(m_len < m_buf_size);
- CRNLIB_ASSERT(!m_pStr[m_len]);
-#if CRNLIB_SLOW_STRING_LEN_CHECKS
- CRNLIB_ASSERT(strlen(m_pStr) == m_len);
-#endif
- }
- }
-#endif
-
- bool dynamic_string::ensure_buf(uint len, bool preserve_contents)
- {
- uint buf_size_needed = len + 1;
-
- CRNLIB_ASSERT(buf_size_needed <= cUINT16_MAX);
-
- if (buf_size_needed <= cUINT16_MAX)
- {
- if (buf_size_needed > m_buf_size)
- expand_buf(buf_size_needed, preserve_contents);
- }
-
- return m_buf_size >= buf_size_needed;
- }
-
- bool dynamic_string::expand_buf(uint new_buf_size, bool preserve_contents)
- {
- new_buf_size = math::minimum<uint>(cUINT16_MAX, math::next_pow2(math::maximum<uint>(m_buf_size, new_buf_size)));
-
- if (new_buf_size != m_buf_size)
- {
- char* p = crnlib_new_array<char>(new_buf_size);
-
- if (preserve_contents)
- memcpy(p, get_ptr_priv(), m_len + 1);
-
- crnlib_delete_array(m_pStr);
- m_pStr = p;
-
- m_buf_size = static_cast<uint16>(new_buf_size);
-
- if (preserve_contents)
- check();
- }
-
- return m_buf_size >= new_buf_size;
- }
-
- void dynamic_string::swap(dynamic_string& other)
- {
- utils::swap(other.m_buf_size, m_buf_size);
- utils::swap(other.m_len, m_len);
- utils::swap(other.m_pStr, m_pStr);
- }
-
- int dynamic_string::serialize(void* pBuf, uint buf_size, bool little_endian) const
- {
- uint buf_left = buf_size;
-
- //if (m_len > cUINT16_MAX)
- // return -1;
- CRNLIB_ASSUME(sizeof(m_len) == sizeof(uint16));
-
- if (!utils::write_val((uint16)m_len, pBuf, buf_left, little_endian))
- return -1;
-
- if (buf_left < m_len)
- return -1;
-
- memcpy(pBuf, get_ptr(), m_len);
-
- buf_left -= m_len;
-
- return buf_size - buf_left;
- }
-
- int dynamic_string::deserialize(const void* pBuf, uint buf_size, bool little_endian)
- {
- uint buf_left = buf_size;
-
- if (buf_left < sizeof(uint16)) return -1;
-
- uint16 l;
- if (!utils::read_obj(l, pBuf, buf_left, little_endian))
- return -1;
-
- if (buf_left < l)
- return -1;
-
- set_from_buf(pBuf, l);
-
- buf_left -= l;
-
- return buf_size - buf_left;
- }
-
- void dynamic_string::translate_lf_to_crlf()
- {
- if (find_left(0x0A) < 0)
- return;
-
- dynamic_string tmp;
- tmp.ensure_buf(m_len + 2);
-
- // normal sequence is 0x0D 0x0A (CR LF, \r\n)
-
- int prev_char = -1;
- for (uint i = 0; i < get_len(); i++)
- {
- const int cur_char = (*this)[i];
-
- if ((cur_char == 0x0A) && (prev_char != 0x0D))
- tmp.append_char(0x0D);
-
- tmp.append_char(cur_char);
-
- prev_char = cur_char;
- }
-
- swap(tmp);
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_dynamic_string.h b/Libraries/crunch-ea9b8d/crnlib/crn_dynamic_string.h
deleted file mode 100644
index e5eeac31..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_dynamic_string.h
+++ /dev/null
@@ -1,173 +0,0 @@
-// File: crn_dynamic_string.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- enum { cMaxDynamicStringLen = cUINT16_MAX - 1 };
- class dynamic_string
- {
- public:
- inline dynamic_string() : m_buf_size(0), m_len(0), m_pStr(NULL) { }
- dynamic_string(eVarArg dummy, const char* p, ...);
- dynamic_string(const char* p);
- dynamic_string(const char* p, uint len);
- dynamic_string(const dynamic_string& other);
-
- inline ~dynamic_string() { if (m_pStr) crnlib_delete_array(m_pStr); }
-
- // Truncates the string to 0 chars and frees the buffer.
- void clear();
- void optimize();
-
- // Truncates the string to 0 chars, but does not free the buffer.
- void empty();
- inline const char *assume_ownership() { const char *p = m_pStr; m_pStr = NULL; m_len = 0; m_buf_size = 0; return p; }
-
- inline uint get_len() const { return m_len; }
- inline bool is_empty() const { return !m_len; }
-
- inline const char* get_ptr() const { return m_pStr ? m_pStr : ""; }
- inline const char* c_str() const { return get_ptr(); }
-
- inline const char* get_ptr_raw() const { return m_pStr; }
- inline char* get_ptr_raw() { return m_pStr; }
-
- inline char front() const { return m_len ? m_pStr[0] : '\0'; }
- inline char back() const { return m_len ? m_pStr[m_len - 1] : '\0'; }
-
- inline char operator[] (uint i) const { CRNLIB_ASSERT(i <= m_len); return get_ptr()[i]; }
-
- inline operator size_t() const { return fast_hash(get_ptr(), m_len) ^ fast_hash(&m_len, sizeof(m_len)); }
-
- int compare(const char* p, bool case_sensitive = false) const;
- int compare(const dynamic_string& rhs, bool case_sensitive = false) const;
-
- inline bool operator== (const dynamic_string& rhs) const { return compare(rhs) == 0; }
- inline bool operator== (const char* p) const { return compare(p) == 0; }
-
- inline bool operator!= (const dynamic_string& rhs) const { return compare(rhs) != 0; }
- inline bool operator!= (const char* p) const { return compare(p) != 0; }
-
- inline bool operator< (const dynamic_string& rhs) const { return compare(rhs) < 0; }
- inline bool operator< (const char* p) const { return compare(p) < 0; }
-
- inline bool operator> (const dynamic_string& rhs) const { return compare(rhs) > 0; }
- inline bool operator> (const char* p) const { return compare(p) > 0; }
-
- inline bool operator<= (const dynamic_string& rhs) const { return compare(rhs) <= 0; }
- inline bool operator<= (const char* p) const { return compare(p) <= 0; }
-
- inline bool operator>= (const dynamic_string& rhs) const { return compare(rhs) >= 0; }
- inline bool operator>= (const char* p) const { return compare(p) >= 0; }
-
- friend inline bool operator== (const char* p, const dynamic_string& rhs) { return rhs.compare(p) == 0; }
-
- dynamic_string& set(const char* p, uint max_len = UINT_MAX);
- dynamic_string& set(const dynamic_string& other, uint max_len = UINT_MAX);
-
- bool set_len(uint new_len, char fill_char = ' ');
-
- // Set from non-zero terminated buffer.
- dynamic_string& set_from_buf(const void* pBuf, uint buf_size);
-
- dynamic_string& operator= (const dynamic_string& rhs) { return set(rhs); }
- dynamic_string& operator= (const char* p) { return set(p); }
-
- dynamic_string& set_char(uint index, char c);
- dynamic_string& append_char(char c);
- dynamic_string& append_char(int c) { CRNLIB_ASSERT((c >= 0) && (c <= 255)); return append_char(static_cast<char>(c)); }
- dynamic_string& truncate(uint new_len);
- dynamic_string& tolower();
- dynamic_string& toupper();
-
- dynamic_string& append(const char* p);
- dynamic_string& append(const dynamic_string& other);
- dynamic_string& operator += (const char* p) { return append(p); }
- dynamic_string& operator += (const dynamic_string& other) { return append(other); }
-
- friend dynamic_string operator+ (const char* p, const dynamic_string& a);
- friend dynamic_string operator+ (const dynamic_string& a, const char* p);
- friend dynamic_string operator+ (const dynamic_string& a, const dynamic_string& b);
-
- dynamic_string& format_args(const char* p, va_list args);
- dynamic_string& format(const char* p, ...);
-
- dynamic_string& crop(uint start, uint len);
- dynamic_string& substring(uint start, uint end);
- dynamic_string& left(uint len);
- dynamic_string& mid(uint start, uint len);
- dynamic_string& right(uint start);
- dynamic_string& tail(uint num);
-
- dynamic_string& unquote();
-
- uint count_char(char c) const;
-
- int find_left(const char* p, bool case_sensitive = false) const;
- int find_left(char c) const;
-
- int find_right(char c) const;
- int find_right(const char* p, bool case_sensitive = false) const;
-
- bool contains(const char* p, bool case_sensitive = false) const;
-
- dynamic_string& trim();
- dynamic_string& trim_crlf();
-
- dynamic_string& remap(int from_char, int to_char);
-
- void swap(dynamic_string& other);
-
- // Returns -1 on failure, or the number of bytes written.
- int serialize(void* pBuf, uint buf_size, bool little_endian) const;
-
- // Returns -1 on failure, or the number of bytes read.
- int deserialize(const void* pBuf, uint buf_size, bool little_endian);
-
- void translate_lf_to_crlf();
-
- static inline char *create_raw_buffer(uint& buf_size_in_chars);
- static inline void free_raw_buffer(char *p) { crnlib_delete_array(p); }
- dynamic_string& set_from_raw_buf_and_assume_ownership(char *pBuf, uint buf_size_in_chars, uint len_in_chars);
- private:
- uint16 m_buf_size;
- uint16 m_len;
- char* m_pStr;
-
-#ifdef CRNLIB_BUILD_DEBUG
- void check() const;
-#else
- inline void check() const { }
-#endif
-
- bool expand_buf(uint new_buf_size, bool preserve_contents);
-
- const char* get_ptr_priv() const { return m_pStr ? m_pStr : ""; }
- char* get_ptr_priv() { return (char*)(m_pStr ? m_pStr : ""); }
-
- bool ensure_buf(uint len, bool preserve_contents = true);
- };
-
- typedef crnlib::vector<dynamic_string> dynamic_string_array;
-
- extern dynamic_string g_empty_dynamic_string;
-
- CRNLIB_DEFINE_BITWISE_MOVABLE(dynamic_string);
-
- inline void swap (dynamic_string& a, dynamic_string& b)
- {
- a.swap(b);
- }
-
- inline char *dynamic_string::create_raw_buffer(uint& buf_size_in_chars)
- {
- if (buf_size_in_chars > cUINT16_MAX)
- {
- CRNLIB_ASSERT(0);
- return NULL;
- }
- buf_size_in_chars = math::minimum<uint>(cUINT16_MAX, math::next_pow2(buf_size_in_chars));
- return crnlib_new_array<char>(buf_size_in_chars);
- }
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_etc.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_etc.cpp
deleted file mode 100644
index 86937daf..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_etc.cpp
+++ /dev/null
@@ -1,1481 +0,0 @@
-// File: crn_etc.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_etc.h"
-#include "crn_radix_sort.h"
-#include "crn_ryg_dxt.hpp"
-
-namespace crnlib
-{
- const int g_etc1_inten_tables[cETC1IntenModifierValues][cETC1SelectorValues] =
- {
- { -8, -2, 2, 8 }, { -17, -5, 5, 17 }, { -29, -9, 9, 29 }, { -42, -13, 13, 42 },
- { -60, -18, 18, 60 }, { -80, -24, 24, 80 }, { -106, -33, 33, 106 }, { -183, -47, 47, 183 }
- };
-
- const uint8 g_etc1_to_selector_index[cETC1SelectorValues] = { 2, 3, 1, 0 };
- const uint8 g_selector_index_to_etc1[cETC1SelectorValues] = { 3, 2, 0, 1 };
-
- // [flip][subblock][pixel_index]
- const etc1_coord2 g_etc1_pixel_coords[2][2][8] =
- {
- {
- {
- { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 },
- { 1, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 }
- },
- {
- { 2, 0 }, { 2, 1 }, { 2, 2 }, { 2, 3 },
- { 3, 0 }, { 3, 1 }, { 3, 2 }, { 3, 3 }
- }
- },
- {
- {
- { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 },
- { 0, 1 }, { 1, 1 }, { 2, 1 }, { 3, 1 }
- },
- {
- { 0, 2 }, { 1, 2 }, { 2, 2 }, { 3, 2 },
- { 0, 3 }, { 1, 3 }, { 2, 3 }, { 3, 3 }
- },
- }
- };
-
- // Given an ETC1 diff/inten_table/selector, and an 8-bit desired color, this table encodes the best packed_color in the low byte, and the abs error in the high byte.
- static uint16 g_etc1_inverse_lookup[2*8*4][256]; // [diff/inten_table/selector][desired_color]
-
- // g_color8_to_etc_block_config[color][table_index] = Supplies for each 8-bit color value a list of packed ETC1 diff/intensity table/selectors/packed_colors that map to that color.
- // To pack: diff | (inten << 1) | (selector << 4) | (packed_c << 8)
- static const uint16 g_color8_to_etc_block_config_0_255[2][33] =
- {
- { 0x0000, 0x0010, 0x0002, 0x0012, 0x0004, 0x0014, 0x0006, 0x0016, 0x0008, 0x0018, 0x000A, 0x001A, 0x000C, 0x001C, 0x000E, 0x001E,
- 0x0001, 0x0011, 0x0003, 0x0013, 0x0005, 0x0015, 0x0007, 0x0017, 0x0009, 0x0019, 0x000B, 0x001B, 0x000D, 0x001D, 0x000F, 0x001F, 0xFFFF },
- { 0x0F20, 0x0F30, 0x0E32, 0x0F22, 0x0E34, 0x0F24, 0x0D36, 0x0F26, 0x0C38, 0x0E28, 0x0B3A, 0x0E2A, 0x093C, 0x0E2C, 0x053E, 0x0D2E,
- 0x1E31, 0x1F21, 0x1D33, 0x1F23, 0x1C35, 0x1E25, 0x1A37, 0x1E27, 0x1839, 0x1D29, 0x163B, 0x1C2B, 0x133D, 0x1B2D, 0x093F, 0x1A2F, 0xFFFF },
- };
-
- // Really only [254][11].
- static const uint16 g_color8_to_etc_block_config_1_to_254[254][12] =
- {
- { 0x021C, 0x0D0D, 0xFFFF }, { 0x0020, 0x0021, 0x0A0B, 0x061F, 0xFFFF }, { 0x0113, 0x0217, 0xFFFF }, { 0x0116, 0x031E,
- 0x0B0E, 0x0405, 0xFFFF }, { 0x0022, 0x0204, 0x050A, 0x0023, 0xFFFF }, { 0x0111, 0x0319, 0x0809, 0x170F, 0xFFFF }, {
- 0x0303, 0x0215, 0x0607, 0xFFFF }, { 0x0030, 0x0114, 0x0408, 0x0031, 0x0201, 0x051D, 0xFFFF }, { 0x0100, 0x0024, 0x0306,
- 0x0025, 0x041B, 0x0E0D, 0xFFFF }, { 0x021A, 0x0121, 0x0B0B, 0x071F, 0xFFFF }, { 0x0213, 0x0317, 0xFFFF }, { 0x0112,
- 0x0505, 0xFFFF }, { 0x0026, 0x070C, 0x0123, 0x0027, 0xFFFF }, { 0x0211, 0x0909, 0xFFFF }, { 0x0110, 0x0315, 0x0707,
- 0x0419, 0x180F, 0xFFFF }, { 0x0218, 0x0131, 0x0301, 0x0403, 0x061D, 0xFFFF }, { 0x0032, 0x0202, 0x0033, 0x0125, 0x051B,
- 0x0F0D, 0xFFFF }, { 0x0028, 0x031C, 0x0221, 0x0029, 0xFFFF }, { 0x0120, 0x0313, 0x0C0B, 0x081F, 0xFFFF }, { 0x0605,
- 0x0417, 0xFFFF }, { 0x0216, 0x041E, 0x0C0E, 0x0223, 0x0127, 0xFFFF }, { 0x0122, 0x0304, 0x060A, 0x0311, 0x0A09, 0xFFFF
- }, { 0x0519, 0x190F, 0xFFFF }, { 0x002A, 0x0231, 0x0503, 0x0415, 0x0807, 0x002B, 0x071D, 0xFFFF }, { 0x0130, 0x0214,
- 0x0508, 0x0401, 0x0133, 0x0225, 0x061B, 0xFFFF }, { 0x0200, 0x0124, 0x0406, 0x0321, 0x0129, 0x100D, 0xFFFF }, { 0x031A,
- 0x0D0B, 0x091F, 0xFFFF }, { 0x0413, 0x0705, 0x0517, 0xFFFF }, { 0x0212, 0x0034, 0x0323, 0x0035, 0x0227, 0xFFFF }, {
- 0x0126, 0x080C, 0x0B09, 0xFFFF }, { 0x0411, 0x0619, 0x1A0F, 0xFFFF }, { 0x0210, 0x0331, 0x0603, 0x0515, 0x0907, 0x012B,
- 0xFFFF }, { 0x0318, 0x002C, 0x0501, 0x0233, 0x0325, 0x071B, 0x002D, 0x081D, 0xFFFF }, { 0x0132, 0x0302, 0x0229, 0x110D,
- 0xFFFF }, { 0x0128, 0x041C, 0x0421, 0x0E0B, 0x0A1F, 0xFFFF }, { 0x0220, 0x0513, 0x0617, 0xFFFF }, { 0x0135, 0x0805,
- 0x0327, 0xFFFF }, { 0x0316, 0x051E, 0x0D0E, 0x0423, 0xFFFF }, { 0x0222, 0x0404, 0x070A, 0x0511, 0x0719, 0x0C09, 0x1B0F,
- 0xFFFF }, { 0x0703, 0x0615, 0x0A07, 0x022B, 0xFFFF }, { 0x012A, 0x0431, 0x0601, 0x0333, 0x012D, 0x091D, 0xFFFF }, {
- 0x0230, 0x0314, 0x0036, 0x0608, 0x0425, 0x0037, 0x0329, 0x081B, 0x120D, 0xFFFF }, { 0x0300, 0x0224, 0x0506, 0x0521,
- 0x0F0B, 0x0B1F, 0xFFFF }, { 0x041A, 0x0613, 0x0717, 0xFFFF }, { 0x0235, 0x0905, 0xFFFF }, { 0x0312, 0x0134, 0x0523,
- 0x0427, 0xFFFF }, { 0x0226, 0x090C, 0x002E, 0x0611, 0x0D09, 0x002F, 0xFFFF }, { 0x0715, 0x0B07, 0x0819, 0x032B, 0x1C0F,
- 0xFFFF }, { 0x0310, 0x0531, 0x0701, 0x0803, 0x022D, 0x0A1D, 0xFFFF }, { 0x0418, 0x012C, 0x0433, 0x0525, 0x0137, 0x091B,
- 0x130D, 0xFFFF }, { 0x0232, 0x0402, 0x0621, 0x0429, 0xFFFF }, { 0x0228, 0x051C, 0x0713, 0x100B, 0x0C1F, 0xFFFF }, {
- 0x0320, 0x0335, 0x0A05, 0x0817, 0xFFFF }, { 0x0623, 0x0527, 0xFFFF }, { 0x0416, 0x061E, 0x0E0E, 0x0711, 0x0E09, 0x012F,
- 0xFFFF }, { 0x0322, 0x0504, 0x080A, 0x0919, 0x1D0F, 0xFFFF }, { 0x0631, 0x0903, 0x0815, 0x0C07, 0x042B, 0x032D, 0x0B1D,
- 0xFFFF }, { 0x022A, 0x0801, 0x0533, 0x0625, 0x0237, 0x0A1B, 0xFFFF }, { 0x0330, 0x0414, 0x0136, 0x0708, 0x0721, 0x0529,
- 0x140D, 0xFFFF }, { 0x0400, 0x0324, 0x0606, 0x0038, 0x0039, 0x110B, 0x0D1F, 0xFFFF }, { 0x051A, 0x0813, 0x0B05, 0x0917,
- 0xFFFF }, { 0x0723, 0x0435, 0x0627, 0xFFFF }, { 0x0412, 0x0234, 0x0F09, 0x022F, 0xFFFF }, { 0x0326, 0x0A0C, 0x012E,
- 0x0811, 0x0A19, 0x1E0F, 0xFFFF }, { 0x0731, 0x0A03, 0x0915, 0x0D07, 0x052B, 0xFFFF }, { 0x0410, 0x0901, 0x0633, 0x0725,
- 0x0337, 0x0B1B, 0x042D, 0x0C1D, 0xFFFF }, { 0x0518, 0x022C, 0x0629, 0x150D, 0xFFFF }, { 0x0332, 0x0502, 0x0821, 0x0139,
- 0x120B, 0x0E1F, 0xFFFF }, { 0x0328, 0x061C, 0x0913, 0x0A17, 0xFFFF }, { 0x0420, 0x0535, 0x0C05, 0x0727, 0xFFFF }, {
- 0x0823, 0x032F, 0xFFFF }, { 0x0516, 0x071E, 0x0F0E, 0x0911, 0x0B19, 0x1009, 0x1F0F, 0xFFFF }, { 0x0422, 0x0604, 0x090A,
- 0x0B03, 0x0A15, 0x0E07, 0x062B, 0xFFFF }, { 0x0831, 0x0A01, 0x0733, 0x052D, 0x0D1D, 0xFFFF }, { 0x032A, 0x0825, 0x0437,
- 0x0729, 0x0C1B, 0x160D, 0xFFFF }, { 0x0430, 0x0514, 0x0236, 0x0808, 0x0921, 0x0239, 0x130B, 0x0F1F, 0xFFFF }, { 0x0500,
- 0x0424, 0x0706, 0x0138, 0x0A13, 0x0B17, 0xFFFF }, { 0x061A, 0x0635, 0x0D05, 0xFFFF }, { 0x0923, 0x0827, 0xFFFF }, {
- 0x0512, 0x0334, 0x003A, 0x0A11, 0x1109, 0x003B, 0x042F, 0xFFFF }, { 0x0426, 0x0B0C, 0x022E, 0x0B15, 0x0F07, 0x0C19,
- 0x072B, 0xFFFF }, { 0x0931, 0x0B01, 0x0C03, 0x062D, 0x0E1D, 0xFFFF }, { 0x0510, 0x0833, 0x0925, 0x0537, 0x0D1B, 0x170D,
- 0xFFFF }, { 0x0618, 0x032C, 0x0A21, 0x0339, 0x0829, 0xFFFF }, { 0x0432, 0x0602, 0x0B13, 0x140B, 0x101F, 0xFFFF }, {
- 0x0428, 0x071C, 0x0735, 0x0E05, 0x0C17, 0xFFFF }, { 0x0520, 0x0A23, 0x0927, 0xFFFF }, { 0x0B11, 0x1209, 0x013B, 0x052F,
- 0xFFFF }, { 0x0616, 0x081E, 0x0D19, 0xFFFF }, { 0x0522, 0x0704, 0x0A0A, 0x0A31, 0x0D03, 0x0C15, 0x1007, 0x082B, 0x072D,
- 0x0F1D, 0xFFFF }, { 0x0C01, 0x0933, 0x0A25, 0x0637, 0x0E1B, 0xFFFF }, { 0x042A, 0x0B21, 0x0929, 0x180D, 0xFFFF }, {
- 0x0530, 0x0614, 0x0336, 0x0908, 0x0439, 0x150B, 0x111F, 0xFFFF }, { 0x0600, 0x0524, 0x0806, 0x0238, 0x0C13, 0x0F05,
- 0x0D17, 0xFFFF }, { 0x071A, 0x0B23, 0x0835, 0x0A27, 0xFFFF }, { 0x1309, 0x023B, 0x062F, 0xFFFF }, { 0x0612, 0x0434,
- 0x013A, 0x0C11, 0x0E19, 0xFFFF }, { 0x0526, 0x0C0C, 0x032E, 0x0B31, 0x0E03, 0x0D15, 0x1107, 0x092B, 0xFFFF }, { 0x0D01,
- 0x0A33, 0x0B25, 0x0737, 0x0F1B, 0x082D, 0x101D, 0xFFFF }, { 0x0610, 0x0A29, 0x190D, 0xFFFF }, { 0x0718, 0x042C, 0x0C21,
- 0x0539, 0x160B, 0x121F, 0xFFFF }, { 0x0532, 0x0702, 0x0D13, 0x0E17, 0xFFFF }, { 0x0528, 0x081C, 0x0935, 0x1005, 0x0B27,
- 0xFFFF }, { 0x0620, 0x0C23, 0x033B, 0x072F, 0xFFFF }, { 0x0D11, 0x0F19, 0x1409, 0xFFFF }, { 0x0716, 0x003C, 0x091E,
- 0x0F03, 0x0E15, 0x1207, 0x0A2B, 0x003D, 0xFFFF }, { 0x0622, 0x0804, 0x0B0A, 0x0C31, 0x0E01, 0x0B33, 0x092D, 0x111D,
- 0xFFFF }, { 0x0C25, 0x0837, 0x0B29, 0x101B, 0x1A0D, 0xFFFF }, { 0x052A, 0x0D21, 0x0639, 0x170B, 0x131F, 0xFFFF }, {
- 0x0630, 0x0714, 0x0436, 0x0A08, 0x0E13, 0x0F17, 0xFFFF }, { 0x0700, 0x0624, 0x0906, 0x0338, 0x0A35, 0x1105, 0xFFFF }, {
- 0x081A, 0x0D23, 0x0C27, 0xFFFF }, { 0x0E11, 0x1509, 0x043B, 0x082F, 0xFFFF }, { 0x0712, 0x0534, 0x023A, 0x0F15, 0x1307,
- 0x1019, 0x0B2B, 0x013D, 0xFFFF }, { 0x0626, 0x0D0C, 0x042E, 0x0D31, 0x0F01, 0x1003, 0x0A2D, 0x121D, 0xFFFF }, { 0x0C33,
- 0x0D25, 0x0937, 0x111B, 0x1B0D, 0xFFFF }, { 0x0710, 0x0E21, 0x0739, 0x0C29, 0xFFFF }, { 0x0818, 0x052C, 0x0F13, 0x180B,
- 0x141F, 0xFFFF }, { 0x0632, 0x0802, 0x0B35, 0x1205, 0x1017, 0xFFFF }, { 0x0628, 0x091C, 0x0E23, 0x0D27, 0xFFFF }, {
- 0x0720, 0x0F11, 0x1609, 0x053B, 0x092F, 0xFFFF }, { 0x1119, 0x023D, 0xFFFF }, { 0x0816, 0x013C, 0x0A1E, 0x0E31, 0x1103,
- 0x1015, 0x1407, 0x0C2B, 0x0B2D, 0x131D, 0xFFFF }, { 0x0722, 0x0904, 0x0C0A, 0x1001, 0x0D33, 0x0E25, 0x0A37, 0x121B,
- 0xFFFF }, { 0x0F21, 0x0D29, 0x1C0D, 0xFFFF }, { 0x062A, 0x0839, 0x190B, 0x151F, 0xFFFF }, { 0x0730, 0x0814, 0x0536,
- 0x0B08, 0x1013, 0x1305, 0x1117, 0xFFFF }, { 0x0800, 0x0724, 0x0A06, 0x0438, 0x0F23, 0x0C35, 0x0E27, 0xFFFF }, { 0x091A,
- 0x1709, 0x063B, 0x0A2F, 0xFFFF }, { 0x1011, 0x1219, 0x033D, 0xFFFF }, { 0x0812, 0x0634, 0x033A, 0x0F31, 0x1203, 0x1115,
- 0x1507, 0x0D2B, 0xFFFF }, { 0x0726, 0x0E0C, 0x052E, 0x1101, 0x0E33, 0x0F25, 0x0B37, 0x131B, 0x0C2D, 0x141D, 0xFFFF }, {
- 0x0E29, 0x1D0D, 0xFFFF }, { 0x0810, 0x1021, 0x0939, 0x1A0B, 0x161F, 0xFFFF }, { 0x0918, 0x062C, 0x1113, 0x1217, 0xFFFF
- }, { 0x0732, 0x0902, 0x0D35, 0x1405, 0x0F27, 0xFFFF }, { 0x0728, 0x0A1C, 0x1023, 0x073B, 0x0B2F, 0xFFFF }, { 0x0820,
- 0x1111, 0x1319, 0x1809, 0xFFFF }, { 0x1303, 0x1215, 0x1607, 0x0E2B, 0x043D, 0xFFFF }, { 0x0916, 0x023C, 0x0B1E, 0x1031,
- 0x1201, 0x0F33, 0x0D2D, 0x151D, 0xFFFF }, { 0x0822, 0x0A04, 0x0D0A, 0x1025, 0x0C37, 0x0F29, 0x141B, 0x1E0D, 0xFFFF }, {
- 0x1121, 0x0A39, 0x1B0B, 0x171F, 0xFFFF }, { 0x072A, 0x1213, 0x1317, 0xFFFF }, { 0x0830, 0x0914, 0x0636, 0x0C08, 0x0E35,
- 0x1505, 0xFFFF }, { 0x0900, 0x0824, 0x0B06, 0x0538, 0x1123, 0x1027, 0xFFFF }, { 0x0A1A, 0x1211, 0x1909, 0x083B, 0x0C2F,
- 0xFFFF }, { 0x1315, 0x1707, 0x1419, 0x0F2B, 0x053D, 0xFFFF }, { 0x0912, 0x0734, 0x043A, 0x1131, 0x1301, 0x1403, 0x0E2D,
- 0x161D, 0xFFFF }, { 0x0826, 0x0F0C, 0x062E, 0x1033, 0x1125, 0x0D37, 0x151B, 0x1F0D, 0xFFFF }, { 0x1221, 0x0B39, 0x1029,
- 0xFFFF }, { 0x0910, 0x1313, 0x1C0B, 0x181F, 0xFFFF }, { 0x0A18, 0x072C, 0x0F35, 0x1605, 0x1417, 0xFFFF }, { 0x0832,
- 0x0A02, 0x1223, 0x1127, 0xFFFF }, { 0x0828, 0x0B1C, 0x1311, 0x1A09, 0x093B, 0x0D2F, 0xFFFF }, { 0x0920, 0x1519, 0x063D,
- 0xFFFF }, { 0x1231, 0x1503, 0x1415, 0x1807, 0x102B, 0x0F2D, 0x171D, 0xFFFF }, { 0x0A16, 0x033C, 0x0C1E, 0x1401, 0x1133,
- 0x1225, 0x0E37, 0x161B, 0xFFFF }, { 0x0922, 0x0B04, 0x0E0A, 0x1321, 0x1129, 0xFFFF }, { 0x0C39, 0x1D0B, 0x191F, 0xFFFF
- }, { 0x082A, 0x1413, 0x1705, 0x1517, 0xFFFF }, { 0x0930, 0x0A14, 0x0736, 0x0D08, 0x1323, 0x1035, 0x1227, 0xFFFF }, {
- 0x0A00, 0x0924, 0x0C06, 0x0638, 0x1B09, 0x0A3B, 0x0E2F, 0xFFFF }, { 0x0B1A, 0x1411, 0x1619, 0x073D, 0xFFFF }, { 0x1331,
- 0x1603, 0x1515, 0x1907, 0x112B, 0xFFFF }, { 0x0A12, 0x0834, 0x053A, 0x1501, 0x1233, 0x1325, 0x0F37, 0x171B, 0x102D,
- 0x181D, 0xFFFF }, { 0x0926, 0x072E, 0x1229, 0xFFFF }, { 0x1421, 0x0D39, 0x1E0B, 0x1A1F, 0xFFFF }, { 0x0A10, 0x1513,
- 0x1617, 0xFFFF }, { 0x0B18, 0x082C, 0x1135, 0x1805, 0x1327, 0xFFFF }, { 0x0932, 0x0B02, 0x1423, 0x0B3B, 0x0F2F, 0xFFFF
- }, { 0x0928, 0x0C1C, 0x1511, 0x1719, 0x1C09, 0xFFFF }, { 0x0A20, 0x1703, 0x1615, 0x1A07, 0x122B, 0x083D, 0xFFFF }, {
- 0x1431, 0x1601, 0x1333, 0x112D, 0x191D, 0xFFFF }, { 0x0B16, 0x043C, 0x0D1E, 0x1425, 0x1037, 0x1329, 0x181B, 0xFFFF }, {
- 0x0A22, 0x0C04, 0x0F0A, 0x1521, 0x0E39, 0x1F0B, 0x1B1F, 0xFFFF }, { 0x1613, 0x1717, 0xFFFF }, { 0x092A, 0x1235, 0x1905,
- 0xFFFF }, { 0x0A30, 0x0B14, 0x0836, 0x0E08, 0x1523, 0x1427, 0xFFFF }, { 0x0B00, 0x0A24, 0x0D06, 0x0738, 0x1611, 0x1D09,
- 0x0C3B, 0x102F, 0xFFFF }, { 0x0C1A, 0x1715, 0x1B07, 0x1819, 0x132B, 0x093D, 0xFFFF }, { 0x1531, 0x1701, 0x1803, 0x122D,
- 0x1A1D, 0xFFFF }, { 0x0B12, 0x0934, 0x063A, 0x1433, 0x1525, 0x1137, 0x191B, 0xFFFF }, { 0x0A26, 0x003E, 0x082E, 0x1621,
- 0x0F39, 0x1429, 0x003F, 0xFFFF }, { 0x1713, 0x1C1F, 0xFFFF }, { 0x0B10, 0x1335, 0x1A05, 0x1817, 0xFFFF }, { 0x0C18,
- 0x092C, 0x1623, 0x1527, 0xFFFF }, { 0x0A32, 0x0C02, 0x1711, 0x1E09, 0x0D3B, 0x112F, 0xFFFF }, { 0x0A28, 0x0D1C, 0x1919,
- 0x0A3D, 0xFFFF }, { 0x0B20, 0x1631, 0x1903, 0x1815, 0x1C07, 0x142B, 0x132D, 0x1B1D, 0xFFFF }, { 0x1801, 0x1533, 0x1625,
- 0x1237, 0x1A1B, 0xFFFF }, { 0x0C16, 0x053C, 0x0E1E, 0x1721, 0x1529, 0x013F, 0xFFFF }, { 0x0B22, 0x0D04, 0x1039, 0x1D1F,
- 0xFFFF }, { 0x1813, 0x1B05, 0x1917, 0xFFFF }, { 0x0A2A, 0x1723, 0x1435, 0x1627, 0xFFFF }, { 0x0B30, 0x0C14, 0x0936,
- 0x0F08, 0x1F09, 0x0E3B, 0x122F, 0xFFFF }, { 0x0C00, 0x0B24, 0x0E06, 0x0838, 0x1811, 0x1A19, 0x0B3D, 0xFFFF }, { 0x0D1A,
- 0x1731, 0x1A03, 0x1915, 0x1D07, 0x152B, 0xFFFF }, { 0x1901, 0x1633, 0x1725, 0x1337, 0x1B1B, 0x142D, 0x1C1D, 0xFFFF }, {
- 0x0C12, 0x0A34, 0x073A, 0x1629, 0x023F, 0xFFFF }, { 0x0B26, 0x013E, 0x092E, 0x1821, 0x1139, 0x1E1F, 0xFFFF }, { 0x1913,
- 0x1A17, 0xFFFF }, { 0x0C10, 0x1535, 0x1C05, 0x1727, 0xFFFF }, { 0x0D18, 0x0A2C, 0x1823, 0x0F3B, 0x132F, 0xFFFF }, {
- 0x0B32, 0x0D02, 0x1911, 0x1B19, 0xFFFF }, { 0x0B28, 0x0E1C, 0x1B03, 0x1A15, 0x1E07, 0x162B, 0x0C3D, 0xFFFF }, { 0x0C20,
- 0x1831, 0x1A01, 0x1733, 0x152D, 0x1D1D, 0xFFFF }, { 0x1825, 0x1437, 0x1729, 0x1C1B, 0x033F, 0xFFFF }, { 0x0D16, 0x063C,
- 0x0F1E, 0x1921, 0x1239, 0x1F1F, 0xFFFF }, { 0x0C22, 0x0E04, 0x1A13, 0x1B17, 0xFFFF }, { 0x1635, 0x1D05, 0xFFFF }, {
- 0x0B2A, 0x1923, 0x1827, 0xFFFF }, { 0x0C30, 0x0D14, 0x0A36, 0x1A11, 0x103B, 0x142F, 0xFFFF }, { 0x0D00, 0x0C24, 0x0F06,
- 0x0938, 0x1B15, 0x1F07, 0x1C19, 0x172B, 0x0D3D, 0xFFFF }, { 0x0E1A, 0x1931, 0x1B01, 0x1C03, 0x162D, 0x1E1D, 0xFFFF }, {
- 0x1833, 0x1925, 0x1537, 0x1D1B, 0xFFFF }, { 0x0D12, 0x0B34, 0x083A, 0x1A21, 0x1339, 0x1829, 0x043F, 0xFFFF }, { 0x0C26,
- 0x023E, 0x0A2E, 0x1B13, 0xFFFF }, { 0x1735, 0x1E05, 0x1C17, 0xFFFF }, { 0x0D10, 0x1A23, 0x1927, 0xFFFF }, { 0x0E18,
- 0x0B2C, 0x1B11, 0x113B, 0x152F, 0xFFFF }, { 0x0C32, 0x0E02, 0x1D19, 0x0E3D, 0xFFFF }, { 0x0C28, 0x0F1C, 0x1A31, 0x1D03,
- 0x1C15, 0x182B, 0x172D, 0x1F1D, 0xFFFF }, { 0x0D20, 0x1C01, 0x1933, 0x1A25, 0x1637, 0x1E1B, 0xFFFF }, { 0x1B21, 0x1929,
- 0x053F, 0xFFFF }, { 0x0E16, 0x073C, 0x1439, 0xFFFF }, { 0x0D22, 0x0F04, 0x1C13, 0x1F05, 0x1D17, 0xFFFF }, { 0x1B23,
- 0x1835, 0x1A27, 0xFFFF }, { 0x0C2A, 0x123B, 0x162F, 0xFFFF }, { 0x0D30, 0x0E14, 0x0B36, 0x1C11, 0x1E19, 0x0F3D, 0xFFFF
- }, { 0x0E00, 0x0D24, 0x0A38, 0x1B31, 0x1E03, 0x1D15, 0x192B, 0xFFFF }, { 0x0F1A, 0x1D01, 0x1A33, 0x1B25, 0x1737, 0x1F1B,
- 0x182D, 0xFFFF }, { 0x1A29, 0x063F, 0xFFFF }, { 0x0E12, 0x0C34, 0x093A, 0x1C21, 0x1539, 0xFFFF }, { 0x0D26, 0x033E,
- 0x0B2E, 0x1D13, 0x1E17, 0xFFFF }, { 0x1935, 0x1B27, 0xFFFF }, { 0x0E10, 0x1C23, 0x133B, 0x172F, 0xFFFF }, { 0x0F18,
- 0x0C2C, 0x1D11, 0x1F19, 0xFFFF }, { 0x0D32, 0x0F02, 0x1F03, 0x1E15, 0x1A2B, 0x103D, 0xFFFF }, { 0x0D28, 0x1C31, 0x1E01,
- 0x1B33, 0x192D, 0xFFFF }, { 0x0E20, 0x1C25, 0x1837, 0x1B29, 0x073F, 0xFFFF }, { 0x1D21, 0x1639, 0xFFFF }, { 0x0F16,
- 0x083C, 0x1E13, 0x1F17, 0xFFFF }, { 0x0E22, 0x1A35, 0xFFFF }, { 0x1D23, 0x1C27, 0xFFFF }, { 0x0D2A, 0x1E11, 0x143B,
- 0x182F, 0xFFFF }, { 0x0E30, 0x0F14, 0x0C36, 0x1F15, 0x1B2B, 0x113D, 0xFFFF }, { 0x0F00, 0x0E24, 0x0B38, 0x1D31, 0x1F01,
- 0x1A2D, 0xFFFF }, { 0x1C33, 0x1D25, 0x1937, 0xFFFF }, { 0x1E21, 0x1739, 0x1C29, 0x083F, 0xFFFF }, { 0x0F12, 0x0D34,
- 0x0A3A, 0x1F13, 0xFFFF }, { 0x0E26, 0x043E, 0x0C2E, 0x1B35, 0xFFFF }, { 0x1E23, 0x1D27, 0xFFFF }, { 0x0F10, 0x1F11,
- 0x153B, 0x192F, 0xFFFF }, { 0x0D2C, 0x123D, 0xFFFF },
- };
-
- uint16 etc1_block::pack_color5(const color_quad_u8& color, bool scaled, uint bias)
- {
- return pack_color5(color.r, color.g, color.b, scaled, bias);
- }
-
- uint16 etc1_block::pack_color5(uint r, uint g, uint b, bool scaled, uint bias)
- {
- if (scaled)
- {
- r = (r * 31U + bias) / 255U;
- g = (g * 31U + bias) / 255U;
- b = (b * 31U + bias) / 255U;
- }
-
- r = math::minimum(r, 31U);
- g = math::minimum(g, 31U);
- b = math::minimum(b, 31U);
-
- return static_cast<uint16>(b | (g << 5U) | (r << 10U));
- }
-
- color_quad_u8 etc1_block::unpack_color5(uint16 packed_color5, bool scaled, uint alpha)
- {
- uint b = packed_color5 & 31U;
- uint g = (packed_color5 >> 5U) & 31U;
- uint r = (packed_color5 >> 10U) & 31U;
-
- if (scaled)
- {
- b = (b << 3U) | (b >> 2U);
- g = (g << 3U) | (g >> 2U);
- r = (r << 3U) | (r >> 2U);
- }
-
- return color_quad_u8(cNoClamp, r, g, b, math::minimum(alpha, 255U));
- }
-
- void etc1_block::unpack_color5(uint& r, uint& g, uint& b, uint16 packed_color5, bool scaled)
- {
- color_quad_u8 c(unpack_color5(packed_color5, scaled, 0));
- r = c.r;
- g = c.g;
- b = c.b;
- }
-
- bool etc1_block::unpack_color5(color_quad_u8& result, uint16 packed_color5, uint16 packed_delta3, bool scaled, uint alpha)
- {
- color_quad_i16 dc(unpack_delta3(packed_delta3));
-
- int b = (packed_color5 & 31U) + dc.b;
- int g = ((packed_color5 >> 5U) & 31U) + dc.g;
- int r = ((packed_color5 >> 10U) & 31U) + dc.r;
-
- bool success = true;
- if (static_cast<uint>(r | g | b) > 31U)
- {
- success = false;
- r = math::clamp<int>(r, 0, 31);
- g = math::clamp<int>(g, 0, 31);
- b = math::clamp<int>(b, 0, 31);
- }
-
- if (scaled)
- {
- b = (b << 3U) | (b >> 2U);
- g = (g << 3U) | (g >> 2U);
- r = (r << 3U) | (r >> 2U);
- }
-
- result.set_noclamp_rgba(r, g, b, math::minimum(alpha, 255U));
- return success;
- }
-
- bool etc1_block::unpack_color5(uint& r, uint& g, uint& b, uint16 packed_color5, uint16 packed_delta3, bool scaled, uint alpha)
- {
- color_quad_u8 result;
- const bool success = unpack_color5(result, packed_color5, packed_delta3, scaled, alpha);
- r = result.r;
- g = result.g;
- b = result.b;
- return success;
- }
-
- uint16 etc1_block::pack_delta3(const color_quad_i16& color)
- {
- return pack_delta3(color.r, color.g, color.b);
- }
-
- uint16 etc1_block::pack_delta3(int r, int g, int b)
- {
- CRNLIB_ASSERT((r >= cETC1ColorDeltaMin) && (r <= cETC1ColorDeltaMax));
- CRNLIB_ASSERT((g >= cETC1ColorDeltaMin) && (g <= cETC1ColorDeltaMax));
- CRNLIB_ASSERT((b >= cETC1ColorDeltaMin) && (b <= cETC1ColorDeltaMax));
- if (r < 0) r += 8;
- if (g < 0) g += 8;
- if (b < 0) b += 8;
- return static_cast<uint16>(b | (g << 3) | (r << 6));
- }
-
- color_quad_i16 etc1_block::unpack_delta3(uint16 packed_delta3)
- {
- int r = (packed_delta3 >> 6) & 7;
- int g = (packed_delta3 >> 3) & 7;
- int b = packed_delta3 & 7;
- if (r >= 4) r -= 8;
- if (g >= 4) g -= 8;
- if (b >= 4) b -= 8;
- return color_quad_i16(r, g, b, 0);
- }
-
- void etc1_block::unpack_delta3(int& r, int& g, int& b, uint16 packed_delta3)
- {
- r = (packed_delta3 >> 6) & 7;
- g = (packed_delta3 >> 3) & 7;
- b = packed_delta3 & 7;
- if (r >= 4) r -= 8;
- if (g >= 4) g -= 8;
- if (b >= 4) b -= 8;
- }
-
- uint16 etc1_block::pack_color4(const color_quad_u8& color, bool scaled, uint bias)
- {
- return pack_color4(color.r, color.g, color.b, scaled, bias);
- }
-
- uint16 etc1_block::pack_color4(uint r, uint g, uint b, bool scaled, uint bias)
- {
- if (scaled)
- {
- r = (r * 15U + bias) / 255U;
- g = (g * 15U + bias) / 255U;
- b = (b * 15U + bias) / 255U;
- }
-
- r = math::minimum(r, 15U);
- g = math::minimum(g, 15U);
- b = math::minimum(b, 15U);
-
- return static_cast<uint16>(b | (g << 4U) | (r << 8U));
- }
-
- color_quad_u8 etc1_block::unpack_color4(uint16 packed_color4, bool scaled, uint alpha)
- {
- uint b = packed_color4 & 15U;
- uint g = (packed_color4 >> 4U) & 15U;
- uint r = (packed_color4 >> 8U) & 15U;
-
- if (scaled)
- {
- b = (b << 4U) | b;
- g = (g << 4U) | g;
- r = (r << 4U) | r;
- }
-
- return color_quad_u8(cNoClamp, r, g, b, math::minimum(alpha, 255U));
- }
-
- void etc1_block::unpack_color4(uint& r, uint& g, uint& b, uint16 packed_color4, bool scaled)
- {
- color_quad_u8 c(unpack_color4(packed_color4, scaled, 0));
- r = c.r;
- g = c.g;
- b = c.b;
- }
-
- void etc1_block::get_diff_subblock_colors(color_quad_u8* pDst, uint16 packed_color5, uint table_idx)
- {
- CRNLIB_ASSERT(table_idx < cETC1IntenModifierValues);
- const int *pInten_modifer_table = &g_etc1_inten_tables[table_idx][0];
-
- uint r, g, b;
- unpack_color5(r, g, b, packed_color5, true);
-
- const int ir = static_cast<int>(r), ig = static_cast<int>(g), ib = static_cast<int>(b);
-
- const int y0 = pInten_modifer_table[0];
- pDst[0].set(ir + y0, ig + y0, ib + y0);
-
- const int y1 = pInten_modifer_table[1];
- pDst[1].set(ir + y1, ig + y1, ib + y1);
-
- const int y2 = pInten_modifer_table[2];
- pDst[2].set(ir + y2, ig + y2, ib + y2);
-
- const int y3 = pInten_modifer_table[3];
- pDst[3].set(ir + y3, ig + y3, ib + y3);
- }
-
- bool etc1_block::get_diff_subblock_colors(color_quad_u8* pDst, uint16 packed_color5, uint16 packed_delta3, uint table_idx)
- {
- CRNLIB_ASSERT(table_idx < cETC1IntenModifierValues);
- const int *pInten_modifer_table = &g_etc1_inten_tables[table_idx][0];
-
- uint r, g, b;
- bool success = unpack_color5(r, g, b, packed_color5, packed_delta3, true);
-
- const int ir = static_cast<int>(r), ig = static_cast<int>(g), ib = static_cast<int>(b);
-
- const int y0 = pInten_modifer_table[0];
- pDst[0].set(ir + y0, ig + y0, ib + y0);
-
- const int y1 = pInten_modifer_table[1];
- pDst[1].set(ir + y1, ig + y1, ib + y1);
-
- const int y2 = pInten_modifer_table[2];
- pDst[2].set(ir + y2, ig + y2, ib + y2);
-
- const int y3 = pInten_modifer_table[3];
- pDst[3].set(ir + y3, ig + y3, ib + y3);
-
- return success;
- }
-
- void etc1_block::get_abs_subblock_colors(color_quad_u8* pDst, uint16 packed_color4, uint table_idx)
- {
- CRNLIB_ASSERT(table_idx < cETC1IntenModifierValues);
- const int *pInten_modifer_table = &g_etc1_inten_tables[table_idx][0];
-
- uint r, g, b;
- unpack_color4(r, g, b, packed_color4, true);
-
- const int ir = static_cast<int>(r), ig = static_cast<int>(g), ib = static_cast<int>(b);
-
- const int y0 = pInten_modifer_table[0];
- pDst[0].set(ir + y0, ig + y0, ib + y0);
-
- const int y1 = pInten_modifer_table[1];
- pDst[1].set(ir + y1, ig + y1, ib + y1);
-
- const int y2 = pInten_modifer_table[2];
- pDst[2].set(ir + y2, ig + y2, ib + y2);
-
- const int y3 = pInten_modifer_table[3];
- pDst[3].set(ir + y3, ig + y3, ib + y3);
- }
-
- bool unpack_etc1(const etc1_block& block, color_quad_u8 *pDst, bool preserve_alpha)
- {
- const bool diff_flag = block.get_diff_bit();
- const bool flip_flag = block.get_flip_bit();
- const uint table_index0 = block.get_inten_table(0);
- const uint table_index1 = block.get_inten_table(1);
-
- color_quad_u8 subblock_colors0[4];
- color_quad_u8 subblock_colors1[4];
- bool success = true;
-
- if (diff_flag)
- {
- const uint16 base_color5 = block.get_base5_color();
- const uint16 delta_color3 = block.get_delta3_color();
- etc1_block::get_diff_subblock_colors(subblock_colors0, base_color5, table_index0);
-
- if (!etc1_block::get_diff_subblock_colors(subblock_colors1, base_color5, delta_color3, table_index1))
- success = false;
- }
- else
- {
- const uint16 base_color4_0 = block.get_base4_color(0);
- etc1_block::get_abs_subblock_colors(subblock_colors0, base_color4_0, table_index0);
-
- const uint16 base_color4_1 = block.get_base4_color(1);
- etc1_block::get_abs_subblock_colors(subblock_colors1, base_color4_1, table_index1);
- }
-
- if (preserve_alpha)
- {
- if (flip_flag)
- {
- for (uint y = 0; y < 2; y++)
- {
- pDst[0].set_rgb(subblock_colors0[block.get_selector(0, y)]);
- pDst[1].set_rgb(subblock_colors0[block.get_selector(1, y)]);
- pDst[2].set_rgb(subblock_colors0[block.get_selector(2, y)]);
- pDst[3].set_rgb(subblock_colors0[block.get_selector(3, y)]);
- pDst += 4;
- }
-
- for (uint y = 2; y < 4; y++)
- {
- pDst[0].set_rgb(subblock_colors1[block.get_selector(0, y)]);
- pDst[1].set_rgb(subblock_colors1[block.get_selector(1, y)]);
- pDst[2].set_rgb(subblock_colors1[block.get_selector(2, y)]);
- pDst[3].set_rgb(subblock_colors1[block.get_selector(3, y)]);
- pDst += 4;
- }
- }
- else
- {
- for (uint y = 0; y < 4; y++)
- {
- pDst[0].set_rgb(subblock_colors0[block.get_selector(0, y)]);
- pDst[1].set_rgb(subblock_colors0[block.get_selector(1, y)]);
- pDst[2].set_rgb(subblock_colors1[block.get_selector(2, y)]);
- pDst[3].set_rgb(subblock_colors1[block.get_selector(3, y)]);
- pDst += 4;
- }
- }
- }
- else
- {
- if (flip_flag)
- {
- // 0000
- // 0000
- // 1111
- // 1111
- for (uint y = 0; y < 2; y++)
- {
- pDst[0] = subblock_colors0[block.get_selector(0, y)];
- pDst[1] = subblock_colors0[block.get_selector(1, y)];
- pDst[2] = subblock_colors0[block.get_selector(2, y)];
- pDst[3] = subblock_colors0[block.get_selector(3, y)];
- pDst += 4;
- }
-
- for (uint y = 2; y < 4; y++)
- {
- pDst[0] = subblock_colors1[block.get_selector(0, y)];
- pDst[1] = subblock_colors1[block.get_selector(1, y)];
- pDst[2] = subblock_colors1[block.get_selector(2, y)];
- pDst[3] = subblock_colors1[block.get_selector(3, y)];
- pDst += 4;
- }
- }
- else
- {
- // 0011
- // 0011
- // 0011
- // 0011
- for (uint y = 0; y < 4; y++)
- {
- pDst[0] = subblock_colors0[block.get_selector(0, y)];
- pDst[1] = subblock_colors0[block.get_selector(1, y)];
- pDst[2] = subblock_colors1[block.get_selector(2, y)];
- pDst[3] = subblock_colors1[block.get_selector(3, y)];
- pDst += 4;
- }
- }
- }
-
- return success;
- }
-
- bool etc1_optimizer::compute()
- {
- const uint n = m_pParams->m_num_src_pixels;
- const int scan_delta_size = m_pParams->m_scan_delta_size;
-
- // Scan through a subset of the 3D lattice centered around the avg block color trying each 3D (555 or 444) lattice point as a potential block color.
- // Each time a better solution is found try to refine the current solution's block color based of the current selectors and intensity table index.
- for (int zdi = 0; zdi < scan_delta_size; zdi++)
- {
- const int zd = m_pParams->m_pScan_deltas[zdi];
- const int mbb = m_bb + zd;
- if (mbb < 0) continue; else if (mbb > m_limit) break;
-
- for (int ydi = 0; ydi < scan_delta_size; ydi++)
- {
- const int yd = m_pParams->m_pScan_deltas[ydi];
- const int mbg = m_bg + yd;
- if (mbg < 0) continue; else if (mbg > m_limit) break;
-
- for (int xdi = 0; xdi < scan_delta_size; xdi++)
- {
- const int xd = m_pParams->m_pScan_deltas[xdi];
- const int mbr = m_br + xd;
- if (mbr < 0) continue; else if (mbr > m_limit) break;
-
- etc1_solution_coordinates coords(mbr, mbg, mbb, 0, m_pParams->m_use_color4);
- if (m_pParams->m_quality == cCRNETCQualitySlow)
- {
- if (!evaluate_solution(coords, m_trial_solution, &m_best_solution))
- continue;
- }
- else
- {
- if (!evaluate_solution_fast(coords, m_trial_solution, &m_best_solution))
- continue;
- }
-
- // Now we have the input block, the avg. color of the input pixels, a set of trial selector indices, and the block color+intensity index.
- // Now, for each component, attempt to refine the current solution by solving a simple linear equation. For example, for 4 colors:
- // The goal is:
- // pixel0 - (block_color+inten_table[selector0]) + pixel1 - (block_color+inten_table[selector1]) + pixel2 - (block_color+inten_table[selector2]) + pixel3 - (block_color+inten_table[selector3]) = 0
- // Rearranging this:
- // (pixel0 + pixel1 + pixel2 + pixel3) - (block_color+inten_table[selector0]) - (block_color+inten_table[selector1]) - (block_color+inten_table[selector2]) - (block_color+inten_table[selector3]) = 0
- // (pixel0 + pixel1 + pixel2 + pixel3) - block_color - inten_table[selector0] - block_color-inten_table[selector1] - block_color-inten_table[selector2] - block_color-inten_table[selector3] = 0
- // (pixel0 + pixel1 + pixel2 + pixel3) - 4*block_color - inten_table[selector0] - inten_table[selector1] - inten_table[selector2] - inten_table[selector3] = 0
- // (pixel0 + pixel1 + pixel2 + pixel3) - 4*block_color - (inten_table[selector0] + inten_table[selector1] + inten_table[selector2] + inten_table[selector3]) = 0
- // (pixel0 + pixel1 + pixel2 + pixel3)/4 - block_color - (inten_table[selector0] + inten_table[selector1] + inten_table[selector2] + inten_table[selector3])/4 = 0
- // block_color = (pixel0 + pixel1 + pixel2 + pixel3)/4 - (inten_table[selector0] + inten_table[selector1] + inten_table[selector2] + inten_table[selector3])/4
- // So what this means:
- // optimal_block_color = avg_input - avg_inten_delta
- // So the optimal block color can be computed by taking the average block color and subtracting the current average of the intensity delta.
- // Unfortunately, optimal_block_color must then be quantized to 555 or 444 so it's not always possible to improve matters using this formula.
- // Also, the above formula is for unclamped intensity deltas. The actual implementation takes into account clamping.
-
- const uint max_refinement_trials = (m_pParams->m_quality == cCRNETCQualityFast) ? 2 : (((xd | yd | zd) == 0) ? 4 : 2);
- for (uint refinement_trial = 0; refinement_trial < max_refinement_trials; refinement_trial++)
- {
- const uint8* pSelectors = m_best_solution.m_selectors.get_ptr();
- const int* pInten_table = g_etc1_inten_tables[m_best_solution.m_coords.m_inten_table];
-
- int delta_sum_r = 0, delta_sum_g = 0, delta_sum_b = 0;
- const color_quad_u8 base_color(m_best_solution.m_coords.get_scaled_color());
- for (uint r = 0; r < n; r++)
- {
- const uint s = *pSelectors++;
- const int yd = pInten_table[s];
- // Compute actual delta being applied to each pixel, taking into account clamping.
- delta_sum_r += math::clamp<int>(base_color.r + yd, 0, 255) - base_color.r;
- delta_sum_g += math::clamp<int>(base_color.g + yd, 0, 255) - base_color.g;
- delta_sum_b += math::clamp<int>(base_color.b + yd, 0, 255) - base_color.b;
- }
- if ((!delta_sum_r) && (!delta_sum_g) && (!delta_sum_b))
- break;
- const float avg_delta_r_f = static_cast<float>(delta_sum_r) / n;
- const float avg_delta_g_f = static_cast<float>(delta_sum_g) / n;
- const float avg_delta_b_f = static_cast<float>(delta_sum_b) / n;
- const int br1 = math::clamp<int>(static_cast<uint>((m_avg_color[0] - avg_delta_r_f) * m_limit / 255.0f + .5f), 0, m_limit);
- const int bg1 = math::clamp<int>(static_cast<uint>((m_avg_color[1] - avg_delta_g_f) * m_limit / 255.0f + .5f), 0, m_limit);
- const int bb1 = math::clamp<int>(static_cast<uint>((m_avg_color[2] - avg_delta_b_f) * m_limit / 255.0f + .5f), 0, m_limit);
-
- bool skip = false;
-
- if ((mbr == br1) && (mbg == bg1) && (mbb == bb1))
- skip = true;
- else if ((br1 == m_best_solution.m_coords.m_unscaled_color.r) && (bg1 == m_best_solution.m_coords.m_unscaled_color.g) && (bb1 == m_best_solution.m_coords.m_unscaled_color.b))
- skip = true;
- else if ((m_br == br1) && (m_bg == bg1) && (m_bb == bb1))
- skip = true;
-
- if (skip)
- break;
-
- etc1_solution_coordinates coords1(br1, bg1, bb1, 0, m_pParams->m_use_color4);
- if (m_pParams->m_quality == cCRNETCQualitySlow)
- {
- if (!evaluate_solution(coords1, m_trial_solution, &m_best_solution))
- break;
- }
- else
- {
- if (!evaluate_solution_fast(coords1, m_trial_solution, &m_best_solution))
- break;
- }
-
- } // refinement_trial
-
- } // xdi
- } // ydi
- } // zdi
-
- if (!m_best_solution.m_valid)
- {
- m_pResult->m_error = cUINT32_MAX;
- return false;
- }
-
- const uint8* pSelectors = m_best_solution.m_selectors.get_ptr();
-
-#ifdef CRNLIB_BUILD_DEBUG
- {
- color_quad_u8 block_colors[4];
- m_best_solution.m_coords.get_block_colors(block_colors);
-
- const color_quad_u8* pSrc_pixels = m_pParams->m_pSrc_pixels;
- uint64 actual_error = 0;
- for (uint i = 0; i < n; i++)
- actual_error += color::elucidian_distance(pSrc_pixels[i], block_colors[pSelectors[i]], false);
-
- CRNLIB_ASSERT(actual_error == m_best_solution.m_error);
- }
-#endif
-
- m_pResult->m_error = m_best_solution.m_error;
-
- m_pResult->m_block_color_unscaled = m_best_solution.m_coords.m_unscaled_color;
- m_pResult->m_block_color4 = m_best_solution.m_coords.m_color4;
-
- m_pResult->m_block_inten_table = m_best_solution.m_coords.m_inten_table;
- memcpy(m_pResult->m_pSelectors, pSelectors, n);
- m_pResult->m_n = n;
-
- return true;
- }
-
- void etc1_optimizer::init(const params& params, results& result)
- {
- m_pParams = &params;
- m_pResult = &result;
-
- const uint n = m_pParams->m_num_src_pixels;
-
- m_selectors.resize(n);
- m_best_selectors.resize(n);
- m_temp_selectors.resize(n);
- m_trial_solution.m_selectors.resize(n);
- m_best_solution.m_selectors.resize(n);
-
- m_limit = m_pParams->m_use_color4 ? 15 : 31;
-
- vec3F avg_color(0.0f);
-
- m_luma.resize(n);
- m_sorted_luma[0].resize(n);
- m_sorted_luma[1].resize(n);
-
- for (uint i = 0; i < n; i++)
- {
- const color_quad_u8& c = m_pParams->m_pSrc_pixels[i];
- const vec3F fc(c.r, c.g, c.b);
-
- avg_color += fc;
-
- m_luma[i] = static_cast<uint16>(c.r + c.g + c.b);
- m_sorted_luma[0][i] = i;
- }
- avg_color /= static_cast<float>(n);
- m_avg_color = avg_color;
-
- m_br = math::clamp<int>(static_cast<uint>(m_avg_color[0] * m_limit / 255.0f + .5f), 0, m_limit);
- m_bg = math::clamp<int>(static_cast<uint>(m_avg_color[1] * m_limit / 255.0f + .5f), 0, m_limit);
- m_bb = math::clamp<int>(static_cast<uint>(m_avg_color[2] * m_limit / 255.0f + .5f), 0, m_limit);
-
- if (m_pParams->m_quality <= cCRNETCQualityMedium)
- {
- m_pSorted_luma_indices = indirect_radix_sort(n, m_sorted_luma[0].get_ptr(), m_sorted_luma[1].get_ptr(), m_luma.get_ptr(), 0, sizeof(m_luma[0]), false);
- m_pSorted_luma = m_sorted_luma[0].get_ptr();
- if (m_pSorted_luma_indices == m_sorted_luma[0].get_ptr())
- m_pSorted_luma = m_sorted_luma[1].get_ptr();
-
- for (uint i = 0; i < n; i++)
- m_pSorted_luma[i] = m_luma[m_pSorted_luma_indices[i]];
- }
-
- m_best_solution.m_coords.clear();
- m_best_solution.m_valid = false;
- m_best_solution.m_error = cUINT64_MAX;
- }
-
- bool etc1_optimizer::evaluate_solution(const etc1_solution_coordinates& coords, potential_solution& trial_solution, potential_solution* pBest_solution)
- {
- trial_solution.m_valid = false;
-
- if (m_pParams->m_constrain_against_base_color5)
- {
- const int dr = coords.m_unscaled_color.r - m_pParams->m_base_color5.r;
- const int dg = coords.m_unscaled_color.g - m_pParams->m_base_color5.g;
- const int db = coords.m_unscaled_color.b - m_pParams->m_base_color5.b;
-
- if ((math::minimum(dr, dg, db) < cETC1ColorDeltaMin) || (math::maximum(dr, dg, db) > cETC1ColorDeltaMax))
- return false;
- }
-
- const color_quad_u8 base_color(coords.get_scaled_color());
-
- const uint n = m_pParams->m_num_src_pixels;
- CRNLIB_ASSERT(trial_solution.m_selectors.size() == n);
-
- trial_solution.m_error = cUINT64_MAX;
-
- for (uint inten_table = 0; inten_table < cETC1IntenModifierValues; inten_table++)
- {
- const int* pInten_table = g_etc1_inten_tables[inten_table];
-
- color_quad_u8 block_colors[4];
- for (uint s = 0; s < 4; s++)
- {
- const int yd = pInten_table[s];
- block_colors[s].set(base_color.r + yd, base_color.g + yd, base_color.b + yd, 0);
- }
-
- uint64 total_error = 0;
-
- const color_quad_u8* pSrc_pixels = m_pParams->m_pSrc_pixels;
- for (uint c = 0; c < n; c++)
- {
- const color_quad_u8& src_pixel = *pSrc_pixels++;
-
- uint best_selector_index = 0;
- uint best_error = math::square(src_pixel.r - block_colors[0].r) + math::square(src_pixel.g - block_colors[0].g) + math::square(src_pixel.b - block_colors[0].b);
-
- uint trial_error = math::square(src_pixel.r - block_colors[1].r) + math::square(src_pixel.g - block_colors[1].g) + math::square(src_pixel.b - block_colors[1].b);
- if (trial_error < best_error)
- {
- best_error = trial_error;
- best_selector_index = 1;
- }
-
- trial_error = math::square(src_pixel.r - block_colors[2].r) + math::square(src_pixel.g - block_colors[2].g) + math::square(src_pixel.b - block_colors[2].b);
- if (trial_error < best_error)
- {
- best_error = trial_error;
- best_selector_index = 2;
- }
-
- trial_error = math::square(src_pixel.r - block_colors[3].r) + math::square(src_pixel.g - block_colors[3].g) + math::square(src_pixel.b - block_colors[3].b);
- if (trial_error < best_error)
- {
- best_error = trial_error;
- best_selector_index = 3;
- }
-
- m_temp_selectors[c] = static_cast<uint8>(best_selector_index);
-
- total_error += best_error;
- if (total_error >= trial_solution.m_error)
- break;
- }
-
- if (total_error < trial_solution.m_error)
- {
- trial_solution.m_error = total_error;
- trial_solution.m_coords.m_inten_table = inten_table;
- trial_solution.m_selectors.swap(m_temp_selectors);
- trial_solution.m_valid = true;
- }
- }
- trial_solution.m_coords.m_unscaled_color = coords.m_unscaled_color;
- trial_solution.m_coords.m_color4 = m_pParams->m_use_color4;
-
- bool success = false;
- if (pBest_solution)
- {
- if (trial_solution.m_error < pBest_solution->m_error)
- {
- *pBest_solution = trial_solution;
- success = true;
- }
- }
-
- return success;
- }
-
- bool etc1_optimizer::evaluate_solution_fast(const etc1_solution_coordinates& coords, potential_solution& trial_solution, potential_solution* pBest_solution)
- {
- if (m_pParams->m_constrain_against_base_color5)
- {
- const int dr = coords.m_unscaled_color.r - m_pParams->m_base_color5.r;
- const int dg = coords.m_unscaled_color.g - m_pParams->m_base_color5.g;
- const int db = coords.m_unscaled_color.b - m_pParams->m_base_color5.b;
-
- if ((math::minimum(dr, dg, db) < cETC1ColorDeltaMin) || (math::maximum(dr, dg, db) > cETC1ColorDeltaMax))
- {
- trial_solution.m_valid = false;
- return false;
- }
- }
-
- const color_quad_u8 base_color(coords.get_scaled_color());
-
- const uint n = m_pParams->m_num_src_pixels;
- CRNLIB_ASSERT(trial_solution.m_selectors.size() == n);
-
- trial_solution.m_error = cUINT64_MAX;
-
- for (int inten_table = cETC1IntenModifierValues - 1; inten_table >= 0; --inten_table)
- {
- const int* pInten_table = g_etc1_inten_tables[inten_table];
-
- uint block_inten[4];
- color_quad_u8 block_colors[4];
- for (uint s = 0; s < 4; s++)
- {
- const int yd = pInten_table[s];
- color_quad_u8 block_color(base_color.r + yd, base_color.g + yd, base_color.b + yd, 0);
- block_colors[s] = block_color;
- block_inten[s] = block_color.r + block_color.g + block_color.b;
- }
-
- // evaluate_solution_fast() enforces/assumesd a total ordering of the input colors along the intensity (1,1,1) axis to more quickly classify the inputs to selectors.
- // The inputs colors have been presorted along the projection onto this axis, and ETC1 block colors are always ordered along the intensity axis, so this classification is fast.
- // 0 1 2 3
- // 01 12 23
- const uint block_inten_midpoints[3] = { block_inten[0] + block_inten[1], block_inten[1] + block_inten[2], block_inten[2] + block_inten[3] };
-
- uint64 total_error = 0;
- const color_quad_u8* pSrc_pixels = m_pParams->m_pSrc_pixels;
- if ((m_pSorted_luma[n - 1] * 2) < block_inten_midpoints[0])
- {
- if (block_inten[0] > m_pSorted_luma[n - 1])
- {
- const uint min_error = labs(block_inten[0] - m_pSorted_luma[n - 1]);
- if (min_error >= trial_solution.m_error)
- continue;
- }
-
- memset(&m_temp_selectors[0], 0, n);
-
- for (uint c = 0; c < n; c++)
- total_error += color::elucidian_distance(block_colors[0], pSrc_pixels[c], false);
- }
- else if ((m_pSorted_luma[0] * 2) >= block_inten_midpoints[2])
- {
- if (m_pSorted_luma[0] > block_inten[3])
- {
- const uint min_error = labs(m_pSorted_luma[0] - block_inten[3]);
- if (min_error >= trial_solution.m_error)
- continue;
- }
-
- memset(&m_temp_selectors[0], 3, n);
-
- for (uint c = 0; c < n; c++)
- total_error += color::elucidian_distance(block_colors[3], pSrc_pixels[c], false);
- }
- else
- {
- uint cur_selector = 0, c;
- for (c = 0; c < n; c++)
- {
- const uint y = m_pSorted_luma[c];
- while ((y * 2) >= block_inten_midpoints[cur_selector])
- if (++cur_selector > 2)
- goto done;
- const uint sorted_pixel_index = m_pSorted_luma_indices[c];
- m_temp_selectors[sorted_pixel_index] = static_cast<uint8>(cur_selector);
- total_error += color::elucidian_distance(block_colors[cur_selector], pSrc_pixels[sorted_pixel_index], false);
- }
-done:
- while (c < n)
- {
- const uint sorted_pixel_index = m_pSorted_luma_indices[c];
- m_temp_selectors[sorted_pixel_index] = 3;
- total_error += color::elucidian_distance(block_colors[3], pSrc_pixels[sorted_pixel_index], false);
- ++c;
- }
- }
-
- if (total_error < trial_solution.m_error)
- {
- trial_solution.m_error = total_error;
- trial_solution.m_coords.m_inten_table = inten_table;
- trial_solution.m_selectors.swap(m_temp_selectors);
- trial_solution.m_valid = true;
- if (!total_error)
- break;
- }
- }
- trial_solution.m_coords.m_unscaled_color = coords.m_unscaled_color;
- trial_solution.m_coords.m_color4 = m_pParams->m_use_color4;
-
- bool success = false;
- if (pBest_solution)
- {
- if (trial_solution.m_error < pBest_solution->m_error)
- {
- *pBest_solution = trial_solution;
- success = true;
- }
- }
-
- return success;
- }
-
- // Dither function from RYG's public domain real-time DXT1 compressor, modified for 555.
- static void DitherBlock(color_quad_u8 *dest, const color_quad_u8 *block)
- {
- int err[8],*ep1 = err,*ep2 = err+4;
- uint8 *quant = ryg_dxt::QuantRBTab+8;
-
- // process channels seperately
- for(int ch=0;ch<3;ch++)
- {
- uint8 *bp = (uint8 *) block;
- uint8 *dp = (uint8 *) dest;
-
- bp += ch;
- dp += ch;
- memset(err,0,sizeof(err));
-
- for(int y=0;y<4;y++)
- {
- // pixel 0
- dp[ 0] = quant[bp[ 0] + ((3*ep2[1] + 5*ep2[0]) >> 4)];
- ep1[0] = bp[ 0] - dp[ 0];
-
- // pixel 1
- dp[ 4] = quant[bp[ 4] + ((7*ep1[0] + 3*ep2[2] + 5*ep2[1] + ep2[0]) >> 4)];
- ep1[1] = bp[ 4] - dp[ 4];
-
- // pixel 2
- dp[ 8] = quant[bp[ 8] + ((7*ep1[1] + 3*ep2[3] + 5*ep2[2] + ep2[1]) >> 4)];
- ep1[2] = bp[ 8] - dp[ 8];
-
- // pixel 3
- dp[12] = quant[bp[12] + ((7*ep1[2] + 5*ep2[3] + ep2[2]) >> 4)];
- ep1[3] = bp[12] - dp[12];
-
- // advance to next line
- std::swap(ep1,ep2);
- bp += 16;
- dp += 16;
- }
- }
- }
-
- static uint etc1_decode_value(uint diff, uint inten, uint selector, uint packed_c)
- {
- const uint limit = diff ? 32 : 16; limit;
- CRNLIB_ASSERT((diff < 2) && (inten < 8) && (selector < 4) && (packed_c < limit));
- int c;
- if (diff)
- c = (packed_c >> 2) | (packed_c << 3);
- else
- c = packed_c | (packed_c << 4);
- c += g_etc1_inten_tables[inten][selector];
- c = math::clamp<int>(c, 0, 255);
- return c;
- }
-
- void pack_etc1_block_init()
- {
- for (uint diff = 0; diff < 2; diff++)
- {
- const uint limit = diff ? 32 : 16;
-
- for (uint inten = 0; inten < 8; inten++)
- {
- for (uint selector = 0; selector < 4; selector++)
- {
- const uint inverse_table_index = diff + (inten << 1) + (selector << 4);
- for (uint color = 0; color < 256; color++)
- {
- uint best_error = cUINT32_MAX, best_packed_c = 0;
- for (uint packed_c = 0; packed_c < limit; packed_c++)
- {
- int v = etc1_decode_value(diff, inten, selector, packed_c);
- uint err = labs(v - color);
- if (err < best_error)
- {
- best_error = err;
- best_packed_c = packed_c;
- if (!best_error)
- break;
- }
- }
- CRNLIB_ASSERT(best_error <= 255);
- g_etc1_inverse_lookup[inverse_table_index][color] = static_cast<uint16>(best_packed_c | (best_error << 8));
- }
- }
- }
- }
- }
-
- // Packs solid color blocks efficiently using a set of small precomputed tables.
- // For random 888 inputs, MSE results are better than Erricson's ETC1 packer in "slow" mode ~9.5% of the time, is slightly worse only ~.01% of the time, and is equal the rest of the time.
- static uint64 pack_etc1_block_solid_color(etc1_block& block, const uint8* pColor, crn_etc1_pack_params& pack_params, pack_etc1_block_context& context)
- {
- CRNLIB_ASSERT(g_etc1_inverse_lookup[0][255]);
-
- context, pack_params;
- static uint s_next_comp[4] = { 1, 2, 0, 1 };
-
- uint best_error = cUINT32_MAX, best_i = 0;
- int best_x = 0, best_packed_c1 = 0, best_packed_c2 = 0;
-
- // For each possible 8-bit value, there is a precomputed list of diff/inten/selector configurations that allow that 8-bit value to be encoded with no error.
- for (uint i = 0; i < 3; i++)
- {
- const uint c1 = pColor[s_next_comp[i]], c2 = pColor[s_next_comp[i + 1]];
-
- const int delta_range = 1;
- for (int delta = -delta_range; delta <= delta_range; delta++)
- {
- const int c_plus_delta = math::clamp<int>(pColor[i] + delta, 0, 255);
-
- const uint16* pTable;
- if (!c_plus_delta)
- pTable = g_color8_to_etc_block_config_0_255[0];
- else if (c_plus_delta == 255)
- pTable = g_color8_to_etc_block_config_0_255[1];
- else
- pTable = g_color8_to_etc_block_config_1_to_254[c_plus_delta - 1];
-
- do
- {
- const uint x = *pTable++;
-
-#ifdef CRNLIB_BUILD_DEBUG
- const uint diff = x & 1;
- const uint inten = (x >> 1) & 7;
- const uint selector = (x >> 4) & 3;
- const uint p0 = (x >> 8) & 255;
- CRNLIB_ASSERT(etc1_decode_value(diff, inten, selector, p0) == (uint)c_plus_delta);
-#endif
-
- const uint16* pInverse_table = g_etc1_inverse_lookup[x & 0xFF];
- uint16 p1 = pInverse_table[c1];
- uint16 p2 = pInverse_table[c2];
- const uint trial_error = math::square(c_plus_delta - pColor[i]) + math::square(p1 >> 8) + math::square(p2 >> 8);
- if (trial_error < best_error)
- {
- best_error = trial_error;
- best_x = x;
- best_packed_c1 = p1 & 0xFF;
- best_packed_c2 = p2 & 0xFF;
- best_i = i;
- if (!best_error)
- goto found_perfect_match;
- }
- } while (*pTable != 0xFFFF);
- }
- }
-found_perfect_match:
-
- const uint diff = best_x & 1;
- const uint inten = (best_x >> 1) & 7;
-
- block.m_bytes[3] = static_cast<uint8>(((inten | (inten << 3)) << 2) | (diff << 1));
-
- const uint etc1_selector = g_selector_index_to_etc1[(best_x >> 4) & 3];
- *reinterpret_cast<uint16*>(&block.m_bytes[4]) = (etc1_selector & 2) ? 0xFFFF : 0;
- *reinterpret_cast<uint16*>(&block.m_bytes[6]) = (etc1_selector & 1) ? 0xFFFF : 0;
-
- const uint best_packed_c0 = (best_x >> 8) & 255;
- if (diff)
- {
- block.m_bytes[best_i] = static_cast<uint8>(best_packed_c0 << 3);
- block.m_bytes[s_next_comp[best_i]] = static_cast<uint8>(best_packed_c1 << 3);
- block.m_bytes[s_next_comp[best_i+1]] = static_cast<uint8>(best_packed_c2 << 3);
- }
- else
- {
- block.m_bytes[best_i] = static_cast<uint8>(best_packed_c0 | (best_packed_c0 << 4));
- block.m_bytes[s_next_comp[best_i]] = static_cast<uint8>(best_packed_c1 | (best_packed_c1 << 4));
- block.m_bytes[s_next_comp[best_i+1]] = static_cast<uint8>(best_packed_c2 | (best_packed_c2 << 4));
- }
-
- return best_error;
- }
-
- static uint pack_etc1_block_solid_color_constrained(
- etc1_optimizer::results& results,
- uint num_colors, const uint8 *pColor,
- crn_etc1_pack_params& pack_params,
- pack_etc1_block_context& context,
- bool use_diff,
- const color_quad_u8* pBase_color5_unscaled)
- {
- CRNLIB_ASSERT(g_etc1_inverse_lookup[0][255]);
-
- context, pack_params;
- static uint s_next_comp[4] = { 1, 2, 0, 1 };
-
- uint best_error = cUINT32_MAX, best_i = 0;
- int best_x = 0, best_packed_c1 = 0, best_packed_c2 = 0;
-
- // For each possible 8-bit value, there is a precomputed list of diff/inten/selector configurations that allow that 8-bit value to be encoded with no error.
- for (uint i = 0; i < 3; i++)
- {
- const uint c1 = pColor[s_next_comp[i]], c2 = pColor[s_next_comp[i + 1]];
-
- const int delta_range = 1;
- for (int delta = -delta_range; delta <= delta_range; delta++)
- {
- const int c_plus_delta = math::clamp<int>(pColor[i] + delta, 0, 255);
-
- const uint16* pTable;
- if (!c_plus_delta)
- pTable = g_color8_to_etc_block_config_0_255[0];
- else if (c_plus_delta == 255)
- pTable = g_color8_to_etc_block_config_0_255[1];
- else
- pTable = g_color8_to_etc_block_config_1_to_254[c_plus_delta - 1];
-
- do
- {
- const uint x = *pTable++;
- const uint diff = x & 1;
- if (static_cast<uint>(use_diff) != diff)
- {
- if (*pTable == 0xFFFF)
- break;
- continue;
- }
-
- if ((diff) && (pBase_color5_unscaled))
- {
- const int p0 = (x >> 8) & 255;
- int delta = p0 - static_cast<int>(pBase_color5_unscaled->c[i]);
- if ((delta < cETC1ColorDeltaMin) || (delta > cETC1ColorDeltaMax))
- {
- if (*pTable == 0xFFFF)
- break;
- continue;
- }
- }
-
-#ifdef CRNLIB_BUILD_DEBUG
- {
- const uint inten = (x >> 1) & 7;
- const uint selector = (x >> 4) & 3;
- const uint p0 = (x >> 8) & 255;
- CRNLIB_ASSERT(etc1_decode_value(diff, inten, selector, p0) == (uint)c_plus_delta);
- }
-#endif
-
- const uint16* pInverse_table = g_etc1_inverse_lookup[x & 0xFF];
- uint16 p1 = pInverse_table[c1];
- uint16 p2 = pInverse_table[c2];
-
- if ((diff) && (pBase_color5_unscaled))
- {
- int delta1 = (p1 & 0xFF) - static_cast<int>(pBase_color5_unscaled->c[s_next_comp[i]]);
- int delta2 = (p2 & 0xFF) - static_cast<int>(pBase_color5_unscaled->c[s_next_comp[i + 1]]);
- if ((delta1 < cETC1ColorDeltaMin) || (delta1 > cETC1ColorDeltaMax) || (delta2 < cETC1ColorDeltaMin) || (delta2 > cETC1ColorDeltaMax))
- {
- if (*pTable == 0xFFFF)
- break;
- continue;
- }
- }
-
- const uint trial_error = math::square(c_plus_delta - pColor[i]) + math::square(p1 >> 8) + math::square(p2 >> 8);
- if (trial_error < best_error)
- {
- best_error = trial_error;
- best_x = x;
- best_packed_c1 = p1 & 0xFF;
- best_packed_c2 = p2 & 0xFF;
- best_i = i;
- if (!best_error)
- goto found_perfect_match;
- }
- } while (*pTable != 0xFFFF);
- }
- }
-found_perfect_match:
-
- if (best_error == cUINT32_MAX)
- return best_error;
-
- best_error *= num_colors;
-
- results.m_n = num_colors;
- results.m_block_color4 = !(best_x & 1);
- results.m_block_inten_table = (best_x >> 1) & 7;
- memset(results.m_pSelectors, (best_x >> 4) & 3, num_colors);
-
- const uint best_packed_c0 = (best_x >> 8) & 255;
- results.m_block_color_unscaled[best_i] = static_cast<uint8>(best_packed_c0);
- results.m_block_color_unscaled[s_next_comp[best_i]] = static_cast<uint8>(best_packed_c1);
- results.m_block_color_unscaled[s_next_comp[best_i + 1]] = static_cast<uint8>(best_packed_c2);
- results.m_error = best_error;
-
- return best_error;
- }
-
- uint64 pack_etc1_block(etc1_block& dst_block, const color_quad_u8* pSrc_pixels, crn_etc1_pack_params& pack_params, pack_etc1_block_context& context)
- {
- color_quad_u8 src_pixel0(pSrc_pixels[0]);
-
- int r;
- for (r = 15; r >= 1; --r)
- if ((pSrc_pixels[r].r != src_pixel0.r) || (pSrc_pixels[r].g != src_pixel0.g) || (pSrc_pixels[r].b != src_pixel0.b))
- break;
- if (!r)
- return 16 * pack_etc1_block_solid_color(dst_block, &pSrc_pixels[0].r, pack_params, context);
-
- color_quad_u8 dithered_pixels[16];
- if (pack_params.m_dithering)
- {
- DitherBlock(dithered_pixels, pSrc_pixels);
- pSrc_pixels = dithered_pixels;
- }
-
- uint64 best_error = cUINT64_MAX;
- uint best_flip = false, best_use_color4 = false;
-
- uint8 best_selectors[2][8];
- etc1_optimizer::results best_results[2];
- for (uint i = 0; i < 2; i++)
- {
- best_results[i].m_n = 8;
- best_results[i].m_pSelectors = best_selectors[i];
- }
-
- uint8 selectors[3][8];
- etc1_optimizer::results results[3];
-
- for (uint i = 0; i < 3; i++)
- {
- results[i].m_n = 8;
- results[i].m_pSelectors = selectors[i];
- }
-
- color_quad_u8 subblock_pixels[8];
-
- etc1_optimizer::params params(pack_params);
- params.m_num_src_pixels = 8;
- params.m_pSrc_pixels = subblock_pixels;
-
- for (uint flip = 0; flip < 2; flip++)
- {
- for (uint use_color4 = 0; use_color4 < 2; use_color4++)
- {
- uint64 trial_error = 0;
-
- uint subblock;
- for (subblock = 0; subblock < 2; subblock++)
- {
- if (flip)
- memcpy(subblock_pixels, pSrc_pixels + subblock * 8, sizeof(color_quad_u8) * 8);
- else
- {
- const color_quad_u8* pSrc_col = pSrc_pixels + subblock * 2;
- subblock_pixels[0] = pSrc_col[0]; subblock_pixels[1] = pSrc_col[4]; subblock_pixels[2] = pSrc_col[8]; subblock_pixels[3] = pSrc_col[12];
- subblock_pixels[4] = pSrc_col[1]; subblock_pixels[5] = pSrc_col[5]; subblock_pixels[6] = pSrc_col[9]; subblock_pixels[7] = pSrc_col[13];
- }
-
- results[2].m_error = cUINT64_MAX;
- if ((params.m_quality >= cCRNETCQualityMedium) && ((subblock) || (use_color4)))
- {
- color_quad_u8 subblock_pixel0(subblock_pixels[0]);
- for (r = 7; r >= 1; --r)
- if ((subblock_pixels[r].r != subblock_pixel0.r) || (subblock_pixels[r].g != subblock_pixel0.g) || (subblock_pixels[r].b != subblock_pixel0.b))
- break;
- if (!r)
- {
- pack_etc1_block_solid_color_constrained(results[2], 8, &subblock_pixel0.r, pack_params, context, !use_color4, (subblock && !use_color4) ? &results[0].m_block_color_unscaled : NULL);
- }
- }
-
- params.m_use_color4 = (use_color4 != 0);
- params.m_constrain_against_base_color5 = false;
-
- if ((!use_color4) && (subblock))
- {
- params.m_constrain_against_base_color5 = true;
- params.m_base_color5 = results[0].m_block_color_unscaled;
- }
-
- if (params.m_quality == cCRNETCQualitySlow)
- {
- static const int s_scan_delta_0_to_4[] = { -4, -3, -2, -1, 0, 1, 2, 3, 4 };
- params.m_scan_delta_size = CRNLIB_ARRAY_SIZE(s_scan_delta_0_to_4);
- params.m_pScan_deltas = s_scan_delta_0_to_4;
- }
- else if (params.m_quality == cCRNETCQualityMedium)
- {
- static const int s_scan_delta_0_to_1[] = { -1, 0, 1 };
- params.m_scan_delta_size = CRNLIB_ARRAY_SIZE(s_scan_delta_0_to_1);
- params.m_pScan_deltas = s_scan_delta_0_to_1;
- }
- else
- {
- static const int s_scan_delta_0[] = { 0 };
- params.m_scan_delta_size = CRNLIB_ARRAY_SIZE(s_scan_delta_0);
- params.m_pScan_deltas = s_scan_delta_0;
- }
-
- context.m_optimizer.init(params, results[subblock]);
-
- if (!context.m_optimizer.compute())
- break;
-
- // Fairly arbitrary/unrefined thresholds that control how far away to scan for potentially better solutions.
- const uint refinement_error_thresh0 = 3000;
- const uint refinement_error_thresh1 = 6000;
- if ((params.m_quality >= cCRNETCQualityMedium) && (results[subblock].m_error > refinement_error_thresh0))
- {
- if (params.m_quality == cCRNETCQualityMedium)
- {
- static const int s_scan_delta_2_to_3[] = { -3, -2, 2, 3 };
- params.m_scan_delta_size = CRNLIB_ARRAY_SIZE(s_scan_delta_2_to_3);
- params.m_pScan_deltas = s_scan_delta_2_to_3;
- }
- else
- {
- static const int s_scan_delta_5_to_5[] = { -5, 5 };
- static const int s_scan_delta_5_to_8[] = { -8, -7, -6, -5, 5, 6, 7, 8 };
- if (results[subblock].m_error > refinement_error_thresh1)
- {
- params.m_scan_delta_size = CRNLIB_ARRAY_SIZE(s_scan_delta_5_to_8);
- params.m_pScan_deltas = s_scan_delta_5_to_8;
- }
- else
- {
- params.m_scan_delta_size = CRNLIB_ARRAY_SIZE(s_scan_delta_5_to_5);
- params.m_pScan_deltas = s_scan_delta_5_to_5;
- }
- }
-
- if (!context.m_optimizer.compute())
- break;
- }
-
- if (results[2].m_error < results[subblock].m_error)
- results[subblock] = results[2];
-
- trial_error += results[subblock].m_error;
- if (trial_error >= best_error)
- break;
- }
-
- if (subblock < 2)
- continue;
-
- best_error = trial_error;
- best_results[0] = results[0];
- best_results[1] = results[1];
- best_flip = flip;
- best_use_color4 = use_color4;
-
- } // use_color4
-
- } // flip
-
- int dr = best_results[1].m_block_color_unscaled.r - best_results[0].m_block_color_unscaled.r;
- int dg = best_results[1].m_block_color_unscaled.g - best_results[0].m_block_color_unscaled.g;
- int db = best_results[1].m_block_color_unscaled.b - best_results[0].m_block_color_unscaled.b;
- if (!best_use_color4)
- {
- if ((math::minimum(dr, dg, db) < cETC1ColorDeltaMin) || (math::maximum(dr, dg, db) > cETC1ColorDeltaMax))
- {
- // Shouldn't ever happen
- CRNLIB_VERIFY(0);
- }
- }
-
- if (best_use_color4)
- {
- dst_block.m_bytes[0] = static_cast<uint8>(best_results[1].m_block_color_unscaled.r | (best_results[0].m_block_color_unscaled.r << 4));
- dst_block.m_bytes[1] = static_cast<uint8>(best_results[1].m_block_color_unscaled.g | (best_results[0].m_block_color_unscaled.g << 4));
- dst_block.m_bytes[2] = static_cast<uint8>(best_results[1].m_block_color_unscaled.b | (best_results[0].m_block_color_unscaled.b << 4));
- }
- else
- {
- if (dr < 0) dr += 8;
- if (dg < 0) dg += 8;
- if (db < 0) db += 8;
- dst_block.m_bytes[0] = static_cast<uint8>((best_results[0].m_block_color_unscaled.r << 3) | dr);
- dst_block.m_bytes[1] = static_cast<uint8>((best_results[0].m_block_color_unscaled.g << 3) | dg);
- dst_block.m_bytes[2] = static_cast<uint8>((best_results[0].m_block_color_unscaled.b << 3) | db);
- }
-
- dst_block.m_bytes[3] = static_cast<uint8>( (best_results[1].m_block_inten_table << 2) | (best_results[0].m_block_inten_table << 5) | ((~best_use_color4 & 1) << 1) | best_flip );
-
- uint selector0 = 0, selector1 = 0;
- if (best_flip)
- {
- // flipped:
- // { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 },
- // { 0, 1 }, { 1, 1 }, { 2, 1 }, { 3, 1 }
- //
- // { 0, 2 }, { 1, 2 }, { 2, 2 }, { 3, 2 },
- // { 0, 3 }, { 1, 3 }, { 2, 3 }, { 3, 3 }
- const uint8* pSelectors0 = best_results[0].m_pSelectors;
- const uint8* pSelectors1 = best_results[1].m_pSelectors;
- for (int x = 3; x >= 0; --x)
- {
- uint b;
- b = g_selector_index_to_etc1[pSelectors1[4 + x]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
-
- b = g_selector_index_to_etc1[pSelectors1[x]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
-
- b = g_selector_index_to_etc1[pSelectors0[4 + x]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
-
- b = g_selector_index_to_etc1[pSelectors0[x]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
- }
- }
- else
- {
- // non-flipped:
- // { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 },
- // { 1, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 }
- //
- // { 2, 0 }, { 2, 1 }, { 2, 2 }, { 2, 3 },
- // { 3, 0 }, { 3, 1 }, { 3, 2 }, { 3, 3 }
- for (int subblock = 1; subblock >= 0; --subblock)
- {
- const uint8* pSelectors = best_results[subblock].m_pSelectors + 4;
- for (uint i = 0; i < 2; i++)
- {
- uint b;
- b = g_selector_index_to_etc1[pSelectors[3]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
-
- b = g_selector_index_to_etc1[pSelectors[2]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
-
- b = g_selector_index_to_etc1[pSelectors[1]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
-
- b = g_selector_index_to_etc1[pSelectors[0]];
- selector0 = (selector0 << 1) | (b & 1);selector1 = (selector1 << 1) | (b >> 1);
-
- pSelectors -= 4;
- }
- }
- }
-
- dst_block.m_bytes[4] = static_cast<uint8>(selector1 >> 8);
- dst_block.m_bytes[5] = static_cast<uint8>(selector1 & 0xFF);
- dst_block.m_bytes[6] = static_cast<uint8>(selector0 >> 8);
- dst_block.m_bytes[7] = static_cast<uint8>(selector0 & 0xFF);
-
- return best_error;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_etc.h b/Libraries/crunch-ea9b8d/crnlib/crn_etc.h
deleted file mode 100644
index 82b3a129..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_etc.h
+++ /dev/null
@@ -1,609 +0,0 @@
-// File: crn_etc.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "../inc/crnlib.h"
-#include "crn_dxt.h"
-
-namespace crnlib
-{
- enum etc_constants
- {
- cETC1BytesPerBlock = 8U,
-
- cETC1SelectorBits = 2U,
- cETC1SelectorValues = 1U << cETC1SelectorBits,
- cETC1SelectorMask = cETC1SelectorValues - 1U,
-
- cETC1BlockShift = 2U,
- cETC1BlockSize = 1U << cETC1BlockShift,
-
- cETC1LSBSelectorIndicesBitOffset = 0,
- cETC1MSBSelectorIndicesBitOffset = 16,
-
- cETC1FlipBitOffset = 32,
- cETC1DiffBitOffset = 33,
-
- cETC1IntenModifierNumBits = 3,
- cETC1IntenModifierValues = 1 << cETC1IntenModifierNumBits,
- cETC1RightIntenModifierTableBitOffset = 34,
- cETC1LeftIntenModifierTableBitOffset = 37,
-
- // Base+Delta encoding (5 bit bases, 3 bit delta)
- cETC1BaseColorCompNumBits = 5,
- cETC1BaseColorCompMax = 1 << cETC1BaseColorCompNumBits,
-
- cETC1DeltaColorCompNumBits = 3,
- cETC1DeltaColorComp = 1 << cETC1DeltaColorCompNumBits,
- cETC1DeltaColorCompMax = 1 << cETC1DeltaColorCompNumBits,
-
- cETC1BaseColor5RBitOffset = 59,
- cETC1BaseColor5GBitOffset = 51,
- cETC1BaseColor5BBitOffset = 43,
-
- cETC1DeltaColor3RBitOffset = 56,
- cETC1DeltaColor3GBitOffset = 48,
- cETC1DeltaColor3BBitOffset = 40,
-
- // Absolute (non-delta) encoding (two 4-bit per component bases)
- cETC1AbsColorCompNumBits = 4,
- cETC1AbsColorCompMax = 1 << cETC1AbsColorCompNumBits,
-
- cETC1AbsColor4R1BitOffset = 60,
- cETC1AbsColor4G1BitOffset = 52,
- cETC1AbsColor4B1BitOffset = 44,
-
- cETC1AbsColor4R2BitOffset = 56,
- cETC1AbsColor4G2BitOffset = 48,
- cETC1AbsColor4B2BitOffset = 40,
-
- cETC1ColorDeltaMin = -4,
- cETC1ColorDeltaMax = 3,
-
- // Delta3:
- // 0 1 2 3 4 5 6 7
- // 000 001 010 011 100 101 110 111
- // 0 1 2 3 -4 -3 -2 -1
- };
-
- extern const int g_etc1_inten_tables[cETC1IntenModifierValues][cETC1SelectorValues];
- extern const uint8 g_etc1_to_selector_index[cETC1SelectorValues];
- extern const uint8 g_selector_index_to_etc1[cETC1SelectorValues];
-
- struct etc1_coord2
- {
- uint8 m_x, m_y;
- };
- extern const etc1_coord2 g_etc1_pixel_coords[2][2][8]; // [flipped][subblock][subblock_pixel]
-
- struct etc1_block
- {
- // big endian uint64:
- // bit ofs: 56 48 40 32 24 16 8 0
- // byte ofs: b0, b1, b2, b3, b4, b5, b6, b7
- union
- {
- uint64 m_uint64;
- uint8 m_bytes[8];
- };
-
- uint8 m_low_color[2];
- uint8 m_high_color[2];
-
- enum { cNumSelectorBytes = 4 };
- uint8 m_selectors[cNumSelectorBytes];
-
- inline void clear()
- {
- utils::zero_this(this);
- }
-
- inline uint get_general_bits(uint ofs, uint num) const
- {
- CRNLIB_ASSERT((ofs + num) <= 64U);
- CRNLIB_ASSERT(num && (num < 32U));
- return (utils::read_be64(&m_uint64) >> ofs) & ((1UL << num) - 1UL);
- }
-
- inline void set_general_bits(uint ofs, uint num, uint bits)
- {
- CRNLIB_ASSERT((ofs + num) <= 64U);
- CRNLIB_ASSERT(num && (num < 32U));
-
- uint64 x = utils::read_be64(&m_uint64);
- uint64 msk = ((1ULL << static_cast<uint64>(num)) - 1ULL) << static_cast<uint64>(ofs);
- x &= ~msk;
- x |= (static_cast<uint64>(bits) << static_cast<uint64>(ofs));
- utils::write_be64(&m_uint64, x);
- }
-
- inline uint get_byte_bits(uint ofs, uint num) const
- {
- CRNLIB_ASSERT((ofs + num) <= 64U);
- CRNLIB_ASSERT(num && (num <= 8U));
- CRNLIB_ASSERT((ofs >> 3) == ((ofs + num - 1) >> 3));
- const uint byte_ofs = 7 - (ofs >> 3);
- const uint byte_bit_ofs = ofs & 7;
- return (m_bytes[byte_ofs] >> byte_bit_ofs) & ((1 << num) - 1);
- }
-
- inline void set_byte_bits(uint ofs, uint num, uint bits)
- {
- CRNLIB_ASSERT((ofs + num) <= 64U);
- CRNLIB_ASSERT(num && (num < 32U));
- CRNLIB_ASSERT((ofs >> 3) == ((ofs + num - 1) >> 3));
- CRNLIB_ASSERT(bits < (1U << num));
- const uint byte_ofs = 7 - (ofs >> 3);
- const uint byte_bit_ofs = ofs & 7;
- const uint mask = (1 << num) - 1;
- m_bytes[byte_ofs] &= ~(mask << byte_bit_ofs);
- m_bytes[byte_ofs] |= (bits << byte_bit_ofs);
- }
-
- // false = left/right subblocks
- // true = upper/lower subblocks
- inline bool get_flip_bit() const
- {
- return (m_bytes[3] & 1) != 0;
- }
-
- inline void set_flip_bit(bool flip)
- {
- m_bytes[3] &= ~1;
- m_bytes[3] |= static_cast<uint8>(flip);
- }
-
- inline bool get_diff_bit() const
- {
- return (m_bytes[3] & 2) != 0;
- }
-
- inline void set_diff_bit(bool diff)
- {
- m_bytes[3] &= ~2;
- m_bytes[3] |= (static_cast<uint>(diff) << 1);
- }
-
- // Returns intensity modifier table (0-7) used by subblock subblock_id.
- // subblock_id=0 left/top (CW 1), 1=right/bottom (CW 2)
- inline uint get_inten_table(uint subblock_id) const
- {
- CRNLIB_ASSERT(subblock_id < 2);
- const uint ofs = subblock_id ? 2 : 5;
- return (m_bytes[3] >> ofs) & 7;
- }
-
- // Sets intensity modifier table (0-7) used by subblock subblock_id (0 or 1)
- inline void set_inten_table(uint subblock_id, uint t)
- {
- CRNLIB_ASSERT(subblock_id < 2);
- CRNLIB_ASSERT(t < 8);
- const uint ofs = subblock_id ? 2 : 5;
- m_bytes[3] &= ~(7 << ofs);
- m_bytes[3] |= (t << ofs);
- }
-
- // Returned selector value ranges from 0-3 and is a direct index into g_etc1_inten_tables.
- inline uint get_selector(uint x, uint y) const
- {
- CRNLIB_ASSERT((x | y) < 4);
-
- const uint bit_index = x * 4 + y;
- const uint byte_bit_ofs = bit_index & 7;
- const uint8 *p = &m_bytes[7 - (bit_index >> 3)];
- const uint lsb = (p[0] >> byte_bit_ofs) & 1;
- const uint msb = (p[-2] >> byte_bit_ofs) & 1;
- const uint val = lsb | (msb << 1);
-
- return g_etc1_to_selector_index[val];
- }
-
- // Selector "val" ranges from 0-3 and is a direct index into g_etc1_inten_tables.
- inline void set_selector(uint x, uint y, uint val)
- {
- CRNLIB_ASSERT((x | y | val) < 4);
- const uint bit_index = x * 4 + y;
-
- uint8 *p = &m_bytes[7 - (bit_index >> 3)];
-
- const uint byte_bit_ofs = bit_index & 7;
- const uint mask = 1 << byte_bit_ofs;
-
- const uint etc1_val = g_selector_index_to_etc1[val];
-
- const uint lsb = etc1_val & 1;
- const uint msb = etc1_val >> 1;
-
- p[0] &= ~mask;
- p[0] |= (lsb << byte_bit_ofs);
-
- p[-2] &= ~mask;
- p[-2] |= (msb << byte_bit_ofs);
- }
-
- inline void set_base4_color(uint idx, uint16 c)
- {
- if (idx)
- {
- set_byte_bits(cETC1AbsColor4R2BitOffset, 4, (c >> 8) & 15);
- set_byte_bits(cETC1AbsColor4G2BitOffset, 4, (c >> 4) & 15);
- set_byte_bits(cETC1AbsColor4B2BitOffset, 4, c & 15);
- }
- else
- {
- set_byte_bits(cETC1AbsColor4R1BitOffset, 4, (c >> 8) & 15);
- set_byte_bits(cETC1AbsColor4G1BitOffset, 4, (c >> 4) & 15);
- set_byte_bits(cETC1AbsColor4B1BitOffset, 4, c & 15);
- }
- }
-
- inline uint16 get_base4_color(uint idx) const
- {
- uint r, g, b;
- if (idx)
- {
- r = get_byte_bits(cETC1AbsColor4R2BitOffset, 4);
- g = get_byte_bits(cETC1AbsColor4G2BitOffset, 4);
- b = get_byte_bits(cETC1AbsColor4B2BitOffset, 4);
- }
- else
- {
- r = get_byte_bits(cETC1AbsColor4R1BitOffset, 4);
- g = get_byte_bits(cETC1AbsColor4G1BitOffset, 4);
- b = get_byte_bits(cETC1AbsColor4B1BitOffset, 4);
- }
- return static_cast<uint16>(b | (g << 4U) | (r << 8U));
- }
-
- inline void set_base5_color(uint16 c)
- {
- set_byte_bits(cETC1BaseColor5RBitOffset, 5, (c >> 10) & 31);
- set_byte_bits(cETC1BaseColor5GBitOffset, 5, (c >> 5) & 31);
- set_byte_bits(cETC1BaseColor5BBitOffset, 5, c & 31);
- }
-
- inline uint16 get_base5_color() const
- {
- const uint r = get_byte_bits(cETC1BaseColor5RBitOffset, 5);
- const uint g = get_byte_bits(cETC1BaseColor5GBitOffset, 5);
- const uint b = get_byte_bits(cETC1BaseColor5BBitOffset, 5);
- return static_cast<uint16>(b | (g << 5U) | (r << 10U));
- }
-
- void set_delta3_color(uint16 c)
- {
- set_byte_bits(cETC1DeltaColor3RBitOffset, 3, (c >> 6) & 7);
- set_byte_bits(cETC1DeltaColor3GBitOffset, 3, (c >> 3) & 7);
- set_byte_bits(cETC1DeltaColor3BBitOffset, 3, c & 7);
- }
-
- inline uint16 get_delta3_color() const
- {
- const uint r = get_byte_bits(cETC1DeltaColor3RBitOffset, 3);
- const uint g = get_byte_bits(cETC1DeltaColor3GBitOffset, 3);
- const uint b = get_byte_bits(cETC1DeltaColor3BBitOffset, 3);
- return static_cast<uint16>(b | (g << 3U) | (r << 6U));
- }
-
- // Base color 5
- static uint16 pack_color5(const color_quad_u8& color, bool scaled, uint bias = 127U);
- static uint16 pack_color5(uint r, uint g, uint b, bool scaled, uint bias = 127U);
-
- static color_quad_u8 unpack_color5(uint16 packed_color5, bool scaled, uint alpha = 255U);
- static void unpack_color5(uint& r, uint& g, uint& b, uint16 packed_color, bool scaled);
-
- static bool unpack_color5(color_quad_u8& result, uint16 packed_color5, uint16 packed_delta3, bool scaled, uint alpha = 255U);
- static bool unpack_color5(uint& r, uint& g, uint& b, uint16 packed_color5, uint16 packed_delta3, bool scaled, uint alpha = 255U);
-
- // Delta color 3
- // Inputs range from -4 to 3 (cETC1ColorDeltaMin to cETC1ColorDeltaMax)
- static uint16 pack_delta3(const color_quad_i16& color);
- static uint16 pack_delta3(int r, int g, int b);
-
- // Results range from -4 to 3 (cETC1ColorDeltaMin to cETC1ColorDeltaMax)
- static color_quad_i16 unpack_delta3(uint16 packed_delta3);
- static void unpack_delta3(int& r, int& g, int& b, uint16 packed_delta3);
-
- // Abs color 4
- static uint16 pack_color4(const color_quad_u8& color, bool scaled, uint bias = 127U);
- static uint16 pack_color4(uint r, uint g, uint b, bool scaled, uint bias = 127U);
-
- static color_quad_u8 unpack_color4(uint16 packed_color4, bool scaled, uint alpha = 255U);
- static void unpack_color4(uint& r, uint& g, uint& b, uint16 packed_color4, bool scaled);
-
- // subblock colors
- static void get_diff_subblock_colors(color_quad_u8* pDst, uint16 packed_color5, uint table_idx);
- static bool get_diff_subblock_colors(color_quad_u8* pDst, uint16 packed_color5, uint16 packed_delta3, uint table_idx);
- static void get_abs_subblock_colors(color_quad_u8* pDst, uint16 packed_color4, uint table_idx);
-
- static inline void unscaled_to_scaled_color(color_quad_u8& dst, const color_quad_u8& src, bool color4)
- {
- if (color4)
- {
- dst.r = src.r | (src.r << 4);
- dst.g = src.g | (src.g << 4);
- dst.b = src.b | (src.b << 4);
- }
- else
- {
- dst.r = (src.r >> 2) | (src.r << 3);
- dst.g = (src.g >> 2) | (src.g << 3);
- dst.b = (src.b >> 2) | (src.b << 3);
- }
- dst.a = src.a;
- }
- };
-
- CRNLIB_DEFINE_BITWISE_COPYABLE(etc1_block);
-
- // Returns false if the block is invalid (it will still be unpacked with clamping).
- bool unpack_etc1(const etc1_block& block, color_quad_u8 *pDst, bool preserve_alpha = false);
-
- enum crn_etc_quality
- {
- cCRNETCQualityFast,
- cCRNETCQualityMedium,
- cCRNETCQualitySlow,
-
- cCRNETCQualityTotal,
-
- cCRNETCQualityForceDWORD = 0xFFFFFFFF
- };
-
- struct crn_etc1_pack_params
- {
- crn_etc_quality m_quality;
- bool m_perceptual;
- bool m_dithering;
-
- inline crn_etc1_pack_params()
- {
- clear();
- }
-
- void clear()
- {
- m_quality = cCRNETCQualitySlow;
- m_perceptual = true;
- m_dithering = false;
- }
- };
-
- struct etc1_solution_coordinates
- {
- inline etc1_solution_coordinates() :
- m_unscaled_color(0, 0, 0, 0),
- m_inten_table(0),
- m_color4(false)
- {
- }
-
- inline etc1_solution_coordinates(uint r, uint g, uint b, uint inten_table, bool color4) :
- m_unscaled_color(r, g, b, 255),
- m_inten_table(inten_table),
- m_color4(color4)
- {
- }
-
- inline etc1_solution_coordinates(const color_quad_u8& c, uint inten_table, bool color4) :
- m_unscaled_color(c),
- m_inten_table(inten_table),
- m_color4(color4)
- {
- }
-
- inline etc1_solution_coordinates(const etc1_solution_coordinates& other)
- {
- *this = other;
- }
-
- inline etc1_solution_coordinates& operator= (const etc1_solution_coordinates& rhs)
- {
- m_unscaled_color = rhs.m_unscaled_color;
- m_inten_table = rhs.m_inten_table;
- m_color4 = rhs.m_color4;
- return *this;
- }
-
- inline void clear()
- {
- m_unscaled_color.clear();
- m_inten_table = 0;
- m_color4 = false;
- }
-
- inline color_quad_u8 get_scaled_color() const
- {
- int br, bg, bb;
- if (m_color4)
- {
- br = m_unscaled_color.r | (m_unscaled_color.r << 4);
- bg = m_unscaled_color.g | (m_unscaled_color.g << 4);
- bb = m_unscaled_color.b | (m_unscaled_color.b << 4);
- }
- else
- {
- br = (m_unscaled_color.r >> 2) | (m_unscaled_color.r << 3);
- bg = (m_unscaled_color.g >> 2) | (m_unscaled_color.g << 3);
- bb = (m_unscaled_color.b >> 2) | (m_unscaled_color.b << 3);
- }
- return color_quad_u8(br, bg, bb);
- }
-
- inline void get_block_colors(color_quad_u8* pBlock_colors)
- {
- int br, bg, bb;
- if (m_color4)
- {
- br = m_unscaled_color.r | (m_unscaled_color.r << 4);
- bg = m_unscaled_color.g | (m_unscaled_color.g << 4);
- bb = m_unscaled_color.b | (m_unscaled_color.b << 4);
- }
- else
- {
- br = (m_unscaled_color.r >> 2) | (m_unscaled_color.r << 3);
- bg = (m_unscaled_color.g >> 2) | (m_unscaled_color.g << 3);
- bb = (m_unscaled_color.b >> 2) | (m_unscaled_color.b << 3);
- }
- const int* pInten_table = g_etc1_inten_tables[m_inten_table];
- pBlock_colors[0].set(br + pInten_table[0], bg + pInten_table[0], bb + pInten_table[0]);
- pBlock_colors[1].set(br + pInten_table[1], bg + pInten_table[1], bb + pInten_table[1]);
- pBlock_colors[2].set(br + pInten_table[2], bg + pInten_table[2], bb + pInten_table[2]);
- pBlock_colors[3].set(br + pInten_table[3], bg + pInten_table[3], bb + pInten_table[3]);
- }
-
- color_quad_u8 m_unscaled_color;
- uint m_inten_table;
- bool m_color4;
- };
-
- class etc1_optimizer
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(etc1_optimizer);
-
- public:
- etc1_optimizer()
- {
- clear();
- }
-
- void clear()
- {
- m_pParams = NULL;
- m_pResult = NULL;
- m_pSorted_luma = NULL;
- m_pSorted_luma_indices = NULL;
- }
-
- struct params : crn_etc1_pack_params
- {
- params()
- {
- clear();
- }
-
- params(const crn_etc1_pack_params& base_params) :
- crn_etc1_pack_params(base_params)
- {
- clear_optimizer_params();
- }
-
- void clear()
- {
- crn_etc1_pack_params::clear();
- clear_optimizer_params();
- }
-
- void clear_optimizer_params()
- {
- m_num_src_pixels = 0;
- m_pSrc_pixels = 0;
-
- m_use_color4 = false;
- static const int s_default_scan_delta[] = { 0 };
- m_pScan_deltas = s_default_scan_delta;
- m_scan_delta_size = 1;
-
- m_base_color5.clear();
- m_constrain_against_base_color5 = false;
- }
-
- uint m_num_src_pixels;
- const color_quad_u8* m_pSrc_pixels;
-
- bool m_use_color4;
- const int* m_pScan_deltas;
- uint m_scan_delta_size;
-
- color_quad_u8 m_base_color5;
- bool m_constrain_against_base_color5;
- };
-
- struct results
- {
- uint64 m_error;
- color_quad_u8 m_block_color_unscaled;
- uint m_block_inten_table;
- uint m_n;
- uint8* m_pSelectors;
- bool m_block_color4;
-
- inline results& operator= (const results& rhs)
- {
- m_block_color_unscaled = rhs.m_block_color_unscaled;
- m_block_color4 = rhs.m_block_color4;
- m_block_inten_table = rhs.m_block_inten_table;
- m_error = rhs.m_error;
- CRNLIB_ASSERT(m_n == rhs.m_n);
- memcpy(m_pSelectors, rhs.m_pSelectors, rhs.m_n);
- return *this;
- }
- };
-
- void init(const params& params, results& result);
- bool compute();
-
- private:
- struct potential_solution
- {
- potential_solution() : m_coords(), m_error(cUINT64_MAX), m_valid(false)
- {
- }
-
- etc1_solution_coordinates m_coords;
- crnlib::vector<uint8> m_selectors;
- uint64 m_error;
- bool m_valid;
-
- void clear()
- {
- m_coords.clear();
- m_selectors.resize(0);
- m_error = cUINT64_MAX;
- m_valid = false;
- }
-
- bool are_selectors_all_equal() const
- {
- if (m_selectors.empty())
- return false;
- const uint s = m_selectors[0];
- for (uint i = 1; i < m_selectors.size(); i++)
- if (m_selectors[i] != s)
- return false;
- return true;
- }
- };
-
- const params* m_pParams;
- results* m_pResult;
-
- int m_limit;
-
- vec3F m_avg_color;
- int m_br, m_bg, m_bb;
- crnlib::vector<uint16> m_luma;
- crnlib::vector<uint32> m_sorted_luma[2];
- const uint32* m_pSorted_luma_indices;
- uint32* m_pSorted_luma;
-
- crnlib::vector<uint8> m_selectors;
- crnlib::vector<uint8> m_best_selectors;
-
- potential_solution m_best_solution;
- potential_solution m_trial_solution;
- crnlib::vector<uint8> m_temp_selectors;
-
- bool evaluate_solution(const etc1_solution_coordinates& coords, potential_solution& trial_solution, potential_solution* pBest_solution);
- bool evaluate_solution_fast(const etc1_solution_coordinates& coords, potential_solution& trial_solution, potential_solution* pBest_solution);
- };
-
- struct pack_etc1_block_context
- {
- etc1_optimizer m_optimizer;
- };
-
- void pack_etc1_block_init();
-
- uint64 pack_etc1_block(etc1_block& block, const color_quad_u8* pSrc_pixels, crn_etc1_pack_params& pack_params, pack_etc1_block_context& context);
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_file_utils.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_file_utils.cpp
deleted file mode 100644
index f5d6430c..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_file_utils.cpp
+++ /dev/null
@@ -1,578 +0,0 @@
-// File: crn_file_utils.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_file_utils.h"
-#include "crn_strutils.h"
-
-#if CRNLIB_USE_WIN32_API
-#include "crn_winhdr.h"
-#endif
-
-#ifdef WIN32
-#include <direct.h>
-#endif
-
-#ifdef __GNUC__
-#include <sys/stat.h>
-#include <sys/stat.h>
-#include <libgen.h>
-#endif
-
-namespace crnlib
-{
-#if CRNLIB_USE_WIN32_API
- bool file_utils::is_read_only(const char* pFilename)
- {
- uint32 dst_file_attribs = GetFileAttributesA(pFilename);
- if (dst_file_attribs == INVALID_FILE_ATTRIBUTES)
- return false;
- if (dst_file_attribs & FILE_ATTRIBUTE_READONLY)
- return true;
- return false;
- }
-
- bool file_utils::disable_read_only(const char* pFilename)
- {
- uint32 dst_file_attribs = GetFileAttributesA(pFilename);
- if (dst_file_attribs == INVALID_FILE_ATTRIBUTES)
- return false;
- if (dst_file_attribs & FILE_ATTRIBUTE_READONLY)
- {
- dst_file_attribs &= ~FILE_ATTRIBUTE_READONLY;
- if (SetFileAttributesA(pFilename, dst_file_attribs))
- return true;
- }
- return false;
- }
-
- bool file_utils::is_older_than(const char* pSrcFilename, const char* pDstFilename)
- {
- WIN32_FILE_ATTRIBUTE_DATA src_file_attribs;
- const BOOL src_file_exists = GetFileAttributesExA(pSrcFilename, GetFileExInfoStandard, &src_file_attribs);
-
- WIN32_FILE_ATTRIBUTE_DATA dst_file_attribs;
- const BOOL dest_file_exists = GetFileAttributesExA(pDstFilename, GetFileExInfoStandard, &dst_file_attribs);
-
- if ((dest_file_exists) && (src_file_exists))
- {
- LONG timeComp = CompareFileTime(&src_file_attribs.ftLastWriteTime, &dst_file_attribs.ftLastWriteTime);
- if (timeComp < 0)
- return true;
- }
- return false;
- }
-
- bool file_utils::does_file_exist(const char* pFilename)
- {
- const DWORD fullAttributes = GetFileAttributesA(pFilename);
-
- if (fullAttributes == INVALID_FILE_ATTRIBUTES)
- return false;
-
- if (fullAttributes & FILE_ATTRIBUTE_DIRECTORY)
- return false;
-
- return true;
- }
-
- bool file_utils::does_dir_exist(const char* pDir)
- {
- //-- Get the file attributes.
- DWORD fullAttributes = GetFileAttributesA(pDir);
-
- if (fullAttributes == INVALID_FILE_ATTRIBUTES)
- return false;
-
- if (fullAttributes & FILE_ATTRIBUTE_DIRECTORY)
- return true;
-
- return false;
- }
-
- bool file_utils::get_file_size(const char* pFilename, uint64& file_size)
- {
- file_size = 0;
-
- WIN32_FILE_ATTRIBUTE_DATA attr;
-
- if (0 == GetFileAttributesExA(pFilename, GetFileExInfoStandard, &attr))
- return false;
-
- if (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- return false;
-
- file_size = static_cast<uint64>(attr.nFileSizeLow) | (static_cast<uint64>(attr.nFileSizeHigh) << 32U);
-
- return true;
- }
-#elif defined( __GNUC__ )
- bool file_utils::is_read_only(const char* pFilename)
- {
- pFilename;
- // TODO
- return false;
- }
-
- bool file_utils::disable_read_only(const char* pFilename)
- {
- pFilename;
- // TODO
- return false;
- }
-
- bool file_utils::is_older_than(const char *pSrcFilename, const char* pDstFilename)
- {
- pSrcFilename, pDstFilename;
- // TODO
- return false;
- }
-
- bool file_utils::does_file_exist(const char* pFilename)
- {
- struct stat stat_buf;
- int result = stat(pFilename, &stat_buf);
- if (result)
- return false;
- if (S_ISREG(stat_buf.st_mode))
- return true;
- return false;
- }
-
- bool file_utils::does_dir_exist(const char* pDir)
- {
- struct stat stat_buf;
- int result = stat(pDir, &stat_buf);
- if (result)
- return false;
- if (S_ISDIR(stat_buf.st_mode) || S_ISLNK(stat_buf.st_mode))
- return true;
- return false;
- }
-
- bool file_utils::get_file_size(const char* pFilename, uint64& file_size)
- {
- file_size = 0;
- struct stat stat_buf;
- int result = stat(pFilename, &stat_buf);
- if (result)
- return false;
- if (!S_ISREG(stat_buf.st_mode))
- return false;
- file_size = stat_buf.st_size;
- return true;
- }
-#else
- bool file_utils::is_read_only(const char* pFilename)
- {
- return false;
- }
-
- bool file_utils::disable_read_only(const char* pFilename)
- {
- pFilename;
- // TODO
- return false;
- }
-
- bool file_utils::is_older_than(const char *pSrcFilename, const char* pDstFilename)
- {
- return false;
- }
-
- bool file_utils::does_file_exist(const char* pFilename)
- {
- FILE* pFile;
- crn_fopen(&pFile, pFilename, "rb");
- if (!pFile)
- return false;
- fclose(pFile);
- return true;
- }
-
- bool file_utils::does_dir_exist(const char* pDir)
- {
- return false;
- }
-
- bool file_utils::get_file_size(const char* pFilename, uint64& file_size)
- {
- FILE* pFile;
- crn_fopen(&pFile, pFilename, "rb");
- if (!pFile)
- return false;
- crn_fseek(pFile, 0, SEEK_END);
- file_size = crn_ftell(pFile);
- fclose(pFile);
- return true;
- }
-#endif
-
- bool file_utils::get_file_size(const char* pFilename, uint32& file_size)
- {
- uint64 file_size64;
- if (!get_file_size(pFilename, file_size64))
- {
- file_size = 0;
- return false;
- }
-
- if (file_size64 > cUINT32_MAX)
- file_size64 = cUINT32_MAX;
-
- file_size = static_cast<uint32>(file_size64);
- return true;
- }
-
- bool file_utils::is_path_separator(char c)
- {
-#ifdef WIN32
- return (c == '/') || (c == '\\');
-#else
- return (c == '/');
-#endif
- }
-
- bool file_utils::is_path_or_drive_separator(char c)
- {
-#ifdef WIN32
- return (c == '/') || (c == '\\') || (c == ':');
-#else
- return (c == '/');
-#endif
- }
-
- bool file_utils::is_drive_separator(char c)
- {
-#ifdef WIN32
- return (c == ':');
-#else
- c;
- return false;
-#endif
- }
-
- bool file_utils::split_path(const char* p, dynamic_string* pDrive, dynamic_string* pDir, dynamic_string* pFilename, dynamic_string* pExt)
- {
- CRNLIB_ASSERT(p);
-
-#ifdef WIN32
- char drive_buf[_MAX_DRIVE];
- char dir_buf[_MAX_DIR];
- char fname_buf[_MAX_FNAME];
- char ext_buf[_MAX_EXT];
-
-#ifdef _MSC_VER
- // Compiling with MSVC
- errno_t error = _splitpath_s(p,
- pDrive ? drive_buf : NULL, pDrive ? _MAX_DRIVE : 0,
- pDir ? dir_buf : NULL, pDir ? _MAX_DIR : 0,
- pFilename ? fname_buf : NULL, pFilename ? _MAX_FNAME : 0,
- pExt ? ext_buf : NULL, pExt ? _MAX_EXT : 0);
- if (error != 0)
- return false;
-#else
- // Compiling with MinGW
- _splitpath(p,
- pDrive ? drive_buf : NULL,
- pDir ? dir_buf : NULL,
- pFilename ? fname_buf : NULL,
- pExt ? ext_buf : NULL);
-#endif
-
- if (pDrive) *pDrive = drive_buf;
- if (pDir) *pDir = dir_buf;
- if (pFilename) *pFilename = fname_buf;
- if (pExt) *pExt = ext_buf;
-#else
- char dirtmp[1024];
- char nametmp[1024];
- strcpy_safe(dirtmp, sizeof(dirtmp), p);
- strcpy_safe(nametmp, sizeof(nametmp), p);
-
- if (pDrive) pDrive->clear();
-
- const char *pDirName = dirname(dirtmp);
- if (!pDirName)
- return false;
-
- if (pDir)
- {
- pDir->set(pDirName);
- if ((!pDir->is_empty()) && (pDir->back() != '/'))
- pDir->append_char('/');
- }
-
- const char *pBaseName = basename(nametmp);
- if (!pBaseName)
- return false;
-
- if (pFilename)
- {
- pFilename->set(pBaseName);
- remove_extension(*pFilename);
- }
-
- if (pExt)
- {
- pExt->set(pBaseName);
- get_extension(*pExt);
- *pExt = "." + *pExt;
- }
-#endif // #ifdef WIN32
-
- return true;
- }
-
- bool file_utils::split_path(const char* p, dynamic_string& path, dynamic_string& filename)
- {
- dynamic_string temp_drive, temp_path, temp_ext;
- if (!split_path(p, &temp_drive, &temp_path, &filename, &temp_ext))
- return false;
-
- filename += temp_ext;
-
- combine_path(path, temp_drive.get_ptr(), temp_path.get_ptr());
- return true;
- }
-
- bool file_utils::get_pathname(const char* p, dynamic_string& path)
- {
- dynamic_string temp_drive, temp_path;
- if (!split_path(p, &temp_drive, &temp_path, NULL, NULL))
- return false;
-
- combine_path(path, temp_drive.get_ptr(), temp_path.get_ptr());
- return true;
- }
-
- bool file_utils::get_filename(const char* p, dynamic_string& filename)
- {
- dynamic_string temp_ext;
- if (!split_path(p, NULL, NULL, &filename, &temp_ext))
- return false;
-
- filename += temp_ext;
- return true;
- }
-
- void file_utils::combine_path(dynamic_string& dst, const char* pA, const char* pB)
- {
- dynamic_string temp(pA);
- if ((!temp.is_empty()) && (!is_path_separator(pB[0])))
- {
- char c = temp[temp.get_len() - 1];
- if (!is_path_separator(c))
- temp.append_char(CRNLIB_PATH_SEPERATOR_CHAR);
- }
- temp += pB;
- dst.swap(temp);
- }
-
- void file_utils::combine_path(dynamic_string& dst, const char* pA, const char* pB, const char* pC)
- {
- combine_path(dst, pA, pB);
- combine_path(dst, dst.get_ptr(), pC);
- }
-
- bool file_utils::full_path(dynamic_string& path)
- {
-#ifdef WIN32
- char buf[1024];
- char* p = _fullpath(buf, path.get_ptr(), sizeof(buf));
- if (!p)
- return false;
-#else
- char buf[PATH_MAX];
- char* p;
- dynamic_string pn, fn;
- split_path(path.get_ptr(), pn, fn);
- if ((fn == ".") || (fn == ".."))
- {
- p = realpath(path.get_ptr(), buf);
- if (!p)
- return false;
- path.set(buf);
- }
- else
- {
- if (pn.is_empty())
- pn = "./";
- p = realpath(pn.get_ptr(), buf);
- if (!p)
- return false;
- combine_path(path, buf, fn.get_ptr());
- }
-#endif
-
- return true;
- }
-
- bool file_utils::get_extension(dynamic_string& filename)
- {
- int sep = -1;
-#ifdef WIN32
- sep = filename.find_right('\\');
-#endif
- if (sep < 0)
- sep = filename.find_right('/');
-
- int dot = filename.find_right('.');
- if (dot < sep)
- {
- filename.clear();
- return false;
- }
-
- filename.right(dot + 1);
-
- return true;
- }
-
- bool file_utils::remove_extension(dynamic_string& filename)
- {
- int sep = -1;
-#ifdef WIN32
- sep = filename.find_right('\\');
-#endif
- if (sep < 0)
- sep = filename.find_right('/');
-
- int dot = filename.find_right('.');
- if (dot < sep)
- return false;
-
- filename.left(dot);
-
- return true;
- }
-
- bool file_utils::create_path(const dynamic_string& fullpath)
- {
- bool got_unc = false; got_unc;
- dynamic_string cur_path;
-
- const int l = fullpath.get_len();
-
- int n = 0;
- while (n < l)
- {
- const char c = fullpath.get_ptr()[n];
-
- const bool sep = is_path_separator(c);
- const bool back_sep = is_path_separator(cur_path.back());
- const bool is_last_char = (n == (l - 1));
-
- if ( ((sep) && (!back_sep)) || (is_last_char) )
- {
- if ((is_last_char) && (!sep))
- cur_path.append_char(c);
-
- bool valid = !cur_path.is_empty();
-
-#ifdef WIN32
- // reject obvious stuff (drives, beginning of UNC paths):
- // c:\b\cool
- // \\machine\blah
- // \cool\blah
- if ((cur_path.get_len() == 2) && (cur_path[1] == ':'))
- valid = false;
- else if ((cur_path.get_len() >= 2) && (cur_path[0] == '\\') && (cur_path[1] == '\\'))
- {
- if (!got_unc)
- valid = false;
- got_unc = true;
- }
- else if (cur_path == "\\")
- valid = false;
-#endif
- if (cur_path == "/")
- valid = false;
-
- if ((valid) && (cur_path.get_len()))
- {
-#ifdef WIN32
- _mkdir(cur_path.get_ptr());
-#else
- mkdir(cur_path.get_ptr(), S_IRWXU | S_IRWXG | S_IRWXO );
-#endif
- }
- }
-
- cur_path.append_char(c);
-
- n++;
- }
-
- return true;
- }
-
- void file_utils::trim_trailing_seperator(dynamic_string& path)
- {
- if ((path.get_len()) && (is_path_separator(path.back())))
- path.truncate(path.get_len() - 1);
- }
-
- // See http://www.codeproject.com/KB/string/wildcmp.aspx
- int file_utils::wildcmp(const char* pWild, const char* pString)
- {
- const char* cp = NULL, *mp = NULL;
-
- while ((*pString) && (*pWild != '*'))
- {
- if ((*pWild != *pString) && (*pWild != '?'))
- return 0;
- pWild++;
- pString++;
- }
-
- // Either *pString=='\0' or *pWild='*' here.
-
- while (*pString)
- {
- if (*pWild == '*')
- {
- if (!*++pWild)
- return 1;
- mp = pWild;
- cp = pString+1;
- }
- else if ((*pWild == *pString) || (*pWild == '?'))
- {
- pWild++;
- pString++;
- }
- else
- {
- pWild = mp;
- pString = cp++;
- }
- }
-
- while (*pWild == '*')
- pWild++;
-
- return !*pWild;
- }
-
- bool file_utils::write_buf_to_file(const char* pPath, const void* pData, size_t data_size)
- {
- FILE *pFile = NULL;
-
-#ifdef _MSC_VER
- // Compiling with MSVC
- if (fopen_s(&pFile, pPath, "wb"))
- return false;
-#else
- pFile = fopen(pPath, "wb");
-#endif
- if (!pFile)
- return false;
-
- bool success = fwrite(pData, 1, data_size, pFile) == data_size;
-
- fclose(pFile);
-
- return success;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_file_utils.h b/Libraries/crunch-ea9b8d/crnlib/crn_file_utils.h
deleted file mode 100644
index 247f85ac..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_file_utils.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// File: crn_file_utils.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- struct file_utils
- {
- // Returns true if pSrcFilename is older than pDstFilename
- static bool is_read_only(const char* pFilename);
- static bool disable_read_only(const char* pFilename);
- static bool is_older_than(const char *pSrcFilename, const char* pDstFilename);
- static bool does_file_exist(const char* pFilename);
- static bool does_dir_exist(const char* pDir);
- static bool get_file_size(const char* pFilename, uint64& file_size);
- static bool get_file_size(const char* pFilename, uint32& file_size);
-
- static bool is_path_separator(char c);
- static bool is_path_or_drive_separator(char c);
- static bool is_drive_separator(char c);
-
- static bool split_path(const char* p, dynamic_string* pDrive, dynamic_string* pDir, dynamic_string* pFilename, dynamic_string* pExt);
- static bool split_path(const char* p, dynamic_string& path, dynamic_string& filename);
-
- static bool get_pathname(const char* p, dynamic_string& path);
- static bool get_filename(const char* p, dynamic_string& filename);
-
- static void combine_path(dynamic_string& dst, const char* pA, const char* pB);
- static void combine_path(dynamic_string& dst, const char* pA, const char* pB, const char* pC);
-
- static bool full_path(dynamic_string& path);
- static bool get_extension(dynamic_string& filename);
- static bool remove_extension(dynamic_string& filename);
- static bool create_path(const dynamic_string& path);
- static void trim_trailing_seperator(dynamic_string& path);
-
- static int wildcmp(const char* pWild, const char* pString);
-
- static bool write_buf_to_file(const char* pPath, const void* pData, size_t data_size);
-
- }; // struct file_utils
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_find_files.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_find_files.cpp
deleted file mode 100644
index 39a13245..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_find_files.cpp
+++ /dev/null
@@ -1,287 +0,0 @@
-// File: crn_win32_find_files.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_find_files.h"
-#include "crn_file_utils.h"
-#include "crn_strutils.h"
-
-#ifdef CRNLIB_USE_WIN32_API
-#include "crn_winhdr.h"
-
-#elif defined(__GNUC__)
-#include <fnmatch.h>
-#include <dirent.h>
-#endif
-
-namespace crnlib
-{
-#ifdef CRNLIB_USE_WIN32_API
- bool find_files::find(const char* pBasepath, const char* pFilespec, uint flags)
- {
- m_last_error = S_OK;
- m_files.resize(0);
-
- return find_internal(pBasepath, "", pFilespec, flags, 0);
- }
-
- bool find_files::find(const char* pSpec, uint flags)
- {
- dynamic_string find_name(pSpec);
-
- if (!file_utils::full_path(find_name))
- return false;
-
- dynamic_string find_pathname, find_filename;
- if (!file_utils::split_path(find_name.get_ptr(), find_pathname, find_filename))
- return false;
-
- return find(find_pathname.get_ptr(), find_filename.get_ptr(), flags);
- }
-
- bool find_files::find_internal(const char* pBasepath, const char* pRelpath, const char* pFilespec, uint flags, int level)
- {
- WIN32_FIND_DATAA find_data;
-
- dynamic_string filename;
-
- dynamic_string_array child_paths;
- if (flags & cFlagRecursive)
- {
- if (strlen(pRelpath))
- file_utils::combine_path(filename, pBasepath, pRelpath, "*");
- else
- file_utils::combine_path(filename, pBasepath, "*");
-
- HANDLE handle = FindFirstFileA(filename.get_ptr(), &find_data);
- if (handle == INVALID_HANDLE_VALUE)
- {
- HRESULT hres = GetLastError();
- if ((level == 0) && (hres != NO_ERROR) && (hres != ERROR_FILE_NOT_FOUND))
- {
- m_last_error = hres;
- return false;
- }
- }
- else
- {
- do
- {
- const bool is_dir = (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
-
- bool skip = !is_dir;
- if (is_dir)
- skip = (strcmp(find_data.cFileName, ".") == 0) || (strcmp(find_data.cFileName, "..") == 0);
-
- if (find_data.dwFileAttributes & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY))
- skip = true;
-
- if (find_data.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
- {
- if ((flags & cFlagAllowHidden) == 0)
- skip = true;
- }
-
- if (!skip)
- {
- dynamic_string child_path(find_data.cFileName);
- if ((!child_path.count_char('?')) && (!child_path.count_char('*')))
- child_paths.push_back(child_path);
- }
-
- } while (FindNextFileA(handle, &find_data) != 0);
-
- HRESULT hres = GetLastError();
-
- FindClose(handle);
- handle = INVALID_HANDLE_VALUE;
-
- if (hres != ERROR_NO_MORE_FILES)
- {
- m_last_error = hres;
- return false;
- }
- }
- }
-
- if (strlen(pRelpath))
- file_utils::combine_path(filename, pBasepath, pRelpath, pFilespec);
- else
- file_utils::combine_path(filename, pBasepath, pFilespec);
-
- HANDLE handle = FindFirstFileA(filename.get_ptr(), &find_data);
- if (handle == INVALID_HANDLE_VALUE)
- {
- HRESULT hres = GetLastError();
- if ((level == 0) && (hres != NO_ERROR) && (hres != ERROR_FILE_NOT_FOUND))
- {
- m_last_error = hres;
- return false;
- }
- }
- else
- {
- do
- {
- const bool is_dir = (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
-
- bool skip = false;
- if (is_dir)
- skip = (strcmp(find_data.cFileName, ".") == 0) || (strcmp(find_data.cFileName, "..") == 0);
-
- if (find_data.dwFileAttributes & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY))
- skip = true;
-
- if (find_data.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
- {
- if ((flags & cFlagAllowHidden) == 0)
- skip = true;
- }
-
- if (!skip)
- {
- if (((is_dir) && (flags & cFlagAllowDirs)) || ((!is_dir) && (flags & cFlagAllowFiles)))
- {
- m_files.resize(m_files.size() + 1);
- file_desc& file = m_files.back();
- file.m_is_dir = is_dir;
- file.m_base = pBasepath;
- file.m_name = find_data.cFileName;
- file.m_rel = pRelpath;
- if (strlen(pRelpath))
- file_utils::combine_path(file.m_fullname, pBasepath, pRelpath, find_data.cFileName);
- else
- file_utils::combine_path(file.m_fullname, pBasepath, find_data.cFileName);
- }
- }
-
- } while (FindNextFileA(handle, &find_data) != 0);
-
- HRESULT hres = GetLastError();
-
- FindClose(handle);
-
- if (hres != ERROR_NO_MORE_FILES)
- {
- m_last_error = hres;
- return false;
- }
- }
-
- for (uint i = 0; i < child_paths.size(); i++)
- {
- dynamic_string child_path;
- if (strlen(pRelpath))
- file_utils::combine_path(child_path, pRelpath, child_paths[i].get_ptr());
- else
- child_path = child_paths[i];
-
- if (!find_internal(pBasepath, child_path.get_ptr(), pFilespec, flags, level + 1))
- return false;
- }
-
- return true;
- }
-#elif defined(__GNUC__)
- bool find_files::find(const char* pBasepath, const char* pFilespec, uint flags)
- {
- m_files.resize(0);
- return find_internal(pBasepath, "", pFilespec, flags, 0);
- }
-
- bool find_files::find(const char* pSpec, uint flags)
- {
- dynamic_string find_name(pSpec);
-
- if (!file_utils::full_path(find_name))
- return false;
-
- dynamic_string find_pathname, find_filename;
- if (!file_utils::split_path(find_name.get_ptr(), find_pathname, find_filename))
- return false;
-
- return find(find_pathname.get_ptr(), find_filename.get_ptr(), flags);
- }
-
- bool find_files::find_internal(const char* pBasepath, const char* pRelpath, const char* pFilespec, uint flags, int level)
- {
- dynamic_string pathname;
- if (strlen(pRelpath))
- file_utils::combine_path(pathname, pBasepath, pRelpath);
- else
- pathname = pBasepath;
-
- if (!pathname.is_empty())
- {
- char c = pathname.back();
- if (c != '/')
- pathname += "/";
- }
-
- DIR *dp = opendir(pathname.get_ptr());
-
- if (!dp)
- return level ? true : false;
-
- dynamic_string_array paths;
-
- for ( ; ; )
- {
- struct dirent *ep = readdir(dp);
- if (!ep)
- break;
- if ((strcmp(ep->d_name, ".") == 0) || (strcmp(ep->d_name, "..") == 0))
- continue;
-
- const bool is_directory = (ep->d_type & DT_DIR) != 0;
- const bool is_file = (ep->d_type & DT_REG) != 0;
-
- dynamic_string filename(ep->d_name);
-
- if (is_directory)
- {
- if (flags & cFlagRecursive)
- {
- paths.push_back(filename);
- }
- }
-
- if (((is_file) && (flags & cFlagAllowFiles)) || ((is_directory) && (flags & cFlagAllowDirs)))
- {
- if (0 == fnmatch(pFilespec, filename.get_ptr(), 0))
- {
- m_files.resize(m_files.size() + 1);
- file_desc& file = m_files.back();
- file.m_is_dir = is_directory;
- file.m_base = pBasepath;
- file.m_rel = pRelpath;
- file.m_name = filename;
- file.m_fullname = pathname + filename;
- }
- }
- }
-
- closedir(dp);
- dp = NULL;
-
- if (flags & cFlagRecursive)
- {
- for (uint i = 0; i < paths.size(); i++)
- {
- dynamic_string childpath;
- if (strlen(pRelpath))
- file_utils::combine_path(childpath, pRelpath, paths[i].get_ptr());
- else
- childpath = paths[i];
-
- if (!find_internal(pBasepath, childpath.get_ptr(), pFilespec, flags, level + 1))
- return false;
- }
- }
-
- return true;
- }
-#else
- #error Unimplemented
-#endif
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_find_files.h b/Libraries/crunch-ea9b8d/crnlib/crn_find_files.h
deleted file mode 100644
index 967ed55d..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_find_files.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// File: crn_win32_find_files.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- class find_files
- {
- public:
- struct file_desc
- {
- inline file_desc() : m_is_dir(false) { }
-
- dynamic_string m_fullname;
- dynamic_string m_base;
- dynamic_string m_rel;
- dynamic_string m_name;
- bool m_is_dir;
-
- inline bool operator== (const file_desc& other) const { return m_fullname == other.m_fullname; }
- inline bool operator< (const file_desc& other) const { return m_fullname < other.m_fullname; }
-
- inline operator size_t() const { return static_cast<size_t>(m_fullname); }
- };
-
- typedef crnlib::vector<file_desc> file_desc_vec;
-
- inline find_files()
- {
- m_last_error = 0; // S_OK;
- }
-
- enum flags
- {
- cFlagRecursive = 1,
- cFlagAllowDirs = 2,
- cFlagAllowFiles = 4,
- cFlagAllowHidden = 8
- };
-
- bool find(const char* pBasepath, const char* pFilespec, uint flags = cFlagAllowFiles);
-
- bool find(const char* pSpec, uint flags = cFlagAllowFiles);
-
- // An HRESULT under Win32. FIXME: Abstract this better?
- inline int64 get_last_error() const { return m_last_error; }
-
- const file_desc_vec& get_files() const { return m_files; }
-
- private:
- file_desc_vec m_files;
-
- // A HRESULT under Win32
- int64 m_last_error;
-
- bool find_internal(const char* pBasepath, const char* pRelpath, const char* pFilespec, uint flags, int level);
-
- }; // class find_files
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_freeimage_image_utils.h b/Libraries/crunch-ea9b8d/crnlib/crn_freeimage_image_utils.h
deleted file mode 100644
index 0597d809..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_freeimage_image_utils.h
+++ /dev/null
@@ -1,158 +0,0 @@
-// File: crn_freeimage_image_utils.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-// Note: This header file requires FreeImage/FreeImagePlus.
-
-#include "crn_image_utils.h"
-
-#include "freeImagePlus.h"
-
-namespace crnlib
-{
- namespace freeimage_image_utils
- {
- inline bool load_from_file(image_u8& dest, const wchar_t* pFilename, int fi_flag)
- {
- fipImage src_image;
-
- if (!src_image.loadU(pFilename, fi_flag))
- return false;
-
- const uint orig_bits_per_pixel = src_image.getBitsPerPixel();
-
- const FREE_IMAGE_COLOR_TYPE orig_color_type = src_image.getColorType();
-
- if (!src_image.convertTo32Bits())
- return false;
-
- if (src_image.getBitsPerPixel() != 32)
- return false;
-
- uint width = src_image.getWidth();
- uint height = src_image.getHeight();
-
- dest.resize(src_image.getWidth(), src_image.getHeight(), src_image.getWidth());
-
- color_quad_u8* pDst = dest.get_ptr();
-
- bool grayscale = true;
- bool has_alpha = false;
- for (uint y = 0; y < height; y++)
- {
- const BYTE* pSrc = src_image.getScanLine((WORD)(height - 1 - y));
- color_quad_u8* pD = pDst;
-
- for (uint x = width; x; x--)
- {
- color_quad_u8 c;
- c.r = pSrc[FI_RGBA_RED];
- c.g = pSrc[FI_RGBA_GREEN];
- c.b = pSrc[FI_RGBA_BLUE];
- c.a = pSrc[FI_RGBA_ALPHA];
-
- if (!c.is_grayscale())
- grayscale = false;
- has_alpha |= (c.a < 255);
-
- pSrc += 4;
- *pD++ = c;
- }
-
- pDst += width;
- }
-
- dest.reset_comp_flags();
-
- if (grayscale)
- dest.set_grayscale(true);
-
- dest.set_component_valid(3, has_alpha || (orig_color_type == FIC_RGBALPHA) || (orig_bits_per_pixel == 32));
-
- return true;
- }
-
- const int cSaveLuma = -1;
-
- inline bool save_to_grayscale_file(const wchar_t* pFilename, const image_u8& src, int component, int fi_flag)
- {
- fipImage dst_image(FIT_BITMAP, (WORD)src.get_width(), (WORD)src.get_height(), 8);
-
- RGBQUAD* p = dst_image.getPalette();
- for (uint i = 0; i < dst_image.getPaletteSize(); i++)
- {
- p[i].rgbRed = (BYTE)i;
- p[i].rgbGreen = (BYTE)i;
- p[i].rgbBlue = (BYTE)i;
- p[i].rgbReserved = 255;
- }
-
- for (uint y = 0; y < src.get_height(); y++)
- {
- const color_quad_u8* pSrc = src.get_scanline(y);
-
- for (uint x = 0; x < src.get_width(); x++)
- {
- BYTE v;
- if (component == cSaveLuma)
- v = (BYTE)(*pSrc).get_luma();
- else
- v = (*pSrc)[component];
- dst_image.setPixelIndex(x, src.get_height() - 1 - y, &v);
-
- pSrc++;
- }
- }
-
- if (!dst_image.saveU(pFilename, fi_flag))
- return false;
-
- return true;
- }
-
- inline bool save_to_file(const wchar_t* pFilename, const image_u8& src, int fi_flag, bool ignore_alpha = false)
- {
- const bool save_alpha = src.is_component_valid(3);
- uint bpp = (save_alpha && !ignore_alpha) ? 32 : 24;
-
- if (bpp == 32)
- {
- dynamic_wstring ext(pFilename);
- get_extension(ext);
-
- if ((ext == L"jpg") || (ext == L"jpeg") || (ext == L"gif") || (ext == L"jp2"))
- bpp = 24;
- }
-
- if ((bpp == 24) && (src.is_grayscale()))
- return save_to_grayscale_file(pFilename, src, cSaveLuma, fi_flag);
-
- fipImage dst_image(FIT_BITMAP, (WORD)src.get_width(), (WORD)src.get_height(), (WORD)bpp);
-
- for (uint y = 0; y < src.get_height(); y++)
- {
- for (uint x = 0; x < src.get_width(); x++)
- {
- color_quad_u8 c(src(x, y));
-
- RGBQUAD quad;
- quad.rgbRed = c.r;
- quad.rgbGreen = c.g;
- quad.rgbBlue = c.b;
- if (bpp == 32)
- quad.rgbReserved = c.a;
- else
- quad.rgbReserved = 255;
-
- dst_image.setPixelColor(x, src.get_height() - 1 - y, &quad);
- }
- }
-
- if (!dst_image.saveU(pFilename, fi_flag))
- return false;
-
- return true;
- }
-
- } // namespace freeimage_image_utils
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_hash.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_hash.cpp
deleted file mode 100644
index d26dc8d9..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_hash.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// File: crn_hash.cpp
-// See Paul Hsieh's page at: http://www.azillionmonkeys.com/qed/hash.html
-// Also see http://www.concentric.net/~Ttwang/tech/inthash.htm,
-// http://burtleburtle.net/bob/hash/integer.html
-#include "crn_core.h"
-
-#undef get16bits
-#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
- || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
-#define get16bits(d) (*((const uint16 *) (d)))
-#endif
-
-#if !defined (get16bits)
-#define get16bits(d) ((((uint32)(((const uint8 *)(d))[1])) << 8)\
- +(uint32)(((const uint8 *)(d))[0]) )
-#endif
-
-namespace crnlib
-{
- uint32 fast_hash (const void* p, int len)
- {
- const char * data = static_cast<const char *>(p);
-
- uint32 hash = len, tmp;
- int rem;
-
- if (len <= 0 || data == NULL) return 0;
-
- rem = len & 3;
- len >>= 2;
-
- /* Main loop */
- for (;len > 0; len--) {
- hash += get16bits (data);
- tmp = (get16bits (data+2) << 11) ^ hash;
- hash = (hash << 16) ^ tmp;
- data += 2*sizeof (uint16);
- hash += hash >> 11;
- }
-
- /* Handle end cases */
- switch (rem) {
- case 3: hash += get16bits (data);
- hash ^= hash << 16;
- hash ^= data[sizeof (uint16)] << 18;
- hash += hash >> 11;
- break;
- case 2: hash += get16bits (data);
- hash ^= hash << 11;
- hash += hash >> 17;
- break;
- case 1: hash += *data;
- hash ^= hash << 10;
- hash += hash >> 1;
- }
-
- /* Force "avalanching" of final 127 bits */
- hash ^= hash << 3;
- hash += hash >> 5;
- hash ^= hash << 4;
- hash += hash >> 17;
- hash ^= hash << 25;
- hash += hash >> 6;
-
- return hash;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_hash.h b/Libraries/crunch-ea9b8d/crnlib/crn_hash.h
deleted file mode 100644
index db09c51e..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_hash.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// File: crn_hash.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- uint32 fast_hash (const void* p, int len);
-
- // 4-byte integer hash, full avalanche
- inline uint32 bitmix32c(uint32 a)
- {
- a = (a+0x7ed55d16) + (a<<12);
- a = (a^0xc761c23c) ^ (a>>19);
- a = (a+0x165667b1) + (a<<5);
- a = (a+0xd3a2646c) ^ (a<<9);
- a = (a+0xfd7046c5) + (a<<3);
- a = (a^0xb55a4f09) ^ (a>>16);
- return a;
- }
-
- // 4-byte integer hash, full avalanche, no constants
- inline uint32 bitmix32(uint32 a)
- {
- a -= (a<<6);
- a ^= (a>>17);
- a -= (a<<9);
- a ^= (a<<4);
- a -= (a<<3);
- a ^= (a<<10);
- a ^= (a>>15);
- return a;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_hash_map.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_hash_map.cpp
deleted file mode 100644
index 47b2e8ca..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_hash_map.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-// File: crn_hash_map.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_hash_map.h"
-#include "crn_rand.h"
-
-namespace crnlib
-{
-#if 0
- class counted_obj
- {
- public:
- counted_obj(uint v = 0) :
- m_val(v)
- {
- m_count++;
- }
-
- counted_obj(const counted_obj& obj) :
- m_val(obj.m_val)
- {
- m_count++;
- }
-
- ~counted_obj()
- {
- CRNLIB_ASSERT(m_count > 0);
- m_count--;
- }
-
- static uint m_count;
-
- uint m_val;
-
- operator size_t() const { return m_val; }
-
- bool operator== (const counted_obj& rhs) const { return m_val == rhs.m_val; }
- bool operator== (const uint rhs) const { return m_val == rhs; }
-
- };
-
- uint counted_obj::m_count;
-
- void hash_map_test()
- {
- random r0, r1;
-
- uint seed = 0;
- for ( ; ; )
- {
- seed++;
-
- typedef crnlib::hash_map<counted_obj, counted_obj> my_hash_map;
- my_hash_map m;
-
- const uint n = r0.irand(1, 100000);
-
- printf("%u\n", n);
-
- r1.seed(seed);
-
- crnlib::vector<int> q;
-
- uint count = 0;
- for (uint i = 0; i < n; i++)
- {
- uint v = r1.urand32() & 0x7FFFFFFF;
- my_hash_map::insert_result res = m.insert(counted_obj(v), counted_obj(v ^ 0xdeadbeef));
- if (res.second)
- {
- count++;
- q.push_back(v);
- }
- }
-
- CRNLIB_VERIFY(m.size() == count);
-
- r1.seed(seed);
-
- my_hash_map cm(m);
- m.clear();
- m = cm;
- cm.reset();
-
- for (uint i = 0; i < n; i++)
- {
- uint v = r1.urand32() & 0x7FFFFFFF;
- my_hash_map::const_iterator it = m.find(counted_obj(v));
- CRNLIB_VERIFY(it != m.end());
- CRNLIB_VERIFY(it->first == v);
- CRNLIB_VERIFY(it->second == (v ^ 0xdeadbeef));
- }
-
- for (uint t = 0; t < 2; t++)
- {
- const uint nd = r0.irand(1, q.size() + 1);
- for (uint i = 0; i < nd; i++)
- {
- uint p = r0.irand(0, q.size());
-
- int k = q[p];
- if (k >= 0)
- {
- q[p] = -k - 1;
-
- bool s = m.erase(counted_obj(k));
- CRNLIB_VERIFY(s);
- }
- }
-
- typedef crnlib::hash_map<uint, empty_type> uint_hash_set;
- uint_hash_set s;
-
- for (uint i = 0; i < q.size(); i++)
- {
- int v = q[i];
-
- if (v >= 0)
- {
- my_hash_map::const_iterator it = m.find(counted_obj(v));
- CRNLIB_VERIFY(it != m.end());
- CRNLIB_VERIFY(it->first == (uint)v);
- CRNLIB_VERIFY(it->second == ((uint)v ^ 0xdeadbeef));
-
- s.insert(v);
- }
- else
- {
- my_hash_map::const_iterator it = m.find(counted_obj(-v - 1));
- CRNLIB_VERIFY(it == m.end());
- }
- }
-
- uint found_count = 0;
- for (my_hash_map::const_iterator it = m.begin(); it != m.end(); ++it)
- {
- CRNLIB_VERIFY(it->second == ((uint)it->first ^ 0xdeadbeef));
-
- uint_hash_set::const_iterator fit(s.find((uint)it->first));
- CRNLIB_VERIFY(fit != s.end());
-
- CRNLIB_VERIFY(fit->first == it->first);
-
- found_count++;
- }
-
- CRNLIB_VERIFY(found_count == s.size());
- }
-
- CRNLIB_VERIFY(counted_obj::m_count == m.size() * 2);
- }
- }
-#endif
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_hash_map.h b/Libraries/crunch-ea9b8d/crnlib/crn_hash_map.h
deleted file mode 100644
index 655796af..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_hash_map.h
+++ /dev/null
@@ -1,876 +0,0 @@
-// File: crn_hash_map.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-//
-// Notes:
-// stl-like hash map/hash set, with predictable performance across platforms/compilers/C run times/etc.
-// Hash function ref: http://www.brpreiss.com/books/opus4/html/page215.html
-// Compared for performance against VC9's std::hash_map.
-// Linear probing, auto resizes on ~50% load factor.
-// Uses Knuth's multiplicative method (Fibonacci hashing).
-#pragma once
-#include "crn_sparse_array.h"
-#include "crn_sparse_bit_array.h"
-#include "crn_hash.h"
-
-namespace crnlib
-{
- template <typename T>
- struct hasher
- {
- inline size_t operator() (const T& key) const { return static_cast<size_t>(key); }
- };
-
- template <typename T>
- struct bit_hasher
- {
- inline size_t operator() (const T& key) const { return static_cast<size_t>(fast_hash(&key, sizeof(key))); }
- };
-
- template <typename T>
- struct equal_to
- {
- inline bool operator()(const T& a, const T& b) const { return a == b; }
- };
-
- // Important: The Hasher and Equals objects must be bitwise movable!
- template<typename Key, typename Value = empty_type, typename Hasher = hasher<Key>, typename Equals = equal_to<Key> >
- class hash_map
- {
- friend class iterator;
- friend class const_iterator;
-
- enum state
- {
- cStateInvalid = 0,
- cStateValid = 1
- };
-
- enum
- {
- cMinHashSize = 4U
- };
-
- public:
- typedef hash_map<Key, Value, Hasher, Equals> hash_map_type;
- typedef std::pair<Key, Value> value_type;
- typedef Key key_type;
- typedef Value referent_type;
- typedef Hasher hasher_type;
- typedef Equals equals_type;
-
- hash_map() :
- m_hash_shift(32), m_num_valid(0), m_grow_threshold(0)
- {
- }
-
- hash_map(const hash_map& other) :
- m_values(other.m_values),
- m_hash_shift(other.m_hash_shift),
- m_hasher(other.m_hasher),
- m_equals(other.m_equals),
- m_num_valid(other.m_num_valid),
- m_grow_threshold(other.m_grow_threshold)
- {
- }
-
- hash_map& operator= (const hash_map& other)
- {
- if (this == &other)
- return *this;
-
- clear();
-
- m_values = other.m_values;
- m_hash_shift = other.m_hash_shift;
- m_num_valid = other.m_num_valid;
- m_grow_threshold = other.m_grow_threshold;
- m_hasher = other.m_hasher;
- m_equals = other.m_equals;
-
- return *this;
- }
-
- inline ~hash_map()
- {
- clear();
- }
-
- const Equals& get_equals() const { return m_equals; }
- Equals& get_equals() { return m_equals; }
-
- void set_equals(const Equals& equals) { m_equals = equals; }
-
- const Hasher& get_hasher() const { return m_hasher; }
- Hasher& get_hasher() { return m_hasher; }
-
- void set_hasher(const Hasher& hasher) { m_hasher = hasher; }
-
- inline void clear()
- {
- if (!m_values.empty())
- {
- if (CRNLIB_HAS_DESTRUCTOR(Key) || CRNLIB_HAS_DESTRUCTOR(Value))
- {
- node* p = &get_node(0);
- node* p_end = p + m_values.size();
-
- uint num_remaining = m_num_valid;
- while (p != p_end)
- {
- if (p->state)
- {
- destruct_value_type(p);
- num_remaining--;
- if (!num_remaining)
- break;
- }
-
- p++;
- }
- }
-
- m_values.clear_no_destruction();
-
- m_hash_shift = 32;
- m_num_valid = 0;
- m_grow_threshold = 0;
- }
- }
-
- inline void reset()
- {
- if (!m_num_valid)
- return;
-
- if (CRNLIB_HAS_DESTRUCTOR(Key) || CRNLIB_HAS_DESTRUCTOR(Value))
- {
- node* p = &get_node(0);
- node* p_end = p + m_values.size();
-
- uint num_remaining = m_num_valid;
- while (p != p_end)
- {
- if (p->state)
- {
- destruct_value_type(p);
- p->state = cStateInvalid;
-
- num_remaining--;
- if (!num_remaining)
- break;
- }
-
- p++;
- }
- }
- else if (sizeof(node) <= 32)
- {
- memset(&m_values[0], 0, m_values.size_in_bytes());
- }
- else
- {
- node* p = &get_node(0);
- node* p_end = p + m_values.size();
-
- uint num_remaining = m_num_valid;
- while (p != p_end)
- {
- if (p->state)
- {
- p->state = cStateInvalid;
-
- num_remaining--;
- if (!num_remaining)
- break;
- }
-
- p++;
- }
- }
-
- m_num_valid = 0;
- }
-
- inline uint size()
- {
- return m_num_valid;
- }
-
- inline uint get_table_size()
- {
- return m_values.size();
- }
-
- inline bool empty()
- {
- return !m_num_valid;
- }
-
- inline void reserve(uint new_capacity)
- {
- uint new_hash_size = math::maximum(1U, new_capacity);
-
- new_hash_size = new_hash_size * 2U;
-
- if (!math::is_power_of_2(new_hash_size))
- new_hash_size = math::next_pow2(new_hash_size);
-
- new_hash_size = math::maximum<uint>(cMinHashSize, new_hash_size);
-
- if (new_hash_size > m_values.size())
- rehash(new_hash_size);
- }
-
- class const_iterator;
-
- class iterator
- {
- friend class hash_map<Key, Value, Hasher, Equals>;
- friend class hash_map<Key, Value, Hasher, Equals>::const_iterator;
-
- public:
- inline iterator() : m_pTable(NULL), m_index(0) { }
- inline iterator(hash_map_type& table, uint index) : m_pTable(&table), m_index(index) { }
- inline iterator(const iterator& other) : m_pTable(other.m_pTable), m_index(other.m_index) { }
-
- inline iterator& operator= (const iterator& other)
- {
- m_pTable = other.m_pTable;
- m_index = other.m_index;
- return *this;
- }
-
- // post-increment
- inline iterator operator++(int)
- {
- iterator result(*this);
- ++*this;
- return result;
- }
-
- // pre-increment
- inline iterator& operator++()
- {
- probe();
- return *this;
- }
-
- inline value_type& operator*() const { return *get_cur(); }
- inline value_type* operator->() const { return get_cur(); }
-
- inline bool operator == (const iterator& b) const { return (m_pTable == b.m_pTable) && (m_index == b.m_index); }
- inline bool operator != (const iterator& b) const { return !(*this == b); }
- inline bool operator == (const const_iterator& b) const { return (m_pTable == b.m_pTable) && (m_index == b.m_index); }
- inline bool operator != (const const_iterator& b) const { return !(*this == b); }
-
- private:
- hash_map_type* m_pTable;
- uint m_index;
-
- inline value_type* get_cur() const
- {
- CRNLIB_ASSERT(m_pTable && (m_index < m_pTable->m_values.size()));
- CRNLIB_ASSERT(m_pTable->get_node_state(m_index) == cStateValid);
-
- return &m_pTable->get_node(m_index);
- }
-
- inline void probe()
- {
- CRNLIB_ASSERT(m_pTable);
- m_index = m_pTable->find_next(m_index);
- }
- };
-
- class const_iterator
- {
- friend class hash_map<Key, Value, Hasher, Equals>;
- friend class hash_map<Key, Value, Hasher, Equals>::iterator;
-
- public:
- inline const_iterator() : m_pTable(NULL), m_index(0) { }
- inline const_iterator(const hash_map_type& table, uint index) : m_pTable(&table), m_index(index) { }
- inline const_iterator(const iterator& other) : m_pTable(other.m_pTable), m_index(other.m_index) { }
- inline const_iterator(const const_iterator& other) : m_pTable(other.m_pTable), m_index(other.m_index) { }
-
- inline const_iterator& operator= (const const_iterator& other)
- {
- m_pTable = other.m_pTable;
- m_index = other.m_index;
- return *this;
- }
-
- inline const_iterator& operator= (const iterator& other)
- {
- m_pTable = other.m_pTable;
- m_index = other.m_index;
- return *this;
- }
-
- // post-increment
- inline const_iterator operator++(int)
- {
- const_iterator result(*this);
- ++*this;
- return result;
- }
-
- // pre-increment
- inline const_iterator& operator++()
- {
- probe();
- return *this;
- }
-
- inline const value_type& operator*() const { return *get_cur(); }
- inline const value_type* operator->() const { return get_cur(); }
-
- inline bool operator == (const const_iterator& b) const { return (m_pTable == b.m_pTable) && (m_index == b.m_index); }
- inline bool operator != (const const_iterator& b) const { return !(*this == b); }
- inline bool operator == (const iterator& b) const { return (m_pTable == b.m_pTable) && (m_index == b.m_index); }
- inline bool operator != (const iterator& b) const { return !(*this == b); }
-
- private:
- const hash_map_type* m_pTable;
- uint m_index;
-
- inline const value_type* get_cur() const
- {
- CRNLIB_ASSERT(m_pTable && (m_index < m_pTable->m_values.size()));
- CRNLIB_ASSERT(m_pTable->get_node_state(m_index) == cStateValid);
-
- return &m_pTable->get_node(m_index);
- }
-
- inline void probe()
- {
- CRNLIB_ASSERT(m_pTable);
- m_index = m_pTable->find_next(m_index);
- }
- };
-
- inline const_iterator begin() const
- {
- if (!m_num_valid)
- return end();
-
- return const_iterator(*this, find_next(-1));
- }
-
- inline const_iterator end() const
- {
- return const_iterator(*this, m_values.size());
- }
-
- inline iterator begin()
- {
- if (!m_num_valid)
- return end();
-
- return iterator(*this, find_next(-1));
- }
-
- inline iterator end()
- {
- return iterator(*this, m_values.size());
- }
-
- // insert_result.first will always point to inserted key/value (or the already existing key/value).
- // insert_resutt.second will be true if a new key/value was inserted, or false if the key already existed (in which case first will point to the already existing value).
- typedef std::pair<iterator, bool> insert_result;
-
- inline insert_result insert(const Key& k, const Value& v = Value())
- {
- insert_result result;
- if (!insert_no_grow(result, k, v))
- {
- grow();
-
- // This must succeed.
- if (!insert_no_grow(result, k, v))
- {
- CRNLIB_FAIL("insert() failed");
- }
- }
-
- return result;
- }
-
- inline insert_result insert(const value_type& v)
- {
- return insert(v.first, v.second);
- }
-
- inline const_iterator find(const Key& k) const
- {
- return const_iterator(*this, find_index(k));
- }
-
- inline iterator find(const Key& k)
- {
- return iterator(*this, find_index(k));
- }
-
- inline bool erase(const Key& k)
- {
- int i = find_index(k);
-
- if (i >= static_cast<int>(m_values.size()))
- return false;
-
- node* pDst = &get_node(i);
- destruct_value_type(pDst);
- pDst->state = cStateInvalid;
-
- m_num_valid--;
-
- for ( ; ; )
- {
- int r, j = i;
-
- node* pSrc = pDst;
-
- do
- {
- if (!i)
- {
- i = m_values.size() - 1;
- pSrc = &get_node(i);
- }
- else
- {
- i--;
- pSrc--;
- }
-
- if (!pSrc->state)
- return true;
-
- r = hash_key(pSrc->first);
-
- } while ((i <= r && r < j) || (r < j && j < i) || (j < i && i <= r));
-
- move_node(pDst, pSrc);
-
- pDst = pSrc;
- }
- }
-
- inline void swap(hash_map_type& other)
- {
- m_values.swap(other.m_values);
- utils::swap(m_hash_shift, other.m_hash_shift);
- utils::swap(m_num_valid, other.m_num_valid);
- utils::swap(m_grow_threshold, other.m_grow_threshold);
- utils::swap(m_hasher, other.m_hasher);
- utils::swap(m_equals, other.m_equals);
- }
-
- private:
- struct node : public value_type
- {
- uint8 state;
- };
-
- static inline void construct_value_type(value_type* pDst, const Key& k, const Value& v)
- {
- if (CRNLIB_IS_BITWISE_COPYABLE(Key))
- memcpy(&pDst->first, &k, sizeof(Key));
- else
- scalar_type<Key>::construct(&pDst->first, k);
-
- if (CRNLIB_IS_BITWISE_COPYABLE(Value))
- memcpy(&pDst->second, &v, sizeof(Value));
- else
- scalar_type<Value>::construct(&pDst->second, v);
- }
-
- static inline void construct_value_type(value_type* pDst, const value_type* pSrc)
- {
- if ((CRNLIB_IS_BITWISE_COPYABLE(Key)) && (CRNLIB_IS_BITWISE_COPYABLE(Value)))
- {
- memcpy(pDst, pSrc, sizeof(value_type));
- }
- else
- {
- if (CRNLIB_IS_BITWISE_COPYABLE(Key))
- memcpy(&pDst->first, &pSrc->first, sizeof(Key));
- else
- scalar_type<Key>::construct(&pDst->first, pSrc->first);
-
- if (CRNLIB_IS_BITWISE_COPYABLE(Value))
- memcpy(&pDst->second, &pSrc->second, sizeof(Value));
- else
- scalar_type<Value>::construct(&pDst->second, pSrc->second);
- }
- }
-
- static inline void destruct_value_type(value_type* p)
- {
- scalar_type<Key>::destruct(&p->first);
- scalar_type<Value>::destruct(&p->second);
- }
-
- // Moves *pSrc to *pDst efficiently.
- // pDst should NOT be constructed on entry.
- static inline void move_node(node* pDst, node* pSrc)
- {
- CRNLIB_ASSERT(!pDst->state);
-
- if (CRNLIB_IS_BITWISE_COPYABLE_OR_MOVABLE(Key) && CRNLIB_IS_BITWISE_COPYABLE_OR_MOVABLE(Value))
- {
- memcpy(pDst, pSrc, sizeof(node));
- }
- else
- {
- if (CRNLIB_IS_BITWISE_COPYABLE_OR_MOVABLE(Key))
- memcpy(&pDst->first, &pSrc->first, sizeof(Key));
- else
- {
- scalar_type<Key>::construct(&pDst->first, pSrc->first);
- scalar_type<Key>::destruct(&pSrc->first);
- }
-
- if (CRNLIB_IS_BITWISE_COPYABLE_OR_MOVABLE(Value))
- memcpy(&pDst->second, &pSrc->second, sizeof(Value));
- else
- {
- scalar_type<Value>::construct(&pDst->second, pSrc->second);
- scalar_type<Value>::destruct(&pSrc->second);
- }
-
- pDst->state = cStateValid;
- }
-
- pSrc->state = cStateInvalid;
- }
-
- struct raw_node
- {
- inline raw_node()
- {
- node* p = reinterpret_cast<node*>(this);
- p->state = cStateInvalid;
- }
-
- inline ~raw_node()
- {
- node* p = reinterpret_cast<node*>(this);
- if (p->state)
- hash_map_type::destruct_value_type(p);
- }
-
- inline raw_node(const raw_node& other)
- {
- node* pDst = reinterpret_cast<node*>(this);
- const node* pSrc = reinterpret_cast<const node*>(&other);
-
- if (pSrc->state)
- {
- hash_map_type::construct_value_type(pDst, pSrc);
- pDst->state = cStateValid;
- }
- else
- pDst->state = cStateInvalid;
- }
-
- inline raw_node& operator= (const raw_node& rhs)
- {
- if (this == &rhs)
- return *this;
-
- node* pDst = reinterpret_cast<node*>(this);
- const node* pSrc = reinterpret_cast<const node*>(&rhs);
-
- if (pSrc->state)
- {
- if (pDst->state)
- {
- pDst->first = pSrc->first;
- pDst->second = pSrc->second;
- }
- else
- {
- hash_map_type::construct_value_type(pDst, pSrc);
- pDst->state = cStateValid;
- }
- }
- else if (pDst->state)
- {
- hash_map_type::destruct_value_type(pDst);
- pDst->state = cStateInvalid;
- }
-
- return *this;
- }
-
- uint8 m_bits[sizeof(node)];
- };
-
- typedef crnlib::vector<raw_node> node_vector;
-
- node_vector m_values;
- uint m_hash_shift;
-
- Hasher m_hasher;
- Equals m_equals;
-
- uint m_num_valid;
-
- uint m_grow_threshold;
-
- inline int hash_key(const Key& k) const
- {
- CRNLIB_ASSERT((1U << (32U - m_hash_shift)) == m_values.size());
-
- uint hash = static_cast<uint>(m_hasher(k));
-
- // Fibonacci hashing
- hash = (2654435769U * hash) >> m_hash_shift;
-
- CRNLIB_ASSERT(hash < m_values.size());
- return hash;
- }
-
- inline const node& get_node(uint index) const
- {
- return *reinterpret_cast<const node*>(&m_values[index]);
- }
-
- inline node& get_node(uint index)
- {
- return *reinterpret_cast<node*>(&m_values[index]);
- }
-
- inline state get_node_state(uint index) const
- {
- return static_cast<state>(get_node(index).state);
- }
-
- inline void set_node_state(uint index, bool valid)
- {
- get_node(index).state = valid;
- }
-
- inline void grow()
- {
- rehash(math::maximum<uint>(cMinHashSize, m_values.size() * 2U));
- }
-
- inline void rehash(uint new_hash_size)
- {
- CRNLIB_ASSERT(new_hash_size >= m_num_valid);
- CRNLIB_ASSERT(math::is_power_of_2(new_hash_size));
-
- if ((new_hash_size < m_num_valid) || (new_hash_size == m_values.size()))
- return;
-
- hash_map new_map;
- new_map.m_values.resize(new_hash_size);
- new_map.m_hash_shift = 32U - math::floor_log2i(new_hash_size);
- CRNLIB_ASSERT(new_hash_size == (1U << (32U - new_map.m_hash_shift)));
- new_map.m_grow_threshold = UINT_MAX;
-
- node* pNode = reinterpret_cast<node*>(m_values.begin());
- node* pNode_end = pNode + m_values.size();
-
- while (pNode != pNode_end)
- {
- if (pNode->state)
- {
- new_map.move_into(pNode);
-
- if (new_map.m_num_valid == m_num_valid)
- break;
- }
-
- pNode++;
- }
-
- new_map.m_grow_threshold = (new_hash_size + 1U) >> 1U;
-
- m_values.clear_no_destruction();
- m_hash_shift = 32;
-
- swap(new_map);
- }
-
- inline uint find_next(int index) const
- {
- index++;
-
- if (index >= static_cast<int>(m_values.size()))
- return index;
-
- const node* pNode = &get_node(index);
-
- for ( ; ; )
- {
- if (pNode->state)
- break;
-
- if (++index >= static_cast<int>(m_values.size()))
- break;
-
- pNode++;
- }
-
- return index;
- }
-
- inline uint find_index(const Key& k) const
- {
- if (m_num_valid)
- {
- int index = hash_key(k);
- const node* pNode = &get_node(index);
-
- if (pNode->state)
- {
- if (m_equals(pNode->first, k))
- return index;
-
- const int orig_index = index;
-
- for ( ; ; )
- {
- if (!index)
- {
- index = m_values.size() - 1;
- pNode = &get_node(index);
- }
- else
- {
- index--;
- pNode--;
- }
-
- if (index == orig_index)
- break;
-
- if (!pNode->state)
- break;
-
- if (m_equals(pNode->first, k))
- return index;
- }
- }
- }
-
- return m_values.size();
- }
-
- inline bool insert_no_grow(insert_result& result, const Key& k, const Value& v = Value())
- {
- if (!m_values.size())
- return false;
-
- int index = hash_key(k);
- node* pNode = &get_node(index);
-
- if (pNode->state)
- {
- if (m_equals(pNode->first, k))
- {
- result.first = iterator(*this, index);
- result.second = false;
- return true;
- }
-
- const int orig_index = index;
-
- for ( ; ; )
- {
- if (!index)
- {
- index = m_values.size() - 1;
- pNode = &get_node(index);
- }
- else
- {
- index--;
- pNode--;
- }
-
- if (orig_index == index)
- return false;
-
- if (!pNode->state)
- break;
-
- if (m_equals(pNode->first, k))
- {
- result.first = iterator(*this, index);
- result.second = false;
- return true;
- }
- }
- }
-
- if (m_num_valid >= m_grow_threshold)
- return false;
-
- construct_value_type(pNode, k, v);
-
- pNode->state = cStateValid;
-
- m_num_valid++;
- CRNLIB_ASSERT(m_num_valid <= m_values.size());
-
- result.first = iterator(*this, index);
- result.second = true;
-
- return true;
- }
-
- inline void move_into(node* pNode)
- {
- int index = hash_key(pNode->first);
- node* pDst_node = &get_node(index);
-
- if (pDst_node->state)
- {
- const int orig_index = index;
-
- for ( ; ; )
- {
- if (!index)
- {
- index = m_values.size() - 1;
- pDst_node = &get_node(index);
- }
- else
- {
- index--;
- pDst_node--;
- }
-
- if (index == orig_index)
- {
- CRNLIB_ASSERT(false);
- return;
- }
-
- if (!pDst_node->state)
- break;
- }
- }
-
- move_node(pDst_node, pNode);
-
- m_num_valid++;
- }
- };
-
- template<typename Key, typename Value, typename Hasher, typename Equals>
- struct bitwise_movable< hash_map<Key, Value, Hasher, Equals> > { enum { cFlag = true }; };
-
- template<typename Key, typename Value, typename Hasher, typename Equals>
- inline void swap(hash_map<Key, Value, Hasher, Equals>& a, hash_map<Key, Value, Hasher, Equals>& b)
- {
- a.swap(b);
- }
-
- extern void hash_map_test();
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_helpers.h b/Libraries/crunch-ea9b8d/crnlib/crn_helpers.h
deleted file mode 100644
index a9e33224..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_helpers.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// File: crn_helpers.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-#define CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(c) c(const c&); c& operator= (const c&);
-#define CRNLIB_NO_HEAP_ALLOC() private: static void* operator new(size_t); static void* operator new[](size_t);
-
-namespace crnlib
-{
- namespace helpers
- {
- template<typename T> struct rel_ops
- {
- friend bool operator!=(const T& x, const T& y) { return (!(x == y)); }
- friend bool operator> (const T& x, const T& y) { return (y < x); }
- friend bool operator<=(const T& x, const T& y) { return (!(y < x)); }
- friend bool operator>=(const T& x, const T& y) { return (!(x < y)); }
- };
-
- template <typename T>
- inline T* construct(T* p)
- {
- return new (static_cast<void*>(p)) T;
- }
-
- template <typename T, typename U>
- inline T* construct(T* p, const U& init)
- {
- return new (static_cast<void*>(p)) T(init);
- }
-
- template <typename T>
- inline void construct_array(T* p, uint n)
- {
- T* q = p + n;
- for ( ; p != q; ++p)
- new (static_cast<void*>(p)) T;
- }
-
- template <typename T, typename U>
- inline void construct_array(T* p, uint n, const U& init)
- {
- T* q = p + n;
- for ( ; p != q; ++p)
- new (static_cast<void*>(p)) T(init);
- }
-
- template <typename T>
- inline void destruct(T* p)
- {
- p;
- p->~T();
- }
-
- template <typename T> inline void destruct_array(T* p, uint n)
- {
- T* q = p + n;
- for ( ; p != q; ++p)
- p->~T();
- }
-
- } // namespace helpers
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_huffman_codes.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_huffman_codes.cpp
deleted file mode 100644
index 83f30aa4..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_huffman_codes.cpp
+++ /dev/null
@@ -1,387 +0,0 @@
-// File: crn_huffman_codes.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_huffman_codes.h"
-
-namespace crnlib
-{
- struct sym_freq
- {
- uint m_freq;
- uint16 m_left;
- uint16 m_right;
-
- inline bool operator< (const sym_freq& other) const
- {
- return m_freq > other.m_freq;
- }
- };
-
- static inline sym_freq* radix_sort_syms(uint num_syms, sym_freq* syms0, sym_freq* syms1)
- {
- const uint cMaxPasses = 2;
- uint hist[256 * cMaxPasses];
-
- memset(hist, 0, sizeof(hist[0]) * 256 * cMaxPasses);
-
- sym_freq* p = syms0;
- sym_freq* q = syms0 + (num_syms >> 1) * 2;
-
- for ( ; p != q; p += 2)
- {
- const uint freq0 = p[0].m_freq;
- const uint freq1 = p[1].m_freq;
-
- hist[ freq0 & 0xFF]++;
- hist[256 + ((freq0 >> 8) & 0xFF)]++;
-
- hist[ freq1 & 0xFF]++;
- hist[256 + ((freq1 >> 8) & 0xFF)]++;
- }
-
- if (num_syms & 1)
- {
- const uint freq = p->m_freq;
-
- hist[ freq & 0xFF]++;
- hist[256 + ((freq >> 8) & 0xFF)]++;
- }
-
- sym_freq* pCur_syms = syms0;
- sym_freq* pNew_syms = syms1;
-
- for (uint pass = 0; pass < cMaxPasses; pass++)
- {
- const uint* pHist = &hist[pass << 8];
-
- uint offsets[256];
-
- uint cur_ofs = 0;
- for (uint i = 0; i < 256; i += 2)
- {
- offsets[i] = cur_ofs;
- cur_ofs += pHist[i];
-
- offsets[i+1] = cur_ofs;
- cur_ofs += pHist[i+1];
- }
-
- const uint pass_shift = pass << 3;
-
- sym_freq* p = pCur_syms;
- sym_freq* q = pCur_syms + (num_syms >> 1) * 2;
-
- for ( ; p != q; p += 2)
- {
- uint c0 = p[0].m_freq;
- uint c1 = p[1].m_freq;
-
- if (pass)
- {
- c0 >>= 8;
- c1 >>= 8;
- }
-
- c0 &= 0xFF;
- c1 &= 0xFF;
-
- if (c0 == c1)
- {
- uint dst_offset0 = offsets[c0];
-
- offsets[c0] = dst_offset0 + 2;
-
- pNew_syms[dst_offset0] = p[0];
- pNew_syms[dst_offset0 + 1] = p[1];
- }
- else
- {
- uint dst_offset0 = offsets[c0]++;
- uint dst_offset1 = offsets[c1]++;
-
- pNew_syms[dst_offset0] = p[0];
- pNew_syms[dst_offset1] = p[1];
- }
- }
-
- if (num_syms & 1)
- {
- uint c = ((p->m_freq) >> pass_shift) & 0xFF;
-
- uint dst_offset = offsets[c];
- offsets[c] = dst_offset + 1;
-
- pNew_syms[dst_offset] = *p;
- }
-
- sym_freq* t = pCur_syms;
- pCur_syms = pNew_syms;
- pNew_syms = t;
- }
-
-#ifdef CRNLIB_ASSERTS_ENABLED
- uint prev_freq = 0;
- for (uint i = 0; i < num_syms; i++)
- {
- CRNLIB_ASSERT(!(pCur_syms[i].m_freq < prev_freq));
- prev_freq = pCur_syms[i].m_freq;
- }
-#endif
-
- return pCur_syms;
- }
-
- struct huffman_work_tables
- {
- enum { cMaxInternalNodes = cHuffmanMaxSupportedSyms };
-
- sym_freq syms0[cHuffmanMaxSupportedSyms + 1 + cMaxInternalNodes];
- sym_freq syms1[cHuffmanMaxSupportedSyms + 1 + cMaxInternalNodes];
-
- uint16 queue[cMaxInternalNodes];
- };
-
- void* create_generate_huffman_codes_tables()
- {
- return crnlib_new<huffman_work_tables>();
- }
-
- void free_generate_huffman_codes_tables(void* p)
- {
- crnlib_delete(static_cast<huffman_work_tables*>(p));
- }
-
-#if USE_CALCULATE_MINIMUM_REDUNDANCY
- /* calculate_minimum_redundancy() written by
- Alistair Moffat, alistair@cs.mu.oz.au,
- Jyrki Katajainen, jyrki@diku.dk
- November 1996.
- */
- static void calculate_minimum_redundancy(int A[], int n) {
- int root; /* next root node to be used */
- int leaf; /* next leaf to be used */
- int next; /* next value to be assigned */
- int avbl; /* number of available nodes */
- int used; /* number of internal nodes */
- int dpth; /* current depth of leaves */
-
- /* check for pathological cases */
- if (n==0) { return; }
- if (n==1) { A[0] = 0; return; }
-
- /* first pass, left to right, setting parent pointers */
- A[0] += A[1]; root = 0; leaf = 2;
- for (next=1; next < n-1; next++) {
- /* select first item for a pairing */
- if (leaf>=n || A[root]<A[leaf]) {
- A[next] = A[root]; A[root++] = next;
- } else
- A[next] = A[leaf++];
-
- /* add on the second item */
- if (leaf>=n || (root<next && A[root]<A[leaf])) {
- A[next] += A[root]; A[root++] = next;
- } else
- A[next] += A[leaf++];
- }
-
- /* second pass, right to left, setting internal depths */
- A[n-2] = 0;
- for (next=n-3; next>=0; next--)
- A[next] = A[A[next]]+1;
-
- /* third pass, right to left, setting leaf depths */
- avbl = 1; used = dpth = 0; root = n-2; next = n-1;
- while (avbl>0) {
- while (root>=0 && A[root]==dpth) {
- used++; root--;
- }
- while (avbl>used) {
- A[next--] = dpth; avbl--;
- }
- avbl = 2*used; dpth++; used = 0;
- }
- }
-#endif
-
- bool generate_huffman_codes(void* pContext, uint num_syms, const uint16* pFreq, uint8* pCodesizes, uint& max_code_size, uint& total_freq_ret)
- {
- if ((!num_syms) || (num_syms > cHuffmanMaxSupportedSyms))
- return false;
-
- huffman_work_tables& state = *static_cast<huffman_work_tables*>(pContext);;
-
- uint max_freq = 0;
- uint total_freq = 0;
-
- uint num_used_syms = 0;
- for (uint i = 0; i < num_syms; i++)
- {
- uint freq = pFreq[i];
-
- if (!freq)
- pCodesizes[i] = 0;
- else
- {
- total_freq += freq;
- max_freq = math::maximum(max_freq, freq);
-
- sym_freq& sf = state.syms0[num_used_syms];
- sf.m_left = (uint16)i;
- sf.m_right = cUINT16_MAX;
- sf.m_freq = freq;
- num_used_syms++;
- }
- }
-
- total_freq_ret = total_freq;
-
- if (num_used_syms == 1)
- {
- pCodesizes[state.syms0[0].m_left] = 1;
- return true;
- }
-
- sym_freq* syms = radix_sort_syms(num_used_syms, state.syms0, state.syms1);
-
-#if USE_CALCULATE_MINIMUM_REDUNDANCY
- int x[cHuffmanMaxSupportedSyms];
- for (uint i = 0; i < num_used_syms; i++)
- x[i] = state.syms0[i].m_freq;
-
- calculate_minimum_redundancy(x, num_used_syms);
-
- uint max_len = 0;
- for (uint i = 0; i < num_used_syms; i++)
- {
- uint len = x[i];
- max_len = math::maximum(len, max_len);
- pCodesizes[state.syms0[i].m_left] = static_cast<uint8>(len);
- }
-
- return true;
-#else
- // Dummy node
- sym_freq& sf = state.syms0[num_used_syms];
- sf.m_left = cUINT16_MAX;
- sf.m_right = cUINT16_MAX;
- sf.m_freq = UINT_MAX;
-
- uint next_internal_node = num_used_syms + 1;
-
- uint queue_front = 0;
- uint queue_end = 0;
-
- uint next_lowest_sym = 0;
-
- uint num_nodes_remaining = num_used_syms;
- do
- {
- uint left_freq = syms[next_lowest_sym].m_freq;
- uint left_child = next_lowest_sym;
-
- if ((queue_end > queue_front) && (syms[state.queue[queue_front]].m_freq < left_freq))
- {
- left_child = state.queue[queue_front];
- left_freq = syms[left_child].m_freq;
-
- queue_front++;
- }
- else
- next_lowest_sym++;
-
- uint right_freq = syms[next_lowest_sym].m_freq;
- uint right_child = next_lowest_sym;
-
- if ((queue_end > queue_front) && (syms[state.queue[queue_front]].m_freq < right_freq))
- {
- right_child = state.queue[queue_front];
- right_freq = syms[right_child].m_freq;
-
- queue_front++;
- }
- else
- next_lowest_sym++;
-
- const uint internal_node_index = next_internal_node;
- next_internal_node++;
-
- CRNLIB_ASSERT(next_internal_node < CRNLIB_ARRAYSIZE(state.syms0));
-
- syms[internal_node_index].m_freq = left_freq + right_freq;
- syms[internal_node_index].m_left = static_cast<uint16>(left_child);
- syms[internal_node_index].m_right = static_cast<uint16>(right_child);
-
- CRNLIB_ASSERT(queue_end < huffman_work_tables::cMaxInternalNodes);
- state.queue[queue_end] = static_cast<uint16>(internal_node_index);
- queue_end++;
-
- num_nodes_remaining--;
-
- } while (num_nodes_remaining > 1);
-
- CRNLIB_ASSERT(next_lowest_sym == num_used_syms);
- CRNLIB_ASSERT((queue_end - queue_front) == 1);
-
- uint cur_node_index = state.queue[queue_front];
-
- uint32* pStack = (syms == state.syms0) ? (uint32*)state.syms1 : (uint32*)state.syms0;
- uint32* pStack_top = pStack;
-
- uint max_level = 0;
-
- for ( ; ; )
- {
- uint level = cur_node_index >> 16;
- uint node_index = cur_node_index & 0xFFFF;
-
- uint left_child = syms[node_index].m_left;
- uint right_child = syms[node_index].m_right;
-
- uint next_level = (cur_node_index + 0x10000) & 0xFFFF0000;
-
- if (left_child < num_used_syms)
- {
- max_level = math::maximum(max_level, level);
-
- pCodesizes[syms[left_child].m_left] = static_cast<uint8>(level + 1);
-
- if (right_child < num_used_syms)
- {
- pCodesizes[syms[right_child].m_left] = static_cast<uint8>(level + 1);
-
- if (pStack == pStack_top) break;
- cur_node_index = *--pStack;
- }
- else
- {
- cur_node_index = next_level | right_child;
- }
- }
- else
- {
- if (right_child < num_used_syms)
- {
- max_level = math::maximum(max_level, level);
-
- pCodesizes[syms[right_child].m_left] = static_cast<uint8>(level + 1);
-
- cur_node_index = next_level | left_child;
- }
- else
- {
- *pStack++ = next_level | left_child;
-
- cur_node_index = next_level | right_child;
- }
- }
- }
-
- max_code_size = max_level + 1;
-#endif
-
- return true;
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_huffman_codes.h b/Libraries/crunch-ea9b8d/crnlib/crn_huffman_codes.h
deleted file mode 100644
index 473d09d9..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_huffman_codes.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// File: crn_huffman_codes.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- const uint cHuffmanMaxSupportedSyms = 8192;
-
- void* create_generate_huffman_codes_tables();
- void free_generate_huffman_codes_tables(void* p);
-
- bool generate_huffman_codes(void* pContext, uint num_syms, const uint16* pFreq, uint8* pCodesizes, uint& max_code_size, uint& total_freq_ret);
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_image.h b/Libraries/crunch-ea9b8d/crnlib/crn_image.h
deleted file mode 100644
index 1e14338d..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_image.h
+++ /dev/null
@@ -1,723 +0,0 @@
-// File: crn_image.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_color.h"
-#include "crn_vec.h"
-#include "crn_pixel_format.h"
-#include "crn_rect.h"
-
-namespace crnlib
-{
- template<typename color_type>
- class image
- {
- public:
- typedef color_type color_t;
-
- typedef crnlib::vector<color_type> pixel_buf_t;
-
- image() :
- m_width(0),
- m_height(0),
- m_pitch(0),
- m_total(0),
- m_comp_flags(pixel_format_helpers::cDefaultCompFlags),
- m_pPixels(NULL)
- {
- }
-
- // pitch is in PIXELS, not bytes.
- image(uint width, uint height, uint pitch = UINT_MAX, const color_type& background = color_type::make_black(), uint flags = pixel_format_helpers::cDefaultCompFlags) :
- m_comp_flags(flags)
- {
- CRNLIB_ASSERT((width > 0) && (height > 0));
- if (pitch == UINT_MAX)
- pitch = width;
-
- m_pixel_buf.resize(pitch * height);
-
- m_width = width;
- m_height = height;
- m_pitch = pitch;
- m_total = m_pitch * m_height;
-
- m_pPixels = &m_pixel_buf.front();
-
- set_all(background);
- }
-
- // pitch is in PIXELS, not bytes.
- image(color_type* pPixels, uint width, uint height, uint pitch = UINT_MAX, uint flags = pixel_format_helpers::cDefaultCompFlags)
- {
- alias(pPixels, width, height, pitch, flags);
- }
-
- image& operator= (const image& other)
- {
- if (this == &other)
- return *this;
-
- if (other.m_pixel_buf.empty())
- {
- // This doesn't look very safe - let's make a new instance.
- //m_pixel_buf.clear();
- //m_pPixels = other.m_pPixels;
-
- const uint total_pixels = other.m_pitch * other.m_height;
- if ((total_pixels) && (other.m_pPixels))
- {
- m_pixel_buf.resize(total_pixels);
- m_pixel_buf.insert(0, other.m_pPixels, m_pixel_buf.size());
- m_pPixels = &m_pixel_buf.front();
- }
- else
- {
- m_pixel_buf.clear();
- m_pPixels = NULL;
- }
- }
- else
- {
- m_pixel_buf = other.m_pixel_buf;
- m_pPixels = &m_pixel_buf.front();
- }
-
- m_width = other.m_width;
- m_height = other.m_height;
- m_pitch = other.m_pitch;
- m_total = other.m_total;
- m_comp_flags = other.m_comp_flags;
-
- return *this;
- }
-
- image(const image& other) :
- m_width(0), m_height(0), m_pitch(0), m_total(0), m_comp_flags(pixel_format_helpers::cDefaultCompFlags), m_pPixels(NULL)
- {
- *this = other;
- }
-
- // pitch is in PIXELS, not bytes.
- void alias(color_type* pPixels, uint width, uint height, uint pitch = UINT_MAX, uint flags = pixel_format_helpers::cDefaultCompFlags)
- {
- m_pixel_buf.clear();
-
- m_pPixels = pPixels;
-
- m_width = width;
- m_height = height;
- m_pitch = (pitch == UINT_MAX) ? width : pitch;
- m_total = m_pitch * m_height;
- m_comp_flags = flags;
- }
-
- // pitch is in PIXELS, not bytes.
- bool grant_ownership(color_type* pPixels, uint width, uint height, uint pitch = UINT_MAX, uint flags = pixel_format_helpers::cDefaultCompFlags)
- {
- if (pitch == UINT_MAX)
- pitch = width;
-
- if ((!pPixels) || (!width) || (!height) || (pitch < width))
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- if (pPixels == get_ptr())
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- clear();
-
- if (!m_pixel_buf.grant_ownership(pPixels, height * pitch, height * pitch))
- return false;
-
- m_pPixels = pPixels;
-
- m_width = width;
- m_height = height;
- m_pitch = pitch;
- m_total = pitch * height;
- m_comp_flags = flags;
-
- return true;
- }
-
- void clear()
- {
- m_pPixels = NULL;
- m_pixel_buf.clear();
- m_width = 0;
- m_height = 0;
- m_pitch = 0;
- m_total = 0;
- m_comp_flags = pixel_format_helpers::cDefaultCompFlags;
- }
-
- inline bool is_valid() const { return m_total > 0; }
-
- inline pixel_format_helpers::component_flags get_comp_flags() const { return static_cast<pixel_format_helpers::component_flags>(m_comp_flags); }
- inline void set_comp_flags(pixel_format_helpers::component_flags new_flags) { m_comp_flags = new_flags; }
- inline void reset_comp_flags() { m_comp_flags = pixel_format_helpers::cDefaultCompFlags; }
-
- inline bool is_component_valid(uint index) const { CRNLIB_ASSERT(index < 4U); return utils::is_flag_set(m_comp_flags, index); }
- inline void set_component_valid(uint index, bool state) { CRNLIB_ASSERT(index < 4U); utils::set_flag(m_comp_flags, index, state); }
-
- inline bool has_rgb() const { return is_component_valid(0) || is_component_valid(1) || is_component_valid(2); }
- inline bool has_alpha() const { return is_component_valid(3); }
-
- inline bool is_grayscale() const { return utils::is_bit_set(m_comp_flags, pixel_format_helpers::cCompFlagGrayscale); }
- inline void set_grayscale(bool state) { utils::set_bit(m_comp_flags, pixel_format_helpers::cCompFlagGrayscale, state); }
-
- void set_all(const color_type& c)
- {
- for (uint i = 0; i < m_total; i++)
- m_pPixels[i] = c;
- }
-
- void flip_x()
- {
- const uint half_width = m_width / 2;
- for (uint y = 0; y < m_height; y++)
- {
- for (uint x = 0; x < half_width; x++)
- {
- color_type c((*this)(x, y));
- (*this)(x, y) = (*this)(m_width - 1 - x, y);
- (*this)(m_width - 1 - x, y) = c;
- }
- }
- }
-
- void flip_y()
- {
- const uint half_height = m_height / 2;
- for (uint y = 0; y < half_height; y++)
- {
- for (uint x = 0; x < m_width; x++)
- {
- color_type c((*this)(x, y));
- (*this)(x, y) = (*this)(x, m_height - 1 - y);
- (*this)(x, m_height - 1 - y) = c;
- }
- }
- }
-
- void convert_to_grayscale()
- {
- for (uint y = 0; y < m_height; y++)
- for (uint x = 0; x < m_width; x++)
- {
- color_type c((*this)(x, y));
- typename color_type::component_t l = static_cast< typename color_type::component_t >(c.get_luma());
- c.r = l;
- c.g = l;
- c.b = l;
- (*this)(x, y) = c;
- }
-
- set_grayscale(true);
- }
-
- void swizzle(uint r, uint g, uint b, uint a)
- {
- for (uint y = 0; y < m_height; y++)
- for (uint x = 0; x < m_width; x++)
- {
- const color_type& c = (*this)(x, y);
-
- (*this)(x, y) = color_type(c[r], c[g], c[b], c[a]);
- }
- }
-
- void set_alpha_to_luma()
- {
- for (uint y = 0; y < m_height; y++)
- for (uint x = 0; x < m_width; x++)
- {
- color_type c((*this)(x, y));
- typename color_type::component_t l = static_cast< typename color_type::component_t >(c.get_luma());
- c.a = l;
- (*this)(x, y) = c;
- }
-
- set_component_valid(3, true);
- }
-
- bool extract_block(color_type* pDst, uint x, uint y, uint w, uint h, bool flip_xy = false) const
- {
- if ((x >= m_width) || (y >= m_height))
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- if (flip_xy)
- {
- for (uint y_ofs = 0; y_ofs < h; y_ofs++)
- for (uint x_ofs = 0; x_ofs < w; x_ofs++)
- pDst[x_ofs * h + y_ofs] = get_clamped(x_ofs + x, y_ofs + y); // 5/4/12 - this was incorrectly x_ofs * 4
- }
- else if (((x + w) > m_width) || ((y + h) > m_height))
- {
- for (uint y_ofs = 0; y_ofs < h; y_ofs++)
- for (uint x_ofs = 0; x_ofs < w; x_ofs++)
- *pDst++ = get_clamped(x_ofs + x, y_ofs + y);
- }
- else
- {
- const color_type* pSrc = get_scanline(y) + x;
-
- for (uint i = h; i; i--)
- {
- memcpy(pDst, pSrc, w * sizeof(color_type));
- pDst += w;
-
- pSrc += m_pitch;
- }
- }
-
- return true;
- }
-
- // No clipping!
- void unclipped_fill_box(uint x, uint y, uint w, uint h, const color_type& c)
- {
- if (((x + w) > m_width) || ((y + h) > m_height))
- {
- CRNLIB_ASSERT(0);
- return;
- }
-
- color_type* p = get_scanline(y) + x;
-
- for (uint i = h; i; i--)
- {
- color_type* q = p;
- for (uint j = w; j; j--)
- *q++ = c;
- p += m_pitch;
- }
- }
-
- void draw_rect(int x, int y, uint width, uint height, const color_type& c)
- {
- draw_line(x, y, x + width - 1, y, c);
- draw_line(x, y, x, y + height - 1, c);
- draw_line(x + width - 1, y, x + width - 1, y + height - 1, c);
- draw_line(x, y + height - 1, x + width - 1, y + height - 1, c);
- }
-
- // No clipping!
- bool unclipped_blit(uint src_x, uint src_y, uint src_w, uint src_h, uint dst_x, uint dst_y, const image& src)
- {
- if ((!is_valid()) || (!src.is_valid()))
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- if ( ((src_x + src_w) > src.get_width()) || ((src_y + src_h) > src.get_height()) )
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- if ( ((dst_x + src_w) > get_width()) || ((dst_y + src_h) > get_height()) )
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- const color_type* pS = &src(src_x, src_y);
- color_type* pD = &(*this)(dst_x, dst_y);
-
- const uint bytes_to_copy = src_w * sizeof(color_type);
- for (uint i = src_h; i; i--)
- {
- memcpy(pD, pS, bytes_to_copy);
-
- pS += src.get_pitch();
- pD += get_pitch();
- }
-
- return true;
- }
-
- // With clipping.
- bool blit(int dst_x, int dst_y, const image& src)
- {
- if ((!is_valid()) || (!src.is_valid()))
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- int src_x = 0;
- int src_y = 0;
-
- if (dst_x < 0)
- {
- src_x = -dst_x;
- if (src_x >= static_cast<int>(src.get_width()))
- return false;
- dst_x = 0;
- }
-
- if (dst_y < 0)
- {
- src_y = -dst_y;
- if (src_y >= static_cast<int>(src.get_height()))
- return false;
- dst_y = 0;
- }
-
- if ((dst_x >= (int)m_width) || (dst_y >= (int)m_height))
- return false;
-
- uint width = math::minimum(m_width - dst_x, src.get_width() - src_x);
- uint height = math::minimum(m_height - dst_y, src.get_height() - src_y);
-
- bool success = unclipped_blit(src_x, src_y, width, height, dst_x, dst_y, src);
- success;
- CRNLIB_ASSERT(success);
-
- return true;
- }
-
- // With clipping.
- bool blit(int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, const image& src)
- {
- if ((!is_valid()) || (!src.is_valid()))
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- rect src_rect(src_x, src_y, src_x + src_w, src_y + src_h);
- if (!src_rect.intersect(src.get_bounds()))
- return false;
-
- rect dst_rect(dst_x, dst_y, dst_x + src_rect.get_width(), dst_y + src_rect.get_height());
- if (!dst_rect.intersect(get_bounds()))
- return false;
-
- bool success = unclipped_blit(
- src_rect.get_left(), src_rect.get_top(),
- math::minimum(src_rect.get_width(), dst_rect.get_width()), math::minimum(src_rect.get_height(), dst_rect.get_height()),
- dst_rect.get_left(), dst_rect.get_top(), src);
- success;
- CRNLIB_ASSERT(success);
-
- return true;
- }
-
- // In-place resize of image dimensions (cropping).
- bool resize(uint new_width, uint new_height, uint new_pitch = UINT_MAX, const color_type background = color_type::make_black())
- {
- if (new_pitch == UINT_MAX)
- new_pitch = new_width;
-
- if ((new_width == m_width) && (new_height == m_height) && (new_pitch == m_pitch))
- return true;
-
- if ((!new_width) || (!new_height) || (!new_pitch))
- {
- clear();
- return false;
- }
-
- pixel_buf_t existing_pixels;
- existing_pixels.swap(m_pixel_buf);
-
- if (!m_pixel_buf.try_resize(new_height * new_pitch))
- {
- clear();
- return false;
- }
-
- for (uint y = 0; y < new_height; y++)
- {
- for (uint x = 0; x < new_width; x++)
- {
- if ((x < m_width) && (y < m_height))
- m_pixel_buf[x + y * new_pitch] = existing_pixels[x + y * m_pitch];
- else
- m_pixel_buf[x + y * new_pitch] = background;
- }
- }
-
- m_width = new_width;
- m_height = new_height;
- m_pitch = new_pitch;
- m_total = new_pitch * new_height;
- m_pPixels = &m_pixel_buf.front();
-
- return true;
- }
-
- inline uint get_width() const { return m_width; }
- inline uint get_height() const { return m_height; }
- inline uint get_total_pixels() const { return m_width * m_height; }
-
- inline rect get_bounds() const { return rect(0, 0, m_width, m_height); }
-
- inline uint get_pitch() const { return m_pitch; }
- inline uint get_pitch_in_bytes() const { return m_pitch * sizeof(color_type); }
-
- // Returns pitch * height, NOT width * height!
- inline uint get_total() const { return m_total; }
-
- inline uint get_block_width(uint block_size) const { return (m_width + block_size - 1) / block_size; }
- inline uint get_block_height(uint block_size) const { return (m_height + block_size - 1) / block_size; }
- inline uint get_total_blocks(uint block_size) const { return get_block_width(block_size) * get_block_height(block_size); }
-
- inline uint get_size_in_bytes() const { return sizeof(color_type) * m_total; }
-
- inline const color_type* get_pixels() const { return m_pPixels; }
- inline color_type* get_pixels() { return m_pPixels; }
-
- inline const color_type& operator() (uint x, uint y) const
- {
- CRNLIB_ASSERT((x < m_width) && (y < m_height));
- return m_pPixels[x + y * m_pitch];
- }
-
- inline color_type& operator() (uint x, uint y)
- {
- CRNLIB_ASSERT((x < m_width) && (y < m_height));
- return m_pPixels[x + y * m_pitch];
- }
-
- inline const color_type& get_unclamped(uint x, uint y) const
- {
- CRNLIB_ASSERT((x < m_width) && (y < m_height));
- return m_pPixels[x + y * m_pitch];
- }
-
- inline const color_type& get_clamped(int x, int y) const
- {
- x = math::clamp<int>(x, 0, m_width - 1);
- y = math::clamp<int>(y, 0, m_height - 1);
- return m_pPixels[x + y * m_pitch];
- }
-
- // Sample image with bilinear filtering.
- // (x,y) - Continuous coordinates, where pixel centers are at (.5,.5), valid image coords are [0,width] and [0,height].
- void get_filtered(float x, float y, color_type& result) const
- {
- x -= .5f;
- y -= .5f;
-
- int ix = (int)floor(x);
- int iy = (int)floor(y);
- float wx = x - ix;
- float wy = y - iy;
-
- color_type a(get_clamped(ix, iy));
- color_type b(get_clamped(ix + 1, iy));
- color_type c(get_clamped(ix, iy + 1));
- color_type d(get_clamped(ix + 1, iy + 1));
-
- for (uint i = 0; i < 4; i++)
- {
- double top = math::lerp<double>(a[i], b[i], wx);
- double bot = math::lerp<double>(c[i], d[i], wx);
- double m = math::lerp<double>(top, bot, wy);
-
- if (!color_type::component_traits::cFloat)
- m += .5f;
-
- result.set_component(i, static_cast< typename color_type::parameter_t >(m));
- }
- }
-
- void get_filtered(float x, float y, vec4F& result) const
- {
- x -= .5f;
- y -= .5f;
-
- int ix = (int)floor(x);
- int iy = (int)floor(y);
- float wx = x - ix;
- float wy = y - iy;
-
- color_type a(get_clamped(ix, iy));
- color_type b(get_clamped(ix + 1, iy));
- color_type c(get_clamped(ix, iy + 1));
- color_type d(get_clamped(ix + 1, iy + 1));
-
- for (uint i = 0; i < 4; i++)
- {
- float top = math::lerp<float>(a[i], b[i], wx);
- float bot = math::lerp<float>(c[i], d[i], wx);
- float m = math::lerp<float>(top, bot, wy);
-
- result[i] = m;
- }
- }
-
- inline void set_pixel_unclipped(uint x, uint y, const color_type& c)
- {
- CRNLIB_ASSERT((x < m_width) && (y < m_height));
- m_pPixels[x + y * m_pitch] = c;
- }
-
- inline void set_pixel_clipped(int x, int y, const color_type& c)
- {
- if ((static_cast<uint>(x) >= m_width) || (static_cast<uint>(y) >= m_height))
- return;
-
- m_pPixels[x + y * m_pitch] = c;
- }
-
- inline const color_type* get_scanline(uint y) const
- {
- CRNLIB_ASSERT(y < m_height);
- return &m_pPixels[y * m_pitch];
- }
-
- inline color_type* get_scanline(uint y)
- {
- CRNLIB_ASSERT(y < m_height);
- return &m_pPixels[y * m_pitch];
- }
-
- inline const color_type* get_ptr() const
- {
- return m_pPixels;
- }
-
- inline color_type* get_ptr()
- {
- return m_pPixels;
- }
-
- inline void swap(image& other)
- {
- utils::swap(m_width, other.m_width);
- utils::swap(m_height, other.m_height);
- utils::swap(m_pitch, other.m_pitch);
- utils::swap(m_total, other.m_total);
- utils::swap(m_comp_flags, other.m_comp_flags);
- utils::swap(m_pPixels, other.m_pPixels);
- m_pixel_buf.swap(other.m_pixel_buf);
- }
-
- void draw_line(int xs, int ys, int xe, int ye, const color_type& color)
- {
- if (xs > xe)
- {
- utils::swap(xs, xe);
- utils::swap(ys, ye);
- }
-
- int dx = xe - xs, dy = ye - ys;
- if (!dx)
- {
- if (ys > ye)
- utils::swap(ys, ye);
- for (int i = ys ; i <= ye ; i++)
- set_pixel_clipped(xs, i, color);
- }
- else if (!dy)
- {
- for (int i = xs ; i < xe ; i++)
- set_pixel_clipped(i, ys, color);
- }
- else if (dy > 0)
- {
- if (dy <= dx)
- {
- int e = 2 * dy - dx, e_no_inc = 2 * dy, e_inc = 2 * (dy - dx);
- rasterize_line(xs, ys, xe, ye, 0, 1, e, e_inc, e_no_inc, color);
- }
- else
- {
- int e = 2 * dx - dy, e_no_inc = 2 * dx, e_inc = 2 * (dx - dy);
- rasterize_line(xs, ys, xe, ye, 1, 1, e, e_inc, e_no_inc, color);
- }
- }
- else
- {
- dy = -dy;
- if (dy <= dx)
- {
- int e = 2 * dy - dx, e_no_inc = 2 * dy, e_inc = 2 * (dy - dx);
- rasterize_line(xs, ys, xe, ye, 0, -1, e, e_inc, e_no_inc, color);
- }
- else
- {
- int e = 2 * dx - dy, e_no_inc = (2 * dx), e_inc = 2 * (dx - dy);
- rasterize_line(xe, ye, xs, ys, 1, -1, e, e_inc, e_no_inc, color);
- }
- }
- }
-
- const pixel_buf_t& get_pixel_buf() const { return m_pixel_buf; }
- pixel_buf_t& get_pixel_buf() { return m_pixel_buf; }
-
- private:
- uint m_width;
- uint m_height;
- uint m_pitch;
- uint m_total;
- uint m_comp_flags;
-
- color_type* m_pPixels;
-
- pixel_buf_t m_pixel_buf;
-
- void rasterize_line(int xs, int ys, int xe, int ye, int pred, int inc_dec, int e, int e_inc, int e_no_inc, const color_type& color)
- {
- int start, end, var;
-
- if (pred)
- {
- start = ys; end = ye; var = xs;
- for (int i = start; i <= end; i++)
- {
- set_pixel_clipped(var, i, color);
- if (e < 0)
- e += e_no_inc;
- else
- {
- var += inc_dec;
- e += e_inc;
- }
- }
- }
- else
- {
- start = xs; end = xe; var = ys;
- for (int i = start; i <= end; i++)
- {
- set_pixel_clipped(i, var, color);
- if (e < 0)
- e += e_no_inc;
- else
- {
- var += inc_dec;
- e += e_inc;
- }
- }
- }
- }
- };
-
- typedef image<color_quad_u8> image_u8;
- typedef image<color_quad_i16> image_i16;
- typedef image<color_quad_u16> image_u16;
- typedef image<color_quad_i32> image_i32;
- typedef image<color_quad_u32> image_u32;
- typedef image<color_quad_f> image_f;
-
- template<typename color_type>
- inline void swap(image<color_type>& a, image<color_type>& b)
- {
- a.swap(b);
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_image_utils.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_image_utils.cpp
deleted file mode 100644
index 0ffac1fe..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_image_utils.cpp
+++ /dev/null
@@ -1,1367 +0,0 @@
-// File: crn_image_utils.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_image_utils.h"
-#include "crn_console.h"
-#include "crn_resampler.h"
-#include "crn_threaded_resampler.h"
-#include "crn_strutils.h"
-#include "crn_file_utils.h"
-#include "crn_threading.h"
-#include "crn_miniz.h"
-#include "crn_jpge.h"
-#include "crn_cfile_stream.h"
-#include "crn_mipmapped_texture.h"
-#include "crn_buffer_stream.h"
-
-#define STBI_HEADER_FILE_ONLY
-#include "crn_stb_image.cpp"
-
-#include "crn_jpgd.h"
-
-#include "crn_pixel_format.h"
-
-namespace crnlib
-{
- const float cInfinitePSNR = 999999.0f;
- const uint CRNLIB_LARGEST_SUPPORTED_IMAGE_DIMENSION = 16384;
-
- namespace image_utils
- {
- bool read_from_stream_stb(data_stream_serializer &serializer, image_u8& img)
- {
- uint8_vec buf;
- if (!serializer.read_entire_file(buf))
- return false;
-
- int x = 0, y = 0, n = 0;
- unsigned char* pData = stbi_load_from_memory(buf.get_ptr(), buf.size_in_bytes(), &x, &y, &n, 4);
-
- if (!pData)
- return false;
-
- if ((x > (int)CRNLIB_LARGEST_SUPPORTED_IMAGE_DIMENSION) || (y > (int)CRNLIB_LARGEST_SUPPORTED_IMAGE_DIMENSION))
- {
- stbi_image_free(pData);
- return false;
- }
-
- const bool has_alpha = ((n == 2) || (n == 4));
-
- img.resize(x, y);
-
- bool grayscale = true;
-
- for (int py = 0; py < y; py++)
- {
- const color_quad_u8* pSrc = reinterpret_cast<const color_quad_u8*>(pData) + (py * x);
- color_quad_u8* pDst = img.get_scanline(py);
- color_quad_u8* pDst_end = pDst + x;
-
- while (pDst != pDst_end)
- {
- color_quad_u8 c(*pSrc++);
- if (!has_alpha)
- c.a = 255;
-
- if (!c.is_grayscale())
- grayscale = false;
-
- *pDst++ = c;
- }
- }
-
- stbi_image_free(pData);
-
- img.reset_comp_flags();
- img.set_grayscale(grayscale);
- img.set_component_valid(3, has_alpha);
-
- return true;
- }
-
- bool read_from_stream_jpgd(data_stream_serializer &serializer, image_u8& img)
- {
- uint8_vec buf;
- if (!serializer.read_entire_file(buf))
- return false;
-
- int width = 0, height = 0, actual_comps = 0;
- unsigned char *pSrc_img = jpgd::decompress_jpeg_image_from_memory(buf.get_ptr(), buf.size_in_bytes(), &width, &height, &actual_comps, 4);
- if (!pSrc_img)
- return false;
-
- if (math::maximum(width, height) > (int)CRNLIB_LARGEST_SUPPORTED_IMAGE_DIMENSION)
- {
- crnlib_free(pSrc_img);
- return false;
- }
-
- if (!img.grant_ownership(reinterpret_cast<color_quad_u8*>(pSrc_img), width, height))
- {
- crnlib_free(pSrc_img);
- return false;
- }
-
- img.reset_comp_flags();
- img.set_grayscale(actual_comps == 1);
- img.set_component_valid(3, false);
-
- return true;
- }
-
- bool read_from_stream(image_u8& dest, data_stream_serializer& serializer, uint read_flags)
- {
- if (read_flags > cReadFlagsAllFlags)
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- if (!serializer.get_stream())
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- dynamic_string ext(serializer.get_name());
- file_utils::get_extension(ext);
-
- if ((ext == "jpg") || (ext == "jpeg"))
- {
- // Use my jpeg decoder by default because it supports progressive jpeg's.
- if ((read_flags & cReadFlagForceSTB) == 0)
- {
- return image_utils::read_from_stream_jpgd(serializer, dest);
- }
- }
-
- return image_utils::read_from_stream_stb(serializer, dest);
- }
-
- bool read_from_file(image_u8& dest, const char* pFilename, uint read_flags)
- {
- if (read_flags > cReadFlagsAllFlags)
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- cfile_stream file_stream;
- if (!file_stream.open(pFilename))
- return false;
-
- data_stream_serializer serializer(file_stream);
- return read_from_stream(dest, serializer, read_flags);
- }
-
- bool write_to_file(const char* pFilename, const image_u8& img, uint write_flags, int grayscale_comp_index)
- {
- if ((grayscale_comp_index < -1) || (grayscale_comp_index > 3))
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- if (!img.get_width())
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- dynamic_string ext(pFilename);
- bool is_jpeg = false;
- if (file_utils::get_extension(ext))
- {
- is_jpeg = ((ext == "jpg") || (ext == "jpeg"));
-
- if ((ext != "png") && (ext != "bmp") && (ext != "tga") && (!is_jpeg))
- {
- console::error("crnlib::image_utils::write_to_file: Can only write .BMP, .TGA, .PNG, or .JPG files!\n");
- return false;
- }
- }
-
- crnlib::vector<uint8> temp;
- uint num_src_chans = 0;
- const void *pSrc_img = NULL;
-
- if (is_jpeg)
- {
- write_flags |= cWriteFlagIgnoreAlpha;
- }
-
- if ((img.get_comp_flags() & pixel_format_helpers::cCompFlagGrayscale) || (write_flags & image_utils::cWriteFlagGrayscale))
- {
- CRNLIB_ASSERT(grayscale_comp_index < 4);
- if (grayscale_comp_index > 3) grayscale_comp_index = 3;
-
- temp.resize(img.get_total_pixels());
-
- for (uint y = 0; y < img.get_height(); y++)
- {
- const color_quad_u8* pSrc = img.get_scanline(y);
- const color_quad_u8* pSrc_end = pSrc + img.get_width();
- uint8* pDst = &temp[y * img.get_width()];
-
- if (img.get_comp_flags() & pixel_format_helpers::cCompFlagGrayscale)
- {
- while (pSrc != pSrc_end)
- *pDst++ = (*pSrc++)[1];
- }
- else if (grayscale_comp_index < 0)
- {
- while (pSrc != pSrc_end)
- *pDst++ = static_cast<uint8>((*pSrc++).get_luma());
- }
- else
- {
- while (pSrc != pSrc_end)
- *pDst++ = (*pSrc++)[grayscale_comp_index];
- }
- }
-
- pSrc_img = &temp[0];
- num_src_chans = 1;
- }
- else if ((!img.is_component_valid(3)) || (write_flags & cWriteFlagIgnoreAlpha))
- {
- temp.resize(img.get_total_pixels() * 3);
-
- for (uint y = 0; y < img.get_height(); y++)
- {
- const color_quad_u8* pSrc = img.get_scanline(y);
- const color_quad_u8* pSrc_end = pSrc + img.get_width();
- uint8* pDst = &temp[y * img.get_width() * 3];
-
- while (pSrc != pSrc_end)
- {
- const color_quad_u8 c(*pSrc++);
-
- pDst[0] = c.r;
- pDst[1] = c.g;
- pDst[2] = c.b;
-
- pDst += 3;
- }
- }
-
- num_src_chans = 3;
- pSrc_img = &temp[0];
- }
- else
- {
- num_src_chans = 4;
- pSrc_img = img.get_ptr();
- }
-
- bool success = false;
- if (ext == "png")
- {
- size_t png_image_size = 0;
- void *pPNG_image_data = tdefl_write_image_to_png_file_in_memory(pSrc_img, img.get_width(), img.get_height(), num_src_chans, &png_image_size);
- if (!pPNG_image_data)
- return false;
- success = file_utils::write_buf_to_file(pFilename, pPNG_image_data, png_image_size);
- mz_free(pPNG_image_data);
- }
- else if (is_jpeg)
- {
- jpge::params params;
- if (write_flags & cWriteFlagJPEGQualityLevelMask)
- params.m_quality = math::clamp<uint>((write_flags & cWriteFlagJPEGQualityLevelMask) >> cWriteFlagJPEGQualityLevelShift, 1U, 100U);
- params.m_two_pass_flag = (write_flags & cWriteFlagJPEGTwoPass) != 0;
- params.m_no_chroma_discrim_flag = (write_flags & cWriteFlagJPEGNoChromaDiscrim) != 0;
-
- if (write_flags & cWriteFlagJPEGH1V1)
- params.m_subsampling = jpge::H1V1;
- else if (write_flags & cWriteFlagJPEGH2V1)
- params.m_subsampling = jpge::H2V1;
- else if (write_flags & cWriteFlagJPEGH2V2)
- params.m_subsampling = jpge::H2V2;
-
- success = jpge::compress_image_to_jpeg_file(pFilename, img.get_width(), img.get_height(), num_src_chans, (const jpge::uint8*)pSrc_img, params);
- }
- else
- {
- success = ((ext == "bmp" ? stbi_write_bmp : stbi_write_tga)(pFilename, img.get_width(), img.get_height(), num_src_chans, pSrc_img) == CRNLIB_TRUE);
- }
- return success;
- }
-
- bool has_alpha(const image_u8& img)
- {
- for (uint y = 0; y < img.get_height(); y++)
- for (uint x = 0; x < img.get_width(); x++)
- if (img(x, y).a < 255)
- return true;
-
- return false;
- }
-
- void renorm_normal_map(image_u8& img)
- {
- for (uint y = 0; y < img.get_height(); y++)
- {
- for (uint x = 0; x < img.get_width(); x++)
- {
- color_quad_u8& c = img(x, y);
- if ((c.r == 128) && (c.g == 128) && (c.b == 128))
- continue;
-
- vec3F v(c.r, c.g, c.b);
- v *= 1.0f/255.0f;
- v *= 2.0f;
- v -= vec3F(1.0f);
- v.clamp(-1.0f, 1.0f);
-
- float length = v.length();
- if (length < .077f)
- c.set(128, 128, 128, c.a);
- else if (fabs(length - 1.0f) > .077f)
- {
- if (length)
- v /= length;
-
- for (uint i = 0; i < 3; i++)
- c[i] = static_cast<uint8>(math::clamp<float>(floor((v[i] + 1.0f) * .5f * 255.0f + .5f), 0.0f, 255.0f));
-
- if ((c.r == 128) && (c.g == 128))
- {
- if (c.b < 128)
- c.b = 0;
- else
- c.b = 255;
- }
- }
- }
- }
- }
-
- bool is_normal_map(const image_u8& img, const char* pFilename)
- {
- float score = 0.0f;
-
- uint num_invalid_pixels = 0;
-
- // TODO: Derive better score from pixel mean, eigenvecs/vals
- //crnlib::vector<vec3F> pixels;
-
- for (uint y = 0; y < img.get_height(); y++)
- {
- for (uint x = 0; x < img.get_width(); x++)
- {
- const color_quad_u8& c = img(x, y);
-
- if (c.b < 123)
- {
- num_invalid_pixels++;
- continue;
- }
- else if ((c.r != 128) || (c.g != 128) || (c.b != 128))
- {
- vec3F v(c.r, c.g, c.b);
- v -= vec3F(128.0f);
- v /= vec3F(127.0f);
- //pixels.push_back(v);
- v.clamp(-1.0f, 1.0f);
-
- float norm = v.norm();
- if ((norm < 0.83f) || (norm > 1.29f))
- num_invalid_pixels++;
- }
- }
- }
-
- score -= math::clamp(float(num_invalid_pixels) / (img.get_width() * img.get_height()) - .026f, 0.0f, 1.0f) * 5.0f;
-
- if (pFilename)
- {
- dynamic_string str(pFilename);
- str.tolower();
-
- if (str.contains("normal") || str.contains("local") || str.contains("nmap"))
- score += 1.0f;
-
- if (str.contains("diffuse") || str.contains("spec") || str.contains("gloss"))
- score -= 1.0f;
- }
-
- return score >= 0.0f;
- }
-
- bool resample_single_thread(const image_u8& src, image_u8& dst, const resample_params& params)
- {
- const uint src_width = src.get_width();
- const uint src_height = src.get_height();
-
- if (math::maximum(src_width, src_height) > CRNLIB_RESAMPLER_MAX_DIMENSION)
- {
- printf("Image is too large!\n");
- return EXIT_FAILURE;
- }
-
- const int cMaxComponents = 4;
- if (((int)params.m_num_comps < 1) || ((int)params.m_num_comps > (int)cMaxComponents))
- return false;
-
- const uint dst_width = params.m_dst_width;
- const uint dst_height = params.m_dst_height;
-
- if ((math::minimum(dst_width, dst_height) < 1) || (math::maximum(dst_width, dst_height) > CRNLIB_RESAMPLER_MAX_DIMENSION))
- {
- printf("Image is too large!\n");
- return EXIT_FAILURE;
- }
-
- if ((src_width == dst_width) && (src_height == dst_height))
- {
- dst = src;
- return true;
- }
-
- dst.clear();
- dst.resize(params.m_dst_width, params.m_dst_height);
-
- // Partial gamma correction looks better on mips. Set to 1.0 to disable gamma correction.
- const float source_gamma = params.m_source_gamma;//1.75f;
-
- float srgb_to_linear[256];
- if (params.m_srgb)
- {
- for (int i = 0; i < 256; ++i)
- srgb_to_linear[i] = (float)pow(i * 1.0f/255.0f, source_gamma);
- }
-
- const int linear_to_srgb_table_size = 8192;
- unsigned char linear_to_srgb[linear_to_srgb_table_size];
-
- const float inv_linear_to_srgb_table_size = 1.0f / linear_to_srgb_table_size;
- const float inv_source_gamma = 1.0f / source_gamma;
-
- if (params.m_srgb)
- {
- for (int i = 0; i < linear_to_srgb_table_size; ++i)
- {
- int k = (int)(255.0f * pow(i * inv_linear_to_srgb_table_size, inv_source_gamma) + .5f);
- if (k < 0) k = 0; else if (k > 255) k = 255;
- linear_to_srgb[i] = (unsigned char)k;
- }
- }
-
- Resampler* resamplers[cMaxComponents];
- crnlib::vector<float> samples[cMaxComponents];
-
- resamplers[0] = crnlib_new<Resampler>(src_width, src_height, dst_width, dst_height,
- params.m_wrapping ? Resampler::BOUNDARY_WRAP : Resampler::BOUNDARY_CLAMP, 0.0f, 1.0f,
- params.m_pFilter, (Resampler::Contrib_List*)NULL, (Resampler::Contrib_List*)NULL, params.m_filter_scale, params.m_filter_scale);
- samples[0].resize(src_width);
-
- for (uint i = 1; i < params.m_num_comps; i++)
- {
- resamplers[i] = crnlib_new<Resampler>(src_width, src_height, dst_width, dst_height,
- params.m_wrapping ? Resampler::BOUNDARY_WRAP : Resampler::BOUNDARY_CLAMP, 0.0f, 1.0f,
- params.m_pFilter, resamplers[0]->get_clist_x(), resamplers[0]->get_clist_y(), params.m_filter_scale, params.m_filter_scale);
- samples[i].resize(src_width);
- }
-
- uint dst_y = 0;
-
- for (uint src_y = 0; src_y < src_height; src_y++)
- {
- const color_quad_u8* pSrc = src.get_scanline(src_y);
-
- for (uint x = 0; x < src_width; x++)
- {
- for (uint c = 0; c < params.m_num_comps; c++)
- {
- const uint comp_index = params.m_first_comp + c;
- const uint8 v = (*pSrc)[comp_index];
-
- if (!params.m_srgb || (comp_index == 3))
- samples[c][x] = v * (1.0f/255.0f);
- else
- samples[c][x] = srgb_to_linear[v];
- }
-
- pSrc++;
- }
-
- for (uint c = 0; c < params.m_num_comps; c++)
- {
- if (!resamplers[c]->put_line(&samples[c][0]))
- {
- for (uint i = 0; i < params.m_num_comps; i++)
- crnlib_delete(resamplers[i]);
- return false;
- }
- }
-
- for ( ; ; )
- {
- uint c;
- for (c = 0; c < params.m_num_comps; c++)
- {
- const uint comp_index = params.m_first_comp + c;
-
- const float* pOutput_samples = resamplers[c]->get_line();
- if (!pOutput_samples)
- break;
-
- const bool linear = !params.m_srgb || (comp_index == 3);
- CRNLIB_ASSERT(dst_y < dst_height);
- color_quad_u8* pDst = dst.get_scanline(dst_y);
-
- for (uint x = 0; x < dst_width; x++)
- {
- if (linear)
- {
- int c = (int)(255.0f * pOutput_samples[x] + .5f);
- if (c < 0) c = 0; else if (c > 255) c = 255;
- (*pDst)[comp_index] = (unsigned char)c;
- }
- else
- {
- int j = (int)(linear_to_srgb_table_size * pOutput_samples[x] + .5f);
- if (j < 0) j = 0; else if (j >= linear_to_srgb_table_size) j = linear_to_srgb_table_size - 1;
- (*pDst)[comp_index] = linear_to_srgb[j];
- }
-
- pDst++;
- }
- }
- if (c < params.m_num_comps)
- break;
-
- dst_y++;
- }
- }
-
- for (uint i = 0; i < params.m_num_comps; i++)
- crnlib_delete(resamplers[i]);
-
- return true;
- }
-
- bool resample_multithreaded(const image_u8& src, image_u8& dst, const resample_params& params)
- {
- const uint src_width = src.get_width();
- const uint src_height = src.get_height();
-
- if (math::maximum(src_width, src_height) > CRNLIB_RESAMPLER_MAX_DIMENSION)
- {
- printf("Image is too large!\n");
- return EXIT_FAILURE;
- }
-
- const int cMaxComponents = 4;
- if (((int)params.m_num_comps < 1) || ((int)params.m_num_comps > (int)cMaxComponents))
- return false;
-
- const uint dst_width = params.m_dst_width;
- const uint dst_height = params.m_dst_height;
-
- if ((math::minimum(dst_width, dst_height) < 1) || (math::maximum(dst_width, dst_height) > CRNLIB_RESAMPLER_MAX_DIMENSION))
- {
- printf("Image is too large!\n");
- return EXIT_FAILURE;
- }
-
- if ((src_width == dst_width) && (src_height == dst_height))
- {
- dst = src;
- return true;
- }
-
- dst.clear();
-
- // Partial gamma correction looks better on mips. Set to 1.0 to disable gamma correction.
- const float source_gamma = params.m_source_gamma;//1.75f;
-
- float srgb_to_linear[256];
- if (params.m_srgb)
- {
- for (int i = 0; i < 256; ++i)
- srgb_to_linear[i] = (float)pow(i * 1.0f/255.0f, source_gamma);
- }
-
- const int linear_to_srgb_table_size = 8192;
- unsigned char linear_to_srgb[linear_to_srgb_table_size];
-
- const float inv_linear_to_srgb_table_size = 1.0f / linear_to_srgb_table_size;
- const float inv_source_gamma = 1.0f / source_gamma;
-
- if (params.m_srgb)
- {
- for (int i = 0; i < linear_to_srgb_table_size; ++i)
- {
- int k = (int)(255.0f * pow(i * inv_linear_to_srgb_table_size, inv_source_gamma) + .5f);
- if (k < 0) k = 0; else if (k > 255) k = 255;
- linear_to_srgb[i] = (unsigned char)k;
- }
- }
-
- task_pool tp;
- tp.init(g_number_of_processors - 1);
-
- threaded_resampler resampler(tp);
- threaded_resampler::params p;
- p.m_src_width = src_width;
- p.m_src_height = src_height;
- p.m_dst_width = dst_width;
- p.m_dst_height = dst_height;
- p.m_sample_low = 0.0f;
- p.m_sample_high = 1.0f;
- p.m_boundary_op = params.m_wrapping ? Resampler::BOUNDARY_WRAP : Resampler::BOUNDARY_CLAMP;
- p.m_Pfilter_name = params.m_pFilter;
- p.m_filter_x_scale = params.m_filter_scale;
- p.m_filter_y_scale = params.m_filter_scale;
-
- uint resampler_comps = 4;
- if (params.m_num_comps == 1)
- {
- p.m_fmt = threaded_resampler::cPF_Y_F32;
- resampler_comps = 1;
- }
- else if (params.m_num_comps <= 3)
- p.m_fmt = threaded_resampler::cPF_RGBX_F32;
- else
- p.m_fmt = threaded_resampler::cPF_RGBA_F32;
-
- crnlib::vector<float> src_samples;
- crnlib::vector<float> dst_samples;
-
- if (!src_samples.try_resize(src_width * src_height * resampler_comps))
- return false;
-
- if (!dst_samples.try_resize(dst_width * dst_height * resampler_comps))
- return false;
-
- p.m_pSrc_pixels = src_samples.get_ptr();
- p.m_src_pitch = src_width * resampler_comps * sizeof(float);
- p.m_pDst_pixels = dst_samples.get_ptr();
- p.m_dst_pitch = dst_width * resampler_comps * sizeof(float);
-
- for (uint src_y = 0; src_y < src_height; src_y++)
- {
- const color_quad_u8* pSrc = src.get_scanline(src_y);
- float* pDst = src_samples.get_ptr() + src_width * resampler_comps * src_y;
-
- for (uint x = 0; x < src_width; x++)
- {
- for (uint c = 0; c < params.m_num_comps; c++)
- {
- const uint comp_index = params.m_first_comp + c;
- const uint8 v = (*pSrc)[comp_index];
-
- if (!params.m_srgb || (comp_index == 3))
- pDst[c] = v * (1.0f/255.0f);
- else
- pDst[c] = srgb_to_linear[v];
- }
-
- pSrc++;
- pDst += resampler_comps;
- }
- }
-
- if (!resampler.resample(p))
- return false;
-
- src_samples.clear();
-
- if (!dst.resize(params.m_dst_width, params.m_dst_height))
- return false;
-
- for (uint dst_y = 0; dst_y < dst_height; dst_y++)
- {
- const float* pSrc = dst_samples.get_ptr() + dst_width * resampler_comps * dst_y;
- color_quad_u8* pDst = dst.get_scanline(dst_y);
-
- for (uint x = 0; x < dst_width; x++)
- {
- color_quad_u8 dst(0, 0, 0, 255);
-
- for (uint c = 0; c < params.m_num_comps; c++)
- {
- const uint comp_index = params.m_first_comp + c;
- const float v = pSrc[c];
-
- if ((!params.m_srgb) || (comp_index == 3))
- {
- int c = static_cast<int>(255.0f * v + .5f);
- if (c < 0) c = 0; else if (c > 255) c = 255;
- dst[comp_index] = (unsigned char)c;
- }
- else
- {
- int j = static_cast<int>(linear_to_srgb_table_size * v + .5f);
- if (j < 0) j = 0; else if (j >= linear_to_srgb_table_size) j = linear_to_srgb_table_size - 1;
- dst[comp_index] = linear_to_srgb[j];
- }
- }
-
- *pDst++ = dst;
-
- pSrc += resampler_comps;
- }
- }
-
- return true;
- }
-
- bool resample(const image_u8& src, image_u8& dst, const resample_params& params)
- {
- if ((params.m_multithreaded) && (g_number_of_processors > 1))
- return resample_multithreaded(src, dst, params);
- else
- return resample_single_thread(src, dst, params);
- }
-
- bool compute_delta(image_u8& dest, image_u8& a, image_u8& b, uint scale)
- {
- if ( (a.get_width() != b.get_width()) || (a.get_height() != b.get_height()) )
- return false;
-
- dest.resize(a.get_width(), b.get_height());
-
- for (uint y = 0; y < a.get_height(); y++)
- {
- for (uint x = 0; x < a.get_width(); x++)
- {
- const color_quad_u8& ca = a(x, y);
- const color_quad_u8& cb = b(x, y);
-
- color_quad_u8 cd;
- for (uint c = 0; c < 4; c++)
- {
- int d = (ca[c] - cb[c]) * scale + 128;
- d = math::clamp(d, 0, 255);
- cd[c] = static_cast<uint8>(d);
- }
-
- dest(x, y) = cd;
- }
- }
-
- return true;
- }
-
- // FIXME: Totally hack-ass computation.
- // Perhaps port http://www.lomont.org/Software/Misc/SSIM/SSIM.html?
- double compute_block_ssim(uint t, const uint8* pX, const uint8* pY)
- {
- double ave_x = 0.0f;
- double ave_y = 0.0f;
- for (uint i = 0; i < t; i++)
- {
- ave_x += pX[i];
- ave_y += pY[i];
- }
-
- ave_x /= t;
- ave_y /= t;
-
- double var_x = 0.0f;
- double var_y = 0.0f;
- for (uint i = 0; i < t; i++)
- {
- var_x += math::square(pX[i] - ave_x);
- var_y += math::square(pY[i] - ave_y);
- }
-
- var_x = sqrt(var_x / (t - 1));
- var_y = sqrt(var_y / (t - 1));
-
- double covar_xy = 0.0f;
- for (uint i = 0; i < t; i++)
- covar_xy += (pX[i] - ave_x) * (pY[i] - ave_y);
-
- covar_xy /= (t - 1);
-
- const double c1 = 6.5025; //(255*.01)^2
- const double c2 = 58.5225; //(255*.03)^2
-
- double n = (2.0f * ave_x * ave_y + c1) * (2.0f * covar_xy + c2);
- double d = (ave_x * ave_x + ave_y * ave_y + c1) * (var_x * var_x + var_y * var_y + c2);
-
- return n / d;
- }
-
- double compute_ssim(const image_u8& a, const image_u8& b, int channel_index)
- {
- const uint N = 6;
- uint8 sx[N*N], sy[N*N];
-
- double total_ssim = 0.0f;
- uint total_blocks = 0;
-
- //image_u8 yimg((a.get_width() + N - 1) / N, (a.get_height() + N - 1) / N);
-
- for (uint y = 0; y < a.get_height(); y += N)
- {
- for (uint x = 0; x < a.get_width(); x += N)
- {
- for (uint iy = 0; iy < N; iy++)
- {
- for (uint ix = 0; ix < N; ix++)
- {
- if (channel_index < 0)
- sx[ix+iy*N] = (uint8)a.get_clamped(x+ix, y+iy).get_luma();
- else
- sx[ix+iy*N] = (uint8)a.get_clamped(x+ix, y+iy)[channel_index];
-
- if (channel_index < 0)
- sy[ix+iy*N] = (uint8)b.get_clamped(x+ix, y+iy).get_luma();
- else
- sy[ix+iy*N] = (uint8)b.get_clamped(x+ix, y+iy)[channel_index];
- }
- }
-
- double ssim = compute_block_ssim(N*N, sx, sy);
- total_ssim += ssim;
- total_blocks++;
-
- //uint ssim_c = (uint)math::clamp<double>(ssim * 127.0f + 128.0f, 0, 255);
- //yimg(x / N, y / N).set(ssim_c, ssim_c, ssim_c, 255);
- }
- }
-
- if (!total_blocks)
- return 0.0f;
-
- //save_to_file_stb_or_miniz("ssim.tga", yimg, cWriteFlagGrayscale);
-
- return total_ssim / total_blocks;
- }
-
- void print_ssim(const image_u8& src_img, const image_u8& dst_img)
- {
- src_img;
- dst_img;
- //double y_ssim = compute_ssim(src_img, dst_img, -1);
- //console::printf("Luma MSSIM: %f, Scaled: %f", y_ssim, (y_ssim - .8f) / .2f);
-
- //double r_ssim = compute_ssim(src_img, dst_img, 0);
- //console::printf(" R MSSIM: %f", r_ssim);
-
- //double g_ssim = compute_ssim(src_img, dst_img, 1);
- //console::printf(" G MSSIM: %f", g_ssim);
-
- //double b_ssim = compute_ssim(src_img, dst_img, 2);
- //console::printf(" B MSSIM: %f", b_ssim);
- }
-
- void error_metrics::print(const char* pName) const
- {
- if (mPeakSNR >= cInfinitePSNR)
- console::printf("%s Error: Max: %3u, Mean: %3.3f, MSE: %3.3f, RMSE: %3.3f, PSNR: Infinite", pName, mMax, mMean, mMeanSquared, mRootMeanSquared);
- else
- console::printf("%s Error: Max: %3u, Mean: %3.3f, MSE: %3.3f, RMSE: %3.3f, PSNR: %3.3f", pName, mMax, mMean, mMeanSquared, mRootMeanSquared, mPeakSNR);
- }
-
- bool error_metrics::compute(const image_u8& a, const image_u8& b, uint first_channel, uint num_channels, bool average_component_error)
- {
- //if ( (!a.get_width()) || (!b.get_height()) || (a.get_width() != b.get_width()) || (a.get_height() != b.get_height()) )
- // return false;
-
- const uint width = math::minimum(a.get_width(), b.get_width());
- const uint height = math::minimum(a.get_height(), b.get_height());
-
- CRNLIB_ASSERT((first_channel < 4U) && (first_channel + num_channels <= 4U));
-
- // Histogram approach due to Charles Bloom.
- double hist[256];
- utils::zero_object(hist);
-
- for (uint y = 0; y < height; y++)
- {
- for (uint x = 0; x < width; x++)
- {
- const color_quad_u8& ca = a(x, y);
- const color_quad_u8& cb = b(x, y);
-
- if (!num_channels)
- hist[labs(ca.get_luma() - cb.get_luma())]++;
- else
- {
- for (uint c = 0; c < num_channels; c++)
- hist[labs(ca[first_channel + c] - cb[first_channel + c])]++;
- }
- }
- }
-
- mMax = 0;
- double sum = 0.0f, sum2 = 0.0f;
- for (uint i = 0; i < 256; i++)
- {
- if (!hist[i])
- continue;
-
- mMax = math::maximum(mMax, i);
-
- double x = i * hist[i];
-
- sum += x;
- sum2 += i * x;
- }
-
- // See http://bmrc.berkeley.edu/courseware/cs294/fall97/assignment/psnr.html
- double total_values = width * height;
-
- if (average_component_error)
- total_values *= math::clamp<uint>(num_channels, 1, 4);
-
- mMean = math::clamp<double>(sum / total_values, 0.0f, 255.0f);
- mMeanSquared = math::clamp<double>(sum2 / total_values, 0.0f, 255.0f*255.0f);
-
- mRootMeanSquared = sqrt(mMeanSquared);
-
- if (!mRootMeanSquared)
- mPeakSNR = cInfinitePSNR;
- else
- mPeakSNR = math::clamp<double>(log10(255.0f / mRootMeanSquared) * 20.0f, 0.0f, 500.0f);
-
- return true;
- }
-
- void print_image_metrics(const image_u8& src_img, const image_u8& dst_img)
- {
- if ( (!src_img.get_width()) || (!dst_img.get_height()) || (src_img.get_width() != dst_img.get_width()) || (src_img.get_height() != dst_img.get_height()) )
- console::printf("print_image_metrics: Image resolutions don't match exactly (%ux%u) vs. (%ux%u)", src_img.get_width(), src_img.get_height(), dst_img.get_width(), dst_img.get_height());
-
- image_utils::error_metrics error_metrics;
-
- if (src_img.has_rgb() || dst_img.has_rgb())
- {
- error_metrics.compute(src_img, dst_img, 0, 3, false);
- error_metrics.print("RGB Total ");
-
- error_metrics.compute(src_img, dst_img, 0, 3, true);
- error_metrics.print("RGB Average");
-
- error_metrics.compute(src_img, dst_img, 0, 0);
- error_metrics.print("Luma ");
-
- error_metrics.compute(src_img, dst_img, 0, 1);
- error_metrics.print("Red ");
-
- error_metrics.compute(src_img, dst_img, 1, 1);
- error_metrics.print("Green ");
-
- error_metrics.compute(src_img, dst_img, 2, 1);
- error_metrics.print("Blue ");
- }
-
- if (src_img.has_alpha() || dst_img.has_alpha())
- {
- error_metrics.compute(src_img, dst_img, 3, 1);
- error_metrics.print("Alpha ");
- }
- }
-
- static uint8 regen_z(uint x, uint y)
- {
- float vx = math::clamp((x - 128.0f) * 1.0f/127.0f, -1.0f, 1.0f);
- float vy = math::clamp((y - 128.0f) * 1.0f/127.0f, -1.0f, 1.0f);
- float vz = sqrt(math::clamp(1.0f - vx * vx - vy * vy, 0.0f, 1.0f));
-
- vz = vz * 127.0f + 128.0f;
-
- if (vz < 128.0f)
- vz -= .5f;
- else
- vz += .5f;
-
- int ib = math::float_to_int(vz);
-
- return static_cast<uint8>(math::clamp(ib, 0, 255));
- }
-
- void convert_image(image_u8& img, image_utils::conversion_type conv_type)
- {
- switch (conv_type)
- {
- case image_utils::cConversion_To_CCxY:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(pixel_format_helpers::cCompFlagRValid | pixel_format_helpers::cCompFlagGValid | pixel_format_helpers::cCompFlagAValid | pixel_format_helpers::cCompFlagLumaChroma));
- break;
- }
- case image_utils::cConversion_From_CCxY:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(pixel_format_helpers::cCompFlagRValid | pixel_format_helpers::cCompFlagGValid | pixel_format_helpers::cCompFlagBValid));
- break;
- }
- case image_utils::cConversion_To_xGxR:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(pixel_format_helpers::cCompFlagGValid | pixel_format_helpers::cCompFlagAValid | pixel_format_helpers::cCompFlagNormalMap));
- break;
- }
- case image_utils::cConversion_From_xGxR:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(pixel_format_helpers::cCompFlagRValid | pixel_format_helpers::cCompFlagGValid | pixel_format_helpers::cCompFlagBValid | pixel_format_helpers::cCompFlagNormalMap));
- break;
- }
- case image_utils::cConversion_To_xGBR:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(pixel_format_helpers::cCompFlagGValid | pixel_format_helpers::cCompFlagBValid | pixel_format_helpers::cCompFlagAValid | pixel_format_helpers::cCompFlagNormalMap));
- break;
- }
- case image_utils::cConversion_To_AGBR:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(pixel_format_helpers::cCompFlagRValid | pixel_format_helpers::cCompFlagGValid | pixel_format_helpers::cCompFlagBValid | pixel_format_helpers::cCompFlagAValid | pixel_format_helpers::cCompFlagNormalMap));
- break;
- }
- case image_utils::cConversion_From_xGBR:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(pixel_format_helpers::cCompFlagRValid | pixel_format_helpers::cCompFlagGValid | pixel_format_helpers::cCompFlagBValid | pixel_format_helpers::cCompFlagNormalMap));
- break;
- }
- case image_utils::cConversion_From_AGBR:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(pixel_format_helpers::cCompFlagRValid | pixel_format_helpers::cCompFlagGValid | pixel_format_helpers::cCompFlagBValid | pixel_format_helpers::cCompFlagAValid | pixel_format_helpers::cCompFlagNormalMap));
- break;
- }
- case image_utils::cConversion_XY_to_XYZ:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(pixel_format_helpers::cCompFlagRValid | pixel_format_helpers::cCompFlagGValid | pixel_format_helpers::cCompFlagBValid | pixel_format_helpers::cCompFlagNormalMap));
- break;
- }
- case cConversion_Y_To_A:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(img.get_comp_flags() | pixel_format_helpers::cCompFlagAValid));
- break;
- }
- case cConversion_A_To_RGBA:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(pixel_format_helpers::cCompFlagRValid | pixel_format_helpers::cCompFlagGValid | pixel_format_helpers::cCompFlagBValid | pixel_format_helpers::cCompFlagAValid));
- break;
- }
- case cConversion_Y_To_RGB:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(pixel_format_helpers::cCompFlagRValid | pixel_format_helpers::cCompFlagGValid | pixel_format_helpers::cCompFlagBValid | pixel_format_helpers::cCompFlagGrayscale | (img.has_alpha() ? pixel_format_helpers::cCompFlagAValid : 0)));
- break;
- }
- case cConversion_To_Y:
- {
- img.set_comp_flags(static_cast<pixel_format_helpers::component_flags>(img.get_comp_flags() | pixel_format_helpers::cCompFlagGrayscale));
- break;
- }
- default:
- {
- CRNLIB_ASSERT(false);
- return;
- }
- }
-
- for (uint y = 0; y < img.get_height(); y++)
- {
- for (uint x = 0; x < img.get_width(); x++)
- {
- color_quad_u8 src(img(x, y));
- color_quad_u8 dst;
-
- switch (conv_type)
- {
- case image_utils::cConversion_To_CCxY:
- {
- color::RGB_to_YCC(dst, src);
- break;
- }
- case image_utils::cConversion_From_CCxY:
- {
- color::YCC_to_RGB(dst, src);
- break;
- }
- case image_utils::cConversion_To_xGxR:
- {
- dst.r = 0;
- dst.g = src.g;
- dst.b = 0;
- dst.a = src.r;
- break;
- }
- case image_utils::cConversion_From_xGxR:
- {
- dst.r = src.a;
- dst.g = src.g;
- // This is kinda iffy, we're assuming the image is a normal map here.
- dst.b = regen_z(src.a, src.g);
- dst.a = 255;
- break;
- }
- case image_utils::cConversion_To_xGBR:
- {
- dst.r = 0;
- dst.g = src.g;
- dst.b = src.b;
- dst.a = src.r;
- break;
- }
- case image_utils::cConversion_To_AGBR:
- {
- dst.r = src.a;
- dst.g = src.g;
- dst.b = src.b;
- dst.a = src.r;
- break;
- }
- case image_utils::cConversion_From_xGBR:
- {
- dst.r = src.a;
- dst.g = src.g;
- dst.b = src.b;
- dst.a = 255;
- break;
- }
- case image_utils::cConversion_From_AGBR:
- {
- dst.r = src.a;
- dst.g = src.g;
- dst.b = src.b;
- dst.a = src.r;
- break;
- }
- case image_utils::cConversion_XY_to_XYZ:
- {
- dst.r = src.r;
- dst.g = src.g;
- // This is kinda iffy, we're assuming the image is a normal map here.
- dst.b = regen_z(src.r, src.g);
- dst.a = 255;
- break;
- }
- case image_utils::cConversion_Y_To_A:
- {
- dst.r = src.r;
- dst.g = src.g;
- dst.b = src.b;
- dst.a = static_cast<uint8>(src.get_luma());
- break;
- }
- case image_utils::cConversion_Y_To_RGB:
- {
- uint8 y = static_cast<uint8>(src.get_luma());
- dst.r = y;
- dst.g = y;
- dst.b = y;
- dst.a = src.a;
- break;
- }
- case image_utils::cConversion_A_To_RGBA:
- {
- dst.r = src.a;
- dst.g = src.a;
- dst.b = src.a;
- dst.a = src.a;
- break;
- }
- case image_utils::cConversion_To_Y:
- {
- uint8 y = static_cast<uint8>(src.get_luma());
- dst.r = y;
- dst.g = y;
- dst.b = y;
- dst.a = src.a;
- break;
- }
- default:
- {
- CRNLIB_ASSERT(false);
- dst = src;
- break;
- }
- }
-
- img(x, y) = dst;
- }
- }
- }
-
- image_utils::conversion_type get_conversion_type(bool cooking, pixel_format fmt)
- {
- image_utils::conversion_type conv_type = image_utils::cConversion_Invalid;
-
- if (cooking)
- {
- switch (fmt)
- {
- case PIXEL_FMT_DXT5_CCxY:
- {
- conv_type = image_utils::cConversion_To_CCxY;
- break;
- }
- case PIXEL_FMT_DXT5_xGxR:
- {
- conv_type = image_utils::cConversion_To_xGxR;
- break;
- }
- case PIXEL_FMT_DXT5_xGBR:
- {
- conv_type = image_utils::cConversion_To_xGBR;
- break;
- }
- case PIXEL_FMT_DXT5_AGBR:
- {
- conv_type = image_utils::cConversion_To_AGBR;
- break;
- }
- default: break;
- }
- }
- else
- {
- switch (fmt)
- {
- case PIXEL_FMT_3DC:
- case PIXEL_FMT_DXN:
- {
- conv_type = image_utils::cConversion_XY_to_XYZ;
- break;
- }
- case PIXEL_FMT_DXT5_CCxY:
- {
- conv_type = image_utils::cConversion_From_CCxY;
- break;
- }
- case PIXEL_FMT_DXT5_xGxR:
- {
- conv_type = image_utils::cConversion_From_xGxR;
- break;
- }
- case PIXEL_FMT_DXT5_xGBR:
- {
- conv_type = image_utils::cConversion_From_xGBR;
- break;
- }
- case PIXEL_FMT_DXT5_AGBR:
- {
- conv_type = image_utils::cConversion_From_AGBR;
- break;
- }
- default: break;
- }
- }
-
- return conv_type;
- }
-
- image_utils::conversion_type get_image_conversion_type_from_crn_format(crn_format fmt)
- {
- switch (fmt)
- {
- case cCRNFmtDXT5_CCxY: return image_utils::cConversion_To_CCxY;
- case cCRNFmtDXT5_xGxR: return image_utils::cConversion_To_xGxR;
- case cCRNFmtDXT5_xGBR: return image_utils::cConversion_To_xGBR;
- case cCRNFmtDXT5_AGBR: return image_utils::cConversion_To_AGBR;
- default: break;
- }
- return image_utils::cConversion_Invalid;
- }
-
- double compute_std_dev(uint n, const color_quad_u8* pPixels, uint first_channel, uint num_channels)
- {
- if (!n)
- return 0.0f;
-
- double sum = 0.0f;
- double sum2 = 0.0f;
-
- for (uint i = 0; i < n; i++)
- {
- const color_quad_u8& cp = pPixels[i];
-
- if (!num_channels)
- {
- uint l = cp.get_luma();
- sum += l;
- sum2 += l*l;
- }
- else
- {
- for (uint c = 0; c < num_channels; c++)
- {
- uint l = cp[first_channel + c];
- sum += l;
- sum2 += l*l;
- }
- }
- }
-
- double w = math::maximum(1U, num_channels) * n;
- sum /= w;
- sum2 /= w;
-
- double var = sum2 - sum * sum;
- var = math::maximum<double>(var, 0.0f);
-
- return sqrt(var);
- }
-
- uint8* read_image_from_memory(const uint8* pImage, int nSize, int* pWidth, int* pHeight, int* pActualComps, int req_comps, const char* pFilename)
- {
- *pWidth = 0;
- *pHeight = 0;
- *pActualComps = 0;
-
- if ((req_comps < 1) || (req_comps > 4))
- return NULL;
-
- mipmapped_texture tex;
-
- buffer_stream buf_stream(pImage, nSize);
- buf_stream.set_name(pFilename);
- data_stream_serializer serializer(buf_stream);
-
- if (!tex.read_from_stream(serializer))
- return NULL;
-
- if (tex.is_packed())
- {
- if (!tex.unpack_from_dxt(true))
- return NULL;
- }
-
- image_u8 img;
- image_u8* pImg = tex.get_level_image(0, 0, img);
- if (!pImg)
- return NULL;
-
- *pWidth = tex.get_width();
- *pHeight = tex.get_height();
-
- if (pImg->has_alpha())
- *pActualComps = 4;
- else if (pImg->is_grayscale())
- *pActualComps = 1;
- else
- *pActualComps = 3;
-
- uint8 *pDst = NULL;
- if (req_comps == 4)
- {
- pDst = (uint8*)malloc(tex.get_total_pixels() * sizeof(uint32));
- uint8 *pSrc = (uint8*)pImg->get_ptr();
- memcpy(pDst, pSrc, tex.get_total_pixels() * sizeof(uint32));
- }
- else
- {
- image_u8 luma_img;
- if (req_comps == 1)
- {
- luma_img = *pImg;
- luma_img.convert_to_grayscale();
- pImg = &luma_img;
- }
-
- pixel_packer packer(req_comps, 8);
- uint32 n;
- pDst = image_utils::pack_image(*pImg, packer, n);
- }
-
- return pDst;
- }
-
- } // namespace image_utils
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_image_utils.h b/Libraries/crunch-ea9b8d/crnlib/crn_image_utils.h
deleted file mode 100644
index 480b3e75..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_image_utils.h
+++ /dev/null
@@ -1,193 +0,0 @@
-// File: crn_image_utils.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_image.h"
-#include "crn_data_stream_serializer.h"
-
-namespace crnlib
-{
- enum pixel_format;
-
- namespace image_utils
- {
- enum read_flags_t
- {
- cReadFlagForceSTB = 1,
-
- cReadFlagsAllFlags = 1
- };
-
- bool read_from_stream_stb(data_stream_serializer& serializer, image_u8& img);
- bool read_from_stream_jpgd(data_stream_serializer& serializer, image_u8& img);
- bool read_from_stream(image_u8& dest, data_stream_serializer& serializer, uint read_flags = 0);
- bool read_from_file(image_u8& dest, const char* pFilename, uint read_flags = 0);
-
- // Reads texture from memory, results returned stb_image.c style.
- // *pActual_comps is set to 1, 3, or 4. req_comps must range from 1-4.
- uint8* read_from_memory(const uint8* pImage, int nSize, int* pWidth, int* pHeight, int* pActualComps, int req_comps, const char* pFilename);
-
- enum
- {
- cWriteFlagIgnoreAlpha = 0x00000001,
- cWriteFlagGrayscale = 0x00000002,
-
- cWriteFlagJPEGH1V1 = 0x00010000,
- cWriteFlagJPEGH2V1 = 0x00020000,
- cWriteFlagJPEGH2V2 = 0x00040000,
- cWriteFlagJPEGTwoPass = 0x00080000,
- cWriteFlagJPEGNoChromaDiscrim = 0x00100000,
- cWriteFlagJPEGQualityLevelMask = 0xFF000000,
- cWriteFlagJPEGQualityLevelShift = 24,
- };
-
- const int cLumaComponentIndex = -1;
-
- inline uint create_jpeg_write_flags(uint base_flags, uint quality_level) { CRNLIB_ASSERT(quality_level <= 100); return base_flags | ((quality_level << cWriteFlagJPEGQualityLevelShift) & cWriteFlagJPEGQualityLevelMask); }
-
- bool write_to_file(const char* pFilename, const image_u8& img, uint write_flags = 0, int grayscale_comp_index = cLumaComponentIndex);
-
- bool has_alpha(const image_u8& img);
- bool is_normal_map(const image_u8& img, const char* pFilename = NULL);
- void renorm_normal_map(image_u8& img);
-
- struct resample_params
- {
- resample_params() :
- m_dst_width(0),
- m_dst_height(0),
- m_pFilter("lanczos4"),
- m_filter_scale(1.0f),
- m_srgb(true),
- m_wrapping(false),
- m_first_comp(0),
- m_num_comps(4),
- m_source_gamma(2.2f), // 1.75f
- m_multithreaded(true)
- {
- }
-
- uint m_dst_width;
- uint m_dst_height;
- const char* m_pFilter;
- float m_filter_scale;
- bool m_srgb;
- bool m_wrapping;
- uint m_first_comp;
- uint m_num_comps;
- float m_source_gamma;
- bool m_multithreaded;
- };
-
- bool resample_single_thread(const image_u8& src, image_u8& dst, const resample_params& params);
- bool resample_multithreaded(const image_u8& src, image_u8& dst, const resample_params& params);
- bool resample(const image_u8& src, image_u8& dst, const resample_params& params);
-
- bool compute_delta(image_u8& dest, image_u8& a, image_u8& b, uint scale = 2);
-
- class error_metrics
- {
- public:
- error_metrics() { utils::zero_this(this); }
-
- void print(const char* pName) const;
-
- // If num_channels==0, luma error is computed.
- // If pHist != NULL, it must point to a 256 entry array.
- bool compute(const image_u8& a, const image_u8& b, uint first_channel, uint num_channels, bool average_component_error = true);
-
- uint mMax;
- double mMean;
- double mMeanSquared;
- double mRootMeanSquared;
- double mPeakSNR;
-
- inline bool operator== (const error_metrics& other) const
- {
- return mPeakSNR == other.mPeakSNR;
- }
-
- inline bool operator< (const error_metrics& other) const
- {
- return mPeakSNR < other.mPeakSNR;
- }
-
- inline bool operator> (const error_metrics& other) const
- {
- return mPeakSNR > other.mPeakSNR;
- }
- };
-
- void print_image_metrics(const image_u8& src_img, const image_u8& dst_img);
-
- double compute_block_ssim(uint n, const uint8* pX, const uint8* pY);
- double compute_ssim(const image_u8& a, const image_u8& b, int channel_index);
- void print_ssim(const image_u8& src_img, const image_u8& dst_img);
-
- enum conversion_type
- {
- cConversion_Invalid = -1,
-
- cConversion_To_CCxY,
- cConversion_From_CCxY,
-
- cConversion_To_xGxR,
- cConversion_From_xGxR,
-
- cConversion_To_xGBR,
- cConversion_From_xGBR,
-
- cConversion_To_AGBR,
- cConversion_From_AGBR,
-
- cConversion_XY_to_XYZ,
-
- cConversion_Y_To_A,
-
- cConversion_A_To_RGBA,
- cConversion_Y_To_RGB,
-
- cConversion_To_Y,
-
- cConversionTotal
- };
-
- void convert_image(image_u8& img, conversion_type conv_type);
-
- template<typename image_type>
- inline uint8* pack_image(const image_type& img, const pixel_packer& packer, uint& n)
- {
- n = 0;
-
- if (!packer.is_valid())
- return NULL;
-
- const uint width = img.get_width(), height = img.get_height();
- uint dst_pixel_stride = packer.get_pixel_stride();
- uint dst_pitch = width * dst_pixel_stride;
-
- n = dst_pitch * height;
-
- uint8* pImage = static_cast<uint8*>(crnlib_malloc(n));
-
- uint8* pDst = pImage;
- for (uint y = 0; y < height; y++)
- {
- const typename image_type::color_t* pSrc = img.get_scanline(y);
- for (uint x = 0; x < width; x++)
- pDst = (uint8*)packer.pack(*pSrc++, pDst);
- }
-
- return pImage;
- }
-
- image_utils::conversion_type get_conversion_type(bool cooking, pixel_format fmt);
-
- image_utils::conversion_type get_image_conversion_type_from_crn_format(crn_format fmt);
-
- double compute_std_dev(uint n, const color_quad_u8* pPixels, uint first_channel, uint num_channels);
-
- uint8* read_image_from_memory(const uint8* pImage, int nSize, int* pWidth, int* pHeight, int* pActualComps, int req_comps, const char* pFilename);
-
- } // namespace image_utils
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_intersect.h b/Libraries/crunch-ea9b8d/crnlib/crn_intersect.h
deleted file mode 100644
index a773dd23..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_intersect.h
+++ /dev/null
@@ -1,123 +0,0 @@
-// File: crn_intersect.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_ray.h"
-
-namespace crnlib
-{
- namespace intersection
- {
- enum result
- {
- cBackfacing = -1,
- cFailure = 0,
- cSuccess,
- cParallel,
- cInside,
- };
-
- // Returns cInside, cSuccess, or cFailure.
- // Algorithm: Graphics Gems 1
- template<typename vector_type, typename scalar_type, typename ray_type, typename aabb_type>
- result ray_aabb(vector_type& coord, scalar_type& t, const ray_type& ray, const aabb_type& box)
- {
- enum
- {
- cNumDim = vector_type::num_elements,
- cRight = 0,
- cLeft = 1,
- cMiddle = 2
- };
-
- bool inside = true;
- int quadrant[cNumDim];
- scalar_type candidate_plane[cNumDim];
-
- for (int i = 0; i < cNumDim; i++)
- {
- if (ray.get_origin()[i] < box[0][i])
- {
- quadrant[i] = cLeft;
- candidate_plane[i] = box[0][i];
- inside = false;
- }
- else if (ray.get_origin()[i] > box[1][i])
- {
- quadrant[i] = cRight;
- candidate_plane[i] = box[1][i];
- inside = false;
- }
- else
- {
- quadrant[i] = cMiddle;
- }
- }
-
- if (inside)
- {
- coord = ray.get_origin();
- t = 0.0f;
- return cInside;
- }
-
- scalar_type max_t[cNumDim];
- for (int i = 0; i < cNumDim; i++)
- {
- if ((quadrant[i] != cMiddle) && (ray.get_direction()[i] != 0.0f))
- max_t[i] = (candidate_plane[i] - ray.get_origin()[i]) / ray.get_direction()[i];
- else
- max_t[i] = -1.0f;
- }
-
- int which_plane = 0;
- for (int i = 1; i < cNumDim; i++)
- if (max_t[which_plane] < max_t[i])
- which_plane = i;
-
- if (max_t[which_plane] < 0.0f)
- return cFailure;
-
- for (int i = 0; i < cNumDim; i++)
- {
- if (i != which_plane)
- {
- coord[i] = ray.get_origin()[i] + max_t[which_plane] * ray.get_direction()[i];
-
- if ( (coord[i] < box[0][i]) || (coord[i] > box[1][i]) )
- return cFailure;
- }
- else
- {
- coord[i] = candidate_plane[i];
- }
-
- CRNLIB_ASSERT(coord[i] >= box[0][i] && coord[i] <= box[1][i]);
- }
-
- t = max_t[which_plane];
- return cSuccess;
- }
-
- template<typename vector_type, typename scalar_type, typename ray_type, typename aabb_type>
- result ray_aabb(bool& started_within, vector_type& coord, scalar_type& t, const ray_type& ray, const aabb_type& box)
- {
- if (!box.contains(ray.get_origin()))
- {
- started_within = false;
- return ray_aabb(coord, t, ray, box);
- }
-
- started_within = true;
-
- float diag_dist = box.diagonal_length() * 1.5f;
- ray_type outside_ray(ray.eval(diag_dist), -ray.get_direction());
-
- result res(ray_aabb(coord, t, outside_ray, box));
- if (res != cSuccess)
- return res;
-
- t = math::maximum(0.0f, diag_dist - t);
- return cSuccess;
- }
- }
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_jpgd.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_jpgd.cpp
deleted file mode 100644
index 9ad1b4a5..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_jpgd.cpp
+++ /dev/null
@@ -1,3172 +0,0 @@
-// jpgd.cpp - C++ class for JPEG decompression.
-// Public domain, Rich Geldreich <richgel99@gmail.com>
-// Alex Evans: Linear memory allocator (taken from jpge.h).
-// v1.04, May. 19, 2012: Code tweaks to fix VS2008 static code analysis warnings (all looked harmless)
-//
-// Supports progressive and baseline sequential JPEG image files, and the most common chroma subsampling factors: Y, H1V1, H2V1, H1V2, and H2V2.
-//
-// Chroma upsampling quality: H2V2 is upsampled in the frequency domain, H2V1 and H1V2 are upsampled using point sampling.
-// Chroma upsampling reference: "Fast Scheme for Image Size Change in the Compressed Domain"
-// http://vision.ai.uiuc.edu/~dugad/research/dct/index.html
-
-#include "crn_jpgd.h"
-#include <string.h>
-
-#include <assert.h>
-#define JPGD_ASSERT(x) assert(x)
-
-#include "crn_core.h"
-
-#ifdef _MSC_VER
-#pragma warning (disable : 4611) // warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable
-#endif
-
-// Set to 1 to enable freq. domain chroma upsampling on images using H2V2 subsampling (0=faster nearest neighbor sampling).
-// This is slower, but results in higher quality on images with highly saturated colors.
-#define JPGD_SUPPORT_FREQ_DOMAIN_UPSAMPLING 1
-
-#define JPGD_TRUE (1)
-#define JPGD_FALSE (0)
-
-#define JPGD_MAX(a,b) (((a)>(b)) ? (a) : (b))
-#define JPGD_MIN(a,b) (((a)<(b)) ? (a) : (b))
-
-namespace jpgd {
-
-static inline void *jpgd_malloc(size_t nSize) { return crnlib::crnlib_malloc(nSize); }
-static inline void jpgd_free(void *p) { crnlib::crnlib_free(p); }
-
-// DCT coefficients are stored in this sequence.
-static int g_ZAG[64] = { 0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63 };
-
-enum JPEG_MARKER
-{
- M_SOF0 = 0xC0, M_SOF1 = 0xC1, M_SOF2 = 0xC2, M_SOF3 = 0xC3, M_SOF5 = 0xC5, M_SOF6 = 0xC6, M_SOF7 = 0xC7, M_JPG = 0xC8,
- M_SOF9 = 0xC9, M_SOF10 = 0xCA, M_SOF11 = 0xCB, M_SOF13 = 0xCD, M_SOF14 = 0xCE, M_SOF15 = 0xCF, M_DHT = 0xC4, M_DAC = 0xCC,
- M_RST0 = 0xD0, M_RST1 = 0xD1, M_RST2 = 0xD2, M_RST3 = 0xD3, M_RST4 = 0xD4, M_RST5 = 0xD5, M_RST6 = 0xD6, M_RST7 = 0xD7,
- M_SOI = 0xD8, M_EOI = 0xD9, M_SOS = 0xDA, M_DQT = 0xDB, M_DNL = 0xDC, M_DRI = 0xDD, M_DHP = 0xDE, M_EXP = 0xDF,
- M_APP0 = 0xE0, M_APP15 = 0xEF, M_JPG0 = 0xF0, M_JPG13 = 0xFD, M_COM = 0xFE, M_TEM = 0x01, M_ERROR = 0x100, RST0 = 0xD0
-};
-
-enum JPEG_SUBSAMPLING { JPGD_GRAYSCALE = 0, JPGD_YH1V1, JPGD_YH2V1, JPGD_YH1V2, JPGD_YH2V2 };
-
-#define CONST_BITS 13
-#define PASS1_BITS 2
-#define SCALEDONE ((int32)1)
-
-#define FIX_0_298631336 ((int32)2446) /* FIX(0.298631336) */
-#define FIX_0_390180644 ((int32)3196) /* FIX(0.390180644) */
-#define FIX_0_541196100 ((int32)4433) /* FIX(0.541196100) */
-#define FIX_0_765366865 ((int32)6270) /* FIX(0.765366865) */
-#define FIX_0_899976223 ((int32)7373) /* FIX(0.899976223) */
-#define FIX_1_175875602 ((int32)9633) /* FIX(1.175875602) */
-#define FIX_1_501321110 ((int32)12299) /* FIX(1.501321110) */
-#define FIX_1_847759065 ((int32)15137) /* FIX(1.847759065) */
-#define FIX_1_961570560 ((int32)16069) /* FIX(1.961570560) */
-#define FIX_2_053119869 ((int32)16819) /* FIX(2.053119869) */
-#define FIX_2_562915447 ((int32)20995) /* FIX(2.562915447) */
-#define FIX_3_072711026 ((int32)25172) /* FIX(3.072711026) */
-
-#define DESCALE(x,n) (((x) + (SCALEDONE << ((n)-1))) >> (n))
-#define DESCALE_ZEROSHIFT(x,n) (((x) + (128 << (n)) + (SCALEDONE << ((n)-1))) >> (n))
-
-#define MULTIPLY(var, cnst) ((var) * (cnst))
-
-#define CLAMP(i) ((static_cast<uint>(i) > 255) ? (((~i) >> 31) & 0xFF) : (i))
-
-// Compiler creates a fast path 1D IDCT for X non-zero columns
-template <int NONZERO_COLS>
-struct Row
-{
- static void idct(int* pTemp, const jpgd_block_t* pSrc)
- {
- // ACCESS_COL() will be optimized at compile time to either an array access, or 0.
- #define ACCESS_COL(x) (((x) < NONZERO_COLS) ? (int)pSrc[x] : 0)
-
- const int z2 = ACCESS_COL(2), z3 = ACCESS_COL(6);
-
- const int z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
- const int tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
- const int tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
-
- const int tmp0 = (ACCESS_COL(0) + ACCESS_COL(4)) << CONST_BITS;
- const int tmp1 = (ACCESS_COL(0) - ACCESS_COL(4)) << CONST_BITS;
-
- const int tmp10 = tmp0 + tmp3, tmp13 = tmp0 - tmp3, tmp11 = tmp1 + tmp2, tmp12 = tmp1 - tmp2;
-
- const int atmp0 = ACCESS_COL(7), atmp1 = ACCESS_COL(5), atmp2 = ACCESS_COL(3), atmp3 = ACCESS_COL(1);
-
- const int bz1 = atmp0 + atmp3, bz2 = atmp1 + atmp2, bz3 = atmp0 + atmp2, bz4 = atmp1 + atmp3;
- const int bz5 = MULTIPLY(bz3 + bz4, FIX_1_175875602);
-
- const int az1 = MULTIPLY(bz1, - FIX_0_899976223);
- const int az2 = MULTIPLY(bz2, - FIX_2_562915447);
- const int az3 = MULTIPLY(bz3, - FIX_1_961570560) + bz5;
- const int az4 = MULTIPLY(bz4, - FIX_0_390180644) + bz5;
-
- const int btmp0 = MULTIPLY(atmp0, FIX_0_298631336) + az1 + az3;
- const int btmp1 = MULTIPLY(atmp1, FIX_2_053119869) + az2 + az4;
- const int btmp2 = MULTIPLY(atmp2, FIX_3_072711026) + az2 + az3;
- const int btmp3 = MULTIPLY(atmp3, FIX_1_501321110) + az1 + az4;
-
- pTemp[0] = DESCALE(tmp10 + btmp3, CONST_BITS-PASS1_BITS);
- pTemp[7] = DESCALE(tmp10 - btmp3, CONST_BITS-PASS1_BITS);
- pTemp[1] = DESCALE(tmp11 + btmp2, CONST_BITS-PASS1_BITS);
- pTemp[6] = DESCALE(tmp11 - btmp2, CONST_BITS-PASS1_BITS);
- pTemp[2] = DESCALE(tmp12 + btmp1, CONST_BITS-PASS1_BITS);
- pTemp[5] = DESCALE(tmp12 - btmp1, CONST_BITS-PASS1_BITS);
- pTemp[3] = DESCALE(tmp13 + btmp0, CONST_BITS-PASS1_BITS);
- pTemp[4] = DESCALE(tmp13 - btmp0, CONST_BITS-PASS1_BITS);
- }
-};
-
-template <>
-struct Row<0>
-{
- static void idct(int* pTemp, const jpgd_block_t* pSrc)
- {
- (void)pTemp; (void)pSrc;
- }
-};
-
-template <>
-struct Row<1>
-{
- static void idct(int* pTemp, const jpgd_block_t* pSrc)
- {
- const int dcval = (pSrc[0] << PASS1_BITS);
-
- pTemp[0] = dcval;
- pTemp[1] = dcval;
- pTemp[2] = dcval;
- pTemp[3] = dcval;
- pTemp[4] = dcval;
- pTemp[5] = dcval;
- pTemp[6] = dcval;
- pTemp[7] = dcval;
- }
-};
-
-// Compiler creates a fast path 1D IDCT for X non-zero rows
-template <int NONZERO_ROWS>
-struct Col
-{
- static void idct(uint8* pDst_ptr, const int* pTemp)
- {
- // ACCESS_ROW() will be optimized at compile time to either an array access, or 0.
- #define ACCESS_ROW(x) (((x) < NONZERO_ROWS) ? pTemp[x * 8] : 0)
-
- const int z2 = ACCESS_ROW(2);
- const int z3 = ACCESS_ROW(6);
-
- const int z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
- const int tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
- const int tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
-
- const int tmp0 = (ACCESS_ROW(0) + ACCESS_ROW(4)) << CONST_BITS;
- const int tmp1 = (ACCESS_ROW(0) - ACCESS_ROW(4)) << CONST_BITS;
-
- const int tmp10 = tmp0 + tmp3, tmp13 = tmp0 - tmp3, tmp11 = tmp1 + tmp2, tmp12 = tmp1 - tmp2;
-
- const int atmp0 = ACCESS_ROW(7), atmp1 = ACCESS_ROW(5), atmp2 = ACCESS_ROW(3), atmp3 = ACCESS_ROW(1);
-
- const int bz1 = atmp0 + atmp3, bz2 = atmp1 + atmp2, bz3 = atmp0 + atmp2, bz4 = atmp1 + atmp3;
- const int bz5 = MULTIPLY(bz3 + bz4, FIX_1_175875602);
-
- const int az1 = MULTIPLY(bz1, - FIX_0_899976223);
- const int az2 = MULTIPLY(bz2, - FIX_2_562915447);
- const int az3 = MULTIPLY(bz3, - FIX_1_961570560) + bz5;
- const int az4 = MULTIPLY(bz4, - FIX_0_390180644) + bz5;
-
- const int btmp0 = MULTIPLY(atmp0, FIX_0_298631336) + az1 + az3;
- const int btmp1 = MULTIPLY(atmp1, FIX_2_053119869) + az2 + az4;
- const int btmp2 = MULTIPLY(atmp2, FIX_3_072711026) + az2 + az3;
- const int btmp3 = MULTIPLY(atmp3, FIX_1_501321110) + az1 + az4;
-
- int i = DESCALE_ZEROSHIFT(tmp10 + btmp3, CONST_BITS+PASS1_BITS+3);
- pDst_ptr[8*0] = (uint8)CLAMP(i);
-
- i = DESCALE_ZEROSHIFT(tmp10 - btmp3, CONST_BITS+PASS1_BITS+3);
- pDst_ptr[8*7] = (uint8)CLAMP(i);
-
- i = DESCALE_ZEROSHIFT(tmp11 + btmp2, CONST_BITS+PASS1_BITS+3);
- pDst_ptr[8*1] = (uint8)CLAMP(i);
-
- i = DESCALE_ZEROSHIFT(tmp11 - btmp2, CONST_BITS+PASS1_BITS+3);
- pDst_ptr[8*6] = (uint8)CLAMP(i);
-
- i = DESCALE_ZEROSHIFT(tmp12 + btmp1, CONST_BITS+PASS1_BITS+3);
- pDst_ptr[8*2] = (uint8)CLAMP(i);
-
- i = DESCALE_ZEROSHIFT(tmp12 - btmp1, CONST_BITS+PASS1_BITS+3);
- pDst_ptr[8*5] = (uint8)CLAMP(i);
-
- i = DESCALE_ZEROSHIFT(tmp13 + btmp0, CONST_BITS+PASS1_BITS+3);
- pDst_ptr[8*3] = (uint8)CLAMP(i);
-
- i = DESCALE_ZEROSHIFT(tmp13 - btmp0, CONST_BITS+PASS1_BITS+3);
- pDst_ptr[8*4] = (uint8)CLAMP(i);
- }
-};
-
-template <>
-struct Col<1>
-{
- static void idct(uint8* pDst_ptr, const int* pTemp)
- {
- int dcval = DESCALE_ZEROSHIFT(pTemp[0], PASS1_BITS+3);
- const uint8 dcval_clamped = (uint8)CLAMP(dcval);
- pDst_ptr[0*8] = dcval_clamped;
- pDst_ptr[1*8] = dcval_clamped;
- pDst_ptr[2*8] = dcval_clamped;
- pDst_ptr[3*8] = dcval_clamped;
- pDst_ptr[4*8] = dcval_clamped;
- pDst_ptr[5*8] = dcval_clamped;
- pDst_ptr[6*8] = dcval_clamped;
- pDst_ptr[7*8] = dcval_clamped;
- }
-};
-
-static const uint8 s_idct_row_table[] =
-{
- 1,0,0,0,0,0,0,0, 2,0,0,0,0,0,0,0, 2,1,0,0,0,0,0,0, 2,1,1,0,0,0,0,0, 2,2,1,0,0,0,0,0, 3,2,1,0,0,0,0,0, 4,2,1,0,0,0,0,0, 4,3,1,0,0,0,0,0,
- 4,3,2,0,0,0,0,0, 4,3,2,1,0,0,0,0, 4,3,2,1,1,0,0,0, 4,3,2,2,1,0,0,0, 4,3,3,2,1,0,0,0, 4,4,3,2,1,0,0,0, 5,4,3,2,1,0,0,0, 6,4,3,2,1,0,0,0,
- 6,5,3,2,1,0,0,0, 6,5,4,2,1,0,0,0, 6,5,4,3,1,0,0,0, 6,5,4,3,2,0,0,0, 6,5,4,3,2,1,0,0, 6,5,4,3,2,1,1,0, 6,5,4,3,2,2,1,0, 6,5,4,3,3,2,1,0,
- 6,5,4,4,3,2,1,0, 6,5,5,4,3,2,1,0, 6,6,5,4,3,2,1,0, 7,6,5,4,3,2,1,0, 8,6,5,4,3,2,1,0, 8,7,5,4,3,2,1,0, 8,7,6,4,3,2,1,0, 8,7,6,5,3,2,1,0,
- 8,7,6,5,4,2,1,0, 8,7,6,5,4,3,1,0, 8,7,6,5,4,3,2,0, 8,7,6,5,4,3,2,1, 8,7,6,5,4,3,2,2, 8,7,6,5,4,3,3,2, 8,7,6,5,4,4,3,2, 8,7,6,5,5,4,3,2,
- 8,7,6,6,5,4,3,2, 8,7,7,6,5,4,3,2, 8,8,7,6,5,4,3,2, 8,8,8,6,5,4,3,2, 8,8,8,7,5,4,3,2, 8,8,8,7,6,4,3,2, 8,8,8,7,6,5,3,2, 8,8,8,7,6,5,4,2,
- 8,8,8,7,6,5,4,3, 8,8,8,7,6,5,4,4, 8,8,8,7,6,5,5,4, 8,8,8,7,6,6,5,4, 8,8,8,7,7,6,5,4, 8,8,8,8,7,6,5,4, 8,8,8,8,8,6,5,4, 8,8,8,8,8,7,5,4,
- 8,8,8,8,8,7,6,4, 8,8,8,8,8,7,6,5, 8,8,8,8,8,7,6,6, 8,8,8,8,8,7,7,6, 8,8,8,8,8,8,7,6, 8,8,8,8,8,8,8,6, 8,8,8,8,8,8,8,7, 8,8,8,8,8,8,8,8,
-};
-
-static const uint8 s_idct_col_table[] = { 1, 1, 2, 3, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 };
-
-void idct(const jpgd_block_t* pSrc_ptr, uint8* pDst_ptr, int block_max_zag)
-{
- JPGD_ASSERT(block_max_zag >= 1);
- JPGD_ASSERT(block_max_zag <= 64);
-
- if (block_max_zag <= 1)
- {
- int k = ((pSrc_ptr[0] + 4) >> 3) + 128;
- k = CLAMP(k);
- k = k | (k<<8);
- k = k | (k<<16);
-
- for (int i = 8; i > 0; i--)
- {
- *(int*)&pDst_ptr[0] = k;
- *(int*)&pDst_ptr[4] = k;
- pDst_ptr += 8;
- }
- return;
- }
-
- int temp[64];
-
- const jpgd_block_t* pSrc = pSrc_ptr;
- int* pTemp = temp;
-
- const uint8* pRow_tab = &s_idct_row_table[(block_max_zag - 1) * 8];
- int i;
- for (i = 8; i > 0; i--, pRow_tab++)
- {
- switch (*pRow_tab)
- {
- case 0: Row<0>::idct(pTemp, pSrc); break;
- case 1: Row<1>::idct(pTemp, pSrc); break;
- case 2: Row<2>::idct(pTemp, pSrc); break;
- case 3: Row<3>::idct(pTemp, pSrc); break;
- case 4: Row<4>::idct(pTemp, pSrc); break;
- case 5: Row<5>::idct(pTemp, pSrc); break;
- case 6: Row<6>::idct(pTemp, pSrc); break;
- case 7: Row<7>::idct(pTemp, pSrc); break;
- case 8: Row<8>::idct(pTemp, pSrc); break;
- }
-
- pSrc += 8;
- pTemp += 8;
- }
-
- pTemp = temp;
-
- const int nonzero_rows = s_idct_col_table[block_max_zag - 1];
- for (i = 8; i > 0; i--)
- {
- switch (nonzero_rows)
- {
- case 1: Col<1>::idct(pDst_ptr, pTemp); break;
- case 2: Col<2>::idct(pDst_ptr, pTemp); break;
- case 3: Col<3>::idct(pDst_ptr, pTemp); break;
- case 4: Col<4>::idct(pDst_ptr, pTemp); break;
- case 5: Col<5>::idct(pDst_ptr, pTemp); break;
- case 6: Col<6>::idct(pDst_ptr, pTemp); break;
- case 7: Col<7>::idct(pDst_ptr, pTemp); break;
- case 8: Col<8>::idct(pDst_ptr, pTemp); break;
- }
-
- pTemp++;
- pDst_ptr++;
- }
-}
-
-void idct_4x4(const jpgd_block_t* pSrc_ptr, uint8* pDst_ptr)
-{
- int temp[64];
- int* pTemp = temp;
- const jpgd_block_t* pSrc = pSrc_ptr;
-
- for (int i = 4; i > 0; i--)
- {
- Row<4>::idct(pTemp, pSrc);
- pSrc += 8;
- pTemp += 8;
- }
-
- pTemp = temp;
- for (int i = 8; i > 0; i--)
- {
- Col<4>::idct(pDst_ptr, pTemp);
- pTemp++;
- pDst_ptr++;
- }
-}
-
-// Retrieve one character from the input stream.
-inline uint jpeg_decoder::get_char()
-{
- // Any bytes remaining in buffer?
- if (!m_in_buf_left)
- {
- // Try to get more bytes.
- prep_in_buffer();
- // Still nothing to get?
- if (!m_in_buf_left)
- {
- // Pad the end of the stream with 0xFF 0xD9 (EOI marker)
- int t = m_tem_flag;
- m_tem_flag ^= 1;
- if (t)
- return 0xD9;
- else
- return 0xFF;
- }
- }
-
- uint c = *m_pIn_buf_ofs++;
- m_in_buf_left--;
-
- return c;
-}
-
-// Same as previous method, except can indicate if the character is a pad character or not.
-inline uint jpeg_decoder::get_char(bool *pPadding_flag)
-{
- if (!m_in_buf_left)
- {
- prep_in_buffer();
- if (!m_in_buf_left)
- {
- *pPadding_flag = true;
- int t = m_tem_flag;
- m_tem_flag ^= 1;
- if (t)
- return 0xD9;
- else
- return 0xFF;
- }
- }
-
- *pPadding_flag = false;
-
- uint c = *m_pIn_buf_ofs++;
- m_in_buf_left--;
-
- return c;
-}
-
-// Inserts a previously retrieved character back into the input buffer.
-inline void jpeg_decoder::stuff_char(uint8 q)
-{
- *(--m_pIn_buf_ofs) = q;
- m_in_buf_left++;
-}
-
-// Retrieves one character from the input stream, but does not read past markers. Will continue to return 0xFF when a marker is encountered.
-inline uint8 jpeg_decoder::get_octet()
-{
- bool padding_flag;
- int c = get_char(&padding_flag);
-
- if (c == 0xFF)
- {
- if (padding_flag)
- return 0xFF;
-
- c = get_char(&padding_flag);
- if (padding_flag)
- {
- stuff_char(0xFF);
- return 0xFF;
- }
-
- if (c == 0x00)
- return 0xFF;
- else
- {
- stuff_char(static_cast<uint8>(c));
- stuff_char(0xFF);
- return 0xFF;
- }
- }
-
- return static_cast<uint8>(c);
-}
-
-// Retrieves a variable number of bits from the input stream. Does not recognize markers.
-inline uint jpeg_decoder::get_bits(int num_bits)
-{
- if (!num_bits)
- return 0;
-
- uint i = m_bit_buf >> (32 - num_bits);
-
- if ((m_bits_left -= num_bits) <= 0)
- {
- m_bit_buf <<= (num_bits += m_bits_left);
-
- uint c1 = get_char();
- uint c2 = get_char();
- m_bit_buf = (m_bit_buf & 0xFFFF0000) | (c1 << 8) | c2;
-
- m_bit_buf <<= -m_bits_left;
-
- m_bits_left += 16;
-
- JPGD_ASSERT(m_bits_left >= 0);
- }
- else
- m_bit_buf <<= num_bits;
-
- return i;
-}
-
-// Retrieves a variable number of bits from the input stream. Markers will not be read into the input bit buffer. Instead, an infinite number of all 1's will be returned when a marker is encountered.
-inline uint jpeg_decoder::get_bits_no_markers(int num_bits)
-{
- if (!num_bits)
- return 0;
-
- uint i = m_bit_buf >> (32 - num_bits);
-
- if ((m_bits_left -= num_bits) <= 0)
- {
- m_bit_buf <<= (num_bits += m_bits_left);
-
- if ((m_in_buf_left < 2) || (m_pIn_buf_ofs[0] == 0xFF) || (m_pIn_buf_ofs[1] == 0xFF))
- {
- uint c1 = get_octet();
- uint c2 = get_octet();
- m_bit_buf |= (c1 << 8) | c2;
- }
- else
- {
- m_bit_buf |= ((uint)m_pIn_buf_ofs[0] << 8) | m_pIn_buf_ofs[1];
- m_in_buf_left -= 2;
- m_pIn_buf_ofs += 2;
- }
-
- m_bit_buf <<= -m_bits_left;
-
- m_bits_left += 16;
-
- JPGD_ASSERT(m_bits_left >= 0);
- }
- else
- m_bit_buf <<= num_bits;
-
- return i;
-}
-
-// Decodes a Huffman encoded symbol.
-inline int jpeg_decoder::huff_decode(huff_tables *pH)
-{
- int symbol;
-
- // Check first 8-bits: do we have a complete symbol?
- if ((symbol = pH->look_up[m_bit_buf >> 24]) < 0)
- {
- // Decode more bits, use a tree traversal to find symbol.
- int ofs = 23;
- do
- {
- symbol = pH->tree[-(int)(symbol + ((m_bit_buf >> ofs) & 1))];
- ofs--;
- } while (symbol < 0);
-
- get_bits_no_markers(8 + (23 - ofs));
- }
- else
- get_bits_no_markers(pH->code_size[symbol]);
-
- return symbol;
-}
-
-// Decodes a Huffman encoded symbol.
-inline int jpeg_decoder::huff_decode(huff_tables *pH, int& extra_bits)
-{
- int symbol;
-
- // Check first 8-bits: do we have a complete symbol?
- if ((symbol = pH->look_up2[m_bit_buf >> 24]) < 0)
- {
- // Use a tree traversal to find symbol.
- int ofs = 23;
- do
- {
- symbol = pH->tree[-(int)(symbol + ((m_bit_buf >> ofs) & 1))];
- ofs--;
- } while (symbol < 0);
-
- get_bits_no_markers(8 + (23 - ofs));
-
- extra_bits = get_bits_no_markers(symbol & 0xF);
- }
- else
- {
- JPGD_ASSERT(((symbol >> 8) & 31) == pH->code_size[symbol & 255] + ((symbol & 0x8000) ? (symbol & 15) : 0));
-
- if (symbol & 0x8000)
- {
- get_bits_no_markers((symbol >> 8) & 31);
- extra_bits = symbol >> 16;
- }
- else
- {
- int code_size = (symbol >> 8) & 31;
- int num_extra_bits = symbol & 0xF;
- int bits = code_size + num_extra_bits;
- if (bits <= (m_bits_left + 16))
- extra_bits = get_bits_no_markers(bits) & ((1 << num_extra_bits) - 1);
- else
- {
- get_bits_no_markers(code_size);
- extra_bits = get_bits_no_markers(num_extra_bits);
- }
- }
-
- symbol &= 0xFF;
- }
-
- return symbol;
-}
-
-// Tables and macro used to fully decode the DPCM differences.
-static const int s_extend_test[16] = { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
-static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
-static const int s_extend_mask[] = { 0, (1<<0), (1<<1), (1<<2), (1<<3), (1<<4), (1<<5), (1<<6), (1<<7), (1<<8), (1<<9), (1<<10), (1<<11), (1<<12), (1<<13), (1<<14), (1<<15), (1<<16) };
-// The logical AND's in this macro are to shut up static code analysis (aren't really necessary - couldn't find another way to do this)
-#define JPGD_HUFF_EXTEND(x, s) (((x) < s_extend_test[s & 15]) ? ((x) + s_extend_offset[s & 15]) : (x))
-
-// Clamps a value between 0-255.
-inline uint8 jpeg_decoder::clamp(int i)
-{
- if (static_cast<uint>(i) > 255)
- i = (((~i) >> 31) & 0xFF);
-
- return static_cast<uint8>(i);
-}
-
-namespace DCT_Upsample
-{
- struct Matrix44
- {
- typedef int Element_Type;
- enum { NUM_ROWS = 4, NUM_COLS = 4 };
-
- Element_Type v[NUM_ROWS][NUM_COLS];
-
- inline int rows() const { return NUM_ROWS; }
- inline int cols() const { return NUM_COLS; }
-
- inline const Element_Type & at(int r, int c) const { return v[r][c]; }
- inline Element_Type & at(int r, int c) { return v[r][c]; }
-
- inline Matrix44() { }
-
- inline Matrix44& operator += (const Matrix44& a)
- {
- for (int r = 0; r < NUM_ROWS; r++)
- {
- at(r, 0) += a.at(r, 0);
- at(r, 1) += a.at(r, 1);
- at(r, 2) += a.at(r, 2);
- at(r, 3) += a.at(r, 3);
- }
- return *this;
- }
-
- inline Matrix44& operator -= (const Matrix44& a)
- {
- for (int r = 0; r < NUM_ROWS; r++)
- {
- at(r, 0) -= a.at(r, 0);
- at(r, 1) -= a.at(r, 1);
- at(r, 2) -= a.at(r, 2);
- at(r, 3) -= a.at(r, 3);
- }
- return *this;
- }
-
- friend inline Matrix44 operator + (const Matrix44& a, const Matrix44& b)
- {
- Matrix44 ret;
- for (int r = 0; r < NUM_ROWS; r++)
- {
- ret.at(r, 0) = a.at(r, 0) + b.at(r, 0);
- ret.at(r, 1) = a.at(r, 1) + b.at(r, 1);
- ret.at(r, 2) = a.at(r, 2) + b.at(r, 2);
- ret.at(r, 3) = a.at(r, 3) + b.at(r, 3);
- }
- return ret;
- }
-
- friend inline Matrix44 operator - (const Matrix44& a, const Matrix44& b)
- {
- Matrix44 ret;
- for (int r = 0; r < NUM_ROWS; r++)
- {
- ret.at(r, 0) = a.at(r, 0) - b.at(r, 0);
- ret.at(r, 1) = a.at(r, 1) - b.at(r, 1);
- ret.at(r, 2) = a.at(r, 2) - b.at(r, 2);
- ret.at(r, 3) = a.at(r, 3) - b.at(r, 3);
- }
- return ret;
- }
-
- static inline void add_and_store(jpgd_block_t* pDst, const Matrix44& a, const Matrix44& b)
- {
- for (int r = 0; r < 4; r++)
- {
- pDst[0*8 + r] = static_cast<jpgd_block_t>(a.at(r, 0) + b.at(r, 0));
- pDst[1*8 + r] = static_cast<jpgd_block_t>(a.at(r, 1) + b.at(r, 1));
- pDst[2*8 + r] = static_cast<jpgd_block_t>(a.at(r, 2) + b.at(r, 2));
- pDst[3*8 + r] = static_cast<jpgd_block_t>(a.at(r, 3) + b.at(r, 3));
- }
- }
-
- static inline void sub_and_store(jpgd_block_t* pDst, const Matrix44& a, const Matrix44& b)
- {
- for (int r = 0; r < 4; r++)
- {
- pDst[0*8 + r] = static_cast<jpgd_block_t>(a.at(r, 0) - b.at(r, 0));
- pDst[1*8 + r] = static_cast<jpgd_block_t>(a.at(r, 1) - b.at(r, 1));
- pDst[2*8 + r] = static_cast<jpgd_block_t>(a.at(r, 2) - b.at(r, 2));
- pDst[3*8 + r] = static_cast<jpgd_block_t>(a.at(r, 3) - b.at(r, 3));
- }
- }
- };
-
- const int FRACT_BITS = 10;
- const int SCALE = 1 << FRACT_BITS;
-
- typedef int Temp_Type;
- #define D(i) (((i) + (SCALE >> 1)) >> FRACT_BITS)
- #define F(i) ((int)((i) * SCALE + .5f))
-
- // Any decent C++ compiler will optimize this at compile time to a 0, or an array access.
- #define AT(c, r) ((((c)>=NUM_COLS)||((r)>=NUM_ROWS)) ? 0 : pSrc[(c)+(r)*8])
-
- // NUM_ROWS/NUM_COLS = # of non-zero rows/cols in input matrix
- template<int NUM_ROWS, int NUM_COLS>
- struct P_Q
- {
- static void calc(Matrix44& P, Matrix44& Q, const jpgd_block_t* pSrc)
- {
- // 4x8 = 4x8 times 8x8, matrix 0 is constant
- const Temp_Type X000 = AT(0, 0);
- const Temp_Type X001 = AT(0, 1);
- const Temp_Type X002 = AT(0, 2);
- const Temp_Type X003 = AT(0, 3);
- const Temp_Type X004 = AT(0, 4);
- const Temp_Type X005 = AT(0, 5);
- const Temp_Type X006 = AT(0, 6);
- const Temp_Type X007 = AT(0, 7);
- const Temp_Type X010 = D(F(0.415735f) * AT(1, 0) + F(0.791065f) * AT(3, 0) + F(-0.352443f) * AT(5, 0) + F(0.277785f) * AT(7, 0));
- const Temp_Type X011 = D(F(0.415735f) * AT(1, 1) + F(0.791065f) * AT(3, 1) + F(-0.352443f) * AT(5, 1) + F(0.277785f) * AT(7, 1));
- const Temp_Type X012 = D(F(0.415735f) * AT(1, 2) + F(0.791065f) * AT(3, 2) + F(-0.352443f) * AT(5, 2) + F(0.277785f) * AT(7, 2));
- const Temp_Type X013 = D(F(0.415735f) * AT(1, 3) + F(0.791065f) * AT(3, 3) + F(-0.352443f) * AT(5, 3) + F(0.277785f) * AT(7, 3));
- const Temp_Type X014 = D(F(0.415735f) * AT(1, 4) + F(0.791065f) * AT(3, 4) + F(-0.352443f) * AT(5, 4) + F(0.277785f) * AT(7, 4));
- const Temp_Type X015 = D(F(0.415735f) * AT(1, 5) + F(0.791065f) * AT(3, 5) + F(-0.352443f) * AT(5, 5) + F(0.277785f) * AT(7, 5));
- const Temp_Type X016 = D(F(0.415735f) * AT(1, 6) + F(0.791065f) * AT(3, 6) + F(-0.352443f) * AT(5, 6) + F(0.277785f) * AT(7, 6));
- const Temp_Type X017 = D(F(0.415735f) * AT(1, 7) + F(0.791065f) * AT(3, 7) + F(-0.352443f) * AT(5, 7) + F(0.277785f) * AT(7, 7));
- const Temp_Type X020 = AT(4, 0);
- const Temp_Type X021 = AT(4, 1);
- const Temp_Type X022 = AT(4, 2);
- const Temp_Type X023 = AT(4, 3);
- const Temp_Type X024 = AT(4, 4);
- const Temp_Type X025 = AT(4, 5);
- const Temp_Type X026 = AT(4, 6);
- const Temp_Type X027 = AT(4, 7);
- const Temp_Type X030 = D(F(0.022887f) * AT(1, 0) + F(-0.097545f) * AT(3, 0) + F(0.490393f) * AT(5, 0) + F(0.865723f) * AT(7, 0));
- const Temp_Type X031 = D(F(0.022887f) * AT(1, 1) + F(-0.097545f) * AT(3, 1) + F(0.490393f) * AT(5, 1) + F(0.865723f) * AT(7, 1));
- const Temp_Type X032 = D(F(0.022887f) * AT(1, 2) + F(-0.097545f) * AT(3, 2) + F(0.490393f) * AT(5, 2) + F(0.865723f) * AT(7, 2));
- const Temp_Type X033 = D(F(0.022887f) * AT(1, 3) + F(-0.097545f) * AT(3, 3) + F(0.490393f) * AT(5, 3) + F(0.865723f) * AT(7, 3));
- const Temp_Type X034 = D(F(0.022887f) * AT(1, 4) + F(-0.097545f) * AT(3, 4) + F(0.490393f) * AT(5, 4) + F(0.865723f) * AT(7, 4));
- const Temp_Type X035 = D(F(0.022887f) * AT(1, 5) + F(-0.097545f) * AT(3, 5) + F(0.490393f) * AT(5, 5) + F(0.865723f) * AT(7, 5));
- const Temp_Type X036 = D(F(0.022887f) * AT(1, 6) + F(-0.097545f) * AT(3, 6) + F(0.490393f) * AT(5, 6) + F(0.865723f) * AT(7, 6));
- const Temp_Type X037 = D(F(0.022887f) * AT(1, 7) + F(-0.097545f) * AT(3, 7) + F(0.490393f) * AT(5, 7) + F(0.865723f) * AT(7, 7));
-
- // 4x4 = 4x8 times 8x4, matrix 1 is constant
- P.at(0, 0) = X000;
- P.at(0, 1) = D(X001 * F(0.415735f) + X003 * F(0.791065f) + X005 * F(-0.352443f) + X007 * F(0.277785f));
- P.at(0, 2) = X004;
- P.at(0, 3) = D(X001 * F(0.022887f) + X003 * F(-0.097545f) + X005 * F(0.490393f) + X007 * F(0.865723f));
- P.at(1, 0) = X010;
- P.at(1, 1) = D(X011 * F(0.415735f) + X013 * F(0.791065f) + X015 * F(-0.352443f) + X017 * F(0.277785f));
- P.at(1, 2) = X014;
- P.at(1, 3) = D(X011 * F(0.022887f) + X013 * F(-0.097545f) + X015 * F(0.490393f) + X017 * F(0.865723f));
- P.at(2, 0) = X020;
- P.at(2, 1) = D(X021 * F(0.415735f) + X023 * F(0.791065f) + X025 * F(-0.352443f) + X027 * F(0.277785f));
- P.at(2, 2) = X024;
- P.at(2, 3) = D(X021 * F(0.022887f) + X023 * F(-0.097545f) + X025 * F(0.490393f) + X027 * F(0.865723f));
- P.at(3, 0) = X030;
- P.at(3, 1) = D(X031 * F(0.415735f) + X033 * F(0.791065f) + X035 * F(-0.352443f) + X037 * F(0.277785f));
- P.at(3, 2) = X034;
- P.at(3, 3) = D(X031 * F(0.022887f) + X033 * F(-0.097545f) + X035 * F(0.490393f) + X037 * F(0.865723f));
- // 40 muls 24 adds
-
- // 4x4 = 4x8 times 8x4, matrix 1 is constant
- Q.at(0, 0) = D(X001 * F(0.906127f) + X003 * F(-0.318190f) + X005 * F(0.212608f) + X007 * F(-0.180240f));
- Q.at(0, 1) = X002;
- Q.at(0, 2) = D(X001 * F(-0.074658f) + X003 * F(0.513280f) + X005 * F(0.768178f) + X007 * F(-0.375330f));
- Q.at(0, 3) = X006;
- Q.at(1, 0) = D(X011 * F(0.906127f) + X013 * F(-0.318190f) + X015 * F(0.212608f) + X017 * F(-0.180240f));
- Q.at(1, 1) = X012;
- Q.at(1, 2) = D(X011 * F(-0.074658f) + X013 * F(0.513280f) + X015 * F(0.768178f) + X017 * F(-0.375330f));
- Q.at(1, 3) = X016;
- Q.at(2, 0) = D(X021 * F(0.906127f) + X023 * F(-0.318190f) + X025 * F(0.212608f) + X027 * F(-0.180240f));
- Q.at(2, 1) = X022;
- Q.at(2, 2) = D(X021 * F(-0.074658f) + X023 * F(0.513280f) + X025 * F(0.768178f) + X027 * F(-0.375330f));
- Q.at(2, 3) = X026;
- Q.at(3, 0) = D(X031 * F(0.906127f) + X033 * F(-0.318190f) + X035 * F(0.212608f) + X037 * F(-0.180240f));
- Q.at(3, 1) = X032;
- Q.at(3, 2) = D(X031 * F(-0.074658f) + X033 * F(0.513280f) + X035 * F(0.768178f) + X037 * F(-0.375330f));
- Q.at(3, 3) = X036;
- // 40 muls 24 adds
- }
- };
-
- template<int NUM_ROWS, int NUM_COLS>
- struct R_S
- {
- static void calc(Matrix44& R, Matrix44& S, const jpgd_block_t* pSrc)
- {
- // 4x8 = 4x8 times 8x8, matrix 0 is constant
- const Temp_Type X100 = D(F(0.906127f) * AT(1, 0) + F(-0.318190f) * AT(3, 0) + F(0.212608f) * AT(5, 0) + F(-0.180240f) * AT(7, 0));
- const Temp_Type X101 = D(F(0.906127f) * AT(1, 1) + F(-0.318190f) * AT(3, 1) + F(0.212608f) * AT(5, 1) + F(-0.180240f) * AT(7, 1));
- const Temp_Type X102 = D(F(0.906127f) * AT(1, 2) + F(-0.318190f) * AT(3, 2) + F(0.212608f) * AT(5, 2) + F(-0.180240f) * AT(7, 2));
- const Temp_Type X103 = D(F(0.906127f) * AT(1, 3) + F(-0.318190f) * AT(3, 3) + F(0.212608f) * AT(5, 3) + F(-0.180240f) * AT(7, 3));
- const Temp_Type X104 = D(F(0.906127f) * AT(1, 4) + F(-0.318190f) * AT(3, 4) + F(0.212608f) * AT(5, 4) + F(-0.180240f) * AT(7, 4));
- const Temp_Type X105 = D(F(0.906127f) * AT(1, 5) + F(-0.318190f) * AT(3, 5) + F(0.212608f) * AT(5, 5) + F(-0.180240f) * AT(7, 5));
- const Temp_Type X106 = D(F(0.906127f) * AT(1, 6) + F(-0.318190f) * AT(3, 6) + F(0.212608f) * AT(5, 6) + F(-0.180240f) * AT(7, 6));
- const Temp_Type X107 = D(F(0.906127f) * AT(1, 7) + F(-0.318190f) * AT(3, 7) + F(0.212608f) * AT(5, 7) + F(-0.180240f) * AT(7, 7));
- const Temp_Type X110 = AT(2, 0);
- const Temp_Type X111 = AT(2, 1);
- const Temp_Type X112 = AT(2, 2);
- const Temp_Type X113 = AT(2, 3);
- const Temp_Type X114 = AT(2, 4);
- const Temp_Type X115 = AT(2, 5);
- const Temp_Type X116 = AT(2, 6);
- const Temp_Type X117 = AT(2, 7);
- const Temp_Type X120 = D(F(-0.074658f) * AT(1, 0) + F(0.513280f) * AT(3, 0) + F(0.768178f) * AT(5, 0) + F(-0.375330f) * AT(7, 0));
- const Temp_Type X121 = D(F(-0.074658f) * AT(1, 1) + F(0.513280f) * AT(3, 1) + F(0.768178f) * AT(5, 1) + F(-0.375330f) * AT(7, 1));
- const Temp_Type X122 = D(F(-0.074658f) * AT(1, 2) + F(0.513280f) * AT(3, 2) + F(0.768178f) * AT(5, 2) + F(-0.375330f) * AT(7, 2));
- const Temp_Type X123 = D(F(-0.074658f) * AT(1, 3) + F(0.513280f) * AT(3, 3) + F(0.768178f) * AT(5, 3) + F(-0.375330f) * AT(7, 3));
- const Temp_Type X124 = D(F(-0.074658f) * AT(1, 4) + F(0.513280f) * AT(3, 4) + F(0.768178f) * AT(5, 4) + F(-0.375330f) * AT(7, 4));
- const Temp_Type X125 = D(F(-0.074658f) * AT(1, 5) + F(0.513280f) * AT(3, 5) + F(0.768178f) * AT(5, 5) + F(-0.375330f) * AT(7, 5));
- const Temp_Type X126 = D(F(-0.074658f) * AT(1, 6) + F(0.513280f) * AT(3, 6) + F(0.768178f) * AT(5, 6) + F(-0.375330f) * AT(7, 6));
- const Temp_Type X127 = D(F(-0.074658f) * AT(1, 7) + F(0.513280f) * AT(3, 7) + F(0.768178f) * AT(5, 7) + F(-0.375330f) * AT(7, 7));
- const Temp_Type X130 = AT(6, 0);
- const Temp_Type X131 = AT(6, 1);
- const Temp_Type X132 = AT(6, 2);
- const Temp_Type X133 = AT(6, 3);
- const Temp_Type X134 = AT(6, 4);
- const Temp_Type X135 = AT(6, 5);
- const Temp_Type X136 = AT(6, 6);
- const Temp_Type X137 = AT(6, 7);
- // 80 muls 48 adds
-
- // 4x4 = 4x8 times 8x4, matrix 1 is constant
- R.at(0, 0) = X100;
- R.at(0, 1) = D(X101 * F(0.415735f) + X103 * F(0.791065f) + X105 * F(-0.352443f) + X107 * F(0.277785f));
- R.at(0, 2) = X104;
- R.at(0, 3) = D(X101 * F(0.022887f) + X103 * F(-0.097545f) + X105 * F(0.490393f) + X107 * F(0.865723f));
- R.at(1, 0) = X110;
- R.at(1, 1) = D(X111 * F(0.415735f) + X113 * F(0.791065f) + X115 * F(-0.352443f) + X117 * F(0.277785f));
- R.at(1, 2) = X114;
- R.at(1, 3) = D(X111 * F(0.022887f) + X113 * F(-0.097545f) + X115 * F(0.490393f) + X117 * F(0.865723f));
- R.at(2, 0) = X120;
- R.at(2, 1) = D(X121 * F(0.415735f) + X123 * F(0.791065f) + X125 * F(-0.352443f) + X127 * F(0.277785f));
- R.at(2, 2) = X124;
- R.at(2, 3) = D(X121 * F(0.022887f) + X123 * F(-0.097545f) + X125 * F(0.490393f) + X127 * F(0.865723f));
- R.at(3, 0) = X130;
- R.at(3, 1) = D(X131 * F(0.415735f) + X133 * F(0.791065f) + X135 * F(-0.352443f) + X137 * F(0.277785f));
- R.at(3, 2) = X134;
- R.at(3, 3) = D(X131 * F(0.022887f) + X133 * F(-0.097545f) + X135 * F(0.490393f) + X137 * F(0.865723f));
- // 40 muls 24 adds
- // 4x4 = 4x8 times 8x4, matrix 1 is constant
- S.at(0, 0) = D(X101 * F(0.906127f) + X103 * F(-0.318190f) + X105 * F(0.212608f) + X107 * F(-0.180240f));
- S.at(0, 1) = X102;
- S.at(0, 2) = D(X101 * F(-0.074658f) + X103 * F(0.513280f) + X105 * F(0.768178f) + X107 * F(-0.375330f));
- S.at(0, 3) = X106;
- S.at(1, 0) = D(X111 * F(0.906127f) + X113 * F(-0.318190f) + X115 * F(0.212608f) + X117 * F(-0.180240f));
- S.at(1, 1) = X112;
- S.at(1, 2) = D(X111 * F(-0.074658f) + X113 * F(0.513280f) + X115 * F(0.768178f) + X117 * F(-0.375330f));
- S.at(1, 3) = X116;
- S.at(2, 0) = D(X121 * F(0.906127f) + X123 * F(-0.318190f) + X125 * F(0.212608f) + X127 * F(-0.180240f));
- S.at(2, 1) = X122;
- S.at(2, 2) = D(X121 * F(-0.074658f) + X123 * F(0.513280f) + X125 * F(0.768178f) + X127 * F(-0.375330f));
- S.at(2, 3) = X126;
- S.at(3, 0) = D(X131 * F(0.906127f) + X133 * F(-0.318190f) + X135 * F(0.212608f) + X137 * F(-0.180240f));
- S.at(3, 1) = X132;
- S.at(3, 2) = D(X131 * F(-0.074658f) + X133 * F(0.513280f) + X135 * F(0.768178f) + X137 * F(-0.375330f));
- S.at(3, 3) = X136;
- // 40 muls 24 adds
- }
- };
-} // end namespace DCT_Upsample
-
-// Unconditionally frees all allocated m_blocks.
-void jpeg_decoder::free_all_blocks()
-{
- m_pStream = NULL;
- for (mem_block *b = m_pMem_blocks; b; )
- {
- mem_block *n = b->m_pNext;
- jpgd_free(b);
- b = n;
- }
- m_pMem_blocks = NULL;
-}
-
-// This method handles all errors. It will never return.
-// It could easily be changed to use C++ exceptions.
-JPGD_NORETURN void jpeg_decoder::stop_decoding(jpgd_status status)
-{
- m_error_code = status;
- free_all_blocks();
- longjmp(m_jmp_state, status);
-}
-
-void *jpeg_decoder::alloc(size_t nSize, bool zero)
-{
- nSize = (JPGD_MAX(nSize, 1) + 3) & ~3;
- char *rv = NULL;
- for (mem_block *b = m_pMem_blocks; b; b = b->m_pNext)
- {
- if ((b->m_used_count + nSize) <= b->m_size)
- {
- rv = b->m_data + b->m_used_count;
- b->m_used_count += nSize;
- break;
- }
- }
- if (!rv)
- {
- int capacity = JPGD_MAX(32768 - 256, (nSize + 2047) & ~2047);
- mem_block *b = (mem_block*)jpgd_malloc(sizeof(mem_block) + capacity);
- if (!b) { stop_decoding(JPGD_NOTENOUGHMEM); }
- b->m_pNext = m_pMem_blocks; m_pMem_blocks = b;
- b->m_used_count = nSize;
- b->m_size = capacity;
- rv = b->m_data;
- }
- if (zero) memset(rv, 0, nSize);
- return rv;
-}
-
-void jpeg_decoder::word_clear(void *p, uint16 c, uint n)
-{
- uint8 *pD = (uint8*)p;
- const uint8 l = c & 0xFF, h = (c >> 8) & 0xFF;
- while (n)
- {
- pD[0] = l; pD[1] = h; pD += 2;
- n--;
- }
-}
-
-// Refill the input buffer.
-// This method will sit in a loop until (A) the buffer is full or (B)
-// the stream's read() method reports and end of file condition.
-void jpeg_decoder::prep_in_buffer()
-{
- m_in_buf_left = 0;
- m_pIn_buf_ofs = m_in_buf;
-
- if (m_eof_flag)
- return;
-
- do
- {
- int bytes_read = m_pStream->read(m_in_buf + m_in_buf_left, JPGD_IN_BUF_SIZE - m_in_buf_left, &m_eof_flag);
- if (bytes_read == -1)
- stop_decoding(JPGD_STREAM_READ);
-
- m_in_buf_left += bytes_read;
- } while ((m_in_buf_left < JPGD_IN_BUF_SIZE) && (!m_eof_flag));
-
- m_total_bytes_read += m_in_buf_left;
-
- // Pad the end of the block with M_EOI (prevents the decompressor from going off the rails if the stream is invalid).
- // (This dates way back to when this decompressor was written in C/asm, and the all-asm Huffman decoder did some fancy things to increase perf.)
- word_clear(m_pIn_buf_ofs + m_in_buf_left, 0xD9FF, 64);
-}
-
-// Read a Huffman code table.
-void jpeg_decoder::read_dht_marker()
-{
- int i, index, count;
- uint8 huff_num[17];
- uint8 huff_val[256];
-
- uint num_left = get_bits(16);
-
- if (num_left < 2)
- stop_decoding(JPGD_BAD_DHT_MARKER);
-
- num_left -= 2;
-
- while (num_left)
- {
- index = get_bits(8);
-
- huff_num[0] = 0;
-
- count = 0;
-
- for (i = 1; i <= 16; i++)
- {
- huff_num[i] = static_cast<uint8>(get_bits(8));
- count += huff_num[i];
- }
-
- if (count > 255)
- stop_decoding(JPGD_BAD_DHT_COUNTS);
-
- for (i = 0; i < count; i++)
- huff_val[i] = static_cast<uint8>(get_bits(8));
-
- i = 1 + 16 + count;
-
- if (num_left < (uint)i)
- stop_decoding(JPGD_BAD_DHT_MARKER);
-
- num_left -= i;
-
- if ((index & 0x10) > 0x10)
- stop_decoding(JPGD_BAD_DHT_INDEX);
-
- index = (index & 0x0F) + ((index & 0x10) >> 4) * (JPGD_MAX_HUFF_TABLES >> 1);
-
- if (index >= JPGD_MAX_HUFF_TABLES)
- stop_decoding(JPGD_BAD_DHT_INDEX);
-
- if (!m_huff_num[index])
- m_huff_num[index] = (uint8 *)alloc(17);
-
- if (!m_huff_val[index])
- m_huff_val[index] = (uint8 *)alloc(256);
-
- m_huff_ac[index] = (index & 0x10) != 0;
- memcpy(m_huff_num[index], huff_num, 17);
- memcpy(m_huff_val[index], huff_val, 256);
- }
-}
-
-// Read a quantization table.
-void jpeg_decoder::read_dqt_marker()
-{
- int n, i, prec;
- uint num_left;
- uint temp;
-
- num_left = get_bits(16);
-
- if (num_left < 2)
- stop_decoding(JPGD_BAD_DQT_MARKER);
-
- num_left -= 2;
-
- while (num_left)
- {
- n = get_bits(8);
- prec = n >> 4;
- n &= 0x0F;
-
- if (n >= JPGD_MAX_QUANT_TABLES)
- stop_decoding(JPGD_BAD_DQT_TABLE);
-
- if (!m_quant[n])
- m_quant[n] = (jpgd_quant_t *)alloc(64 * sizeof(jpgd_quant_t));
-
- // read quantization entries, in zag order
- for (i = 0; i < 64; i++)
- {
- temp = get_bits(8);
-
- if (prec)
- temp = (temp << 8) + get_bits(8);
-
- m_quant[n][i] = static_cast<jpgd_quant_t>(temp);
- }
-
- i = 64 + 1;
-
- if (prec)
- i += 64;
-
- if (num_left < (uint)i)
- stop_decoding(JPGD_BAD_DQT_LENGTH);
-
- num_left -= i;
- }
-}
-
-// Read the start of frame (SOF) marker.
-void jpeg_decoder::read_sof_marker()
-{
- int i;
- uint num_left;
-
- num_left = get_bits(16);
-
- if (get_bits(8) != 8) /* precision: sorry, only 8-bit precision is supported right now */
- stop_decoding(JPGD_BAD_PRECISION);
-
- m_image_y_size = get_bits(16);
-
- if ((m_image_y_size < 1) || (m_image_y_size > JPGD_MAX_HEIGHT))
- stop_decoding(JPGD_BAD_HEIGHT);
-
- m_image_x_size = get_bits(16);
-
- if ((m_image_x_size < 1) || (m_image_x_size > JPGD_MAX_WIDTH))
- stop_decoding(JPGD_BAD_WIDTH);
-
- m_comps_in_frame = get_bits(8);
-
- if (m_comps_in_frame > JPGD_MAX_COMPONENTS)
- stop_decoding(JPGD_TOO_MANY_COMPONENTS);
-
- if (num_left != (uint)(m_comps_in_frame * 3 + 8))
- stop_decoding(JPGD_BAD_SOF_LENGTH);
-
- for (i = 0; i < m_comps_in_frame; i++)
- {
- m_comp_ident[i] = get_bits(8);
- m_comp_h_samp[i] = get_bits(4);
- m_comp_v_samp[i] = get_bits(4);
- m_comp_quant[i] = get_bits(8);
- }
-}
-
-// Used to skip unrecognized markers.
-void jpeg_decoder::skip_variable_marker()
-{
- uint num_left;
-
- num_left = get_bits(16);
-
- if (num_left < 2)
- stop_decoding(JPGD_BAD_VARIABLE_MARKER);
-
- num_left -= 2;
-
- while (num_left)
- {
- get_bits(8);
- num_left--;
- }
-}
-
-// Read a define restart interval (DRI) marker.
-void jpeg_decoder::read_dri_marker()
-{
- if (get_bits(16) != 4)
- stop_decoding(JPGD_BAD_DRI_LENGTH);
-
- m_restart_interval = get_bits(16);
-}
-
-// Read a start of scan (SOS) marker.
-void jpeg_decoder::read_sos_marker()
-{
- uint num_left;
- int i, ci, n, c, cc;
-
- num_left = get_bits(16);
-
- n = get_bits(8);
-
- m_comps_in_scan = n;
-
- num_left -= 3;
-
- if ( (num_left != (uint)(n * 2 + 3)) || (n < 1) || (n > JPGD_MAX_COMPS_IN_SCAN) )
- stop_decoding(JPGD_BAD_SOS_LENGTH);
-
- for (i = 0; i < n; i++)
- {
- cc = get_bits(8);
- c = get_bits(8);
- num_left -= 2;
-
- for (ci = 0; ci < m_comps_in_frame; ci++)
- if (cc == m_comp_ident[ci])
- break;
-
- if (ci >= m_comps_in_frame)
- stop_decoding(JPGD_BAD_SOS_COMP_ID);
-
- m_comp_list[i] = ci;
- m_comp_dc_tab[ci] = (c >> 4) & 15;
- m_comp_ac_tab[ci] = (c & 15) + (JPGD_MAX_HUFF_TABLES >> 1);
- }
-
- m_spectral_start = get_bits(8);
- m_spectral_end = get_bits(8);
- m_successive_high = get_bits(4);
- m_successive_low = get_bits(4);
-
- if (!m_progressive_flag)
- {
- m_spectral_start = 0;
- m_spectral_end = 63;
- }
-
- num_left -= 3;
-
- while (num_left) /* read past whatever is num_left */
- {
- get_bits(8);
- num_left--;
- }
-}
-
-// Finds the next marker.
-int jpeg_decoder::next_marker()
-{
- uint c, bytes;
-
- bytes = 0;
-
- do
- {
- do
- {
- bytes++;
- c = get_bits(8);
- } while (c != 0xFF);
-
- do
- {
- c = get_bits(8);
- } while (c == 0xFF);
-
- } while (c == 0);
-
- // If bytes > 0 here, there where extra bytes before the marker (not good).
-
- return c;
-}
-
-// Process markers. Returns when an SOFx, SOI, EOI, or SOS marker is
-// encountered.
-int jpeg_decoder::process_markers()
-{
- int c;
-
- for ( ; ; )
- {
- c = next_marker();
-
- switch (c)
- {
- case M_SOF0:
- case M_SOF1:
- case M_SOF2:
- case M_SOF3:
- case M_SOF5:
- case M_SOF6:
- case M_SOF7:
-// case M_JPG:
- case M_SOF9:
- case M_SOF10:
- case M_SOF11:
- case M_SOF13:
- case M_SOF14:
- case M_SOF15:
- case M_SOI:
- case M_EOI:
- case M_SOS:
- {
- return c;
- }
- case M_DHT:
- {
- read_dht_marker();
- break;
- }
- // No arithmitic support - dumb patents!
- case M_DAC:
- {
- stop_decoding(JPGD_NO_ARITHMITIC_SUPPORT);
- break;
- }
- case M_DQT:
- {
- read_dqt_marker();
- break;
- }
- case M_DRI:
- {
- read_dri_marker();
- break;
- }
- //case M_APP0: /* no need to read the JFIF marker */
-
- case M_JPG:
- case M_RST0: /* no parameters */
- case M_RST1:
- case M_RST2:
- case M_RST3:
- case M_RST4:
- case M_RST5:
- case M_RST6:
- case M_RST7:
- case M_TEM:
- {
- stop_decoding(JPGD_UNEXPECTED_MARKER);
- break;
- }
- default: /* must be DNL, DHP, EXP, APPn, JPGn, COM, or RESn or APP0 */
- {
- skip_variable_marker();
- break;
- }
- }
- }
-}
-
-// Finds the start of image (SOI) marker.
-// This code is rather defensive: it only checks the first 512 bytes to avoid
-// false positives.
-void jpeg_decoder::locate_soi_marker()
-{
- uint lastchar, thischar;
- uint bytesleft;
-
- lastchar = get_bits(8);
-
- thischar = get_bits(8);
-
- /* ok if it's a normal JPEG file without a special header */
-
- if ((lastchar == 0xFF) && (thischar == M_SOI))
- return;
-
- bytesleft = 4096; //512;
-
- for ( ; ; )
- {
- if (--bytesleft == 0)
- stop_decoding(JPGD_NOT_JPEG);
-
- lastchar = thischar;
-
- thischar = get_bits(8);
-
- if (lastchar == 0xFF)
- {
- if (thischar == M_SOI)
- break;
- else if (thischar == M_EOI) // get_bits will keep returning M_EOI if we read past the end
- stop_decoding(JPGD_NOT_JPEG);
- }
- }
-
- // Check the next character after marker: if it's not 0xFF, it can't be the start of the next marker, so the file is bad.
- thischar = (m_bit_buf >> 24) & 0xFF;
-
- if (thischar != 0xFF)
- stop_decoding(JPGD_NOT_JPEG);
-}
-
-// Find a start of frame (SOF) marker.
-void jpeg_decoder::locate_sof_marker()
-{
- locate_soi_marker();
-
- int c = process_markers();
-
- switch (c)
- {
- case M_SOF2:
- m_progressive_flag = JPGD_TRUE;
- case M_SOF0: /* baseline DCT */
- case M_SOF1: /* extended sequential DCT */
- {
- read_sof_marker();
- break;
- }
- case M_SOF9: /* Arithmitic coding */
- {
- stop_decoding(JPGD_NO_ARITHMITIC_SUPPORT);
- break;
- }
- default:
- {
- stop_decoding(JPGD_UNSUPPORTED_MARKER);
- break;
- }
- }
-}
-
-// Find a start of scan (SOS) marker.
-int jpeg_decoder::locate_sos_marker()
-{
- int c;
-
- c = process_markers();
-
- if (c == M_EOI)
- return JPGD_FALSE;
- else if (c != M_SOS)
- stop_decoding(JPGD_UNEXPECTED_MARKER);
-
- read_sos_marker();
-
- return JPGD_TRUE;
-}
-
-// Reset everything to default/uninitialized state.
-void jpeg_decoder::init(jpeg_decoder_stream *pStream)
-{
- m_pMem_blocks = NULL;
- m_error_code = JPGD_SUCCESS;
- m_ready_flag = false;
- m_image_x_size = m_image_y_size = 0;
- m_pStream = pStream;
- m_progressive_flag = JPGD_FALSE;
-
- memset(m_huff_ac, 0, sizeof(m_huff_ac));
- memset(m_huff_num, 0, sizeof(m_huff_num));
- memset(m_huff_val, 0, sizeof(m_huff_val));
- memset(m_quant, 0, sizeof(m_quant));
-
- m_scan_type = 0;
- m_comps_in_frame = 0;
-
- memset(m_comp_h_samp, 0, sizeof(m_comp_h_samp));
- memset(m_comp_v_samp, 0, sizeof(m_comp_v_samp));
- memset(m_comp_quant, 0, sizeof(m_comp_quant));
- memset(m_comp_ident, 0, sizeof(m_comp_ident));
- memset(m_comp_h_blocks, 0, sizeof(m_comp_h_blocks));
- memset(m_comp_v_blocks, 0, sizeof(m_comp_v_blocks));
-
- m_comps_in_scan = 0;
- memset(m_comp_list, 0, sizeof(m_comp_list));
- memset(m_comp_dc_tab, 0, sizeof(m_comp_dc_tab));
- memset(m_comp_ac_tab, 0, sizeof(m_comp_ac_tab));
-
- m_spectral_start = 0;
- m_spectral_end = 0;
- m_successive_low = 0;
- m_successive_high = 0;
- m_max_mcu_x_size = 0;
- m_max_mcu_y_size = 0;
- m_blocks_per_mcu = 0;
- m_max_blocks_per_row = 0;
- m_mcus_per_row = 0;
- m_mcus_per_col = 0;
- m_expanded_blocks_per_component = 0;
- m_expanded_blocks_per_mcu = 0;
- m_expanded_blocks_per_row = 0;
- m_freq_domain_chroma_upsample = false;
-
- memset(m_mcu_org, 0, sizeof(m_mcu_org));
-
- m_total_lines_left = 0;
- m_mcu_lines_left = 0;
- m_real_dest_bytes_per_scan_line = 0;
- m_dest_bytes_per_scan_line = 0;
- m_dest_bytes_per_pixel = 0;
-
- memset(m_pHuff_tabs, 0, sizeof(m_pHuff_tabs));
-
- memset(m_dc_coeffs, 0, sizeof(m_dc_coeffs));
- memset(m_ac_coeffs, 0, sizeof(m_ac_coeffs));
- memset(m_block_y_mcu, 0, sizeof(m_block_y_mcu));
-
- m_eob_run = 0;
-
- memset(m_block_y_mcu, 0, sizeof(m_block_y_mcu));
-
- m_pIn_buf_ofs = m_in_buf;
- m_in_buf_left = 0;
- m_eof_flag = false;
- m_tem_flag = 0;
-
- memset(m_in_buf_pad_start, 0, sizeof(m_in_buf_pad_start));
- memset(m_in_buf, 0, sizeof(m_in_buf));
- memset(m_in_buf_pad_end, 0, sizeof(m_in_buf_pad_end));
-
- m_restart_interval = 0;
- m_restarts_left = 0;
- m_next_restart_num = 0;
-
- m_max_mcus_per_row = 0;
- m_max_blocks_per_mcu = 0;
- m_max_mcus_per_col = 0;
-
- memset(m_last_dc_val, 0, sizeof(m_last_dc_val));
- m_pMCU_coefficients = NULL;
- m_pSample_buf = NULL;
-
- m_total_bytes_read = 0;
-
- m_pScan_line_0 = NULL;
- m_pScan_line_1 = NULL;
-
- // Ready the input buffer.
- prep_in_buffer();
-
- // Prime the bit buffer.
- m_bits_left = 16;
- m_bit_buf = 0;
-
- get_bits(16);
- get_bits(16);
-
- for (int i = 0; i < JPGD_MAX_BLOCKS_PER_MCU; i++)
- m_mcu_block_max_zag[i] = 64;
-}
-
-#define SCALEBITS 16
-#define ONE_HALF ((int) 1 << (SCALEBITS-1))
-#define FIX(x) ((int) ((x) * (1L<<SCALEBITS) + 0.5f))
-
-// Create a few tables that allow us to quickly convert YCbCr to RGB.
-void jpeg_decoder::create_look_ups()
-{
- for (int i = 0; i <= 255; i++)
- {
- int k = i - 128;
- m_crr[i] = ( FIX(1.40200f) * k + ONE_HALF) >> SCALEBITS;
- m_cbb[i] = ( FIX(1.77200f) * k + ONE_HALF) >> SCALEBITS;
- m_crg[i] = (-FIX(0.71414f)) * k;
- m_cbg[i] = (-FIX(0.34414f)) * k + ONE_HALF;
- }
-}
-
-// This method throws back into the stream any bytes that where read
-// into the bit buffer during initial marker scanning.
-void jpeg_decoder::fix_in_buffer()
-{
- // In case any 0xFF's where pulled into the buffer during marker scanning.
- JPGD_ASSERT((m_bits_left & 7) == 0);
-
- if (m_bits_left == 16)
- stuff_char( (uint8)(m_bit_buf & 0xFF));
-
- if (m_bits_left >= 8)
- stuff_char( (uint8)((m_bit_buf >> 8) & 0xFF));
-
- stuff_char((uint8)((m_bit_buf >> 16) & 0xFF));
- stuff_char((uint8)((m_bit_buf >> 24) & 0xFF));
-
- m_bits_left = 16;
- get_bits_no_markers(16);
- get_bits_no_markers(16);
-}
-
-void jpeg_decoder::transform_mcu(int mcu_row)
-{
- jpgd_block_t* pSrc_ptr = m_pMCU_coefficients;
- uint8* pDst_ptr = m_pSample_buf + mcu_row * m_blocks_per_mcu * 64;
-
- for (int mcu_block = 0; mcu_block < m_blocks_per_mcu; mcu_block++)
- {
- idct(pSrc_ptr, pDst_ptr, m_mcu_block_max_zag[mcu_block]);
- pSrc_ptr += 64;
- pDst_ptr += 64;
- }
-}
-
-static const uint8 s_max_rc[64] =
-{
- 17, 18, 34, 50, 50, 51, 52, 52, 52, 68, 84, 84, 84, 84, 85, 86, 86, 86, 86, 86,
- 102, 118, 118, 118, 118, 118, 118, 119, 120, 120, 120, 120, 120, 120, 120, 136,
- 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
- 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136
-};
-
-void jpeg_decoder::transform_mcu_expand(int mcu_row)
-{
- jpgd_block_t* pSrc_ptr = m_pMCU_coefficients;
- uint8* pDst_ptr = m_pSample_buf + mcu_row * m_expanded_blocks_per_mcu * 64;
-
- // Y IDCT
- int mcu_block;
- for (mcu_block = 0; mcu_block < m_expanded_blocks_per_component; mcu_block++)
- {
- idct(pSrc_ptr, pDst_ptr, m_mcu_block_max_zag[mcu_block]);
- pSrc_ptr += 64;
- pDst_ptr += 64;
- }
-
- // Chroma IDCT, with upsampling
- jpgd_block_t temp_block[64];
-
- for (int i = 0; i < 2; i++)
- {
- DCT_Upsample::Matrix44 P, Q, R, S;
-
- JPGD_ASSERT(m_mcu_block_max_zag[mcu_block] >= 1);
- JPGD_ASSERT(m_mcu_block_max_zag[mcu_block] <= 64);
-
- int max_zag = m_mcu_block_max_zag[mcu_block++] - 1;
- if (max_zag <= 0) max_zag = 0; // should never happen, only here to shut up static analysis
- switch (s_max_rc[max_zag])
- {
- case 1*16+1:
- DCT_Upsample::P_Q<1, 1>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<1, 1>::calc(R, S, pSrc_ptr);
- break;
- case 1*16+2:
- DCT_Upsample::P_Q<1, 2>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<1, 2>::calc(R, S, pSrc_ptr);
- break;
- case 2*16+2:
- DCT_Upsample::P_Q<2, 2>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<2, 2>::calc(R, S, pSrc_ptr);
- break;
- case 3*16+2:
- DCT_Upsample::P_Q<3, 2>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<3, 2>::calc(R, S, pSrc_ptr);
- break;
- case 3*16+3:
- DCT_Upsample::P_Q<3, 3>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<3, 3>::calc(R, S, pSrc_ptr);
- break;
- case 3*16+4:
- DCT_Upsample::P_Q<3, 4>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<3, 4>::calc(R, S, pSrc_ptr);
- break;
- case 4*16+4:
- DCT_Upsample::P_Q<4, 4>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<4, 4>::calc(R, S, pSrc_ptr);
- break;
- case 5*16+4:
- DCT_Upsample::P_Q<5, 4>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<5, 4>::calc(R, S, pSrc_ptr);
- break;
- case 5*16+5:
- DCT_Upsample::P_Q<5, 5>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<5, 5>::calc(R, S, pSrc_ptr);
- break;
- case 5*16+6:
- DCT_Upsample::P_Q<5, 6>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<5, 6>::calc(R, S, pSrc_ptr);
- break;
- case 6*16+6:
- DCT_Upsample::P_Q<6, 6>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<6, 6>::calc(R, S, pSrc_ptr);
- break;
- case 7*16+6:
- DCT_Upsample::P_Q<7, 6>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<7, 6>::calc(R, S, pSrc_ptr);
- break;
- case 7*16+7:
- DCT_Upsample::P_Q<7, 7>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<7, 7>::calc(R, S, pSrc_ptr);
- break;
- case 7*16+8:
- DCT_Upsample::P_Q<7, 8>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<7, 8>::calc(R, S, pSrc_ptr);
- break;
- case 8*16+8:
- DCT_Upsample::P_Q<8, 8>::calc(P, Q, pSrc_ptr);
- DCT_Upsample::R_S<8, 8>::calc(R, S, pSrc_ptr);
- break;
- default:
- JPGD_ASSERT(false);
- }
-
- DCT_Upsample::Matrix44 a(P + Q); P -= Q;
- DCT_Upsample::Matrix44& b = P;
- DCT_Upsample::Matrix44 c(R + S); R -= S;
- DCT_Upsample::Matrix44& d = R;
-
- DCT_Upsample::Matrix44::add_and_store(temp_block, a, c);
- idct_4x4(temp_block, pDst_ptr);
- pDst_ptr += 64;
-
- DCT_Upsample::Matrix44::sub_and_store(temp_block, a, c);
- idct_4x4(temp_block, pDst_ptr);
- pDst_ptr += 64;
-
- DCT_Upsample::Matrix44::add_and_store(temp_block, b, d);
- idct_4x4(temp_block, pDst_ptr);
- pDst_ptr += 64;
-
- DCT_Upsample::Matrix44::sub_and_store(temp_block, b, d);
- idct_4x4(temp_block, pDst_ptr);
- pDst_ptr += 64;
-
- pSrc_ptr += 64;
- }
-}
-
-// Loads and dequantizes the next row of (already decoded) coefficients.
-// Progressive images only.
-void jpeg_decoder::load_next_row()
-{
- int i;
- jpgd_block_t *p;
- jpgd_quant_t *q;
- int mcu_row, mcu_block, row_block = 0;
- int component_num, component_id;
- int block_x_mcu[JPGD_MAX_COMPONENTS];
-
- memset(block_x_mcu, 0, JPGD_MAX_COMPONENTS * sizeof(int));
-
- for (mcu_row = 0; mcu_row < m_mcus_per_row; mcu_row++)
- {
- int block_x_mcu_ofs = 0, block_y_mcu_ofs = 0;
-
- for (mcu_block = 0; mcu_block < m_blocks_per_mcu; mcu_block++)
- {
- component_id = m_mcu_org[mcu_block];
- q = m_quant[m_comp_quant[component_id]];
-
- p = m_pMCU_coefficients + 64 * mcu_block;
-
- jpgd_block_t* pAC = coeff_buf_getp(m_ac_coeffs[component_id], block_x_mcu[component_id] + block_x_mcu_ofs, m_block_y_mcu[component_id] + block_y_mcu_ofs);
- jpgd_block_t* pDC = coeff_buf_getp(m_dc_coeffs[component_id], block_x_mcu[component_id] + block_x_mcu_ofs, m_block_y_mcu[component_id] + block_y_mcu_ofs);
- p[0] = pDC[0];
- memcpy(&p[1], &pAC[1], 63 * sizeof(jpgd_block_t));
-
- for (i = 63; i > 0; i--)
- if (p[g_ZAG[i]])
- break;
-
- m_mcu_block_max_zag[mcu_block] = i + 1;
-
- for ( ; i >= 0; i--)
- if (p[g_ZAG[i]])
- p[g_ZAG[i]] = static_cast<jpgd_block_t>(p[g_ZAG[i]] * q[i]);
-
- row_block++;
-
- if (m_comps_in_scan == 1)
- block_x_mcu[component_id]++;
- else
- {
- if (++block_x_mcu_ofs == m_comp_h_samp[component_id])
- {
- block_x_mcu_ofs = 0;
-
- if (++block_y_mcu_ofs == m_comp_v_samp[component_id])
- {
- block_y_mcu_ofs = 0;
-
- block_x_mcu[component_id] += m_comp_h_samp[component_id];
- }
- }
- }
- }
-
- if (m_freq_domain_chroma_upsample)
- transform_mcu_expand(mcu_row);
- else
- transform_mcu(mcu_row);
- }
-
- if (m_comps_in_scan == 1)
- m_block_y_mcu[m_comp_list[0]]++;
- else
- {
- for (component_num = 0; component_num < m_comps_in_scan; component_num++)
- {
- component_id = m_comp_list[component_num];
-
- m_block_y_mcu[component_id] += m_comp_v_samp[component_id];
- }
- }
-}
-
-// Restart interval processing.
-void jpeg_decoder::process_restart()
-{
- int i;
- int c = 0;
-
- // Align to a byte boundry
- // FIXME: Is this really necessary? get_bits_no_markers() never reads in markers!
- //get_bits_no_markers(m_bits_left & 7);
-
- // Let's scan a little bit to find the marker, but not _too_ far.
- // 1536 is a "fudge factor" that determines how much to scan.
- for (i = 1536; i > 0; i--)
- if (get_char() == 0xFF)
- break;
-
- if (i == 0)
- stop_decoding(JPGD_BAD_RESTART_MARKER);
-
- for ( ; i > 0; i--)
- if ((c = get_char()) != 0xFF)
- break;
-
- if (i == 0)
- stop_decoding(JPGD_BAD_RESTART_MARKER);
-
- // Is it the expected marker? If not, something bad happened.
- if (c != (m_next_restart_num + M_RST0))
- stop_decoding(JPGD_BAD_RESTART_MARKER);
-
- // Reset each component's DC prediction values.
- memset(&m_last_dc_val, 0, m_comps_in_frame * sizeof(uint));
-
- m_eob_run = 0;
-
- m_restarts_left = m_restart_interval;
-
- m_next_restart_num = (m_next_restart_num + 1) & 7;
-
- // Get the bit buffer going again...
-
- m_bits_left = 16;
- get_bits_no_markers(16);
- get_bits_no_markers(16);
-}
-
-static inline int dequantize_ac(int c, int q) { c *= q; return c; }
-
-// Decodes and dequantizes the next row of coefficients.
-void jpeg_decoder::decode_next_row()
-{
- int row_block = 0;
-
- for (int mcu_row = 0; mcu_row < m_mcus_per_row; mcu_row++)
- {
- if ((m_restart_interval) && (m_restarts_left == 0))
- process_restart();
-
- jpgd_block_t* p = m_pMCU_coefficients;
- for (int mcu_block = 0; mcu_block < m_blocks_per_mcu; mcu_block++, p += 64)
- {
- int component_id = m_mcu_org[mcu_block];
- jpgd_quant_t* q = m_quant[m_comp_quant[component_id]];
-
- int r, s;
- s = huff_decode(m_pHuff_tabs[m_comp_dc_tab[component_id]], r);
- s = JPGD_HUFF_EXTEND(r, s);
-
- m_last_dc_val[component_id] = (s += m_last_dc_val[component_id]);
-
- p[0] = static_cast<jpgd_block_t>(s * q[0]);
-
- int prev_num_set = m_mcu_block_max_zag[mcu_block];
-
- huff_tables *pH = m_pHuff_tabs[m_comp_ac_tab[component_id]];
-
- int k;
- for (k = 1; k < 64; k++)
- {
- int extra_bits;
- s = huff_decode(pH, extra_bits);
-
- r = s >> 4;
- s &= 15;
-
- if (s)
- {
- if (r)
- {
- if ((k + r) > 63)
- stop_decoding(JPGD_DECODE_ERROR);
-
- if (k < prev_num_set)
- {
- int n = JPGD_MIN(r, prev_num_set - k);
- int kt = k;
- while (n--)
- p[g_ZAG[kt++]] = 0;
- }
-
- k += r;
- }
-
- s = JPGD_HUFF_EXTEND(extra_bits, s);
-
- JPGD_ASSERT(k < 64);
-
- p[g_ZAG[k]] = static_cast<jpgd_block_t>(dequantize_ac(s, q[k])); //s * q[k];
- }
- else
- {
- if (r == 15)
- {
- if ((k + 16) > 64)
- stop_decoding(JPGD_DECODE_ERROR);
-
- if (k < prev_num_set)
- {
- int n = JPGD_MIN(16, prev_num_set - k);
- int kt = k;
- while (n--)
- {
- JPGD_ASSERT(kt <= 63);
- p[g_ZAG[kt++]] = 0;
- }
- }
-
- k += 16 - 1; // - 1 because the loop counter is k
- JPGD_ASSERT(p[g_ZAG[k]] == 0);
- }
- else
- break;
- }
- }
-
- if (k < prev_num_set)
- {
- int kt = k;
- while (kt < prev_num_set)
- p[g_ZAG[kt++]] = 0;
- }
-
- m_mcu_block_max_zag[mcu_block] = k;
-
- row_block++;
- }
-
- if (m_freq_domain_chroma_upsample)
- transform_mcu_expand(mcu_row);
- else
- transform_mcu(mcu_row);
-
- m_restarts_left--;
- }
-}
-
-// YCbCr H1V1 (1x1:1:1, 3 m_blocks per MCU) to RGB
-void jpeg_decoder::H1V1Convert()
-{
- int row = m_max_mcu_y_size - m_mcu_lines_left;
- uint8 *d = m_pScan_line_0;
- uint8 *s = m_pSample_buf + row * 8;
-
- for (int i = m_max_mcus_per_row; i > 0; i--)
- {
- for (int j = 0; j < 8; j++)
- {
- int y = s[j];
- int cb = s[64+j];
- int cr = s[128+j];
-
- d[0] = clamp(y + m_crr[cr]);
- d[1] = clamp(y + ((m_crg[cr] + m_cbg[cb]) >> 16));
- d[2] = clamp(y + m_cbb[cb]);
- d[3] = 255;
-
- d += 4;
- }
-
- s += 64*3;
- }
-}
-
-// YCbCr H2V1 (2x1:1:1, 4 m_blocks per MCU) to RGB
-void jpeg_decoder::H2V1Convert()
-{
- int row = m_max_mcu_y_size - m_mcu_lines_left;
- uint8 *d0 = m_pScan_line_0;
- uint8 *y = m_pSample_buf + row * 8;
- uint8 *c = m_pSample_buf + 2*64 + row * 8;
-
- for (int i = m_max_mcus_per_row; i > 0; i--)
- {
- for (int l = 0; l < 2; l++)
- {
- for (int j = 0; j < 4; j++)
- {
- int cb = c[0];
- int cr = c[64];
-
- int rc = m_crr[cr];
- int gc = ((m_crg[cr] + m_cbg[cb]) >> 16);
- int bc = m_cbb[cb];
-
- int yy = y[j<<1];
- d0[0] = clamp(yy+rc);
- d0[1] = clamp(yy+gc);
- d0[2] = clamp(yy+bc);
- d0[3] = 255;
-
- yy = y[(j<<1)+1];
- d0[4] = clamp(yy+rc);
- d0[5] = clamp(yy+gc);
- d0[6] = clamp(yy+bc);
- d0[7] = 255;
-
- d0 += 8;
-
- c++;
- }
- y += 64;
- }
-
- y += 64*4 - 64*2;
- c += 64*4 - 8;
- }
-}
-
-// YCbCr H2V1 (1x2:1:1, 4 m_blocks per MCU) to RGB
-void jpeg_decoder::H1V2Convert()
-{
- int row = m_max_mcu_y_size - m_mcu_lines_left;
- uint8 *d0 = m_pScan_line_0;
- uint8 *d1 = m_pScan_line_1;
- uint8 *y;
- uint8 *c;
-
- if (row < 8)
- y = m_pSample_buf + row * 8;
- else
- y = m_pSample_buf + 64*1 + (row & 7) * 8;
-
- c = m_pSample_buf + 64*2 + (row >> 1) * 8;
-
- for (int i = m_max_mcus_per_row; i > 0; i--)
- {
- for (int j = 0; j < 8; j++)
- {
- int cb = c[0+j];
- int cr = c[64+j];
-
- int rc = m_crr[cr];
- int gc = ((m_crg[cr] + m_cbg[cb]) >> 16);
- int bc = m_cbb[cb];
-
- int yy = y[j];
- d0[0] = clamp(yy+rc);
- d0[1] = clamp(yy+gc);
- d0[2] = clamp(yy+bc);
- d0[3] = 255;
-
- yy = y[8+j];
- d1[0] = clamp(yy+rc);
- d1[1] = clamp(yy+gc);
- d1[2] = clamp(yy+bc);
- d1[3] = 255;
-
- d0 += 4;
- d1 += 4;
- }
-
- y += 64*4;
- c += 64*4;
- }
-}
-
-// YCbCr H2V2 (2x2:1:1, 6 m_blocks per MCU) to RGB
-void jpeg_decoder::H2V2Convert()
-{
- int row = m_max_mcu_y_size - m_mcu_lines_left;
- uint8 *d0 = m_pScan_line_0;
- uint8 *d1 = m_pScan_line_1;
- uint8 *y;
- uint8 *c;
-
- if (row < 8)
- y = m_pSample_buf + row * 8;
- else
- y = m_pSample_buf + 64*2 + (row & 7) * 8;
-
- c = m_pSample_buf + 64*4 + (row >> 1) * 8;
-
- for (int i = m_max_mcus_per_row; i > 0; i--)
- {
- for (int l = 0; l < 2; l++)
- {
- for (int j = 0; j < 8; j += 2)
- {
- int cb = c[0];
- int cr = c[64];
-
- int rc = m_crr[cr];
- int gc = ((m_crg[cr] + m_cbg[cb]) >> 16);
- int bc = m_cbb[cb];
-
- int yy = y[j];
- d0[0] = clamp(yy+rc);
- d0[1] = clamp(yy+gc);
- d0[2] = clamp(yy+bc);
- d0[3] = 255;
-
- yy = y[j+1];
- d0[4] = clamp(yy+rc);
- d0[5] = clamp(yy+gc);
- d0[6] = clamp(yy+bc);
- d0[7] = 255;
-
- yy = y[j+8];
- d1[0] = clamp(yy+rc);
- d1[1] = clamp(yy+gc);
- d1[2] = clamp(yy+bc);
- d1[3] = 255;
-
- yy = y[j+8+1];
- d1[4] = clamp(yy+rc);
- d1[5] = clamp(yy+gc);
- d1[6] = clamp(yy+bc);
- d1[7] = 255;
-
- d0 += 8;
- d1 += 8;
-
- c++;
- }
- y += 64;
- }
-
- y += 64*6 - 64*2;
- c += 64*6 - 8;
- }
-}
-
-// Y (1 block per MCU) to 8-bit grayscale
-void jpeg_decoder::gray_convert()
-{
- int row = m_max_mcu_y_size - m_mcu_lines_left;
- uint8 *d = m_pScan_line_0;
- uint8 *s = m_pSample_buf + row * 8;
-
- for (int i = m_max_mcus_per_row; i > 0; i--)
- {
- *(uint *)d = *(uint *)s;
- *(uint *)(&d[4]) = *(uint *)(&s[4]);
-
- s += 64;
- d += 8;
- }
-}
-
-void jpeg_decoder::expanded_convert()
-{
- int row = m_max_mcu_y_size - m_mcu_lines_left;
-
- uint8* Py = m_pSample_buf + (row / 8) * 64 * m_comp_h_samp[0] + (row & 7) * 8;
-
- uint8* d = m_pScan_line_0;
-
- for (int i = m_max_mcus_per_row; i > 0; i--)
- {
- for (int k = 0; k < m_max_mcu_x_size; k += 8)
- {
- const int Y_ofs = k * 8;
- const int Cb_ofs = Y_ofs + 64 * m_expanded_blocks_per_component;
- const int Cr_ofs = Y_ofs + 64 * m_expanded_blocks_per_component * 2;
- for (int j = 0; j < 8; j++)
- {
- int y = Py[Y_ofs + j];
- int cb = Py[Cb_ofs + j];
- int cr = Py[Cr_ofs + j];
-
- d[0] = clamp(y + m_crr[cr]);
- d[1] = clamp(y + ((m_crg[cr] + m_cbg[cb]) >> 16));
- d[2] = clamp(y + m_cbb[cb]);
- d[3] = 255;
-
- d += 4;
- }
- }
-
- Py += 64 * m_expanded_blocks_per_mcu;
- }
-}
-
-// Find end of image (EOI) marker, so we can return to the user the exact size of the input stream.
-void jpeg_decoder::find_eoi()
-{
- if (!m_progressive_flag)
- {
- // Attempt to read the EOI marker.
- //get_bits_no_markers(m_bits_left & 7);
-
- // Prime the bit buffer
- m_bits_left = 16;
- get_bits(16);
- get_bits(16);
-
- // The next marker _should_ be EOI
- process_markers();
- }
-
- m_total_bytes_read -= m_in_buf_left;
-}
-
-int jpeg_decoder::decode(const void** pScan_line, uint* pScan_line_len)
-{
- if ((m_error_code) || (!m_ready_flag))
- return JPGD_FAILED;
-
- if (m_total_lines_left == 0)
- return JPGD_DONE;
-
- if (m_mcu_lines_left == 0)
- {
- if (setjmp(m_jmp_state))
- return JPGD_FAILED;
-
- if (m_progressive_flag)
- load_next_row();
- else
- decode_next_row();
-
- // Find the EOI marker if that was the last row.
- if (m_total_lines_left <= m_max_mcu_y_size)
- find_eoi();
-
- m_mcu_lines_left = m_max_mcu_y_size;
- }
-
- if (m_freq_domain_chroma_upsample)
- {
- expanded_convert();
- *pScan_line = m_pScan_line_0;
- }
- else
- {
- switch (m_scan_type)
- {
- case JPGD_YH2V2:
- {
- if ((m_mcu_lines_left & 1) == 0)
- {
- H2V2Convert();
- *pScan_line = m_pScan_line_0;
- }
- else
- *pScan_line = m_pScan_line_1;
-
- break;
- }
- case JPGD_YH2V1:
- {
- H2V1Convert();
- *pScan_line = m_pScan_line_0;
- break;
- }
- case JPGD_YH1V2:
- {
- if ((m_mcu_lines_left & 1) == 0)
- {
- H1V2Convert();
- *pScan_line = m_pScan_line_0;
- }
- else
- *pScan_line = m_pScan_line_1;
-
- break;
- }
- case JPGD_YH1V1:
- {
- H1V1Convert();
- *pScan_line = m_pScan_line_0;
- break;
- }
- case JPGD_GRAYSCALE:
- {
- gray_convert();
- *pScan_line = m_pScan_line_0;
-
- break;
- }
- }
- }
-
- *pScan_line_len = m_real_dest_bytes_per_scan_line;
-
- m_mcu_lines_left--;
- m_total_lines_left--;
-
- return JPGD_SUCCESS;
-}
-
-// Creates the tables needed for efficient Huffman decoding.
-void jpeg_decoder::make_huff_table(int index, huff_tables *pH)
-{
- int p, i, l, si;
- uint8 huffsize[257];
- uint huffcode[257];
- uint code;
- uint subtree;
- int code_size;
- int lastp;
- int nextfreeentry;
- int currententry;
-
- pH->ac_table = m_huff_ac[index] != 0;
-
- p = 0;
-
- for (l = 1; l <= 16; l++)
- {
- for (i = 1; i <= m_huff_num[index][l]; i++)
- huffsize[p++] = static_cast<uint8>(l);
- }
-
- huffsize[p] = 0;
-
- lastp = p;
-
- code = 0;
- si = huffsize[0];
- p = 0;
-
- while (huffsize[p])
- {
- while (huffsize[p] == si)
- {
- huffcode[p++] = code;
- code++;
- }
-
- code <<= 1;
- si++;
- }
-
- memset(pH->look_up, 0, sizeof(pH->look_up));
- memset(pH->look_up2, 0, sizeof(pH->look_up2));
- memset(pH->tree, 0, sizeof(pH->tree));
- memset(pH->code_size, 0, sizeof(pH->code_size));
-
- nextfreeentry = -1;
-
- p = 0;
-
- while (p < lastp)
- {
- i = m_huff_val[index][p];
- code = huffcode[p];
- code_size = huffsize[p];
-
- pH->code_size[i] = static_cast<uint8>(code_size);
-
- if (code_size <= 8)
- {
- code <<= (8 - code_size);
-
- for (l = 1 << (8 - code_size); l > 0; l--)
- {
- JPGD_ASSERT(i < 256);
-
- pH->look_up[code] = i;
-
- bool has_extrabits = false;
- int extra_bits = 0;
- int num_extra_bits = i & 15;
-
- int bits_to_fetch = code_size;
- if (num_extra_bits)
- {
- int total_codesize = code_size + num_extra_bits;
- if (total_codesize <= 8)
- {
- has_extrabits = true;
- extra_bits = ((1 << num_extra_bits) - 1) & (code >> (8 - total_codesize));
- JPGD_ASSERT(extra_bits <= 0x7FFF);
- bits_to_fetch += num_extra_bits;
- }
- }
-
- if (!has_extrabits)
- pH->look_up2[code] = i | (bits_to_fetch << 8);
- else
- pH->look_up2[code] = i | 0x8000 | (extra_bits << 16) | (bits_to_fetch << 8);
-
- code++;
- }
- }
- else
- {
- subtree = (code >> (code_size - 8)) & 0xFF;
-
- currententry = pH->look_up[subtree];
-
- if (currententry == 0)
- {
- pH->look_up[subtree] = currententry = nextfreeentry;
- pH->look_up2[subtree] = currententry = nextfreeentry;
-
- nextfreeentry -= 2;
- }
-
- code <<= (16 - (code_size - 8));
-
- for (l = code_size; l > 9; l--)
- {
- if ((code & 0x8000) == 0)
- currententry--;
-
- if (pH->tree[-currententry - 1] == 0)
- {
- pH->tree[-currententry - 1] = nextfreeentry;
-
- currententry = nextfreeentry;
-
- nextfreeentry -= 2;
- }
- else
- currententry = pH->tree[-currententry - 1];
-
- code <<= 1;
- }
-
- if ((code & 0x8000) == 0)
- currententry--;
-
- pH->tree[-currententry - 1] = i;
- }
-
- p++;
- }
-}
-
-// Verifies the quantization tables needed for this scan are available.
-void jpeg_decoder::check_quant_tables()
-{
- for (int i = 0; i < m_comps_in_scan; i++)
- if (m_quant[m_comp_quant[m_comp_list[i]]] == NULL)
- stop_decoding(JPGD_UNDEFINED_QUANT_TABLE);
-}
-
-// Verifies that all the Huffman tables needed for this scan are available.
-void jpeg_decoder::check_huff_tables()
-{
- for (int i = 0; i < m_comps_in_scan; i++)
- {
- if ((m_spectral_start == 0) && (m_huff_num[m_comp_dc_tab[m_comp_list[i]]] == NULL))
- stop_decoding(JPGD_UNDEFINED_HUFF_TABLE);
-
- if ((m_spectral_end > 0) && (m_huff_num[m_comp_ac_tab[m_comp_list[i]]] == NULL))
- stop_decoding(JPGD_UNDEFINED_HUFF_TABLE);
- }
-
- for (int i = 0; i < JPGD_MAX_HUFF_TABLES; i++)
- if (m_huff_num[i])
- {
- if (!m_pHuff_tabs[i])
- m_pHuff_tabs[i] = (huff_tables *)alloc(sizeof(huff_tables));
-
- make_huff_table(i, m_pHuff_tabs[i]);
- }
-}
-
-// Determines the component order inside each MCU.
-// Also calcs how many MCU's are on each row, etc.
-void jpeg_decoder::calc_mcu_block_order()
-{
- int component_num, component_id;
- int max_h_samp = 0, max_v_samp = 0;
-
- for (component_id = 0; component_id < m_comps_in_frame; component_id++)
- {
- if (m_comp_h_samp[component_id] > max_h_samp)
- max_h_samp = m_comp_h_samp[component_id];
-
- if (m_comp_v_samp[component_id] > max_v_samp)
- max_v_samp = m_comp_v_samp[component_id];
- }
-
- for (component_id = 0; component_id < m_comps_in_frame; component_id++)
- {
- m_comp_h_blocks[component_id] = ((((m_image_x_size * m_comp_h_samp[component_id]) + (max_h_samp - 1)) / max_h_samp) + 7) / 8;
- m_comp_v_blocks[component_id] = ((((m_image_y_size * m_comp_v_samp[component_id]) + (max_v_samp - 1)) / max_v_samp) + 7) / 8;
- }
-
- if (m_comps_in_scan == 1)
- {
- m_mcus_per_row = m_comp_h_blocks[m_comp_list[0]];
- m_mcus_per_col = m_comp_v_blocks[m_comp_list[0]];
- }
- else
- {
- m_mcus_per_row = (((m_image_x_size + 7) / 8) + (max_h_samp - 1)) / max_h_samp;
- m_mcus_per_col = (((m_image_y_size + 7) / 8) + (max_v_samp - 1)) / max_v_samp;
- }
-
- if (m_comps_in_scan == 1)
- {
- m_mcu_org[0] = m_comp_list[0];
-
- m_blocks_per_mcu = 1;
- }
- else
- {
- m_blocks_per_mcu = 0;
-
- for (component_num = 0; component_num < m_comps_in_scan; component_num++)
- {
- int num_blocks;
-
- component_id = m_comp_list[component_num];
-
- num_blocks = m_comp_h_samp[component_id] * m_comp_v_samp[component_id];
-
- while (num_blocks--)
- m_mcu_org[m_blocks_per_mcu++] = component_id;
- }
- }
-}
-
-// Starts a new scan.
-int jpeg_decoder::init_scan()
-{
- if (!locate_sos_marker())
- return JPGD_FALSE;
-
- calc_mcu_block_order();
-
- check_huff_tables();
-
- check_quant_tables();
-
- memset(m_last_dc_val, 0, m_comps_in_frame * sizeof(uint));
-
- m_eob_run = 0;
-
- if (m_restart_interval)
- {
- m_restarts_left = m_restart_interval;
- m_next_restart_num = 0;
- }
-
- fix_in_buffer();
-
- return JPGD_TRUE;
-}
-
-// Starts a frame. Determines if the number of components or sampling factors
-// are supported.
-void jpeg_decoder::init_frame()
-{
- int i;
-
- if (m_comps_in_frame == 1)
- {
- if ((m_comp_h_samp[0] != 1) || (m_comp_v_samp[0] != 1))
- stop_decoding(JPGD_UNSUPPORTED_SAMP_FACTORS);
-
- m_scan_type = JPGD_GRAYSCALE;
- m_max_blocks_per_mcu = 1;
- m_max_mcu_x_size = 8;
- m_max_mcu_y_size = 8;
- }
- else if (m_comps_in_frame == 3)
- {
- if ( ((m_comp_h_samp[1] != 1) || (m_comp_v_samp[1] != 1)) ||
- ((m_comp_h_samp[2] != 1) || (m_comp_v_samp[2] != 1)) )
- stop_decoding(JPGD_UNSUPPORTED_SAMP_FACTORS);
-
- if ((m_comp_h_samp[0] == 1) && (m_comp_v_samp[0] == 1))
- {
- m_scan_type = JPGD_YH1V1;
-
- m_max_blocks_per_mcu = 3;
- m_max_mcu_x_size = 8;
- m_max_mcu_y_size = 8;
- }
- else if ((m_comp_h_samp[0] == 2) && (m_comp_v_samp[0] == 1))
- {
- m_scan_type = JPGD_YH2V1;
- m_max_blocks_per_mcu = 4;
- m_max_mcu_x_size = 16;
- m_max_mcu_y_size = 8;
- }
- else if ((m_comp_h_samp[0] == 1) && (m_comp_v_samp[0] == 2))
- {
- m_scan_type = JPGD_YH1V2;
- m_max_blocks_per_mcu = 4;
- m_max_mcu_x_size = 8;
- m_max_mcu_y_size = 16;
- }
- else if ((m_comp_h_samp[0] == 2) && (m_comp_v_samp[0] == 2))
- {
- m_scan_type = JPGD_YH2V2;
- m_max_blocks_per_mcu = 6;
- m_max_mcu_x_size = 16;
- m_max_mcu_y_size = 16;
- }
- else
- stop_decoding(JPGD_UNSUPPORTED_SAMP_FACTORS);
- }
- else
- stop_decoding(JPGD_UNSUPPORTED_COLORSPACE);
-
- m_max_mcus_per_row = (m_image_x_size + (m_max_mcu_x_size - 1)) / m_max_mcu_x_size;
- m_max_mcus_per_col = (m_image_y_size + (m_max_mcu_y_size - 1)) / m_max_mcu_y_size;
-
- // These values are for the *destination* pixels: after conversion.
- if (m_scan_type == JPGD_GRAYSCALE)
- m_dest_bytes_per_pixel = 1;
- else
- m_dest_bytes_per_pixel = 4;
-
- m_dest_bytes_per_scan_line = ((m_image_x_size + 15) & 0xFFF0) * m_dest_bytes_per_pixel;
-
- m_real_dest_bytes_per_scan_line = (m_image_x_size * m_dest_bytes_per_pixel);
-
- // Initialize two scan line buffers.
- m_pScan_line_0 = (uint8 *)alloc(m_dest_bytes_per_scan_line, true);
- if ((m_scan_type == JPGD_YH1V2) || (m_scan_type == JPGD_YH2V2))
- m_pScan_line_1 = (uint8 *)alloc(m_dest_bytes_per_scan_line, true);
-
- m_max_blocks_per_row = m_max_mcus_per_row * m_max_blocks_per_mcu;
-
- // Should never happen
- if (m_max_blocks_per_row > JPGD_MAX_BLOCKS_PER_ROW)
- stop_decoding(JPGD_ASSERTION_ERROR);
-
- // Allocate the coefficient buffer, enough for one MCU
- m_pMCU_coefficients = (jpgd_block_t*)alloc(m_max_blocks_per_mcu * 64 * sizeof(jpgd_block_t));
-
- for (i = 0; i < m_max_blocks_per_mcu; i++)
- m_mcu_block_max_zag[i] = 64;
-
- m_expanded_blocks_per_component = m_comp_h_samp[0] * m_comp_v_samp[0];
- m_expanded_blocks_per_mcu = m_expanded_blocks_per_component * m_comps_in_frame;
- m_expanded_blocks_per_row = m_max_mcus_per_row * m_expanded_blocks_per_mcu;
- // Freq. domain chroma upsampling is only supported for H2V2 subsampling factor (the most common one I've seen).
- m_freq_domain_chroma_upsample = false;
-#if JPGD_SUPPORT_FREQ_DOMAIN_UPSAMPLING
- m_freq_domain_chroma_upsample = (m_expanded_blocks_per_mcu == 4*3);
-#endif
-
- if (m_freq_domain_chroma_upsample)
- m_pSample_buf = (uint8 *)alloc(m_expanded_blocks_per_row * 64);
- else
- m_pSample_buf = (uint8 *)alloc(m_max_blocks_per_row * 64);
-
- m_total_lines_left = m_image_y_size;
-
- m_mcu_lines_left = 0;
-
- create_look_ups();
-}
-
-// The coeff_buf series of methods originally stored the coefficients
-// into a "virtual" file which was located in EMS, XMS, or a disk file. A cache
-// was used to make this process more efficient. Now, we can store the entire
-// thing in RAM.
-jpeg_decoder::coeff_buf* jpeg_decoder::coeff_buf_open(int block_num_x, int block_num_y, int block_len_x, int block_len_y)
-{
- coeff_buf* cb = (coeff_buf*)alloc(sizeof(coeff_buf));
-
- cb->block_num_x = block_num_x;
- cb->block_num_y = block_num_y;
- cb->block_len_x = block_len_x;
- cb->block_len_y = block_len_y;
- cb->block_size = (block_len_x * block_len_y) * sizeof(jpgd_block_t);
- cb->pData = (uint8 *)alloc(cb->block_size * block_num_x * block_num_y, true);
- return cb;
-}
-
-inline jpgd_block_t *jpeg_decoder::coeff_buf_getp(coeff_buf *cb, int block_x, int block_y)
-{
- JPGD_ASSERT((block_x < cb->block_num_x) && (block_y < cb->block_num_y));
- return (jpgd_block_t *)(cb->pData + block_x * cb->block_size + block_y * (cb->block_size * cb->block_num_x));
-}
-
-// The following methods decode the various types of m_blocks encountered
-// in progressively encoded images.
-void jpeg_decoder::decode_block_dc_first(jpeg_decoder *pD, int component_id, int block_x, int block_y)
-{
- int s, r;
- jpgd_block_t *p = pD->coeff_buf_getp(pD->m_dc_coeffs[component_id], block_x, block_y);
-
- if ((s = pD->huff_decode(pD->m_pHuff_tabs[pD->m_comp_dc_tab[component_id]])) != 0)
- {
- r = pD->get_bits_no_markers(s);
- s = JPGD_HUFF_EXTEND(r, s);
- }
-
- pD->m_last_dc_val[component_id] = (s += pD->m_last_dc_val[component_id]);
-
- p[0] = static_cast<jpgd_block_t>(s << pD->m_successive_low);
-}
-
-void jpeg_decoder::decode_block_dc_refine(jpeg_decoder *pD, int component_id, int block_x, int block_y)
-{
- if (pD->get_bits_no_markers(1))
- {
- jpgd_block_t *p = pD->coeff_buf_getp(pD->m_dc_coeffs[component_id], block_x, block_y);
-
- p[0] |= (1 << pD->m_successive_low);
- }
-}
-
-void jpeg_decoder::decode_block_ac_first(jpeg_decoder *pD, int component_id, int block_x, int block_y)
-{
- int k, s, r;
-
- if (pD->m_eob_run)
- {
- pD->m_eob_run--;
- return;
- }
-
- jpgd_block_t *p = pD->coeff_buf_getp(pD->m_ac_coeffs[component_id], block_x, block_y);
-
- for (k = pD->m_spectral_start; k <= pD->m_spectral_end; k++)
- {
- s = pD->huff_decode(pD->m_pHuff_tabs[pD->m_comp_ac_tab[component_id]]);
-
- r = s >> 4;
- s &= 15;
-
- if (s)
- {
- if ((k += r) > 63)
- pD->stop_decoding(JPGD_DECODE_ERROR);
-
- r = pD->get_bits_no_markers(s);
- s = JPGD_HUFF_EXTEND(r, s);
-
- p[g_ZAG[k]] = static_cast<jpgd_block_t>(s << pD->m_successive_low);
- }
- else
- {
- if (r == 15)
- {
- if ((k += 15) > 63)
- pD->stop_decoding(JPGD_DECODE_ERROR);
- }
- else
- {
- pD->m_eob_run = 1 << r;
-
- if (r)
- pD->m_eob_run += pD->get_bits_no_markers(r);
-
- pD->m_eob_run--;
-
- break;
- }
- }
- }
-}
-
-void jpeg_decoder::decode_block_ac_refine(jpeg_decoder *pD, int component_id, int block_x, int block_y)
-{
- int s, k, r;
- int p1 = 1 << pD->m_successive_low;
- int m1 = (-1) << pD->m_successive_low;
- jpgd_block_t *p = pD->coeff_buf_getp(pD->m_ac_coeffs[component_id], block_x, block_y);
-
- JPGD_ASSERT(pD->m_spectral_end <= 63);
-
- k = pD->m_spectral_start;
-
- if (pD->m_eob_run == 0)
- {
- for ( ; k <= pD->m_spectral_end; k++)
- {
- s = pD->huff_decode(pD->m_pHuff_tabs[pD->m_comp_ac_tab[component_id]]);
-
- r = s >> 4;
- s &= 15;
-
- if (s)
- {
- if (s != 1)
- pD->stop_decoding(JPGD_DECODE_ERROR);
-
- if (pD->get_bits_no_markers(1))
- s = p1;
- else
- s = m1;
- }
- else
- {
- if (r != 15)
- {
- pD->m_eob_run = 1 << r;
-
- if (r)
- pD->m_eob_run += pD->get_bits_no_markers(r);
-
- break;
- }
- }
-
- do
- {
- jpgd_block_t *this_coef = p + g_ZAG[k & 63];
-
- if (*this_coef != 0)
- {
- if (pD->get_bits_no_markers(1))
- {
- if ((*this_coef & p1) == 0)
- {
- if (*this_coef >= 0)
- *this_coef = static_cast<jpgd_block_t>(*this_coef + p1);
- else
- *this_coef = static_cast<jpgd_block_t>(*this_coef + m1);
- }
- }
- }
- else
- {
- if (--r < 0)
- break;
- }
-
- k++;
-
- } while (k <= pD->m_spectral_end);
-
- if ((s) && (k < 64))
- {
- p[g_ZAG[k]] = static_cast<jpgd_block_t>(s);
- }
- }
- }
-
- if (pD->m_eob_run > 0)
- {
- for ( ; k <= pD->m_spectral_end; k++)
- {
- jpgd_block_t *this_coef = p + g_ZAG[k & 63]; // logical AND to shut up static code analysis
-
- if (*this_coef != 0)
- {
- if (pD->get_bits_no_markers(1))
- {
- if ((*this_coef & p1) == 0)
- {
- if (*this_coef >= 0)
- *this_coef = static_cast<jpgd_block_t>(*this_coef + p1);
- else
- *this_coef = static_cast<jpgd_block_t>(*this_coef + m1);
- }
- }
- }
- }
-
- pD->m_eob_run--;
- }
-}
-
-// Decode a scan in a progressively encoded image.
-void jpeg_decoder::decode_scan(pDecode_block_func decode_block_func)
-{
- int mcu_row, mcu_col, mcu_block;
- int block_x_mcu[JPGD_MAX_COMPONENTS], m_block_y_mcu[JPGD_MAX_COMPONENTS];
-
- memset(m_block_y_mcu, 0, sizeof(m_block_y_mcu));
-
- for (mcu_col = 0; mcu_col < m_mcus_per_col; mcu_col++)
- {
- int component_num, component_id;
-
- memset(block_x_mcu, 0, sizeof(block_x_mcu));
-
- for (mcu_row = 0; mcu_row < m_mcus_per_row; mcu_row++)
- {
- int block_x_mcu_ofs = 0, block_y_mcu_ofs = 0;
-
- if ((m_restart_interval) && (m_restarts_left == 0))
- process_restart();
-
- for (mcu_block = 0; mcu_block < m_blocks_per_mcu; mcu_block++)
- {
- component_id = m_mcu_org[mcu_block];
-
- decode_block_func(this, component_id, block_x_mcu[component_id] + block_x_mcu_ofs, m_block_y_mcu[component_id] + block_y_mcu_ofs);
-
- if (m_comps_in_scan == 1)
- block_x_mcu[component_id]++;
- else
- {
- if (++block_x_mcu_ofs == m_comp_h_samp[component_id])
- {
- block_x_mcu_ofs = 0;
-
- if (++block_y_mcu_ofs == m_comp_v_samp[component_id])
- {
- block_y_mcu_ofs = 0;
- block_x_mcu[component_id] += m_comp_h_samp[component_id];
- }
- }
- }
- }
-
- m_restarts_left--;
- }
-
- if (m_comps_in_scan == 1)
- m_block_y_mcu[m_comp_list[0]]++;
- else
- {
- for (component_num = 0; component_num < m_comps_in_scan; component_num++)
- {
- component_id = m_comp_list[component_num];
- m_block_y_mcu[component_id] += m_comp_v_samp[component_id];
- }
- }
- }
-}
-
-// Decode a progressively encoded image.
-void jpeg_decoder::init_progressive()
-{
- int i;
-
- if (m_comps_in_frame == 4)
- stop_decoding(JPGD_UNSUPPORTED_COLORSPACE);
-
- // Allocate the coefficient buffers.
- for (i = 0; i < m_comps_in_frame; i++)
- {
- m_dc_coeffs[i] = coeff_buf_open(m_max_mcus_per_row * m_comp_h_samp[i], m_max_mcus_per_col * m_comp_v_samp[i], 1, 1);
- m_ac_coeffs[i] = coeff_buf_open(m_max_mcus_per_row * m_comp_h_samp[i], m_max_mcus_per_col * m_comp_v_samp[i], 8, 8);
- }
-
- for ( ; ; )
- {
- int dc_only_scan, refinement_scan;
- pDecode_block_func decode_block_func;
-
- if (!init_scan())
- break;
-
- dc_only_scan = (m_spectral_start == 0);
- refinement_scan = (m_successive_high != 0);
-
- if ((m_spectral_start > m_spectral_end) || (m_spectral_end > 63))
- stop_decoding(JPGD_BAD_SOS_SPECTRAL);
-
- if (dc_only_scan)
- {
- if (m_spectral_end)
- stop_decoding(JPGD_BAD_SOS_SPECTRAL);
- }
- else if (m_comps_in_scan != 1) /* AC scans can only contain one component */
- stop_decoding(JPGD_BAD_SOS_SPECTRAL);
-
- if ((refinement_scan) && (m_successive_low != m_successive_high - 1))
- stop_decoding(JPGD_BAD_SOS_SUCCESSIVE);
-
- if (dc_only_scan)
- {
- if (refinement_scan)
- decode_block_func = decode_block_dc_refine;
- else
- decode_block_func = decode_block_dc_first;
- }
- else
- {
- if (refinement_scan)
- decode_block_func = decode_block_ac_refine;
- else
- decode_block_func = decode_block_ac_first;
- }
-
- decode_scan(decode_block_func);
-
- m_bits_left = 16;
- get_bits(16);
- get_bits(16);
- }
-
- m_comps_in_scan = m_comps_in_frame;
-
- for (i = 0; i < m_comps_in_frame; i++)
- m_comp_list[i] = i;
-
- calc_mcu_block_order();
-}
-
-void jpeg_decoder::init_sequential()
-{
- if (!init_scan())
- stop_decoding(JPGD_UNEXPECTED_MARKER);
-}
-
-void jpeg_decoder::decode_start()
-{
- init_frame();
-
- if (m_progressive_flag)
- init_progressive();
- else
- init_sequential();
-}
-
-void jpeg_decoder::decode_init(jpeg_decoder_stream *pStream)
-{
- init(pStream);
- locate_sof_marker();
-}
-
-jpeg_decoder::jpeg_decoder(jpeg_decoder_stream *pStream)
-{
- if (setjmp(m_jmp_state))
- return;
- decode_init(pStream);
-}
-
-int jpeg_decoder::begin_decoding()
-{
- if (m_ready_flag)
- return JPGD_SUCCESS;
-
- if (m_error_code)
- return JPGD_FAILED;
-
- if (setjmp(m_jmp_state))
- return JPGD_FAILED;
-
- decode_start();
-
- m_ready_flag = true;
-
- return JPGD_SUCCESS;
-}
-
-jpeg_decoder::~jpeg_decoder()
-{
- free_all_blocks();
-}
-
-jpeg_decoder_file_stream::jpeg_decoder_file_stream()
-{
- m_pFile = NULL;
- m_eof_flag = false;
- m_error_flag = false;
-}
-
-void jpeg_decoder_file_stream::close()
-{
- if (m_pFile)
- {
- fclose(m_pFile);
- m_pFile = NULL;
- }
-
- m_eof_flag = false;
- m_error_flag = false;
-}
-
-jpeg_decoder_file_stream::~jpeg_decoder_file_stream()
-{
- close();
-}
-
-bool jpeg_decoder_file_stream::open(const char *Pfilename)
-{
- close();
-
- m_eof_flag = false;
- m_error_flag = false;
-
-#if defined(_MSC_VER)
- m_pFile = NULL;
- fopen_s(&m_pFile, Pfilename, "rb");
-#else
- m_pFile = fopen(Pfilename, "rb");
-#endif
- return m_pFile != NULL;
-}
-
-int jpeg_decoder_file_stream::read(uint8 *pBuf, int max_bytes_to_read, bool *pEOF_flag)
-{
- if (!m_pFile)
- return -1;
-
- if (m_eof_flag)
- {
- *pEOF_flag = true;
- return 0;
- }
-
- if (m_error_flag)
- return -1;
-
- int bytes_read = static_cast<int>(fread(pBuf, 1, max_bytes_to_read, m_pFile));
- if (bytes_read < max_bytes_to_read)
- {
- if (ferror(m_pFile))
- {
- m_error_flag = true;
- return -1;
- }
-
- m_eof_flag = true;
- *pEOF_flag = true;
- }
-
- return bytes_read;
-}
-
-bool jpeg_decoder_mem_stream::open(const uint8 *pSrc_data, uint size)
-{
- close();
- m_pSrc_data = pSrc_data;
- m_ofs = 0;
- m_size = size;
- return true;
-}
-
-int jpeg_decoder_mem_stream::read(uint8 *pBuf, int max_bytes_to_read, bool *pEOF_flag)
-{
- *pEOF_flag = false;
-
- if (!m_pSrc_data)
- return -1;
-
- uint bytes_remaining = m_size - m_ofs;
- if ((uint)max_bytes_to_read > bytes_remaining)
- {
- max_bytes_to_read = bytes_remaining;
- *pEOF_flag = true;
- }
-
- memcpy(pBuf, m_pSrc_data + m_ofs, max_bytes_to_read);
- m_ofs += max_bytes_to_read;
-
- return max_bytes_to_read;
-}
-
-unsigned char *decompress_jpeg_image_from_stream(jpeg_decoder_stream *pStream, int *width, int *height, int *actual_comps, int req_comps)
-{
- if (!actual_comps)
- return NULL;
- *actual_comps = 0;
-
- if ((!pStream) || (!width) || (!height) || (!req_comps))
- return NULL;
-
- if ((req_comps != 1) && (req_comps != 3) && (req_comps != 4))
- return NULL;
-
- jpeg_decoder decoder(pStream);
- if (decoder.get_error_code() != JPGD_SUCCESS)
- return NULL;
-
- const int image_width = decoder.get_width(), image_height = decoder.get_height();
- *width = image_width;
- *height = image_height;
- *actual_comps = decoder.get_num_components();
-
- if (decoder.begin_decoding() != JPGD_SUCCESS)
- return NULL;
-
- const int dst_bpl = image_width * req_comps;
-
- uint8 *pImage_data = (uint8*)jpgd_malloc(dst_bpl * image_height);
- if (!pImage_data)
- return NULL;
-
- for (int y = 0; y < image_height; y++)
- {
- const uint8* pScan_line;
- uint scan_line_len;
- if (decoder.decode((const void**)&pScan_line, &scan_line_len) != JPGD_SUCCESS)
- {
- jpgd_free(pImage_data);
- return NULL;
- }
-
- uint8 *pDst = pImage_data + y * dst_bpl;
-
- if (((req_comps == 1) && (decoder.get_num_components() == 1)) || ((req_comps == 4) && (decoder.get_num_components() == 3)))
- memcpy(pDst, pScan_line, dst_bpl);
- else if (decoder.get_num_components() == 1)
- {
- if (req_comps == 3)
- {
- for (int x = 0; x < image_width; x++)
- {
- uint8 luma = pScan_line[x];
- pDst[0] = luma;
- pDst[1] = luma;
- pDst[2] = luma;
- pDst += 3;
- }
- }
- else
- {
- for (int x = 0; x < image_width; x++)
- {
- uint8 luma = pScan_line[x];
- pDst[0] = luma;
- pDst[1] = luma;
- pDst[2] = luma;
- pDst[3] = 255;
- pDst += 4;
- }
- }
- }
- else if (decoder.get_num_components() == 3)
- {
- if (req_comps == 1)
- {
- const int YR = 19595, YG = 38470, YB = 7471;
- for (int x = 0; x < image_width; x++)
- {
- int r = pScan_line[x*4+0];
- int g = pScan_line[x*4+1];
- int b = pScan_line[x*4+2];
- *pDst++ = static_cast<uint8>((r * YR + g * YG + b * YB + 32768) >> 16);
- }
- }
- else
- {
- for (int x = 0; x < image_width; x++)
- {
- pDst[0] = pScan_line[x*4+0];
- pDst[1] = pScan_line[x*4+1];
- pDst[2] = pScan_line[x*4+2];
- pDst += 3;
- }
- }
- }
- }
-
- return pImage_data;
-}
-
-unsigned char *decompress_jpeg_image_from_memory(const unsigned char *pSrc_data, int src_data_size, int *width, int *height, int *actual_comps, int req_comps)
-{
- jpgd::jpeg_decoder_mem_stream mem_stream(pSrc_data, src_data_size);
- return decompress_jpeg_image_from_stream(&mem_stream, width, height, actual_comps, req_comps);
-}
-
-unsigned char *decompress_jpeg_image_from_file(const char *pSrc_filename, int *width, int *height, int *actual_comps, int req_comps)
-{
- jpgd::jpeg_decoder_file_stream file_stream;
- if (!file_stream.open(pSrc_filename))
- return NULL;
- return decompress_jpeg_image_from_stream(&file_stream, width, height, actual_comps, req_comps);
-}
-
-} // namespace jpgd
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_jpgd.h b/Libraries/crunch-ea9b8d/crnlib/crn_jpgd.h
deleted file mode 100644
index 46069a1f..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_jpgd.h
+++ /dev/null
@@ -1,319 +0,0 @@
-// jpgd.h - C++ class for JPEG decompression.
-// Public domain, Rich Geldreich <richgel99@gmail.com>
-#ifndef JPEG_DECODER_H
-#define JPEG_DECODER_H
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <setjmp.h>
-
-#ifdef _MSC_VER
- #define JPGD_NORETURN __declspec(noreturn)
-#elif defined(__GNUC__)
- #define JPGD_NORETURN __attribute__ ((noreturn))
-#else
- #define JPGD_NORETURN
-#endif
-
-namespace jpgd
-{
- typedef unsigned char uint8;
- typedef signed short int16;
- typedef unsigned short uint16;
- typedef unsigned int uint;
- typedef signed int int32;
-
- // Loads a JPEG image from a memory buffer or a file.
- // req_comps can be 1 (grayscale), 3 (RGB), or 4 (RGBA).
- // On return, width/height will be set to the image's dimensions, and actual_comps will be set to the either 1 (grayscale) or 3 (RGB).
- // Notes: For more control over where and how the source data is read, see the decompress_jpeg_image_from_stream() function below, or call the jpeg_decoder class directly.
- // Requesting a 8 or 32bpp image is currently a little faster than 24bpp because the jpeg_decoder class itself currently always unpacks to either 8 or 32bpp.
- unsigned char *decompress_jpeg_image_from_memory(const unsigned char *pSrc_data, int src_data_size, int *width, int *height, int *actual_comps, int req_comps);
- unsigned char *decompress_jpeg_image_from_file(const char *pSrc_filename, int *width, int *height, int *actual_comps, int req_comps);
-
- // Success/failure error codes.
- enum jpgd_status
- {
- JPGD_SUCCESS = 0, JPGD_FAILED = -1, JPGD_DONE = 1,
- JPGD_BAD_DHT_COUNTS = -256, JPGD_BAD_DHT_INDEX, JPGD_BAD_DHT_MARKER, JPGD_BAD_DQT_MARKER, JPGD_BAD_DQT_TABLE,
- JPGD_BAD_PRECISION, JPGD_BAD_HEIGHT, JPGD_BAD_WIDTH, JPGD_TOO_MANY_COMPONENTS,
- JPGD_BAD_SOF_LENGTH, JPGD_BAD_VARIABLE_MARKER, JPGD_BAD_DRI_LENGTH, JPGD_BAD_SOS_LENGTH,
- JPGD_BAD_SOS_COMP_ID, JPGD_W_EXTRA_BYTES_BEFORE_MARKER, JPGD_NO_ARITHMITIC_SUPPORT, JPGD_UNEXPECTED_MARKER,
- JPGD_NOT_JPEG, JPGD_UNSUPPORTED_MARKER, JPGD_BAD_DQT_LENGTH, JPGD_TOO_MANY_BLOCKS,
- JPGD_UNDEFINED_QUANT_TABLE, JPGD_UNDEFINED_HUFF_TABLE, JPGD_NOT_SINGLE_SCAN, JPGD_UNSUPPORTED_COLORSPACE,
- JPGD_UNSUPPORTED_SAMP_FACTORS, JPGD_DECODE_ERROR, JPGD_BAD_RESTART_MARKER, JPGD_ASSERTION_ERROR,
- JPGD_BAD_SOS_SPECTRAL, JPGD_BAD_SOS_SUCCESSIVE, JPGD_STREAM_READ, JPGD_NOTENOUGHMEM
- };
-
- // Input stream interface.
- // Derive from this class to read input data from sources other than files or memory. Set m_eof_flag to true when no more data is available.
- // The decoder is rather greedy: it will keep on calling this method until its internal input buffer is full, or until the EOF flag is set.
- // It the input stream contains data after the JPEG stream's EOI (end of image) marker it will probably be pulled into the internal buffer.
- // Call the get_total_bytes_read() method to determine the actual size of the JPEG stream after successful decoding.
- class jpeg_decoder_stream
- {
- public:
- jpeg_decoder_stream() { }
- virtual ~jpeg_decoder_stream() { }
-
- // The read() method is called when the internal input buffer is empty.
- // Parameters:
- // pBuf - input buffer
- // max_bytes_to_read - maximum bytes that can be written to pBuf
- // pEOF_flag - set this to true if at end of stream (no more bytes remaining)
- // Returns -1 on error, otherwise return the number of bytes actually written to the buffer (which may be 0).
- // Notes: This method will be called in a loop until you set *pEOF_flag to true or the internal buffer is full.
- virtual int read(uint8 *pBuf, int max_bytes_to_read, bool *pEOF_flag) = 0;
- };
-
- // stdio FILE stream class.
- class jpeg_decoder_file_stream : public jpeg_decoder_stream
- {
- jpeg_decoder_file_stream(const jpeg_decoder_file_stream &);
- jpeg_decoder_file_stream &operator =(const jpeg_decoder_file_stream &);
-
- FILE *m_pFile;
- bool m_eof_flag, m_error_flag;
-
- public:
- jpeg_decoder_file_stream();
- virtual ~jpeg_decoder_file_stream();
-
- bool open(const char *Pfilename);
- void close();
-
- virtual int read(uint8 *pBuf, int max_bytes_to_read, bool *pEOF_flag);
- };
-
- // Memory stream class.
- class jpeg_decoder_mem_stream : public jpeg_decoder_stream
- {
- const uint8 *m_pSrc_data;
- uint m_ofs, m_size;
-
- public:
- jpeg_decoder_mem_stream() : m_pSrc_data(NULL), m_ofs(0), m_size(0) { }
- jpeg_decoder_mem_stream(const uint8 *pSrc_data, uint size) : m_pSrc_data(pSrc_data), m_ofs(0), m_size(size) { }
-
- virtual ~jpeg_decoder_mem_stream() { }
-
- bool open(const uint8 *pSrc_data, uint size);
- void close() { m_pSrc_data = NULL; m_ofs = 0; m_size = 0; }
-
- virtual int read(uint8 *pBuf, int max_bytes_to_read, bool *pEOF_flag);
- };
-
- // Loads JPEG file from a jpeg_decoder_stream.
- unsigned char *decompress_jpeg_image_from_stream(jpeg_decoder_stream *pStream, int *width, int *height, int *actual_comps, int req_comps);
-
- enum
- {
- JPGD_IN_BUF_SIZE = 8192, JPGD_MAX_BLOCKS_PER_MCU = 10, JPGD_MAX_HUFF_TABLES = 8, JPGD_MAX_QUANT_TABLES = 4,
- JPGD_MAX_COMPONENTS = 4, JPGD_MAX_COMPS_IN_SCAN = 4, JPGD_MAX_BLOCKS_PER_ROW = 8192, JPGD_MAX_HEIGHT = 16384, JPGD_MAX_WIDTH = 16384
- };
-
- typedef int16 jpgd_quant_t;
- typedef int16 jpgd_block_t;
-
- class jpeg_decoder
- {
- public:
- // Call get_error_code() after constructing to determine if the stream is valid or not. You may call the get_width(), get_height(), etc.
- // methods after the constructor is called. You may then either destruct the object, or begin decoding the image by calling begin_decoding(), then decode() on each scanline.
- jpeg_decoder(jpeg_decoder_stream *pStream);
-
- ~jpeg_decoder();
-
- // Call this method after constructing the object to begin decompression.
- // If JPGD_SUCCESS is returned you may then call decode() on each scanline.
- int begin_decoding();
-
- // Returns the next scan line.
- // For grayscale images, pScan_line will point to a buffer containing 8-bit pixels (get_bytes_per_pixel() will return 1).
- // Otherwise, it will always point to a buffer containing 32-bit RGBA pixels (A will always be 255, and get_bytes_per_pixel() will return 4).
- // Returns JPGD_SUCCESS if a scan line has been returned.
- // Returns JPGD_DONE if all scan lines have been returned.
- // Returns JPGD_FAILED if an error occurred. Call get_error_code() for a more info.
- int decode(const void** pScan_line, uint* pScan_line_len);
-
- inline jpgd_status get_error_code() const { return m_error_code; }
-
- inline int get_width() const { return m_image_x_size; }
- inline int get_height() const { return m_image_y_size; }
-
- inline int get_num_components() const { return m_comps_in_frame; }
-
- inline int get_bytes_per_pixel() const { return m_dest_bytes_per_pixel; }
- inline int get_bytes_per_scan_line() const { return m_image_x_size * get_bytes_per_pixel(); }
-
- // Returns the total number of bytes actually consumed by the decoder (which should equal the actual size of the JPEG file).
- inline int get_total_bytes_read() const { return m_total_bytes_read; }
-
- private:
- jpeg_decoder(const jpeg_decoder &);
- jpeg_decoder &operator =(const jpeg_decoder &);
-
- typedef void (*pDecode_block_func)(jpeg_decoder *, int, int, int);
-
- struct huff_tables
- {
- bool ac_table;
- uint look_up[256];
- uint look_up2[256];
- uint8 code_size[256];
- uint tree[512];
- };
-
- struct coeff_buf
- {
- uint8 *pData;
- int block_num_x, block_num_y;
- int block_len_x, block_len_y;
- int block_size;
- };
-
- struct mem_block
- {
- mem_block *m_pNext;
- size_t m_used_count;
- size_t m_size;
- char m_data[1];
- };
-
- jmp_buf m_jmp_state;
- mem_block *m_pMem_blocks;
- int m_image_x_size;
- int m_image_y_size;
- jpeg_decoder_stream *m_pStream;
- int m_progressive_flag;
- uint8 m_huff_ac[JPGD_MAX_HUFF_TABLES];
- uint8* m_huff_num[JPGD_MAX_HUFF_TABLES]; // pointer to number of Huffman codes per bit size
- uint8* m_huff_val[JPGD_MAX_HUFF_TABLES]; // pointer to Huffman codes per bit size
- jpgd_quant_t* m_quant[JPGD_MAX_QUANT_TABLES]; // pointer to quantization tables
- int m_scan_type; // Gray, Yh1v1, Yh1v2, Yh2v1, Yh2v2 (CMYK111, CMYK4114 no longer supported)
- int m_comps_in_frame; // # of components in frame
- int m_comp_h_samp[JPGD_MAX_COMPONENTS]; // component's horizontal sampling factor
- int m_comp_v_samp[JPGD_MAX_COMPONENTS]; // component's vertical sampling factor
- int m_comp_quant[JPGD_MAX_COMPONENTS]; // component's quantization table selector
- int m_comp_ident[JPGD_MAX_COMPONENTS]; // component's ID
- int m_comp_h_blocks[JPGD_MAX_COMPONENTS];
- int m_comp_v_blocks[JPGD_MAX_COMPONENTS];
- int m_comps_in_scan; // # of components in scan
- int m_comp_list[JPGD_MAX_COMPS_IN_SCAN]; // components in this scan
- int m_comp_dc_tab[JPGD_MAX_COMPONENTS]; // component's DC Huffman coding table selector
- int m_comp_ac_tab[JPGD_MAX_COMPONENTS]; // component's AC Huffman coding table selector
- int m_spectral_start; // spectral selection start
- int m_spectral_end; // spectral selection end
- int m_successive_low; // successive approximation low
- int m_successive_high; // successive approximation high
- int m_max_mcu_x_size; // MCU's max. X size in pixels
- int m_max_mcu_y_size; // MCU's max. Y size in pixels
- int m_blocks_per_mcu;
- int m_max_blocks_per_row;
- int m_mcus_per_row, m_mcus_per_col;
- int m_mcu_org[JPGD_MAX_BLOCKS_PER_MCU];
- int m_total_lines_left; // total # lines left in image
- int m_mcu_lines_left; // total # lines left in this MCU
- int m_real_dest_bytes_per_scan_line;
- int m_dest_bytes_per_scan_line; // rounded up
- int m_dest_bytes_per_pixel; // 4 (RGB) or 1 (Y)
- huff_tables* m_pHuff_tabs[JPGD_MAX_HUFF_TABLES];
- coeff_buf* m_dc_coeffs[JPGD_MAX_COMPONENTS];
- coeff_buf* m_ac_coeffs[JPGD_MAX_COMPONENTS];
- int m_eob_run;
- int m_block_y_mcu[JPGD_MAX_COMPONENTS];
- uint8* m_pIn_buf_ofs;
- int m_in_buf_left;
- int m_tem_flag;
- bool m_eof_flag;
- uint8 m_in_buf_pad_start[128];
- uint8 m_in_buf[JPGD_IN_BUF_SIZE + 128];
- uint8 m_in_buf_pad_end[128];
- int m_bits_left;
- uint m_bit_buf;
- int m_restart_interval;
- int m_restarts_left;
- int m_next_restart_num;
- int m_max_mcus_per_row;
- int m_max_blocks_per_mcu;
- int m_expanded_blocks_per_mcu;
- int m_expanded_blocks_per_row;
- int m_expanded_blocks_per_component;
- bool m_freq_domain_chroma_upsample;
- int m_max_mcus_per_col;
- uint m_last_dc_val[JPGD_MAX_COMPONENTS];
- jpgd_block_t* m_pMCU_coefficients;
- int m_mcu_block_max_zag[JPGD_MAX_BLOCKS_PER_MCU];
- uint8* m_pSample_buf;
- int m_crr[256];
- int m_cbb[256];
- int m_crg[256];
- int m_cbg[256];
- uint8* m_pScan_line_0;
- uint8* m_pScan_line_1;
- jpgd_status m_error_code;
- bool m_ready_flag;
- int m_total_bytes_read;
-
- void free_all_blocks();
- JPGD_NORETURN void stop_decoding(jpgd_status status);
- void *alloc(size_t n, bool zero = false);
- void word_clear(void *p, uint16 c, uint n);
- void prep_in_buffer();
- void read_dht_marker();
- void read_dqt_marker();
- void read_sof_marker();
- void skip_variable_marker();
- void read_dri_marker();
- void read_sos_marker();
- int next_marker();
- int process_markers();
- void locate_soi_marker();
- void locate_sof_marker();
- int locate_sos_marker();
- void init(jpeg_decoder_stream * pStream);
- void create_look_ups();
- void fix_in_buffer();
- void transform_mcu(int mcu_row);
- void transform_mcu_expand(int mcu_row);
- coeff_buf* coeff_buf_open(int block_num_x, int block_num_y, int block_len_x, int block_len_y);
- inline jpgd_block_t *coeff_buf_getp(coeff_buf *cb, int block_x, int block_y);
- void load_next_row();
- void decode_next_row();
- void make_huff_table(int index, huff_tables *pH);
- void check_quant_tables();
- void check_huff_tables();
- void calc_mcu_block_order();
- int init_scan();
- void init_frame();
- void process_restart();
- void decode_scan(pDecode_block_func decode_block_func);
- void init_progressive();
- void init_sequential();
- void decode_start();
- void decode_init(jpeg_decoder_stream * pStream);
- void H2V2Convert();
- void H2V1Convert();
- void H1V2Convert();
- void H1V1Convert();
- void gray_convert();
- void expanded_convert();
- void find_eoi();
- inline uint get_char();
- inline uint get_char(bool *pPadding_flag);
- inline void stuff_char(uint8 q);
- inline uint8 get_octet();
- inline uint get_bits(int num_bits);
- inline uint get_bits_no_markers(int numbits);
- inline int huff_decode(huff_tables *pH);
- inline int huff_decode(huff_tables *pH, int& extrabits);
- static inline uint8 clamp(int i);
- static void decode_block_dc_first(jpeg_decoder *pD, int component_id, int block_x, int block_y);
- static void decode_block_dc_refine(jpeg_decoder *pD, int component_id, int block_x, int block_y);
- static void decode_block_ac_first(jpeg_decoder *pD, int component_id, int block_x, int block_y);
- static void decode_block_ac_refine(jpeg_decoder *pD, int component_id, int block_x, int block_y);
- };
-
-} // namespace jpgd
-
-#endif // JPEG_DECODER_H
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_jpge.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_jpge.cpp
deleted file mode 100644
index 964f908d..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_jpge.cpp
+++ /dev/null
@@ -1,1044 +0,0 @@
-// jpge.cpp - C++ class for JPEG compression.
-// Public domain, Rich Geldreich <richgel99@gmail.com>
-// v1.01, Dec. 18, 2010 - Initial release
-// v1.02, Apr. 6, 2011 - Removed 2x2 ordered dither in H2V1 chroma subsampling method load_block_16_8_8(). (The rounding factor was 2, when it should have been 1. Either way, it wasn't helping.)
-// v1.03, Apr. 16, 2011 - Added support for optimized Huffman code tables, optimized dynamic memory allocation down to only 1 alloc.
-// Also from Alex Evans: Added RGBA support, linear memory allocator (no longer needed in v1.03).
-// v1.04, May. 19, 2012: Forgot to set m_pFile ptr to NULL in cfile_stream::close(). Thanks to Owen Kaluza for reporting this bug.
-// Code tweaks to fix VS2008 static code analysis warnings (all looked harmless).
-// Code review revealed method load_block_16_8_8() (used for the non-default H2V1 sampling mode to downsample chroma) somehow didn't get the rounding factor fix from v1.02.
-
-#include "crn_jpge.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <malloc.h>
-
-#include "crn_core.h"
-
-#define JPGE_MAX(a,b) (((a)>(b))?(a):(b))
-#define JPGE_MIN(a,b) (((a)<(b))?(a):(b))
-
-namespace jpge {
-
- static inline void *jpge_malloc(size_t nSize) { return crnlib::crnlib_malloc(nSize); }
- static inline void jpge_free(void *p) { crnlib::crnlib_free(p); }
-
- // Various JPEG enums and tables.
- enum { M_SOF0 = 0xC0, M_DHT = 0xC4, M_SOI = 0xD8, M_EOI = 0xD9, M_SOS = 0xDA, M_DQT = 0xDB, M_APP0 = 0xE0 };
- enum { DC_LUM_CODES = 12, AC_LUM_CODES = 256, DC_CHROMA_CODES = 12, AC_CHROMA_CODES = 256, MAX_HUFF_SYMBOLS = 257, MAX_HUFF_CODESIZE = 32 };
-
- static uint8 s_zag[64] = { 0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63 };
- static int16 s_std_lum_quant[64] = { 16,11,12,14,12,10,16,14,13,14,18,17,16,19,24,40,26,24,22,22,24,49,35,37,29,40,58,51,61,60,57,51,56,55,64,72,92,78,64,68,87,69,55,56,80,109,81,87,95,98,103,104,103,62,77,113,121,112,100,120,92,101,103,99 };
- static int16 s_std_croma_quant[64] = { 17,18,18,24,21,24,47,26,26,47,99,66,56,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99 };
- static uint8 s_dc_lum_bits[17] = { 0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0 };
- static uint8 s_dc_lum_val[DC_LUM_CODES] = { 0,1,2,3,4,5,6,7,8,9,10,11 };
- static uint8 s_ac_lum_bits[17] = { 0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d };
- static uint8 s_ac_lum_val[AC_LUM_CODES] =
- {
- 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08,0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0,
- 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16,0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28,0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,
- 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89,
- 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,
- 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,
- 0xf9,0xfa
- };
- static uint8 s_dc_chroma_bits[17] = { 0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0 };
- static uint8 s_dc_chroma_val[DC_CHROMA_CODES] = { 0,1,2,3,4,5,6,7,8,9,10,11 };
- static uint8 s_ac_chroma_bits[17] = { 0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77 };
- static uint8 s_ac_chroma_val[AC_CHROMA_CODES] =
- {
- 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71,0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91,0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0,
- 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34,0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26,0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,
- 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87,
- 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3,
- 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,
- 0xf9,0xfa
- };
-
- // Low-level helper functions.
- template <class T> inline void clear_obj(T &obj) { memset(&obj, 0, sizeof(obj)); }
-
- const int YR = 19595, YG = 38470, YB = 7471, CB_R = -11059, CB_G = -21709, CB_B = 32768, CR_R = 32768, CR_G = -27439, CR_B = -5329;
- static inline uint8 clamp(int i) { if (static_cast<uint>(i) > 255U) { if (i < 0) i = 0; else if (i > 255) i = 255; } return static_cast<uint8>(i); }
-
- static void RGB_to_YCC(uint8* pDst, const uint8 *pSrc, int num_pixels)
- {
- for ( ; num_pixels; pDst += 3, pSrc += 3, num_pixels--)
- {
- const int r = pSrc[0], g = pSrc[1], b = pSrc[2];
- pDst[0] = static_cast<uint8>((r * YR + g * YG + b * YB + 32768) >> 16);
- pDst[1] = clamp(128 + ((r * CB_R + g * CB_G + b * CB_B + 32768) >> 16));
- pDst[2] = clamp(128 + ((r * CR_R + g * CR_G + b * CR_B + 32768) >> 16));
- }
- }
-
- static void RGB_to_Y(uint8* pDst, const uint8 *pSrc, int num_pixels)
- {
- for ( ; num_pixels; pDst++, pSrc += 3, num_pixels--)
- pDst[0] = static_cast<uint8>((pSrc[0] * YR + pSrc[1] * YG + pSrc[2] * YB + 32768) >> 16);
- }
-
- static void RGBA_to_YCC(uint8* pDst, const uint8 *pSrc, int num_pixels)
- {
- for ( ; num_pixels; pDst += 3, pSrc += 4, num_pixels--)
- {
- const int r = pSrc[0], g = pSrc[1], b = pSrc[2];
- pDst[0] = static_cast<uint8>((r * YR + g * YG + b * YB + 32768) >> 16);
- pDst[1] = clamp(128 + ((r * CB_R + g * CB_G + b * CB_B + 32768) >> 16));
- pDst[2] = clamp(128 + ((r * CR_R + g * CR_G + b * CR_B + 32768) >> 16));
- }
- }
-
- static void RGBA_to_Y(uint8* pDst, const uint8 *pSrc, int num_pixels)
- {
- for ( ; num_pixels; pDst++, pSrc += 4, num_pixels--)
- pDst[0] = static_cast<uint8>((pSrc[0] * YR + pSrc[1] * YG + pSrc[2] * YB + 32768) >> 16);
- }
-
- static void Y_to_YCC(uint8* pDst, const uint8* pSrc, int num_pixels)
- {
- for( ; num_pixels; pDst += 3, pSrc++, num_pixels--) { pDst[0] = pSrc[0]; pDst[1] = 128; pDst[2] = 128; }
- }
-
- // Forward DCT - DCT derived from jfdctint.
- enum { CONST_BITS = 13, ROW_BITS = 2 };
-#define DCT_DESCALE(x, n) (((x) + (((int32)1) << ((n) - 1))) >> (n))
-#define DCT_MUL(var, c) (static_cast<int16>(var) * static_cast<int32>(c))
-#define DCT1D(s0, s1, s2, s3, s4, s5, s6, s7) \
- int32 t0 = s0 + s7, t7 = s0 - s7, t1 = s1 + s6, t6 = s1 - s6, t2 = s2 + s5, t5 = s2 - s5, t3 = s3 + s4, t4 = s3 - s4; \
- int32 t10 = t0 + t3, t13 = t0 - t3, t11 = t1 + t2, t12 = t1 - t2; \
- int32 u1 = DCT_MUL(t12 + t13, 4433); \
- s2 = u1 + DCT_MUL(t13, 6270); \
- s6 = u1 + DCT_MUL(t12, -15137); \
- u1 = t4 + t7; \
- int32 u2 = t5 + t6, u3 = t4 + t6, u4 = t5 + t7; \
- int32 z5 = DCT_MUL(u3 + u4, 9633); \
- t4 = DCT_MUL(t4, 2446); t5 = DCT_MUL(t5, 16819); \
- t6 = DCT_MUL(t6, 25172); t7 = DCT_MUL(t7, 12299); \
- u1 = DCT_MUL(u1, -7373); u2 = DCT_MUL(u2, -20995); \
- u3 = DCT_MUL(u3, -16069); u4 = DCT_MUL(u4, -3196); \
- u3 += z5; u4 += z5; \
- s0 = t10 + t11; s1 = t7 + u1 + u4; s3 = t6 + u2 + u3; s4 = t10 - t11; s5 = t5 + u2 + u4; s7 = t4 + u1 + u3;
-
- static void DCT2D(int32 *p)
- {
- int32 c, *q = p;
- for (c = 7; c >= 0; c--, q += 8)
- {
- int32 s0 = q[0], s1 = q[1], s2 = q[2], s3 = q[3], s4 = q[4], s5 = q[5], s6 = q[6], s7 = q[7];
- DCT1D(s0, s1, s2, s3, s4, s5, s6, s7);
- q[0] = s0 << ROW_BITS; q[1] = DCT_DESCALE(s1, CONST_BITS-ROW_BITS); q[2] = DCT_DESCALE(s2, CONST_BITS-ROW_BITS); q[3] = DCT_DESCALE(s3, CONST_BITS-ROW_BITS);
- q[4] = s4 << ROW_BITS; q[5] = DCT_DESCALE(s5, CONST_BITS-ROW_BITS); q[6] = DCT_DESCALE(s6, CONST_BITS-ROW_BITS); q[7] = DCT_DESCALE(s7, CONST_BITS-ROW_BITS);
- }
- for (q = p, c = 7; c >= 0; c--, q++)
- {
- int32 s0 = q[0*8], s1 = q[1*8], s2 = q[2*8], s3 = q[3*8], s4 = q[4*8], s5 = q[5*8], s6 = q[6*8], s7 = q[7*8];
- DCT1D(s0, s1, s2, s3, s4, s5, s6, s7);
- q[0*8] = DCT_DESCALE(s0, ROW_BITS+3); q[1*8] = DCT_DESCALE(s1, CONST_BITS+ROW_BITS+3); q[2*8] = DCT_DESCALE(s2, CONST_BITS+ROW_BITS+3); q[3*8] = DCT_DESCALE(s3, CONST_BITS+ROW_BITS+3);
- q[4*8] = DCT_DESCALE(s4, ROW_BITS+3); q[5*8] = DCT_DESCALE(s5, CONST_BITS+ROW_BITS+3); q[6*8] = DCT_DESCALE(s6, CONST_BITS+ROW_BITS+3); q[7*8] = DCT_DESCALE(s7, CONST_BITS+ROW_BITS+3);
- }
- }
-
- struct sym_freq { uint m_key, m_sym_index; };
-
- // Radix sorts sym_freq[] array by 32-bit key m_key. Returns ptr to sorted values.
- static inline sym_freq* radix_sort_syms(uint num_syms, sym_freq* pSyms0, sym_freq* pSyms1)
- {
- const uint cMaxPasses = 4;
- uint32 hist[256 * cMaxPasses]; clear_obj(hist);
- for (uint i = 0; i < num_syms; i++) { uint freq = pSyms0[i].m_key; hist[freq & 0xFF]++; hist[256 + ((freq >> 8) & 0xFF)]++; hist[256*2 + ((freq >> 16) & 0xFF)]++; hist[256*3 + ((freq >> 24) & 0xFF)]++; }
- sym_freq* pCur_syms = pSyms0, *pNew_syms = pSyms1;
- uint total_passes = cMaxPasses; while ((total_passes > 1) && (num_syms == hist[(total_passes - 1) * 256])) total_passes--;
- for (uint pass_shift = 0, pass = 0; pass < total_passes; pass++, pass_shift += 8)
- {
- const uint32* pHist = &hist[pass << 8];
- uint offsets[256], cur_ofs = 0;
- for (uint i = 0; i < 256; i++) { offsets[i] = cur_ofs; cur_ofs += pHist[i]; }
- for (uint i = 0; i < num_syms; i++)
- pNew_syms[offsets[(pCur_syms[i].m_key >> pass_shift) & 0xFF]++] = pCur_syms[i];
- sym_freq* t = pCur_syms; pCur_syms = pNew_syms; pNew_syms = t;
- }
- return pCur_syms;
- }
-
- // calculate_minimum_redundancy() originally written by: Alistair Moffat, alistair@cs.mu.oz.au, Jyrki Katajainen, jyrki@diku.dk, November 1996.
- static void calculate_minimum_redundancy(sym_freq *A, int n)
- {
- int root, leaf, next, avbl, used, dpth;
- if (n==0) return; else if (n==1) { A[0].m_key = 1; return; }
- A[0].m_key += A[1].m_key; root = 0; leaf = 2;
- for (next=1; next < n-1; next++)
- {
- if (leaf>=n || A[root].m_key<A[leaf].m_key) { A[next].m_key = A[root].m_key; A[root++].m_key = next; } else A[next].m_key = A[leaf++].m_key;
- if (leaf>=n || (root<next && A[root].m_key<A[leaf].m_key)) { A[next].m_key += A[root].m_key; A[root++].m_key = next; } else A[next].m_key += A[leaf++].m_key;
- }
- A[n-2].m_key = 0;
- for (next=n-3; next>=0; next--) A[next].m_key = A[A[next].m_key].m_key+1;
- avbl = 1; used = dpth = 0; root = n-2; next = n-1;
- while (avbl>0)
- {
- while (root>=0 && (int)A[root].m_key==dpth) { used++; root--; }
- while (avbl>used) { A[next--].m_key = dpth; avbl--; }
- avbl = 2*used; dpth++; used = 0;
- }
- }
-
- // Limits canonical Huffman code table's max code size to max_code_size.
- static void huffman_enforce_max_code_size(int *pNum_codes, int code_list_len, int max_code_size)
- {
- if (code_list_len <= 1) return;
-
- for (int i = max_code_size + 1; i <= MAX_HUFF_CODESIZE; i++) pNum_codes[max_code_size] += pNum_codes[i];
-
- uint32 total = 0;
- for (int i = max_code_size; i > 0; i--)
- total += (((uint32)pNum_codes[i]) << (max_code_size - i));
-
- while (total != (1UL << max_code_size))
- {
- pNum_codes[max_code_size]--;
- for (int i = max_code_size - 1; i > 0; i--)
- {
- if (pNum_codes[i]) { pNum_codes[i]--; pNum_codes[i + 1] += 2; break; }
- }
- total--;
- }
- }
-
- // Generates an optimized offman table.
- void jpeg_encoder::optimize_huffman_table(int table_num, int table_len)
- {
- sym_freq syms0[MAX_HUFF_SYMBOLS], syms1[MAX_HUFF_SYMBOLS];
- syms0[0].m_key = 1; syms0[0].m_sym_index = 0; // dummy symbol, assures that no valid code contains all 1's
- int num_used_syms = 1;
- const uint32 *pSym_count = &m_huff_count[table_num][0];
- for (int i = 0; i < table_len; i++)
- if (pSym_count[i]) { syms0[num_used_syms].m_key = pSym_count[i]; syms0[num_used_syms++].m_sym_index = i + 1; }
- sym_freq* pSyms = radix_sort_syms(num_used_syms, syms0, syms1);
- calculate_minimum_redundancy(pSyms, num_used_syms);
-
- // Count the # of symbols of each code size.
- int num_codes[1 + MAX_HUFF_CODESIZE]; clear_obj(num_codes);
- for (int i = 0; i < num_used_syms; i++)
- num_codes[pSyms[i].m_key]++;
-
- const uint JPGE_CODE_SIZE_LIMIT = 16; // the maximum possible size of a JPEG Huffman code (valid range is [9,16] - 9 vs. 8 because of the dummy symbol)
- huffman_enforce_max_code_size(num_codes, num_used_syms, JPGE_CODE_SIZE_LIMIT);
-
- // Compute m_huff_bits array, which contains the # of symbols per code size.
- clear_obj(m_huff_bits[table_num]);
- for (int i = 1; i <= (int)JPGE_CODE_SIZE_LIMIT; i++)
- m_huff_bits[table_num][i] = static_cast<uint8>(num_codes[i]);
-
- // Remove the dummy symbol added above, which must be in largest bucket.
- for (int i = JPGE_CODE_SIZE_LIMIT; i >= 1; i--)
- {
- if (m_huff_bits[table_num][i]) { m_huff_bits[table_num][i]--; break; }
- }
-
- // Compute the m_huff_val array, which contains the symbol indices sorted by code size (smallest to largest).
- for (int i = num_used_syms - 1; i >= 1; i--)
- m_huff_val[table_num][num_used_syms - 1 - i] = static_cast<uint8>(pSyms[i].m_sym_index - 1);
- }
-
- // JPEG marker generation.
- void jpeg_encoder::emit_byte(uint8 i)
- {
- m_all_stream_writes_succeeded = m_all_stream_writes_succeeded && m_pStream->put_obj(i);
- }
-
- void jpeg_encoder::emit_word(uint i)
- {
- emit_byte(uint8(i >> 8)); emit_byte(uint8(i & 0xFF));
- }
-
- void jpeg_encoder::emit_marker(int marker)
- {
- emit_byte(uint8(0xFF)); emit_byte(uint8(marker));
- }
-
- // Emit JFIF marker
- void jpeg_encoder::emit_jfif_app0()
- {
- emit_marker(M_APP0);
- emit_word(2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1);
- emit_byte(0x4A); emit_byte(0x46); emit_byte(0x49); emit_byte(0x46); /* Identifier: ASCII "JFIF" */
- emit_byte(0);
- emit_byte(1); /* Major version */
- emit_byte(1); /* Minor version */
- emit_byte(0); /* Density unit */
- emit_word(1);
- emit_word(1);
- emit_byte(0); /* No thumbnail image */
- emit_byte(0);
- }
-
- // Emit quantization tables
- void jpeg_encoder::emit_dqt()
- {
- for (int i = 0; i < ((m_num_components == 3) ? 2 : 1); i++)
- {
- emit_marker(M_DQT);
- emit_word(64 + 1 + 2);
- emit_byte(static_cast<uint8>(i));
- for (int j = 0; j < 64; j++)
- emit_byte(static_cast<uint8>(m_quantization_tables[i][j]));
- }
- }
-
- // Emit start of frame marker
- void jpeg_encoder::emit_sof()
- {
- emit_marker(M_SOF0); /* baseline */
- emit_word(3 * m_num_components + 2 + 5 + 1);
- emit_byte(8); /* precision */
- emit_word(m_image_y);
- emit_word(m_image_x);
- emit_byte(m_num_components);
- for (int i = 0; i < m_num_components; i++)
- {
- emit_byte(static_cast<uint8>(i + 1)); /* component ID */
- emit_byte((m_comp_h_samp[i] << 4) + m_comp_v_samp[i]); /* h and v sampling */
- emit_byte(i > 0); /* quant. table num */
- }
- }
-
- // Emit Huffman table.
- void jpeg_encoder::emit_dht(uint8 *bits, uint8 *val, int index, bool ac_flag)
- {
- emit_marker(M_DHT);
-
- int length = 0;
- for (int i = 1; i <= 16; i++)
- length += bits[i];
-
- emit_word(length + 2 + 1 + 16);
- emit_byte(static_cast<uint8>(index + (ac_flag << 4)));
-
- for (int i = 1; i <= 16; i++)
- emit_byte(bits[i]);
-
- for (int i = 0; i < length; i++)
- emit_byte(val[i]);
- }
-
- // Emit all Huffman tables.
- void jpeg_encoder::emit_dhts()
- {
- emit_dht(m_huff_bits[0+0], m_huff_val[0+0], 0, false);
- emit_dht(m_huff_bits[2+0], m_huff_val[2+0], 0, true);
- if (m_num_components == 3)
- {
- emit_dht(m_huff_bits[0+1], m_huff_val[0+1], 1, false);
- emit_dht(m_huff_bits[2+1], m_huff_val[2+1], 1, true);
- }
- }
-
- // emit start of scan
- void jpeg_encoder::emit_sos()
- {
- emit_marker(M_SOS);
- emit_word(2 * m_num_components + 2 + 1 + 3);
- emit_byte(m_num_components);
- for (int i = 0; i < m_num_components; i++)
- {
- emit_byte(static_cast<uint8>(i + 1));
- if (i == 0)
- emit_byte((0 << 4) + 0);
- else
- emit_byte((1 << 4) + 1);
- }
- emit_byte(0); /* spectral selection */
- emit_byte(63);
- emit_byte(0);
- }
-
- // Emit all markers at beginning of image file.
- void jpeg_encoder::emit_markers()
- {
- emit_marker(M_SOI);
- emit_jfif_app0();
- emit_dqt();
- emit_sof();
- emit_dhts();
- emit_sos();
- }
-
- // Compute the actual canonical Huffman codes/code sizes given the JPEG huff bits and val arrays.
- void jpeg_encoder::compute_huffman_table(uint *codes, uint8 *code_sizes, uint8 *bits, uint8 *val)
- {
- int i, l, last_p, si;
- uint8 huff_size[257];
- uint huff_code[257];
- uint code;
-
- int p = 0;
- for (l = 1; l <= 16; l++)
- for (i = 1; i <= bits[l]; i++)
- huff_size[p++] = (char)l;
-
- huff_size[p] = 0; last_p = p; // write sentinel
-
- code = 0; si = huff_size[0]; p = 0;
-
- while (huff_size[p])
- {
- while (huff_size[p] == si)
- huff_code[p++] = code++;
- code <<= 1;
- si++;
- }
-
- memset(codes, 0, sizeof(codes[0])*256);
- memset(code_sizes, 0, sizeof(code_sizes[0])*256);
- for (p = 0; p < last_p; p++)
- {
- codes[val[p]] = huff_code[p];
- code_sizes[val[p]] = huff_size[p];
- }
- }
-
- // Quantization table generation.
- void jpeg_encoder::compute_quant_table(int32 *pDst, int16 *pSrc)
- {
- int32 q;
- if (m_params.m_quality < 50)
- q = 5000 / m_params.m_quality;
- else
- q = 200 - m_params.m_quality * 2;
- for (int i = 0; i < 64; i++)
- {
- int32 j = *pSrc++; j = (j * q + 50L) / 100L;
- *pDst++ = JPGE_MIN(JPGE_MAX(j, 1), 255);
- }
- }
-
- // Higher-level methods.
- void jpeg_encoder::first_pass_init()
- {
- m_bit_buffer = 0; m_bits_in = 0;
- memset(m_last_dc_val, 0, 3 * sizeof(m_last_dc_val[0]));
- m_mcu_y_ofs = 0;
- m_pass_num = 1;
- }
-
- bool jpeg_encoder::second_pass_init()
- {
- compute_huffman_table(&m_huff_codes[0+0][0], &m_huff_code_sizes[0+0][0], m_huff_bits[0+0], m_huff_val[0+0]);
- compute_huffman_table(&m_huff_codes[2+0][0], &m_huff_code_sizes[2+0][0], m_huff_bits[2+0], m_huff_val[2+0]);
- if (m_num_components > 1)
- {
- compute_huffman_table(&m_huff_codes[0+1][0], &m_huff_code_sizes[0+1][0], m_huff_bits[0+1], m_huff_val[0+1]);
- compute_huffman_table(&m_huff_codes[2+1][0], &m_huff_code_sizes[2+1][0], m_huff_bits[2+1], m_huff_val[2+1]);
- }
- first_pass_init();
- emit_markers();
- m_pass_num = 2;
- return true;
- }
-
- bool jpeg_encoder::jpg_open(int p_x_res, int p_y_res, int src_channels)
- {
- m_num_components = 3;
- switch (m_params.m_subsampling)
- {
- case Y_ONLY:
- {
- m_num_components = 1;
- m_comp_h_samp[0] = 1; m_comp_v_samp[0] = 1;
- m_mcu_x = 8; m_mcu_y = 8;
- break;
- }
- case H1V1:
- {
- m_comp_h_samp[0] = 1; m_comp_v_samp[0] = 1;
- m_comp_h_samp[1] = 1; m_comp_v_samp[1] = 1;
- m_comp_h_samp[2] = 1; m_comp_v_samp[2] = 1;
- m_mcu_x = 8; m_mcu_y = 8;
- break;
- }
- case H2V1:
- {
- m_comp_h_samp[0] = 2; m_comp_v_samp[0] = 1;
- m_comp_h_samp[1] = 1; m_comp_v_samp[1] = 1;
- m_comp_h_samp[2] = 1; m_comp_v_samp[2] = 1;
- m_mcu_x = 16; m_mcu_y = 8;
- break;
- }
- case H2V2:
- {
- m_comp_h_samp[0] = 2; m_comp_v_samp[0] = 2;
- m_comp_h_samp[1] = 1; m_comp_v_samp[1] = 1;
- m_comp_h_samp[2] = 1; m_comp_v_samp[2] = 1;
- m_mcu_x = 16; m_mcu_y = 16;
- }
- }
-
- m_image_x = p_x_res; m_image_y = p_y_res;
- m_image_bpp = src_channels;
- m_image_bpl = m_image_x * src_channels;
- m_image_x_mcu = (m_image_x + m_mcu_x - 1) & (~(m_mcu_x - 1));
- m_image_y_mcu = (m_image_y + m_mcu_y - 1) & (~(m_mcu_y - 1));
- m_image_bpl_xlt = m_image_x * m_num_components;
- m_image_bpl_mcu = m_image_x_mcu * m_num_components;
- m_mcus_per_row = m_image_x_mcu / m_mcu_x;
-
- if ((m_mcu_lines[0] = static_cast<uint8*>(jpge_malloc(m_image_bpl_mcu * m_mcu_y))) == NULL) return false;
- for (int i = 1; i < m_mcu_y; i++)
- m_mcu_lines[i] = m_mcu_lines[i-1] + m_image_bpl_mcu;
-
- compute_quant_table(m_quantization_tables[0], s_std_lum_quant);
- compute_quant_table(m_quantization_tables[1], m_params.m_no_chroma_discrim_flag ? s_std_lum_quant : s_std_croma_quant);
-
- m_out_buf_left = JPGE_OUT_BUF_SIZE;
- m_pOut_buf = m_out_buf;
-
- if (m_params.m_two_pass_flag)
- {
- clear_obj(m_huff_count);
- first_pass_init();
- }
- else
- {
- memcpy(m_huff_bits[0+0], s_dc_lum_bits, 17); memcpy(m_huff_val [0+0], s_dc_lum_val, DC_LUM_CODES);
- memcpy(m_huff_bits[2+0], s_ac_lum_bits, 17); memcpy(m_huff_val [2+0], s_ac_lum_val, AC_LUM_CODES);
- memcpy(m_huff_bits[0+1], s_dc_chroma_bits, 17); memcpy(m_huff_val [0+1], s_dc_chroma_val, DC_CHROMA_CODES);
- memcpy(m_huff_bits[2+1], s_ac_chroma_bits, 17); memcpy(m_huff_val [2+1], s_ac_chroma_val, AC_CHROMA_CODES);
- if (!second_pass_init()) return false; // in effect, skip over the first pass
- }
- return m_all_stream_writes_succeeded;
- }
-
- void jpeg_encoder::load_block_8_8_grey(int x)
- {
- uint8 *pSrc;
- sample_array_t *pDst = m_sample_array;
- x <<= 3;
- for (int i = 0; i < 8; i++, pDst += 8)
- {
- pSrc = m_mcu_lines[i] + x;
- pDst[0] = pSrc[0] - 128; pDst[1] = pSrc[1] - 128; pDst[2] = pSrc[2] - 128; pDst[3] = pSrc[3] - 128;
- pDst[4] = pSrc[4] - 128; pDst[5] = pSrc[5] - 128; pDst[6] = pSrc[6] - 128; pDst[7] = pSrc[7] - 128;
- }
- }
-
- void jpeg_encoder::load_block_8_8(int x, int y, int c)
- {
- uint8 *pSrc;
- sample_array_t *pDst = m_sample_array;
- x = (x * (8 * 3)) + c;
- y <<= 3;
- for (int i = 0; i < 8; i++, pDst += 8)
- {
- pSrc = m_mcu_lines[y + i] + x;
- pDst[0] = pSrc[0 * 3] - 128; pDst[1] = pSrc[1 * 3] - 128; pDst[2] = pSrc[2 * 3] - 128; pDst[3] = pSrc[3 * 3] - 128;
- pDst[4] = pSrc[4 * 3] - 128; pDst[5] = pSrc[5 * 3] - 128; pDst[6] = pSrc[6 * 3] - 128; pDst[7] = pSrc[7 * 3] - 128;
- }
- }
-
- void jpeg_encoder::load_block_16_8(int x, int c)
- {
- uint8 *pSrc1, *pSrc2;
- sample_array_t *pDst = m_sample_array;
- x = (x * (16 * 3)) + c;
- int a = 0, b = 2;
- for (int i = 0; i < 16; i += 2, pDst += 8)
- {
- pSrc1 = m_mcu_lines[i + 0] + x;
- pSrc2 = m_mcu_lines[i + 1] + x;
- pDst[0] = ((pSrc1[ 0 * 3] + pSrc1[ 1 * 3] + pSrc2[ 0 * 3] + pSrc2[ 1 * 3] + a) >> 2) - 128; pDst[1] = ((pSrc1[ 2 * 3] + pSrc1[ 3 * 3] + pSrc2[ 2 * 3] + pSrc2[ 3 * 3] + b) >> 2) - 128;
- pDst[2] = ((pSrc1[ 4 * 3] + pSrc1[ 5 * 3] + pSrc2[ 4 * 3] + pSrc2[ 5 * 3] + a) >> 2) - 128; pDst[3] = ((pSrc1[ 6 * 3] + pSrc1[ 7 * 3] + pSrc2[ 6 * 3] + pSrc2[ 7 * 3] + b) >> 2) - 128;
- pDst[4] = ((pSrc1[ 8 * 3] + pSrc1[ 9 * 3] + pSrc2[ 8 * 3] + pSrc2[ 9 * 3] + a) >> 2) - 128; pDst[5] = ((pSrc1[10 * 3] + pSrc1[11 * 3] + pSrc2[10 * 3] + pSrc2[11 * 3] + b) >> 2) - 128;
- pDst[6] = ((pSrc1[12 * 3] + pSrc1[13 * 3] + pSrc2[12 * 3] + pSrc2[13 * 3] + a) >> 2) - 128; pDst[7] = ((pSrc1[14 * 3] + pSrc1[15 * 3] + pSrc2[14 * 3] + pSrc2[15 * 3] + b) >> 2) - 128;
- int temp = a; a = b; b = temp;
- }
- }
-
- void jpeg_encoder::load_block_16_8_8(int x, int c)
- {
- uint8 *pSrc1;
- sample_array_t *pDst = m_sample_array;
- x = (x * (16 * 3)) + c;
- for (int i = 0; i < 8; i++, pDst += 8)
- {
- pSrc1 = m_mcu_lines[i + 0] + x;
- pDst[0] = ((pSrc1[ 0 * 3] + pSrc1[ 1 * 3]) >> 1) - 128; pDst[1] = ((pSrc1[ 2 * 3] + pSrc1[ 3 * 3]) >> 1) - 128;
- pDst[2] = ((pSrc1[ 4 * 3] + pSrc1[ 5 * 3]) >> 1) - 128; pDst[3] = ((pSrc1[ 6 * 3] + pSrc1[ 7 * 3]) >> 1) - 128;
- pDst[4] = ((pSrc1[ 8 * 3] + pSrc1[ 9 * 3]) >> 1) - 128; pDst[5] = ((pSrc1[10 * 3] + pSrc1[11 * 3]) >> 1) - 128;
- pDst[6] = ((pSrc1[12 * 3] + pSrc1[13 * 3]) >> 1) - 128; pDst[7] = ((pSrc1[14 * 3] + pSrc1[15 * 3]) >> 1) - 128;
- }
- }
-
- void jpeg_encoder::load_quantized_coefficients(int component_num)
- {
- int32 *q = m_quantization_tables[component_num > 0];
- int16 *pDst = m_coefficient_array;
- for (int i = 0; i < 64; i++)
- {
- sample_array_t j = m_sample_array[s_zag[i]];
- if (j < 0)
- {
- if ((j = -j + (*q >> 1)) < *q)
- *pDst++ = 0;
- else
- *pDst++ = static_cast<int16>(-(j / *q));
- }
- else
- {
- if ((j = j + (*q >> 1)) < *q)
- *pDst++ = 0;
- else
- *pDst++ = static_cast<int16>((j / *q));
- }
- q++;
- }
- }
-
- void jpeg_encoder::flush_output_buffer()
- {
- if (m_out_buf_left != JPGE_OUT_BUF_SIZE)
- m_all_stream_writes_succeeded = m_all_stream_writes_succeeded && m_pStream->put_buf(m_out_buf, JPGE_OUT_BUF_SIZE - m_out_buf_left);
- m_pOut_buf = m_out_buf;
- m_out_buf_left = JPGE_OUT_BUF_SIZE;
- }
-
- void jpeg_encoder::put_bits(uint bits, uint len)
- {
- m_bit_buffer |= ((uint32)bits << (24 - (m_bits_in += len)));
- while (m_bits_in >= 8)
- {
- uint8 c;
-#define JPGE_PUT_BYTE(c) { *m_pOut_buf++ = (c); if (--m_out_buf_left == 0) flush_output_buffer(); }
- JPGE_PUT_BYTE(c = (uint8)((m_bit_buffer >> 16) & 0xFF));
- if (c == 0xFF) JPGE_PUT_BYTE(0);
- m_bit_buffer <<= 8;
- m_bits_in -= 8;
- }
- }
-
- void jpeg_encoder::code_coefficients_pass_one(int component_num)
- {
- if (component_num >= 3) return; // just to shut up static analysis
- int i, run_len, nbits, temp1;
- int16 *src = m_coefficient_array;
- uint32 *dc_count = component_num ? m_huff_count[0 + 1] : m_huff_count[0 + 0], *ac_count = component_num ? m_huff_count[2 + 1] : m_huff_count[2 + 0];
-
- temp1 = src[0] - m_last_dc_val[component_num];
- m_last_dc_val[component_num] = src[0];
- if (temp1 < 0) temp1 = -temp1;
-
- nbits = 0;
- while (temp1)
- {
- nbits++; temp1 >>= 1;
- }
-
- dc_count[nbits]++;
- for (run_len = 0, i = 1; i < 64; i++)
- {
- if ((temp1 = m_coefficient_array[i]) == 0)
- run_len++;
- else
- {
- while (run_len >= 16)
- {
- ac_count[0xF0]++;
- run_len -= 16;
- }
- if (temp1 < 0) temp1 = -temp1;
- nbits = 1;
- while (temp1 >>= 1) nbits++;
- ac_count[(run_len << 4) + nbits]++;
- run_len = 0;
- }
- }
- if (run_len) ac_count[0]++;
- }
-
- void jpeg_encoder::code_coefficients_pass_two(int component_num)
- {
- int i, j, run_len, nbits, temp1, temp2;
- int16 *pSrc = m_coefficient_array;
- uint *codes[2];
- uint8 *code_sizes[2];
-
- if (component_num == 0)
- {
- codes[0] = m_huff_codes[0 + 0]; codes[1] = m_huff_codes[2 + 0];
- code_sizes[0] = m_huff_code_sizes[0 + 0]; code_sizes[1] = m_huff_code_sizes[2 + 0];
- }
- else
- {
- codes[0] = m_huff_codes[0 + 1]; codes[1] = m_huff_codes[2 + 1];
- code_sizes[0] = m_huff_code_sizes[0 + 1]; code_sizes[1] = m_huff_code_sizes[2 + 1];
- }
-
- temp1 = temp2 = pSrc[0] - m_last_dc_val[component_num];
- m_last_dc_val[component_num] = pSrc[0];
-
- if (temp1 < 0)
- {
- temp1 = -temp1; temp2--;
- }
-
- nbits = 0;
- while (temp1)
- {
- nbits++; temp1 >>= 1;
- }
-
- put_bits(codes[0][nbits], code_sizes[0][nbits]);
- if (nbits) put_bits(temp2 & ((1 << nbits) - 1), nbits);
-
- for (run_len = 0, i = 1; i < 64; i++)
- {
- if ((temp1 = m_coefficient_array[i]) == 0)
- run_len++;
- else
- {
- while (run_len >= 16)
- {
- put_bits(codes[1][0xF0], code_sizes[1][0xF0]);
- run_len -= 16;
- }
- if ((temp2 = temp1) < 0)
- {
- temp1 = -temp1;
- temp2--;
- }
- nbits = 1;
- while (temp1 >>= 1)
- nbits++;
- j = (run_len << 4) + nbits;
- put_bits(codes[1][j], code_sizes[1][j]);
- put_bits(temp2 & ((1 << nbits) - 1), nbits);
- run_len = 0;
- }
- }
- if (run_len)
- put_bits(codes[1][0], code_sizes[1][0]);
- }
-
- void jpeg_encoder::code_block(int component_num)
- {
- DCT2D(m_sample_array);
- load_quantized_coefficients(component_num);
- if (m_pass_num == 1)
- code_coefficients_pass_one(component_num);
- else
- code_coefficients_pass_two(component_num);
- }
-
- void jpeg_encoder::process_mcu_row()
- {
- if (m_num_components == 1)
- {
- for (int i = 0; i < m_mcus_per_row; i++)
- {
- load_block_8_8_grey(i); code_block(0);
- }
- }
- else if ((m_comp_h_samp[0] == 1) && (m_comp_v_samp[0] == 1))
- {
- for (int i = 0; i < m_mcus_per_row; i++)
- {
- load_block_8_8(i, 0, 0); code_block(0); load_block_8_8(i, 0, 1); code_block(1); load_block_8_8(i, 0, 2); code_block(2);
- }
- }
- else if ((m_comp_h_samp[0] == 2) && (m_comp_v_samp[0] == 1))
- {
- for (int i = 0; i < m_mcus_per_row; i++)
- {
- load_block_8_8(i * 2 + 0, 0, 0); code_block(0); load_block_8_8(i * 2 + 1, 0, 0); code_block(0);
- load_block_16_8_8(i, 1); code_block(1); load_block_16_8_8(i, 2); code_block(2);
- }
- }
- else if ((m_comp_h_samp[0] == 2) && (m_comp_v_samp[0] == 2))
- {
- for (int i = 0; i < m_mcus_per_row; i++)
- {
- load_block_8_8(i * 2 + 0, 0, 0); code_block(0); load_block_8_8(i * 2 + 1, 0, 0); code_block(0);
- load_block_8_8(i * 2 + 0, 1, 0); code_block(0); load_block_8_8(i * 2 + 1, 1, 0); code_block(0);
- load_block_16_8(i, 1); code_block(1); load_block_16_8(i, 2); code_block(2);
- }
- }
- }
-
- bool jpeg_encoder::terminate_pass_one()
- {
- optimize_huffman_table(0+0, DC_LUM_CODES); optimize_huffman_table(2+0, AC_LUM_CODES);
- if (m_num_components > 1)
- {
- optimize_huffman_table(0+1, DC_CHROMA_CODES); optimize_huffman_table(2+1, AC_CHROMA_CODES);
- }
- return second_pass_init();
- }
-
- bool jpeg_encoder::terminate_pass_two()
- {
- put_bits(0x7F, 7);
- flush_output_buffer();
- emit_marker(M_EOI);
- m_pass_num++; // purposely bump up m_pass_num, for debugging
- return true;
- }
-
- bool jpeg_encoder::process_end_of_image()
- {
- if (m_mcu_y_ofs)
- {
- if (m_mcu_y_ofs < 16) // check here just to shut up static analysis
- {
- for (int i = m_mcu_y_ofs; i < m_mcu_y; i++)
- memcpy(m_mcu_lines[i], m_mcu_lines[m_mcu_y_ofs - 1], m_image_bpl_mcu);
- }
-
- process_mcu_row();
- }
-
- if (m_pass_num == 1)
- return terminate_pass_one();
- else
- return terminate_pass_two();
- }
-
- void jpeg_encoder::load_mcu(const void *pSrc)
- {
- const uint8* Psrc = reinterpret_cast<const uint8*>(pSrc);
-
- uint8* pDst = m_mcu_lines[m_mcu_y_ofs]; // OK to write up to m_image_bpl_xlt bytes to pDst
-
- if (m_num_components == 1)
- {
- if (m_image_bpp == 4)
- RGBA_to_Y(pDst, Psrc, m_image_x);
- else if (m_image_bpp == 3)
- RGB_to_Y(pDst, Psrc, m_image_x);
- else
- memcpy(pDst, Psrc, m_image_x);
- }
- else
- {
- if (m_image_bpp == 4)
- RGBA_to_YCC(pDst, Psrc, m_image_x);
- else if (m_image_bpp == 3)
- RGB_to_YCC(pDst, Psrc, m_image_x);
- else
- Y_to_YCC(pDst, Psrc, m_image_x);
- }
-
- // Possibly duplicate pixels at end of scanline if not a multiple of 8 or 16
- if (m_num_components == 1)
- memset(m_mcu_lines[m_mcu_y_ofs] + m_image_bpl_xlt, pDst[m_image_bpl_xlt - 1], m_image_x_mcu - m_image_x);
- else
- {
- const uint8 y = pDst[m_image_bpl_xlt - 3 + 0], cb = pDst[m_image_bpl_xlt - 3 + 1], cr = pDst[m_image_bpl_xlt - 3 + 2];
- uint8 *q = m_mcu_lines[m_mcu_y_ofs] + m_image_bpl_xlt;
- for (int i = m_image_x; i < m_image_x_mcu; i++)
- {
- *q++ = y; *q++ = cb; *q++ = cr;
- }
- }
-
- if (++m_mcu_y_ofs == m_mcu_y)
- {
- process_mcu_row();
- m_mcu_y_ofs = 0;
- }
- }
-
- void jpeg_encoder::clear()
- {
- m_mcu_lines[0] = NULL;
- m_pass_num = 0;
- m_all_stream_writes_succeeded = true;
- }
-
- jpeg_encoder::jpeg_encoder()
- {
- clear();
- }
-
- jpeg_encoder::~jpeg_encoder()
- {
- deinit();
- }
-
- bool jpeg_encoder::init(output_stream *pStream, int width, int height, int src_channels, const params &comp_params)
- {
- deinit();
- if (((!pStream) || (width < 1) || (height < 1)) || ((src_channels != 1) && (src_channels != 3) && (src_channels != 4)) || (!comp_params.check())) return false;
- m_pStream = pStream;
- m_params = comp_params;
- return jpg_open(width, height, src_channels);
- }
-
- void jpeg_encoder::deinit()
- {
- jpge_free(m_mcu_lines[0]);
- clear();
- }
-
- bool jpeg_encoder::process_scanline(const void* pScanline)
- {
- if ((m_pass_num < 1) || (m_pass_num > 2)) return false;
- if (m_all_stream_writes_succeeded)
- {
- if (!pScanline)
- {
- if (!process_end_of_image()) return false;
- }
- else
- {
- load_mcu(pScanline);
- }
- }
- return m_all_stream_writes_succeeded;
- }
-
- // Higher level wrappers/examples (optional).
-#include <stdio.h>
-
- class cfile_stream : public output_stream
- {
- cfile_stream(const cfile_stream &);
- cfile_stream &operator= (const cfile_stream &);
-
- FILE* m_pFile;
- bool m_bStatus;
-
- public:
- cfile_stream() : m_pFile(NULL), m_bStatus(false) { }
-
- virtual ~cfile_stream()
- {
- close();
- }
-
- bool open(const char *pFilename)
- {
- close();
-#ifdef _MSC_VER
- fopen_s(&m_pFile, pFilename, "wb");
-#else
- m_pFile = fopen(pFilename, "wb");
-#endif
- m_bStatus = (m_pFile != NULL);
- return m_bStatus;
- }
-
- bool close()
- {
- if (m_pFile)
- {
- if (fclose(m_pFile) == EOF)
- {
- m_bStatus = false;
- }
- m_pFile = NULL;
- }
- return m_bStatus;
- }
-
- virtual bool put_buf(const void* pBuf, int len)
- {
- m_bStatus = m_bStatus && (fwrite(pBuf, len, 1, m_pFile) == 1);
- return m_bStatus;
- }
-
- uint get_size() const
- {
- return m_pFile ? ftell(m_pFile) : 0;
- }
- };
-
- // Writes JPEG image to file.
- bool compress_image_to_jpeg_file(const char *pFilename, int width, int height, int num_channels, const uint8 *pImage_data, const params &comp_params)
- {
- cfile_stream dst_stream;
- if (!dst_stream.open(pFilename))
- return false;
-
- jpge::jpeg_encoder dst_image;
- if (!dst_image.init(&dst_stream, width, height, num_channels, comp_params))
- return false;
-
- for (uint pass_index = 0; pass_index < dst_image.get_total_passes(); pass_index++)
- {
- for (int i = 0; i < height; i++)
- {
- const uint8* pBuf = pImage_data + i * width * num_channels;
- if (!dst_image.process_scanline(pBuf))
- return false;
- }
- if (!dst_image.process_scanline(NULL))
- return false;
- }
-
- dst_image.deinit();
-
- return dst_stream.close();
- }
-
- class memory_stream : public output_stream
- {
- memory_stream(const memory_stream &);
- memory_stream &operator= (const memory_stream &);
-
- uint8 *m_pBuf;
- uint m_buf_size, m_buf_ofs;
-
- public:
- memory_stream(void *pBuf, uint buf_size) : m_pBuf(static_cast<uint8*>(pBuf)), m_buf_size(buf_size), m_buf_ofs(0) { }
-
- virtual ~memory_stream() { }
-
- virtual bool put_buf(const void* pBuf, int len)
- {
- uint buf_remaining = m_buf_size - m_buf_ofs;
- if ((uint)len > buf_remaining)
- return false;
- memcpy(m_pBuf + m_buf_ofs, pBuf, len);
- m_buf_ofs += len;
- return true;
- }
-
- uint get_size() const
- {
- return m_buf_ofs;
- }
- };
-
- bool compress_image_to_jpeg_file_in_memory(void *pDstBuf, int &buf_size, int width, int height, int num_channels, const uint8 *pImage_data, const params &comp_params)
- {
- if ((!pDstBuf) || (!buf_size))
- return false;
-
- memory_stream dst_stream(pDstBuf, buf_size);
-
- buf_size = 0;
-
- jpge::jpeg_encoder dst_image;
- if (!dst_image.init(&dst_stream, width, height, num_channels, comp_params))
- return false;
-
- for (uint pass_index = 0; pass_index < dst_image.get_total_passes(); pass_index++)
- {
- for (int i = 0; i < height; i++)
- {
- const uint8* pScanline = pImage_data + i * width * num_channels;
- if (!dst_image.process_scanline(pScanline))
- return false;
- }
- if (!dst_image.process_scanline(NULL))
- return false;
- }
-
- dst_image.deinit();
-
- buf_size = dst_stream.get_size();
- return true;
- }
-
-} // namespace jpge
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_jpge.h b/Libraries/crunch-ea9b8d/crnlib/crn_jpge.h
deleted file mode 100644
index 5765cc94..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_jpge.h
+++ /dev/null
@@ -1,169 +0,0 @@
-// jpge.h - C++ class for JPEG compression.
-// Public domain, Rich Geldreich <richgel99@gmail.com>
-// Alex Evans: Added RGBA support, linear memory allocator.
-#ifndef JPEG_ENCODER_H
-#define JPEG_ENCODER_H
-
-namespace jpge
-{
- typedef unsigned char uint8;
- typedef signed short int16;
- typedef signed int int32;
- typedef unsigned short uint16;
- typedef unsigned int uint32;
- typedef unsigned int uint;
-
- // JPEG chroma subsampling factors. Y_ONLY (grayscale images) and H2V2 (color images) are the most common.
- enum subsampling_t { Y_ONLY = 0, H1V1 = 1, H2V1 = 2, H2V2 = 3 };
-
- // JPEG compression parameters structure.
- struct params
- {
- inline params() : m_quality(85), m_subsampling(H2V2), m_no_chroma_discrim_flag(false), m_two_pass_flag(false) { }
-
- inline bool check() const
- {
- if ((m_quality < 1) || (m_quality > 100)) return false;
- if ((uint)m_subsampling > (uint)H2V2) return false;
- return true;
- }
-
- // Quality: 1-100, higher is better. Typical values are around 50-95.
- int m_quality;
-
- // m_subsampling:
- // 0 = Y (grayscale) only
- // 1 = YCbCr, no subsampling (H1V1, YCbCr 1x1x1, 3 blocks per MCU)
- // 2 = YCbCr, H2V1 subsampling (YCbCr 2x1x1, 4 blocks per MCU)
- // 3 = YCbCr, H2V2 subsampling (YCbCr 4x1x1, 6 blocks per MCU-- very common)
- subsampling_t m_subsampling;
-
- // Disables CbCr discrimination - only intended for testing.
- // If true, the Y quantization table is also used for the CbCr channels.
- bool m_no_chroma_discrim_flag;
-
- bool m_two_pass_flag;
- };
-
- // Writes JPEG image to a file.
- // num_channels must be 1 (Y) or 3 (RGB), image pitch must be width*num_channels.
- bool compress_image_to_jpeg_file(const char *pFilename, int width, int height, int num_channels, const uint8 *pImage_data, const params &comp_params = params());
-
- // Writes JPEG image to memory buffer.
- // On entry, buf_size is the size of the output buffer pointed at by pBuf, which should be at least ~1024 bytes.
- // If return value is true, buf_size will be set to the size of the compressed data.
- bool compress_image_to_jpeg_file_in_memory(void *pBuf, int &buf_size, int width, int height, int num_channels, const uint8 *pImage_data, const params &comp_params = params());
-
- // Output stream abstract class - used by the jpeg_encoder class to write to the output stream.
- // put_buf() is generally called with len==JPGE_OUT_BUF_SIZE bytes, but for headers it'll be called with smaller amounts.
- class output_stream
- {
- public:
- virtual ~output_stream() { };
- virtual bool put_buf(const void* Pbuf, int len) = 0;
- template<class T> inline bool put_obj(const T& obj) { return put_buf(&obj, sizeof(T)); }
- };
-
- // Lower level jpeg_encoder class - useful if more control is needed than the above helper functions.
- class jpeg_encoder
- {
- public:
- jpeg_encoder();
- ~jpeg_encoder();
-
- // Initializes the compressor.
- // pStream: The stream object to use for writing compressed data.
- // params - Compression parameters structure, defined above.
- // width, height - Image dimensions.
- // channels - May be 1, or 3. 1 indicates grayscale, 3 indicates RGB source data.
- // Returns false on out of memory or if a stream write fails.
- bool init(output_stream *pStream, int width, int height, int src_channels, const params &comp_params = params());
-
- const params &get_params() const { return m_params; }
-
- // Deinitializes the compressor, freeing any allocated memory. May be called at any time.
- void deinit();
-
- uint get_total_passes() const { return m_params.m_two_pass_flag ? 2 : 1; }
- inline uint get_cur_pass() { return m_pass_num; }
-
- // Call this method with each source scanline.
- // width * src_channels bytes per scanline is expected (RGB or Y format).
- // You must call with NULL after all scanlines are processed to finish compression.
- // Returns false on out of memory or if a stream write fails.
- bool process_scanline(const void* pScanline);
-
- private:
- jpeg_encoder(const jpeg_encoder &);
- jpeg_encoder &operator =(const jpeg_encoder &);
-
- typedef int32 sample_array_t;
-
- output_stream *m_pStream;
- params m_params;
- uint8 m_num_components;
- uint8 m_comp_h_samp[3], m_comp_v_samp[3];
- int m_image_x, m_image_y, m_image_bpp, m_image_bpl;
- int m_image_x_mcu, m_image_y_mcu;
- int m_image_bpl_xlt, m_image_bpl_mcu;
- int m_mcus_per_row;
- int m_mcu_x, m_mcu_y;
- uint8 *m_mcu_lines[16];
- uint8 m_mcu_y_ofs;
- sample_array_t m_sample_array[64];
- int16 m_coefficient_array[64];
- int32 m_quantization_tables[2][64];
- uint m_huff_codes[4][256];
- uint8 m_huff_code_sizes[4][256];
- uint8 m_huff_bits[4][17];
- uint8 m_huff_val[4][256];
- uint32 m_huff_count[4][256];
- int m_last_dc_val[3];
- enum { JPGE_OUT_BUF_SIZE = 2048 };
- uint8 m_out_buf[JPGE_OUT_BUF_SIZE];
- uint8 *m_pOut_buf;
- uint m_out_buf_left;
- uint32 m_bit_buffer;
- uint m_bits_in;
- uint8 m_pass_num;
- bool m_all_stream_writes_succeeded;
-
- void optimize_huffman_table(int table_num, int table_len);
- void emit_byte(uint8 i);
- void emit_word(uint i);
- void emit_marker(int marker);
- void emit_jfif_app0();
- void emit_dqt();
- void emit_sof();
- void emit_dht(uint8 *bits, uint8 *val, int index, bool ac_flag);
- void emit_dhts();
- void emit_sos();
- void emit_markers();
- void compute_huffman_table(uint *codes, uint8 *code_sizes, uint8 *bits, uint8 *val);
- void compute_quant_table(int32 *dst, int16 *src);
- void adjust_quant_table(int32 *dst, int32 *src);
- void first_pass_init();
- bool second_pass_init();
- bool jpg_open(int p_x_res, int p_y_res, int src_channels);
- void load_block_8_8_grey(int x);
- void load_block_8_8(int x, int y, int c);
- void load_block_16_8(int x, int c);
- void load_block_16_8_8(int x, int c);
- void load_quantized_coefficients(int component_num);
- void flush_output_buffer();
- void put_bits(uint bits, uint len);
- void code_coefficients_pass_one(int component_num);
- void code_coefficients_pass_two(int component_num);
- void code_block(int component_num);
- void process_mcu_row();
- bool terminate_pass_one();
- bool terminate_pass_two();
- bool process_end_of_image();
- void load_mcu(const void* src);
- void clear();
- void init();
- };
-
-} // namespace jpge
-
-#endif // JPEG_ENCODER
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_ktx_texture.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_ktx_texture.cpp
deleted file mode 100644
index ddcef6f3..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_ktx_texture.cpp
+++ /dev/null
@@ -1,920 +0,0 @@
-// File: crn_ktx_texture.cpp
-#include "crn_core.h"
-#include "crn_ktx_texture.h"
-#include "crn_console.h"
-
-// Set #if CRNLIB_KTX_PVRTEX_WORKAROUNDS to 1 to enable various workarounds for oddball KTX files written by PVRTexTool.
-#define CRNLIB_KTX_PVRTEX_WORKAROUNDS 1
-
-namespace crnlib
-{
- const uint8 s_ktx_file_id[12] = { 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A };
-
- bool is_packed_pixel_ogl_type(uint32 ogl_type)
- {
- switch (ogl_type)
- {
- case KTX_UNSIGNED_BYTE_3_3_2:
- case KTX_UNSIGNED_BYTE_2_3_3_REV:
- case KTX_UNSIGNED_SHORT_5_6_5:
- case KTX_UNSIGNED_SHORT_5_6_5_REV:
- case KTX_UNSIGNED_SHORT_4_4_4_4:
- case KTX_UNSIGNED_SHORT_4_4_4_4_REV:
- case KTX_UNSIGNED_SHORT_5_5_5_1:
- case KTX_UNSIGNED_SHORT_1_5_5_5_REV:
- case KTX_UNSIGNED_INT_8_8_8_8:
- case KTX_UNSIGNED_INT_8_8_8_8_REV:
- case KTX_UNSIGNED_INT_10_10_10_2:
- case KTX_UNSIGNED_INT_2_10_10_10_REV:
- case KTX_UNSIGNED_INT_24_8:
- case KTX_UNSIGNED_INT_10F_11F_11F_REV:
- case KTX_UNSIGNED_INT_5_9_9_9_REV:
- return true;
- }
- return false;
- }
-
- uint get_ogl_type_size(uint32 ogl_type)
- {
- switch (ogl_type)
- {
- case KTX_UNSIGNED_BYTE:
- case KTX_BYTE:
- return 1;
- case KTX_HALF_FLOAT:
- case KTX_UNSIGNED_SHORT:
- case KTX_SHORT:
- return 2;
- case KTX_FLOAT:
- case KTX_UNSIGNED_INT:
- case KTX_INT:
- return 4;
- case KTX_UNSIGNED_BYTE_3_3_2:
- case KTX_UNSIGNED_BYTE_2_3_3_REV:
- return 1;
- case KTX_UNSIGNED_SHORT_5_6_5:
- case KTX_UNSIGNED_SHORT_5_6_5_REV:
- case KTX_UNSIGNED_SHORT_4_4_4_4:
- case KTX_UNSIGNED_SHORT_4_4_4_4_REV:
- case KTX_UNSIGNED_SHORT_5_5_5_1:
- case KTX_UNSIGNED_SHORT_1_5_5_5_REV:
- return 2;
- case KTX_UNSIGNED_INT_8_8_8_8:
- case KTX_UNSIGNED_INT_8_8_8_8_REV:
- case KTX_UNSIGNED_INT_10_10_10_2:
- case KTX_UNSIGNED_INT_2_10_10_10_REV:
- case KTX_UNSIGNED_INT_24_8:
- case KTX_UNSIGNED_INT_10F_11F_11F_REV:
- case KTX_UNSIGNED_INT_5_9_9_9_REV:
- return 4;
- }
- return 0;
- }
-
- uint32 get_ogl_base_internal_fmt(uint32 ogl_fmt)
- {
- switch (ogl_fmt)
- {
- case KTX_ETC1_RGB8_OES:
- case KTX_RGB_S3TC:
- case KTX_RGB4_S3TC:
- case KTX_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case KTX_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- return KTX_RGB;
- case KTX_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- case KTX_RGBA_S3TC:
- case KTX_RGBA4_S3TC:
- case KTX_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- case KTX_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- case KTX_RGBA_DXT5_S3TC:
- case KTX_RGBA4_DXT5_S3TC:
- return KTX_RGBA;
- case 1:
- case KTX_RED:
- case KTX_RED_INTEGER:
- case KTX_GREEN:
- case KTX_GREEN_INTEGER:
- case KTX_BLUE:
- case KTX_BLUE_INTEGER:
- case KTX_R8:
- case KTX_R8UI:
- case KTX_LUMINANCE8:
- case KTX_ALPHA:
- case KTX_LUMINANCE:
- case KTX_COMPRESSED_RED_RGTC1_EXT:
- case KTX_COMPRESSED_SIGNED_RED_RGTC1_EXT:
- case KTX_COMPRESSED_LUMINANCE_LATC1_EXT:
- case KTX_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
- return KTX_RED;
- case 2:
- case KTX_RG:
- case KTX_RG8:
- case KTX_RG_INTEGER:
- case KTX_LUMINANCE_ALPHA:
- case KTX_COMPRESSED_RED_GREEN_RGTC2_EXT:
- case KTX_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:
- case KTX_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
- case KTX_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
- return KTX_RG;
- case 3:
- case KTX_SRGB:
- case KTX_RGB:
- case KTX_RGB_INTEGER:
- case KTX_BGR:
- case KTX_BGR_INTEGER:
- case KTX_RGB8:
- case KTX_SRGB8:
- return KTX_RGB;
- case 4:
- case KTX_RGBA:
- case KTX_BGRA:
- case KTX_RGBA_INTEGER:
- case KTX_BGRA_INTEGER:
- case KTX_SRGB_ALPHA:
- case KTX_SRGB8_ALPHA8:
- case KTX_RGBA8:
- return KTX_RGBA;
- }
- return 0;
- }
-
- bool get_ogl_fmt_desc(uint32 ogl_fmt, uint32 ogl_type, uint& block_dim, uint& bytes_per_block)
- {
- uint ogl_type_size = get_ogl_type_size(ogl_type);
-
- block_dim = 1;
- bytes_per_block = 0;
-
- switch (ogl_fmt)
- {
- case KTX_COMPRESSED_RED_RGTC1_EXT:
- case KTX_COMPRESSED_SIGNED_RED_RGTC1_EXT:
- case KTX_COMPRESSED_LUMINANCE_LATC1_EXT:
- case KTX_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
- case KTX_ETC1_RGB8_OES:
- case KTX_RGB_S3TC:
- case KTX_RGB4_S3TC:
- case KTX_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case KTX_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case KTX_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- case KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- {
- block_dim = 4;
- bytes_per_block = 8;
- break;
- }
- case KTX_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
- case KTX_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
- case KTX_COMPRESSED_RED_GREEN_RGTC2_EXT:
- case KTX_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:
- case KTX_RGBA_S3TC:
- case KTX_RGBA4_S3TC:
- case KTX_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- case KTX_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- case KTX_RGBA_DXT5_S3TC:
- case KTX_RGBA4_DXT5_S3TC:
- {
- block_dim = 4;
- bytes_per_block = 16;
- break;
- }
- case 1:
- case KTX_ALPHA:
- case KTX_RED:
- case KTX_GREEN:
- case KTX_BLUE:
- case KTX_RED_INTEGER:
- case KTX_GREEN_INTEGER:
- case KTX_BLUE_INTEGER:
- case KTX_LUMINANCE:
- {
- bytes_per_block = ogl_type_size;
- break;
- }
- case KTX_R8:
- case KTX_R8UI:
- case KTX_ALPHA8:
- case KTX_LUMINANCE8:
- {
- bytes_per_block = 1;
- break;
- }
- case 2:
- case KTX_RG:
- case KTX_RG_INTEGER:
- case KTX_LUMINANCE_ALPHA:
- {
- bytes_per_block = 2 * ogl_type_size;
- break;
- }
- case KTX_RG8:
- case KTX_LUMINANCE8_ALPHA8:
- {
- bytes_per_block = 2;
- break;
- }
- case 3:
- case KTX_SRGB:
- case KTX_RGB:
- case KTX_BGR:
- case KTX_RGB_INTEGER:
- case KTX_BGR_INTEGER:
- {
- bytes_per_block = is_packed_pixel_ogl_type(ogl_type) ? ogl_type_size : (3 * ogl_type_size);
- break;
- }
- case KTX_RGB8:
- case KTX_SRGB8:
- {
- bytes_per_block = 3;
- break;
- }
- case 4:
- case KTX_RGBA:
- case KTX_BGRA:
- case KTX_RGBA_INTEGER:
- case KTX_BGRA_INTEGER:
- case KTX_SRGB_ALPHA:
- {
- bytes_per_block = is_packed_pixel_ogl_type(ogl_type) ? ogl_type_size : (4 * ogl_type_size);
- break;
- }
- case KTX_SRGB8_ALPHA8:
- case KTX_RGBA8:
- {
- bytes_per_block = 4;
- break;
- }
- default:
- return false;
- }
- return true;
- }
-
- bool ktx_texture::compute_pixel_info()
- {
- if ((!m_header.m_glType) || (!m_header.m_glFormat))
- {
- if ((m_header.m_glType) || (m_header.m_glFormat))
- return false;
-
- // Must be a compressed format.
- if (!get_ogl_fmt_desc(m_header.m_glInternalFormat, m_header.m_glType, m_block_dim, m_bytes_per_block))
- {
-#if CRNLIB_KTX_PVRTEX_WORKAROUNDS
- if ((!m_header.m_glInternalFormat) && (!m_header.m_glType) && (!m_header.m_glTypeSize) && (!m_header.m_glBaseInternalFormat))
- {
- // PVRTexTool writes bogus headers when outputting ETC1.
- console::warning("ktx_texture::compute_pixel_info: Header doesn't specify any format, assuming ETC1 and hoping for the best");
- m_header.m_glBaseInternalFormat = KTX_RGB;
- m_header.m_glInternalFormat = KTX_ETC1_RGB8_OES;
- m_header.m_glTypeSize = 1;
- m_block_dim = 4;
- m_bytes_per_block = 8;
- return true;
- }
-#endif
- return false;
- }
-
- if (m_block_dim == 1)
- return false;
- }
- else
- {
- // Must be an uncompressed format.
- if (!get_ogl_fmt_desc(m_header.m_glFormat, m_header.m_glType, m_block_dim, m_bytes_per_block))
- return false;
-
- if (m_block_dim > 1)
- return false;
- }
- return true;
- }
-
- bool ktx_texture::read_from_stream(data_stream_serializer& serializer)
- {
- clear();
-
- // Read header
- if (serializer.read(&m_header, 1, sizeof(m_header)) != sizeof(ktx_header))
- return false;
-
- // Check header
- if (memcmp(s_ktx_file_id, m_header.m_identifier, sizeof(m_header.m_identifier)))
- return false;
-
- if ((m_header.m_endianness != KTX_OPPOSITE_ENDIAN) && (m_header.m_endianness != KTX_ENDIAN))
- return false;
-
- m_opposite_endianness = (m_header.m_endianness == KTX_OPPOSITE_ENDIAN);
- if (m_opposite_endianness)
- {
- m_header.endian_swap();
-
- if ((m_header.m_glTypeSize != sizeof(uint8)) && (m_header.m_glTypeSize != sizeof(uint16)) && (m_header.m_glTypeSize != sizeof(uint32)))
- return false;
- }
-
- if (!check_header())
- return false;
-
- if (!compute_pixel_info())
- return false;
-
- uint8 pad_bytes[3];
-
- // Read the key value entries
- uint num_key_value_bytes_remaining = m_header.m_bytesOfKeyValueData;
- while (num_key_value_bytes_remaining)
- {
- if (num_key_value_bytes_remaining < sizeof(uint32))
- return false;
-
- uint32 key_value_byte_size;
- if (serializer.read(&key_value_byte_size, 1, sizeof(uint32)) != sizeof(uint32))
- return false;
-
- num_key_value_bytes_remaining -= sizeof(uint32);
-
- if (m_opposite_endianness)
- key_value_byte_size = utils::swap32(key_value_byte_size);
-
- if (key_value_byte_size > num_key_value_bytes_remaining)
- return false;
-
- uint8_vec key_value_data;
- if (key_value_byte_size)
- {
- key_value_data.resize(key_value_byte_size);
- if (serializer.read(&key_value_data[0], 1, key_value_byte_size) != key_value_byte_size)
- return false;
- }
-
- m_key_values.push_back(key_value_data);
-
- uint padding = 3 - ((key_value_byte_size + 3) % 4);
- if (padding)
- {
- if (serializer.read(pad_bytes, 1, padding) != padding)
- return false;
- }
-
- num_key_value_bytes_remaining -= key_value_byte_size;
- if (num_key_value_bytes_remaining < padding)
- return false;
- num_key_value_bytes_remaining -= padding;
- }
-
- // Now read the mip levels
- uint total_faces = get_num_mips() * get_array_size() * get_num_faces() * get_depth();
- if ((!total_faces) || (total_faces > 65535))
- return false;
-
- // See Section 2.8 of KTX file format: No rounding to block sizes should be applied for block compressed textures.
- // OK, I'm going to break that rule otherwise KTX can only store a subset of textures that DDS can handle for no good reason.
-#if 0
- const uint mip0_row_blocks = m_header.m_pixelWidth / m_block_dim;
- const uint mip0_col_blocks = CRNLIB_MAX(1, m_header.m_pixelHeight) / m_block_dim;
-#else
- const uint mip0_row_blocks = (m_header.m_pixelWidth + m_block_dim - 1) / m_block_dim;
- const uint mip0_col_blocks = (CRNLIB_MAX(1, m_header.m_pixelHeight) + m_block_dim - 1) / m_block_dim;
-#endif
- if ((!mip0_row_blocks) || (!mip0_col_blocks))
- return false;
-
- const uint mip0_depth = CRNLIB_MAX(1, m_header.m_pixelDepth); mip0_depth;
-
- bool has_valid_image_size_fields = true;
- bool disable_mip_and_cubemap_padding = false;
-
-#if CRNLIB_KTX_PVRTEX_WORKAROUNDS
- {
- // PVRTexTool has a bogus KTX writer that doesn't write any imageSize fields. Nice.
- size_t expected_bytes_remaining = 0;
- for (uint mip_level = 0; mip_level < get_num_mips(); mip_level++)
- {
- uint mip_width, mip_height, mip_depth;
- get_mip_dim(mip_level, mip_width, mip_height, mip_depth);
-
- const uint mip_row_blocks = (mip_width + m_block_dim - 1) / m_block_dim;
- const uint mip_col_blocks = (mip_height + m_block_dim - 1) / m_block_dim;
- if ((!mip_row_blocks) || (!mip_col_blocks))
- return false;
-
- expected_bytes_remaining += sizeof(uint32);
-
- if ((!m_header.m_numberOfArrayElements) && (get_num_faces() == 6))
- {
- for (uint face = 0; face < get_num_faces(); face++)
- {
- uint slice_size = mip_row_blocks * mip_col_blocks * m_bytes_per_block;
- expected_bytes_remaining += slice_size;
-
- uint num_cube_pad_bytes = 3 - ((slice_size + 3) % 4);
- expected_bytes_remaining += num_cube_pad_bytes;
- }
- }
- else
- {
- uint total_mip_size = 0;
- for (uint array_element = 0; array_element < get_array_size(); array_element++)
- {
- for (uint face = 0; face < get_num_faces(); face++)
- {
- for (uint zslice = 0; zslice < mip_depth; zslice++)
- {
- uint slice_size = mip_row_blocks * mip_col_blocks * m_bytes_per_block;
- total_mip_size += slice_size;
- }
- }
- }
- expected_bytes_remaining += total_mip_size;
-
- uint num_mip_pad_bytes = 3 - ((total_mip_size + 3) % 4);
- expected_bytes_remaining += num_mip_pad_bytes;
- }
- }
-
- if (serializer.get_stream()->get_remaining() < expected_bytes_remaining)
- {
- has_valid_image_size_fields = false;
- disable_mip_and_cubemap_padding = true;
- console::warning("ktx_texture::read_from_stream: KTX file size is smaller than expected - trying to read anyway without imageSize fields");
- }
- }
-#endif
-
- for (uint mip_level = 0; mip_level < get_num_mips(); mip_level++)
- {
- uint mip_width, mip_height, mip_depth;
- get_mip_dim(mip_level, mip_width, mip_height, mip_depth);
-
- const uint mip_row_blocks = (mip_width + m_block_dim - 1) / m_block_dim;
- const uint mip_col_blocks = (mip_height + m_block_dim - 1) / m_block_dim;
- if ((!mip_row_blocks) || (!mip_col_blocks))
- return false;
-
- uint32 image_size = 0;
- if (!has_valid_image_size_fields)
- image_size = mip_depth * mip_row_blocks * mip_col_blocks * m_bytes_per_block * get_array_size() * get_num_faces();
- else
- {
- if (serializer.read(&image_size, 1, sizeof(image_size)) != sizeof(image_size))
- return false;
-
- if (m_opposite_endianness)
- image_size = utils::swap32(image_size);
- }
-
- if (!image_size)
- return false;
-
- uint total_mip_size = 0;
-
- if ((!m_header.m_numberOfArrayElements) && (get_num_faces() == 6))
- {
- // plain non-array cubemap
- for (uint face = 0; face < get_num_faces(); face++)
- {
- CRNLIB_ASSERT(m_image_data.size() == get_image_index(mip_level, 0, face, 0));
-
- m_image_data.push_back(uint8_vec());
- uint8_vec& image_data = m_image_data.back();
-
- image_data.resize(image_size);
- if (serializer.read(&image_data[0], 1, image_size) != image_size)
- return false;
-
- if (m_opposite_endianness)
- utils::endian_swap_mem(&image_data[0], image_size, m_header.m_glTypeSize);
-
- uint num_cube_pad_bytes = disable_mip_and_cubemap_padding ? 0 : (3 - ((image_size + 3) % 4));
- if (serializer.read(pad_bytes, 1, num_cube_pad_bytes) != num_cube_pad_bytes)
- return false;
-
- total_mip_size += image_size + num_cube_pad_bytes;
- }
- }
- else
- {
- // 1D, 2D, 3D (normal or array texture), or array cubemap
- uint num_image_bytes_remaining = image_size;
-
- for (uint array_element = 0; array_element < get_array_size(); array_element++)
- {
- for (uint face = 0; face < get_num_faces(); face++)
- {
- for (uint zslice = 0; zslice < mip_depth; zslice++)
- {
- CRNLIB_ASSERT(m_image_data.size() == get_image_index(mip_level, array_element, face, zslice));
-
- uint slice_size = mip_row_blocks * mip_col_blocks * m_bytes_per_block;
- if ((!slice_size) || (slice_size > num_image_bytes_remaining))
- return false;
-
- m_image_data.push_back(uint8_vec());
- uint8_vec& image_data = m_image_data.back();
-
- image_data.resize(slice_size);
- if (serializer.read(&image_data[0], 1, slice_size) != slice_size)
- return false;
-
- if (m_opposite_endianness)
- utils::endian_swap_mem(&image_data[0], slice_size, m_header.m_glTypeSize);
-
- num_image_bytes_remaining -= slice_size;
-
- total_mip_size += slice_size;
- }
- }
- }
-
- if (num_image_bytes_remaining)
- return false;
- }
-
- uint num_mip_pad_bytes = disable_mip_and_cubemap_padding ? 0 : (3 - ((total_mip_size + 3) % 4));
- if (serializer.read(pad_bytes, 1, num_mip_pad_bytes) != num_mip_pad_bytes)
- return false;
- }
- return true;
- }
-
- bool ktx_texture::write_to_stream(data_stream_serializer& serializer, bool no_keyvalue_data)
- {
- if (!consistency_check())
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- memcpy(m_header.m_identifier, s_ktx_file_id, sizeof(m_header.m_identifier));
- m_header.m_endianness = m_opposite_endianness ? KTX_OPPOSITE_ENDIAN : KTX_ENDIAN;
-
- if (m_block_dim == 1)
- {
- m_header.m_glTypeSize = get_ogl_type_size(m_header.m_glType);
- m_header.m_glBaseInternalFormat = m_header.m_glFormat;
- }
- else
- {
- m_header.m_glBaseInternalFormat = get_ogl_base_internal_fmt(m_header.m_glInternalFormat);
- }
-
- m_header.m_bytesOfKeyValueData = 0;
- if (!no_keyvalue_data)
- {
- for (uint i = 0; i < m_key_values.size(); i++)
- m_header.m_bytesOfKeyValueData += sizeof(uint32) + ((m_key_values[i].size() + 3) & ~3);
- }
-
- if (m_opposite_endianness)
- m_header.endian_swap();
-
- bool success = (serializer.write(&m_header, sizeof(m_header), 1) == 1);
-
- if (m_opposite_endianness)
- m_header.endian_swap();
-
- if (!success)
- return success;
-
- uint total_key_value_bytes = 0;
- const uint8 padding[3] = { 0, 0, 0 };
-
- if (!no_keyvalue_data)
- {
- for (uint i = 0; i < m_key_values.size(); i++)
- {
- uint32 key_value_size = m_key_values[i].size();
-
- if (m_opposite_endianness)
- key_value_size = utils::swap32(key_value_size);
-
- success = (serializer.write(&key_value_size, sizeof(key_value_size), 1) == 1);
- total_key_value_bytes += sizeof(key_value_size);
-
- if (m_opposite_endianness)
- key_value_size = utils::swap32(key_value_size);
-
- if (!success)
- return false;
-
- if (key_value_size)
- {
- if (serializer.write(&m_key_values[i][0], key_value_size, 1) != 1)
- return false;
- total_key_value_bytes += key_value_size;
-
- uint num_padding = 3 - ((key_value_size + 3) % 4);
- if ((num_padding) && (serializer.write(padding, num_padding, 1) != 1))
- return false;
- total_key_value_bytes += num_padding;
- }
- }
- (void)total_key_value_bytes;
- }
-
- CRNLIB_ASSERT(total_key_value_bytes == m_header.m_bytesOfKeyValueData);
-
- for (uint mip_level = 0; mip_level < get_num_mips(); mip_level++)
- {
- uint mip_width, mip_height, mip_depth;
- get_mip_dim(mip_level, mip_width, mip_height, mip_depth);
-
- const uint mip_row_blocks = (mip_width + m_block_dim - 1) / m_block_dim;
- const uint mip_col_blocks = (mip_height + m_block_dim - 1) / m_block_dim;
- if ((!mip_row_blocks) || (!mip_col_blocks))
- return false;
-
- uint32 image_size = mip_row_blocks * mip_col_blocks * m_bytes_per_block;
- if ((m_header.m_numberOfArrayElements) || (get_num_faces() == 1))
- image_size *= (get_array_size() * get_num_faces() * get_depth());
-
- if (!image_size)
- return false;
-
- if (m_opposite_endianness)
- image_size = utils::swap32(image_size);
-
- success = (serializer.write(&image_size, sizeof(image_size), 1) == 1);
-
- if (m_opposite_endianness)
- image_size = utils::swap32(image_size);
-
- if (!success)
- return false;
-
- uint total_mip_size = 0;
-
- if ((!m_header.m_numberOfArrayElements) && (get_num_faces() == 6))
- {
- // plain non-array cubemap
- for (uint face = 0; face < get_num_faces(); face++)
- {
- const uint8_vec& image_data = get_image_data(get_image_index(mip_level, 0, face, 0));
- if ((!image_data.size()) || (image_data.size() != image_size))
- return false;
-
- if (m_opposite_endianness)
- {
- uint8_vec tmp_image_data(image_data);
- utils::endian_swap_mem(&tmp_image_data[0], tmp_image_data.size(), m_header.m_glTypeSize);
- if (serializer.write(&tmp_image_data[0], tmp_image_data.size(), 1) != 1)
- return false;
- }
- else if (serializer.write(&image_data[0], image_data.size(), 1) != 1)
- return false;
-
- uint num_cube_pad_bytes = 3 - ((image_data.size() + 3) % 4);
- if ((num_cube_pad_bytes) && (serializer.write(padding, num_cube_pad_bytes, 1) != 1))
- return false;
-
- total_mip_size += image_size + num_cube_pad_bytes;
- }
- }
- else
- {
- // 1D, 2D, 3D (normal or array texture), or array cubemap
- for (uint array_element = 0; array_element < get_array_size(); array_element++)
- {
- for (uint face = 0; face < get_num_faces(); face++)
- {
- for (uint zslice = 0; zslice < mip_depth; zslice++)
- {
- const uint8_vec& image_data = get_image_data(get_image_index(mip_level, array_element, face, zslice));
- if (!image_data.size())
- return false;
-
- if (m_opposite_endianness)
- {
- uint8_vec tmp_image_data(image_data);
- utils::endian_swap_mem(&tmp_image_data[0], tmp_image_data.size(), m_header.m_glTypeSize);
- if (serializer.write(&tmp_image_data[0], tmp_image_data.size(), 1) != 1)
- return false;
- }
- else if (serializer.write(&image_data[0], image_data.size(), 1) != 1)
- return false;
-
- total_mip_size += image_data.size();
- }
- }
- }
-
- uint num_mip_pad_bytes = 3 - ((total_mip_size + 3) % 4);
- if ((num_mip_pad_bytes) && (serializer.write(padding, num_mip_pad_bytes, 1) != 1))
- return false;
- total_mip_size += num_mip_pad_bytes;
- }
- CRNLIB_ASSERT((total_mip_size & 3) == 0);
- }
-
- return true;
- }
-
- bool ktx_texture::init_2D(uint width, uint height, uint num_mips, uint32 ogl_internal_fmt, uint32 ogl_fmt, uint32 ogl_type)
- {
- clear();
-
- m_header.m_pixelWidth = width;
- m_header.m_pixelHeight = height;
- m_header.m_numberOfMipmapLevels = num_mips;
- m_header.m_glInternalFormat = ogl_internal_fmt;
- m_header.m_glFormat = ogl_fmt;
- m_header.m_glType = ogl_type;
- m_header.m_numberOfFaces = 1;
-
- if (!compute_pixel_info())
- return false;
-
- return true;
- }
-
- bool ktx_texture::init_2D_array(uint width, uint height, uint num_mips, uint array_size, uint32 ogl_internal_fmt, uint32 ogl_fmt, uint32 ogl_type)
- {
- clear();
-
- m_header.m_pixelWidth = width;
- m_header.m_pixelHeight = height;
- m_header.m_numberOfMipmapLevels = num_mips;
- m_header.m_numberOfArrayElements = array_size;
- m_header.m_glInternalFormat = ogl_internal_fmt;
- m_header.m_glFormat = ogl_fmt;
- m_header.m_glType = ogl_type;
- m_header.m_numberOfFaces = 1;
-
- if (!compute_pixel_info())
- return false;
-
- return true;
- }
-
- bool ktx_texture::init_3D(uint width, uint height, uint depth, uint num_mips, uint32 ogl_internal_fmt, uint32 ogl_fmt, uint32 ogl_type)
- {
- clear();
-
- m_header.m_pixelWidth = width;
- m_header.m_pixelHeight = height;
- m_header.m_pixelDepth = depth;
- m_header.m_numberOfMipmapLevels = num_mips;
- m_header.m_glInternalFormat = ogl_internal_fmt;
- m_header.m_glFormat = ogl_fmt;
- m_header.m_glType = ogl_type;
- m_header.m_numberOfFaces = 1;
-
- if (!compute_pixel_info())
- return false;
-
- return true;
- }
-
- bool ktx_texture::init_cubemap(uint dim, uint num_mips, uint32 ogl_internal_fmt, uint32 ogl_fmt, uint32 ogl_type)
- {
- clear();
-
- m_header.m_pixelWidth = dim;
- m_header.m_pixelHeight = dim;
- m_header.m_numberOfMipmapLevels = num_mips;
- m_header.m_glInternalFormat = ogl_internal_fmt;
- m_header.m_glFormat = ogl_fmt;
- m_header.m_glType = ogl_type;
- m_header.m_numberOfFaces = 6;
-
- if (!compute_pixel_info())
- return false;
-
- return true;
- }
-
- bool ktx_texture::check_header() const
- {
- if (((get_num_faces() != 1) && (get_num_faces() != 6)) || (!m_header.m_pixelWidth))
- return false;
-
- if ((!m_header.m_pixelHeight) && (m_header.m_pixelDepth))
- return false;
-
- if ((get_num_faces() == 6) && ((m_header.m_pixelDepth) || (!m_header.m_pixelHeight)))
- return false;
-
- if (m_header.m_numberOfMipmapLevels)
- {
- const uint max_mipmap_dimension = 1U << (m_header.m_numberOfMipmapLevels - 1U);
- if (max_mipmap_dimension > (CRNLIB_MAX(CRNLIB_MAX(m_header.m_pixelWidth, m_header.m_pixelHeight), m_header.m_pixelDepth)))
- return false;
- }
-
- return true;
- }
-
- bool ktx_texture::consistency_check() const
- {
- if (!check_header())
- return false;
-
- uint block_dim = 0, bytes_per_block = 0;
- if ((!m_header.m_glType) || (!m_header.m_glFormat))
- {
- if ((m_header.m_glType) || (m_header.m_glFormat))
- return false;
- if (!get_ogl_fmt_desc(m_header.m_glInternalFormat, m_header.m_glType, block_dim, bytes_per_block))
- return false;
- if (block_dim == 1)
- return false;
- //if ((get_width() % block_dim) || (get_height() % block_dim))
- // return false;
- }
- else
- {
- if (!get_ogl_fmt_desc(m_header.m_glFormat, m_header.m_glType, block_dim, bytes_per_block))
- return false;
- if (block_dim > 1)
- return false;
- }
- if ((m_block_dim != block_dim) || (m_bytes_per_block != bytes_per_block))
- return false;
-
- if (m_image_data.size() != get_total_images())
- return false;
-
- for (uint mip_level = 0; mip_level < get_num_mips(); mip_level++)
- {
- uint mip_width, mip_height, mip_depth;
- get_mip_dim(mip_level, mip_width, mip_height, mip_depth);
-
- const uint mip_row_blocks = (mip_width + m_block_dim - 1) / m_block_dim;
- const uint mip_col_blocks = (mip_height + m_block_dim - 1) / m_block_dim;
- if ((!mip_row_blocks) || (!mip_col_blocks))
- return false;
-
- for (uint array_element = 0; array_element < get_array_size(); array_element++)
- {
- for (uint face = 0; face < get_num_faces(); face++)
- {
- for (uint zslice = 0; zslice < mip_depth; zslice++)
- {
- const uint8_vec& image_data = get_image_data(get_image_index(mip_level, array_element, face, zslice));
-
- uint expected_image_size = mip_row_blocks * mip_col_blocks * m_bytes_per_block;
- if (image_data.size() != expected_image_size)
- return false;
- }
- }
- }
- }
-
- return true;
- }
-
- const uint8_vec* ktx_texture::find_key(const char* pKey) const
- {
- const size_t n = strlen(pKey) + 1;
- for (uint i = 0; i < m_key_values.size(); i++)
- {
- const uint8_vec& v = m_key_values[i];
- if ((v.size() >= n) && (!memcmp(&v[0], pKey, n)))
- return &v;
- }
-
- return NULL;
- }
-
- bool ktx_texture::get_key_value_as_string(const char* pKey, dynamic_string& str) const
- {
- const uint8_vec* p = find_key(pKey);
- if (!p)
- {
- str.clear();
- return false;
- }
-
- const uint ofs = (static_cast<uint>(strlen(pKey)) + 1);
- const uint8* pValue = p->get_ptr() + ofs;
- const uint n = p->size() - ofs;
-
- uint i;
- for (i = 0; i < n; i++)
- if (!pValue[i])
- break;
-
- str.set_from_buf(pValue, i);
- return true;
- }
-
- uint ktx_texture::add_key_value(const char* pKey, const void* pVal, uint val_size)
- {
- const uint idx = m_key_values.size();
- m_key_values.resize(idx + 1);
- uint8_vec& v = m_key_values.back();
- v.append(reinterpret_cast<const uint8*>(pKey), static_cast<uint>(strlen(pKey)) + 1);
- v.append(static_cast<const uint8*>(pVal), val_size);
- return idx;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_ktx_texture.h b/Libraries/crunch-ea9b8d/crnlib/crn_ktx_texture.h
deleted file mode 100644
index b694fa1d..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_ktx_texture.h
+++ /dev/null
@@ -1,244 +0,0 @@
-// File: crn_ktx_texture.h
-#ifndef _KTX_TEXTURE_H_
-#define _KTX_TEXTURE_H_
-#ifdef _MSC_VER
-#pragma once
-#endif
-
-#include "crn_data_stream_serializer.h"
-
-#define KTX_ENDIAN 0x04030201
-#define KTX_OPPOSITE_ENDIAN 0x01020304
-
-namespace crnlib
-{
- extern const uint8 s_ktx_file_id[12];
-
- struct ktx_header
- {
- uint8 m_identifier[12];
- uint32 m_endianness;
- uint32 m_glType;
- uint32 m_glTypeSize;
- uint32 m_glFormat;
- uint32 m_glInternalFormat;
- uint32 m_glBaseInternalFormat;
- uint32 m_pixelWidth;
- uint32 m_pixelHeight;
- uint32 m_pixelDepth;
- uint32 m_numberOfArrayElements;
- uint32 m_numberOfFaces;
- uint32 m_numberOfMipmapLevels;
- uint32 m_bytesOfKeyValueData;
-
- void clear()
- {
- memset(this, 0, sizeof(*this));
- }
-
- void endian_swap()
- {
- utils::endian_swap_mem32(&m_endianness, (sizeof(*this) - sizeof(m_identifier)) / sizeof(uint32));
- }
- };
-
- typedef crnlib::vector<uint8_vec> ktx_key_value_vec;
- typedef crnlib::vector<uint8_vec> ktx_image_data_vec;
-
- // Compressed pixel data formats: ETC1, DXT1, DXT3, DXT5
- enum
- {
- KTX_ETC1_RGB8_OES = 0x8D64, KTX_RGB_S3TC = 0x83A0, KTX_RGB4_S3TC = 0x83A1, KTX_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0,
- KTX_COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1, KTX_COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C, KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D,
- KTX_RGBA_S3TC = 0x83A2, KTX_RGBA4_S3TC = 0x83A3, KTX_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2, KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E,
- KTX_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3, KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F, KTX_RGBA_DXT5_S3TC = 0x83A4, KTX_RGBA4_DXT5_S3TC = 0x83A5,
- KTX_COMPRESSED_RED_RGTC1_EXT = 0x8DBB, KTX_COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC, KTX_COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8DBD, KTX_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8DBE,
- KTX_COMPRESSED_LUMINANCE_LATC1_EXT = 0x8C70, KTX_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT = 0x8C71, KTX_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C72, KTX_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C73
- };
-
- // Pixel formats (various internal, base, and base internal formats)
- enum
- {
- KTX_R8 = 0x8229, KTX_R8UI = 0x8232, KTX_RGB8 = 0x8051, KTX_SRGB8 = 0x8C41, KTX_SRGB = 0x8C40, KTX_SRGB_ALPHA = 0x8C42,
- KTX_SRGB8_ALPHA8 = 0x8C43, KTX_RGBA8 = 0x8058, KTX_STENCIL_INDEX = 0x1901, KTX_DEPTH_COMPONENT = 0x1902, KTX_DEPTH_STENCIL = 0x84F9, KTX_RED = 0x1903,
- KTX_GREEN = 0x1904, KTX_BLUE = 0x1905, KTX_ALPHA = 0x1906, KTX_RG = 0x8227, KTX_RGB = 0x1907, KTX_RGBA = 0x1908, KTX_BGR = 0x80E0, KTX_BGRA = 0x80E1,
- KTX_RED_INTEGER = 0x8D94, KTX_GREEN_INTEGER = 0x8D95, KTX_BLUE_INTEGER = 0x8D96, KTX_ALPHA_INTEGER = 0x8D97, KTX_RGB_INTEGER = 0x8D98, KTX_RGBA_INTEGER = 0x8D99,
- KTX_BGR_INTEGER = 0x8D9A, KTX_BGRA_INTEGER = 0x8D9B, KTX_LUMINANCE = 0x1909, KTX_LUMINANCE_ALPHA = 0x190A, KTX_RG_INTEGER = 0x8228, KTX_RG8 = 0x822B,
- KTX_ALPHA8 = 0x803C, KTX_LUMINANCE8 = 0x8040, KTX_LUMINANCE8_ALPHA8 = 0x8045
- };
-
- // Pixel data types
- enum
- {
- KTX_UNSIGNED_BYTE = 0x1401, KTX_BYTE = 0x1400, KTX_UNSIGNED_SHORT = 0x1403, KTX_SHORT = 0x1402,
- KTX_UNSIGNED_INT = 0x1405, KTX_INT = 0x1404, KTX_HALF_FLOAT = 0x140B, KTX_FLOAT = 0x1406,
- KTX_UNSIGNED_BYTE_3_3_2 = 0x8032, KTX_UNSIGNED_BYTE_2_3_3_REV = 0x8362, KTX_UNSIGNED_SHORT_5_6_5 = 0x8363,
- KTX_UNSIGNED_SHORT_5_6_5_REV = 0x8364, KTX_UNSIGNED_SHORT_4_4_4_4 = 0x8033, KTX_UNSIGNED_SHORT_4_4_4_4_REV = 0x8365,
- KTX_UNSIGNED_SHORT_5_5_5_1 = 0x8034, KTX_UNSIGNED_SHORT_1_5_5_5_REV = 0x8366, KTX_UNSIGNED_INT_8_8_8_8 = 0x8035,
- KTX_UNSIGNED_INT_8_8_8_8_REV = 0x8367, KTX_UNSIGNED_INT_10_10_10_2 = 0x8036, KTX_UNSIGNED_INT_2_10_10_10_REV = 0x8368,
- KTX_UNSIGNED_INT_24_8 = 0x84FA, KTX_UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B, KTX_UNSIGNED_INT_5_9_9_9_REV = 0x8C3E,
- KTX_FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD
- };
-
- bool is_packed_pixel_ogl_type(uint32 ogl_type);
- uint get_ogl_type_size(uint32 ogl_type);
- bool get_ogl_fmt_desc(uint32 ogl_fmt, uint32 ogl_type, uint& block_dim, uint& bytes_per_block);
- uint get_ogl_type_size(uint32 ogl_type);
- uint32 get_ogl_base_internal_fmt(uint32 ogl_fmt);
-
- class ktx_texture
- {
- public:
- ktx_texture()
- {
- clear();
- }
-
- ktx_texture(const ktx_texture& other)
- {
- *this = other;
- }
-
- ktx_texture& operator= (const ktx_texture& rhs)
- {
- if (this == &rhs)
- return *this;
-
- clear();
-
- m_header = rhs.m_header;
- m_key_values = rhs.m_key_values;
- m_image_data = rhs.m_image_data;
- m_block_dim = rhs.m_block_dim;
- m_bytes_per_block = rhs.m_bytes_per_block;
- m_opposite_endianness = rhs.m_opposite_endianness;
-
- return *this;
- }
-
- void clear()
- {
- m_header.clear();
- m_key_values.clear();
- m_image_data.clear();
-
- m_block_dim = 0;
- m_bytes_per_block = 0;
-
- m_opposite_endianness = false;
- }
-
- // High level methods
- bool read_from_stream(data_stream_serializer& serializer);
- bool write_to_stream(data_stream_serializer& serializer, bool no_keyvalue_data = false);
-
- bool init_2D(uint width, uint height, uint num_mips, uint32 ogl_internal_fmt, uint32 ogl_fmt, uint32 ogl_type);
- bool init_2D_array(uint width, uint height, uint num_mips, uint array_size, uint32 ogl_internal_fmt, uint32 ogl_fmt, uint32 ogl_type);
- bool init_3D(uint width, uint height, uint depth, uint num_mips, uint32 ogl_internal_fmt, uint32 ogl_fmt, uint32 ogl_type);
- bool init_cubemap(uint dim, uint num_mips, uint32 ogl_internal_fmt, uint32 ogl_fmt, uint32 ogl_type);
-
- bool check_header() const;
- bool consistency_check() const;
-
- // General info
-
- bool is_valid() const { return (m_header.m_pixelWidth > 0) && (m_image_data.size() > 0); }
-
- uint get_width() const { return m_header.m_pixelWidth; }
- uint get_height() const { return CRNLIB_MAX(m_header.m_pixelHeight, 1); }
- uint get_depth() const { return CRNLIB_MAX(m_header.m_pixelDepth, 1); }
- uint get_num_mips() const { return CRNLIB_MAX(m_header.m_numberOfMipmapLevels, 1); }
- uint get_array_size() const { return CRNLIB_MAX(m_header.m_numberOfArrayElements, 1); }
- uint get_num_faces() const { return m_header.m_numberOfFaces; }
-
- uint32 get_ogl_type() const { return m_header.m_glType; }
- uint32 get_ogl_fmt() const { return m_header.m_glFormat; }
- uint32 get_ogl_base_fmt() const { return m_header.m_glBaseInternalFormat; }
- uint32 get_ogl_internal_fmt() const { return m_header.m_glInternalFormat; }
-
- uint get_total_images() const { return get_num_mips() * (get_depth() * get_num_faces() * get_array_size()); }
-
- bool is_compressed() const { return m_block_dim > 1; }
- bool is_uncompressed() const { return !is_compressed(); }
-
- bool get_opposite_endianness() const { return m_opposite_endianness; }
- void set_opposite_endianness(bool flag) { m_opposite_endianness = flag; }
-
- uint32 get_block_dim() const { return m_block_dim; }
- uint32 get_bytes_per_block() const { return m_bytes_per_block; }
-
- const ktx_header& get_header() const { return m_header; }
-
- // Key values
- const ktx_key_value_vec& get_key_value_vec() const { return m_key_values; }
- ktx_key_value_vec& get_key_value_vec() { return m_key_values; }
-
- const uint8_vec* find_key(const char* pKey) const;
- bool get_key_value_as_string(const char* pKey, dynamic_string& str) const;
-
- uint add_key_value(const char* pKey, const void* pVal, uint val_size);
- uint add_key_value(const char* pKey, const char* pVal) { return add_key_value(pKey, pVal, static_cast<uint>(strlen(pVal)) + 1); }
-
- // Image data
- uint get_num_images() const { return m_image_data.size(); }
-
- const uint8_vec& get_image_data(uint image_index) const { return m_image_data[image_index]; }
- uint8_vec& get_image_data(uint image_index) { return m_image_data[image_index]; }
-
- const uint8_vec& get_image_data(uint mip_index, uint array_index, uint face_index, uint zslice_index) const { return get_image_data(get_image_index(mip_index, array_index, face_index, zslice_index)); }
- uint8_vec& get_image_data(uint mip_index, uint array_index, uint face_index, uint zslice_index) { return get_image_data(get_image_index(mip_index, array_index, face_index, zslice_index)); }
-
- const ktx_image_data_vec& get_image_data_vec() const { return m_image_data; }
- ktx_image_data_vec& get_image_data_vec() { return m_image_data; }
-
- void add_image(uint face_index, uint mip_index, const void* pImage, uint image_size)
- {
- const uint image_index = get_image_index(mip_index, 0, face_index, 0);
- if (image_index >= m_image_data.size())
- m_image_data.resize(image_index + 1);
- if (image_size)
- {
- uint8_vec& v = m_image_data[image_index];
- v.resize(image_size);
- memcpy(&v[0], pImage, image_size);
- }
- }
-
- uint get_image_index(uint mip_index, uint array_index, uint face_index, uint zslice_index) const
- {
- CRNLIB_ASSERT((mip_index < get_num_mips()) && (array_index < get_array_size()) && (face_index < get_num_faces()) && (zslice_index < get_depth()));
- return zslice_index + (face_index * get_depth()) + (array_index * (get_depth() * get_num_faces())) + (mip_index * (get_depth() * get_num_faces() * get_array_size()));
- }
-
- void get_mip_dim(uint mip_index, uint& mip_width, uint& mip_height) const
- {
- CRNLIB_ASSERT(mip_index < get_num_mips());
- mip_width = CRNLIB_MAX(get_width() >> mip_index, 1);
- mip_height = CRNLIB_MAX(get_height() >> mip_index, 1);
- }
-
- void get_mip_dim(uint mip_index, uint& mip_width, uint& mip_height, uint& mip_depth) const
- {
- CRNLIB_ASSERT(mip_index < get_num_mips());
- mip_width = CRNLIB_MAX(get_width() >> mip_index, 1);
- mip_height = CRNLIB_MAX(get_height() >> mip_index, 1);
- mip_depth = CRNLIB_MAX(get_depth() >> mip_index, 1);
- }
-
- private:
- ktx_header m_header;
-
- ktx_key_value_vec m_key_values;
- ktx_image_data_vec m_image_data;
-
- uint32 m_block_dim;
- uint32 m_bytes_per_block;
-
- bool m_opposite_endianness;
-
- bool compute_pixel_info();
- };
-
-} // namespace crnlib
-
-#endif // #ifndef _KTX_TEXTURE_H_
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_lzma_codec.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_lzma_codec.cpp
deleted file mode 100644
index a88d33f4..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_lzma_codec.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-// File: crn_lzma_codec.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_lzma_codec.h"
-#include "crn_strutils.h"
-#include "crn_checksum.h"
-#include "lzma_LzmaLib.h"
-#include "crn_threading.h"
-
-namespace crnlib
-{
- lzma_codec::lzma_codec() :
- m_pCompress(LzmaCompress),
- m_pUncompress(LzmaUncompress)
- {
- CRNLIB_ASSUME(cLZMAPropsSize == LZMA_PROPS_SIZE);
- }
-
- lzma_codec::~lzma_codec()
- {
- }
-
- bool lzma_codec::pack(const void* p, uint n, crnlib::vector<uint8>& buf)
- {
- if (n > 1024U*1024U*1024U)
- return false;
-
- uint max_comp_size = n + math::maximum<uint>(128, n >> 8);
- buf.resize(sizeof(header) + max_comp_size);
-
- header* pHDR = reinterpret_cast<header*>(&buf[0]);
- uint8* pComp_data = &buf[sizeof(header)];
-
- utils::zero_object(*pHDR);
-
- pHDR->m_uncomp_size = n;
- pHDR->m_adler32 = adler32(p, n);
-
- if (n)
- {
- size_t destLen = 0;
- size_t outPropsSize = 0;
- int status = SZ_ERROR_INPUT_EOF;
-
- for (uint trial = 0; trial < 3; trial++)
- {
- destLen = max_comp_size;
- outPropsSize = cLZMAPropsSize;
-
- status = (*m_pCompress)(pComp_data, &destLen, reinterpret_cast<const unsigned char*>(p), n,
- pHDR->m_lzma_props, &outPropsSize,
- -1, /* 0 <= level <= 9, default = 5 */
- 0, /* default = (1 << 24) */
- -1, /* 0 <= lc <= 8, default = 3 */
- -1, /* 0 <= lp <= 4, default = 0 */
- -1, /* 0 <= pb <= 4, default = 2 */
- -1, /* 5 <= fb <= 273, default = 32 */
-#ifdef WIN32
- (g_number_of_processors > 1) ? 2 : 1
-#else
- 1
-#endif
- );
-
- if (status != SZ_ERROR_OUTPUT_EOF)
- break;
-
- max_comp_size += ((n+1)/2);
- buf.resize(sizeof(header) + max_comp_size);
- pHDR = reinterpret_cast<header*>(&buf[0]);
- pComp_data = &buf[sizeof(header)];
- }
-
- if (status != SZ_OK)
- {
- buf.clear();
- return false;
- }
-
- pHDR->m_comp_size = static_cast<uint>(destLen);
-
- buf.resize(CRNLIB_SIZEOF_U32(header) + static_cast<uint32>(destLen));
- }
-
- pHDR->m_sig = header::cSig;
- pHDR->m_checksum = static_cast<uint8>(adler32((uint8*)pHDR + header::cChecksumSkipBytes, sizeof(header) - header::cChecksumSkipBytes));
-
- return true;
- }
-
- bool lzma_codec::unpack(const void* p, uint n, crnlib::vector<uint8>& buf)
- {
- buf.resize(0);
-
- if (n < sizeof(header))
- return false;
-
- const header& hdr = *static_cast<const header*>(p);
- if (hdr.m_sig != header::cSig)
- return false;
-
- if (static_cast<uint8>(adler32((const uint8*)&hdr + header::cChecksumSkipBytes, sizeof(hdr) - header::cChecksumSkipBytes)) != hdr.m_checksum)
- return false;
-
- if (!hdr.m_uncomp_size)
- return true;
-
- if (!hdr.m_comp_size)
- return false;
-
- if (hdr.m_uncomp_size > 1024U*1024U*1024U)
- return false;
-
- if (!buf.try_resize(hdr.m_uncomp_size))
- return false;
-
- const uint8* pComp_data = static_cast<const uint8*>(p) + sizeof(header);
- size_t srcLen = n - sizeof(header);
- if (srcLen < hdr.m_comp_size)
- return false;
-
- size_t destLen = hdr.m_uncomp_size;
-
- int status = (*m_pUncompress)(&buf[0], &destLen, pComp_data, &srcLen,
- hdr.m_lzma_props, cLZMAPropsSize);
-
- if ((status != SZ_OK) || (destLen != hdr.m_uncomp_size))
- {
- buf.clear();
- return false;
- }
-
- if (adler32(&buf[0], buf.size()) != hdr.m_adler32)
- {
- buf.clear();
- return false;
- }
-
- return true;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_lzma_codec.h b/Libraries/crunch-ea9b8d/crnlib/crn_lzma_codec.h
deleted file mode 100644
index 97bdcd16..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_lzma_codec.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// File: crn_lzma_codec.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_packed_uint.h"
-
-namespace crnlib
-{
- class lzma_codec
- {
- public:
- lzma_codec();
- ~lzma_codec();
-
- // Always available, because we're statically linking in lzmalib now vs. dynamically loading the DLL.
- bool is_initialized() const { return true; }
-
- bool pack(const void* p, uint n, crnlib::vector<uint8>& buf);
-
- bool unpack(const void* p, uint n, crnlib::vector<uint8>& buf);
-
- private:
- typedef int (CRNLIB_STDCALL *LzmaCompressFuncPtr)(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
- unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */
- int level, /* 0 <= level <= 9, default = 5 */
- unsigned dictSize, /* default = (1 << 24) */
- int lc, /* 0 <= lc <= 8, default = 3 */
- int lp, /* 0 <= lp <= 4, default = 0 */
- int pb, /* 0 <= pb <= 4, default = 2 */
- int fb, /* 5 <= fb <= 273, default = 32 */
- int numThreads /* 1 or 2, default = 2 */
- );
-
- typedef int (CRNLIB_STDCALL *LzmaUncompressFuncPtr)(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen,
- const unsigned char *props, size_t propsSize);
-
- LzmaCompressFuncPtr m_pCompress;
- LzmaUncompressFuncPtr m_pUncompress;
-
- enum { cLZMAPropsSize = 5 };
-
-#pragma pack(push)
-#pragma pack(1)
- struct header
- {
- enum { cSig = 'L' | ('0' << 8), cChecksumSkipBytes = 3 };
- packed_uint<2> m_sig;
- uint8 m_checksum;
-
- uint8 m_lzma_props[cLZMAPropsSize];
-
- packed_uint<4> m_comp_size;
- packed_uint<4> m_uncomp_size;
-
- packed_uint<4> m_adler32;
- };
-#pragma pack(pop)
-
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_math.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_math.cpp
deleted file mode 100644
index 3df29c24..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_math.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// File: crn_math.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-
-namespace crnlib
-{
- namespace math
- {
- uint g_bitmasks[32] =
- {
- 1U << 0U, 1U << 1U, 1U << 2U, 1U << 3U,
- 1U << 4U, 1U << 5U, 1U << 6U, 1U << 7U,
- 1U << 8U, 1U << 9U, 1U << 10U, 1U << 11U,
- 1U << 12U, 1U << 13U, 1U << 14U, 1U << 15U,
- 1U << 16U, 1U << 17U, 1U << 18U, 1U << 19U,
- 1U << 20U, 1U << 21U, 1U << 22U, 1U << 23U,
- 1U << 24U, 1U << 25U, 1U << 26U, 1U << 27U,
- 1U << 28U, 1U << 29U, 1U << 30U, 1U << 31U
- };
-
- double compute_entropy(const uint8* p, uint n)
- {
- uint hist[256];
- utils::zero_object(hist);
-
- for (uint i = 0; i < n; i++)
- hist[*p++]++;
-
- double entropy = 0.0f;
-
- const double invln2 = 1.0f/log(2.0f);
- for (uint i = 0; i < 256; i++)
- {
- if (!hist[i])
- continue;
-
- double prob = static_cast<double>(hist[i]) / n;
- entropy += (-log(prob) * invln2) * hist[i];
- }
-
- return entropy;
- }
-
- void compute_lower_pow2_dim(int& width, int& height)
- {
- const int tex_width = width;
- const int tex_height = height;
-
- width = 1;
- for ( ; ; )
- {
- if ((width * 2) > tex_width)
- break;
- width *= 2;
- }
-
- height = 1;
- for ( ; ; )
- {
- if ((height * 2) > tex_height)
- break;
- height *= 2;
- }
- }
-
- void compute_upper_pow2_dim(int& width, int& height)
- {
- if (!math::is_power_of_2((uint32)width))
- width = math::next_pow2((uint32)width);
-
- if (!math::is_power_of_2((uint32)height))
- height = math::next_pow2((uint32)height);
- }
-
- } // namespace math
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_math.h b/Libraries/crunch-ea9b8d/crnlib/crn_math.h
deleted file mode 100644
index 5b48f8a7..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_math.h
+++ /dev/null
@@ -1,237 +0,0 @@
-// File: crn_math.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-#if defined(_M_IX86) && defined(_MSC_VER)
- #include <intrin.h>
- #pragma intrinsic(__emulu)
- unsigned __int64 __emulu(unsigned int a,unsigned int b );
-#endif
-
-namespace crnlib
-{
- namespace math
- {
- const float cNearlyInfinite = 1.0e+37f;
-
- const float cDegToRad = 0.01745329252f;
- const float cRadToDeg = 57.29577951f;
-
- extern uint g_bitmasks[32];
-
- template<typename T> inline bool within_closed_range(T a, T b, T c) { return (a >= b) && (a <= c); }
-
- template<typename T> inline bool within_open_range(T a, T b, T c) { return (a >= b) && (a < c); }
-
- // Yes I know these should probably be pass by ref, not val:
- // http://www.stepanovpapers.com/notes.pdf
- // Just don't use them on non-simple (non built-in) types!
- template<typename T> inline T minimum(T a, T b) { return (a < b) ? a : b; }
-
- template<typename T> inline T minimum(T a, T b, T c) { return minimum(minimum(a, b), c); }
-
- template<typename T> inline T maximum(T a, T b) { return (a > b) ? a : b; }
-
- template<typename T> inline T maximum(T a, T b, T c) { return maximum(maximum(a, b), c); }
-
- template<typename T, typename U> inline T lerp(T a, T b, U c) { return a + (b - a) * c; }
-
- template<typename T> inline T clamp(T value, T low, T high) { return (value < low) ? low : ((value > high) ? high : value); }
-
- template<typename T> inline T saturate(T value) { return (value < 0.0f) ? 0.0f : ((value > 1.0f) ? 1.0f : value); }
-
- inline int float_to_int(float f) { return static_cast<int>(f); }
-
- inline uint float_to_uint(float f) { return static_cast<uint>(f); }
-
- inline int float_to_int(double f) { return static_cast<int>(f); }
-
- inline uint float_to_uint(double f) { return static_cast<uint>(f); }
-
- inline int float_to_int_round(float f) { return static_cast<int>((f < 0.0f) ? -floor(-f + .5f) : floor(f + .5f)); }
-
- inline uint float_to_uint_round(float f) { return static_cast<uint>((f < 0.0f) ? 0.0f : floor(f + .5f)); }
-
- template<typename T> inline int sign(T value) { return (value < 0) ? -1 : ((value > 0) ? 1 : 0); }
-
- template<typename T> inline T square(T value) { return value * value; }
-
- inline bool is_power_of_2(uint32 x) { return x && ((x & (x - 1U)) == 0U); }
- inline bool is_power_of_2(uint64 x) { return x && ((x & (x - 1U)) == 0U); }
-
- template<typename T> inline T align_up_value(T x, uint alignment)
- {
- CRNLIB_ASSERT(is_power_of_2(alignment));
- uint q = static_cast<uint>(x);
- q = (q + alignment - 1) & (~(alignment - 1));
- return static_cast<T>(q);
- }
-
- template<typename T> inline T align_down_value(T x, uint alignment)
- {
- CRNLIB_ASSERT(is_power_of_2(alignment));
- uint q = static_cast<uint>(x);
- q = q & (~(alignment - 1));
- return static_cast<T>(q);
- }
-
- template<typename T> inline T get_align_up_value_delta(T x, uint alignment)
- {
- return align_up_value(x, alignment) - x;
- }
-
- // From "Hackers Delight"
- inline uint32 next_pow2(uint32 val)
- {
- val--;
- val |= val >> 16;
- val |= val >> 8;
- val |= val >> 4;
- val |= val >> 2;
- val |= val >> 1;
- return val + 1;
- }
-
- inline uint64 next_pow2(uint64 val)
- {
- val--;
- val |= val >> 32;
- val |= val >> 16;
- val |= val >> 8;
- val |= val >> 4;
- val |= val >> 2;
- val |= val >> 1;
- return val + 1;
- }
-
- inline uint floor_log2i(uint v)
- {
- uint l = 0;
- while (v > 1U)
- {
- v >>= 1;
- l++;
- }
- return l;
- }
-
- inline uint ceil_log2i(uint v)
- {
- uint l = floor_log2i(v);
- if ((l != cIntBits) && (v > (1U << l)))
- l++;
- return l;
- }
-
- // Returns the total number of bits needed to encode v.
- inline uint total_bits(uint v)
- {
- uint l = 0;
- while (v > 0U)
- {
- v >>= 1;
- l++;
- }
- return l;
- }
-
- // Actually counts the number of set bits, but hey
- inline uint bitmask_size(uint mask)
- {
- uint size = 0;
- while (mask)
- {
- mask &= (mask - 1U);
- size++;
- }
- return size;
- }
-
- inline uint bitmask_ofs(uint mask)
- {
- if (!mask)
- return 0;
- uint ofs = 0;
- while ((mask & 1U) == 0)
- {
- mask >>= 1U;
- ofs++;
- }
- return ofs;
- }
-
- // See Bit Twiddling Hacks (public domain)
- // http://www-graphics.stanford.edu/~seander/bithacks.html
- inline uint count_trailing_zero_bits(uint v)
- {
- uint c = 32; // c will be the number of zero bits on the right
-
- static const unsigned int B[] = { 0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF };
- static const unsigned int S[] = { 1, 2, 4, 8, 16 }; // Our Magic Binary Numbers
-
- for (int i = 4; i >= 0; --i) // unroll for more speed
- {
- if (v & B[i])
- {
- v <<= S[i];
- c -= S[i];
- }
- }
-
- if (v)
- {
- c--;
- }
-
- return c;
- }
-
- inline uint count_leading_zero_bits(uint v)
- {
- uint temp;
- uint result = 32U;
-
- temp = (v >> 16U); if (temp) { result -= 16U; v = temp; }
- temp = (v >> 8U); if (temp) { result -= 8U; v = temp; }
- temp = (v >> 4U); if (temp) { result -= 4U; v = temp; }
- temp = (v >> 2U); if (temp) { result -= 2U; v = temp; }
- temp = (v >> 1U); if (temp) { result -= 1U; v = temp; }
-
- if (v & 1U)
- result--;
-
- return result;
- }
-
- inline uint64 emulu(uint32 a, uint32 b)
- {
-#if defined(_M_IX86) && defined(_MSC_VER)
- return __emulu(a, b);
-#else
- return static_cast<uint64>(a) * static_cast<uint64>(b);
-#endif
- }
-
- double compute_entropy(const uint8* p, uint n);
-
- void compute_lower_pow2_dim(int& width, int& height);
- void compute_upper_pow2_dim(int& width, int& height);
-
- inline bool equal_tol(float a, float b, float t)
- {
- return fabs(a - b) < ((maximum(fabs(a), fabs(b)) + 1.0f) * t);
- }
-
- inline bool equal_tol(double a, double b, double t)
- {
- return fabs(a - b) < ((maximum(fabs(a), fabs(b)) + 1.0f) * t);
- }
- }
-
-} // namespace crnlib
-
-
-
-
-
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_matrix.h b/Libraries/crunch-ea9b8d/crnlib/crn_matrix.h
deleted file mode 100644
index 14b44bf8..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_matrix.h
+++ /dev/null
@@ -1,565 +0,0 @@
-// File: crn_matrix.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-#include "crn_vec.h"
-
-namespace crnlib
-{
- template<class X, class Y, class Z> Z& matrix_mul_helper(Z& result, const X& lhs, const Y& rhs)
- {
- CRNLIB_ASSUME(Z::num_rows == X::num_rows);
- CRNLIB_ASSUME(Z::num_cols == Y::num_cols);
- CRNLIB_ASSUME(X::num_cols == Y::num_rows);
- CRNLIB_ASSERT((&result != &lhs) && (&result != &rhs));
- for (int r = 0; r < X::num_rows; r++)
- for (int c = 0; c < Y::num_cols; c++)
- {
- typename Z::scalar_type s = lhs(r, 0) * rhs(0, c);
- for (uint i = 1; i < X::num_cols; i++)
- s += lhs(r, i) * rhs(i, c);
- result(r, c) = s;
- }
- return result;
- }
-
- template<class X, class Y, class Z> Z& matrix_mul_helper_transpose_lhs(Z& result, const X& lhs, const Y& rhs)
- {
- CRNLIB_ASSUME(Z::num_rows == X::num_cols);
- CRNLIB_ASSUME(Z::num_cols == Y::num_cols);
- CRNLIB_ASSUME(X::num_rows == Y::num_rows);
- for (int r = 0; r < X::num_cols; r++)
- for (int c = 0; c < Y::num_cols; c++)
- {
- typename Z::scalar_type s = lhs(0, r) * rhs(0, c);
- for (uint i = 1; i < X::num_rows; i++)
- s += lhs(i, r) * rhs(i, c);
- result(r, c) = s;
- }
- return result;
- }
-
- template<class X, class Y, class Z> Z& matrix_mul_helper_transpose_rhs(Z& result, const X& lhs, const Y& rhs)
- {
- CRNLIB_ASSUME(Z::num_rows == X::num_rows);
- CRNLIB_ASSUME(Z::num_cols == Y::num_rows);
- CRNLIB_ASSUME(X::num_cols == Y::num_cols);
- for (int r = 0; r < X::num_rows; r++)
- for (int c = 0; c < Y::num_rows; c++)
- {
- typename Z::scalar_type s = lhs(r, 0) * rhs(c, 0);
- for (uint i = 1; i < X::num_cols; i++)
- s += lhs(r, i) * rhs(c, i);
- result(r, c) = s;
- }
- return result;
- }
-
- template<uint R, uint C, typename T>
- class matrix
- {
- public:
- typedef T scalar_type;
- enum { num_rows = R, num_cols = C };
-
- typedef vec<R, T> col_vec;
- typedef vec<(R > 1) ? (R - 1) : 0, T> subcol_vec;
-
- typedef vec<C, T> row_vec;
- typedef vec<(C > 1) ? (C - 1) : 0, T> subrow_vec;
-
- inline matrix() { }
-
- inline matrix(eClear) { clear(); }
-
- inline matrix(const T* p) { set(p); }
-
- inline matrix(const matrix& other)
- {
- for (uint i = 0; i < R; i++)
- m_rows[i] = other.m_rows[i];
- }
-
- inline matrix& operator= (const matrix& rhs)
- {
- if (this != &rhs)
- for (uint i = 0; i < R; i++)
- m_rows[i] = rhs.m_rows[i];
- return *this;
- }
-
- inline matrix(T val00, T val01,
- T val10, T val11)
- {
- set(val00, val01, val10, val11);
- }
-
- inline matrix(T val00, T val01, T val02,
- T val10, T val11, T val12,
- T val20, T val21, T val22)
- {
- set(val00, val01, val02, val10, val11, val12, val20, val21, val22);
- }
-
- inline matrix(T val00, T val01, T val02, T val03,
- T val10, T val11, T val12, T val13,
- T val20, T val21, T val22, T val23,
- T val30, T val31, T val32, T val33)
- {
- set(val00, val01, val02, val03, val10, val11, val12, val13, val20, val21, val22, val23, val30, val31, val32, val33);
- }
-
- inline void set(const float* p)
- {
- for (uint i = 0; i < R; i++)
- {
- m_rows[i].set(p);
- p += C;
- }
- }
-
- inline void set(T val00, T val01,
- T val10, T val11)
- {
- m_rows[0].set(val00, val01);
- if (R >= 2)
- {
- m_rows[1].set(val10, val11);
-
- for (uint i = 2; i < R; i++)
- m_rows[i].clear();
- }
- }
-
- inline void set(T val00, T val01, T val02,
- T val10, T val11, T val12,
- T val20, T val21, T val22)
- {
- m_rows[0].set(val00, val01, val02);
- if (R >= 2)
- {
- m_rows[1].set(val10, val11, val12);
- if (R >= 3)
- {
- m_rows[2].set(val20, val21, val22);
-
- for (uint i = 3; i < R; i++)
- m_rows[i].clear();
- }
- }
- }
-
- inline void set(T val00, T val01, T val02, T val03,
- T val10, T val11, T val12, T val13,
- T val20, T val21, T val22, T val23,
- T val30, T val31, T val32, T val33)
- {
- m_rows[0].set(val00, val01, val02, val03);
- if (R >= 2)
- {
- m_rows[1].set(val10, val11, val12, val13);
- if (R >= 3)
- {
- m_rows[2].set(val20, val21, val22, val23);
-
- if (R >= 4)
- {
- m_rows[3].set(val30, val31, val32, val33);
-
- for (uint i = 4; i < R; i++)
- m_rows[i].clear();
- }
- }
- }
- }
-
- inline T operator() (uint r, uint c) const
- {
- CRNLIB_ASSERT((r < R) && (c < C));
- return m_rows[r][c];
- }
-
- inline T& operator() (uint r, uint c)
- {
- CRNLIB_ASSERT((r < R) && (c < C));
- return m_rows[r][c];
- }
-
- inline const row_vec& operator[] (uint r) const
- {
- CRNLIB_ASSERT(r < R);
- return m_rows[r];
- }
-
- inline row_vec& operator[] (uint r)
- {
- CRNLIB_ASSERT(r < R);
- return m_rows[r];
- }
-
- inline const row_vec& get_row (uint r) const { return (*this)[r]; }
- inline row_vec& get_row (uint r) { return (*this)[r]; }
-
- inline col_vec get_col(uint c) const
- {
- CRNLIB_ASSERT(c < C);
- col_vec result;
- for (uint i = 0; i < R; i++)
- result[i] = m_rows[i][c];
- return result;
- }
-
- inline void set_col(uint c, const col_vec& col)
- {
- CRNLIB_ASSERT(c < C);
- for (uint i = 0; i < R; i++)
- m_rows[i][c] = col[i];
- }
-
- inline void set_col(uint c, const subcol_vec& col)
- {
- CRNLIB_ASSERT(c < C);
- for (uint i = 0; i < (R - 1); i++)
- m_rows[i][c] = col[i];
-
- m_rows[R - 1][c] = 0.0f;
- }
-
- inline const row_vec& get_translate() const
- {
- return m_rows[R - 1];
- }
-
- inline matrix& set_translate(const row_vec& r)
- {
- m_rows[R - 1] = r;
- return *this;
- }
-
- inline matrix& set_translate(const subrow_vec& r)
- {
- m_rows[R - 1] = row_vec(r).as_point();
- return *this;
- }
-
- inline const T* get_ptr() const { return reinterpret_cast<const T*>(&m_rows[0]); }
- inline T* get_ptr() { return reinterpret_cast< T*>(&m_rows[0]); }
-
- inline matrix& operator+= (const matrix& other)
- {
- for (uint i = 0; i < R; i++)
- m_rows[i] += other.m_rows[i];
- return *this;
- }
-
- inline matrix& operator-= (const matrix& other)
- {
- for (uint i = 0; i < R; i++)
- m_rows[i] -= other.m_rows[i];
- return *this;
- }
-
- inline matrix& operator*= (T val)
- {
- for (uint i = 0; i < R; i++)
- m_rows[i] *= val;
- return *this;
- }
-
- inline matrix& operator/= (T val)
- {
- for (uint i = 0; i < R; i++)
- m_rows[i] /= val;
- return *this;
- }
-
- inline matrix& operator*= (const matrix& other)
- {
- matrix result;
- matrix_mul_helper(result, *this, other);
- *this = result;
- return *this;
- }
-
- friend inline matrix operator+ (const matrix& lhs, const matrix& rhs)
- {
- matrix result;
- for (uint i = 0; i < R; i++)
- result[i] = lhs.m_rows[i] + rhs.m_rows[i];
- return result;
- }
-
- friend inline matrix operator- (const matrix& lhs, const matrix& rhs)
- {
- matrix result;
- for (uint i = 0; i < R; i++)
- result[i] = lhs.m_rows[i] - rhs.m_rows[i];
- return result;
- }
-
- friend inline matrix operator* (const matrix& lhs, T val)
- {
- matrix result;
- for (uint i = 0; i < R; i++)
- result[i] = lhs.m_rows[i] * val;
- return result;
- }
-
- friend inline matrix operator/ (const matrix& lhs, T val)
- {
- matrix result;
- for (uint i = 0; i < R; i++)
- result[i] = lhs.m_rows[i] / val;
- return result;
- }
-
- friend inline matrix operator* (T val, const matrix& rhs)
- {
- matrix result;
- for (uint i = 0; i < R; i++)
- result[i] = val * rhs.m_rows[i];
- return result;
- }
-
- friend inline matrix operator* (const matrix& lhs, const matrix& rhs)
- {
- matrix result;
- return matrix_mul_helper(result, lhs, rhs);
- }
-
- friend inline row_vec operator* (const col_vec& a, const matrix& b)
- {
- return transform(a, b);
- }
-
- inline matrix operator+ () const
- {
- return *this;
- }
-
- inline matrix operator- () const
- {
- matrix result;
- for (uint i = 0; i < R; i++)
- result[i] = -m_rows[i];
- return result;
- }
-
- inline void clear(void)
- {
- for (uint i = 0; i < R; i++)
- m_rows[i].clear();
- }
-
- inline void set_zero_matrix()
- {
- clear();
- }
-
- inline void set_identity_matrix()
- {
- for (uint i = 0; i < R; i++)
- {
- m_rows[i].clear();
- m_rows[i][i] = 1.0f;
- }
- }
-
- inline matrix& set_scale_matrix(float s)
- {
- clear();
- for (int i = 0; i < (R - 1); i++)
- m_rows[i][i] = s;
- m_rows[R - 1][C - 1] = 1.0f;
- return *this;
- }
-
- inline matrix& set_scale_matrix(const row_vec& s)
- {
- clear();
- for (uint i = 0; i < R; i++)
- m_rows[i][i] = s[i];
- return *this;
- }
-
- inline matrix& set_translate_matrix(const row_vec& s)
- {
- set_identity_matrix();
- set_translate(s);
- return *this;
- }
-
- inline matrix& set_translate_matrix(float x, float y)
- {
- set_identity_matrix();
- set_translate(row_vec(x, y).as_point());
- return *this;
- }
-
- inline matrix& set_translate_matrix(float x, float y, float z)
- {
- set_identity_matrix();
- set_translate(row_vec(x, y, z).as_point());
- return *this;
- }
-
- inline matrix get_transposed(void) const
- {
- matrix result;
- for (uint i = 0; i < R; i++)
- for (uint j = 0; j < C; j++)
- result.m_rows[i][j] = m_rows[j][i];
- return result;
- }
-
- inline matrix& transpose_in_place(void)
- {
- matrix result;
- for (uint i = 0; i < R; i++)
- for (uint j = 0; j < C; j++)
- result.m_rows[i][j] = m_rows[j][i];
- *this = result;
- return *this;
- }
-
- // This method transforms a column vec by a matrix (D3D-style).
- static inline row_vec transform(const col_vec& a, const matrix& b)
- {
- row_vec result(b[0] * a[0]);
- for (uint r = 1; r < R; r++)
- result += b[r] * a[r];
- return result;
- }
-
- // This method transforms a column vec by a matrix. Last component of vec is assumed to be 1.
- static inline row_vec transform_point(const col_vec& a, const matrix& b)
- {
- row_vec result(0);
- for (int r = 0; r < (R - 1); r++)
- result += b[r] * a[r];
- result += b[R - 1];
- return result;
- }
-
- // This method transforms a column vec by a matrix. Last component of vec is assumed to be 0.
- static inline row_vec transform_vector(const col_vec& a, const matrix& b)
- {
- row_vec result(0);
- for (int r = 0; r < (R - 1); r++)
- result += b[r] * a[r];
- return result;
- }
-
- static inline subcol_vec transform_point(const subcol_vec& a, const matrix& b)
- {
- subcol_vec result(0);
- for (int r = 0; r < R; r++)
- {
- const T s = (r < subcol_vec::num_elements) ? a[r] : 1.0f;
- for (int c = 0; c < (C - 1); c++)
- result[c] += b[r][c] * s;
- }
- return result;
- }
-
- static inline subcol_vec transform_vector(const subcol_vec& a, const matrix& b)
- {
- subcol_vec result(0);
- for (int r = 0; r < (R - 1); r++)
- {
- const T s = a[r];
- for (int c = 0; c < (C - 1); c++)
- result[c] += b[r][c] * s;
- }
- return result;
- }
-
- // This method transforms a column vec by the transpose of a matrix.
- static inline col_vec transform_transposed(const matrix& b, const col_vec& a)
- {
- CRNLIB_ASSUME(R == C);
- col_vec result;
- for (uint r = 0; r < R; r++)
- result[r] = b[r] * a;
- return result;
- }
-
- // This method transforms a column vec by the transpose of a matrix. Last component of vec is assumed to be 0.
- static inline col_vec transform_vector_transposed(const matrix& b, const col_vec& a)
- {
- CRNLIB_ASSUME(R == C);
- col_vec result;
- for (uint r = 0; r < R; r++)
- {
- T s = 0;
- for (uint c = 0; c < (C - 1); c++)
- s += b[r][c] * a[c];
-
- result[r] = s;
- }
- return result;
- }
-
- // This method transforms a matrix by a row vector (OGL style).
- static inline col_vec transform(const matrix& b, const row_vec& a)
- {
- col_vec result;
- for (int r = 0; r < R; r++)
- result[r] = b[r] * a;
- return result;
- }
-
- static inline matrix& multiply(matrix& result, const matrix& lhs, const matrix& rhs)
- {
- return matrix_mul_helper(result, lhs, rhs);
- }
-
- static inline matrix make_scale_matrix(float s)
- {
- return matrix().set_scale_matrix(s);
- }
-
- static inline matrix make_scale_matrix(const row_vec& s)
- {
- return matrix().set_scale_matrix(s);
- }
-
- static inline matrix make_scale_matrix(float x, float y)
- {
- CRNLIB_ASSUME(R >= 3 && C >= 3);
- matrix result;
- result.clear();
- result.m_rows[0][0] = x;
- result.m_rows[1][1] = y;
- result.m_rows[2][2] = 1.0f;
- return result;
- }
-
- static inline matrix make_scale_matrix(float x, float y, float z)
- {
- CRNLIB_ASSUME(R >= 4 && C >= 4);
- matrix result;
- result.clear();
- result.m_rows[0][0] = x;
- result.m_rows[1][1] = y;
- result.m_rows[2][2] = z;
- result.m_rows[3][3] = 1.0f;
- return result;
- }
-
- private:
- row_vec m_rows[R];
- };
-
- typedef matrix<2, 2, float> matrix22F;
- typedef matrix<2, 2, double> matrix22D;
-
- typedef matrix<3, 3, float> matrix33F;
- typedef matrix<3, 3, double> matrix33D;
-
- typedef matrix<4, 4, float> matrix44F;
- typedef matrix<4, 4, double> matrix44D;
-
- typedef matrix<8, 8, float> matrix88F;
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_mem.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_mem.cpp
deleted file mode 100644
index b7abfb9b..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_mem.cpp
+++ /dev/null
@@ -1,379 +0,0 @@
-// File: crn_mem.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_console.h"
-#include "../inc/crnlib.h"
-#include <malloc.h>
-#if CRNLIB_USE_WIN32_API
-#include "crn_winhdr.h"
-#endif
-
-#define CRNLIB_MEM_STATS 0
-
-#if !CRNLIB_USE_WIN32_API
-#define _msize malloc_usable_size
-#endif
-
-namespace crnlib
-{
-#if CRNLIB_MEM_STATS
- #if CRNLIB_64BIT_POINTERS
- typedef LONGLONG mem_stat_t;
- #define CRNLIB_MEM_COMPARE_EXCHANGE InterlockedCompareExchange64
- #else
- typedef LONG mem_stat_t;
- #define CRNLIB_MEM_COMPARE_EXCHANGE InterlockedCompareExchange
- #endif
-
- static volatile mem_stat_t g_total_blocks;
- static volatile mem_stat_t g_total_allocated;
- static volatile mem_stat_t g_max_allocated;
-
- static mem_stat_t update_total_allocated(int block_delta, mem_stat_t byte_delta)
- {
- mem_stat_t cur_total_blocks;
- for ( ; ; )
- {
- cur_total_blocks = (mem_stat_t)g_total_blocks;
- mem_stat_t new_total_blocks = static_cast<mem_stat_t>(cur_total_blocks + block_delta);
- CRNLIB_ASSERT(new_total_blocks >= 0);
- if (CRNLIB_MEM_COMPARE_EXCHANGE(&g_total_blocks, new_total_blocks, cur_total_blocks) == cur_total_blocks)
- break;
- }
-
- mem_stat_t cur_total_allocated, new_total_allocated;
- for ( ; ; )
- {
- cur_total_allocated = g_total_allocated;
- new_total_allocated = static_cast<mem_stat_t>(cur_total_allocated + byte_delta);
- CRNLIB_ASSERT(new_total_allocated >= 0);
- if (CRNLIB_MEM_COMPARE_EXCHANGE(&g_total_allocated, new_total_allocated, cur_total_allocated) == cur_total_allocated)
- break;
- }
- for ( ; ; )
- {
- mem_stat_t cur_max_allocated = g_max_allocated;
- mem_stat_t new_max_allocated = CRNLIB_MAX(new_total_allocated, cur_max_allocated);
- if (CRNLIB_MEM_COMPARE_EXCHANGE(&g_max_allocated, new_max_allocated, cur_max_allocated) == cur_max_allocated)
- break;
- }
- return new_total_allocated;
- }
-#endif // CRNLIB_MEM_STATS
-
- static void* crnlib_default_realloc(void* p, size_t size, size_t* pActual_size, bool movable, void* pUser_data)
- {
- pUser_data;
-
- void* p_new;
-
- if (!p)
- {
- p_new = ::malloc(size);
- CRNLIB_ASSERT( (reinterpret_cast<ptr_bits_t>(p_new) & (CRNLIB_MIN_ALLOC_ALIGNMENT - 1)) == 0 );
-
- if (!p_new)
- {
- printf("WARNING: ::malloc() of size %u failed!\n", (uint)size);
- }
-
- if (pActual_size)
- *pActual_size = p_new ? ::_msize(p_new) : 0;
- }
- else if (!size)
- {
- ::free(p);
- p_new = NULL;
-
- if (pActual_size)
- *pActual_size = 0;
- }
- else
- {
- void* p_final_block = p;
-#ifdef WIN32
- p_new = ::_expand(p, size);
-#else
- p_new = NULL;
-#endif
-
- if (p_new)
- {
- CRNLIB_ASSERT( (reinterpret_cast<ptr_bits_t>(p_new) & (CRNLIB_MIN_ALLOC_ALIGNMENT - 1)) == 0 );
- p_final_block = p_new;
- }
- else if (movable)
- {
- p_new = ::realloc(p, size);
-
- if (p_new)
- {
- CRNLIB_ASSERT( (reinterpret_cast<ptr_bits_t>(p_new) & (CRNLIB_MIN_ALLOC_ALIGNMENT - 1)) == 0 );
- p_final_block = p_new;
- }
- else
- {
- printf("WARNING: ::realloc() of size %u failed!\n", (uint)size);
- }
- }
-
- if (pActual_size)
- *pActual_size = ::_msize(p_final_block);
- }
-
- return p_new;
- }
-
- static size_t crnlib_default_msize(void* p, void* pUser_data)
- {
- pUser_data;
- return p ? _msize(p) : 0;
- }
-
-#if 0
- static __declspec(thread) void *g_pBuf;
- static __declspec(thread) size_t g_buf_size;
- static __declspec(thread) size_t g_buf_ofs;
-
- static size_t crnlib_nofree_msize(void* p, void* pUser_data)
- {
- pUser_data;
- return p ? ((const size_t*)p)[-1] : 0;
- }
-
- static void* crnlib_nofree_realloc(void* p, size_t size, size_t* pActual_size, bool movable, void* pUser_data)
- {
- pUser_data;
-
- void* p_new;
-
- if (!p)
- {
- size = math::align_up_value(size, CRNLIB_MIN_ALLOC_ALIGNMENT);
- size_t actual_size = sizeof(size_t)*2 + size;
- size_t num_remaining = g_buf_size - g_buf_ofs;
- if (num_remaining < actual_size)
- {
- g_buf_size = CRNLIB_MAX(actual_size, 32*1024*1024);
- g_buf_ofs = 0;
- g_pBuf = malloc(g_buf_size);
- if (!g_pBuf)
- return NULL;
- }
-
- p_new = (uint8*)g_pBuf + g_buf_ofs;
- ((size_t*)p_new)[1] = size;
- p_new = (size_t*)p_new + 2;
- g_buf_ofs += actual_size;
-
- if (pActual_size)
- *pActual_size = size;
-
- CRNLIB_ASSERT(crnlib_nofree_msize(p_new, NULL) == size);
- }
- else if (!size)
- {
- if (pActual_size)
- *pActual_size = 0;
- p_new = NULL;
- }
- else
- {
- size_t cur_size = crnlib_nofree_msize(p, NULL);
- p_new = p;
-
- if (!movable)
- return NULL;
-
- if (size > cur_size)
- {
- p_new = crnlib_nofree_realloc(NULL, size, NULL, true, NULL);
- if (!p_new)
- return NULL;
-
- memcpy(p_new, p, cur_size);
-
- cur_size = size;
- }
-
- if (pActual_size)
- *pActual_size = cur_size;
- }
-
- return p_new;
- }
-
- static crn_realloc_func g_pRealloc = crnlib_nofree_realloc;
- static crn_msize_func g_pMSize = crnlib_nofree_msize;
-#else
- static crn_realloc_func g_pRealloc = crnlib_default_realloc;
- static crn_msize_func g_pMSize = crnlib_default_msize;
-#endif
- static void* g_pUser_data;
-
- void crnlib_mem_error(const char* p_msg)
- {
- crnlib_assert(p_msg, __FILE__, __LINE__);
- }
- void* crnlib_malloc(size_t size)
- {
- return crnlib_malloc(size, NULL);
- }
-
- void* crnlib_malloc(size_t size, size_t* pActual_size)
- {
- size = (size + sizeof(uint32) - 1U) & ~(sizeof(uint32) - 1U);
- if (!size)
- size = sizeof(uint32);
-
- if (size > CRNLIB_MAX_POSSIBLE_BLOCK_SIZE)
- {
- crnlib_mem_error("crnlib_malloc: size too big");
- return NULL;
- }
-
- size_t actual_size = size;
- uint8* p_new = static_cast<uint8*>((*g_pRealloc)(NULL, size, &actual_size, true, g_pUser_data));
-
- if (pActual_size)
- *pActual_size = actual_size;
-
- if ((!p_new) || (actual_size < size))
- {
- crnlib_mem_error("crnlib_malloc: out of memory");
- return NULL;
- }
-
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(p_new) & (CRNLIB_MIN_ALLOC_ALIGNMENT - 1)) == 0);
-
-#if CRNLIB_MEM_STATS
- CRNLIB_ASSERT((*g_pMSize)(p_new, g_pUser_data) == actual_size);
- update_total_allocated(1, static_cast<mem_stat_t>(actual_size));
-#endif
-
- return p_new;
- }
-
- void* crnlib_realloc(void* p, size_t size, size_t* pActual_size, bool movable)
- {
- if ((ptr_bits_t)p & (CRNLIB_MIN_ALLOC_ALIGNMENT - 1))
- {
- crnlib_mem_error("crnlib_realloc: bad ptr");
- return NULL;
- }
-
- if (size > CRNLIB_MAX_POSSIBLE_BLOCK_SIZE)
- {
- crnlib_mem_error("crnlib_malloc: size too big");
- return NULL;
- }
-
-#if CRNLIB_MEM_STATS
- size_t cur_size = p ? (*g_pMSize)(p, g_pUser_data) : 0;
- CRNLIB_ASSERT(!p || (cur_size >= sizeof(uint32)));
-#endif
- if ((size) && (size < sizeof(uint32)))
- size = sizeof(uint32);
-
- size_t actual_size = size;
- void* p_new = (*g_pRealloc)(p, size, &actual_size, movable, g_pUser_data);
-
- if (pActual_size)
- *pActual_size = actual_size;
-
- CRNLIB_ASSERT((reinterpret_cast<ptr_bits_t>(p_new) & (CRNLIB_MIN_ALLOC_ALIGNMENT - 1)) == 0);
-
-#if CRNLIB_MEM_STATS
- CRNLIB_ASSERT(!p_new || ((*g_pMSize)(p_new, g_pUser_data) == actual_size));
-
- int num_new_blocks = 0;
- if (p)
- {
- if (!p_new)
- num_new_blocks = -1;
- }
- else if (p_new)
- {
- num_new_blocks = 1;
- }
- update_total_allocated(num_new_blocks, static_cast<mem_stat_t>(actual_size) - static_cast<mem_stat_t>(cur_size));
-#endif
-
- return p_new;
- }
-
- void* crnlib_calloc(size_t count, size_t size, size_t* pActual_size)
- {
- size_t total = count * size;
- void *p = crnlib_malloc(total, pActual_size);
- if (p) memset(p, 0, total);
- return p;
- }
-
- void crnlib_free(void* p)
- {
- if (!p)
- return;
-
- if (reinterpret_cast<ptr_bits_t>(p) & (CRNLIB_MIN_ALLOC_ALIGNMENT - 1))
- {
- crnlib_mem_error("crnlib_free: bad ptr");
- return;
- }
-
-#if CRNLIB_MEM_STATS
- size_t cur_size = (*g_pMSize)(p, g_pUser_data);
- CRNLIB_ASSERT(cur_size >= sizeof(uint32));
- update_total_allocated(-1, -static_cast<mem_stat_t>(cur_size));
-#endif
-
- (*g_pRealloc)(p, 0, NULL, true, g_pUser_data);
- }
-
- size_t crnlib_msize(void* p)
- {
- if (!p)
- return 0;
-
- if (reinterpret_cast<ptr_bits_t>(p) & (CRNLIB_MIN_ALLOC_ALIGNMENT - 1))
- {
- crnlib_mem_error("crnlib_msize: bad ptr");
- return 0;
- }
-
- return (*g_pMSize)(p, g_pUser_data);
- }
-
- void crnlib_print_mem_stats()
- {
-#if CRNLIB_MEM_STATS
- if (console::is_initialized())
- {
- console::debug("crnlib_print_mem_stats:");
- console::debug("Current blocks: %u, allocated: " CRNLIB_INT64_FORMAT_SPECIFIER ", max ever allocated: " CRNLIB_INT64_FORMAT_SPECIFIER, g_total_blocks, (int64)g_total_allocated, (int64)g_max_allocated);
- }
- else
- {
- printf("crnlib_print_mem_stats:\n");
- printf("Current blocks: %u, allocated: " CRNLIB_INT64_FORMAT_SPECIFIER ", max ever allocated: " CRNLIB_INT64_FORMAT_SPECIFIER "\n", g_total_blocks, (int64)g_total_allocated, (int64)g_max_allocated);
- }
-#endif
- }
-
-} // namespace crnlib
-
-void crn_set_memory_callbacks(crn_realloc_func pRealloc, crn_msize_func pMSize, void* pUser_data)
-{
- if ((!pRealloc) || (!pMSize))
- {
- crnlib::g_pRealloc = crnlib::crnlib_default_realloc;
- crnlib::g_pMSize = crnlib::crnlib_default_msize;
- crnlib::g_pUser_data = NULL;
- }
- else
- {
- crnlib::g_pRealloc = pRealloc;
- crnlib::g_pMSize = pMSize;
- crnlib::g_pUser_data = pUser_data;
- }
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_mem.h b/Libraries/crunch-ea9b8d/crnlib/crn_mem.h
deleted file mode 100644
index 767192fe..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_mem.h
+++ /dev/null
@@ -1,209 +0,0 @@
-// File: crn_mem.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-#ifndef CRNLIB_MIN_ALLOC_ALIGNMENT
-#define CRNLIB_MIN_ALLOC_ALIGNMENT sizeof(size_t) * 2
-#endif
-
-namespace crnlib
-{
-#if CRNLIB_64BIT_POINTERS
- const uint64 CRNLIB_MAX_POSSIBLE_BLOCK_SIZE = 0x400000000ULL;
-#else
- const uint32 CRNLIB_MAX_POSSIBLE_BLOCK_SIZE = 0x7FFF0000U;
-#endif
-
- void* crnlib_malloc(size_t size);
- void* crnlib_malloc(size_t size, size_t* pActual_size);
- void* crnlib_realloc(void* p, size_t size, size_t* pActual_size = NULL, bool movable = true);
- void* crnlib_calloc(size_t count, size_t size, size_t* pActual_size = NULL);
- void crnlib_free(void* p);
- size_t crnlib_msize(void* p);
- void crnlib_print_mem_stats();
- void crnlib_mem_error(const char* p_msg);
-
- // omfg - there must be a better way
-
- template<typename T>
- inline T* crnlib_new()
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- if (CRNLIB_IS_SCALAR_TYPE(T))
- return p;
- return helpers::construct(p);
- }
-
- template<typename T, typename A>
- inline T* crnlib_new(const A& init0)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0);
- }
-
- template<typename T, typename A>
- inline T* crnlib_new(A& init0)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0);
- }
-
- template<typename T, typename A, typename B>
- inline T* crnlib_new(const A& init0, const B& init1)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0, init1);
- }
-
- template<typename T, typename A, typename B, typename C>
- inline T* crnlib_new(const A& init0, const B& init1, const C& init2)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0, init1, init2);
- }
-
- template<typename T, typename A, typename B, typename C, typename D>
- inline T* crnlib_new(const A& init0, const B& init1, const C& init2, const D& init3)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0, init1, init2, init3);
- }
-
- template<typename T, typename A, typename B, typename C, typename D, typename E>
- inline T* crnlib_new(const A& init0, const B& init1, const C& init2, const D& init3, const E& init4)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0, init1, init2, init3, init4);
- }
-
- template<typename T, typename A, typename B, typename C, typename D, typename E, typename F>
- inline T* crnlib_new(const A& init0, const B& init1, const C& init2, const D& init3, const E& init4, const F& init5)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0, init1, init2, init3, init4, init5);
- }
-
- template<typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G>
- inline T* crnlib_new(const A& init0, const B& init1, const C& init2, const D& init3, const E& init4, const F& init5, const G& init6)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0, init1, init2, init3, init4, init5, init6);
- }
-
- template<typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H>
- inline T* crnlib_new(const A& init0, const B& init1, const C& init2, const D& init3, const E& init4, const F& init5, const G& init6, const H& init7)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0, init1, init2, init3, init4, init5, init6, init7);
- }
-
- template<typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I>
- inline T* crnlib_new(const A& init0, const B& init1, const C& init2, const D& init3, const E& init4, const F& init5, const G& init6, const H& init7, const I& init8)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0, init1, init2, init3, init4, init5, init6, init7, init8);
- }
-
- template<typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J>
- inline T* crnlib_new(const A& init0, const B& init1, const C& init2, const D& init3, const E& init4, const F& init5, const G& init6, const H& init7, const I& init8, const J& init9)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0, init1, init2, init3, init4, init5, init6, init7, init8, init9);
- }
-
- template<typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K>
- inline T* crnlib_new(const A& init0, const B& init1, const C& init2, const D& init3, const E& init4, const F& init5, const G& init6, const H& init7, const I& init8, const J& init9, const K& init10)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0, init1, init2, init3, init4, init5, init6, init7, init8, init9, init10);
- }
-
- template<typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L>
- inline T* crnlib_new(const A& init0, const B& init1, const C& init2, const D& init3, const E& init4, const F& init5, const G& init6, const H& init7, const I& init8, const J& init9, const K& init10, const L& init11)
- {
- T* p = static_cast<T*>(crnlib_malloc(sizeof(T)));
- return new (static_cast<void*>(p)) T(init0, init1, init2, init3, init4, init5, init6, init7, init8, init9, init10, init11);
- }
-
- template<typename T>
- inline T* crnlib_new_array(uint32 num)
- {
- if (!num) num = 1;
-
- uint64 total = CRNLIB_MIN_ALLOC_ALIGNMENT + sizeof(T) * num;
- if (total > CRNLIB_MAX_POSSIBLE_BLOCK_SIZE)
- {
- crnlib_mem_error("crnlib_new_array: Array too large!");
- return NULL;
- }
- uint8* q = static_cast<uint8*>(crnlib_malloc(static_cast<size_t>(total)));
-
- T* p = reinterpret_cast<T*>(q + CRNLIB_MIN_ALLOC_ALIGNMENT);
-
- reinterpret_cast<uint32*>(p)[-1] = num;
- reinterpret_cast<uint32*>(p)[-2] = ~num;
-
- if (!CRNLIB_IS_SCALAR_TYPE(T))
- {
- helpers::construct_array(p, num);
- }
- return p;
- }
-
- template<typename T>
- inline void crnlib_delete(T* p)
- {
- if (p)
- {
- if (!CRNLIB_IS_SCALAR_TYPE(T))
- {
- helpers::destruct(p);
- }
- crnlib_free(p);
- }
- }
-
- template<typename T>
- inline void crnlib_delete_array(T* p)
- {
- if (p)
- {
- const uint32 num = reinterpret_cast<uint32*>(p)[-1];
- const uint32 num_check = reinterpret_cast<uint32*>(p)[-2];
- CRNLIB_ASSERT(num && (num == ~num_check));
- if (num == ~num_check)
- {
- if (!CRNLIB_IS_SCALAR_TYPE(T))
- {
- helpers::destruct_array(p, num);
- }
-
- crnlib_free(reinterpret_cast<uint8*>(p) - CRNLIB_MIN_ALLOC_ALIGNMENT);
- }
- }
- }
-
-} // namespace crnlib
-#define CRNLIB_DEFINE_NEW_DELETE \
- void* operator new (size_t size) \
- { \
- void* p = crnlib::crnlib_malloc(size); \
- if (!p) \
- crnlib_fail("new: Out of memory!", __FILE__, __LINE__); \
- return p; \
- } \
- void* operator new[] (size_t size) \
- { \
- void* p = crnlib::crnlib_malloc(size); \
- if (!p) \
- crnlib_fail("new[]: Out of memory!", __FILE__, __LINE__); \
- return p; \
- } \
- void operator delete (void* p_block) \
- { \
- crnlib::crnlib_free(p_block); \
- } \
- void operator delete[] (void* p_block) \
- { \
- crnlib::crnlib_free(p_block); \
- }
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_miniz.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_miniz.cpp
deleted file mode 100644
index 6fc8bdda..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_miniz.cpp
+++ /dev/null
@@ -1,3948 +0,0 @@
-// File: crn_miniz.cpp
-#include "crn_core.h"
-#include "crn_miniz.h"
-
-// ------------------- End of Header: Implementation follows. (If you only want the header, define MINIZ_HEADER_FILE_ONLY.)
-
-#ifndef MINIZ_HEADER_FILE_ONLY
-
-typedef unsigned char mz_validate_uint16[sizeof(mz_uint16)==2 ? 1 : -1];
-typedef unsigned char mz_validate_uint32[sizeof(mz_uint32)==4 ? 1 : -1];
-typedef unsigned char mz_validate_uint64[sizeof(mz_uint64)==8 ? 1 : -1];
-
-#include <string.h>
-#include <assert.h>
-
-#include "crn_core.h"
-
-#define MZ_ASSERT(x) assert(x)
-
-#ifdef MINIZ_NO_MALLOC
- #define MZ_MALLOC(x) NULL
- #define MZ_FREE(x) (void)x, ((void)0)
- #define MZ_REALLOC(p, x) NULL
-#else
- #define MZ_MALLOC(x) crnlib::crnlib_malloc(x)
- #define MZ_FREE(x) crnlib::crnlib_free(x)
- #define MZ_REALLOC(p, x) crnlib::crnlib_realloc(p, x)
-#endif
-
-#define MZ_MAX(a,b) (((a)>(b))?(a):(b))
-#define MZ_MIN(a,b) (((a)<(b))?(a):(b))
-#define MZ_CLEAR_OBJ(obj) memset(&(obj), 0, sizeof(obj))
-
-#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
- #define MZ_READ_LE16(p) *((const mz_uint16 *)(p))
- #define MZ_READ_LE32(p) *((const mz_uint32 *)(p))
-#else
- #define MZ_READ_LE16(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U))
- #define MZ_READ_LE32(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U) | ((mz_uint32)(((const mz_uint8 *)(p))[2]) << 16U) | ((mz_uint32)(((const mz_uint8 *)(p))[3]) << 24U))
-#endif
-
-#ifdef _MSC_VER
- #define MZ_FORCEINLINE __forceinline
-#elif defined(__GNUC__)
- #define MZ_FORCEINLINE __attribute__((__always_inline__))
-#else
- #define MZ_FORCEINLINE
-#endif
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-// ------------------- zlib-style API's
-
-mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len)
-{
- mz_uint32 i, s1 = (mz_uint32)(adler & 0xffff), s2 = (mz_uint32)(adler >> 16); size_t block_len = buf_len % 5552;
- if (!ptr) return MZ_ADLER32_INIT;
- while (buf_len) {
- for (i = 0; i + 7 < block_len; i += 8, ptr += 8) {
- s1 += ptr[0], s2 += s1; s1 += ptr[1], s2 += s1; s1 += ptr[2], s2 += s1; s1 += ptr[3], s2 += s1;
- s1 += ptr[4], s2 += s1; s1 += ptr[5], s2 += s1; s1 += ptr[6], s2 += s1; s1 += ptr[7], s2 += s1;
- }
- for ( ; i < block_len; ++i) s1 += *ptr++, s2 += s1;
- s1 %= 65521U, s2 %= 65521U; buf_len -= block_len; block_len = 5552;
- }
- return (s2 << 16) + s1;
-}
-
-// Karl Malbrain's compact CRC-32. See "A compact CCITT crc16 and crc32 C implementation that balances processor cache usage against speed": http://www.geocities.com/malbrain/
-mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len)
-{
- static const mz_uint32 s_crc32[16] = { 0, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c,
- 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c };
- mz_uint32 crcu32 = (mz_uint32)crc;
- if (!ptr) return MZ_CRC32_INIT;
- crcu32 = ~crcu32; while (buf_len--) { mz_uint8 b = *ptr++; crcu32 = (crcu32 >> 4) ^ s_crc32[(crcu32 & 0xF) ^ (b & 0xF)]; crcu32 = (crcu32 >> 4) ^ s_crc32[(crcu32 & 0xF) ^ (b >> 4)]; }
- return ~crcu32;
-}
-
-void mz_free(void *p)
-{
- MZ_FREE(p);
-}
-
-#ifndef MINIZ_NO_ZLIB_APIS
-
-static void *def_alloc_func(void *opaque, size_t items, size_t size) { (void)opaque, (void)items, (void)size; return MZ_MALLOC(items * size); }
-static void def_free_func(void *opaque, void *address) { (void)opaque, (void)address; MZ_FREE(address); }
-static void *def_realloc_func(void *opaque, void *address, size_t items, size_t size) { (void)opaque, (void)address, (void)items, (void)size; return MZ_REALLOC(address, items * size); }
-
-const char *mz_version(void)
-{
- return MZ_VERSION;
-}
-
-int mz_deflateInit(mz_streamp pStream, int level)
-{
- return mz_deflateInit2(pStream, level, MZ_DEFLATED, MZ_DEFAULT_WINDOW_BITS, 9, MZ_DEFAULT_STRATEGY);
-}
-
-int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy)
-{
- tdefl_compressor *pComp;
- mz_uint comp_flags = TDEFL_COMPUTE_ADLER32 | tdefl_create_comp_flags_from_zip_params(level, window_bits, strategy);
-
- if (!pStream) return MZ_STREAM_ERROR;
- if ((method != MZ_DEFLATED) || ((mem_level < 1) || (mem_level > 9)) || ((window_bits != MZ_DEFAULT_WINDOW_BITS) && (-window_bits != MZ_DEFAULT_WINDOW_BITS))) return MZ_PARAM_ERROR;
-
- pStream->data_type = 0;
- pStream->adler = MZ_ADLER32_INIT;
- pStream->msg = NULL;
- pStream->reserved = 0;
- pStream->total_in = 0;
- pStream->total_out = 0;
- if (!pStream->zalloc) pStream->zalloc = def_alloc_func;
- if (!pStream->zfree) pStream->zfree = def_free_func;
-
- pComp = (tdefl_compressor *)pStream->zalloc(pStream->opaque, 1, sizeof(tdefl_compressor));
- if (!pComp)
- return MZ_MEM_ERROR;
-
- pStream->state = (struct mz_internal_state *)pComp;
-
- if (tdefl_init(pComp, NULL, NULL, comp_flags) != TDEFL_STATUS_OKAY)
- {
- mz_deflateEnd(pStream);
- return MZ_PARAM_ERROR;
- }
-
- return MZ_OK;
-}
-
-int mz_deflateReset(mz_streamp pStream)
-{
- if ((!pStream) || (!pStream->state) || (!pStream->zalloc) || (!pStream->zfree)) return MZ_STREAM_ERROR;
- pStream->total_in = pStream->total_out = 0;
- tdefl_init((tdefl_compressor*)pStream->state, NULL, NULL, ((tdefl_compressor*)pStream->state)->m_flags);
- return MZ_OK;
-}
-
-int mz_deflate(mz_streamp pStream, int flush)
-{
- size_t in_bytes, out_bytes;
- mz_ulong orig_total_in, orig_total_out;
- int mz_status = MZ_OK;
-
- if ((!pStream) || (!pStream->state) || (flush < 0) || (flush > MZ_FINISH) || (!pStream->next_out)) return MZ_STREAM_ERROR;
- if (!pStream->avail_out) return MZ_BUF_ERROR;
-
- if (flush == MZ_PARTIAL_FLUSH) flush = MZ_SYNC_FLUSH;
-
- if (((tdefl_compressor*)pStream->state)->m_prev_return_status == TDEFL_STATUS_DONE)
- return (flush == MZ_FINISH) ? MZ_STREAM_END : MZ_BUF_ERROR;
-
- orig_total_in = pStream->total_in; orig_total_out = pStream->total_out;
- for ( ; ; )
- {
- tdefl_status defl_status;
- in_bytes = pStream->avail_in; out_bytes = pStream->avail_out;
-
- defl_status = tdefl_compress((tdefl_compressor*)pStream->state, pStream->next_in, &in_bytes, pStream->next_out, &out_bytes, (tdefl_flush)flush);
- pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes;
- pStream->total_in += (mz_uint)in_bytes; pStream->adler = tdefl_get_adler32((tdefl_compressor*)pStream->state);
-
- pStream->next_out += (mz_uint)out_bytes; pStream->avail_out -= (mz_uint)out_bytes;
- pStream->total_out += (mz_uint)out_bytes;
-
- if (defl_status < 0)
- {
- mz_status = MZ_STREAM_ERROR;
- break;
- }
- else if (defl_status == TDEFL_STATUS_DONE)
- {
- mz_status = MZ_STREAM_END;
- break;
- }
- else if (!pStream->avail_out)
- break;
- else if ((!pStream->avail_in) && (flush != MZ_FINISH))
- {
- if ((flush) || (pStream->total_in != orig_total_in) || (pStream->total_out != orig_total_out))
- break;
- return MZ_BUF_ERROR; // Can't make forward progress without some input.
- }
- }
- return mz_status;
-}
-
-int mz_deflateEnd(mz_streamp pStream)
-{
- if (!pStream) return MZ_STREAM_ERROR;
- if (pStream->state)
- {
- pStream->zfree(pStream->opaque, pStream->state);
- pStream->state = NULL;
- }
- return MZ_OK;
-}
-
-mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len)
-{
- (void)pStream;
- // This is really over conservative. (And lame, but it's actually pretty tricky to compute a true upper bound given the way tdefl's blocking works.)
- return MZ_MAX(128 + (source_len * 110) / 100, 128 + source_len + ((source_len / (31 * 1024)) + 1) * 5);
-}
-
-int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level)
-{
- int status;
- mz_stream stream;
- memset(&stream, 0, sizeof(stream));
-
- // In case mz_ulong is 64-bits (argh I hate longs).
- if ((source_len | *pDest_len) > 0xFFFFFFFFU) return MZ_PARAM_ERROR;
-
- stream.next_in = pSource;
- stream.avail_in = (mz_uint32)source_len;
- stream.next_out = pDest;
- stream.avail_out = (mz_uint32)*pDest_len;
-
- status = mz_deflateInit(&stream, level);
- if (status != MZ_OK) return status;
-
- status = mz_deflate(&stream, MZ_FINISH);
- if (status != MZ_STREAM_END)
- {
- mz_deflateEnd(&stream);
- return (status == MZ_OK) ? MZ_BUF_ERROR : status;
- }
-
- *pDest_len = stream.total_out;
- return mz_deflateEnd(&stream);
-}
-
-int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len)
-{
- return mz_compress2(pDest, pDest_len, pSource, source_len, MZ_DEFAULT_COMPRESSION);
-}
-
-mz_ulong mz_compressBound(mz_ulong source_len)
-{
- return mz_deflateBound(NULL, source_len);
-}
-
-typedef struct
-{
- tinfl_decompressor m_decomp;
- mz_uint m_dict_ofs, m_dict_avail, m_first_call, m_has_flushed; int m_window_bits;
- mz_uint8 m_dict[TINFL_LZ_DICT_SIZE];
- tinfl_status m_last_status;
-} inflate_state;
-
-int mz_inflateInit2(mz_streamp pStream, int window_bits)
-{
- inflate_state *pDecomp;
- if (!pStream) return MZ_STREAM_ERROR;
- if ((window_bits != MZ_DEFAULT_WINDOW_BITS) && (-window_bits != MZ_DEFAULT_WINDOW_BITS)) return MZ_PARAM_ERROR;
-
- pStream->data_type = 0;
- pStream->adler = 0;
- pStream->msg = NULL;
- pStream->total_in = 0;
- pStream->total_out = 0;
- pStream->reserved = 0;
- if (!pStream->zalloc) pStream->zalloc = def_alloc_func;
- if (!pStream->zfree) pStream->zfree = def_free_func;
-
- pDecomp = (inflate_state*)pStream->zalloc(pStream->opaque, 1, sizeof(inflate_state));
- if (!pDecomp) return MZ_MEM_ERROR;
-
- pStream->state = (struct mz_internal_state *)pDecomp;
-
- tinfl_init(&pDecomp->m_decomp);
- pDecomp->m_dict_ofs = 0;
- pDecomp->m_dict_avail = 0;
- pDecomp->m_last_status = TINFL_STATUS_NEEDS_MORE_INPUT;
- pDecomp->m_first_call = 1;
- pDecomp->m_has_flushed = 0;
- pDecomp->m_window_bits = window_bits;
-
- return MZ_OK;
-}
-
-int mz_inflateInit(mz_streamp pStream)
-{
- return mz_inflateInit2(pStream, MZ_DEFAULT_WINDOW_BITS);
-}
-
-int mz_inflate(mz_streamp pStream, int flush)
-{
- inflate_state* pState;
- mz_uint n, first_call, decomp_flags = TINFL_FLAG_COMPUTE_ADLER32;
- size_t in_bytes, out_bytes, orig_avail_in;
- tinfl_status status;
-
- if ((!pStream) || (!pStream->state)) return MZ_STREAM_ERROR;
- if (flush == MZ_PARTIAL_FLUSH) flush = MZ_SYNC_FLUSH;
- if ((flush) && (flush != MZ_SYNC_FLUSH) && (flush != MZ_FINISH)) return MZ_STREAM_ERROR;
-
- pState = (inflate_state*)pStream->state;
- if (pState->m_window_bits > 0) decomp_flags |= TINFL_FLAG_PARSE_ZLIB_HEADER;
- orig_avail_in = pStream->avail_in;
-
- first_call = pState->m_first_call; pState->m_first_call = 0;
- if (pState->m_last_status < 0) return MZ_DATA_ERROR;
-
- if (pState->m_has_flushed && (flush != MZ_FINISH)) return MZ_STREAM_ERROR;
- pState->m_has_flushed |= (flush == MZ_FINISH);
-
- if ((flush == MZ_FINISH) && (first_call))
- {
- // MZ_FINISH on the first call implies that the input and output buffers are large enough to hold the entire compressed/decompressed file.
- decomp_flags |= TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF;
- in_bytes = pStream->avail_in; out_bytes = pStream->avail_out;
- status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, pStream->next_out, pStream->next_out, &out_bytes, decomp_flags);
- pState->m_last_status = status;
- pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes; pStream->total_in += (mz_uint)in_bytes;
- pStream->adler = tinfl_get_adler32(&pState->m_decomp);
- pStream->next_out += (mz_uint)out_bytes; pStream->avail_out -= (mz_uint)out_bytes; pStream->total_out += (mz_uint)out_bytes;
-
- if (status < 0)
- return MZ_DATA_ERROR;
- else if (status != TINFL_STATUS_DONE)
- {
- pState->m_last_status = TINFL_STATUS_FAILED;
- return MZ_BUF_ERROR;
- }
- return MZ_STREAM_END;
- }
- // flush != MZ_FINISH then we must assume there's more input.
- if (flush != MZ_FINISH) decomp_flags |= TINFL_FLAG_HAS_MORE_INPUT;
-
- if (pState->m_dict_avail)
- {
- n = MZ_MIN(pState->m_dict_avail, pStream->avail_out);
- memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n);
- pStream->next_out += n; pStream->avail_out -= n; pStream->total_out += n;
- pState->m_dict_avail -= n; pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1);
- return ((pState->m_last_status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK;
- }
-
- for ( ; ; )
- {
- in_bytes = pStream->avail_in;
- out_bytes = TINFL_LZ_DICT_SIZE - pState->m_dict_ofs;
-
- status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, pState->m_dict, pState->m_dict + pState->m_dict_ofs, &out_bytes, decomp_flags);
- pState->m_last_status = status;
-
- pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes;
- pStream->total_in += (mz_uint)in_bytes; pStream->adler = tinfl_get_adler32(&pState->m_decomp);
-
- pState->m_dict_avail = (mz_uint)out_bytes;
-
- n = MZ_MIN(pState->m_dict_avail, pStream->avail_out);
- memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n);
- pStream->next_out += n; pStream->avail_out -= n; pStream->total_out += n;
- pState->m_dict_avail -= n; pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1);
-
- if (status < 0)
- return MZ_DATA_ERROR; // Stream is corrupted (there could be some uncompressed data left in the output dictionary - oh well).
- else if ((status == TINFL_STATUS_NEEDS_MORE_INPUT) && (!orig_avail_in))
- return MZ_BUF_ERROR; // Signal caller that we can't make forward progress without supplying more input or by setting flush to MZ_FINISH.
- else if (flush == MZ_FINISH)
- {
- // The output buffer MUST be large to hold the remaining uncompressed data when flush==MZ_FINISH.
- if (status == TINFL_STATUS_DONE)
- return pState->m_dict_avail ? MZ_BUF_ERROR : MZ_STREAM_END;
- // status here must be TINFL_STATUS_HAS_MORE_OUTPUT, which means there's at least 1 more byte on the way. If there's no more room left in the output buffer then something is wrong.
- else if (!pStream->avail_out)
- return MZ_BUF_ERROR;
- }
- else if ((status == TINFL_STATUS_DONE) || (!pStream->avail_in) || (!pStream->avail_out) || (pState->m_dict_avail))
- break;
- }
-
- return ((status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK;
-}
-
-int mz_inflateEnd(mz_streamp pStream)
-{
- if (!pStream)
- return MZ_STREAM_ERROR;
- if (pStream->state)
- {
- pStream->zfree(pStream->opaque, pStream->state);
- pStream->state = NULL;
- }
- return MZ_OK;
-}
-
-int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len)
-{
- mz_stream stream;
- int status;
- memset(&stream, 0, sizeof(stream));
-
- // In case mz_ulong is 64-bits (argh I hate longs).
- if ((source_len | *pDest_len) > 0xFFFFFFFFU) return MZ_PARAM_ERROR;
-
- stream.next_in = pSource;
- stream.avail_in = (mz_uint32)source_len;
- stream.next_out = pDest;
- stream.avail_out = (mz_uint32)*pDest_len;
-
- status = mz_inflateInit(&stream);
- if (status != MZ_OK)
- return status;
-
- status = mz_inflate(&stream, MZ_FINISH);
- if (status != MZ_STREAM_END)
- {
- mz_inflateEnd(&stream);
- return ((status == MZ_BUF_ERROR) && (!stream.avail_in)) ? MZ_DATA_ERROR : status;
- }
- *pDest_len = stream.total_out;
-
- return mz_inflateEnd(&stream);
-}
-
-const char *mz_error(int err)
-{
- static struct { int m_err; const char *m_pDesc; } s_error_descs[] =
- {
- { MZ_OK, "" }, { MZ_STREAM_END, "stream end" }, { MZ_NEED_DICT, "need dictionary" }, { MZ_ERRNO, "file error" }, { MZ_STREAM_ERROR, "stream error" },
- { MZ_DATA_ERROR, "data error" }, { MZ_MEM_ERROR, "out of memory" }, { MZ_BUF_ERROR, "buf error" }, { MZ_VERSION_ERROR, "version error" }, { MZ_PARAM_ERROR, "parameter error" }
- };
- mz_uint i; for (i = 0; i < sizeof(s_error_descs) / sizeof(s_error_descs[0]); ++i) if (s_error_descs[i].m_err == err) return s_error_descs[i].m_pDesc;
- return NULL;
-}
-
-#endif //MINIZ_NO_ZLIB_APIS
-
-// ------------------- Low-level Decompression (completely independent from all compression API's)
-
-#define TINFL_MEMCPY(d, s, l) memcpy(d, s, l)
-#define TINFL_MEMSET(p, c, l) memset(p, c, l)
-
-#define TINFL_CR_BEGIN switch(r->m_state) { case 0:
-#define TINFL_CR_RETURN(state_index, result) do { status = result; r->m_state = state_index; goto common_exit; case state_index:; } MZ_MACRO_END
-#define TINFL_CR_RETURN_FOREVER(state_index, result) do { for ( ; ; ) { TINFL_CR_RETURN(state_index, result); } } MZ_MACRO_END
-#define TINFL_CR_FINISH }
-
-// TODO: If the caller has indicated that there's no more input, and we attempt to read beyond the input buf, then something is wrong with the input because the inflator never
-// reads ahead more than it needs to. Currently TINFL_GET_BYTE() pads the end of the stream with 0's in this scenario.
-#define TINFL_GET_BYTE(state_index, c) do { \
- if (pIn_buf_cur >= pIn_buf_end) { \
- for ( ; ; ) { \
- if (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) { \
- TINFL_CR_RETURN(state_index, TINFL_STATUS_NEEDS_MORE_INPUT); \
- if (pIn_buf_cur < pIn_buf_end) { \
- c = *pIn_buf_cur++; \
- break; \
- } \
- } else { \
- c = 0; \
- break; \
- } \
- } \
- } else c = *pIn_buf_cur++; } MZ_MACRO_END
-
-#define TINFL_NEED_BITS(state_index, n) do { mz_uint c; TINFL_GET_BYTE(state_index, c); bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); num_bits += 8; } while (num_bits < (mz_uint)(n))
-#define TINFL_SKIP_BITS(state_index, n) do { if (num_bits < (mz_uint)(n)) { TINFL_NEED_BITS(state_index, n); } bit_buf >>= (n); num_bits -= (n); } MZ_MACRO_END
-#define TINFL_GET_BITS(state_index, b, n) do { if (num_bits < (mz_uint)(n)) { TINFL_NEED_BITS(state_index, n); } b = bit_buf & ((1 << (n)) - 1); bit_buf >>= (n); num_bits -= (n); } MZ_MACRO_END
-
-// TINFL_HUFF_BITBUF_FILL() is only used rarely, when the number of bytes remaining in the input buffer falls below 2.
-// It reads just enough bytes from the input stream that are needed to decode the next Huffman code (and absolutely no more). It works by trying to fully decode a
-// Huffman code by using whatever bits are currently present in the bit buffer. If this fails, it reads another byte, and tries again until it succeeds or until the
-// bit buffer contains >=15 bits (deflate's max. Huffman code size).
-#define TINFL_HUFF_BITBUF_FILL(state_index, pHuff) \
- do { \
- temp = (pHuff)->m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]; \
- if (temp >= 0) { \
- code_len = temp >> 9; \
- if ((code_len) && (num_bits >= code_len)) \
- break; \
- } else if (num_bits > TINFL_FAST_LOOKUP_BITS) { \
- code_len = TINFL_FAST_LOOKUP_BITS; \
- do { \
- temp = (pHuff)->m_tree[~temp + ((bit_buf >> code_len++) & 1)]; \
- } while ((temp < 0) && (num_bits >= (code_len + 1))); if (temp >= 0) break; \
- } TINFL_GET_BYTE(state_index, c); bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); num_bits += 8; \
- } while (num_bits < 15);
-
-// TINFL_HUFF_DECODE() decodes the next Huffman coded symbol. It's more complex than you would initially expect because the zlib API expects the decompressor to never read
-// beyond the final byte of the deflate stream. (In other words, when this macro wants to read another byte from the input, it REALLY needs another byte in order to fully
-// decode the next Huffman code.) Handling this properly is particularly important on raw deflate (non-zlib) streams, which aren't followed by a byte aligned adler-32.
-// The slow path is only executed at the very end of the input buffer.
-#define TINFL_HUFF_DECODE(state_index, sym, pHuff) do { \
- int temp; mz_uint code_len, c; \
- if (num_bits < 15) { \
- if ((pIn_buf_end - pIn_buf_cur) < 2) { \
- TINFL_HUFF_BITBUF_FILL(state_index, pHuff); \
- } else { \
- bit_buf |= (((tinfl_bit_buf_t)pIn_buf_cur[0]) << num_bits) | (((tinfl_bit_buf_t)pIn_buf_cur[1]) << (num_bits + 8)); pIn_buf_cur += 2; num_bits += 16; \
- } \
- } \
- if ((temp = (pHuff)->m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0) \
- code_len = temp >> 9, temp &= 511; \
- else { \
- code_len = TINFL_FAST_LOOKUP_BITS; do { temp = (pHuff)->m_tree[~temp + ((bit_buf >> code_len++) & 1)]; } while (temp < 0); \
- } sym = temp; bit_buf >>= code_len; num_bits -= code_len; } MZ_MACRO_END
-
-tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags)
-{
- static const int s_length_base[31] = { 3,4,5,6,7,8,9,10,11,13, 15,17,19,23,27,31,35,43,51,59, 67,83,99,115,131,163,195,227,258,0,0 };
- static const int s_length_extra[31]= { 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 };
- static const int s_dist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193, 257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0};
- static const int s_dist_extra[32] = { 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
- static const mz_uint8 s_length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 };
- static const int s_min_table_sizes[3] = { 257, 1, 4 };
-
- tinfl_status status = TINFL_STATUS_FAILED; mz_uint32 num_bits, dist, counter, num_extra; tinfl_bit_buf_t bit_buf;
- const mz_uint8 *pIn_buf_cur = pIn_buf_next, *const pIn_buf_end = pIn_buf_next + *pIn_buf_size;
- mz_uint8 *pOut_buf_cur = pOut_buf_next, *const pOut_buf_end = pOut_buf_next + *pOut_buf_size;
- size_t out_buf_size_mask = (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF) ? (size_t)-1 : ((pOut_buf_next - pOut_buf_start) + *pOut_buf_size) - 1, dist_from_out_buf_start;
-
- // Ensure the output buffer's size is a power of 2, unless the output buffer is large enough to hold the entire output file (in which case it doesn't matter).
- if (((out_buf_size_mask + 1) & out_buf_size_mask) || (pOut_buf_next < pOut_buf_start)) { *pIn_buf_size = *pOut_buf_size = 0; return TINFL_STATUS_BAD_PARAM; }
-
- num_bits = r->m_num_bits; bit_buf = r->m_bit_buf; dist = r->m_dist; counter = r->m_counter; num_extra = r->m_num_extra; dist_from_out_buf_start = r->m_dist_from_out_buf_start;
- TINFL_CR_BEGIN
-
- bit_buf = num_bits = dist = counter = num_extra = r->m_zhdr0 = r->m_zhdr1 = 0; r->m_z_adler32 = r->m_check_adler32 = 1;
- if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER)
- {
- TINFL_GET_BYTE(1, r->m_zhdr0); TINFL_GET_BYTE(2, r->m_zhdr1);
- counter = (((r->m_zhdr0 * 256 + r->m_zhdr1) % 31 != 0) || (r->m_zhdr1 & 32) || ((r->m_zhdr0 & 15) != 8));
- if (!(decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) counter |= (((1U << (8U + (r->m_zhdr0 >> 4))) > 32768U) || ((out_buf_size_mask + 1) < (size_t)(1U << (8U + (r->m_zhdr0 >> 4)))));
- if (counter) { TINFL_CR_RETURN_FOREVER(36, TINFL_STATUS_FAILED); }
- }
-
- do
- {
- TINFL_GET_BITS(3, r->m_final, 3); r->m_type = r->m_final >> 1;
- if (r->m_type == 0)
- {
- TINFL_SKIP_BITS(5, num_bits & 7);
- for (counter = 0; counter < 4; ++counter) { if (num_bits) TINFL_GET_BITS(6, r->m_raw_header[counter], 8); else TINFL_GET_BYTE(7, r->m_raw_header[counter]); }
- if ((counter = (r->m_raw_header[0] | (r->m_raw_header[1] << 8))) != (mz_uint)(0xFFFF ^ (r->m_raw_header[2] | (r->m_raw_header[3] << 8)))) { TINFL_CR_RETURN_FOREVER(39, TINFL_STATUS_FAILED); }
- while ((counter) && (num_bits))
- {
- TINFL_GET_BITS(51, dist, 8);
- while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(52, TINFL_STATUS_HAS_MORE_OUTPUT); }
- *pOut_buf_cur++ = (mz_uint8)dist;
- counter--;
- }
- while (counter)
- {
- size_t n; while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(9, TINFL_STATUS_HAS_MORE_OUTPUT); }
- while (pIn_buf_cur >= pIn_buf_end)
- {
- if (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT)
- {
- TINFL_CR_RETURN(38, TINFL_STATUS_NEEDS_MORE_INPUT);
- }
- else
- {
- TINFL_CR_RETURN_FOREVER(40, TINFL_STATUS_FAILED);
- }
- }
- n = MZ_MIN(MZ_MIN((size_t)(pOut_buf_end - pOut_buf_cur), (size_t)(pIn_buf_end - pIn_buf_cur)), counter);
- TINFL_MEMCPY(pOut_buf_cur, pIn_buf_cur, n); pIn_buf_cur += n; pOut_buf_cur += n; counter -= (mz_uint)n;
- }
- }
- else if (r->m_type == 3)
- {
- TINFL_CR_RETURN_FOREVER(10, TINFL_STATUS_FAILED);
- }
- else
- {
- if (r->m_type == 1)
- {
- mz_uint8 *p = r->m_tables[0].m_code_size; mz_uint i;
- r->m_table_sizes[0] = 288; r->m_table_sizes[1] = 32; TINFL_MEMSET(r->m_tables[1].m_code_size, 5, 32);
- for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8;
- }
- else
- {
- for (counter = 0; counter < 3; counter++) { TINFL_GET_BITS(11, r->m_table_sizes[counter], "\05\05\04"[counter]); r->m_table_sizes[counter] += s_min_table_sizes[counter]; }
- MZ_CLEAR_OBJ(r->m_tables[2].m_code_size); for (counter = 0; counter < r->m_table_sizes[2]; counter++) { mz_uint s; TINFL_GET_BITS(14, s, 3); r->m_tables[2].m_code_size[s_length_dezigzag[counter]] = (mz_uint8)s; }
- r->m_table_sizes[2] = 19;
- }
- for ( ; (int)r->m_type >= 0; r->m_type--)
- {
- int tree_next, tree_cur; tinfl_huff_table *pTable;
- mz_uint i, j, used_syms, total, sym_index, next_code[17], total_syms[16]; pTable = &r->m_tables[r->m_type]; MZ_CLEAR_OBJ(total_syms); MZ_CLEAR_OBJ(pTable->m_look_up); MZ_CLEAR_OBJ(pTable->m_tree);
- for (i = 0; i < r->m_table_sizes[r->m_type]; ++i) total_syms[pTable->m_code_size[i]]++;
- used_syms = 0, total = 0; next_code[0] = next_code[1] = 0;
- for (i = 1; i <= 15; ++i) { used_syms += total_syms[i]; next_code[i + 1] = (total = ((total + total_syms[i]) << 1)); }
- if ((65536 != total) && (used_syms > 1))
- {
- TINFL_CR_RETURN_FOREVER(35, TINFL_STATUS_FAILED);
- }
- for (tree_next = -1, sym_index = 0; sym_index < r->m_table_sizes[r->m_type]; ++sym_index)
- {
- mz_uint rev_code = 0, l, cur_code, code_size = pTable->m_code_size[sym_index]; if (!code_size) continue;
- cur_code = next_code[code_size]++; for (l = code_size; l > 0; l--, cur_code >>= 1) rev_code = (rev_code << 1) | (cur_code & 1);
- if (code_size <= TINFL_FAST_LOOKUP_BITS) { mz_int16 k = (mz_int16)((code_size << 9) | sym_index); while (rev_code < TINFL_FAST_LOOKUP_SIZE) { pTable->m_look_up[rev_code] = k; rev_code += (1 << code_size); } continue; }
- if (0 == (tree_cur = pTable->m_look_up[rev_code & (TINFL_FAST_LOOKUP_SIZE - 1)])) { pTable->m_look_up[rev_code & (TINFL_FAST_LOOKUP_SIZE - 1)] = (mz_int16)tree_next; tree_cur = tree_next; tree_next -= 2; }
- rev_code >>= (TINFL_FAST_LOOKUP_BITS - 1);
- for (j = code_size; j > (TINFL_FAST_LOOKUP_BITS + 1); j--)
- {
- tree_cur -= ((rev_code >>= 1) & 1);
- if (!pTable->m_tree[-tree_cur - 1]) { pTable->m_tree[-tree_cur - 1] = (mz_int16)tree_next; tree_cur = tree_next; tree_next -= 2; } else tree_cur = pTable->m_tree[-tree_cur - 1];
- }
- tree_cur -= ((rev_code >>= 1) & 1); pTable->m_tree[-tree_cur - 1] = (mz_int16)sym_index;
- }
- if (r->m_type == 2)
- {
- for (counter = 0; counter < (r->m_table_sizes[0] + r->m_table_sizes[1]); )
- {
- mz_uint s; TINFL_HUFF_DECODE(16, dist, &r->m_tables[2]); if (dist < 16) { r->m_len_codes[counter++] = (mz_uint8)dist; continue; }
- if ((dist == 16) && (!counter))
- {
- TINFL_CR_RETURN_FOREVER(17, TINFL_STATUS_FAILED);
- }
- num_extra = "\02\03\07"[dist - 16]; TINFL_GET_BITS(18, s, num_extra); s += "\03\03\013"[dist - 16];
- TINFL_MEMSET(r->m_len_codes + counter, (dist == 16) ? r->m_len_codes[counter - 1] : 0, s); counter += s;
- }
- if ((r->m_table_sizes[0] + r->m_table_sizes[1]) != counter)
- {
- TINFL_CR_RETURN_FOREVER(21, TINFL_STATUS_FAILED);
- }
- TINFL_MEMCPY(r->m_tables[0].m_code_size, r->m_len_codes, r->m_table_sizes[0]); TINFL_MEMCPY(r->m_tables[1].m_code_size, r->m_len_codes + r->m_table_sizes[0], r->m_table_sizes[1]);
- }
- }
- for ( ; ; )
- {
- mz_uint8 *pSrc;
- for ( ; ; )
- {
- if (((pIn_buf_end - pIn_buf_cur) < 4) || ((pOut_buf_end - pOut_buf_cur) < 2))
- {
- TINFL_HUFF_DECODE(23, counter, &r->m_tables[0]);
- if (counter >= 256)
- break;
- while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(24, TINFL_STATUS_HAS_MORE_OUTPUT); }
- *pOut_buf_cur++ = (mz_uint8)counter;
- }
- else
- {
- int sym2; mz_uint code_len;
-#if TINFL_USE_64BIT_BITBUF
- if (num_bits < 30) { bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE32(pIn_buf_cur)) << num_bits); pIn_buf_cur += 4; num_bits += 32; }
-#else
- if (num_bits < 15) { bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE16(pIn_buf_cur)) << num_bits); pIn_buf_cur += 2; num_bits += 16; }
-#endif
- if ((sym2 = r->m_tables[0].m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0)
- code_len = sym2 >> 9;
- else
- {
- code_len = TINFL_FAST_LOOKUP_BITS; do { sym2 = r->m_tables[0].m_tree[~sym2 + ((bit_buf >> code_len++) & 1)]; } while (sym2 < 0);
- }
- counter = sym2; bit_buf >>= code_len; num_bits -= code_len;
- if (counter & 256)
- break;
-
-#if !TINFL_USE_64BIT_BITBUF
- if (num_bits < 15) { bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE16(pIn_buf_cur)) << num_bits); pIn_buf_cur += 2; num_bits += 16; }
-#endif
- if ((sym2 = r->m_tables[0].m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0)
- code_len = sym2 >> 9;
- else
- {
- code_len = TINFL_FAST_LOOKUP_BITS; do { sym2 = r->m_tables[0].m_tree[~sym2 + ((bit_buf >> code_len++) & 1)]; } while (sym2 < 0);
- }
- bit_buf >>= code_len; num_bits -= code_len;
-
- pOut_buf_cur[0] = (mz_uint8)counter;
- if (sym2 & 256)
- {
- pOut_buf_cur++;
- counter = sym2;
- break;
- }
- pOut_buf_cur[1] = (mz_uint8)sym2;
- pOut_buf_cur += 2;
- }
- }
- if ((counter &= 511) == 256) break;
-
- num_extra = s_length_extra[counter - 257]; counter = s_length_base[counter - 257];
- if (num_extra) { mz_uint extra_bits; TINFL_GET_BITS(25, extra_bits, num_extra); counter += extra_bits; }
-
- TINFL_HUFF_DECODE(26, dist, &r->m_tables[1]);
- num_extra = s_dist_extra[dist]; dist = s_dist_base[dist];
- if (num_extra) { mz_uint extra_bits; TINFL_GET_BITS(27, extra_bits, num_extra); dist += extra_bits; }
-
- dist_from_out_buf_start = pOut_buf_cur - pOut_buf_start;
- if ((dist > dist_from_out_buf_start) && (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF))
- {
- TINFL_CR_RETURN_FOREVER(37, TINFL_STATUS_FAILED);
- }
-
- pSrc = pOut_buf_start + ((dist_from_out_buf_start - dist) & out_buf_size_mask);
-
- if ((MZ_MAX(pOut_buf_cur, pSrc) + counter) > pOut_buf_end)
- {
- while (counter--)
- {
- while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(53, TINFL_STATUS_HAS_MORE_OUTPUT); }
- *pOut_buf_cur++ = pOut_buf_start[(dist_from_out_buf_start++ - dist) & out_buf_size_mask];
- }
- continue;
- }
-#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES
- else if ((counter >= 9) && (counter <= dist))
- {
- const mz_uint8 *pSrc_end = pSrc + (counter & ~7);
- do
- {
- ((mz_uint32 *)pOut_buf_cur)[0] = ((const mz_uint32 *)pSrc)[0];
- ((mz_uint32 *)pOut_buf_cur)[1] = ((const mz_uint32 *)pSrc)[1];
- pOut_buf_cur += 8;
- } while ((pSrc += 8) < pSrc_end);
- if ((counter &= 7) < 3)
- {
- if (counter)
- {
- pOut_buf_cur[0] = pSrc[0];
- if (counter > 1)
- pOut_buf_cur[1] = pSrc[1];
- pOut_buf_cur += counter;
- }
- continue;
- }
- }
-#endif
- do
- {
- pOut_buf_cur[0] = pSrc[0];
- pOut_buf_cur[1] = pSrc[1];
- pOut_buf_cur[2] = pSrc[2];
- pOut_buf_cur += 3; pSrc += 3;
- } while ((int)(counter -= 3) > 2);
- if ((int)counter > 0)
- {
- pOut_buf_cur[0] = pSrc[0];
- if ((int)counter > 1)
- pOut_buf_cur[1] = pSrc[1];
- pOut_buf_cur += counter;
- }
- }
- }
- } while (!(r->m_final & 1));
- if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER)
- {
- TINFL_SKIP_BITS(32, num_bits & 7); for (counter = 0; counter < 4; ++counter) { mz_uint s; if (num_bits) TINFL_GET_BITS(41, s, 8); else TINFL_GET_BYTE(42, s); r->m_z_adler32 = (r->m_z_adler32 << 8) | s; }
- }
- TINFL_CR_RETURN_FOREVER(34, TINFL_STATUS_DONE);
- TINFL_CR_FINISH
-
-common_exit:
- r->m_num_bits = num_bits; r->m_bit_buf = bit_buf; r->m_dist = dist; r->m_counter = counter; r->m_num_extra = num_extra; r->m_dist_from_out_buf_start = dist_from_out_buf_start;
- *pIn_buf_size = pIn_buf_cur - pIn_buf_next; *pOut_buf_size = pOut_buf_cur - pOut_buf_next;
- if ((decomp_flags & (TINFL_FLAG_PARSE_ZLIB_HEADER | TINFL_FLAG_COMPUTE_ADLER32)) && (status >= 0))
- {
- const mz_uint8 *ptr = pOut_buf_next; size_t buf_len = *pOut_buf_size;
- mz_uint32 i, s1 = r->m_check_adler32 & 0xffff, s2 = r->m_check_adler32 >> 16; size_t block_len = buf_len % 5552;
- while (buf_len)
- {
- for (i = 0; i + 7 < block_len; i += 8, ptr += 8)
- {
- s1 += ptr[0], s2 += s1; s1 += ptr[1], s2 += s1; s1 += ptr[2], s2 += s1; s1 += ptr[3], s2 += s1;
- s1 += ptr[4], s2 += s1; s1 += ptr[5], s2 += s1; s1 += ptr[6], s2 += s1; s1 += ptr[7], s2 += s1;
- }
- for ( ; i < block_len; ++i) s1 += *ptr++, s2 += s1;
- s1 %= 65521U, s2 %= 65521U; buf_len -= block_len; block_len = 5552;
- }
- r->m_check_adler32 = (s2 << 16) + s1; if ((status == TINFL_STATUS_DONE) && (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) && (r->m_check_adler32 != r->m_z_adler32)) status = TINFL_STATUS_ADLER32_MISMATCH;
- }
- return status;
-}
-
-// Higher level helper functions.
-void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags)
-{
- tinfl_decompressor decomp; void *pBuf = NULL, *pNew_buf; size_t src_buf_ofs = 0, out_buf_capacity = 0;
- *pOut_len = 0;
- tinfl_init(&decomp);
- for ( ; ; )
- {
- size_t src_buf_size = src_buf_len - src_buf_ofs, dst_buf_size = out_buf_capacity - *pOut_len, new_out_buf_capacity;
- tinfl_status status = tinfl_decompress(&decomp, (const mz_uint8*)pSrc_buf + src_buf_ofs, &src_buf_size, (mz_uint8*)pBuf, pBuf ? (mz_uint8*)pBuf + *pOut_len : NULL, &dst_buf_size,
- (flags & ~TINFL_FLAG_HAS_MORE_INPUT) | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF);
- if ((status < 0) || (status == TINFL_STATUS_NEEDS_MORE_INPUT))
- {
- MZ_FREE(pBuf); *pOut_len = 0; return NULL;
- }
- src_buf_ofs += src_buf_size;
- *pOut_len += dst_buf_size;
- if (status == TINFL_STATUS_DONE) break;
- new_out_buf_capacity = out_buf_capacity * 2; if (new_out_buf_capacity < 128) new_out_buf_capacity = 128;
- pNew_buf = MZ_REALLOC(pBuf, new_out_buf_capacity);
- if (!pNew_buf)
- {
- MZ_FREE(pBuf); *pOut_len = 0; return NULL;
- }
- pBuf = pNew_buf; out_buf_capacity = new_out_buf_capacity;
- }
- return pBuf;
-}
-
-size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags)
-{
- tinfl_decompressor decomp; tinfl_status status; tinfl_init(&decomp);
- status = tinfl_decompress(&decomp, (const mz_uint8*)pSrc_buf, &src_buf_len, (mz_uint8*)pOut_buf, (mz_uint8*)pOut_buf, &out_buf_len, (flags & ~TINFL_FLAG_HAS_MORE_INPUT) | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF);
- return (status != TINFL_STATUS_DONE) ? TINFL_DECOMPRESS_MEM_TO_MEM_FAILED : out_buf_len;
-}
-
-int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags)
-{
- int result = 0;
- tinfl_decompressor decomp;
- mz_uint8 *pDict = (mz_uint8*)MZ_MALLOC(TINFL_LZ_DICT_SIZE); size_t in_buf_ofs = 0, dict_ofs = 0;
- if (!pDict)
- return TINFL_STATUS_FAILED;
- tinfl_init(&decomp);
- for ( ; ; )
- {
- size_t in_buf_size = *pIn_buf_size - in_buf_ofs, dst_buf_size = TINFL_LZ_DICT_SIZE - dict_ofs;
- tinfl_status status = tinfl_decompress(&decomp, (const mz_uint8*)pIn_buf + in_buf_ofs, &in_buf_size, pDict, pDict + dict_ofs, &dst_buf_size,
- (flags & ~(TINFL_FLAG_HAS_MORE_INPUT | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)));
- in_buf_ofs += in_buf_size;
- if ((dst_buf_size) && (!(*pPut_buf_func)(pDict + dict_ofs, (int)dst_buf_size, pPut_buf_user)))
- break;
- if (status != TINFL_STATUS_HAS_MORE_OUTPUT)
- {
- result = (status == TINFL_STATUS_DONE);
- break;
- }
- dict_ofs = (dict_ofs + dst_buf_size) & (TINFL_LZ_DICT_SIZE - 1);
- }
- MZ_FREE(pDict);
- *pIn_buf_size = in_buf_ofs;
- return result;
-}
-
-// ------------------- Low-level Compression (independent from all decompression API's)
-
-// Purposely making these tables static for faster init and thread safety.
-static const mz_uint16 s_tdefl_len_sym[256] = {
- 257,258,259,260,261,262,263,264,265,265,266,266,267,267,268,268,269,269,269,269,270,270,270,270,271,271,271,271,272,272,272,272,
- 273,273,273,273,273,273,273,273,274,274,274,274,274,274,274,274,275,275,275,275,275,275,275,275,276,276,276,276,276,276,276,276,
- 277,277,277,277,277,277,277,277,277,277,277,277,277,277,277,277,278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,
- 279,279,279,279,279,279,279,279,279,279,279,279,279,279,279,279,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,
- 281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,
- 282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,
- 283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,
- 284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,285 };
-
-static const mz_uint8 s_tdefl_len_extra[256] = {
- 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
- 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0 };
-
-static const mz_uint8 s_tdefl_small_dist_sym[512] = {
- 0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,
- 11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,
- 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
- 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
- 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
- 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17 };
-
-static const mz_uint8 s_tdefl_small_dist_extra[512] = {
- 0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7 };
-
-static const mz_uint8 s_tdefl_large_dist_sym[128] = {
- 0,0,18,19,20,20,21,21,22,22,22,22,23,23,23,23,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,
- 28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29 };
-
-static const mz_uint8 s_tdefl_large_dist_extra[128] = {
- 0,0,8,8,9,9,9,9,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
- 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13 };
-
-// Radix sorts tdefl_sym_freq[] array by 16-bit key m_key. Returns ptr to sorted values.
-typedef struct { mz_uint16 m_key, m_sym_index; } tdefl_sym_freq;
-static tdefl_sym_freq* tdefl_radix_sort_syms(mz_uint num_syms, tdefl_sym_freq* pSyms0, tdefl_sym_freq* pSyms1)
-{
- mz_uint32 total_passes = 2, pass_shift, pass, i, hist[256 * 2]; tdefl_sym_freq* pCur_syms = pSyms0, *pNew_syms = pSyms1; MZ_CLEAR_OBJ(hist);
- for (i = 0; i < num_syms; i++) { mz_uint freq = pSyms0[i].m_key; hist[freq & 0xFF]++; hist[256 + ((freq >> 8) & 0xFF)]++; }
- while ((total_passes > 1) && (num_syms == hist[(total_passes - 1) * 256])) total_passes--;
- for (pass_shift = 0, pass = 0; pass < total_passes; pass++, pass_shift += 8)
- {
- const mz_uint32* pHist = &hist[pass << 8];
- mz_uint offsets[256], cur_ofs = 0;
- for (i = 0; i < 256; i++) { offsets[i] = cur_ofs; cur_ofs += pHist[i]; }
- for (i = 0; i < num_syms; i++) pNew_syms[offsets[(pCur_syms[i].m_key >> pass_shift) & 0xFF]++] = pCur_syms[i];
- { tdefl_sym_freq* t = pCur_syms; pCur_syms = pNew_syms; pNew_syms = t; }
- }
- return pCur_syms;
-}
-
-// tdefl_calculate_minimum_redundancy() originally written by: Alistair Moffat, alistair@cs.mu.oz.au, Jyrki Katajainen, jyrki@diku.dk, November 1996.
-static void tdefl_calculate_minimum_redundancy(tdefl_sym_freq *A, int n)
-{
- int root, leaf, next, avbl, used, dpth;
- if (n==0) return; else if (n==1) { A[0].m_key = 1; return; }
- A[0].m_key += A[1].m_key; root = 0; leaf = 2;
- for (next=1; next < n-1; next++)
- {
- if (leaf>=n || A[root].m_key<A[leaf].m_key) { A[next].m_key = A[root].m_key; A[root++].m_key = (mz_uint16)next; } else A[next].m_key = A[leaf++].m_key;
- if (leaf>=n || (root<next && A[root].m_key<A[leaf].m_key)) { A[next].m_key = (mz_uint16)(A[next].m_key + A[root].m_key); A[root++].m_key = (mz_uint16)next; } else A[next].m_key = (mz_uint16)(A[next].m_key + A[leaf++].m_key);
- }
- A[n-2].m_key = 0; for (next=n-3; next>=0; next--) A[next].m_key = A[A[next].m_key].m_key+1;
- avbl = 1; used = dpth = 0; root = n-2; next = n-1;
- while (avbl>0)
- {
- while (root>=0 && (int)A[root].m_key==dpth) { used++; root--; }
- while (avbl>used) { A[next--].m_key = (mz_uint16)(dpth); avbl--; }
- avbl = 2*used; dpth++; used = 0;
- }
-}
-
-// Limits canonical Huffman code table's max code size.
-enum { TDEFL_MAX_SUPPORTED_HUFF_CODESIZE = 32 };
-static void tdefl_huffman_enforce_max_code_size(int *pNum_codes, int code_list_len, int max_code_size)
-{
- int i; mz_uint32 total = 0; if (code_list_len <= 1) return;
- for (i = max_code_size + 1; i <= TDEFL_MAX_SUPPORTED_HUFF_CODESIZE; i++) pNum_codes[max_code_size] += pNum_codes[i];
- for (i = max_code_size; i > 0; i--) total += (((mz_uint32)pNum_codes[i]) << (max_code_size - i));
- while (total != (1UL << max_code_size))
- {
- pNum_codes[max_code_size]--;
- for (i = max_code_size - 1; i > 0; i--) if (pNum_codes[i]) { pNum_codes[i]--; pNum_codes[i + 1] += 2; break; }
- total--;
- }
-}
-
-static void tdefl_optimize_huffman_table(tdefl_compressor *d, int table_num, int table_len, int code_size_limit, int static_table)
-{
- int i, j, l, num_codes[1 + TDEFL_MAX_SUPPORTED_HUFF_CODESIZE]; mz_uint next_code[TDEFL_MAX_SUPPORTED_HUFF_CODESIZE + 1]; MZ_CLEAR_OBJ(num_codes);
- if (static_table)
- {
- for (i = 0; i < table_len; i++) num_codes[d->m_huff_code_sizes[table_num][i]]++;
- }
- else
- {
- tdefl_sym_freq syms0[TDEFL_MAX_HUFF_SYMBOLS], syms1[TDEFL_MAX_HUFF_SYMBOLS], *pSyms;
- int num_used_syms = 0;
- const mz_uint16 *pSym_count = &d->m_huff_count[table_num][0];
- for (i = 0; i < table_len; i++) if (pSym_count[i]) { syms0[num_used_syms].m_key = (mz_uint16)pSym_count[i]; syms0[num_used_syms++].m_sym_index = (mz_uint16)i; }
-
- pSyms = tdefl_radix_sort_syms(num_used_syms, syms0, syms1); tdefl_calculate_minimum_redundancy(pSyms, num_used_syms);
-
- for (i = 0; i < num_used_syms; i++) num_codes[pSyms[i].m_key]++;
-
- tdefl_huffman_enforce_max_code_size(num_codes, num_used_syms, code_size_limit);
-
- MZ_CLEAR_OBJ(d->m_huff_code_sizes[table_num]); MZ_CLEAR_OBJ(d->m_huff_codes[table_num]);
- for (i = 1, j = num_used_syms; i <= code_size_limit; i++)
- for (l = num_codes[i]; l > 0; l--) d->m_huff_code_sizes[table_num][pSyms[--j].m_sym_index] = (mz_uint8)(i);
- }
-
- next_code[1] = 0; for (j = 0, i = 2; i <= code_size_limit; i++) next_code[i] = j = ((j + num_codes[i - 1]) << 1);
-
- for (i = 0; i < table_len; i++)
- {
- mz_uint rev_code = 0, code, code_size; if ((code_size = d->m_huff_code_sizes[table_num][i]) == 0) continue;
- code = next_code[code_size]++; for (l = code_size; l > 0; l--, code >>= 1) rev_code = (rev_code << 1) | (code & 1);
- d->m_huff_codes[table_num][i] = (mz_uint16)rev_code;
- }
-}
-
-#define TDEFL_PUT_BITS(b, l) do { \
- mz_uint bits = b; mz_uint len = l; MZ_ASSERT(bits <= ((1U << len) - 1U)); \
- d->m_bit_buffer |= (bits << d->m_bits_in); d->m_bits_in += len; \
- while (d->m_bits_in >= 8) { \
- if (d->m_pOutput_buf < d->m_pOutput_buf_end) \
- *d->m_pOutput_buf++ = (mz_uint8)(d->m_bit_buffer); \
- d->m_bit_buffer >>= 8; \
- d->m_bits_in -= 8; \
- } \
-} MZ_MACRO_END
-
-#define TDEFL_RLE_PREV_CODE_SIZE() { if (rle_repeat_count) { \
- if (rle_repeat_count < 3) { \
- d->m_huff_count[2][prev_code_size] = (mz_uint16)(d->m_huff_count[2][prev_code_size] + rle_repeat_count); \
- while (rle_repeat_count--) packed_code_sizes[num_packed_code_sizes++] = prev_code_size; \
- } else { \
- d->m_huff_count[2][16] = (mz_uint16)(d->m_huff_count[2][16] + 1); packed_code_sizes[num_packed_code_sizes++] = 16; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_repeat_count - 3); \
-} rle_repeat_count = 0; } }
-
-#define TDEFL_RLE_ZERO_CODE_SIZE() { if (rle_z_count) { \
- if (rle_z_count < 3) { \
- d->m_huff_count[2][0] = (mz_uint16)(d->m_huff_count[2][0] + rle_z_count); while (rle_z_count--) packed_code_sizes[num_packed_code_sizes++] = 0; \
- } else if (rle_z_count <= 10) { \
- d->m_huff_count[2][17] = (mz_uint16)(d->m_huff_count[2][17] + 1); packed_code_sizes[num_packed_code_sizes++] = 17; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_z_count - 3); \
- } else { \
- d->m_huff_count[2][18] = (mz_uint16)(d->m_huff_count[2][18] + 1); packed_code_sizes[num_packed_code_sizes++] = 18; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_z_count - 11); \
-} rle_z_count = 0; } }
-
-static mz_uint8 s_tdefl_packed_code_size_syms_swizzle[] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
-
-static void tdefl_start_dynamic_block(tdefl_compressor *d)
-{
- int num_lit_codes, num_dist_codes, num_bit_lengths; mz_uint i, total_code_sizes_to_pack, num_packed_code_sizes, rle_z_count, rle_repeat_count, packed_code_sizes_index;
- mz_uint8 code_sizes_to_pack[TDEFL_MAX_HUFF_SYMBOLS_0 + TDEFL_MAX_HUFF_SYMBOLS_1], packed_code_sizes[TDEFL_MAX_HUFF_SYMBOLS_0 + TDEFL_MAX_HUFF_SYMBOLS_1], prev_code_size = 0xFF;
-
- d->m_huff_count[0][256] = 1;
-
- tdefl_optimize_huffman_table(d, 0, TDEFL_MAX_HUFF_SYMBOLS_0, 15, MZ_FALSE);
- tdefl_optimize_huffman_table(d, 1, TDEFL_MAX_HUFF_SYMBOLS_1, 15, MZ_FALSE);
-
- for (num_lit_codes = 286; num_lit_codes > 257; num_lit_codes--) if (d->m_huff_code_sizes[0][num_lit_codes - 1]) break;
- for (num_dist_codes = 30; num_dist_codes > 1; num_dist_codes--) if (d->m_huff_code_sizes[1][num_dist_codes - 1]) break;
-
- memcpy(code_sizes_to_pack, &d->m_huff_code_sizes[0][0], num_lit_codes);
- memcpy(code_sizes_to_pack + num_lit_codes, &d->m_huff_code_sizes[1][0], num_dist_codes);
- total_code_sizes_to_pack = num_lit_codes + num_dist_codes; num_packed_code_sizes = 0; rle_z_count = 0; rle_repeat_count = 0;
-
- memset(&d->m_huff_count[2][0], 0, sizeof(d->m_huff_count[2][0]) * TDEFL_MAX_HUFF_SYMBOLS_2);
- for (i = 0; i < total_code_sizes_to_pack; i++)
- {
- mz_uint8 code_size = code_sizes_to_pack[i];
- if (!code_size)
- {
- TDEFL_RLE_PREV_CODE_SIZE();
- if (++rle_z_count == 138) { TDEFL_RLE_ZERO_CODE_SIZE(); }
- }
- else
- {
- TDEFL_RLE_ZERO_CODE_SIZE();
- if (code_size != prev_code_size)
- {
- TDEFL_RLE_PREV_CODE_SIZE();
- d->m_huff_count[2][code_size] = (mz_uint16)(d->m_huff_count[2][code_size] + 1); packed_code_sizes[num_packed_code_sizes++] = code_size;
- }
- else if (++rle_repeat_count == 6)
- {
- TDEFL_RLE_PREV_CODE_SIZE();
- }
- }
- prev_code_size = code_size;
- }
- if (rle_repeat_count) { TDEFL_RLE_PREV_CODE_SIZE(); } else { TDEFL_RLE_ZERO_CODE_SIZE(); }
-
- tdefl_optimize_huffman_table(d, 2, TDEFL_MAX_HUFF_SYMBOLS_2, 7, MZ_FALSE);
-
- TDEFL_PUT_BITS(2, 2);
-
- TDEFL_PUT_BITS(num_lit_codes - 257, 5);
- TDEFL_PUT_BITS(num_dist_codes - 1, 5);
-
- for (num_bit_lengths = 18; num_bit_lengths >= 0; num_bit_lengths--) if (d->m_huff_code_sizes[2][s_tdefl_packed_code_size_syms_swizzle[num_bit_lengths]]) break;
- num_bit_lengths = MZ_MAX(4, (num_bit_lengths + 1)); TDEFL_PUT_BITS(num_bit_lengths - 4, 4);
- for (i = 0; (int)i < num_bit_lengths; i++) TDEFL_PUT_BITS(d->m_huff_code_sizes[2][s_tdefl_packed_code_size_syms_swizzle[i]], 3);
-
- for (packed_code_sizes_index = 0; packed_code_sizes_index < num_packed_code_sizes; )
- {
- mz_uint code = packed_code_sizes[packed_code_sizes_index++]; MZ_ASSERT(code < TDEFL_MAX_HUFF_SYMBOLS_2);
- TDEFL_PUT_BITS(d->m_huff_codes[2][code], d->m_huff_code_sizes[2][code]);
- if (code >= 16) TDEFL_PUT_BITS(packed_code_sizes[packed_code_sizes_index++], "\02\03\07"[code - 16]);
- }
-}
-
-static void tdefl_start_static_block(tdefl_compressor *d)
-{
- mz_uint i;
- mz_uint8 *p = &d->m_huff_code_sizes[0][0];
-
- for (i = 0; i <= 143; ++i) *p++ = 8;
- for ( ; i <= 255; ++i) *p++ = 9;
- for ( ; i <= 279; ++i) *p++ = 7;
- for ( ; i <= 287; ++i) *p++ = 8;
-
- memset(d->m_huff_code_sizes[1], 5, 32);
-
- tdefl_optimize_huffman_table(d, 0, 288, 15, MZ_TRUE);
- tdefl_optimize_huffman_table(d, 1, 32, 15, MZ_TRUE);
-
- TDEFL_PUT_BITS(1, 2);
-}
-
-static const mz_uint mz_bitmasks[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
-
-#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && MINIZ_HAS_64BIT_REGISTERS
-static mz_bool tdefl_compress_lz_codes(tdefl_compressor *d)
-{
- mz_uint flags;
- mz_uint8 *pLZ_codes;
- mz_uint8 *pOutput_buf = d->m_pOutput_buf;
- mz_uint8 *pLZ_code_buf_end = d->m_pLZ_code_buf;
- mz_uint64 bit_buffer = d->m_bit_buffer;
- mz_uint bits_in = d->m_bits_in;
-
-#define TDEFL_PUT_BITS_FAST(b, l) { bit_buffer |= (((mz_uint64)(b)) << bits_in); bits_in += (l); }
-
- flags = 1;
- for (pLZ_codes = d->m_lz_code_buf; pLZ_codes < pLZ_code_buf_end; flags >>= 1)
- {
- if (flags == 1)
- flags = *pLZ_codes++ | 0x100;
-
- if (flags & 1)
- {
- mz_uint s0, s1, n0, n1, sym, num_extra_bits;
- mz_uint match_len = pLZ_codes[0], match_dist = *(const mz_uint16 *)(pLZ_codes + 1); pLZ_codes += 3;
-
- MZ_ASSERT(d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]);
- TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][s_tdefl_len_sym[match_len]], d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]);
- TDEFL_PUT_BITS_FAST(match_len & mz_bitmasks[s_tdefl_len_extra[match_len]], s_tdefl_len_extra[match_len]);
-
- // This sequence coaxes MSVC into using cmov's vs. jmp's.
- s0 = s_tdefl_small_dist_sym[match_dist & 511];
- n0 = s_tdefl_small_dist_extra[match_dist & 511];
- s1 = s_tdefl_large_dist_sym[match_dist >> 8];
- n1 = s_tdefl_large_dist_extra[match_dist >> 8];
- sym = (match_dist < 512) ? s0 : s1;
- num_extra_bits = (match_dist < 512) ? n0 : n1;
-
- MZ_ASSERT(d->m_huff_code_sizes[1][sym]);
- TDEFL_PUT_BITS_FAST(d->m_huff_codes[1][sym], d->m_huff_code_sizes[1][sym]);
- TDEFL_PUT_BITS_FAST(match_dist & mz_bitmasks[num_extra_bits], num_extra_bits);
- }
- else
- {
- mz_uint lit = *pLZ_codes++;
- MZ_ASSERT(d->m_huff_code_sizes[0][lit]);
- TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]);
-
- if (((flags & 2) == 0) && (pLZ_codes < pLZ_code_buf_end))
- {
- flags >>= 1;
- lit = *pLZ_codes++;
- MZ_ASSERT(d->m_huff_code_sizes[0][lit]);
- TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]);
-
- if (((flags & 2) == 0) && (pLZ_codes < pLZ_code_buf_end))
- {
- flags >>= 1;
- lit = *pLZ_codes++;
- MZ_ASSERT(d->m_huff_code_sizes[0][lit]);
- TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]);
- }
- }
- }
-
- if (pOutput_buf >= d->m_pOutput_buf_end)
- return MZ_FALSE;
-
- *(mz_uint64*)pOutput_buf = bit_buffer;
- pOutput_buf += (bits_in >> 3);
- bit_buffer >>= (bits_in & ~7);
- bits_in &= 7;
- }
-
-#undef TDEFL_PUT_BITS_FAST
-
- d->m_pOutput_buf = pOutput_buf;
- d->m_bits_in = 0;
- d->m_bit_buffer = 0;
-
- while (bits_in)
- {
- mz_uint32 n = MZ_MIN(bits_in, 16);
- TDEFL_PUT_BITS((mz_uint)bit_buffer & mz_bitmasks[n], n);
- bit_buffer >>= n;
- bits_in -= n;
- }
-
- TDEFL_PUT_BITS(d->m_huff_codes[0][256], d->m_huff_code_sizes[0][256]);
-
- return (d->m_pOutput_buf < d->m_pOutput_buf_end);
-}
-#else
-static mz_bool tdefl_compress_lz_codes(tdefl_compressor *d)
-{
- mz_uint flags;
- mz_uint8 *pLZ_codes;
-
- flags = 1;
- for (pLZ_codes = d->m_lz_code_buf; pLZ_codes < d->m_pLZ_code_buf; flags >>= 1)
- {
- if (flags == 1)
- flags = *pLZ_codes++ | 0x100;
- if (flags & 1)
- {
- mz_uint sym, num_extra_bits;
- mz_uint match_len = pLZ_codes[0], match_dist = (pLZ_codes[1] | (pLZ_codes[2] << 8)); pLZ_codes += 3;
-
- MZ_ASSERT(d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]);
- TDEFL_PUT_BITS(d->m_huff_codes[0][s_tdefl_len_sym[match_len]], d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]);
- TDEFL_PUT_BITS(match_len & mz_bitmasks[s_tdefl_len_extra[match_len]], s_tdefl_len_extra[match_len]);
-
- if (match_dist < 512)
- {
- sym = s_tdefl_small_dist_sym[match_dist]; num_extra_bits = s_tdefl_small_dist_extra[match_dist];
- }
- else
- {
- sym = s_tdefl_large_dist_sym[match_dist >> 8]; num_extra_bits = s_tdefl_large_dist_extra[match_dist >> 8];
- }
- MZ_ASSERT(d->m_huff_code_sizes[1][sym]);
- TDEFL_PUT_BITS(d->m_huff_codes[1][sym], d->m_huff_code_sizes[1][sym]);
- TDEFL_PUT_BITS(match_dist & mz_bitmasks[num_extra_bits], num_extra_bits);
- }
- else
- {
- mz_uint lit = *pLZ_codes++;
- MZ_ASSERT(d->m_huff_code_sizes[0][lit]);
- TDEFL_PUT_BITS(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]);
- }
- }
-
- TDEFL_PUT_BITS(d->m_huff_codes[0][256], d->m_huff_code_sizes[0][256]);
-
- return (d->m_pOutput_buf < d->m_pOutput_buf_end);
-}
-#endif // MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && MINIZ_HAS_64BIT_REGISTERS
-
-static mz_bool tdefl_compress_block(tdefl_compressor *d, mz_bool static_block)
-{
- if (static_block)
- tdefl_start_static_block(d);
- else
- tdefl_start_dynamic_block(d);
- return tdefl_compress_lz_codes(d);
-}
-
-static int tdefl_flush_block(tdefl_compressor *d, int flush)
-{
- mz_uint saved_bit_buf, saved_bits_in;
- mz_uint8 *pSaved_output_buf;
- mz_bool comp_block_succeeded = MZ_FALSE;
- int n, use_raw_block = ((d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS) != 0) && (d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size;
- mz_uint8 *pOutput_buf_start = ((d->m_pPut_buf_func == NULL) && ((*d->m_pOut_buf_size - d->m_out_buf_ofs) >= TDEFL_OUT_BUF_SIZE)) ? ((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs) : d->m_output_buf;
-
- d->m_pOutput_buf = pOutput_buf_start;
- d->m_pOutput_buf_end = d->m_pOutput_buf + TDEFL_OUT_BUF_SIZE - 16;
-
- MZ_ASSERT(!d->m_output_flush_remaining);
- d->m_output_flush_ofs = 0;
- d->m_output_flush_remaining = 0;
-
- *d->m_pLZ_flags = (mz_uint8)(*d->m_pLZ_flags >> d->m_num_flags_left);
- d->m_pLZ_code_buf -= (d->m_num_flags_left == 8);
-
- if ((d->m_flags & TDEFL_WRITE_ZLIB_HEADER) && (!d->m_block_index))
- {
- TDEFL_PUT_BITS(0x78, 8); TDEFL_PUT_BITS(0x01, 8);
- }
-
- TDEFL_PUT_BITS(flush == TDEFL_FINISH, 1);
-
- pSaved_output_buf = d->m_pOutput_buf; saved_bit_buf = d->m_bit_buffer; saved_bits_in = d->m_bits_in;
-
- if (!use_raw_block)
- comp_block_succeeded = tdefl_compress_block(d, (d->m_flags & TDEFL_FORCE_ALL_STATIC_BLOCKS) || (d->m_total_lz_bytes < 48));
-
- // If the block gets expanded, forget the current contents of the output buffer and send a raw block instead.
- if ( ((use_raw_block) || ((d->m_total_lz_bytes) && ((d->m_pOutput_buf - pSaved_output_buf + 1U) >= d->m_total_lz_bytes))) &&
- ((d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size) )
- {
- mz_uint i; d->m_pOutput_buf = pSaved_output_buf; d->m_bit_buffer = saved_bit_buf, d->m_bits_in = saved_bits_in;
- TDEFL_PUT_BITS(0, 2);
- if (d->m_bits_in) { TDEFL_PUT_BITS(0, 8 - d->m_bits_in); }
- for (i = 2; i; --i, d->m_total_lz_bytes ^= 0xFFFF)
- {
- TDEFL_PUT_BITS(d->m_total_lz_bytes & 0xFFFF, 16);
- }
- for (i = 0; i < d->m_total_lz_bytes; ++i)
- {
- TDEFL_PUT_BITS(d->m_dict[(d->m_lz_code_buf_dict_pos + i) & TDEFL_LZ_DICT_SIZE_MASK], 8);
- }
- }
- // Check for the extremely unlikely (if not impossible) case of the compressed block not fitting into the output buffer when using dynamic codes.
- else if (!comp_block_succeeded)
- {
- d->m_pOutput_buf = pSaved_output_buf; d->m_bit_buffer = saved_bit_buf, d->m_bits_in = saved_bits_in;
- tdefl_compress_block(d, MZ_TRUE);
- }
-
- if (flush)
- {
- if (flush == TDEFL_FINISH)
- {
- if (d->m_bits_in) { TDEFL_PUT_BITS(0, 8 - d->m_bits_in); }
- if (d->m_flags & TDEFL_WRITE_ZLIB_HEADER) { mz_uint i, a = d->m_adler32; for (i = 0; i < 4; i++) { TDEFL_PUT_BITS((a >> 24) & 0xFF, 8); a <<= 8; } }
- }
- else
- {
- mz_uint i, z = 0; TDEFL_PUT_BITS(0, 3); if (d->m_bits_in) { TDEFL_PUT_BITS(0, 8 - d->m_bits_in); } for (i = 2; i; --i, z ^= 0xFFFF) { TDEFL_PUT_BITS(z & 0xFFFF, 16); }
- }
- }
-
- MZ_ASSERT(d->m_pOutput_buf < d->m_pOutput_buf_end);
-
- memset(&d->m_huff_count[0][0], 0, sizeof(d->m_huff_count[0][0]) * TDEFL_MAX_HUFF_SYMBOLS_0);
- memset(&d->m_huff_count[1][0], 0, sizeof(d->m_huff_count[1][0]) * TDEFL_MAX_HUFF_SYMBOLS_1);
-
- d->m_pLZ_code_buf = d->m_lz_code_buf + 1; d->m_pLZ_flags = d->m_lz_code_buf; d->m_num_flags_left = 8; d->m_lz_code_buf_dict_pos += d->m_total_lz_bytes; d->m_total_lz_bytes = 0; d->m_block_index++;
-
- if ((n = (int)(d->m_pOutput_buf - pOutput_buf_start)) != 0)
- {
- if (d->m_pPut_buf_func)
- {
- *d->m_pIn_buf_size = d->m_pSrc - (const mz_uint8 *)d->m_pIn_buf;
- if (!(*d->m_pPut_buf_func)(d->m_output_buf, n, d->m_pPut_buf_user))
- return (d->m_prev_return_status = TDEFL_STATUS_PUT_BUF_FAILED);
- }
- else if (pOutput_buf_start == d->m_output_buf)
- {
- int bytes_to_copy = (int)MZ_MIN((size_t)n, (size_t)(*d->m_pOut_buf_size - d->m_out_buf_ofs));
- memcpy((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs, d->m_output_buf, bytes_to_copy);
- d->m_out_buf_ofs += bytes_to_copy;
- if ((n -= bytes_to_copy) != 0)
- {
- d->m_output_flush_ofs = bytes_to_copy;
- d->m_output_flush_remaining = n;
- }
- }
- else
- {
- d->m_out_buf_ofs += n;
- }
- }
-
- return d->m_output_flush_remaining;
-}
-
-#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES
-#define TDEFL_READ_UNALIGNED_WORD(p) *(const mz_uint16*)(p)
-static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahead_pos, mz_uint max_dist, mz_uint max_match_len, mz_uint *pMatch_dist, mz_uint *pMatch_len)
-{
- mz_uint dist, pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK, match_len = *pMatch_len, probe_pos = pos, next_probe_pos, probe_len;
- mz_uint num_probes_left = d->m_max_probes[match_len >= 32];
- const mz_uint16 *s = (const mz_uint16*)(d->m_dict + pos), *p, *q;
- mz_uint16 c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]), s01 = TDEFL_READ_UNALIGNED_WORD(s);
- MZ_ASSERT(max_match_len <= TDEFL_MAX_MATCH_LEN); if (max_match_len <= match_len) return;
- for ( ; ; )
- {
- for ( ; ; )
- {
- if (--num_probes_left == 0) return;
- #define TDEFL_PROBE \
- next_probe_pos = d->m_next[probe_pos]; \
- if ((!next_probe_pos) || ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) return; \
- probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \
- if (TDEFL_READ_UNALIGNED_WORD(&d->m_dict[probe_pos + match_len - 1]) == c01) break;
- TDEFL_PROBE; TDEFL_PROBE; TDEFL_PROBE;
- }
- if (!dist) break; q = (const mz_uint16*)(d->m_dict + probe_pos); if (TDEFL_READ_UNALIGNED_WORD(q) != s01) continue; p = s; probe_len = 32;
- do { } while ( (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) &&
- (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (--probe_len > 0) );
- if (!probe_len)
- {
- *pMatch_dist = dist; *pMatch_len = MZ_MIN(max_match_len, TDEFL_MAX_MATCH_LEN); break;
- }
- else if ((probe_len = ((mz_uint)(p - s) * 2) + (mz_uint)(*(const mz_uint8*)p == *(const mz_uint8*)q)) > match_len)
- {
- *pMatch_dist = dist; if ((*pMatch_len = match_len = MZ_MIN(max_match_len, probe_len)) == max_match_len) break;
- c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]);
- }
- }
-}
-#else
-static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahead_pos, mz_uint max_dist, mz_uint max_match_len, mz_uint *pMatch_dist, mz_uint *pMatch_len)
-{
- mz_uint dist, pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK, match_len = *pMatch_len, probe_pos = pos, next_probe_pos, probe_len;
- mz_uint num_probes_left = d->m_max_probes[match_len >= 32];
- const mz_uint8 *s = d->m_dict + pos, *p, *q;
- mz_uint8 c0 = d->m_dict[pos + match_len], c1 = d->m_dict[pos + match_len - 1];
- MZ_ASSERT(max_match_len <= TDEFL_MAX_MATCH_LEN); if (max_match_len <= match_len) return;
- for ( ; ; )
- {
- for ( ; ; )
- {
- if (--num_probes_left == 0) return;
- #define TDEFL_PROBE \
- next_probe_pos = d->m_next[probe_pos]; \
- if ((!next_probe_pos) || ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) return; \
- probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \
- if ((d->m_dict[probe_pos + match_len] == c0) && (d->m_dict[probe_pos + match_len - 1] == c1)) break;
- TDEFL_PROBE; TDEFL_PROBE; TDEFL_PROBE;
- }
- if (!dist) break; p = s; q = d->m_dict + probe_pos; for (probe_len = 0; probe_len < max_match_len; probe_len++) if (*p++ != *q++) break;
- if (probe_len > match_len)
- {
- *pMatch_dist = dist; if ((*pMatch_len = match_len = probe_len) == max_match_len) return;
- c0 = d->m_dict[pos + match_len]; c1 = d->m_dict[pos + match_len - 1];
- }
- }
-}
-#endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES
-
-#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
-static mz_bool tdefl_compress_fast(tdefl_compressor *d)
-{
- // Faster, minimally featured LZRW1-style match+parse loop with better register utilization. Intended for applications where raw throughput is valued more highly than ratio.
- mz_uint lookahead_pos = d->m_lookahead_pos, lookahead_size = d->m_lookahead_size, dict_size = d->m_dict_size, total_lz_bytes = d->m_total_lz_bytes, num_flags_left = d->m_num_flags_left;
- mz_uint8 *pLZ_code_buf = d->m_pLZ_code_buf, *pLZ_flags = d->m_pLZ_flags;
- mz_uint cur_pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK;
-
- while ((d->m_src_buf_left) || ((d->m_flush) && (lookahead_size)))
- {
- const mz_uint TDEFL_COMP_FAST_LOOKAHEAD_SIZE = 4096;
- mz_uint dst_pos = (lookahead_pos + lookahead_size) & TDEFL_LZ_DICT_SIZE_MASK;
- mz_uint num_bytes_to_process = (mz_uint)MZ_MIN(d->m_src_buf_left, TDEFL_COMP_FAST_LOOKAHEAD_SIZE - lookahead_size);
- d->m_src_buf_left -= num_bytes_to_process;
- lookahead_size += num_bytes_to_process;
-
- while (num_bytes_to_process)
- {
- mz_uint32 n = MZ_MIN(TDEFL_LZ_DICT_SIZE - dst_pos, num_bytes_to_process);
- memcpy(d->m_dict + dst_pos, d->m_pSrc, n);
- if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1))
- memcpy(d->m_dict + TDEFL_LZ_DICT_SIZE + dst_pos, d->m_pSrc, MZ_MIN(n, (TDEFL_MAX_MATCH_LEN - 1) - dst_pos));
- d->m_pSrc += n;
- dst_pos = (dst_pos + n) & TDEFL_LZ_DICT_SIZE_MASK;
- num_bytes_to_process -= n;
- }
-
- dict_size = MZ_MIN(TDEFL_LZ_DICT_SIZE - lookahead_size, dict_size);
- if ((!d->m_flush) && (lookahead_size < TDEFL_COMP_FAST_LOOKAHEAD_SIZE)) break;
-
- while (lookahead_size >= 4)
- {
- mz_uint cur_match_dist, cur_match_len = 1;
- mz_uint8 *pCur_dict = d->m_dict + cur_pos;
- mz_uint first_trigram = (*(const mz_uint32 *)pCur_dict) & 0xFFFFFF;
- mz_uint hash = (first_trigram ^ (first_trigram >> (24 - (TDEFL_LZ_HASH_BITS - 8)))) & TDEFL_LEVEL1_HASH_SIZE_MASK;
- mz_uint probe_pos = d->m_hash[hash];
- d->m_hash[hash] = (mz_uint16)lookahead_pos;
-
- if (((cur_match_dist = (mz_uint16)(lookahead_pos - probe_pos)) <= dict_size) && ((*(const mz_uint32 *)(d->m_dict + (probe_pos &= TDEFL_LZ_DICT_SIZE_MASK)) & 0xFFFFFF) == first_trigram))
- {
- const mz_uint16 *p = (const mz_uint16 *)pCur_dict;
- const mz_uint16 *q = (const mz_uint16 *)(d->m_dict + probe_pos);
- mz_uint32 probe_len = 32;
- do { } while ( (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) &&
- (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (--probe_len > 0) );
- cur_match_len = ((mz_uint)(p - (const mz_uint16 *)pCur_dict) * 2) + (mz_uint)(*(const mz_uint8 *)p == *(const mz_uint8 *)q);
- if (!probe_len)
- cur_match_len = cur_match_dist ? TDEFL_MAX_MATCH_LEN : 0;
-
- if ((cur_match_len < TDEFL_MIN_MATCH_LEN) || ((cur_match_len == TDEFL_MIN_MATCH_LEN) && (cur_match_dist >= 8U*1024U)))
- {
- cur_match_len = 1;
- *pLZ_code_buf++ = (mz_uint8)first_trigram;
- *pLZ_flags = (mz_uint8)(*pLZ_flags >> 1);
- d->m_huff_count[0][(mz_uint8)first_trigram]++;
- }
- else
- {
- mz_uint32 s0, s1;
- cur_match_len = MZ_MIN(cur_match_len, lookahead_size);
-
- MZ_ASSERT((cur_match_len >= TDEFL_MIN_MATCH_LEN) && (cur_match_dist >= 1) && (cur_match_dist <= TDEFL_LZ_DICT_SIZE));
-
- cur_match_dist--;
-
- pLZ_code_buf[0] = (mz_uint8)(cur_match_len - TDEFL_MIN_MATCH_LEN);
- *(mz_uint16 *)(&pLZ_code_buf[1]) = (mz_uint16)cur_match_dist;
- pLZ_code_buf += 3;
- *pLZ_flags = (mz_uint8)((*pLZ_flags >> 1) | 0x80);
-
- s0 = s_tdefl_small_dist_sym[cur_match_dist & 511];
- s1 = s_tdefl_large_dist_sym[cur_match_dist >> 8];
- d->m_huff_count[1][(cur_match_dist < 512) ? s0 : s1]++;
-
- d->m_huff_count[0][s_tdefl_len_sym[cur_match_len - TDEFL_MIN_MATCH_LEN]]++;
- }
- }
- else
- {
- *pLZ_code_buf++ = (mz_uint8)first_trigram;
- *pLZ_flags = (mz_uint8)(*pLZ_flags >> 1);
- d->m_huff_count[0][(mz_uint8)first_trigram]++;
- }
-
- if (--num_flags_left == 0) { num_flags_left = 8; pLZ_flags = pLZ_code_buf++; }
-
- total_lz_bytes += cur_match_len;
- lookahead_pos += cur_match_len;
- dict_size = MZ_MIN(dict_size + cur_match_len, TDEFL_LZ_DICT_SIZE);
- cur_pos = (cur_pos + cur_match_len) & TDEFL_LZ_DICT_SIZE_MASK;
- MZ_ASSERT(lookahead_size >= cur_match_len);
- lookahead_size -= cur_match_len;
-
- if (pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8])
- {
- int n;
- d->m_lookahead_pos = lookahead_pos; d->m_lookahead_size = lookahead_size; d->m_dict_size = dict_size;
- d->m_total_lz_bytes = total_lz_bytes; d->m_pLZ_code_buf = pLZ_code_buf; d->m_pLZ_flags = pLZ_flags; d->m_num_flags_left = num_flags_left;
- if ((n = tdefl_flush_block(d, 0)) != 0)
- return (n < 0) ? MZ_FALSE : MZ_TRUE;
- total_lz_bytes = d->m_total_lz_bytes; pLZ_code_buf = d->m_pLZ_code_buf; pLZ_flags = d->m_pLZ_flags; num_flags_left = d->m_num_flags_left;
- }
- }
-
- while (lookahead_size)
- {
- mz_uint8 lit = d->m_dict[cur_pos];
-
- total_lz_bytes++;
- *pLZ_code_buf++ = lit;
- *pLZ_flags = (mz_uint8)(*pLZ_flags >> 1);
- if (--num_flags_left == 0) { num_flags_left = 8; pLZ_flags = pLZ_code_buf++; }
-
- d->m_huff_count[0][lit]++;
-
- lookahead_pos++;
- dict_size = MZ_MIN(dict_size + 1, TDEFL_LZ_DICT_SIZE);
- cur_pos = (cur_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK;
- lookahead_size--;
-
- if (pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8])
- {
- int n;
- d->m_lookahead_pos = lookahead_pos; d->m_lookahead_size = lookahead_size; d->m_dict_size = dict_size;
- d->m_total_lz_bytes = total_lz_bytes; d->m_pLZ_code_buf = pLZ_code_buf; d->m_pLZ_flags = pLZ_flags; d->m_num_flags_left = num_flags_left;
- if ((n = tdefl_flush_block(d, 0)) != 0)
- return (n < 0) ? MZ_FALSE : MZ_TRUE;
- total_lz_bytes = d->m_total_lz_bytes; pLZ_code_buf = d->m_pLZ_code_buf; pLZ_flags = d->m_pLZ_flags; num_flags_left = d->m_num_flags_left;
- }
- }
- }
-
- d->m_lookahead_pos = lookahead_pos; d->m_lookahead_size = lookahead_size; d->m_dict_size = dict_size;
- d->m_total_lz_bytes = total_lz_bytes; d->m_pLZ_code_buf = pLZ_code_buf; d->m_pLZ_flags = pLZ_flags; d->m_num_flags_left = num_flags_left;
- return MZ_TRUE;
-}
-#endif // MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
-
-static MZ_FORCEINLINE void tdefl_record_literal(tdefl_compressor *d, mz_uint8 lit)
-{
- d->m_total_lz_bytes++;
- *d->m_pLZ_code_buf++ = lit;
- *d->m_pLZ_flags = (mz_uint8)(*d->m_pLZ_flags >> 1); if (--d->m_num_flags_left == 0) { d->m_num_flags_left = 8; d->m_pLZ_flags = d->m_pLZ_code_buf++; }
- d->m_huff_count[0][lit]++;
-}
-
-static MZ_FORCEINLINE void tdefl_record_match(tdefl_compressor *d, mz_uint match_len, mz_uint match_dist)
-{
- mz_uint32 s0, s1;
-
- MZ_ASSERT((match_len >= TDEFL_MIN_MATCH_LEN) && (match_dist >= 1) && (match_dist <= TDEFL_LZ_DICT_SIZE));
-
- d->m_total_lz_bytes += match_len;
-
- d->m_pLZ_code_buf[0] = (mz_uint8)(match_len - TDEFL_MIN_MATCH_LEN);
-
- match_dist -= 1;
- d->m_pLZ_code_buf[1] = (mz_uint8)(match_dist & 0xFF);
- d->m_pLZ_code_buf[2] = (mz_uint8)(match_dist >> 8); d->m_pLZ_code_buf += 3;
-
- *d->m_pLZ_flags = (mz_uint8)((*d->m_pLZ_flags >> 1) | 0x80); if (--d->m_num_flags_left == 0) { d->m_num_flags_left = 8; d->m_pLZ_flags = d->m_pLZ_code_buf++; }
-
- s0 = s_tdefl_small_dist_sym[match_dist & 511]; s1 = s_tdefl_large_dist_sym[(match_dist >> 8) & 127];
- d->m_huff_count[1][(match_dist < 512) ? s0 : s1]++;
-
- if (match_len >= TDEFL_MIN_MATCH_LEN) d->m_huff_count[0][s_tdefl_len_sym[match_len - TDEFL_MIN_MATCH_LEN]]++;
-}
-
-static mz_bool tdefl_compress_normal(tdefl_compressor *d)
-{
- const mz_uint8 *pSrc = d->m_pSrc; size_t src_buf_left = d->m_src_buf_left;
- tdefl_flush flush = d->m_flush;
-
- while ((src_buf_left) || ((flush) && (d->m_lookahead_size)))
- {
- mz_uint len_to_move, cur_match_dist, cur_match_len, cur_pos;
- // Update dictionary and hash chains. Keeps the lookahead size equal to TDEFL_MAX_MATCH_LEN.
- if ((d->m_lookahead_size + d->m_dict_size) >= (TDEFL_MIN_MATCH_LEN - 1))
- {
- mz_uint dst_pos = (d->m_lookahead_pos + d->m_lookahead_size) & TDEFL_LZ_DICT_SIZE_MASK, ins_pos = d->m_lookahead_pos + d->m_lookahead_size - 2;
- mz_uint hash = (d->m_dict[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] << TDEFL_LZ_HASH_SHIFT) ^ d->m_dict[(ins_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK];
- mz_uint num_bytes_to_process = (mz_uint)MZ_MIN(src_buf_left, TDEFL_MAX_MATCH_LEN - d->m_lookahead_size);
- const mz_uint8 *pSrc_end = pSrc + num_bytes_to_process;
- src_buf_left -= num_bytes_to_process;
- d->m_lookahead_size += num_bytes_to_process;
- while (pSrc != pSrc_end)
- {
- mz_uint8 c = *pSrc++; d->m_dict[dst_pos] = c; if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1)) d->m_dict[TDEFL_LZ_DICT_SIZE + dst_pos] = c;
- hash = ((hash << TDEFL_LZ_HASH_SHIFT) ^ c) & (TDEFL_LZ_HASH_SIZE - 1);
- d->m_next[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] = d->m_hash[hash]; d->m_hash[hash] = (mz_uint16)(ins_pos);
- dst_pos = (dst_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK; ins_pos++;
- }
- }
- else
- {
- while ((src_buf_left) && (d->m_lookahead_size < TDEFL_MAX_MATCH_LEN))
- {
- mz_uint8 c = *pSrc++;
- mz_uint dst_pos = (d->m_lookahead_pos + d->m_lookahead_size) & TDEFL_LZ_DICT_SIZE_MASK;
- src_buf_left--;
- d->m_dict[dst_pos] = c;
- if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1))
- d->m_dict[TDEFL_LZ_DICT_SIZE + dst_pos] = c;
- if ((++d->m_lookahead_size + d->m_dict_size) >= TDEFL_MIN_MATCH_LEN)
- {
- mz_uint ins_pos = d->m_lookahead_pos + (d->m_lookahead_size - 1) - 2;
- mz_uint hash = ((d->m_dict[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] << (TDEFL_LZ_HASH_SHIFT * 2)) ^ (d->m_dict[(ins_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK] << TDEFL_LZ_HASH_SHIFT) ^ c) & (TDEFL_LZ_HASH_SIZE - 1);
- d->m_next[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] = d->m_hash[hash]; d->m_hash[hash] = (mz_uint16)(ins_pos);
- }
- }
- }
- d->m_dict_size = MZ_MIN(TDEFL_LZ_DICT_SIZE - d->m_lookahead_size, d->m_dict_size);
- if ((!flush) && (d->m_lookahead_size < TDEFL_MAX_MATCH_LEN))
- break;
-
- // Simple lazy/greedy parsing state machine.
- len_to_move = 1; cur_match_dist = 0; cur_match_len = d->m_saved_match_len ? d->m_saved_match_len : (TDEFL_MIN_MATCH_LEN - 1); cur_pos = d->m_lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK;
- if (d->m_flags & (TDEFL_RLE_MATCHES | TDEFL_FORCE_ALL_RAW_BLOCKS))
- {
- if ((d->m_dict_size) && (!(d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS)))
- {
- mz_uint8 c = d->m_dict[(cur_pos - 1) & TDEFL_LZ_DICT_SIZE_MASK];
- cur_match_len = 0; while (cur_match_len < d->m_lookahead_size) { if (d->m_dict[cur_pos + cur_match_len] != c) break; cur_match_len++; }
- if (cur_match_len < TDEFL_MIN_MATCH_LEN) cur_match_len = 0; else cur_match_dist = 1;
- }
- }
- else
- {
- tdefl_find_match(d, d->m_lookahead_pos, d->m_dict_size, d->m_lookahead_size, &cur_match_dist, &cur_match_len);
- }
- if (((cur_match_len == TDEFL_MIN_MATCH_LEN) && (cur_match_dist >= 8U*1024U)) || (cur_pos == cur_match_dist) || ((d->m_flags & TDEFL_FILTER_MATCHES) && (cur_match_len <= 5)))
- {
- cur_match_dist = cur_match_len = 0;
- }
- if (d->m_saved_match_len)
- {
- if (cur_match_len > d->m_saved_match_len)
- {
- tdefl_record_literal(d, (mz_uint8)d->m_saved_lit);
- if (cur_match_len >= 128)
- {
- tdefl_record_match(d, cur_match_len, cur_match_dist);
- d->m_saved_match_len = 0; len_to_move = cur_match_len;
- }
- else
- {
- d->m_saved_lit = d->m_dict[cur_pos]; d->m_saved_match_dist = cur_match_dist; d->m_saved_match_len = cur_match_len;
- }
- }
- else
- {
- tdefl_record_match(d, d->m_saved_match_len, d->m_saved_match_dist);
- len_to_move = d->m_saved_match_len - 1; d->m_saved_match_len = 0;
- }
- }
- else if (!cur_match_dist)
- tdefl_record_literal(d, d->m_dict[MZ_MIN(cur_pos, sizeof(d->m_dict) - 1)]);
- else if ((d->m_greedy_parsing) || (d->m_flags & TDEFL_RLE_MATCHES) || (cur_match_len >= 128))
- {
- tdefl_record_match(d, cur_match_len, cur_match_dist);
- len_to_move = cur_match_len;
- }
- else
- {
- d->m_saved_lit = d->m_dict[MZ_MIN(cur_pos, sizeof(d->m_dict) - 1)]; d->m_saved_match_dist = cur_match_dist; d->m_saved_match_len = cur_match_len;
- }
- // Move the lookahead forward by len_to_move bytes.
- d->m_lookahead_pos += len_to_move;
- MZ_ASSERT(d->m_lookahead_size >= len_to_move);
- d->m_lookahead_size -= len_to_move;
- d->m_dict_size = MZ_MIN(d->m_dict_size + len_to_move, TDEFL_LZ_DICT_SIZE);
- // Check if it's time to flush the current LZ codes to the internal output buffer.
- if ( (d->m_pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8]) ||
- ( (d->m_total_lz_bytes > 31*1024) && (((((mz_uint)(d->m_pLZ_code_buf - d->m_lz_code_buf) * 115) >> 7) >= d->m_total_lz_bytes) || (d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS))) )
- {
- int n;
- d->m_pSrc = pSrc; d->m_src_buf_left = src_buf_left;
- if ((n = tdefl_flush_block(d, 0)) != 0)
- return (n < 0) ? MZ_FALSE : MZ_TRUE;
- }
- }
-
- d->m_pSrc = pSrc; d->m_src_buf_left = src_buf_left;
- return MZ_TRUE;
-}
-
-static tdefl_status tdefl_flush_output_buffer(tdefl_compressor *d)
-{
- if (d->m_pIn_buf_size)
- {
- *d->m_pIn_buf_size = d->m_pSrc - (const mz_uint8 *)d->m_pIn_buf;
- }
-
- if (d->m_pOut_buf_size)
- {
- size_t n = MZ_MIN(*d->m_pOut_buf_size - d->m_out_buf_ofs, d->m_output_flush_remaining);
- memcpy((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs, d->m_output_buf + d->m_output_flush_ofs, n);
- d->m_output_flush_ofs += (mz_uint)n;
- d->m_output_flush_remaining -= (mz_uint)n;
- d->m_out_buf_ofs += n;
-
- *d->m_pOut_buf_size = d->m_out_buf_ofs;
- }
-
- return (d->m_finished && !d->m_output_flush_remaining) ? TDEFL_STATUS_DONE : TDEFL_STATUS_OKAY;
-}
-
-tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pIn_buf_size, void *pOut_buf, size_t *pOut_buf_size, tdefl_flush flush)
-{
- if (!d)
- {
- if (pIn_buf_size) *pIn_buf_size = 0;
- if (pOut_buf_size) *pOut_buf_size = 0;
- return TDEFL_STATUS_BAD_PARAM;
- }
-
- d->m_pIn_buf = pIn_buf; d->m_pIn_buf_size = pIn_buf_size;
- d->m_pOut_buf = pOut_buf; d->m_pOut_buf_size = pOut_buf_size;
- d->m_pSrc = (const mz_uint8 *)(pIn_buf); d->m_src_buf_left = pIn_buf_size ? *pIn_buf_size : 0;
- d->m_out_buf_ofs = 0;
- d->m_flush = flush;
-
- if ( ((d->m_pPut_buf_func != NULL) == ((pOut_buf != NULL) || (pOut_buf_size != NULL))) || (d->m_prev_return_status != TDEFL_STATUS_OKAY) ||
- (d->m_wants_to_finish && (flush != TDEFL_FINISH)) || (pIn_buf_size && *pIn_buf_size && !pIn_buf) || (pOut_buf_size && *pOut_buf_size && !pOut_buf) )
- {
- if (pIn_buf_size) *pIn_buf_size = 0;
- if (pOut_buf_size) *pOut_buf_size = 0;
- return (d->m_prev_return_status = TDEFL_STATUS_BAD_PARAM);
- }
- d->m_wants_to_finish |= (flush == TDEFL_FINISH);
-
- if ((d->m_output_flush_remaining) || (d->m_finished))
- return (d->m_prev_return_status = tdefl_flush_output_buffer(d));
-
-#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
- if (((d->m_flags & TDEFL_MAX_PROBES_MASK) == 1) &&
- ((d->m_flags & TDEFL_GREEDY_PARSING_FLAG) != 0) &&
- ((d->m_flags & (TDEFL_FILTER_MATCHES | TDEFL_FORCE_ALL_RAW_BLOCKS | TDEFL_RLE_MATCHES)) == 0))
- {
- if (!tdefl_compress_fast(d))
- return d->m_prev_return_status;
- }
- else
-#endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
- {
- if (!tdefl_compress_normal(d))
- return d->m_prev_return_status;
- }
-
- if ((d->m_flags & (TDEFL_WRITE_ZLIB_HEADER | TDEFL_COMPUTE_ADLER32)) && (pIn_buf))
- d->m_adler32 = (mz_uint32)mz_adler32(d->m_adler32, (const mz_uint8 *)pIn_buf, d->m_pSrc - (const mz_uint8 *)pIn_buf);
-
- if ((flush) && (!d->m_lookahead_size) && (!d->m_src_buf_left) && (!d->m_output_flush_remaining))
- {
- if (tdefl_flush_block(d, flush) < 0)
- return d->m_prev_return_status;
- d->m_finished = (flush == TDEFL_FINISH);
- if (flush == TDEFL_FULL_FLUSH) { MZ_CLEAR_OBJ(d->m_hash); MZ_CLEAR_OBJ(d->m_next); d->m_dict_size = 0; }
- }
-
- return (d->m_prev_return_status = tdefl_flush_output_buffer(d));
-}
-
-tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, size_t in_buf_size, tdefl_flush flush)
-{
- MZ_ASSERT(d->m_pPut_buf_func); return tdefl_compress(d, pIn_buf, &in_buf_size, NULL, NULL, flush);
-}
-
-tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags)
-{
- d->m_pPut_buf_func = pPut_buf_func; d->m_pPut_buf_user = pPut_buf_user;
- d->m_flags = (mz_uint)(flags); d->m_max_probes[0] = 1 + ((flags & 0xFFF) + 2) / 3; d->m_greedy_parsing = (flags & TDEFL_GREEDY_PARSING_FLAG) != 0;
- d->m_max_probes[1] = 1 + (((flags & 0xFFF) >> 2) + 2) / 3;
- if (!(flags & TDEFL_NONDETERMINISTIC_PARSING_FLAG)) MZ_CLEAR_OBJ(d->m_hash);
- d->m_lookahead_pos = d->m_lookahead_size = d->m_dict_size = d->m_total_lz_bytes = d->m_lz_code_buf_dict_pos = d->m_bits_in = 0;
- d->m_output_flush_ofs = d->m_output_flush_remaining = d->m_finished = d->m_block_index = d->m_bit_buffer = d->m_wants_to_finish = 0;
- d->m_pLZ_code_buf = d->m_lz_code_buf + 1; d->m_pLZ_flags = d->m_lz_code_buf; d->m_num_flags_left = 8;
- d->m_pOutput_buf = d->m_output_buf; d->m_pOutput_buf_end = d->m_output_buf; d->m_prev_return_status = TDEFL_STATUS_OKAY;
- d->m_saved_match_dist = d->m_saved_match_len = d->m_saved_lit = 0; d->m_adler32 = 1;
- d->m_pIn_buf = NULL; d->m_pOut_buf = NULL;
- d->m_pIn_buf_size = NULL; d->m_pOut_buf_size = NULL;
- d->m_flush = TDEFL_NO_FLUSH; d->m_pSrc = NULL; d->m_src_buf_left = 0; d->m_out_buf_ofs = 0;
- memset(&d->m_huff_count[0][0], 0, sizeof(d->m_huff_count[0][0]) * TDEFL_MAX_HUFF_SYMBOLS_0);
- memset(&d->m_huff_count[1][0], 0, sizeof(d->m_huff_count[1][0]) * TDEFL_MAX_HUFF_SYMBOLS_1);
- return TDEFL_STATUS_OKAY;
-}
-
-tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d)
-{
- return d->m_prev_return_status;
-}
-
-mz_uint32 tdefl_get_adler32(tdefl_compressor *d)
-{
- return d->m_adler32;
-}
-
-mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags)
-{
- tdefl_compressor *pComp; mz_bool succeeded; if (((buf_len) && (!pBuf)) || (!pPut_buf_func)) return MZ_FALSE;
- pComp = (tdefl_compressor*)MZ_MALLOC(sizeof(tdefl_compressor)); if (!pComp) return MZ_FALSE;
- succeeded = (tdefl_init(pComp, pPut_buf_func, pPut_buf_user, flags) == TDEFL_STATUS_OKAY);
- succeeded = succeeded && (tdefl_compress_buffer(pComp, pBuf, buf_len, TDEFL_FINISH) == TDEFL_STATUS_DONE);
- MZ_FREE(pComp); return succeeded;
-}
-
-typedef struct
-{
- size_t m_size, m_capacity;
- mz_uint8 *m_pBuf;
- mz_bool m_expandable;
-} tdefl_output_buffer;
-
-static mz_bool tdefl_output_buffer_putter(const void *pBuf, int len, void *pUser)
-{
- tdefl_output_buffer *p = (tdefl_output_buffer *)pUser;
- size_t new_size = p->m_size + len;
- if (new_size > p->m_capacity)
- {
- size_t new_capacity = p->m_capacity; mz_uint8 *pNew_buf; if (!p->m_expandable) return MZ_FALSE;
- do { new_capacity = MZ_MAX(128U, new_capacity << 1U); } while (new_size > new_capacity);
- pNew_buf = (mz_uint8*)MZ_REALLOC(p->m_pBuf, new_capacity); if (!pNew_buf) return MZ_FALSE;
- p->m_pBuf = pNew_buf; p->m_capacity = new_capacity;
- }
- memcpy((mz_uint8*)p->m_pBuf + p->m_size, pBuf, len); p->m_size = new_size;
- return MZ_TRUE;
-}
-
-void *tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags)
-{
- tdefl_output_buffer out_buf; MZ_CLEAR_OBJ(out_buf);
- if (!pOut_len) return MZ_FALSE; else *pOut_len = 0;
- out_buf.m_expandable = MZ_TRUE;
- if (!tdefl_compress_mem_to_output(pSrc_buf, src_buf_len, tdefl_output_buffer_putter, &out_buf, flags)) return NULL;
- *pOut_len = out_buf.m_size; return out_buf.m_pBuf;
-}
-
-size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags)
-{
- tdefl_output_buffer out_buf; MZ_CLEAR_OBJ(out_buf);
- if (!pOut_buf) return 0;
- out_buf.m_pBuf = (mz_uint8*)pOut_buf; out_buf.m_capacity = out_buf_len;
- if (!tdefl_compress_mem_to_output(pSrc_buf, src_buf_len, tdefl_output_buffer_putter, &out_buf, flags)) return 0;
- return out_buf.m_size;
-}
-
-#ifndef MINIZ_NO_ZLIB_APIS
-static const mz_uint s_tdefl_num_probes[11] = { 0, 1, 6, 32, 16, 32, 128, 256, 512, 768, 1500 };
-
-// level may actually range from [0,10] (10 is a "hidden" max level, where we want a bit more compression and it's fine if throughput to fall off a cliff on some files).
-mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy)
-{
- mz_uint comp_flags = s_tdefl_num_probes[(level >= 0) ? MZ_MIN(10, level) : MZ_DEFAULT_LEVEL] | ((level <= 3) ? TDEFL_GREEDY_PARSING_FLAG : 0);
- if (window_bits > 0) comp_flags |= TDEFL_WRITE_ZLIB_HEADER;
-
- if (!level) comp_flags |= TDEFL_FORCE_ALL_RAW_BLOCKS;
- else if (strategy == MZ_FILTERED) comp_flags |= TDEFL_FILTER_MATCHES;
- else if (strategy == MZ_HUFFMAN_ONLY) comp_flags &= ~TDEFL_MAX_PROBES_MASK;
- else if (strategy == MZ_FIXED) comp_flags |= TDEFL_FORCE_ALL_STATIC_BLOCKS;
- else if (strategy == MZ_RLE) comp_flags |= TDEFL_RLE_MATCHES;
-
- return comp_flags;
-}
-#endif //MINIZ_NO_ZLIB_APIS
-
-#ifdef _MSC_VER
-#pragma warning (push)
-#pragma warning (disable:4204) // nonstandard extension used : non-constant aggregate initializer (also supported by GNU C and C99, so no big deal)
-#endif
-
-// Simple PNG writer function by Alex Evans, 2011. Released into the public domain: https://gist.github.com/908299, more context at
-// http://altdevblogaday.org/2011/04/06/a-smaller-jpg-encoder/.
-void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, int num_chans, size_t *pLen_out)
-{
- tdefl_compressor *pComp = (tdefl_compressor *)MZ_MALLOC(sizeof(tdefl_compressor)); tdefl_output_buffer out_buf; int i, bpl = w * num_chans, y, z; mz_uint32 c; *pLen_out = 0;
- if (!pComp) return NULL;
- MZ_CLEAR_OBJ(out_buf); out_buf.m_expandable = MZ_TRUE; out_buf.m_capacity = 57+MZ_MAX(64, (1+bpl)*h); if (NULL == (out_buf.m_pBuf = (mz_uint8*)MZ_MALLOC(out_buf.m_capacity))) { MZ_FREE(pComp); return NULL; }
- // write dummy header
- for (z = 41; z; --z) tdefl_output_buffer_putter(&z, 1, &out_buf);
- // compress image data
- tdefl_init(pComp, tdefl_output_buffer_putter, &out_buf, TDEFL_DEFAULT_MAX_PROBES | TDEFL_WRITE_ZLIB_HEADER);
- for (y = 0; y < h; ++y) { tdefl_compress_buffer(pComp, &z, 1, TDEFL_NO_FLUSH); tdefl_compress_buffer(pComp, (mz_uint8*)pImage + y * bpl, bpl, TDEFL_NO_FLUSH); }
- if (tdefl_compress_buffer(pComp, NULL, 0, TDEFL_FINISH) != TDEFL_STATUS_DONE) { MZ_FREE(pComp); MZ_FREE(out_buf.m_pBuf); return NULL; }
- // write real header
- *pLen_out = out_buf.m_size-41;
- {
- mz_uint8 pnghdr[41]={0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48,0x44,0x52,
- 0,0,(mz_uint8)(w>>8),(mz_uint8)w,0,0,(mz_uint8)(h>>8),(mz_uint8)h,8,"\0\0\04\02\06"[num_chans],0,0,0,0,0,0,0,
- (mz_uint8)(*pLen_out>>24),(mz_uint8)(*pLen_out>>16),(mz_uint8)(*pLen_out>>8),(mz_uint8)*pLen_out,0x49,0x44,0x41,0x54};
- c=(mz_uint32)mz_crc32(MZ_CRC32_INIT,pnghdr+12,17); for (i=0; i<4; ++i, c<<=8) ((mz_uint8*)(pnghdr+29))[i]=(mz_uint8)(c>>24);
- memcpy(out_buf.m_pBuf, pnghdr, 41);
- }
- // write footer (IDAT CRC-32, followed by IEND chunk)
- if (!tdefl_output_buffer_putter("\0\0\0\0\0\0\0\0\x49\x45\x4e\x44\xae\x42\x60\x82", 16, &out_buf)) { *pLen_out = 0; MZ_FREE(pComp); MZ_FREE(out_buf.m_pBuf); return NULL; }
- c = (mz_uint32)mz_crc32(MZ_CRC32_INIT,out_buf.m_pBuf+41-4, *pLen_out+4); for (i=0; i<4; ++i, c<<=8) (out_buf.m_pBuf+out_buf.m_size-16)[i] = (mz_uint8)(c >> 24);
- // compute final size of file, grab compressed data buffer and return
- *pLen_out += 57; MZ_FREE(pComp); return out_buf.m_pBuf;
-}
-
-#ifdef _MSC_VER
-#pragma warning (pop)
-#endif
-
-// ------------------- .ZIP archive reading
-
-#ifndef MINIZ_NO_ARCHIVE_APIS
-
-#ifdef MINIZ_NO_STDIO
- #define MZ_FILE void *
-#else
- #include <stdio.h>
- #include <sys/stat.h>
-
- #if defined(_MSC_VER)
- static FILE *mz_fopen(const char *pFilename, const char *pMode)
- {
- FILE* pFile = NULL;
- fopen_s(&pFile, pFilename, pMode);
- return pFile;
- }
- static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
- {
- FILE* pFile = NULL;
- if (freopen_s(&pFile, pPath, pMode, pStream))
- return NULL;
- return pFile;
- }
- #else
- static FILE *mz_fopen(const char *pFilename, const char *pMode)
- {
- return fopen(pFilename, pMode);
- }
- static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
- {
- return freopen(pPath, pMode, pStream);
- }
- #endif // #if defined(_MSC_VER)
-
- #if defined(_MSC_VER) || defined(__MINGW64__)
- #ifndef MINIZ_NO_TIME
- #include <sys/utime.h>
- #endif
- #define MZ_FILE FILE
- #define MZ_FOPEN mz_fopen
- #define MZ_FCLOSE fclose
- #define MZ_FREAD fread
- #define MZ_FWRITE fwrite
- #define MZ_FTELL64 _ftelli64
- #define MZ_FSEEK64 _fseeki64
- #define MZ_FILE_STAT_STRUCT _stat
- #define MZ_FILE_STAT _stat
- #define MZ_FFLUSH fflush
- #define MZ_FREOPEN mz_freopen
- #define MZ_DELETE_FILE remove
- #elif defined(__MINGW32__)
- #ifndef MINIZ_NO_TIME
- #include <sys/utime.h>
- #endif
- #define MZ_FILE FILE
- #define MZ_FOPEN mz_fopen
- #define MZ_FCLOSE fclose
- #define MZ_FREAD fread
- #define MZ_FWRITE fwrite
- #define MZ_FTELL64 ftello64
- #define MZ_FSEEK64 fseeko64
- #define MZ_FILE_STAT_STRUCT _stat
- #define MZ_FILE_STAT _stat
- #define MZ_FFLUSH fflush
- #define MZ_FREOPEN mz_freopen
- #define MZ_DELETE_FILE remove
- #elif defined(__TINYC__)
- #ifndef MINIZ_NO_TIME
- #include <sys\utime.h>
- #endif
- #define MZ_FILE FILE
- #define MZ_FOPEN mz_fopen
- #define MZ_FCLOSE fclose
- #define MZ_FREAD fread
- #define MZ_FWRITE fwrite
- #define MZ_FTELL64 ftell
- #define MZ_FSEEK64 fseek
- #define MZ_FILE_STAT_STRUCT stat
- #define MZ_FILE_STAT stat
- #define MZ_FFLUSH fflush
- #define MZ_FREOPEN mz_freopen
- #define MZ_DELETE_FILE remove
- #else
- #ifndef MINIZ_NO_TIME
- #include <utime.h>
- #endif
- #define MZ_FILE FILE
- #define MZ_FOPEN mz_fopen
- #define MZ_FCLOSE fclose
- #define MZ_FREAD fread
- #define MZ_FWRITE fwrite
- #define MZ_FTELL64 ftello
- #define MZ_FSEEK64 fseeko
- #define MZ_FILE_STAT_STRUCT stat
- #define MZ_FILE_STAT stat
- #define MZ_FFLUSH fflush
- #define MZ_FREOPEN mz_freopen
- #define MZ_DELETE_FILE remove
- #endif // #ifdef _MSC_VER
-#endif // #ifdef MINIZ_NO_STDIO
-
-#define MZ_TOLOWER(c) ((((c) >= 'A') && ((c) <= 'Z')) ? ((c) - 'A' + 'a') : (c))
-
-// Various ZIP archive enums. To completely avoid cross platform compiler alignment and platform endian issues, miniz.c doesn't use structs for any of this stuff.
-enum
-{
- // ZIP archive identifiers and record sizes
- MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG = 0x06054b50, MZ_ZIP_CENTRAL_DIR_HEADER_SIG = 0x02014b50, MZ_ZIP_LOCAL_DIR_HEADER_SIG = 0x04034b50,
- MZ_ZIP_LOCAL_DIR_HEADER_SIZE = 30, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE = 46, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE = 22,
- // Central directory header record offsets
- MZ_ZIP_CDH_SIG_OFS = 0, MZ_ZIP_CDH_VERSION_MADE_BY_OFS = 4, MZ_ZIP_CDH_VERSION_NEEDED_OFS = 6, MZ_ZIP_CDH_BIT_FLAG_OFS = 8,
- MZ_ZIP_CDH_METHOD_OFS = 10, MZ_ZIP_CDH_FILE_TIME_OFS = 12, MZ_ZIP_CDH_FILE_DATE_OFS = 14, MZ_ZIP_CDH_CRC32_OFS = 16,
- MZ_ZIP_CDH_COMPRESSED_SIZE_OFS = 20, MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS = 24, MZ_ZIP_CDH_FILENAME_LEN_OFS = 28, MZ_ZIP_CDH_EXTRA_LEN_OFS = 30,
- MZ_ZIP_CDH_COMMENT_LEN_OFS = 32, MZ_ZIP_CDH_DISK_START_OFS = 34, MZ_ZIP_CDH_INTERNAL_ATTR_OFS = 36, MZ_ZIP_CDH_EXTERNAL_ATTR_OFS = 38, MZ_ZIP_CDH_LOCAL_HEADER_OFS = 42,
- // Local directory header offsets
- MZ_ZIP_LDH_SIG_OFS = 0, MZ_ZIP_LDH_VERSION_NEEDED_OFS = 4, MZ_ZIP_LDH_BIT_FLAG_OFS = 6, MZ_ZIP_LDH_METHOD_OFS = 8, MZ_ZIP_LDH_FILE_TIME_OFS = 10,
- MZ_ZIP_LDH_FILE_DATE_OFS = 12, MZ_ZIP_LDH_CRC32_OFS = 14, MZ_ZIP_LDH_COMPRESSED_SIZE_OFS = 18, MZ_ZIP_LDH_DECOMPRESSED_SIZE_OFS = 22,
- MZ_ZIP_LDH_FILENAME_LEN_OFS = 26, MZ_ZIP_LDH_EXTRA_LEN_OFS = 28,
- // End of central directory offsets
- MZ_ZIP_ECDH_SIG_OFS = 0, MZ_ZIP_ECDH_NUM_THIS_DISK_OFS = 4, MZ_ZIP_ECDH_NUM_DISK_CDIR_OFS = 6, MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS = 8,
- MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS = 10, MZ_ZIP_ECDH_CDIR_SIZE_OFS = 12, MZ_ZIP_ECDH_CDIR_OFS_OFS = 16, MZ_ZIP_ECDH_COMMENT_SIZE_OFS = 20,
-};
-
-typedef struct
-{
- void *m_p;
- size_t m_size, m_capacity;
- mz_uint m_element_size;
-} mz_zip_array;
-
-struct mz_zip_internal_state_tag
-{
- mz_zip_array m_central_dir;
- mz_zip_array m_central_dir_offsets;
- mz_zip_array m_sorted_central_dir_offsets;
- MZ_FILE *m_pFile;
- void *m_pMem;
- size_t m_mem_size;
- size_t m_mem_capacity;
-};
-
-#define MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(array_ptr, element_size) (array_ptr)->m_element_size = element_size
-#define MZ_ZIP_ARRAY_ELEMENT(array_ptr, element_type, index) ((element_type *)((array_ptr)->m_p))[index]
-
-static MZ_FORCEINLINE void mz_zip_array_clear(mz_zip_archive *pZip, mz_zip_array *pArray)
-{
- pZip->m_pFree(pZip->m_pAlloc_opaque, pArray->m_p);
- memset(pArray, 0, sizeof(mz_zip_array));
-}
-
-static mz_bool mz_zip_array_ensure_capacity(mz_zip_archive *pZip, mz_zip_array *pArray, size_t min_new_capacity, mz_uint growing)
-{
- void *pNew_p; size_t new_capacity = min_new_capacity; MZ_ASSERT(pArray->m_element_size); if (pArray->m_capacity >= min_new_capacity) return MZ_TRUE;
- if (growing) { new_capacity = MZ_MAX(1, pArray->m_capacity); while (new_capacity < min_new_capacity) new_capacity *= 2; }
- if (NULL == (pNew_p = pZip->m_pRealloc(pZip->m_pAlloc_opaque, pArray->m_p, pArray->m_element_size, new_capacity))) return MZ_FALSE;
- pArray->m_p = pNew_p; pArray->m_capacity = new_capacity;
- return MZ_TRUE;
-}
-
-static MZ_FORCEINLINE mz_bool mz_zip_array_reserve(mz_zip_archive *pZip, mz_zip_array *pArray, size_t new_capacity, mz_uint growing)
-{
- if (new_capacity > pArray->m_capacity) { if (!mz_zip_array_ensure_capacity(pZip, pArray, new_capacity, growing)) return MZ_FALSE; }
- return MZ_TRUE;
-}
-
-static MZ_FORCEINLINE mz_bool mz_zip_array_resize(mz_zip_archive *pZip, mz_zip_array *pArray, size_t new_size, mz_uint growing)
-{
- if (new_size > pArray->m_capacity) { if (!mz_zip_array_ensure_capacity(pZip, pArray, new_size, growing)) return MZ_FALSE; }
- pArray->m_size = new_size;
- return MZ_TRUE;
-}
-
-static MZ_FORCEINLINE mz_bool mz_zip_array_ensure_room(mz_zip_archive *pZip, mz_zip_array *pArray, size_t n)
-{
- return mz_zip_array_reserve(pZip, pArray, pArray->m_size + n, MZ_TRUE);
-}
-
-static MZ_FORCEINLINE mz_bool mz_zip_array_push_back(mz_zip_archive *pZip, mz_zip_array *pArray, const void *pElements, size_t n)
-{
- size_t orig_size = pArray->m_size; if (!mz_zip_array_resize(pZip, pArray, orig_size + n, MZ_TRUE)) return MZ_FALSE;
- memcpy((mz_uint8*)pArray->m_p + orig_size * pArray->m_element_size, pElements, n * pArray->m_element_size);
- return MZ_TRUE;
-}
-
-#ifndef MINIZ_NO_TIME
-static time_t mz_zip_dos_to_time_t(int dos_time, int dos_date)
-{
- struct tm tm;
- memset(&tm, 0, sizeof(tm)); tm.tm_isdst = -1;
- tm.tm_year = ((dos_date >> 9) & 127) + 1980 - 1900; tm.tm_mon = ((dos_date >> 5) & 15) - 1; tm.tm_mday = dos_date & 31;
- tm.tm_hour = (dos_time >> 11) & 31; tm.tm_min = (dos_time >> 5) & 63; tm.tm_sec = (dos_time << 1) & 62;
- return mktime(&tm);
-}
-
-static void mz_zip_time_to_dos_time(time_t time, mz_uint16 *pDOS_time, mz_uint16 *pDOS_date)
-{
-#ifdef _MSC_VER
- struct tm tm_struct;
- struct tm *tm = &tm_struct;
- errno_t err = localtime_s(tm, &time);
- if (err)
- {
- *pDOS_date = 0; *pDOS_time = 0;
- return;
- }
-#else
- struct tm *tm = localtime(&time);
-#endif
- *pDOS_time = (mz_uint16)(((tm->tm_hour) << 11) + ((tm->tm_min) << 5) + ((tm->tm_sec) >> 1));
- *pDOS_date = (mz_uint16)(((tm->tm_year + 1900 - 1980) << 9) + ((tm->tm_mon + 1) << 5) + tm->tm_mday);
-}
-#endif
-
-#ifndef MINIZ_NO_STDIO
-static mz_bool mz_zip_get_file_modified_time(const char *pFilename, mz_uint16 *pDOS_time, mz_uint16 *pDOS_date)
-{
-#ifdef MINIZ_NO_TIME
- (void)pFilename; *pDOS_date = *pDOS_time = 0;
-#else
- struct MZ_FILE_STAT_STRUCT file_stat; if (MZ_FILE_STAT(pFilename, &file_stat) != 0) return MZ_FALSE;
- mz_zip_time_to_dos_time(file_stat.st_mtime, pDOS_time, pDOS_date);
-#endif // #ifdef MINIZ_NO_TIME
- return MZ_TRUE;
-}
-
-static mz_bool mz_zip_set_file_times(const char *pFilename, time_t access_time, time_t modified_time)
-{
-#ifndef MINIZ_NO_TIME
- struct utimbuf t; t.actime = access_time; t.modtime = modified_time;
- return !utime(pFilename, &t);
-#else
- (void)pFilename, (void)access_time, (void)modified_time;
- return MZ_TRUE;
-#endif // #ifndef MINIZ_NO_TIME
-}
-#endif
-
-static mz_bool mz_zip_reader_init_internal(mz_zip_archive *pZip, mz_uint32 flags)
-{
- (void)flags;
- if ((!pZip) || (pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_INVALID))
- return MZ_FALSE;
-
- if (!pZip->m_pAlloc) pZip->m_pAlloc = def_alloc_func;
- if (!pZip->m_pFree) pZip->m_pFree = def_free_func;
- if (!pZip->m_pRealloc) pZip->m_pRealloc = def_realloc_func;
-
- pZip->m_zip_mode = MZ_ZIP_MODE_READING;
- pZip->m_archive_size = 0;
- pZip->m_central_directory_file_ofs = 0;
- pZip->m_total_files = 0;
-
- if (NULL == (pZip->m_pState = (mz_zip_internal_state *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(mz_zip_internal_state))))
- return MZ_FALSE;
- memset(pZip->m_pState, 0, sizeof(mz_zip_internal_state));
- MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir, sizeof(mz_uint8));
- MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir_offsets, sizeof(mz_uint32));
- MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_sorted_central_dir_offsets, sizeof(mz_uint32));
- return MZ_TRUE;
-}
-
-static MZ_FORCEINLINE mz_bool mz_zip_reader_filename_less(const mz_zip_array *pCentral_dir_array, const mz_zip_array *pCentral_dir_offsets, mz_uint l_index, mz_uint r_index)
-{
- const mz_uint8 *pL = &MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_array, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_offsets, mz_uint32, l_index)), *pE;
- const mz_uint8 *pR = &MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_array, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_offsets, mz_uint32, r_index));
- mz_uint l_len = MZ_READ_LE16(pL + MZ_ZIP_CDH_FILENAME_LEN_OFS), r_len = MZ_READ_LE16(pR + MZ_ZIP_CDH_FILENAME_LEN_OFS);
- mz_uint8 l = 0, r = 0;
- pL += MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; pR += MZ_ZIP_CENTRAL_DIR_HEADER_SIZE;
- pE = pL + MZ_MIN(l_len, r_len);
- while (pL < pE)
- {
- if ((l = MZ_TOLOWER(*pL)) != (r = MZ_TOLOWER(*pR)))
- break;
- pL++; pR++;
- }
- return (pL == pE) ? (l_len < r_len) : (l < r);
-}
-
-#define MZ_SWAP_UINT32(a, b) do { mz_uint32 t = a; a = b; b = t; } MZ_MACRO_END
-
-// Heap sort of lowercased filenames, used to help accelerate plain central directory searches by mz_zip_reader_locate_file(). (Could also use qsort(), but it could allocate memory.)
-static void mz_zip_reader_sort_central_dir_offsets_by_filename(mz_zip_archive *pZip)
-{
- mz_zip_internal_state *pState = pZip->m_pState;
- const mz_zip_array *pCentral_dir_offsets = &pState->m_central_dir_offsets;
- const mz_zip_array *pCentral_dir = &pState->m_central_dir;
- mz_uint32 *pIndices = &MZ_ZIP_ARRAY_ELEMENT(&pState->m_sorted_central_dir_offsets, mz_uint32, 0);
- const int size = pZip->m_total_files;
- int start = (size - 2) >> 1, end;
- while (start >= 0)
- {
- int child, root = start;
- for ( ; ; )
- {
- if ((child = (root << 1) + 1) >= size)
- break;
- child += (((child + 1) < size) && (mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[child], pIndices[child + 1])));
- if (!mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[root], pIndices[child]))
- break;
- MZ_SWAP_UINT32(pIndices[root], pIndices[child]); root = child;
- }
- start--;
- }
-
- end = size - 1;
- while (end > 0)
- {
- int child, root = 0;
- MZ_SWAP_UINT32(pIndices[end], pIndices[0]);
- for ( ; ; )
- {
- if ((child = (root << 1) + 1) >= end)
- break;
- child += (((child + 1) < end) && mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[child], pIndices[child + 1]));
- if (!mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[root], pIndices[child]))
- break;
- MZ_SWAP_UINT32(pIndices[root], pIndices[child]); root = child;
- }
- end--;
- }
-}
-
-static mz_bool mz_zip_reader_read_central_dir(mz_zip_archive *pZip, mz_uint32 flags)
-{
- mz_uint cdir_size, num_this_disk, cdir_disk_index;
- mz_uint64 cdir_ofs;
- mz_int64 cur_file_ofs;
- const mz_uint8 *p;
- mz_uint32 buf_u32[4096 / sizeof(mz_uint32)]; mz_uint8 *pBuf = (mz_uint8 *)buf_u32;
- // Basic sanity checks - reject files which are too small, and check the first 4 bytes of the file to make sure a local header is there.
- if (pZip->m_archive_size < MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE)
- return MZ_FALSE;
- // Find the end of central directory record by scanning the file from the end towards the beginning.
- cur_file_ofs = MZ_MAX((mz_int64)pZip->m_archive_size - (mz_int64)sizeof(buf_u32), 0);
- for ( ; ; )
- {
- int i, n = (int)MZ_MIN(sizeof(buf_u32), pZip->m_archive_size - cur_file_ofs);
- if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, n) != (mz_uint)n)
- return MZ_FALSE;
- for (i = n - 4; i >= 0; --i)
- if (MZ_READ_LE32(pBuf + i) == MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG)
- break;
- if (i >= 0)
- {
- cur_file_ofs += i;
- break;
- }
- if ((!cur_file_ofs) || ((pZip->m_archive_size - cur_file_ofs) >= (0xFFFF + MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE)))
- return MZ_FALSE;
- cur_file_ofs = MZ_MAX(cur_file_ofs - (sizeof(buf_u32) - 3), 0);
- }
- // Read and verify the end of central directory record.
- if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) != MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE)
- return MZ_FALSE;
- if ((MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_SIG_OFS) != MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG) ||
- ((pZip->m_total_files = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS)) != MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS)))
- return MZ_FALSE;
-
- num_this_disk = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_NUM_THIS_DISK_OFS);
- cdir_disk_index = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_NUM_DISK_CDIR_OFS);
- if (((num_this_disk | cdir_disk_index) != 0) && ((num_this_disk != 1) || (cdir_disk_index != 1)))
- return MZ_FALSE;
-
- if ((cdir_size = MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_CDIR_SIZE_OFS)) < pZip->m_total_files * MZ_ZIP_CENTRAL_DIR_HEADER_SIZE)
- return MZ_FALSE;
-
- cdir_ofs = MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_CDIR_OFS_OFS);
- if ((cdir_ofs + (mz_uint64)cdir_size) > pZip->m_archive_size)
- return MZ_FALSE;
-
- pZip->m_central_directory_file_ofs = cdir_ofs;
-
- if (pZip->m_total_files)
- {
- mz_uint i, n;
- // Read the entire central directory into a heap block, and allocate another heap block to hold the unsorted central dir file record offsets, and another to hold the sorted indices.
- if ((!mz_zip_array_resize(pZip, &pZip->m_pState->m_central_dir, cdir_size, MZ_FALSE)) ||
- (!mz_zip_array_resize(pZip, &pZip->m_pState->m_central_dir_offsets, pZip->m_total_files, MZ_FALSE)) ||
- (!mz_zip_array_resize(pZip, &pZip->m_pState->m_sorted_central_dir_offsets, pZip->m_total_files, MZ_FALSE)))
- return MZ_FALSE;
- if (pZip->m_pRead(pZip->m_pIO_opaque, cdir_ofs, pZip->m_pState->m_central_dir.m_p, cdir_size) != cdir_size)
- return MZ_FALSE;
-
- // Now create an index into the central directory file records, do some basic sanity checking on each record, and check for zip64 entries (which are not yet supported).
- p = (const mz_uint8 *)pZip->m_pState->m_central_dir.m_p;
- for (n = cdir_size, i = 0; i < pZip->m_total_files; ++i)
- {
- mz_uint total_header_size, comp_size, decomp_size, disk_index;
- if ((n < MZ_ZIP_CENTRAL_DIR_HEADER_SIZE) || (MZ_READ_LE32(p) != MZ_ZIP_CENTRAL_DIR_HEADER_SIG))
- return MZ_FALSE;
- MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, i) = (mz_uint32)(p - (const mz_uint8 *)pZip->m_pState->m_central_dir.m_p);
- MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_sorted_central_dir_offsets, mz_uint32, i) = i;
- comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS);
- decomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS);
- if (((!MZ_READ_LE32(p + MZ_ZIP_CDH_METHOD_OFS)) && (decomp_size != comp_size)) || (decomp_size && !comp_size) || (decomp_size == 0xFFFFFFFF) || (comp_size == 0xFFFFFFFF))
- return MZ_FALSE;
- disk_index = MZ_READ_LE16(p + MZ_ZIP_CDH_DISK_START_OFS);
- if ((disk_index != num_this_disk) && (disk_index != 1))
- return MZ_FALSE;
- if (((mz_uint64)MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS) + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + comp_size) > pZip->m_archive_size)
- return MZ_FALSE;
- if ((total_header_size = MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS) + MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS) + MZ_READ_LE16(p + MZ_ZIP_CDH_COMMENT_LEN_OFS)) > n)
- return MZ_FALSE;
- n -= total_header_size; p += total_header_size;
- }
- }
-
- if ((flags & MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY) == 0)
- mz_zip_reader_sort_central_dir_offsets_by_filename(pZip);
-
- return MZ_TRUE;
-}
-
-mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags)
-{
- if ((!pZip) || (!pZip->m_pRead))
- return MZ_FALSE;
- if (!mz_zip_reader_init_internal(pZip, flags))
- return MZ_FALSE;
- pZip->m_archive_size = size;
- if (!mz_zip_reader_read_central_dir(pZip, flags))
- {
- mz_zip_reader_end(pZip);
- return MZ_FALSE;
- }
- return MZ_TRUE;
-}
-
-static size_t mz_zip_mem_read_func(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n)
-{
- mz_zip_archive *pZip = (mz_zip_archive *)pOpaque;
- size_t s = (file_ofs >= pZip->m_archive_size) ? 0 : (size_t)MZ_MIN(pZip->m_archive_size - file_ofs, n);
- memcpy(pBuf, (const mz_uint8 *)pZip->m_pState->m_pMem + file_ofs, s);
- return s;
-}
-
-mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags)
-{
- if (!mz_zip_reader_init_internal(pZip, flags))
- return MZ_FALSE;
- pZip->m_archive_size = size;
- pZip->m_pRead = mz_zip_mem_read_func;
- pZip->m_pIO_opaque = pZip;
- pZip->m_pState->m_pMem = (void *)pMem;
- pZip->m_pState->m_mem_size = size;
- if (!mz_zip_reader_read_central_dir(pZip, flags))
- {
- mz_zip_reader_end(pZip);
- return MZ_FALSE;
- }
- return MZ_TRUE;
-}
-
-#ifndef MINIZ_NO_STDIO
-static size_t mz_zip_file_read_func(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n)
-{
- mz_zip_archive *pZip = (mz_zip_archive *)pOpaque;
- mz_int64 cur_ofs = MZ_FTELL64(pZip->m_pState->m_pFile);
- if (((mz_int64)file_ofs < 0) || (((cur_ofs != (mz_int64)file_ofs)) && (MZ_FSEEK64(pZip->m_pState->m_pFile, (mz_int64)file_ofs, SEEK_SET))))
- return 0;
- return MZ_FREAD(pBuf, 1, n, pZip->m_pState->m_pFile);
-}
-
-mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags)
-{
- mz_uint64 file_size;
- MZ_FILE *pFile = MZ_FOPEN(pFilename, "rb");
- if (!pFile)
- return MZ_FALSE;
- if (MZ_FSEEK64(pFile, 0, SEEK_END))
- return MZ_FALSE;
- file_size = MZ_FTELL64(pFile);
- if (!mz_zip_reader_init_internal(pZip, flags))
- {
- MZ_FCLOSE(pFile);
- return MZ_FALSE;
- }
- pZip->m_pRead = mz_zip_file_read_func;
- pZip->m_pIO_opaque = pZip;
- pZip->m_pState->m_pFile = pFile;
- pZip->m_archive_size = file_size;
- if (!mz_zip_reader_read_central_dir(pZip, flags))
- {
- mz_zip_reader_end(pZip);
- return MZ_FALSE;
- }
- return MZ_TRUE;
-}
-#endif // #ifndef MINIZ_NO_STDIO
-
-mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip)
-{
- return pZip ? pZip->m_total_files : 0;
-}
-
-static MZ_FORCEINLINE const mz_uint8 *mz_zip_reader_get_cdh(mz_zip_archive *pZip, mz_uint file_index)
-{
- if ((!pZip) || (!pZip->m_pState) || (file_index >= pZip->m_total_files) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING))
- return NULL;
- return &MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, file_index));
-}
-
-mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index)
-{
- mz_uint m_bit_flag;
- const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index);
- if (!p)
- return MZ_FALSE;
- m_bit_flag = MZ_READ_LE16(p + MZ_ZIP_CDH_BIT_FLAG_OFS);
- return (m_bit_flag & 1);
-}
-
-mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index)
-{
- mz_uint filename_len, internal_attr, external_attr;
- const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index);
- if (!p)
- return MZ_FALSE;
-
- internal_attr = MZ_READ_LE16(p + MZ_ZIP_CDH_INTERNAL_ATTR_OFS);
- external_attr = MZ_READ_LE32(p + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS);
- if ((!internal_attr) && ((external_attr & 0x10) != 0))
- return MZ_TRUE;
-
- filename_len = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS);
- if (filename_len)
- {
- if (*(p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_len - 1) == '/')
- return MZ_TRUE;
- }
-
- return MZ_FALSE;
-}
-
-mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat)
-{
- mz_uint n;
- const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index);
- if ((!p) || (!pStat))
- return MZ_FALSE;
-
- // Unpack the central directory record.
- pStat->m_file_index = file_index;
- pStat->m_central_dir_ofs = MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, file_index);
- pStat->m_version_made_by = MZ_READ_LE16(p + MZ_ZIP_CDH_VERSION_MADE_BY_OFS);
- pStat->m_version_needed = MZ_READ_LE16(p + MZ_ZIP_CDH_VERSION_NEEDED_OFS);
- pStat->m_bit_flag = MZ_READ_LE16(p + MZ_ZIP_CDH_BIT_FLAG_OFS);
- pStat->m_method = MZ_READ_LE16(p + MZ_ZIP_CDH_METHOD_OFS);
-#ifndef MINIZ_NO_TIME
- pStat->m_time = mz_zip_dos_to_time_t(MZ_READ_LE16(p + MZ_ZIP_CDH_FILE_TIME_OFS), MZ_READ_LE16(p + MZ_ZIP_CDH_FILE_DATE_OFS));
-#endif
- pStat->m_crc32 = MZ_READ_LE32(p + MZ_ZIP_CDH_CRC32_OFS);
- pStat->m_comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS);
- pStat->m_uncomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS);
- pStat->m_internal_attr = MZ_READ_LE16(p + MZ_ZIP_CDH_INTERNAL_ATTR_OFS);
- pStat->m_external_attr = MZ_READ_LE32(p + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS);
- pStat->m_local_header_ofs = MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS);
-
- // Copy as much of the filename and comment as possible.
- n = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS); n = MZ_MIN(n, MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE - 1);
- memcpy(pStat->m_filename, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n); pStat->m_filename[n] = '\0';
-
- n = MZ_READ_LE16(p + MZ_ZIP_CDH_COMMENT_LEN_OFS); n = MZ_MIN(n, MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE - 1);
- pStat->m_comment_size = n;
- memcpy(pStat->m_comment, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS) + MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS), n); pStat->m_comment[n] = '\0';
-
- return MZ_TRUE;
-}
-
-mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size)
-{
- mz_uint n;
- const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index);
- if (!p) { if (filename_buf_size) pFilename[0] = '\0'; return 0; }
- n = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS);
- if (filename_buf_size)
- {
- n = MZ_MIN(n, filename_buf_size - 1);
- memcpy(pFilename, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n);
- pFilename[n] = '\0';
- }
- return n + 1;
-}
-
-static MZ_FORCEINLINE mz_bool mz_zip_reader_string_equal(const char *pA, const char *pB, mz_uint len, mz_uint flags)
-{
- mz_uint i;
- if (flags & MZ_ZIP_FLAG_CASE_SENSITIVE)
- return 0 == memcmp(pA, pB, len);
- for (i = 0; i < len; ++i)
- if (MZ_TOLOWER(pA[i]) != MZ_TOLOWER(pB[i]))
- return MZ_FALSE;
- return MZ_TRUE;
-}
-
-static MZ_FORCEINLINE int mz_zip_reader_filename_compare(const mz_zip_array *pCentral_dir_array, const mz_zip_array *pCentral_dir_offsets, mz_uint l_index, const char *pR, mz_uint r_len)
-{
- const mz_uint8 *pL = &MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_array, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_offsets, mz_uint32, l_index)), *pE;
- mz_uint l_len = MZ_READ_LE16(pL + MZ_ZIP_CDH_FILENAME_LEN_OFS);
- mz_uint8 l = 0, r = 0;
- pL += MZ_ZIP_CENTRAL_DIR_HEADER_SIZE;
- pE = pL + MZ_MIN(l_len, r_len);
- while (pL < pE)
- {
- if ((l = MZ_TOLOWER(*pL)) != (r = MZ_TOLOWER(*pR)))
- break;
- pL++; pR++;
- }
- return (pL == pE) ? (int)(l_len - r_len) : (l - r);
-}
-
-static int mz_zip_reader_locate_file_binary_search(mz_zip_archive *pZip, const char *pFilename)
-{
- mz_zip_internal_state *pState = pZip->m_pState;
- const mz_zip_array *pCentral_dir_offsets = &pState->m_central_dir_offsets;
- const mz_zip_array *pCentral_dir = &pState->m_central_dir;
- mz_uint32 *pIndices = &MZ_ZIP_ARRAY_ELEMENT(&pState->m_sorted_central_dir_offsets, mz_uint32, 0);
- const int size = pZip->m_total_files;
- const mz_uint filename_len = (mz_uint)strlen(pFilename);
- int l = 0, h = size - 1;
- while (l <= h)
- {
- int m = (l + h) >> 1, file_index = pIndices[m], comp = mz_zip_reader_filename_compare(pCentral_dir, pCentral_dir_offsets, file_index, pFilename, filename_len);
- if (!comp)
- return file_index;
- else if (comp < 0)
- l = m + 1;
- else
- h = m - 1;
- }
- return -1;
-}
-
-int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags)
-{
- mz_uint file_index; size_t name_len, comment_len;
- if ((!pZip) || (!pZip->m_pState) || (!pName) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING))
- return -1;
- if (((flags & (MZ_ZIP_FLAG_IGNORE_PATH | MZ_ZIP_FLAG_CASE_SENSITIVE)) == 0) && (!pComment) && (pZip->m_pState->m_sorted_central_dir_offsets.m_p))
- return mz_zip_reader_locate_file_binary_search(pZip, pName);
- name_len = strlen(pName); if (name_len > 0xFFFF) return -1;
- comment_len = pComment ? strlen(pComment) : 0; if (comment_len > 0xFFFF) return -1;
- for (file_index = 0; file_index < pZip->m_total_files; file_index++)
- {
- const mz_uint8 *pHeader = &MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, file_index));
- mz_uint filename_len = MZ_READ_LE16(pHeader + MZ_ZIP_CDH_FILENAME_LEN_OFS);
- const char *pFilename = (const char *)pHeader + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE;
- if (filename_len < name_len)
- continue;
- if (comment_len)
- {
- mz_uint file_extra_len = MZ_READ_LE16(pHeader + MZ_ZIP_CDH_EXTRA_LEN_OFS), file_comment_len = MZ_READ_LE16(pHeader + MZ_ZIP_CDH_COMMENT_LEN_OFS);
- const char *pFile_comment = pFilename + filename_len + file_extra_len;
- if ((file_comment_len != comment_len) || (!mz_zip_reader_string_equal(pComment, pFile_comment, file_comment_len, flags)))
- continue;
- }
- if ((flags & MZ_ZIP_FLAG_IGNORE_PATH) && (filename_len))
- {
- int ofs = filename_len - 1;
- do
- {
- if ((pFilename[ofs] == '/') || (pFilename[ofs] == '\\') || (pFilename[ofs] == ':'))
- break;
- } while (--ofs >= 0);
- ofs++;
- pFilename += ofs; filename_len -= ofs;
- }
- if ((filename_len == name_len) && (mz_zip_reader_string_equal(pName, pFilename, filename_len, flags)))
- return file_index;
- }
- return -1;
-}
-
-mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size)
-{
- int status = TINFL_STATUS_DONE;
- mz_uint64 needed_size, cur_file_ofs, comp_remaining, out_buf_ofs = 0, read_buf_size, read_buf_ofs = 0, read_buf_avail;
- mz_zip_archive_file_stat file_stat;
- void *pRead_buf;
- mz_uint32 local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / sizeof(mz_uint32)]; mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32;
- tinfl_decompressor inflator;
-
- if ((buf_size) && (!pBuf))
- return MZ_FALSE;
-
- if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat))
- return MZ_FALSE;
-
- if (!file_stat.m_comp_size)
- return MZ_TRUE;
-
- // Encryption and patch files are not supported.
- if (file_stat.m_bit_flag & (1 | 32))
- return MZ_FALSE;
-
- // This function only supports stored and deflate.
- if ((!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (file_stat.m_method != 0) && (file_stat.m_method != MZ_DEFLATED))
- return MZ_FALSE;
-
- // Ensure supplied output buffer is large enough.
- needed_size = (flags & MZ_ZIP_FLAG_COMPRESSED_DATA) ? file_stat.m_comp_size : file_stat.m_uncomp_size;
- if (buf_size < needed_size)
- return MZ_FALSE;
-
- // Read and parse the local directory entry.
- cur_file_ofs = file_stat.m_local_header_ofs;
- if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE)
- return MZ_FALSE;
- if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG)
- return MZ_FALSE;
-
- cur_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS);
- if ((cur_file_ofs + file_stat.m_comp_size) > pZip->m_archive_size)
- return MZ_FALSE;
-
- if ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) || (!file_stat.m_method))
- {
- // The file is stored or the caller has requested the compressed data.
- if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, (size_t)needed_size) != needed_size)
- return MZ_FALSE;
- return ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) != 0) || (mz_crc32(MZ_CRC32_INIT, (const mz_uint8 *)pBuf, (size_t)file_stat.m_uncomp_size) == file_stat.m_crc32);
- }
-
- // Decompress the file either directly from memory or from a file input buffer.
- tinfl_init(&inflator);
-
- if (pZip->m_pState->m_pMem)
- {
- // Read directly from the archive in memory.
- pRead_buf = (mz_uint8 *)pZip->m_pState->m_pMem + cur_file_ofs;
- read_buf_size = read_buf_avail = file_stat.m_comp_size;
- comp_remaining = 0;
- }
- else if (pUser_read_buf)
- {
- // Use a user provided read buffer.
- if (!user_read_buf_size)
- return MZ_FALSE;
- pRead_buf = (mz_uint8 *)pUser_read_buf;
- read_buf_size = user_read_buf_size;
- read_buf_avail = 0;
- comp_remaining = file_stat.m_uncomp_size;
- }
- else
- {
- // Temporarily allocate a read buffer.
- read_buf_size = MZ_MIN(file_stat.m_comp_size, MZ_ZIP_MAX_IO_BUF_SIZE);
-#ifdef _MSC_VER
- if (((0, sizeof(size_t) == sizeof(mz_uint32))) && (read_buf_size > 0x7FFFFFFF))
-#else
- if (((sizeof(size_t) == sizeof(mz_uint32))) && (read_buf_size > 0x7FFFFFFF))
-#endif
- return MZ_FALSE;
- if (NULL == (pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)read_buf_size)))
- return MZ_FALSE;
- read_buf_avail = 0;
- comp_remaining = file_stat.m_comp_size;
- }
-
- do
- {
- size_t in_buf_size, out_buf_size = (size_t)(file_stat.m_uncomp_size - out_buf_ofs);
- if ((!read_buf_avail) && (!pZip->m_pState->m_pMem))
- {
- read_buf_avail = MZ_MIN(read_buf_size, comp_remaining);
- if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf_avail)
- {
- status = TINFL_STATUS_FAILED;
- break;
- }
- cur_file_ofs += read_buf_avail;
- comp_remaining -= read_buf_avail;
- read_buf_ofs = 0;
- }
- in_buf_size = (size_t)read_buf_avail;
- status = tinfl_decompress(&inflator, (mz_uint8 *)pRead_buf + read_buf_ofs, &in_buf_size, (mz_uint8 *)pBuf, (mz_uint8 *)pBuf + out_buf_ofs, &out_buf_size, TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF | (comp_remaining ? TINFL_FLAG_HAS_MORE_INPUT : 0));
- read_buf_avail -= in_buf_size;
- read_buf_ofs += in_buf_size;
- out_buf_ofs += out_buf_size;
- } while (status == TINFL_STATUS_NEEDS_MORE_INPUT);
-
- if (status == TINFL_STATUS_DONE)
- {
- // Make sure the entire file was decompressed, and check its CRC.
- if ((out_buf_ofs != file_stat.m_uncomp_size) || (mz_crc32(MZ_CRC32_INIT, (const mz_uint8 *)pBuf, (size_t)file_stat.m_uncomp_size) != file_stat.m_crc32))
- status = TINFL_STATUS_FAILED;
- }
-
- if ((!pZip->m_pState->m_pMem) && (!pUser_read_buf))
- pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf);
-
- return status == TINFL_STATUS_DONE;
-}
-
-mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size)
-{
- int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags);
- if (file_index < 0)
- return MZ_FALSE;
- return mz_zip_reader_extract_to_mem_no_alloc(pZip, file_index, pBuf, buf_size, flags, pUser_read_buf, user_read_buf_size);
-}
-
-mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags)
-{
- return mz_zip_reader_extract_to_mem_no_alloc(pZip, file_index, pBuf, buf_size, flags, NULL, 0);
-}
-
-mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags)
-{
- return mz_zip_reader_extract_file_to_mem_no_alloc(pZip, pFilename, pBuf, buf_size, flags, NULL, 0);
-}
-
-void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uint flags)
-{
- mz_uint64 comp_size, uncomp_size, alloc_size;
- const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index);
- void *pBuf;
-
- if (pSize)
- *pSize = 0;
- if (!p)
- return NULL;
-
- comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS);
- uncomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS);
-
- alloc_size = (flags & MZ_ZIP_FLAG_COMPRESSED_DATA) ? comp_size : uncomp_size;
-#ifdef _MSC_VER
- if (((0, sizeof(size_t) == sizeof(mz_uint32))) && (alloc_size > 0x7FFFFFFF))
-#else
- if (((sizeof(size_t) == sizeof(mz_uint32))) && (alloc_size > 0x7FFFFFFF))
-#endif
- return NULL;
- if (NULL == (pBuf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)alloc_size)))
- return NULL;
-
- if (!mz_zip_reader_extract_to_mem(pZip, file_index, pBuf, (size_t)alloc_size, flags))
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf);
- return NULL;
- }
-
- if (pSize) *pSize = (size_t)alloc_size;
- return pBuf;
-}
-
-void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize, mz_uint flags)
-{
- int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags);
- if (file_index < 0)
- {
- if (pSize) *pSize = 0;
- return MZ_FALSE;
- }
- return mz_zip_reader_extract_to_heap(pZip, file_index, pSize, flags);
-}
-
-mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, mz_uint file_index, mz_file_write_func pCallback, void *pOpaque, mz_uint flags)
-{
- int status = TINFL_STATUS_DONE; mz_uint file_crc32 = MZ_CRC32_INIT;
- mz_uint64 read_buf_size, read_buf_ofs = 0, read_buf_avail, comp_remaining, out_buf_ofs = 0, cur_file_ofs;
- mz_zip_archive_file_stat file_stat;
- void *pRead_buf = NULL; void *pWrite_buf = NULL;
- mz_uint32 local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / sizeof(mz_uint32)]; mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32;
-
- if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat))
- return MZ_FALSE;
-
- if (!file_stat.m_comp_size)
- return MZ_TRUE;
-
- // Encryption and patch files are not supported.
- if (file_stat.m_bit_flag & (1 | 32))
- return MZ_FALSE;
-
- // This function only supports stored and deflate.
- if ((!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (file_stat.m_method != 0) && (file_stat.m_method != MZ_DEFLATED))
- return MZ_FALSE;
-
- // Read and parse the local directory entry.
- cur_file_ofs = file_stat.m_local_header_ofs;
- if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE)
- return MZ_FALSE;
- if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG)
- return MZ_FALSE;
-
- cur_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS);
- if ((cur_file_ofs + file_stat.m_comp_size) > pZip->m_archive_size)
- return MZ_FALSE;
-
- // Decompress the file either directly from memory or from a file input buffer.
- if (pZip->m_pState->m_pMem)
- {
- pRead_buf = (mz_uint8 *)pZip->m_pState->m_pMem + cur_file_ofs;
- read_buf_size = read_buf_avail = file_stat.m_comp_size;
- comp_remaining = 0;
- }
- else
- {
- read_buf_size = MZ_MIN(file_stat.m_comp_size, MZ_ZIP_MAX_IO_BUF_SIZE);
- if (NULL == (pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)read_buf_size)))
- return MZ_FALSE;
- read_buf_avail = 0;
- comp_remaining = file_stat.m_comp_size;
- }
-
- if ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) || (!file_stat.m_method))
- {
- // The file is stored or the caller has requested the compressed data.
- if (pZip->m_pState->m_pMem)
- {
-#ifdef _MSC_VER
- if (((0, sizeof(size_t) == sizeof(mz_uint32))) && (file_stat.m_comp_size > 0xFFFFFFFF))
-#else
- if (((sizeof(size_t) == sizeof(mz_uint32))) && (file_stat.m_comp_size > 0xFFFFFFFF))
-#endif
- return MZ_FALSE;
- if (pCallback(pOpaque, out_buf_ofs, pRead_buf, (size_t)file_stat.m_comp_size) != file_stat.m_comp_size)
- status = TINFL_STATUS_FAILED;
- else if (!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA))
- file_crc32 = (mz_uint32)mz_crc32(file_crc32, (const mz_uint8 *)pRead_buf, (size_t)file_stat.m_comp_size);
- cur_file_ofs += file_stat.m_comp_size;
- out_buf_ofs += file_stat.m_comp_size;
- comp_remaining = 0;
- }
- else
- {
- while (comp_remaining)
- {
- read_buf_avail = MZ_MIN(read_buf_size, comp_remaining);
- if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf_avail)
- {
- status = TINFL_STATUS_FAILED;
- break;
- }
-
- if (!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA))
- file_crc32 = (mz_uint32)mz_crc32(file_crc32, (const mz_uint8 *)pRead_buf, (size_t)read_buf_avail);
-
- if (pCallback(pOpaque, out_buf_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf_avail)
- {
- status = TINFL_STATUS_FAILED;
- break;
- }
- cur_file_ofs += read_buf_avail;
- out_buf_ofs += read_buf_avail;
- comp_remaining -= read_buf_avail;
- }
- }
- }
- else
- {
- tinfl_decompressor inflator;
- tinfl_init(&inflator);
-
- if (NULL == (pWrite_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, TINFL_LZ_DICT_SIZE)))
- status = TINFL_STATUS_FAILED;
- else
- {
- do
- {
- mz_uint8 *pWrite_buf_cur = (mz_uint8 *)pWrite_buf + (out_buf_ofs & (TINFL_LZ_DICT_SIZE - 1));
- size_t in_buf_size, out_buf_size = TINFL_LZ_DICT_SIZE - (out_buf_ofs & (TINFL_LZ_DICT_SIZE - 1));
- if ((!read_buf_avail) && (!pZip->m_pState->m_pMem))
- {
- read_buf_avail = MZ_MIN(read_buf_size, comp_remaining);
- if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf_avail)
- {
- status = TINFL_STATUS_FAILED;
- break;
- }
- cur_file_ofs += read_buf_avail;
- comp_remaining -= read_buf_avail;
- read_buf_ofs = 0;
- }
-
- in_buf_size = (size_t)read_buf_avail;
- status = tinfl_decompress(&inflator, (const mz_uint8 *)pRead_buf + read_buf_ofs, &in_buf_size, (mz_uint8 *)pWrite_buf, pWrite_buf_cur, &out_buf_size, comp_remaining ? TINFL_FLAG_HAS_MORE_INPUT : 0);
- read_buf_avail -= in_buf_size;
- read_buf_ofs += in_buf_size;
-
- if (out_buf_size)
- {
- if (pCallback(pOpaque, out_buf_ofs, pWrite_buf_cur, out_buf_size) != out_buf_size)
- {
- status = TINFL_STATUS_FAILED;
- break;
- }
- file_crc32 = (mz_uint32)mz_crc32(file_crc32, pWrite_buf_cur, out_buf_size);
- if ((out_buf_ofs += out_buf_size) > file_stat.m_uncomp_size)
- {
- status = TINFL_STATUS_FAILED;
- break;
- }
- }
- } while ((status == TINFL_STATUS_NEEDS_MORE_INPUT) || (status == TINFL_STATUS_HAS_MORE_OUTPUT));
- }
- }
-
- if ((status == TINFL_STATUS_DONE) && (!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)))
- {
- // Make sure the entire file was decompressed, and check its CRC.
- if ((out_buf_ofs != file_stat.m_uncomp_size) || (file_crc32 != file_stat.m_crc32))
- status = TINFL_STATUS_FAILED;
- }
-
- if (!pZip->m_pState->m_pMem)
- pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf);
- if (pWrite_buf)
- pZip->m_pFree(pZip->m_pAlloc_opaque, pWrite_buf);
-
- return status == TINFL_STATUS_DONE;
-}
-
-mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, const char *pFilename, mz_file_write_func pCallback, void *pOpaque, mz_uint flags)
-{
- int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags);
- if (file_index < 0)
- return MZ_FALSE;
- return mz_zip_reader_extract_to_callback(pZip, file_index, pCallback, pOpaque, flags);
-}
-
-#ifndef MINIZ_NO_STDIO
-static size_t mz_zip_file_write_callback(void *pOpaque, mz_uint64 ofs, const void *pBuf, size_t n)
-{
- (void)ofs; return MZ_FWRITE(pBuf, 1, n, (MZ_FILE*)pOpaque);
-}
-
-mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags)
-{
- mz_bool status;
- mz_zip_archive_file_stat file_stat;
- MZ_FILE *pFile;
- if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat))
- return MZ_FALSE;
- pFile = MZ_FOPEN(pDst_filename, "wb");
- if (!pFile)
- return MZ_FALSE;
- status = mz_zip_reader_extract_to_callback(pZip, file_index, mz_zip_file_write_callback, pFile, flags);
- if (MZ_FCLOSE(pFile) == EOF)
- return MZ_FALSE;
-#ifndef MINIZ_NO_TIME
- if (status)
- mz_zip_set_file_times(pDst_filename, file_stat.m_time, file_stat.m_time);
-#endif
- return status;
-}
-#endif // #ifndef MINIZ_NO_STDIO
-
-mz_bool mz_zip_reader_end(mz_zip_archive *pZip)
-{
- if ((!pZip) || (!pZip->m_pState) || (!pZip->m_pAlloc) || (!pZip->m_pFree) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING))
- return MZ_FALSE;
-
- if (pZip->m_pState)
- {
- mz_zip_internal_state *pState = pZip->m_pState; pZip->m_pState = NULL;
- mz_zip_array_clear(pZip, &pState->m_central_dir);
- mz_zip_array_clear(pZip, &pState->m_central_dir_offsets);
- mz_zip_array_clear(pZip, &pState->m_sorted_central_dir_offsets);
-
-#ifndef MINIZ_NO_STDIO
- if (pState->m_pFile)
- {
- MZ_FCLOSE(pState->m_pFile);
- pState->m_pFile = NULL;
- }
-#endif // #ifndef MINIZ_NO_STDIO
-
- pZip->m_pFree(pZip->m_pAlloc_opaque, pState);
- }
- pZip->m_zip_mode = MZ_ZIP_MODE_INVALID;
-
- return MZ_TRUE;
-}
-
-#ifndef MINIZ_NO_STDIO
-mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags)
-{
- int file_index = mz_zip_reader_locate_file(pZip, pArchive_filename, NULL, flags);
- if (file_index < 0)
- return MZ_FALSE;
- return mz_zip_reader_extract_to_file(pZip, file_index, pDst_filename, flags);
-}
-#endif
-
-// ------------------- .ZIP archive writing
-
-#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
-
-static void mz_write_le16(mz_uint8 *p, mz_uint16 v) { p[0] = (mz_uint8)v; p[1] = (mz_uint8)(v >> 8); }
-static void mz_write_le32(mz_uint8 *p, mz_uint32 v) { p[0] = (mz_uint8)v; p[1] = (mz_uint8)(v >> 8); p[2] = (mz_uint8)(v >> 16); p[3] = (mz_uint8)(v >> 24); }
-#define MZ_WRITE_LE16(p, v) mz_write_le16((mz_uint8 *)(p), (mz_uint16)(v))
-#define MZ_WRITE_LE32(p, v) mz_write_le32((mz_uint8 *)(p), (mz_uint32)(v))
-
-mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size)
-{
- if ((!pZip) || (pZip->m_pState) || (!pZip->m_pWrite) || (pZip->m_zip_mode != MZ_ZIP_MODE_INVALID))
- return MZ_FALSE;
-
- if (pZip->m_file_offset_alignment)
- {
- // Ensure user specified file offset alignment is a power of 2.
- if (pZip->m_file_offset_alignment & (pZip->m_file_offset_alignment - 1))
- return MZ_FALSE;
- }
-
- if (!pZip->m_pAlloc) pZip->m_pAlloc = def_alloc_func;
- if (!pZip->m_pFree) pZip->m_pFree = def_free_func;
- if (!pZip->m_pRealloc) pZip->m_pRealloc = def_realloc_func;
-
- pZip->m_zip_mode = MZ_ZIP_MODE_WRITING;
- pZip->m_archive_size = existing_size;
- pZip->m_central_directory_file_ofs = 0;
- pZip->m_total_files = 0;
-
- if (NULL == (pZip->m_pState = (mz_zip_internal_state *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(mz_zip_internal_state))))
- return MZ_FALSE;
- memset(pZip->m_pState, 0, sizeof(mz_zip_internal_state));
- MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir, sizeof(mz_uint8));
- MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir_offsets, sizeof(mz_uint32));
- MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_sorted_central_dir_offsets, sizeof(mz_uint32));
- return MZ_TRUE;
-}
-
-static size_t mz_zip_heap_write_func(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n)
-{
- mz_zip_archive *pZip = (mz_zip_archive *)pOpaque;
- mz_zip_internal_state *pState = pZip->m_pState;
- mz_uint64 new_size = MZ_MAX(file_ofs + n, pState->m_mem_size);
-#ifdef _MSC_VER
- if ((!n) || ((0, sizeof(size_t) == sizeof(mz_uint32)) && (new_size > 0x7FFFFFFF)))
-#else
- if ((!n) || ((sizeof(size_t) == sizeof(mz_uint32)) && (new_size > 0x7FFFFFFF)))
-#endif
- return 0;
- if (new_size > pState->m_mem_capacity)
- {
- void *pNew_block;
- size_t new_capacity = MZ_MAX(64, pState->m_mem_capacity); while (new_capacity < new_size) new_capacity *= 2;
- if (NULL == (pNew_block = pZip->m_pRealloc(pZip->m_pAlloc_opaque, pState->m_pMem, 1, new_capacity)))
- return 0;
- pState->m_pMem = pNew_block; pState->m_mem_capacity = new_capacity;
- }
- memcpy((mz_uint8 *)pState->m_pMem + file_ofs, pBuf, n);
- pState->m_mem_size = (size_t)new_size;
- return n;
-}
-
-mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size)
-{
- pZip->m_pWrite = mz_zip_heap_write_func;
- pZip->m_pIO_opaque = pZip;
- if (!mz_zip_writer_init(pZip, size_to_reserve_at_beginning))
- return MZ_FALSE;
- if (0 != (initial_allocation_size = MZ_MAX(initial_allocation_size, size_to_reserve_at_beginning)))
- {
- if (NULL == (pZip->m_pState->m_pMem = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, initial_allocation_size)))
- {
- mz_zip_writer_end(pZip);
- return MZ_FALSE;
- }
- pZip->m_pState->m_mem_capacity = initial_allocation_size;
- }
- return MZ_TRUE;
-}
-
-#ifndef MINIZ_NO_STDIO
-static size_t mz_zip_file_write_func(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n)
-{
- mz_zip_archive *pZip = (mz_zip_archive *)pOpaque;
- mz_int64 cur_ofs = MZ_FTELL64(pZip->m_pState->m_pFile);
- if (((mz_int64)file_ofs < 0) || (((cur_ofs != (mz_int64)file_ofs)) && (MZ_FSEEK64(pZip->m_pState->m_pFile, (mz_int64)file_ofs, SEEK_SET))))
- return 0;
- return MZ_FWRITE(pBuf, 1, n, pZip->m_pState->m_pFile);
-}
-
-mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning)
-{
- MZ_FILE *pFile;
- pZip->m_pWrite = mz_zip_file_write_func;
- pZip->m_pIO_opaque = pZip;
- if (!mz_zip_writer_init(pZip, size_to_reserve_at_beginning))
- return MZ_FALSE;
- if (NULL == (pFile = MZ_FOPEN(pFilename, "wb")))
- {
- mz_zip_writer_end(pZip);
- return MZ_FALSE;
- }
- pZip->m_pState->m_pFile = pFile;
- if (size_to_reserve_at_beginning)
- {
- mz_uint64 cur_ofs = 0; char buf[4096]; MZ_CLEAR_OBJ(buf);
- do
- {
- size_t n = (size_t)MZ_MIN(sizeof(buf), size_to_reserve_at_beginning);
- if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_ofs, buf, n) != n)
- {
- mz_zip_writer_end(pZip);
- return MZ_FALSE;
- }
- cur_ofs += n; size_to_reserve_at_beginning -= n;
- } while (size_to_reserve_at_beginning);
- }
- return MZ_TRUE;
-}
-#endif // #ifndef MINIZ_NO_STDIO
-
-mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, const char *pFilename)
-{
- mz_zip_internal_state *pState;
- if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING))
- return MZ_FALSE;
- // No sense in trying to write to an archive that's already at the support max size
- if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + MZ_ZIP_LOCAL_DIR_HEADER_SIZE) > 0xFFFFFFFF))
- return MZ_FALSE;
-
- pState = pZip->m_pState;
-
- if (pState->m_pFile)
- {
-#ifdef MINIZ_NO_STDIO
- pFilename; return MZ_FALSE;
-#else
- // Archive is being read from stdio - try to reopen as writable.
- if (pZip->m_pIO_opaque != pZip)
- return MZ_FALSE;
- if (!pFilename)
- return MZ_FALSE;
- pZip->m_pWrite = mz_zip_file_write_func;
- if (NULL == (pState->m_pFile = MZ_FREOPEN(pFilename, "r+b", pState->m_pFile)))
- {
- // The mz_zip_archive is now in a bogus state because pState->m_pFile is NULL, so just close it.
- mz_zip_reader_end(pZip);
- return MZ_FALSE;
- }
-#endif // #ifdef MINIZ_NO_STDIO
- }
- else if (pState->m_pMem)
- {
- // Archive lives in a memory block. Assume it's from the heap that we can resize using the realloc callback.
- if (pZip->m_pIO_opaque != pZip)
- return MZ_FALSE;
- pState->m_mem_capacity = pState->m_mem_size;
- pZip->m_pWrite = mz_zip_heap_write_func;
- }
- // Archive is being read via a user provided read function - make sure the user has specified a write function too.
- else if (!pZip->m_pWrite)
- return MZ_FALSE;
-
- // Start writing new files at the archive's current central directory location.
- pZip->m_archive_size = pZip->m_central_directory_file_ofs;
- pZip->m_zip_mode = MZ_ZIP_MODE_WRITING;
- pZip->m_central_directory_file_ofs = 0;
-
- return MZ_TRUE;
-}
-
-mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags)
-{
- return mz_zip_writer_add_mem_ex(pZip, pArchive_name, pBuf, buf_size, NULL, 0, level_and_flags, 0, 0);
-}
-
-typedef struct
-{
- mz_zip_archive *m_pZip;
- mz_uint64 m_cur_archive_file_ofs;
- mz_uint64 m_comp_size;
-} mz_zip_writer_add_state;
-
-static mz_bool mz_zip_writer_add_put_buf_callback(const void* pBuf, int len, void *pUser)
-{
- mz_zip_writer_add_state *pState = (mz_zip_writer_add_state *)pUser;
- if ((int)pState->m_pZip->m_pWrite(pState->m_pZip->m_pIO_opaque, pState->m_cur_archive_file_ofs, pBuf, len) != len)
- return MZ_FALSE;
- pState->m_cur_archive_file_ofs += len;
- pState->m_comp_size += len;
- return MZ_TRUE;
-}
-
-static mz_bool mz_zip_writer_create_local_dir_header(mz_zip_archive *pZip, mz_uint8 *pDst, mz_uint16 filename_size, mz_uint16 extra_size, mz_uint64 uncomp_size, mz_uint64 comp_size, mz_uint32 uncomp_crc32, mz_uint16 method, mz_uint16 bit_flags, mz_uint16 dos_time, mz_uint16 dos_date)
-{
- (void)pZip;
- memset(pDst, 0, MZ_ZIP_LOCAL_DIR_HEADER_SIZE);
- MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_SIG_OFS, MZ_ZIP_LOCAL_DIR_HEADER_SIG);
- MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_VERSION_NEEDED_OFS, method ? 20 : 0);
- MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_BIT_FLAG_OFS, bit_flags);
- MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_METHOD_OFS, method);
- MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_FILE_TIME_OFS, dos_time);
- MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_FILE_DATE_OFS, dos_date);
- MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_CRC32_OFS, uncomp_crc32);
- MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_COMPRESSED_SIZE_OFS, comp_size);
- MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_DECOMPRESSED_SIZE_OFS, uncomp_size);
- MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_FILENAME_LEN_OFS, filename_size);
- MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_EXTRA_LEN_OFS, extra_size);
- return MZ_TRUE;
-}
-
-static mz_bool mz_zip_writer_create_central_dir_header(mz_zip_archive *pZip, mz_uint8 *pDst, mz_uint16 filename_size, mz_uint16 extra_size, mz_uint16 comment_size, mz_uint64 uncomp_size, mz_uint64 comp_size, mz_uint32 uncomp_crc32, mz_uint16 method, mz_uint16 bit_flags, mz_uint16 dos_time, mz_uint16 dos_date, mz_uint64 local_header_ofs, mz_uint32 ext_attributes)
-{
- (void)pZip;
- memset(pDst, 0, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE);
- MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_SIG_OFS, MZ_ZIP_CENTRAL_DIR_HEADER_SIG);
- MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_VERSION_NEEDED_OFS, method ? 20 : 0);
- MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_BIT_FLAG_OFS, bit_flags);
- MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_METHOD_OFS, method);
- MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_FILE_TIME_OFS, dos_time);
- MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_FILE_DATE_OFS, dos_date);
- MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_CRC32_OFS, uncomp_crc32);
- MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS, comp_size);
- MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS, uncomp_size);
- MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_FILENAME_LEN_OFS, filename_size);
- MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_EXTRA_LEN_OFS, extra_size);
- MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_COMMENT_LEN_OFS, comment_size);
- MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS, ext_attributes);
- MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_LOCAL_HEADER_OFS, local_header_ofs);
- return MZ_TRUE;
-}
-
-static mz_bool mz_zip_writer_add_to_central_dir(mz_zip_archive *pZip, const char *pFilename, mz_uint16 filename_size, const void *pExtra, mz_uint16 extra_size, const void *pComment, mz_uint16 comment_size, mz_uint64 uncomp_size, mz_uint64 comp_size, mz_uint32 uncomp_crc32, mz_uint16 method, mz_uint16 bit_flags, mz_uint16 dos_time, mz_uint16 dos_date, mz_uint64 local_header_ofs, mz_uint32 ext_attributes)
-{
- mz_zip_internal_state *pState = pZip->m_pState;
- mz_uint32 central_dir_ofs = (mz_uint32)pState->m_central_dir.m_size;
- size_t orig_central_dir_size = pState->m_central_dir.m_size;
- mz_uint8 central_dir_header[MZ_ZIP_CENTRAL_DIR_HEADER_SIZE];
-
- // No zip64 support yet
- if ((local_header_ofs > 0xFFFFFFFF) || (((mz_uint64)pState->m_central_dir.m_size + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_size + extra_size + comment_size) > 0xFFFFFFFF))
- return MZ_FALSE;
-
- if (!mz_zip_writer_create_central_dir_header(pZip, central_dir_header, filename_size, extra_size, comment_size, uncomp_size, comp_size, uncomp_crc32, method, bit_flags, dos_time, dos_date, local_header_ofs, ext_attributes))
- return MZ_FALSE;
-
- if ((!mz_zip_array_push_back(pZip, &pState->m_central_dir, central_dir_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE)) ||
- (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pFilename, filename_size)) ||
- (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pExtra, extra_size)) ||
- (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pComment, comment_size)) ||
- (!mz_zip_array_push_back(pZip, &pState->m_central_dir_offsets, &central_dir_ofs, 1)))
- {
- // Try to push the central directory array back into its original state.
- mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE);
- return MZ_FALSE;
- }
-
- return MZ_TRUE;
-}
-
-static mz_bool mz_zip_writer_validate_archive_name(const char *pArchive_name)
-{
- // Basic ZIP archive filename validity checks: Valid filenames cannot start with a forward slash, cannot contain a drive letter, and cannot use DOS-style backward slashes.
- if (*pArchive_name == '/')
- return MZ_FALSE;
- while (*pArchive_name)
- {
- if ((*pArchive_name == '\\') || (*pArchive_name == ':'))
- return MZ_FALSE;
- pArchive_name++;
- }
- return MZ_TRUE;
-}
-
-static mz_uint mz_zip_writer_compute_padding_needed_for_file_alignment(mz_zip_archive *pZip)
-{
- mz_uint32 n;
- if (!pZip->m_file_offset_alignment)
- return 0;
- n = (mz_uint32)(pZip->m_archive_size & (pZip->m_file_offset_alignment - 1));
- return (pZip->m_file_offset_alignment - n) & (pZip->m_file_offset_alignment - 1);
-}
-
-static mz_bool mz_zip_writer_write_zeros(mz_zip_archive *pZip, mz_uint64 cur_file_ofs, mz_uint32 n)
-{
- char buf[4096];
- memset(buf, 0, MZ_MIN(sizeof(buf), n));
- while (n)
- {
- mz_uint32 s = MZ_MIN(sizeof(buf), n);
- if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_file_ofs, buf, s) != s)
- return MZ_FALSE;
- cur_file_ofs += s; n -= s;
- }
- return MZ_TRUE;
-}
-
-mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_uint64 uncomp_size, mz_uint32 uncomp_crc32)
-{
- mz_uint16 method = 0, dos_time = 0, dos_date = 0;
- mz_uint level, ext_attributes = 0, num_alignment_padding_bytes;
- mz_uint64 local_dir_header_ofs = pZip->m_archive_size, cur_archive_file_ofs = pZip->m_archive_size, comp_size = 0;
- size_t archive_name_size;
- mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE];
- tdefl_compressor *pComp = NULL;
- mz_bool store_data_uncompressed;
- mz_zip_internal_state *pState;
-
- if ((int)level_and_flags < 0)
- level_and_flags = MZ_DEFAULT_LEVEL;
- level = level_and_flags & 0xF;
- store_data_uncompressed = ((!level) || (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA));
-
- if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || ((buf_size) && (!pBuf)) || (!pArchive_name) || ((comment_size) && (!pComment)) || (pZip->m_total_files == 0xFFFF) || (level > MZ_UBER_COMPRESSION))
- return MZ_FALSE;
-
- pState = pZip->m_pState;
-
- if ((!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (uncomp_size))
- return MZ_FALSE;
- // No zip64 support yet
- if ((buf_size > 0xFFFFFFFF) || (uncomp_size > 0xFFFFFFFF))
- return MZ_FALSE;
- if (!mz_zip_writer_validate_archive_name(pArchive_name))
- return MZ_FALSE;
-
-#ifndef MINIZ_NO_TIME
- {
- time_t cur_time; time(&cur_time);
- mz_zip_time_to_dos_time(cur_time, &dos_time, &dos_date);
- }
-#endif // #ifndef MINIZ_NO_TIME
-
- archive_name_size = strlen(pArchive_name);
- if (archive_name_size > 0xFFFF)
- return MZ_FALSE;
-
- num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip);
-
- // no zip64 support yet
- if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + comment_size + archive_name_size) > 0xFFFFFFFF))
- return MZ_FALSE;
-
- if ((archive_name_size) && (pArchive_name[archive_name_size - 1] == '/'))
- {
- // Set DOS Subdirectory attribute bit.
- ext_attributes |= 0x10;
- // Subdirectories cannot contain data.
- if ((buf_size) || (uncomp_size))
- return MZ_FALSE;
- }
-
- // Try to do any allocations before writing to the archive, so if an allocation fails the file remains unmodified. (A good idea if we're doing an in-place modification.)
- if ((!mz_zip_array_ensure_room(pZip, &pState->m_central_dir, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + archive_name_size + comment_size)) || (!mz_zip_array_ensure_room(pZip, &pState->m_central_dir_offsets, 1)))
- return MZ_FALSE;
-
- if ((!store_data_uncompressed) && (buf_size))
- {
- if (NULL == (pComp = (tdefl_compressor *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(tdefl_compressor))))
- return MZ_FALSE;
- }
-
- if (!mz_zip_writer_write_zeros(pZip, cur_archive_file_ofs, num_alignment_padding_bytes + sizeof(local_dir_header)))
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pComp);
- return MZ_FALSE;
- }
- local_dir_header_ofs += num_alignment_padding_bytes;
- if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == 0); }
- cur_archive_file_ofs += num_alignment_padding_bytes + sizeof(local_dir_header);
-
- MZ_CLEAR_OBJ(local_dir_header);
- if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pArchive_name, archive_name_size) != archive_name_size)
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pComp);
- return MZ_FALSE;
- }
- cur_archive_file_ofs += archive_name_size;
-
- if (!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA))
- {
- uncomp_crc32 = (mz_uint32)mz_crc32(MZ_CRC32_INIT, (const mz_uint8*)pBuf, buf_size);
- uncomp_size = buf_size;
- if (uncomp_size <= 3)
- {
- level = 0;
- store_data_uncompressed = MZ_TRUE;
- }
- }
-
- if (store_data_uncompressed)
- {
- if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pBuf, buf_size) != buf_size)
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pComp);
- return MZ_FALSE;
- }
-
- cur_archive_file_ofs += buf_size;
- comp_size = buf_size;
-
- if (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)
- method = MZ_DEFLATED;
- }
- else if (buf_size)
- {
- mz_zip_writer_add_state state;
-
- state.m_pZip = pZip;
- state.m_cur_archive_file_ofs = cur_archive_file_ofs;
- state.m_comp_size = 0;
-
- if ((tdefl_init(pComp, mz_zip_writer_add_put_buf_callback, &state, tdefl_create_comp_flags_from_zip_params(level, -15, MZ_DEFAULT_STRATEGY)) != TDEFL_STATUS_OKAY) ||
- (tdefl_compress_buffer(pComp, pBuf, buf_size, TDEFL_FINISH) != TDEFL_STATUS_DONE))
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pComp);
- return MZ_FALSE;
- }
-
- comp_size = state.m_comp_size;
- cur_archive_file_ofs = state.m_cur_archive_file_ofs;
-
- method = MZ_DEFLATED;
- }
-
- pZip->m_pFree(pZip->m_pAlloc_opaque, pComp);
- pComp = NULL;
-
- // no zip64 support yet
- if ((comp_size > 0xFFFFFFFF) || (cur_archive_file_ofs > 0xFFFFFFFF))
- return MZ_FALSE;
-
- if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, 0, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date))
- return MZ_FALSE;
-
- if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, sizeof(local_dir_header)) != sizeof(local_dir_header))
- return MZ_FALSE;
-
- if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, pComment, comment_size, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date, local_dir_header_ofs, ext_attributes))
- return MZ_FALSE;
-
- pZip->m_total_files++;
- pZip->m_archive_size = cur_archive_file_ofs;
-
- return MZ_TRUE;
-}
-
-#ifndef MINIZ_NO_STDIO
-mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags)
-{
- mz_uint uncomp_crc32 = MZ_CRC32_INIT, level, num_alignment_padding_bytes;
- mz_uint16 method = 0, dos_time = 0, dos_date = 0, ext_attributes = 0;
- mz_uint64 local_dir_header_ofs = pZip->m_archive_size, cur_archive_file_ofs = pZip->m_archive_size, uncomp_size = 0, comp_size = 0;
- size_t archive_name_size;
- mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE];
- MZ_FILE *pSrc_file = NULL;
-
- if ((int)level_and_flags < 0)
- level_and_flags = MZ_DEFAULT_LEVEL;
- level = level_and_flags & 0xF;
-
- if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || (!pArchive_name) || ((comment_size) && (!pComment)) || (level > MZ_UBER_COMPRESSION))
- return MZ_FALSE;
- if (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)
- return MZ_FALSE;
- if (!mz_zip_writer_validate_archive_name(pArchive_name))
- return MZ_FALSE;
-
- archive_name_size = strlen(pArchive_name);
- if (archive_name_size > 0xFFFF)
- return MZ_FALSE;
-
- num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip);
-
- // no zip64 support yet
- if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + comment_size + archive_name_size) > 0xFFFFFFFF))
- return MZ_FALSE;
-
- if (!mz_zip_get_file_modified_time(pSrc_filename, &dos_time, &dos_date))
- return MZ_FALSE;
-
- pSrc_file = MZ_FOPEN(pSrc_filename, "rb");
- if (!pSrc_file)
- return MZ_FALSE;
- MZ_FSEEK64(pSrc_file, 0, SEEK_END);
- uncomp_size = MZ_FTELL64(pSrc_file);
- MZ_FSEEK64(pSrc_file, 0, SEEK_SET);
-
- if (uncomp_size > 0xFFFFFFFF)
- {
- // No zip64 support yet
- MZ_FCLOSE(pSrc_file);
- return MZ_FALSE;
- }
- if (uncomp_size <= 3)
- level = 0;
-
- if (!mz_zip_writer_write_zeros(pZip, cur_archive_file_ofs, num_alignment_padding_bytes + sizeof(local_dir_header)))
- return MZ_FALSE;
- local_dir_header_ofs += num_alignment_padding_bytes;
- if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == 0); }
- cur_archive_file_ofs += num_alignment_padding_bytes + sizeof(local_dir_header);
-
- MZ_CLEAR_OBJ(local_dir_header);
- if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pArchive_name, archive_name_size) != archive_name_size)
- {
- MZ_FCLOSE(pSrc_file);
- return MZ_FALSE;
- }
- cur_archive_file_ofs += archive_name_size;
-
- if (uncomp_size)
- {
- mz_uint64 uncomp_remaining = uncomp_size;
- void *pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, MZ_ZIP_MAX_IO_BUF_SIZE);
- if (!pRead_buf)
- {
- MZ_FCLOSE(pSrc_file);
- return MZ_FALSE;
- }
-
- if (!level)
- {
- while (uncomp_remaining)
- {
- mz_uint n = (mz_uint)MZ_MIN(MZ_ZIP_MAX_IO_BUF_SIZE, uncomp_remaining);
- if ((MZ_FREAD(pRead_buf, 1, n, pSrc_file) != n) || (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pRead_buf, n) != n))
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf);
- MZ_FCLOSE(pSrc_file);
- return MZ_FALSE;
- }
- uncomp_crc32 = (mz_uint32)mz_crc32(uncomp_crc32, (const mz_uint8 *)pRead_buf, n);
- uncomp_remaining -= n;
- cur_archive_file_ofs += n;
- }
- comp_size = uncomp_size;
- }
- else
- {
- mz_bool result = MZ_FALSE;
- mz_zip_writer_add_state state;
- tdefl_compressor *pComp = (tdefl_compressor *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(tdefl_compressor));
- if (!pComp)
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf);
- MZ_FCLOSE(pSrc_file);
- return MZ_FALSE;
- }
-
- state.m_pZip = pZip;
- state.m_cur_archive_file_ofs = cur_archive_file_ofs;
- state.m_comp_size = 0;
-
- if (tdefl_init(pComp, mz_zip_writer_add_put_buf_callback, &state, tdefl_create_comp_flags_from_zip_params(level, -15, MZ_DEFAULT_STRATEGY)) != TDEFL_STATUS_OKAY)
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pComp);
- pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf);
- MZ_FCLOSE(pSrc_file);
- return MZ_FALSE;
- }
-
- for ( ; ; )
- {
- size_t in_buf_size = (mz_uint32)MZ_MIN(uncomp_remaining, MZ_ZIP_MAX_IO_BUF_SIZE);
- tdefl_status status;
-
- if (MZ_FREAD(pRead_buf, 1, in_buf_size, pSrc_file) != in_buf_size)
- break;
-
- uncomp_crc32 = (mz_uint32)mz_crc32(uncomp_crc32, (const mz_uint8 *)pRead_buf, in_buf_size);
- uncomp_remaining -= in_buf_size;
-
- status = tdefl_compress_buffer(pComp, pRead_buf, in_buf_size, uncomp_remaining ? TDEFL_NO_FLUSH : TDEFL_FINISH);
- if (status == TDEFL_STATUS_DONE)
- {
- result = MZ_TRUE;
- break;
- }
- else if (status != TDEFL_STATUS_OKAY)
- break;
- }
-
- pZip->m_pFree(pZip->m_pAlloc_opaque, pComp);
-
- if (!result)
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf);
- MZ_FCLOSE(pSrc_file);
- return MZ_FALSE;
- }
-
- comp_size = state.m_comp_size;
- cur_archive_file_ofs = state.m_cur_archive_file_ofs;
-
- method = MZ_DEFLATED;
- }
-
- pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf);
- }
-
- MZ_FCLOSE(pSrc_file); pSrc_file = NULL;
-
- // no zip64 support yet
- if ((comp_size > 0xFFFFFFFF) || (cur_archive_file_ofs > 0xFFFFFFFF))
- return MZ_FALSE;
-
- if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, 0, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date))
- return MZ_FALSE;
-
- if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, sizeof(local_dir_header)) != sizeof(local_dir_header))
- return MZ_FALSE;
-
- if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, pComment, comment_size, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date, local_dir_header_ofs, ext_attributes))
- return MZ_FALSE;
-
- pZip->m_total_files++;
- pZip->m_archive_size = cur_archive_file_ofs;
-
- return MZ_TRUE;
-}
-#endif // #ifndef MINIZ_NO_STDIO
-
-mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive *pSource_zip, mz_uint file_index)
-{
- mz_uint n, bit_flags, num_alignment_padding_bytes;
- mz_uint64 comp_bytes_remaining, local_dir_header_ofs;
- mz_uint64 cur_src_file_ofs, cur_dst_file_ofs;
- mz_uint32 local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / sizeof(mz_uint32)]; mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32;
- mz_uint8 central_header[MZ_ZIP_CENTRAL_DIR_HEADER_SIZE];
- size_t orig_central_dir_size;
- mz_zip_internal_state *pState;
- void *pBuf; const mz_uint8 *pSrc_central_header;
-
- if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING))
- return MZ_FALSE;
- if (NULL == (pSrc_central_header = mz_zip_reader_get_cdh(pSource_zip, file_index)))
- return MZ_FALSE;
- pState = pZip->m_pState;
-
- num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip);
-
- // no zip64 support yet
- if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE) > 0xFFFFFFFF))
- return MZ_FALSE;
-
- cur_src_file_ofs = MZ_READ_LE32(pSrc_central_header + MZ_ZIP_CDH_LOCAL_HEADER_OFS);
- cur_dst_file_ofs = pZip->m_archive_size;
-
- if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE)
- return MZ_FALSE;
- if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG)
- return MZ_FALSE;
- cur_src_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE;
-
- if (!mz_zip_writer_write_zeros(pZip, cur_dst_file_ofs, num_alignment_padding_bytes))
- return MZ_FALSE;
- cur_dst_file_ofs += num_alignment_padding_bytes;
- local_dir_header_ofs = cur_dst_file_ofs;
- if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == 0); }
-
- if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE)
- return MZ_FALSE;
- cur_dst_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE;
-
- n = MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS);
- comp_bytes_remaining = n + MZ_READ_LE32(pSrc_central_header + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS);
-
- if (NULL == (pBuf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)MZ_MAX(sizeof(mz_uint32) * 4, MZ_MIN(MZ_ZIP_MAX_IO_BUF_SIZE, comp_bytes_remaining)))))
- return MZ_FALSE;
-
- while (comp_bytes_remaining)
- {
- n = (mz_uint)MZ_MIN(MZ_ZIP_MAX_IO_BUF_SIZE, comp_bytes_remaining);
- if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pBuf, n) != n)
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf);
- return MZ_FALSE;
- }
- cur_src_file_ofs += n;
-
- if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pBuf, n) != n)
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf);
- return MZ_FALSE;
- }
- cur_dst_file_ofs += n;
-
- comp_bytes_remaining -= n;
- }
-
- bit_flags = MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_BIT_FLAG_OFS);
- if (bit_flags & 8)
- {
- // Copy data descriptor
- if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pBuf, sizeof(mz_uint32) * 4) != sizeof(mz_uint32) * 4)
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf);
- return MZ_FALSE;
- }
-
- n = sizeof(mz_uint32) * ((MZ_READ_LE32(pBuf) == 0x08074b50) ? 4 : 3);
- if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pBuf, n) != n)
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf);
- return MZ_FALSE;
- }
-
- cur_src_file_ofs += n;
- cur_dst_file_ofs += n;
- }
- pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf);
-
- // no zip64 support yet
- if (cur_dst_file_ofs > 0xFFFFFFFF)
- return MZ_FALSE;
-
- orig_central_dir_size = pState->m_central_dir.m_size;
-
- memcpy(central_header, pSrc_central_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE);
- MZ_WRITE_LE32(central_header + MZ_ZIP_CDH_LOCAL_HEADER_OFS, local_dir_header_ofs);
- if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, central_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE))
- return MZ_FALSE;
-
- n = MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_EXTRA_LEN_OFS) + MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_COMMENT_LEN_OFS);
- if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pSrc_central_header + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n))
- {
- mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE);
- return MZ_FALSE;
- }
-
- if (pState->m_central_dir.m_size > 0xFFFFFFFF)
- return MZ_FALSE;
- n = (mz_uint32)pState->m_central_dir.m_size;
- if (!mz_zip_array_push_back(pZip, &pState->m_central_dir_offsets, &n, 1))
- {
- mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE);
- return MZ_FALSE;
- }
-
- pZip->m_total_files++;
- pZip->m_archive_size = cur_dst_file_ofs;
-
- return MZ_TRUE;
-}
-
-mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip)
-{
- mz_zip_internal_state *pState;
- mz_uint64 central_dir_ofs, central_dir_size;
- mz_uint8 hdr[MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE];
-
- if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING))
- return MZ_FALSE;
-
- pState = pZip->m_pState;
-
- // no zip64 support yet
- if ((pZip->m_total_files > 0xFFFF) || ((pZip->m_archive_size + pState->m_central_dir.m_size + MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) > 0xFFFFFFFF))
- return MZ_FALSE;
-
- central_dir_ofs = 0;
- central_dir_size = 0;
- if (pZip->m_total_files)
- {
- // Write central directory
- central_dir_ofs = pZip->m_archive_size;
- central_dir_size = pState->m_central_dir.m_size;
- pZip->m_central_directory_file_ofs = central_dir_ofs;
- if (pZip->m_pWrite(pZip->m_pIO_opaque, central_dir_ofs, pState->m_central_dir.m_p, (size_t)central_dir_size) != central_dir_size)
- return MZ_FALSE;
- pZip->m_archive_size += central_dir_size;
- }
-
- // Write end of central directory record
- MZ_CLEAR_OBJ(hdr);
- MZ_WRITE_LE32(hdr + MZ_ZIP_ECDH_SIG_OFS, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG);
- MZ_WRITE_LE16(hdr + MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS, pZip->m_total_files);
- MZ_WRITE_LE16(hdr + MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS, pZip->m_total_files);
- MZ_WRITE_LE32(hdr + MZ_ZIP_ECDH_CDIR_SIZE_OFS, central_dir_size);
- MZ_WRITE_LE32(hdr + MZ_ZIP_ECDH_CDIR_OFS_OFS, central_dir_ofs);
-
- if (pZip->m_pWrite(pZip->m_pIO_opaque, pZip->m_archive_size, hdr, sizeof(hdr)) != sizeof(hdr))
- return MZ_FALSE;
-#ifndef MINIZ_NO_STDIO
- if ((pState->m_pFile) && (MZ_FFLUSH(pState->m_pFile) == EOF))
- return MZ_FALSE;
-#endif // #ifndef MINIZ_NO_STDIO
-
- pZip->m_archive_size += sizeof(hdr);
-
- pZip->m_zip_mode = MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED;
- return MZ_TRUE;
-}
-
-mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **pBuf, size_t *pSize)
-{
- if ((!pZip) || (!pZip->m_pState) || (!pBuf) || (!pSize))
- return MZ_FALSE;
- if (pZip->m_pWrite != mz_zip_heap_write_func)
- return MZ_FALSE;
- if (!mz_zip_writer_finalize_archive(pZip))
- return MZ_FALSE;
-
- *pBuf = pZip->m_pState->m_pMem;
- *pSize = pZip->m_pState->m_mem_size;
- pZip->m_pState->m_pMem = NULL;
- pZip->m_pState->m_mem_size = pZip->m_pState->m_mem_capacity = 0;
- return MZ_TRUE;
-}
-
-mz_bool mz_zip_writer_end(mz_zip_archive *pZip)
-{
- mz_zip_internal_state *pState;
- mz_bool status = MZ_TRUE;
- if ((!pZip) || (!pZip->m_pState) || (!pZip->m_pAlloc) || (!pZip->m_pFree) || ((pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) && (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED)))
- return MZ_FALSE;
-
- pState = pZip->m_pState;
- pZip->m_pState = NULL;
- mz_zip_array_clear(pZip, &pState->m_central_dir);
- mz_zip_array_clear(pZip, &pState->m_central_dir_offsets);
- mz_zip_array_clear(pZip, &pState->m_sorted_central_dir_offsets);
-
-#ifndef MINIZ_NO_STDIO
- if (pState->m_pFile)
- {
- MZ_FCLOSE(pState->m_pFile);
- pState->m_pFile = NULL;
- }
-#endif // #ifndef MINIZ_NO_STDIO
-
- if ((pZip->m_pWrite == mz_zip_heap_write_func) && (pState->m_pMem))
- {
- pZip->m_pFree(pZip->m_pAlloc_opaque, pState->m_pMem);
- pState->m_pMem = NULL;
- }
-
- pZip->m_pFree(pZip->m_pAlloc_opaque, pState);
- pZip->m_zip_mode = MZ_ZIP_MODE_INVALID;
- return status;
-}
-
-#ifndef MINIZ_NO_STDIO
-mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags)
-{
- mz_bool status, created_new_archive = MZ_FALSE;
- mz_zip_archive zip_archive;
- struct MZ_FILE_STAT_STRUCT file_stat;
- MZ_CLEAR_OBJ(zip_archive);
- if ((int)level_and_flags < 0)
- level_and_flags = MZ_DEFAULT_LEVEL;
- if ((!pZip_filename) || (!pArchive_name) || ((buf_size) && (!pBuf)) || ((comment_size) && (!pComment)) || ((level_and_flags & 0xF) > MZ_UBER_COMPRESSION))
- return MZ_FALSE;
- if (!mz_zip_writer_validate_archive_name(pArchive_name))
- return MZ_FALSE;
- if (MZ_FILE_STAT(pZip_filename, &file_stat) != 0)
- {
- // Create a new archive.
- if (!mz_zip_writer_init_file(&zip_archive, pZip_filename, 0))
- return MZ_FALSE;
- created_new_archive = MZ_TRUE;
- }
- else
- {
- // Append to an existing archive.
- if (!mz_zip_reader_init_file(&zip_archive, pZip_filename, level_and_flags | MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY))
- return MZ_FALSE;
- if (!mz_zip_writer_init_from_reader(&zip_archive, pZip_filename))
- {
- mz_zip_reader_end(&zip_archive);
- return MZ_FALSE;
- }
- }
- status = mz_zip_writer_add_mem_ex(&zip_archive, pArchive_name, pBuf, buf_size, pComment, comment_size, level_and_flags, 0, 0);
- // Always finalize, even if adding failed for some reason, so we have a valid central directory. (This may not always succeed, but we can try.)
- if (!mz_zip_writer_finalize_archive(&zip_archive))
- status = MZ_FALSE;
- if (!mz_zip_writer_end(&zip_archive))
- status = MZ_FALSE;
- if ((!status) && (created_new_archive))
- {
- // It's a new archive and something went wrong, so just delete it.
- int ignoredStatus = MZ_DELETE_FILE(pZip_filename);
- (void)ignoredStatus;
- }
- return status;
-}
-
-void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, const char *pComment, size_t *pSize, mz_uint flags)
-{
- int file_index;
- mz_zip_archive zip_archive;
- void *p = NULL;
-
- if (pSize)
- *pSize = 0;
-
- if ((!pZip_filename) || (!pArchive_name))
- return NULL;
-
- MZ_CLEAR_OBJ(zip_archive);
- if (!mz_zip_reader_init_file(&zip_archive, pZip_filename, flags | MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY))
- return NULL;
-
- if ((file_index = mz_zip_reader_locate_file(&zip_archive, pArchive_name, pComment, flags)) >= 0)
- p = mz_zip_reader_extract_to_heap(&zip_archive, file_index, pSize, flags);
-
- mz_zip_reader_end(&zip_archive);
- return p;
-}
-
-#endif // #ifndef MINIZ_NO_STDIO
-
-#endif // #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
-
-#endif // #ifndef MINIZ_NO_ARCHIVE_APIS
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // MINIZ_HEADER_FILE_ONLY
-
-/*
- This is free and unencumbered software released into the public domain.
-
- Anyone is free to copy, modify, publish, use, compile, sell, or
- distribute this software, either in source code form or as a compiled
- binary, for any purpose, commercial or non-commercial, and by any
- means.
-
- In jurisdictions that recognize copyright laws, the author or authors
- of this software dedicate any and all copyright interest in the
- software to the public domain. We make this dedication for the benefit
- of the public at large and to the detriment of our heirs and
- successors. We intend this dedication to be an overt act of
- relinquishment in perpetuity of all present and future rights to this
- software under copyright law.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-
- For more information, please refer to <http://unlicense.org/>
-*/
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_miniz.h b/Libraries/crunch-ea9b8d/crnlib/crn_miniz.h
deleted file mode 100644
index 6d518c62..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_miniz.h
+++ /dev/null
@@ -1,893 +0,0 @@
-/* miniz.c v1.14 - public domain deflate/inflate, zlib-subset, ZIP reading/writing/appending, PNG writing
- See "unlicense" statement at the end of this file.
- Rich Geldreich <richgel99@gmail.com>, last updated May 20, 2012
- Implements RFC 1950: http://www.ietf.org/rfc/rfc1950.txt and RFC 1951: http://www.ietf.org/rfc/rfc1951.txt
-
- Most API's defined in miniz.c are optional. For example, to disable the archive related functions just define
- MINIZ_NO_ARCHIVE_APIS, or to get rid of all stdio usage define MINIZ_NO_STDIO (see the list below for more macros).
-
- * Change History
- 5/20/12 v1.14 - MinGW32/64 GCC 4.6.1 compiler fixes: added MZ_FORCEINLINE, #include <time.h> (thanks fermtect).
- 5/19/12 v1.13 - From jason@cornsyrup.org and kelwert@mtu.edu - Fix mz_crc32() so it doesn't compute the wrong CRC-32's when mz_ulong is 64-bit.
- Temporarily/locally slammed in "typedef unsigned long mz_ulong" and re-ran a randomized regression test on ~500k files.
- Eliminated a bunch of warnings when compiling with GCC 32-bit/64.
- Ran all examples, miniz.c, and tinfl.c through MSVC 2008's /analyze (static analysis) option and fixed all warnings (except for the silly
- "Use of the comma-operator in a tested expression.." analysis warning, which I purposely use to work around a MSVC compiler warning).
- Created 32-bit and 64-bit Codeblocks projects/workspace. Built and tested Linux executables. The codeblocks workspace is compatible with Linux+Win32/x64.
- Added miniz_tester solution/project, which is a useful little app derived from LZHAM's tester app that I use as part of the regression test.
- Ran miniz.c and tinfl.c through another series of regression testing on ~500,000 files and archives.
- Modified example5.c so it purposely disables a bunch of high-level functionality (MINIZ_NO_STDIO, etc.). (Thanks to corysama for the MINIZ_NO_STDIO bug report.)
- Fix ftell() usage in examples so they exit with an error on files which are too large (a limitation of the examples, not miniz itself).
- 4/12/12 v1.12 - More comments, added low-level example5.c, fixed a couple minor level_and_flags issues in the archive API's.
- level_and_flags can now be set to MZ_DEFAULT_COMPRESSION. Thanks to Bruce Dawson <bruced@valvesoftware.com> for the feedback/bug report.
- 5/28/11 v1.11 - Added statement from unlicense.org
- 5/27/11 v1.10 - Substantial compressor optimizations:
- Level 1 is now ~4x faster than before. The L1 compressor's throughput now varies between 70-110MB/sec. on a
- Core i7 (actual throughput varies depending on the type of data, and x64 vs. x86).
- Improved baseline L2-L9 compression perf. Also, greatly improved compression perf. issues on some file types.
- Refactored the compression code for better readability and maintainability.
- Added level 10 compression level (L10 has slightly better ratio than level 9, but could have a potentially large
- drop in throughput on some files).
- 5/15/11 v1.09 - Initial stable release.
-
- * Low-level Deflate/Inflate implementation notes:
-
- Compression: Use the "tdefl" API's. The compressor supports raw, static, and dynamic blocks, lazy or
- greedy parsing, match length filtering, RLE-only, and Huffman-only streams. It performs and compresses
- approximately as well as zlib.
-
- Decompression: Use the "tinfl" API's. The entire decompressor is implemented as a single function
- coroutine: see tinfl_decompress(). It supports decompression into a 32KB (or larger power of 2) wrapping buffer, or into a memory
- block large enough to hold the entire file.
-
- The low-level tdefl/tinfl API's do not make any use of dynamic memory allocation.
-
- * zlib-style API notes:
-
- miniz.c implements a fairly large subset of zlib. There's enough functionality present for it to be a drop-in
- zlib replacement in many apps:
- The z_stream struct, optional memory allocation callbacks
- deflateInit/deflateInit2/deflate/deflateReset/deflateEnd/deflateBound
- inflateInit/inflateInit2/inflate/inflateEnd
- compress, compress2, compressBound, uncompress
- CRC-32, Adler-32 - Using modern, minimal code size, CPU cache friendly routines.
- Supports raw deflate streams or standard zlib streams with adler-32 checking.
-
- Limitations:
- The callback API's are not implemented yet. No support for gzip headers or zlib static dictionaries.
- I've tried to closely emulate zlib's various flavors of stream flushing and return status codes, but
- there are no guarantees that miniz.c pulls this off perfectly.
-
- * PNG writing: See the tdefl_write_image_to_png_file_in_memory() function, originally written by
- Alex Evans. Supports 1-4 bytes/pixel images.
-
- * ZIP archive API notes:
-
- The ZIP archive API's where designed with simplicity and efficiency in mind, with just enough abstraction to
- get the job done with minimal fuss. There are simple API's to retrieve file information, read files from
- existing archives, create new archives, append new files to existing archives, or clone archive data from
- one archive to another. It supports archives located in memory or the heap, on disk (using stdio.h),
- or you can specify custom file read/write callbacks.
-
- - Archive reading: Just call this function to read a single file from a disk archive:
-
- void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name,
- size_t *pSize, mz_uint zip_flags);
-
- For more complex cases, use the "mz_zip_reader" functions. Upon opening an archive, the entire central
- directory is located and read as-is into memory, and subsequent file access only occurs when reading individual files.
-
- - Archives file scanning: The simple way is to use this function to scan a loaded archive for a specific file:
-
- int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags);
-
- The locate operation can optionally check file comments too, which (as one example) can be used to identify
- multiple versions of the same file in an archive. This function uses a simple linear search through the central
- directory, so it's not very fast.
-
- Alternately, you can iterate through all the files in an archive (using mz_zip_reader_get_num_files()) and
- retrieve detailed info on each file by calling mz_zip_reader_file_stat().
-
- - Archive creation: Use the "mz_zip_writer" functions. The ZIP writer immediately writes compressed file data
- to disk and builds an exact image of the central directory in memory. The central directory image is written
- all at once at the end of the archive file when the archive is finalized.
-
- The archive writer can optionally align each file's local header and file data to any power of 2 alignment,
- which can be useful when the archive will be read from optical media. Also, the writer supports placing
- arbitrary data blobs at the very beginning of ZIP archives. Archives written using either feature are still
- readable by any ZIP tool.
-
- - Archive appending: The simple way to add a single file to an archive is to call this function:
-
- mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name,
- const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags);
-
- The archive will be created if it doesn't already exist, otherwise it'll be appended to.
- Note the appending is done in-place and is not an atomic operation, so if something goes wrong
- during the operation it's possible the archive could be left without a central directory (although the local
- file headers and file data will be fine, so the archive will be recoverable).
-
- For more complex archive modification scenarios:
- 1. The safest way is to use a mz_zip_reader to read the existing archive, cloning only those bits you want to
- preserve into a new archive using using the mz_zip_writer_add_from_zip_reader() function (which compiles the
- compressed file data as-is). When you're done, delete the old archive and rename the newly written archive, and
- you're done. This is safe but requires a bunch of temporary disk space or heap memory.
-
- 2. Or, you can convert an mz_zip_reader in-place to an mz_zip_writer using mz_zip_writer_init_from_reader(),
- append new files as needed, then finalize the archive which will write an updated central directory to the
- original archive. (This is basically what mz_zip_add_mem_to_archive_file_in_place() does.) There's a
- possibility that the archive's central directory could be lost with this method if anything goes wrong, though.
-
- - ZIP archive support limitations:
- No zip64 or spanning support. Extraction functions can only handle unencrypted, stored or deflated files.
- Requires streams capable of seeking.
-
- * This is a header file library, like stb_image.c. To get only a header file, either cut and paste the
- below header, or create miniz.h, #define MINIZ_HEADER_FILE_ONLY, and then include miniz.c from it.
-
- * Important: For best perf. be sure to customize the below macros for your target platform:
- #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1
- #define MINIZ_LITTLE_ENDIAN 1
- #define MINIZ_HAS_64BIT_REGISTERS 1
-*/
-#pragma once
-
-#ifndef MINIZ_HEADER_INCLUDED
-#define MINIZ_HEADER_INCLUDED
-
-#include <stdlib.h>
-
-#if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS)
-#include <time.h>
-#endif
-
-// Defines to completely disable specific portions of miniz.c:
-// If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl.
-
-// Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O.
-//#define MINIZ_NO_STDIO
-
-// If MINIZ_NO_TIME is specified then the ZIP archive functions will not be able to get the current time, or
-// get/set file times.
-//#define MINIZ_NO_TIME
-
-// Define MINIZ_NO_ARCHIVE_APIS to disable all ZIP archive API's.
-//#define MINIZ_NO_ARCHIVE_APIS
-
-// Define MINIZ_NO_ARCHIVE_APIS to disable all writing related ZIP archive API's.
-//#define MINIZ_NO_ARCHIVE_WRITING_APIS
-
-// Define MINIZ_NO_ZLIB_APIS to remove all ZLIB-style compression/decompression API's.
-//#define MINIZ_NO_ZLIB_APIS
-
-// Define MINIZ_NO_ZLIB_COMPATIBLE_NAME to disable zlib names, to prevent conflicts against stock zlib.
-//#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
-
-// Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc.
-// Note if MINIZ_NO_MALLOC is defined then the user must always provide custom user alloc/free/realloc
-// callbacks to the zlib and archive API's, and a few stand-alone helper API's which don't provide custom user
-// functions (such as tdefl_compress_mem_to_heap() and tinfl_decompress_mem_to_heap()) won't work.
-//#define MINIZ_NO_MALLOC
-
-#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__)
-// MINIZ_X86_OR_X64_CPU is only used to help set the below macros.
-#define MINIZ_X86_OR_X64_CPU 1
-#endif
-
-#if (__BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU
-// Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian.
-#define MINIZ_LITTLE_ENDIAN 1
-#endif
-
-#if MINIZ_X86_OR_X64_CPU
-// Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses.
-#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1
-#endif
-
-#if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__)
-// Set MINIZ_HAS_64BIT_REGISTERS to 1 if operations on 64-bit integers are reasonably fast (and don't involve compiler generated calls to helper functions).
-#define MINIZ_HAS_64BIT_REGISTERS 1
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// ------------------- zlib-style API Definitions.
-
-// For more compatibility with zlib, miniz.c uses unsigned long for some parameters/struct members. Beware: mz_ulong can be either 32 or 64-bits!
-typedef unsigned long mz_ulong;
-
-// mz_free() internally uses the MZ_FREE() macro (which by default calls free() unless you've modified the MZ_MALLOC macro) to release a block allocated from the heap.
-void mz_free(void *p);
-
-#define MZ_ADLER32_INIT (1)
-// mz_adler32() returns the initial adler-32 value to use when called with ptr==NULL.
-mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len);
-
-#define MZ_CRC32_INIT (0)
-// mz_crc32() returns the initial CRC-32 value to use when called with ptr==NULL.
-mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len);
-
-// Compression strategies.
-enum { MZ_DEFAULT_STRATEGY = 0, MZ_FILTERED = 1, MZ_HUFFMAN_ONLY = 2, MZ_RLE = 3, MZ_FIXED = 4 };
-
-// Method
-#define MZ_DEFLATED 8
-
-#ifndef MINIZ_NO_ZLIB_APIS
-
-// Heap allocation callbacks.
-// Note that mz_alloc_func parameter types purpsosely differ from zlib's: items/size is size_t, not unsigned long.
-typedef void *(*mz_alloc_func)(void *opaque, size_t items, size_t size);
-typedef void (*mz_free_func)(void *opaque, void *address);
-typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, size_t size);
-
-#define MZ_VERSION "9.1.14"
-#define MZ_VERNUM 0x91E0
-#define MZ_VER_MAJOR 9
-#define MZ_VER_MINOR 1
-#define MZ_VER_REVISION 14
-#define MZ_VER_SUBREVISION 0
-
-// Flush values. For typical usage you only need MZ_NO_FLUSH and MZ_FINISH. The other values are for advanced use (refer to the zlib docs).
-enum { MZ_NO_FLUSH = 0, MZ_PARTIAL_FLUSH = 1, MZ_SYNC_FLUSH = 2, MZ_FULL_FLUSH = 3, MZ_FINISH = 4, MZ_BLOCK = 5 };
-
-// Return status codes. MZ_PARAM_ERROR is non-standard.
-enum { MZ_OK = 0, MZ_STREAM_END = 1, MZ_NEED_DICT = 2, MZ_ERRNO = -1, MZ_STREAM_ERROR = -2, MZ_DATA_ERROR = -3, MZ_MEM_ERROR = -4, MZ_BUF_ERROR = -5, MZ_VERSION_ERROR = -6, MZ_PARAM_ERROR = -10000 };
-
-// Compression levels: 0-9 are the standard zlib-style levels, 10 is best possible compression (not zlib compatible, and may be very slow), MZ_DEFAULT_COMPRESSION=MZ_DEFAULT_LEVEL.
-enum { MZ_NO_COMPRESSION = 0, MZ_BEST_SPEED = 1, MZ_BEST_COMPRESSION = 9, MZ_UBER_COMPRESSION = 10, MZ_DEFAULT_LEVEL = 6, MZ_DEFAULT_COMPRESSION = -1 };
-
-// Window bits
-#define MZ_DEFAULT_WINDOW_BITS 15
-
-struct mz_internal_state;
-
-// Compression/decompression stream struct.
-typedef struct mz_stream_s
-{
- const unsigned char *next_in; // pointer to next byte to read
- unsigned int avail_in; // number of bytes available at next_in
- mz_ulong total_in; // total number of bytes consumed so far
-
- unsigned char *next_out; // pointer to next byte to write
- unsigned int avail_out; // number of bytes that can be written to next_out
- mz_ulong total_out; // total number of bytes produced so far
-
- char *msg; // error msg (unused)
- struct mz_internal_state *state; // internal state, allocated by zalloc/zfree
-
- mz_alloc_func zalloc; // optional heap allocation function (defaults to malloc)
- mz_free_func zfree; // optional heap free function (defaults to free)
- void *opaque; // heap alloc function user pointer
-
- int data_type; // data_type (unused)
- mz_ulong adler; // adler32 of the source or uncompressed data
- mz_ulong reserved; // not used
-} mz_stream;
-
-typedef mz_stream *mz_streamp;
-
-// Returns the version string of miniz.c.
-const char *mz_version(void);
-
-// mz_deflateInit() initializes a compressor with default options:
-// Parameters:
-// pStream must point to an initialized mz_stream struct.
-// level must be between [MZ_NO_COMPRESSION, MZ_BEST_COMPRESSION].
-// level 1 enables a specially optimized compression function that's been optimized purely for performance, not ratio.
-// (This special func. is currently only enabled when MINIZ_USE_UNALIGNED_LOADS_AND_STORES and MINIZ_LITTLE_ENDIAN are defined.)
-// Return values:
-// MZ_OK on success.
-// MZ_STREAM_ERROR if the stream is bogus.
-// MZ_PARAM_ERROR if the input parameters are bogus.
-// MZ_MEM_ERROR on out of memory.
-int mz_deflateInit(mz_streamp pStream, int level);
-
-// mz_deflateInit2() is like mz_deflate(), except with more control:
-// Additional parameters:
-// method must be MZ_DEFLATED
-// window_bits must be MZ_DEFAULT_WINDOW_BITS (to wrap the deflate stream with zlib header/adler-32 footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate/no header or footer)
-// mem_level must be between [1, 9] (it's checked but ignored by miniz.c)
-int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy);
-
-// Quickly resets a compressor without having to reallocate anything. Same as calling mz_deflateEnd() followed by mz_deflateInit()/mz_deflateInit2().
-int mz_deflateReset(mz_streamp pStream);
-
-// mz_deflate() compresses the input to output, consuming as much of the input and producing as much output as possible.
-// Parameters:
-// pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members.
-// flush may be MZ_NO_FLUSH, MZ_PARTIAL_FLUSH/MZ_SYNC_FLUSH, MZ_FULL_FLUSH, or MZ_FINISH.
-// Return values:
-// MZ_OK on success (when flushing, or if more input is needed but not available, and/or there's more output to be written but the output buffer is full).
-// MZ_STREAM_END if all input has been consumed and all output bytes have been written. Don't call mz_deflate() on the stream anymore.
-// MZ_STREAM_ERROR if the stream is bogus.
-// MZ_PARAM_ERROR if one of the parameters is invalid.
-// MZ_BUF_ERROR if no forward progress is possible because the input and/or output buffers are empty. (Fill up the input buffer or free up some output space and try again.)
-int mz_deflate(mz_streamp pStream, int flush);
-
-// mz_deflateEnd() deinitializes a compressor:
-// Return values:
-// MZ_OK on success.
-// MZ_STREAM_ERROR if the stream is bogus.
-int mz_deflateEnd(mz_streamp pStream);
-
-// mz_deflateBound() returns a (very) conservative upper bound on the amount of data that could be generated by deflate(), assuming flush is set to only MZ_NO_FLUSH or MZ_FINISH.
-mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len);
-
-// Single-call compression functions mz_compress() and mz_compress2():
-// Returns MZ_OK on success, or one of the error codes from mz_deflate() on failure.
-int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
-int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level);
-
-// mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress().
-mz_ulong mz_compressBound(mz_ulong source_len);
-
-// Initializes a decompressor.
-int mz_inflateInit(mz_streamp pStream);
-
-// mz_inflateInit2() is like mz_inflateInit() with an additional option that controls the window size and whether or not the stream has been wrapped with a zlib header/footer:
-// window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate).
-int mz_inflateInit2(mz_streamp pStream, int window_bits);
-
-// Decompresses the input stream to the output, consuming only as much of the input as needed, and writing as much to the output as possible.
-// Parameters:
-// pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members.
-// flush may be MZ_NO_FLUSH, MZ_SYNC_FLUSH, or MZ_FINISH.
-// On the first call, if flush is MZ_FINISH it's assumed the input and output buffers are both sized large enough to decompress the entire stream in a single call (this is slightly faster).
-// MZ_FINISH implies that there are no more source bytes available beside what's already in the input buffer, and that the output buffer is large enough to hold the rest of the decompressed data.
-// Return values:
-// MZ_OK on success. Either more input is needed but not available, and/or there's more output to be written but the output buffer is full.
-// MZ_STREAM_END if all needed input has been consumed and all output bytes have been written. For zlib streams, the adler-32 of the decompressed data has also been verified.
-// MZ_STREAM_ERROR if the stream is bogus.
-// MZ_DATA_ERROR if the deflate stream is invalid.
-// MZ_PARAM_ERROR if one of the parameters is invalid.
-// MZ_BUF_ERROR if no forward progress is possible because the input buffer is empty but the inflater needs more input to continue, or if the output buffer is not large enough. Call mz_inflate() again
-// with more input data, or with more room in the output buffer (except when using single call decompression, described above).
-int mz_inflate(mz_streamp pStream, int flush);
-
-// Deinitializes a decompressor.
-int mz_inflateEnd(mz_streamp pStream);
-
-// Single-call decompression.
-// Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure.
-int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
-
-// Returns a string description of the specified error code, or NULL if the error code is invalid.
-const char *mz_error(int err);
-
-// Redefine zlib-compatible names to miniz equivalents, so miniz.c can be used as a drop-in replacement for the subset of zlib that miniz.c supports.
-// Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project.
-#ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
- typedef unsigned char Byte;
- typedef unsigned int uInt;
- typedef mz_ulong uLong;
- typedef Byte Bytef;
- typedef uInt uIntf;
- typedef char charf;
- typedef int intf;
- typedef void *voidpf;
- typedef uLong uLongf;
- typedef void *voidp;
- typedef void *const voidpc;
- #define Z_NULL 0
- #define Z_NO_FLUSH MZ_NO_FLUSH
- #define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH
- #define Z_SYNC_FLUSH MZ_SYNC_FLUSH
- #define Z_FULL_FLUSH MZ_FULL_FLUSH
- #define Z_FINISH MZ_FINISH
- #define Z_BLOCK MZ_BLOCK
- #define Z_OK MZ_OK
- #define Z_STREAM_END MZ_STREAM_END
- #define Z_NEED_DICT MZ_NEED_DICT
- #define Z_ERRNO MZ_ERRNO
- #define Z_STREAM_ERROR MZ_STREAM_ERROR
- #define Z_DATA_ERROR MZ_DATA_ERROR
- #define Z_MEM_ERROR MZ_MEM_ERROR
- #define Z_BUF_ERROR MZ_BUF_ERROR
- #define Z_VERSION_ERROR MZ_VERSION_ERROR
- #define Z_PARAM_ERROR MZ_PARAM_ERROR
- #define Z_NO_COMPRESSION MZ_NO_COMPRESSION
- #define Z_BEST_SPEED MZ_BEST_SPEED
- #define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION
- #define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION
- #define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY
- #define Z_FILTERED MZ_FILTERED
- #define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY
- #define Z_RLE MZ_RLE
- #define Z_FIXED MZ_FIXED
- #define Z_DEFLATED MZ_DEFLATED
- #define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS
- #define alloc_func mz_alloc_func
- #define free_func mz_free_func
- #define internal_state mz_internal_state
- #define z_stream mz_stream
- #define deflateInit mz_deflateInit
- #define deflateInit2 mz_deflateInit2
- #define deflateReset mz_deflateReset
- #define deflate mz_deflate
- #define deflateEnd mz_deflateEnd
- #define deflateBound mz_deflateBound
- #define compress mz_compress
- #define compress2 mz_compress2
- #define compressBound mz_compressBound
- #define inflateInit mz_inflateInit
- #define inflateInit2 mz_inflateInit2
- #define inflate mz_inflate
- #define inflateEnd mz_inflateEnd
- #define uncompress mz_uncompress
- #define crc32 mz_crc32
- #define adler32 mz_adler32
- #define MAX_WBITS 15
- #define MAX_MEM_LEVEL 9
- #define zError mz_error
- #define ZLIB_VERSION MZ_VERSION
- #define ZLIB_VERNUM MZ_VERNUM
- #define ZLIB_VER_MAJOR MZ_VER_MAJOR
- #define ZLIB_VER_MINOR MZ_VER_MINOR
- #define ZLIB_VER_REVISION MZ_VER_REVISION
- #define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION
- #define zlibVersion mz_version
- #define zlib_version mz_version()
-#endif // #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
-
-#endif // MINIZ_NO_ZLIB_APIS
-
-// ------------------- Types and macros
-
-typedef unsigned char mz_uint8;
-typedef signed short mz_int16;
-typedef unsigned short mz_uint16;
-typedef unsigned int mz_uint32;
-typedef unsigned int mz_uint;
-typedef long long mz_int64;
-typedef unsigned long long mz_uint64;
-typedef int mz_bool;
-
-#define MZ_FALSE (0)
-#define MZ_TRUE (1)
-
-// Works around MSVC's spammy "warning C4127: conditional expression is constant" message.
-#ifdef _MSC_VER
- #define MZ_MACRO_END while (0, 0)
-#else
- #define MZ_MACRO_END while (0)
-#endif
-
-// ------------------- ZIP archive reading/writing
-
-#ifndef MINIZ_NO_ARCHIVE_APIS
-
-enum
-{
- MZ_ZIP_MAX_IO_BUF_SIZE = 64*1024,
- MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE = 260,
- MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE = 256
-};
-
-typedef struct
-{
- mz_uint32 m_file_index;
- mz_uint32 m_central_dir_ofs;
- mz_uint16 m_version_made_by;
- mz_uint16 m_version_needed;
- mz_uint16 m_bit_flag;
- mz_uint16 m_method;
-#ifndef MINIZ_NO_TIME
- time_t m_time;
-#endif
- mz_uint32 m_crc32;
- mz_uint64 m_comp_size;
- mz_uint64 m_uncomp_size;
- mz_uint16 m_internal_attr;
- mz_uint32 m_external_attr;
- mz_uint64 m_local_header_ofs;
- mz_uint32 m_comment_size;
- char m_filename[MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE];
- char m_comment[MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE];
-} mz_zip_archive_file_stat;
-
-typedef size_t (*mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n);
-typedef size_t (*mz_file_write_func)(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n);
-
-struct mz_zip_internal_state_tag;
-typedef struct mz_zip_internal_state_tag mz_zip_internal_state;
-
-typedef enum
-{
- MZ_ZIP_MODE_INVALID = 0,
- MZ_ZIP_MODE_READING = 1,
- MZ_ZIP_MODE_WRITING = 2,
- MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED = 3
-} mz_zip_mode;
-
-typedef struct
-{
- mz_uint64 m_archive_size;
- mz_uint64 m_central_directory_file_ofs;
- mz_uint m_total_files;
- mz_zip_mode m_zip_mode;
-
- mz_uint m_file_offset_alignment;
-
- mz_alloc_func m_pAlloc;
- mz_free_func m_pFree;
- mz_realloc_func m_pRealloc;
- void *m_pAlloc_opaque;
-
- mz_file_read_func m_pRead;
- mz_file_write_func m_pWrite;
- void *m_pIO_opaque;
-
- mz_zip_internal_state *m_pState;
-
-} mz_zip_archive;
-
-typedef enum
-{
- MZ_ZIP_FLAG_CASE_SENSITIVE = 0x0100,
- MZ_ZIP_FLAG_IGNORE_PATH = 0x0200,
- MZ_ZIP_FLAG_COMPRESSED_DATA = 0x0400,
- MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY = 0x0800
-} mz_zip_flags;
-
-// ZIP archive reading
-
-// Inits a ZIP archive reader.
-// These functions read and validate the archive's central directory.
-mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags);
-mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags);
-
-#ifndef MINIZ_NO_STDIO
-mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags);
-#endif
-
-// Returns the total number of files in the archive.
-mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip);
-
-// Returns detailed information about an archive file entry.
-mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat);
-
-// Determines if an archive file entry is a directory entry.
-mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index);
-mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index);
-
-// Retrieves the filename of an archive file entry.
-// Returns the number of bytes written to pFilename, or if filename_buf_size is 0 this function returns the number of bytes needed to fully store the filename.
-mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size);
-
-// Attempts to locates a file in the archive's central directory.
-// Valid flags: MZ_ZIP_FLAG_CASE_SENSITIVE, MZ_ZIP_FLAG_IGNORE_PATH
-// Returns -1 if the file cannot be found.
-int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags);
-
-// Extracts a archive file to a memory buffer using no memory allocation.
-mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size);
-mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size);
-
-// Extracts a archive file to a memory buffer.
-mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags);
-mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags);
-
-// Extracts a archive file to a dynamically allocated heap buffer.
-void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uint flags);
-void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize, mz_uint flags);
-
-// Extracts a archive file using a callback function to output the file's data.
-mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, mz_uint file_index, mz_file_write_func pCallback, void *pOpaque, mz_uint flags);
-mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, const char *pFilename, mz_file_write_func pCallback, void *pOpaque, mz_uint flags);
-
-#ifndef MINIZ_NO_STDIO
-// Extracts a archive file to a disk file and sets its last accessed and modified times.
-// This function only extracts files, not archive directory records.
-mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags);
-mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags);
-#endif
-
-// Ends archive reading, freeing all allocations, and closing the input archive file if mz_zip_reader_init_file() was used.
-mz_bool mz_zip_reader_end(mz_zip_archive *pZip);
-
-// ZIP archive writing
-
-#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
-
-// Inits a ZIP archive writer.
-mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size);
-mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size);
-
-#ifndef MINIZ_NO_STDIO
-mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning);
-#endif
-
-// Converts a ZIP archive reader object into a writer object, to allow efficient in-place file appends to occur on an existing archive.
-// For archives opened using mz_zip_reader_init_file, pFilename must be the archive's filename so it can be reopened for writing. If the file can't be reopened, mz_zip_reader_end() will be called.
-// For archives opened using mz_zip_reader_init_mem, the memory block must be growable using the realloc callback (which defaults to realloc unless you've overridden it).
-// Finally, for archives opened using mz_zip_reader_init, the mz_zip_archive's user provided m_pWrite function cannot be NULL.
-// Note: In-place archive modification is not recommended unless you know what you're doing, because if execution stops or something goes wrong before
-// the archive is finalized the file's central directory will be hosed.
-mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, const char *pFilename);
-
-// Adds the contents of a memory buffer to an archive. These functions record the current local time into the archive.
-// To add a directory entry, call this method with an archive name ending in a forwardslash with empty buffer.
-// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION.
-mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags);
-mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_uint64 uncomp_size, mz_uint32 uncomp_crc32);
-
-#ifndef MINIZ_NO_STDIO
-// Adds the contents of a disk file to an archive. This function also records the disk file's modified time into the archive.
-// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION.
-mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags);
-#endif
-
-// Adds a file to an archive by fully cloning the data from another archive.
-// This function fully clones the source file's compressed data (no recompression), along with its full filename, extra data, and comment fields.
-mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive *pSource_zip, mz_uint file_index);
-
-// Finalizes the archive by writing the central directory records followed by the end of central directory record.
-// After an archive is finalized, the only valid call on the mz_zip_archive struct is mz_zip_writer_end().
-// An archive must be manually finalized by calling this function for it to be valid.
-mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip);
-mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **pBuf, size_t *pSize);
-
-// Ends archive writing, freeing all allocations, and closing the output file if mz_zip_writer_init_file() was used.
-// Note for the archive to be valid, it must have been finalized before ending.
-mz_bool mz_zip_writer_end(mz_zip_archive *pZip);
-
-// Misc. high-level helper functions:
-
-// mz_zip_add_mem_to_archive_file_in_place() efficiently (but not atomically) appends a memory blob to a ZIP archive.
-// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION.
-mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags);
-
-// Reads a single file from an archive into a heap block.
-// If pComment is not NULL, only the file with the specified comment will be extracted.
-// Returns NULL on failure.
-void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, const char *pComment, size_t *pSize, mz_uint flags);
-
-#endif // #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
-
-#endif // #ifndef MINIZ_NO_ARCHIVE_APIS
-
-// ------------------- Low-level Decompression API Definitions
-
-// Decompression flags used by tinfl_decompress().
-// TINFL_FLAG_PARSE_ZLIB_HEADER: If set, the input has a valid zlib header and ends with an adler32 checksum (it's a valid zlib stream). Otherwise, the input is a raw deflate stream.
-// TINFL_FLAG_HAS_MORE_INPUT: If set, there are more input bytes available beyond the end of the supplied input buffer. If clear, the input buffer contains all remaining input.
-// TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF: If set, the output buffer is large enough to hold the entire decompressed stream. If clear, the output buffer is at least the size of the dictionary (typically 32KB).
-// TINFL_FLAG_COMPUTE_ADLER32: Force adler-32 checksum computation of the decompressed bytes.
-enum
-{
- TINFL_FLAG_PARSE_ZLIB_HEADER = 1,
- TINFL_FLAG_HAS_MORE_INPUT = 2,
- TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF = 4,
- TINFL_FLAG_COMPUTE_ADLER32 = 8
-};
-
-// High level decompression functions:
-// tinfl_decompress_mem_to_heap() decompresses a block in memory to a heap block allocated via malloc().
-// On entry:
-// pSrc_buf, src_buf_len: Pointer and size of the Deflate or zlib source data to decompress.
-// On return:
-// Function returns a pointer to the decompressed data, or NULL on failure.
-// *pOut_len will be set to the decompressed data's size, which could be larger than src_buf_len on uncompressible data.
-// The caller must call mz_free() on the returned block when it's no longer needed.
-void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags);
-
-// tinfl_decompress_mem_to_mem() decompresses a block in memory to another block in memory.
-// Returns TINFL_DECOMPRESS_MEM_TO_MEM_FAILED on failure, or the number of bytes written on success.
-#define TINFL_DECOMPRESS_MEM_TO_MEM_FAILED ((size_t)(-1))
-size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags);
-
-// tinfl_decompress_mem_to_callback() decompresses a block in memory to an internal 32KB buffer, and a user provided callback function will be called to flush the buffer.
-// Returns 1 on success or 0 on failure.
-typedef int (*tinfl_put_buf_func_ptr)(const void* pBuf, int len, void *pUser);
-int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags);
-
-struct tinfl_decompressor_tag; typedef struct tinfl_decompressor_tag tinfl_decompressor;
-
-// Max size of LZ dictionary.
-#define TINFL_LZ_DICT_SIZE 32768
-
-// Return status.
-typedef enum
-{
- TINFL_STATUS_BAD_PARAM = -3,
- TINFL_STATUS_ADLER32_MISMATCH = -2,
- TINFL_STATUS_FAILED = -1,
- TINFL_STATUS_DONE = 0,
- TINFL_STATUS_NEEDS_MORE_INPUT = 1,
- TINFL_STATUS_HAS_MORE_OUTPUT = 2
-} tinfl_status;
-
-// Initializes the decompressor to its initial state.
-#define tinfl_init(r) do { (r)->m_state = 0; } MZ_MACRO_END
-#define tinfl_get_adler32(r) (r)->m_check_adler32
-
-// Main low-level decompressor coroutine function. This is the only function actually needed for decompression. All the other functions are just high-level helpers for improved usability.
-// This is a universal API, i.e. it can be used as a building block to build any desired higher level decompression API. In the limit case, it can be called once per every byte input or output.
-tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags);
-
-// Internal/private bits follow.
-enum
-{
- TINFL_MAX_HUFF_TABLES = 3, TINFL_MAX_HUFF_SYMBOLS_0 = 288, TINFL_MAX_HUFF_SYMBOLS_1 = 32, TINFL_MAX_HUFF_SYMBOLS_2 = 19,
- TINFL_FAST_LOOKUP_BITS = 10, TINFL_FAST_LOOKUP_SIZE = 1 << TINFL_FAST_LOOKUP_BITS
-};
-
-typedef struct
-{
- mz_uint8 m_code_size[TINFL_MAX_HUFF_SYMBOLS_0];
- mz_int16 m_look_up[TINFL_FAST_LOOKUP_SIZE], m_tree[TINFL_MAX_HUFF_SYMBOLS_0 * 2];
-} tinfl_huff_table;
-
-#if MINIZ_HAS_64BIT_REGISTERS
- #define TINFL_USE_64BIT_BITBUF 1
-#endif
-
-#if TINFL_USE_64BIT_BITBUF
- typedef mz_uint64 tinfl_bit_buf_t;
- #define TINFL_BITBUF_SIZE (64)
-#else
- typedef mz_uint32 tinfl_bit_buf_t;
- #define TINFL_BITBUF_SIZE (32)
-#endif
-
-struct tinfl_decompressor_tag
-{
- mz_uint32 m_state, m_num_bits, m_zhdr0, m_zhdr1, m_z_adler32, m_final, m_type, m_check_adler32, m_dist, m_counter, m_num_extra, m_table_sizes[TINFL_MAX_HUFF_TABLES];
- tinfl_bit_buf_t m_bit_buf;
- size_t m_dist_from_out_buf_start;
- tinfl_huff_table m_tables[TINFL_MAX_HUFF_TABLES];
- mz_uint8 m_raw_header[4], m_len_codes[TINFL_MAX_HUFF_SYMBOLS_0 + TINFL_MAX_HUFF_SYMBOLS_1 + 137];
-};
-
-// ------------------- Low-level Compression API Definitions
-
-// Set TDEFL_LESS_MEMORY to 1 to use less memory (compression will be slightly slower, and raw/dynamic blocks will be output more frequently).
-#define TDEFL_LESS_MEMORY 0
-
-// tdefl_init() compression flags logically OR'd together (low 12 bits contain the max. number of probes per dictionary search):
-// TDEFL_DEFAULT_MAX_PROBES: The compressor defaults to 128 dictionary probes per dictionary search. 0=Huffman only, 1=Huffman+LZ (fastest/crap compression), 4095=Huffman+LZ (slowest/best compression).
-enum
-{
- TDEFL_HUFFMAN_ONLY = 0, TDEFL_DEFAULT_MAX_PROBES = 128, TDEFL_MAX_PROBES_MASK = 0xFFF
-};
-
-// TDEFL_WRITE_ZLIB_HEADER: If set, the compressor outputs a zlib header before the deflate data, and the Adler-32 of the source data at the end. Otherwise, you'll get raw deflate data.
-// TDEFL_COMPUTE_ADLER32: Always compute the adler-32 of the input data (even when not writing zlib headers).
-// TDEFL_GREEDY_PARSING_FLAG: Set to use faster greedy parsing, instead of more efficient lazy parsing.
-// TDEFL_NONDETERMINISTIC_PARSING_FLAG: Enable to decrease the compressor's initialization time to the minimum, but the output may vary from run to run given the same input (depending on the contents of memory).
-// TDEFL_RLE_MATCHES: Only look for RLE matches (matches with a distance of 1)
-// TDEFL_FILTER_MATCHES: Discards matches <= 5 chars if enabled.
-// TDEFL_FORCE_ALL_STATIC_BLOCKS: Disable usage of optimized Huffman tables.
-// TDEFL_FORCE_ALL_RAW_BLOCKS: Only use raw (uncompressed) deflate blocks.
-enum
-{
- TDEFL_WRITE_ZLIB_HEADER = 0x01000,
- TDEFL_COMPUTE_ADLER32 = 0x02000,
- TDEFL_GREEDY_PARSING_FLAG = 0x04000,
- TDEFL_NONDETERMINISTIC_PARSING_FLAG = 0x08000,
- TDEFL_RLE_MATCHES = 0x10000,
- TDEFL_FILTER_MATCHES = 0x20000,
- TDEFL_FORCE_ALL_STATIC_BLOCKS = 0x40000,
- TDEFL_FORCE_ALL_RAW_BLOCKS = 0x80000
-};
-
-// High level compression functions:
-// tdefl_compress_mem_to_heap() compresses a block in memory to a heap block allocated via malloc().
-// On entry:
-// pSrc_buf, src_buf_len: Pointer and size of source block to compress.
-// flags: The max match finder probes (default is 128) logically OR'd against the above flags. Higher probes are slower but improve compression.
-// On return:
-// Function returns a pointer to the compressed data, or NULL on failure.
-// *pOut_len will be set to the compressed data's size, which could be larger than src_buf_len on uncompressible data.
-// The caller must free() the returned block when it's no longer needed.
-void *tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags);
-
-// tdefl_compress_mem_to_mem() compresses a block in memory to another block in memory.
-// Returns 0 on failure.
-size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags);
-
-// Compresses an image to a compressed PNG file in memory.
-// On entry:
-// pImage, w, h, and num_chans describe the image to compress. num_chans may be 1, 2, 3, or 4.
-// The image pitch in bytes per scanline will be w*num_chans. The leftmost pixel on the top scanline is stored first in memory.
-// On return:
-// Function returns a pointer to the compressed data, or NULL on failure.
-// *pLen_out will be set to the size of the PNG image file.
-// The caller must mz_free() the returned heap block (which will typically be larger than *pLen_out) when it's no longer needed.
-void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, int num_chans, size_t *pLen_out);
-
-// Output stream interface. The compressor uses this interface to write compressed data. It'll typically be called TDEFL_OUT_BUF_SIZE at a time.
-typedef mz_bool (*tdefl_put_buf_func_ptr)(const void* pBuf, int len, void *pUser);
-
-// tdefl_compress_mem_to_output() compresses a block to an output stream. The above helpers use this function internally.
-mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags);
-
-enum { TDEFL_MAX_HUFF_TABLES = 3, TDEFL_MAX_HUFF_SYMBOLS_0 = 288, TDEFL_MAX_HUFF_SYMBOLS_1 = 32, TDEFL_MAX_HUFF_SYMBOLS_2 = 19, TDEFL_LZ_DICT_SIZE = 32768, TDEFL_LZ_DICT_SIZE_MASK = TDEFL_LZ_DICT_SIZE - 1, TDEFL_MIN_MATCH_LEN = 3, TDEFL_MAX_MATCH_LEN = 258 };
-
-// TDEFL_OUT_BUF_SIZE MUST be large enough to hold a single entire compressed output block (using static/fixed Huffman codes).
-#if TDEFL_LESS_MEMORY
-enum { TDEFL_LZ_CODE_BUF_SIZE = 24 * 1024, TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13 ) / 10, TDEFL_MAX_HUFF_SYMBOLS = 288, TDEFL_LZ_HASH_BITS = 12, TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS };
-#else
-enum { TDEFL_LZ_CODE_BUF_SIZE = 64 * 1024, TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13 ) / 10, TDEFL_MAX_HUFF_SYMBOLS = 288, TDEFL_LZ_HASH_BITS = 15, TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS };
-#endif
-
-// The low-level tdefl functions below may be used directly if the above helper functions aren't flexible enough. The low-level functions don't make any heap allocations, unlike the above helper functions.
-typedef enum
-{
- TDEFL_STATUS_BAD_PARAM = -2,
- TDEFL_STATUS_PUT_BUF_FAILED = -1,
- TDEFL_STATUS_OKAY = 0,
- TDEFL_STATUS_DONE = 1,
-} tdefl_status;
-
-// Must map to MZ_NO_FLUSH, MZ_SYNC_FLUSH, etc. enums
-typedef enum
-{
- TDEFL_NO_FLUSH = 0,
- TDEFL_SYNC_FLUSH = 2,
- TDEFL_FULL_FLUSH = 3,
- TDEFL_FINISH = 4
-} tdefl_flush;
-
-// tdefl's compression state structure.
-typedef struct
-{
- tdefl_put_buf_func_ptr m_pPut_buf_func;
- void *m_pPut_buf_user;
- mz_uint m_flags, m_max_probes[2];
- int m_greedy_parsing;
- mz_uint m_adler32, m_lookahead_pos, m_lookahead_size, m_dict_size;
- mz_uint8 *m_pLZ_code_buf, *m_pLZ_flags, *m_pOutput_buf, *m_pOutput_buf_end;
- mz_uint m_num_flags_left, m_total_lz_bytes, m_lz_code_buf_dict_pos, m_bits_in, m_bit_buffer;
- mz_uint m_saved_match_dist, m_saved_match_len, m_saved_lit, m_output_flush_ofs, m_output_flush_remaining, m_finished, m_block_index, m_wants_to_finish;
- tdefl_status m_prev_return_status;
- const void *m_pIn_buf;
- void *m_pOut_buf;
- size_t *m_pIn_buf_size, *m_pOut_buf_size;
- tdefl_flush m_flush;
- const mz_uint8 *m_pSrc;
- size_t m_src_buf_left, m_out_buf_ofs;
- mz_uint8 m_dict[TDEFL_LZ_DICT_SIZE + TDEFL_MAX_MATCH_LEN - 1];
- mz_uint16 m_huff_count[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS];
- mz_uint16 m_huff_codes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS];
- mz_uint8 m_huff_code_sizes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS];
- mz_uint8 m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE];
- mz_uint16 m_next[TDEFL_LZ_DICT_SIZE];
- mz_uint16 m_hash[TDEFL_LZ_HASH_SIZE];
- mz_uint8 m_output_buf[TDEFL_OUT_BUF_SIZE];
-} tdefl_compressor;
-
-// Initializes the compressor.
-// There is no corresponding deinit() function because the tdefl API's do not dynamically allocate memory.
-// pBut_buf_func: If NULL, output data will be supplied to the specified callback. In this case, the user should call the tdefl_compress_buffer() API for compression.
-// If pBut_buf_func is NULL the user should always call the tdefl_compress() API.
-// flags: See the above enums (TDEFL_HUFFMAN_ONLY, TDEFL_WRITE_ZLIB_HEADER, etc.)
-tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags);
-
-// Compresses a block of data, consuming as much of the specified input buffer as possible, and writing as much compressed data to the specified output buffer as possible.
-tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pIn_buf_size, void *pOut_buf, size_t *pOut_buf_size, tdefl_flush flush);
-
-// tdefl_compress_buffer() is only usable when the tdefl_init() is called with a non-NULL tdefl_put_buf_func_ptr.
-// tdefl_compress_buffer() always consumes the entire input buffer.
-tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, size_t in_buf_size, tdefl_flush flush);
-
-tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d);
-mz_uint32 tdefl_get_adler32(tdefl_compressor *d);
-
-// Can't use tdefl_create_comp_flags_from_zip_params if MINIZ_NO_ZLIB_APIS isn't defined, because it uses some of its macros.
-#ifndef MINIZ_NO_ZLIB_APIS
-// Create tdefl_compress() flags given zlib-style compression parameters.
-// level may range from [0,10] (where 10 is absolute max compression, but may be much slower on some files)
-// window_bits may be -15 (raw deflate) or 15 (zlib)
-// strategy may be either MZ_DEFAULT_STRATEGY, MZ_FILTERED, MZ_HUFFMAN_ONLY, MZ_RLE, or MZ_FIXED
-mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy);
-#endif // #ifndef MINIZ_NO_ZLIB_APIS
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // MINIZ_HEADER_INCLUDED \ No newline at end of file
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_mipmapped_texture.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_mipmapped_texture.cpp
deleted file mode 100644
index 99bfe3b1..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_mipmapped_texture.cpp
+++ /dev/null
@@ -1,3374 +0,0 @@
-// File: crn_dds_texture.cpp - Actually supports both .DDS and .KTX. Probably will rename this eventually.
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_mipmapped_texture.h"
-#include "crn_cfile_stream.h"
-#include "crn_image_utils.h"
-#include "crn_console.h"
-#include "crn_texture_comp.h"
-#include "crn_ktx_texture.h"
-
-#define CRND_HEADER_FILE_ONLY
-#include "../inc/crn_decomp.h"
-
-namespace crnlib
-{
- const vec2I g_vertical_cross_image_offsets[6] = { vec2I(2, 1), vec2I(0, 1), vec2I(1, 0), vec2I(1, 2), vec2I(1, 1), vec2I(1, 3) };
-
- mip_level::mip_level() :
- m_width(0),
- m_height(0),
- m_comp_flags(pixel_format_helpers::cDefaultCompFlags),
- m_format(PIXEL_FMT_INVALID),
- m_pImage(NULL),
- m_pDXTImage(NULL),
- m_orient_flags(cDefaultOrientationFlags)
- {
- }
-
- mip_level::mip_level(const mip_level& other) :
- m_width(0),
- m_height(0),
- m_comp_flags(pixel_format_helpers::cDefaultCompFlags),
- m_format(PIXEL_FMT_INVALID),
- m_pImage(NULL),
- m_pDXTImage(NULL),
- m_orient_flags(cDefaultOrientationFlags)
- {
- *this = other;
- }
-
- mip_level& mip_level::operator= (const mip_level& rhs)
- {
- clear();
-
- m_width = rhs.m_width;
- m_height = rhs.m_height;
- m_comp_flags = rhs.m_comp_flags;
- m_format = rhs.m_format;
- m_orient_flags = rhs.m_orient_flags;
-
- if (rhs.m_pImage)
- m_pImage = crnlib_new<image_u8>(*rhs.m_pImage);
-
- if (rhs.m_pDXTImage)
- m_pDXTImage = crnlib_new<dxt_image>(*rhs.m_pDXTImage);
-
- return *this;
- }
-
- mip_level::~mip_level()
- {
- crnlib_delete(m_pImage);
- crnlib_delete(m_pDXTImage);
- }
-
- void mip_level::clear()
- {
- m_width = 0;
- m_height = 0;
- m_comp_flags = pixel_format_helpers::cDefaultCompFlags;
- m_format = PIXEL_FMT_INVALID;
- m_orient_flags = cDefaultOrientationFlags;
-
- if (m_pImage)
- {
- crnlib_delete(m_pImage);
- m_pImage = NULL;
- }
-
- if (m_pDXTImage)
- {
- crnlib_delete(m_pDXTImage);
- m_pDXTImage = NULL;
- }
- }
-
- void mip_level::assign(image_u8* p, pixel_format fmt, orientation_flags_t orient_flags)
- {
- CRNLIB_ASSERT(p);
-
- clear();
-
- m_pImage = p;
-
- m_width = p->get_width();
- m_height = p->get_height();
- m_orient_flags = orient_flags;
-
- if (fmt != PIXEL_FMT_INVALID)
- m_format = fmt;
- else
- {
- if (p->is_grayscale())
- m_format = p->is_component_valid(3) ? PIXEL_FMT_A8L8 : PIXEL_FMT_L8;
- else
- m_format = p->is_component_valid(3) ? PIXEL_FMT_A8R8G8B8 : PIXEL_FMT_R8G8B8;
- }
-
- m_comp_flags = p->get_comp_flags(); //pixel_format_helpers::get_component_flags(m_format);
- }
-
- void mip_level::assign(dxt_image* p, pixel_format fmt, orientation_flags_t orient_flags)
- {
- CRNLIB_ASSERT(p);
-
- clear();
-
- m_pDXTImage = p;
-
- m_width = p->get_width();
- m_height = p->get_height();
- m_orient_flags = orient_flags;
-
- if (fmt != PIXEL_FMT_INVALID)
- m_format = fmt;
- else
- m_format = pixel_format_helpers::from_dxt_format(p->get_format());
-
- m_comp_flags = pixel_format_helpers::get_component_flags(m_format);
- }
-
- bool mip_level::pack_to_dxt(const image_u8& img, pixel_format fmt, bool cook, const dxt_image::pack_params& orig_params, orientation_flags_t orient_flags)
- {
- CRNLIB_ASSERT(pixel_format_helpers::is_dxt(fmt));
- if (!pixel_format_helpers::is_dxt(fmt))
- return false;
-
- dxt_image::pack_params p(orig_params);
- if (pixel_format_helpers::is_pixel_format_non_srgb(fmt) || (img.get_comp_flags() & pixel_format_helpers::cCompFlagNormalMap) || (img.get_comp_flags() & pixel_format_helpers::cCompFlagLumaChroma))
- {
- // Disable perceptual colorspace metrics when packing to swizzled or non-RGB pixel formats.
- p.m_perceptual = false;
- }
-
- image_u8 tmp_img(img);
-
- clear();
-
- m_format = fmt;
-
- if (cook)
- cook_image(tmp_img);
-
- if ((pixel_format_helpers::is_alpha_only(fmt)) && (!tmp_img.has_alpha()))
- tmp_img.set_alpha_to_luma();
-
- dxt_format dxt_fmt = pixel_format_helpers::get_dxt_format(fmt);
-
- dxt_image* pDXT_image = crnlib_new<dxt_image>();
- if (!pDXT_image->init(dxt_fmt, tmp_img, p))
- {
- clear();
- return false;
- }
-
- assign(pDXT_image, fmt, orient_flags);
-
- return true;
- }
-
- bool mip_level::pack_to_dxt(pixel_format fmt, bool cook, const dxt_image::pack_params& p)
- {
- CRNLIB_ASSERT(pixel_format_helpers::is_dxt(fmt));
- if (!pixel_format_helpers::is_dxt(fmt))
- return false;
-
- image_u8 tmp_img;
- image_u8* pImage = get_unpacked_image(tmp_img, cUnpackFlagUncook);
-
- return pack_to_dxt(*pImage, fmt, cook, p, m_orient_flags);
- }
-
- bool mip_level::unpack_from_dxt(bool uncook)
- {
- if (!m_pDXTImage)
- return false;
-
- image_u8* pNew_img = crnlib_new<image_u8>();
- image_u8* pImg = get_unpacked_image(*pNew_img, uncook ? cUnpackFlagUncook : 0);
- pImg;
-
- CRNLIB_ASSERT(pImg == pNew_img);
-
- assign(pNew_img, PIXEL_FMT_INVALID, m_orient_flags);
- return true;
- }
-
- bool mip_level::is_flipped() const
- {
- return ((m_orient_flags & (cOrientationFlagXFlipped | cOrientationFlagYFlipped)) != 0);
- }
-
- bool mip_level::is_x_flipped() const
- {
- return ((m_orient_flags & cOrientationFlagXFlipped) != 0);
- }
-
- bool mip_level::is_y_flipped() const
- {
- return ((m_orient_flags & cOrientationFlagYFlipped) != 0);
- }
-
- bool mip_level::can_unflip_without_unpacking() const
- {
- if (!is_valid())
- return false;
-
- if (!is_packed())
- return true;
-
- bool can_unflip = true;
- if (m_orient_flags & cOrientationFlagXFlipped)
- {
- if (!m_pDXTImage->can_flip(0))
- can_unflip = false;
- }
- if (m_orient_flags & cOrientationFlagYFlipped)
- {
- if (!m_pDXTImage->can_flip(1))
- can_unflip = false;
- }
-
- return can_unflip;
- }
-
- bool mip_level::unflip(bool allow_unpacking_to_flip, bool uncook_if_necessary_to_unpack)
- {
- if (!is_valid())
- return false;
-
- if (!is_flipped())
- return false;
-
- if (is_packed())
- {
- if (can_unflip_without_unpacking())
- {
- if (m_orient_flags & cOrientationFlagXFlipped)
- {
- m_pDXTImage->flip_x();
- m_orient_flags = static_cast<orientation_flags_t>(m_orient_flags & ~cOrientationFlagXFlipped);
- }
-
- if (m_orient_flags & cOrientationFlagYFlipped)
- {
- m_pDXTImage->flip_y();
- m_orient_flags = static_cast<orientation_flags_t>(m_orient_flags & ~cOrientationFlagYFlipped);
- }
-
- return true;
- }
-
- if (!allow_unpacking_to_flip)
- return false;
- }
-
- unpack_from_dxt(uncook_if_necessary_to_unpack);
-
- if (m_orient_flags & cOrientationFlagXFlipped)
- {
- m_pImage->flip_x();
- m_orient_flags = static_cast<orientation_flags_t>(m_orient_flags & ~cOrientationFlagXFlipped);
- }
-
- if (m_orient_flags & cOrientationFlagYFlipped)
- {
- m_pImage->flip_y();
- m_orient_flags = static_cast<orientation_flags_t>(m_orient_flags & ~cOrientationFlagYFlipped);
- }
-
- return true;
- }
-
- bool mip_level::set_alpha_to_luma()
- {
- if (m_pDXTImage)
- unpack_from_dxt(true);
-
- m_pImage->set_alpha_to_luma();
-
- m_comp_flags = m_pImage->get_comp_flags();
-
- if (m_pImage->is_grayscale())
- m_format = PIXEL_FMT_A8L8;
- else
- m_format = PIXEL_FMT_A8R8G8B8;
-
- return true;
- }
-
- bool mip_level::convert(image_utils::conversion_type conv_type)
- {
- if (m_pDXTImage)
- unpack_from_dxt(true);
-
- image_utils::convert_image(*m_pImage, conv_type);
-
- m_comp_flags = m_pImage->get_comp_flags();
-
- if (m_pImage->is_grayscale())
- m_format = m_pImage->has_alpha() ? PIXEL_FMT_A8L8 : PIXEL_FMT_L8;
- else
- m_format = m_pImage->has_alpha() ? PIXEL_FMT_A8R8G8B8 : PIXEL_FMT_R8G8B8;
-
- return true;
- }
-
- bool mip_level::convert(pixel_format fmt, bool cook, const dxt_image::pack_params& p)
- {
- if (pixel_format_helpers::is_dxt(fmt))
- return pack_to_dxt(fmt, cook, p);
-
- image_u8 tmp_img;
- image_u8* pImg = get_unpacked_image(tmp_img, cUnpackFlagUncook);
-
- image_u8* pImage = crnlib_new<image_u8>();
- pImage->set_comp_flags(pixel_format_helpers::get_component_flags(fmt));
-
- if (!pImage->resize(pImg->get_width(), pImg->get_height()))
- return false;
-
- for (uint y = 0; y < pImg->get_height(); y++)
- {
- for (uint x = 0; x < pImg->get_width(); x++)
- {
- color_quad_u8 c((*pImg)(x, y));
-
- if ((pixel_format_helpers::is_alpha_only(fmt)) && (!pImg->has_alpha()))
- {
- c.a = static_cast<uint8>(c.get_luma());
- }
- else
- {
- if (pImage->is_grayscale())
- {
- uint8 g = static_cast<uint8>(c.get_luma());
- c.r = g;
- c.g = g;
- c.b = g;
- }
-
- if (!pImage->is_component_valid(3))
- c.a = 255;
- }
-
- (*pImage)(x, y) = c;
- }
- }
-
- assign(pImage, fmt, m_orient_flags);
-
- return true;
- }
-
- void mip_level::cook_image(image_u8& img) const
- {
- image_utils::conversion_type conv_type = image_utils::get_conversion_type(true, m_format);
-
- if (conv_type != image_utils::cConversion_Invalid)
- image_utils::convert_image(img, conv_type);
- }
-
- void mip_level::uncook_image(image_u8& img) const
- {
- image_utils::conversion_type conv_type = image_utils::get_conversion_type(false, m_format);
-
- if (conv_type != image_utils::cConversion_Invalid)
- image_utils::convert_image(img, conv_type);
- }
-
- image_u8* mip_level::get_unpacked_image(image_u8& tmp, uint unpack_flags) const
- {
- if (!is_valid())
- return NULL;
-
- if (m_pDXTImage)
- {
- m_pDXTImage->unpack(tmp);
-
- tmp.set_comp_flags(m_comp_flags);
-
- if (unpack_flags & cUnpackFlagUncook)
- uncook_image(tmp);
- }
- else if ((unpack_flags & cUnpackFlagUnflip) && (m_orient_flags & (cOrientationFlagXFlipped | cOrientationFlagYFlipped)))
- tmp = *m_pImage;
- else
- return m_pImage;
-
- if (unpack_flags & cUnpackFlagUnflip)
- {
- if (m_orient_flags & cOrientationFlagXFlipped) tmp.flip_x();
- if (m_orient_flags & cOrientationFlagYFlipped) tmp.flip_y();
- }
-
- return &tmp;
- }
-
- bool mip_level::flip_x()
- {
- if (!is_valid())
- return false;
-
- if (m_pDXTImage)
- return m_pDXTImage->flip_x();
- else if (m_pImage)
- {
- m_pImage->flip_x();
- return true;
- }
-
- return false;
- }
-
- bool mip_level::flip_y()
- {
- if (!is_valid())
- return false;
-
- if (m_pDXTImage)
- return m_pDXTImage->flip_y();
- else if (m_pImage)
- {
- m_pImage->flip_y();
- return true;
- }
-
- return false;
- }
-
- // -------------------------------------------------------------------------
-
- mipmapped_texture::mipmapped_texture() :
- m_width(0),
- m_height(0),
- m_comp_flags(pixel_format_helpers::cDefaultCompFlags),
- m_format(PIXEL_FMT_INVALID),
- m_source_file_type(texture_file_types::cFormatInvalid)
- {
- }
-
- mipmapped_texture::~mipmapped_texture()
- {
- free_all_mips();
- }
-
- void mipmapped_texture::clear()
- {
- free_all_mips();
-
- m_name.clear();
- m_width = 0;
- m_height = 0;
- m_comp_flags = pixel_format_helpers::cDefaultCompFlags;
- m_format = PIXEL_FMT_INVALID;
- m_source_file_type = texture_file_types::cFormatInvalid;
- m_last_error.clear();
- }
-
- void mipmapped_texture::free_all_mips()
- {
- for (uint i = 0; i < m_faces.size(); i++)
- for (uint j = 0; j < m_faces[i].size(); j++)
- crnlib_delete(m_faces[i][j]);
-
- m_faces.clear();
- }
-
- mipmapped_texture::mipmapped_texture(const mipmapped_texture& other) :
- m_width(0),
- m_height(0),
- m_comp_flags(pixel_format_helpers::cDefaultCompFlags),
- m_format(PIXEL_FMT_INVALID)
- {
- *this = other;
- }
-
- mipmapped_texture& mipmapped_texture::operator= (const mipmapped_texture& rhs)
- {
- if (this == &rhs)
- return *this;
-
- clear();
-
- m_name = rhs.m_name;
- m_width = rhs.m_width;
- m_height = rhs.m_height;
-
- m_comp_flags = rhs.m_comp_flags;
- m_format = rhs.m_format;
-
- m_faces.resize(rhs.m_faces.size());
- for (uint i = 0; i < m_faces.size(); i++)
- {
- m_faces[i].resize(rhs.m_faces[i].size());
-
- for (uint j = 0; j < rhs.m_faces[i].size(); j++)
- m_faces[i][j] = crnlib_new<mip_level>(*rhs.m_faces[i][j]);
- }
-
- CRNLIB_ASSERT((!is_valid()) || check());
-
- return *this;
- }
-
- bool mipmapped_texture::read_dds(data_stream_serializer& serializer)
- {
- if (!read_dds_internal(serializer))
- {
- clear();
- return false;
- }
-
- return true;
- }
-
- bool mipmapped_texture::read_dds_internal(data_stream_serializer& serializer)
- {
- CRNLIB_ASSERT(serializer.get_little_endian());
-
- clear();
-
- set_last_error("Not a DDS file");
-
- uint8 hdr[4];
- if (!serializer.read(hdr, sizeof(hdr)))
- return false;
-
- if (memcmp(hdr, "DDS ", 4) != 0)
- return false;
-
- DDSURFACEDESC2 desc;
- if (!serializer.read(&desc, sizeof(desc)))
- return false;
-
- if (!c_crnlib_little_endian_platform)
- utils::endian_switch_dwords(reinterpret_cast<uint32*>(&desc), sizeof(desc) / sizeof(uint32));
-
- if (desc.dwSize != sizeof(desc))
- return false;
-
- if ((!desc.dwHeight) || (!desc.dwWidth) || (desc.dwHeight > cDDSMaxImageDimensions) || (desc.dwWidth > cDDSMaxImageDimensions))
- return false;
-
- m_width = desc.dwWidth;
- m_height = desc.dwHeight;
-
- uint num_mip_levels = 1;
-
- if ((desc.dwFlags & DDSD_MIPMAPCOUNT) && (desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP) && (desc.dwMipMapCount))
- {
- num_mip_levels = desc.dwMipMapCount;
- if (num_mip_levels > utils::compute_max_mips(desc.dwWidth, desc.dwHeight))
- return false;
- }
-
- uint num_faces = 1;
-
- if (desc.ddsCaps.dwCaps & DDSCAPS_COMPLEX)
- {
- if (desc.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
- {
- const uint all_faces_mask = DDSCAPS2_CUBEMAP_POSITIVEX|DDSCAPS2_CUBEMAP_NEGATIVEX|DDSCAPS2_CUBEMAP_POSITIVEY|DDSCAPS2_CUBEMAP_NEGATIVEY|DDSCAPS2_CUBEMAP_POSITIVEZ|DDSCAPS2_CUBEMAP_NEGATIVEZ;
- if ((desc.ddsCaps.dwCaps2 & all_faces_mask) != all_faces_mask)
- {
- set_last_error("Incomplete cubemaps unsupported");
- return false;
- }
-
- num_faces = 6;
- }
- else if (desc.ddsCaps.dwCaps2 & DDSCAPS2_VOLUME)
- {
- set_last_error("Volume textures unsupported");
- return false;
- }
- }
-
- if (desc.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)
- {
- // It's difficult to even make P8 textures with existing tools:
- // nvdxt just hangs
- // dxtex.exe just makes all-white textures
- // So screw it.
- set_last_error("Palettized textures unsupported");
- return false;
- }
-
- dxt_format dxt_fmt = cDXTInvalid;
-
- if (desc.ddpfPixelFormat.dwFlags & DDPF_FOURCC)
- {
- // http://code.google.com/p/nvidia-texture-tools/issues/detail?id=41
- // ATI2 YX: 0 (0x00000000)
- // ATI2 XY: 1498952257 (0x59583241) (BC5)
- // ATI Compressonator obeys this stuff, nvidia's tools (like readdxt) don't - oh great
-
- switch (desc.ddpfPixelFormat.dwFourCC)
- {
- case PIXEL_FMT_DXT1:
- {
- m_format = PIXEL_FMT_DXT1;
- dxt_fmt = cDXT1;
- break;
- }
- case PIXEL_FMT_DXT2:
- case PIXEL_FMT_DXT3:
- {
- m_format = PIXEL_FMT_DXT3;
- dxt_fmt = cDXT3;
- break;
- }
- case PIXEL_FMT_DXT4:
- case PIXEL_FMT_DXT5:
- {
- switch (desc.ddpfPixelFormat.dwRGBBitCount)
- {
- case PIXEL_FMT_DXT5_CCxY:
- m_format = PIXEL_FMT_DXT5_CCxY;
- break;
- case PIXEL_FMT_DXT5_xGxR:
- m_format = PIXEL_FMT_DXT5_xGxR;
- break;
- case PIXEL_FMT_DXT5_xGBR:
- m_format = PIXEL_FMT_DXT5_xGBR;
- break;
- case PIXEL_FMT_DXT5_AGBR:
- m_format = PIXEL_FMT_DXT5_AGBR;
- break;
- default:
- m_format = PIXEL_FMT_DXT5;
- break;
- }
-
- dxt_fmt = cDXT5;
- break;
- }
- case PIXEL_FMT_3DC:
- {
- if (desc.ddpfPixelFormat.dwRGBBitCount == CRNLIB_PIXEL_FMT_FOURCC('A', '2', 'X', 'Y'))
- {
- dxt_fmt = cDXN_XY;
- m_format = PIXEL_FMT_DXN;
- }
- else
- {
- dxt_fmt = cDXN_YX; // aka ATI2
- m_format = PIXEL_FMT_3DC;
- }
-
- break;
- }
- case PIXEL_FMT_DXT5A:
- {
- m_format = PIXEL_FMT_DXT5A;
- dxt_fmt = cDXT5A;
- break;
- }
- case PIXEL_FMT_ETC1:
- {
- m_format = PIXEL_FMT_ETC1;
- dxt_fmt = cETC1;
- break;
- }
- default:
- {
- dynamic_string err_msg(cVarArg, "Unsupported DDS FOURCC format: 0x%08X", desc.ddpfPixelFormat.dwFourCC);
- set_last_error(err_msg.get_ptr());
- return false;
- }
- }
- }
- else if ((desc.ddpfPixelFormat.dwRGBBitCount < 8) || (desc.ddpfPixelFormat.dwRGBBitCount > 32) || (desc.ddpfPixelFormat.dwRGBBitCount & 7))
- {
- set_last_error("Unsupported bit count");
- return false;
- }
- else if (desc.ddpfPixelFormat.dwFlags & DDPF_RGB)
- {
- if (desc.ddpfPixelFormat.dwFlags & DDPF_LUMINANCE)
- {
- if (desc.ddpfPixelFormat.dwFlags & DDPF_ALPHAPIXELS)
- m_format = PIXEL_FMT_A8L8;
- else
- m_format = PIXEL_FMT_L8;
- }
- else if (desc.ddpfPixelFormat.dwFlags & DDPF_ALPHAPIXELS)
- m_format = PIXEL_FMT_A8R8G8B8;
- else
- m_format = PIXEL_FMT_R8G8B8;
- }
- else if (desc.ddpfPixelFormat.dwFlags & DDPF_ALPHAPIXELS)
- {
- if (desc.ddpfPixelFormat.dwFlags & DDPF_LUMINANCE)
- m_format = PIXEL_FMT_A8L8;
- else
- m_format = PIXEL_FMT_A8;
- }
- else if (desc.ddpfPixelFormat.dwFlags & DDPF_LUMINANCE)
- {
- m_format = PIXEL_FMT_L8;
- }
- else if (desc.ddpfPixelFormat.dwFlags & DDPF_ALPHA)
- {
- m_format = PIXEL_FMT_A8;
- }
- else
- {
- set_last_error("Unsupported format");
- return false;
- }
-
- m_comp_flags = pixel_format_helpers::get_component_flags(m_format);
-
- uint bits_per_pixel = desc.ddpfPixelFormat.dwRGBBitCount;
-
- if (desc.ddpfPixelFormat.dwFlags & DDPF_FOURCC)
- bits_per_pixel = pixel_format_helpers::get_bpp(m_format);
-
- set_last_error("Load failed");
-
- uint default_pitch;
- if (desc.ddpfPixelFormat.dwFlags & DDPF_FOURCC)
- default_pitch = (((desc.dwWidth + 3) & ~3) * ((desc.dwHeight + 3) & ~3) * bits_per_pixel) >> 3;
- else
- default_pitch = (desc.dwWidth * bits_per_pixel) >> 3;
-
- uint pitch = 0;
- if ( ( desc.dwFlags & DDSD_PITCH ) && ( !( desc.dwFlags & DDSD_LINEARSIZE ) ) )
- {
- pitch = desc.lPitch;
- }
-
- if (!pitch)
- pitch = default_pitch;
-#if 0
- else if (pitch & 3)
- {
- // MS's DDS docs say the pitch must be DWORD aligned - but this isn't always the case.
- // ATI Compressonator writes images with non-DWORD aligned pitches, and the DDSWithoutD3DX sample from MS doesn't compute the proper DWORD aligned pitch when reading DDS
- // files, so the docs must be wrong/outdated.
- console::warning("DDS file's pitch is not divisible by 4 - trying to load anyway.");
- }
-#endif
- // Check for obviously wacky source pitches (probably a corrupted/invalid file).
- else if (pitch > default_pitch * 8)
- {
- set_last_error("Invalid pitch");
- return false;
- }
-
- crnlib::vector<uint8> load_buf;
-
- uint mask_size[4];
- mask_size[0] = math::bitmask_size(desc.ddpfPixelFormat.dwRBitMask);
- mask_size[1] = math::bitmask_size(desc.ddpfPixelFormat.dwGBitMask);
- mask_size[2] = math::bitmask_size(desc.ddpfPixelFormat.dwBBitMask);
- mask_size[3] = math::bitmask_size(desc.ddpfPixelFormat.dwRGBAlphaBitMask);
-
- uint mask_ofs[4];
- mask_ofs[0] = math::bitmask_ofs(desc.ddpfPixelFormat.dwRBitMask);
- mask_ofs[1] = math::bitmask_ofs(desc.ddpfPixelFormat.dwGBitMask);
- mask_ofs[2] = math::bitmask_ofs(desc.ddpfPixelFormat.dwBBitMask);
- mask_ofs[3] = math::bitmask_ofs(desc.ddpfPixelFormat.dwRGBAlphaBitMask);
-
- if ((desc.ddpfPixelFormat.dwFlags & DDPF_LUMINANCE) && (!mask_size[0]))
- {
- mask_size[0] = desc.ddpfPixelFormat.dwRGBBitCount >> 3;
- if (desc.ddpfPixelFormat.dwFlags & DDPF_ALPHAPIXELS)
- mask_size[0] /= 2;
- }
-
- m_faces.resize(num_faces);
-
- bool dxt1_alpha = false;
-
- for (uint face_index = 0; face_index < num_faces; face_index++)
- {
- m_faces[face_index].resize(num_mip_levels);
-
- for (uint level_index = 0; level_index < num_mip_levels; level_index++)
- {
- const uint width = math::maximum<uint>(desc.dwWidth >> level_index, 1U);
- const uint height = math::maximum<uint>(desc.dwHeight >> level_index, 1U);
-
- mip_level* pMip = crnlib_new<mip_level>();
- m_faces[face_index][level_index] = pMip;
-
- if (desc.ddpfPixelFormat.dwFlags & DDPF_FOURCC)
- {
- const uint bytes_per_block = pixel_format_helpers::get_dxt_bytes_per_block(m_format);
-
- const uint num_blocks_x = (width + 3) >> 2;
- const uint num_blocks_y = (height + 3) >> 2;
-
- const uint actual_level_pitch = num_blocks_x * num_blocks_y * bytes_per_block;
- const uint level_pitch = level_index ? actual_level_pitch : pitch;
-
- dxt_image* pDXTImage = crnlib_new<dxt_image>();
- if (!pDXTImage->init(dxt_fmt, width, height, false))
- {
- crnlib_delete(pDXTImage);
-
- CRNLIB_ASSERT(0);
- return false;
- }
-
- CRNLIB_ASSERT(pDXTImage->get_element_vec().size() * sizeof(dxt_image::element) == actual_level_pitch);
-
- if (!serializer.read(&pDXTImage->get_element_vec()[0], actual_level_pitch))
- {
- crnlib_delete(pDXTImage);
-
- return false;
- }
-
- // DDS image in memory are always assumed to be little endian - the same as DDS itself.
- //if (c_crnlib_big_endian_platform)
- // utils::endian_switch_words(reinterpret_cast<uint16*>(&pDXTImage->get_element_vec()[0]), actual_level_pitch / sizeof(uint16));
-
- if (level_pitch > actual_level_pitch)
- {
- if (!serializer.skip(level_pitch - actual_level_pitch))
- {
- crnlib_delete(pDXTImage);
-
- return false;
- }
- }
-
- if ((m_format == PIXEL_FMT_DXT1) && (!dxt1_alpha))
- dxt1_alpha = pDXTImage->has_alpha();
-
- pMip->assign(pDXTImage, m_format);
- }
- else
- {
- image_u8* pImage = crnlib_new<image_u8>(width, height);
-
- pImage->set_comp_flags(m_comp_flags);
-
- const uint bytes_per_pixel = desc.ddpfPixelFormat.dwRGBBitCount >> 3;
- const uint actual_line_pitch = width * bytes_per_pixel;
- const uint line_pitch = level_index ? actual_line_pitch : pitch;
-
- if (load_buf.size() < line_pitch)
- load_buf.resize(line_pitch);
-
- color_quad_u8 q(0, 0, 0, 255);
-
- for (uint y = 0; y < height; y++)
- {
- if (!serializer.read(&load_buf[0], line_pitch))
- {
- crnlib_delete(pImage);
- return false;
- }
-
- color_quad_u8* pDst = pImage->get_scanline(y);
-
- for (uint x = 0; x < width; x++)
- {
- const uint8* pPixel = &load_buf[x * bytes_per_pixel];
-
- uint c = 0;
- // Assumes DDS is always little endian.
- for (uint l = 0; l < bytes_per_pixel; l++)
- c |= (pPixel[l] << (l * 8U));
-
- for (uint i = 0; i < 4; i++)
- {
- if (!mask_size[i])
- continue;
-
- uint mask = (1U << mask_size[i]) - 1U;
- uint bits = (c >> mask_ofs[i]) & mask;
-
- uint v = (bits * 255 + (mask >> 1)) / mask;
-
- q.set_component(i, v);
- }
-
- if (desc.ddpfPixelFormat.dwFlags & DDPF_LUMINANCE)
- {
- q.g = q.r;
- q.b = q.r;
- }
-
- *pDst++ = q;
- }
- }
-
- pMip->assign(pImage, m_format);
-
- CRNLIB_ASSERT(pMip->get_comp_flags() == m_comp_flags);
- }
- }
- }
-
- clear_last_error();
-
- if (dxt1_alpha)
- change_dxt1_to_dxt1a();
-
- return true;
- }
-
- void mipmapped_texture::change_dxt1_to_dxt1a()
- {
- if (m_format != PIXEL_FMT_DXT1)
- return;
-
- m_format = PIXEL_FMT_DXT1A;
-
- m_comp_flags = pixel_format_helpers::get_component_flags(m_format);
-
- for (uint f = 0; f < m_faces.size(); f++)
- {
- for (uint l = 0; l < m_faces[f].size(); l++)
- {
- if (m_faces[f][l]->get_dxt_image())
- {
- m_faces[f][l]->set_format(m_format);
- m_faces[f][l]->set_comp_flags(m_comp_flags);
-
- m_faces[f][l]->get_dxt_image()->change_dxt1_to_dxt1a();
- }
- }
- }
- }
-
- bool mipmapped_texture::check() const
- {
- uint levels = 0;
- orientation_flags_t orient_flags = cDefaultOrientationFlags;
- for (uint f = 0; f < m_faces.size(); f++)
- {
- if (!f)
- {
- levels = m_faces[f].size();
- if ((levels) && (m_faces[f][0]))
- orient_flags = m_faces[f][0]->get_orientation_flags();
- }
- else if (m_faces[f].size() != levels)
- return false;
-
- for (uint l = 0; l < m_faces[f].size(); l++)
- {
- mip_level* p = m_faces[f][l];
- if (!p)
- return false;
-
- if (!p->is_valid())
- return false;
-
- if (p->get_orientation_flags() != orient_flags)
- return false;
-
- if (!l)
- {
- if (m_width != p->get_width())
- return false;
- if (m_height != p->get_height())
- return false;
- }
-
- if (p->get_comp_flags() != m_comp_flags)
- return false;
-
- if (p->get_format() != m_format)
- return false;
-
- if (p->get_image())
- {
- if (pixel_format_helpers::is_dxt(p->get_format()))
- return false;
-
- if (p->get_image()->get_width() != p->get_width())
- return false;
- if (p->get_image()->get_height() != p->get_height())
- return false;
- if (p->get_image()->get_comp_flags() != m_comp_flags)
- return false;
- }
- else if (!pixel_format_helpers::is_dxt(p->get_format()))
- return false;
- }
- }
-
- return true;
- }
-
- bool mipmapped_texture::write_dds(data_stream_serializer& serializer) const
- {
- if (!m_width)
- {
- set_last_error("Nothing to write");
- return false;
- }
-
- set_last_error("write_dds() failed");
-
- if (!serializer.write("DDS ", sizeof(uint32)))
- return false;
-
- DDSURFACEDESC2 desc;
- utils::zero_object(desc);
-
- desc.dwSize = sizeof(desc);
- desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_CAPS;
-
- desc.dwWidth = m_width;
- desc.dwHeight = m_height;
-
- desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
- desc.ddpfPixelFormat.dwSize = sizeof(desc.ddpfPixelFormat);
-
- if (get_num_levels() > 1)
- {
- desc.dwMipMapCount = get_num_levels();
- desc.dwFlags |= DDSD_MIPMAPCOUNT;
- desc.ddsCaps.dwCaps |= (DDSCAPS_MIPMAP | DDSCAPS_COMPLEX);
- }
-
- if (get_num_faces() > 1)
- {
- desc.ddsCaps.dwCaps |= DDSCAPS_COMPLEX;
- desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP;
- desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX|DDSCAPS2_CUBEMAP_NEGATIVEX|DDSCAPS2_CUBEMAP_POSITIVEY|DDSCAPS2_CUBEMAP_NEGATIVEY|DDSCAPS2_CUBEMAP_POSITIVEZ|DDSCAPS2_CUBEMAP_NEGATIVEZ;
- }
-
- bool dxt_format = false;
- if (pixel_format_helpers::is_dxt(m_format))
- {
- dxt_format = true;
-
- desc.ddpfPixelFormat.dwFlags |= DDPF_FOURCC;
-
- switch (m_format)
- {
- case PIXEL_FMT_ETC1:
- {
- desc.ddpfPixelFormat.dwFourCC = (uint32)PIXEL_FMT_ETC1;
- desc.ddpfPixelFormat.dwRGBBitCount = 0;
- break;
- }
- case PIXEL_FMT_DXN:
- {
- desc.ddpfPixelFormat.dwFourCC = (uint32)PIXEL_FMT_3DC;
- desc.ddpfPixelFormat.dwRGBBitCount = PIXEL_FMT_DXN;
- break;
- }
- case PIXEL_FMT_DXT1A:
- {
- desc.ddpfPixelFormat.dwFourCC = (uint32)PIXEL_FMT_DXT1;
- desc.ddpfPixelFormat.dwRGBBitCount = 0;
- break;
- }
- case PIXEL_FMT_DXT5_CCxY:
- {
- desc.ddpfPixelFormat.dwFourCC = (uint32)PIXEL_FMT_DXT5;
- desc.ddpfPixelFormat.dwRGBBitCount = (uint32)PIXEL_FMT_DXT5_CCxY;
- break;
- }
- case PIXEL_FMT_DXT5_xGxR:
- {
- desc.ddpfPixelFormat.dwFourCC = (uint32)PIXEL_FMT_DXT5;
- desc.ddpfPixelFormat.dwRGBBitCount = (uint32)PIXEL_FMT_DXT5_xGxR;
- break;
- }
- case PIXEL_FMT_DXT5_xGBR:
- {
- desc.ddpfPixelFormat.dwFourCC = (uint32)PIXEL_FMT_DXT5;
- desc.ddpfPixelFormat.dwRGBBitCount = (uint32)PIXEL_FMT_DXT5_xGBR;
- break;
- }
- case PIXEL_FMT_DXT5_AGBR:
- {
- desc.ddpfPixelFormat.dwFourCC = (uint32)PIXEL_FMT_DXT5;
- desc.ddpfPixelFormat.dwRGBBitCount = (uint32)PIXEL_FMT_DXT5_AGBR;
- break;
- }
- default:
- {
- desc.ddpfPixelFormat.dwFourCC = (uint32)m_format;
- desc.ddpfPixelFormat.dwRGBBitCount = 0;
- break;
- }
- }
-
- uint bits_per_pixel = pixel_format_helpers::get_bpp(m_format);
- desc.lPitch = (((desc.dwWidth + 3) & ~3) * ((desc.dwHeight + 3) & ~3) * bits_per_pixel) >> 3;
- desc.dwFlags |= DDSD_LINEARSIZE;
- }
- else
- {
- switch (m_format)
- {
- case PIXEL_FMT_A8R8G8B8:
- {
- desc.ddpfPixelFormat.dwFlags |= (DDPF_RGB | DDPF_ALPHAPIXELS);
- desc.ddpfPixelFormat.dwRGBBitCount = 32;
- desc.ddpfPixelFormat.dwRBitMask = 0xFF0000;
- desc.ddpfPixelFormat.dwGBitMask = 0x00FF00;
- desc.ddpfPixelFormat.dwBBitMask = 0x0000FF;
- desc.ddpfPixelFormat.dwRGBAlphaBitMask = 0xFF000000;
- break;
- }
- case PIXEL_FMT_R8G8B8:
- {
- desc.ddpfPixelFormat.dwFlags |= DDPF_RGB;
- desc.ddpfPixelFormat.dwRGBBitCount = 24;
- desc.ddpfPixelFormat.dwRBitMask = 0xFF0000;
- desc.ddpfPixelFormat.dwGBitMask = 0x00FF00;
- desc.ddpfPixelFormat.dwBBitMask = 0x0000FF;
- break;
- }
- case PIXEL_FMT_A8:
- {
- desc.ddpfPixelFormat.dwFlags |= DDPF_ALPHA;
- desc.ddpfPixelFormat.dwRGBBitCount = 8;
- desc.ddpfPixelFormat.dwRGBAlphaBitMask = 0xFF;
- break;
- }
- case PIXEL_FMT_L8:
- {
- desc.ddpfPixelFormat.dwFlags |= DDPF_LUMINANCE;
- desc.ddpfPixelFormat.dwRGBBitCount = 8;
- desc.ddpfPixelFormat.dwRBitMask = 0xFF;
- break;
- }
- case PIXEL_FMT_A8L8:
- {
- desc.ddpfPixelFormat.dwFlags |= DDPF_ALPHAPIXELS | DDPF_LUMINANCE;
- desc.ddpfPixelFormat.dwRGBBitCount = 16;
- desc.ddpfPixelFormat.dwRBitMask = 0xFF;
- desc.ddpfPixelFormat.dwRGBAlphaBitMask = 0xFF00;
- break;
- }
- default:
- {
- CRNLIB_ASSERT(false);
- return false;
- }
- }
-
- uint bits_per_pixel = desc.ddpfPixelFormat.dwRGBBitCount;
- desc.lPitch = (desc.dwWidth * bits_per_pixel) >> 3;
- desc.dwFlags |= DDSD_LINEARSIZE;
- }
-
- if (!c_crnlib_little_endian_platform)
- utils::endian_switch_dwords(reinterpret_cast<uint32*>(&desc), sizeof(desc) / sizeof(uint32));
-
- if (!serializer.write(&desc, sizeof(desc)))
- return false;
-
- if (!c_crnlib_little_endian_platform)
- utils::endian_switch_dwords(reinterpret_cast<uint32*>(&desc), sizeof(desc) / sizeof(uint32));
-
- crnlib::vector<uint8> write_buf;
-
- const bool can_unflip_packed_texture = can_unflip_without_unpacking();
- if ((is_packed()) && (is_flipped()) && (!can_unflip_without_unpacking()))
- {
- console::warning("mipmapped_texture::write_dds: One or more faces/miplevels cannot be unflipped without unpacking. Writing flipped .DDS texture.");
- }
-
- for (uint face = 0; face < get_num_faces(); face++)
- {
- for (uint level = 0; level < get_num_levels(); level++)
- {
- const mip_level* pLevel = get_level(face, level);
-
- if (dxt_format)
- {
- const uint width = pLevel->get_width();
- const uint height = pLevel->get_height();
-
- CRNLIB_ASSERT(width == math::maximum<uint>(1, m_width >> level));
- CRNLIB_ASSERT(height == math::maximum<uint>(1, m_height >> level));
-
- const dxt_image* p = pLevel->get_dxt_image();
- dxt_image tmp;
- if ((can_unflip_packed_texture) && (pLevel->get_orientation_flags() & (cOrientationFlagXFlipped | cOrientationFlagYFlipped)))
- {
- tmp = *p;
- if (pLevel->get_orientation_flags() & cOrientationFlagXFlipped)
- {
- if (!tmp.flip_x())
- console::warning("mipmapped_texture::write_dds: Unable to unflip compressed texture on X axis");
- }
-
- if (pLevel->get_orientation_flags() & cOrientationFlagYFlipped)
- {
- if (!tmp.flip_y())
- console::warning("mipmapped_texture::write_dds: Unable to unflip compressed texture on Y axis");
- }
- p = &tmp;
- }
-
- const uint num_blocks_x = (width + 3) >> 2;
- const uint num_blocks_y = (height + 3) >> 2;
-
- CRNLIB_ASSERT(num_blocks_x * num_blocks_y * p->get_elements_per_block() == p->get_total_elements());
- width, height, num_blocks_x, num_blocks_y;
-
- const uint size_in_bytes = p->get_total_elements() * sizeof(dxt_image::element);
- if (size_in_bytes > write_buf.size())
- write_buf.resize(size_in_bytes);
-
- memcpy(&write_buf[0], p->get_element_ptr(), size_in_bytes);
-
- // DXT data is always little endian in memory, just like the DDS format.
- // (Except for ETC1, which contains big endian 64-bit QWORD's).
- //if (!c_crnlib_little_endian_platform)
- // utils::endian_switch_words(reinterpret_cast<WORD*>(&write_buf[0]), size_in_bytes / sizeof(WORD));
-
- if (!serializer.write(&write_buf[0], size_in_bytes))
- return false;
- }
- else
- {
- const uint width = pLevel->get_width();
- const uint height = pLevel->get_height();
-
- const image_u8* p = pLevel->get_image();
- image_u8 tmp;
- if (pLevel->get_orientation_flags() & (cOrientationFlagXFlipped | cOrientationFlagYFlipped))
- {
- p = pLevel->get_unpacked_image(tmp, cUnpackFlagUnflip);
- }
-
- const uint bits_per_pixel = desc.ddpfPixelFormat.dwRGBBitCount;
- const uint bytes_per_pixel = bits_per_pixel >> 3;
-
- const uint pitch = width * bytes_per_pixel;
- if (pitch > write_buf.size())
- write_buf.resize(pitch);
-
- for (uint y = 0; y < height; y++)
- {
- const color_quad_u8* pSrc = p->get_scanline(y);
- const color_quad_u8* pEnd = pSrc + width;
-
- uint8* pDst = &write_buf[0];
-
- do
- {
- const color_quad_u8& c = *pSrc;
-
- uint x = 0;
- switch (m_format)
- {
- case PIXEL_FMT_A8R8G8B8:
- {
- x = (c.a << 24) | (c.r << 16) | (c.g << 8) | c.b;
- break;
- }
- case PIXEL_FMT_R8G8B8:
- {
- x = (c.r << 16) | (c.g << 8) | c.b;
- break;
- }
- case PIXEL_FMT_A8:
- {
- x = c.a;
- break;
- }
- case PIXEL_FMT_A8L8:
- {
- x = (c.a << 8) | c.get_luma();
- break;
- }
- case PIXEL_FMT_L8:
- {
- x = c.get_luma();
- break;
- }
- default: break;
- }
-
- pDst[0] = static_cast<uint8>(x);
- if (bytes_per_pixel > 1)
- {
- pDst[1] = static_cast<uint8>(x >> 8);
-
- if (bytes_per_pixel > 2)
- {
- pDst[2] = static_cast<uint8>(x >> 16);
-
- if (bytes_per_pixel > 3)
- pDst[3] = static_cast<uint8>(x >> 24);
- }
- }
-
- pSrc++;
- pDst += bytes_per_pixel;
-
- } while (pSrc != pEnd);
-
- if (!serializer.write(&write_buf[0], pitch))
- return false;
- }
- }
- }
- }
-
- clear_last_error();
-
- return true;
- }
-
- bool mipmapped_texture::read_ktx(data_stream_serializer& serializer)
- {
- clear();
-
- set_last_error("Unable to read KTX file");
-
- ktx_texture kt;
- if (!kt.read_from_stream(serializer))
- return false;
-
- if ((kt.get_depth() > 1) || (kt.get_array_size() > 1))
- {
- set_last_error("read_ktx: Depth and array textures are not supported");
- return false;
- }
-
- // Must be 1D, 2D, or a cubemap, with or without mipmaps.
- m_width = kt.get_width();
- m_height = kt.get_height();
-
- uint num_mip_levels = kt.get_num_mips();
- uint num_faces = kt.get_num_faces();
-
- uint32 crnlib_fourcc = 0;
- dynamic_string crnlib_fourcc_str;
- if (kt.get_key_value_as_string("CRNLIB_FOURCC", crnlib_fourcc_str))
- {
- if (crnlib_fourcc_str.get_len() == 4)
- {
- for (int i = 3; i >= 0; i--)
- crnlib_fourcc = (crnlib_fourcc << 8) | crnlib_fourcc_str[i];
- }
- }
-
- const bool is_compressed_texture = kt.is_compressed();
- dxt_format dxt_fmt = cDXTInvalid;
-
- pixel_packer unpacker;
- if (is_compressed_texture)
- {
- switch (kt.get_ogl_internal_fmt())
- {
- case KTX_ETC1_RGB8_OES:
- dxt_fmt = cETC1;
- break;
- case KTX_RGB_S3TC:
- case KTX_RGB4_S3TC:
- case KTX_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case KTX_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- dxt_fmt = cDXT1;
- break;
- case KTX_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- dxt_fmt = cDXT1A;
- break;
- case KTX_RGBA_S3TC:
- case KTX_RGBA4_S3TC:
- case KTX_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- dxt_fmt = cDXT3;
- break;
- case KTX_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- case KTX_RGBA_DXT5_S3TC:
- case KTX_RGBA4_DXT5_S3TC:
- dxt_fmt = cDXT5;
- break;
- case KTX_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:
- dxt_fmt = cDXN_YX;
- if (crnlib_fourcc == PIXEL_FMT_DXN)
- {
- dxt_fmt = cDXN_XY;
- }
- break;
- case KTX_COMPRESSED_LUMINANCE_LATC1_EXT:
- dxt_fmt = cDXT5A;
- break;
- default:
- set_last_error("Unsupported KTX internal format");
- return false;
- }
-
- m_format = pixel_format_helpers::from_dxt_format(dxt_fmt);
- if (m_format == PIXEL_FMT_INVALID)
- {
- set_last_error("Unsupported KTX internal compressed format");
- return false;
- }
-
- if (crnlib_fourcc != 0)
- {
- switch (crnlib_fourcc)
- {
- case PIXEL_FMT_DXT5_CCxY:
- case PIXEL_FMT_DXT5_xGxR:
- case PIXEL_FMT_DXT5_xGBR:
- case PIXEL_FMT_DXT5_AGBR:
- {
- if (dxt_fmt == cDXT5)
- {
- m_format = static_cast<pixel_format>(crnlib_fourcc);
- }
- break;
- }
- }
- }
- }
- else
- {
- m_format = PIXEL_FMT_A8R8G8B8;
- const uint type_size = get_ogl_type_size(kt.get_ogl_type());
- const uint type_bits = type_size * 8;
-
- // Normal component order: 1,2,3,4 (*last* component packed into LSB of output type)
- // Reversed component order: 4,3,2,1 (*first* component packed into LSB of output type)
-
- if (is_packed_pixel_ogl_type(kt.get_ogl_type()))
- {
- switch (kt.get_ogl_type())
- {
- // 24bpp packed formats
- case KTX_UNSIGNED_BYTE_3_3_2: unpacker.init("B2G3R3"); m_format = PIXEL_FMT_R8G8B8; break;
- case KTX_UNSIGNED_BYTE_2_3_3_REV: unpacker.init("R3G3B2"); m_format = PIXEL_FMT_R8G8B8; break;
- case KTX_UNSIGNED_SHORT_5_6_5: unpacker.init("B5G6R5"); m_format = PIXEL_FMT_R8G8B8; break;
- case KTX_UNSIGNED_SHORT_5_6_5_REV: unpacker.init("R5G6B5"); m_format = PIXEL_FMT_R8G8B8; break;
- // 32bpp packed formats
- case KTX_UNSIGNED_SHORT_4_4_4_4: unpacker.init("A4B4G4R4"); break;
- case KTX_UNSIGNED_SHORT_4_4_4_4_REV: unpacker.init("R4G4B4A4"); break;
- case KTX_UNSIGNED_SHORT_5_5_5_1: unpacker.init("A1B5G5R5"); break;
- case KTX_UNSIGNED_SHORT_1_5_5_5_REV: unpacker.init("R5G5B5A1"); break;
- case KTX_UNSIGNED_INT_8_8_8_8: unpacker.init("A8B8G8R8"); break;
- case KTX_UNSIGNED_INT_8_8_8_8_REV: unpacker.init("R8G8B8A8"); break;
- case KTX_UNSIGNED_INT_10_10_10_2: unpacker.init("A2B10G10R10"); break;
- case KTX_UNSIGNED_INT_2_10_10_10_REV: unpacker.init("R10G10B10A2"); break;
- case KTX_UNSIGNED_INT_5_9_9_9_REV: unpacker.init("R9G9B9A5"); break;
- default:
- set_last_error("Unsupported KTX packed pixel type");
- return false;
- }
-
- unpacker.set_pixel_stride(get_ogl_type_size(kt.get_ogl_type()));
- }
- else
- {
- switch (kt.get_ogl_fmt())
- {
- case 1:
- case KTX_RED:
- case KTX_RED_INTEGER:
- case KTX_R8:
- case KTX_R8UI:
- {
- unpacker.init("R", -1, type_bits);
- m_format = PIXEL_FMT_R8G8B8;
- break;
- }
- case KTX_GREEN:
- case KTX_GREEN_INTEGER:
- {
- unpacker.init("G", -1, type_bits);
- m_format = PIXEL_FMT_R8G8B8;
- break;
- }
- case KTX_BLUE:
- case KTX_BLUE_INTEGER:
- {
- unpacker.init("B", -1, type_bits);
- m_format = PIXEL_FMT_R8G8B8;
- break;
- }
- case KTX_ALPHA:
- {
- unpacker.init("A", -1, type_bits);
- m_format = PIXEL_FMT_A8;
- break;
- }
- case KTX_LUMINANCE:
- {
- unpacker.init("Y", -1, type_bits);
- m_format = PIXEL_FMT_L8;
- break;
- }
- case 2:
- case KTX_RG:
- case KTX_RG8:
- case KTX_RG_INTEGER:
- {
- unpacker.init("RG", -1, type_bits);
- m_format = PIXEL_FMT_A8L8;
- break;
- }
- case KTX_LUMINANCE_ALPHA:
- {
- unpacker.init("YA", -1, type_bits);
- m_format = PIXEL_FMT_A8L8;
- break;
- }
- case 3:
- case KTX_SRGB:
- case KTX_RGB:
- case KTX_RGB_INTEGER:
- case KTX_RGB8:
- case KTX_SRGB8:
- {
- unpacker.init("RGB", -1, type_bits);
- m_format = PIXEL_FMT_R8G8B8;
- break;
- }
- case KTX_BGR:
- case KTX_BGR_INTEGER:
- {
- unpacker.init("BGR", -1, type_bits);
- m_format = PIXEL_FMT_R8G8B8;
- break;
- }
- case 4:
- case KTX_RGBA_INTEGER:
- case KTX_RGBA:
- case KTX_SRGB_ALPHA:
- case KTX_SRGB8_ALPHA8:
- case KTX_RGBA8:
- {
- unpacker.init("RGBA", -1, type_bits);
- break;
- }
- case KTX_BGRA:
- case KTX_BGRA_INTEGER:
- {
- unpacker.init("BGRA", -1, type_bits);
- break;
- }
- default:
- set_last_error("Unsupported KTX pixel format");
- return false;
- }
-
- unpacker.set_pixel_stride(unpacker.get_num_comps() * get_ogl_type_size(kt.get_ogl_type()));
- }
-
- CRNLIB_ASSERT(unpacker.is_valid());
- }
-
- m_comp_flags = pixel_format_helpers::get_component_flags(m_format);
-
- m_faces.resize(num_faces);
-
- bool x_flipped = false;
- bool y_flipped = true;
-
- dynamic_string orient;
- if ((kt.get_key_value_as_string("KTXorientation", orient)) && (orient.get_len() >= 7))
- {
- // 0123456
- // "S=r,T=d"
- if ((orient[0] == 'S') && (orient[1] == '=') && (orient[3] == ',') &&
- (orient[4] == 'T') && (orient[5] == '='))
- {
- if (tolower(orient[2]) == 'l')
- x_flipped = true;
- else if (tolower(orient[2]) == 'r')
- x_flipped = false;
-
- if (tolower(orient[6]) == 'u')
- y_flipped = true;
- else if (tolower(orient[6]) == 'd')
- y_flipped = false;
- }
- }
-
- orientation_flags_t orient_flags = cDefaultOrientationFlags;
- if (x_flipped) orient_flags = static_cast<orientation_flags_t>(orient_flags | cOrientationFlagXFlipped);
- if (y_flipped) orient_flags = static_cast<orientation_flags_t>(orient_flags | cOrientationFlagYFlipped);
-
- bool dxt1_alpha = false;
-
- for (uint face_index = 0; face_index < num_faces; face_index++)
- {
- m_faces[face_index].resize(num_mip_levels);
-
- for (uint level_index = 0; level_index < num_mip_levels; level_index++)
- {
- const uint width = math::maximum<uint>(m_width >> level_index, 1U);
- const uint height = math::maximum<uint>(m_height >> level_index, 1U);
-
- mip_level* pMip = crnlib_new<mip_level>();
- m_faces[face_index][level_index] = pMip;
-
- const crnlib::vector<uint8>& image_data = kt.get_image_data(level_index, 0, face_index, 0);
-
- if (is_compressed_texture)
- {
- const uint bytes_per_block = pixel_format_helpers::get_dxt_bytes_per_block(m_format);
-
- const uint num_blocks_x = (width + 3) >> 2;
- const uint num_blocks_y = (height + 3) >> 2;
-
- const uint level_pitch = num_blocks_x * num_blocks_y * bytes_per_block;
- if (image_data.size() != level_pitch)
- return false;
-
- dxt_image* pDXTImage = crnlib_new<dxt_image>();
- if (!pDXTImage->init(dxt_fmt, width, height, false))
- {
- crnlib_delete(pDXTImage);
-
- CRNLIB_ASSERT(0);
- return false;
- }
-
- CRNLIB_ASSERT(pDXTImage->get_element_vec().size() * sizeof(dxt_image::element) == level_pitch);
-
- memcpy(&pDXTImage->get_element_vec()[0], image_data.get_ptr(), image_data.size());
-
- if ((m_format == PIXEL_FMT_DXT1) && (!dxt1_alpha))
- dxt1_alpha = pDXTImage->has_alpha();
-
- pMip->assign(pDXTImage, m_format, orient_flags);
- }
- else
- {
- if (image_data.size() != (width * height * unpacker.get_pixel_stride()))
- return false;
-
- image_u8* pImage = crnlib_new<image_u8>(width, height);
-
- pImage->set_comp_flags(m_comp_flags);
-
- const uint8* pSrc = image_data.get_ptr();
-
- color_quad_u8 q(0, 0, 0, 255);
-
- for (uint y = 0; y < height; y++)
- {
- for (uint x = 0; x < width; x++)
- {
- color_quad_u8 c;
- pSrc = static_cast<const uint8*>(unpacker.unpack(pSrc, c));
- pImage->set_pixel_unclipped(x, y, c);
- }
- }
-
- pMip->assign(pImage, m_format, orient_flags);
-
- CRNLIB_ASSERT(pMip->get_comp_flags() == m_comp_flags);
- }
- }
- }
-
- clear_last_error();
-
- if (dxt1_alpha)
- change_dxt1_to_dxt1a();
-
- return true;
- }
-
- bool mipmapped_texture::write_ktx(data_stream_serializer& serializer) const
- {
- if (!m_width)
- {
- set_last_error("Nothing to write");
- return false;
- }
-
- set_last_error("write_ktx() failed");
-
- uint32 ogl_internal_fmt = 0, ogl_fmt = 0, ogl_type = 0;
-
- pixel_packer packer;
-
- if (is_packed())
- {
- switch (get_format())
- {
- case PIXEL_FMT_DXT1:
- {
- ogl_internal_fmt = KTX_COMPRESSED_RGB_S3TC_DXT1_EXT;
- break;
- }
- case PIXEL_FMT_DXT1A:
- {
- ogl_internal_fmt = KTX_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- break;
- }
- case PIXEL_FMT_DXT2:
- case PIXEL_FMT_DXT3:
- {
- ogl_internal_fmt = KTX_COMPRESSED_RGBA_S3TC_DXT3_EXT;
- break;
- }
- case PIXEL_FMT_DXT4:
- case PIXEL_FMT_DXT5:
- case PIXEL_FMT_DXT5_CCxY:
- case PIXEL_FMT_DXT5_xGxR:
- case PIXEL_FMT_DXT5_xGBR:
- case PIXEL_FMT_DXT5_AGBR:
- {
- ogl_internal_fmt = KTX_COMPRESSED_RGBA_S3TC_DXT5_EXT;
- break;
- }
- case PIXEL_FMT_3DC:
- case PIXEL_FMT_DXN:
- {
- ogl_internal_fmt = KTX_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
- break;
- }
- case PIXEL_FMT_DXT5A:
- {
- ogl_internal_fmt = KTX_COMPRESSED_LUMINANCE_LATC1_EXT;
- break;
- }
- case PIXEL_FMT_ETC1:
- {
- ogl_internal_fmt = KTX_ETC1_RGB8_OES;
- break;
- }
- default:
- {
- CRNLIB_ASSERT(0);
- return false;
- }
- }
- }
- else
- {
- ogl_type = KTX_UNSIGNED_BYTE;
-
- switch (get_format())
- {
- case PIXEL_FMT_R8G8B8: ogl_internal_fmt = KTX_RGB8; ogl_fmt = KTX_RGB; packer.init("R8G8B8"); break;
- case PIXEL_FMT_L8: ogl_internal_fmt = KTX_LUMINANCE8; ogl_fmt = KTX_LUMINANCE; packer.init("G8"); break;
- case PIXEL_FMT_A8: ogl_internal_fmt = KTX_ALPHA8; ogl_fmt = KTX_ALPHA; packer.init("A8"); break;
- case PIXEL_FMT_A8L8: ogl_internal_fmt = KTX_LUMINANCE8_ALPHA8; ogl_fmt = KTX_LUMINANCE_ALPHA; packer.init("Y8A8"); break;
- case PIXEL_FMT_A8R8G8B8: ogl_internal_fmt = KTX_RGBA8; ogl_fmt = KTX_RGBA; packer.init("R8G8B8A8"); break;
- default:
- {
- CRNLIB_ASSERT(0);
- return false;
- }
- }
- }
-
- ktx_texture kt;
- bool success;
- if (determine_texture_type() == cTextureTypeCubemap)
- success = kt.init_cubemap(get_width(), get_num_levels(), ogl_internal_fmt, ogl_fmt, ogl_type);
- else
- success = kt.init_2D(get_width(), get_height(), get_num_levels(), ogl_internal_fmt, ogl_fmt, ogl_type);
- if (!success)
- return false;
-
- dynamic_string fourcc_str(cVarArg, "%c%c%c%c", m_format & 0xFF, (m_format >> 8) & 0xFF, (m_format >> 16) & 0xFF, (m_format >> 24) & 0xFF);
- kt.add_key_value("CRNLIB_FOURCC", fourcc_str.get_ptr());
-
- const mip_level* pLevel0 = get_level(0, 0);
- dynamic_string ktx_orient_str(cVarArg, "S=%c,T=%c", (pLevel0->get_orientation_flags() & cOrientationFlagXFlipped) ? 'l' : 'r', (pLevel0->get_orientation_flags() & cOrientationFlagYFlipped) ? 'u' : 'd');
- kt.add_key_value("KTXorientation", ktx_orient_str.get_ptr());
-
- for (uint face_index = 0; face_index < get_num_faces(); face_index++)
- {
- for (uint level_index = 0; level_index < get_num_levels(); level_index++)
- {
- const mip_level* pLevel = get_level(face_index, level_index);
-
- const uint mip_width = pLevel->get_width();
- const uint mip_height = pLevel->get_height();
-
- if (is_packed())
- {
- const dxt_image* p = pLevel->get_dxt_image();
-
- kt.add_image(face_index, level_index, p->get_element_ptr(), p->get_size_in_bytes());
- }
- else
- {
- const image_u8* p = pLevel->get_image();
-
- crnlib::vector<uint8> tmp(mip_width * mip_height * packer.get_pixel_stride());
-
- uint8* pDst = tmp.get_ptr();
- for (uint y = 0; y < mip_height; y++)
- for (uint x = 0; x < mip_width; x++)
- pDst = (uint8*)packer.pack(p->get_unclamped(x, y), pDst);
-
- kt.add_image(face_index, level_index, tmp.get_ptr(), tmp.size_in_bytes());
- }
- }
- }
-
- if (!kt.write_to_stream(serializer))
- return false;
-
- clear_last_error();
- return true;
- }
-
- void mipmapped_texture::assign(face_vec& faces)
- {
- CRNLIB_ASSERT(!faces.empty());
- if (faces.empty())
- return;
-
- free_all_mips();
-
-#ifdef CRNLIB_BUILD_DEBUG
- for (uint i = 1; i < faces.size(); i++)
- CRNLIB_ASSERT(faces[i].size() == faces[0].size());
-#endif
-
- mip_level* p = faces[0][0];
- m_width = p->get_width();
- m_height = p->get_height();
- m_comp_flags = p->get_comp_flags();
- m_format = p->get_format();
-
- m_faces.swap(faces);
-
- CRNLIB_ASSERT(check());
- }
-
- void mipmapped_texture::assign(mip_level* pLevel)
- {
- face_vec faces(1, mip_ptr_vec(1, pLevel));
- assign(faces);
- }
-
- void mipmapped_texture::assign(image_u8* p, pixel_format fmt, orientation_flags_t orient_flags)
- {
- mip_level* pLevel = crnlib_new<mip_level>();
- pLevel->assign(p, fmt, orient_flags);
- assign(pLevel);
- }
-
- void mipmapped_texture::assign(dxt_image* p, pixel_format fmt, orientation_flags_t orient_flags)
- {
- mip_level* pLevel = crnlib_new<mip_level>();
- pLevel->assign(p, fmt, orient_flags);
- assign(pLevel);
- }
-
- void mipmapped_texture::set(texture_file_types::format source_file_type, const mipmapped_texture& mipmapped_texture)
- {
- clear();
-
- *this = mipmapped_texture;
- m_source_file_type = source_file_type;
- }
-
- image_u8* mipmapped_texture::get_level_image(uint face, uint level, image_u8& img, uint unpack_flags) const
- {
- if (!is_valid())
- return NULL;
-
- const mip_level* pLevel = get_level(face, level);
-
- return pLevel->get_unpacked_image(img, unpack_flags);
- }
-
- void mipmapped_texture::swap(mipmapped_texture& img)
- {
- utils::swap(m_width, img.m_width);
- utils::swap(m_height, img.m_height);
- utils::swap(m_comp_flags, img.m_comp_flags);
- utils::swap(m_format, img.m_format);
- m_faces.swap(img.m_faces);
- m_last_error.swap(img.m_last_error);
- utils::swap(m_source_file_type, img.m_source_file_type);
-
- CRNLIB_ASSERT(check());
- }
-
- texture_type mipmapped_texture::determine_texture_type() const
- {
- if (!is_valid())
- return cTextureTypeUnknown;
-
- if (get_num_faces() == 6)
- return cTextureTypeCubemap;
- else if (is_vertical_cross())
- return cTextureTypeVerticalCrossCubemap;
- else if (is_normal_map())
- return cTextureTypeNormalMap;
-
- return cTextureTypeRegularMap;
- }
-
- void mipmapped_texture::discard_mips()
- {
- for (uint f = 0; f < m_faces.size(); f++)
- {
- if (m_faces[f].size() > 1)
- {
- for (uint l = 1; l < m_faces[f].size(); l++)
- crnlib_delete(m_faces[f][l]);
-
- m_faces[f].resize(1);
- }
- }
-
- CRNLIB_ASSERT(check());
- }
-
- void mipmapped_texture::init(uint width, uint height, uint levels, uint faces, pixel_format fmt, const char* pName, orientation_flags_t orient_flags)
- {
- clear();
-
- CRNLIB_ASSERT((width > 0) && (height > 0) && (levels > 0));
- CRNLIB_ASSERT((faces == 1) || (faces == 6));
-
- m_width = width;
- m_height = height;
- m_comp_flags = pixel_format_helpers::get_component_flags(fmt);
- m_format = fmt;
- if (pName)
- m_name.set(pName);
-
- m_faces.resize(faces);
- for (uint f = 0; f < faces; f++)
- {
- m_faces[f].resize(levels);
- for (uint l = 0; l < levels; l++)
- {
- m_faces[f][l] = crnlib_new<mip_level>();
-
- const uint mip_width = math::maximum(1U, width >> l);
- const uint mip_height = math::maximum(1U, height >> l);
- if (pixel_format_helpers::is_dxt(fmt))
- {
- dxt_image* p = crnlib_new<dxt_image>();
- p->init(pixel_format_helpers::get_dxt_format(fmt), mip_width, mip_height, true);
- m_faces[f][l]->assign(p, m_format, orient_flags);
- }
- else
- {
- image_u8* p = crnlib_new<image_u8>(mip_width, mip_height);
- p->set_comp_flags(m_comp_flags);
- m_faces[f][l]->assign(p, m_format, orient_flags);
- }
- }
- }
-
- CRNLIB_ASSERT(check());
- }
-
- void mipmapped_texture::discard_mipmaps()
- {
- if (!is_valid())
- return;
-
- discard_mips();
- }
-
- bool mipmapped_texture::convert(pixel_format fmt, bool cook, const dxt_image::pack_params& p)
- {
- if (!is_valid())
- return false;
-
- if (fmt == get_format())
- return true;
-
- uint total_pixels = 0;
- for (uint f = 0; f < m_faces.size(); f++)
- for (uint l = 0; l < m_faces[f].size(); l++)
- total_pixels += m_faces[f][l]->get_total_pixels();
-
- uint num_pixels_processed = 0;
-
- uint progress_start = p.m_progress_start;
-
- for (uint f = 0; f < m_faces.size(); f++)
- {
- for (uint l = 0; l < m_faces[f].size(); l++)
- {
- const uint num_pixels = m_faces[f][l]->get_total_pixels();
-
- uint progress_range = (num_pixels * p.m_progress_range) / total_pixels;
-
- dxt_image::pack_params tmp_params(p);
- tmp_params.m_progress_start = math::clamp<uint>(progress_start, 0, p.m_progress_range);
- tmp_params.m_progress_range = math::clamp<uint>(progress_range, 0, p.m_progress_range - tmp_params.m_progress_start);
-
- progress_start += tmp_params.m_progress_range;
-
- if (!m_faces[f][l]->convert(fmt, cook, tmp_params))
- {
- clear();
- return false;
- }
-
- num_pixels_processed += num_pixels;
- }
- }
-
- m_format = get_level(0, 0)->get_format();
- m_comp_flags = get_level(0, 0)->get_comp_flags();
-
- CRNLIB_ASSERT(check());
-
- if (p.m_pProgress_callback)
- {
- if (!p.m_pProgress_callback(p.m_progress_start + p.m_progress_range, p.m_pProgress_callback_user_data_ptr))
- return false;
- }
-
- return true;
- }
-
- bool mipmapped_texture::convert(pixel_format fmt, const dxt_image::pack_params& p)
- {
- return convert(fmt, true, p);
- }
-
- bool mipmapped_texture::convert(pixel_format fmt, bool cook, const dxt_image::pack_params& p, int qdxt_quality, bool hierarchical)
- {
- if ((!pixel_format_helpers::is_dxt(fmt)) || (fmt == PIXEL_FMT_DXT3) || (fmt == PIXEL_FMT_ETC1))
- {
- // QDXT doesn't support DXT3 or ETC1 yet.
- return convert(fmt, cook, p);
- }
-
- mipmapped_texture src_tex(*this);
-
- if (src_tex.is_packed())
- src_tex.unpack_from_dxt(true);
-
- if (cook)
- {
- mipmapped_texture cooked_tex(src_tex);
-
- for (uint f = 0; f < m_faces.size(); f++)
- for (uint l = 0; l < m_faces[f].size(); l++)
- src_tex.m_faces[f][l]->cook_image(*cooked_tex.m_faces[f][l]->get_image());
-
- src_tex.swap(cooked_tex);
- }
-
- qdxt1_params q1_params;
- q1_params.init(p, qdxt_quality, hierarchical);
-
- qdxt5_params q5_params;
- q5_params.init(p, qdxt_quality, hierarchical);
-
- if (pixel_format_helpers::is_pixel_format_non_srgb(fmt) || (m_comp_flags & pixel_format_helpers::cCompFlagNormalMap) || (m_comp_flags & pixel_format_helpers::cCompFlagLumaChroma))
- {
- // Disable perceptual colorspace metrics when packing to swizzled or non-RGB pixel formats.
- q1_params.m_perceptual = false;
- }
-
- task_pool tp;
- if (!tp.init(p.m_num_helper_threads))
- return false;
-
- mipmapped_texture packed_tex;
-
- qdxt_state state(tp);
- if (!src_tex.qdxt_pack_init(state, packed_tex, q1_params, q5_params, fmt, false))
- return false;
-
- if (!src_tex.qdxt_pack(state, packed_tex, q1_params, q5_params))
- return false;
-
- swap(packed_tex);
-
- return true;
- }
-
- bool mipmapped_texture::is_packed() const
- {
- CRNLIB_ASSERT(is_valid());
- if (!is_valid())
- return false;
-
- return get_level(0, 0)->is_packed();
- }
-
- bool mipmapped_texture::set_alpha_to_luma()
- {
- CRNLIB_ASSERT(is_valid());
- if (!is_valid())
- return false;
-
- if (is_packed())
- unpack_from_dxt(true);
-
- for (uint f = 0; f < m_faces.size(); f++)
- for (uint l = 0; l < get_num_levels(); l++)
- get_level(f, l)->set_alpha_to_luma();
-
- m_format = get_level(0, 0)->get_format();
- m_comp_flags = get_level(0, 0)->get_comp_flags();
-
- CRNLIB_ASSERT(check());
-
- return true;
- }
-
- bool mipmapped_texture::convert(image_utils::conversion_type conv_type)
- {
- CRNLIB_ASSERT(is_valid());
- if (!is_valid())
- return false;
-
- if (is_packed())
- unpack_from_dxt(true);
-
- for (uint f = 0; f < m_faces.size(); f++)
- for (uint l = 0; l < get_num_levels(); l++)
- get_level(f, l)->convert(conv_type);
-
- m_format = get_level(0, 0)->get_format();
- m_comp_flags = get_level(0, 0)->get_comp_flags();
-
- CRNLIB_ASSERT(check());
-
- return true;
- }
-
- bool mipmapped_texture::unpack_from_dxt(bool uncook)
- {
- CRNLIB_ASSERT(is_valid());
- if (!is_valid())
- return false;
-
- CRNLIB_ASSERT(pixel_format_helpers::is_dxt(m_format));
- if (!pixel_format_helpers::is_dxt(m_format))
- return false;
-
- for (uint f = 0; f < m_faces.size(); f++)
- for (uint l = 0; l < get_num_levels(); l++)
- if (!get_level(f, l)->unpack_from_dxt(uncook))
- return false;
-
- m_format = get_level(0, 0)->get_format();
- m_comp_flags = get_level(0, 0)->get_comp_flags();
-
- CRNLIB_ASSERT(check());
-
- return true;
- }
-
- bool mipmapped_texture::has_alpha() const
- {
- CRNLIB_ASSERT(is_valid());
- if (!is_valid())
- return false;
-
- if (pixel_format_helpers::has_alpha(m_format))
- return true;
-
- if ((m_format == PIXEL_FMT_DXT1) && (get_level(0, 0)->get_dxt_image()))
- {
- // Try scanning DXT1 mip levels to find blocks with transparent pixels.
- for (uint f = 0; f < get_num_faces(); f++)
- if (get_level(f, 0)->get_dxt_image()->has_alpha())
- return true;
- }
-
- return false;
- }
-
- bool mipmapped_texture::is_normal_map() const
- {
- CRNLIB_ASSERT(is_valid());
- if (!is_valid())
- return false;
-
- if (pixel_format_helpers::is_normal_map(get_format()))
- return true;
-
- const mip_level* pLevel = get_level(0, 0);
-
- if (pLevel->get_image())
- return image_utils::is_normal_map(*pLevel->get_image(), m_name.get_ptr());
-
- image_u8 tmp;
- pLevel->get_dxt_image()->unpack(tmp);
- return image_utils::is_normal_map(tmp, m_name.get_ptr());
- }
-
- bool mipmapped_texture::is_vertical_cross() const
- {
- CRNLIB_ASSERT(is_valid());
- if (!is_valid())
- return false;
-
- if (get_num_faces() > 1)
- return false;
-
- if (!((math::is_power_of_2(m_height)) && (!math::is_power_of_2(m_width)) && (m_height / 4U == m_width / 3U)))
- return false;
-
- return true;
- }
-
- bool mipmapped_texture::resize(uint new_width, uint new_height, const resample_params& params)
- {
- CRNLIB_ASSERT(is_valid());
- if (!is_valid())
- return false;
-
- CRNLIB_ASSERT((new_width >= 1) && (new_height >= 1));
-
- face_vec faces(get_num_faces());
- for (uint f = 0; f < faces.size(); f++)
- {
- faces[f].resize(1);
- faces[f][0] = crnlib_new<mip_level>();
- }
-
- for (uint f = 0; f < faces.size(); f++)
- {
- image_u8 tmp;
- image_u8* pImg = get_level(f, 0)->get_unpacked_image(tmp, cUnpackFlagUncook);
-
- image_u8* pMip = crnlib_new<image_u8>();
-
- image_utils::resample_params rparams;
- rparams.m_dst_width = new_width;
- rparams.m_dst_height = new_height;
- rparams.m_filter_scale = params.m_filter_scale;
- rparams.m_first_comp = 0;
- rparams.m_num_comps = pImg->is_component_valid(3) ? 4 : 3;
- rparams.m_srgb = params.m_srgb;
- rparams.m_wrapping = params.m_wrapping;
- rparams.m_pFilter = params.m_pFilter;
- rparams.m_multithreaded = params.m_multithreaded;
-
- if (!image_utils::resample(*pImg, *pMip, rparams))
- {
- crnlib_delete(pMip);
-
- for (uint f = 0; f < faces.size(); f++)
- for (uint l = 0; l < faces[f].size(); l++)
- crnlib_delete(faces[f][l]);
-
- return false;
- }
-
- if (params.m_renormalize)
- image_utils::renorm_normal_map(*pMip);
-
- pMip->set_comp_flags(pImg->get_comp_flags());
-
- faces[f][0]->assign(pMip, PIXEL_FMT_INVALID, get_level(f, 0)->get_orientation_flags());
- }
-
- assign(faces);
-
- CRNLIB_ASSERT(check());
-
- return true;
- }
-
- bool mipmapped_texture::generate_mipmaps(const generate_mipmap_params& params, bool force)
- {
- CRNLIB_ASSERT(is_valid());
- if (!is_valid())
- return false;
-
- uint num_levels = 1;
- {
- uint width = get_width();
- uint height = get_height();
- while ((width > params.m_min_mip_size) || (height > params.m_min_mip_size))
- {
- width >>= 1U;
- height >>= 1U;
- num_levels++;
- }
- }
-
- if ((params.m_max_mips > 0) && (num_levels > params.m_max_mips))
- num_levels = params.m_max_mips;
-
- if ((force) && (get_num_levels() > 1))
- discard_mipmaps();
-
- if (num_levels == get_num_levels())
- return true;
-
- face_vec faces(get_num_faces());
- for (uint f = 0; f < faces.size(); f++)
- {
- faces[f].resize(num_levels);
- for (uint l = 0; l < num_levels; l++)
- faces[f][l] = crnlib_new<mip_level>();
- }
-
- for (uint f = 0; f < faces.size(); f++)
- {
- image_u8 tmp;
- image_u8* pImg = get_level(f, 0)->get_unpacked_image(tmp, cUnpackFlagUncook);
-
- for (uint l = 0; l < num_levels; l++)
- {
- const uint mip_width = math::maximum<uint>(1U, get_width() >> l);
- const uint mip_height = math::maximum<uint>(1U, get_height() >> l);
-
- image_u8* pMip = crnlib_new<image_u8>();
-
- if (!l)
- *pMip = *pImg;
- else
- {
- image_utils::resample_params rparams;
- rparams.m_dst_width = mip_width;
- rparams.m_dst_height = mip_height;
- rparams.m_filter_scale = params.m_filter_scale;
- rparams.m_first_comp = 0;
- rparams.m_num_comps = pImg->is_component_valid(3) ? 4 : 3;
- rparams.m_srgb = params.m_srgb;
- rparams.m_wrapping = params.m_wrapping;
- rparams.m_pFilter = params.m_pFilter;
- rparams.m_multithreaded = params.m_multithreaded;
-
- if (!image_utils::resample(*pImg, *pMip, rparams))
- {
- crnlib_delete(pMip);
-
- for (uint f = 0; f < faces.size(); f++)
- for (uint l = 0; l < faces[f].size(); l++)
- crnlib_delete(faces[f][l]);
-
- return false;
- }
-
- if (params.m_renormalize)
- image_utils::renorm_normal_map(*pMip);
-
- pMip->set_comp_flags(pImg->get_comp_flags());
- }
-
- faces[f][l]->assign(pMip, PIXEL_FMT_INVALID, get_level(f, 0)->get_orientation_flags());
- }
- }
-
- assign(faces);
-
- CRNLIB_ASSERT(check());
-
- return true;
- }
-
- bool mipmapped_texture::crop(uint x, uint y, uint width, uint height)
- {
- CRNLIB_ASSERT(is_valid());
- if (!is_valid())
- return false;
- if (get_num_faces() > 1)
- return false;
-
- if ((width < 1) || (height < 1))
- return false;
-
- image_u8 tmp;
- image_u8* pImg = get_level(0, 0)->get_unpacked_image(tmp, cUnpackFlagUncook | cUnpackFlagUnflip);
-
- image_u8* pMip = crnlib_new<image_u8>(width, height);
-
- if (!pImg->extract_block(pMip->get_ptr(), x, y, width, height))
- return false;
-
- face_vec faces(1);
- faces[0].resize(1);
- faces[0][0] = crnlib_new<mip_level>();
-
- pMip->set_comp_flags(pImg->get_comp_flags());
-
- faces[0][0]->assign(pMip);
-
- assign(faces);
-
- CRNLIB_ASSERT(check());
-
- return true;
- }
-
- bool mipmapped_texture::vertical_cross_to_cubemap()
- {
- if (!is_vertical_cross())
- return false;
-
- const uint face_width = get_height() / 4;
-
- bool alpha_is_valid = has_alpha();
-
- mipmapped_texture cubemap;
-
- pixel_format fmt = alpha_is_valid ? PIXEL_FMT_A8R8G8B8 : PIXEL_FMT_R8G8B8;
-
- cubemap.init(face_width, face_width, 1, 6, fmt, m_name.get_ptr(), cDefaultOrientationFlags);
-
- // +x -x +y -y +z -z
- // 0 1 2
- // 0 +y
- // 1 -x +z +x
- // 2 -y
- // 3 -z
-
- for (uint face_index = 0; face_index < 6; face_index++)
- {
- const mip_level* pSrc = get_level(0, 0);
-
- image_u8 tmp_img;
- image_u8* pSrc_image = pSrc->get_unpacked_image(tmp_img, cUnpackFlagUncook | cUnpackFlagUnflip);
-
- const mip_level* pDst = get_level(face_index, 0);
- image_u8* pDst_image = pDst->get_image();
- CRNLIB_ASSERT(pDst_image);
-
- const bool flipped = (face_index == 5);
- const uint x_ofs = g_vertical_cross_image_offsets[face_index][0] * face_width;
- const uint y_ofs = g_vertical_cross_image_offsets[face_index][1] * face_width;
-
- for (uint y = 0; y < face_width; y++)
- {
- for (uint x = 0; x < face_width; x++)
- {
- const color_quad_u8& c = (*pSrc_image)(x_ofs + x, y_ofs + y);
-
- if (!flipped)
- (*pDst_image)(x, y) = c;
- else
- (*pDst_image)(face_width - 1 - x, face_width - 1 - y) = c;
- }
- }
- }
-
- swap(cubemap);
-
- CRNLIB_ASSERT(check());
-
- return true;
- }
-
- bool mipmapped_texture::qdxt_pack_init(qdxt_state& state, mipmapped_texture& dst_tex, const qdxt1_params& dxt1_params, const qdxt5_params& dxt5_params, pixel_format fmt, bool cook)
- {
- if (!is_valid())
- return false;
-
- state.m_qdxt1_params = dxt1_params;
- state.m_qdxt5_params[0] = dxt5_params;
- state.m_qdxt5_params[1] = dxt5_params;
- utils::zero_object(state.m_has_blocks);
-
- switch (fmt)
- {
- case PIXEL_FMT_DXT1:
- {
- state.m_has_blocks[0] = true;
- break;
- }
- case PIXEL_FMT_DXT1A:
- {
- state.m_has_blocks[0] = true;
- state.m_qdxt1_params.m_use_alpha_blocks = true;
- break;
- }
- case PIXEL_FMT_DXT4:
- case PIXEL_FMT_DXT5:
- {
- state.m_has_blocks[0] = true;
- state.m_has_blocks[1] = true;
- state.m_qdxt1_params.m_use_alpha_blocks = false;
- state.m_qdxt5_params[0].m_comp_index = 3;
- break;
- }
- case PIXEL_FMT_DXT5_CCxY:
- case PIXEL_FMT_DXT5_xGxR:
- case PIXEL_FMT_DXT5_xGBR:
- case PIXEL_FMT_DXT5_AGBR:
- {
- state.m_has_blocks[0] = true;
- state.m_has_blocks[1] = true;
- state.m_qdxt1_params.m_use_alpha_blocks = false;
- state.m_qdxt1_params.m_perceptual = false;
- state.m_qdxt5_params[0].m_comp_index = 3;
- break;
- }
- case PIXEL_FMT_3DC:
- {
- state.m_has_blocks[1] = true;
- state.m_has_blocks[2] = true;
- state.m_qdxt5_params[0].m_comp_index = 1;
- state.m_qdxt5_params[1].m_comp_index = 0;
- break;
- }
- case PIXEL_FMT_DXN:
- {
- state.m_has_blocks[1] = true;
- state.m_has_blocks[2] = true;
- state.m_qdxt5_params[0].m_comp_index = 0;
- state.m_qdxt5_params[1].m_comp_index = 1;
- break;
- }
- case PIXEL_FMT_DXT5A:
- {
- state.m_has_blocks[1] = true;
- state.m_qdxt5_params[0].m_comp_index = 3;
- break;
- }
- case PIXEL_FMT_ETC1:
- {
- console::warning("mipmapped_texture::qdxt_pack_init: This method does not support ETC1");
- return false;
- }
- default:
- {
- CRNLIB_ASSERT(0);
- return false;
- }
- }
-
- const uint num_elements = state.m_has_blocks[0] + state.m_has_blocks[1] + state.m_has_blocks[2];
-
- uint cur_progress_start = dxt1_params.m_progress_start;
- if (state.m_has_blocks[0])
- {
- state.m_qdxt1_params.m_progress_start = cur_progress_start;
- state.m_qdxt1_params.m_progress_range = dxt1_params.m_progress_range / num_elements;
- cur_progress_start += state.m_qdxt1_params.m_progress_range;
- }
-
- if (state.m_has_blocks[1])
- {
- state.m_qdxt5_params[0].m_progress_start = cur_progress_start;
- state.m_qdxt5_params[0].m_progress_range = dxt1_params.m_progress_range / num_elements;
- cur_progress_start += state.m_qdxt5_params[0].m_progress_range;
- }
-
- if (state.m_has_blocks[2])
- {
- state.m_qdxt5_params[1].m_progress_start = cur_progress_start;
- state.m_qdxt5_params[1].m_progress_range = dxt1_params.m_progress_range - cur_progress_start;
- }
-
- state.m_fmt = fmt;
-
- dst_tex.init(get_width(), get_height(), get_num_levels(), get_num_faces(), fmt, get_name().get_ptr(), cDefaultOrientationFlags);
-
- state.m_pixel_blocks.resize(0);
-
- image_utils::conversion_type cook_conv_type = image_utils::cConversion_Invalid;
- if (cook)
- {
- cook_conv_type = image_utils::get_conversion_type(true, fmt);
- if (pixel_format_helpers::is_alpha_only(fmt) && !pixel_format_helpers::has_alpha(m_format))
- cook_conv_type = image_utils::cConversion_Y_To_A;
- }
-
- state.m_qdxt1_params.m_num_mips = 0;
- state.m_qdxt5_params[0].m_num_mips = 0;
- state.m_qdxt5_params[1].m_num_mips = 0;
-
- for (uint f = 0; f < get_num_faces(); f++)
- {
- for (uint l = 0; l < get_num_levels(); l++)
- {
- mip_level* pLevel = get_level(f, l);
-
- dst_tex.get_level(f, l)->set_orientation_flags(pLevel->get_orientation_flags());
-
- image_u8 tmp_img;
- image_u8 img(*pLevel->get_unpacked_image(tmp_img, cUnpackFlagUncook));
-
- if (cook_conv_type != image_utils::cConversion_Invalid)
- image_utils::convert_image(img, cook_conv_type);
-
- const uint num_blocks_x = (img.get_width() + 3) / 4;
- const uint num_blocks_y = (img.get_height() + 3) / 4;
- const uint total_blocks = num_blocks_x * num_blocks_y;
-
- const uint cur_size = state.m_pixel_blocks.size();
- state.m_pixel_blocks.resize(cur_size + total_blocks);
- dxt_pixel_block* pDst_blocks = &state.m_pixel_blocks[cur_size];
-
- {
- CRNLIB_ASSERT(state.m_qdxt1_params.m_num_mips < qdxt1_params::cMaxMips);
- qdxt1_params::mip_desc& mip_desc = state.m_qdxt1_params.m_mip_desc[state.m_qdxt1_params.m_num_mips];
- mip_desc.m_first_block = cur_size;
- mip_desc.m_block_width = num_blocks_x;
- mip_desc.m_block_height = num_blocks_y;
- state.m_qdxt1_params.m_num_mips++;
- }
-
- for (uint i = 0; i < 2; i++)
- {
- CRNLIB_ASSERT(state.m_qdxt5_params[i].m_num_mips < qdxt5_params::cMaxMips);
- qdxt5_params::mip_desc& mip_desc = state.m_qdxt5_params[i].m_mip_desc[state.m_qdxt5_params[i].m_num_mips];
- mip_desc.m_first_block = cur_size;
- mip_desc.m_block_width = num_blocks_x;
- mip_desc.m_block_height = num_blocks_y;
- state.m_qdxt5_params[i].m_num_mips++;
- }
-
- for (uint block_y = 0; block_y < num_blocks_y; block_y++)
- {
- const uint img_y = block_y << 2;
-
- for (uint block_x = 0; block_x < num_blocks_x; block_x++)
- {
- const uint img_x = block_x << 2;
-
- color_quad_u8* pDst_pixel = &pDst_blocks->m_pixels[0][0];
-
- pDst_blocks++;
-
- for (uint by = 0; by < 4; by++)
- for (uint bx = 0; bx < 4; bx++)
- *pDst_pixel++ = img.get_clamped(img_x + bx, img_y + by);
- } // block_x
- } // block_y
- } // l
- } // f
-
- if (state.m_has_blocks[0])
- {
- if (!state.m_qdxt1.init(state.m_pixel_blocks.size(), &state.m_pixel_blocks[0], state.m_qdxt1_params))
- return false;
- }
-
- if (state.m_has_blocks[1])
- {
- if (!state.m_qdxt5a.init(state.m_pixel_blocks.size(), &state.m_pixel_blocks[0], state.m_qdxt5_params[0]))
- return false;
- }
-
- if (state.m_has_blocks[2])
- {
- if (!state.m_qdxt5b.init(state.m_pixel_blocks.size(), &state.m_pixel_blocks[0], state.m_qdxt5_params[1]))
- return false;
- }
-
- return true;
- }
-
- bool mipmapped_texture::qdxt_pack(qdxt_state& state, mipmapped_texture& dst_tex, const qdxt1_params& dxt1_params, const qdxt5_params& dxt5_params)
- {
- if (!is_valid())
- return false;
-
- CRNLIB_ASSERT(dxt1_params.m_quality_level <= qdxt1_params::cMaxQuality);
- CRNLIB_ASSERT(dxt5_params.m_quality_level <= qdxt5_params::cMaxQuality);
-
- state.m_qdxt1_params.m_quality_level = dxt1_params.m_quality_level;
- state.m_qdxt1_params.m_pProgress_func = dxt1_params.m_pProgress_func;
- state.m_qdxt1_params.m_pProgress_data = dxt1_params.m_pProgress_data;
-
- state.m_qdxt5_params[0].m_quality_level = dxt5_params.m_quality_level;
- state.m_qdxt5_params[0].m_pProgress_func = dxt5_params.m_pProgress_func;
- state.m_qdxt5_params[0].m_pProgress_data = dxt5_params.m_pProgress_data;
-
- state.m_qdxt5_params[1].m_quality_level = dxt5_params.m_quality_level;
- state.m_qdxt5_params[1].m_pProgress_func = dxt5_params.m_pProgress_func;
- state.m_qdxt5_params[1].m_pProgress_data = dxt5_params.m_pProgress_data;
-
- const uint num_elements = state.m_has_blocks[0] + state.m_has_blocks[1] + state.m_has_blocks[2];
-
- uint cur_progress_start = dxt1_params.m_progress_start;
- if (state.m_has_blocks[0])
- {
- state.m_qdxt1_params.m_progress_start = cur_progress_start;
- state.m_qdxt1_params.m_progress_range = dxt1_params.m_progress_range / num_elements;
- cur_progress_start += state.m_qdxt1_params.m_progress_range;
- }
-
- if (state.m_has_blocks[1])
- {
- state.m_qdxt5_params[0].m_progress_start = cur_progress_start;
- state.m_qdxt5_params[0].m_progress_range = dxt1_params.m_progress_range / num_elements;
- cur_progress_start += state.m_qdxt5_params[0].m_progress_range;
- }
-
- if (state.m_has_blocks[2])
- {
- state.m_qdxt5_params[1].m_progress_start = cur_progress_start;
- state.m_qdxt5_params[1].m_progress_range = dxt1_params.m_progress_range - cur_progress_start;
- }
-
- crnlib::vector<dxt1_block> dxt1_blocks;
- if (state.m_has_blocks[0])
- {
- dxt1_blocks.resize(state.m_pixel_blocks.size());
- float pow_mul = 1.0f;
-
- if (state.m_fmt == PIXEL_FMT_DXT5_CCxY)
- {
- // use a "deeper" codebook size curves when compressing chroma into DXT1, because it's not as important
- pow_mul = 1.5f;
- }
- else if (state.m_fmt == PIXEL_FMT_DXT5)
- {
- // favor color more than alpha
- pow_mul = .75f;
- }
-
- if (!state.m_qdxt1.pack(&dxt1_blocks[0], 1, state.m_qdxt1_params, pow_mul))
- return false;
- }
-
- crnlib::vector<dxt5_block> dxt5_blocks[2];
- for (uint i = 0; i < 2; i++)
- {
- if (state.m_has_blocks[i + 1])
- {
- dxt5_blocks[i].resize(state.m_pixel_blocks.size());
-
- if (!(i ? state.m_qdxt5b : state.m_qdxt5a).pack(&dxt5_blocks[i][0], 1, state.m_qdxt5_params[i]))
- return false;
- }
- }
-
- uint cur_block_ofs = 0;
-
- for (uint f = 0; f < dst_tex.get_num_faces(); f++)
- {
- for (uint l = 0; l < dst_tex.get_num_levels(); l++)
- {
- mip_level* pDst_level = dst_tex.get_level(f, l);
-
- const uint num_blocks_x = (pDst_level->get_width() + 3) / 4;
- const uint num_blocks_y = (pDst_level->get_height() + 3) / 4;
- const uint total_blocks = num_blocks_x * num_blocks_y;
-
- dxt_image* pDst_dxt_image = pDst_level->get_dxt_image();
-
- dxt_image::element* pDst = pDst_dxt_image->get_element_ptr();
- for (uint block_index = 0; block_index < total_blocks; block_index++)
- {
- if (state.m_has_blocks[1])
- memcpy(pDst, &dxt5_blocks[0][cur_block_ofs + block_index], 8);
-
- if (state.m_has_blocks[2])
- memcpy(pDst + 1, &dxt5_blocks[1][cur_block_ofs + block_index], 8);
-
- if (state.m_has_blocks[0])
- memcpy(pDst + state.m_has_blocks[1], &dxt1_blocks[cur_block_ofs + block_index], 8);
-
- pDst += pDst_dxt_image->get_elements_per_block();
- }
-
- cur_block_ofs += total_blocks;
- }
- }
-
- if (dxt1_params.m_pProgress_func)
- {
- if (!dxt1_params.m_pProgress_func(dxt1_params.m_progress_start + dxt1_params.m_progress_range, dxt1_params.m_pProgress_data))
- return false;
- }
-
- CRNLIB_ASSERT(dst_tex.check());
-
- return true;
- }
-
- bool mipmapped_texture::read_from_file(const char* pFilename, texture_file_types::format file_format)
- {
- clear();
-
- set_last_error("Can't open file");
-
- bool success = false;
-
- cfile_stream in_stream;
- if (in_stream.open(pFilename))
- {
- data_stream_serializer serializer(in_stream);
- success = read_from_stream(serializer, file_format);
- }
-
- return success;
- }
-
- bool mipmapped_texture::read_from_stream(data_stream_serializer& serializer, texture_file_types::format file_format)
- {
- clear();
-
- if (!serializer.get_stream())
- {
- set_last_error("Invalid stream");
- return false;
- }
-
- if (file_format == texture_file_types::cFormatInvalid)
- file_format = texture_file_types::determine_file_format(serializer.get_name().get_ptr());
-
- if (file_format == texture_file_types::cFormatInvalid)
- {
- set_last_error("Unsupported file format");
- return false;
- }
-
- set_last_error("Image file load failed");
-
- bool success = false;
-
- if (!texture_file_types::supports_mipmaps(file_format))
- {
- success = read_regular_image(serializer, file_format);
- }
- else
- {
- switch (file_format)
- {
- case texture_file_types::cFormatDDS:
- {
- success = read_dds(serializer);
- break;
- }
- case texture_file_types::cFormatCRN:
- {
- success = read_crn(serializer);
- break;
- }
- case texture_file_types::cFormatKTX:
- {
- success = read_ktx(serializer);
- break;
- }
- default:
- {
- CRNLIB_ASSERT(0);
- break;
- }
- }
- }
-
- if (success)
- {
- CRNLIB_ASSERT(check());
-
- m_source_file_type = file_format;
- set_name(serializer.get_name());
- clear_last_error();
- }
-
- return success;
- }
-
- bool mipmapped_texture::read_regular_image(data_stream_serializer &serializer, texture_file_types::format file_format)
- {
- file_format;
-
- image_u8* pImg = crnlib_new<image_u8>();
- bool status = image_utils::read_from_stream(*pImg, serializer, 0);
- if (!status)
- {
- crnlib_delete(pImg);
-
- set_last_error("Failed loading image file");
- return false;
- }
-
- mip_level* pLevel = crnlib_new<mip_level>();
- pLevel->assign(pImg);
-
- assign(pLevel);
- set_name(serializer.get_name());
-
- return true;
-
- }
-
- bool mipmapped_texture::read_crn_from_memory(const void *pData, uint data_size, const char* pFilename)
- {
- clear();
-
- set_last_error("Image file load failed");
-
- if ((!pData) || (data_size < 1)) return false;
-
- crnd::crn_texture_info tex_info;
- tex_info.m_struct_size = sizeof(crnd::crn_texture_info);
- if (!crnd_get_texture_info(pData, data_size, &tex_info))
- {
- set_last_error("crnd_get_texture_info() failed");
- return false;
- }
-
- const pixel_format dds_fmt = (pixel_format)crnd::crnd_crn_format_to_fourcc(tex_info.m_format);
- if (dds_fmt == PIXEL_FMT_INVALID)
- {
- set_last_error("Unsupported DXT format");
- return false;
- }
-
- const dxt_format dxt_fmt = pixel_format_helpers::get_dxt_format(dds_fmt);
-
- face_vec faces(tex_info.m_faces);
- for (uint f = 0; f < tex_info.m_faces; f++)
- {
- faces[f].resize(tex_info.m_levels);
-
- for (uint l = 0; l < tex_info.m_levels; l++)
- faces[f][l] = crnlib_new<mip_level>();
- }
-
- const uint tex_num_blocks_x = (tex_info.m_width + 3) >> 2;
- const uint tex_num_blocks_y = (tex_info.m_height + 3) >> 2;
-
- vector<uint8> dxt_data;
- // Create temp buffer big enough to hold the largest mip level, and all faces if it's a cubemap.
- dxt_data.resize(tex_info.m_bytes_per_block * tex_num_blocks_x * tex_num_blocks_y * tex_info.m_faces);
-
- set_last_error("CRN unpack failed");
-
-#if 0
- timer t;
- double total_time = 0.0f;
- t.start();
-#endif
-
- crnd::crnd_unpack_context pContext = crnd::crnd_unpack_begin(pData, data_size);
-
-#if 0
- total_time += t.get_elapsed_secs();
-#endif
-
- if (!pContext)
- {
- for (uint f = 0; f < faces.size(); f++)
- for (uint l = 0; l < faces[f].size(); l++)
- crnlib_delete(faces[f][l]);
- return false;
- }
-
- uint total_pixels = 0;
-
- void* pFaces[cCRNMaxFaces];
- for (uint f = tex_info.m_faces; f < cCRNMaxFaces; f++)
- pFaces[f] = NULL;
-
- for (uint l = 0; l < tex_info.m_levels; l++)
- {
- const uint level_width = math::maximum<uint>(1U, tex_info.m_width >> l);
- const uint level_height = math::maximum<uint>(1U, tex_info.m_height >> l);
- const uint num_blocks_x = (level_width + 3U) >> 2U;
- const uint num_blocks_y = (level_height + 3U) >> 2U;
-
- const uint row_pitch = num_blocks_x * tex_info.m_bytes_per_block;
- const uint size_of_face = num_blocks_y * row_pitch;
-
- total_pixels += num_blocks_x * num_blocks_y * 4 * 4 * tex_info.m_faces;
-
-#if 0
- t.start();
-#endif
-
- for (uint f = 0; f < tex_info.m_faces; f++)
- pFaces[f] = &dxt_data[f * size_of_face];
-
- if (!crnd::crnd_unpack_level(pContext, pFaces, dxt_data.size(), row_pitch, l))
- {
- crnd::crnd_unpack_end(pContext);
- for (uint f = 0; f < faces.size(); f++)
- for (uint l = 0; l < faces[f].size(); l++)
- crnlib_delete(faces[f][l]);
- return false;
- }
-
-#if 0
- total_time += t.get_elapsed_secs();
-#endif
-
- for (uint f = 0; f < tex_info.m_faces; f++)
- {
- dxt_image* pDXT_image = crnlib_new<dxt_image>();
-
- if (!pDXT_image->init(
- dxt_fmt, level_width, level_height,
- num_blocks_x * num_blocks_y * (tex_info.m_bytes_per_block / sizeof(dxt_image::element)),
- reinterpret_cast<dxt_image::element*>(pFaces[f]), true))
- {
- crnlib_delete(pDXT_image);
-
- crnd::crnd_unpack_end(pContext);
- for (uint f = 0; f < faces.size(); f++)
- for (uint l = 0; l < faces[f].size(); l++)
- crnlib_delete(faces[f][l]);
-
- return false;
- }
-
- faces[f][l]->assign(pDXT_image, dds_fmt);
- }
- }
-
-#if 0
- if (total_pixels)
- {
- console::info("read_crn_from_memory: Total pixels: %u, ms: %3.3fms, megapixels/sec: %3.3f",
- total_pixels, total_time * 1000.0f, total_pixels / total_time);
- }
-#endif
-
- crnd::crnd_unpack_end(pContext);
-
- assign(faces);
- set_name(pFilename);
-
- m_source_file_type = texture_file_types::cFormatCRN;
- clear_last_error();
-
- return true;
- }
-
- bool mipmapped_texture::read_crn(data_stream_serializer& serializer)
- {
- crnlib::vector<uint8> crn_data;
- if (!serializer.read_entire_file(crn_data))
- {
- set_last_error("Failed reading CRN file");
- return false;
- }
- return read_crn_from_memory(crn_data.get_ptr(), crn_data.size(), serializer.get_name().get_ptr());
- }
-
- bool mipmapped_texture::write_to_file(
- const char* pFilename,
- texture_file_types::format file_format,
- crn_comp_params* pComp_params,
- uint32 *pActual_quality_level, float *pActual_bitrate,
- uint32 image_write_flags)
- {
- if (pActual_quality_level) *pActual_quality_level = 0;
- if (pActual_bitrate) *pActual_bitrate = 0.0f;
-
- if (!is_valid())
- {
- set_last_error("Unable to write empty texture");
- return false;
- }
-
- if (file_format == texture_file_types::cFormatInvalid)
- file_format = texture_file_types::determine_file_format(pFilename);
-
- if (file_format == texture_file_types::cFormatInvalid)
- {
- set_last_error("Unknown file format");
- return false;
- }
-
- bool success = false;
-
- if ( ((pComp_params) && (file_format == texture_file_types::cFormatDDS)) ||
- (file_format == texture_file_types::cFormatCRN) )
- {
- if (!pComp_params)
- return false;
- success = write_comp_texture(pFilename, *pComp_params, pActual_quality_level, pActual_bitrate);
- }
- else if (!texture_file_types::supports_mipmaps(file_format))
- {
- success = write_regular_image(pFilename, image_write_flags);
- }
- else
- {
- if (pComp_params)
- {
- console::warning("mipmapped_texture::write_to_file: Ignoring CRN compression parameters (currently unsupported for this file type).");
- }
-
- cfile_stream write_stream;
- if (!write_stream.open(pFilename, cDataStreamWritable | cDataStreamSeekable))
- {
- set_last_error(dynamic_string(cVarArg, "Failed creating output file \"%s\"", pFilename).get_ptr());
- return false;
- }
- data_stream_serializer serializer(write_stream);
-
- switch (file_format)
- {
- case texture_file_types::cFormatDDS:
- {
- success = write_dds(serializer);
- break;
- }
- case texture_file_types::cFormatKTX:
- {
- success = write_ktx(serializer);
- break;
- }
- default:
- {
- break;
- }
- }
- }
-
- return success;
- }
-
- bool mipmapped_texture::write_regular_image(const char* pFilename, uint32 image_write_flags)
- {
- image_u8 tmp;
- image_u8* pLevel_image = get_level_image(0, 0, tmp);
-
- if (!image_utils::write_to_file(pFilename, *pLevel_image, image_write_flags))
- {
- set_last_error("File write failed");
- return false;
- }
-
- return true;
- }
-
- void mipmapped_texture::print_crn_comp_params(const crn_comp_params& p)
- {
- console::debug("CRN compression params:");
- console::debug(" File Type: %s", crn_get_file_type_ext(p.m_file_type));
- console::debug(" Quality level: %u", p.m_quality_level);
- console::debug(" Target Bitrate: %f", p.m_target_bitrate);
- console::debug(" Faces: %u", p.m_faces);
- console::debug(" Width: %u", p.m_width);
- console::debug(" Height: %u", p.m_height);
- console::debug(" Levels: %u", p.m_levels);
- console::debug(" Pixel Format: %s", crn_get_format_string(p.m_format));
- console::debug("Use manual CRN palette sizes: %u", p.get_flag(cCRNCompFlagManualPaletteSizes));
- console::debug("Color endpoints: %u", p.m_crn_color_endpoint_palette_size);
- console::debug("Color selectors: %u", p.m_crn_color_selector_palette_size);
- console::debug("Alpha endpoints: %u", p.m_crn_alpha_endpoint_palette_size);
- console::debug("Alpha selectors: %u", p.m_crn_alpha_selector_palette_size);
- console::debug("Flags:");
- console::debug(" Perceptual: %u", p.get_flag(cCRNCompFlagPerceptual));
- console::debug(" Hierarchical: %u", p.get_flag(cCRNCompFlagHierarchical));
- console::debug(" UseBothBlockTypes: %u", p.get_flag(cCRNCompFlagUseBothBlockTypes));
- console::debug(" UseTransparentIndicesForBlack: %u", p.get_flag(cCRNCompFlagUseTransparentIndicesForBlack));
- console::debug(" DisableEndpointCaching: %u", p.get_flag(cCRNCompFlagDisableEndpointCaching));
- console::debug("GrayscaleSampling: %u", p.get_flag(cCRNCompFlagGrayscaleSampling));
- console::debug(" UseDXT1ATransparency: %u", p.get_flag(cCRNCompFlagDXT1AForTransparency));
- console::debug("AdaptiveTileColorPSNRDerating: %2.2fdB", p.m_crn_adaptive_tile_color_psnr_derating);
- console::debug("AdaptiveTileAlphaPSNRDerating: %2.2fdB", p.m_crn_adaptive_tile_alpha_psnr_derating);
- console::debug("NumHelperThreads: %u", p.m_num_helper_threads);
- }
-
- bool mipmapped_texture::write_comp_texture(const char* pFilename, const crn_comp_params &orig_comp_params, uint32 *pActual_quality_level, float *pActual_bitrate)
- {
- crn_comp_params comp_params(orig_comp_params);
-
- if (pActual_quality_level) *pActual_quality_level = 0;
- if (pActual_bitrate) *pActual_bitrate = 0.0f;
-
- if (math::maximum(get_height(), get_width()) > cCRNMaxLevelResolution)
- {
- set_last_error("Texture resolution is too big!");
- return false;
- }
-
- comp_params.m_faces = get_num_faces();
- comp_params.m_levels = get_num_levels();
- comp_params.m_width = get_width();
- comp_params.m_height = get_height();
-
- image_u8 temp_images[cCRNMaxFaces][cCRNMaxLevels];
- for (uint f = 0; f < get_num_faces(); f++)
- {
- for (uint l = 0; l < get_num_levels(); l++)
- {
- image_u8* p = get_level_image(f, l, temp_images[f][l]);
-
- comp_params.m_pImages[f][l] = (crn_uint32*)p->get_ptr();
- }
- }
-
- if (comp_params.get_flag(cCRNCompFlagDebugging))
- print_crn_comp_params(comp_params);
-
- timer t;
- t.start();
-
- crnlib::vector<uint8> comp_data;
- if (!create_compressed_texture(comp_params, comp_data, pActual_quality_level, pActual_bitrate))
- {
- set_last_error("CRN compression failed");
- return false;
- }
-
- double total_time = t.get_elapsed_secs();
- if (comp_params.get_flag(cCRNCompFlagDebugging))
- {
- console::debug("\nTotal compression time: %3.3fs", total_time);
- }
-
- cfile_stream out_stream;
- if (!out_stream.open(pFilename, cDataStreamWritable | cDataStreamSeekable))
- {
- set_last_error("Failed opening file");
- return false;
- }
-
- if (out_stream.write(comp_data.get_ptr(), comp_data.size()) != comp_data.size())
- {
- set_last_error("Failed writing to file");
- return false;
- }
-
- if (!out_stream.close())
- {
- set_last_error("Failed writing to file");
- return false;
- }
-
- return true;
- }
-
- uint mipmapped_texture::get_total_pixels_in_all_faces_and_mips() const
- {
- uint total_pixels = 0;
- for (uint l = 0; l < m_faces.size(); l++)
- for (uint m = 0; m < m_faces[l].size(); m++)
- total_pixels += m_faces[l][m]->get_total_pixels();
-
- return total_pixels;
- }
-
- void mipmapped_texture::set_orientation_flags(orientation_flags_t flags)
- {
- for (uint l = 0; l < m_faces.size(); l++)
- for (uint m = 0; m < m_faces[l].size(); m++)
- m_faces[l][m]->set_orientation_flags(flags);
- }
-
- bool mipmapped_texture::is_flipped() const
- {
- for (uint l = 0; l < m_faces.size(); l++)
- for (uint m = 0; m < m_faces[l].size(); m++)
- if (m_faces[l][m]->is_flipped())
- return true;
-
- return false;
- }
-
- bool mipmapped_texture::is_x_flipped() const
- {
- for (uint l = 0; l < m_faces.size(); l++)
- for (uint m = 0; m < m_faces[l].size(); m++)
- if (m_faces[l][m]->is_x_flipped())
- return true;
-
- return false;
- }
-
- bool mipmapped_texture::is_y_flipped() const
- {
- for (uint l = 0; l < m_faces.size(); l++)
- for (uint m = 0; m < m_faces[l].size(); m++)
- if (m_faces[l][m]->is_y_flipped())
- return true;
-
- return false;
- }
-
- bool mipmapped_texture::can_unflip_without_unpacking() const
- {
- if (!is_valid())
- return false;
-
- if (!is_packed())
- return true;
-
- for (uint l = 0; l < m_faces.size(); l++)
- for (uint m = 0; m < m_faces[l].size(); m++)
- if (!m_faces[l][m]->can_unflip_without_unpacking())
- return false;
-
- return true;
- }
-
- bool mipmapped_texture::unflip(bool allow_unpacking_to_flip, bool uncook_if_necessary_to_unpack)
- {
- if (!is_valid())
- return false;
-
- if (is_packed())
- {
- // The texture is packed - make sure all faces/miplevels can be consistently unflipped.
- bool can_do_packed_unflip = can_unflip_without_unpacking();
-
- if ((!can_do_packed_unflip) && (!allow_unpacking_to_flip))
- return false;
-
- // If any face/miplevel can't unflip the packed bits, then just unpack the whole texture.
- if (!can_do_packed_unflip)
- unpack_from_dxt(uncook_if_necessary_to_unpack);
- }
-
- for (uint l = 0; l < m_faces.size(); l++)
- for (uint m = 0; m < m_faces[l].size(); m++)
- if (!m_faces[l][m]->unflip(true, false))
- return false;
-
- CRNLIB_VERIFY(check());
-
- return true;
- }
-
-#if 0
- bool mipmapped_texture::flip_x()
- {
- for (uint l = 0; l < m_faces.size(); l++)
- for (uint m = 0; m < m_faces[l].size(); m++)
- if (!m_faces[l][m]->flip_x())
- return false;
-
- return true;
- }
-#endif
-
- bool mipmapped_texture::flip_y_helper()
- {
- for (uint l = 0; l < m_faces.size(); l++)
- for (uint m = 0; m < m_faces[l].size(); m++)
- if (!m_faces[l][m]->flip_y())
- return false;
-
- return true;
- }
-
- bool mipmapped_texture::flip_y(bool update_orientation_flags)
- {
- mipmapped_texture temp_tex(*this);
- if (!temp_tex.flip_y_helper())
- {
- temp_tex = *this;
- temp_tex.unpack_from_dxt(true);
- if (!temp_tex.flip_y_helper())
- return false;
- }
- swap(temp_tex);
-
- if (update_orientation_flags)
- {
- for (uint f = 0; f < get_num_faces(); f++)
- {
- for (uint m = 0; m < get_face(f).size(); m++)
- {
- uint orient_flags = get_face(f)[m]->get_orientation_flags();
- orient_flags ^= cOrientationFlagYFlipped;
- get_face(f)[m]->set_orientation_flags(static_cast<orientation_flags_t>(orient_flags));
- }
- }
- }
-
- CRNLIB_ASSERT(check());
-
- return true;
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_mipmapped_texture.h b/Libraries/crunch-ea9b8d/crnlib/crn_mipmapped_texture.h
deleted file mode 100644
index 7fed19bb..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_mipmapped_texture.h
+++ /dev/null
@@ -1,339 +0,0 @@
-// File: crn_mipmapped_texture.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_dxt_image.h"
-#include "../inc/dds_defs.h"
-#include "crn_pixel_format.h"
-#include "crn_image.h"
-#include "crn_resampler.h"
-#include "crn_data_stream_serializer.h"
-#include "crn_qdxt1.h"
-#include "crn_qdxt5.h"
-#include "crn_texture_file_types.h"
-#include "crn_image_utils.h"
-
-namespace crnlib
-{
- extern const vec2I g_vertical_cross_image_offsets[6];
-
- enum orientation_flags_t
- {
- cOrientationFlagXFlipped = 1,
- cOrientationFlagYFlipped = 2,
-
- cDefaultOrientationFlags = 0
- };
-
- enum unpack_flags_t
- {
- cUnpackFlagUncook = 1,
- cUnpackFlagUnflip = 2
- };
-
- class mip_level
- {
- friend class mipmapped_texture;
-
- public:
- mip_level();
- ~mip_level();
-
- mip_level(const mip_level& other);
- mip_level& operator= (const mip_level& rhs);
-
- // Assumes ownership.
- void assign(image_u8* p, pixel_format fmt = PIXEL_FMT_INVALID, orientation_flags_t orient_flags = cDefaultOrientationFlags);
- void assign(dxt_image* p, pixel_format fmt = PIXEL_FMT_INVALID, orientation_flags_t orient_flags = cDefaultOrientationFlags);
-
- void clear();
-
- inline uint get_width() const { return m_width; }
- inline uint get_height() const { return m_height; }
- inline uint get_total_pixels() const { return m_width * m_height; }
-
- orientation_flags_t get_orientation_flags() const { return m_orient_flags; }
- void set_orientation_flags(orientation_flags_t flags) { m_orient_flags = flags; }
-
- inline image_u8* get_image() const { return m_pImage; }
- inline dxt_image* get_dxt_image() const { return m_pDXTImage; }
-
- image_u8* get_unpacked_image(image_u8& tmp, uint unpack_flags) const;
-
- inline bool is_packed() const { return m_pDXTImage != NULL; }
-
- inline bool is_valid() const { return (m_pImage != NULL) || (m_pDXTImage != NULL); }
-
- inline pixel_format_helpers::component_flags get_comp_flags() const { return m_comp_flags; }
- inline void set_comp_flags(pixel_format_helpers::component_flags comp_flags) { m_comp_flags = comp_flags; }
-
- inline pixel_format get_format() const { return m_format; }
- inline void set_format(pixel_format fmt) { m_format = fmt; }
-
- bool convert(pixel_format fmt, bool cook, const dxt_image::pack_params& p);
-
- bool pack_to_dxt(const image_u8& img, pixel_format fmt, bool cook, const dxt_image::pack_params& p, orientation_flags_t orient_flags = cDefaultOrientationFlags);
- bool pack_to_dxt(pixel_format fmt, bool cook, const dxt_image::pack_params& p);
-
- bool unpack_from_dxt(bool uncook = true);
-
- // Returns true if flipped on either axis.
- bool is_flipped() const;
-
- bool is_x_flipped() const;
- bool is_y_flipped() const;
-
- bool can_unflip_without_unpacking() const;
-
- // Returns true if unflipped on either axis.
- // Will try to flip packed (DXT/ETC) data in-place, if this isn't possible it'll unpack/uncook the mip level then unflip.
- bool unflip(bool allow_unpacking_to_flip, bool uncook_during_unpack);
-
- bool set_alpha_to_luma();
- bool convert(image_utils::conversion_type conv_type);
-
- bool flip_x();
- bool flip_y();
-
- private:
- uint m_width;
- uint m_height;
-
- pixel_format_helpers::component_flags m_comp_flags;
- pixel_format m_format;
-
- image_u8* m_pImage;
- dxt_image* m_pDXTImage;
-
- orientation_flags_t m_orient_flags;
-
- void cook_image(image_u8& img) const;
- void uncook_image(image_u8& img) const;
- };
-
- // A face is an array of mip_level ptr's.
- typedef crnlib::vector<mip_level*> mip_ptr_vec;
-
- // And an array of one, six, or N faces make up a texture.
- typedef crnlib::vector<mip_ptr_vec> face_vec;
-
- class mipmapped_texture
- {
- public:
- // Construction/destruction
- mipmapped_texture();
- ~mipmapped_texture();
-
- mipmapped_texture(const mipmapped_texture& other);
- mipmapped_texture& operator= (const mipmapped_texture& rhs);
-
- void clear();
-
- void init(uint width, uint height, uint levels, uint faces, pixel_format fmt, const char* pName, orientation_flags_t orient_flags);
-
- // Assumes ownership.
- void assign(face_vec& faces);
- void assign(mip_level* pLevel);
- void assign(image_u8* p, pixel_format fmt = PIXEL_FMT_INVALID, orientation_flags_t orient_flags = cDefaultOrientationFlags);
- void assign(dxt_image* p, pixel_format fmt = PIXEL_FMT_INVALID, orientation_flags_t orient_flags = cDefaultOrientationFlags);
-
- void set(texture_file_types::format source_file_type, const mipmapped_texture& mipmapped_texture);
-
- // Accessors
- image_u8* get_level_image(uint face, uint level, image_u8& img, uint unpack_flags = cUnpackFlagUncook | cUnpackFlagUnflip) const;
-
- inline bool is_valid() const { return m_faces.size() > 0; }
-
- const dynamic_string& get_name() const { return m_name; }
- void set_name(const dynamic_string& name) { m_name = name; }
-
- const dynamic_string& get_source_filename() const { return get_name(); }
- texture_file_types::format get_source_file_type() const { return m_source_file_type; }
-
- inline uint get_width() const { return m_width; }
- inline uint get_height() const { return m_height; }
- inline uint get_total_pixels() const { return m_width * m_height; }
- uint get_total_pixels_in_all_faces_and_mips() const;
-
- inline uint get_num_faces() const { return m_faces.size(); }
- inline uint get_num_levels() const { if (m_faces.empty()) return 0; else return m_faces[0].size(); }
-
- inline pixel_format_helpers::component_flags get_comp_flags() const { return m_comp_flags; }
- inline pixel_format get_format() const { return m_format; }
-
- inline bool is_unpacked() const { if (get_num_faces()) { return get_level(0, 0)->get_image() != NULL; } return false; }
-
- inline const mip_ptr_vec& get_face(uint face) const { return m_faces[face]; }
- inline mip_ptr_vec& get_face(uint face) { return m_faces[face]; }
-
- inline const mip_level* get_level(uint face, uint mip) const { return m_faces[face][mip]; }
- inline mip_level* get_level(uint face, uint mip) { return m_faces[face][mip]; }
-
- bool has_alpha() const;
- bool is_normal_map() const;
- bool is_vertical_cross() const;
- bool is_packed() const;
- texture_type determine_texture_type() const;
-
- const dynamic_string& get_last_error() const { return m_last_error; }
- void clear_last_error() { m_last_error.clear(); }
-
- // Reading/writing
- bool read_dds(data_stream_serializer& serializer);
- bool write_dds(data_stream_serializer& serializer) const;
-
- bool read_ktx(data_stream_serializer& serializer);
- bool write_ktx(data_stream_serializer& serializer) const;
-
- bool read_crn(data_stream_serializer& serializer);
- bool read_crn_from_memory(const void *pData, uint data_size, const char* pFilename);
-
- // If file_format is texture_file_types::cFormatInvalid, the format will be determined from the filename's extension.
- bool read_from_file(const char* pFilename, texture_file_types::format file_format = texture_file_types::cFormatInvalid);
- bool read_from_stream(data_stream_serializer& serializer, texture_file_types::format file_format = texture_file_types::cFormatInvalid);
-
- bool write_to_file(
- const char* pFilename,
- texture_file_types::format file_format = texture_file_types::cFormatInvalid,
- crn_comp_params* pComp_params = NULL,
- uint32* pActual_quality_level = NULL, float* pActual_bitrate = NULL,
- uint32 image_write_flags = 0);
-
- // Conversion
- bool convert(pixel_format fmt, bool cook, const dxt_image::pack_params& p);
- bool convert(pixel_format fmt, const dxt_image::pack_params& p);
- bool convert(pixel_format fmt, bool cook, const dxt_image::pack_params& p, int qdxt_quality, bool hierarchical = true);
- bool convert(image_utils::conversion_type conv_type);
-
- bool unpack_from_dxt(bool uncook = true);
-
- bool set_alpha_to_luma();
-
- void discard_mipmaps();
-
- void discard_mips();
-
- struct resample_params
- {
- resample_params() :
- m_pFilter("kaiser"),
- m_wrapping(false),
- m_srgb(false),
- m_renormalize(false),
- m_filter_scale(.9f),
- m_gamma(1.75f), // or 2.2f
- m_multithreaded(true)
- {
- }
-
- const char* m_pFilter;
- bool m_wrapping;
- bool m_srgb;
- bool m_renormalize;
- float m_filter_scale;
- float m_gamma;
- bool m_multithreaded;
- };
-
- bool resize(uint new_width, uint new_height, const resample_params& params);
-
- struct generate_mipmap_params : public resample_params
- {
- generate_mipmap_params() :
- resample_params(),
- m_min_mip_size(1),
- m_max_mips(0)
- {
- }
-
- uint m_min_mip_size;
- uint m_max_mips; // actually the max # of total levels
- };
-
- bool generate_mipmaps(const generate_mipmap_params& params, bool force);
-
- bool crop(uint x, uint y, uint width, uint height);
-
- bool vertical_cross_to_cubemap();
-
- // Low-level clustered DXT (QDXT) compression
- struct qdxt_state
- {
- qdxt_state(task_pool& tp) : m_fmt(PIXEL_FMT_INVALID), m_qdxt1(tp), m_qdxt5a(tp), m_qdxt5b(tp)
- {
- }
-
- pixel_format m_fmt;
- qdxt1 m_qdxt1;
- qdxt5 m_qdxt5a;
- qdxt5 m_qdxt5b;
- crnlib::vector<dxt_pixel_block> m_pixel_blocks;
-
- qdxt1_params m_qdxt1_params;
- qdxt5_params m_qdxt5_params[2];
- bool m_has_blocks[3];
-
- void clear()
- {
- m_fmt = PIXEL_FMT_INVALID;
- m_qdxt1.clear();
- m_qdxt5a.clear();
- m_qdxt5b.clear();
- m_pixel_blocks.clear();
- m_qdxt1_params.clear();
- m_qdxt5_params[0].clear();
- m_qdxt5_params[1].clear();
- utils::zero_object(m_has_blocks);
- }
- };
- bool qdxt_pack_init(qdxt_state& state, mipmapped_texture& dst_tex, const qdxt1_params& dxt1_params, const qdxt5_params& dxt5_params, pixel_format fmt, bool cook);
- bool qdxt_pack(qdxt_state& state, mipmapped_texture& dst_tex, const qdxt1_params& dxt1_params, const qdxt5_params& dxt5_params);
-
- void swap(mipmapped_texture& img);
-
- bool check() const;
-
- void set_orientation_flags(orientation_flags_t flags);
-
- // Returns true if any face/miplevel is flipped.
- bool is_flipped() const;
- bool is_x_flipped() const;
- bool is_y_flipped() const;
- bool can_unflip_without_unpacking() const;
- bool unflip(bool allow_unpacking_to_flip, bool uncook_if_necessary_to_unpack);
-
- bool flip_y(bool update_orientation_flags);
-
- private:
- dynamic_string m_name;
-
- uint m_width;
- uint m_height;
-
- pixel_format_helpers::component_flags m_comp_flags;
- pixel_format m_format;
-
- face_vec m_faces;
-
- texture_file_types::format m_source_file_type;
-
- mutable dynamic_string m_last_error;
-
- inline void clear_last_error() const { m_last_error.clear(); }
- inline void set_last_error(const char* p) const { m_last_error = p; }
-
- void free_all_mips();
- bool read_regular_image(data_stream_serializer &serializer, texture_file_types::format file_format);
- bool write_regular_image(const char* pFilename, uint32 image_write_flags);
- bool read_dds_internal(data_stream_serializer& serializer);
- void print_crn_comp_params(const crn_comp_params& p);
- bool write_comp_texture(const char* pFilename, const crn_comp_params &comp_params, uint32 *pActual_quality_level, float *pActual_bitrate);
- void change_dxt1_to_dxt1a();
- bool flip_y_helper();
- };
-
- inline void swap(mipmapped_texture& a, mipmapped_texture& b)
- {
- a.swap(b);
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_packed_uint.h b/Libraries/crunch-ea9b8d/crnlib/crn_packed_uint.h
deleted file mode 100644
index bde60c17..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_packed_uint.h
+++ /dev/null
@@ -1,91 +0,0 @@
-// File: crn_packed_uint
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- template<unsigned int N>
- struct packed_uint
- {
- inline packed_uint() { }
-
- inline packed_uint(unsigned int val) { *this = val; }
-
- inline packed_uint(const packed_uint& other) { *this = other; }
-
- inline packed_uint& operator= (const packed_uint& rhs)
- {
- if (this != &rhs)
- memcpy(m_buf, rhs.m_buf, sizeof(m_buf));
- return *this;
- }
-
- inline packed_uint& operator= (unsigned int val)
- {
-#ifdef CRNLIB_BUILD_DEBUG
- if (N == 1)
- {
- CRNLIB_ASSERT(val <= 0xFFU);
- }
- else if (N == 2)
- {
- CRNLIB_ASSERT(val <= 0xFFFFU);
- }
- else if (N == 3)
- {
- CRNLIB_ASSERT(val <= 0xFFFFFFU);
- }
-#endif
-
- val <<= (8U * (4U - N));
-
- for (unsigned int i = 0; i < N; i++)
- {
- m_buf[i] = static_cast<unsigned char>(val >> 24U);
- val <<= 8U;
- }
-
- return *this;
- }
-
- inline operator unsigned int() const
- {
- switch (N)
- {
- case 1: return m_buf[0];
- case 2: return (m_buf[0] << 8U) | m_buf[1];
- case 3: return (m_buf[0] << 16U) | (m_buf[1] << 8U) | (m_buf[2]);
- default: return (m_buf[0] << 24U) | (m_buf[1] << 16U) | (m_buf[2] << 8U) | (m_buf[3]);
- }
- }
-
- unsigned char m_buf[N];
- };
- template<typename T>
- class packed_value
- {
- public:
- packed_value() { }
- packed_value(T val) { *this = val; }
-
- inline operator T() const
- {
- T result = 0;
- for (int i = sizeof(T) - 1; i >= 0; i--)
- result = static_cast<T>((result << 8) | m_bytes[i]);
- return result;
- }
- packed_value& operator= (T val)
- {
- for (int i = 0; i < sizeof(T); i++)
- {
- m_bytes[i] = static_cast<uint8>(val);
- val >>= 8;
- }
- return *this;
- }
- private:
- uint8 m_bytes[sizeof(T)];
- };
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_pixel_format.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_pixel_format.cpp
deleted file mode 100644
index b86345f5..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_pixel_format.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-// File: crn_pixel_format.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_pixel_format.h"
-#include "crn_image.h"
-
-namespace crnlib
-{
- namespace pixel_format_helpers
- {
- const pixel_format g_all_pixel_formats[] =
- {
- PIXEL_FMT_DXT1,
- PIXEL_FMT_DXT2,
- PIXEL_FMT_DXT3,
- PIXEL_FMT_DXT4,
- PIXEL_FMT_DXT5,
- PIXEL_FMT_3DC,
- PIXEL_FMT_DXN,
- PIXEL_FMT_DXT5A,
- PIXEL_FMT_DXT5_CCxY,
- PIXEL_FMT_DXT5_xGxR,
- PIXEL_FMT_DXT5_xGBR,
- PIXEL_FMT_DXT5_AGBR,
- PIXEL_FMT_DXT1A,
- PIXEL_FMT_ETC1,
- PIXEL_FMT_R8G8B8,
- PIXEL_FMT_L8,
- PIXEL_FMT_A8,
- PIXEL_FMT_A8L8,
- PIXEL_FMT_A8R8G8B8
- };
-
- uint get_num_formats()
- {
- return sizeof(g_all_pixel_formats) / sizeof(g_all_pixel_formats[0]);
- }
-
- pixel_format get_pixel_format_by_index(uint index)
- {
- CRNLIB_ASSERT(index < get_num_formats());
- return g_all_pixel_formats[index];
- }
-
- const char* get_pixel_format_string(pixel_format fmt)
- {
- switch (fmt)
- {
- case PIXEL_FMT_INVALID: return "INVALID";
- case PIXEL_FMT_DXT1: return "DXT1";
- case PIXEL_FMT_DXT1A: return "DXT1A";
- case PIXEL_FMT_DXT2: return "DXT2";
- case PIXEL_FMT_DXT3: return "DXT3";
- case PIXEL_FMT_DXT4: return "DXT4";
- case PIXEL_FMT_DXT5: return "DXT5";
- case PIXEL_FMT_3DC: return "3DC";
- case PIXEL_FMT_DXN: return "DXN";
- case PIXEL_FMT_DXT5A: return "DXT5A";
- case PIXEL_FMT_DXT5_CCxY: return "DXT5_CCxY";
- case PIXEL_FMT_DXT5_xGxR: return "DXT5_xGxR";
- case PIXEL_FMT_DXT5_xGBR: return "DXT5_xGBR";
- case PIXEL_FMT_DXT5_AGBR: return "DXT5_AGBR";
- case PIXEL_FMT_ETC1: return "ETC1";
- case PIXEL_FMT_R8G8B8: return "R8G8B8";
- case PIXEL_FMT_A8R8G8B8: return "A8R8G8B8";
- case PIXEL_FMT_A8: return "A8";
- case PIXEL_FMT_L8: return "L8";
- case PIXEL_FMT_A8L8: return "A8L8";
- default: break;
- }
- CRNLIB_ASSERT(false);
- return "?";
- }
-
- const char* get_crn_format_string(crn_format fmt)
- {
- switch (fmt)
- {
- case cCRNFmtDXT1: return "DXT1";
- case cCRNFmtDXT3: return "DXT3";
- case cCRNFmtDXT5: return "DXT5";
- case cCRNFmtDXT5_CCxY: return "DXT5_CCxY";
- case cCRNFmtDXT5_xGBR: return "DXT5_xGBR";
- case cCRNFmtDXT5_AGBR: return "DXT5_AGBR";
- case cCRNFmtDXT5_xGxR: return "DXT5_xGxR";
- case cCRNFmtDXN_XY: return "DXN_XY";
- case cCRNFmtDXN_YX: return "DXN_YX";
- case cCRNFmtDXT5A: return "DXT5A";
- case cCRNFmtETC1: return "ETC1";
- default: break;
- }
- CRNLIB_ASSERT(false);
- return "?";
- }
-
- component_flags get_component_flags(pixel_format fmt)
- {
- // These flags are for *uncooked* pixels, i.e. after after adding Z to DXN maps, or converting YCC maps to RGB, etc.
-
- uint flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagAValid | cCompFlagGrayscale;
- switch (fmt)
- {
- case PIXEL_FMT_DXT1:
- case PIXEL_FMT_ETC1:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid;
- break;
- }
- case PIXEL_FMT_DXT1A:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagAValid;
- break;
- }
- case PIXEL_FMT_DXT2:
- case PIXEL_FMT_DXT3:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagAValid;
- break;
- }
- case PIXEL_FMT_DXT4:
- case PIXEL_FMT_DXT5:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagAValid;
- break;
- }
- case PIXEL_FMT_DXT5A:
- {
- flags = cCompFlagAValid;
- break;
- }
- case PIXEL_FMT_DXT5_CCxY:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagLumaChroma;
- break;
- }
- case PIXEL_FMT_DXT5_xGBR:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagNormalMap;
- break;
- }
- case PIXEL_FMT_DXT5_AGBR:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagAValid | cCompFlagNormalMap;
- break;
- }
- case PIXEL_FMT_DXT5_xGxR:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagNormalMap;
- break;
- }
- case PIXEL_FMT_3DC:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagNormalMap;
- break;
- }
- case PIXEL_FMT_DXN:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagNormalMap;
- break;
- }
- case PIXEL_FMT_R8G8B8:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid;
- break;
- }
- case PIXEL_FMT_A8R8G8B8:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagAValid;
- break;
- }
- case PIXEL_FMT_A8:
- {
- flags = cCompFlagAValid;
- break;
- }
- case PIXEL_FMT_L8:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagGrayscale;
- break;
- }
- case PIXEL_FMT_A8L8:
- {
- flags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagAValid | cCompFlagGrayscale;
- break;
- }
- default:
- {
- CRNLIB_ASSERT(0);
- break;
- }
- }
- return static_cast<component_flags>(flags);
- }
-
- crn_format convert_pixel_format_to_best_crn_format(pixel_format crn_fmt)
- {
- crn_format fmt = cCRNFmtDXT1;
- switch (crn_fmt)
- {
- case PIXEL_FMT_DXT1:
- case PIXEL_FMT_DXT1A:
- fmt = cCRNFmtDXT1;
- break;
- case PIXEL_FMT_DXT2:
- case PIXEL_FMT_DXT3:
- case PIXEL_FMT_DXT4:
- case PIXEL_FMT_DXT5:
- fmt = cCRNFmtDXT5;
- break;
- case PIXEL_FMT_3DC:
- fmt = cCRNFmtDXN_YX;
- break;
- case PIXEL_FMT_DXN:
- fmt = cCRNFmtDXN_XY;
- break;
- case PIXEL_FMT_DXT5A:
- fmt = cCRNFmtDXT5A;
- break;
- case PIXEL_FMT_R8G8B8:
- case PIXEL_FMT_L8:
- fmt = cCRNFmtDXT1;
- break;
- case PIXEL_FMT_A8R8G8B8:
- case PIXEL_FMT_A8:
- case PIXEL_FMT_A8L8:
- fmt = cCRNFmtDXT5;
- break;
- case PIXEL_FMT_DXT5_CCxY:
- fmt = cCRNFmtDXT5_CCxY;
- break;
- case PIXEL_FMT_DXT5_xGBR:
- fmt = cCRNFmtDXT5_xGBR;
- break;
- case PIXEL_FMT_DXT5_AGBR:
- fmt = cCRNFmtDXT5_AGBR;
- break;
- case PIXEL_FMT_DXT5_xGxR:
- fmt = cCRNFmtDXT5_xGxR;
- break;
- case PIXEL_FMT_ETC1:
- fmt = cCRNFmtETC1;
- break;
- default:
- {
- CRNLIB_ASSERT(false);
- break;
- }
- }
- return fmt;
- }
-
- pixel_format convert_crn_format_to_pixel_format(crn_format fmt)
- {
- switch (fmt)
- {
- case cCRNFmtDXT1: return PIXEL_FMT_DXT1;
- case cCRNFmtDXT3: return PIXEL_FMT_DXT3;
- case cCRNFmtDXT5: return PIXEL_FMT_DXT5;
- case cCRNFmtDXT5_CCxY: return PIXEL_FMT_DXT5_CCxY;
- case cCRNFmtDXT5_xGxR: return PIXEL_FMT_DXT5_xGxR;
- case cCRNFmtDXT5_xGBR: return PIXEL_FMT_DXT5_xGBR;
- case cCRNFmtDXT5_AGBR: return PIXEL_FMT_DXT5_AGBR;
- case cCRNFmtDXN_XY: return PIXEL_FMT_DXN;
- case cCRNFmtDXN_YX: return PIXEL_FMT_3DC;
- case cCRNFmtDXT5A: return PIXEL_FMT_DXT5A;
- case cCRNFmtETC1: return PIXEL_FMT_ETC1;
- default:
- {
- CRNLIB_ASSERT(false);
- break;
- }
- }
-
- return PIXEL_FMT_INVALID;
- }
-
- } // namespace pixel_format
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_pixel_format.h b/Libraries/crunch-ea9b8d/crnlib/crn_pixel_format.h
deleted file mode 100644
index 0fcc9b1e..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_pixel_format.h
+++ /dev/null
@@ -1,284 +0,0 @@
-// File: crn_pixel_format.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_dxt.h"
-#include "../inc/crnlib.h"
-#include "../inc/dds_defs.h"
-
-namespace crnlib
-{
- namespace pixel_format_helpers
- {
- uint get_num_formats();
- pixel_format get_pixel_format_by_index(uint index);
-
- const char* get_pixel_format_string(pixel_format fmt);
-
- const char* get_crn_format_string(crn_format fmt);
-
- inline bool is_grayscale(pixel_format fmt)
- {
- switch (fmt)
- {
- case PIXEL_FMT_L8:
- case PIXEL_FMT_A8L8:
- return true;
- default: break;
- }
- return false;
- }
-
- inline bool is_dxt1(pixel_format fmt)
- {
- return (fmt == PIXEL_FMT_DXT1) || (fmt == PIXEL_FMT_DXT1A);
- }
-
- // has_alpha() should probably be called "has_opacity()" - it indicates if the format encodes opacity
- // because some swizzled DXT5 formats do not encode opacity.
- inline bool has_alpha(pixel_format fmt)
- {
- switch (fmt)
- {
- case PIXEL_FMT_DXT1A:
- case PIXEL_FMT_DXT2:
- case PIXEL_FMT_DXT3:
- case PIXEL_FMT_DXT4:
- case PIXEL_FMT_DXT5:
- case PIXEL_FMT_DXT5A:
- case PIXEL_FMT_A8R8G8B8:
- case PIXEL_FMT_A8:
- case PIXEL_FMT_A8L8:
- case PIXEL_FMT_DXT5_AGBR:
- return true;
- default: break;
- }
- return false;
- }
-
- inline bool is_alpha_only(pixel_format fmt)
- {
- switch (fmt)
- {
- case PIXEL_FMT_A8:
- case PIXEL_FMT_DXT5A:
- return true;
- default: break;
- }
- return false;
- }
-
- inline bool is_normal_map(pixel_format fmt)
- {
- switch (fmt)
- {
- case PIXEL_FMT_3DC:
- case PIXEL_FMT_DXN:
- case PIXEL_FMT_DXT5_xGBR:
- case PIXEL_FMT_DXT5_xGxR:
- case PIXEL_FMT_DXT5_AGBR:
- return true;
- default: break;
- }
- return false;
- }
-
- inline int is_dxt(pixel_format fmt)
- {
- switch (fmt)
- {
- case PIXEL_FMT_DXT1:
- case PIXEL_FMT_DXT1A:
- case PIXEL_FMT_DXT2:
- case PIXEL_FMT_DXT3:
- case PIXEL_FMT_DXT4:
- case PIXEL_FMT_DXT5:
- case PIXEL_FMT_3DC:
- case PIXEL_FMT_DXT5A:
- case PIXEL_FMT_DXN:
- case PIXEL_FMT_DXT5_CCxY:
- case PIXEL_FMT_DXT5_xGxR:
- case PIXEL_FMT_DXT5_xGBR:
- case PIXEL_FMT_DXT5_AGBR:
- case PIXEL_FMT_ETC1:
- return true;
- default: break;
- }
- return false;
- }
-
- inline int get_fundamental_format(pixel_format fmt)
- {
- switch (fmt)
- {
- case PIXEL_FMT_DXT1A:
- return PIXEL_FMT_DXT1;
- case PIXEL_FMT_DXT5_CCxY:
- case PIXEL_FMT_DXT5_xGxR:
- case PIXEL_FMT_DXT5_xGBR:
- case PIXEL_FMT_DXT5_AGBR:
- return PIXEL_FMT_DXT5;
- default: break;
- }
- return fmt;
- }
-
- inline dxt_format get_dxt_format(pixel_format fmt)
- {
- switch (fmt)
- {
- case PIXEL_FMT_DXT1: return cDXT1;
- case PIXEL_FMT_DXT1A: return cDXT1A;
- case PIXEL_FMT_DXT2: return cDXT3;
- case PIXEL_FMT_DXT3: return cDXT3;
- case PIXEL_FMT_DXT4: return cDXT5;
- case PIXEL_FMT_DXT5: return cDXT5;
- case PIXEL_FMT_3DC: return cDXN_YX;
- case PIXEL_FMT_DXT5A: return cDXT5A;
- case PIXEL_FMT_DXN: return cDXN_XY;
- case PIXEL_FMT_DXT5_CCxY: return cDXT5;
- case PIXEL_FMT_DXT5_xGxR: return cDXT5;
- case PIXEL_FMT_DXT5_xGBR: return cDXT5;
- case PIXEL_FMT_DXT5_AGBR: return cDXT5;
- case PIXEL_FMT_ETC1: return cETC1;
- default: break;
- }
- return cDXTInvalid;
- }
-
- inline pixel_format from_dxt_format(dxt_format dxt_fmt)
- {
- switch (dxt_fmt)
- {
- case cDXT1:
- return PIXEL_FMT_DXT1;
- case cDXT1A:
- return PIXEL_FMT_DXT1A;
- case cDXT3:
- return PIXEL_FMT_DXT3;
- case cDXT5:
- return PIXEL_FMT_DXT5;
- case cDXN_XY:
- return PIXEL_FMT_DXN;
- case cDXN_YX:
- return PIXEL_FMT_3DC;
- case cDXT5A:
- return PIXEL_FMT_DXT5A;
- case cETC1:
- return PIXEL_FMT_ETC1;
- default: break;
- }
- CRNLIB_ASSERT(false);
- return PIXEL_FMT_INVALID;
- }
-
- inline bool is_pixel_format_non_srgb(pixel_format fmt)
- {
- switch (fmt)
- {
- case PIXEL_FMT_3DC:
- case PIXEL_FMT_DXN:
- case PIXEL_FMT_DXT5A:
- case PIXEL_FMT_DXT5_CCxY:
- case PIXEL_FMT_DXT5_xGxR:
- case PIXEL_FMT_DXT5_xGBR:
- case PIXEL_FMT_DXT5_AGBR:
- return true;
- default: break;
- }
- return false;
- }
-
- inline bool is_crn_format_non_srgb(crn_format fmt)
- {
- switch (fmt)
- {
- case cCRNFmtDXN_XY:
- case cCRNFmtDXN_YX:
- case cCRNFmtDXT5A:
- case cCRNFmtDXT5_CCxY:
- case cCRNFmtDXT5_xGxR:
- case cCRNFmtDXT5_xGBR:
- case cCRNFmtDXT5_AGBR:
- return true;
- default: break;
- }
- return false;
- }
-
- inline uint get_bpp(pixel_format fmt)
- {
- switch (fmt)
- {
- case PIXEL_FMT_DXT1: return 4;
- case PIXEL_FMT_DXT1A: return 4;
- case PIXEL_FMT_ETC1: return 4;
- case PIXEL_FMT_DXT2: return 8;
- case PIXEL_FMT_DXT3: return 8;
- case PIXEL_FMT_DXT4: return 8;
- case PIXEL_FMT_DXT5: return 8;
- case PIXEL_FMT_3DC: return 8;
- case PIXEL_FMT_DXT5A: return 4;
- case PIXEL_FMT_R8G8B8: return 24;
- case PIXEL_FMT_A8R8G8B8: return 32;
- case PIXEL_FMT_A8: return 8;
- case PIXEL_FMT_L8: return 8;
- case PIXEL_FMT_A8L8: return 16;
- case PIXEL_FMT_DXN: return 8;
- case PIXEL_FMT_DXT5_CCxY: return 8;
- case PIXEL_FMT_DXT5_xGxR: return 8;
- case PIXEL_FMT_DXT5_xGBR: return 8;
- case PIXEL_FMT_DXT5_AGBR: return 8;
- default: break;
- }
- CRNLIB_ASSERT(false);
- return 0;
- };
-
- inline uint get_dxt_bytes_per_block(pixel_format fmt)
- {
- switch (fmt)
- {
- case PIXEL_FMT_DXT1: return 8;
- case PIXEL_FMT_DXT1A: return 8;
- case PIXEL_FMT_DXT5A: return 8;
- case PIXEL_FMT_ETC1: return 8;
- case PIXEL_FMT_DXT2: return 16;
- case PIXEL_FMT_DXT3: return 16;
- case PIXEL_FMT_DXT4: return 16;
- case PIXEL_FMT_DXT5: return 16;
- case PIXEL_FMT_3DC: return 16;
- case PIXEL_FMT_DXN: return 16;
- case PIXEL_FMT_DXT5_CCxY: return 16;
- case PIXEL_FMT_DXT5_xGxR: return 16;
- case PIXEL_FMT_DXT5_xGBR: return 16;
- case PIXEL_FMT_DXT5_AGBR: return 16;
- default: break;
- }
- CRNLIB_ASSERT(false);
- return 0;
- }
-
- enum component_flags
- {
- cCompFlagRValid = 1,
- cCompFlagGValid = 2,
- cCompFlagBValid = 4,
- cCompFlagAValid = 8,
-
- cCompFlagGrayscale = 16,
- cCompFlagNormalMap = 32,
- cCompFlagLumaChroma = 64,
-
- cDefaultCompFlags = cCompFlagRValid | cCompFlagGValid | cCompFlagBValid | cCompFlagAValid
- };
-
- component_flags get_component_flags(pixel_format fmt);
-
- crn_format convert_pixel_format_to_best_crn_format(pixel_format crn_fmt);
-
- pixel_format convert_crn_format_to_pixel_format(crn_format fmt);
-
- } // namespace pixel_format_helpers
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_platform.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_platform.cpp
deleted file mode 100644
index 4ffe2718..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_platform.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-// File: crn_platform.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-
-#if CRNLIB_USE_WIN32_API
-#include "crn_winhdr.h"
-#endif
-#ifndef _MSC_VER
-int sprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, ...)
-{
- if (!sizeOfBuffer)
- return 0;
-
- va_list args;
- va_start(args, format);
- int c = vsnprintf(buffer, sizeOfBuffer, format, args);
- va_end(args);
-
- buffer[sizeOfBuffer - 1] = '\0';
-
- if (c < 0)
- return sizeOfBuffer - 1;
-
- return CRNLIB_MIN(c, (int)sizeOfBuffer - 1);
-}
-
-int vsprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, va_list args)
-{
- if (!sizeOfBuffer)
- return 0;
-
- int c = vsnprintf(buffer, sizeOfBuffer, format, args);
-
- buffer[sizeOfBuffer - 1] = '\0';
-
- if (c < 0)
- return sizeOfBuffer - 1;
-
- return CRNLIB_MIN(c, (int)sizeOfBuffer - 1);
-}
-
-char* strlwr(char* p)
-{
- char *q = p;
- while (*q)
- {
- char c = *q;
- *q++ = tolower(c);
- }
- return p;
-}
-
-char* strupr(char *p)
-{
- char *q = p;
- while (*q)
- {
- char c = *q;
- *q++ = toupper(c);
- }
- return p;
-}
-#endif // __GNUC__
-
-void crnlib_debug_break(void)
-{
- CRNLIB_BREAKPOINT
-}
-
-#if CRNLIB_USE_WIN32_API
-#include "crn_winhdr.h"
-
-bool crnlib_is_debugger_present(void)
-{
- return IsDebuggerPresent() != 0;
-}
-
-void crnlib_output_debug_string(const char* p)
-{
- OutputDebugStringA(p);
-}
-#else
-bool crnlib_is_debugger_present(void)
-{
- return false;
-}
-
-void crnlib_output_debug_string(const char* p)
-{
- puts(p);
-}
-#endif // CRNLIB_USE_WIN32_API
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_platform.h b/Libraries/crunch-ea9b8d/crnlib/crn_platform.h
deleted file mode 100644
index 3588e37a..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_platform.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// File: crn_platform.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-bool crnlib_is_debugger_present(void);
-void crnlib_debug_break(void);
-void crnlib_output_debug_string(const char* p);
-
-// actually in crnlib_assert.cpp
-void crnlib_assert(const char* pExp, const char* pFile, unsigned line);
-void crnlib_fail(const char* pExp, const char* pFile, unsigned line);
-
-#if CRNLIB_LITTLE_ENDIAN_CPU
- const bool c_crnlib_little_endian_platform = true;
-#else
- const bool c_crnlib_little_endian_platform = false;
-#endif
-
-const bool c_crnlib_big_endian_platform = !c_crnlib_little_endian_platform;
-
-#ifdef __GNUC__
- #define crn_fopen(pDstFile, f, m) *(pDstFile) = fopen64(f, m)
- #define crn_fseek fseeko64
- #define crn_ftell ftello64
-#elif defined( _MSC_VER )
- #define crn_fopen(pDstFile, f, m) fopen_s(pDstFile, f, m)
- #define crn_fseek _fseeki64
- #define crn_ftell _ftelli64
-#else
- #define crn_fopen(pDstFile, f, m) *(pDstFile) = fopen(f, m)
- #define crn_fseek(s, o, w) fseek(s, static_cast<long>(o), w)
- #define crn_ftell ftell
-#endif
-
-#if CRNLIB_USE_WIN32_API
- #define CRNLIB_BREAKPOINT DebugBreak();
- #define CRNLIB_BUILTIN_EXPECT(c, v) c
-#elif defined(__GNUC__)
- #define CRNLIB_BREAKPOINT asm("int $3");
- #define CRNLIB_BUILTIN_EXPECT(c, v) __builtin_expect(c, v)
-#else
- #define CRNLIB_BREAKPOINT
- #define CRNLIB_BUILTIN_EXPECT(c, v) c
-#endif
-
-#if defined(__GNUC__)
- #define CRNLIB_ALIGNED(x) __attribute__((aligned(x)))
- #define CRNLIB_NOINLINE __attribute__((noinline))
-#elif defined(_MSC_VER)
- #define CRNLIB_ALIGNED(x) __declspec(align(x))
- #define CRNLIB_NOINLINE __declspec(noinline)
-#else
- #define CRNLIB_ALIGNED(x)
- #define CRNLIB_NOINLINE
-#endif
-
-#define CRNLIB_GET_ALIGNMENT(v) ((!sizeof(v)) ? 1 : (__alignof(v) ? __alignof(v) : sizeof(uint32)))
-
-#ifndef _MSC_VER
- int sprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, ...);
- int vsprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, va_list args);
- char* strlwr(char* p);
- char* strupr(char *p);
- #define _stricmp strcasecmp
- #define _strnicmp strncasecmp
-#endif
-
-inline bool crnlib_is_little_endian() { return c_crnlib_little_endian_platform; }
-inline bool crnlib_is_big_endian() { return c_crnlib_big_endian_platform; }
-
-inline bool crnlib_is_pc()
-{
-#ifdef CRNLIB_PLATFORM_PC
- return true;
-#else
- return false;
-#endif
-}
-
-inline bool crnlib_is_x86()
-{
-#ifdef CRNLIB_PLATFORM_PC_X86
- return true;
-#else
- return false;
-#endif
-}
-
-inline bool crnlib_is_x64()
-{
-#ifdef CRNLIB_PLATFORM_PC_X64
- return true;
-#else
- return false;
-#endif
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_prefix_coding.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_prefix_coding.cpp
deleted file mode 100644
index e608ffcc..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_prefix_coding.cpp
+++ /dev/null
@@ -1,356 +0,0 @@
-// File: crn_prefix_coding.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_prefix_coding.h"
-//#include "rand.h"
-
-#ifdef CRNLIB_BUILD_DEBUG
- //#define TEST_DECODER_TABLES
-#endif
-
-namespace crnlib
-{
-
- namespace prefix_coding
- {
- bool limit_max_code_size(uint num_syms, uint8* pCodesizes, uint max_code_size)
- {
- const uint cMaxEverCodeSize = 34;
-
- if ((!num_syms) || (num_syms > cMaxSupportedSyms) || (max_code_size < 1) || (max_code_size > cMaxEverCodeSize))
- return false;
-
- uint num_codes[cMaxEverCodeSize + 1];
- utils::zero_object(num_codes);
-
- bool should_limit = false;
-
- for (uint i = 0; i < num_syms; i++)
- {
- uint c = pCodesizes[i];
- if (c)
- {
- CRNLIB_ASSERT(c <= cMaxEverCodeSize);
-
- num_codes[c]++;
- if (c > max_code_size)
- should_limit = true;
- }
- }
-
- if (!should_limit)
- return true;
-
- uint ofs = 0;
- uint next_sorted_ofs[cMaxEverCodeSize + 1];
- for (uint i = 1; i <= cMaxEverCodeSize; i++)
- {
- next_sorted_ofs[i] = ofs;
- ofs += num_codes[i];
- }
-
- if ((ofs < 2) || (ofs > cMaxSupportedSyms))
- return true;
-
- if (ofs > (1U << max_code_size))
- return false;
-
- for (uint i = max_code_size + 1; i <= cMaxEverCodeSize; i++)
- num_codes[max_code_size] += num_codes[i];
-
- // Technique of adjusting tree to enforce maximum code size from LHArc.
-
- uint total = 0;
- for (uint i = max_code_size; i; --i)
- total += (num_codes[i] << (max_code_size - i));
-
- if (total == (1U << max_code_size))
- return true;
-
- do
- {
- num_codes[max_code_size]--;
-
- uint i;
- for (i = max_code_size - 1; i; --i)
- {
- if (!num_codes[i])
- continue;
- num_codes[i]--;
- num_codes[i + 1] += 2;
- break;
- }
- if (!i)
- return false;
-
- total--;
- } while (total != (1U << max_code_size));
-
- uint8 new_codesizes[cMaxSupportedSyms];
- uint8* p = new_codesizes;
- for (uint i = 1; i <= max_code_size; i++)
- {
- uint n = num_codes[i];
- if (n)
- {
- memset(p, i, n);
- p += n;
- }
- }
-
- for (uint i = 0; i < num_syms; i++)
- {
- const uint c = pCodesizes[i];
- if (c)
- {
- uint ofs = next_sorted_ofs[c];
- next_sorted_ofs[c] = ofs + 1;
-
- pCodesizes[i] = static_cast<uint8>(new_codesizes[ofs]);
- }
- }
-
- return true;
- }
-
- bool generate_codes(uint num_syms, const uint8* pCodesizes, uint16* pCodes)
- {
- uint num_codes[cMaxExpectedCodeSize + 1];
- utils::zero_object(num_codes);
-
- for (uint i = 0; i < num_syms; i++)
- {
- uint c = pCodesizes[i];
- if (c)
- {
- CRNLIB_ASSERT(c <= cMaxExpectedCodeSize);
- num_codes[c]++;
- }
- }
-
- uint code = 0;
-
- uint next_code[cMaxExpectedCodeSize + 1];
- next_code[0] = 0;
-
- for (uint i = 1; i <= cMaxExpectedCodeSize; i++)
- {
- next_code[i] = code;
-
- code = (code + num_codes[i]) << 1;
- }
-
- if (code != (1 << (cMaxExpectedCodeSize + 1)))
- {
- uint t = 0;
- for (uint i = 1; i <= cMaxExpectedCodeSize; i++)
- {
- t += num_codes[i];
- if (t > 1)
- return false;
- }
- }
-
- for (uint i = 0; i < num_syms; i++)
- {
- uint c = pCodesizes[i];
- if (c)
- {
- CRNLIB_ASSERT(next_code[c] <= cUINT16_MAX);
- pCodes[i] = static_cast<uint16>(next_code[c]++);
-
- CRNLIB_ASSERT(math::total_bits(pCodes[i]) <= pCodesizes[i]);
- }
- }
-
- return true;
- }
-
- bool generate_decoder_tables(uint num_syms, const uint8* pCodesizes, decoder_tables* pTables, uint table_bits)
- {
- uint min_codes[cMaxExpectedCodeSize];
-
- if ((!num_syms) || (table_bits > cMaxTableBits))
- return false;
-
- pTables->m_num_syms = num_syms;
-
- uint num_codes[cMaxExpectedCodeSize + 1];
- utils::zero_object(num_codes);
-
- for (uint i = 0; i < num_syms; i++)
- {
- uint c = pCodesizes[i];
- if (c)
- num_codes[c]++;
- }
-
- uint sorted_positions[cMaxExpectedCodeSize + 1];
-
- uint code = 0;
-
- uint total_used_syms = 0;
- uint max_code_size = 0;
- uint min_code_size = UINT_MAX;
- for (uint i = 1; i <= cMaxExpectedCodeSize; i++)
- {
- const uint n = num_codes[i];
-
- if (!n)
- pTables->m_max_codes[i - 1] = 0;//UINT_MAX;
- else
- {
- min_code_size = math::minimum(min_code_size, i);
- max_code_size = math::maximum(max_code_size, i);
-
- min_codes[i - 1] = code;
-
- pTables->m_max_codes[i - 1] = code + n - 1;
- pTables->m_max_codes[i - 1] = 1 + ((pTables->m_max_codes[i - 1] << (16 - i)) | ((1 << (16 - i)) - 1));
-
- pTables->m_val_ptrs[i - 1] = total_used_syms;
-
- sorted_positions[i] = total_used_syms;
-
- code += n;
- total_used_syms += n;
- }
-
- code <<= 1;
- }
-
- pTables->m_total_used_syms = total_used_syms;
-
- if (total_used_syms > pTables->m_cur_sorted_symbol_order_size)
- {
- pTables->m_cur_sorted_symbol_order_size = total_used_syms;
-
- if (!math::is_power_of_2(total_used_syms))
- pTables->m_cur_sorted_symbol_order_size = math::minimum<uint>(num_syms, math::next_pow2(total_used_syms));
-
- if (pTables->m_sorted_symbol_order)
- {
- crnlib_delete_array(pTables->m_sorted_symbol_order);
- pTables->m_sorted_symbol_order = NULL;
- }
-
- pTables->m_sorted_symbol_order = crnlib_new_array<uint16>(pTables->m_cur_sorted_symbol_order_size);
- }
-
- pTables->m_min_code_size = static_cast<uint8>(min_code_size);
- pTables->m_max_code_size = static_cast<uint8>(max_code_size);
-
- for (uint i = 0; i < num_syms; i++)
- {
- uint c = pCodesizes[i];
- if (c)
- {
- CRNLIB_ASSERT(num_codes[c]);
-
- uint sorted_pos = sorted_positions[c]++;
-
- CRNLIB_ASSERT(sorted_pos < total_used_syms);
-
- pTables->m_sorted_symbol_order[sorted_pos] = static_cast<uint16>(i);
- }
- }
-
- if (table_bits <= pTables->m_min_code_size)
- table_bits = 0;
- pTables->m_table_bits = table_bits;
-
- if (table_bits)
- {
- uint table_size = 1 << table_bits;
- if (table_size > pTables->m_cur_lookup_size)
- {
- pTables->m_cur_lookup_size = table_size;
-
- if (pTables->m_lookup)
- {
- crnlib_delete_array(pTables->m_lookup);
- pTables->m_lookup = NULL;
- }
-
- pTables->m_lookup = crnlib_new_array<uint32>(table_size);
- }
-
- memset(pTables->m_lookup, 0xFF, static_cast<uint>(sizeof(pTables->m_lookup[0])) * (1UL << table_bits));
-
- for (uint codesize = 1; codesize <= table_bits; codesize++)
- {
- if (!num_codes[codesize])
- continue;
-
- const uint fillsize = table_bits - codesize;
- const uint fillnum = 1 << fillsize;
-
- const uint min_code = min_codes[codesize - 1];
- const uint max_code = pTables->get_unshifted_max_code(codesize);
- const uint val_ptr = pTables->m_val_ptrs[codesize - 1];
-
- for (uint code = min_code; code <= max_code; code++)
- {
- const uint sym_index = pTables->m_sorted_symbol_order[ val_ptr + code - min_code ];
- CRNLIB_ASSERT( pCodesizes[sym_index] == codesize );
-
- for (uint j = 0; j < fillnum; j++)
- {
- const uint t = j + (code << fillsize);
-
- CRNLIB_ASSERT(t < (1U << table_bits));
-
- CRNLIB_ASSERT(pTables->m_lookup[t] == cUINT32_MAX);
-
- pTables->m_lookup[t] = sym_index | (codesize << 16U);
- }
- }
- }
- }
-
- for (uint i = 0; i < cMaxExpectedCodeSize; i++)
- pTables->m_val_ptrs[i] -= min_codes[i];
-
- pTables->m_table_max_code = 0;
- pTables->m_decode_start_code_size = pTables->m_min_code_size;
-
- if (table_bits)
- {
- uint i;
- for (i = table_bits; i >= 1; i--)
- {
- if (num_codes[i])
- {
- pTables->m_table_max_code = pTables->m_max_codes[i - 1];
- break;
- }
- }
- if (i >= 1)
- {
- pTables->m_decode_start_code_size = table_bits + 1;
- for (uint i = table_bits + 1; i <= max_code_size; i++)
- {
- if (num_codes[i])
- {
- pTables->m_decode_start_code_size = i;
- break;
- }
- }
- }
- }
-
- // sentinels
- pTables->m_max_codes[cMaxExpectedCodeSize] = UINT_MAX;
- pTables->m_val_ptrs[cMaxExpectedCodeSize] = 0xFFFFF;
-
- pTables->m_table_shift = 32 - pTables->m_table_bits;
-
- return true;
- }
-
- } // namespace prefix_codig
-
-
-} // namespace crnlib
-
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_prefix_coding.h b/Libraries/crunch-ea9b8d/crnlib/crn_prefix_coding.h
deleted file mode 100644
index e07bbee9..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_prefix_coding.h
+++ /dev/null
@@ -1,116 +0,0 @@
-// File: crn_prefix_coding.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- namespace prefix_coding
- {
- const uint cMaxExpectedCodeSize = 16;
- const uint cMaxSupportedSyms = 8192;
- const uint cMaxTableBits = 11;
-
- bool limit_max_code_size(uint num_syms, uint8* pCodesizes, uint max_code_size);
-
- bool generate_codes(uint num_syms, const uint8* pCodesizes, uint16* pCodes);
-
- class decoder_tables
- {
- public:
- inline decoder_tables() :
- m_table_shift(0), m_table_max_code(0), m_decode_start_code_size(0), m_cur_lookup_size(0), m_lookup(NULL), m_cur_sorted_symbol_order_size(0), m_sorted_symbol_order(NULL)
- {
- }
-
- inline decoder_tables(const decoder_tables& other) :
- m_table_shift(0), m_table_max_code(0), m_decode_start_code_size(0), m_cur_lookup_size(0), m_lookup(NULL), m_cur_sorted_symbol_order_size(0), m_sorted_symbol_order(NULL)
- {
- *this = other;
- }
-
- decoder_tables& operator= (const decoder_tables& other)
- {
- if (this == &other)
- return *this;
-
- clear();
-
- memcpy(this, &other, sizeof(*this));
-
- if (other.m_lookup)
- {
- m_lookup = crnlib_new_array<uint32>(m_cur_lookup_size);
- memcpy(m_lookup, other.m_lookup, sizeof(m_lookup[0]) * m_cur_lookup_size);
- }
-
- if (other.m_sorted_symbol_order)
- {
- m_sorted_symbol_order = crnlib_new_array<uint16>(m_cur_sorted_symbol_order_size);
- memcpy(m_sorted_symbol_order, other.m_sorted_symbol_order, sizeof(m_sorted_symbol_order[0]) * m_cur_sorted_symbol_order_size);
- }
-
- return *this;
- }
-
- inline void clear()
- {
- if (m_lookup)
- {
- crnlib_delete_array(m_lookup);
- m_lookup = 0;
- m_cur_lookup_size = 0;
- }
-
- if (m_sorted_symbol_order)
- {
- crnlib_delete_array(m_sorted_symbol_order);
- m_sorted_symbol_order = NULL;
- m_cur_sorted_symbol_order_size = 0;
- }
- }
-
- inline ~decoder_tables()
- {
- if (m_lookup)
- crnlib_delete_array(m_lookup);
-
- if (m_sorted_symbol_order)
- crnlib_delete_array(m_sorted_symbol_order);
- }
-
- // DO NOT use any complex classes here - it is bitwise copied.
-
- uint m_num_syms;
- uint m_total_used_syms;
- uint m_table_bits;
- uint m_table_shift;
- uint m_table_max_code;
- uint m_decode_start_code_size;
-
- uint8 m_min_code_size;
- uint8 m_max_code_size;
-
- uint m_max_codes[cMaxExpectedCodeSize + 1];
- int m_val_ptrs[cMaxExpectedCodeSize + 1];
-
- uint m_cur_lookup_size;
- uint32* m_lookup;
-
- uint m_cur_sorted_symbol_order_size;
- uint16* m_sorted_symbol_order;
-
- inline uint get_unshifted_max_code(uint len) const
- {
- CRNLIB_ASSERT( (len >= 1) && (len <= cMaxExpectedCodeSize) );
- uint k = m_max_codes[len - 1];
- if (!k)
- return UINT_MAX;
- return (k - 1) >> (16 - len);
- }
- };
-
- bool generate_decoder_tables(uint num_syms, const uint8* pCodesizes, decoder_tables* pTables, uint table_bits);
-
- } // namespace prefix_coding
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_qdxt1.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_qdxt1.cpp
deleted file mode 100644
index e978d5e4..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_qdxt1.cpp
+++ /dev/null
@@ -1,910 +0,0 @@
-// File: crn_qdxt.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_qdxt1.h"
-#include "crn_dxt1.h"
-#include "crn_dxt_fast.h"
-#include "crn_image_utils.h"
-#include "crn_dxt_hc_common.h"
-
-#define GENERATE_DEBUG_IMAGES 0
-
-namespace crnlib
-{
- qdxt1::qdxt1(task_pool& task_pool) :
- m_pTask_pool(&task_pool),
- m_main_thread_id(0),
- m_canceled(false),
- m_progress_start(0),
- m_progress_range(100),
- m_num_blocks(0),
- m_pBlocks(NULL),
- m_pDst_elements(NULL),
- m_elements_per_block(0),
- m_max_selector_clusters(0),
- m_prev_percentage_complete(-1),
- m_selector_clusterizer(task_pool)
- {
- }
-
- qdxt1::~qdxt1()
- {
- }
-
- void qdxt1::clear()
- {
- m_main_thread_id = 0;
- m_num_blocks = 0;
- m_pBlocks = 0;
- m_pDst_elements = NULL;
- m_elements_per_block = 0;
- m_params.clear();
- m_endpoint_clusterizer.clear();
- m_endpoint_cluster_indices.clear();
- m_max_selector_clusters = 0;
- m_canceled = false;
- m_progress_start = 0;
- m_progress_range = 100;
- m_selector_clusterizer.clear();
-
- for (uint i = 0; i <= qdxt1_params::cMaxQuality; i++)
- m_cached_selector_cluster_indices[i].clear();
-
- m_cluster_hash.clear();
-
- m_prev_percentage_complete = -1;
- }
-
- bool qdxt1::init(uint n, const dxt_pixel_block* pBlocks, const qdxt1_params& params)
- {
- clear();
-
- CRNLIB_ASSERT(n && pBlocks);
-
- m_main_thread_id = crn_get_current_thread_id();
-
- m_num_blocks = n;
- m_pBlocks = pBlocks;
- m_params = params;
-
- m_endpoint_clusterizer.reserve_training_vecs(m_num_blocks);
-
- m_progress_start = 0;
- m_progress_range = 75;
-
- const bool debugging = false;
- image_u8 debug_img;
-
- if ((m_params.m_hierarchical) && (m_params.m_num_mips))
- {
- vec6F_clusterizer::training_vec_array& training_vecs = m_endpoint_clusterizer.get_training_vecs();
- training_vecs.resize(m_num_blocks);
-
- uint encoding_hist[cNumChunkEncodings];
- utils::zero_object(encoding_hist);
-
- uint total_processed_blocks = 0;
- uint next_progress_threshold = 512;
-
- for (uint level = 0; level < m_params.m_num_mips; level++)
- {
- const qdxt1_params::mip_desc& level_desc = m_params.m_mip_desc[level];
-
- const uint num_chunks_x = (level_desc.m_block_width + cChunkBlockWidth - 1) / cChunkBlockWidth;
- const uint num_chunks_y = (level_desc.m_block_height + cChunkBlockHeight - 1) / cChunkBlockHeight;
-
- const uint level_width = level_desc.m_block_width * 4;
- const uint level_height = level_desc.m_block_height * 4;
-
- if (debugging)
- debug_img.resize(num_chunks_x * cChunkPixelWidth, num_chunks_y * cChunkPixelHeight);
-
- float adaptive_tile_color_psnr_derating = 1.5f; // was 2.4f
- if ((level) && (adaptive_tile_color_psnr_derating > .25f))
- {
- adaptive_tile_color_psnr_derating = math::maximum(.25f, adaptive_tile_color_psnr_derating / powf(3.1f, static_cast<float>(level))); // was 3.0f
- }
- for (uint chunk_y = 0; chunk_y < num_chunks_y; chunk_y++)
- {
- for (uint chunk_x = 0; chunk_x < num_chunks_x; chunk_x++)
- {
- color_quad_u8 chunk_pixels[cChunkPixelWidth * cChunkPixelHeight];
-
- for (uint y = 0; y < cChunkPixelHeight; y++)
- {
- const uint pix_y = math::minimum<uint>(chunk_y * cChunkPixelHeight + y, level_height - 1);
-
- const uint outer_block_index = level_desc.m_first_block + ((pix_y >> 2) * level_desc.m_block_width);
-
- for (uint x = 0; x < cChunkPixelWidth; x++)
- {
- const uint pix_x = math::minimum<uint>(chunk_x * cChunkPixelWidth + x, level_width - 1);
-
- const uint block_index = outer_block_index + (pix_x >> 2);
-
- const dxt_pixel_block& block = m_pBlocks[block_index];
-
- const color_quad_u8& p = block.m_pixels[pix_y & 3][pix_x & 3];
-
- chunk_pixels[x + y * 8] = p;
- }
- }
-
- struct layout_results
- {
- uint m_low_color;
- uint m_high_color;
- uint8 m_selectors[cChunkPixelWidth * cChunkPixelHeight];
- uint64 m_error;
- //float m_penalty;
- };
- layout_results layouts[cNumChunkTileLayouts];
-
- for (uint l = 0; l < cNumChunkTileLayouts; l++)
- {
- const uint width = g_chunk_tile_layouts[l].m_width;
- const uint height = g_chunk_tile_layouts[l].m_height;
- const uint x_ofs = g_chunk_tile_layouts[l].m_x_ofs;
- const uint y_ofs = g_chunk_tile_layouts[l].m_y_ofs;
-
- color_quad_u8 layout_pixels[cChunkPixelWidth * cChunkPixelHeight];
- for (uint y = 0; y < height; y++)
- for (uint x = 0; x < width; x++)
- layout_pixels[x + y * width] = chunk_pixels[(x_ofs + x) + (y_ofs + y) * cChunkPixelWidth];
-
- const uint n = width * height;
- dxt_fast::compress_color_block(n, layout_pixels, layouts[l].m_low_color, layouts[l].m_high_color, layouts[l].m_selectors);
-
- color_quad_u8 c[4];
- dxt1_block::get_block_colors(c, static_cast<uint16>(layouts[l].m_low_color), static_cast<uint16>(layouts[l].m_high_color));
-
- uint64 error = 0;
- for (uint i = 0; i < n; i++)
- error += color::elucidian_distance(layout_pixels[i], c[layouts[l].m_selectors[i]], false);
-
- layouts[l].m_error = error;
-
-#if 0
- if ((width > 4) || (height > 4))
- {
- const uint dist = color::elucidian_distance(
- dxt1_block::unpack_color(static_cast<uint16>(layouts[l].m_low_color), true),
- dxt1_block::unpack_color(static_cast<uint16>(layouts[l].m_high_color), true), false);
-
- layouts[l].m_penalty = math::clamp((sqrt((float)dist) - 75.0f) / 150.0f, 0.0f, 2.0f);
- if ((width == 8) && (height == 8))
- layouts[l].m_penalty *= 2.0f;
- }
- else
- {
- layouts[l].m_penalty = 0.0f;
- }
-#endif
- }
-
- double best_peak_snr = -1.0f;
- uint best_encoding = 0;
-
- for (uint e = 0; e < cNumChunkEncodings; e++)
- {
- const chunk_encoding_desc& encoding_desc = g_chunk_encodings[e];
-
- double total_error = 0;
-
- for (uint t = 0; t < encoding_desc.m_num_tiles; t++)
- total_error += (double)layouts[encoding_desc.m_tiles[t].m_layout_index].m_error;
-
- //double mean_squared = total_error * (1.0f / (16.0f * 3.0f));
- double mean_squared = total_error * (1.0f / (64.0f * 3.0f));
- double root_mean_squared = sqrt(mean_squared);
-
- double peak_snr = 999999.0f;
- if (mean_squared)
- peak_snr = math::clamp<double>(log10(255.0f / root_mean_squared) * 20.0f, 0.0f, 500.0f);
-
- //if (level)
- // adaptive_tile_color_psnr_derating = math::lerp(adaptive_tile_color_psnr_derating * .5f, .3f, math::maximum((level - 1) / float(m_params.m_num_mips - 2), 1.0f));
-
- float color_derating = math::lerp( 0.0f, adaptive_tile_color_psnr_derating, (g_chunk_encodings[e].m_num_tiles - 1) / 3.0f );
- peak_snr = peak_snr - color_derating;
-
- //for (uint t = 0; t < encoding_desc.m_num_tiles; t++)
- // peak_snr -= (double)layouts[encoding_desc.m_tiles[t].m_layout_index].m_penalty;
-
- if (peak_snr > best_peak_snr)
- {
- best_peak_snr = peak_snr;
- best_encoding = e;
- }
- }
-
- encoding_hist[best_encoding]++;
-
- const chunk_encoding_desc& encoding_desc = g_chunk_encodings[best_encoding];
-
- for (uint t = 0; t < encoding_desc.m_num_tiles; t++)
- {
- const chunk_tile_desc& tile_desc = encoding_desc.m_tiles[t];
-
- uint layout_index = tile_desc.m_layout_index;
- const layout_results& layout = layouts[layout_index];
- color_quad_u8 c[4];
- if (debugging)
- dxt1_block::get_block_colors(c, static_cast<uint16>(layout.m_low_color), static_cast<uint16>(layout.m_high_color));
-
- color_quad_u8 tile_pixels[cChunkPixelWidth * cChunkPixelHeight];
-
- for (uint y = 0; y < tile_desc.m_height; y++)
- {
- const uint pix_y = y + tile_desc.m_y_ofs;
-
- for (uint x = 0; x < tile_desc.m_width; x++)
- {
- const uint pix_x = x + tile_desc.m_x_ofs;
-
- tile_pixels[x + y * tile_desc.m_width] = chunk_pixels[pix_x + pix_y * cChunkPixelWidth];
-
- if (debugging)
- debug_img(chunk_x * 8 + pix_x, chunk_y * 8 + pix_y) = c[layout.m_selectors[x + y * tile_desc.m_width]];
- }
- }
-
- color_quad_u8 l, h;
- dxt_fast::find_representative_colors(tile_desc.m_width * tile_desc.m_height, tile_pixels, l, h);
-
- //const uint dist = color::color_distance(m_params.m_perceptual, l, h, false);
- const uint dist = color::elucidian_distance(l, h, false);
-
- const uint cColorDistToWeight = 5000;
- const uint cMaxWeight = 8;
- uint weight = math::clamp<uint>(dist / cColorDistToWeight, 1, cMaxWeight);
-
- vec6F ev;
-
- ev[0] = l[0]; ev[1] = l[1]; ev[2] = l[2];
- ev[3] = h[0]; ev[4] = h[1]; ev[5] = h[2];
-
- for (uint y = 0; y < (tile_desc.m_height >> 2); y++)
- {
- uint block_y = chunk_y * cChunkBlockHeight + y + (tile_desc.m_y_ofs >> 2);
- if (block_y >= level_desc.m_block_height)
- continue;
-
- for (uint x = 0; x < (tile_desc.m_width >> 2); x++)
- {
- uint block_x = chunk_x * cChunkBlockWidth + x + (tile_desc.m_x_ofs >> 2);
- if (block_x >= level_desc.m_block_width)
- break;
-
- uint block_index = level_desc.m_first_block + block_x + block_y * level_desc.m_block_width;
-
- training_vecs[block_index].first = ev;
- training_vecs[block_index].second = weight;
-
- total_processed_blocks++;
-
- //if (debugging)
- //{
- // debug_img(block_x, block_y) = l;
- // debug_img(block_x + level_desc.m_block_width, block_y) = h;
- //}
-
- } // x
- } // y
- } //t
-
- if (total_processed_blocks >= next_progress_threshold)
- {
- next_progress_threshold += 512;
-
- if (!update_progress(total_processed_blocks, m_num_blocks - 1))
- return false;
- }
-
- } // chunk_x
- } // chunk_y
-
-#if GENERATE_DEBUG_IMAGES
- if (debugging)
- image_utils::write_to_file(dynamic_string(cVarArg, "debug_%u.tga", level).get_ptr(), debug_img, image_utils::cWriteFlagIgnoreAlpha);
-#endif
-
- } // level
-
-#if 0
- trace("chunk encoding hist: ");
- for (uint i = 0; i < cNumChunkEncodings; i++)
- trace("%u ", encoding_hist[i]);
- trace("\n");
-#endif
- }
- else
- {
- for (uint block_index = 0; block_index < m_num_blocks; block_index++)
- {
- if ((block_index & 511) == 0)
- {
- if (!update_progress(block_index, m_num_blocks - 1))
- return false;
- }
-
- color_quad_u8 l, h;
- dxt_fast::find_representative_colors(cDXTBlockSize * cDXTBlockSize, &m_pBlocks[block_index].m_pixels[0][0], l, h);
-
- //const uint dist = color::color_distance(m_params.m_perceptual, l, h, false);
- const uint dist = color::elucidian_distance(l, h, false);
-
- const uint cColorDistToWeight = 5000;
- const uint cMaxWeight = 8;
- uint weight = math::clamp<uint>(dist / cColorDistToWeight, 1, cMaxWeight);
-
- vec6F ev;
-
- ev[0] = l[0]; ev[1] = l[1]; ev[2] = l[2];
- ev[3] = h[0]; ev[4] = h[1]; ev[5] = h[2];
-
- m_endpoint_clusterizer.add_training_vec(ev, weight);
- }
- }
-
- const uint cMaxEndpointClusters = 65535U;
-
- m_progress_start = 75;
- m_progress_range = 20;
-
- if (!m_endpoint_clusterizer.generate_codebook(cMaxEndpointClusters, generate_codebook_progress_callback, this))
- return false;
-
- crnlib::hash_map<uint, empty_type> selector_hash;
-
- m_progress_start = 95;
- m_progress_range = 5;
-
- for (uint block_index = 0; block_index < m_num_blocks; block_index++)
- {
- if ((block_index & 511) == 0)
- {
- if (!update_progress(block_index, m_num_blocks - 1))
- return false;
- }
-
- dxt1_block dxt_blk;
- dxt_fast::compress_color_block(&dxt_blk, &m_pBlocks[block_index].m_pixels[0][0]);
-
- uint selectors = dxt_blk.m_selectors[0] | (dxt_blk.m_selectors[1] << 8) | (dxt_blk.m_selectors[2] << 16) | (dxt_blk.m_selectors[3] << 24);
-
- selector_hash.insert(selectors);
- }
-
- m_max_selector_clusters = selector_hash.size() + 128;
-
-// trace("max endpoint clusters: %u\n", m_endpoint_clusterizer.get_codebook_size());
-// trace("max selector clusters: %u\n", m_max_selector_clusters);
-
- update_progress(1, 1);
-
- return true;
- }
-
- bool qdxt1::update_progress(uint value, uint max_value)
- {
- if (!m_params.m_pProgress_func)
- return true;
-
- uint percentage = max_value ? (m_progress_start + (value * m_progress_range + (max_value / 2)) / max_value) : 100;
- if ((int)percentage == m_prev_percentage_complete)
- return true;
- m_prev_percentage_complete = percentage;
-
- if (!m_params.m_pProgress_func(m_params.m_progress_start + (percentage * m_params.m_progress_range) / 100U, m_params.m_pProgress_data))
- {
- m_canceled = true;
- return false;
- }
-
- return true;
- }
-
- void qdxt1::pack_endpoints_task(uint64 data, void* pData_ptr)
- {
- pData_ptr;
- const uint thread_index = static_cast<uint>(data);
-
- crnlib::vector<color_quad_u8> cluster_pixels;
- cluster_pixels.reserve(1024);
-
- crnlib::vector<uint8> selectors;
- selectors.reserve(1024);
-
- dxt1_endpoint_optimizer optimizer;
- dxt1_endpoint_optimizer::params p;
- dxt1_endpoint_optimizer::results r;
-
- p.m_quality = m_params.m_dxt_quality;
- p.m_use_alpha_blocks = m_params.m_use_alpha_blocks;
- p.m_dxt1a_alpha_threshold = m_params.m_dxt1a_alpha_threshold;
- p.m_perceptual = m_params.m_perceptual;
-
- uint cluster_index_progress_mask = math::next_pow2(m_endpoint_cluster_indices.size() / 100);
- cluster_index_progress_mask /= 2;
- cluster_index_progress_mask = math::maximum<uint>(cluster_index_progress_mask, 8);
- cluster_index_progress_mask -= 1;
-
- cluster_id cid;
- const crnlib::vector<uint32>& indices = cid.m_cells;
-
- for (uint cluster_index = 0; cluster_index < m_endpoint_cluster_indices.size(); cluster_index++)
- {
- if (m_canceled)
- return;
-
- if ((cluster_index & cluster_index_progress_mask) == 0)
- {
- if (crn_get_current_thread_id() == m_main_thread_id)
- {
- if (!update_progress(cluster_index, m_endpoint_cluster_indices.size() - 1))
- return;
- }
- }
-
- if (m_pTask_pool->get_num_threads())
- {
- if ((cluster_index % (m_pTask_pool->get_num_threads() + 1)) != thread_index)
- continue;
- }
-
- const crnlib::vector<uint>& cluster_indices = m_endpoint_cluster_indices[cluster_index];
-
- selectors.resize(cluster_indices.size() * cDXTBlockSize * cDXTBlockSize);
-
- bool found = false;
- uint32 found_endpoints = 0;
-
- cid.set(cluster_indices);
-
- {
- scoped_spinlock lock(m_cluster_hash_lock);
-
- cluster_hash::const_iterator it(m_cluster_hash.find(cid));
- if (it != m_cluster_hash.end())
- {
- CRNLIB_ASSERT(cid == it->first);
-
- found = true;
- found_endpoints = it->second;
- }
- }
-
- if (found)
- {
- const uint16 low_color = static_cast<uint16>(found_endpoints);
- const uint16 high_color = static_cast<uint16>((found_endpoints >> 16U));
-
- color_quad_u8 block_colors[4];
- dxt1_block::get_block_colors(block_colors, low_color, high_color);
-
- const bool is_alpha_block = (low_color <= high_color);
-
- for (uint block_iter = 0; block_iter < indices.size(); block_iter++)
- {
- const uint block_index = indices[block_iter];
-
- const color_quad_u8* pSrc_pixels = &m_pBlocks[block_index].m_pixels[0][0];
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- dxt1_block& dxt_block = get_block(block_index);
-
- dxt_block.set_low_color(static_cast<uint16>(low_color));
- dxt_block.set_high_color(static_cast<uint16>(high_color));
-
- uint mask = 0;
- for (int i = 15; i >= 0; i--)
- {
- mask <<= 2;
-
- const color_quad_u8& c = pSrc_pixels[i];
-
- uint dist0 = color::color_distance(m_params.m_perceptual, c, block_colors[0], false);
- uint dist1 = color::color_distance(m_params.m_perceptual, c, block_colors[1], false);
- uint dist2 = color::color_distance(m_params.m_perceptual, c, block_colors[2], false);
-
- uint selector = 0, best_dist = dist0;
-
- if (dist1 < best_dist) { selector = 1; best_dist = dist1; }
- if (dist2 < best_dist) { selector = 2; best_dist = dist2; }
-
- if (!is_alpha_block)
- {
- uint dist3 = color::color_distance(m_params.m_perceptual, c, block_colors[3], false);
- if (dist3 < best_dist) { selector = 3; }
- }
- else
- {
- if (c.a < m_params.m_dxt1a_alpha_threshold)
- selector = 3;
- }
-
- mask |= selector;
- }
-
- dxt_block.m_selectors[0] = static_cast<uint8>(mask & 0xFF);
- dxt_block.m_selectors[1] = static_cast<uint8>((mask >> 8) & 0xFF);
- dxt_block.m_selectors[2] = static_cast<uint8>((mask >> 16) & 0xFF);
- dxt_block.m_selectors[3] = static_cast<uint8>((mask >> 24) & 0xFF);
- }
- }
- }
- else
- {
- cluster_pixels.resize(indices.size() * cDXTBlockSize * cDXTBlockSize);
-
- color_quad_u8* pDst = &cluster_pixels[0];
-
- bool has_alpha_pixels = false;
-
- for (uint block_iter = 0; block_iter < indices.size(); block_iter++)
- {
- const uint block_index = indices[block_iter];
-
- //const color_quad_u8* pSrc_pixels = &m_pBlocks[block_index].m_pixels[0][0];
- const color_quad_u8* pSrc_pixels = (const color_quad_u8*)m_pBlocks[block_index].m_pixels;
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- const color_quad_u8& src = pSrc_pixels[i];
-
- if (src.a < m_params.m_dxt1a_alpha_threshold)
- has_alpha_pixels = true;
-
- *pDst++ = src;
- }
- }
-
- p.m_block_index = cluster_index;
- p.m_num_pixels = cluster_pixels.size();
- p.m_pPixels = cluster_pixels.begin();
-
- r.m_pSelectors = selectors.begin();
-
- uint low_color, high_color;
- if ((m_params.m_dxt_quality != cCRNDXTQualitySuperFast) || (has_alpha_pixels))
- {
- p.m_pixels_have_alpha = has_alpha_pixels;
-
- optimizer.compute(p, r);
- low_color = r.m_low_color;
- high_color = r.m_high_color;
- }
- else
- {
- dxt_fast::compress_color_block(cluster_pixels.size(), cluster_pixels.begin(), low_color, high_color, selectors.begin(), true);
- }
-
- const uint8* pSrc_selectors = selectors.begin();
-
- for (uint block_iter = 0; block_iter < indices.size(); block_iter++)
- {
- const uint block_index = indices[block_iter];
-
- dxt1_block& dxt_block = get_block(block_index);
-
- dxt_block.set_low_color(static_cast<uint16>(low_color));
- dxt_block.set_high_color(static_cast<uint16>(high_color));
-
- uint mask = 0;
- for (int i = 15; i >= 0; i--)
- {
- mask <<= 2;
- mask |= pSrc_selectors[i];
- }
- pSrc_selectors += (cDXTBlockSize * cDXTBlockSize);
-
- dxt_block.m_selectors[0] = static_cast<uint8>(mask & 0xFF);
- dxt_block.m_selectors[1] = static_cast<uint8>((mask >> 8) & 0xFF);
- dxt_block.m_selectors[2] = static_cast<uint8>((mask >> 16) & 0xFF);
- dxt_block.m_selectors[3] = static_cast<uint8>((mask >> 24) & 0xFF);
-
- }
-
- {
- scoped_spinlock lock(m_cluster_hash_lock);
-
- m_cluster_hash.insert(cid, low_color | (high_color << 16));
- }
- }
-
- }
- }
-
- struct optimize_selectors_params
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(optimize_selectors_params);
-
- optimize_selectors_params(
- crnlib::vector< crnlib::vector<uint> >& selector_cluster_indices) :
- m_selector_cluster_indices(selector_cluster_indices)
- {
- }
-
- crnlib::vector< crnlib::vector<uint> >& m_selector_cluster_indices;
- };
-
- void qdxt1::optimize_selectors_task(uint64 data, void* pData_ptr)
- {
- const uint thread_index = static_cast<uint>(data);
-
- optimize_selectors_params& task_params = *static_cast<optimize_selectors_params*>(pData_ptr);
-
- crnlib::vector<uint> block_categories[2];
- block_categories[0].reserve(2048);
- block_categories[1].reserve(2048);
-
- for (uint cluster_index = 0; cluster_index < task_params.m_selector_cluster_indices.size(); cluster_index++)
- {
- if (m_canceled)
- return;
-
- if ((cluster_index & 255) == 0)
- {
- if (crn_get_current_thread_id() == m_main_thread_id)
- {
- if (!update_progress(cluster_index, task_params.m_selector_cluster_indices.size() - 1))
- return;
- }
- }
-
- if (m_pTask_pool->get_num_threads())
- {
- if ((cluster_index % (m_pTask_pool->get_num_threads() + 1)) != thread_index)
- continue;
- }
-
- const crnlib::vector<uint>& selector_indices = task_params.m_selector_cluster_indices[cluster_index];
-
- if (selector_indices.size() <= 1)
- continue;
-
- block_categories[0].resize(0);
- block_categories[1].resize(0);
-
- for (uint block_iter = 0; block_iter < selector_indices.size(); block_iter++)
- {
- const uint block_index = selector_indices[block_iter];
-
- const dxt1_block& src_block = get_block(block_index);
-
- if (!src_block.is_alpha_block())
- block_categories[0].push_back(block_index);
- else
- {
- bool has_alpha_pixels = false;
-
- if (m_params.m_dxt1a_alpha_threshold > 0)
- {
- const color_quad_u8* pSrc_pixels = (const color_quad_u8*)m_pBlocks[block_index].m_pixels;
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- const color_quad_u8& src = pSrc_pixels[i];
- if (src.a < m_params.m_dxt1a_alpha_threshold)
- {
- has_alpha_pixels = true;
- break;
- }
- }
- }
-
- if (has_alpha_pixels)
- continue;
-
- block_categories[1].push_back(block_index);
- }
- }
-
- dxt1_block blk;
- utils::zero_object(blk);
-
- for (uint block_type = 0; block_type <= 1; block_type++)
- {
- const crnlib::vector<uint>& block_indices = block_categories[block_type];
- if (block_indices.size() <= 1)
- continue;
-
- for (uint y = 0; y < 4; y++)
- {
- for (uint x = 0; x < 4; x++)
- {
- uint best_s = 0;
- uint64 best_error = 0xFFFFFFFFFFULL;
-
- uint max_s = 4;
- if (block_type == 1)
- max_s = 3;
-
- for (uint s = 0; s < max_s; s++)
- {
- uint64 total_error = 0;
-
- for (uint block_iter = 0; block_iter < block_indices.size(); block_iter++)
- {
- const uint block_index = block_indices[block_iter];
-
- const color_quad_u8& orig_color = m_pBlocks[block_index].m_pixels[y][x];
-
- const dxt1_block& dst_block = get_block(block_index);
-
- color_quad_u8 colors[4];
- dxt1_block::get_block_colors(colors, static_cast<uint16>(dst_block.get_low_color()), static_cast<uint16>(dst_block.get_high_color()));
-
- uint error = color::color_distance(m_params.m_perceptual, orig_color, colors[s], false);
-
- total_error += error;
- }
-
- if (total_error < best_error)
- {
- best_error = total_error;
- best_s = s;
- }
- }
-
- blk.set_selector(x, y, best_s);
-
- } // x
- } // y
-
- for (uint block_iter = 0; block_iter < block_indices.size(); block_iter++)
- {
- const uint block_index = block_indices[block_iter];
-
- dxt1_block& dst_block = get_block(block_index);
-
- memcpy(dst_block.m_selectors, blk.m_selectors, sizeof(dst_block.m_selectors));
- }
- }
-
- } // cluster_index
- }
-
- bool qdxt1::generate_codebook_progress_callback(uint percentage_completed, void* pData)
- {
- return static_cast<qdxt1*>(pData)->update_progress(percentage_completed, 100U);
- }
-
- bool qdxt1::create_selector_clusters(uint max_selector_clusters, crnlib::vector< crnlib::vector<uint> >& selector_cluster_indices)
- {
- m_progress_start = m_progress_range;
- m_progress_range = 33;
-
- weighted_selector_vec_array selector_vecs(m_num_blocks);
-
- for (uint block_iter = 0; block_iter < m_num_blocks; block_iter++)
- {
- dxt1_block& dxt1_block = get_block(block_iter);
-
- vec16F sv;
- float* pDst = &sv[0];
-
- for (uint y = 0; y < 4; y++)
- for (uint x = 0; x < 4; x++)
- *pDst++ = g_dxt1_to_linear[dxt1_block.get_selector(x, y)];
-
- const color_quad_u8 first_color(dxt1_block::unpack_color((uint16)dxt1_block.get_low_color(), true));
- const color_quad_u8 second_color(dxt1_block::unpack_color((uint16)dxt1_block.get_high_color(), true));
- const uint dist = color::color_distance(m_params.m_perceptual, first_color, second_color, false);
-
- const uint cColorDistToWeight = 2000;
- const uint cMaxWeight = 2048;
- uint weight = math::clamp<uint>(dist / cColorDistToWeight, 1, cMaxWeight);
-
- selector_vecs[block_iter].m_vec = sv;
- selector_vecs[block_iter].m_weight = weight;
- }
-
- return m_selector_clusterizer.create_clusters(
- selector_vecs, max_selector_clusters, selector_cluster_indices, generate_codebook_progress_callback, this);
- }
-
- bool qdxt1::pack(dxt1_block* pDst_elements, uint elements_per_block, const qdxt1_params& params, float quality_power_mul)
- {
- CRNLIB_ASSERT(m_num_blocks);
-
- m_main_thread_id = crn_get_current_thread_id();
- m_canceled = false;
-
- m_pDst_elements = pDst_elements;
- m_elements_per_block = elements_per_block;
- m_params = params;
- if (!m_params.m_use_alpha_blocks)
- m_params.m_dxt1a_alpha_threshold = 0;
-
- m_prev_percentage_complete = -1;
-
- CRNLIB_ASSERT(m_params.m_quality_level <= qdxt1_params::cMaxQuality);
- const float quality = m_params.m_quality_level / (float)qdxt1_params::cMaxQuality;
- const float endpoint_quality = powf(quality, 1.8f * quality_power_mul);
- const float selector_quality = powf(quality, 1.65f * quality_power_mul);
-
- //const uint max_endpoint_clusters = math::clamp<uint>(static_cast<uint>(m_endpoint_clusterizer.get_codebook_size() * endpoint_quality), 128U, m_endpoint_clusterizer.get_codebook_size());
- //const uint max_selector_clusters = math::clamp<uint>(static_cast<uint>(m_max_selector_clusters * selector_quality), 150U, m_max_selector_clusters);
- const uint max_endpoint_clusters = math::clamp<uint>(static_cast<uint>(m_endpoint_clusterizer.get_codebook_size() * endpoint_quality), 96U, m_endpoint_clusterizer.get_codebook_size());
- const uint max_selector_clusters = math::clamp<uint>(static_cast<uint>(m_max_selector_clusters * selector_quality), 128U, m_max_selector_clusters);
-
- if (quality >= 1.0f)
- {
- m_endpoint_cluster_indices.resize(m_num_blocks);
- for (uint i = 0; i < m_num_blocks; i++)
- {
- m_endpoint_cluster_indices[i].resize(1);
- m_endpoint_cluster_indices[i][0] = i;
- }
- }
- else
- m_endpoint_clusterizer.retrieve_clusters(max_endpoint_clusters, m_endpoint_cluster_indices);
-
-// trace("endpoint clusters: %u\n", m_endpoint_cluster_indices.size());
-
- uint total_blocks = 0;
- uint max_blocks = 0;
- for (uint i = 0; i < m_endpoint_cluster_indices.size(); i++)
- {
- uint num = m_endpoint_cluster_indices[i].size();
- total_blocks += num;
- max_blocks = math::maximum(max_blocks, num);
- }
-#if 0
- trace("Num clusters: %u, Average blocks per cluster: %u, Max blocks per cluster: %u\n",
- m_endpoint_cluster_indices.size(),
- total_blocks / m_endpoint_cluster_indices.size(),
- max_blocks);
-#endif
-
- crnlib::vector< crnlib::vector<uint> >& selector_cluster_indices = m_cached_selector_cluster_indices[params.m_quality_level];
-
- m_progress_start = 0;
- if (quality >= 1.0f)
- m_progress_range = 100;
- else if (selector_cluster_indices.empty())
- m_progress_range = (m_params.m_dxt_quality == cCRNDXTQualitySuperFast) ? 10 : 33;
- else
- m_progress_range = (m_params.m_dxt_quality == cCRNDXTQualitySuperFast) ? 10 : 50;
-
- for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
- m_pTask_pool->queue_object_task(this, &qdxt1::pack_endpoints_task, i);
- m_pTask_pool->join();
-
- if (m_canceled)
- return false;
-
- if (quality >= 1.0f)
- return true;
-
- if (selector_cluster_indices.empty())
- {
- create_selector_clusters(max_selector_clusters, selector_cluster_indices);
-
- if (m_canceled)
- {
- selector_cluster_indices.clear();
-
- return false;
- }
- }
-
- m_progress_start += m_progress_range;
- m_progress_range = 100 - m_progress_start;
-
- optimize_selectors_params optimize_selectors_task_params(selector_cluster_indices);
-
- for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
- m_pTask_pool->queue_object_task(this, &qdxt1::optimize_selectors_task, i, &optimize_selectors_task_params);
-
- m_pTask_pool->join();
-
- return !m_canceled;
- }
-
-} // namespace crnlib
-
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_qdxt1.h b/Libraries/crunch-ea9b8d/crnlib/crn_qdxt1.h
deleted file mode 100644
index 3051798a..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_qdxt1.h
+++ /dev/null
@@ -1,185 +0,0 @@
-// File: crn_qdxt1.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_dxt.h"
-#include "crn_hash_map.h"
-#include "crn_clusterizer.h"
-#include "crn_hash.h"
-#include "crn_threaded_clusterizer.h"
-#include "crn_dxt_image.h"
-
-namespace crnlib
-{
- struct qdxt1_params
- {
- qdxt1_params()
- {
- clear();
- }
-
- void clear()
- {
- m_quality_level = cMaxQuality;
- m_dxt_quality = cCRNDXTQualityUber;
- m_perceptual = true;
- m_dxt1a_alpha_threshold = 0;
- m_use_alpha_blocks = true;
- m_pProgress_func = NULL;
- m_pProgress_data = NULL;
- m_num_mips = 0;
- m_hierarchical = true;
- utils::zero_object(m_mip_desc);
- m_progress_start = 0;
- m_progress_range = 100;
- }
-
- void init(const dxt_image::pack_params &pp, int quality_level, bool hierarchical)
- {
- m_dxt_quality = pp.m_quality;
- m_hierarchical = hierarchical;
- m_perceptual = pp.m_perceptual;
- m_use_alpha_blocks = pp.m_use_both_block_types;
- m_quality_level = quality_level;
- m_dxt1a_alpha_threshold = pp.m_dxt1a_alpha_threshold;
- }
-
- enum { cMaxQuality = cCRNMaxQualityLevel };
- uint m_quality_level;
-
- uint m_dxt1a_alpha_threshold;
- crn_dxt_quality m_dxt_quality;
- bool m_perceptual;
- bool m_use_alpha_blocks;
- bool m_hierarchical;
-
- struct mip_desc
- {
- uint m_first_block;
- uint m_block_width;
- uint m_block_height;
- };
-
- uint m_num_mips;
- enum { cMaxMips = 128 };
- mip_desc m_mip_desc[cMaxMips];
-
- typedef bool (*progress_callback_func)(uint percentage_completed, void* pProgress_data);
- progress_callback_func m_pProgress_func;
- void* m_pProgress_data;
- uint m_progress_start;
- uint m_progress_range;
- };
-
- class qdxt1
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(qdxt1);
-
- public:
- qdxt1(task_pool& task_pool);
- ~qdxt1();
-
- void clear();
-
- bool init(uint n, const dxt_pixel_block* pBlocks, const qdxt1_params& params);
-
- uint get_num_blocks() const { return m_num_blocks; }
- const dxt_pixel_block* get_blocks() const { return m_pBlocks; }
-
- bool pack(dxt1_block* pDst_elements, uint elements_per_block, const qdxt1_params& params, float quality_power_mul);
-
- private:
- task_pool* m_pTask_pool;
- crn_thread_id_t m_main_thread_id;
- bool m_canceled;
-
- uint m_progress_start;
- uint m_progress_range;
-
- uint m_num_blocks;
- const dxt_pixel_block* m_pBlocks;
-
- dxt1_block* m_pDst_elements;
- uint m_elements_per_block;
- qdxt1_params m_params;
-
- uint m_max_selector_clusters;
-
- int m_prev_percentage_complete;
-
- typedef vec<6, float> vec6F;
- typedef clusterizer<vec6F> vec6F_clusterizer;
- vec6F_clusterizer m_endpoint_clusterizer;
-
- crnlib::vector< crnlib::vector<uint> > m_endpoint_cluster_indices;
-
- typedef vec<16, float> vec16F;
- typedef threaded_clusterizer<vec16F> vec16F_clusterizer;
-
- typedef vec16F_clusterizer::weighted_vec weighted_selector_vec;
- typedef vec16F_clusterizer::weighted_vec_array weighted_selector_vec_array;
-
- vec16F_clusterizer m_selector_clusterizer;
-
- crnlib::vector< crnlib::vector<uint> > m_cached_selector_cluster_indices[qdxt1_params::cMaxQuality + 1];
-
- struct cluster_id
- {
- cluster_id() : m_hash(0)
- {
-
- }
-
- cluster_id(const crnlib::vector<uint>& indices)
- {
- set(indices);
- }
-
- void set(const crnlib::vector<uint>& indices)
- {
- m_cells.resize(indices.size());
-
- for (uint i = 0; i < indices.size(); i++)
- m_cells[i] = static_cast<uint32>(indices[i]);
-
- std::sort(m_cells.begin(), m_cells.end());
-
- m_hash = fast_hash(&m_cells[0], sizeof(m_cells[0]) * m_cells.size());
- }
-
- bool operator< (const cluster_id& rhs) const
- {
- return m_cells < rhs.m_cells;
- }
-
- bool operator== (const cluster_id& rhs) const
- {
- if (m_hash != rhs.m_hash)
- return false;
-
- return m_cells == rhs.m_cells;
- }
-
- crnlib::vector<uint32> m_cells;
-
- size_t m_hash;
-
- operator size_t() const { return m_hash; }
- };
-
- typedef crnlib::hash_map<cluster_id, uint> cluster_hash;
- cluster_hash m_cluster_hash;
- spinlock m_cluster_hash_lock;
-
- static bool generate_codebook_dummy_progress_callback(uint percentage_completed, void* pData);
- static bool generate_codebook_progress_callback(uint percentage_completed, void* pData);
- bool update_progress(uint value, uint max_value);
- void pack_endpoints_task(uint64 data, void* pData_ptr);
- void optimize_selectors_task(uint64 data, void* pData_ptr);
- bool create_selector_clusters(uint max_selector_clusters, crnlib::vector< crnlib::vector<uint> >& selector_cluster_indices);
-
- inline dxt1_block& get_block(uint index) const { return m_pDst_elements[index * m_elements_per_block]; }
- };
-
- CRNLIB_DEFINE_BITWISE_MOVABLE(qdxt1::cluster_id);
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_qdxt5.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_qdxt5.cpp
deleted file mode 100644
index 4e3136d6..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_qdxt5.cpp
+++ /dev/null
@@ -1,827 +0,0 @@
-// File: crn_qdxt5.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_qdxt5.h"
-#include "crn_dxt5a.h"
-#include "crn_image.h"
-#include "crn_image_utils.h"
-#include "crn_dxt_fast.h"
-#include "crn_dxt_hc_common.h"
-
-#define QDXT5_DEBUGGING 0
-
-namespace crnlib
-{
- qdxt5::qdxt5(task_pool& task_pool) :
- m_pTask_pool(&task_pool),
- m_main_thread_id(0),
- m_canceled(false),
- m_progress_start(0),
- m_progress_range(100),
- m_num_blocks(0),
- m_pBlocks(NULL),
- m_pDst_elements(NULL),
- m_elements_per_block(0),
- m_max_selector_clusters(0),
- m_prev_percentage_complete(-1),
- m_selector_clusterizer(task_pool)
- {
- }
-
- qdxt5::~qdxt5()
- {
- }
-
- void qdxt5::clear()
- {
- m_main_thread_id = 0;
- m_num_blocks = 0;
- m_pBlocks = 0;
- m_pDst_elements = NULL;
- m_elements_per_block = 0;
- m_params.clear();
- m_endpoint_clusterizer.clear();
- m_endpoint_cluster_indices.clear();
- m_max_selector_clusters = 0;
- m_canceled = false;
- m_progress_start = 0;
- m_progress_range = 100;
- m_selector_clusterizer.clear();
-
- for (uint i = 0; i <= qdxt5_params::cMaxQuality; i++)
- m_cached_selector_cluster_indices[i].clear();
-
- m_cluster_hash.clear();
-
- m_prev_percentage_complete = -1;
- }
-
- bool qdxt5::init(uint n, const dxt_pixel_block* pBlocks, const qdxt5_params& params)
- {
- clear();
-
- CRNLIB_ASSERT(n && pBlocks);
-
- m_main_thread_id = crn_get_current_thread_id();
-
- m_num_blocks = n;
- m_pBlocks = pBlocks;
- m_params = params;
-
- m_endpoint_clusterizer.reserve_training_vecs(m_num_blocks);
-
- m_progress_start = 0;
- m_progress_range = 75;
-
- image_u8 debug_img;
-
- const bool debugging = true;
-
- if ((m_params.m_hierarchical) && (m_params.m_num_mips))
- {
- vec2F_clusterizer::training_vec_array& training_vecs = m_endpoint_clusterizer.get_training_vecs();
- training_vecs.resize(m_num_blocks);
-
- uint encoding_hist[cNumChunkEncodings];
- utils::zero_object(encoding_hist);
-
- uint total_processed_blocks = 0;
- uint next_progress_threshold = 512;
-
- for (uint level = 0; level < m_params.m_num_mips; level++)
- {
- const qdxt5_params::mip_desc& level_desc = m_params.m_mip_desc[level];
-
- const uint num_chunks_x = (level_desc.m_block_width + cChunkBlockWidth - 1) / cChunkBlockWidth;
- const uint num_chunks_y = (level_desc.m_block_height + cChunkBlockHeight - 1) / cChunkBlockHeight;
-
- const uint level_width = level_desc.m_block_width * 4;
- const uint level_height = level_desc.m_block_height * 4;
-
- if (debugging)
- debug_img.resize(num_chunks_x * cChunkPixelWidth, num_chunks_y * cChunkPixelHeight);
-
- for (uint chunk_y = 0; chunk_y < num_chunks_y; chunk_y++)
- {
- for (uint chunk_x = 0; chunk_x < num_chunks_x; chunk_x++)
- {
- color_quad_u8 chunk_pixels[cChunkPixelWidth * cChunkPixelHeight];
-
- for (uint y = 0; y < cChunkPixelHeight; y++)
- {
- const uint pix_y = math::minimum<uint>(chunk_y * cChunkPixelHeight + y, level_height - 1);
-
- const uint outer_block_index = level_desc.m_first_block + ((pix_y >> 2) * level_desc.m_block_width);
-
- for (uint x = 0; x < cChunkPixelWidth; x++)
- {
- const uint pix_x = math::minimum<uint>(chunk_x * cChunkPixelWidth + x, level_width - 1);
-
- const uint block_index = outer_block_index + (pix_x >> 2);
-
- const dxt_pixel_block& block = m_pBlocks[block_index];
-
- const color_quad_u8& p = block.m_pixels[pix_y & 3][pix_x & 3];
-
- chunk_pixels[x + y * 8] = p;
- }
- }
-
- struct layout_results
- {
- uint m_low_color;
- uint m_high_color;
- uint8 m_selectors[cChunkPixelWidth * cChunkPixelHeight];
- uint64 m_error;
- //float m_penalty;
- };
- layout_results layouts[cNumChunkTileLayouts];
-
- for (uint l = 0; l < cNumChunkTileLayouts; l++)
- {
- const uint width = g_chunk_tile_layouts[l].m_width;
- const uint height = g_chunk_tile_layouts[l].m_height;
- const uint x_ofs = g_chunk_tile_layouts[l].m_x_ofs;
- const uint y_ofs = g_chunk_tile_layouts[l].m_y_ofs;
-
- color_quad_u8 layout_pixels[cChunkPixelWidth * cChunkPixelHeight];
- for (uint y = 0; y < height; y++)
- for (uint x = 0; x < width; x++)
- layout_pixels[x + y * width] = chunk_pixels[(x_ofs + x) + (y_ofs + y) * cChunkPixelWidth];
-
- const uint n = width * height;
- dxt_fast::compress_alpha_block(n, layout_pixels, layouts[l].m_low_color, layouts[l].m_high_color, layouts[l].m_selectors, m_params.m_comp_index);
-
- uint c[dxt5_block::cMaxSelectorValues];
- dxt5_block::get_block_values(c, layouts[l].m_low_color, layouts[l].m_high_color);
-
- uint64 error = 0;
- for (uint i = 0; i < n; i++)
- error += math::square((int)layout_pixels[i][m_params.m_comp_index] - (int)c[layouts[l].m_selectors[i]]);
-
- layouts[l].m_error = error;
- }
-
- double best_peak_snr = -1.0f;
- uint best_encoding = 0;
-
- for (uint e = 0; e < cNumChunkEncodings; e++)
- {
- const chunk_encoding_desc& encoding_desc = g_chunk_encodings[e];
-
- double total_error = 0;
-
- for (uint t = 0; t < encoding_desc.m_num_tiles; t++)
- total_error += (double)layouts[encoding_desc.m_tiles[t].m_layout_index].m_error;
-
- double mean_squared = total_error * (1.0f / 64.0f);
- double root_mean_squared = sqrt(mean_squared);
-
- double peak_snr = 999999.0f;
- if (mean_squared)
- peak_snr = math::clamp<double>(log10(255.0f / root_mean_squared) * 20.0f, 0.0f, 500.0f);
-
- float adaptive_tile_alpha_psnr_derating = 2.4f;
- //if (level)
- // adaptive_tile_alpha_psnr_derating = math::lerp(adaptive_tile_alpha_psnr_derating * .5f, .3f, math::maximum((level - 1) / float(m_params.m_num_mips - 2), 1.0f));
- if ((level) && (adaptive_tile_alpha_psnr_derating > .25f))
- {
- adaptive_tile_alpha_psnr_derating = math::maximum(.25f, adaptive_tile_alpha_psnr_derating / powf(3.0f, static_cast<float>(level)));
- }
-
- float alpha_derating = math::lerp( 0.0f, adaptive_tile_alpha_psnr_derating, (g_chunk_encodings[e].m_num_tiles - 1) / 3.0f );
- peak_snr = peak_snr - alpha_derating;
-
- //for (uint t = 0; t < encoding_desc.m_num_tiles; t++)
- // peak_snr -= (double)layouts[encoding_desc.m_tiles[t].m_layout_index].m_penalty;
-
- if (peak_snr > best_peak_snr)
- {
- best_peak_snr = peak_snr;
- best_encoding = e;
- }
- }
-
- encoding_hist[best_encoding]++;
-
- const chunk_encoding_desc& encoding_desc = g_chunk_encodings[best_encoding];
-
- for (uint t = 0; t < encoding_desc.m_num_tiles; t++)
- {
- const chunk_tile_desc& tile_desc = encoding_desc.m_tiles[t];
-
- uint layout_index = tile_desc.m_layout_index;
- const layout_results& layout = layouts[layout_index];
-
- uint c[dxt5_block::cMaxSelectorValues];
- if (debugging)
- dxt5_block::get_block_values(c, layout.m_low_color, layout.m_high_color);
-
- color_quad_u8 tile_pixels[cChunkPixelWidth * cChunkPixelHeight];
-
- for (uint y = 0; y < tile_desc.m_height; y++)
- {
- const uint pix_y = y + tile_desc.m_y_ofs;
-
- for (uint x = 0; x < tile_desc.m_width; x++)
- {
- const uint pix_x = x + tile_desc.m_x_ofs;
-
- uint a = chunk_pixels[pix_x + pix_y * cChunkPixelWidth][m_params.m_comp_index];
-
- tile_pixels[x + y * tile_desc.m_width].set(a, a, a, 255);
-
- if (debugging)
- debug_img(chunk_x * 8 + pix_x, chunk_y * 8 + pix_y) = c[layout.m_selectors[x + y * tile_desc.m_width]];
- }
- }
-
- color_quad_u8 l, h;
- dxt_fast::find_representative_colors(tile_desc.m_width * tile_desc.m_height, tile_pixels, l, h);
-
- const uint dist = math::square<int>((int)l[0] - (int)h[0]);
-
- const int cAlphaErrorToWeight = 8;
- const uint cMaxWeight = 8;
- uint weight = math::clamp<uint>(dist / cAlphaErrorToWeight, 1, cMaxWeight);
-
- vec2F ev;
-
- ev[0] = l[0];
- ev[1] = h[0];
-
- for (uint y = 0; y < (tile_desc.m_height >> 2); y++)
- {
- uint block_y = chunk_y * cChunkBlockHeight + y + (tile_desc.m_y_ofs >> 2);
- if (block_y >= level_desc.m_block_height)
- continue;
-
- for (uint x = 0; x < (tile_desc.m_width >> 2); x++)
- {
- uint block_x = chunk_x * cChunkBlockWidth + x + (tile_desc.m_x_ofs >> 2);
- if (block_x >= level_desc.m_block_width)
- break;
-
- uint block_index = level_desc.m_first_block + block_x + block_y * level_desc.m_block_width;
-
- training_vecs[block_index].first = ev;
- training_vecs[block_index].second = weight;
-
- total_processed_blocks++;
-
- } // x
- } // y
- } //t
-
- if (total_processed_blocks >= next_progress_threshold)
- {
- next_progress_threshold += 512;
-
- if (!update_progress(total_processed_blocks, m_num_blocks - 1))
- return false;
- }
-
- } // chunk_x
- } // chunk_y
-
-#if QDXT5_DEBUGGING
- if (debugging)
- image_utils::write_to_file(dynamic_wstring(cVarArg, "debug_%u.tga", level).get_ptr(), debug_img, image_utils::cWriteFlagIgnoreAlpha);
-#endif
-
- } // level
-
-#if 0
- trace("chunk encoding hist: ");
- for (uint i = 0; i < cNumChunkEncodings; i++)
- trace("%u ", encoding_hist[i]);
- trace("\n");
-#endif
- }
- else
- {
- for (uint block_index = 0; block_index < m_num_blocks; block_index++)
- {
- if ((block_index & 511) == 0)
- {
- if (!update_progress(block_index, m_num_blocks - 1))
- return false;
- }
-
- color_quad_u8 c[16];
- for (uint y = 0; y < cDXTBlockSize; y++)
- for (uint x = 0; x < cDXTBlockSize; x++)
- c[x+y*cDXTBlockSize].set(m_pBlocks[block_index].m_pixels[y][x][m_params.m_comp_index], 255);
-
- color_quad_u8 l, h;
- dxt_fast::find_representative_colors(cDXTBlockSize * cDXTBlockSize, c, l, h);
-
- const uint dist = math::square<int>((int)l[0] - (int)h[0]);
-
- const int cAlphaErrorToWeight = 8;
- const uint cMaxWeight = 8;
- uint weight = math::clamp<uint>(dist / cAlphaErrorToWeight, 1, cMaxWeight);
-
- vec2F ev;
-
- ev[0] = l[0];
- ev[1] = h[0];
-
- m_endpoint_clusterizer.add_training_vec(ev, weight);
- }
- }
-
- const uint cMaxEndpointClusters = 65535U;
-
- m_progress_start = 75;
- m_progress_range = 20;
-
- if (!m_endpoint_clusterizer.generate_codebook(cMaxEndpointClusters, generate_codebook_progress_callback, this))
- return false;
-
- crnlib::hash_map<uint64, empty_type> selector_hash;
-
- m_progress_start = 95;
- m_progress_range = 5;
-
- for (uint block_index = 0; block_index < m_num_blocks; block_index++)
- {
- if ((block_index & 511) == 0)
- {
- if (!update_progress(block_index, m_num_blocks - 1))
- return false;
- }
-
- dxt5_block dxt_blk;
- dxt_fast::compress_alpha_block(&dxt_blk, &m_pBlocks[block_index].m_pixels[0][0], m_params.m_comp_index);
-
- uint64 selectors = 0;
- for (uint i = 0; i < dxt5_block::cNumSelectorBytes; i++)
- selectors |= static_cast<uint64>(dxt_blk.m_selectors[i]) << (i * 8U);
-
- selector_hash.insert(selectors);
- }
-
- m_max_selector_clusters = selector_hash.size() + 128;
-
- update_progress(1, 1);
-
- return true;
- }
-
- bool qdxt5::update_progress(uint value, uint max_value)
- {
- if (!m_params.m_pProgress_func)
- return true;
-
- uint percentage = max_value ? (m_progress_start + (value * m_progress_range + (max_value / 2)) / max_value) : 100;
- if ((int)percentage == m_prev_percentage_complete)
- return true;
- m_prev_percentage_complete = percentage;
-
- if (!m_params.m_pProgress_func(m_params.m_progress_start + (percentage * m_params.m_progress_range) / 100U, m_params.m_pProgress_data))
- {
- m_canceled = true;
- return false;
- }
-
- return true;
- }
-
- void qdxt5::pack_endpoints_task(uint64 data, void* pData_ptr)
- {
- pData_ptr;
- const uint thread_index = static_cast<uint>(data);
-
- crnlib::vector<color_quad_u8> cluster_pixels;
- cluster_pixels.reserve(1024);
-
- crnlib::vector<uint8> selectors;
- selectors.reserve(1024);
-
- dxt5_endpoint_optimizer optimizer;
- dxt5_endpoint_optimizer::params p;
- dxt5_endpoint_optimizer::results r;
-
- p.m_quality = m_params.m_dxt_quality;
- p.m_comp_index = m_params.m_comp_index;
- p.m_use_both_block_types = m_params.m_use_both_block_types;
-
- uint cluster_index_progress_mask = math::next_pow2(m_endpoint_cluster_indices.size() / 100);
- cluster_index_progress_mask /= 2;
- cluster_index_progress_mask = math::maximum<uint>(cluster_index_progress_mask, 8);
- cluster_index_progress_mask -= 1;
-
- for (uint cluster_index = 0; cluster_index < m_endpoint_cluster_indices.size(); cluster_index++)
- {
- if (m_canceled)
- return;
-
- if ((cluster_index & cluster_index_progress_mask) == 0)
- {
- if (crn_get_current_thread_id() == m_main_thread_id)
- {
- if (!update_progress(cluster_index, m_endpoint_cluster_indices.size() - 1))
- return;
- }
- }
-
- if (m_pTask_pool->get_num_threads())
- {
- if ((cluster_index % (m_pTask_pool->get_num_threads() + 1)) != thread_index)
- continue;
- }
-
- const crnlib::vector<uint>& cluster_indices = m_endpoint_cluster_indices[cluster_index];
-
- selectors.resize(cluster_indices.size() * cDXTBlockSize * cDXTBlockSize);
-
- cluster_pixels.resize(cluster_indices.size() * cDXTBlockSize * cDXTBlockSize);
-
- color_quad_u8* pDst = &cluster_pixels[0];
-
- for (uint block_iter = 0; block_iter < cluster_indices.size(); block_iter++)
- {
- const uint block_index = cluster_indices[block_iter];
-
- //const color_quad_u8* pSrc_pixels = &m_pBlocks[block_index].m_pixels[0][0];
- const color_quad_u8* pSrc_pixels = (const color_quad_u8*)m_pBlocks[block_index].m_pixels;
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- const color_quad_u8& src = pSrc_pixels[i];
-
- *pDst++ = src;
- }
- }
-
- p.m_block_index = cluster_index;
- p.m_num_pixels = cluster_pixels.size();
- p.m_pPixels = cluster_pixels.begin();
-
- r.m_pSelectors = selectors.begin();
-
- uint low_color;
- uint high_color;
- if (m_params.m_dxt_quality != cCRNDXTQualitySuperFast)
- {
- optimizer.compute(p, r);
- low_color = r.m_first_endpoint;
- high_color = r.m_second_endpoint;
- }
- else
- {
- dxt_fast::compress_alpha_block(cluster_pixels.size(), cluster_pixels.begin(), low_color, high_color, selectors.begin(), m_params.m_comp_index);
- }
-
- const uint8* pSrc_selectors = selectors.begin();
-
- for (uint block_iter = 0; block_iter < cluster_indices.size(); block_iter++)
- {
- const uint block_index = cluster_indices[block_iter];
-
- dxt5_block& dxt_block = get_block(block_index);
-
- dxt_block.set_low_alpha(low_color);
- dxt_block.set_high_alpha(high_color);
-
- for (uint y = 0; y < 4; y++)
- for (uint x = 0; x < 4; x++)
- dxt_block.set_selector(x, y, *pSrc_selectors++);
- }
- }
- }
-
- struct optimize_selectors_params
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(optimize_selectors_params);
-
- optimize_selectors_params(
- crnlib::vector< crnlib::vector<uint> >& selector_cluster_indices) :
- m_selector_cluster_indices(selector_cluster_indices)
- {
- }
-
- crnlib::vector< crnlib::vector<uint> >& m_selector_cluster_indices;
- };
-
- void qdxt5::optimize_selectors_task(uint64 data, void* pData_ptr)
- {
- const uint thread_index = static_cast<uint>(data);
-
- optimize_selectors_params& task_params = *static_cast<optimize_selectors_params*>(pData_ptr);
-
- crnlib::vector<uint> block_categories[2];
- block_categories[0].reserve(2048);
- block_categories[1].reserve(2048);
-
- for (uint cluster_index = 0; cluster_index < task_params.m_selector_cluster_indices.size(); cluster_index++)
- {
- if (m_canceled)
- return;
-
- if ((cluster_index & 255) == 0)
- {
- if (crn_get_current_thread_id() == m_main_thread_id)
- {
- if (!update_progress(cluster_index, task_params.m_selector_cluster_indices.size() - 1))
- return;
- }
- }
-
- if (m_pTask_pool->get_num_threads())
- {
- if ((cluster_index % (m_pTask_pool->get_num_threads() + 1)) != thread_index)
- continue;
- }
-
- const crnlib::vector<uint>& selector_indices = task_params.m_selector_cluster_indices[cluster_index];
-
- if (selector_indices.size() <= 1)
- continue;
-
- block_categories[0].resize(0);
- block_categories[1].resize(0);
-
- for (uint block_iter = 0; block_iter < selector_indices.size(); block_iter++)
- {
- const uint block_index = selector_indices[block_iter];
-
- const dxt5_block& src_block = get_block(block_index);
-
- block_categories[src_block.is_alpha6_block()].push_back(block_index);
- }
-
- dxt5_block blk;
- utils::zero_object(blk);
-
- for (uint block_type = 0; block_type <= 1; block_type++)
- {
- const crnlib::vector<uint>& block_indices = block_categories[block_type];
- if (block_indices.size() <= 1)
- continue;
-
- for (uint y = 0; y < cDXTBlockSize; y++)
- {
- for (uint x = 0; x < cDXTBlockSize; x++)
- {
- uint best_s = 0;
- uint64 best_error = 0xFFFFFFFFFFULL;
-
- for (uint s = 0; s < dxt5_block::cMaxSelectorValues; s++)
- {
- uint64 total_error = 0;
-
- for (uint block_iter = 0; block_iter < block_indices.size(); block_iter++)
- {
- const uint block_index = block_indices[block_iter];
-
- const color_quad_u8& orig_color = m_pBlocks[block_index].m_pixels[y][x];
-
- const dxt5_block& dst_block = get_block(block_index);
-
- uint values[dxt5_block::cMaxSelectorValues];
- dxt5_block::get_block_values(values, dst_block.get_low_alpha(), dst_block.get_high_alpha());
-
- int error = math::square((int)orig_color[m_params.m_comp_index] - (int)values[s]);
-
- total_error += error;
- }
-
- if (total_error < best_error)
- {
- best_error = total_error;
- best_s = s;
- }
- }
-
- blk.set_selector(x, y, best_s);
-
- } // x
- } // y
-
- for (uint block_iter = 0; block_iter < block_indices.size(); block_iter++)
- {
- const uint block_index = block_indices[block_iter];
-
- dxt5_block& dst_block = get_block(block_index);
-
- memcpy(dst_block.m_selectors, blk.m_selectors, sizeof(dst_block.m_selectors));
- }
- }
-
- } // cluster_index
- }
-
- bool qdxt5::generate_codebook_progress_callback(uint percentage_completed, void* pData)
- {
- return static_cast<qdxt5*>(pData)->update_progress(percentage_completed, 100U);
- }
-
- bool qdxt5::create_selector_clusters(uint max_selector_clusters, crnlib::vector< crnlib::vector<uint> >& selector_cluster_indices)
- {
- weighted_selector_vec_array selector_vecs[2];
- crnlib::vector<uint> selector_vec_remap[2];
-
- for (uint block_type = 0; block_type < 2; block_type++)
- {
- for (uint block_iter = 0; block_iter < m_num_blocks; block_iter++)
- {
- dxt5_block& dxt5_block = get_block(block_iter);
- if ((uint)dxt5_block.is_alpha6_block() != block_type)
- continue;
-
- vec16F sv;
- float* pDst = &sv[0];
-
- bool uses_absolute_values = false;
-
- for (uint y = 0; y < 4; y++)
- {
- for (uint x = 0; x < 4; x++)
- {
- const uint s = dxt5_block.get_selector(x, y);
-
- float f;
- if (dxt5_block.is_alpha6_block())
- {
- if (s >= 6)
- {
- uses_absolute_values = true;
- f = 0.0f;
- }
- else
- f = g_dxt5_alpha6_to_linear[s];
- }
- else
- f = g_dxt5_to_linear[s];
-
- *pDst++ = f;
- }
- }
-
- if (uses_absolute_values)
- continue;
-
- int low_alpha = dxt5_block.get_low_alpha();
- int high_alpha = dxt5_block.get_high_alpha();
- int dist = math::square(low_alpha - high_alpha);
-
- const uint cAlphaDistToWeight = 8;
- const uint cMaxWeight = 2048;
- uint weight = math::clamp<uint>(dist / cAlphaDistToWeight, 1, cMaxWeight);
-
- selector_vecs[block_type].resize(selector_vecs[block_type].size() + 1);
- selector_vecs[block_type].back().m_vec = sv;
- selector_vecs[block_type].back().m_weight = weight;
-
- selector_vec_remap[block_type].push_back(block_iter);
- }
- }
-
- selector_cluster_indices.clear();
-
- for (uint block_type = 0; block_type < 2; block_type++)
- {
- if (selector_vecs[block_type].empty())
- continue;
-
- if ((selector_vecs[block_type].size() / (float)m_num_blocks) < .01f)
- continue;
- uint max_clusters = static_cast<uint>((math::emulu(selector_vecs[block_type].size(), max_selector_clusters) + (m_num_blocks - 1)) / m_num_blocks);
- max_clusters = math::minimum(math::maximum(64U, max_clusters), selector_vecs[block_type].size());
- if (max_clusters >= selector_vecs[block_type].size())
- continue;
-
-#if QDXT5_DEBUGGING
- trace("max_clusters (%u): %u\n", block_type, max_clusters);
-#endif
-
- crnlib::vector< crnlib::vector<uint> > block_type_selector_cluster_indices;
-
- if (!block_type)
- {
- m_progress_start = m_progress_range;
- m_progress_range = 16;
- }
- else
- {
- m_progress_start = m_progress_range + 16;
- m_progress_range = 17;
- }
-
- if (!m_selector_clusterizer.create_clusters(
- selector_vecs[block_type], max_clusters, block_type_selector_cluster_indices, generate_codebook_progress_callback, this))
- {
- return false;
- }
-
- const uint first_cluster = selector_cluster_indices.size();
- selector_cluster_indices.enlarge(block_type_selector_cluster_indices.size());
-
- for (uint i = 0; i < block_type_selector_cluster_indices.size(); i++)
- {
- crnlib::vector<uint>& indices = selector_cluster_indices[first_cluster + i];
- indices.swap(block_type_selector_cluster_indices[i]);
-
- for (uint j = 0; j < indices.size(); j++)
- indices.at(j) = selector_vec_remap[block_type][indices.at(j)];
- }
- }
-
- return true;
- }
-
- bool qdxt5::pack(dxt5_block* pDst_elements, uint elements_per_block, const qdxt5_params& params)
- {
- CRNLIB_ASSERT(m_num_blocks);
-
- m_main_thread_id = crn_get_current_thread_id();
- m_canceled = false;
-
- m_pDst_elements = pDst_elements;
- m_elements_per_block = elements_per_block;
- m_params = params;
-
- m_prev_percentage_complete = -1;
-
- CRNLIB_ASSERT(m_params.m_quality_level <= qdxt5_params::cMaxQuality);
- const float quality = m_params.m_quality_level / (float)qdxt5_params::cMaxQuality;
- const float endpoint_quality = powf(quality, 2.1f);
- const float selector_quality = powf(quality, 1.65f);
-
- const uint max_endpoint_clusters = math::clamp<uint>(static_cast<uint>(m_endpoint_clusterizer.get_codebook_size() * endpoint_quality), 16U, m_endpoint_clusterizer.get_codebook_size());
- const uint max_selector_clusters = math::clamp<uint>(static_cast<uint>(m_max_selector_clusters * selector_quality), 32U, m_max_selector_clusters);
-
-#if QDXT5_DEBUGGING
- trace("max endpoint clusters: %u\n", max_endpoint_clusters);
- trace("max selector clusters: %u\n", max_selector_clusters);
-#endif
-
- if (quality >= 1.0f)
- {
- m_endpoint_cluster_indices.resize(m_num_blocks);
- for (uint i = 0; i < m_num_blocks; i++)
- {
- m_endpoint_cluster_indices[i].resize(1);
- m_endpoint_cluster_indices[i][0] = i;
- }
- }
- else
- m_endpoint_clusterizer.retrieve_clusters(max_endpoint_clusters, m_endpoint_cluster_indices);
-
- uint total_blocks = 0;
- uint max_blocks = 0;
- for (uint i = 0; i < m_endpoint_cluster_indices.size(); i++)
- {
- uint num = m_endpoint_cluster_indices[i].size();
- total_blocks += num;
- max_blocks = math::maximum(max_blocks, num);
- }
-
- crnlib::vector< crnlib::vector<uint> >& selector_cluster_indices = m_cached_selector_cluster_indices[params.m_quality_level];
-
- m_progress_start = 0;
- if (quality >= 1.0f)
- m_progress_range = 100;
- else if (selector_cluster_indices.empty())
- m_progress_range = (m_params.m_dxt_quality == cCRNDXTQualitySuperFast) ? 10 : 33;
- else
- m_progress_range = (m_params.m_dxt_quality == cCRNDXTQualitySuperFast) ? 10 : 50;
-
- for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
- m_pTask_pool->queue_object_task(this, &qdxt5::pack_endpoints_task, i);
- m_pTask_pool->join();
-
- if (m_canceled)
- return false;
-
- if (quality >= 1.0f)
- return true;
-
- if (selector_cluster_indices.empty())
- {
- create_selector_clusters(max_selector_clusters, selector_cluster_indices);
-
- if (m_canceled)
- {
- selector_cluster_indices.clear();
-
- return false;
- }
- }
-
- m_progress_start += m_progress_range;
- m_progress_range = 100 - m_progress_start;
-
- optimize_selectors_params optimize_selectors_task_params(selector_cluster_indices);
-
- for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
- m_pTask_pool->queue_object_task(this, &qdxt5::optimize_selectors_task, i, &optimize_selectors_task_params);
-
- m_pTask_pool->join();
-
- return !m_canceled;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_qdxt5.h b/Libraries/crunch-ea9b8d/crnlib/crn_qdxt5.h
deleted file mode 100644
index 355a9d8b..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_qdxt5.h
+++ /dev/null
@@ -1,194 +0,0 @@
-// File: crn_qdxt5.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_hash_map.h"
-#include "crn_clusterizer.h"
-#include "crn_hash.h"
-#include "crn_threaded_clusterizer.h"
-#include "crn_dxt.h"
-#include "crn_dxt_image.h"
-
-namespace crnlib
-{
- struct qdxt5_params
- {
- qdxt5_params()
- {
- clear();
- }
-
- void clear()
- {
- m_quality_level = cMaxQuality;
- m_dxt_quality = cCRNDXTQualityUber;
-
- m_pProgress_func = NULL;
- m_pProgress_data = NULL;
- m_num_mips = 0;
- m_hierarchical = true;
- utils::zero_object(m_mip_desc);
-
- m_comp_index = 3;
- m_progress_start = 0;
- m_progress_range = 100;
-
- m_use_both_block_types = true;
- }
-
- void init(const dxt_image::pack_params &pp, int quality_level, bool hierarchical, int comp_index = 3)
- {
- m_dxt_quality = pp.m_quality;
- m_hierarchical = hierarchical;
- m_comp_index = comp_index;
- m_use_both_block_types = pp.m_use_both_block_types;
- m_quality_level = quality_level;
- }
-
- enum { cMaxQuality = cCRNMaxQualityLevel };
- uint m_quality_level;
- crn_dxt_quality m_dxt_quality;
- bool m_hierarchical;
-
- struct mip_desc
- {
- uint m_first_block;
- uint m_block_width;
- uint m_block_height;
- };
-
- uint m_num_mips;
- enum { cMaxMips = 128 };
- mip_desc m_mip_desc[cMaxMips];
-
- typedef bool (*progress_callback_func)(uint percentage_completed, void* pProgress_data);
- progress_callback_func m_pProgress_func;
- void* m_pProgress_data;
- uint m_progress_start;
- uint m_progress_range;
-
- uint m_comp_index;
-
- bool m_use_both_block_types;
- };
-
- class qdxt5
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(qdxt5);
-
- public:
- qdxt5(task_pool& task_pool);
- ~qdxt5();
-
- void clear();
-
- bool init(uint n, const dxt_pixel_block* pBlocks, const qdxt5_params& params);
-
- uint get_num_blocks() const { return m_num_blocks; }
- const dxt_pixel_block* get_blocks() const { return m_pBlocks; }
-
- bool pack(dxt5_block* pDst_elements, uint elements_per_block, const qdxt5_params& params);
-
- private:
- task_pool* m_pTask_pool;
- crn_thread_id_t m_main_thread_id;
- bool m_canceled;
-
- uint m_progress_start;
- uint m_progress_range;
-
- uint m_num_blocks;
- const dxt_pixel_block* m_pBlocks;
-
- dxt5_block* m_pDst_elements;
- uint m_elements_per_block;
- qdxt5_params m_params;
-
- uint m_max_selector_clusters;
-
- int m_prev_percentage_complete;
-
- typedef vec<2, float> vec2F;
- typedef clusterizer<vec2F> vec2F_clusterizer;
- vec2F_clusterizer m_endpoint_clusterizer;
-
- crnlib::vector< crnlib::vector<uint> > m_endpoint_cluster_indices;
-
- typedef vec<16, float> vec16F;
- typedef threaded_clusterizer<vec16F> vec16F_clusterizer;
-
- typedef vec16F_clusterizer::weighted_vec weighted_selector_vec;
- typedef vec16F_clusterizer::weighted_vec_array weighted_selector_vec_array;
-
- vec16F_clusterizer m_selector_clusterizer;
-
- crnlib::vector< crnlib::vector<uint> > m_cached_selector_cluster_indices[qdxt5_params::cMaxQuality + 1];
-
- struct cluster_id
- {
- cluster_id() : m_hash(0)
- {
-
- }
-
- cluster_id(const crnlib::vector<uint>& indices)
- {
- set(indices);
- }
-
- void set(const crnlib::vector<uint>& indices)
- {
- m_cells.resize(indices.size());
-
- for (uint i = 0; i < indices.size(); i++)
- m_cells[i] = static_cast<uint32>(indices[i]);
-
- std::sort(m_cells.begin(), m_cells.end());
-
- m_hash = fast_hash(&m_cells[0], sizeof(m_cells[0]) * m_cells.size());
- }
-
- bool operator< (const cluster_id& rhs) const
- {
- return m_cells < rhs.m_cells;
- }
-
- bool operator== (const cluster_id& rhs) const
- {
- if (m_hash != rhs.m_hash)
- return false;
-
- return m_cells == rhs.m_cells;
- }
-
- crnlib::vector<uint32> m_cells;
-
- size_t m_hash;
-
- operator size_t() const { return m_hash; }
- };
-
- typedef crnlib::hash_map<cluster_id, uint> cluster_hash;
- cluster_hash m_cluster_hash;
- spinlock m_cluster_hash_lock;
-
- static bool generate_codebook_dummy_progress_callback(uint percentage_completed, void* pData);
- static bool generate_codebook_progress_callback(uint percentage_completed, void* pData);
- bool update_progress(uint value, uint max_value);
- void pack_endpoints_task(uint64 data, void* pData_ptr);
- void optimize_selectors_task(uint64 data, void* pData_ptr);
- bool create_selector_clusters(uint max_selector_clusters, crnlib::vector< crnlib::vector<uint> >& selector_cluster_indices);
-
- inline dxt5_block& get_block(uint index) const { return m_pDst_elements[index * m_elements_per_block]; }
- };
-
-} // namespace crnlib
-
-
-
-
-
-
-
-
-
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_radix_sort.h b/Libraries/crunch-ea9b8d/crnlib/crn_radix_sort.h
deleted file mode 100644
index e71d2429..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_radix_sort.h
+++ /dev/null
@@ -1,345 +0,0 @@
-// File: crn_radix_sort.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- // Returns pointer to sorted array.
- template<typename T>
- T* radix_sort(uint num_vals, T* pBuf0, T* pBuf1, uint key_ofs, uint key_size)
- {
- CRNLIB_ASSERT_OPEN_RANGE(key_ofs, 0, sizeof(T));
- CRNLIB_ASSERT_CLOSED_RANGE(key_size, 1, 4);
-
- uint hist[256 * 4];
-
- memset(hist, 0, sizeof(hist[0]) * 256 * key_size);
-
-#define CRNLIB_GET_KEY(p) (*(uint*)((uint8*)(p) + key_ofs))
-
- if (key_size == 4)
- {
- T* p = pBuf0;
- T* q = pBuf0 + num_vals;
- for ( ; p != q; p++)
- {
- const uint key = CRNLIB_GET_KEY(p);
-
- hist[ key & 0xFF]++;
- hist[256 + ((key >> 8) & 0xFF)]++;
- hist[512 + ((key >> 16) & 0xFF)]++;
- hist[768 + ((key >> 24) & 0xFF)]++;
- }
- }
- else if (key_size == 3)
- {
- T* p = pBuf0;
- T* q = pBuf0 + num_vals;
- for ( ; p != q; p++)
- {
- const uint key = CRNLIB_GET_KEY(p);
-
- hist[ key & 0xFF]++;
- hist[256 + ((key >> 8) & 0xFF)]++;
- hist[512 + ((key >> 16) & 0xFF)]++;
- }
- }
- else if (key_size == 2)
- {
- T* p = pBuf0;
- T* q = pBuf0 + (num_vals >> 1) * 2;
-
- for ( ; p != q; p += 2)
- {
- const uint key0 = CRNLIB_GET_KEY(p);
- const uint key1 = CRNLIB_GET_KEY(p+1);
-
- hist[ key0 & 0xFF]++;
- hist[256 + ((key0 >> 8) & 0xFF)]++;
-
- hist[ key1 & 0xFF]++;
- hist[256 + ((key1 >> 8) & 0xFF)]++;
- }
-
- if (num_vals & 1)
- {
- const uint key = CRNLIB_GET_KEY(p);
-
- hist[ key & 0xFF]++;
- hist[256 + ((key >> 8) & 0xFF)]++;
- }
- }
- else
- {
- CRNLIB_ASSERT(key_size == 1);
- if (key_size != 1)
- return NULL;
-
- T* p = pBuf0;
- T* q = pBuf0 + (num_vals >> 1) * 2;
-
- for ( ; p != q; p += 2)
- {
- const uint key0 = CRNLIB_GET_KEY(p);
- const uint key1 = CRNLIB_GET_KEY(p+1);
-
- hist[key0 & 0xFF]++;
- hist[key1 & 0xFF]++;
- }
-
- if (num_vals & 1)
- {
- const uint key = CRNLIB_GET_KEY(p);
- hist[key & 0xFF]++;
- }
- }
-
- T* pCur = pBuf0;
- T* pNew = pBuf1;
-
- for (uint pass = 0; pass < key_size; pass++)
- {
- const uint* pHist = &hist[pass << 8];
-
- uint offsets[256];
-
- uint cur_ofs = 0;
- for (uint i = 0; i < 256; i += 2)
- {
- offsets[i] = cur_ofs;
- cur_ofs += pHist[i];
-
- offsets[i+1] = cur_ofs;
- cur_ofs += pHist[i+1];
- }
-
- const uint pass_shift = pass << 3;
-
- T* p = pCur;
- T* q = pCur + (num_vals >> 1) * 2;
-
- for ( ; p != q; p += 2)
- {
- uint c0 = (CRNLIB_GET_KEY(p) >> pass_shift) & 0xFF;
- uint c1 = (CRNLIB_GET_KEY(p+1) >> pass_shift) & 0xFF;
-
- if (c0 == c1)
- {
- uint dst_offset0 = offsets[c0];
-
- offsets[c0] = dst_offset0 + 2;
-
- pNew[dst_offset0] = p[0];
- pNew[dst_offset0 + 1] = p[1];
- }
- else
- {
- uint dst_offset0 = offsets[c0]++;
- uint dst_offset1 = offsets[c1]++;
-
- pNew[dst_offset0] = p[0];
- pNew[dst_offset1] = p[1];
- }
- }
-
- if (num_vals & 1)
- {
- uint c = (CRNLIB_GET_KEY(p) >> pass_shift) & 0xFF;
-
- uint dst_offset = offsets[c];
- offsets[c] = dst_offset + 1;
-
- pNew[dst_offset] = *p;
- }
-
- T* t = pCur;
- pCur = pNew;
- pNew = t;
- }
-
- return pCur;
- }
-
-#undef CRNLIB_GET_KEY
-
- // Returns pointer to sorted array.
- template<typename T, typename Q>
- T* indirect_radix_sort(uint num_indices, T* pIndices0, T* pIndices1, const Q* pKeys, uint key_ofs, uint key_size, bool init_indices)
- {
- CRNLIB_ASSERT_OPEN_RANGE(key_ofs, 0, sizeof(T));
- CRNLIB_ASSERT_CLOSED_RANGE(key_size, 1, 4);
-
- if (init_indices)
- {
- T* p = pIndices0;
- T* q = pIndices0 + (num_indices >> 1) * 2;
- uint i;
- for (i = 0; p != q; p += 2, i += 2)
- {
- p[0] = static_cast<T>(i);
- p[1] = static_cast<T>(i + 1);
- }
-
- if (num_indices & 1)
- *p = static_cast<T>(i);
- }
-
- uint hist[256 * 4];
-
- memset(hist, 0, sizeof(hist[0]) * 256 * key_size);
-
-#define CRNLIB_GET_KEY(p) (*(const uint*)((const uint8*)(pKeys + *(p)) + key_ofs))
-#define CRNLIB_GET_KEY_FROM_INDEX(i) (*(const uint*)((const uint8*)(pKeys + (i)) + key_ofs))
-
- if (key_size == 4)
- {
- T* p = pIndices0;
- T* q = pIndices0 + num_indices;
- for ( ; p != q; p++)
- {
- const uint key = CRNLIB_GET_KEY(p);
-
- hist[ key & 0xFF]++;
- hist[256 + ((key >> 8) & 0xFF)]++;
- hist[512 + ((key >> 16) & 0xFF)]++;
- hist[768 + ((key >> 24) & 0xFF)]++;
- }
- }
- else if (key_size == 3)
- {
- T* p = pIndices0;
- T* q = pIndices0 + num_indices;
- for ( ; p != q; p++)
- {
- const uint key = CRNLIB_GET_KEY(p);
-
- hist[ key & 0xFF]++;
- hist[256 + ((key >> 8) & 0xFF)]++;
- hist[512 + ((key >> 16) & 0xFF)]++;
- }
- }
- else if (key_size == 2)
- {
- T* p = pIndices0;
- T* q = pIndices0 + (num_indices >> 1) * 2;
-
- for ( ; p != q; p += 2)
- {
- const uint key0 = CRNLIB_GET_KEY(p);
- const uint key1 = CRNLIB_GET_KEY(p+1);
-
- hist[ key0 & 0xFF]++;
- hist[256 + ((key0 >> 8) & 0xFF)]++;
-
- hist[ key1 & 0xFF]++;
- hist[256 + ((key1 >> 8) & 0xFF)]++;
- }
-
- if (num_indices & 1)
- {
- const uint key = CRNLIB_GET_KEY(p);
-
- hist[ key & 0xFF]++;
- hist[256 + ((key >> 8) & 0xFF)]++;
- }
- }
- else
- {
- CRNLIB_ASSERT(key_size == 1);
- if (key_size != 1)
- return NULL;
-
- T* p = pIndices0;
- T* q = pIndices0 + (num_indices >> 1) * 2;
-
- for ( ; p != q; p += 2)
- {
- const uint key0 = CRNLIB_GET_KEY(p);
- const uint key1 = CRNLIB_GET_KEY(p+1);
-
- hist[key0 & 0xFF]++;
- hist[key1 & 0xFF]++;
- }
-
- if (num_indices & 1)
- {
- const uint key = CRNLIB_GET_KEY(p);
-
- hist[key & 0xFF]++;
- }
- }
-
- T* pCur = pIndices0;
- T* pNew = pIndices1;
-
- for (uint pass = 0; pass < key_size; pass++)
- {
- const uint* pHist = &hist[pass << 8];
-
- uint offsets[256];
-
- uint cur_ofs = 0;
- for (uint i = 0; i < 256; i += 2)
- {
- offsets[i] = cur_ofs;
- cur_ofs += pHist[i];
-
- offsets[i+1] = cur_ofs;
- cur_ofs += pHist[i+1];
- }
-
- const uint pass_shift = pass << 3;
-
- T* p = pCur;
- T* q = pCur + (num_indices >> 1) * 2;
-
- for ( ; p != q; p += 2)
- {
- uint index0 = p[0];
- uint index1 = p[1];
-
- uint c0 = (CRNLIB_GET_KEY_FROM_INDEX(index0) >> pass_shift) & 0xFF;
- uint c1 = (CRNLIB_GET_KEY_FROM_INDEX(index1) >> pass_shift) & 0xFF;
-
- if (c0 == c1)
- {
- uint dst_offset0 = offsets[c0];
-
- offsets[c0] = dst_offset0 + 2;
-
- pNew[dst_offset0] = static_cast<T>(index0);
- pNew[dst_offset0 + 1] = static_cast<T>(index1);
- }
- else
- {
- uint dst_offset0 = offsets[c0]++;
- uint dst_offset1 = offsets[c1]++;
-
- pNew[dst_offset0] = static_cast<T>(index0);
- pNew[dst_offset1] = static_cast<T>(index1);
- }
- }
-
- if (num_indices & 1)
- {
- uint index = *p;
- uint c = (CRNLIB_GET_KEY_FROM_INDEX(index) >> pass_shift) & 0xFF;
-
- uint dst_offset = offsets[c];
- offsets[c] = dst_offset + 1;
-
- pNew[dst_offset] = static_cast<T>(index);
- }
-
- T* t = pCur;
- pCur = pNew;
- pNew = t;
- }
-
- return pCur;
- }
-
-#undef CRNLIB_GET_KEY
-#undef CRNLIB_GET_KEY_FROM_INDEX
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_rand.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_rand.cpp
deleted file mode 100644
index 507083f8..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_rand.cpp
+++ /dev/null
@@ -1,385 +0,0 @@
-// File: crn_rand.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-// See:
-// http://www.ciphersbyritter.com/NEWS4/RANDC.HTM
-// http://burtleburtle.net/bob/rand/smallprng.html
-// http://www.cs.ucl.ac.uk/staff/d.jones/GoodPracticeRNG.pdf
-// See GPG7, page 120, or http://www.lomont.org/Math/Papers/2008/Lomont_PRNG_2008.pdf
-#include "crn_core.h"
-#include "crn_rand.h"
-#include "crn_hash.h"
-
-#define znew (z=36969*(z&65535)+(z>>16))
-#define wnew (w=18000*(w&65535)+(w>>16))
-#define MWC ((znew<<16)+wnew )
-#define SHR3 (jsr^=(jsr<<17), jsr^=(jsr>>13), jsr^=(jsr<<5))
-#define CONG (jcong=69069*jcong+1234567)
-#define FIB ((b=a+b),(a=b-a))
-#define KISS ((MWC^CONG)+SHR3)
-#define LFIB4 (c++,t[c]=t[c]+t[UC(c+58)]+t[UC(c+119)]+t[UC(c+178)])
-#define SWB (c++,bro=(x<y),t[c]=(x=t[UC(c+34)])-(y=t[UC(c+19)]+bro))
-#define UNI (KISS*2.328306e-10)
-#define VNI ((long) KISS)*4.656613e-10
-#define UC (unsigned char) /*a cast operation*/
-
-//#define rot(x,k) (((x)<<(k))|((x)>>(32-(k))))
-#define rot(x,k) CRNLIB_ROTATE_LEFT(x,k)
-
-namespace crnlib
-{
- static const double cNorm = 1.0 / (double)0x100000000ULL;
-
- kiss99::kiss99()
- {
- x = 123456789;
- y = 362436000;
- z = 521288629;
- c = 7654321;
- }
-
- void kiss99::seed(uint32 i, uint32 j, uint32 k)
- {
- x = i;
- y = j;
- z = k;
- c = 7654321;
- }
-
- inline uint32 kiss99::next()
- {
- x = 69069*x+12345;
-
- y ^= (y<<13);
- y ^= (y>>17);
- y ^= (y<<5);
-
- uint64 t = c;
- t += (698769069ULL*z);
- c = static_cast<uint32>(t >> 32);
- z = static_cast<uint32>(t);
-
- return (x+y+z);
- }
-
- inline uint32 ranctx::next()
- {
- uint32 e = a - rot(b, 27);
- a = b ^ rot(c, 17);
- b = c + d;
- c = d + e;
- d = e + a;
- return d;
- }
-
- void ranctx::seed(uint32 seed)
- {
- a = 0xf1ea5eed, b = c = d = seed;
- for (uint32 i=0; i<20; ++i)
- next();
- }
-
- well512::well512()
- {
- seed(0xDEADBE3F);
- }
-
- void well512::seed(uint32 seed[well512::cStateSize])
- {
- memcpy(m_state, seed, sizeof(m_state));
- m_index = 0;
- }
-
- void well512::seed(uint32 seed)
- {
- uint32 jsr = utils::swap32(seed) ^ 0xAAC29377;
-
- for (uint i = 0; i < cStateSize; i++)
- {
- SHR3;
- seed = bitmix32c(seed);
-
- m_state[i] = seed ^ jsr;
- }
- m_index = 0;
- }
-
- void well512::seed(uint32 seed1, uint32 seed2, uint32 seed3)
- {
- uint32 jsr = seed2;
- uint32 jcong = seed3;
-
- for (uint i = 0; i < cStateSize; i++)
- {
- SHR3;
- seed1 = bitmix32c(seed1);
- CONG;
-
- m_state[i] = seed1 ^ jsr ^ jcong;
- }
- m_index = 0;
- }
-
- inline uint32 well512::next()
- {
- uint32 a, b, c, d;
- a = m_state[m_index];
- c = m_state[(m_index+13)&15];
- b = a^c^(a<<16)^(c<<15);
- c = m_state[(m_index+9)&15];
- c ^= (c>>11);
- a = m_state[m_index] = b^c;
- d = a^((a<<5)&0xDA442D20UL);
- m_index = (m_index + 15)&15;
- a = m_state[m_index];
- m_state[m_index] = a^b^d^(a<<2)^(b<<18)^(c<<28);
- return m_state[m_index];
- }
-
- random::random()
- {
- seed(12345,65435,34221);
- }
-
- random::random(uint32 i)
- {
- seed(i);
- }
-
- void random::seed(uint32 i1, uint32 i2, uint32 i3)
- {
- m_ranctx.seed(i1^i2^i3);
-
- m_kiss99.seed(i1, i2, i3);
-
- m_well512.seed(i1, i2, i3);
-
- for (uint i = 0; i < 100; i++)
- urand32();
- }
-
- void random::seed(uint32 i)
- {
- uint32 jsr = i;
- SHR3; SHR3;
- uint32 jcong = utils::swap32(~jsr);
- CONG; CONG;
- uint32 i1 = SHR3 ^ CONG;
- uint32 i2 = SHR3 ^ CONG;
- uint32 i3 = SHR3 + CONG;
- seed(i1, i2, i3);
- }
-
- uint32 random::urand32()
- {
- return m_kiss99.next() ^ (m_ranctx.next() + m_well512.next());
- }
-
- uint64 random::urand64()
- {
- uint64 result = urand32();
- result <<= 32ULL;
- result |= urand32();
- return result;
- }
- uint32 random::fast_urand32()
- {
- return m_well512.next();
- }
-
- uint32 random::bit()
- {
- uint32 k = urand32();
- return (k ^ (k >> 6) ^ (k >> 10) ^ (k >> 30)) & 1;
- }
-
- double random::drand(double l, double h)
- {
- CRNLIB_ASSERT(l <= h);
- if (l >= h)
- return l;
-
- return math::clamp(l + (h - l) * (urand32() * cNorm), l, h);
- }
-
- float random::frand(float l, float h)
- {
- CRNLIB_ASSERT(l <= h);
- if (l >= h)
- return l;
-
- float r = static_cast<float>(l + (h - l) * (urand32() * cNorm));
-
- return math::clamp<float>(r, l, h);
- }
-
- int random::irand(int l, int h)
- {
- CRNLIB_ASSERT(l < h);
- if (l >= h)
- return l;
-
- uint32 range = static_cast<uint32>(h - l);
-
- uint32 rnd = urand32();
-
-#if defined(_M_IX86) && defined(_MSC_VER)
- //uint32 rnd_range = static_cast<uint32>(__emulu(range, rnd) >> 32U);
- uint32 x[2];
- *reinterpret_cast<uint64*>(x) = __emulu(range, rnd);
- uint32 rnd_range = x[1];
-#else
- uint32 rnd_range = static_cast<uint32>((((uint64)range) * ((uint64)rnd)) >> 32U);
-#endif
-
- int result = l + rnd_range;
- CRNLIB_ASSERT((result >= l) && (result < h));
- return result;
- }
-
- int random::irand_inclusive(int l, int h)
- {
- CRNLIB_ASSERT(h < cINT32_MAX);
- return irand(l, h + 1);
- }
-
- /*
- ALGORITHM 712, COLLECTED ALGORITHMS FROM ACM.
- THIS WORK PUBLISHED IN TRANSACTIONS ON MATHEMATICAL SOFTWARE,
- VOL. 18, NO. 4, DECEMBER, 1992, PP. 434-435.
- The function returns a normally distributed pseudo-random number
- with a given mean and standard devaiation. Calls are made to a
- function subprogram which must return independent random
- numbers uniform in the interval (0,1).
- The algorithm uses the ratio of uniforms method of A.J. Kinderman
- and J.F. Monahan augmented with quadratic bounding curves.
- */
- double random::gaussian(double mean, double stddev)
- {
- double q,u,v,x,y;
-
- /*
- Generate P = (u,v) uniform in rect. enclosing acceptance region
- Make sure that any random numbers <= 0 are rejected, since
- gaussian() requires uniforms > 0, but RandomUniform() delivers >= 0.
- */
- do {
- u = drand(0, 1);
- v = drand(0, 1);
- if (u <= 0.0 || v <= 0.0) {
- u = 1.0;
- v = 1.0;
- }
- v = 1.7156 * (v - 0.5);
-
- /* Evaluate the quadratic form */
- x = u - 0.449871;
- y = fabs(v) + 0.386595;
- q = x * x + y * (0.19600 * y - 0.25472 * x);
-
- /* Accept P if inside inner ellipse */
- if (q < 0.27597)
- break;
-
- /* Reject P if outside outer ellipse, or outside acceptance region */
- } while ((q > 0.27846) || (v * v > -4.0 * log(u) * u * u));
-
- /* Return ratio of P's coordinates as the normal deviate */
- return (mean + stddev * v / u);
- }
-
- void random::test()
- {
- }
-
- fast_random::fast_random() :
- jsr(0xABCD917A),
- jcong(0x17F3DEAD)
- {
- }
-
- fast_random::fast_random(const fast_random& other) :
- jsr(other.jsr), jcong(other.jcong)
- {
- }
-
- fast_random::fast_random(uint32 i)
- {
- seed(i);
- }
-
- fast_random& fast_random::operator=(const fast_random& other)
- {
- jsr = other.jsr;
- jcong = other.jcong;
- return *this;
- }
-
- void fast_random::seed(uint32 i)
- {
- jsr = i;
- SHR3;
- SHR3;
- jcong = (~i) ^ 0xDEADBEEF;
-
- SHR3;
- CONG;
- }
-
- uint32 fast_random::urand32()
- {
- return SHR3 ^ CONG;
- }
-
- uint64 fast_random::urand64()
- {
- uint64 result = urand32();
- result <<= 32ULL;
- result |= urand32();
- return result;
- }
- int fast_random::irand(int l, int h)
- {
- CRNLIB_ASSERT(l < h);
- if (l >= h)
- return l;
-
- uint32 range = static_cast<uint32>(h - l);
-
- uint32 rnd = urand32();
-
-#if defined(_M_IX86) && defined(_MSC_VER)
- //uint32 rnd_range = static_cast<uint32>(__emulu(range, rnd) >> 32U);
- uint32 x[2];
- *reinterpret_cast<uint64*>(x) = __emulu(range, rnd);
- uint32 rnd_range = x[1];
-#else
- uint32 rnd_range = static_cast<uint32>((((uint64)range) * ((uint64)rnd)) >> 32U);
-#endif
-
- int result = l + rnd_range;
- CRNLIB_ASSERT((result >= l) && (result < h));
- return result;
- }
-
- double fast_random::drand(double l, double h)
- {
- CRNLIB_ASSERT(l <= h);
- if (l >= h)
- return l;
-
- return math::clamp(l + (h - l) * (urand32() * cNorm), l, h);
- }
-
- float fast_random::frand(float l, float h)
- {
- CRNLIB_ASSERT(l <= h);
- if (l >= h)
- return l;
-
- float r = static_cast<float>(l + (h - l) * (urand32() * cNorm));
-
- return math::clamp<float>(r, l, h);
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_rand.h b/Libraries/crunch-ea9b8d/crnlib/crn_rand.h
deleted file mode 100644
index 3179dcea..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_rand.h
+++ /dev/null
@@ -1,119 +0,0 @@
-// File: crn_rand.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- class kiss99
- {
- public:
- kiss99();
-
- void seed(uint32 i, uint32 j, uint32 k);
-
- inline uint32 next();
-
- private:
- uint32 x;
- uint32 y;
- uint32 z;
- uint32 c;
- };
-
- class well512
- {
- public:
- well512();
-
- enum { cStateSize = 16 };
- void seed(uint32 seed[cStateSize]);
- void seed(uint32 seed);
- void seed(uint32 seed1, uint32 seed2, uint32 seed3);
-
- inline uint32 next();
-
- private:
- uint32 m_state[cStateSize];
- uint32 m_index;
- };
-
- class ranctx
- {
- public:
- ranctx() { seed(0xDE149737); }
-
- void seed(uint32 seed);
-
- inline uint32 next();
-
- private:
- uint32 a;
- uint32 b;
- uint32 c;
- uint32 d;
- };
-
- class random
- {
- public:
- random();
- random(uint32 i);
-
- void seed(uint32 i);
- void seed(uint32 i1, uint32 i2, uint32 i3);
-
- uint32 urand32();
- uint64 urand64();
-
- // "Fast" variant uses no multiplies.
- uint32 fast_urand32();
-
- uint32 bit();
-
- // Returns random between [0, 1)
- double drand(double l, double h);
-
- float frand(float l, float h);
-
- // Returns random between [l, h)
- int irand(int l, int h);
-
- // Returns random between [l, h]
- int irand_inclusive(int l, int h);
-
- double gaussian(double mean, double stddev);
-
- void test();
-
- private:
- ranctx m_ranctx;
- kiss99 m_kiss99;
- well512 m_well512;
- };
-
- // Simpler, minimal state PRNG
- class fast_random
- {
- public:
- fast_random();
- fast_random(uint32 i);
- fast_random(const fast_random& other);
- fast_random& operator=(const fast_random& other);
-
- void seed(uint32 i);
-
- uint32 urand32();
- uint64 urand64();
-
- int irand(int l, int h);
-
- double drand(double l, double h);
-
- float frand(float l, float h);
-
- private:
- uint32 jsr;
- uint32 jcong;
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_ray.h b/Libraries/crunch-ea9b8d/crnlib/crn_ray.h
deleted file mode 100644
index b3893a2a..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_ray.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// File: crn_ray.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_vec.h"
-
-namespace crnlib
-{
- template<typename vector_type>
- class ray
- {
- public:
- typedef vector_type vector_t;
- typedef typename vector_type::scalar_type scalar_type;
-
- inline ray() { }
- inline ray(eClear) { clear(); }
- inline ray(const vector_type& origin, const vector_type& direction) : m_origin(origin), m_direction(direction) { }
-
- inline void clear()
- {
- m_origin.clear();
- m_direction.clear();
- }
-
- inline const vector_type& get_origin(void) const { return m_origin; }
- inline void set_origin(const vector_type& origin) { m_origin = origin; }
-
- inline const vector_type& get_direction(void) const { return m_direction; }
- inline void set_direction(const vector_type& direction) { m_direction = direction; }
-
- inline scalar_type set_endpoints(const vector_type& start, const vector_type& end, const vector_type& def)
- {
- m_origin = start;
-
- m_direction = end - start;
- return m_direction.normalize(&def);
- }
-
- inline vector_type eval(scalar_type t) const
- {
- return m_origin + m_direction * t;
- }
-
- private:
- vector_type m_origin;
- vector_type m_direction;
- };
-
- typedef ray<vec2F> ray2F;
- typedef ray<vec3F> ray3F;
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_rect.h b/Libraries/crunch-ea9b8d/crnlib/crn_rect.h
deleted file mode 100644
index 9364c310..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_rect.h
+++ /dev/null
@@ -1,186 +0,0 @@
-// File: crn_rect.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_vec.h"
-#include "crn_hash.h"
-
-namespace crnlib
-{
- class rect
- {
- public:
- inline rect()
- {
- }
-
- inline rect(eClear)
- {
- clear();
- }
-
- // up to, but not including right/bottom
- inline rect(int left, int top, int right, int bottom)
- {
- set(left, top, right, bottom);
- }
-
- inline rect(const vec2I& lo, const vec2I& hi)
- {
- m_corner[0] = lo;
- m_corner[1] = hi;
- }
-
- inline rect(const vec2I& point)
- {
- m_corner[0] = point;
- m_corner[1].set(point[0] + 1, point[1] + 1);
- }
-
- inline bool operator== (const rect& r) const
- {
- return (m_corner[0] == r.m_corner[0]) && (m_corner[1] == r.m_corner[1]);
- }
-
- inline bool operator< (const rect& r) const
- {
- for (uint i = 0; i < 2; i++)
- {
- if (m_corner[i] < r.m_corner[i])
- return true;
- else if (!(m_corner[i] == r.m_corner[i]))
- return false;
- }
-
- return false;
- }
-
- inline void clear()
- {
- m_corner[0].clear();
- m_corner[1].clear();
- }
-
- inline void set(int left, int top, int right, int bottom)
- {
- m_corner[0].set(left, top);
- m_corner[1].set(right, bottom);
- }
-
- inline void set(const vec2I& lo, const vec2I& hi)
- {
- m_corner[0] = lo;
- m_corner[1] = hi;
- }
-
- inline void set(const vec2I& point)
- {
- m_corner[0] = point;
- m_corner[1].set(point[0] + 1, point[1] + 1);
- }
-
- inline uint get_width() const { return m_corner[1][0] - m_corner[0][0]; }
- inline uint get_height() const { return m_corner[1][1] - m_corner[0][1]; }
-
- inline int get_left() const { return m_corner[0][0]; }
- inline int get_top() const { return m_corner[0][1]; }
- inline int get_right() const { return m_corner[1][0]; }
- inline int get_bottom() const { return m_corner[1][1]; }
-
- inline bool is_empty() const { return (m_corner[1][0] <= m_corner[0][0]) || (m_corner[1][1] <= m_corner[0][1]); }
-
- inline uint get_dimension(uint axis) const { return m_corner[1][axis] - m_corner[0][axis]; }
- inline uint get_area() const { return get_dimension(0) * get_dimension(1); }
-
- inline const vec2I& operator[] (uint i) const { CRNLIB_ASSERT(i < 2); return m_corner[i]; }
- inline vec2I& operator[] (uint i) { CRNLIB_ASSERT(i < 2); return m_corner[i]; }
-
- inline rect& translate(int x_ofs, int y_ofs)
- {
- m_corner[0][0] += x_ofs;
- m_corner[0][1] += y_ofs;
- m_corner[1][0] += x_ofs;
- m_corner[1][1] += y_ofs;
- return *this;
- }
-
- inline rect& init_expand()
- {
- m_corner[0].set(INT_MAX);
- m_corner[1].set(INT_MIN);
- return *this;
- }
-
- inline rect& expand(int x, int y)
- {
- m_corner[0][0] = math::minimum(m_corner[0][0], x);
- m_corner[0][1] = math::minimum(m_corner[0][1], y);
- m_corner[1][0] = math::maximum(m_corner[1][0], x + 1);
- m_corner[1][1] = math::maximum(m_corner[1][1], y + 1);
- return *this;
- }
-
- inline rect& expand(const rect& r)
- {
- m_corner[0][0] = math::minimum(m_corner[0][0], r[0][0]);
- m_corner[0][1] = math::minimum(m_corner[0][1], r[0][1]);
- m_corner[1][0] = math::maximum(m_corner[1][0], r[1][0]);
- m_corner[1][1] = math::maximum(m_corner[1][1], r[1][1]);
- return *this;
- }
-
- inline bool touches(const rect& r) const
- {
- for (uint i = 0; i < 2; i++)
- {
- if (r[1][i] <= m_corner[0][i])
- return false;
- else if (r[0][i] >= m_corner[1][i])
- return false;
- }
-
- return true;
- }
-
- inline bool within(const rect& r) const
- {
- for (uint i = 0; i < 2; i++)
- {
- if (m_corner[0][i] < r[0][i])
- return false;
- else if (m_corner[1][i] > r[1][i])
- return false;
- }
-
- return true;
- }
-
- inline bool intersect(const rect& r)
- {
- if (!touches(r))
- {
- clear();
- return false;
- }
-
- for (uint i = 0; i < 2; i++)
- {
- m_corner[0][i] = math::maximum<int>(m_corner[0][i], r[0][i]);
- m_corner[1][i] = math::minimum<int>(m_corner[1][i], r[1][i]);
- }
-
- return true;
- }
-
- inline bool contains(int x, int y) const
- {
- return (x >= m_corner[0][0]) && (x < m_corner[1][0]) &&
- (y >= m_corner[0][1]) && (y < m_corner[1][1]);
- }
-
- inline bool contains(const vec2I& p) const { return contains(p[0], p[1]); }
-
- private:
- vec2I m_corner[2];
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_resample_filters.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_resample_filters.cpp
deleted file mode 100644
index 49862e61..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_resample_filters.cpp
+++ /dev/null
@@ -1,337 +0,0 @@
-// File: crn_resample_filters.cpp
-// RG: This is public domain code, originally derived from Graphics Gems 3, see: http://code.google.com/p/imageresampler/
-#include "crn_core.h"
-#include "crn_resample_filters.h"
-
-namespace crnlib
-{
- #define M_PI 3.14159265358979323846
-
- // To add your own filter, insert the new function below and update the filter table.
- // There is no need to make the filter function particularly fast, because it's
- // only called during initializing to create the X and Y axis contributor tables.
-
-#define BOX_FILTER_SUPPORT (0.5f)
- static float box_filter(float t) /* pulse/Fourier window */
- {
- // make_clist() calls the filter function with t inverted (pos = left, neg = right)
- if ((t >= -0.5f) && (t < 0.5f))
- return 1.0f;
- else
- return 0.0f;
- }
-
-#define TENT_FILTER_SUPPORT (1.0f)
- static float tent_filter(float t) /* box (*) box, bilinear/triangle */
- {
- if (t < 0.0f)
- t = -t;
-
- if (t < 1.0f)
- return 1.0f - t;
- else
- return 0.0f;
- }
-
-#define BELL_SUPPORT (1.5f)
- static float bell_filter(float t) /* box (*) box (*) box */
- {
- if (t < 0.0f)
- t = -t;
-
- if (t < .5f)
- return (.75f - (t * t));
-
- if (t < 1.5f)
- {
- t = (t - 1.5f);
- return (.5f * (t * t));
- }
-
- return (0.0f);
- }
-
-#define B_SPLINE_SUPPORT (2.0f)
- static float B_spline_filter(float t) /* box (*) box (*) box (*) box */
- {
- float tt;
-
- if (t < 0.0f)
- t = -t;
-
- if (t < 1.0f)
- {
- tt = t * t;
- return ((.5f * tt * t) - tt + (2.0f / 3.0f));
- }
- else if (t < 2.0f)
- {
- t = 2.0f - t;
- return ((1.0f / 6.0f) * (t * t * t));
- }
-
- return (0.0f);
- }
-
- // Dodgson, N., "Quadratic Interpolation for Image Resampling"
-#define QUADRATIC_SUPPORT 1.5f
- static float quadratic(float t, const float R)
- {
- if (t < 0.0f)
- t = -t;
- if (t < QUADRATIC_SUPPORT)
- {
- float tt = t * t;
- if (t <= .5f)
- return (-2.0f * R) * tt + .5f * (R + 1.0f);
- else
- return (R * tt) + (-2.0f * R - .5f) * t + (3.0f / 4.0f) * (R + 1.0f);
- }
- else
- return 0.0f;
- }
-
- static float quadratic_interp_filter(float t)
- {
- return quadratic(t, 1.0f);
- }
-
- static float quadratic_approx_filter(float t)
- {
- return quadratic(t, .5f);
- }
-
- static float quadratic_mix_filter(float t)
- {
- return quadratic(t, .8f);
- }
-
- // Mitchell, D. and A. Netravali, "Reconstruction Filters in Computer Graphics."
- // Computer Graphics, Vol. 22, No. 4, pp. 221-228.
- // (B, C)
- // (1/3, 1/3) - Defaults recommended by Mitchell and Netravali
- // (1, 0) - Equivalent to the Cubic B-Spline
- // (0, 0.5) - Equivalent to the Catmull-Rom Spline
- // (0, C) - The family of Cardinal Cubic Splines
- // (B, 0) - Duff's tensioned B-Splines.
- static float mitchell(float t, const float B, const float C)
- {
- float tt;
-
- tt = t * t;
-
- if(t < 0.0f)
- t = -t;
-
- if(t < 1.0f)
- {
- t = (((12.0f - 9.0f * B - 6.0f * C) * (t * tt))
- + ((-18.0f + 12.0f * B + 6.0f * C) * tt)
- + (6.0f - 2.0f * B));
-
- return (t / 6.0f);
- }
- else if (t < 2.0f)
- {
- t = (((-1.0f * B - 6.0f * C) * (t * tt))
- + ((6.0f * B + 30.0f * C) * tt)
- + ((-12.0f * B - 48.0f * C) * t)
- + (8.0f * B + 24.0f * C));
-
- return (t / 6.0f);
- }
-
- return (0.0f);
- }
-
-#define MITCHELL_SUPPORT (2.0f)
- static float mitchell_filter(float t)
- {
- return mitchell(t, 1.0f / 3.0f, 1.0f / 3.0f);
- }
-
-#define CATMULL_ROM_SUPPORT (2.0f)
- static float catmull_rom_filter(float t)
- {
- return mitchell(t, 0.0f, .5f);
- }
-
- static double sinc(double x)
- {
- x = (x * M_PI);
-
- if ((x < 0.01f) && (x > -0.01f))
- return 1.0f + x*x*(-1.0f/6.0f + x*x*1.0f/120.0f);
-
- return sin(x) / x;
- }
-
- static float clean(double t)
- {
- const float EPSILON = .0000125f;
- if (fabs(t) < EPSILON)
- return 0.0f;
- return (float)t;
- }
-
- //static double blackman_window(double x)
- //{
- // return .42f + .50f * cos(M_PI*x) + .08f * cos(2.0f*M_PI*x);
- //}
-
- static double blackman_exact_window(double x)
- {
- return 0.42659071f + 0.49656062f * cos(M_PI*x) + 0.07684867f * cos(2.0f*M_PI*x);
- }
-
-#define BLACKMAN_SUPPORT (3.0f)
- static float blackman_filter(float t)
- {
- if (t < 0.0f)
- t = -t;
-
- if (t < 3.0f)
- //return clean(sinc(t) * blackman_window(t / 3.0f));
- return clean(sinc(t) * blackman_exact_window(t / 3.0f));
- else
- return (0.0f);
- }
-
-#define GAUSSIAN_SUPPORT (1.25f)
- static float gaussian_filter(float t) // with blackman window
- {
- if (t < 0)
- t = -t;
- if (t < GAUSSIAN_SUPPORT)
- return clean(exp(-2.0f * t * t) * sqrt(2.0f / M_PI) * blackman_exact_window(t / GAUSSIAN_SUPPORT));
- else
- return 0.0f;
- }
-
- // Windowed sinc -- see "Jimm Blinn's Corner: Dirty Pixels" pg. 26.
-#define LANCZOS3_SUPPORT (3.0f)
- static float lanczos3_filter(float t)
- {
- if (t < 0.0f)
- t = -t;
-
- if (t < 3.0f)
- return clean(sinc(t) * sinc(t / 3.0f));
- else
- return (0.0f);
- }
-
-#define LANCZOS4_SUPPORT (4.0f)
- static float lanczos4_filter(float t)
- {
- if (t < 0.0f)
- t = -t;
-
- if (t < 4.0f)
- return clean(sinc(t) * sinc(t / 4.0f));
- else
- return (0.0f);
- }
-
-#define LANCZOS6_SUPPORT (6.0f)
- static float lanczos6_filter(float t)
- {
- if (t < 0.0f)
- t = -t;
-
- if (t < 6.0f)
- return clean(sinc(t) * sinc(t / 6.0f));
- else
- return (0.0f);
- }
-
-#define LANCZOS12_SUPPORT (12.0f)
- static float lanczos12_filter(float t)
- {
- if (t < 0.0f)
- t = -t;
-
- if (t < 12.0f)
- return clean(sinc(t) * sinc(t / 12.0f));
- else
- return (0.0f);
- }
-
- static double bessel0(double x)
- {
- const double EPSILON_RATIO = 1E-16;
- double xh, sum, pow, ds;
- int k;
-
- xh = 0.5 * x;
- sum = 1.0;
- pow = 1.0;
- k = 0;
- ds = 1.0;
- while (ds > sum * EPSILON_RATIO) // FIXME: Shouldn't this stop after X iterations for max. safety?
- {
- ++k;
- pow = pow * (xh / k);
- ds = pow * pow;
- sum = sum + ds;
- }
-
- return sum;
- }
-
- static const float KAISER_ALPHA = 4.0;
- static double kaiser(double alpha, double half_width, double x)
- {
- const double ratio = (x / half_width);
- return bessel0(alpha * sqrt(1 - ratio * ratio)) / bessel0(alpha);
- }
-
-#define KAISER_SUPPORT 3
- static float kaiser_filter(float t)
- {
- if (t < 0.0f)
- t = -t;
-
- if (t < KAISER_SUPPORT)
- {
- // db atten
- const float att = 40.0f;
- const float alpha = (float)(exp(log((double)0.58417 * (att - 20.96)) * 0.4) + 0.07886 * (att - 20.96));
- //const float alpha = KAISER_ALPHA;
- return (float)clean(sinc(t) * kaiser(alpha, KAISER_SUPPORT, t));
- }
-
- return 0.0f;
- }
-
- const resample_filter g_resample_filters[] =
- {
- { "box", box_filter, BOX_FILTER_SUPPORT },
- { "tent", tent_filter, TENT_FILTER_SUPPORT },
- { "bell", bell_filter, BELL_SUPPORT },
- { "b-spline", B_spline_filter, B_SPLINE_SUPPORT },
- { "mitchell", mitchell_filter, MITCHELL_SUPPORT },
- { "lanczos3", lanczos3_filter, LANCZOS3_SUPPORT },
- { "blackman", blackman_filter, BLACKMAN_SUPPORT },
- { "lanczos4", lanczos4_filter, LANCZOS4_SUPPORT },
- { "lanczos6", lanczos6_filter, LANCZOS6_SUPPORT },
- { "lanczos12", lanczos12_filter, LANCZOS12_SUPPORT },
- { "kaiser", kaiser_filter, KAISER_SUPPORT },
- { "gaussian", gaussian_filter, GAUSSIAN_SUPPORT },
- { "catmullrom", catmull_rom_filter, CATMULL_ROM_SUPPORT },
- { "quadratic_interp", quadratic_interp_filter, QUADRATIC_SUPPORT },
- { "quadratic_approx", quadratic_approx_filter, QUADRATIC_SUPPORT },
- { "quadratic_mix", quadratic_mix_filter, QUADRATIC_SUPPORT },
- };
-
- const int g_num_resample_filters = sizeof(g_resample_filters) / sizeof(g_resample_filters[0]);
-
- int find_resample_filter(const char* pName)
- {
- for (int i = 0; i < g_num_resample_filters; i++)
- if (_stricmp(pName, g_resample_filters[i].name) == 0)
- return i;
- return cInvalidIndex;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_resample_filters.h b/Libraries/crunch-ea9b8d/crnlib/crn_resample_filters.h
deleted file mode 100644
index 299fea93..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_resample_filters.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// File: crn_resample_filters.h
-// RG: This is public domain code, originally derived from Graphics Gems 3, see: http://code.google.com/p/imageresampler/
-#pragma once
-
-namespace crnlib
-{
- typedef float (*resample_filter_func)(float t);
-
- struct resample_filter
- {
- char name[32];
- resample_filter_func func;
- float support;
- };
-
- extern const resample_filter g_resample_filters[];
- extern const int g_num_resample_filters;
-
- int find_resample_filter(const char* pName);
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_resampler.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_resampler.cpp
deleted file mode 100644
index 4fded5bc..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_resampler.cpp
+++ /dev/null
@@ -1,884 +0,0 @@
-// File: crn_resampler.h
-// RG: This is public domain code, originally derived from Graphics Gems 3, see: http://code.google.com/p/imageresampler/
-#include "crn_core.h"
-#include "crn_resampler.h"
-#include "crn_resample_filters.h"
-
-namespace crnlib
-{
- #define resampler_assert CRNLIB_ASSERT
-
- static inline int resampler_range_check(int v, int h) { h; resampler_assert((v >= 0) && (v < h)); return v; }
-
- #ifndef max
- #define max(a,b) (((a) > (b)) ? (a) : (b))
- #endif
-
- #ifndef min
- #define min(a,b) (((a) < (b)) ? (a) : (b))
- #endif
-
- #ifndef TRUE
- #define TRUE (1)
- #endif
-
- #ifndef FALSE
- #define FALSE (0)
- #endif
-
- #define RESAMPLER_DEBUG 0
-
- // (x mod y) with special handling for negative x values.
- static inline int posmod(int x, int y)
- {
- if (x >= 0)
- return (x % y);
- else
- {
- int m = (-x) % y;
-
- if (m != 0)
- m = y - m;
-
- return (m);
- }
- }
-
- // Float to int cast with truncation.
- static inline int cast_to_int(Resample_Real i)
- {
- return (int)i;
- }
-
- /* Ensure that the contributing source sample is
- * within bounds. If not, reflect, clamp, or wrap.
- */
- int Resampler::reflect(const int j, const int src_x, const Boundary_Op boundary_op)
- {
- int n;
-
- if (j < 0)
- {
- if (boundary_op == BOUNDARY_REFLECT)
- {
- n = -j;
-
- if (n >= src_x)
- n = src_x - 1;
- }
- else if (boundary_op == BOUNDARY_WRAP)
- n = posmod(j, src_x);
- else
- n = 0;
- }
- else if (j >= src_x)
- {
- if (boundary_op == BOUNDARY_REFLECT)
- {
- n = (src_x - j) + (src_x - 1);
-
- if (n < 0)
- n = 0;
- }
- else if (boundary_op == BOUNDARY_WRAP)
- n = posmod(j, src_x);
- else
- n = src_x - 1;
- }
- else
- n = j;
-
- return n;
- }
-
- // The make_clist() method generates, for all destination samples,
- // the list of all source samples with non-zero weighted contributions.
- Resampler::Contrib_List* Resampler::make_clist(
- int src_x, int dst_x, Boundary_Op boundary_op,
- Resample_Real (*Pfilter)(Resample_Real),
- Resample_Real filter_support,
- Resample_Real filter_scale,
- Resample_Real src_ofs)
- {
- typedef struct
- {
- // The center of the range in DISCRETE coordinates (pixel center = 0.0f).
- Resample_Real center;
- int left, right;
- } Contrib_Bounds;
-
- int i, j, k, n, left, right;
- Resample_Real total_weight;
- Resample_Real xscale, center, half_width, weight;
- Contrib_List* Pcontrib;
- Contrib* Pcpool;
- Contrib* Pcpool_next;
- Contrib_Bounds* Pcontrib_bounds;
-
- if ((Pcontrib = (Contrib_List*)crnlib_calloc(dst_x, sizeof(Contrib_List))) == NULL)
- return NULL;
-
- Pcontrib_bounds = (Contrib_Bounds*)crnlib_calloc(dst_x, sizeof(Contrib_Bounds));
- if (!Pcontrib_bounds)
- {
- crnlib_free(Pcontrib);
- return (NULL);
- }
-
- const Resample_Real oo_filter_scale = 1.0f / filter_scale;
-
- const Resample_Real NUDGE = 0.5f;
- xscale = dst_x / (Resample_Real)src_x;
-
- if (xscale < 1.0f)
- {
- int total; (void)total;
-
- /* Handle case when there are fewer destination
- * samples than source samples (downsampling/minification).
- */
-
- // stretched half width of filter
- half_width = (filter_support / xscale) * filter_scale;
-
- // Find the range of source sample(s) that will contribute to each destination sample.
-
- for (i = 0, n = 0; i < dst_x; i++)
- {
- // Convert from discrete to continuous coordinates, scale, then convert back to discrete.
- center = ((Resample_Real)i + NUDGE) / xscale;
- center -= NUDGE;
- center += src_ofs;
-
- left = cast_to_int((Resample_Real)floor(center - half_width));
- right = cast_to_int((Resample_Real)ceil(center + half_width));
-
- Pcontrib_bounds[i].center = center;
- Pcontrib_bounds[i].left = left;
- Pcontrib_bounds[i].right = right;
-
- n += (right - left + 1);
- }
-
- /* Allocate memory for contributors. */
-
- if ((n == 0) || ((Pcpool = (Contrib*)crnlib_calloc(n, sizeof(Contrib))) == NULL))
- {
- crnlib_free(Pcontrib);
- crnlib_free(Pcontrib_bounds);
- return NULL;
- }
- total = n;
-
- Pcpool_next = Pcpool;
-
- /* Create the list of source samples which
- * contribute to each destination sample.
- */
-
- for (i = 0; i < dst_x; i++)
- {
- int max_k = -1;
- Resample_Real max_w = -1e+20f;
-
- center = Pcontrib_bounds[i].center;
- left = Pcontrib_bounds[i].left;
- right = Pcontrib_bounds[i].right;
-
- Pcontrib[i].n = 0;
- Pcontrib[i].p = Pcpool_next;
- Pcpool_next += (right - left + 1);
- resampler_assert ((Pcpool_next - Pcpool) <= total);
-
- total_weight = 0;
-
- for (j = left; j <= right; j++)
- total_weight += (*Pfilter)((center - (Resample_Real)j) * xscale * oo_filter_scale);
- const Resample_Real norm = static_cast<Resample_Real>(1.0f / total_weight);
-
- total_weight = 0;
-
- #if RESAMPLER_DEBUG
- printf("%i: ", i);
- #endif
-
- for (j = left; j <= right; j++)
- {
- weight = (*Pfilter)((center - (Resample_Real)j) * xscale * oo_filter_scale) * norm;
- if (weight == 0.0f)
- continue;
-
- n = reflect(j, src_x, boundary_op);
-
- #if RESAMPLER_DEBUG
- printf("%i(%f), ", n, weight);
- #endif
-
- /* Increment the number of source
- * samples which contribute to the
- * current destination sample.
- */
-
- k = Pcontrib[i].n++;
-
- Pcontrib[i].p[k].pixel = (unsigned short)n; /* store src sample number */
- Pcontrib[i].p[k].weight = weight; /* store src sample weight */
-
- total_weight += weight; /* total weight of all contributors */
-
- if (weight > max_w)
- {
- max_w = weight;
- max_k = k;
- }
- }
-
- #if RESAMPLER_DEBUG
- printf("\n\n");
- #endif
-
- //resampler_assert(Pcontrib[i].n);
- //resampler_assert(max_k != -1);
- if ((max_k == -1) || (Pcontrib[i].n == 0))
- {
- crnlib_free(Pcpool);
- crnlib_free(Pcontrib);
- crnlib_free(Pcontrib_bounds);
- return NULL;
- }
-
- if (total_weight != 1.0f)
- Pcontrib[i].p[max_k].weight += 1.0f - total_weight;
- }
- }
- else
- {
- /* Handle case when there are more
- * destination samples than source
- * samples (upsampling).
- */
-
- half_width = filter_support * filter_scale;
-
- // Find the source sample(s) that contribute to each destination sample.
-
- for (i = 0, n = 0; i < dst_x; i++)
- {
- // Convert from discrete to continuous coordinates, scale, then convert back to discrete.
- center = ((Resample_Real)i + NUDGE) / xscale;
- center -= NUDGE;
- center += src_ofs;
-
- left = cast_to_int((Resample_Real)floor(center - half_width));
- right = cast_to_int((Resample_Real)ceil(center + half_width));
-
- Pcontrib_bounds[i].center = center;
- Pcontrib_bounds[i].left = left;
- Pcontrib_bounds[i].right = right;
-
- n += (right - left + 1);
- }
-
- /* Allocate memory for contributors. */
-
- int total = n;
- if ((total == 0) || ((Pcpool = (Contrib*)crnlib_calloc(total, sizeof(Contrib))) == NULL))
- {
- crnlib_free(Pcontrib);
- crnlib_free(Pcontrib_bounds);
- return NULL;
- }
-
- Pcpool_next = Pcpool;
-
- /* Create the list of source samples which
- * contribute to each destination sample.
- */
-
- for (i = 0; i < dst_x; i++)
- {
- int max_k = -1;
- Resample_Real max_w = -1e+20f;
-
- center = Pcontrib_bounds[i].center;
- left = Pcontrib_bounds[i].left;
- right = Pcontrib_bounds[i].right;
-
- Pcontrib[i].n = 0;
- Pcontrib[i].p = Pcpool_next;
- Pcpool_next += (right - left + 1);
- resampler_assert((Pcpool_next - Pcpool) <= total);
-
- total_weight = 0;
- for (j = left; j <= right; j++)
- total_weight += (*Pfilter)((center - (Resample_Real)j) * oo_filter_scale);
-
- const Resample_Real norm = static_cast<Resample_Real>(1.0f / total_weight);
-
- total_weight = 0;
-
- #if RESAMPLER_DEBUG
- printf("%i: ", i);
- #endif
-
- for (j = left; j <= right; j++)
- {
- weight = (*Pfilter)((center - (Resample_Real)j) * oo_filter_scale) * norm;
- if (weight == 0.0f)
- continue;
-
- n = reflect(j, src_x, boundary_op);
-
- #if RESAMPLER_DEBUG
- printf("%i(%f), ", n, weight);
- #endif
-
- /* Increment the number of source
- * samples which contribute to the
- * current destination sample.
- */
-
- k = Pcontrib[i].n++;
-
- Pcontrib[i].p[k].pixel = (unsigned short)n; /* store src sample number */
- Pcontrib[i].p[k].weight = weight; /* store src sample weight */
-
- total_weight += weight; /* total weight of all contributors */
-
- if (weight > max_w)
- {
- max_w = weight;
- max_k = k;
- }
- }
-
- #if RESAMPLER_DEBUG
- printf("\n\n");
- #endif
-
- //resampler_assert(Pcontrib[i].n);
- //resampler_assert(max_k != -1);
-
- if ((max_k == -1) || (Pcontrib[i].n == 0))
- {
- crnlib_free(Pcpool);
- crnlib_free(Pcontrib);
- crnlib_free(Pcontrib_bounds);
- return NULL;
- }
-
- if (total_weight != 1.0f)
- Pcontrib[i].p[max_k].weight += 1.0f - total_weight;
- }
- }
-
- #if RESAMPLER_DEBUG
- printf("*******\n");
- #endif
-
- crnlib_free(Pcontrib_bounds);
-
- return Pcontrib;
- }
-
- void Resampler::resample_x(Sample* Pdst, const Sample* Psrc)
- {
- resampler_assert(Pdst);
- resampler_assert(Psrc);
-
- int i, j;
- Sample total;
- Contrib_List *Pclist = m_Pclist_x;
- Contrib *p;
-
- for (i = m_resample_dst_x; i > 0; i--, Pclist++)
- {
- #if CRNLIB_RESAMPLER_DEBUG_OPS
- total_ops += Pclist->n;
- #endif
-
- for (j = Pclist->n, p = Pclist->p, total = 0; j > 0; j--, p++)
- total += Psrc[p->pixel] * p->weight;
-
- *Pdst++ = total;
- }
- }
-
- void Resampler::scale_y_mov(Sample* Ptmp, const Sample* Psrc, Resample_Real weight, int dst_x)
- {
- int i;
-
- #if CRNLIB_RESAMPLER_DEBUG_OPS
- total_ops += dst_x;
- #endif
-
- // Not += because temp buf wasn't cleared.
- for (i = dst_x; i > 0; i--)
- *Ptmp++ = *Psrc++ * weight;
- }
-
- void Resampler::scale_y_add(Sample* Ptmp, const Sample* Psrc, Resample_Real weight, int dst_x)
- {
- #if CRNLIB_RESAMPLER_DEBUG_OPS
- total_ops += dst_x;
- #endif
-
- for (int i = dst_x; i > 0; i--)
- (*Ptmp++) += *Psrc++ * weight;
- }
-
- void Resampler::clamp(Sample* Pdst, int n)
- {
- while (n > 0)
- {
- Sample x = *Pdst;
- *Pdst++ = clamp_sample(x);
- n--;
- }
- }
-
- void Resampler::resample_y(Sample* Pdst)
- {
- int i, j;
- Sample* Psrc;
- Contrib_List* Pclist = &m_Pclist_y[m_cur_dst_y];
-
- Sample* Ptmp = m_delay_x_resample ? m_Ptmp_buf : Pdst;
- resampler_assert(Ptmp);
-
- /* Process each contributor. */
-
- for (i = 0; i < Pclist->n; i++)
- {
- /* locate the contributor's location in the scan
- * buffer -- the contributor must always be found!
- */
-
- for (j = 0; j < MAX_SCAN_BUF_SIZE; j++)
- if (m_Pscan_buf->scan_buf_y[j] == Pclist->p[i].pixel)
- break;
-
- resampler_assert(j < MAX_SCAN_BUF_SIZE);
-
- Psrc = m_Pscan_buf->scan_buf_l[j];
-
- if (!i)
- scale_y_mov(Ptmp, Psrc, Pclist->p[i].weight, m_intermediate_x);
- else
- scale_y_add(Ptmp, Psrc, Pclist->p[i].weight, m_intermediate_x);
-
- /* If this source line doesn't contribute to any
- * more destination lines then mark the scanline buffer slot
- * which holds this source line as free.
- * (The max. number of slots used depends on the Y
- * axis sampling factor and the scaled filter width.)
- */
-
- if (--m_Psrc_y_count[resampler_range_check(Pclist->p[i].pixel, m_resample_src_y)] == 0)
- {
- m_Psrc_y_flag[resampler_range_check(Pclist->p[i].pixel, m_resample_src_y)] = FALSE;
- m_Pscan_buf->scan_buf_y[j] = -1;
- }
- }
-
- /* Now generate the destination line */
-
- if (m_delay_x_resample) // Was X resampling delayed until after Y resampling?
- {
- resampler_assert(Pdst != Ptmp);
- resample_x(Pdst, Ptmp);
- }
- else
- {
- resampler_assert(Pdst == Ptmp);
- }
-
- if (m_lo < m_hi)
- clamp(Pdst, m_resample_dst_x);
- }
-
- bool Resampler::put_line(const Sample* Psrc)
- {
- int i;
-
- if (m_cur_src_y >= m_resample_src_y)
- return false;
-
- /* Does this source line contribute
- * to any destination line? if not,
- * exit now.
- */
-
- if (!m_Psrc_y_count[resampler_range_check(m_cur_src_y, m_resample_src_y)])
- {
- m_cur_src_y++;
- return true;
- }
-
- /* Find an empty slot in the scanline buffer. (FIXME: Perf. is terrible here with extreme scaling ratios.) */
-
- for (i = 0; i < MAX_SCAN_BUF_SIZE; i++)
- if (m_Pscan_buf->scan_buf_y[i] == -1)
- break;
-
- /* If the buffer is full, exit with an error. */
-
- if (i == MAX_SCAN_BUF_SIZE)
- {
- m_status = STATUS_SCAN_BUFFER_FULL;
- return false;
- }
-
- m_Psrc_y_flag[resampler_range_check(m_cur_src_y, m_resample_src_y)] = TRUE;
- m_Pscan_buf->scan_buf_y[i] = m_cur_src_y;
-
- /* Does this slot have any memory allocated to it? */
-
- if (!m_Pscan_buf->scan_buf_l[i])
- {
- if ((m_Pscan_buf->scan_buf_l[i] = (Sample*)crnlib_malloc(m_intermediate_x * sizeof(Sample))) == NULL)
- {
- m_status = STATUS_OUT_OF_MEMORY;
- return false;
- }
- }
-
- // Resampling on the X axis first?
- if (m_delay_x_resample)
- {
- resampler_assert(m_intermediate_x == m_resample_src_x);
-
- // Y-X resampling order
- memcpy(m_Pscan_buf->scan_buf_l[i], Psrc, m_intermediate_x * sizeof(Sample));
- }
- else
- {
- resampler_assert(m_intermediate_x == m_resample_dst_x);
-
- // X-Y resampling order
- resample_x(m_Pscan_buf->scan_buf_l[i], Psrc);
- }
-
- m_cur_src_y++;
-
- return true;
- }
-
- const Resampler::Sample* Resampler::get_line()
- {
- int i;
-
- /* If all the destination lines have been
- * generated, then always return NULL.
- */
-
- if (m_cur_dst_y == m_resample_dst_y)
- return NULL;
-
- /* Check to see if all the required
- * contributors are present, if not,
- * return NULL.
- */
-
- for (i = 0; i < m_Pclist_y[m_cur_dst_y].n; i++)
- if (!m_Psrc_y_flag[resampler_range_check(m_Pclist_y[m_cur_dst_y].p[i].pixel, m_resample_src_y)])
- return NULL;
-
- resample_y(m_Pdst_buf);
-
- m_cur_dst_y++;
-
- return m_Pdst_buf;
- }
-
- Resampler::~Resampler()
- {
- int i;
-
- #if CRNLIB_RESAMPLER_DEBUG_OPS
- printf("actual ops: %i\n", total_ops);
- #endif
-
- crnlib_free(m_Pdst_buf);
- m_Pdst_buf = NULL;
-
- if (m_Ptmp_buf)
- {
- crnlib_free(m_Ptmp_buf);
- m_Ptmp_buf = NULL;
- }
-
- /* Don't deallocate a contibutor list
- * if the user passed us one of their own.
- */
-
- if ((m_Pclist_x) && (!m_clist_x_forced))
- {
- crnlib_free(m_Pclist_x->p);
- crnlib_free(m_Pclist_x);
- m_Pclist_x = NULL;
- }
-
- if ((m_Pclist_y) && (!m_clist_y_forced))
- {
- crnlib_free(m_Pclist_y->p);
- crnlib_free(m_Pclist_y);
- m_Pclist_y = NULL;
- }
-
- crnlib_free(m_Psrc_y_count);
- m_Psrc_y_count = NULL;
-
- crnlib_free(m_Psrc_y_flag);
- m_Psrc_y_flag = NULL;
-
- if (m_Pscan_buf)
- {
- for (i = 0; i < MAX_SCAN_BUF_SIZE; i++)
- crnlib_free(m_Pscan_buf->scan_buf_l[i]);
-
- crnlib_free(m_Pscan_buf);
- m_Pscan_buf = NULL;
- }
- }
-
- void Resampler::restart()
- {
- if (STATUS_OKAY != m_status)
- return;
-
- m_cur_src_y = m_cur_dst_y = 0;
-
- int i, j;
- for (i = 0; i < m_resample_src_y; i++)
- {
- m_Psrc_y_count[i] = 0;
- m_Psrc_y_flag[i] = FALSE;
- }
-
- for (i = 0; i < m_resample_dst_y; i++)
- {
- for (j = 0; j < m_Pclist_y[i].n; j++)
- m_Psrc_y_count[resampler_range_check(m_Pclist_y[i].p[j].pixel, m_resample_src_y)]++;
- }
-
- for (i = 0; i < MAX_SCAN_BUF_SIZE; i++)
- {
- m_Pscan_buf->scan_buf_y[i] = -1;
-
- crnlib_free(m_Pscan_buf->scan_buf_l[i]);
- m_Pscan_buf->scan_buf_l[i] = NULL;
- }
- }
-
- Resampler::Resampler(int src_x, int src_y,
- int dst_x, int dst_y,
- Boundary_Op boundary_op,
- Resample_Real sample_low, Resample_Real sample_high,
- const char* Pfilter_name,
- Contrib_List* Pclist_x,
- Contrib_List* Pclist_y,
- Resample_Real filter_x_scale,
- Resample_Real filter_y_scale,
- Resample_Real src_x_ofs,
- Resample_Real src_y_ofs)
- {
- int i, j;
- Resample_Real support, (*func)(Resample_Real);
-
- resampler_assert(src_x > 0);
- resampler_assert(src_y > 0);
- resampler_assert(dst_x > 0);
- resampler_assert(dst_y > 0);
-
- #if CRNLIB_RESAMPLER_DEBUG_OPS
- total_ops = 0;
- #endif
-
- m_lo = sample_low;
- m_hi = sample_high;
-
- m_delay_x_resample = false;
- m_intermediate_x = 0;
- m_Pdst_buf = NULL;
- m_Ptmp_buf = NULL;
- m_clist_x_forced = false;
- m_Pclist_x = NULL;
- m_clist_y_forced = false;
- m_Pclist_y = NULL;
- m_Psrc_y_count = NULL;
- m_Psrc_y_flag = NULL;
- m_Pscan_buf = NULL;
- m_status = STATUS_OKAY;
-
- m_resample_src_x = src_x;
- m_resample_src_y = src_y;
- m_resample_dst_x = dst_x;
- m_resample_dst_y = dst_y;
-
- m_boundary_op = boundary_op;
-
- if ((m_Pdst_buf = (Sample*)crnlib_malloc(m_resample_dst_x * sizeof(Sample))) == NULL)
- {
- m_status = STATUS_OUT_OF_MEMORY;
- return;
- }
-
- // Find the specified filter.
-
- if (Pfilter_name == NULL)
- Pfilter_name = CRNLIB_RESAMPLER_DEFAULT_FILTER;
-
- for (i = 0; i < g_num_resample_filters; i++)
- if (strcmp(Pfilter_name, g_resample_filters[i].name) == 0)
- break;
-
- if (i == g_num_resample_filters)
- {
- m_status = STATUS_BAD_FILTER_NAME;
- return;
- }
-
- func = g_resample_filters[i].func;
- support = g_resample_filters[i].support;
-
- /* Create contributor lists, unless the user supplied custom lists. */
-
- if (!Pclist_x)
- {
- m_Pclist_x = make_clist(m_resample_src_x, m_resample_dst_x, m_boundary_op, func, support, filter_x_scale, src_x_ofs);
- if (!m_Pclist_x)
- {
- m_status = STATUS_OUT_OF_MEMORY;
- return;
- }
- }
- else
- {
- m_Pclist_x = Pclist_x;
- m_clist_x_forced = true;
- }
-
- if (!Pclist_y)
- {
- m_Pclist_y = make_clist(m_resample_src_y, m_resample_dst_y, m_boundary_op, func, support, filter_y_scale, src_y_ofs);
- if (!m_Pclist_y)
- {
- m_status = STATUS_OUT_OF_MEMORY;
- return;
- }
- }
- else
- {
- m_Pclist_y = Pclist_y;
- m_clist_y_forced = true;
- }
-
- if ((m_Psrc_y_count = (int*)crnlib_calloc(m_resample_src_y, sizeof(int))) == NULL)
- {
- m_status = STATUS_OUT_OF_MEMORY;
- return;
- }
-
- if ((m_Psrc_y_flag = (unsigned char*)crnlib_calloc(m_resample_src_y, sizeof(unsigned char))) == NULL)
- {
- m_status = STATUS_OUT_OF_MEMORY;
- return;
- }
-
- /* Count how many times each source line
- * contributes to a destination line.
- */
-
- for (i = 0; i < m_resample_dst_y; i++)
- for (j = 0; j < m_Pclist_y[i].n; j++)
- m_Psrc_y_count[resampler_range_check(m_Pclist_y[i].p[j].pixel, m_resample_src_y)]++;
-
- if ((m_Pscan_buf = (Scan_Buf*)crnlib_malloc(sizeof(Scan_Buf))) == NULL)
- {
- m_status = STATUS_OUT_OF_MEMORY;
- return;
- }
-
- for (i = 0; i < MAX_SCAN_BUF_SIZE; i++)
- {
- m_Pscan_buf->scan_buf_y[i] = -1;
- m_Pscan_buf->scan_buf_l[i] = NULL;
- }
-
- m_cur_src_y = m_cur_dst_y = 0;
- {
- // Determine which axis to resample first by comparing the number of multiplies required
- // for each possibility.
- int x_ops = count_ops(m_Pclist_x, m_resample_dst_x);
- int y_ops = count_ops(m_Pclist_y, m_resample_dst_y);
-
- // Hack 10/2000: Weight Y axis ops a little more than X axis ops.
- // (Y axis ops use more cache resources.)
- int xy_ops = x_ops * m_resample_src_y +
- (4 * y_ops * m_resample_dst_x)/3;
-
- int yx_ops = (4 * y_ops * m_resample_src_x)/3 +
- x_ops * m_resample_dst_y;
-
- #if CRNLIB_RESAMPLER_DEBUG_OPS
- printf("src: %i %i\n", m_resample_src_x, m_resample_src_y);
- printf("dst: %i %i\n", m_resample_dst_x, m_resample_dst_y);
- printf("x_ops: %i\n", x_ops);
- printf("y_ops: %i\n", y_ops);
- printf("xy_ops: %i\n", xy_ops);
- printf("yx_ops: %i\n", yx_ops);
- #endif
-
- // Now check which resample order is better. In case of a tie, choose the order
- // which buffers the least amount of data.
- if ((xy_ops > yx_ops) ||
- ((xy_ops == yx_ops) && (m_resample_src_x < m_resample_dst_x))
- )
- {
- m_delay_x_resample = true;
- m_intermediate_x = m_resample_src_x;
- }
- else
- {
- m_delay_x_resample = false;
- m_intermediate_x = m_resample_dst_x;
- }
- #if CRNLIB_RESAMPLER_DEBUG_OPS
- printf("delaying: %i\n", m_delay_x_resample);
- #endif
- }
-
- if (m_delay_x_resample)
- {
- if ((m_Ptmp_buf = (Sample*)crnlib_malloc(m_intermediate_x * sizeof(Sample))) == NULL)
- {
- m_status = STATUS_OUT_OF_MEMORY;
- return;
- }
- }
- }
-
- void Resampler::get_clists(Contrib_List** ptr_clist_x, Contrib_List** ptr_clist_y)
- {
- if (ptr_clist_x)
- *ptr_clist_x = m_Pclist_x;
-
- if (ptr_clist_y)
- *ptr_clist_y = m_Pclist_y;
- }
-
- int Resampler::get_filter_num()
- {
- return g_num_resample_filters;
- }
-
- const char* Resampler::get_filter_name(int filter_num)
- {
- if ((filter_num < 0) || (filter_num >= g_num_resample_filters))
- return NULL;
- else
- return g_resample_filters[filter_num].name;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_resampler.h b/Libraries/crunch-ea9b8d/crnlib/crn_resampler.h
deleted file mode 100644
index 160e9943..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_resampler.h
+++ /dev/null
@@ -1,173 +0,0 @@
-// File: crn_resampler.h
-// RG: This is public domain code, originally derived from Graphics Gems 3, see: http://code.google.com/p/imageresampler/
-#pragma once
-
-namespace crnlib
-{
- #define CRNLIB_RESAMPLER_DEBUG_OPS 0
- #define CRNLIB_RESAMPLER_DEFAULT_FILTER "lanczos4"
-
- #define CRNLIB_RESAMPLER_MAX_DIMENSION 16384
-
- // float or double
- typedef float Resample_Real;
-
- class Resampler
- {
- public:
- typedef Resample_Real Sample;
-
- struct Contrib
- {
- Resample_Real weight;
- unsigned short pixel;
- };
-
- struct Contrib_List
- {
- unsigned short n;
- Contrib* p;
- };
-
- enum Boundary_Op
- {
- BOUNDARY_WRAP = 0,
- BOUNDARY_REFLECT = 1,
- BOUNDARY_CLAMP = 2
- };
-
- enum Status
- {
- STATUS_OKAY = 0,
- STATUS_OUT_OF_MEMORY = 1,
- STATUS_BAD_FILTER_NAME = 2,
- STATUS_SCAN_BUFFER_FULL = 3
- };
-
- // src_x/src_y - Input dimensions
- // dst_x/dst_y - Output dimensions
- // boundary_op - How to sample pixels near the image boundaries
- // sample_low/sample_high - Clamp output samples to specified range, or disable clamping if sample_low >= sample_high
- // Pclist_x/Pclist_y - Optional pointers to contributor lists from another instance of a Resampler
- // src_x_ofs/src_y_ofs - Offset input image by specified amount (fractional values okay)
- Resampler(
- int src_x, int src_y,
- int dst_x, int dst_y,
- Boundary_Op boundary_op = BOUNDARY_CLAMP,
- Resample_Real sample_low = 0.0f, Resample_Real sample_high = 0.0f,
- const char* Pfilter_name = CRNLIB_RESAMPLER_DEFAULT_FILTER,
- Contrib_List* Pclist_x = NULL,
- Contrib_List* Pclist_y = NULL,
- Resample_Real filter_x_scale = 1.0f,
- Resample_Real filter_y_scale = 1.0f,
- Resample_Real src_x_ofs = 0.0f,
- Resample_Real src_y_ofs = 0.0f);
-
- ~Resampler();
-
- // Reinits resampler so it can handle another frame.
- void restart();
-
- // false on out of memory.
- bool put_line(const Sample* Psrc);
-
- // NULL if no scanlines are currently available (give the resampler more scanlines!)
- const Sample* get_line();
-
- Status status() const { return m_status; }
-
- // Returned contributor lists can be shared with another Resampler.
- void get_clists(Contrib_List** ptr_clist_x, Contrib_List** ptr_clist_y);
- Contrib_List* get_clist_x() const { return m_Pclist_x; }
- Contrib_List* get_clist_y() const { return m_Pclist_y; }
-
- // Filter accessors.
- static int get_filter_num();
- static const char* get_filter_name(int filter_num);
-
- static Contrib_List* make_clist(
- int src_x, int dst_x, Boundary_Op boundary_op,
- Resample_Real (*Pfilter)(Resample_Real),
- Resample_Real filter_support,
- Resample_Real filter_scale,
- Resample_Real src_ofs);
-
- private:
- Resampler();
- Resampler(const Resampler& o);
- Resampler& operator= (const Resampler& o);
-
- #ifdef CRNLIB_RESAMPLER_DEBUG_OPS
- int total_ops;
- #endif
-
- int m_intermediate_x;
-
- int m_resample_src_x;
- int m_resample_src_y;
- int m_resample_dst_x;
- int m_resample_dst_y;
-
- Boundary_Op m_boundary_op;
-
- Sample* m_Pdst_buf;
- Sample* m_Ptmp_buf;
-
- Contrib_List* m_Pclist_x;
- Contrib_List* m_Pclist_y;
-
- bool m_clist_x_forced;
- bool m_clist_y_forced;
-
- bool m_delay_x_resample;
-
- int* m_Psrc_y_count;
- unsigned char* m_Psrc_y_flag;
-
- // The maximum number of scanlines that can be buffered at one time.
- enum { MAX_SCAN_BUF_SIZE = CRNLIB_RESAMPLER_MAX_DIMENSION };
-
- struct Scan_Buf
- {
- int scan_buf_y[MAX_SCAN_BUF_SIZE];
- Sample* scan_buf_l[MAX_SCAN_BUF_SIZE];
- };
-
- Scan_Buf* m_Pscan_buf;
-
- int m_cur_src_y;
- int m_cur_dst_y;
-
- Status m_status;
-
- void resample_x(Sample* Pdst, const Sample* Psrc);
- void scale_y_mov(Sample* Ptmp, const Sample* Psrc, Resample_Real weight, int dst_x);
- void scale_y_add(Sample* Ptmp, const Sample* Psrc, Resample_Real weight, int dst_x);
- void clamp(Sample* Pdst, int n);
- void resample_y(Sample* Pdst);
-
- static int reflect(const int j, const int src_x, const Boundary_Op boundary_op);
-
- inline int count_ops(Contrib_List* Pclist, int k)
- {
- int i, t = 0;
- for (i = 0; i < k; i++)
- t += Pclist[i].n;
- return (t);
- }
-
- Resample_Real m_lo;
- Resample_Real m_hi;
-
- inline Resample_Real clamp_sample(Resample_Real f) const
- {
- if (f < m_lo)
- f = m_lo;
- else if (f > m_hi)
- f = m_hi;
- return f;
- }
- };
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_rg_etc1.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_rg_etc1.cpp
deleted file mode 100644
index 664825ec..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_rg_etc1.cpp
+++ /dev/null
@@ -1,2449 +0,0 @@
-// File: rg_etc1.cpp - Fast, high quality ETC1 block packer/unpacker - Rich Geldreich <richgel99@gmail.com>
-// Please see ZLIB license at the end of rg_etc1.h.
-//
-// For more information Ericsson Texture Compression (ETC/ETC1), see:
-// http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt
-//
-// v1.03 - 5/12/13 - Initial public release
-#include "crn_core.h"
-#include "crn_rg_etc1.h"
-
-#include <stdlib.h>
-#include <memory.h>
-#include <assert.h>
-//#include <stdio.h>
-#include <math.h>
-
-#if defined(_MSC_VER)
-#pragma warning (disable: 4201) // nonstandard extension used : nameless struct/union
-#endif
-
-#if defined(_DEBUG) || defined(DEBUG)
-#define RG_ETC1_BUILD_DEBUG
-#endif
-
-#define RG_ETC1_ASSERT CRNLIB_ASSERT
-
-namespace crnlib {
-
-namespace rg_etc1
-{
- typedef unsigned char uint8;
- typedef unsigned short uint16;
- typedef unsigned int uint;
- typedef unsigned int uint32;
- typedef long long int64;
- typedef unsigned long long uint64;
-
- const uint32 cUINT32_MAX = 0xFFFFFFFFU;
- const uint64 cUINT64_MAX = 0xFFFFFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFFFFFui64;
-
- template<typename T> inline T minimum(T a, T b) { return (a < b) ? a : b; }
- template<typename T> inline T minimum(T a, T b, T c) { return minimum(minimum(a, b), c); }
- template<typename T> inline T maximum(T a, T b) { return (a > b) ? a : b; }
- template<typename T> inline T maximum(T a, T b, T c) { return maximum(maximum(a, b), c); }
- template<typename T> inline T clamp(T value, T low, T high) { return (value < low) ? low : ((value > high) ? high : value); }
- template<typename T> inline T square(T value) { return value * value; }
- template<typename T> inline void zero_object(T& obj) { memset((void*)&obj, 0, sizeof(obj)); }
- template<typename T> inline void zero_this(T* pObj) { memset((void*)pObj, 0, sizeof(*pObj)); }
-
- template<class T, size_t N> T decay_array_to_subtype(T (&a)[N]);
-
-#define RG_ETC1_ARRAY_SIZE(X) (sizeof(X) / sizeof(decay_array_to_subtype(X)))
-
- enum eNoClamp { cNoClamp };
-
- struct color_quad_u8
- {
- static inline int clamp(int v) { if (v & 0xFFFFFF00U) v = (~(static_cast<int>(v) >> 31)) & 0xFF; return v; }
-
- struct component_traits { enum { cSigned = false, cFloat = false, cMin = 0U, cMax = 255U }; };
-
- public:
- typedef unsigned char component_t;
- typedef int parameter_t;
-
- enum { cNumComps = 4 };
-
- union
- {
- struct
- {
- component_t r;
- component_t g;
- component_t b;
- component_t a;
- };
-
- component_t c[cNumComps];
-
- uint32 m_u32;
- };
-
- inline color_quad_u8()
- {
- }
-
- inline color_quad_u8(const color_quad_u8& other) : m_u32(other.m_u32)
- {
- }
-
- explicit inline color_quad_u8(parameter_t y, parameter_t alpha = component_traits::cMax)
- {
- set(y, alpha);
- }
-
- inline color_quad_u8(parameter_t red, parameter_t green, parameter_t blue, parameter_t alpha = component_traits::cMax)
- {
- set(red, green, blue, alpha);
- }
-
- explicit inline color_quad_u8(eNoClamp, parameter_t y, parameter_t alpha = component_traits::cMax)
- {
- set_noclamp_y_alpha(y, alpha);
- }
-
- inline color_quad_u8(eNoClamp, parameter_t red, parameter_t green, parameter_t blue, parameter_t alpha = component_traits::cMax)
- {
- set_noclamp_rgba(red, green, blue, alpha);
- }
-
- inline void clear()
- {
- m_u32 = 0;
- }
-
- inline color_quad_u8& operator= (const color_quad_u8& other)
- {
- m_u32 = other.m_u32;
- return *this;
- }
-
- inline color_quad_u8& set_rgb(const color_quad_u8& other)
- {
- r = other.r;
- g = other.g;
- b = other.b;
- return *this;
- }
-
- inline color_quad_u8& operator= (parameter_t y)
- {
- set(y, component_traits::cMax);
- return *this;
- }
-
- inline color_quad_u8& set(parameter_t y, parameter_t alpha = component_traits::cMax)
- {
- y = clamp(y);
- alpha = clamp(alpha);
- r = static_cast<component_t>(y);
- g = static_cast<component_t>(y);
- b = static_cast<component_t>(y);
- a = static_cast<component_t>(alpha);
- return *this;
- }
-
- inline color_quad_u8& set_noclamp_y_alpha(parameter_t y, parameter_t alpha = component_traits::cMax)
- {
- RG_ETC1_ASSERT( (y >= component_traits::cMin) && (y <= component_traits::cMax) );
- RG_ETC1_ASSERT( (alpha >= component_traits::cMin) && (alpha <= component_traits::cMax) );
-
- r = static_cast<component_t>(y);
- g = static_cast<component_t>(y);
- b = static_cast<component_t>(y);
- a = static_cast<component_t>(alpha);
- return *this;
- }
-
- inline color_quad_u8& set(parameter_t red, parameter_t green, parameter_t blue, parameter_t alpha = component_traits::cMax)
- {
- r = static_cast<component_t>(clamp(red));
- g = static_cast<component_t>(clamp(green));
- b = static_cast<component_t>(clamp(blue));
- a = static_cast<component_t>(clamp(alpha));
- return *this;
- }
-
- inline color_quad_u8& set_noclamp_rgba(parameter_t red, parameter_t green, parameter_t blue, parameter_t alpha)
- {
- RG_ETC1_ASSERT( (red >= component_traits::cMin) && (red <= component_traits::cMax) );
- RG_ETC1_ASSERT( (green >= component_traits::cMin) && (green <= component_traits::cMax) );
- RG_ETC1_ASSERT( (blue >= component_traits::cMin) && (blue <= component_traits::cMax) );
- RG_ETC1_ASSERT( (alpha >= component_traits::cMin) && (alpha <= component_traits::cMax) );
-
- r = static_cast<component_t>(red);
- g = static_cast<component_t>(green);
- b = static_cast<component_t>(blue);
- a = static_cast<component_t>(alpha);
- return *this;
- }
-
- inline color_quad_u8& set_noclamp_rgb(parameter_t red, parameter_t green, parameter_t blue)
- {
- RG_ETC1_ASSERT( (red >= component_traits::cMin) && (red <= component_traits::cMax) );
- RG_ETC1_ASSERT( (green >= component_traits::cMin) && (green <= component_traits::cMax) );
- RG_ETC1_ASSERT( (blue >= component_traits::cMin) && (blue <= component_traits::cMax) );
-
- r = static_cast<component_t>(red);
- g = static_cast<component_t>(green);
- b = static_cast<component_t>(blue);
- return *this;
- }
-
- static inline parameter_t get_min_comp() { return component_traits::cMin; }
- static inline parameter_t get_max_comp() { return component_traits::cMax; }
- static inline bool get_comps_are_signed() { return component_traits::cSigned; }
-
- inline component_t operator[] (uint i) const { RG_ETC1_ASSERT(i < cNumComps); return c[i]; }
- inline component_t& operator[] (uint i) { RG_ETC1_ASSERT(i < cNumComps); return c[i]; }
-
- inline color_quad_u8& set_component(uint i, parameter_t f)
- {
- RG_ETC1_ASSERT(i < cNumComps);
-
- c[i] = static_cast<component_t>(clamp(f));
-
- return *this;
- }
-
- inline color_quad_u8& set_grayscale(parameter_t l)
- {
- component_t x = static_cast<component_t>(clamp(l));
- c[0] = x;
- c[1] = x;
- c[2] = x;
- return *this;
- }
-
- inline color_quad_u8& clamp(const color_quad_u8& l, const color_quad_u8& h)
- {
- for (uint i = 0; i < cNumComps; i++)
- c[i] = static_cast<component_t>(rg_etc1::clamp<parameter_t>(c[i], l[i], h[i]));
- return *this;
- }
-
- inline color_quad_u8& clamp(parameter_t l, parameter_t h)
- {
- for (uint i = 0; i < cNumComps; i++)
- c[i] = static_cast<component_t>(rg_etc1::clamp<parameter_t>(c[i], l, h));
- return *this;
- }
-
- // Returns CCIR 601 luma (consistent with color_utils::RGB_To_Y).
- inline parameter_t get_luma() const
- {
- return static_cast<parameter_t>((19595U * r + 38470U * g + 7471U * b + 32768U) >> 16U);
- }
-
- // Returns REC 709 luma.
- inline parameter_t get_luma_rec709() const
- {
- return static_cast<parameter_t>((13938U * r + 46869U * g + 4729U * b + 32768U) >> 16U);
- }
-
- inline uint squared_distance_rgb(const color_quad_u8& c) const
- {
- return rg_etc1::square(r - c.r) + rg_etc1::square(g - c.g) + rg_etc1::square(b - c.b);
- }
-
- inline uint squared_distance_rgba(const color_quad_u8& c) const
- {
- return rg_etc1::square(r - c.r) + rg_etc1::square(g - c.g) + rg_etc1::square(b - c.b) + rg_etc1::square(a - c.a);
- }
-
- inline bool rgb_equals(const color_quad_u8& rhs) const
- {
- return (r == rhs.r) && (g == rhs.g) && (b == rhs.b);
- }
-
- inline bool operator== (const color_quad_u8& rhs) const
- {
- return m_u32 == rhs.m_u32;
- }
-
- color_quad_u8& operator+= (const color_quad_u8& other)
- {
- for (uint i = 0; i < 4; i++)
- c[i] = static_cast<component_t>(clamp(c[i] + other.c[i]));
- return *this;
- }
-
- color_quad_u8& operator-= (const color_quad_u8& other)
- {
- for (uint i = 0; i < 4; i++)
- c[i] = static_cast<component_t>(clamp(c[i] - other.c[i]));
- return *this;
- }
-
- friend color_quad_u8 operator+ (const color_quad_u8& lhs, const color_quad_u8& rhs)
- {
- color_quad_u8 result(lhs);
- result += rhs;
- return result;
- }
-
- friend color_quad_u8 operator- (const color_quad_u8& lhs, const color_quad_u8& rhs)
- {
- color_quad_u8 result(lhs);
- result -= rhs;
- return result;
- }
- }; // class color_quad_u8
-
- struct vec3F
- {
- float m_s[3];
-
- inline vec3F() { }
- inline vec3F(float s) { m_s[0] = s; m_s[1] = s; m_s[2] = s; }
- inline vec3F(float x, float y, float z) { m_s[0] = x; m_s[1] = y; m_s[2] = z; }
-
- inline float operator[] (uint i) const { RG_ETC1_ASSERT(i < 3); return m_s[i]; }
-
- inline vec3F& operator += (const vec3F& other) { for (uint i = 0; i < 3; i++) m_s[i] += other.m_s[i]; return *this; }
-
- inline vec3F& operator *= (float s) { for (uint i = 0; i < 3; i++) m_s[i] *= s; return *this; }
- };
-
- enum etc_constants
- {
- cETC1BytesPerBlock = 8U,
-
- cETC1SelectorBits = 2U,
- cETC1SelectorValues = 1U << cETC1SelectorBits,
- cETC1SelectorMask = cETC1SelectorValues - 1U,
-
- cETC1BlockShift = 2U,
- cETC1BlockSize = 1U << cETC1BlockShift,
-
- cETC1LSBSelectorIndicesBitOffset = 0,
- cETC1MSBSelectorIndicesBitOffset = 16,
-
- cETC1FlipBitOffset = 32,
- cETC1DiffBitOffset = 33,
-
- cETC1IntenModifierNumBits = 3,
- cETC1IntenModifierValues = 1 << cETC1IntenModifierNumBits,
- cETC1RightIntenModifierTableBitOffset = 34,
- cETC1LeftIntenModifierTableBitOffset = 37,
-
- // Base+Delta encoding (5 bit bases, 3 bit delta)
- cETC1BaseColorCompNumBits = 5,
- cETC1BaseColorCompMax = 1 << cETC1BaseColorCompNumBits,
-
- cETC1DeltaColorCompNumBits = 3,
- cETC1DeltaColorComp = 1 << cETC1DeltaColorCompNumBits,
- cETC1DeltaColorCompMax = 1 << cETC1DeltaColorCompNumBits,
-
- cETC1BaseColor5RBitOffset = 59,
- cETC1BaseColor5GBitOffset = 51,
- cETC1BaseColor5BBitOffset = 43,
-
- cETC1DeltaColor3RBitOffset = 56,
- cETC1DeltaColor3GBitOffset = 48,
- cETC1DeltaColor3BBitOffset = 40,
-
- // Absolute (non-delta) encoding (two 4-bit per component bases)
- cETC1AbsColorCompNumBits = 4,
- cETC1AbsColorCompMax = 1 << cETC1AbsColorCompNumBits,
-
- cETC1AbsColor4R1BitOffset = 60,
- cETC1AbsColor4G1BitOffset = 52,
- cETC1AbsColor4B1BitOffset = 44,
-
- cETC1AbsColor4R2BitOffset = 56,
- cETC1AbsColor4G2BitOffset = 48,
- cETC1AbsColor4B2BitOffset = 40,
-
- cETC1ColorDeltaMin = -4,
- cETC1ColorDeltaMax = 3,
-
- // Delta3:
- // 0 1 2 3 4 5 6 7
- // 000 001 010 011 100 101 110 111
- // 0 1 2 3 -4 -3 -2 -1
- };
-
- static uint8 g_quant5_tab[256+16];
-
- static const int g_etc1_inten_tables[cETC1IntenModifierValues][cETC1SelectorValues] =
- {
- { -8, -2, 2, 8 }, { -17, -5, 5, 17 }, { -29, -9, 9, 29 }, { -42, -13, 13, 42 },
- { -60, -18, 18, 60 }, { -80, -24, 24, 80 }, { -106, -33, 33, 106 }, { -183, -47, 47, 183 }
- };
-
- static const uint8 g_etc1_to_selector_index[cETC1SelectorValues] = { 2, 3, 1, 0 };
- static const uint8 g_selector_index_to_etc1[cETC1SelectorValues] = { 3, 2, 0, 1 };
-
- // Given an ETC1 diff/inten_table/selector, and an 8-bit desired color, this table encodes the best packed_color in the low byte, and the abs error in the high byte.
- static uint16 g_etc1_inverse_lookup[2*8*4][256]; // [diff/inten_table/selector][desired_color]
-
- // g_color8_to_etc_block_config[color][table_index] = Supplies for each 8-bit color value a list of packed ETC1 diff/intensity table/selectors/packed_colors that map to that color.
- // To pack: diff | (inten << 1) | (selector << 4) | (packed_c << 8)
- static const uint16 g_color8_to_etc_block_config_0_255[2][33] =
- {
- { 0x0000, 0x0010, 0x0002, 0x0012, 0x0004, 0x0014, 0x0006, 0x0016, 0x0008, 0x0018, 0x000A, 0x001A, 0x000C, 0x001C, 0x000E, 0x001E,
- 0x0001, 0x0011, 0x0003, 0x0013, 0x0005, 0x0015, 0x0007, 0x0017, 0x0009, 0x0019, 0x000B, 0x001B, 0x000D, 0x001D, 0x000F, 0x001F, 0xFFFF },
- { 0x0F20, 0x0F30, 0x0E32, 0x0F22, 0x0E34, 0x0F24, 0x0D36, 0x0F26, 0x0C38, 0x0E28, 0x0B3A, 0x0E2A, 0x093C, 0x0E2C, 0x053E, 0x0D2E,
- 0x1E31, 0x1F21, 0x1D33, 0x1F23, 0x1C35, 0x1E25, 0x1A37, 0x1E27, 0x1839, 0x1D29, 0x163B, 0x1C2B, 0x133D, 0x1B2D, 0x093F, 0x1A2F, 0xFFFF },
- };
-
- // Really only [254][11].
- static const uint16 g_color8_to_etc_block_config_1_to_254[254][12] =
- {
- { 0x021C, 0x0D0D, 0xFFFF }, { 0x0020, 0x0021, 0x0A0B, 0x061F, 0xFFFF }, { 0x0113, 0x0217, 0xFFFF }, { 0x0116, 0x031E,
- 0x0B0E, 0x0405, 0xFFFF }, { 0x0022, 0x0204, 0x050A, 0x0023, 0xFFFF }, { 0x0111, 0x0319, 0x0809, 0x170F, 0xFFFF }, {
- 0x0303, 0x0215, 0x0607, 0xFFFF }, { 0x0030, 0x0114, 0x0408, 0x0031, 0x0201, 0x051D, 0xFFFF }, { 0x0100, 0x0024, 0x0306,
- 0x0025, 0x041B, 0x0E0D, 0xFFFF }, { 0x021A, 0x0121, 0x0B0B, 0x071F, 0xFFFF }, { 0x0213, 0x0317, 0xFFFF }, { 0x0112,
- 0x0505, 0xFFFF }, { 0x0026, 0x070C, 0x0123, 0x0027, 0xFFFF }, { 0x0211, 0x0909, 0xFFFF }, { 0x0110, 0x0315, 0x0707,
- 0x0419, 0x180F, 0xFFFF }, { 0x0218, 0x0131, 0x0301, 0x0403, 0x061D, 0xFFFF }, { 0x0032, 0x0202, 0x0033, 0x0125, 0x051B,
- 0x0F0D, 0xFFFF }, { 0x0028, 0x031C, 0x0221, 0x0029, 0xFFFF }, { 0x0120, 0x0313, 0x0C0B, 0x081F, 0xFFFF }, { 0x0605,
- 0x0417, 0xFFFF }, { 0x0216, 0x041E, 0x0C0E, 0x0223, 0x0127, 0xFFFF }, { 0x0122, 0x0304, 0x060A, 0x0311, 0x0A09, 0xFFFF
- }, { 0x0519, 0x190F, 0xFFFF }, { 0x002A, 0x0231, 0x0503, 0x0415, 0x0807, 0x002B, 0x071D, 0xFFFF }, { 0x0130, 0x0214,
- 0x0508, 0x0401, 0x0133, 0x0225, 0x061B, 0xFFFF }, { 0x0200, 0x0124, 0x0406, 0x0321, 0x0129, 0x100D, 0xFFFF }, { 0x031A,
- 0x0D0B, 0x091F, 0xFFFF }, { 0x0413, 0x0705, 0x0517, 0xFFFF }, { 0x0212, 0x0034, 0x0323, 0x0035, 0x0227, 0xFFFF }, {
- 0x0126, 0x080C, 0x0B09, 0xFFFF }, { 0x0411, 0x0619, 0x1A0F, 0xFFFF }, { 0x0210, 0x0331, 0x0603, 0x0515, 0x0907, 0x012B,
- 0xFFFF }, { 0x0318, 0x002C, 0x0501, 0x0233, 0x0325, 0x071B, 0x002D, 0x081D, 0xFFFF }, { 0x0132, 0x0302, 0x0229, 0x110D,
- 0xFFFF }, { 0x0128, 0x041C, 0x0421, 0x0E0B, 0x0A1F, 0xFFFF }, { 0x0220, 0x0513, 0x0617, 0xFFFF }, { 0x0135, 0x0805,
- 0x0327, 0xFFFF }, { 0x0316, 0x051E, 0x0D0E, 0x0423, 0xFFFF }, { 0x0222, 0x0404, 0x070A, 0x0511, 0x0719, 0x0C09, 0x1B0F,
- 0xFFFF }, { 0x0703, 0x0615, 0x0A07, 0x022B, 0xFFFF }, { 0x012A, 0x0431, 0x0601, 0x0333, 0x012D, 0x091D, 0xFFFF }, {
- 0x0230, 0x0314, 0x0036, 0x0608, 0x0425, 0x0037, 0x0329, 0x081B, 0x120D, 0xFFFF }, { 0x0300, 0x0224, 0x0506, 0x0521,
- 0x0F0B, 0x0B1F, 0xFFFF }, { 0x041A, 0x0613, 0x0717, 0xFFFF }, { 0x0235, 0x0905, 0xFFFF }, { 0x0312, 0x0134, 0x0523,
- 0x0427, 0xFFFF }, { 0x0226, 0x090C, 0x002E, 0x0611, 0x0D09, 0x002F, 0xFFFF }, { 0x0715, 0x0B07, 0x0819, 0x032B, 0x1C0F,
- 0xFFFF }, { 0x0310, 0x0531, 0x0701, 0x0803, 0x022D, 0x0A1D, 0xFFFF }, { 0x0418, 0x012C, 0x0433, 0x0525, 0x0137, 0x091B,
- 0x130D, 0xFFFF }, { 0x0232, 0x0402, 0x0621, 0x0429, 0xFFFF }, { 0x0228, 0x051C, 0x0713, 0x100B, 0x0C1F, 0xFFFF }, {
- 0x0320, 0x0335, 0x0A05, 0x0817, 0xFFFF }, { 0x0623, 0x0527, 0xFFFF }, { 0x0416, 0x061E, 0x0E0E, 0x0711, 0x0E09, 0x012F,
- 0xFFFF }, { 0x0322, 0x0504, 0x080A, 0x0919, 0x1D0F, 0xFFFF }, { 0x0631, 0x0903, 0x0815, 0x0C07, 0x042B, 0x032D, 0x0B1D,
- 0xFFFF }, { 0x022A, 0x0801, 0x0533, 0x0625, 0x0237, 0x0A1B, 0xFFFF }, { 0x0330, 0x0414, 0x0136, 0x0708, 0x0721, 0x0529,
- 0x140D, 0xFFFF }, { 0x0400, 0x0324, 0x0606, 0x0038, 0x0039, 0x110B, 0x0D1F, 0xFFFF }, { 0x051A, 0x0813, 0x0B05, 0x0917,
- 0xFFFF }, { 0x0723, 0x0435, 0x0627, 0xFFFF }, { 0x0412, 0x0234, 0x0F09, 0x022F, 0xFFFF }, { 0x0326, 0x0A0C, 0x012E,
- 0x0811, 0x0A19, 0x1E0F, 0xFFFF }, { 0x0731, 0x0A03, 0x0915, 0x0D07, 0x052B, 0xFFFF }, { 0x0410, 0x0901, 0x0633, 0x0725,
- 0x0337, 0x0B1B, 0x042D, 0x0C1D, 0xFFFF }, { 0x0518, 0x022C, 0x0629, 0x150D, 0xFFFF }, { 0x0332, 0x0502, 0x0821, 0x0139,
- 0x120B, 0x0E1F, 0xFFFF }, { 0x0328, 0x061C, 0x0913, 0x0A17, 0xFFFF }, { 0x0420, 0x0535, 0x0C05, 0x0727, 0xFFFF }, {
- 0x0823, 0x032F, 0xFFFF }, { 0x0516, 0x071E, 0x0F0E, 0x0911, 0x0B19, 0x1009, 0x1F0F, 0xFFFF }, { 0x0422, 0x0604, 0x090A,
- 0x0B03, 0x0A15, 0x0E07, 0x062B, 0xFFFF }, { 0x0831, 0x0A01, 0x0733, 0x052D, 0x0D1D, 0xFFFF }, { 0x032A, 0x0825, 0x0437,
- 0x0729, 0x0C1B, 0x160D, 0xFFFF }, { 0x0430, 0x0514, 0x0236, 0x0808, 0x0921, 0x0239, 0x130B, 0x0F1F, 0xFFFF }, { 0x0500,
- 0x0424, 0x0706, 0x0138, 0x0A13, 0x0B17, 0xFFFF }, { 0x061A, 0x0635, 0x0D05, 0xFFFF }, { 0x0923, 0x0827, 0xFFFF }, {
- 0x0512, 0x0334, 0x003A, 0x0A11, 0x1109, 0x003B, 0x042F, 0xFFFF }, { 0x0426, 0x0B0C, 0x022E, 0x0B15, 0x0F07, 0x0C19,
- 0x072B, 0xFFFF }, { 0x0931, 0x0B01, 0x0C03, 0x062D, 0x0E1D, 0xFFFF }, { 0x0510, 0x0833, 0x0925, 0x0537, 0x0D1B, 0x170D,
- 0xFFFF }, { 0x0618, 0x032C, 0x0A21, 0x0339, 0x0829, 0xFFFF }, { 0x0432, 0x0602, 0x0B13, 0x140B, 0x101F, 0xFFFF }, {
- 0x0428, 0x071C, 0x0735, 0x0E05, 0x0C17, 0xFFFF }, { 0x0520, 0x0A23, 0x0927, 0xFFFF }, { 0x0B11, 0x1209, 0x013B, 0x052F,
- 0xFFFF }, { 0x0616, 0x081E, 0x0D19, 0xFFFF }, { 0x0522, 0x0704, 0x0A0A, 0x0A31, 0x0D03, 0x0C15, 0x1007, 0x082B, 0x072D,
- 0x0F1D, 0xFFFF }, { 0x0C01, 0x0933, 0x0A25, 0x0637, 0x0E1B, 0xFFFF }, { 0x042A, 0x0B21, 0x0929, 0x180D, 0xFFFF }, {
- 0x0530, 0x0614, 0x0336, 0x0908, 0x0439, 0x150B, 0x111F, 0xFFFF }, { 0x0600, 0x0524, 0x0806, 0x0238, 0x0C13, 0x0F05,
- 0x0D17, 0xFFFF }, { 0x071A, 0x0B23, 0x0835, 0x0A27, 0xFFFF }, { 0x1309, 0x023B, 0x062F, 0xFFFF }, { 0x0612, 0x0434,
- 0x013A, 0x0C11, 0x0E19, 0xFFFF }, { 0x0526, 0x0C0C, 0x032E, 0x0B31, 0x0E03, 0x0D15, 0x1107, 0x092B, 0xFFFF }, { 0x0D01,
- 0x0A33, 0x0B25, 0x0737, 0x0F1B, 0x082D, 0x101D, 0xFFFF }, { 0x0610, 0x0A29, 0x190D, 0xFFFF }, { 0x0718, 0x042C, 0x0C21,
- 0x0539, 0x160B, 0x121F, 0xFFFF }, { 0x0532, 0x0702, 0x0D13, 0x0E17, 0xFFFF }, { 0x0528, 0x081C, 0x0935, 0x1005, 0x0B27,
- 0xFFFF }, { 0x0620, 0x0C23, 0x033B, 0x072F, 0xFFFF }, { 0x0D11, 0x0F19, 0x1409, 0xFFFF }, { 0x0716, 0x003C, 0x091E,
- 0x0F03, 0x0E15, 0x1207, 0x0A2B, 0x003D, 0xFFFF }, { 0x0622, 0x0804, 0x0B0A, 0x0C31, 0x0E01, 0x0B33, 0x092D, 0x111D,
- 0xFFFF }, { 0x0C25, 0x0837, 0x0B29, 0x101B, 0x1A0D, 0xFFFF }, { 0x052A, 0x0D21, 0x0639, 0x170B, 0x131F, 0xFFFF }, {
- 0x0630, 0x0714, 0x0436, 0x0A08, 0x0E13, 0x0F17, 0xFFFF }, { 0x0700, 0x0624, 0x0906, 0x0338, 0x0A35, 0x1105, 0xFFFF }, {
- 0x081A, 0x0D23, 0x0C27, 0xFFFF }, { 0x0E11, 0x1509, 0x043B, 0x082F, 0xFFFF }, { 0x0712, 0x0534, 0x023A, 0x0F15, 0x1307,
- 0x1019, 0x0B2B, 0x013D, 0xFFFF }, { 0x0626, 0x0D0C, 0x042E, 0x0D31, 0x0F01, 0x1003, 0x0A2D, 0x121D, 0xFFFF }, { 0x0C33,
- 0x0D25, 0x0937, 0x111B, 0x1B0D, 0xFFFF }, { 0x0710, 0x0E21, 0x0739, 0x0C29, 0xFFFF }, { 0x0818, 0x052C, 0x0F13, 0x180B,
- 0x141F, 0xFFFF }, { 0x0632, 0x0802, 0x0B35, 0x1205, 0x1017, 0xFFFF }, { 0x0628, 0x091C, 0x0E23, 0x0D27, 0xFFFF }, {
- 0x0720, 0x0F11, 0x1609, 0x053B, 0x092F, 0xFFFF }, { 0x1119, 0x023D, 0xFFFF }, { 0x0816, 0x013C, 0x0A1E, 0x0E31, 0x1103,
- 0x1015, 0x1407, 0x0C2B, 0x0B2D, 0x131D, 0xFFFF }, { 0x0722, 0x0904, 0x0C0A, 0x1001, 0x0D33, 0x0E25, 0x0A37, 0x121B,
- 0xFFFF }, { 0x0F21, 0x0D29, 0x1C0D, 0xFFFF }, { 0x062A, 0x0839, 0x190B, 0x151F, 0xFFFF }, { 0x0730, 0x0814, 0x0536,
- 0x0B08, 0x1013, 0x1305, 0x1117, 0xFFFF }, { 0x0800, 0x0724, 0x0A06, 0x0438, 0x0F23, 0x0C35, 0x0E27, 0xFFFF }, { 0x091A,
- 0x1709, 0x063B, 0x0A2F, 0xFFFF }, { 0x1011, 0x1219, 0x033D, 0xFFFF }, { 0x0812, 0x0634, 0x033A, 0x0F31, 0x1203, 0x1115,
- 0x1507, 0x0D2B, 0xFFFF }, { 0x0726, 0x0E0C, 0x052E, 0x1101, 0x0E33, 0x0F25, 0x0B37, 0x131B, 0x0C2D, 0x141D, 0xFFFF }, {
- 0x0E29, 0x1D0D, 0xFFFF }, { 0x0810, 0x1021, 0x0939, 0x1A0B, 0x161F, 0xFFFF }, { 0x0918, 0x062C, 0x1113, 0x1217, 0xFFFF
- }, { 0x0732, 0x0902, 0x0D35, 0x1405, 0x0F27, 0xFFFF }, { 0x0728, 0x0A1C, 0x1023, 0x073B, 0x0B2F, 0xFFFF }, { 0x0820,
- 0x1111, 0x1319, 0x1809, 0xFFFF }, { 0x1303, 0x1215, 0x1607, 0x0E2B, 0x043D, 0xFFFF }, { 0x0916, 0x023C, 0x0B1E, 0x1031,
- 0x1201, 0x0F33, 0x0D2D, 0x151D, 0xFFFF }, { 0x0822, 0x0A04, 0x0D0A, 0x1025, 0x0C37, 0x0F29, 0x141B, 0x1E0D, 0xFFFF }, {
- 0x1121, 0x0A39, 0x1B0B, 0x171F, 0xFFFF }, { 0x072A, 0x1213, 0x1317, 0xFFFF }, { 0x0830, 0x0914, 0x0636, 0x0C08, 0x0E35,
- 0x1505, 0xFFFF }, { 0x0900, 0x0824, 0x0B06, 0x0538, 0x1123, 0x1027, 0xFFFF }, { 0x0A1A, 0x1211, 0x1909, 0x083B, 0x0C2F,
- 0xFFFF }, { 0x1315, 0x1707, 0x1419, 0x0F2B, 0x053D, 0xFFFF }, { 0x0912, 0x0734, 0x043A, 0x1131, 0x1301, 0x1403, 0x0E2D,
- 0x161D, 0xFFFF }, { 0x0826, 0x0F0C, 0x062E, 0x1033, 0x1125, 0x0D37, 0x151B, 0x1F0D, 0xFFFF }, { 0x1221, 0x0B39, 0x1029,
- 0xFFFF }, { 0x0910, 0x1313, 0x1C0B, 0x181F, 0xFFFF }, { 0x0A18, 0x072C, 0x0F35, 0x1605, 0x1417, 0xFFFF }, { 0x0832,
- 0x0A02, 0x1223, 0x1127, 0xFFFF }, { 0x0828, 0x0B1C, 0x1311, 0x1A09, 0x093B, 0x0D2F, 0xFFFF }, { 0x0920, 0x1519, 0x063D,
- 0xFFFF }, { 0x1231, 0x1503, 0x1415, 0x1807, 0x102B, 0x0F2D, 0x171D, 0xFFFF }, { 0x0A16, 0x033C, 0x0C1E, 0x1401, 0x1133,
- 0x1225, 0x0E37, 0x161B, 0xFFFF }, { 0x0922, 0x0B04, 0x0E0A, 0x1321, 0x1129, 0xFFFF }, { 0x0C39, 0x1D0B, 0x191F, 0xFFFF
- }, { 0x082A, 0x1413, 0x1705, 0x1517, 0xFFFF }, { 0x0930, 0x0A14, 0x0736, 0x0D08, 0x1323, 0x1035, 0x1227, 0xFFFF }, {
- 0x0A00, 0x0924, 0x0C06, 0x0638, 0x1B09, 0x0A3B, 0x0E2F, 0xFFFF }, { 0x0B1A, 0x1411, 0x1619, 0x073D, 0xFFFF }, { 0x1331,
- 0x1603, 0x1515, 0x1907, 0x112B, 0xFFFF }, { 0x0A12, 0x0834, 0x053A, 0x1501, 0x1233, 0x1325, 0x0F37, 0x171B, 0x102D,
- 0x181D, 0xFFFF }, { 0x0926, 0x072E, 0x1229, 0xFFFF }, { 0x1421, 0x0D39, 0x1E0B, 0x1A1F, 0xFFFF }, { 0x0A10, 0x1513,
- 0x1617, 0xFFFF }, { 0x0B18, 0x082C, 0x1135, 0x1805, 0x1327, 0xFFFF }, { 0x0932, 0x0B02, 0x1423, 0x0B3B, 0x0F2F, 0xFFFF
- }, { 0x0928, 0x0C1C, 0x1511, 0x1719, 0x1C09, 0xFFFF }, { 0x0A20, 0x1703, 0x1615, 0x1A07, 0x122B, 0x083D, 0xFFFF }, {
- 0x1431, 0x1601, 0x1333, 0x112D, 0x191D, 0xFFFF }, { 0x0B16, 0x043C, 0x0D1E, 0x1425, 0x1037, 0x1329, 0x181B, 0xFFFF }, {
- 0x0A22, 0x0C04, 0x0F0A, 0x1521, 0x0E39, 0x1F0B, 0x1B1F, 0xFFFF }, { 0x1613, 0x1717, 0xFFFF }, { 0x092A, 0x1235, 0x1905,
- 0xFFFF }, { 0x0A30, 0x0B14, 0x0836, 0x0E08, 0x1523, 0x1427, 0xFFFF }, { 0x0B00, 0x0A24, 0x0D06, 0x0738, 0x1611, 0x1D09,
- 0x0C3B, 0x102F, 0xFFFF }, { 0x0C1A, 0x1715, 0x1B07, 0x1819, 0x132B, 0x093D, 0xFFFF }, { 0x1531, 0x1701, 0x1803, 0x122D,
- 0x1A1D, 0xFFFF }, { 0x0B12, 0x0934, 0x063A, 0x1433, 0x1525, 0x1137, 0x191B, 0xFFFF }, { 0x0A26, 0x003E, 0x082E, 0x1621,
- 0x0F39, 0x1429, 0x003F, 0xFFFF }, { 0x1713, 0x1C1F, 0xFFFF }, { 0x0B10, 0x1335, 0x1A05, 0x1817, 0xFFFF }, { 0x0C18,
- 0x092C, 0x1623, 0x1527, 0xFFFF }, { 0x0A32, 0x0C02, 0x1711, 0x1E09, 0x0D3B, 0x112F, 0xFFFF }, { 0x0A28, 0x0D1C, 0x1919,
- 0x0A3D, 0xFFFF }, { 0x0B20, 0x1631, 0x1903, 0x1815, 0x1C07, 0x142B, 0x132D, 0x1B1D, 0xFFFF }, { 0x1801, 0x1533, 0x1625,
- 0x1237, 0x1A1B, 0xFFFF }, { 0x0C16, 0x053C, 0x0E1E, 0x1721, 0x1529, 0x013F, 0xFFFF }, { 0x0B22, 0x0D04, 0x1039, 0x1D1F,
- 0xFFFF }, { 0x1813, 0x1B05, 0x1917, 0xFFFF }, { 0x0A2A, 0x1723, 0x1435, 0x1627, 0xFFFF }, { 0x0B30, 0x0C14, 0x0936,
- 0x0F08, 0x1F09, 0x0E3B, 0x122F, 0xFFFF }, { 0x0C00, 0x0B24, 0x0E06, 0x0838, 0x1811, 0x1A19, 0x0B3D, 0xFFFF }, { 0x0D1A,
- 0x1731, 0x1A03, 0x1915, 0x1D07, 0x152B, 0xFFFF }, { 0x1901, 0x1633, 0x1725, 0x1337, 0x1B1B, 0x142D, 0x1C1D, 0xFFFF }, {
- 0x0C12, 0x0A34, 0x073A, 0x1629, 0x023F, 0xFFFF }, { 0x0B26, 0x013E, 0x092E, 0x1821, 0x1139, 0x1E1F, 0xFFFF }, { 0x1913,
- 0x1A17, 0xFFFF }, { 0x0C10, 0x1535, 0x1C05, 0x1727, 0xFFFF }, { 0x0D18, 0x0A2C, 0x1823, 0x0F3B, 0x132F, 0xFFFF }, {
- 0x0B32, 0x0D02, 0x1911, 0x1B19, 0xFFFF }, { 0x0B28, 0x0E1C, 0x1B03, 0x1A15, 0x1E07, 0x162B, 0x0C3D, 0xFFFF }, { 0x0C20,
- 0x1831, 0x1A01, 0x1733, 0x152D, 0x1D1D, 0xFFFF }, { 0x1825, 0x1437, 0x1729, 0x1C1B, 0x033F, 0xFFFF }, { 0x0D16, 0x063C,
- 0x0F1E, 0x1921, 0x1239, 0x1F1F, 0xFFFF }, { 0x0C22, 0x0E04, 0x1A13, 0x1B17, 0xFFFF }, { 0x1635, 0x1D05, 0xFFFF }, {
- 0x0B2A, 0x1923, 0x1827, 0xFFFF }, { 0x0C30, 0x0D14, 0x0A36, 0x1A11, 0x103B, 0x142F, 0xFFFF }, { 0x0D00, 0x0C24, 0x0F06,
- 0x0938, 0x1B15, 0x1F07, 0x1C19, 0x172B, 0x0D3D, 0xFFFF }, { 0x0E1A, 0x1931, 0x1B01, 0x1C03, 0x162D, 0x1E1D, 0xFFFF }, {
- 0x1833, 0x1925, 0x1537, 0x1D1B, 0xFFFF }, { 0x0D12, 0x0B34, 0x083A, 0x1A21, 0x1339, 0x1829, 0x043F, 0xFFFF }, { 0x0C26,
- 0x023E, 0x0A2E, 0x1B13, 0xFFFF }, { 0x1735, 0x1E05, 0x1C17, 0xFFFF }, { 0x0D10, 0x1A23, 0x1927, 0xFFFF }, { 0x0E18,
- 0x0B2C, 0x1B11, 0x113B, 0x152F, 0xFFFF }, { 0x0C32, 0x0E02, 0x1D19, 0x0E3D, 0xFFFF }, { 0x0C28, 0x0F1C, 0x1A31, 0x1D03,
- 0x1C15, 0x182B, 0x172D, 0x1F1D, 0xFFFF }, { 0x0D20, 0x1C01, 0x1933, 0x1A25, 0x1637, 0x1E1B, 0xFFFF }, { 0x1B21, 0x1929,
- 0x053F, 0xFFFF }, { 0x0E16, 0x073C, 0x1439, 0xFFFF }, { 0x0D22, 0x0F04, 0x1C13, 0x1F05, 0x1D17, 0xFFFF }, { 0x1B23,
- 0x1835, 0x1A27, 0xFFFF }, { 0x0C2A, 0x123B, 0x162F, 0xFFFF }, { 0x0D30, 0x0E14, 0x0B36, 0x1C11, 0x1E19, 0x0F3D, 0xFFFF
- }, { 0x0E00, 0x0D24, 0x0A38, 0x1B31, 0x1E03, 0x1D15, 0x192B, 0xFFFF }, { 0x0F1A, 0x1D01, 0x1A33, 0x1B25, 0x1737, 0x1F1B,
- 0x182D, 0xFFFF }, { 0x1A29, 0x063F, 0xFFFF }, { 0x0E12, 0x0C34, 0x093A, 0x1C21, 0x1539, 0xFFFF }, { 0x0D26, 0x033E,
- 0x0B2E, 0x1D13, 0x1E17, 0xFFFF }, { 0x1935, 0x1B27, 0xFFFF }, { 0x0E10, 0x1C23, 0x133B, 0x172F, 0xFFFF }, { 0x0F18,
- 0x0C2C, 0x1D11, 0x1F19, 0xFFFF }, { 0x0D32, 0x0F02, 0x1F03, 0x1E15, 0x1A2B, 0x103D, 0xFFFF }, { 0x0D28, 0x1C31, 0x1E01,
- 0x1B33, 0x192D, 0xFFFF }, { 0x0E20, 0x1C25, 0x1837, 0x1B29, 0x073F, 0xFFFF }, { 0x1D21, 0x1639, 0xFFFF }, { 0x0F16,
- 0x083C, 0x1E13, 0x1F17, 0xFFFF }, { 0x0E22, 0x1A35, 0xFFFF }, { 0x1D23, 0x1C27, 0xFFFF }, { 0x0D2A, 0x1E11, 0x143B,
- 0x182F, 0xFFFF }, { 0x0E30, 0x0F14, 0x0C36, 0x1F15, 0x1B2B, 0x113D, 0xFFFF }, { 0x0F00, 0x0E24, 0x0B38, 0x1D31, 0x1F01,
- 0x1A2D, 0xFFFF }, { 0x1C33, 0x1D25, 0x1937, 0xFFFF }, { 0x1E21, 0x1739, 0x1C29, 0x083F, 0xFFFF }, { 0x0F12, 0x0D34,
- 0x0A3A, 0x1F13, 0xFFFF }, { 0x0E26, 0x043E, 0x0C2E, 0x1B35, 0xFFFF }, { 0x1E23, 0x1D27, 0xFFFF }, { 0x0F10, 0x1F11,
- 0x153B, 0x192F, 0xFFFF }, { 0x0D2C, 0x123D, 0xFFFF },
- };
-
- struct etc1_block
- {
- // big endian uint64:
- // bit ofs: 56 48 40 32 24 16 8 0
- // byte ofs: b0, b1, b2, b3, b4, b5, b6, b7
- union
- {
- uint64 m_uint64;
- uint8 m_bytes[8];
- };
-
- uint8 m_low_color[2];
- uint8 m_high_color[2];
-
- enum { cNumSelectorBytes = 4 };
- uint8 m_selectors[cNumSelectorBytes];
-
- inline void clear()
- {
- zero_this(this);
- }
-
- inline uint get_byte_bits(uint ofs, uint num) const
- {
- RG_ETC1_ASSERT((ofs + num) <= 64U);
- RG_ETC1_ASSERT(num && (num <= 8U));
- RG_ETC1_ASSERT((ofs >> 3) == ((ofs + num - 1) >> 3));
- const uint byte_ofs = 7 - (ofs >> 3);
- const uint byte_bit_ofs = ofs & 7;
- return (m_bytes[byte_ofs] >> byte_bit_ofs) & ((1 << num) - 1);
- }
-
- inline void set_byte_bits(uint ofs, uint num, uint bits)
- {
- RG_ETC1_ASSERT((ofs + num) <= 64U);
- RG_ETC1_ASSERT(num && (num < 32U));
- RG_ETC1_ASSERT((ofs >> 3) == ((ofs + num - 1) >> 3));
- RG_ETC1_ASSERT(bits < (1U << num));
- const uint byte_ofs = 7 - (ofs >> 3);
- const uint byte_bit_ofs = ofs & 7;
- const uint mask = (1 << num) - 1;
- m_bytes[byte_ofs] &= ~(mask << byte_bit_ofs);
- m_bytes[byte_ofs] |= (bits << byte_bit_ofs);
- }
-
- // false = left/right subblocks
- // true = upper/lower subblocks
- inline bool get_flip_bit() const
- {
- return (m_bytes[3] & 1) != 0;
- }
-
- inline void set_flip_bit(bool flip)
- {
- m_bytes[3] &= ~1;
- m_bytes[3] |= static_cast<uint8>(flip);
- }
-
- inline bool get_diff_bit() const
- {
- return (m_bytes[3] & 2) != 0;
- }
-
- inline void set_diff_bit(bool diff)
- {
- m_bytes[3] &= ~2;
- m_bytes[3] |= (static_cast<uint>(diff) << 1);
- }
-
- // Returns intensity modifier table (0-7) used by subblock subblock_id.
- // subblock_id=0 left/top (CW 1), 1=right/bottom (CW 2)
- inline uint get_inten_table(uint subblock_id) const
- {
- RG_ETC1_ASSERT(subblock_id < 2);
- const uint ofs = subblock_id ? 2 : 5;
- return (m_bytes[3] >> ofs) & 7;
- }
-
- // Sets intensity modifier table (0-7) used by subblock subblock_id (0 or 1)
- inline void set_inten_table(uint subblock_id, uint t)
- {
- RG_ETC1_ASSERT(subblock_id < 2);
- RG_ETC1_ASSERT(t < 8);
- const uint ofs = subblock_id ? 2 : 5;
- m_bytes[3] &= ~(7 << ofs);
- m_bytes[3] |= (t << ofs);
- }
-
- // Returned selector value ranges from 0-3 and is a direct index into g_etc1_inten_tables.
- inline uint get_selector(uint x, uint y) const
- {
- RG_ETC1_ASSERT((x | y) < 4);
-
- const uint bit_index = x * 4 + y;
- const uint byte_bit_ofs = bit_index & 7;
- const uint8 *p = &m_bytes[7 - (bit_index >> 3)];
- const uint lsb = (p[0] >> byte_bit_ofs) & 1;
- const uint msb = (p[-2] >> byte_bit_ofs) & 1;
- const uint val = lsb | (msb << 1);
-
- return g_etc1_to_selector_index[val];
- }
-
- // Selector "val" ranges from 0-3 and is a direct index into g_etc1_inten_tables.
- inline void set_selector(uint x, uint y, uint val)
- {
- RG_ETC1_ASSERT((x | y | val) < 4);
- const uint bit_index = x * 4 + y;
-
- uint8 *p = &m_bytes[7 - (bit_index >> 3)];
-
- const uint byte_bit_ofs = bit_index & 7;
- const uint mask = 1 << byte_bit_ofs;
-
- const uint etc1_val = g_selector_index_to_etc1[val];
-
- const uint lsb = etc1_val & 1;
- const uint msb = etc1_val >> 1;
-
- p[0] &= ~mask;
- p[0] |= (lsb << byte_bit_ofs);
-
- p[-2] &= ~mask;
- p[-2] |= (msb << byte_bit_ofs);
- }
-
- inline void set_base4_color(uint idx, uint16 c)
- {
- if (idx)
- {
- set_byte_bits(cETC1AbsColor4R2BitOffset, 4, (c >> 8) & 15);
- set_byte_bits(cETC1AbsColor4G2BitOffset, 4, (c >> 4) & 15);
- set_byte_bits(cETC1AbsColor4B2BitOffset, 4, c & 15);
- }
- else
- {
- set_byte_bits(cETC1AbsColor4R1BitOffset, 4, (c >> 8) & 15);
- set_byte_bits(cETC1AbsColor4G1BitOffset, 4, (c >> 4) & 15);
- set_byte_bits(cETC1AbsColor4B1BitOffset, 4, c & 15);
- }
- }
-
- inline uint16 get_base4_color(uint idx) const
- {
- uint r, g, b;
- if (idx)
- {
- r = get_byte_bits(cETC1AbsColor4R2BitOffset, 4);
- g = get_byte_bits(cETC1AbsColor4G2BitOffset, 4);
- b = get_byte_bits(cETC1AbsColor4B2BitOffset, 4);
- }
- else
- {
- r = get_byte_bits(cETC1AbsColor4R1BitOffset, 4);
- g = get_byte_bits(cETC1AbsColor4G1BitOffset, 4);
- b = get_byte_bits(cETC1AbsColor4B1BitOffset, 4);
- }
- return static_cast<uint16>(b | (g << 4U) | (r << 8U));
- }
-
- inline void set_base5_color(uint16 c)
- {
- set_byte_bits(cETC1BaseColor5RBitOffset, 5, (c >> 10) & 31);
- set_byte_bits(cETC1BaseColor5GBitOffset, 5, (c >> 5) & 31);
- set_byte_bits(cETC1BaseColor5BBitOffset, 5, c & 31);
- }
-
- inline uint16 get_base5_color() const
- {
- const uint r = get_byte_bits(cETC1BaseColor5RBitOffset, 5);
- const uint g = get_byte_bits(cETC1BaseColor5GBitOffset, 5);
- const uint b = get_byte_bits(cETC1BaseColor5BBitOffset, 5);
- return static_cast<uint16>(b | (g << 5U) | (r << 10U));
- }
-
- void set_delta3_color(uint16 c)
- {
- set_byte_bits(cETC1DeltaColor3RBitOffset, 3, (c >> 6) & 7);
- set_byte_bits(cETC1DeltaColor3GBitOffset, 3, (c >> 3) & 7);
- set_byte_bits(cETC1DeltaColor3BBitOffset, 3, c & 7);
- }
-
- inline uint16 get_delta3_color() const
- {
- const uint r = get_byte_bits(cETC1DeltaColor3RBitOffset, 3);
- const uint g = get_byte_bits(cETC1DeltaColor3GBitOffset, 3);
- const uint b = get_byte_bits(cETC1DeltaColor3BBitOffset, 3);
- return static_cast<uint16>(b | (g << 3U) | (r << 6U));
- }
-
- // Base color 5
- static uint16 pack_color5(const color_quad_u8& color, bool scaled, uint bias = 127U);
- static uint16 pack_color5(uint r, uint g, uint b, bool scaled, uint bias = 127U);
-
- static color_quad_u8 unpack_color5(uint16 packed_color5, bool scaled, uint alpha = 255U);
- static void unpack_color5(uint& r, uint& g, uint& b, uint16 packed_color, bool scaled);
-
- static bool unpack_color5(color_quad_u8& result, uint16 packed_color5, uint16 packed_delta3, bool scaled, uint alpha = 255U);
- static bool unpack_color5(uint& r, uint& g, uint& b, uint16 packed_color5, uint16 packed_delta3, bool scaled, uint alpha = 255U);
-
- // Delta color 3
- // Inputs range from -4 to 3 (cETC1ColorDeltaMin to cETC1ColorDeltaMax)
- static uint16 pack_delta3(int r, int g, int b);
-
- // Results range from -4 to 3 (cETC1ColorDeltaMin to cETC1ColorDeltaMax)
- static void unpack_delta3(int& r, int& g, int& b, uint16 packed_delta3);
-
- // Abs color 4
- static uint16 pack_color4(const color_quad_u8& color, bool scaled, uint bias = 127U);
- static uint16 pack_color4(uint r, uint g, uint b, bool scaled, uint bias = 127U);
-
- static color_quad_u8 unpack_color4(uint16 packed_color4, bool scaled, uint alpha = 255U);
- static void unpack_color4(uint& r, uint& g, uint& b, uint16 packed_color4, bool scaled);
-
- // subblock colors
- static void get_diff_subblock_colors(color_quad_u8* pDst, uint16 packed_color5, uint table_idx);
- static bool get_diff_subblock_colors(color_quad_u8* pDst, uint16 packed_color5, uint16 packed_delta3, uint table_idx);
- static void get_abs_subblock_colors(color_quad_u8* pDst, uint16 packed_color4, uint table_idx);
-
- static inline void unscaled_to_scaled_color(color_quad_u8& dst, const color_quad_u8& src, bool color4)
- {
- if (color4)
- {
- dst.r = src.r | (src.r << 4);
- dst.g = src.g | (src.g << 4);
- dst.b = src.b | (src.b << 4);
- }
- else
- {
- dst.r = (src.r >> 2) | (src.r << 3);
- dst.g = (src.g >> 2) | (src.g << 3);
- dst.b = (src.b >> 2) | (src.b << 3);
- }
- dst.a = src.a;
- }
- };
-
- // Returns pointer to sorted array.
- template<typename T, typename Q>
- T* indirect_radix_sort(uint num_indices, T* pIndices0, T* pIndices1, const Q* pKeys, uint key_ofs, uint key_size, bool init_indices)
- {
- RG_ETC1_ASSERT((key_ofs >= 0) && (key_ofs < sizeof(T)));
- RG_ETC1_ASSERT((key_size >= 1) && (key_size <= 4));
-
- if (init_indices)
- {
- T* p = pIndices0;
- T* q = pIndices0 + (num_indices >> 1) * 2;
- uint i;
- for (i = 0; p != q; p += 2, i += 2)
- {
- p[0] = static_cast<T>(i);
- p[1] = static_cast<T>(i + 1);
- }
-
- if (num_indices & 1)
- *p = static_cast<T>(i);
- }
-
- uint hist[256 * 4];
-
- memset(hist, 0, sizeof(hist[0]) * 256 * key_size);
-
-#define RG_ETC1_GET_KEY(p) (*(const uint*)((const uint8*)(pKeys + *(p)) + key_ofs))
-#define RG_ETC1_GET_KEY_FROM_INDEX(i) (*(const uint*)((const uint8*)(pKeys + (i)) + key_ofs))
-
- if (key_size == 4)
- {
- T* p = pIndices0;
- T* q = pIndices0 + num_indices;
- for ( ; p != q; p++)
- {
- const uint key = RG_ETC1_GET_KEY(p);
-
- hist[ key & 0xFF]++;
- hist[256 + ((key >> 8) & 0xFF)]++;
- hist[512 + ((key >> 16) & 0xFF)]++;
- hist[768 + ((key >> 24) & 0xFF)]++;
- }
- }
- else if (key_size == 3)
- {
- T* p = pIndices0;
- T* q = pIndices0 + num_indices;
- for ( ; p != q; p++)
- {
- const uint key = RG_ETC1_GET_KEY(p);
-
- hist[ key & 0xFF]++;
- hist[256 + ((key >> 8) & 0xFF)]++;
- hist[512 + ((key >> 16) & 0xFF)]++;
- }
- }
- else if (key_size == 2)
- {
- T* p = pIndices0;
- T* q = pIndices0 + (num_indices >> 1) * 2;
-
- for ( ; p != q; p += 2)
- {
- const uint key0 = RG_ETC1_GET_KEY(p);
- const uint key1 = RG_ETC1_GET_KEY(p+1);
-
- hist[ key0 & 0xFF]++;
- hist[256 + ((key0 >> 8) & 0xFF)]++;
-
- hist[ key1 & 0xFF]++;
- hist[256 + ((key1 >> 8) & 0xFF)]++;
- }
-
- if (num_indices & 1)
- {
- const uint key = RG_ETC1_GET_KEY(p);
-
- hist[ key & 0xFF]++;
- hist[256 + ((key >> 8) & 0xFF)]++;
- }
- }
- else
- {
- RG_ETC1_ASSERT(key_size == 1);
- if (key_size != 1)
- return NULL;
-
- T* p = pIndices0;
- T* q = pIndices0 + (num_indices >> 1) * 2;
-
- for ( ; p != q; p += 2)
- {
- const uint key0 = RG_ETC1_GET_KEY(p);
- const uint key1 = RG_ETC1_GET_KEY(p+1);
-
- hist[key0 & 0xFF]++;
- hist[key1 & 0xFF]++;
- }
-
- if (num_indices & 1)
- {
- const uint key = RG_ETC1_GET_KEY(p);
-
- hist[key & 0xFF]++;
- }
- }
-
- T* pCur = pIndices0;
- T* pNew = pIndices1;
-
- for (uint pass = 0; pass < key_size; pass++)
- {
- const uint* pHist = &hist[pass << 8];
-
- uint offsets[256];
-
- uint cur_ofs = 0;
- for (uint i = 0; i < 256; i += 2)
- {
- offsets[i] = cur_ofs;
- cur_ofs += pHist[i];
-
- offsets[i+1] = cur_ofs;
- cur_ofs += pHist[i+1];
- }
-
- const uint pass_shift = pass << 3;
-
- T* p = pCur;
- T* q = pCur + (num_indices >> 1) * 2;
-
- for ( ; p != q; p += 2)
- {
- uint index0 = p[0];
- uint index1 = p[1];
-
- uint c0 = (RG_ETC1_GET_KEY_FROM_INDEX(index0) >> pass_shift) & 0xFF;
- uint c1 = (RG_ETC1_GET_KEY_FROM_INDEX(index1) >> pass_shift) & 0xFF;
-
- if (c0 == c1)
- {
- uint dst_offset0 = offsets[c0];
-
- offsets[c0] = dst_offset0 + 2;
-
- pNew[dst_offset0] = static_cast<T>(index0);
- pNew[dst_offset0 + 1] = static_cast<T>(index1);
- }
- else
- {
- uint dst_offset0 = offsets[c0]++;
- uint dst_offset1 = offsets[c1]++;
-
- pNew[dst_offset0] = static_cast<T>(index0);
- pNew[dst_offset1] = static_cast<T>(index1);
- }
- }
-
- if (num_indices & 1)
- {
- uint index = *p;
- uint c = (RG_ETC1_GET_KEY_FROM_INDEX(index) >> pass_shift) & 0xFF;
-
- uint dst_offset = offsets[c];
- offsets[c] = dst_offset + 1;
-
- pNew[dst_offset] = static_cast<T>(index);
- }
-
- T* t = pCur;
- pCur = pNew;
- pNew = t;
- }
-
- return pCur;
- }
-
-#undef RG_ETC1_GET_KEY
-#undef RG_ETC1_GET_KEY_FROM_INDEX
-
- uint16 etc1_block::pack_color5(const color_quad_u8& color, bool scaled, uint bias)
- {
- return pack_color5(color.r, color.g, color.b, scaled, bias);
- }
-
- uint16 etc1_block::pack_color5(uint r, uint g, uint b, bool scaled, uint bias)
- {
- if (scaled)
- {
- r = (r * 31U + bias) / 255U;
- g = (g * 31U + bias) / 255U;
- b = (b * 31U + bias) / 255U;
- }
-
- r = rg_etc1::minimum(r, 31U);
- g = rg_etc1::minimum(g, 31U);
- b = rg_etc1::minimum(b, 31U);
-
- return static_cast<uint16>(b | (g << 5U) | (r << 10U));
- }
-
- color_quad_u8 etc1_block::unpack_color5(uint16 packed_color5, bool scaled, uint alpha)
- {
- uint b = packed_color5 & 31U;
- uint g = (packed_color5 >> 5U) & 31U;
- uint r = (packed_color5 >> 10U) & 31U;
-
- if (scaled)
- {
- b = (b << 3U) | (b >> 2U);
- g = (g << 3U) | (g >> 2U);
- r = (r << 3U) | (r >> 2U);
- }
-
- return color_quad_u8(cNoClamp, r, g, b, rg_etc1::minimum(alpha, 255U));
- }
-
- void etc1_block::unpack_color5(uint& r, uint& g, uint& b, uint16 packed_color5, bool scaled)
- {
- color_quad_u8 c(unpack_color5(packed_color5, scaled, 0));
- r = c.r;
- g = c.g;
- b = c.b;
- }
-
- bool etc1_block::unpack_color5(color_quad_u8& result, uint16 packed_color5, uint16 packed_delta3, bool scaled, uint alpha)
- {
- int dc_r, dc_g, dc_b;
- unpack_delta3(dc_r, dc_g, dc_b, packed_delta3);
-
- int b = (packed_color5 & 31U) + dc_b;
- int g = ((packed_color5 >> 5U) & 31U) + dc_g;
- int r = ((packed_color5 >> 10U) & 31U) + dc_r;
-
- bool success = true;
- if (static_cast<uint>(r | g | b) > 31U)
- {
- success = false;
- r = rg_etc1::clamp<int>(r, 0, 31);
- g = rg_etc1::clamp<int>(g, 0, 31);
- b = rg_etc1::clamp<int>(b, 0, 31);
- }
-
- if (scaled)
- {
- b = (b << 3U) | (b >> 2U);
- g = (g << 3U) | (g >> 2U);
- r = (r << 3U) | (r >> 2U);
- }
-
- result.set_noclamp_rgba(r, g, b, rg_etc1::minimum(alpha, 255U));
- return success;
- }
-
- bool etc1_block::unpack_color5(uint& r, uint& g, uint& b, uint16 packed_color5, uint16 packed_delta3, bool scaled, uint alpha)
- {
- color_quad_u8 result;
- const bool success = unpack_color5(result, packed_color5, packed_delta3, scaled, alpha);
- r = result.r;
- g = result.g;
- b = result.b;
- return success;
- }
-
- uint16 etc1_block::pack_delta3(int r, int g, int b)
- {
- RG_ETC1_ASSERT((r >= cETC1ColorDeltaMin) && (r <= cETC1ColorDeltaMax));
- RG_ETC1_ASSERT((g >= cETC1ColorDeltaMin) && (g <= cETC1ColorDeltaMax));
- RG_ETC1_ASSERT((b >= cETC1ColorDeltaMin) && (b <= cETC1ColorDeltaMax));
- if (r < 0) r += 8;
- if (g < 0) g += 8;
- if (b < 0) b += 8;
- return static_cast<uint16>(b | (g << 3) | (r << 6));
- }
-
- void etc1_block::unpack_delta3(int& r, int& g, int& b, uint16 packed_delta3)
- {
- r = (packed_delta3 >> 6) & 7;
- g = (packed_delta3 >> 3) & 7;
- b = packed_delta3 & 7;
- if (r >= 4) r -= 8;
- if (g >= 4) g -= 8;
- if (b >= 4) b -= 8;
- }
-
- uint16 etc1_block::pack_color4(const color_quad_u8& color, bool scaled, uint bias)
- {
- return pack_color4(color.r, color.g, color.b, scaled, bias);
- }
-
- uint16 etc1_block::pack_color4(uint r, uint g, uint b, bool scaled, uint bias)
- {
- if (scaled)
- {
- r = (r * 15U + bias) / 255U;
- g = (g * 15U + bias) / 255U;
- b = (b * 15U + bias) / 255U;
- }
-
- r = rg_etc1::minimum(r, 15U);
- g = rg_etc1::minimum(g, 15U);
- b = rg_etc1::minimum(b, 15U);
-
- return static_cast<uint16>(b | (g << 4U) | (r << 8U));
- }
-
- color_quad_u8 etc1_block::unpack_color4(uint16 packed_color4, bool scaled, uint alpha)
- {
- uint b = packed_color4 & 15U;
- uint g = (packed_color4 >> 4U) & 15U;
- uint r = (packed_color4 >> 8U) & 15U;
-
- if (scaled)
- {
- b = (b << 4U) | b;
- g = (g << 4U) | g;
- r = (r << 4U) | r;
- }
-
- return color_quad_u8(cNoClamp, r, g, b, rg_etc1::minimum(alpha, 255U));
- }
-
- void etc1_block::unpack_color4(uint& r, uint& g, uint& b, uint16 packed_color4, bool scaled)
- {
- color_quad_u8 c(unpack_color4(packed_color4, scaled, 0));
- r = c.r;
- g = c.g;
- b = c.b;
- }
-
- void etc1_block::get_diff_subblock_colors(color_quad_u8* pDst, uint16 packed_color5, uint table_idx)
- {
- RG_ETC1_ASSERT(table_idx < cETC1IntenModifierValues);
- const int *pInten_modifer_table = &g_etc1_inten_tables[table_idx][0];
-
- uint r, g, b;
- unpack_color5(r, g, b, packed_color5, true);
-
- const int ir = static_cast<int>(r), ig = static_cast<int>(g), ib = static_cast<int>(b);
-
- const int y0 = pInten_modifer_table[0];
- pDst[0].set(ir + y0, ig + y0, ib + y0);
-
- const int y1 = pInten_modifer_table[1];
- pDst[1].set(ir + y1, ig + y1, ib + y1);
-
- const int y2 = pInten_modifer_table[2];
- pDst[2].set(ir + y2, ig + y2, ib + y2);
-
- const int y3 = pInten_modifer_table[3];
- pDst[3].set(ir + y3, ig + y3, ib + y3);
- }
-
- bool etc1_block::get_diff_subblock_colors(color_quad_u8* pDst, uint16 packed_color5, uint16 packed_delta3, uint table_idx)
- {
- RG_ETC1_ASSERT(table_idx < cETC1IntenModifierValues);
- const int *pInten_modifer_table = &g_etc1_inten_tables[table_idx][0];
-
- uint r, g, b;
- bool success = unpack_color5(r, g, b, packed_color5, packed_delta3, true);
-
- const int ir = static_cast<int>(r), ig = static_cast<int>(g), ib = static_cast<int>(b);
-
- const int y0 = pInten_modifer_table[0];
- pDst[0].set(ir + y0, ig + y0, ib + y0);
-
- const int y1 = pInten_modifer_table[1];
- pDst[1].set(ir + y1, ig + y1, ib + y1);
-
- const int y2 = pInten_modifer_table[2];
- pDst[2].set(ir + y2, ig + y2, ib + y2);
-
- const int y3 = pInten_modifer_table[3];
- pDst[3].set(ir + y3, ig + y3, ib + y3);
-
- return success;
- }
-
- void etc1_block::get_abs_subblock_colors(color_quad_u8* pDst, uint16 packed_color4, uint table_idx)
- {
- RG_ETC1_ASSERT(table_idx < cETC1IntenModifierValues);
- const int *pInten_modifer_table = &g_etc1_inten_tables[table_idx][0];
-
- uint r, g, b;
- unpack_color4(r, g, b, packed_color4, true);
-
- const int ir = static_cast<int>(r), ig = static_cast<int>(g), ib = static_cast<int>(b);
-
- const int y0 = pInten_modifer_table[0];
- pDst[0].set(ir + y0, ig + y0, ib + y0);
-
- const int y1 = pInten_modifer_table[1];
- pDst[1].set(ir + y1, ig + y1, ib + y1);
-
- const int y2 = pInten_modifer_table[2];
- pDst[2].set(ir + y2, ig + y2, ib + y2);
-
- const int y3 = pInten_modifer_table[3];
- pDst[3].set(ir + y3, ig + y3, ib + y3);
- }
-
- bool unpack_etc1_block(const void* pETC1_block, unsigned int* pDst_pixels_rgba, bool preserve_alpha)
- {
- color_quad_u8* pDst = reinterpret_cast<color_quad_u8*>(pDst_pixels_rgba);
- const etc1_block& block = *static_cast<const etc1_block*>(pETC1_block);
-
- const bool diff_flag = block.get_diff_bit();
- const bool flip_flag = block.get_flip_bit();
- const uint table_index0 = block.get_inten_table(0);
- const uint table_index1 = block.get_inten_table(1);
-
- color_quad_u8 subblock_colors0[4];
- color_quad_u8 subblock_colors1[4];
- bool success = true;
-
- if (diff_flag)
- {
- const uint16 base_color5 = block.get_base5_color();
- const uint16 delta_color3 = block.get_delta3_color();
- etc1_block::get_diff_subblock_colors(subblock_colors0, base_color5, table_index0);
-
- if (!etc1_block::get_diff_subblock_colors(subblock_colors1, base_color5, delta_color3, table_index1))
- success = false;
- }
- else
- {
- const uint16 base_color4_0 = block.get_base4_color(0);
- etc1_block::get_abs_subblock_colors(subblock_colors0, base_color4_0, table_index0);
-
- const uint16 base_color4_1 = block.get_base4_color(1);
- etc1_block::get_abs_subblock_colors(subblock_colors1, base_color4_1, table_index1);
- }
-
- if (preserve_alpha)
- {
- if (flip_flag)
- {
- for (uint y = 0; y < 2; y++)
- {
- pDst[0].set_rgb(subblock_colors0[block.get_selector(0, y)]);
- pDst[1].set_rgb(subblock_colors0[block.get_selector(1, y)]);
- pDst[2].set_rgb(subblock_colors0[block.get_selector(2, y)]);
- pDst[3].set_rgb(subblock_colors0[block.get_selector(3, y)]);
- pDst += 4;
- }
-
- for (uint y = 2; y < 4; y++)
- {
- pDst[0].set_rgb(subblock_colors1[block.get_selector(0, y)]);
- pDst[1].set_rgb(subblock_colors1[block.get_selector(1, y)]);
- pDst[2].set_rgb(subblock_colors1[block.get_selector(2, y)]);
- pDst[3].set_rgb(subblock_colors1[block.get_selector(3, y)]);
- pDst += 4;
- }
- }
- else
- {
- for (uint y = 0; y < 4; y++)
- {
- pDst[0].set_rgb(subblock_colors0[block.get_selector(0, y)]);
- pDst[1].set_rgb(subblock_colors0[block.get_selector(1, y)]);
- pDst[2].set_rgb(subblock_colors1[block.get_selector(2, y)]);
- pDst[3].set_rgb(subblock_colors1[block.get_selector(3, y)]);
- pDst += 4;
- }
- }
- }
- else
- {
- if (flip_flag)
- {
- // 0000
- // 0000
- // 1111
- // 1111
- for (uint y = 0; y < 2; y++)
- {
- pDst[0] = subblock_colors0[block.get_selector(0, y)];
- pDst[1] = subblock_colors0[block.get_selector(1, y)];
- pDst[2] = subblock_colors0[block.get_selector(2, y)];
- pDst[3] = subblock_colors0[block.get_selector(3, y)];
- pDst += 4;
- }
-
- for (uint y = 2; y < 4; y++)
- {
- pDst[0] = subblock_colors1[block.get_selector(0, y)];
- pDst[1] = subblock_colors1[block.get_selector(1, y)];
- pDst[2] = subblock_colors1[block.get_selector(2, y)];
- pDst[3] = subblock_colors1[block.get_selector(3, y)];
- pDst += 4;
- }
- }
- else
- {
- // 0011
- // 0011
- // 0011
- // 0011
- for (uint y = 0; y < 4; y++)
- {
- pDst[0] = subblock_colors0[block.get_selector(0, y)];
- pDst[1] = subblock_colors0[block.get_selector(1, y)];
- pDst[2] = subblock_colors1[block.get_selector(2, y)];
- pDst[3] = subblock_colors1[block.get_selector(3, y)];
- pDst += 4;
- }
- }
- }
-
- return success;
- }
-
- struct etc1_solution_coordinates
- {
- inline etc1_solution_coordinates() :
- m_unscaled_color(0, 0, 0, 0),
- m_inten_table(0),
- m_color4(false)
- {
- }
-
- inline etc1_solution_coordinates(uint r, uint g, uint b, uint inten_table, bool color4) :
- m_unscaled_color(r, g, b, 255),
- m_inten_table(inten_table),
- m_color4(color4)
- {
- }
-
- inline etc1_solution_coordinates(const color_quad_u8& c, uint inten_table, bool color4) :
- m_unscaled_color(c),
- m_inten_table(inten_table),
- m_color4(color4)
- {
- }
-
- inline etc1_solution_coordinates(const etc1_solution_coordinates& other)
- {
- *this = other;
- }
-
- inline etc1_solution_coordinates& operator= (const etc1_solution_coordinates& rhs)
- {
- m_unscaled_color = rhs.m_unscaled_color;
- m_inten_table = rhs.m_inten_table;
- m_color4 = rhs.m_color4;
- return *this;
- }
-
- inline void clear()
- {
- m_unscaled_color.clear();
- m_inten_table = 0;
- m_color4 = false;
- }
-
- inline color_quad_u8 get_scaled_color() const
- {
- int br, bg, bb;
- if (m_color4)
- {
- br = m_unscaled_color.r | (m_unscaled_color.r << 4);
- bg = m_unscaled_color.g | (m_unscaled_color.g << 4);
- bb = m_unscaled_color.b | (m_unscaled_color.b << 4);
- }
- else
- {
- br = (m_unscaled_color.r >> 2) | (m_unscaled_color.r << 3);
- bg = (m_unscaled_color.g >> 2) | (m_unscaled_color.g << 3);
- bb = (m_unscaled_color.b >> 2) | (m_unscaled_color.b << 3);
- }
- return color_quad_u8(br, bg, bb);
- }
-
- inline void get_block_colors(color_quad_u8* pBlock_colors)
- {
- int br, bg, bb;
- if (m_color4)
- {
- br = m_unscaled_color.r | (m_unscaled_color.r << 4);
- bg = m_unscaled_color.g | (m_unscaled_color.g << 4);
- bb = m_unscaled_color.b | (m_unscaled_color.b << 4);
- }
- else
- {
- br = (m_unscaled_color.r >> 2) | (m_unscaled_color.r << 3);
- bg = (m_unscaled_color.g >> 2) | (m_unscaled_color.g << 3);
- bb = (m_unscaled_color.b >> 2) | (m_unscaled_color.b << 3);
- }
- const int* pInten_table = g_etc1_inten_tables[m_inten_table];
- pBlock_colors[0].set(br + pInten_table[0], bg + pInten_table[0], bb + pInten_table[0]);
- pBlock_colors[1].set(br + pInten_table[1], bg + pInten_table[1], bb + pInten_table[1]);
- pBlock_colors[2].set(br + pInten_table[2], bg + pInten_table[2], bb + pInten_table[2]);
- pBlock_colors[3].set(br + pInten_table[3], bg + pInten_table[3], bb + pInten_table[3]);
- }
-
- color_quad_u8 m_unscaled_color;
- uint m_inten_table;
- bool m_color4;
- };
-
- class etc1_optimizer
- {
- etc1_optimizer(const etc1_optimizer&);
- etc1_optimizer& operator= (const etc1_optimizer&);
-
- public:
- etc1_optimizer()
- {
- clear();
- }
-
- void clear()
- {
- m_pParams = NULL;
- m_pResult = NULL;
- m_pSorted_luma = NULL;
- m_pSorted_luma_indices = NULL;
- }
-
- struct params : etc1_pack_params
- {
- params()
- {
- clear();
- }
-
- params(const etc1_pack_params& base_params) :
- etc1_pack_params(base_params)
- {
- clear_optimizer_params();
- }
-
- void clear()
- {
- etc1_pack_params::clear();
- clear_optimizer_params();
- }
-
- void clear_optimizer_params()
- {
- m_num_src_pixels = 0;
- m_pSrc_pixels = 0;
-
- m_use_color4 = false;
- static const int s_default_scan_delta[] = { 0 };
- m_pScan_deltas = s_default_scan_delta;
- m_scan_delta_size = 1;
-
- m_base_color5.clear();
- m_constrain_against_base_color5 = false;
- }
-
- uint m_num_src_pixels;
- const color_quad_u8* m_pSrc_pixels;
-
- bool m_use_color4;
- const int* m_pScan_deltas;
- uint m_scan_delta_size;
-
- color_quad_u8 m_base_color5;
- bool m_constrain_against_base_color5;
- };
-
- struct results
- {
- uint64 m_error;
- color_quad_u8 m_block_color_unscaled;
- uint m_block_inten_table;
- uint m_n;
- uint8* m_pSelectors;
- bool m_block_color4;
-
- inline results& operator= (const results& rhs)
- {
- m_block_color_unscaled = rhs.m_block_color_unscaled;
- m_block_color4 = rhs.m_block_color4;
- m_block_inten_table = rhs.m_block_inten_table;
- m_error = rhs.m_error;
- RG_ETC1_ASSERT(m_n == rhs.m_n);
- memcpy(m_pSelectors, rhs.m_pSelectors, rhs.m_n);
- return *this;
- }
- };
-
- void init(const params& params, results& result);
- bool compute();
-
- private:
- struct potential_solution
- {
- potential_solution() : m_coords(), m_error(cUINT64_MAX), m_valid(false)
- {
- }
-
- etc1_solution_coordinates m_coords;
- uint8 m_selectors[8];
- uint64 m_error;
- bool m_valid;
-
- void clear()
- {
- m_coords.clear();
- m_error = cUINT64_MAX;
- m_valid = false;
- }
- };
-
- const params* m_pParams;
- results* m_pResult;
-
- int m_limit;
-
- vec3F m_avg_color;
- int m_br, m_bg, m_bb;
- uint16 m_luma[8];
- uint32 m_sorted_luma[2][8];
- const uint32* m_pSorted_luma_indices;
- uint32* m_pSorted_luma;
-
- uint8 m_selectors[8];
- uint8 m_best_selectors[8];
-
- potential_solution m_best_solution;
- potential_solution m_trial_solution;
- uint8 m_temp_selectors[8];
-
- bool evaluate_solution(const etc1_solution_coordinates& coords, potential_solution& trial_solution, potential_solution* pBest_solution);
- bool evaluate_solution_fast(const etc1_solution_coordinates& coords, potential_solution& trial_solution, potential_solution* pBest_solution);
- };
-
- bool etc1_optimizer::compute()
- {
- const uint n = m_pParams->m_num_src_pixels;
- const int scan_delta_size = m_pParams->m_scan_delta_size;
-
- // Scan through a subset of the 3D lattice centered around the avg block color trying each 3D (555 or 444) lattice point as a potential block color.
- // Each time a better solution is found try to refine the current solution's block color based of the current selectors and intensity table index.
- for (int zdi = 0; zdi < scan_delta_size; zdi++)
- {
- const int zd = m_pParams->m_pScan_deltas[zdi];
- const int mbb = m_bb + zd;
- if (mbb < 0) continue; else if (mbb > m_limit) break;
-
- for (int ydi = 0; ydi < scan_delta_size; ydi++)
- {
- const int yd = m_pParams->m_pScan_deltas[ydi];
- const int mbg = m_bg + yd;
- if (mbg < 0) continue; else if (mbg > m_limit) break;
-
- for (int xdi = 0; xdi < scan_delta_size; xdi++)
- {
- const int xd = m_pParams->m_pScan_deltas[xdi];
- const int mbr = m_br + xd;
- if (mbr < 0) continue; else if (mbr > m_limit) break;
-
- etc1_solution_coordinates coords(mbr, mbg, mbb, 0, m_pParams->m_use_color4);
- if (m_pParams->m_quality == cHighQuality)
- {
- if (!evaluate_solution(coords, m_trial_solution, &m_best_solution))
- continue;
- }
- else
- {
- if (!evaluate_solution_fast(coords, m_trial_solution, &m_best_solution))
- continue;
- }
-
- // Now we have the input block, the avg. color of the input pixels, a set of trial selector indices, and the block color+intensity index.
- // Now, for each component, attempt to refine the current solution by solving a simple linear equation. For example, for 4 colors:
- // The goal is:
- // pixel0 - (block_color+inten_table[selector0]) + pixel1 - (block_color+inten_table[selector1]) + pixel2 - (block_color+inten_table[selector2]) + pixel3 - (block_color+inten_table[selector3]) = 0
- // Rearranging this:
- // (pixel0 + pixel1 + pixel2 + pixel3) - (block_color+inten_table[selector0]) - (block_color+inten_table[selector1]) - (block_color+inten_table[selector2]) - (block_color+inten_table[selector3]) = 0
- // (pixel0 + pixel1 + pixel2 + pixel3) - block_color - inten_table[selector0] - block_color-inten_table[selector1] - block_color-inten_table[selector2] - block_color-inten_table[selector3] = 0
- // (pixel0 + pixel1 + pixel2 + pixel3) - 4*block_color - inten_table[selector0] - inten_table[selector1] - inten_table[selector2] - inten_table[selector3] = 0
- // (pixel0 + pixel1 + pixel2 + pixel3) - 4*block_color - (inten_table[selector0] + inten_table[selector1] + inten_table[selector2] + inten_table[selector3]) = 0
- // (pixel0 + pixel1 + pixel2 + pixel3)/4 - block_color - (inten_table[selector0] + inten_table[selector1] + inten_table[selector2] + inten_table[selector3])/4 = 0
- // block_color = (pixel0 + pixel1 + pixel2 + pixel3)/4 - (inten_table[selector0] + inten_table[selector1] + inten_table[selector2] + inten_table[selector3])/4
- // So what this means:
- // optimal_block_color = avg_input - avg_inten_delta
- // So the optimal block color can be computed by taking the average block color and subtracting the current average of the intensity delta.
- // Unfortunately, optimal_block_color must then be quantized to 555 or 444 so it's not always possible to improve matters using this formula.
- // Also, the above formula is for unclamped intensity deltas. The actual implementation takes into account clamping.
-
- const uint max_refinement_trials = (m_pParams->m_quality == cLowQuality) ? 2 : (((xd | yd | zd) == 0) ? 4 : 2);
- for (uint refinement_trial = 0; refinement_trial < max_refinement_trials; refinement_trial++)
- {
- const uint8* pSelectors = m_best_solution.m_selectors;
- const int* pInten_table = g_etc1_inten_tables[m_best_solution.m_coords.m_inten_table];
-
- int delta_sum_r = 0, delta_sum_g = 0, delta_sum_b = 0;
- const color_quad_u8 base_color(m_best_solution.m_coords.get_scaled_color());
- for (uint r = 0; r < n; r++)
- {
- const uint s = *pSelectors++;
- const int yd = pInten_table[s];
- // Compute actual delta being applied to each pixel, taking into account clamping.
- delta_sum_r += rg_etc1::clamp<int>(base_color.r + yd, 0, 255) - base_color.r;
- delta_sum_g += rg_etc1::clamp<int>(base_color.g + yd, 0, 255) - base_color.g;
- delta_sum_b += rg_etc1::clamp<int>(base_color.b + yd, 0, 255) - base_color.b;
- }
- if ((!delta_sum_r) && (!delta_sum_g) && (!delta_sum_b))
- break;
- const float avg_delta_r_f = static_cast<float>(delta_sum_r) / n;
- const float avg_delta_g_f = static_cast<float>(delta_sum_g) / n;
- const float avg_delta_b_f = static_cast<float>(delta_sum_b) / n;
- const int br1 = rg_etc1::clamp<int>(static_cast<uint>((m_avg_color[0] - avg_delta_r_f) * m_limit / 255.0f + .5f), 0, m_limit);
- const int bg1 = rg_etc1::clamp<int>(static_cast<uint>((m_avg_color[1] - avg_delta_g_f) * m_limit / 255.0f + .5f), 0, m_limit);
- const int bb1 = rg_etc1::clamp<int>(static_cast<uint>((m_avg_color[2] - avg_delta_b_f) * m_limit / 255.0f + .5f), 0, m_limit);
-
- bool skip = false;
-
- if ((mbr == br1) && (mbg == bg1) && (mbb == bb1))
- skip = true;
- else if ((br1 == m_best_solution.m_coords.m_unscaled_color.r) && (bg1 == m_best_solution.m_coords.m_unscaled_color.g) && (bb1 == m_best_solution.m_coords.m_unscaled_color.b))
- skip = true;
- else if ((m_br == br1) && (m_bg == bg1) && (m_bb == bb1))
- skip = true;
-
- if (skip)
- break;
-
- etc1_solution_coordinates coords1(br1, bg1, bb1, 0, m_pParams->m_use_color4);
- if (m_pParams->m_quality == cHighQuality)
- {
- if (!evaluate_solution(coords1, m_trial_solution, &m_best_solution))
- break;
- }
- else
- {
- if (!evaluate_solution_fast(coords1, m_trial_solution, &m_best_solution))
- break;
- }
-
- } // refinement_trial
-
- } // xdi
- } // ydi
- } // zdi
-
- if (!m_best_solution.m_valid)
- {
- m_pResult->m_error = cUINT32_MAX;
- return false;
- }
-
- const uint8* pSelectors = m_best_solution.m_selectors;
-
-#ifdef RG_ETC1_BUILD_DEBUG
- {
- color_quad_u8 block_colors[4];
- m_best_solution.m_coords.get_block_colors(block_colors);
-
- const color_quad_u8* pSrc_pixels = m_pParams->m_pSrc_pixels;
- uint64 actual_error = 0;
- for (uint i = 0; i < n; i++)
- actual_error += pSrc_pixels[i].squared_distance_rgb(block_colors[pSelectors[i]]);
-
- RG_ETC1_ASSERT(actual_error == m_best_solution.m_error);
- }
-#endif
-
- m_pResult->m_error = m_best_solution.m_error;
-
- m_pResult->m_block_color_unscaled = m_best_solution.m_coords.m_unscaled_color;
- m_pResult->m_block_color4 = m_best_solution.m_coords.m_color4;
-
- m_pResult->m_block_inten_table = m_best_solution.m_coords.m_inten_table;
- memcpy(m_pResult->m_pSelectors, pSelectors, n);
- m_pResult->m_n = n;
-
- return true;
- }
-
- void etc1_optimizer::init(const params& p, results& r)
- {
- // This version is hardcoded for 8 pixel subblocks.
- RG_ETC1_ASSERT(p.m_num_src_pixels == 8);
-
- m_pParams = &p;
- m_pResult = &r;
-
- const uint n = 8;
-
- m_limit = m_pParams->m_use_color4 ? 15 : 31;
-
- vec3F avg_color(0.0f);
-
- for (uint i = 0; i < n; i++)
- {
- const color_quad_u8& c = m_pParams->m_pSrc_pixels[i];
- const vec3F fc(c.r, c.g, c.b);
-
- avg_color += fc;
-
- m_luma[i] = static_cast<uint16>(c.r + c.g + c.b);
- m_sorted_luma[0][i] = i;
- }
- avg_color *= (1.0f / static_cast<float>(n));
- m_avg_color = avg_color;
-
- m_br = rg_etc1::clamp<int>(static_cast<uint>(m_avg_color[0] * m_limit / 255.0f + .5f), 0, m_limit);
- m_bg = rg_etc1::clamp<int>(static_cast<uint>(m_avg_color[1] * m_limit / 255.0f + .5f), 0, m_limit);
- m_bb = rg_etc1::clamp<int>(static_cast<uint>(m_avg_color[2] * m_limit / 255.0f + .5f), 0, m_limit);
-
- if (m_pParams->m_quality <= cMediumQuality)
- {
- m_pSorted_luma_indices = indirect_radix_sort(n, m_sorted_luma[0], m_sorted_luma[1], m_luma, 0, sizeof(m_luma[0]), false);
- m_pSorted_luma = m_sorted_luma[0];
- if (m_pSorted_luma_indices == m_sorted_luma[0])
- m_pSorted_luma = m_sorted_luma[1];
-
- for (uint i = 0; i < n; i++)
- m_pSorted_luma[i] = m_luma[m_pSorted_luma_indices[i]];
- }
-
- m_best_solution.m_coords.clear();
- m_best_solution.m_valid = false;
- m_best_solution.m_error = cUINT64_MAX;
- }
-
- bool etc1_optimizer::evaluate_solution(const etc1_solution_coordinates& coords, potential_solution& trial_solution, potential_solution* pBest_solution)
- {
- trial_solution.m_valid = false;
-
- if (m_pParams->m_constrain_against_base_color5)
- {
- const int dr = coords.m_unscaled_color.r - m_pParams->m_base_color5.r;
- const int dg = coords.m_unscaled_color.g - m_pParams->m_base_color5.g;
- const int db = coords.m_unscaled_color.b - m_pParams->m_base_color5.b;
-
- if ((rg_etc1::minimum(dr, dg, db) < cETC1ColorDeltaMin) || (rg_etc1::maximum(dr, dg, db) > cETC1ColorDeltaMax))
- return false;
- }
-
- const color_quad_u8 base_color(coords.get_scaled_color());
-
- const uint n = 8;
-
- trial_solution.m_error = cUINT64_MAX;
-
- for (uint inten_table = 0; inten_table < cETC1IntenModifierValues; inten_table++)
- {
- const int* pInten_table = g_etc1_inten_tables[inten_table];
-
- color_quad_u8 block_colors[4];
- for (uint s = 0; s < 4; s++)
- {
- const int yd = pInten_table[s];
- block_colors[s].set(base_color.r + yd, base_color.g + yd, base_color.b + yd, 0);
- }
-
- uint64 total_error = 0;
-
- const color_quad_u8* pSrc_pixels = m_pParams->m_pSrc_pixels;
- for (uint c = 0; c < n; c++)
- {
- const color_quad_u8& src_pixel = *pSrc_pixels++;
-
- uint best_selector_index = 0;
- uint best_error = rg_etc1::square(src_pixel.r - block_colors[0].r) + rg_etc1::square(src_pixel.g - block_colors[0].g) + rg_etc1::square(src_pixel.b - block_colors[0].b);
-
- uint trial_error = rg_etc1::square(src_pixel.r - block_colors[1].r) + rg_etc1::square(src_pixel.g - block_colors[1].g) + rg_etc1::square(src_pixel.b - block_colors[1].b);
- if (trial_error < best_error)
- {
- best_error = trial_error;
- best_selector_index = 1;
- }
-
- trial_error = rg_etc1::square(src_pixel.r - block_colors[2].r) + rg_etc1::square(src_pixel.g - block_colors[2].g) + rg_etc1::square(src_pixel.b - block_colors[2].b);
- if (trial_error < best_error)
- {
- best_error = trial_error;
- best_selector_index = 2;
- }
-
- trial_error = rg_etc1::square(src_pixel.r - block_colors[3].r) + rg_etc1::square(src_pixel.g - block_colors[3].g) + rg_etc1::square(src_pixel.b - block_colors[3].b);
- if (trial_error < best_error)
- {
- best_error = trial_error;
- best_selector_index = 3;
- }
-
- m_temp_selectors[c] = static_cast<uint8>(best_selector_index);
-
- total_error += best_error;
- if (total_error >= trial_solution.m_error)
- break;
- }
-
- if (total_error < trial_solution.m_error)
- {
- trial_solution.m_error = total_error;
- trial_solution.m_coords.m_inten_table = inten_table;
- memcpy(trial_solution.m_selectors, m_temp_selectors, 8);
- trial_solution.m_valid = true;
- }
- }
- trial_solution.m_coords.m_unscaled_color = coords.m_unscaled_color;
- trial_solution.m_coords.m_color4 = m_pParams->m_use_color4;
-
- bool success = false;
- if (pBest_solution)
- {
- if (trial_solution.m_error < pBest_solution->m_error)
- {
- *pBest_solution = trial_solution;
- success = true;
- }
- }
-
- return success;
- }
-
- bool etc1_optimizer::evaluate_solution_fast(const etc1_solution_coordinates& coords, potential_solution& trial_solution, potential_solution* pBest_solution)
- {
- if (m_pParams->m_constrain_against_base_color5)
- {
- const int dr = coords.m_unscaled_color.r - m_pParams->m_base_color5.r;
- const int dg = coords.m_unscaled_color.g - m_pParams->m_base_color5.g;
- const int db = coords.m_unscaled_color.b - m_pParams->m_base_color5.b;
-
- if ((rg_etc1::minimum(dr, dg, db) < cETC1ColorDeltaMin) || (rg_etc1::maximum(dr, dg, db) > cETC1ColorDeltaMax))
- {
- trial_solution.m_valid = false;
- return false;
- }
- }
-
- const color_quad_u8 base_color(coords.get_scaled_color());
-
- const uint n = 8;
-
- trial_solution.m_error = cUINT64_MAX;
-
- for (int inten_table = cETC1IntenModifierValues - 1; inten_table >= 0; --inten_table)
- {
- const int* pInten_table = g_etc1_inten_tables[inten_table];
-
- uint block_inten[4];
- color_quad_u8 block_colors[4];
- for (uint s = 0; s < 4; s++)
- {
- const int yd = pInten_table[s];
- color_quad_u8 block_color(base_color.r + yd, base_color.g + yd, base_color.b + yd, 0);
- block_colors[s] = block_color;
- block_inten[s] = block_color.r + block_color.g + block_color.b;
- }
-
- // evaluate_solution_fast() enforces/assumesd a total ordering of the input colors along the intensity (1,1,1) axis to more quickly classify the inputs to selectors.
- // The inputs colors have been presorted along the projection onto this axis, and ETC1 block colors are always ordered along the intensity axis, so this classification is fast.
- // 0 1 2 3
- // 01 12 23
- const uint block_inten_midpoints[3] = { block_inten[0] + block_inten[1], block_inten[1] + block_inten[2], block_inten[2] + block_inten[3] };
-
- uint64 total_error = 0;
- const color_quad_u8* pSrc_pixels = m_pParams->m_pSrc_pixels;
- if ((m_pSorted_luma[n - 1] * 2) < block_inten_midpoints[0])
- {
- if (block_inten[0] > m_pSorted_luma[n - 1])
- {
- const uint min_error = labs(block_inten[0] - m_pSorted_luma[n - 1]);
- if (min_error >= trial_solution.m_error)
- continue;
- }
-
- memset(&m_temp_selectors[0], 0, n);
-
- for (uint c = 0; c < n; c++)
- total_error += block_colors[0].squared_distance_rgb(pSrc_pixels[c]);
- }
- else if ((m_pSorted_luma[0] * 2) >= block_inten_midpoints[2])
- {
- if (m_pSorted_luma[0] > block_inten[3])
- {
- const uint min_error = labs(m_pSorted_luma[0] - block_inten[3]);
- if (min_error >= trial_solution.m_error)
- continue;
- }
-
- memset(&m_temp_selectors[0], 3, n);
-
- for (uint c = 0; c < n; c++)
- total_error += block_colors[3].squared_distance_rgb(pSrc_pixels[c]);
- }
- else
- {
- uint cur_selector = 0, c;
- for (c = 0; c < n; c++)
- {
- const uint y = m_pSorted_luma[c];
- while ((y * 2) >= block_inten_midpoints[cur_selector])
- if (++cur_selector > 2)
- goto done;
- const uint sorted_pixel_index = m_pSorted_luma_indices[c];
- m_temp_selectors[sorted_pixel_index] = static_cast<uint8>(cur_selector);
- total_error += block_colors[cur_selector].squared_distance_rgb(pSrc_pixels[sorted_pixel_index]);
- }
-done:
- while (c < n)
- {
- const uint sorted_pixel_index = m_pSorted_luma_indices[c];
- m_temp_selectors[sorted_pixel_index] = 3;
- total_error += block_colors[3].squared_distance_rgb(pSrc_pixels[sorted_pixel_index]);
- ++c;
- }
- }
-
- if (total_error < trial_solution.m_error)
- {
- trial_solution.m_error = total_error;
- trial_solution.m_coords.m_inten_table = inten_table;
- memcpy(trial_solution.m_selectors, m_temp_selectors, n);
- trial_solution.m_valid = true;
- if (!total_error)
- break;
- }
- }
- trial_solution.m_coords.m_unscaled_color = coords.m_unscaled_color;
- trial_solution.m_coords.m_color4 = m_pParams->m_use_color4;
-
- bool success = false;
- if (pBest_solution)
- {
- if (trial_solution.m_error < pBest_solution->m_error)
- {
- *pBest_solution = trial_solution;
- success = true;
- }
- }
-
- return success;
- }
-
- static uint etc1_decode_value(uint diff, uint inten, uint selector, uint packed_c)
- {
- const uint limit = diff ? 32 : 16; limit;
- RG_ETC1_ASSERT((diff < 2) && (inten < 8) && (selector < 4) && (packed_c < limit));
- int c;
- if (diff)
- c = (packed_c >> 2) | (packed_c << 3);
- else
- c = packed_c | (packed_c << 4);
- c += g_etc1_inten_tables[inten][selector];
- c = rg_etc1::clamp<int>(c, 0, 255);
- return c;
- }
-
- static inline int mul_8bit(int a, int b) { int t = a*b + 128; return (t + (t >> 8)) >> 8; }
-
- void pack_etc1_block_init()
- {
- for (uint diff = 0; diff < 2; diff++)
- {
- const uint limit = diff ? 32 : 16;
-
- for (uint inten = 0; inten < 8; inten++)
- {
- for (uint selector = 0; selector < 4; selector++)
- {
- const uint inverse_table_index = diff + (inten << 1) + (selector << 4);
- for (uint color = 0; color < 256; color++)
- {
- uint best_error = cUINT32_MAX, best_packed_c = 0;
- for (uint packed_c = 0; packed_c < limit; packed_c++)
- {
- int v = etc1_decode_value(diff, inten, selector, packed_c);
- uint err = labs(v - color);
- if (err < best_error)
- {
- best_error = err;
- best_packed_c = packed_c;
- if (!best_error)
- break;
- }
- }
- RG_ETC1_ASSERT(best_error <= 255);
- g_etc1_inverse_lookup[inverse_table_index][color] = static_cast<uint16>(best_packed_c | (best_error << 8));
- }
- }
- }
- }
-
- uint expand5[32];
- for(int i = 0; i < 32; i++)
- expand5[i] = (i << 3) | (i >> 2);
-
- for(int i = 0; i < 256 + 16; i++)
- {
- int v = clamp<int>(i - 8, 0, 255);
- g_quant5_tab[i] = static_cast<uint8>(expand5[mul_8bit(v,31)]);
- }
- }
-
- // Packs solid color blocks efficiently using a set of small precomputed tables.
- // For random 888 inputs, MSE results are better than Erricson's ETC1 packer in "slow" mode ~9.5% of the time, is slightly worse only ~.01% of the time, and is equal the rest of the time.
- static uint64 pack_etc1_block_solid_color(etc1_block& block, const uint8* pColor, etc1_pack_params& pack_params)
- {
- pack_params;
- RG_ETC1_ASSERT(g_etc1_inverse_lookup[0][255]);
-
- static uint s_next_comp[4] = { 1, 2, 0, 1 };
-
- uint best_error = cUINT32_MAX, best_i = 0;
- int best_x = 0, best_packed_c1 = 0, best_packed_c2 = 0;
-
- // For each possible 8-bit value, there is a precomputed list of diff/inten/selector configurations that allow that 8-bit value to be encoded with no error.
- for (uint i = 0; i < 3; i++)
- {
- const uint c1 = pColor[s_next_comp[i]], c2 = pColor[s_next_comp[i + 1]];
-
- const int delta_range = 1;
- for (int delta = -delta_range; delta <= delta_range; delta++)
- {
- const int c_plus_delta = rg_etc1::clamp<int>(pColor[i] + delta, 0, 255);
-
- const uint16* pTable;
- if (!c_plus_delta)
- pTable = g_color8_to_etc_block_config_0_255[0];
- else if (c_plus_delta == 255)
- pTable = g_color8_to_etc_block_config_0_255[1];
- else
- pTable = g_color8_to_etc_block_config_1_to_254[c_plus_delta - 1];
-
- do
- {
- const uint x = *pTable++;
-
-#ifdef RG_ETC1_BUILD_DEBUG
- const uint diff = x & 1;
- const uint inten = (x >> 1) & 7;
- const uint selector = (x >> 4) & 3;
- const uint p0 = (x >> 8) & 255;
- RG_ETC1_ASSERT(etc1_decode_value(diff, inten, selector, p0) == (uint)c_plus_delta);
-#endif
-
- const uint16* pInverse_table = g_etc1_inverse_lookup[x & 0xFF];
- uint16 p1 = pInverse_table[c1];
- uint16 p2 = pInverse_table[c2];
- const uint trial_error = rg_etc1::square(c_plus_delta - pColor[i]) + rg_etc1::square(p1 >> 8) + rg_etc1::square(p2 >> 8);
- if (trial_error < best_error)
- {
- best_error = trial_error;
- best_x = x;
- best_packed_c1 = p1 & 0xFF;
- best_packed_c2 = p2 & 0xFF;
- best_i = i;
- if (!best_error)
- goto found_perfect_match;
- }
- } while (*pTable != 0xFFFF);
- }
- }
-found_perfect_match:
-
- const uint diff = best_x & 1;
- const uint inten = (best_x >> 1) & 7;
-
- block.m_bytes[3] = static_cast<uint8>(((inten | (inten << 3)) << 2) | (diff << 1));
-
- const uint etc1_selector = g_selector_index_to_etc1[(best_x >> 4) & 3];
- *reinterpret_cast<uint16*>(&block.m_bytes[4]) = (etc1_selector & 2) ? 0xFFFF : 0;
- *reinterpret_cast<uint16*>(&block.m_bytes[6]) = (etc1_selector & 1) ? 0xFFFF : 0;
-
- const uint best_packed_c0 = (best_x >> 8) & 255;
- if (diff)
- {
- block.m_bytes[best_i] = static_cast<uint8>(best_packed_c0 << 3);
- block.m_bytes[s_next_comp[best_i]] = static_cast<uint8>(best_packed_c1 << 3);
- block.m_bytes[s_next_comp[best_i+1]] = static_cast<uint8>(best_packed_c2 << 3);
- }
- else
- {
- block.m_bytes[best_i] = static_cast<uint8>(best_packed_c0 | (best_packed_c0 << 4));
- block.m_bytes[s_next_comp[best_i]] = static_cast<uint8>(best_packed_c1 | (best_packed_c1 << 4));
- block.m_bytes[s_next_comp[best_i+1]] = static_cast<uint8>(best_packed_c2 | (best_packed_c2 << 4));
- }
-
- return best_error;
- }
-
- static uint pack_etc1_block_solid_color_constrained(
- etc1_optimizer::results& results,
- uint num_colors, const uint8* pColor,
- etc1_pack_params& pack_params,
- bool use_diff,
- const color_quad_u8* pBase_color5_unscaled)
- {
- RG_ETC1_ASSERT(g_etc1_inverse_lookup[0][255]);
-
- pack_params;
- static uint s_next_comp[4] = { 1, 2, 0, 1 };
-
- uint best_error = cUINT32_MAX, best_i = 0;
- int best_x = 0, best_packed_c1 = 0, best_packed_c2 = 0;
-
- // For each possible 8-bit value, there is a precomputed list of diff/inten/selector configurations that allow that 8-bit value to be encoded with no error.
- for (uint i = 0; i < 3; i++)
- {
- const uint c1 = pColor[s_next_comp[i]], c2 = pColor[s_next_comp[i + 1]];
-
- const int delta_range = 1;
- for (int delta = -delta_range; delta <= delta_range; delta++)
- {
- const int c_plus_delta = rg_etc1::clamp<int>(pColor[i] + delta, 0, 255);
-
- const uint16* pTable;
- if (!c_plus_delta)
- pTable = g_color8_to_etc_block_config_0_255[0];
- else if (c_plus_delta == 255)
- pTable = g_color8_to_etc_block_config_0_255[1];
- else
- pTable = g_color8_to_etc_block_config_1_to_254[c_plus_delta - 1];
-
- do
- {
- const uint x = *pTable++;
- const uint diff = x & 1;
- if (static_cast<uint>(use_diff) != diff)
- {
- if (*pTable == 0xFFFF)
- break;
- continue;
- }
-
- if ((diff) && (pBase_color5_unscaled))
- {
- const int p0 = (x >> 8) & 255;
- int delta = p0 - static_cast<int>(pBase_color5_unscaled->c[i]);
- if ((delta < cETC1ColorDeltaMin) || (delta > cETC1ColorDeltaMax))
- {
- if (*pTable == 0xFFFF)
- break;
- continue;
- }
- }
-
-#ifdef RG_ETC1_BUILD_DEBUG
- {
- const uint inten = (x >> 1) & 7;
- const uint selector = (x >> 4) & 3;
- const uint p0 = (x >> 8) & 255;
- RG_ETC1_ASSERT(etc1_decode_value(diff, inten, selector, p0) == (uint)c_plus_delta);
- }
-#endif
-
- const uint16* pInverse_table = g_etc1_inverse_lookup[x & 0xFF];
- uint16 p1 = pInverse_table[c1];
- uint16 p2 = pInverse_table[c2];
-
- if ((diff) && (pBase_color5_unscaled))
- {
- int delta1 = (p1 & 0xFF) - static_cast<int>(pBase_color5_unscaled->c[s_next_comp[i]]);
- int delta2 = (p2 & 0xFF) - static_cast<int>(pBase_color5_unscaled->c[s_next_comp[i + 1]]);
- if ((delta1 < cETC1ColorDeltaMin) || (delta1 > cETC1ColorDeltaMax) || (delta2 < cETC1ColorDeltaMin) || (delta2 > cETC1ColorDeltaMax))
- {
- if (*pTable == 0xFFFF)
- break;
- continue;
- }
- }
-
- const uint trial_error = rg_etc1::square(c_plus_delta - pColor[i]) + rg_etc1::square(p1 >> 8) + rg_etc1::square(p2 >> 8);
- if (trial_error < best_error)
- {
- best_error = trial_error;
- best_x = x;
- best_packed_c1 = p1 & 0xFF;
- best_packed_c2 = p2 & 0xFF;
- best_i = i;
- if (!best_error)
- goto found_perfect_match;
- }
- } while (*pTable != 0xFFFF);
- }
- }
-found_perfect_match:
-
- if (best_error == cUINT32_MAX)
- return best_error;
-
- best_error *= num_colors;
-
- results.m_n = num_colors;
- results.m_block_color4 = !(best_x & 1);
- results.m_block_inten_table = (best_x >> 1) & 7;
- memset(results.m_pSelectors, (best_x >> 4) & 3, num_colors);
-
- const uint best_packed_c0 = (best_x >> 8) & 255;
- results.m_block_color_unscaled[best_i] = static_cast<uint8>(best_packed_c0);
- results.m_block_color_unscaled[s_next_comp[best_i]] = static_cast<uint8>(best_packed_c1);
- results.m_block_color_unscaled[s_next_comp[best_i + 1]] = static_cast<uint8>(best_packed_c2);
- results.m_error = best_error;
-
- return best_error;
- }
-
- // Function originally from RYG's public domain real-time DXT1 compressor, modified for 555.
- static void dither_block_555(color_quad_u8* dest, const color_quad_u8* block)
- {
- int err[8],*ep1 = err,*ep2 = err+4;
- uint8 *quant = g_quant5_tab+8;
-
- memset(dest, 0xFF, sizeof(color_quad_u8)*16);
-
- // process channels seperately
- for(int ch=0;ch<3;ch++)
- {
- uint8* bp = (uint8*)block;
- uint8* dp = (uint8*)dest;
-
- bp += ch; dp += ch;
-
- memset(err,0, sizeof(err));
- for(int y = 0; y < 4; y++)
- {
- // pixel 0
- dp[ 0] = quant[bp[ 0] + ((3*ep2[1] + 5*ep2[0]) >> 4)];
- ep1[0] = bp[ 0] - dp[ 0];
-
- // pixel 1
- dp[ 4] = quant[bp[ 4] + ((7*ep1[0] + 3*ep2[2] + 5*ep2[1] + ep2[0]) >> 4)];
- ep1[1] = bp[ 4] - dp[ 4];
-
- // pixel 2
- dp[ 8] = quant[bp[ 8] + ((7*ep1[1] + 3*ep2[3] + 5*ep2[2] + ep2[1]) >> 4)];
- ep1[2] = bp[ 8] - dp[ 8];
-
- // pixel 3
- dp[12] = quant[bp[12] + ((7*ep1[2] + 5*ep2[3] + ep2[2]) >> 4)];
- ep1[3] = bp[12] - dp[12];
-
- // advance to next line
- int* tmp = ep1; ep1 = ep2; ep2 = tmp;
- bp += 16;
- dp += 16;
- }
- }
- }
-
- unsigned int pack_etc1_block(void* pETC1_block, const unsigned int* pSrc_pixels_rgba, etc1_pack_params& pack_params)
- {
- const color_quad_u8* pSrc_pixels = reinterpret_cast<const color_quad_u8*>(pSrc_pixels_rgba);
- etc1_block& dst_block = *static_cast<etc1_block*>(pETC1_block);
-
-#ifdef RG_ETC1_BUILD_DEBUG
- // Ensure all alpha values are 0xFF.
- for (uint i = 0; i < 16; i++)
- {
- RG_ETC1_ASSERT(pSrc_pixels[i].a == 255);
- }
-#endif
-
- color_quad_u8 src_pixel0(pSrc_pixels[0]);
-
- // Check for solid block.
- const uint32 first_pixel_u32 = pSrc_pixels->m_u32;
- int r;
- for (r = 15; r >= 1; --r)
- if (pSrc_pixels[r].m_u32 != first_pixel_u32)
- break;
- if (!r)
- return static_cast<unsigned int>(16 * pack_etc1_block_solid_color(dst_block, &pSrc_pixels[0].r, pack_params));
-
- color_quad_u8 dithered_pixels[16];
- if (pack_params.m_dithering)
- {
- dither_block_555(dithered_pixels, pSrc_pixels);
- pSrc_pixels = dithered_pixels;
- }
-
- etc1_optimizer optimizer;
-
- uint64 best_error = cUINT64_MAX;
- uint best_flip = false, best_use_color4 = false;
-
- uint8 best_selectors[2][8];
- etc1_optimizer::results best_results[2];
- for (uint i = 0; i < 2; i++)
- {
- best_results[i].m_n = 8;
- best_results[i].m_pSelectors = best_selectors[i];
- }
-
- uint8 selectors[3][8];
- etc1_optimizer::results results[3];
-
- for (uint i = 0; i < 3; i++)
- {
- results[i].m_n = 8;
- results[i].m_pSelectors = selectors[i];
- }
-
- color_quad_u8 subblock_pixels[8];
-
- etc1_optimizer::params params(pack_params);
- params.m_num_src_pixels = 8;
- params.m_pSrc_pixels = subblock_pixels;
-
- for (uint flip = 0; flip < 2; flip++)
- {
- for (uint use_color4 = 0; use_color4 < 2; use_color4++)
- {
- uint64 trial_error = 0;
-
- uint subblock;
- for (subblock = 0; subblock < 2; subblock++)
- {
- if (flip)
- memcpy(subblock_pixels, pSrc_pixels + subblock * 8, sizeof(color_quad_u8) * 8);
- else
- {
- const color_quad_u8* pSrc_col = pSrc_pixels + subblock * 2;
- subblock_pixels[0] = pSrc_col[0]; subblock_pixels[1] = pSrc_col[4]; subblock_pixels[2] = pSrc_col[8]; subblock_pixels[3] = pSrc_col[12];
- subblock_pixels[4] = pSrc_col[1]; subblock_pixels[5] = pSrc_col[5]; subblock_pixels[6] = pSrc_col[9]; subblock_pixels[7] = pSrc_col[13];
- }
-
- results[2].m_error = cUINT64_MAX;
- if ((params.m_quality >= cMediumQuality) && ((subblock) || (use_color4)))
- {
- const uint32 subblock_pixel0_u32 = subblock_pixels[0].m_u32;
- for (r = 7; r >= 1; --r)
- if (subblock_pixels[r].m_u32 != subblock_pixel0_u32)
- break;
- if (!r)
- {
- pack_etc1_block_solid_color_constrained(results[2], 8, &subblock_pixels[0].r, pack_params, !use_color4, (subblock && !use_color4) ? &results[0].m_block_color_unscaled : NULL);
- }
- }
-
- params.m_use_color4 = (use_color4 != 0);
- params.m_constrain_against_base_color5 = false;
-
- if ((!use_color4) && (subblock))
- {
- params.m_constrain_against_base_color5 = true;
- params.m_base_color5 = results[0].m_block_color_unscaled;
- }
-
- if (params.m_quality == cHighQuality)
- {
- static const int s_scan_delta_0_to_4[] = { -4, -3, -2, -1, 0, 1, 2, 3, 4 };
- params.m_scan_delta_size = RG_ETC1_ARRAY_SIZE(s_scan_delta_0_to_4);
- params.m_pScan_deltas = s_scan_delta_0_to_4;
- }
- else if (params.m_quality == cMediumQuality)
- {
- static const int s_scan_delta_0_to_1[] = { -1, 0, 1 };
- params.m_scan_delta_size = RG_ETC1_ARRAY_SIZE(s_scan_delta_0_to_1);
- params.m_pScan_deltas = s_scan_delta_0_to_1;
- }
- else
- {
- static const int s_scan_delta_0[] = { 0 };
- params.m_scan_delta_size = RG_ETC1_ARRAY_SIZE(s_scan_delta_0);
- params.m_pScan_deltas = s_scan_delta_0;
- }
-
- optimizer.init(params, results[subblock]);
- if (!optimizer.compute())
- break;
-
- if (params.m_quality >= cMediumQuality)
- {
- // TODO: Fix fairly arbitrary/unrefined thresholds that control how far away to scan for potentially better solutions.
- const uint refinement_error_thresh0 = 3000;
- const uint refinement_error_thresh1 = 6000;
- if (results[subblock].m_error > refinement_error_thresh0)
- {
- if (params.m_quality == cMediumQuality)
- {
- static const int s_scan_delta_2_to_3[] = { -3, -2, 2, 3 };
- params.m_scan_delta_size = RG_ETC1_ARRAY_SIZE(s_scan_delta_2_to_3);
- params.m_pScan_deltas = s_scan_delta_2_to_3;
- }
- else
- {
- static const int s_scan_delta_5_to_5[] = { -5, 5 };
- static const int s_scan_delta_5_to_8[] = { -8, -7, -6, -5, 5, 6, 7, 8 };
- if (results[subblock].m_error > refinement_error_thresh1)
- {
- params.m_scan_delta_size = RG_ETC1_ARRAY_SIZE(s_scan_delta_5_to_8);
- params.m_pScan_deltas = s_scan_delta_5_to_8;
- }
- else
- {
- params.m_scan_delta_size = RG_ETC1_ARRAY_SIZE(s_scan_delta_5_to_5);
- params.m_pScan_deltas = s_scan_delta_5_to_5;
- }
- }
-
- if (!optimizer.compute())
- break;
- }
-
- if (results[2].m_error < results[subblock].m_error)
- results[subblock] = results[2];
- }
-
- trial_error += results[subblock].m_error;
- if (trial_error >= best_error)
- break;
- }
-
- if (subblock < 2)
- continue;
-
- best_error = trial_error;
- best_results[0] = results[0];
- best_results[1] = results[1];
- best_flip = flip;
- best_use_color4 = use_color4;
-
- } // use_color4
-
- } // flip
-
- int dr = best_results[1].m_block_color_unscaled.r - best_results[0].m_block_color_unscaled.r;
- int dg = best_results[1].m_block_color_unscaled.g - best_results[0].m_block_color_unscaled.g;
- int db = best_results[1].m_block_color_unscaled.b - best_results[0].m_block_color_unscaled.b;
- RG_ETC1_ASSERT(best_use_color4 || (rg_etc1::minimum(dr, dg, db) >= cETC1ColorDeltaMin) && (rg_etc1::maximum(dr, dg, db) <= cETC1ColorDeltaMax));
-
- if (best_use_color4)
- {
- dst_block.m_bytes[0] = static_cast<uint8>(best_results[1].m_block_color_unscaled.r | (best_results[0].m_block_color_unscaled.r << 4));
- dst_block.m_bytes[1] = static_cast<uint8>(best_results[1].m_block_color_unscaled.g | (best_results[0].m_block_color_unscaled.g << 4));
- dst_block.m_bytes[2] = static_cast<uint8>(best_results[1].m_block_color_unscaled.b | (best_results[0].m_block_color_unscaled.b << 4));
- }
- else
- {
- if (dr < 0) dr += 8; dst_block.m_bytes[0] = static_cast<uint8>((best_results[0].m_block_color_unscaled.r << 3) | dr);
- if (dg < 0) dg += 8; dst_block.m_bytes[1] = static_cast<uint8>((best_results[0].m_block_color_unscaled.g << 3) | dg);
- if (db < 0) db += 8; dst_block.m_bytes[2] = static_cast<uint8>((best_results[0].m_block_color_unscaled.b << 3) | db);
- }
-
- dst_block.m_bytes[3] = static_cast<uint8>( (best_results[1].m_block_inten_table << 2) | (best_results[0].m_block_inten_table << 5) | ((~best_use_color4 & 1) << 1) | best_flip );
-
- uint selector0 = 0, selector1 = 0;
- if (best_flip)
- {
- // flipped:
- // { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 },
- // { 0, 1 }, { 1, 1 }, { 2, 1 }, { 3, 1 }
- //
- // { 0, 2 }, { 1, 2 }, { 2, 2 }, { 3, 2 },
- // { 0, 3 }, { 1, 3 }, { 2, 3 }, { 3, 3 }
- const uint8* pSelectors0 = best_results[0].m_pSelectors;
- const uint8* pSelectors1 = best_results[1].m_pSelectors;
- for (int x = 3; x >= 0; --x)
- {
- uint b;
- b = g_selector_index_to_etc1[pSelectors1[4 + x]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
-
- b = g_selector_index_to_etc1[pSelectors1[x]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
-
- b = g_selector_index_to_etc1[pSelectors0[4 + x]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
-
- b = g_selector_index_to_etc1[pSelectors0[x]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
- }
- }
- else
- {
- // non-flipped:
- // { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 },
- // { 1, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 }
- //
- // { 2, 0 }, { 2, 1 }, { 2, 2 }, { 2, 3 },
- // { 3, 0 }, { 3, 1 }, { 3, 2 }, { 3, 3 }
- for (int subblock = 1; subblock >= 0; --subblock)
- {
- const uint8* pSelectors = best_results[subblock].m_pSelectors + 4;
- for (uint i = 0; i < 2; i++)
- {
- uint b;
- b = g_selector_index_to_etc1[pSelectors[3]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
-
- b = g_selector_index_to_etc1[pSelectors[2]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
-
- b = g_selector_index_to_etc1[pSelectors[1]];
- selector0 = (selector0 << 1) | (b & 1); selector1 = (selector1 << 1) | (b >> 1);
-
- b = g_selector_index_to_etc1[pSelectors[0]];
- selector0 = (selector0 << 1) | (b & 1);selector1 = (selector1 << 1) | (b >> 1);
-
- pSelectors -= 4;
- }
- }
- }
-
- dst_block.m_bytes[4] = static_cast<uint8>(selector1 >> 8); dst_block.m_bytes[5] = static_cast<uint8>(selector1 & 0xFF);
- dst_block.m_bytes[6] = static_cast<uint8>(selector0 >> 8); dst_block.m_bytes[7] = static_cast<uint8>(selector0 & 0xFF);
-
- return static_cast<unsigned int>(best_error);
- }
-
-} // namespace rg_etc1
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_rg_etc1.h b/Libraries/crunch-ea9b8d/crnlib/crn_rg_etc1.h
deleted file mode 100644
index ba8cad06..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_rg_etc1.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// File: rg_etc1.h - Fast, high quality ETC1 block packer/unpacker - Rich Geldreich <richgel99@gmail.com>
-// Please see ZLIB license at the end of this file.
-#pragma once
-
-namespace crnlib {
-
-namespace rg_etc1
-{
- // Unpacks an 8-byte ETC1 compressed block to a block of 4x4 32bpp RGBA pixels.
- // Returns false if the block is invalid. Invalid blocks will still be unpacked with clamping.
- // This function is thread safe, and does not dynamically allocate any memory.
- // If preserve_alpha is true, the alpha channel of the destination pixels will not be overwritten. Otherwise, alpha will be set to 255.
- bool unpack_etc1_block(const void *pETC1_block, unsigned int* pDst_pixels_rgba, bool preserve_alpha = false);
-
- // Quality setting = the higher the quality, the slower.
- // To pack large textures, it is highly recommended to call pack_etc1_block() in parallel, on different blocks, from multiple threads (particularly when using cHighQuality).
- enum etc1_quality
- {
- cLowQuality,
- cMediumQuality,
- cHighQuality,
- };
-
- struct etc1_pack_params
- {
- etc1_quality m_quality;
- bool m_dithering;
-
- inline etc1_pack_params()
- {
- clear();
- }
-
- void clear()
- {
- m_quality = cHighQuality;
- m_dithering = false;
- }
- };
-
- // Important: pack_etc1_block_init() must be called before calling pack_etc1_block().
- void pack_etc1_block_init();
-
- // Packs a 4x4 block of 32bpp RGBA pixels to an 8-byte ETC1 block.
- // 32-bit RGBA pixels must always be arranged as (R,G,B,A) (R first, A last) in memory, independent of platform endianness. A should always be 255.
- // Returns squared error of result.
- // This function is thread safe, and does not dynamically allocate any memory.
- // pack_etc1_block() does not currently support "perceptual" colorspace metrics - it primarily optimizes for RGB RMSE.
- unsigned int pack_etc1_block(void* pETC1_block, const unsigned int* pSrc_pixels_rgba, etc1_pack_params& pack_params);
-
-} // namespace rg_etc1
-
-} // namespace crnlib
-
-//------------------------------------------------------------------------------
-//
-// rg_etc1 uses the ZLIB license:
-// http://opensource.org/licenses/Zlib
-//
-// Copyright (c) 2012 Rich Geldreich
-//
-// This software is provided 'as-is', without any express or implied
-// warranty. In no event will the authors be held liable for any damages
-// arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it
-// freely, subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented; you must not
-// claim that you wrote the original software. If you use this software
-// in a product, an acknowledgment in the product documentation would be
-// appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such, and must not be
-// misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-//------------------------------------------------------------------------------
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_ryg_dxt.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_ryg_dxt.cpp
deleted file mode 100644
index fc2d7a52..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_ryg_dxt.cpp
+++ /dev/null
@@ -1,609 +0,0 @@
-// File: crn_ryg_dxt.cpp
-// RYG's real-time DXT compressor - Public domain.
-#include "crn_core.h"
-#include "crn_ryg_types.hpp"
-#include "crn_ryg_dxt.hpp"
-
-#ifdef _MSC_VER
-#pragma warning (disable: 4244) // conversion from 'a' to 'b', possible loss of data
-#endif
-
-namespace ryg_dxt
-{
- // Couple of tables...
- sU8 Expand5[32];
- sU8 Expand6[64];
- sU8 OMatch5[256][2];
- sU8 OMatch6[256][2];
- sU8 OMatch5_3[256][2];
- sU8 OMatch6_3[256][2];
- sU8 QuantRBTab[256+16];
- sU8 QuantGTab[256+16];
-
- static sInt Mul8Bit(sInt a,sInt b)
- {
- sInt t = a*b + 128;
- return (t + (t >> 8)) >> 8;
- }
-
- union Pixel
- {
- struct
- {
- sU8 b,g,r,a;
- };
- sU32 v;
-
- void From16Bit(sU16 v)
- {
- sInt rv = (v & 0xf800) >> 11;
- sInt gv = (v & 0x07e0) >> 5;
- sInt bv = (v & 0x001f) >> 0;
-
- a = 0;
- r = Expand5[rv];
- g = Expand6[gv];
- b = Expand5[bv];
- }
-
- sU16 As16Bit() const
- {
- return (Mul8Bit(r,31) << 11) + (Mul8Bit(g,63) << 5) + Mul8Bit(b,31);
- }
-
- void LerpRGB(const Pixel &p1,const Pixel &p2,sInt f)
- {
- r = p1.r + Mul8Bit(p2.r - p1.r,f);
- g = p1.g + Mul8Bit(p2.g - p1.g,f);
- b = p1.b + Mul8Bit(p2.b - p1.b,f);
- }
- };
-
- /****************************************************************************/
-
- static void PrepareOptTable4(sU8 *Table,const sU8 *expand,sInt size)
- {
- for(sInt i=0;i<256;i++)
- {
- sInt bestErr = 256;
-
- for(sInt min=0;min<size;min++)
- {
- for(sInt max=0;max<size;max++)
- {
- sInt mine = expand[min];
- sInt maxe = expand[max];
- //sInt err = sAbs(maxe + Mul8Bit(mine-maxe,0x55) - i);
- sInt err = sAbs(((maxe*2+mine)/3) - i);
- err += ((sAbs(maxe-mine)*8)>>8); // approx. .03f
-
- if(err < bestErr)
- {
- Table[i*2+0] = max;
- Table[i*2+1] = min;
- bestErr = err;
- }
- }
- }
- }
- }
-
- static void PrepareOptTable3(sU8 *Table,const sU8 *expand,sInt size)
- {
- for(sInt i=0;i<256;i++)
- {
- sInt bestErr = 256;
-
- for(sInt min=0;min<size;min++)
- {
- for(sInt max=0;max<size;max++)
- {
- sInt mine = expand[min];
- sInt maxe = expand[max];
- sInt err = sAbs(((mine + maxe) >> 1) - i);
- err += ((sAbs(maxe-mine)*8)>>8); // approx. .03f
-
- if(err < bestErr)
- {
- Table[i*2+0] = max;
- Table[i*2+1] = min;
- bestErr = err;
- }
- }
- }
- }
- }
-
- static inline void EvalColors(Pixel *color,sU16 c0,sU16 c1)
- {
- color[0].From16Bit(c0);
- color[1].From16Bit(c1);
- color[2].LerpRGB(color[0],color[1],0x55);
- color[3].LerpRGB(color[0],color[1],0xaa);
- }
-
- // Block dithering function. Simply dithers a block to 565 RGB.
- // (Floyd-Steinberg)
- static void DitherBlock(Pixel *dest,const Pixel *block)
- {
- sInt err[8],*ep1 = err,*ep2 = err+4;
-
- // process channels seperately
- for(sInt ch=0;ch<3;ch++)
- {
- sU8 *bp = (sU8 *) block;
- sU8 *dp = (sU8 *) dest;
- sU8 *quant = (ch == 1) ? QuantGTab+8 : QuantRBTab+8;
-
- bp += ch;
- dp += ch;
- sSetMem(err,0,sizeof(err));
-
- for(sInt y=0;y<4;y++)
- {
- // pixel 0
- dp[ 0] = quant[bp[ 0] + ((3*ep2[1] + 5*ep2[0]) >> 4)];
- ep1[0] = bp[ 0] - dp[ 0];
-
- // pixel 1
- dp[ 4] = quant[bp[ 4] + ((7*ep1[0] + 3*ep2[2] + 5*ep2[1] + ep2[0]) >> 4)];
- ep1[1] = bp[ 4] - dp[ 4];
-
- // pixel 2
- dp[ 8] = quant[bp[ 8] + ((7*ep1[1] + 3*ep2[3] + 5*ep2[2] + ep2[1]) >> 4)];
- ep1[2] = bp[ 8] - dp[ 8];
-
- // pixel 3
- dp[12] = quant[bp[12] + ((7*ep1[2] + 5*ep2[3] + ep2[2]) >> 4)];
- ep1[3] = bp[12] - dp[12];
-
- // advance to next line
- sSwap(ep1,ep2);
- bp += 16;
- dp += 16;
- }
- }
- }
-
- // The color matching function
- static sU32 MatchColorsBlock(const Pixel *block,const Pixel *color,sBool dither)
- {
- sU32 mask = 0;
- sInt dirr = color[0].r - color[1].r;
- sInt dirg = color[0].g - color[1].g;
- sInt dirb = color[0].b - color[1].b;
-
- sInt dots[16];
- for(sInt i=0;i<16;i++)
- dots[i] = block[i].r*dirr + block[i].g*dirg + block[i].b*dirb;
-
- sInt stops[4];
- for(sInt i=0;i<4;i++)
- stops[i] = color[i].r*dirr + color[i].g*dirg + color[i].b*dirb;
-
- sInt c0Point = (stops[1] + stops[3]) >> 1;
- sInt halfPoint = (stops[3] + stops[2]) >> 1;
- sInt c3Point = (stops[2] + stops[0]) >> 1;
-
- if(!dither)
- {
- // the version without dithering is straightforward
- for(sInt i=15;i>=0;i--)
- {
- mask <<= 2;
- sInt dot = dots[i];
-
- if(dot < halfPoint)
- mask |= (dot < c0Point) ? 1 : 3;
- else
- mask |= (dot < c3Point) ? 2 : 0;
- }
- }
- else
- {
- // with floyd-steinberg dithering (see above)
- sInt err[8],*ep1 = err,*ep2 = err+4;
- sInt *dp = dots;
-
- c0Point <<= 4;
- halfPoint <<= 4;
- c3Point <<= 4;
- for(sInt i=0;i<8;i++)
- err[i] = 0;
-
- for(sInt y=0;y<4;y++)
- {
- sInt dot,lmask,step;
-
- // pixel 0
- dot = (dp[0] << 4) + (3*ep2[1] + 5*ep2[0]);
- if(dot < halfPoint)
- step = (dot < c0Point) ? 1 : 3;
- else
- step = (dot < c3Point) ? 2 : 0;
-
- ep1[0] = dp[0] - stops[step];
- lmask = step;
-
- // pixel 1
- dot = (dp[1] << 4) + (7*ep1[0] + 3*ep2[2] + 5*ep2[1] + ep2[0]);
- if(dot < halfPoint)
- step = (dot < c0Point) ? 1 : 3;
- else
- step = (dot < c3Point) ? 2 : 0;
-
- ep1[1] = dp[1] - stops[step];
- lmask |= step<<2;
-
- // pixel 2
- dot = (dp[2] << 4) + (7*ep1[1] + 3*ep2[3] + 5*ep2[2] + ep2[1]);
- if(dot < halfPoint)
- step = (dot < c0Point) ? 1 : 3;
- else
- step = (dot < c3Point) ? 2 : 0;
-
- ep1[2] = dp[2] - stops[step];
- lmask |= step<<4;
-
- // pixel 3
- dot = (dp[3] << 4) + (7*ep1[2] + 5*ep2[3] + ep2[2]);
- if(dot < halfPoint)
- step = (dot < c0Point) ? 1 : 3;
- else
- step = (dot < c3Point) ? 2 : 0;
-
- ep1[3] = dp[3] - stops[step];
- lmask |= step<<6;
-
- // advance to next line
- sSwap(ep1,ep2);
- dp += 4;
- mask |= lmask << (y*8);
- }
- }
-
- return mask;
- }
-
- // The color optimization function. (Clever code, part 1)
- static void OptimizeColorsBlock(const Pixel *block,sU16 &max16,sU16 &min16)
- {
- static const sInt nIterPower = 4;
-
- // determine color distribution
- sInt mu[3],min[3],max[3];
-
- for(sInt ch=0;ch<3;ch++)
- {
- const sU8 *bp = ((const sU8 *) block) + ch;
- sInt muv,minv,maxv;
-
- muv = minv = maxv = bp[0];
- for(sInt i=4;i<64;i+=4)
- {
- muv += bp[i];
- minv = sMin<sInt>(minv,bp[i]);
- maxv = sMax<sInt>(maxv,bp[i]);
- }
-
- mu[ch] = (muv + 8) >> 4;
- min[ch] = minv;
- max[ch] = maxv;
- }
-
- // determine covariance matrix
- sInt cov[6];
- for(sInt i=0;i<6;i++)
- cov[i] = 0;
-
- for(sInt i=0;i<16;i++)
- {
- sInt r = block[i].r - mu[2];
- sInt g = block[i].g - mu[1];
- sInt b = block[i].b - mu[0];
-
- cov[0] += r*r;
- cov[1] += r*g;
- cov[2] += r*b;
- cov[3] += g*g;
- cov[4] += g*b;
- cov[5] += b*b;
- }
-
- // convert covariance matrix to float, find principal axis via power iter
- sF32 covf[6],vfr,vfg,vfb;
- for(sInt i=0;i<6;i++)
- covf[i] = cov[i] / 255.0f;
-
- vfr = max[2] - min[2];
- vfg = max[1] - min[1];
- vfb = max[0] - min[0];
-
- for(sInt iter=0;iter<nIterPower;iter++)
- {
- sF32 r = vfr*covf[0] + vfg*covf[1] + vfb*covf[2];
- sF32 g = vfr*covf[1] + vfg*covf[3] + vfb*covf[4];
- sF32 b = vfr*covf[2] + vfg*covf[4] + vfb*covf[5];
-
- vfr = r;
- vfg = g;
- vfb = b;
- }
-
- sF32 magn = sMax(sMax(sFAbs(vfr),sFAbs(vfg)),sFAbs(vfb));
- sInt v_r,v_g,v_b;
-
- if(magn < 4.0f) // too small, default to luminance
- {
- v_r = 148;
- v_g = 300;
- v_b = 58;
- }
- else
- {
- magn = 512.0f / magn;
- v_r = vfr * magn;
- v_g = vfg * magn;
- v_b = vfb * magn;
- }
-
- // Pick colors at extreme points
- sInt mind = 0x7fffffff,maxd = -0x7fffffff;
- Pixel minp,maxp;
-
- for(sInt i=0;i<16;i++)
- {
- sInt dot = block[i].r*v_r + block[i].g*v_g + block[i].b*v_b;
-
- if(dot < mind)
- {
- mind = dot;
- minp = block[i];
- }
-
- if(dot > maxd)
- {
- maxd = dot;
- maxp = block[i];
- }
- }
-
- // Reduce to 16 bit colors
- max16 = maxp.As16Bit();
- min16 = minp.As16Bit();
- }
-
- // The refinement function. (Clever code, part 2)
- // Tries to optimize colors to suit block contents better.
- // (By solving a least squares system via normal equations+Cramer's rule)
- static sBool RefineBlock(const Pixel *block,sU16 &max16,sU16 &min16,sU32 mask)
- {
- static const sInt w1Tab[4] = { 3,0,2,1 };
- static const sInt prods[4] = { 0x090000,0x000900,0x040102,0x010402 };
- // ^some magic to save a lot of multiplies in the accumulating loop...
-
- sInt akku = 0;
- sInt At1_r,At1_g,At1_b;
- sInt At2_r,At2_g,At2_b;
- sU32 cm = mask;
-
- At1_r = At1_g = At1_b = 0;
- At2_r = At2_g = At2_b = 0;
- for(sInt i=0;i<16;i++,cm>>=2)
- {
- sInt step = cm&3;
- sInt w1 = w1Tab[step];
- sInt r = block[i].r;
- sInt g = block[i].g;
- sInt b = block[i].b;
-
- akku += prods[step];
- At1_r += w1*r;
- At1_g += w1*g;
- At1_b += w1*b;
- At2_r += r;
- At2_g += g;
- At2_b += b;
- }
-
- At2_r = 3*At2_r - At1_r;
- At2_g = 3*At2_g - At1_g;
- At2_b = 3*At2_b - At1_b;
-
- // extract solutions and decide solvability
- sInt xx = akku >> 16;
- sInt yy = (akku >> 8) & 0xff;
- sInt xy = (akku >> 0) & 0xff;
-
- if(!yy || !xx || xx*yy == xy*xy)
- return sFALSE;
-
- sF32 frb = 3.0f * 31.0f / 255.0f / (xx*yy - xy*xy);
- sF32 fg = frb * 63.0f / 31.0f;
-
- sU16 oldMin = min16;
- sU16 oldMax = max16;
-
- // solve.
- max16 = sClamp<sInt>((At1_r*yy - At2_r*xy)*frb+0.5f,0,31) << 11;
- max16 |= sClamp<sInt>((At1_g*yy - At2_g*xy)*fg +0.5f,0,63) << 5;
- max16 |= sClamp<sInt>((At1_b*yy - At2_b*xy)*frb+0.5f,0,31) << 0;
-
- min16 = sClamp<sInt>((At2_r*xx - At1_r*xy)*frb+0.5f,0,31) << 11;
- min16 |= sClamp<sInt>((At2_g*xx - At1_g*xy)*fg +0.5f,0,63) << 5;
- min16 |= sClamp<sInt>((At2_b*xx - At1_b*xy)*frb+0.5f,0,31) << 0;
-
- return oldMin != min16 || oldMax != max16;
- }
-
- // Color block compression
- static void CompressColorBlock(sU8 *dest,const sU32 *src,sInt quality)
- {
- const Pixel *block = (const Pixel *) src;
- Pixel dblock[16],color[4];
-
- // check if block is constant
- sU32 min,max;
- min = max = block[0].v;
-
- for(sInt i=1;i<16;i++)
- {
- min = sMin(min,block[i].v);
- max = sMax(max,block[i].v);
- }
-
- // perform block compression
- sU16 min16,max16;
- sU32 mask;
-
- if(min != max) // no constant color
- {
- // first step: compute dithered version for PCA if desired
- if(quality)
- DitherBlock(dblock,block);
-
- // second step: pca+map along principal axis
- OptimizeColorsBlock(quality ? dblock : block,max16,min16);
- if(max16 != min16)
- {
- EvalColors(color,max16,min16);
- mask = MatchColorsBlock(block,color,quality != 0);
- }
- else
- mask = 0;
-
- // third step: refine
- if(RefineBlock(quality ? dblock : block,max16,min16,mask))
- {
- if(max16 != min16)
- {
- EvalColors(color,max16,min16);
- mask = MatchColorsBlock(block,color,quality != 0);
- }
- else
- mask = 0;
- }
-
- }
- else // constant color
- {
- sInt r = block[0].r;
- sInt g = block[0].g;
- sInt b = block[0].b;
-
- mask = 0xaaaaaaaa;
- max16 = (OMatch5[r][0]<<11) | (OMatch6[g][0]<<5) | OMatch5[b][0];
- min16 = (OMatch5[r][1]<<11) | (OMatch6[g][1]<<5) | OMatch5[b][1];
- }
-
- // write the color block
- if(max16 < min16)
- {
- sSwap(max16,min16);
- mask ^= 0x55555555;
- }
-
- ((sU16 *) dest)[0] = max16;
- ((sU16 *) dest)[1] = min16;
- ((sU32 *) dest)[1] = mask;
- }
-
- // Alpha block compression (this is easy for a change)
- static void CompressAlphaBlock(sU8 *dest,const sU32 *src,sInt quality)
- {
- quality;
- const Pixel *block = (const Pixel *) src;
-
- // find min/max color
- sInt min,max;
- min = max = block[0].a;
-
- for(sInt i=1;i<16;i++)
- {
- min = sMin<sInt>(min,block[i].a);
- max = sMax<sInt>(max,block[i].a);
- }
-
- // encode them
- *dest++ = max;
- *dest++ = min;
-
- // determine bias and emit color indices
- sInt dist = max-min;
- sInt bias = min*7 - (dist >> 1);
- sInt dist4 = dist*4;
- sInt dist2 = dist*2;
- sInt bits = 0,mask=0;
-
- for(sInt i=0;i<16;i++)
- {
- sInt a = block[i].a*7 - bias;
- sInt ind,t;
-
- // select index (hooray for bit magic)
- t = (dist4 - a) >> 31; ind = t & 4; a -= dist4 & t;
- t = (dist2 - a) >> 31; ind += t & 2; a -= dist2 & t;
- t = (dist - a) >> 31; ind += t & 1;
-
- ind = -ind & 7;
- ind ^= (2 > ind);
-
- // write index
- mask |= ind << bits;
- if((bits += 3) >= 8)
- {
- *dest++ = mask;
- mask >>= 8;
- bits -= 8;
- }
- }
- }
-
- /****************************************************************************/
-
- void sInitDXT()
- {
- for(sInt i=0;i<32;i++)
- Expand5[i] = (i<<3)|(i>>2);
-
- for(sInt i=0;i<64;i++)
- Expand6[i] = (i<<2)|(i>>4);
-
- for(sInt i=0;i<256+16;i++)
- {
- sInt v = sClamp(i-8,0,255);
- QuantRBTab[i] = Expand5[Mul8Bit(v,31)];
- QuantGTab[i] = Expand6[Mul8Bit(v,63)];
- }
-
- PrepareOptTable4(&OMatch5[0][0],Expand5,32);
- PrepareOptTable4(&OMatch6[0][0],Expand6,64);
-
- PrepareOptTable3(&OMatch5_3[0][0],Expand5,32);
- PrepareOptTable3(&OMatch6_3[0][0],Expand6,64);
- }
-
- void sCompressDXTBlock(sU8 *dest,const sU32 *src,sBool alpha,sInt quality)
- {
- CRNLIB_ASSERT(Expand5[1]);
-
- // if alpha specified, compress alpha as well
- if(alpha)
- {
- CompressAlphaBlock(dest,src,quality);
- dest += 8;
- }
-
- // compress the color part
- CompressColorBlock(dest,src,quality);
- }
-
- void sCompressDXT5ABlock(sU8 *dest,const sU32 *src,sInt quality)
- {
- CRNLIB_ASSERT(Expand5[1]);
-
- CompressAlphaBlock(dest,src,quality);
- }
-
-} // namespace ryg_dxt
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_ryg_dxt.hpp b/Libraries/crunch-ea9b8d/crnlib/crn_ryg_dxt.hpp
deleted file mode 100644
index 5f3adb1b..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_ryg_dxt.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// File: ryg_dxt.hpp
-#pragma once
-
-#include "crn_ryg_types.hpp"
-
-namespace ryg_dxt
-{
- extern sU8 Expand5[32];
- extern sU8 Expand6[64];
- extern sU8 OMatch5[256][2];
- extern sU8 OMatch6[256][2];
- extern sU8 OMatch5_3[256][2];
- extern sU8 OMatch6_3[256][2];
- extern sU8 QuantRBTab[256+16];
- extern sU8 QuantGTab[256+16];
-
- // initialize DXT codec. only needs to be called once.
- void sInitDXT();
-
- // input: a 4x4 pixel block, A8R8G8B8. you need to handle boundary cases
- // yourself.
- // alpha=sTRUE => use DXT5 (else use DXT1)
- // quality: 0=fastest (no dither), 1=medium (dither)
- void sCompressDXTBlock(sU8 *dest,const sU32 *src,sBool alpha,sInt quality);
-
- void sCompressDXT5ABlock(sU8 *dest,const sU32 *src,sInt quality);
-
-} // namespace ryg_dxt
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_ryg_types.hpp b/Libraries/crunch-ea9b8d/crnlib/crn_ryg_types.hpp
deleted file mode 100644
index 806a9a1b..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_ryg_types.hpp
+++ /dev/null
@@ -1,114 +0,0 @@
-// File: ryg_types.hpp
-#pragma once
-#ifndef __TP_TYPES_HPP__
-#define __TP_TYPES_HPP__
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <math.h>
-
-#ifdef _MSC_VER // microsoft C++
-
-#define sCONFIG_NATIVEINT int _w64 // sDInt: an int of the same size as a pointer
-#define sCONFIG_INT64 __int64 // sS64, sU64: a 64 bit int
-
-#define sINLINE __forceinline // use this to inline
-
-#endif
-
-#ifdef __GNUC__ // GNU C++
-
-#define sCONFIG_NATIVEINT int
-#define sCONFIG_INT64 long long
-
-#define sINLINE __inline__
-
-#endif
-
-/****************************************************************************/
-/*** ***/
-/*** Basic Types and Functions ***/
-/*** ***/
-/****************************************************************************/
-
-typedef unsigned char sU8; // for packed arrays
-typedef unsigned short sU16; // for packed arrays
-typedef unsigned int sU32; // for packed arrays and bitfields
-typedef unsigned sCONFIG_INT64 sU64; // use as needed
-typedef signed char sS8; // for packed arrays
-typedef short sS16; // for packed arrays
-typedef int sS32; // for packed arrays
-typedef signed sCONFIG_INT64 sS64; // use as needed
-typedef float sF32; // basic floatingpoint
-typedef double sF64; // use as needed
-typedef int sInt; // use this most!
-typedef signed sCONFIG_NATIVEINT sDInt; // type for pointer diff
-typedef bool sBool; // use for boolean function results
-
-/****************************************************************************/
-
-#define sTRUE true
-#define sFALSE false
-
-/****************************************************************************/
-
-template <class Type> sINLINE Type sMin(Type a,Type b) {return (a<b) ? a : b;}
-template <class Type> sINLINE Type sMax(Type a,Type b) {return (a>b) ? a : b;}
-template <class Type> sINLINE Type sSign(Type a) {return (a==0) ? Type(0) : (a>0) ? Type(1) : Type(-1);}
-template <class Type> sINLINE Type sClamp(Type a,Type min,Type max) {return (a>=max) ? max : (a<=min) ? min : a;}
-template <class Type> sINLINE void sSwap(Type &a,Type &b) {Type s; s=a; a=b; b=s;}
-template <class Type> sINLINE Type sAlign(Type a,sInt b) {return (Type)((((sDInt)a)+b-1)&(~(b-1)));}
-
-template <class Type> sINLINE Type sSquare(Type a) {return a*a;}
-
-/****************************************************************************/
-
-#define sPI 3.1415926535897932384626433832795
-#define sPI2 6.28318530717958647692528676655901
-#define sPIF 3.1415926535897932384626433832795f
-#define sPI2F 6.28318530717958647692528676655901f
-#define sSQRT2 1.4142135623730950488016887242097
-#define sSQRT2F 1.4142135623730950488016887242097f
-
-sINLINE sInt sAbs(sInt i) { return abs(i); }
-sINLINE void sSetMem(void *dd,sInt s,sInt c) { memset(dd,s,c); }
-sINLINE void sCopyMem(void *dd,const void *ss,sInt c) { memcpy(dd,ss,c); }
-sINLINE sInt sCmpMem(const void *dd,const void *ss,sInt c) { return (sInt)memcmp(dd,ss,c); }
-
-sINLINE sF64 sFATan(sF64 f) { return atan(f); }
-sINLINE sF64 sFATan2(sF64 a,sF64 b) { return atan2(a,b); }
-sINLINE sF64 sFCos(sF64 f) { return cos(f); }
-sINLINE sF64 sFAbs(sF64 f) { return fabs(f); }
-sINLINE sF64 sFLog(sF64 f) { return log(f); }
-sINLINE sF64 sFLog10(sF64 f) { return log10(f); }
-sINLINE sF64 sFSin(sF64 f) { return sin(f); }
-sINLINE sF64 sFSqrt(sF64 f) { return sqrt(f); }
-sINLINE sF64 sFTan(sF64 f) { return tan(f); }
-
-sINLINE sF64 sFACos(sF64 f) { return acos(f); }
-sINLINE sF64 sFASin(sF64 f) { return asin(f); }
-sINLINE sF64 sFCosH(sF64 f) { return cosh(f); }
-sINLINE sF64 sFSinH(sF64 f) { return sinh(f); }
-sINLINE sF64 sFTanH(sF64 f) { return tanh(f); }
-
-sINLINE sF64 sFInvSqrt(sF64 f) { return 1.0/sqrt(f); }
-
-sINLINE sF64 sFFloor(sF64 f) { return floor(f); }
-
-sINLINE sF64 sFPow(sF64 a,sF64 b) { return pow(a,b); }
-sINLINE sF64 sFMod(sF64 a,sF64 b) { return fmod(a,b); }
-sINLINE sF64 sFExp(sF64 f) { return exp(f); }
-
-/****************************************************************************/
-/*** ***/
-/*** Debugging ***/
-/*** ***/
-/****************************************************************************/
-
-#define sVERIFY(x) {assert(x);}
-#define sVERIFYFALSE {assert(false);}
-
-/****************************************************************************/
-
-#endif \ No newline at end of file
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_sparse_array.h b/Libraries/crunch-ea9b8d/crnlib/crn_sparse_array.h
deleted file mode 100644
index 4e64ba0a..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_sparse_array.h
+++ /dev/null
@@ -1,399 +0,0 @@
-// File: crn_sparse_array.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- template<typename T, uint Log2N>
- class sparse_array_traits
- {
- public:
- static inline void* alloc_space(uint size)
- {
- return crnlib_malloc(size);
- }
-
- static inline void free_space(void* p)
- {
- crnlib_free(p);
- }
-
- static inline void construct_group(T* p)
- {
- scalar_type<T>::construct_array(p, 1U << Log2N);
- }
-
- static inline void destruct_group(T* p)
- {
- scalar_type<T>::destruct_array(p, 1U << Log2N);
- }
-
- static inline void construct_element(T* p)
- {
- scalar_type<T>::construct(p);
- }
-
- static inline void destruct_element(T* p)
- {
- scalar_type<T>::destruct(p);
- }
-
- static inline void copy_group(T* pDst, const T* pSrc)
- {
- for (uint j = 0; j < (1U << Log2N); j++)
- pDst[j] = pSrc[j];
- }
- };
-
- template<typename T, uint Log2N = 5, template <typename, uint> class Traits = sparse_array_traits>
- class sparse_array : public Traits<T, Log2N>
- {
- public:
- enum { N = 1U << Log2N };
-
- inline sparse_array() : m_size(0), m_num_active_groups(0)
- {
- init_default();
- }
-
- inline sparse_array(uint size) : m_size(0), m_num_active_groups(0)
- {
- init_default();
-
- resize(size);
- }
-
- inline sparse_array(const sparse_array& other) : m_size(0), m_num_active_groups(0)
- {
- init_default();
-
- *this = other;
- }
-
- inline ~sparse_array()
- {
- for (uint i = 0; (i < m_groups.size()) && m_num_active_groups; i++)
- free_group(m_groups[i]);
-
- deinit_default();
- }
-
- bool assign(const sparse_array& other)
- {
- if (this == &other)
- return true;
-
- if (!try_resize(other.size()))
- return false;
-
- for (uint i = 0; i < other.m_groups.size(); i++)
- {
- const T* p = other.m_groups[i];
-
- T* q = m_groups[i];
-
- if (p)
- {
- if (!q)
- {
- q = alloc_group(true);
- if (!q)
- return false;
-
- m_groups[i] = q;
- }
-
- copy_group(q, p);
- }
- else if (q)
- {
- free_group(q);
- m_groups[i] = NULL;
- }
- }
-
- return true;
- }
-
- sparse_array& operator= (const sparse_array& other)
- {
- if (!assign(other))
- {
- CRNLIB_FAIL("Out of memory");
- }
-
- return *this;
- }
-
- bool operator== (const sparse_array& other) const
- {
- if (m_size != other.m_size)
- return false;
-
- for (uint i = 0; i < m_size; i++)
- if (!((*this)[i] == other[i]))
- return false;
-
- return true;
- }
-
- bool operator< (const sparse_array& rhs) const
- {
- const uint min_size = math::minimum(m_size, rhs.m_size);
-
- uint i;
- for (i = 0; i < min_size; i++)
- if (!((*this)[i] == rhs[i]))
- break;
-
- if (i < min_size)
- return (*this)[i] < rhs[i];
-
- return m_size < rhs.m_size;
- }
-
- void clear()
- {
- if (m_groups.size())
- {
- for (uint i = 0; (i < m_groups.size()) && m_num_active_groups; i++)
- free_group(m_groups[i]);
-
- m_groups.clear();
- }
-
- m_size = 0;
-
- CRNLIB_ASSERT(!m_num_active_groups);
- }
-
- bool try_resize(uint size)
- {
- if (m_size == size)
- return true;
-
- const uint new_num_groups = (size + N - 1) >> Log2N;
- if (new_num_groups != m_groups.size())
- {
- for (uint i = new_num_groups; i < m_groups.size(); i++)
- free_group(m_groups[i]);
-
- if (!m_groups.try_resize(new_num_groups))
- return false;
- }
-
- m_size = size;
- return true;
- }
-
- void resize(uint size)
- {
- if (!try_resize(size))
- {
- CRNLIB_FAIL("Out of memory");
- }
- }
-
- inline uint size() const { return m_size; }
- inline bool empty() const { return 0 == m_size; }
-
- inline uint capacity() const { return m_groups.size(); }
-
- inline const T& operator[] (uint i) const
- {
- CRNLIB_ASSERT(i < m_size);
- const T* p = m_groups[i >> Log2N];
- const void *t = m_default;
- return p ? p[i & (N - 1)] : *reinterpret_cast<const T*>(t);
- }
-
- inline const T* get(uint i) const
- {
- CRNLIB_ASSERT(i < m_size);
- const T* p = m_groups[i >> Log2N];
- return p ? &p[i & (N - 1)] : NULL;
- }
-
- inline T* get(uint i)
- {
- CRNLIB_ASSERT(i < m_size);
- T* p = m_groups[i >> Log2N];
- return p ? &p[i & (N - 1)] : NULL;
- }
-
- inline bool is_present(uint i) const
- {
- CRNLIB_ASSERT(i < m_size);
- return m_groups[i >> Log2N] != NULL;
- }
-
- inline uint get_num_groups() const { return m_groups.size(); }
-
- inline const T* get_group(uint group_index) const
- {
- return m_groups[group_index];
- }
-
- inline T* get_group(uint group_index)
- {
- return m_groups[group_index];
- }
-
- inline uint get_group_size() const
- {
- return N;
- }
-
- inline T* ensure_valid(uint index)
- {
- CRNLIB_ASSERT(index <= m_size);
-
- const uint group_index = index >> Log2N;
-
- if (group_index >= m_groups.size())
- {
- T* p = alloc_group(true);
- if (!p)
- return NULL;
-
- if (!m_groups.try_push_back(p))
- {
- free_group(p);
- return NULL;
- }
- }
-
- T* p = m_groups[group_index];
- if (!p)
- {
- p = alloc_group(true);
- if (!p)
- return NULL;
-
- m_groups[group_index] = p;
- }
-
- m_size = math::maximum(index + 1, m_size);
-
- return p + (index & (N - 1));
- }
-
- inline bool set(uint index, const T& obj)
- {
- T* p = ensure_valid(index);
- if (!p)
- return false;
-
- *p = obj;
-
- return true;
- }
-
- inline void push_back(const T& obj)
- {
- if (!set(m_size, obj))
- {
- CRNLIB_FAIL("Out of memory");
- }
- }
-
- inline bool try_push_back(const T& obj)
- {
- return set(m_size, obj);
- }
-
- inline void pop_back()
- {
- CRNLIB_ASSERT(m_size);
- if (m_size)
- resize(m_size - 1);
- }
-
- inline void unset_range(uint start, uint num)
- {
- if (!num)
- return;
-
- CRNLIB_ASSERT((start + num) <= capacity());
-
- const uint num_to_skip = math::minimum(math::get_align_up_value_delta(start, N), num);
- num -= num_to_skip;
-
- const uint first_group = (start + num_to_skip) >> Log2N;
- const uint num_groups = num >> Log2N;
-
- for (uint i = 0; i < num_groups; i++)
- {
- T* p = m_groups[first_group + i];
- if (p)
- {
- free_group(p);
- m_groups[i] = NULL;
- }
- }
- }
-
- inline void unset_all()
- {
- unset_range(0, m_groups.size() << Log2N);
- }
-
- inline void swap(sparse_array& other)
- {
- utils::swap(m_size, other.m_size);
- m_groups.swap(other.m_groups);
- utils::swap(m_num_active_groups, other.m_num_active_groups);
- }
-
- private:
- uint m_size;
- uint m_num_active_groups;
-
- crnlib::vector<T*> m_groups;
-
- uint64 m_default[(sizeof(T) + sizeof(uint64) - 1) / sizeof(uint64)];
-
- inline T* alloc_group(bool nofail = false)
- {
- T* p = static_cast<T*>(sparse_array_traits<T, Log2N>::alloc_space(N * sizeof(T)));
-
- if (!p)
- {
- if (nofail)
- return NULL;
-
- CRNLIB_FAIL("Out of memory");
- }
-
- sparse_array_traits<T, Log2N>::construct_group(p);
-
- m_num_active_groups++;
-
- return p;
- }
-
- inline void free_group(T* p)
- {
- if (p)
- {
- CRNLIB_ASSERT(m_num_active_groups);
- m_num_active_groups--;
-
- sparse_array_traits<T, Log2N>::destruct_group(p);
-
- sparse_array_traits<T, Log2N>::free_space(p);
- }
- }
-
- inline void init_default()
- {
- sparse_array_traits<T, Log2N>::construct_element(reinterpret_cast<T*>(m_default));
- }
-
- inline void deinit_default()
- {
- sparse_array_traits<T, Log2N>::destruct_element(reinterpret_cast<T*>(m_default));
- }
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_sparse_bit_array.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_sparse_bit_array.cpp
deleted file mode 100644
index d0bdcb37..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_sparse_bit_array.cpp
+++ /dev/null
@@ -1,538 +0,0 @@
-// File: crn_sparse_bit_array.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_sparse_bit_array.h"
-
-namespace crnlib
-{
- sparse_bit_array::sparse_bit_array() :
- m_num_groups(0), m_ppGroups(NULL)
- {
- }
-
- sparse_bit_array::sparse_bit_array(uint size) :
- m_num_groups(0), m_ppGroups(NULL)
- {
- resize(size);
- }
-
- sparse_bit_array::sparse_bit_array(sparse_bit_array& other)
- {
- m_num_groups = other.m_num_groups;
- m_ppGroups = (uint32**)crnlib_malloc(m_num_groups * sizeof(uint32*));
- CRNLIB_VERIFY(m_ppGroups);
-
- for (uint i = 0; i < m_num_groups; i++)
- {
- if (other.m_ppGroups[i])
- {
- m_ppGroups[i] = alloc_group(false);
- memcpy(m_ppGroups[i], other.m_ppGroups[i], cBytesPerGroup);
- }
- else
- m_ppGroups[i] = NULL;
- }
- }
-
- sparse_bit_array::~sparse_bit_array()
- {
- clear();
- }
-
- sparse_bit_array& sparse_bit_array::operator= (sparse_bit_array& other)
- {
- if (this == &other)
- return *this;
-
- if (m_num_groups != other.m_num_groups)
- {
- clear();
-
- m_num_groups = other.m_num_groups;
- m_ppGroups = (uint32**)crnlib_calloc(m_num_groups, sizeof(uint32*));
- CRNLIB_VERIFY(m_ppGroups);
- }
-
- for (uint i = 0; i < m_num_groups; i++)
- {
- if (other.m_ppGroups[i])
- {
- if (!m_ppGroups[i])
- m_ppGroups[i] = alloc_group(false);
- memcpy(m_ppGroups[i], other.m_ppGroups[i], cBytesPerGroup);
- }
- else if (m_ppGroups[i])
- {
- free_group(m_ppGroups[i]);
- m_ppGroups[i] = NULL;
- }
- }
-
- return *this;
- }
-
- void sparse_bit_array::clear()
- {
- if (!m_num_groups)
- return;
-
- for (uint i = 0; i < m_num_groups; i++)
- free_group(m_ppGroups[i]);
-
- crnlib_free(m_ppGroups);
- m_ppGroups = NULL;
-
- m_num_groups = 0;
- }
-
- void sparse_bit_array::swap(sparse_bit_array& other)
- {
- utils::swap(m_ppGroups, other.m_ppGroups);
- utils::swap(m_num_groups, other.m_num_groups);
- }
-
- void sparse_bit_array::optimize()
- {
- for (uint i = 0; i < m_num_groups; i++)
- {
- uint32* s = m_ppGroups[i];
- if (s)
- {
- uint j;
- for (j = 0; j < cDWORDsPerGroup; j++)
- if (s[j])
- break;
- if (j == cDWORDsPerGroup)
- {
- free_group(s);
- m_ppGroups[i] = NULL;
- }
- }
- }
- }
-
- void sparse_bit_array::set_bit_range(uint index, uint num)
- {
- CRNLIB_ASSERT((index + num) <= (m_num_groups << cBitsPerGroupShift));
-
- if (!num)
- return;
- else if (num == 1)
- {
- set_bit(index);
- return;
- }
-
- while ((index & cBitsPerGroupMask) || (num <= cBitsPerGroup))
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (!pGroup)
- {
- pGroup = alloc_group(true);
- m_ppGroups[group_index] = pGroup;
- }
-
- const uint group_bit_ofs = index & cBitsPerGroupMask;
-
- const uint dword_bit_ofs = group_bit_ofs & 31;
- const uint max_bits_to_set = 32 - dword_bit_ofs;
-
- const uint bits_to_set = math::minimum(max_bits_to_set, num);
- const uint32 msk = (0xFFFFFFFFU >> (32 - bits_to_set));
-
- pGroup[group_bit_ofs >> 5] |= (msk << dword_bit_ofs);
-
- num -= bits_to_set;
- if (!num)
- return;
-
- index += bits_to_set;
- }
-
- while (num >= cBitsPerGroup)
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (!pGroup)
- {
- pGroup = alloc_group(true);
- m_ppGroups[group_index] = pGroup;
- }
-
- memset(pGroup, 0xFF, sizeof(uint32) * cDWORDsPerGroup);
-
- num -= cBitsPerGroup;
- index += cBitsPerGroup;
- }
-
- while (num)
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (!pGroup)
- {
- pGroup = alloc_group(true);
- m_ppGroups[group_index] = pGroup;
- }
-
- uint group_bit_ofs = index & cBitsPerGroupMask;
-
- uint bits_to_set = math::minimum(32U, num);
- uint32 msk = (0xFFFFFFFFU >> (32 - bits_to_set));
-
- pGroup[group_bit_ofs >> 5] |= (msk << (group_bit_ofs & 31));
-
- num -= bits_to_set;
- index += bits_to_set;
- }
- }
-
- void sparse_bit_array::clear_all_bits()
- {
- for (uint i = 0; i < m_num_groups; i++)
- {
- uint32* pGroup = m_ppGroups[i];
- if (pGroup)
- memset(pGroup, 0, sizeof(uint32) * cDWORDsPerGroup);
- }
- }
-
- void sparse_bit_array::clear_bit_range(uint index, uint num)
- {
- CRNLIB_ASSERT((index + num) <= (m_num_groups << cBitsPerGroupShift));
-
- if (!num)
- return;
- else if (num == 1)
- {
- clear_bit(index);
- return;
- }
-
- while ((index & cBitsPerGroupMask) || (num <= cBitsPerGroup))
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- const uint group_bit_ofs = index & cBitsPerGroupMask;
-
- const uint dword_bit_ofs = group_bit_ofs & 31;
- const uint max_bits_to_set = 32 - dword_bit_ofs;
-
- const uint bits_to_set = math::minimum(max_bits_to_set, num);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (pGroup)
- {
- const uint32 msk = (0xFFFFFFFFU >> (32 - bits_to_set));
-
- pGroup[group_bit_ofs >> 5] &= (~(msk << dword_bit_ofs));
- }
-
- num -= bits_to_set;
- if (!num)
- return;
-
- index += bits_to_set;
- }
-
- while (num >= cBitsPerGroup)
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (pGroup)
- {
- free_group(pGroup);
- m_ppGroups[group_index] = NULL;
- }
-
- num -= cBitsPerGroup;
- index += cBitsPerGroup;
- }
-
- while (num)
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint bits_to_set = math::minimum(32u, num);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (pGroup)
- {
- uint group_bit_ofs = index & cBitsPerGroupMask;
-
- uint32 msk = (0xFFFFFFFFU >> (32 - bits_to_set));
-
- pGroup[group_bit_ofs >> 5] &= (~(msk << (group_bit_ofs & 31)));
- }
-
- num -= bits_to_set;
- index += bits_to_set;
- }
- }
-
- void sparse_bit_array::resize(uint size)
- {
- uint num_groups = (size + cBitsPerGroup - 1) >> cBitsPerGroupShift;
- if (num_groups == m_num_groups)
- return;
-
- if (!num_groups)
- {
- clear();
- return;
- }
-
- sparse_bit_array temp;
- temp.swap(*this);
-
- m_num_groups = num_groups;
- m_ppGroups = (uint32**)crnlib_calloc(m_num_groups, sizeof(uint32*));
- CRNLIB_VERIFY(m_ppGroups);
-
- uint n = math::minimum(temp.m_num_groups, m_num_groups);
- for (uint i = 0; i < n; i++)
- {
- uint32* p = temp.m_ppGroups[i];
- if (p)
- {
- m_ppGroups[i] = temp.m_ppGroups[i];
- temp.m_ppGroups[i] = NULL;
- }
- }
- }
-
- sparse_bit_array& sparse_bit_array::operator&= (const sparse_bit_array& other)
- {
- if (this == &other)
- return *this;
-
- CRNLIB_VERIFY(other.m_num_groups == m_num_groups);
-
- for (uint i = 0; i < m_num_groups; i++)
- {
- uint32* d = m_ppGroups[i];
- if (!d)
- continue;
- uint32* s = other.m_ppGroups[i];
-
- if (!s)
- {
- free_group(d);
- m_ppGroups[i] = NULL;
- }
- else
- {
- uint32 oc = 0;
- for (uint j = 0; j < cDWORDsPerGroup; j++)
- {
- uint32 c = d[j] & s[j];
- d[j] = c;
- oc |= c;
- }
- if (!oc)
- {
- free_group(d);
- m_ppGroups[i] = NULL;
- }
- }
- }
-
- return *this;
- }
-
- sparse_bit_array& sparse_bit_array::operator|= (const sparse_bit_array& other)
- {
- if (this == &other)
- return *this;
-
- CRNLIB_VERIFY(other.m_num_groups == m_num_groups);
-
- for (uint i = 0; i < m_num_groups; i++)
- {
- uint32* s = other.m_ppGroups[i];
- if (!s)
- continue;
-
- uint32* d = m_ppGroups[i];
- if (!d)
- {
- d = alloc_group(true);
- m_ppGroups[i] = d;
- memcpy(d, s, cBytesPerGroup);
- }
- else
- {
- uint32 oc = 0;
- for (uint j = 0; j < cDWORDsPerGroup; j++)
- {
- uint32 c = d[j] | s[j];
- d[j] = c;
- oc |= c;
- }
- if (!oc)
- {
- free_group(d);
- m_ppGroups[i] = NULL;
- }
- }
- }
-
- return *this;
- }
-
- sparse_bit_array& sparse_bit_array::and_not(const sparse_bit_array& other)
- {
- if (this == &other)
- return *this;
-
- CRNLIB_VERIFY(other.m_num_groups == m_num_groups);
-
- for (uint i = 0; i < m_num_groups; i++)
- {
- uint32* d = m_ppGroups[i];
- if (!d)
- continue;
- uint32* s = other.m_ppGroups[i];
- if (!s)
- continue;
-
- uint32 oc = 0;
- for (uint j = 0; j < cDWORDsPerGroup; j++)
- {
- uint32 c = d[j] & (~s[j]);
- d[j] = c;
- oc |= c;
- }
- if (!oc)
- {
- free_group(d);
- m_ppGroups[i] = NULL;
- }
- }
-
- return *this;
- }
-
- int sparse_bit_array::find_first_set_bit(uint index, uint num) const
- {
- CRNLIB_ASSERT((index + num) <= (m_num_groups << cBitsPerGroupShift));
-
- if (!num)
- return -1;
-
- while ((index & cBitsPerGroupMask) || (num <= cBitsPerGroup))
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- const uint group_bit_ofs = index & cBitsPerGroupMask;
- const uint dword_bit_ofs = group_bit_ofs & 31;
-
- const uint max_bits_to_examine = 32 - dword_bit_ofs;
- const uint bits_to_examine = math::minimum(max_bits_to_examine, num);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (pGroup)
- {
- const uint32 msk = (0xFFFFFFFFU >> (32 - bits_to_examine));
-
- uint bits = pGroup[group_bit_ofs >> 5] & (msk << dword_bit_ofs);
- if (bits)
- {
- uint num_trailing_zeros = math::count_trailing_zero_bits(bits);
- int set_index = num_trailing_zeros + (index & ~31);
- CRNLIB_ASSERT(get_bit(set_index));
- return set_index;
- }
- }
-
- num -= bits_to_examine;
- if (!num)
- return -1;
-
- index += bits_to_examine;
- }
-
- while (num >= cBitsPerGroup)
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (pGroup)
- {
- for (uint i = 0; i < cDWORDsPerGroup; i++)
- {
- uint32 bits = pGroup[i];
- if (bits)
- {
- uint num_trailing_zeros = math::count_trailing_zero_bits(bits);
-
- int set_index = num_trailing_zeros + index + (i << 5);
- CRNLIB_ASSERT(get_bit(set_index));
- return set_index;
- }
- }
-
- }
-
- num -= cBitsPerGroup;
- index += cBitsPerGroup;
- }
-
- while (num)
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint bits_to_examine = math::minimum(32U, num);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (pGroup)
- {
- uint group_bit_ofs = index & cBitsPerGroupMask;
-
- uint32 msk = (0xFFFFFFFFU >> (32 - bits_to_examine));
-
- uint32 bits = pGroup[group_bit_ofs >> 5] & (msk << (group_bit_ofs & 31));
- if (bits)
- {
- uint num_trailing_zeros = math::count_trailing_zero_bits(bits);
-
- int set_index = num_trailing_zeros + (index & ~31);
- CRNLIB_ASSERT(get_bit(set_index));
- return set_index;
- }
- }
-
- num -= bits_to_examine;
- index += bits_to_examine;
- }
-
- return -1;
- }
-
-} // namespace crnlib
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_sparse_bit_array.h b/Libraries/crunch-ea9b8d/crnlib/crn_sparse_bit_array.h
deleted file mode 100644
index 75a26bce..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_sparse_bit_array.h
+++ /dev/null
@@ -1,176 +0,0 @@
-// File: crn_sparse_bit_array.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- class sparse_bit_array
- {
- public:
- sparse_bit_array();
- sparse_bit_array(uint size);
- sparse_bit_array(sparse_bit_array& other);
- ~sparse_bit_array();
-
- sparse_bit_array& operator= (sparse_bit_array& other);
-
- void clear();
-
- inline uint get_size() { return (m_num_groups << cBitsPerGroupShift); }
-
- void resize(uint size);
-
- sparse_bit_array& operator&= (const sparse_bit_array& other);
- sparse_bit_array& operator|= (const sparse_bit_array& other);
- sparse_bit_array& and_not(const sparse_bit_array& other);
-
- void swap(sparse_bit_array& other);
-
- void optimize();
-
- void set_bit_range(uint index, uint num);
- void clear_bit_range(uint index, uint num);
-
- void clear_all_bits();
-
- inline void set_bit(uint index)
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (!pGroup)
- {
- pGroup = alloc_group(true);
- m_ppGroups[group_index] = pGroup;
- }
-
- uint bit_ofs = index & (cBitsPerGroup - 1);
-
- pGroup[bit_ofs >> 5] |= (1U << (bit_ofs & 31));
- }
-
- inline void clear_bit(uint index)
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (!pGroup)
- {
- pGroup = alloc_group(true);
- m_ppGroups[group_index] = pGroup;
- }
-
- uint bit_ofs = index & (cBitsPerGroup - 1);
-
- pGroup[bit_ofs >> 5] &= (~(1U << (bit_ofs & 31)));
- }
-
- inline void set(uint index, bool value)
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (!pGroup)
- {
- pGroup = alloc_group(true);
- m_ppGroups[group_index] = pGroup;
- }
-
- uint bit_ofs = index & (cBitsPerGroup - 1);
-
- uint bit = (1U << (bit_ofs & 31));
-
- uint c = pGroup[bit_ofs >> 5];
- uint mask = (uint)(-(int)value);
-
- pGroup[bit_ofs >> 5] = (c & ~bit) | (mask & bit);
- }
-
- inline bool get_bit(uint index) const
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (!pGroup)
- return 0;
-
- uint bit_ofs = index & (cBitsPerGroup - 1);
-
- uint bit = (1U << (bit_ofs & 31));
-
- return (pGroup[bit_ofs >> 5] & bit) != 0;
- }
-
- inline uint32 get_uint32(uint index) const
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (!pGroup)
- return 0;
-
- uint bit_ofs = index & (cBitsPerGroup - 1);
-
- return pGroup[bit_ofs >> 5];
- }
-
- inline void set_uint32(uint index, uint32 value) const
- {
- uint group_index = index >> cBitsPerGroupShift;
- CRNLIB_ASSERT(group_index < m_num_groups);
-
- uint32* pGroup = m_ppGroups[group_index];
- if (!pGroup)
- {
- pGroup = alloc_group(true);
- m_ppGroups[group_index] = pGroup;
- }
-
- uint bit_ofs = index & (cBitsPerGroup - 1);
-
- pGroup[bit_ofs >> 5] = value;
- }
-
- int find_first_set_bit(uint index, uint num) const;
-
- enum
- {
- cDWORDsPerGroupShift = 4U,
- cDWORDsPerGroup = 1U << cDWORDsPerGroupShift,
-
- cBitsPerGroupShift = cDWORDsPerGroupShift + 5,
- cBitsPerGroup = 1U << cBitsPerGroupShift,
- cBitsPerGroupMask = cBitsPerGroup - 1U,
-
- cBytesPerGroup = cDWORDsPerGroup * sizeof(uint32)
- };
-
- uint get_num_groups() const { return m_num_groups; }
- uint32** get_groups() { return m_ppGroups; }
-
- private:
- uint m_num_groups;
- uint32** m_ppGroups;
-
- static inline uint32* alloc_group(bool clear)
- {
- uint32* p = (uint32*)crnlib_malloc(cBytesPerGroup);
- CRNLIB_VERIFY(p);
- if (clear) memset(p, 0, cBytesPerGroup);
- return p;
- }
-
- static inline void free_group(void* p)
- {
- if (p)
- crnlib_free(p);
- }
- };
-
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_stb_image.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_stb_image.cpp
deleted file mode 100644
index 0778e396..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_stb_image.cpp
+++ /dev/null
@@ -1,3979 +0,0 @@
-/* stbi-1.18 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c
- when you control the images you're loading
-
- QUICK NOTES:
- Primarily of interest to game developers and other people who can
- avoid problematic images and only need the trivial interface
-
- JPEG baseline (no JPEG progressive, no oddball channel decimations)
- PNG 8-bit only
- BMP non-1bpp, non-RLE
- TGA (not sure what subset, if a subset)
- PSD (composited view only, no extra channels)
- HDR (radiance rgbE format)
- writes BMP,TGA (define STBI_NO_WRITE to remove code)
- decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code)
- supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD)
-
- TODO:
- stbi_info_*
-
- history:
- 1.18 fix a threading bug (local mutable static)
- 1.17 support interlaced PNG
- 1.16 major bugfix - convert_format converted one too many pixels
- 1.15 initialize some fields for thread safety
- 1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including)
- 1.13 threadsafe
- 1.12 const qualifiers in the API
- 1.11 Support installable IDCT, colorspace conversion routines
- 1.10 Fixes for 64-bit (don't use "unsigned long")
- optimized upsampling by Fabian "ryg" Giesen
- 1.09 Fix format-conversion for PSD code (bad global variables!)
- 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz
- 1.07 attempt to fix C++ warning/errors again
- 1.06 attempt to fix C++ warning/errors again
- 1.05 fix TGA loading to return correct *comp and use good luminance calc
- 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free
- 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR
- 1.02 support for (subset of) HDR files, float interface for preferred access to them
- 1.01 fix bug: possible bug in handling right-side up bmps... not sure
- fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all
- 1.00 interface to zlib that skips zlib header
- 0.99 correct handling of alpha in palette
- 0.98 TGA loader by lonesock; dynamically add loaders (untested)
- 0.97 jpeg errors on too large a file; also catch another stb_malloc failure
- 0.96 fix detection of invalid v value - particleman@mollyrocket forum
- 0.95 during header scan, seek to markers in case of padding
- 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same
- 0.93 handle jpegtran output; verbose errors
- 0.92 read 4,8,16,24,32-bit BMP files of several formats
- 0.91 output 24-bit Windows 3.0 BMP files
- 0.90 fix a few more warnings; bump version number to approach 1.0
- 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd
- 0.60 fix compiling as c++
- 0.59 fix warnings: merge Dave Moore's -Wall fixes
- 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian
- 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less
- than 16 available
- 0.56 fix bug: zlib uncompressed mode len vs. nlen
- 0.55 fix bug: restart_interval not initialized to 0
- 0.54 allow NULL for 'int *comp'
- 0.53 fix bug in png 3->4; speedup png decoding
- 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments
- 0.51 obey req_comp requests, 1-component jpegs return as 1-component,
- on 'test' only check type, not whether we support this variant
-*/
-
-#ifdef _MSC_VER
-#pragma warning (disable: 4793) // function compiled as native
-#endif
-
-#ifndef STBI_INCLUDE_STB_IMAGE_H
-#define STBI_INCLUDE_STB_IMAGE_H
-
-//// begin header file ////////////////////////////////////////////////////
-//
-// Limitations:
-// - no progressive/interlaced support (jpeg, png)
-// - 8-bit samples only (jpeg, png)
-// - not threadsafe
-// - channel subsampling of at most 2 in each dimension (jpeg)
-// - no delayed line count (jpeg) -- IJG doesn't support either
-//
-// Basic usage (see HDR discussion below):
-// int x,y,n;
-// unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
-// // ... process data if not NULL ...
-// // ... x = width, y = height, n = # 8-bit components per pixel ...
-// // ... replace '0' with '1'..'4' to force that many components per pixel
-// stbi_image_free(data)
-//
-// Standard parameters:
-// int *x -- outputs image width in pixels
-// int *y -- outputs image height in pixels
-// int *comp -- outputs # of image components in image file
-// int req_comp -- if non-zero, # of image components requested in result
-//
-// The return value from an image loader is an 'unsigned char *' which points
-// to the pixel data. The pixel data consists of *y scanlines of *x pixels,
-// with each pixel consisting of N interleaved 8-bit components; the first
-// pixel pointed to is top-left-most in the image. There is no padding between
-// image scanlines or between pixels, regardless of format. The number of
-// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise.
-// If req_comp is non-zero, *comp has the number of components that _would_
-// have been output otherwise. E.g. if you set req_comp to 4, you will always
-// get RGBA output, but you can check *comp to easily see if it's opaque.
-//
-// An output image with N components has the following components interleaved
-// in this order in each pixel:
-//
-// N=#comp components
-// 1 grey
-// 2 grey, alpha
-// 3 red, green, blue
-// 4 red, green, blue, alpha
-//
-// If image loading fails for any reason, the return value will be NULL,
-// and *x, *y, *comp will be unchanged. The function stbi_failure_reason()
-// can be queried for an extremely brief, end-user unfriendly explanation
-// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid
-// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly
-// more user-friendly ones.
-//
-// Paletted PNG and BMP images are automatically depalettized.
-//
-//
-// ===========================================================================
-//
-// HDR image support (disable by defining STBI_NO_HDR)
-//
-// stb_image now supports loading HDR images in general, and currently
-// the Radiance .HDR file format, although the support is provided
-// generically. You can still load any file through the existing interface;
-// if you attempt to load an HDR file, it will be automatically remapped to
-// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;
-// both of these constants can be reconfigured through this interface:
-//
-// stbi_hdr_to_ldr_gamma(2.2f);
-// stbi_hdr_to_ldr_scale(1.0f);
-//
-// (note, do not use _inverse_ constants; stbi_image will invert them
-// appropriately).
-//
-// Additionally, there is a new, parallel interface for loading files as
-// (linear) floats to preserve the full dynamic range:
-//
-// float *data = stbi_loadf(filename, &x, &y, &n, 0);
-//
-// If you load LDR images through this interface, those images will
-// be promoted to floating point values, run through the inverse of
-// constants corresponding to the above:
-//
-// stbi_ldr_to_hdr_scale(1.0f);
-// stbi_ldr_to_hdr_gamma(2.2f);
-//
-// Finally, given a filename (or an open file or memory block--see header
-// file for details) containing image data, you can query for the "most
-// appropriate" interface to use (that is, whether the image is HDR or
-// not), using:
-//
-// stbi_is_hdr(char *filename);
-
-#define _CRT_SECURE_NO_WARNINGS
-
-#ifndef STBI_NO_STDIO
-#include <stdio.h>
-#endif
-
-namespace crnlib {
-
-#define STBI_VERSION 1
-
-enum
-{
- STBI_default = 0, // only used for req_comp
-
- STBI_grey = 1,
- STBI_grey_alpha = 2,
- STBI_rgb = 3,
- STBI_rgb_alpha = 4,
-};
-
-typedef unsigned char stbi_uc;
-
-//#ifdef __cplusplus
-//extern "C" {
-//#endif
-
-// WRITING API
-
-#if !defined(STBI_NO_WRITE) && !defined(STBI_NO_STDIO)
-// write a BMP/TGA file given tightly packed 'comp' channels (no padding, nor bmp-stride-padding)
-// (you must include the appropriate extension in the filename).
-// returns TRUE on success, FALSE if couldn't open file, error writing file
-extern int stbi_write_bmp (char const *filename, int x, int y, int comp, const void *data);
-#ifdef _MSC_VER
-extern int stbi_write_bmp_w (wchar_t const *filename, int x, int y, int comp, const void *data);
-#endif
-extern int stbi_write_tga (char const *filename, int x, int y, int comp, const void *data);
-#ifdef _MSC_VER
-extern int stbi_write_tga_w (wchar_t const *filename, int x, int y, int comp, const void *data);
-#endif
-#endif
-
-// PRIMARY API - works on images of any type
-
-// load image by filename, open file, or memory buffer
-#ifndef STBI_NO_STDIO
-extern stbi_uc *stbi_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-#ifdef _MSC_VER
-extern stbi_uc *stbi_load_w (wchar_t const *filename, int *x, int *y, int *comp, int req_comp);
-#endif
-extern stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-extern stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-// for stbi_load_from_file, file pointer is left pointing immediately after image
-
-#ifndef STBI_NO_HDR
-#ifndef STBI_NO_STDIO
-extern float *stbi_loadf (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-extern float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-
-extern void stbi_hdr_to_ldr_gamma(float gamma);
-extern void stbi_hdr_to_ldr_scale(float scale);
-
-extern void stbi_ldr_to_hdr_gamma(float gamma);
-extern void stbi_ldr_to_hdr_scale(float scale);
-
-#endif // STBI_NO_HDR
-
-// get a VERY brief reason for failure
-// NOT THREADSAFE
-extern const char *stbi_failure_reason (void);
-
-// free the loaded image -- this is just stb_free()
-extern void stbi_image_free (void *retval_from_stbi_load);
-
-// get image dimensions & components without fully decoding
-extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-extern int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);
-#ifndef STBI_NO_STDIO
-extern int stbi_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_is_hdr (char const *filename);
-extern int stbi_is_hdr_from_file(FILE *f);
-#endif
-
-// ZLIB client - used by PNG, available for other purposes
-
-extern char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen);
-extern char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);
-extern int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
-
-extern char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);
-extern int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
-
-// TYPE-SPECIFIC ACCESS
-
-// is it a jpeg?
-extern int stbi_jpeg_test_memory (stbi_uc const *buffer, int len);
-extern stbi_uc *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-extern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-#ifndef STBI_NO_STDIO
-extern stbi_uc *stbi_jpeg_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern int stbi_jpeg_test_file (FILE *f);
-extern stbi_uc *stbi_jpeg_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-
-extern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-
-// is it a png?
-extern int stbi_png_test_memory (stbi_uc const *buffer, int len);
-extern stbi_uc *stbi_png_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-extern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-#ifndef STBI_NO_STDIO
-extern stbi_uc *stbi_png_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern int stbi_png_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_png_test_file (FILE *f);
-extern stbi_uc *stbi_png_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-
-// is it a bmp?
-extern int stbi_bmp_test_memory (stbi_uc const *buffer, int len);
-
-extern stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-#ifndef STBI_NO_STDIO
-extern int stbi_bmp_test_file (FILE *f);
-extern stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-
-// is it a tga?
-extern int stbi_tga_test_memory (stbi_uc const *buffer, int len);
-
-extern stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-#ifndef STBI_NO_STDIO
-extern int stbi_tga_test_file (FILE *f);
-extern stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-
-// is it a psd?
-extern int stbi_psd_test_memory (stbi_uc const *buffer, int len);
-
-extern stbi_uc *stbi_psd_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-#ifndef STBI_NO_STDIO
-extern int stbi_psd_test_file (FILE *f);
-extern stbi_uc *stbi_psd_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-
-// is it an hdr?
-extern int stbi_hdr_test_memory (stbi_uc const *buffer, int len);
-
-extern float * stbi_hdr_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-#ifndef STBI_NO_STDIO
-extern int stbi_hdr_test_file (FILE *f);
-extern float * stbi_hdr_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-
-// define new loaders
-typedef struct
-{
- int (*test_memory)(stbi_uc const *buffer, int len);
- stbi_uc * (*load_from_memory)(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
- #ifndef STBI_NO_STDIO
- int (*test_file)(FILE *f);
- stbi_uc * (*load_from_file)(FILE *f, int *x, int *y, int *comp, int req_comp);
- #endif
-} stbi_loader;
-
-// register a loader by filling out the above structure (you must defined ALL functions)
-// returns 1 if added or already added, 0 if not added (too many loaders)
-// NOT THREADSAFE
-extern int stbi_register_loader(stbi_loader *loader);
-
-// define faster low-level operations (typically SIMD support)
-#if STBI_SIMD
-typedef void (*stbi_idct_8x8)(uint8 *out, int out_stride, short data[64], unsigned short *dequantize);
-// compute an integer IDCT on "input"
-// input[x] = data[x] * dequantize[x]
-// write results to 'out': 64 samples, each run of 8 spaced by 'out_stride'
-// CLAMP results to 0..255
-typedef void (*stbi_YCbCr_to_RGB_run)(uint8 *output, uint8 const *y, uint8 const *cb, uint8 const *cr, int count, int step);
-// compute a conversion from YCbCr to RGB
-// 'count' pixels
-// write pixels to 'output'; each pixel is 'step' bytes (either 3 or 4; if 4, write '255' as 4th), order R,G,B
-// y: Y input channel
-// cb: Cb input channel; scale/biased to be 0..255
-// cr: Cr input channel; scale/biased to be 0..255
-
-extern void stbi_install_idct(stbi_idct_8x8 func);
-extern void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func);
-#endif // STBI_SIMD
-
-//#ifdef __cplusplus
-//}
-//#endif
-
-}
-
-//
-//
-//// end header file /////////////////////////////////////////////////////
-#endif // STBI_INCLUDE_STB_IMAGE_H
-
-#ifndef STBI_HEADER_FILE_ONLY
-
-#include "crn_core.h"
-
-#ifndef STBI_NO_HDR
-#include <math.h> // ldexp
-#include <string.h> // strcmp
-#endif
-
-#ifndef STBI_NO_STDIO
-#include <stdio.h>
-#endif
-#include <stdlib.h>
-#include <memory.h>
-#include <assert.h>
-#include <stdarg.h>
-
-namespace crnlib {
-
-inline void* stb_malloc(size_t c) { return crnlib::crnlib_malloc(c); }
-inline void* stb_realloc(void *p, size_t c) { return crnlib::crnlib_realloc(p, c); }
-inline void stb_free(void *p) { crnlib::crnlib_free(p); }
-
-#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__MINGW64__)
- #ifdef __cplusplus
- #define __forceinline inline
- #else
- #define __forceinline
- #endif
-#endif
-
-
-// implementation:
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef signed short int16;
-typedef unsigned int uint32;
-typedef signed int int32;
-typedef unsigned int uint;
-
-// should produce compiler error if size is wrong
-typedef unsigned char validate_uint32[sizeof(uint32)==4];
-
-#if defined(STBI_NO_STDIO) && !defined(STBI_NO_WRITE)
-#define STBI_NO_WRITE
-#endif
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// Generic API that works on all image types
-//
-
-// this is not threadsafe
-static const char *failure_reason;
-
-const char *stbi_failure_reason(void)
-{
- return failure_reason;
-}
-
-static int e(const char *str)
-{
- failure_reason = str;
- return 0;
-}
-
-#ifdef STBI_NO_FAILURE_STRINGS
- #define e(x,y) 0
-#elif defined(STBI_FAILURE_USERMSG)
- #define e(x,y) e(y)
-#else
- #define e(x,y) e(x)
-#endif
-
-#define epf(x,y) ((float *) (e(x,y)?NULL:NULL))
-#define epuc(x,y) ((unsigned char *) (e(x,y)?NULL:NULL))
-
-void stbi_image_free(void *retval_from_stbi_load)
-{
- stb_free(retval_from_stbi_load);
-}
-
-#define MAX_LOADERS 32
-stbi_loader *loaders[MAX_LOADERS];
-static int max_loaders = 0;
-
-int stbi_register_loader(stbi_loader *loader)
-{
- int i;
- for (i=0; i < MAX_LOADERS; ++i) {
- // already present?
- if (loaders[i] == loader)
- return 1;
- // end of the list?
- if (loaders[i] == NULL) {
- loaders[i] = loader;
- max_loaders = i+1;
- return 1;
- }
- }
- // no room for it
- return 0;
-}
-
-#ifndef STBI_NO_HDR
-static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp);
-static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp);
-#endif
-
-#ifndef STBI_NO_STDIO
-unsigned char *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- FILE *f = fopen(filename, "rb");
- unsigned char *result;
- if (!f) return epuc("can't fopen", "Unable to open file");
- result = stbi_load_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return result;
-}
-
-#ifdef _MSC_VER
-unsigned char *stbi_load_w(wchar_t const *filename, int *x, int *y, int *comp, int req_comp)
-{
- FILE *f = _wfopen(filename, L"rb");
- unsigned char *result;
- if (!f) return epuc("can't fopen", "Unable to open file");
- result = stbi_load_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return result;
-}
-#endif
-
-unsigned char *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- int i;
- if (stbi_jpeg_test_file(f))
- return stbi_jpeg_load_from_file(f,x,y,comp,req_comp);
- if (stbi_png_test_file(f))
- return stbi_png_load_from_file(f,x,y,comp,req_comp);
- if (stbi_bmp_test_file(f))
- return stbi_bmp_load_from_file(f,x,y,comp,req_comp);
- if (stbi_psd_test_file(f))
- return stbi_psd_load_from_file(f,x,y,comp,req_comp);
- #ifndef STBI_NO_HDR
- if (stbi_hdr_test_file(f)) {
- float *hdr = stbi_hdr_load_from_file(f, x,y,comp,req_comp);
- return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);
- }
- #endif
- for (i=0; i < max_loaders; ++i)
- if (loaders[i]->test_file(f))
- return loaders[i]->load_from_file(f,x,y,comp,req_comp);
- // test tga last because it's a crappy test!
- if (stbi_tga_test_file(f))
- return stbi_tga_load_from_file(f,x,y,comp,req_comp);
- return epuc("unknown image type", "Image not of any known type, or corrupt");
-}
-#endif
-
-unsigned char *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- int i;
- if (stbi_jpeg_test_memory(buffer,len))
- return stbi_jpeg_load_from_memory(buffer,len,x,y,comp,req_comp);
- if (stbi_png_test_memory(buffer,len))
- return stbi_png_load_from_memory(buffer,len,x,y,comp,req_comp);
- if (stbi_bmp_test_memory(buffer,len))
- return stbi_bmp_load_from_memory(buffer,len,x,y,comp,req_comp);
- if (stbi_psd_test_memory(buffer,len))
- return stbi_psd_load_from_memory(buffer,len,x,y,comp,req_comp);
- #ifndef STBI_NO_HDR
- if (stbi_hdr_test_memory(buffer, len)) {
- float *hdr = stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp);
- return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);
- }
- #endif
- for (i=0; i < max_loaders; ++i)
- if (loaders[i]->test_memory(buffer,len))
- return loaders[i]->load_from_memory(buffer,len,x,y,comp,req_comp);
- // test tga last because it's a crappy test!
- if (stbi_tga_test_memory(buffer,len))
- return stbi_tga_load_from_memory(buffer,len,x,y,comp,req_comp);
- return epuc("unknown image type", "Image not of any known type, or corrupt");
-}
-
-#ifndef STBI_NO_HDR
-
-#ifndef STBI_NO_STDIO
-float *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- FILE *f = fopen(filename, "rb");
- float *result;
- if (!f) return epf("can't fopen", "Unable to open file");
- result = stbi_loadf_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return result;
-}
-
-float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- unsigned char *data;
- #ifndef STBI_NO_HDR
- if (stbi_hdr_test_file(f))
- return stbi_hdr_load_from_file(f,x,y,comp,req_comp);
- #endif
- data = stbi_load_from_file(f, x, y, comp, req_comp);
- if (data)
- return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);
- return epf("unknown image type", "Image not of any known type, or corrupt");
-}
-#endif
-
-float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi_uc *data;
- #ifndef STBI_NO_HDR
- if (stbi_hdr_test_memory(buffer, len))
- return stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp);
- #endif
- data = stbi_load_from_memory(buffer, len, x, y, comp, req_comp);
- if (data)
- return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);
- return epf("unknown image type", "Image not of any known type, or corrupt");
-}
-#endif
-
-// these is-hdr-or-not is defined independent of whether STBI_NO_HDR is
-// defined, for API simplicity; if STBI_NO_HDR is defined, it always
-// reports false!
-
-int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)
-{
- #ifndef STBI_NO_HDR
- return stbi_hdr_test_memory(buffer, len);
- #else
- return 0;
- #endif
-}
-
-#ifndef STBI_NO_STDIO
-extern int stbi_is_hdr (char const *filename)
-{
- FILE *f = fopen(filename, "rb");
- int result=0;
- if (f) {
- result = stbi_is_hdr_from_file(f);
- fclose(f);
- }
- return result;
-}
-
-extern int stbi_is_hdr_from_file(FILE *f)
-{
- #ifndef STBI_NO_HDR
- return stbi_hdr_test_file(f);
- #else
- return 0;
- #endif
-}
-
-#endif
-
-// @TODO: get image dimensions & components without fully decoding
-#ifndef STBI_NO_STDIO
-extern int stbi_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-#ifndef STBI_NO_HDR
-static float h2l_gamma_i=1.0f/2.2f, h2l_scale_i=1.0f;
-static float l2h_gamma=2.2f, l2h_scale=1.0f;
-
-void stbi_hdr_to_ldr_gamma(float gamma) { h2l_gamma_i = 1/gamma; }
-void stbi_hdr_to_ldr_scale(float scale) { h2l_scale_i = 1/scale; }
-
-void stbi_ldr_to_hdr_gamma(float gamma) { l2h_gamma = gamma; }
-void stbi_ldr_to_hdr_scale(float scale) { l2h_scale = scale; }
-#endif
-
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// Common code used by all image loaders
-//
-
-enum
-{
- SCAN_load=0,
- SCAN_type,
- SCAN_header,
-};
-
-typedef struct
-{
- uint32 img_x, img_y;
- int img_n, img_out_n;
-
- #ifndef STBI_NO_STDIO
- FILE *img_file;
- #endif
- uint8 *img_buffer, *img_buffer_end;
-} stbi;
-
-#ifndef STBI_NO_STDIO
-static void start_file(stbi *s, FILE *f)
-{
- s->img_file = f;
-}
-#endif
-
-static void start_mem(stbi *s, uint8 const *buffer, int len)
-{
-#ifndef STBI_NO_STDIO
- s->img_file = NULL;
-#endif
- s->img_buffer = (uint8 *) buffer;
- s->img_buffer_end = (uint8 *) buffer+len;
-}
-
-__forceinline static int get8(stbi *s)
-{
-#ifndef STBI_NO_STDIO
- if (s->img_file) {
- int c = fgetc(s->img_file);
- return c == EOF ? 0 : c;
- }
-#endif
- if (s->img_buffer < s->img_buffer_end)
- return *s->img_buffer++;
- return 0;
-}
-
-__forceinline static int at_eof(stbi *s)
-{
-#ifndef STBI_NO_STDIO
- if (s->img_file)
- return feof(s->img_file);
-#endif
- return s->img_buffer >= s->img_buffer_end;
-}
-
-__forceinline static uint8 get8u(stbi *s)
-{
- return (uint8) get8(s);
-}
-
-static void skip(stbi *s, int n)
-{
-#ifndef STBI_NO_STDIO
- if (s->img_file)
- fseek(s->img_file, n, SEEK_CUR);
- else
-#endif
- s->img_buffer += n;
-}
-
-static int get16(stbi *s)
-{
- int z = get8(s);
- return (z << 8) + get8(s);
-}
-
-static uint32 get32(stbi *s)
-{
- uint32 z = get16(s);
- return (z << 16) + get16(s);
-}
-
-static int get16le(stbi *s)
-{
- int z = get8(s);
- return z + (get8(s) << 8);
-}
-
-static uint32 get32le(stbi *s)
-{
- uint32 z = get16le(s);
- return z + (get16le(s) << 16);
-}
-
-static void getn(stbi *s, stbi_uc *buffer, int n)
-{
-#ifndef STBI_NO_STDIO
- if (s->img_file) {
- size_t nr = fread(buffer, 1, n, s->img_file); nr;
- return;
- }
-#endif
- memcpy(buffer, s->img_buffer, n);
- s->img_buffer += n;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// generic converter from built-in img_n to req_comp
-// individual types do this automatically as much as possible (e.g. jpeg
-// does all cases internally since it needs to colorspace convert anyway,
-// and it never has alpha, so very few cases ). png can automatically
-// interleave an alpha=255 channel, but falls back to this for other cases
-//
-// assume data buffer is malloced, so stb_malloc a new one and free that one
-// only failure mode is stb_malloc failing
-
-static uint8 compute_y(int r, int g, int b)
-{
- return (uint8) (((r*77) + (g*150) + (29*b)) >> 8);
-}
-
-static unsigned char *convert_format(unsigned char *data, int img_n, int req_comp, uint x, uint y)
-{
- int i,j;
- unsigned char *good;
-
- if (req_comp == img_n) return data;
- assert(req_comp >= 1 && req_comp <= 4);
-
- good = (unsigned char *) stb_malloc(req_comp * x * y);
- if (good == NULL) {
- stb_free(data);
- return epuc("outofmem", "Out of memory");
- }
-
- for (j=0; j < (int) y; ++j) {
- unsigned char *src = data + j * x * img_n ;
- unsigned char *dest = good + j * x * req_comp;
-
- #define COMBO(a,b) ((a)*8+(b))
- #define CASE(a,b) case COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)
- // convert source image with img_n components to one with req_comp components;
- // avoid switch per pixel, so use switch per scanline and massive macros
- switch(COMBO(img_n, req_comp)) {
- CASE(1,2) dest[0]=src[0], dest[1]=255; break;
- CASE(1,3) dest[0]=dest[1]=dest[2]=src[0]; break;
- CASE(1,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; break;
- CASE(2,1) dest[0]=src[0]; break;
- CASE(2,3) dest[0]=dest[1]=dest[2]=src[0]; break;
- CASE(2,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; break;
- CASE(3,4) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; break;
- CASE(3,1) dest[0]=compute_y(src[0],src[1],src[2]); break;
- CASE(3,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = 255; break;
- CASE(4,1) dest[0]=compute_y(src[0],src[1],src[2]); break;
- CASE(4,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = src[3]; break;
- CASE(4,3) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; break;
- default: assert(0);
- }
- #undef CASE
- }
-
- stb_free(data);
- return good;
-}
-
-#ifndef STBI_NO_HDR
-static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp)
-{
- int i,k,n;
- float *output = (float *) stb_malloc(x * y * comp * sizeof(float));
- if (output == NULL) { stb_free(data); return epf("outofmem", "Out of memory"); }
- // compute number of non-alpha components
- if (comp & 1) n = comp; else n = comp-1;
- for (i=0; i < x*y; ++i) {
- for (k=0; k < n; ++k) {
- output[i*comp + k] = (float) pow(data[i*comp+k]/255.0f, l2h_gamma) * l2h_scale;
- }
- if (k < comp) output[i*comp + k] = data[i*comp+k]/255.0f;
- }
- stb_free(data);
- return output;
-}
-
-#define float2int(x) ((int) (x))
-static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp)
-{
- int i,k,n;
- stbi_uc *output = (stbi_uc *) stb_malloc(x * y * comp);
- if (output == NULL) { stb_free(data); return epuc("outofmem", "Out of memory"); }
- // compute number of non-alpha components
- if (comp & 1) n = comp; else n = comp-1;
- for (i=0; i < x*y; ++i) {
- for (k=0; k < n; ++k) {
- float z = (float) pow(data[i*comp+k]*h2l_scale_i, h2l_gamma_i) * 255 + 0.5f;
- if (z < 0) z = 0;
- if (z > 255) z = 255;
- output[i*comp + k] = float2int(z);
- }
- if (k < comp) {
- float z = data[i*comp+k] * 255 + 0.5f;
- if (z < 0) z = 0;
- if (z > 255) z = 255;
- output[i*comp + k] = float2int(z);
- }
- }
- stb_free(data);
- return output;
-}
-#endif
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// "baseline" JPEG/JFIF decoder (not actually fully baseline implementation)
-//
-// simple implementation
-// - channel subsampling of at most 2 in each dimension
-// - doesn't support delayed output of y-dimension
-// - simple interface (only one output format: 8-bit interleaved RGB)
-// - doesn't try to recover corrupt jpegs
-// - doesn't allow partial loading, loading multiple at once
-// - still fast on x86 (copying globals into locals doesn't help x86)
-// - allocates lots of intermediate memory (full size of all components)
-// - non-interleaved case requires this anyway
-// - allows good upsampling (see next)
-// high-quality
-// - upsampled channels are bilinearly interpolated, even across blocks
-// - quality integer IDCT derived from IJG's 'slow'
-// performance
-// - fast huffman; reasonable integer IDCT
-// - uses a lot of intermediate memory, could cache poorly
-// - load http://nothings.org/remote/anemones.jpg 3 times on 2.8Ghz P4
-// stb_jpeg: 1.34 seconds (MSVC6, default release build)
-// stb_jpeg: 1.06 seconds (MSVC6, processor = Pentium Pro)
-// IJL11.dll: 1.08 seconds (compiled by intel)
-// IJG 1998: 0.98 seconds (MSVC6, makefile provided by IJG)
-// IJG 1998: 0.95 seconds (MSVC6, makefile + proc=PPro)
-
-// huffman decoding acceleration
-#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache
-
-typedef struct
-{
- uint8 fast[1 << FAST_BITS];
- // weirdly, repacking this into AoS is a 10% speed loss, instead of a win
- uint16 code[256];
- uint8 values[256];
- uint8 size[257];
- unsigned int maxcode[18];
- int delta[17]; // old 'firstsymbol' - old 'firstcode'
-} huffman;
-
-typedef struct
-{
- #if STBI_SIMD
- unsigned short dequant2[4][64];
- #endif
- stbi s;
- huffman huff_dc[4];
- huffman huff_ac[4];
- uint8 dequant[4][64];
-
-// sizes for components, interleaved MCUs
- int img_h_max, img_v_max;
- int img_mcu_x, img_mcu_y;
- int img_mcu_w, img_mcu_h;
-
-// definition of jpeg image component
- struct
- {
- int id;
- int h,v;
- int tq;
- int hd,ha;
- int dc_pred;
-
- int x,y,w2,h2;
- uint8 *data;
- void *raw_data;
- uint8 *linebuf;
- } img_comp[4];
-
- uint32 code_buffer; // jpeg entropy-coded buffer
- int code_bits; // number of valid bits
- unsigned char marker; // marker seen while filling entropy buffer
- int nomore; // flag if we saw a marker so must stop
-
- int scan_n, order[4];
- int restart_interval, todo;
-} jpeg;
-
-static int build_huffman(huffman *h, int *count)
-{
- int i,j,k=0,code;
- // build size list for each symbol (from JPEG spec)
- for (i=0; i < 16; ++i)
- for (j=0; j < count[i]; ++j)
- h->size[k++] = (uint8) (i+1);
- h->size[k] = 0;
-
- // compute actual symbols (from jpeg spec)
- code = 0;
- k = 0;
- for(j=1; j <= 16; ++j) {
- // compute delta to add to code to compute symbol id
- h->delta[j] = k - code;
- if (h->size[k] == j) {
- while (h->size[k] == j)
- h->code[k++] = (uint16) (code++);
- if (code-1 >= (1 << j)) return e("bad code lengths","Corrupt JPEG");
- }
- // compute largest code + 1 for this size, preshifted as needed later
- h->maxcode[j] = code << (16-j);
- code <<= 1;
- }
- h->maxcode[j] = 0xffffffff;
-
- // build non-spec acceleration table; 255 is flag for not-accelerated
- memset(h->fast, 255, 1 << FAST_BITS);
- for (i=0; i < k; ++i) {
- int s = h->size[i];
- if (s <= FAST_BITS) {
- int c = h->code[i] << (FAST_BITS-s);
- int m = 1 << (FAST_BITS-s);
- for (j=0; j < m; ++j) {
- h->fast[c+j] = (uint8) i;
- }
- }
- }
- return 1;
-}
-
-static void grow_buffer_unsafe(jpeg *j)
-{
- do {
- int b = j->nomore ? 0 : get8(&j->s);
- if (b == 0xff) {
- int c = get8(&j->s);
- if (c != 0) {
- j->marker = (unsigned char) c;
- j->nomore = 1;
- return;
- }
- }
- j->code_buffer = (j->code_buffer << 8) | b;
- j->code_bits += 8;
- } while (j->code_bits <= 24);
-}
-
-// (1 << n) - 1
-static uint32 bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535};
-
-// decode a jpeg huffman value from the bitstream
-__forceinline static int decode(jpeg *j, huffman *h)
-{
- unsigned int temp;
- int c,k;
-
- if (j->code_bits < 16) grow_buffer_unsafe(j);
-
- // look at the top FAST_BITS and determine what symbol ID it is,
- // if the code is <= FAST_BITS
- c = (j->code_buffer >> (j->code_bits - FAST_BITS)) & ((1 << FAST_BITS)-1);
- k = h->fast[c];
- if (k < 255) {
- if (h->size[k] > j->code_bits)
- return -1;
- j->code_bits -= h->size[k];
- return h->values[k];
- }
-
- // naive test is to shift the code_buffer down so k bits are
- // valid, then test against maxcode. To speed this up, we've
- // preshifted maxcode left so that it has (16-k) 0s at the
- // end; in other words, regardless of the number of bits, it
- // wants to be compared against something shifted to have 16;
- // that way we don't need to shift inside the loop.
- if (j->code_bits < 16)
- temp = (j->code_buffer << (16 - j->code_bits)) & 0xffff;
- else
- temp = (j->code_buffer >> (j->code_bits - 16)) & 0xffff;
- for (k=FAST_BITS+1 ; ; ++k)
- if (temp < h->maxcode[k])
- break;
- if (k == 17) {
- // error! code not found
- j->code_bits -= 16;
- return -1;
- }
-
- if (k > j->code_bits)
- return -1;
-
- // convert the huffman code to the symbol id
- c = ((j->code_buffer >> (j->code_bits - k)) & bmask[k]) + h->delta[k];
- assert((((j->code_buffer) >> (j->code_bits - h->size[c])) & bmask[h->size[c]]) == h->code[c]);
-
- // convert the id to a symbol
- j->code_bits -= k;
- return h->values[c];
-}
-
-// combined JPEG 'receive' and JPEG 'extend', since baseline
-// always extends everything it receives.
-__forceinline static int extend_receive(jpeg *j, int n)
-{
- unsigned int m = 1 << (n-1);
- unsigned int k;
- if (j->code_bits < n) grow_buffer_unsafe(j);
- k = (j->code_buffer >> (j->code_bits - n)) & bmask[n];
- j->code_bits -= n;
- // the following test is probably a random branch that won't
- // predict well. I tried to table accelerate it but failed.
- // maybe it's compiling as a conditional move?
- if (k < m)
- return (-1 << n) + k + 1;
- else
- return k;
-}
-
-// given a value that's at position X in the zigzag stream,
-// where does it appear in the 8x8 matrix coded as row-major?
-static uint8 dezigzag[64+15] =
-{
- 0, 1, 8, 16, 9, 2, 3, 10,
- 17, 24, 32, 25, 18, 11, 4, 5,
- 12, 19, 26, 33, 40, 48, 41, 34,
- 27, 20, 13, 6, 7, 14, 21, 28,
- 35, 42, 49, 56, 57, 50, 43, 36,
- 29, 22, 15, 23, 30, 37, 44, 51,
- 58, 59, 52, 45, 38, 31, 39, 46,
- 53, 60, 61, 54, 47, 55, 62, 63,
- // let corrupt input sample past end
- 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63
-};
-
-// decode one 64-entry block--
-static int decode_block(jpeg *j, short data[64], huffman *hdc, huffman *hac, int b)
-{
- int diff,dc,k;
- int t = decode(j, hdc);
- if (t < 0) return e("bad huffman code","Corrupt JPEG");
-
- // 0 all the ac values now so we can do it 32-bits at a time
- memset(data,0,64*sizeof(data[0]));
-
- diff = t ? extend_receive(j, t) : 0;
- dc = j->img_comp[b].dc_pred + diff;
- j->img_comp[b].dc_pred = dc;
- data[0] = (short) dc;
-
- // decode AC components, see JPEG spec
- k = 1;
- do {
- int r,s;
- int rs = decode(j, hac);
- if (rs < 0) return e("bad huffman code","Corrupt JPEG");
- s = rs & 15;
- r = rs >> 4;
- if (s == 0) {
- if (rs != 0xf0) break; // end block
- k += 16;
- } else {
- k += r;
- // decode into unzigzag'd location
- data[dezigzag[k++]] = (short) extend_receive(j,s);
- }
- } while (k < 64);
- return 1;
-}
-
-// take a -128..127 value and clamp it and convert to 0..255
-__forceinline static uint8 clamp(int x)
-{
- x += 128;
- // trick to use a single test to catch both cases
- if ((unsigned int) x > 255) {
- if (x < 0) return 0;
- if (x > 255) return 255;
- }
- return (uint8) x;
-}
-
-#define f2f(x) (int) (((x) * 4096 + 0.5))
-#define fsh(x) ((x) << 12)
-
-// derived from jidctint -- DCT_ISLOW
-#define IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \
- int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \
- p2 = s2; \
- p3 = s6; \
- p1 = (p2+p3) * f2f(0.5411961f); \
- t2 = p1 + p3*f2f(-1.847759065f); \
- t3 = p1 + p2*f2f( 0.765366865f); \
- p2 = s0; \
- p3 = s4; \
- t0 = fsh(p2+p3); \
- t1 = fsh(p2-p3); \
- x0 = t0+t3; \
- x3 = t0-t3; \
- x1 = t1+t2; \
- x2 = t1-t2; \
- t0 = s7; \
- t1 = s5; \
- t2 = s3; \
- t3 = s1; \
- p3 = t0+t2; \
- p4 = t1+t3; \
- p1 = t0+t3; \
- p2 = t1+t2; \
- p5 = (p3+p4)*f2f( 1.175875602f); \
- t0 = t0*f2f( 0.298631336f); \
- t1 = t1*f2f( 2.053119869f); \
- t2 = t2*f2f( 3.072711026f); \
- t3 = t3*f2f( 1.501321110f); \
- p1 = p5 + p1*f2f(-0.899976223f); \
- p2 = p5 + p2*f2f(-2.562915447f); \
- p3 = p3*f2f(-1.961570560f); \
- p4 = p4*f2f(-0.390180644f); \
- t3 += p1+p4; \
- t2 += p2+p3; \
- t1 += p2+p4; \
- t0 += p1+p3;
-
-#if !STBI_SIMD
-// .344 seconds on 3*anemones.jpg
-static void idct_block(uint8 *out, int out_stride, short data[64], uint8 *dequantize)
-{
- int i,val[64],*v=val;
- uint8 *o,*dq = dequantize;
- short *d = data;
-
- // columns
- for (i=0; i < 8; ++i,++d,++dq, ++v) {
- // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing
- if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0
- && d[40]==0 && d[48]==0 && d[56]==0) {
- // no shortcut 0 seconds
- // (1|2|3|4|5|6|7)==0 0 seconds
- // all separate -0.047 seconds
- // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds
- int dcterm = d[0] * dq[0] << 2;
- v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;
- } else {
- IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24],
- d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56])
- // constants scaled things up by 1<<12; let's bring them back
- // down, but keep 2 extra bits of precision
- x0 += 512; x1 += 512; x2 += 512; x3 += 512;
- v[ 0] = (x0+t3) >> 10;
- v[56] = (x0-t3) >> 10;
- v[ 8] = (x1+t2) >> 10;
- v[48] = (x1-t2) >> 10;
- v[16] = (x2+t1) >> 10;
- v[40] = (x2-t1) >> 10;
- v[24] = (x3+t0) >> 10;
- v[32] = (x3-t0) >> 10;
- }
- }
-
- for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) {
- // no fast case since the first 1D IDCT spread components out
- IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7])
- // constants scaled things up by 1<<12, plus we had 1<<2 from first
- // loop, plus horizontal and vertical each scale by sqrt(8) so together
- // we've got an extra 1<<3, so 1<<17 total we need to remove.
- x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536;
- o[0] = clamp((x0+t3) >> 17);
- o[7] = clamp((x0-t3) >> 17);
- o[1] = clamp((x1+t2) >> 17);
- o[6] = clamp((x1-t2) >> 17);
- o[2] = clamp((x2+t1) >> 17);
- o[5] = clamp((x2-t1) >> 17);
- o[3] = clamp((x3+t0) >> 17);
- o[4] = clamp((x3-t0) >> 17);
- }
-}
-#else
-static void idct_block(uint8 *out, int out_stride, short data[64], unsigned short *dequantize)
-{
- int i,val[64],*v=val;
- uint8 *o;
- unsigned short *dq = dequantize;
- short *d = data;
-
- // columns
- for (i=0; i < 8; ++i,++d,++dq, ++v) {
- // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing
- if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0
- && d[40]==0 && d[48]==0 && d[56]==0) {
- // no shortcut 0 seconds
- // (1|2|3|4|5|6|7)==0 0 seconds
- // all separate -0.047 seconds
- // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds
- int dcterm = d[0] * dq[0] << 2;
- v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;
- } else {
- IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24],
- d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56])
- // constants scaled things up by 1<<12; let's bring them back
- // down, but keep 2 extra bits of precision
- x0 += 512; x1 += 512; x2 += 512; x3 += 512;
- v[ 0] = (x0+t3) >> 10;
- v[56] = (x0-t3) >> 10;
- v[ 8] = (x1+t2) >> 10;
- v[48] = (x1-t2) >> 10;
- v[16] = (x2+t1) >> 10;
- v[40] = (x2-t1) >> 10;
- v[24] = (x3+t0) >> 10;
- v[32] = (x3-t0) >> 10;
- }
- }
-
- for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) {
- // no fast case since the first 1D IDCT spread components out
- IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7])
- // constants scaled things up by 1<<12, plus we had 1<<2 from first
- // loop, plus horizontal and vertical each scale by sqrt(8) so together
- // we've got an extra 1<<3, so 1<<17 total we need to remove.
- x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536;
- o[0] = clamp((x0+t3) >> 17);
- o[7] = clamp((x0-t3) >> 17);
- o[1] = clamp((x1+t2) >> 17);
- o[6] = clamp((x1-t2) >> 17);
- o[2] = clamp((x2+t1) >> 17);
- o[5] = clamp((x2-t1) >> 17);
- o[3] = clamp((x3+t0) >> 17);
- o[4] = clamp((x3-t0) >> 17);
- }
-}
-static stbi_idct_8x8 stbi_idct_installed = idct_block;
-
-extern void stbi_install_idct(stbi_idct_8x8 func)
-{
- stbi_idct_installed = func;
-}
-#endif
-
-#define MARKER_none 0xff
-// if there's a pending marker from the entropy stream, return that
-// otherwise, fetch from the stream and get a marker. if there's no
-// marker, return 0xff, which is never a valid marker value
-static uint8 get_marker(jpeg *j)
-{
- uint8 x;
- if (j->marker != MARKER_none) { x = j->marker; j->marker = MARKER_none; return x; }
- x = get8u(&j->s);
- if (x != 0xff) return MARKER_none;
- while (x == 0xff)
- x = get8u(&j->s);
- return x;
-}
-
-// in each scan, we'll have scan_n components, and the order
-// of the components is specified by order[]
-#define RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7)
-
-// after a restart interval, reset the entropy decoder and
-// the dc prediction
-static void reset(jpeg *j)
-{
- j->code_bits = 0;
- j->code_buffer = 0;
- j->nomore = 0;
- j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = 0;
- j->marker = MARKER_none;
- j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff;
- // no more than 1<<31 MCUs if no restart_interal? that's plenty safe,
- // since we don't even allow 1<<30 pixels
-}
-
-static int parse_entropy_coded_data(jpeg *z)
-{
- reset(z);
- if (z->scan_n == 1) {
- int i,j;
- #if STBI_SIMD
- __declspec(align(16))
- #endif
- short data[64];
- int n = z->order[0];
- // non-interleaved data, we just need to process one block at a time,
- // in trivial scanline order
- // number of blocks to do just depends on how many actual "pixels" this
- // component has, independent of interleaved MCU blocking and such
- int w = (z->img_comp[n].x+7) >> 3;
- int h = (z->img_comp[n].y+7) >> 3;
- for (j=0; j < h; ++j) {
- for (i=0; i < w; ++i) {
- if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0;
- #if STBI_SIMD
- stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]);
- #else
- idct_block(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]);
- #endif
- // every data block is an MCU, so countdown the restart interval
- if (--z->todo <= 0) {
- if (z->code_bits < 24) grow_buffer_unsafe(z);
- // if it's NOT a restart, then just bail, so we get corrupt data
- // rather than no data
- if (!RESTART(z->marker)) return 1;
- reset(z);
- }
- }
- }
- } else { // interleaved!
- int i,j,k,x,y;
- short data[64];
- for (j=0; j < z->img_mcu_y; ++j) {
- for (i=0; i < z->img_mcu_x; ++i) {
- // scan an interleaved mcu... process scan_n components in order
- for (k=0; k < z->scan_n; ++k) {
- int n = z->order[k];
- // scan out an mcu's worth of this component; that's just determined
- // by the basic H and V specified for the component
- for (y=0; y < z->img_comp[n].v; ++y) {
- for (x=0; x < z->img_comp[n].h; ++x) {
- int x2 = (i*z->img_comp[n].h + x)*8;
- int y2 = (j*z->img_comp[n].v + y)*8;
- if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0;
- #if STBI_SIMD
- stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]);
- #else
- idct_block(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]);
- #endif
- }
- }
- }
- // after all interleaved components, that's an interleaved MCU,
- // so now count down the restart interval
- if (--z->todo <= 0) {
- if (z->code_bits < 24) grow_buffer_unsafe(z);
- // if it's NOT a restart, then just bail, so we get corrupt data
- // rather than no data
- if (!RESTART(z->marker)) return 1;
- reset(z);
- }
- }
- }
- }
- return 1;
-}
-
-static int process_marker(jpeg *z, int m)
-{
- int L;
- switch (m) {
- case MARKER_none: // no marker found
- return e("expected marker","Corrupt JPEG");
-
- case 0xC2: // SOF - progressive
- return e("progressive jpeg","JPEG format not supported (progressive)");
-
- case 0xDD: // DRI - specify restart interval
- if (get16(&z->s) != 4) return e("bad DRI len","Corrupt JPEG");
- z->restart_interval = get16(&z->s);
- return 1;
-
- case 0xDB: // DQT - define quantization table
- L = get16(&z->s)-2;
- while (L > 0) {
- int q = get8(&z->s);
- int p = q >> 4;
- int t = q & 15,i;
- if (p != 0) return e("bad DQT type","Corrupt JPEG");
- if (t > 3) return e("bad DQT table","Corrupt JPEG");
- for (i=0; i < 64; ++i)
- z->dequant[t][dezigzag[i]] = get8u(&z->s);
- #if STBI_SIMD
- for (i=0; i < 64; ++i)
- z->dequant2[t][i] = z->dequant[t][i];
- #endif
- L -= 65;
- }
- return L==0;
-
- case 0xC4: // DHT - define huffman table
- L = get16(&z->s)-2;
- while (L > 0) {
- uint8 *v;
- int sizes[16],i,m=0;
- int q = get8(&z->s);
- int tc = q >> 4;
- int th = q & 15;
- if (tc > 1 || th > 3) return e("bad DHT header","Corrupt JPEG");
- for (i=0; i < 16; ++i) {
- sizes[i] = get8(&z->s);
- m += sizes[i];
- }
- L -= 17;
- if (tc == 0) {
- if (!build_huffman(z->huff_dc+th, sizes)) return 0;
- v = z->huff_dc[th].values;
- } else {
- if (!build_huffman(z->huff_ac+th, sizes)) return 0;
- v = z->huff_ac[th].values;
- }
- for (i=0; i < m; ++i)
- v[i] = get8u(&z->s);
- L -= m;
- }
- return L==0;
- }
- // check for comment block or APP blocks
- if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) {
- skip(&z->s, get16(&z->s)-2);
- return 1;
- }
- return 0;
-}
-
-// after we see SOS
-static int process_scan_header(jpeg *z)
-{
- int i;
- int Ls = get16(&z->s);
- z->scan_n = get8(&z->s);
- if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s.img_n) return e("bad SOS component count","Corrupt JPEG");
- if (Ls != 6+2*z->scan_n) return e("bad SOS len","Corrupt JPEG");
- for (i=0; i < z->scan_n; ++i) {
- int id = get8(&z->s), which;
- int q = get8(&z->s);
- for (which = 0; which < z->s.img_n; ++which)
- if (z->img_comp[which].id == id)
- break;
- if (which == z->s.img_n) return 0;
- z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return e("bad DC huff","Corrupt JPEG");
- z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return e("bad AC huff","Corrupt JPEG");
- z->order[i] = which;
- }
- if (get8(&z->s) != 0) return e("bad SOS","Corrupt JPEG");
- get8(&z->s); // should be 63, but might be 0
- if (get8(&z->s) != 0) return e("bad SOS","Corrupt JPEG");
-
- return 1;
-}
-
-static int process_frame_header(jpeg *z, int scan)
-{
- stbi *s = &z->s;
- int Lf,p,i,q, h_max=1,v_max=1,c;
- Lf = get16(s); if (Lf < 11) return e("bad SOF len","Corrupt JPEG"); // JPEG
- p = get8(s); if (p != 8) return e("only 8-bit","JPEG format not supported: 8-bit only"); // JPEG baseline
- s->img_y = get16(s); if (s->img_y == 0) return e("no header height", "JPEG format not supported: delayed height"); // Legal, but we don't handle it--but neither does IJG
- s->img_x = get16(s); if (s->img_x == 0) return e("0 width","Corrupt JPEG"); // JPEG requires
- c = get8(s);
- if (c != 3 && c != 1) return e("bad component count","Corrupt JPEG"); // JFIF requires
- s->img_n = c;
- for (i=0; i < c; ++i) {
- z->img_comp[i].data = NULL;
- z->img_comp[i].linebuf = NULL;
- }
-
- if (Lf != 8+3*s->img_n) return e("bad SOF len","Corrupt JPEG");
-
- for (i=0; i < s->img_n; ++i) {
- z->img_comp[i].id = get8(s);
- if (z->img_comp[i].id != i+1) // JFIF requires
- if (z->img_comp[i].id != i) // some version of jpegtran outputs non-JFIF-compliant files!
- return e("bad component ID","Corrupt JPEG");
- q = get8(s);
- z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return e("bad H","Corrupt JPEG");
- z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return e("bad V","Corrupt JPEG");
- z->img_comp[i].tq = get8(s); if (z->img_comp[i].tq > 3) return e("bad TQ","Corrupt JPEG");
- }
-
- if (scan != SCAN_load) return 1;
-
- if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e("too large", "Image too large to decode");
-
- for (i=0; i < s->img_n; ++i) {
- if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h;
- if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v;
- }
-
- // compute interleaved mcu info
- z->img_h_max = h_max;
- z->img_v_max = v_max;
- z->img_mcu_w = h_max * 8;
- z->img_mcu_h = v_max * 8;
- z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w;
- z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h;
-
- for (i=0; i < s->img_n; ++i) {
- // number of effective pixels (e.g. for non-interleaved MCU)
- z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max;
- z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max;
- // to simplify generation, we'll allocate enough memory to decode
- // the bogus oversized data from using interleaved MCUs and their
- // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't
- // discard the extra data until colorspace conversion
- z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8;
- z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8;
- z->img_comp[i].raw_data = stb_malloc(z->img_comp[i].w2 * z->img_comp[i].h2+15);
- if (z->img_comp[i].raw_data == NULL) {
- for(--i; i >= 0; --i) {
- stb_free(z->img_comp[i].raw_data);
- z->img_comp[i].data = NULL;
- }
- return e("outofmem", "Out of memory");
- }
- // align blocks for installable-idct using mmx/sse
- z->img_comp[i].data = (uint8*) (((size_t) z->img_comp[i].raw_data + 15) & ~15);
- z->img_comp[i].linebuf = NULL;
- }
-
- return 1;
-}
-
-// use comparisons since in some cases we handle more than one case (e.g. SOF)
-#define DNL(x) ((x) == 0xdc)
-#define SOI(x) ((x) == 0xd8)
-#define EOI(x) ((x) == 0xd9)
-#define SOF(x) ((x) == 0xc0 || (x) == 0xc1)
-#define SOS(x) ((x) == 0xda)
-
-static int decode_jpeg_header(jpeg *z, int scan)
-{
- int m;
- z->marker = MARKER_none; // initialize cached marker to empty
- m = get_marker(z);
- if (!SOI(m)) return e("no SOI","Corrupt JPEG");
- if (scan == SCAN_type) return 1;
- m = get_marker(z);
- while (!SOF(m)) {
- if (!process_marker(z,m)) return 0;
- m = get_marker(z);
- while (m == MARKER_none) {
- // some files have extra padding after their blocks, so ok, we'll scan
- if (at_eof(&z->s)) return e("no SOF", "Corrupt JPEG");
- m = get_marker(z);
- }
- }
- if (!process_frame_header(z, scan)) return 0;
- return 1;
-}
-
-static int decode_jpeg_image(jpeg *j)
-{
- int m;
- j->restart_interval = 0;
- if (!decode_jpeg_header(j, SCAN_load)) return 0;
- m = get_marker(j);
- while (!EOI(m)) {
- if (SOS(m)) {
- if (!process_scan_header(j)) return 0;
- if (!parse_entropy_coded_data(j)) return 0;
- } else {
- if (!process_marker(j, m)) return 0;
- }
- m = get_marker(j);
- }
- return 1;
-}
-
-// static jfif-centered resampling (across block boundaries)
-
-typedef uint8 *(*resample_row_func)(uint8 *out, uint8 *in0, uint8 *in1,
- int w, int hs);
-
-#define div4(x) ((uint8) ((x) >> 2))
-
-static uint8 *resample_row_1(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- out, in_far, w, hs;
- return in_near;
-}
-
-static uint8* resample_row_v_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- hs;
- // need to generate two samples vertically for every one in input
- int i;
- for (i=0; i < w; ++i)
- out[i] = div4(3*in_near[i] + in_far[i] + 2);
- return out;
-}
-
-static uint8* resample_row_h_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- hs, in_far;
- // need to generate two samples horizontally for every one in input
- int i;
- uint8 *input = in_near;
- if (w == 1) {
- // if only one sample, can't do any interpolation
- out[0] = out[1] = input[0];
- return out;
- }
-
- out[0] = input[0];
- out[1] = div4(input[0]*3 + input[1] + 2);
- for (i=1; i < w-1; ++i) {
- int n = 3*input[i]+2;
- out[i*2+0] = div4(n+input[i-1]);
- out[i*2+1] = div4(n+input[i+1]);
- }
- out[i*2+0] = div4(input[w-2]*3 + input[w-1] + 2);
- out[i*2+1] = input[w-1];
- return out;
-}
-
-#define div16(x) ((uint8) ((x) >> 4))
-
-static uint8 *resample_row_hv_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- hs;
- // need to generate 2x2 samples for every one in input
- int i,t0,t1;
- if (w == 1) {
- out[0] = out[1] = div4(3*in_near[0] + in_far[0] + 2);
- return out;
- }
-
- t1 = 3*in_near[0] + in_far[0];
- out[0] = div4(t1+2);
- for (i=1; i < w; ++i) {
- t0 = t1;
- t1 = 3*in_near[i]+in_far[i];
- out[i*2-1] = div16(3*t0 + t1 + 8);
- out[i*2 ] = div16(3*t1 + t0 + 8);
- }
- out[w*2-1] = div4(t1+2);
- return out;
-}
-
-static uint8 *resample_row_generic(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- in_far;
- // resample with nearest-neighbor
- int i,j;
- for (i=0; i < w; ++i)
- for (j=0; j < hs; ++j)
- out[i*hs+j] = in_near[i];
- return out;
-}
-
-#define float2fixed(x) ((int) ((x) * 65536 + 0.5))
-
-// 0.38 seconds on 3*anemones.jpg (0.25 with processor = Pro)
-// VC6 without processor=Pro is generating multiple LEAs per multiply!
-static void YCbCr_to_RGB_row(uint8 *out, const uint8 *y, const uint8 *pcb, const uint8 *pcr, int count, int step)
-{
- int i;
- for (i=0; i < count; ++i) {
- int y_fixed = (y[i] << 16) + 32768; // rounding
- int r,g,b;
- int cr = pcr[i] - 128;
- int cb = pcb[i] - 128;
- r = y_fixed + cr*float2fixed(1.40200f);
- g = y_fixed - cr*float2fixed(0.71414f) - cb*float2fixed(0.34414f);
- b = y_fixed + cb*float2fixed(1.77200f);
- r >>= 16;
- g >>= 16;
- b >>= 16;
- if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; }
- if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; }
- if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; }
- out[0] = (uint8)r;
- out[1] = (uint8)g;
- out[2] = (uint8)b;
- out[3] = 255;
- out += step;
- }
-}
-
-#if STBI_SIMD
-static stbi_YCbCr_to_RGB_run stbi_YCbCr_installed = YCbCr_to_RGB_row;
-
-void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func)
-{
- stbi_YCbCr_installed = func;
-}
-#endif
-
-
-// clean up the temporary component buffers
-static void cleanup_jpeg(jpeg *j)
-{
- int i;
- for (i=0; i < j->s.img_n; ++i) {
- if (j->img_comp[i].data) {
- stb_free(j->img_comp[i].raw_data);
- j->img_comp[i].data = NULL;
- }
- if (j->img_comp[i].linebuf) {
- stb_free(j->img_comp[i].linebuf);
- j->img_comp[i].linebuf = NULL;
- }
- }
-}
-
-typedef struct
-{
- resample_row_func resample;
- uint8 *line0,*line1;
- int hs,vs; // expansion factor in each axis
- int w_lores; // horizontal pixels pre-expansion
- int ystep; // how far through vertical expansion we are
- int ypos; // which pre-expansion row we're on
-} stbi_resample;
-
-static uint8 *load_jpeg_image(jpeg *z, int *out_x, int *out_y, int *comp, int req_comp)
-{
- int n, decode_n;
- // validate req_comp
- if (req_comp < 0 || req_comp > 4) return epuc("bad req_comp", "Internal error");
- z->s.img_n = 0;
-
- // load a jpeg image from whichever source
- if (!decode_jpeg_image(z)) { cleanup_jpeg(z); return NULL; }
-
- // determine actual number of components to generate
- n = req_comp ? req_comp : z->s.img_n;
-
- if (z->s.img_n == 3 && n < 3)
- decode_n = 1;
- else
- decode_n = z->s.img_n;
-
- // resample and color-convert
- {
- int k;
- uint i,j;
- uint8 *output;
- uint8 *coutput[4];
-
- stbi_resample res_comp[4];
-
- for (k=0; k < decode_n; ++k) {
- stbi_resample *r = &res_comp[k];
-
- // allocate line buffer big enough for upsampling off the edges
- // with upsample factor of 4
- z->img_comp[k].linebuf = (uint8 *) stb_malloc(z->s.img_x + 3);
- if (!z->img_comp[k].linebuf) { cleanup_jpeg(z); return epuc("outofmem", "Out of memory"); }
-
- r->hs = z->img_h_max / z->img_comp[k].h;
- r->vs = z->img_v_max / z->img_comp[k].v;
- r->ystep = r->vs >> 1;
- r->w_lores = (z->s.img_x + r->hs-1) / r->hs;
- r->ypos = 0;
- r->line0 = r->line1 = z->img_comp[k].data;
-
- if (r->hs == 1 && r->vs == 1) r->resample = resample_row_1;
- else if (r->hs == 1 && r->vs == 2) r->resample = resample_row_v_2;
- else if (r->hs == 2 && r->vs == 1) r->resample = resample_row_h_2;
- else if (r->hs == 2 && r->vs == 2) r->resample = resample_row_hv_2;
- else r->resample = resample_row_generic;
- }
-
- // can't error after this so, this is safe
- output = (uint8 *) stb_malloc(n * z->s.img_x * z->s.img_y + 1);
- if (!output) { cleanup_jpeg(z); return epuc("outofmem", "Out of memory"); }
-
- // now go ahead and resample
- for (j=0; j < z->s.img_y; ++j) {
- uint8 *out = output + n * z->s.img_x * j;
- for (k=0; k < decode_n; ++k) {
- stbi_resample *r = &res_comp[k];
- int y_bot = r->ystep >= (r->vs >> 1);
- coutput[k] = r->resample(z->img_comp[k].linebuf,
- y_bot ? r->line1 : r->line0,
- y_bot ? r->line0 : r->line1,
- r->w_lores, r->hs);
- if (++r->ystep >= r->vs) {
- r->ystep = 0;
- r->line0 = r->line1;
- if (++r->ypos < z->img_comp[k].y)
- r->line1 += z->img_comp[k].w2;
- }
- }
- if (n >= 3) {
- uint8 *y = coutput[0];
- if (z->s.img_n == 3) {
- #if STBI_SIMD
- stbi_YCbCr_installed(out, y, coutput[1], coutput[2], z->s.img_x, n);
- #else
- YCbCr_to_RGB_row(out, y, coutput[1], coutput[2], z->s.img_x, n);
- #endif
- } else
- for (i=0; i < z->s.img_x; ++i) {
- out[0] = out[1] = out[2] = y[i];
- out[3] = 255; // not used if n==3
- out += n;
- }
- } else {
- uint8 *y = coutput[0];
- if (n == 1)
- for (i=0; i < z->s.img_x; ++i) out[i] = y[i];
- else
- for (i=0; i < z->s.img_x; ++i) *out++ = y[i], *out++ = 255;
- }
- }
- cleanup_jpeg(z);
- *out_x = z->s.img_x;
- *out_y = z->s.img_y;
- if (comp) *comp = z->s.img_n; // report original components, not output
- return output;
- }
-}
-
-#ifndef STBI_NO_STDIO
-unsigned char *stbi_jpeg_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- jpeg j;
- start_file(&j.s, f);
- return load_jpeg_image(&j, x,y,comp,req_comp);
-}
-
-unsigned char *stbi_jpeg_load(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- unsigned char *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_jpeg_load_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-#endif
-
-unsigned char *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- jpeg j;
- start_mem(&j.s, buffer,len);
- return load_jpeg_image(&j, x,y,comp,req_comp);
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_jpeg_test_file(FILE *f)
-{
- int n,r;
- jpeg j;
- n = ftell(f);
- start_file(&j.s, f);
- r = decode_jpeg_header(&j, SCAN_type);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_jpeg_test_memory(stbi_uc const *buffer, int len)
-{
- jpeg j;
- start_mem(&j.s, buffer,len);
- return decode_jpeg_header(&j, SCAN_type);
-}
-
-// @TODO:
-#ifndef STBI_NO_STDIO
-extern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-extern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-// public domain zlib decode v0.2 Sean Barrett 2006-11-18
-// simple implementation
-// - all input must be provided in an upfront buffer
-// - all output is written to a single output buffer (can stb_malloc/stb_realloc)
-// performance
-// - fast huffman
-
-// fast-way is faster to check than jpeg huffman, but slow way is slower
-#define ZFAST_BITS 9 // accelerate all cases in default tables
-#define ZFAST_MASK ((1 << ZFAST_BITS) - 1)
-
-// zlib-style huffman encoding
-// (jpegs packs from left, zlib from right, so can't share code)
-typedef struct
-{
- uint16 fast[1 << ZFAST_BITS];
- uint16 firstcode[16];
- int maxcode[17];
- uint16 firstsymbol[16];
- uint8 size[288];
- uint16 value[288];
-} zhuffman;
-
-__forceinline static int bitreverse16(int n)
-{
- n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1);
- n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2);
- n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4);
- n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8);
- return n;
-}
-
-__forceinline static int bit_reverse(int v, int bits)
-{
- assert(bits <= 16);
- // to bit reverse n bits, reverse 16 and shift
- // e.g. 11 bits, bit reverse and shift away 5
- return bitreverse16(v) >> (16-bits);
-}
-
-static int zbuild_huffman(zhuffman *z, uint8 *sizelist, int num)
-{
- int i,k=0;
- int code, next_code[16], sizes[17];
-
- // DEFLATE spec for generating codes
- memset(sizes, 0, sizeof(sizes));
- memset(z->fast, 255, sizeof(z->fast));
- for (i=0; i < num; ++i)
- ++sizes[sizelist[i]];
- sizes[0] = 0;
- for (i=1; i < 16; ++i)
- assert(sizes[i] <= (1 << i));
- code = 0;
- for (i=1; i < 16; ++i) {
- next_code[i] = code;
- z->firstcode[i] = (uint16) code;
- z->firstsymbol[i] = (uint16) k;
- code = (code + sizes[i]);
- if (sizes[i])
- if (code-1 >= (1 << i)) return e("bad codelengths","Corrupt JPEG");
- z->maxcode[i] = code << (16-i); // preshift for inner loop
- code <<= 1;
- k += sizes[i];
- }
- z->maxcode[16] = 0x10000; // sentinel
- for (i=0; i < num; ++i) {
- int s = sizelist[i];
- if (s) {
- int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s];
- z->size[c] = (uint8)s;
- z->value[c] = (uint16)i;
- if (s <= ZFAST_BITS) {
- int k = bit_reverse(next_code[s],s);
- while (k < (1 << ZFAST_BITS)) {
- z->fast[k] = (uint16) c;
- k += (1 << s);
- }
- }
- ++next_code[s];
- }
- }
- return 1;
-}
-
-// zlib-from-memory implementation for PNG reading
-// because PNG allows splitting the zlib stream arbitrarily,
-// and it's annoying structurally to have PNG call ZLIB call PNG,
-// we require PNG read all the IDATs and combine them into a single
-// memory buffer
-
-typedef struct
-{
- uint8 *zbuffer, *zbuffer_end;
- int num_bits;
- uint32 code_buffer;
-
- char *zout;
- char *zout_start;
- char *zout_end;
- int z_expandable;
-
- zhuffman z_length, z_distance;
-} zbuf;
-
-__forceinline static int zget8(zbuf *z)
-{
- if (z->zbuffer >= z->zbuffer_end) return 0;
- return *z->zbuffer++;
-}
-
-static void fill_bits(zbuf *z)
-{
- do {
- assert(z->code_buffer < (1U << z->num_bits));
- z->code_buffer |= zget8(z) << z->num_bits;
- z->num_bits += 8;
- } while (z->num_bits <= 24);
-}
-
-__forceinline static unsigned int zreceive(zbuf *z, int n)
-{
- unsigned int k;
- if (z->num_bits < n) fill_bits(z);
- k = z->code_buffer & ((1 << n) - 1);
- z->code_buffer >>= n;
- z->num_bits -= n;
- return k;
-}
-
-__forceinline static int zhuffman_decode(zbuf *a, zhuffman *z)
-{
- int b,s,k;
- if (a->num_bits < 16) fill_bits(a);
- b = z->fast[a->code_buffer & ZFAST_MASK];
- if (b < 0xffff) {
- s = z->size[b];
- a->code_buffer >>= s;
- a->num_bits -= s;
- return z->value[b];
- }
-
- // not resolved by fast table, so compute it the slow way
- // use jpeg approach, which requires MSbits at top
- k = bit_reverse(a->code_buffer, 16);
- for (s=ZFAST_BITS+1; ; ++s)
- if (k < z->maxcode[s])
- break;
- if (s == 16) return -1; // invalid code!
- // code size is s, so:
- b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s];
- assert(z->size[b] == s);
- a->code_buffer >>= s;
- a->num_bits -= s;
- return z->value[b];
-}
-
-static int expand(zbuf *z, int n) // need to make room for n bytes
-{
- char *q;
- int cur, limit;
- if (!z->z_expandable) return e("output buffer limit","Corrupt PNG");
- cur = (int) (z->zout - z->zout_start);
- limit = (int) (z->zout_end - z->zout_start);
- while (cur + n > limit)
- limit *= 2;
- q = (char *) stb_realloc(z->zout_start, limit);
- if (q == NULL) return e("outofmem", "Out of memory");
- z->zout_start = q;
- z->zout = q + cur;
- z->zout_end = q + limit;
- return 1;
-}
-
-static int length_base[31] = {
- 3,4,5,6,7,8,9,10,11,13,
- 15,17,19,23,27,31,35,43,51,59,
- 67,83,99,115,131,163,195,227,258,0,0 };
-
-static int length_extra[31]=
-{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 };
-
-static int dist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,
-257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0};
-
-static int dist_extra[32] =
-{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
-
-static int parse_huffman_block(zbuf *a)
-{
- for(;;) {
- int z = zhuffman_decode(a, &a->z_length);
- if (z < 256) {
- if (z < 0) return e("bad huffman code","Corrupt PNG"); // error in huffman codes
- if (a->zout >= a->zout_end) if (!expand(a, 1)) return 0;
- *a->zout++ = (char) z;
- } else {
- uint8 *p;
- int len,dist;
- if (z == 256) return 1;
- z -= 257;
- len = length_base[z];
- if (length_extra[z]) len += zreceive(a, length_extra[z]);
- z = zhuffman_decode(a, &a->z_distance);
- if (z < 0) return e("bad huffman code","Corrupt PNG");
- dist = dist_base[z];
- if (dist_extra[z]) dist += zreceive(a, dist_extra[z]);
- if (a->zout - a->zout_start < dist) return e("bad dist","Corrupt PNG");
- if (a->zout + len > a->zout_end) if (!expand(a, len)) return 0;
- p = (uint8 *) (a->zout - dist);
- while (len--)
- *a->zout++ = *p++;
- }
- }
-}
-
-static int compute_huffman_codes(zbuf *a)
-{
- static uint8 length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 };
- zhuffman z_codelength;
- uint8 lencodes[286+32+137];//padding for maximum single op
- uint8 codelength_sizes[19];
- int i,n;
-
- int hlit = zreceive(a,5) + 257;
- int hdist = zreceive(a,5) + 1;
- int hclen = zreceive(a,4) + 4;
-
- memset(codelength_sizes, 0, sizeof(codelength_sizes));
- for (i=0; i < hclen; ++i) {
- int s = zreceive(a,3);
- codelength_sizes[length_dezigzag[i]] = (uint8) s;
- }
- if (!zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0;
-
- n = 0;
- while (n < hlit + hdist) {
- int c = zhuffman_decode(a, &z_codelength);
- assert(c >= 0 && c < 19);
- if (c < 16)
- lencodes[n++] = (uint8) c;
- else if (c == 16) {
- c = zreceive(a,2)+3;
- memset(lencodes+n, lencodes[n-1], c);
- n += c;
- } else if (c == 17) {
- c = zreceive(a,3)+3;
- memset(lencodes+n, 0, c);
- n += c;
- } else {
- assert(c == 18);
- c = zreceive(a,7)+11;
- memset(lencodes+n, 0, c);
- n += c;
- }
- }
- if (n != hlit+hdist) return e("bad codelengths","Corrupt PNG");
- if (!zbuild_huffman(&a->z_length, lencodes, hlit)) return 0;
- if (!zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0;
- return 1;
-}
-
-static int parse_uncompressed_block(zbuf *a)
-{
- uint8 header[4];
- int len,nlen,k;
- if (a->num_bits & 7)
- zreceive(a, a->num_bits & 7); // discard
- // drain the bit-packed data into header
- k = 0;
- while (a->num_bits > 0) {
- header[k++] = (uint8) (a->code_buffer & 255); // wtf this warns?
- a->code_buffer >>= 8;
- a->num_bits -= 8;
- }
- assert(a->num_bits == 0);
- // now fill header the normal way
- while (k < 4)
- header[k++] = (uint8) zget8(a);
- len = header[1] * 256 + header[0];
- nlen = header[3] * 256 + header[2];
- if (nlen != (len ^ 0xffff)) return e("zlib corrupt","Corrupt PNG");
- if (a->zbuffer + len > a->zbuffer_end) return e("read past buffer","Corrupt PNG");
- if (a->zout + len > a->zout_end)
- if (!expand(a, len)) return 0;
- memcpy(a->zout, a->zbuffer, len);
- a->zbuffer += len;
- a->zout += len;
- return 1;
-}
-
-static int parse_zlib_header(zbuf *a)
-{
- int cmf = zget8(a);
- int cm = cmf & 15;
- /* int cinfo = cmf >> 4; */
- int flg = zget8(a);
- if ((cmf*256+flg) % 31 != 0) return e("bad zlib header","Corrupt PNG"); // zlib spec
- if (flg & 32) return e("no preset dict","Corrupt PNG"); // preset dictionary not allowed in png
- if (cm != 8) return e("bad compression","Corrupt PNG"); // DEFLATE required for png
- // window = 1 << (8 + cinfo)... but who cares, we fully buffer output
- return 1;
-}
-
-// @TODO: should statically initialize these for optimal thread safety
-static uint8 default_length[288], default_distance[32];
-static void init_defaults(void)
-{
- int i; // use <= to match clearly with spec
- for (i=0; i <= 143; ++i) default_length[i] = 8;
- for ( ; i <= 255; ++i) default_length[i] = 9;
- for ( ; i <= 279; ++i) default_length[i] = 7;
- for ( ; i <= 287; ++i) default_length[i] = 8;
-
- for (i=0; i <= 31; ++i) default_distance[i] = 5;
-}
-
-int stbi_png_partial; // a quick hack to only allow decoding some of a PNG... I should implement real streaming support instead
-static int parse_zlib(zbuf *a, int parse_header)
-{
- int final, type;
- if (parse_header)
- if (!parse_zlib_header(a)) return 0;
- a->num_bits = 0;
- a->code_buffer = 0;
- do {
- final = zreceive(a,1);
- type = zreceive(a,2);
- if (type == 0) {
- if (!parse_uncompressed_block(a)) return 0;
- } else if (type == 3) {
- return 0;
- } else {
- if (type == 1) {
- // use fixed code lengths
- if (!default_distance[31]) init_defaults();
- if (!zbuild_huffman(&a->z_length , default_length , 288)) return 0;
- if (!zbuild_huffman(&a->z_distance, default_distance, 32)) return 0;
- } else {
- if (!compute_huffman_codes(a)) return 0;
- }
- if (!parse_huffman_block(a)) return 0;
- }
- if (stbi_png_partial && a->zout - a->zout_start > 65536)
- break;
- } while (!final);
- return 1;
-}
-
-static int do_zlib(zbuf *a, char *obuf, int olen, int exp, int parse_header)
-{
- a->zout_start = obuf;
- a->zout = obuf;
- a->zout_end = obuf + olen;
- a->z_expandable = exp;
-
- return parse_zlib(a, parse_header);
-}
-
-char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen)
-{
- zbuf a;
- char *p = (char *) stb_malloc(initial_size);
- if (p == NULL) return NULL;
- a.zbuffer = (uint8 *) buffer;
- a.zbuffer_end = (uint8 *) buffer + len;
- if (do_zlib(&a, p, initial_size, 1, 1)) {
- if (outlen) *outlen = (int) (a.zout - a.zout_start);
- return a.zout_start;
- } else {
- stb_free(a.zout_start);
- return NULL;
- }
-}
-
-char *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen)
-{
- return stbi_zlib_decode_malloc_guesssize(buffer, len, 16384, outlen);
-}
-
-int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen)
-{
- zbuf a;
- a.zbuffer = (uint8 *) ibuffer;
- a.zbuffer_end = (uint8 *) ibuffer + ilen;
- if (do_zlib(&a, obuffer, olen, 0, 1))
- return (int) (a.zout - a.zout_start);
- else
- return -1;
-}
-
-char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen)
-{
- zbuf a;
- char *p = (char *) stb_malloc(16384);
- if (p == NULL) return NULL;
- a.zbuffer = (uint8 *) buffer;
- a.zbuffer_end = (uint8 *) buffer+len;
- if (do_zlib(&a, p, 16384, 1, 0)) {
- if (outlen) *outlen = (int) (a.zout - a.zout_start);
- return a.zout_start;
- } else {
- stb_free(a.zout_start);
- return NULL;
- }
-}
-
-int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen)
-{
- zbuf a;
- a.zbuffer = (uint8 *) ibuffer;
- a.zbuffer_end = (uint8 *) ibuffer + ilen;
- if (do_zlib(&a, obuffer, olen, 0, 0))
- return (int) (a.zout - a.zout_start);
- else
- return -1;
-}
-
-// public domain "baseline" PNG decoder v0.10 Sean Barrett 2006-11-18
-// simple implementation
-// - only 8-bit samples
-// - no CRC checking
-// - allocates lots of intermediate memory
-// - avoids problem of streaming data between subsystems
-// - avoids explicit window management
-// performance
-// - uses stb_zlib, a PD zlib implementation with fast huffman decoding
-
-
-typedef struct
-{
- uint32 length;
- uint32 type;
-} chunk;
-
-#define PNG_TYPE(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
-
-static chunk get_chunk_header(stbi *s)
-{
- chunk c;
- c.length = get32(s);
- c.type = get32(s);
- return c;
-}
-
-static int check_png_header(stbi *s)
-{
- static uint8 png_sig[8] = { 137,80,78,71,13,10,26,10 };
- int i;
- for (i=0; i < 8; ++i)
- if (get8(s) != png_sig[i]) return e("bad png sig","Not a PNG");
- return 1;
-}
-
-typedef struct
-{
- stbi s;
- uint8 *idata, *expanded, *out;
-} png;
-
-
-enum {
- F_none=0, F_sub=1, F_up=2, F_avg=3, F_paeth=4,
- F_avg_first, F_paeth_first,
-};
-
-static uint8 first_row_filter[5] =
-{
- F_none, F_sub, F_none, F_avg_first, F_paeth_first
-};
-
-static int paeth(int a, int b, int c)
-{
- int p = a + b - c;
- int pa = abs(p-a);
- int pb = abs(p-b);
- int pc = abs(p-c);
- if (pa <= pb && pa <= pc) return a;
- if (pb <= pc) return b;
- return c;
-}
-
-// create the png data from post-deflated data
-static int create_png_image_raw(png *a, uint8 *raw, uint32 raw_len, int out_n, uint32 x, uint32 y)
-{
- stbi *s = &a->s;
- uint32 i,j,stride = x*out_n;
- int k;
- int img_n = s->img_n; // copy it into a local for later
- assert(out_n == s->img_n || out_n == s->img_n+1);
- if (stbi_png_partial) y = 1;
- a->out = (uint8 *) stb_malloc(x * y * out_n);
- if (!a->out) return e("outofmem", "Out of memory");
- if (!stbi_png_partial) {
- if ((s->img_x == x) && (s->img_y == y))
- {
- if (raw_len != (img_n * x + 1) * y) return e("not enough pixels","Corrupt PNG");
- }
- else // interlaced:
- {
- if (raw_len < (img_n * x + 1) * y) return e("not enough pixels","Corrupt PNG");
- }
- }
- for (j=0; j < y; ++j) {
- uint8 *cur = a->out + stride*j;
- uint8 *prior = cur - stride;
- int filter = *raw++;
- if (filter > 4) return e("invalid filter","Corrupt PNG");
- // if first row, use special filter that doesn't sample previous row
- if (j == 0) filter = first_row_filter[filter];
- // handle first pixel explicitly
- for (k=0; k < img_n; ++k) {
- switch(filter) {
- case F_none : cur[k] = raw[k]; break;
- case F_sub : cur[k] = raw[k]; break;
- case F_up : cur[k] = raw[k] + prior[k]; break;
- case F_avg : cur[k] = raw[k] + (prior[k]>>1); break;
- case F_paeth : cur[k] = (uint8) (raw[k] + paeth(0,prior[k],0)); break;
- case F_avg_first : cur[k] = raw[k]; break;
- case F_paeth_first: cur[k] = raw[k]; break;
- }
- }
- if (img_n != out_n) cur[img_n] = 255;
- raw += img_n;
- cur += out_n;
- prior += out_n;
- // this is a little gross, so that we don't switch per-pixel or per-component
- if (img_n == out_n) {
- #define CASE(f) \
- case f: \
- for (i=x-1; i >= 1; --i, raw+=img_n,cur+=img_n,prior+=img_n) \
- for (k=0; k < img_n; ++k)
- switch(filter) {
- CASE(F_none) cur[k] = raw[k]; break;
- CASE(F_sub) cur[k] = raw[k] + cur[k-img_n]; break;
- CASE(F_up) cur[k] = raw[k] + prior[k]; break;
- CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-img_n])>>1); break;
- CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],prior[k],prior[k-img_n])); break;
- CASE(F_avg_first) cur[k] = raw[k] + (cur[k-img_n] >> 1); break;
- CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],0,0)); break;
- }
- #undef CASE
- } else {
- assert(img_n+1 == out_n);
- #define CASE(f) \
- case f: \
- for (i=x-1; i >= 1; --i, cur[img_n]=255,raw+=img_n,cur+=out_n,prior+=out_n) \
- for (k=0; k < img_n; ++k)
- switch(filter) {
- CASE(F_none) cur[k] = raw[k]; break;
- CASE(F_sub) cur[k] = raw[k] + cur[k-out_n]; break;
- CASE(F_up) cur[k] = raw[k] + prior[k]; break;
- CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-out_n])>>1); break;
- CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],prior[k],prior[k-out_n])); break;
- CASE(F_avg_first) cur[k] = raw[k] + (cur[k-out_n] >> 1); break;
- CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],0,0)); break;
- }
- #undef CASE
- }
- }
- return 1;
-}
-
-static int create_png_image(png *a, uint8 *raw, uint32 raw_len, int out_n, int interlaced)
-{
- uint8 *final;
- int p;
- int save;
- if (!interlaced)
- return create_png_image_raw(a, raw, raw_len, out_n, a->s.img_x, a->s.img_y);
- save = stbi_png_partial;
- stbi_png_partial = 0;
-
- // de-interlacing
- final = (uint8 *) stb_malloc(a->s.img_x * a->s.img_y * out_n);
- for (p=0; p < 7; ++p) {
- int xorig[] = { 0,4,0,2,0,1,0 };
- int yorig[] = { 0,0,4,0,2,0,1 };
- int xspc[] = { 8,8,4,4,2,2,1 };
- int yspc[] = { 8,8,8,4,4,2,2 };
- int i,j,x,y;
- // pass1_x[4] = 0, pass1_x[5] = 1, pass1_x[12] = 1
- x = (a->s.img_x - xorig[p] + xspc[p]-1) / xspc[p];
- y = (a->s.img_y - yorig[p] + yspc[p]-1) / yspc[p];
- if (x && y) {
- if (!create_png_image_raw(a, raw, raw_len, out_n, x, y)) {
- stb_free(final);
- return 0;
- }
- for (j=0; j < y; ++j)
- for (i=0; i < x; ++i)
- memcpy(final + (j*yspc[p]+yorig[p])*a->s.img_x*out_n + (i*xspc[p]+xorig[p])*out_n,
- a->out + (j*x+i)*out_n, out_n);
- stb_free(a->out);
- raw += (x*out_n+1)*y;
- raw_len -= (x*out_n+1)*y;
- }
- }
- a->out = final;
-
- stbi_png_partial = save;
- return 1;
-}
-
-static int compute_transparency(png *z, uint8 tc[3], int out_n)
-{
- stbi *s = &z->s;
- uint32 i, pixel_count = s->img_x * s->img_y;
- uint8 *p = z->out;
-
- // compute color-based transparency, assuming we've
- // already got 255 as the alpha value in the output
- assert(out_n == 2 || out_n == 4);
-
- if (out_n == 2) {
- for (i=0; i < pixel_count; ++i) {
- p[1] = (p[0] == tc[0] ? 0 : 255);
- p += 2;
- }
- } else {
- for (i=0; i < pixel_count; ++i) {
- if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2])
- p[3] = 0;
- p += 4;
- }
- }
- return 1;
-}
-
-static int expand_palette(png *a, uint8 *palette, int len, int pal_img_n)
-{
- len;
- uint32 i, pixel_count = a->s.img_x * a->s.img_y;
- uint8 *p, *temp_out, *orig = a->out;
-
- p = (uint8 *) stb_malloc(pixel_count * pal_img_n);
- if (p == NULL) return e("outofmem", "Out of memory");
-
- // between here and stb_free(out) below, exitting would leak
- temp_out = p;
-
- if (pal_img_n == 3) {
- for (i=0; i < pixel_count; ++i) {
- int n = orig[i]*4;
- p[0] = palette[n ];
- p[1] = palette[n+1];
- p[2] = palette[n+2];
- p += 3;
- }
- } else {
- for (i=0; i < pixel_count; ++i) {
- int n = orig[i]*4;
- p[0] = palette[n ];
- p[1] = palette[n+1];
- p[2] = palette[n+2];
- p[3] = palette[n+3];
- p += 4;
- }
- }
- stb_free(a->out);
- a->out = temp_out;
- return 1;
-}
-
-static int parse_png_file(png *z, int scan, int req_comp)
-{
- uint8 palette[1024], pal_img_n=0;
- uint8 has_trans=0, tc[3];
- uint32 ioff=0, idata_limit=0, i, pal_len=0;
- int first=1,k,interlace=0;
- stbi *s = &z->s;
-
- if (!check_png_header(s)) return 0;
-
- if (scan == SCAN_type) return 1;
-
- for(;;first=0) {
- chunk c = get_chunk_header(s);
- if (first && c.type != PNG_TYPE('I','H','D','R'))
- return e("first not IHDR","Corrupt PNG");
- switch (c.type) {
- case PNG_TYPE('I','H','D','R'): {
- int depth,color,comp,filter;
- if (!first) return e("multiple IHDR","Corrupt PNG");
- if (c.length != 13) return e("bad IHDR len","Corrupt PNG");
- s->img_x = get32(s); if (s->img_x > (1 << 24)) return e("too large","Very large image (corrupt?)");
- s->img_y = get32(s); if (s->img_y > (1 << 24)) return e("too large","Very large image (corrupt?)");
- depth = get8(s); if (depth != 8) return e("8bit only","PNG not supported: 8-bit only");
- color = get8(s); if (color > 6) return e("bad ctype","Corrupt PNG");
- if (color == 3) pal_img_n = 3; else if (color & 1) return e("bad ctype","Corrupt PNG");
- comp = get8(s); if (comp) return e("bad comp method","Corrupt PNG");
- filter= get8(s); if (filter) return e("bad filter method","Corrupt PNG");
- interlace = get8(s); if (interlace>1) return e("bad interlace method","Corrupt PNG");
- if (!s->img_x || !s->img_y) return e("0-pixel image","Corrupt PNG");
- if (!pal_img_n) {
- s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0);
- if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e("too large", "Image too large to decode");
- if (scan == SCAN_header) return 1;
- } else {
- // if paletted, then pal_n is our final components, and
- // img_n is # components to decompress/filter.
- s->img_n = 1;
- if ((1 << 30) / s->img_x / 4 < s->img_y) return e("too large","Corrupt PNG");
- // if SCAN_header, have to scan to see if we have a tRNS
- }
- break;
- }
-
- case PNG_TYPE('P','L','T','E'): {
- if (c.length > 256*3) return e("invalid PLTE","Corrupt PNG");
- pal_len = c.length / 3;
- if (pal_len * 3 != c.length) return e("invalid PLTE","Corrupt PNG");
- for (i=0; i < pal_len; ++i) {
- palette[i*4+0] = get8u(s);
- palette[i*4+1] = get8u(s);
- palette[i*4+2] = get8u(s);
- palette[i*4+3] = 255;
- }
- break;
- }
-
- case PNG_TYPE('t','R','N','S'): {
- if (z->idata) return e("tRNS after IDAT","Corrupt PNG");
- if (pal_img_n) {
- if (scan == SCAN_header) { s->img_n = 4; return 1; }
- if (pal_len == 0) return e("tRNS before PLTE","Corrupt PNG");
- if (c.length > pal_len) return e("bad tRNS len","Corrupt PNG");
- pal_img_n = 4;
- for (i=0; i < c.length; ++i)
- palette[i*4+3] = get8u(s);
- } else {
- if (!(s->img_n & 1)) return e("tRNS with alpha","Corrupt PNG");
- if (c.length != (uint32) s->img_n*2) return e("bad tRNS len","Corrupt PNG");
- has_trans = 1;
- for (k=0; k < s->img_n; ++k)
- tc[k] = (uint8) get16(s); // non 8-bit images will be larger
- }
- break;
- }
-
- case PNG_TYPE('I','D','A','T'): {
- if (pal_img_n && !pal_len) return e("no PLTE","Corrupt PNG");
- if (scan == SCAN_header) { s->img_n = pal_img_n; return 1; }
- if (ioff + c.length > idata_limit) {
- uint8 *p;
- if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096;
- while (ioff + c.length > idata_limit)
- idata_limit *= 2;
- p = (uint8 *) stb_realloc(z->idata, idata_limit); if (p == NULL) return e("outofmem", "Out of memory");
- z->idata = p;
- }
- #ifndef STBI_NO_STDIO
- if (s->img_file)
- {
- if (fread(z->idata+ioff,1,c.length,s->img_file) != c.length) return e("outofdata","Corrupt PNG");
- }
- else
- #endif
- {
- memcpy(z->idata+ioff, s->img_buffer, c.length);
- s->img_buffer += c.length;
- }
- ioff += c.length;
- break;
- }
-
- case PNG_TYPE('I','E','N','D'): {
- uint32 raw_len;
- if (scan != SCAN_load) return 1;
- if (z->idata == NULL) return e("no IDAT","Corrupt PNG");
- z->expanded = (uint8 *) stbi_zlib_decode_malloc((char *) z->idata, ioff, (int *) &raw_len);
- if (z->expanded == NULL) return 0; // zlib should set error
- stb_free(z->idata); z->idata = NULL;
- if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans)
- s->img_out_n = s->img_n+1;
- else
- s->img_out_n = s->img_n;
- if (!create_png_image(z, z->expanded, raw_len, s->img_out_n, interlace)) return 0;
- if (has_trans)
- if (!compute_transparency(z, tc, s->img_out_n)) return 0;
- if (pal_img_n) {
- // pal_img_n == 3 or 4
- s->img_n = pal_img_n; // record the actual colors we had
- s->img_out_n = pal_img_n;
- if (req_comp >= 3) s->img_out_n = req_comp;
- if (!expand_palette(z, palette, pal_len, s->img_out_n))
- return 0;
- }
- stb_free(z->expanded); z->expanded = NULL;
- return 1;
- }
-
- default:
- // if critical, fail
- if ((c.type & (1 << 29)) == 0) {
- #ifndef STBI_NO_FAILURE_STRINGS
- // not threadsafe
- static char invalid_chunk[] = "XXXX chunk not known";
- invalid_chunk[0] = (uint8) (c.type >> 24);
- invalid_chunk[1] = (uint8) (c.type >> 16);
- invalid_chunk[2] = (uint8) (c.type >> 8);
- invalid_chunk[3] = (uint8) (c.type >> 0);
- #endif
- return e(invalid_chunk, "PNG not supported: unknown chunk type");
- }
- skip(s, c.length);
- break;
- }
- // end of chunk, read and skip CRC
- get32(s);
- }
-}
-
-static unsigned char *do_png(png *p, int *x, int *y, int *n, int req_comp)
-{
- unsigned char *result=NULL;
- p->expanded = NULL;
- p->idata = NULL;
- p->out = NULL;
- if (req_comp < 0 || req_comp > 4) return epuc("bad req_comp", "Internal error");
- if (parse_png_file(p, SCAN_load, req_comp)) {
- result = p->out;
- p->out = NULL;
- if (req_comp && req_comp != p->s.img_out_n) {
- result = convert_format(result, p->s.img_out_n, req_comp, p->s.img_x, p->s.img_y);
- p->s.img_out_n = req_comp;
- if (result == NULL) return result;
- }
- *x = p->s.img_x;
- *y = p->s.img_y;
- if (n) *n = p->s.img_n;
- }
- stb_free(p->out); p->out = NULL;
- stb_free(p->expanded); p->expanded = NULL;
- stb_free(p->idata); p->idata = NULL;
-
- return result;
-}
-
-#ifndef STBI_NO_STDIO
-unsigned char *stbi_png_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- png p;
- start_file(&p.s, f);
- return do_png(&p, x,y,comp,req_comp);
-}
-
-unsigned char *stbi_png_load(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- unsigned char *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_png_load_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-#endif
-
-unsigned char *stbi_png_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- png p;
- start_mem(&p.s, buffer,len);
- return do_png(&p, x,y,comp,req_comp);
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_png_test_file(FILE *f)
-{
- png p;
- int n,r;
- n = ftell(f);
- start_file(&p.s, f);
- r = parse_png_file(&p, SCAN_type,STBI_default);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_png_test_memory(stbi_uc const *buffer, int len)
-{
- png p;
- start_mem(&p.s, buffer, len);
- return parse_png_file(&p, SCAN_type,STBI_default);
-}
-
-// TODO: load header from png
-#ifndef STBI_NO_STDIO
-int stbi_png_info (char const *filename, int *x, int *y, int *comp)
-{
- png p;
- FILE *f = fopen(filename, "rb");
- if (!f) return 0;
- start_file(&p.s, f);
- if (parse_png_file(&p, SCAN_header, 0)) {
- if(x) *x = p.s.img_x;
- if(y) *y = p.s.img_y;
- if (comp) *comp = p.s.img_n;
- fclose(f);
- return 1;
- }
- fclose(f);
- return 0;
-}
-
-extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-extern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-// Microsoft/Windows BMP image
-
-static int bmp_test(stbi *s)
-{
- int sz;
- if (get8(s) != 'B') return 0;
- if (get8(s) != 'M') return 0;
- get32le(s); // discard filesize
- get16le(s); // discard reserved
- get16le(s); // discard reserved
- get32le(s); // discard data offset
- sz = get32le(s);
- if (sz == 12 || sz == 40 || sz == 56 || sz == 108) return 1;
- return 0;
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_bmp_test_file (FILE *f)
-{
- stbi s;
- int r,n = ftell(f);
- start_file(&s,f);
- r = bmp_test(&s);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_bmp_test_memory (stbi_uc const *buffer, int len)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return bmp_test(&s);
-}
-
-// returns 0..31 for the highest set bit
-static int high_bit(unsigned int z)
-{
- int n=0;
- if (z == 0) return -1;
- if (z >= 0x10000) n += 16, z >>= 16;
- if (z >= 0x00100) n += 8, z >>= 8;
- if (z >= 0x00010) n += 4, z >>= 4;
- if (z >= 0x00004) n += 2, z >>= 2;
- if (z >= 0x00002) n += 1, z >>= 1;
- return n;
-}
-
-static int bitcount(unsigned int a)
-{
- a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2
- a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4
- a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits
- a = (a + (a >> 8)); // max 16 per 8 bits
- a = (a + (a >> 16)); // max 32 per 8 bits
- return a & 0xff;
-}
-
-static int shiftsigned(int v, int shift, int bits)
-{
- int result;
- int z=0;
-
- if (shift < 0) v <<= -shift;
- else v >>= shift;
- result = v;
-
- z = bits;
- while (z < 8) {
- result += v >> z;
- z += bits;
- }
- return result;
-}
-
-static stbi_uc *bmp_load(stbi *s, int *x, int *y, int *comp, int req_comp)
-{
- uint8 *out;
- unsigned int mr=0,mg=0,mb=0,ma=0, fake_a=0; (void)fake_a;
- stbi_uc pal[256][4];
- int psize=0,i,j,compress=0,width;
- int bpp, flip_vertically, pad, target, offset, hsz;
- if (get8(s) != 'B' || get8(s) != 'M') return epuc("not BMP", "Corrupt BMP");
- get32le(s); // discard filesize
- get16le(s); // discard reserved
- get16le(s); // discard reserved
- offset = get32le(s);
- hsz = get32le(s);
- if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108) return epuc("unknown BMP", "BMP type not supported: unknown");
- failure_reason = "bad BMP";
- if (hsz == 12) {
- s->img_x = get16le(s);
- s->img_y = get16le(s);
- } else {
- s->img_x = get32le(s);
- s->img_y = get32le(s);
- }
- if (get16le(s) != 1) return 0;
- bpp = get16le(s);
- if (bpp == 1) return epuc("monochrome", "BMP type not supported: 1-bit");
- flip_vertically = ((int) s->img_y) > 0;
- s->img_y = abs((int) s->img_y);
- if (hsz == 12) {
- if (bpp < 24)
- psize = (offset - 14 - 24) / 3;
- } else {
- compress = get32le(s);
- if (compress == 1 || compress == 2) return epuc("BMP RLE", "BMP type not supported: RLE");
- get32le(s); // discard sizeof
- get32le(s); // discard hres
- get32le(s); // discard vres
- get32le(s); // discard colorsused
- get32le(s); // discard max important
- if (hsz == 40 || hsz == 56) {
- if (hsz == 56) {
- get32le(s);
- get32le(s);
- get32le(s);
- get32le(s);
- }
- if (bpp == 16 || bpp == 32) {
- mr = mg = mb = 0;
- if (compress == 0) {
- if (bpp == 32) {
- mr = 0xff << 16;
- mg = 0xff << 8;
- mb = 0xff << 0;
- ma = 0xff << 24;
- fake_a = 1; // @TODO: check for cases like alpha value is all 0 and switch it to 255
- } else {
- mr = 31 << 10;
- mg = 31 << 5;
- mb = 31 << 0;
- }
- } else if (compress == 3) {
- mr = get32le(s);
- mg = get32le(s);
- mb = get32le(s);
- // not documented, but generated by photoshop and handled by mspaint
- if (mr == mg && mg == mb) {
- // ?!?!?
- return NULL;
- }
- } else
- return NULL;
- }
- } else {
- assert(hsz == 108);
- mr = get32le(s);
- mg = get32le(s);
- mb = get32le(s);
- ma = get32le(s);
- get32le(s); // discard color space
- for (i=0; i < 12; ++i)
- get32le(s); // discard color space parameters
- }
- if (bpp < 16)
- psize = (offset - 14 - hsz) >> 2;
- }
- s->img_n = ma ? 4 : 3;
- if (req_comp && req_comp >= 3) // we can directly decode 3 or 4
- target = req_comp;
- else
- target = s->img_n; // if they want monochrome, we'll post-convert
- out = (stbi_uc *) stb_malloc(target * s->img_x * s->img_y);
- if (!out) return epuc("outofmem", "Out of memory");
- if (bpp < 16) {
- int z=0;
- if (psize == 0 || psize > 256) { stb_free(out); return epuc("invalid", "Corrupt BMP"); }
- for (i=0; i < psize; ++i) {
- pal[i][2] = get8(s);
- pal[i][1] = get8(s);
- pal[i][0] = get8(s);
- if (hsz != 12) get8(s);
- pal[i][3] = 255;
- }
- skip(s, offset - 14 - hsz - psize * (hsz == 12 ? 3 : 4));
- if (bpp == 4) width = (s->img_x + 1) >> 1;
- else if (bpp == 8) width = s->img_x;
- else { stb_free(out); return epuc("bad bpp", "Corrupt BMP"); }
- pad = (-width)&3;
- for (j=0; j < (int) s->img_y; ++j) {
- for (i=0; i < (int) s->img_x; i += 2) {
- int v=get8(s),v2=0;
- if (bpp == 4) {
- v2 = v & 15;
- v >>= 4;
- }
- out[z++] = pal[v][0];
- out[z++] = pal[v][1];
- out[z++] = pal[v][2];
- if (target == 4) out[z++] = 255;
- if (i+1 == (int) s->img_x) break;
- v = (bpp == 8) ? get8(s) : v2;
- out[z++] = pal[v][0];
- out[z++] = pal[v][1];
- out[z++] = pal[v][2];
- if (target == 4) out[z++] = 255;
- }
- skip(s, pad);
- }
- } else {
- int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0;
- int z = 0;
- int easy=0;
- skip(s, offset - 14 - hsz);
- if (bpp == 24) width = 3 * s->img_x;
- else if (bpp == 16) width = 2*s->img_x;
- else /* bpp = 32 and pad = 0 */ width=0;
- pad = (-width) & 3;
- if (bpp == 24) {
- easy = 1;
- } else if (bpp == 32) {
- if (mb == 0xff && mg == 0xff00 && mr == 0xff000000 && ma == 0xff000000)
- easy = 2;
- }
- if (!easy) {
- if (!mr || !mg || !mb) return epuc("bad masks", "Corrupt BMP");
- // right shift amt to put high bit in position #7
- rshift = high_bit(mr)-7; rcount = bitcount(mr);
- gshift = high_bit(mg)-7; gcount = bitcount(mr);
- bshift = high_bit(mb)-7; bcount = bitcount(mr);
- ashift = high_bit(ma)-7; acount = bitcount(mr);
- }
- for (j=0; j < (int) s->img_y; ++j) {
- if (easy) {
- for (i=0; i < (int) s->img_x; ++i) {
- int a;
- out[z+2] = get8(s);
- out[z+1] = get8(s);
- out[z+0] = get8(s);
- z += 3;
- a = (easy == 2 ? get8(s) : 255);
- if (target == 4) out[z++] = a;
- }
- } else {
- for (i=0; i < (int) s->img_x; ++i) {
- uint32 v = (bpp == 16 ? get16le(s) : get32le(s));
- int a;
- out[z++] = shiftsigned(v & mr, rshift, rcount);
- out[z++] = shiftsigned(v & mg, gshift, gcount);
- out[z++] = shiftsigned(v & mb, bshift, bcount);
- a = (ma ? shiftsigned(v & ma, ashift, acount) : 255);
- if (target == 4) out[z++] = a;
- }
- }
- skip(s, pad);
- }
- }
- if (flip_vertically) {
- stbi_uc t;
- for (j=0; j < (int) s->img_y>>1; ++j) {
- stbi_uc *p1 = out + j *s->img_x*target;
- stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target;
- for (i=0; i < (int) s->img_x*target; ++i) {
- t = p1[i], p1[i] = p2[i], p2[i] = t;
- }
- }
- }
-
- if (req_comp && req_comp != target) {
- out = convert_format(out, target, req_comp, s->img_x, s->img_y);
- if (out == NULL) return out; // convert_format frees input on failure
- }
-
- *x = s->img_x;
- *y = s->img_y;
- if (comp) *comp = target;
- return out;
-}
-
-#ifndef STBI_NO_STDIO
-stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- stbi_uc *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_bmp_load_from_file(f, x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-
-stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_file(&s, f);
- return bmp_load(&s, x,y,comp,req_comp);
-}
-#endif
-
-stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return bmp_load(&s, x,y,comp,req_comp);
-}
-
-// Targa Truevision - TGA
-// by Jonathan Dummer
-
-static int tga_test(stbi *s)
-{
- int sz;
- get8u(s); // discard Offset
- sz = get8u(s); // color type
- if( sz > 1 ) return 0; // only RGB or indexed allowed
- sz = get8u(s); // image type
- if( (sz != 1) && (sz != 2) && (sz != 3) && (sz != 9) && (sz != 10) && (sz != 11) ) return 0; // only RGB or grey allowed, +/- RLE
- get16(s); // discard palette start
- get16(s); // discard palette length
- get8(s); // discard bits per palette color entry
- get16(s); // discard x origin
- get16(s); // discard y origin
- if( get16(s) < 1 ) return 0; // test width
- if( get16(s) < 1 ) return 0; // test height
- sz = get8(s); // bits per pixel
- if( (sz != 8) && (sz != 16) && (sz != 24) && (sz != 32) ) return 0; // only RGB or RGBA or grey allowed
- return 1; // seems to have passed everything
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_tga_test_file (FILE *f)
-{
- stbi s;
- int r,n = ftell(f);
- start_file(&s, f);
- r = tga_test(&s);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_tga_test_memory (stbi_uc const *buffer, int len)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return tga_test(&s);
-}
-
-static stbi_uc *tga_load(stbi *s, int *x, int *y, int *comp, int req_comp)
-{
- // read in the TGA header stuff
- int tga_offset = get8u(s);
- int tga_indexed = get8u(s);
- int tga_image_type = get8u(s);
- int tga_is_RLE = 0;
- int tga_palette_start = get16le(s);
- int tga_palette_len = get16le(s);
- int tga_palette_bits = get8u(s);
- int tga_x_origin = get16le(s);
- int tga_y_origin = get16le(s);
- int tga_width = get16le(s);
- int tga_height = get16le(s);
- int tga_bits_per_pixel = get8u(s);
- int tga_inverted = get8u(s);
- // image data
- unsigned char *tga_data;
- unsigned char *tga_palette = NULL;
- int i, j;
- unsigned char raw_data[4];
- unsigned char trans_data[4] = { 0, 0, 0, 0 };
- int RLE_count = 0;
- int RLE_repeating = 0;
- int read_next_pixel = 1;
- // do a tiny bit of precessing
- if( tga_image_type >= 8 )
- {
- tga_image_type -= 8;
- tga_is_RLE = 1;
- }
- /* int tga_alpha_bits = tga_inverted & 15; */
- tga_inverted = 1 - ((tga_inverted >> 5) & 1);
-
- // error check
- if( //(tga_indexed) ||
- (tga_width < 1) || (tga_height < 1) ||
- (tga_image_type < 1) || (tga_image_type > 3) ||
- ((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16) &&
- (tga_bits_per_pixel != 24) && (tga_bits_per_pixel != 32))
- )
- {
- return NULL;
- }
-
- // If I'm paletted, then I'll use the number of bits from the palette
- if( tga_indexed )
- {
- tga_bits_per_pixel = tga_palette_bits;
- }
-
- // tga info
- *x = tga_width;
- *y = tga_height;
- if( (req_comp < 1) || (req_comp > 4) )
- {
- // just use whatever the file was
- req_comp = tga_bits_per_pixel / 8;
- *comp = req_comp;
- } else
- {
- // force a new number of components
- *comp = tga_bits_per_pixel/8;
- }
- tga_data = (unsigned char*)stb_malloc( tga_width * tga_height * req_comp );
-
- // skip to the data's starting position (offset usually = 0)
- skip(s, tga_offset );
- // do I need to load a palette?
- if( tga_indexed )
- {
- // any data to skip? (offset usually = 0)
- skip(s, tga_palette_start );
- // load the palette
- tga_palette = (unsigned char*)stb_malloc( tga_palette_len * tga_palette_bits / 8 );
- getn(s, tga_palette, tga_palette_len * tga_palette_bits / 8 );
- }
- // load the data
- for( i = 0; i < tga_width * tga_height; ++i )
- {
- // if I'm in RLE mode, do I need to get a RLE chunk?
- if( tga_is_RLE )
- {
- if( RLE_count == 0 )
- {
- // yep, get the next byte as a RLE command
- int RLE_cmd = get8u(s);
- RLE_count = 1 + (RLE_cmd & 127);
- RLE_repeating = RLE_cmd >> 7;
- read_next_pixel = 1;
- } else if( !RLE_repeating )
- {
- read_next_pixel = 1;
- }
- } else
- {
- read_next_pixel = 1;
- }
- // OK, if I need to read a pixel, do it now
- if( read_next_pixel )
- {
- // load however much data we did have
- if( tga_indexed )
- {
- // read in 1 byte, then perform the lookup
- int pal_idx = get8u(s);
- if( pal_idx >= tga_palette_len )
- {
- // invalid index
- pal_idx = 0;
- }
- pal_idx *= tga_bits_per_pixel / 8;
- for( j = 0; j*8 < tga_bits_per_pixel; ++j )
- {
- raw_data[j] = tga_palette[pal_idx+j];
- }
- } else
- {
- // read in the data raw
- for( j = 0; j*8 < tga_bits_per_pixel; ++j )
- {
- raw_data[j] = get8u(s);
- }
- }
- // convert raw to the intermediate format
- switch( tga_bits_per_pixel )
- {
- case 8:
- // Luminous => RGBA
- trans_data[0] = raw_data[0];
- trans_data[1] = raw_data[0];
- trans_data[2] = raw_data[0];
- trans_data[3] = 255;
- break;
- case 16:
- // Luminous,Alpha => RGBA
- trans_data[0] = raw_data[0];
- trans_data[1] = raw_data[0];
- trans_data[2] = raw_data[0];
- trans_data[3] = raw_data[1];
- break;
- case 24:
- // BGR => RGBA
- trans_data[0] = raw_data[2];
- trans_data[1] = raw_data[1];
- trans_data[2] = raw_data[0];
- trans_data[3] = 255;
- break;
- case 32:
- // BGRA => RGBA
- trans_data[0] = raw_data[2];
- trans_data[1] = raw_data[1];
- trans_data[2] = raw_data[0];
- trans_data[3] = raw_data[3];
- break;
- }
- // clear the reading flag for the next pixel
- read_next_pixel = 0;
- } // end of reading a pixel
- // convert to final format
- switch( req_comp )
- {
- case 1:
- // RGBA => Luminance
- tga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]);
- break;
- case 2:
- // RGBA => Luminance,Alpha
- tga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]);
- tga_data[i*req_comp+1] = trans_data[3];
- break;
- case 3:
- // RGBA => RGB
- tga_data[i*req_comp+0] = trans_data[0];
- tga_data[i*req_comp+1] = trans_data[1];
- tga_data[i*req_comp+2] = trans_data[2];
- break;
- case 4:
- // RGBA => RGBA
- tga_data[i*req_comp+0] = trans_data[0];
- tga_data[i*req_comp+1] = trans_data[1];
- tga_data[i*req_comp+2] = trans_data[2];
- tga_data[i*req_comp+3] = trans_data[3];
- break;
- }
- // in case we're in RLE mode, keep counting down
- --RLE_count;
- }
- // do I need to invert the image?
- if( tga_inverted )
- {
- for( j = 0; j*2 < tga_height; ++j )
- {
- int index1 = j * tga_width * req_comp;
- int index2 = (tga_height - 1 - j) * tga_width * req_comp;
- for( i = tga_width * req_comp; i > 0; --i )
- {
- unsigned char temp = tga_data[index1];
- tga_data[index1] = tga_data[index2];
- tga_data[index2] = temp;
- ++index1;
- ++index2;
- }
- }
- }
- // clear my palette, if I had one
- if( tga_palette != NULL )
- {
- stb_free( tga_palette );
- }
- // the things I do to get rid of an error message, and yet keep
- // Microsoft's C compilers happy... [8^(
- tga_palette_start = tga_palette_len = tga_palette_bits =
- tga_x_origin = tga_y_origin = 0;
- // OK, done
- return tga_data;
-}
-
-#ifndef STBI_NO_STDIO
-stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- stbi_uc *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_tga_load_from_file(f, x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-
-stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_file(&s, f);
- return tga_load(&s, x,y,comp,req_comp);
-}
-#endif
-
-stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return tga_load(&s, x,y,comp,req_comp);
-}
-
-
-// *************************************************************************************************
-// Photoshop PSD loader -- PD by Thatcher Ulrich, integration by Nicholas Schulz, tweaked by STB
-
-static int psd_test(stbi *s)
-{
- if (get32(s) != 0x38425053) return 0; // "8BPS"
- else return 1;
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_psd_test_file(FILE *f)
-{
- stbi s;
- int r,n = ftell(f);
- memset(&s, 0, sizeof(s));
- start_file(&s, f);
- r = psd_test(&s);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_psd_test_memory(stbi_uc const *buffer, int len)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return psd_test(&s);
-}
-
-static stbi_uc *psd_load(stbi *s, int *x, int *y, int *comp, int req_comp)
-{
- int pixelCount;
- int channelCount, compression;
- int channel, i, count, len;
- int w,h;
- uint8 *out;
-
- // Check identifier
- if (get32(s) != 0x38425053) // "8BPS"
- return epuc("not PSD", "Corrupt PSD image");
-
- // Check file type version.
- if (get16(s) != 1)
- return epuc("wrong version", "Unsupported version of PSD image");
-
- // Skip 6 reserved bytes.
- skip(s, 6 );
-
- // Read the number of channels (R, G, B, A, etc).
- channelCount = get16(s);
- if (channelCount < 0 || channelCount > 16)
- return epuc("wrong channel count", "Unsupported number of channels in PSD image");
-
- // Read the rows and columns of the image.
- h = get32(s);
- w = get32(s);
-
- // Make sure the depth is 8 bits.
- if (get16(s) != 8)
- return epuc("unsupported bit depth", "PSD bit depth is not 8 bit");
-
- // Make sure the color mode is RGB.
- // Valid options are:
- // 0: Bitmap
- // 1: Grayscale
- // 2: Indexed color
- // 3: RGB color
- // 4: CMYK color
- // 7: Multichannel
- // 8: Duotone
- // 9: Lab color
- if (get16(s) != 3)
- return epuc("wrong color format", "PSD is not in RGB color format");
-
- // Skip the Mode Data. (It's the palette for indexed color; other info for other modes.)
- skip(s,get32(s) );
-
- // Skip the image resources. (resolution, pen tool paths, etc)
- skip(s, get32(s) );
-
- // Skip the reserved data.
- skip(s, get32(s) );
-
- // Find out if the data is compressed.
- // Known values:
- // 0: no compression
- // 1: RLE compressed
- compression = get16(s);
- if (compression > 1)
- return epuc("bad compression", "PSD has an unknown compression format");
-
- // Create the destination image.
- out = (stbi_uc *) stb_malloc(4 * w*h);
- if (!out) return epuc("outofmem", "Out of memory");
- pixelCount = w*h;
-
- // Initialize the data to zero.
- //memset( out, 0, pixelCount * 4 );
-
- // Finally, the image data.
- if (compression) {
- // RLE as used by .PSD and .TIFF
- // Loop until you get the number of unpacked bytes you are expecting:
- // Read the next source byte into n.
- // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally.
- // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times.
- // Else if n is 128, noop.
- // Endloop
-
- // The RLE-compressed data is preceeded by a 2-byte data count for each row in the data,
- // which we're going to just skip.
- skip(s, h * channelCount * 2 );
-
- // Read the RLE data by channel.
- for (channel = 0; channel < 4; channel++) {
- uint8 *p;
-
- p = out+channel;
- if (channel >= channelCount) {
- // Fill this channel with default data.
- for (i = 0; i < pixelCount; i++) *p = (channel == 3 ? 255 : 0), p += 4;
- } else {
- // Read the RLE data.
- count = 0;
- while (count < pixelCount) {
- len = get8(s);
- if (len == 128) {
- // No-op.
- } else if (len < 128) {
- // Copy next len+1 bytes literally.
- len++;
- count += len;
- while (len) {
- *p = get8(s);
- p += 4;
- len--;
- }
- } else if (len > 128) {
- uint32 val;
- // Next -len+1 bytes in the dest are replicated from next source byte.
- // (Interpret len as a negative 8-bit int.)
- len ^= 0x0FF;
- len += 2;
- val = get8(s);
- count += len;
- while (len) {
- *p = val;
- p += 4;
- len--;
- }
- }
- }
- }
- }
-
- } else {
- // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...)
- // where each channel consists of an 8-bit value for each pixel in the image.
-
- // Read the data by channel.
- for (channel = 0; channel < 4; channel++) {
- uint8 *p;
-
- p = out + channel;
- if (channel > channelCount) {
- // Fill this channel with default data.
- for (i = 0; i < pixelCount; i++) *p = channel == 3 ? 255 : 0, p += 4;
- } else {
- // Read the data.
- count = 0;
- for (i = 0; i < pixelCount; i++)
- *p = get8(s), p += 4;
- }
- }
- }
-
- if (req_comp && req_comp != 4) {
- out = convert_format(out, 4, req_comp, w, h);
- if (out == NULL) return out; // convert_format frees input on failure
- }
-
- if (comp) *comp = channelCount;
- *y = h;
- *x = w;
-
- return out;
-}
-
-#ifndef STBI_NO_STDIO
-stbi_uc *stbi_psd_load(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- stbi_uc *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_psd_load_from_file(f, x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-
-stbi_uc *stbi_psd_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_file(&s, f);
- return psd_load(&s, x,y,comp,req_comp);
-}
-#endif
-
-stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return psd_load(&s, x,y,comp,req_comp);
-}
-
-
-// *************************************************************************************************
-// Radiance RGBE HDR loader
-// originally by Nicolas Schulz
-#ifndef STBI_NO_HDR
-static int hdr_test(stbi *s)
-{
- const char *signature = "#?RADIANCE\n";
- int i;
- for (i=0; signature[i]; ++i)
- if (get8(s) != signature[i])
- return 0;
- return 1;
-}
-
-int stbi_hdr_test_memory(stbi_uc const *buffer, int len)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return hdr_test(&s);
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_hdr_test_file(FILE *f)
-{
- stbi s;
- int r,n = ftell(f);
- memset(&s, 0, sizeof(s));
- start_file(&s, f);
- r = hdr_test(&s);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-#define HDR_BUFLEN 1024
-static char *hdr_gettoken(stbi *z, char *buffer)
-{
- int len=0;
- //char *s = buffer;
- char c = '\0';
-
- c = get8(z);
-
- while (!at_eof(z) && c != '\n') {
- buffer[len++] = c;
- if (len == HDR_BUFLEN-1) {
- // flush to end of line
- while (!at_eof(z) && get8(z) != '\n')
- ;
- break;
- }
- c = get8(z);
- }
-
- buffer[len] = 0;
- return buffer;
-}
-
-static void hdr_convert(float *output, stbi_uc *input, int req_comp)
-{
- if( input[3] != 0 ) {
- float f1;
- // Exponent
- f1 = (float) ldexp(1.0f, input[3] - (int)(128 + 8));
- if (req_comp <= 2)
- output[0] = (input[0] + input[1] + input[2]) * f1 / 3;
- else {
- output[0] = input[0] * f1;
- output[1] = input[1] * f1;
- output[2] = input[2] * f1;
- }
- if (req_comp == 2) output[1] = 1;
- if (req_comp == 4) output[3] = 1;
- } else {
- switch (req_comp) {
- case 4: output[3] = 1; /* fallthrough */
- case 3: output[0] = output[1] = output[2] = 0;
- break;
- case 2: output[1] = 1; /* fallthrough */
- case 1: output[0] = 0;
- break;
- }
- }
-}
-
-
-static float *hdr_load(stbi *s, int *x, int *y, int *comp, int req_comp)
-{
- char buffer[HDR_BUFLEN];
- char *token;
- int valid = 0;
- int width, height;
- stbi_uc *scanline;
- float *hdr_data;
- int len;
- unsigned char count, value;
- int i, j, k, c1,c2, z;
-
-
- // Check identifier
- if (strcmp(hdr_gettoken(s,buffer), "#?RADIANCE") != 0)
- return epf("not HDR", "Corrupt HDR image");
-
- // Parse header
- while(1) {
- token = hdr_gettoken(s,buffer);
- if (token[0] == 0) break;
- if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1;
- }
-
- if (!valid) return epf("unsupported format", "Unsupported HDR format");
-
- // Parse width and height
- // can't use sscanf() if we're not using stdio!
- token = hdr_gettoken(s,buffer);
- if (strncmp(token, "-Y ", 3)) return epf("unsupported data layout", "Unsupported HDR format");
- token += 3;
- height = strtol(token, &token, 10);
- while (*token == ' ') ++token;
- if (strncmp(token, "+X ", 3)) return epf("unsupported data layout", "Unsupported HDR format");
- token += 3;
- width = strtol(token, NULL, 10);
-
- *x = width;
- *y = height;
-
- *comp = 3;
- if (req_comp == 0) req_comp = 3;
-
- // Read data
- hdr_data = (float *) stb_malloc(height * width * req_comp * sizeof(float));
-
- // Load image data
- // image data is stored as some number of sca
- if( width < 8 || width >= 32768) {
- // Read flat data
- for (j=0; j < height; ++j) {
- for (i=0; i < width; ++i) {
- stbi_uc rgbe[4];
- main_decode_loop:
- getn(s, rgbe, 4);
- hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp);
- }
- }
- } else {
- // Read RLE-encoded data
- scanline = NULL;
-
- for (j = 0; j < height; ++j) {
- c1 = get8(s);
- c2 = get8(s);
- len = get8(s);
- if (c1 != 2 || c2 != 2 || (len & 0x80)) {
- // not run-length encoded, so we have to actually use THIS data as a decoded
- // pixel (note this can't be a valid pixel--one of RGB must be >= 128)
- stbi_uc rgbe[4] = { c1,c2,len, get8(s) };
- hdr_convert(hdr_data, rgbe, req_comp);
- i = 1;
- j = 0;
- stb_free(scanline);
- goto main_decode_loop; // yes, this is fucking insane; blame the fucking insane format
- }
- len <<= 8;
- len |= get8(s);
- if (len != width) { stb_free(hdr_data); stb_free(scanline); return epf("invalid decoded scanline length", "corrupt HDR"); }
- if (scanline == NULL) scanline = (stbi_uc *) stb_malloc(width * 4);
-
- for (k = 0; k < 4; ++k) {
- i = 0;
- while (i < width) {
- count = get8(s);
- if (count > 128) {
- // Run
- value = get8(s);
- count -= 128;
- for (z = 0; z < count; ++z)
- scanline[i++ * 4 + k] = value;
- } else {
- // Dump
- for (z = 0; z < count; ++z)
- scanline[i++ * 4 + k] = get8(s);
- }
- }
- }
- for (i=0; i < width; ++i)
- hdr_convert(hdr_data+(j*width + i)*req_comp, scanline + i*4, req_comp);
- }
- stb_free(scanline);
- }
-
- return hdr_data;
-}
-
-#ifndef STBI_NO_STDIO
-float *stbi_hdr_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_file(&s,f);
- return hdr_load(&s,x,y,comp,req_comp);
-}
-#endif
-
-float *stbi_hdr_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_mem(&s,buffer, len);
- return hdr_load(&s,x,y,comp,req_comp);
-}
-
-#endif // STBI_NO_HDR
-
-/////////////////////// write image ///////////////////////
-
-#ifndef STBI_NO_WRITE
-
-static void write8(FILE *f, int x) { uint8 z = (uint8) x; fwrite(&z,1,1,f); }
-
-static void writefv(FILE *f, char *fmt, va_list v)
-{
- while (*fmt) {
- switch (*fmt++) {
- case ' ': break;
- case '1': { uint8 x = va_arg(v, int); write8(f,x); break; }
- case '2': { int16 x = va_arg(v, int); write8(f,x); write8(f,x>>8); break; }
- case '4': { int32 x = va_arg(v, int); write8(f,x); write8(f,x>>8); write8(f,x>>16); write8(f,x>>24); break; }
- default:
- assert(0);
- va_end(v);
- return;
- }
- }
-}
-
-static void writef(FILE *f, char *fmt, ...)
-{
- va_list v;
- va_start(v, fmt);
- writefv(f,fmt,v);
- va_end(v);
-}
-
-static void write_pixels(FILE *f, int rgb_dir, int vdir, int x, int y, int comp, const void *data, int write_alpha, int scanline_pad)
-{
- uint8 bg[3] = { 255, 0, 255}, px[3];
- uint32 zero = 0;
- int i,j,k, j_end;
-
- if (vdir < 0)
- j_end = -1, j = y-1;
- else
- j_end = y, j = 0;
-
- for (; j != j_end; j += vdir) {
- for (i=0; i < x; ++i) {
- uint8 *d = (uint8 *) data + (j*x+i)*comp;
- if (write_alpha < 0)
- fwrite(&d[comp-1], 1, 1, f);
- switch (comp) {
- case 1:
- case 2: writef(f, (char*)"111", d[0],d[0],d[0]);
- break;
- case 4:
- if (!write_alpha) {
- for (k=0; k < 3; ++k)
- px[k] = bg[k] + ((d[k] - bg[k]) * d[3])/255;
- writef(f, (char*)"111", px[1-rgb_dir],px[1],px[1+rgb_dir]);
- break;
- }
- /* FALLTHROUGH */
- case 3:
- writef(f, (char*)"111", d[1-rgb_dir],d[1],d[1+rgb_dir]);
- break;
- }
- if (write_alpha > 0)
- fwrite(&d[comp-1], 1, 1, f);
- }
- fwrite(&zero,scanline_pad,1,f);
- }
-}
-
-static int outfile(char const *filename, int rgb_dir, int vdir, int x, int y, int comp, const void *data, int alpha, int pad, char *fmt, ...)
-{
- FILE *f = fopen(filename, "wb");
- if (f) {
- va_list v;
- va_start(v, fmt);
- writefv(f, fmt, v);
- va_end(v);
- write_pixels(f,rgb_dir,vdir,x,y,comp,data,alpha,pad);
- fclose(f);
- }
- return f != NULL;
-}
-
-#ifdef _MSC_VER
-static int outfile_w(wchar_t const *filename, int rgb_dir, int vdir, int x, int y, int comp, const void *data, int alpha, int pad, char *fmt, ...)
-{
- FILE *f = _wfopen(filename, L"wb");
- if (f) {
- va_list v;
- va_start(v, fmt);
- writefv(f, fmt, v);
- va_end(v);
- write_pixels(f,rgb_dir,vdir,x,y,comp,data,alpha,pad);
- fclose(f);
- }
- return f != NULL;
-}
-#endif
-
-int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data)
-{
- int pad = (-x*3) & 3;
- return outfile(filename,-1,-1,x,y,comp,data,0,pad,
- (char*)"11 4 22 4" "4 44 22 444444",
- 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
- 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
-}
-
-#ifdef _MSC_VER
-int stbi_write_bmp_w(wchar_t const *filename, int x, int y, int comp, const void *data)
-{
- int pad = (-x*3) & 3;
- return outfile_w(filename,-1,-1,x,y,comp,data,0,pad,
- (char*)"11 4 22 4" "4 44 22 444444",
- 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
- 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
-}
-#endif
-
-int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)
-{
- int has_alpha = !(comp & 1);
- return outfile(filename, -1,-1, x, y, comp, data, has_alpha, 0,
- (char*)"111 221 2222 11", 0,0,2, 0,0,0, 0,0,x,y, 24+8*has_alpha, 8*has_alpha);
-}
-
-#ifdef _MSC_VER
-int stbi_write_tga_w(wchar_t const *filename, int x, int y, int comp, const void *data)
-{
- int has_alpha = !(comp & 1);
- return outfile_w(filename, -1,-1, x, y, comp, data, has_alpha, 0,
- (char*)"111 221 2222 11", 0,0,2, 0,0,0, 0,0,x,y, 24+8*has_alpha, 8*has_alpha);
-}
-#endif
-
-// any other image formats that do interleaved rgb data?
-// PNG: requires adler32,crc32 -- significant amount of code
-// PSD: no, channels output separately
-// TIFF: no, stripwise-interleaved... i think
-
-#endif // STBI_NO_WRITE
-
-}
-
-#endif // STBI_HEADER_FILE_ONLY
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_strutils.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_strutils.cpp
deleted file mode 100644
index 3a53c28e..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_strutils.cpp
+++ /dev/null
@@ -1,613 +0,0 @@
-// File: crn_strutils.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_strutils.h"
-
-namespace crnlib
-{
- char* crn_strdup(const char* pStr)
- {
- if (!pStr)
- pStr = "";
-
- size_t l = strlen(pStr) + 1;
- char *p = (char *)crnlib_malloc(l);
- if (p)
- memcpy(p, pStr, l);
-
- return p;
- }
-
- int crn_stricmp(const char *p, const char *q)
- {
- return _stricmp(p, q);
- }
-
- char* strcpy_safe(char* pDst, uint dst_len, const char* pSrc)
- {
- CRNLIB_ASSERT(pDst && pSrc && dst_len);
- if (!dst_len)
- return pDst;
-
- char* q = pDst;
- char c;
-
- do
- {
- if (dst_len == 1)
- {
- *q++ = '\0';
- break;
- }
-
- c = *pSrc++;
- *q++ = c;
-
- dst_len--;
-
- } while (c);
-
- CRNLIB_ASSERT((q - pDst) <= (int)dst_len);
-
- return pDst;
- }
-
- bool int_to_string(int value, char* pDst, uint len)
- {
- CRNLIB_ASSERT(pDst);
-
- const uint cBufSize = 16;
- char buf[cBufSize];
-
- uint j = static_cast<uint>((value < 0) ? -value : value);
-
- char* p = buf + cBufSize - 1;
-
- *p-- = '\0';
-
- do
- {
- *p-- = static_cast<uint8>('0' + (j % 10));
- j /= 10;
- } while (j);
-
- if (value < 0)
- *p-- = '-';
-
- const size_t total_bytes = (buf + cBufSize - 1) - p;
- if (total_bytes > len)
- return false;
-
- for (size_t i = 0; i < total_bytes; i++)
- pDst[i] = p[1 + i];
-
- return true;
- }
-
- bool uint_to_string(uint value, char* pDst, uint len)
- {
- CRNLIB_ASSERT(pDst);
-
- const uint cBufSize = 16;
- char buf[cBufSize];
-
- char* p = buf + cBufSize - 1;
-
- *p-- = '\0';
-
- do
- {
- *p-- = static_cast<uint8>('0' + (value % 10));
- value /= 10;
- } while (value);
-
- const size_t total_bytes = (buf + cBufSize - 1) - p;
- if (total_bytes > len)
- return false;
-
- for (size_t i = 0; i < total_bytes; i++)
- pDst[i] = p[1 + i];
-
- return true;
- }
-
- bool string_to_int(const char*& pBuf, int& value)
- {
- value = 0;
-
- CRNLIB_ASSERT(pBuf);
- const char* p = pBuf;
-
- while (*p && isspace(*p))
- p++;
-
- uint result = 0;
- bool negative = false;
-
- if (!isdigit(*p))
- {
- if (p[0] == '-')
- {
- negative = true;
- p++;
- }
- else
- return false;
- }
-
- while (*p && isdigit(*p))
- {
- if (result & 0xE0000000U)
- return false;
-
- const uint result8 = result << 3U;
- const uint result2 = result << 1U;
-
- if (result2 > (0xFFFFFFFFU - result8))
- return false;
-
- result = result8 + result2;
-
- uint c = p[0] - '0';
- if (c > (0xFFFFFFFFU - result))
- return false;
-
- result += c;
-
- p++;
- }
-
- if (negative)
- {
- if (result > 0x80000000U)
- {
- value = 0;
- return false;
- }
- value = -static_cast<int>(result);
- }
- else
- {
- if (result > 0x7FFFFFFFU)
- {
- value = 0;
- return false;
- }
- value = static_cast<int>(result);
- }
-
- pBuf = p;
-
- return true;
- }
-
- bool string_to_int64(const char*& pBuf, int64& value)
- {
- value = 0;
-
- CRNLIB_ASSERT(pBuf);
- const char* p = pBuf;
-
- while (*p && isspace(*p))
- p++;
-
- uint64 result = 0;
- bool negative = false;
-
- if (!isdigit(*p))
- {
- if (p[0] == '-')
- {
- negative = true;
- p++;
- }
- else
- return false;
- }
-
- while (*p && isdigit(*p))
- {
- if (result & 0xE000000000000000ULL)
- return false;
-
- const uint64 result8 = result << 3U;
- const uint64 result2 = result << 1U;
-
- if (result2 > (0xFFFFFFFFFFFFFFFFULL - result8))
- return false;
-
- result = result8 + result2;
-
- uint c = p[0] - '0';
- if (c > (0xFFFFFFFFFFFFFFFFULL - result))
- return false;
-
- result += c;
-
- p++;
- }
-
- if (negative)
- {
- if (result > 0x8000000000000000ULL)
- {
- value = 0;
- return false;
- }
- value = -static_cast<int64>(result);
- }
- else
- {
- if (result > 0x7FFFFFFFFFFFFFFFULL)
- {
- value = 0;
- return false;
- }
- value = static_cast<int64>(result);
- }
-
- pBuf = p;
-
- return true;
- }
-
- bool string_to_uint(const char*& pBuf, uint& value)
- {
- value = 0;
-
- CRNLIB_ASSERT(pBuf);
- const char* p = pBuf;
-
- while (*p && isspace(*p))
- p++;
-
- uint result = 0;
-
- if (!isdigit(*p))
- return false;
-
- while (*p && isdigit(*p))
- {
- if (result & 0xE0000000U)
- return false;
-
- const uint result8 = result << 3U;
- const uint result2 = result << 1U;
-
- if (result2 > (0xFFFFFFFFU - result8))
- return false;
-
- result = result8 + result2;
-
- uint c = p[0] - '0';
- if (c > (0xFFFFFFFFU - result))
- return false;
-
- result += c;
-
- p++;
- }
-
- value = result;
-
- pBuf = p;
-
- return true;
- }
-
- bool string_to_uint64(const char*& pBuf, uint64& value)
- {
- value = 0;
-
- CRNLIB_ASSERT(pBuf);
- const char* p = pBuf;
-
- while (*p && isspace(*p))
- p++;
-
- uint64 result = 0;
-
- if (!isdigit(*p))
- return false;
-
- while (*p && isdigit(*p))
- {
- if (result & 0xE000000000000000ULL)
- return false;
-
- const uint64 result8 = result << 3U;
- const uint64 result2 = result << 1U;
-
- if (result2 > (0xFFFFFFFFFFFFFFFFULL - result8))
- return false;
-
- result = result8 + result2;
-
- uint c = p[0] - '0';
- if (c > (0xFFFFFFFFFFFFFFFFULL - result))
- return false;
-
- result += c;
-
- p++;
- }
-
- value = result;
-
- pBuf = p;
-
- return true;
- }
-
- bool string_to_bool(const char* p, bool& value)
- {
- CRNLIB_ASSERT(p);
-
- value = false;
-
- if (_stricmp(p, "false") == 0)
- return true;
-
- if (_stricmp(p, "true") == 0)
- {
- value = true;
- return true;
- }
-
- const char* q = p;
- uint v;
- if (string_to_uint(q, v))
- {
- if (!v)
- return true;
- else if (v == 1)
- {
- value = true;
- return true;
- }
- }
-
- return false;
- }
-
- bool string_to_float(const char*& p, float& value, uint round_digit)
- {
- double d;
- if (!string_to_double(p, d, round_digit))
- {
- value = 0;
- return false;
- }
- value = static_cast<float>(d);
- return true;
- }
-
- bool string_to_double(const char*& p, double& value, uint round_digit)
- {
- return string_to_double(p, p + 128, value, round_digit);
- }
-
- // I wrote this approx. 20 years ago in C/assembly using a limited FP emulator package, so it's a bit crude.
- bool string_to_double(const char*& p, const char *pEnd, double& value, uint round_digit)
- {
- CRNLIB_ASSERT(p);
-
- value = 0;
-
- enum { AF_BLANK = 1, AF_SIGN = 2, AF_DPOINT = 3, AF_BADCHAR = 4, AF_OVRFLOW = 5, AF_EXPONENT = 6, AF_NODIGITS = 7 };
- int status = 0;
-
- const char* buf = p;
-
- int got_sign_flag = 0, got_dp_flag = 0, got_num_flag = 0;
- int got_e_flag = 0, got_e_sign_flag = 0, e_sign = 0;
- uint whole_count = 0, frac_count = 0;
-
- double whole = 0, frac = 0, scale = 1, exponent = 1;
-
- if (p >= pEnd)
- {
- status = AF_NODIGITS;
- goto af_exit;
- }
-
- while (*buf)
- {
- if (!isspace(*buf))
- break;
- if (++buf >= pEnd)
- {
- status = AF_NODIGITS;
- goto af_exit;
- }
- }
-
- p = buf;
-
- while (*buf)
- {
- p = buf;
- if (buf >= pEnd)
- break;
-
- int i = *buf++;
-
- switch (i)
- {
- case 'e':
- case 'E':
- {
- got_e_flag = 1;
- goto exit_while;
- }
- case '+':
- {
- if ((got_num_flag) || (got_sign_flag))
- {
- status = AF_SIGN;
- goto af_exit;
- }
-
- got_sign_flag = 1;
-
- break;
- }
- case '-':
- {
- if ((got_num_flag) || (got_sign_flag))
- {
- status = AF_SIGN;
- goto af_exit;
- }
-
- got_sign_flag = -1;
-
- break;
- }
- case '.':
- {
- if (got_dp_flag)
- {
- status = AF_DPOINT;
- goto af_exit;
- }
-
- got_dp_flag = 1;
-
- break;
- }
- default:
- {
- if ((i < '0') || (i > '9'))
- goto exit_while;
- else
- {
- i -= '0';
-
- got_num_flag = 1;
-
- if (got_dp_flag)
- {
- if (frac_count < round_digit)
- {
- frac = frac * 10.0f + i;
-
- scale = scale * 10.0f;
- }
- else if (frac_count == round_digit)
- {
- if (i >= 5) /* check for round */
- frac = frac + 1.0f;
- }
-
- frac_count++;
- }
- else
- {
- whole = whole * 10.0f + i;
-
- whole_count++;
-
- if (whole > 1e+100)
- {
- status = AF_OVRFLOW;
- goto af_exit;
- }
- }
- }
-
- break;
- }
- }
- }
-
- exit_while:
-
- if (got_e_flag)
- {
- if ((got_num_flag == 0) && (got_dp_flag))
- {
- status = AF_EXPONENT;
- goto af_exit;
- }
-
- int e = 0;
- e_sign = 1;
- got_num_flag = 0;
- got_e_sign_flag = 0;
-
- while (*buf)
- {
- p = buf;
- if (buf >= pEnd)
- break;
-
- int i = *buf++;
-
- if (i == '+')
- {
- if ((got_num_flag) || (got_e_sign_flag))
- {
- status = AF_EXPONENT;
- goto af_exit;
- }
-
- e_sign = 1;
- got_e_sign_flag = 1;
- }
- else if (i == '-')
- {
- if ((got_num_flag) || (got_e_sign_flag))
- {
- status = AF_EXPONENT;
- goto af_exit;
- }
-
- e_sign = -1;
- got_e_sign_flag = 1;
- }
- else if ((i >= '0') && (i <= '9'))
- {
- got_num_flag = 1;
-
- if ((e = (e * 10) + (i - 48)) > 100)
- {
- status = AF_EXPONENT;
- goto af_exit;
- }
- }
- else
- break;
- }
-
- for (int i = 1; i <= e; i++) /* compute 10^e */
- exponent = exponent * 10.0f;
- }
-
- if (((whole_count + frac_count) == 0) && (got_e_flag == 0))
- {
- status = AF_NODIGITS;
- goto af_exit;
- }
-
- if (frac)
- whole = whole + (frac / scale);
-
- if (got_e_flag)
- {
- if (e_sign > 0)
- whole = whole * exponent;
- else
- whole = whole / exponent;
- }
-
- if (got_sign_flag < 0)
- whole = -whole;
-
- value = whole;
-
- af_exit:
- return (status == 0);
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_strutils.h b/Libraries/crunch-ea9b8d/crnlib/crn_strutils.h
deleted file mode 100644
index af4fbd05..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_strutils.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// File: crn_strutils.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-#ifdef WIN32
- #define CRNLIB_PATH_SEPERATOR_CHAR '\\'
-#else
- #define CRNLIB_PATH_SEPERATOR_CHAR '/'
-#endif
-
-namespace crnlib
-{
- char* crn_strdup(const char* pStr);
- int crn_stricmp(const char *p, const char *q);
-
- char* strcpy_safe(char* pDst, uint dst_len, const char* pSrc);
-
- bool int_to_string(int value, char* pDst, uint len);
- bool uint_to_string(uint value, char* pDst, uint len);
-
- bool string_to_int(const char*& pBuf, int& value);
-
- bool string_to_uint(const char*& pBuf, uint& value);
-
- bool string_to_int64(const char*& pBuf, int64& value);
- bool string_to_uint64(const char*& pBuf, uint64& value);
-
- bool string_to_bool(const char* p, bool& value);
-
- bool string_to_float(const char*& p, float& value, uint round_digit = 512U);
-
- bool string_to_double(const char*& p, double& value, uint round_digit = 512U);
- bool string_to_double(const char*& p, const char *pEnd, double& value, uint round_digit = 512U);
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_symbol_codec.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_symbol_codec.cpp
deleted file mode 100644
index 410b3e39..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_symbol_codec.cpp
+++ /dev/null
@@ -1,1901 +0,0 @@
-// File: crn_symbol_codec.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_symbol_codec.h"
-#include "crn_huffman_codes.h"
-
-namespace crnlib
-{
- static float gProbCost[cSymbolCodecArithProbScale];
-
- //const uint cArithProbMulLenSigBits = 8;
- //const uint cArithProbMulLenSigScale = 1 << cArithProbMulLenSigBits;
-
- class arith_prob_cost_initializer
- {
- public:
- arith_prob_cost_initializer()
- {
- const float cInvLn2 = 1.0f / 0.69314718f;
-
- for (uint i = 0; i < cSymbolCodecArithProbScale; i++)
- gProbCost[i] = -logf(i * (1.0f / cSymbolCodecArithProbScale)) * cInvLn2;
- }
- };
-
- static arith_prob_cost_initializer g_prob_cost_initializer;
-
- double symbol_histogram::calc_entropy() const
- {
- double total = 0.0f;
- for (uint i = 0; i < m_hist.size(); i++)
- total += m_hist[i];
- if (total == 0.0f)
- return 0.0f;
-
- double entropy = 0.0f;
- double neg_inv_log2 = -1.0f / log(2.0f);
- double inv_total = 1.0f / total;
- for (uint i = 0; i < m_hist.size(); i++)
- {
- if (m_hist[i])
- {
- double bits = log(m_hist[i] * inv_total) * neg_inv_log2;
- entropy += bits * m_hist[i];
- }
- }
-
- return entropy;
- }
-
- uint64 symbol_histogram::get_total() const
- {
- uint64 total = 0;
- for (uint i = 0; i < m_hist.size(); i++)
- total += m_hist[i];
- return total;
- }
-
- adaptive_huffman_data_model::adaptive_huffman_data_model(bool encoding, uint total_syms) :
- m_total_syms(0),
- m_update_cycle(0),
- m_symbols_until_update(0),
- m_total_count(0),
- m_pDecode_tables(NULL),
- m_decoder_table_bits(0),
- m_encoding(encoding)
- {
- if (total_syms)
- init(encoding, total_syms);
- }
-
- adaptive_huffman_data_model::adaptive_huffman_data_model(const adaptive_huffman_data_model& other) :
- m_total_syms(0),
- m_update_cycle(0),
- m_symbols_until_update(0),
- m_total_count(0),
- m_pDecode_tables(NULL),
- m_decoder_table_bits(0),
- m_encoding(false)
- {
- *this = other;
- }
-
- adaptive_huffman_data_model::~adaptive_huffman_data_model()
- {
- if (m_pDecode_tables)
- crnlib_delete(m_pDecode_tables);
- }
-
- adaptive_huffman_data_model& adaptive_huffman_data_model::operator= (const adaptive_huffman_data_model& rhs)
- {
- if (this == &rhs)
- return *this;
-
- m_total_syms = rhs.m_total_syms;
-
- m_update_cycle = rhs.m_update_cycle;
- m_symbols_until_update = rhs.m_symbols_until_update;
-
- m_total_count = rhs.m_total_count;
-
- m_sym_freq = rhs.m_sym_freq;
-
- m_codes = rhs.m_codes;
- m_code_sizes = rhs.m_code_sizes;
-
- if (rhs.m_pDecode_tables)
- {
- if (m_pDecode_tables)
- *m_pDecode_tables = *rhs.m_pDecode_tables;
- else
- m_pDecode_tables = crnlib_new<prefix_coding::decoder_tables>(*rhs.m_pDecode_tables);
- }
- else
- {
- crnlib_delete(m_pDecode_tables);
- m_pDecode_tables = NULL;
- }
-
- m_decoder_table_bits = rhs.m_decoder_table_bits;
- m_encoding = rhs.m_encoding;
-
- return *this;
- }
-
- void adaptive_huffman_data_model::clear()
- {
- m_sym_freq.clear();
- m_codes.clear();
- m_code_sizes.clear();
-
- m_total_syms = 0;
- m_update_cycle = 0;
- m_symbols_until_update = 0;
- m_decoder_table_bits = 0;
- m_total_count = 0;
-
- if (m_pDecode_tables)
- {
- crnlib_delete(m_pDecode_tables);
- m_pDecode_tables = NULL;
- }
- }
-
- void adaptive_huffman_data_model::init(bool encoding, uint total_syms)
- {
- clear();
-
- m_encoding = encoding;
-
- m_sym_freq.resize(total_syms);
- m_code_sizes.resize(total_syms);
-
- m_total_syms = total_syms;
-
- if (m_total_syms <= 16)
- m_decoder_table_bits = 0;
- else
- m_decoder_table_bits = static_cast<uint8>(math::minimum(1 + math::ceil_log2i(m_total_syms), prefix_coding::cMaxTableBits));
-
- if (m_encoding)
- m_codes.resize(total_syms);
- else
- m_pDecode_tables = crnlib_new<prefix_coding::decoder_tables>();
-
- reset();
- }
-
- void adaptive_huffman_data_model::reset()
- {
- if (!m_total_syms)
- return;
-
- for (uint i = 0; i < m_total_syms; i++)
- m_sym_freq[i] = 1;
-
- m_total_count = 0;
- m_update_cycle = m_total_syms;
-
- update();
-
- m_symbols_until_update = m_update_cycle = 8;//(m_total_syms + 6) >> 1;
- }
-
- void adaptive_huffman_data_model::rescale()
- {
- uint total_freq = 0;
-
- for (uint i = 0; i < m_total_syms; i++)
- {
- uint freq = (m_sym_freq[i] + 1) >> 1;
- total_freq += freq;
- m_sym_freq[i] = static_cast<uint16>(freq);
- }
-
- m_total_count = total_freq;
- }
-
- void adaptive_huffman_data_model::update()
- {
- m_total_count += m_update_cycle;
-
- if (m_total_count >= 32768)
- rescale();
-
- void* pTables = create_generate_huffman_codes_tables();
-
- uint max_code_size, total_freq;
- bool status = generate_huffman_codes(pTables, m_total_syms, &m_sym_freq[0], &m_code_sizes[0], max_code_size, total_freq);
- CRNLIB_ASSERT(status);
- CRNLIB_ASSERT(total_freq == m_total_count);
-
- if (max_code_size > prefix_coding::cMaxExpectedCodeSize)
- prefix_coding::limit_max_code_size(m_total_syms, &m_code_sizes[0], prefix_coding::cMaxExpectedCodeSize);
-
- free_generate_huffman_codes_tables(pTables);
-
- if (m_encoding)
- status = prefix_coding::generate_codes(m_total_syms, &m_code_sizes[0], &m_codes[0]);
- else
- status = prefix_coding::generate_decoder_tables(m_total_syms, &m_code_sizes[0], m_pDecode_tables, m_decoder_table_bits);
-
- CRNLIB_ASSERT(status);
- status;
-
- m_update_cycle = (5 * m_update_cycle) >> 2;
- uint max_cycle = (m_total_syms + 6) << 3; // this was << 2 - which is ~12% slower but compresses around .5% better
-
- if (m_update_cycle > max_cycle)
- m_update_cycle = max_cycle;
-
- m_symbols_until_update = m_update_cycle;
- }
-
- static_huffman_data_model::static_huffman_data_model() :
- m_total_syms(0),
- m_pDecode_tables(NULL),
- m_encoding(false)
- {
- }
-
- static_huffman_data_model::static_huffman_data_model(const static_huffman_data_model& other) :
- m_total_syms(0),
- m_pDecode_tables(NULL),
- m_encoding(false)
- {
- *this = other;
- }
-
- static_huffman_data_model::~static_huffman_data_model()
- {
- if (m_pDecode_tables)
- crnlib_delete(m_pDecode_tables);
- }
-
- static_huffman_data_model& static_huffman_data_model::operator=(const static_huffman_data_model& rhs)
- {
- if (this == &rhs)
- return *this;
-
- m_total_syms = rhs.m_total_syms;
- m_codes = rhs.m_codes;
- m_code_sizes = rhs.m_code_sizes;
-
- if (rhs.m_pDecode_tables)
- {
- if (m_pDecode_tables)
- *m_pDecode_tables = *rhs.m_pDecode_tables;
- else
- m_pDecode_tables = crnlib_new<prefix_coding::decoder_tables>(*rhs.m_pDecode_tables);
- }
- else
- {
- crnlib_delete(m_pDecode_tables);
- m_pDecode_tables = NULL;
- }
-
- m_encoding = rhs.m_encoding;
-
- return *this;
- }
-
- void static_huffman_data_model::clear()
- {
- m_total_syms = 0;
- m_codes.clear();
- m_code_sizes.clear();
- if (m_pDecode_tables)
- {
- crnlib_delete(m_pDecode_tables);
- m_pDecode_tables = NULL;
- }
- m_encoding = false;
- }
-
- bool static_huffman_data_model::init(bool encoding, uint total_syms, const uint16* pSym_freq, uint code_size_limit)
- {
- CRNLIB_ASSERT((total_syms >= 1) && (total_syms <= prefix_coding::cMaxSupportedSyms) && (code_size_limit >= 1));
-
- m_encoding = encoding;
-
- m_total_syms = total_syms;
-
- code_size_limit = math::minimum(code_size_limit, prefix_coding::cMaxExpectedCodeSize);
-
- m_code_sizes.resize(total_syms);
-
- void* pTables = create_generate_huffman_codes_tables();
-
- uint max_code_size = 0, total_freq;
- bool status = generate_huffman_codes(pTables, m_total_syms, pSym_freq, &m_code_sizes[0], max_code_size, total_freq);
-
- free_generate_huffman_codes_tables(pTables);
-
- if (!status)
- return false;
-
- if (max_code_size > code_size_limit)
- {
- if (!prefix_coding::limit_max_code_size(m_total_syms, &m_code_sizes[0], code_size_limit))
- return false;
- }
-
- if (m_encoding)
- {
- m_codes.resize(total_syms);
-
- if (m_pDecode_tables)
- {
- crnlib_delete(m_pDecode_tables);
- m_pDecode_tables = NULL;
- }
-
- if (!prefix_coding::generate_codes(m_total_syms, &m_code_sizes[0], &m_codes[0]))
- return false;
- }
- else
- {
- m_codes.clear();
-
- if (!m_pDecode_tables)
- m_pDecode_tables = crnlib_new<prefix_coding::decoder_tables>();
-
- if (!prefix_coding::generate_decoder_tables(m_total_syms, &m_code_sizes[0], m_pDecode_tables, compute_decoder_table_bits()))
- return false;
- }
-
- return true;
- }
-
- bool static_huffman_data_model::init(bool encoding, uint total_syms, const uint* pSym_freq, uint code_size_limit)
- {
- CRNLIB_ASSERT((total_syms >= 1) && (total_syms <= prefix_coding::cMaxSupportedSyms) && (code_size_limit >= 1));
-
- crnlib::vector<uint16> sym_freq16(total_syms);
-
- uint max_freq = 0;
- for (uint i = 0; i < total_syms; i++)
- max_freq = math::maximum(max_freq, pSym_freq[i]);
-
- if (!max_freq)
- return false;
-
- if (max_freq <= cUINT16_MAX)
- {
- for (uint i = 0; i < total_syms; i++)
- sym_freq16[i] = static_cast<uint16>(pSym_freq[i]);
- }
- else
- {
- for (uint i = 0; i < total_syms; i++)
- {
- uint f = pSym_freq[i];
- if (!f)
- continue;
-
- uint64 fl = f;
-
- fl = ((fl << 16) - fl) + (max_freq >> 1);
- fl /= max_freq;
- if (fl < 1)
- fl = 1;
-
- CRNLIB_ASSERT(fl <= cUINT16_MAX);
-
- sym_freq16[i] = static_cast<uint16>(fl);
- }
- }
-
- return init(encoding, total_syms, &sym_freq16[0], code_size_limit);
- }
-
- bool static_huffman_data_model::init(bool encoding, uint total_syms, const uint8* pCode_sizes, uint code_size_limit)
- {
- CRNLIB_ASSERT((total_syms >= 1) && (total_syms <= prefix_coding::cMaxSupportedSyms) && (code_size_limit >= 1));
-
- m_encoding = encoding;
-
- code_size_limit = math::minimum(code_size_limit, prefix_coding::cMaxExpectedCodeSize);
-
- m_code_sizes.resize(total_syms);
-
- uint min_code_size = UINT_MAX;
- uint max_code_size = 0;
-
- for (uint i = 0; i < total_syms; i++)
- {
- uint s = pCode_sizes[i];
- m_code_sizes[i] = static_cast<uint8>(s);
- min_code_size = math::minimum(min_code_size, s);
- max_code_size = math::maximum(max_code_size, s);
- }
-
- if ((max_code_size < 1) || (max_code_size > 32) || (min_code_size > code_size_limit))
- return false;
-
- if (max_code_size > code_size_limit)
- {
- if (!prefix_coding::limit_max_code_size(m_total_syms, &m_code_sizes[0], code_size_limit))
- return false;
- }
-
- if (m_encoding)
- {
- m_codes.resize(total_syms);
-
- if (m_pDecode_tables)
- {
- crnlib_delete(m_pDecode_tables);
- m_pDecode_tables = NULL;
- }
-
- if (!prefix_coding::generate_codes(m_total_syms, &m_code_sizes[0], &m_codes[0]))
- return false;
- }
- else
- {
- m_codes.clear();
-
- if (!m_pDecode_tables)
- m_pDecode_tables = crnlib_new<prefix_coding::decoder_tables>();
-
- if (!prefix_coding::generate_decoder_tables(m_total_syms, &m_code_sizes[0], m_pDecode_tables, compute_decoder_table_bits()))
- return false;
- }
-
- return true;
- }
-
- bool static_huffman_data_model::init(bool encoding, const symbol_histogram& hist, uint code_size_limit)
- {
- return init(encoding, hist.size(), hist.get_ptr(), code_size_limit);
- }
-
- bool static_huffman_data_model::prepare_decoder_tables()
- {
- uint total_syms = m_code_sizes.size();
-
- CRNLIB_ASSERT((total_syms >= 1) && (total_syms <= prefix_coding::cMaxSupportedSyms));
-
- m_encoding = false;
-
- m_total_syms = total_syms;
-
- m_codes.clear();
-
- if (!m_pDecode_tables)
- m_pDecode_tables = crnlib_new<prefix_coding::decoder_tables>();
-
- return prefix_coding::generate_decoder_tables(m_total_syms, &m_code_sizes[0], m_pDecode_tables, compute_decoder_table_bits());
- }
-
- uint static_huffman_data_model::compute_decoder_table_bits() const
- {
- uint decoder_table_bits = 0;
- if (m_total_syms > 16)
- decoder_table_bits = static_cast<uint8>(math::minimum(1 + math::ceil_log2i(m_total_syms), prefix_coding::cMaxTableBits));
- return decoder_table_bits;
- }
-
- adaptive_bit_model::adaptive_bit_model()
- {
- clear();
- }
-
- adaptive_bit_model::adaptive_bit_model(float prob0)
- {
- set_probability_0(prob0);
- }
-
- adaptive_bit_model::adaptive_bit_model(const adaptive_bit_model& other) :
- m_bit_0_prob(other.m_bit_0_prob)
- {
- }
-
- adaptive_bit_model& adaptive_bit_model::operator= (const adaptive_bit_model& rhs)
- {
- m_bit_0_prob = rhs.m_bit_0_prob;
- return *this;
- }
-
- void adaptive_bit_model::clear()
- {
- m_bit_0_prob = 1U << (cSymbolCodecArithProbBits - 1);
- }
-
- void adaptive_bit_model::set_probability_0(float prob0)
- {
- m_bit_0_prob = static_cast<uint16>(math::clamp<uint>((uint)(prob0 * cSymbolCodecArithProbScale), 1, cSymbolCodecArithProbScale - 1));
- }
-
- float adaptive_bit_model::get_cost(uint bit) const
- {
- return gProbCost[bit ? (cSymbolCodecArithProbScale - m_bit_0_prob) : m_bit_0_prob];
- }
-
- void adaptive_bit_model::update(uint bit)
- {
- if (!bit)
- m_bit_0_prob += ((cSymbolCodecArithProbScale - m_bit_0_prob) >> cSymbolCodecArithProbMoveBits);
- else
- m_bit_0_prob -= (m_bit_0_prob >> cSymbolCodecArithProbMoveBits);
- CRNLIB_ASSERT(m_bit_0_prob >= 1);
- CRNLIB_ASSERT(m_bit_0_prob < cSymbolCodecArithProbScale);
- }
-
- adaptive_arith_data_model::adaptive_arith_data_model(bool encoding, uint total_syms)
- {
- init(encoding, total_syms);
- }
-
- adaptive_arith_data_model::adaptive_arith_data_model(const adaptive_arith_data_model& other)
- {
- m_total_syms = other.m_total_syms;
- m_probs = other.m_probs;
- }
-
- adaptive_arith_data_model::~adaptive_arith_data_model()
- {
- }
-
- adaptive_arith_data_model& adaptive_arith_data_model::operator= (const adaptive_arith_data_model& rhs)
- {
- m_total_syms = rhs.m_total_syms;
- m_probs = rhs.m_probs;
- return *this;
- }
-
- void adaptive_arith_data_model::clear()
- {
- m_total_syms = 0;
- m_probs.clear();
- }
-
- void adaptive_arith_data_model::init(bool encoding, uint total_syms)
- {
- encoding;
- if (!total_syms)
- {
- clear();
- return;
- }
-
- if ((total_syms < 2) || (!math::is_power_of_2(total_syms)))
- total_syms = math::next_pow2(total_syms);
-
- m_total_syms = total_syms;
-
- m_probs.resize(m_total_syms);
- }
-
- void adaptive_arith_data_model::reset()
- {
- for (uint i = 0; i < m_probs.size(); i++)
- m_probs[i].clear();
- }
-
- float adaptive_arith_data_model::get_cost(uint sym) const
- {
- uint node = 1;
-
- uint bitmask = m_total_syms;
-
- float cost = 0.0f;
- do
- {
- bitmask >>= 1;
-
- uint bit = (sym & bitmask) ? 1 : 0;
- cost += m_probs[node].get_cost(bit);
- node = (node << 1) + bit;
-
- } while (bitmask > 1);
-
- return cost;
- }
-
- symbol_codec::symbol_codec()
- {
- clear();
- }
-
- void symbol_codec::clear()
- {
- m_pDecode_buf = NULL;
- m_pDecode_buf_next = NULL;
- m_pDecode_buf_end = NULL;
- m_decode_buf_size = 0;
-
- m_bit_buf = 0;
- m_bit_count = 0;
- m_total_model_updates = 0;
- m_mode = cNull;
- m_simulate_encoding = false;
- m_total_bits_written = 0;
-
- m_arith_base = 0;
- m_arith_value = 0;
- m_arith_length = 0;
- m_arith_total_bits = 0;
-
- m_output_buf.clear();
- m_arith_output_buf.clear();
- m_output_syms.clear();
- }
-
- void symbol_codec::start_encoding(uint expected_file_size)
- {
- m_mode = cEncoding;
-
- m_total_model_updates = 0;
- m_total_bits_written = 0;
-
- put_bits_init(expected_file_size);
-
- m_output_syms.resize(0);
-
- arith_start_encoding();
- }
-
- // Code length encoding symbols:
- // 0-16 - actual code lengths
- const uint cMaxCodelengthCodes = 21;
-
- const uint cSmallZeroRunCode = 17;
- const uint cLargeZeroRunCode = 18;
- const uint cSmallRepeatCode = 19;
- const uint cLargeRepeatCode = 20;
-
- const uint cMinSmallZeroRunSize = 3;
- const uint cMaxSmallZeroRunSize = 10;
- const uint cMinLargeZeroRunSize = 11;
- const uint cMaxLargeZeroRunSize = 138;
-
- const uint cSmallMinNonZeroRunSize = 3;
- const uint cSmallMaxNonZeroRunSize = 6;
- const uint cLargeMinNonZeroRunSize = 7;
- const uint cLargeMaxNonZeroRunSize = 70;
-
- const uint cSmallZeroRunExtraBits = 3;
- const uint cLargeZeroRunExtraBits = 7;
- const uint cSmallNonZeroRunExtraBits = 2;
- const uint cLargeNonZeroRunExtraBits = 6;
-
- static const uint8 g_most_probable_codelength_codes[] =
- {
- cSmallZeroRunCode, cLargeZeroRunCode,
- cSmallRepeatCode, cLargeRepeatCode,
-
- 0, 8,
- 7, 9,
- 6, 10,
- 5, 11,
- 4, 12,
- 3, 13,
- 2, 14,
- 1, 15,
- 16
- };
- const uint cNumMostProbableCodelengthCodes = sizeof(g_most_probable_codelength_codes) / sizeof(g_most_probable_codelength_codes[0]);
-
- static inline void end_zero_run(uint& size, crnlib::vector<uint16>& codes)
- {
- if (!size)
- return;
-
- if (size < cMinSmallZeroRunSize)
- {
- while (size--)
- codes.push_back(0);
- }
- else if (size <= cMaxSmallZeroRunSize)
- codes.push_back( static_cast<uint16>(cSmallZeroRunCode | ((size - cMinSmallZeroRunSize) << 8)) );
- else
- {
- CRNLIB_ASSERT((size >= cMinLargeZeroRunSize) && (size <= cMaxLargeZeroRunSize));
- codes.push_back( static_cast<uint16>(cLargeZeroRunCode | ((size - cMinLargeZeroRunSize) << 8)) );
- }
-
- size = 0;
- }
-
- static inline void end_nonzero_run(uint& size, uint len, crnlib::vector<uint16>& codes)
- {
- if (!size)
- return;
-
- if (size < cSmallMinNonZeroRunSize)
- {
- while (size--)
- codes.push_back(static_cast<uint16>(len));
- }
- else if (size <= cSmallMaxNonZeroRunSize)
- {
- codes.push_back(static_cast<uint16>(cSmallRepeatCode | ((size - cSmallMinNonZeroRunSize) << 8)));
- }
- else
- {
- CRNLIB_ASSERT((size >= cLargeMinNonZeroRunSize) && (size <= cLargeMaxNonZeroRunSize));
- codes.push_back(static_cast<uint16>(cLargeRepeatCode | ((size - cLargeMinNonZeroRunSize) << 8)));
- }
-
- size = 0;
- }
-
- uint symbol_codec::encode_transmit_static_huffman_data_model(static_huffman_data_model& model, bool simulate = false, static_huffman_data_model* pDeltaModel )
- {
- CRNLIB_ASSERT(m_mode == cEncoding);
-
- uint total_used_syms = 0;
- for (uint i = model.m_total_syms; i > 0; i--)
- {
- if (model.m_code_sizes[i - 1])
- {
- total_used_syms = i;
- break;
- }
- }
-
- if (!total_used_syms)
- {
- if (!simulate)
- {
- encode_bits(0, math::total_bits(prefix_coding::cMaxSupportedSyms));
- }
-
- return math::total_bits(prefix_coding::cMaxSupportedSyms);
- }
-
- crnlib::vector<uint16> codes;
- codes.reserve(model.m_total_syms);
-
- uint prev_len = UINT_MAX;
- uint cur_zero_run_size = 0;
- uint cur_nonzero_run_size = 0;
-
- const uint8* pCodesizes = &model.m_code_sizes[0];
-
- crnlib::vector<uint8> delta_code_sizes;
- if ((pDeltaModel) && (pDeltaModel->get_total_syms()))
- {
- if (pDeltaModel->m_code_sizes.size() < total_used_syms)
- return 0;
-
- delta_code_sizes.resize(total_used_syms);
- for (uint i = 0; i < total_used_syms; i++)
- {
- int delta = (int)model.m_code_sizes[i] - (int)pDeltaModel->m_code_sizes[i];
- if (delta < 0)
- delta += 17;
- delta_code_sizes[i] = static_cast<uint8>(delta);
- }
-
- pCodesizes = delta_code_sizes.get_ptr();
- }
-
- for (uint i = 0; i <= total_used_syms; i++)
- {
- const uint len = (i < total_used_syms) ? *pCodesizes++ : 0xFF;
- CRNLIB_ASSERT((len == 0xFF) || (len <= prefix_coding::cMaxExpectedCodeSize));
-
- if (!len)
- {
- end_nonzero_run(cur_nonzero_run_size, prev_len, codes);
-
- if (++cur_zero_run_size == cMaxLargeZeroRunSize)
- end_zero_run(cur_zero_run_size, codes);
- }
- else
- {
- end_zero_run(cur_zero_run_size, codes);
-
- if (len != prev_len)
- {
- end_nonzero_run(cur_nonzero_run_size, prev_len, codes);
-
- if (len != 0xFF)
- codes.push_back(static_cast<uint16>(len));
- }
- else if (++cur_nonzero_run_size == cLargeMaxNonZeroRunSize)
- end_nonzero_run(cur_nonzero_run_size, prev_len, codes);
- }
-
- prev_len = len;
- }
-
- uint16 hist[cMaxCodelengthCodes];
- utils::zero_object(hist);
-
- for (uint i = 0; i < codes.size(); i++)
- {
- uint code = codes[i] & 0xFF;
- CRNLIB_ASSERT(code < cMaxCodelengthCodes);
- hist[code] = static_cast<uint16>(hist[code] + 1);
- }
-
- static_huffman_data_model dm;
- if (!dm.init(true, cMaxCodelengthCodes, hist, 7))
- return 0;
-
- uint num_codelength_codes_to_send;
- for (num_codelength_codes_to_send = cNumMostProbableCodelengthCodes; num_codelength_codes_to_send > 0; num_codelength_codes_to_send--)
- if (dm.get_cost(g_most_probable_codelength_codes[num_codelength_codes_to_send - 1]))
- break;
-
- uint total_bits = math::total_bits(prefix_coding::cMaxSupportedSyms);
- total_bits += 5;
- total_bits += 3 * num_codelength_codes_to_send;
-
- if (!simulate)
- {
- encode_bits(total_used_syms, math::total_bits(prefix_coding::cMaxSupportedSyms));
-
- encode_bits(num_codelength_codes_to_send, 5);
- for (uint i = 0; i < num_codelength_codes_to_send; i++)
- encode_bits(dm.get_cost(g_most_probable_codelength_codes[i]), 3);
- }
-
- for (uint i = 0; i < codes.size(); i++)
- {
- uint code = codes[i];
- uint extra = code >> 8;
- code &= 0xFF;
-
- uint extra_bits = 0;
- if (code == cSmallZeroRunCode)
- extra_bits = cSmallZeroRunExtraBits;
- else if (code == cLargeZeroRunCode)
- extra_bits = cLargeZeroRunExtraBits;
- else if (code == cSmallRepeatCode)
- extra_bits = cSmallNonZeroRunExtraBits;
- else if (code == cLargeRepeatCode)
- extra_bits = cLargeNonZeroRunExtraBits;
-
- total_bits += dm.get_cost(code);
-
- if (!simulate)
- encode(code, dm);
-
- if (extra_bits)
- {
- if (!simulate)
- encode_bits(extra, extra_bits);
-
- total_bits += extra_bits;
- }
- }
-
- return total_bits;
- }
-
- void symbol_codec::encode_bits(uint bits, uint num_bits)
- {
- CRNLIB_ASSERT(m_mode == cEncoding);
-
- if (!num_bits)
- return;
-
- CRNLIB_ASSERT((num_bits == 32) || (bits <= ((1U << num_bits) - 1)));
-
- if (num_bits > 16)
- {
- record_put_bits(bits >> 16, num_bits - 16);
- record_put_bits(bits & 0xFFFF, 16);
- }
- else
- record_put_bits(bits, num_bits);
- }
-
- void symbol_codec::encode_align_to_byte()
- {
- CRNLIB_ASSERT(m_mode == cEncoding);
-
- if (!m_simulate_encoding)
- {
- output_symbol sym;
- sym.m_bits = 0;
- sym.m_num_bits = output_symbol::cAlignToByteSym;
- sym.m_arith_prob0 = 0;
- m_output_syms.push_back(sym);
- }
- else
- {
- // We really don't know how many we're going to write, so just be conservative.
- m_total_bits_written += 7;
- }
- }
-
- void symbol_codec::encode(uint sym, adaptive_huffman_data_model& model)
- {
- CRNLIB_ASSERT(m_mode == cEncoding);
- CRNLIB_ASSERT(model.m_encoding);
-
- record_put_bits(model.m_codes[sym], model.m_code_sizes[sym]);
-
- uint freq = model.m_sym_freq[sym];
- freq++;
- model.m_sym_freq[sym] = static_cast<uint16>(freq);
-
- if (freq == cUINT16_MAX)
- model.rescale();
-
- if (--model.m_symbols_until_update == 0)
- {
- m_total_model_updates++;
- model.update();
- }
- }
-
- void symbol_codec::encode(uint sym, static_huffman_data_model& model)
- {
- CRNLIB_ASSERT(m_mode == cEncoding);
- CRNLIB_ASSERT(model.m_encoding);
-
- CRNLIB_ASSERT(model.m_code_sizes[sym]);
-
- record_put_bits(model.m_codes[sym], model.m_code_sizes[sym]);
- }
-
- void symbol_codec::encode_truncated_binary(uint v, uint n)
- {
- CRNLIB_ASSERT((n >= 2) && (v < n));
-
- uint k = math::floor_log2i(n);
- uint u = (1 << (k + 1)) - n;
-
- if (v < u)
- encode_bits(v, k);
- else
- encode_bits(v + u, k + 1);
- }
-
- uint symbol_codec::encode_truncated_binary_cost(uint v, uint n)
- {
- CRNLIB_ASSERT((n >= 2) && (v < n));
-
- uint k = math::floor_log2i(n);
- uint u = (1 << (k + 1)) - n;
-
- if (v < u)
- return k;
- else
- return k + 1;
- }
-
- void symbol_codec::encode_golomb(uint v, uint m)
- {
- CRNLIB_ASSERT(m > 0);
-
- uint q = v / m;
- uint r = v % m;
-
- while (q > 16)
- {
- encode_bits(0xFFFF, 16);
- q -= 16;
- }
-
- if (q)
- encode_bits( (1 << q) - 1, q);
-
- encode_bits(0, 1);
-
- encode_truncated_binary(r, m);
- }
-
- void symbol_codec::encode_rice(uint v, uint m)
- {
- CRNLIB_ASSERT(m > 0);
-
- uint q = v >> m;
- uint r = v & ((1 << m) - 1);
-
- while (q > 16)
- {
- encode_bits(0xFFFF, 16);
- q -= 16;
- }
-
- if (q)
- encode_bits( (1 << q) - 1, q);
-
- encode_bits(0, 1);
-
- encode_bits(r, m);
- }
-
- uint symbol_codec::encode_rice_get_cost(uint v, uint m)
- {
- CRNLIB_ASSERT(m > 0);
-
- uint q = v >> m;
- //uint r = v & ((1 << m) - 1);
-
- return q + 1 + m;
- }
-
- void symbol_codec::arith_propagate_carry()
- {
- int index = m_arith_output_buf.size() - 1;
- while (index >= 0)
- {
- uint c = m_arith_output_buf[index];
-
- if (c == 0xFF)
- m_arith_output_buf[index] = 0;
- else
- {
- m_arith_output_buf[index]++;
- break;
- }
-
- index--;
- }
- }
-
- void symbol_codec::arith_renorm_enc_interval()
- {
- do
- {
- m_arith_output_buf.push_back( (m_arith_base >> 24) & 0xFF );
- m_total_bits_written += 8;
-
- m_arith_base <<= 8;
- } while ((m_arith_length <<= 8) < cSymbolCodecArithMinLen);
- }
-
- void symbol_codec::arith_start_encoding()
- {
- m_arith_output_buf.resize(0);
-
- m_arith_base = 0;
- m_arith_value = 0;
- m_arith_length = cSymbolCodecArithMaxLen;
- m_arith_total_bits = 0;
- }
-
- void symbol_codec::encode(uint bit, adaptive_bit_model& model, bool update_model)
- {
- CRNLIB_ASSERT(m_mode == cEncoding);
-
- m_arith_total_bits++;
-
- if (!m_simulate_encoding)
- {
- output_symbol sym;
- sym.m_bits = bit;
- sym.m_num_bits = -1;
- sym.m_arith_prob0 = model.m_bit_0_prob;
- m_output_syms.push_back(sym);
- }
-
- //uint x = gArithProbMulTab[model.m_bit_0_prob >> (cSymbolCodecArithProbBits - cSymbolCodecArithProbMulBits)][m_arith_length >> (32 - cSymbolCodecArithProbMulLenSigBits)] << 16;
- uint x = model.m_bit_0_prob * (m_arith_length >> cSymbolCodecArithProbBits);
-
- if (!bit)
- {
- if (update_model)
- model.m_bit_0_prob += ((cSymbolCodecArithProbScale - model.m_bit_0_prob) >> cSymbolCodecArithProbMoveBits);
-
- m_arith_length = x;
- }
- else
- {
- if (update_model)
- model.m_bit_0_prob -= (model.m_bit_0_prob >> cSymbolCodecArithProbMoveBits);
-
- uint orig_base = m_arith_base;
- m_arith_base += x;
- m_arith_length -= x;
- if (orig_base > m_arith_base)
- arith_propagate_carry();
- }
-
- if (m_arith_length < cSymbolCodecArithMinLen)
- arith_renorm_enc_interval();
- }
-
- void symbol_codec::encode(uint sym, adaptive_arith_data_model& model)
- {
- uint node = 1;
-
- uint bitmask = model.m_total_syms;
-
- do
- {
- bitmask >>= 1;
-
- uint bit = (sym & bitmask) ? 1 : 0;
- encode(bit, model.m_probs[node]);
- node = (node << 1) + bit;
-
- } while (bitmask > 1);
- }
-
- void symbol_codec::arith_stop_encoding()
- {
- if (!m_arith_total_bits)
- return;
-
- uint orig_base = m_arith_base;
-
- if (m_arith_length > 2 * cSymbolCodecArithMinLen)
- {
- m_arith_base += cSymbolCodecArithMinLen;
- m_arith_length = (cSymbolCodecArithMinLen >> 1);
- }
- else
- {
- m_arith_base += (cSymbolCodecArithMinLen >> 1);
- m_arith_length = (cSymbolCodecArithMinLen >> 9);
- }
-
- if (orig_base > m_arith_base)
- arith_propagate_carry();
-
- arith_renorm_enc_interval();
-
- while (m_arith_output_buf.size() < 4)
- {
- m_arith_output_buf.push_back(0);
- m_total_bits_written += 8;
- }
- }
-
- void symbol_codec::stop_encoding(bool support_arith)
- {
- CRNLIB_ASSERT(m_mode == cEncoding);
-
- arith_stop_encoding();
-
- if (!m_simulate_encoding)
- assemble_output_buf(support_arith);
-
- m_mode = cNull;
- }
-
- void symbol_codec::record_put_bits(uint bits, uint num_bits)
- {
- CRNLIB_ASSERT(m_mode == cEncoding);
-
- CRNLIB_ASSERT(num_bits <= 25);
- CRNLIB_ASSERT(m_bit_count >= 25);
-
- if (!num_bits)
- return;
-
- m_total_bits_written += num_bits;
-
- if (!m_simulate_encoding)
- {
- output_symbol sym;
- sym.m_bits = bits;
- sym.m_num_bits = (uint16)num_bits;
- sym.m_arith_prob0 = 0;
- m_output_syms.push_back(sym);
- }
- }
-
- void symbol_codec::put_bits_init(uint expected_size)
- {
- m_bit_buf = 0;
- m_bit_count = cBitBufSize;
-
- m_output_buf.resize(0);
- m_output_buf.reserve(expected_size);
- }
-
- void symbol_codec::put_bits(uint bits, uint num_bits)
- {
- CRNLIB_ASSERT(num_bits <= 25);
- CRNLIB_ASSERT(m_bit_count >= 25);
-
- if (!num_bits)
- return;
-
- m_bit_count -= num_bits;
- m_bit_buf |= (static_cast<bit_buf_t>(bits) << m_bit_count);
-
- m_total_bits_written += num_bits;
-
- while (m_bit_count <= (cBitBufSize - 8))
- {
- m_output_buf.push_back(static_cast<uint8>(m_bit_buf >> (cBitBufSize - 8)));
-
- m_bit_buf <<= 8;
- m_bit_count += 8;
- }
- }
-
- void symbol_codec::put_bits_align_to_byte()
- {
- uint num_bits_in = cBitBufSize - m_bit_count;
- if (num_bits_in & 7)
- {
- put_bits(0, 8 - (num_bits_in & 7));
- }
- }
-
- void symbol_codec::flush_bits()
- {
- //put_bits(15, 4); // for table look-ahead
- //put_bits(3, 3); // for table look-ahead
-
- put_bits(0, 7); // to ensure the last bits are flushed
- }
-
- void symbol_codec::assemble_output_buf(bool support_arith)
- {
- m_total_bits_written = 0;
-
- uint arith_buf_ofs = 0;
-
- if (support_arith)
- {
- if (m_arith_output_buf.size())
- {
- put_bits(1, 1);
-
- m_arith_length = cSymbolCodecArithMaxLen;
- m_arith_value = 0;
- for (uint i = 0; i < 4; i++)
- {
- const uint c = m_arith_output_buf[arith_buf_ofs++];
- m_arith_value = (m_arith_value << 8) | c;
- put_bits(c, 8);
- }
- }
- else
- {
- put_bits(0, 1);
- }
- }
-
- for (uint sym_index = 0; sym_index < m_output_syms.size(); sym_index++)
- {
- const output_symbol& sym = m_output_syms[sym_index];
-
- if (sym.m_num_bits == output_symbol::cAlignToByteSym)
- {
- put_bits_align_to_byte();
- }
- else if (sym.m_num_bits == output_symbol::cArithSym)
- {
- if (m_arith_length < cSymbolCodecArithMinLen)
- {
- do
- {
- const uint c = (arith_buf_ofs < m_arith_output_buf.size()) ? m_arith_output_buf[arith_buf_ofs++] : 0;
- put_bits(c, 8);
- m_arith_value = (m_arith_value << 8) | c;
- } while ((m_arith_length <<= 8) < cSymbolCodecArithMinLen);
- }
-
- //uint x = gArithProbMulTab[sym.m_arith_prob0 >> (cSymbolCodecArithProbBits - cSymbolCodecArithProbMulBits)][m_arith_length >> (32 - cSymbolCodecArithProbMulLenSigBits)] << 16;
- uint x = sym.m_arith_prob0 * (m_arith_length >> cSymbolCodecArithProbBits);
- uint bit = (m_arith_value >= x);
-
- if (bit == 0)
- {
- m_arith_length = x;
- }
- else
- {
- m_arith_value -= x;
- m_arith_length -= x;
- }
-
- CRNLIB_VERIFY(bit == sym.m_bits);
- }
- else
- {
- put_bits(sym.m_bits, sym.m_num_bits);
- }
- }
-
- flush_bits();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- // Decoding
- //------------------------------------------------------------------------------------------------------------------
-
- bool symbol_codec::start_decoding(const uint8* pBuf, size_t buf_size, bool eof_flag, need_bytes_func_ptr pNeed_bytes_func, void *pPrivate_data)
- {
- if (!buf_size)
- return false;
-
- m_total_model_updates = 0;
-
- m_pDecode_buf = pBuf;
- m_pDecode_buf_next = pBuf;
- m_decode_buf_size = buf_size;
- m_pDecode_buf_end = pBuf + buf_size;
-
- m_pDecode_need_bytes_func = pNeed_bytes_func;
- m_pDecode_private_data = pPrivate_data;
- m_decode_buf_eof = eof_flag;
- if (!pNeed_bytes_func)
- {
- m_decode_buf_eof = true;
- }
-
- m_mode = cDecoding;
-
- get_bits_init();
-
- return true;
- }
-
- uint symbol_codec::decode_bits(uint num_bits)
- {
- CRNLIB_ASSERT(m_mode == cDecoding);
-
- if (!num_bits)
- return 0;
-
- if (num_bits > 16)
- {
- uint a = get_bits(num_bits - 16);
- uint b = get_bits(16);
-
- return (a << 16) | b;
- }
- else
- return get_bits(num_bits);
- }
-
- void symbol_codec::decode_remove_bits(uint num_bits)
- {
- CRNLIB_ASSERT(m_mode == cDecoding);
-
- while (num_bits > 16)
- {
- remove_bits(16);
- num_bits -= 16;
- }
-
- remove_bits(num_bits);
- }
-
- uint symbol_codec::decode_peek_bits(uint num_bits)
- {
- CRNLIB_ASSERT(m_mode == cDecoding);
- CRNLIB_ASSERT(num_bits <= 25);
-
- if (!num_bits)
- return 0;
-
- while (m_bit_count < (int)num_bits)
- {
- uint c = 0;
- if (m_pDecode_buf_next == m_pDecode_buf_end)
- {
- if (!m_decode_buf_eof)
- {
- m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof);
- m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size;
- m_pDecode_buf_next = m_pDecode_buf;
- if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++;
- }
- }
- else
- c = *m_pDecode_buf_next++;
-
- m_bit_count += 8;
- CRNLIB_ASSERT(m_bit_count <= cBitBufSize);
-
- m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count));
- }
-
- return static_cast<uint>(m_bit_buf >> (cBitBufSize - num_bits));
- }
-
- uint symbol_codec::decode(adaptive_huffman_data_model& model)
- {
- CRNLIB_ASSERT(m_mode == cDecoding);
- CRNLIB_ASSERT(!model.m_encoding);
-
- const prefix_coding::decoder_tables* pTables = model.m_pDecode_tables;
-
- while (m_bit_count < (cBitBufSize - 8))
- {
- uint c = 0;
- if (m_pDecode_buf_next == m_pDecode_buf_end)
- {
- if (!m_decode_buf_eof)
- {
- m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof);
- m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size;
- m_pDecode_buf_next = m_pDecode_buf;
- if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++;
- }
- }
- else
- c = *m_pDecode_buf_next++;
-
- m_bit_count += 8;
- m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count));
- }
-
- uint k = static_cast<uint>((m_bit_buf >> (cBitBufSize - 16)) + 1);
- uint sym, len;
-
- if (k <= pTables->m_table_max_code)
- {
- uint32 t = pTables->m_lookup[m_bit_buf >> (cBitBufSize - pTables->m_table_bits)];
-
- CRNLIB_ASSERT(t != cUINT32_MAX);
- sym = t & cUINT16_MAX;
- len = t >> 16;
-
- CRNLIB_ASSERT(model.m_code_sizes[sym] == len);
- }
- else
- {
- len = pTables->m_decode_start_code_size;
-
- for ( ; ; )
- {
- if (k <= pTables->m_max_codes[len - 1])
- break;
- len++;
- }
-
- int val_ptr = pTables->m_val_ptrs[len - 1] + static_cast<int>((m_bit_buf >> (cBitBufSize - len)));
-
- if (((uint)val_ptr >= model.m_total_syms))
- {
- // corrupted stream, or a bug
- CRNLIB_ASSERT(0);
- return 0;
- }
-
- sym = pTables->m_sorted_symbol_order[val_ptr];
- }
-
- m_bit_buf <<= len;
- m_bit_count -= len;
-
- uint freq = model.m_sym_freq[sym];
- freq++;
- model.m_sym_freq[sym] = static_cast<uint16>(freq);
-
- if (freq == cUINT16_MAX)
- model.rescale();
-
- if (--model.m_symbols_until_update == 0)
- {
- m_total_model_updates++;
- model.update();
- }
-
- return sym;
- }
-
- void symbol_codec::decode_set_input_buffer(const uint8* pBuf, size_t buf_size, const uint8* pBuf_next, bool eof_flag)
- {
- CRNLIB_ASSERT(m_mode == cDecoding);
-
- m_pDecode_buf = pBuf;
- m_pDecode_buf_next = pBuf_next;
- m_decode_buf_size = buf_size;
- m_pDecode_buf_end = pBuf + buf_size;
-
- if (!m_pDecode_need_bytes_func)
- m_decode_buf_eof = true;
- else
- m_decode_buf_eof = eof_flag;
- }
-
- bool symbol_codec::decode_receive_static_huffman_data_model(static_huffman_data_model& model, static_huffman_data_model* pDeltaModel)
- {
- CRNLIB_ASSERT(m_mode == cDecoding);
-
- const uint total_used_syms = decode_bits(math::total_bits(prefix_coding::cMaxSupportedSyms));
- if (!total_used_syms)
- {
- model.clear();
- return true;
- }
-
- model.m_code_sizes.resize(total_used_syms);
- memset(&model.m_code_sizes[0], 0, sizeof(model.m_code_sizes[0]) * total_used_syms);
-
- const uint num_codelength_codes_to_send = decode_bits(5);
- if ((num_codelength_codes_to_send < 1) || (num_codelength_codes_to_send > cMaxCodelengthCodes))
- return false;
-
- static_huffman_data_model dm;
- dm.m_code_sizes.resize(cMaxCodelengthCodes);
-
- for (uint i = 0; i < num_codelength_codes_to_send; i++)
- dm.m_code_sizes[g_most_probable_codelength_codes[i]] = static_cast<uint8>(decode_bits(3));
-
- if (!dm.prepare_decoder_tables())
- return false;
-
- uint ofs = 0;
- while (ofs < total_used_syms)
- {
- const uint num_remaining = total_used_syms - ofs;
-
- uint code = decode(dm);
- if (code <= 16)
- model.m_code_sizes[ofs++] = static_cast<uint8>(code);
- else if (code == cSmallZeroRunCode)
- {
- uint len = decode_bits(cSmallZeroRunExtraBits) + cMinSmallZeroRunSize;
- if (len > num_remaining)
- return false;
- ofs += len;
- }
- else if (code == cLargeZeroRunCode)
- {
- uint len = decode_bits(cLargeZeroRunExtraBits) + cMinLargeZeroRunSize;
- if (len > num_remaining)
- return false;
- ofs += len;
- }
- else if ((code == cSmallRepeatCode) || (code == cLargeRepeatCode))
- {
- uint len;
- if (code == cSmallRepeatCode)
- len = decode_bits(cSmallNonZeroRunExtraBits) + cSmallMinNonZeroRunSize;
- else
- len = decode_bits(cLargeNonZeroRunExtraBits) + cLargeMinNonZeroRunSize;
-
- if ((!ofs) || (len > num_remaining))
- return false;
- const uint prev = model.m_code_sizes[ofs - 1];
- if (!prev)
- return false;
- const uint end = ofs + len;
- while (ofs < end)
- model.m_code_sizes[ofs++] = static_cast<uint8>(prev);
- }
- else
- {
- CRNLIB_ASSERT(0);
- return false;
- }
- }
-
- if (ofs != total_used_syms)
- return false;
-
- if ((pDeltaModel) && (pDeltaModel->get_total_syms()))
- {
- uint n = math::minimum(pDeltaModel->m_code_sizes.size(), total_used_syms);
- for (uint i = 0; i < n; i++)
- {
- int codesize = model.m_code_sizes[i] + pDeltaModel->m_code_sizes[i];
- if (codesize > 16)
- codesize -= 17;
- model.m_code_sizes[i] = static_cast<uint8>(codesize);
- }
- }
-
- return model.prepare_decoder_tables();
- }
-
- uint symbol_codec::decode(static_huffman_data_model& model)
- {
- CRNLIB_ASSERT(m_mode == cDecoding);
- CRNLIB_ASSERT(!model.m_encoding);
-
- const prefix_coding::decoder_tables* pTables = model.m_pDecode_tables;
-
- while (m_bit_count < (cBitBufSize - 8))
- {
- uint c = 0;
- if (m_pDecode_buf_next == m_pDecode_buf_end)
- {
- if (!m_decode_buf_eof)
- {
- m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof);
- m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size;
- m_pDecode_buf_next = m_pDecode_buf;
- if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++;
- }
- }
- else
- c = *m_pDecode_buf_next++;
-
- m_bit_count += 8;
- m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count));
- }
-
- uint k = static_cast<uint>((m_bit_buf >> (cBitBufSize - 16)) + 1);
- uint sym, len;
-
- if (k <= pTables->m_table_max_code)
- {
- uint32 t = pTables->m_lookup[m_bit_buf >> (cBitBufSize - pTables->m_table_bits)];
-
- CRNLIB_ASSERT(t != cUINT32_MAX);
- sym = t & cUINT16_MAX;
- len = t >> 16;
-
- CRNLIB_ASSERT(model.m_code_sizes[sym] == len);
- }
- else
- {
- len = pTables->m_decode_start_code_size;
-
- for ( ; ; )
- {
- if (k <= pTables->m_max_codes[len - 1])
- break;
- len++;
- }
-
- int val_ptr = pTables->m_val_ptrs[len - 1] + static_cast<int>((m_bit_buf >> (cBitBufSize - len)));
-
- if (((uint)val_ptr >= model.m_total_syms))
- {
- // corrupted stream, or a bug
- CRNLIB_ASSERT(0);
- return 0;
- }
-
- sym = pTables->m_sorted_symbol_order[val_ptr];
- }
-
- m_bit_buf <<= len;
- m_bit_count -= len;
-
- return sym;
- }
-
- uint symbol_codec::decode_truncated_binary(uint n)
- {
- CRNLIB_ASSERT(n >= 2);
-
- uint k = math::floor_log2i(n);
- uint u = (1 << (k + 1)) - n;
-
- uint i = decode_bits(k);
-
- if (i >= u)
- i = ((i << 1) | decode_bits(1)) - u;
-
- return i;
- }
-
- uint symbol_codec::decode_golomb(uint m)
- {
- CRNLIB_ASSERT(m > 1);
-
- uint q = 0;
-
- for ( ; ; )
- {
- uint k = decode_peek_bits(16);
-
- uint l = utils::count_leading_zeros16((~k) & 0xFFFF);
- q += l;
- if (l < 16)
- break;
- }
-
- decode_remove_bits(q + 1);
-
- uint r = decode_truncated_binary(m);
-
- return (q * m) + r;
- }
-
- uint symbol_codec::decode_rice(uint m)
- {
- CRNLIB_ASSERT(m > 0);
-
- uint q = 0;
-
- for ( ; ; )
- {
- uint k = decode_peek_bits(16);
-
- uint l = utils::count_leading_zeros16((~k) & 0xFFFF);
-
- q += l;
-
- decode_remove_bits(l);
-
- if (l < 16)
- break;
- }
-
- decode_remove_bits(1);
-
- uint r = decode_bits(m);
-
- return (q << m) + r;
- }
-
- uint64 symbol_codec::stop_decoding()
- {
- CRNLIB_ASSERT(m_mode == cDecoding);
-
- uint64 n = m_pDecode_buf_next - m_pDecode_buf;
-
- m_mode = cNull;
-
- return n;
- }
-
- void symbol_codec::get_bits_init()
- {
- m_bit_buf = 0;
- m_bit_count = 0;
- }
-
- uint symbol_codec::get_bits(uint num_bits)
- {
- CRNLIB_ASSERT(num_bits <= 25);
-
- if (!num_bits)
- return 0;
-
- while (m_bit_count < (int)num_bits)
- {
- uint c = 0;
- if (m_pDecode_buf_next == m_pDecode_buf_end)
- {
- if (!m_decode_buf_eof)
- {
- m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof);
- m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size;
- m_pDecode_buf_next = m_pDecode_buf;
- if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++;
- }
- }
- else
- c = *m_pDecode_buf_next++;
-
- m_bit_count += 8;
- CRNLIB_ASSERT(m_bit_count <= cBitBufSize);
-
- m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count));
- }
-
- uint result = static_cast<uint>(m_bit_buf >> (cBitBufSize - num_bits));
-
- m_bit_buf <<= num_bits;
- m_bit_count -= num_bits;
-
- return result;
- }
-
- void symbol_codec::remove_bits(uint num_bits)
- {
- CRNLIB_ASSERT(num_bits <= 25);
-
- if (!num_bits)
- return;
-
- while (m_bit_count < (int)num_bits)
- {
- uint c = 0;
- if (m_pDecode_buf_next == m_pDecode_buf_end)
- {
- if (!m_decode_buf_eof)
- {
- m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof);
- m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size;
- m_pDecode_buf_next = m_pDecode_buf;
- if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++;
- }
- }
- else
- c = *m_pDecode_buf_next++;
-
- m_bit_count += 8;
- CRNLIB_ASSERT(m_bit_count <= cBitBufSize);
-
- m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count));
- }
-
- m_bit_buf <<= num_bits;
- m_bit_count -= num_bits;
- }
-
- void symbol_codec::decode_align_to_byte()
- {
- CRNLIB_ASSERT(m_mode == cDecoding);
-
- if (m_bit_count & 7)
- {
- remove_bits(m_bit_count & 7);
- }
- }
-
- int symbol_codec::decode_remove_byte_from_bit_buf()
- {
- if (m_bit_count < 8)
- return -1;
- int result = static_cast<int>(m_bit_buf >> (cBitBufSize - 8));
- m_bit_buf <<= 8;
- m_bit_count -= 8;
- return result;
- }
-
- uint symbol_codec::decode(adaptive_bit_model& model, bool update_model)
- {
- if (m_arith_length < cSymbolCodecArithMinLen)
- {
- uint c = get_bits(8);
- m_arith_value = (m_arith_value << 8) | c;
-
- m_arith_length <<= 8;
- CRNLIB_ASSERT(m_arith_length >= cSymbolCodecArithMinLen);
- }
-
- CRNLIB_ASSERT(m_arith_length >= cSymbolCodecArithMinLen);
-
- //uint x = gArithProbMulTab[model.m_bit_0_prob >> (cSymbolCodecArithProbBits - cSymbolCodecArithProbMulBits)][m_arith_length >> (32 - cSymbolCodecArithProbMulLenSigBits)] << 16;
- uint x = model.m_bit_0_prob * (m_arith_length >> cSymbolCodecArithProbBits);
- uint bit = (m_arith_value >= x);
-
- if (!bit)
- {
- if (update_model)
- model.m_bit_0_prob += ((cSymbolCodecArithProbScale - model.m_bit_0_prob) >> cSymbolCodecArithProbMoveBits);
-
- m_arith_length = x;
- }
- else
- {
- if (update_model)
- model.m_bit_0_prob -= (model.m_bit_0_prob >> cSymbolCodecArithProbMoveBits);
-
- m_arith_value -= x;
- m_arith_length -= x;
- }
-
- return bit;
- }
-
- uint symbol_codec::decode(adaptive_arith_data_model& model)
- {
- uint node = 1;
-
- do
- {
- uint bit = decode(model.m_probs[node]);
-
- node = (node << 1) + bit;
-
- } while (node < model.m_total_syms);
-
- return node - model.m_total_syms;
- }
-
- void symbol_codec::start_arith_decoding()
- {
- CRNLIB_ASSERT(m_mode == cDecoding);
-
- m_arith_length = cSymbolCodecArithMaxLen;
- m_arith_value = 0;
-
- if (get_bits(1))
- {
- m_arith_value = (get_bits(8) << 24);
- m_arith_value |= (get_bits(8) << 16);
- m_arith_value |= (get_bits(8) << 8);
- m_arith_value |= get_bits(8);
- }
- }
-
- void symbol_codec::decode_need_bytes()
- {
- if (!m_decode_buf_eof)
- {
- m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof);
- m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size;
- m_pDecode_buf_next = m_pDecode_buf;
- }
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_symbol_codec.h b/Libraries/crunch-ea9b8d/crnlib/crn_symbol_codec.h
deleted file mode 100644
index 11ef4585..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_symbol_codec.h
+++ /dev/null
@@ -1,519 +0,0 @@
-// File: crn_symbol_codec.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_prefix_coding.h"
-
-namespace crnlib
-{
- class symbol_codec;
- class adaptive_arith_data_model;
-
- const uint cSymbolCodecArithMinLen = 0x01000000U;
- const uint cSymbolCodecArithMaxLen = 0xFFFFFFFFU;
-
- const uint cSymbolCodecArithProbBits = 11;
- const uint cSymbolCodecArithProbScale = 1 << cSymbolCodecArithProbBits;
- const uint cSymbolCodecArithProbMoveBits = 5;
-
- const uint cSymbolCodecArithProbMulBits = 8;
- const uint cSymbolCodecArithProbMulScale = 1 << cSymbolCodecArithProbMulBits;
-
- class symbol_histogram
- {
- public:
- inline symbol_histogram(uint size = 0) : m_hist(size) { }
-
- inline void clear() { m_hist.clear(); }
-
- inline uint size() const { return static_cast<uint>(m_hist.size()); }
-
- inline void inc_freq(uint x, uint amount = 1)
- {
- uint h = m_hist[x];
- CRNLIB_ASSERT( amount <= (0xFFFFFFFF - h) );
- m_hist[x] = h + amount;
- }
-
- inline void set_all(uint val) { for (uint i = 0; i < m_hist.size(); i++) m_hist[i] = val; }
-
- inline void resize(uint new_size) { m_hist.resize(new_size); }
-
- inline const uint* get_ptr() const { return m_hist.empty() ? NULL : &m_hist.front(); }
-
- double calc_entropy() const;
-
- uint operator[] (uint i) const { return m_hist[i]; }
- uint& operator[] (uint i) { return m_hist[i]; }
-
- uint64 get_total() const;
-
- private:
- crnlib::vector<uint> m_hist;
- };
-
- class adaptive_huffman_data_model
- {
- public:
- adaptive_huffman_data_model(bool encoding = true, uint total_syms = 0);
- adaptive_huffman_data_model(const adaptive_huffman_data_model& other);
- ~adaptive_huffman_data_model();
-
- adaptive_huffman_data_model& operator= (const adaptive_huffman_data_model& rhs);
-
- void clear();
-
- void init(bool encoding, uint total_syms);
- void reset();
-
- void rescale();
-
- uint get_total_syms() const { return m_total_syms; }
- uint get_cost(uint sym) const { return m_code_sizes[sym]; }
-
- public:
- uint m_total_syms;
-
- uint m_update_cycle;
- uint m_symbols_until_update;
-
- uint m_total_count;
-
- crnlib::vector<uint16> m_sym_freq;
-
- crnlib::vector<uint16> m_codes;
- crnlib::vector<uint8> m_code_sizes;
-
- prefix_coding::decoder_tables* m_pDecode_tables;
-
- uint8 m_decoder_table_bits;
- bool m_encoding;
-
- void update();
-
- friend class symbol_codec;
- };
-
- class static_huffman_data_model
- {
- public:
- static_huffman_data_model();
- static_huffman_data_model(const static_huffman_data_model& other);
- ~static_huffman_data_model();
-
- static_huffman_data_model& operator= (const static_huffman_data_model& rhs);
-
- void clear();
-
- bool init(bool encoding, uint total_syms, const uint16* pSym_freq, uint code_size_limit);
- bool init(bool encoding, uint total_syms, const uint* pSym_freq, uint code_size_limit);
- bool init(bool encoding, uint total_syms, const uint8* pCode_sizes, uint code_size_limit);
- bool init(bool encoding, const symbol_histogram& hist, uint code_size_limit);
-
- uint get_total_syms() const { return m_total_syms; }
- uint get_cost(uint sym) const { return m_code_sizes[sym]; }
-
- const uint8* get_code_sizes() const { return m_code_sizes.empty() ? NULL : &m_code_sizes[0]; }
-
- private:
- uint m_total_syms;
-
- crnlib::vector<uint16> m_codes;
- crnlib::vector<uint8> m_code_sizes;
-
- prefix_coding::decoder_tables* m_pDecode_tables;
-
- bool m_encoding;
-
- bool prepare_decoder_tables();
- uint compute_decoder_table_bits() const;
-
- friend class symbol_codec;
- };
-
- class adaptive_bit_model
- {
- public:
- adaptive_bit_model();
- adaptive_bit_model(float prob0);
- adaptive_bit_model(const adaptive_bit_model& other);
-
- adaptive_bit_model& operator= (const adaptive_bit_model& rhs);
-
- void clear();
- void set_probability_0(float prob0);
- void update(uint bit);
-
- float get_cost(uint bit) const;
-
- public:
- uint16 m_bit_0_prob;
-
- friend class symbol_codec;
- friend class adaptive_arith_data_model;
- };
-
- class adaptive_arith_data_model
- {
- public:
- adaptive_arith_data_model(bool encoding = true, uint total_syms = 0);
- adaptive_arith_data_model(const adaptive_arith_data_model& other);
- ~adaptive_arith_data_model();
-
- adaptive_arith_data_model& operator= (const adaptive_arith_data_model& rhs);
-
- void clear();
-
- void init(bool encoding, uint total_syms);
- void reset();
-
- uint get_total_syms() const { return m_total_syms; }
- float get_cost(uint sym) const;
-
- private:
- uint m_total_syms;
- typedef crnlib::vector<adaptive_bit_model> adaptive_bit_model_vector;
- adaptive_bit_model_vector m_probs;
-
- friend class symbol_codec;
- };
-
-#if (defined(_XBOX) || defined(_WIN64))
- #define CRNLIB_SYMBOL_CODEC_USE_64_BIT_BUFFER 1
-#else
- #define CRNLIB_SYMBOL_CODEC_USE_64_BIT_BUFFER 0
-#endif
-
- class symbol_codec
- {
- public:
- symbol_codec();
-
- void clear();
-
- // Encoding
- void start_encoding(uint expected_file_size);
- uint encode_transmit_static_huffman_data_model(static_huffman_data_model& model, bool simulate, static_huffman_data_model* pDelta_model = NULL );
- void encode_bits(uint bits, uint num_bits);
- void encode_align_to_byte();
- void encode(uint sym, adaptive_huffman_data_model& model);
- void encode(uint sym, static_huffman_data_model& model);
- void encode_truncated_binary(uint v, uint n);
- static uint encode_truncated_binary_cost(uint v, uint n);
- void encode_golomb(uint v, uint m);
- void encode_rice(uint v, uint m);
- static uint encode_rice_get_cost(uint v, uint m);
- void encode(uint bit, adaptive_bit_model& model, bool update_model = true);
- void encode(uint sym, adaptive_arith_data_model& model);
-
- inline void encode_enable_simulation(bool enabled) { m_simulate_encoding = enabled; }
- inline bool encode_get_simulation() { return m_simulate_encoding; }
- inline uint encode_get_total_bits_written() const { return m_total_bits_written; }
-
- void stop_encoding(bool support_arith);
-
- const crnlib::vector<uint8>& get_encoding_buf() const { return m_output_buf; }
- crnlib::vector<uint8>& get_encoding_buf() { return m_output_buf; }
-
- // Decoding
-
- typedef void (*need_bytes_func_ptr)(size_t num_bytes_consumed, void *pPrivate_data, const uint8* &pBuf, size_t &buf_size, bool &eof_flag);
-
- bool start_decoding(const uint8* pBuf, size_t buf_size, bool eof_flag = true, need_bytes_func_ptr pNeed_bytes_func = NULL, void *pPrivate_data = NULL);
- void decode_set_input_buffer(const uint8* pBuf, size_t buf_size, const uint8* pBuf_next, bool eof_flag = true);
- inline uint64 decode_get_bytes_consumed() const { return m_pDecode_buf_next - m_pDecode_buf; }
- inline uint64 decode_get_bits_remaining() const { return ((m_pDecode_buf_end - m_pDecode_buf_next) << 3) + m_bit_count; }
- void start_arith_decoding();
- bool decode_receive_static_huffman_data_model(static_huffman_data_model& model, static_huffman_data_model* pDeltaModel);
- uint decode_bits(uint num_bits);
- uint decode_peek_bits(uint num_bits);
- void decode_remove_bits(uint num_bits);
- void decode_align_to_byte();
- int decode_remove_byte_from_bit_buf();
- uint decode(adaptive_huffman_data_model& model);
- uint decode(static_huffman_data_model& model);
- uint decode_truncated_binary(uint n);
- uint decode_golomb(uint m);
- uint decode_rice(uint m);
- uint decode(adaptive_bit_model& model, bool update_model = true);
- uint decode(adaptive_arith_data_model& model);
- uint64 stop_decoding();
-
- uint get_total_model_updates() const { return m_total_model_updates; }
-
- public:
- const uint8* m_pDecode_buf;
- const uint8* m_pDecode_buf_next;
- const uint8* m_pDecode_buf_end;
- size_t m_decode_buf_size;
- bool m_decode_buf_eof;
-
- need_bytes_func_ptr m_pDecode_need_bytes_func;
- void* m_pDecode_private_data;
-
-#if CRNLIB_SYMBOL_CODEC_USE_64_BIT_BUFFER
- typedef uint64 bit_buf_t;
- enum { cBitBufSize = 64 };
-#else
- typedef uint32 bit_buf_t;
- enum { cBitBufSize = 32 };
-#endif
-
- bit_buf_t m_bit_buf;
- int m_bit_count;
-
- uint m_total_model_updates;
-
- crnlib::vector<uint8> m_output_buf;
- crnlib::vector<uint8> m_arith_output_buf;
-
- struct output_symbol
- {
- uint m_bits;
-
- enum { cArithSym = -1, cAlignToByteSym = -2 };
- int16 m_num_bits;
-
- uint16 m_arith_prob0;
- };
- crnlib::vector<output_symbol> m_output_syms;
-
- uint m_total_bits_written;
- bool m_simulate_encoding;
-
- uint m_arith_base;
- uint m_arith_value;
- uint m_arith_length;
- uint m_arith_total_bits;
-
- bool m_support_arith;
-
- void put_bits_init(uint expected_size);
- void record_put_bits(uint bits, uint num_bits);
-
- void arith_propagate_carry();
- void arith_renorm_enc_interval();
- void arith_start_encoding();
- void arith_stop_encoding();
-
- void put_bits(uint bits, uint num_bits);
- void put_bits_align_to_byte();
- void flush_bits();
- void assemble_output_buf(bool support_arith);
-
- void get_bits_init();
- uint get_bits(uint num_bits);
- void remove_bits(uint num_bits);
-
- void decode_need_bytes();
-
- enum
- {
- cNull,
- cEncoding,
- cDecoding
- } m_mode;
- };
-
-#define CRNLIB_SYMBOL_CODEC_USE_MACROS 1
-
-#ifdef _XBOX
- #define CRNLIB_READ_BIG_ENDIAN_UINT32(p) *reinterpret_cast<const uint32*>(p)
-#elif defined(_MSC_VER)
- #define CRNLIB_READ_BIG_ENDIAN_UINT32(p) _byteswap_ulong(*reinterpret_cast<const uint32*>(p))
-#else
- #define CRNLIB_READ_BIG_ENDIAN_UINT32(p) utils::swap32(*reinterpret_cast<const uint32*>(p))
-#endif
-
-#if CRNLIB_SYMBOL_CODEC_USE_MACROS
- #define CRNLIB_SYMBOL_CODEC_DECODE_DECLARE(codec) \
- uint arith_value; \
- uint arith_length; \
- symbol_codec::bit_buf_t bit_buf; \
- int bit_count; \
- const uint8* pDecode_buf_next;
-
- #define CRNLIB_SYMBOL_CODEC_DECODE_BEGIN(codec) \
- arith_value = codec.m_arith_value; \
- arith_length = codec.m_arith_length; \
- bit_buf = codec.m_bit_buf; \
- bit_count = codec.m_bit_count; \
- pDecode_buf_next = codec.m_pDecode_buf_next;
-
- #define CRNLIB_SYMBOL_CODEC_DECODE_END(codec) \
- codec.m_arith_value = arith_value; \
- codec.m_arith_length = arith_length; \
- codec.m_bit_buf = bit_buf; \
- codec.m_bit_count = bit_count; \
- codec.m_pDecode_buf_next = pDecode_buf_next;
-
- #define CRNLIB_SYMBOL_CODEC_DECODE_GET_BITS(codec, result, num_bits) \
- { \
- while (bit_count < (int)(num_bits)) \
- { \
- uint c = 0; \
- if (pDecode_buf_next == codec.m_pDecode_buf_end) \
- { \
- CRNLIB_SYMBOL_CODEC_DECODE_END(codec) \
- codec.decode_need_bytes(); \
- CRNLIB_SYMBOL_CODEC_DECODE_BEGIN(codec) \
- if (pDecode_buf_next < codec.m_pDecode_buf_end) c = *pDecode_buf_next++; \
- } \
- else \
- c = *pDecode_buf_next++; \
- bit_count += 8; \
- bit_buf |= (static_cast<symbol_codec::bit_buf_t>(c) << (symbol_codec::cBitBufSize - bit_count)); \
- } \
- result = num_bits ? static_cast<uint>(bit_buf >> (symbol_codec::cBitBufSize - (num_bits))) : 0; \
- bit_buf <<= (num_bits); \
- bit_count -= (num_bits); \
- }
-
- #define CRNLIB_SYMBOL_CODEC_DECODE_ARITH_BIT(codec, result, model) \
- { \
- if (arith_length < cSymbolCodecArithMinLen) \
- { \
- uint c; \
- CRNLIB_SYMBOL_CODEC_DECODE_GET_BITS(codec, c, 8); \
- arith_value = (arith_value << 8) | c; \
- arith_length <<= 8; \
- } \
- uint x = model.m_bit_0_prob * (arith_length >> cSymbolCodecArithProbBits); \
- result = (arith_value >= x); \
- if (!result) \
- { \
- model.m_bit_0_prob += ((cSymbolCodecArithProbScale - model.m_bit_0_prob) >> cSymbolCodecArithProbMoveBits); \
- arith_length = x; \
- } \
- else \
- { \
- model.m_bit_0_prob -= (model.m_bit_0_prob >> cSymbolCodecArithProbMoveBits); \
- arith_value -= x; \
- arith_length -= x; \
- } \
- }
-
-#if CRNLIB_SYMBOL_CODEC_USE_64_BIT_BUFFER
- #define CRNLIB_SYMBOL_CODEC_DECODE_ADAPTIVE_HUFFMAN(codec, result, model) \
- { \
- const prefix_coding::decoder_tables* pTables = model.m_pDecode_tables; \
- if (bit_count < 24) \
- { \
- uint c = 0; \
- pDecode_buf_next += sizeof(uint32); \
- if (pDecode_buf_next >= codec.m_pDecode_buf_end) \
- { \
- pDecode_buf_next -= sizeof(uint32); \
- while (bit_count < 24) \
- { \
- CRNLIB_SYMBOL_CODEC_DECODE_END(codec) \
- codec.decode_need_bytes(); \
- CRNLIB_SYMBOL_CODEC_DECODE_BEGIN(codec) \
- if (pDecode_buf_next < codec.m_pDecode_buf_end) c = *pDecode_buf_next++; \
- bit_count += 8; \
- bit_buf |= (static_cast<symbol_codec::bit_buf_t>(c) << (symbol_codec::cBitBufSize - bit_count)); \
- } \
- } \
- else \
- { \
- c = CRNLIB_READ_BIG_ENDIAN_UINT32(pDecode_buf_next - sizeof(uint32)); \
- bit_count += 32; \
- bit_buf |= (static_cast<symbol_codec::bit_buf_t>(c) << (symbol_codec::cBitBufSize - bit_count)); \
- } \
- } \
- uint k = static_cast<uint>((bit_buf >> (symbol_codec::cBitBufSize - 16)) + 1); \
- uint len; \
- if (k <= pTables->m_table_max_code) \
- { \
- uint32 t = pTables->m_lookup[bit_buf >> (symbol_codec::cBitBufSize - pTables->m_table_bits)]; \
- result = t & UINT16_MAX; \
- len = t >> 16; \
- } \
- else \
- { \
- len = pTables->m_decode_start_code_size; \
- for ( ; ; ) \
- { \
- if (k <= pTables->m_max_codes[len - 1]) \
- break; \
- len++; \
- } \
- int val_ptr = pTables->m_val_ptrs[len - 1] + static_cast<int>(bit_buf >> (symbol_codec::cBitBufSize - len)); \
- if (((uint)val_ptr >= model.m_total_syms)) val_ptr = 0; \
- result = pTables->m_sorted_symbol_order[val_ptr]; \
- } \
- bit_buf <<= len; \
- bit_count -= len; \
- uint freq = model.m_sym_freq[result]; \
- freq++; \
- model.m_sym_freq[result] = static_cast<uint16>(freq); \
- if (freq == UINT16_MAX) model.rescale(); \
- if (--model.m_symbols_until_update == 0) \
- { \
- model.update(); \
- } \
- }
-#else
- #define CRNLIB_SYMBOL_CODEC_DECODE_ADAPTIVE_HUFFMAN(codec, result, model) \
- { \
- const prefix_coding::decoder_tables* pTables = model.m_pDecode_tables; \
- while (bit_count < (symbol_codec::cBitBufSize - 8)) \
- { \
- uint c = 0; \
- if (pDecode_buf_next == codec.m_pDecode_buf_end) \
- { \
- CRNLIB_SYMBOL_CODEC_DECODE_END(codec) \
- codec.decode_need_bytes(); \
- CRNLIB_SYMBOL_CODEC_DECODE_BEGIN(codec) \
- if (pDecode_buf_next < codec.m_pDecode_buf_end) c = *pDecode_buf_next++; \
- } \
- else \
- c = *pDecode_buf_next++; \
- bit_count += 8; \
- bit_buf |= (static_cast<symbol_codec::bit_buf_t>(c) << (symbol_codec::cBitBufSize - bit_count)); \
- } \
- uint k = static_cast<uint>((bit_buf >> (symbol_codec::cBitBufSize - 16)) + 1); \
- uint len; \
- if (k <= pTables->m_table_max_code) \
- { \
- uint32 t = pTables->m_lookup[bit_buf >> (symbol_codec::cBitBufSize - pTables->m_table_bits)]; \
- result = t & UINT16_MAX; \
- len = t >> 16; \
- } \
- else \
- { \
- len = pTables->m_decode_start_code_size; \
- for ( ; ; ) \
- { \
- if (k <= pTables->m_max_codes[len - 1]) \
- break; \
- len++; \
- } \
- int val_ptr = pTables->m_val_ptrs[len - 1] + static_cast<int>(bit_buf >> (symbol_codec::cBitBufSize - len)); \
- if (((uint)val_ptr >= model.m_total_syms)) val_ptr = 0; \
- result = pTables->m_sorted_symbol_order[val_ptr]; \
- } \
- bit_buf <<= len; \
- bit_count -= len; \
- uint freq = model.m_sym_freq[result]; \
- freq++; \
- model.m_sym_freq[result] = static_cast<uint16>(freq); \
- if (freq == UINT16_MAX) model.rescale(); \
- if (--model.m_symbols_until_update == 0) \
- { \
- model.update(); \
- } \
- }
-#endif
-
-#else
- #define CRNLIB_SYMBOL_CODEC_DECODE_DECLARE(codec)
- #define CRNLIB_SYMBOL_CODEC_DECODE_BEGIN(codec)
- #define CRNLIB_SYMBOL_CODEC_DECODE_END(codec)
-
- #define CRNLIB_SYMBOL_CODEC_DECODE_GET_BITS(codec, result, num_bits) result = codec.decode_bits(num_bits);
- #define CRNLIB_SYMBOL_CODEC_DECODE_ARITH_BIT(codec, result, model) result = codec.decode(model);
- #define CRNLIB_SYMBOL_CODEC_DECODE_ADAPTIVE_HUFFMAN(codec, result, model) result = codec.decode(model);
-#endif
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_texture_comp.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_texture_comp.cpp
deleted file mode 100644
index 8423541a..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_texture_comp.cpp
+++ /dev/null
@@ -1,521 +0,0 @@
-// File: crn_texture_comp.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_texture_comp.h"
-#include "crn_dds_comp.h"
-#include "crn_console.h"
-#include "crn_rect.h"
-
-namespace crnlib
-{
- static itexture_comp *create_texture_comp(crn_file_type file_type)
- {
- if (file_type == cCRNFileTypeCRN)
- return crnlib_new<crn_comp>();
- else if (file_type == cCRNFileTypeDDS)
- return crnlib_new<dds_comp>();
- else
- return NULL;
- }
-
- bool create_compressed_texture(const crn_comp_params &params, crnlib::vector<uint8> &comp_data, uint32 *pActual_quality_level, float *pActual_bitrate)
- {
- crn_comp_params local_params(params);
-
- if (pixel_format_helpers::is_crn_format_non_srgb(local_params.m_format))
- {
- if (local_params.get_flag(cCRNCompFlagPerceptual))
- {
- console::info("Output pixel format is swizzled or not RGB, disabling perceptual color metrics");
-
- // Destination compressed pixel format is swizzled or not RGB at all, so be sure perceptual colorspace metrics are disabled.
- local_params.set_flag(cCRNCompFlagPerceptual, false);
- }
- }
-
- if (pActual_quality_level) *pActual_quality_level = 0;
- if (pActual_bitrate) *pActual_bitrate = 0.0f;
-
- comp_data.resize(0);
-
- itexture_comp *pTexture_comp = create_texture_comp(local_params.m_file_type);
- if (!pTexture_comp)
- return false;
-
- if (!pTexture_comp->compress_init(local_params))
- {
- crnlib_delete(pTexture_comp);
- return false;
- }
-
- if ( (local_params.m_target_bitrate <= 0.0f) ||
- (local_params.m_format == cCRNFmtDXT3) ||
- ((local_params.m_file_type == cCRNFileTypeCRN) && ((local_params.m_flags & cCRNCompFlagManualPaletteSizes) != 0))
- )
- {
- if ( (local_params.m_file_type == cCRNFileTypeCRN) ||
- ((local_params.m_file_type == cCRNFileTypeDDS) && (local_params.m_quality_level < cCRNMaxQualityLevel)) )
- {
- console::info("Compressing using quality level %i", local_params.m_quality_level);
- }
- if (local_params.m_format == cCRNFmtDXT3)
- {
- if (local_params.m_file_type == cCRNFileTypeCRN)
- console::warning("CRN format doesn't support DXT3");
- else if ((local_params.m_file_type == cCRNFileTypeDDS) && (local_params.m_quality_level < cCRNMaxQualityLevel))
- console::warning("Clustered DDS compressor doesn't support DXT3");
- }
- if (!pTexture_comp->compress_pass(local_params, pActual_bitrate))
- {
- crnlib_delete(pTexture_comp);
- return false;
- }
-
- comp_data.swap(pTexture_comp->get_comp_data());
-
- if ((pActual_quality_level) && (local_params.m_target_bitrate <= 0.0))
- *pActual_quality_level = local_params.m_quality_level;
-
- crnlib_delete(pTexture_comp);
- return true;
- }
-
- // Interpolative search to find closest quality level to target bitrate.
- const int cLowestQuality = 0;
- const int cHighestQuality = cCRNMaxQualityLevel;
- const int cNumQualityLevels = cHighestQuality - cLowestQuality + 1;
-
- float best_bitrate = 1e+10f;
- int best_quality_level = -1;
- const uint cMaxIterations = 8;
-
- for ( ; ; )
- {
- int low_quality = cLowestQuality;
- int high_quality = cHighestQuality;
-
- float cached_bitrates[cNumQualityLevels];
- for (int i = 0; i < cNumQualityLevels; i++)
- cached_bitrates[i] = -1.0f;
-
- float highest_bitrate = 0.0f;
-
- uint iter_count = 0;
- bool force_binary_search = false;
-
- while (low_quality <= high_quality)
- {
- if (params.m_flags & cCRNCompFlagDebugging)
- {
- console::debug("Quality level bracket: [%u, %u]", low_quality, high_quality);
- }
-
- int trial_quality = (low_quality + high_quality) / 2;
-
- if ((iter_count) && (!force_binary_search))
- {
- int bracket_low = trial_quality;
- while ((cached_bitrates[bracket_low] < 0) && (bracket_low > cLowestQuality))
- bracket_low--;
-
- if (cached_bitrates[bracket_low] < 0)
- trial_quality = static_cast<int>(math::lerp<float>((float)low_quality, (float)high_quality, .33f));
- else
- {
- int bracket_high = trial_quality + 1;
- if (bracket_high <= cHighestQuality)
- {
- while ((cached_bitrates[bracket_high] < 0) && (bracket_high < cHighestQuality))
- bracket_high++;
-
- if (cached_bitrates[bracket_high] >= 0)
- {
- float bracket_low_bitrate = cached_bitrates[bracket_low];
- float bracket_high_bitrate = cached_bitrates[bracket_high];
-
- if ((bracket_low_bitrate < bracket_high_bitrate) &&
- (bracket_low_bitrate < local_params.m_target_bitrate) &&
- (bracket_high_bitrate >= local_params.m_target_bitrate))
- {
- int quality = low_quality + static_cast<int>( ((local_params.m_target_bitrate - bracket_low_bitrate) * (high_quality - low_quality)) / (bracket_high_bitrate - bracket_low_bitrate) );
-
- if ((quality >= low_quality) && (quality <= high_quality))
- {
- trial_quality = quality;
- }
- }
- }
- }
- }
- }
-
- console::info("Compressing to quality level %u", trial_quality);
-
- float bitrate = 0.0f;
-
- local_params.m_quality_level = trial_quality;
-
- if (!pTexture_comp->compress_pass(local_params, &bitrate))
- {
- crnlib_delete(pTexture_comp);
- return false;
- }
-
- cached_bitrates[trial_quality] = bitrate;
-
- highest_bitrate = math::maximum(highest_bitrate, bitrate);
-
- console::info("\nTried quality level %u, bpp: %3.3f", trial_quality, bitrate);
-
- if ( (best_quality_level < 0) ||
- ((bitrate <= local_params.m_target_bitrate) && (best_bitrate > local_params.m_target_bitrate)) ||
- (((bitrate <= local_params.m_target_bitrate) || (best_bitrate > local_params.m_target_bitrate)) && (fabs(bitrate - local_params.m_target_bitrate) < fabs(best_bitrate - local_params.m_target_bitrate)))
- )
- {
- best_bitrate = bitrate;
- comp_data.swap(pTexture_comp->get_comp_data());
- best_quality_level = trial_quality;
- if (params.m_flags & cCRNCompFlagDebugging)
- {
- console::debug("Choose new best quality level");
- }
-
- if ((best_bitrate <= local_params.m_target_bitrate) && (fabs(best_bitrate - local_params.m_target_bitrate) < .005f))
- break;
- }
-
- if (bitrate > local_params.m_target_bitrate)
- high_quality = trial_quality - 1;
- else
- low_quality = trial_quality + 1;
-
- iter_count++;
- if (iter_count > cMaxIterations)
- {
- force_binary_search = true;
- }
- }
-
- if (((local_params.m_flags & cCRNCompFlagHierarchical) != 0) &&
- (highest_bitrate < local_params.m_target_bitrate) &&
- (fabs(best_bitrate - local_params.m_target_bitrate) >= .005f))
- {
- console::info("Unable to achieve desired bitrate - disabling adaptive block sizes and retrying search.");
-
- local_params.m_flags &= ~cCRNCompFlagHierarchical;
-
- crnlib_delete(pTexture_comp);
- pTexture_comp = create_texture_comp(local_params.m_file_type);
-
- if (!pTexture_comp->compress_init(local_params))
- {
- crnlib_delete(pTexture_comp);
- return false;
- }
- }
- else
- break;
- }
-
- crnlib_delete(pTexture_comp);
- pTexture_comp = NULL;
-
- if (best_quality_level < 0)
- return false;
-
- if (pActual_quality_level) *pActual_quality_level = best_quality_level;
- if (pActual_bitrate) *pActual_bitrate = best_bitrate;
-
- console::printf("Selected quality level %u bpp: %f", best_quality_level, best_bitrate);
-
- return true;
- }
-
- static bool create_dds_tex(const crn_comp_params &params, mipmapped_texture &dds_tex)
- {
- image_u8 images[cCRNMaxFaces][cCRNMaxLevels];
-
- bool has_alpha = false;
- for (uint face_index = 0; face_index < params.m_faces; face_index++)
- {
- for (uint level_index = 0; level_index < params.m_levels; level_index++)
- {
- const uint width = math::maximum(1U, params.m_width >> level_index);
- const uint height = math::maximum(1U, params.m_height >> level_index);
-
- if (!params.m_pImages[face_index][level_index])
- return false;
-
- images[face_index][level_index].alias((color_quad_u8*)params.m_pImages[face_index][level_index], width, height);
- if (!has_alpha)
- has_alpha = image_utils::has_alpha(images[face_index][level_index]);
- }
- }
-
- for (uint face_index = 0; face_index < params.m_faces; face_index++)
- for (uint level_index = 0; level_index < params.m_levels; level_index++)
- images[face_index][level_index].set_component_valid(3, has_alpha);
-
- face_vec faces(params.m_faces);
-
- for (uint face_index = 0; face_index < params.m_faces; face_index++)
- {
- for (uint level_index = 0; level_index < params.m_levels; level_index++)
- {
- mip_level *pMip = crnlib_new<mip_level>();
-
- image_u8 *pImage = crnlib_new<image_u8>();
- pImage->swap(images[face_index][level_index]);
- pMip->assign(pImage);
-
- faces[face_index].push_back(pMip);
- }
- }
-
- dds_tex.assign(faces);
-
-#ifdef CRNLIB_BUILD_DEBUG
- CRNLIB_ASSERT(dds_tex.check());
-#endif
-
- return true;
- }
-
- bool create_texture_mipmaps(mipmapped_texture &work_tex, const crn_comp_params &params, const crn_mipmap_params &mipmap_params, bool generate_mipmaps)
- {
- crn_comp_params new_params(params);
-
- bool generate_new_mips = false;
-
- switch (mipmap_params.m_mode)
- {
- case cCRNMipModeUseSourceOrGenerateMips:
- {
- if (work_tex.get_num_levels() == 1)
- generate_new_mips = true;
- break;
- }
- case cCRNMipModeUseSourceMips:
- {
- break;
- }
- case cCRNMipModeGenerateMips:
- {
- generate_new_mips = true;
- break;
- }
- case cCRNMipModeNoMips:
- {
- work_tex.discard_mipmaps();
- break;
- }
- default:
- {
- CRNLIB_ASSERT(0);
- break;
- }
- }
-
- rect window_rect(mipmap_params.m_window_left, mipmap_params.m_window_top, mipmap_params.m_window_right, mipmap_params.m_window_bottom);
-
- if (!window_rect.is_empty())
- {
- if (work_tex.get_num_faces() > 1)
- {
- console::warning("Can't crop cubemap textures");
- }
- else
- {
- console::info("Cropping input texture from window (%ux%u)-(%ux%u)", window_rect.get_left(), window_rect.get_top(), window_rect.get_right(), window_rect.get_bottom());
-
- if (!work_tex.crop(window_rect.get_left(), window_rect.get_top(), window_rect.get_width(), window_rect.get_height()))
- console::warning("Failed cropping window rect");
- }
- }
-
- int new_width = work_tex.get_width();
- int new_height = work_tex.get_height();
-
- if ((mipmap_params.m_clamp_width) && (mipmap_params.m_clamp_height))
- {
- if ((new_width > (int)mipmap_params.m_clamp_width) || (new_height > (int)mipmap_params.m_clamp_height))
- {
- if (!mipmap_params.m_clamp_scale)
- {
- if (work_tex.get_num_faces() > 1)
- {
- console::warning("Can't crop cubemap textures");
- }
- else
- {
- new_width = math::minimum<uint>(mipmap_params.m_clamp_width, new_width);
- new_height = math::minimum<uint>(mipmap_params.m_clamp_height, new_height);
- console::info("Clamping input texture to %ux%u", new_width, new_height);
- work_tex.crop(0, 0, new_width, new_height);
- }
- }
- }
- }
-
- if (mipmap_params.m_scale_mode != cCRNSMDisabled)
- {
- bool is_pow2 = math::is_power_of_2((uint32)new_width) && math::is_power_of_2((uint32)new_height);
-
- switch (mipmap_params.m_scale_mode)
- {
- case cCRNSMAbsolute:
- {
- new_width = (uint)mipmap_params.m_scale_x;
- new_height = (uint)mipmap_params.m_scale_y;
- break;
- }
- case cCRNSMRelative:
- {
- new_width = (uint)(mipmap_params.m_scale_x * new_width + .5f);
- new_height = (uint)(mipmap_params.m_scale_y * new_height + .5f);
- break;
- }
- case cCRNSMLowerPow2:
- {
- if (!is_pow2)
- math::compute_lower_pow2_dim(new_width, new_height);
- break;
- }
- case cCRNSMNearestPow2:
- {
- if (!is_pow2)
- {
- int lwidth = new_width;
- int lheight = new_height;
- math::compute_lower_pow2_dim(lwidth, lheight);
-
- int uwidth = new_width;
- int uheight = new_height;
- math::compute_upper_pow2_dim(uwidth, uheight);
-
- if (labs(new_width - lwidth) < labs(new_width - uwidth))
- new_width = lwidth;
- else
- new_width = uwidth;
-
- if (labs(new_height - lheight) < labs(new_height - uheight))
- new_height = lheight;
- else
- new_height = uheight;
- }
- break;
- }
- case cCRNSMNextPow2:
- {
- if (!is_pow2)
- math::compute_upper_pow2_dim(new_width, new_height);
- break;
- }
- default: break;
- }
- }
-
- if ((mipmap_params.m_clamp_width) && (mipmap_params.m_clamp_height))
- {
- if ((new_width > (int)mipmap_params.m_clamp_width) || (new_height > (int)mipmap_params.m_clamp_height))
- {
- if (mipmap_params.m_clamp_scale)
- {
- new_width = math::minimum<uint>(mipmap_params.m_clamp_width, new_width);
- new_height = math::minimum<uint>(mipmap_params.m_clamp_height, new_height);
- }
- }
- }
-
- new_width = math::clamp<int>(new_width, 1, cCRNMaxLevelResolution);
- new_height = math::clamp<int>(new_height, 1, cCRNMaxLevelResolution);
-
- if ((new_width != (int)work_tex.get_width()) || (new_height != (int)work_tex.get_height()))
- {
- console::info("Resampling input texture to %ux%u", new_width, new_height);
-
- const char* pFilter = crn_get_mip_filter_name(mipmap_params.m_filter);
-
- bool srgb = mipmap_params.m_gamma_filtering != 0;
-
- mipmapped_texture::resample_params res_params;
- res_params.m_pFilter = pFilter;
- res_params.m_wrapping = mipmap_params.m_tiled != 0;
- if (work_tex.get_num_faces())
- res_params.m_wrapping = false;
- res_params.m_renormalize = mipmap_params.m_renormalize != 0;
- res_params.m_filter_scale = 1.0f;
- res_params.m_gamma = mipmap_params.m_gamma;
- res_params.m_srgb = srgb;
- res_params.m_multithreaded = (params.m_num_helper_threads > 0);
-
- if (!work_tex.resize(new_width, new_height, res_params))
- {
- console::error("Failed resizing texture!");
- return false;
- }
- }
-
- if ((generate_new_mips) && (generate_mipmaps))
- {
- bool srgb = mipmap_params.m_gamma_filtering != 0;
-
- const char* pFilter = crn_get_mip_filter_name(mipmap_params.m_filter);
-
- mipmapped_texture::generate_mipmap_params gen_params;
- gen_params.m_pFilter = pFilter;
- gen_params.m_wrapping = mipmap_params.m_tiled != 0;
- gen_params.m_renormalize = mipmap_params.m_renormalize != 0;
- gen_params.m_filter_scale = mipmap_params.m_blurriness;
- gen_params.m_gamma = mipmap_params.m_gamma;
- gen_params.m_srgb = srgb;
- gen_params.m_multithreaded = params.m_num_helper_threads > 0;
- gen_params.m_max_mips = mipmap_params.m_max_levels;
- gen_params.m_min_mip_size = mipmap_params.m_min_mip_size;
-
- console::info("Generating mipmaps using filter \"%s\"", pFilter);
-
- timer tm;
- tm.start();
- if (!work_tex.generate_mipmaps(gen_params, true))
- {
- console::error("Failed generating mipmaps!");
- return false;
- }
- double t = tm.get_elapsed_secs();
-
- console::info("Generated %u mipmap levels in %3.3fs", work_tex.get_num_levels() - 1, t);
- }
-
- return true;
- }
-
- bool create_compressed_texture(const crn_comp_params &params, const crn_mipmap_params &mipmap_params, crnlib::vector<uint8> &comp_data, uint32 *pActual_quality_level, float *pActual_bitrate)
- {
- comp_data.resize(0);
- if (pActual_bitrate) *pActual_bitrate = 0.0f;
- if (pActual_quality_level) *pActual_quality_level = 0;
-
- mipmapped_texture work_tex;
- if (!create_dds_tex(params, work_tex))
- {
- console::error("Failed creating DDS texture from crn_comp_params!");
- return false;
- }
-
- if (!create_texture_mipmaps(work_tex, params, mipmap_params, true))
- return false;
-
- crn_comp_params new_params(params);
- new_params.m_levels = work_tex.get_num_levels();
- memset(new_params.m_pImages, 0, sizeof(new_params.m_pImages));
-
- for (uint f = 0; f < work_tex.get_num_faces(); f++)
- for (uint l = 0; l < work_tex.get_num_levels(); l++)
- new_params.m_pImages[f][l] = (uint32*)work_tex.get_level(f, l)->get_image()->get_ptr();
-
- return create_compressed_texture(new_params, comp_data, pActual_quality_level, pActual_bitrate);
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_texture_comp.h b/Libraries/crunch-ea9b8d/crnlib/crn_texture_comp.h
deleted file mode 100644
index 9319054f..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_texture_comp.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// File: crn_texture_comp.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-#include "../inc/crnlib.h"
-
-namespace crnlib
-{
- class mipmapped_texture;
-
- class itexture_comp
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(itexture_comp);
-
- public:
- itexture_comp() { }
- virtual ~itexture_comp() { }
-
- virtual const char *get_ext() const = 0;
-
- virtual bool compress_init(const crn_comp_params& params) = 0;
- virtual bool compress_pass(const crn_comp_params& params, float *pEffective_bitrate) = 0;
- virtual void compress_deinit() = 0;
-
- virtual const crnlib::vector<uint8>& get_comp_data() const = 0;
- virtual crnlib::vector<uint8>& get_comp_data() = 0;
- };
-
- bool create_compressed_texture(const crn_comp_params &params, crnlib::vector<uint8> &comp_data, uint32 *pActual_quality_level, float *pActual_bitrate);
- bool create_texture_mipmaps(mipmapped_texture &work_tex, const crn_comp_params &params, const crn_mipmap_params &mipmap_params, bool generate_mipmaps);
- bool create_compressed_texture(const crn_comp_params &params, const crn_mipmap_params &mipmap_params, crnlib::vector<uint8> &comp_data, uint32 *pActual_quality_level, float *pActual_bitrate);
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_texture_conversion.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_texture_conversion.cpp
deleted file mode 100644
index 9255b8ad..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_texture_conversion.cpp
+++ /dev/null
@@ -1,772 +0,0 @@
-// File: crn_texture_conversion.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_texture_conversion.h"
-#include "crn_console.h"
-#include "crn_file_utils.h"
-#include "crn_cfile_stream.h"
-#include "crn_image_utils.h"
-#include "crn_texture_comp.h"
-#include "crn_strutils.h"
-
-namespace crnlib
-{
- namespace texture_conversion
- {
- struct progress_params
- {
- convert_params* m_pParams;
- uint m_start_percentage;
- bool m_canceled;
- };
-
- convert_stats::convert_stats()
- {
- clear();
- }
-
- bool convert_stats::init(
- const char* pSrc_filename,
- const char* pDst_filename,
- mipmapped_texture& src_tex,
- texture_file_types::format dst_file_type,
- bool lzma_stats)
- {
- m_src_filename = pSrc_filename;
- m_dst_filename = pDst_filename;
- m_dst_file_type = dst_file_type;
-
- m_pInput_tex = &src_tex;
-
- file_utils::get_file_size(pSrc_filename, m_input_file_size);
- file_utils::get_file_size(pDst_filename, m_output_file_size);
-
- m_total_input_pixels = 0;
- for (uint i = 0; i < src_tex.get_num_levels(); i++)
- {
- uint width = math::maximum<uint>(1, src_tex.get_width() >> i);
- uint height = math::maximum<uint>(1, src_tex.get_height() >> i);
- m_total_input_pixels += width*height*src_tex.get_num_faces();
- }
-
- m_output_comp_file_size = 0;
-
- m_total_output_pixels = 0;
-
- if (lzma_stats)
- {
- vector<uint8> dst_tex_bytes;
- if (!cfile_stream::read_file_into_array(pDst_filename, dst_tex_bytes))
- {
- console::error("Failed loading output file: %s", pDst_filename);
- return false;
- }
- if (!dst_tex_bytes.size())
- {
- console::error("Output file is empty: %s", pDst_filename);
- return false;
- }
- vector<uint8> cmp_tex_bytes;
- lzma_codec lossless_codec;
- if (lossless_codec.pack(dst_tex_bytes.get_ptr(), dst_tex_bytes.size(), cmp_tex_bytes))
- {
- m_output_comp_file_size = cmp_tex_bytes.size();
- }
- }
-
- if (!m_output_tex.read_from_file(pDst_filename, m_dst_file_type))
- {
- console::error("Failed loading output file: %s", pDst_filename);
- return false;
- }
-
- for (uint i = 0; i < m_output_tex.get_num_levels(); i++)
- {
- uint width = math::maximum<uint>(1, m_output_tex.get_width() >> i);
- uint height = math::maximum<uint>(1, m_output_tex.get_height() >> i);
- m_total_output_pixels += width*height*m_output_tex.get_num_faces();
- }
- CRNLIB_ASSERT(m_total_output_pixels == m_output_tex.get_total_pixels_in_all_faces_and_mips());
-
- return true;
- }
-
- bool convert_stats::print(bool psnr_metrics, bool mip_stats, bool grayscale_sampling, const char *pCSVStatsFile) const
- {
- if (!m_pInput_tex)
- return false;
-
- console::info("Input texture: %ux%u, Levels: %u, Faces: %u, Format: %s",
- m_pInput_tex->get_width(),
- m_pInput_tex->get_height(),
- m_pInput_tex->get_num_levels(),
- m_pInput_tex->get_num_faces(),
- pixel_format_helpers::get_pixel_format_string(m_pInput_tex->get_format()));
-
- // Just casting the uint64's filesizes to uint32 here to work around gcc issues - it's not even possible to have files that large anyway.
- console::info("Input pixels: %u, Input file size: %u, Input bits/pixel: %1.3f",
- m_total_input_pixels, (uint32)m_input_file_size, (m_input_file_size * 8.0f) / m_total_input_pixels);
-
- console::info("Output texture: %ux%u, Levels: %u, Faces: %u, Format: %s",
- m_output_tex.get_width(),
- m_output_tex.get_height(),
- m_output_tex.get_num_levels(),
- m_output_tex.get_num_faces(),
- pixel_format_helpers::get_pixel_format_string(m_output_tex.get_format()));
-
- console::info("Output pixels: %u, Output file size: %u, Output bits/pixel: %1.3f",
- m_total_output_pixels, (uint32)m_output_file_size, (m_output_file_size * 8.0f) / m_total_output_pixels);
-
- if (m_output_comp_file_size)
- {
- console::info("LZMA compressed output file size: %u bytes, %1.3f bits/pixel",
- (uint32)m_output_comp_file_size, (m_output_comp_file_size * 8.0f) / m_total_output_pixels);
- }
- if (psnr_metrics)
- {
- if ( (m_pInput_tex->get_width() != m_output_tex.get_width()) || (m_pInput_tex->get_height() != m_output_tex.get_height()) || (m_pInput_tex->get_num_faces() != m_output_tex.get_num_faces()) )
- {
- console::warning("Unable to compute image statistics - input/output texture dimensions are different.");
- }
- else
- {
- uint num_faces = math::minimum(m_pInput_tex->get_num_faces(), m_output_tex.get_num_faces());
- uint num_levels = math::minimum(m_pInput_tex->get_num_levels(), m_output_tex.get_num_levels());
-
- if (!mip_stats)
- num_levels = 1;
-
- for (uint face = 0; face < num_faces; face++)
- {
- for (uint level = 0; level < num_levels; level++)
- {
- image_u8 a, b;
- image_u8* pA = m_pInput_tex->get_level_image(face, level, a);
- image_u8* pB = m_output_tex.get_level_image(face, level, b);
-
- if (pA && pB)
- {
- image_u8 grayscale_a, grayscale_b;
- if (grayscale_sampling)
- {
- grayscale_a = *pA;
- grayscale_a.convert_to_grayscale();
- pA = &grayscale_a;
-
- grayscale_b = *pB;
- grayscale_b.convert_to_grayscale();
- pB = &grayscale_b;
- }
-
- console::info("Face %u Mipmap level %u statistics:", face, level);
- image_utils::print_image_metrics(*pA, *pB);
-
- if ((pA->has_rgb()) || (pB->has_rgb()))
- image_utils::print_ssim(*pA, *pB);
- }
- }
- }
-
- if (pCSVStatsFile)
- {
- // FIXME: This is kind of a hack, and should be combined with the code above.
- image_u8 a, b;
- image_u8* pA = m_pInput_tex->get_level_image(0, 0, a);
- image_u8* pB = m_output_tex.get_level_image(0, 0, b);
- if (pA && pB)
- {
- image_u8 grayscale_a, grayscale_b;
- if (grayscale_sampling)
- {
- grayscale_a = *pA;
- grayscale_a.convert_to_grayscale();
- pA = &grayscale_a;
-
- grayscale_b = *pB;
- grayscale_b.convert_to_grayscale();
- pB = &grayscale_b;
- }
-
- image_utils::error_metrics rgb_error;
- image_utils::error_metrics luma_error;
- if (rgb_error.compute(*pA, *pB, 0, 3, false) && luma_error.compute(*pA, *pB, 0, 0, true))
- {
- bool bCSVStatsFileExists = file_utils::does_file_exist(pCSVStatsFile);
- FILE* pFile;
- crn_fopen(&pFile, pCSVStatsFile, "a");
- if (!pFile)
- console::warning("Unable to append to CSV stats file: %s\n", pCSVStatsFile);
- else
- {
- if (!bCSVStatsFileExists)
- fprintf(pFile, "name,width,height,miplevels,rgb_rms,luma_rms,effective_output_size,effective_bitrate\n");
- dynamic_string filename;
- file_utils::split_path(m_src_filename.get_ptr(), NULL, NULL, &filename, NULL);
-
- uint64 effective_output_size = m_output_comp_file_size ? m_output_comp_file_size : m_output_file_size;
- float bitrate = (effective_output_size * 8.0f) / m_total_output_pixels;
- fprintf(pFile, "%s,%u,%u,%u,%f,%f,%u,%f\n",
- filename.get_ptr(),
- pB->get_width(), pB->get_height(), m_output_tex.get_num_levels(),
- rgb_error.mRootMeanSquared, luma_error.mRootMeanSquared,
- (uint32)effective_output_size, bitrate);
- fclose(pFile);
- }
- }
- }
- }
- }
- }
-
- return true;
- }
-
- void convert_stats::clear()
- {
- m_src_filename.clear();
- m_dst_filename.clear();
- m_dst_file_type = texture_file_types::cFormatInvalid;
-
- m_pInput_tex = NULL;
- m_output_tex.clear();
-
- m_input_file_size = 0;
- m_total_input_pixels = 0;
-
- m_output_file_size = 0;
- m_total_output_pixels = 0;
-
- m_output_comp_file_size = 0;
- }
-
- //-----------------------------------------------------------------------
-
- static crn_bool crn_progress_callback(crn_uint32 phase_index, crn_uint32 total_phases, crn_uint32 subphase_index, crn_uint32 total_subphases, void* pUser_data_ptr)
- {
- progress_params& params = *static_cast<progress_params*>(pUser_data_ptr);
-
- if (params.m_canceled)
- return false;
- if (!params.m_pParams->m_pProgress_func)
- return true;
-
- int percentage_complete = params.m_start_percentage + (int)(.5f + (phase_index + float(subphase_index) / total_subphases) * (100.0f - params.m_start_percentage) / total_phases);
-
- percentage_complete = math::clamp<int>(percentage_complete, 0, 100);
-
- if (!params.m_pParams->m_pProgress_func(percentage_complete, params.m_pParams->m_pProgress_user_data))
- {
- params.m_canceled = true;
- return false;
- }
-
- return true;
- }
-
- static bool dxt_progress_callback_func(uint percentage_complete, void* pUser_data_ptr)
- {
- progress_params& params = *static_cast<progress_params*>(pUser_data_ptr);
-
- if (params.m_canceled)
- return false;
-
- if (!params.m_pParams->m_pProgress_func)
- return true;
-
- int scaled_percentage_complete = params.m_start_percentage + (percentage_complete * (100 - params.m_start_percentage)) / 100;
-
- scaled_percentage_complete = math::clamp<int>(scaled_percentage_complete, 0, 100);
-
- if (!params.m_pParams->m_pProgress_func(scaled_percentage_complete, params.m_pParams->m_pProgress_user_data))
- {
- params.m_canceled = true;
- return false;
- }
-
- return true;
- }
-
- static bool convert_error(const convert_params& params, const char* pError_msg)
- {
- params.m_status = false;
- params.m_error_message = pError_msg;
-
- remove(params.m_dst_filename.get_ptr());
-
- return false;
- }
-
- static pixel_format choose_pixel_format(convert_params& params, const crn_comp_params &comp_params, const mipmapped_texture& src_tex, texture_type tex_type)
- {
- const pixel_format src_fmt = src_tex.get_format();
- const texture_file_types::format src_file_type = src_tex.get_source_file_type();
- const bool is_normal_map = (tex_type == cTextureTypeNormalMap);
-
- if (params.m_always_use_source_pixel_format)
- return src_fmt;
-
- // Attempt to choose a reasonable/sane output pixel format.
- if (params.m_dst_file_type == texture_file_types::cFormatCRN)
- {
- if (is_normal_map)
- {
- if (pixel_format_helpers::is_dxt(src_fmt))
- return src_fmt;
- else
- return PIXEL_FMT_DXT5_AGBR;
- }
- }
- else if (params.m_dst_file_type == texture_file_types::cFormatKTX)
- {
- if ((src_file_type != texture_file_types::cFormatCRN) && (src_file_type != texture_file_types::cFormatKTX) && (src_file_type != texture_file_types::cFormatDDS))
- {
- if (is_normal_map)
- {
- return pixel_format_helpers::has_alpha(src_fmt) ? PIXEL_FMT_A8R8G8B8 : PIXEL_FMT_R8G8B8;
- }
- else if (pixel_format_helpers::is_grayscale(src_fmt))
- {
- if (pixel_format_helpers::has_alpha(src_fmt))
- return PIXEL_FMT_A8L8;
- else
- return PIXEL_FMT_ETC1;
- }
- else if (pixel_format_helpers::has_alpha(src_fmt))
- return PIXEL_FMT_A8R8G8B8;
- else
- return PIXEL_FMT_ETC1;
- }
- }
- else if (params.m_dst_file_type == texture_file_types::cFormatDDS)
- {
- if ((src_file_type != texture_file_types::cFormatCRN) && (src_file_type != texture_file_types::cFormatKTX) && (src_file_type != texture_file_types::cFormatDDS))
- {
- if (is_normal_map)
- {
- return PIXEL_FMT_DXT5_AGBR;
- }
- else if (pixel_format_helpers::is_grayscale(src_fmt))
- {
- if (pixel_format_helpers::has_alpha(src_fmt))
- return comp_params.get_flag(cCRNCompFlagDXT1AForTransparency) ? PIXEL_FMT_DXT1A : PIXEL_FMT_DXT5;
- else
- return PIXEL_FMT_DXT1;
- }
- else if (pixel_format_helpers::has_alpha(src_fmt))
- return comp_params.get_flag(cCRNCompFlagDXT1AForTransparency) ? PIXEL_FMT_DXT1A : PIXEL_FMT_DXT5;
- else
- return PIXEL_FMT_DXT1;
- }
- }
- else
- {
- // Destination is a regular image format.
- if (pixel_format_helpers::is_grayscale(src_fmt))
- {
- if (pixel_format_helpers::has_alpha(src_fmt))
- return PIXEL_FMT_A8L8;
- else
- return PIXEL_FMT_L8;
- }
- else if (pixel_format_helpers::has_alpha(src_fmt))
- return PIXEL_FMT_A8R8G8B8;
- else
- return PIXEL_FMT_R8G8B8;
- }
-
- return src_fmt;
- }
-
- static void print_comp_params(const crn_comp_params &comp_params)
- {
- console::debug("\nTexture conversion compression parameters:");
- console::debug(" Desired bitrate: %3.3f", comp_params.m_target_bitrate);
- console::debug(" CRN Quality: %i", comp_params.m_quality_level);
- console::debug("CRN C endpoints/selectors: %u %u", comp_params.m_crn_color_endpoint_palette_size, comp_params.m_crn_color_selector_palette_size);
- console::debug("CRN A endpoints/selectors: %u %u", comp_params.m_crn_alpha_endpoint_palette_size, comp_params.m_crn_alpha_selector_palette_size);
- console::debug(" DXT both block types: %u, Alpha threshold: %u", comp_params.get_flag(cCRNCompFlagUseBothBlockTypes), comp_params.m_dxt1a_alpha_threshold);
- console::debug(" DXT compression quality: %s", crn_get_dxt_quality_string(comp_params.m_dxt_quality));
- console::debug(" Perceptual: %u, Large Blocks: %u", comp_params.get_flag(cCRNCompFlagPerceptual), comp_params.get_flag(cCRNCompFlagHierarchical));
- console::debug(" Compressor: %s", get_dxt_compressor_name(comp_params.m_dxt_compressor_type));
- console::debug(" Disable endpoint caching: %u", comp_params.get_flag(cCRNCompFlagDisableEndpointCaching));
- console::debug(" Grayscale sampling: %u", comp_params.get_flag(cCRNCompFlagGrayscaleSampling));
- console::debug(" Max helper threads: %u", comp_params.m_num_helper_threads);
- console::debug("");
- }
-
- static void print_mipmap_params(const crn_mipmap_params &mipmap_params)
- {
- console::debug("\nTexture conversion MIP-map parameters:");
- console::debug(" Mode: %s", crn_get_mip_mode_name(mipmap_params.m_mode));
- console::debug(" Filter: %s", crn_get_mip_filter_name(mipmap_params.m_filter));
- console::debug("Gamma filtering: %u, Gamma: %2.2f", mipmap_params.m_gamma_filtering, mipmap_params.m_gamma);
- console::debug(" Blurriness: %2.2f", mipmap_params.m_blurriness);
- console::debug(" Renormalize: %u", mipmap_params.m_renormalize);
- console::debug(" Tiled: %u", mipmap_params.m_tiled);
- console::debug(" Max Levels: %u", mipmap_params.m_max_levels);
- console::debug(" Min level size: %u", mipmap_params.m_min_mip_size);
- console::debug(" window: %u %u %u %u", mipmap_params.m_window_left, mipmap_params.m_window_top, mipmap_params.m_window_right, mipmap_params.m_window_bottom);
- console::debug(" scale mode: %s", crn_get_scale_mode_desc(mipmap_params.m_scale_mode));
- console::debug(" scale: %f %f", mipmap_params.m_scale_x, mipmap_params.m_scale_y);
- console::debug(" clamp: %u %u, clamp_scale: %u", mipmap_params.m_clamp_width, mipmap_params.m_clamp_height, mipmap_params.m_clamp_scale);
- console::debug("");
- }
-
- void convert_params::print()
- {
- console::debug("\nTexture conversion parameters:");
- console::debug(" Resolution: %ux%u, Faces: %u, Levels: %u, Format: %s, X Flipped: %u, Y Flipped: %u",
- m_pInput_texture->get_width(),
- m_pInput_texture->get_height(),
- m_pInput_texture->get_num_faces(),
- m_pInput_texture->get_num_levels(),
- pixel_format_helpers::get_pixel_format_string(m_pInput_texture->get_format()),
- m_pInput_texture->is_x_flipped(),
- m_pInput_texture->is_y_flipped());
-
- console::debug(" texture_type: %s", get_texture_type_desc(m_texture_type));
- console::debug(" dst_filename: %s", m_dst_filename.get_ptr());
- console::debug(" dst_file_type: %s", texture_file_types::get_extension(m_dst_file_type));
- console::debug(" dst_format: %s", pixel_format_helpers::get_pixel_format_string(m_dst_format));
- console::debug(" quick: %u", m_quick);
- console::debug(" use_source_format: %u", m_always_use_source_pixel_format);
- console::debug(" Y Flip: %u", m_y_flip);
- console::debug(" Unflip: %u", m_unflip);
- }
-
- static bool write_compressed_texture(
- mipmapped_texture& work_tex, convert_params& params, crn_comp_params &comp_params, pixel_format dst_format, progress_params& progress_state, bool perceptual, convert_stats &stats)
- {
- comp_params.m_file_type = (params.m_dst_file_type == texture_file_types::cFormatCRN) ? cCRNFileTypeCRN : cCRNFileTypeDDS;
-
- comp_params.m_pProgress_func = crn_progress_callback;
- comp_params.m_pProgress_func_data = &progress_state;
- comp_params.set_flag(cCRNCompFlagPerceptual, perceptual);
-
- crn_format crn_fmt = pixel_format_helpers::convert_pixel_format_to_best_crn_format(dst_format);
- comp_params.m_format = crn_fmt;
-
- console::message("Writing %s texture to file: \"%s\"", crn_get_format_string(crn_fmt), params.m_dst_filename.get_ptr());
-
- uint32 actual_quality_level;
- float actual_bitrate;
- bool status = work_tex.write_to_file(params.m_dst_filename.get_ptr(), params.m_dst_file_type, &comp_params, &actual_quality_level, &actual_bitrate);
- if (!status)
- return convert_error(params, "Failed writing output file!");
-
- if (!params.m_no_stats)
- {
- if (!stats.init(params.m_pInput_texture->get_source_filename().get_ptr(), params.m_dst_filename.get_ptr(), *params.m_pIntermediate_texture, params.m_dst_file_type, params.m_lzma_stats))
- {
- console::warning("Unable to compute output statistics for file: %s", params.m_pInput_texture->get_source_filename().get_ptr());
- }
- }
-
- return true;
- }
-
- static bool convert_and_write_normal_texture(mipmapped_texture& work_tex, convert_params& params, const crn_comp_params &comp_params, pixel_format dst_format, progress_params& progress_state, bool formats_differ, bool perceptual, convert_stats& stats)
- {
- if (formats_differ)
- {
- dxt_image::pack_params pack_params;
-
- pack_params.m_perceptual = perceptual;
- pack_params.m_compressor = comp_params.m_dxt_compressor_type;
- pack_params.m_pProgress_callback = dxt_progress_callback_func;
- pack_params.m_pProgress_callback_user_data_ptr = &progress_state;
- pack_params.m_dxt1a_alpha_threshold = comp_params.m_dxt1a_alpha_threshold;
- pack_params.m_quality = comp_params.m_dxt_quality;
- pack_params.m_endpoint_caching = !comp_params.get_flag(cCRNCompFlagDisableEndpointCaching);
- pack_params.m_grayscale_sampling = comp_params.get_flag(cCRNCompFlagGrayscaleSampling);
- if ((!comp_params.get_flag(cCRNCompFlagUseBothBlockTypes)) && (!comp_params.get_flag(cCRNCompFlagDXT1AForTransparency)))
- pack_params.m_use_both_block_types = false;
-
- pack_params.m_num_helper_threads = comp_params.m_num_helper_threads;
- pack_params.m_use_transparent_indices_for_black = comp_params.get_flag(cCRNCompFlagUseTransparentIndicesForBlack);
-
- console::info("Converting texture format from %s to %s", pixel_format_helpers::get_pixel_format_string(work_tex.get_format()), pixel_format_helpers::get_pixel_format_string(dst_format));
-
- timer tm;
- tm.start();
-
- bool status = work_tex.convert(dst_format, pack_params);
-
- double t = tm.get_elapsed_secs();
-
- console::info("");
-
- if (!status)
- {
- if (progress_state.m_canceled)
- {
- params.m_canceled = true;
- return false;
- }
- else
- {
- return convert_error(params, "Failed converting texture to output format!");
- }
- }
-
- console::info("Texture format conversion took %3.3fs", t);
- }
-
- if (params.m_write_mipmaps_to_multiple_files)
- {
- for (uint f = 0; f < work_tex.get_num_faces(); f++)
- {
- for (uint l = 0; l < work_tex.get_num_levels(); l++)
- {
- dynamic_string filename(params.m_dst_filename.get_ptr());
-
- dynamic_string drv, dir, fn, ext;
- if (!file_utils::split_path(params.m_dst_filename.get_ptr(), &drv, &dir, &fn, &ext))
- return false;
-
- fn += dynamic_string(cVarArg, "_face%u_mip%u", f, l).get_ptr();
- filename = drv + dir + fn + ext;
-
- mip_level *pLevel = work_tex.get_level(f, l);
-
- face_vec face(1);
- face[0].push_back(crnlib_new<mip_level>(*pLevel));
-
- mipmapped_texture new_tex;
- new_tex.assign(face);
-
- console::info("Writing texture face %u mip level %u to file %s", f, l, filename.get_ptr());
-
- if (!new_tex.write_to_file(filename.get_ptr(), params.m_dst_file_type, NULL, NULL, NULL))
- return convert_error(params, "Failed writing output file!");
- }
- }
- }
- else
- {
- console::message("Writing texture to file: \"%s\"", params.m_dst_filename.get_ptr());
-
- if (!work_tex.write_to_file(params.m_dst_filename.get_ptr(), params.m_dst_file_type, NULL, NULL, NULL))
- return convert_error(params, "Failed writing output file!");
-
- if (!params.m_no_stats)
- {
- if (!stats.init(params.m_pInput_texture->get_source_filename().get_ptr(), params.m_dst_filename.get_ptr(), *params.m_pIntermediate_texture, params.m_dst_file_type, params.m_lzma_stats))
- {
- console::warning("Unable to compute output statistics for file: %s", params.m_pInput_texture->get_source_filename().get_ptr());
- }
- }
- }
-
- return true;
- }
-
- bool process(convert_params& params, convert_stats& stats)
- {
- texture_type tex_type = params.m_texture_type;
-
- crn_comp_params comp_params(params.m_comp_params);
- crn_mipmap_params mipmap_params(params.m_mipmap_params);
-
- progress_params progress_state;
- progress_state.m_pParams = &params;
- progress_state.m_canceled = false;
- progress_state.m_start_percentage = 0;
-
- params.m_status = false;
- params.m_error_message.clear();
-
- if (params.m_pIntermediate_texture)
- {
- crnlib_delete(params.m_pIntermediate_texture);
- params.m_pIntermediate_texture = NULL;
- }
-
- params.m_pIntermediate_texture = crnlib_new<mipmapped_texture>(*params.m_pInput_texture);
-
- mipmapped_texture& work_tex = *params.m_pInput_texture;
-
- if ((params.m_unflip) && (work_tex.is_flipped()))
- {
- console::info("Unflipping texture");
- work_tex.unflip(true, true);
- }
-
- if (params.m_y_flip)
- {
- console::info("Flipping texture on Y axis");
-
- // This is awkward - if we're writing to KTX, then go ahead and properly update the work texture's orientation flags.
- // Otherwise, don't bother updating the orientation flags because the writer may then attempt to unflip the texture before writing to formats
- // that don't support flipped textures (ugh).
- const bool bOutputFormatSupportsFlippedTextures = params.m_dst_file_type == texture_file_types::cFormatKTX;
- if (!work_tex.flip_y(bOutputFormatSupportsFlippedTextures))
- {
- console::warning("Failed flipping texture on Y axis");
- }
- }
-
- if ((params.m_dst_format != PIXEL_FMT_INVALID) && (pixel_format_helpers::is_alpha_only(params.m_dst_format)))
- {
- if ((work_tex.get_comp_flags() & pixel_format_helpers::cCompFlagAValid) == 0)
- {
- console::warning("Output format is alpha-only, but input doesn't have alpha, so setting alpha to luminance.");
-
- work_tex.convert(PIXEL_FMT_A8, crnlib::dxt_image::pack_params());
-
- if (tex_type == cTextureTypeNormalMap)
- tex_type = cTextureTypeRegularMap;
- }
- }
-
- pixel_format dst_format = params.m_dst_format;
- if (pixel_format_helpers::is_dxt(dst_format))
- {
- if ((params.m_dst_file_type != texture_file_types::cFormatCRN) &&
- (params.m_dst_file_type != texture_file_types::cFormatDDS) &&
- (params.m_dst_file_type != texture_file_types::cFormatKTX))
- {
- console::warning("Output file format does not support DXTc - automatically choosing a non-DXT pixel format.");
- dst_format = PIXEL_FMT_INVALID;
- }
- }
-
- if (dst_format == PIXEL_FMT_INVALID)
- {
- // Caller didn't specify a format to use, so try to pick something reasonable.
- // This is actually much trickier than it seems, and the current approach kind of sucks.
- dst_format = choose_pixel_format(params, comp_params, work_tex, tex_type);
- }
-
- if ((dst_format == PIXEL_FMT_DXT1) && (comp_params.get_flag(cCRNCompFlagDXT1AForTransparency)))
- dst_format = PIXEL_FMT_DXT1A;
- else if (dst_format == PIXEL_FMT_DXT1A)
- comp_params.set_flag(cCRNCompFlagDXT1AForTransparency, true);
-
- if ((dst_format == PIXEL_FMT_ETC1) && (params.m_dst_file_type == texture_file_types::cFormatCRN))
- {
- console::warning("CRN file format does not support ETC1 compressed textures - converting to DXT1 instead.");
- dst_format = PIXEL_FMT_DXT1;
- }
-
- if ((dst_format == PIXEL_FMT_DXT1A) && (params.m_dst_file_type == texture_file_types::cFormatCRN))
- {
- console::warning("CRN file format does not support DXT1A compressed textures - converting to DXT5 instead.");
- dst_format = PIXEL_FMT_DXT5;
- }
-
- const bool is_normal_map = (tex_type == cTextureTypeNormalMap);
- bool perceptual = comp_params.get_flag(cCRNCompFlagPerceptual);
- if (is_normal_map)
- {
- perceptual = false;
- mipmap_params.m_gamma_filtering = false;
- }
-
- if (pixel_format_helpers::is_pixel_format_non_srgb(dst_format))
- {
- if (perceptual)
- {
- console::message("Output pixel format is swizzled or not RGB, disabling perceptual color metrics");
- perceptual = false;
- }
- }
-
- if (pixel_format_helpers::is_normal_map(dst_format))
- {
- if (perceptual)
- console::message("Output pixel format is intended for normal maps, disabling perceptual color metrics");
-
- perceptual = false;
- }
-
- bool generate_mipmaps = texture_file_types::supports_mipmaps(params.m_dst_file_type);
- if ( (params.m_write_mipmaps_to_multiple_files) &&
- ((params.m_dst_file_type != texture_file_types::cFormatCRN) && (params.m_dst_file_type != texture_file_types::cFormatDDS) && (params.m_dst_file_type != texture_file_types::cFormatKTX))
- )
- {
- generate_mipmaps = true;
- }
-
- if (params.m_param_debugging)
- {
- params.print();
-
- print_comp_params(comp_params);
- print_mipmap_params(mipmap_params);
- }
-
- if (!create_texture_mipmaps(work_tex, comp_params, mipmap_params, generate_mipmaps))
- return convert_error(params, "Failed creating texture mipmaps!");
-
- bool formats_differ = work_tex.get_format() != dst_format;
- if (formats_differ)
- {
- if (pixel_format_helpers::is_dxt1(work_tex.get_format()) && pixel_format_helpers::is_dxt1(dst_format))
- formats_differ = false;
- }
-
- bool status = false;
-
- timer t;
- t.start();
-
- if ( (params.m_dst_file_type == texture_file_types::cFormatCRN) ||
- ( (params.m_dst_file_type == texture_file_types::cFormatDDS) && (pixel_format_helpers::is_dxt(dst_format)) &&
- //((formats_differ) || (comp_params.m_target_bitrate > 0.0f) || (comp_params.m_quality_level < cCRNMaxQualityLevel))
- ((comp_params.m_target_bitrate > 0.0f) || (comp_params.m_quality_level < cCRNMaxQualityLevel))
- )
- )
- {
- status = write_compressed_texture(work_tex, params, comp_params, dst_format, progress_state, perceptual, stats);
- }
- else
- {
- if ((comp_params.m_target_bitrate > 0.0f) || (comp_params.m_quality_level < cCRNMaxQualityLevel))
- {
- console::warning( "Target bitrate/quality level is not supported for this output file format.\n");
- }
- status = convert_and_write_normal_texture(work_tex, params, comp_params, dst_format, progress_state, formats_differ, perceptual, stats);
- }
-
- console::progress("");
-
- if (progress_state.m_canceled)
- {
- params.m_canceled = true;
- return false;
- }
-
- double total_write_time = t.get_elapsed_secs();
-
- if (status)
- {
- if (params.m_param_debugging)
- console::info("Work texture format: %s, desired destination format: %s", pixel_format_helpers::get_pixel_format_string(work_tex.get_format()), pixel_format_helpers::get_pixel_format_string(dst_format));
-
- console::message("Texture successfully written in %3.3fs", total_write_time);
- }
- else
- {
- dynamic_string str;
-
- if (work_tex.get_last_error().is_empty())
- str.format("Failed writing texture to file \"%s\"", params.m_dst_filename.get_ptr());
- else
- str.format("Failed writing texture to file \"%s\", Reason: %s", params.m_dst_filename.get_ptr(), work_tex.get_last_error().get_ptr());
-
- return convert_error(params, str.get_ptr());
- }
-
- if (params.m_debugging)
- {
- crnlib_print_mem_stats();
- }
-
- params.m_status = true;
- return true;
- }
-
- } // namespace texture_conversion
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_texture_conversion.h b/Libraries/crunch-ea9b8d/crnlib/crn_texture_conversion.h
deleted file mode 100644
index 3b21915a..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_texture_conversion.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// File: crn_texture_conversion.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_dxt_image.h"
-#include "crn_mipmapped_texture.h"
-#include "crn_rect.h"
-#include "crn_lzma_codec.h"
-
-namespace crnlib
-{
- namespace texture_conversion
- {
- class convert_stats
- {
- public:
- convert_stats();
-
- bool init(
- const char* pSrc_filename,
- const char* pDst_filename,
- mipmapped_texture& src_tex,
- texture_file_types::format dst_file_type,
- bool lzma_stats);
-
- bool print(bool psnr_metrics, bool mip_stats, bool grayscale_sampling, const char *pCSVStatsFile = NULL) const;
-
- void clear();
-
- dynamic_string m_src_filename;
- dynamic_string m_dst_filename;
- texture_file_types::format m_dst_file_type;
-
- mipmapped_texture* m_pInput_tex;
- mipmapped_texture m_output_tex;
-
- uint64 m_input_file_size;
- uint m_total_input_pixels;
-
- uint64 m_output_file_size;
- uint m_total_output_pixels;
-
- uint64 m_output_comp_file_size;
- };
-
- class convert_params
- {
- public:
- convert_params() :
- m_pInput_texture(NULL),
- m_texture_type(cTextureTypeUnknown),
- m_dst_file_type(texture_file_types::cFormatInvalid),
- m_dst_format(PIXEL_FMT_INVALID),
- m_pProgress_func(NULL),
- m_pProgress_user_data(NULL),
- m_pIntermediate_texture(NULL),
- m_y_flip(false),
- m_unflip(false),
- m_always_use_source_pixel_format(false),
- m_write_mipmaps_to_multiple_files(false),
- m_quick(false),
- m_debugging(false),
- m_param_debugging(false),
- m_no_stats(false),
- m_lzma_stats(false),
- m_status(false),
- m_canceled(false)
- {
- }
-
- ~convert_params()
- {
- crnlib_delete(m_pIntermediate_texture);
- }
-
- void print();
-
- // Input parameters
- mipmapped_texture* m_pInput_texture;
-
- texture_type m_texture_type;
-
- dynamic_string m_dst_filename;
- texture_file_types::format m_dst_file_type;
- pixel_format m_dst_format;
-
- crn_comp_params m_comp_params;
- crn_mipmap_params m_mipmap_params;
-
- typedef bool (*progress_callback_func_ptr)(uint percentage_complete, void* pUser_data_ptr);
- progress_callback_func_ptr m_pProgress_func;
- void* m_pProgress_user_data;
-
- // Return parameters
- mipmapped_texture* m_pIntermediate_texture;
- mutable dynamic_string m_error_message;
-
- bool m_y_flip;
- bool m_unflip;
- bool m_always_use_source_pixel_format;
- bool m_write_mipmaps_to_multiple_files;
- bool m_quick;
- bool m_debugging;
- bool m_param_debugging;
- bool m_no_stats;
-
- bool m_lzma_stats;
- mutable bool m_status;
- mutable bool m_canceled;
- };
-
- bool process(convert_params& params, convert_stats& stats);
-
- } // namespace texture_conversion
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_texture_file_types.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_texture_file_types.cpp
deleted file mode 100644
index e737ce99..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_texture_file_types.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-// File: crn_texture_file_types.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_texture_file_types.h"
-#include "crn_file_utils.h"
-
-namespace crnlib
-{
- const char* texture_file_types::get_extension(format fmt)
- {
- CRNLIB_ASSERT(fmt < cNumFileFormats);
- if (fmt >= cNumFileFormats)
- return NULL;
-
- static const char* extensions[cNumFileFormats] =
- {
- "dds",
- "crn",
- "ktx",
-
- "tga",
- "png",
- "jpg",
- "jpeg",
- "bmp",
- "gif",
- "tif",
- "tiff",
- "ppm",
- "pgm",
- "psd",
- "jp2",
-
- "<clipboard>",
- "<dragdrop>"
- };
- return extensions[fmt];
- }
-
- texture_file_types::format texture_file_types::determine_file_format(const char* pFilename)
- {
- dynamic_string ext;
- if (!file_utils::split_path(pFilename, NULL, NULL, NULL, &ext))
- return cFormatInvalid;
-
- if (ext.is_empty())
- return cFormatInvalid;
-
- if (ext[0] == '.')
- ext.right(1);
-
- for (uint i = 0; i < cNumFileFormats; i++)
- if (ext == get_extension(static_cast<format>(i)))
- return static_cast<format>(i);
-
- return cFormatInvalid;
- }
-
- bool texture_file_types::supports_mipmaps(format fmt)
- {
- switch (fmt)
- {
- case cFormatCRN:
- case cFormatDDS:
- case cFormatKTX:
- return true;
- default: break;
- }
-
- return false;
- }
-
- bool texture_file_types::supports_alpha(format fmt)
- {
- switch (fmt)
- {
- case cFormatJPG:
- case cFormatJPEG:
- case cFormatGIF:
- case cFormatJP2:
- return false;
- default: break;
- }
-
- return true;
- }
-
- const char* get_texture_type_desc(texture_type t)
- {
- switch (t)
- {
- case cTextureTypeUnknown: return "Unknown";
- case cTextureTypeRegularMap: return "2D map";
- case cTextureTypeNormalMap: return "Normal map";
- case cTextureTypeVerticalCrossCubemap: return "Vertical Cross Cubemap";
- case cTextureTypeCubemap: return "Cubemap";
- default: break;
- }
-
- CRNLIB_ASSERT(false);
-
- return "?";
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_texture_file_types.h b/Libraries/crunch-ea9b8d/crnlib/crn_texture_file_types.h
deleted file mode 100644
index dba4ed66..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_texture_file_types.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// File: crn_texture_file_types.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "../inc/crnlib.h"
-#include "crn_vec.h"
-#include "crn_pixel_format.h"
-
-namespace crnlib
-{
- struct texture_file_types
- {
- enum format
- {
- cFormatInvalid = -1,
-
- cFormatDDS,
- cFormatCRN,
- cFormatKTX,
-
- cNumMipmappedFileFormats,
-
- cFormatTGA = cNumMipmappedFileFormats,
- cFormatPNG,
- cFormatJPG,
- cFormatJPEG,
- cFormatBMP,
- cFormatGIF,
- cFormatTIF,
- cFormatTIFF,
- cFormatPPM,
- cFormatPGM,
- cFormatPSD,
- cFormatJP2,
-
- cNumRegularFileFormats,
-
- cNumImageFileFormats = cNumRegularFileFormats - cNumMipmappedFileFormats,
-
- // Not really a file format
- cFormatClipboard = cNumRegularFileFormats,
- cFormatDragDrop,
-
- cNumFileFormats
- };
-
- static const char* get_extension(format fmt);
-
- static format determine_file_format(const char* pFilename);
-
- static bool supports_mipmaps(format fmt);
- static bool supports_alpha(format fmt);
- };
-
- enum texture_type
- {
- cTextureTypeUnknown = 0,
- cTextureTypeRegularMap,
- cTextureTypeNormalMap,
- cTextureTypeVerticalCrossCubemap,
- cTextureTypeCubemap,
-
- cNumTextureTypes
- };
-
- const char* get_texture_type_desc(texture_type t);
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_threaded_clusterizer.h b/Libraries/crunch-ea9b8d/crnlib/crn_threaded_clusterizer.h
deleted file mode 100644
index 6d045dc6..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_threaded_clusterizer.h
+++ /dev/null
@@ -1,362 +0,0 @@
-// File: crn_threaded_clusterizer.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_clusterizer.h"
-#include "crn_threading.h"
-
-namespace crnlib
-{
- template<typename VectorType>
- class threaded_clusterizer
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(threaded_clusterizer);
-
- public:
- threaded_clusterizer(task_pool& tp) :
- m_pTask_pool(&tp),
- m_pProgress_callback(NULL),
- m_pProgress_callback_data(NULL),
- m_canceled(false)
- {
- }
-
- void clear()
- {
- for (uint i = 0; i < cMaxClusterizers; i++)
- m_clusterizers[i].clear();
- }
-
- struct weighted_vec
- {
- weighted_vec() { }
- weighted_vec(const VectorType& v, uint w) : m_vec(v), m_weight(w) { }
-
- VectorType m_vec;
- uint m_weight;
- };
- typedef crnlib::vector<weighted_vec> weighted_vec_array;
-
- typedef bool (*progress_callback_func)(uint percentage_completed, void* pProgress_data);
-
- bool create_clusters(
- const weighted_vec_array& weighted_vecs,
- uint max_clusters, crnlib::vector< crnlib::vector<uint> >& cluster_indices,
- progress_callback_func pProgress_callback,
- void* pProgress_callback_data)
- {
- m_main_thread_id = crn_get_current_thread_id();
- m_canceled = false;
- m_pProgress_callback = pProgress_callback;
- m_pProgress_callback_data = pProgress_callback_data;
-
- if (max_clusters >= 128)
- {
- crnlib::vector<uint> primary_indices(weighted_vecs.size());
- for (uint i = 0; i < weighted_vecs.size(); i++)
- primary_indices[i] = i;
-
- CRNLIB_ASSUME(cMaxClusterizers == 4);
-
- crnlib::vector<uint> indices[6];
-
- compute_split(weighted_vecs, primary_indices, indices[0], indices[1]);
- compute_split(weighted_vecs, indices[0], indices[2], indices[3]);
- compute_split(weighted_vecs, indices[1], indices[4], indices[5]);
-
- create_clusters_task_state task_state[4];
-
- m_cluster_task_displayed_progress = false;
-
- uint total_partitions = 0;
- for (uint i = 0; i < 4; i++)
- {
- const uint num_indices = indices[2 + i].size();
- if (num_indices)
- total_partitions++;
- }
-
- for (uint i = 0; i < 4; i++)
- {
- const uint num_indices = indices[2 + i].size();
- if (!num_indices)
- continue;
-
- task_state[i].m_pWeighted_vecs = &weighted_vecs;
- task_state[i].m_pIndices = &indices[2 + i];
- task_state[i].m_max_clusters = (max_clusters + (total_partitions / 2)) / total_partitions;
-
- m_pTask_pool->queue_object_task(this, &threaded_clusterizer::create_clusters_task, i, &task_state[i]);
- }
-
- m_pTask_pool->join();
-
- if (m_canceled)
- return false;
-
- uint total_clusters = 0;
- for (uint i = 0; i < 4; i++)
- total_clusters += task_state[i].m_cluster_indices.size();
-
- cluster_indices.reserve(total_clusters);
- cluster_indices.resize(0);
-
- for (uint i = 0; i < 4; i++)
- {
- const uint ofs = cluster_indices.size();
-
- cluster_indices.resize(ofs + task_state[i].m_cluster_indices.size());
-
- for (uint j = 0; j < task_state[i].m_cluster_indices.size(); j++)
- {
- cluster_indices[ofs + j].swap( task_state[i].m_cluster_indices[j] );
- }
- }
- }
- else
- {
- m_clusterizers[0].clear();
- m_clusterizers[0].get_training_vecs().reserve(weighted_vecs.size());
-
- for (uint i = 0; i < weighted_vecs.size(); i++)
- {
- const weighted_vec& v = weighted_vecs[i];
-
- m_clusterizers[0].add_training_vec(v.m_vec, v.m_weight);
- }
-
- m_clusterizers[0].generate_codebook(max_clusters, generate_codebook_progress_callback, this, false);//m_params.m_dxt_quality <= cCRNDXTQualityFast);
-
- const uint num_clusters = m_clusterizers[0].get_codebook_size();
-
- m_clusterizers[0].retrieve_clusters(num_clusters, cluster_indices);
- }
-
- return !m_canceled;
- }
-
- private:
- task_pool* m_pTask_pool;
-
- crn_thread_id_t m_main_thread_id;
-
- struct create_clusters_task_state
- {
- create_clusters_task_state() : m_pWeighted_vecs(NULL), m_pIndices(NULL), m_max_clusters(0)
- {
- }
-
- const weighted_vec_array* m_pWeighted_vecs;
- crnlib::vector<uint>* m_pIndices;
- crnlib::vector< crnlib::vector<uint> > m_cluster_indices;
- uint m_max_clusters;
- };
-
- typedef clusterizer<VectorType> vector_clusterizer;
-
- enum { cMaxClusterizers = 4 };
- vector_clusterizer m_clusterizers[cMaxClusterizers];
- bool m_cluster_task_displayed_progress;
-
- progress_callback_func m_pProgress_callback;
- void* m_pProgress_callback_data;
- bool m_canceled;
-
- static bool generate_codebook_progress_callback(uint percentage_completed, void* pData)
- {
- threaded_clusterizer* pClusterizer = static_cast<threaded_clusterizer*>(pData);
-
- if (!pClusterizer->m_pProgress_callback)
- return true;
-
- if (!pClusterizer->m_pProgress_callback(percentage_completed, pClusterizer->m_pProgress_callback_data))
- {
- pClusterizer->m_canceled = true;
- return false;
- }
- return true;
- }
-
- void compute_pca(VectorType& axis_res, VectorType& centroid_res, const weighted_vec_array& vecs, const vector<uint>& indices)
- {
- const uint N = VectorType::num_elements;
-
- VectorType centroid(0.0f);
- double total_weight = 0.0f;
- for (uint i = 0; i < indices.size(); i++)
- {
- const weighted_vec& v = vecs[indices[i]];
- centroid += v.m_vec * static_cast<float>(v.m_weight);
- total_weight += v.m_weight;
- }
-
- if (total_weight == 0.0f)
- {
- axis_res.clear();
- centroid_res = centroid;
- return;
- }
-
- double one_over_total_weight = 1.0f / total_weight;
- for (uint i = 0; i < N; i++)
- centroid[i] = static_cast<float>(centroid[i] * one_over_total_weight);
-
- matrix<N, N, float> covar;
- covar.clear();
-
- for (uint i = 0; i < indices.size(); i++)
- {
- const weighted_vec& weighted_vec = vecs[indices[i]];
-
- const VectorType v(weighted_vec.m_vec - centroid);
- const VectorType w(v * static_cast<float>(weighted_vec.m_weight));
-
- for (uint x = 0; x < N; x++)
- for (uint y = x; y < N; y++)
- covar[x][y] = covar[x][y] + v[x] * w[y];
- }
-
- for (uint x = 0; x < N; x++)
- for (uint y = x; y < N; y++)
- covar[x][y] = static_cast<float>(covar[x][y] * one_over_total_weight);
-
- for (uint x = 0; x < (N - 1); x++)
- for (uint y = x + 1; y < N; y++)
- covar[y][x] = covar[x][y];
-
- VectorType axis;
- for (uint i = 0; i < N; i++)
- axis[i] = math::lerp(.75f, 1.25f, i * (1.0f / (N - 1)));
-
- VectorType prev_axis(axis);
-
- const uint cMaxIterations = 10;
- for (uint iter = 0; iter < cMaxIterations; iter++)
- {
- VectorType x;
-
- double max_sum = 0;
-
- for (uint i = 0; i < N; i++)
- {
- double sum = 0;
-
- for (uint j = 0; j < N; j++)
- sum += axis[j] * covar[i][j];
-
- x[i] = static_cast<float>(sum);
-
- max_sum = math::maximum(max_sum, fabs(sum));
- }
-
- if (max_sum != 0.0f)
- x *= static_cast<float>(1.0f / max_sum);
-
- VectorType delta_axis(prev_axis - x);
-
- prev_axis = axis;
- axis = x;
-
- if (delta_axis.norm() < .0025f)
- break;
- }
-
- axis.normalize();
-
- axis_res = axis;
- centroid_res = centroid;
- }
-
- void compute_division(
- const VectorType& axis, const VectorType& centroid, const weighted_vec_array& vecs, const vector<uint>& indices,
- vector<uint>& left_indices,
- vector<uint>& right_indices)
- {
- left_indices.resize(0);
- right_indices.resize(0);
-
- for (uint i = 0; i < indices.size(); i++)
- {
- const uint vec_index = indices[i];
- const VectorType v(vecs[vec_index].m_vec - centroid);
-
- float t = v * axis;
- if (t < 0.0f)
- left_indices.push_back(vec_index);
- else
- right_indices.push_back(vec_index);
- }
- }
-
- void compute_split(
- const weighted_vec_array& vecs, const vector<uint>& indices,
- vector<uint>& left_indices,
- vector<uint>& right_indices)
- {
- VectorType axis, centroid;
- compute_pca(axis, centroid, vecs, indices);
-
- compute_division(axis, centroid, vecs, indices, left_indices, right_indices);
- }
-
- static bool generate_codebook_dummy_progress_callback(uint percentage_completed, void* pData)
- {
- percentage_completed;
-
- if (static_cast<threaded_clusterizer*>(pData)->m_canceled)
- return false;
-
- return true;
- }
-
- void create_clusters_task(uint64 data, void* pData_ptr)
- {
- if (m_canceled)
- return;
-
- const uint partition_index = static_cast<uint>(data);
- create_clusters_task_state& state = *static_cast<create_clusters_task_state*>(pData_ptr);
-
- m_clusterizers[partition_index].clear();
-
- for (uint i = 0; i < state.m_pIndices->size(); i++)
- {
- const uint index = (*state.m_pIndices)[i];
- const weighted_vec& v = (*state.m_pWeighted_vecs)[index];
-
- m_clusterizers[partition_index].add_training_vec(v.m_vec, v.m_weight);
- }
-
- if (m_canceled)
- return;
-
- const bool is_main_thread = (crn_get_current_thread_id() == m_main_thread_id);
-
- const bool quick = false;
- m_clusterizers[partition_index].generate_codebook(
- state.m_max_clusters,
- (is_main_thread && !m_cluster_task_displayed_progress) ? generate_codebook_progress_callback : generate_codebook_dummy_progress_callback,
- this,
- quick);
-
- if (is_main_thread)
- m_cluster_task_displayed_progress = true;
-
- if (m_canceled)
- return;
-
- const uint num_clusters = m_clusterizers[partition_index].get_codebook_size();
-
- m_clusterizers[partition_index].retrieve_clusters(num_clusters, state.m_cluster_indices);
-
- for (uint i = 0; i < state.m_cluster_indices.size(); i++)
- {
- crnlib::vector<uint>& indices = state.m_cluster_indices[i];
-
- for (uint j = 0; j < indices.size(); j++)
- indices[j] = (*state.m_pIndices)[indices[j]];
- }
- }
-
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_threaded_resampler.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_threaded_resampler.cpp
deleted file mode 100644
index e46f3912..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_threaded_resampler.cpp
+++ /dev/null
@@ -1,322 +0,0 @@
-// File: crn_threaded_resampler.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_threaded_resampler.h"
-#include "crn_resample_filters.h"
-#include "crn_threading.h"
-
-namespace crnlib
-{
- threaded_resampler::threaded_resampler(task_pool& tp) :
- m_pTask_pool(&tp),
- m_pParams(NULL),
- m_pX_contribs(NULL),
- m_pY_contribs(NULL),
- m_bytes_per_pixel(0)
- {
- }
-
- threaded_resampler::~threaded_resampler()
- {
- free_contrib_lists();
- }
-
- void threaded_resampler::free_contrib_lists()
- {
- if (m_pX_contribs)
- {
- crnlib_free(m_pX_contribs->p);
- m_pX_contribs->p = NULL;
-
- crnlib_free(m_pX_contribs);
- m_pX_contribs = NULL;
- }
-
- if (m_pY_contribs)
- {
- crnlib_free(m_pY_contribs->p);
- m_pY_contribs->p = NULL;
-
- crnlib_free(m_pY_contribs);
- m_pY_contribs = NULL;
- }
- }
-
- void threaded_resampler::resample_x_task(uint64 data, void* pData_ptr)
- {
- pData_ptr;
- const uint thread_index = (uint)data;
-
- for (uint src_y = 0; src_y < m_pParams->m_src_height; src_y++)
- {
- if (m_pTask_pool->get_num_threads())
- {
- if ((src_y % (m_pTask_pool->get_num_threads() + 1)) != thread_index)
- continue;
- }
-
- const Resampler::Contrib_List* pContribs = m_pX_contribs;
- const Resampler::Contrib_List* pContribs_end = m_pX_contribs + m_pParams->m_dst_width;
-
- switch (m_pParams->m_fmt)
- {
- case cPF_Y_F32:
- {
- const float* pSrc = reinterpret_cast<const float*>(static_cast<const uint8*>(m_pParams->m_pSrc_pixels) + m_pParams->m_src_pitch * src_y);
- vec4F* pDst = m_tmp_img.get_ptr() + m_pParams->m_dst_width * src_y;
-
- do
- {
- const Resampler::Contrib* p = pContribs->p;
- const Resampler::Contrib* p_end = pContribs->p + pContribs->n;
-
- vec4F s(0.0f);
-
- while (p != p_end)
- {
- const uint src_pixel = p->pixel;
- const float src_weight = p->weight;
-
- s[0] += pSrc[src_pixel] * src_weight;
-
- p++;
- }
-
- *pDst++ = s;
- pContribs++;
- } while (pContribs != pContribs_end);
-
- break;
- }
- case cPF_RGBX_F32:
- {
- const vec4F* pSrc = reinterpret_cast<const vec4F*>(static_cast<const uint8*>(m_pParams->m_pSrc_pixels) + m_pParams->m_src_pitch * src_y);
- vec4F* pDst = m_tmp_img.get_ptr() + m_pParams->m_dst_width * src_y;
-
- do
- {
- const Resampler::Contrib* p = pContribs->p;
- const Resampler::Contrib* p_end = pContribs->p + pContribs->n;
-
- vec4F s(0.0f);
-
- while (p != p_end)
- {
- const float src_weight = p->weight;
-
- const vec4F& src_pixel = pSrc[p->pixel];
-
- s[0] += src_pixel[0] * src_weight;
- s[1] += src_pixel[1] * src_weight;
- s[2] += src_pixel[2] * src_weight;
-
- p++;
- }
-
- *pDst++ = s;
- pContribs++;
- } while (pContribs != pContribs_end);
-
- break;
- }
- case cPF_RGBA_F32:
- {
- const vec4F* pSrc = reinterpret_cast<const vec4F*>(static_cast<const uint8*>(m_pParams->m_pSrc_pixels) + m_pParams->m_src_pitch * src_y);
- vec4F* pDst = m_tmp_img.get_ptr() + m_pParams->m_dst_width * src_y;
-
- do
- {
- Resampler::Contrib* p = pContribs->p;
- Resampler::Contrib* p_end = pContribs->p + pContribs->n;
-
- vec4F s(0.0f);
-
- while (p != p_end)
- {
- const float src_weight = p->weight;
-
- const vec4F& src_pixel = pSrc[p->pixel];
-
- s[0] += src_pixel[0] * src_weight;
- s[1] += src_pixel[1] * src_weight;
- s[2] += src_pixel[2] * src_weight;
- s[3] += src_pixel[3] * src_weight;
-
- p++;
- }
-
- *pDst++ = s;
- pContribs++;
- } while (pContribs != pContribs_end);
-
- break;
- }
- default: break;
- }
- }
- }
-
- void threaded_resampler::resample_y_task(uint64 data, void* pData_ptr)
- {
- pData_ptr;
-
- const uint thread_index = (uint)data;
-
- crnlib::vector<vec4F> tmp(m_pParams->m_dst_width);
-
- for (uint dst_y = 0; dst_y < m_pParams->m_dst_height; dst_y++)
- {
- if (m_pTask_pool->get_num_threads())
- {
- if ((dst_y % (m_pTask_pool->get_num_threads() + 1)) != thread_index)
- continue;
- }
-
- const Resampler::Contrib_List& contribs = m_pY_contribs[dst_y];
-
- const vec4F* pSrc;
-
- if (contribs.n == 1)
- {
- pSrc = m_tmp_img.get_ptr() + m_pParams->m_dst_width * contribs.p[0].pixel;
- }
- else
- {
- for (uint src_y_iter = 0; src_y_iter < contribs.n; src_y_iter++)
- {
- const vec4F* p = m_tmp_img.get_ptr() + m_pParams->m_dst_width * contribs.p[src_y_iter].pixel;
- const float weight = contribs.p[src_y_iter].weight;
-
- if (!src_y_iter)
- {
- for (uint i = 0; i < m_pParams->m_dst_width; i++)
- tmp[i] = p[i] * weight;
- }
- else
- {
- for (uint i = 0; i < m_pParams->m_dst_width; i++)
- tmp[i] += p[i] * weight;
- }
- }
-
- pSrc = tmp.get_ptr();
- }
-
- const vec4F* pSrc_end = pSrc + m_pParams->m_dst_width;
-
- const float l = m_pParams->m_sample_low;
- const float h = m_pParams->m_sample_high;
-
- switch (m_pParams->m_fmt)
- {
- case cPF_Y_F32:
- {
- float* pDst = reinterpret_cast<float*>(static_cast<uint8*>(m_pParams->m_pDst_pixels) + m_pParams->m_dst_pitch * dst_y);
-
- do
- {
- *pDst++ = math::clamp((*pSrc)[0], l, h);
-
- pSrc++;
-
- } while (pSrc != pSrc_end);
-
- break;
- }
- case cPF_RGBX_F32:
- {
- vec4F* pDst = reinterpret_cast<vec4F*>(static_cast<uint8*>(m_pParams->m_pDst_pixels) + m_pParams->m_dst_pitch * dst_y);
-
- do
- {
- (*pDst)[0] = math::clamp((*pSrc)[0], l, h);
- (*pDst)[1] = math::clamp((*pSrc)[1], l, h);
- (*pDst)[2] = math::clamp((*pSrc)[2], l, h);
- (*pDst)[3] = h;
-
- pSrc++;
- pDst++;
-
- } while (pSrc != pSrc_end);
-
- break;
- }
- case cPF_RGBA_F32:
- {
- vec4F* pDst = reinterpret_cast<vec4F*>(static_cast<uint8*>(m_pParams->m_pDst_pixels) + m_pParams->m_dst_pitch * dst_y);
-
- do
- {
- (*pDst)[0] = math::clamp((*pSrc)[0], l, h);
- (*pDst)[1] = math::clamp((*pSrc)[1], l, h);
- (*pDst)[2] = math::clamp((*pSrc)[2], l, h);
- (*pDst)[3] = math::clamp((*pSrc)[3], l, h);
-
- pSrc++;
- pDst++;
-
- } while (pSrc != pSrc_end);
-
- break;
- }
- default: break;
- }
- }
- }
-
- bool threaded_resampler::resample(const params& p)
- {
- free_contrib_lists();
-
- m_pParams = &p;
-
- CRNLIB_ASSERT(m_pParams->m_src_width && m_pParams->m_src_height);
- CRNLIB_ASSERT(m_pParams->m_dst_width && m_pParams->m_dst_height);
-
- switch (p.m_fmt)
- {
- case cPF_Y_F32:
- m_bytes_per_pixel = 4;
- break;
- case cPF_RGBX_F32:
- case cPF_RGBA_F32:
- m_bytes_per_pixel = 16;
- break;
- default:
- CRNLIB_ASSERT(false);
- return false;
- }
-
- int filter_index = find_resample_filter(p.m_Pfilter_name);
- if (filter_index < 0)
- return false;
-
- const resample_filter& filter = g_resample_filters[filter_index];
-
- m_pX_contribs = Resampler::make_clist(m_pParams->m_src_width, m_pParams->m_dst_width, m_pParams->m_boundary_op, filter.func, filter.support, p.m_filter_x_scale, 0.0f);
- if (!m_pX_contribs)
- return false;
-
- m_pY_contribs = Resampler::make_clist(m_pParams->m_src_height, m_pParams->m_dst_height, m_pParams->m_boundary_op, filter.func, filter.support, p.m_filter_y_scale, 0.0f);
- if (!m_pY_contribs)
- return false;
-
- if (!m_tmp_img.try_resize(m_pParams->m_dst_width * m_pParams->m_src_height))
- return false;
-
- for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
- m_pTask_pool->queue_object_task(this, &threaded_resampler::resample_x_task, i, NULL);
- m_pTask_pool->join();
-
- for (uint i = 0; i <= m_pTask_pool->get_num_threads(); i++)
- m_pTask_pool->queue_object_task(this, &threaded_resampler::resample_y_task, i, NULL);
- m_pTask_pool->join();
-
- m_tmp_img.clear();
- free_contrib_lists();
-
- return true;
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_threaded_resampler.h b/Libraries/crunch-ea9b8d/crnlib/crn_threaded_resampler.h
deleted file mode 100644
index e94a8b65..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_threaded_resampler.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// File: crn_threaded_resampler.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_resampler.h"
-#include "crn_vec.h"
-
-namespace crnlib
-{
- class task_pool;
- class threaded_resampler
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(threaded_resampler);
-
- public:
- threaded_resampler(task_pool& tp);
- ~threaded_resampler();
-
- enum pixel_format
- {
- cPF_Y_F32,
- cPF_RGBX_F32,
- cPF_RGBA_F32,
-
- cPF_Total
- };
-
- struct params
- {
- params()
- {
- clear();
- }
-
- void clear()
- {
- utils::zero_object(*this);
-
- m_boundary_op = Resampler::BOUNDARY_CLAMP;
- m_sample_low = 0.0f;
- m_sample_high = 255.0f;
- m_Pfilter_name = CRNLIB_RESAMPLER_DEFAULT_FILTER;
- m_filter_x_scale = 1.0f;
- m_filter_y_scale = 1.0f;
- }
-
- pixel_format m_fmt;
-
- const void* m_pSrc_pixels;
- uint m_src_width;
- uint m_src_height;
- uint m_src_pitch;
-
- void* m_pDst_pixels;
- uint m_dst_width;
- uint m_dst_height;
- uint m_dst_pitch;
-
- Resampler::Boundary_Op m_boundary_op;
-
- float m_sample_low;
- float m_sample_high;
-
- const char* m_Pfilter_name;
- float m_filter_x_scale;
- float m_filter_y_scale;
- };
-
- bool resample(const params& p);
-
- private:
- task_pool* m_pTask_pool;
-
- const params* m_pParams;
-
- Resampler::Contrib_List* m_pX_contribs;
- Resampler::Contrib_List* m_pY_contribs;
- uint m_bytes_per_pixel;
-
- crnlib::vector<vec4F> m_tmp_img;
-
- void free_contrib_lists();
-
- void resample_x_task(uint64 data, void* pData_ptr);
- void resample_y_task(uint64 data, void* pData_ptr);
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_threading.h b/Libraries/crunch-ea9b8d/crnlib/crn_threading.h
deleted file mode 100644
index 55463af6..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_threading.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// File: crn_threading.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-
-#if CRNLIB_USE_WIN32_API
- #include "crn_threading_win32.h"
-#elif CRNLIB_USE_PTHREADS_API
- #include "crn_threading_pthreads.h"
-#else
- #include "crn_threading_null.h"
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_threading_null.h b/Libraries/crunch-ea9b8d/crnlib/crn_threading_null.h
deleted file mode 100644
index c52bef7d..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_threading_null.h
+++ /dev/null
@@ -1,192 +0,0 @@
-// File: crn_threading_null.h
-// See Copyright Notice and license at the end of include/crnlib.h
-#pragma once
-
-#include "crn_atomics.h"
-
-namespace crnlib
-{
- const uint g_number_of_processors = 1;
-
- inline void crn_threading_init()
- {
- }
-
- typedef uint64 crn_thread_id_t;
- inline crn_thread_id_t crn_get_current_thread_id()
- {
- return 0;
- }
-
- inline void crn_sleep(unsigned int milliseconds)
- {
- milliseconds;
- }
-
- inline uint crn_get_max_helper_threads()
- {
- return 0;
- }
-
- class mutex
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(mutex);
-
- public:
- inline mutex(unsigned int spin_count = 0)
- {
- spin_count;
- }
-
- inline ~mutex()
- {
- }
-
- inline void lock()
- {
- }
-
- inline void unlock()
- {
- }
-
- inline void set_spin_count(unsigned int count)
- {
- count;
- }
- };
-
- class scoped_mutex
- {
- scoped_mutex(const scoped_mutex&);
- scoped_mutex& operator= (const scoped_mutex&);
-
- public:
- inline scoped_mutex(mutex& lock) : m_lock(lock) { m_lock.lock(); }
- inline ~scoped_mutex() { m_lock.unlock(); }
-
- private:
- mutex& m_lock;
- };
-
- // Simple non-recursive spinlock.
- class spinlock
- {
- public:
- inline spinlock()
- {
- }
-
- inline void lock(uint32 max_spins = 4096, bool yielding = true, bool memoryBarrier = true)
- {
- max_spins, yielding, memoryBarrier;
- }
-
- inline void lock_no_barrier(uint32 max_spins = 4096, bool yielding = true)
- {
- max_spins, yielding;
- }
-
- inline void unlock()
- {
- }
-
- inline void unlock_no_barrier()
- {
- }
- };
-
- class scoped_spinlock
- {
- scoped_spinlock(const scoped_spinlock&);
- scoped_spinlock& operator= (const scoped_spinlock&);
-
- public:
- inline scoped_spinlock(spinlock& lock) : m_lock(lock) { m_lock.lock(); }
- inline ~scoped_spinlock() { m_lock.unlock(); }
-
- private:
- spinlock& m_lock;
- };
-
- class semaphore
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(semaphore);
-
- public:
- inline semaphore(long initialCount = 0, long maximumCount = 1, const char* pName = NULL)
- {
- initialCount, maximumCount, pName;
- }
-
- inline ~semaphore()
- {
- }
-
- inline void release(long releaseCount = 1, long *pPreviousCount = NULL)
- {
- releaseCount, pPreviousCount;
- }
-
- inline bool wait(uint32 milliseconds = cUINT32_MAX)
- {
- milliseconds;
- return true;
- }
- };
-
- class task_pool
- {
- public:
- inline task_pool() { }
- inline task_pool(uint num_threads) { num_threads; }
- inline ~task_pool() { }
-
- inline bool init(uint num_threads) { num_threads; return true; }
- inline void deinit() { }
-
- inline uint get_num_threads() const { return 0; }
- inline uint get_num_outstanding_tasks() const { return 0; }
-
- // C-style task callback
- typedef void (*task_callback_func)(uint64 data, void* pData_ptr);
- inline bool queue_task(task_callback_func pFunc, uint64 data = 0, void* pData_ptr = NULL)
- {
- pFunc(data, pData_ptr);
- return true;
- }
-
- class executable_task
- {
- public:
- virtual void execute_task(uint64 data, void* pData_ptr) = 0;
- };
-
- // It's the caller's responsibility to delete pObj within the execute_task() method, if needed!
- inline bool queue_task(executable_task* pObj, uint64 data = 0, void* pData_ptr = NULL)
- {
- pObj->execute_task(data, pData_ptr);
- return true;
- }
-
- template<typename S, typename T>
- inline bool queue_object_task(S* pObject, T pObject_method, uint64 data = 0, void* pData_ptr = NULL)
- {
- (pObject->*pObject_method)(data, pData_ptr);
- return true;
- }
-
- template<typename S, typename T>
- inline bool queue_multiple_object_tasks(S* pObject, T pObject_method, uint64 first_data, uint num_tasks, void* pData_ptr = NULL)
- {
- for (uint i = 0; i < num_tasks; i++)
- {
- (pObject->*pObject_method)(first_data + i, pData_ptr);
- }
- return true;
- }
-
- inline void join() { }
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_threading_pthreads.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_threading_pthreads.cpp
deleted file mode 100644
index f57adb2d..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_threading_pthreads.cpp
+++ /dev/null
@@ -1,408 +0,0 @@
-// File: crn_threading_pthreads.cpp
-// See Copyright Notice and license at the end of include/crnlib.h
-#include "crn_core.h"
-#include "crn_threading_pthreads.h"
-#include "crn_timer.h"
-
-#if CRNLIB_USE_PTHREADS_API
-
-#ifdef WIN32
-#pragma comment(lib, "../ext/libpthread/lib/pthreadVC2.lib")
-#include "crn_winhdr.h"
-#endif
-
-#ifdef __GNUC__
-#include <sys/sysinfo.h>
-#endif
-
-#ifdef WIN32
-#include <process.h>
-#endif
-
-namespace crnlib
-{
- uint g_number_of_processors = 1;
-
- void crn_threading_init()
- {
-#ifdef WIN32
- SYSTEM_INFO g_system_info;
- GetSystemInfo(&g_system_info);
- g_number_of_processors = math::maximum<uint>(1U, g_system_info.dwNumberOfProcessors);
-#elif defined(__GNUC__)
- g_number_of_processors = math::maximum<int>(1, get_nprocs());
-#else
- g_number_of_processors = 1;
-#endif
- }
-
- crn_thread_id_t crn_get_current_thread_id()
- {
- // FIXME: Not portable
- return static_cast<crn_thread_id_t>(pthread_self());
- }
-
- void crn_sleep(unsigned int milliseconds)
- {
-#ifdef WIN32
- struct timespec interval;
- interval.tv_sec = milliseconds / 1000;
- interval.tv_nsec = (milliseconds % 1000) * 1000000L;
- pthread_delay_np(&interval);
-#else
- while (milliseconds)
- {
- int msecs_to_sleep = CRNLIB_MIN(milliseconds, 1000);
- usleep(msecs_to_sleep * 1000);
- milliseconds -= msecs_to_sleep;
- }
-#endif
- }
-
- mutex::mutex(unsigned int spin_count)
- {
- spin_count;
-
- if (pthread_mutex_init(&m_mutex, NULL))
- crnlib_fail("mutex::mutex: pthread_mutex_init() failed", __FILE__, __LINE__);
-
-#ifdef CRNLIB_BUILD_DEBUG
- m_lock_count = 0;
-#endif
- }
-
- mutex::~mutex()
- {
-#ifdef CRNLIB_BUILD_DEBUG
- if (m_lock_count)
- crnlib_assert("mutex::~mutex: mutex is still locked", __FILE__, __LINE__);
-#endif
- if (pthread_mutex_destroy(&m_mutex))
- crnlib_assert("mutex::~mutex: pthread_mutex_destroy() failed", __FILE__, __LINE__);
- }
-
- void mutex::lock()
- {
- pthread_mutex_lock(&m_mutex);
-#ifdef CRNLIB_BUILD_DEBUG
- m_lock_count++;
-#endif
- }
-
- void mutex::unlock()
- {
-#ifdef CRNLIB_BUILD_DEBUG
- if (!m_lock_count)
- crnlib_assert("mutex::unlock: mutex is not locked", __FILE__, __LINE__);
- m_lock_count--;
-#endif
- pthread_mutex_unlock(&m_mutex);
- }
-
- void mutex::set_spin_count(unsigned int count)
- {
- count;
- }
-
- semaphore::semaphore(long initialCount, long maximumCount, const char* pName)
- {
- maximumCount, pName;
- CRNLIB_ASSERT(maximumCount >= initialCount);
- if (sem_init(&m_sem, 0, initialCount))
- {
- CRNLIB_FAIL("semaphore: sem_init() failed");
- }
- }
-
- semaphore::~semaphore()
- {
- sem_destroy(&m_sem);
- }
-
- void semaphore::release(long releaseCount)
- {
- CRNLIB_ASSERT(releaseCount >= 1);
-
- int status = 0;
-#ifdef WIN32
- if (1 == releaseCount)
- status = sem_post(&m_sem);
- else
- status = sem_post_multiple(&m_sem, releaseCount);
-#else
- while (releaseCount > 0)
- {
- status = sem_post(&m_sem);
- if (status)
- break;
- releaseCount--;
- }
-#endif
-
- if (status)
- {
- CRNLIB_FAIL("semaphore: sem_post() or sem_post_multiple() failed");
- }
- }
-
- void semaphore::try_release(long releaseCount)
- {
- CRNLIB_ASSERT(releaseCount >= 1);
-
-#ifdef WIN32
- if (1 == releaseCount)
- sem_post(&m_sem);
- else
- sem_post_multiple(&m_sem, releaseCount);
-#else
- while (releaseCount > 0)
- {
- sem_post(&m_sem);
- releaseCount--;
- }
-#endif
- }
-
- bool semaphore::wait(uint32 milliseconds)
- {
- int status;
- if (milliseconds == cUINT32_MAX)
- {
- status = sem_wait(&m_sem);
- }
- else
- {
- struct timespec interval;
- interval.tv_sec = milliseconds / 1000;
- interval.tv_nsec = (milliseconds % 1000) * 1000000L;
- status = sem_timedwait(&m_sem, &interval);
- }
-
- if (status)
- {
- if (errno != ETIMEDOUT)
- {
- CRNLIB_FAIL("semaphore: sem_wait() or sem_timedwait() failed");
- }
- return false;
- }
-
- return true;
- }
-
- spinlock::spinlock()
- {
- if (pthread_spin_init(&m_spinlock, 0))
- {
- CRNLIB_FAIL("spinlock: pthread_spin_init() failed");
- }
- }
-
- spinlock::~spinlock()
- {
- pthread_spin_destroy(&m_spinlock);
- }
-
- void spinlock::lock()
- {
- if (pthread_spin_lock(&m_spinlock))
- {
- CRNLIB_FAIL("spinlock: pthread_spin_lock() failed");
- }
- }
-
- void spinlock::unlock()
- {
- if (pthread_spin_unlock(&m_spinlock))
- {
- CRNLIB_FAIL("spinlock: pthread_spin_unlock() failed");
- }
- }
-
- task_pool::task_pool() :
- m_num_threads(0),
- m_tasks_available(0, 32767),
- m_all_tasks_completed(0, 1),
- m_total_submitted_tasks(0),
- m_total_completed_tasks(0),
- m_exit_flag(false)
- {
- utils::zero_object(m_threads);
- }
-
- task_pool::task_pool(uint num_threads) :
- m_num_threads(0),
- m_tasks_available(0, 32767),
- m_all_tasks_completed(0, 1),
- m_total_submitted_tasks(0),
- m_total_completed_tasks(0),
- m_exit_flag(false)
- {
- utils::zero_object(m_threads);
-
- bool status = init(num_threads);
- CRNLIB_VERIFY(status);
- }
-
- task_pool::~task_pool()
- {
- deinit();
- }
-
- bool task_pool::init(uint num_threads)
- {
- CRNLIB_ASSERT(num_threads <= cMaxThreads);
- num_threads = math::minimum<uint>(num_threads, cMaxThreads);
-
- deinit();
-
- bool succeeded = true;
-
- m_num_threads = 0;
- while (m_num_threads < num_threads)
- {
- int status = pthread_create(&m_threads[m_num_threads], NULL, thread_func, this);
- if (status)
- {
- succeeded = false;
- break;
- }
-
- m_num_threads++;
- }
-
- if (!succeeded)
- {
- deinit();
- return false;
- }
-
- return true;
- }
-
- void task_pool::deinit()
- {
- if (m_num_threads)
- {
- join();
-
- atomic_exchange32(&m_exit_flag, true);
-
- m_tasks_available.release(m_num_threads);
-
- for (uint i = 0; i < m_num_threads; i++)
- pthread_join(m_threads[i], NULL);
-
- m_num_threads = 0;
-
- atomic_exchange32(&m_exit_flag, false);
- }
-
- m_task_stack.clear();
- m_total_submitted_tasks = 0;
- m_total_completed_tasks = 0;
- }
-
- bool task_pool::queue_task(task_callback_func pFunc, uint64 data, void* pData_ptr)
- {
- CRNLIB_ASSERT(pFunc);
-
- task tsk;
- tsk.m_callback = pFunc;
- tsk.m_data = data;
- tsk.m_pData_ptr = pData_ptr;
- tsk.m_flags = 0;
-
- atomic_increment32(&m_total_submitted_tasks);
- if (!m_task_stack.try_push(tsk))
- {
- atomic_increment32(&m_total_completed_tasks);
- return false;
- }
-
- m_tasks_available.release(1);
-
- return true;
- }
-
- // It's the object's responsibility to delete pObj within the execute_task() method, if needed!
- bool task_pool::queue_task(executable_task* pObj, uint64 data, void* pData_ptr)
- {
- CRNLIB_ASSERT(pObj);
-
- task tsk;
- tsk.m_pObj = pObj;
- tsk.m_data = data;
- tsk.m_pData_ptr = pData_ptr;
- tsk.m_flags = cTaskFlagObject;
-
- atomic_increment32(&m_total_submitted_tasks);
- if (!m_task_stack.try_push(tsk))
- {
- atomic_increment32(&m_total_completed_tasks);
- return false;
- }
-
- m_tasks_available.release(1);
-
- return true;
- }
-
- void task_pool::process_task(task& tsk)
- {
- if (tsk.m_flags & cTaskFlagObject)
- tsk.m_pObj->execute_task(tsk.m_data, tsk.m_pData_ptr);
- else
- tsk.m_callback(tsk.m_data, tsk.m_pData_ptr);
-
- if (atomic_increment32(&m_total_completed_tasks) == m_total_submitted_tasks)
- {
- // Try to signal the semaphore (the max count is 1 so this may actually fail).
- m_all_tasks_completed.try_release();
- }
- }
-
- void task_pool::join()
- {
- // Try to steal any outstanding tasks. This could cause one or more worker threads to wake up and immediately go back to sleep, which is wasteful but should be harmless.
- task tsk;
- while (m_task_stack.pop(tsk))
- process_task(tsk);
-
- // At this point the task stack is empty.
- // Now wait for all concurrent tasks to complete. The m_all_tasks_completed semaphore has a max count of 1, so it's possible it could have saturated to 1 as the tasks
- // where issued and asynchronously completed, so this loop may iterate a few times.
- const int total_submitted_tasks = atomic_add32(&m_total_submitted_tasks, 0);
- while (m_total_completed_tasks != total_submitted_tasks)
- {
- // If the previous (m_total_completed_tasks != total_submitted_tasks) check failed the semaphore MUST be eventually signalled once the last task completes.
- // So I think this can actually be an INFINITE delay, but it shouldn't really matter if it's 1ms.
- m_all_tasks_completed.wait(1);
- }
- }
-
- void * task_pool::thread_func(void *pContext)
- {
- task_pool* pPool = static_cast<task_pool*>(pContext);
- task tsk;
-
- for ( ; ; )
- {
- if (!pPool->m_tasks_available.wait())
- break;
-
- if (pPool->m_exit_flag)
- break;
-
- if (pPool->m_task_stack.pop(tsk))
- {
- pPool->process_task(tsk);
- }
- }
-
- return NULL;
- }
-
-} // namespace crnlib
-
-#endif // CRNLIB_USE_PTHREADS_API
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_threading_pthreads.h b/Libraries/crunch-ea9b8d/crnlib/crn_threading_pthreads.h
deleted file mode 100644
index 547bb884..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_threading_pthreads.h
+++ /dev/null
@@ -1,346 +0,0 @@
-// File: crn_threading_pthreads.h
-// See Copyright Notice and license at the end of include/crnlib.h
-#pragma once
-
-#if CRNLIB_USE_PTHREADS_API
-
-#include "crn_atomics.h"
-
-#if CRNLIB_NO_ATOMICS
-#error No atomic operations defined in crn_platform.h!
-#endif
-
-#include <pthread.h>
-#include <semaphore.h>
-#include <unistd.h>
-
-namespace crnlib
-{
- // g_number_of_processors defaults to 1. Will be higher on multicore machines.
- extern uint g_number_of_processors;
-
- void crn_threading_init();
-
- typedef uint64 crn_thread_id_t;
- crn_thread_id_t crn_get_current_thread_id();
-
- void crn_sleep(unsigned int milliseconds);
-
- uint crn_get_max_helper_threads();
-
- class mutex
- {
- mutex(const mutex&);
- mutex& operator= (const mutex&);
-
- public:
- mutex(unsigned int spin_count = 0);
- ~mutex();
- void lock();
- void unlock();
- void set_spin_count(unsigned int count);
-
- private:
- pthread_mutex_t m_mutex;
-
-#ifdef CRNLIB_BUILD_DEBUG
- unsigned int m_lock_count;
-#endif
- };
-
- class scoped_mutex
- {
- scoped_mutex(const scoped_mutex&);
- scoped_mutex& operator= (const scoped_mutex&);
-
- public:
- inline scoped_mutex(mutex& m) : m_mutex(m) { m_mutex.lock(); }
- inline ~scoped_mutex() { m_mutex.unlock(); }
-
- private:
- mutex& m_mutex;
- };
-
- class semaphore
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(semaphore);
-
- public:
- semaphore(long initialCount = 0, long maximumCount = 1, const char* pName = NULL);
- ~semaphore();
-
- void release(long releaseCount = 1);
- void try_release(long releaseCount = 1);
- bool wait(uint32 milliseconds = cUINT32_MAX);
-
- private:
- sem_t m_sem;
- };
-
- class spinlock
- {
- public:
- spinlock();
- ~spinlock();
-
- void lock();
- void unlock();
-
- private:
- pthread_spinlock_t m_spinlock;
- };
-
- class scoped_spinlock
- {
- scoped_spinlock(const scoped_spinlock&);
- scoped_spinlock& operator= (const scoped_spinlock&);
-
- public:
- inline scoped_spinlock(spinlock& lock) : m_lock(lock) { m_lock.lock(); }
- inline ~scoped_spinlock() { m_lock.unlock(); }
-
- private:
- spinlock& m_lock;
- };
-
- template<typename T, uint cMaxSize>
- class tsstack
- {
- public:
- inline tsstack() :
- m_top(0)
- {
- }
-
- inline ~tsstack()
- {
- }
-
- inline void clear()
- {
- m_spinlock.lock();
- m_top = 0;
- m_spinlock.unlock();
- }
-
- inline bool try_push(const T& obj)
- {
- bool result = false;
- m_spinlock.lock();
- if (m_top < (int)cMaxSize)
- {
- m_stack[m_top++] = obj;
- result = true;
- }
- m_spinlock.unlock();
- return result;
- }
-
- inline bool pop(T& obj)
- {
- bool result = false;
- m_spinlock.lock();
- if (m_top > 0)
- {
- obj = m_stack[--m_top];
- result = true;
- }
- m_spinlock.unlock();
- return result;
- }
-
- private:
- spinlock m_spinlock;
- T m_stack[cMaxSize];
- int m_top;
- };
-
- class task_pool
- {
- public:
- task_pool();
- task_pool(uint num_threads);
- ~task_pool();
-
- enum { cMaxThreads = 16 };
- bool init(uint num_threads);
- void deinit();
-
- inline uint get_num_threads() const { return m_num_threads; }
- inline uint32 get_num_outstanding_tasks() const { return m_total_submitted_tasks - m_total_completed_tasks; }
-
- // C-style task callback
- typedef void (*task_callback_func)(uint64 data, void* pData_ptr);
- bool queue_task(task_callback_func pFunc, uint64 data = 0, void* pData_ptr = NULL);
-
- class executable_task
- {
- public:
- virtual void execute_task(uint64 data, void* pData_ptr) = 0;
- };
-
- // It's the caller's responsibility to delete pObj within the execute_task() method, if needed!
- bool queue_task(executable_task* pObj, uint64 data = 0, void* pData_ptr = NULL);
-
- template<typename S, typename T>
- inline bool queue_object_task(S* pObject, T pObject_method, uint64 data = 0, void* pData_ptr = NULL);
-
- template<typename S, typename T>
- inline bool queue_multiple_object_tasks(S* pObject, T pObject_method, uint64 first_data, uint num_tasks, void* pData_ptr = NULL);
-
- void join();
-
- private:
- struct task
- {
- inline task() : m_data(0), m_pData_ptr(NULL), m_pObj(NULL), m_flags(0) { }
-
- uint64 m_data;
- void* m_pData_ptr;
-
- union
- {
- task_callback_func m_callback;
- executable_task* m_pObj;
- };
-
- uint m_flags;
- };
-
- tsstack<task, cMaxThreads> m_task_stack;
-
- uint m_num_threads;
- pthread_t m_threads[cMaxThreads];
-
- // Signalled whenever a task is queued up.
- semaphore m_tasks_available;
-
- // Signalled when all outstanding tasks are completed.
- semaphore m_all_tasks_completed;
-
- enum task_flags
- {
- cTaskFlagObject = 1
- };
-
- volatile atomic32_t m_total_submitted_tasks;
- volatile atomic32_t m_total_completed_tasks;
- volatile atomic32_t m_exit_flag;
-
- void process_task(task& tsk);
-
- static void* thread_func(void *pContext);
- };
-
- enum object_task_flags
- {
- cObjectTaskFlagDefault = 0,
- cObjectTaskFlagDeleteAfterExecution = 1
- };
-
- template<typename T>
- class object_task : public task_pool::executable_task
- {
- public:
- object_task(uint flags = cObjectTaskFlagDefault) :
- m_pObject(NULL),
- m_pMethod(NULL),
- m_flags(flags)
- {
- }
-
- typedef void (T::*object_method_ptr)(uint64 data, void* pData_ptr);
-
- object_task(T* pObject, object_method_ptr pMethod, uint flags = cObjectTaskFlagDefault) :
- m_pObject(pObject),
- m_pMethod(pMethod),
- m_flags(flags)
- {
- CRNLIB_ASSERT(pObject && pMethod);
- }
-
- void init(T* pObject, object_method_ptr pMethod, uint flags = cObjectTaskFlagDefault)
- {
- CRNLIB_ASSERT(pObject && pMethod);
-
- m_pObject = pObject;
- m_pMethod = pMethod;
- m_flags = flags;
- }
-
- T* get_object() const { return m_pObject; }
- object_method_ptr get_method() const { return m_pMethod; }
-
- virtual void execute_task(uint64 data, void* pData_ptr)
- {
- (m_pObject->*m_pMethod)(data, pData_ptr);
-
- if (m_flags & cObjectTaskFlagDeleteAfterExecution)
- crnlib_delete(this);
- }
-
- protected:
- T* m_pObject;
-
- object_method_ptr m_pMethod;
-
- uint m_flags;
- };
-
- template<typename S, typename T>
- inline bool task_pool::queue_object_task(S* pObject, T pObject_method, uint64 data, void* pData_ptr)
- {
- object_task<S> *pTask = crnlib_new< object_task<S> >(pObject, pObject_method, cObjectTaskFlagDeleteAfterExecution);
- if (!pTask)
- return false;
- return queue_task(pTask, data, pData_ptr);
- }
-
- template<typename S, typename T>
- inline bool task_pool::queue_multiple_object_tasks(S* pObject, T pObject_method, uint64 first_data, uint num_tasks, void* pData_ptr)
- {
- CRNLIB_ASSERT(pObject);
- CRNLIB_ASSERT(num_tasks);
- if (!num_tasks)
- return true;
-
- bool status = true;
-
- uint i;
- for (i = 0; i < num_tasks; i++)
- {
- task tsk;
-
- tsk.m_pObj = crnlib_new< object_task<S> >(pObject, pObject_method, cObjectTaskFlagDeleteAfterExecution);
- if (!tsk.m_pObj)
- {
- status = false;
- break;
- }
-
- tsk.m_data = first_data + i;
- tsk.m_pData_ptr = pData_ptr;
- tsk.m_flags = cTaskFlagObject;
-
- atomic_increment32(&m_total_submitted_tasks);
-
- if (!m_task_stack.try_push(tsk))
- {
- atomic_increment32(&m_total_completed_tasks);
-
- status = false;
- break;
- }
- }
-
- if (i)
- {
- m_tasks_available.release(i);
- }
-
- return status;
- }
-
-} // namespace crnlib
-
-#endif // CRNLIB_USE_PTHREADS_API
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_threading_win32.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_threading_win32.cpp
deleted file mode 100644
index 26eb3ea3..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_threading_win32.cpp
+++ /dev/null
@@ -1,428 +0,0 @@
-// File: crn_win32_threading.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_threading_win32.h"
-#include "crn_winhdr.h"
-#include <process.h>
-
-namespace crnlib
-{
- uint g_number_of_processors = 1;
-
- void crn_threading_init()
- {
- SYSTEM_INFO g_system_info;
- GetSystemInfo(&g_system_info);
-
- g_number_of_processors = math::maximum<uint>(1U, g_system_info.dwNumberOfProcessors);
- }
-
- crn_thread_id_t crn_get_current_thread_id()
- {
- return static_cast<crn_thread_id_t>(GetCurrentThreadId());
- }
-
- void crn_sleep(unsigned int milliseconds)
- {
- Sleep(milliseconds);
- }
-
- uint crn_get_max_helper_threads()
- {
- if (g_number_of_processors > 1)
- {
- // use all CPU's
- return CRNLIB_MIN((int)task_pool::cMaxThreads, (int)g_number_of_processors - 1);
- }
-
- return 0;
- }
-
- mutex::mutex(unsigned int spin_count)
- {
- CRNLIB_ASSUME(sizeof(mutex) >= sizeof(CRITICAL_SECTION));
-
- void *p = m_buf;
- CRITICAL_SECTION &m_cs = *static_cast<CRITICAL_SECTION *>(p);
-
- BOOL status = true;
- status = InitializeCriticalSectionAndSpinCount(&m_cs, spin_count);
- if (!status)
- crnlib_fail("mutex::mutex: InitializeCriticalSectionAndSpinCount failed", __FILE__, __LINE__);
-
-#ifdef CRNLIB_BUILD_DEBUG
- m_lock_count = 0;
-#endif
- }
-
- mutex::~mutex()
- {
- void *p = m_buf;
- CRITICAL_SECTION &m_cs = *static_cast<CRITICAL_SECTION *>(p);
-
-#ifdef CRNLIB_BUILD_DEBUG
- if (m_lock_count)
- crnlib_assert("mutex::~mutex: mutex is still locked", __FILE__, __LINE__);
-#endif
- DeleteCriticalSection(&m_cs);
- }
-
- void mutex::lock()
- {
- void *p = m_buf;
- CRITICAL_SECTION &m_cs = *static_cast<CRITICAL_SECTION *>(p);
-
- EnterCriticalSection(&m_cs);
-#ifdef CRNLIB_BUILD_DEBUG
- m_lock_count++;
-#endif
- }
-
- void mutex::unlock()
- {
- void *p = m_buf;
- CRITICAL_SECTION &m_cs = *static_cast<CRITICAL_SECTION *>(p);
-
-#ifdef CRNLIB_BUILD_DEBUG
- if (!m_lock_count)
- crnlib_assert("mutex::unlock: mutex is not locked", __FILE__, __LINE__);
- m_lock_count--;
-#endif
- LeaveCriticalSection(&m_cs);
- }
-
- void mutex::set_spin_count(unsigned int count)
- {
- void *p = m_buf;
- CRITICAL_SECTION &m_cs = *static_cast<CRITICAL_SECTION *>(p);
-
- SetCriticalSectionSpinCount(&m_cs, count);
- }
-
- void spinlock::lock(uint32 max_spins, bool yielding)
- {
- if (g_number_of_processors <= 1)
- max_spins = 1;
-
- uint32 spinCount = 0;
- uint32 yieldCount = 0;
-
- for ( ; ; )
- {
- CRNLIB_ASSUME(sizeof(long) == sizeof(int32));
- if (!InterlockedExchange((volatile long*)&m_flag, TRUE))
- break;
-
- YieldProcessor();
- YieldProcessor();
- YieldProcessor();
- YieldProcessor();
- YieldProcessor();
- YieldProcessor();
- YieldProcessor();
- YieldProcessor();
-
- spinCount++;
- if ((yielding) && (spinCount >= max_spins))
- {
- switch (yieldCount)
- {
- case 0:
- {
- spinCount = 0;
-
- Sleep(0);
-
- yieldCount++;
- break;
- }
- case 1:
- {
- if (g_number_of_processors <= 1)
- spinCount = 0;
- else
- spinCount = max_spins / 2;
-
- Sleep(1);
-
- yieldCount++;
- break;
- }
- case 2:
- {
- if (g_number_of_processors <= 1)
- spinCount = 0;
- else
- spinCount = max_spins;
-
- Sleep(2);
- break;
- }
- }
- }
- }
-
- CRNLIB_MEMORY_IMPORT_BARRIER
- }
-
- void spinlock::unlock()
- {
- CRNLIB_MEMORY_EXPORT_BARRIER
-
- InterlockedExchange((volatile long*)&m_flag, FALSE);
- }
-
- semaphore::semaphore(int32 initialCount, int32 maximumCount, const char* pName)
- {
- m_handle = CreateSemaphoreA(NULL, initialCount, maximumCount, pName);
- if (NULL == m_handle)
- {
- CRNLIB_FAIL("semaphore: CreateSemaphore() failed");
- }
- }
-
- semaphore::~semaphore()
- {
- if (m_handle)
- {
- CloseHandle(m_handle);
- m_handle = NULL;
- }
- }
-
- void semaphore::release(int32 releaseCount, int32 *pPreviousCount)
- {
- CRNLIB_ASSUME(sizeof(LONG) == sizeof(int32));
- if (0 == ReleaseSemaphore(m_handle, releaseCount, (LPLONG)pPreviousCount))
- {
- CRNLIB_FAIL("semaphore: ReleaseSemaphore() failed");
- }
- }
-
- bool semaphore::try_release(int32 releaseCount, int32 *pPreviousCount)
- {
- CRNLIB_ASSUME(sizeof(LONG) == sizeof(int32));
- return ReleaseSemaphore(m_handle, releaseCount, (LPLONG)pPreviousCount) != 0;
- }
-
- bool semaphore::wait(uint32 milliseconds)
- {
- uint32 result = WaitForSingleObject(m_handle, milliseconds);
-
- if (WAIT_FAILED == result)
- {
- CRNLIB_FAIL("semaphore: WaitForSingleObject() failed");
- }
-
- return WAIT_OBJECT_0 == result;
- }
-
- task_pool::task_pool() :
- m_pTask_stack(crnlib_new<ts_task_stack_t>()),
- m_num_threads(0),
- m_tasks_available(0, 32767),
- m_all_tasks_completed(0, 1),
- m_total_submitted_tasks(0),
- m_total_completed_tasks(0),
- m_exit_flag(false)
- {
- utils::zero_object(m_threads);
- }
-
- task_pool::task_pool(uint num_threads) :
- m_pTask_stack(crnlib_new<ts_task_stack_t>()),
- m_num_threads(0),
- m_tasks_available(0, 32767),
- m_all_tasks_completed(0, 1),
- m_total_submitted_tasks(0),
- m_total_completed_tasks(0),
- m_exit_flag(false)
- {
- utils::zero_object(m_threads);
-
- bool status = init(num_threads);
- CRNLIB_VERIFY(status);
- }
-
- task_pool::~task_pool()
- {
- deinit();
- crnlib_delete(m_pTask_stack);
- }
-
- bool task_pool::init(uint num_threads)
- {
- CRNLIB_ASSERT(num_threads <= cMaxThreads);
- num_threads = math::minimum<uint>(num_threads, cMaxThreads);
-
- deinit();
-
- bool succeeded = true;
-
- m_num_threads = 0;
- while (m_num_threads < num_threads)
- {
- m_threads[m_num_threads] = (HANDLE)_beginthreadex(NULL, 32768, thread_func, this, 0, NULL);
- CRNLIB_ASSERT(m_threads[m_num_threads] != 0);
-
- if (!m_threads[m_num_threads])
- {
- succeeded = false;
- break;
- }
-
- m_num_threads++;
- }
-
- if (!succeeded)
- {
- deinit();
- return false;
- }
-
- return true;
- }
-
- void task_pool::deinit()
- {
- if (m_num_threads)
- {
- join();
-
- // Set exit flag, then release all threads. Each should wakeup and exit.
- atomic_exchange32(&m_exit_flag, true);
-
- m_tasks_available.release(m_num_threads);
-
- // Now wait for each thread to exit.
- for (uint i = 0; i < m_num_threads; i++)
- {
- if (m_threads[i])
- {
- for ( ; ; )
- {
- // Can be an INFINITE delay, but set at 30 seconds so this function always provably exits.
- DWORD result = WaitForSingleObject(m_threads[i], 30000);
- if ((result == WAIT_OBJECT_0) || (result == WAIT_ABANDONED))
- break;
- }
-
- CloseHandle(m_threads[i]);
- m_threads[i] = NULL;
- }
- }
-
- m_num_threads = 0;
-
- atomic_exchange32(&m_exit_flag, false);
- }
-
- if (m_pTask_stack)
- m_pTask_stack->clear();
- m_total_submitted_tasks = 0;
- m_total_completed_tasks = 0;
- }
-
- bool task_pool::queue_task(task_callback_func pFunc, uint64 data, void* pData_ptr)
- {
- CRNLIB_ASSERT(pFunc);
-
- task tsk;
- tsk.m_callback = pFunc;
- tsk.m_data = data;
- tsk.m_pData_ptr = pData_ptr;
- tsk.m_flags = 0;
-
- atomic_increment32(&m_total_submitted_tasks);
-
- if (!m_pTask_stack->try_push(tsk))
- {
- atomic_increment32(&m_total_completed_tasks);
- return false;
- }
-
- m_tasks_available.release(1);
-
- return true;
- }
-
- // It's the object's responsibility to delete pObj within the execute_task() method, if needed!
- bool task_pool::queue_task(executable_task* pObj, uint64 data, void* pData_ptr)
- {
- CRNLIB_ASSERT(pObj);
-
- task tsk;
- tsk.m_pObj = pObj;
- tsk.m_data = data;
- tsk.m_pData_ptr = pData_ptr;
- tsk.m_flags = cTaskFlagObject;
-
- atomic_increment32(&m_total_submitted_tasks);
-
- if (!m_pTask_stack->try_push(tsk))
- {
- atomic_increment32(&m_total_completed_tasks);
- return false;
- }
-
- m_tasks_available.release(1);
-
- return true;
- }
-
- void task_pool::process_task(task& tsk)
- {
- if (tsk.m_flags & cTaskFlagObject)
- tsk.m_pObj->execute_task(tsk.m_data, tsk.m_pData_ptr);
- else
- tsk.m_callback(tsk.m_data, tsk.m_pData_ptr);
-
- if (atomic_increment32(&m_total_completed_tasks) == m_total_submitted_tasks)
- {
- // Try to signal the semaphore (the max count is 1 so this may actually fail).
- m_all_tasks_completed.try_release();
- }
- }
-
- void task_pool::join()
- {
- // Try to steal any outstanding tasks. This could cause one or more worker threads to wake up and immediately go back to sleep, which is wasteful but should be harmless.
- task tsk;
- while (m_pTask_stack->pop(tsk))
- process_task(tsk);
-
- // At this point the task stack is empty.
- // Now wait for all concurrent tasks to complete. The m_all_tasks_completed semaphore has a max count of 1, so it's possible it could have saturated to 1 as the tasks
- // where issued and asynchronously completed, so this loop may iterate a few times.
- const int total_submitted_tasks = atomic_add32(&m_total_submitted_tasks, 0);
- while (m_total_completed_tasks != total_submitted_tasks)
- {
- // If the previous (m_total_completed_tasks != total_submitted_tasks) check failed the semaphore MUST be eventually signalled once the last task completes.
- // So I think this can actually be an INFINITE delay, but it shouldn't really matter if it's 1ms.
- m_all_tasks_completed.wait(1);
- }
- }
-
- unsigned __stdcall task_pool::thread_func(void* pContext)
- {
- task_pool* pPool = static_cast<task_pool*>(pContext);
-
- for ( ; ; )
- {
- if (!pPool->m_tasks_available.wait())
- break;
-
- if (pPool->m_exit_flag)
- break;
-
- task tsk;
- if (pPool->m_pTask_stack->pop(tsk))
- pPool->process_task(tsk);
- }
-
- _endthreadex(0);
- return 0;
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_threading_win32.h b/Libraries/crunch-ea9b8d/crnlib/crn_threading_win32.h
deleted file mode 100644
index 098f1c3c..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_threading_win32.h
+++ /dev/null
@@ -1,417 +0,0 @@
-// File: crn_win32_threading.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-#include "crn_atomics.h"
-#if CRNLIB_NO_ATOMICS
-#error No atomic operations defined in crn_platform.h!
-#endif
-
-namespace crnlib
-{
- // g_number_of_processors defaults to 1. Will be higher on multicore machines.
- extern uint g_number_of_processors;
-
- void crn_threading_init();
-
- typedef uint64 crn_thread_id_t;
- crn_thread_id_t crn_get_current_thread_id();
-
- void crn_sleep(unsigned int milliseconds);
-
- uint crn_get_max_helper_threads();
-
- class mutex
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(mutex);
-
- public:
- mutex(unsigned int spin_count = 0);
- ~mutex();
- void lock();
- void unlock();
- void set_spin_count(unsigned int count);
-
- private:
- int m_buf[12];
-
-#ifdef CRNLIB_BUILD_DEBUG
- unsigned int m_lock_count;
-#endif
- };
-
- class scoped_mutex
- {
- scoped_mutex(const scoped_mutex&);
- scoped_mutex& operator= (const scoped_mutex&);
-
- public:
- inline scoped_mutex(mutex& m) : m_mutex(m) { m_mutex.lock(); }
- inline ~scoped_mutex() { m_mutex.unlock(); }
-
- private:
- mutex& m_mutex;
- };
-
- // Simple non-recursive spinlock.
- class spinlock
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(spinlock);
- public:
- inline spinlock() : m_flag(0) { }
-
- void lock(uint32 max_spins = 4096, bool yielding = true);
-
- inline void lock_no_barrier(uint32 max_spins = 4096, bool yielding = true) { lock(max_spins, yielding); }
-
- void unlock();
-
- inline void unlock_no_barrier() { m_flag = CRNLIB_FALSE; }
-
- private:
- volatile int32 m_flag;
- };
-
- class scoped_spinlock
- {
- scoped_spinlock(const scoped_spinlock&);
- scoped_spinlock& operator= (const scoped_spinlock&);
-
- public:
- inline scoped_spinlock(spinlock& lock) : m_lock(lock) { m_lock.lock(); }
- inline ~scoped_spinlock() { m_lock.unlock(); }
-
- private:
- spinlock& m_lock;
- };
-
- class semaphore
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(semaphore);
-
- public:
- semaphore(int32 initialCount = 0, int32 maximumCount = 1, const char* pName = NULL);
-
- ~semaphore();
-
- inline HANDLE get_handle(void) const { return m_handle; }
-
- void release(int32 releaseCount = 1, int32 *pPreviousCount = NULL);
- bool try_release(int32 releaseCount = 1, int32 *pPreviousCount = NULL);
-
- bool wait(uint32 milliseconds = cUINT32_MAX);
-
- private:
- HANDLE m_handle;
- };
-
- template<typename T>
- class tsstack
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(tsstack);
- public:
- inline tsstack(bool use_freelist = true) :
- m_use_freelist(use_freelist)
- {
- CRNLIB_VERIFY(((ptr_bits_t)this & (CRNLIB_GET_ALIGNMENT(tsstack) - 1)) == 0);
- InitializeSListHead(&m_stack_head);
- InitializeSListHead(&m_freelist_head);
- }
-
- inline ~tsstack()
- {
- clear();
- }
-
- inline void clear()
- {
- for ( ; ; )
- {
- node* pNode = (node*)InterlockedPopEntrySList(&m_stack_head);
- if (!pNode)
- break;
-
- CRNLIB_MEMORY_IMPORT_BARRIER
-
- helpers::destruct(&pNode->m_obj);
-
- crnlib_free(pNode);
- }
-
- flush_freelist();
- }
-
- inline void flush_freelist()
- {
- if (!m_use_freelist)
- return;
-
- for ( ; ; )
- {
- node* pNode = (node*)InterlockedPopEntrySList(&m_freelist_head);
- if (!pNode)
- break;
-
- CRNLIB_MEMORY_IMPORT_BARRIER
-
- crnlib_free(pNode);
- }
- }
-
- inline bool try_push(const T& obj)
- {
- node* pNode = alloc_node();
- if (!pNode)
- return false;
-
- helpers::construct(&pNode->m_obj, obj);
-
- CRNLIB_MEMORY_EXPORT_BARRIER
-
- InterlockedPushEntrySList(&m_stack_head, &pNode->m_slist_entry);
-
- return true;
- }
-
- inline bool pop(T& obj)
- {
- node* pNode = (node*)InterlockedPopEntrySList(&m_stack_head);
- if (!pNode)
- return false;
-
- CRNLIB_MEMORY_IMPORT_BARRIER
-
- obj = pNode->m_obj;
-
- helpers::destruct(&pNode->m_obj);
-
- free_node(pNode);
-
- return true;
- }
-
- private:
- SLIST_HEADER m_stack_head;
- SLIST_HEADER m_freelist_head;
-
- struct node
- {
- SLIST_ENTRY m_slist_entry;
- T m_obj;
- };
-
- bool m_use_freelist;
-
- inline node* alloc_node()
- {
- node* pNode = m_use_freelist ? (node*)InterlockedPopEntrySList(&m_freelist_head) : NULL;
-
- if (!pNode)
- pNode = (node*)crnlib_malloc(sizeof(node));
-
- return pNode;
- }
-
- inline void free_node(node* pNode)
- {
- if (m_use_freelist)
- InterlockedPushEntrySList(&m_freelist_head, &pNode->m_slist_entry);
- else
- crnlib_free(pNode);
- }
- };
-
- // Simple multithreaded task pool. This class assumes a single global thread will be issuing tasks and joining.
- class task_pool
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(task_pool);
- public:
- task_pool();
- task_pool(uint num_threads);
- ~task_pool();
-
- enum { cMaxThreads = 16 };
- bool init(uint num_threads);
- void deinit();
-
- inline uint get_num_threads() const { return m_num_threads; }
- inline uint32 get_num_outstanding_tasks() const { return m_total_submitted_tasks - m_total_completed_tasks; }
-
- // C-style task callback
- typedef void (*task_callback_func)(uint64 data, void* pData_ptr);
- bool queue_task(task_callback_func pFunc, uint64 data = 0, void* pData_ptr = NULL);
-
- class executable_task
- {
- public:
- virtual void execute_task(uint64 data, void* pData_ptr) = 0;
- };
-
- // It's the caller's responsibility to delete pObj within the execute_task() method, if needed!
- bool queue_task(executable_task* pObj, uint64 data = 0, void* pData_ptr = NULL);
-
- template<typename S, typename T>
- inline bool queue_object_task(S* pObject, T pObject_method, uint64 data = 0, void* pData_ptr = NULL);
-
- template<typename S, typename T>
- inline bool queue_multiple_object_tasks(S* pObject, T pObject_method, uint64 first_data, uint num_tasks, void* pData_ptr = NULL);
-
- // Waits for all outstanding tasks (if any) to complete.
- // The calling thread will steal any outstanding tasks from worker threads, if possible.
- void join();
-
- private:
- struct task
- {
- //inline task() : m_data(0), m_pData_ptr(NULL), m_pObj(NULL), m_flags(0) { }
-
- uint64 m_data;
- void* m_pData_ptr;
-
- union
- {
- task_callback_func m_callback;
- executable_task* m_pObj;
- };
-
- uint m_flags;
- };
-
- typedef tsstack<task> ts_task_stack_t;
- ts_task_stack_t* m_pTask_stack;
-
- uint m_num_threads;
- HANDLE m_threads[cMaxThreads];
-
- // Signalled whenever a task is queued up.
- semaphore m_tasks_available;
-
- // Signalled when all outstanding tasks are completed.
- semaphore m_all_tasks_completed;
-
- enum task_flags
- {
- cTaskFlagObject = 1
- };
-
- volatile atomic32_t m_total_submitted_tasks;
- volatile atomic32_t m_total_completed_tasks;
- volatile atomic32_t m_exit_flag;
-
- void process_task(task& tsk);
-
- static unsigned __stdcall thread_func(void* pContext);
- };
-
- enum object_task_flags
- {
- cObjectTaskFlagDefault = 0,
- cObjectTaskFlagDeleteAfterExecution = 1
- };
-
- template<typename T>
- class object_task : public task_pool::executable_task
- {
- public:
- object_task(uint flags = cObjectTaskFlagDefault) :
- m_pObject(NULL),
- m_pMethod(NULL),
- m_flags(flags)
- {
- }
-
- typedef void (T::*object_method_ptr)(uint64 data, void* pData_ptr);
-
- object_task(T* pObject, object_method_ptr pMethod, uint flags = cObjectTaskFlagDefault) :
- m_pObject(pObject),
- m_pMethod(pMethod),
- m_flags(flags)
- {
- CRNLIB_ASSERT(pObject && pMethod);
- }
-
- void init(T* pObject, object_method_ptr pMethod, uint flags = cObjectTaskFlagDefault)
- {
- CRNLIB_ASSERT(pObject && pMethod);
-
- m_pObject = pObject;
- m_pMethod = pMethod;
- m_flags = flags;
- }
-
- T* get_object() const { return m_pObject; }
- object_method_ptr get_method() const { return m_pMethod; }
-
- virtual void execute_task(uint64 data, void* pData_ptr)
- {
- (m_pObject->*m_pMethod)(data, pData_ptr);
-
- if (m_flags & cObjectTaskFlagDeleteAfterExecution)
- crnlib_delete(this);
- }
-
- protected:
- T* m_pObject;
-
- object_method_ptr m_pMethod;
-
- uint m_flags;
- };
-
- template<typename S, typename T>
- inline bool task_pool::queue_object_task(S* pObject, T pObject_method, uint64 data, void* pData_ptr)
- {
- object_task<S> *pTask = crnlib_new< object_task<S> >(pObject, pObject_method, cObjectTaskFlagDeleteAfterExecution);
- if (!pTask)
- return false;
- return queue_task(pTask, data, pData_ptr);
- }
-
- template<typename S, typename T>
- inline bool task_pool::queue_multiple_object_tasks(S* pObject, T pObject_method, uint64 first_data, uint num_tasks, void* pData_ptr)
- {
- CRNLIB_ASSERT(pObject);
- CRNLIB_ASSERT(num_tasks);
- if (!num_tasks)
- return true;
-
- bool status = true;
-
- uint i;
- for (i = 0; i < num_tasks; i++)
- {
- task tsk;
-
- tsk.m_pObj = crnlib_new< object_task<S> >(pObject, pObject_method, cObjectTaskFlagDeleteAfterExecution);
- if (!tsk.m_pObj)
- {
- status = false;
- break;
- }
-
- tsk.m_data = first_data + i;
- tsk.m_pData_ptr = pData_ptr;
- tsk.m_flags = cTaskFlagObject;
-
- atomic_increment32(&m_total_submitted_tasks);
-
- if (!m_pTask_stack->try_push(tsk))
- {
- atomic_increment32(&m_total_completed_tasks);
-
- status = false;
- break;
- }
- }
-
- if (i)
- {
- m_tasks_available.release(i);
- }
-
- return status;
- }
-
-} // namespace crnlib
-
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_timer.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_timer.cpp
deleted file mode 100644
index 1c6fc4a4..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_timer.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-// File: crn_win32_timer.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_timer.h"
-#include <time.h>
-
-#include "crn_timer.h"
-
-#if CRNLIB_USE_WIN32_API
- #include "crn_winhdr.h"
-#endif
-
-namespace crnlib
-{
- unsigned long long timer::g_init_ticks;
- unsigned long long timer::g_freq;
- double timer::g_inv_freq;
-
-#if defined(CRNLIB_USE_WIN32_API)
- inline void query_counter(timer_ticks *pTicks)
- {
- QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(pTicks));
- }
- inline void query_counter_frequency(timer_ticks *pTicks)
- {
- QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(pTicks));
- }
-#elif defined(__GNUC__)
- #include <sys/timex.h>
- inline void query_counter(timer_ticks *pTicks)
- {
- struct timeval cur_time;
- gettimeofday(&cur_time, NULL);
- *pTicks = static_cast<unsigned long long>(cur_time.tv_sec)*1000000ULL + static_cast<unsigned long long>(cur_time.tv_usec);
- }
- inline void query_counter_frequency(timer_ticks *pTicks)
- {
- *pTicks = 1000000;
- }
-#else
- #error Unimplemented
-#endif
-
- timer::timer() :
- m_start_time(0),
- m_stop_time(0),
- m_started(false),
- m_stopped(false)
- {
- if (!g_inv_freq)
- init();
- }
-
- timer::timer(timer_ticks start_ticks)
- {
- if (!g_inv_freq)
- init();
-
- m_start_time = start_ticks;
-
- m_started = true;
- m_stopped = false;
- }
-
- void timer::start(timer_ticks start_ticks)
- {
- m_start_time = start_ticks;
-
- m_started = true;
- m_stopped = false;
- }
-
- void timer::start()
- {
- query_counter(&m_start_time);
-
- m_started = true;
- m_stopped = false;
- }
-
- void timer::stop()
- {
- CRNLIB_ASSERT(m_started);
-
- query_counter(&m_stop_time);
-
- m_stopped = true;
- }
-
- double timer::get_elapsed_secs() const
- {
- CRNLIB_ASSERT(m_started);
- if (!m_started)
- return 0;
-
- timer_ticks stop_time = m_stop_time;
- if (!m_stopped)
- query_counter(&stop_time);
-
- timer_ticks delta = stop_time - m_start_time;
- return delta * g_inv_freq;
- }
-
- timer_ticks timer::get_elapsed_us() const
- {
- CRNLIB_ASSERT(m_started);
- if (!m_started)
- return 0;
-
- timer_ticks stop_time = m_stop_time;
- if (!m_stopped)
- query_counter(&stop_time);
-
- timer_ticks delta = stop_time - m_start_time;
- return (delta * 1000000ULL + (g_freq >> 1U)) / g_freq;
- }
-
- void timer::init()
- {
- if (!g_inv_freq)
- {
- query_counter_frequency(&g_freq);
- g_inv_freq = 1.0f / g_freq;
-
- query_counter(&g_init_ticks);
- }
- }
-
- timer_ticks timer::get_init_ticks()
- {
- if (!g_inv_freq)
- init();
-
- return g_init_ticks;
- }
-
- timer_ticks timer::get_ticks()
- {
- if (!g_inv_freq)
- init();
-
- timer_ticks ticks;
- query_counter(&ticks);
- return ticks - g_init_ticks;
- }
-
- double timer::ticks_to_secs(timer_ticks ticks)
- {
- if (!g_inv_freq)
- init();
-
- return ticks * g_inv_freq;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_timer.h b/Libraries/crunch-ea9b8d/crnlib/crn_timer.h
deleted file mode 100644
index f96e5328..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_timer.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// File: crn_win32_timer.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- typedef unsigned long long timer_ticks;
-
- class timer
- {
- public:
- timer();
- timer(timer_ticks start_ticks);
-
- void start();
- void start(timer_ticks start_ticks);
-
- void stop();
-
- double get_elapsed_secs() const;
- inline double get_elapsed_ms() const { return get_elapsed_secs() * 1000.0f; }
- timer_ticks get_elapsed_us() const;
-
- static void init();
- static inline timer_ticks get_ticks_per_sec() { return g_freq; }
- static timer_ticks get_init_ticks();
- static timer_ticks get_ticks();
- static double ticks_to_secs(timer_ticks ticks);
- static inline double ticks_to_ms(timer_ticks ticks) { return ticks_to_secs(ticks) * 1000.0f; }
- static inline double get_secs() { return ticks_to_secs(get_ticks()); }
- static inline double get_ms() { return ticks_to_ms(get_ticks()); }
-
- private:
- static timer_ticks g_init_ticks;
- static timer_ticks g_freq;
- static double g_inv_freq;
-
- timer_ticks m_start_time;
- timer_ticks m_stop_time;
-
- bool m_started : 1;
- bool m_stopped : 1;
- };
-
- // Prints object's lifetime to stdout
- class timed_scope
- {
- const char* m_pName;
- timer m_tm;
-
- public:
- inline timed_scope(char* pName = "timed_scope") : m_pName(pName) { m_tm.start(); }
-
- inline double get_elapsed_secs() const { return m_tm.get_elapsed_secs(); }
- inline double get_elapsed_ms() const { return m_tm.get_elapsed_ms(); }
-
- const timer &get_timer() const { return m_tm; }
- timer &get_timer() { return m_tm; }
-
- inline ~timed_scope() { double secs = m_tm.get_elapsed_secs(); printf("%s: %f secs, %f ms\n", m_pName, secs, secs * 1000.0f); }
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_traits.h b/Libraries/crunch-ea9b8d/crnlib/crn_traits.h
deleted file mode 100644
index 2d1e2c1e..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_traits.h
+++ /dev/null
@@ -1,124 +0,0 @@
-// File: crn_traits.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- template<typename T> struct int_traits { enum { cMin = crnlib::cINT32_MIN, cMax = crnlib::cINT32_MAX, cSigned = true }; };
-
- template<> struct int_traits<int8> { enum { cMin = crnlib::cINT8_MIN, cMax = crnlib::cINT8_MAX, cSigned = true }; };
- template<> struct int_traits<int16> { enum { cMin = crnlib::cINT16_MIN, cMax = crnlib::cINT16_MAX, cSigned = true }; };
- template<> struct int_traits<int32> { enum { cMin = crnlib::cINT32_MIN, cMax = crnlib::cINT32_MAX, cSigned = true }; };
-
- template<> struct int_traits<uint8> { enum { cMin = 0, cMax = crnlib::cUINT8_MAX, cSigned = false }; };
- template<> struct int_traits<uint16> { enum { cMin = 0, cMax = crnlib::cUINT16_MAX, cSigned = false }; };
- template<> struct int_traits<uint32> { enum { cMin = 0, cMax = crnlib::cUINT32_MAX, cSigned = false }; };
- template<typename T>
- struct scalar_type
- {
- enum { cFlag = false };
- static inline void construct(T* p) { helpers::construct(p); }
- static inline void construct(T* p, const T& init) { helpers::construct(p, init); }
- static inline void construct_array(T* p, uint n) { helpers::construct_array(p, n); }
- static inline void destruct(T* p) { helpers::destruct(p); }
- static inline void destruct_array(T* p, uint n) { helpers::destruct_array(p, n); }
- };
-
- template<typename T> struct scalar_type<T*>
- {
- enum { cFlag = true };
- static inline void construct(T** p) { memset(p, 0, sizeof(T*)); }
- static inline void construct(T** p, T* init) { *p = init; }
- static inline void construct_array(T** p, uint n) { memset(p, 0, sizeof(T*) * n); }
- static inline void destruct(T** p) { p; }
- static inline void destruct_array(T** p, uint n) { p, n; }
- };
-
-#define CRNLIB_DEFINE_BUILT_IN_TYPE(X) \
- template<> struct scalar_type<X> { \
- enum { cFlag = true }; \
- static inline void construct(X* p) { memset(p, 0, sizeof(X)); } \
- static inline void construct(X* p, const X& init) { memcpy(p, &init, sizeof(X)); } \
- static inline void construct_array(X* p, uint n) { memset(p, 0, sizeof(X) * n); } \
- static inline void destruct(X* p) { p; } \
- static inline void destruct_array(X* p, uint n) { p, n; } };
-
- CRNLIB_DEFINE_BUILT_IN_TYPE(bool)
- CRNLIB_DEFINE_BUILT_IN_TYPE(char)
- CRNLIB_DEFINE_BUILT_IN_TYPE(unsigned char)
- CRNLIB_DEFINE_BUILT_IN_TYPE(short)
- CRNLIB_DEFINE_BUILT_IN_TYPE(unsigned short)
- CRNLIB_DEFINE_BUILT_IN_TYPE(int)
- CRNLIB_DEFINE_BUILT_IN_TYPE(unsigned int)
- CRNLIB_DEFINE_BUILT_IN_TYPE(long)
- CRNLIB_DEFINE_BUILT_IN_TYPE(unsigned long)
-#ifdef __GNUC__
- CRNLIB_DEFINE_BUILT_IN_TYPE(long long)
- CRNLIB_DEFINE_BUILT_IN_TYPE(unsigned long long)
-#else
- CRNLIB_DEFINE_BUILT_IN_TYPE(__int64)
- CRNLIB_DEFINE_BUILT_IN_TYPE(unsigned __int64)
-#endif
- CRNLIB_DEFINE_BUILT_IN_TYPE(float)
- CRNLIB_DEFINE_BUILT_IN_TYPE(double)
- CRNLIB_DEFINE_BUILT_IN_TYPE(long double)
-
-#undef CRNLIB_DEFINE_BUILT_IN_TYPE
-
-// See: http://erdani.org/publications/cuj-2004-06.pdf
-
- template<typename T>
- struct bitwise_movable { enum { cFlag = false }; };
-
-// Defines type Q as bitwise movable.
-// Bitwise movable: type T may be safely moved to a new location via memcpy, without requiring the old copy to be destructed.
-// However, the final version of the object (wherever it winds up in memory) must be eventually destructed (a single time, of course).
-// Bitwise movable is a superset of bitwise copyable (all bitwise copyable types are also bitwise movable).
-#define CRNLIB_DEFINE_BITWISE_MOVABLE(Q) template<> struct bitwise_movable<Q> { enum { cFlag = true }; };
-
- template<typename T>
- struct bitwise_copyable { enum { cFlag = false }; };
-
-// Defines type Q as bitwise copyable.
-// Bitwise copyable: type T may be safely and freely copied (duplicated) via memcpy, and *does not* require destruction.
-#define CRNLIB_DEFINE_BITWISE_COPYABLE(Q) template<> struct bitwise_copyable<Q> { enum { cFlag = true }; };
-
-#define CRNLIB_IS_POD(T) __is_pod(T)
-
-#define CRNLIB_IS_SCALAR_TYPE(T) (scalar_type<T>::cFlag)
-
-#define CRNLIB_IS_BITWISE_COPYABLE(T) (CRNLIB_IS_SCALAR_TYPE(T) || CRNLIB_IS_POD(T) || (bitwise_copyable<T>::cFlag))
-
-#define CRNLIB_IS_BITWISE_COPYABLE_OR_MOVABLE(T) (CRNLIB_IS_BITWISE_COPYABLE(T) || (bitwise_movable<T>::cFlag))
-
-#define CRNLIB_HAS_DESTRUCTOR(T) ((!scalar_type<T>::cFlag) && (!__is_pod(T)))
-
- // From yasli_traits.h:
- // Credit goes to Boost;
- // also found in the C++ Templates book by Vandevoorde and Josuttis
-
- typedef char (&yes_t)[1];
- typedef char (&no_t)[2];
-
- template <class U> yes_t class_test(int U::*);
- template <class U> no_t class_test(...);
-
- template <class T> struct is_class
- {
- enum { value = (sizeof(class_test<T>(0)) == sizeof(yes_t)) };
- };
-
- template <typename T> struct is_pointer
- {
- enum { value = false };
- };
-
- template <typename T> struct is_pointer<T*>
- {
- enum { value = true };
- };
-
- CRNLIB_DEFINE_BITWISE_COPYABLE(empty_type);
- CRNLIB_DEFINE_BITWISE_MOVABLE(empty_type);
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_tree_clusterizer.h b/Libraries/crunch-ea9b8d/crnlib/crn_tree_clusterizer.h
deleted file mode 100644
index 8ace530d..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_tree_clusterizer.h
+++ /dev/null
@@ -1,463 +0,0 @@
-// File: crn_tree_clusterizer.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_matrix.h"
-
-namespace crnlib
-{
- template<typename VectorType>
- class tree_clusterizer
- {
- public:
- tree_clusterizer() :
- m_overall_variance(0.0f)
- {
- }
-
- void clear()
- {
- m_hist.clear();
- m_codebook.clear();
- m_nodes.clear();
- m_overall_variance = 0.0f;
- }
-
- void add_training_vec(const VectorType& v, uint weight)
- {
- const std::pair<typename vector_map_type::iterator, bool> insert_result( m_hist.insert( std::make_pair(v, 0U) ) );
-
- typename vector_map_type::iterator it(insert_result.first);
-
- uint max_weight = UINT_MAX - weight;
- if (weight > max_weight)
- it->second = UINT_MAX;
- else
- it->second = it->second + weight;
- }
-
- bool generate_codebook(uint max_size)
- {
- if (m_hist.empty())
- return false;
-
- double ttsum = 0.0f;
-
- vq_node root;
- root.m_vectors.reserve(static_cast<uint>(m_hist.size()));
-
- for (typename vector_map_type::const_iterator it = m_hist.begin(); it != m_hist.end(); ++it)
- {
- const VectorType& v = it->first;
- const uint weight = it->second;
-
- root.m_centroid += (v * (float)weight);
- root.m_total_weight += weight;
- root.m_vectors.push_back( std::make_pair(v, weight) );
-
- ttsum += v.dot(v) * weight;
- }
-
- root.m_variance = (float)(ttsum - (root.m_centroid.dot(root.m_centroid) / root.m_total_weight));
-
- root.m_centroid *= (1.0f / root.m_total_weight);
-
- m_nodes.clear();
- m_nodes.reserve(max_size * 2 + 1);
-
- m_nodes.push_back(root);
-
- // Warning: if this code is NOT compiled with -fno-strict-aliasing, m_nodes.get_ptr() can be NULL here. (Argh!)
-
- uint total_leaves = 1;
-
- while (total_leaves < max_size)
- {
- int worst_node_index = -1;
- float worst_variance = -1.0f;
-
- for (uint i = 0; i < m_nodes.size(); i++)
- {
- vq_node& node = m_nodes[i];
-
- // Skip internal and unsplittable nodes.
- if ((node.m_left != -1) || (node.m_unsplittable))
- continue;
-
- if (node.m_variance > worst_variance)
- {
- worst_variance = node.m_variance;
- worst_node_index = i;
- }
- }
-
- if (worst_variance <= 0.0f)
- break;
-
- split_node(worst_node_index);
- total_leaves++;
- }
-
- m_codebook.clear();
-
- m_overall_variance = 0.0f;
-
- for (uint i = 0; i < m_nodes.size(); i++)
- {
- vq_node& node = m_nodes[i];
- if (node.m_left != -1)
- {
- CRNLIB_ASSERT(node.m_right != -1);
- continue;
- }
-
- CRNLIB_ASSERT((node.m_left == -1) && (node.m_right == -1));
-
- node.m_codebook_index = m_codebook.size();
- m_codebook.push_back(node.m_centroid);
-
- m_overall_variance += node.m_variance;
- }
-
- return true;
- }
-
- inline float get_overall_variance() const { return m_overall_variance; }
-
- inline uint get_codebook_size() const
- {
- return m_codebook.size();
- }
-
- inline const VectorType& get_codebook_entry(uint index) const
- {
- return m_codebook[index];
- }
-
- typedef crnlib::vector<VectorType> vector_vec_type;
- inline const vector_vec_type& get_codebook() const
- {
- return m_codebook;
- }
-
- uint find_best_codebook_entry(const VectorType& v) const
- {
- uint cur_node_index = 0;
-
- for ( ; ; )
- {
- const vq_node& cur_node = m_nodes[cur_node_index];
-
- if (cur_node.m_left == -1)
- return cur_node.m_codebook_index;
-
- const vq_node& left_node = m_nodes[cur_node.m_left];
- const vq_node& right_node = m_nodes[cur_node.m_right];
-
- float left_dist = left_node.m_centroid.squared_distance(v);
- float right_dist = right_node.m_centroid.squared_distance(v);
-
- if (left_dist < right_dist)
- cur_node_index = cur_node.m_left;
- else
- cur_node_index = cur_node.m_right;
- }
- }
-
- uint find_best_codebook_entry_fs(const VectorType& v) const
- {
- float best_dist = math::cNearlyInfinite;
- uint best_index = 0;
-
- for (uint i = 0; i < m_codebook.size(); i++)
- {
- float dist = m_codebook[i].squared_distance(v);
- if (dist < best_dist)
- {
- best_dist = dist;
- best_index = i;
- if (best_dist == 0.0f)
- break;
- }
- }
-
- return best_index;
- }
-
- private:
- typedef std::map<VectorType, uint> vector_map_type;
-
- vector_map_type m_hist;
-
- struct vq_node
- {
- vq_node() : m_centroid(cClear), m_total_weight(0), m_left(-1), m_right(-1), m_codebook_index(-1), m_unsplittable(false) { }
-
- VectorType m_centroid;
- uint64 m_total_weight;
-
- float m_variance;
-
- crnlib::vector< std::pair<VectorType, uint> > m_vectors;
-
- int m_left;
- int m_right;
-
- int m_codebook_index;
-
- bool m_unsplittable;
- };
-
- typedef crnlib::vector<vq_node> node_vec_type;
-
- node_vec_type m_nodes;
-
- vector_vec_type m_codebook;
-
- float m_overall_variance;
-
- random m_rand;
-
- void split_node(uint index)
- {
- vq_node& parent_node = m_nodes[index];
-
- if (parent_node.m_vectors.size() == 1)
- return;
-
- VectorType furthest(0);
- double furthest_dist = -1.0f;
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const VectorType& v = parent_node.m_vectors[i].first;
-
- double dist = v.squared_distance(parent_node.m_centroid);
- if (dist > furthest_dist)
- {
- furthest_dist = dist;
- furthest = v;
- }
- }
-
- VectorType opposite;
- double opposite_dist = -1.0f;
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const VectorType& v = parent_node.m_vectors[i].first;
-
- double dist = v.squared_distance(furthest);
- if (dist > opposite_dist)
- {
- opposite_dist = dist;
- opposite = v;
- }
- }
-
- VectorType left_child((furthest + parent_node.m_centroid) * .5f);
- VectorType right_child((opposite + parent_node.m_centroid) * .5f);
-
- if (parent_node.m_vectors.size() > 2)
- {
- const uint N = VectorType::num_elements;
-
- matrix<N, N, float> covar;
- covar.clear();
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const VectorType v(parent_node.m_vectors[i].first - parent_node.m_centroid);
- const VectorType w(v * (float)parent_node.m_vectors[i].second);
-
- for (uint x = 0; x < N; x++)
- for (uint y = x; y < N; y++)
- covar[x][y] = covar[x][y] + v[x] * w[y];
- }
-
- if (N > 1)
- {
- //for (uint x = 0; x < (N - 1); x++)
- for (uint x = 0; x != (N - 1); x++)
- for (uint y = x + 1; y < N; y++)
- covar[y][x] = covar[x][y];
- }
-
- covar /= float(parent_node.m_total_weight);
-
- VectorType axis(1.0f);
- // Starting with an estimate of the principle axis should work better, but doesn't in practice?
- //left_child - right_child);
- //axis.normalize();
-
- for (uint iter = 0; iter < 10; iter++)
- {
- VectorType x;
-
- double max_sum = 0;
-
- for (uint i = 0; i < N; i++)
- {
- double sum = 0;
-
- for (uint j = 0; j < N; j++)
- sum += axis[j] * covar[i][j];
-
- x[i] = (float)sum;
-
- max_sum = i ? math::maximum(max_sum, sum) : sum;
- }
-
- if (max_sum != 0.0f)
- x *= (float)(1.0f / max_sum);
-
- axis = x;
- }
-
- axis.normalize();
-
- VectorType new_left_child(0.0f);
- VectorType new_right_child(0.0f);
-
- double left_weight = 0.0f;
- double right_weight = 0.0f;
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const float weight = (float)parent_node.m_vectors[i].second;
-
- const VectorType& v = parent_node.m_vectors[i].first;
-
- double t = (v - parent_node.m_centroid) * axis;
- if (t < 0.0f)
- {
- new_left_child += v * weight;
- left_weight += weight;
- }
- else
- {
- new_right_child += v * weight;
- right_weight += weight;
- }
- }
-
- if ((left_weight > 0.0f) && (right_weight > 0.0f))
- {
- left_child = new_left_child * (float)(1.0f/left_weight);
- right_child = new_right_child * (float)(1.0f/right_weight);
- }
- }
-
- uint64 left_weight = 0;
- uint64 right_weight = 0;
-
- crnlib::vector< std::pair<VectorType, uint> > left_children;
- crnlib::vector< std::pair<VectorType, uint> > right_children;
-
- left_children.reserve(parent_node.m_vectors.size() / 2);
- right_children.reserve(parent_node.m_vectors.size() / 2);
-
- float prev_total_variance = 1e+10f;
-
- float left_variance = 0.0f;
- float right_variance = 0.0f;
-
- // FIXME: Excessive upper limit
- const uint cMaxLoops = 1024;
- for (uint total_loops = 0; total_loops < cMaxLoops; total_loops++)
- {
- left_children.resize(0);
- right_children.resize(0);
-
- VectorType new_left_child(cClear);
- VectorType new_right_child(cClear);
-
- double left_ttsum = 0.0f;
- double right_ttsum = 0.0f;
-
- left_weight = 0;
- right_weight = 0;
-
- for (uint i = 0; i < parent_node.m_vectors.size(); i++)
- {
- const VectorType& v = parent_node.m_vectors[i].first;
- const uint weight = parent_node.m_vectors[i].second;
-
- double left_dist2 = left_child.squared_distance(v);
- double right_dist2 = right_child.squared_distance(v);
-
- if (left_dist2 < right_dist2)
- {
- left_children.push_back(parent_node.m_vectors[i]);
-
- new_left_child += (v * (float)weight);
- left_weight += weight;
-
- left_ttsum += v.dot(v) * weight;
- }
- else
- {
- right_children.push_back(parent_node.m_vectors[i]);
-
- new_right_child += (v * (float)weight);
- right_weight += weight;
-
- right_ttsum += v.dot(v) * weight;
- }
- }
-
- if ((!left_weight) || (!right_weight))
- {
- parent_node.m_unsplittable = true;
- return;
- }
-
- left_variance = (float)(left_ttsum - (new_left_child.dot(new_left_child) / left_weight));
- right_variance = (float)(right_ttsum - (new_right_child.dot(new_right_child) / right_weight));
-
- new_left_child *= (1.0f / left_weight);
- new_right_child *= (1.0f / right_weight);
-
- left_child = new_left_child;
- left_weight = left_weight;
-
- right_child = new_right_child;
- right_weight = right_weight;
-
- float total_variance = left_variance + right_variance;
- if (total_variance < .00001f)
- break;
-
- if (((prev_total_variance - total_variance) / total_variance) < .00001f)
- break;
-
- prev_total_variance = total_variance;
- }
-
- const uint left_child_index = m_nodes.size();
- const uint right_child_index = m_nodes.size() + 1;
-
- parent_node.m_left = m_nodes.size();
- parent_node.m_right = m_nodes.size() + 1;
-
- m_nodes.resize(m_nodes.size() + 2);
-
- // parent_node is invalid now, because m_nodes has been changed
-
- vq_node& left_child_node = m_nodes[left_child_index];
- vq_node& right_child_node = m_nodes[right_child_index];
-
- left_child_node.m_centroid = left_child;
- left_child_node.m_total_weight = left_weight;
- left_child_node.m_vectors.swap(left_children);
- left_child_node.m_variance = left_variance;
-
- right_child_node.m_centroid = right_child;
- right_child_node.m_total_weight = right_weight;
- right_child_node.m_vectors.swap(right_children);
- right_child_node.m_variance = right_variance;
- }
-
- };
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_types.h b/Libraries/crunch-ea9b8d/crnlib/crn_types.h
deleted file mode 100644
index 20ce5269..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_types.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// File: crn_types.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- typedef unsigned char uint8;
- typedef signed char int8;
- typedef unsigned short uint16;
- typedef signed short int16;
- typedef unsigned int uint32;
- typedef uint32 uint;
- typedef signed int int32;
-
- #ifdef __GNUC__
- typedef unsigned long long uint64;
- typedef long long int64;
- #else
- typedef unsigned __int64 uint64;
- typedef signed __int64 int64;
- #endif
-
- const uint8 cUINT8_MIN = 0;
- const uint8 cUINT8_MAX = 0xFFU;
- const uint16 cUINT16_MIN = 0;
- const uint16 cUINT16_MAX = 0xFFFFU;
- const uint32 cUINT32_MIN = 0;
- const uint32 cUINT32_MAX = 0xFFFFFFFFU;
- const uint64 cUINT64_MIN = 0;
- const uint64 cUINT64_MAX = 0xFFFFFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFFFFFui64;
-
- const int8 cINT8_MIN = -128;
- const int8 cINT8_MAX = 127;
- const int16 cINT16_MIN = -32768;
- const int16 cINT16_MAX = 32767;
- const int32 cINT32_MIN = (-2147483647 - 1);
- const int32 cINT32_MAX = 2147483647;
- const int64 cINT64_MIN = (int64)0x8000000000000000ULL; //(-9223372036854775807i64 - 1);
- const int64 cINT64_MAX = (int64)0x7FFFFFFFFFFFFFFFULL; // 9223372036854775807i64;
-
-#if CRNLIB_64BIT_POINTERS
- typedef uint64 uint_ptr;
- typedef uint64 uint32_ptr;
- typedef int64 signed_size_t;
- typedef uint64 ptr_bits_t;
-#else
- typedef unsigned int uint_ptr;
- typedef unsigned int uint32_ptr;
- typedef signed int signed_size_t;
- typedef uint32 ptr_bits_t;
-#endif
-
- enum eVarArg { cVarArg };
- enum eClear { cClear };
- enum eNoClamp { cNoClamp };
- enum { cInvalidIndex = -1 };
-
- const uint cIntBits = 32;
-
- struct empty_type { };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_utils.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_utils.cpp
deleted file mode 100644
index 47aad7ab..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_utils.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-// File: crn_utils.cpp
-#include "crn_core.h"
-#include "crn_utils.h"
-
-namespace crnlib
-{
- namespace utils
- {
- void endian_switch_words(uint16* p, uint num)
- {
- uint16* p_end = p + num;
- while (p != p_end)
- {
- uint16 k = *p;
- *p++ = swap16(k);
- }
- }
-
- void endian_switch_dwords(uint32* p, uint num)
- {
- uint32* p_end = p + num;
- while (p != p_end)
- {
- uint32 k = *p;
- *p++ = swap32(k);
- }
- }
-
- void copy_words(uint16* pDst, const uint16* pSrc, uint num, bool endian_switch)
- {
- if (!endian_switch)
- memcpy(pDst, pSrc, num << 1U);
- else
- {
- uint16* pDst_end = pDst + num;
- while (pDst != pDst_end)
- *pDst++ = swap16(*pSrc++);
- }
- }
-
- void copy_dwords(uint32* pDst, const uint32* pSrc, uint num, bool endian_switch)
- {
- if (!endian_switch)
- memcpy(pDst, pSrc, num << 2U);
- else
- {
- uint32* pDst_end = pDst + num;
- while (pDst != pDst_end)
- *pDst++ = swap32(*pSrc++);
- }
- }
-
- uint compute_max_mips(uint width, uint height)
- {
- if ((width | height) == 0)
- return 0;
-
- uint num_mips = 1;
-
- while ((width > 1U) || (height > 1U))
- {
- width >>= 1U;
- height >>= 1U;
- num_mips++;
- }
-
- return num_mips;
- }
-
- } // namespace utils
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_utils.h b/Libraries/crunch-ea9b8d/crnlib/crn_utils.h
deleted file mode 100644
index 3cb53325..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_utils.h
+++ /dev/null
@@ -1,275 +0,0 @@
-// File: crn_utils.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-#define CRNLIB_MIN(a, b) (((a) < (b)) ? (a) : (b))
-#define CRNLIB_MAX(a, b) (((a) < (b)) ? (b) : (a))
-
-#define CRNLIB_ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
-
-#ifdef _MSC_VER
- // Need to explictly extern these with MSVC, but not MinGW.
- extern "C" unsigned long __cdecl _lrotl(unsigned long, int);
- #pragma intrinsic(_lrotl)
-
- extern "C" unsigned long __cdecl _lrotr(unsigned long, int);
- #pragma intrinsic(_lrotr)
-#endif
-
-#ifdef WIN32
- #define CRNLIB_ROTATE_LEFT(x, k) _lrotl(x, k)
- #define CRNLIB_ROTATE_RIGHT(x, k) _lrotr(x, k)
-#else
- #define CRNLIB_ROTATE_LEFT(x, k) (((x) << (k)) | ((x) >> (32-(k))))
- #define CRNLIB_ROTATE_RIGHT(x, k) (((x) >> (k)) | ((x) << (32-(k))))
-#endif
-
-template<class T, size_t N> T decay_array_to_subtype(T (&a)[N]);
-#define CRNLIB_ARRAY_SIZE(X) (sizeof(X) / sizeof(decay_array_to_subtype(X)))
-
-#define CRNLIB_SIZEOF_U32(x) static_cast<uint32>(sizeof(x))
-
-namespace crnlib
-{
- namespace utils
- {
- template<typename T> inline void swap(T& l, T& r)
- {
- T temp(l);
- l = r;
- r = temp;
- }
-
- template<typename T> inline void zero_object(T& obj)
- {
- memset((void*)&obj, 0, sizeof(obj));
- }
-
- template<typename T> inline void zero_this(T* pObj)
- {
- memset((void*)pObj, 0, sizeof(*pObj));
- }
-
- inline bool is_bit_set(uint bits, uint mask)
- {
- return (bits & mask) != 0;
- }
-
- inline void set_bit(uint& bits, uint mask, bool state)
- {
- if (state)
- bits |= mask;
- else
- bits &= ~mask;
- }
-
- inline bool is_flag_set(uint bits, uint flag)
- {
- CRNLIB_ASSERT(flag < 32U);
- return is_bit_set(bits, 1U << flag);
- }
-
- inline void set_flag(uint& bits, uint flag, bool state)
- {
- CRNLIB_ASSERT(flag < 32U);
- set_bit(bits, 1U << flag, state);
- }
-
- inline void invert_buf(void* pBuf, uint size)
- {
- uint8* p = static_cast<uint8*>(pBuf);
-
- const uint half_size = size >> 1;
- for (uint i = 0; i < half_size; i++)
- utils::swap(p[i], p[size - 1U - i]);
- }
-
- // buffer_is_little_endian is the endianness of the buffer's data
- template<typename T>
- inline void write_obj(const T& obj, void* pBuf, bool buffer_is_little_endian)
- {
- const uint8* pSrc = reinterpret_cast<const uint8*>(&obj);
- uint8* pDst = static_cast<uint8*>(pBuf);
-
- if (c_crnlib_little_endian_platform == buffer_is_little_endian)
- memcpy(pDst, pSrc, sizeof(T));
- else
- {
- for (uint i = 0; i < sizeof(T); i++)
- pDst[i] = pSrc[sizeof(T) - 1 - i];
- }
- }
-
- // buffer_is_little_endian is the endianness of the buffer's data
- template<typename T>
- inline void read_obj(T& obj, const void* pBuf, bool buffer_is_little_endian)
- {
- const uint8* pSrc = reinterpret_cast<const uint8*>(pBuf);
- uint8* pDst = reinterpret_cast<uint8*>(&obj);
-
- if (c_crnlib_little_endian_platform == buffer_is_little_endian)
- memcpy(pDst, pSrc, sizeof(T));
- else
- {
- for (uint i = 0; i < sizeof(T); i++)
- pDst[i] = pSrc[sizeof(T) - 1 - i];
- }
- }
-
- template<typename T>
- inline bool write_obj(const T& obj, void*& pBuf, uint& buf_size, bool buffer_is_little_endian)
- {
- if (buf_size < sizeof(T))
- return false;
-
- utils::write_obj(obj, pBuf, buffer_is_little_endian);
-
- pBuf = static_cast<uint8*>(pBuf) + sizeof(T);
- buf_size -= sizeof(T);
-
- return true;
- }
-
- inline bool write_val(uint8 val, void*& pBuf, uint& buf_size, bool buffer_is_little_endian) { return write_obj(val, pBuf, buf_size, buffer_is_little_endian); }
- inline bool write_val(uint16 val, void*& pBuf, uint& buf_size, bool buffer_is_little_endian) { return write_obj(val, pBuf, buf_size, buffer_is_little_endian); }
- inline bool write_val(uint val, void*& pBuf, uint& buf_size, bool buffer_is_little_endian) { return write_obj(val, pBuf, buf_size, buffer_is_little_endian); }
- inline bool write_val(int val, void*& pBuf, uint& buf_size, bool buffer_is_little_endian) { return write_obj(val, pBuf, buf_size, buffer_is_little_endian); }
- inline bool write_val(uint64 val, void*& pBuf, uint& buf_size, bool buffer_is_little_endian) { return write_obj(val, pBuf, buf_size, buffer_is_little_endian); }
- inline bool write_val(float val, void*& pBuf, uint& buf_size, bool buffer_is_little_endian) { return write_obj(val, pBuf, buf_size, buffer_is_little_endian); }
- inline bool write_val(double val, void*& pBuf, uint& buf_size, bool buffer_is_little_endian) { return write_obj(val, pBuf, buf_size, buffer_is_little_endian); }
-
- template<typename T>
- inline bool read_obj(T& obj, const void*& pBuf, uint& buf_size, bool buffer_is_little_endian)
- {
- if (buf_size < sizeof(T))
- {
- zero_object(obj);
- return false;
- }
-
- utils::read_obj(obj, pBuf, buffer_is_little_endian);
-
- pBuf = static_cast<const uint8*>(pBuf) + sizeof(T);
- buf_size -= sizeof(T);
-
- return true;
- }
-
-#if defined(_MSC_VER)
- static CRNLIB_FORCE_INLINE uint16 swap16(uint16 x) { return _byteswap_ushort(x); }
- static CRNLIB_FORCE_INLINE uint32 swap32(uint32 x) { return _byteswap_ulong(x); }
- static CRNLIB_FORCE_INLINE uint64 swap64(uint64 x) { return _byteswap_uint64(x); }
-#elif defined(__GNUC__)
- static CRNLIB_FORCE_INLINE uint16 swap16(uint16 x) { return static_cast<uint16>((x << 8U) | (x >> 8U)); }
- static CRNLIB_FORCE_INLINE uint32 swap32(uint32 x) { return __builtin_bswap32(x); }
- static CRNLIB_FORCE_INLINE uint64 swap64(uint64 x) { return __builtin_bswap64(x); }
-#else
- static CRNLIB_FORCE_INLINE uint16 swap16(uint16 x) { return static_cast<uint16>((x << 8U) | (x >> 8U)); }
- static CRNLIB_FORCE_INLINE uint32 swap32(uint32 x) { return ((x << 24U) | ((x << 8U) & 0x00FF0000U) | ((x >> 8U) & 0x0000FF00U) | (x >> 24U)); }
- static CRNLIB_FORCE_INLINE uint64 swap64(uint64 x) { return (static_cast<uint64>(swap32(static_cast<uint32>(x))) << 32ULL) | swap32(static_cast<uint32>(x >> 32U)); }
-#endif
-
- // Assumes x has been read from memory as a little endian value, converts to native endianness for manipulation.
- CRNLIB_FORCE_INLINE uint16 swap_le16_to_native(uint16 x) { return c_crnlib_little_endian_platform ? x : swap16(x); }
- CRNLIB_FORCE_INLINE uint32 swap_le32_to_native(uint32 x) { return c_crnlib_little_endian_platform ? x : swap32(x); }
- CRNLIB_FORCE_INLINE uint64 swap_le64_to_native(uint64 x) { return c_crnlib_little_endian_platform ? x : swap64(x); }
-
- // Assumes x has been read from memory as a big endian value, converts to native endianness for manipulation.
- CRNLIB_FORCE_INLINE uint16 swap_be16_to_native(uint16 x) { return c_crnlib_big_endian_platform ? x : swap16(x); }
- CRNLIB_FORCE_INLINE uint32 swap_be32_to_native(uint32 x) { return c_crnlib_big_endian_platform ? x : swap32(x); }
- CRNLIB_FORCE_INLINE uint64 swap_be64_to_native(uint64 x) { return c_crnlib_big_endian_platform ? x : swap64(x); }
-
- CRNLIB_FORCE_INLINE uint32 read_le32(const void* p) { return swap_le32_to_native(*static_cast<const uint32*>(p)); }
- CRNLIB_FORCE_INLINE void write_le32(void* p, uint32 x) { *static_cast<uint32*>(p) = swap_le32_to_native(x); }
- CRNLIB_FORCE_INLINE uint64 read_le64(const void* p) { return swap_le64_to_native(*static_cast<const uint64*>(p)); }
- CRNLIB_FORCE_INLINE void write_le64(void* p, uint64 x) { *static_cast<uint64*>(p) = swap_le64_to_native(x); }
-
- CRNLIB_FORCE_INLINE uint32 read_be32(const void* p) { return swap_be32_to_native(*static_cast<const uint32*>(p)); }
- CRNLIB_FORCE_INLINE void write_be32(void* p, uint32 x) { *static_cast<uint32*>(p) = swap_be32_to_native(x); }
- CRNLIB_FORCE_INLINE uint64 read_be64(const void* p) { return swap_be64_to_native(*static_cast<const uint64*>(p)); }
- CRNLIB_FORCE_INLINE void write_be64(void* p, uint64 x) { *static_cast<uint64*>(p) = swap_be64_to_native(x); }
-
- inline void endian_swap_mem16(uint16* p, uint n) { while (n--) { *p = swap16(*p); ++p; } }
- inline void endian_swap_mem32(uint32* p, uint n) { while (n--) { *p = swap32(*p); ++p; } }
- inline void endian_swap_mem64(uint64* p, uint n) { while (n--) { *p = swap64(*p); ++p; } }
-
- inline void endian_swap_mem(void* p, uint size_in_bytes, uint type_size)
- {
- switch (type_size)
- {
- case sizeof(uint16): endian_swap_mem16(static_cast<uint16*>(p), size_in_bytes / type_size); break;
- case sizeof(uint32): endian_swap_mem32(static_cast<uint32*>(p), size_in_bytes / type_size); break;
- case sizeof(uint64): endian_swap_mem64(static_cast<uint64*>(p), size_in_bytes / type_size); break;
- }
- }
-
- inline void fast_memset(void* pDst, int val, size_t size)
- {
- memset(pDst, val, size);
- }
-
- inline void fast_memcpy(void* pDst, const void* pSrc, size_t size)
- {
- memcpy(pDst, pSrc, size);
- }
-
- inline uint count_leading_zeros(uint v)
- {
- uint temp;
- uint n = 32;
-
- temp = v >> 16;
- if (temp) { n -= 16; v = temp; }
-
- temp = v >> 8;
- if (temp) { n -= 8; v = temp; }
-
- temp = v >> 4;
- if (temp) { n -= 4; v = temp; }
-
- temp = v >> 2;
- if (temp) { n -= 2; v = temp; }
-
- temp = v >> 1;
- if (temp) { n -= 1; v = temp; }
-
- if (v & 1) n--;
-
- return n;
- }
-
- inline uint count_leading_zeros16(uint v)
- {
- CRNLIB_ASSERT(v < 0x10000);
-
- uint temp;
- uint n = 16;
-
- temp = v >> 8;
- if (temp) { n -= 8; v = temp; }
-
- temp = v >> 4;
- if (temp) { n -= 4; v = temp; }
-
- temp = v >> 2;
- if (temp) { n -= 2; v = temp; }
-
- temp = v >> 1;
- if (temp) { n -= 1; v = temp; }
-
- if (v & 1) n--;
-
- return n;
- }
-
- void endian_switch_words(uint16* p, uint num);
- void endian_switch_dwords(uint32* p, uint num);
- void copy_words(uint16* pDst, const uint16* pSrc, uint num, bool endian_switch);
- void copy_dwords(uint32* pDst, const uint32* pSrc, uint num, bool endian_switch);
-
- uint compute_max_mips(uint width, uint height);
-
- } // namespace utils
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_value.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_value.cpp
deleted file mode 100644
index 77245008..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_value.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// File: crn_value.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_value.h"
-
-namespace crnlib
-{
- const char* gValueDataTypeStrings[cDTTotal + 1] =
- {
- "invalid",
- "string",
- "bool",
- "int",
- "uint",
- "float",
- "vec3f",
- "vec3i",
-
- NULL,
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_value.h b/Libraries/crunch-ea9b8d/crnlib/crn_value.h
deleted file mode 100644
index eabff1f7..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_value.h
+++ /dev/null
@@ -1,1025 +0,0 @@
-// File: crn_value.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_strutils.h"
-#include "crn_dynamic_string.h"
-#include "crn_vec.h"
-
-namespace crnlib
-{
- enum value_data_type
- {
- cDTInvalid,
- cDTString,
- cDTBool,
- cDTInt,
- cDTUInt,
- cDTFloat,
- cDTVec3F,
- cDTVec3I,
-
- cDTTotal
- };
-
- extern const char* gValueDataTypeStrings[cDTTotal + 1];
-
- class value
- {
- public:
- value() :
- m_type(cDTInvalid)
- {
- }
-
- value(const char* pStr) :
- m_pStr(crnlib_new<dynamic_string>(pStr)), m_type(cDTString)
- {
- }
-
- value(const dynamic_string& str) :
- m_pStr(crnlib_new<dynamic_string>(str)), m_type(cDTString)
- {
- }
-
- explicit value(bool v) :
- m_bool(v), m_type(cDTBool)
- {
- }
-
- value(int v) :
- m_int(v), m_type(cDTInt)
- {
- }
-
- value(uint v) :
- m_uint(v), m_type(cDTUInt)
- {
- }
-
- value(float v) :
- m_float(v), m_type(cDTFloat)
- {
- }
-
- value(const vec3F& v) :
- m_pVec3F(crnlib_new<vec3F>(v)), m_type(cDTVec3F)
- {
- }
-
- value(const vec3I& v) :
- m_pVec3I(crnlib_new<vec3I>(v)), m_type(cDTVec3I)
- {
- }
-
- ~value()
- {
- switch (m_type)
- {
- case cDTString:
- crnlib_delete(m_pStr);
- break;
- case cDTVec3F:
- crnlib_delete(m_pVec3F);
- break;
- case cDTVec3I:
- crnlib_delete(m_pVec3I);
- break;
- default:
- break;
- }
- }
-
- value(const value& other) :
- m_type(cDTInvalid)
- {
- *this = other;
- }
-
- value& operator= (const value& other)
- {
- if (this == &other)
- return *this;
-
- change_type(other.m_type);
-
- switch (other.m_type)
- {
- case cDTString: m_pStr->set(*other.m_pStr); break;
- case cDTBool: m_bool = other.m_bool; break;
- case cDTInt: m_int = other.m_int; break;
- case cDTUInt: m_uint = other.m_uint; break;
- case cDTFloat: m_float = other.m_float; break;
- case cDTVec3F: m_pVec3F->set(*other.m_pVec3F); break;
- case cDTVec3I: m_pVec3I->set(*other.m_pVec3I); break;
- default: break;
- }
- return *this;
- }
-
- inline value_data_type get_data_type() const { return m_type; }
-
- void clear()
- {
- clear_dynamic();
-
- m_type = cDTInvalid;
- }
-
- void set_string(const char* pStr)
- {
- set_str(pStr);
- }
-
- void set_int(int v)
- {
- clear_dynamic();
- m_type = cDTInt;
- m_int = v;
- }
-
- void set_uint(uint v)
- {
- clear_dynamic();
- m_type = cDTUInt;
- m_uint = v;
- }
-
- void set_bool(bool v)
- {
- clear_dynamic();
- m_type = cDTBool;
- m_bool = v;
- }
-
- void set_float(float v)
- {
- clear_dynamic();
- m_type = cDTFloat;
- m_float = v;
- }
-
- void set_vec(const vec3F& v)
- {
- change_type(cDTVec3F);
- m_pVec3F->set(v);
- }
-
- void set_vec(const vec3I& v)
- {
- change_type(cDTVec3I);
- m_pVec3I->set(v);
- }
-
- bool parse(const char* p)
- {
- if ((!p) || (!p[0]))
- {
- clear();
- return false;
- }
-
- if (_stricmp(p, "false") == 0)
- {
- set_bool(false);
- return true;
- }
- else if (_stricmp(p, "true") == 0)
- {
- set_bool(true);
- return true;
- }
-
- if (p[0] == '\"')
- {
- dynamic_string str;
- str = p + 1;
- if (!str.is_empty())
- {
- if (str[str.get_len() - 1] == '\"')
- {
- str.left(str.get_len() - 1);
- set_str(str);
-
- return true;
- }
- }
- }
-
- if (strchr(p, ',') != NULL)
- {
- float fx = 0, fy = 0, fz = 0;
-#ifdef _MSC_VER
- if (sscanf_s(p, "%f,%f,%f", &fx, &fy, &fz) == 3)
-#else
- if (sscanf(p, "%f,%f,%f", &fx, &fy, &fz) == 3)
-#endif
- {
- bool as_float = true;
- int ix = 0, iy = 0, iz = 0;
-#ifdef _MSC_VER
- if (sscanf_s(p, "%i,%i,%i", &ix, &iy, &iz) == 3)
-#else
- if (sscanf(p, "%i,%i,%i", &ix, &iy, &iz) == 3)
-#endif
- {
- if ((ix == fx) && (iy == fy) && (iz == fz))
- as_float = false;
- }
-
- if (as_float)
- set_vec(vec3F(fx, fy, fz));
- else
- set_vec(vec3I(ix, iy, iz));
-
- return true;
- }
- }
-
- const char* q = p;
- bool success = string_to_uint(q, m_uint);
- if ((success) && (*q == 0))
- {
- set_uint(m_uint);
- return true;
- }
-
- q = p;
- success = string_to_int(q, m_int);
- if ((success) && (*q == 0))
- {
- set_int(m_int);
- return true;
- }
-
- q = p;
- success = string_to_float(q, m_float);
- if ((success) && (*q == 0))
- {
- set_float(m_float);
- return true;
- }
-
- set_string(p);
-
- return true;
- }
-
- dynamic_string& get_as_string(dynamic_string& dst) const
- {
- switch (m_type)
- {
- case cDTInvalid: dst.clear(); break;
- case cDTString: dst = *m_pStr; break;
- case cDTBool: dst = m_bool ? "TRUE" : "FALSE"; break;
- case cDTInt: dst.format("%i", m_int); break;
- case cDTUInt: dst.format("%u", m_uint); break;
- case cDTFloat: dst.format("%f", m_float); break;
- case cDTVec3F: dst.format("%f,%f,%f", (*m_pVec3F)[0], (*m_pVec3F)[1], (*m_pVec3F)[2]); break;
- case cDTVec3I: dst.format("%i,%i,%i", (*m_pVec3I)[0], (*m_pVec3I)[1], (*m_pVec3I)[2]); break;
- default: break;
- }
-
- return dst;
- }
-
- bool get_as_int(int& val, uint component = 0) const
- {
- switch (m_type)
- {
- case cDTInvalid:
- {
- val = 0;
- return false;
- }
- case cDTString:
- {
- const char* p = m_pStr->get_ptr();
- return string_to_int(p, val);
- }
- case cDTBool: val = m_bool; break;
- case cDTInt: val = m_int; break;
- case cDTUInt:
- {
- if (m_uint > INT_MAX)
- {
- val = 0;
- return false;
- }
- val = m_uint;
- break;
- }
- case cDTFloat:
- {
- if ((m_float < INT_MIN) || (m_float > INT_MAX))
- {
- val = 0;
- return false;
- }
- val = (int)m_float;
- break;
- }
- case cDTVec3F:
- {
- if (component > 2)
- {
- val = 0;
- return false;
- }
- if (((*m_pVec3F)[component] < INT_MIN) || ((*m_pVec3F)[component] > INT_MAX))
- {
- val = 0;
- return false;
- }
- val = (int)(*m_pVec3F)[component];
- break;
- }
- case cDTVec3I:
- {
- if (component > 2)
- {
- val = 0;
- return false;
- }
- val = (int)(*m_pVec3I)[component];
- break;
- }
- default: break;
- }
- return true;
- }
-
- bool get_as_uint(uint& val, uint component = 0) const
- {
- switch (m_type)
- {
- case cDTInvalid:
- {
- val = 0;
- return false;
- }
- case cDTString:
- {
- const char* p = m_pStr->get_ptr();
- return string_to_uint(p, val);
- }
- case cDTBool:
- {
- val = m_bool;
- break;
- }
- case cDTInt:
- {
- if (m_int < 0)
- {
- val = 0;
- return false;
- }
- val = (uint)m_int;
- break;
- }
- case cDTUInt:
- {
- val = m_uint;
- break;
- }
- case cDTFloat:
- {
- if ((m_float < 0) || (m_float > UINT_MAX))
- {
- val = 0;
- return false;
- }
- val = (uint)m_float;
- break;
- }
- case cDTVec3F:
- {
- if (component > 2)
- {
- val = 0;
- return false;
- }
- if (((*m_pVec3F)[component] < 0) || ((*m_pVec3F)[component] > UINT_MAX))
- {
- val = 0;
- return false;
- }
- val = (uint)(*m_pVec3F)[component];
- break;
- }
- case cDTVec3I:
- {
- if (component > 2)
- {
- val = 0;
- return false;
- }
- if ((*m_pVec3I)[component] < 0)
- {
- val = 0;
- return false;
- }
- val = (uint)(*m_pVec3I)[component];
- break;
- }
- default: break;
- }
- return true;
- }
-
- bool get_as_bool(bool& val, uint component = 0) const
- {
- switch (m_type)
- {
- case cDTInvalid:
- {
- val = false;
- return false;
- }
- case cDTString:
- {
- const char* p = m_pStr->get_ptr();
- return string_to_bool(p, val);
- }
- case cDTBool:
- {
- val = m_bool;
- break;
- }
- case cDTInt:
- {
- val = (m_int != 0);
- break;
- }
- case cDTUInt:
- {
- val = (m_uint != 0);
- break;
- }
- case cDTFloat:
- {
- val = (m_float != 0);
- break;
- }
- case cDTVec3F:
- {
- if (component > 2)
- {
- val = false;
- return false;
- }
- val = ((*m_pVec3F)[component] != 0);
- break;
- }
- case cDTVec3I:
- {
- if (component > 2)
- {
- val = false;
- return false;
- }
- val = ((*m_pVec3I)[component] != 0);
- break;
- }
- default: break;
- }
- return true;
- }
-
- bool get_as_float(float& val, uint component = 0) const
- {
- switch (m_type)
- {
- case cDTInvalid:
- {
- val = 0;
- return false;
- }
- case cDTString:
- {
- const char* p = m_pStr->get_ptr();
- return string_to_float(p, val);
- }
- case cDTBool:
- {
- val = m_bool;
- break;
- }
- case cDTInt:
- {
- val = (float)m_int;
- break;
- }
- case cDTUInt:
- {
- val = (float)m_uint;
- break;
- }
- case cDTFloat:
- {
- val = m_float;
- break;
- }
- case cDTVec3F:
- {
- if (component > 2)
- {
- val = 0;
- return false;
- }
- val = (*m_pVec3F)[component];
- break;
- }
- case cDTVec3I:
- {
- if (component > 2)
- {
- val = 0;
- return false;
- }
- val = (float)(*m_pVec3I)[component];
- break;
- }
- default: break;
- }
- return true;
- }
-
- bool get_as_vec(vec3F& val) const
- {
- switch (m_type)
- {
- case cDTInvalid:
- {
- val.clear();
- return false;
- }
- case cDTString:
- {
- const char* p = m_pStr->get_ptr();
- float x = 0, y = 0, z = 0;
-#ifdef _MSC_VER
- if (sscanf_s(p, "%f,%f,%f", &x, &y, &z) == 3)
-#else
- if (sscanf(p, "%f,%f,%f", &x, &y, &z) == 3)
-#endif
- {
- val.set(x, y, z);
- return true;
- }
- else
- {
- val.clear();
- return false;
- }
- }
- case cDTBool:
- {
- val.set(m_bool);
- break;
- }
- case cDTInt:
- {
- val.set(static_cast<float>(m_int));
- break;
- }
- case cDTUInt:
- {
- val.set(static_cast<float>(m_uint));
- break;
- }
- case cDTFloat:
- {
- val.set(m_float);
- break;
- }
- case cDTVec3F:
- {
- val = *m_pVec3F;
- break;
- }
- case cDTVec3I:
- {
- val.set((float)(*m_pVec3I)[0], (float)(*m_pVec3I)[1], (float)(*m_pVec3I)[2]);
- break;
- }
- default: break;
- }
- return true;
- }
-
- bool get_as_vec(vec3I& val) const
- {
- switch (m_type)
- {
- case cDTInvalid:
- {
- val.clear();
- return false;
- }
- case cDTString:
- {
- const char* p = m_pStr->get_ptr();
- float x = 0, y = 0, z = 0;
-#ifdef _MSC_VER
- if (sscanf_s(p, "%f,%f,%f", &x, &y, &z) == 3)
-#else
- if (sscanf(p, "%f,%f,%f", &x, &y, &z) == 3)
-#endif
- {
- if ((x < INT_MIN) || (x > INT_MAX) || (y < INT_MIN) || (y > INT_MAX) || (z < INT_MIN) || (z > INT_MAX))
- {
- val.clear();
- return false;
- }
- val.set((int)x, (int)y, (int)z);
- return true;
- }
- else
- {
- val.clear();
- return false;
- }
-
- break;
- }
- case cDTBool:
- {
- val.set(m_bool);
- break;
- }
- case cDTInt:
- {
- val.set(m_int);
- break;
- }
- case cDTUInt:
- {
- val.set(m_uint);
- break;
- }
- case cDTFloat:
- {
- val.set((int)m_float);
- break;
- }
- case cDTVec3F:
- {
- val.set((int)(*m_pVec3F)[0], (int)(*m_pVec3F)[1], (int)(*m_pVec3F)[2]);
- break;
- }
- case cDTVec3I:
- {
- val = *m_pVec3I;
- break;
- }
- default: break;
- }
- return true;
- }
-
- bool set_zero()
- {
- switch (m_type)
- {
- case cDTInvalid:
- {
- return false;
- }
- case cDTString:
- {
- m_pStr->empty();
- break;
- }
- case cDTBool:
- {
- m_bool = false;
- break;
- }
- case cDTInt:
- {
- m_int = 0;
- break;
- }
- case cDTUInt:
- {
- m_uint = 0;
- break;
- }
- case cDTFloat:
- {
- m_float = 0;
- break;
- }
- case cDTVec3F:
- {
- m_pVec3F->clear();
- break;
- }
- case cDTVec3I:
- {
- m_pVec3I->clear();
- break;
- }
- default: break;
- }
- return true;
- }
-
- bool is_vector() const
- {
- switch (m_type)
- {
- case cDTVec3F:
- case cDTVec3I:
- return true;
- default: break;
- }
- return false;
- }
-
- uint get_num_components() const
- {
- switch (m_type)
- {
- case cDTVec3F:
- case cDTVec3I:
- return 3;
- default: break;
- }
- return 1;
- }
-
- bool is_numeric() const
- {
- switch (m_type)
- {
- case cDTInt:
- case cDTUInt:
- case cDTFloat:
- case cDTVec3F:
- case cDTVec3I:
- return true;
- default: break;
- }
- return false;
- }
-
- bool is_float() const
- {
- switch (m_type)
- {
- case cDTFloat:
- case cDTVec3F:
- return true;
- default: break;
- }
- return false;
- }
-
- bool is_integer() const
- {
- switch (m_type)
- {
- case cDTInt:
- case cDTUInt:
- case cDTVec3I:
- return true;
- default: break;
- }
- return false;
- }
-
- bool is_signed() const
- {
- switch (m_type)
- {
- case cDTInt:
- case cDTFloat:
- case cDTVec3F:
- case cDTVec3I:
- return true;
- default: break;
- }
- return false;
- }
-
- bool is_string() const
- {
- return m_type == cDTString;
- }
-
- int serialize(void* pBuf, uint buf_size, bool little_endian) const
- {
- uint buf_left = buf_size;
-
- uint8 t = (uint8)m_type;
- if (!utils::write_obj(t, pBuf, buf_left, little_endian)) return -1;
-
- switch (m_type)
- {
- case cDTString:
- {
- int bytes_written = m_pStr->serialize(pBuf, buf_left, little_endian);
- if (bytes_written < 0) return -1;
-
- pBuf = static_cast<uint8*>(pBuf) + bytes_written;
- buf_left -= bytes_written;
-
- break;
- }
- case cDTBool:
- {
- if (!utils::write_obj(m_bool, pBuf, buf_left, little_endian)) return -1;
- break;
- }
- case cDTInt:
- case cDTUInt:
- case cDTFloat:
- {
- if (!utils::write_obj(m_float, pBuf, buf_left, little_endian)) return -1;
- break;
- }
- case cDTVec3F:
- {
- for (uint i = 0; i < 3; i++)
- if (!utils::write_obj((*m_pVec3F)[i], pBuf, buf_left, little_endian)) return -1;
- break;
- }
- case cDTVec3I:
- {
- for (uint i = 0; i < 3; i++)
- if (!utils::write_obj((*m_pVec3I)[i], pBuf, buf_left, little_endian)) return -1;
- break;
- }
- default: break;
- }
-
- return buf_size - buf_left;
- }
-
- int deserialize(const void* pBuf, uint buf_size, bool little_endian)
- {
- uint buf_left = buf_size;
-
- uint8 t;
- if (!utils::read_obj(t, pBuf, buf_left, little_endian)) return -1;
-
- if (t >= cDTTotal)
- return -1;
-
- m_type = static_cast<value_data_type>(t);
-
- switch (m_type)
- {
- case cDTString:
- {
- change_type(cDTString);
-
- int bytes_read = m_pStr->deserialize(pBuf, buf_left, little_endian);
- if (bytes_read < 0) return -1;
-
- pBuf = static_cast<const uint8*>(pBuf) + bytes_read;
- buf_left -= bytes_read;
-
- break;
- }
- case cDTBool:
- {
- if (!utils::read_obj(m_bool, pBuf, buf_left, little_endian)) return -1;
- break;
- }
- case cDTInt:
- case cDTUInt:
- case cDTFloat:
- {
- if (!utils::read_obj(m_float, pBuf, buf_left, little_endian)) return -1;
- break;
- }
- case cDTVec3F:
- {
- change_type(cDTVec3F);
-
- for (uint i = 0; i < 3; i++)
- if (!utils::read_obj((*m_pVec3F)[i], pBuf, buf_left, little_endian)) return -1;
- break;
- }
- case cDTVec3I:
- {
- change_type(cDTVec3I);
-
- for (uint i = 0; i < 3; i++)
- if (!utils::read_obj((*m_pVec3I)[i], pBuf, buf_left, little_endian)) return -1;
- break;
- }
- default: break;
- }
-
- return buf_size - buf_left;
- }
-
- void swap(value& other)
- {
- for (uint i = 0; i < cUnionSize; i++)
- std::swap(m_union[i], other.m_union[i]);
-
- std::swap(m_type, other.m_type);
- }
-
- private:
- void clear_dynamic()
- {
- if (m_type == cDTVec3F)
- {
- crnlib_delete(m_pVec3F);
- m_pVec3F = NULL;
-
- m_type = cDTInvalid;
- }
- else if (m_type == cDTVec3I)
- {
- crnlib_delete(m_pVec3I);
- m_pVec3I = NULL;
-
- m_type = cDTInvalid;
- }
- else if (m_type == cDTString)
- {
- crnlib_delete(m_pStr);
- m_pStr = NULL;
-
- m_type = cDTInvalid;
- }
- }
-
- void change_type(value_data_type type)
- {
- if (type != m_type)
- {
- clear_dynamic();
-
- m_type = type;
-
- switch (m_type)
- {
- case cDTString:
- m_pStr = crnlib_new<dynamic_string>();
- break;
- case cDTVec3F:
- m_pVec3F = crnlib_new<vec3F>();
- break;
- case cDTVec3I:
- m_pVec3I = crnlib_new<vec3I>();
- break;
- default: break;
- }
- }
- }
-
- void set_str(const dynamic_string& s)
- {
- if (m_type == cDTString)
- m_pStr->set(s);
- else
- {
- clear_dynamic();
-
- m_type = cDTString;
- m_pStr = crnlib_new<dynamic_string>(s);
- }
- }
-
- void set_str(const char* p)
- {
- if (m_type == cDTString)
- m_pStr->set(p);
- else
- {
- clear_dynamic();
-
- m_type = cDTString;
- m_pStr = crnlib_new<dynamic_string>(p);
- }
- }
-
- enum { cUnionSize = 1 };
-
- union
- {
- bool m_bool;
- int m_int;
- uint m_uint;
- float m_float;
-
- vec3F* m_pVec3F;
- vec3I* m_pVec3I;
- dynamic_string* m_pStr;
-
- uint m_union[cUnionSize];
- };
-
- value_data_type m_type;
- };
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_vec.h b/Libraries/crunch-ea9b8d/crnlib/crn_vec.h
deleted file mode 100644
index f380aa20..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_vec.h
+++ /dev/null
@@ -1,838 +0,0 @@
-// File: crn_vec.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-#include "crn_core.h"
-#include "crn_rand.h"
-
-namespace crnlib
-{
- template<uint N, typename T> class vec : public helpers::rel_ops< vec<N, T> >
- {
- public:
- typedef T scalar_type;
- enum { num_elements = N };
-
- inline vec() { }
-
- inline vec(eClear) { clear(); }
-
- inline vec(const vec& other)
- {
- for (uint i = 0; i < N; i++)
- m_s[i] = other.m_s[i];
- }
-
- template<uint O, typename U>
- inline vec(const vec<O, U>& other)
- {
- set(other);
- }
-
- template<uint O, typename U>
- inline vec(const vec<O, U>& other, T w)
- {
- *this = other;
- m_s[N - 1] = w;
- }
-
- explicit inline vec(T val)
- {
- set(val);
- }
-
- inline vec(T val0, T val1)
- {
- set(val0, val1);
- }
-
- inline vec(T val0, T val1, T val2)
- {
- set(val0, val1, val2);
- }
-
- inline vec(T val0, T val1, T val2, T val3)
- {
- set(val0, val1, val2, val3);
- }
-
- inline void clear()
- {
- if (N > 4)
- memset(m_s, 0, sizeof(m_s));
- else
- {
- for (uint i = 0; i < N; i++)
- m_s[i] = 0;
- }
- }
-
- template<uint ON, typename OT> inline vec& set(const vec<ON, OT>& other)
- {
- if ((void*)this == (void*)&other)
- return *this;
- const uint m = math::minimum(N, ON);
- uint i;
- for (i = 0; i < m; i++)
- m_s[i] = static_cast<T>(other[i]);
- for ( ; i < N; i++)
- m_s[i] = 0;
- return *this;
- }
-
- inline vec& set_component(uint index, T val)
- {
- CRNLIB_ASSERT(index < N);
- m_s[index] = val;
- return *this;
- }
-
- inline vec& set(T val)
- {
- for (uint i = 0; i < N; i++)
- m_s[i] = val;
- return *this;
- }
-
- inline vec& set(T val0, T val1)
- {
- m_s[0] = val0;
- if (N >= 2)
- {
- m_s[1] = val1;
-
- for (uint i = 2; i < N; i++)
- m_s[i] = 0;
- }
- return *this;
- }
-
- inline vec& set(T val0, T val1, T val2)
- {
- m_s[0] = val0;
- if (N >= 2)
- {
- m_s[1] = val1;
-
- if (N >= 3)
- {
- m_s[2] = val2;
-
- for (uint i = 3; i < N; i++)
- m_s[i] = 0;
- }
- }
- return *this;
- }
-
- inline vec& set(T val0, T val1, T val2, T val3)
- {
- m_s[0] = val0;
- if (N >= 2)
- {
- m_s[1] = val1;
-
- if (N >= 3)
- {
- m_s[2] = val2;
-
- if (N >= 4)
- {
- m_s[3] = val3;
-
- for (uint i = 4; i < N; i++)
- m_s[i] = 0;
- }
- }
- }
- return *this;
- }
-
- inline vec& set(const T* pValues)
- {
- for (uint i = 0; i < N; i++)
- m_s[i] = pValues[i];
- return *this;
- }
-
- template<uint ON, typename OT> inline vec& swizzle_set(const vec<ON, OT>& other, uint i)
- {
- return set(static_cast<T>(other[i]));
- }
-
- template<uint ON, typename OT> inline vec& swizzle_set(const vec<ON, OT>& other, uint i, uint j)
- {
- return set(static_cast<T>(other[i]), static_cast<T>(other[j]));
- }
-
- template<uint ON, typename OT> inline vec& swizzle_set(const vec<ON, OT>& other, uint i, uint j, uint k)
- {
- return set(static_cast<T>(other[i]), static_cast<T>(other[j]), static_cast<T>(other[k]));
- }
-
- template<uint ON, typename OT> inline vec& swizzle_set(const vec<ON, OT>& other, uint i, uint j, uint k, uint l)
- {
- return set(static_cast<T>(other[i]), static_cast<T>(other[j]), static_cast<T>(other[k]), static_cast<T>(other[l]));
- }
-
- inline vec& operator= (const vec& rhs)
- {
- if (this != &rhs)
- {
- for (uint i = 0; i < N; i++)
- m_s[i] = rhs.m_s[i];
- }
- return *this;
- }
-
- template<uint O, typename U>
- inline vec& operator= (const vec<O, U>& other)
- {
- if ((void*)this == (void*)&other)
- return *this;
-
- uint s = math::minimum(N, O);
-
- uint i;
- for (i = 0; i < s; i++)
- m_s[i] = static_cast<T>(other[i]);
-
- for ( ; i < N; i++)
- m_s[i] = 0;
-
- return *this;
- }
-
- inline bool operator== (const vec& rhs) const
- {
- for (uint i = 0; i < N; i++)
- if (!(m_s[i] == rhs.m_s[i]))
- return false;
- return true;
- }
-
- inline bool operator< (const vec& rhs) const
- {
- for (uint i = 0; i < N; i++)
- {
- if (m_s[i] < rhs.m_s[i])
- return true;
- else if (!(m_s[i] == rhs.m_s[i]))
- return false;
- }
-
- return false;
- }
-
- inline T operator[] (uint i) const
- {
- CRNLIB_ASSERT(i < N);
- return m_s[i];
- }
-
- inline T& operator[] (uint i)
- {
- CRNLIB_ASSERT(i < N);
- return m_s[i];
- }
-
- inline T get_x(void) const { return m_s[0]; }
- inline T get_y(void) const { CRNLIB_ASSUME(N >= 2); return m_s[1]; }
- inline T get_z(void) const { CRNLIB_ASSUME(N >= 3); return m_s[2]; }
- inline T get_w(void) const { CRNLIB_ASSUME(N >= 4); return m_s[3]; }
-
- inline vec& set_x(T v) { m_s[0] = v; return *this; }
- inline vec& set_y(T v) { CRNLIB_ASSUME(N >= 2); m_s[1] = v; return *this; }
- inline vec& set_z(T v) { CRNLIB_ASSUME(N >= 3); m_s[2] = v; return *this; }
- inline vec& set_w(T v) { CRNLIB_ASSUME(N >= 4); m_s[3] = v; return *this; }
-
- inline vec as_point() const
- {
- vec result(*this);
- result[N - 1] = 1;
- return result;
- }
-
- inline vec as_dir() const
- {
- vec result(*this);
- result[N - 1] = 0;
- return result;
- }
-
- inline vec<2, T> select2(uint i, uint j) const
- {
- CRNLIB_ASSERT((i < N) && (j < N));
- return vec<2, T>(m_s[i], m_s[j]);
- }
-
- inline vec<3, T> select3(uint i, uint j, uint k) const
- {
- CRNLIB_ASSERT((i < N) && (j < N) && (k < N));
- return vec<3, T>(m_s[i], m_s[j], m_s[k]);
- }
-
- inline vec<4, T> select4(uint i, uint j, uint k, uint l) const
- {
- CRNLIB_ASSERT((i < N) && (j < N) && (k < N) && (l < N));
- return vec<4, T>(m_s[i], m_s[j], m_s[k], m_s[l]);
- }
-
- inline bool is_dir() const { return m_s[N - 1] == 0; }
- inline bool is_vector() const { return is_dir(); }
- inline bool is_point() const { return m_s[N - 1] == 1; }
-
- inline vec project() const
- {
- vec result(*this);
- if (result[N - 1])
- result /= result[N - 1];
- return result;
- }
-
- inline vec broadcast(unsigned i) const
- {
- return vec((*this)[i]);
- }
-
- inline vec swizzle(uint i, uint j) const
- {
- return vec((*this)[i], (*this)[j]);
- }
-
- inline vec swizzle(uint i, uint j, uint k) const
- {
- return vec((*this)[i], (*this)[j], (*this)[k]);
- }
-
- inline vec swizzle(uint i, uint j, uint k, uint l) const
- {
- return vec((*this)[i], (*this)[j], (*this)[k], (*this)[l]);
- }
-
- inline vec operator- () const
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result.m_s[i] = -m_s[i];
- return result;
- }
-
- inline vec operator+ () const
- {
- return *this;
- }
-
- inline vec& operator += (const vec& other)
- {
- for (uint i = 0; i < N; i++)
- m_s[i] += other.m_s[i];
- return *this;
- }
-
- inline vec& operator -= (const vec& other)
- {
- for (uint i = 0; i < N; i++)
- m_s[i] -= other.m_s[i];
- return *this;
- }
-
- inline vec& operator *= (const vec& other)
- {
- for (uint i = 0; i < N; i++)
- m_s[i] *= other.m_s[i];
- return *this;
- }
-
- inline vec& operator /= (const vec& other)
- {
- for (uint i = 0; i < N; i++)
- m_s[i] /= other.m_s[i];
- return *this;
- }
-
- inline vec& operator *= (T s)
- {
- for (uint i = 0; i < N; i++)
- m_s[i] *= s;
- return *this;
- }
-
- inline vec& operator /= (T s)
- {
- for (uint i = 0; i < N; i++)
- m_s[i] /= s;
- return *this;
- }
-
- friend inline T operator* (const vec& lhs, const vec& rhs)
- {
- T result = lhs.m_s[0] * rhs.m_s[0];
- for (uint i = 1; i < N; i++)
- result += lhs.m_s[i] * rhs.m_s[i];
- return result;
- }
-
- friend inline vec operator* (const vec& lhs, T val)
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result.m_s[i] = lhs.m_s[i] * val;
- return result;
- }
-
- friend inline vec operator* (T val, const vec& lhs)
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result.m_s[i] = lhs.m_s[i] * val;
- return result;
- }
-
- friend inline vec operator/ (const vec& lhs, const vec& rhs)
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result.m_s[i] = lhs.m_s[i] / rhs.m_s[i];
- return result;
- }
-
- friend inline vec operator/ (const vec& lhs, T val)
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result.m_s[i] = lhs.m_s[i] / val;
- return result;
- }
-
- friend inline vec operator+ (const vec& lhs, const vec& rhs)
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result.m_s[i] = lhs.m_s[i] + rhs.m_s[i];
- return result;
- }
-
- friend inline vec operator- (const vec& lhs, const vec& rhs)
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result.m_s[i] = lhs.m_s[i] - rhs.m_s[i];
- return result;
- }
-
- static inline vec<3, T> cross2(const vec& a, const vec& b)
- {
- CRNLIB_ASSUME(N >= 2);
- return vec<3, T>(0, 0, a[0] * b[1] - a[1] * b[0]);
- }
-
- static inline vec<3, T> cross3(const vec& a, const vec& b)
- {
- CRNLIB_ASSUME(N >= 3);
- return vec<3, T>(a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]);
- }
-
- static inline vec<3, T> cross(const vec& a, const vec& b)
- {
- CRNLIB_ASSUME(N >= 2);
-
- if (N == 2)
- return cross2(a, b);
- else
- return cross3(a, b);
- }
-
- inline T dot(const vec& rhs) const
- {
- return *this * rhs;
- }
-
- inline T dot2(const vec& rhs) const
- {
- CRNLIB_ASSUME(N >= 2);
- return m_s[0] * rhs.m_s[0] + m_s[1] * rhs.m_s[1];
- }
-
- inline T dot3(const vec& rhs) const
- {
- CRNLIB_ASSUME(N >= 3);
- return m_s[0] * rhs.m_s[0] + m_s[1] * rhs.m_s[1] + m_s[2] * rhs.m_s[2];
- }
-
- inline T norm(void) const
- {
- T sum = m_s[0] * m_s[0];
- for (uint i = 1; i < N; i++)
- sum += m_s[i] * m_s[i];
- return sum;
- }
-
- inline T length(void) const
- {
- return sqrt(norm());
- }
-
- inline T squared_distance(const vec& rhs) const
- {
- T dist2 = 0;
- for (uint i = 0; i < N; i++)
- {
- T d = m_s[i] - rhs.m_s[i];
- dist2 += d * d;
- }
- return dist2;
- }
-
- inline T squared_distance(const vec& rhs, T early_out) const
- {
- T dist2 = 0;
- for (uint i = 0; i < N; i++)
- {
- T d = m_s[i] - rhs.m_s[i];
- dist2 += d * d;
- if (dist2 > early_out)
- break;
- }
- return dist2;
- }
-
- inline T distance(const vec& rhs) const
- {
- T dist2 = 0;
- for (uint i = 0; i < N; i++)
- {
- T d = m_s[i] - rhs.m_s[i];
- dist2 += d * d;
- }
- return sqrt(dist2);
- }
-
- inline vec inverse() const
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result[i] = m_s[i] ? (1.0f / m_s[i]) : 0;
- return result;
- }
-
- inline double normalize(const vec* pDefaultVec = NULL)
- {
- double n = m_s[0] * m_s[0];
- for (uint i = 1; i < N; i++)
- n += m_s[i] * m_s[i];
-
- if (n != 0)
- *this *= static_cast<T>((1.0f / sqrt(n)));
- else if (pDefaultVec)
- *this = *pDefaultVec;
- return n;
- }
-
- inline double normalize3(const vec* pDefaultVec = NULL)
- {
- CRNLIB_ASSUME(N >= 3);
-
- double n = m_s[0] * m_s[0] + m_s[1] * m_s[1] + m_s[2] * m_s[2];
-
- if (n != 0)
- *this *= static_cast<T>((1.0f / sqrt(n)));
- else if (pDefaultVec)
- *this = *pDefaultVec;
- return n;
- }
-
- inline vec& normalize_in_place(const vec* pDefaultVec = NULL)
- {
- normalize(pDefaultVec);
- return *this;
- }
-
- inline vec& normalize3_in_place(const vec* pDefaultVec = NULL)
- {
- normalize3(pDefaultVec);
- return *this;
- }
-
- inline vec get_normalized(const vec* pDefaultVec = NULL) const
- {
- vec result(*this);
- result.normalize(pDefaultVec);
- return result;
- }
-
- inline vec get_normalized3(const vec* pDefaultVec = NULL) const
- {
- vec result(*this);
- result.normalize3(pDefaultVec);
- return result;
- }
-
- inline vec& clamp(T l, T h)
- {
- for (uint i = 0; i < N; i++)
- m_s[i] = static_cast<T>(math::clamp(m_s[i], l, h));
- return *this;
- }
-
- inline vec& clamp(const vec& l, const vec& h)
- {
- for (uint i = 0; i < N; i++)
- m_s[i] = static_cast<T>(math::clamp(m_s[i], l[i], h[i]));
- return *this;
- }
-
- inline bool is_within_bounds(const vec& l, const vec& h) const
- {
- for (uint i = 0; i < N; i++)
- if ((m_s[i] < l[i]) || (m_s[i] > h[i]))
- return false;
-
- return true;
- }
-
- inline bool is_within_bounds(T l, T h) const
- {
- for (uint i = 0; i < N; i++)
- if ((m_s[i] < l) || (m_s[i] > h))
- return false;
-
- return true;
- }
-
- inline uint get_major_axis(void) const
- {
- T m = fabs(m_s[0]);
- uint r = 0;
- for (uint i = 1; i < N; i++)
- {
- const T c = fabs(m_s[i]);
- if (c > m)
- {
- m = c;
- r = i;
- }
- }
- return r;
- }
-
- inline uint get_minor_axis(void) const
- {
- T m = fabs(m_s[0]);
- uint r = 0;
- for (uint i = 1; i < N; i++)
- {
- const T c = fabs(m_s[i]);
- if (c < m)
- {
- m = c;
- r = i;
- }
- }
- return r;
- }
-
- inline T get_absolute_minimum(void) const
- {
- T result = fabs(m_s[0]);
- for (uint i = 1; i < N; i++)
- result = math::minimum(result, fabs(m_s[i]));
- return result;
- }
-
- inline T get_absolute_maximum(void) const
- {
- T result = fabs(m_s[0]);
- for (uint i = 1; i < N; i++)
- result = math::maximum(result, fabs(m_s[i]));
- return result;
- }
-
- inline T get_minimum(void) const
- {
- T result = m_s[0];
- for (uint i = 1; i < N; i++)
- result = math::minimum(result, m_s[i]);
- return result;
- }
-
- inline T get_maximum(void) const
- {
- T result = m_s[0];
- for (uint i = 1; i < N; i++)
- result = math::maximum(result, m_s[i]);
- return result;
- }
-
- inline vec& remove_unit_direction(const vec& dir)
- {
- T p = *this * dir;
- *this -= (p * dir);
- return *this;
- }
-
- inline bool all_less(const vec& b) const
- {
- for (uint i = 0; i < N; i++)
- if (m_s[i] >= b.m_s[i])
- return false;
- return true;
- }
-
- inline bool all_less_equal(const vec& b) const
- {
- for (uint i = 0; i < N; i++)
- if (m_s[i] > b.m_s[i])
- return false;
- return true;
- }
-
- inline bool all_greater(const vec& b) const
- {
- for (uint i = 0; i < N; i++)
- if (m_s[i] <= b.m_s[i])
- return false;
- return true;
- }
-
- inline bool all_greater_equal(const vec& b) const
- {
- for (uint i = 0; i < N; i++)
- if (m_s[i] < b.m_s[i])
- return false;
- return true;
- }
-
- inline vec get_negate_xyz() const
- {
- vec ret;
-
- ret[0] = -m_s[0];
- if (N >= 2) ret[1] = -m_s[1];
- if (N >= 3) ret[2] = -m_s[2];
-
- for (uint i = 3; i < N; i++)
- ret[i] = m_s[i];
-
- return ret;
- }
-
- inline vec& invert()
- {
- for (uint i = 0; i < N; i++)
- if (m_s[i] != 0.0f)
- m_s[i] = 1.0f / m_s[i];
- return *this;
- }
-
- static inline vec mul_components(const vec& lhs, const vec& rhs)
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result[i] = lhs.m_s[i] * rhs.m_s[i];
- return result;
- }
-
- static inline vec make_axis(uint i)
- {
- vec result;
- result.clear();
- result[i] = 1;
- return result;
- }
-
- static inline vec component_max(const vec& a, const vec& b)
- {
- vec ret;
- for (uint i = 0; i < N; i++)
- ret.m_s[i] = math::maximum(a.m_s[i], b.m_s[i]);
- return ret;
- }
-
- static inline vec component_min(const vec& a, const vec& b)
- {
- vec ret;
- for (uint i = 0; i < N; i++)
- ret.m_s[i] = math::minimum(a.m_s[i], b.m_s[i]);
- return ret;
- }
-
- static inline vec lerp(const vec& a, const vec& b, float t)
- {
- vec ret;
- for (uint i = 0; i < N; i++)
- ret.m_s[i] = a.m_s[i] + (b.m_s[i] - a.m_s[i]) * t;
- return ret;
- }
-
- static inline vec make_random(random& r, float l, float h)
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result[i] = r.frand(l, h);
- return result;
- }
-
- static inline vec make_random(fast_random& r, float l, float h)
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result[i] = r.frand(l, h);
- return result;
- }
-
- static inline vec make_random(random& r, const vec& l, const vec& h)
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result[i] = r.frand(l[i], h[i]);
- return result;
- }
-
- static inline vec make_random(fast_random& r, const vec& l, const vec& h)
- {
- vec result;
- for (uint i = 0; i < N; i++)
- result[i] = r.frand(l[i], h[i]);
- return result;
- }
-
- private:
- T m_s[N];
- };
-
- typedef vec<1, double> vec1D;
- typedef vec<2, double> vec2D;
- typedef vec<3, double> vec3D;
- typedef vec<4, double> vec4D;
-
- typedef vec<1, float> vec1F;
-
- typedef vec<2, float> vec2F;
- typedef crnlib::vector<vec2F> vec2F_array;
-
- typedef vec<3, float> vec3F;
- typedef crnlib::vector<vec3F> vec3F_array;
-
- typedef vec<4, float> vec4F;
- typedef crnlib::vector<vec4F> vec4F_array;
-
- typedef vec<2, int> vec2I;
- typedef vec<3, int> vec3I;
-
- typedef vec<2, int16> vec2I16;
- typedef vec<3, int16> vec3I16;
-
- template<uint N, typename T>
- struct scalar_type< vec<N, T> >
- {
- enum { cFlag = true };
- static inline void construct(vec<N, T>* p) { }
- static inline void construct(vec<N, T>* p, const vec<N, T>& init) { memcpy(p, &init, sizeof(vec<N, T>)); }
- static inline void construct_array(vec<N, T>* p, uint n) { p, n; }
- static inline void destruct(vec<N, T>* p) { p; }
- static inline void destruct_array(vec<N, T>* p, uint n) { p, n; }
- };
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_vec_interval.h b/Libraries/crunch-ea9b8d/crnlib/crn_vec_interval.h
deleted file mode 100644
index 8dc452ed..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_vec_interval.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// File: crn_vec_interval.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_vec.h"
-
-namespace crnlib
-{
- template<typename T>
- class vec_interval
- {
- public:
- enum { N = T::num_elements };
- typedef typename T::scalar_type scalar_type;
-
- inline vec_interval(const T& v) { m_bounds[0] = v; m_bounds[1] = v; }
- inline vec_interval(const T& low, const T& high) { m_bounds[0] = low; m_bounds[1] = high; }
-
- inline void clear() { m_bounds[0].clear(); m_bounds[1].clear(); }
-
- inline const T& operator[] (uint i) const { CRNLIB_ASSERT(i < 2); return m_bounds[i]; }
- inline T& operator[] (uint i) { CRNLIB_ASSERT(i < 2); return m_bounds[i]; }
-
- private:
- T m_bounds[2];
- };
-
- typedef vec_interval<vec1F> vec_interval1F;
- typedef vec_interval<vec2F> vec_interval2F;
- typedef vec_interval<vec3F> vec_interval3F;
- typedef vec_interval<vec4F> vec_interval4F;
-
- typedef vec_interval2F aabb2F;
- typedef vec_interval3F aabb3F;
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_vector.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_vector.cpp
deleted file mode 100644
index 41a33d83..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_vector.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-// File: crn_vector.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "crn_vector.h"
-#include "crn_rand.h"
-
-#include "crn_color.h"
-#include "crn_vec.h"
-
-namespace crnlib
-{
- bool elemental_vector::increase_capacity(uint min_new_capacity, bool grow_hint, uint element_size, object_mover pMover, bool nofail)
- {
- CRNLIB_ASSERT(m_size <= m_capacity);
-#ifdef CRNLIB_64BIT_POINTERS
- CRNLIB_ASSERT(min_new_capacity < (0x400000000ULL / element_size));
-#else
- CRNLIB_ASSERT(min_new_capacity < (0x7FFF0000U / element_size));
-#endif
-
- if (m_capacity >= min_new_capacity)
- return true;
-
- size_t new_capacity = min_new_capacity;
- if ((grow_hint) && (!math::is_power_of_2((uint64)new_capacity)))
- new_capacity = math::next_pow2((uint64)new_capacity);
-
- CRNLIB_ASSERT(new_capacity && (new_capacity > m_capacity));
-
- const size_t desired_size = element_size * new_capacity;
- size_t actual_size;
- if (!pMover)
- {
- void* new_p = crnlib_realloc(m_p, desired_size, &actual_size, true);
- if (!new_p)
- {
- if (nofail)
- return false;
-
- char buf[256];
-#ifdef _MSC_VER
- sprintf_s(buf, sizeof(buf), "vector: crnlib_realloc() failed allocating %u bytes", (uint)desired_size);
-#else
- sprintf(buf, "vector: crnlib_realloc() failed allocating %u bytes", (uint)desired_size);
-#endif
- CRNLIB_FAIL(buf);
- }
- m_p = new_p;
- }
- else
- {
- void* new_p = crnlib_malloc(desired_size, &actual_size);
- if (!new_p)
- {
- if (nofail)
- return false;
-
- char buf[256];
-#ifdef _MSC_VER
- sprintf_s(buf, sizeof(buf), "vector: crnlib_malloc() failed allocating %u bytes", (uint)desired_size);
-#else
- sprintf(buf, "vector: crnlib_malloc() failed allocating %u bytes", (uint)desired_size);
-#endif
- CRNLIB_FAIL(buf);
- }
-
- (*pMover)(new_p, m_p, m_size);
-
- if (m_p)
- crnlib_free(m_p);
-
- m_p = new_p;
- }
-
- if (actual_size > desired_size)
- m_capacity = static_cast<uint>(actual_size / element_size);
- else
- m_capacity = static_cast<uint>(new_capacity);
-
- return true;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_vector.h b/Libraries/crunch-ea9b8d/crnlib/crn_vector.h
deleted file mode 100644
index 5f56f943..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_vector.h
+++ /dev/null
@@ -1,708 +0,0 @@
-// File: crn_vector.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-
-namespace crnlib
-{
- struct elemental_vector
- {
- void* m_p;
- uint m_size;
- uint m_capacity;
-
- typedef void (*object_mover)(void* pDst, void* pSrc, uint num);
-
- bool increase_capacity(uint min_new_capacity, bool grow_hint, uint element_size, object_mover pRelocate, bool nofail);
- };
-
- template<typename T>
- class vector : public helpers::rel_ops< vector<T> >
- {
- public:
- typedef T* iterator;
- typedef const T* const_iterator;
- typedef T value_type;
- typedef T& reference;
- typedef const T& const_reference;
- typedef T* pointer;
- typedef const T* const_pointer;
-
- inline vector() :
- m_p(NULL),
- m_size(0),
- m_capacity(0)
- {
- }
-
- inline vector(uint n, const T& init) :
- m_p(NULL),
- m_size(0),
- m_capacity(0)
- {
- increase_capacity(n, false);
- helpers::construct_array(m_p, n, init);
- m_size = n;
- }
-
- inline vector(const vector& other) :
- m_p(NULL),
- m_size(0),
- m_capacity(0)
- {
- increase_capacity(other.m_size, false);
-
- m_size = other.m_size;
-
- if (CRNLIB_IS_BITWISE_COPYABLE(T))
- memcpy(m_p, other.m_p, m_size * sizeof(T));
- else
- {
- T* pDst = m_p;
- const T* pSrc = other.m_p;
- for (uint i = m_size; i > 0; i--)
- helpers::construct(pDst++, *pSrc++);
- }
- }
-
- inline explicit vector(uint size) :
- m_p(NULL),
- m_size(0),
- m_capacity(0)
- {
- resize(size);
- }
-
- inline ~vector()
- {
- if (m_p)
- {
- scalar_type<T>::destruct_array(m_p, m_size);
- crnlib_free(m_p);
- }
- }
-
- inline vector& operator= (const vector& other)
- {
- if (this == &other)
- return *this;
-
- if (m_capacity >= other.m_size)
- resize(0);
- else
- {
- clear();
- increase_capacity(other.m_size, false);
- }
-
- if (CRNLIB_IS_BITWISE_COPYABLE(T))
- memcpy(m_p, other.m_p, other.m_size * sizeof(T));
- else
- {
- T* pDst = m_p;
- const T* pSrc = other.m_p;
- for (uint i = other.m_size; i > 0; i--)
- helpers::construct(pDst++, *pSrc++);
- }
-
- m_size = other.m_size;
-
- return *this;
- }
-
- inline const T* begin() const { return m_p; }
- T* begin() { return m_p; }
-
- inline const T* end() const { return m_p + m_size; }
- T* end() { return m_p + m_size; }
-
- inline bool empty() const { return !m_size; }
- inline uint size() const { return m_size; }
- inline uint size_in_bytes() const { return m_size * sizeof(T); }
- inline uint capacity() const { return m_capacity; }
-
- // operator[] will assert on out of range indices, but in final builds there is (and will never be) any range checking on this method.
- inline const T& operator[] (uint i) const { CRNLIB_ASSERT(i < m_size); return m_p[i]; }
- inline T& operator[] (uint i) { CRNLIB_ASSERT(i < m_size); return m_p[i]; }
-
- // at() always includes range checking, even in final builds, unlike operator [].
- // The first element is returned if the index is out of range.
- inline const T& at(uint i) const { CRNLIB_ASSERT(i < m_size); return (i >= m_size) ? m_p[0] : m_p[i]; }
- inline T& at(uint i) { CRNLIB_ASSERT(i < m_size); return (i >= m_size) ? m_p[0] : m_p[i]; }
-
- inline const T& front() const { CRNLIB_ASSERT(m_size); return m_p[0]; }
- inline T& front() { CRNLIB_ASSERT(m_size); return m_p[0]; }
-
- inline const T& back() const { CRNLIB_ASSERT(m_size); return m_p[m_size - 1]; }
- inline T& back() { CRNLIB_ASSERT(m_size); return m_p[m_size - 1]; }
-
- inline const T* get_ptr() const { return m_p; }
- inline T* get_ptr() { return m_p; }
-
- // clear() sets the container to empty, then frees the allocated block.
- inline void clear()
- {
- if (m_p)
- {
- scalar_type<T>::destruct_array(m_p, m_size);
- crnlib_free(m_p);
- m_p = NULL;
- m_size = 0;
- m_capacity = 0;
- }
- }
-
- inline void clear_no_destruction()
- {
- if (m_p)
- {
- crnlib_free(m_p);
- m_p = NULL;
- m_size = 0;
- m_capacity = 0;
- }
- }
-
- inline void reserve(uint new_capacity)
- {
- if (new_capacity > m_capacity)
- increase_capacity(new_capacity, false);
- else if (new_capacity < m_capacity)
- {
- // Must work around the lack of a "decrease_capacity()" method.
- // This case is rare enough in practice that it's probably not worth implementing an optimized in-place resize.
- vector tmp;
- tmp.increase_capacity(math::maximum(m_size, new_capacity), false);
- tmp = *this;
- swap(tmp);
- }
- }
-
- inline bool try_reserve(uint new_capacity)
- {
- return increase_capacity(new_capacity, true, true);
- }
-
- // resize(0) sets the container to empty, but does not free the allocated block.
- inline void resize(uint new_size, bool grow_hint = false)
- {
- if (m_size != new_size)
- {
- if (new_size < m_size)
- scalar_type<T>::destruct_array(m_p + new_size, m_size - new_size);
- else
- {
- if (new_size > m_capacity)
- increase_capacity(new_size, (new_size == (m_size + 1)) || grow_hint);
-
- scalar_type<T>::construct_array(m_p + m_size, new_size - m_size);
- }
-
- m_size = new_size;
- }
- }
-
- inline bool try_resize(uint new_size, bool grow_hint = false)
- {
- if (m_size != new_size)
- {
- if (new_size < m_size)
- scalar_type<T>::destruct_array(m_p + new_size, m_size - new_size);
- else
- {
- if (new_size > m_capacity)
- {
- if (!increase_capacity(new_size, (new_size == (m_size + 1)) || grow_hint, true))
- return false;
- }
-
- scalar_type<T>::construct_array(m_p + m_size, new_size - m_size);
- }
-
- m_size = new_size;
- }
-
- return true;
- }
-
- // If size >= capacity/2, reset() sets the container's size to 0 but doesn't free the allocated block (because the container may be similarly loaded in the future).
- // Otherwise it blows away the allocated block. See http://www.codercorner.com/blog/?p=494
- inline void reset()
- {
- if (m_size >= (m_capacity >> 1))
- resize(0);
- else
- clear();
- }
-
- inline T* enlarge(uint i)
- {
- uint cur_size = m_size;
- resize(cur_size + i, true);
- return get_ptr() + cur_size;
- }
-
- inline T* try_enlarge(uint i)
- {
- uint cur_size = m_size;
- if (!try_resize(cur_size + i, true))
- return NULL;
- return get_ptr() + cur_size;
- }
-
- inline void push_back(const T& obj)
- {
- CRNLIB_ASSERT(!m_p || (&obj < m_p) || (&obj >= (m_p + m_size)));
-
- if (m_size >= m_capacity)
- increase_capacity(m_size + 1, true);
-
- scalar_type<T>::construct(m_p + m_size, obj);
- m_size++;
- }
-
- inline bool try_push_back(const T& obj)
- {
- CRNLIB_ASSERT(!m_p || (&obj < m_p) || (&obj >= (m_p + m_size)));
-
- if (m_size >= m_capacity)
- {
- if (!increase_capacity(m_size + 1, true, true))
- return false;
- }
-
- scalar_type<T>::construct(m_p + m_size, obj);
- m_size++;
-
- return true;
- }
-
- inline void push_back_value(T obj)
- {
- if (m_size >= m_capacity)
- increase_capacity(m_size + 1, true);
-
- scalar_type<T>::construct(m_p + m_size, obj);
- m_size++;
- }
-
- inline void pop_back()
- {
- CRNLIB_ASSERT(m_size);
-
- if (m_size)
- {
- m_size--;
- scalar_type<T>::destruct(&m_p[m_size]);
- }
- }
-
- inline void insert(uint index, const T* p, uint n)
- {
- CRNLIB_ASSERT(index <= m_size);
- if (!n)
- return;
-
- const uint orig_size = m_size;
- resize(m_size + n, true);
-
- const uint num_to_move = orig_size - index;
-
- if (CRNLIB_IS_BITWISE_COPYABLE(T))
- {
- // This overwrites the destination object bits, but bitwise copyable means we don't need to worry about destruction.
- memmove(m_p + index + n, m_p + index, sizeof(T) * num_to_move);
- }
- else
- {
- const T* pSrc = m_p + orig_size - 1;
- T* pDst = const_cast<T*>(pSrc) + n;
-
- for (uint i = 0; i < num_to_move; i++)
- {
- CRNLIB_ASSERT((pDst - m_p) < (int)m_size);
- *pDst-- = *pSrc--;
- }
- }
-
- T* pDst = m_p + index;
-
- if (CRNLIB_IS_BITWISE_COPYABLE(T))
- {
- // This copies in the new bits, overwriting the existing objects, which is OK for copyable types that don't need destruction.
- memcpy(pDst, p, sizeof(T) * n);
- }
- else
- {
- for (uint i = 0; i < n; i++)
- {
- CRNLIB_ASSERT((pDst - m_p) < (int)m_size);
- *pDst++ = *p++;
- }
- }
- }
-
- // push_front() isn't going to be very fast - it's only here for usability.
- inline void push_front(const T& obj)
- {
- insert(0, &obj, 1);
- }
-
- vector& append(const vector& other)
- {
- if (other.m_size)
- insert(m_size, &other[0], other.m_size);
- return *this;
- }
-
- vector& append(const T* p, uint n)
- {
- if (n)
- insert(m_size, p, n);
- return *this;
- }
-
- inline void erase(uint start, uint n)
- {
- CRNLIB_ASSERT((start + n) <= m_size);
- if ((start + n) > m_size)
- return;
-
- if (!n)
- return;
-
- const uint num_to_move = m_size - (start + n);
-
- T* pDst = m_p + start;
-
- const T* pSrc = m_p + start + n;
-
- if (CRNLIB_IS_BITWISE_COPYABLE_OR_MOVABLE(T))
- {
- // This test is overly cautious.
- if ((!CRNLIB_IS_BITWISE_COPYABLE(T)) || (CRNLIB_HAS_DESTRUCTOR(T)))
- {
- // Type has been marked explictly as bitwise movable, which means we can move them around but they may need to be destructed.
- // First destroy the erased objects.
- scalar_type<T>::destruct_array(pDst, n);
- }
-
- // Copy "down" the objects to preserve, filling in the empty slots.
- memmove(pDst, pSrc, num_to_move * sizeof(T));
- }
- else
- {
- // Type is not bitwise copyable or movable.
- // Move them down one at a time by using the equals operator, and destroying anything that's left over at the end.
- T* pDst_end = pDst + num_to_move;
- while (pDst != pDst_end)
- *pDst++ = *pSrc++;
-
- scalar_type<T>::destruct_array(pDst_end, n);
- }
-
- m_size -= n;
- }
-
- inline void erase(uint index)
- {
- erase(index, 1);
- }
-
- inline void erase(T* p)
- {
- CRNLIB_ASSERT((p >= m_p) && (p < (m_p + m_size)));
- erase(static_cast<uint>(p - m_p));
- }
-
- void erase_unordered(uint index)
- {
- CRNLIB_ASSERT(index < m_size);
-
- if ((index + 1) < m_size)
- (*this)[index] = back();
-
- pop_back();
- }
-
- inline bool operator== (const vector& rhs) const
- {
- if (m_size != rhs.m_size)
- return false;
- else if (m_size)
- {
- if (scalar_type<T>::cFlag)
- return memcmp(m_p, rhs.m_p, sizeof(T) * m_size) == 0;
- else
- {
- const T* pSrc = m_p;
- const T* pDst = rhs.m_p;
- for (uint i = m_size; i; i--)
- if (!(*pSrc++ == *pDst++))
- return false;
- }
- }
-
- return true;
- }
-
- inline bool operator< (const vector& rhs) const
- {
- const uint min_size = math::minimum(m_size, rhs.m_size);
-
- const T* pSrc = m_p;
- const T* pSrc_end = m_p + min_size;
- const T* pDst = rhs.m_p;
-
- while ((pSrc < pSrc_end) && (*pSrc == *pDst))
- {
- pSrc++;
- pDst++;
- }
-
- if (pSrc < pSrc_end)
- return *pSrc < *pDst;
-
- return m_size < rhs.m_size;
- }
-
- inline void swap(vector& other)
- {
- utils::swap(m_p, other.m_p);
- utils::swap(m_size, other.m_size);
- utils::swap(m_capacity, other.m_capacity);
- }
-
- inline void sort()
- {
- std::sort(begin(), end());
- }
-
- inline void unique()
- {
- if (!empty())
- {
- sort();
-
- resize(std::unique(begin(), end()) - begin());
- }
- }
-
- inline void reverse()
- {
- uint j = m_size >> 1;
- for (uint i = 0; i < j; i++)
- utils::swap(m_p[i], m_p[m_size - 1 - i]);
- }
-
- inline int find(const T& key) const
- {
- const T* p = m_p;
- const T* p_end = m_p + m_size;
-
- uint index = 0;
-
- while (p != p_end)
- {
- if (key == *p)
- return index;
-
- p++;
- index++;
- }
-
- return cInvalidIndex;
- }
-
- inline int find_sorted(const T& key) const
- {
- if (m_size)
- {
- // Uniform binary search - Knuth Algorithm 6.2.1 U, unrolled twice.
- int i = ((m_size + 1) >> 1) - 1;
- int m = m_size;
-
- for ( ; ; )
- {
- CRNLIB_ASSERT_OPEN_RANGE(i, 0, (int)m_size);
- const T* pKey_i = m_p + i;
- int cmp = key < *pKey_i;
- if ((!cmp) && (key == *pKey_i)) return i;
- m >>= 1;
- if (!m) break;
- cmp = -cmp;
- i += (((m + 1) >> 1) ^ cmp) - cmp;
-
- CRNLIB_ASSERT_OPEN_RANGE(i, 0, (int)m_size);
- pKey_i = m_p + i;
- cmp = key < *pKey_i;
- if ((!cmp) && (key == *pKey_i)) return i;
- m >>= 1;
- if (!m) break;
- cmp = -cmp;
- i += (((m + 1) >> 1) ^ cmp) - cmp;
- }
- }
-
- return cInvalidIndex;
- }
-
- template<typename Q>
- inline int find_sorted(const T& key, Q less_than) const
- {
- if (m_size)
- {
- // Uniform binary search - Knuth Algorithm 6.2.1 U, unrolled twice.
- int i = ((m_size + 1) >> 1) - 1;
- int m = m_size;
-
- for ( ; ; )
- {
- CRNLIB_ASSERT_OPEN_RANGE(i, 0, (int)m_size);
- const T* pKey_i = m_p + i;
- int cmp = less_than(key, *pKey_i);
- if ((!cmp) && (!less_than(*pKey_i, key))) return i;
- m >>= 1;
- if (!m) break;
- cmp = -cmp;
- i += (((m + 1) >> 1) ^ cmp) - cmp;
-
- CRNLIB_ASSERT_OPEN_RANGE(i, 0, (int)m_size);
- pKey_i = m_p + i;
- cmp = less_than(key, *pKey_i);
- if ((!cmp) && (!less_than(*pKey_i, key))) return i;
- m >>= 1;
- if (!m) break;
- cmp = -cmp;
- i += (((m + 1) >> 1) ^ cmp) - cmp;
- }
- }
-
- return cInvalidIndex;
- }
-
- inline uint count_occurences(const T& key) const
- {
- uint c = 0;
-
- const T* p = m_p;
- const T* p_end = m_p + m_size;
-
- while (p != p_end)
- {
- if (key == *p)
- c++;
-
- p++;
- }
-
- return c;
- }
-
- inline void set_all(const T& o)
- {
- if ((sizeof(T) == 1) && (scalar_type<T>::cFlag))
- memset(m_p, *reinterpret_cast<const uint8*>(&o), m_size);
- else
- {
- T* pDst = m_p;
- T* pDst_end = pDst + m_size;
- while (pDst != pDst_end)
- *pDst++ = o;
- }
- }
-
- // Caller assumes ownership of the heap block associated with the container. Container is cleared.
- inline void *assume_ownership()
- {
- T* p = m_p;
- m_p = NULL;
- m_size = 0;
- m_capacity = 0;
- return p;
- }
-
- // Caller is granting ownership of the indicated heap block.
- // Block must have size constructed elements, and have enough room for capacity elements.
- inline bool grant_ownership(T* p, uint size, uint capacity)
- {
- // To to prevent the caller from obviously shooting themselves in the foot.
- if (((p + capacity) > m_p) && (p < (m_p + m_capacity)))
- {
- // Can grant ownership of a block inside the container itself!
- CRNLIB_ASSERT(0);
- return false;
- }
-
- if (size > capacity)
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- if (!p)
- {
- if (capacity)
- {
- CRNLIB_ASSERT(0);
- return false;
- }
- }
- else if (!capacity)
- {
- CRNLIB_ASSERT(0);
- return false;
- }
-
- clear();
- m_p = p;
- m_size = size;
- m_capacity = capacity;
- return true;
- }
-
- private:
- T* m_p;
- uint m_size;
- uint m_capacity;
-
- template<typename Q> struct is_vector { enum { cFlag = false }; };
- template<typename Q> struct is_vector< vector<Q> > { enum { cFlag = true }; };
-
- static void object_mover(void* pDst_void, void* pSrc_void, uint num)
- {
- T* pSrc = static_cast<T*>(pSrc_void);
- T* const pSrc_end = pSrc + num;
- T* pDst = static_cast<T*>(pDst_void);
-
- while (pSrc != pSrc_end)
- {
- // placement new
- new (static_cast<void*>(pDst)) T(*pSrc);
- pSrc->~T();
- ++pSrc;
- ++pDst;
- }
- }
-
- inline bool increase_capacity(uint min_new_capacity, bool grow_hint, bool nofail = false)
- {
- return reinterpret_cast<elemental_vector*>(this)->increase_capacity(
- min_new_capacity, grow_hint, sizeof(T),
- (CRNLIB_IS_BITWISE_COPYABLE_OR_MOVABLE(T) || (is_vector<T>::cFlag)) ? NULL : object_mover, nofail);
- }
- };
-
- typedef crnlib::vector<uint8> uint8_vec;
-
- template<typename T> struct bitwise_movable< vector<T> > { enum { cFlag = true }; };
-
- extern void vector_test();
-
- template<typename T>
- inline void swap(vector<T>& a, vector<T>& b)
- {
- a.swap(b);
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_vector2d.h b/Libraries/crunch-ea9b8d/crnlib/crn_vector2d.h
deleted file mode 100644
index dcfcf2ab..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_vector2d.h
+++ /dev/null
@@ -1,155 +0,0 @@
-// File: crn_vector2d.h
-#pragma once
-
-namespace crnlib
-{
- template <typename T>
- class vector2D
- {
- public:
- typedef crnlib::vector<T> vector_type;
- typedef T value_type;
- typedef T& reference;
- typedef const T& const_reference;
- typedef T* pointer;
- typedef const T* const_pointer;
-
- inline vector2D(uint width = 0, uint height = 0, const T& def = T()) :
- m_width(width),
- m_height(height),
- m_vec(width * height),
- m_def(def)
- {
- }
-
- inline vector2D(const vector2D& other) :
- m_width(other.m_width),
- m_height(other.m_height),
- m_vec(other.m_vec),
- m_def(other.m_def)
- {
- }
-
- inline vector2D& operator= (const vector2D& rhs)
- {
- if (this == &rhs)
- return *this;
-
- m_width = rhs.m_width;
- m_height = rhs.m_height;
- m_vec = rhs.m_vec;
-
- return *this;
- }
-
- bool try_resize(uint width, uint height, bool preserve = true)
- {
- if ((width == m_width) && (height == m_height))
- return true;
-
- vector_type new_vec;
- if (!new_vec.try_resize(width * height))
- return false;
-
- if (preserve)
- {
- const uint nx = math::minimum(width, m_width);
- const uint ny = math::minimum(height, m_height);
-
- for (uint y = 0; y < ny; y++)
- {
- const T* pSrc = &m_vec[y * m_width];
- T* pDst = &new_vec[y * width];
- if (CRNLIB_IS_BITWISE_COPYABLE_OR_MOVABLE(T))
- memcpy(pDst, pSrc, nx * sizeof(T));
- else
- {
- for (uint x = 0; x < nx; x++)
- *pDst++ = *pSrc++;
- }
- }
- }
-
- m_width = width;
- m_height = height;
- m_vec.swap(new_vec);
-
- return true;
- }
-
- void resize(uint width, uint height, bool preserve = true)
- {
- if (!try_resize(width, height, preserve))
- {
- CRNLIB_FAIL("vector2D::resize: Out of memory");
- }
- }
-
- inline void clear()
- {
- m_vec.clear();
- m_width = 0;
- m_height = 0;
- }
-
- inline uint width() const { return m_width; }
- inline uint height() const { return m_height; }
- inline uint size() const { return m_vec.size(); }
-
- inline uint size_in_bytes() const { return m_vec.size() * sizeof(T); }
-
- const vector_type& get_vec() const { return m_vec; }
- vector_type& get_vec() { return m_vec; }
-
- inline const T* get_ptr() const { return m_vec.get_ptr(); }
- inline T* get_ptr() { return m_vec.get_ptr(); }
-
- inline const T& operator[] (uint i) const { return m_vec[i]; }
- inline T& operator[] (uint i) { return m_vec[i]; }
-
- inline const T& operator() (uint x, uint y) const
- {
- CRNLIB_ASSERT((x < m_width) && (y < m_height));
- return m_vec[x + y * m_width];
- }
-
- inline T& operator() (uint x, uint y)
- {
- CRNLIB_ASSERT((x < m_width) && (y < m_height));
- return m_vec[x + y * m_width];
- }
-
- inline const T& at (uint x, uint y) const
- {
- if ((x >= m_width) || (y >= m_height))
- return m_def;
- return m_vec[x + y * m_width];
- }
-
- inline T& at (uint x, uint y)
- {
- if ((x >= m_width) || (y >= m_height))
- return m_def;
- return m_vec[x + y * m_width];
- }
-
- inline void swap(vector2D& other)
- {
- m_vec.swap(other.m_vec);
- anvil::swap(m_width, other.m_width);
- anvil::swap(m_height, other.m_height);
- }
-
- inline void set_all(const T& x)
- {
- m_vec.set_all(x);
- }
-
- private:
- vector_type m_vec;
- uint m_width;
- uint m_height;
- T m_def;
- };
-
-} // namespace anvil
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_winhdr.h b/Libraries/crunch-ea9b8d/crnlib/crn_winhdr.h
deleted file mode 100644
index 65ee6368..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_winhdr.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma once
-
-#ifndef WIN32
-#error Should not get here
-#endif
-
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x500
-#endif
-
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#ifndef NOMINMAX
-#define NOMINMAX
-#endif
-
-#include "windows.h"
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_zeng.cpp b/Libraries/crunch-ea9b8d/crnlib/crn_zeng.cpp
deleted file mode 100644
index 9f1fa2b2..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_zeng.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
-// File: crn_zeng.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-// Modified Zeng's technique for codebook/palette reordering
-// Evaluation of some reordering techniques for image VQ index compression, António R. C. Paiva , O J. Pinho
-// http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.88.7221
-#include "crn_core.h"
-#include "crn_zeng.h"
-#include "crn_sparse_array.h"
-#include <deque>
-
-#define USE_SPARSE_ARRAY 1
-
-namespace crnlib
-{
-#if USE_SPARSE_ARRAY
- typedef sparse_array<uint, 4> hist_type;
-#else
- typedef crnlib::vector<uint> hist_type;
-#endif
-
- static inline void update_hist(hist_type& hist, int i, int j, int n)
- {
- if (i == j)
- return;
-
- if ((i != -1) && (j != -1) && (i < j))
- {
- CRNLIB_ASSERT( (i >= 0) && (i < (int)n) );
- CRNLIB_ASSERT( (j >= 0) && (j < (int)n) );
-
- uint index = i * n + j;
-
-#if USE_SPARSE_ARRAY
- uint freq = hist[index];
- freq++;
- hist.set(index, freq);
-#else
- hist[index]++;
-#endif
- }
- }
-
- static inline uint read_hist(hist_type& hist, int i, int j, int n)
- {
- if (i > j)
- utils::swap(i, j);
-
- return hist[i * n + j];
- }
-
- void create_zeng_reorder_table(uint n, uint num_indices, const uint* pIndices, crnlib::vector<uint>& remap_table, zeng_similarity_func pFunc, void* pContext, float similarity_func_weight)
- {
- CRNLIB_ASSERT((n > 0) && (num_indices > 0));
- CRNLIB_ASSERT_CLOSED_RANGE(similarity_func_weight, 0.0f, 1.0f);
-
-// printf("create_zeng_reorder_table start:\n");
-
- remap_table.clear();
- remap_table.resize(n);
-
- if (num_indices <= 1)
- return;
-
- const uint t = n * n;
- hist_type xhist(t);
-
- for (uint i = 0; i < num_indices; i++)
- {
- const int prev_val = (i > 0) ? pIndices[i-1] : -1;
- const int cur_val = pIndices[i];
- const int next_val = (i < (num_indices - 1)) ? pIndices[i+1] : -1;
-
- update_hist(xhist, cur_val, prev_val, n);
- update_hist(xhist, cur_val, next_val, n);
- }
-
-#if 0
- uint total1 = 0, total2 = 0;
- for (uint i = 0; i < n; i++)
- {
- for (uint j = 0; j < n; j++)
- {
- if (i == j)
- continue;
-
- //uint a = hist[i * n + j];
- //total1 += a;
-
- uint c = read_hist(xhist, i, j, n);
- total2 += c;
- }
- }
-
- printf("%u %u\n", total1, total2);
-#endif
-
- uint max_freq = 0;
- uint max_index = 0;
- for (uint i = 0; i < t; i++)
- {
- if (xhist[i] > max_freq)
- {
- max_freq = xhist[i];
- max_index = i;
- }
- }
-
- uint x = max_index / n;
- uint y = max_index % n;
-
- crnlib::vector<uint16> values_chosen;
- values_chosen.reserve(n);
-
- values_chosen.push_back(static_cast<uint16>(x));
- values_chosen.push_back(static_cast<uint16>(y));
-
- crnlib::vector<uint16> values_remaining;
- if (n > 2)
- values_remaining.reserve(n - 2);
- for (uint i = 0; i < n; i++)
- if ((i != x) && (i != y))
- values_remaining.push_back(static_cast<uint16>(i));
-
- crnlib::vector<uint> total_freq_to_chosen_values(n);
- for (uint i = 0; i < values_remaining.size(); i++)
- {
- uint u = values_remaining[i];
-
- uint total_freq = 0;
-
- for (uint j = 0; j < values_chosen.size(); j++)
- {
- uint l = values_chosen[j];
-
- total_freq += read_hist(xhist, u, l, n); //[u * n + l];
- }
-
- total_freq_to_chosen_values[u] = total_freq;
- }
-
- while (!values_remaining.empty())
- {
- double best_freq = 0;
- uint best_i = 0;
-
- for (uint i = 0; i < values_remaining.size(); i++)
- {
- uint u = values_remaining[i];
-
- #if 0
- double total_freq = 0;
-
- for (uint j = 0; j < values_chosen.size(); j++)
- {
- uint l = values_chosen[j];
-
- total_freq += read_hist(xhist, u, l, n); //[u * n + l];
- }
-
- CRNLIB_ASSERT(total_freq_to_chosen_values[u] == total_freq);
- #else
- double total_freq = total_freq_to_chosen_values[u];
- #endif
-
- if (pFunc)
- {
- float weight = math::maximum<float>(
- (*pFunc)(u, values_chosen.front(), pContext),
- (*pFunc)(u, values_chosen.back(), pContext) );
-
- CRNLIB_ASSERT_CLOSED_RANGE(weight, 0.0f, 1.0f);
-
- weight = math::lerp(1.0f - similarity_func_weight, 1.0f + similarity_func_weight, weight);
-
- total_freq = (total_freq + 1.0f) * weight;
- }
-
- if (total_freq > best_freq)
- {
- best_freq = total_freq;
- best_i = i;
- }
- }
-
- const uint u = values_remaining[best_i];
-
- float side = 0;
- int left_freq = 0;
- int right_freq = 0;
-
- for (uint j = 0; j < values_chosen.size(); j++)
- {
- const uint l = values_chosen[j];
-
- int freq = read_hist(xhist, u, l, n); //[u * n + l];
- int scale = (values_chosen.size() + 1 - 2 * (j + 1));
-
- side = side + (float)(scale * freq);
-
- if (scale < 0)
- right_freq += -scale * freq;
- else
- left_freq += scale * freq;
- }
-
- if (pFunc)
- {
- float weight_left = (*pFunc)(u, values_chosen.front(), pContext);
- float weight_right = (*pFunc)(u, values_chosen.back(), pContext);
-
- weight_left = math::lerp(1.0f - similarity_func_weight, 1.0f + similarity_func_weight, weight_left);
- weight_right = math::lerp(1.0f - similarity_func_weight, 1.0f + similarity_func_weight, weight_right);
-
- side = weight_left * left_freq - weight_right * right_freq;
- }
-
- if (side > 0)
- values_chosen.push_front(static_cast<uint16>(u));
- else
- values_chosen.push_back(static_cast<uint16>(u));
-
- values_remaining.erase(values_remaining.begin() + best_i);
-
- for (uint i = 0; i < values_remaining.size(); i++)
- {
- const uint r = values_remaining[i];
-
- total_freq_to_chosen_values[r] += read_hist(xhist, r, u, n); //[r * n + u];
- }
- }
-
- for (uint i = 0; i < n; i++)
- {
- uint v = values_chosen[i];
- remap_table[v] = i;
- }
-
- #if 0
- uint before_sum = 0;
- uint after_sum = 0;
- {
- printf("\nBEFORE:\n");
- crnlib::vector<uint> delta_hist(n*2);
-
- int sum = 0;
- for (uint i = 1; i < num_indices; i++)
- {
- int prev = pIndices[i-1];
- int cur = pIndices[i];
- delta_hist[prev-cur+n]++;
- sum += labs(prev-cur);
- }
-
- printf("\n");
- for (uint i = 0; i < n*2; i++)
- printf("%04u ", delta_hist[i]);
-
- printf("\nSum: %i\n", sum);
- before_sum = sum;
- }
-
- {
- printf("AFTER:\n");
- crnlib::vector<uint> delta_hist(n*2);
-
- int sum = 0;
- for (uint i = 1; i < num_indices; i++)
- {
- int prev = remap_table[pIndices[i-1]];
- int cur = remap_table[pIndices[i]];
- delta_hist[prev-cur+n]++;
- sum += labs(prev-cur);
- }
-
- printf("\n");
- for (uint i = 0; i < n*2; i++)
- printf("%04u ", delta_hist[i]);
-
- printf("\nSum: %i\n", sum);
- after_sum = sum;
- }
- printf("Before sum: %u, After sum: %u\n", before_sum, after_sum);
- #endif
-
-// printf("create_zeng_reorder_table end:\n");
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/crn_zeng.h b/Libraries/crunch-ea9b8d/crnlib/crn_zeng.h
deleted file mode 100644
index bf37bea4..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crn_zeng.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// File: crn_zeng.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-
-namespace crnlib
-{
- typedef float (*zeng_similarity_func)(uint index_a, uint index_b, void* pContext);
-
- void create_zeng_reorder_table(uint n, uint num_indices, const uint* pIndices, crnlib::vector<uint>& remap_table, zeng_similarity_func pFunc, void* pContext, float similarity_func_weight);
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crnlib/crnlib.2008.vcproj b/Libraries/crunch-ea9b8d/crnlib/crnlib.2008.vcproj
deleted file mode 100644
index 2c5291e2..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crnlib.2008.vcproj
+++ /dev/null
@@ -1,1635 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="crnlib"
- ProjectGUID="{CF2E70E8-7133-4D96-92C7-68BB406C0664}"
- RootNamespace="crnlib"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- ManagedExtensions="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
- MinimalRebuild="false"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="2"
- PrecompiledHeaderThrough="crn_core.h"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\$(ProjectName)D_VC9.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- ManagedExtensions="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
- MinimalRebuild="false"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="2"
- PrecompiledHeaderThrough="crn_core.h"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\$(ProjectName)D_x64_VC9.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="2"
- PrecompiledHeaderThrough="crn_core.h"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\$(ProjectName)_VC9.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- FloatingPointModel="2"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="2"
- PrecompiledHeaderThrough="crn_core.h"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\$(ProjectName)_x64_VC9.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_DLL|Win32"
- OutputDirectory="$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- ManagedExtensions="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
- MinimalRebuild="false"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="2"
- PrecompiledHeaderThrough="crn_core.h"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\$(ProjectName)D_DLL_VC9.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_DLL|x64"
- OutputDirectory="$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- ManagedExtensions="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
- MinimalRebuild="false"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="2"
- PrecompiledHeaderThrough="crn_core.h"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\$(ProjectName)D_DLL_x64_VC9.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_DLL|Win32"
- OutputDirectory="$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="2"
- PrecompiledHeaderThrough="crn_core.h"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\$(ProjectName)_DLL_VC9.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_DLL|x64"
- OutputDirectory="$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- FloatingPointModel="2"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="2"
- PrecompiledHeaderThrough="crn_core.h"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\$(ProjectName)_DLL_x64_VC9.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\crn_assert.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_assert.h"
- >
- </File>
- <File
- RelativePath=".\crn_atomics.h"
- >
- </File>
- <File
- RelativePath=".\crn_core.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- PrecompiledHeaderThrough="crn_core.h"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_DLL|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- PrecompiledHeaderThrough="crn_core.h"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_DLL|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_DLL|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_DLL|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\crn_core.h"
- >
- </File>
- <File
- RelativePath=".\crn_mem.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_mem.h"
- >
- </File>
- <File
- RelativePath=".\crn_platform.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_platform.h"
- >
- </File>
- <File
- RelativePath=".\crn_types.h"
- >
- </File>
- <File
- RelativePath=".\crn_winhdr.h"
- >
- </File>
- <Filter
- Name="math"
- >
- <File
- RelativePath=".\crn_intersect.h"
- >
- </File>
- <File
- RelativePath=".\crn_math.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_math.h"
- >
- </File>
- <File
- RelativePath=".\crn_matrix.h"
- >
- </File>
- <File
- RelativePath=".\crn_rand.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_rand.h"
- >
- </File>
- <File
- RelativePath=".\crn_ray.h"
- >
- </File>
- <File
- RelativePath=".\crn_rect.h"
- >
- </File>
- <File
- RelativePath=".\crn_vec.h"
- >
- </File>
- <File
- RelativePath=".\crn_vec_interval.h"
- >
- </File>
- </Filter>
- <Filter
- Name="containers"
- >
- <File
- RelativePath=".\crn_hash_map.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_hash_map.h"
- >
- </File>
- <File
- RelativePath=".\crn_sparse_array.h"
- >
- </File>
- <File
- RelativePath=".\crn_sparse_bit_array.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_sparse_bit_array.h"
- >
- </File>
- <File
- RelativePath=".\crn_value.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_value.h"
- >
- </File>
- <File
- RelativePath=".\crn_vector.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_vector.h"
- >
- </File>
- <File
- RelativePath=".\crn_vector2d.h"
- >
- </File>
- </Filter>
- <Filter
- Name="image"
- >
- <File
- RelativePath=".\crn_color.h"
- >
- </File>
- <File
- RelativePath=".\crn_image.h"
- >
- </File>
- <File
- RelativePath=".\crn_image_utils.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_image_utils.h"
- >
- </File>
- <File
- RelativePath=".\crn_jpgd.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_DLL|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_DLL|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_DLL|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_DLL|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\crn_jpgd.h"
- >
- </File>
- <File
- RelativePath=".\crn_jpge.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_DLL|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_DLL|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_DLL|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_DLL|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\crn_jpge.h"
- >
- </File>
- <File
- RelativePath=".\crn_pixel_format.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_pixel_format.h"
- >
- </File>
- <File
- RelativePath=".\crn_resample_filters.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_resample_filters.h"
- >
- </File>
- <File
- RelativePath=".\crn_resampler.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_resampler.h"
- >
- </File>
- <File
- RelativePath=".\crn_stb_image.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_DLL|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_DLL|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_DLL|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_DLL|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\crn_threaded_resampler.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_threaded_resampler.h"
- >
- </File>
- </Filter>
- <Filter
- Name="comp"
- >
- <File
- RelativePath=".\crn_clusterizer.h"
- >
- </File>
- <File
- RelativePath=".\crn_dxt.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_dxt.h"
- >
- </File>
- <File
- RelativePath=".\crn_dxt1.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_dxt1.h"
- >
- </File>
- <File
- RelativePath=".\crn_dxt5a.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_dxt5a.h"
- >
- </File>
- <File
- RelativePath=".\crn_dxt_endpoint_refiner.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_dxt_endpoint_refiner.h"
- >
- </File>
- <File
- RelativePath=".\crn_dxt_fast.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_dxt_fast.h"
- >
- </File>
- <File
- RelativePath=".\crn_dxt_hc_common.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_dxt_hc_common.h"
- >
- </File>
- <File
- RelativePath=".\crn_etc.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_etc.h"
- >
- </File>
- <File
- RelativePath=".\crn_huffman_codes.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_huffman_codes.h"
- >
- </File>
- <File
- RelativePath=".\crn_lzma_codec.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_lzma_codec.h"
- >
- </File>
- <File
- RelativePath=".\crn_miniz.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_miniz.h"
- >
- </File>
- <File
- RelativePath=".\crn_prefix_coding.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_prefix_coding.h"
- >
- </File>
- <File
- RelativePath=".\crn_qdxt1.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_qdxt1.h"
- >
- </File>
- <File
- RelativePath=".\crn_qdxt5.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_qdxt5.h"
- >
- </File>
- <File
- RelativePath=".\crn_rg_etc1.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_rg_etc1.h"
- >
- </File>
- <File
- RelativePath=".\crn_ryg_dxt.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_ryg_dxt.hpp"
- >
- </File>
- <File
- RelativePath=".\crn_ryg_types.hpp"
- >
- </File>
- <File
- RelativePath=".\crn_symbol_codec.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_symbol_codec.h"
- >
- </File>
- <File
- RelativePath=".\crn_threaded_clusterizer.h"
- >
- </File>
- <File
- RelativePath=".\crn_tree_clusterizer.h"
- >
- </File>
- <File
- RelativePath=".\crn_zeng.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_zeng.h"
- >
- </File>
- </Filter>
- <Filter
- Name="string"
- >
- <File
- RelativePath=".\crn_dynamic_string.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_dynamic_string.h"
- >
- </File>
- <File
- RelativePath=".\crn_strutils.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_strutils.h"
- >
- </File>
- </Filter>
- <Filter
- Name="utils"
- >
- <File
- RelativePath=".\crn_arealist.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_arealist.h"
- >
- </File>
- <File
- RelativePath=".\crn_checksum.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_checksum.h"
- >
- </File>
- <File
- RelativePath=".\crn_command_line_params.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_command_line_params.h"
- >
- </File>
- <File
- RelativePath=".\crn_hash.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_hash.h"
- >
- </File>
- <File
- RelativePath=".\crn_helpers.h"
- >
- </File>
- <File
- RelativePath=".\crn_packed_uint.h"
- >
- </File>
- <File
- RelativePath=".\crn_radix_sort.h"
- >
- </File>
- <File
- RelativePath=".\crn_timer.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_timer.h"
- >
- </File>
- <File
- RelativePath=".\crn_traits.h"
- >
- </File>
- <File
- RelativePath=".\crn_utils.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_utils.h"
- >
- </File>
- </Filter>
- <Filter
- Name="stream"
- >
- <File
- RelativePath=".\crn_buffer_stream.h"
- >
- </File>
- <File
- RelativePath=".\crn_cfile_stream.h"
- >
- </File>
- <File
- RelativePath=".\crn_data_stream.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_data_stream.h"
- >
- </File>
- <File
- RelativePath=".\crn_data_stream_serializer.h"
- >
- </File>
- <File
- RelativePath=".\crn_dynamic_stream.h"
- >
- </File>
- </Filter>
- <Filter
- Name="console"
- >
- <File
- RelativePath=".\crn_colorized_console.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_colorized_console.h"
- >
- </File>
- <File
- RelativePath=".\crn_console.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_console.h"
- >
- </File>
- </Filter>
- <Filter
- Name="threading"
- >
- <File
- RelativePath=".\crn_threading.h"
- >
- </File>
- <File
- RelativePath=".\crn_threading_null.h"
- >
- </File>
- <File
- RelativePath=".\crn_threading_win32.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_threading_win32.h"
- >
- </File>
- </Filter>
- <Filter
- Name="lzmalib"
- >
- <File
- RelativePath=".\lzma_7zBuf.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_7zBuf.h"
- >
- </File>
- <File
- RelativePath=".\lzma_7zBuf2.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_7zCrc.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_7zCrc.h"
- >
- </File>
- <File
- RelativePath=".\lzma_7zFile.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_7zFile.h"
- >
- </File>
- <File
- RelativePath=".\lzma_7zStream.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_7zVersion.h"
- >
- </File>
- <File
- RelativePath=".\lzma_Alloc.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_Alloc.h"
- >
- </File>
- <File
- RelativePath=".\lzma_Bcj2.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_Bcj2.h"
- >
- </File>
- <File
- RelativePath=".\lzma_Bra.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_Bra.h"
- >
- </File>
- <File
- RelativePath=".\lzma_Bra86.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_BraIA64.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_CpuArch.h"
- >
- </File>
- <File
- RelativePath=".\lzma_LzFind.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_LzFind.h"
- >
- </File>
- <File
- RelativePath=".\lzma_LzFindMt.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_LzFindMt.h"
- >
- </File>
- <File
- RelativePath=".\lzma_LzHash.h"
- >
- </File>
- <File
- RelativePath=".\lzma_LzmaDec.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_LzmaDec.h"
- >
- </File>
- <File
- RelativePath=".\lzma_LzmaEnc.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_LzmaEnc.h"
- >
- </File>
- <File
- RelativePath=".\lzma_LzmaLib.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_LzmaLib.h"
- >
- </File>
- <File
- RelativePath=".\lzma_MyVersion.h"
- >
- </File>
- <File
- RelativePath=".\lzma_Threads.cpp"
- >
- </File>
- <File
- RelativePath=".\lzma_Threads.h"
- >
- </File>
- <File
- RelativePath=".\lzma_Types.h"
- >
- </File>
- </Filter>
- <Filter
- Name="crn"
- >
- <File
- RelativePath=".\crn_comp.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_comp.h"
- >
- </File>
- <File
- RelativePath=".\crn_dds_comp.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_dds_comp.h"
- >
- </File>
- <File
- RelativePath=".\crn_decomp.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_dxt_hc.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_dxt_hc.h"
- >
- </File>
- <File
- RelativePath=".\crn_texture_comp.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_texture_comp.h"
- >
- </File>
- </Filter>
- <Filter
- Name="texture_conversion"
- >
- <File
- RelativePath=".\crn_texture_conversion.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_texture_conversion.h"
- >
- </File>
- <File
- RelativePath=".\crn_texture_file_types.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_texture_file_types.h"
- >
- </File>
- </Filter>
- <Filter
- Name="api"
- >
- <File
- RelativePath=".\crnlib.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="inc"
- >
- <File
- RelativePath="..\inc\crn_decomp.h"
- >
- </File>
- <File
- RelativePath="..\inc\crnlib.h"
- >
- </File>
- <File
- RelativePath="..\inc\dds_defs.h"
- >
- </File>
- </Filter>
- <Filter
- Name="file"
- >
- <File
- RelativePath=".\crn_file_utils.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_file_utils.h"
- >
- </File>
- <File
- RelativePath=".\crn_find_files.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_find_files.h"
- >
- </File>
- </Filter>
- <Filter
- Name="texture"
- >
- <File
- RelativePath=".\crn_dxt_image.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_dxt_image.h"
- >
- </File>
- <File
- RelativePath=".\crn_ktx_texture.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_ktx_texture.h"
- >
- </File>
- <File
- RelativePath=".\crn_mipmapped_texture.cpp"
- >
- </File>
- <File
- RelativePath=".\crn_mipmapped_texture.h"
- >
- </File>
- </Filter>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/crunch-ea9b8d/crnlib/crnlib.cbp b/Libraries/crunch-ea9b8d/crnlib/crnlib.cbp
deleted file mode 100644
index dfc2cfef..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crnlib.cbp
+++ /dev/null
@@ -1,237 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="crnlib" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="libcrnlibD" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-Wextra" />
- <Add option="-Wall" />
- <Add option="-g" />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output="libcrnlib" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-march=core2" />
- <Add option="-fomit-frame-pointer" />
- <Add option="-fexpensive-optimizations" />
- <Add option="-O3" />
- <Add option="-Wextra" />
- <Add option="-Wall" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wextra" />
- <Add option="-Wall" />
- <Add option="-Wno-unused-value" />
- <Add option="-Wno-unused" />
- <Add option="-fno-strict-aliasing" />
- </Compiler>
- <Unit filename="crn_arealist.cpp" />
- <Unit filename="crn_arealist.h" />
- <Unit filename="crn_assert.cpp" />
- <Unit filename="crn_assert.h" />
- <Unit filename="crn_buffer_stream.h" />
- <Unit filename="crn_cfile_stream.h" />
- <Unit filename="crn_checksum.cpp" />
- <Unit filename="crn_checksum.h" />
- <Unit filename="crn_clusterizer.h" />
- <Unit filename="crn_color.h" />
- <Unit filename="crn_colorized_console.cpp" />
- <Unit filename="crn_colorized_console.h" />
- <Unit filename="crn_command_line_params.cpp" />
- <Unit filename="crn_command_line_params.h" />
- <Unit filename="crn_comp.cpp" />
- <Unit filename="crn_comp.h" />
- <Unit filename="crn_condition_var.h" />
- <Unit filename="crn_console.cpp" />
- <Unit filename="crn_console.h" />
- <Unit filename="crn_core.cpp" />
- <Unit filename="crn_core.h" />
- <Unit filename="crn_data_stream.cpp" />
- <Unit filename="crn_data_stream.h" />
- <Unit filename="crn_data_stream_serializer.h" />
- <Unit filename="crn_dds_comp.cpp" />
- <Unit filename="crn_dds_comp.h" />
- <Unit filename="crn_decomp.cpp" />
- <Unit filename="crn_dxt.cpp" />
- <Unit filename="crn_dxt.h" />
- <Unit filename="crn_dxt1.cpp" />
- <Unit filename="crn_dxt1.h" />
- <Unit filename="crn_dxt5a.cpp" />
- <Unit filename="crn_dxt5a.h" />
- <Unit filename="crn_dxt_endpoint_refiner.cpp" />
- <Unit filename="crn_dxt_endpoint_refiner.h" />
- <Unit filename="crn_dxt_fast.cpp" />
- <Unit filename="crn_dxt_fast.h" />
- <Unit filename="crn_dxt_hc.cpp" />
- <Unit filename="crn_dxt_hc.h" />
- <Unit filename="crn_dxt_hc_common.cpp" />
- <Unit filename="crn_dxt_hc_common.h" />
- <Unit filename="crn_dxt_image.cpp" />
- <Unit filename="crn_dxt_image.h" />
- <Unit filename="crn_dynamic_stream.h" />
- <Unit filename="crn_dynamic_string.cpp" />
- <Unit filename="crn_dynamic_string.h" />
- <Unit filename="crn_etc.cpp" />
- <Unit filename="crn_etc.h" />
- <Unit filename="crn_file_utils.cpp" />
- <Unit filename="crn_file_utils.h" />
- <Unit filename="crn_find_files.cpp" />
- <Unit filename="crn_find_files.h" />
- <Unit filename="crn_fixed_array.h" />
- <Unit filename="crn_hash.cpp" />
- <Unit filename="crn_hash.h" />
- <Unit filename="crn_hash_map.cpp" />
- <Unit filename="crn_hash_map.h" />
- <Unit filename="crn_helpers.h" />
- <Unit filename="crn_huffman_codes.cpp" />
- <Unit filename="crn_huffman_codes.h" />
- <Unit filename="crn_image.h" />
- <Unit filename="crn_image_utils.cpp" />
- <Unit filename="crn_image_utils.h" />
- <Unit filename="crn_intersect.h" />
- <Unit filename="crn_jpgd.cpp" />
- <Unit filename="crn_jpgd.h" />
- <Unit filename="crn_jpge.cpp" />
- <Unit filename="crn_jpge.h" />
- <Unit filename="crn_ktx_texture.cpp" />
- <Unit filename="crn_ktx_texture.h" />
- <Unit filename="crn_lzma_codec.cpp" />
- <Unit filename="crn_lzma_codec.h" />
- <Unit filename="crn_math.cpp" />
- <Unit filename="crn_math.h" />
- <Unit filename="crn_matrix.h" />
- <Unit filename="crn_mem.cpp" />
- <Unit filename="crn_mem.h" />
- <Unit filename="crn_miniz.cpp" />
- <Unit filename="crn_miniz.h" />
- <Unit filename="crn_mipmapped_texture.cpp" />
- <Unit filename="crn_mipmapped_texture.h" />
- <Unit filename="crn_mutex.h" />
- <Unit filename="crn_packed_uint.h" />
- <Unit filename="crn_pixel_format.cpp" />
- <Unit filename="crn_pixel_format.h" />
- <Unit filename="crn_platform.cpp" />
- <Unit filename="crn_platform.h" />
- <Unit filename="crn_prefix_coding.cpp" />
- <Unit filename="crn_prefix_coding.h" />
- <Unit filename="crn_qdxt1.cpp" />
- <Unit filename="crn_qdxt1.h" />
- <Unit filename="crn_qdxt5.cpp" />
- <Unit filename="crn_qdxt5.h" />
- <Unit filename="crn_rand.cpp" />
- <Unit filename="crn_rand.h" />
- <Unit filename="crn_ray.h" />
- <Unit filename="crn_rect.h" />
- <Unit filename="crn_resample_filters.cpp" />
- <Unit filename="crn_resample_filters.h" />
- <Unit filename="crn_resampler.cpp" />
- <Unit filename="crn_resampler.h" />
- <Unit filename="crn_rg_etc1.cpp" />
- <Unit filename="crn_rg_etc1.h" />
- <Unit filename="crn_ryg_dxt.cpp" />
- <Unit filename="crn_ryg_dxt.hpp" />
- <Unit filename="crn_ryg_types.hpp" />
- <Unit filename="crn_sparse_array.h" />
- <Unit filename="crn_sparse_bit_array.cpp" />
- <Unit filename="crn_sparse_bit_array.h" />
- <Unit filename="crn_stb_image.cpp" />
- <Unit filename="crn_strutils.cpp" />
- <Unit filename="crn_strutils.h" />
- <Unit filename="crn_symbol_codec.cpp" />
- <Unit filename="crn_symbol_codec.h" />
- <Unit filename="crn_texture_comp.cpp" />
- <Unit filename="crn_texture_comp.h" />
- <Unit filename="crn_texture_conversion.cpp" />
- <Unit filename="crn_texture_conversion.h" />
- <Unit filename="crn_texture_file_types.cpp" />
- <Unit filename="crn_texture_file_types.h" />
- <Unit filename="crn_threaded_clusterizer.h" />
- <Unit filename="crn_threaded_resampler.cpp" />
- <Unit filename="crn_threaded_resampler.h" />
- <Unit filename="crn_threading.h" />
- <Unit filename="crn_threading_null.h" />
- <Unit filename="crn_threading_pthreads.h" />
- <Unit filename="crn_threading_win32.cpp" />
- <Unit filename="crn_threading_win32.h" />
- <Unit filename="crn_timer.cpp" />
- <Unit filename="crn_timer.h" />
- <Unit filename="crn_traits.h" />
- <Unit filename="crn_tree_clusterizer.h" />
- <Unit filename="crn_types.h" />
- <Unit filename="crn_utils.cpp" />
- <Unit filename="crn_utils.h" />
- <Unit filename="crn_value.cpp" />
- <Unit filename="crn_value.h" />
- <Unit filename="crn_vec.h" />
- <Unit filename="crn_vec_interval.h" />
- <Unit filename="crn_vector.cpp" />
- <Unit filename="crn_vector.h" />
- <Unit filename="crn_vector2d.h" />
- <Unit filename="crn_winhdr.h" />
- <Unit filename="crn_zeng.cpp" />
- <Unit filename="crn_zeng.h" />
- <Unit filename="crnlib.cbp" />
- <Unit filename="crnlib.cpp" />
- <Unit filename="lzma_7zBuf.cpp" />
- <Unit filename="lzma_7zBuf.h" />
- <Unit filename="lzma_7zBuf2.cpp" />
- <Unit filename="lzma_7zCrc.h" />
- <Unit filename="lzma_7zFile.cpp" />
- <Unit filename="lzma_7zFile.h" />
- <Unit filename="lzma_7zStream.cpp" />
- <Unit filename="lzma_7zVersion.h" />
- <Unit filename="lzma_Alloc.cpp" />
- <Unit filename="lzma_Alloc.h" />
- <Unit filename="lzma_Bcj2.cpp" />
- <Unit filename="lzma_Bcj2.h" />
- <Unit filename="lzma_Bra.cpp" />
- <Unit filename="lzma_Bra.h" />
- <Unit filename="lzma_Bra86.cpp" />
- <Unit filename="lzma_BraIA64.cpp" />
- <Unit filename="lzma_CpuArch.h" />
- <Unit filename="lzma_LzFind.cpp" />
- <Unit filename="lzma_LzFind.h" />
- <Unit filename="lzma_LzFindMt.cpp" />
- <Unit filename="lzma_LzFindMt.h" />
- <Unit filename="lzma_LzHash.h" />
- <Unit filename="lzma_LzmaDec.cpp" />
- <Unit filename="lzma_LzmaDec.h" />
- <Unit filename="lzma_LzmaEnc.cpp" />
- <Unit filename="lzma_LzmaEnc.h" />
- <Unit filename="lzma_LzmaLib.cpp" />
- <Unit filename="lzma_LzmaLib.h" />
- <Unit filename="lzma_MyVersion.h" />
- <Unit filename="lzma_Threads.cpp" />
- <Unit filename="lzma_Threads.h" />
- <Unit filename="lzma_Types.h" />
- <Unit filename="..\inc\crn_decomp.h" />
- <Unit filename="..\inc\crnlib.h" />
- <Unit filename="..\inc\dds_defs.h" />
- <Extensions>
- <code_completion />
- <debugger />
- <envvars />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/Libraries/crunch-ea9b8d/crnlib/crnlib.cpp b/Libraries/crunch-ea9b8d/crnlib/crnlib.cpp
deleted file mode 100644
index 682efad8..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crnlib.cpp
+++ /dev/null
@@ -1,459 +0,0 @@
-// File: crnlib.cpp
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include "crn_core.h"
-#include "../inc/crnlib.h"
-#include "crn_comp.h"
-#include "crn_dds_comp.h"
-#include "crn_dynamic_stream.h"
-#include "crn_buffer_stream.h"
-#include "crn_ryg_dxt.hpp"
-#include "crn_etc.h"
-
-#define CRND_HEADER_FILE_ONLY
-#include "../inc/crn_decomp.h"
-
-#include "crn_rg_etc1.h"
-
-namespace crnlib
-{
- static void* realloc_func(void* p, size_t size, size_t* pActual_size, bool movable, void* pUser_data)
- {
- pUser_data;
- return crnlib_realloc(p, size, pActual_size, movable);
- }
-
- static size_t msize_func(void* p, void* pUser_data)
- {
- pUser_data;
- return crnlib_msize(p);
- }
-
- class crnlib_global_initializer
- {
- public:
- crnlib_global_initializer()
- {
- crn_threading_init();
-
- crnlib_enable_fail_exceptions(true);
-
- // Redirect crn_decomp.h's memory allocations into crnlib, which may be further redirected by the outside caller.
- crnd::crnd_set_memory_callbacks(realloc_func, msize_func, NULL);
-
- ryg_dxt::sInitDXT();
-
- pack_etc1_block_init();
-
- rg_etc1::pack_etc1_block_init();
- }
- };
-
- crnlib_global_initializer g_crnlib_initializer;
-} // namespace crnlib
-
-using namespace crnlib;
-
-const char* crn_get_format_string(crn_format fmt)
-{
- return pixel_format_helpers::get_crn_format_string(fmt);
-}
-
-crn_uint32 crn_get_format_fourcc(crn_format fmt)
-{
- return crnd::crnd_crn_format_to_fourcc(fmt);
-}
-
-crn_uint32 crn_get_format_bits_per_texel(crn_format fmt)
-{
- return crnd::crnd_get_crn_format_bits_per_texel(fmt);
-}
-
-crn_uint32 crn_get_bytes_per_dxt_block(crn_format fmt)
-{
- return crnd::crnd_get_bytes_per_dxt_block(fmt);
-}
-
-crn_format crn_get_fundamental_dxt_format(crn_format fmt)
-{
- return crnd::crnd_get_fundamental_dxt_format(fmt);
-}
-
-const char* crn_get_file_type_ext(crn_file_type file_type)
-{
- switch (file_type)
- {
- case cCRNFileTypeDDS: return "dds";
- case cCRNFileTypeCRN: return "crn";
- default: break;
- }
- return "?";
-}
-
-const char* crn_get_mip_mode_desc(crn_mip_mode m)
-{
- switch (m)
- {
- case cCRNMipModeUseSourceOrGenerateMips: return "Use source/generate if none";
- case cCRNMipModeUseSourceMips: return "Only use source MIP maps (if any)";
- case cCRNMipModeGenerateMips: return "Always generate new MIP maps";
- case cCRNMipModeNoMips: return "No MIP maps";
- default: break;
- }
- return "?";
-}
-
-const char* crn_get_mip_mode_name(crn_mip_mode m)
-{
- switch (m)
- {
- case cCRNMipModeUseSourceOrGenerateMips: return "UseSourceOrGenerate";
- case cCRNMipModeUseSourceMips: return "UseSource";
- case cCRNMipModeGenerateMips: return "Generate";
- case cCRNMipModeNoMips: return "None";
- default: break;
- }
- return "?";
-}
-
-const char* crn_get_mip_filter_name(crn_mip_filter f)
-{
- switch (f)
- {
- case cCRNMipFilterBox: return "box";
- case cCRNMipFilterTent: return "tent";
- case cCRNMipFilterLanczos4: return "lanczos4";
- case cCRNMipFilterMitchell: return "mitchell";
- case cCRNMipFilterKaiser: return "kaiser";
- default: break;
- }
- return "?";
-}
-
-const char* crn_get_scale_mode_desc(crn_scale_mode sm)
-{
- switch (sm)
- {
- case cCRNSMDisabled: return "disabled";
- case cCRNSMAbsolute: return "absolute";
- case cCRNSMRelative: return "relative";
- case cCRNSMLowerPow2: return "lowerpow2";
- case cCRNSMNearestPow2: return "nearestpow2";
- case cCRNSMNextPow2: return "nextpow2";
- default: break;
- }
- return "?";
-}
-
-const char* crn_get_dxt_quality_string(crn_dxt_quality q)
-{
- switch (q)
- {
- case cCRNDXTQualitySuperFast: return "SuperFast";
- case cCRNDXTQualityFast: return "Fast";
- case cCRNDXTQualityNormal: return "Normal";
- case cCRNDXTQualityBetter: return "Better";
- case cCRNDXTQualityUber: return "Uber";
- default: break;
- }
- CRNLIB_ASSERT(false);
- return "?";
-}
-
-
-void crn_free_block(void *pBlock)
-{
- crnlib_free(pBlock);
-}
-
-void *crn_compress(const crn_comp_params &comp_params, crn_uint32 &compressed_size, crn_uint32 *pActual_quality_level, float *pActual_bitrate)
-{
- compressed_size = 0;
- if (pActual_quality_level) *pActual_quality_level = 0;
- if (pActual_bitrate) *pActual_bitrate = 0.0f;
-
- if (!comp_params.check())
- return NULL;
-
- crnlib::vector<uint8> crn_file_data;
- if (!create_compressed_texture(comp_params, crn_file_data, pActual_quality_level, pActual_bitrate))
- return NULL;
-
- compressed_size = crn_file_data.size();
- return crn_file_data.assume_ownership();
-}
-
-void *crn_compress(const crn_comp_params &comp_params, const crn_mipmap_params &mip_params, crn_uint32 &compressed_size, crn_uint32 *pActual_quality_level, float *pActual_bitrate)
-{
- compressed_size = 0;
- if (pActual_quality_level) *pActual_quality_level = 0;
- if (pActual_bitrate) *pActual_bitrate = 0.0f;
-
- if ((!comp_params.check()) || (!mip_params.check()))
- return NULL;
-
- crnlib::vector<uint8> crn_file_data;
- if (!create_compressed_texture(comp_params, mip_params, crn_file_data, pActual_quality_level, pActual_bitrate))
- return NULL;
-
- compressed_size = crn_file_data.size();
- return crn_file_data.assume_ownership();
-}
-
-void *crn_decompress_crn_to_dds(const void *pCRN_file_data, crn_uint32 &file_size)
-{
- mipmapped_texture tex;
- if (!tex.read_crn_from_memory(pCRN_file_data, file_size, "from_memory.crn"))
- {
- file_size = 0;
- return NULL;
- }
-
- file_size = 0;
-
- dynamic_stream dds_file_data;
- dds_file_data.reserve(128*1024);
- data_stream_serializer serializer(dds_file_data);
- if (!tex.write_dds(serializer))
- return NULL;
- dds_file_data.reserve(0);
-
- file_size = static_cast<crn_uint32>(dds_file_data.get_size());
- return dds_file_data.get_buf().assume_ownership();
-}
-
-bool crn_decompress_dds_to_images(const void *pDDS_file_data, crn_uint32 dds_file_size, crn_uint32 **ppImages, crn_texture_desc &tex_desc)
-{
- memset(&tex_desc, 0, sizeof(tex_desc));
-
- mipmapped_texture tex;
- buffer_stream in_stream(pDDS_file_data, dds_file_size);
- data_stream_serializer in_serializer(in_stream);
- if (!tex.read_dds(in_serializer))
- return false;
-
- if (tex.is_packed())
- {
- // TODO: Allow the user to disable uncooking of swizzled DXT5 formats?
- bool uncook = true;
-
- if (!tex.unpack_from_dxt(uncook))
- return false;
- }
-
- tex_desc.m_faces = tex.get_num_faces();
- tex_desc.m_width = tex.get_width();
- tex_desc.m_height = tex.get_height();
- tex_desc.m_levels = tex.get_num_levels();
- tex_desc.m_fmt_fourcc = (crn_uint32)tex.get_format();
-
- for (uint32 f = 0; f < tex.get_num_faces(); f++)
- {
- for (uint32 l = 0; l < tex.get_num_levels(); l++)
- {
- mip_level *pLevel = tex.get_level(f, l);
- image_u8 *pImg = pLevel->get_image();
- ppImages[l + tex.get_num_levels() * f] = static_cast<crn_uint32*>(pImg->get_pixel_buf().assume_ownership());
- }
- }
-
- return true;
-}
-
-void crn_free_all_images(crn_uint32 **ppImages, const crn_texture_desc &desc)
-{
- for (uint32 f = 0; f < desc.m_faces; f++)
- for (uint32 l = 0; l < desc.m_levels; l++)
- crn_free_block(ppImages[l + desc.m_levels * f]);
-}
-
-// Simple low-level DXTn 4x4 block compressor API.
-// Basically just a basic wrapper over the crnlib::dxt_image class.
-
-namespace crnlib
-{
- class crn_block_compressor
- {
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(crn_block_compressor);
-
- public:
- crn_block_compressor()
- {
- }
-
- bool init(const crn_comp_params &params)
- {
- m_comp_params = params;
-
- m_pack_params.init(params);
-
- crn_format basic_crn_fmt = crnd::crnd_get_fundamental_dxt_format(params.m_format);
- pixel_format basic_pixel_fmt = pixel_format_helpers::convert_crn_format_to_pixel_format(basic_crn_fmt);
-
- if ((params.get_flag(cCRNCompFlagDXT1AForTransparency)) && (basic_pixel_fmt == PIXEL_FMT_DXT1))
- basic_pixel_fmt = PIXEL_FMT_DXT1A;
-
- if (!m_image.init(pixel_format_helpers::get_dxt_format(basic_pixel_fmt), cDXTBlockSize, cDXTBlockSize, false))
- return false;
-
- return true;
- }
-
- void compress_block(const crn_uint32 *pPixels, void *pDst_block)
- {
- if (m_image.is_valid())
- {
- m_image.set_block_pixels(0, 0, reinterpret_cast<const color_quad_u8 *>(pPixels), m_pack_params, m_set_block_pixels_context);
- memcpy(pDst_block, &m_image.get_element(0, 0, 0), m_image.get_bytes_per_block());
- }
- }
-
- private:
- dxt_image m_image;
- crn_comp_params m_comp_params;
- dxt_image::pack_params m_pack_params;
- dxt_image::set_block_pixels_context m_set_block_pixels_context;
- };
-}
-
-crn_block_compressor_context_t crn_create_block_compressor(const crn_comp_params &params)
-{
- crn_block_compressor *pComp = crnlib_new<crn_block_compressor>();
- if (!pComp->init(params))
- {
- crnlib_delete(pComp);
- return NULL;
- }
- return pComp;
-}
-
-void crn_compress_block(crn_block_compressor_context_t pContext, const crn_uint32 *pPixels, void *pDst_block)
-{
- crn_block_compressor *pComp = static_cast<crn_block_compressor *>(pContext);
- pComp->compress_block(pPixels, pDst_block);
-}
-
-void crn_free_block_compressor(crn_block_compressor_context_t pContext)
-{
- crnlib_delete(static_cast<crn_block_compressor *>(pContext));
-}
-
-bool crn_decompress_block(const void *pSrc_block, crn_uint32 *pDst_pixels_u32, crn_format crn_fmt)
-{
- color_quad_u8* pDst_pixels = reinterpret_cast<color_quad_u8*>(pDst_pixels_u32);
-
- switch (crn_get_fundamental_dxt_format(crn_fmt))
- {
- case cCRNFmtETC1:
- {
- const etc1_block& block = *reinterpret_cast<const etc1_block*>(pSrc_block);
- unpack_etc1(block, pDst_pixels, false);
- break;
- }
- case cCRNFmtDXT1:
- {
- const dxt1_block* pDXT1_block = reinterpret_cast<const dxt1_block*>(pSrc_block);
-
- color_quad_u8 colors[cDXT1SelectorValues];
- pDXT1_block->get_block_colors(colors, static_cast<uint16>(pDXT1_block->get_low_color()), static_cast<uint16>(pDXT1_block->get_high_color()));
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- const uint s = pDXT1_block->get_selector(i & 3, i >> 2);
-
- pDst_pixels[i] = colors[s];
- }
-
- break;
- }
-
- case cCRNFmtDXT3:
- {
- const dxt3_block* pDXT3_block = reinterpret_cast<const dxt3_block*>(pSrc_block);
-
- const dxt1_block* pDXT1_block = reinterpret_cast<const dxt1_block*>(pSrc_block) + 1;
- color_quad_u8 colors[cDXT1SelectorValues];
- pDXT1_block->get_block_colors(colors, static_cast<uint16>(pDXT1_block->get_low_color()), static_cast<uint16>(pDXT1_block->get_high_color()));
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- const uint s = pDXT1_block->get_selector(i & 3, i >> 2);
- const uint a = pDXT3_block->get_alpha(i & 3, i >> 2, true);
-
- pDst_pixels[i] = colors[s];
- pDst_pixels[i].a = static_cast<uint8>(a);
- }
-
- break;
- }
-
- case cCRNFmtDXT5:
- {
- const dxt5_block* pDXT5_block = reinterpret_cast<const dxt5_block*>(pSrc_block);
-
- const dxt1_block* pDXT1_block = reinterpret_cast<const dxt1_block*>(pSrc_block) + 1;
- color_quad_u8 colors[cDXT1SelectorValues];
- pDXT1_block->get_block_colors(colors, static_cast<uint16>(pDXT1_block->get_low_color()), static_cast<uint16>(pDXT1_block->get_high_color()));
-
- uint values[cDXT5SelectorValues];
- dxt5_block::get_block_values(values, pDXT5_block->get_low_alpha(), pDXT5_block->get_high_alpha());
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- const uint s = pDXT1_block->get_selector(i & 3, i >> 2);
- const uint a = pDXT5_block->get_selector(i & 3, i >> 2);
-
- pDst_pixels[i] = colors[s];
- pDst_pixels[i].a = static_cast<uint8>(values[a]);
- }
- }
-
- case cCRNFmtDXN_XY:
- case cCRNFmtDXN_YX:
- {
- const dxt5_block* pDXT5_block0 = reinterpret_cast<const dxt5_block*>(pSrc_block);
- const dxt5_block* pDXT5_block1 = reinterpret_cast<const dxt5_block*>(pSrc_block) + 1;
-
- uint values0[cDXT5SelectorValues];
- dxt5_block::get_block_values(values0, pDXT5_block0->get_low_alpha(), pDXT5_block0->get_high_alpha());
-
- uint values1[cDXT5SelectorValues];
- dxt5_block::get_block_values(values1, pDXT5_block1->get_low_alpha(), pDXT5_block1->get_high_alpha());
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- const uint s0 = pDXT5_block0->get_selector(i & 3, i >> 2);
- const uint s1 = pDXT5_block1->get_selector(i & 3, i >> 2);
-
- if (crn_fmt == cCRNFmtDXN_XY)
- pDst_pixels[i].set_noclamp_rgba(values0[s0], values1[s1], 255, 255);
- else
- pDst_pixels[i].set_noclamp_rgba(values1[s1], values0[s0], 255, 255);
- }
-
- break;
- }
-
- case cCRNFmtDXT5A:
- {
- const dxt5_block* pDXT5_block = reinterpret_cast<const dxt5_block*>(pSrc_block);
-
- uint values[cDXT5SelectorValues];
- dxt5_block::get_block_values(values, pDXT5_block->get_low_alpha(), pDXT5_block->get_high_alpha());
-
- for (uint i = 0; i < cDXTBlockSize * cDXTBlockSize; i++)
- {
- const uint s = pDXT5_block->get_selector(i & 3, i >> 2);
-
- pDst_pixels[i].set_noclamp_rgba(255, 255, 255, values[s]);
- }
-
- break;
- }
- default:
- {
- return false;
- }
- }
-
- return true;
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/crnlib_linux.cbp b/Libraries/crunch-ea9b8d/crnlib/crnlib_linux.cbp
deleted file mode 100644
index 712dc1d8..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/crnlib_linux.cbp
+++ /dev/null
@@ -1,235 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="crnlib" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="libcrnlibD" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj/Debug/" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-Wextra" />
- <Add option="-Wall" />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output="libcrnlib" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj/Release/" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-march=core2" />
- <Add option="-fomit-frame-pointer" />
- <Add option="-fexpensive-optimizations" />
- <Add option="-O3" />
- <Add option="-Wextra" />
- <Add option="-Wall" />
- </Compiler>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wextra" />
- <Add option="-Wall" />
- <Add option="-g" />
- <Add option="-Wno-unused-value" />
- <Add option="-Wno-unused" />
- <Add option="-fno-strict-aliasing" />
- <Add option="-ffast-math" />
- <Add option="-fno-math-errno" />
- </Compiler>
- <Unit filename="crn_arealist.cpp" />
- <Unit filename="crn_arealist.h" />
- <Unit filename="crn_assert.cpp" />
- <Unit filename="crn_assert.h" />
- <Unit filename="crn_atomics.h" />
- <Unit filename="crn_buffer_stream.h" />
- <Unit filename="crn_cfile_stream.h" />
- <Unit filename="crn_checksum.cpp" />
- <Unit filename="crn_checksum.h" />
- <Unit filename="crn_clusterizer.h" />
- <Unit filename="crn_color.h" />
- <Unit filename="crn_colorized_console.cpp" />
- <Unit filename="crn_colorized_console.h" />
- <Unit filename="crn_command_line_params.cpp" />
- <Unit filename="crn_command_line_params.h" />
- <Unit filename="crn_comp.cpp" />
- <Unit filename="crn_comp.h" />
- <Unit filename="crn_condition_var.h" />
- <Unit filename="crn_console.cpp" />
- <Unit filename="crn_console.h" />
- <Unit filename="crn_core.cpp" />
- <Unit filename="crn_core.h" />
- <Unit filename="crn_data_stream.cpp" />
- <Unit filename="crn_data_stream.h" />
- <Unit filename="crn_data_stream_serializer.h" />
- <Unit filename="crn_dds_comp.cpp" />
- <Unit filename="crn_dds_comp.h" />
- <Unit filename="crn_decomp.cpp" />
- <Unit filename="crn_dxt.cpp" />
- <Unit filename="crn_dxt.h" />
- <Unit filename="crn_dxt1.cpp" />
- <Unit filename="crn_dxt1.h" />
- <Unit filename="crn_dxt5a.cpp" />
- <Unit filename="crn_dxt5a.h" />
- <Unit filename="crn_dxt_endpoint_refiner.cpp" />
- <Unit filename="crn_dxt_endpoint_refiner.h" />
- <Unit filename="crn_dxt_fast.cpp" />
- <Unit filename="crn_dxt_fast.h" />
- <Unit filename="crn_dxt_hc.cpp" />
- <Unit filename="crn_dxt_hc.h" />
- <Unit filename="crn_dxt_hc_common.cpp" />
- <Unit filename="crn_dxt_hc_common.h" />
- <Unit filename="crn_dxt_image.cpp" />
- <Unit filename="crn_dxt_image.h" />
- <Unit filename="crn_dynamic_stream.h" />
- <Unit filename="crn_dynamic_string.cpp" />
- <Unit filename="crn_dynamic_string.h" />
- <Unit filename="crn_etc.cpp" />
- <Unit filename="crn_etc.h" />
- <Unit filename="crn_file_utils.cpp" />
- <Unit filename="crn_file_utils.h" />
- <Unit filename="crn_find_files.cpp" />
- <Unit filename="crn_find_files.h" />
- <Unit filename="crn_fixed_array.h" />
- <Unit filename="crn_hash.cpp" />
- <Unit filename="crn_hash.h" />
- <Unit filename="crn_hash_map.cpp" />
- <Unit filename="crn_hash_map.h" />
- <Unit filename="crn_helpers.h" />
- <Unit filename="crn_huffman_codes.cpp" />
- <Unit filename="crn_huffman_codes.h" />
- <Unit filename="crn_image.h" />
- <Unit filename="crn_image_utils.cpp" />
- <Unit filename="crn_image_utils.h" />
- <Unit filename="crn_intersect.h" />
- <Unit filename="crn_jpgd.cpp" />
- <Unit filename="crn_jpgd.h" />
- <Unit filename="crn_jpge.cpp" />
- <Unit filename="crn_jpge.h" />
- <Unit filename="crn_ktx_texture.cpp" />
- <Unit filename="crn_ktx_texture.h" />
- <Unit filename="crn_lzma_codec.cpp" />
- <Unit filename="crn_lzma_codec.h" />
- <Unit filename="crn_math.cpp" />
- <Unit filename="crn_math.h" />
- <Unit filename="crn_matrix.h" />
- <Unit filename="crn_mem.cpp" />
- <Unit filename="crn_mem.h" />
- <Unit filename="crn_miniz.cpp" />
- <Unit filename="crn_miniz.h" />
- <Unit filename="crn_mipmapped_texture.cpp" />
- <Unit filename="crn_mipmapped_texture.h" />
- <Unit filename="crn_mutex.h" />
- <Unit filename="crn_packed_uint.h" />
- <Unit filename="crn_pixel_format.cpp" />
- <Unit filename="crn_pixel_format.h" />
- <Unit filename="crn_platform.cpp" />
- <Unit filename="crn_platform.h" />
- <Unit filename="crn_prefix_coding.cpp" />
- <Unit filename="crn_prefix_coding.h" />
- <Unit filename="crn_qdxt1.cpp" />
- <Unit filename="crn_qdxt1.h" />
- <Unit filename="crn_qdxt5.cpp" />
- <Unit filename="crn_qdxt5.h" />
- <Unit filename="crn_rand.cpp" />
- <Unit filename="crn_rand.h" />
- <Unit filename="crn_ray.h" />
- <Unit filename="crn_rect.h" />
- <Unit filename="crn_resample_filters.cpp" />
- <Unit filename="crn_resample_filters.h" />
- <Unit filename="crn_resampler.cpp" />
- <Unit filename="crn_resampler.h" />
- <Unit filename="crn_rg_etc1.cpp" />
- <Unit filename="crn_rg_etc1.h" />
- <Unit filename="crn_ryg_dxt.cpp" />
- <Unit filename="crn_ryg_dxt.hpp" />
- <Unit filename="crn_ryg_types.hpp" />
- <Unit filename="crn_sparse_array.h" />
- <Unit filename="crn_sparse_bit_array.cpp" />
- <Unit filename="crn_sparse_bit_array.h" />
- <Unit filename="crn_stb_image.cpp" />
- <Unit filename="crn_strutils.cpp" />
- <Unit filename="crn_strutils.h" />
- <Unit filename="crn_symbol_codec.cpp" />
- <Unit filename="crn_symbol_codec.h" />
- <Unit filename="crn_texture_comp.cpp" />
- <Unit filename="crn_texture_comp.h" />
- <Unit filename="crn_texture_conversion.cpp" />
- <Unit filename="crn_texture_conversion.h" />
- <Unit filename="crn_texture_file_types.cpp" />
- <Unit filename="crn_texture_file_types.h" />
- <Unit filename="crn_threaded_clusterizer.h" />
- <Unit filename="crn_threaded_resampler.cpp" />
- <Unit filename="crn_threaded_resampler.h" />
- <Unit filename="crn_threading.h" />
- <Unit filename="crn_threading_null.h" />
- <Unit filename="crn_threading_pthreads.cpp" />
- <Unit filename="crn_threading_pthreads.h" />
- <Unit filename="crn_threading_win32.h" />
- <Unit filename="crn_timer.cpp" />
- <Unit filename="crn_timer.h" />
- <Unit filename="crn_traits.h" />
- <Unit filename="crn_tree_clusterizer.h" />
- <Unit filename="crn_types.h" />
- <Unit filename="crn_utils.cpp" />
- <Unit filename="crn_utils.h" />
- <Unit filename="crn_value.cpp" />
- <Unit filename="crn_value.h" />
- <Unit filename="crn_vec.h" />
- <Unit filename="crn_vec_interval.h" />
- <Unit filename="crn_vector.cpp" />
- <Unit filename="crn_vector.h" />
- <Unit filename="crn_vector2d.h" />
- <Unit filename="crn_winhdr.h" />
- <Unit filename="crn_zeng.cpp" />
- <Unit filename="crn_zeng.h" />
- <Unit filename="crnlib.cbp" />
- <Unit filename="crnlib.cpp" />
- <Unit filename="lzma_7zBuf.cpp" />
- <Unit filename="lzma_7zBuf.h" />
- <Unit filename="lzma_7zBuf2.cpp" />
- <Unit filename="lzma_7zCrc.h" />
- <Unit filename="lzma_7zFile.cpp" />
- <Unit filename="lzma_7zFile.h" />
- <Unit filename="lzma_7zStream.cpp" />
- <Unit filename="lzma_7zVersion.h" />
- <Unit filename="lzma_Alloc.cpp" />
- <Unit filename="lzma_Alloc.h" />
- <Unit filename="lzma_Bcj2.cpp" />
- <Unit filename="lzma_Bcj2.h" />
- <Unit filename="lzma_Bra.cpp" />
- <Unit filename="lzma_Bra.h" />
- <Unit filename="lzma_Bra86.cpp" />
- <Unit filename="lzma_BraIA64.cpp" />
- <Unit filename="lzma_CpuArch.h" />
- <Unit filename="lzma_LzFind.cpp" />
- <Unit filename="lzma_LzFind.h" />
- <Unit filename="lzma_LzFindMt.h" />
- <Unit filename="lzma_LzHash.h" />
- <Unit filename="lzma_LzmaDec.cpp" />
- <Unit filename="lzma_LzmaDec.h" />
- <Unit filename="lzma_LzmaEnc.cpp" />
- <Unit filename="lzma_LzmaEnc.h" />
- <Unit filename="lzma_LzmaLib.cpp" />
- <Unit filename="lzma_LzmaLib.h" />
- <Unit filename="lzma_MyVersion.h" />
- <Unit filename="lzma_Threads.h" />
- <Unit filename="lzma_Types.h" />
- <Unit filename="../inc/crn_decomp.h" />
- <Unit filename="../inc/crnlib.h" />
- <Unit filename="../inc/dds_defs.h" />
- <Extensions>
- <code_completion />
- <debugger />
- <envvars />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzham_timer.cpp b/Libraries/crunch-ea9b8d/crnlib/lzham_timer.cpp
deleted file mode 100644
index 90aa5364..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzham_timer.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-// File: lzham_timer.cpp
-// See Copyright Notice and license at the end of include/lzham.h
-#include "lzham_core.h"
-#include "lzham_timer.h"
-
-#ifndef LZHAM_USE_WIN32_API
- #include <time.h>
-#endif
-
-namespace lzham
-{
- unsigned long long lzham_timer::g_init_ticks;
- unsigned long long lzham_timer::g_freq;
- double lzham_timer::g_inv_freq;
-
- #if LZHAM_USE_WIN32_API
- inline void query_counter(timer_ticks *pTicks)
- {
- QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(pTicks));
- }
- inline void query_counter_frequency(timer_ticks *pTicks)
- {
- QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(pTicks));
- }
- #else
- inline void query_counter(timer_ticks *pTicks)
- {
- *pTicks = clock();
- }
- inline void query_counter_frequency(timer_ticks *pTicks)
- {
- *pTicks = CLOCKS_PER_SEC;
- }
- #endif
-
- lzham_timer::lzham_timer() :
- m_start_time(0),
- m_stop_time(0),
- m_started(false),
- m_stopped(false)
- {
- if (!g_inv_freq)
- init();
- }
-
- lzham_timer::lzham_timer(timer_ticks start_ticks)
- {
- if (!g_inv_freq)
- init();
-
- m_start_time = start_ticks;
-
- m_started = true;
- m_stopped = false;
- }
-
- void lzham_timer::start(timer_ticks start_ticks)
- {
- m_start_time = start_ticks;
-
- m_started = true;
- m_stopped = false;
- }
-
- void lzham_timer::start()
- {
- query_counter(&m_start_time);
-
- m_started = true;
- m_stopped = false;
- }
-
- void lzham_timer::stop()
- {
- LZHAM_ASSERT(m_started);
-
- query_counter(&m_stop_time);
-
- m_stopped = true;
- }
-
- double lzham_timer::get_elapsed_secs() const
- {
- LZHAM_ASSERT(m_started);
- if (!m_started)
- return 0;
-
- timer_ticks stop_time = m_stop_time;
- if (!m_stopped)
- query_counter(&stop_time);
-
- timer_ticks delta = stop_time - m_start_time;
- return delta * g_inv_freq;
- }
-
- timer_ticks lzham_timer::get_elapsed_us() const
- {
- LZHAM_ASSERT(m_started);
- if (!m_started)
- return 0;
-
- timer_ticks stop_time = m_stop_time;
- if (!m_stopped)
- query_counter(&stop_time);
-
- timer_ticks delta = stop_time - m_start_time;
- return (delta * 1000000ULL + (g_freq >> 1U)) / g_freq;
- }
-
- void lzham_timer::init()
- {
- if (!g_inv_freq)
- {
- query_counter_frequency(&g_freq);
- g_inv_freq = 1.0f / g_freq;
-
- query_counter(&g_init_ticks);
- }
- }
-
- timer_ticks lzham_timer::get_init_ticks()
- {
- if (!g_inv_freq)
- init();
-
- return g_init_ticks;
- }
-
- timer_ticks lzham_timer::get_ticks()
- {
- if (!g_inv_freq)
- init();
-
- timer_ticks ticks;
- query_counter(&ticks);
- return ticks - g_init_ticks;
- }
-
- double lzham_timer::ticks_to_secs(timer_ticks ticks)
- {
- if (!g_inv_freq)
- init();
-
- return ticks * g_inv_freq;
- }
-
-} // namespace lzham \ No newline at end of file
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzham_timer.h b/Libraries/crunch-ea9b8d/crnlib/lzham_timer.h
deleted file mode 100644
index d011a2bf..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzham_timer.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// File: lzham_timer.h
-// See Copyright Notice and license at the end of include/lzham.h
-#pragma once
-
-namespace lzham
-{
- typedef unsigned long long timer_ticks;
-
- class lzham_timer
- {
- public:
- lzham_timer();
- lzham_timer(timer_ticks start_ticks);
-
- void start();
- void start(timer_ticks start_ticks);
-
- void stop();
-
- double get_elapsed_secs() const;
- inline double get_elapsed_ms() const { return get_elapsed_secs() * 1000.0f; }
- timer_ticks get_elapsed_us() const;
-
- static void init();
- static inline timer_ticks get_ticks_per_sec() { return g_freq; }
- static timer_ticks get_init_ticks();
- static timer_ticks get_ticks();
- static double ticks_to_secs(timer_ticks ticks);
- static inline double ticks_to_ms(timer_ticks ticks) { return ticks_to_secs(ticks) * 1000.0f; }
- static inline double get_secs() { return ticks_to_secs(get_ticks()); }
- static inline double get_ms() { return ticks_to_ms(get_ticks()); }
-
- private:
- static timer_ticks g_init_ticks;
- static timer_ticks g_freq;
- static double g_inv_freq;
-
- timer_ticks m_start_time;
- timer_ticks m_stop_time;
-
- bool m_started : 1;
- bool m_stopped : 1;
- };
-
- enum var_args_t { cVarArgs };
-
-#if LZHAM_PERF_SECTIONS
- class scoped_perf_section
- {
- public:
- inline scoped_perf_section() :
- m_start_ticks(lzham_timer::get_ticks())
- {
- m_name[0] = '?';
- m_name[1] = '\0';
- }
-
- inline scoped_perf_section(const char *pName) :
- m_start_ticks(lzham_timer::get_ticks())
- {
- strcpy_s(m_name, pName);
-
- lzham_buffered_printf("Thread: 0x%08X, BEGIN Time: %3.3fms, Section: %s\n", GetCurrentThreadId(), lzham_timer::ticks_to_ms(m_start_ticks), m_name);
- }
-
- inline scoped_perf_section(var_args_t, const char *pName, ...) :
- m_start_ticks(lzham_timer::get_ticks())
- {
- va_list args;
- va_start(args, pName);
- vsprintf_s(m_name, sizeof(m_name), pName, args);
- va_end(args);
-
- lzham_buffered_printf("Thread: 0x%08X, BEGIN Time: %3.3fms, Section: %s\n", GetCurrentThreadId(), lzham_timer::ticks_to_ms(m_start_ticks), m_name);
- }
-
- inline ~scoped_perf_section()
- {
- double end_ms = lzham_timer::get_ms();
- double start_ms = lzham_timer::ticks_to_ms(m_start_ticks);
-
- lzham_buffered_printf("Thread: 0x%08X, END Time: %3.3fms, Total: %3.3fms, Section: %s\n", GetCurrentThreadId(), end_ms, end_ms - start_ms, m_name);
- }
-
- private:
- char m_name[64];
- timer_ticks m_start_ticks;
- };
-#else
- class scoped_perf_section
- {
- public:
- inline scoped_perf_section() { }
- inline scoped_perf_section(const char *pName) { (void)pName; }
- inline scoped_perf_section(var_args_t, const char *pName, ...) { (void)pName; }
- };
-#endif // LZHAM_PERF_SECTIONS
-
-} // namespace lzham
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzham_win32_threading.cpp b/Libraries/crunch-ea9b8d/crnlib/lzham_win32_threading.cpp
deleted file mode 100644
index a3372a23..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzham_win32_threading.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-// File: lzham_task_pool_win32.cpp
-// See Copyright Notice and license at the end of include/lzham.h
-#include "lzham_core.h"
-#include "lzham_win32_threading.h"
-#include "lzham_timer.h"
-#include <process.h>
-
-#if LZHAM_USE_WIN32_API
-
-namespace lzham
-{
- task_pool::task_pool() :
- m_num_threads(0),
- m_tasks_available(0, 32767),
- m_num_outstanding_tasks(0),
- m_exit_flag(false)
- {
- utils::zero_object(m_threads);
- }
-
- task_pool::task_pool(uint num_threads) :
- m_num_threads(0),
- m_tasks_available(0, 32767),
- m_num_outstanding_tasks(0),
- m_exit_flag(false)
- {
- utils::zero_object(m_threads);
-
- bool status = init(num_threads);
- LZHAM_VERIFY(status);
- }
-
- task_pool::~task_pool()
- {
- deinit();
- }
-
- bool task_pool::init(uint num_threads)
- {
- LZHAM_ASSERT(num_threads <= cMaxThreads);
- num_threads = math::minimum<uint>(num_threads, cMaxThreads);
-
- deinit();
-
- bool succeeded = true;
-
- m_num_threads = 0;
- while (m_num_threads < num_threads)
- {
- m_threads[m_num_threads] = (HANDLE)_beginthreadex(NULL, 32768, thread_func, this, 0, NULL);
- LZHAM_ASSERT(m_threads[m_num_threads] != 0);
-
- if (!m_threads[m_num_threads])
- {
- succeeded = false;
- break;
- }
-
- m_num_threads++;
- }
-
- if (!succeeded)
- {
- deinit();
- return false;
- }
-
- return true;
- }
-
- void task_pool::deinit()
- {
- if (m_num_threads)
- {
- join();
-
- atomic_exchange32(&m_exit_flag, true);
-
- m_tasks_available.release(m_num_threads);
-
- for (uint i = 0; i < m_num_threads; i++)
- {
- if (m_threads[i])
- {
- for ( ; ; )
- {
- DWORD result = WaitForSingleObject(m_threads[i], 30000);
- if ((result == WAIT_OBJECT_0) || (result == WAIT_ABANDONED))
- break;
- }
-
- CloseHandle(m_threads[i]);
- m_threads[i] = NULL;
- }
- }
-
- m_num_threads = 0;
-
- atomic_exchange32(&m_exit_flag, false);
- }
-
- m_task_stack.clear();
- m_num_outstanding_tasks = 0;
- }
-
- bool task_pool::queue_task(task_callback_func pFunc, uint64 data, void* pData_ptr)
- {
- LZHAM_ASSERT(m_num_threads);
- LZHAM_ASSERT(pFunc);
-
- task tsk;
- tsk.m_callback = pFunc;
- tsk.m_data = data;
- tsk.m_pData_ptr = pData_ptr;
- tsk.m_flags = 0;
-
- if (!m_task_stack.try_push(tsk))
- return false;
-
- atomic_increment32(&m_num_outstanding_tasks);
-
- m_tasks_available.release(1);
-
- return true;
- }
-
- // It's the object's responsibility to delete pObj within the execute_task() method, if needed!
- bool task_pool::queue_task(executable_task* pObj, uint64 data, void* pData_ptr)
- {
- LZHAM_ASSERT(m_num_threads);
- LZHAM_ASSERT(pObj);
-
- task tsk;
- tsk.m_pObj = pObj;
- tsk.m_data = data;
- tsk.m_pData_ptr = pData_ptr;
- tsk.m_flags = cTaskFlagObject;
-
- if (!m_task_stack.try_push(tsk))
- return false;
-
- atomic_increment32(&m_num_outstanding_tasks);
-
- m_tasks_available.release(1);
-
- return true;
- }
-
- void task_pool::process_task(task& tsk)
- {
- if (tsk.m_flags & cTaskFlagObject)
- tsk.m_pObj->execute_task(tsk.m_data, tsk.m_pData_ptr);
- else
- tsk.m_callback(tsk.m_data, tsk.m_pData_ptr);
-
- atomic_decrement32(&m_num_outstanding_tasks);
- }
-
- void task_pool::join()
- {
- while (atomic_add32(&m_num_outstanding_tasks, 0) > 0)
- {
- task tsk;
- if (m_task_stack.pop(tsk))
- {
- process_task(tsk);
- }
- else
- {
- lzham_sleep(1);
- }
- }
- }
-
- unsigned __stdcall task_pool::thread_func(void* pContext)
- {
- task_pool* pPool = static_cast<task_pool*>(pContext);
-
- for ( ; ; )
- {
- if (!pPool->m_tasks_available.wait())
- break;
-
- if (pPool->m_exit_flag)
- break;
-
- task tsk;
- if (pPool->m_task_stack.pop(tsk))
- {
- pPool->process_task(tsk);
- }
- }
-
- _endthreadex(0);
- return 0;
- }
-
- static uint g_num_processors;
-
- uint lzham_get_max_helper_threads()
- {
- if (!g_num_processors)
- {
- SYSTEM_INFO system_info;
- GetSystemInfo(&system_info);
- g_num_processors = system_info.dwNumberOfProcessors;
- }
-
- if (g_num_processors > 1)
- {
- // use all CPU's
- return LZHAM_MIN(task_pool::cMaxThreads, g_num_processors - 1);
- }
-
- return 0;
- }
-
-} // namespace lzham
-
-#endif // LZHAM_USE_WIN32_API
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzham_win32_threading.h b/Libraries/crunch-ea9b8d/crnlib/lzham_win32_threading.h
deleted file mode 100644
index 640dc8f5..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzham_win32_threading.h
+++ /dev/null
@@ -1,368 +0,0 @@
-// File: lzham_task_pool_win32.h
-// See Copyright Notice and license at the end of include/lzham.h
-#pragma once
-
-#if LZHAM_USE_WIN32_API
-
-#if LZHAM_NO_ATOMICS
-#error No atomic operations defined in lzham_platform.h!
-#endif
-
-namespace lzham
-{
- class semaphore
- {
- LZHAM_NO_COPY_OR_ASSIGNMENT_OP(semaphore);
-
- public:
- semaphore(long initialCount = 0, long maximumCount = 1, const char* pName = NULL)
- {
- m_handle = CreateSemaphoreA(NULL, initialCount, maximumCount, pName);
- if (NULL == m_handle)
- {
- LZHAM_FAIL("semaphore: CreateSemaphore() failed");
- }
- }
-
- ~semaphore()
- {
- if (m_handle)
- {
- CloseHandle(m_handle);
- m_handle = NULL;
- }
- }
-
- inline HANDLE get_handle(void) const { return m_handle; }
-
- void release(long releaseCount = 1)
- {
- if (0 == ReleaseSemaphore(m_handle, releaseCount, NULL))
- {
- LZHAM_FAIL("semaphore: ReleaseSemaphore() failed");
- }
- }
-
- bool wait(uint32 milliseconds = UINT32_MAX)
- {
- LZHAM_ASSUME(INFINITE == UINT32_MAX);
-
- DWORD result = WaitForSingleObject(m_handle, milliseconds);
-
- if (WAIT_FAILED == result)
- {
- LZHAM_FAIL("semaphore: WaitForSingleObject() failed");
- }
-
- return WAIT_OBJECT_0 == result;
- }
-
- private:
- HANDLE m_handle;
- };
-
- template<typename T>
- class tsstack
- {
- public:
- inline tsstack(bool use_freelist = true) :
- m_use_freelist(use_freelist)
- {
- LZHAM_VERIFY(((ptr_bits_t)this & (LZHAM_GET_ALIGNMENT(tsstack) - 1)) == 0);
- InitializeSListHead(&m_stack_head);
- InitializeSListHead(&m_freelist_head);
- }
-
- inline ~tsstack()
- {
- clear();
- }
-
- inline void clear()
- {
- for ( ; ; )
- {
- node* pNode = (node*)InterlockedPopEntrySList(&m_stack_head);
- if (!pNode)
- break;
-
- LZHAM_MEMORY_IMPORT_BARRIER
-
- helpers::destruct(&pNode->m_obj);
-
- lzham_free(pNode);
- }
-
- flush_freelist();
- }
-
- inline void flush_freelist()
- {
- if (!m_use_freelist)
- return;
-
- for ( ; ; )
- {
- node* pNode = (node*)InterlockedPopEntrySList(&m_freelist_head);
- if (!pNode)
- break;
-
- LZHAM_MEMORY_IMPORT_BARRIER
-
- lzham_free(pNode);
- }
- }
-
- inline bool try_push(const T& obj)
- {
- node* pNode = alloc_node();
- if (!pNode)
- return false;
-
- helpers::construct(&pNode->m_obj, obj);
-
- LZHAM_MEMORY_EXPORT_BARRIER
-
- InterlockedPushEntrySList(&m_stack_head, &pNode->m_slist_entry);
-
- return true;
- }
-
- inline bool pop(T& obj)
- {
- node* pNode = (node*)InterlockedPopEntrySList(&m_stack_head);
- if (!pNode)
- return false;
-
- LZHAM_MEMORY_IMPORT_BARRIER
-
- obj = pNode->m_obj;
-
- helpers::destruct(&pNode->m_obj);
-
- free_node(pNode);
-
- return true;
- }
-
- private:
- SLIST_HEADER m_stack_head;
- SLIST_HEADER m_freelist_head;
-
- struct node
- {
- SLIST_ENTRY m_slist_entry;
- T m_obj;
- };
-
- bool m_use_freelist;
-
- inline node* alloc_node()
- {
- node* pNode = m_use_freelist ? (node*)InterlockedPopEntrySList(&m_freelist_head) : NULL;
-
- if (!pNode)
- pNode = (node*)lzham_malloc(sizeof(node));
-
- return pNode;
- }
-
- inline void free_node(node* pNode)
- {
- if (m_use_freelist)
- InterlockedPushEntrySList(&m_freelist_head, &pNode->m_slist_entry);
- else
- lzham_free(pNode);
- }
- };
-
- class task_pool
- {
- public:
- task_pool();
- task_pool(uint num_threads);
- ~task_pool();
-
- enum { cMaxThreads = 16 };
- bool init(uint num_threads);
- void deinit();
-
- inline uint get_num_threads() const { return m_num_threads; }
- inline uint get_num_outstanding_tasks() const { return m_num_outstanding_tasks; }
-
- // C-style task callback
- typedef void (*task_callback_func)(uint64 data, void* pData_ptr);
- bool queue_task(task_callback_func pFunc, uint64 data = 0, void* pData_ptr = NULL);
-
- class executable_task
- {
- public:
- virtual void execute_task(uint64 data, void* pData_ptr) = 0;
- };
-
- // It's the caller's responsibility to delete pObj within the execute_task() method, if needed!
- bool queue_task(executable_task* pObj, uint64 data = 0, void* pData_ptr = NULL);
-
- template<typename S, typename T>
- inline bool queue_object_task(S* pObject, T pObject_method, uint64 data = 0, void* pData_ptr = NULL);
-
- template<typename S, typename T>
- inline bool queue_multiple_object_tasks(S* pObject, T pObject_method, uint64 first_data, uint num_tasks, void* pData_ptr = NULL);
-
- void join();
-
- private:
- struct task
- {
- //inline task() : m_data(0), m_pData_ptr(NULL), m_pObj(NULL), m_flags(0) { }
-
- uint64 m_data;
- void* m_pData_ptr;
-
- union
- {
- task_callback_func m_callback;
- executable_task* m_pObj;
- };
-
- uint m_flags;
- };
-
- tsstack<task> m_task_stack;
-
- uint m_num_threads;
- HANDLE m_threads[cMaxThreads];
-
- semaphore m_tasks_available;
-
- enum task_flags
- {
- cTaskFlagObject = 1
- };
-
- volatile atomic32_t m_num_outstanding_tasks;
- volatile atomic32_t m_exit_flag;
-
- void process_task(task& tsk);
-
- static unsigned __stdcall thread_func(void* pContext);
- };
-
- enum object_task_flags
- {
- cObjectTaskFlagDefault = 0,
- cObjectTaskFlagDeleteAfterExecution = 1
- };
-
- template<typename T>
- class object_task : public task_pool::executable_task
- {
- public:
- object_task(uint flags = cObjectTaskFlagDefault) :
- m_pObject(NULL),
- m_pMethod(NULL),
- m_flags(flags)
- {
- }
-
- typedef void (T::*object_method_ptr)(uint64 data, void* pData_ptr);
-
- object_task(T* pObject, object_method_ptr pMethod, uint flags = cObjectTaskFlagDefault) :
- m_pObject(pObject),
- m_pMethod(pMethod),
- m_flags(flags)
- {
- LZHAM_ASSERT(pObject && pMethod);
- }
-
- void init(T* pObject, object_method_ptr pMethod, uint flags = cObjectTaskFlagDefault)
- {
- LZHAM_ASSERT(pObject && pMethod);
-
- m_pObject = pObject;
- m_pMethod = pMethod;
- m_flags = flags;
- }
-
- T* get_object() const { return m_pObject; }
- object_method_ptr get_method() const { return m_pMethod; }
-
- virtual void execute_task(uint64 data, void* pData_ptr)
- {
- (m_pObject->*m_pMethod)(data, pData_ptr);
-
- if (m_flags & cObjectTaskFlagDeleteAfterExecution)
- lzham_delete(this);
- }
-
- protected:
- T* m_pObject;
-
- object_method_ptr m_pMethod;
-
- uint m_flags;
- };
-
- template<typename S, typename T>
- inline bool task_pool::queue_object_task(S* pObject, T pObject_method, uint64 data, void* pData_ptr)
- {
- object_task<S> *pTask = lzham_new< object_task<S> >(pObject, pObject_method, cObjectTaskFlagDeleteAfterExecution);
- if (!pTask)
- return false;
- return queue_task(pTask, data, pData_ptr);
- }
-
- template<typename S, typename T>
- inline bool task_pool::queue_multiple_object_tasks(S* pObject, T pObject_method, uint64 first_data, uint num_tasks, void* pData_ptr)
- {
- LZHAM_ASSERT(m_num_threads);
- LZHAM_ASSERT(pObject);
- LZHAM_ASSERT(num_tasks);
- if (!num_tasks)
- return true;
-
- bool status = true;
-
- uint i;
- for (i = 0; i < num_tasks; i++)
- {
- task tsk;
-
- tsk.m_pObj = lzham_new< object_task<S> >(pObject, pObject_method, cObjectTaskFlagDeleteAfterExecution);
- if (!tsk.m_pObj)
- {
- status = false;
- break;
- }
-
- tsk.m_data = first_data + i;
- tsk.m_pData_ptr = pData_ptr;
- tsk.m_flags = cTaskFlagObject;
-
- if (!m_task_stack.try_push(tsk))
- {
- status = false;
- break;
- }
- }
-
- if (i)
- {
- atomic_add32(&m_num_outstanding_tasks, i);
-
- m_tasks_available.release(i);
- }
-
- return status;
- }
-
- inline void lzham_sleep(unsigned int milliseconds)
- {
- Sleep(milliseconds);
- }
-
- uint lzham_get_max_helper_threads();
-
-} // namespace lzham
-
-#endif // LZHAM_USE_WIN32_API
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_7zBuf.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_7zBuf.cpp
deleted file mode 100644
index 1645edd4..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_7zBuf.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/* 7zBuf.c -- Byte Buffer
-2008-03-28
-Igor Pavlov
-Public domain */
-#include "crn_core.h"
-
-#include "lzma_7zBuf.h"
-
-namespace crnlib {
-
-void Buf_Init(CBuf *p)
-{
- p->data = 0;
- p->size = 0;
-}
-
-int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc)
-{
- p->size = 0;
- if (size == 0)
- {
- p->data = 0;
- return 1;
- }
- p->data = (Byte *)alloc->Alloc(alloc, size);
- if (p->data != 0)
- {
- p->size = size;
- return 1;
- }
- return 0;
-}
-
-void Buf_Free(CBuf *p, ISzAlloc *alloc)
-{
- alloc->Free(alloc, p->data);
- p->data = 0;
- p->size = 0;
-}
-
-} \ No newline at end of file
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_7zBuf.h b/Libraries/crunch-ea9b8d/crnlib/lzma_7zBuf.h
deleted file mode 100644
index bad28bce..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_7zBuf.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 7zBuf.h -- Byte Buffer
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_BUF_H
-#define __7Z_BUF_H
-
-#include "lzma_Types.h"
-
-namespace crnlib {
-
-typedef struct
-{
- Byte *data;
- size_t size;
-} CBuf;
-
-void Buf_Init(CBuf *p);
-int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc);
-void Buf_Free(CBuf *p, ISzAlloc *alloc);
-
-typedef struct
-{
- Byte *data;
- size_t size;
- size_t pos;
-} CDynBuf;
-
-void DynBuf_Construct(CDynBuf *p);
-void DynBuf_SeekToBeg(CDynBuf *p);
-int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc);
-void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc);
-
-}
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_7zBuf2.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_7zBuf2.cpp
deleted file mode 100644
index 2c3ddfe1..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_7zBuf2.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 7zBuf2.c -- Byte Buffer
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include "crn_core.h"
-#include <string.h>
-#include "lzma_7zBuf.h"
-
-namespace crnlib {
-
-void DynBuf_Construct(CDynBuf *p)
-{
- p->data = 0;
- p->size = 0;
- p->pos = 0;
-}
-
-void DynBuf_SeekToBeg(CDynBuf *p)
-{
- p->pos = 0;
-}
-
-int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc)
-{
- if (size > p->size - p->pos)
- {
- size_t newSize = p->pos + size;
- Byte *data;
- newSize += newSize / 4;
- data = (Byte *)alloc->Alloc(alloc, newSize);
- if (data == 0)
- return 0;
- p->size = newSize;
- memcpy(data, p->data, p->pos);
- alloc->Free(alloc, p->data);
- p->data = data;
- }
- memcpy(p->data + p->pos, buf, size);
- p->pos += size;
- return 1;
-}
-
-void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc)
-{
- alloc->Free(alloc, p->data);
- p->data = 0;
- p->size = 0;
- p->pos = 0;
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_7zCrc.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_7zCrc.cpp
deleted file mode 100644
index 8c53ee18..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_7zCrc.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/* 7zCrc.c -- CRC32 calculation
-2008-08-05
-Igor Pavlov
-Public domain */
-#include "crn_core.h"
-
-#include "lzma_7zCrc.h"
-
-namespace crnlib {
-
-#define kCrcPoly 0xEDB88320
-UInt32 g_CrcTable[256];
-
-void MY_FAST_CALL CrcGenerateTable(void)
-{
- UInt32 i;
- for (i = 0; i < 256; i++)
- {
- UInt32 r = i;
- int j;
- for (j = 0; j < 8; j++)
- r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
- g_CrcTable[i] = r;
- }
-}
-
-UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
-{
- const Byte *p = (const Byte *)data;
- for (; size > 0 ; size--, p++)
- v = CRC_UPDATE_BYTE(v, *p);
- return v;
-}
-
-UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size)
-{
- return CrcUpdate(CRC_INIT_VAL, data, size) ^ 0xFFFFFFFF;
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_7zCrc.h b/Libraries/crunch-ea9b8d/crnlib/lzma_7zCrc.h
deleted file mode 100644
index 77351d56..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_7zCrc.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* 7zCrc.h -- CRC32 calculation
-2008-03-13
-Igor Pavlov
-Public domain */
-
-#ifndef __7Z_CRC_H
-#define __7Z_CRC_H
-
-#include <stddef.h>
-
-#include "lzma_Types.h"
-
-namespace crnlib {
-
-extern UInt32 g_CrcTable[];
-
-void MY_FAST_CALL CrcGenerateTable(void);
-
-#define CRC_INIT_VAL 0xFFFFFFFF
-#define CRC_GET_DIGEST(crc) ((crc) ^ 0xFFFFFFFF)
-#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
-
-UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size);
-UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size);
-
-}
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_7zFile.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_7zFile.cpp
deleted file mode 100644
index 8cdaeacf..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_7zFile.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-/* 7zFile.c -- File IO
-2008-11-22 : Igor Pavlov : Public domain */
-#include "crn_core.h"
-#include "lzma_7zFile.h"
-
-#ifndef USE_WINDOWS_FILE
-
-#include <errno.h>
-
-#endif
-
-#ifdef USE_WINDOWS_FILE
-
-/*
- ReadFile and WriteFile functions in Windows have BUG:
- If you Read or Write 64MB or more (probably min_failure_size = 64MB - 32KB + 1)
- from/to Network file, it returns ERROR_NO_SYSTEM_RESOURCES
- (Insufficient system resources exist to complete the requested service).
- Probably in some version of Windows there are problems with other sizes:
- for 32 MB (maybe also for 16 MB).
- And message can be "Network connection was lost"
-*/
-
-#define kChunkSizeMax (1 << 22)
-
-#endif
-
-namespace crnlib {
-
-void File_Construct(CSzFile *p)
-{
- #ifdef USE_WINDOWS_FILE
- p->handle = INVALID_HANDLE_VALUE;
- #else
- p->file = NULL;
- #endif
-}
-
-static WRes File_Open(CSzFile *p, const char *name, int writeMode)
-{
- #ifdef USE_WINDOWS_FILE
- p->handle = CreateFileA(name,
- writeMode ? GENERIC_WRITE : GENERIC_READ,
- FILE_SHARE_READ, NULL,
- writeMode ? CREATE_ALWAYS : OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, NULL);
- return (p->handle != INVALID_HANDLE_VALUE) ? 0 : GetLastError();
- #else
- p->file = fopen(name, writeMode ? "wb+" : "rb");
- return (p->file != 0) ? 0 : errno;
- #endif
-}
-
-WRes InFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 0); }
-WRes OutFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 1); }
-
-WRes File_Close(CSzFile *p)
-{
- #ifdef USE_WINDOWS_FILE
- if (p->handle != INVALID_HANDLE_VALUE)
- {
- if (!CloseHandle(p->handle))
- return GetLastError();
- p->handle = INVALID_HANDLE_VALUE;
- }
- #else
- if (p->file != NULL)
- {
- int res = fclose(p->file);
- if (res != 0)
- return res;
- p->file = NULL;
- }
- #endif
- return 0;
-}
-
-WRes File_Read(CSzFile *p, void *data, size_t *size)
-{
- size_t originalSize = *size;
- if (originalSize == 0)
- return 0;
-
- #ifdef USE_WINDOWS_FILE
-
- *size = 0;
- do
- {
- DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize;
- DWORD processed = 0;
- BOOL res = ReadFile(p->handle, data, curSize, &processed, NULL);
- data = (void *)((Byte *)data + processed);
- originalSize -= processed;
- *size += processed;
- if (!res)
- return GetLastError();
- if (processed == 0)
- break;
- }
- while (originalSize > 0);
- return 0;
-
- #else
-
- *size = fread(data, 1, originalSize, p->file);
- if (*size == originalSize)
- return 0;
- return ferror(p->file);
-
- #endif
-}
-
-WRes File_Write(CSzFile *p, const void *data, size_t *size)
-{
- size_t originalSize = *size;
- if (originalSize == 0)
- return 0;
-
- #ifdef USE_WINDOWS_FILE
-
- *size = 0;
- do
- {
- DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize;
- DWORD processed = 0;
- BOOL res = WriteFile(p->handle, data, curSize, &processed, NULL);
- data = (void *)((Byte *)data + processed);
- originalSize -= processed;
- *size += processed;
- if (!res)
- return GetLastError();
- if (processed == 0)
- break;
- }
- while (originalSize > 0);
- return 0;
-
- #else
-
- *size = fwrite(data, 1, originalSize, p->file);
- if (*size == originalSize)
- return 0;
- return ferror(p->file);
-
- #endif
-}
-
-WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
-{
- #ifdef USE_WINDOWS_FILE
-
- LARGE_INTEGER value;
- DWORD moveMethod;
- value.LowPart = (DWORD)*pos;
- value.HighPart = (LONG)((UInt64)*pos >> 16 >> 16); /* for case when UInt64 is 32-bit only */
- switch (origin)
- {
- case SZ_SEEK_SET: moveMethod = FILE_BEGIN; break;
- case SZ_SEEK_CUR: moveMethod = FILE_CURRENT; break;
- case SZ_SEEK_END: moveMethod = FILE_END; break;
- default: return ERROR_INVALID_PARAMETER;
- }
- value.LowPart = SetFilePointer(p->handle, value.LowPart, &value.HighPart, moveMethod);
- if (value.LowPart == 0xFFFFFFFF)
- {
- WRes res = GetLastError();
- if (res != NO_ERROR)
- return res;
- }
- *pos = ((Int64)value.HighPart << 32) | value.LowPart;
- return 0;
-
- #else
-
- int moveMethod;
- int res;
- switch (origin)
- {
- case SZ_SEEK_SET: moveMethod = SEEK_SET; break;
- case SZ_SEEK_CUR: moveMethod = SEEK_CUR; break;
- case SZ_SEEK_END: moveMethod = SEEK_END; break;
- default: return 1;
- }
- res = fseek(p->file, (long)*pos, moveMethod);
- *pos = ftell(p->file);
- return res;
-
- #endif
-}
-
-WRes File_GetLength(CSzFile *p, UInt64 *length)
-{
- #ifdef USE_WINDOWS_FILE
-
- DWORD sizeHigh;
- DWORD sizeLow = GetFileSize(p->handle, &sizeHigh);
- if (sizeLow == 0xFFFFFFFF)
- {
- DWORD res = GetLastError();
- if (res != NO_ERROR)
- return res;
- }
- *length = (((UInt64)sizeHigh) << 32) + sizeLow;
- return 0;
-
- #else
-
- long pos = ftell(p->file);
- int res = fseek(p->file, 0, SEEK_END);
- *length = ftell(p->file);
- fseek(p->file, pos, SEEK_SET);
- return res;
-
- #endif
-}
-
-
-/* ---------- FileSeqInStream ---------- */
-
-static SRes FileSeqInStream_Read(void *pp, void *buf, size_t *size)
-{
- CFileSeqInStream *p = (CFileSeqInStream *)pp;
- return File_Read(&p->file, buf, size) == 0 ? SZ_OK : SZ_ERROR_READ;
-}
-
-void FileSeqInStream_CreateVTable(CFileSeqInStream *p)
-{
- p->s.Read = FileSeqInStream_Read;
-}
-
-
-/* ---------- FileInStream ---------- */
-
-static SRes FileInStream_Read(void *pp, void *buf, size_t *size)
-{
- CFileInStream *p = (CFileInStream *)pp;
- return (File_Read(&p->file, buf, size) == 0) ? SZ_OK : SZ_ERROR_READ;
-}
-
-static SRes FileInStream_Seek(void *pp, Int64 *pos, ESzSeek origin)
-{
- CFileInStream *p = (CFileInStream *)pp;
- return File_Seek(&p->file, pos, origin);
-}
-
-void FileInStream_CreateVTable(CFileInStream *p)
-{
- p->s.Read = FileInStream_Read;
- p->s.Seek = FileInStream_Seek;
-}
-
-
-/* ---------- FileOutStream ---------- */
-
-static size_t FileOutStream_Write(void *pp, const void *data, size_t size)
-{
- CFileOutStream *p = (CFileOutStream *)pp;
- File_Write(&p->file, data, &size);
- return size;
-}
-
-void FileOutStream_CreateVTable(CFileOutStream *p)
-{
- p->s.Write = FileOutStream_Write;
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_7zFile.h b/Libraries/crunch-ea9b8d/crnlib/lzma_7zFile.h
deleted file mode 100644
index d18f2583..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_7zFile.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* 7zFile.h -- File IO
-2008-11-22 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_FILE_H
-#define __7Z_FILE_H
-
-#ifdef _WIN32
-#define USE_WINDOWS_FILE
-#endif
-
-#ifdef USE_WINDOWS_FILE
-#include <windows.h>
-#else
-#include <stdio.h>
-#endif
-
-#include "lzma_Types.h"
-
-namespace crnlib {
-
-
-/* ---------- File ---------- */
-
-typedef struct
-{
- #ifdef USE_WINDOWS_FILE
- HANDLE handle;
- #else
- FILE *file;
- #endif
-} CSzFile;
-
-void File_Construct(CSzFile *p);
-WRes InFile_Open(CSzFile *p, const char *name);
-WRes OutFile_Open(CSzFile *p, const char *name);
-WRes File_Close(CSzFile *p);
-
-/* reads max(*size, remain file's size) bytes */
-WRes File_Read(CSzFile *p, void *data, size_t *size);
-
-/* writes *size bytes */
-WRes File_Write(CSzFile *p, const void *data, size_t *size);
-
-WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin);
-WRes File_GetLength(CSzFile *p, UInt64 *length);
-
-
-/* ---------- FileInStream ---------- */
-
-typedef struct
-{
- ISeqInStream s;
- CSzFile file;
-} CFileSeqInStream;
-
-void FileSeqInStream_CreateVTable(CFileSeqInStream *p);
-
-
-typedef struct
-{
- ISeekInStream s;
- CSzFile file;
-} CFileInStream;
-
-void FileInStream_CreateVTable(CFileInStream *p);
-
-
-typedef struct
-{
- ISeqOutStream s;
- CSzFile file;
-} CFileOutStream;
-
-void FileOutStream_CreateVTable(CFileOutStream *p);
-
-}
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_7zStream.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_7zStream.cpp
deleted file mode 100644
index 7aca68ce..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_7zStream.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/* 7zStream.c -- 7z Stream functions
-2008-11-23 : Igor Pavlov : Public domain */
-#include "crn_core.h"
-#include <string.h>
-
-#include "lzma_Types.h"
-
-namespace crnlib {
-
-SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType)
-{
- while (size != 0)
- {
- size_t processed = size;
- RINOK(stream->Read(stream, buf, &processed));
- if (processed == 0)
- return errorType;
- buf = (void *)((Byte *)buf + processed);
- size -= processed;
- }
- return SZ_OK;
-}
-
-SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size)
-{
- return SeqInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
-}
-
-SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf)
-{
- size_t processed = 1;
- RINOK(stream->Read(stream, buf, &processed));
- return (processed == 1) ? SZ_OK : SZ_ERROR_INPUT_EOF;
-}
-
-SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset)
-{
- Int64 t = offset;
- return stream->Seek(stream, &t, SZ_SEEK_SET);
-}
-
-SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size)
-{
- void *lookBuf;
- if (*size == 0)
- return SZ_OK;
- RINOK(stream->Look(stream, &lookBuf, size));
- memcpy(buf, lookBuf, *size);
- return stream->Skip(stream, *size);
-}
-
-SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType)
-{
- while (size != 0)
- {
- size_t processed = size;
- RINOK(stream->Read(stream, buf, &processed));
- if (processed == 0)
- return errorType;
- buf = (void *)((Byte *)buf + processed);
- size -= processed;
- }
- return SZ_OK;
-}
-
-SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size)
-{
- return LookInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
-}
-
-static SRes LookToRead_Look_Lookahead(void *pp, void **buf, size_t *size)
-{
- SRes res = SZ_OK;
- CLookToRead *p = (CLookToRead *)pp;
- size_t size2 = p->size - p->pos;
- if (size2 == 0 && *size > 0)
- {
- p->pos = 0;
- size2 = LookToRead_BUF_SIZE;
- res = p->realStream->Read(p->realStream, p->buf, &size2);
- p->size = size2;
- }
- if (size2 < *size)
- *size = size2;
- *buf = p->buf + p->pos;
- return res;
-}
-
-static SRes LookToRead_Look_Exact(void *pp, void **buf, size_t *size)
-{
- SRes res = SZ_OK;
- CLookToRead *p = (CLookToRead *)pp;
- size_t size2 = p->size - p->pos;
- if (size2 == 0 && *size > 0)
- {
- p->pos = 0;
- if (*size > LookToRead_BUF_SIZE)
- *size = LookToRead_BUF_SIZE;
- res = p->realStream->Read(p->realStream, p->buf, size);
- size2 = p->size = *size;
- }
- if (size2 < *size)
- *size = size2;
- *buf = p->buf + p->pos;
- return res;
-}
-
-static SRes LookToRead_Skip(void *pp, size_t offset)
-{
- CLookToRead *p = (CLookToRead *)pp;
- p->pos += offset;
- return SZ_OK;
-}
-
-static SRes LookToRead_Read(void *pp, void *buf, size_t *size)
-{
- CLookToRead *p = (CLookToRead *)pp;
- size_t rem = p->size - p->pos;
- if (rem == 0)
- return p->realStream->Read(p->realStream, buf, size);
- if (rem > *size)
- rem = *size;
- memcpy(buf, p->buf + p->pos, rem);
- p->pos += rem;
- *size = rem;
- return SZ_OK;
-}
-
-static SRes LookToRead_Seek(void *pp, Int64 *pos, ESzSeek origin)
-{
- CLookToRead *p = (CLookToRead *)pp;
- p->pos = p->size = 0;
- return p->realStream->Seek(p->realStream, pos, origin);
-}
-
-void LookToRead_CreateVTable(CLookToRead *p, int lookahead)
-{
- p->s.Look = lookahead ?
- LookToRead_Look_Lookahead :
- LookToRead_Look_Exact;
- p->s.Skip = LookToRead_Skip;
- p->s.Read = LookToRead_Read;
- p->s.Seek = LookToRead_Seek;
-}
-
-void LookToRead_Init(CLookToRead *p)
-{
- p->pos = p->size = 0;
-}
-
-static SRes SecToLook_Read(void *pp, void *buf, size_t *size)
-{
- CSecToLook *p = (CSecToLook *)pp;
- return LookInStream_LookRead(p->realStream, buf, size);
-}
-
-void SecToLook_CreateVTable(CSecToLook *p)
-{
- p->s.Read = SecToLook_Read;
-}
-
-static SRes SecToRead_Read(void *pp, void *buf, size_t *size)
-{
- CSecToRead *p = (CSecToRead *)pp;
- return p->realStream->Read(p->realStream, buf, size);
-}
-
-void SecToRead_CreateVTable(CSecToRead *p)
-{
- p->s.Read = SecToRead_Read;
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_7zVersion.h b/Libraries/crunch-ea9b8d/crnlib/lzma_7zVersion.h
deleted file mode 100644
index 595dec5f..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_7zVersion.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#define MY_VER_MAJOR 4
-#define MY_VER_MINOR 63
-#define MY_VER_BUILD 0
-#define MY_VERSION "4.63"
-#define MY_DATE "2008-12-31"
-#define MY_COPYRIGHT ": Igor Pavlov : Public domain"
-#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_Alloc.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_Alloc.cpp
deleted file mode 100644
index 32b0da87..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_Alloc.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Alloc.c -- Memory allocation functions
-2008-09-24
-Igor Pavlov
-Public domain */
-#include "crn_core.h"
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#include <stdlib.h>
-
-#include "lzma_Alloc.h"
-
-namespace crnlib {
-
-/* #define _SZ_ALLOC_DEBUG */
-
-/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
-#ifdef _SZ_ALLOC_DEBUG
-#include <stdio.h>
-int g_allocCount = 0;
-int g_allocCountMid = 0;
-int g_allocCountBig = 0;
-#endif
-
-void *MyAlloc(size_t size)
-{
- if (size == 0)
- return 0;
- #ifdef _SZ_ALLOC_DEBUG
- {
- void *p = crnlib::crnlib_malloc(size);
- fprintf(stderr, "\nAlloc %10d bytes, count = %10d, addr = %8X", size, g_allocCount++, (unsigned)p);
- return p;
- }
- #else
- return crnlib::crnlib_malloc(size);
- #endif
-}
-
-void MyFree(void *address)
-{
- #ifdef _SZ_ALLOC_DEBUG
- if (address != 0)
- fprintf(stderr, "\nFree; count = %10d, addr = %8X", --g_allocCount, (unsigned)address);
- #endif
- crnlib::crnlib_free(address);
-}
-
-#ifdef _WIN32
-
-void *MidAlloc(size_t size)
-{
- if (size == 0)
- return 0;
- #ifdef _SZ_ALLOC_DEBUG
- fprintf(stderr, "\nAlloc_Mid %10d bytes; count = %10d", size, g_allocCountMid++);
- #endif
- return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
-}
-
-void MidFree(void *address)
-{
- #ifdef _SZ_ALLOC_DEBUG
- if (address != 0)
- fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid);
- #endif
- if (address == 0)
- return;
- VirtualFree(address, 0, MEM_RELEASE);
-}
-
-#ifndef MEM_LARGE_PAGES
-#undef _7ZIP_LARGE_PAGES
-#endif
-
-#ifdef _7ZIP_LARGE_PAGES
-SIZE_T g_LargePageSize = 0;
-typedef SIZE_T (WINAPI *GetLargePageMinimumP)();
-#endif
-
-void SetLargePageSize()
-{
- #ifdef _7ZIP_LARGE_PAGES
- SIZE_T size = 0;
- GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP)
- GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
- if (largePageMinimum == 0)
- return;
- size = largePageMinimum();
- if (size == 0 || (size & (size - 1)) != 0)
- return;
- g_LargePageSize = size;
- #endif
-}
-
-
-void *BigAlloc(size_t size)
-{
- if (size == 0)
- return 0;
- #ifdef _SZ_ALLOC_DEBUG
- fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++);
- #endif
-
- #ifdef _7ZIP_LARGE_PAGES
- if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18))
- {
- void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),
- MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE);
- if (res != 0)
- return res;
- }
- #endif
- return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
-}
-
-void BigFree(void *address)
-{
- #ifdef _SZ_ALLOC_DEBUG
- if (address != 0)
- fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig);
- #endif
-
- if (address == 0)
- return;
- VirtualFree(address, 0, MEM_RELEASE);
-}
-
-#endif
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_Alloc.h b/Libraries/crunch-ea9b8d/crnlib/lzma_Alloc.h
deleted file mode 100644
index 479f6b04..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_Alloc.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Alloc.h -- Memory allocation functions
-2008-03-13
-Igor Pavlov
-Public domain */
-
-#ifndef __COMMON_ALLOC_H
-#define __COMMON_ALLOC_H
-
-#include <stddef.h>
-
-namespace crnlib {
-
-void *MyAlloc(size_t size);
-void MyFree(void *address);
-
-#ifdef _WIN32
-
-void SetLargePageSize();
-
-void *MidAlloc(size_t size);
-void MidFree(void *address);
-void *BigAlloc(size_t size);
-void BigFree(void *address);
-
-#else
-
-#define MidAlloc(size) MyAlloc(size)
-#define MidFree(address) MyFree(address)
-#define BigAlloc(size) MyAlloc(size)
-#define BigFree(address) MyFree(address)
-
-#endif
-
-}
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_Bcj2.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_Bcj2.cpp
deleted file mode 100644
index 4bf75750..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_Bcj2.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Bcj2.c -- Converter for x86 code (BCJ2)
-2008-10-04 : Igor Pavlov : Public domain */
-#include "crn_core.h"
-#include "lzma_Bcj2.h"
-
-namespace crnlib {
-
-#ifdef _LZMA_PROB32
-#define CProb UInt32
-#else
-#define CProb UInt16
-#endif
-
-#define IsJcc(b0, b1) ((b0) == 0x0F && ((b1) & 0xF0) == 0x80)
-#define IsJ(b0, b1) ((b1 & 0xFE) == 0xE8 || IsJcc(b0, b1))
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-#define RC_READ_BYTE (*buffer++)
-#define RC_TEST { if (buffer == bufferLim) return SZ_ERROR_DATA; }
-#define RC_INIT2 code = 0; range = 0xFFFFFFFF; \
- { int i; for (i = 0; i < 5; i++) { RC_TEST; code = (code << 8) | RC_READ_BYTE; }}
-
-#define NORMALIZE if (range < kTopValue) { RC_TEST; range <<= 8; code = (code << 8) | RC_READ_BYTE; }
-
-#define IF_BIT_0(p) ttt = *(p); bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
-#define UPDATE_0(p) range = bound; *(p) = (CProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); NORMALIZE;
-#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CProb)(ttt - (ttt >> kNumMoveBits)); NORMALIZE;
-
-int Bcj2_Decode(
- const Byte *buf0, SizeT size0,
- const Byte *buf1, SizeT size1,
- const Byte *buf2, SizeT size2,
- const Byte *buf3, SizeT size3,
- Byte *outBuf, SizeT outSize)
-{
- CProb p[256 + 2];
- SizeT inPos = 0, outPos = 0;
-
- const Byte *buffer, *bufferLim;
- UInt32 range, code;
- Byte prevByte = 0;
-
- unsigned int i;
- for (i = 0; i < sizeof(p) / sizeof(p[0]); i++)
- p[i] = kBitModelTotal >> 1;
-
- buffer = buf3;
- bufferLim = buffer + size3;
- RC_INIT2
-
- if (outSize == 0)
- return SZ_OK;
-
- for (;;)
- {
- Byte b;
- CProb *prob;
- UInt32 bound;
- UInt32 ttt;
-
- SizeT limit = size0 - inPos;
- if (outSize - outPos < limit)
- limit = outSize - outPos;
- while (limit != 0)
- {
- Byte b = buf0[inPos];
- outBuf[outPos++] = b;
- if (IsJ(prevByte, b))
- break;
- inPos++;
- prevByte = b;
- limit--;
- }
-
- if (limit == 0 || outPos == outSize)
- break;
-
- b = buf0[inPos++];
-
- if (b == 0xE8)
- prob = p + prevByte;
- else if (b == 0xE9)
- prob = p + 256;
- else
- prob = p + 257;
-
- IF_BIT_0(prob)
- {
- UPDATE_0(prob)
- prevByte = b;
- }
- else
- {
- UInt32 dest;
- const Byte *v;
- UPDATE_1(prob)
- if (b == 0xE8)
- {
- v = buf1;
- if (size1 < 4)
- return SZ_ERROR_DATA;
- buf1 += 4;
- size1 -= 4;
- }
- else
- {
- v = buf2;
- if (size2 < 4)
- return SZ_ERROR_DATA;
- buf2 += 4;
- size2 -= 4;
- }
- dest = (((UInt32)v[0] << 24) | ((UInt32)v[1] << 16) |
- ((UInt32)v[2] << 8) | ((UInt32)v[3])) - ((UInt32)outPos + 4);
- outBuf[outPos++] = (Byte)dest;
- if (outPos == outSize)
- break;
- outBuf[outPos++] = (Byte)(dest >> 8);
- if (outPos == outSize)
- break;
- outBuf[outPos++] = (Byte)(dest >> 16);
- if (outPos == outSize)
- break;
- outBuf[outPos++] = prevByte = (Byte)(dest >> 24);
- }
- }
- return (outPos == outSize) ? SZ_OK : SZ_ERROR_DATA;
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_Bcj2.h b/Libraries/crunch-ea9b8d/crnlib/lzma_Bcj2.h
deleted file mode 100644
index 8a8429d0..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_Bcj2.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Bcj2.h -- Converter for x86 code (BCJ2)
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __BCJ2_H
-#define __BCJ2_H
-
-#include "lzma_Types.h"
-
-namespace crnlib {
-
-/*
-Conditions:
- outSize <= FullOutputSize,
- where FullOutputSize is full size of output stream of x86_2 filter.
-
-If buf0 overlaps outBuf, there are two required conditions:
- 1) (buf0 >= outBuf)
- 2) (buf0 + size0 >= outBuf + FullOutputSize).
-
-Returns:
- SZ_OK
- SZ_ERROR_DATA - Data error
-*/
-
-int Bcj2_Decode(
- const Byte *buf0, SizeT size0,
- const Byte *buf1, SizeT size1,
- const Byte *buf2, SizeT size2,
- const Byte *buf3, SizeT size3,
- Byte *outBuf, SizeT outSize);
-
-}
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_Bra.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_Bra.cpp
deleted file mode 100644
index 434d7c56..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_Bra.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/* Bra.c -- Converters for RISC code
-2008-10-04 : Igor Pavlov : Public domain */
-#include "crn_core.h"
-#include "lzma_Bra.h"
-
-namespace crnlib {
-
-SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
-{
- SizeT i;
- if (size < 4)
- return 0;
- size -= 4;
- ip += 8;
- for (i = 0; i <= size; i += 4)
- {
- if (data[i + 3] == 0xEB)
- {
- UInt32 dest;
- UInt32 src = ((UInt32)data[i + 2] << 16) | ((UInt32)data[i + 1] << 8) | (data[i + 0]);
- src <<= 2;
- if (encoding)
- dest = ip + (UInt32)i + src;
- else
- dest = src - (ip + (UInt32)i);
- dest >>= 2;
- data[i + 2] = (Byte)(dest >> 16);
- data[i + 1] = (Byte)(dest >> 8);
- data[i + 0] = (Byte)dest;
- }
- }
- return i;
-}
-
-SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
-{
- SizeT i;
- if (size < 4)
- return 0;
- size -= 4;
- ip += 4;
- for (i = 0; i <= size; i += 2)
- {
- if ((data[i + 1] & 0xF8) == 0xF0 &&
- (data[i + 3] & 0xF8) == 0xF8)
- {
- UInt32 dest;
- UInt32 src =
- (((UInt32)data[i + 1] & 0x7) << 19) |
- ((UInt32)data[i + 0] << 11) |
- (((UInt32)data[i + 3] & 0x7) << 8) |
- (data[i + 2]);
-
- src <<= 1;
- if (encoding)
- dest = ip + (UInt32)i + src;
- else
- dest = src - (ip + (UInt32)i);
- dest >>= 1;
-
- data[i + 1] = (Byte)(0xF0 | ((dest >> 19) & 0x7));
- data[i + 0] = (Byte)(dest >> 11);
- data[i + 3] = (Byte)(0xF8 | ((dest >> 8) & 0x7));
- data[i + 2] = (Byte)dest;
- i += 2;
- }
- }
- return i;
-}
-
-SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
-{
- SizeT i;
- if (size < 4)
- return 0;
- size -= 4;
- for (i = 0; i <= size; i += 4)
- {
- if ((data[i] >> 2) == 0x12 && (data[i + 3] & 3) == 1)
- {
- UInt32 src = ((UInt32)(data[i + 0] & 3) << 24) |
- ((UInt32)data[i + 1] << 16) |
- ((UInt32)data[i + 2] << 8) |
- ((UInt32)data[i + 3] & (~3));
-
- UInt32 dest;
- if (encoding)
- dest = ip + (UInt32)i + src;
- else
- dest = src - (ip + (UInt32)i);
- data[i + 0] = (Byte)(0x48 | ((dest >> 24) & 0x3));
- data[i + 1] = (Byte)(dest >> 16);
- data[i + 2] = (Byte)(dest >> 8);
- data[i + 3] &= 0x3;
- data[i + 3] |= dest;
- }
- }
- return i;
-}
-
-SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
-{
- UInt32 i;
- if (size < 4)
- return 0;
- size -= 4;
- for (i = 0; i <= size; i += 4)
- {
- if ( ((data[i] == 0x40) && ((data[i + 1] & 0xC0) == 0x00)) ||
- ((data[i] == 0x7F) && ((data[i + 1] & 0xC0) == 0xC0)) )
- {
- UInt32 src =
- ((UInt32)data[i + 0] << 24) |
- ((UInt32)data[i + 1] << 16) |
- ((UInt32)data[i + 2] << 8) |
- ((UInt32)data[i + 3]);
- UInt32 dest;
-
- src <<= 2;
- if (encoding)
- dest = ip + i + src;
- else
- dest = src - (ip + i);
- dest >>= 2;
-
- dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) | (dest & 0x3FFFFF) | 0x40000000;
-
- data[i + 0] = (Byte)(dest >> 24);
- data[i + 1] = (Byte)(dest >> 16);
- data[i + 2] = (Byte)(dest >> 8);
- data[i + 3] = (Byte)dest;
- }
- }
- return i;
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_Bra.h b/Libraries/crunch-ea9b8d/crnlib/lzma_Bra.h
deleted file mode 100644
index 9cf320ee..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_Bra.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Bra.h -- Branch converters for executables
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __BRA_H
-#define __BRA_H
-
-#include "lzma_Types.h"
-
-namespace crnlib {
-
-/*
-These functions convert relative addresses to absolute addresses
-in CALL instructions to increase the compression ratio.
-
- In:
- data - data buffer
- size - size of data
- ip - current virtual Instruction Pinter (IP) value
- state - state variable for x86 converter
- encoding - 0 (for decoding), 1 (for encoding)
-
- Out:
- state - state variable for x86 converter
-
- Returns:
- The number of processed bytes. If you call these functions with multiple calls,
- you must start next call with first byte after block of processed bytes.
-
- Type Endian Alignment LookAhead
-
- x86 little 1 4
- ARMT little 2 2
- ARM little 4 0
- PPC big 4 0
- SPARC big 4 0
- IA64 little 16 0
-
- size must be >= Alignment + LookAhead, if it's not last block.
- If (size < Alignment + LookAhead), converter returns 0.
-
- Example:
-
- UInt32 ip = 0;
- for ()
- {
- ; size must be >= Alignment + LookAhead, if it's not last block
- SizeT processed = Convert(data, size, ip, 1);
- data += processed;
- size -= processed;
- ip += processed;
- }
-*/
-
-#define x86_Convert_Init(state) { state = 0; }
-SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding);
-SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
-SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
-SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
-SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
-SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
-
-}
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_Bra86.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_Bra86.cpp
deleted file mode 100644
index 51814744..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_Bra86.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Bra86.c -- Converter for x86 code (BCJ)
-2008-10-04 : Igor Pavlov : Public domain */
-#include "crn_core.h"
-#include "lzma_Bra.h"
-
-namespace crnlib {
-
-#define Test86MSByte(b) ((b) == 0 || (b) == 0xFF)
-
-const Byte kMaskToAllowedStatus[8] = {1, 1, 1, 0, 1, 0, 0, 0};
-const Byte kMaskToBitNumber[8] = {0, 1, 2, 2, 3, 3, 3, 3};
-
-SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding)
-{
- SizeT bufferPos = 0, prevPosT;
- UInt32 prevMask = *state & 0x7;
- if (size < 5)
- return 0;
- ip += 5;
- prevPosT = (SizeT)0 - 1;
-
- for (;;)
- {
- Byte *p = data + bufferPos;
- Byte *limit = data + size - 4;
- for (; p < limit; p++)
- if ((*p & 0xFE) == 0xE8)
- break;
- bufferPos = (SizeT)(p - data);
- if (p >= limit)
- break;
- prevPosT = bufferPos - prevPosT;
- if (prevPosT > 3)
- prevMask = 0;
- else
- {
- prevMask = (prevMask << ((int)prevPosT - 1)) & 0x7;
- if (prevMask != 0)
- {
- Byte b = p[4 - kMaskToBitNumber[prevMask]];
- if (!kMaskToAllowedStatus[prevMask] || Test86MSByte(b))
- {
- prevPosT = bufferPos;
- prevMask = ((prevMask << 1) & 0x7) | 1;
- bufferPos++;
- continue;
- }
- }
- }
- prevPosT = bufferPos;
-
- if (Test86MSByte(p[4]))
- {
- UInt32 src = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]);
- UInt32 dest;
- for (;;)
- {
- Byte b;
- int index;
- if (encoding)
- dest = (ip + (UInt32)bufferPos) + src;
- else
- dest = src - (ip + (UInt32)bufferPos);
- if (prevMask == 0)
- break;
- index = kMaskToBitNumber[prevMask] * 8;
- b = (Byte)(dest >> (24 - index));
- if (!Test86MSByte(b))
- break;
- src = dest ^ ((1 << (32 - index)) - 1);
- }
- p[4] = (Byte)(~(((dest >> 24) & 1) - 1));
- p[3] = (Byte)(dest >> 16);
- p[2] = (Byte)(dest >> 8);
- p[1] = (Byte)dest;
- bufferPos += 5;
- }
- else
- {
- prevMask = ((prevMask << 1) & 0x7) | 1;
- bufferPos++;
- }
- }
- prevPosT = bufferPos - prevPosT;
- *state = ((prevPosT > 3) ? 0 : ((prevMask << ((int)prevPosT - 1)) & 0x7));
- return bufferPos;
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_BraIA64.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_BraIA64.cpp
deleted file mode 100644
index 65d3425c..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_BraIA64.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/* BraIA64.c -- Converter for IA-64 code
-2008-10-04 : Igor Pavlov : Public domain */
-#include "crn_core.h"
-#include "lzma_Bra.h"
-
-namespace crnlib {
-
-static const Byte kBranchTable[32] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 4, 4, 6, 6, 0, 0, 7, 7,
- 4, 4, 0, 0, 4, 4, 0, 0
-};
-
-SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
-{
- SizeT i;
- if (size < 16)
- return 0;
- size -= 16;
- for (i = 0; i <= size; i += 16)
- {
- UInt32 instrTemplate = data[i] & 0x1F;
- UInt32 mask = kBranchTable[instrTemplate];
- UInt32 bitPos = 5;
- int slot;
- for (slot = 0; slot < 3; slot++, bitPos += 41)
- {
- UInt32 bytePos, bitRes;
- UInt64 instruction, instNorm;
- int j;
- if (((mask >> slot) & 1) == 0)
- continue;
- bytePos = (bitPos >> 3);
- bitRes = bitPos & 0x7;
- instruction = 0;
- for (j = 0; j < 6; j++)
- instruction += (UInt64)data[i + j + bytePos] << (8 * j);
-
- instNorm = instruction >> bitRes;
- if (((instNorm >> 37) & 0xF) == 0x5 && ((instNorm >> 9) & 0x7) == 0)
- {
- UInt32 src = (UInt32)((instNorm >> 13) & 0xFFFFF);
- UInt32 dest;
- src |= ((UInt32)(instNorm >> 36) & 1) << 20;
-
- src <<= 4;
-
- if (encoding)
- dest = ip + (UInt32)i + src;
- else
- dest = src - (ip + (UInt32)i);
-
- dest >>= 4;
-
- instNorm &= ~((UInt64)(0x8FFFFF) << 13);
- instNorm |= ((UInt64)(dest & 0xFFFFF) << 13);
- instNorm |= ((UInt64)(dest & 0x100000) << (36 - 20));
-
- instruction &= (1 << bitRes) - 1;
- instruction |= (instNorm << bitRes);
- for (j = 0; j < 6; j++)
- data[i + j + bytePos] = (Byte)(instruction >> (8 * j));
- }
- }
- }
- return i;
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_CpuArch.h b/Libraries/crunch-ea9b8d/crnlib/lzma_CpuArch.h
deleted file mode 100644
index 006361f2..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_CpuArch.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* CpuArch.h
-2008-08-05
-Igor Pavlov
-Public domain */
-
-#ifndef __CPUARCH_H
-#define __CPUARCH_H
-
-/*
-LITTLE_ENDIAN_UNALIGN means:
- 1) CPU is LITTLE_ENDIAN
- 2) it's allowed to make unaligned memory accesses
-if LITTLE_ENDIAN_UNALIGN is not defined, it means that we don't know
-about these properties of platform.
-*/
-
-#if defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) || defined(__i386__) || defined(__x86_64__)
-#define LITTLE_ENDIAN_UNALIGN
-#endif
-
-#ifdef LITTLE_ENDIAN_UNALIGN
-
-#define GetUi16(p) (*(const UInt16 *)(p))
-#define GetUi32(p) (*(const UInt32 *)(p))
-#define GetUi64(p) (*(const UInt64 *)(p))
-#define SetUi32(p, d) *(UInt32 *)(p) = (d);
-
-#else
-
-#define GetUi16(p) (((const Byte *)(p))[0] | ((UInt16)((const Byte *)(p))[1] << 8))
-
-#define GetUi32(p) ( \
- ((const Byte *)(p))[0] | \
- ((UInt32)((const Byte *)(p))[1] << 8) | \
- ((UInt32)((const Byte *)(p))[2] << 16) | \
- ((UInt32)((const Byte *)(p))[3] << 24))
-
-#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
-
-#define SetUi32(p, d) { UInt32 _x_ = (d); \
- ((Byte *)(p))[0] = (Byte)_x_; \
- ((Byte *)(p))[1] = (Byte)(_x_ >> 8); \
- ((Byte *)(p))[2] = (Byte)(_x_ >> 16); \
- ((Byte *)(p))[3] = (Byte)(_x_ >> 24); }
-
-#endif
-
-#if defined(LITTLE_ENDIAN_UNALIGN) && defined(_WIN64) && (_MSC_VER >= 1300)
-
-#pragma intrinsic(_byteswap_ulong)
-#pragma intrinsic(_byteswap_uint64)
-#define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p))
-#define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const Byte *)(p))
-
-#else
-
-#define GetBe32(p) ( \
- ((UInt32)((const Byte *)(p))[0] << 24) | \
- ((UInt32)((const Byte *)(p))[1] << 16) | \
- ((UInt32)((const Byte *)(p))[2] << 8) | \
- ((const Byte *)(p))[3] )
-
-#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4))
-
-#endif
-
-#define GetBe16(p) (((UInt16)((const Byte *)(p))[0] << 8) | ((const Byte *)(p))[1])
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_LzFind.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_LzFind.cpp
deleted file mode 100644
index 98b2b09f..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_LzFind.cpp
+++ /dev/null
@@ -1,755 +0,0 @@
-/* LzFind.c -- Match finder for LZ algorithms
-2008-10-04 : Igor Pavlov : Public domain */
-#include "crn_core.h"
-#include <string.h>
-
-#include "lzma_LzFind.h"
-#include "lzma_LzHash.h"
-
-namespace crnlib {
-
-#define kEmptyHashValue 0
-#define kMaxValForNormalize ((UInt32)0xFFFFFFFF)
-#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */
-#define kNormalizeMask (~(kNormalizeStepMin - 1))
-#define kMaxHistorySize ((UInt32)3 << 30)
-
-#define kStartMaxLen 3
-
-static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc)
-{
- if (!p->directInput)
- {
- alloc->Free(alloc, p->bufferBase);
- p->bufferBase = 0;
- }
-}
-
-/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */
-
-static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc)
-{
- UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv;
- if (p->directInput)
- {
- p->blockSize = blockSize;
- return 1;
- }
- if (p->bufferBase == 0 || p->blockSize != blockSize)
- {
- LzInWindow_Free(p, alloc);
- p->blockSize = blockSize;
- p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize);
- }
- return (p->bufferBase != 0);
-}
-
-Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
-Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
-
-UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
-
-void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
-{
- p->posLimit -= subValue;
- p->pos -= subValue;
- p->streamPos -= subValue;
-}
-
-static void MatchFinder_ReadBlock(CMatchFinder *p)
-{
- if (p->streamEndWasReached || p->result != SZ_OK)
- return;
- for (;;)
- {
- Byte *dest = p->buffer + (p->streamPos - p->pos);
- size_t size = (p->bufferBase + p->blockSize - dest);
- if (size == 0)
- return;
- p->result = p->stream->Read(p->stream, dest, &size);
- if (p->result != SZ_OK)
- return;
- if (size == 0)
- {
- p->streamEndWasReached = 1;
- return;
- }
- p->streamPos += (UInt32)size;
- if (p->streamPos - p->pos > p->keepSizeAfter)
- return;
- }
-}
-
-void MatchFinder_MoveBlock(CMatchFinder *p)
-{
- memmove(p->bufferBase,
- p->buffer - p->keepSizeBefore,
- (size_t)(p->streamPos - p->pos + p->keepSizeBefore));
- p->buffer = p->bufferBase + p->keepSizeBefore;
-}
-
-int MatchFinder_NeedMove(CMatchFinder *p)
-{
- /* if (p->streamEndWasReached) return 0; */
- return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
-}
-
-void MatchFinder_ReadIfRequired(CMatchFinder *p)
-{
- if (p->streamEndWasReached)
- return;
- if (p->keepSizeAfter >= p->streamPos - p->pos)
- MatchFinder_ReadBlock(p);
-}
-
-static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p)
-{
- if (MatchFinder_NeedMove(p))
- MatchFinder_MoveBlock(p);
- MatchFinder_ReadBlock(p);
-}
-
-static void MatchFinder_SetDefaultSettings(CMatchFinder *p)
-{
- p->cutValue = 32;
- p->btMode = 1;
- p->numHashBytes = 4;
- /* p->skipModeBits = 0; */
- p->directInput = 0;
- p->bigHash = 0;
-}
-
-#define kCrcPoly 0xEDB88320
-
-void MatchFinder_Construct(CMatchFinder *p)
-{
- UInt32 i;
- p->bufferBase = 0;
- p->directInput = 0;
- p->hash = 0;
- MatchFinder_SetDefaultSettings(p);
-
- for (i = 0; i < 256; i++)
- {
- UInt32 r = i;
- int j;
- for (j = 0; j < 8; j++)
- r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
- p->crc[i] = r;
- }
-}
-
-static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc)
-{
- alloc->Free(alloc, p->hash);
- p->hash = 0;
-}
-
-void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc)
-{
- MatchFinder_FreeThisClassMemory(p, alloc);
- LzInWindow_Free(p, alloc);
-}
-
-static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc)
-{
- size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
- if (sizeInBytes / sizeof(CLzRef) != num)
- return 0;
- return (CLzRef *)alloc->Alloc(alloc, sizeInBytes);
-}
-
-int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
- UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
- ISzAlloc *alloc)
-{
- UInt32 sizeReserv;
- if (historySize > kMaxHistorySize)
- {
- MatchFinder_Free(p, alloc);
- return 0;
- }
- sizeReserv = historySize >> 1;
- if (historySize > ((UInt32)2 << 30))
- sizeReserv = historySize >> 2;
- sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19);
-
- p->keepSizeBefore = historySize + keepAddBufferBefore + 1;
- p->keepSizeAfter = matchMaxLen + keepAddBufferAfter;
- /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */
- if (LzInWindow_Create(p, sizeReserv, alloc))
- {
- UInt32 newCyclicBufferSize = (historySize /* >> p->skipModeBits */) + 1;
- UInt32 hs;
- p->matchMaxLen = matchMaxLen;
- {
- p->fixedHashSize = 0;
- if (p->numHashBytes == 2)
- hs = (1 << 16) - 1;
- else
- {
- hs = historySize - 1;
- hs |= (hs >> 1);
- hs |= (hs >> 2);
- hs |= (hs >> 4);
- hs |= (hs >> 8);
- hs >>= 1;
- /* hs >>= p->skipModeBits; */
- hs |= 0xFFFF; /* don't change it! It's required for Deflate */
- if (hs > (1 << 24))
- {
- if (p->numHashBytes == 3)
- hs = (1 << 24) - 1;
- else
- hs >>= 1;
- }
- }
- p->hashMask = hs;
- hs++;
- if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size;
- if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size;
- if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size;
- hs += p->fixedHashSize;
- }
-
- {
- UInt32 prevSize = p->hashSizeSum + p->numSons;
- UInt32 newSize;
- p->historySize = historySize;
- p->hashSizeSum = hs;
- p->cyclicBufferSize = newCyclicBufferSize;
- p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize);
- newSize = p->hashSizeSum + p->numSons;
- if (p->hash != 0 && prevSize == newSize)
- return 1;
- MatchFinder_FreeThisClassMemory(p, alloc);
- p->hash = AllocRefs(newSize, alloc);
- if (p->hash != 0)
- {
- p->son = p->hash + p->hashSizeSum;
- return 1;
- }
- }
- }
- MatchFinder_Free(p, alloc);
- return 0;
-}
-
-static void MatchFinder_SetLimits(CMatchFinder *p)
-{
- UInt32 limit = kMaxValForNormalize - p->pos;
- UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos;
- if (limit2 < limit)
- limit = limit2;
- limit2 = p->streamPos - p->pos;
- if (limit2 <= p->keepSizeAfter)
- {
- if (limit2 > 0)
- limit2 = 1;
- }
- else
- limit2 -= p->keepSizeAfter;
- if (limit2 < limit)
- limit = limit2;
- {
- UInt32 lenLimit = p->streamPos - p->pos;
- if (lenLimit > p->matchMaxLen)
- lenLimit = p->matchMaxLen;
- p->lenLimit = lenLimit;
- }
- p->posLimit = p->pos + limit;
-}
-
-void MatchFinder_Init(CMatchFinder *p)
-{
- UInt32 i;
- for (i = 0; i < p->hashSizeSum; i++)
- p->hash[i] = kEmptyHashValue;
- p->cyclicBufferPos = 0;
- p->buffer = p->bufferBase;
- p->pos = p->streamPos = p->cyclicBufferSize;
- p->result = SZ_OK;
- p->streamEndWasReached = 0;
- MatchFinder_ReadBlock(p);
- MatchFinder_SetLimits(p);
-}
-
-static UInt32 MatchFinder_GetSubValue(CMatchFinder *p)
-{
- return (p->pos - p->historySize - 1) & kNormalizeMask;
-}
-
-void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
-{
- UInt32 i;
- for (i = 0; i < numItems; i++)
- {
- UInt32 value = items[i];
- if (value <= subValue)
- value = kEmptyHashValue;
- else
- value -= subValue;
- items[i] = value;
- }
-}
-
-static void MatchFinder_Normalize(CMatchFinder *p)
-{
- UInt32 subValue = MatchFinder_GetSubValue(p);
- MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons);
- MatchFinder_ReduceOffsets(p, subValue);
-}
-
-static void MatchFinder_CheckLimits(CMatchFinder *p)
-{
- if (p->pos == kMaxValForNormalize)
- MatchFinder_Normalize(p);
- if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos)
- MatchFinder_CheckAndMoveAndRead(p);
- if (p->cyclicBufferPos == p->cyclicBufferSize)
- p->cyclicBufferPos = 0;
- MatchFinder_SetLimits(p);
-}
-
-static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
- UInt32 *distances, UInt32 maxLen)
-{
- son[_cyclicBufferPos] = curMatch;
- for (;;)
- {
- UInt32 delta = pos - curMatch;
- if (cutValue-- == 0 || delta >= _cyclicBufferSize)
- return distances;
- {
- const Byte *pb = cur - delta;
- curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
- if (pb[maxLen] == cur[maxLen] && *pb == *cur)
- {
- UInt32 len = 0;
- while (++len != lenLimit)
- if (pb[len] != cur[len])
- break;
- if (maxLen < len)
- {
- *distances++ = maxLen = len;
- *distances++ = delta - 1;
- if (len == lenLimit)
- return distances;
- }
- }
- }
- }
-}
-
-UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
- UInt32 *distances, UInt32 maxLen)
-{
- CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
- CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
- UInt32 len0 = 0, len1 = 0;
- for (;;)
- {
- UInt32 delta = pos - curMatch;
- if (cutValue-- == 0 || delta >= _cyclicBufferSize)
- {
- *ptr0 = *ptr1 = kEmptyHashValue;
- return distances;
- }
- {
- CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
- const Byte *pb = cur - delta;
- UInt32 len = (len0 < len1 ? len0 : len1);
- if (pb[len] == cur[len])
- {
- if (++len != lenLimit && pb[len] == cur[len])
- while (++len != lenLimit)
- if (pb[len] != cur[len])
- break;
- if (maxLen < len)
- {
- *distances++ = maxLen = len;
- *distances++ = delta - 1;
- if (len == lenLimit)
- {
- *ptr1 = pair[0];
- *ptr0 = pair[1];
- return distances;
- }
- }
- }
- if (pb[len] < cur[len])
- {
- *ptr1 = curMatch;
- ptr1 = pair + 1;
- curMatch = *ptr1;
- len1 = len;
- }
- else
- {
- *ptr0 = curMatch;
- ptr0 = pair;
- curMatch = *ptr0;
- len0 = len;
- }
- }
- }
-}
-
-static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue)
-{
- CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
- CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
- UInt32 len0 = 0, len1 = 0;
- for (;;)
- {
- UInt32 delta = pos - curMatch;
- if (cutValue-- == 0 || delta >= _cyclicBufferSize)
- {
- *ptr0 = *ptr1 = kEmptyHashValue;
- return;
- }
- {
- CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
- const Byte *pb = cur - delta;
- UInt32 len = (len0 < len1 ? len0 : len1);
- if (pb[len] == cur[len])
- {
- while (++len != lenLimit)
- if (pb[len] != cur[len])
- break;
- {
- if (len == lenLimit)
- {
- *ptr1 = pair[0];
- *ptr0 = pair[1];
- return;
- }
- }
- }
- if (pb[len] < cur[len])
- {
- *ptr1 = curMatch;
- ptr1 = pair + 1;
- curMatch = *ptr1;
- len1 = len;
- }
- else
- {
- *ptr0 = curMatch;
- ptr0 = pair;
- curMatch = *ptr0;
- len0 = len;
- }
- }
- }
-}
-
-#define MOVE_POS \
- ++p->cyclicBufferPos; \
- p->buffer++; \
- if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p);
-
-#define MOVE_POS_RET MOVE_POS return offset;
-
-static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }
-
-#define GET_MATCHES_HEADER2(minLen, ret_op) \
- UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \
- lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
- cur = p->buffer;
-
-#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0)
-#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue)
-
-#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
-
-#define GET_MATCHES_FOOTER(offset, maxLen) \
- offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \
- distances + offset, maxLen) - distances); MOVE_POS_RET;
-
-#define SKIP_FOOTER \
- SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;
-
-static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-{
- UInt32 offset;
- GET_MATCHES_HEADER(2)
- HASH2_CALC;
- curMatch = p->hash[hashValue];
- p->hash[hashValue] = p->pos;
- offset = 0;
- GET_MATCHES_FOOTER(offset, 1)
-}
-
-UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-{
- UInt32 offset;
- GET_MATCHES_HEADER(3)
- HASH_ZIP_CALC;
- curMatch = p->hash[hashValue];
- p->hash[hashValue] = p->pos;
- offset = 0;
- GET_MATCHES_FOOTER(offset, 2)
-}
-
-static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-{
- UInt32 hash2Value, delta2, maxLen, offset;
- GET_MATCHES_HEADER(3)
-
- HASH3_CALC;
-
- delta2 = p->pos - p->hash[hash2Value];
- curMatch = p->hash[kFix3HashSize + hashValue];
-
- p->hash[hash2Value] =
- p->hash[kFix3HashSize + hashValue] = p->pos;
-
-
- maxLen = 2;
- offset = 0;
- if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
- {
- for (; maxLen != lenLimit; maxLen++)
- if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
- break;
- distances[0] = maxLen;
- distances[1] = delta2 - 1;
- offset = 2;
- if (maxLen == lenLimit)
- {
- SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
- MOVE_POS_RET;
- }
- }
- GET_MATCHES_FOOTER(offset, maxLen)
-}
-
-static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-{
- UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
- GET_MATCHES_HEADER(4)
-
- HASH4_CALC;
-
- delta2 = p->pos - p->hash[ hash2Value];
- delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
- curMatch = p->hash[kFix4HashSize + hashValue];
-
- p->hash[ hash2Value] =
- p->hash[kFix3HashSize + hash3Value] =
- p->hash[kFix4HashSize + hashValue] = p->pos;
-
- maxLen = 1;
- offset = 0;
- if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
- {
- distances[0] = maxLen = 2;
- distances[1] = delta2 - 1;
- offset = 2;
- }
- if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
- {
- maxLen = 3;
- distances[offset + 1] = delta3 - 1;
- offset += 2;
- delta2 = delta3;
- }
- if (offset != 0)
- {
- for (; maxLen != lenLimit; maxLen++)
- if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
- break;
- distances[offset - 2] = maxLen;
- if (maxLen == lenLimit)
- {
- SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
- MOVE_POS_RET;
- }
- }
- if (maxLen < 3)
- maxLen = 3;
- GET_MATCHES_FOOTER(offset, maxLen)
-}
-
-static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-{
- UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
- GET_MATCHES_HEADER(4)
-
- HASH4_CALC;
-
- delta2 = p->pos - p->hash[ hash2Value];
- delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
- curMatch = p->hash[kFix4HashSize + hashValue];
-
- p->hash[ hash2Value] =
- p->hash[kFix3HashSize + hash3Value] =
- p->hash[kFix4HashSize + hashValue] = p->pos;
-
- maxLen = 1;
- offset = 0;
- if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
- {
- distances[0] = maxLen = 2;
- distances[1] = delta2 - 1;
- offset = 2;
- }
- if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
- {
- maxLen = 3;
- distances[offset + 1] = delta3 - 1;
- offset += 2;
- delta2 = delta3;
- }
- if (offset != 0)
- {
- for (; maxLen != lenLimit; maxLen++)
- if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
- break;
- distances[offset - 2] = maxLen;
- if (maxLen == lenLimit)
- {
- p->son[p->cyclicBufferPos] = curMatch;
- MOVE_POS_RET;
- }
- }
- if (maxLen < 3)
- maxLen = 3;
- offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
- distances + offset, maxLen) - (distances));
- MOVE_POS_RET
-}
-
-UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-{
- UInt32 offset;
- GET_MATCHES_HEADER(3)
- HASH_ZIP_CALC;
- curMatch = p->hash[hashValue];
- p->hash[hashValue] = p->pos;
- offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
- distances, 2) - (distances));
- MOVE_POS_RET
-}
-
-static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-{
- do
- {
- SKIP_HEADER(2)
- HASH2_CALC;
- curMatch = p->hash[hashValue];
- p->hash[hashValue] = p->pos;
- SKIP_FOOTER
- }
- while (--num != 0);
-}
-
-void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-{
- do
- {
- SKIP_HEADER(3)
- HASH_ZIP_CALC;
- curMatch = p->hash[hashValue];
- p->hash[hashValue] = p->pos;
- SKIP_FOOTER
- }
- while (--num != 0);
-}
-
-static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-{
- do
- {
- UInt32 hash2Value;
- SKIP_HEADER(3)
- HASH3_CALC;
- curMatch = p->hash[kFix3HashSize + hashValue];
- p->hash[hash2Value] =
- p->hash[kFix3HashSize + hashValue] = p->pos;
- SKIP_FOOTER
- }
- while (--num != 0);
-}
-
-static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-{
- do
- {
- UInt32 hash2Value, hash3Value;
- SKIP_HEADER(4)
- HASH4_CALC;
- curMatch = p->hash[kFix4HashSize + hashValue];
- p->hash[ hash2Value] =
- p->hash[kFix3HashSize + hash3Value] = p->pos;
- p->hash[kFix4HashSize + hashValue] = p->pos;
- SKIP_FOOTER
- }
- while (--num != 0);
-}
-
-static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-{
- do
- {
- UInt32 hash2Value, hash3Value;
- SKIP_HEADER(4)
- HASH4_CALC;
- curMatch = p->hash[kFix4HashSize + hashValue];
- p->hash[ hash2Value] =
- p->hash[kFix3HashSize + hash3Value] =
- p->hash[kFix4HashSize + hashValue] = p->pos;
- p->son[p->cyclicBufferPos] = curMatch;
- MOVE_POS
- }
- while (--num != 0);
-}
-
-void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-{
- do
- {
- SKIP_HEADER(3)
- HASH_ZIP_CALC;
- curMatch = p->hash[hashValue];
- p->hash[hashValue] = p->pos;
- p->son[p->cyclicBufferPos] = curMatch;
- MOVE_POS
- }
- while (--num != 0);
-}
-
-void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
-{
- vTable->Init = (Mf_Init_Func)MatchFinder_Init;
- vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte;
- vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
- vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
- if (!p->btMode)
- {
- vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
- vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
- }
- else if (p->numHashBytes == 2)
- {
- vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
- vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
- }
- else if (p->numHashBytes == 3)
- {
- vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
- vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
- }
- else
- {
- vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
- vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
- }
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_LzFind.h b/Libraries/crunch-ea9b8d/crnlib/lzma_LzFind.h
deleted file mode 100644
index e5550e47..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_LzFind.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* LzFind.h -- Match finder for LZ algorithms
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __LZFIND_H
-#define __LZFIND_H
-
-#include "lzma_Types.h"
-
-namespace crnlib {
-
-typedef UInt32 CLzRef;
-
-typedef struct _CMatchFinder
-{
- Byte *buffer;
- UInt32 pos;
- UInt32 posLimit;
- UInt32 streamPos;
- UInt32 lenLimit;
-
- UInt32 cyclicBufferPos;
- UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
-
- UInt32 matchMaxLen;
- CLzRef *hash;
- CLzRef *son;
- UInt32 hashMask;
- UInt32 cutValue;
-
- Byte *bufferBase;
- ISeqInStream *stream;
- int streamEndWasReached;
-
- UInt32 blockSize;
- UInt32 keepSizeBefore;
- UInt32 keepSizeAfter;
-
- UInt32 numHashBytes;
- int directInput;
- int btMode;
- /* int skipModeBits; */
- int bigHash;
- UInt32 historySize;
- UInt32 fixedHashSize;
- UInt32 hashSizeSum;
- UInt32 numSons;
- SRes result;
- UInt32 crc[256];
-} CMatchFinder;
-
-#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
-#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
-
-#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
-
-int MatchFinder_NeedMove(CMatchFinder *p);
-Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
-void MatchFinder_MoveBlock(CMatchFinder *p);
-void MatchFinder_ReadIfRequired(CMatchFinder *p);
-
-void MatchFinder_Construct(CMatchFinder *p);
-
-/* Conditions:
- historySize <= 3 GB
- keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
-*/
-int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
- UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
- ISzAlloc *alloc);
-void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
-void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
-void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
-
-UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
- UInt32 *distances, UInt32 maxLen);
-
-/*
-Conditions:
- Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
- Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
-*/
-
-typedef void (*Mf_Init_Func)(void *object);
-typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
-typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
-typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
-typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
-typedef void (*Mf_Skip_Func)(void *object, UInt32);
-
-typedef struct _IMatchFinder
-{
- Mf_Init_Func Init;
- Mf_GetIndexByte_Func GetIndexByte;
- Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
- Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
- Mf_GetMatches_Func GetMatches;
- Mf_Skip_Func Skip;
-} IMatchFinder;
-
-void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
-
-void MatchFinder_Init(CMatchFinder *p);
-UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
-UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
-void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
-void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
-
-}
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_LzFindMt.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_LzFindMt.cpp
deleted file mode 100644
index d1451a02..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_LzFindMt.cpp
+++ /dev/null
@@ -1,797 +0,0 @@
-/* LzFindMt.c -- multithreaded Match finder for LZ algorithms
-2008-10-04 : Igor Pavlov : Public domain */
-#include "crn_core.h"
-#include "lzma_LzHash.h"
-
-#include "lzma_LzFindMt.h"
-
-namespace crnlib {
-
-void MtSync_Construct(CMtSync *p)
-{
- p->wasCreated = False;
- p->csWasInitialized = False;
- p->csWasEntered = False;
- Thread_Construct(&p->thread);
- Event_Construct(&p->canStart);
- Event_Construct(&p->wasStarted);
- Event_Construct(&p->wasStopped);
- Semaphore_Construct(&p->freeSemaphore);
- Semaphore_Construct(&p->filledSemaphore);
-}
-
-void MtSync_GetNextBlock(CMtSync *p)
-{
- if (p->needStart)
- {
- p->numProcessedBlocks = 1;
- p->needStart = False;
- p->stopWriting = False;
- p->exit = False;
- Event_Reset(&p->wasStarted);
- Event_Reset(&p->wasStopped);
-
- Event_Set(&p->canStart);
- Event_Wait(&p->wasStarted);
- }
- else
- {
- CriticalSection_Leave(&p->cs);
- p->csWasEntered = False;
- p->numProcessedBlocks++;
- Semaphore_Release1(&p->freeSemaphore);
- }
- Semaphore_Wait(&p->filledSemaphore);
- CriticalSection_Enter(&p->cs);
- p->csWasEntered = True;
-}
-
-/* MtSync_StopWriting must be called if Writing was started */
-
-void MtSync_StopWriting(CMtSync *p)
-{
- UInt32 myNumBlocks = p->numProcessedBlocks;
- if (!Thread_WasCreated(&p->thread) || p->needStart)
- return;
- p->stopWriting = True;
- if (p->csWasEntered)
- {
- CriticalSection_Leave(&p->cs);
- p->csWasEntered = False;
- }
- Semaphore_Release1(&p->freeSemaphore);
-
- Event_Wait(&p->wasStopped);
-
- while (myNumBlocks++ != p->numProcessedBlocks)
- {
- Semaphore_Wait(&p->filledSemaphore);
- Semaphore_Release1(&p->freeSemaphore);
- }
- p->needStart = True;
-}
-
-void MtSync_Destruct(CMtSync *p)
-{
- if (Thread_WasCreated(&p->thread))
- {
- MtSync_StopWriting(p);
- p->exit = True;
- if (p->needStart)
- Event_Set(&p->canStart);
- Thread_Wait(&p->thread);
- Thread_Close(&p->thread);
- }
- if (p->csWasInitialized)
- {
- CriticalSection_Delete(&p->cs);
- p->csWasInitialized = False;
- }
-
- Event_Close(&p->canStart);
- Event_Close(&p->wasStarted);
- Event_Close(&p->wasStopped);
- Semaphore_Close(&p->freeSemaphore);
- Semaphore_Close(&p->filledSemaphore);
-
- p->wasCreated = False;
-}
-
-#define RINOK_THREAD(x) { if ((x) != 0) return SZ_ERROR_THREAD; }
-
-static SRes MtSync_Create2(CMtSync *p, unsigned (MY_STD_CALL *startAddress)(void *), void *obj, UInt32 numBlocks)
-{
- if (p->wasCreated)
- return SZ_OK;
-
- RINOK_THREAD(CriticalSection_Init(&p->cs));
- p->csWasInitialized = True;
-
- RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canStart));
- RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStarted));
- RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStopped));
-
- RINOK_THREAD(Semaphore_Create(&p->freeSemaphore, numBlocks, numBlocks));
- RINOK_THREAD(Semaphore_Create(&p->filledSemaphore, 0, numBlocks));
-
- p->needStart = True;
-
- RINOK_THREAD(Thread_Create(&p->thread, startAddress, obj));
- p->wasCreated = True;
- return SZ_OK;
-}
-
-static SRes MtSync_Create(CMtSync *p, unsigned (MY_STD_CALL *startAddress)(void *), void *obj, UInt32 numBlocks)
-{
- SRes res = MtSync_Create2(p, startAddress, obj, numBlocks);
- if (res != SZ_OK)
- MtSync_Destruct(p);
- return res;
-}
-
-void MtSync_Init(CMtSync *p) { p->needStart = True; }
-
-#define kMtMaxValForNormalize 0xFFFFFFFF
-
-#define DEF_GetHeads2(name, v, action) \
-static void GetHeads ## name(const Byte *p, UInt32 pos, \
-UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc) \
-{ action; for (; numHeads != 0; numHeads--) { \
-const UInt32 value = (v); p++; *heads++ = pos - hash[value]; hash[value] = pos++; } }
-
-#define DEF_GetHeads(name, v) DEF_GetHeads2(name, v, ;)
-
-DEF_GetHeads2(2, (p[0] | ((UInt32)p[1] << 8)), hashMask = hashMask; crc = crc; )
-DEF_GetHeads(3, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8)) & hashMask)
-DEF_GetHeads(4, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ (crc[p[3]] << 5)) & hashMask)
-DEF_GetHeads(4b, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ ((UInt32)p[3] << 16)) & hashMask)
-//DEF_GetHeads(5, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ (crc[p[3]] << 5) ^ (crc[p[4]] << 3)) & hashMask)
-
-void HashThreadFunc(CMatchFinderMt *mt)
-{
- CMtSync *p = &mt->hashSync;
- for (;;)
- {
- UInt32 numProcessedBlocks = 0;
- Event_Wait(&p->canStart);
- Event_Set(&p->wasStarted);
- for (;;)
- {
- if (p->exit)
- return;
- if (p->stopWriting)
- {
- p->numProcessedBlocks = numProcessedBlocks;
- Event_Set(&p->wasStopped);
- break;
- }
-
- {
- CMatchFinder *mf = mt->MatchFinder;
- if (MatchFinder_NeedMove(mf))
- {
- CriticalSection_Enter(&mt->btSync.cs);
- CriticalSection_Enter(&mt->hashSync.cs);
- {
- const Byte *beforePtr = MatchFinder_GetPointerToCurrentPos(mf);
- const Byte *afterPtr;
- MatchFinder_MoveBlock(mf);
- afterPtr = MatchFinder_GetPointerToCurrentPos(mf);
- mt->pointerToCurPos -= beforePtr - afterPtr;
- mt->buffer -= beforePtr - afterPtr;
- }
- CriticalSection_Leave(&mt->btSync.cs);
- CriticalSection_Leave(&mt->hashSync.cs);
- continue;
- }
-
- Semaphore_Wait(&p->freeSemaphore);
-
- MatchFinder_ReadIfRequired(mf);
- if (mf->pos > (kMtMaxValForNormalize - kMtHashBlockSize))
- {
- UInt32 subValue = (mf->pos - mf->historySize - 1);
- MatchFinder_ReduceOffsets(mf, subValue);
- MatchFinder_Normalize3(subValue, mf->hash + mf->fixedHashSize, mf->hashMask + 1);
- }
- {
- UInt32 *heads = mt->hashBuf + ((numProcessedBlocks++) & kMtHashNumBlocksMask) * kMtHashBlockSize;
- UInt32 num = mf->streamPos - mf->pos;
- heads[0] = 2;
- heads[1] = num;
- if (num >= mf->numHashBytes)
- {
- num = num - mf->numHashBytes + 1;
- if (num > kMtHashBlockSize - 2)
- num = kMtHashBlockSize - 2;
- mt->GetHeadsFunc(mf->buffer, mf->pos, mf->hash + mf->fixedHashSize, mf->hashMask, heads + 2, num, mf->crc);
- heads[0] += num;
- }
- mf->pos += num;
- mf->buffer += num;
- }
- }
-
- Semaphore_Release1(&p->filledSemaphore);
- }
- }
-}
-
-void MatchFinderMt_GetNextBlock_Hash(CMatchFinderMt *p)
-{
- MtSync_GetNextBlock(&p->hashSync);
- p->hashBufPosLimit = p->hashBufPos = ((p->hashSync.numProcessedBlocks - 1) & kMtHashNumBlocksMask) * kMtHashBlockSize;
- p->hashBufPosLimit += p->hashBuf[p->hashBufPos++];
- p->hashNumAvail = p->hashBuf[p->hashBufPos++];
-}
-
-#define kEmptyHashValue 0
-
-/* #define MFMT_GM_INLINE */
-
-#ifdef MFMT_GM_INLINE
-
-#define NO_INLINE MY_FAST_CALL
-
-Int32 NO_INLINE GetMatchesSpecN(UInt32 lenLimit, UInt32 pos, const Byte *cur, CLzRef *son,
- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
- UInt32 *_distances, UInt32 _maxLen, const UInt32 *hash, Int32 limit, UInt32 size, UInt32 *posRes)
-{
- do
- {
- UInt32 *distances = _distances + 1;
- UInt32 curMatch = pos - *hash++;
-
- CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
- CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
- UInt32 len0 = 0, len1 = 0;
- UInt32 cutValue = _cutValue;
- UInt32 maxLen = _maxLen;
- for (;;)
- {
- UInt32 delta = pos - curMatch;
- if (cutValue-- == 0 || delta >= _cyclicBufferSize)
- {
- *ptr0 = *ptr1 = kEmptyHashValue;
- break;
- }
- {
- CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
- const Byte *pb = cur - delta;
- UInt32 len = (len0 < len1 ? len0 : len1);
- if (pb[len] == cur[len])
- {
- if (++len != lenLimit && pb[len] == cur[len])
- while (++len != lenLimit)
- if (pb[len] != cur[len])
- break;
- if (maxLen < len)
- {
- *distances++ = maxLen = len;
- *distances++ = delta - 1;
- if (len == lenLimit)
- {
- *ptr1 = pair[0];
- *ptr0 = pair[1];
- break;
- }
- }
- }
- if (pb[len] < cur[len])
- {
- *ptr1 = curMatch;
- ptr1 = pair + 1;
- curMatch = *ptr1;
- len1 = len;
- }
- else
- {
- *ptr0 = curMatch;
- ptr0 = pair;
- curMatch = *ptr0;
- len0 = len;
- }
- }
- }
- pos++;
- _cyclicBufferPos++;
- cur++;
- {
- UInt32 num = (UInt32)(distances - _distances);
- *_distances = num - 1;
- _distances += num;
- limit -= num;
- }
- }
- while (limit > 0 && --size != 0);
- *posRes = pos;
- return limit;
-}
-
-#endif
-
-void BtGetMatches(CMatchFinderMt *p, UInt32 *distances)
-{
- UInt32 numProcessed = 0;
- UInt32 curPos = 2;
- UInt32 limit = kMtBtBlockSize - (p->matchMaxLen * 2);
- distances[1] = p->hashNumAvail;
- while (curPos < limit)
- {
- if (p->hashBufPos == p->hashBufPosLimit)
- {
- MatchFinderMt_GetNextBlock_Hash(p);
- distances[1] = numProcessed + p->hashNumAvail;
- if (p->hashNumAvail >= p->numHashBytes)
- continue;
- for (; p->hashNumAvail != 0; p->hashNumAvail--)
- distances[curPos++] = 0;
- break;
- }
- {
- UInt32 size = p->hashBufPosLimit - p->hashBufPos;
- UInt32 lenLimit = p->matchMaxLen;
- UInt32 pos = p->pos;
- UInt32 cyclicBufferPos = p->cyclicBufferPos;
- if (lenLimit >= p->hashNumAvail)
- lenLimit = p->hashNumAvail;
- {
- UInt32 size2 = p->hashNumAvail - lenLimit + 1;
- if (size2 < size)
- size = size2;
- size2 = p->cyclicBufferSize - cyclicBufferPos;
- if (size2 < size)
- size = size2;
- }
- #ifndef MFMT_GM_INLINE
- while (curPos < limit && size-- != 0)
- {
- UInt32 *startDistances = distances + curPos;
- UInt32 num = (UInt32)(GetMatchesSpec1(lenLimit, pos - p->hashBuf[p->hashBufPos++],
- pos, p->buffer, p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue,
- startDistances + 1, p->numHashBytes - 1) - startDistances);
- *startDistances = num - 1;
- curPos += num;
- cyclicBufferPos++;
- pos++;
- p->buffer++;
- }
- #else
- {
- UInt32 posRes;
- curPos = limit - GetMatchesSpecN(lenLimit, pos, p->buffer, p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue,
- distances + curPos, p->numHashBytes - 1, p->hashBuf + p->hashBufPos, (Int32)(limit - curPos) , size, &posRes);
- p->hashBufPos += posRes - pos;
- cyclicBufferPos += posRes - pos;
- p->buffer += posRes - pos;
- pos = posRes;
- }
- #endif
-
- numProcessed += pos - p->pos;
- p->hashNumAvail -= pos - p->pos;
- p->pos = pos;
- if (cyclicBufferPos == p->cyclicBufferSize)
- cyclicBufferPos = 0;
- p->cyclicBufferPos = cyclicBufferPos;
- }
- }
- distances[0] = curPos;
-}
-
-void BtFillBlock(CMatchFinderMt *p, UInt32 globalBlockIndex)
-{
- CMtSync *sync = &p->hashSync;
- if (!sync->needStart)
- {
- CriticalSection_Enter(&sync->cs);
- sync->csWasEntered = True;
- }
-
- BtGetMatches(p, p->btBuf + (globalBlockIndex & kMtBtNumBlocksMask) * kMtBtBlockSize);
-
- if (p->pos > kMtMaxValForNormalize - kMtBtBlockSize)
- {
- UInt32 subValue = p->pos - p->cyclicBufferSize;
- MatchFinder_Normalize3(subValue, p->son, p->cyclicBufferSize * 2);
- p->pos -= subValue;
- }
-
- if (!sync->needStart)
- {
- CriticalSection_Leave(&sync->cs);
- sync->csWasEntered = False;
- }
-}
-
-void BtThreadFunc(CMatchFinderMt *mt)
-{
- CMtSync *p = &mt->btSync;
- for (;;)
- {
- UInt32 blockIndex = 0;
- Event_Wait(&p->canStart);
- Event_Set(&p->wasStarted);
- for (;;)
- {
- if (p->exit)
- return;
- if (p->stopWriting)
- {
- p->numProcessedBlocks = blockIndex;
- MtSync_StopWriting(&mt->hashSync);
- Event_Set(&p->wasStopped);
- break;
- }
- Semaphore_Wait(&p->freeSemaphore);
- BtFillBlock(mt, blockIndex++);
- Semaphore_Release1(&p->filledSemaphore);
- }
- }
-}
-
-void MatchFinderMt_Construct(CMatchFinderMt *p)
-{
- p->hashBuf = 0;
- MtSync_Construct(&p->hashSync);
- MtSync_Construct(&p->btSync);
-}
-
-void MatchFinderMt_FreeMem(CMatchFinderMt *p, ISzAlloc *alloc)
-{
- alloc->Free(alloc, p->hashBuf);
- p->hashBuf = 0;
-}
-
-void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAlloc *alloc)
-{
- MtSync_Destruct(&p->hashSync);
- MtSync_Destruct(&p->btSync);
- MatchFinderMt_FreeMem(p, alloc);
-}
-
-#define kHashBufferSize (kMtHashBlockSize * kMtHashNumBlocks)
-#define kBtBufferSize (kMtBtBlockSize * kMtBtNumBlocks)
-
-static unsigned MY_STD_CALL HashThreadFunc2(void *p) { HashThreadFunc((CMatchFinderMt *)p); return 0; }
-static unsigned MY_STD_CALL BtThreadFunc2(void *p)
-{
- Byte allocaDummy[0x180]; (void)allocaDummy;
- int i = 0;
- for (i = 0; i < 16; i++)
- allocaDummy[i] = (Byte)i;
- BtThreadFunc((CMatchFinderMt *)p);
- return 0;
-}
-
-SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,
- UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc)
-{
- CMatchFinder *mf = p->MatchFinder;
- p->historySize = historySize;
- if (kMtBtBlockSize <= matchMaxLen * 4)
- return SZ_ERROR_PARAM;
- if (p->hashBuf == 0)
- {
- p->hashBuf = (UInt32 *)alloc->Alloc(alloc, (kHashBufferSize + kBtBufferSize) * sizeof(UInt32));
- if (p->hashBuf == 0)
- return SZ_ERROR_MEM;
- p->btBuf = p->hashBuf + kHashBufferSize;
- }
- keepAddBufferBefore += (kHashBufferSize + kBtBufferSize);
- keepAddBufferAfter += kMtHashBlockSize;
- if (!MatchFinder_Create(mf, historySize, keepAddBufferBefore, matchMaxLen, keepAddBufferAfter, alloc))
- return SZ_ERROR_MEM;
-
- RINOK(MtSync_Create(&p->hashSync, HashThreadFunc2, p, kMtHashNumBlocks));
- RINOK(MtSync_Create(&p->btSync, BtThreadFunc2, p, kMtBtNumBlocks));
- return SZ_OK;
-}
-
-/* Call it after ReleaseStream / SetStream */
-void MatchFinderMt_Init(CMatchFinderMt *p)
-{
- CMatchFinder *mf = p->MatchFinder;
- p->btBufPos = p->btBufPosLimit = 0;
- p->hashBufPos = p->hashBufPosLimit = 0;
- MatchFinder_Init(mf);
- p->pointerToCurPos = MatchFinder_GetPointerToCurrentPos(mf);
- p->btNumAvailBytes = 0;
- p->lzPos = p->historySize + 1;
-
- p->hash = mf->hash;
- p->fixedHashSize = mf->fixedHashSize;
- p->crc = mf->crc;
-
- p->son = mf->son;
- p->matchMaxLen = mf->matchMaxLen;
- p->numHashBytes = mf->numHashBytes;
- p->pos = mf->pos;
- p->buffer = mf->buffer;
- p->cyclicBufferPos = mf->cyclicBufferPos;
- p->cyclicBufferSize = mf->cyclicBufferSize;
- p->cutValue = mf->cutValue;
-}
-
-/* ReleaseStream is required to finish multithreading */
-void MatchFinderMt_ReleaseStream(CMatchFinderMt *p)
-{
- MtSync_StopWriting(&p->btSync);
- /* p->MatchFinder->ReleaseStream(); */
-}
-
-void MatchFinderMt_Normalize(CMatchFinderMt *p)
-{
- MatchFinder_Normalize3(p->lzPos - p->historySize - 1, p->hash, p->fixedHashSize);
- p->lzPos = p->historySize + 1;
-}
-
-void MatchFinderMt_GetNextBlock_Bt(CMatchFinderMt *p)
-{
- UInt32 blockIndex;
- MtSync_GetNextBlock(&p->btSync);
- blockIndex = ((p->btSync.numProcessedBlocks - 1) & kMtBtNumBlocksMask);
- p->btBufPosLimit = p->btBufPos = blockIndex * kMtBtBlockSize;
- p->btBufPosLimit += p->btBuf[p->btBufPos++];
- p->btNumAvailBytes = p->btBuf[p->btBufPos++];
- if (p->lzPos >= kMtMaxValForNormalize - kMtBtBlockSize)
- MatchFinderMt_Normalize(p);
-}
-
-const Byte * MatchFinderMt_GetPointerToCurrentPos(CMatchFinderMt *p)
-{
- return p->pointerToCurPos;
-}
-
-#define GET_NEXT_BLOCK_IF_REQUIRED if (p->btBufPos == p->btBufPosLimit) MatchFinderMt_GetNextBlock_Bt(p);
-
-UInt32 MatchFinderMt_GetNumAvailableBytes(CMatchFinderMt *p)
-{
- GET_NEXT_BLOCK_IF_REQUIRED;
- return p->btNumAvailBytes;
-}
-
-Byte MatchFinderMt_GetIndexByte(CMatchFinderMt *p, Int32 index)
-{
- return p->pointerToCurPos[index];
-}
-
-UInt32 * MixMatches2(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
-{
- UInt32 hash2Value, curMatch2;
- UInt32 *hash = p->hash;
- const Byte *cur = p->pointerToCurPos;
- UInt32 lzPos = p->lzPos;
- MT_HASH2_CALC
-
- curMatch2 = hash[hash2Value];
- hash[hash2Value] = lzPos;
-
- if (curMatch2 >= matchMinPos)
- if (cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
- {
- *distances++ = 2;
- *distances++ = lzPos - curMatch2 - 1;
- }
- return distances;
-}
-
-UInt32 * MixMatches3(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
-{
- UInt32 hash2Value, hash3Value, curMatch2, curMatch3;
- UInt32 *hash = p->hash;
- const Byte *cur = p->pointerToCurPos;
- UInt32 lzPos = p->lzPos;
- MT_HASH3_CALC
-
- curMatch2 = hash[ hash2Value];
- curMatch3 = hash[kFix3HashSize + hash3Value];
-
- hash[ hash2Value] =
- hash[kFix3HashSize + hash3Value] =
- lzPos;
-
- if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
- {
- distances[1] = lzPos - curMatch2 - 1;
- if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2])
- {
- distances[0] = 3;
- return distances + 2;
- }
- distances[0] = 2;
- distances += 2;
- }
- if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0])
- {
- *distances++ = 3;
- *distances++ = lzPos - curMatch3 - 1;
- }
- return distances;
-}
-
-/*
-UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
-{
- UInt32 hash2Value, hash3Value, hash4Value, curMatch2, curMatch3, curMatch4;
- UInt32 *hash = p->hash;
- const Byte *cur = p->pointerToCurPos;
- UInt32 lzPos = p->lzPos;
- MT_HASH4_CALC
-
- curMatch2 = hash[ hash2Value];
- curMatch3 = hash[kFix3HashSize + hash3Value];
- curMatch4 = hash[kFix4HashSize + hash4Value];
-
- hash[ hash2Value] =
- hash[kFix3HashSize + hash3Value] =
- hash[kFix4HashSize + hash4Value] =
- lzPos;
-
- if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
- {
- distances[1] = lzPos - curMatch2 - 1;
- if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2])
- {
- distances[0] = (cur[(ptrdiff_t)curMatch2 - lzPos + 3] == cur[3]) ? 4 : 3;
- return distances + 2;
- }
- distances[0] = 2;
- distances += 2;
- }
- if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0])
- {
- distances[1] = lzPos - curMatch3 - 1;
- if (cur[(ptrdiff_t)curMatch3 - lzPos + 3] == cur[3])
- {
- distances[0] = 4;
- return distances + 2;
- }
- distances[0] = 3;
- distances += 2;
- }
-
- if (curMatch4 >= matchMinPos)
- if (
- cur[(ptrdiff_t)curMatch4 - lzPos] == cur[0] &&
- cur[(ptrdiff_t)curMatch4 - lzPos + 3] == cur[3]
- )
- {
- *distances++ = 4;
- *distances++ = lzPos - curMatch4 - 1;
- }
- return distances;
-}
-*/
-
-#define INCREASE_LZ_POS p->lzPos++; p->pointerToCurPos++;
-
-UInt32 MatchFinderMt2_GetMatches(CMatchFinderMt *p, UInt32 *distances)
-{
- const UInt32 *btBuf = p->btBuf + p->btBufPos;
- UInt32 len = *btBuf++;
- p->btBufPos += 1 + len;
- p->btNumAvailBytes--;
- {
- UInt32 i;
- for (i = 0; i < len; i += 2)
- {
- *distances++ = *btBuf++;
- *distances++ = *btBuf++;
- }
- }
- INCREASE_LZ_POS
- return len;
-}
-
-UInt32 MatchFinderMt_GetMatches(CMatchFinderMt *p, UInt32 *distances)
-{
- const UInt32 *btBuf = p->btBuf + p->btBufPos;
- UInt32 len = *btBuf++;
- p->btBufPos += 1 + len;
-
- if (len == 0)
- {
- if (p->btNumAvailBytes-- >= 4)
- len = (UInt32)(p->MixMatchesFunc(p, p->lzPos - p->historySize, distances) - (distances));
- }
- else
- {
- /* Condition: there are matches in btBuf with length < p->numHashBytes */
- UInt32 *distances2;
- p->btNumAvailBytes--;
- distances2 = p->MixMatchesFunc(p, p->lzPos - btBuf[1], distances);
- do
- {
- *distances2++ = *btBuf++;
- *distances2++ = *btBuf++;
- }
- while ((len -= 2) != 0);
- len = (UInt32)(distances2 - (distances));
- }
- INCREASE_LZ_POS
- return len;
-}
-
-#define SKIP_HEADER2 do { GET_NEXT_BLOCK_IF_REQUIRED
-#define SKIP_HEADER(n) SKIP_HEADER2 if (p->btNumAvailBytes-- >= (n)) { const Byte *cur = p->pointerToCurPos; UInt32 *hash = p->hash;
-#define SKIP_FOOTER } INCREASE_LZ_POS p->btBufPos += p->btBuf[p->btBufPos] + 1; } while (--num != 0);
-
-void MatchFinderMt0_Skip(CMatchFinderMt *p, UInt32 num)
-{
- SKIP_HEADER2 { p->btNumAvailBytes--;
- SKIP_FOOTER
-}
-
-void MatchFinderMt2_Skip(CMatchFinderMt *p, UInt32 num)
-{
- SKIP_HEADER(2)
- UInt32 hash2Value;
- MT_HASH2_CALC
- hash[hash2Value] = p->lzPos;
- SKIP_FOOTER
-}
-
-void MatchFinderMt3_Skip(CMatchFinderMt *p, UInt32 num)
-{
- SKIP_HEADER(3)
- UInt32 hash2Value, hash3Value;
- MT_HASH3_CALC
- hash[kFix3HashSize + hash3Value] =
- hash[ hash2Value] =
- p->lzPos;
- SKIP_FOOTER
-}
-
-/*
-void MatchFinderMt4_Skip(CMatchFinderMt *p, UInt32 num)
-{
- SKIP_HEADER(4)
- UInt32 hash2Value, hash3Value, hash4Value;
- MT_HASH4_CALC
- hash[kFix4HashSize + hash4Value] =
- hash[kFix3HashSize + hash3Value] =
- hash[ hash2Value] =
- p->lzPos;
- SKIP_FOOTER
-}
-*/
-
-void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable)
-{
- vTable->Init = (Mf_Init_Func)MatchFinderMt_Init;
- vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinderMt_GetIndexByte;
- vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinderMt_GetNumAvailableBytes;
- vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinderMt_GetPointerToCurrentPos;
- vTable->GetMatches = (Mf_GetMatches_Func)MatchFinderMt_GetMatches;
- switch(p->MatchFinder->numHashBytes)
- {
- case 2:
- p->GetHeadsFunc = GetHeads2;
- p->MixMatchesFunc = (Mf_Mix_Matches)0;
- vTable->Skip = (Mf_Skip_Func)MatchFinderMt0_Skip;
- vTable->GetMatches = (Mf_GetMatches_Func)MatchFinderMt2_GetMatches;
- break;
- case 3:
- p->GetHeadsFunc = GetHeads3;
- p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches2;
- vTable->Skip = (Mf_Skip_Func)MatchFinderMt2_Skip;
- break;
- default:
- /* case 4: */
- p->GetHeadsFunc = p->MatchFinder->bigHash ? GetHeads4b : GetHeads4;
- /* p->GetHeadsFunc = GetHeads4; */
- p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches3;
- vTable->Skip = (Mf_Skip_Func)MatchFinderMt3_Skip;
- break;
- /*
- default:
- p->GetHeadsFunc = GetHeads5;
- p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches4;
- vTable->Skip = (Mf_Skip_Func)MatchFinderMt4_Skip;
- break;
- */
- }
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_LzFindMt.h b/Libraries/crunch-ea9b8d/crnlib/lzma_LzFindMt.h
deleted file mode 100644
index b815d739..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_LzFindMt.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* LzFindMt.h -- multithreaded Match finder for LZ algorithms
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __LZFINDMT_H
-#define __LZFINDMT_H
-
-#include "lzma_Threads.h"
-#include "lzma_LzFind.h"
-
-namespace crnlib {
-
-#define kMtHashBlockSize (1 << 13)
-#define kMtHashNumBlocks (1 << 3)
-#define kMtHashNumBlocksMask (kMtHashNumBlocks - 1)
-
-#define kMtBtBlockSize (1 << 14)
-#define kMtBtNumBlocks (1 << 6)
-#define kMtBtNumBlocksMask (kMtBtNumBlocks - 1)
-
-typedef struct _CMtSync
-{
- Bool wasCreated;
- Bool needStart;
- Bool exit;
- Bool stopWriting;
-
- CThread thread;
- CAutoResetEvent canStart;
- CAutoResetEvent wasStarted;
- CAutoResetEvent wasStopped;
- CSemaphore freeSemaphore;
- CSemaphore filledSemaphore;
- Bool csWasInitialized;
- Bool csWasEntered;
- CCriticalSection cs;
- UInt32 numProcessedBlocks;
-} CMtSync;
-
-typedef UInt32 * (*Mf_Mix_Matches)(void *p, UInt32 matchMinPos, UInt32 *distances);
-
-/* kMtCacheLineDummy must be >= size_of_CPU_cache_line */
-#define kMtCacheLineDummy 128
-
-typedef void (*Mf_GetHeads)(const Byte *buffer, UInt32 pos,
- UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc);
-
-typedef struct _CMatchFinderMt
-{
- /* LZ */
- const Byte *pointerToCurPos;
- UInt32 *btBuf;
- UInt32 btBufPos;
- UInt32 btBufPosLimit;
- UInt32 lzPos;
- UInt32 btNumAvailBytes;
-
- UInt32 *hash;
- UInt32 fixedHashSize;
- UInt32 historySize;
- const UInt32 *crc;
-
- Mf_Mix_Matches MixMatchesFunc;
-
- /* LZ + BT */
- CMtSync btSync;
- Byte btDummy[kMtCacheLineDummy];
-
- /* BT */
- UInt32 *hashBuf;
- UInt32 hashBufPos;
- UInt32 hashBufPosLimit;
- UInt32 hashNumAvail;
-
- CLzRef *son;
- UInt32 matchMaxLen;
- UInt32 numHashBytes;
- UInt32 pos;
- Byte *buffer;
- UInt32 cyclicBufferPos;
- UInt32 cyclicBufferSize; /* it must be historySize + 1 */
- UInt32 cutValue;
-
- /* BT + Hash */
- CMtSync hashSync;
- /* Byte hashDummy[kMtCacheLineDummy]; */
-
- /* Hash */
- Mf_GetHeads GetHeadsFunc;
- CMatchFinder *MatchFinder;
-} CMatchFinderMt;
-
-void MatchFinderMt_Construct(CMatchFinderMt *p);
-void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAlloc *alloc);
-SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,
- UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc);
-void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable);
-void MatchFinderMt_ReleaseStream(CMatchFinderMt *p);
-
-}
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_LzHash.h b/Libraries/crunch-ea9b8d/crnlib/lzma_LzHash.h
deleted file mode 100644
index c9234175..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_LzHash.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* LzHash.h -- HASH functions for LZ algorithms
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __LZHASH_H
-#define __LZHASH_H
-
-#define kHash2Size (1 << 10)
-#define kHash3Size (1 << 16)
-#define kHash4Size (1 << 20)
-
-#define kFix3HashSize (kHash2Size)
-#define kFix4HashSize (kHash2Size + kHash3Size)
-#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
-
-#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8);
-
-#define HASH3_CALC { \
- UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
- hash2Value = temp & (kHash2Size - 1); \
- hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
-
-#define HASH4_CALC { \
- UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
- hash2Value = temp & (kHash2Size - 1); \
- hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
- hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
-
-#define HASH5_CALC { \
- UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
- hash2Value = temp & (kHash2Size - 1); \
- hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
- hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \
- hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \
- hash4Value &= (kHash4Size - 1); }
-
-/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */
-#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
-
-
-#define MT_HASH2_CALC \
- hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
-
-#define MT_HASH3_CALC { \
- UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
- hash2Value = temp & (kHash2Size - 1); \
- hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
-
-#define MT_HASH4_CALC { \
- UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
- hash2Value = temp & (kHash2Size - 1); \
- hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
- hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaDec.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaDec.cpp
deleted file mode 100644
index fab2ee9a..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaDec.cpp
+++ /dev/null
@@ -1,1011 +0,0 @@
-/* LzmaDec.c -- LZMA Decoder
-2008-11-06 : Igor Pavlov : Public domain */
-#include "crn_core.h"
-#include "lzma_LzmaDec.h"
-
-#include <string.h>
-
-namespace crnlib {
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-#define RC_INIT_SIZE 5
-
-#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
-
-#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
-#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
-#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
-#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
- { UPDATE_0(p); i = (i + i); A0; } else \
- { UPDATE_1(p); i = (i + i) + 1; A1; }
-#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;)
-
-#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); }
-#define TREE_DECODE(probs, limit, i) \
- { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
-
-/* #define _LZMA_SIZE_OPT */
-
-#ifdef _LZMA_SIZE_OPT
-#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
-#else
-#define TREE_6_DECODE(probs, i) \
- { i = 1; \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- i -= 0x40; }
-#endif
-
-#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); }
-
-#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
-#define UPDATE_0_CHECK range = bound;
-#define UPDATE_1_CHECK range -= bound; code -= bound;
-#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
- { UPDATE_0_CHECK; i = (i + i); A0; } else \
- { UPDATE_1_CHECK; i = (i + i) + 1; A1; }
-#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)
-#define TREE_DECODE_CHECK(probs, limit, i) \
- { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
-
-
-#define kNumPosBitsMax 4
-#define kNumPosStatesMax (1 << kNumPosBitsMax)
-
-#define kLenNumLowBits 3
-#define kLenNumLowSymbols (1 << kLenNumLowBits)
-#define kLenNumMidBits 3
-#define kLenNumMidSymbols (1 << kLenNumMidBits)
-#define kLenNumHighBits 8
-#define kLenNumHighSymbols (1 << kLenNumHighBits)
-
-#define LenChoice 0
-#define LenChoice2 (LenChoice + 1)
-#define LenLow (LenChoice2 + 1)
-#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
-#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
-#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
-
-
-#define kNumStates 12
-#define kNumLitStates 7
-
-#define kStartPosModelIndex 4
-#define kEndPosModelIndex 14
-#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
-
-#define kNumPosSlotBits 6
-#define kNumLenToPosStates 4
-
-#define kNumAlignBits 4
-#define kAlignTableSize (1 << kNumAlignBits)
-
-#define kMatchMinLen 2
-#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
-
-#define IsMatch 0
-#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
-#define IsRepG0 (IsRep + kNumStates)
-#define IsRepG1 (IsRepG0 + kNumStates)
-#define IsRepG2 (IsRepG1 + kNumStates)
-#define IsRep0Long (IsRepG2 + kNumStates)
-#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
-#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
-#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
-#define LenCoder (Align + kAlignTableSize)
-#define RepLenCoder (LenCoder + kNumLenProbs)
-#define Literal (RepLenCoder + kNumLenProbs)
-
-#define LZMA_BASE_SIZE 1846
-#define LZMA_LIT_SIZE 768
-
-#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp)))
-
-#if Literal != LZMA_BASE_SIZE
-StopCompilingDueBUG
-#endif
-
-static const Byte kLiteralNextStates[kNumStates * 2] =
-{
- 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5,
- 7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10
-};
-
-#define LZMA_DIC_MIN (1 << 12)
-
-/* First LZMA-symbol is always decoded.
-And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization
-Out:
- Result:
- SZ_OK - OK
- SZ_ERROR_DATA - Error
- p->remainLen:
- < kMatchSpecLenStart : normal remain
- = kMatchSpecLenStart : finished
- = kMatchSpecLenStart + 1 : Flush marker
- = kMatchSpecLenStart + 2 : State Init Marker
-*/
-
-static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
-{
- CLzmaProb *probs = p->probs;
-
- unsigned state = p->state;
- UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3];
- unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1;
- unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1;
- unsigned lc = p->prop.lc;
-
- Byte *dic = p->dic;
- SizeT dicBufSize = p->dicBufSize;
- SizeT dicPos = p->dicPos;
-
- UInt32 processedPos = p->processedPos;
- UInt32 checkDicSize = p->checkDicSize;
- unsigned len = 0;
-
- const Byte *buf = p->buf;
- UInt32 range = p->range;
- UInt32 code = p->code;
-
- do
- {
- CLzmaProb *prob;
- UInt32 bound;
- unsigned ttt;
- unsigned posState = processedPos & pbMask;
-
- prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
- IF_BIT_0(prob)
- {
- unsigned symbol;
- UPDATE_0(prob);
- prob = probs + Literal;
- if (checkDicSize != 0 || processedPos != 0)
- prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) +
- (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc))));
-
- if (state < kNumLitStates)
- {
- symbol = 1;
- do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100);
- }
- else
- {
- unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
- unsigned offs = 0x100;
- symbol = 1;
- do
- {
- unsigned bit;
- CLzmaProb *probLit;
- matchByte <<= 1;
- bit = (matchByte & offs);
- probLit = prob + offs + bit + symbol;
- GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit)
- }
- while (symbol < 0x100);
- }
- dic[dicPos++] = (Byte)symbol;
- processedPos++;
-
- state = kLiteralNextStates[state];
- /* if (state < 4) state = 0; else if (state < 10) state -= 3; else state -= 6; */
- continue;
- }
- else
- {
- UPDATE_1(prob);
- prob = probs + IsRep + state;
- IF_BIT_0(prob)
- {
- UPDATE_0(prob);
- state += kNumStates;
- prob = probs + LenCoder;
- }
- else
- {
- UPDATE_1(prob);
- if (checkDicSize == 0 && processedPos == 0)
- return SZ_ERROR_DATA;
- prob = probs + IsRepG0 + state;
- IF_BIT_0(prob)
- {
- UPDATE_0(prob);
- prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
- IF_BIT_0(prob)
- {
- UPDATE_0(prob);
- dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
- dicPos++;
- processedPos++;
- state = state < kNumLitStates ? 9 : 11;
- continue;
- }
- UPDATE_1(prob);
- }
- else
- {
- UInt32 distance;
- UPDATE_1(prob);
- prob = probs + IsRepG1 + state;
- IF_BIT_0(prob)
- {
- UPDATE_0(prob);
- distance = rep1;
- }
- else
- {
- UPDATE_1(prob);
- prob = probs + IsRepG2 + state;
- IF_BIT_0(prob)
- {
- UPDATE_0(prob);
- distance = rep2;
- }
- else
- {
- UPDATE_1(prob);
- distance = rep3;
- rep3 = rep2;
- }
- rep2 = rep1;
- }
- rep1 = rep0;
- rep0 = distance;
- }
- state = state < kNumLitStates ? 8 : 11;
- prob = probs + RepLenCoder;
- }
- {
- unsigned limit, offset;
- CLzmaProb *probLen = prob + LenChoice;
- IF_BIT_0(probLen)
- {
- UPDATE_0(probLen);
- probLen = prob + LenLow + (posState << kLenNumLowBits);
- offset = 0;
- limit = (1 << kLenNumLowBits);
- }
- else
- {
- UPDATE_1(probLen);
- probLen = prob + LenChoice2;
- IF_BIT_0(probLen)
- {
- UPDATE_0(probLen);
- probLen = prob + LenMid + (posState << kLenNumMidBits);
- offset = kLenNumLowSymbols;
- limit = (1 << kLenNumMidBits);
- }
- else
- {
- UPDATE_1(probLen);
- probLen = prob + LenHigh;
- offset = kLenNumLowSymbols + kLenNumMidSymbols;
- limit = (1 << kLenNumHighBits);
- }
- }
- TREE_DECODE(probLen, limit, len);
- len += offset;
- }
-
- if (state >= kNumStates)
- {
- UInt32 distance;
- prob = probs + PosSlot +
- ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
- TREE_6_DECODE(prob, distance);
- if (distance >= kStartPosModelIndex)
- {
- unsigned posSlot = (unsigned)distance;
- int numDirectBits = (int)(((distance >> 1) - 1));
- distance = (2 | (distance & 1));
- if (posSlot < kEndPosModelIndex)
- {
- distance <<= numDirectBits;
- prob = probs + SpecPos + distance - posSlot - 1;
- {
- UInt32 mask = 1;
- unsigned i = 1;
- do
- {
- GET_BIT2(prob + i, i, ; , distance |= mask);
- mask <<= 1;
- }
- while (--numDirectBits != 0);
- }
- }
- else
- {
- numDirectBits -= kNumAlignBits;
- do
- {
- NORMALIZE
- range >>= 1;
-
- {
- UInt32 t;
- code -= range;
- t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */
- distance = (distance << 1) + (t + 1);
- code += range & t;
- }
- /*
- distance <<= 1;
- if (code >= range)
- {
- code -= range;
- distance |= 1;
- }
- */
- }
- while (--numDirectBits != 0);
- prob = probs + Align;
- distance <<= kNumAlignBits;
- {
- unsigned i = 1;
- GET_BIT2(prob + i, i, ; , distance |= 1);
- GET_BIT2(prob + i, i, ; , distance |= 2);
- GET_BIT2(prob + i, i, ; , distance |= 4);
- GET_BIT2(prob + i, i, ; , distance |= 8);
- }
- if (distance == (UInt32)0xFFFFFFFF)
- {
- len += kMatchSpecLenStart;
- state -= kNumStates;
- break;
- }
- }
- }
- rep3 = rep2;
- rep2 = rep1;
- rep1 = rep0;
- rep0 = distance + 1;
- if (checkDicSize == 0)
- {
- if (distance >= processedPos)
- return SZ_ERROR_DATA;
- }
- else if (distance >= checkDicSize)
- return SZ_ERROR_DATA;
- state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
- /* state = kLiteralNextStates[state]; */
- }
-
- len += kMatchMinLen;
-
- if (limit == dicPos)
- return SZ_ERROR_DATA;
- {
- SizeT rem = limit - dicPos;
- unsigned curLen = ((rem < len) ? (unsigned)rem : len);
- SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0);
-
- processedPos += curLen;
-
- len -= curLen;
- if (pos + curLen <= dicBufSize)
- {
- Byte *dest = dic + dicPos;
- ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos;
- const Byte *lim = dest + curLen;
- dicPos += curLen;
- do
- *(dest) = (Byte)*(dest + src);
- while (++dest != lim);
- }
- else
- {
- do
- {
- dic[dicPos++] = dic[pos];
- if (++pos == dicBufSize)
- pos = 0;
- }
- while (--curLen != 0);
- }
- }
- }
- }
- while (dicPos < limit && buf < bufLimit);
- NORMALIZE;
- p->buf = buf;
- p->range = range;
- p->code = code;
- p->remainLen = len;
- p->dicPos = dicPos;
- p->processedPos = processedPos;
- p->reps[0] = rep0;
- p->reps[1] = rep1;
- p->reps[2] = rep2;
- p->reps[3] = rep3;
- p->state = state;
-
- return SZ_OK;
-}
-
-static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
-{
- if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart)
- {
- Byte *dic = p->dic;
- SizeT dicPos = p->dicPos;
- SizeT dicBufSize = p->dicBufSize;
- unsigned len = p->remainLen;
- UInt32 rep0 = p->reps[0];
- if (limit - dicPos < len)
- len = (unsigned)(limit - dicPos);
-
- if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len)
- p->checkDicSize = p->prop.dicSize;
-
- p->processedPos += len;
- p->remainLen -= len;
- while (len-- != 0)
- {
- dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
- dicPos++;
- }
- p->dicPos = dicPos;
- }
-}
-
-static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
-{
- do
- {
- SizeT limit2 = limit;
- if (p->checkDicSize == 0)
- {
- UInt32 rem = p->prop.dicSize - p->processedPos;
- if (limit - p->dicPos > rem)
- limit2 = p->dicPos + rem;
- }
- RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit));
- if (p->processedPos >= p->prop.dicSize)
- p->checkDicSize = p->prop.dicSize;
- LzmaDec_WriteRem(p, limit);
- }
- while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart);
-
- if (p->remainLen > kMatchSpecLenStart)
- {
- p->remainLen = kMatchSpecLenStart;
- }
- return 0;
-}
-
-typedef enum
-{
- DUMMY_ERROR, /* unexpected end of input stream */
- DUMMY_LIT,
- DUMMY_MATCH,
- DUMMY_REP
-} ELzmaDummy;
-
-static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize)
-{
- UInt32 range = p->range;
- UInt32 code = p->code;
- const Byte *bufLimit = buf + inSize;
- CLzmaProb *probs = p->probs;
- unsigned state = p->state;
- ELzmaDummy res;
-
- {
- CLzmaProb *prob;
- UInt32 bound;
- unsigned ttt;
- unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1);
-
- prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
- IF_BIT_0_CHECK(prob)
- {
- UPDATE_0_CHECK
-
- /* if (bufLimit - buf >= 7) return DUMMY_LIT; */
-
- prob = probs + Literal;
- if (p->checkDicSize != 0 || p->processedPos != 0)
- prob += (LZMA_LIT_SIZE *
- ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) +
- (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc))));
-
- if (state < kNumLitStates)
- {
- unsigned symbol = 1;
- do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100);
- }
- else
- {
- unsigned matchByte = p->dic[p->dicPos - p->reps[0] +
- ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)];
- unsigned offs = 0x100;
- unsigned symbol = 1;
- do
- {
- unsigned bit;
- CLzmaProb *probLit;
- matchByte <<= 1;
- bit = (matchByte & offs);
- probLit = prob + offs + bit + symbol;
- GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit)
- }
- while (symbol < 0x100);
- }
- res = DUMMY_LIT;
- }
- else
- {
- unsigned len;
- UPDATE_1_CHECK;
-
- prob = probs + IsRep + state;
- IF_BIT_0_CHECK(prob)
- {
- UPDATE_0_CHECK;
- state = 0;
- prob = probs + LenCoder;
- res = DUMMY_MATCH;
- }
- else
- {
- UPDATE_1_CHECK;
- res = DUMMY_REP;
- prob = probs + IsRepG0 + state;
- IF_BIT_0_CHECK(prob)
- {
- UPDATE_0_CHECK;
- prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
- IF_BIT_0_CHECK(prob)
- {
- UPDATE_0_CHECK;
- NORMALIZE_CHECK;
- return DUMMY_REP;
- }
- else
- {
- UPDATE_1_CHECK;
- }
- }
- else
- {
- UPDATE_1_CHECK;
- prob = probs + IsRepG1 + state;
- IF_BIT_0_CHECK(prob)
- {
- UPDATE_0_CHECK;
- }
- else
- {
- UPDATE_1_CHECK;
- prob = probs + IsRepG2 + state;
- IF_BIT_0_CHECK(prob)
- {
- UPDATE_0_CHECK;
- }
- else
- {
- UPDATE_1_CHECK;
- }
- }
- }
- state = kNumStates;
- prob = probs + RepLenCoder;
- }
- {
- unsigned limit, offset;
- CLzmaProb *probLen = prob + LenChoice;
- IF_BIT_0_CHECK(probLen)
- {
- UPDATE_0_CHECK;
- probLen = prob + LenLow + (posState << kLenNumLowBits);
- offset = 0;
- limit = 1 << kLenNumLowBits;
- }
- else
- {
- UPDATE_1_CHECK;
- probLen = prob + LenChoice2;
- IF_BIT_0_CHECK(probLen)
- {
- UPDATE_0_CHECK;
- probLen = prob + LenMid + (posState << kLenNumMidBits);
- offset = kLenNumLowSymbols;
- limit = 1 << kLenNumMidBits;
- }
- else
- {
- UPDATE_1_CHECK;
- probLen = prob + LenHigh;
- offset = kLenNumLowSymbols + kLenNumMidSymbols;
- limit = 1 << kLenNumHighBits;
- }
- }
- TREE_DECODE_CHECK(probLen, limit, len);
- len += offset;
- }
-
- if (state < 4)
- {
- unsigned posSlot;
- prob = probs + PosSlot +
- ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
- kNumPosSlotBits);
- TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot);
- if (posSlot >= kStartPosModelIndex)
- {
- int numDirectBits = ((posSlot >> 1) - 1);
-
- /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */
-
- if (posSlot < kEndPosModelIndex)
- {
- prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1;
- }
- else
- {
- numDirectBits -= kNumAlignBits;
- do
- {
- NORMALIZE_CHECK
- range >>= 1;
- code -= range & (((code - range) >> 31) - 1);
- /* if (code >= range) code -= range; */
- }
- while (--numDirectBits != 0);
- prob = probs + Align;
- numDirectBits = kNumAlignBits;
- }
- {
- unsigned i = 1;
- do
- {
- GET_BIT_CHECK(prob + i, i);
- }
- while (--numDirectBits != 0);
- }
- }
- }
- }
- }
- NORMALIZE_CHECK;
- return res;
-}
-
-
-static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data)
-{
- p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]);
- p->range = 0xFFFFFFFF;
- p->needFlush = 0;
-}
-
-void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
-{
- p->needFlush = 1;
- p->remainLen = 0;
- p->tempBufSize = 0;
-
- if (initDic)
- {
- p->processedPos = 0;
- p->checkDicSize = 0;
- p->needInitState = 1;
- }
- if (initState)
- p->needInitState = 1;
-}
-
-void LzmaDec_Init(CLzmaDec *p)
-{
- p->dicPos = 0;
- LzmaDec_InitDicAndState(p, True, True);
-}
-
-static void LzmaDec_InitStateReal(CLzmaDec *p)
-{
- UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp));
- UInt32 i;
- CLzmaProb *probs = p->probs;
- for (i = 0; i < numProbs; i++)
- probs[i] = kBitModelTotal >> 1;
- p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1;
- p->state = 0;
- p->needInitState = 0;
-}
-
-SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
- ELzmaFinishMode finishMode, ELzmaStatus *status)
-{
- SizeT inSize = *srcLen;
- (*srcLen) = 0;
- LzmaDec_WriteRem(p, dicLimit);
-
- *status = LZMA_STATUS_NOT_SPECIFIED;
-
- while (p->remainLen != kMatchSpecLenStart)
- {
- int checkEndMarkNow;
-
- if (p->needFlush != 0)
- {
- for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--)
- p->tempBuf[p->tempBufSize++] = *src++;
- if (p->tempBufSize < RC_INIT_SIZE)
- {
- *status = LZMA_STATUS_NEEDS_MORE_INPUT;
- return SZ_OK;
- }
- if (p->tempBuf[0] != 0)
- return SZ_ERROR_DATA;
-
- LzmaDec_InitRc(p, p->tempBuf);
- p->tempBufSize = 0;
- }
-
- checkEndMarkNow = 0;
- if (p->dicPos >= dicLimit)
- {
- if (p->remainLen == 0 && p->code == 0)
- {
- *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK;
- return SZ_OK;
- }
- if (finishMode == LZMA_FINISH_ANY)
- {
- *status = LZMA_STATUS_NOT_FINISHED;
- return SZ_OK;
- }
- if (p->remainLen != 0)
- {
- *status = LZMA_STATUS_NOT_FINISHED;
- return SZ_ERROR_DATA;
- }
- checkEndMarkNow = 1;
- }
-
- if (p->needInitState)
- LzmaDec_InitStateReal(p);
-
- if (p->tempBufSize == 0)
- {
- SizeT processed;
- const Byte *bufLimit;
- if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
- {
- int dummyRes = LzmaDec_TryDummy(p, src, inSize);
- if (dummyRes == DUMMY_ERROR)
- {
- memcpy(p->tempBuf, src, inSize);
- p->tempBufSize = (unsigned)inSize;
- (*srcLen) += inSize;
- *status = LZMA_STATUS_NEEDS_MORE_INPUT;
- return SZ_OK;
- }
- if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
- {
- *status = LZMA_STATUS_NOT_FINISHED;
- return SZ_ERROR_DATA;
- }
- bufLimit = src;
- }
- else
- bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX;
- p->buf = src;
- if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0)
- return SZ_ERROR_DATA;
- processed = (SizeT)(p->buf - src);
- (*srcLen) += processed;
- src += processed;
- inSize -= processed;
- }
- else
- {
- unsigned rem = p->tempBufSize, lookAhead = 0;
- while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize)
- p->tempBuf[rem++] = src[lookAhead++];
- p->tempBufSize = rem;
- if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
- {
- int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem);
- if (dummyRes == DUMMY_ERROR)
- {
- (*srcLen) += lookAhead;
- *status = LZMA_STATUS_NEEDS_MORE_INPUT;
- return SZ_OK;
- }
- if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
- {
- *status = LZMA_STATUS_NOT_FINISHED;
- return SZ_ERROR_DATA;
- }
- }
- p->buf = p->tempBuf;
- if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0)
- return SZ_ERROR_DATA;
- lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf));
- (*srcLen) += lookAhead;
- src += lookAhead;
- inSize -= lookAhead;
- p->tempBufSize = 0;
- }
- }
- if (p->code == 0)
- *status = LZMA_STATUS_FINISHED_WITH_MARK;
- return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
-}
-
-SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
-{
- SizeT outSize = *destLen;
- SizeT inSize = *srcLen;
- *srcLen = *destLen = 0;
- for (;;)
- {
- SizeT inSizeCur = inSize, outSizeCur, dicPos;
- ELzmaFinishMode curFinishMode;
- SRes res;
- if (p->dicPos == p->dicBufSize)
- p->dicPos = 0;
- dicPos = p->dicPos;
- if (outSize > p->dicBufSize - dicPos)
- {
- outSizeCur = p->dicBufSize;
- curFinishMode = LZMA_FINISH_ANY;
- }
- else
- {
- outSizeCur = dicPos + outSize;
- curFinishMode = finishMode;
- }
-
- res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status);
- src += inSizeCur;
- inSize -= inSizeCur;
- *srcLen += inSizeCur;
- outSizeCur = p->dicPos - dicPos;
- memcpy(dest, p->dic + dicPos, outSizeCur);
- dest += outSizeCur;
- outSize -= outSizeCur;
- *destLen += outSizeCur;
- if (res != 0)
- return res;
- if (outSizeCur == 0 || outSize == 0)
- return SZ_OK;
- }
-}
-
-void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
-{
- alloc->Free(alloc, p->probs);
- p->probs = 0;
-}
-
-static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc)
-{
- alloc->Free(alloc, p->dic);
- p->dic = 0;
-}
-
-void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
-{
- LzmaDec_FreeProbs(p, alloc);
- LzmaDec_FreeDict(p, alloc);
-}
-
-SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
-{
- UInt32 dicSize;
- Byte d;
-
- if (size < LZMA_PROPS_SIZE)
- return SZ_ERROR_UNSUPPORTED;
- else
- dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24);
-
- if (dicSize < LZMA_DIC_MIN)
- dicSize = LZMA_DIC_MIN;
- p->dicSize = dicSize;
-
- d = data[0];
- if (d >= (9 * 5 * 5))
- return SZ_ERROR_UNSUPPORTED;
-
- p->lc = d % 9;
- d /= 9;
- p->pb = d / 5;
- p->lp = d % 5;
-
- return SZ_OK;
-}
-
-static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc)
-{
- UInt32 numProbs = LzmaProps_GetNumProbs(propNew);
- if (p->probs == 0 || numProbs != p->numProbs)
- {
- LzmaDec_FreeProbs(p, alloc);
- p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb));
- p->numProbs = numProbs;
- if (p->probs == 0)
- return SZ_ERROR_MEM;
- }
- return SZ_OK;
-}
-
-SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
-{
- CLzmaProps propNew;
- RINOK(LzmaProps_Decode(&propNew, props, propsSize));
- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
- p->prop = propNew;
- return SZ_OK;
-}
-
-SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
-{
- CLzmaProps propNew;
- SizeT dicBufSize;
- RINOK(LzmaProps_Decode(&propNew, props, propsSize));
- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
- dicBufSize = propNew.dicSize;
- if (p->dic == 0 || dicBufSize != p->dicBufSize)
- {
- LzmaDec_FreeDict(p, alloc);
- p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize);
- if (p->dic == 0)
- {
- LzmaDec_FreeProbs(p, alloc);
- return SZ_ERROR_MEM;
- }
- }
- p->dicBufSize = dicBufSize;
- p->prop = propNew;
- return SZ_OK;
-}
-
-SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
- const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
- ELzmaStatus *status, ISzAlloc *alloc)
-{
- CLzmaDec p;
- SRes res;
- SizeT inSize = *srcLen;
- SizeT outSize = *destLen;
- *srcLen = *destLen = 0;
- if (inSize < RC_INIT_SIZE)
- return SZ_ERROR_INPUT_EOF;
-
- LzmaDec_Construct(&p);
- res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc);
- if (res != 0)
- return res;
- p.dic = dest;
- p.dicBufSize = outSize;
-
- LzmaDec_Init(&p);
-
- *srcLen = inSize;
- res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
-
- if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
- res = SZ_ERROR_INPUT_EOF;
-
- (*destLen) = p.dicPos;
- LzmaDec_FreeProbs(&p, alloc);
- return res;
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaDec.h b/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaDec.h
deleted file mode 100644
index 2a86ab8e..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaDec.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/* LzmaDec.h -- LZMA Decoder
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __LZMADEC_H
-#define __LZMADEC_H
-
-#include "lzma_Types.h"
-
-namespace crnlib {
-
-/* #define _LZMA_PROB32 */
-/* _LZMA_PROB32 can increase the speed on some CPUs,
- but memory usage for CLzmaDec::probs will be doubled in that case */
-
-#ifdef _LZMA_PROB32
-#define CLzmaProb UInt32
-#else
-#define CLzmaProb UInt16
-#endif
-
-
-/* ---------- LZMA Properties ---------- */
-
-#define LZMA_PROPS_SIZE 5
-
-typedef struct _CLzmaProps
-{
- unsigned lc, lp, pb;
- UInt32 dicSize;
-} CLzmaProps;
-
-/* LzmaProps_Decode - decodes properties
-Returns:
- SZ_OK
- SZ_ERROR_UNSUPPORTED - Unsupported properties
-*/
-
-SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
-
-
-/* ---------- LZMA Decoder state ---------- */
-
-/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
- Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
-
-#define LZMA_REQUIRED_INPUT_MAX 20
-
-typedef struct
-{
- CLzmaProps prop;
- CLzmaProb *probs;
- Byte *dic;
- const Byte *buf;
- UInt32 range, code;
- SizeT dicPos;
- SizeT dicBufSize;
- UInt32 processedPos;
- UInt32 checkDicSize;
- unsigned state;
- UInt32 reps[4];
- unsigned remainLen;
- int needFlush;
- int needInitState;
- UInt32 numProbs;
- unsigned tempBufSize;
- Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
-} CLzmaDec;
-
-#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
-
-void LzmaDec_Init(CLzmaDec *p);
-
-/* There are two types of LZMA streams:
- 0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
- 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */
-
-typedef enum
-{
- LZMA_FINISH_ANY, /* finish at any point */
- LZMA_FINISH_END /* block must be finished at the end */
-} ELzmaFinishMode;
-
-/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
-
- You must use LZMA_FINISH_END, when you know that current output buffer
- covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
-
- If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
- and output value of destLen will be less than output buffer size limit.
- You can check status result also.
-
- You can use multiple checks to test data integrity after full decompression:
- 1) Check Result and "status" variable.
- 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
- 3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
- You must use correct finish mode in that case. */
-
-typedef enum
-{
- LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */
- LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */
- LZMA_STATUS_NOT_FINISHED, /* stream was not finished */
- LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */
- LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */
-} ELzmaStatus;
-
-/* ELzmaStatus is used only as output value for function call */
-
-
-/* ---------- Interfaces ---------- */
-
-/* There are 3 levels of interfaces:
- 1) Dictionary Interface
- 2) Buffer Interface
- 3) One Call Interface
- You can select any of these interfaces, but don't mix functions from different
- groups for same object. */
-
-
-/* There are two variants to allocate state for Dictionary Interface:
- 1) LzmaDec_Allocate / LzmaDec_Free
- 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
- You can use variant 2, if you set dictionary buffer manually.
- For Buffer Interface you must always use variant 1.
-
-LzmaDec_Allocate* can return:
- SZ_OK
- SZ_ERROR_MEM - Memory allocation error
- SZ_ERROR_UNSUPPORTED - Unsupported properties
-*/
-
-SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
-void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
-
-SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
-void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
-
-/* ---------- Dictionary Interface ---------- */
-
-/* You can use it, if you want to eliminate the overhead for data copying from
- dictionary to some other external buffer.
- You must work with CLzmaDec variables directly in this interface.
-
- STEPS:
- LzmaDec_Constr()
- LzmaDec_Allocate()
- for (each new stream)
- {
- LzmaDec_Init()
- while (it needs more decompression)
- {
- LzmaDec_DecodeToDic()
- use data from CLzmaDec::dic and update CLzmaDec::dicPos
- }
- }
- LzmaDec_Free()
-*/
-
-/* LzmaDec_DecodeToDic
-
- The decoding to internal dictionary buffer (CLzmaDec::dic).
- You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
-
-finishMode:
- It has meaning only if the decoding reaches output limit (dicLimit).
- LZMA_FINISH_ANY - Decode just dicLimit bytes.
- LZMA_FINISH_END - Stream must be finished after dicLimit.
-
-Returns:
- SZ_OK
- status:
- LZMA_STATUS_FINISHED_WITH_MARK
- LZMA_STATUS_NOT_FINISHED
- LZMA_STATUS_NEEDS_MORE_INPUT
- LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
- SZ_ERROR_DATA - Data error
-*/
-
-SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
-
-
-/* ---------- Buffer Interface ---------- */
-
-/* It's zlib-like interface.
- See LzmaDec_DecodeToDic description for information about STEPS and return results,
- but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
- to work with CLzmaDec variables manually.
-
-finishMode:
- It has meaning only if the decoding reaches output limit (*destLen).
- LZMA_FINISH_ANY - Decode just destLen bytes.
- LZMA_FINISH_END - Stream must be finished after (*destLen).
-*/
-
-SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
-
-
-/* ---------- One Call Interface ---------- */
-
-/* LzmaDecode
-
-finishMode:
- It has meaning only if the decoding reaches output limit (*destLen).
- LZMA_FINISH_ANY - Decode just destLen bytes.
- LZMA_FINISH_END - Stream must be finished after (*destLen).
-
-Returns:
- SZ_OK
- status:
- LZMA_STATUS_FINISHED_WITH_MARK
- LZMA_STATUS_NOT_FINISHED
- LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
- SZ_ERROR_DATA - Data error
- SZ_ERROR_MEM - Memory allocation error
- SZ_ERROR_UNSUPPORTED - Unsupported properties
- SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
-*/
-
-SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
- const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
- ELzmaStatus *status, ISzAlloc *alloc);
-
-}
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaEnc.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaEnc.cpp
deleted file mode 100644
index 81a0a352..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaEnc.cpp
+++ /dev/null
@@ -1,2282 +0,0 @@
-/* LzmaEnc.c -- LZMA Encoder
-2008-10-04 : Igor Pavlov : Public domain */
-#include "crn_core.h"
-#include <string.h>
-
-/* #define SHOW_STAT */
-/* #define SHOW_STAT2 */
-
-#if defined(SHOW_STAT) || defined(SHOW_STAT2)
-#include <stdio.h>
-#endif
-
-#include "lzma_LzmaEnc.h"
-
-#include "lzma_LzFind.h"
-#ifdef COMPRESS_MF_MT
-#include "lzma_LzFindMt.h"
-#endif
-
-namespace crnlib {
-
-#ifdef SHOW_STAT
-static int ttt = 0;
-#endif
-
-#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1)
-
-#define kBlockSize (9 << 10)
-#define kUnpackBlockSize (1 << 18)
-#define kMatchArraySize (1 << 21)
-#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX)
-
-#define kNumMaxDirectBits (31)
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-#define kProbInitValue (kBitModelTotal >> 1)
-
-#define kNumMoveReducingBits 4
-#define kNumBitPriceShiftBits 4
-#define kBitPrice (1 << kNumBitPriceShiftBits)
-
-void LzmaEncProps_Init(CLzmaEncProps *p)
-{
- p->level = 5;
- p->dictSize = p->mc = 0;
- p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1;
- p->writeEndMark = 0;
-}
-
-void LzmaEncProps_Normalize(CLzmaEncProps *p)
-{
- int level = p->level;
- if (level < 0) level = 5;
- p->level = level;
- if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26)));
- if (p->lc < 0) p->lc = 3;
- if (p->lp < 0) p->lp = 0;
- if (p->pb < 0) p->pb = 2;
- if (p->algo < 0) p->algo = (level < 5 ? 0 : 1);
- if (p->fb < 0) p->fb = (level < 7 ? 32 : 64);
- if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1);
- if (p->numHashBytes < 0) p->numHashBytes = 4;
- if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1);
- if (p->numThreads < 0) p->numThreads = ((p->btMode && p->algo) ? 2 : 1);
-}
-
-UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
-{
- CLzmaEncProps props = *props2;
- LzmaEncProps_Normalize(&props);
- return props.dictSize;
-}
-
-/* #define LZMA_LOG_BSR */
-/* Define it for Intel's CPU */
-
-
-#ifdef LZMA_LOG_BSR
-
-#define kDicLogSizeMaxCompress 30
-
-#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); }
-
-UInt32 GetPosSlot1(UInt32 pos)
-{
- UInt32 res;
- BSR2_RET(pos, res);
- return res;
-}
-#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
-#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); }
-
-#else
-
-#define kNumLogBits (9 + (int)sizeof(size_t) / 2)
-#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
-
-void LzmaEnc_FastPosInit(Byte *g_FastPos)
-{
- int c = 2, slotFast;
- g_FastPos[0] = 0;
- g_FastPos[1] = 1;
-
- for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++)
- {
- UInt32 k = (1 << ((slotFast >> 1) - 1));
- UInt32 j;
- for (j = 0; j < k; j++, c++)
- g_FastPos[c] = (Byte)slotFast;
- }
-}
-
-#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \
- (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \
- res = p->g_FastPos[pos >> i] + (i * 2); }
-/*
-#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \
- p->g_FastPos[pos >> 6] + 12 : \
- p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; }
-*/
-
-#define GetPosSlot1(pos) p->g_FastPos[pos]
-#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
-#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); }
-
-#endif
-
-
-#define LZMA_NUM_REPS 4
-
-typedef unsigned CState;
-
-typedef struct _COptimal
-{
- UInt32 price;
-
- CState state;
- int prev1IsChar;
- int prev2;
-
- UInt32 posPrev2;
- UInt32 backPrev2;
-
- UInt32 posPrev;
- UInt32 backPrev;
- UInt32 backs[LZMA_NUM_REPS];
-} COptimal;
-
-#define kNumOpts (1 << 12)
-
-#define kNumLenToPosStates 4
-#define kNumPosSlotBits 6
-#define kDicLogSizeMin 0
-#define kDicLogSizeMax 32
-#define kDistTableSizeMax (kDicLogSizeMax * 2)
-
-
-#define kNumAlignBits 4
-#define kAlignTableSize (1 << kNumAlignBits)
-#define kAlignMask (kAlignTableSize - 1)
-
-#define kStartPosModelIndex 4
-#define kEndPosModelIndex 14
-#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex)
-
-#define kNumFullDistances (1 << (kEndPosModelIndex / 2))
-
-#ifdef _LZMA_PROB32
-#define CLzmaProb UInt32
-#else
-#define CLzmaProb UInt16
-#endif
-
-#define LZMA_PB_MAX 4
-#define LZMA_LC_MAX 8
-#define LZMA_LP_MAX 4
-
-#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX)
-
-
-#define kLenNumLowBits 3
-#define kLenNumLowSymbols (1 << kLenNumLowBits)
-#define kLenNumMidBits 3
-#define kLenNumMidSymbols (1 << kLenNumMidBits)
-#define kLenNumHighBits 8
-#define kLenNumHighSymbols (1 << kLenNumHighBits)
-
-#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
-
-#define LZMA_MATCH_LEN_MIN 2
-#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1)
-
-#define kNumStates 12
-
-typedef struct
-{
- CLzmaProb choice;
- CLzmaProb choice2;
- CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits];
- CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits];
- CLzmaProb high[kLenNumHighSymbols];
-} CLenEnc;
-
-typedef struct
-{
- CLenEnc p;
- UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal];
- UInt32 tableSize;
- UInt32 counters[LZMA_NUM_PB_STATES_MAX];
-} CLenPriceEnc;
-
-typedef struct _CRangeEnc
-{
- UInt32 range;
- Byte cache;
- UInt64 low;
- UInt64 cacheSize;
- Byte *buf;
- Byte *bufLim;
- Byte *bufBase;
- ISeqOutStream *outStream;
- UInt64 processed;
- SRes res;
-} CRangeEnc;
-
-typedef struct _CSeqInStreamBuf
-{
- ISeqInStream funcTable;
- const Byte *data;
- SizeT rem;
-} CSeqInStreamBuf;
-
-static SRes MyRead(void *pp, void *data, size_t *size)
-{
- size_t curSize = *size;
- CSeqInStreamBuf *p = (CSeqInStreamBuf *)pp;
- if (p->rem < curSize)
- curSize = p->rem;
- memcpy(data, p->data, curSize);
- p->rem -= curSize;
- p->data += curSize;
- *size = curSize;
- return SZ_OK;
-}
-
-typedef struct
-{
- CLzmaProb *litProbs;
-
- CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
- CLzmaProb isRep[kNumStates];
- CLzmaProb isRepG0[kNumStates];
- CLzmaProb isRepG1[kNumStates];
- CLzmaProb isRepG2[kNumStates];
- CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
-
- CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
- CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
- CLzmaProb posAlignEncoder[1 << kNumAlignBits];
-
- CLenPriceEnc lenEnc;
- CLenPriceEnc repLenEnc;
-
- UInt32 reps[LZMA_NUM_REPS];
- UInt32 state;
-} CSaveState;
-
-typedef struct _CLzmaEnc
-{
- IMatchFinder matchFinder;
- void *matchFinderObj;
-
- #ifdef COMPRESS_MF_MT
- Bool mtMode;
- CMatchFinderMt matchFinderMt;
- #endif
-
- CMatchFinder matchFinderBase;
-
- #ifdef COMPRESS_MF_MT
- Byte pad[128];
- #endif
-
- UInt32 optimumEndIndex;
- UInt32 optimumCurrentIndex;
-
- UInt32 longestMatchLength;
- UInt32 numPairs;
- UInt32 numAvail;
- COptimal opt[kNumOpts];
-
- #ifndef LZMA_LOG_BSR
- Byte g_FastPos[1 << kNumLogBits];
- #endif
-
- UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
- UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1];
- UInt32 numFastBytes;
- UInt32 additionalOffset;
- UInt32 reps[LZMA_NUM_REPS];
- UInt32 state;
-
- UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax];
- UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances];
- UInt32 alignPrices[kAlignTableSize];
- UInt32 alignPriceCount;
-
- UInt32 distTableSize;
-
- unsigned lc, lp, pb;
- unsigned lpMask, pbMask;
-
- CLzmaProb *litProbs;
-
- CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
- CLzmaProb isRep[kNumStates];
- CLzmaProb isRepG0[kNumStates];
- CLzmaProb isRepG1[kNumStates];
- CLzmaProb isRepG2[kNumStates];
- CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
-
- CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
- CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
- CLzmaProb posAlignEncoder[1 << kNumAlignBits];
-
- CLenPriceEnc lenEnc;
- CLenPriceEnc repLenEnc;
-
- unsigned lclp;
-
- Bool fastMode;
-
- CRangeEnc rc;
-
- Bool writeEndMark;
- UInt64 nowPos64;
- UInt32 matchPriceCount;
- Bool finished;
- Bool multiThread;
-
- SRes result;
- UInt32 dictSize;
- UInt32 matchFinderCycles;
-
- ISeqInStream *inStream;
- CSeqInStreamBuf seqBufInStream;
-
- CSaveState saveState;
-} CLzmaEnc;
-
-void LzmaEnc_SaveState(CLzmaEncHandle pp)
-{
- CLzmaEnc *p = (CLzmaEnc *)pp;
- CSaveState *dest = &p->saveState;
- int i;
- dest->lenEnc = p->lenEnc;
- dest->repLenEnc = p->repLenEnc;
- dest->state = p->state;
-
- for (i = 0; i < kNumStates; i++)
- {
- memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
- memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
- }
- for (i = 0; i < kNumLenToPosStates; i++)
- memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
- memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
- memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
- memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
- memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
- memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
- memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
- memcpy(dest->reps, p->reps, sizeof(p->reps));
- memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb));
-}
-
-void LzmaEnc_RestoreState(CLzmaEncHandle pp)
-{
- CLzmaEnc *dest = (CLzmaEnc *)pp;
- const CSaveState *p = &dest->saveState;
- int i;
- dest->lenEnc = p->lenEnc;
- dest->repLenEnc = p->repLenEnc;
- dest->state = p->state;
-
- for (i = 0; i < kNumStates; i++)
- {
- memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
- memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
- }
- for (i = 0; i < kNumLenToPosStates; i++)
- memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
- memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
- memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
- memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
- memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
- memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
- memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
- memcpy(dest->reps, p->reps, sizeof(p->reps));
- memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb));
-}
-
-SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
-{
- CLzmaEnc *p = (CLzmaEnc *)pp;
- CLzmaEncProps props = *props2;
- LzmaEncProps_Normalize(&props);
-
- if (props.lc > LZMA_LC_MAX ||
- props.lp > LZMA_LP_MAX ||
- props.pb > LZMA_PB_MAX ||
- props.dictSize > (1U << kDicLogSizeMaxCompress) ||
- props.dictSize > (1 << 30))
- return SZ_ERROR_PARAM;
- p->dictSize = props.dictSize;
- p->matchFinderCycles = props.mc;
- {
- unsigned fb = props.fb;
- if (fb < 5)
- fb = 5;
- if (fb > LZMA_MATCH_LEN_MAX)
- fb = LZMA_MATCH_LEN_MAX;
- p->numFastBytes = fb;
- }
- p->lc = props.lc;
- p->lp = props.lp;
- p->pb = props.pb;
- p->fastMode = (props.algo == 0);
- p->matchFinderBase.btMode = props.btMode;
- {
- UInt32 numHashBytes = 4;
- if (props.btMode)
- {
- if (props.numHashBytes < 2)
- numHashBytes = 2;
- else if (props.numHashBytes < 4)
- numHashBytes = props.numHashBytes;
- }
- p->matchFinderBase.numHashBytes = numHashBytes;
- }
-
- p->matchFinderBase.cutValue = props.mc;
-
- p->writeEndMark = props.writeEndMark;
-
- #ifdef COMPRESS_MF_MT
- /*
- if (newMultiThread != _multiThread)
- {
- ReleaseMatchFinder();
- _multiThread = newMultiThread;
- }
- */
- p->multiThread = (props.numThreads > 1);
- #endif
-
- return SZ_OK;
-}
-
-static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5};
-static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
-static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
-static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
-
-#define IsCharState(s) ((s) < 7)
-
-#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1)
-
-#define kInfinityPrice (1 << 30)
-
-static void RangeEnc_Construct(CRangeEnc *p)
-{
- p->outStream = 0;
- p->bufBase = 0;
-}
-
-#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize)
-
-#define RC_BUF_SIZE (1 << 16)
-static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc)
-{
- if (p->bufBase == 0)
- {
- p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE);
- if (p->bufBase == 0)
- return 0;
- p->bufLim = p->bufBase + RC_BUF_SIZE;
- }
- return 1;
-}
-
-static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc)
-{
- alloc->Free(alloc, p->bufBase);
- p->bufBase = 0;
-}
-
-static void RangeEnc_Init(CRangeEnc *p)
-{
- /* Stream.Init(); */
- p->low = 0;
- p->range = 0xFFFFFFFF;
- p->cacheSize = 1;
- p->cache = 0;
-
- p->buf = p->bufBase;
-
- p->processed = 0;
- p->res = SZ_OK;
-}
-
-static void RangeEnc_FlushStream(CRangeEnc *p)
-{
- size_t num;
- if (p->res != SZ_OK)
- return;
- num = p->buf - p->bufBase;
- if (num != p->outStream->Write(p->outStream, p->bufBase, num))
- p->res = SZ_ERROR_WRITE;
- p->processed += num;
- p->buf = p->bufBase;
-}
-
-static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p)
-{
- if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0)
- {
- Byte temp = p->cache;
- do
- {
- Byte *buf = p->buf;
- *buf++ = (Byte)(temp + (Byte)(p->low >> 32));
- p->buf = buf;
- if (buf == p->bufLim)
- RangeEnc_FlushStream(p);
- temp = 0xFF;
- }
- while (--p->cacheSize != 0);
- p->cache = (Byte)((UInt32)p->low >> 24);
- }
- p->cacheSize++;
- p->low = (UInt32)p->low << 8;
-}
-
-static void RangeEnc_FlushData(CRangeEnc *p)
-{
- int i;
- for (i = 0; i < 5; i++)
- RangeEnc_ShiftLow(p);
-}
-
-static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits)
-{
- do
- {
- p->range >>= 1;
- p->low += p->range & (0 - ((value >> --numBits) & 1));
- if (p->range < kTopValue)
- {
- p->range <<= 8;
- RangeEnc_ShiftLow(p);
- }
- }
- while (numBits != 0);
-}
-
-static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol)
-{
- UInt32 ttt = *prob;
- UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt;
- if (symbol == 0)
- {
- p->range = newBound;
- ttt += (kBitModelTotal - ttt) >> kNumMoveBits;
- }
- else
- {
- p->low += newBound;
- p->range -= newBound;
- ttt -= ttt >> kNumMoveBits;
- }
- *prob = (CLzmaProb)ttt;
- if (p->range < kTopValue)
- {
- p->range <<= 8;
- RangeEnc_ShiftLow(p);
- }
-}
-
-static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol)
-{
- symbol |= 0x100;
- do
- {
- RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1);
- symbol <<= 1;
- }
- while (symbol < 0x10000);
-}
-
-static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte)
-{
- UInt32 offs = 0x100;
- symbol |= 0x100;
- do
- {
- matchByte <<= 1;
- RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1);
- symbol <<= 1;
- offs &= ~(matchByte ^ symbol);
- }
- while (symbol < 0x10000);
-}
-
-void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
-{
- UInt32 i;
- for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits))
- {
- const int kCyclesBits = kNumBitPriceShiftBits;
- UInt32 w = i;
- UInt32 bitCount = 0;
- int j;
- for (j = 0; j < kCyclesBits; j++)
- {
- w = w * w;
- bitCount <<= 1;
- while (w >= ((UInt32)1 << 16))
- {
- w >>= 1;
- bitCount++;
- }
- }
- ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount);
- }
-}
-
-
-#define GET_PRICE(prob, symbol) \
- p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
-
-#define GET_PRICEa(prob, symbol) \
- ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
-
-#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits]
-#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
-
-#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits]
-#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
-
-static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices)
-{
- UInt32 price = 0;
- symbol |= 0x100;
- do
- {
- price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1);
- symbol <<= 1;
- }
- while (symbol < 0x10000);
- return price;
-}
-
-static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices)
-{
- UInt32 price = 0;
- UInt32 offs = 0x100;
- symbol |= 0x100;
- do
- {
- matchByte <<= 1;
- price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1);
- symbol <<= 1;
- offs &= ~(matchByte ^ symbol);
- }
- while (symbol < 0x10000);
- return price;
-}
-
-
-static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol)
-{
- UInt32 m = 1;
- int i;
- for (i = numBitLevels; i != 0;)
- {
- UInt32 bit;
- i--;
- bit = (symbol >> i) & 1;
- RangeEnc_EncodeBit(rc, probs + m, bit);
- m = (m << 1) | bit;
- }
-}
-
-static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol)
-{
- UInt32 m = 1;
- int i;
- for (i = 0; i < numBitLevels; i++)
- {
- UInt32 bit = symbol & 1;
- RangeEnc_EncodeBit(rc, probs + m, bit);
- m = (m << 1) | bit;
- symbol >>= 1;
- }
-}
-
-static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices)
-{
- UInt32 price = 0;
- symbol |= (1 << numBitLevels);
- while (symbol != 1)
- {
- price += GET_PRICEa(probs[symbol >> 1], symbol & 1);
- symbol >>= 1;
- }
- return price;
-}
-
-static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices)
-{
- UInt32 price = 0;
- UInt32 m = 1;
- int i;
- for (i = numBitLevels; i != 0; i--)
- {
- UInt32 bit = symbol & 1;
- symbol >>= 1;
- price += GET_PRICEa(probs[m], bit);
- m = (m << 1) | bit;
- }
- return price;
-}
-
-
-static void LenEnc_Init(CLenEnc *p)
-{
- unsigned i;
- p->choice = p->choice2 = kProbInitValue;
- for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++)
- p->low[i] = kProbInitValue;
- for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++)
- p->mid[i] = kProbInitValue;
- for (i = 0; i < kLenNumHighSymbols; i++)
- p->high[i] = kProbInitValue;
-}
-
-static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState)
-{
- if (symbol < kLenNumLowSymbols)
- {
- RangeEnc_EncodeBit(rc, &p->choice, 0);
- RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol);
- }
- else
- {
- RangeEnc_EncodeBit(rc, &p->choice, 1);
- if (symbol < kLenNumLowSymbols + kLenNumMidSymbols)
- {
- RangeEnc_EncodeBit(rc, &p->choice2, 0);
- RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols);
- }
- else
- {
- RangeEnc_EncodeBit(rc, &p->choice2, 1);
- RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols);
- }
- }
-}
-
-static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices)
-{
- UInt32 a0 = GET_PRICE_0a(p->choice);
- UInt32 a1 = GET_PRICE_1a(p->choice);
- UInt32 b0 = a1 + GET_PRICE_0a(p->choice2);
- UInt32 b1 = a1 + GET_PRICE_1a(p->choice2);
- UInt32 i = 0;
- for (i = 0; i < kLenNumLowSymbols; i++)
- {
- if (i >= numSymbols)
- return;
- prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices);
- }
- for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++)
- {
- if (i >= numSymbols)
- return;
- prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices);
- }
- for (; i < numSymbols; i++)
- prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices);
-}
-
-static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices)
-{
- LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices);
- p->counters[posState] = p->tableSize;
-}
-
-static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices)
-{
- UInt32 posState;
- for (posState = 0; posState < numPosStates; posState++)
- LenPriceEnc_UpdateTable(p, posState, ProbPrices);
-}
-
-static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices)
-{
- LenEnc_Encode(&p->p, rc, symbol, posState);
- if (updatePrice)
- if (--p->counters[posState] == 0)
- LenPriceEnc_UpdateTable(p, posState, ProbPrices);
-}
-
-
-
-
-static void MovePos(CLzmaEnc *p, UInt32 num)
-{
- #ifdef SHOW_STAT
- ttt += num;
- printf("\n MovePos %d", num);
- #endif
- if (num != 0)
- {
- p->additionalOffset += num;
- p->matchFinder.Skip(p->matchFinderObj, num);
- }
-}
-
-static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes)
-{
- UInt32 lenRes = 0, numPairs;
- p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
- numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches);
- #ifdef SHOW_STAT
- printf("\n i = %d numPairs = %d ", ttt, numPairs / 2);
- ttt++;
- {
- UInt32 i;
- for (i = 0; i < numPairs; i += 2)
- printf("%2d %6d | ", p->matches[i], p->matches[i + 1]);
- }
- #endif
- if (numPairs > 0)
- {
- lenRes = p->matches[numPairs - 2];
- if (lenRes == p->numFastBytes)
- {
- const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
- UInt32 distance = p->matches[numPairs - 1] + 1;
- UInt32 numAvail = p->numAvail;
- if (numAvail > LZMA_MATCH_LEN_MAX)
- numAvail = LZMA_MATCH_LEN_MAX;
- {
- const Byte *pby2 = pby - distance;
- for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++);
- }
- }
- }
- p->additionalOffset++;
- *numDistancePairsRes = numPairs;
- return lenRes;
-}
-
-
-#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False;
-#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False;
-#define IsShortRep(p) ((p)->backPrev == 0)
-
-static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState)
-{
- return
- GET_PRICE_0(p->isRepG0[state]) +
- GET_PRICE_0(p->isRep0Long[state][posState]);
-}
-
-static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState)
-{
- UInt32 price;
- if (repIndex == 0)
- {
- price = GET_PRICE_0(p->isRepG0[state]);
- price += GET_PRICE_1(p->isRep0Long[state][posState]);
- }
- else
- {
- price = GET_PRICE_1(p->isRepG0[state]);
- if (repIndex == 1)
- price += GET_PRICE_0(p->isRepG1[state]);
- else
- {
- price += GET_PRICE_1(p->isRepG1[state]);
- price += GET_PRICE(p->isRepG2[state], repIndex - 2);
- }
- }
- return price;
-}
-
-static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState)
-{
- return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] +
- GetPureRepPrice(p, repIndex, state, posState);
-}
-
-static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur)
-{
- UInt32 posMem = p->opt[cur].posPrev;
- UInt32 backMem = p->opt[cur].backPrev;
- p->optimumEndIndex = cur;
- do
- {
- if (p->opt[cur].prev1IsChar)
- {
- MakeAsChar(&p->opt[posMem])
- p->opt[posMem].posPrev = posMem - 1;
- if (p->opt[cur].prev2)
- {
- p->opt[posMem - 1].prev1IsChar = False;
- p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2;
- p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2;
- }
- }
- {
- UInt32 posPrev = posMem;
- UInt32 backCur = backMem;
-
- backMem = p->opt[posPrev].backPrev;
- posMem = p->opt[posPrev].posPrev;
-
- p->opt[posPrev].backPrev = backCur;
- p->opt[posPrev].posPrev = cur;
- cur = posPrev;
- }
- }
- while (cur != 0);
- *backRes = p->opt[0].backPrev;
- p->optimumCurrentIndex = p->opt[0].posPrev;
- return p->optimumCurrentIndex;
-}
-
-#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300)
-
-static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
-{
- UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur;
- UInt32 matchPrice, repMatchPrice, normalMatchPrice;
- UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS];
- UInt32 *matches;
- const Byte *data;
- Byte curByte, matchByte;
- if (p->optimumEndIndex != p->optimumCurrentIndex)
- {
- const COptimal *opt = &p->opt[p->optimumCurrentIndex];
- UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex;
- *backRes = opt->backPrev;
- p->optimumCurrentIndex = opt->posPrev;
- return lenRes;
- }
- p->optimumCurrentIndex = p->optimumEndIndex = 0;
-
- if (p->additionalOffset == 0)
- mainLen = ReadMatchDistances(p, &numPairs);
- else
- {
- mainLen = p->longestMatchLength;
- numPairs = p->numPairs;
- }
-
- numAvail = p->numAvail;
- if (numAvail < 2)
- {
- *backRes = (UInt32)(-1);
- return 1;
- }
- if (numAvail > LZMA_MATCH_LEN_MAX)
- numAvail = LZMA_MATCH_LEN_MAX;
-
- data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
- repMaxIndex = 0;
- for (i = 0; i < LZMA_NUM_REPS; i++)
- {
- UInt32 lenTest;
- const Byte *data2;
- reps[i] = p->reps[i];
- data2 = data - (reps[i] + 1);
- if (data[0] != data2[0] || data[1] != data2[1])
- {
- repLens[i] = 0;
- continue;
- }
- for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++);
- repLens[i] = lenTest;
- if (lenTest > repLens[repMaxIndex])
- repMaxIndex = i;
- }
- if (repLens[repMaxIndex] >= p->numFastBytes)
- {
- UInt32 lenRes;
- *backRes = repMaxIndex;
- lenRes = repLens[repMaxIndex];
- MovePos(p, lenRes - 1);
- return lenRes;
- }
-
- matches = p->matches;
- if (mainLen >= p->numFastBytes)
- {
- *backRes = matches[numPairs - 1] + LZMA_NUM_REPS;
- MovePos(p, mainLen - 1);
- return mainLen;
- }
- curByte = *data;
- matchByte = *(data - (reps[0] + 1));
-
- if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2)
- {
- *backRes = (UInt32)-1;
- return 1;
- }
-
- p->opt[0].state = (CState)p->state;
-
- posState = (position & p->pbMask);
-
- {
- const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
- p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) +
- (!IsCharState(p->state) ?
- LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) :
- LitEnc_GetPrice(probs, curByte, p->ProbPrices));
- }
-
- MakeAsChar(&p->opt[1]);
-
- matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]);
- repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]);
-
- if (matchByte == curByte)
- {
- UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState);
- if (shortRepPrice < p->opt[1].price)
- {
- p->opt[1].price = shortRepPrice;
- MakeAsShortRep(&p->opt[1]);
- }
- }
- lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]);
-
- if (lenEnd < 2)
- {
- *backRes = p->opt[1].backPrev;
- return 1;
- }
-
- p->opt[1].posPrev = 0;
- for (i = 0; i < LZMA_NUM_REPS; i++)
- p->opt[0].backs[i] = reps[i];
-
- len = lenEnd;
- do
- p->opt[len--].price = kInfinityPrice;
- while (len >= 2);
-
- for (i = 0; i < LZMA_NUM_REPS; i++)
- {
- UInt32 repLen = repLens[i];
- UInt32 price;
- if (repLen < 2)
- continue;
- price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState);
- do
- {
- UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2];
- COptimal *opt = &p->opt[repLen];
- if (curAndLenPrice < opt->price)
- {
- opt->price = curAndLenPrice;
- opt->posPrev = 0;
- opt->backPrev = i;
- opt->prev1IsChar = False;
- }
- }
- while (--repLen >= 2);
- }
-
- normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]);
-
- len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2);
- if (len <= mainLen)
- {
- UInt32 offs = 0;
- while (len > matches[offs])
- offs += 2;
- for (; ; len++)
- {
- COptimal *opt;
- UInt32 distance = matches[offs + 1];
-
- UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN];
- UInt32 lenToPosState = GetLenToPosState(len);
- if (distance < kNumFullDistances)
- curAndLenPrice += p->distancesPrices[lenToPosState][distance];
- else
- {
- UInt32 slot;
- GetPosSlot2(distance, slot);
- curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot];
- }
- opt = &p->opt[len];
- if (curAndLenPrice < opt->price)
- {
- opt->price = curAndLenPrice;
- opt->posPrev = 0;
- opt->backPrev = distance + LZMA_NUM_REPS;
- opt->prev1IsChar = False;
- }
- if (len == matches[offs])
- {
- offs += 2;
- if (offs == numPairs)
- break;
- }
- }
- }
-
- cur = 0;
-
- #ifdef SHOW_STAT2
- if (position >= 0)
- {
- unsigned i;
- printf("\n pos = %4X", position);
- for (i = cur; i <= lenEnd; i++)
- printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price);
- }
- #endif
-
- for (;;)
- {
- UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen;
- UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice;
- Bool nextIsChar;
- Byte curByte, matchByte;
- const Byte *data;
- COptimal *curOpt;
- COptimal *nextOpt;
-
- cur++;
- if (cur == lenEnd)
- return Backward(p, backRes, cur);
-
- newLen = ReadMatchDistances(p, &numPairs);
- if (newLen >= p->numFastBytes)
- {
- p->numPairs = numPairs;
- p->longestMatchLength = newLen;
- return Backward(p, backRes, cur);
- }
- position++;
- curOpt = &p->opt[cur];
- posPrev = curOpt->posPrev;
- if (curOpt->prev1IsChar)
- {
- posPrev--;
- if (curOpt->prev2)
- {
- state = p->opt[curOpt->posPrev2].state;
- if (curOpt->backPrev2 < LZMA_NUM_REPS)
- state = kRepNextStates[state];
- else
- state = kMatchNextStates[state];
- }
- else
- state = p->opt[posPrev].state;
- state = kLiteralNextStates[state];
- }
- else
- state = p->opt[posPrev].state;
- if (posPrev == cur - 1)
- {
- if (IsShortRep(curOpt))
- state = kShortRepNextStates[state];
- else
- state = kLiteralNextStates[state];
- }
- else
- {
- UInt32 pos;
- const COptimal *prevOpt;
- if (curOpt->prev1IsChar && curOpt->prev2)
- {
- posPrev = curOpt->posPrev2;
- pos = curOpt->backPrev2;
- state = kRepNextStates[state];
- }
- else
- {
- pos = curOpt->backPrev;
- if (pos < LZMA_NUM_REPS)
- state = kRepNextStates[state];
- else
- state = kMatchNextStates[state];
- }
- prevOpt = &p->opt[posPrev];
- if (pos < LZMA_NUM_REPS)
- {
- UInt32 i;
- reps[0] = prevOpt->backs[pos];
- for (i = 1; i <= pos; i++)
- reps[i] = prevOpt->backs[i - 1];
- for (; i < LZMA_NUM_REPS; i++)
- reps[i] = prevOpt->backs[i];
- }
- else
- {
- UInt32 i;
- reps[0] = (pos - LZMA_NUM_REPS);
- for (i = 1; i < LZMA_NUM_REPS; i++)
- reps[i] = prevOpt->backs[i - 1];
- }
- }
- curOpt->state = (CState)state;
-
- curOpt->backs[0] = reps[0];
- curOpt->backs[1] = reps[1];
- curOpt->backs[2] = reps[2];
- curOpt->backs[3] = reps[3];
-
- curPrice = curOpt->price;
- nextIsChar = False;
- data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
- curByte = *data;
- matchByte = *(data - (reps[0] + 1));
-
- posState = (position & p->pbMask);
-
- curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]);
- {
- const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
- curAnd1Price +=
- (!IsCharState(state) ?
- LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) :
- LitEnc_GetPrice(probs, curByte, p->ProbPrices));
- }
-
- nextOpt = &p->opt[cur + 1];
-
- if (curAnd1Price < nextOpt->price)
- {
- nextOpt->price = curAnd1Price;
- nextOpt->posPrev = cur;
- MakeAsChar(nextOpt);
- nextIsChar = True;
- }
-
- matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]);
- repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]);
-
- if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0))
- {
- UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState);
- if (shortRepPrice <= nextOpt->price)
- {
- nextOpt->price = shortRepPrice;
- nextOpt->posPrev = cur;
- MakeAsShortRep(nextOpt);
- nextIsChar = True;
- }
- }
- numAvailFull = p->numAvail;
- {
- UInt32 temp = kNumOpts - 1 - cur;
- if (temp < numAvailFull)
- numAvailFull = temp;
- }
-
- if (numAvailFull < 2)
- continue;
- numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes);
-
- if (!nextIsChar && matchByte != curByte) /* speed optimization */
- {
- /* try Literal + rep0 */
- UInt32 temp;
- UInt32 lenTest2;
- const Byte *data2 = data - (reps[0] + 1);
- UInt32 limit = p->numFastBytes + 1;
- if (limit > numAvailFull)
- limit = numAvailFull;
-
- for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++);
- lenTest2 = temp - 1;
- if (lenTest2 >= 2)
- {
- UInt32 state2 = kLiteralNextStates[state];
- UInt32 posStateNext = (position + 1) & p->pbMask;
- UInt32 nextRepMatchPrice = curAnd1Price +
- GET_PRICE_1(p->isMatch[state2][posStateNext]) +
- GET_PRICE_1(p->isRep[state2]);
- /* for (; lenTest2 >= 2; lenTest2--) */
- {
- UInt32 curAndLenPrice;
- COptimal *opt;
- UInt32 offset = cur + 1 + lenTest2;
- while (lenEnd < offset)
- p->opt[++lenEnd].price = kInfinityPrice;
- curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
- opt = &p->opt[offset];
- if (curAndLenPrice < opt->price)
- {
- opt->price = curAndLenPrice;
- opt->posPrev = cur + 1;
- opt->backPrev = 0;
- opt->prev1IsChar = True;
- opt->prev2 = False;
- }
- }
- }
- }
-
- startLen = 2; /* speed optimization */
- {
- UInt32 repIndex;
- for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++)
- {
- UInt32 lenTest;
- UInt32 lenTestTemp;
- UInt32 price;
- const Byte *data2 = data - (reps[repIndex] + 1);
- if (data[0] != data2[0] || data[1] != data2[1])
- continue;
- for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++);
- while (lenEnd < cur + lenTest)
- p->opt[++lenEnd].price = kInfinityPrice;
- lenTestTemp = lenTest;
- price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState);
- do
- {
- UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2];
- COptimal *opt = &p->opt[cur + lenTest];
- if (curAndLenPrice < opt->price)
- {
- opt->price = curAndLenPrice;
- opt->posPrev = cur;
- opt->backPrev = repIndex;
- opt->prev1IsChar = False;
- }
- }
- while (--lenTest >= 2);
- lenTest = lenTestTemp;
-
- if (repIndex == 0)
- startLen = lenTest + 1;
-
- /* if (_maxMode) */
- {
- UInt32 lenTest2 = lenTest + 1;
- UInt32 limit = lenTest2 + p->numFastBytes;
- UInt32 nextRepMatchPrice;
- if (limit > numAvailFull)
- limit = numAvailFull;
- for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
- lenTest2 -= lenTest + 1;
- if (lenTest2 >= 2)
- {
- UInt32 state2 = kRepNextStates[state];
- UInt32 posStateNext = (position + lenTest) & p->pbMask;
- UInt32 curAndLenCharPrice =
- price + p->repLenEnc.prices[posState][lenTest - 2] +
- GET_PRICE_0(p->isMatch[state2][posStateNext]) +
- LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]),
- data[lenTest], data2[lenTest], p->ProbPrices);
- state2 = kLiteralNextStates[state2];
- posStateNext = (position + lenTest + 1) & p->pbMask;
- nextRepMatchPrice = curAndLenCharPrice +
- GET_PRICE_1(p->isMatch[state2][posStateNext]) +
- GET_PRICE_1(p->isRep[state2]);
-
- /* for (; lenTest2 >= 2; lenTest2--) */
- {
- UInt32 curAndLenPrice;
- COptimal *opt;
- UInt32 offset = cur + lenTest + 1 + lenTest2;
- while (lenEnd < offset)
- p->opt[++lenEnd].price = kInfinityPrice;
- curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
- opt = &p->opt[offset];
- if (curAndLenPrice < opt->price)
- {
- opt->price = curAndLenPrice;
- opt->posPrev = cur + lenTest + 1;
- opt->backPrev = 0;
- opt->prev1IsChar = True;
- opt->prev2 = True;
- opt->posPrev2 = cur;
- opt->backPrev2 = repIndex;
- }
- }
- }
- }
- }
- }
- /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */
- if (newLen > numAvail)
- {
- newLen = numAvail;
- for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2);
- matches[numPairs] = newLen;
- numPairs += 2;
- }
- if (newLen >= startLen)
- {
- UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]);
- UInt32 offs, curBack, posSlot;
- UInt32 lenTest;
- while (lenEnd < cur + newLen)
- p->opt[++lenEnd].price = kInfinityPrice;
-
- offs = 0;
- while (startLen > matches[offs])
- offs += 2;
- curBack = matches[offs + 1];
- GetPosSlot2(curBack, posSlot);
- for (lenTest = /*2*/ startLen; ; lenTest++)
- {
- UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];
- UInt32 lenToPosState = GetLenToPosState(lenTest);
- COptimal *opt;
- if (curBack < kNumFullDistances)
- curAndLenPrice += p->distancesPrices[lenToPosState][curBack];
- else
- curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask];
-
- opt = &p->opt[cur + lenTest];
- if (curAndLenPrice < opt->price)
- {
- opt->price = curAndLenPrice;
- opt->posPrev = cur;
- opt->backPrev = curBack + LZMA_NUM_REPS;
- opt->prev1IsChar = False;
- }
-
- if (/*_maxMode && */lenTest == matches[offs])
- {
- /* Try Match + Literal + Rep0 */
- const Byte *data2 = data - (curBack + 1);
- UInt32 lenTest2 = lenTest + 1;
- UInt32 limit = lenTest2 + p->numFastBytes;
- UInt32 nextRepMatchPrice;
- if (limit > numAvailFull)
- limit = numAvailFull;
- for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
- lenTest2 -= lenTest + 1;
- if (lenTest2 >= 2)
- {
- UInt32 state2 = kMatchNextStates[state];
- UInt32 posStateNext = (position + lenTest) & p->pbMask;
- UInt32 curAndLenCharPrice = curAndLenPrice +
- GET_PRICE_0(p->isMatch[state2][posStateNext]) +
- LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]),
- data[lenTest], data2[lenTest], p->ProbPrices);
- state2 = kLiteralNextStates[state2];
- posStateNext = (posStateNext + 1) & p->pbMask;
- nextRepMatchPrice = curAndLenCharPrice +
- GET_PRICE_1(p->isMatch[state2][posStateNext]) +
- GET_PRICE_1(p->isRep[state2]);
-
- /* for (; lenTest2 >= 2; lenTest2--) */
- {
- UInt32 offset = cur + lenTest + 1 + lenTest2;
- UInt32 curAndLenPrice;
- COptimal *opt;
- while (lenEnd < offset)
- p->opt[++lenEnd].price = kInfinityPrice;
- curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
- opt = &p->opt[offset];
- if (curAndLenPrice < opt->price)
- {
- opt->price = curAndLenPrice;
- opt->posPrev = cur + lenTest + 1;
- opt->backPrev = 0;
- opt->prev1IsChar = True;
- opt->prev2 = True;
- opt->posPrev2 = cur;
- opt->backPrev2 = curBack + LZMA_NUM_REPS;
- }
- }
- }
- offs += 2;
- if (offs == numPairs)
- break;
- curBack = matches[offs + 1];
- if (curBack >= kNumFullDistances)
- GetPosSlot2(curBack, posSlot);
- }
- }
- }
- }
-}
-
-#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist))
-
-static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes)
-{
- UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i;
- const Byte *data;
- const UInt32 *matches;
-
- if (p->additionalOffset == 0)
- mainLen = ReadMatchDistances(p, &numPairs);
- else
- {
- mainLen = p->longestMatchLength;
- numPairs = p->numPairs;
- }
-
- numAvail = p->numAvail;
- *backRes = (UInt32)-1;
- if (numAvail < 2)
- return 1;
- if (numAvail > LZMA_MATCH_LEN_MAX)
- numAvail = LZMA_MATCH_LEN_MAX;
- data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
-
- repLen = repIndex = 0;
- for (i = 0; i < LZMA_NUM_REPS; i++)
- {
- UInt32 len;
- const Byte *data2 = data - (p->reps[i] + 1);
- if (data[0] != data2[0] || data[1] != data2[1])
- continue;
- for (len = 2; len < numAvail && data[len] == data2[len]; len++);
- if (len >= p->numFastBytes)
- {
- *backRes = i;
- MovePos(p, len - 1);
- return len;
- }
- if (len > repLen)
- {
- repIndex = i;
- repLen = len;
- }
- }
-
- matches = p->matches;
- if (mainLen >= p->numFastBytes)
- {
- *backRes = matches[numPairs - 1] + LZMA_NUM_REPS;
- MovePos(p, mainLen - 1);
- return mainLen;
- }
-
- mainDist = 0; /* for GCC */
- if (mainLen >= 2)
- {
- mainDist = matches[numPairs - 1];
- while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1)
- {
- if (!ChangePair(matches[numPairs - 3], mainDist))
- break;
- numPairs -= 2;
- mainLen = matches[numPairs - 2];
- mainDist = matches[numPairs - 1];
- }
- if (mainLen == 2 && mainDist >= 0x80)
- mainLen = 1;
- }
-
- if (repLen >= 2 && (
- (repLen + 1 >= mainLen) ||
- (repLen + 2 >= mainLen && mainDist >= (1 << 9)) ||
- (repLen + 3 >= mainLen && mainDist >= (1 << 15))))
- {
- *backRes = repIndex;
- MovePos(p, repLen - 1);
- return repLen;
- }
-
- if (mainLen < 2 || numAvail <= 2)
- return 1;
-
- p->longestMatchLength = ReadMatchDistances(p, &p->numPairs);
- if (p->longestMatchLength >= 2)
- {
- UInt32 newDistance = matches[p->numPairs - 1];
- if ((p->longestMatchLength >= mainLen && newDistance < mainDist) ||
- (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) ||
- (p->longestMatchLength > mainLen + 1) ||
- (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist)))
- return 1;
- }
-
- data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
- for (i = 0; i < LZMA_NUM_REPS; i++)
- {
- UInt32 len, limit;
- const Byte *data2 = data - (p->reps[i] + 1);
- if (data[0] != data2[0] || data[1] != data2[1])
- continue;
- limit = mainLen - 1;
- for (len = 2; len < limit && data[len] == data2[len]; len++);
- if (len >= limit)
- return 1;
- }
- *backRes = mainDist + LZMA_NUM_REPS;
- MovePos(p, mainLen - 2);
- return mainLen;
-}
-
-static void WriteEndMarker(CLzmaEnc *p, UInt32 posState)
-{
- UInt32 len;
- RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1);
- RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0);
- p->state = kMatchNextStates[p->state];
- len = LZMA_MATCH_LEN_MIN;
- LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
- RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1);
- RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits);
- RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask);
-}
-
-static SRes CheckErrors(CLzmaEnc *p)
-{
- if (p->result != SZ_OK)
- return p->result;
- if (p->rc.res != SZ_OK)
- p->result = SZ_ERROR_WRITE;
- if (p->matchFinderBase.result != SZ_OK)
- p->result = SZ_ERROR_READ;
- if (p->result != SZ_OK)
- p->finished = True;
- return p->result;
-}
-
-static SRes Flush(CLzmaEnc *p, UInt32 nowPos)
-{
- /* ReleaseMFStream(); */
- p->finished = True;
- if (p->writeEndMark)
- WriteEndMarker(p, nowPos & p->pbMask);
- RangeEnc_FlushData(&p->rc);
- RangeEnc_FlushStream(&p->rc);
- return CheckErrors(p);
-}
-
-static void FillAlignPrices(CLzmaEnc *p)
-{
- UInt32 i;
- for (i = 0; i < kAlignTableSize; i++)
- p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices);
- p->alignPriceCount = 0;
-}
-
-static void FillDistancesPrices(CLzmaEnc *p)
-{
- UInt32 tempPrices[kNumFullDistances];
- UInt32 i, lenToPosState;
- for (i = kStartPosModelIndex; i < kNumFullDistances; i++)
- {
- UInt32 posSlot = GetPosSlot1(i);
- UInt32 footerBits = ((posSlot >> 1) - 1);
- UInt32 base = ((2 | (posSlot & 1)) << footerBits);
- tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices);
- }
-
- for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++)
- {
- UInt32 posSlot;
- const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState];
- UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState];
- for (posSlot = 0; posSlot < p->distTableSize; posSlot++)
- posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices);
- for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++)
- posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits);
-
- {
- UInt32 *distancesPrices = p->distancesPrices[lenToPosState];
- UInt32 i;
- for (i = 0; i < kStartPosModelIndex; i++)
- distancesPrices[i] = posSlotPrices[i];
- for (; i < kNumFullDistances; i++)
- distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i];
- }
- }
- p->matchPriceCount = 0;
-}
-
-void LzmaEnc_Construct(CLzmaEnc *p)
-{
- RangeEnc_Construct(&p->rc);
- MatchFinder_Construct(&p->matchFinderBase);
- #ifdef COMPRESS_MF_MT
- MatchFinderMt_Construct(&p->matchFinderMt);
- p->matchFinderMt.MatchFinder = &p->matchFinderBase;
- #endif
-
- {
- CLzmaEncProps props;
- LzmaEncProps_Init(&props);
- LzmaEnc_SetProps(p, &props);
- }
-
- #ifndef LZMA_LOG_BSR
- LzmaEnc_FastPosInit(p->g_FastPos);
- #endif
-
- LzmaEnc_InitPriceTables(p->ProbPrices);
- p->litProbs = 0;
- p->saveState.litProbs = 0;
-}
-
-CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc)
-{
- void *p;
- p = alloc->Alloc(alloc, sizeof(CLzmaEnc));
- if (p != 0)
- LzmaEnc_Construct((CLzmaEnc *)p);
- return p;
-}
-
-void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
-{
- alloc->Free(alloc, p->litProbs);
- alloc->Free(alloc, p->saveState.litProbs);
- p->litProbs = 0;
- p->saveState.litProbs = 0;
-}
-
-void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
- #ifdef COMPRESS_MF_MT
- MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
- #endif
- MatchFinder_Free(&p->matchFinderBase, allocBig);
- LzmaEnc_FreeLits(p, alloc);
- RangeEnc_Free(&p->rc, alloc);
-}
-
-void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
- LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig);
- alloc->Free(alloc, p);
-}
-
-static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize)
-{
- UInt32 nowPos32, startPos32;
- if (p->inStream != 0)
- {
- p->matchFinderBase.stream = p->inStream;
- p->matchFinder.Init(p->matchFinderObj);
- p->inStream = 0;
- }
-
- if (p->finished)
- return p->result;
- RINOK(CheckErrors(p));
-
- nowPos32 = (UInt32)p->nowPos64;
- startPos32 = nowPos32;
-
- if (p->nowPos64 == 0)
- {
- UInt32 numPairs;
- Byte curByte;
- if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
- return Flush(p, nowPos32);
- ReadMatchDistances(p, &numPairs);
- RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0);
- p->state = kLiteralNextStates[p->state];
- curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset);
- LitEnc_Encode(&p->rc, p->litProbs, curByte);
- p->additionalOffset--;
- nowPos32++;
- }
-
- if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0)
- for (;;)
- {
- UInt32 pos, len, posState;
-
- if (p->fastMode)
- len = GetOptimumFast(p, &pos);
- else
- len = GetOptimum(p, nowPos32, &pos);
-
- #ifdef SHOW_STAT2
- printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos);
- #endif
-
- posState = nowPos32 & p->pbMask;
- if (len == 1 && pos == (UInt32)-1)
- {
- Byte curByte;
- CLzmaProb *probs;
- const Byte *data;
-
- RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0);
- data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
- curByte = *data;
- probs = LIT_PROBS(nowPos32, *(data - 1));
- if (IsCharState(p->state))
- LitEnc_Encode(&p->rc, probs, curByte);
- else
- LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1));
- p->state = kLiteralNextStates[p->state];
- }
- else
- {
- RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1);
- if (pos < LZMA_NUM_REPS)
- {
- RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1);
- if (pos == 0)
- {
- RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0);
- RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1));
- }
- else
- {
- UInt32 distance = p->reps[pos];
- RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1);
- if (pos == 1)
- RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0);
- else
- {
- RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1);
- RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2);
- if (pos == 3)
- p->reps[3] = p->reps[2];
- p->reps[2] = p->reps[1];
- }
- p->reps[1] = p->reps[0];
- p->reps[0] = distance;
- }
- if (len == 1)
- p->state = kShortRepNextStates[p->state];
- else
- {
- LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
- p->state = kRepNextStates[p->state];
- }
- }
- else
- {
- UInt32 posSlot;
- RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0);
- p->state = kMatchNextStates[p->state];
- LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
- pos -= LZMA_NUM_REPS;
- GetPosSlot(pos, posSlot);
- RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot);
-
- if (posSlot >= kStartPosModelIndex)
- {
- UInt32 footerBits = ((posSlot >> 1) - 1);
- UInt32 base = ((2 | (posSlot & 1)) << footerBits);
- UInt32 posReduced = pos - base;
-
- if (posSlot < kEndPosModelIndex)
- RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced);
- else
- {
- RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits);
- RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask);
- p->alignPriceCount++;
- }
- }
- p->reps[3] = p->reps[2];
- p->reps[2] = p->reps[1];
- p->reps[1] = p->reps[0];
- p->reps[0] = pos;
- p->matchPriceCount++;
- }
- }
- p->additionalOffset -= len;
- nowPos32 += len;
- if (p->additionalOffset == 0)
- {
- UInt32 processed;
- if (!p->fastMode)
- {
- if (p->matchPriceCount >= (1 << 7))
- FillDistancesPrices(p);
- if (p->alignPriceCount >= kAlignTableSize)
- FillAlignPrices(p);
- }
- if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
- break;
- processed = nowPos32 - startPos32;
- if (useLimits)
- {
- if (processed + kNumOpts + 300 >= maxUnpackSize ||
- RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize)
- break;
- }
- else if (processed >= (1 << 15))
- {
- p->nowPos64 += nowPos32 - startPos32;
- return CheckErrors(p);
- }
- }
- }
- p->nowPos64 += nowPos32 - startPos32;
- return Flush(p, nowPos32);
-}
-
-#define kBigHashDicLimit ((UInt32)1 << 24)
-
-static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
- UInt32 beforeSize = kNumOpts;
- Bool btMode;
- if (!RangeEnc_Alloc(&p->rc, alloc))
- return SZ_ERROR_MEM;
- btMode = (p->matchFinderBase.btMode != 0);
- #ifdef COMPRESS_MF_MT
- p->mtMode = (p->multiThread && !p->fastMode && btMode);
- #endif
-
- {
- unsigned lclp = p->lc + p->lp;
- if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp)
- {
- LzmaEnc_FreeLits(p, alloc);
- p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb));
- p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb));
- if (p->litProbs == 0 || p->saveState.litProbs == 0)
- {
- LzmaEnc_FreeLits(p, alloc);
- return SZ_ERROR_MEM;
- }
- p->lclp = lclp;
- }
- }
-
- p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit);
-
- if (beforeSize + p->dictSize < keepWindowSize)
- beforeSize = keepWindowSize - p->dictSize;
-
- #ifdef COMPRESS_MF_MT
- if (p->mtMode)
- {
- RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig));
- p->matchFinderObj = &p->matchFinderMt;
- MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder);
- }
- else
- #endif
- {
- if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig))
- return SZ_ERROR_MEM;
- p->matchFinderObj = &p->matchFinderBase;
- MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder);
- }
- return SZ_OK;
-}
-
-void LzmaEnc_Init(CLzmaEnc *p)
-{
- UInt32 i;
- p->state = 0;
- for (i = 0 ; i < LZMA_NUM_REPS; i++)
- p->reps[i] = 0;
-
- RangeEnc_Init(&p->rc);
-
-
- for (i = 0; i < kNumStates; i++)
- {
- UInt32 j;
- for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++)
- {
- p->isMatch[i][j] = kProbInitValue;
- p->isRep0Long[i][j] = kProbInitValue;
- }
- p->isRep[i] = kProbInitValue;
- p->isRepG0[i] = kProbInitValue;
- p->isRepG1[i] = kProbInitValue;
- p->isRepG2[i] = kProbInitValue;
- }
-
- {
- UInt32 num = 0x300 << (p->lp + p->lc);
- for (i = 0; i < num; i++)
- p->litProbs[i] = kProbInitValue;
- }
-
- {
- for (i = 0; i < kNumLenToPosStates; i++)
- {
- CLzmaProb *probs = p->posSlotEncoder[i];
- UInt32 j;
- for (j = 0; j < (1 << kNumPosSlotBits); j++)
- probs[j] = kProbInitValue;
- }
- }
- {
- for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++)
- p->posEncoders[i] = kProbInitValue;
- }
-
- LenEnc_Init(&p->lenEnc.p);
- LenEnc_Init(&p->repLenEnc.p);
-
- for (i = 0; i < (1 << kNumAlignBits); i++)
- p->posAlignEncoder[i] = kProbInitValue;
-
- p->optimumEndIndex = 0;
- p->optimumCurrentIndex = 0;
- p->additionalOffset = 0;
-
- p->pbMask = (1 << p->pb) - 1;
- p->lpMask = (1 << p->lp) - 1;
-}
-
-void LzmaEnc_InitPrices(CLzmaEnc *p)
-{
- if (!p->fastMode)
- {
- FillDistancesPrices(p);
- FillAlignPrices(p);
- }
-
- p->lenEnc.tableSize =
- p->repLenEnc.tableSize =
- p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN;
- LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices);
- LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices);
-}
-
-static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
- UInt32 i;
- for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++)
- if (p->dictSize <= ((UInt32)1 << i))
- break;
- p->distTableSize = i * 2;
-
- p->finished = False;
- p->result = SZ_OK;
- RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig));
- LzmaEnc_Init(p);
- LzmaEnc_InitPrices(p);
- p->nowPos64 = 0;
- return SZ_OK;
-}
-
-static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqInStream *inStream, ISeqOutStream *outStream,
- ISzAlloc *alloc, ISzAlloc *allocBig)
-{
- CLzmaEnc *p = (CLzmaEnc *)pp;
- p->inStream = inStream;
- p->rc.outStream = outStream;
- return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
-}
-
-SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
- ISeqInStream *inStream, UInt32 keepWindowSize,
- ISzAlloc *alloc, ISzAlloc *allocBig)
-{
- CLzmaEnc *p = (CLzmaEnc *)pp;
- p->inStream = inStream;
- return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
-}
-
-static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen)
-{
- p->seqBufInStream.funcTable.Read = MyRead;
- p->seqBufInStream.data = src;
- p->seqBufInStream.rem = srcLen;
-}
-
-SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
- UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
- CLzmaEnc *p = (CLzmaEnc *)pp;
- LzmaEnc_SetInputBuf(p, src, srcLen);
- p->inStream = &p->seqBufInStream.funcTable;
- return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
-}
-
-void LzmaEnc_Finish(CLzmaEncHandle pp)
-{
- #ifdef COMPRESS_MF_MT
- CLzmaEnc *p = (CLzmaEnc *)pp;
- if (p->mtMode)
- MatchFinderMt_ReleaseStream(&p->matchFinderMt);
- #else
- pp = pp;
- #endif
-}
-
-typedef struct _CSeqOutStreamBuf
-{
- ISeqOutStream funcTable;
- Byte *data;
- SizeT rem;
- Bool overflow;
-} CSeqOutStreamBuf;
-
-static size_t MyWrite(void *pp, const void *data, size_t size)
-{
- CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp;
- if (p->rem < size)
- {
- size = p->rem;
- p->overflow = True;
- }
- memcpy(p->data, data, size);
- p->rem -= size;
- p->data += size;
- return size;
-}
-
-
-UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
-{
- const CLzmaEnc *p = (CLzmaEnc *)pp;
- return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
-}
-
-const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
-{
- const CLzmaEnc *p = (CLzmaEnc *)pp;
- return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
-}
-
-SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
- Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
-{
- CLzmaEnc *p = (CLzmaEnc *)pp;
- UInt64 nowPos64;
- SRes res;
- CSeqOutStreamBuf outStream;
-
- outStream.funcTable.Write = MyWrite;
- outStream.data = dest;
- outStream.rem = *destLen;
- outStream.overflow = False;
-
- p->writeEndMark = False;
- p->finished = False;
- p->result = SZ_OK;
-
- if (reInit)
- LzmaEnc_Init(p);
- LzmaEnc_InitPrices(p);
- nowPos64 = p->nowPos64;
- RangeEnc_Init(&p->rc);
- p->rc.outStream = &outStream.funcTable;
-
- res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize);
-
- *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
- *destLen -= outStream.rem;
- if (outStream.overflow)
- return SZ_ERROR_OUTPUT_EOF;
-
- return res;
-}
-
-SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress,
- ISzAlloc *alloc, ISzAlloc *allocBig)
-{
- CLzmaEnc *p = (CLzmaEnc *)pp;
- SRes res = SZ_OK;
-
- #ifdef COMPRESS_MF_MT
- Byte allocaDummy[0x300]; (void)allocaDummy;
- int i = 0;
- for (i = 0; i < 16; i++)
- allocaDummy[i] = (Byte)i;
- #endif
-
- RINOK(LzmaEnc_Prepare(pp, inStream, outStream, alloc, allocBig));
-
- for (;;)
- {
- res = LzmaEnc_CodeOneBlock(p, False, 0, 0);
- if (res != SZ_OK || p->finished != 0)
- break;
- if (progress != 0)
- {
- res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc));
- if (res != SZ_OK)
- {
- res = SZ_ERROR_PROGRESS;
- break;
- }
- }
- }
- LzmaEnc_Finish(pp);
- return res;
-}
-
-SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
-{
- CLzmaEnc *p = (CLzmaEnc *)pp;
- int i;
- UInt32 dictSize = p->dictSize;
- if (*size < LZMA_PROPS_SIZE)
- return SZ_ERROR_PARAM;
- *size = LZMA_PROPS_SIZE;
- props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc);
-
- for (i = 11; i <= 30; i++)
- {
- if (dictSize <= ((UInt32)2 << i))
- {
- dictSize = (2 << i);
- break;
- }
- if (dictSize <= ((UInt32)3 << i))
- {
- dictSize = (3 << i);
- break;
- }
- }
-
- for (i = 0; i < 4; i++)
- props[1 + i] = (Byte)(dictSize >> (8 * i));
- return SZ_OK;
-}
-
-SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
- int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
- SRes res;
- CLzmaEnc *p = (CLzmaEnc *)pp;
-
- CSeqOutStreamBuf outStream;
-
- LzmaEnc_SetInputBuf(p, src, srcLen);
-
- outStream.funcTable.Write = MyWrite;
- outStream.data = dest;
- outStream.rem = *destLen;
- outStream.overflow = False;
-
- p->writeEndMark = writeEndMark;
- res = LzmaEnc_Encode(pp, &outStream.funcTable, &p->seqBufInStream.funcTable,
- progress, alloc, allocBig);
-
- *destLen -= outStream.rem;
- if (outStream.overflow)
- return SZ_ERROR_OUTPUT_EOF;
- return res;
-}
-
-SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
- const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
-{
- CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc);
- SRes res;
- if (p == 0)
- return SZ_ERROR_MEM;
-
- res = LzmaEnc_SetProps(p, props);
- if (res == SZ_OK)
- {
- res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize);
- if (res == SZ_OK)
- res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen,
- writeEndMark, progress, alloc, allocBig);
- }
-
- LzmaEnc_Destroy(p, alloc, allocBig);
- return res;
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaEnc.h b/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaEnc.h
deleted file mode 100644
index 8b547508..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaEnc.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* LzmaEnc.h -- LZMA Encoder
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __LZMAENC_H
-#define __LZMAENC_H
-
-#include "lzma_Types.h"
-
-namespace crnlib {
-
-#define LZMA_PROPS_SIZE 5
-
-typedef struct _CLzmaEncProps
-{
- int level; /* 0 <= level <= 9 */
- UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
- (1 << 12) <= dictSize <= (1 << 30) for 64-bit version
- default = (1 << 24) */
- int lc; /* 0 <= lc <= 8, default = 3 */
- int lp; /* 0 <= lp <= 4, default = 0 */
- int pb; /* 0 <= pb <= 4, default = 2 */
- int algo; /* 0 - fast, 1 - normal, default = 1 */
- int fb; /* 5 <= fb <= 273, default = 32 */
- int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
- int numHashBytes; /* 2, 3 or 4, default = 4 */
- UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */
- unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
- int numThreads; /* 1 or 2, default = 2 */
-} CLzmaEncProps;
-
-void LzmaEncProps_Init(CLzmaEncProps *p);
-void LzmaEncProps_Normalize(CLzmaEncProps *p);
-UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
-
-
-/* ---------- CLzmaEncHandle Interface ---------- */
-
-/* LzmaEnc_* functions can return the following exit codes:
-Returns:
- SZ_OK - OK
- SZ_ERROR_MEM - Memory allocation error
- SZ_ERROR_PARAM - Incorrect paramater in props
- SZ_ERROR_WRITE - Write callback error.
- SZ_ERROR_PROGRESS - some break from progress callback
- SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
-*/
-
-typedef void * CLzmaEncHandle;
-
-CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc);
-void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
-SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
-SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
-SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
-SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
- int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
-
-/* ---------- One Call Interface ---------- */
-
-/* LzmaEncode
-Return code:
- SZ_OK - OK
- SZ_ERROR_MEM - Memory allocation error
- SZ_ERROR_PARAM - Incorrect paramater
- SZ_ERROR_OUTPUT_EOF - output buffer overflow
- SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
-*/
-
-SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
- const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
-
-}
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaLib.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaLib.cpp
deleted file mode 100644
index 9b8eb156..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaLib.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/* LzmaLib.c -- LZMA library wrapper
-2008-08-05
-Igor Pavlov
-Public domain */
-#include "crn_core.h"
-#include "lzma_LzmaEnc.h"
-#include "lzma_LzmaDec.h"
-#include "lzma_Alloc.h"
-#include "lzma_LzmaLib.h"
-
-namespace crnlib {
-
-static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
-static void SzFree(void *p, void *address) { p = p; MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
- unsigned char *outProps, size_t *outPropsSize,
- int level, /* 0 <= level <= 9, default = 5 */
- unsigned dictSize, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */
- int lc, /* 0 <= lc <= 8, default = 3 */
- int lp, /* 0 <= lp <= 4, default = 0 */
- int pb, /* 0 <= pb <= 4, default = 2 */
- int fb, /* 5 <= fb <= 273, default = 32 */
- int numThreads /* 1 or 2, default = 2 */
-)
-{
- CLzmaEncProps props;
- LzmaEncProps_Init(&props);
- props.level = level;
- props.dictSize = dictSize;
- props.lc = lc;
- props.lp = lp;
- props.pb = pb;
- props.fb = fb;
- props.numThreads = numThreads;
-
- return LzmaEncode(dest, destLen, src, srcLen, &props, outProps, outPropsSize, 0,
- NULL, &g_Alloc, &g_Alloc);
-}
-
-
-MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen,
- const unsigned char *props, size_t propsSize)
-{
- ELzmaStatus status;
- return LzmaDecode(dest, destLen, src, srcLen, props, (unsigned)propsSize, LZMA_FINISH_ANY, &status, &g_Alloc);
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaLib.h b/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaLib.h
deleted file mode 100644
index ee18e6d3..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_LzmaLib.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* LzmaLib.h -- LZMA library interface
-2008-08-05
-Igor Pavlov
-Public domain */
-
-#ifndef __LZMALIB_H
-#define __LZMALIB_H
-
-#include "lzma_Types.h"
-
-namespace crnlib {
-
-#if 0
-#ifdef __cplusplus
- #define MY_EXTERN_C extern "C"
-#else
- #define MY_EXTERN_C extern
-#endif
-
-#define MY_STDAPI MY_EXTERN_C int MY_STD_CALL
-#else
-#define MY_STDAPI int MY_STD_CALL
-#endif
-
-#define LZMA_PROPS_SIZE 5
-
-/*
-RAM requirements for LZMA:
- for compression: (dictSize * 11.5 + 6 MB) + state_size
- for decompression: dictSize + state_size
- state_size = (4 + (1.5 << (lc + lp))) KB
- by default (lc=3, lp=0), state_size = 16 KB.
-
-LZMA properties (5 bytes) format
- Offset Size Description
- 0 1 lc, lp and pb in encoded form.
- 1 4 dictSize (little endian).
-*/
-
-/*
-LzmaCompress
-------------
-
-outPropsSize -
- In: the pointer to the size of outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
- Out: the pointer to the size of written properties in outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
-
- LZMA Encoder will use defult values for any parameter, if it is
- -1 for any from: level, loc, lp, pb, fb, numThreads
- 0 for dictSize
-
-level - compression level: 0 <= level <= 9;
-
- level dictSize algo fb
- 0: 16 KB 0 32
- 1: 64 KB 0 32
- 2: 256 KB 0 32
- 3: 1 MB 0 32
- 4: 4 MB 0 32
- 5: 16 MB 1 32
- 6: 32 MB 1 32
- 7+: 64 MB 1 64
-
- The default value for "level" is 5.
-
- algo = 0 means fast method
- algo = 1 means normal method
-
-dictSize - The dictionary size in bytes. The maximum value is
- 128 MB = (1 << 27) bytes for 32-bit version
- 1 GB = (1 << 30) bytes for 64-bit version
- The default value is 16 MB = (1 << 24) bytes.
- It's recommended to use the dictionary that is larger than 4 KB and
- that can be calculated as (1 << N) or (3 << N) sizes.
-
-lc - The number of literal context bits (high bits of previous literal).
- It can be in the range from 0 to 8. The default value is 3.
- Sometimes lc=4 gives the gain for big files.
-
-lp - The number of literal pos bits (low bits of current position for literals).
- It can be in the range from 0 to 4. The default value is 0.
- The lp switch is intended for periodical data when the period is equal to 2^lp.
- For example, for 32-bit (4 bytes) periodical data you can use lp=2. Often it's
- better to set lc=0, if you change lp switch.
-
-pb - The number of pos bits (low bits of current position).
- It can be in the range from 0 to 4. The default value is 2.
- The pb switch is intended for periodical data when the period is equal 2^pb.
-
-fb - Word size (the number of fast bytes).
- It can be in the range from 5 to 273. The default value is 32.
- Usually, a big number gives a little bit better compression ratio and
- slower compression process.
-
-numThreads - The number of thereads. 1 or 2. The default value is 2.
- Fast mode (algo = 0) can use only 1 thread.
-
-Out:
- destLen - processed output size
-Returns:
- SZ_OK - OK
- SZ_ERROR_MEM - Memory allocation error
- SZ_ERROR_PARAM - Incorrect paramater
- SZ_ERROR_OUTPUT_EOF - output buffer overflow
- SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
-*/
-
-MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
- unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */
- int level, /* 0 <= level <= 9, default = 5 */
- unsigned dictSize, /* default = (1 << 24) */
- int lc, /* 0 <= lc <= 8, default = 3 */
- int lp, /* 0 <= lp <= 4, default = 0 */
- int pb, /* 0 <= pb <= 4, default = 2 */
- int fb, /* 5 <= fb <= 273, default = 32 */
- int numThreads /* 1 or 2, default = 2 */
- );
-
-/*
-LzmaUncompress
---------------
-In:
- dest - output data
- destLen - output data size
- src - input data
- srcLen - input data size
-Out:
- destLen - processed output size
- srcLen - processed input size
-Returns:
- SZ_OK - OK
- SZ_ERROR_DATA - Data error
- SZ_ERROR_MEM - Memory allocation arror
- SZ_ERROR_UNSUPPORTED - Unsupported properties
- SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer (src)
-*/
-
-MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,
- const unsigned char *props, size_t propsSize);
-
-#define LZMA_COMPRESS_FUNC_EXPORT "LzmaCompress"
-#define LZMA_UNCOMPRESS_FUNC_EXPORT "LzmaUncompress"
-
-}
-
-#endif
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_MyVersion.h b/Libraries/crunch-ea9b8d/crnlib/lzma_MyVersion.h
deleted file mode 100644
index 07e27917..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_MyVersion.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#define MY_VER_MAJOR 4
-#define MY_VER_MINOR 63
-#define MY_VER_BUILD 0
-#define MY_VERSION "4.63"
-#define MY_7ZIP_VERSION "7-Zip 4.63"
-#define MY_DATE "2008-12-31"
-#define MY_COPYRIGHT "Copyright (c) 1999-2008 Igor Pavlov"
-#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_Threads.cpp b/Libraries/crunch-ea9b8d/crnlib/lzma_Threads.cpp
deleted file mode 100644
index 8d556724..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_Threads.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Threads.c -- multithreading library
-2008-08-05
-Igor Pavlov
-Public domain */
-#include "crn_core.h"
-#include "lzma_Threads.h"
-#include <process.h>
-
-namespace crnlib {
-
-static WRes GetError()
-{
- DWORD res = GetLastError();
- return (res) ? (WRes)(res) : 1;
-}
-
-WRes HandleToWRes(HANDLE h) { return (h != 0) ? 0 : GetError(); }
-WRes BOOLToWRes(BOOL v) { return v ? 0 : GetError(); }
-
-static WRes MyCloseHandle(HANDLE *h)
-{
- if (*h != NULL)
- if (!CloseHandle(*h))
- return GetError();
- *h = NULL;
- return 0;
-}
-
-WRes Thread_Create(CThread *thread, THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter)
-{
- unsigned threadId; /* Windows Me/98/95: threadId parameter may not be NULL in _beginthreadex/CreateThread functions */
- thread->handle =
- /* CreateThread(0, 0, startAddress, parameter, 0, &threadId); */
- (HANDLE)_beginthreadex(NULL, 0, startAddress, parameter, 0, &threadId);
- /* maybe we must use errno here, but probably GetLastError() is also OK. */
- return HandleToWRes(thread->handle);
-}
-
-WRes WaitObject(HANDLE h)
-{
- return (WRes)WaitForSingleObject(h, INFINITE);
-}
-
-WRes Thread_Wait(CThread *thread)
-{
- if (thread->handle == NULL)
- return 1;
- return WaitObject(thread->handle);
-}
-
-WRes Thread_Close(CThread *thread)
-{
- return MyCloseHandle(&thread->handle);
-}
-
-WRes Event_Create(CEvent *p, BOOL manualReset, int initialSignaled)
-{
- p->handle = CreateEvent(NULL, manualReset, (initialSignaled ? TRUE : FALSE), NULL);
- return HandleToWRes(p->handle);
-}
-
-WRes ManualResetEvent_Create(CManualResetEvent *p, int initialSignaled)
- { return Event_Create(p, TRUE, initialSignaled); }
-WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *p)
- { return ManualResetEvent_Create(p, 0); }
-
-WRes AutoResetEvent_Create(CAutoResetEvent *p, int initialSignaled)
- { return Event_Create(p, FALSE, initialSignaled); }
-WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *p)
- { return AutoResetEvent_Create(p, 0); }
-
-WRes Event_Set(CEvent *p) { return BOOLToWRes(SetEvent(p->handle)); }
-WRes Event_Reset(CEvent *p) { return BOOLToWRes(ResetEvent(p->handle)); }
-WRes Event_Wait(CEvent *p) { return WaitObject(p->handle); }
-WRes Event_Close(CEvent *p) { return MyCloseHandle(&p->handle); }
-
-
-WRes Semaphore_Create(CSemaphore *p, UInt32 initiallyCount, UInt32 maxCount)
-{
- p->handle = CreateSemaphore(NULL, (LONG)initiallyCount, (LONG)maxCount, NULL);
- return HandleToWRes(p->handle);
-}
-
-WRes Semaphore_Release(CSemaphore *p, LONG releaseCount, LONG *previousCount)
-{
- return BOOLToWRes(ReleaseSemaphore(p->handle, releaseCount, previousCount));
-}
-WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 releaseCount)
-{
- return Semaphore_Release(p, (LONG)releaseCount, NULL);
-}
-WRes Semaphore_Release1(CSemaphore *p)
-{
- return Semaphore_ReleaseN(p, 1);
-}
-
-WRes Semaphore_Wait(CSemaphore *p) { return WaitObject(p->handle); }
-WRes Semaphore_Close(CSemaphore *p) { return MyCloseHandle(&p->handle); }
-
-WRes CriticalSection_Init(CCriticalSection *p)
-{
-#ifdef _MSC_VER
- /* InitializeCriticalSection can raise only STATUS_NO_MEMORY exception */
- __try
- {
- InitializeCriticalSection(p);
- /* InitializeCriticalSectionAndSpinCount(p, 0); */
- }
- __except (EXCEPTION_EXECUTE_HANDLER) { return 1; }
-#else
- InitializeCriticalSection(p);
-#endif
- return 0;
-}
-
-}
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_Threads.h b/Libraries/crunch-ea9b8d/crnlib/lzma_Threads.h
deleted file mode 100644
index e0aa9141..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_Threads.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Threads.h -- multithreading library
-2008-11-22 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_THRESDS_H
-#define __7Z_THRESDS_H
-
-#include "lzma_Types.h"
-
-namespace crnlib {
-
-typedef struct _CThread
-{
- HANDLE handle;
-} CThread;
-
-#define Thread_Construct(thread) (thread)->handle = NULL
-#define Thread_WasCreated(thread) ((thread)->handle != NULL)
-
-typedef unsigned THREAD_FUNC_RET_TYPE;
-#define THREAD_FUNC_CALL_TYPE MY_STD_CALL
-#define THREAD_FUNC_DECL THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE
-
-WRes Thread_Create(CThread *thread, THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter);
-WRes Thread_Wait(CThread *thread);
-WRes Thread_Close(CThread *thread);
-
-typedef struct _CEvent
-{
- HANDLE handle;
-} CEvent;
-
-typedef CEvent CAutoResetEvent;
-typedef CEvent CManualResetEvent;
-
-#define Event_Construct(event) (event)->handle = NULL
-#define Event_IsCreated(event) ((event)->handle != NULL)
-
-WRes ManualResetEvent_Create(CManualResetEvent *event, int initialSignaled);
-WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *event);
-WRes AutoResetEvent_Create(CAutoResetEvent *event, int initialSignaled);
-WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *event);
-WRes Event_Set(CEvent *event);
-WRes Event_Reset(CEvent *event);
-WRes Event_Wait(CEvent *event);
-WRes Event_Close(CEvent *event);
-
-
-typedef struct _CSemaphore
-{
- HANDLE handle;
-} CSemaphore;
-
-#define Semaphore_Construct(p) (p)->handle = NULL
-
-WRes Semaphore_Create(CSemaphore *p, UInt32 initiallyCount, UInt32 maxCount);
-WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 num);
-WRes Semaphore_Release1(CSemaphore *p);
-WRes Semaphore_Wait(CSemaphore *p);
-WRes Semaphore_Close(CSemaphore *p);
-
-
-typedef CRITICAL_SECTION CCriticalSection;
-
-WRes CriticalSection_Init(CCriticalSection *p);
-#define CriticalSection_Delete(p) DeleteCriticalSection(p)
-#define CriticalSection_Enter(p) EnterCriticalSection(p)
-#define CriticalSection_Leave(p) LeaveCriticalSection(p)
-
-}
-
-#endif
-
diff --git a/Libraries/crunch-ea9b8d/crnlib/lzma_Types.h b/Libraries/crunch-ea9b8d/crnlib/lzma_Types.h
deleted file mode 100644
index d321124e..00000000
--- a/Libraries/crunch-ea9b8d/crnlib/lzma_Types.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/* Types.h -- Basic types
-2008-11-23 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_TYPES_H
-#define __7Z_TYPES_H
-
-#include <stddef.h>
-
-#if defined( _WIN32 )
-#include <windows.h>
-#define COMPRESS_MF_MT
-#endif
-
-namespace crnlib {
-
-#define SZ_OK 0
-
-#define SZ_ERROR_DATA 1
-#define SZ_ERROR_MEM 2
-#define SZ_ERROR_CRC 3
-#define SZ_ERROR_UNSUPPORTED 4
-#define SZ_ERROR_PARAM 5
-#define SZ_ERROR_INPUT_EOF 6
-#define SZ_ERROR_OUTPUT_EOF 7
-#define SZ_ERROR_READ 8
-#define SZ_ERROR_WRITE 9
-#define SZ_ERROR_PROGRESS 10
-#define SZ_ERROR_FAIL 11
-#define SZ_ERROR_THREAD 12
-
-#define SZ_ERROR_ARCHIVE 16
-#define SZ_ERROR_NO_ARCHIVE 17
-
-typedef int SRes;
-
-#ifdef _WIN32
-typedef DWORD WRes;
-#else
-typedef int WRes;
-#endif
-
-#ifndef RINOK
-#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
-#endif
-
-typedef unsigned char Byte;
-typedef short Int16;
-typedef unsigned short UInt16;
-
-#ifdef _LZMA_UINT32_IS_ULONG
-typedef long Int32;
-typedef unsigned long UInt32;
-#else
-typedef int Int32;
-typedef unsigned int UInt32;
-#endif
-
-#ifdef _SZ_NO_INT_64
-
-/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
- NOTES: Some code will work incorrectly in that case! */
-
-typedef long Int64;
-typedef unsigned long UInt64;
-
-#else
-
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-typedef __int64 Int64;
-typedef unsigned __int64 UInt64;
-#else
-typedef long long int Int64;
-typedef unsigned long long int UInt64;
-#endif
-
-#endif
-
-#ifdef _LZMA_NO_SYSTEM_SIZE_T
-typedef UInt32 SizeT;
-#else
-typedef size_t SizeT;
-#endif
-
-typedef int Bool;
-#define True 1
-#define False 0
-
-
-#ifdef _MSC_VER
-
-#if _MSC_VER >= 1300
-#define MY_NO_INLINE __declspec(noinline)
-#else
-#define MY_NO_INLINE
-#endif
-
-#define MY_CDECL __cdecl
-#define MY_STD_CALL __stdcall
-#define MY_FAST_CALL MY_NO_INLINE __fastcall
-
-#else
-
-#define MY_CDECL
-#define MY_STD_CALL
-#define MY_FAST_CALL
-
-#endif
-
-
-/* The following interfaces use first parameter as pointer to structure */
-
-typedef struct
-{
- SRes (*Read)(void *p, void *buf, size_t *size);
- /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
- (output(*size) < input(*size)) is allowed */
-} ISeqInStream;
-
-/* it can return SZ_ERROR_INPUT_EOF */
-SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
-SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
-SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf);
-
-typedef struct
-{
- size_t (*Write)(void *p, const void *buf, size_t size);
- /* Returns: result - the number of actually written bytes.
- (result < size) means error */
-} ISeqOutStream;
-
-typedef enum
-{
- SZ_SEEK_SET = 0,
- SZ_SEEK_CUR = 1,
- SZ_SEEK_END = 2
-} ESzSeek;
-
-typedef struct
-{
- SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
- SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
-} ISeekInStream;
-
-typedef struct
-{
- SRes (*Look)(void *p, void **buf, size_t *size);
- /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
- (output(*size) > input(*size)) is not allowed
- (output(*size) < input(*size)) is allowed */
- SRes (*Skip)(void *p, size_t offset);
- /* offset must be <= output(*size) of Look */
-
- SRes (*Read)(void *p, void *buf, size_t *size);
- /* reads directly (without buffer). It's same as ISeqInStream::Read */
- SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
-} ILookInStream;
-
-SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
-SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset);
-
-/* reads via ILookInStream::Read */
-SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
-SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
-
-#define LookToRead_BUF_SIZE (1 << 14)
-
-typedef struct
-{
- ILookInStream s;
- ISeekInStream *realStream;
- size_t pos;
- size_t size;
- Byte buf[LookToRead_BUF_SIZE];
-} CLookToRead;
-
-void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
-void LookToRead_Init(CLookToRead *p);
-
-typedef struct
-{
- ISeqInStream s;
- ILookInStream *realStream;
-} CSecToLook;
-
-void SecToLook_CreateVTable(CSecToLook *p);
-
-typedef struct
-{
- ISeqInStream s;
- ILookInStream *realStream;
-} CSecToRead;
-
-void SecToRead_CreateVTable(CSecToRead *p);
-
-typedef struct
-{
- SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
- /* Returns: result. (result != SZ_OK) means break.
- Value (UInt64)(Int64)-1 for size means unknown value. */
-} ICompressProgress;
-
-typedef struct
-{
- void *(*Alloc)(void *p, size_t size);
- void (*Free)(void *p, void *address); /* address can be 0 */
-} ISzAlloc;
-
-#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
-#define IAlloc_Free(p, a) (p)->Free((p), a)
-
-}
-
-#endif
-
diff --git a/Libraries/crunch-ea9b8d/crunch/corpus_gen.cpp b/Libraries/crunch-ea9b8d/crunch/corpus_gen.cpp
deleted file mode 100644
index 792e57d6..00000000
--- a/Libraries/crunch-ea9b8d/crunch/corpus_gen.cpp
+++ /dev/null
@@ -1,357 +0,0 @@
-// File: corpus_gen.cpp - Block compression corpus generator.
-// See Copyright Notice and license at the end of inc/crnlib.h
-//
-// Example command line:
-// -gentest [-deep] [-blockpercentage .035] [-width 4096] [-height 4096] -in c:\temp\*.jpg [-in c:\temp\*.jpeg] [-in @blah.txt]
-#include "crn_core.h"
-#include "corpus_gen.h"
-#include "crn_console.h"
-
-#include "crn_find_files.h"
-#include "crn_file_utils.h"
-#include "crn_command_line_params.h"
-
-#include "crn_dxt.h"
-#include "crn_cfile_stream.h"
-#include "crn_texture_conversion.h"
-#include "crn_radix_sort.h"
-
-#define CRND_HEADER_FILE_ONLY
-#include "crn_decomp.h"
-
-namespace crnlib
-{
- struct block
- {
- color_quad_u8 m_c[4*4];
-
- inline operator size_t() const { return fast_hash(this, sizeof(*this)); }
-
- inline bool operator== (const block& rhs) const
- {
- return memcmp(this, &rhs, sizeof(*this)) == 0;
- }
- };
-
- typedef crnlib::hash_map<block, empty_type> block_hash_map;
-
- corpus_gen::corpus_gen()
- {
-
-
- }
-
- void corpus_gen::sort_blocks(image_u8& img)
- {
- const uint num_blocks_x = img.get_width() / 4;
- const uint num_blocks_y = img.get_height() / 4;
- const uint total_blocks = num_blocks_x * num_blocks_y;
-
- console::printf("Sorting %u blocks...", total_blocks);
-
- crnlib::vector<float> block_std_dev(total_blocks);
-
- for (uint by = 0; by < num_blocks_y; by++)
- {
- for (uint bx = 0; bx < num_blocks_x; bx++)
- {
- color_quad_u8 c[4 * 4];
-
- for (uint y = 0; y < 4; y++)
- for (uint x = 0; x < 4; x++)
- c[x+y*4] = img(bx*4+x, by*4+y);
-
- double std_dev = 0.0f;
- for (uint i = 0; i < 3; i++)
- std_dev += image_utils::compute_std_dev(16, c, i, 1);
-
- block_std_dev[bx + by * num_blocks_x] = (float)std_dev;
- }
- }
-
- crnlib::vector<uint> block_indices0(total_blocks);
- crnlib::vector<uint> block_indices1(total_blocks);
-
- const uint* pIndices = indirect_radix_sort(total_blocks, &block_indices0[0], &block_indices1[0], &block_std_dev[0], 0, sizeof(float), true);
-
- image_u8 new_img(img.get_width(), img.get_height());
-
- uint dst_block_index = 0;
-
- //float prev_std_dev = -999;
- for (uint i = 0; i < total_blocks; i++)
- {
- uint src_block_index = pIndices[i];
-
- //float std_dev = block_std_dev[src_block_index];
- //crnlib_ASSERT(std_dev >= prev_std_dev);
- //prev_std_dev = std_dev;
-
- uint src_block_x = src_block_index % num_blocks_x;
- uint src_block_y = src_block_index / num_blocks_x;
-
- uint dst_block_x = dst_block_index % num_blocks_x;
- uint dst_block_y = dst_block_index / num_blocks_x;
-
- new_img.unclipped_blit(src_block_x * 4, src_block_y * 4, 4, 4, dst_block_x * 4, dst_block_y * 4, img);
-
- dst_block_index++;
- }
-
-#if 0
- //new_img.swap(img);
-#else
- crnlib::vector<uint> remaining_blocks(num_blocks_x);
-
- console::printf("Arranging %u blocks...", total_blocks);
-
- for (uint by = 0; by < num_blocks_y; by++)
- {
- console::printf("%u of %u", by, num_blocks_y);
-
- remaining_blocks.resize(num_blocks_x);
- for (uint i = 0; i < num_blocks_x; i++)
- remaining_blocks[i] = i;
-
- color_quad_u8 match_block[16];
- utils::zero_object(match_block);
- for (uint bx = 0; bx < num_blocks_x; bx++)
- {
- uint best_index = 0;
-
- uint64 best_error = cUINT64_MAX;
-
- for (uint i = 0; i < remaining_blocks.size(); i++)
- {
- uint src_block_index = remaining_blocks[i];
-
- uint64 error = 0;
- for (uint y = 0; y < 4; y++)
- {
- for (uint x = 0; x < 4; x++)
- {
- const color_quad_u8& c = new_img(src_block_index*4+x, by*4+y);
- error += color::elucidian_distance(c, match_block[x+y*4], false);
- }
- }
-
- if (error < best_error)
- {
- best_error = error;
- best_index = i;
- }
- }
-
- uint src_block_index = remaining_blocks[best_index];
-
- for (uint y = 0; y < 4; y++)
- {
- for (uint x = 0; x < 4; x++)
- {
- const color_quad_u8& c = new_img(src_block_index*4+x, by*4+y);
- match_block[x+y*4] = c;
-
- img(bx * 4 + x, by * 4 + y) = c;
- }
- }
-
- remaining_blocks.erase_unordered(best_index);
- }
- }
-#endif
- }
-
- bool corpus_gen::generate(const char* pCmd_line)
- {
- static const command_line_params::param_desc param_desc_array[] =
- {
- { "corpus_gen", 0, false },
- { "in", 1, true },
- { "deep", 0, false },
- { "blockpercentage", 1, false },
- { "width", 1, false },
- { "height", 1, false },
- { "alpha", 0, false },
- };
-
- command_line_params params;
- if (!params.parse(pCmd_line, CRNLIB_ARRAY_SIZE(param_desc_array), param_desc_array, true))
- return false;
-
- if (!params.has_key("in"))
- {
- console::error("Must specify one or more input files using the /in option!");
- return false;
- }
-
- uint num_dst_blocks_x = params.get_value_as_int("width", 0, 4096, 128, 4096);
- num_dst_blocks_x = (num_dst_blocks_x + 3) / 4;
- uint num_dst_blocks_y = params.get_value_as_int("height", 0, 4096, 128, 4096);
- num_dst_blocks_y = (num_dst_blocks_y + 3) / 4;
-
- const uint total_dst_blocks = num_dst_blocks_x * num_dst_blocks_y;
- image_u8 dst_img(num_dst_blocks_x * 4, num_dst_blocks_y * 4);
- uint next_dst_block = 0;
- uint total_dst_images = 0;
-
- random rm;
-
- block_hash_map block_hash;
- block_hash.reserve(total_dst_blocks);
-
- uint total_images_loaded = 0;
- uint total_blocks_written = 0;
-
- command_line_params::param_map_const_iterator it = params.begin();
- for ( ; it != params.end(); ++it)
- {
- if (it->first != "in")
- continue;
- if (it->second.m_values.empty())
- {
- console::error("Must follow /in parameter with a filename!\n");
- return false;
- }
-
- for (uint in_value_index = 0; in_value_index < it->second.m_values.size(); in_value_index++)
- {
- const dynamic_string& filespec = it->second.m_values[in_value_index];
-
- find_files file_finder;
- if (!file_finder.find(filespec.get_ptr(), find_files::cFlagAllowFiles | (params.has_key("deep") ? find_files::cFlagRecursive : 0)))
- {
- console::warning("Failed finding files: %s", filespec.get_ptr());
- continue;
- }
-
- if (file_finder.get_files().empty())
- {
- console::warning("No files found: %s", filespec.get_ptr());
- return false;
- }
-
- const find_files::file_desc_vec& files = file_finder.get_files();
-
- for (uint file_index = 0; file_index < files.size(); file_index++)
- {
- const find_files::file_desc& file_desc = files[file_index];
-
- console::printf("Loading image: %s", file_desc.m_fullname.get_ptr());
-
- image_u8 img;
- if (!image_utils::read_from_file(img, file_desc.m_fullname.get_ptr(), 0))
- {
- console::warning("Failed loading image file: %s", file_desc.m_fullname.get_ptr());
- continue;
- }
-
- if (!params.has_key("alpha"))
- {
- for (uint y = 0; y < img.get_height(); y++)
- for (uint x = 0; x < img.get_width(); x++)
- img(x, y).a = 255;
- }
-
- total_images_loaded++;
-
- uint width = img.get_width();
- uint height = img.get_height();
-
- uint num_blocks_x = (width + 3) / 4;
- uint num_blocks_y = (height + 3) / 4;
- uint total_blocks = num_blocks_x * num_blocks_y;
-
- float percentage = params.get_value_as_float("blockpercentage", 0, .1f, .001f, 1.0f);
- uint total_rand_blocks = math::maximum<uint>(1U, (uint)(total_blocks * percentage));
-
- crnlib::vector<uint> remaining_blocks(total_blocks);
- for (uint i = 0; i < total_blocks; i++)
- remaining_blocks[i] = i;
-
- uint num_blocks_remaining = total_rand_blocks;
- while (num_blocks_remaining)
- {
- if (remaining_blocks.empty())
- break;
-
- uint rand_block_index = rm.irand(0, remaining_blocks.size());
- uint block_index = remaining_blocks[rand_block_index];
- remaining_blocks.erase_unordered(rand_block_index);
-
- uint block_y = block_index / num_blocks_x;
- uint block_x = block_index % num_blocks_x;
-
- block b;
-
- for (uint y = 0; y < 4; y++)
- {
- for (uint x = 0; x < 4; x++)
- {
- b.m_c[x+y*4] = img.get_clamped(block_x*4+x, block_y*4+y);
- }
- }
-
- if (!block_hash.insert(b).second)
- continue;
- if (block_hash.size() == total_dst_blocks)
- {
- block_hash.clear();
- block_hash.reserve(total_dst_blocks);
- }
-
- uint dst_block_x = next_dst_block % num_dst_blocks_x;
- uint dst_block_y = next_dst_block / num_dst_blocks_x;
- for (uint y = 0; y < 4; y++)
- {
- for (uint x = 0; x < 4; x++)
- {
- dst_img(dst_block_x * 4 + x, dst_block_y * 4 + y) = b.m_c[x + y*4];
- }
- }
-
- next_dst_block++;
- if (total_dst_blocks == next_dst_block)
- {
- sort_blocks(dst_img);
-
- dynamic_string dst_filename(cVarArg, "test_%u.tga", total_dst_images);
- console::printf("Writing image: %s", dst_filename.get_ptr());
- image_utils::write_to_file(dst_filename.get_ptr(), dst_img, 0);
-
- dst_img.set_all(color_quad_u8::make_black());
-
- next_dst_block = 0;
-
- total_dst_images++;
- }
-
- total_blocks_written++;
-
- num_blocks_remaining--;
- }
-
- } // file_index
-
- } // in_value_index
-
- }
-
- if (next_dst_block)
- {
- sort_blocks(dst_img);
-
- dynamic_string dst_filename(cVarArg, "test_%u.tga", total_dst_images);
- console::printf("Writing image: %s", dst_filename.get_ptr());
- image_utils::write_to_file(dst_filename.get_ptr(), dst_img, 0);
-
- next_dst_block = 0;
-
- total_dst_images++;
- }
-
- console::printf("Found %u input images, %u output images, %u total blocks", total_images_loaded, total_dst_images, total_blocks_written);
-
- return true;
- }
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crunch/corpus_gen.h b/Libraries/crunch-ea9b8d/crunch/corpus_gen.h
deleted file mode 100644
index dbbec5dd..00000000
--- a/Libraries/crunch-ea9b8d/crunch/corpus_gen.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// File: corpus_gen.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_command_line_params.h"
-#include "crn_image.h"
-
-namespace crnlib
-{
- class corpus_gen
- {
- public:
- corpus_gen();
-
- bool generate(const char* pCmd_line);
-
- private:
- void sort_blocks(image_u8& img);
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crunch/corpus_test.cpp b/Libraries/crunch-ea9b8d/crunch/corpus_test.cpp
deleted file mode 100644
index 94bc50fc..00000000
--- a/Libraries/crunch-ea9b8d/crunch/corpus_test.cpp
+++ /dev/null
@@ -1,404 +0,0 @@
-// File: corpus_test.cpp
-#include "crn_core.h"
-#include "corpus_test.h"
-#include "crn_find_files.h"
-#include "crn_console.h"
-#include "crn_image_utils.h"
-#include "crn_hash.h"
-#include "crn_hash_map.h"
-#include "crn_radix_sort.h"
-#include "crn_mipmapped_texture.h"
-
-namespace crnlib
-{
- corpus_tester::corpus_tester()
- {
- m_bad_block_img.resize(256, 256);
- m_next_bad_block_index = 0;
- m_total_bad_block_files = 0;
- }
-
- void corpus_tester::print_comparative_metric_stats(const command_line_params& cmd_line_params, const crnlib::vector<image_utils::error_metrics>& stats1, const crnlib::vector<image_utils::error_metrics>& stats2, uint num_blocks_x, uint num_blocks_y)
- {
- num_blocks_y;
-
- crnlib::vector<uint> better_blocks;
- crnlib::vector<uint> equal_blocks;
- crnlib::vector<uint> worse_blocks;
- crnlib::vector<float> delta_psnr;
-
- for (uint i = 0; i < stats1.size(); i++)
- {
- //uint bx = i % num_blocks_x;
- //uint by = i / num_blocks_x;
-
- const image_utils::error_metrics& em1 = stats1[i];
- const image_utils::error_metrics& em2 = stats2[i];
-
- if (em1.mPeakSNR < em2.mPeakSNR)
- {
- worse_blocks.push_back(i);
- delta_psnr.push_back((float)(em2.mPeakSNR - em1.mPeakSNR));
- }
- else if (fabs(em1.mPeakSNR - em2.mPeakSNR) < .001f)
- equal_blocks.push_back(i);
- else
- better_blocks.push_back(i);
- }
-
- console::printf("Num worse blocks: %u, %3.3f%%", worse_blocks.size(), worse_blocks.size() * 100.0f / stats1.size());
- console::printf("Num equal blocks: %u, %3.3f%%", equal_blocks.size(), equal_blocks.size() * 100.0f / stats1.size());
- console::printf("Num better blocks: %u, %3.3f%%", better_blocks.size(), better_blocks.size() * 100.0f / stats1.size());
- console::printf("Num equal+better blocks: %u, %3.3f%%", equal_blocks.size()+better_blocks.size(), (equal_blocks.size()+better_blocks.size()) * 100.0f / stats1.size());
-
- if (!cmd_line_params.has_key("nobadblocks"))
- {
- crnlib::vector<uint> indices[2];
- indices[0].resize(worse_blocks.size());
- indices[1].resize(worse_blocks.size());
-
- uint* pSorted_indices = NULL;
- if (worse_blocks.size())
- {
- pSorted_indices = indirect_radix_sort(worse_blocks.size(), &indices[0][0], &indices[1][0], &delta_psnr[0], 0, sizeof(float), true);
-
- console::printf("List of worse blocks sorted by delta PSNR:");
- for (uint i = 0; i < worse_blocks.size(); i++)
- {
- uint block_index = worse_blocks[pSorted_indices[i]];
- uint bx = block_index % num_blocks_x;
- uint by = block_index / num_blocks_x;
-
- console::printf("%u. [%u,%u] %3.3f %3.3f %3.3f",
- i,
- bx, by,
- stats1[block_index].mPeakSNR,
- stats2[block_index].mPeakSNR,
- stats2[block_index].mPeakSNR - stats1[block_index].mPeakSNR);
- }
- }
- }
- }
-
- void corpus_tester::print_metric_stats(const crnlib::vector<image_utils::error_metrics>& stats, uint num_blocks_x, uint num_blocks_y)
- {
- num_blocks_y;
-
- image_utils::error_metrics best_metrics;
- image_utils::error_metrics worst_metrics;
- worst_metrics.mPeakSNR = 1e+6f;
-
- vec2I best_loc;
- vec2I worst_loc;
- utils::zero_object(best_loc);
- utils::zero_object(worst_loc);
-
- double psnr_total = 0.0f;
- double psnr2_total = 0.0f;
- uint num_non_inf = 0;
- uint num_inf = 0;
-
- for (uint i = 0; i < stats.size(); i++)
- {
- uint bx = i % num_blocks_x;
- uint by = i / num_blocks_x;
-
- const image_utils::error_metrics& em = stats[i];
-
- if ((em.mPeakSNR < 200.0f) && (em > best_metrics)) { best_metrics = em; best_loc.set(bx, by); }
- if (em < worst_metrics) { worst_metrics = em; worst_loc.set(bx, by); }
-
- if (em.mPeakSNR < 200.0f)
- {
- psnr_total += em.mPeakSNR;
- psnr2_total += em.mPeakSNR*em.mPeakSNR;
- num_non_inf++;
- }
- else
- {
- num_inf++;
- }
- }
-
- console::printf("Number of infinite PSNR blocks: %u", num_inf);
- console::printf("Number of non-infinite PSNR blocks: %u", num_non_inf);
- if (num_non_inf)
- {
- psnr_total /= num_non_inf;
- psnr2_total /= num_non_inf;
-
- double psnr_std_dev = sqrt(psnr2_total - psnr_total * psnr_total);
-
- console::printf("Average Non-Inf PSNR: %3.3f, Std dev: %3.3f", psnr_total, psnr_std_dev);
- console::printf("Worst PSNR: %3.3f, Block Location: %i,%i", worst_metrics.mPeakSNR, worst_loc[0], worst_loc[1]);
- console::printf("Best Non-Inf PSNR: %3.3f, Block Location: %i,%i", best_metrics.mPeakSNR, best_loc[0], best_loc[1]);
- }
- }
-
- void corpus_tester::flush_bad_blocks()
- {
- if (!m_next_bad_block_index)
- return;
-
- dynamic_string filename(cVarArg, "badblocks_%u.tga", m_total_bad_block_files);
- console::printf("Writing bad block image: %s", filename.get_ptr());
- image_utils::write_to_file(filename.get_ptr(), m_bad_block_img, image_utils::cWriteFlagIgnoreAlpha);
-
- m_bad_block_img.set_all(color_quad_u8::make_black());
-
- m_total_bad_block_files++;
-
- m_next_bad_block_index = 0;
- }
-
- void corpus_tester::add_bad_block(image_u8& block)
- {
- uint num_blocks_x = m_bad_block_img.get_block_width(4);
- uint num_blocks_y = m_bad_block_img.get_block_height(4);
- uint total_blocks = num_blocks_x * num_blocks_y;
-
- m_bad_block_img.blit((m_next_bad_block_index % num_blocks_x) * 4, (m_next_bad_block_index / num_blocks_x) * 4, block);
- m_next_bad_block_index++;
-
- if (m_next_bad_block_index == total_blocks)
- flush_bad_blocks();
- }
-
- static bool progress_callback(uint percentage_complete, void* pUser_data_ptr)
- {
- static int s_prev_percentage_complete = -1;
- pUser_data_ptr;
- if (s_prev_percentage_complete != static_cast<int>(percentage_complete))
- {
- console::progress("%u%%", percentage_complete);
- s_prev_percentage_complete = percentage_complete;
- }
- return true;
- }
-
- bool corpus_tester::test(const char* pCmd_line)
- {
- console::printf("Command line:\n\"%s\"", pCmd_line);
-
- static const command_line_params::param_desc param_desc_array[] =
- {
- { "corpus_test", 0, false },
- { "in", 1, true },
- { "deep", 0, false },
- { "alpha", 0, false },
- { "nomips", 0, false },
- { "perceptual", 0, false },
- { "endpointcaching", 0, false },
- { "multithreaded", 0, false },
- { "writehybrid", 0, false },
- { "nobadblocks", 0, false },
- };
-
- command_line_params cmd_line_params;
- if (!cmd_line_params.parse(pCmd_line, CRNLIB_ARRAY_SIZE(param_desc_array), param_desc_array, true))
- return false;
-
- double total_time1 = 0, total_time2 = 0;
-
- command_line_params::param_map_const_iterator it = cmd_line_params.begin();
- for ( ; it != cmd_line_params.end(); ++it)
- {
- if (it->first != "in")
- continue;
- if (it->second.m_values.empty())
- {
- console::error("Must follow /in parameter with a filename!\n");
- return false;
- }
-
- for (uint in_value_index = 0; in_value_index < it->second.m_values.size(); in_value_index++)
- {
- const dynamic_string& filespec = it->second.m_values[in_value_index];
-
- find_files file_finder;
- if (!file_finder.find(filespec.get_ptr(), find_files::cFlagAllowFiles | (cmd_line_params.has_key("deep") ? find_files::cFlagRecursive : 0)))
- {
- console::warning("Failed finding files: %s", filespec.get_ptr());
- continue;
- }
-
- if (file_finder.get_files().empty())
- {
- console::warning("No files found: %s", filespec.get_ptr());
- return false;
- }
-
- const find_files::file_desc_vec& files = file_finder.get_files();
-
- image_u8 o(4, 4), a(4, 4), b(4, 4);
-
- uint first_channel = 0;
- uint num_channels = 3;
- bool perceptual = cmd_line_params.get_value_as_bool("perceptual", false);
- if (perceptual)
- {
- first_channel = 0;
- num_channels = 0;
- }
- console::printf("Perceptual mode: %u", perceptual);
-
- for (uint file_index = 0; file_index < files.size(); file_index++)
- {
- const find_files::file_desc& file_desc = files[file_index];
-
- console::printf("-------- Loading image: %s", file_desc.m_fullname.get_ptr());
-
- image_u8 img;
- if (!image_utils::read_from_file(img, file_desc.m_fullname.get_ptr(), 0))
- {
- console::warning("Failed loading image file: %s", file_desc.m_fullname.get_ptr());
- continue;
- }
-
- if ((!cmd_line_params.has_key("alpha")) && img.is_component_valid(3))
- {
- for (uint y = 0; y < img.get_height(); y++)
- for (uint x = 0; x < img.get_width(); x++)
- img(x, y).a = 255;
-
- img.set_component_valid(3, false);
- }
-
- mipmapped_texture orig_tex;
- orig_tex.assign(crnlib_new<image_u8>(img));
-
- if (!cmd_line_params.has_key("nomips"))
- {
- mipmapped_texture::generate_mipmap_params genmip_params;
- genmip_params.m_srgb = true;
-
- console::printf("Generating mipmaps");
-
- if (!orig_tex.generate_mipmaps(genmip_params, false))
- {
- console::error("Mipmap generation failed!");
- return false;
- }
- }
-
- console::printf("Compress 1");
-
- mipmapped_texture tex1(orig_tex);
- dxt_image::pack_params convert_params;
- convert_params.m_endpoint_caching = cmd_line_params.get_value_as_bool("endpointcaching", 0, false);
- convert_params.m_compressor = cCRNDXTCompressorCRN;
- convert_params.m_quality = cCRNDXTQualityNormal;
- convert_params.m_perceptual = perceptual;
- convert_params.m_num_helper_threads = cmd_line_params.get_value_as_bool("multithreaded", 0, true) ? (g_number_of_processors - 1) : 0;
- convert_params.m_pProgress_callback = progress_callback;
- timer t;
- t.start();
- if (!tex1.convert(PIXEL_FMT_ETC1, false, convert_params))
- {
- console::error("Texture conversion failed!");
- return false;
- }
- double time1 = t.get_elapsed_secs();
- total_time1 += time1;
- console::printf("Elapsed time: %3.3f", time1);
-
- console::printf("Compress 2");
-
- mipmapped_texture tex2(orig_tex);
- convert_params.m_endpoint_caching = false;
- convert_params.m_compressor = cCRNDXTCompressorCRN;
- convert_params.m_quality = cCRNDXTQualitySuperFast;
- t.start();
- if (!tex2.convert(PIXEL_FMT_ETC1, false, convert_params))
- {
- console::error("Texture conversion failed!");
- return false;
- }
- double time2 = t.get_elapsed_secs();
- total_time2 += time2;
- console::printf("Elapsed time: %3.3f", time2);
-
- image_u8 hybrid_img(img.get_width(), img.get_height());
-
- for (uint l = 0; l < orig_tex.get_num_levels(); l++)
- {
- image_u8 orig_img, img1, img2;
-
- image_u8* pOrig = orig_tex.get_level(0, l)->get_unpacked_image(orig_img, cUnpackFlagUncook | cUnpackFlagUnflip);
- image_u8* pImg1 = tex1.get_level(0, l)->get_unpacked_image(img1, cUnpackFlagUncook | cUnpackFlagUnflip);
- image_u8* pImg2 = tex2.get_level(0, l)->get_unpacked_image(img2, cUnpackFlagUncook | cUnpackFlagUnflip);
-
- const uint num_blocks_x = pOrig->get_block_width(4);
- const uint num_blocks_y = pOrig->get_block_height(4);
-
- crnlib::vector<image_utils::error_metrics> metrics[2];
-
- for (uint by = 0; by < num_blocks_y; by++)
- {
- for (uint bx = 0; bx < num_blocks_x; bx++)
- {
- pOrig->extract_block(o.get_ptr(), bx * 4, by * 4, 4, 4);
- pImg1->extract_block(a.get_ptr(), bx * 4, by * 4, 4, 4);
- pImg2->extract_block(b.get_ptr(), bx * 4, by * 4, 4, 4);
-
- image_utils::error_metrics em1;
- em1.compute(o, a, first_channel, num_channels);
-
- image_utils::error_metrics em2;
- em2.compute(o, b, first_channel, num_channels);
-
- metrics[0].push_back(em1);
- metrics[1].push_back(em2);
-
- if (em1.mPeakSNR < em2.mPeakSNR)
- {
- add_bad_block(o);
-
- hybrid_img.blit(bx * 4, by * 4, b);
- }
- else
- {
- hybrid_img.blit(bx * 4, by * 4, a);
- }
- }
- }
-
- if (cmd_line_params.has_key("writehybrid"))
- image_utils::write_to_file("hybrid.tga", hybrid_img, image_utils::cWriteFlagIgnoreAlpha);
-
- console::printf("---- Mip level: %u, Total blocks: %ux%u, %u", l, num_blocks_x, num_blocks_y, num_blocks_x * num_blocks_y);
-
- console::printf("Compressor 1:");
- print_metric_stats(metrics[0], num_blocks_x, num_blocks_y);
-
- console::printf("Compressor 2:");
- print_metric_stats(metrics[1], num_blocks_x, num_blocks_y);
-
- console::printf("Compressor 1 vs. 2:");
- print_comparative_metric_stats(cmd_line_params, metrics[0], metrics[1], num_blocks_x, num_blocks_y);
-
- image_utils::error_metrics em;
-
- em.compute(*pOrig, *pImg1, 0, perceptual ? 0 : 3);
- em.print("Compressor 1: ");
-
- em.compute(*pOrig, *pImg2, 0, perceptual ? 0 : 3);
- em.print("Compressor 2: ");
-
- em.compute(*pOrig, hybrid_img, 0, perceptual ? 0 : 3);
- em.print("Best of Both: ");
- }
- }
-
- } // file_index
- }
-
- flush_bad_blocks();
-
- console::printf("Total times: %4.3f vs. %4.3f", total_time1, total_time2);
-
- return true;
- }
-
-} // namespace crnlib
-
diff --git a/Libraries/crunch-ea9b8d/crunch/corpus_test.h b/Libraries/crunch-ea9b8d/crunch/corpus_test.h
deleted file mode 100644
index 83687612..00000000
--- a/Libraries/crunch-ea9b8d/crunch/corpus_test.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// File: corpus_test.h
-// See Copyright Notice and license at the end of inc/crnlib.h
-#pragma once
-#include "crn_command_line_params.h"
-#include "crn_image_utils.h"
-
-namespace crnlib
-{
- class corpus_tester
- {
- public:
- corpus_tester();
-
- bool test(const char* pCmd_line);
-
- private:
- void print_comparative_metric_stats(const command_line_params& params, const crnlib::vector<image_utils::error_metrics>& stats1, const crnlib::vector<image_utils::error_metrics>& stats2, uint num_blocks_x, uint num_blocks_y);
- void print_metric_stats(const crnlib::vector<image_utils::error_metrics>& stats, uint num_blocks_x, uint num_blocks_y);
-
- image_u8 m_bad_block_img;
- uint m_next_bad_block_index;
- uint m_total_bad_block_files;
-
- void flush_bad_blocks();
- void add_bad_block(image_u8& block);
- };
-
-} // namespace crnlib
diff --git a/Libraries/crunch-ea9b8d/crunch/crunch.2008.vcproj b/Libraries/crunch-ea9b8d/crunch/crunch.2008.vcproj
deleted file mode 100644
index 17e702ef..00000000
--- a/Libraries/crunch-ea9b8d/crunch/crunch.2008.vcproj
+++ /dev/null
@@ -1,389 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="crunch"
- ProjectGUID="{8F645BA1-B996-49EB-859B-970A671DE05D}"
- RootNamespace="comp"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\crnlib;..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="false"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)D.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\crnlib;..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="false"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)D_x64.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\crnlib;..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\crnlib;..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- FloatingPointModel="2"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)_x64.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\corpus_gen.cpp"
- >
- </File>
- <File
- RelativePath=".\corpus_gen.h"
- >
- </File>
- <File
- RelativePath=".\corpus_test.cpp"
- >
- </File>
- <File
- RelativePath=".\corpus_test.h"
- >
- </File>
- <File
- RelativePath=".\crunch.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/crunch-ea9b8d/crunch/crunch.cbp b/Libraries/crunch-ea9b8d/crunch/crunch.cbp
deleted file mode 100644
index 8e832f2f..00000000
--- a/Libraries/crunch-ea9b8d/crunch/crunch.cbp
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="crunch" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="..\bin_mingw\crunchD" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Debug\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add library="..\crnlib\libcrnlibD.a" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="..\bin_mingw\crunch" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-march=core2" />
- <Add option="-fomit-frame-pointer" />
- <Add option="-fexpensive-optimizations" />
- <Add option="-O3" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add library="..\crnlib\libcrnlib.a" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wextra" />
- <Add option="-Wall" />
- <Add option="-fexceptions" />
- <Add option="-Wno-unused-value" />
- <Add option="-Wno-unused" />
- <Add option="-fno-strict-aliasing" />
- <Add directory="..\inc" />
- <Add directory="..\crnlib" />
- </Compiler>
- <Unit filename="corpus_gen.cpp" />
- <Unit filename="corpus_gen.h" />
- <Unit filename="corpus_test.cpp" />
- <Unit filename="corpus_test.h" />
- <Unit filename="crunch.cpp" />
- <Extensions>
- <code_completion />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/Libraries/crunch-ea9b8d/crunch/crunch.cpp b/Libraries/crunch-ea9b8d/crunch/crunch.cpp
deleted file mode 100644
index 782f6da4..00000000
--- a/Libraries/crunch-ea9b8d/crunch/crunch.cpp
+++ /dev/null
@@ -1,1352 +0,0 @@
-// File: crunch.cpp - Command line tool for DDS/CRN texture compression/decompression.
-// This tool exposes all of crnlib's functionality. It also uses a bunch of internal crlib
-// classes that aren't directly exposed in the main crnlib.h header. The actual tool is
-// implemented as a single class "crunch" which in theory is reusable. Most of the heavy
-// lifting is actually done by functions in the crnlib::texture_conversion namespace,
-// which are mostly wrappers over the public crnlib.h functions.
-// See Copyright Notice and license at the end of inc/crnlib.h
-//
-// Important: If compiling with gcc, be sure strict aliasing is disabled: -fno-strict-aliasing
-#include "crn_core.h"
-#include "crn_console.h"
-
-#include "crn_colorized_console.h"
-
-#include "crn_find_files.h"
-#include "crn_file_utils.h"
-#include "crn_command_line_params.h"
-
-#include "crn_dxt.h"
-#include "crn_cfile_stream.h"
-#include "crn_texture_conversion.h"
-
-#define CRND_HEADER_FILE_ONLY
-#include "crn_decomp.h"
-
-#include "corpus_gen.h"
-#include "corpus_test.h"
-
-using namespace crnlib;
-
-const int cDefaultCRNQualityLevel = 128;
-
-class crunch
-{
- CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(crunch);
-
- cfile_stream m_log_stream;
-
- uint32 m_num_processed;
- uint32 m_num_failed;
- uint32 m_num_succeeded;
- uint32 m_num_skipped;
-
-public:
- crunch() :
- m_num_processed(0),
- m_num_failed(0),
- m_num_succeeded(0),
- m_num_skipped(0)
- {
- }
-
- ~crunch()
- {
- }
-
- enum convert_status
- {
- cCSFailed,
- cCSSucceeded,
- cCSSkipped,
- cCSBadParam,
- };
-
- inline uint32 get_num_processed() const { return m_num_processed; }
- inline uint32 get_num_failed() const { return m_num_failed; }
- inline uint32 get_num_succeeded() const { return m_num_succeeded; }
- inline uint32 get_num_skipped() const { return m_num_skipped; }
-
- static void print_usage()
- {
- // -------------------------------------------------------------------------------
- console::message("\nCommand line usage:");
- console::printf("crunch [options] -file filename");
- console::printf("-file filename - Required input filename, wildcards, multiple -file params OK.");
- console::printf("-file @list.txt - List of files to convert.");
- console::printf("Supported source file formats: dds,ktx,crn,tga,bmp,png,jpg/jpeg,psd");
- console::printf("Note: Some file format variants are unsupported.");
- console::printf("See the docs for stb_image.c: http://www.nothings.org/stb_image.c");
- console::printf("Progressive JPEG files are supported, see: http://code.google.com/p/jpeg-compressor/");
-
- console::message("\nPath/file related parameters:");
- console::printf("-out filename - Output filename");
- console::printf("-outdir dir - Output directory");
- console::printf("-outsamedir - Write output file to input directory");
- console::printf("-deep - Recurse subdirectories, default=false");
- console::printf("-nooverwrite - Don't overwrite existing files");
- console::printf("-timestamp - Update only changed files");
- console::printf("-forcewrite - Overwrite read-only files");
- console::printf("-recreate - Recreate directory structure");
- console::printf("-fileformat [dds,ktx,crn,tga,bmp,png] - Output file format, default=crn or dds");
-
- console::message("\nModes:");
- console::printf("-compare - Compare input and output files (no output files are written).");
- console::printf("-info - Only display input file statistics (no output files are written).");
-
- console::message("\nMisc. options:");
- console::printf("-helperThreads # - Set number of helper threads, 0-16, default=(# of CPU's)-1");
- console::printf("-noprogress - Disable progress output");
- console::printf("-quiet - Disable all console output");
- console::printf("-ignoreerrors - Continue processing files after errors. Note: The default");
- console::printf(" behavior is to immediately exit whenever an error occurs.");
- console::printf("-logfile filename - Append output to log file");
- console::printf("-pause - Wait for keypress on error");
- console::printf("-window <left> <top> <right> <bottom> - Crop window before processing");
- console::printf("-clamp <width> <height> - Crop image if larger than width/height");
- console::printf("-clampscale <width> <height> - Scale image if larger than width/height");
- console::printf("-nostats - Disable all output file statistics (faster)");
- console::printf("-imagestats - Print various image qualilty statistics");
- console::printf("-mipstats - Print statistics for each mipmap, not just the top mip");
- console::printf("-lzmastats - Print size of output file compressed with LZMA codec");
- console::printf("-split - Write faces/mip levels to multiple separate output PNG files");
- console::printf("-yflip - Always flip texture on Y axis before processing");
- console::printf("-unflip - Unflip texture if read from source file as flipped");
-
- console::message("\nImage rescaling (mutually exclusive options)");
- console::printf("-rescale <int> <int> - Rescale image to specified resolution");
- console::printf("-relscale <float> <float> - Rescale image to specified relative resolution");
- console::printf("-rescalemode <nearest | hi | lo> - Auto-rescale non-power of two images");
- console::printf(" nearest - Use nearest power of 2, hi - Use next, lo - Use previous");
-
- console::message("\nDDS/CRN compression quality control:");
- console::printf("-quality # (or /q #) - Set Clustered DDS/CRN quality factor [0-255] 255=best");
- console::printf(" DDS default quality is best possible.");
- console::printf(" CRN default quality is %u.", cDefaultCRNQualityLevel);
- console::printf("-bitrate # - Set the desired output bitrate of DDS or CRN output files.");
- console::printf(" This option causes crunch to find the quality factor");
- console::printf(" closest to the desired bitrate using a binary search.");
-
- console::message("\nLow-level CRN specific options:");
- console::printf("-c # - Color endpoint palette size, 32-8192, default=3072");
- console::printf("-s # - Color selector palette size, 32-8192, default=3072");
- console::printf("-ca # - Alpha endpoint palette size, 32-8192, default=3072");
- console::printf("-sa # - Alpha selector palette size, 32-8192, default=3072");
-
- // -------------------------------------------------------------------------------
- console::message("\nMipmap filtering options:");
- console::printf("-mipMode [UseSourceOrGenerate,UseSource,Generate,None]");
- console::printf(" Default mipMode is UseSourceOrGenerate");
- console::printf(" UseSourceOrGenerate: Use source mipmaps if possible, or create new mipmaps.");
- console::printf(" UseSource: Always use source mipmaps, if any (never generate new mipmaps)");
- console::printf(" Generate: Always generate a new mipmap chain (ignore source mipmaps)");
- console::printf(" None: Do not output any mipmaps");
- console::printf("-mipFilter [box,tent,lanczos4,mitchell,kaiser], default=kaiser");
- console::printf("-gamma # - Mipmap gamma correction value, default=2.2, use 1.0 for linear");
- console::printf("-blurriness # - Scale filter kernel, >1=blur, <1=sharpen, .01-8, default=.9");
- console::printf("-wrap - Assume texture is tiled when filtering, default=clamping");
- console::printf("-renormalize - Renormalize filtered normal map texels, default=disabled");
- console::printf("-maxmips # - Limit number of generated texture mipmap levels, 1-16, default=16");
- console::printf("-minmipsize # - Smallest allowable mipmap resolution, default=1");
-
- console::message("\nCompression options:");
- console::printf("-alphaThreshold # - Set DXT1A alpha threshold, 0-255, default=128");
- console::printf(" Note: -alphaThreshold also changes the compressor's behavior to");
- console::printf(" prefer DXT1A over DXT5 for images with alpha channels (.DDS only).");
- console::printf("-uniformMetrics - Use uniform color metrics, default=use perceptual metrics");
- console::printf("-noAdaptiveBlocks - Disable adaptive block sizes (i.e. disable macroblocks).");
-#ifdef CRNLIB_SUPPORT_ATI_COMPRESS
- console::printf("-compressor [CRN,CRNF,RYG,ATI] - Set DXTn compressor, default=CRN");
-#else
- console::printf("-compressor [CRN,CRNF,RYG] - Set DXTn compressor, default=CRN");
-#endif
- console::printf("-dxtQuality [superfast,fast,normal,better,uber] - Endpoint optimizer speed.");
- console::printf(" Sets endpoint optimizer's max iteration depth. Default=uber.");
- console::printf("-noendpointcaching - Don't try reusing previous DXT endpoint solutions.");
- console::printf("-grayscalsampling - Assume shader will convert fetched results to luma (Y).");
- console::printf("-forceprimaryencoding - Only use DXT1 color4 and DXT5 alpha8 block encodings.");
- console::printf("-usetransparentindicesforblack - Try DXT1 transparent indices for dark pixels.");
-
- console::message("\nOuptut pixel format options:");
- console::printf("-usesourceformat - Use input file's format for output format (when possible).");
- console::message("\nAll supported texture formats (Note: .CRN only supports DXTn pixel formats):");
- for (uint32 i = 0; i < pixel_format_helpers::get_num_formats(); i++)
- {
- pixel_format fmt = pixel_format_helpers::get_pixel_format_by_index(i);
- console::printf("-%s", pixel_format_helpers::get_pixel_format_string(fmt));
- }
-
- console::printf("\nFor bugs, support, or feedback: info@binomial.info");
- }
-
- bool convert(const char* pCommand_line)
- {
- m_num_processed = 0;
- m_num_failed = 0;
- m_num_succeeded = 0;
- m_num_skipped = 0;
-
- command_line_params::param_desc std_params[] =
- {
- { "file", 1, true },
-
- { "out", 1, false },
- { "outdir", 1, false },
- { "outsamedir", 0, false },
- { "deep", 0, false },
- { "fileformat", 1, false },
-
- { "helperThreads", 1, false },
- { "noprogress", 0, false },
- { "quiet", 0, false },
- { "ignoreerrors", 0, false },
- { "logfile", 1, false },
-
- { "q", 1, false },
- { "quality", 1, false },
-
- { "c", 1, false },
- { "s", 1, false },
- { "ca", 1, false },
- { "sa", 1, false },
-
- { "mipMode", 1, false },
- { "mipFilter", 1, false },
- { "gamma", 1, false },
- { "blurriness", 1, false },
- { "wrap", 0, false },
- { "renormalize", 0, false },
- { "noprogress", 0, false },
- { "paramdebug", 0, false },
- { "debug", 0, false },
- { "quick", 0, false },
- { "imagestats", 0, false },
- { "nostats", 0, false },
- { "mipstats", 0, false },
-
- { "alphaThreshold", 1, false },
- { "uniformMetrics", 0, false },
- { "noAdaptiveBlocks", 0, false },
- { "compressor", 1, false },
- { "dxtQuality", 1, false },
- { "noendpointcaching", 0, false },
- { "grayscalesampling", 0, false },
- { "converttoluma", 0, false },
- { "setalphatoluma", 0, false },
- { "pause", 0, false },
- { "timestamp", 0, false },
- { "nooverwrite", 0, false },
- { "forcewrite", 0, false },
- { "recreate", 0, false },
- { "compare", 0, false },
- { "info", 0, false },
- { "forceprimaryencoding", 0, false },
- { "usetransparentindicesforblack", 0, false },
- { "usesourceformat", 0, false },
-
- { "rescalemode", 1, false },
- { "rescale", 2, false },
- { "relrescale", 2, false },
- { "clamp", 2, false },
- { "clampScale", 2, false },
- { "window", 4, false },
-
- { "maxmips", 1, false },
- { "minmipsize", 1, false },
-
- { "bitrate", 1, false },
-
- { "lzmastats", 0, false },
- { "split", 0, false },
- { "csvfile", 1, false },
-
- { "yflip", 0, false },
- { "unflip", 0, false },
- };
-
- crnlib::vector<command_line_params::param_desc> params;
- params.append(std_params, sizeof(std_params) / sizeof(std_params[0]));
-
- for (uint32 i = 0; i < pixel_format_helpers::get_num_formats(); i++)
- {
- pixel_format fmt = pixel_format_helpers::get_pixel_format_by_index(i);
-
- command_line_params::param_desc desc;
- desc.m_pName = pixel_format_helpers::get_pixel_format_string(fmt);
- desc.m_num_values = 0;
- desc.m_support_listing_file = false;
- params.push_back(desc);
- }
-
- if (!m_params.parse(pCommand_line, params.size(), params.get_ptr(), true))
- {
- return false;
- }
-
- if (!m_params.get_num_params())
- {
- console::error("No command line parameters specified!");
-
- print_usage();
-
- return false;
- }
-
-#if 0
- if (m_params.get_count(""))
- {
- console::error("Unrecognized command line parameter: \"%s\"", m_params.get_value_as_string_or_empty("", 0).get_ptr());
-
- return false;
- }
-#endif
-
- if (m_params.get_value_as_bool("debug"))
- {
- console::debug("Command line parameters:");
- for (command_line_params::param_map_const_iterator it = m_params.begin(); it != m_params.end(); ++it)
- {
- console::disable_crlf();
- console::debug("Key:\"%s\" Values (%u): ", it->first.get_ptr(), it->second.m_values.size());
- for (uint32 i = 0; i < it->second.m_values.size(); i++)
- console::debug("\"%s\" ", it->second.m_values[i].get_ptr());
- console::debug("\n");
- console::enable_crlf();
- }
- }
-
- dynamic_string log_filename;
- if (m_params.get_value_as_string("logfile", 0, log_filename))
- {
- if (!m_log_stream.open(log_filename.get_ptr(), cDataStreamWritable | cDataStreamSeekable, true))
- {
- console::error("Unable to open log file: \"%s\"", log_filename.get_ptr());
- return false;
- }
-
- console::printf("Appending output to log file \"%s\"", log_filename.get_ptr());
-
- console::set_log_stream(&m_log_stream);
- }
-
- bool status = convert();
-
- if (m_log_stream.is_opened())
- {
- console::set_log_stream(NULL);
-
- m_log_stream.close();
- }
-
- return status;
- }
-
-private:
- command_line_params m_params;
-
- bool convert()
- {
- find_files::file_desc_vec files;
-
- uint32 total_input_specs = 0;
-
- for (uint32 phase = 0; phase < 2; phase++)
- {
- command_line_params::param_map_const_iterator begin, end;
- m_params.find(phase ? "" : "file", begin, end);
- for (command_line_params::param_map_const_iterator it = begin; it != end; ++it)
- {
- total_input_specs++;
-
- const dynamic_string_array& strings = it->second.m_values;
- for (uint32 i = 0; i < strings.size(); i++)
- {
- if (!process_input_spec(files, strings[i]))
- {
- if (!m_params.get_value_as_bool("ignoreerrors"))
- return false;
- }
- }
- }
- }
-
- if (!total_input_specs)
- {
- console::error("No input files specified!");
- return false;
- }
-
- if (files.empty())
- {
- console::error("No files found to process!");
- return false;
- }
-
- std::sort(files.begin(), files.end());
- files.resize((uint32)(std::unique(files.begin(), files.end()) - files.begin()));
-
- timer tm;
- tm.start();
-
- if (!process_files(files))
- {
- if (!m_params.get_value_as_bool("ignoreerrors"))
- return false;
- }
-
- double total_time = tm.get_elapsed_secs();
-
- console::printf("Total time: %3.3fs", total_time);
-
- console::printf(
- ((m_num_skipped) || (m_num_failed)) ? cWarningConsoleMessage : cInfoConsoleMessage,
- "%u total file(s) successfully processed, %u file(s) skipped, %u file(s) failed.", m_num_succeeded, m_num_skipped, m_num_failed);
-
- return true;
- }
-
- bool process_input_spec(find_files::file_desc_vec& files, const dynamic_string& input_spec)
- {
- dynamic_string find_name(input_spec);
-
- if ((find_name.get_len()) && (file_utils::does_dir_exist(find_name.get_ptr())))
- {
- file_utils::combine_path(find_name, find_name.get_ptr(), "*");
- }
-
- if ((find_name.is_empty()) || (!file_utils::full_path(find_name)))
- {
- console::error("Invalid input filename: %s", find_name.get_ptr());
- return false;
- }
-
- const bool deep_flag = m_params.get_value_as_bool("deep");
-
- dynamic_string find_drive, find_path, find_fname, find_ext;
- file_utils::split_path(find_name.get_ptr(), &find_drive, &find_path, &find_fname, &find_ext);
-
- dynamic_string find_pathname;
- file_utils::combine_path(find_pathname, find_drive.get_ptr(), find_path.get_ptr());
- dynamic_string find_filename;
- find_filename = find_fname + find_ext;
-
- find_files file_finder;
- bool success = file_finder.find(find_pathname.get_ptr(), find_filename.get_ptr(), find_files::cFlagAllowFiles | (deep_flag ? find_files::cFlagRecursive : 0));
- if (!success)
- {
- console::error("Failed finding files: %s", find_name.get_ptr());
- return false;
- }
-
- if (file_finder.get_files().empty())
- {
- console::warning("No files found: %s", find_name.get_ptr());
- return true;
- }
-
- files.append(file_finder.get_files());
-
- return true;
- }
-
- bool read_only_file_check(const char* pDst_filename)
- {
- if (!file_utils::is_read_only(pDst_filename))
- return true;
-
- if (m_params.get_value_as_bool("forcewrite"))
- {
- if (file_utils::disable_read_only(pDst_filename))
- {
- console::warning("Setting read-only file \"%s\" to writable", pDst_filename);
- return true;
- }
- else
- {
- console::error("Failed setting read-only file \"%s\" to writable!", pDst_filename);
- return false;
- }
- }
-
- console::error("Output file \"%s\" is read-only!", pDst_filename);
-
- return false;
- }
-
- bool process_files(find_files::file_desc_vec& files)
- {
- const bool compare_mode = m_params.get_value_as_bool("compare");
- const bool info_mode = m_params.get_value_as_bool("info");
-
- for (uint32 file_index = 0; file_index < files.size(); file_index++)
- {
- const find_files::file_desc& file_desc = files[file_index];
- const dynamic_string& in_filename = file_desc.m_fullname;
-
- dynamic_string in_drive, in_path, in_fname, in_ext;
- file_utils::split_path(in_filename.get_ptr(), &in_drive, &in_path, &in_fname, &in_ext);
-
- texture_file_types::format out_file_type = texture_file_types::cFormatCRN;
- dynamic_string fmt;
- if (m_params.get_value_as_string("fileformat", 0, fmt))
- {
- if (fmt == "tga")
- out_file_type = texture_file_types::cFormatTGA;
- else if (fmt == "bmp")
- out_file_type = texture_file_types::cFormatBMP;
- else if (fmt == "dds")
- out_file_type = texture_file_types::cFormatDDS;
- else if (fmt == "ktx")
- out_file_type = texture_file_types::cFormatKTX;
- else if (fmt == "crn")
- out_file_type = texture_file_types::cFormatCRN;
- else if (fmt == "png")
- out_file_type = texture_file_types::cFormatPNG;
- else
- {
- console::error("Unsupported output file type: %s", fmt.get_ptr());
- return false;
- }
- }
-
- // No explicit output format has been specified - try to determine something doable.
- if (!m_params.has_key("fileformat"))
- {
- if (m_params.has_key("split"))
- {
- out_file_type = texture_file_types::cFormatPNG;
- }
- else
- {
- texture_file_types::format input_file_type = texture_file_types::determine_file_format(in_filename.get_ptr());
- if (input_file_type == texture_file_types::cFormatCRN)
- {
- // Automatically transcode CRN->DXTc and write to DDS files, unless the user specifies either the /fileformat or /split options.
- out_file_type = texture_file_types::cFormatDDS;
- }
- else if (input_file_type == texture_file_types::cFormatKTX)
- {
- // Default to converting KTX files to PNG
- out_file_type = texture_file_types::cFormatPNG;
- }
- }
- }
-
- dynamic_string out_filename;
- if (m_params.get_value_as_bool("outsamedir"))
- out_filename.format("%s%s%s.%s", in_drive.get_ptr(), in_path.get_ptr(), in_fname.get_ptr(), texture_file_types::get_extension(out_file_type));
- else if (m_params.has_key("out"))
- {
- out_filename = m_params.get_value_as_string_or_empty("out");
-
- if (files.size() > 1)
- {
- dynamic_string out_drive, out_dir, out_name, out_ext;
- file_utils::split_path(out_filename.get_ptr(), &out_drive, &out_dir, &out_name, &out_ext);
-
- out_name.format("%s_%u", out_name.get_ptr(), file_index);
-
- out_filename.format("%s%s%s%s", out_drive.get_ptr(), out_dir.get_ptr(), out_name.get_ptr(), out_ext.get_ptr());
- }
-
- if (!m_params.has_key("fileformat"))
- out_file_type = texture_file_types::determine_file_format(out_filename.get_ptr());
- }
- else
- {
- dynamic_string out_dir(m_params.get_value_as_string_or_empty("outdir"));
-
- if (m_params.get_value_as_bool("recreate") && file_desc.m_rel.get_len())
- {
- file_utils::combine_path(out_dir, out_dir.get_ptr(), file_desc.m_rel.get_ptr());
- }
-
- if (out_dir.get_len())
- {
- if (file_utils::is_path_separator(out_dir.back()))
- out_filename.format("%s%s.%s", out_dir.get_ptr(), in_fname.get_ptr(), texture_file_types::get_extension(out_file_type));
- else
- out_filename.format("%s\\%s.%s", out_dir.get_ptr(), in_fname.get_ptr(), texture_file_types::get_extension(out_file_type));
- }
- else
- {
- out_filename.format("%s.%s", in_fname.get_ptr(), texture_file_types::get_extension(out_file_type));
- }
-
- if (m_params.get_value_as_bool("recreate"))
- {
- if (file_utils::full_path(out_filename))
- {
- if ((!compare_mode) && (!info_mode))
- {
- dynamic_string out_drive, out_path;
- file_utils::split_path(out_filename.get_ptr(), &out_drive, &out_path, NULL, NULL);
- out_drive += out_path;
- file_utils::create_path(out_drive.get_ptr());
- }
- }
- }
- }
-
- if ((!compare_mode) && (!info_mode))
- {
- if (file_utils::does_file_exist(out_filename.get_ptr()))
- {
- if (m_params.get_value_as_bool("nooverwrite"))
- {
- console::warning("Skipping already existing file: %s\n", out_filename.get_ptr());
- m_num_skipped++;
- continue;
- }
-
- if (m_params.get_value_as_bool("timestamp"))
- {
- if (file_utils::is_older_than(in_filename.get_ptr(), out_filename.get_ptr()))
- {
- console::warning("Skipping up to date file: %s\n", out_filename.get_ptr());
- m_num_skipped++;
- continue;
- }
- }
- }
- }
-
- convert_status status = cCSFailed;
-
- if (info_mode)
- status = display_file_info(file_index, files.size(), in_filename.get_ptr());
- else if (compare_mode)
- status = compare_file(file_index, files.size(), in_filename.get_ptr(), out_filename.get_ptr(), out_file_type);
- else if (read_only_file_check(out_filename.get_ptr()))
- status = convert_file(file_index, files.size(), in_filename.get_ptr(), out_filename.get_ptr(), out_file_type);
-
- m_num_processed++;
-
- switch (status)
- {
- case cCSSucceeded:
- {
- console::info("");
- m_num_succeeded++;
- break;
- }
- case cCSSkipped:
- {
- console::info("Skipping file.\n");
- m_num_skipped++;
- break;
- }
- case cCSBadParam:
- {
- return false;
- }
- default:
- {
- if (!m_params.get_value_as_bool("ignoreerrors"))
- return false;
-
- console::info("");
-
- m_num_failed++;
- break;
- }
- }
- }
-
- return true;
- }
-
- void print_texture_info(const char* pTex_desc, texture_conversion::convert_params& params, mipmapped_texture& tex)
- {
- console::info("%s: %ux%u, Levels: %u, Faces: %u, Format: %s",
- pTex_desc,
- tex.get_width(),
- tex.get_height(),
- tex.get_num_levels(),
- tex.get_num_faces(),
- pixel_format_helpers::get_pixel_format_string(tex.get_format()));
-
- console::disable_crlf();
- console::info("Apparent type: %s, ", get_texture_type_desc(params.m_texture_type));
-
- console::info("Flags: ");
- if (tex.get_comp_flags() & pixel_format_helpers::cCompFlagRValid) console::info("R ");
- if (tex.get_comp_flags() & pixel_format_helpers::cCompFlagGValid) console::info("G ");
- if (tex.get_comp_flags() & pixel_format_helpers::cCompFlagBValid) console::info("B ");
- if (tex.get_comp_flags() & pixel_format_helpers::cCompFlagAValid) console::info("A ");
- if (tex.get_comp_flags() & pixel_format_helpers::cCompFlagGrayscale) console::info("Grayscale ");
- if (tex.get_comp_flags() & pixel_format_helpers::cCompFlagNormalMap) console::info("NormalMap ");
- if (tex.get_comp_flags() & pixel_format_helpers::cCompFlagLumaChroma) console::info("LumaChroma ");
- if (tex.is_flipped()) console::info("Flipped "); else console::info("Non-Flipped ");
- console::info("\n");
- console::enable_crlf();
- }
-
- static bool progress_callback_func(uint32 percentage_complete, void* pUser_data_ptr)
- {
- pUser_data_ptr;
-
- console::disable_crlf();
-
- char buf[8];
- for (uint32 i = 0; i < 7; i++)
- buf[i] = 8;
- buf[7] = '\0';
-
- for (uint32 i = 0; i < 130/8; i++)
- console::progress(buf);
-
- console::progress("Processing: %u%%", percentage_complete);
-
- for (uint32 i = 0; i < 7; i++)
- buf[i] = ' ';
- console::progress(buf);
- console::progress(buf);
-
- for (uint32 i = 0; i < 7; i++)
- buf[i] = 8;
- console::progress(buf);
- console::progress(buf);
-
- console::enable_crlf();
-
- return true;
- }
-
- bool parse_mipmap_params(crn_mipmap_params& mip_params)
- {
- dynamic_string val;
-
- if (m_params.get_value_as_string("mipMode", 0, val))
- {
- uint32 i;
- for (i = 0; i < cCRNMipModeTotal; i++)
- {
- if (val == crn_get_mip_mode_name( static_cast<crn_mip_mode>(i) ))
- {
- mip_params.m_mode = static_cast<crn_mip_mode>(i);
- break;
- }
- }
- if (i == cCRNMipModeTotal)
- {
- console::error("Invalid MipMode: \"%s\"", val.get_ptr());
- return false;
- }
- }
-
- if (m_params.get_value_as_string("mipFilter", 0, val))
- {
- uint32 i;
- for (i = 0; i < cCRNMipFilterTotal; i++)
- {
- if (val == dynamic_string(crn_get_mip_filter_name( static_cast<crn_mip_filter>(i) )) )
- {
- mip_params.m_filter = static_cast<crn_mip_filter>(i);
- break;
- }
- }
-
- if (i == cCRNMipFilterTotal)
- {
- console::error("Invalid MipFilter: \"%s\"", val.get_ptr());
- return false;
- }
-
- if (i == cCRNMipFilterBox)
- mip_params.m_blurriness = 1.0f;
- }
-
- mip_params.m_gamma = m_params.get_value_as_float("gamma", 0, mip_params.m_gamma, .1f, 8.0f);
- mip_params.m_gamma_filtering = (mip_params.m_gamma != 1.0f);
-
- mip_params.m_blurriness = m_params.get_value_as_float("blurriness", 0, mip_params.m_blurriness, .01f, 8.0f);
-
- mip_params.m_renormalize = m_params.get_value_as_bool("renormalize", 0, mip_params.m_renormalize != 0);
- mip_params.m_tiled = m_params.get_value_as_bool("wrap");
-
- mip_params.m_max_levels = m_params.get_value_as_int("maxmips", 0, cCRNMaxLevels, 1, cCRNMaxLevels);
- mip_params.m_min_mip_size = m_params.get_value_as_int("minmipsize", 0, 1, 1, cCRNMaxLevelResolution);
-
- return true;
- }
-
- bool parse_scale_params(crn_mipmap_params &mipmap_params)
- {
- if (m_params.has_key("rescale"))
- {
- int w = m_params.get_value_as_int("rescale", 0, -1, 1, cCRNMaxLevelResolution, 0);
- int h = m_params.get_value_as_int("rescale", 0, -1, 1, cCRNMaxLevelResolution, 1);
-
- mipmap_params.m_scale_mode = cCRNSMAbsolute;
- mipmap_params.m_scale_x = (float)w;
- mipmap_params.m_scale_y = (float)h;
- }
- else if (m_params.has_key("relrescale"))
- {
- float w = m_params.get_value_as_float("relrescale", 0, 1, 1, 256, 0);
- float h = m_params.get_value_as_float("relrescale", 0, 1, 1, 256, 1);
-
- mipmap_params.m_scale_mode = cCRNSMRelative;
- mipmap_params.m_scale_x = w;
- mipmap_params.m_scale_y = h;
- }
- else if (m_params.has_key("rescalemode"))
- {
- // nearest | hi | lo
-
- dynamic_string mode_str(m_params.get_value_as_string_or_empty("rescalemode"));
- if (mode_str == "nearest")
- mipmap_params.m_scale_mode = cCRNSMNearestPow2;
- else if (mode_str == "hi")
- mipmap_params.m_scale_mode = cCRNSMNextPow2;
- else if (mode_str == "lo")
- mipmap_params.m_scale_mode = cCRNSMLowerPow2;
- else
- {
- console::error("Invalid rescale mode: \"%s\"", mode_str.get_ptr());
- return false;
- }
- }
-
- if (m_params.has_key("clamp"))
- {
- uint32 w = m_params.get_value_as_int("clamp", 0, 1, 1, cCRNMaxLevelResolution, 0);
- uint32 h = m_params.get_value_as_int("clamp", 0, 1, 1, cCRNMaxLevelResolution, 1);
-
- mipmap_params.m_clamp_scale = false;
- mipmap_params.m_clamp_width = w;
- mipmap_params.m_clamp_height = h;
- }
- else if (m_params.has_key("clampScale"))
- {
- uint32 w = m_params.get_value_as_int("clampscale", 0, 1, 1, cCRNMaxLevelResolution, 0);
- uint32 h = m_params.get_value_as_int("clampscale", 0, 1, 1, cCRNMaxLevelResolution, 1);
-
- mipmap_params.m_clamp_scale = true;
- mipmap_params.m_clamp_width = w;
- mipmap_params.m_clamp_height = h;
- }
-
- if (m_params.has_key("window"))
- {
- uint32 xl = m_params.get_value_as_int("window", 0, 0, 0, cCRNMaxLevelResolution, 0);
- uint32 yl = m_params.get_value_as_int("window", 0, 0, 0, cCRNMaxLevelResolution, 1);
- uint32 xh = m_params.get_value_as_int("window", 0, 0, 0, cCRNMaxLevelResolution, 2);
- uint32 yh = m_params.get_value_as_int("window", 0, 0, 0, cCRNMaxLevelResolution, 3);
-
- mipmap_params.m_window_left = math::minimum(xl, xh);
- mipmap_params.m_window_top = math::minimum(yl, yh);
- mipmap_params.m_window_right = math::maximum(xl, xh);
- mipmap_params.m_window_bottom = math::maximum(yl, yh);
- }
-
- return true;
- }
-
- bool parse_comp_params(texture_file_types::format dst_file_format, crn_comp_params &comp_params)
- {
- if (dst_file_format == texture_file_types::cFormatCRN)
- comp_params.m_quality_level = cDefaultCRNQualityLevel;
-
- if (m_params.has_key("q") || m_params.has_key("quality"))
- {
- const char *pKeyName = m_params.has_key("q") ? "q" : "quality";
-
- if ((dst_file_format == texture_file_types::cFormatDDS) || (dst_file_format == texture_file_types::cFormatCRN) || (dst_file_format == texture_file_types::cFormatKTX))
- {
- uint32 i = m_params.get_value_as_int(pKeyName, 0, cDefaultCRNQualityLevel, 0, cCRNMaxQualityLevel);
-
- comp_params.m_quality_level = i;
- }
- else
- {
- console::error("/quality or /q option is only invalid when writing DDS, KTX or CRN files!");
- return false;
- }
- }
- else
- {
- float desired_bitrate = m_params.get_value_as_float("bitrate", 0, 0.0f, .1f, 30.0f);
- if (desired_bitrate > 0.0f)
- {
- comp_params.m_target_bitrate = desired_bitrate;
- }
- }
-
- int color_endpoints = m_params.get_value_as_int("c", 0, 0, cCRNMinPaletteSize, cCRNMaxPaletteSize);
- int color_selectors = m_params.get_value_as_int("s", 0, 0, cCRNMinPaletteSize, cCRNMaxPaletteSize);
- int alpha_endpoints = m_params.get_value_as_int("ca", 0, 0, cCRNMinPaletteSize, cCRNMaxPaletteSize);
- int alpha_selectors = m_params.get_value_as_int("sa", 0, 0, cCRNMinPaletteSize, cCRNMaxPaletteSize);
- if ( ((color_endpoints > 0) && (color_selectors > 0)) ||
- ((alpha_endpoints > 0) && (alpha_selectors > 0)) )
- {
- comp_params.set_flag(cCRNCompFlagManualPaletteSizes, true);
- comp_params.m_crn_color_endpoint_palette_size = color_endpoints;
- comp_params.m_crn_color_selector_palette_size = color_selectors;
- comp_params.m_crn_alpha_endpoint_palette_size = alpha_endpoints;
- comp_params.m_crn_alpha_selector_palette_size = alpha_selectors;
- }
-
- if (m_params.has_key("alphaThreshold"))
- {
- int dxt1a_alpha_threshold = m_params.get_value_as_int("alphaThreshold", 0, 128, 0, 255);
- comp_params.m_dxt1a_alpha_threshold = dxt1a_alpha_threshold;
- if (dxt1a_alpha_threshold > 0)
- {
- comp_params.set_flag(cCRNCompFlagDXT1AForTransparency, true);
- }
- }
-
- comp_params.set_flag(cCRNCompFlagPerceptual, !m_params.get_value_as_bool("uniformMetrics"));
- comp_params.set_flag(cCRNCompFlagHierarchical, !m_params.get_value_as_bool("noAdaptiveBlocks"));
-
- if (m_params.has_key("helperThreads"))
- comp_params.m_num_helper_threads = m_params.get_value_as_int("helperThreads", 0, cCRNMaxHelperThreads, 0, cCRNMaxHelperThreads);
- else if (g_number_of_processors > 1)
- comp_params.m_num_helper_threads = g_number_of_processors - 1;
-
- dynamic_string comp_name;
- if (m_params.get_value_as_string("compressor", 0, comp_name))
- {
- uint32 i;
- for (i = 0; i < cCRNTotalDXTCompressors; i++)
- {
- if (comp_name == get_dxt_compressor_name(static_cast<crn_dxt_compressor_type>(i)))
- {
- comp_params.m_dxt_compressor_type = static_cast<crn_dxt_compressor_type>(i);
- break;
- }
- }
- if (i == cCRNTotalDXTCompressors)
- {
- console::error("Invalid compressor: \"%s\"", comp_name.get_ptr());
- return false;
- }
- }
-
- dynamic_string dxt_quality_str;
- if (m_params.get_value_as_string("dxtquality", 0, dxt_quality_str))
- {
- uint32 i;
- for (i = 0; i < cCRNDXTQualityTotal; i++)
- {
- if (dxt_quality_str == crn_get_dxt_quality_string(static_cast<crn_dxt_quality>(i)))
- {
- comp_params.m_dxt_quality = static_cast<crn_dxt_quality>(i);
- break;
- }
- }
- if (i == cCRNDXTQualityTotal)
- {
- console::error("Invalid DXT quality: \"%s\"", dxt_quality_str.get_ptr());
- return false;
- }
- }
- else
- {
- comp_params.m_dxt_quality = cCRNDXTQualityUber;
- }
-
- comp_params.set_flag(cCRNCompFlagDisableEndpointCaching, m_params.get_value_as_bool("noendpointcaching"));
- comp_params.set_flag(cCRNCompFlagGrayscaleSampling, m_params.get_value_as_bool("grayscalesampling"));
- comp_params.set_flag(cCRNCompFlagUseBothBlockTypes, !m_params.get_value_as_bool("forceprimaryencoding"));
- if (comp_params.get_flag(cCRNCompFlagUseBothBlockTypes))
- comp_params.set_flag(cCRNCompFlagUseTransparentIndicesForBlack, m_params.get_value_as_bool("usetransparentindicesforblack"));
- else
- comp_params.set_flag(cCRNCompFlagUseTransparentIndicesForBlack, false);
-
- return true;
- }
-
- convert_status display_file_info(uint32 file_index, uint32 num_files, const char* pSrc_filename)
- {
- if (num_files > 1)
- console::message("[%u/%u] Source texture: \"%s\"", file_index + 1, num_files, pSrc_filename);
- else
- console::message("Source texture: \"%s\"", pSrc_filename);
-
- texture_file_types::format src_file_format = texture_file_types::determine_file_format(pSrc_filename);
- if (src_file_format == texture_file_types::cFormatInvalid)
- {
- console::error("Unrecognized file type: %s", pSrc_filename);
- return cCSFailed;
- }
-
- mipmapped_texture src_tex;
- if (!src_tex.read_from_file(pSrc_filename, src_file_format))
- {
- if (src_tex.get_last_error().is_empty())
- console::error("Failed reading source file: \"%s\"", pSrc_filename);
- else
- console::error("%s", src_tex.get_last_error().get_ptr());
-
- return cCSFailed;
- }
-
- uint64 input_file_size;
- file_utils::get_file_size(pSrc_filename, input_file_size);
-
- uint32 total_in_pixels = 0;
- for (uint32 i = 0; i < src_tex.get_num_levels(); i++)
- {
- uint32 width = math::maximum<uint32>(1, src_tex.get_width() >> i);
- uint32 height = math::maximum<uint32>(1, src_tex.get_height() >> i);
- total_in_pixels += width*height*src_tex.get_num_faces();
- }
-
- vector<uint8> src_tex_bytes;
- if (!cfile_stream::read_file_into_array(pSrc_filename, src_tex_bytes))
- {
- console::error("Failed loading source file: %s", pSrc_filename);
- return cCSFailed;
- }
-
- if (!src_tex_bytes.size())
- {
- console::warning("Source file is empty: %s", pSrc_filename);
- return cCSSkipped;
- }
-
- uint32 compressed_size = 0;
- if (m_params.has_key("lzmastats"))
- {
- lzma_codec lossless_codec;
- vector<uint8> cmp_tex_bytes;
- if (lossless_codec.pack(src_tex_bytes.get_ptr(), src_tex_bytes.size(), cmp_tex_bytes))
- {
- compressed_size = cmp_tex_bytes.size();
- }
- }
- console::info("Source texture dimensions: %ux%u, Levels: %u, Faces: %u, Format: %s\nPacked Format: %u, Apparent Type: %s, Flipped: %u, Can Unflip Without Unpacking: %u",
- src_tex.get_width(),
- src_tex.get_height(),
- src_tex.get_num_levels(),
- src_tex.get_num_faces(),
- pixel_format_helpers::get_pixel_format_string(src_tex.get_format()),
- src_tex.is_packed(), get_texture_type_desc(src_tex.determine_texture_type()),
- src_tex.is_flipped(), src_tex.can_unflip_without_unpacking());
-
- console::info("Total pixels: %u, Source file size: " CRNLIB_UINT64_FORMAT_SPECIFIER ", Source file bits/pixel: %1.3f",
- total_in_pixels, input_file_size, (input_file_size * 8.0f) / total_in_pixels);
- if (compressed_size)
- {
- console::info("LZMA compressed file size: %u bytes, %1.3f bits/pixel",
- compressed_size, compressed_size * 8.0f / total_in_pixels);
- }
-
- double entropy = math::compute_entropy(src_tex_bytes.get_ptr(), src_tex_bytes.size());
- console::info("Source file entropy: %3.6f bits per byte", entropy / src_tex_bytes.size());
-
- if (src_file_format == texture_file_types::cFormatCRN)
- {
- crnd::crn_texture_info tex_info;
- tex_info.m_struct_size = sizeof(crnd::crn_texture_info);
- crn_bool success = crnd::crnd_get_texture_info(src_tex_bytes.get_ptr(), src_tex_bytes.size(), &tex_info);
- if (!success)
- console::error("Failed retrieving CRN texture info!");
- else
- {
- console::info("CRN texture info:");
-
- console::info("Width: %u, Height: %u, Levels: %u, Faces: %u\nBytes per block: %u, User0: 0x%08X, User1: 0x%08X, CRN Format: %u",
- tex_info.m_width,
- tex_info.m_height,
- tex_info.m_levels,
- tex_info.m_faces,
- tex_info.m_bytes_per_block,
- tex_info.m_userdata0,
- tex_info.m_userdata1,
- tex_info.m_format);
- }
- }
-
- return cCSSucceeded;
- }
-
- void print_stats(texture_conversion::convert_stats &stats, bool force_image_stats = false)
- {
- dynamic_string csv_filename;
- const char *pCSVStatsFilename = m_params.get_value_as_string("csvfile", 0, csv_filename) ? csv_filename.get_ptr() : NULL;
-
- bool image_stats = force_image_stats || m_params.get_value_as_bool("imagestats") || m_params.get_value_as_bool("mipstats") || (pCSVStatsFilename != NULL);
- bool mip_stats = m_params.get_value_as_bool("mipstats");
- bool grayscale_sampling = m_params.get_value_as_bool("grayscalesampling");
- if (!stats.print(image_stats, mip_stats, grayscale_sampling, pCSVStatsFilename))
- {
- console::warning("Unable to compute/display full output file statistics.");
- }
- }
-
- convert_status compare_file(uint32 file_index, uint32 num_files, const char* pSrc_filename, const char* pDst_filename, texture_file_types::format out_file_type)
- {
- if (num_files > 1)
- console::message("[%u/%u] Comparing source texture \"%s\" to output texture \"%s\"", file_index + 1, num_files, pSrc_filename, pDst_filename);
- else
- console::message("Comparing source texture \"%s\" to output texture \"%s\"", pSrc_filename, pDst_filename);
-
- texture_file_types::format src_file_format = texture_file_types::determine_file_format(pSrc_filename);
- if (src_file_format == texture_file_types::cFormatInvalid)
- {
- console::error("Unrecognized file type: %s", pSrc_filename);
- return cCSFailed;
- }
-
- mipmapped_texture src_tex;
-
- if (!src_tex.read_from_file(pSrc_filename, src_file_format))
- {
- if (src_tex.get_last_error().is_empty())
- console::error("Failed reading source file: \"%s\"", pSrc_filename);
- else
- console::error("%s", src_tex.get_last_error().get_ptr());
-
- return cCSFailed;
- }
-
- texture_conversion::convert_stats stats;
- if (!stats.init(pSrc_filename, pDst_filename, src_tex, out_file_type, m_params.has_key("lzmastats")))
- return cCSFailed;
-
- print_stats(stats, true);
-
- return cCSSucceeded;
- }
-
- convert_status convert_file(uint32 file_index, uint32 num_files, const char* pSrc_filename, const char* pDst_filename, texture_file_types::format out_file_type)
- {
- timer tim;
-
- if (num_files > 1)
- console::message("[%u/%u] Reading source texture: \"%s\"", file_index + 1, num_files, pSrc_filename);
- else
- console::message("Reading source texture: \"%s\"", pSrc_filename);
-
- texture_file_types::format src_file_format = texture_file_types::determine_file_format(pSrc_filename);
- if (src_file_format == texture_file_types::cFormatInvalid)
- {
- console::error("Unrecognized file type: %s", pSrc_filename);
- return cCSFailed;
- }
-
- mipmapped_texture src_tex;
- tim.start();
- if (!src_tex.read_from_file(pSrc_filename, src_file_format))
- {
- if (src_tex.get_last_error().is_empty())
- console::error("Failed reading source file: \"%s\"", pSrc_filename);
- else
- console::error("%s", src_tex.get_last_error().get_ptr());
-
- return cCSFailed;
- }
- double total_time = tim.get_elapsed_secs();
- console::info("Texture successfully loaded in %3.3fs", total_time);
-
- if (m_params.get_value_as_bool("converttoluma"))
- src_tex.convert(image_utils::cConversion_Y_To_RGB);
- if (m_params.get_value_as_bool("setalphatoluma"))
- src_tex.convert(image_utils::cConversion_Y_To_A);
-
- texture_conversion::convert_params params;
-
- params.m_texture_type = src_tex.determine_texture_type();
- params.m_pInput_texture = &src_tex;
- params.m_dst_filename = pDst_filename;
- params.m_dst_file_type = out_file_type;
- params.m_lzma_stats = m_params.has_key("lzmastats");
- params.m_write_mipmaps_to_multiple_files = m_params.has_key("split");
- params.m_always_use_source_pixel_format = m_params.has_key("usesourceformat");
- params.m_y_flip = m_params.has_key("yflip");
- params.m_unflip = m_params.has_key("unflip");
-
- if ((!m_params.get_value_as_bool("noprogress")) && (!m_params.get_value_as_bool("quiet")))
- params.m_pProgress_func = progress_callback_func;
-
- if (m_params.get_value_as_bool("debug"))
- {
- params.m_debugging = true;
- params.m_comp_params.set_flag(cCRNCompFlagDebugging, true);
- }
-
- if (m_params.get_value_as_bool("paramdebug"))
- params.m_param_debugging = true;
-
- if (m_params.get_value_as_bool("quick"))
- params.m_quick = true;
-
- params.m_no_stats = m_params.get_value_as_bool("nostats");
-
- params.m_dst_format = PIXEL_FMT_INVALID;
-
- for (uint32 i = 0; i < pixel_format_helpers::get_num_formats(); i++)
- {
- pixel_format trial_fmt = pixel_format_helpers::get_pixel_format_by_index(i);
- if (m_params.has_key(pixel_format_helpers::get_pixel_format_string(trial_fmt)))
- {
- params.m_dst_format = trial_fmt;
- break;
- }
- }
-
- if (texture_file_types::supports_mipmaps(src_file_format))
- {
- params.m_mipmap_params.m_mode = cCRNMipModeUseSourceMips;
- }
-
- if (!parse_mipmap_params(params.m_mipmap_params))
- return cCSBadParam;
-
- if (!parse_comp_params(params.m_dst_file_type, params.m_comp_params))
- return cCSBadParam;
-
- if (!parse_scale_params(params.m_mipmap_params))
- return cCSBadParam;
-
- print_texture_info("Source texture", params, src_tex);
-
- if (params.m_texture_type == cTextureTypeNormalMap)
- {
- params.m_comp_params.set_flag(cCRNCompFlagPerceptual, false);
- }
-
- texture_conversion::convert_stats stats;
-
- tim.start();
- bool status = texture_conversion::process(params, stats);
- total_time = tim.get_elapsed_secs();
-
- if (!status)
- {
- if (params.m_error_message.is_empty())
- console::error("Failed writing output file: \"%s\"", pDst_filename);
- else
- console::error(params.m_error_message.get_ptr());
- return cCSFailed;
- }
-
- console::info("Texture successfully processed in %3.3fs", total_time);
-
- if (!m_params.get_value_as_bool("nostats"))
- print_stats(stats);
-
- return cCSSucceeded;
- }
-};
-
-//-----------------------------------------------------------------------------------------------------------------------
-
-static bool check_for_option(int argc, char *argv[], const char *pOption)
-{
- for (int i = 1; i < argc; i++)
- {
- if ((argv[i][0] == '/') || (argv[i][0] == '-'))
- {
- if (crn_stricmp(&argv[i][1], pOption) == 0)
- return true;
- }
- }
- return false;
-}
-
-//-----------------------------------------------------------------------------------------------------------------------
-
-static void print_title()
-{
- console::printf("crunch: Advanced DXTn Texture Compressor - https://github.com/BinomialLLC/crunch");
- console::printf("Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC");
- console::printf("crnlib version v%u.%02u %s Built %s, %s", CRNLIB_VERSION / 100U, CRNLIB_VERSION % 100U, crnlib_is_x64() ? "x64" : "x86", __DATE__, __TIME__);
- console::printf("");
-}
-
-//-----------------------------------------------------------------------------------------------------------------------
-
-static int main_internal(int argc, char *argv[])
-{
- argc;
- argv;
-
- colorized_console::init();
-
- if (check_for_option(argc, argv, "quiet"))
- console::disable_output();
-
- print_title();
-
- dynamic_string cmd_line;
- get_command_line_as_single_string(cmd_line, argc, argv);
-
- bool status = false;
- if (check_for_option(argc, argv, "corpus_gen"))
- {
- corpus_gen generator;
- status = generator.generate(cmd_line.get_ptr());
- }
- else if (check_for_option(argc, argv, "corpus_test"))
- {
- corpus_tester tester;
- status = tester.test(cmd_line.get_ptr());
- }
- else
- {
- crunch converter;
- status = converter.convert(cmd_line.get_ptr());
- }
-
- colorized_console::deinit();
-
- crnlib_print_mem_stats();
-
- return status ? EXIT_SUCCESS : EXIT_FAILURE;
-}
-
-static void pause_and_wait(void)
-{
- console::enable_output();
-
- console::message("\nPress a key to continue.");
-
- for ( ; ; )
- {
- if (crn_getch() != -1)
- break;
- }
-}
-
-//-----------------------------------------------------------------------------------------------------------------------
-
-int main(int argc, char *argv[])
-{
- int status = EXIT_FAILURE;
-
- if (crnlib_is_debugger_present())
- {
- status = main_internal(argc, argv);
- }
- else
- {
-#ifdef _MSC_VER
- __try
- {
- status = main_internal(argc, argv);
- }
- __except(EXCEPTION_EXECUTE_HANDLER)
- {
- console::error("Uncached exception! crunch command line tool failed!");
- }
-#else
- status = main_internal(argc, argv);
-#endif
- }
-
- console::printf("\nExit status: %i", status);
-
- if (check_for_option(argc, argv, "pause"))
- {
- if ((status == EXIT_FAILURE) || (console::get_num_messages(cErrorConsoleMessage)))
- pause_and_wait();
- }
-
- return status;
-}
-
diff --git a/Libraries/crunch-ea9b8d/crunch/crunch_linux.cbp b/Libraries/crunch-ea9b8d/crunch/crunch_linux.cbp
deleted file mode 100644
index 1fca90ed..00000000
--- a/Libraries/crunch-ea9b8d/crunch/crunch_linux.cbp
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="crunch" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="../bin_linux/crunchD" prefix_auto="1" extension_auto="1" />
- <Option working_dir="/home/richg/crunch_work/bin_linux" />
- <Option object_output="obj/Debug/" />
- <Option external_deps="../crnlib/libcrnlibD.a;" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option parameters="-file orig/*.png -fileformat crn -bitrate 1.33 " />
- <Compiler>
- <Add option="-Wextra" />
- <Add option="-Wall" />
- <Add option="-D_DEBUG" />
- </Compiler>
- <Linker>
- <Add library="../crnlib/libcrnlibD.a" />
- <Add library="pthread" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="../bin_linux/crunch" prefix_auto="1" extension_auto="1" />
- <Option working_dir="/home/richg/crunch_work/bin_linux" />
- <Option object_output="obj/Release/" />
- <Option external_deps="../crnlib/libcrnlib.a;" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option parameters="-file orig/*.png -fileformat crn -bitrate 1.33 -imagestats -lzmastats -logfile log3.txt -fileformat crn -bitrate 1.33 -imagestats -lzmastats -logfile log3.txt -bitrate 1.5" />
- <Compiler>
- <Add option="-march=core2" />
- <Add option="-fomit-frame-pointer" />
- <Add option="-fexpensive-optimizations" />
- <Add option="-O3" />
- <Add option="-Wextra" />
- <Add option="-Wall" />
- <Add option="-DNDEBUG" />
- </Compiler>
- <Linker>
- <Add library="../crnlib/libcrnlib.a" />
- <Add library="pthread" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wextra" />
- <Add option="-Wall" />
- <Add option="-g" />
- <Add option="-fexceptions" />
- <Add option="-Wno-unused-value" />
- <Add option="-Wno-unused" />
- <Add option="-fno-strict-aliasing" />
- <Add option="-ffast-math" />
- <Add option="-fno-math-errno" />
- <Add directory="../inc" />
- <Add directory="../crnlib" />
- </Compiler>
- <Unit filename="corpus_gen.cpp" />
- <Unit filename="corpus_gen.h" />
- <Unit filename="corpus_test.cpp" />
- <Unit filename="corpus_test.h" />
- <Unit filename="crunch.cpp" />
- <Extensions>
- <code_completion />
- <debugger />
- <DoxyBlocks>
- <comment_style block="0" line="0" />
- <doxyfile_project />
- <doxyfile_build />
- <doxyfile_warnings />
- <doxyfile_output />
- <doxyfile_dot />
- <general />
- </DoxyBlocks>
- <envvars />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/Libraries/crunch-ea9b8d/emscripten/crunch_lib.cpp b/Libraries/crunch-ea9b8d/emscripten/crunch_lib.cpp
deleted file mode 100644
index cc66b7d1..00000000
--- a/Libraries/crunch-ea9b8d/emscripten/crunch_lib.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Copyright (c) 2013, Evan Parker, Brandon Jones. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-#define PLATFORM_NACL // This disables use of 64 bit integers, among other things.
-
-#include <stddef.h> // For NULL, size_t
-#include <cstring> // for malloc etc
-
-#include "crn_decomp.h"
-
-extern "C" {
- unsigned int crn_get_width(void *src, unsigned int src_size);
- unsigned int crn_get_height(void *src, unsigned int src_size);
- unsigned int crn_get_levels(void *src, unsigned int src_size);
- unsigned int crn_get_dxt_format(void *src, unsigned int src_size);
- unsigned int crn_get_bytes_per_block(void *src, unsigned int src_size);
- unsigned int crn_get_uncompressed_size(void *p, unsigned int size, unsigned int level);
- void crn_decompress(void *src, unsigned int src_size, void *dst, unsigned int dst_size, unsigned int firstLevel, unsigned int levelCount);
-}
-
-unsigned int crn_get_width(void *src, unsigned int src_size) {
- crnd::crn_texture_info tex_info;
- crnd::crnd_get_texture_info(static_cast<crn_uint8*>(src), src_size, &tex_info);
- return tex_info.m_width;
-}
-
-unsigned int crn_get_height(void *src, unsigned int src_size) {
- crnd::crn_texture_info tex_info;
- crnd::crnd_get_texture_info(static_cast<crn_uint8*>(src), src_size, &tex_info);
- return tex_info.m_height;
-}
-
-unsigned int crn_get_levels(void *src, unsigned int src_size) {
- crnd::crn_texture_info tex_info;
- crnd::crnd_get_texture_info(static_cast<crn_uint8*>(src), src_size, &tex_info);
- return tex_info.m_levels;
-}
-
-unsigned int crn_get_dxt_format(void *src, unsigned int src_size) {
- crnd::crn_texture_info tex_info;
- crnd::crnd_get_texture_info(static_cast<crn_uint8*>(src), src_size, &tex_info);
- return tex_info.m_format;
-}
-
-unsigned int crn_get_bytes_per_block(void *src, unsigned int src_size) {
- crnd::crn_texture_info tex_info;
- crnd::crnd_get_texture_info(static_cast<crn_uint8*>(src), src_size, &tex_info);
- return crnd::crnd_get_bytes_per_dxt_block(tex_info.m_format);
-}
-
-unsigned int crn_get_uncompressed_size(void *src, unsigned int src_size, unsigned int level) {
- crnd::crn_texture_info tex_info;
- crnd::crnd_get_texture_info(static_cast<crn_uint8*>(src), src_size, &tex_info);
- const crn_uint32 width = tex_info.m_width >> level;
- const crn_uint32 height = tex_info.m_height >> level;
- const crn_uint32 blocks_x = (width + 3) >> 2;
- const crn_uint32 blocks_y = (height + 3) >> 2;
- const crn_uint32 row_pitch = blocks_x * crnd::crnd_get_bytes_per_dxt_block(tex_info.m_format);
- const crn_uint32 total_face_size = row_pitch * blocks_y;
- return total_face_size;
-}
-
-void crn_decompress(void *src, unsigned int src_size, void *dst, unsigned int dst_size, unsigned int firstLevel, unsigned int levelCount) {
- crnd::crn_texture_info tex_info;
- crnd::crnd_get_texture_info(static_cast<crn_uint8*>(src), src_size, &tex_info);
-
- crn_uint32 width = tex_info.m_width >> firstLevel;
- crn_uint32 height = tex_info.m_height >> firstLevel;
- crn_uint32 bytes_per_block = crnd::crnd_get_bytes_per_dxt_block(tex_info.m_format);
-
- void *pDecomp_images[1];
- pDecomp_images[0] = dst;
-
- crnd::crnd_unpack_context pContext =
- crnd::crnd_unpack_begin(static_cast<crn_uint8*>(src), src_size);
-
- for (int i = firstLevel; i < firstLevel + levelCount; ++i) {
- crn_uint32 blocks_x = (width + 3) >> 2;
- crn_uint32 blocks_y = (height + 3) >> 2;
- crn_uint32 row_pitch = blocks_x * bytes_per_block;
- crn_uint32 total_level_size = row_pitch * blocks_y;
-
- crnd::crnd_unpack_level(pContext, pDecomp_images, total_level_size, row_pitch, i);
- pDecomp_images[0] = (char*)pDecomp_images[0] + total_level_size;
-
- width = width >> 1;
- height = height >> 1;
- }
-
- crnd::crnd_unpack_end(pContext);
-} \ No newline at end of file
diff --git a/Libraries/crunch-ea9b8d/example1/example1.2008.vcproj b/Libraries/crunch-ea9b8d/example1/example1.2008.vcproj
deleted file mode 100644
index 9184de72..00000000
--- a/Libraries/crunch-ea9b8d/example1/example1.2008.vcproj
+++ /dev/null
@@ -1,716 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="example1"
- ProjectGUID="{8F745B42-F996-49EB-859B-970A671DE05D}"
- RootNamespace="comp"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="false"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlibD_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)D.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="false"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlibD_x64_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)D_x64.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlib_VC9.lib&quot;"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- FloatingPointModel="2"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlib_x64_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)_x64.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_DLL|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="false"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlibD_DLL_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)D_DLL.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_DLL|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="false"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlibD_DLL_x64_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)D_DLL_x64.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_DLL|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlib_DLL_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)_DLL.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_DLL|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- FloatingPointModel="2"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlib_DLL_x64_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)_DLL_x64.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F2-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\example1.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995384-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\stb_image.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{61DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/crunch-ea9b8d/example1/example1.cpp b/Libraries/crunch-ea9b8d/example1/example1.cpp
deleted file mode 100644
index 69d1a89d..00000000
--- a/Libraries/crunch-ea9b8d/example1/example1.cpp
+++ /dev/null
@@ -1,579 +0,0 @@
-// File: example1.cpp - Simple command line tool that uses the crnlib lib and the crn_decomp.h header file library
-// to compress, transcode/unpack, and inspect CRN/DDS textures.
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <algorithm>
-
-// Public crnlib header.
-#include "crnlib.h"
-
-// CRN transcoder library.
-#include "crn_decomp.h"
-// .DDS file format definitions.
-#include "dds_defs.h"
-
-// stb_image, for loading/saving image files.
-#ifdef _MSC_VER
-#pragma warning (disable: 4244) // conversion from 'int' to 'uint8', possible loss of data
-#pragma warning (disable: 4100) // unreferenced formal parameter
-#endif
-#include "stb_image.h"
-
-// windows.h is only needed here for GetSystemInfo().
-#define WIN32_LEAN_AND_MEAN
-#define NOMINMAX
-#include "windows.h"
-
-using namespace crnlib;
-
-const int cDefaultCRNQualityLevel = 128;
-
-static int print_usage()
-{
- printf("Description: Simple crnlib API example program.\n");
- printf("Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC\n");
- printf("Usage: example1 [mode: i/c/d] [source_file] [options]\n");
- printf("\nModes:\n");
- printf("c: Compress to .DDS or .CRN using the crn_compress() func. in crnlib.h\n");
- printf(" The default output format is .DDS\n");
- printf(" Supported source image formats:\n");
- printf(" Baseline JPEG, PNG, BMP, TGA, PSD, and HDR\n");
- printf("d: Transcodes a .CRN file to .DDS using the crn_decompress_crn_to_dds() func.,\n");
- printf("or unpacks each face and mipmap level in a .DDS file to multiple .TGA files.\n");
- printf("i: Display info about source_file.\n");
- printf("\nOptions:\n");
- printf("-out filename - Force output filename.\n");
- printf("\nCompression mode options:\n");
- printf("-crn - Generate a .CRN file instead of .DDS\n");
- printf("-bitrate # - Specify desired CRN/DDS bits/texel, from [.1-8]\n");
- printf(" When writing .DDS: -bitrate or -quality enable clustered DXTn compression.\n");
- printf("-quality # - Specify CRN/DDS quality level factor, from [0-255]\n");
- printf("-noAdaptiveBlocks - Always use 4x4 blocks instead of up to 8x8 macroblocks\n");
- printf("-nonsrgb - Input is not sRGB: disables gamma filtering, perceptual metrics.\n");
- printf("-nomips - Don't generate mipmaps\n");
- printf("-setalphatoluma - Set alpha channel to luma before compression.\n");
- printf("-converttoluma - Set RGB to luma before compression.\n");
- printf("-pixelformat fmt - Output file's crn_format: DXT1, DXT1A, DXT3, DXT5_CCxY,\n");
- printf(" DXT5_xGxR, DXT5_xGBR, DXT5_AGBR, DXN_XY (ATI 3DC), DXN_YX (ATI 3DC),\n");
- printf(" DXT5A (ATN1N)\n");
- printf(" If no output format is specified, this example uses either DXT1 or DXT5.\n");
- return EXIT_FAILURE;
-}
-
-static int error(const char* pMsg, ...)
-{
- va_list args;
- va_start(args, pMsg);
- char buf[512];
- vsprintf_s(buf, sizeof(buf), pMsg, args);
- va_end(args);
- printf("%s", buf);
- return EXIT_FAILURE;
-}
-
-// Loads an entire file into an allocated memory block.
-static crn_uint8 *read_file_into_buffer(const char *pFilename, crn_uint32 &size)
-{
- size = 0;
-
- FILE* pFile = NULL;
- fopen_s(&pFile, pFilename, "rb");
- if (!pFile)
- return NULL;
-
- fseek(pFile, 0, SEEK_END);
- size = ftell(pFile);
- fseek(pFile, 0, SEEK_SET);
-
- crn_uint8 *pSrc_file_data = static_cast<crn_uint8*>(malloc(std::max(1U, size)));
- if ((!pSrc_file_data) || (fread(pSrc_file_data, size, 1, pFile) != 1))
- {
- fclose(pFile);
- free(pSrc_file_data);
- size = 0;
- return NULL;
- }
-
- fclose(pFile);
- return pSrc_file_data;
-}
-
-// Cracks a CRN's file header using the helper functions in crn_decomp.h.
-static bool print_crn_info(const crn_uint8 *pData, crn_uint32 data_size)
-{
- crnd::crn_file_info file_info;
- if (!crnd::crnd_validate_file(pData, data_size, &file_info))
- return false;
-
- printf("crnd_validate_file:\n");
- printf("File size: %u\nActualDataSize: %u\nHeaderSize: %u\nTotalPaletteSize: %u\nTablesSize: %u\nLevels: %u\n", data_size,
- file_info.m_actual_data_size, file_info.m_header_size, file_info.m_total_palette_size, file_info.m_tables_size, file_info.m_levels);
-
- printf("LevelCompressedSize: ");
- for (crn_uint32 i = 0; i < cCRNMaxLevels; i++)
- printf("%u ", file_info.m_level_compressed_size[i]);
- printf("\n");
-
- printf("ColorEndpointPaletteSize: %u\n", file_info.m_color_endpoint_palette_entries);
- printf("ColorSelectorPaletteSize: %u\n", file_info.m_color_selector_palette_entries);
- printf("AlphaEndpointPaletteSize: %u\n", file_info.m_alpha_endpoint_palette_entries);
- printf("AlphaSelectorPaletteSize: %u\n", file_info.m_alpha_selector_palette_entries);
-
- printf("crnd_get_texture_info:\n");
- crnd::crn_texture_info tex_info;
- if (!crnd::crnd_get_texture_info(pData, data_size, &tex_info))
- return false;
-
- printf("Dimensions: %ux%u\nLevels: %u\nFaces: %u\nBytesPerBlock: %u\nUserData0: %u\nUserData1: %u\nCrnFormat: %S\n",
- tex_info.m_width, tex_info.m_height, tex_info.m_levels, tex_info.m_faces, tex_info.m_bytes_per_block, tex_info.m_userdata0, tex_info.m_userdata1, crn_get_format_string(tex_info.m_format));
-
- return true;
-}
-
-// Cracks the DDS header and dump its contents.
-static bool print_dds_info(const void *pData, crn_uint32 data_size)
-{
- if ((data_size < 128) || (*reinterpret_cast<const crn_uint32*>(pData) != crnlib::cDDSFileSignature))
- return false;
-
- const crnlib::DDSURFACEDESC2 &desc = *reinterpret_cast<const crnlib::DDSURFACEDESC2*>((reinterpret_cast<const crn_uint8*>(pData) + sizeof(crn_uint32)));
- if (desc.dwSize != sizeof(crnlib::DDSURFACEDESC2))
- return false;
-
- printf("DDS file information:\n");
- printf("File size: %u\nDimensions: %ux%u\nPitch/LinearSize: %u\n", data_size, desc.dwWidth, desc.dwHeight, desc.dwLinearSize);
- printf("MipMapCount: %u\nAlphaBitDepth: %u\n", desc.dwMipMapCount, desc.dwAlphaBitDepth);
-
- const char *pDDSDFlagNames[] =
- {
- "DDSD_CAPS", "DDSD_HEIGHT", "DDSD_WIDTH", "DDSD_PITCH",
- NULL, "DDSD_BACKBUFFERCOUNT", "DDSD_ZBUFFERBITDEPTH", "DDSD_ALPHABITDEPTH",
- NULL, NULL, NULL, "DDSD_LPSURFACE",
- "DDSD_PIXELFORMAT", "DDSD_CKDESTOVERLAY", "DDSD_CKDESTBLT", "DDSD_CKSRCOVERLAY",
- "DDSD_CKSRCBLT", "DDSD_MIPMAPCOUNT", "DDSD_REFRESHRATE", "DDSD_LINEARSIZE",
- "DDSD_TEXTURESTAGE", "DDSD_FVF", "DDSD_SRCVBHANDLE", "DDSD_DEPTH"
- };
-
- printf("DDSD Flags: 0x%08X ", desc.dwFlags);
- for (int i = 0; i < sizeof(pDDSDFlagNames)/sizeof(pDDSDFlagNames[0]); i++)
- if ((pDDSDFlagNames[i]) && (desc.dwFlags & (1 << i)))
- printf("%s ", pDDSDFlagNames[i]);
- printf("\n\n");
-
- printf("ddpfPixelFormat.dwFlags: 0x%08X ", desc.ddpfPixelFormat.dwFlags);
- if (desc.ddpfPixelFormat.dwFlags & DDPF_ALPHAPIXELS) printf("DDPF_ALPHAPIXELS ");
- if (desc.ddpfPixelFormat.dwFlags & DDPF_ALPHA) printf("DDPF_ALPHA ");
- if (desc.ddpfPixelFormat.dwFlags & DDPF_FOURCC) printf("DDPF_FOURCC ");
- if (desc.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) printf("DDPF_PALETTEINDEXED8 ");
- if (desc.ddpfPixelFormat.dwFlags & DDPF_RGB) printf("DDPF_RGB ");
- if (desc.ddpfPixelFormat.dwFlags & DDPF_LUMINANCE) printf("DDPF_LUMINANCE ");
- printf("\n");
-
- printf("ddpfPixelFormat.dwFourCC: 0x%08X '%c' '%c' '%c' '%c'\n",
- desc.ddpfPixelFormat.dwFourCC,
- std::max(32U, desc.ddpfPixelFormat.dwFourCC & 0xFF),
- std::max(32U, (desc.ddpfPixelFormat.dwFourCC >> 8) & 0xFF),
- std::max(32U, (desc.ddpfPixelFormat.dwFourCC >> 16) & 0xFF),
- std::max(32U, (desc.ddpfPixelFormat.dwFourCC >> 24) & 0xFF));
-
- printf("dwRGBBitCount: %u 0x%08X\n",
- desc.ddpfPixelFormat.dwRGBBitCount, desc.ddpfPixelFormat.dwRGBBitCount);
-
- printf("dwRGBBitCount as FOURCC: '%c' '%c' '%c' '%c'\n",
- std::max(32U, desc.ddpfPixelFormat.dwRGBBitCount & 0xFF),
- std::max(32U, (desc.ddpfPixelFormat.dwRGBBitCount >> 8) & 0xFF),
- std::max(32U, (desc.ddpfPixelFormat.dwRGBBitCount >> 16) & 0xFF),
- std::max(32U, (desc.ddpfPixelFormat.dwRGBBitCount >> 24) & 0xFF));
-
- printf("dwRBitMask: 0x%08X\ndwGBitMask: 0x%08X\ndwBBitMask: 0x%08X\ndwRGBAlphaBitMask: 0x%08X\n",
- desc.ddpfPixelFormat.dwRBitMask, desc.ddpfPixelFormat.dwGBitMask, desc.ddpfPixelFormat.dwBBitMask, desc.ddpfPixelFormat.dwRGBAlphaBitMask);
-
- printf("\n");
- printf("ddsCaps.dwCaps: 0x%08X ", desc.ddsCaps.dwCaps);
- if (desc.ddsCaps.dwCaps & DDSCAPS_COMPLEX) printf("DDSCAPS_COMPLEX ");
- if (desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE) printf("DDSCAPS_TEXTURE ");
- if (desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP) printf("DDSCAPS_MIPMAP");
- printf("\n");
-
- printf("ddsCaps.dwCaps2: 0x%08X ", desc.ddsCaps.dwCaps2);
- const char *pDDCAPS2FlagNames[] =
- {
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, "DDSCAPS2_CUBEMAP", "DDSCAPS2_CUBEMAP_POSITIVEX", "DDSCAPS2_CUBEMAP_NEGATIVEX",
- "DDSCAPS2_CUBEMAP_POSITIVEY", "DDSCAPS2_CUBEMAP_NEGATIVEY", "DDSCAPS2_CUBEMAP_POSITIVEZ", "DDSCAPS2_CUBEMAP_NEGATIVEZ",
- NULL, NULL, NULL, NULL,
- NULL, "DDSCAPS2_VOLUME"
- };
- for (int i = 0; i < sizeof(pDDCAPS2FlagNames)/sizeof(pDDCAPS2FlagNames[0]); i++)
- if ((pDDCAPS2FlagNames[i]) && (desc.ddsCaps.dwCaps2 & (1 << i)))
- printf("%s ", pDDCAPS2FlagNames[i]);
- printf("\n");
-
- printf("ddsCaps.dwCaps3: 0x%08X\nddsCaps.dwCaps4: 0x%08X\n",
- desc.ddsCaps.dwCaps3, desc.ddsCaps.dwCaps4);
-
- return true;
-}
-
-// CRN/DDS compression callback function.
-static crn_bool progress_callback_func(crn_uint32 phase_index, crn_uint32 total_phases, crn_uint32 subphase_index, crn_uint32 total_subphases, void* pUser_data_ptr)
-{
- int percentage_complete = (int)(.5f + (phase_index + float(subphase_index) / total_subphases) * 100.0f) / total_phases;
- printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProcessing: %u%%", std::min(100, std::max(0, percentage_complete)));
- return true;
-}
-
-int main(int argc, char *argv[])
-{
- printf("example1 - Version v%u.%02u Built " __DATE__ ", " __TIME__ "\n", CRNLIB_VERSION / 100, CRNLIB_VERSION % 100);
-
- if (argc < 3)
- return print_usage();
-
- // Parse command line options
- int mode = argv[1][0];
- if ((mode != 'c') && (mode != 'd') && (mode != 'i'))
- return error("Invalid mode!\n");
-
- const char *pSrc_filename = argv[2];
- char out_filename[FILENAME_MAX] = { '\0' };
-
- float bitrate = 0.0f;
- int quality_level = -1;
- bool srgb_colorspace = true;
- bool create_mipmaps = true;
- bool output_crn = false;
- crn_format fmt = cCRNFmtInvalid;
- bool use_adaptive_block_sizes = true;
- bool set_alpha_to_luma = false;
- bool convert_to_luma = false;
- bool enable_dxt1a = false;
-
- for (int i = 3; i < argc; i++)
- {
- if (argv[i][0] == '/')
- argv[i][0] = '-';
-
- if (!_stricmp(argv[i], "-crn"))
- {
- output_crn = true;
- }
- else if (!_stricmp(argv[i], "-pixelformat"))
- {
- if (++i >= argc)
- return error("Expected pixel format!");
-
- if (!_stricmp(argv[i], "dxt1a"))
- {
- enable_dxt1a = true;
- fmt = cCRNFmtDXT1;
- }
- else
- {
- uint f;
- for (f = 0; f < cCRNFmtTotal; f++)
- {
- if (!_stricmp(argv[i], crn_get_format_string(static_cast<crn_format>(f))))
- {
- fmt = static_cast<crn_format>(f);
- break;
- }
- }
- if (f == cCRNFmtTotal)
- return error("Unrecognized pixel format: %s\n", argv[i]);
- }
- }
- else if (!_stricmp(argv[i], "-bitrate"))
- {
- if (++i >= argc)
- return error("Invalid bitrate!");
-
- bitrate = (float)atof(argv[i]);
- if ((bitrate < .1f) || (bitrate > 8.0f))
- return error("Invalid bitrate!");
- }
- else if (!_stricmp(argv[i], "-quality"))
- {
- if (++i >= argc)
- return error("Invalid quality level!");
-
- quality_level = atoi(argv[i]);
- if ((quality_level < 0) || (quality_level > cCRNMaxQualityLevel))
- return error("Invalid quality level!");
- }
- else if (!_stricmp(argv[i], "-out"))
- {
- if (++i >= argc)
- return error("Expected output filename!");
-
- strcpy_s(out_filename, sizeof(out_filename), argv[i]);
- }
- else if (!_stricmp(argv[i], "-nonsrgb"))
- srgb_colorspace = false;
- else if (!_stricmp(argv[i], "-nomips"))
- create_mipmaps = false;
- else if (!_stricmp(argv[i], "-noAdaptiveBlocks"))
- use_adaptive_block_sizes = false;
- else if (!_stricmp(argv[i], "-setalphatoluma"))
- set_alpha_to_luma = true;
- else if (!_stricmp(argv[i], "-converttoluma"))
- convert_to_luma = true;
- else
- return error("Invalid option: %s\n", argv[i]);
- }
-
- char drive_buf[_MAX_DRIVE], dir_buf[_MAX_DIR], fname_buf[_MAX_FNAME], ext_buf[_MAX_EXT];
- if (_splitpath_s(pSrc_filename, drive_buf, _MAX_DRIVE, dir_buf, _MAX_DIR, fname_buf, _MAX_FNAME, ext_buf, _MAX_EXT))
- return error("Invalid source filename!\n");
-
- // Load the source file into memory.
- printf("Loading source file: %s\n", pSrc_filename);
- crn_uint32 src_file_size;
- crn_uint8 *pSrc_file_data = read_file_into_buffer(pSrc_filename, src_file_size);
- if (!pSrc_file_data)
- return error("Unable to read source file\n");
-
- if (mode == 'i')
- {
- // Information
- if (_stricmp(ext_buf, ".crn") == 0)
- {
- if (!print_crn_info(pSrc_file_data, src_file_size))
- {
- free(pSrc_file_data);
- return error("Not a CRN file!\n");
- }
- }
- else if (_stricmp(ext_buf, ".dds") == 0)
- {
- if (!print_dds_info(pSrc_file_data, src_file_size))
- {
- free(pSrc_file_data);
- return error("Not a DDS file!\n");
- }
- }
- else
- {
- // Try parsing the source file as a regular image.
- int x, y, actual_comps;
- stbi_uc *p = stbi_load_from_memory(pSrc_file_data, src_file_size, &x, &y, &actual_comps, 4);
- if (!p)
- {
- free(pSrc_file_data);
- return error("Failed reading image file!\n");
- }
- stbi_image_free(p);
-
- printf("File size: %u\nDimensions: %ix%i\nActual Components: %i\n", src_file_size, x, y, actual_comps);
- }
- }
- else if (mode == 'c')
- {
- // Compression to DDS or CRN.
-
- // If the user has explicitly specified an output file, check the output file's extension to ensure we write the expected format.
- if (out_filename[0])
- {
- char out_fname_buf[_MAX_FNAME], out_ext_buf[_MAX_EXT];
- _splitpath_s(out_filename, NULL, 0, NULL, 0, out_fname_buf, _MAX_FNAME, out_ext_buf, _MAX_EXT);
- if (!_stricmp(out_ext_buf, ".crn"))
- output_crn = true;
- else if (!_stricmp(out_ext_buf, ".dds"))
- output_crn = false;
- }
-
- // Load source image
- int width, height, actual_comps;
- crn_uint32 *pSrc_image = (crn_uint32*)stbi_load_from_memory(pSrc_file_data, src_file_size, &width, &height, &actual_comps, 4);
- if (!pSrc_image)
- {
- free(pSrc_file_data);
- return error("Failed reading image file!\n");
- }
-
- printf("Source file size: %u, Dimensions: %ux%u\nActual Components: %u\n", src_file_size, width, height, actual_comps);
-
- // Fill in compression parameters struct.
- bool has_alpha_channel = actual_comps > 3;
-
- if ((fmt == cCRNFmtDXT5A) && (actual_comps <= 3))
- set_alpha_to_luma = true;
-
- if ((set_alpha_to_luma) || (convert_to_luma))
- {
- for (int i = 0; i < width * height; i++)
- {
- crn_uint32 r = pSrc_image[i] & 0xFF, g = (pSrc_image[i] >> 8) & 0xFF, b = (pSrc_image[i] >> 16) & 0xFF;
- // Compute CCIR 601 luma.
- crn_uint32 y = (19595U * r + 38470U * g + 7471U * b + 32768) >> 16U;
- crn_uint32 a = (pSrc_image[i] >> 24) & 0xFF;
- if (set_alpha_to_luma) a = y;
- if (convert_to_luma) { r = y; g = y; b = y; }
- pSrc_image[i] = r | (g << 8) | (b << 16) | (a << 24);
- }
- }
-
- crn_comp_params comp_params;
- comp_params.m_width = width;
- comp_params.m_height = height;
- comp_params.set_flag(cCRNCompFlagPerceptual, srgb_colorspace);
- comp_params.set_flag(cCRNCompFlagDXT1AForTransparency, enable_dxt1a && has_alpha_channel);
- comp_params.set_flag(cCRNCompFlagHierarchical, use_adaptive_block_sizes);
- comp_params.m_file_type = output_crn ? cCRNFileTypeCRN : cCRNFileTypeDDS;
- comp_params.m_format = (fmt != cCRNFmtInvalid) ? fmt : (has_alpha_channel ? cCRNFmtDXT5 : cCRNFmtDXT1);
-
- // Important note: This example only feeds a single source image to the compressor, and it internaly generates mipmaps from that source image.
- // If you want, there's nothing stopping you from generating the mipmaps on your own, then feeding the multiple source images
- // to the compressor. Just set the crn_mipmap_params::m_mode member (set below) to cCRNMipModeUseSourceMips.
- comp_params.m_pImages[0][0] = pSrc_image;
-
- if (bitrate > 0.0f)
- comp_params.m_target_bitrate = bitrate;
- else if (quality_level >= 0)
- comp_params.m_quality_level = quality_level;
- else if (output_crn)
- {
- // Set a default quality level for CRN, otherwise we'll get the default (highest quality) which leads to huge compressed palettes.
- comp_params.m_quality_level = cDefaultCRNQualityLevel;
- }
-
- // Determine the # of helper threads (in addition to the main thread) to use during compression. NumberOfCPU's-1 is reasonable.
- SYSTEM_INFO g_system_info;
- GetSystemInfo(&g_system_info);
- int num_helper_threads = std::max<int>(0, (int)g_system_info.dwNumberOfProcessors - 1);
- comp_params.m_num_helper_threads = num_helper_threads;
-
- comp_params.m_pProgress_func = progress_callback_func;
-
- // Fill in mipmap parameters struct.
- crn_mipmap_params mip_params;
- mip_params.m_gamma_filtering = srgb_colorspace;
- mip_params.m_mode = create_mipmaps ? cCRNMipModeGenerateMips : cCRNMipModeNoMips;
-
- crn_uint32 actual_quality_level;
- float actual_bitrate;
- crn_uint32 output_file_size;
-
- printf("Compressing to %s\n", crn_get_format_string(comp_params.m_format));
-
- // Now compress to DDS or CRN.
- void *pOutput_file_data = crn_compress(comp_params, mip_params, output_file_size, &actual_quality_level, &actual_bitrate);
- printf("\n");
-
- if (!pOutput_file_data)
- {
- stbi_image_free(pSrc_image);
- free(pSrc_file_data);
- return error("Compression failed!");
- }
-
- printf("Compressed to %u bytes, quality level: %u, effective bitrate: %f\n", output_file_size, actual_quality_level, actual_bitrate);
-
- // Write the output file.
- char dst_filename[FILENAME_MAX];
- sprintf_s(dst_filename, sizeof(dst_filename), "%s%s%s%s", drive_buf, dir_buf, fname_buf, output_crn ? ".crn" : ".dds");
- if (out_filename[0]) strcpy(dst_filename, out_filename);
-
- printf("Writing %s file: %s\n", output_crn ? "CRN" : "DDS", dst_filename);
- FILE *pFile = fopen(dst_filename, "wb");
- if ((!pFile) || (fwrite(pOutput_file_data, output_file_size, 1, pFile) != 1) || (fclose(pFile) == EOF))
- {
- free(pSrc_file_data);
- crn_free_block(pOutput_file_data);
- stbi_image_free(pSrc_image);
- return error("Failed writing to output file!\n");
- }
-
- crn_free_block(pOutput_file_data);
- stbi_image_free(pSrc_image);
- }
- else if (_stricmp(ext_buf, ".crn") == 0)
- {
- // Decompress/transcode CRN to DDS.
- printf("Decompressing CRN to DDS\n");
-
- // Transcode the CRN file to a DDS file in memory.
- crn_uint32 dds_file_size = src_file_size;
- void *pDDS_file_data = crn_decompress_crn_to_dds(pSrc_file_data, dds_file_size);
- if (!pDDS_file_data)
- {
- free(pSrc_file_data);
- return error("Failed decompressing CRN file!\n");
- }
-
- // Now write the DDS file to disk.
- char dst_filename[FILENAME_MAX];
- sprintf_s(dst_filename, sizeof(dst_filename), "%s%s%s.dds", drive_buf, dir_buf, fname_buf);
- if (out_filename[0]) strcpy(dst_filename, out_filename);
-
- printf("Writing file: %s\n", dst_filename);
- FILE *pFile = fopen(dst_filename, "wb");
- if ((!pFile) || (fwrite(pDDS_file_data, dds_file_size, 1, pFile) != 1) || (fclose(pFile) == EOF))
- {
- crn_free_block(pDDS_file_data);
- free(pSrc_file_data);
- return error("Failed writing to output file!\n");
- }
-
- printf("\n");
-
- print_dds_info(pDDS_file_data, dds_file_size);
-
- crn_free_block(pDDS_file_data);
- }
- else if (_stricmp(ext_buf, ".dds") == 0)
- {
- // Unpack DDS to one or more TGA's.
- if (out_filename[0])
- _splitpath_s(out_filename, drive_buf, _MAX_DRIVE, dir_buf, _MAX_DIR, fname_buf, _MAX_FNAME, ext_buf, _MAX_EXT);
-
- crn_texture_desc tex_desc;
- crn_uint32 *pImages[cCRNMaxFaces * cCRNMaxLevels];
- if (!crn_decompress_dds_to_images(pSrc_file_data, src_file_size, pImages, tex_desc))
- {
- free(pSrc_file_data);
- return error("Failed unpacking DDS file!\n");
- }
-
- printf("Decompressed texture Dimensions: %ux%u, Faces: %u, Levels: %u, FourCC: 0x%08X '%c' '%c' '%c' '%c'\n",
- tex_desc.m_width, tex_desc.m_height, tex_desc.m_faces, tex_desc.m_levels, tex_desc.m_fmt_fourcc,
- std::max(32U, tex_desc.m_fmt_fourcc & 0xFF),
- std::max(32U, (tex_desc.m_fmt_fourcc >> 8) & 0xFF),
- std::max(32U, (tex_desc.m_fmt_fourcc >> 16) & 0xFF),
- std::max(32U, (tex_desc.m_fmt_fourcc >> 24) & 0xFF));
-
- for (crn_uint32 face_index = 0; face_index < tex_desc.m_faces; face_index++)
- {
- for (crn_uint32 level_index = 0; level_index < tex_desc.m_levels; level_index++)
- {
- int width = std::max(1U, tex_desc.m_width >> level_index);
- int height = std::max(1U, tex_desc.m_height >> level_index);
-
- char dst_filename[FILENAME_MAX];
- sprintf_s(dst_filename, sizeof(dst_filename), "%s%s%s_face%u_mip%u.tga", drive_buf, dir_buf, fname_buf, face_index, level_index);
-
- printf("Writing file: %s\n", dst_filename);
- if (!stbi_write_tga(dst_filename, width, height, 4, pImages[level_index + face_index * tex_desc.m_levels]))
- {
- crn_free_all_images(pImages, tex_desc);
- free(pSrc_file_data);
-
- return error("Failed writing output file!\n");
- }
- }
- }
-
- crn_free_all_images(pImages, tex_desc);
- }
- else
- {
- free(pSrc_file_data);
- return error("Decompression mode only supports .dds or .crn files!\n");
- }
-
- free(pSrc_file_data);
-
- return EXIT_SUCCESS;
-}
diff --git a/Libraries/crunch-ea9b8d/example1/stb_image.h b/Libraries/crunch-ea9b8d/example1/stb_image.h
deleted file mode 100644
index 6da2b729..00000000
--- a/Libraries/crunch-ea9b8d/example1/stb_image.h
+++ /dev/null
@@ -1,3942 +0,0 @@
-/* stbi-1.18 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c
- when you control the images you're loading
-
- QUICK NOTES:
- Primarily of interest to game developers and other people who can
- avoid problematic images and only need the trivial interface
-
- JPEG baseline (no JPEG progressive, no oddball channel decimations)
- PNG 8-bit only
- BMP non-1bpp, non-RLE
- TGA (not sure what subset, if a subset)
- PSD (composited view only, no extra channels)
- HDR (radiance rgbE format)
- writes BMP,TGA (define STBI_NO_WRITE to remove code)
- decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code)
- supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD)
-
- TODO:
- stbi_info_*
-
- history:
- 1.18 fix a threading bug (local mutable static)
- 1.17 support interlaced PNG
- 1.16 major bugfix - convert_format converted one too many pixels
- 1.15 initialize some fields for thread safety
- 1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including)
- 1.13 threadsafe
- 1.12 const qualifiers in the API
- 1.11 Support installable IDCT, colorspace conversion routines
- 1.10 Fixes for 64-bit (don't use "unsigned long")
- optimized upsampling by Fabian "ryg" Giesen
- 1.09 Fix format-conversion for PSD code (bad global variables!)
- 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz
- 1.07 attempt to fix C++ warning/errors again
- 1.06 attempt to fix C++ warning/errors again
- 1.05 fix TGA loading to return correct *comp and use good luminance calc
- 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free
- 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR
- 1.02 support for (subset of) HDR files, float interface for preferred access to them
- 1.01 fix bug: possible bug in handling right-side up bmps... not sure
- fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all
- 1.00 interface to zlib that skips zlib header
- 0.99 correct handling of alpha in palette
- 0.98 TGA loader by lonesock; dynamically add loaders (untested)
- 0.97 jpeg errors on too large a file; also catch another stb_malloc failure
- 0.96 fix detection of invalid v value - particleman@mollyrocket forum
- 0.95 during header scan, seek to markers in case of padding
- 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same
- 0.93 handle jpegtran output; verbose errors
- 0.92 read 4,8,16,24,32-bit BMP files of several formats
- 0.91 output 24-bit Windows 3.0 BMP files
- 0.90 fix a few more warnings; bump version number to approach 1.0
- 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd
- 0.60 fix compiling as c++
- 0.59 fix warnings: merge Dave Moore's -Wall fixes
- 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian
- 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less
- than 16 available
- 0.56 fix bug: zlib uncompressed mode len vs. nlen
- 0.55 fix bug: restart_interval not initialized to 0
- 0.54 allow NULL for 'int *comp'
- 0.53 fix bug in png 3->4; speedup png decoding
- 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments
- 0.51 obey req_comp requests, 1-component jpegs return as 1-component,
- on 'test' only check type, not whether we support this variant
-*/
-
-#pragma warning (disable: 4793) // function compiled as native
-
-#ifndef STBI_INCLUDE_STB_IMAGE_H
-#define STBI_INCLUDE_STB_IMAGE_H
-
-//// begin header file ////////////////////////////////////////////////////
-//
-// Limitations:
-// - no progressive/interlaced support (jpeg, png)
-// - 8-bit samples only (jpeg, png)
-// - not threadsafe
-// - channel subsampling of at most 2 in each dimension (jpeg)
-// - no delayed line count (jpeg) -- IJG doesn't support either
-//
-// Basic usage (see HDR discussion below):
-// int x,y,n;
-// unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
-// // ... process data if not NULL ...
-// // ... x = width, y = height, n = # 8-bit components per pixel ...
-// // ... replace '0' with '1'..'4' to force that many components per pixel
-// stbi_image_free(data)
-//
-// Standard parameters:
-// int *x -- outputs image width in pixels
-// int *y -- outputs image height in pixels
-// int *comp -- outputs # of image components in image file
-// int req_comp -- if non-zero, # of image components requested in result
-//
-// The return value from an image loader is an 'unsigned char *' which points
-// to the pixel data. The pixel data consists of *y scanlines of *x pixels,
-// with each pixel consisting of N interleaved 8-bit components; the first
-// pixel pointed to is top-left-most in the image. There is no padding between
-// image scanlines or between pixels, regardless of format. The number of
-// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise.
-// If req_comp is non-zero, *comp has the number of components that _would_
-// have been output otherwise. E.g. if you set req_comp to 4, you will always
-// get RGBA output, but you can check *comp to easily see if it's opaque.
-//
-// An output image with N components has the following components interleaved
-// in this order in each pixel:
-//
-// N=#comp components
-// 1 grey
-// 2 grey, alpha
-// 3 red, green, blue
-// 4 red, green, blue, alpha
-//
-// If image loading fails for any reason, the return value will be NULL,
-// and *x, *y, *comp will be unchanged. The function stbi_failure_reason()
-// can be queried for an extremely brief, end-user unfriendly explanation
-// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid
-// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly
-// more user-friendly ones.
-//
-// Paletted PNG and BMP images are automatically depalettized.
-//
-//
-// ===========================================================================
-//
-// HDR image support (disable by defining STBI_NO_HDR)
-//
-// stb_image now supports loading HDR images in general, and currently
-// the Radiance .HDR file format, although the support is provided
-// generically. You can still load any file through the existing interface;
-// if you attempt to load an HDR file, it will be automatically remapped to
-// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;
-// both of these constants can be reconfigured through this interface:
-//
-// stbi_hdr_to_ldr_gamma(2.2f);
-// stbi_hdr_to_ldr_scale(1.0f);
-//
-// (note, do not use _inverse_ constants; stbi_image will invert them
-// appropriately).
-//
-// Additionally, there is a new, parallel interface for loading files as
-// (linear) floats to preserve the full dynamic range:
-//
-// float *data = stbi_loadf(filename, &x, &y, &n, 0);
-//
-// If you load LDR images through this interface, those images will
-// be promoted to floating point values, run through the inverse of
-// constants corresponding to the above:
-//
-// stbi_ldr_to_hdr_scale(1.0f);
-// stbi_ldr_to_hdr_gamma(2.2f);
-//
-// Finally, given a filename (or an open file or memory block--see header
-// file for details) containing image data, you can query for the "most
-// appropriate" interface to use (that is, whether the image is HDR or
-// not), using:
-//
-// stbi_is_hdr(char *filename);
-
-//#define _CRT_SECURE_NO_WARNINGS
-
-#ifndef STBI_NO_STDIO
-#include <stdio.h>
-#endif
-
-#define STBI_VERSION 1
-
-enum
-{
- STBI_default = 0, // only used for req_comp
-
- STBI_grey = 1,
- STBI_grey_alpha = 2,
- STBI_rgb = 3,
- STBI_rgb_alpha = 4,
-};
-
-typedef unsigned char stbi_uc;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// WRITING API
-
-#if !defined(STBI_NO_WRITE) && !defined(STBI_NO_STDIO)
-// write a BMP/TGA file given tightly packed 'comp' channels (no padding, nor bmp-stride-padding)
-// (you must include the appropriate extension in the filename).
-// returns TRUE on success, FALSE if couldn't open file, error writing file
-extern int stbi_write_bmp (char const *filename, int x, int y, int comp, const void *data);
-extern int stbi_write_bmp_w (wchar_t const *filename, int x, int y, int comp, const void *data);
-extern int stbi_write_tga (char const *filename, int x, int y, int comp, const void *data);
-extern int stbi_write_tga_w (wchar_t const *filename, int x, int y, int comp, const void *data);
-#endif
-
-// PRIMARY API - works on images of any type
-
-// load image by filename, open file, or memory buffer
-#ifndef STBI_NO_STDIO
-extern stbi_uc *stbi_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_load_w (wchar_t const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-extern stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-// for stbi_load_from_file, file pointer is left pointing immediately after image
-
-#ifndef STBI_NO_HDR
-#ifndef STBI_NO_STDIO
-extern float *stbi_loadf (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-extern float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-
-extern void stbi_hdr_to_ldr_gamma(float gamma);
-extern void stbi_hdr_to_ldr_scale(float scale);
-
-extern void stbi_ldr_to_hdr_gamma(float gamma);
-extern void stbi_ldr_to_hdr_scale(float scale);
-
-#endif // STBI_NO_HDR
-
-// get a VERY brief reason for failure
-// NOT THREADSAFE
-extern char *stbi_failure_reason (void);
-
-// free the loaded image -- this is just stb_free()
-extern void stbi_image_free (void *retval_from_stbi_load);
-
-// get image dimensions & components without fully decoding
-extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-extern int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);
-#ifndef STBI_NO_STDIO
-extern int stbi_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_is_hdr (char const *filename);
-extern int stbi_is_hdr_from_file(FILE *f);
-#endif
-
-// ZLIB client - used by PNG, available for other purposes
-
-extern char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen);
-extern char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);
-extern int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
-
-extern char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);
-extern int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
-
-// TYPE-SPECIFIC ACCESS
-
-// is it a jpeg?
-extern int stbi_jpeg_test_memory (stbi_uc const *buffer, int len);
-extern stbi_uc *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-extern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-#ifndef STBI_NO_STDIO
-extern stbi_uc *stbi_jpeg_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern int stbi_jpeg_test_file (FILE *f);
-extern stbi_uc *stbi_jpeg_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-
-extern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-
-// is it a png?
-extern int stbi_png_test_memory (stbi_uc const *buffer, int len);
-extern stbi_uc *stbi_png_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-extern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-#ifndef STBI_NO_STDIO
-extern stbi_uc *stbi_png_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern int stbi_png_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_png_test_file (FILE *f);
-extern stbi_uc *stbi_png_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-
-// is it a bmp?
-extern int stbi_bmp_test_memory (stbi_uc const *buffer, int len);
-
-extern stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-#ifndef STBI_NO_STDIO
-extern int stbi_bmp_test_file (FILE *f);
-extern stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-
-// is it a tga?
-extern int stbi_tga_test_memory (stbi_uc const *buffer, int len);
-
-extern stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-#ifndef STBI_NO_STDIO
-extern int stbi_tga_test_file (FILE *f);
-extern stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-
-// is it a psd?
-extern int stbi_psd_test_memory (stbi_uc const *buffer, int len);
-
-extern stbi_uc *stbi_psd_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-#ifndef STBI_NO_STDIO
-extern int stbi_psd_test_file (FILE *f);
-extern stbi_uc *stbi_psd_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-
-// is it an hdr?
-extern int stbi_hdr_test_memory (stbi_uc const *buffer, int len);
-
-extern float * stbi_hdr_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-#ifndef STBI_NO_STDIO
-extern int stbi_hdr_test_file (FILE *f);
-extern float * stbi_hdr_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-
-// define new loaders
-typedef struct
-{
- int (*test_memory)(stbi_uc const *buffer, int len);
- stbi_uc * (*load_from_memory)(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
- #ifndef STBI_NO_STDIO
- int (*test_file)(FILE *f);
- stbi_uc * (*load_from_file)(FILE *f, int *x, int *y, int *comp, int req_comp);
- #endif
-} stbi_loader;
-
-// register a loader by filling out the above structure (you must defined ALL functions)
-// returns 1 if added or already added, 0 if not added (too many loaders)
-// NOT THREADSAFE
-extern int stbi_register_loader(stbi_loader *loader);
-
-// define faster low-level operations (typically SIMD support)
-#if STBI_SIMD
-typedef void (*stbi_idct_8x8)(uint8 *out, int out_stride, short data[64], unsigned short *dequantize);
-// compute an integer IDCT on "input"
-// input[x] = data[x] * dequantize[x]
-// write results to 'out': 64 samples, each run of 8 spaced by 'out_stride'
-// CLAMP results to 0..255
-typedef void (*stbi_YCbCr_to_RGB_run)(uint8 *output, uint8 const *y, uint8 const *cb, uint8 const *cr, int count, int step);
-// compute a conversion from YCbCr to RGB
-// 'count' pixels
-// write pixels to 'output'; each pixel is 'step' bytes (either 3 or 4; if 4, write '255' as 4th), order R,G,B
-// y: Y input channel
-// cb: Cb input channel; scale/biased to be 0..255
-// cr: Cr input channel; scale/biased to be 0..255
-
-extern void stbi_install_idct(stbi_idct_8x8 func);
-extern void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func);
-#endif // STBI_SIMD
-
-#ifdef __cplusplus
-}
-#endif
-
-//
-//
-//// end header file /////////////////////////////////////////////////////
-#endif // STBI_INCLUDE_STB_IMAGE_H
-
-#ifndef STBI_HEADER_FILE_ONLY
-
-inline void* stb_malloc(size_t c) { return ::malloc(c); }
-inline void* stb_realloc(void *p, size_t c) { return ::realloc(p, c); }
-inline void stb_free(void *p) { ::free(p); }
-
-#ifndef STBI_NO_HDR
-#include <math.h> // ldexp
-#include <string.h> // strcmp
-#endif
-
-#ifndef STBI_NO_STDIO
-#include <stdio.h>
-#endif
-#include <stdlib.h>
-#include <memory.h>
-#include <assert.h>
-#include <stdarg.h>
-
-#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__MINGW64__)
- #ifdef __cplusplus
- #define __forceinline inline
- #else
- #define __forceinline
- #endif
-#endif
-
-
-// implementation:
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef signed short int16;
-typedef unsigned int uint32;
-typedef signed int int32;
-typedef unsigned int uint;
-
-// should produce compiler error if size is wrong
-typedef unsigned char validate_uint32[sizeof(uint32)==4];
-
-#if defined(STBI_NO_STDIO) && !defined(STBI_NO_WRITE)
-#define STBI_NO_WRITE
-#endif
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// Generic API that works on all image types
-//
-
-// this is not threadsafe
-static char *failure_reason;
-
-char *stbi_failure_reason(void)
-{
- return failure_reason;
-}
-
-static int e(char *str)
-{
- failure_reason = str;
- return 0;
-}
-
-#ifdef STBI_NO_FAILURE_STRINGS
- #define e(x,y) 0
-#elif defined(STBI_FAILURE_USERMSG)
- #define e(x,y) e(y)
-#else
- #define e(x,y) e(x)
-#endif
-
-#define epf(x,y) ((float *) (e(x,y)?NULL:NULL))
-#define epuc(x,y) ((unsigned char *) (e(x,y)?NULL:NULL))
-
-void stbi_image_free(void *retval_from_stbi_load)
-{
- stb_free(retval_from_stbi_load);
-}
-
-#define MAX_LOADERS 32
-stbi_loader *loaders[MAX_LOADERS];
-static int max_loaders = 0;
-
-int stbi_register_loader(stbi_loader *loader)
-{
- int i;
- for (i=0; i < MAX_LOADERS; ++i) {
- // already present?
- if (loaders[i] == loader)
- return 1;
- // end of the list?
- if (loaders[i] == NULL) {
- loaders[i] = loader;
- max_loaders = i+1;
- return 1;
- }
- }
- // no room for it
- return 0;
-}
-
-#ifndef STBI_NO_HDR
-static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp);
-static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp);
-#endif
-
-#ifndef STBI_NO_STDIO
-unsigned char *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- FILE *f = fopen(filename, "rb");
- unsigned char *result;
- if (!f) return epuc("can't fopen", "Unable to open file");
- result = stbi_load_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return result;
-}
-
-unsigned char *stbi_load_w(wchar_t const *filename, int *x, int *y, int *comp, int req_comp)
-{
- FILE *f = _wfopen(filename, L"rb");
- unsigned char *result;
- if (!f) return epuc("can't fopen", "Unable to open file");
- result = stbi_load_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return result;
-}
-
-unsigned char *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- int i;
- if (stbi_jpeg_test_file(f))
- return stbi_jpeg_load_from_file(f,x,y,comp,req_comp);
- if (stbi_png_test_file(f))
- return stbi_png_load_from_file(f,x,y,comp,req_comp);
- if (stbi_bmp_test_file(f))
- return stbi_bmp_load_from_file(f,x,y,comp,req_comp);
- if (stbi_psd_test_file(f))
- return stbi_psd_load_from_file(f,x,y,comp,req_comp);
- #ifndef STBI_NO_HDR
- if (stbi_hdr_test_file(f)) {
- float *hdr = stbi_hdr_load_from_file(f, x,y,comp,req_comp);
- return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);
- }
- #endif
- for (i=0; i < max_loaders; ++i)
- if (loaders[i]->test_file(f))
- return loaders[i]->load_from_file(f,x,y,comp,req_comp);
- // test tga last because it's a crappy test!
- if (stbi_tga_test_file(f))
- return stbi_tga_load_from_file(f,x,y,comp,req_comp);
- return epuc("unknown image type", "Image not of any known type, or corrupt");
-}
-#endif
-
-unsigned char *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- int i;
- if (stbi_jpeg_test_memory(buffer,len))
- return stbi_jpeg_load_from_memory(buffer,len,x,y,comp,req_comp);
- if (stbi_png_test_memory(buffer,len))
- return stbi_png_load_from_memory(buffer,len,x,y,comp,req_comp);
- if (stbi_bmp_test_memory(buffer,len))
- return stbi_bmp_load_from_memory(buffer,len,x,y,comp,req_comp);
- if (stbi_psd_test_memory(buffer,len))
- return stbi_psd_load_from_memory(buffer,len,x,y,comp,req_comp);
- #ifndef STBI_NO_HDR
- if (stbi_hdr_test_memory(buffer, len)) {
- float *hdr = stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp);
- return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);
- }
- #endif
- for (i=0; i < max_loaders; ++i)
- if (loaders[i]->test_memory(buffer,len))
- return loaders[i]->load_from_memory(buffer,len,x,y,comp,req_comp);
- // test tga last because it's a crappy test!
- if (stbi_tga_test_memory(buffer,len))
- return stbi_tga_load_from_memory(buffer,len,x,y,comp,req_comp);
- return epuc("unknown image type", "Image not of any known type, or corrupt");
-}
-
-#ifndef STBI_NO_HDR
-
-#ifndef STBI_NO_STDIO
-float *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- FILE *f = fopen(filename, "rb");
- float *result;
- if (!f) return epf("can't fopen", "Unable to open file");
- result = stbi_loadf_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return result;
-}
-
-float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- unsigned char *data;
- #ifndef STBI_NO_HDR
- if (stbi_hdr_test_file(f))
- return stbi_hdr_load_from_file(f,x,y,comp,req_comp);
- #endif
- data = stbi_load_from_file(f, x, y, comp, req_comp);
- if (data)
- return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);
- return epf("unknown image type", "Image not of any known type, or corrupt");
-}
-#endif
-
-float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi_uc *data;
- #ifndef STBI_NO_HDR
- if (stbi_hdr_test_memory(buffer, len))
- return stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp);
- #endif
- data = stbi_load_from_memory(buffer, len, x, y, comp, req_comp);
- if (data)
- return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);
- return epf("unknown image type", "Image not of any known type, or corrupt");
-}
-#endif
-
-// these is-hdr-or-not is defined independent of whether STBI_NO_HDR is
-// defined, for API simplicity; if STBI_NO_HDR is defined, it always
-// reports false!
-
-int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)
-{
- #ifndef STBI_NO_HDR
- return stbi_hdr_test_memory(buffer, len);
- #else
- return 0;
- #endif
-}
-
-#ifndef STBI_NO_STDIO
-extern int stbi_is_hdr (char const *filename)
-{
- FILE *f = fopen(filename, "rb");
- int result=0;
- if (f) {
- result = stbi_is_hdr_from_file(f);
- fclose(f);
- }
- return result;
-}
-
-extern int stbi_is_hdr_from_file(FILE *f)
-{
- #ifndef STBI_NO_HDR
- return stbi_hdr_test_file(f);
- #else
- return 0;
- #endif
-}
-
-#endif
-
-// @TODO: get image dimensions & components without fully decoding
-#ifndef STBI_NO_STDIO
-extern int stbi_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-#ifndef STBI_NO_HDR
-static float h2l_gamma_i=1.0f/2.2f, h2l_scale_i=1.0f;
-static float l2h_gamma=2.2f, l2h_scale=1.0f;
-
-void stbi_hdr_to_ldr_gamma(float gamma) { h2l_gamma_i = 1/gamma; }
-void stbi_hdr_to_ldr_scale(float scale) { h2l_scale_i = 1/scale; }
-
-void stbi_ldr_to_hdr_gamma(float gamma) { l2h_gamma = gamma; }
-void stbi_ldr_to_hdr_scale(float scale) { l2h_scale = scale; }
-#endif
-
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// Common code used by all image loaders
-//
-
-enum
-{
- SCAN_load=0,
- SCAN_type,
- SCAN_header,
-};
-
-typedef struct
-{
- uint32 img_x, img_y;
- int img_n, img_out_n;
-
- #ifndef STBI_NO_STDIO
- FILE *img_file;
- #endif
- uint8 *img_buffer, *img_buffer_end;
-} stbi;
-
-#ifndef STBI_NO_STDIO
-static void start_file(stbi *s, FILE *f)
-{
- s->img_file = f;
-}
-#endif
-
-static void start_mem(stbi *s, uint8 const *buffer, int len)
-{
-#ifndef STBI_NO_STDIO
- s->img_file = NULL;
-#endif
- s->img_buffer = (uint8 *) buffer;
- s->img_buffer_end = (uint8 *) buffer+len;
-}
-
-__forceinline static int get8(stbi *s)
-{
-#ifndef STBI_NO_STDIO
- if (s->img_file) {
- int c = fgetc(s->img_file);
- return c == EOF ? 0 : c;
- }
-#endif
- if (s->img_buffer < s->img_buffer_end)
- return *s->img_buffer++;
- return 0;
-}
-
-__forceinline static int at_eof(stbi *s)
-{
-#ifndef STBI_NO_STDIO
- if (s->img_file)
- return feof(s->img_file);
-#endif
- return s->img_buffer >= s->img_buffer_end;
-}
-
-__forceinline static uint8 get8u(stbi *s)
-{
- return (uint8) get8(s);
-}
-
-static void skip(stbi *s, int n)
-{
-#ifndef STBI_NO_STDIO
- if (s->img_file)
- fseek(s->img_file, n, SEEK_CUR);
- else
-#endif
- s->img_buffer += n;
-}
-
-static int get16(stbi *s)
-{
- int z = get8(s);
- return (z << 8) + get8(s);
-}
-
-static uint32 get32(stbi *s)
-{
- uint32 z = get16(s);
- return (z << 16) + get16(s);
-}
-
-static int get16le(stbi *s)
-{
- int z = get8(s);
- return z + (get8(s) << 8);
-}
-
-static uint32 get32le(stbi *s)
-{
- uint32 z = get16le(s);
- return z + (get16le(s) << 16);
-}
-
-static void getn(stbi *s, stbi_uc *buffer, int n)
-{
-#ifndef STBI_NO_STDIO
- if (s->img_file) {
- fread(buffer, 1, n, s->img_file);
- return;
- }
-#endif
- memcpy(buffer, s->img_buffer, n);
- s->img_buffer += n;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// generic converter from built-in img_n to req_comp
-// individual types do this automatically as much as possible (e.g. jpeg
-// does all cases internally since it needs to colorspace convert anyway,
-// and it never has alpha, so very few cases ). png can automatically
-// interleave an alpha=255 channel, but falls back to this for other cases
-//
-// assume data buffer is malloced, so stb_malloc a new one and free that one
-// only failure mode is stb_malloc failing
-
-static uint8 compute_y(int r, int g, int b)
-{
- return (uint8) (((r*77) + (g*150) + (29*b)) >> 8);
-}
-
-static unsigned char *convert_format(unsigned char *data, int img_n, int req_comp, uint x, uint y)
-{
- int i,j;
- unsigned char *good;
-
- if (req_comp == img_n) return data;
- assert(req_comp >= 1 && req_comp <= 4);
-
- good = (unsigned char *) stb_malloc(req_comp * x * y);
- if (good == NULL) {
- stb_free(data);
- return epuc("outofmem", "Out of memory");
- }
-
- for (j=0; j < (int) y; ++j) {
- unsigned char *src = data + j * x * img_n ;
- unsigned char *dest = good + j * x * req_comp;
-
- #define COMBO(a,b) ((a)*8+(b))
- #define CASE(a,b) case COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)
- // convert source image with img_n components to one with req_comp components;
- // avoid switch per pixel, so use switch per scanline and massive macros
- switch(COMBO(img_n, req_comp)) {
- CASE(1,2) dest[0]=src[0], dest[1]=255; break;
- CASE(1,3) dest[0]=dest[1]=dest[2]=src[0]; break;
- CASE(1,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; break;
- CASE(2,1) dest[0]=src[0]; break;
- CASE(2,3) dest[0]=dest[1]=dest[2]=src[0]; break;
- CASE(2,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; break;
- CASE(3,4) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; break;
- CASE(3,1) dest[0]=compute_y(src[0],src[1],src[2]); break;
- CASE(3,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = 255; break;
- CASE(4,1) dest[0]=compute_y(src[0],src[1],src[2]); break;
- CASE(4,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = src[3]; break;
- CASE(4,3) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; break;
- default: assert(0);
- }
- #undef CASE
- }
-
- stb_free(data);
- return good;
-}
-
-#ifndef STBI_NO_HDR
-static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp)
-{
- int i,k,n;
- float *output = (float *) stb_malloc(x * y * comp * sizeof(float));
- if (output == NULL) { stb_free(data); return epf("outofmem", "Out of memory"); }
- // compute number of non-alpha components
- if (comp & 1) n = comp; else n = comp-1;
- for (i=0; i < x*y; ++i) {
- for (k=0; k < n; ++k) {
- output[i*comp + k] = (float) pow(data[i*comp+k]/255.0f, l2h_gamma) * l2h_scale;
- }
- if (k < comp) output[i*comp + k] = data[i*comp+k]/255.0f;
- }
- stb_free(data);
- return output;
-}
-
-#define float2int(x) ((int) (x))
-static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp)
-{
- int i,k,n;
- stbi_uc *output = (stbi_uc *) stb_malloc(x * y * comp);
- if (output == NULL) { stb_free(data); return epuc("outofmem", "Out of memory"); }
- // compute number of non-alpha components
- if (comp & 1) n = comp; else n = comp-1;
- for (i=0; i < x*y; ++i) {
- for (k=0; k < n; ++k) {
- float z = (float) pow(data[i*comp+k]*h2l_scale_i, h2l_gamma_i) * 255 + 0.5f;
- if (z < 0) z = 0;
- if (z > 255) z = 255;
- output[i*comp + k] = float2int(z);
- }
- if (k < comp) {
- float z = data[i*comp+k] * 255 + 0.5f;
- if (z < 0) z = 0;
- if (z > 255) z = 255;
- output[i*comp + k] = float2int(z);
- }
- }
- stb_free(data);
- return output;
-}
-#endif
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// "baseline" JPEG/JFIF decoder (not actually fully baseline implementation)
-//
-// simple implementation
-// - channel subsampling of at most 2 in each dimension
-// - doesn't support delayed output of y-dimension
-// - simple interface (only one output format: 8-bit interleaved RGB)
-// - doesn't try to recover corrupt jpegs
-// - doesn't allow partial loading, loading multiple at once
-// - still fast on x86 (copying globals into locals doesn't help x86)
-// - allocates lots of intermediate memory (full size of all components)
-// - non-interleaved case requires this anyway
-// - allows good upsampling (see next)
-// high-quality
-// - upsampled channels are bilinearly interpolated, even across blocks
-// - quality integer IDCT derived from IJG's 'slow'
-// performance
-// - fast huffman; reasonable integer IDCT
-// - uses a lot of intermediate memory, could cache poorly
-// - load http://nothings.org/remote/anemones.jpg 3 times on 2.8Ghz P4
-// stb_jpeg: 1.34 seconds (MSVC6, default release build)
-// stb_jpeg: 1.06 seconds (MSVC6, processor = Pentium Pro)
-// IJL11.dll: 1.08 seconds (compiled by intel)
-// IJG 1998: 0.98 seconds (MSVC6, makefile provided by IJG)
-// IJG 1998: 0.95 seconds (MSVC6, makefile + proc=PPro)
-
-// huffman decoding acceleration
-#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache
-
-typedef struct
-{
- uint8 fast[1 << FAST_BITS];
- // weirdly, repacking this into AoS is a 10% speed loss, instead of a win
- uint16 code[256];
- uint8 values[256];
- uint8 size[257];
- unsigned int maxcode[18];
- int delta[17]; // old 'firstsymbol' - old 'firstcode'
-} huffman;
-
-typedef struct
-{
- #if STBI_SIMD
- unsigned short dequant2[4][64];
- #endif
- stbi s;
- huffman huff_dc[4];
- huffman huff_ac[4];
- uint8 dequant[4][64];
-
-// sizes for components, interleaved MCUs
- int img_h_max, img_v_max;
- int img_mcu_x, img_mcu_y;
- int img_mcu_w, img_mcu_h;
-
-// definition of jpeg image component
- struct
- {
- int id;
- int h,v;
- int tq;
- int hd,ha;
- int dc_pred;
-
- int x,y,w2,h2;
- uint8 *data;
- void *raw_data;
- uint8 *linebuf;
- } img_comp[4];
-
- uint32 code_buffer; // jpeg entropy-coded buffer
- int code_bits; // number of valid bits
- unsigned char marker; // marker seen while filling entropy buffer
- int nomore; // flag if we saw a marker so must stop
-
- int scan_n, order[4];
- int restart_interval, todo;
-} jpeg;
-
-static int build_huffman(huffman *h, int *count)
-{
- int i,j,k=0,code;
- // build size list for each symbol (from JPEG spec)
- for (i=0; i < 16; ++i)
- for (j=0; j < count[i]; ++j)
- h->size[k++] = (uint8) (i+1);
- h->size[k] = 0;
-
- // compute actual symbols (from jpeg spec)
- code = 0;
- k = 0;
- for(j=1; j <= 16; ++j) {
- // compute delta to add to code to compute symbol id
- h->delta[j] = k - code;
- if (h->size[k] == j) {
- while (h->size[k] == j)
- h->code[k++] = (uint16) (code++);
- if (code-1 >= (1 << j)) return e("bad code lengths","Corrupt JPEG");
- }
- // compute largest code + 1 for this size, preshifted as needed later
- h->maxcode[j] = code << (16-j);
- code <<= 1;
- }
- h->maxcode[j] = 0xffffffff;
-
- // build non-spec acceleration table; 255 is flag for not-accelerated
- memset(h->fast, 255, 1 << FAST_BITS);
- for (i=0; i < k; ++i) {
- int s = h->size[i];
- if (s <= FAST_BITS) {
- int c = h->code[i] << (FAST_BITS-s);
- int m = 1 << (FAST_BITS-s);
- for (j=0; j < m; ++j) {
- h->fast[c+j] = (uint8) i;
- }
- }
- }
- return 1;
-}
-
-static void grow_buffer_unsafe(jpeg *j)
-{
- do {
- int b = j->nomore ? 0 : get8(&j->s);
- if (b == 0xff) {
- int c = get8(&j->s);
- if (c != 0) {
- j->marker = (unsigned char) c;
- j->nomore = 1;
- return;
- }
- }
- j->code_buffer = (j->code_buffer << 8) | b;
- j->code_bits += 8;
- } while (j->code_bits <= 24);
-}
-
-// (1 << n) - 1
-static uint32 bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535};
-
-// decode a jpeg huffman value from the bitstream
-__forceinline static int decode(jpeg *j, huffman *h)
-{
- unsigned int temp;
- int c,k;
-
- if (j->code_bits < 16) grow_buffer_unsafe(j);
-
- // look at the top FAST_BITS and determine what symbol ID it is,
- // if the code is <= FAST_BITS
- c = (j->code_buffer >> (j->code_bits - FAST_BITS)) & ((1 << FAST_BITS)-1);
- k = h->fast[c];
- if (k < 255) {
- if (h->size[k] > j->code_bits)
- return -1;
- j->code_bits -= h->size[k];
- return h->values[k];
- }
-
- // naive test is to shift the code_buffer down so k bits are
- // valid, then test against maxcode. To speed this up, we've
- // preshifted maxcode left so that it has (16-k) 0s at the
- // end; in other words, regardless of the number of bits, it
- // wants to be compared against something shifted to have 16;
- // that way we don't need to shift inside the loop.
- if (j->code_bits < 16)
- temp = (j->code_buffer << (16 - j->code_bits)) & 0xffff;
- else
- temp = (j->code_buffer >> (j->code_bits - 16)) & 0xffff;
- for (k=FAST_BITS+1 ; ; ++k)
- if (temp < h->maxcode[k])
- break;
- if (k == 17) {
- // error! code not found
- j->code_bits -= 16;
- return -1;
- }
-
- if (k > j->code_bits)
- return -1;
-
- // convert the huffman code to the symbol id
- c = ((j->code_buffer >> (j->code_bits - k)) & bmask[k]) + h->delta[k];
- assert((((j->code_buffer) >> (j->code_bits - h->size[c])) & bmask[h->size[c]]) == h->code[c]);
-
- // convert the id to a symbol
- j->code_bits -= k;
- return h->values[c];
-}
-
-// combined JPEG 'receive' and JPEG 'extend', since baseline
-// always extends everything it receives.
-__forceinline static int extend_receive(jpeg *j, int n)
-{
- unsigned int m = 1 << (n-1);
- unsigned int k;
- if (j->code_bits < n) grow_buffer_unsafe(j);
- k = (j->code_buffer >> (j->code_bits - n)) & bmask[n];
- j->code_bits -= n;
- // the following test is probably a random branch that won't
- // predict well. I tried to table accelerate it but failed.
- // maybe it's compiling as a conditional move?
- if (k < m)
- return (-1 << n) + k + 1;
- else
- return k;
-}
-
-// given a value that's at position X in the zigzag stream,
-// where does it appear in the 8x8 matrix coded as row-major?
-static uint8 dezigzag[64+15] =
-{
- 0, 1, 8, 16, 9, 2, 3, 10,
- 17, 24, 32, 25, 18, 11, 4, 5,
- 12, 19, 26, 33, 40, 48, 41, 34,
- 27, 20, 13, 6, 7, 14, 21, 28,
- 35, 42, 49, 56, 57, 50, 43, 36,
- 29, 22, 15, 23, 30, 37, 44, 51,
- 58, 59, 52, 45, 38, 31, 39, 46,
- 53, 60, 61, 54, 47, 55, 62, 63,
- // let corrupt input sample past end
- 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63
-};
-
-// decode one 64-entry block--
-static int decode_block(jpeg *j, short data[64], huffman *hdc, huffman *hac, int b)
-{
- int diff,dc,k;
- int t = decode(j, hdc);
- if (t < 0) return e("bad huffman code","Corrupt JPEG");
-
- // 0 all the ac values now so we can do it 32-bits at a time
- memset(data,0,64*sizeof(data[0]));
-
- diff = t ? extend_receive(j, t) : 0;
- dc = j->img_comp[b].dc_pred + diff;
- j->img_comp[b].dc_pred = dc;
- data[0] = (short) dc;
-
- // decode AC components, see JPEG spec
- k = 1;
- do {
- int r,s;
- int rs = decode(j, hac);
- if (rs < 0) return e("bad huffman code","Corrupt JPEG");
- s = rs & 15;
- r = rs >> 4;
- if (s == 0) {
- if (rs != 0xf0) break; // end block
- k += 16;
- } else {
- k += r;
- // decode into unzigzag'd location
- data[dezigzag[k++]] = (short) extend_receive(j,s);
- }
- } while (k < 64);
- return 1;
-}
-
-// take a -128..127 value and clamp it and convert to 0..255
-__forceinline static uint8 clamp(int x)
-{
- x += 128;
- // trick to use a single test to catch both cases
- if ((unsigned int) x > 255) {
- if (x < 0) return 0;
- if (x > 255) return 255;
- }
- return (uint8) x;
-}
-
-#define f2f(x) (int) (((x) * 4096 + 0.5))
-#define fsh(x) ((x) << 12)
-
-// derived from jidctint -- DCT_ISLOW
-#define IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \
- int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \
- p2 = s2; \
- p3 = s6; \
- p1 = (p2+p3) * f2f(0.5411961f); \
- t2 = p1 + p3*f2f(-1.847759065f); \
- t3 = p1 + p2*f2f( 0.765366865f); \
- p2 = s0; \
- p3 = s4; \
- t0 = fsh(p2+p3); \
- t1 = fsh(p2-p3); \
- x0 = t0+t3; \
- x3 = t0-t3; \
- x1 = t1+t2; \
- x2 = t1-t2; \
- t0 = s7; \
- t1 = s5; \
- t2 = s3; \
- t3 = s1; \
- p3 = t0+t2; \
- p4 = t1+t3; \
- p1 = t0+t3; \
- p2 = t1+t2; \
- p5 = (p3+p4)*f2f( 1.175875602f); \
- t0 = t0*f2f( 0.298631336f); \
- t1 = t1*f2f( 2.053119869f); \
- t2 = t2*f2f( 3.072711026f); \
- t3 = t3*f2f( 1.501321110f); \
- p1 = p5 + p1*f2f(-0.899976223f); \
- p2 = p5 + p2*f2f(-2.562915447f); \
- p3 = p3*f2f(-1.961570560f); \
- p4 = p4*f2f(-0.390180644f); \
- t3 += p1+p4; \
- t2 += p2+p3; \
- t1 += p2+p4; \
- t0 += p1+p3;
-
-#if !STBI_SIMD
-// .344 seconds on 3*anemones.jpg
-static void idct_block(uint8 *out, int out_stride, short data[64], uint8 *dequantize)
-{
- int i,val[64],*v=val;
- uint8 *o,*dq = dequantize;
- short *d = data;
-
- // columns
- for (i=0; i < 8; ++i,++d,++dq, ++v) {
- // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing
- if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0
- && d[40]==0 && d[48]==0 && d[56]==0) {
- // no shortcut 0 seconds
- // (1|2|3|4|5|6|7)==0 0 seconds
- // all separate -0.047 seconds
- // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds
- int dcterm = d[0] * dq[0] << 2;
- v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;
- } else {
- IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24],
- d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56])
- // constants scaled things up by 1<<12; let's bring them back
- // down, but keep 2 extra bits of precision
- x0 += 512; x1 += 512; x2 += 512; x3 += 512;
- v[ 0] = (x0+t3) >> 10;
- v[56] = (x0-t3) >> 10;
- v[ 8] = (x1+t2) >> 10;
- v[48] = (x1-t2) >> 10;
- v[16] = (x2+t1) >> 10;
- v[40] = (x2-t1) >> 10;
- v[24] = (x3+t0) >> 10;
- v[32] = (x3-t0) >> 10;
- }
- }
-
- for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) {
- // no fast case since the first 1D IDCT spread components out
- IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7])
- // constants scaled things up by 1<<12, plus we had 1<<2 from first
- // loop, plus horizontal and vertical each scale by sqrt(8) so together
- // we've got an extra 1<<3, so 1<<17 total we need to remove.
- x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536;
- o[0] = clamp((x0+t3) >> 17);
- o[7] = clamp((x0-t3) >> 17);
- o[1] = clamp((x1+t2) >> 17);
- o[6] = clamp((x1-t2) >> 17);
- o[2] = clamp((x2+t1) >> 17);
- o[5] = clamp((x2-t1) >> 17);
- o[3] = clamp((x3+t0) >> 17);
- o[4] = clamp((x3-t0) >> 17);
- }
-}
-#else
-static void idct_block(uint8 *out, int out_stride, short data[64], unsigned short *dequantize)
-{
- int i,val[64],*v=val;
- uint8 *o;
- unsigned short *dq = dequantize;
- short *d = data;
-
- // columns
- for (i=0; i < 8; ++i,++d,++dq, ++v) {
- // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing
- if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0
- && d[40]==0 && d[48]==0 && d[56]==0) {
- // no shortcut 0 seconds
- // (1|2|3|4|5|6|7)==0 0 seconds
- // all separate -0.047 seconds
- // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds
- int dcterm = d[0] * dq[0] << 2;
- v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;
- } else {
- IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24],
- d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56])
- // constants scaled things up by 1<<12; let's bring them back
- // down, but keep 2 extra bits of precision
- x0 += 512; x1 += 512; x2 += 512; x3 += 512;
- v[ 0] = (x0+t3) >> 10;
- v[56] = (x0-t3) >> 10;
- v[ 8] = (x1+t2) >> 10;
- v[48] = (x1-t2) >> 10;
- v[16] = (x2+t1) >> 10;
- v[40] = (x2-t1) >> 10;
- v[24] = (x3+t0) >> 10;
- v[32] = (x3-t0) >> 10;
- }
- }
-
- for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) {
- // no fast case since the first 1D IDCT spread components out
- IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7])
- // constants scaled things up by 1<<12, plus we had 1<<2 from first
- // loop, plus horizontal and vertical each scale by sqrt(8) so together
- // we've got an extra 1<<3, so 1<<17 total we need to remove.
- x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536;
- o[0] = clamp((x0+t3) >> 17);
- o[7] = clamp((x0-t3) >> 17);
- o[1] = clamp((x1+t2) >> 17);
- o[6] = clamp((x1-t2) >> 17);
- o[2] = clamp((x2+t1) >> 17);
- o[5] = clamp((x2-t1) >> 17);
- o[3] = clamp((x3+t0) >> 17);
- o[4] = clamp((x3-t0) >> 17);
- }
-}
-static stbi_idct_8x8 stbi_idct_installed = idct_block;
-
-extern void stbi_install_idct(stbi_idct_8x8 func)
-{
- stbi_idct_installed = func;
-}
-#endif
-
-#define MARKER_none 0xff
-// if there's a pending marker from the entropy stream, return that
-// otherwise, fetch from the stream and get a marker. if there's no
-// marker, return 0xff, which is never a valid marker value
-static uint8 get_marker(jpeg *j)
-{
- uint8 x;
- if (j->marker != MARKER_none) { x = j->marker; j->marker = MARKER_none; return x; }
- x = get8u(&j->s);
- if (x != 0xff) return MARKER_none;
- while (x == 0xff)
- x = get8u(&j->s);
- return x;
-}
-
-// in each scan, we'll have scan_n components, and the order
-// of the components is specified by order[]
-#define RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7)
-
-// after a restart interval, reset the entropy decoder and
-// the dc prediction
-static void reset(jpeg *j)
-{
- j->code_bits = 0;
- j->code_buffer = 0;
- j->nomore = 0;
- j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = 0;
- j->marker = MARKER_none;
- j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff;
- // no more than 1<<31 MCUs if no restart_interal? that's plenty safe,
- // since we don't even allow 1<<30 pixels
-}
-
-static int parse_entropy_coded_data(jpeg *z)
-{
- reset(z);
- if (z->scan_n == 1) {
- int i,j;
- #if STBI_SIMD
- __declspec(align(16))
- #endif
- short data[64];
- int n = z->order[0];
- // non-interleaved data, we just need to process one block at a time,
- // in trivial scanline order
- // number of blocks to do just depends on how many actual "pixels" this
- // component has, independent of interleaved MCU blocking and such
- int w = (z->img_comp[n].x+7) >> 3;
- int h = (z->img_comp[n].y+7) >> 3;
- for (j=0; j < h; ++j) {
- for (i=0; i < w; ++i) {
- if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0;
- #if STBI_SIMD
- stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]);
- #else
- idct_block(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]);
- #endif
- // every data block is an MCU, so countdown the restart interval
- if (--z->todo <= 0) {
- if (z->code_bits < 24) grow_buffer_unsafe(z);
- // if it's NOT a restart, then just bail, so we get corrupt data
- // rather than no data
- if (!RESTART(z->marker)) return 1;
- reset(z);
- }
- }
- }
- } else { // interleaved!
- int i,j,k,x,y;
- short data[64];
- for (j=0; j < z->img_mcu_y; ++j) {
- for (i=0; i < z->img_mcu_x; ++i) {
- // scan an interleaved mcu... process scan_n components in order
- for (k=0; k < z->scan_n; ++k) {
- int n = z->order[k];
- // scan out an mcu's worth of this component; that's just determined
- // by the basic H and V specified for the component
- for (y=0; y < z->img_comp[n].v; ++y) {
- for (x=0; x < z->img_comp[n].h; ++x) {
- int x2 = (i*z->img_comp[n].h + x)*8;
- int y2 = (j*z->img_comp[n].v + y)*8;
- if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0;
- #if STBI_SIMD
- stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]);
- #else
- idct_block(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]);
- #endif
- }
- }
- }
- // after all interleaved components, that's an interleaved MCU,
- // so now count down the restart interval
- if (--z->todo <= 0) {
- if (z->code_bits < 24) grow_buffer_unsafe(z);
- // if it's NOT a restart, then just bail, so we get corrupt data
- // rather than no data
- if (!RESTART(z->marker)) return 1;
- reset(z);
- }
- }
- }
- }
- return 1;
-}
-
-static int process_marker(jpeg *z, int m)
-{
- int L;
- switch (m) {
- case MARKER_none: // no marker found
- return e("expected marker","Corrupt JPEG");
-
- case 0xC2: // SOF - progressive
- return e("progressive jpeg","JPEG format not supported (progressive)");
-
- case 0xDD: // DRI - specify restart interval
- if (get16(&z->s) != 4) return e("bad DRI len","Corrupt JPEG");
- z->restart_interval = get16(&z->s);
- return 1;
-
- case 0xDB: // DQT - define quantization table
- L = get16(&z->s)-2;
- while (L > 0) {
- int q = get8(&z->s);
- int p = q >> 4;
- int t = q & 15,i;
- if (p != 0) return e("bad DQT type","Corrupt JPEG");
- if (t > 3) return e("bad DQT table","Corrupt JPEG");
- for (i=0; i < 64; ++i)
- z->dequant[t][dezigzag[i]] = get8u(&z->s);
- #if STBI_SIMD
- for (i=0; i < 64; ++i)
- z->dequant2[t][i] = z->dequant[t][i];
- #endif
- L -= 65;
- }
- return L==0;
-
- case 0xC4: // DHT - define huffman table
- L = get16(&z->s)-2;
- while (L > 0) {
- uint8 *v;
- int sizes[16],i,m=0;
- int q = get8(&z->s);
- int tc = q >> 4;
- int th = q & 15;
- if (tc > 1 || th > 3) return e("bad DHT header","Corrupt JPEG");
- for (i=0; i < 16; ++i) {
- sizes[i] = get8(&z->s);
- m += sizes[i];
- }
- L -= 17;
- if (tc == 0) {
- if (!build_huffman(z->huff_dc+th, sizes)) return 0;
- v = z->huff_dc[th].values;
- } else {
- if (!build_huffman(z->huff_ac+th, sizes)) return 0;
- v = z->huff_ac[th].values;
- }
- for (i=0; i < m; ++i)
- v[i] = get8u(&z->s);
- L -= m;
- }
- return L==0;
- }
- // check for comment block or APP blocks
- if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) {
- skip(&z->s, get16(&z->s)-2);
- return 1;
- }
- return 0;
-}
-
-// after we see SOS
-static int process_scan_header(jpeg *z)
-{
- int i;
- int Ls = get16(&z->s);
- z->scan_n = get8(&z->s);
- if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s.img_n) return e("bad SOS component count","Corrupt JPEG");
- if (Ls != 6+2*z->scan_n) return e("bad SOS len","Corrupt JPEG");
- for (i=0; i < z->scan_n; ++i) {
- int id = get8(&z->s), which;
- int q = get8(&z->s);
- for (which = 0; which < z->s.img_n; ++which)
- if (z->img_comp[which].id == id)
- break;
- if (which == z->s.img_n) return 0;
- z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return e("bad DC huff","Corrupt JPEG");
- z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return e("bad AC huff","Corrupt JPEG");
- z->order[i] = which;
- }
- if (get8(&z->s) != 0) return e("bad SOS","Corrupt JPEG");
- get8(&z->s); // should be 63, but might be 0
- if (get8(&z->s) != 0) return e("bad SOS","Corrupt JPEG");
-
- return 1;
-}
-
-static int process_frame_header(jpeg *z, int scan)
-{
- stbi *s = &z->s;
- int Lf,p,i,q, h_max=1,v_max=1,c;
- Lf = get16(s); if (Lf < 11) return e("bad SOF len","Corrupt JPEG"); // JPEG
- p = get8(s); if (p != 8) return e("only 8-bit","JPEG format not supported: 8-bit only"); // JPEG baseline
- s->img_y = get16(s); if (s->img_y == 0) return e("no header height", "JPEG format not supported: delayed height"); // Legal, but we don't handle it--but neither does IJG
- s->img_x = get16(s); if (s->img_x == 0) return e("0 width","Corrupt JPEG"); // JPEG requires
- c = get8(s);
- if (c != 3 && c != 1) return e("bad component count","Corrupt JPEG"); // JFIF requires
- s->img_n = c;
- for (i=0; i < c; ++i) {
- z->img_comp[i].data = NULL;
- z->img_comp[i].linebuf = NULL;
- }
-
- if (Lf != 8+3*s->img_n) return e("bad SOF len","Corrupt JPEG");
-
- for (i=0; i < s->img_n; ++i) {
- z->img_comp[i].id = get8(s);
- if (z->img_comp[i].id != i+1) // JFIF requires
- if (z->img_comp[i].id != i) // some version of jpegtran outputs non-JFIF-compliant files!
- return e("bad component ID","Corrupt JPEG");
- q = get8(s);
- z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return e("bad H","Corrupt JPEG");
- z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return e("bad V","Corrupt JPEG");
- z->img_comp[i].tq = get8(s); if (z->img_comp[i].tq > 3) return e("bad TQ","Corrupt JPEG");
- }
-
- if (scan != SCAN_load) return 1;
-
- if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e("too large", "Image too large to decode");
-
- for (i=0; i < s->img_n; ++i) {
- if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h;
- if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v;
- }
-
- // compute interleaved mcu info
- z->img_h_max = h_max;
- z->img_v_max = v_max;
- z->img_mcu_w = h_max * 8;
- z->img_mcu_h = v_max * 8;
- z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w;
- z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h;
-
- for (i=0; i < s->img_n; ++i) {
- // number of effective pixels (e.g. for non-interleaved MCU)
- z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max;
- z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max;
- // to simplify generation, we'll allocate enough memory to decode
- // the bogus oversized data from using interleaved MCUs and their
- // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't
- // discard the extra data until colorspace conversion
- z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8;
- z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8;
- z->img_comp[i].raw_data = stb_malloc(z->img_comp[i].w2 * z->img_comp[i].h2+15);
- if (z->img_comp[i].raw_data == NULL) {
- for(--i; i >= 0; --i) {
- stb_free(z->img_comp[i].raw_data);
- z->img_comp[i].data = NULL;
- }
- return e("outofmem", "Out of memory");
- }
- // align blocks for installable-idct using mmx/sse
- z->img_comp[i].data = (uint8*) (((size_t) z->img_comp[i].raw_data + 15) & ~15);
- z->img_comp[i].linebuf = NULL;
- }
-
- return 1;
-}
-
-// use comparisons since in some cases we handle more than one case (e.g. SOF)
-#define DNL(x) ((x) == 0xdc)
-#define SOI(x) ((x) == 0xd8)
-#define EOI(x) ((x) == 0xd9)
-#define SOF(x) ((x) == 0xc0 || (x) == 0xc1)
-#define SOS(x) ((x) == 0xda)
-
-static int decode_jpeg_header(jpeg *z, int scan)
-{
- int m;
- z->marker = MARKER_none; // initialize cached marker to empty
- m = get_marker(z);
- if (!SOI(m)) return e("no SOI","Corrupt JPEG");
- if (scan == SCAN_type) return 1;
- m = get_marker(z);
- while (!SOF(m)) {
- if (!process_marker(z,m)) return 0;
- m = get_marker(z);
- while (m == MARKER_none) {
- // some files have extra padding after their blocks, so ok, we'll scan
- if (at_eof(&z->s)) return e("no SOF", "Corrupt JPEG");
- m = get_marker(z);
- }
- }
- if (!process_frame_header(z, scan)) return 0;
- return 1;
-}
-
-static int decode_jpeg_image(jpeg *j)
-{
- int m;
- j->restart_interval = 0;
- if (!decode_jpeg_header(j, SCAN_load)) return 0;
- m = get_marker(j);
- while (!EOI(m)) {
- if (SOS(m)) {
- if (!process_scan_header(j)) return 0;
- if (!parse_entropy_coded_data(j)) return 0;
- } else {
- if (!process_marker(j, m)) return 0;
- }
- m = get_marker(j);
- }
- return 1;
-}
-
-// static jfif-centered resampling (across block boundaries)
-
-typedef uint8 *(*resample_row_func)(uint8 *out, uint8 *in0, uint8 *in1,
- int w, int hs);
-
-#define div4(x) ((uint8) ((x) >> 2))
-
-static uint8 *resample_row_1(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- return in_near;
-}
-
-static uint8* resample_row_v_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- // need to generate two samples vertically for every one in input
- int i;
- for (i=0; i < w; ++i)
- out[i] = div4(3*in_near[i] + in_far[i] + 2);
- return out;
-}
-
-static uint8* resample_row_h_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- // need to generate two samples horizontally for every one in input
- int i;
- uint8 *input = in_near;
- if (w == 1) {
- // if only one sample, can't do any interpolation
- out[0] = out[1] = input[0];
- return out;
- }
-
- out[0] = input[0];
- out[1] = div4(input[0]*3 + input[1] + 2);
- for (i=1; i < w-1; ++i) {
- int n = 3*input[i]+2;
- out[i*2+0] = div4(n+input[i-1]);
- out[i*2+1] = div4(n+input[i+1]);
- }
- out[i*2+0] = div4(input[w-2]*3 + input[w-1] + 2);
- out[i*2+1] = input[w-1];
- return out;
-}
-
-#define div16(x) ((uint8) ((x) >> 4))
-
-static uint8 *resample_row_hv_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- // need to generate 2x2 samples for every one in input
- int i,t0,t1;
- if (w == 1) {
- out[0] = out[1] = div4(3*in_near[0] + in_far[0] + 2);
- return out;
- }
-
- t1 = 3*in_near[0] + in_far[0];
- out[0] = div4(t1+2);
- for (i=1; i < w; ++i) {
- t0 = t1;
- t1 = 3*in_near[i]+in_far[i];
- out[i*2-1] = div16(3*t0 + t1 + 8);
- out[i*2 ] = div16(3*t1 + t0 + 8);
- }
- out[w*2-1] = div4(t1+2);
- return out;
-}
-
-static uint8 *resample_row_generic(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- // resample with nearest-neighbor
- int i,j;
- for (i=0; i < w; ++i)
- for (j=0; j < hs; ++j)
- out[i*hs+j] = in_near[i];
- return out;
-}
-
-#define float2fixed(x) ((int) ((x) * 65536 + 0.5))
-
-// 0.38 seconds on 3*anemones.jpg (0.25 with processor = Pro)
-// VC6 without processor=Pro is generating multiple LEAs per multiply!
-static void YCbCr_to_RGB_row(uint8 *out, const uint8 *y, const uint8 *pcb, const uint8 *pcr, int count, int step)
-{
- int i;
- for (i=0; i < count; ++i) {
- int y_fixed = (y[i] << 16) + 32768; // rounding
- int r,g,b;
- int cr = pcr[i] - 128;
- int cb = pcb[i] - 128;
- r = y_fixed + cr*float2fixed(1.40200f);
- g = y_fixed - cr*float2fixed(0.71414f) - cb*float2fixed(0.34414f);
- b = y_fixed + cb*float2fixed(1.77200f);
- r >>= 16;
- g >>= 16;
- b >>= 16;
- if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; }
- if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; }
- if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; }
- out[0] = (uint8)r;
- out[1] = (uint8)g;
- out[2] = (uint8)b;
- out[3] = 255;
- out += step;
- }
-}
-
-#if STBI_SIMD
-static stbi_YCbCr_to_RGB_run stbi_YCbCr_installed = YCbCr_to_RGB_row;
-
-void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func)
-{
- stbi_YCbCr_installed = func;
-}
-#endif
-
-
-// clean up the temporary component buffers
-static void cleanup_jpeg(jpeg *j)
-{
- int i;
- for (i=0; i < j->s.img_n; ++i) {
- if (j->img_comp[i].data) {
- stb_free(j->img_comp[i].raw_data);
- j->img_comp[i].data = NULL;
- }
- if (j->img_comp[i].linebuf) {
- stb_free(j->img_comp[i].linebuf);
- j->img_comp[i].linebuf = NULL;
- }
- }
-}
-
-typedef struct
-{
- resample_row_func resample;
- uint8 *line0,*line1;
- int hs,vs; // expansion factor in each axis
- int w_lores; // horizontal pixels pre-expansion
- int ystep; // how far through vertical expansion we are
- int ypos; // which pre-expansion row we're on
-} stbi_resample;
-
-static uint8 *load_jpeg_image(jpeg *z, int *out_x, int *out_y, int *comp, int req_comp)
-{
- int n, decode_n;
- // validate req_comp
- if (req_comp < 0 || req_comp > 4) return epuc("bad req_comp", "Internal error");
- z->s.img_n = 0;
-
- // load a jpeg image from whichever source
- if (!decode_jpeg_image(z)) { cleanup_jpeg(z); return NULL; }
-
- // determine actual number of components to generate
- n = req_comp ? req_comp : z->s.img_n;
-
- if (z->s.img_n == 3 && n < 3)
- decode_n = 1;
- else
- decode_n = z->s.img_n;
-
- // resample and color-convert
- {
- int k;
- uint i,j;
- uint8 *output;
- uint8 *coutput[4];
-
- stbi_resample res_comp[4];
-
- for (k=0; k < decode_n; ++k) {
- stbi_resample *r = &res_comp[k];
-
- // allocate line buffer big enough for upsampling off the edges
- // with upsample factor of 4
- z->img_comp[k].linebuf = (uint8 *) stb_malloc(z->s.img_x + 3);
- if (!z->img_comp[k].linebuf) { cleanup_jpeg(z); return epuc("outofmem", "Out of memory"); }
-
- r->hs = z->img_h_max / z->img_comp[k].h;
- r->vs = z->img_v_max / z->img_comp[k].v;
- r->ystep = r->vs >> 1;
- r->w_lores = (z->s.img_x + r->hs-1) / r->hs;
- r->ypos = 0;
- r->line0 = r->line1 = z->img_comp[k].data;
-
- if (r->hs == 1 && r->vs == 1) r->resample = resample_row_1;
- else if (r->hs == 1 && r->vs == 2) r->resample = resample_row_v_2;
- else if (r->hs == 2 && r->vs == 1) r->resample = resample_row_h_2;
- else if (r->hs == 2 && r->vs == 2) r->resample = resample_row_hv_2;
- else r->resample = resample_row_generic;
- }
-
- // can't error after this so, this is safe
- output = (uint8 *) stb_malloc(n * z->s.img_x * z->s.img_y + 1);
- if (!output) { cleanup_jpeg(z); return epuc("outofmem", "Out of memory"); }
-
- // now go ahead and resample
- for (j=0; j < z->s.img_y; ++j) {
- uint8 *out = output + n * z->s.img_x * j;
- for (k=0; k < decode_n; ++k) {
- stbi_resample *r = &res_comp[k];
- int y_bot = r->ystep >= (r->vs >> 1);
- coutput[k] = r->resample(z->img_comp[k].linebuf,
- y_bot ? r->line1 : r->line0,
- y_bot ? r->line0 : r->line1,
- r->w_lores, r->hs);
- if (++r->ystep >= r->vs) {
- r->ystep = 0;
- r->line0 = r->line1;
- if (++r->ypos < z->img_comp[k].y)
- r->line1 += z->img_comp[k].w2;
- }
- }
- if (n >= 3) {
- uint8 *y = coutput[0];
- if (z->s.img_n == 3) {
- #if STBI_SIMD
- stbi_YCbCr_installed(out, y, coutput[1], coutput[2], z->s.img_x, n);
- #else
- YCbCr_to_RGB_row(out, y, coutput[1], coutput[2], z->s.img_x, n);
- #endif
- } else
- for (i=0; i < z->s.img_x; ++i) {
- out[0] = out[1] = out[2] = y[i];
- out[3] = 255; // not used if n==3
- out += n;
- }
- } else {
- uint8 *y = coutput[0];
- if (n == 1)
- for (i=0; i < z->s.img_x; ++i) out[i] = y[i];
- else
- for (i=0; i < z->s.img_x; ++i) *out++ = y[i], *out++ = 255;
- }
- }
- cleanup_jpeg(z);
- *out_x = z->s.img_x;
- *out_y = z->s.img_y;
- if (comp) *comp = z->s.img_n; // report original components, not output
- return output;
- }
-}
-
-#ifndef STBI_NO_STDIO
-unsigned char *stbi_jpeg_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- jpeg j;
- start_file(&j.s, f);
- return load_jpeg_image(&j, x,y,comp,req_comp);
-}
-
-unsigned char *stbi_jpeg_load(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- unsigned char *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_jpeg_load_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-#endif
-
-unsigned char *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- jpeg j;
- start_mem(&j.s, buffer,len);
- return load_jpeg_image(&j, x,y,comp,req_comp);
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_jpeg_test_file(FILE *f)
-{
- int n,r;
- jpeg j;
- n = ftell(f);
- start_file(&j.s, f);
- r = decode_jpeg_header(&j, SCAN_type);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_jpeg_test_memory(stbi_uc const *buffer, int len)
-{
- jpeg j;
- start_mem(&j.s, buffer,len);
- return decode_jpeg_header(&j, SCAN_type);
-}
-
-// @TODO:
-#ifndef STBI_NO_STDIO
-extern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-extern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-// public domain zlib decode v0.2 Sean Barrett 2006-11-18
-// simple implementation
-// - all input must be provided in an upfront buffer
-// - all output is written to a single output buffer (can stb_malloc/stb_realloc)
-// performance
-// - fast huffman
-
-// fast-way is faster to check than jpeg huffman, but slow way is slower
-#define ZFAST_BITS 9 // accelerate all cases in default tables
-#define ZFAST_MASK ((1 << ZFAST_BITS) - 1)
-
-// zlib-style huffman encoding
-// (jpegs packs from left, zlib from right, so can't share code)
-typedef struct
-{
- uint16 fast[1 << ZFAST_BITS];
- uint16 firstcode[16];
- int maxcode[17];
- uint16 firstsymbol[16];
- uint8 size[288];
- uint16 value[288];
-} zhuffman;
-
-__forceinline static int bitreverse16(int n)
-{
- n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1);
- n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2);
- n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4);
- n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8);
- return n;
-}
-
-__forceinline static int bit_reverse(int v, int bits)
-{
- assert(bits <= 16);
- // to bit reverse n bits, reverse 16 and shift
- // e.g. 11 bits, bit reverse and shift away 5
- return bitreverse16(v) >> (16-bits);
-}
-
-static int zbuild_huffman(zhuffman *z, uint8 *sizelist, int num)
-{
- int i,k=0;
- int code, next_code[16], sizes[17];
-
- // DEFLATE spec for generating codes
- memset(sizes, 0, sizeof(sizes));
- memset(z->fast, 255, sizeof(z->fast));
- for (i=0; i < num; ++i)
- ++sizes[sizelist[i]];
- sizes[0] = 0;
- for (i=1; i < 16; ++i)
- assert(sizes[i] <= (1 << i));
- code = 0;
- for (i=1; i < 16; ++i) {
- next_code[i] = code;
- z->firstcode[i] = (uint16) code;
- z->firstsymbol[i] = (uint16) k;
- code = (code + sizes[i]);
- if (sizes[i])
- if (code-1 >= (1 << i)) return e("bad codelengths","Corrupt JPEG");
- z->maxcode[i] = code << (16-i); // preshift for inner loop
- code <<= 1;
- k += sizes[i];
- }
- z->maxcode[16] = 0x10000; // sentinel
- for (i=0; i < num; ++i) {
- int s = sizelist[i];
- if (s) {
- int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s];
- z->size[c] = (uint8)s;
- z->value[c] = (uint16)i;
- if (s <= ZFAST_BITS) {
- int k = bit_reverse(next_code[s],s);
- while (k < (1 << ZFAST_BITS)) {
- z->fast[k] = (uint16) c;
- k += (1 << s);
- }
- }
- ++next_code[s];
- }
- }
- return 1;
-}
-
-// zlib-from-memory implementation for PNG reading
-// because PNG allows splitting the zlib stream arbitrarily,
-// and it's annoying structurally to have PNG call ZLIB call PNG,
-// we require PNG read all the IDATs and combine them into a single
-// memory buffer
-
-typedef struct
-{
- uint8 *zbuffer, *zbuffer_end;
- int num_bits;
- uint32 code_buffer;
-
- char *zout;
- char *zout_start;
- char *zout_end;
- int z_expandable;
-
- zhuffman z_length, z_distance;
-} zbuf;
-
-__forceinline static int zget8(zbuf *z)
-{
- if (z->zbuffer >= z->zbuffer_end) return 0;
- return *z->zbuffer++;
-}
-
-static void fill_bits(zbuf *z)
-{
- do {
- assert(z->code_buffer < (1U << z->num_bits));
- z->code_buffer |= zget8(z) << z->num_bits;
- z->num_bits += 8;
- } while (z->num_bits <= 24);
-}
-
-__forceinline static unsigned int zreceive(zbuf *z, int n)
-{
- unsigned int k;
- if (z->num_bits < n) fill_bits(z);
- k = z->code_buffer & ((1 << n) - 1);
- z->code_buffer >>= n;
- z->num_bits -= n;
- return k;
-}
-
-__forceinline static int zhuffman_decode(zbuf *a, zhuffman *z)
-{
- int b,s,k;
- if (a->num_bits < 16) fill_bits(a);
- b = z->fast[a->code_buffer & ZFAST_MASK];
- if (b < 0xffff) {
- s = z->size[b];
- a->code_buffer >>= s;
- a->num_bits -= s;
- return z->value[b];
- }
-
- // not resolved by fast table, so compute it the slow way
- // use jpeg approach, which requires MSbits at top
- k = bit_reverse(a->code_buffer, 16);
- for (s=ZFAST_BITS+1; ; ++s)
- if (k < z->maxcode[s])
- break;
- if (s == 16) return -1; // invalid code!
- // code size is s, so:
- b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s];
- assert(z->size[b] == s);
- a->code_buffer >>= s;
- a->num_bits -= s;
- return z->value[b];
-}
-
-static int expand(zbuf *z, int n) // need to make room for n bytes
-{
- char *q;
- int cur, limit;
- if (!z->z_expandable) return e("output buffer limit","Corrupt PNG");
- cur = (int) (z->zout - z->zout_start);
- limit = (int) (z->zout_end - z->zout_start);
- while (cur + n > limit)
- limit *= 2;
- q = (char *) stb_realloc(z->zout_start, limit);
- if (q == NULL) return e("outofmem", "Out of memory");
- z->zout_start = q;
- z->zout = q + cur;
- z->zout_end = q + limit;
- return 1;
-}
-
-static int length_base[31] = {
- 3,4,5,6,7,8,9,10,11,13,
- 15,17,19,23,27,31,35,43,51,59,
- 67,83,99,115,131,163,195,227,258,0,0 };
-
-static int length_extra[31]=
-{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 };
-
-static int dist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,
-257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0};
-
-static int dist_extra[32] =
-{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
-
-static int parse_huffman_block(zbuf *a)
-{
- for(;;) {
- int z = zhuffman_decode(a, &a->z_length);
- if (z < 256) {
- if (z < 0) return e("bad huffman code","Corrupt PNG"); // error in huffman codes
- if (a->zout >= a->zout_end) if (!expand(a, 1)) return 0;
- *a->zout++ = (char) z;
- } else {
- uint8 *p;
- int len,dist;
- if (z == 256) return 1;
- z -= 257;
- len = length_base[z];
- if (length_extra[z]) len += zreceive(a, length_extra[z]);
- z = zhuffman_decode(a, &a->z_distance);
- if (z < 0) return e("bad huffman code","Corrupt PNG");
- dist = dist_base[z];
- if (dist_extra[z]) dist += zreceive(a, dist_extra[z]);
- if (a->zout - a->zout_start < dist) return e("bad dist","Corrupt PNG");
- if (a->zout + len > a->zout_end) if (!expand(a, len)) return 0;
- p = (uint8 *) (a->zout - dist);
- while (len--)
- *a->zout++ = *p++;
- }
- }
-}
-
-static int compute_huffman_codes(zbuf *a)
-{
- static uint8 length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 };
- zhuffman z_codelength;
- uint8 lencodes[286+32+137];//padding for maximum single op
- uint8 codelength_sizes[19];
- int i,n;
-
- int hlit = zreceive(a,5) + 257;
- int hdist = zreceive(a,5) + 1;
- int hclen = zreceive(a,4) + 4;
-
- memset(codelength_sizes, 0, sizeof(codelength_sizes));
- for (i=0; i < hclen; ++i) {
- int s = zreceive(a,3);
- codelength_sizes[length_dezigzag[i]] = (uint8) s;
- }
- if (!zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0;
-
- n = 0;
- while (n < hlit + hdist) {
- int c = zhuffman_decode(a, &z_codelength);
- assert(c >= 0 && c < 19);
- if (c < 16)
- lencodes[n++] = (uint8) c;
- else if (c == 16) {
- c = zreceive(a,2)+3;
- memset(lencodes+n, lencodes[n-1], c);
- n += c;
- } else if (c == 17) {
- c = zreceive(a,3)+3;
- memset(lencodes+n, 0, c);
- n += c;
- } else {
- assert(c == 18);
- c = zreceive(a,7)+11;
- memset(lencodes+n, 0, c);
- n += c;
- }
- }
- if (n != hlit+hdist) return e("bad codelengths","Corrupt PNG");
- if (!zbuild_huffman(&a->z_length, lencodes, hlit)) return 0;
- if (!zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0;
- return 1;
-}
-
-static int parse_uncompressed_block(zbuf *a)
-{
- uint8 header[4];
- int len,nlen,k;
- if (a->num_bits & 7)
- zreceive(a, a->num_bits & 7); // discard
- // drain the bit-packed data into header
- k = 0;
- while (a->num_bits > 0) {
- header[k++] = (uint8) (a->code_buffer & 255); // wtf this warns?
- a->code_buffer >>= 8;
- a->num_bits -= 8;
- }
- assert(a->num_bits == 0);
- // now fill header the normal way
- while (k < 4)
- header[k++] = (uint8) zget8(a);
- len = header[1] * 256 + header[0];
- nlen = header[3] * 256 + header[2];
- if (nlen != (len ^ 0xffff)) return e("zlib corrupt","Corrupt PNG");
- if (a->zbuffer + len > a->zbuffer_end) return e("read past buffer","Corrupt PNG");
- if (a->zout + len > a->zout_end)
- if (!expand(a, len)) return 0;
- memcpy(a->zout, a->zbuffer, len);
- a->zbuffer += len;
- a->zout += len;
- return 1;
-}
-
-static int parse_zlib_header(zbuf *a)
-{
- int cmf = zget8(a);
- int cm = cmf & 15;
- /* int cinfo = cmf >> 4; */
- int flg = zget8(a);
- if ((cmf*256+flg) % 31 != 0) return e("bad zlib header","Corrupt PNG"); // zlib spec
- if (flg & 32) return e("no preset dict","Corrupt PNG"); // preset dictionary not allowed in png
- if (cm != 8) return e("bad compression","Corrupt PNG"); // DEFLATE required for png
- // window = 1 << (8 + cinfo)... but who cares, we fully buffer output
- return 1;
-}
-
-// @TODO: should statically initialize these for optimal thread safety
-static uint8 default_length[288], default_distance[32];
-static void init_defaults(void)
-{
- int i; // use <= to match clearly with spec
- for (i=0; i <= 143; ++i) default_length[i] = 8;
- for ( ; i <= 255; ++i) default_length[i] = 9;
- for ( ; i <= 279; ++i) default_length[i] = 7;
- for ( ; i <= 287; ++i) default_length[i] = 8;
-
- for (i=0; i <= 31; ++i) default_distance[i] = 5;
-}
-
-int stbi_png_partial; // a quick hack to only allow decoding some of a PNG... I should implement real streaming support instead
-static int parse_zlib(zbuf *a, int parse_header)
-{
- int final, type;
- if (parse_header)
- if (!parse_zlib_header(a)) return 0;
- a->num_bits = 0;
- a->code_buffer = 0;
- do {
- final = zreceive(a,1);
- type = zreceive(a,2);
- if (type == 0) {
- if (!parse_uncompressed_block(a)) return 0;
- } else if (type == 3) {
- return 0;
- } else {
- if (type == 1) {
- // use fixed code lengths
- if (!default_distance[31]) init_defaults();
- if (!zbuild_huffman(&a->z_length , default_length , 288)) return 0;
- if (!zbuild_huffman(&a->z_distance, default_distance, 32)) return 0;
- } else {
- if (!compute_huffman_codes(a)) return 0;
- }
- if (!parse_huffman_block(a)) return 0;
- }
- if (stbi_png_partial && a->zout - a->zout_start > 65536)
- break;
- } while (!final);
- return 1;
-}
-
-static int do_zlib(zbuf *a, char *obuf, int olen, int exp, int parse_header)
-{
- a->zout_start = obuf;
- a->zout = obuf;
- a->zout_end = obuf + olen;
- a->z_expandable = exp;
-
- return parse_zlib(a, parse_header);
-}
-
-char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen)
-{
- zbuf a;
- char *p = (char *) stb_malloc(initial_size);
- if (p == NULL) return NULL;
- a.zbuffer = (uint8 *) buffer;
- a.zbuffer_end = (uint8 *) buffer + len;
- if (do_zlib(&a, p, initial_size, 1, 1)) {
- if (outlen) *outlen = (int) (a.zout - a.zout_start);
- return a.zout_start;
- } else {
- stb_free(a.zout_start);
- return NULL;
- }
-}
-
-char *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen)
-{
- return stbi_zlib_decode_malloc_guesssize(buffer, len, 16384, outlen);
-}
-
-int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen)
-{
- zbuf a;
- a.zbuffer = (uint8 *) ibuffer;
- a.zbuffer_end = (uint8 *) ibuffer + ilen;
- if (do_zlib(&a, obuffer, olen, 0, 1))
- return (int) (a.zout - a.zout_start);
- else
- return -1;
-}
-
-char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen)
-{
- zbuf a;
- char *p = (char *) stb_malloc(16384);
- if (p == NULL) return NULL;
- a.zbuffer = (uint8 *) buffer;
- a.zbuffer_end = (uint8 *) buffer+len;
- if (do_zlib(&a, p, 16384, 1, 0)) {
- if (outlen) *outlen = (int) (a.zout - a.zout_start);
- return a.zout_start;
- } else {
- stb_free(a.zout_start);
- return NULL;
- }
-}
-
-int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen)
-{
- zbuf a;
- a.zbuffer = (uint8 *) ibuffer;
- a.zbuffer_end = (uint8 *) ibuffer + ilen;
- if (do_zlib(&a, obuffer, olen, 0, 0))
- return (int) (a.zout - a.zout_start);
- else
- return -1;
-}
-
-// public domain "baseline" PNG decoder v0.10 Sean Barrett 2006-11-18
-// simple implementation
-// - only 8-bit samples
-// - no CRC checking
-// - allocates lots of intermediate memory
-// - avoids problem of streaming data between subsystems
-// - avoids explicit window management
-// performance
-// - uses stb_zlib, a PD zlib implementation with fast huffman decoding
-
-
-typedef struct
-{
- uint32 length;
- uint32 type;
-} chunk;
-
-#define PNG_TYPE(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
-
-static chunk get_chunk_header(stbi *s)
-{
- chunk c;
- c.length = get32(s);
- c.type = get32(s);
- return c;
-}
-
-static int check_png_header(stbi *s)
-{
- static uint8 png_sig[8] = { 137,80,78,71,13,10,26,10 };
- int i;
- for (i=0; i < 8; ++i)
- if (get8(s) != png_sig[i]) return e("bad png sig","Not a PNG");
- return 1;
-}
-
-typedef struct
-{
- stbi s;
- uint8 *idata, *expanded, *out;
-} png;
-
-
-enum {
- F_none=0, F_sub=1, F_up=2, F_avg=3, F_paeth=4,
- F_avg_first, F_paeth_first,
-};
-
-static uint8 first_row_filter[5] =
-{
- F_none, F_sub, F_none, F_avg_first, F_paeth_first
-};
-
-static int paeth(int a, int b, int c)
-{
- int p = a + b - c;
- int pa = abs(p-a);
- int pb = abs(p-b);
- int pc = abs(p-c);
- if (pa <= pb && pa <= pc) return a;
- if (pb <= pc) return b;
- return c;
-}
-
-// create the png data from post-deflated data
-static int create_png_image_raw(png *a, uint8 *raw, uint32 raw_len, int out_n, uint32 x, uint32 y)
-{
- stbi *s = &a->s;
- uint32 i,j,stride = x*out_n;
- int k;
- int img_n = s->img_n; // copy it into a local for later
- assert(out_n == s->img_n || out_n == s->img_n+1);
- if (stbi_png_partial) y = 1;
- a->out = (uint8 *) stb_malloc(x * y * out_n);
- if (!a->out) return e("outofmem", "Out of memory");
- if (!stbi_png_partial) {
- if (s->img_x == x && s->img_y == y)
- if (raw_len != (img_n * x + 1) * y) return e("not enough pixels","Corrupt PNG");
- else // interlaced:
- if (raw_len < (img_n * x + 1) * y) return e("not enough pixels","Corrupt PNG");
- }
- for (j=0; j < y; ++j) {
- uint8 *cur = a->out + stride*j;
- uint8 *prior = cur - stride;
- int filter = *raw++;
- if (filter > 4) return e("invalid filter","Corrupt PNG");
- // if first row, use special filter that doesn't sample previous row
- if (j == 0) filter = first_row_filter[filter];
- // handle first pixel explicitly
- for (k=0; k < img_n; ++k) {
- switch(filter) {
- case F_none : cur[k] = raw[k]; break;
- case F_sub : cur[k] = raw[k]; break;
- case F_up : cur[k] = raw[k] + prior[k]; break;
- case F_avg : cur[k] = raw[k] + (prior[k]>>1); break;
- case F_paeth : cur[k] = (uint8) (raw[k] + paeth(0,prior[k],0)); break;
- case F_avg_first : cur[k] = raw[k]; break;
- case F_paeth_first: cur[k] = raw[k]; break;
- }
- }
- if (img_n != out_n) cur[img_n] = 255;
- raw += img_n;
- cur += out_n;
- prior += out_n;
- // this is a little gross, so that we don't switch per-pixel or per-component
- if (img_n == out_n) {
- #define CASE(f) \
- case f: \
- for (i=x-1; i >= 1; --i, raw+=img_n,cur+=img_n,prior+=img_n) \
- for (k=0; k < img_n; ++k)
- switch(filter) {
- CASE(F_none) cur[k] = raw[k]; break;
- CASE(F_sub) cur[k] = raw[k] + cur[k-img_n]; break;
- CASE(F_up) cur[k] = raw[k] + prior[k]; break;
- CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-img_n])>>1); break;
- CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],prior[k],prior[k-img_n])); break;
- CASE(F_avg_first) cur[k] = raw[k] + (cur[k-img_n] >> 1); break;
- CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],0,0)); break;
- }
- #undef CASE
- } else {
- assert(img_n+1 == out_n);
- #define CASE(f) \
- case f: \
- for (i=x-1; i >= 1; --i, cur[img_n]=255,raw+=img_n,cur+=out_n,prior+=out_n) \
- for (k=0; k < img_n; ++k)
- switch(filter) {
- CASE(F_none) cur[k] = raw[k]; break;
- CASE(F_sub) cur[k] = raw[k] + cur[k-out_n]; break;
- CASE(F_up) cur[k] = raw[k] + prior[k]; break;
- CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-out_n])>>1); break;
- CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],prior[k],prior[k-out_n])); break;
- CASE(F_avg_first) cur[k] = raw[k] + (cur[k-out_n] >> 1); break;
- CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],0,0)); break;
- }
- #undef CASE
- }
- }
- return 1;
-}
-
-static int create_png_image(png *a, uint8 *raw, uint32 raw_len, int out_n, int interlaced)
-{
- uint8 *final;
- int p;
- int save;
- if (!interlaced)
- return create_png_image_raw(a, raw, raw_len, out_n, a->s.img_x, a->s.img_y);
- save = stbi_png_partial;
- stbi_png_partial = 0;
-
- // de-interlacing
- final = (uint8 *) stb_malloc(a->s.img_x * a->s.img_y * out_n);
- for (p=0; p < 7; ++p) {
- int xorig[] = { 0,4,0,2,0,1,0 };
- int yorig[] = { 0,0,4,0,2,0,1 };
- int xspc[] = { 8,8,4,4,2,2,1 };
- int yspc[] = { 8,8,8,4,4,2,2 };
- int i,j,x,y;
- // pass1_x[4] = 0, pass1_x[5] = 1, pass1_x[12] = 1
- x = (a->s.img_x - xorig[p] + xspc[p]-1) / xspc[p];
- y = (a->s.img_y - yorig[p] + yspc[p]-1) / yspc[p];
- if (x && y) {
- if (!create_png_image_raw(a, raw, raw_len, out_n, x, y)) {
- stb_free(final);
- return 0;
- }
- for (j=0; j < y; ++j)
- for (i=0; i < x; ++i)
- memcpy(final + (j*yspc[p]+yorig[p])*a->s.img_x*out_n + (i*xspc[p]+xorig[p])*out_n,
- a->out + (j*x+i)*out_n, out_n);
- stb_free(a->out);
- raw += (x*out_n+1)*y;
- raw_len -= (x*out_n+1)*y;
- }
- }
- a->out = final;
-
- stbi_png_partial = save;
- return 1;
-}
-
-static int compute_transparency(png *z, uint8 tc[3], int out_n)
-{
- stbi *s = &z->s;
- uint32 i, pixel_count = s->img_x * s->img_y;
- uint8 *p = z->out;
-
- // compute color-based transparency, assuming we've
- // already got 255 as the alpha value in the output
- assert(out_n == 2 || out_n == 4);
-
- if (out_n == 2) {
- for (i=0; i < pixel_count; ++i) {
- p[1] = (p[0] == tc[0] ? 0 : 255);
- p += 2;
- }
- } else {
- for (i=0; i < pixel_count; ++i) {
- if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2])
- p[3] = 0;
- p += 4;
- }
- }
- return 1;
-}
-
-static int expand_palette(png *a, uint8 *palette, int len, int pal_img_n)
-{
- uint32 i, pixel_count = a->s.img_x * a->s.img_y;
- uint8 *p, *temp_out, *orig = a->out;
-
- p = (uint8 *) stb_malloc(pixel_count * pal_img_n);
- if (p == NULL) return e("outofmem", "Out of memory");
-
- // between here and stb_free(out) below, exitting would leak
- temp_out = p;
-
- if (pal_img_n == 3) {
- for (i=0; i < pixel_count; ++i) {
- int n = orig[i]*4;
- p[0] = palette[n ];
- p[1] = palette[n+1];
- p[2] = palette[n+2];
- p += 3;
- }
- } else {
- for (i=0; i < pixel_count; ++i) {
- int n = orig[i]*4;
- p[0] = palette[n ];
- p[1] = palette[n+1];
- p[2] = palette[n+2];
- p[3] = palette[n+3];
- p += 4;
- }
- }
- stb_free(a->out);
- a->out = temp_out;
- return 1;
-}
-
-static int parse_png_file(png *z, int scan, int req_comp)
-{
- uint8 palette[1024], pal_img_n=0;
- uint8 has_trans=0, tc[3];
- uint32 ioff=0, idata_limit=0, i, pal_len=0;
- int first=1,k,interlace=0;
- stbi *s = &z->s;
-
- if (!check_png_header(s)) return 0;
-
- if (scan == SCAN_type) return 1;
-
- for(;;first=0) {
- chunk c = get_chunk_header(s);
- if (first && c.type != PNG_TYPE('I','H','D','R'))
- return e("first not IHDR","Corrupt PNG");
- switch (c.type) {
- case PNG_TYPE('I','H','D','R'): {
- int depth,color,comp,filter;
- if (!first) return e("multiple IHDR","Corrupt PNG");
- if (c.length != 13) return e("bad IHDR len","Corrupt PNG");
- s->img_x = get32(s); if (s->img_x > (1 << 24)) return e("too large","Very large image (corrupt?)");
- s->img_y = get32(s); if (s->img_y > (1 << 24)) return e("too large","Very large image (corrupt?)");
- depth = get8(s); if (depth != 8) return e("8bit only","PNG not supported: 8-bit only");
- color = get8(s); if (color > 6) return e("bad ctype","Corrupt PNG");
- if (color == 3) pal_img_n = 3; else if (color & 1) return e("bad ctype","Corrupt PNG");
- comp = get8(s); if (comp) return e("bad comp method","Corrupt PNG");
- filter= get8(s); if (filter) return e("bad filter method","Corrupt PNG");
- interlace = get8(s); if (interlace>1) return e("bad interlace method","Corrupt PNG");
- if (!s->img_x || !s->img_y) return e("0-pixel image","Corrupt PNG");
- if (!pal_img_n) {
- s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0);
- if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e("too large", "Image too large to decode");
- if (scan == SCAN_header) return 1;
- } else {
- // if paletted, then pal_n is our final components, and
- // img_n is # components to decompress/filter.
- s->img_n = 1;
- if ((1 << 30) / s->img_x / 4 < s->img_y) return e("too large","Corrupt PNG");
- // if SCAN_header, have to scan to see if we have a tRNS
- }
- break;
- }
-
- case PNG_TYPE('P','L','T','E'): {
- if (c.length > 256*3) return e("invalid PLTE","Corrupt PNG");
- pal_len = c.length / 3;
- if (pal_len * 3 != c.length) return e("invalid PLTE","Corrupt PNG");
- for (i=0; i < pal_len; ++i) {
- palette[i*4+0] = get8u(s);
- palette[i*4+1] = get8u(s);
- palette[i*4+2] = get8u(s);
- palette[i*4+3] = 255;
- }
- break;
- }
-
- case PNG_TYPE('t','R','N','S'): {
- if (z->idata) return e("tRNS after IDAT","Corrupt PNG");
- if (pal_img_n) {
- if (scan == SCAN_header) { s->img_n = 4; return 1; }
- if (pal_len == 0) return e("tRNS before PLTE","Corrupt PNG");
- if (c.length > pal_len) return e("bad tRNS len","Corrupt PNG");
- pal_img_n = 4;
- for (i=0; i < c.length; ++i)
- palette[i*4+3] = get8u(s);
- } else {
- if (!(s->img_n & 1)) return e("tRNS with alpha","Corrupt PNG");
- if (c.length != (uint32) s->img_n*2) return e("bad tRNS len","Corrupt PNG");
- has_trans = 1;
- for (k=0; k < s->img_n; ++k)
- tc[k] = (uint8) get16(s); // non 8-bit images will be larger
- }
- break;
- }
-
- case PNG_TYPE('I','D','A','T'): {
- if (pal_img_n && !pal_len) return e("no PLTE","Corrupt PNG");
- if (scan == SCAN_header) { s->img_n = pal_img_n; return 1; }
- if (ioff + c.length > idata_limit) {
- uint8 *p;
- if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096;
- while (ioff + c.length > idata_limit)
- idata_limit *= 2;
- p = (uint8 *) stb_realloc(z->idata, idata_limit); if (p == NULL) return e("outofmem", "Out of memory");
- z->idata = p;
- }
- #ifndef STBI_NO_STDIO
- if (s->img_file)
- {
- if (fread(z->idata+ioff,1,c.length,s->img_file) != c.length) return e("outofdata","Corrupt PNG");
- }
- else
- #endif
- {
- memcpy(z->idata+ioff, s->img_buffer, c.length);
- s->img_buffer += c.length;
- }
- ioff += c.length;
- break;
- }
-
- case PNG_TYPE('I','E','N','D'): {
- uint32 raw_len;
- if (scan != SCAN_load) return 1;
- if (z->idata == NULL) return e("no IDAT","Corrupt PNG");
- z->expanded = (uint8 *) stbi_zlib_decode_malloc((char *) z->idata, ioff, (int *) &raw_len);
- if (z->expanded == NULL) return 0; // zlib should set error
- stb_free(z->idata); z->idata = NULL;
- if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans)
- s->img_out_n = s->img_n+1;
- else
- s->img_out_n = s->img_n;
- if (!create_png_image(z, z->expanded, raw_len, s->img_out_n, interlace)) return 0;
- if (has_trans)
- if (!compute_transparency(z, tc, s->img_out_n)) return 0;
- if (pal_img_n) {
- // pal_img_n == 3 or 4
- s->img_n = pal_img_n; // record the actual colors we had
- s->img_out_n = pal_img_n;
- if (req_comp >= 3) s->img_out_n = req_comp;
- if (!expand_palette(z, palette, pal_len, s->img_out_n))
- return 0;
- }
- stb_free(z->expanded); z->expanded = NULL;
- return 1;
- }
-
- default:
- // if critical, fail
- if ((c.type & (1 << 29)) == 0) {
- #ifndef STBI_NO_FAILURE_STRINGS
- // not threadsafe
- static char invalid_chunk[] = "XXXX chunk not known";
- invalid_chunk[0] = (uint8) (c.type >> 24);
- invalid_chunk[1] = (uint8) (c.type >> 16);
- invalid_chunk[2] = (uint8) (c.type >> 8);
- invalid_chunk[3] = (uint8) (c.type >> 0);
- #endif
- return e(invalid_chunk, "PNG not supported: unknown chunk type");
- }
- skip(s, c.length);
- break;
- }
- // end of chunk, read and skip CRC
- get32(s);
- }
-}
-
-static unsigned char *do_png(png *p, int *x, int *y, int *n, int req_comp)
-{
- unsigned char *result=NULL;
- p->expanded = NULL;
- p->idata = NULL;
- p->out = NULL;
- if (req_comp < 0 || req_comp > 4) return epuc("bad req_comp", "Internal error");
- if (parse_png_file(p, SCAN_load, req_comp)) {
- result = p->out;
- p->out = NULL;
- if (req_comp && req_comp != p->s.img_out_n) {
- result = convert_format(result, p->s.img_out_n, req_comp, p->s.img_x, p->s.img_y);
- p->s.img_out_n = req_comp;
- if (result == NULL) return result;
- }
- *x = p->s.img_x;
- *y = p->s.img_y;
- if (n) *n = p->s.img_n;
- }
- stb_free(p->out); p->out = NULL;
- stb_free(p->expanded); p->expanded = NULL;
- stb_free(p->idata); p->idata = NULL;
-
- return result;
-}
-
-#ifndef STBI_NO_STDIO
-unsigned char *stbi_png_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- png p;
- start_file(&p.s, f);
- return do_png(&p, x,y,comp,req_comp);
-}
-
-unsigned char *stbi_png_load(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- unsigned char *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_png_load_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-#endif
-
-unsigned char *stbi_png_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- png p;
- start_mem(&p.s, buffer,len);
- return do_png(&p, x,y,comp,req_comp);
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_png_test_file(FILE *f)
-{
- png p;
- int n,r;
- n = ftell(f);
- start_file(&p.s, f);
- r = parse_png_file(&p, SCAN_type,STBI_default);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_png_test_memory(stbi_uc const *buffer, int len)
-{
- png p;
- start_mem(&p.s, buffer, len);
- return parse_png_file(&p, SCAN_type,STBI_default);
-}
-
-// TODO: load header from png
-#ifndef STBI_NO_STDIO
-int stbi_png_info (char const *filename, int *x, int *y, int *comp)
-{
- png p;
- FILE *f = fopen(filename, "rb");
- if (!f) return 0;
- start_file(&p.s, f);
- if (parse_png_file(&p, SCAN_header, 0)) {
- if(x) *x = p.s.img_x;
- if(y) *y = p.s.img_y;
- if (comp) *comp = p.s.img_n;
- fclose(f);
- return 1;
- }
- fclose(f);
- return 0;
-}
-
-extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-extern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-// Microsoft/Windows BMP image
-
-static int bmp_test(stbi *s)
-{
- int sz;
- if (get8(s) != 'B') return 0;
- if (get8(s) != 'M') return 0;
- get32le(s); // discard filesize
- get16le(s); // discard reserved
- get16le(s); // discard reserved
- get32le(s); // discard data offset
- sz = get32le(s);
- if (sz == 12 || sz == 40 || sz == 56 || sz == 108) return 1;
- return 0;
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_bmp_test_file (FILE *f)
-{
- stbi s;
- int r,n = ftell(f);
- start_file(&s,f);
- r = bmp_test(&s);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_bmp_test_memory (stbi_uc const *buffer, int len)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return bmp_test(&s);
-}
-
-// returns 0..31 for the highest set bit
-static int high_bit(unsigned int z)
-{
- int n=0;
- if (z == 0) return -1;
- if (z >= 0x10000) n += 16, z >>= 16;
- if (z >= 0x00100) n += 8, z >>= 8;
- if (z >= 0x00010) n += 4, z >>= 4;
- if (z >= 0x00004) n += 2, z >>= 2;
- if (z >= 0x00002) n += 1, z >>= 1;
- return n;
-}
-
-static int bitcount(unsigned int a)
-{
- a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2
- a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4
- a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits
- a = (a + (a >> 8)); // max 16 per 8 bits
- a = (a + (a >> 16)); // max 32 per 8 bits
- return a & 0xff;
-}
-
-static int shiftsigned(int v, int shift, int bits)
-{
- int result;
- int z=0;
-
- if (shift < 0) v <<= -shift;
- else v >>= shift;
- result = v;
-
- z = bits;
- while (z < 8) {
- result += v >> z;
- z += bits;
- }
- return result;
-}
-
-static stbi_uc *bmp_load(stbi *s, int *x, int *y, int *comp, int req_comp)
-{
- uint8 *out;
- unsigned int mr=0,mg=0,mb=0,ma=0, fake_a=0;
- stbi_uc pal[256][4];
- int psize=0,i,j,compress=0,width;
- int bpp, flip_vertically, pad, target, offset, hsz;
- if (get8(s) != 'B' || get8(s) != 'M') return epuc("not BMP", "Corrupt BMP");
- get32le(s); // discard filesize
- get16le(s); // discard reserved
- get16le(s); // discard reserved
- offset = get32le(s);
- hsz = get32le(s);
- if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108) return epuc("unknown BMP", "BMP type not supported: unknown");
- failure_reason = "bad BMP";
- if (hsz == 12) {
- s->img_x = get16le(s);
- s->img_y = get16le(s);
- } else {
- s->img_x = get32le(s);
- s->img_y = get32le(s);
- }
- if (get16le(s) != 1) return 0;
- bpp = get16le(s);
- if (bpp == 1) return epuc("monochrome", "BMP type not supported: 1-bit");
- flip_vertically = ((int) s->img_y) > 0;
- s->img_y = abs((int) s->img_y);
- if (hsz == 12) {
- if (bpp < 24)
- psize = (offset - 14 - 24) / 3;
- } else {
- compress = get32le(s);
- if (compress == 1 || compress == 2) return epuc("BMP RLE", "BMP type not supported: RLE");
- get32le(s); // discard sizeof
- get32le(s); // discard hres
- get32le(s); // discard vres
- get32le(s); // discard colorsused
- get32le(s); // discard max important
- if (hsz == 40 || hsz == 56) {
- if (hsz == 56) {
- get32le(s);
- get32le(s);
- get32le(s);
- get32le(s);
- }
- if (bpp == 16 || bpp == 32) {
- mr = mg = mb = 0;
- if (compress == 0) {
- if (bpp == 32) {
- mr = 0xff << 16;
- mg = 0xff << 8;
- mb = 0xff << 0;
- ma = (unsigned int)(0xff << 24);
- fake_a = 1; // @TODO: check for cases like alpha value is all 0 and switch it to 255
- } else {
- mr = 31 << 10;
- mg = 31 << 5;
- mb = 31 << 0;
- }
- } else if (compress == 3) {
- mr = get32le(s);
- mg = get32le(s);
- mb = get32le(s);
- // not documented, but generated by photoshop and handled by mspaint
- if (mr == mg && mg == mb) {
- // ?!?!?
- return NULL;
- }
- } else
- return NULL;
- }
- } else {
- assert(hsz == 108);
- mr = get32le(s);
- mg = get32le(s);
- mb = get32le(s);
- ma = get32le(s);
- get32le(s); // discard color space
- for (i=0; i < 12; ++i)
- get32le(s); // discard color space parameters
- }
- if (bpp < 16)
- psize = (offset - 14 - hsz) >> 2;
- }
- s->img_n = ma ? 4 : 3;
- if (req_comp && req_comp >= 3) // we can directly decode 3 or 4
- target = req_comp;
- else
- target = s->img_n; // if they want monochrome, we'll post-convert
- out = (stbi_uc *) stb_malloc(target * s->img_x * s->img_y);
- if (!out) return epuc("outofmem", "Out of memory");
- if (bpp < 16) {
- int z=0;
- if (psize == 0 || psize > 256) { stb_free(out); return epuc("invalid", "Corrupt BMP"); }
- for (i=0; i < psize; ++i) {
- pal[i][2] = get8(s);
- pal[i][1] = get8(s);
- pal[i][0] = get8(s);
- if (hsz != 12) get8(s);
- pal[i][3] = 255;
- }
- skip(s, offset - 14 - hsz - psize * (hsz == 12 ? 3 : 4));
- if (bpp == 4) width = (s->img_x + 1) >> 1;
- else if (bpp == 8) width = s->img_x;
- else { stb_free(out); return epuc("bad bpp", "Corrupt BMP"); }
- pad = (-width)&3;
- for (j=0; j < (int) s->img_y; ++j) {
- for (i=0; i < (int) s->img_x; i += 2) {
- int v=get8(s),v2=0;
- if (bpp == 4) {
- v2 = v & 15;
- v >>= 4;
- }
- out[z++] = pal[v][0];
- out[z++] = pal[v][1];
- out[z++] = pal[v][2];
- if (target == 4) out[z++] = 255;
- if (i+1 == (int) s->img_x) break;
- v = (bpp == 8) ? get8(s) : v2;
- out[z++] = pal[v][0];
- out[z++] = pal[v][1];
- out[z++] = pal[v][2];
- if (target == 4) out[z++] = 255;
- }
- skip(s, pad);
- }
- } else {
- int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0;
- int z = 0;
- int easy=0;
- skip(s, offset - 14 - hsz);
- if (bpp == 24) width = 3 * s->img_x;
- else if (bpp == 16) width = 2*s->img_x;
- else /* bpp = 32 and pad = 0 */ width=0;
- pad = (-width) & 3;
- if (bpp == 24) {
- easy = 1;
- } else if (bpp == 32) {
- if (mb == 0xff && mg == 0xff00 && mr == 0xff000000 && ma == 0xff000000)
- easy = 2;
- }
- if (!easy) {
- if (!mr || !mg || !mb) return epuc("bad masks", "Corrupt BMP");
- // right shift amt to put high bit in position #7
- rshift = high_bit(mr)-7; rcount = bitcount(mr);
- gshift = high_bit(mg)-7; gcount = bitcount(mr);
- bshift = high_bit(mb)-7; bcount = bitcount(mr);
- ashift = high_bit(ma)-7; acount = bitcount(mr);
- }
- for (j=0; j < (int) s->img_y; ++j) {
- if (easy) {
- for (i=0; i < (int) s->img_x; ++i) {
- int a;
- out[z+2] = get8(s);
- out[z+1] = get8(s);
- out[z+0] = get8(s);
- z += 3;
- a = (easy == 2 ? get8(s) : 255);
- if (target == 4) out[z++] = a;
- }
- } else {
- for (i=0; i < (int) s->img_x; ++i) {
- uint32 v = (bpp == 16 ? get16le(s) : get32le(s));
- int a;
- out[z++] = shiftsigned(v & mr, rshift, rcount);
- out[z++] = shiftsigned(v & mg, gshift, gcount);
- out[z++] = shiftsigned(v & mb, bshift, bcount);
- a = (ma ? shiftsigned(v & ma, ashift, acount) : 255);
- if (target == 4) out[z++] = a;
- }
- }
- skip(s, pad);
- }
- }
- if (flip_vertically) {
- stbi_uc t;
- for (j=0; j < (int) s->img_y>>1; ++j) {
- stbi_uc *p1 = out + j *s->img_x*target;
- stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target;
- for (i=0; i < (int) s->img_x*target; ++i) {
- t = p1[i], p1[i] = p2[i], p2[i] = t;
- }
- }
- }
-
- if (req_comp && req_comp != target) {
- out = convert_format(out, target, req_comp, s->img_x, s->img_y);
- if (out == NULL) return out; // convert_format frees input on failure
- }
-
- *x = s->img_x;
- *y = s->img_y;
- if (comp) *comp = target;
- return out;
-}
-
-#ifndef STBI_NO_STDIO
-stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- stbi_uc *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_bmp_load_from_file(f, x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-
-stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_file(&s, f);
- return bmp_load(&s, x,y,comp,req_comp);
-}
-#endif
-
-stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return bmp_load(&s, x,y,comp,req_comp);
-}
-
-// Targa Truevision - TGA
-// by Jonathan Dummer
-
-static int tga_test(stbi *s)
-{
- int sz;
- get8u(s); // discard Offset
- sz = get8u(s); // color type
- if( sz > 1 ) return 0; // only RGB or indexed allowed
- sz = get8u(s); // image type
- if( (sz != 1) && (sz != 2) && (sz != 3) && (sz != 9) && (sz != 10) && (sz != 11) ) return 0; // only RGB or grey allowed, +/- RLE
- get16(s); // discard palette start
- get16(s); // discard palette length
- get8(s); // discard bits per palette color entry
- get16(s); // discard x origin
- get16(s); // discard y origin
- if( get16(s) < 1 ) return 0; // test width
- if( get16(s) < 1 ) return 0; // test height
- sz = get8(s); // bits per pixel
- if( (sz != 8) && (sz != 16) && (sz != 24) && (sz != 32) ) return 0; // only RGB or RGBA or grey allowed
- return 1; // seems to have passed everything
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_tga_test_file (FILE *f)
-{
- stbi s;
- int r,n = ftell(f);
- start_file(&s, f);
- r = tga_test(&s);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_tga_test_memory (stbi_uc const *buffer, int len)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return tga_test(&s);
-}
-
-static stbi_uc *tga_load(stbi *s, int *x, int *y, int *comp, int req_comp)
-{
- // read in the TGA header stuff
- int tga_offset = get8u(s);
- int tga_indexed = get8u(s);
- int tga_image_type = get8u(s);
- int tga_is_RLE = 0;
- int tga_palette_start = get16le(s);
- int tga_palette_len = get16le(s);
- int tga_palette_bits = get8u(s);
- int tga_x_origin = get16le(s);
- int tga_y_origin = get16le(s);
- int tga_width = get16le(s);
- int tga_height = get16le(s);
- int tga_bits_per_pixel = get8u(s);
- int tga_inverted = get8u(s);
- // image data
- unsigned char *tga_data;
- unsigned char *tga_palette = NULL;
- int i, j;
- unsigned char raw_data[4];
- unsigned char trans_data[4];
- int RLE_count = 0;
- int RLE_repeating = 0;
- int read_next_pixel = 1;
- // do a tiny bit of precessing
- if( tga_image_type >= 8 )
- {
- tga_image_type -= 8;
- tga_is_RLE = 1;
- }
- /* int tga_alpha_bits = tga_inverted & 15; */
- tga_inverted = 1 - ((tga_inverted >> 5) & 1);
-
- // error check
- if( //(tga_indexed) ||
- (tga_width < 1) || (tga_height < 1) ||
- (tga_image_type < 1) || (tga_image_type > 3) ||
- ((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16) &&
- (tga_bits_per_pixel != 24) && (tga_bits_per_pixel != 32))
- )
- {
- return NULL;
- }
-
- // If I'm paletted, then I'll use the number of bits from the palette
- if( tga_indexed )
- {
- tga_bits_per_pixel = tga_palette_bits;
- }
-
- // tga info
- *x = tga_width;
- *y = tga_height;
- if( (req_comp < 1) || (req_comp > 4) )
- {
- // just use whatever the file was
- req_comp = tga_bits_per_pixel / 8;
- *comp = req_comp;
- } else
- {
- // force a new number of components
- *comp = tga_bits_per_pixel/8;
- }
- tga_data = (unsigned char*)stb_malloc( tga_width * tga_height * req_comp );
-
- // skip to the data's starting position (offset usually = 0)
- skip(s, tga_offset );
- // do I need to load a palette?
- if( tga_indexed )
- {
- // any data to skip? (offset usually = 0)
- skip(s, tga_palette_start );
- // load the palette
- tga_palette = (unsigned char*)stb_malloc( tga_palette_len * tga_palette_bits / 8 );
- getn(s, tga_palette, tga_palette_len * tga_palette_bits / 8 );
- }
- // load the data
- for( i = 0; i < tga_width * tga_height; ++i )
- {
- // if I'm in RLE mode, do I need to get a RLE chunk?
- if( tga_is_RLE )
- {
- if( RLE_count == 0 )
- {
- // yep, get the next byte as a RLE command
- int RLE_cmd = get8u(s);
- RLE_count = 1 + (RLE_cmd & 127);
- RLE_repeating = RLE_cmd >> 7;
- read_next_pixel = 1;
- } else if( !RLE_repeating )
- {
- read_next_pixel = 1;
- }
- } else
- {
- read_next_pixel = 1;
- }
- // OK, if I need to read a pixel, do it now
- if( read_next_pixel )
- {
- // load however much data we did have
- if( tga_indexed )
- {
- // read in 1 byte, then perform the lookup
- int pal_idx = get8u(s);
- if( pal_idx >= tga_palette_len )
- {
- // invalid index
- pal_idx = 0;
- }
- pal_idx *= tga_bits_per_pixel / 8;
- for( j = 0; j*8 < tga_bits_per_pixel; ++j )
- {
- raw_data[j] = tga_palette[pal_idx+j];
- }
- } else
- {
- // read in the data raw
- for( j = 0; j*8 < tga_bits_per_pixel; ++j )
- {
- raw_data[j] = get8u(s);
- }
- }
- // convert raw to the intermediate format
- switch( tga_bits_per_pixel )
- {
- case 8:
- // Luminous => RGBA
- trans_data[0] = raw_data[0];
- trans_data[1] = raw_data[0];
- trans_data[2] = raw_data[0];
- trans_data[3] = 255;
- break;
- case 16:
- // Luminous,Alpha => RGBA
- trans_data[0] = raw_data[0];
- trans_data[1] = raw_data[0];
- trans_data[2] = raw_data[0];
- trans_data[3] = raw_data[1];
- break;
- case 24:
- // BGR => RGBA
- trans_data[0] = raw_data[2];
- trans_data[1] = raw_data[1];
- trans_data[2] = raw_data[0];
- trans_data[3] = 255;
- break;
- case 32:
- // BGRA => RGBA
- trans_data[0] = raw_data[2];
- trans_data[1] = raw_data[1];
- trans_data[2] = raw_data[0];
- trans_data[3] = raw_data[3];
- break;
- }
- // clear the reading flag for the next pixel
- read_next_pixel = 0;
- } // end of reading a pixel
- // convert to final format
- switch( req_comp )
- {
- case 1:
- // RGBA => Luminance
- tga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]);
- break;
- case 2:
- // RGBA => Luminance,Alpha
- tga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]);
- tga_data[i*req_comp+1] = trans_data[3];
- break;
- case 3:
- // RGBA => RGB
- tga_data[i*req_comp+0] = trans_data[0];
- tga_data[i*req_comp+1] = trans_data[1];
- tga_data[i*req_comp+2] = trans_data[2];
- break;
- case 4:
- // RGBA => RGBA
- tga_data[i*req_comp+0] = trans_data[0];
- tga_data[i*req_comp+1] = trans_data[1];
- tga_data[i*req_comp+2] = trans_data[2];
- tga_data[i*req_comp+3] = trans_data[3];
- break;
- }
- // in case we're in RLE mode, keep counting down
- --RLE_count;
- }
- // do I need to invert the image?
- if( tga_inverted )
- {
- for( j = 0; j*2 < tga_height; ++j )
- {
- int index1 = j * tga_width * req_comp;
- int index2 = (tga_height - 1 - j) * tga_width * req_comp;
- for( i = tga_width * req_comp; i > 0; --i )
- {
- unsigned char temp = tga_data[index1];
- tga_data[index1] = tga_data[index2];
- tga_data[index2] = temp;
- ++index1;
- ++index2;
- }
- }
- }
- // clear my palette, if I had one
- if( tga_palette != NULL )
- {
- stb_free( tga_palette );
- }
- // the things I do to get rid of an error message, and yet keep
- // Microsoft's C compilers happy... [8^(
- tga_palette_start = tga_palette_len = tga_palette_bits =
- tga_x_origin = tga_y_origin = 0;
- // OK, done
- return tga_data;
-}
-
-#ifndef STBI_NO_STDIO
-stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- stbi_uc *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_tga_load_from_file(f, x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-
-stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_file(&s, f);
- return tga_load(&s, x,y,comp,req_comp);
-}
-#endif
-
-stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return tga_load(&s, x,y,comp,req_comp);
-}
-
-
-// *************************************************************************************************
-// Photoshop PSD loader -- PD by Thatcher Ulrich, integration by Nicholas Schulz, tweaked by STB
-
-static int psd_test(stbi *s)
-{
- if (get32(s) != 0x38425053) return 0; // "8BPS"
- else return 1;
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_psd_test_file(FILE *f)
-{
- stbi s;
- int r,n = ftell(f);
- start_file(&s, f);
- r = psd_test(&s);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_psd_test_memory(stbi_uc const *buffer, int len)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return psd_test(&s);
-}
-
-static stbi_uc *psd_load(stbi *s, int *x, int *y, int *comp, int req_comp)
-{
- int pixelCount;
- int channelCount, compression;
- int channel, i, count, len;
- int w,h;
- uint8 *out;
-
- // Check identifier
- if (get32(s) != 0x38425053) // "8BPS"
- return epuc("not PSD", "Corrupt PSD image");
-
- // Check file type version.
- if (get16(s) != 1)
- return epuc("wrong version", "Unsupported version of PSD image");
-
- // Skip 6 reserved bytes.
- skip(s, 6 );
-
- // Read the number of channels (R, G, B, A, etc).
- channelCount = get16(s);
- if (channelCount < 0 || channelCount > 16)
- return epuc("wrong channel count", "Unsupported number of channels in PSD image");
-
- // Read the rows and columns of the image.
- h = get32(s);
- w = get32(s);
-
- // Make sure the depth is 8 bits.
- if (get16(s) != 8)
- return epuc("unsupported bit depth", "PSD bit depth is not 8 bit");
-
- // Make sure the color mode is RGB.
- // Valid options are:
- // 0: Bitmap
- // 1: Grayscale
- // 2: Indexed color
- // 3: RGB color
- // 4: CMYK color
- // 7: Multichannel
- // 8: Duotone
- // 9: Lab color
- if (get16(s) != 3)
- return epuc("wrong color format", "PSD is not in RGB color format");
-
- // Skip the Mode Data. (It's the palette for indexed color; other info for other modes.)
- skip(s,get32(s) );
-
- // Skip the image resources. (resolution, pen tool paths, etc)
- skip(s, get32(s) );
-
- // Skip the reserved data.
- skip(s, get32(s) );
-
- // Find out if the data is compressed.
- // Known values:
- // 0: no compression
- // 1: RLE compressed
- compression = get16(s);
- if (compression > 1)
- return epuc("bad compression", "PSD has an unknown compression format");
-
- // Create the destination image.
- out = (stbi_uc *) stb_malloc(4 * w*h);
- if (!out) return epuc("outofmem", "Out of memory");
- pixelCount = w*h;
-
- // Initialize the data to zero.
- //memset( out, 0, pixelCount * 4 );
-
- // Finally, the image data.
- if (compression) {
- // RLE as used by .PSD and .TIFF
- // Loop until you get the number of unpacked bytes you are expecting:
- // Read the next source byte into n.
- // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally.
- // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times.
- // Else if n is 128, noop.
- // Endloop
-
- // The RLE-compressed data is preceeded by a 2-byte data count for each row in the data,
- // which we're going to just skip.
- skip(s, h * channelCount * 2 );
-
- // Read the RLE data by channel.
- for (channel = 0; channel < 4; channel++) {
- uint8 *p;
-
- p = out+channel;
- if (channel >= channelCount) {
- // Fill this channel with default data.
- for (i = 0; i < pixelCount; i++) *p = (channel == 3 ? 255 : 0), p += 4;
- } else {
- // Read the RLE data.
- count = 0;
- while (count < pixelCount) {
- len = get8(s);
- if (len == 128) {
- // No-op.
- } else if (len < 128) {
- // Copy next len+1 bytes literally.
- len++;
- count += len;
- while (len) {
- *p = get8(s);
- p += 4;
- len--;
- }
- } else if (len > 128) {
- uint32 val;
- // Next -len+1 bytes in the dest are replicated from next source byte.
- // (Interpret len as a negative 8-bit int.)
- len ^= 0x0FF;
- len += 2;
- val = get8(s);
- count += len;
- while (len) {
- *p = val;
- p += 4;
- len--;
- }
- }
- }
- }
- }
-
- } else {
- // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...)
- // where each channel consists of an 8-bit value for each pixel in the image.
-
- // Read the data by channel.
- for (channel = 0; channel < 4; channel++) {
- uint8 *p;
-
- p = out + channel;
- if (channel > channelCount) {
- // Fill this channel with default data.
- for (i = 0; i < pixelCount; i++) *p = channel == 3 ? 255 : 0, p += 4;
- } else {
- // Read the data.
- count = 0;
- for (i = 0; i < pixelCount; i++)
- *p = get8(s), p += 4;
- }
- }
- }
-
- if (req_comp && req_comp != 4) {
- out = convert_format(out, 4, req_comp, w, h);
- if (out == NULL) return out; // convert_format frees input on failure
- }
-
- if (comp) *comp = channelCount;
- *y = h;
- *x = w;
-
- return out;
-}
-
-#ifndef STBI_NO_STDIO
-stbi_uc *stbi_psd_load(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- stbi_uc *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_psd_load_from_file(f, x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-
-stbi_uc *stbi_psd_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_file(&s, f);
- return psd_load(&s, x,y,comp,req_comp);
-}
-#endif
-
-stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return psd_load(&s, x,y,comp,req_comp);
-}
-
-
-// *************************************************************************************************
-// Radiance RGBE HDR loader
-// originally by Nicolas Schulz
-#ifndef STBI_NO_HDR
-static int hdr_test(stbi *s)
-{
- char *signature = "#?RADIANCE\n";
- int i;
- for (i=0; signature[i]; ++i)
- if (get8(s) != signature[i])
- return 0;
- return 1;
-}
-
-int stbi_hdr_test_memory(stbi_uc const *buffer, int len)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return hdr_test(&s);
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_hdr_test_file(FILE *f)
-{
- stbi s;
- int r,n = ftell(f);
- start_file(&s, f);
- r = hdr_test(&s);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-#define HDR_BUFLEN 1024
-static char *hdr_gettoken(stbi *z, char *buffer)
-{
- int len=0;
- char *s = buffer, c = '\0';
- s;
-
- c = get8(z);
-
- while (!at_eof(z) && c != '\n') {
- buffer[len++] = c;
- if (len == HDR_BUFLEN-1) {
- // flush to end of line
- while (!at_eof(z) && get8(z) != '\n')
- ;
- break;
- }
- c = get8(z);
- }
-
- buffer[len] = 0;
- return buffer;
-}
-
-static void hdr_convert(float *output, stbi_uc *input, int req_comp)
-{
- if( input[3] != 0 ) {
- float f1;
- // Exponent
- f1 = (float) ldexp(1.0f, input[3] - (int)(128 + 8));
- if (req_comp <= 2)
- output[0] = (input[0] + input[1] + input[2]) * f1 / 3;
- else {
- output[0] = input[0] * f1;
- output[1] = input[1] * f1;
- output[2] = input[2] * f1;
- }
- if (req_comp == 2) output[1] = 1;
- if (req_comp == 4) output[3] = 1;
- } else {
- switch (req_comp) {
- case 4: output[3] = 1; /* fallthrough */
- case 3: output[0] = output[1] = output[2] = 0;
- break;
- case 2: output[1] = 1; /* fallthrough */
- case 1: output[0] = 0;
- break;
- }
- }
-}
-
-
-static float *hdr_load(stbi *s, int *x, int *y, int *comp, int req_comp)
-{
- char buffer[HDR_BUFLEN];
- char *token;
- int valid = 0;
- int width, height;
- stbi_uc *scanline;
- float *hdr_data;
- int len;
- unsigned char count, value;
- int i, j, k, c1,c2, z;
-
-
- // Check identifier
- if (strcmp(hdr_gettoken(s,buffer), "#?RADIANCE") != 0)
- return epf("not HDR", "Corrupt HDR image");
-
- // Parse header
- while(1) {
- token = hdr_gettoken(s,buffer);
- if (token[0] == 0) break;
- if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1;
- }
-
- if (!valid) return epf("unsupported format", "Unsupported HDR format");
-
- // Parse width and height
- // can't use sscanf() if we're not using stdio!
- token = hdr_gettoken(s,buffer);
- if (strncmp(token, "-Y ", 3)) return epf("unsupported data layout", "Unsupported HDR format");
- token += 3;
- height = strtol(token, &token, 10);
- while (*token == ' ') ++token;
- if (strncmp(token, "+X ", 3)) return epf("unsupported data layout", "Unsupported HDR format");
- token += 3;
- width = strtol(token, NULL, 10);
-
- *x = width;
- *y = height;
-
- *comp = 3;
- if (req_comp == 0) req_comp = 3;
-
- // Read data
- hdr_data = (float *) stb_malloc(height * width * req_comp * sizeof(float));
-
- // Load image data
- // image data is stored as some number of sca
- if( width < 8 || width >= 32768) {
- // Read flat data
- for (j=0; j < height; ++j) {
- for (i=0; i < width; ++i) {
- stbi_uc rgbe[4];
- main_decode_loop:
- getn(s, rgbe, 4);
- hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp);
- }
- }
- } else {
- // Read RLE-encoded data
- scanline = NULL;
-
- for (j = 0; j < height; ++j) {
- c1 = get8(s);
- c2 = get8(s);
- len = get8(s);
- if (c1 != 2 || c2 != 2 || (len & 0x80)) {
- // not run-length encoded, so we have to actually use THIS data as a decoded
- // pixel (note this can't be a valid pixel--one of RGB must be >= 128)
- stbi_uc rgbe[4] = { c1,c2,len, get8(s) };
- hdr_convert(hdr_data, rgbe, req_comp);
- i = 1;
- j = 0;
- stb_free(scanline);
- goto main_decode_loop; // yes, this is fucking insane; blame the fucking insane format
- }
- len <<= 8;
- len |= get8(s);
- if (len != width) { stb_free(hdr_data); stb_free(scanline); return epf("invalid decoded scanline length", "corrupt HDR"); }
- if (scanline == NULL) scanline = (stbi_uc *) stb_malloc(width * 4);
-
- for (k = 0; k < 4; ++k) {
- i = 0;
- while (i < width) {
- count = get8(s);
- if (count > 128) {
- // Run
- value = get8(s);
- count -= 128;
- for (z = 0; z < count; ++z)
- scanline[i++ * 4 + k] = value;
- } else {
- // Dump
- for (z = 0; z < count; ++z)
- scanline[i++ * 4 + k] = get8(s);
- }
- }
- }
- for (i=0; i < width; ++i)
- hdr_convert(hdr_data+(j*width + i)*req_comp, scanline + i*4, req_comp);
- }
- stb_free(scanline);
- }
-
- return hdr_data;
-}
-
-#ifndef STBI_NO_STDIO
-float *stbi_hdr_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_file(&s,f);
- return hdr_load(&s,x,y,comp,req_comp);
-}
-#endif
-
-float *stbi_hdr_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_mem(&s,buffer, len);
- return hdr_load(&s,x,y,comp,req_comp);
-}
-
-#endif // STBI_NO_HDR
-
-/////////////////////// write image ///////////////////////
-
-#ifndef STBI_NO_WRITE
-
-static void write8(FILE *f, int x) { uint8 z = (uint8) x; fwrite(&z,1,1,f); }
-
-static void writefv(FILE *f, char *fmt, va_list v)
-{
- while (*fmt) {
- switch (*fmt++) {
- case ' ': break;
- case '1': { uint8 x = va_arg(v, int); write8(f,x); break; }
- case '2': { int16 x = va_arg(v, int); write8(f,x); write8(f,x>>8); break; }
- case '4': { int32 x = va_arg(v, int); write8(f,x); write8(f,x>>8); write8(f,x>>16); write8(f,x>>24); break; }
- default:
- assert(0);
- va_end(v);
- return;
- }
- }
-}
-
-static void writef(FILE *f, char *fmt, ...)
-{
- va_list v;
- va_start(v, fmt);
- writefv(f,fmt,v);
- va_end(v);
-}
-
-static void write_pixels(FILE *f, int rgb_dir, int vdir, int x, int y, int comp, const void *data, int write_alpha, int scanline_pad)
-{
- uint8 bg[3] = { 255, 0, 255}, px[3];
- uint32 zero = 0;
- int i,j,k, j_end;
-
- if (vdir < 0)
- j_end = -1, j = y-1;
- else
- j_end = y, j = 0;
-
- for (; j != j_end; j += vdir) {
- for (i=0; i < x; ++i) {
- uint8 *d = (uint8 *) data + (j*x+i)*comp;
- if (write_alpha < 0)
- fwrite(&d[comp-1], 1, 1, f);
- switch (comp) {
- case 1:
- case 2: writef(f, "111", d[0],d[0],d[0]);
- break;
- case 4:
- if (!write_alpha) {
- for (k=0; k < 3; ++k)
- px[k] = bg[k] + ((d[k] - bg[k]) * d[3])/255;
- writef(f, "111", px[1-rgb_dir],px[1],px[1+rgb_dir]);
- break;
- }
- /* FALLTHROUGH */
- case 3:
- writef(f, "111", d[1-rgb_dir],d[1],d[1+rgb_dir]);
- break;
- }
- if (write_alpha > 0)
- fwrite(&d[comp-1], 1, 1, f);
- }
- fwrite(&zero,scanline_pad,1,f);
- }
-}
-
-static int outfile(char const *filename, int rgb_dir, int vdir, int x, int y, int comp, const void *data, int alpha, int pad, char *fmt, ...)
-{
- FILE *f = fopen(filename, "wb");
- if (f) {
- va_list v;
- va_start(v, fmt);
- writefv(f, fmt, v);
- va_end(v);
- write_pixels(f,rgb_dir,vdir,x,y,comp,data,alpha,pad);
- fclose(f);
- }
- return f != NULL;
-}
-
-static int outfile_w(wchar_t const *filename, int rgb_dir, int vdir, int x, int y, int comp, const void *data, int alpha, int pad, char *fmt, ...)
-{
- FILE *f = _wfopen(filename, L"wb");
- if (f) {
- va_list v;
- va_start(v, fmt);
- writefv(f, fmt, v);
- va_end(v);
- write_pixels(f,rgb_dir,vdir,x,y,comp,data,alpha,pad);
- fclose(f);
- }
- return f != NULL;
-}
-
-int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data)
-{
- int pad = (-x*3) & 3;
- return outfile(filename,-1,-1,x,y,comp,data,0,pad,
- "11 4 22 4" "4 44 22 444444",
- 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
- 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
-}
-
-int stbi_write_bmp_w(wchar_t const *filename, int x, int y, int comp, const void *data)
-{
- int pad = (-x*3) & 3;
- return outfile_w(filename,-1,-1,x,y,comp,data,0,pad,
- "11 4 22 4" "4 44 22 444444",
- 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
- 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
-}
-
-int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)
-{
- int has_alpha = !(comp & 1);
- return outfile(filename, -1,-1, x, y, comp, data, has_alpha, 0,
- "111 221 2222 11", 0,0,2, 0,0,0, 0,0,x,y, 24+8*has_alpha, 8*has_alpha);
-}
-
-int stbi_write_tga_w(wchar_t const *filename, int x, int y, int comp, const void *data)
-{
- int has_alpha = !(comp & 1);
- return outfile_w(filename, -1,-1, x, y, comp, data, has_alpha, 0,
- "111 221 2222 11", 0,0,2, 0,0,0, 0,0,x,y, 24+8*has_alpha, 8*has_alpha);
-}
-
-// any other image formats that do interleaved rgb data?
-// PNG: requires adler32,crc32 -- significant amount of code
-// PSD: no, channels output separately
-// TIFF: no, stripwise-interleaved... i think
-
-#endif // STBI_NO_WRITE
-
-#endif // STBI_HEADER_FILE_ONLY
-
diff --git a/Libraries/crunch-ea9b8d/example2/example2.2008.vcproj b/Libraries/crunch-ea9b8d/example2/example2.2008.vcproj
deleted file mode 100644
index 0bf1beb9..00000000
--- a/Libraries/crunch-ea9b8d/example2/example2.2008.vcproj
+++ /dev/null
@@ -1,712 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="example2"
- ProjectGUID="{AF745B42-F996-49EB-859B-970A671DEF5E}"
- RootNamespace="comp"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="false"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)D.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="false"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)D_x64.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- FloatingPointModel="2"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)_x64.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_DLL|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="false"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)D_DLL.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_DLL|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="false"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)D_DLL_x64.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_DLL|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)_DLL.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_DLL|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- FloatingPointModel="2"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)_DLL_x64.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F2-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\example2.cpp"
- >
- </File>
- <File
- RelativePath=".\timer.cpp"
- >
- </File>
- <File
- RelativePath=".\timer.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995384-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{61DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/crunch-ea9b8d/example2/example2.cpp b/Libraries/crunch-ea9b8d/example2/example2.cpp
deleted file mode 100644
index 63c46bac..00000000
--- a/Libraries/crunch-ea9b8d/example2/example2.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-// File: example2.cpp - This example uses the crn_decomp.h stand-alone header file library
-// to transcode .CRN files directly to .DDS, with no intermediate recompression step to DXTn.
-// This tool does NOT depend on the crnlib library at all. It only needs the low-level
-// decompression/transcoding functionality defined in inc/crn_decomp.h.
-// This is the basic functionality a game engine would need to employ at runtime to utilize
-// .CRN textures (excluding writing the output DDS file - instead you would provide the DXTn
-// bits directly to OpenGL/D3D).
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <algorithm>
-
-// CRN transcoder library.
-#include "crn_decomp.h"
-// .DDS file format definitions.
-#include "dds_defs.h"
-
-// A simple high-precision, platform independent timer class.
-#include "timer.h"
-
-using namespace crnlib;
-
-static int print_usage()
-{
- printf("Description: Transcodes .CRN to .DDS files using crn_decomp.h.\n");
- printf("Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC\n");
- printf("Usage: example2 [source_file] [options]\n");
- printf("\nOptions:\n");
- printf("-out filename - Force output filename.\n");
- return EXIT_FAILURE;
-}
-
-static int error(const char* pMsg, ...)
-{
- va_list args;
- va_start(args, pMsg);
- char buf[512];
- vsprintf_s(buf, sizeof(buf), pMsg, args);
- va_end(args);
- printf("%s", buf);
- return EXIT_FAILURE;
-}
-
-// Loads an entire file into an allocated memory block.
-static crn_uint8 *read_file_into_buffer(const char *pFilename, crn_uint32 &size)
-{
- size = 0;
-
- FILE* pFile = NULL;
- fopen_s(&pFile, pFilename, "rb");
- if (!pFile)
- return NULL;
-
- fseek(pFile, 0, SEEK_END);
- size = ftell(pFile);
- fseek(pFile, 0, SEEK_SET);
-
- crn_uint8 *pSrc_file_data = static_cast<crn_uint8*>(malloc(std::max(1U, size)));
- if ((!pSrc_file_data) || (fread(pSrc_file_data, size, 1, pFile) != 1))
- {
- fclose(pFile);
- free(pSrc_file_data);
- size = 0;
- return NULL;
- }
-
- fclose(pFile);
- return pSrc_file_data;
-}
-
-int main(int argc, char *argv[])
-{
- printf("example2 - Version v%u.%02u Built " __DATE__ ", " __TIME__ "\n", CRNLIB_VERSION / 100, CRNLIB_VERSION % 100);
-
- if (argc < 2)
- return print_usage();
-
- // Parse command line options
- const char *pSrc_filename = argv[1];
- char out_filename[FILENAME_MAX] = { '\0' };
-
- for (int i = 2; i < argc; i++)
- {
- if (argv[i][0] == '/')
- argv[i][0] = '-';
-
- if (!_stricmp(argv[i], "-out"))
- {
- if (++i >= argc)
- return error("Expected output filename!");
-
- strcpy_s(out_filename, sizeof(out_filename), argv[i]);
- }
- else
- return error("Invalid option: %s\n", argv[i]);
- }
-
- // Split the source filename into its various components.
- char drive_buf[_MAX_DRIVE], dir_buf[_MAX_DIR], fname_buf[_MAX_FNAME], ext_buf[_MAX_EXT];
- if (_splitpath_s(pSrc_filename, drive_buf, _MAX_DRIVE, dir_buf, _MAX_DIR, fname_buf, _MAX_FNAME, ext_buf, _MAX_EXT))
- return error("Invalid source filename!\n");
-
- // Load the source file into memory.
- printf("Loading source file: %s\n", pSrc_filename);
- crn_uint32 src_file_size;
- crn_uint8 *pSrc_file_data = read_file_into_buffer(pSrc_filename, src_file_size);
- if (!pSrc_file_data)
- return error("Unable to read source file\n");
-
- // Decompress/transcode CRN to DDS.
- // DDS files are organized in face-major order, like this:
- // Face0: Mip0, Mip1, Mip2, etc.
- // Face1: Mip0, Mip1, Mip2, etc.
- // etc.
- // While CRN files are organized in mip-major order, like this:
- // Mip0: Face0, Face1, Face2, Face3, Face4, Face5
- // Mip1: Face0, Face1, Face2, Face3, Face4, Face5
- // etc.
- printf("Transcoding CRN to DDS\n");
-
- crnd::crn_texture_info tex_info;
- if (!crnd::crnd_get_texture_info(pSrc_file_data, src_file_size, &tex_info))
- {
- free(pSrc_file_data);
- return error("crnd_get_texture_info() failed!\n");
- }
-
- timer tm;
-
- tm.start();
- crnd::crnd_unpack_context pContext = crnd::crnd_unpack_begin(pSrc_file_data, src_file_size);
- double total_unpack_begin_time = tm.get_elapsed_ms();
-
- if (!pContext)
- {
- free(pSrc_file_data);
- return error("crnd_unpack_begin() failed!\n");
- }
-
- // Now create the DDS file.
- char dst_filename[FILENAME_MAX];
- sprintf_s(dst_filename, sizeof(dst_filename), "%s%s%s.dds", drive_buf, dir_buf, fname_buf);
- if (out_filename[0]) strcpy(dst_filename, out_filename);
-
- printf("Writing DDS file: %s\n", dst_filename);
-
- FILE *pDDS_file = fopen(dst_filename, "wb");
- if (!pDDS_file)
- {
- crnd::crnd_unpack_end(pContext);
- free(pSrc_file_data);
- return error("Failed creating destination file!\n");
- }
-
- // Write the 4-byte DDS signature (not endian safe, but whatever this is a sample).
- fwrite(&crnlib::cDDSFileSignature, sizeof(crnlib::cDDSFileSignature), 1, pDDS_file);
-
- // Prepare the DDS header.
- crnlib::DDSURFACEDESC2 dds_desc;
- memset(&dds_desc, 0, sizeof(dds_desc));
- dds_desc.dwSize = sizeof(dds_desc);
- dds_desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | ((tex_info.m_levels > 1) ? DDSD_MIPMAPCOUNT : 0);
- dds_desc.dwWidth = tex_info.m_width;
- dds_desc.dwHeight = tex_info.m_height;
- dds_desc.dwMipMapCount = (tex_info.m_levels > 1) ? tex_info.m_levels : 0;
-
- dds_desc.ddpfPixelFormat.dwSize = sizeof(crnlib::DDPIXELFORMAT);
- dds_desc.ddpfPixelFormat.dwFlags = DDPF_FOURCC;
- crn_format fundamental_fmt = crnd::crnd_get_fundamental_dxt_format(tex_info.m_format);
- dds_desc.ddpfPixelFormat.dwFourCC = crnd::crnd_crn_format_to_fourcc(fundamental_fmt);
- if (fundamental_fmt != tex_info.m_format)
- {
- // It's a funky swizzled DXTn format - write its FOURCC to dwRGBBitCount.
- dds_desc.ddpfPixelFormat.dwRGBBitCount = crnd::crnd_crn_format_to_fourcc(tex_info.m_format);
- }
-
- dds_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
- if (tex_info.m_levels > 1)
- {
- dds_desc.ddsCaps.dwCaps |= (DDSCAPS_COMPLEX | DDSCAPS_MIPMAP);
- }
-
- if (tex_info.m_faces == 6)
- {
- dds_desc.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP |
- DDSCAPS2_CUBEMAP_POSITIVEX | DDSCAPS2_CUBEMAP_NEGATIVEX | DDSCAPS2_CUBEMAP_POSITIVEY |
- DDSCAPS2_CUBEMAP_NEGATIVEY | DDSCAPS2_CUBEMAP_POSITIVEZ | DDSCAPS2_CUBEMAP_NEGATIVEZ;
- }
-
- // Set pitch/linearsize field (some DDS readers require this field to be non-zero).
- int bits_per_pixel = crnd::crnd_get_crn_format_bits_per_texel(tex_info.m_format);
- dds_desc.lPitch = (((dds_desc.dwWidth + 3) & ~3) * ((dds_desc.dwHeight + 3) & ~3) * bits_per_pixel) >> 3;
- dds_desc.dwFlags |= DDSD_LINEARSIZE;
-
- // Write the DDS header to the output file.
- fwrite(&dds_desc, sizeof(dds_desc), 1, pDDS_file);
-
- // Now transcode all face and mipmap levels into memory, one mip level at a time.
- void *pImages[cCRNMaxFaces][cCRNMaxLevels];
- crn_uint32 image_size_in_bytes[cCRNMaxLevels];
- memset(pImages, 0, sizeof(pImages));
- memset(image_size_in_bytes, 0, sizeof(image_size_in_bytes));
-
- crn_uint32 total_unpacked_texels = 0;
-
- double total_unpack_time = 0.0f;
- for (crn_uint32 level_index = 0; level_index < tex_info.m_levels; level_index++)
- {
- // Compute the face's width, height, number of DXT blocks per row/col, etc.
- const crn_uint32 width = std::max(1U, tex_info.m_width >> level_index);
- const crn_uint32 height = std::max(1U, tex_info.m_height >> level_index);
- const crn_uint32 blocks_x = std::max(1U, (width + 3) >> 2);
- const crn_uint32 blocks_y = std::max(1U, (height + 3) >> 2);
- const crn_uint32 row_pitch = blocks_x * crnd::crnd_get_bytes_per_dxt_block(tex_info.m_format);
- const crn_uint32 total_face_size = row_pitch * blocks_y;
-
- image_size_in_bytes[level_index] = total_face_size;
-
- for (crn_uint32 face_index = 0; face_index < tex_info.m_faces; face_index++)
- {
- void *p = malloc(total_face_size);
- if (!p)
- {
- for (crn_uint32 f = 0; f < cCRNMaxFaces; f++)
- for (crn_uint32 l = 0; l < cCRNMaxLevels; l++)
- free(pImages[f][l]);
- crnd::crnd_unpack_end(pContext);
- free(pSrc_file_data);
- return error("Out of memory!");
- }
-
- pImages[face_index][level_index] = p;
- }
-
- // Prepare the face pointer array needed by crnd_unpack_level().
- void *pDecomp_images[cCRNMaxFaces];
- for (crn_uint32 face_index = 0; face_index < tex_info.m_faces; face_index++)
- pDecomp_images[face_index] = pImages[face_index][level_index];
-
- // Now transcode the level to raw DXTn
- tm.start();
- if (!crnd::crnd_unpack_level(pContext, pDecomp_images, total_face_size, row_pitch, level_index))
- {
- for (crn_uint32 f = 0; f < cCRNMaxFaces; f++)
- for (crn_uint32 l = 0; l < cCRNMaxLevels; l++)
- free(pImages[f][l]);
-
- crnd::crnd_unpack_end(pContext);
- free(pSrc_file_data);
-
- return error("Failed transcoding texture!");
- }
-
- total_unpack_time += tm.get_elapsed_ms();
- total_unpacked_texels += (blocks_x * blocks_y * 16);
- }
-
- printf("crnd_unpack_begin time: %3.3fms\n", total_unpack_begin_time);
- printf("Total crnd_unpack_level time: %3.3fms\n", total_unpack_time);
- double total_time = total_unpack_begin_time + total_unpack_time;
- printf("Total transcode time: %3.3fms\n", total_time);
- printf("Total texels transcoded: %u\n", total_unpacked_texels);
- printf("Overall transcode throughput: %3.3f million texels/sec\n", (total_unpacked_texels / (total_time / 1000.0f)) / 1000000.0f);
-
- // Now write the DXTn data to the DDS file in face-major order.
- for (crn_uint32 face_index = 0; face_index < tex_info.m_faces; face_index++)
- for (crn_uint32 level_index = 0; level_index < tex_info.m_levels; level_index++)
- fwrite(pImages[face_index][level_index], image_size_in_bytes[level_index], 1, pDDS_file);
-
- for (crn_uint32 f = 0; f < cCRNMaxFaces; f++)
- for (crn_uint32 l = 0; l < cCRNMaxLevels; l++)
- free(pImages[f][l]);
-
- crnd::crnd_unpack_end(pContext);
- free(pSrc_file_data);
-
- if (fclose(pDDS_file) == EOF)
- {
- return error("Failed writing to DDS file!\n");
- }
-
- return EXIT_SUCCESS;
-}
diff --git a/Libraries/crunch-ea9b8d/example2/timer.cpp b/Libraries/crunch-ea9b8d/example2/timer.cpp
deleted file mode 100644
index c3627fd9..00000000
--- a/Libraries/crunch-ea9b8d/example2/timer.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-// File: timer.cpp
-// A simple high-precision, platform independent timer class.
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include <time.h>
-
-#include "timer.h"
-
-#if defined(WIN32)
-#include <windows.h>
-#elif defined(_XBOX)
-#include <xtl.h>
-#endif
-
-unsigned long long timer::g_init_ticks;
-unsigned long long timer::g_freq;
-double timer::g_inv_freq;
-
-#if defined(WIN32) || defined(_XBOX)
-inline void query_counter(timer_ticks *pTicks)
-{
- QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(pTicks));
-}
-inline void query_counter_frequency(timer_ticks *pTicks)
-{
- QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(pTicks));
-}
-#elif defined(__GNUC__)
-#include <sys/timex.h>
-inline void query_counter(timer_ticks *pTicks)
-{
- struct timeval cur_time;
- gettimeofday(&cur_time, NULL);
- *pTicks = static_cast<unsigned long long>(cur_time.tv_sec)*1000000ULL + static_cast<unsigned long long>(cur_time.tv_usec);
-}
-inline void query_counter_frequency(timer_ticks *pTicks)
-{
- *pTicks = 1000000;
-}
-#endif
-
-timer::timer() :
- m_start_time(0),
- m_stop_time(0),
- m_started(false),
- m_stopped(false)
-{
- if (!g_inv_freq)
- init();
-}
-
-timer::timer(timer_ticks start_ticks)
-{
- if (!g_inv_freq)
- init();
-
- m_start_time = start_ticks;
-
- m_started = true;
- m_stopped = false;
-}
-
-void timer::start(timer_ticks start_ticks)
-{
- m_start_time = start_ticks;
-
- m_started = true;
- m_stopped = false;
-}
-
-void timer::start()
-{
- query_counter(&m_start_time);
-
- m_started = true;
- m_stopped = false;
-}
-
-void timer::stop()
-{
- assert(m_started);
-
- query_counter(&m_stop_time);
-
- m_stopped = true;
-}
-
-double timer::get_elapsed_secs() const
-{
- assert(m_started);
- if (!m_started)
- return 0;
-
- timer_ticks stop_time = m_stop_time;
- if (!m_stopped)
- query_counter(&stop_time);
-
- timer_ticks delta = stop_time - m_start_time;
- return delta * g_inv_freq;
-}
-
-timer_ticks timer::get_elapsed_us() const
-{
- assert(m_started);
- if (!m_started)
- return 0;
-
- timer_ticks stop_time = m_stop_time;
- if (!m_stopped)
- query_counter(&stop_time);
-
- timer_ticks delta = stop_time - m_start_time;
- return (delta * 1000000ULL + (g_freq >> 1U)) / g_freq;
-}
-
-void timer::init()
-{
- if (!g_inv_freq)
- {
- query_counter_frequency(&g_freq);
- g_inv_freq = 1.0f / g_freq;
-
- query_counter(&g_init_ticks);
- }
-}
-
-timer_ticks timer::get_init_ticks()
-{
- if (!g_inv_freq)
- init();
-
- return g_init_ticks;
-}
-
-timer_ticks timer::get_ticks()
-{
- if (!g_inv_freq)
- init();
-
- timer_ticks ticks;
- query_counter(&ticks);
- return ticks - g_init_ticks;
-}
-
-double timer::ticks_to_secs(timer_ticks ticks)
-{
- if (!g_inv_freq)
- init();
-
- return ticks * g_inv_freq;
-}
-
diff --git a/Libraries/crunch-ea9b8d/example2/timer.h b/Libraries/crunch-ea9b8d/example2/timer.h
deleted file mode 100644
index 6fa3300e..00000000
--- a/Libraries/crunch-ea9b8d/example2/timer.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// File: timer.h
-// A simple high-precision, platform independent timer class.
-#pragma once
-
-typedef unsigned long long timer_ticks;
-
-class timer
-{
-public:
- timer();
- timer(timer_ticks start_ticks);
-
- void start();
- void start(timer_ticks start_ticks);
-
- void stop();
-
- double get_elapsed_secs() const;
- inline double get_elapsed_ms() const { return get_elapsed_secs() * 1000.0f; }
- timer_ticks get_elapsed_us() const;
-
- static void init();
- static inline timer_ticks get_ticks_per_sec() { return g_freq; }
- static timer_ticks get_init_ticks();
- static timer_ticks get_ticks();
- static double ticks_to_secs(timer_ticks ticks);
- static inline double ticks_to_ms(timer_ticks ticks) { return ticks_to_secs(ticks) * 1000.0f; }
- static inline double get_secs() { return ticks_to_secs(get_ticks()); }
- static inline double get_ms() { return ticks_to_ms(get_ticks()); }
-
-private:
- static timer_ticks g_init_ticks;
- static timer_ticks g_freq;
- static double g_inv_freq;
-
- timer_ticks m_start_time;
- timer_ticks m_stop_time;
-
- bool m_started : 1;
- bool m_stopped : 1;
-};
diff --git a/Libraries/crunch-ea9b8d/example3/example3.2008.vcproj b/Libraries/crunch-ea9b8d/example3/example3.2008.vcproj
deleted file mode 100644
index e74ffc50..00000000
--- a/Libraries/crunch-ea9b8d/example3/example3.2008.vcproj
+++ /dev/null
@@ -1,716 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="example3"
- ProjectGUID="{AF745B42-E296-46EB-859B-970A671DEF5E}"
- RootNamespace="comp"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="false"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlibD_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)D.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="false"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlibD_x64_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)D_x64.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlib_VC9.lib&quot;"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- FloatingPointModel="2"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlib_x64_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)_x64.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_DLL|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="false"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlibD_DLL_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)D_DLL.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_DLL|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="false"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlibD_DLL_x64_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)D_DLL_x64.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_DLL|Win32"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlib_DLL_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)_DLL.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_DLL|x64"
- OutputDirectory="..\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\inc"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- FloatingPointModel="2"
- RuntimeTypeInfo="false"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="&quot;$(SolutionDir)lib\VC9\$(ConfigurationName)\$(PlatformName)\crnlib_DLL_x64_VC9.lib&quot;"
- OutputFile="$(OutDir)\$(ProjectName)_DLL_x64.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F2-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\example3.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995384-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\stb_image.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{61DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/crunch-ea9b8d/example3/example3.cpp b/Libraries/crunch-ea9b8d/example3/example3.cpp
deleted file mode 100644
index 0732feb1..00000000
--- a/Libraries/crunch-ea9b8d/example3/example3.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-// File: example3.cpp - Demonstrates how to use crnlib's simple block compression
-// API's to manually pack images to DXTn compressed .DDS files. This example isn't multithreaded
-// so it's not going to be fast.
-// Also note that this sample only demonstrates traditional/vanilla 4x4 DXTn block compression (not CRN).
-
-// See Copyright Notice and license at the end of inc/crnlib.h
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <minmax.h>
-
-// CRN transcoder library.
-#include "crnlib.h"
-// .DDS file format definitions.
-#include "dds_defs.h"
-
-// stb_image, for loading/saving image files.
-#ifdef _MSC_VER
-#pragma warning (disable: 4244) // conversion from 'int' to 'uint8', possible loss of data
-#pragma warning (disable: 4100) // unreferenced formal parameter
-#pragma warning (disable: 4127) // conditional expression is constant
-#endif
-#include "stb_image.h"
-
-using namespace crnlib;
-
-const uint cDXTBlockSize = 4;
-
-static int print_usage()
-{
- printf("Description: Simple .DDS DXTn block compression using crnlib.\n");
- printf("Copyright (c) 2010-2016 Binomial LLC\n");
- printf("Usage: example3 [source_file] [options]\n");
- printf("\n");
- printf("Note: This simple example is not multithreaded, so it's not going to be\n");
- printf("particularly fast.\n");
- printf("\n");
- printf("Supported source image formats:\n");
- printf("Baseline JPEG, PNG, BMP, TGA, PSD, and HDR\n");
- printf("\nOptions:\n");
- printf("-out filename - Force output filename (always use .DDS extension).\n");
- printf("-nonsrgb - Input is not sRGB: disables gamma filtering, perceptual metrics.\n");
- printf("-pixelformat X - Output DXTn format. Supported formats:\n");
- printf("DXT1, DXT3, DXT5, DXN_XY (ATI 3DC), DXN_YX (ATI 3DC), DXT5A (ATN1N)\n");
- printf("If no output pixel format is specified, this example uses either DXT1 or DXT5.\n");
- printf("-dxtquality X - DXTn quality: superfast, fast, normal, better, uber (default)\n");
- printf("-setalphatoluma - Set alpha channel to luma before compression.\n");
- printf("-converttoluma - Set RGB to luma before compression.\n");
- return EXIT_FAILURE;
-}
-
-static int error(const char* pMsg, ...)
-{
- va_list args;
- va_start(args, pMsg);
- char buf[512];
- vsprintf_s(buf, sizeof(buf), pMsg, args);
- va_end(args);
- printf("%s", buf);
- return EXIT_FAILURE;
-}
-
-int main(int argc, char *argv[])
-{
- printf("example3 - Version v%u.%02u Built " __DATE__ ", " __TIME__ "\n", CRNLIB_VERSION / 100, CRNLIB_VERSION % 100);
-
- if (argc < 2)
- return print_usage();
-
- // Parse command line options
- const char *pSrc_filename = argv[1];
- char out_filename[FILENAME_MAX] = { '\0' };
- crn_format fmt = cCRNFmtInvalid;
- bool srgb_colorspace = true;
- crn_dxt_quality dxt_quality = cCRNDXTQualityUber; // best quality, but slowest
- bool set_alpha_to_luma = false;
- bool convert_to_luma = false;
-
- for (int i = 2; i < argc; i++)
- {
- if (argv[i][0] == '/')
- argv[i][0] = '-';
-
- if (!_stricmp(argv[i], "-out"))
- {
- if (++i >= argc)
- return error("Expected output filename!");
-
- strcpy_s(out_filename, sizeof(out_filename), argv[i]);
- }
- else if (!_stricmp(argv[i], "-nonsrgb"))
- srgb_colorspace = false;
- else if (!_stricmp(argv[i], "-pixelformat"))
- {
- if (++i >= argc)
- return error("Expected pixel format!");
-
- uint f;
- for (f = 0; f < cCRNFmtTotal; f++)
- {
- crn_format actual_fmt = crn_get_fundamental_dxt_format(static_cast<crn_format>(f));
- if (!_stricmp(argv[i], crn_get_format_string(actual_fmt)))
- {
- fmt = actual_fmt;
- break;
- }
- }
- if (f == cCRNFmtTotal)
- return error("Unrecognized pixel format: %s\n", argv[i]);
- }
- else if (!_stricmp(argv[i], "-dxtquality"))
- {
- if (++i >= argc)
- return error("Expected DXTn quality!\n");
-
- uint q;
- for (q = 0; q < cCRNDXTQualityTotal; q++)
- {
- if (!_stricmp(argv[i], crn_get_dxt_quality_string(static_cast<crn_dxt_quality>(q))))
- {
- dxt_quality = static_cast<crn_dxt_quality>(q);
- break;
- }
- }
- if (q == cCRNDXTQualityTotal)
- return error("Unrecognized DXTn quality: %s\n", argv[i]);
- }
- else if (!_stricmp(argv[i], "-setalphatoluma"))
- set_alpha_to_luma = true;
- else if (!_stricmp(argv[i], "-converttoluma"))
- convert_to_luma = true;
- else
- return error("Invalid option: %s\n", argv[i]);
- }
-
- // Split the source filename into its various components.
- char drive_buf[_MAX_DRIVE], dir_buf[_MAX_DIR], fname_buf[_MAX_FNAME], ext_buf[_MAX_EXT];
- if (_splitpath_s(pSrc_filename, drive_buf, _MAX_DRIVE, dir_buf, _MAX_DIR, fname_buf, _MAX_FNAME, ext_buf, _MAX_EXT))
- return error("Invalid source filename!\n");
-
- // Load the source image into memory.
- printf("Loading source file: %s\n", pSrc_filename);
- int width, height, actual_comps;
- crn_uint32 *pSrc_image = (crn_uint32*)stbi_load(pSrc_filename, &width, &height, &actual_comps, 4);
- if (!pSrc_image)
- return error("Unable to read source file\n");
-
- if (fmt == cCRNFmtInvalid)
- {
- // Format not specified - automatically choose the DXTn format.
- fmt = (actual_comps > 3) ? cCRNFmtDXT5 : cCRNFmtDXT1;
- }
-
- if ((fmt == cCRNFmtDXT5A) && (actual_comps <= 3))
- set_alpha_to_luma = true;
-
- if ((set_alpha_to_luma) || (convert_to_luma))
- {
- for (int i = 0; i < width * height; i++)
- {
- crn_uint32 r = pSrc_image[i] & 0xFF, g = (pSrc_image[i] >> 8) & 0xFF, b = (pSrc_image[i] >> 16) & 0xFF;
- // Compute CCIR 601 luma.
- crn_uint32 y = (19595U * r + 38470U * g + 7471U * b + 32768) >> 16U;
- crn_uint32 a = (pSrc_image[i] >> 24) & 0xFF;
- if (set_alpha_to_luma) a = y;
- if (convert_to_luma) { r = y; g = y; b = y; }
- pSrc_image[i] = r | (g << 8) | (b << 16) | (a << 24);
- }
- }
-
- printf("Source Dimensions: %ux%u, Actual Components: %u\n", width, height, actual_comps);
-
- const uint num_blocks_x = (width + cDXTBlockSize - 1) / cDXTBlockSize;
- const uint num_blocks_y = (height + cDXTBlockSize - 1) / cDXTBlockSize;
- const uint bytes_per_block = crn_get_bytes_per_dxt_block(fmt);
- const uint total_compressed_size = num_blocks_x * num_blocks_y * bytes_per_block;
-
- printf("Block Dimensions: %ux%u, BytesPerBlock: %u, Total Compressed Size: %u\n", num_blocks_x, num_blocks_y, bytes_per_block, total_compressed_size);
-
- void *pCompressed_data = malloc(total_compressed_size);
- if (!pCompressed_data)
- {
- stbi_image_free(pSrc_image);
- return error("Out of memory!");
- }
-
- crn_comp_params comp_params;
- comp_params.m_format = fmt;
- comp_params.m_dxt_quality = dxt_quality;
- comp_params.set_flag(cCRNCompFlagPerceptual, srgb_colorspace);
- comp_params.set_flag(cCRNCompFlagDXT1AForTransparency, actual_comps > 3);
-
- crn_block_compressor_context_t pContext = crn_create_block_compressor(comp_params);
-
- printf("Compressing to %s: ", crn_get_format_string(fmt));
-
- int prev_percentage_complete = -1;
- for (crn_uint32 block_y = 0; block_y < num_blocks_y; block_y++)
- {
- for (crn_uint32 block_x = 0; block_x < num_blocks_x; block_x++)
- {
- crn_uint32 pixels[cDXTBlockSize * cDXTBlockSize];
-
- // Exact block from image, clamping at the sides of non-divisible by 4 images to avoid artifacts.
- crn_uint32 *pDst_pixels = pixels;
- for (int y = 0; y < cDXTBlockSize; y++)
- {
- const uint actual_y = min(height - 1U, (block_y * cDXTBlockSize) + y);
- for (int x = 0; x < cDXTBlockSize; x++)
- {
- const uint actual_x = min(width - 1U, (block_x * cDXTBlockSize) + x);
- *pDst_pixels++ = pSrc_image[actual_x + actual_y * width];
- }
- }
-
- // Compress the DXTn block.
- crn_compress_block(pContext, pixels, static_cast<crn_uint8 *>(pCompressed_data) + (block_x + block_y * num_blocks_x) * bytes_per_block);
- }
-
- int percentage_complete = ((block_y + 1) * 100 + (num_blocks_y / 2)) / num_blocks_y;
- if (percentage_complete != prev_percentage_complete)
- {
- printf("\b\b\b\b%3u%%", percentage_complete);
- prev_percentage_complete = percentage_complete;
- }
- }
- printf("\n");
-
- // Free the block compressor.
- crn_free_block_compressor(pContext);
- pContext = NULL;
-
- // Now create the DDS file.
- char dst_filename[FILENAME_MAX];
- sprintf_s(dst_filename, sizeof(dst_filename), "%s%s%s.dds", drive_buf, dir_buf, fname_buf);
- if (out_filename[0]) strcpy(dst_filename, out_filename);
-
- printf("Writing DDS file: %s\n", dst_filename);
-
- FILE *pDDS_file = fopen(dst_filename, "wb");
- if (!pDDS_file)
- {
- free(pCompressed_data);
- return error("Failed creating destination file!\n");
- }
-
- // Write the 4-byte DDS signature (not endian safe, but whatever this is a sample).
- fwrite(&crnlib::cDDSFileSignature, sizeof(crnlib::cDDSFileSignature), 1, pDDS_file);
-
- // Prepare the DDS header.
- crnlib::DDSURFACEDESC2 dds_desc;
- memset(&dds_desc, 0, sizeof(dds_desc));
- dds_desc.dwSize = sizeof(dds_desc);
- dds_desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
- dds_desc.dwWidth = width;
- dds_desc.dwHeight = height;
-
- dds_desc.ddpfPixelFormat.dwSize = sizeof(crnlib::DDPIXELFORMAT);
- dds_desc.ddpfPixelFormat.dwFlags = DDPF_FOURCC;
- dds_desc.ddpfPixelFormat.dwFourCC = crn_get_format_fourcc(fmt);
- dds_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
-
- // Set pitch/linearsize field (some DDS readers require this field to be non-zero).
- uint bits_per_pixel = crn_get_format_bits_per_texel(fmt);
- dds_desc.lPitch = (((dds_desc.dwWidth + 3) & ~3) * ((dds_desc.dwHeight + 3) & ~3) * bits_per_pixel) >> 3;
- dds_desc.dwFlags |= DDSD_LINEARSIZE;
-
- // Write the DDS header to the output file.
- fwrite(&dds_desc, sizeof(dds_desc), 1, pDDS_file);
-
- // Write the image's compressed data to the output file.
- fwrite(pCompressed_data, total_compressed_size, 1, pDDS_file);
- free(pCompressed_data);
-
- stbi_image_free(pSrc_image);
-
- if (fclose(pDDS_file) == EOF)
- {
- return error("Failed writing to DDS file!\n");
- }
-
- return EXIT_SUCCESS;
-}
diff --git a/Libraries/crunch-ea9b8d/example3/stb_image.h b/Libraries/crunch-ea9b8d/example3/stb_image.h
deleted file mode 100644
index 6da2b729..00000000
--- a/Libraries/crunch-ea9b8d/example3/stb_image.h
+++ /dev/null
@@ -1,3942 +0,0 @@
-/* stbi-1.18 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c
- when you control the images you're loading
-
- QUICK NOTES:
- Primarily of interest to game developers and other people who can
- avoid problematic images and only need the trivial interface
-
- JPEG baseline (no JPEG progressive, no oddball channel decimations)
- PNG 8-bit only
- BMP non-1bpp, non-RLE
- TGA (not sure what subset, if a subset)
- PSD (composited view only, no extra channels)
- HDR (radiance rgbE format)
- writes BMP,TGA (define STBI_NO_WRITE to remove code)
- decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code)
- supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD)
-
- TODO:
- stbi_info_*
-
- history:
- 1.18 fix a threading bug (local mutable static)
- 1.17 support interlaced PNG
- 1.16 major bugfix - convert_format converted one too many pixels
- 1.15 initialize some fields for thread safety
- 1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including)
- 1.13 threadsafe
- 1.12 const qualifiers in the API
- 1.11 Support installable IDCT, colorspace conversion routines
- 1.10 Fixes for 64-bit (don't use "unsigned long")
- optimized upsampling by Fabian "ryg" Giesen
- 1.09 Fix format-conversion for PSD code (bad global variables!)
- 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz
- 1.07 attempt to fix C++ warning/errors again
- 1.06 attempt to fix C++ warning/errors again
- 1.05 fix TGA loading to return correct *comp and use good luminance calc
- 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free
- 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR
- 1.02 support for (subset of) HDR files, float interface for preferred access to them
- 1.01 fix bug: possible bug in handling right-side up bmps... not sure
- fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all
- 1.00 interface to zlib that skips zlib header
- 0.99 correct handling of alpha in palette
- 0.98 TGA loader by lonesock; dynamically add loaders (untested)
- 0.97 jpeg errors on too large a file; also catch another stb_malloc failure
- 0.96 fix detection of invalid v value - particleman@mollyrocket forum
- 0.95 during header scan, seek to markers in case of padding
- 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same
- 0.93 handle jpegtran output; verbose errors
- 0.92 read 4,8,16,24,32-bit BMP files of several formats
- 0.91 output 24-bit Windows 3.0 BMP files
- 0.90 fix a few more warnings; bump version number to approach 1.0
- 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd
- 0.60 fix compiling as c++
- 0.59 fix warnings: merge Dave Moore's -Wall fixes
- 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian
- 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less
- than 16 available
- 0.56 fix bug: zlib uncompressed mode len vs. nlen
- 0.55 fix bug: restart_interval not initialized to 0
- 0.54 allow NULL for 'int *comp'
- 0.53 fix bug in png 3->4; speedup png decoding
- 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments
- 0.51 obey req_comp requests, 1-component jpegs return as 1-component,
- on 'test' only check type, not whether we support this variant
-*/
-
-#pragma warning (disable: 4793) // function compiled as native
-
-#ifndef STBI_INCLUDE_STB_IMAGE_H
-#define STBI_INCLUDE_STB_IMAGE_H
-
-//// begin header file ////////////////////////////////////////////////////
-//
-// Limitations:
-// - no progressive/interlaced support (jpeg, png)
-// - 8-bit samples only (jpeg, png)
-// - not threadsafe
-// - channel subsampling of at most 2 in each dimension (jpeg)
-// - no delayed line count (jpeg) -- IJG doesn't support either
-//
-// Basic usage (see HDR discussion below):
-// int x,y,n;
-// unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
-// // ... process data if not NULL ...
-// // ... x = width, y = height, n = # 8-bit components per pixel ...
-// // ... replace '0' with '1'..'4' to force that many components per pixel
-// stbi_image_free(data)
-//
-// Standard parameters:
-// int *x -- outputs image width in pixels
-// int *y -- outputs image height in pixels
-// int *comp -- outputs # of image components in image file
-// int req_comp -- if non-zero, # of image components requested in result
-//
-// The return value from an image loader is an 'unsigned char *' which points
-// to the pixel data. The pixel data consists of *y scanlines of *x pixels,
-// with each pixel consisting of N interleaved 8-bit components; the first
-// pixel pointed to is top-left-most in the image. There is no padding between
-// image scanlines or between pixels, regardless of format. The number of
-// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise.
-// If req_comp is non-zero, *comp has the number of components that _would_
-// have been output otherwise. E.g. if you set req_comp to 4, you will always
-// get RGBA output, but you can check *comp to easily see if it's opaque.
-//
-// An output image with N components has the following components interleaved
-// in this order in each pixel:
-//
-// N=#comp components
-// 1 grey
-// 2 grey, alpha
-// 3 red, green, blue
-// 4 red, green, blue, alpha
-//
-// If image loading fails for any reason, the return value will be NULL,
-// and *x, *y, *comp will be unchanged. The function stbi_failure_reason()
-// can be queried for an extremely brief, end-user unfriendly explanation
-// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid
-// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly
-// more user-friendly ones.
-//
-// Paletted PNG and BMP images are automatically depalettized.
-//
-//
-// ===========================================================================
-//
-// HDR image support (disable by defining STBI_NO_HDR)
-//
-// stb_image now supports loading HDR images in general, and currently
-// the Radiance .HDR file format, although the support is provided
-// generically. You can still load any file through the existing interface;
-// if you attempt to load an HDR file, it will be automatically remapped to
-// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;
-// both of these constants can be reconfigured through this interface:
-//
-// stbi_hdr_to_ldr_gamma(2.2f);
-// stbi_hdr_to_ldr_scale(1.0f);
-//
-// (note, do not use _inverse_ constants; stbi_image will invert them
-// appropriately).
-//
-// Additionally, there is a new, parallel interface for loading files as
-// (linear) floats to preserve the full dynamic range:
-//
-// float *data = stbi_loadf(filename, &x, &y, &n, 0);
-//
-// If you load LDR images through this interface, those images will
-// be promoted to floating point values, run through the inverse of
-// constants corresponding to the above:
-//
-// stbi_ldr_to_hdr_scale(1.0f);
-// stbi_ldr_to_hdr_gamma(2.2f);
-//
-// Finally, given a filename (or an open file or memory block--see header
-// file for details) containing image data, you can query for the "most
-// appropriate" interface to use (that is, whether the image is HDR or
-// not), using:
-//
-// stbi_is_hdr(char *filename);
-
-//#define _CRT_SECURE_NO_WARNINGS
-
-#ifndef STBI_NO_STDIO
-#include <stdio.h>
-#endif
-
-#define STBI_VERSION 1
-
-enum
-{
- STBI_default = 0, // only used for req_comp
-
- STBI_grey = 1,
- STBI_grey_alpha = 2,
- STBI_rgb = 3,
- STBI_rgb_alpha = 4,
-};
-
-typedef unsigned char stbi_uc;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// WRITING API
-
-#if !defined(STBI_NO_WRITE) && !defined(STBI_NO_STDIO)
-// write a BMP/TGA file given tightly packed 'comp' channels (no padding, nor bmp-stride-padding)
-// (you must include the appropriate extension in the filename).
-// returns TRUE on success, FALSE if couldn't open file, error writing file
-extern int stbi_write_bmp (char const *filename, int x, int y, int comp, const void *data);
-extern int stbi_write_bmp_w (wchar_t const *filename, int x, int y, int comp, const void *data);
-extern int stbi_write_tga (char const *filename, int x, int y, int comp, const void *data);
-extern int stbi_write_tga_w (wchar_t const *filename, int x, int y, int comp, const void *data);
-#endif
-
-// PRIMARY API - works on images of any type
-
-// load image by filename, open file, or memory buffer
-#ifndef STBI_NO_STDIO
-extern stbi_uc *stbi_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_load_w (wchar_t const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-extern stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-// for stbi_load_from_file, file pointer is left pointing immediately after image
-
-#ifndef STBI_NO_HDR
-#ifndef STBI_NO_STDIO
-extern float *stbi_loadf (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-extern float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-
-extern void stbi_hdr_to_ldr_gamma(float gamma);
-extern void stbi_hdr_to_ldr_scale(float scale);
-
-extern void stbi_ldr_to_hdr_gamma(float gamma);
-extern void stbi_ldr_to_hdr_scale(float scale);
-
-#endif // STBI_NO_HDR
-
-// get a VERY brief reason for failure
-// NOT THREADSAFE
-extern char *stbi_failure_reason (void);
-
-// free the loaded image -- this is just stb_free()
-extern void stbi_image_free (void *retval_from_stbi_load);
-
-// get image dimensions & components without fully decoding
-extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-extern int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);
-#ifndef STBI_NO_STDIO
-extern int stbi_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_is_hdr (char const *filename);
-extern int stbi_is_hdr_from_file(FILE *f);
-#endif
-
-// ZLIB client - used by PNG, available for other purposes
-
-extern char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen);
-extern char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);
-extern int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
-
-extern char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);
-extern int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
-
-// TYPE-SPECIFIC ACCESS
-
-// is it a jpeg?
-extern int stbi_jpeg_test_memory (stbi_uc const *buffer, int len);
-extern stbi_uc *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-extern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-#ifndef STBI_NO_STDIO
-extern stbi_uc *stbi_jpeg_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern int stbi_jpeg_test_file (FILE *f);
-extern stbi_uc *stbi_jpeg_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-
-extern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-
-// is it a png?
-extern int stbi_png_test_memory (stbi_uc const *buffer, int len);
-extern stbi_uc *stbi_png_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-extern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-#ifndef STBI_NO_STDIO
-extern stbi_uc *stbi_png_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern int stbi_png_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_png_test_file (FILE *f);
-extern stbi_uc *stbi_png_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-
-// is it a bmp?
-extern int stbi_bmp_test_memory (stbi_uc const *buffer, int len);
-
-extern stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-#ifndef STBI_NO_STDIO
-extern int stbi_bmp_test_file (FILE *f);
-extern stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-
-// is it a tga?
-extern int stbi_tga_test_memory (stbi_uc const *buffer, int len);
-
-extern stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-#ifndef STBI_NO_STDIO
-extern int stbi_tga_test_file (FILE *f);
-extern stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-
-// is it a psd?
-extern int stbi_psd_test_memory (stbi_uc const *buffer, int len);
-
-extern stbi_uc *stbi_psd_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-#ifndef STBI_NO_STDIO
-extern int stbi_psd_test_file (FILE *f);
-extern stbi_uc *stbi_psd_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-
-// is it an hdr?
-extern int stbi_hdr_test_memory (stbi_uc const *buffer, int len);
-
-extern float * stbi_hdr_load (char const *filename, int *x, int *y, int *comp, int req_comp);
-extern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
-#ifndef STBI_NO_STDIO
-extern int stbi_hdr_test_file (FILE *f);
-extern float * stbi_hdr_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
-#endif
-
-// define new loaders
-typedef struct
-{
- int (*test_memory)(stbi_uc const *buffer, int len);
- stbi_uc * (*load_from_memory)(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
- #ifndef STBI_NO_STDIO
- int (*test_file)(FILE *f);
- stbi_uc * (*load_from_file)(FILE *f, int *x, int *y, int *comp, int req_comp);
- #endif
-} stbi_loader;
-
-// register a loader by filling out the above structure (you must defined ALL functions)
-// returns 1 if added or already added, 0 if not added (too many loaders)
-// NOT THREADSAFE
-extern int stbi_register_loader(stbi_loader *loader);
-
-// define faster low-level operations (typically SIMD support)
-#if STBI_SIMD
-typedef void (*stbi_idct_8x8)(uint8 *out, int out_stride, short data[64], unsigned short *dequantize);
-// compute an integer IDCT on "input"
-// input[x] = data[x] * dequantize[x]
-// write results to 'out': 64 samples, each run of 8 spaced by 'out_stride'
-// CLAMP results to 0..255
-typedef void (*stbi_YCbCr_to_RGB_run)(uint8 *output, uint8 const *y, uint8 const *cb, uint8 const *cr, int count, int step);
-// compute a conversion from YCbCr to RGB
-// 'count' pixels
-// write pixels to 'output'; each pixel is 'step' bytes (either 3 or 4; if 4, write '255' as 4th), order R,G,B
-// y: Y input channel
-// cb: Cb input channel; scale/biased to be 0..255
-// cr: Cr input channel; scale/biased to be 0..255
-
-extern void stbi_install_idct(stbi_idct_8x8 func);
-extern void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func);
-#endif // STBI_SIMD
-
-#ifdef __cplusplus
-}
-#endif
-
-//
-//
-//// end header file /////////////////////////////////////////////////////
-#endif // STBI_INCLUDE_STB_IMAGE_H
-
-#ifndef STBI_HEADER_FILE_ONLY
-
-inline void* stb_malloc(size_t c) { return ::malloc(c); }
-inline void* stb_realloc(void *p, size_t c) { return ::realloc(p, c); }
-inline void stb_free(void *p) { ::free(p); }
-
-#ifndef STBI_NO_HDR
-#include <math.h> // ldexp
-#include <string.h> // strcmp
-#endif
-
-#ifndef STBI_NO_STDIO
-#include <stdio.h>
-#endif
-#include <stdlib.h>
-#include <memory.h>
-#include <assert.h>
-#include <stdarg.h>
-
-#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__MINGW64__)
- #ifdef __cplusplus
- #define __forceinline inline
- #else
- #define __forceinline
- #endif
-#endif
-
-
-// implementation:
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef signed short int16;
-typedef unsigned int uint32;
-typedef signed int int32;
-typedef unsigned int uint;
-
-// should produce compiler error if size is wrong
-typedef unsigned char validate_uint32[sizeof(uint32)==4];
-
-#if defined(STBI_NO_STDIO) && !defined(STBI_NO_WRITE)
-#define STBI_NO_WRITE
-#endif
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// Generic API that works on all image types
-//
-
-// this is not threadsafe
-static char *failure_reason;
-
-char *stbi_failure_reason(void)
-{
- return failure_reason;
-}
-
-static int e(char *str)
-{
- failure_reason = str;
- return 0;
-}
-
-#ifdef STBI_NO_FAILURE_STRINGS
- #define e(x,y) 0
-#elif defined(STBI_FAILURE_USERMSG)
- #define e(x,y) e(y)
-#else
- #define e(x,y) e(x)
-#endif
-
-#define epf(x,y) ((float *) (e(x,y)?NULL:NULL))
-#define epuc(x,y) ((unsigned char *) (e(x,y)?NULL:NULL))
-
-void stbi_image_free(void *retval_from_stbi_load)
-{
- stb_free(retval_from_stbi_load);
-}
-
-#define MAX_LOADERS 32
-stbi_loader *loaders[MAX_LOADERS];
-static int max_loaders = 0;
-
-int stbi_register_loader(stbi_loader *loader)
-{
- int i;
- for (i=0; i < MAX_LOADERS; ++i) {
- // already present?
- if (loaders[i] == loader)
- return 1;
- // end of the list?
- if (loaders[i] == NULL) {
- loaders[i] = loader;
- max_loaders = i+1;
- return 1;
- }
- }
- // no room for it
- return 0;
-}
-
-#ifndef STBI_NO_HDR
-static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp);
-static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp);
-#endif
-
-#ifndef STBI_NO_STDIO
-unsigned char *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- FILE *f = fopen(filename, "rb");
- unsigned char *result;
- if (!f) return epuc("can't fopen", "Unable to open file");
- result = stbi_load_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return result;
-}
-
-unsigned char *stbi_load_w(wchar_t const *filename, int *x, int *y, int *comp, int req_comp)
-{
- FILE *f = _wfopen(filename, L"rb");
- unsigned char *result;
- if (!f) return epuc("can't fopen", "Unable to open file");
- result = stbi_load_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return result;
-}
-
-unsigned char *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- int i;
- if (stbi_jpeg_test_file(f))
- return stbi_jpeg_load_from_file(f,x,y,comp,req_comp);
- if (stbi_png_test_file(f))
- return stbi_png_load_from_file(f,x,y,comp,req_comp);
- if (stbi_bmp_test_file(f))
- return stbi_bmp_load_from_file(f,x,y,comp,req_comp);
- if (stbi_psd_test_file(f))
- return stbi_psd_load_from_file(f,x,y,comp,req_comp);
- #ifndef STBI_NO_HDR
- if (stbi_hdr_test_file(f)) {
- float *hdr = stbi_hdr_load_from_file(f, x,y,comp,req_comp);
- return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);
- }
- #endif
- for (i=0; i < max_loaders; ++i)
- if (loaders[i]->test_file(f))
- return loaders[i]->load_from_file(f,x,y,comp,req_comp);
- // test tga last because it's a crappy test!
- if (stbi_tga_test_file(f))
- return stbi_tga_load_from_file(f,x,y,comp,req_comp);
- return epuc("unknown image type", "Image not of any known type, or corrupt");
-}
-#endif
-
-unsigned char *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- int i;
- if (stbi_jpeg_test_memory(buffer,len))
- return stbi_jpeg_load_from_memory(buffer,len,x,y,comp,req_comp);
- if (stbi_png_test_memory(buffer,len))
- return stbi_png_load_from_memory(buffer,len,x,y,comp,req_comp);
- if (stbi_bmp_test_memory(buffer,len))
- return stbi_bmp_load_from_memory(buffer,len,x,y,comp,req_comp);
- if (stbi_psd_test_memory(buffer,len))
- return stbi_psd_load_from_memory(buffer,len,x,y,comp,req_comp);
- #ifndef STBI_NO_HDR
- if (stbi_hdr_test_memory(buffer, len)) {
- float *hdr = stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp);
- return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);
- }
- #endif
- for (i=0; i < max_loaders; ++i)
- if (loaders[i]->test_memory(buffer,len))
- return loaders[i]->load_from_memory(buffer,len,x,y,comp,req_comp);
- // test tga last because it's a crappy test!
- if (stbi_tga_test_memory(buffer,len))
- return stbi_tga_load_from_memory(buffer,len,x,y,comp,req_comp);
- return epuc("unknown image type", "Image not of any known type, or corrupt");
-}
-
-#ifndef STBI_NO_HDR
-
-#ifndef STBI_NO_STDIO
-float *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- FILE *f = fopen(filename, "rb");
- float *result;
- if (!f) return epf("can't fopen", "Unable to open file");
- result = stbi_loadf_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return result;
-}
-
-float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- unsigned char *data;
- #ifndef STBI_NO_HDR
- if (stbi_hdr_test_file(f))
- return stbi_hdr_load_from_file(f,x,y,comp,req_comp);
- #endif
- data = stbi_load_from_file(f, x, y, comp, req_comp);
- if (data)
- return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);
- return epf("unknown image type", "Image not of any known type, or corrupt");
-}
-#endif
-
-float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi_uc *data;
- #ifndef STBI_NO_HDR
- if (stbi_hdr_test_memory(buffer, len))
- return stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp);
- #endif
- data = stbi_load_from_memory(buffer, len, x, y, comp, req_comp);
- if (data)
- return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);
- return epf("unknown image type", "Image not of any known type, or corrupt");
-}
-#endif
-
-// these is-hdr-or-not is defined independent of whether STBI_NO_HDR is
-// defined, for API simplicity; if STBI_NO_HDR is defined, it always
-// reports false!
-
-int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)
-{
- #ifndef STBI_NO_HDR
- return stbi_hdr_test_memory(buffer, len);
- #else
- return 0;
- #endif
-}
-
-#ifndef STBI_NO_STDIO
-extern int stbi_is_hdr (char const *filename)
-{
- FILE *f = fopen(filename, "rb");
- int result=0;
- if (f) {
- result = stbi_is_hdr_from_file(f);
- fclose(f);
- }
- return result;
-}
-
-extern int stbi_is_hdr_from_file(FILE *f)
-{
- #ifndef STBI_NO_HDR
- return stbi_hdr_test_file(f);
- #else
- return 0;
- #endif
-}
-
-#endif
-
-// @TODO: get image dimensions & components without fully decoding
-#ifndef STBI_NO_STDIO
-extern int stbi_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-#ifndef STBI_NO_HDR
-static float h2l_gamma_i=1.0f/2.2f, h2l_scale_i=1.0f;
-static float l2h_gamma=2.2f, l2h_scale=1.0f;
-
-void stbi_hdr_to_ldr_gamma(float gamma) { h2l_gamma_i = 1/gamma; }
-void stbi_hdr_to_ldr_scale(float scale) { h2l_scale_i = 1/scale; }
-
-void stbi_ldr_to_hdr_gamma(float gamma) { l2h_gamma = gamma; }
-void stbi_ldr_to_hdr_scale(float scale) { l2h_scale = scale; }
-#endif
-
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// Common code used by all image loaders
-//
-
-enum
-{
- SCAN_load=0,
- SCAN_type,
- SCAN_header,
-};
-
-typedef struct
-{
- uint32 img_x, img_y;
- int img_n, img_out_n;
-
- #ifndef STBI_NO_STDIO
- FILE *img_file;
- #endif
- uint8 *img_buffer, *img_buffer_end;
-} stbi;
-
-#ifndef STBI_NO_STDIO
-static void start_file(stbi *s, FILE *f)
-{
- s->img_file = f;
-}
-#endif
-
-static void start_mem(stbi *s, uint8 const *buffer, int len)
-{
-#ifndef STBI_NO_STDIO
- s->img_file = NULL;
-#endif
- s->img_buffer = (uint8 *) buffer;
- s->img_buffer_end = (uint8 *) buffer+len;
-}
-
-__forceinline static int get8(stbi *s)
-{
-#ifndef STBI_NO_STDIO
- if (s->img_file) {
- int c = fgetc(s->img_file);
- return c == EOF ? 0 : c;
- }
-#endif
- if (s->img_buffer < s->img_buffer_end)
- return *s->img_buffer++;
- return 0;
-}
-
-__forceinline static int at_eof(stbi *s)
-{
-#ifndef STBI_NO_STDIO
- if (s->img_file)
- return feof(s->img_file);
-#endif
- return s->img_buffer >= s->img_buffer_end;
-}
-
-__forceinline static uint8 get8u(stbi *s)
-{
- return (uint8) get8(s);
-}
-
-static void skip(stbi *s, int n)
-{
-#ifndef STBI_NO_STDIO
- if (s->img_file)
- fseek(s->img_file, n, SEEK_CUR);
- else
-#endif
- s->img_buffer += n;
-}
-
-static int get16(stbi *s)
-{
- int z = get8(s);
- return (z << 8) + get8(s);
-}
-
-static uint32 get32(stbi *s)
-{
- uint32 z = get16(s);
- return (z << 16) + get16(s);
-}
-
-static int get16le(stbi *s)
-{
- int z = get8(s);
- return z + (get8(s) << 8);
-}
-
-static uint32 get32le(stbi *s)
-{
- uint32 z = get16le(s);
- return z + (get16le(s) << 16);
-}
-
-static void getn(stbi *s, stbi_uc *buffer, int n)
-{
-#ifndef STBI_NO_STDIO
- if (s->img_file) {
- fread(buffer, 1, n, s->img_file);
- return;
- }
-#endif
- memcpy(buffer, s->img_buffer, n);
- s->img_buffer += n;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// generic converter from built-in img_n to req_comp
-// individual types do this automatically as much as possible (e.g. jpeg
-// does all cases internally since it needs to colorspace convert anyway,
-// and it never has alpha, so very few cases ). png can automatically
-// interleave an alpha=255 channel, but falls back to this for other cases
-//
-// assume data buffer is malloced, so stb_malloc a new one and free that one
-// only failure mode is stb_malloc failing
-
-static uint8 compute_y(int r, int g, int b)
-{
- return (uint8) (((r*77) + (g*150) + (29*b)) >> 8);
-}
-
-static unsigned char *convert_format(unsigned char *data, int img_n, int req_comp, uint x, uint y)
-{
- int i,j;
- unsigned char *good;
-
- if (req_comp == img_n) return data;
- assert(req_comp >= 1 && req_comp <= 4);
-
- good = (unsigned char *) stb_malloc(req_comp * x * y);
- if (good == NULL) {
- stb_free(data);
- return epuc("outofmem", "Out of memory");
- }
-
- for (j=0; j < (int) y; ++j) {
- unsigned char *src = data + j * x * img_n ;
- unsigned char *dest = good + j * x * req_comp;
-
- #define COMBO(a,b) ((a)*8+(b))
- #define CASE(a,b) case COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)
- // convert source image with img_n components to one with req_comp components;
- // avoid switch per pixel, so use switch per scanline and massive macros
- switch(COMBO(img_n, req_comp)) {
- CASE(1,2) dest[0]=src[0], dest[1]=255; break;
- CASE(1,3) dest[0]=dest[1]=dest[2]=src[0]; break;
- CASE(1,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; break;
- CASE(2,1) dest[0]=src[0]; break;
- CASE(2,3) dest[0]=dest[1]=dest[2]=src[0]; break;
- CASE(2,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; break;
- CASE(3,4) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; break;
- CASE(3,1) dest[0]=compute_y(src[0],src[1],src[2]); break;
- CASE(3,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = 255; break;
- CASE(4,1) dest[0]=compute_y(src[0],src[1],src[2]); break;
- CASE(4,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = src[3]; break;
- CASE(4,3) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; break;
- default: assert(0);
- }
- #undef CASE
- }
-
- stb_free(data);
- return good;
-}
-
-#ifndef STBI_NO_HDR
-static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp)
-{
- int i,k,n;
- float *output = (float *) stb_malloc(x * y * comp * sizeof(float));
- if (output == NULL) { stb_free(data); return epf("outofmem", "Out of memory"); }
- // compute number of non-alpha components
- if (comp & 1) n = comp; else n = comp-1;
- for (i=0; i < x*y; ++i) {
- for (k=0; k < n; ++k) {
- output[i*comp + k] = (float) pow(data[i*comp+k]/255.0f, l2h_gamma) * l2h_scale;
- }
- if (k < comp) output[i*comp + k] = data[i*comp+k]/255.0f;
- }
- stb_free(data);
- return output;
-}
-
-#define float2int(x) ((int) (x))
-static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp)
-{
- int i,k,n;
- stbi_uc *output = (stbi_uc *) stb_malloc(x * y * comp);
- if (output == NULL) { stb_free(data); return epuc("outofmem", "Out of memory"); }
- // compute number of non-alpha components
- if (comp & 1) n = comp; else n = comp-1;
- for (i=0; i < x*y; ++i) {
- for (k=0; k < n; ++k) {
- float z = (float) pow(data[i*comp+k]*h2l_scale_i, h2l_gamma_i) * 255 + 0.5f;
- if (z < 0) z = 0;
- if (z > 255) z = 255;
- output[i*comp + k] = float2int(z);
- }
- if (k < comp) {
- float z = data[i*comp+k] * 255 + 0.5f;
- if (z < 0) z = 0;
- if (z > 255) z = 255;
- output[i*comp + k] = float2int(z);
- }
- }
- stb_free(data);
- return output;
-}
-#endif
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// "baseline" JPEG/JFIF decoder (not actually fully baseline implementation)
-//
-// simple implementation
-// - channel subsampling of at most 2 in each dimension
-// - doesn't support delayed output of y-dimension
-// - simple interface (only one output format: 8-bit interleaved RGB)
-// - doesn't try to recover corrupt jpegs
-// - doesn't allow partial loading, loading multiple at once
-// - still fast on x86 (copying globals into locals doesn't help x86)
-// - allocates lots of intermediate memory (full size of all components)
-// - non-interleaved case requires this anyway
-// - allows good upsampling (see next)
-// high-quality
-// - upsampled channels are bilinearly interpolated, even across blocks
-// - quality integer IDCT derived from IJG's 'slow'
-// performance
-// - fast huffman; reasonable integer IDCT
-// - uses a lot of intermediate memory, could cache poorly
-// - load http://nothings.org/remote/anemones.jpg 3 times on 2.8Ghz P4
-// stb_jpeg: 1.34 seconds (MSVC6, default release build)
-// stb_jpeg: 1.06 seconds (MSVC6, processor = Pentium Pro)
-// IJL11.dll: 1.08 seconds (compiled by intel)
-// IJG 1998: 0.98 seconds (MSVC6, makefile provided by IJG)
-// IJG 1998: 0.95 seconds (MSVC6, makefile + proc=PPro)
-
-// huffman decoding acceleration
-#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache
-
-typedef struct
-{
- uint8 fast[1 << FAST_BITS];
- // weirdly, repacking this into AoS is a 10% speed loss, instead of a win
- uint16 code[256];
- uint8 values[256];
- uint8 size[257];
- unsigned int maxcode[18];
- int delta[17]; // old 'firstsymbol' - old 'firstcode'
-} huffman;
-
-typedef struct
-{
- #if STBI_SIMD
- unsigned short dequant2[4][64];
- #endif
- stbi s;
- huffman huff_dc[4];
- huffman huff_ac[4];
- uint8 dequant[4][64];
-
-// sizes for components, interleaved MCUs
- int img_h_max, img_v_max;
- int img_mcu_x, img_mcu_y;
- int img_mcu_w, img_mcu_h;
-
-// definition of jpeg image component
- struct
- {
- int id;
- int h,v;
- int tq;
- int hd,ha;
- int dc_pred;
-
- int x,y,w2,h2;
- uint8 *data;
- void *raw_data;
- uint8 *linebuf;
- } img_comp[4];
-
- uint32 code_buffer; // jpeg entropy-coded buffer
- int code_bits; // number of valid bits
- unsigned char marker; // marker seen while filling entropy buffer
- int nomore; // flag if we saw a marker so must stop
-
- int scan_n, order[4];
- int restart_interval, todo;
-} jpeg;
-
-static int build_huffman(huffman *h, int *count)
-{
- int i,j,k=0,code;
- // build size list for each symbol (from JPEG spec)
- for (i=0; i < 16; ++i)
- for (j=0; j < count[i]; ++j)
- h->size[k++] = (uint8) (i+1);
- h->size[k] = 0;
-
- // compute actual symbols (from jpeg spec)
- code = 0;
- k = 0;
- for(j=1; j <= 16; ++j) {
- // compute delta to add to code to compute symbol id
- h->delta[j] = k - code;
- if (h->size[k] == j) {
- while (h->size[k] == j)
- h->code[k++] = (uint16) (code++);
- if (code-1 >= (1 << j)) return e("bad code lengths","Corrupt JPEG");
- }
- // compute largest code + 1 for this size, preshifted as needed later
- h->maxcode[j] = code << (16-j);
- code <<= 1;
- }
- h->maxcode[j] = 0xffffffff;
-
- // build non-spec acceleration table; 255 is flag for not-accelerated
- memset(h->fast, 255, 1 << FAST_BITS);
- for (i=0; i < k; ++i) {
- int s = h->size[i];
- if (s <= FAST_BITS) {
- int c = h->code[i] << (FAST_BITS-s);
- int m = 1 << (FAST_BITS-s);
- for (j=0; j < m; ++j) {
- h->fast[c+j] = (uint8) i;
- }
- }
- }
- return 1;
-}
-
-static void grow_buffer_unsafe(jpeg *j)
-{
- do {
- int b = j->nomore ? 0 : get8(&j->s);
- if (b == 0xff) {
- int c = get8(&j->s);
- if (c != 0) {
- j->marker = (unsigned char) c;
- j->nomore = 1;
- return;
- }
- }
- j->code_buffer = (j->code_buffer << 8) | b;
- j->code_bits += 8;
- } while (j->code_bits <= 24);
-}
-
-// (1 << n) - 1
-static uint32 bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535};
-
-// decode a jpeg huffman value from the bitstream
-__forceinline static int decode(jpeg *j, huffman *h)
-{
- unsigned int temp;
- int c,k;
-
- if (j->code_bits < 16) grow_buffer_unsafe(j);
-
- // look at the top FAST_BITS and determine what symbol ID it is,
- // if the code is <= FAST_BITS
- c = (j->code_buffer >> (j->code_bits - FAST_BITS)) & ((1 << FAST_BITS)-1);
- k = h->fast[c];
- if (k < 255) {
- if (h->size[k] > j->code_bits)
- return -1;
- j->code_bits -= h->size[k];
- return h->values[k];
- }
-
- // naive test is to shift the code_buffer down so k bits are
- // valid, then test against maxcode. To speed this up, we've
- // preshifted maxcode left so that it has (16-k) 0s at the
- // end; in other words, regardless of the number of bits, it
- // wants to be compared against something shifted to have 16;
- // that way we don't need to shift inside the loop.
- if (j->code_bits < 16)
- temp = (j->code_buffer << (16 - j->code_bits)) & 0xffff;
- else
- temp = (j->code_buffer >> (j->code_bits - 16)) & 0xffff;
- for (k=FAST_BITS+1 ; ; ++k)
- if (temp < h->maxcode[k])
- break;
- if (k == 17) {
- // error! code not found
- j->code_bits -= 16;
- return -1;
- }
-
- if (k > j->code_bits)
- return -1;
-
- // convert the huffman code to the symbol id
- c = ((j->code_buffer >> (j->code_bits - k)) & bmask[k]) + h->delta[k];
- assert((((j->code_buffer) >> (j->code_bits - h->size[c])) & bmask[h->size[c]]) == h->code[c]);
-
- // convert the id to a symbol
- j->code_bits -= k;
- return h->values[c];
-}
-
-// combined JPEG 'receive' and JPEG 'extend', since baseline
-// always extends everything it receives.
-__forceinline static int extend_receive(jpeg *j, int n)
-{
- unsigned int m = 1 << (n-1);
- unsigned int k;
- if (j->code_bits < n) grow_buffer_unsafe(j);
- k = (j->code_buffer >> (j->code_bits - n)) & bmask[n];
- j->code_bits -= n;
- // the following test is probably a random branch that won't
- // predict well. I tried to table accelerate it but failed.
- // maybe it's compiling as a conditional move?
- if (k < m)
- return (-1 << n) + k + 1;
- else
- return k;
-}
-
-// given a value that's at position X in the zigzag stream,
-// where does it appear in the 8x8 matrix coded as row-major?
-static uint8 dezigzag[64+15] =
-{
- 0, 1, 8, 16, 9, 2, 3, 10,
- 17, 24, 32, 25, 18, 11, 4, 5,
- 12, 19, 26, 33, 40, 48, 41, 34,
- 27, 20, 13, 6, 7, 14, 21, 28,
- 35, 42, 49, 56, 57, 50, 43, 36,
- 29, 22, 15, 23, 30, 37, 44, 51,
- 58, 59, 52, 45, 38, 31, 39, 46,
- 53, 60, 61, 54, 47, 55, 62, 63,
- // let corrupt input sample past end
- 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63
-};
-
-// decode one 64-entry block--
-static int decode_block(jpeg *j, short data[64], huffman *hdc, huffman *hac, int b)
-{
- int diff,dc,k;
- int t = decode(j, hdc);
- if (t < 0) return e("bad huffman code","Corrupt JPEG");
-
- // 0 all the ac values now so we can do it 32-bits at a time
- memset(data,0,64*sizeof(data[0]));
-
- diff = t ? extend_receive(j, t) : 0;
- dc = j->img_comp[b].dc_pred + diff;
- j->img_comp[b].dc_pred = dc;
- data[0] = (short) dc;
-
- // decode AC components, see JPEG spec
- k = 1;
- do {
- int r,s;
- int rs = decode(j, hac);
- if (rs < 0) return e("bad huffman code","Corrupt JPEG");
- s = rs & 15;
- r = rs >> 4;
- if (s == 0) {
- if (rs != 0xf0) break; // end block
- k += 16;
- } else {
- k += r;
- // decode into unzigzag'd location
- data[dezigzag[k++]] = (short) extend_receive(j,s);
- }
- } while (k < 64);
- return 1;
-}
-
-// take a -128..127 value and clamp it and convert to 0..255
-__forceinline static uint8 clamp(int x)
-{
- x += 128;
- // trick to use a single test to catch both cases
- if ((unsigned int) x > 255) {
- if (x < 0) return 0;
- if (x > 255) return 255;
- }
- return (uint8) x;
-}
-
-#define f2f(x) (int) (((x) * 4096 + 0.5))
-#define fsh(x) ((x) << 12)
-
-// derived from jidctint -- DCT_ISLOW
-#define IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \
- int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \
- p2 = s2; \
- p3 = s6; \
- p1 = (p2+p3) * f2f(0.5411961f); \
- t2 = p1 + p3*f2f(-1.847759065f); \
- t3 = p1 + p2*f2f( 0.765366865f); \
- p2 = s0; \
- p3 = s4; \
- t0 = fsh(p2+p3); \
- t1 = fsh(p2-p3); \
- x0 = t0+t3; \
- x3 = t0-t3; \
- x1 = t1+t2; \
- x2 = t1-t2; \
- t0 = s7; \
- t1 = s5; \
- t2 = s3; \
- t3 = s1; \
- p3 = t0+t2; \
- p4 = t1+t3; \
- p1 = t0+t3; \
- p2 = t1+t2; \
- p5 = (p3+p4)*f2f( 1.175875602f); \
- t0 = t0*f2f( 0.298631336f); \
- t1 = t1*f2f( 2.053119869f); \
- t2 = t2*f2f( 3.072711026f); \
- t3 = t3*f2f( 1.501321110f); \
- p1 = p5 + p1*f2f(-0.899976223f); \
- p2 = p5 + p2*f2f(-2.562915447f); \
- p3 = p3*f2f(-1.961570560f); \
- p4 = p4*f2f(-0.390180644f); \
- t3 += p1+p4; \
- t2 += p2+p3; \
- t1 += p2+p4; \
- t0 += p1+p3;
-
-#if !STBI_SIMD
-// .344 seconds on 3*anemones.jpg
-static void idct_block(uint8 *out, int out_stride, short data[64], uint8 *dequantize)
-{
- int i,val[64],*v=val;
- uint8 *o,*dq = dequantize;
- short *d = data;
-
- // columns
- for (i=0; i < 8; ++i,++d,++dq, ++v) {
- // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing
- if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0
- && d[40]==0 && d[48]==0 && d[56]==0) {
- // no shortcut 0 seconds
- // (1|2|3|4|5|6|7)==0 0 seconds
- // all separate -0.047 seconds
- // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds
- int dcterm = d[0] * dq[0] << 2;
- v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;
- } else {
- IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24],
- d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56])
- // constants scaled things up by 1<<12; let's bring them back
- // down, but keep 2 extra bits of precision
- x0 += 512; x1 += 512; x2 += 512; x3 += 512;
- v[ 0] = (x0+t3) >> 10;
- v[56] = (x0-t3) >> 10;
- v[ 8] = (x1+t2) >> 10;
- v[48] = (x1-t2) >> 10;
- v[16] = (x2+t1) >> 10;
- v[40] = (x2-t1) >> 10;
- v[24] = (x3+t0) >> 10;
- v[32] = (x3-t0) >> 10;
- }
- }
-
- for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) {
- // no fast case since the first 1D IDCT spread components out
- IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7])
- // constants scaled things up by 1<<12, plus we had 1<<2 from first
- // loop, plus horizontal and vertical each scale by sqrt(8) so together
- // we've got an extra 1<<3, so 1<<17 total we need to remove.
- x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536;
- o[0] = clamp((x0+t3) >> 17);
- o[7] = clamp((x0-t3) >> 17);
- o[1] = clamp((x1+t2) >> 17);
- o[6] = clamp((x1-t2) >> 17);
- o[2] = clamp((x2+t1) >> 17);
- o[5] = clamp((x2-t1) >> 17);
- o[3] = clamp((x3+t0) >> 17);
- o[4] = clamp((x3-t0) >> 17);
- }
-}
-#else
-static void idct_block(uint8 *out, int out_stride, short data[64], unsigned short *dequantize)
-{
- int i,val[64],*v=val;
- uint8 *o;
- unsigned short *dq = dequantize;
- short *d = data;
-
- // columns
- for (i=0; i < 8; ++i,++d,++dq, ++v) {
- // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing
- if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0
- && d[40]==0 && d[48]==0 && d[56]==0) {
- // no shortcut 0 seconds
- // (1|2|3|4|5|6|7)==0 0 seconds
- // all separate -0.047 seconds
- // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds
- int dcterm = d[0] * dq[0] << 2;
- v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;
- } else {
- IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24],
- d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56])
- // constants scaled things up by 1<<12; let's bring them back
- // down, but keep 2 extra bits of precision
- x0 += 512; x1 += 512; x2 += 512; x3 += 512;
- v[ 0] = (x0+t3) >> 10;
- v[56] = (x0-t3) >> 10;
- v[ 8] = (x1+t2) >> 10;
- v[48] = (x1-t2) >> 10;
- v[16] = (x2+t1) >> 10;
- v[40] = (x2-t1) >> 10;
- v[24] = (x3+t0) >> 10;
- v[32] = (x3-t0) >> 10;
- }
- }
-
- for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) {
- // no fast case since the first 1D IDCT spread components out
- IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7])
- // constants scaled things up by 1<<12, plus we had 1<<2 from first
- // loop, plus horizontal and vertical each scale by sqrt(8) so together
- // we've got an extra 1<<3, so 1<<17 total we need to remove.
- x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536;
- o[0] = clamp((x0+t3) >> 17);
- o[7] = clamp((x0-t3) >> 17);
- o[1] = clamp((x1+t2) >> 17);
- o[6] = clamp((x1-t2) >> 17);
- o[2] = clamp((x2+t1) >> 17);
- o[5] = clamp((x2-t1) >> 17);
- o[3] = clamp((x3+t0) >> 17);
- o[4] = clamp((x3-t0) >> 17);
- }
-}
-static stbi_idct_8x8 stbi_idct_installed = idct_block;
-
-extern void stbi_install_idct(stbi_idct_8x8 func)
-{
- stbi_idct_installed = func;
-}
-#endif
-
-#define MARKER_none 0xff
-// if there's a pending marker from the entropy stream, return that
-// otherwise, fetch from the stream and get a marker. if there's no
-// marker, return 0xff, which is never a valid marker value
-static uint8 get_marker(jpeg *j)
-{
- uint8 x;
- if (j->marker != MARKER_none) { x = j->marker; j->marker = MARKER_none; return x; }
- x = get8u(&j->s);
- if (x != 0xff) return MARKER_none;
- while (x == 0xff)
- x = get8u(&j->s);
- return x;
-}
-
-// in each scan, we'll have scan_n components, and the order
-// of the components is specified by order[]
-#define RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7)
-
-// after a restart interval, reset the entropy decoder and
-// the dc prediction
-static void reset(jpeg *j)
-{
- j->code_bits = 0;
- j->code_buffer = 0;
- j->nomore = 0;
- j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = 0;
- j->marker = MARKER_none;
- j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff;
- // no more than 1<<31 MCUs if no restart_interal? that's plenty safe,
- // since we don't even allow 1<<30 pixels
-}
-
-static int parse_entropy_coded_data(jpeg *z)
-{
- reset(z);
- if (z->scan_n == 1) {
- int i,j;
- #if STBI_SIMD
- __declspec(align(16))
- #endif
- short data[64];
- int n = z->order[0];
- // non-interleaved data, we just need to process one block at a time,
- // in trivial scanline order
- // number of blocks to do just depends on how many actual "pixels" this
- // component has, independent of interleaved MCU blocking and such
- int w = (z->img_comp[n].x+7) >> 3;
- int h = (z->img_comp[n].y+7) >> 3;
- for (j=0; j < h; ++j) {
- for (i=0; i < w; ++i) {
- if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0;
- #if STBI_SIMD
- stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]);
- #else
- idct_block(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]);
- #endif
- // every data block is an MCU, so countdown the restart interval
- if (--z->todo <= 0) {
- if (z->code_bits < 24) grow_buffer_unsafe(z);
- // if it's NOT a restart, then just bail, so we get corrupt data
- // rather than no data
- if (!RESTART(z->marker)) return 1;
- reset(z);
- }
- }
- }
- } else { // interleaved!
- int i,j,k,x,y;
- short data[64];
- for (j=0; j < z->img_mcu_y; ++j) {
- for (i=0; i < z->img_mcu_x; ++i) {
- // scan an interleaved mcu... process scan_n components in order
- for (k=0; k < z->scan_n; ++k) {
- int n = z->order[k];
- // scan out an mcu's worth of this component; that's just determined
- // by the basic H and V specified for the component
- for (y=0; y < z->img_comp[n].v; ++y) {
- for (x=0; x < z->img_comp[n].h; ++x) {
- int x2 = (i*z->img_comp[n].h + x)*8;
- int y2 = (j*z->img_comp[n].v + y)*8;
- if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0;
- #if STBI_SIMD
- stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]);
- #else
- idct_block(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]);
- #endif
- }
- }
- }
- // after all interleaved components, that's an interleaved MCU,
- // so now count down the restart interval
- if (--z->todo <= 0) {
- if (z->code_bits < 24) grow_buffer_unsafe(z);
- // if it's NOT a restart, then just bail, so we get corrupt data
- // rather than no data
- if (!RESTART(z->marker)) return 1;
- reset(z);
- }
- }
- }
- }
- return 1;
-}
-
-static int process_marker(jpeg *z, int m)
-{
- int L;
- switch (m) {
- case MARKER_none: // no marker found
- return e("expected marker","Corrupt JPEG");
-
- case 0xC2: // SOF - progressive
- return e("progressive jpeg","JPEG format not supported (progressive)");
-
- case 0xDD: // DRI - specify restart interval
- if (get16(&z->s) != 4) return e("bad DRI len","Corrupt JPEG");
- z->restart_interval = get16(&z->s);
- return 1;
-
- case 0xDB: // DQT - define quantization table
- L = get16(&z->s)-2;
- while (L > 0) {
- int q = get8(&z->s);
- int p = q >> 4;
- int t = q & 15,i;
- if (p != 0) return e("bad DQT type","Corrupt JPEG");
- if (t > 3) return e("bad DQT table","Corrupt JPEG");
- for (i=0; i < 64; ++i)
- z->dequant[t][dezigzag[i]] = get8u(&z->s);
- #if STBI_SIMD
- for (i=0; i < 64; ++i)
- z->dequant2[t][i] = z->dequant[t][i];
- #endif
- L -= 65;
- }
- return L==0;
-
- case 0xC4: // DHT - define huffman table
- L = get16(&z->s)-2;
- while (L > 0) {
- uint8 *v;
- int sizes[16],i,m=0;
- int q = get8(&z->s);
- int tc = q >> 4;
- int th = q & 15;
- if (tc > 1 || th > 3) return e("bad DHT header","Corrupt JPEG");
- for (i=0; i < 16; ++i) {
- sizes[i] = get8(&z->s);
- m += sizes[i];
- }
- L -= 17;
- if (tc == 0) {
- if (!build_huffman(z->huff_dc+th, sizes)) return 0;
- v = z->huff_dc[th].values;
- } else {
- if (!build_huffman(z->huff_ac+th, sizes)) return 0;
- v = z->huff_ac[th].values;
- }
- for (i=0; i < m; ++i)
- v[i] = get8u(&z->s);
- L -= m;
- }
- return L==0;
- }
- // check for comment block or APP blocks
- if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) {
- skip(&z->s, get16(&z->s)-2);
- return 1;
- }
- return 0;
-}
-
-// after we see SOS
-static int process_scan_header(jpeg *z)
-{
- int i;
- int Ls = get16(&z->s);
- z->scan_n = get8(&z->s);
- if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s.img_n) return e("bad SOS component count","Corrupt JPEG");
- if (Ls != 6+2*z->scan_n) return e("bad SOS len","Corrupt JPEG");
- for (i=0; i < z->scan_n; ++i) {
- int id = get8(&z->s), which;
- int q = get8(&z->s);
- for (which = 0; which < z->s.img_n; ++which)
- if (z->img_comp[which].id == id)
- break;
- if (which == z->s.img_n) return 0;
- z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return e("bad DC huff","Corrupt JPEG");
- z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return e("bad AC huff","Corrupt JPEG");
- z->order[i] = which;
- }
- if (get8(&z->s) != 0) return e("bad SOS","Corrupt JPEG");
- get8(&z->s); // should be 63, but might be 0
- if (get8(&z->s) != 0) return e("bad SOS","Corrupt JPEG");
-
- return 1;
-}
-
-static int process_frame_header(jpeg *z, int scan)
-{
- stbi *s = &z->s;
- int Lf,p,i,q, h_max=1,v_max=1,c;
- Lf = get16(s); if (Lf < 11) return e("bad SOF len","Corrupt JPEG"); // JPEG
- p = get8(s); if (p != 8) return e("only 8-bit","JPEG format not supported: 8-bit only"); // JPEG baseline
- s->img_y = get16(s); if (s->img_y == 0) return e("no header height", "JPEG format not supported: delayed height"); // Legal, but we don't handle it--but neither does IJG
- s->img_x = get16(s); if (s->img_x == 0) return e("0 width","Corrupt JPEG"); // JPEG requires
- c = get8(s);
- if (c != 3 && c != 1) return e("bad component count","Corrupt JPEG"); // JFIF requires
- s->img_n = c;
- for (i=0; i < c; ++i) {
- z->img_comp[i].data = NULL;
- z->img_comp[i].linebuf = NULL;
- }
-
- if (Lf != 8+3*s->img_n) return e("bad SOF len","Corrupt JPEG");
-
- for (i=0; i < s->img_n; ++i) {
- z->img_comp[i].id = get8(s);
- if (z->img_comp[i].id != i+1) // JFIF requires
- if (z->img_comp[i].id != i) // some version of jpegtran outputs non-JFIF-compliant files!
- return e("bad component ID","Corrupt JPEG");
- q = get8(s);
- z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return e("bad H","Corrupt JPEG");
- z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return e("bad V","Corrupt JPEG");
- z->img_comp[i].tq = get8(s); if (z->img_comp[i].tq > 3) return e("bad TQ","Corrupt JPEG");
- }
-
- if (scan != SCAN_load) return 1;
-
- if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e("too large", "Image too large to decode");
-
- for (i=0; i < s->img_n; ++i) {
- if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h;
- if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v;
- }
-
- // compute interleaved mcu info
- z->img_h_max = h_max;
- z->img_v_max = v_max;
- z->img_mcu_w = h_max * 8;
- z->img_mcu_h = v_max * 8;
- z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w;
- z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h;
-
- for (i=0; i < s->img_n; ++i) {
- // number of effective pixels (e.g. for non-interleaved MCU)
- z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max;
- z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max;
- // to simplify generation, we'll allocate enough memory to decode
- // the bogus oversized data from using interleaved MCUs and their
- // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't
- // discard the extra data until colorspace conversion
- z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8;
- z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8;
- z->img_comp[i].raw_data = stb_malloc(z->img_comp[i].w2 * z->img_comp[i].h2+15);
- if (z->img_comp[i].raw_data == NULL) {
- for(--i; i >= 0; --i) {
- stb_free(z->img_comp[i].raw_data);
- z->img_comp[i].data = NULL;
- }
- return e("outofmem", "Out of memory");
- }
- // align blocks for installable-idct using mmx/sse
- z->img_comp[i].data = (uint8*) (((size_t) z->img_comp[i].raw_data + 15) & ~15);
- z->img_comp[i].linebuf = NULL;
- }
-
- return 1;
-}
-
-// use comparisons since in some cases we handle more than one case (e.g. SOF)
-#define DNL(x) ((x) == 0xdc)
-#define SOI(x) ((x) == 0xd8)
-#define EOI(x) ((x) == 0xd9)
-#define SOF(x) ((x) == 0xc0 || (x) == 0xc1)
-#define SOS(x) ((x) == 0xda)
-
-static int decode_jpeg_header(jpeg *z, int scan)
-{
- int m;
- z->marker = MARKER_none; // initialize cached marker to empty
- m = get_marker(z);
- if (!SOI(m)) return e("no SOI","Corrupt JPEG");
- if (scan == SCAN_type) return 1;
- m = get_marker(z);
- while (!SOF(m)) {
- if (!process_marker(z,m)) return 0;
- m = get_marker(z);
- while (m == MARKER_none) {
- // some files have extra padding after their blocks, so ok, we'll scan
- if (at_eof(&z->s)) return e("no SOF", "Corrupt JPEG");
- m = get_marker(z);
- }
- }
- if (!process_frame_header(z, scan)) return 0;
- return 1;
-}
-
-static int decode_jpeg_image(jpeg *j)
-{
- int m;
- j->restart_interval = 0;
- if (!decode_jpeg_header(j, SCAN_load)) return 0;
- m = get_marker(j);
- while (!EOI(m)) {
- if (SOS(m)) {
- if (!process_scan_header(j)) return 0;
- if (!parse_entropy_coded_data(j)) return 0;
- } else {
- if (!process_marker(j, m)) return 0;
- }
- m = get_marker(j);
- }
- return 1;
-}
-
-// static jfif-centered resampling (across block boundaries)
-
-typedef uint8 *(*resample_row_func)(uint8 *out, uint8 *in0, uint8 *in1,
- int w, int hs);
-
-#define div4(x) ((uint8) ((x) >> 2))
-
-static uint8 *resample_row_1(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- return in_near;
-}
-
-static uint8* resample_row_v_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- // need to generate two samples vertically for every one in input
- int i;
- for (i=0; i < w; ++i)
- out[i] = div4(3*in_near[i] + in_far[i] + 2);
- return out;
-}
-
-static uint8* resample_row_h_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- // need to generate two samples horizontally for every one in input
- int i;
- uint8 *input = in_near;
- if (w == 1) {
- // if only one sample, can't do any interpolation
- out[0] = out[1] = input[0];
- return out;
- }
-
- out[0] = input[0];
- out[1] = div4(input[0]*3 + input[1] + 2);
- for (i=1; i < w-1; ++i) {
- int n = 3*input[i]+2;
- out[i*2+0] = div4(n+input[i-1]);
- out[i*2+1] = div4(n+input[i+1]);
- }
- out[i*2+0] = div4(input[w-2]*3 + input[w-1] + 2);
- out[i*2+1] = input[w-1];
- return out;
-}
-
-#define div16(x) ((uint8) ((x) >> 4))
-
-static uint8 *resample_row_hv_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- // need to generate 2x2 samples for every one in input
- int i,t0,t1;
- if (w == 1) {
- out[0] = out[1] = div4(3*in_near[0] + in_far[0] + 2);
- return out;
- }
-
- t1 = 3*in_near[0] + in_far[0];
- out[0] = div4(t1+2);
- for (i=1; i < w; ++i) {
- t0 = t1;
- t1 = 3*in_near[i]+in_far[i];
- out[i*2-1] = div16(3*t0 + t1 + 8);
- out[i*2 ] = div16(3*t1 + t0 + 8);
- }
- out[w*2-1] = div4(t1+2);
- return out;
-}
-
-static uint8 *resample_row_generic(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
-{
- // resample with nearest-neighbor
- int i,j;
- for (i=0; i < w; ++i)
- for (j=0; j < hs; ++j)
- out[i*hs+j] = in_near[i];
- return out;
-}
-
-#define float2fixed(x) ((int) ((x) * 65536 + 0.5))
-
-// 0.38 seconds on 3*anemones.jpg (0.25 with processor = Pro)
-// VC6 without processor=Pro is generating multiple LEAs per multiply!
-static void YCbCr_to_RGB_row(uint8 *out, const uint8 *y, const uint8 *pcb, const uint8 *pcr, int count, int step)
-{
- int i;
- for (i=0; i < count; ++i) {
- int y_fixed = (y[i] << 16) + 32768; // rounding
- int r,g,b;
- int cr = pcr[i] - 128;
- int cb = pcb[i] - 128;
- r = y_fixed + cr*float2fixed(1.40200f);
- g = y_fixed - cr*float2fixed(0.71414f) - cb*float2fixed(0.34414f);
- b = y_fixed + cb*float2fixed(1.77200f);
- r >>= 16;
- g >>= 16;
- b >>= 16;
- if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; }
- if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; }
- if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; }
- out[0] = (uint8)r;
- out[1] = (uint8)g;
- out[2] = (uint8)b;
- out[3] = 255;
- out += step;
- }
-}
-
-#if STBI_SIMD
-static stbi_YCbCr_to_RGB_run stbi_YCbCr_installed = YCbCr_to_RGB_row;
-
-void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func)
-{
- stbi_YCbCr_installed = func;
-}
-#endif
-
-
-// clean up the temporary component buffers
-static void cleanup_jpeg(jpeg *j)
-{
- int i;
- for (i=0; i < j->s.img_n; ++i) {
- if (j->img_comp[i].data) {
- stb_free(j->img_comp[i].raw_data);
- j->img_comp[i].data = NULL;
- }
- if (j->img_comp[i].linebuf) {
- stb_free(j->img_comp[i].linebuf);
- j->img_comp[i].linebuf = NULL;
- }
- }
-}
-
-typedef struct
-{
- resample_row_func resample;
- uint8 *line0,*line1;
- int hs,vs; // expansion factor in each axis
- int w_lores; // horizontal pixels pre-expansion
- int ystep; // how far through vertical expansion we are
- int ypos; // which pre-expansion row we're on
-} stbi_resample;
-
-static uint8 *load_jpeg_image(jpeg *z, int *out_x, int *out_y, int *comp, int req_comp)
-{
- int n, decode_n;
- // validate req_comp
- if (req_comp < 0 || req_comp > 4) return epuc("bad req_comp", "Internal error");
- z->s.img_n = 0;
-
- // load a jpeg image from whichever source
- if (!decode_jpeg_image(z)) { cleanup_jpeg(z); return NULL; }
-
- // determine actual number of components to generate
- n = req_comp ? req_comp : z->s.img_n;
-
- if (z->s.img_n == 3 && n < 3)
- decode_n = 1;
- else
- decode_n = z->s.img_n;
-
- // resample and color-convert
- {
- int k;
- uint i,j;
- uint8 *output;
- uint8 *coutput[4];
-
- stbi_resample res_comp[4];
-
- for (k=0; k < decode_n; ++k) {
- stbi_resample *r = &res_comp[k];
-
- // allocate line buffer big enough for upsampling off the edges
- // with upsample factor of 4
- z->img_comp[k].linebuf = (uint8 *) stb_malloc(z->s.img_x + 3);
- if (!z->img_comp[k].linebuf) { cleanup_jpeg(z); return epuc("outofmem", "Out of memory"); }
-
- r->hs = z->img_h_max / z->img_comp[k].h;
- r->vs = z->img_v_max / z->img_comp[k].v;
- r->ystep = r->vs >> 1;
- r->w_lores = (z->s.img_x + r->hs-1) / r->hs;
- r->ypos = 0;
- r->line0 = r->line1 = z->img_comp[k].data;
-
- if (r->hs == 1 && r->vs == 1) r->resample = resample_row_1;
- else if (r->hs == 1 && r->vs == 2) r->resample = resample_row_v_2;
- else if (r->hs == 2 && r->vs == 1) r->resample = resample_row_h_2;
- else if (r->hs == 2 && r->vs == 2) r->resample = resample_row_hv_2;
- else r->resample = resample_row_generic;
- }
-
- // can't error after this so, this is safe
- output = (uint8 *) stb_malloc(n * z->s.img_x * z->s.img_y + 1);
- if (!output) { cleanup_jpeg(z); return epuc("outofmem", "Out of memory"); }
-
- // now go ahead and resample
- for (j=0; j < z->s.img_y; ++j) {
- uint8 *out = output + n * z->s.img_x * j;
- for (k=0; k < decode_n; ++k) {
- stbi_resample *r = &res_comp[k];
- int y_bot = r->ystep >= (r->vs >> 1);
- coutput[k] = r->resample(z->img_comp[k].linebuf,
- y_bot ? r->line1 : r->line0,
- y_bot ? r->line0 : r->line1,
- r->w_lores, r->hs);
- if (++r->ystep >= r->vs) {
- r->ystep = 0;
- r->line0 = r->line1;
- if (++r->ypos < z->img_comp[k].y)
- r->line1 += z->img_comp[k].w2;
- }
- }
- if (n >= 3) {
- uint8 *y = coutput[0];
- if (z->s.img_n == 3) {
- #if STBI_SIMD
- stbi_YCbCr_installed(out, y, coutput[1], coutput[2], z->s.img_x, n);
- #else
- YCbCr_to_RGB_row(out, y, coutput[1], coutput[2], z->s.img_x, n);
- #endif
- } else
- for (i=0; i < z->s.img_x; ++i) {
- out[0] = out[1] = out[2] = y[i];
- out[3] = 255; // not used if n==3
- out += n;
- }
- } else {
- uint8 *y = coutput[0];
- if (n == 1)
- for (i=0; i < z->s.img_x; ++i) out[i] = y[i];
- else
- for (i=0; i < z->s.img_x; ++i) *out++ = y[i], *out++ = 255;
- }
- }
- cleanup_jpeg(z);
- *out_x = z->s.img_x;
- *out_y = z->s.img_y;
- if (comp) *comp = z->s.img_n; // report original components, not output
- return output;
- }
-}
-
-#ifndef STBI_NO_STDIO
-unsigned char *stbi_jpeg_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- jpeg j;
- start_file(&j.s, f);
- return load_jpeg_image(&j, x,y,comp,req_comp);
-}
-
-unsigned char *stbi_jpeg_load(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- unsigned char *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_jpeg_load_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-#endif
-
-unsigned char *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- jpeg j;
- start_mem(&j.s, buffer,len);
- return load_jpeg_image(&j, x,y,comp,req_comp);
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_jpeg_test_file(FILE *f)
-{
- int n,r;
- jpeg j;
- n = ftell(f);
- start_file(&j.s, f);
- r = decode_jpeg_header(&j, SCAN_type);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_jpeg_test_memory(stbi_uc const *buffer, int len)
-{
- jpeg j;
- start_mem(&j.s, buffer,len);
- return decode_jpeg_header(&j, SCAN_type);
-}
-
-// @TODO:
-#ifndef STBI_NO_STDIO
-extern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp);
-extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-extern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-// public domain zlib decode v0.2 Sean Barrett 2006-11-18
-// simple implementation
-// - all input must be provided in an upfront buffer
-// - all output is written to a single output buffer (can stb_malloc/stb_realloc)
-// performance
-// - fast huffman
-
-// fast-way is faster to check than jpeg huffman, but slow way is slower
-#define ZFAST_BITS 9 // accelerate all cases in default tables
-#define ZFAST_MASK ((1 << ZFAST_BITS) - 1)
-
-// zlib-style huffman encoding
-// (jpegs packs from left, zlib from right, so can't share code)
-typedef struct
-{
- uint16 fast[1 << ZFAST_BITS];
- uint16 firstcode[16];
- int maxcode[17];
- uint16 firstsymbol[16];
- uint8 size[288];
- uint16 value[288];
-} zhuffman;
-
-__forceinline static int bitreverse16(int n)
-{
- n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1);
- n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2);
- n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4);
- n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8);
- return n;
-}
-
-__forceinline static int bit_reverse(int v, int bits)
-{
- assert(bits <= 16);
- // to bit reverse n bits, reverse 16 and shift
- // e.g. 11 bits, bit reverse and shift away 5
- return bitreverse16(v) >> (16-bits);
-}
-
-static int zbuild_huffman(zhuffman *z, uint8 *sizelist, int num)
-{
- int i,k=0;
- int code, next_code[16], sizes[17];
-
- // DEFLATE spec for generating codes
- memset(sizes, 0, sizeof(sizes));
- memset(z->fast, 255, sizeof(z->fast));
- for (i=0; i < num; ++i)
- ++sizes[sizelist[i]];
- sizes[0] = 0;
- for (i=1; i < 16; ++i)
- assert(sizes[i] <= (1 << i));
- code = 0;
- for (i=1; i < 16; ++i) {
- next_code[i] = code;
- z->firstcode[i] = (uint16) code;
- z->firstsymbol[i] = (uint16) k;
- code = (code + sizes[i]);
- if (sizes[i])
- if (code-1 >= (1 << i)) return e("bad codelengths","Corrupt JPEG");
- z->maxcode[i] = code << (16-i); // preshift for inner loop
- code <<= 1;
- k += sizes[i];
- }
- z->maxcode[16] = 0x10000; // sentinel
- for (i=0; i < num; ++i) {
- int s = sizelist[i];
- if (s) {
- int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s];
- z->size[c] = (uint8)s;
- z->value[c] = (uint16)i;
- if (s <= ZFAST_BITS) {
- int k = bit_reverse(next_code[s],s);
- while (k < (1 << ZFAST_BITS)) {
- z->fast[k] = (uint16) c;
- k += (1 << s);
- }
- }
- ++next_code[s];
- }
- }
- return 1;
-}
-
-// zlib-from-memory implementation for PNG reading
-// because PNG allows splitting the zlib stream arbitrarily,
-// and it's annoying structurally to have PNG call ZLIB call PNG,
-// we require PNG read all the IDATs and combine them into a single
-// memory buffer
-
-typedef struct
-{
- uint8 *zbuffer, *zbuffer_end;
- int num_bits;
- uint32 code_buffer;
-
- char *zout;
- char *zout_start;
- char *zout_end;
- int z_expandable;
-
- zhuffman z_length, z_distance;
-} zbuf;
-
-__forceinline static int zget8(zbuf *z)
-{
- if (z->zbuffer >= z->zbuffer_end) return 0;
- return *z->zbuffer++;
-}
-
-static void fill_bits(zbuf *z)
-{
- do {
- assert(z->code_buffer < (1U << z->num_bits));
- z->code_buffer |= zget8(z) << z->num_bits;
- z->num_bits += 8;
- } while (z->num_bits <= 24);
-}
-
-__forceinline static unsigned int zreceive(zbuf *z, int n)
-{
- unsigned int k;
- if (z->num_bits < n) fill_bits(z);
- k = z->code_buffer & ((1 << n) - 1);
- z->code_buffer >>= n;
- z->num_bits -= n;
- return k;
-}
-
-__forceinline static int zhuffman_decode(zbuf *a, zhuffman *z)
-{
- int b,s,k;
- if (a->num_bits < 16) fill_bits(a);
- b = z->fast[a->code_buffer & ZFAST_MASK];
- if (b < 0xffff) {
- s = z->size[b];
- a->code_buffer >>= s;
- a->num_bits -= s;
- return z->value[b];
- }
-
- // not resolved by fast table, so compute it the slow way
- // use jpeg approach, which requires MSbits at top
- k = bit_reverse(a->code_buffer, 16);
- for (s=ZFAST_BITS+1; ; ++s)
- if (k < z->maxcode[s])
- break;
- if (s == 16) return -1; // invalid code!
- // code size is s, so:
- b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s];
- assert(z->size[b] == s);
- a->code_buffer >>= s;
- a->num_bits -= s;
- return z->value[b];
-}
-
-static int expand(zbuf *z, int n) // need to make room for n bytes
-{
- char *q;
- int cur, limit;
- if (!z->z_expandable) return e("output buffer limit","Corrupt PNG");
- cur = (int) (z->zout - z->zout_start);
- limit = (int) (z->zout_end - z->zout_start);
- while (cur + n > limit)
- limit *= 2;
- q = (char *) stb_realloc(z->zout_start, limit);
- if (q == NULL) return e("outofmem", "Out of memory");
- z->zout_start = q;
- z->zout = q + cur;
- z->zout_end = q + limit;
- return 1;
-}
-
-static int length_base[31] = {
- 3,4,5,6,7,8,9,10,11,13,
- 15,17,19,23,27,31,35,43,51,59,
- 67,83,99,115,131,163,195,227,258,0,0 };
-
-static int length_extra[31]=
-{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 };
-
-static int dist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,
-257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0};
-
-static int dist_extra[32] =
-{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
-
-static int parse_huffman_block(zbuf *a)
-{
- for(;;) {
- int z = zhuffman_decode(a, &a->z_length);
- if (z < 256) {
- if (z < 0) return e("bad huffman code","Corrupt PNG"); // error in huffman codes
- if (a->zout >= a->zout_end) if (!expand(a, 1)) return 0;
- *a->zout++ = (char) z;
- } else {
- uint8 *p;
- int len,dist;
- if (z == 256) return 1;
- z -= 257;
- len = length_base[z];
- if (length_extra[z]) len += zreceive(a, length_extra[z]);
- z = zhuffman_decode(a, &a->z_distance);
- if (z < 0) return e("bad huffman code","Corrupt PNG");
- dist = dist_base[z];
- if (dist_extra[z]) dist += zreceive(a, dist_extra[z]);
- if (a->zout - a->zout_start < dist) return e("bad dist","Corrupt PNG");
- if (a->zout + len > a->zout_end) if (!expand(a, len)) return 0;
- p = (uint8 *) (a->zout - dist);
- while (len--)
- *a->zout++ = *p++;
- }
- }
-}
-
-static int compute_huffman_codes(zbuf *a)
-{
- static uint8 length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 };
- zhuffman z_codelength;
- uint8 lencodes[286+32+137];//padding for maximum single op
- uint8 codelength_sizes[19];
- int i,n;
-
- int hlit = zreceive(a,5) + 257;
- int hdist = zreceive(a,5) + 1;
- int hclen = zreceive(a,4) + 4;
-
- memset(codelength_sizes, 0, sizeof(codelength_sizes));
- for (i=0; i < hclen; ++i) {
- int s = zreceive(a,3);
- codelength_sizes[length_dezigzag[i]] = (uint8) s;
- }
- if (!zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0;
-
- n = 0;
- while (n < hlit + hdist) {
- int c = zhuffman_decode(a, &z_codelength);
- assert(c >= 0 && c < 19);
- if (c < 16)
- lencodes[n++] = (uint8) c;
- else if (c == 16) {
- c = zreceive(a,2)+3;
- memset(lencodes+n, lencodes[n-1], c);
- n += c;
- } else if (c == 17) {
- c = zreceive(a,3)+3;
- memset(lencodes+n, 0, c);
- n += c;
- } else {
- assert(c == 18);
- c = zreceive(a,7)+11;
- memset(lencodes+n, 0, c);
- n += c;
- }
- }
- if (n != hlit+hdist) return e("bad codelengths","Corrupt PNG");
- if (!zbuild_huffman(&a->z_length, lencodes, hlit)) return 0;
- if (!zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0;
- return 1;
-}
-
-static int parse_uncompressed_block(zbuf *a)
-{
- uint8 header[4];
- int len,nlen,k;
- if (a->num_bits & 7)
- zreceive(a, a->num_bits & 7); // discard
- // drain the bit-packed data into header
- k = 0;
- while (a->num_bits > 0) {
- header[k++] = (uint8) (a->code_buffer & 255); // wtf this warns?
- a->code_buffer >>= 8;
- a->num_bits -= 8;
- }
- assert(a->num_bits == 0);
- // now fill header the normal way
- while (k < 4)
- header[k++] = (uint8) zget8(a);
- len = header[1] * 256 + header[0];
- nlen = header[3] * 256 + header[2];
- if (nlen != (len ^ 0xffff)) return e("zlib corrupt","Corrupt PNG");
- if (a->zbuffer + len > a->zbuffer_end) return e("read past buffer","Corrupt PNG");
- if (a->zout + len > a->zout_end)
- if (!expand(a, len)) return 0;
- memcpy(a->zout, a->zbuffer, len);
- a->zbuffer += len;
- a->zout += len;
- return 1;
-}
-
-static int parse_zlib_header(zbuf *a)
-{
- int cmf = zget8(a);
- int cm = cmf & 15;
- /* int cinfo = cmf >> 4; */
- int flg = zget8(a);
- if ((cmf*256+flg) % 31 != 0) return e("bad zlib header","Corrupt PNG"); // zlib spec
- if (flg & 32) return e("no preset dict","Corrupt PNG"); // preset dictionary not allowed in png
- if (cm != 8) return e("bad compression","Corrupt PNG"); // DEFLATE required for png
- // window = 1 << (8 + cinfo)... but who cares, we fully buffer output
- return 1;
-}
-
-// @TODO: should statically initialize these for optimal thread safety
-static uint8 default_length[288], default_distance[32];
-static void init_defaults(void)
-{
- int i; // use <= to match clearly with spec
- for (i=0; i <= 143; ++i) default_length[i] = 8;
- for ( ; i <= 255; ++i) default_length[i] = 9;
- for ( ; i <= 279; ++i) default_length[i] = 7;
- for ( ; i <= 287; ++i) default_length[i] = 8;
-
- for (i=0; i <= 31; ++i) default_distance[i] = 5;
-}
-
-int stbi_png_partial; // a quick hack to only allow decoding some of a PNG... I should implement real streaming support instead
-static int parse_zlib(zbuf *a, int parse_header)
-{
- int final, type;
- if (parse_header)
- if (!parse_zlib_header(a)) return 0;
- a->num_bits = 0;
- a->code_buffer = 0;
- do {
- final = zreceive(a,1);
- type = zreceive(a,2);
- if (type == 0) {
- if (!parse_uncompressed_block(a)) return 0;
- } else if (type == 3) {
- return 0;
- } else {
- if (type == 1) {
- // use fixed code lengths
- if (!default_distance[31]) init_defaults();
- if (!zbuild_huffman(&a->z_length , default_length , 288)) return 0;
- if (!zbuild_huffman(&a->z_distance, default_distance, 32)) return 0;
- } else {
- if (!compute_huffman_codes(a)) return 0;
- }
- if (!parse_huffman_block(a)) return 0;
- }
- if (stbi_png_partial && a->zout - a->zout_start > 65536)
- break;
- } while (!final);
- return 1;
-}
-
-static int do_zlib(zbuf *a, char *obuf, int olen, int exp, int parse_header)
-{
- a->zout_start = obuf;
- a->zout = obuf;
- a->zout_end = obuf + olen;
- a->z_expandable = exp;
-
- return parse_zlib(a, parse_header);
-}
-
-char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen)
-{
- zbuf a;
- char *p = (char *) stb_malloc(initial_size);
- if (p == NULL) return NULL;
- a.zbuffer = (uint8 *) buffer;
- a.zbuffer_end = (uint8 *) buffer + len;
- if (do_zlib(&a, p, initial_size, 1, 1)) {
- if (outlen) *outlen = (int) (a.zout - a.zout_start);
- return a.zout_start;
- } else {
- stb_free(a.zout_start);
- return NULL;
- }
-}
-
-char *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen)
-{
- return stbi_zlib_decode_malloc_guesssize(buffer, len, 16384, outlen);
-}
-
-int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen)
-{
- zbuf a;
- a.zbuffer = (uint8 *) ibuffer;
- a.zbuffer_end = (uint8 *) ibuffer + ilen;
- if (do_zlib(&a, obuffer, olen, 0, 1))
- return (int) (a.zout - a.zout_start);
- else
- return -1;
-}
-
-char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen)
-{
- zbuf a;
- char *p = (char *) stb_malloc(16384);
- if (p == NULL) return NULL;
- a.zbuffer = (uint8 *) buffer;
- a.zbuffer_end = (uint8 *) buffer+len;
- if (do_zlib(&a, p, 16384, 1, 0)) {
- if (outlen) *outlen = (int) (a.zout - a.zout_start);
- return a.zout_start;
- } else {
- stb_free(a.zout_start);
- return NULL;
- }
-}
-
-int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen)
-{
- zbuf a;
- a.zbuffer = (uint8 *) ibuffer;
- a.zbuffer_end = (uint8 *) ibuffer + ilen;
- if (do_zlib(&a, obuffer, olen, 0, 0))
- return (int) (a.zout - a.zout_start);
- else
- return -1;
-}
-
-// public domain "baseline" PNG decoder v0.10 Sean Barrett 2006-11-18
-// simple implementation
-// - only 8-bit samples
-// - no CRC checking
-// - allocates lots of intermediate memory
-// - avoids problem of streaming data between subsystems
-// - avoids explicit window management
-// performance
-// - uses stb_zlib, a PD zlib implementation with fast huffman decoding
-
-
-typedef struct
-{
- uint32 length;
- uint32 type;
-} chunk;
-
-#define PNG_TYPE(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
-
-static chunk get_chunk_header(stbi *s)
-{
- chunk c;
- c.length = get32(s);
- c.type = get32(s);
- return c;
-}
-
-static int check_png_header(stbi *s)
-{
- static uint8 png_sig[8] = { 137,80,78,71,13,10,26,10 };
- int i;
- for (i=0; i < 8; ++i)
- if (get8(s) != png_sig[i]) return e("bad png sig","Not a PNG");
- return 1;
-}
-
-typedef struct
-{
- stbi s;
- uint8 *idata, *expanded, *out;
-} png;
-
-
-enum {
- F_none=0, F_sub=1, F_up=2, F_avg=3, F_paeth=4,
- F_avg_first, F_paeth_first,
-};
-
-static uint8 first_row_filter[5] =
-{
- F_none, F_sub, F_none, F_avg_first, F_paeth_first
-};
-
-static int paeth(int a, int b, int c)
-{
- int p = a + b - c;
- int pa = abs(p-a);
- int pb = abs(p-b);
- int pc = abs(p-c);
- if (pa <= pb && pa <= pc) return a;
- if (pb <= pc) return b;
- return c;
-}
-
-// create the png data from post-deflated data
-static int create_png_image_raw(png *a, uint8 *raw, uint32 raw_len, int out_n, uint32 x, uint32 y)
-{
- stbi *s = &a->s;
- uint32 i,j,stride = x*out_n;
- int k;
- int img_n = s->img_n; // copy it into a local for later
- assert(out_n == s->img_n || out_n == s->img_n+1);
- if (stbi_png_partial) y = 1;
- a->out = (uint8 *) stb_malloc(x * y * out_n);
- if (!a->out) return e("outofmem", "Out of memory");
- if (!stbi_png_partial) {
- if (s->img_x == x && s->img_y == y)
- if (raw_len != (img_n * x + 1) * y) return e("not enough pixels","Corrupt PNG");
- else // interlaced:
- if (raw_len < (img_n * x + 1) * y) return e("not enough pixels","Corrupt PNG");
- }
- for (j=0; j < y; ++j) {
- uint8 *cur = a->out + stride*j;
- uint8 *prior = cur - stride;
- int filter = *raw++;
- if (filter > 4) return e("invalid filter","Corrupt PNG");
- // if first row, use special filter that doesn't sample previous row
- if (j == 0) filter = first_row_filter[filter];
- // handle first pixel explicitly
- for (k=0; k < img_n; ++k) {
- switch(filter) {
- case F_none : cur[k] = raw[k]; break;
- case F_sub : cur[k] = raw[k]; break;
- case F_up : cur[k] = raw[k] + prior[k]; break;
- case F_avg : cur[k] = raw[k] + (prior[k]>>1); break;
- case F_paeth : cur[k] = (uint8) (raw[k] + paeth(0,prior[k],0)); break;
- case F_avg_first : cur[k] = raw[k]; break;
- case F_paeth_first: cur[k] = raw[k]; break;
- }
- }
- if (img_n != out_n) cur[img_n] = 255;
- raw += img_n;
- cur += out_n;
- prior += out_n;
- // this is a little gross, so that we don't switch per-pixel or per-component
- if (img_n == out_n) {
- #define CASE(f) \
- case f: \
- for (i=x-1; i >= 1; --i, raw+=img_n,cur+=img_n,prior+=img_n) \
- for (k=0; k < img_n; ++k)
- switch(filter) {
- CASE(F_none) cur[k] = raw[k]; break;
- CASE(F_sub) cur[k] = raw[k] + cur[k-img_n]; break;
- CASE(F_up) cur[k] = raw[k] + prior[k]; break;
- CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-img_n])>>1); break;
- CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],prior[k],prior[k-img_n])); break;
- CASE(F_avg_first) cur[k] = raw[k] + (cur[k-img_n] >> 1); break;
- CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],0,0)); break;
- }
- #undef CASE
- } else {
- assert(img_n+1 == out_n);
- #define CASE(f) \
- case f: \
- for (i=x-1; i >= 1; --i, cur[img_n]=255,raw+=img_n,cur+=out_n,prior+=out_n) \
- for (k=0; k < img_n; ++k)
- switch(filter) {
- CASE(F_none) cur[k] = raw[k]; break;
- CASE(F_sub) cur[k] = raw[k] + cur[k-out_n]; break;
- CASE(F_up) cur[k] = raw[k] + prior[k]; break;
- CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-out_n])>>1); break;
- CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],prior[k],prior[k-out_n])); break;
- CASE(F_avg_first) cur[k] = raw[k] + (cur[k-out_n] >> 1); break;
- CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],0,0)); break;
- }
- #undef CASE
- }
- }
- return 1;
-}
-
-static int create_png_image(png *a, uint8 *raw, uint32 raw_len, int out_n, int interlaced)
-{
- uint8 *final;
- int p;
- int save;
- if (!interlaced)
- return create_png_image_raw(a, raw, raw_len, out_n, a->s.img_x, a->s.img_y);
- save = stbi_png_partial;
- stbi_png_partial = 0;
-
- // de-interlacing
- final = (uint8 *) stb_malloc(a->s.img_x * a->s.img_y * out_n);
- for (p=0; p < 7; ++p) {
- int xorig[] = { 0,4,0,2,0,1,0 };
- int yorig[] = { 0,0,4,0,2,0,1 };
- int xspc[] = { 8,8,4,4,2,2,1 };
- int yspc[] = { 8,8,8,4,4,2,2 };
- int i,j,x,y;
- // pass1_x[4] = 0, pass1_x[5] = 1, pass1_x[12] = 1
- x = (a->s.img_x - xorig[p] + xspc[p]-1) / xspc[p];
- y = (a->s.img_y - yorig[p] + yspc[p]-1) / yspc[p];
- if (x && y) {
- if (!create_png_image_raw(a, raw, raw_len, out_n, x, y)) {
- stb_free(final);
- return 0;
- }
- for (j=0; j < y; ++j)
- for (i=0; i < x; ++i)
- memcpy(final + (j*yspc[p]+yorig[p])*a->s.img_x*out_n + (i*xspc[p]+xorig[p])*out_n,
- a->out + (j*x+i)*out_n, out_n);
- stb_free(a->out);
- raw += (x*out_n+1)*y;
- raw_len -= (x*out_n+1)*y;
- }
- }
- a->out = final;
-
- stbi_png_partial = save;
- return 1;
-}
-
-static int compute_transparency(png *z, uint8 tc[3], int out_n)
-{
- stbi *s = &z->s;
- uint32 i, pixel_count = s->img_x * s->img_y;
- uint8 *p = z->out;
-
- // compute color-based transparency, assuming we've
- // already got 255 as the alpha value in the output
- assert(out_n == 2 || out_n == 4);
-
- if (out_n == 2) {
- for (i=0; i < pixel_count; ++i) {
- p[1] = (p[0] == tc[0] ? 0 : 255);
- p += 2;
- }
- } else {
- for (i=0; i < pixel_count; ++i) {
- if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2])
- p[3] = 0;
- p += 4;
- }
- }
- return 1;
-}
-
-static int expand_palette(png *a, uint8 *palette, int len, int pal_img_n)
-{
- uint32 i, pixel_count = a->s.img_x * a->s.img_y;
- uint8 *p, *temp_out, *orig = a->out;
-
- p = (uint8 *) stb_malloc(pixel_count * pal_img_n);
- if (p == NULL) return e("outofmem", "Out of memory");
-
- // between here and stb_free(out) below, exitting would leak
- temp_out = p;
-
- if (pal_img_n == 3) {
- for (i=0; i < pixel_count; ++i) {
- int n = orig[i]*4;
- p[0] = palette[n ];
- p[1] = palette[n+1];
- p[2] = palette[n+2];
- p += 3;
- }
- } else {
- for (i=0; i < pixel_count; ++i) {
- int n = orig[i]*4;
- p[0] = palette[n ];
- p[1] = palette[n+1];
- p[2] = palette[n+2];
- p[3] = palette[n+3];
- p += 4;
- }
- }
- stb_free(a->out);
- a->out = temp_out;
- return 1;
-}
-
-static int parse_png_file(png *z, int scan, int req_comp)
-{
- uint8 palette[1024], pal_img_n=0;
- uint8 has_trans=0, tc[3];
- uint32 ioff=0, idata_limit=0, i, pal_len=0;
- int first=1,k,interlace=0;
- stbi *s = &z->s;
-
- if (!check_png_header(s)) return 0;
-
- if (scan == SCAN_type) return 1;
-
- for(;;first=0) {
- chunk c = get_chunk_header(s);
- if (first && c.type != PNG_TYPE('I','H','D','R'))
- return e("first not IHDR","Corrupt PNG");
- switch (c.type) {
- case PNG_TYPE('I','H','D','R'): {
- int depth,color,comp,filter;
- if (!first) return e("multiple IHDR","Corrupt PNG");
- if (c.length != 13) return e("bad IHDR len","Corrupt PNG");
- s->img_x = get32(s); if (s->img_x > (1 << 24)) return e("too large","Very large image (corrupt?)");
- s->img_y = get32(s); if (s->img_y > (1 << 24)) return e("too large","Very large image (corrupt?)");
- depth = get8(s); if (depth != 8) return e("8bit only","PNG not supported: 8-bit only");
- color = get8(s); if (color > 6) return e("bad ctype","Corrupt PNG");
- if (color == 3) pal_img_n = 3; else if (color & 1) return e("bad ctype","Corrupt PNG");
- comp = get8(s); if (comp) return e("bad comp method","Corrupt PNG");
- filter= get8(s); if (filter) return e("bad filter method","Corrupt PNG");
- interlace = get8(s); if (interlace>1) return e("bad interlace method","Corrupt PNG");
- if (!s->img_x || !s->img_y) return e("0-pixel image","Corrupt PNG");
- if (!pal_img_n) {
- s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0);
- if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e("too large", "Image too large to decode");
- if (scan == SCAN_header) return 1;
- } else {
- // if paletted, then pal_n is our final components, and
- // img_n is # components to decompress/filter.
- s->img_n = 1;
- if ((1 << 30) / s->img_x / 4 < s->img_y) return e("too large","Corrupt PNG");
- // if SCAN_header, have to scan to see if we have a tRNS
- }
- break;
- }
-
- case PNG_TYPE('P','L','T','E'): {
- if (c.length > 256*3) return e("invalid PLTE","Corrupt PNG");
- pal_len = c.length / 3;
- if (pal_len * 3 != c.length) return e("invalid PLTE","Corrupt PNG");
- for (i=0; i < pal_len; ++i) {
- palette[i*4+0] = get8u(s);
- palette[i*4+1] = get8u(s);
- palette[i*4+2] = get8u(s);
- palette[i*4+3] = 255;
- }
- break;
- }
-
- case PNG_TYPE('t','R','N','S'): {
- if (z->idata) return e("tRNS after IDAT","Corrupt PNG");
- if (pal_img_n) {
- if (scan == SCAN_header) { s->img_n = 4; return 1; }
- if (pal_len == 0) return e("tRNS before PLTE","Corrupt PNG");
- if (c.length > pal_len) return e("bad tRNS len","Corrupt PNG");
- pal_img_n = 4;
- for (i=0; i < c.length; ++i)
- palette[i*4+3] = get8u(s);
- } else {
- if (!(s->img_n & 1)) return e("tRNS with alpha","Corrupt PNG");
- if (c.length != (uint32) s->img_n*2) return e("bad tRNS len","Corrupt PNG");
- has_trans = 1;
- for (k=0; k < s->img_n; ++k)
- tc[k] = (uint8) get16(s); // non 8-bit images will be larger
- }
- break;
- }
-
- case PNG_TYPE('I','D','A','T'): {
- if (pal_img_n && !pal_len) return e("no PLTE","Corrupt PNG");
- if (scan == SCAN_header) { s->img_n = pal_img_n; return 1; }
- if (ioff + c.length > idata_limit) {
- uint8 *p;
- if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096;
- while (ioff + c.length > idata_limit)
- idata_limit *= 2;
- p = (uint8 *) stb_realloc(z->idata, idata_limit); if (p == NULL) return e("outofmem", "Out of memory");
- z->idata = p;
- }
- #ifndef STBI_NO_STDIO
- if (s->img_file)
- {
- if (fread(z->idata+ioff,1,c.length,s->img_file) != c.length) return e("outofdata","Corrupt PNG");
- }
- else
- #endif
- {
- memcpy(z->idata+ioff, s->img_buffer, c.length);
- s->img_buffer += c.length;
- }
- ioff += c.length;
- break;
- }
-
- case PNG_TYPE('I','E','N','D'): {
- uint32 raw_len;
- if (scan != SCAN_load) return 1;
- if (z->idata == NULL) return e("no IDAT","Corrupt PNG");
- z->expanded = (uint8 *) stbi_zlib_decode_malloc((char *) z->idata, ioff, (int *) &raw_len);
- if (z->expanded == NULL) return 0; // zlib should set error
- stb_free(z->idata); z->idata = NULL;
- if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans)
- s->img_out_n = s->img_n+1;
- else
- s->img_out_n = s->img_n;
- if (!create_png_image(z, z->expanded, raw_len, s->img_out_n, interlace)) return 0;
- if (has_trans)
- if (!compute_transparency(z, tc, s->img_out_n)) return 0;
- if (pal_img_n) {
- // pal_img_n == 3 or 4
- s->img_n = pal_img_n; // record the actual colors we had
- s->img_out_n = pal_img_n;
- if (req_comp >= 3) s->img_out_n = req_comp;
- if (!expand_palette(z, palette, pal_len, s->img_out_n))
- return 0;
- }
- stb_free(z->expanded); z->expanded = NULL;
- return 1;
- }
-
- default:
- // if critical, fail
- if ((c.type & (1 << 29)) == 0) {
- #ifndef STBI_NO_FAILURE_STRINGS
- // not threadsafe
- static char invalid_chunk[] = "XXXX chunk not known";
- invalid_chunk[0] = (uint8) (c.type >> 24);
- invalid_chunk[1] = (uint8) (c.type >> 16);
- invalid_chunk[2] = (uint8) (c.type >> 8);
- invalid_chunk[3] = (uint8) (c.type >> 0);
- #endif
- return e(invalid_chunk, "PNG not supported: unknown chunk type");
- }
- skip(s, c.length);
- break;
- }
- // end of chunk, read and skip CRC
- get32(s);
- }
-}
-
-static unsigned char *do_png(png *p, int *x, int *y, int *n, int req_comp)
-{
- unsigned char *result=NULL;
- p->expanded = NULL;
- p->idata = NULL;
- p->out = NULL;
- if (req_comp < 0 || req_comp > 4) return epuc("bad req_comp", "Internal error");
- if (parse_png_file(p, SCAN_load, req_comp)) {
- result = p->out;
- p->out = NULL;
- if (req_comp && req_comp != p->s.img_out_n) {
- result = convert_format(result, p->s.img_out_n, req_comp, p->s.img_x, p->s.img_y);
- p->s.img_out_n = req_comp;
- if (result == NULL) return result;
- }
- *x = p->s.img_x;
- *y = p->s.img_y;
- if (n) *n = p->s.img_n;
- }
- stb_free(p->out); p->out = NULL;
- stb_free(p->expanded); p->expanded = NULL;
- stb_free(p->idata); p->idata = NULL;
-
- return result;
-}
-
-#ifndef STBI_NO_STDIO
-unsigned char *stbi_png_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- png p;
- start_file(&p.s, f);
- return do_png(&p, x,y,comp,req_comp);
-}
-
-unsigned char *stbi_png_load(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- unsigned char *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_png_load_from_file(f,x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-#endif
-
-unsigned char *stbi_png_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- png p;
- start_mem(&p.s, buffer,len);
- return do_png(&p, x,y,comp,req_comp);
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_png_test_file(FILE *f)
-{
- png p;
- int n,r;
- n = ftell(f);
- start_file(&p.s, f);
- r = parse_png_file(&p, SCAN_type,STBI_default);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_png_test_memory(stbi_uc const *buffer, int len)
-{
- png p;
- start_mem(&p.s, buffer, len);
- return parse_png_file(&p, SCAN_type,STBI_default);
-}
-
-// TODO: load header from png
-#ifndef STBI_NO_STDIO
-int stbi_png_info (char const *filename, int *x, int *y, int *comp)
-{
- png p;
- FILE *f = fopen(filename, "rb");
- if (!f) return 0;
- start_file(&p.s, f);
- if (parse_png_file(&p, SCAN_header, 0)) {
- if(x) *x = p.s.img_x;
- if(y) *y = p.s.img_y;
- if (comp) *comp = p.s.img_n;
- fclose(f);
- return 1;
- }
- fclose(f);
- return 0;
-}
-
-extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp);
-#endif
-extern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp);
-
-// Microsoft/Windows BMP image
-
-static int bmp_test(stbi *s)
-{
- int sz;
- if (get8(s) != 'B') return 0;
- if (get8(s) != 'M') return 0;
- get32le(s); // discard filesize
- get16le(s); // discard reserved
- get16le(s); // discard reserved
- get32le(s); // discard data offset
- sz = get32le(s);
- if (sz == 12 || sz == 40 || sz == 56 || sz == 108) return 1;
- return 0;
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_bmp_test_file (FILE *f)
-{
- stbi s;
- int r,n = ftell(f);
- start_file(&s,f);
- r = bmp_test(&s);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_bmp_test_memory (stbi_uc const *buffer, int len)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return bmp_test(&s);
-}
-
-// returns 0..31 for the highest set bit
-static int high_bit(unsigned int z)
-{
- int n=0;
- if (z == 0) return -1;
- if (z >= 0x10000) n += 16, z >>= 16;
- if (z >= 0x00100) n += 8, z >>= 8;
- if (z >= 0x00010) n += 4, z >>= 4;
- if (z >= 0x00004) n += 2, z >>= 2;
- if (z >= 0x00002) n += 1, z >>= 1;
- return n;
-}
-
-static int bitcount(unsigned int a)
-{
- a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2
- a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4
- a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits
- a = (a + (a >> 8)); // max 16 per 8 bits
- a = (a + (a >> 16)); // max 32 per 8 bits
- return a & 0xff;
-}
-
-static int shiftsigned(int v, int shift, int bits)
-{
- int result;
- int z=0;
-
- if (shift < 0) v <<= -shift;
- else v >>= shift;
- result = v;
-
- z = bits;
- while (z < 8) {
- result += v >> z;
- z += bits;
- }
- return result;
-}
-
-static stbi_uc *bmp_load(stbi *s, int *x, int *y, int *comp, int req_comp)
-{
- uint8 *out;
- unsigned int mr=0,mg=0,mb=0,ma=0, fake_a=0;
- stbi_uc pal[256][4];
- int psize=0,i,j,compress=0,width;
- int bpp, flip_vertically, pad, target, offset, hsz;
- if (get8(s) != 'B' || get8(s) != 'M') return epuc("not BMP", "Corrupt BMP");
- get32le(s); // discard filesize
- get16le(s); // discard reserved
- get16le(s); // discard reserved
- offset = get32le(s);
- hsz = get32le(s);
- if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108) return epuc("unknown BMP", "BMP type not supported: unknown");
- failure_reason = "bad BMP";
- if (hsz == 12) {
- s->img_x = get16le(s);
- s->img_y = get16le(s);
- } else {
- s->img_x = get32le(s);
- s->img_y = get32le(s);
- }
- if (get16le(s) != 1) return 0;
- bpp = get16le(s);
- if (bpp == 1) return epuc("monochrome", "BMP type not supported: 1-bit");
- flip_vertically = ((int) s->img_y) > 0;
- s->img_y = abs((int) s->img_y);
- if (hsz == 12) {
- if (bpp < 24)
- psize = (offset - 14 - 24) / 3;
- } else {
- compress = get32le(s);
- if (compress == 1 || compress == 2) return epuc("BMP RLE", "BMP type not supported: RLE");
- get32le(s); // discard sizeof
- get32le(s); // discard hres
- get32le(s); // discard vres
- get32le(s); // discard colorsused
- get32le(s); // discard max important
- if (hsz == 40 || hsz == 56) {
- if (hsz == 56) {
- get32le(s);
- get32le(s);
- get32le(s);
- get32le(s);
- }
- if (bpp == 16 || bpp == 32) {
- mr = mg = mb = 0;
- if (compress == 0) {
- if (bpp == 32) {
- mr = 0xff << 16;
- mg = 0xff << 8;
- mb = 0xff << 0;
- ma = (unsigned int)(0xff << 24);
- fake_a = 1; // @TODO: check for cases like alpha value is all 0 and switch it to 255
- } else {
- mr = 31 << 10;
- mg = 31 << 5;
- mb = 31 << 0;
- }
- } else if (compress == 3) {
- mr = get32le(s);
- mg = get32le(s);
- mb = get32le(s);
- // not documented, but generated by photoshop and handled by mspaint
- if (mr == mg && mg == mb) {
- // ?!?!?
- return NULL;
- }
- } else
- return NULL;
- }
- } else {
- assert(hsz == 108);
- mr = get32le(s);
- mg = get32le(s);
- mb = get32le(s);
- ma = get32le(s);
- get32le(s); // discard color space
- for (i=0; i < 12; ++i)
- get32le(s); // discard color space parameters
- }
- if (bpp < 16)
- psize = (offset - 14 - hsz) >> 2;
- }
- s->img_n = ma ? 4 : 3;
- if (req_comp && req_comp >= 3) // we can directly decode 3 or 4
- target = req_comp;
- else
- target = s->img_n; // if they want monochrome, we'll post-convert
- out = (stbi_uc *) stb_malloc(target * s->img_x * s->img_y);
- if (!out) return epuc("outofmem", "Out of memory");
- if (bpp < 16) {
- int z=0;
- if (psize == 0 || psize > 256) { stb_free(out); return epuc("invalid", "Corrupt BMP"); }
- for (i=0; i < psize; ++i) {
- pal[i][2] = get8(s);
- pal[i][1] = get8(s);
- pal[i][0] = get8(s);
- if (hsz != 12) get8(s);
- pal[i][3] = 255;
- }
- skip(s, offset - 14 - hsz - psize * (hsz == 12 ? 3 : 4));
- if (bpp == 4) width = (s->img_x + 1) >> 1;
- else if (bpp == 8) width = s->img_x;
- else { stb_free(out); return epuc("bad bpp", "Corrupt BMP"); }
- pad = (-width)&3;
- for (j=0; j < (int) s->img_y; ++j) {
- for (i=0; i < (int) s->img_x; i += 2) {
- int v=get8(s),v2=0;
- if (bpp == 4) {
- v2 = v & 15;
- v >>= 4;
- }
- out[z++] = pal[v][0];
- out[z++] = pal[v][1];
- out[z++] = pal[v][2];
- if (target == 4) out[z++] = 255;
- if (i+1 == (int) s->img_x) break;
- v = (bpp == 8) ? get8(s) : v2;
- out[z++] = pal[v][0];
- out[z++] = pal[v][1];
- out[z++] = pal[v][2];
- if (target == 4) out[z++] = 255;
- }
- skip(s, pad);
- }
- } else {
- int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0;
- int z = 0;
- int easy=0;
- skip(s, offset - 14 - hsz);
- if (bpp == 24) width = 3 * s->img_x;
- else if (bpp == 16) width = 2*s->img_x;
- else /* bpp = 32 and pad = 0 */ width=0;
- pad = (-width) & 3;
- if (bpp == 24) {
- easy = 1;
- } else if (bpp == 32) {
- if (mb == 0xff && mg == 0xff00 && mr == 0xff000000 && ma == 0xff000000)
- easy = 2;
- }
- if (!easy) {
- if (!mr || !mg || !mb) return epuc("bad masks", "Corrupt BMP");
- // right shift amt to put high bit in position #7
- rshift = high_bit(mr)-7; rcount = bitcount(mr);
- gshift = high_bit(mg)-7; gcount = bitcount(mr);
- bshift = high_bit(mb)-7; bcount = bitcount(mr);
- ashift = high_bit(ma)-7; acount = bitcount(mr);
- }
- for (j=0; j < (int) s->img_y; ++j) {
- if (easy) {
- for (i=0; i < (int) s->img_x; ++i) {
- int a;
- out[z+2] = get8(s);
- out[z+1] = get8(s);
- out[z+0] = get8(s);
- z += 3;
- a = (easy == 2 ? get8(s) : 255);
- if (target == 4) out[z++] = a;
- }
- } else {
- for (i=0; i < (int) s->img_x; ++i) {
- uint32 v = (bpp == 16 ? get16le(s) : get32le(s));
- int a;
- out[z++] = shiftsigned(v & mr, rshift, rcount);
- out[z++] = shiftsigned(v & mg, gshift, gcount);
- out[z++] = shiftsigned(v & mb, bshift, bcount);
- a = (ma ? shiftsigned(v & ma, ashift, acount) : 255);
- if (target == 4) out[z++] = a;
- }
- }
- skip(s, pad);
- }
- }
- if (flip_vertically) {
- stbi_uc t;
- for (j=0; j < (int) s->img_y>>1; ++j) {
- stbi_uc *p1 = out + j *s->img_x*target;
- stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target;
- for (i=0; i < (int) s->img_x*target; ++i) {
- t = p1[i], p1[i] = p2[i], p2[i] = t;
- }
- }
- }
-
- if (req_comp && req_comp != target) {
- out = convert_format(out, target, req_comp, s->img_x, s->img_y);
- if (out == NULL) return out; // convert_format frees input on failure
- }
-
- *x = s->img_x;
- *y = s->img_y;
- if (comp) *comp = target;
- return out;
-}
-
-#ifndef STBI_NO_STDIO
-stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- stbi_uc *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_bmp_load_from_file(f, x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-
-stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_file(&s, f);
- return bmp_load(&s, x,y,comp,req_comp);
-}
-#endif
-
-stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return bmp_load(&s, x,y,comp,req_comp);
-}
-
-// Targa Truevision - TGA
-// by Jonathan Dummer
-
-static int tga_test(stbi *s)
-{
- int sz;
- get8u(s); // discard Offset
- sz = get8u(s); // color type
- if( sz > 1 ) return 0; // only RGB or indexed allowed
- sz = get8u(s); // image type
- if( (sz != 1) && (sz != 2) && (sz != 3) && (sz != 9) && (sz != 10) && (sz != 11) ) return 0; // only RGB or grey allowed, +/- RLE
- get16(s); // discard palette start
- get16(s); // discard palette length
- get8(s); // discard bits per palette color entry
- get16(s); // discard x origin
- get16(s); // discard y origin
- if( get16(s) < 1 ) return 0; // test width
- if( get16(s) < 1 ) return 0; // test height
- sz = get8(s); // bits per pixel
- if( (sz != 8) && (sz != 16) && (sz != 24) && (sz != 32) ) return 0; // only RGB or RGBA or grey allowed
- return 1; // seems to have passed everything
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_tga_test_file (FILE *f)
-{
- stbi s;
- int r,n = ftell(f);
- start_file(&s, f);
- r = tga_test(&s);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_tga_test_memory (stbi_uc const *buffer, int len)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return tga_test(&s);
-}
-
-static stbi_uc *tga_load(stbi *s, int *x, int *y, int *comp, int req_comp)
-{
- // read in the TGA header stuff
- int tga_offset = get8u(s);
- int tga_indexed = get8u(s);
- int tga_image_type = get8u(s);
- int tga_is_RLE = 0;
- int tga_palette_start = get16le(s);
- int tga_palette_len = get16le(s);
- int tga_palette_bits = get8u(s);
- int tga_x_origin = get16le(s);
- int tga_y_origin = get16le(s);
- int tga_width = get16le(s);
- int tga_height = get16le(s);
- int tga_bits_per_pixel = get8u(s);
- int tga_inverted = get8u(s);
- // image data
- unsigned char *tga_data;
- unsigned char *tga_palette = NULL;
- int i, j;
- unsigned char raw_data[4];
- unsigned char trans_data[4];
- int RLE_count = 0;
- int RLE_repeating = 0;
- int read_next_pixel = 1;
- // do a tiny bit of precessing
- if( tga_image_type >= 8 )
- {
- tga_image_type -= 8;
- tga_is_RLE = 1;
- }
- /* int tga_alpha_bits = tga_inverted & 15; */
- tga_inverted = 1 - ((tga_inverted >> 5) & 1);
-
- // error check
- if( //(tga_indexed) ||
- (tga_width < 1) || (tga_height < 1) ||
- (tga_image_type < 1) || (tga_image_type > 3) ||
- ((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16) &&
- (tga_bits_per_pixel != 24) && (tga_bits_per_pixel != 32))
- )
- {
- return NULL;
- }
-
- // If I'm paletted, then I'll use the number of bits from the palette
- if( tga_indexed )
- {
- tga_bits_per_pixel = tga_palette_bits;
- }
-
- // tga info
- *x = tga_width;
- *y = tga_height;
- if( (req_comp < 1) || (req_comp > 4) )
- {
- // just use whatever the file was
- req_comp = tga_bits_per_pixel / 8;
- *comp = req_comp;
- } else
- {
- // force a new number of components
- *comp = tga_bits_per_pixel/8;
- }
- tga_data = (unsigned char*)stb_malloc( tga_width * tga_height * req_comp );
-
- // skip to the data's starting position (offset usually = 0)
- skip(s, tga_offset );
- // do I need to load a palette?
- if( tga_indexed )
- {
- // any data to skip? (offset usually = 0)
- skip(s, tga_palette_start );
- // load the palette
- tga_palette = (unsigned char*)stb_malloc( tga_palette_len * tga_palette_bits / 8 );
- getn(s, tga_palette, tga_palette_len * tga_palette_bits / 8 );
- }
- // load the data
- for( i = 0; i < tga_width * tga_height; ++i )
- {
- // if I'm in RLE mode, do I need to get a RLE chunk?
- if( tga_is_RLE )
- {
- if( RLE_count == 0 )
- {
- // yep, get the next byte as a RLE command
- int RLE_cmd = get8u(s);
- RLE_count = 1 + (RLE_cmd & 127);
- RLE_repeating = RLE_cmd >> 7;
- read_next_pixel = 1;
- } else if( !RLE_repeating )
- {
- read_next_pixel = 1;
- }
- } else
- {
- read_next_pixel = 1;
- }
- // OK, if I need to read a pixel, do it now
- if( read_next_pixel )
- {
- // load however much data we did have
- if( tga_indexed )
- {
- // read in 1 byte, then perform the lookup
- int pal_idx = get8u(s);
- if( pal_idx >= tga_palette_len )
- {
- // invalid index
- pal_idx = 0;
- }
- pal_idx *= tga_bits_per_pixel / 8;
- for( j = 0; j*8 < tga_bits_per_pixel; ++j )
- {
- raw_data[j] = tga_palette[pal_idx+j];
- }
- } else
- {
- // read in the data raw
- for( j = 0; j*8 < tga_bits_per_pixel; ++j )
- {
- raw_data[j] = get8u(s);
- }
- }
- // convert raw to the intermediate format
- switch( tga_bits_per_pixel )
- {
- case 8:
- // Luminous => RGBA
- trans_data[0] = raw_data[0];
- trans_data[1] = raw_data[0];
- trans_data[2] = raw_data[0];
- trans_data[3] = 255;
- break;
- case 16:
- // Luminous,Alpha => RGBA
- trans_data[0] = raw_data[0];
- trans_data[1] = raw_data[0];
- trans_data[2] = raw_data[0];
- trans_data[3] = raw_data[1];
- break;
- case 24:
- // BGR => RGBA
- trans_data[0] = raw_data[2];
- trans_data[1] = raw_data[1];
- trans_data[2] = raw_data[0];
- trans_data[3] = 255;
- break;
- case 32:
- // BGRA => RGBA
- trans_data[0] = raw_data[2];
- trans_data[1] = raw_data[1];
- trans_data[2] = raw_data[0];
- trans_data[3] = raw_data[3];
- break;
- }
- // clear the reading flag for the next pixel
- read_next_pixel = 0;
- } // end of reading a pixel
- // convert to final format
- switch( req_comp )
- {
- case 1:
- // RGBA => Luminance
- tga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]);
- break;
- case 2:
- // RGBA => Luminance,Alpha
- tga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]);
- tga_data[i*req_comp+1] = trans_data[3];
- break;
- case 3:
- // RGBA => RGB
- tga_data[i*req_comp+0] = trans_data[0];
- tga_data[i*req_comp+1] = trans_data[1];
- tga_data[i*req_comp+2] = trans_data[2];
- break;
- case 4:
- // RGBA => RGBA
- tga_data[i*req_comp+0] = trans_data[0];
- tga_data[i*req_comp+1] = trans_data[1];
- tga_data[i*req_comp+2] = trans_data[2];
- tga_data[i*req_comp+3] = trans_data[3];
- break;
- }
- // in case we're in RLE mode, keep counting down
- --RLE_count;
- }
- // do I need to invert the image?
- if( tga_inverted )
- {
- for( j = 0; j*2 < tga_height; ++j )
- {
- int index1 = j * tga_width * req_comp;
- int index2 = (tga_height - 1 - j) * tga_width * req_comp;
- for( i = tga_width * req_comp; i > 0; --i )
- {
- unsigned char temp = tga_data[index1];
- tga_data[index1] = tga_data[index2];
- tga_data[index2] = temp;
- ++index1;
- ++index2;
- }
- }
- }
- // clear my palette, if I had one
- if( tga_palette != NULL )
- {
- stb_free( tga_palette );
- }
- // the things I do to get rid of an error message, and yet keep
- // Microsoft's C compilers happy... [8^(
- tga_palette_start = tga_palette_len = tga_palette_bits =
- tga_x_origin = tga_y_origin = 0;
- // OK, done
- return tga_data;
-}
-
-#ifndef STBI_NO_STDIO
-stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- stbi_uc *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_tga_load_from_file(f, x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-
-stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_file(&s, f);
- return tga_load(&s, x,y,comp,req_comp);
-}
-#endif
-
-stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return tga_load(&s, x,y,comp,req_comp);
-}
-
-
-// *************************************************************************************************
-// Photoshop PSD loader -- PD by Thatcher Ulrich, integration by Nicholas Schulz, tweaked by STB
-
-static int psd_test(stbi *s)
-{
- if (get32(s) != 0x38425053) return 0; // "8BPS"
- else return 1;
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_psd_test_file(FILE *f)
-{
- stbi s;
- int r,n = ftell(f);
- start_file(&s, f);
- r = psd_test(&s);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-int stbi_psd_test_memory(stbi_uc const *buffer, int len)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return psd_test(&s);
-}
-
-static stbi_uc *psd_load(stbi *s, int *x, int *y, int *comp, int req_comp)
-{
- int pixelCount;
- int channelCount, compression;
- int channel, i, count, len;
- int w,h;
- uint8 *out;
-
- // Check identifier
- if (get32(s) != 0x38425053) // "8BPS"
- return epuc("not PSD", "Corrupt PSD image");
-
- // Check file type version.
- if (get16(s) != 1)
- return epuc("wrong version", "Unsupported version of PSD image");
-
- // Skip 6 reserved bytes.
- skip(s, 6 );
-
- // Read the number of channels (R, G, B, A, etc).
- channelCount = get16(s);
- if (channelCount < 0 || channelCount > 16)
- return epuc("wrong channel count", "Unsupported number of channels in PSD image");
-
- // Read the rows and columns of the image.
- h = get32(s);
- w = get32(s);
-
- // Make sure the depth is 8 bits.
- if (get16(s) != 8)
- return epuc("unsupported bit depth", "PSD bit depth is not 8 bit");
-
- // Make sure the color mode is RGB.
- // Valid options are:
- // 0: Bitmap
- // 1: Grayscale
- // 2: Indexed color
- // 3: RGB color
- // 4: CMYK color
- // 7: Multichannel
- // 8: Duotone
- // 9: Lab color
- if (get16(s) != 3)
- return epuc("wrong color format", "PSD is not in RGB color format");
-
- // Skip the Mode Data. (It's the palette for indexed color; other info for other modes.)
- skip(s,get32(s) );
-
- // Skip the image resources. (resolution, pen tool paths, etc)
- skip(s, get32(s) );
-
- // Skip the reserved data.
- skip(s, get32(s) );
-
- // Find out if the data is compressed.
- // Known values:
- // 0: no compression
- // 1: RLE compressed
- compression = get16(s);
- if (compression > 1)
- return epuc("bad compression", "PSD has an unknown compression format");
-
- // Create the destination image.
- out = (stbi_uc *) stb_malloc(4 * w*h);
- if (!out) return epuc("outofmem", "Out of memory");
- pixelCount = w*h;
-
- // Initialize the data to zero.
- //memset( out, 0, pixelCount * 4 );
-
- // Finally, the image data.
- if (compression) {
- // RLE as used by .PSD and .TIFF
- // Loop until you get the number of unpacked bytes you are expecting:
- // Read the next source byte into n.
- // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally.
- // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times.
- // Else if n is 128, noop.
- // Endloop
-
- // The RLE-compressed data is preceeded by a 2-byte data count for each row in the data,
- // which we're going to just skip.
- skip(s, h * channelCount * 2 );
-
- // Read the RLE data by channel.
- for (channel = 0; channel < 4; channel++) {
- uint8 *p;
-
- p = out+channel;
- if (channel >= channelCount) {
- // Fill this channel with default data.
- for (i = 0; i < pixelCount; i++) *p = (channel == 3 ? 255 : 0), p += 4;
- } else {
- // Read the RLE data.
- count = 0;
- while (count < pixelCount) {
- len = get8(s);
- if (len == 128) {
- // No-op.
- } else if (len < 128) {
- // Copy next len+1 bytes literally.
- len++;
- count += len;
- while (len) {
- *p = get8(s);
- p += 4;
- len--;
- }
- } else if (len > 128) {
- uint32 val;
- // Next -len+1 bytes in the dest are replicated from next source byte.
- // (Interpret len as a negative 8-bit int.)
- len ^= 0x0FF;
- len += 2;
- val = get8(s);
- count += len;
- while (len) {
- *p = val;
- p += 4;
- len--;
- }
- }
- }
- }
- }
-
- } else {
- // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...)
- // where each channel consists of an 8-bit value for each pixel in the image.
-
- // Read the data by channel.
- for (channel = 0; channel < 4; channel++) {
- uint8 *p;
-
- p = out + channel;
- if (channel > channelCount) {
- // Fill this channel with default data.
- for (i = 0; i < pixelCount; i++) *p = channel == 3 ? 255 : 0, p += 4;
- } else {
- // Read the data.
- count = 0;
- for (i = 0; i < pixelCount; i++)
- *p = get8(s), p += 4;
- }
- }
- }
-
- if (req_comp && req_comp != 4) {
- out = convert_format(out, 4, req_comp, w, h);
- if (out == NULL) return out; // convert_format frees input on failure
- }
-
- if (comp) *comp = channelCount;
- *y = h;
- *x = w;
-
- return out;
-}
-
-#ifndef STBI_NO_STDIO
-stbi_uc *stbi_psd_load(char const *filename, int *x, int *y, int *comp, int req_comp)
-{
- stbi_uc *data;
- FILE *f = fopen(filename, "rb");
- if (!f) return NULL;
- data = stbi_psd_load_from_file(f, x,y,comp,req_comp);
- fclose(f);
- return data;
-}
-
-stbi_uc *stbi_psd_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_file(&s, f);
- return psd_load(&s, x,y,comp,req_comp);
-}
-#endif
-
-stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return psd_load(&s, x,y,comp,req_comp);
-}
-
-
-// *************************************************************************************************
-// Radiance RGBE HDR loader
-// originally by Nicolas Schulz
-#ifndef STBI_NO_HDR
-static int hdr_test(stbi *s)
-{
- char *signature = "#?RADIANCE\n";
- int i;
- for (i=0; signature[i]; ++i)
- if (get8(s) != signature[i])
- return 0;
- return 1;
-}
-
-int stbi_hdr_test_memory(stbi_uc const *buffer, int len)
-{
- stbi s;
- start_mem(&s, buffer, len);
- return hdr_test(&s);
-}
-
-#ifndef STBI_NO_STDIO
-int stbi_hdr_test_file(FILE *f)
-{
- stbi s;
- int r,n = ftell(f);
- start_file(&s, f);
- r = hdr_test(&s);
- fseek(f,n,SEEK_SET);
- return r;
-}
-#endif
-
-#define HDR_BUFLEN 1024
-static char *hdr_gettoken(stbi *z, char *buffer)
-{
- int len=0;
- char *s = buffer, c = '\0';
- s;
-
- c = get8(z);
-
- while (!at_eof(z) && c != '\n') {
- buffer[len++] = c;
- if (len == HDR_BUFLEN-1) {
- // flush to end of line
- while (!at_eof(z) && get8(z) != '\n')
- ;
- break;
- }
- c = get8(z);
- }
-
- buffer[len] = 0;
- return buffer;
-}
-
-static void hdr_convert(float *output, stbi_uc *input, int req_comp)
-{
- if( input[3] != 0 ) {
- float f1;
- // Exponent
- f1 = (float) ldexp(1.0f, input[3] - (int)(128 + 8));
- if (req_comp <= 2)
- output[0] = (input[0] + input[1] + input[2]) * f1 / 3;
- else {
- output[0] = input[0] * f1;
- output[1] = input[1] * f1;
- output[2] = input[2] * f1;
- }
- if (req_comp == 2) output[1] = 1;
- if (req_comp == 4) output[3] = 1;
- } else {
- switch (req_comp) {
- case 4: output[3] = 1; /* fallthrough */
- case 3: output[0] = output[1] = output[2] = 0;
- break;
- case 2: output[1] = 1; /* fallthrough */
- case 1: output[0] = 0;
- break;
- }
- }
-}
-
-
-static float *hdr_load(stbi *s, int *x, int *y, int *comp, int req_comp)
-{
- char buffer[HDR_BUFLEN];
- char *token;
- int valid = 0;
- int width, height;
- stbi_uc *scanline;
- float *hdr_data;
- int len;
- unsigned char count, value;
- int i, j, k, c1,c2, z;
-
-
- // Check identifier
- if (strcmp(hdr_gettoken(s,buffer), "#?RADIANCE") != 0)
- return epf("not HDR", "Corrupt HDR image");
-
- // Parse header
- while(1) {
- token = hdr_gettoken(s,buffer);
- if (token[0] == 0) break;
- if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1;
- }
-
- if (!valid) return epf("unsupported format", "Unsupported HDR format");
-
- // Parse width and height
- // can't use sscanf() if we're not using stdio!
- token = hdr_gettoken(s,buffer);
- if (strncmp(token, "-Y ", 3)) return epf("unsupported data layout", "Unsupported HDR format");
- token += 3;
- height = strtol(token, &token, 10);
- while (*token == ' ') ++token;
- if (strncmp(token, "+X ", 3)) return epf("unsupported data layout", "Unsupported HDR format");
- token += 3;
- width = strtol(token, NULL, 10);
-
- *x = width;
- *y = height;
-
- *comp = 3;
- if (req_comp == 0) req_comp = 3;
-
- // Read data
- hdr_data = (float *) stb_malloc(height * width * req_comp * sizeof(float));
-
- // Load image data
- // image data is stored as some number of sca
- if( width < 8 || width >= 32768) {
- // Read flat data
- for (j=0; j < height; ++j) {
- for (i=0; i < width; ++i) {
- stbi_uc rgbe[4];
- main_decode_loop:
- getn(s, rgbe, 4);
- hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp);
- }
- }
- } else {
- // Read RLE-encoded data
- scanline = NULL;
-
- for (j = 0; j < height; ++j) {
- c1 = get8(s);
- c2 = get8(s);
- len = get8(s);
- if (c1 != 2 || c2 != 2 || (len & 0x80)) {
- // not run-length encoded, so we have to actually use THIS data as a decoded
- // pixel (note this can't be a valid pixel--one of RGB must be >= 128)
- stbi_uc rgbe[4] = { c1,c2,len, get8(s) };
- hdr_convert(hdr_data, rgbe, req_comp);
- i = 1;
- j = 0;
- stb_free(scanline);
- goto main_decode_loop; // yes, this is fucking insane; blame the fucking insane format
- }
- len <<= 8;
- len |= get8(s);
- if (len != width) { stb_free(hdr_data); stb_free(scanline); return epf("invalid decoded scanline length", "corrupt HDR"); }
- if (scanline == NULL) scanline = (stbi_uc *) stb_malloc(width * 4);
-
- for (k = 0; k < 4; ++k) {
- i = 0;
- while (i < width) {
- count = get8(s);
- if (count > 128) {
- // Run
- value = get8(s);
- count -= 128;
- for (z = 0; z < count; ++z)
- scanline[i++ * 4 + k] = value;
- } else {
- // Dump
- for (z = 0; z < count; ++z)
- scanline[i++ * 4 + k] = get8(s);
- }
- }
- }
- for (i=0; i < width; ++i)
- hdr_convert(hdr_data+(j*width + i)*req_comp, scanline + i*4, req_comp);
- }
- stb_free(scanline);
- }
-
- return hdr_data;
-}
-
-#ifndef STBI_NO_STDIO
-float *stbi_hdr_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_file(&s,f);
- return hdr_load(&s,x,y,comp,req_comp);
-}
-#endif
-
-float *stbi_hdr_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
-{
- stbi s;
- start_mem(&s,buffer, len);
- return hdr_load(&s,x,y,comp,req_comp);
-}
-
-#endif // STBI_NO_HDR
-
-/////////////////////// write image ///////////////////////
-
-#ifndef STBI_NO_WRITE
-
-static void write8(FILE *f, int x) { uint8 z = (uint8) x; fwrite(&z,1,1,f); }
-
-static void writefv(FILE *f, char *fmt, va_list v)
-{
- while (*fmt) {
- switch (*fmt++) {
- case ' ': break;
- case '1': { uint8 x = va_arg(v, int); write8(f,x); break; }
- case '2': { int16 x = va_arg(v, int); write8(f,x); write8(f,x>>8); break; }
- case '4': { int32 x = va_arg(v, int); write8(f,x); write8(f,x>>8); write8(f,x>>16); write8(f,x>>24); break; }
- default:
- assert(0);
- va_end(v);
- return;
- }
- }
-}
-
-static void writef(FILE *f, char *fmt, ...)
-{
- va_list v;
- va_start(v, fmt);
- writefv(f,fmt,v);
- va_end(v);
-}
-
-static void write_pixels(FILE *f, int rgb_dir, int vdir, int x, int y, int comp, const void *data, int write_alpha, int scanline_pad)
-{
- uint8 bg[3] = { 255, 0, 255}, px[3];
- uint32 zero = 0;
- int i,j,k, j_end;
-
- if (vdir < 0)
- j_end = -1, j = y-1;
- else
- j_end = y, j = 0;
-
- for (; j != j_end; j += vdir) {
- for (i=0; i < x; ++i) {
- uint8 *d = (uint8 *) data + (j*x+i)*comp;
- if (write_alpha < 0)
- fwrite(&d[comp-1], 1, 1, f);
- switch (comp) {
- case 1:
- case 2: writef(f, "111", d[0],d[0],d[0]);
- break;
- case 4:
- if (!write_alpha) {
- for (k=0; k < 3; ++k)
- px[k] = bg[k] + ((d[k] - bg[k]) * d[3])/255;
- writef(f, "111", px[1-rgb_dir],px[1],px[1+rgb_dir]);
- break;
- }
- /* FALLTHROUGH */
- case 3:
- writef(f, "111", d[1-rgb_dir],d[1],d[1+rgb_dir]);
- break;
- }
- if (write_alpha > 0)
- fwrite(&d[comp-1], 1, 1, f);
- }
- fwrite(&zero,scanline_pad,1,f);
- }
-}
-
-static int outfile(char const *filename, int rgb_dir, int vdir, int x, int y, int comp, const void *data, int alpha, int pad, char *fmt, ...)
-{
- FILE *f = fopen(filename, "wb");
- if (f) {
- va_list v;
- va_start(v, fmt);
- writefv(f, fmt, v);
- va_end(v);
- write_pixels(f,rgb_dir,vdir,x,y,comp,data,alpha,pad);
- fclose(f);
- }
- return f != NULL;
-}
-
-static int outfile_w(wchar_t const *filename, int rgb_dir, int vdir, int x, int y, int comp, const void *data, int alpha, int pad, char *fmt, ...)
-{
- FILE *f = _wfopen(filename, L"wb");
- if (f) {
- va_list v;
- va_start(v, fmt);
- writefv(f, fmt, v);
- va_end(v);
- write_pixels(f,rgb_dir,vdir,x,y,comp,data,alpha,pad);
- fclose(f);
- }
- return f != NULL;
-}
-
-int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data)
-{
- int pad = (-x*3) & 3;
- return outfile(filename,-1,-1,x,y,comp,data,0,pad,
- "11 4 22 4" "4 44 22 444444",
- 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
- 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
-}
-
-int stbi_write_bmp_w(wchar_t const *filename, int x, int y, int comp, const void *data)
-{
- int pad = (-x*3) & 3;
- return outfile_w(filename,-1,-1,x,y,comp,data,0,pad,
- "11 4 22 4" "4 44 22 444444",
- 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
- 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
-}
-
-int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)
-{
- int has_alpha = !(comp & 1);
- return outfile(filename, -1,-1, x, y, comp, data, has_alpha, 0,
- "111 221 2222 11", 0,0,2, 0,0,0, 0,0,x,y, 24+8*has_alpha, 8*has_alpha);
-}
-
-int stbi_write_tga_w(wchar_t const *filename, int x, int y, int comp, const void *data)
-{
- int has_alpha = !(comp & 1);
- return outfile_w(filename, -1,-1, x, y, comp, data, has_alpha, 0,
- "111 221 2222 11", 0,0,2, 0,0,0, 0,0,x,y, 24+8*has_alpha, 8*has_alpha);
-}
-
-// any other image formats that do interleaved rgb data?
-// PNG: requires adler32,crc32 -- significant amount of code
-// PSD: no, channels output separately
-// TIFF: no, stripwise-interleaved... i think
-
-#endif // STBI_NO_WRITE
-
-#endif // STBI_HEADER_FILE_ONLY
-
diff --git a/Libraries/crunch-ea9b8d/inc/crn_decomp.h b/Libraries/crunch-ea9b8d/inc/crn_decomp.h
deleted file mode 100644
index 680beb1f..00000000
--- a/Libraries/crunch-ea9b8d/inc/crn_decomp.h
+++ /dev/null
@@ -1,4839 +0,0 @@
-// File: crn_decomp.h - Fast CRN->DXTc texture transcoder header file library
-// Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC
-// See Copyright Notice and license at the end of this file.
-//
-// This single header file contains *all* of the code necessary to unpack .CRN files to raw DXTn bits.
-// It does NOT depend on the crn compression library.
-//
-// Note: This is a single file, stand-alone C++ library which is controlled by the use of two macros:
-// If CRND_INCLUDE_CRND_H is NOT defined, the header is included.
-// If CRND_HEADER_FILE_ONLY is NOT defined, the implementation is included.
-//
-// Important: If compiling with gcc, be sure strict aliasing is disabled: -fno-strict-aliasing
-#ifndef CRND_INCLUDE_CRND_H
-#define CRND_INCLUDE_CRND_H
-
-// Include crnlib.h (only to bring in some basic CRN-related types).
-#include "crnlib.h"
-
-#define CRND_LIB_VERSION 104
-#define CRND_VERSION_STRING "01.04"
-
-#ifdef _DEBUG
-#define CRND_BUILD_DEBUG
-#else
-#define CRND_BUILD_RELEASE
-#endif
-
-// CRN decompression API
-namespace crnd
-{
- typedef unsigned char uint8;
- typedef signed char int8;
- typedef unsigned short uint16;
- typedef signed short int16;
- typedef unsigned int uint32;
- typedef uint32 uint32;
- typedef unsigned int uint;
- typedef signed int int32;
- #ifdef __GNUC__
- typedef unsigned long long uint64;
- typedef long long int64;
- #else
- typedef unsigned __int64 uint64;
- typedef signed __int64 int64;
- #endif
-
- // The crnd library assumes all allocation blocks have at least CRND_MIN_ALLOC_ALIGNMENT alignment.
- const uint32 CRND_MIN_ALLOC_ALIGNMENT = sizeof(uint32) * 2U;
-
- // realloc callback:
- // Used to allocate, resize, or free memory blocks.
- // If p is NULL, the realloc function attempts to allocate a block of at least size bytes. Returns NULL on out of memory.
- // *pActual_size must be set to the actual size of the allocated block, which must be greater than or equal to the requested size.
- // If p is not NULL, and size is 0, the realloc function frees the specified block, and always returns NULL. *pActual_size should be set to 0.
- // If p is not NULL, and size is non-zero, the realloc function attempts to resize the specified block:
- // If movable is false, the realloc function attempts to shrink or expand the block in-place. NULL is returned if the block cannot be resized in place, or if the
- // underlying heap implementation doesn't support in-place resizing. Otherwise, the pointer to the original block is returned.
- // If movable is true, it is permissible to move the block's contents if it cannot be resized in place. NULL is returned if the block cannot be resized in place, and there
- // is not enough memory to relocate the block.
- // In all cases, *pActual_size must be set to the actual size of the allocated block, whether it was successfully resized or not.
- typedef void* (*crnd_realloc_func)(void* p, size_t size, size_t* pActual_size, bool movable, void* pUser_data);
-
- // msize callback: Returns the size of the memory block in bytes, or 0 if the pointer or block is invalid.
- typedef size_t (*crnd_msize_func)(void* p, void* pUser_data);
-
- // crnd_set_memory_callbacks() - Use to override the crnd library's memory allocation functions.
- // If any input parameters are NULL, the memory callback functions are reset to the default functions.
- // The default functions call malloc(), free(), _msize(), _expand(), etc.
- void crnd_set_memory_callbacks(crnd_realloc_func pRealloc, crnd_msize_func pMSize, void* pUser_data);
-
- struct crn_file_info
- {
- inline crn_file_info() : m_struct_size(sizeof(crn_file_info)) { }
-
- uint32 m_struct_size;
- uint32 m_actual_data_size;
- uint32 m_header_size;
- uint32 m_total_palette_size;
- uint32 m_tables_size;
- uint32 m_levels;
- uint32 m_level_compressed_size[cCRNMaxLevels];
- uint32 m_color_endpoint_palette_entries;
- uint32 m_color_selector_palette_entries;
- uint32 m_alpha_endpoint_palette_entries;
- uint32 m_alpha_selector_palette_entries;
- };
-
- struct crn_texture_info
- {
- inline crn_texture_info() : m_struct_size(sizeof(crn_texture_info)) { }
-
- uint32 m_struct_size;
- uint32 m_width;
- uint32 m_height;
- uint32 m_levels;
- uint32 m_faces;
- uint32 m_bytes_per_block;
- uint32 m_userdata0;
- uint32 m_userdata1;
- crn_format m_format;
- };
-
- struct crn_level_info
- {
- inline crn_level_info() : m_struct_size(sizeof(crn_level_info)) { }
-
- uint32 m_struct_size;
- uint32 m_width;
- uint32 m_height;
- uint32 m_faces;
- uint32 m_blocks_x;
- uint32 m_blocks_y;
- uint32 m_bytes_per_block;
- crn_format m_format;
- };
-
- // Returns the FOURCC format code corresponding to the specified CRN format.
- uint32 crnd_crn_format_to_fourcc(crn_format fmt);
-
- // Returns the fundamental GPU format given a potentially swizzled DXT5 crn_format.
- crn_format crnd_get_fundamental_dxt_format(crn_format fmt);
-
- // Returns the size of the crn_format in bits/texel (either 4 or 8).
- uint32 crnd_get_crn_format_bits_per_texel(crn_format fmt);
-
- // Returns the number of bytes per DXTn block (8 or 16).
- uint32 crnd_get_bytes_per_dxt_block(crn_format fmt);
-
- // Validates the entire file by checking the header and data CRC's.
- // This is not something you want to be doing much!
- // The crn_file_info.m_struct_size field must be set before calling this function.
- bool crnd_validate_file(const void* pData, uint32 data_size, crn_file_info* pFile_info);
-
- // Retrieves texture information from the CRN file.
- // The crn_texture_info.m_struct_size field must be set before calling this function.
- bool crnd_get_texture_info(const void* pData, uint32 data_size, crn_texture_info* pTexture_info);
-
- // Retrieves mipmap level specific information from the CRN file.
- // The crn_level_info.m_struct_size field must be set before calling this function.
- bool crnd_get_level_info(const void* pData, uint32 data_size, uint32 level_index, crn_level_info* pLevel_info);
-
- // Transcode/unpack context handle.
- typedef void* crnd_unpack_context;
-
- // crnd_unpack_begin() - Decompresses the texture's decoder tables and endpoint/selector palettes.
- // Once you call this function, you may call crnd_unpack_level() to unpack one or more mip levels.
- // Don't call this once per mip level (unless you absolutely must)!
- // This function allocates enough memory to hold: Huffman decompression tables, and the endpoint/selector palettes (color and/or alpha).
- // Worst case allocation is approx. 200k, assuming all palettes contain 8192 entries.
- // pData must point to a buffer holding all of the compressed .CRN file data.
- // This buffer must be stable until crnd_unpack_end() is called.
- // Returns NULL if out of memory, or if any of the input parameters are invalid.
- crnd_unpack_context crnd_unpack_begin(const void* pData, uint32 data_size);
-
- // Returns a pointer to the compressed .CRN data associated with a crnd_unpack_context.
- // Returns false if any of the input parameters are invalid.
- bool crnd_get_data(crnd_unpack_context pContext, const void** ppData, uint32* pData_size);
-
- // crnd_unpack_level() - Transcodes the specified mipmap level to a destination buffer in cached or write combined memory.
- // pContext - Context created by a call to crnd_unpack_begin().
- // ppDst - A pointer to an array of 1 or 6 destination buffer pointers. Cubemaps require an array of 6 pointers, 2D textures require an array of 1 pointer.
- // dst_size_in_bytes - Optional size of each destination buffer. Only used for debugging - OK to set to UINT32_MAX.
- // row_pitch_in_bytes - The pitch in bytes from one row of DXT blocks to the next. Must be a multiple of 4.
- // level_index - mipmap level index, where 0 is the largest/first level.
- // Returns false if any of the input parameters, or the compressed stream, are invalid.
- // This function does not allocate any memory.
- bool crnd_unpack_level(
- crnd_unpack_context pContext,
- void** ppDst, uint32 dst_size_in_bytes, uint32 row_pitch_in_bytes,
- uint32 level_index);
-
- // crnd_unpack_level_segmented() - Unpacks the specified mipmap level from a "segmented" CRN file.
- // See the crnd_create_segmented_file() API below.
- // Segmented files allow the user to control where the compressed mipmap data is stored.
- bool crnd_unpack_level_segmented(
- crnd_unpack_context pContext,
- const void* pSrc, uint32 src_size_in_bytes,
- void** ppDst, uint32 dst_size_in_bytes, uint32 row_pitch_in_bytes,
- uint32 level_index);
-
- // crnd_unpack_end() - Frees the decompress tables and unpacked palettes associated with the specified unpack context.
- // Returns false if the context is NULL, or if it points to an invalid context.
- // This function frees all memory associated with the context.
- bool crnd_unpack_end(crnd_unpack_context pContext);
-
- // The following API's allow the user to create "segmented" CRN files. A segmented file contains multiple pieces:
- // - Base data: Header + compression tables
- // - Level data: Individual mipmap levels
- // This allows mipmap levels from multiple CRN files to be tightly packed together into single files.
-
- // Returns a pointer to the level's compressed data, and optionally returns the level's compressed data size if pSize is not NULL.
- const void* crnd_get_level_data(const void* pData, uint32 data_size, uint32 level_index, uint32* pSize);
-
- // Returns the compressed size of the texture's header and compression tables (but no levels).
- uint32 crnd_get_segmented_file_size(const void* pData, uint32 data_size);
-
- // Creates a "segmented" CRN texture from a normal CRN texture. The new texture will be created at pBase_data, and will be crnd_get_base_data_size() bytes long.
- // base_data_size must be >= crnd_get_base_data_size().
- // The base data will contain the CRN header and compression tables, but no mipmap data.
- bool crnd_create_segmented_file(const void* pData, uint32 data_size, void* pBase_data, uint base_data_size);
-
-} // namespace crnd
-
-// Low-level CRN file header cracking.
-namespace crnd
-{
- template<unsigned int N>
- struct crn_packed_uint
- {
- inline crn_packed_uint() { }
-
- inline crn_packed_uint(unsigned int val) { *this = val; }
-
- inline crn_packed_uint(const crn_packed_uint& other) { *this = other; }
-
- inline crn_packed_uint& operator= (const crn_packed_uint& rhs)
- {
- if (this != &rhs)
- memcpy(m_buf, rhs.m_buf, sizeof(m_buf));
- return *this;
- }
-
- inline crn_packed_uint& operator= (unsigned int val)
- {
- //CRND_ASSERT((N == 4U) || (val < (1U << (N * 8U))));
-
- val <<= (8U * (4U - N));
-
- for (unsigned int i = 0; i < N; i++)
- {
- m_buf[i] = static_cast<unsigned char>(val >> 24U);
- val <<= 8U;
- }
-
- return *this;
- }
-
- inline operator unsigned int() const
- {
- switch (N)
- {
- case 1: return m_buf[0];
- case 2: return (m_buf[0] << 8U) | m_buf[1];
- case 3: return (m_buf[0] << 16U) | (m_buf[1] << 8U) | (m_buf[2]);
- default: return (m_buf[0] << 24U) | (m_buf[1] << 16U) | (m_buf[2] << 8U) | (m_buf[3]);
- }
- }
-
- unsigned char m_buf[N];
- };
-
-#pragma pack(push)
-#pragma pack(1)
- struct crn_palette
- {
- crn_packed_uint<3> m_ofs;
- crn_packed_uint<3> m_size;
- crn_packed_uint<2> m_num;
- };
-
- enum crn_header_flags
- {
- // If set, the compressed mipmap level data is not located after the file's base data - it will be separately managed by the user instead.
- cCRNHeaderFlagSegmented = 1
- };
-
- struct crn_header
- {
- enum { cCRNSigValue = ('H' << 8) | 'x' };
-
- crn_packed_uint<2> m_sig;
- crn_packed_uint<2> m_header_size;
- crn_packed_uint<2> m_header_crc16;
-
- crn_packed_uint<4> m_data_size;
- crn_packed_uint<2> m_data_crc16;
-
- crn_packed_uint<2> m_width;
- crn_packed_uint<2> m_height;
-
- crn_packed_uint<1> m_levels;
- crn_packed_uint<1> m_faces;
-
- crn_packed_uint<1> m_format;
- crn_packed_uint<2> m_flags;
-
- crn_packed_uint<4> m_reserved;
- crn_packed_uint<4> m_userdata0;
- crn_packed_uint<4> m_userdata1;
-
- crn_palette m_color_endpoints;
- crn_palette m_color_selectors;
-
- crn_palette m_alpha_endpoints;
- crn_palette m_alpha_selectors;
-
- crn_packed_uint<2> m_tables_size;
- crn_packed_uint<3> m_tables_ofs;
-
- // m_level_ofs[] is actually an array of offsets: m_level_ofs[m_levels]
- crn_packed_uint<4> m_level_ofs[1];
- };
-
- const unsigned int cCRNHeaderMinSize = 62U;
-
-#pragma pack(pop)
-
-} // namespace crnd
-
-#endif // CRND_INCLUDE_CRND_H
-
-// Internal library source follows this line.
-
-#ifndef CRND_HEADER_FILE_ONLY
-
-#include <stdlib.h>
-#include <stdio.h>
-#ifdef WIN32
-#include <memory.h>
-#else
-#include <malloc.h>
-#endif
-#include <stdarg.h>
-#include <new> // needed for placement new, _msize, _expand
-
-#define CRND_RESTRICT __restrict
-
-#ifdef _MSC_VER
-#include <intrin.h>
-#pragma intrinsic(_WriteBarrier)
-#pragma intrinsic(_ReadWriteBarrier)
-#define CRND_WRITE_BARRIER _WriteBarrier();
-#define CRND_FULL_BARRIER _ReadWriteBarrier();
-#else
-#define CRND_WRITE_BARRIER
-#define CRND_FULL_BARRIER
-#endif
-
-#ifdef _MSC_VER
-#pragma warning(disable:4127) // warning C4127: conditional expression is constant
-#endif
-
-#ifdef CRND_DEVEL
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x500
-#endif
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#ifndef
-#define NOMINMAX
-#endif
-#include "windows.h" // only for IsDebuggerPresent(), DebugBreak(), and OutputDebugStringA()
-#endif
-
-// File: crnd_types.h
-namespace crnd
-{
- const crn_uint8 cUINT8_MIN = 0;
- const crn_uint8 cUINT8_MAX = 0xFFU;
- const uint16 cUINT16_MIN = 0;
- const uint16 cUINT16_MAX = 0xFFFFU;
- const uint32 cUINT32_MIN = 0;
- const uint32 cUINT32_MAX = 0xFFFFFFFFU;
-
- const int8 cINT8_MIN = -128;
- const int8 cINT8_MAX = 127;
- const int16 cINT16_MIN = -32768;
- const int16 cINT16_MAX = 32767;
- const int32 cINT32_MIN = (-2147483647 - 1);
- const int32 cINT32_MAX = 2147483647;
-
- enum eClear { cClear };
-
- const uint32 cIntBits = 32U;
-
-#ifdef _WIN64
- typedef uint64 ptr_bits;
-#else
- #ifdef __x86_64__
- typedef uint64 ptr_bits;
- #else
- typedef uint32 ptr_bits;
- #endif
-#endif
-
- template<typename T> struct int_traits { enum { cMin = crnd::cINT32_MIN, cMax = crnd::cINT32_MAX, cSigned = true }; };
-
- template<> struct int_traits<int8> { enum { cMin = crnd::cINT8_MIN, cMax = crnd::cINT8_MAX, cSigned = true }; };
- template<> struct int_traits<int16> { enum { cMin = crnd::cINT16_MIN, cMax = crnd::cINT16_MAX, cSigned = true }; };
- template<> struct int_traits<int32> { enum { cMin = crnd::cINT32_MIN, cMax = crnd::cINT32_MAX, cSigned = true }; };
-
- template<> struct int_traits<uint8> { enum { cMin = 0, cMax = crnd::cUINT8_MAX, cSigned = false }; };
- template<> struct int_traits<uint16> { enum { cMin = 0, cMax = crnd::cUINT16_MAX, cSigned = false }; };
- template<> struct int_traits<uint32> { enum { cMin = 0, cMax = crnd::cUINT32_MAX, cSigned = false }; };
-
- struct empty_type { };
-
-} // namespace crnd
-
-// File: crnd_platform.h
-namespace crnd
-{
-#ifdef _XBOX
- const bool c_crnd_little_endian_platform = false;
- const bool c_crnd_big_endian_platform = true;
-#define CRND_BIG_ENDIAN_PLATFORM 1
-#else
- const bool c_crnd_little_endian_platform = true;
- const bool c_crnd_big_endian_platform = false;
-#endif
-
- bool crnd_is_debugger_present();
- void crnd_debug_break();
- void crnd_output_debug_string(const char* p);
-
- // actually in crnd_assert.cpp
- void crnd_assert(const char* pExp, const char* pFile, unsigned line);
- void crnd_fail(const char* pExp, const char* pFile, unsigned line);
-
-} // namespace crnd
-
-// File: crnd_assert.h
-namespace crnd
-{
- void crnd_assert(const char* pExp, const char* pFile, unsigned line);
-
-#ifdef NDEBUG
-#define CRND_ASSERT(x) ((void)0)
-#undef CRND_ASSERTS_ENABLED
-#else
-#define CRND_ASSERT(_exp) (void)( (!!(_exp)) || (crnd::crnd_assert(#_exp, __FILE__, __LINE__), 0) )
-#define CRND_ASSERTS_ENABLED
-#endif
-
- void crnd_trace(const char* pFmt, va_list args);
- void crnd_trace(const char* pFmt, ...);
-
-} // namespace crnd
-
-// File: crnd_helpers.h
-namespace crnd
-{
- namespace helpers
- {
- template<typename T> struct rel_ops
- {
- friend bool operator!= (const T& x, const T& y) { return (!(x == y)); }
- friend bool operator> (const T& x, const T& y) { return (y < x); }
- friend bool operator<= (const T& x, const T& y) { return (!(y < x)); }
- friend bool operator>= (const T& x, const T& y) { return (!(x < y)); }
- };
-
- template <typename T>
- inline T* construct(T* p)
- {
- return new (static_cast<void*>(p)) T;
- }
-
- template <typename T, typename U>
- inline T* construct(T* p, const U& init)
- {
- return new (static_cast<void*>(p)) T(init);
- }
-
- template <typename T>
- void construct_array(T* p, uint32 n)
- {
- T* q = p + n;
- for ( ; p != q; ++p)
- new (static_cast<void*>(p)) T;
- }
-
- template <typename T, typename U>
- void construct_array(T* p, uint32 n, const U& init)
- {
- T* q = p + n;
- for ( ; p != q; ++p)
- new (static_cast<void*>(p)) T(init);
- }
-
- template <typename T>
- inline void destruct(T* p)
- {
- p;
- p->~T();
- }
-
- template <typename T> inline void destruct_array(T* p, uint32 n)
- {
- T* q = p + n;
- for ( ; p != q; ++p)
- p->~T();
- }
-
- } // namespace helpers
-
-} // namespace crnd
-
-// File: crnd_traits.h
-namespace crnd
-{
- template<typename T>
- struct scalar_type
- {
- enum { cFlag = false };
- static inline void construct(T* p) { helpers::construct(p); }
- static inline void construct(T* p, const T& init) { helpers::construct(p, init); }
- static inline void construct_array(T* p, uint32 n) { helpers::construct_array(p, n); }
- static inline void destruct(T* p) { helpers::destruct(p); }
- static inline void destruct_array(T* p, uint32 n) { helpers::destruct_array(p, n); }
- };
-
- template<typename T> struct scalar_type<T*>
- {
- enum { cFlag = true };
- static inline void construct(T** p) { memset(p, 0, sizeof(T*)); }
- static inline void construct(T** p, T* init) { *p = init; }
- static inline void construct_array(T** p, uint32 n) { memset(p, 0, sizeof(T*) * n); }
- static inline void destruct(T** p) { p; }
- static inline void destruct_array(T** p, uint32 n) { p, n; }
- };
-
-#define CRND_DEFINE_BUILT_IN_TYPE(X) \
- template<> struct scalar_type<X> { \
- enum { cFlag = true }; \
- static inline void construct(X* p) { memset(p, 0, sizeof(X)); } \
- static inline void construct(X* p, const X& init) { memcpy(p, &init, sizeof(X)); } \
- static inline void construct_array(X* p, uint32 n) { memset(p, 0, sizeof(X) * n); } \
- static inline void destruct(X* p) { p; } \
- static inline void destruct_array(X* p, uint32 n) { p, n; } };
-
- CRND_DEFINE_BUILT_IN_TYPE(bool)
- CRND_DEFINE_BUILT_IN_TYPE(char)
- CRND_DEFINE_BUILT_IN_TYPE(unsigned char)
- CRND_DEFINE_BUILT_IN_TYPE(short)
- CRND_DEFINE_BUILT_IN_TYPE(unsigned short)
- CRND_DEFINE_BUILT_IN_TYPE(int)
- CRND_DEFINE_BUILT_IN_TYPE(unsigned int)
- CRND_DEFINE_BUILT_IN_TYPE(long)
- CRND_DEFINE_BUILT_IN_TYPE(unsigned long)
- CRND_DEFINE_BUILT_IN_TYPE(int64)
- CRND_DEFINE_BUILT_IN_TYPE(uint64)
- CRND_DEFINE_BUILT_IN_TYPE(float)
- CRND_DEFINE_BUILT_IN_TYPE(double)
- CRND_DEFINE_BUILT_IN_TYPE(long double)
-
-#undef CRND_DEFINE_BUILT_IN_TYPE
-
- // See: http://erdani.org/publications/cuj-2004-06.pdf
-
- template<typename T>
- struct bitwise_movable { enum { cFlag = false }; };
-
- // Defines type Q as bitwise movable.
-#define CRND_DEFINE_BITWISE_MOVABLE(Q) template<> struct bitwise_movable<Q> { enum { cFlag = true }; };
-
- // From yasli_traits.h:
- // Credit goes to Boost;
- // also found in the C++ Templates book by Vandevoorde and Josuttis
-
- typedef char (&yes_t)[1];
- typedef char (&no_t)[2];
-
- template <class U> yes_t class_test(int U::*);
- template <class U> no_t class_test(...);
-
- template <class T> struct is_class
- {
- enum { value = (sizeof(class_test<T>(0)) == sizeof(yes_t)) };
- };
-
- template <typename T> struct is_pointer
- {
- enum { value = false };
- };
-
- template <typename T> struct is_pointer<T*>
- {
- enum { value = true };
- };
-
-#define CRND_IS_POD(T) __is_pod(T)
-
-} // namespace crnd
-
-// File: crnd_mem.h
-namespace crnd
-{
- void* crnd_malloc(size_t size, size_t* pActual_size = NULL);
- void* crnd_realloc(void* p, size_t size, size_t* pActual_size = NULL, bool movable = true);
- void crnd_free(void* p);
- size_t crnd_msize(void* p);
-
- template<typename T>
- inline T* crnd_new()
- {
- T* p = static_cast<T*>(crnd_malloc(sizeof(T)));
- if (!p)
- return NULL;
-
- return helpers::construct(p);
- }
-
- template<typename T>
- inline T* crnd_new(const T& init)
- {
- T* p = static_cast<T*>(crnd_malloc(sizeof(T)));
- if (!p)
- return NULL;
-
- return helpers::construct(p, init);
- }
-
- template<typename T>
- inline T* crnd_new_array(uint32 num)
- {
- if (!num) num = 1;
-
- uint8* q = static_cast<uint8*>(crnd_malloc(CRND_MIN_ALLOC_ALIGNMENT + sizeof(T) * num));
- if (!q)
- return NULL;
-
- T* p = reinterpret_cast<T*>(q + CRND_MIN_ALLOC_ALIGNMENT);
-
- reinterpret_cast<uint32*>(p)[-1] = num;
- reinterpret_cast<uint32*>(p)[-2] = ~num;
-
- helpers::construct_array(p, num);
- return p;
- }
-
- template<typename T>
- inline void crnd_delete(T* p)
- {
- if (p)
- {
- helpers::destruct(p);
- crnd_free(p);
- }
- }
-
- template<typename T>
- inline void crnd_delete_array(T* p)
- {
- if (p)
- {
- const uint32 num = reinterpret_cast<uint32*>(p)[-1];
- const uint32 num_check = reinterpret_cast<uint32*>(p)[-2];
- num_check;
- CRND_ASSERT(num && (num == ~num_check));
-
- helpers::destruct_array(p, num);
-
- crnd_free(reinterpret_cast<uint8*>(p) - CRND_MIN_ALLOC_ALIGNMENT);
- }
- }
-
-} // namespace crnd
-
-// File: crnd_math.h
-namespace crnd
-{
- namespace math
- {
- const float cNearlyInfinite = 1.0e+37f;
-
- const float cDegToRad = 0.01745329252f;
- const float cRadToDeg = 57.29577951f;
-
- extern uint32 g_bitmasks[32];
-
- // Yes I know these should probably be pass by ref, not val:
- // http://www.stepanovpapers.com/notes.pdf
- // Just don't use them on non-simple (non built-in) types!
- template<typename T> inline T minimum(T a, T b)
- {
- return (a < b) ? a : b;
- }
-
- template<typename T> inline T minimum(T a, T b, T c)
- {
- return minimum(minimum(a, b), c);
- }
-
- template<typename T> inline T maximum(T a, T b)
- {
- return (a > b) ? a : b;
- }
-
- template<typename T> inline T maximum(T a, T b, T c)
- {
- return maximum(maximum(a, b), c);
- }
-
- template<typename T> inline T clamp(T value, T low, T high)
- {
- return (value < low) ? low : ((value > high) ? high : value);
- }
-
- template<typename T> inline T square(T value)
- {
- return value * value;
- }
-
- inline bool is_power_of_2(uint32 x)
- {
- return x && ((x & (x - 1U)) == 0U);
- }
-
- // From "Hackers Delight"
- inline int next_pow2(uint32 val)
- {
- val--;
- val |= val >> 16;
- val |= val >> 8;
- val |= val >> 4;
- val |= val >> 2;
- val |= val >> 1;
- return val + 1;
- }
-
- // Returns the total number of bits needed to encode v.
- inline uint32 total_bits(uint32 v)
- {
- uint32 l = 0;
- while (v > 0U)
- {
- v >>= 1;
- l++;
- }
- return l;
- }
-
- inline uint floor_log2i(uint v)
- {
- uint l = 0;
- while (v > 1U)
- {
- v >>= 1;
- l++;
- }
- return l;
- }
-
- inline uint ceil_log2i(uint v)
- {
- uint l = floor_log2i(v);
- if ((l != cIntBits) && (v > (1U << l)))
- l++;
- return l;
- }
- }
-}
-
-// File: crnd_utils.h
-namespace crnd
-{
- namespace utils
- {
- template<typename T> inline void zero_object(T& obj)
- {
- memset(&obj, 0, sizeof(obj));
- }
-
- template<typename T> inline void zero_this(T* pObj)
- {
- memset(pObj, 0, sizeof(*pObj));
- }
-
- template <typename T>
- inline void swap(T& left, T& right)
- {
- T temp(left);
- left = right;
- right = temp;
- }
-
- inline void invert_buf(void* pBuf, uint32 size)
- {
- uint8* p = static_cast<uint8*>(pBuf);
-
- const uint32 half_size = size >> 1;
- for (uint32 i = 0; i < half_size; i++)
- swap(p[i], p[size - 1U - i]);
- }
-
- static inline uint16 swap16(uint16 x) { return static_cast<uint16>((x << 8) | (x >> 8)); }
- static inline uint32 swap32(uint32 x) { return ((x << 24) | ((x << 8) & 0x00FF0000) | (( x >> 8) & 0x0000FF00) | (x >> 24)); }
-
- uint32 compute_max_mips(uint32 width, uint32 height);
-
- } // namespace utils
-
-} // namespace crnd
-
-// File: crnd_vector.h
-namespace crnd
-{
- struct elemental_vector
- {
- void* m_p;
- uint32 m_size;
- uint32 m_capacity;
-
- typedef void (*object_mover)(void* pDst, void* pSrc, uint32 num);
-
- bool increase_capacity(uint32 min_new_capacity, bool grow_hint, uint32 element_size, object_mover pRelocate);
- };
-
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable:4127) // warning C4127: conditional expression is constant
-#endif
-
- template<typename T>
- class vector : public helpers::rel_ops< vector<T> >
- {
- public:
- typedef T* iterator;
- typedef const T* const_iterator;
- typedef T value_type;
- typedef T& reference;
- typedef const T& const_reference;
- typedef T* pointer;
- typedef const T* const_pointer;
-
- inline vector() :
- m_p(NULL),
- m_size(0),
- m_capacity(0),
- m_alloc_failed(false)
- {
- }
-
- inline vector(const vector& other) :
- m_p(NULL),
- m_size(0),
- m_capacity(0),
- m_alloc_failed(false)
- {
- *this = other;
- }
-
- inline vector(uint32 size) :
- m_p(NULL),
- m_size(0),
- m_capacity(0),
- m_alloc_failed(false)
- {
- resize(size);
- }
-
- inline ~vector()
- {
- clear();
- }
-
- // I don't like this. Not at all. But exceptions, or just failing suck worse.
- inline bool get_alloc_failed() const { return m_alloc_failed; }
- inline void clear_alloc_failed() { m_alloc_failed = false; }
-
- inline bool assign(const vector& other)
- {
- if (this == &other)
- return true;
-
- if (m_capacity == other.m_size)
- resize(0);
- else
- {
- clear();
-
- if (!increase_capacity(other.m_size, false))
- return false;
- }
-
- if (scalar_type<T>::cFlag)
- memcpy(m_p, other.m_p, other.m_size * sizeof(T));
- else
- {
- T* pDst = m_p;
- const T* pSrc = other.m_p;
- for (uint32 i = other.m_size; i > 0; i--)
- helpers::construct(pDst++, *pSrc++);
- }
-
- m_size = other.m_size;
-
- return true;
- }
-
- inline vector& operator= (const vector& other)
- {
- assign(other);
- return *this;
- }
-
- inline const T* begin() const { return m_p; }
- T* begin() { return m_p; }
-
- inline const T* end() const { return m_p + m_size; }
- T* end() { return m_p + m_size; }
-
- inline bool empty() const { return !m_size; }
- inline uint32 size() const { return m_size; }
- inline uint32 capacity() const { return m_capacity; }
-
- inline const T& operator[] (uint32 i) const { CRND_ASSERT(i < m_size); return m_p[i]; }
- inline T& operator[] (uint32 i) { CRND_ASSERT(i < m_size); return m_p[i]; }
-
- inline const T& front() const { CRND_ASSERT(m_size); return m_p[0]; }
- inline T& front() { CRND_ASSERT(m_size); return m_p[0]; }
-
- inline const T& back() const { CRND_ASSERT(m_size); return m_p[m_size - 1]; }
- inline T& back() { CRND_ASSERT(m_size); return m_p[m_size - 1]; }
-
- inline void clear()
- {
- if (m_p)
- {
- scalar_type<T>::destruct_array(m_p, m_size);
- crnd_free(m_p);
- m_p = NULL;
- m_size = 0;
- m_capacity = 0;
- }
-
- m_alloc_failed = false;
- }
-
- inline bool reserve(uint32 new_capacity)
- {
- if (!increase_capacity(new_capacity, false))
- return false;
-
- return true;
- }
-
- inline bool resize(uint32 new_size)
- {
- if (m_size != new_size)
- {
- if (new_size < m_size)
- scalar_type<T>::destruct_array(m_p + new_size, m_size - new_size);
- else
- {
- if (new_size > m_capacity)
- {
- if (!increase_capacity(new_size, new_size == (m_size + 1)))
- return false;
- }
-
- scalar_type<T>::construct_array(m_p + m_size, new_size - m_size);
- }
-
- m_size = new_size;
- }
-
- return true;
- }
-
- inline bool push_back(const T& obj)
- {
- CRND_ASSERT(!m_p || (&obj < m_p) || (&obj >= (m_p + m_size)));
-
- if (m_size >= m_capacity)
- {
- if (!increase_capacity(m_size + 1, true))
- return false;
- }
-
- scalar_type<T>::construct(m_p + m_size, obj);
- m_size++;
-
- return true;
- }
-
- inline void pop_back()
- {
- CRND_ASSERT(m_size);
-
- if (m_size)
- {
- m_size--;
- scalar_type<T>::destruct(&m_p[m_size]);
- }
- }
-
- inline void insert(uint32 index, const T* p, uint32 n)
- {
- CRND_ASSERT(index <= m_size);
- if (!n)
- return;
-
- const uint32 orig_size = m_size;
- resize(m_size + n);
-
- const T* pSrc = m_p + orig_size - 1;
- T* pDst = const_cast<T*>(pSrc) + n;
-
- const uint32 num_to_move = orig_size - index;
-
- for (uint32 i = 0; i < num_to_move; i++)
- {
- CRND_ASSERT((pDst - m_p) < (int)m_size);
- *pDst-- = *pSrc--;
- }
-
- pSrc = p;
- pDst = m_p + index;
-
- for (uint32 i = 0; i < n; i++)
- {
- CRND_ASSERT((pDst - m_p) < (int)m_size);
- *pDst++ = *p++;
- }
- }
-
- inline void erase(uint32 start, uint32 n)
- {
- CRND_ASSERT((start + n) <= m_size);
-
- if (!n)
- return;
-
- const uint32 num_to_move = m_size - (start + n);
-
- T* pDst = m_p + start;
- T* pDst_end = pDst + num_to_move;
- const T* pSrc = m_p + start + n;
-
- while (pDst != pDst_end)
- *pDst++ = *pSrc++;
-
- scalar_type<T>::destruct_array(pDst_end, n);
-
- m_size -= n;
- }
-
- inline void erase(uint32 index)
- {
- erase(index, 1);
- }
-
- inline void erase(T* p)
- {
- CRND_ASSERT((p >= m_p) && (p < (m_p + m_size)));
- erase(p - m_p);
- }
-
- inline bool operator== (const vector& rhs) const
- {
- if (m_size != rhs.m_size)
- return false;
- else if (m_size)
- {
- if (scalar_type<T>::cFlag)
- return memcmp(m_p, rhs.m_p, sizeof(T) * m_size) == 0;
- else
- {
- const T* pSrc = m_p;
- const T* pDst = rhs.m_p;
- for (uint32 i = m_size; i; i--)
- if (!(*pSrc++ == *pDst++))
- return false;
- }
- }
-
- return true;
- }
-
- inline bool operator< (const vector& rhs) const
- {
- const uint32 min_size = math::minimum(m_size, rhs.m_size);
-
- const T* pSrc = m_p;
- const T* pSrc_end = m_p + min_size;
- const T* pDst = rhs.m_p;
-
- while ((pSrc < pSrc_end) && (*pSrc == *pDst))
- {
- pSrc++;
- pDst++;
- }
-
- if (pSrc < pSrc_end)
- return *pSrc < *pDst;
-
- return m_size < rhs.m_size;
- }
-
- void swap(vector& other)
- {
- utils::swap(m_p, other.m_p);
- utils::swap(m_size, other.m_size);
- utils::swap(m_capacity, other.m_capacity);
- }
-
- private:
- T* m_p;
- uint32 m_size;
- uint32 m_capacity;
- bool m_alloc_failed;
-
- template<typename Q> struct is_vector { enum { cFlag = false }; };
- template<typename Q> struct is_vector< vector<Q> > { enum { cFlag = true }; };
-
- static void object_mover(void* pDst_void, void* pSrc_void, uint32 num)
- {
- T* pSrc = static_cast<T*>(pSrc_void);
- T* const pSrc_end = pSrc + num;
- T* pDst = static_cast<T*>(pDst_void);
-
- while (pSrc != pSrc_end)
- {
- helpers::construct<T>(pDst, *pSrc);
- pSrc->~T();
- pSrc++;
- pDst++;
- }
- }
-
- inline bool increase_capacity(uint32 min_new_capacity, bool grow_hint)
- {
- if (!reinterpret_cast<elemental_vector*>(this)->increase_capacity(
- min_new_capacity, grow_hint, sizeof(T),
- ((scalar_type<T>::cFlag) || (is_vector<T>::cFlag) || (bitwise_movable<T>::cFlag) || CRND_IS_POD(T)) ? NULL : object_mover))
- {
- m_alloc_failed = true;
- return false;
- }
- return true;
- }
- };
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
- extern void vector_test();
-
-} // namespace crnd
-
-// File: crnd_private.h
-namespace crnd
-{
- const crn_header* crnd_get_header(crn_header& header, const void* pData, uint32 data_size);
-
-} // namespace crnd
-
-// File: checksum.h
-namespace crnd
-{
- // crc16() intended for small buffers - doesn't use an acceleration table.
- const uint16 cInitCRC16 = 0;
- uint16 crc16(const void* pBuf, uint32 len, uint16 crc = cInitCRC16);
-
-} // namespace crnd
-
-// File: crnd_color.h
-namespace crnd
-{
- template<typename component_type> struct color_quad_component_traits
- {
- enum
- {
- cSigned = false,
- cFloat = false,
- cMin = cUINT8_MIN,
- cMax = cUINT8_MAX
- };
- };
-
- template<> struct color_quad_component_traits<int16>
- {
- enum
- {
- cSigned = true,
- cFloat = false,
- cMin = cINT16_MIN,
- cMax = cINT16_MAX
- };
- };
-
- template<> struct color_quad_component_traits<uint16>
- {
- enum
- {
- cSigned = false,
- cFloat = false,
- cMin = cUINT16_MIN,
- cMax = cUINT16_MAX
- };
- };
-
- template<> struct color_quad_component_traits<int32>
- {
- enum
- {
- cSigned = true,
- cFloat = false,
- cMin = cINT32_MIN,
- cMax = cINT32_MAX
- };
- };
-
- template<> struct color_quad_component_traits<uint32>
- {
- enum
- {
- cSigned = false,
- cFloat = false,
- cMin = cUINT32_MIN,
- cMax = cUINT32_MAX
- };
- };
-
- template<> struct color_quad_component_traits<float>
- {
- enum
- {
- cSigned = false,
- cFloat = true,
- cMin = cINT32_MIN,
- cMax = cINT32_MAX
- };
- };
-
- template<> struct color_quad_component_traits<double>
- {
- enum
- {
- cSigned = false,
- cFloat = true,
- cMin = cINT32_MIN,
- cMax = cINT32_MAX
- };
- };
-
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
-#pragma warning(disable:4127) // warning C4127: conditional expression is constant
-#endif
-
- template<typename component_type, typename parameter_type>
- class color_quad : public helpers::rel_ops<color_quad<component_type, parameter_type> >
- {
- static parameter_type clamp(parameter_type v)
- {
- if (component_traits::cFloat)
- return v;
- else
- {
- if (v < component_traits::cMin)
- return component_traits::cMin;
- else if (v > component_traits::cMax)
- return component_traits::cMax;
- return v;
- }
- }
-
- public:
- typedef component_type component_t;
- typedef parameter_type parameter_t;
- typedef color_quad_component_traits<component_type> component_traits;
-
- enum { cNumComps = 4 };
-
- union
- {
- struct
- {
- component_type r;
- component_type g;
- component_type b;
- component_type a;
- };
-
- component_type c[cNumComps];
- };
-
- inline color_quad()
- {
- }
-
- inline color_quad(eClear) :
- r(0), g(0), b(0), a(0)
- {
- }
-
- inline color_quad(const color_quad& other) :
- r(other.r), g(other.g), b(other.b), a(other.a)
- {
- }
-
- inline color_quad(parameter_type y, parameter_type alpha = component_traits::cMax)
- {
- set(y, alpha);
- }
-
- inline color_quad(parameter_type red, parameter_type green, parameter_type blue, parameter_type alpha = component_traits::cMax)
- {
- set(red, green, blue, alpha);
- }
-
- template<typename other_component_type, typename other_parameter_type>
- inline color_quad(const color_quad<other_component_type, other_parameter_type>& other) :
- r(clamp(other.r)), g(clamp(other.g)), b(clamp(other.b)), a(clamp(other.a))
- {
- }
-
- inline void clear()
- {
- r = 0;
- g = 0;
- b = 0;
- a = 0;
- }
-
- inline color_quad& operator= (const color_quad& other)
- {
- r = other.r;
- g = other.g;
- b = other.b;
- a = other.a;
- return *this;
- }
-
- template<typename other_component_type, typename other_parameter_type>
- inline color_quad& operator=(const color_quad<other_component_type, other_parameter_type>& other)
- {
- r = clamp(other.r);
- g = clamp(other.g);
- b = clamp(other.b);
- a = clamp(other.a);
- return *this;
- }
-
- inline color_quad& set(parameter_type y, parameter_type alpha = component_traits::cMax)
- {
- y = clamp(y);
- r = static_cast<component_type>(y);
- g = static_cast<component_type>(y);
- b = static_cast<component_type>(y);
- a = static_cast<component_type>(alpha);
- return *this;
- }
-
- inline color_quad& set(parameter_type red, parameter_type green, parameter_type blue, parameter_type alpha = component_traits::cMax)
- {
- r = static_cast<component_type>(clamp(red));
- g = static_cast<component_type>(clamp(green));
- b = static_cast<component_type>(clamp(blue));
- a = static_cast<component_type>(clamp(alpha));
- return *this;
- }
-
- inline color_quad& set_noclamp_rgba(parameter_type red, parameter_type green, parameter_type blue, parameter_type alpha)
- {
- r = static_cast<component_type>(red);
- g = static_cast<component_type>(green);
- b = static_cast<component_type>(blue);
- a = static_cast<component_type>(alpha);
- return *this;
- }
-
- inline color_quad& set_noclamp_rgb(parameter_type red, parameter_type green, parameter_type blue)
- {
- r = static_cast<component_type>(red);
- g = static_cast<component_type>(green);
- b = static_cast<component_type>(blue);
- return *this;
- }
-
- static inline parameter_type get_min_comp() { return component_traits::cMin; }
- static inline parameter_type get_max_comp() { return component_traits::cMax; }
- static inline bool get_comps_are_signed() { return component_traits::cSigned; }
-
- inline component_type operator[] (uint32 i) const { CRND_ASSERT(i < cNumComps); return c[i]; }
- inline component_type& operator[] (uint32 i) { CRND_ASSERT(i < cNumComps); return c[i]; }
-
- inline color_quad& set_component(uint32 i, parameter_type f)
- {
- CRND_ASSERT(i < cNumComps);
-
- c[i] = static_cast<component_type>(clamp(f));
-
- return *this;
- }
-
- inline color_quad& clamp(const color_quad& l, const color_quad& h)
- {
- for (uint32 i = 0; i < cNumComps; i++)
- c[i] = static_cast<component_type>(math::clamp<parameter_type>(c[i], l[i], h[i]));
- return *this;
- }
-
- inline color_quad& clamp(parameter_type l, parameter_type h)
- {
- for (uint32 i = 0; i < cNumComps; i++)
- c[i] = static_cast<component_type>(math::clamp<parameter_type>(c[i], l, h));
- return *this;
- }
-
- // Returns CCIR 601 luma (consistent with color_utils::RGB_To_Y).
- inline parameter_type get_luma() const
- {
- return static_cast<parameter_type>((19595U * r + 38470U * g + 7471U * b + 32768) >> 16U);
- }
-
- // Returns REC 709 luma.
- inline parameter_type get_luma_rec709() const
- {
- return static_cast<parameter_type>((13938U * r + 46869U * g + 4729U * b + 32768U) >> 16U);
- }
-
- inline uint32 squared_distance(const color_quad& c, bool alpha = true) const
- {
- return math::square(r - c.r) + math::square(g - c.g) + math::square(b - c.b) + (alpha ? math::square(a - c.a) : 0);
- }
-
- inline bool rgb_equals(const color_quad& rhs) const
- {
- return (r == rhs.r) && (g == rhs.g) && (b == rhs.b);
- }
-
- inline bool operator== (const color_quad& rhs) const
- {
- return (r == rhs.r) && (g == rhs.g) && (b == rhs.b) && (a == rhs.a);
- }
-
- inline bool operator< (const color_quad& rhs) const
- {
- for (uint32 i = 0; i < cNumComps; i++)
- {
- if (c[i] < rhs.c[i])
- return true;
- else if (!(c[i] == rhs.c[i]))
- return false;
- }
- return false;
- }
-
- inline color_quad& operator+= (const color_quad& other)
- {
- for (uint32 i = 0; i < 4; i++)
- c[i] = static_cast<component_type>(clamp(c[i] + other.c[i]));
- return *this;
- }
-
- inline color_quad& operator-= (const color_quad& other)
- {
- for (uint32 i = 0; i < 4; i++)
- c[i] = static_cast<component_type>(clamp(c[i] - other.c[i]));
- return *this;
- }
-
- inline color_quad& operator*= (parameter_type v)
- {
- for (uint32 i = 0; i < 4; i++)
- c[i] = static_cast<component_type>(clamp(c[i] * v));
- return *this;
- }
-
- inline color_quad& operator/= (parameter_type v)
- {
- for (uint32 i = 0; i < 4; i++)
- c[i] = static_cast<component_type>(c[i] / v);
- return *this;
- }
-
- inline color_quad get_swizzled(uint32 x, uint32 y, uint32 z, uint32 w) const
- {
- CRND_ASSERT((x | y | z | w) < 4);
- return color_quad(c[x], c[y], c[z], c[w]);
- }
-
- inline friend color_quad operator+ (const color_quad& lhs, const color_quad& rhs)
- {
- color_quad result(lhs);
- result += rhs;
- return result;
- }
-
- inline friend color_quad operator- (const color_quad& lhs, const color_quad& rhs)
- {
- color_quad result(lhs);
- result -= rhs;
- return result;
- }
-
- inline friend color_quad operator* (const color_quad& lhs, parameter_type v)
- {
- color_quad result(lhs);
- result *= v;
- return result;
- }
-
- friend inline color_quad operator/ (const color_quad& lhs, parameter_type v)
- {
- color_quad result(lhs);
- result /= v;
- return result;
- }
-
- friend inline color_quad operator* (parameter_type v, const color_quad& rhs)
- {
- color_quad result(rhs);
- result *= v;
- return result;
- }
-
- inline uint32 get_min_component_index(bool alpha = true) const
- {
- uint32 index = 0;
- uint32 limit = alpha ? cNumComps : (cNumComps - 1);
- for (uint32 i = 1; i < limit; i++)
- if (c[i] < c[index])
- index = i;
- return index;
- }
-
- inline uint32 get_max_component_index(bool alpha = true) const
- {
- uint32 index = 0;
- uint32 limit = alpha ? cNumComps : (cNumComps - 1);
- for (uint32 i = 1; i < limit; i++)
- if (c[i] > c[index])
- index = i;
- return index;
- }
-
- inline void get_float4(float* pDst)
- {
- for (uint32 i = 0; i < 4; i++)
- pDst[i] = ((*this)[i] - component_traits::cMin) / float(component_traits::cMax - component_traits::cMin);
- }
-
- inline void get_float3(float* pDst)
- {
- for (uint32 i = 0; i < 3; i++)
- pDst[i] = ((*this)[i] - component_traits::cMin) / float(component_traits::cMax - component_traits::cMin);
- }
-
- static inline color_quad make_black()
- {
- return color_quad(0, 0, 0, component_traits::cMax);
- }
-
- static inline color_quad make_white()
- {
- return color_quad(component_traits::cMax, component_traits::cMax, component_traits::cMax, component_traits::cMax);
- }
- }; // class color_quad
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
- template<typename c, typename q>
- struct scalar_type< color_quad<c, q> >
- {
- enum { cFlag = true };
- static inline void construct(color_quad<c, q>* p) { }
- static inline void construct(color_quad<c, q>* p, const color_quad<c, q>& init) { memcpy(p, &init, sizeof(color_quad<c, q>)); }
- static inline void construct_array(color_quad<c, q>* p, uint32 n) { p, n; }
- static inline void destruct(color_quad<c, q>* p) { p; }
- static inline void destruct_array(color_quad<c, q>* p, uint32 n) { p, n; }
- };
-
- typedef color_quad<uint8, int> color_quad_u8;
- typedef color_quad<int16, int> color_quad_i16;
- typedef color_quad<uint16, int> color_quad_u16;
- typedef color_quad<int32, int> color_quad_i32;
- typedef color_quad<uint32, uint32> color_quad_u32;
- typedef color_quad<float, float> color_quad_f;
- typedef color_quad<double, double> color_quad_d;
-
-} // namespace crnd
-
-// File: crnd_dxt.h
-namespace crnd
-{
- enum dxt_format
- {
- cDXTInvalid = -1,
-
- // cDXT1/1A must appear first!
- cDXT1,
- cDXT1A,
-
- cDXT3,
- cDXT5,
- cDXT5A,
-
- cDXN_XY, // inverted relative to standard ATI2, 360's DXN
- cDXN_YX // standard ATI2
- };
-
- enum dxt_constants
- {
- cDXTBlockShift = 2U,
- cDXTBlockSize = 1U << cDXTBlockShift,
-
- cDXT1BytesPerBlock = 8U,
- cDXT5NBytesPerBlock = 16U,
-
- cDXT1SelectorBits = 2U,
- cDXT1SelectorValues = 1U << cDXT1SelectorBits,
- cDXT1SelectorMask = cDXT1SelectorValues - 1U,
-
- cDXT5SelectorBits = 3U,
- cDXT5SelectorValues = 1U << cDXT5SelectorBits,
- cDXT5SelectorMask = cDXT5SelectorValues - 1U
- };
-
- const float cDXT1MaxLinearValue = 3.0f;
- const float cDXT1InvMaxLinearValue = 1.0f/3.0f;
-
- const float cDXT5MaxLinearValue = 7.0f;
- const float cDXT5InvMaxLinearValue = 1.0f/7.0f;
-
- // Converts DXT1 raw color selector index to a linear value.
- extern const uint8 g_dxt1_to_linear[cDXT1SelectorValues];
-
- // Converts DXT5 raw alpha selector index to a linear value.
- extern const uint8 g_dxt5_to_linear[cDXT5SelectorValues];
-
- // Converts DXT1 linear color selector index to a raw value (inverse of g_dxt1_to_linear).
- extern const uint8 g_dxt1_from_linear[cDXT1SelectorValues];
-
- // Converts DXT5 linear alpha selector index to a raw value (inverse of g_dxt5_to_linear).
- extern const uint8 g_dxt5_from_linear[cDXT5SelectorValues];
-
- extern const uint8 g_six_alpha_invert_table[cDXT5SelectorValues];
- extern const uint8 g_eight_alpha_invert_table[cDXT5SelectorValues];
-
- struct dxt1_block
- {
- uint8 m_low_color[2];
- uint8 m_high_color[2];
-
- enum { cNumSelectorBytes = 4 };
- uint8 m_selectors[cNumSelectorBytes];
-
- inline void clear()
- {
- utils::zero_this(this);
- }
-
- // These methods assume the in-memory rep is in LE byte order.
- inline uint32 get_low_color() const
- {
- return m_low_color[0] | (m_low_color[1] << 8U);
- }
-
- inline uint32 get_high_color() const
- {
- return m_high_color[0] | (m_high_color[1] << 8U);
- }
-
- inline void set_low_color(uint16 c)
- {
- m_low_color[0] = static_cast<uint8>(c & 0xFF);
- m_low_color[1] = static_cast<uint8>((c >> 8) & 0xFF);
- }
-
- inline void set_high_color(uint16 c)
- {
- m_high_color[0] = static_cast<uint8>(c & 0xFF);
- m_high_color[1] = static_cast<uint8>((c >> 8) & 0xFF);
- }
-
- inline uint32 get_selector(uint32 x, uint32 y) const
- {
- CRND_ASSERT((x < 4U) && (y < 4U));
- return (m_selectors[y] >> (x * cDXT1SelectorBits)) & cDXT1SelectorMask;
- }
-
- inline void set_selector(uint32 x, uint32 y, uint32 val)
- {
- CRND_ASSERT((x < 4U) && (y < 4U) && (val < 4U));
-
- m_selectors[y] &= (~(cDXT1SelectorMask << (x * cDXT1SelectorBits)));
- m_selectors[y] |= (val << (x * cDXT1SelectorBits));
- }
-
- static uint16 pack_color(const color_quad_u8& color, bool scaled, uint32 bias = 127U);
- static uint16 pack_color(uint32 r, uint32 g, uint32 b, bool scaled, uint32 bias = 127U);
-
- static color_quad_u8 unpack_color(uint16 packed_color, bool scaled, uint32 alpha = 255U);
- static void unpack_color(uint32& r, uint32& g, uint32& b, uint16 packed_color, bool scaled);
-
- static uint32 get_block_colors3(color_quad_u8* pDst, uint16 color0, uint16 color1);
- static uint32 get_block_colors4(color_quad_u8* pDst, uint16 color0, uint16 color1);
- // pDst must point to an array at least cDXT1SelectorValues long.
- static uint32 get_block_colors(color_quad_u8* pDst, uint16 color0, uint16 color1);
-
- static color_quad_u8 unpack_endpoint(uint32 endpoints, uint32 index, bool scaled, uint32 alpha = 255U);
- static uint32 pack_endpoints(uint32 lo, uint32 hi);
- };
-
- CRND_DEFINE_BITWISE_MOVABLE(dxt1_block);
-
- struct dxt3_block
- {
- enum { cNumAlphaBytes = 8 };
- uint8 m_alpha[cNumAlphaBytes];
-
- void set_alpha(uint32 x, uint32 y, uint32 value, bool scaled);
- uint32 get_alpha(uint32 x, uint32 y, bool scaled) const;
- };
-
- CRND_DEFINE_BITWISE_MOVABLE(dxt3_block);
-
- struct dxt5_block
- {
- uint8 m_endpoints[2];
-
- enum { cNumSelectorBytes = 6 };
- uint8 m_selectors[cNumSelectorBytes];
-
- inline void clear()
- {
- utils::zero_this(this);
- }
-
- inline uint32 get_low_alpha() const
- {
- return m_endpoints[0];
- }
-
- inline uint32 get_high_alpha() const
- {
- return m_endpoints[1];
- }
-
- inline void set_low_alpha(uint32 i)
- {
- CRND_ASSERT(i <= cUINT8_MAX);
- m_endpoints[0] = static_cast<uint8>(i);
- }
-
- inline void set_high_alpha(uint32 i)
- {
- CRND_ASSERT(i <= cUINT8_MAX);
- m_endpoints[1] = static_cast<uint8>(i);
- }
-
- uint32 get_endpoints_as_word() const { return m_endpoints[0] | (m_endpoints[1] << 8); }
-
- uint32 get_selectors_as_word(uint32 index) { CRND_ASSERT(index < 3); return m_selectors[index * 2] | (m_selectors[index * 2 + 1] << 8); }
-
- inline uint32 get_selector(uint32 x, uint32 y) const
- {
- CRND_ASSERT((x < 4U) && (y < 4U));
-
- uint32 selector_index = (y * 4) + x;
- uint32 bit_index = selector_index * cDXT5SelectorBits;
-
- uint32 byte_index = bit_index >> 3;
- uint32 bit_ofs = bit_index & 7;
-
- uint32 v = m_selectors[byte_index];
- if (byte_index < (cNumSelectorBytes - 1))
- v |= (m_selectors[byte_index + 1] << 8);
-
- return (v >> bit_ofs) & 7;
- }
-
- inline void set_selector(uint32 x, uint32 y, uint32 val)
- {
- CRND_ASSERT((x < 4U) && (y < 4U) && (val < 8U));
-
- uint32 selector_index = (y * 4) + x;
- uint32 bit_index = selector_index * cDXT5SelectorBits;
-
- uint32 byte_index = bit_index >> 3;
- uint32 bit_ofs = bit_index & 7;
-
- uint32 v = m_selectors[byte_index];
- if (byte_index < (cNumSelectorBytes - 1))
- v |= (m_selectors[byte_index + 1] << 8);
-
- v &= (~(7 << bit_ofs));
- v |= (val << bit_ofs);
-
- m_selectors[byte_index] = static_cast<uint8>(v);
- if (byte_index < (cNumSelectorBytes - 1))
- m_selectors[byte_index + 1] = static_cast<uint8>(v >> 8);
- }
-
- // Results written to alpha channel.
- static uint32 get_block_values6(color_quad_u8* pDst, uint32 l, uint32 h);
- static uint32 get_block_values8(color_quad_u8* pDst, uint32 l, uint32 h);
- static uint32 get_block_values(color_quad_u8* pDst, uint32 l, uint32 h);
-
- static uint32 get_block_values6(uint32* pDst, uint32 l, uint32 h);
- static uint32 get_block_values8(uint32* pDst, uint32 l, uint32 h);
- // pDst must point to an array at least cDXT5SelectorValues long.
- static uint32 get_block_values(uint32* pDst, uint32 l, uint32 h);
-
- static uint32 unpack_endpoint(uint32 packed, uint32 index);
- static uint32 pack_endpoints(uint32 lo, uint32 hi);
- };
-
- CRND_DEFINE_BITWISE_MOVABLE(dxt5_block);
-
-} // namespace crnd
-
-// File: crnd_dxt_hc_common.h
-namespace crnd
-{
- struct chunk_tile_desc
- {
- // These values are in pixels, and always a multiple of cBlockPixelWidth/cBlockPixelHeight.
- uint32 m_x_ofs;
- uint32 m_y_ofs;
- uint32 m_width;
- uint32 m_height;
- uint32 m_layout_index;
- };
-
- struct chunk_encoding_desc
- {
- uint32 m_num_tiles;
- chunk_tile_desc m_tiles[4];
- };
-
- const uint32 cChunkPixelWidth = 8;
- const uint32 cChunkPixelHeight = 8;
- const uint32 cChunkBlockWidth = 2;
- const uint32 cChunkBlockHeight = 2;
-
- const uint32 cChunkMaxTiles = 4;
-
- const uint32 cBlockPixelWidthShift = 2;
- const uint32 cBlockPixelHeightShift = 2;
-
- const uint32 cBlockPixelWidth = 4;
- const uint32 cBlockPixelHeight = 4;
-
- const uint32 cNumChunkEncodings = 8;
- extern chunk_encoding_desc g_chunk_encodings[cNumChunkEncodings];
-
- const uint32 cNumChunkTileLayouts = 9;
- const uint32 cFirst4x4ChunkTileLayout = 5;
- extern chunk_tile_desc g_chunk_tile_layouts[cNumChunkTileLayouts];
-
-} // namespace crnd
-
-// File: crnd_prefix_coding.h
-#ifdef _XBOX
-#define CRND_PREFIX_CODING_USE_FIXED_TABLE_SIZE 1
-#else
-#define CRND_PREFIX_CODING_USE_FIXED_TABLE_SIZE 0
-#endif
-
-namespace crnd
-{
- namespace prefix_coding
- {
- const uint32 cMaxExpectedCodeSize = 16;
- const uint32 cMaxSupportedSyms = 8192;
- const uint32 cMaxTableBits = 11;
-
- class decoder_tables
- {
- public:
- inline decoder_tables() :
- m_cur_lookup_size(0), m_lookup(NULL), m_cur_sorted_symbol_order_size(0), m_sorted_symbol_order(NULL)
- {
- }
-
- inline decoder_tables(const decoder_tables& other) :
- m_cur_lookup_size(0), m_lookup(NULL), m_cur_sorted_symbol_order_size(0), m_sorted_symbol_order(NULL)
- {
- *this = other;
- }
-
- decoder_tables& operator= (const decoder_tables& other)
- {
- if (this == &other)
- return *this;
-
- clear();
-
- memcpy(this, &other, sizeof(*this));
-
- if (other.m_lookup)
- {
- m_lookup = crnd_new_array<uint32>(m_cur_lookup_size);
- if (m_lookup)
- memcpy(m_lookup, other.m_lookup, sizeof(m_lookup[0]) * m_cur_lookup_size);
- }
-
- if (other.m_sorted_symbol_order)
- {
- m_sorted_symbol_order = crnd_new_array<uint16>(m_cur_sorted_symbol_order_size);
- if (m_sorted_symbol_order)
- memcpy(m_sorted_symbol_order, other.m_sorted_symbol_order, sizeof(m_sorted_symbol_order[0]) * m_cur_sorted_symbol_order_size);
- }
-
- return *this;
- }
-
- inline void clear()
- {
- if (m_lookup)
- {
- crnd_delete_array(m_lookup);
- m_lookup = 0;
- m_cur_lookup_size = 0;
- }
-
- if (m_sorted_symbol_order)
- {
- crnd_delete_array(m_sorted_symbol_order);
- m_sorted_symbol_order = NULL;
- m_cur_sorted_symbol_order_size = 0;
- }
- }
-
- inline ~decoder_tables()
- {
- if (m_lookup)
- crnd_delete_array(m_lookup);
-
- if (m_sorted_symbol_order)
- crnd_delete_array(m_sorted_symbol_order);
- }
-
- bool init(uint32 num_syms, const uint8* pCodesizes, uint32 table_bits);
-
- // DO NOT use any complex classes here - it is bitwise copied.
-
- uint32 m_num_syms;
- uint32 m_total_used_syms;
- uint32 m_table_bits;
- uint32 m_table_shift;
- uint32 m_table_max_code;
- uint32 m_decode_start_code_size;
-
- uint8 m_min_code_size;
- uint8 m_max_code_size;
-
- uint32 m_max_codes[cMaxExpectedCodeSize + 1];
- int32 m_val_ptrs[cMaxExpectedCodeSize + 1];
-
- uint32 m_cur_lookup_size;
- uint32* m_lookup;
-
- uint32 m_cur_sorted_symbol_order_size;
- uint16* m_sorted_symbol_order;
-
- inline uint32 get_unshifted_max_code(uint32 len) const
- {
- CRND_ASSERT( (len >= 1) && (len <= cMaxExpectedCodeSize) );
- uint32 k = m_max_codes[len - 1];
- if (!k)
- return crnd::cUINT32_MAX;
- return (k - 1) >> (16 - len);
- }
- };
-
- } // namespace prefix_coding
-
-} // namespace crnd
-
-// File: crnd_symbol_codec.h
-namespace crnd
-{
- class static_huffman_data_model
- {
- public:
- static_huffman_data_model();
- static_huffman_data_model(const static_huffman_data_model& other);
- ~static_huffman_data_model();
-
- static_huffman_data_model& operator= (const static_huffman_data_model& rhs);
-
- bool init(uint32 total_syms, const uint8* pCode_sizes, uint32 code_size_limit);
- void clear();
-
- inline bool is_valid() const { return m_pDecode_tables != NULL; }
-
- inline uint32 get_total_syms() const { return m_total_syms; }
-
- inline uint32 get_code_size(uint32 sym) const { return m_code_sizes[sym]; }
-
- inline const uint8* get_code_sizes() const { return m_code_sizes.empty() ? NULL : &m_code_sizes[0]; }
-
- public:
- uint32 m_total_syms;
- crnd::vector<uint8> m_code_sizes;
- prefix_coding::decoder_tables* m_pDecode_tables;
-
- private:
- bool prepare_decoder_tables();
- uint compute_decoder_table_bits() const;
-
- friend class symbol_codec;
- };
-
- class symbol_codec
- {
- public:
- symbol_codec();
-
- bool start_decoding(const uint8* pBuf, uint32 buf_size);
- bool decode_receive_static_data_model(static_huffman_data_model& model);
-
- uint32 decode_bits(uint32 num_bits);
- uint32 decode(const static_huffman_data_model& model);
-
- uint64 stop_decoding();
-
- public:
- const uint8* m_pDecode_buf;
- const uint8* m_pDecode_buf_next;
- const uint8* m_pDecode_buf_end;
- uint32 m_decode_buf_size;
-
- typedef uint32 bit_buf_type;
- enum { cBitBufSize = 32U };
- bit_buf_type m_bit_buf;
-
- int m_bit_count;
-
- private:
- void get_bits_init();
- uint32 get_bits(uint32 num_bits);
- };
-
-} // namespace crnd
-
-#define CRND_HUFF_DECODE_BEGIN(x)
-#define CRND_HUFF_DECODE_END(x)
-#define CRND_HUFF_DECODE(codec, model, symbol) symbol = codec.decode(model);
-
-namespace crnd
-{
- void crnd_assert(const char* pExp, const char* pFile, unsigned line)
- {
- char buf[512];
-
-#if defined(WIN32) && defined(_MSC_VER)
- sprintf_s(buf, sizeof(buf), "%s(%u): Assertion failure: \"%s\"\n", pFile, line, pExp);
-#else
- sprintf(buf, "%s(%u): Assertion failure: \"%s\"\n", pFile, line, pExp);
-#endif
-
- crnd_output_debug_string(buf);
-
- puts(buf);
-
- if (crnd_is_debugger_present())
- crnd_debug_break();
- }
-
- void crnd_trace(const char* pFmt, va_list args)
- {
- if (crnd_is_debugger_present())
- {
- char buf[512];
-#if defined(WIN32) && defined(_MSC_VER)
- vsprintf_s(buf, sizeof(buf), pFmt, args);
-#else
- vsprintf(buf, pFmt, args);
-#endif
-
- crnd_output_debug_string(buf);
- }
- };
-
- void crnd_trace(const char* pFmt, ...)
- {
- va_list args;
- va_start(args, pFmt);
- crnd_trace(pFmt, args);
- va_end(args);
- };
-
-} // namespace crnd
-
-// File: checksum.cpp
-// From the public domain stb.h header.
-namespace crnd
-{
- uint16 crc16(const void* pBuf, uint32 len, uint16 crc)
- {
- crc = ~crc;
-
- const uint8* p = reinterpret_cast<const uint8*>(pBuf);
- while (len)
- {
- const uint16 q = *p++ ^ (crc >> 8U);
- crc <<= 8U;
-
- uint16 r = (q >> 4U) ^ q;
- crc ^= r;
- r <<= 5U;
- crc ^= r;
- r <<= 7U;
- crc ^= r;
-
- len--;
- }
-
- return static_cast<uint16>(~crc);
- }
-
-} // namespace crnd
-
-
-// File: crnd_vector.cpp
-namespace crnd
-{
- bool elemental_vector::increase_capacity(uint32 min_new_capacity, bool grow_hint, uint32 element_size, object_mover pMover)
- {
- CRND_ASSERT(m_size <= m_capacity);
- CRND_ASSERT(min_new_capacity < (0x7FFF0000U / element_size));
-
- if (m_capacity >= min_new_capacity)
- return true;
-
- uint32 new_capacity = min_new_capacity;
- if ((grow_hint) && (!math::is_power_of_2(new_capacity)))
- new_capacity = math::next_pow2(new_capacity);
-
- CRND_ASSERT(new_capacity && (new_capacity > m_capacity));
-
- const uint32 desired_size = element_size * new_capacity;
- size_t actual_size;
- if (!pMover)
- {
- void* new_p = crnd_realloc(m_p, desired_size, &actual_size, true);
- if (!new_p)
- return false;
- m_p = new_p;
- }
- else
- {
- void* new_p = crnd_malloc(desired_size, &actual_size);
- if (!new_p)
- return false;
-
- (*pMover)(new_p, m_p, m_size);
-
- if (m_p)
- crnd_free(m_p);
-
- m_p = new_p;
- }
-
- if (actual_size > desired_size)
- m_capacity = static_cast<uint32>(actual_size / element_size);
- else
- m_capacity = new_capacity;
-
- return true;
- }
-
-} // namespace crnd
-
-// File: crnd_utils.cpp
-namespace crnd
-{
- namespace utils
- {
- uint32 compute_max_mips(uint32 width, uint32 height)
- {
- if ((width | height) == 0)
- return 0;
-
- uint32 num_mips = 1;
-
- while ((width > 1U) || (height > 1U))
- {
- width >>= 1U;
- height >>= 1U;
- num_mips++;
- }
-
- return num_mips;
- }
-
- } // namespace utils
-
-} // namespace crnd
-
-// File: crnd_prefix_coding.cpp
-namespace crnd
-{
- namespace prefix_coding
- {
- bool decoder_tables::init(uint32 num_syms, const uint8* pCodesizes, uint32 table_bits)
- {
- uint32 min_codes[cMaxExpectedCodeSize];
- if ((!num_syms) || (table_bits > cMaxTableBits))
- return false;
-
- m_num_syms = num_syms;
-
- uint32 num_codes[cMaxExpectedCodeSize + 1];
- utils::zero_object(num_codes);
-
- for (uint32 i = 0; i < num_syms; i++)
- {
- uint32 c = pCodesizes[i];
- if (c)
- num_codes[c]++;
- }
-
- uint32 sorted_positions[cMaxExpectedCodeSize + 1];
-
- uint32 cur_code = 0;
-
- uint32 total_used_syms = 0;
- uint32 max_code_size = 0;
- uint32 min_code_size = cUINT32_MAX;
- for (uint32 i = 1; i <= cMaxExpectedCodeSize; i++)
- {
- const uint32 n = num_codes[i];
-
- if (!n)
- m_max_codes[i - 1] = 0;//UINT_MAX;
- else
- {
- min_code_size = math::minimum(min_code_size, i);
- max_code_size = math::maximum(max_code_size, i);
-
- min_codes[i - 1] = cur_code;
-
- m_max_codes[i - 1] = cur_code + n - 1;
- m_max_codes[i - 1] = 1 + ((m_max_codes[i - 1] << (16 - i)) | ((1 << (16 - i)) - 1));
-
- m_val_ptrs[i - 1] = total_used_syms;
-
- sorted_positions[i] = total_used_syms;
-
- cur_code += n;
- total_used_syms += n;
- }
-
- cur_code <<= 1;
- }
-
- m_total_used_syms = total_used_syms;
-
- if (total_used_syms > m_cur_sorted_symbol_order_size)
- {
- m_cur_sorted_symbol_order_size = total_used_syms;
-
- if (!math::is_power_of_2(total_used_syms))
- m_cur_sorted_symbol_order_size = math::minimum<uint32>(num_syms, math::next_pow2(total_used_syms));
-
- if (m_sorted_symbol_order)
- crnd_delete_array(m_sorted_symbol_order);
-
- m_sorted_symbol_order = crnd_new_array<uint16>(m_cur_sorted_symbol_order_size);
- if (!m_sorted_symbol_order)
- return false;
- }
-
- m_min_code_size = static_cast<uint8>(min_code_size);
- m_max_code_size = static_cast<uint8>(max_code_size);
-
- for (uint32 i = 0; i < num_syms; i++)
- {
- uint32 c = pCodesizes[i];
- if (c)
- {
- CRND_ASSERT(num_codes[c]);
-
- uint32 sorted_pos = sorted_positions[c]++;
-
- CRND_ASSERT(sorted_pos < total_used_syms);
-
- m_sorted_symbol_order[sorted_pos] = static_cast<uint16>(i);
- }
- }
-
- if (table_bits <= m_min_code_size)
- table_bits = 0;
- m_table_bits = table_bits;
-
- if (table_bits)
- {
- uint32 table_size = 1 << table_bits;
- if (table_size > m_cur_lookup_size)
- {
- m_cur_lookup_size = table_size;
-
- if (m_lookup)
- crnd_delete_array(m_lookup);
-
- m_lookup = crnd_new_array<uint32>(table_size);
- if (!m_lookup)
- return false;
- }
-
- memset(m_lookup, 0xFF, (uint)sizeof(m_lookup[0]) * (1UL << table_bits));
-
- for (uint32 codesize = 1; codesize <= table_bits; codesize++)
- {
- if (!num_codes[codesize])
- continue;
-
- const uint32 fillsize = table_bits - codesize;
- const uint32 fillnum = 1 << fillsize;
-
- const uint32 min_code = min_codes[codesize - 1];
- const uint32 max_code = get_unshifted_max_code(codesize);
- const uint32 val_ptr = m_val_ptrs[codesize - 1];
-
- for (uint32 code = min_code; code <= max_code; code++)
- {
- const uint32 sym_index = m_sorted_symbol_order[ val_ptr + code - min_code ];
- CRND_ASSERT( pCodesizes[sym_index] == codesize );
-
- for (uint32 j = 0; j < fillnum; j++)
- {
- const uint32 t = j + (code << fillsize);
-
- CRND_ASSERT(t < (1U << table_bits));
-
- CRND_ASSERT(m_lookup[t] == cUINT32_MAX);
-
- m_lookup[t] = sym_index | (codesize << 16U);
- }
- }
- }
- }
-
- for (uint32 i = 0; i < cMaxExpectedCodeSize; i++)
- m_val_ptrs[i] -= min_codes[i];
-
- m_table_max_code = 0;
- m_decode_start_code_size = m_min_code_size;
-
- if (table_bits)
- {
- uint32 i;
- for (i = table_bits; i >= 1; i--)
- {
- if (num_codes[i])
- {
- m_table_max_code = m_max_codes[i - 1];
- break;
- }
- }
- if (i >= 1)
- {
- m_decode_start_code_size = table_bits + 1;
- for (uint32 j = table_bits + 1; j <= max_code_size; j++)
- {
- if (num_codes[j])
- {
- m_decode_start_code_size = j;
- break;
- }
- }
- }
- }
-
- // sentinels
- m_max_codes[cMaxExpectedCodeSize] = cUINT32_MAX;
- m_val_ptrs[cMaxExpectedCodeSize] = 0xFFFFF;
-
- m_table_shift = 32 - m_table_bits;
- return true;
- }
-
- } // namespace prefix_codig
-
-} // namespace crnd
-
-// File: crnd_platform.cpp
-namespace crnd
-{
- bool crnd_is_debugger_present()
- {
-#ifdef CRND_DEVEL
- return IsDebuggerPresent() != 0;
-#else
- return false;
-#endif
- }
-
- void crnd_debug_break()
- {
-#ifdef CRND_DEVEL
- DebugBreak();
-#endif
- }
-
- void crnd_output_debug_string(const char* p)
- {
- p;
-#ifdef CRND_DEVEL
- OutputDebugStringA(p);
-#endif
- }
-
-} // namespace crnd
-
-// File: crnd_mem.cpp
-namespace crnd
-{
- const uint32 MAX_POSSIBLE_BLOCK_SIZE = 0x7FFF0000U;
-
- static void* crnd_default_realloc(void* p, size_t size, size_t* pActual_size, bool movable, void* pUser_data)
- {
- pUser_data;
-
- void* p_new;
-
- if (!p)
- {
- p_new = ::malloc(size);
-
- if (pActual_size)
- {
-#ifdef WIN32
- *pActual_size = p_new ? ::_msize(p_new) : 0;
-#else
- *pActual_size = p_new ? malloc_usable_size(p_new) : 0;
-#endif
- }
- }
- else if (!size)
- {
- ::free(p);
- p_new = NULL;
-
- if (pActual_size)
- *pActual_size = 0;
- }
- else
- {
- void* p_final_block = p;
-#ifdef WIN32
- p_new = ::_expand(p, size);
-#else
- p_new = NULL;
-#endif
-
- if (p_new)
- p_final_block = p_new;
- else if (movable)
- {
- p_new = ::realloc(p, size);
-
- if (p_new)
- p_final_block = p_new;
- }
-
- if (pActual_size)
- {
-#ifdef WIN32
- *pActual_size = ::_msize(p_final_block);
-#else
- *pActual_size = ::malloc_usable_size(p_final_block);
-#endif
- }
- }
-
- return p_new;
- }
-
- static size_t crnd_default_msize(void* p, void* pUser_data)
- {
- pUser_data;
-#ifdef WIN32
- return p ? _msize(p) : 0;
-#else
- return p ? malloc_usable_size(p) : 0;
-#endif
- }
-
- static crnd_realloc_func g_pRealloc = crnd_default_realloc;
- static crnd_msize_func g_pMSize = crnd_default_msize;
- static void* g_pUser_data;
-
- void crnd_set_memory_callbacks(crnd_realloc_func pRealloc, crnd_msize_func pMSize, void* pUser_data)
- {
- if ((!pRealloc) || (!pMSize))
- {
- g_pRealloc = crnd_default_realloc;
- g_pMSize = crnd_default_msize;
- g_pUser_data = NULL;
- }
- else
- {
- g_pRealloc = pRealloc;
- g_pMSize = pMSize;
- g_pUser_data = pUser_data;
- }
- }
-
- static inline void crnd_mem_error(const char* p_msg)
- {
- crnd_assert(p_msg, __FILE__, __LINE__);
- }
-
- void* crnd_malloc(size_t size, size_t* pActual_size)
- {
- size = (size + sizeof(uint32) - 1U) & ~(sizeof(uint32) - 1U);
- if (!size)
- size = sizeof(uint32);
-
- if (size > MAX_POSSIBLE_BLOCK_SIZE)
- {
- crnd_mem_error("crnd_malloc: size too big");
- return NULL;
- }
-
- size_t actual_size = size;
- uint8* p_new = static_cast<uint8*>((*g_pRealloc)(NULL, size, &actual_size, true, g_pUser_data));
-
- if (pActual_size)
- *pActual_size = actual_size;
-
- if ((!p_new) || (actual_size < size))
- {
- crnd_mem_error("crnd_malloc: out of memory");
- return NULL;
- }
-
- CRND_ASSERT(((uint32)p_new & (CRND_MIN_ALLOC_ALIGNMENT - 1)) == 0);
-
- return p_new;
- }
-
- void* crnd_realloc(void* p, size_t size, size_t* pActual_size, bool movable)
- {
- if ((uint32)reinterpret_cast<ptr_bits>(p) & (CRND_MIN_ALLOC_ALIGNMENT - 1))
- {
- crnd_mem_error("crnd_realloc: bad ptr");
- return NULL;
- }
-
- if (size > MAX_POSSIBLE_BLOCK_SIZE)
- {
- crnd_mem_error("crnd_malloc: size too big");
- return NULL;
- }
-
- size_t actual_size = size;
- void* p_new = (*g_pRealloc)(p, size, &actual_size, movable, g_pUser_data);
-
- if (pActual_size)
- *pActual_size = actual_size;
-
- CRND_ASSERT(((uint32)p_new & (CRND_MIN_ALLOC_ALIGNMENT - 1)) == 0);
-
- return p_new;
- }
-
- void crnd_free(void* p)
- {
- if (!p)
- return;
-
- if ((uint32)reinterpret_cast<ptr_bits>(p) & (CRND_MIN_ALLOC_ALIGNMENT - 1))
- {
- crnd_mem_error("crnd_free: bad ptr");
- return;
- }
-
- (*g_pRealloc)(p, 0, NULL, true, g_pUser_data);
- }
-
- size_t crnd_msize(void* p)
- {
- if (!p)
- return 0;
-
- if ((uint32)reinterpret_cast<ptr_bits>(p) & (CRND_MIN_ALLOC_ALIGNMENT - 1))
- {
- crnd_mem_error("crnd_msize: bad ptr");
- return 0;
- }
-
- return (*g_pMSize)(p, g_pUser_data);
- }
-
-} // namespace crnd
-
-// File: crnd_math.cpp
-namespace crnd
-{
- namespace math
- {
- uint32 g_bitmasks[32] =
- {
- 1U << 0U, 1U << 1U, 1U << 2U, 1U << 3U,
- 1U << 4U, 1U << 5U, 1U << 6U, 1U << 7U,
- 1U << 8U, 1U << 9U, 1U << 10U, 1U << 11U,
- 1U << 12U, 1U << 13U, 1U << 14U, 1U << 15U,
- 1U << 16U, 1U << 17U, 1U << 18U, 1U << 19U,
- 1U << 20U, 1U << 21U, 1U << 22U, 1U << 23U,
- 1U << 24U, 1U << 25U, 1U << 26U, 1U << 27U,
- 1U << 28U, 1U << 29U, 1U << 30U, 1U << 31U
- };
-
- } // namespace math
-} // namespace crnd
-
-// File: crnd_info.cpp
-namespace crnd
-{
-#define CRND_FOURCC(a, b, c, d) ((a) | ((b) << 8U) | ((c) << 16U) | ((d) << 24U))
-
- uint32 crnd_crn_format_to_fourcc(crn_format fmt)
- {
- switch (fmt)
- {
- case cCRNFmtDXT1: return CRND_FOURCC('D', 'X', 'T', '1');
- case cCRNFmtDXT3: return CRND_FOURCC('D', 'X', 'T', '3');
- case cCRNFmtDXT5: return CRND_FOURCC('D', 'X', 'T', '5');
- case cCRNFmtDXN_XY: return CRND_FOURCC('A', '2', 'X', 'Y');
- case cCRNFmtDXN_YX: return CRND_FOURCC('A', 'T', 'I', '2');
- case cCRNFmtDXT5A: return CRND_FOURCC('A', 'T', 'I', '1');
- case cCRNFmtDXT5_CCxY: return CRND_FOURCC('C', 'C', 'x', 'Y');
- case cCRNFmtDXT5_xGxR: return CRND_FOURCC('x', 'G', 'x', 'R');
- case cCRNFmtDXT5_xGBR: return CRND_FOURCC('x', 'G', 'B', 'R');
- case cCRNFmtDXT5_AGBR: return CRND_FOURCC('A', 'G', 'B', 'R');
- case cCRNFmtETC1: return CRND_FOURCC('E', 'T', 'C', '1');
- default: break;
- }
- CRND_ASSERT(false);
- return 0;
- }
-
- crn_format crnd_get_fundamental_dxt_format(crn_format fmt)
- {
- switch (fmt)
- {
- case cCRNFmtDXT5_CCxY:
- case cCRNFmtDXT5_xGxR:
- case cCRNFmtDXT5_xGBR:
- case cCRNFmtDXT5_AGBR:
- return cCRNFmtDXT5;
- default: break;
- }
- return fmt;
- }
-
- uint32 crnd_get_crn_format_bits_per_texel(crn_format fmt)
- {
- switch (fmt)
- {
- case cCRNFmtDXT1:
- case cCRNFmtDXT5A:
- case cCRNFmtETC1:
- return 4;
- case cCRNFmtDXT3:
- case cCRNFmtDXT5:
- case cCRNFmtDXN_XY:
- case cCRNFmtDXN_YX:
- case cCRNFmtDXT5_CCxY:
- case cCRNFmtDXT5_xGxR:
- case cCRNFmtDXT5_xGBR:
- case cCRNFmtDXT5_AGBR:
- return 8;
- default: break;
- }
- CRND_ASSERT(false);
- return 0;
- }
-
- uint32 crnd_get_bytes_per_dxt_block(crn_format fmt)
- {
- return (crnd_get_crn_format_bits_per_texel(fmt) << 4) >> 3;
- }
-
- // TODO: tmp_header isn't used/This function is a helper to support old headers.
- const crn_header* crnd_get_header(crn_header& tmp_header, const void* pData, uint32 data_size)
- {
- tmp_header;
-
- if ((!pData) || (data_size < sizeof(crn_header)))
- return NULL;
-
- const crn_header& file_header = *static_cast<const crn_header*>(pData);
- if (file_header.m_sig != crn_header::cCRNSigValue)
- return NULL;
-
- if ((file_header.m_header_size < sizeof(crn_header)) || (data_size < file_header.m_data_size))
- return NULL;
-
- return &file_header;
- }
-
- bool crnd_validate_file(const void* pData, uint32 data_size, crn_file_info* pFile_info)
- {
- if (pFile_info)
- {
- if (pFile_info->m_struct_size != sizeof(crn_file_info))
- return false;
-
- memset(&pFile_info->m_struct_size + 1, 0, sizeof(crn_file_info) - sizeof(pFile_info->m_struct_size));
- }
-
- if ((!pData) || (data_size < cCRNHeaderMinSize))
- return false;
-
- crn_header tmp_header;
- const crn_header* pHeader = crnd_get_header(tmp_header, pData, data_size);
- if (!pHeader)
- return false;
-
- const uint32 header_crc = crc16(&pHeader->m_data_size, (uint32)(pHeader->m_header_size - ((const uint8*)&pHeader->m_data_size - (const uint8*)pHeader)));
- if (header_crc != pHeader->m_header_crc16)
- return false;
-
- const uint32 data_crc = crc16((const uint8*)pData + pHeader->m_header_size, pHeader->m_data_size - pHeader->m_header_size);
- if (data_crc != pHeader->m_data_crc16)
- return false;
-
- if ((pHeader->m_faces != 1) && (pHeader->m_faces != 6))
- return false;
- if ((pHeader->m_width < 1) || (pHeader->m_width > cCRNMaxLevelResolution))
- return false;
- if ((pHeader->m_height < 1) || (pHeader->m_height > cCRNMaxLevelResolution))
- return false;
- if ((pHeader->m_levels < 1) || (pHeader->m_levels > utils::compute_max_mips(pHeader->m_width, pHeader->m_height)))
- return false;
- if (((int)pHeader->m_format < cCRNFmtDXT1) || ((int)pHeader->m_format >= cCRNFmtTotal))
- return false;
-
- if (pFile_info)
- {
- pFile_info->m_actual_data_size = pHeader->m_data_size;
- pFile_info->m_header_size = pHeader->m_header_size;
- pFile_info->m_total_palette_size = pHeader->m_color_endpoints.m_size + pHeader->m_color_selectors.m_size + pHeader->m_alpha_endpoints.m_size + pHeader->m_alpha_selectors.m_size;
- pFile_info->m_tables_size = pHeader->m_tables_size;
-
- pFile_info->m_levels = pHeader->m_levels;
-
- for (uint32 i = 0; i < pHeader->m_levels; i++)
- {
- uint32 next_ofs = pHeader->m_data_size;
-
- // assumes the levels are packed together sequentially
- if ((i + 1) < pHeader->m_levels)
- next_ofs = pHeader->m_level_ofs[i + 1];
-
- pFile_info->m_level_compressed_size[i] = next_ofs - pHeader->m_level_ofs[i];
- }
-
- pFile_info->m_color_endpoint_palette_entries = pHeader->m_color_endpoints.m_num;
- pFile_info->m_color_selector_palette_entries = pHeader->m_color_selectors.m_num;;
- pFile_info->m_alpha_endpoint_palette_entries = pHeader->m_alpha_endpoints.m_num;;
- pFile_info->m_alpha_selector_palette_entries = pHeader->m_alpha_selectors.m_num;;
- }
-
- return true;
- }
-
- bool crnd_get_texture_info(const void* pData, uint32 data_size, crn_texture_info* pInfo)
- {
- if ((!pData) || (data_size < sizeof(crn_header)) || (!pInfo))
- return false;
-
- if (pInfo->m_struct_size != sizeof(crn_texture_info))
- return false;
-
- crn_header tmp_header;
- const crn_header* pHeader = crnd_get_header(tmp_header, pData, data_size);
- if (!pHeader)
- return false;
-
- pInfo->m_width = pHeader->m_width;
- pInfo->m_height = pHeader->m_height;
- pInfo->m_levels = pHeader->m_levels;
- pInfo->m_faces = pHeader->m_faces;
- pInfo->m_format = static_cast<crn_format>((uint32)pHeader->m_format);
- pInfo->m_bytes_per_block = ((pHeader->m_format == cCRNFmtDXT1) || (pHeader->m_format == cCRNFmtDXT5A)) ? 8 : 16;
- pInfo->m_userdata0 = pHeader->m_userdata0;
- pInfo->m_userdata1 = pHeader->m_userdata1;
-
- return true;
- }
-
- bool crnd_get_level_info(const void* pData, uint32 data_size, uint32 level_index, crn_level_info* pLevel_info)
- {
- if ((!pData) || (data_size < cCRNHeaderMinSize) || (!pLevel_info))
- return false;
-
- if (pLevel_info->m_struct_size != sizeof(crn_level_info))
- return false;
-
- crn_header tmp_header;
- const crn_header* pHeader = crnd_get_header(tmp_header, pData, data_size);
- if (!pHeader)
- return false;
-
- if (level_index >= pHeader->m_levels)
- return false;
-
- uint32 width = math::maximum<uint32>(1U, pHeader->m_width >> level_index);
- uint32 height = math::maximum<uint32>(1U, pHeader->m_height >> level_index);
-
- pLevel_info->m_width = width;
- pLevel_info->m_height = height;
- pLevel_info->m_faces = pHeader->m_faces;
- pLevel_info->m_blocks_x = (width + 3) >> 2;
- pLevel_info->m_blocks_y = (height + 3) >> 2;
- pLevel_info->m_bytes_per_block = ((pHeader->m_format == cCRNFmtDXT1) || (pHeader->m_format == cCRNFmtDXT5A)) ? 8 : 16;
- pLevel_info->m_format = static_cast<crn_format>((uint32)pHeader->m_format);
-
- return true;
- }
-
- const void* crnd_get_level_data(const void* pData, uint32 data_size, uint32 level_index, uint32* pSize)
- {
- if (pSize)
- *pSize = 0;
-
- if ((!pData) || (data_size < cCRNHeaderMinSize))
- return NULL;
-
- crn_header tmp_header;
- const crn_header* pHeader = crnd_get_header(tmp_header, pData, data_size);
- if (!pHeader)
- return NULL;
-
- if (level_index >= pHeader->m_levels)
- return NULL;
-
- uint32 cur_level_ofs = pHeader->m_level_ofs[level_index];
-
- if (pSize)
- {
- uint32 next_level_ofs = data_size;
- if ((level_index + 1) < (pHeader->m_levels))
- next_level_ofs = pHeader->m_level_ofs[level_index + 1];
-
- *pSize = next_level_ofs - cur_level_ofs;
- }
-
- return static_cast<const uint8*>(pData) + cur_level_ofs;
- }
-
- uint32 crnd_get_segmented_file_size(const void* pData, uint32 data_size)
- {
- if ((!pData) || (data_size < cCRNHeaderMinSize))
- return false;
-
- crn_header tmp_header;
- const crn_header* pHeader = crnd_get_header(tmp_header, pData, data_size);
- if (!pHeader)
- return false;
-
- uint32 size = pHeader->m_header_size;
-
- size = math::maximum(size, pHeader->m_color_endpoints.m_ofs + pHeader->m_color_endpoints.m_size);
- size = math::maximum(size, pHeader->m_color_selectors.m_ofs + pHeader->m_color_selectors.m_size);
- size = math::maximum(size, pHeader->m_alpha_endpoints.m_ofs + pHeader->m_alpha_endpoints.m_size);
- size = math::maximum(size, pHeader->m_alpha_selectors.m_ofs + pHeader->m_alpha_selectors.m_size);
- size = math::maximum(size, pHeader->m_tables_ofs + pHeader->m_tables_size);
-
- return size;
- }
-
- bool crnd_create_segmented_file(const void* pData, uint32 data_size, void* pBase_data, uint base_data_size)
- {
- if ((!pData) || (data_size < cCRNHeaderMinSize))
- return false;
-
- crn_header tmp_header;
- const crn_header* pHeader = crnd_get_header(tmp_header, pData, data_size);
- if (!pHeader)
- return false;
-
- if (pHeader->m_flags & cCRNHeaderFlagSegmented)
- return false;
-
- const uint actual_base_data_size = crnd_get_segmented_file_size(pData, data_size);
- if (base_data_size < actual_base_data_size)
- return false;
-
- memcpy(pBase_data, pData, actual_base_data_size);
-
- crn_header& new_header = *static_cast<crn_header*>(pBase_data);
- new_header.m_flags = new_header.m_flags | cCRNHeaderFlagSegmented;
- new_header.m_data_size = actual_base_data_size;
-
- new_header.m_data_crc16 = crc16((const uint8*)pBase_data + new_header.m_header_size, new_header.m_data_size - new_header.m_header_size);
-
- new_header.m_header_crc16 = crc16(&new_header.m_data_size, new_header.m_header_size - (uint32)((const uint8*)&new_header.m_data_size - (const uint8*)&new_header));
-
- CRND_ASSERT(crnd_validate_file(&new_header, actual_base_data_size, NULL));
-
- return true;
- }
-
-} // namespace crnd
-
-// File: symbol_codec.cpp
-namespace crnd
-{
- static_huffman_data_model::static_huffman_data_model() :
-m_total_syms(0),
-m_pDecode_tables(NULL)
-{
-}
-
-static_huffman_data_model::static_huffman_data_model(const static_huffman_data_model& other) :
-m_total_syms(0),
-m_pDecode_tables(NULL)
-{
- *this = other;
-}
-
-static_huffman_data_model::~static_huffman_data_model()
-{
- if (m_pDecode_tables)
- crnd_delete(m_pDecode_tables);
-}
-
-static_huffman_data_model& static_huffman_data_model::operator=(const static_huffman_data_model& rhs)
-{
- if (this == &rhs)
- return *this;
-
- m_total_syms = rhs.m_total_syms;
- m_code_sizes = rhs.m_code_sizes;
- if (m_code_sizes.get_alloc_failed())
- {
- clear();
- return *this;
- }
-
- if (rhs.m_pDecode_tables)
- {
- if (m_pDecode_tables)
- *m_pDecode_tables = *rhs.m_pDecode_tables;
- else
- m_pDecode_tables = crnd_new<prefix_coding::decoder_tables>(*rhs.m_pDecode_tables);
- }
- else
- {
- crnd_delete(m_pDecode_tables);
- m_pDecode_tables = NULL;
- }
-
- return *this;
-}
-
-void static_huffman_data_model::clear()
-{
- m_total_syms = 0;
- m_code_sizes.clear();
- if (m_pDecode_tables)
- {
- crnd_delete(m_pDecode_tables);
- m_pDecode_tables = NULL;
- }
-}
-
-bool static_huffman_data_model::init(uint32 total_syms, const uint8* pCode_sizes, uint32 code_size_limit)
-{
- CRND_ASSERT((total_syms >= 1) && (total_syms <= prefix_coding::cMaxSupportedSyms) && (code_size_limit >= 1));
-
- code_size_limit = math::minimum(code_size_limit, prefix_coding::cMaxExpectedCodeSize);
-
- if (!m_code_sizes.resize(total_syms))
- return false;
-
- uint32 min_code_size = cUINT32_MAX;
- uint32 max_code_size = 0;
-
- for (uint32 i = 0; i < total_syms; i++)
- {
- uint32 s = pCode_sizes[i];
- m_code_sizes[i] = static_cast<uint8>(s);
- min_code_size = math::minimum(min_code_size, s);
- max_code_size = math::maximum(max_code_size, s);
- }
-
- if ((max_code_size < 1) || (max_code_size > 32) || (min_code_size > code_size_limit))
- return false;
-
- if (max_code_size > code_size_limit)
- return false;
-
- if (!m_pDecode_tables)
- m_pDecode_tables = crnd_new<prefix_coding::decoder_tables>();
-
- if (!m_pDecode_tables->init(m_total_syms, &m_code_sizes[0], compute_decoder_table_bits()))
- return false;
-
- return true;
-}
-
-bool static_huffman_data_model::prepare_decoder_tables()
-{
- uint32 total_syms = m_code_sizes.size();
-
- CRND_ASSERT((total_syms >= 1) && (total_syms <= prefix_coding::cMaxSupportedSyms));
-
- m_total_syms = total_syms;
-
- if (!m_pDecode_tables)
- m_pDecode_tables = crnd_new<prefix_coding::decoder_tables>();
-
- return m_pDecode_tables->init(m_total_syms, &m_code_sizes[0], compute_decoder_table_bits());
-}
-
-uint static_huffman_data_model::compute_decoder_table_bits() const
-{
-#if CRND_PREFIX_CODING_USE_FIXED_TABLE_SIZE
- return prefix_coding::cMaxTableBits;
-#else
- uint32 decoder_table_bits = 0;
- if (m_total_syms > 16)
- decoder_table_bits = static_cast<uint8>(math::minimum(1 + math::ceil_log2i(m_total_syms), prefix_coding::cMaxTableBits));
- return decoder_table_bits;
-#endif
-}
-
-symbol_codec::symbol_codec() :
- m_pDecode_buf(NULL),
- m_pDecode_buf_next(NULL),
- m_pDecode_buf_end(NULL),
- m_decode_buf_size(0),
- m_bit_buf(0),
- m_bit_count(0)
-{
-}
-
-// Code length encoding symbols:
-// 0-16 - actual code lengths
-const uint32 cMaxCodelengthCodes = 21;
-
-const uint32 cSmallZeroRunCode = 17;
-const uint32 cLargeZeroRunCode = 18;
-const uint32 cSmallRepeatCode = 19;
-const uint32 cLargeRepeatCode = 20;
-
-const uint32 cMinSmallZeroRunSize = 3;
-const uint32 cMaxSmallZeroRunSize = 10;
-const uint32 cMinLargeZeroRunSize = 11;
-const uint32 cMaxLargeZeroRunSize = 138;
-
-const uint32 cSmallMinNonZeroRunSize = 3;
-const uint32 cSmallMaxNonZeroRunSize = 6;
-const uint32 cLargeMinNonZeroRunSize = 7;
-const uint32 cLargeMaxNonZeroRunSize = 70;
-
-const uint32 cSmallZeroRunExtraBits = 3;
-const uint32 cLargeZeroRunExtraBits = 7;
-const uint32 cSmallNonZeroRunExtraBits = 2;
-const uint32 cLargeNonZeroRunExtraBits = 6;
-
-static const uint8 g_most_probable_codelength_codes[] =
-{
- cSmallZeroRunCode, cLargeZeroRunCode,
- cSmallRepeatCode, cLargeRepeatCode,
-
- 0, 8,
- 7, 9,
- 6, 10,
- 5, 11,
- 4, 12,
- 3, 13,
- 2, 14,
- 1, 15,
- 16
-};
-const uint32 cNumMostProbableCodelengthCodes = sizeof(g_most_probable_codelength_codes) / sizeof(g_most_probable_codelength_codes[0]);
-
-bool symbol_codec::decode_receive_static_data_model(static_huffman_data_model& model)
-{
- const uint32 total_used_syms = decode_bits(math::total_bits(prefix_coding::cMaxSupportedSyms));
-
- if (!total_used_syms)
- {
- model.clear();
- return true;
- }
-
- if (!model.m_code_sizes.resize(total_used_syms))
- return false;
-
- memset(&model.m_code_sizes[0], 0, sizeof(model.m_code_sizes[0]) * total_used_syms);
-
- const uint32 num_codelength_codes_to_send = decode_bits(5);
- if ((num_codelength_codes_to_send < 1) || (num_codelength_codes_to_send > cMaxCodelengthCodes))
- return false;
-
- static_huffman_data_model dm;
- if (!dm.m_code_sizes.resize(cMaxCodelengthCodes))
- return false;
-
- for (uint32 i = 0; i < num_codelength_codes_to_send; i++)
- dm.m_code_sizes[g_most_probable_codelength_codes[i]] = static_cast<uint8>(decode_bits(3));
-
- if (!dm.prepare_decoder_tables())
- return false;
-
- uint32 ofs = 0;
- while (ofs < total_used_syms)
- {
- const uint32 num_remaining = total_used_syms - ofs;
-
- uint32 code = decode(dm);
- if (code <= 16)
- model.m_code_sizes[ofs++] = static_cast<uint8>(code);
- else if (code == cSmallZeroRunCode)
- {
- uint32 len = decode_bits(cSmallZeroRunExtraBits) + cMinSmallZeroRunSize;
- if (len > num_remaining)
- return false;
- ofs += len;
- }
- else if (code == cLargeZeroRunCode)
- {
- uint32 len = decode_bits(cLargeZeroRunExtraBits) + cMinLargeZeroRunSize;
- if (len > num_remaining)
- return false;
- ofs += len;
- }
- else if ((code == cSmallRepeatCode) || (code == cLargeRepeatCode))
- {
- uint32 len;
- if (code == cSmallRepeatCode)
- len = decode_bits(cSmallNonZeroRunExtraBits) + cSmallMinNonZeroRunSize;
- else
- len = decode_bits(cLargeNonZeroRunExtraBits) + cLargeMinNonZeroRunSize;
-
- if ((!ofs) || (len > num_remaining))
- return false;
- const uint32 prev = model.m_code_sizes[ofs - 1];
- if (!prev)
- return false;
- const uint32 end = ofs + len;
- while (ofs < end)
- model.m_code_sizes[ofs++] = static_cast<uint8>(prev);
- }
- else
- {
- CRND_ASSERT(0);
- return false;
- }
- }
-
- if (ofs != total_used_syms)
- return false;
-
- return model.prepare_decoder_tables();
-}
-
-bool symbol_codec::start_decoding(const uint8* pBuf, uint32 buf_size)
-{
- if (!buf_size)
- return false;
-
- m_pDecode_buf = pBuf;
- m_pDecode_buf_next = pBuf;
- m_decode_buf_size = buf_size;
- m_pDecode_buf_end = pBuf + buf_size;
-
- get_bits_init();
-
- return true;
-}
-
-void symbol_codec::get_bits_init()
-{
- m_bit_buf = 0;
- m_bit_count = 0;
-}
-
-uint32 symbol_codec::decode_bits(uint32 num_bits)
-{
- if (!num_bits)
- return 0;
-
- if (num_bits > 16)
- {
- uint32 a = get_bits(num_bits - 16);
- uint32 b = get_bits(16);
-
- return (a << 16) | b;
- }
- else
- return get_bits(num_bits);
-}
-
-uint32 symbol_codec::get_bits(uint32 num_bits)
-{
- CRND_ASSERT(num_bits <= 32U);
-
- while (m_bit_count < (int)num_bits)
- {
- bit_buf_type c = 0;
- if (m_pDecode_buf_next != m_pDecode_buf_end)
- c = *m_pDecode_buf_next++;
-
- m_bit_count += 8;
- CRND_ASSERT(m_bit_count <= cBitBufSize);
-
- m_bit_buf |= (c << (cBitBufSize - m_bit_count));
- }
-
- uint32 result = static_cast<uint32>(m_bit_buf >> (cBitBufSize - num_bits));
-
- m_bit_buf <<= num_bits;
- m_bit_count -= num_bits;
-
- return result;
-}
-
-uint32 symbol_codec::decode(const static_huffman_data_model& model)
-{
- const prefix_coding::decoder_tables* pTables = model.m_pDecode_tables;
-
- if (m_bit_count < 24)
- {
- if (m_bit_count < 16)
- {
- uint32 c0 = 0, c1 = 0;
- const uint8* p = m_pDecode_buf_next;
- if (p < m_pDecode_buf_end) c0 = *p++;
- if (p < m_pDecode_buf_end) c1 = *p++;
- m_pDecode_buf_next = p;
- m_bit_count += 16;
- uint32 c = (c0 << 8) | c1;
- m_bit_buf |= (c << (32 - m_bit_count));
- }
- else
- {
- uint32 c = (m_pDecode_buf_next < m_pDecode_buf_end) ? *m_pDecode_buf_next++ : 0;
- m_bit_count += 8;
- m_bit_buf |= (c << (32 - m_bit_count));
- }
- }
-
- uint32 k = (m_bit_buf >> 16) + 1;
- uint32 sym, len;
-
- if (k <= pTables->m_table_max_code)
- {
- uint32 t = pTables->m_lookup[m_bit_buf >> (32 - pTables->m_table_bits)];
-
- CRND_ASSERT(t != cUINT32_MAX);
- sym = t & cUINT16_MAX;
- len = t >> 16;
-
- CRND_ASSERT(model.m_code_sizes[sym] == len);
- }
- else
- {
- len = pTables->m_decode_start_code_size;
-
- for ( ; ; )
- {
- if (k <= pTables->m_max_codes[len - 1])
- break;
- len++;
- }
-
- int val_ptr = pTables->m_val_ptrs[len - 1] + (m_bit_buf >> (32 - len));
-
- if (((uint32)val_ptr >= model.m_total_syms))
- {
- // corrupted stream, or a bug
- CRND_ASSERT(0);
- return 0;
- }
-
- sym = pTables->m_sorted_symbol_order[val_ptr];
- }
-
- m_bit_buf <<= len;
- m_bit_count -= len;
-
- return sym;
-}
-
- uint64 symbol_codec::stop_decoding()
- {
-#if 0
- uint32 i = get_bits(4);
- uint32 k = get_bits(3);
- i, k;
- CRND_ASSERT((i == 15) && (k == 3));
-#endif
-
- uint64 n = static_cast<uint64>(m_pDecode_buf_next - m_pDecode_buf);
-
- return n;
- }
-
-} // namespace crnd
-
-// File: crnd_dxt_hc_common.cpp
-namespace crnd
-{
- chunk_encoding_desc g_chunk_encodings[cNumChunkEncodings] =
- {
- { 1, { { 0, 0, 8, 8, 0 } } },
-
- { 2, { { 0, 0, 8, 4, 1 }, { 0, 4, 8, 4, 2 } } },
- { 2, { { 0, 0, 4, 8, 3 }, { 4, 0, 4, 8, 4 } } },
-
- { 3, { { 0, 0, 8, 4, 1 }, { 0, 4, 4, 4, 7 }, { 4, 4, 4, 4, 8 } } },
- { 3, { { 0, 4, 8, 4, 2 }, { 0, 0, 4, 4, 5 }, { 4, 0, 4, 4, 6 } } },
-
- { 3, { { 0, 0, 4, 8, 3 }, { 4, 0, 4, 4, 6 }, { 4, 4, 4, 4, 8 } } },
- { 3, { { 4, 0, 4, 8, 4 }, { 0, 0, 4, 4, 5 }, { 0, 4, 4, 4, 7 } } },
-
- { 4, { { 0, 0, 4, 4, 5 }, { 4, 0, 4, 4, 6 }, { 0, 4, 4, 4, 7 }, { 4, 4, 4, 4, 8 } } }
- };
-
- chunk_tile_desc g_chunk_tile_layouts[cNumChunkTileLayouts] =
- {
- // 2x2
- { 0, 0, 8, 8, 0 },
-
- // 2x1
- { 0, 0, 8, 4, 1 },
- { 0, 4, 8, 4, 2 },
-
- // 1x2
- { 0, 0, 4, 8, 3 },
- { 4, 0, 4, 8, 4 },
-
- // 1x1
- { 0, 0, 4, 4, 5 },
- { 4, 0, 4, 4, 6 },
- { 0, 4, 4, 4, 7 },
- { 4, 4, 4, 4, 8 }
- };
-
-} // namespace crnd
-
-// File: crnd_dxt.cpp
-namespace crnd
-{
- const uint8 g_dxt1_to_linear[cDXT1SelectorValues] = { 0U, 3U, 1U, 2U };
- const uint8 g_dxt1_from_linear[cDXT1SelectorValues] = { 0U, 2U, 3U, 1U };
-
- const uint8 g_dxt5_to_linear[cDXT5SelectorValues] = { 0U, 7U, 1U, 2U, 3U, 4U, 5U, 6U };
- const uint8 g_dxt5_from_linear[cDXT5SelectorValues] = { 0U, 2U, 3U, 4U, 5U, 6U, 7U, 1U };
-
- const uint8 g_six_alpha_invert_table[cDXT5SelectorValues] = { 1, 0, 5, 4, 3, 2, 6, 7 };
- const uint8 g_eight_alpha_invert_table[cDXT5SelectorValues] = { 1, 0, 7, 6, 5, 4, 3, 2 };
-
- uint16 dxt1_block::pack_color(const color_quad_u8& color, bool scaled, uint32 bias)
- {
- uint32 r = color.r;
- uint32 g = color.g;
- uint32 b = color.b;
-
- if (scaled)
- {
- r = (r * 31U + bias) / 255U;
- g = (g * 63U + bias) / 255U;
- b = (b * 31U + bias) / 255U;
- }
-
- r = math::minimum(r, 31U);
- g = math::minimum(g, 63U);
- b = math::minimum(b, 31U);
-
- return static_cast<uint16>(b | (g << 5U) | (r << 11U));
- }
-
- uint16 dxt1_block::pack_color(uint32 r, uint32 g, uint32 b, bool scaled, uint32 bias)
- {
- return pack_color(color_quad_u8(r, g, b, 0), scaled, bias);
- }
-
- color_quad_u8 dxt1_block::unpack_color(uint16 packed_color, bool scaled, uint32 alpha)
- {
- uint32 b = packed_color & 31U;
- uint32 g = (packed_color >> 5U) & 63U;
- uint32 r = (packed_color >> 11U) & 31U;
-
- if (scaled)
- {
- b = (b << 3U) | (b >> 2U);
- g = (g << 2U) | (g >> 4U);
- r = (r << 3U) | (r >> 2U);
- }
-
- return color_quad_u8(r, g, b, alpha);
- }
-
- void dxt1_block::unpack_color(uint32& r, uint32& g, uint32& b, uint16 packed_color, bool scaled)
- {
- color_quad_u8 c(unpack_color(packed_color, scaled, 0));
- r = c.r;
- g = c.g;
- b = c.b;
- }
-
- uint32 dxt1_block::get_block_colors3(color_quad_u8* pDst, uint16 color0, uint16 color1)
- {
- color_quad_u8 c0(unpack_color(color0, true));
- color_quad_u8 c1(unpack_color(color1, true));
-
- pDst[0] = c0;
- pDst[1] = c1;
- pDst[2].set( (c0.r + c1.r) >> 1U, (c0.g + c1.g) >> 1U, (c0.b + c1.b) >> 1U, 255U);
- pDst[3].set(0, 0, 0, 0);
-
- return 3;
- }
-
- uint32 dxt1_block::get_block_colors4(color_quad_u8* pDst, uint16 color0, uint16 color1)
- {
- color_quad_u8 c0(unpack_color(color0, true));
- color_quad_u8 c1(unpack_color(color1, true));
-
- pDst[0] = c0;
- pDst[1] = c1;
-
- // 12/14/09 - Supposed to round according to DX docs, but this conflicts with the OpenGL S3TC spec. ?
- // Turns out some GPU's round and some don't. Great.
- //pDst[2].set( (c0.r * 2 + c1.r + 1) / 3, (c0.g * 2 + c1.g + 1) / 3, (c0.b * 2 + c1.b + 1) / 3, 255U);
- //pDst[3].set( (c1.r * 2 + c0.r + 1) / 3, (c1.g * 2 + c0.g + 1) / 3, (c1.b * 2 + c0.b + 1) / 3, 255U);
-
- pDst[2].set( (c0.r * 2 + c1.r) / 3, (c0.g * 2 + c1.g) / 3, (c0.b * 2 + c1.b) / 3, 255U);
- pDst[3].set( (c1.r * 2 + c0.r) / 3, (c1.g * 2 + c0.g) / 3, (c1.b * 2 + c0.b) / 3, 255U);
-
- return 4;
- }
-
- uint32 dxt1_block::get_block_colors(color_quad_u8* pDst, uint16 color0, uint16 color1)
- {
- if (color0 > color1)
- return get_block_colors4(pDst, color0, color1);
- else
- return get_block_colors3(pDst, color0, color1);
- }
-
- color_quad_u8 dxt1_block::unpack_endpoint(uint32 endpoints, uint32 index, bool scaled, uint32 alpha)
- {
- CRND_ASSERT(index < 2);
- return unpack_color( static_cast<uint16>((endpoints >> (index * 16U)) & 0xFFFFU), scaled, alpha );
- }
-
- uint32 dxt1_block::pack_endpoints(uint32 lo, uint32 hi)
- {
- CRND_ASSERT((lo <= 0xFFFFU) && (hi <= 0xFFFFU));
- return lo | (hi << 16U);
- }
-
- void dxt3_block::set_alpha(uint32 x, uint32 y, uint32 value, bool scaled)
- {
- CRND_ASSERT((x < cDXTBlockSize) && (y < cDXTBlockSize));
-
- if (scaled)
- {
- CRND_ASSERT(value <= 0xFF);
- value = (value * 15U + 128U) / 255U;
- }
- else
- {
- CRND_ASSERT(value <= 0xF);
- }
-
- uint32 ofs = (y << 1U) + (x >> 1U);
- uint32 c = m_alpha[ofs];
-
- c &= ~(0xF << ((x & 1U) << 2U));
- c |= (value << ((x & 1U) << 2U));
-
- m_alpha[ofs] = static_cast<uint8>(c);
- }
-
- uint32 dxt3_block::get_alpha(uint32 x, uint32 y, bool scaled) const
- {
- CRND_ASSERT((x < cDXTBlockSize) && (y < cDXTBlockSize));
-
- uint32 value = m_alpha[(y << 1U) + (x >> 1U)];
- if (x & 1)
- value >>= 4;
- value &= 0xF;
-
- if (scaled)
- value = (value << 4U) | value;
-
- return value;
- }
-
- uint32 dxt5_block::get_block_values6(color_quad_u8* pDst, uint32 l, uint32 h)
- {
- pDst[0].a = static_cast<uint8>(l);
- pDst[1].a = static_cast<uint8>(h);
- pDst[2].a = static_cast<uint8>((l * 4 + h ) / 5);
- pDst[3].a = static_cast<uint8>((l * 3 + h * 2) / 5);
- pDst[4].a = static_cast<uint8>((l * 2 + h * 3) / 5);
- pDst[5].a = static_cast<uint8>((l + h * 4) / 5);
- pDst[6].a = 0;
- pDst[7].a = 255;
- return 6;
- }
-
- uint32 dxt5_block::get_block_values8(color_quad_u8* pDst, uint32 l, uint32 h)
- {
- pDst[0].a = static_cast<uint8>(l);
- pDst[1].a = static_cast<uint8>(h);
- pDst[2].a = static_cast<uint8>((l * 6 + h ) / 7);
- pDst[3].a = static_cast<uint8>((l * 5 + h * 2) / 7);
- pDst[4].a = static_cast<uint8>((l * 4 + h * 3) / 7);
- pDst[5].a = static_cast<uint8>((l * 3 + h * 4) / 7);
- pDst[6].a = static_cast<uint8>((l * 2 + h * 5) / 7);
- pDst[7].a = static_cast<uint8>((l + h * 6) / 7);
- return 8;
- }
-
- uint32 dxt5_block::get_block_values(color_quad_u8* pDst, uint32 l, uint32 h)
- {
- if (l > h)
- return get_block_values8(pDst, l, h);
- else
- return get_block_values6(pDst, l, h);
- }
-
- uint32 dxt5_block::get_block_values6(uint32* pDst, uint32 l, uint32 h)
- {
- pDst[0] = l;
- pDst[1] = h;
- pDst[2] = (l * 4 + h ) / 5;
- pDst[3] = (l * 3 + h * 2) / 5;
- pDst[4] = (l * 2 + h * 3) / 5;
- pDst[5] = (l + h * 4) / 5;
- pDst[6] = 0;
- pDst[7] = 255;
- return 6;
- }
-
- uint32 dxt5_block::get_block_values8(uint32* pDst, uint32 l, uint32 h)
- {
- pDst[0] = l;
- pDst[1] = h;
- pDst[2] = (l * 6 + h ) / 7;
- pDst[3] = (l * 5 + h * 2) / 7;
- pDst[4] = (l * 4 + h * 3) / 7;
- pDst[5] = (l * 3 + h * 4) / 7;
- pDst[6] = (l * 2 + h * 5) / 7;
- pDst[7] = (l + h * 6) / 7;
- return 8;
- }
-
- uint32 dxt5_block::unpack_endpoint(uint32 packed, uint32 index)
- {
- CRND_ASSERT(index < 2);
- return (packed >> (8 * index)) & 0xFF;
- }
-
- uint32 dxt5_block::pack_endpoints(uint32 lo, uint32 hi)
- {
- CRND_ASSERT((lo <= 0xFF) && (hi <= 0xFF));
- return lo | (hi << 8U);
- }
-
- uint32 dxt5_block::get_block_values(uint32* pDst, uint32 l, uint32 h)
- {
- if (l > h)
- return get_block_values8(pDst, l, h);
- else
- return get_block_values6(pDst, l, h);
- }
-
-} // namespace crnd
-
-// File: crnd_decode.cpp
-#define CRND_CREATE_BYTE_STREAMS 0
-
-namespace crnd
-{
-#if CRND_CREATE_BYTE_STREAMS
- static void write_array_to_file(const char* pFilename, const vector<uint8>& buf)
- {
- FILE* pFile = fopen(pFilename, "wb");
- fwrite(&buf[0], buf.size(), 1, pFile);
- fclose(pFile);
- }
-#endif
-
- struct crnd_chunk_tile_desc
- {
- // These values are in blocks
- uint8 m_x_ofs;
- uint8 m_y_ofs;
- uint8 m_width;
- uint8 m_height;
- };
-
- struct crnd_chunk_encoding_desc
- {
- uint32 m_num_tiles;
- chunk_tile_desc m_tiles[4];
- };
-
-#if 0
- static crnd_chunk_encoding_desc g_crnd_chunk_encodings[cNumChunkEncodings] =
- {
- { 1, { { 0, 0, 2, 2 } } },
-
- { 2, { { 0, 0, 2, 1 }, { 0, 1, 2, 1 } } },
- { 2, { { 0, 0, 1, 2 }, { 1, 0, 1, 2 } } },
-
- { 3, { { 0, 0, 2, 1 }, { 0, 1, 1, 1 }, { 1, 1, 1, 1 } } },
- { 3, { { 0, 1, 2, 1 }, { 0, 0, 1, 1 }, { 1, 0, 1, 1 } } },
-
- { 3, { { 0, 0, 1, 2 }, { 1, 0, 1, 1 }, { 1, 1, 1, 1 } } },
- { 3, { { 1, 0, 1, 2 }, { 0, 0, 1, 1 }, { 0, 1, 1, 1 } } },
-
- { 1, { { 0, 0, 1, 1 }, { 1, 0, 1, 1 }, { 0, 1, 1, 1 }, { 1, 1, 1, 1 } } }
- };
-#endif
-
- struct crnd_encoding_tile_indices
- {
- uint8 m_tiles[4];
- };
-
- static crnd_encoding_tile_indices g_crnd_chunk_encoding_tiles[cNumChunkEncodings] =
- {
- { { 0, 0, 0, 0 } },
-
- { { 0, 0, 1, 1 } },
- { { 0, 1, 0, 1 } },
-
- { { 0, 0, 1, 2 } },
- { { 1, 2, 0, 0 } },
-
- { { 0, 1, 0, 2 } },
- { { 1, 0, 2, 0 } },
-
- { { 0, 1, 2, 3 } }
- };
-
- static uint8 g_crnd_chunk_encoding_num_tiles[cNumChunkEncodings] = { 1, 2, 2, 3, 3, 3, 3, 4 };
-
- class crn_unpacker
- {
- public:
- inline crn_unpacker() :
- m_magic(cMagicValue),
- m_pData(NULL),
- m_data_size(0),
- m_pHeader(NULL)
- {
- }
-
- inline ~crn_unpacker()
- {
- m_magic = 0;
- }
-
- inline bool is_valid() const { return m_magic == cMagicValue; }
-
- bool init(const void* pData, uint32 data_size)
- {
- m_pHeader = crnd_get_header(m_tmp_header, pData, data_size);
- if (!m_pHeader)
- return false;
-
- m_pData = static_cast<const uint8*>(pData);
- m_data_size = data_size;
-
- if (!init_tables())
- return false;
-
- if (!decode_palettes())
- return false;
-
- return true;
- }
-
- bool unpack_level(
- void** pDst, uint32 dst_size_in_bytes, uint32 row_pitch_in_bytes,
- uint32 level_index)
- {
- uint32 cur_level_ofs = m_pHeader->m_level_ofs[level_index];
-
- uint32 next_level_ofs = m_data_size;
- if ((level_index + 1) < (m_pHeader->m_levels))
- next_level_ofs = m_pHeader->m_level_ofs[level_index + 1];
-
- CRND_ASSERT(next_level_ofs > cur_level_ofs);
-
- return unpack_level(m_pData + cur_level_ofs, next_level_ofs - cur_level_ofs, pDst, dst_size_in_bytes, row_pitch_in_bytes, level_index);
- }
-
- bool unpack_level(
- const void* pSrc, uint32 src_size_in_bytes,
- void** pDst, uint32 dst_size_in_bytes, uint32 row_pitch_in_bytes,
- uint32 level_index)
- {
- dst_size_in_bytes;
-
-#ifdef CRND_BUILD_DEBUG
- for (uint32 f = 0; f < m_pHeader->m_faces; f++)
- if (!pDst[f])
- return false;
-#endif
-
- const uint32 width = math::maximum(m_pHeader->m_width >> level_index, 1U);
- const uint32 height = math::maximum(m_pHeader->m_height >> level_index, 1U);
- const uint32 blocks_x = (width + 3U) >> 2U;
- const uint32 blocks_y = (height + 3U) >> 2U;
- const uint32 block_size = ((m_pHeader->m_format == cCRNFmtDXT1) || (m_pHeader->m_format == cCRNFmtDXT5A)) ? 8 : 16;
-
- uint32 minimal_row_pitch = block_size * blocks_x;
- if (!row_pitch_in_bytes)
- row_pitch_in_bytes = minimal_row_pitch;
- else if ((row_pitch_in_bytes < minimal_row_pitch) || (row_pitch_in_bytes & 3))
- return false;
- if (dst_size_in_bytes < row_pitch_in_bytes * blocks_y)
- return false;
-
- const uint32 chunks_x = (blocks_x + 1) >> 1;
- const uint32 chunks_y = (blocks_y + 1) >> 1;
-
-#if CRND_CREATE_BYTE_STREAMS
- crnd_trace("Index stream: %u bytes\n", src_size_in_bytes);
-#endif
-
- if (!m_codec.start_decoding(static_cast<const crnd::uint8*>(pSrc), src_size_in_bytes))
- return false;
-
- bool status = false;
- switch (m_pHeader->m_format)
- {
- case cCRNFmtDXT1:
- status = unpack_dxt1((uint8**)pDst, dst_size_in_bytes, row_pitch_in_bytes, blocks_x, blocks_y, chunks_x, chunks_y);
- break;
- case cCRNFmtDXT5:
- case cCRNFmtDXT5_CCxY:
- case cCRNFmtDXT5_xGBR:
- case cCRNFmtDXT5_AGBR:
- case cCRNFmtDXT5_xGxR:
- status = unpack_dxt5((uint8**)pDst, dst_size_in_bytes, row_pitch_in_bytes, blocks_x, blocks_y, chunks_x, chunks_y);
- break;
- case cCRNFmtDXT5A:
- status = unpack_dxt5a((uint8**)pDst, dst_size_in_bytes, row_pitch_in_bytes, blocks_x, blocks_y, chunks_x, chunks_y);
- break;
- case cCRNFmtDXN_XY:
- case cCRNFmtDXN_YX:
- status = unpack_dxn((uint8**)pDst, dst_size_in_bytes, row_pitch_in_bytes, blocks_x, blocks_y, chunks_x, chunks_y);
- break;
- default:
- return false;
- }
- if (!status)
- return false;
-
- m_codec.stop_decoding();
- return true;
- }
-
- inline const void* get_data() const { return m_pData; }
- inline uint32 get_data_size() const { return m_data_size; }
-
- private:
- enum { cMagicValue = 0x1EF9CABD };
- uint32 m_magic;
-
- const uint8* m_pData;
- uint32 m_data_size;
- crn_header m_tmp_header;
- const crn_header* m_pHeader;
-
- symbol_codec m_codec;
-
- static_huffman_data_model m_chunk_encoding_dm;
- static_huffman_data_model m_endpoint_delta_dm[2];
- static_huffman_data_model m_selector_delta_dm[2];
-
- crnd::vector<uint32> m_color_endpoints;
- crnd::vector<uint32> m_color_selectors;
-
- crnd::vector<uint16> m_alpha_endpoints;
- crnd::vector<uint16> m_alpha_selectors;
-
- bool init_tables()
- {
- if (!m_codec.start_decoding(m_pData + m_pHeader->m_tables_ofs, m_pHeader->m_tables_size))
- return false;
-
- if (!m_codec.decode_receive_static_data_model(m_chunk_encoding_dm))
- return false;
-
- if ((!m_pHeader->m_color_endpoints.m_num) && (!m_pHeader->m_alpha_endpoints.m_num))
- return false;
-
- if (m_pHeader->m_color_endpoints.m_num)
- {
- if (!m_codec.decode_receive_static_data_model(m_endpoint_delta_dm[0])) return false;
- if (!m_codec.decode_receive_static_data_model(m_selector_delta_dm[0])) return false;
- }
-
- if (m_pHeader->m_alpha_endpoints.m_num)
- {
- if (!m_codec.decode_receive_static_data_model(m_endpoint_delta_dm[1])) return false;
- if (!m_codec.decode_receive_static_data_model(m_selector_delta_dm[1])) return false;
- }
-
- m_codec.stop_decoding();
-
- return true;
- }
-
- bool decode_palettes()
- {
- if (m_pHeader->m_color_endpoints.m_num)
- {
- if (!decode_color_endpoints()) return false;
- if (!decode_color_selectors()) return false;
- }
-
- if (m_pHeader->m_alpha_endpoints.m_num)
- {
- if (!decode_alpha_endpoints()) return false;
- if (!decode_alpha_selectors()) return false;
- }
-
- return true;
- }
-
- bool decode_color_endpoints()
- {
- const uint32 num_color_endpoints = m_pHeader->m_color_endpoints.m_num;
-
- if (!m_color_endpoints.resize(num_color_endpoints))
- return false;
-
- if (!m_codec.start_decoding(m_pData + m_pHeader->m_color_endpoints.m_ofs, m_pHeader->m_color_endpoints.m_size))
- return false;
-
- static_huffman_data_model dm[2];
- for (uint32 i = 0; i < 2; i++)
- if (!m_codec.decode_receive_static_data_model(dm[i]))
- return false;
-
- uint32 a = 0, b = 0, c = 0;
- uint32 d = 0, e = 0, f = 0;
-
- uint32* CRND_RESTRICT pDst = &m_color_endpoints[0];
-
- CRND_HUFF_DECODE_BEGIN(m_codec);
-
-#if CRND_CREATE_BYTE_STREAMS
- vector<uint8> byte_stream;
-#endif
-
- for (uint32 i = 0; i < num_color_endpoints; i++)
- {
- uint32 da, db, dc, dd, de, df;
- CRND_HUFF_DECODE(m_codec, dm[0], da); a = (a + da) & 31;
- CRND_HUFF_DECODE(m_codec, dm[1], db); b = (b + db) & 63;
- CRND_HUFF_DECODE(m_codec, dm[0], dc); c = (c + dc) & 31;
-
- CRND_HUFF_DECODE(m_codec, dm[0], dd); d = (d + dd) & 31;
- CRND_HUFF_DECODE(m_codec, dm[1], de); e = (e + de) & 63;
- CRND_HUFF_DECODE(m_codec, dm[0], df); f = (f + df) & 31;
-
-#if CRND_CREATE_BYTE_STREAMS
- byte_stream.push_back(da);
- byte_stream.push_back(db);
- byte_stream.push_back(dc);
- byte_stream.push_back(dd);
- byte_stream.push_back(de);
- byte_stream.push_back(df);
-#endif
-
- if (c_crnd_little_endian_platform)
- *pDst++ = c | (b << 5U) | (a << 11U) | (f << 16U) | (e << 21U) | (d << 27U);
- else
- *pDst++ = f | (e << 5U) | (d << 11U) | (c << 16U) | (b << 21U) | (a << 27U);
- }
-
- CRND_HUFF_DECODE_END(m_codec);
-
- m_codec.stop_decoding();
-
-#if CRND_CREATE_BYTE_STREAMS
- write_array_to_file(L"colorendpoints.bin", byte_stream);
- crnd_trace("color endpoints: %u\n", (uint)m_pHeader->m_color_endpoints.m_size);
-#endif
-
- return true;
- }
-
- bool decode_color_selectors()
- {
- const uint32 cMaxSelectorValue = 3U;
- const uint32 cMaxUniqueSelectorDeltas = cMaxSelectorValue * 2U + 1U;
-
- const uint32 num_color_selectors = m_pHeader->m_color_selectors.m_num;
-
- if (!m_codec.start_decoding(m_pData + m_pHeader->m_color_selectors.m_ofs, m_pHeader->m_color_selectors.m_size))
- return false;
-
- static_huffman_data_model dm;
- if (!m_codec.decode_receive_static_data_model(dm))
- return false;
-
- int32 delta0[cMaxUniqueSelectorDeltas * cMaxUniqueSelectorDeltas];
- int32 delta1[cMaxUniqueSelectorDeltas * cMaxUniqueSelectorDeltas];
- int32 l = -(int32)cMaxSelectorValue, m = -(int32)cMaxSelectorValue;
- for (uint32 i = 0; i < (cMaxUniqueSelectorDeltas * cMaxUniqueSelectorDeltas); i++)
- {
- delta0[i] = l;
- delta1[i] = m;
-
- if (++l > (int32)cMaxSelectorValue)
- {
- l = -(int32)cMaxSelectorValue;
- m++;
- }
- }
-
- uint32 cur[16];
- utils::zero_object(cur);
-
- if (!m_color_selectors.resize(num_color_selectors))
- return false;
-
- uint32* CRND_RESTRICT pDst = &m_color_selectors[0];
-
- const uint8* pFrom_linear = g_dxt1_from_linear;
-
- CRND_HUFF_DECODE_BEGIN(m_codec);
-
-#if CRND_CREATE_BYTE_STREAMS
- vector<uint8> byte_stream;
-#endif
-
- for (uint32 i = 0; i < num_color_selectors; i++)
- {
- for (uint32 j = 0; j < 8; j++)
- {
- int32 sym;
- CRND_HUFF_DECODE(m_codec, dm, sym);
-
-#if CRND_CREATE_BYTE_STREAMS
- byte_stream.push_back(sym);
-#endif
-
- cur[j*2+0] = (delta0[sym] + cur[j*2+0]) & 3;
- cur[j*2+1] = (delta1[sym] + cur[j*2+1]) & 3;
- }
-
- if (c_crnd_little_endian_platform)
- {
- *pDst++ =
- (pFrom_linear[cur[0 ]] ) | (pFrom_linear[cur[1 ]] << 2) | (pFrom_linear[cur[2 ]] << 4) | (pFrom_linear[cur[3 ]] << 6) |
- (pFrom_linear[cur[4 ]] << 8) | (pFrom_linear[cur[5 ]] << 10) | (pFrom_linear[cur[6 ]] << 12) | (pFrom_linear[cur[7 ]] << 14) |
- (pFrom_linear[cur[8 ]] << 16) | (pFrom_linear[cur[9 ]] << 18) | (pFrom_linear[cur[10]] << 20) | (pFrom_linear[cur[11]] << 22) |
- (pFrom_linear[cur[12]] << 24) | (pFrom_linear[cur[13]] << 26) | (pFrom_linear[cur[14]] << 28) | (pFrom_linear[cur[15]] << 30);
- }
- else
- {
- *pDst++ =
- (pFrom_linear[cur[8 ]] ) | (pFrom_linear[cur[9 ]] << 2) | (pFrom_linear[cur[10]] << 4) | (pFrom_linear[cur[11]] << 6) |
- (pFrom_linear[cur[12]] << 8) | (pFrom_linear[cur[13]] << 10) | (pFrom_linear[cur[14]] << 12) | (pFrom_linear[cur[15]] << 14) |
- (pFrom_linear[cur[0 ]] << 16) | (pFrom_linear[cur[1 ]] << 18) | (pFrom_linear[cur[2 ]] << 20) | (pFrom_linear[cur[3 ]] << 22) |
- (pFrom_linear[cur[4 ]] << 24) | (pFrom_linear[cur[5 ]] << 26) | (pFrom_linear[cur[6 ]] << 28) | (pFrom_linear[cur[7 ]] << 30);
- }
- }
-
- CRND_HUFF_DECODE_END(m_codec);
-
- m_codec.stop_decoding();
-
-#if CRND_CREATE_BYTE_STREAMS
- write_array_to_file(L"colorselectors.bin", byte_stream);
- crnd_trace("color selectors: %u\n", (uint)m_pHeader->m_color_selectors.m_size);
-#endif
-
- return true;
- }
-
- bool decode_alpha_endpoints()
- {
- const uint32 num_alpha_endpoints = m_pHeader->m_alpha_endpoints.m_num;
-
- if (!m_codec.start_decoding(m_pData + m_pHeader->m_alpha_endpoints.m_ofs, m_pHeader->m_alpha_endpoints.m_size))
- return false;
-
- static_huffman_data_model dm;
- if (!m_codec.decode_receive_static_data_model(dm))
- return false;
-
- if (!m_alpha_endpoints.resize(num_alpha_endpoints))
- return false;
-
- uint16* CRND_RESTRICT pDst = &m_alpha_endpoints[0];
- uint32 a = 0, b = 0;
-
- CRND_HUFF_DECODE_BEGIN(m_codec);
-
- for (uint32 i = 0; i < num_alpha_endpoints; i++)
- {
- uint sa; CRND_HUFF_DECODE(m_codec, dm, sa);
- uint sb; CRND_HUFF_DECODE(m_codec, dm, sb);
-
- a = (sa + a) & 255;
- b = (sb + b) & 255;
-
- *pDst++ = (uint16)(a | (b << 8));
- }
-
- CRND_HUFF_DECODE_END(m_codec);
-
- m_codec.stop_decoding();
-
- return true;
- }
-
- bool decode_alpha_selectors()
- {
- const uint32 cMaxSelectorValue = 7U;
- const uint32 cMaxUniqueSelectorDeltas = cMaxSelectorValue * 2U + 1U;
-
- const uint32 num_alpha_selectors = m_pHeader->m_alpha_selectors.m_num;
-
- if (!m_codec.start_decoding(m_pData + m_pHeader->m_alpha_selectors.m_ofs, m_pHeader->m_alpha_selectors.m_size))
- return false;
-
- static_huffman_data_model dm;
- if (!m_codec.decode_receive_static_data_model(dm))
- return false;
-
- int32 delta0[cMaxUniqueSelectorDeltas * cMaxUniqueSelectorDeltas];
- int32 delta1[cMaxUniqueSelectorDeltas * cMaxUniqueSelectorDeltas];
- int32 l = -(int32)cMaxSelectorValue, m = -(int32)cMaxSelectorValue;
- for (uint32 i = 0; i < (cMaxUniqueSelectorDeltas * cMaxUniqueSelectorDeltas); i++)
- {
- delta0[i] = l;
- delta1[i] = m;
-
- if (++l > (int32)cMaxSelectorValue)
- {
- l = -(int32)cMaxSelectorValue;
- m++;
- }
- }
-
- uint32 cur[16];
- utils::zero_object(cur);
-
- if (!m_alpha_selectors.resize(num_alpha_selectors * 3))
- return false;
-
- uint16* CRND_RESTRICT pDst = &m_alpha_selectors[0];
-
- const uint8* pFrom_linear = g_dxt5_from_linear;
-
- CRND_HUFF_DECODE_BEGIN(m_codec);
-
- for (uint32 i = 0; i < num_alpha_selectors; i++)
- {
- for (uint32 j = 0; j < 8; j++)
- {
- int32 sym;
- CRND_HUFF_DECODE(m_codec, dm, sym);
-
- cur[j*2+0] = (delta0[sym] + cur[j*2+0]) & 7;
- cur[j*2+1] = (delta1[sym] + cur[j*2+1]) & 7;
- //cur[j*2+0] = ((sym%15)-7 + cur[j*2+0]) & 7;
- //cur[j*2+1] = ((sym/15)-7 + cur[j*2+1]) & 7;
- }
-
-#if 0
- dxt5_block blk;
- for (uint32 y = 0; y < 4; y++)
- for (uint32 x = 0; x < 4; x++)
- blk.set_selector(x, y, pFrom_linear[cur[x+y*4]]);
-
- *pDst++ = blk.get_selectors_as_word(0);
- *pDst++ = blk.get_selectors_as_word(1);
- *pDst++ = blk.get_selectors_as_word(2);
-#else
- *pDst++ = (uint16)((pFrom_linear[cur[0 ]] ) | (pFrom_linear[cur[1 ]] << 3) | (pFrom_linear[cur[2 ]] << 6) | (pFrom_linear[cur[3 ]] << 9) |
- (pFrom_linear[cur[4 ]] << 12) | (pFrom_linear[cur[5 ]] << 15));
-
- *pDst++ = (uint16)((pFrom_linear[cur[5 ]] >> 1) | (pFrom_linear[cur[6 ]] << 2) | (pFrom_linear[cur[7 ]] << 5) |
- (pFrom_linear[cur[8 ]] << 8) | (pFrom_linear[cur[9 ]] << 11) | (pFrom_linear[cur[10]] << 14));
-
- *pDst++ = (uint16)((pFrom_linear[cur[10]] >> 2) | (pFrom_linear[cur[11]] << 1) | (pFrom_linear[cur[12]] << 4) |
- (pFrom_linear[cur[13]] << 7) | (pFrom_linear[cur[14]] << 10) | (pFrom_linear[cur[15]] << 13));
-#endif
- }
-
- CRND_HUFF_DECODE_END(m_codec);
-
- m_codec.stop_decoding();
-
- return true;
- }
-
- static inline uint32 tiled_offset_2d_outer(uint32 y, uint32 AlignedWidth, uint32 LogBpp)
- {
- uint32 Macro = ((y >> 5) * (AlignedWidth >> 5)) << (LogBpp + 7);
- uint32 Micro = ((y & 6) << 2) << LogBpp;
-
- return Macro +
- ((Micro & ~15) << 1) +
- (Micro & 15) +
- ((y & 8) << (3 + LogBpp)) + ((y & 1) << 4);
- }
-
- static inline uint32 tiled_offset_2d_inner(uint32 x, uint32 y, uint32 LogBpp, uint32 BaseOffset)
- {
- uint32 Macro = (x >> 5) << (LogBpp + 7);
- uint32 Micro = (x & 7) << LogBpp;
- uint32 Offset = BaseOffset + Macro + ((Micro & ~15) << 1) + (Micro & 15);
-
- return ((Offset & ~511) << 3) + ((Offset & 448) << 2) + (Offset & 63) +
- ((y & 16) << 7) +
- (((((y & 8) >> 2) + (x >> 3)) & 3) << 6);
- }
-
- static inline void limit(uint& x, uint n)
- {
- int v = x - n;
- int msk = (v >> 31);
- x = (x & msk) | (v & ~msk);
- }
-
- bool unpack_dxt1(uint8** pDst, uint32 dst_size_in_bytes, uint32 row_pitch_in_bytes, uint32 blocks_x, uint32 blocks_y, uint32 chunks_x, uint32 chunks_y)
- {
- dst_size_in_bytes;
-
- uint32 chunk_encoding_bits = 1;
-
- const uint32 num_color_endpoints = m_color_endpoints.size();
- const uint32 num_color_selectors = m_color_selectors.size();
-
- uint32 prev_color_endpoint_index = 0;
- uint32 prev_color_selector_index = 0;
-
- const uint32 num_faces = m_pHeader->m_faces;
-
- const uint32 row_pitch_in_dwords = row_pitch_in_bytes >> 2U;
-
- const int32 cBytesPerBlock = 8;
-
- CRND_HUFF_DECODE_BEGIN(m_codec);
-
-#if CRND_CREATE_BYTE_STREAMS
- vector<uint8> tile_encoding_stream;
- vector<uint8> endpoint_indices_stream;
- vector<uint8> selector_indices_stream;
-#endif
-
- for (uint32 f = 0; f < num_faces; f++)
- {
- uint8* CRND_RESTRICT pRow = pDst[f];
-
- for (uint32 y = 0; y < chunks_y; y++)
- {
- int32 start_x = 0;
- int32 end_x = chunks_x;
- int32 dir_x = 1;
- int32 block_delta = cBytesPerBlock*2;
- uint8* CRND_RESTRICT pBlock = pRow;
-
- if (y & 1)
- {
- start_x = chunks_x - 1;
- end_x = -1;
- dir_x = -1;
- block_delta = -cBytesPerBlock*2;
- pBlock += (chunks_x - 1) * cBytesPerBlock * 2;
- }
-
- const bool skip_bottom_row = (y == (chunks_y - 1)) && (blocks_y & 1);
-
- for (int32 x = start_x; x != end_x; x += dir_x)
- {
- uint32 color_endpoints[4];
-
- if (chunk_encoding_bits == 1)
- {
- CRND_HUFF_DECODE(m_codec, m_chunk_encoding_dm, chunk_encoding_bits);
-#if CRND_CREATE_BYTE_STREAMS
- tile_encoding_stream.push_back(chunk_encoding_bits & 7);
- tile_encoding_stream.push_back((chunk_encoding_bits >> 3) & 7);
- tile_encoding_stream.push_back((chunk_encoding_bits >> 6) & 7);
-#endif
- chunk_encoding_bits |= 512;
- }
-
- const uint32 chunk_encoding_index = chunk_encoding_bits & 7;
- chunk_encoding_bits >>= 3;
-
- const uint32 num_tiles = g_crnd_chunk_encoding_num_tiles[chunk_encoding_index];
-
- for (uint32 i = 0; i < num_tiles; i++)
- {
- uint32 delta;
- CRND_HUFF_DECODE(m_codec, m_endpoint_delta_dm[0], delta);
-#if CRND_CREATE_BYTE_STREAMS
- endpoint_indices_stream.push_back(delta);
-#endif
- prev_color_endpoint_index += delta;
- limit(prev_color_endpoint_index, num_color_endpoints);
- color_endpoints[i] = m_color_endpoints[prev_color_endpoint_index];
- }
-
- const uint8* pTile_indices = g_crnd_chunk_encoding_tiles[chunk_encoding_index].m_tiles;
-
- const bool skip_right_col = (blocks_x & 1) && (x == ((int32)chunks_x - 1));
-
- uint32* CRND_RESTRICT pD = (uint32*)pBlock;
-
- if ((!skip_bottom_row) && (!skip_right_col))
- {
- //CRND_ASSERT( ((uint8*)&pD[4 + row_pitch_in_dwords] - pDst) <= dst_size_in_bytes );
-
- pD[0] = color_endpoints[pTile_indices[0]];
- CRND_WRITE_BARRIER
- uint32 delta0;
- CRND_HUFF_DECODE(m_codec, m_selector_delta_dm[0], delta0);
-#if CRND_CREATE_BYTE_STREAMS
- selector_indices_stream.push_back(delta0);
-#endif
- prev_color_selector_index += delta0;
- limit(prev_color_selector_index, num_color_selectors);
- pD[1] = m_color_selectors[prev_color_selector_index];
- CRND_WRITE_BARRIER
-
- pD[2] = color_endpoints[pTile_indices[1]];
- CRND_WRITE_BARRIER
- uint32 delta1;
- CRND_HUFF_DECODE(m_codec, m_selector_delta_dm[0], delta1);
-#if CRND_CREATE_BYTE_STREAMS
- selector_indices_stream.push_back(delta1);
-#endif
- prev_color_selector_index += delta1;
- limit(prev_color_selector_index, num_color_selectors);
- pD[3] = m_color_selectors[prev_color_selector_index];
- CRND_WRITE_BARRIER
-
- pD[0 + row_pitch_in_dwords] = color_endpoints[pTile_indices[2]];
- CRND_WRITE_BARRIER
- uint32 delta2;
- CRND_HUFF_DECODE(m_codec, m_selector_delta_dm[0], delta2);
-#if CRND_CREATE_BYTE_STREAMS
- selector_indices_stream.push_back(delta2);
-#endif
- prev_color_selector_index += delta2;
- limit(prev_color_selector_index, num_color_selectors);
- pD[1 + row_pitch_in_dwords] = m_color_selectors[prev_color_selector_index];
- CRND_WRITE_BARRIER
-
- pD[2 + row_pitch_in_dwords] = color_endpoints[pTile_indices[3]];
- CRND_WRITE_BARRIER
- uint32 delta3;
- CRND_HUFF_DECODE(m_codec, m_selector_delta_dm[0], delta3);
-#if CRND_CREATE_BYTE_STREAMS
- selector_indices_stream.push_back(delta3);
-#endif
- prev_color_selector_index += delta3;
- limit(prev_color_selector_index, num_color_selectors);
- pD[3 + row_pitch_in_dwords] = m_color_selectors[prev_color_selector_index];
- CRND_WRITE_BARRIER
- }
- else
- {
- for (uint32 by = 0; by < 2; by++)
- {
- pD = (uint32*)((uint8*)pBlock + row_pitch_in_bytes * by);
- for (uint32 bx = 0; bx < 2; bx++, pD += 2)
- {
- uint32 delta;
- CRND_HUFF_DECODE(m_codec, m_selector_delta_dm[0], delta);
-#if CRND_CREATE_BYTE_STREAMS
- selector_indices_stream.push_back(delta);
-#endif
- prev_color_selector_index += delta;
- limit(prev_color_selector_index, num_color_selectors);
-
- if (!((bx && skip_right_col) || (by && skip_bottom_row)))
- {
- pD[0] = color_endpoints[pTile_indices[bx + by * 2]];
- CRND_WRITE_BARRIER
- pD[1] = m_color_selectors[prev_color_selector_index];
- CRND_WRITE_BARRIER
- }
- }
- }
- }
-
- pBlock += block_delta;
-
- } // x
-
- pRow += row_pitch_in_bytes * 2;
-
- } // y
-
- } // f
-
- CRND_HUFF_DECODE_END(m_codec);
-
-#if CRND_CREATE_BYTE_STREAMS
- write_array_to_file(L"tile_encodings.bin", tile_encoding_stream);
- write_array_to_file(L"endpoint_indices.bin", endpoint_indices_stream);
- write_array_to_file(L"selector_indices.bin", selector_indices_stream);
-#endif
-
- return true;
- }
-
- bool unpack_dxt5(uint8** pDst, uint32 dst_size_in_bytes, uint32 row_pitch_in_bytes, uint32 blocks_x, uint32 blocks_y, uint32 chunks_x, uint32 chunks_y)
- {
- dst_size_in_bytes;
-
- uint32 chunk_encoding_bits = 1;
-
- const uint32 num_color_endpoints = m_color_endpoints.size();
- const uint32 num_color_selectors = m_color_selectors.size();
- const uint32 num_alpha_endpoints = m_alpha_endpoints.size();
- const uint32 num_alpha_selectors = m_pHeader->m_alpha_selectors.m_num;
-
- uint32 prev_color_endpoint_index = 0;
- uint32 prev_color_selector_index = 0;
- uint32 prev_alpha_endpoint_index = 0;
- uint32 prev_alpha_selector_index = 0;
-
- const uint32 num_faces = m_pHeader->m_faces;
-
- //const uint32 row_pitch_in_dwords = row_pitch_in_bytes >> 2U;
-
- const int32 cBytesPerBlock = 16;
-
- CRND_HUFF_DECODE_BEGIN(m_codec);
-
- for (uint32 f = 0; f < num_faces; f++)
- {
- uint8* CRND_RESTRICT pRow = pDst[f];
-
- for (uint32 y = 0; y < chunks_y; y++)
- {
- int32 start_x = 0;
- int32 end_x = chunks_x;
- int32 dir_x = 1;
- int32 block_delta = cBytesPerBlock*2;
- uint8* CRND_RESTRICT pBlock = pRow;
-
- if (y & 1)
- {
- start_x = chunks_x - 1;
- end_x = -1;
- dir_x = -1;
- block_delta = -cBytesPerBlock*2;
- pBlock += (chunks_x - 1) * cBytesPerBlock * 2;
- }
-
- const bool skip_bottom_row = (y == (chunks_y - 1)) && (blocks_y & 1);
-
- for (int32 x = start_x; x != end_x; x += dir_x)
- {
- uint32 color_endpoints[4];
- uint32 alpha_endpoints[4];
-
- if (chunk_encoding_bits == 1)
- {
- CRND_HUFF_DECODE(m_codec, m_chunk_encoding_dm, chunk_encoding_bits);
- chunk_encoding_bits |= 512;
- }
-
- const uint32 chunk_encoding_index = chunk_encoding_bits & 7;
- chunk_encoding_bits >>= 3;
-
- const uint32 num_tiles = g_crnd_chunk_encoding_num_tiles[chunk_encoding_index];
-
- const uint8* pTile_indices = g_crnd_chunk_encoding_tiles[chunk_encoding_index].m_tiles;
-
- const bool skip_right_col = (blocks_x & 1) && (x == ((int32)chunks_x - 1));
-
- uint32* CRND_RESTRICT pD = (uint32*)pBlock;
-
- for (uint32 i = 0; i < num_tiles; i++)
- {
- uint32 delta; CRND_HUFF_DECODE(m_codec, m_endpoint_delta_dm[1], delta);
- prev_alpha_endpoint_index += delta;
- limit(prev_alpha_endpoint_index, num_alpha_endpoints);
- alpha_endpoints[i] = m_alpha_endpoints[prev_alpha_endpoint_index];
- }
-
- for (uint32 i = 0; i < num_tiles; i++)
- {
- uint32 delta; CRND_HUFF_DECODE(m_codec, m_endpoint_delta_dm[0], delta);
- prev_color_endpoint_index += delta;
- limit(prev_color_endpoint_index, num_color_endpoints);
- color_endpoints[i] = m_color_endpoints[prev_color_endpoint_index];
- }
-
- pD = (uint32*)pBlock;
- for (uint32 by = 0; by < 2; by++)
- {
- for (uint32 bx = 0; bx < 2; bx++, pD += 4)
- {
- uint32 delta0; CRND_HUFF_DECODE(m_codec, m_selector_delta_dm[1], delta0);
- prev_alpha_selector_index += delta0;
- limit(prev_alpha_selector_index, num_alpha_selectors);
-
- uint32 delta1; CRND_HUFF_DECODE(m_codec, m_selector_delta_dm[0], delta1);
- prev_color_selector_index += delta1;
- limit(prev_color_selector_index, num_color_selectors);
-
- if (!((bx && skip_right_col) || (by && skip_bottom_row)))
- {
- const uint32 tile_index = pTile_indices[bx + by * 2];
- const uint16* pAlpha_selectors = &m_alpha_selectors[prev_alpha_selector_index * 3];
-
-#ifdef CRND_BIG_ENDIAN_PLATFORM
- pD[0] = (alpha_endpoints[tile_index] << 16) | pAlpha_selectors[0];
- CRND_WRITE_BARRIER
- pD[1] = (pAlpha_selectors[1] << 16) | pAlpha_selectors[2];
- CRND_WRITE_BARRIER
- pD[2] = color_endpoints[tile_index];
- CRND_WRITE_BARRIER
- pD[3] = m_color_selectors[prev_color_selector_index];
- CRND_WRITE_BARRIER
-#else
- pD[0] = alpha_endpoints[tile_index] | (pAlpha_selectors[0] << 16);
- CRND_WRITE_BARRIER
- pD[1] = pAlpha_selectors[1] | (pAlpha_selectors[2] << 16);
- CRND_WRITE_BARRIER
- pD[2] = color_endpoints[tile_index];
- CRND_WRITE_BARRIER
- pD[3] = m_color_selectors[prev_color_selector_index];
- CRND_WRITE_BARRIER
-#endif
- }
- }
-
- pD = (uint32*)((uint8*)pD - cBytesPerBlock * 2 + row_pitch_in_bytes);
- }
-
- pBlock += block_delta;
-
- } // x
-
- pRow += row_pitch_in_bytes * 2;
-
- } // y
-
- } // f
-
- CRND_HUFF_DECODE_END(m_codec);
-
- return true;
- }
-
- bool unpack_dxn(uint8** pDst, uint32 dst_size_in_bytes, uint32 row_pitch_in_bytes, uint32 blocks_x, uint32 blocks_y, uint32 chunks_x, uint32 chunks_y)
- {
- dst_size_in_bytes;
-
- uint32 chunk_encoding_bits = 1;
-
- const uint32 num_alpha_endpoints = m_alpha_endpoints.size();
- const uint32 num_alpha_selectors = m_pHeader->m_alpha_selectors.m_num;
-
- uint32 prev_alpha0_endpoint_index = 0;
- uint32 prev_alpha0_selector_index = 0;
- uint32 prev_alpha1_endpoint_index = 0;
- uint32 prev_alpha1_selector_index = 0;
-
- const uint32 num_faces = m_pHeader->m_faces;
-
- //const uint32 row_pitch_in_dwords = row_pitch_in_bytes >> 2U;
-
- const int32 cBytesPerBlock = 16;
-
- CRND_HUFF_DECODE_BEGIN(m_codec);
-
- for (uint32 f = 0; f < num_faces; f++)
- {
- uint8* CRND_RESTRICT pRow = pDst[f];
-
- for (uint32 y = 0; y < chunks_y; y++)
- {
- int32 start_x = 0;
- int32 end_x = chunks_x;
- int32 dir_x = 1;
- int32 block_delta = cBytesPerBlock*2;
- uint8* CRND_RESTRICT pBlock = pRow;
-
- if (y & 1)
- {
- start_x = chunks_x - 1;
- end_x = -1;
- dir_x = -1;
- block_delta = -cBytesPerBlock*2;
- pBlock += (chunks_x - 1) * cBytesPerBlock * 2;
- }
-
- const bool skip_bottom_row = (y == (chunks_y - 1)) && (blocks_y & 1);
-
- for (int32 x = start_x; x != end_x; x += dir_x)
- {
- uint32 alpha0_endpoints[4];
- uint32 alpha1_endpoints[4];
-
- if (chunk_encoding_bits == 1)
- {
- CRND_HUFF_DECODE(m_codec, m_chunk_encoding_dm, chunk_encoding_bits);
- chunk_encoding_bits |= 512;
- }
-
- const uint32 chunk_encoding_index = chunk_encoding_bits & 7;
- chunk_encoding_bits >>= 3;
-
- const uint32 num_tiles = g_crnd_chunk_encoding_num_tiles[chunk_encoding_index];
-
- const uint8* pTile_indices = g_crnd_chunk_encoding_tiles[chunk_encoding_index].m_tiles;
-
- const bool skip_right_col = (blocks_x & 1) && (x == ((int32)chunks_x - 1));
-
- uint32* CRND_RESTRICT pD = (uint32*)pBlock;
-
- for (uint32 i = 0; i < num_tiles; i++)
- {
- uint32 delta; CRND_HUFF_DECODE(m_codec, m_endpoint_delta_dm[1], delta);
- prev_alpha0_endpoint_index += delta;
- limit(prev_alpha0_endpoint_index, num_alpha_endpoints);
- alpha0_endpoints[i] = m_alpha_endpoints[prev_alpha0_endpoint_index];
- }
-
- for (uint32 i = 0; i < num_tiles; i++)
- {
- uint32 delta; CRND_HUFF_DECODE(m_codec, m_endpoint_delta_dm[1], delta);
- prev_alpha1_endpoint_index += delta;
- limit(prev_alpha1_endpoint_index, num_alpha_endpoints);
- alpha1_endpoints[i] = m_alpha_endpoints[prev_alpha1_endpoint_index];
- }
-
- pD = (uint32*)pBlock;
- for (uint32 by = 0; by < 2; by++)
- {
- for (uint32 bx = 0; bx < 2; bx++, pD += 4)
- {
- uint32 delta0; CRND_HUFF_DECODE(m_codec, m_selector_delta_dm[1], delta0);
- prev_alpha0_selector_index += delta0;
- limit(prev_alpha0_selector_index, num_alpha_selectors);
-
- uint32 delta1; CRND_HUFF_DECODE(m_codec, m_selector_delta_dm[1], delta1);
- prev_alpha1_selector_index += delta1;
- limit(prev_alpha1_selector_index, num_alpha_selectors);
-
- if (!((bx && skip_right_col) || (by && skip_bottom_row)))
- {
- const uint32 tile_index = pTile_indices[bx + by * 2];
- const uint16* pAlpha0_selectors = &m_alpha_selectors[prev_alpha0_selector_index * 3];
- const uint16* pAlpha1_selectors = &m_alpha_selectors[prev_alpha1_selector_index * 3];
-
-#ifdef CRND_BIG_ENDIAN_PLATFORM
- pD[0] = (alpha0_endpoints[tile_index] << 16) | pAlpha0_selectors[0];
- CRND_WRITE_BARRIER
- pD[1] = (pAlpha0_selectors[1] << 16) | pAlpha0_selectors[2];
- CRND_WRITE_BARRIER
- pD[2] = (alpha1_endpoints[tile_index] << 16) | pAlpha1_selectors[0];
- CRND_WRITE_BARRIER
- pD[3] = (pAlpha1_selectors[1] << 16) | pAlpha1_selectors[2];
- CRND_WRITE_BARRIER
-#else
- pD[0] = alpha0_endpoints[tile_index] | (pAlpha0_selectors[0] << 16);
- CRND_WRITE_BARRIER
- pD[1] = pAlpha0_selectors[1] | (pAlpha0_selectors[2] << 16);
- CRND_WRITE_BARRIER
- pD[2] = alpha1_endpoints[tile_index] | (pAlpha1_selectors[0] << 16);
- CRND_WRITE_BARRIER
- pD[3] = pAlpha1_selectors[1] | (pAlpha1_selectors[2] << 16);
- CRND_WRITE_BARRIER
-#endif
- }
- }
-
- pD = (uint32*)((uint8*)pD - cBytesPerBlock * 2 + row_pitch_in_bytes);
- }
-
- pBlock += block_delta;
-
- } // x
-
- pRow += row_pitch_in_bytes * 2;
-
- } // y
-
- } // f
-
- CRND_HUFF_DECODE_END(m_codec);
-
- return true;
- }
-
- bool unpack_dxt5a(uint8** pDst, uint32 dst_size_in_bytes, uint32 row_pitch_in_bytes, uint32 blocks_x, uint32 blocks_y, uint32 chunks_x, uint32 chunks_y)
- {
- dst_size_in_bytes;
-
- uint32 chunk_encoding_bits = 1;
-
- const uint32 num_alpha_endpoints = m_alpha_endpoints.size();
- const uint32 num_alpha_selectors = m_pHeader->m_alpha_selectors.m_num;
-
- uint32 prev_alpha0_endpoint_index = 0;
- uint32 prev_alpha0_selector_index = 0;
-
- const uint32 num_faces = m_pHeader->m_faces;
-
- const int32 cBytesPerBlock = 8;
-
- CRND_HUFF_DECODE_BEGIN(m_codec);
-
- for (uint32 f = 0; f < num_faces; f++)
- {
- uint8* CRND_RESTRICT pRow = pDst[f];
-
- for (uint32 y = 0; y < chunks_y; y++)
- {
- int32 start_x = 0;
- int32 end_x = chunks_x;
- int32 dir_x = 1;
- int32 block_delta = cBytesPerBlock*2;
- uint8* CRND_RESTRICT pBlock = pRow;
-
- if (y & 1)
- {
- start_x = chunks_x - 1;
- end_x = -1;
- dir_x = -1;
- block_delta = -cBytesPerBlock*2;
- pBlock += (chunks_x - 1) * cBytesPerBlock * 2;
- }
-
- const bool skip_bottom_row = (y == (chunks_y - 1)) && (blocks_y & 1);
-
- for (int32 x = start_x; x != end_x; x += dir_x)
- {
- uint32 alpha0_endpoints[4];
-
- if (chunk_encoding_bits == 1)
- {
- CRND_HUFF_DECODE(m_codec, m_chunk_encoding_dm, chunk_encoding_bits);
- chunk_encoding_bits |= 512;
- }
-
- const uint32 chunk_encoding_index = chunk_encoding_bits & 7;
- chunk_encoding_bits >>= 3;
-
- const uint32 num_tiles = g_crnd_chunk_encoding_num_tiles[chunk_encoding_index];
-
- const uint8* pTile_indices = g_crnd_chunk_encoding_tiles[chunk_encoding_index].m_tiles;
-
- const bool skip_right_col = (blocks_x & 1) && (x == ((int32)chunks_x - 1));
-
- uint32* CRND_RESTRICT pD = (uint32*)pBlock;
-
- for (uint32 i = 0; i < num_tiles; i++)
- {
- uint32 delta; CRND_HUFF_DECODE(m_codec, m_endpoint_delta_dm[1], delta);
- prev_alpha0_endpoint_index += delta;
- limit(prev_alpha0_endpoint_index, num_alpha_endpoints);
- alpha0_endpoints[i] = m_alpha_endpoints[prev_alpha0_endpoint_index];
- }
-
- pD = (uint32*)pBlock;
- for (uint32 by = 0; by < 2; by++)
- {
- for (uint32 bx = 0; bx < 2; bx++, pD += 2)
- {
- uint32 delta; CRND_HUFF_DECODE(m_codec, m_selector_delta_dm[1], delta);
- prev_alpha0_selector_index += delta;
- limit(prev_alpha0_selector_index, num_alpha_selectors);
-
- if (!((bx && skip_right_col) || (by && skip_bottom_row)))
- {
- const uint32 tile_index = pTile_indices[bx + by * 2];
- const uint16* pAlpha0_selectors = &m_alpha_selectors[prev_alpha0_selector_index * 3];
-
-#if CRND_BIG_ENDIAN_PLATFORM
- pD[0] = (alpha0_endpoints[tile_index] << 16) | pAlpha0_selectors[0];
- CRND_WRITE_BARRIER
- pD[1] = (pAlpha0_selectors[1] << 16) | pAlpha0_selectors[2];
- CRND_WRITE_BARRIER
-#else
- pD[0] = alpha0_endpoints[tile_index] | (pAlpha0_selectors[0] << 16);
- CRND_WRITE_BARRIER
- pD[1] = pAlpha0_selectors[1] | (pAlpha0_selectors[2] << 16);
- CRND_WRITE_BARRIER
-#endif
- }
- }
-
- pD = (uint32*)((uint8*)pD - cBytesPerBlock * 2 + row_pitch_in_bytes);
- }
-
- pBlock += block_delta;
-
- } // x
-
- pRow += row_pitch_in_bytes * 2;
-
- } // y
-
- } // f
-
- CRND_HUFF_DECODE_END(m_codec);
-
- return true;
- }
- };
-
- crnd_unpack_context crnd_unpack_begin(const void* pData, uint32 data_size)
- {
- if ((!pData) || (data_size < cCRNHeaderMinSize))
- return NULL;
-
- crn_unpacker* p = crnd_new<crn_unpacker>();
- if (!p)
- return NULL;
-
- if (!p->init(pData, data_size))
- {
- crnd_delete(p);
- return NULL;
- }
-
- return p;
- }
-
- bool crnd_get_data(crnd_unpack_context pContext, const void** ppData, uint32* pData_size)
- {
- if (!pContext)
- return false;
-
- crn_unpacker* pUnpacker = static_cast<crn_unpacker*>(pContext);
-
- if (!pUnpacker->is_valid())
- return false;
-
- if (ppData)
- *ppData = pUnpacker->get_data();
-
- if (pData_size)
- *pData_size = pUnpacker->get_data_size();
-
- return true;
- }
-
- bool crnd_unpack_level(
- crnd_unpack_context pContext,
- void** pDst, uint32 dst_size_in_bytes, uint32 row_pitch_in_bytes,
- uint32 level_index)
- {
- if ((!pContext) || (!pDst) || (dst_size_in_bytes < 8U) || (level_index >= cCRNMaxLevels))
- return false;
-
- crn_unpacker* pUnpacker = static_cast<crn_unpacker*>(pContext);
-
- if (!pUnpacker->is_valid())
- return false;
-
- return pUnpacker->unpack_level(pDst, dst_size_in_bytes, row_pitch_in_bytes, level_index);
- }
-
- bool crnd_unpack_level_segmented(
- crnd_unpack_context pContext,
- const void* pSrc, uint32 src_size_in_bytes,
- void** pDst, uint32 dst_size_in_bytes, uint32 row_pitch_in_bytes,
- uint32 level_index)
- {
- if ((!pContext) || (!pSrc) || (!pDst) || (dst_size_in_bytes < 8U) || (level_index >= cCRNMaxLevels))
- return false;
-
- crn_unpacker* pUnpacker = static_cast<crn_unpacker*>(pContext);
-
- if (!pUnpacker->is_valid())
- return false;
-
- return pUnpacker->unpack_level(pSrc, src_size_in_bytes, pDst, dst_size_in_bytes, row_pitch_in_bytes, level_index);
- }
-
- bool crnd_unpack_end(crnd_unpack_context pContext)
- {
- if (!pContext)
- return false;
-
- crn_unpacker* pUnpacker = static_cast<crn_unpacker*>(pContext);
-
- if (!pUnpacker->is_valid())
- return false;
-
- crnd_delete(pUnpacker);
-
- return true;
- }
-
-} // namespace crnd
-
-#endif // CRND_HEADER_FILE_ONLY
-
-//------------------------------------------------------------------------------
-//
-// crn_decomp.h uses the ZLIB license:
-// http://opensource.org/licenses/Zlib
-//
-// Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC
-//
-// This software is provided 'as-is', without any express or implied
-// warranty. In no event will the authors be held liable for any damages
-// arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it
-// freely, subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented; you must not
-// claim that you wrote the original software. If you use this software
-// in a product, an acknowledgment in the product documentation would be
-// appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such, and must not be
-// misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-//------------------------------------------------------------------------------
diff --git a/Libraries/crunch-ea9b8d/inc/crnlib.h b/Libraries/crunch-ea9b8d/inc/crnlib.h
deleted file mode 100644
index 1c3e0782..00000000
--- a/Libraries/crunch-ea9b8d/inc/crnlib.h
+++ /dev/null
@@ -1,642 +0,0 @@
-// File: crnlib.h - Advanced DXTn texture compression library.
-// Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC
-// See copyright notice and license at the end of this file.
-//
-// This header file contains the public crnlib declarations for DXTn,
-// clustered DXTn, and CRN compression/decompression.
-//
-// Note: This library does NOT need to be linked into your game executable if
-// all you want to do is transcode .CRN files to raw DXTn bits at run-time.
-// The crn_decomp.h header file library contains all the code necessary for
-// decompression.
-//
-// Important: If compiling with gcc, be sure strict aliasing is disabled: -fno-strict-aliasing
-#ifndef CRNLIB_H
-#define CRNLIB_H
-
-#ifdef _MSC_VER
-#pragma warning (disable: 4127) // conditional expression is constant
-#endif
-
-#define CRNLIB_VERSION 104
-
-#define CRNLIB_SUPPORT_ATI_COMPRESS 0
-#define CRNLIB_SUPPORT_SQUISH 0
-
-typedef unsigned char crn_uint8;
-typedef unsigned short crn_uint16;
-typedef unsigned int crn_uint32;
-typedef signed char crn_int8;
-typedef signed short crn_int16;
-typedef signed int crn_int32;
-typedef unsigned int crn_bool;
-
-// crnlib can compress to these file types.
-enum crn_file_type
-{
- // .CRN
- cCRNFileTypeCRN = 0,
-
- // .DDS using regular DXT or clustered DXT
- cCRNFileTypeDDS,
-
- cCRNFileTypeForceDWORD = 0xFFFFFFFF
-};
-
-// Supported compressed pixel formats.
-// Basically all the standard DX9 formats, with some swizzled DXT5 formats
-// (most of them supported by ATI's Compressonator), along with some ATI/X360 GPU specific formats.
-enum crn_format
-{
- cCRNFmtInvalid = -1,
-
- cCRNFmtDXT1 = 0,
-
- cCRNFmtFirstValid = cCRNFmtDXT1,
-
- // cCRNFmtDXT3 is not currently supported when writing to CRN - only DDS.
- cCRNFmtDXT3,
-
- cCRNFmtDXT5,
-
- // Various DXT5 derivatives
- cCRNFmtDXT5_CCxY, // Luma-chroma
- cCRNFmtDXT5_xGxR, // Swizzled 2-component
- cCRNFmtDXT5_xGBR, // Swizzled 3-component
- cCRNFmtDXT5_AGBR, // Swizzled 4-component
-
- // ATI 3DC and X360 DXN
- cCRNFmtDXN_XY,
- cCRNFmtDXN_YX,
-
- // DXT5 alpha blocks only
- cCRNFmtDXT5A,
-
- cCRNFmtETC1,
-
- cCRNFmtTotal,
-
- cCRNFmtForceDWORD = 0xFFFFFFFF
-};
-
-// Various library/file format limits.
-enum crn_limits
-{
- // Max. mipmap level resolution on any axis.
- cCRNMaxLevelResolution = 4096,
-
- cCRNMinPaletteSize = 8,
- cCRNMaxPaletteSize = 8192,
-
- cCRNMaxFaces = 6,
- cCRNMaxLevels = 16,
-
- cCRNMaxHelperThreads = 16,
-
- cCRNMinQualityLevel = 0,
- cCRNMaxQualityLevel = 255
-};
-
-// CRN/DDS compression flags.
-// See the m_flags member in the crn_comp_params struct, below.
-enum crn_comp_flags
-{
- // Enables perceptual colorspace distance metrics if set.
- // Important: Be sure to disable this when compressing non-sRGB colorspace images, like normal maps!
- // Default: Set
- cCRNCompFlagPerceptual = 1,
-
- // Enables (up to) 8x8 macroblock usage if set. If disabled, only 4x4 blocks are allowed.
- // Compression ratio will be lower when disabled, but may cut down on blocky artifacts because the process used to determine
- // where large macroblocks can be used without artifacts isn't perfect.
- // Default: Set.
- cCRNCompFlagHierarchical = 2,
-
- // cCRNCompFlagQuick disables several output file optimizations - intended for things like quicker previews.
- // Default: Not set.
- cCRNCompFlagQuick = 4,
-
- // DXT1: OK to use DXT1 alpha blocks for better quality or DXT1A transparency.
- // DXT5: OK to use both DXT5 block types.
- // Currently only used when writing to .DDS files, as .CRN uses only a subset of the possible DXTn block types.
- // Default: Set.
- cCRNCompFlagUseBothBlockTypes = 8,
-
- // OK to use DXT1A transparent indices to encode black (assumes pixel shader ignores fetched alpha).
- // Currently only used when writing to .DDS files, .CRN never uses alpha blocks.
- // Default: Not set.
- cCRNCompFlagUseTransparentIndicesForBlack = 16,
-
- // Disables endpoint caching, for more deterministic output.
- // Currently only used when writing to .DDS files.
- // Default: Not set.
- cCRNCompFlagDisableEndpointCaching = 32,
-
- // If enabled, use the cCRNColorEndpointPaletteSize, etc. params to control the CRN palette sizes. Only useful when writing to .CRN files.
- // Default: Not set.
- cCRNCompFlagManualPaletteSizes = 64,
-
- // If enabled, DXT1A alpha blocks are used to encode single bit transparency.
- // Default: Not set.
- cCRNCompFlagDXT1AForTransparency = 128,
-
- // If enabled, the DXT1 compressor's color distance metric assumes the pixel shader will be converting the fetched RGB results to luma (Y part of YCbCr).
- // This increases quality when compressing grayscale images, because the compressor can spread the luma error amoung all three channels (i.e. it can generate blocks
- // with some chroma present if doing so will ultimately lead to lower luma error).
- // Only enable on grayscale source images.
- // Default: Not set.
- cCRNCompFlagGrayscaleSampling = 256,
-
- // If enabled, debug information will be output during compression.
- // Default: Not set.
- cCRNCompFlagDebugging = 0x80000000,
-
- cCRNCompFlagForceDWORD = 0xFFFFFFFF
-};
-
-// Controls DXTn quality vs. speed control - only used when compressing to .DDS.
-enum crn_dxt_quality
-{
- cCRNDXTQualitySuperFast,
- cCRNDXTQualityFast,
- cCRNDXTQualityNormal,
- cCRNDXTQualityBetter,
- cCRNDXTQualityUber,
-
- cCRNDXTQualityTotal,
-
- cCRNDXTQualityForceDWORD = 0xFFFFFFFF
-};
-
-// Which DXTn compressor to use when compressing to plain (non-clustered) .DDS.
-enum crn_dxt_compressor_type
-{
- cCRNDXTCompressorCRN, // Use crnlib's ETC1 or DXTc block compressor (default, highest quality, comparable or better than ati_compress or squish, and crnlib's ETC1 is a lot fasterw with similiar quality to Erricson's)
- cCRNDXTCompressorCRNF, // Use crnlib's "fast" DXTc block compressor
- cCRNDXTCompressorRYG, // Use RYG's DXTc block compressor (low quality, but very fast)
-
-#if CRNLIB_SUPPORT_ATI_COMPRESS
- cCRNDXTCompressorATI,
-#endif
-
-#if CRNLIB_SUPPORT_SQUISH
- cCRNDXTCompressorSquish,
-#endif
-
- cCRNTotalDXTCompressors,
-
- cCRNDXTCompressorForceDWORD = 0xFFFFFFFF
-};
-
-// Progress callback function.
-// Processing will stop prematurely (and fail) if the callback returns false.
-// phase_index, total_phases - high level progress
-// subphase_index, total_subphases - progress within current phase
-typedef crn_bool (*crn_progress_callback_func)(crn_uint32 phase_index, crn_uint32 total_phases, crn_uint32 subphase_index, crn_uint32 total_subphases, void* pUser_data_ptr);
-
-// CRN/DDS compression parameters struct.
-struct crn_comp_params
-{
- inline crn_comp_params() { clear(); }
-
- // Clear struct to default parameters.
- inline void clear()
- {
- m_size_of_obj = sizeof(*this);
- m_file_type = cCRNFileTypeCRN;
- m_faces = 1;
- m_width = 0;
- m_height = 0;
- m_levels = 1;
- m_format = cCRNFmtDXT1;
- m_flags = cCRNCompFlagPerceptual | cCRNCompFlagHierarchical | cCRNCompFlagUseBothBlockTypes;
-
- for (crn_uint32 f = 0; f < cCRNMaxFaces; f++)
- for (crn_uint32 l = 0; l < cCRNMaxLevels; l++)
- m_pImages[f][l] = NULL;
-
- m_target_bitrate = 0.0f;
- m_quality_level = cCRNMaxQualityLevel;
- m_dxt1a_alpha_threshold = 128;
- m_dxt_quality = cCRNDXTQualityUber;
- m_dxt_compressor_type = cCRNDXTCompressorCRN;
- m_alpha_component = 3;
-
- m_crn_adaptive_tile_color_psnr_derating = 2.0f;
- m_crn_adaptive_tile_alpha_psnr_derating = 2.0f;
- m_crn_color_endpoint_palette_size = 0;
- m_crn_color_selector_palette_size = 0;
- m_crn_alpha_endpoint_palette_size = 0;
- m_crn_alpha_selector_palette_size = 0;
-
- m_num_helper_threads = 0;
- m_userdata0 = 0;
- m_userdata1 = 0;
- m_pProgress_func = NULL;
- m_pProgress_func_data = NULL;
- }
-
- inline bool operator== (const crn_comp_params& rhs) const
- {
-#define CRNLIB_COMP(x) do { if ((x) != (rhs.x)) return false; } while(0)
- CRNLIB_COMP(m_size_of_obj);
- CRNLIB_COMP(m_file_type);
- CRNLIB_COMP(m_faces);
- CRNLIB_COMP(m_width);
- CRNLIB_COMP(m_height);
- CRNLIB_COMP(m_levels);
- CRNLIB_COMP(m_format);
- CRNLIB_COMP(m_flags);
- CRNLIB_COMP(m_target_bitrate);
- CRNLIB_COMP(m_quality_level);
- CRNLIB_COMP(m_dxt1a_alpha_threshold);
- CRNLIB_COMP(m_dxt_quality);
- CRNLIB_COMP(m_dxt_compressor_type);
- CRNLIB_COMP(m_alpha_component);
- CRNLIB_COMP(m_crn_adaptive_tile_color_psnr_derating);
- CRNLIB_COMP(m_crn_adaptive_tile_alpha_psnr_derating);
- CRNLIB_COMP(m_crn_color_endpoint_palette_size);
- CRNLIB_COMP(m_crn_color_selector_palette_size);
- CRNLIB_COMP(m_crn_alpha_endpoint_palette_size);
- CRNLIB_COMP(m_crn_alpha_selector_palette_size);
- CRNLIB_COMP(m_num_helper_threads);
- CRNLIB_COMP(m_userdata0);
- CRNLIB_COMP(m_userdata1);
- CRNLIB_COMP(m_pProgress_func);
- CRNLIB_COMP(m_pProgress_func_data);
-
- for (crn_uint32 f = 0; f < cCRNMaxFaces; f++)
- for (crn_uint32 l = 0; l < cCRNMaxLevels; l++)
- CRNLIB_COMP(m_pImages[f][l]);
-
-#undef CRNLIB_COMP
- return true;
- }
-
- // Returns true if the input parameters are reasonable.
- inline bool check() const
- {
- if ( (m_file_type > cCRNFileTypeDDS) ||
- (((int)m_quality_level < (int)cCRNMinQualityLevel) || ((int)m_quality_level > (int)cCRNMaxQualityLevel)) ||
- (m_dxt1a_alpha_threshold > 255) ||
- ((m_faces != 1) && (m_faces != 6)) ||
- ((m_width < 1) || (m_width > cCRNMaxLevelResolution)) ||
- ((m_height < 1) || (m_height > cCRNMaxLevelResolution)) ||
- ((m_levels < 1) || (m_levels > cCRNMaxLevels)) ||
- ((m_format < cCRNFmtDXT1) || (m_format >= cCRNFmtTotal)) ||
- ((m_crn_color_endpoint_palette_size) && ((m_crn_color_endpoint_palette_size < cCRNMinPaletteSize) || (m_crn_color_endpoint_palette_size > cCRNMaxPaletteSize))) ||
- ((m_crn_color_selector_palette_size) && ((m_crn_color_selector_palette_size < cCRNMinPaletteSize) || (m_crn_color_selector_palette_size > cCRNMaxPaletteSize))) ||
- ((m_crn_alpha_endpoint_palette_size) && ((m_crn_alpha_endpoint_palette_size < cCRNMinPaletteSize) || (m_crn_alpha_endpoint_palette_size > cCRNMaxPaletteSize))) ||
- ((m_crn_alpha_selector_palette_size) && ((m_crn_alpha_selector_palette_size < cCRNMinPaletteSize) || (m_crn_alpha_selector_palette_size > cCRNMaxPaletteSize))) ||
- (m_alpha_component > 3) ||
- (m_num_helper_threads > cCRNMaxHelperThreads) ||
- (m_dxt_quality > cCRNDXTQualityUber) ||
- (m_dxt_compressor_type >= cCRNTotalDXTCompressors) )
- {
- return false;
- }
- return true;
- }
-
- // Helper to set/get flags from m_flags member.
- inline bool get_flag(crn_comp_flags flag) const { return (m_flags & flag) != 0; }
- inline void set_flag(crn_comp_flags flag, bool val) { m_flags &= ~flag; if (val) m_flags |= flag; }
-
- crn_uint32 m_size_of_obj;
-
- crn_file_type m_file_type; // Output file type: cCRNFileTypeCRN or cCRNFileTypeDDS.
-
- crn_uint32 m_faces; // 1 (2D map) or 6 (cubemap)
- crn_uint32 m_width; // [1,cCRNMaxLevelResolution], non-power of 2 OK, non-square OK
- crn_uint32 m_height; // [1,cCRNMaxLevelResolution], non-power of 2 OK, non-square OK
- crn_uint32 m_levels; // [1,cCRNMaxLevelResolution], non-power of 2 OK, non-square OK
-
- crn_format m_format; // Output pixel format.
-
- crn_uint32 m_flags; // see crn_comp_flags enum
-
- // Array of pointers to 32bpp input images.
- const crn_uint32* m_pImages[cCRNMaxFaces][cCRNMaxLevels];
-
- // Target bitrate - if non-zero, the compressor will use an interpolative search to find the
- // highest quality level that is <= the target bitrate. If it fails to find a bitrate high enough, it'll
- // try disabling adaptive block sizes (cCRNCompFlagHierarchical flag) and redo the search. This process can be pretty slow.
- float m_target_bitrate;
-
- // Desired quality level.
- // Currently, CRN and DDS quality levels are not compatible with eachother from an image quality standpoint.
- crn_uint32 m_quality_level; // [cCRNMinQualityLevel, cCRNMaxQualityLevel]
-
- // DXTn compression parameters.
- crn_uint32 m_dxt1a_alpha_threshold;
- crn_dxt_quality m_dxt_quality;
- crn_dxt_compressor_type m_dxt_compressor_type;
-
- // Alpha channel's component. Defaults to 3.
- crn_uint32 m_alpha_component;
-
- // Various low-level CRN specific parameters.
- float m_crn_adaptive_tile_color_psnr_derating;
- float m_crn_adaptive_tile_alpha_psnr_derating;
-
- crn_uint32 m_crn_color_endpoint_palette_size; // [cCRNMinPaletteSize,cCRNMaxPaletteSize]
- crn_uint32 m_crn_color_selector_palette_size; // [cCRNMinPaletteSize,cCRNMaxPaletteSize]
-
- crn_uint32 m_crn_alpha_endpoint_palette_size; // [cCRNMinPaletteSize,cCRNMaxPaletteSize]
- crn_uint32 m_crn_alpha_selector_palette_size; // [cCRNMinPaletteSize,cCRNMaxPaletteSize]
-
- // Number of helper threads to create during compression. 0=no threading.
- crn_uint32 m_num_helper_threads;
-
- // CRN userdata0 and userdata1 members, which are written directly to the header of the output file.
- crn_uint32 m_userdata0;
- crn_uint32 m_userdata1;
-
- // User provided progress callback.
- crn_progress_callback_func m_pProgress_func;
- void* m_pProgress_func_data;
-};
-
-// Mipmap generator's mode.
-enum crn_mip_mode
-{
- cCRNMipModeUseSourceOrGenerateMips, // Use source texture's mipmaps if it has any, otherwise generate new mipmaps
- cCRNMipModeUseSourceMips, // Use source texture's mipmaps if it has any, otherwise the output has no mipmaps
- cCRNMipModeGenerateMips, // Always generate new mipmaps
- cCRNMipModeNoMips, // Output texture has no mipmaps
-
- cCRNMipModeTotal,
-
- cCRNModeForceDWORD = 0xFFFFFFFF
-};
-
-const char* crn_get_mip_mode_desc(crn_mip_mode m);
-const char* crn_get_mip_mode_name(crn_mip_mode m);
-
-// Mipmap generator's filter kernel.
-enum crn_mip_filter
-{
- cCRNMipFilterBox,
- cCRNMipFilterTent,
- cCRNMipFilterLanczos4,
- cCRNMipFilterMitchell,
- cCRNMipFilterKaiser, // Kaiser=default mipmap filter
-
- cCRNMipFilterTotal,
-
- cCRNMipFilterForceDWORD = 0xFFFFFFFF
-};
-
-const char* crn_get_mip_filter_name(crn_mip_filter f);
-
-// Mipmap generator's scale mode.
-enum crn_scale_mode
-{
- cCRNSMDisabled,
- cCRNSMAbsolute,
- cCRNSMRelative,
- cCRNSMLowerPow2,
- cCRNSMNearestPow2,
- cCRNSMNextPow2,
-
- cCRNSMTotal,
-
- cCRNSMForceDWORD = 0xFFFFFFFF
-};
-
-const char* crn_get_scale_mode_desc(crn_scale_mode sm);
-
-// Mipmap generator parameters.
-struct crn_mipmap_params
-{
- inline crn_mipmap_params() { clear(); }
-
- inline void clear()
- {
- m_size_of_obj = sizeof(*this);
- m_mode = cCRNMipModeUseSourceOrGenerateMips;
- m_filter = cCRNMipFilterKaiser;
- m_gamma_filtering = true;
- m_gamma = 2.2f;
- // Default "blurriness" factor of .9 actually sharpens the output a little.
- m_blurriness = .9f;
- m_renormalize = false;
- m_tiled = false;
- m_max_levels = cCRNMaxLevels;
- m_min_mip_size = 1;
-
- m_scale_mode = cCRNSMDisabled;
- m_scale_x = 1.0f;
- m_scale_y = 1.0f;
-
- m_window_left = 0;
- m_window_top = 0;
- m_window_right = 0;
- m_window_bottom = 0;
-
- m_clamp_scale = false;
- m_clamp_width = 0;
- m_clamp_height = 0;
- }
-
- inline bool check() const { return true; }
-
- inline bool operator== (const crn_mipmap_params& rhs) const
- {
-#define CRNLIB_COMP(x) do { if ((x) != (rhs.x)) return false; } while(0)
- CRNLIB_COMP(m_size_of_obj);
- CRNLIB_COMP(m_mode);
- CRNLIB_COMP(m_filter);
- CRNLIB_COMP(m_gamma_filtering);
- CRNLIB_COMP(m_gamma);
- CRNLIB_COMP(m_blurriness);
- CRNLIB_COMP(m_renormalize);
- CRNLIB_COMP(m_tiled);
- CRNLIB_COMP(m_max_levels);
- CRNLIB_COMP(m_min_mip_size);
- CRNLIB_COMP(m_scale_mode);
- CRNLIB_COMP(m_scale_x);
- CRNLIB_COMP(m_scale_y);
- CRNLIB_COMP(m_window_left);
- CRNLIB_COMP(m_window_top);
- CRNLIB_COMP(m_window_right);
- CRNLIB_COMP(m_window_bottom);
- CRNLIB_COMP(m_clamp_scale);
- CRNLIB_COMP(m_clamp_width);
- CRNLIB_COMP(m_clamp_height);
- return true;
-#undef CRNLIB_COMP
- }
- crn_uint32 m_size_of_obj;
-
- crn_mip_mode m_mode;
- crn_mip_filter m_filter;
-
- crn_bool m_gamma_filtering;
- float m_gamma;
-
- float m_blurriness;
-
- crn_uint32 m_max_levels;
- crn_uint32 m_min_mip_size;
-
- crn_bool m_renormalize;
- crn_bool m_tiled;
-
- crn_scale_mode m_scale_mode;
- float m_scale_x;
- float m_scale_y;
-
- crn_uint32 m_window_left;
- crn_uint32 m_window_top;
- crn_uint32 m_window_right;
- crn_uint32 m_window_bottom;
-
- crn_bool m_clamp_scale;
- crn_uint32 m_clamp_width;
- crn_uint32 m_clamp_height;
-};
-
-// -------- High-level helper function definitions for CDN/DDS compression.
-
-#ifndef CRNLIB_MIN_ALLOC_ALIGNMENT
-#define CRNLIB_MIN_ALLOC_ALIGNMENT sizeof(size_t) * 2
-#endif
-
-// Function to set an optional user provided memory allocation/reallocation/msize routines.
-// By default, crnlib just uses malloc(), free(), etc. for all allocations.
-typedef void* (*crn_realloc_func)(void* p, size_t size, size_t* pActual_size, bool movable, void* pUser_data);
-typedef size_t (*crn_msize_func)(void* p, void* pUser_data);
-void crn_set_memory_callbacks(crn_realloc_func pRealloc, crn_msize_func pMSize, void* pUser_data);
-
-// Frees memory blocks allocated by crn_compress(), crn_decompress_crn_to_dds(), or crn_decompress_dds_to_images().
-void crn_free_block(void *pBlock);
-
-// Compresses a 32-bit/pixel texture to either: a regular DX9 DDS file, a "clustered" (or reduced entropy) DX9 DDS file, or a CRN file in memory.
-// Input parameters:
-// comp_params is the compression parameters struct, defined above.
-// compressed_size will be set to the size of the returned memory block containing the output file.
-// The returned block must be freed by calling crn_free_block().
-// *pActual_quality_level will be set to the actual quality level used to compress the image. May be NULL.
-// *pActual_bitrate will be set to the output file's effective bitrate, possibly taking into account LZMA compression. May be NULL.
-// Return value:
-// The compressed file data, or NULL on failure.
-// compressed_size will be set to the size of the returned memory buffer.
-// Notes:
-// A "regular" DDS file is compressed using normal DXTn compression at the specified DXT quality level.
-// A "clustered" DDS file is compressed using clustered DXTn compression to either the target bitrate or the specified integer quality factor.
-// The output file is a standard DX9 format DDS file, except the compressor assumes you will be later losslessly compressing the DDS output file using the LZMA algorithm.
-// A texture is defined as an array of 1 or 6 "faces" (6 faces=cubemap), where each "face" consists of between [1,cCRNMaxLevels] mipmap levels.
-// Mipmap levels are simple 32-bit 2D images with a pitch of width*sizeof(uint32), arranged in the usual raster order (top scanline first).
-// The image pixels may be grayscale (YYYX bytes in memory), grayscale/alpha (YYYA in memory), 24-bit (RGBX in memory), or 32-bit (RGBA) colors (where "X"=don't care).
-// RGB color data is generally assumed to be in the sRGB colorspace. If not, be sure to clear the "cCRNCompFlagPerceptual" in the crn_comp_params struct!
-void *crn_compress(const crn_comp_params &comp_params, crn_uint32 &compressed_size, crn_uint32 *pActual_quality_level = NULL, float *pActual_bitrate = NULL);
-
-// Like the above function, except this function can also do things like generate mipmaps, and resize or crop the input texture before compression.
-// The actual operations performed are controlled by the crn_mipmap_params struct members.
-// Be sure to set the "m_gamma_filtering" member of crn_mipmap_params to false if the input texture is not sRGB.
-void *crn_compress(const crn_comp_params &comp_params, const crn_mipmap_params &mip_params, crn_uint32 &compressed_size, crn_uint32 *pActual_quality_level = NULL, float *pActual_bitrate = NULL);
-
-// Transcodes an entire CRN file to DDS using the crn_decomp.h header file library to do most of the heavy lifting.
-// The output DDS file's format is guaranteed to be one of the DXTn formats in the crn_format enum.
-// This is a fast operation, because the CRN format is explicitly designed to be efficiently transcodable to DXTn.
-// For more control over decompression, see the lower-level helper functions in crn_decomp.h, which do not depend at all on crnlib.
-void *crn_decompress_crn_to_dds(const void *pCRN_file_data, crn_uint32 &file_size);
-
-// Decompresses an entire DDS file in any supported format to uncompressed 32-bit/pixel image(s).
-// See the crnlib::pixel_format enum in inc/dds_defs.h for a list of the supported DDS formats.
-// You are responsible for freeing each image block, either by calling crn_free_all_images() or manually calling crn_free_block() on each image pointer.
-struct crn_texture_desc
-{
- crn_uint32 m_faces;
- crn_uint32 m_width;
- crn_uint32 m_height;
- crn_uint32 m_levels;
- crn_uint32 m_fmt_fourcc; // Same as crnlib::pixel_format
-};
-bool crn_decompress_dds_to_images(const void *pDDS_file_data, crn_uint32 dds_file_size, crn_uint32 **ppImages, crn_texture_desc &tex_desc);
-
-// Frees all images allocated by crn_decompress_dds_to_images().
-void crn_free_all_images(crn_uint32 **ppImages, const crn_texture_desc &desc);
-
-// -------- crn_format related helpers functions.
-
-// Returns the FOURCC format equivalent to the specified crn_format.
-crn_uint32 crn_get_format_fourcc(crn_format fmt);
-
-// Returns the crn_format's bits per texel.
-crn_uint32 crn_get_format_bits_per_texel(crn_format fmt);
-
-// Returns the crn_format's number of bytes per block.
-crn_uint32 crn_get_bytes_per_dxt_block(crn_format fmt);
-
-// Returns the non-swizzled, basic DXTn version of the specified crn_format.
-// This is the format you would supply D3D or OpenGL.
-crn_format crn_get_fundamental_dxt_format(crn_format fmt);
-
-// -------- String helpers.
-
-// Converts a crn_file_type to a string.
-const char* crn_get_file_type_ext(crn_file_type file_type);
-
-// Converts a crn_format to a string.
-const char* crn_get_format_string(crn_format fmt);
-
-// Converts a crn_dxt_quality to a string.
-const char* crn_get_dxt_quality_string(crn_dxt_quality q);
-
-// -------- Low-level DXTn 4x4 block compressor API
-
-// crnlib's DXTn endpoint optimizer actually supports any number of source pixels (i.e. from 1 to thousands, not just 16),
-// but for simplicity this API only supports 4x4 texel blocks.
-typedef void *crn_block_compressor_context_t;
-
-// Create a DXTn block compressor.
-// This function only supports the basic/nonswizzled "fundamental" formats: DXT1, DXT3, DXT5, DXT5A, DXN_XY and DXN_YX.
-// Avoid calling this multiple times if you intend on compressing many blocks, because it allocates some memory.
-crn_block_compressor_context_t crn_create_block_compressor(const crn_comp_params &params);
-
-// Compresses a block of 16 pixels to the destination DXTn block.
-// pDst_block should be 8 (for DXT1/DXT5A) or 16 bytes (all the others).
-// pPixels should be an array of 16 crn_uint32's. Each crn_uint32 must be r,g,b,a (r is always first) in memory.
-void crn_compress_block(crn_block_compressor_context_t pContext, const crn_uint32 *pPixels, void *pDst_block);
-
-// Frees a DXTn block compressor.
-void crn_free_block_compressor(crn_block_compressor_context_t pContext);
-
-// Unpacks a compressed block to pDst_pixels.
-// pSrc_block should be 8 (for DXT1/DXT5A) or 16 bytes (all the others).
-// pDst_pixel should be an array of 16 crn_uint32's. Each uint32 will be r,g,b,a (r is always first) in memory.
-// crn_fmt should be one of the "fundamental" formats: DXT1, DXT3, DXT5, DXT5A, DXN_XY and DXN_YX.
-// The various swizzled DXT5 formats (such as cCRNFmtDXT5_xGBR, etc.) will be unpacked as if they where plain DXT5.
-// Returns false if the crn_fmt is invalid.
-bool crn_decompress_block(const void *pSrc_block, crn_uint32 *pDst_pixels, crn_format crn_fmt);
-
-#endif // CRNLIB_H
-
-//------------------------------------------------------------------------------
-//
-// crnlib uses the ZLIB license:
-// http://opensource.org/licenses/Zlib
-//
-// Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC
-//
-// This software is provided 'as-is', without any express or implied
-// warranty. In no event will the authors be held liable for any damages
-// arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it
-// freely, subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented; you must not
-// claim that you wrote the original software. If you use this software
-// in a product, an acknowledgment in the product documentation would be
-// appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such, and must not be
-// misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-//------------------------------------------------------------------------------
diff --git a/Libraries/crunch-ea9b8d/inc/dds_defs.h b/Libraries/crunch-ea9b8d/inc/dds_defs.h
deleted file mode 100644
index 64a171c7..00000000
--- a/Libraries/crunch-ea9b8d/inc/dds_defs.h
+++ /dev/null
@@ -1,152 +0,0 @@
-// File: dds_defs.h
-// DX9 .DDS file header definitions.
-#ifndef CRNLIB_DDS_DEFS_H
-#define CRNLIB_DDS_DEFS_H
-
-#include "crnlib.h"
-
-#define CRNLIB_PIXEL_FMT_FOURCC(a, b, c, d) ((a) | ((b) << 8U) | ((c) << 16U) | ((d) << 24U))
-
-namespace crnlib
-{
- enum pixel_format
- {
- PIXEL_FMT_INVALID = 0,
-
- PIXEL_FMT_DXT1 = CRNLIB_PIXEL_FMT_FOURCC('D', 'X', 'T', '1'),
- PIXEL_FMT_DXT2 = CRNLIB_PIXEL_FMT_FOURCC('D', 'X', 'T', '2'),
- PIXEL_FMT_DXT3 = CRNLIB_PIXEL_FMT_FOURCC('D', 'X', 'T', '3'),
- PIXEL_FMT_DXT4 = CRNLIB_PIXEL_FMT_FOURCC('D', 'X', 'T', '4'),
- PIXEL_FMT_DXT5 = CRNLIB_PIXEL_FMT_FOURCC('D', 'X', 'T', '5'),
- PIXEL_FMT_3DC = CRNLIB_PIXEL_FMT_FOURCC('A', 'T', 'I', '2'), // DXN_YX
- PIXEL_FMT_DXN = CRNLIB_PIXEL_FMT_FOURCC('A', '2', 'X', 'Y'), // DXN_XY
- PIXEL_FMT_DXT5A = CRNLIB_PIXEL_FMT_FOURCC('A', 'T', 'I', '1'), // ATI1N, http://developer.amd.com/media/gpu_assets/Radeon_X1x00_Programming_Guide.pdf
-
- // Non-standard, crnlib-specific pixel formats (some of these are supported by ATI's Compressonator)
- PIXEL_FMT_DXT5_CCxY = CRNLIB_PIXEL_FMT_FOURCC('C', 'C', 'x', 'Y'),
- PIXEL_FMT_DXT5_xGxR = CRNLIB_PIXEL_FMT_FOURCC('x', 'G', 'x', 'R'),
- PIXEL_FMT_DXT5_xGBR = CRNLIB_PIXEL_FMT_FOURCC('x', 'G', 'B', 'R'),
- PIXEL_FMT_DXT5_AGBR = CRNLIB_PIXEL_FMT_FOURCC('A', 'G', 'B', 'R'),
-
- PIXEL_FMT_DXT1A = CRNLIB_PIXEL_FMT_FOURCC('D', 'X', '1', 'A'),
- PIXEL_FMT_ETC1 = CRNLIB_PIXEL_FMT_FOURCC('E', 'T', 'C', '1'),
-
- PIXEL_FMT_R8G8B8 = CRNLIB_PIXEL_FMT_FOURCC('R', 'G', 'B', 'x'),
- PIXEL_FMT_L8 = CRNLIB_PIXEL_FMT_FOURCC('L', 'x', 'x', 'x'),
- PIXEL_FMT_A8 = CRNLIB_PIXEL_FMT_FOURCC('x', 'x', 'x', 'A'),
- PIXEL_FMT_A8L8 = CRNLIB_PIXEL_FMT_FOURCC('L', 'x', 'x', 'A'),
- PIXEL_FMT_A8R8G8B8 = CRNLIB_PIXEL_FMT_FOURCC('R', 'G', 'B', 'A')
- };
-
- const crn_uint32 cDDSMaxImageDimensions = 8192U;
-
- // Total size of header is sizeof(uint32)+cDDSSizeofDDSurfaceDesc2;
- const crn_uint32 cDDSSizeofDDSurfaceDesc2 = 124;
-
- // "DDS "
- const crn_uint32 cDDSFileSignature = 0x20534444;
-
- struct DDCOLORKEY
- {
- crn_uint32 dwUnused0;
- crn_uint32 dwUnused1;
- };
-
- struct DDPIXELFORMAT
- {
- crn_uint32 dwSize;
- crn_uint32 dwFlags;
- crn_uint32 dwFourCC;
- crn_uint32 dwRGBBitCount; // ATI compressonator and crnlib will place a FOURCC code here for swizzled/cooked DXTn formats
- crn_uint32 dwRBitMask;
- crn_uint32 dwGBitMask;
- crn_uint32 dwBBitMask;
- crn_uint32 dwRGBAlphaBitMask;
- };
-
- struct DDSCAPS2
- {
- crn_uint32 dwCaps;
- crn_uint32 dwCaps2;
- crn_uint32 dwCaps3;
- crn_uint32 dwCaps4;
- };
-
- struct DDSURFACEDESC2
- {
- crn_uint32 dwSize;
- crn_uint32 dwFlags;
- crn_uint32 dwHeight;
- crn_uint32 dwWidth;
- union
- {
- crn_int32 lPitch;
- crn_uint32 dwLinearSize;
- };
- crn_uint32 dwBackBufferCount;
- crn_uint32 dwMipMapCount;
- crn_uint32 dwAlphaBitDepth;
- crn_uint32 dwUnused0;
- crn_uint32 lpSurface;
- DDCOLORKEY unused0;
- DDCOLORKEY unused1;
- DDCOLORKEY unused2;
- DDCOLORKEY unused3;
- DDPIXELFORMAT ddpfPixelFormat;
- DDSCAPS2 ddsCaps;
- crn_uint32 dwUnused1;
- };
-
- const crn_uint32 DDSD_CAPS = 0x00000001;
- const crn_uint32 DDSD_HEIGHT = 0x00000002;
- const crn_uint32 DDSD_WIDTH = 0x00000004;
- const crn_uint32 DDSD_PITCH = 0x00000008;
-
- const crn_uint32 DDSD_BACKBUFFERCOUNT = 0x00000020;
- const crn_uint32 DDSD_ZBUFFERBITDEPTH = 0x00000040;
- const crn_uint32 DDSD_ALPHABITDEPTH = 0x00000080;
-
- const crn_uint32 DDSD_LPSURFACE = 0x00000800;
-
- const crn_uint32 DDSD_PIXELFORMAT = 0x00001000;
- const crn_uint32 DDSD_CKDESTOVERLAY = 0x00002000;
- const crn_uint32 DDSD_CKDESTBLT = 0x00004000;
- const crn_uint32 DDSD_CKSRCOVERLAY = 0x00008000;
-
- const crn_uint32 DDSD_CKSRCBLT = 0x00010000;
- const crn_uint32 DDSD_MIPMAPCOUNT = 0x00020000;
- const crn_uint32 DDSD_REFRESHRATE = 0x00040000;
- const crn_uint32 DDSD_LINEARSIZE = 0x00080000;
-
- const crn_uint32 DDSD_TEXTURESTAGE = 0x00100000;
- const crn_uint32 DDSD_FVF = 0x00200000;
- const crn_uint32 DDSD_SRCVBHANDLE = 0x00400000;
- const crn_uint32 DDSD_DEPTH = 0x00800000;
-
- const crn_uint32 DDSD_ALL = 0x00fff9ee;
-
- const crn_uint32 DDPF_ALPHAPIXELS = 0x00000001;
- const crn_uint32 DDPF_ALPHA = 0x00000002;
- const crn_uint32 DDPF_FOURCC = 0x00000004;
- const crn_uint32 DDPF_PALETTEINDEXED8 = 0x00000020;
- const crn_uint32 DDPF_RGB = 0x00000040;
- const crn_uint32 DDPF_LUMINANCE = 0x00020000;
-
- const crn_uint32 DDSCAPS_COMPLEX = 0x00000008;
- const crn_uint32 DDSCAPS_TEXTURE = 0x00001000;
- const crn_uint32 DDSCAPS_MIPMAP = 0x00400000;
-
- const crn_uint32 DDSCAPS2_CUBEMAP = 0x00000200;
- const crn_uint32 DDSCAPS2_CUBEMAP_POSITIVEX = 0x00000400;
- const crn_uint32 DDSCAPS2_CUBEMAP_NEGATIVEX = 0x00000800;
-
- const crn_uint32 DDSCAPS2_CUBEMAP_POSITIVEY = 0x00001000;
- const crn_uint32 DDSCAPS2_CUBEMAP_NEGATIVEY = 0x00002000;
- const crn_uint32 DDSCAPS2_CUBEMAP_POSITIVEZ = 0x00004000;
- const crn_uint32 DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x00008000;
-
- const crn_uint32 DDSCAPS2_VOLUME = 0x00200000;
-
-} // namespace crnlib
-
-#endif // CRNLIB_DDS_DEFS_H
diff --git a/Libraries/crunch-ea9b8d/license.txt b/Libraries/crunch-ea9b8d/license.txt
deleted file mode 100644
index c6ce4f80..00000000
--- a/Libraries/crunch-ea9b8d/license.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-crunch/crnlib uses the ZLIB license:
-http://opensource.org/licenses/Zlib
-
-Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
-claim that you wrote the original software. If you use this software
-in a product, an acknowledgment in the product documentation would be
-appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and must not be
-misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source distribution.
diff --git a/Libraries/glew-urkle-core/CMakeLists.txt b/Libraries/glew-urkle-core/CMakeLists.txt
deleted file mode 100644
index 4ea7566d..00000000
--- a/Libraries/glew-urkle-core/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12)
-Project(GLEW)
-
-find_package(OpenGL)
-
-CreateLibrary(${PROJECT_NAME}
-DIRS
- src
- include/GL
-INCLUDES
- PUBLIC include
-LINK
- ${OPENGL_gl_LIBRARY}
-DEFINES
- PUBLIC GLEW_STATIC GLEW_NO_GLU
-PROPERTIES
- FOLDER "3rd Party"
-)
-
-source_group("Source" REGULAR_EXPRESSION ".*\\.(c|h)")
diff --git a/Libraries/glew-urkle-core/include/GL/glew.h b/Libraries/glew-urkle-core/include/GL/glew.h
deleted file mode 100644
index 718479f2..00000000
--- a/Libraries/glew-urkle-core/include/GL/glew.h
+++ /dev/null
@@ -1,19356 +0,0 @@
-/*
-** The OpenGL Extension Wrangler Library
-** Copyright (C) 2008-2014, Nigel Stewart <nigels[]users sourceforge net>
-** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
-** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
-** Copyright (C) 2002, Lev Povalahev
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-** * The name of the author may be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-** THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
- * Mesa 3-D graphics library
- * Version: 7.0
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
-** Copyright (c) 2007 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-#ifndef __glew_h__
-#define __glew_h__
-#define __GLEW_H__
-
-#if defined(__gl_h_) || defined(__GL_H__) || defined(_GL_H) || defined(__X_GL_H)
-#error gl.h included before glew.h
-#endif
-#if defined(__gl2_h_)
-#error gl2.h included before glew.h
-#endif
-#if defined(__gltypes_h_)
-#error gltypes.h included before glew.h
-#endif
-#if defined(__REGAL_H__)
-#error Regal.h included before glew.h
-#endif
-#if defined(__glext_h_) || defined(__GLEXT_H_)
-#error glext.h included before glew.h
-#endif
-#if defined(__gl_ATI_h_)
-#error glATI.h included before glew.h
-#endif
-
-#define __gl_h_
-#define __gl2_h_
-#define __GL_H__
-#define _GL_H
-#define __gltypes_h_
-#define __REGAL_H__
-#define __X_GL_H
-#define __glext_h_
-#define __GLEXT_H_
-#define __gl_ATI_h_
-
-#if defined(_WIN32)
-
-/*
- * GLEW does not include <windows.h> to avoid name space pollution.
- * GL needs GLAPI and GLAPIENTRY, GLU needs APIENTRY, CALLBACK, and wchar_t
- * defined properly.
- */
-/* <windef.h> and <gl.h>*/
-#ifdef APIENTRY
-# ifndef GLAPIENTRY
-# define GLAPIENTRY APIENTRY
-# endif
-# ifndef GLEWAPIENTRY
-# define GLEWAPIENTRY APIENTRY
-# endif
-#else
-#define GLEW_APIENTRY_DEFINED
-# if defined(__MINGW32__) || defined(__CYGWIN__) || (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__)
-# define APIENTRY __stdcall
-# ifndef GLAPIENTRY
-# define GLAPIENTRY __stdcall
-# endif
-# ifndef GLEWAPIENTRY
-# define GLEWAPIENTRY __stdcall
-# endif
-# else
-# define APIENTRY
-# endif
-#endif
-#ifndef GLAPI
-# if defined(__MINGW32__) || defined(__CYGWIN__)
-# define GLAPI extern
-# endif
-#endif
-/* <winnt.h> */
-#ifndef CALLBACK
-#define GLEW_CALLBACK_DEFINED
-# if defined(__MINGW32__) || defined(__CYGWIN__)
-# define CALLBACK __attribute__ ((__stdcall__))
-# elif (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
-# define CALLBACK __stdcall
-# else
-# define CALLBACK
-# endif
-#endif
-/* <wingdi.h> and <winnt.h> */
-#ifndef WINGDIAPI
-#define GLEW_WINGDIAPI_DEFINED
-#define WINGDIAPI __declspec(dllimport)
-#endif
-/* <ctype.h> */
-#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(_WCHAR_T_DEFINED)
-typedef unsigned short wchar_t;
-# define _WCHAR_T_DEFINED
-#endif
-/* <stddef.h> */
-#if !defined(_W64)
-# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && defined(_MSC_VER) && _MSC_VER >= 1300
-# define _W64 __w64
-# else
-# define _W64
-# endif
-#endif
-#if !defined(_PTRDIFF_T_DEFINED) && !defined(_PTRDIFF_T_) && !defined(__MINGW64__)
-# ifdef _WIN64
-typedef __int64 ptrdiff_t;
-# else
-typedef _W64 int ptrdiff_t;
-# endif
-# define _PTRDIFF_T_DEFINED
-# define _PTRDIFF_T_
-#endif
-
-#ifndef GLAPI
-# if defined(__MINGW32__) || defined(__CYGWIN__)
-# define GLAPI extern
-# else
-# define GLAPI WINGDIAPI
-# endif
-#endif
-
-/*
- * GLEW_STATIC is defined for static library.
- * GLEW_BUILD is defined for building the DLL library.
- */
-
-#ifdef GLEW_STATIC
-# define GLEWAPI extern
-#else
-# ifdef GLEW_BUILD
-# define GLEWAPI extern __declspec(dllexport)
-# else
-# define GLEWAPI extern __declspec(dllimport)
-# endif
-#endif
-
-#else /* _UNIX */
-
-/*
- * Needed for ptrdiff_t in turn needed by VBO. This is defined by ISO
- * C. On my system, this amounts to _3 lines_ of included code, all of
- * them pretty much harmless. If you know of a way of detecting 32 vs
- * 64 _targets_ at compile time you are free to replace this with
- * something that's portable. For now, _this_ is the portable solution.
- * (mem, 2004-01-04)
- */
-
-#include <stddef.h>
-
-/* SGI MIPSPro doesn't like stdint.h in C++ mode */
-/* ID: 3376260 Solaris 9 has inttypes.h, but not stdint.h */
-
-#if (defined(__sgi) || defined(__sun)) && !defined(__GNUC__)
-#include <inttypes.h>
-#else
-#include <stdint.h>
-#endif
-
-#define GLEW_APIENTRY_DEFINED
-#define APIENTRY
-
-/*
- * GLEW_STATIC is defined for static library.
- */
-
-#ifdef GLEW_STATIC
-# define GLEWAPI extern
-#else
-# if defined(__GNUC__) && __GNUC__>=4
-# define GLEWAPI extern __attribute__ ((visibility("default")))
-# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-# define GLEWAPI extern __global
-# else
-# define GLEWAPI extern
-# endif
-#endif
-
-/* <glu.h> */
-#ifndef GLAPI
-#define GLAPI extern
-#endif
-
-#endif /* _WIN32 */
-
-#ifndef GLAPIENTRY
-#define GLAPIENTRY
-#endif
-
-#ifndef GLEWAPIENTRY
-#define GLEWAPIENTRY
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct GLEWHashListStruct GLEWHashList;
-
-/* ----------------------------- GL_VERSION_1_1 ---------------------------- */
-
-#ifndef GL_VERSION_1_1
-#define GL_VERSION_1_1 1
-
-typedef unsigned int GLenum;
-typedef unsigned int GLbitfield;
-typedef unsigned int GLuint;
-typedef int GLint;
-typedef int GLsizei;
-typedef unsigned char GLboolean;
-typedef signed char GLbyte;
-typedef short GLshort;
-typedef unsigned char GLubyte;
-typedef unsigned short GLushort;
-typedef unsigned long GLulong;
-typedef float GLfloat;
-typedef float GLclampf;
-typedef double GLdouble;
-typedef double GLclampd;
-typedef void GLvoid;
-#if defined(_MSC_VER) && _MSC_VER < 1400
-typedef __int64 GLint64EXT;
-typedef unsigned __int64 GLuint64EXT;
-#elif defined(_MSC_VER) || defined(__BORLANDC__)
-typedef signed long long GLint64EXT;
-typedef unsigned long long GLuint64EXT;
-#else
-# if defined(__MINGW32__) || defined(__CYGWIN__)
-#include <inttypes.h>
-# endif
-typedef int64_t GLint64EXT;
-typedef uint64_t GLuint64EXT;
-#endif
-typedef GLint64EXT GLint64;
-typedef GLuint64EXT GLuint64;
-typedef struct __GLsync *GLsync;
-
-typedef char GLchar;
-
-#define GL_ZERO 0
-#define GL_FALSE 0
-#define GL_LOGIC_OP 0x0BF1
-#define GL_NONE 0
-#define GL_TEXTURE_COMPONENTS 0x1003
-#define GL_NO_ERROR 0
-#define GL_POINTS 0x0000
-#define GL_CURRENT_BIT 0x00000001
-#define GL_TRUE 1
-#define GL_ONE 1
-#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_POINT_BIT 0x00000002
-#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
-#define GL_LINE_STRIP 0x0003
-#define GL_LINE_BIT 0x00000004
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-#define GL_QUADS 0x0007
-#define GL_QUAD_STRIP 0x0008
-#define GL_POLYGON_BIT 0x00000008
-#define GL_POLYGON 0x0009
-#define GL_POLYGON_STIPPLE_BIT 0x00000010
-#define GL_PIXEL_MODE_BIT 0x00000020
-#define GL_LIGHTING_BIT 0x00000040
-#define GL_FOG_BIT 0x00000080
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_ACCUM 0x0100
-#define GL_LOAD 0x0101
-#define GL_RETURN 0x0102
-#define GL_MULT 0x0103
-#define GL_ADD 0x0104
-#define GL_NEVER 0x0200
-#define GL_ACCUM_BUFFER_BIT 0x00000200
-#define GL_LESS 0x0201
-#define GL_EQUAL 0x0202
-#define GL_LEQUAL 0x0203
-#define GL_GREATER 0x0204
-#define GL_NOTEQUAL 0x0205
-#define GL_GEQUAL 0x0206
-#define GL_ALWAYS 0x0207
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_FRONT_LEFT 0x0400
-#define GL_FRONT_RIGHT 0x0401
-#define GL_BACK_LEFT 0x0402
-#define GL_BACK_RIGHT 0x0403
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_LEFT 0x0406
-#define GL_RIGHT 0x0407
-#define GL_FRONT_AND_BACK 0x0408
-#define GL_AUX0 0x0409
-#define GL_AUX1 0x040A
-#define GL_AUX2 0x040B
-#define GL_AUX3 0x040C
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_STACK_OVERFLOW 0x0503
-#define GL_STACK_UNDERFLOW 0x0504
-#define GL_OUT_OF_MEMORY 0x0505
-#define GL_2D 0x0600
-#define GL_3D 0x0601
-#define GL_3D_COLOR 0x0602
-#define GL_3D_COLOR_TEXTURE 0x0603
-#define GL_4D_COLOR_TEXTURE 0x0604
-#define GL_PASS_THROUGH_TOKEN 0x0700
-#define GL_POINT_TOKEN 0x0701
-#define GL_LINE_TOKEN 0x0702
-#define GL_POLYGON_TOKEN 0x0703
-#define GL_BITMAP_TOKEN 0x0704
-#define GL_DRAW_PIXEL_TOKEN 0x0705
-#define GL_COPY_PIXEL_TOKEN 0x0706
-#define GL_LINE_RESET_TOKEN 0x0707
-#define GL_EXP 0x0800
-#define GL_VIEWPORT_BIT 0x00000800
-#define GL_EXP2 0x0801
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-#define GL_COEFF 0x0A00
-#define GL_ORDER 0x0A01
-#define GL_DOMAIN 0x0A02
-#define GL_CURRENT_COLOR 0x0B00
-#define GL_CURRENT_INDEX 0x0B01
-#define GL_CURRENT_NORMAL 0x0B02
-#define GL_CURRENT_TEXTURE_COORDS 0x0B03
-#define GL_CURRENT_RASTER_COLOR 0x0B04
-#define GL_CURRENT_RASTER_INDEX 0x0B05
-#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06
-#define GL_CURRENT_RASTER_POSITION 0x0B07
-#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08
-#define GL_CURRENT_RASTER_DISTANCE 0x0B09
-#define GL_POINT_SMOOTH 0x0B10
-#define GL_POINT_SIZE 0x0B11
-#define GL_POINT_SIZE_RANGE 0x0B12
-#define GL_POINT_SIZE_GRANULARITY 0x0B13
-#define GL_LINE_SMOOTH 0x0B20
-#define GL_LINE_WIDTH 0x0B21
-#define GL_LINE_WIDTH_RANGE 0x0B22
-#define GL_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_LINE_STIPPLE 0x0B24
-#define GL_LINE_STIPPLE_PATTERN 0x0B25
-#define GL_LINE_STIPPLE_REPEAT 0x0B26
-#define GL_LIST_MODE 0x0B30
-#define GL_MAX_LIST_NESTING 0x0B31
-#define GL_LIST_BASE 0x0B32
-#define GL_LIST_INDEX 0x0B33
-#define GL_POLYGON_MODE 0x0B40
-#define GL_POLYGON_SMOOTH 0x0B41
-#define GL_POLYGON_STIPPLE 0x0B42
-#define GL_EDGE_FLAG 0x0B43
-#define GL_CULL_FACE 0x0B44
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_LIGHTING 0x0B50
-#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51
-#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
-#define GL_LIGHT_MODEL_AMBIENT 0x0B53
-#define GL_SHADE_MODEL 0x0B54
-#define GL_COLOR_MATERIAL_FACE 0x0B55
-#define GL_COLOR_MATERIAL_PARAMETER 0x0B56
-#define GL_COLOR_MATERIAL 0x0B57
-#define GL_FOG 0x0B60
-#define GL_FOG_INDEX 0x0B61
-#define GL_FOG_DENSITY 0x0B62
-#define GL_FOG_START 0x0B63
-#define GL_FOG_END 0x0B64
-#define GL_FOG_MODE 0x0B65
-#define GL_FOG_COLOR 0x0B66
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_TEST 0x0B71
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_ACCUM_CLEAR_VALUE 0x0B80
-#define GL_STENCIL_TEST 0x0B90
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_MATRIX_MODE 0x0BA0
-#define GL_NORMALIZE 0x0BA1
-#define GL_VIEWPORT 0x0BA2
-#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
-#define GL_PROJECTION_STACK_DEPTH 0x0BA4
-#define GL_TEXTURE_STACK_DEPTH 0x0BA5
-#define GL_MODELVIEW_MATRIX 0x0BA6
-#define GL_PROJECTION_MATRIX 0x0BA7
-#define GL_TEXTURE_MATRIX 0x0BA8
-#define GL_ATTRIB_STACK_DEPTH 0x0BB0
-#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1
-#define GL_ALPHA_TEST 0x0BC0
-#define GL_ALPHA_TEST_FUNC 0x0BC1
-#define GL_ALPHA_TEST_REF 0x0BC2
-#define GL_DITHER 0x0BD0
-#define GL_BLEND_DST 0x0BE0
-#define GL_BLEND_SRC 0x0BE1
-#define GL_BLEND 0x0BE2
-#define GL_LOGIC_OP_MODE 0x0BF0
-#define GL_INDEX_LOGIC_OP 0x0BF1
-#define GL_COLOR_LOGIC_OP 0x0BF2
-#define GL_AUX_BUFFERS 0x0C00
-#define GL_DRAW_BUFFER 0x0C01
-#define GL_READ_BUFFER 0x0C02
-#define GL_SCISSOR_BOX 0x0C10
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_INDEX_CLEAR_VALUE 0x0C20
-#define GL_INDEX_WRITEMASK 0x0C21
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_INDEX_MODE 0x0C30
-#define GL_RGBA_MODE 0x0C31
-#define GL_DOUBLEBUFFER 0x0C32
-#define GL_STEREO 0x0C33
-#define GL_RENDER_MODE 0x0C40
-#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
-#define GL_POINT_SMOOTH_HINT 0x0C51
-#define GL_LINE_SMOOTH_HINT 0x0C52
-#define GL_POLYGON_SMOOTH_HINT 0x0C53
-#define GL_FOG_HINT 0x0C54
-#define GL_TEXTURE_GEN_S 0x0C60
-#define GL_TEXTURE_GEN_T 0x0C61
-#define GL_TEXTURE_GEN_R 0x0C62
-#define GL_TEXTURE_GEN_Q 0x0C63
-#define GL_PIXEL_MAP_I_TO_I 0x0C70
-#define GL_PIXEL_MAP_S_TO_S 0x0C71
-#define GL_PIXEL_MAP_I_TO_R 0x0C72
-#define GL_PIXEL_MAP_I_TO_G 0x0C73
-#define GL_PIXEL_MAP_I_TO_B 0x0C74
-#define GL_PIXEL_MAP_I_TO_A 0x0C75
-#define GL_PIXEL_MAP_R_TO_R 0x0C76
-#define GL_PIXEL_MAP_G_TO_G 0x0C77
-#define GL_PIXEL_MAP_B_TO_B 0x0C78
-#define GL_PIXEL_MAP_A_TO_A 0x0C79
-#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0
-#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1
-#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2
-#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3
-#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4
-#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5
-#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6
-#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7
-#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8
-#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9
-#define GL_UNPACK_SWAP_BYTES 0x0CF0
-#define GL_UNPACK_LSB_FIRST 0x0CF1
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GL_UNPACK_SKIP_ROWS 0x0CF3
-#define GL_UNPACK_SKIP_PIXELS 0x0CF4
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_SWAP_BYTES 0x0D00
-#define GL_PACK_LSB_FIRST 0x0D01
-#define GL_PACK_ROW_LENGTH 0x0D02
-#define GL_PACK_SKIP_ROWS 0x0D03
-#define GL_PACK_SKIP_PIXELS 0x0D04
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_MAP_COLOR 0x0D10
-#define GL_MAP_STENCIL 0x0D11
-#define GL_INDEX_SHIFT 0x0D12
-#define GL_INDEX_OFFSET 0x0D13
-#define GL_RED_SCALE 0x0D14
-#define GL_RED_BIAS 0x0D15
-#define GL_ZOOM_X 0x0D16
-#define GL_ZOOM_Y 0x0D17
-#define GL_GREEN_SCALE 0x0D18
-#define GL_GREEN_BIAS 0x0D19
-#define GL_BLUE_SCALE 0x0D1A
-#define GL_BLUE_BIAS 0x0D1B
-#define GL_ALPHA_SCALE 0x0D1C
-#define GL_ALPHA_BIAS 0x0D1D
-#define GL_DEPTH_SCALE 0x0D1E
-#define GL_DEPTH_BIAS 0x0D1F
-#define GL_MAX_EVAL_ORDER 0x0D30
-#define GL_MAX_LIGHTS 0x0D31
-#define GL_MAX_CLIP_PLANES 0x0D32
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_PIXEL_MAP_TABLE 0x0D34
-#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35
-#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
-#define GL_MAX_NAME_STACK_DEPTH 0x0D37
-#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
-#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_INDEX_BITS 0x0D51
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_ALPHA_BITS 0x0D55
-#define GL_DEPTH_BITS 0x0D56
-#define GL_STENCIL_BITS 0x0D57
-#define GL_ACCUM_RED_BITS 0x0D58
-#define GL_ACCUM_GREEN_BITS 0x0D59
-#define GL_ACCUM_BLUE_BITS 0x0D5A
-#define GL_ACCUM_ALPHA_BITS 0x0D5B
-#define GL_NAME_STACK_DEPTH 0x0D70
-#define GL_AUTO_NORMAL 0x0D80
-#define GL_MAP1_COLOR_4 0x0D90
-#define GL_MAP1_INDEX 0x0D91
-#define GL_MAP1_NORMAL 0x0D92
-#define GL_MAP1_TEXTURE_COORD_1 0x0D93
-#define GL_MAP1_TEXTURE_COORD_2 0x0D94
-#define GL_MAP1_TEXTURE_COORD_3 0x0D95
-#define GL_MAP1_TEXTURE_COORD_4 0x0D96
-#define GL_MAP1_VERTEX_3 0x0D97
-#define GL_MAP1_VERTEX_4 0x0D98
-#define GL_MAP2_COLOR_4 0x0DB0
-#define GL_MAP2_INDEX 0x0DB1
-#define GL_MAP2_NORMAL 0x0DB2
-#define GL_MAP2_TEXTURE_COORD_1 0x0DB3
-#define GL_MAP2_TEXTURE_COORD_2 0x0DB4
-#define GL_MAP2_TEXTURE_COORD_3 0x0DB5
-#define GL_MAP2_TEXTURE_COORD_4 0x0DB6
-#define GL_MAP2_VERTEX_3 0x0DB7
-#define GL_MAP2_VERTEX_4 0x0DB8
-#define GL_MAP1_GRID_DOMAIN 0x0DD0
-#define GL_MAP1_GRID_SEGMENTS 0x0DD1
-#define GL_MAP2_GRID_DOMAIN 0x0DD2
-#define GL_MAP2_GRID_SEGMENTS 0x0DD3
-#define GL_TEXTURE_1D 0x0DE0
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0
-#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1
-#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2
-#define GL_SELECTION_BUFFER_POINTER 0x0DF3
-#define GL_SELECTION_BUFFER_SIZE 0x0DF4
-#define GL_TEXTURE_WIDTH 0x1000
-#define GL_TRANSFORM_BIT 0x00001000
-#define GL_TEXTURE_HEIGHT 0x1001
-#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
-#define GL_TEXTURE_BORDER_COLOR 0x1004
-#define GL_TEXTURE_BORDER 0x1005
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-#define GL_AMBIENT 0x1200
-#define GL_DIFFUSE 0x1201
-#define GL_SPECULAR 0x1202
-#define GL_POSITION 0x1203
-#define GL_SPOT_DIRECTION 0x1204
-#define GL_SPOT_EXPONENT 0x1205
-#define GL_SPOT_CUTOFF 0x1206
-#define GL_CONSTANT_ATTENUATION 0x1207
-#define GL_LINEAR_ATTENUATION 0x1208
-#define GL_QUADRATIC_ATTENUATION 0x1209
-#define GL_COMPILE 0x1300
-#define GL_COMPILE_AND_EXECUTE 0x1301
-#define GL_BYTE 0x1400
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_SHORT 0x1402
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_INT 0x1404
-#define GL_UNSIGNED_INT 0x1405
-#define GL_FLOAT 0x1406
-#define GL_2_BYTES 0x1407
-#define GL_3_BYTES 0x1408
-#define GL_4_BYTES 0x1409
-#define GL_DOUBLE 0x140A
-#define GL_CLEAR 0x1500
-#define GL_AND 0x1501
-#define GL_AND_REVERSE 0x1502
-#define GL_COPY 0x1503
-#define GL_AND_INVERTED 0x1504
-#define GL_NOOP 0x1505
-#define GL_XOR 0x1506
-#define GL_OR 0x1507
-#define GL_NOR 0x1508
-#define GL_EQUIV 0x1509
-#define GL_INVERT 0x150A
-#define GL_OR_REVERSE 0x150B
-#define GL_COPY_INVERTED 0x150C
-#define GL_OR_INVERTED 0x150D
-#define GL_NAND 0x150E
-#define GL_SET 0x150F
-#define GL_EMISSION 0x1600
-#define GL_SHININESS 0x1601
-#define GL_AMBIENT_AND_DIFFUSE 0x1602
-#define GL_COLOR_INDEXES 0x1603
-#define GL_MODELVIEW 0x1700
-#define GL_PROJECTION 0x1701
-#define GL_TEXTURE 0x1702
-#define GL_COLOR 0x1800
-#define GL_DEPTH 0x1801
-#define GL_STENCIL 0x1802
-#define GL_COLOR_INDEX 0x1900
-#define GL_STENCIL_INDEX 0x1901
-#define GL_DEPTH_COMPONENT 0x1902
-#define GL_RED 0x1903
-#define GL_GREEN 0x1904
-#define GL_BLUE 0x1905
-#define GL_ALPHA 0x1906
-#define GL_RGB 0x1907
-#define GL_RGBA 0x1908
-#define GL_LUMINANCE 0x1909
-#define GL_LUMINANCE_ALPHA 0x190A
-#define GL_BITMAP 0x1A00
-#define GL_POINT 0x1B00
-#define GL_LINE 0x1B01
-#define GL_FILL 0x1B02
-#define GL_RENDER 0x1C00
-#define GL_FEEDBACK 0x1C01
-#define GL_SELECT 0x1C02
-#define GL_FLAT 0x1D00
-#define GL_SMOOTH 0x1D01
-#define GL_KEEP 0x1E00
-#define GL_REPLACE 0x1E01
-#define GL_INCR 0x1E02
-#define GL_DECR 0x1E03
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-#define GL_S 0x2000
-#define GL_ENABLE_BIT 0x00002000
-#define GL_T 0x2001
-#define GL_R 0x2002
-#define GL_Q 0x2003
-#define GL_MODULATE 0x2100
-#define GL_DECAL 0x2101
-#define GL_TEXTURE_ENV_MODE 0x2200
-#define GL_TEXTURE_ENV_COLOR 0x2201
-#define GL_TEXTURE_ENV 0x2300
-#define GL_EYE_LINEAR 0x2400
-#define GL_OBJECT_LINEAR 0x2401
-#define GL_SPHERE_MAP 0x2402
-#define GL_TEXTURE_GEN_MODE 0x2500
-#define GL_OBJECT_PLANE 0x2501
-#define GL_EYE_PLANE 0x2502
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-#define GL_CLAMP 0x2900
-#define GL_REPEAT 0x2901
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-#define GL_POLYGON_OFFSET_POINT 0x2A01
-#define GL_POLYGON_OFFSET_LINE 0x2A02
-#define GL_R3_G3_B2 0x2A10
-#define GL_V2F 0x2A20
-#define GL_V3F 0x2A21
-#define GL_C4UB_V2F 0x2A22
-#define GL_C4UB_V3F 0x2A23
-#define GL_C3F_V3F 0x2A24
-#define GL_N3F_V3F 0x2A25
-#define GL_C4F_N3F_V3F 0x2A26
-#define GL_T2F_V3F 0x2A27
-#define GL_T4F_V4F 0x2A28
-#define GL_T2F_C4UB_V3F 0x2A29
-#define GL_T2F_C3F_V3F 0x2A2A
-#define GL_T2F_N3F_V3F 0x2A2B
-#define GL_T2F_C4F_N3F_V3F 0x2A2C
-#define GL_T4F_C4F_N3F_V4F 0x2A2D
-#define GL_CLIP_PLANE0 0x3000
-#define GL_CLIP_PLANE1 0x3001
-#define GL_CLIP_PLANE2 0x3002
-#define GL_CLIP_PLANE3 0x3003
-#define GL_CLIP_PLANE4 0x3004
-#define GL_CLIP_PLANE5 0x3005
-#define GL_LIGHT0 0x4000
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_LIGHT1 0x4001
-#define GL_LIGHT2 0x4002
-#define GL_LIGHT3 0x4003
-#define GL_LIGHT4 0x4004
-#define GL_LIGHT5 0x4005
-#define GL_LIGHT6 0x4006
-#define GL_LIGHT7 0x4007
-#define GL_HINT_BIT 0x00008000
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_ALPHA4 0x803B
-#define GL_ALPHA8 0x803C
-#define GL_ALPHA12 0x803D
-#define GL_ALPHA16 0x803E
-#define GL_LUMINANCE4 0x803F
-#define GL_LUMINANCE8 0x8040
-#define GL_LUMINANCE12 0x8041
-#define GL_LUMINANCE16 0x8042
-#define GL_LUMINANCE4_ALPHA4 0x8043
-#define GL_LUMINANCE6_ALPHA2 0x8044
-#define GL_LUMINANCE8_ALPHA8 0x8045
-#define GL_LUMINANCE12_ALPHA4 0x8046
-#define GL_LUMINANCE12_ALPHA12 0x8047
-#define GL_LUMINANCE16_ALPHA16 0x8048
-#define GL_INTENSITY 0x8049
-#define GL_INTENSITY4 0x804A
-#define GL_INTENSITY8 0x804B
-#define GL_INTENSITY12 0x804C
-#define GL_INTENSITY16 0x804D
-#define GL_RGB4 0x804F
-#define GL_RGB5 0x8050
-#define GL_RGB8 0x8051
-#define GL_RGB10 0x8052
-#define GL_RGB12 0x8053
-#define GL_RGB16 0x8054
-#define GL_RGBA2 0x8055
-#define GL_RGBA4 0x8056
-#define GL_RGB5_A1 0x8057
-#define GL_RGBA8 0x8058
-#define GL_RGB10_A2 0x8059
-#define GL_RGBA12 0x805A
-#define GL_RGBA16 0x805B
-#define GL_TEXTURE_RED_SIZE 0x805C
-#define GL_TEXTURE_GREEN_SIZE 0x805D
-#define GL_TEXTURE_BLUE_SIZE 0x805E
-#define GL_TEXTURE_ALPHA_SIZE 0x805F
-#define GL_TEXTURE_LUMINANCE_SIZE 0x8060
-#define GL_TEXTURE_INTENSITY_SIZE 0x8061
-#define GL_PROXY_TEXTURE_1D 0x8063
-#define GL_PROXY_TEXTURE_2D 0x8064
-#define GL_TEXTURE_PRIORITY 0x8066
-#define GL_TEXTURE_RESIDENT 0x8067
-#define GL_TEXTURE_BINDING_1D 0x8068
-#define GL_TEXTURE_BINDING_2D 0x8069
-#define GL_VERTEX_ARRAY 0x8074
-#define GL_NORMAL_ARRAY 0x8075
-#define GL_COLOR_ARRAY 0x8076
-#define GL_INDEX_ARRAY 0x8077
-#define GL_TEXTURE_COORD_ARRAY 0x8078
-#define GL_EDGE_FLAG_ARRAY 0x8079
-#define GL_VERTEX_ARRAY_SIZE 0x807A
-#define GL_VERTEX_ARRAY_TYPE 0x807B
-#define GL_VERTEX_ARRAY_STRIDE 0x807C
-#define GL_NORMAL_ARRAY_TYPE 0x807E
-#define GL_NORMAL_ARRAY_STRIDE 0x807F
-#define GL_COLOR_ARRAY_SIZE 0x8081
-#define GL_COLOR_ARRAY_TYPE 0x8082
-#define GL_COLOR_ARRAY_STRIDE 0x8083
-#define GL_INDEX_ARRAY_TYPE 0x8085
-#define GL_INDEX_ARRAY_STRIDE 0x8086
-#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
-#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
-#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
-#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C
-#define GL_VERTEX_ARRAY_POINTER 0x808E
-#define GL_NORMAL_ARRAY_POINTER 0x808F
-#define GL_COLOR_ARRAY_POINTER 0x8090
-#define GL_INDEX_ARRAY_POINTER 0x8091
-#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
-#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093
-#define GL_COLOR_INDEX1_EXT 0x80E2
-#define GL_COLOR_INDEX2_EXT 0x80E3
-#define GL_COLOR_INDEX4_EXT 0x80E4
-#define GL_COLOR_INDEX8_EXT 0x80E5
-#define GL_COLOR_INDEX12_EXT 0x80E6
-#define GL_COLOR_INDEX16_EXT 0x80E7
-#define GL_EVAL_BIT 0x00010000
-#define GL_LIST_BIT 0x00020000
-#define GL_TEXTURE_BIT 0x00040000
-#define GL_SCISSOR_BIT 0x00080000
-#define GL_ALL_ATTRIB_BITS 0x000fffff
-#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff
-
-GLAPI void GLAPIENTRY glAccum (GLenum op, GLfloat value);
-GLAPI void GLAPIENTRY glAlphaFunc (GLenum func, GLclampf ref);
-GLAPI GLboolean GLAPIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences);
-GLAPI void GLAPIENTRY glArrayElement (GLint i);
-GLAPI void GLAPIENTRY glBegin (GLenum mode);
-GLAPI void GLAPIENTRY glBindTexture (GLenum target, GLuint texture);
-GLAPI void GLAPIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
-GLAPI void GLAPIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
-GLAPI void GLAPIENTRY glCallList (GLuint list);
-GLAPI void GLAPIENTRY glCallLists (GLsizei n, GLenum type, const void *lists);
-GLAPI void GLAPIENTRY glClear (GLbitfield mask);
-GLAPI void GLAPIENTRY glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GLAPI void GLAPIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-GLAPI void GLAPIENTRY glClearDepth (GLclampd depth);
-GLAPI void GLAPIENTRY glClearIndex (GLfloat c);
-GLAPI void GLAPIENTRY glClearStencil (GLint s);
-GLAPI void GLAPIENTRY glClipPlane (GLenum plane, const GLdouble *equation);
-GLAPI void GLAPIENTRY glColor3b (GLbyte red, GLbyte green, GLbyte blue);
-GLAPI void GLAPIENTRY glColor3bv (const GLbyte *v);
-GLAPI void GLAPIENTRY glColor3d (GLdouble red, GLdouble green, GLdouble blue);
-GLAPI void GLAPIENTRY glColor3dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glColor3f (GLfloat red, GLfloat green, GLfloat blue);
-GLAPI void GLAPIENTRY glColor3fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glColor3i (GLint red, GLint green, GLint blue);
-GLAPI void GLAPIENTRY glColor3iv (const GLint *v);
-GLAPI void GLAPIENTRY glColor3s (GLshort red, GLshort green, GLshort blue);
-GLAPI void GLAPIENTRY glColor3sv (const GLshort *v);
-GLAPI void GLAPIENTRY glColor3ub (GLubyte red, GLubyte green, GLubyte blue);
-GLAPI void GLAPIENTRY glColor3ubv (const GLubyte *v);
-GLAPI void GLAPIENTRY glColor3ui (GLuint red, GLuint green, GLuint blue);
-GLAPI void GLAPIENTRY glColor3uiv (const GLuint *v);
-GLAPI void GLAPIENTRY glColor3us (GLushort red, GLushort green, GLushort blue);
-GLAPI void GLAPIENTRY glColor3usv (const GLushort *v);
-GLAPI void GLAPIENTRY glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
-GLAPI void GLAPIENTRY glColor4bv (const GLbyte *v);
-GLAPI void GLAPIENTRY glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
-GLAPI void GLAPIENTRY glColor4dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GLAPI void GLAPIENTRY glColor4fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glColor4i (GLint red, GLint green, GLint blue, GLint alpha);
-GLAPI void GLAPIENTRY glColor4iv (const GLint *v);
-GLAPI void GLAPIENTRY glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha);
-GLAPI void GLAPIENTRY glColor4sv (const GLshort *v);
-GLAPI void GLAPIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
-GLAPI void GLAPIENTRY glColor4ubv (const GLubyte *v);
-GLAPI void GLAPIENTRY glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha);
-GLAPI void GLAPIENTRY glColor4uiv (const GLuint *v);
-GLAPI void GLAPIENTRY glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha);
-GLAPI void GLAPIENTRY glColor4usv (const GLushort *v);
-GLAPI void GLAPIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-GLAPI void GLAPIENTRY glColorMaterial (GLenum face, GLenum mode);
-GLAPI void GLAPIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void GLAPIENTRY glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
-GLAPI void GLAPIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
-GLAPI void GLAPIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GLAPI void GLAPIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-GLAPI void GLAPIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void GLAPIENTRY glCullFace (GLenum mode);
-GLAPI void GLAPIENTRY glDeleteLists (GLuint list, GLsizei range);
-GLAPI void GLAPIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
-GLAPI void GLAPIENTRY glDepthFunc (GLenum func);
-GLAPI void GLAPIENTRY glDepthMask (GLboolean flag);
-GLAPI void GLAPIENTRY glDepthRange (GLclampd zNear, GLclampd zFar);
-GLAPI void GLAPIENTRY glDisable (GLenum cap);
-GLAPI void GLAPIENTRY glDisableClientState (GLenum array);
-GLAPI void GLAPIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
-GLAPI void GLAPIENTRY glDrawBuffer (GLenum mode);
-GLAPI void GLAPIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
-GLAPI void GLAPIENTRY glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-GLAPI void GLAPIENTRY glEdgeFlag (GLboolean flag);
-GLAPI void GLAPIENTRY glEdgeFlagPointer (GLsizei stride, const void *pointer);
-GLAPI void GLAPIENTRY glEdgeFlagv (const GLboolean *flag);
-GLAPI void GLAPIENTRY glEnable (GLenum cap);
-GLAPI void GLAPIENTRY glEnableClientState (GLenum array);
-GLAPI void GLAPIENTRY glEnd (void);
-GLAPI void GLAPIENTRY glEndList (void);
-GLAPI void GLAPIENTRY glEvalCoord1d (GLdouble u);
-GLAPI void GLAPIENTRY glEvalCoord1dv (const GLdouble *u);
-GLAPI void GLAPIENTRY glEvalCoord1f (GLfloat u);
-GLAPI void GLAPIENTRY glEvalCoord1fv (const GLfloat *u);
-GLAPI void GLAPIENTRY glEvalCoord2d (GLdouble u, GLdouble v);
-GLAPI void GLAPIENTRY glEvalCoord2dv (const GLdouble *u);
-GLAPI void GLAPIENTRY glEvalCoord2f (GLfloat u, GLfloat v);
-GLAPI void GLAPIENTRY glEvalCoord2fv (const GLfloat *u);
-GLAPI void GLAPIENTRY glEvalMesh1 (GLenum mode, GLint i1, GLint i2);
-GLAPI void GLAPIENTRY glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
-GLAPI void GLAPIENTRY glEvalPoint1 (GLint i);
-GLAPI void GLAPIENTRY glEvalPoint2 (GLint i, GLint j);
-GLAPI void GLAPIENTRY glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer);
-GLAPI void GLAPIENTRY glFinish (void);
-GLAPI void GLAPIENTRY glFlush (void);
-GLAPI void GLAPIENTRY glFogf (GLenum pname, GLfloat param);
-GLAPI void GLAPIENTRY glFogfv (GLenum pname, const GLfloat *params);
-GLAPI void GLAPIENTRY glFogi (GLenum pname, GLint param);
-GLAPI void GLAPIENTRY glFogiv (GLenum pname, const GLint *params);
-GLAPI void GLAPIENTRY glFrontFace (GLenum mode);
-GLAPI void GLAPIENTRY glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-GLAPI GLuint GLAPIENTRY glGenLists (GLsizei range);
-GLAPI void GLAPIENTRY glGenTextures (GLsizei n, GLuint *textures);
-GLAPI void GLAPIENTRY glGetBooleanv (GLenum pname, GLboolean *params);
-GLAPI void GLAPIENTRY glGetClipPlane (GLenum plane, GLdouble *equation);
-GLAPI void GLAPIENTRY glGetDoublev (GLenum pname, GLdouble *params);
-GLAPI GLenum GLAPIENTRY glGetError (void);
-GLAPI void GLAPIENTRY glGetFloatv (GLenum pname, GLfloat *params);
-GLAPI void GLAPIENTRY glGetIntegerv (GLenum pname, GLint *params);
-GLAPI void GLAPIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
-GLAPI void GLAPIENTRY glGetLightiv (GLenum light, GLenum pname, GLint *params);
-GLAPI void GLAPIENTRY glGetMapdv (GLenum target, GLenum query, GLdouble *v);
-GLAPI void GLAPIENTRY glGetMapfv (GLenum target, GLenum query, GLfloat *v);
-GLAPI void GLAPIENTRY glGetMapiv (GLenum target, GLenum query, GLint *v);
-GLAPI void GLAPIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
-GLAPI void GLAPIENTRY glGetMaterialiv (GLenum face, GLenum pname, GLint *params);
-GLAPI void GLAPIENTRY glGetPixelMapfv (GLenum map, GLfloat *values);
-GLAPI void GLAPIENTRY glGetPixelMapuiv (GLenum map, GLuint *values);
-GLAPI void GLAPIENTRY glGetPixelMapusv (GLenum map, GLushort *values);
-GLAPI void GLAPIENTRY glGetPointerv (GLenum pname, void* *params);
-GLAPI void GLAPIENTRY glGetPolygonStipple (GLubyte *mask);
-GLAPI const GLubyte * GLAPIENTRY glGetString (GLenum name);
-GLAPI void GLAPIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params);
-GLAPI void GLAPIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params);
-GLAPI void GLAPIENTRY glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params);
-GLAPI void GLAPIENTRY glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params);
-GLAPI void GLAPIENTRY glGetTexGeniv (GLenum coord, GLenum pname, GLint *params);
-GLAPI void GLAPIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-GLAPI void GLAPIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);
-GLAPI void GLAPIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);
-GLAPI void GLAPIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
-GLAPI void GLAPIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
-GLAPI void GLAPIENTRY glHint (GLenum target, GLenum mode);
-GLAPI void GLAPIENTRY glIndexMask (GLuint mask);
-GLAPI void GLAPIENTRY glIndexPointer (GLenum type, GLsizei stride, const void *pointer);
-GLAPI void GLAPIENTRY glIndexd (GLdouble c);
-GLAPI void GLAPIENTRY glIndexdv (const GLdouble *c);
-GLAPI void GLAPIENTRY glIndexf (GLfloat c);
-GLAPI void GLAPIENTRY glIndexfv (const GLfloat *c);
-GLAPI void GLAPIENTRY glIndexi (GLint c);
-GLAPI void GLAPIENTRY glIndexiv (const GLint *c);
-GLAPI void GLAPIENTRY glIndexs (GLshort c);
-GLAPI void GLAPIENTRY glIndexsv (const GLshort *c);
-GLAPI void GLAPIENTRY glIndexub (GLubyte c);
-GLAPI void GLAPIENTRY glIndexubv (const GLubyte *c);
-GLAPI void GLAPIENTRY glInitNames (void);
-GLAPI void GLAPIENTRY glInterleavedArrays (GLenum format, GLsizei stride, const void *pointer);
-GLAPI GLboolean GLAPIENTRY glIsEnabled (GLenum cap);
-GLAPI GLboolean GLAPIENTRY glIsList (GLuint list);
-GLAPI GLboolean GLAPIENTRY glIsTexture (GLuint texture);
-GLAPI void GLAPIENTRY glLightModelf (GLenum pname, GLfloat param);
-GLAPI void GLAPIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
-GLAPI void GLAPIENTRY glLightModeli (GLenum pname, GLint param);
-GLAPI void GLAPIENTRY glLightModeliv (GLenum pname, const GLint *params);
-GLAPI void GLAPIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
-GLAPI void GLAPIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
-GLAPI void GLAPIENTRY glLighti (GLenum light, GLenum pname, GLint param);
-GLAPI void GLAPIENTRY glLightiv (GLenum light, GLenum pname, const GLint *params);
-GLAPI void GLAPIENTRY glLineStipple (GLint factor, GLushort pattern);
-GLAPI void GLAPIENTRY glLineWidth (GLfloat width);
-GLAPI void GLAPIENTRY glListBase (GLuint base);
-GLAPI void GLAPIENTRY glLoadIdentity (void);
-GLAPI void GLAPIENTRY glLoadMatrixd (const GLdouble *m);
-GLAPI void GLAPIENTRY glLoadMatrixf (const GLfloat *m);
-GLAPI void GLAPIENTRY glLoadName (GLuint name);
-GLAPI void GLAPIENTRY glLogicOp (GLenum opcode);
-GLAPI void GLAPIENTRY glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
-GLAPI void GLAPIENTRY glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
-GLAPI void GLAPIENTRY glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
-GLAPI void GLAPIENTRY glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
-GLAPI void GLAPIENTRY glMapGrid1d (GLint un, GLdouble u1, GLdouble u2);
-GLAPI void GLAPIENTRY glMapGrid1f (GLint un, GLfloat u1, GLfloat u2);
-GLAPI void GLAPIENTRY glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
-GLAPI void GLAPIENTRY glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
-GLAPI void GLAPIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
-GLAPI void GLAPIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
-GLAPI void GLAPIENTRY glMateriali (GLenum face, GLenum pname, GLint param);
-GLAPI void GLAPIENTRY glMaterialiv (GLenum face, GLenum pname, const GLint *params);
-GLAPI void GLAPIENTRY glMatrixMode (GLenum mode);
-GLAPI void GLAPIENTRY glMultMatrixd (const GLdouble *m);
-GLAPI void GLAPIENTRY glMultMatrixf (const GLfloat *m);
-GLAPI void GLAPIENTRY glNewList (GLuint list, GLenum mode);
-GLAPI void GLAPIENTRY glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz);
-GLAPI void GLAPIENTRY glNormal3bv (const GLbyte *v);
-GLAPI void GLAPIENTRY glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz);
-GLAPI void GLAPIENTRY glNormal3dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
-GLAPI void GLAPIENTRY glNormal3fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glNormal3i (GLint nx, GLint ny, GLint nz);
-GLAPI void GLAPIENTRY glNormal3iv (const GLint *v);
-GLAPI void GLAPIENTRY glNormal3s (GLshort nx, GLshort ny, GLshort nz);
-GLAPI void GLAPIENTRY glNormal3sv (const GLshort *v);
-GLAPI void GLAPIENTRY glNormalPointer (GLenum type, GLsizei stride, const void *pointer);
-GLAPI void GLAPIENTRY glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-GLAPI void GLAPIENTRY glPassThrough (GLfloat token);
-GLAPI void GLAPIENTRY glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values);
-GLAPI void GLAPIENTRY glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values);
-GLAPI void GLAPIENTRY glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values);
-GLAPI void GLAPIENTRY glPixelStoref (GLenum pname, GLfloat param);
-GLAPI void GLAPIENTRY glPixelStorei (GLenum pname, GLint param);
-GLAPI void GLAPIENTRY glPixelTransferf (GLenum pname, GLfloat param);
-GLAPI void GLAPIENTRY glPixelTransferi (GLenum pname, GLint param);
-GLAPI void GLAPIENTRY glPixelZoom (GLfloat xfactor, GLfloat yfactor);
-GLAPI void GLAPIENTRY glPointSize (GLfloat size);
-GLAPI void GLAPIENTRY glPolygonMode (GLenum face, GLenum mode);
-GLAPI void GLAPIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
-GLAPI void GLAPIENTRY glPolygonStipple (const GLubyte *mask);
-GLAPI void GLAPIENTRY glPopAttrib (void);
-GLAPI void GLAPIENTRY glPopClientAttrib (void);
-GLAPI void GLAPIENTRY glPopMatrix (void);
-GLAPI void GLAPIENTRY glPopName (void);
-GLAPI void GLAPIENTRY glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities);
-GLAPI void GLAPIENTRY glPushAttrib (GLbitfield mask);
-GLAPI void GLAPIENTRY glPushClientAttrib (GLbitfield mask);
-GLAPI void GLAPIENTRY glPushMatrix (void);
-GLAPI void GLAPIENTRY glPushName (GLuint name);
-GLAPI void GLAPIENTRY glRasterPos2d (GLdouble x, GLdouble y);
-GLAPI void GLAPIENTRY glRasterPos2dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glRasterPos2f (GLfloat x, GLfloat y);
-GLAPI void GLAPIENTRY glRasterPos2fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glRasterPos2i (GLint x, GLint y);
-GLAPI void GLAPIENTRY glRasterPos2iv (const GLint *v);
-GLAPI void GLAPIENTRY glRasterPos2s (GLshort x, GLshort y);
-GLAPI void GLAPIENTRY glRasterPos2sv (const GLshort *v);
-GLAPI void GLAPIENTRY glRasterPos3d (GLdouble x, GLdouble y, GLdouble z);
-GLAPI void GLAPIENTRY glRasterPos3dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glRasterPos3f (GLfloat x, GLfloat y, GLfloat z);
-GLAPI void GLAPIENTRY glRasterPos3fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glRasterPos3i (GLint x, GLint y, GLint z);
-GLAPI void GLAPIENTRY glRasterPos3iv (const GLint *v);
-GLAPI void GLAPIENTRY glRasterPos3s (GLshort x, GLshort y, GLshort z);
-GLAPI void GLAPIENTRY glRasterPos3sv (const GLshort *v);
-GLAPI void GLAPIENTRY glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void GLAPIENTRY glRasterPos4dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void GLAPIENTRY glRasterPos4fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glRasterPos4i (GLint x, GLint y, GLint z, GLint w);
-GLAPI void GLAPIENTRY glRasterPos4iv (const GLint *v);
-GLAPI void GLAPIENTRY glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w);
-GLAPI void GLAPIENTRY glRasterPos4sv (const GLshort *v);
-GLAPI void GLAPIENTRY glReadBuffer (GLenum mode);
-GLAPI void GLAPIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
-GLAPI void GLAPIENTRY glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
-GLAPI void GLAPIENTRY glRectdv (const GLdouble *v1, const GLdouble *v2);
-GLAPI void GLAPIENTRY glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
-GLAPI void GLAPIENTRY glRectfv (const GLfloat *v1, const GLfloat *v2);
-GLAPI void GLAPIENTRY glRecti (GLint x1, GLint y1, GLint x2, GLint y2);
-GLAPI void GLAPIENTRY glRectiv (const GLint *v1, const GLint *v2);
-GLAPI void GLAPIENTRY glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2);
-GLAPI void GLAPIENTRY glRectsv (const GLshort *v1, const GLshort *v2);
-GLAPI GLint GLAPIENTRY glRenderMode (GLenum mode);
-GLAPI void GLAPIENTRY glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void GLAPIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void GLAPIENTRY glScaled (GLdouble x, GLdouble y, GLdouble z);
-GLAPI void GLAPIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
-GLAPI void GLAPIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void GLAPIENTRY glSelectBuffer (GLsizei size, GLuint *buffer);
-GLAPI void GLAPIENTRY glShadeModel (GLenum mode);
-GLAPI void GLAPIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
-GLAPI void GLAPIENTRY glStencilMask (GLuint mask);
-GLAPI void GLAPIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
-GLAPI void GLAPIENTRY glTexCoord1d (GLdouble s);
-GLAPI void GLAPIENTRY glTexCoord1dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glTexCoord1f (GLfloat s);
-GLAPI void GLAPIENTRY glTexCoord1fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glTexCoord1i (GLint s);
-GLAPI void GLAPIENTRY glTexCoord1iv (const GLint *v);
-GLAPI void GLAPIENTRY glTexCoord1s (GLshort s);
-GLAPI void GLAPIENTRY glTexCoord1sv (const GLshort *v);
-GLAPI void GLAPIENTRY glTexCoord2d (GLdouble s, GLdouble t);
-GLAPI void GLAPIENTRY glTexCoord2dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glTexCoord2f (GLfloat s, GLfloat t);
-GLAPI void GLAPIENTRY glTexCoord2fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glTexCoord2i (GLint s, GLint t);
-GLAPI void GLAPIENTRY glTexCoord2iv (const GLint *v);
-GLAPI void GLAPIENTRY glTexCoord2s (GLshort s, GLshort t);
-GLAPI void GLAPIENTRY glTexCoord2sv (const GLshort *v);
-GLAPI void GLAPIENTRY glTexCoord3d (GLdouble s, GLdouble t, GLdouble r);
-GLAPI void GLAPIENTRY glTexCoord3dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glTexCoord3f (GLfloat s, GLfloat t, GLfloat r);
-GLAPI void GLAPIENTRY glTexCoord3fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glTexCoord3i (GLint s, GLint t, GLint r);
-GLAPI void GLAPIENTRY glTexCoord3iv (const GLint *v);
-GLAPI void GLAPIENTRY glTexCoord3s (GLshort s, GLshort t, GLshort r);
-GLAPI void GLAPIENTRY glTexCoord3sv (const GLshort *v);
-GLAPI void GLAPIENTRY glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-GLAPI void GLAPIENTRY glTexCoord4dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-GLAPI void GLAPIENTRY glTexCoord4fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glTexCoord4i (GLint s, GLint t, GLint r, GLint q);
-GLAPI void GLAPIENTRY glTexCoord4iv (const GLint *v);
-GLAPI void GLAPIENTRY glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q);
-GLAPI void GLAPIENTRY glTexCoord4sv (const GLshort *v);
-GLAPI void GLAPIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void GLAPIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
-GLAPI void GLAPIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void GLAPIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);
-GLAPI void GLAPIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);
-GLAPI void GLAPIENTRY glTexGend (GLenum coord, GLenum pname, GLdouble param);
-GLAPI void GLAPIENTRY glTexGendv (GLenum coord, GLenum pname, const GLdouble *params);
-GLAPI void GLAPIENTRY glTexGenf (GLenum coord, GLenum pname, GLfloat param);
-GLAPI void GLAPIENTRY glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params);
-GLAPI void GLAPIENTRY glTexGeni (GLenum coord, GLenum pname, GLint param);
-GLAPI void GLAPIENTRY glTexGeniv (GLenum coord, GLenum pname, const GLint *params);
-GLAPI void GLAPIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void GLAPIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void GLAPIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
-GLAPI void GLAPIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void GLAPIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
-GLAPI void GLAPIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
-GLAPI void GLAPIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-GLAPI void GLAPIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-GLAPI void GLAPIENTRY glTranslated (GLdouble x, GLdouble y, GLdouble z);
-GLAPI void GLAPIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
-GLAPI void GLAPIENTRY glVertex2d (GLdouble x, GLdouble y);
-GLAPI void GLAPIENTRY glVertex2dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glVertex2f (GLfloat x, GLfloat y);
-GLAPI void GLAPIENTRY glVertex2fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glVertex2i (GLint x, GLint y);
-GLAPI void GLAPIENTRY glVertex2iv (const GLint *v);
-GLAPI void GLAPIENTRY glVertex2s (GLshort x, GLshort y);
-GLAPI void GLAPIENTRY glVertex2sv (const GLshort *v);
-GLAPI void GLAPIENTRY glVertex3d (GLdouble x, GLdouble y, GLdouble z);
-GLAPI void GLAPIENTRY glVertex3dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glVertex3f (GLfloat x, GLfloat y, GLfloat z);
-GLAPI void GLAPIENTRY glVertex3fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glVertex3i (GLint x, GLint y, GLint z);
-GLAPI void GLAPIENTRY glVertex3iv (const GLint *v);
-GLAPI void GLAPIENTRY glVertex3s (GLshort x, GLshort y, GLshort z);
-GLAPI void GLAPIENTRY glVertex3sv (const GLshort *v);
-GLAPI void GLAPIENTRY glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void GLAPIENTRY glVertex4dv (const GLdouble *v);
-GLAPI void GLAPIENTRY glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void GLAPIENTRY glVertex4fv (const GLfloat *v);
-GLAPI void GLAPIENTRY glVertex4i (GLint x, GLint y, GLint z, GLint w);
-GLAPI void GLAPIENTRY glVertex4iv (const GLint *v);
-GLAPI void GLAPIENTRY glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w);
-GLAPI void GLAPIENTRY glVertex4sv (const GLshort *v);
-GLAPI void GLAPIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-
-#define GLEW_VERSION_1_1 GLEW_GET_VAR(__GLEW_VERSION_1_1)
-
-#endif /* GL_VERSION_1_1 */
-
-/* ---------------------------------- GLU ---------------------------------- */
-
-#ifndef GLEW_NO_GLU
-# ifdef __APPLE__
-# include <Availability.h>
-# if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
-# define GLEW_NO_GLU
-# endif
-# endif
-#endif
-
-#ifndef GLEW_NO_GLU
-/* this is where we can safely include GLU */
-# if defined(__APPLE__) && defined(__MACH__)
-# include <OpenGL/glu.h>
-# else
-# include <GL/glu.h>
-# endif
-#endif
-
-/* ----------------------------- GL_VERSION_1_2 ---------------------------- */
-
-#ifndef GL_VERSION_1_2
-#define GL_VERSION_1_2 1
-
-#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
-#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
-#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
-#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_UNSIGNED_BYTE_3_3_2 0x8032
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_INT_8_8_8_8 0x8035
-#define GL_UNSIGNED_INT_10_10_10_2 0x8036
-#define GL_RESCALE_NORMAL 0x803A
-#define GL_TEXTURE_BINDING_3D 0x806A
-#define GL_PACK_SKIP_IMAGES 0x806B
-#define GL_PACK_IMAGE_HEIGHT 0x806C
-#define GL_UNPACK_SKIP_IMAGES 0x806D
-#define GL_UNPACK_IMAGE_HEIGHT 0x806E
-#define GL_TEXTURE_3D 0x806F
-#define GL_PROXY_TEXTURE_3D 0x8070
-#define GL_TEXTURE_DEPTH 0x8071
-#define GL_TEXTURE_WRAP_R 0x8072
-#define GL_MAX_3D_TEXTURE_SIZE 0x8073
-#define GL_BGR 0x80E0
-#define GL_BGRA 0x80E1
-#define GL_MAX_ELEMENTS_VERTICES 0x80E8
-#define GL_MAX_ELEMENTS_INDICES 0x80E9
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_TEXTURE_MIN_LOD 0x813A
-#define GL_TEXTURE_MAX_LOD 0x813B
-#define GL_TEXTURE_BASE_LEVEL 0x813C
-#define GL_TEXTURE_MAX_LEVEL 0x813D
-#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
-#define GL_SINGLE_COLOR 0x81F9
-#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
-#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
-#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
-#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-
-typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-
-#define glCopyTexSubImage3D GLEW_GET_FUN(__glewCopyTexSubImage3D)
-#define glDrawRangeElements GLEW_GET_FUN(__glewDrawRangeElements)
-#define glTexImage3D GLEW_GET_FUN(__glewTexImage3D)
-#define glTexSubImage3D GLEW_GET_FUN(__glewTexSubImage3D)
-
-#define GLEW_VERSION_1_2 GLEW_GET_VAR(__GLEW_VERSION_1_2)
-
-#endif /* GL_VERSION_1_2 */
-
-/* ---------------------------- GL_VERSION_1_2_1 --------------------------- */
-
-#ifndef GL_VERSION_1_2_1
-#define GL_VERSION_1_2_1 1
-
-#define GLEW_VERSION_1_2_1 GLEW_GET_VAR(__GLEW_VERSION_1_2_1)
-
-#endif /* GL_VERSION_1_2_1 */
-
-/* ----------------------------- GL_VERSION_1_3 ---------------------------- */
-
-#ifndef GL_VERSION_1_3
-#define GL_VERSION_1_3 1
-
-#define GL_MULTISAMPLE 0x809D
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
-#define GL_SAMPLE_COVERAGE 0x80A0
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_CLAMP_TO_BORDER 0x812D
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-#define GL_ACTIVE_TEXTURE 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
-#define GL_MAX_TEXTURE_UNITS 0x84E2
-#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
-#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
-#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
-#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
-#define GL_SUBTRACT 0x84E7
-#define GL_COMPRESSED_ALPHA 0x84E9
-#define GL_COMPRESSED_LUMINANCE 0x84EA
-#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
-#define GL_COMPRESSED_INTENSITY 0x84EC
-#define GL_COMPRESSED_RGB 0x84ED
-#define GL_COMPRESSED_RGBA 0x84EE
-#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
-#define GL_NORMAL_MAP 0x8511
-#define GL_REFLECTION_MAP 0x8512
-#define GL_TEXTURE_CUBE_MAP 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
-#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
-#define GL_COMBINE 0x8570
-#define GL_COMBINE_RGB 0x8571
-#define GL_COMBINE_ALPHA 0x8572
-#define GL_RGB_SCALE 0x8573
-#define GL_ADD_SIGNED 0x8574
-#define GL_INTERPOLATE 0x8575
-#define GL_CONSTANT 0x8576
-#define GL_PRIMARY_COLOR 0x8577
-#define GL_PREVIOUS 0x8578
-#define GL_SOURCE0_RGB 0x8580
-#define GL_SOURCE1_RGB 0x8581
-#define GL_SOURCE2_RGB 0x8582
-#define GL_SOURCE0_ALPHA 0x8588
-#define GL_SOURCE1_ALPHA 0x8589
-#define GL_SOURCE2_ALPHA 0x858A
-#define GL_OPERAND0_RGB 0x8590
-#define GL_OPERAND1_RGB 0x8591
-#define GL_OPERAND2_RGB 0x8592
-#define GL_OPERAND0_ALPHA 0x8598
-#define GL_OPERAND1_ALPHA 0x8599
-#define GL_OPERAND2_ALPHA 0x859A
-#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
-#define GL_TEXTURE_COMPRESSED 0x86A1
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_DOT3_RGB 0x86AE
-#define GL_DOT3_RGBA 0x86AF
-#define GL_MULTISAMPLE_BIT 0x20000000
-
-typedef void (GLAPIENTRY * PFNGLACTIVETEXTUREPROC) (GLenum texture);
-typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, void *img);
-typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble m[16]);
-typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat m[16]);
-typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble m[16]);
-typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat m[16]);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v);
-typedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
-
-#define glActiveTexture GLEW_GET_FUN(__glewActiveTexture)
-#define glClientActiveTexture GLEW_GET_FUN(__glewClientActiveTexture)
-#define glCompressedTexImage1D GLEW_GET_FUN(__glewCompressedTexImage1D)
-#define glCompressedTexImage2D GLEW_GET_FUN(__glewCompressedTexImage2D)
-#define glCompressedTexImage3D GLEW_GET_FUN(__glewCompressedTexImage3D)
-#define glCompressedTexSubImage1D GLEW_GET_FUN(__glewCompressedTexSubImage1D)
-#define glCompressedTexSubImage2D GLEW_GET_FUN(__glewCompressedTexSubImage2D)
-#define glCompressedTexSubImage3D GLEW_GET_FUN(__glewCompressedTexSubImage3D)
-#define glGetCompressedTexImage GLEW_GET_FUN(__glewGetCompressedTexImage)
-#define glLoadTransposeMatrixd GLEW_GET_FUN(__glewLoadTransposeMatrixd)
-#define glLoadTransposeMatrixf GLEW_GET_FUN(__glewLoadTransposeMatrixf)
-#define glMultTransposeMatrixd GLEW_GET_FUN(__glewMultTransposeMatrixd)
-#define glMultTransposeMatrixf GLEW_GET_FUN(__glewMultTransposeMatrixf)
-#define glMultiTexCoord1d GLEW_GET_FUN(__glewMultiTexCoord1d)
-#define glMultiTexCoord1dv GLEW_GET_FUN(__glewMultiTexCoord1dv)
-#define glMultiTexCoord1f GLEW_GET_FUN(__glewMultiTexCoord1f)
-#define glMultiTexCoord1fv GLEW_GET_FUN(__glewMultiTexCoord1fv)
-#define glMultiTexCoord1i GLEW_GET_FUN(__glewMultiTexCoord1i)
-#define glMultiTexCoord1iv GLEW_GET_FUN(__glewMultiTexCoord1iv)
-#define glMultiTexCoord1s GLEW_GET_FUN(__glewMultiTexCoord1s)
-#define glMultiTexCoord1sv GLEW_GET_FUN(__glewMultiTexCoord1sv)
-#define glMultiTexCoord2d GLEW_GET_FUN(__glewMultiTexCoord2d)
-#define glMultiTexCoord2dv GLEW_GET_FUN(__glewMultiTexCoord2dv)
-#define glMultiTexCoord2f GLEW_GET_FUN(__glewMultiTexCoord2f)
-#define glMultiTexCoord2fv GLEW_GET_FUN(__glewMultiTexCoord2fv)
-#define glMultiTexCoord2i GLEW_GET_FUN(__glewMultiTexCoord2i)
-#define glMultiTexCoord2iv GLEW_GET_FUN(__glewMultiTexCoord2iv)
-#define glMultiTexCoord2s GLEW_GET_FUN(__glewMultiTexCoord2s)
-#define glMultiTexCoord2sv GLEW_GET_FUN(__glewMultiTexCoord2sv)
-#define glMultiTexCoord3d GLEW_GET_FUN(__glewMultiTexCoord3d)
-#define glMultiTexCoord3dv GLEW_GET_FUN(__glewMultiTexCoord3dv)
-#define glMultiTexCoord3f GLEW_GET_FUN(__glewMultiTexCoord3f)
-#define glMultiTexCoord3fv GLEW_GET_FUN(__glewMultiTexCoord3fv)
-#define glMultiTexCoord3i GLEW_GET_FUN(__glewMultiTexCoord3i)
-#define glMultiTexCoord3iv GLEW_GET_FUN(__glewMultiTexCoord3iv)
-#define glMultiTexCoord3s GLEW_GET_FUN(__glewMultiTexCoord3s)
-#define glMultiTexCoord3sv GLEW_GET_FUN(__glewMultiTexCoord3sv)
-#define glMultiTexCoord4d GLEW_GET_FUN(__glewMultiTexCoord4d)
-#define glMultiTexCoord4dv GLEW_GET_FUN(__glewMultiTexCoord4dv)
-#define glMultiTexCoord4f GLEW_GET_FUN(__glewMultiTexCoord4f)
-#define glMultiTexCoord4fv GLEW_GET_FUN(__glewMultiTexCoord4fv)
-#define glMultiTexCoord4i GLEW_GET_FUN(__glewMultiTexCoord4i)
-#define glMultiTexCoord4iv GLEW_GET_FUN(__glewMultiTexCoord4iv)
-#define glMultiTexCoord4s GLEW_GET_FUN(__glewMultiTexCoord4s)
-#define glMultiTexCoord4sv GLEW_GET_FUN(__glewMultiTexCoord4sv)
-#define glSampleCoverage GLEW_GET_FUN(__glewSampleCoverage)
-
-#define GLEW_VERSION_1_3 GLEW_GET_VAR(__GLEW_VERSION_1_3)
-
-#endif /* GL_VERSION_1_3 */
-
-/* ----------------------------- GL_VERSION_1_4 ---------------------------- */
-
-#ifndef GL_VERSION_1_4
-#define GL_VERSION_1_4 1
-
-#define GL_BLEND_DST_RGB 0x80C8
-#define GL_BLEND_SRC_RGB 0x80C9
-#define GL_BLEND_DST_ALPHA 0x80CA
-#define GL_BLEND_SRC_ALPHA 0x80CB
-#define GL_POINT_SIZE_MIN 0x8126
-#define GL_POINT_SIZE_MAX 0x8127
-#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
-#define GL_POINT_DISTANCE_ATTENUATION 0x8129
-#define GL_GENERATE_MIPMAP 0x8191
-#define GL_GENERATE_MIPMAP_HINT 0x8192
-#define GL_DEPTH_COMPONENT16 0x81A5
-#define GL_DEPTH_COMPONENT24 0x81A6
-#define GL_DEPTH_COMPONENT32 0x81A7
-#define GL_MIRRORED_REPEAT 0x8370
-#define GL_FOG_COORDINATE_SOURCE 0x8450
-#define GL_FOG_COORDINATE 0x8451
-#define GL_FRAGMENT_DEPTH 0x8452
-#define GL_CURRENT_FOG_COORDINATE 0x8453
-#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454
-#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455
-#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456
-#define GL_FOG_COORDINATE_ARRAY 0x8457
-#define GL_COLOR_SUM 0x8458
-#define GL_CURRENT_SECONDARY_COLOR 0x8459
-#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A
-#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B
-#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C
-#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D
-#define GL_SECONDARY_COLOR_ARRAY 0x845E
-#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
-#define GL_TEXTURE_FILTER_CONTROL 0x8500
-#define GL_TEXTURE_LOD_BIAS 0x8501
-#define GL_INCR_WRAP 0x8507
-#define GL_DECR_WRAP 0x8508
-#define GL_TEXTURE_DEPTH_SIZE 0x884A
-#define GL_DEPTH_TEXTURE_MODE 0x884B
-#define GL_TEXTURE_COMPARE_MODE 0x884C
-#define GL_TEXTURE_COMPARE_FUNC 0x884D
-#define GL_COMPARE_R_TO_TEXTURE 0x884E
-
-typedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode);
-typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const void *pointer);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDDPROC) (GLdouble coord);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDDVPROC) (const GLdouble *coord);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDFPROC) (GLfloat coord);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDFVPROC) (const GLfloat *coord);
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const* indices, GLsizei drawcount);
-typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
-typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVPROC) (const GLdouble *p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVPROC) (const GLfloat *p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IPROC) (GLint x, GLint y);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVPROC) (const GLint *p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVPROC) (const GLshort *p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVPROC) (const GLdouble *p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVPROC) (const GLfloat *p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVPROC) (const GLint *p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVPROC) (const GLshort *p);
-
-#define glBlendColor GLEW_GET_FUN(__glewBlendColor)
-#define glBlendEquation GLEW_GET_FUN(__glewBlendEquation)
-#define glBlendFuncSeparate GLEW_GET_FUN(__glewBlendFuncSeparate)
-#define glFogCoordPointer GLEW_GET_FUN(__glewFogCoordPointer)
-#define glFogCoordd GLEW_GET_FUN(__glewFogCoordd)
-#define glFogCoorddv GLEW_GET_FUN(__glewFogCoorddv)
-#define glFogCoordf GLEW_GET_FUN(__glewFogCoordf)
-#define glFogCoordfv GLEW_GET_FUN(__glewFogCoordfv)
-#define glMultiDrawArrays GLEW_GET_FUN(__glewMultiDrawArrays)
-#define glMultiDrawElements GLEW_GET_FUN(__glewMultiDrawElements)
-#define glPointParameterf GLEW_GET_FUN(__glewPointParameterf)
-#define glPointParameterfv GLEW_GET_FUN(__glewPointParameterfv)
-#define glPointParameteri GLEW_GET_FUN(__glewPointParameteri)
-#define glPointParameteriv GLEW_GET_FUN(__glewPointParameteriv)
-#define glSecondaryColor3b GLEW_GET_FUN(__glewSecondaryColor3b)
-#define glSecondaryColor3bv GLEW_GET_FUN(__glewSecondaryColor3bv)
-#define glSecondaryColor3d GLEW_GET_FUN(__glewSecondaryColor3d)
-#define glSecondaryColor3dv GLEW_GET_FUN(__glewSecondaryColor3dv)
-#define glSecondaryColor3f GLEW_GET_FUN(__glewSecondaryColor3f)
-#define glSecondaryColor3fv GLEW_GET_FUN(__glewSecondaryColor3fv)
-#define glSecondaryColor3i GLEW_GET_FUN(__glewSecondaryColor3i)
-#define glSecondaryColor3iv GLEW_GET_FUN(__glewSecondaryColor3iv)
-#define glSecondaryColor3s GLEW_GET_FUN(__glewSecondaryColor3s)
-#define glSecondaryColor3sv GLEW_GET_FUN(__glewSecondaryColor3sv)
-#define glSecondaryColor3ub GLEW_GET_FUN(__glewSecondaryColor3ub)
-#define glSecondaryColor3ubv GLEW_GET_FUN(__glewSecondaryColor3ubv)
-#define glSecondaryColor3ui GLEW_GET_FUN(__glewSecondaryColor3ui)
-#define glSecondaryColor3uiv GLEW_GET_FUN(__glewSecondaryColor3uiv)
-#define glSecondaryColor3us GLEW_GET_FUN(__glewSecondaryColor3us)
-#define glSecondaryColor3usv GLEW_GET_FUN(__glewSecondaryColor3usv)
-#define glSecondaryColorPointer GLEW_GET_FUN(__glewSecondaryColorPointer)
-#define glWindowPos2d GLEW_GET_FUN(__glewWindowPos2d)
-#define glWindowPos2dv GLEW_GET_FUN(__glewWindowPos2dv)
-#define glWindowPos2f GLEW_GET_FUN(__glewWindowPos2f)
-#define glWindowPos2fv GLEW_GET_FUN(__glewWindowPos2fv)
-#define glWindowPos2i GLEW_GET_FUN(__glewWindowPos2i)
-#define glWindowPos2iv GLEW_GET_FUN(__glewWindowPos2iv)
-#define glWindowPos2s GLEW_GET_FUN(__glewWindowPos2s)
-#define glWindowPos2sv GLEW_GET_FUN(__glewWindowPos2sv)
-#define glWindowPos3d GLEW_GET_FUN(__glewWindowPos3d)
-#define glWindowPos3dv GLEW_GET_FUN(__glewWindowPos3dv)
-#define glWindowPos3f GLEW_GET_FUN(__glewWindowPos3f)
-#define glWindowPos3fv GLEW_GET_FUN(__glewWindowPos3fv)
-#define glWindowPos3i GLEW_GET_FUN(__glewWindowPos3i)
-#define glWindowPos3iv GLEW_GET_FUN(__glewWindowPos3iv)
-#define glWindowPos3s GLEW_GET_FUN(__glewWindowPos3s)
-#define glWindowPos3sv GLEW_GET_FUN(__glewWindowPos3sv)
-
-#define GLEW_VERSION_1_4 GLEW_GET_VAR(__GLEW_VERSION_1_4)
-
-#endif /* GL_VERSION_1_4 */
-
-/* ----------------------------- GL_VERSION_1_5 ---------------------------- */
-
-#ifndef GL_VERSION_1_5
-#define GL_VERSION_1_5 1
-
-#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE
-#define GL_FOG_COORD GL_FOG_COORDINATE
-#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY
-#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING
-#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER
-#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE
-#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE
-#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE
-#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA
-#define GL_SRC0_RGB GL_SOURCE0_RGB
-#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA
-#define GL_SRC1_RGB GL_SOURCE1_RGB
-#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA
-#define GL_SRC2_RGB GL_SOURCE2_RGB
-#define GL_BUFFER_SIZE 0x8764
-#define GL_BUFFER_USAGE 0x8765
-#define GL_QUERY_COUNTER_BITS 0x8864
-#define GL_CURRENT_QUERY 0x8865
-#define GL_QUERY_RESULT 0x8866
-#define GL_QUERY_RESULT_AVAILABLE 0x8867
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-#define GL_ARRAY_BUFFER_BINDING 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
-#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
-#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
-#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899
-#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
-#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B
-#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C
-#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D
-#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E
-#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
-#define GL_READ_ONLY 0x88B8
-#define GL_WRITE_ONLY 0x88B9
-#define GL_READ_WRITE 0x88BA
-#define GL_BUFFER_ACCESS 0x88BB
-#define GL_BUFFER_MAPPED 0x88BC
-#define GL_BUFFER_MAP_POINTER 0x88BD
-#define GL_STREAM_DRAW 0x88E0
-#define GL_STREAM_READ 0x88E1
-#define GL_STREAM_COPY 0x88E2
-#define GL_STATIC_DRAW 0x88E4
-#define GL_STATIC_READ 0x88E5
-#define GL_STATIC_COPY 0x88E6
-#define GL_DYNAMIC_DRAW 0x88E8
-#define GL_DYNAMIC_READ 0x88E9
-#define GL_DYNAMIC_COPY 0x88EA
-#define GL_SAMPLES_PASSED 0x8914
-
-typedef ptrdiff_t GLintptr;
-typedef ptrdiff_t GLsizeiptr;
-
-typedef void (GLAPIENTRY * PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
-typedef void (GLAPIENTRY * PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void* data, GLenum usage);
-typedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
-typedef void (GLAPIENTRY * PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint* buffers);
-typedef void (GLAPIENTRY * PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLENDQUERYPROC) (GLenum target);
-typedef void (GLAPIENTRY * PFNGLGENBUFFERSPROC) (GLsizei n, GLuint* buffers);
-typedef void (GLAPIENTRY * PFNGLGENQUERIESPROC) (GLsizei n, GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void** params);
-typedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void* data);
-typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISBUFFERPROC) (GLuint buffer);
-typedef GLboolean (GLAPIENTRY * PFNGLISQUERYPROC) (GLuint id);
-typedef void* (GLAPIENTRY * PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);
-typedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERPROC) (GLenum target);
-
-#define glBeginQuery GLEW_GET_FUN(__glewBeginQuery)
-#define glBindBuffer GLEW_GET_FUN(__glewBindBuffer)
-#define glBufferData GLEW_GET_FUN(__glewBufferData)
-#define glBufferSubData GLEW_GET_FUN(__glewBufferSubData)
-#define glDeleteBuffers GLEW_GET_FUN(__glewDeleteBuffers)
-#define glDeleteQueries GLEW_GET_FUN(__glewDeleteQueries)
-#define glEndQuery GLEW_GET_FUN(__glewEndQuery)
-#define glGenBuffers GLEW_GET_FUN(__glewGenBuffers)
-#define glGenQueries GLEW_GET_FUN(__glewGenQueries)
-#define glGetBufferParameteriv GLEW_GET_FUN(__glewGetBufferParameteriv)
-#define glGetBufferPointerv GLEW_GET_FUN(__glewGetBufferPointerv)
-#define glGetBufferSubData GLEW_GET_FUN(__glewGetBufferSubData)
-#define glGetQueryObjectiv GLEW_GET_FUN(__glewGetQueryObjectiv)
-#define glGetQueryObjectuiv GLEW_GET_FUN(__glewGetQueryObjectuiv)
-#define glGetQueryiv GLEW_GET_FUN(__glewGetQueryiv)
-#define glIsBuffer GLEW_GET_FUN(__glewIsBuffer)
-#define glIsQuery GLEW_GET_FUN(__glewIsQuery)
-#define glMapBuffer GLEW_GET_FUN(__glewMapBuffer)
-#define glUnmapBuffer GLEW_GET_FUN(__glewUnmapBuffer)
-
-#define GLEW_VERSION_1_5 GLEW_GET_VAR(__GLEW_VERSION_1_5)
-
-#endif /* GL_VERSION_1_5 */
-
-/* ----------------------------- GL_VERSION_2_0 ---------------------------- */
-
-#ifndef GL_VERSION_2_0
-#define GL_VERSION_2_0 1
-
-#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION
-#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
-#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
-#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
-#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
-#define GL_CURRENT_VERTEX_ATTRIB 0x8626
-#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
-#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
-#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
-#define GL_STENCIL_BACK_FUNC 0x8800
-#define GL_STENCIL_BACK_FAIL 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
-#define GL_MAX_DRAW_BUFFERS 0x8824
-#define GL_DRAW_BUFFER0 0x8825
-#define GL_DRAW_BUFFER1 0x8826
-#define GL_DRAW_BUFFER2 0x8827
-#define GL_DRAW_BUFFER3 0x8828
-#define GL_DRAW_BUFFER4 0x8829
-#define GL_DRAW_BUFFER5 0x882A
-#define GL_DRAW_BUFFER6 0x882B
-#define GL_DRAW_BUFFER7 0x882C
-#define GL_DRAW_BUFFER8 0x882D
-#define GL_DRAW_BUFFER9 0x882E
-#define GL_DRAW_BUFFER10 0x882F
-#define GL_DRAW_BUFFER11 0x8830
-#define GL_DRAW_BUFFER12 0x8831
-#define GL_DRAW_BUFFER13 0x8832
-#define GL_DRAW_BUFFER14 0x8833
-#define GL_DRAW_BUFFER15 0x8834
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_POINT_SPRITE 0x8861
-#define GL_COORD_REPLACE 0x8862
-#define GL_MAX_VERTEX_ATTRIBS 0x8869
-#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
-#define GL_MAX_TEXTURE_COORDS 0x8871
-#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
-#define GL_FRAGMENT_SHADER 0x8B30
-#define GL_VERTEX_SHADER 0x8B31
-#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
-#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
-#define GL_MAX_VARYING_FLOATS 0x8B4B
-#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
-#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
-#define GL_SHADER_TYPE 0x8B4F
-#define GL_FLOAT_VEC2 0x8B50
-#define GL_FLOAT_VEC3 0x8B51
-#define GL_FLOAT_VEC4 0x8B52
-#define GL_INT_VEC2 0x8B53
-#define GL_INT_VEC3 0x8B54
-#define GL_INT_VEC4 0x8B55
-#define GL_BOOL 0x8B56
-#define GL_BOOL_VEC2 0x8B57
-#define GL_BOOL_VEC3 0x8B58
-#define GL_BOOL_VEC4 0x8B59
-#define GL_FLOAT_MAT2 0x8B5A
-#define GL_FLOAT_MAT3 0x8B5B
-#define GL_FLOAT_MAT4 0x8B5C
-#define GL_SAMPLER_1D 0x8B5D
-#define GL_SAMPLER_2D 0x8B5E
-#define GL_SAMPLER_3D 0x8B5F
-#define GL_SAMPLER_CUBE 0x8B60
-#define GL_SAMPLER_1D_SHADOW 0x8B61
-#define GL_SAMPLER_2D_SHADOW 0x8B62
-#define GL_DELETE_STATUS 0x8B80
-#define GL_COMPILE_STATUS 0x8B81
-#define GL_LINK_STATUS 0x8B82
-#define GL_VALIDATE_STATUS 0x8B83
-#define GL_INFO_LOG_LENGTH 0x8B84
-#define GL_ATTACHED_SHADERS 0x8B85
-#define GL_ACTIVE_UNIFORMS 0x8B86
-#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
-#define GL_SHADER_SOURCE_LENGTH 0x8B88
-#define GL_ACTIVE_ATTRIBUTES 0x8B89
-#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
-#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
-#define GL_CURRENT_PROGRAM 0x8B8D
-#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0
-#define GL_LOWER_LEFT 0x8CA1
-#define GL_UPPER_LEFT 0x8CA2
-#define GL_STENCIL_BACK_REF 0x8CA3
-#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
-#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
-
-typedef void (GLAPIENTRY * PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
-typedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar* name);
-typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
-typedef void (GLAPIENTRY * PFNGLCOMPILESHADERPROC) (GLuint shader);
-typedef GLuint (GLAPIENTRY * PFNGLCREATEPROGRAMPROC) (void);
-typedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROC) (GLenum type);
-typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPROC) (GLuint program);
-typedef void (GLAPIENTRY * PFNGLDELETESHADERPROC) (GLuint shader);
-typedef void (GLAPIENTRY * PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
-typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
-typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum* bufs);
-typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
-typedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
-typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
-typedef void (GLAPIENTRY * PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders);
-typedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar* name);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint* param);
-typedef void (GLAPIENTRY * PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog);
-typedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEPROC) (GLuint obj, GLsizei maxLength, GLsizei* length, GLchar* source);
-typedef void (GLAPIENTRY * PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint* param);
-typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar* name);
-typedef void (GLAPIENTRY * PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void** pointer);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPROC) (GLuint program);
-typedef GLboolean (GLAPIENTRY * PFNGLISSHADERPROC) (GLuint shader);
-typedef void (GLAPIENTRY * PFNGLLINKPROGRAMPROC) (GLuint program);
-typedef void (GLAPIENTRY * PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const* string, const GLint* length);
-typedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-typedef void (GLAPIENTRY * PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
-typedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUSEPROGRAMPROC) (GLuint program);
-typedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPROC) (GLuint program);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer);
-
-#define glAttachShader GLEW_GET_FUN(__glewAttachShader)
-#define glBindAttribLocation GLEW_GET_FUN(__glewBindAttribLocation)
-#define glBlendEquationSeparate GLEW_GET_FUN(__glewBlendEquationSeparate)
-#define glCompileShader GLEW_GET_FUN(__glewCompileShader)
-#define glCreateProgram GLEW_GET_FUN(__glewCreateProgram)
-#define glCreateShader GLEW_GET_FUN(__glewCreateShader)
-#define glDeleteProgram GLEW_GET_FUN(__glewDeleteProgram)
-#define glDeleteShader GLEW_GET_FUN(__glewDeleteShader)
-#define glDetachShader GLEW_GET_FUN(__glewDetachShader)
-#define glDisableVertexAttribArray GLEW_GET_FUN(__glewDisableVertexAttribArray)
-#define glDrawBuffers GLEW_GET_FUN(__glewDrawBuffers)
-#define glEnableVertexAttribArray GLEW_GET_FUN(__glewEnableVertexAttribArray)
-#define glGetActiveAttrib GLEW_GET_FUN(__glewGetActiveAttrib)
-#define glGetActiveUniform GLEW_GET_FUN(__glewGetActiveUniform)
-#define glGetAttachedShaders GLEW_GET_FUN(__glewGetAttachedShaders)
-#define glGetAttribLocation GLEW_GET_FUN(__glewGetAttribLocation)
-#define glGetProgramInfoLog GLEW_GET_FUN(__glewGetProgramInfoLog)
-#define glGetProgramiv GLEW_GET_FUN(__glewGetProgramiv)
-#define glGetShaderInfoLog GLEW_GET_FUN(__glewGetShaderInfoLog)
-#define glGetShaderSource GLEW_GET_FUN(__glewGetShaderSource)
-#define glGetShaderiv GLEW_GET_FUN(__glewGetShaderiv)
-#define glGetUniformLocation GLEW_GET_FUN(__glewGetUniformLocation)
-#define glGetUniformfv GLEW_GET_FUN(__glewGetUniformfv)
-#define glGetUniformiv GLEW_GET_FUN(__glewGetUniformiv)
-#define glGetVertexAttribPointerv GLEW_GET_FUN(__glewGetVertexAttribPointerv)
-#define glGetVertexAttribdv GLEW_GET_FUN(__glewGetVertexAttribdv)
-#define glGetVertexAttribfv GLEW_GET_FUN(__glewGetVertexAttribfv)
-#define glGetVertexAttribiv GLEW_GET_FUN(__glewGetVertexAttribiv)
-#define glIsProgram GLEW_GET_FUN(__glewIsProgram)
-#define glIsShader GLEW_GET_FUN(__glewIsShader)
-#define glLinkProgram GLEW_GET_FUN(__glewLinkProgram)
-#define glShaderSource GLEW_GET_FUN(__glewShaderSource)
-#define glStencilFuncSeparate GLEW_GET_FUN(__glewStencilFuncSeparate)
-#define glStencilMaskSeparate GLEW_GET_FUN(__glewStencilMaskSeparate)
-#define glStencilOpSeparate GLEW_GET_FUN(__glewStencilOpSeparate)
-#define glUniform1f GLEW_GET_FUN(__glewUniform1f)
-#define glUniform1fv GLEW_GET_FUN(__glewUniform1fv)
-#define glUniform1i GLEW_GET_FUN(__glewUniform1i)
-#define glUniform1iv GLEW_GET_FUN(__glewUniform1iv)
-#define glUniform2f GLEW_GET_FUN(__glewUniform2f)
-#define glUniform2fv GLEW_GET_FUN(__glewUniform2fv)
-#define glUniform2i GLEW_GET_FUN(__glewUniform2i)
-#define glUniform2iv GLEW_GET_FUN(__glewUniform2iv)
-#define glUniform3f GLEW_GET_FUN(__glewUniform3f)
-#define glUniform3fv GLEW_GET_FUN(__glewUniform3fv)
-#define glUniform3i GLEW_GET_FUN(__glewUniform3i)
-#define glUniform3iv GLEW_GET_FUN(__glewUniform3iv)
-#define glUniform4f GLEW_GET_FUN(__glewUniform4f)
-#define glUniform4fv GLEW_GET_FUN(__glewUniform4fv)
-#define glUniform4i GLEW_GET_FUN(__glewUniform4i)
-#define glUniform4iv GLEW_GET_FUN(__glewUniform4iv)
-#define glUniformMatrix2fv GLEW_GET_FUN(__glewUniformMatrix2fv)
-#define glUniformMatrix3fv GLEW_GET_FUN(__glewUniformMatrix3fv)
-#define glUniformMatrix4fv GLEW_GET_FUN(__glewUniformMatrix4fv)
-#define glUseProgram GLEW_GET_FUN(__glewUseProgram)
-#define glValidateProgram GLEW_GET_FUN(__glewValidateProgram)
-#define glVertexAttrib1d GLEW_GET_FUN(__glewVertexAttrib1d)
-#define glVertexAttrib1dv GLEW_GET_FUN(__glewVertexAttrib1dv)
-#define glVertexAttrib1f GLEW_GET_FUN(__glewVertexAttrib1f)
-#define glVertexAttrib1fv GLEW_GET_FUN(__glewVertexAttrib1fv)
-#define glVertexAttrib1s GLEW_GET_FUN(__glewVertexAttrib1s)
-#define glVertexAttrib1sv GLEW_GET_FUN(__glewVertexAttrib1sv)
-#define glVertexAttrib2d GLEW_GET_FUN(__glewVertexAttrib2d)
-#define glVertexAttrib2dv GLEW_GET_FUN(__glewVertexAttrib2dv)
-#define glVertexAttrib2f GLEW_GET_FUN(__glewVertexAttrib2f)
-#define glVertexAttrib2fv GLEW_GET_FUN(__glewVertexAttrib2fv)
-#define glVertexAttrib2s GLEW_GET_FUN(__glewVertexAttrib2s)
-#define glVertexAttrib2sv GLEW_GET_FUN(__glewVertexAttrib2sv)
-#define glVertexAttrib3d GLEW_GET_FUN(__glewVertexAttrib3d)
-#define glVertexAttrib3dv GLEW_GET_FUN(__glewVertexAttrib3dv)
-#define glVertexAttrib3f GLEW_GET_FUN(__glewVertexAttrib3f)
-#define glVertexAttrib3fv GLEW_GET_FUN(__glewVertexAttrib3fv)
-#define glVertexAttrib3s GLEW_GET_FUN(__glewVertexAttrib3s)
-#define glVertexAttrib3sv GLEW_GET_FUN(__glewVertexAttrib3sv)
-#define glVertexAttrib4Nbv GLEW_GET_FUN(__glewVertexAttrib4Nbv)
-#define glVertexAttrib4Niv GLEW_GET_FUN(__glewVertexAttrib4Niv)
-#define glVertexAttrib4Nsv GLEW_GET_FUN(__glewVertexAttrib4Nsv)
-#define glVertexAttrib4Nub GLEW_GET_FUN(__glewVertexAttrib4Nub)
-#define glVertexAttrib4Nubv GLEW_GET_FUN(__glewVertexAttrib4Nubv)
-#define glVertexAttrib4Nuiv GLEW_GET_FUN(__glewVertexAttrib4Nuiv)
-#define glVertexAttrib4Nusv GLEW_GET_FUN(__glewVertexAttrib4Nusv)
-#define glVertexAttrib4bv GLEW_GET_FUN(__glewVertexAttrib4bv)
-#define glVertexAttrib4d GLEW_GET_FUN(__glewVertexAttrib4d)
-#define glVertexAttrib4dv GLEW_GET_FUN(__glewVertexAttrib4dv)
-#define glVertexAttrib4f GLEW_GET_FUN(__glewVertexAttrib4f)
-#define glVertexAttrib4fv GLEW_GET_FUN(__glewVertexAttrib4fv)
-#define glVertexAttrib4iv GLEW_GET_FUN(__glewVertexAttrib4iv)
-#define glVertexAttrib4s GLEW_GET_FUN(__glewVertexAttrib4s)
-#define glVertexAttrib4sv GLEW_GET_FUN(__glewVertexAttrib4sv)
-#define glVertexAttrib4ubv GLEW_GET_FUN(__glewVertexAttrib4ubv)
-#define glVertexAttrib4uiv GLEW_GET_FUN(__glewVertexAttrib4uiv)
-#define glVertexAttrib4usv GLEW_GET_FUN(__glewVertexAttrib4usv)
-#define glVertexAttribPointer GLEW_GET_FUN(__glewVertexAttribPointer)
-
-#define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0)
-
-#endif /* GL_VERSION_2_0 */
-
-/* ----------------------------- GL_VERSION_2_1 ---------------------------- */
-
-#ifndef GL_VERSION_2_1
-#define GL_VERSION_2_1 1
-
-#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F
-#define GL_PIXEL_PACK_BUFFER 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
-#define GL_FLOAT_MAT2x3 0x8B65
-#define GL_FLOAT_MAT2x4 0x8B66
-#define GL_FLOAT_MAT3x2 0x8B67
-#define GL_FLOAT_MAT3x4 0x8B68
-#define GL_FLOAT_MAT4x2 0x8B69
-#define GL_FLOAT_MAT4x3 0x8B6A
-#define GL_SRGB 0x8C40
-#define GL_SRGB8 0x8C41
-#define GL_SRGB_ALPHA 0x8C42
-#define GL_SRGB8_ALPHA8 0x8C43
-#define GL_SLUMINANCE_ALPHA 0x8C44
-#define GL_SLUMINANCE8_ALPHA8 0x8C45
-#define GL_SLUMINANCE 0x8C46
-#define GL_SLUMINANCE8 0x8C47
-#define GL_COMPRESSED_SRGB 0x8C48
-#define GL_COMPRESSED_SRGB_ALPHA 0x8C49
-#define GL_COMPRESSED_SLUMINANCE 0x8C4A
-#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B
-
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
-#define glUniformMatrix2x3fv GLEW_GET_FUN(__glewUniformMatrix2x3fv)
-#define glUniformMatrix2x4fv GLEW_GET_FUN(__glewUniformMatrix2x4fv)
-#define glUniformMatrix3x2fv GLEW_GET_FUN(__glewUniformMatrix3x2fv)
-#define glUniformMatrix3x4fv GLEW_GET_FUN(__glewUniformMatrix3x4fv)
-#define glUniformMatrix4x2fv GLEW_GET_FUN(__glewUniformMatrix4x2fv)
-#define glUniformMatrix4x3fv GLEW_GET_FUN(__glewUniformMatrix4x3fv)
-
-#define GLEW_VERSION_2_1 GLEW_GET_VAR(__GLEW_VERSION_2_1)
-
-#endif /* GL_VERSION_2_1 */
-
-/* ----------------------------- GL_VERSION_3_0 ---------------------------- */
-
-#ifndef GL_VERSION_3_0
-#define GL_VERSION_3_0 1
-
-#define GL_CLIP_DISTANCE0 GL_CLIP_PLANE0
-#define GL_CLIP_DISTANCE1 GL_CLIP_PLANE1
-#define GL_CLIP_DISTANCE2 GL_CLIP_PLANE2
-#define GL_CLIP_DISTANCE3 GL_CLIP_PLANE3
-#define GL_CLIP_DISTANCE4 GL_CLIP_PLANE4
-#define GL_CLIP_DISTANCE5 GL_CLIP_PLANE5
-#define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_R_TO_TEXTURE_ARB
-#define GL_MAX_CLIP_DISTANCES GL_MAX_CLIP_PLANES
-#define GL_MAX_VARYING_COMPONENTS GL_MAX_VARYING_FLOATS
-#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001
-#define GL_MAJOR_VERSION 0x821B
-#define GL_MINOR_VERSION 0x821C
-#define GL_NUM_EXTENSIONS 0x821D
-#define GL_CONTEXT_FLAGS 0x821E
-#define GL_DEPTH_BUFFER 0x8223
-#define GL_STENCIL_BUFFER 0x8224
-#define GL_RGBA32F 0x8814
-#define GL_RGB32F 0x8815
-#define GL_RGBA16F 0x881A
-#define GL_RGB16F 0x881B
-#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
-#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
-#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
-#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
-#define GL_CLAMP_VERTEX_COLOR 0x891A
-#define GL_CLAMP_FRAGMENT_COLOR 0x891B
-#define GL_CLAMP_READ_COLOR 0x891C
-#define GL_FIXED_ONLY 0x891D
-#define GL_TEXTURE_RED_TYPE 0x8C10
-#define GL_TEXTURE_GREEN_TYPE 0x8C11
-#define GL_TEXTURE_BLUE_TYPE 0x8C12
-#define GL_TEXTURE_ALPHA_TYPE 0x8C13
-#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14
-#define GL_TEXTURE_INTENSITY_TYPE 0x8C15
-#define GL_TEXTURE_DEPTH_TYPE 0x8C16
-#define GL_TEXTURE_1D_ARRAY 0x8C18
-#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19
-#define GL_TEXTURE_2D_ARRAY 0x8C1A
-#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B
-#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C
-#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
-#define GL_R11F_G11F_B10F 0x8C3A
-#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
-#define GL_RGB9_E5 0x8C3D
-#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
-#define GL_TEXTURE_SHARED_SIZE 0x8C3F
-#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
-#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
-#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
-#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
-#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
-#define GL_PRIMITIVES_GENERATED 0x8C87
-#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
-#define GL_RASTERIZER_DISCARD 0x8C89
-#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
-#define GL_INTERLEAVED_ATTRIBS 0x8C8C
-#define GL_SEPARATE_ATTRIBS 0x8C8D
-#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
-#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
-#define GL_RGBA32UI 0x8D70
-#define GL_RGB32UI 0x8D71
-#define GL_RGBA16UI 0x8D76
-#define GL_RGB16UI 0x8D77
-#define GL_RGBA8UI 0x8D7C
-#define GL_RGB8UI 0x8D7D
-#define GL_RGBA32I 0x8D82
-#define GL_RGB32I 0x8D83
-#define GL_RGBA16I 0x8D88
-#define GL_RGB16I 0x8D89
-#define GL_RGBA8I 0x8D8E
-#define GL_RGB8I 0x8D8F
-#define GL_RED_INTEGER 0x8D94
-#define GL_GREEN_INTEGER 0x8D95
-#define GL_BLUE_INTEGER 0x8D96
-#define GL_ALPHA_INTEGER 0x8D97
-#define GL_RGB_INTEGER 0x8D98
-#define GL_RGBA_INTEGER 0x8D99
-#define GL_BGR_INTEGER 0x8D9A
-#define GL_BGRA_INTEGER 0x8D9B
-#define GL_SAMPLER_1D_ARRAY 0x8DC0
-#define GL_SAMPLER_2D_ARRAY 0x8DC1
-#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3
-#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
-#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
-#define GL_UNSIGNED_INT_VEC2 0x8DC6
-#define GL_UNSIGNED_INT_VEC3 0x8DC7
-#define GL_UNSIGNED_INT_VEC4 0x8DC8
-#define GL_INT_SAMPLER_1D 0x8DC9
-#define GL_INT_SAMPLER_2D 0x8DCA
-#define GL_INT_SAMPLER_3D 0x8DCB
-#define GL_INT_SAMPLER_CUBE 0x8DCC
-#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE
-#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
-#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1
-#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
-#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
-#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
-#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6
-#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
-#define GL_QUERY_WAIT 0x8E13
-#define GL_QUERY_NO_WAIT 0x8E14
-#define GL_QUERY_BY_REGION_WAIT 0x8E15
-#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16
-
-typedef void (GLAPIENTRY * PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode);
-typedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
-typedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint colorNumber, const GLchar* name);
-typedef void (GLAPIENTRY * PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp);
-typedef void (GLAPIENTRY * PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil);
-typedef void (GLAPIENTRY * PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawBuffer, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawBuffer, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawBuffer, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLCOLORMASKIPROC) (GLuint buf, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-typedef void (GLAPIENTRY * PFNGLDISABLEIPROC) (GLenum cap, GLuint index);
-typedef void (GLAPIENTRY * PFNGLENABLEIPROC) (GLenum cap, GLuint index);
-typedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERPROC) (void);
-typedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKPROC) (void);
-typedef void (GLAPIENTRY * PFNGLGETBOOLEANI_VPROC) (GLenum pname, GLuint index, GLboolean* data);
-typedef GLint (GLAPIENTRY * PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar* name);
-typedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
-typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name);
-typedef void (GLAPIENTRY * PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISENABLEDIPROC) (GLenum cap, GLuint index);
-typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint* params);
-typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint* v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint* v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint v0, GLint v1);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint* v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint v0, GLuint v1);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint* v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint v0, GLint v1, GLint v2);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint* v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint v0, GLuint v1, GLuint v2);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint* v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte* v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint* v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort* v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte* v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint* v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort* v0);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void*pointer);
-
-#define glBeginConditionalRender GLEW_GET_FUN(__glewBeginConditionalRender)
-#define glBeginTransformFeedback GLEW_GET_FUN(__glewBeginTransformFeedback)
-#define glBindFragDataLocation GLEW_GET_FUN(__glewBindFragDataLocation)
-#define glClampColor GLEW_GET_FUN(__glewClampColor)
-#define glClearBufferfi GLEW_GET_FUN(__glewClearBufferfi)
-#define glClearBufferfv GLEW_GET_FUN(__glewClearBufferfv)
-#define glClearBufferiv GLEW_GET_FUN(__glewClearBufferiv)
-#define glClearBufferuiv GLEW_GET_FUN(__glewClearBufferuiv)
-#define glColorMaski GLEW_GET_FUN(__glewColorMaski)
-#define glDisablei GLEW_GET_FUN(__glewDisablei)
-#define glEnablei GLEW_GET_FUN(__glewEnablei)
-#define glEndConditionalRender GLEW_GET_FUN(__glewEndConditionalRender)
-#define glEndTransformFeedback GLEW_GET_FUN(__glewEndTransformFeedback)
-#define glGetBooleani_v GLEW_GET_FUN(__glewGetBooleani_v)
-#define glGetFragDataLocation GLEW_GET_FUN(__glewGetFragDataLocation)
-#define glGetStringi GLEW_GET_FUN(__glewGetStringi)
-#define glGetTexParameterIiv GLEW_GET_FUN(__glewGetTexParameterIiv)
-#define glGetTexParameterIuiv GLEW_GET_FUN(__glewGetTexParameterIuiv)
-#define glGetTransformFeedbackVarying GLEW_GET_FUN(__glewGetTransformFeedbackVarying)
-#define glGetUniformuiv GLEW_GET_FUN(__glewGetUniformuiv)
-#define glGetVertexAttribIiv GLEW_GET_FUN(__glewGetVertexAttribIiv)
-#define glGetVertexAttribIuiv GLEW_GET_FUN(__glewGetVertexAttribIuiv)
-#define glIsEnabledi GLEW_GET_FUN(__glewIsEnabledi)
-#define glTexParameterIiv GLEW_GET_FUN(__glewTexParameterIiv)
-#define glTexParameterIuiv GLEW_GET_FUN(__glewTexParameterIuiv)
-#define glTransformFeedbackVaryings GLEW_GET_FUN(__glewTransformFeedbackVaryings)
-#define glUniform1ui GLEW_GET_FUN(__glewUniform1ui)
-#define glUniform1uiv GLEW_GET_FUN(__glewUniform1uiv)
-#define glUniform2ui GLEW_GET_FUN(__glewUniform2ui)
-#define glUniform2uiv GLEW_GET_FUN(__glewUniform2uiv)
-#define glUniform3ui GLEW_GET_FUN(__glewUniform3ui)
-#define glUniform3uiv GLEW_GET_FUN(__glewUniform3uiv)
-#define glUniform4ui GLEW_GET_FUN(__glewUniform4ui)
-#define glUniform4uiv GLEW_GET_FUN(__glewUniform4uiv)
-#define glVertexAttribI1i GLEW_GET_FUN(__glewVertexAttribI1i)
-#define glVertexAttribI1iv GLEW_GET_FUN(__glewVertexAttribI1iv)
-#define glVertexAttribI1ui GLEW_GET_FUN(__glewVertexAttribI1ui)
-#define glVertexAttribI1uiv GLEW_GET_FUN(__glewVertexAttribI1uiv)
-#define glVertexAttribI2i GLEW_GET_FUN(__glewVertexAttribI2i)
-#define glVertexAttribI2iv GLEW_GET_FUN(__glewVertexAttribI2iv)
-#define glVertexAttribI2ui GLEW_GET_FUN(__glewVertexAttribI2ui)
-#define glVertexAttribI2uiv GLEW_GET_FUN(__glewVertexAttribI2uiv)
-#define glVertexAttribI3i GLEW_GET_FUN(__glewVertexAttribI3i)
-#define glVertexAttribI3iv GLEW_GET_FUN(__glewVertexAttribI3iv)
-#define glVertexAttribI3ui GLEW_GET_FUN(__glewVertexAttribI3ui)
-#define glVertexAttribI3uiv GLEW_GET_FUN(__glewVertexAttribI3uiv)
-#define glVertexAttribI4bv GLEW_GET_FUN(__glewVertexAttribI4bv)
-#define glVertexAttribI4i GLEW_GET_FUN(__glewVertexAttribI4i)
-#define glVertexAttribI4iv GLEW_GET_FUN(__glewVertexAttribI4iv)
-#define glVertexAttribI4sv GLEW_GET_FUN(__glewVertexAttribI4sv)
-#define glVertexAttribI4ubv GLEW_GET_FUN(__glewVertexAttribI4ubv)
-#define glVertexAttribI4ui GLEW_GET_FUN(__glewVertexAttribI4ui)
-#define glVertexAttribI4uiv GLEW_GET_FUN(__glewVertexAttribI4uiv)
-#define glVertexAttribI4usv GLEW_GET_FUN(__glewVertexAttribI4usv)
-#define glVertexAttribIPointer GLEW_GET_FUN(__glewVertexAttribIPointer)
-
-#define GLEW_VERSION_3_0 GLEW_GET_VAR(__GLEW_VERSION_3_0)
-
-#endif /* GL_VERSION_3_0 */
-
-/* ----------------------------- GL_VERSION_3_1 ---------------------------- */
-
-#ifndef GL_VERSION_3_1
-#define GL_VERSION_3_1 1
-
-#define GL_TEXTURE_RECTANGLE 0x84F5
-#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6
-#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7
-#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8
-#define GL_SAMPLER_2D_RECT 0x8B63
-#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64
-#define GL_TEXTURE_BUFFER 0x8C2A
-#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B
-#define GL_TEXTURE_BINDING_BUFFER 0x8C2C
-#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
-#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E
-#define GL_SAMPLER_BUFFER 0x8DC2
-#define GL_INT_SAMPLER_2D_RECT 0x8DCD
-#define GL_INT_SAMPLER_BUFFER 0x8DD0
-#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5
-#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8
-#define GL_RED_SNORM 0x8F90
-#define GL_RG_SNORM 0x8F91
-#define GL_RGB_SNORM 0x8F92
-#define GL_RGBA_SNORM 0x8F93
-#define GL_R8_SNORM 0x8F94
-#define GL_RG8_SNORM 0x8F95
-#define GL_RGB8_SNORM 0x8F96
-#define GL_RGBA8_SNORM 0x8F97
-#define GL_R16_SNORM 0x8F98
-#define GL_RG16_SNORM 0x8F99
-#define GL_RGB16_SNORM 0x8F9A
-#define GL_RGBA16_SNORM 0x8F9B
-#define GL_SIGNED_NORMALIZED 0x8F9C
-#define GL_PRIMITIVE_RESTART 0x8F9D
-#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E
-#define GL_BUFFER_ACCESS_FLAGS 0x911F
-#define GL_BUFFER_MAP_LENGTH 0x9120
-#define GL_BUFFER_MAP_OFFSET 0x9121
-
-typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount);
-typedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalFormat, GLuint buffer);
-
-#define glDrawArraysInstanced GLEW_GET_FUN(__glewDrawArraysInstanced)
-#define glDrawElementsInstanced GLEW_GET_FUN(__glewDrawElementsInstanced)
-#define glPrimitiveRestartIndex GLEW_GET_FUN(__glewPrimitiveRestartIndex)
-#define glTexBuffer GLEW_GET_FUN(__glewTexBuffer)
-
-#define GLEW_VERSION_3_1 GLEW_GET_VAR(__GLEW_VERSION_3_1)
-
-#endif /* GL_VERSION_3_1 */
-
-/* ----------------------------- GL_VERSION_3_2 ---------------------------- */
-
-#ifndef GL_VERSION_3_2
-#define GL_VERSION_3_2 1
-
-#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
-#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
-#define GL_LINES_ADJACENCY 0x000A
-#define GL_LINE_STRIP_ADJACENCY 0x000B
-#define GL_TRIANGLES_ADJACENCY 0x000C
-#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D
-#define GL_PROGRAM_POINT_SIZE 0x8642
-#define GL_GEOMETRY_VERTICES_OUT 0x8916
-#define GL_GEOMETRY_INPUT_TYPE 0x8917
-#define GL_GEOMETRY_OUTPUT_TYPE 0x8918
-#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29
-#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8
-#define GL_GEOMETRY_SHADER 0x8DD9
-#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF
-#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0
-#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1
-#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
-#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123
-#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124
-#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
-#define GL_CONTEXT_PROFILE_MASK 0x9126
-
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
-typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum value, GLint64 * data);
-typedef void (GLAPIENTRY * PFNGLGETINTEGER64I_VPROC) (GLenum pname, GLuint index, GLint64 * data);
-
-#define glFramebufferTexture GLEW_GET_FUN(__glewFramebufferTexture)
-#define glGetBufferParameteri64v GLEW_GET_FUN(__glewGetBufferParameteri64v)
-#define glGetInteger64i_v GLEW_GET_FUN(__glewGetInteger64i_v)
-
-#define GLEW_VERSION_3_2 GLEW_GET_VAR(__GLEW_VERSION_3_2)
-
-#endif /* GL_VERSION_3_2 */
-
-/* ----------------------------- GL_VERSION_3_3 ---------------------------- */
-
-#ifndef GL_VERSION_3_3
-#define GL_VERSION_3_3 1
-
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
-#define GL_RGB10_A2UI 0x906F
-
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
-
-#define glVertexAttribDivisor GLEW_GET_FUN(__glewVertexAttribDivisor)
-
-#define GLEW_VERSION_3_3 GLEW_GET_VAR(__GLEW_VERSION_3_3)
-
-#endif /* GL_VERSION_3_3 */
-
-/* ----------------------------- GL_VERSION_4_0 ---------------------------- */
-
-#ifndef GL_VERSION_4_0
-#define GL_VERSION_4_0 1
-
-#define GL_SAMPLE_SHADING 0x8C36
-#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37
-#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS 0x8F9F
-#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
-#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A
-#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B
-#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C
-#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D
-#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E
-#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F
-
-typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);
-typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-typedef void (GLAPIENTRY * PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);
-typedef void (GLAPIENTRY * PFNGLMINSAMPLESHADINGPROC) (GLclampf value);
-
-#define glBlendEquationSeparatei GLEW_GET_FUN(__glewBlendEquationSeparatei)
-#define glBlendEquationi GLEW_GET_FUN(__glewBlendEquationi)
-#define glBlendFuncSeparatei GLEW_GET_FUN(__glewBlendFuncSeparatei)
-#define glBlendFunci GLEW_GET_FUN(__glewBlendFunci)
-#define glMinSampleShading GLEW_GET_FUN(__glewMinSampleShading)
-
-#define GLEW_VERSION_4_0 GLEW_GET_VAR(__GLEW_VERSION_4_0)
-
-#endif /* GL_VERSION_4_0 */
-
-/* ----------------------------- GL_VERSION_4_1 ---------------------------- */
-
-#ifndef GL_VERSION_4_1
-#define GL_VERSION_4_1 1
-
-#define GLEW_VERSION_4_1 GLEW_GET_VAR(__GLEW_VERSION_4_1)
-
-#endif /* GL_VERSION_4_1 */
-
-/* ----------------------------- GL_VERSION_4_2 ---------------------------- */
-
-#ifndef GL_VERSION_4_2
-#define GL_VERSION_4_2 1
-
-#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C
-#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D
-#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E
-#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F
-
-#define GLEW_VERSION_4_2 GLEW_GET_VAR(__GLEW_VERSION_4_2)
-
-#endif /* GL_VERSION_4_2 */
-
-/* ----------------------------- GL_VERSION_4_3 ---------------------------- */
-
-#ifndef GL_VERSION_4_3
-#define GL_VERSION_4_3 1
-
-#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9
-#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E
-
-#define GLEW_VERSION_4_3 GLEW_GET_VAR(__GLEW_VERSION_4_3)
-
-#endif /* GL_VERSION_4_3 */
-
-/* ----------------------------- GL_VERSION_4_4 ---------------------------- */
-
-#ifndef GL_VERSION_4_4
-#define GL_VERSION_4_4 1
-
-#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
-#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5
-#define GL_TEXTURE_BUFFER_BINDING 0x8C2A
-
-#define GLEW_VERSION_4_4 GLEW_GET_VAR(__GLEW_VERSION_4_4)
-
-#endif /* GL_VERSION_4_4 */
-
-/* ----------------------------- GL_VERSION_4_5 ---------------------------- */
-
-#ifndef GL_VERSION_4_5
-#define GL_VERSION_4_5 1
-
-#define GLEW_VERSION_4_5 GLEW_GET_VAR(__GLEW_VERSION_4_5)
-
-#endif /* GL_VERSION_4_5 */
-
-/* -------------------------- GL_3DFX_multisample -------------------------- */
-
-#ifndef GL_3DFX_multisample
-#define GL_3DFX_multisample 1
-
-#define GL_MULTISAMPLE_3DFX 0x86B2
-#define GL_SAMPLE_BUFFERS_3DFX 0x86B3
-#define GL_SAMPLES_3DFX 0x86B4
-#define GL_MULTISAMPLE_BIT_3DFX 0x20000000
-
-#define GLEW_3DFX_multisample GLEW_GET_VAR(__GLEW_3DFX_multisample)
-
-#endif /* GL_3DFX_multisample */
-
-/* ---------------------------- GL_3DFX_tbuffer ---------------------------- */
-
-#ifndef GL_3DFX_tbuffer
-#define GL_3DFX_tbuffer 1
-
-typedef void (GLAPIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask);
-
-#define glTbufferMask3DFX GLEW_GET_FUN(__glewTbufferMask3DFX)
-
-#define GLEW_3DFX_tbuffer GLEW_GET_VAR(__GLEW_3DFX_tbuffer)
-
-#endif /* GL_3DFX_tbuffer */
-
-/* -------------------- GL_3DFX_texture_compression_FXT1 ------------------- */
-
-#ifndef GL_3DFX_texture_compression_FXT1
-#define GL_3DFX_texture_compression_FXT1 1
-
-#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0
-#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1
-
-#define GLEW_3DFX_texture_compression_FXT1 GLEW_GET_VAR(__GLEW_3DFX_texture_compression_FXT1)
-
-#endif /* GL_3DFX_texture_compression_FXT1 */
-
-/* ----------------------- GL_AMD_blend_minmax_factor ---------------------- */
-
-#ifndef GL_AMD_blend_minmax_factor
-#define GL_AMD_blend_minmax_factor 1
-
-#define GL_FACTOR_MIN_AMD 0x901C
-#define GL_FACTOR_MAX_AMD 0x901D
-
-#define GLEW_AMD_blend_minmax_factor GLEW_GET_VAR(__GLEW_AMD_blend_minmax_factor)
-
-#endif /* GL_AMD_blend_minmax_factor */
-
-/* ----------------------- GL_AMD_conservative_depth ----------------------- */
-
-#ifndef GL_AMD_conservative_depth
-#define GL_AMD_conservative_depth 1
-
-#define GLEW_AMD_conservative_depth GLEW_GET_VAR(__GLEW_AMD_conservative_depth)
-
-#endif /* GL_AMD_conservative_depth */
-
-/* -------------------------- GL_AMD_debug_output -------------------------- */
-
-#ifndef GL_AMD_debug_output
-#define GL_AMD_debug_output 1
-
-#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143
-#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144
-#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145
-#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146
-#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147
-#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148
-#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149
-#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A
-#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B
-#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C
-#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D
-#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E
-#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F
-#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150
-
-typedef void (GLAPIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, void* userParam);
-
-typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void *userParam);
-typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);
-typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar* buf);
-typedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum* categories, GLuint* severities, GLuint* ids, GLsizei* lengths, GLchar* message);
-
-#define glDebugMessageCallbackAMD GLEW_GET_FUN(__glewDebugMessageCallbackAMD)
-#define glDebugMessageEnableAMD GLEW_GET_FUN(__glewDebugMessageEnableAMD)
-#define glDebugMessageInsertAMD GLEW_GET_FUN(__glewDebugMessageInsertAMD)
-#define glGetDebugMessageLogAMD GLEW_GET_FUN(__glewGetDebugMessageLogAMD)
-
-#define GLEW_AMD_debug_output GLEW_GET_VAR(__GLEW_AMD_debug_output)
-
-#endif /* GL_AMD_debug_output */
-
-/* ---------------------- GL_AMD_depth_clamp_separate ---------------------- */
-
-#ifndef GL_AMD_depth_clamp_separate
-#define GL_AMD_depth_clamp_separate 1
-
-#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E
-#define GL_DEPTH_CLAMP_FAR_AMD 0x901F
-
-#define GLEW_AMD_depth_clamp_separate GLEW_GET_VAR(__GLEW_AMD_depth_clamp_separate)
-
-#endif /* GL_AMD_depth_clamp_separate */
-
-/* ----------------------- GL_AMD_draw_buffers_blend ----------------------- */
-
-#ifndef GL_AMD_draw_buffers_blend
-#define GL_AMD_draw_buffers_blend 1
-
-typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode);
-typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-typedef void (GLAPIENTRY * PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst);
-typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-
-#define glBlendEquationIndexedAMD GLEW_GET_FUN(__glewBlendEquationIndexedAMD)
-#define glBlendEquationSeparateIndexedAMD GLEW_GET_FUN(__glewBlendEquationSeparateIndexedAMD)
-#define glBlendFuncIndexedAMD GLEW_GET_FUN(__glewBlendFuncIndexedAMD)
-#define glBlendFuncSeparateIndexedAMD GLEW_GET_FUN(__glewBlendFuncSeparateIndexedAMD)
-
-#define GLEW_AMD_draw_buffers_blend GLEW_GET_VAR(__GLEW_AMD_draw_buffers_blend)
-
-#endif /* GL_AMD_draw_buffers_blend */
-
-/* --------------------------- GL_AMD_gcn_shader --------------------------- */
-
-#ifndef GL_AMD_gcn_shader
-#define GL_AMD_gcn_shader 1
-
-#define GLEW_AMD_gcn_shader GLEW_GET_VAR(__GLEW_AMD_gcn_shader)
-
-#endif /* GL_AMD_gcn_shader */
-
-/* ------------------------ GL_AMD_gpu_shader_int64 ------------------------ */
-
-#ifndef GL_AMD_gpu_shader_int64
-#define GL_AMD_gpu_shader_int64 1
-
-#define GLEW_AMD_gpu_shader_int64 GLEW_GET_VAR(__GLEW_AMD_gpu_shader_int64)
-
-#endif /* GL_AMD_gpu_shader_int64 */
-
-/* ---------------------- GL_AMD_interleaved_elements ---------------------- */
-
-#ifndef GL_AMD_interleaved_elements
-#define GL_AMD_interleaved_elements 1
-
-#define GL_RED 0x1903
-#define GL_GREEN 0x1904
-#define GL_BLUE 0x1905
-#define GL_ALPHA 0x1906
-#define GL_RG8UI 0x8238
-#define GL_RG16UI 0x823A
-#define GL_RGBA8UI 0x8D7C
-#define GL_VERTEX_ELEMENT_SWIZZLE_AMD 0x91A4
-#define GL_VERTEX_ID_SWIZZLE_AMD 0x91A5
-
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPARAMETERIAMDPROC) (GLuint index, GLenum pname, GLint param);
-
-#define glVertexAttribParameteriAMD GLEW_GET_FUN(__glewVertexAttribParameteriAMD)
-
-#define GLEW_AMD_interleaved_elements GLEW_GET_VAR(__GLEW_AMD_interleaved_elements)
-
-#endif /* GL_AMD_interleaved_elements */
-
-/* ----------------------- GL_AMD_multi_draw_indirect ---------------------- */
-
-#ifndef GL_AMD_multi_draw_indirect
-#define GL_AMD_multi_draw_indirect 1
-
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride);
-
-#define glMultiDrawArraysIndirectAMD GLEW_GET_FUN(__glewMultiDrawArraysIndirectAMD)
-#define glMultiDrawElementsIndirectAMD GLEW_GET_FUN(__glewMultiDrawElementsIndirectAMD)
-
-#define GLEW_AMD_multi_draw_indirect GLEW_GET_VAR(__GLEW_AMD_multi_draw_indirect)
-
-#endif /* GL_AMD_multi_draw_indirect */
-
-/* ------------------------- GL_AMD_name_gen_delete ------------------------ */
-
-#ifndef GL_AMD_name_gen_delete
-#define GL_AMD_name_gen_delete 1
-
-#define GL_DATA_BUFFER_AMD 0x9151
-#define GL_PERFORMANCE_MONITOR_AMD 0x9152
-#define GL_QUERY_OBJECT_AMD 0x9153
-#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154
-#define GL_SAMPLER_OBJECT_AMD 0x9155
-
-typedef void (GLAPIENTRY * PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint* names);
-typedef void (GLAPIENTRY * PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint* names);
-typedef GLboolean (GLAPIENTRY * PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name);
-
-#define glDeleteNamesAMD GLEW_GET_FUN(__glewDeleteNamesAMD)
-#define glGenNamesAMD GLEW_GET_FUN(__glewGenNamesAMD)
-#define glIsNameAMD GLEW_GET_FUN(__glewIsNameAMD)
-
-#define GLEW_AMD_name_gen_delete GLEW_GET_VAR(__GLEW_AMD_name_gen_delete)
-
-#endif /* GL_AMD_name_gen_delete */
-
-/* ---------------------- GL_AMD_occlusion_query_event --------------------- */
-
-#ifndef GL_AMD_occlusion_query_event
-#define GL_AMD_occlusion_query_event 1
-
-#define GL_QUERY_DEPTH_PASS_EVENT_BIT_AMD 0x00000001
-#define GL_QUERY_DEPTH_FAIL_EVENT_BIT_AMD 0x00000002
-#define GL_QUERY_STENCIL_FAIL_EVENT_BIT_AMD 0x00000004
-#define GL_QUERY_DEPTH_BOUNDS_FAIL_EVENT_BIT_AMD 0x00000008
-#define GL_OCCLUSION_QUERY_EVENT_MASK_AMD 0x874F
-#define GL_QUERY_ALL_EVENT_BITS_AMD 0xFFFFFFFF
-
-typedef void (GLAPIENTRY * PFNGLQUERYOBJECTPARAMETERUIAMDPROC) (GLenum target, GLuint id, GLenum pname, GLuint param);
-
-#define glQueryObjectParameteruiAMD GLEW_GET_FUN(__glewQueryObjectParameteruiAMD)
-
-#define GLEW_AMD_occlusion_query_event GLEW_GET_VAR(__GLEW_AMD_occlusion_query_event)
-
-#endif /* GL_AMD_occlusion_query_event */
-
-/* ----------------------- GL_AMD_performance_monitor ---------------------- */
-
-#ifndef GL_AMD_performance_monitor
-#define GL_AMD_performance_monitor 1
-
-#define GL_COUNTER_TYPE_AMD 0x8BC0
-#define GL_COUNTER_RANGE_AMD 0x8BC1
-#define GL_UNSIGNED_INT64_AMD 0x8BC2
-#define GL_PERCENTAGE_AMD 0x8BC3
-#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
-#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
-#define GL_PERFMON_RESULT_AMD 0x8BC6
-
-typedef void (GLAPIENTRY * PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
-typedef void (GLAPIENTRY * PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint* monitors);
-typedef void (GLAPIENTRY * PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
-typedef void (GLAPIENTRY * PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint* monitors);
-typedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint* data, GLint *bytesWritten);
-typedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
-typedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei* length, GLchar *counterString);
-typedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint* numCounters, GLint *maxActiveCounters, GLsizei countersSize, GLuint *counters);
-typedef void (GLAPIENTRY * PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei* length, GLchar *groupString);
-typedef void (GLAPIENTRY * PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint* numGroups, GLsizei groupsSize, GLuint *groups);
-typedef void (GLAPIENTRY * PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint* counterList);
-
-#define glBeginPerfMonitorAMD GLEW_GET_FUN(__glewBeginPerfMonitorAMD)
-#define glDeletePerfMonitorsAMD GLEW_GET_FUN(__glewDeletePerfMonitorsAMD)
-#define glEndPerfMonitorAMD GLEW_GET_FUN(__glewEndPerfMonitorAMD)
-#define glGenPerfMonitorsAMD GLEW_GET_FUN(__glewGenPerfMonitorsAMD)
-#define glGetPerfMonitorCounterDataAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterDataAMD)
-#define glGetPerfMonitorCounterInfoAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterInfoAMD)
-#define glGetPerfMonitorCounterStringAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterStringAMD)
-#define glGetPerfMonitorCountersAMD GLEW_GET_FUN(__glewGetPerfMonitorCountersAMD)
-#define glGetPerfMonitorGroupStringAMD GLEW_GET_FUN(__glewGetPerfMonitorGroupStringAMD)
-#define glGetPerfMonitorGroupsAMD GLEW_GET_FUN(__glewGetPerfMonitorGroupsAMD)
-#define glSelectPerfMonitorCountersAMD GLEW_GET_FUN(__glewSelectPerfMonitorCountersAMD)
-
-#define GLEW_AMD_performance_monitor GLEW_GET_VAR(__GLEW_AMD_performance_monitor)
-
-#endif /* GL_AMD_performance_monitor */
-
-/* -------------------------- GL_AMD_pinned_memory ------------------------- */
-
-#ifndef GL_AMD_pinned_memory
-#define GL_AMD_pinned_memory 1
-
-#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160
-
-#define GLEW_AMD_pinned_memory GLEW_GET_VAR(__GLEW_AMD_pinned_memory)
-
-#endif /* GL_AMD_pinned_memory */
-
-/* ----------------------- GL_AMD_query_buffer_object ---------------------- */
-
-#ifndef GL_AMD_query_buffer_object
-#define GL_AMD_query_buffer_object 1
-
-#define GL_QUERY_BUFFER_AMD 0x9192
-#define GL_QUERY_BUFFER_BINDING_AMD 0x9193
-#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194
-
-#define GLEW_AMD_query_buffer_object GLEW_GET_VAR(__GLEW_AMD_query_buffer_object)
-
-#endif /* GL_AMD_query_buffer_object */
-
-/* ------------------------ GL_AMD_sample_positions ------------------------ */
-
-#ifndef GL_AMD_sample_positions
-#define GL_AMD_sample_positions 1
-
-#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F
-
-typedef void (GLAPIENTRY * PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat* val);
-
-#define glSetMultisamplefvAMD GLEW_GET_FUN(__glewSetMultisamplefvAMD)
-
-#define GLEW_AMD_sample_positions GLEW_GET_VAR(__GLEW_AMD_sample_positions)
-
-#endif /* GL_AMD_sample_positions */
-
-/* ------------------ GL_AMD_seamless_cubemap_per_texture ------------------ */
-
-#ifndef GL_AMD_seamless_cubemap_per_texture
-#define GL_AMD_seamless_cubemap_per_texture 1
-
-#define GL_TEXTURE_CUBE_MAP_SEAMLESS_ARB 0x884F
-
-#define GLEW_AMD_seamless_cubemap_per_texture GLEW_GET_VAR(__GLEW_AMD_seamless_cubemap_per_texture)
-
-#endif /* GL_AMD_seamless_cubemap_per_texture */
-
-/* -------------------- GL_AMD_shader_atomic_counter_ops ------------------- */
-
-#ifndef GL_AMD_shader_atomic_counter_ops
-#define GL_AMD_shader_atomic_counter_ops 1
-
-#define GLEW_AMD_shader_atomic_counter_ops GLEW_GET_VAR(__GLEW_AMD_shader_atomic_counter_ops)
-
-#endif /* GL_AMD_shader_atomic_counter_ops */
-
-/* ---------------------- GL_AMD_shader_stencil_export --------------------- */
-
-#ifndef GL_AMD_shader_stencil_export
-#define GL_AMD_shader_stencil_export 1
-
-#define GLEW_AMD_shader_stencil_export GLEW_GET_VAR(__GLEW_AMD_shader_stencil_export)
-
-#endif /* GL_AMD_shader_stencil_export */
-
-/* ------------------- GL_AMD_shader_stencil_value_export ------------------ */
-
-#ifndef GL_AMD_shader_stencil_value_export
-#define GL_AMD_shader_stencil_value_export 1
-
-#define GLEW_AMD_shader_stencil_value_export GLEW_GET_VAR(__GLEW_AMD_shader_stencil_value_export)
-
-#endif /* GL_AMD_shader_stencil_value_export */
-
-/* ---------------------- GL_AMD_shader_trinary_minmax --------------------- */
-
-#ifndef GL_AMD_shader_trinary_minmax
-#define GL_AMD_shader_trinary_minmax 1
-
-#define GLEW_AMD_shader_trinary_minmax GLEW_GET_VAR(__GLEW_AMD_shader_trinary_minmax)
-
-#endif /* GL_AMD_shader_trinary_minmax */
-
-/* ------------------------- GL_AMD_sparse_texture ------------------------- */
-
-#ifndef GL_AMD_sparse_texture
-#define GL_AMD_sparse_texture 1
-
-#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001
-#define GL_VIRTUAL_PAGE_SIZE_X_AMD 0x9195
-#define GL_VIRTUAL_PAGE_SIZE_Y_AMD 0x9196
-#define GL_VIRTUAL_PAGE_SIZE_Z_AMD 0x9197
-#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD 0x9198
-#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199
-#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A
-#define GL_MIN_SPARSE_LEVEL_AMD 0x919B
-#define GL_MIN_LOD_WARNING_AMD 0x919C
-
-typedef void (GLAPIENTRY * PFNGLTEXSTORAGESPARSEAMDPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
-typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGESPARSEAMDPROC) (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
-
-#define glTexStorageSparseAMD GLEW_GET_FUN(__glewTexStorageSparseAMD)
-#define glTextureStorageSparseAMD GLEW_GET_FUN(__glewTextureStorageSparseAMD)
-
-#define GLEW_AMD_sparse_texture GLEW_GET_VAR(__GLEW_AMD_sparse_texture)
-
-#endif /* GL_AMD_sparse_texture */
-
-/* ------------------- GL_AMD_stencil_operation_extended ------------------- */
-
-#ifndef GL_AMD_stencil_operation_extended
-#define GL_AMD_stencil_operation_extended 1
-
-#define GL_SET_AMD 0x874A
-#define GL_REPLACE_VALUE_AMD 0x874B
-#define GL_STENCIL_OP_VALUE_AMD 0x874C
-#define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D
-
-typedef void (GLAPIENTRY * PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value);
-
-#define glStencilOpValueAMD GLEW_GET_FUN(__glewStencilOpValueAMD)
-
-#define GLEW_AMD_stencil_operation_extended GLEW_GET_VAR(__GLEW_AMD_stencil_operation_extended)
-
-#endif /* GL_AMD_stencil_operation_extended */
-
-/* ------------------------ GL_AMD_texture_texture4 ------------------------ */
-
-#ifndef GL_AMD_texture_texture4
-#define GL_AMD_texture_texture4 1
-
-#define GLEW_AMD_texture_texture4 GLEW_GET_VAR(__GLEW_AMD_texture_texture4)
-
-#endif /* GL_AMD_texture_texture4 */
-
-/* --------------- GL_AMD_transform_feedback3_lines_triangles -------------- */
-
-#ifndef GL_AMD_transform_feedback3_lines_triangles
-#define GL_AMD_transform_feedback3_lines_triangles 1
-
-#define GLEW_AMD_transform_feedback3_lines_triangles GLEW_GET_VAR(__GLEW_AMD_transform_feedback3_lines_triangles)
-
-#endif /* GL_AMD_transform_feedback3_lines_triangles */
-
-/* ----------------------- GL_AMD_transform_feedback4 ---------------------- */
-
-#ifndef GL_AMD_transform_feedback4
-#define GL_AMD_transform_feedback4 1
-
-#define GL_STREAM_RASTERIZATION_AMD 0x91A0
-
-#define GLEW_AMD_transform_feedback4 GLEW_GET_VAR(__GLEW_AMD_transform_feedback4)
-
-#endif /* GL_AMD_transform_feedback4 */
-
-/* ----------------------- GL_AMD_vertex_shader_layer ---------------------- */
-
-#ifndef GL_AMD_vertex_shader_layer
-#define GL_AMD_vertex_shader_layer 1
-
-#define GLEW_AMD_vertex_shader_layer GLEW_GET_VAR(__GLEW_AMD_vertex_shader_layer)
-
-#endif /* GL_AMD_vertex_shader_layer */
-
-/* -------------------- GL_AMD_vertex_shader_tessellator ------------------- */
-
-#ifndef GL_AMD_vertex_shader_tessellator
-#define GL_AMD_vertex_shader_tessellator 1
-
-#define GL_SAMPLER_BUFFER_AMD 0x9001
-#define GL_INT_SAMPLER_BUFFER_AMD 0x9002
-#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003
-#define GL_TESSELLATION_MODE_AMD 0x9004
-#define GL_TESSELLATION_FACTOR_AMD 0x9005
-#define GL_DISCRETE_AMD 0x9006
-#define GL_CONTINUOUS_AMD 0x9007
-
-typedef void (GLAPIENTRY * PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor);
-typedef void (GLAPIENTRY * PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode);
-
-#define glTessellationFactorAMD GLEW_GET_FUN(__glewTessellationFactorAMD)
-#define glTessellationModeAMD GLEW_GET_FUN(__glewTessellationModeAMD)
-
-#define GLEW_AMD_vertex_shader_tessellator GLEW_GET_VAR(__GLEW_AMD_vertex_shader_tessellator)
-
-#endif /* GL_AMD_vertex_shader_tessellator */
-
-/* ------------------ GL_AMD_vertex_shader_viewport_index ------------------ */
-
-#ifndef GL_AMD_vertex_shader_viewport_index
-#define GL_AMD_vertex_shader_viewport_index 1
-
-#define GLEW_AMD_vertex_shader_viewport_index GLEW_GET_VAR(__GLEW_AMD_vertex_shader_viewport_index)
-
-#endif /* GL_AMD_vertex_shader_viewport_index */
-
-/* ------------------------- GL_ANGLE_depth_texture ------------------------ */
-
-#ifndef GL_ANGLE_depth_texture
-#define GL_ANGLE_depth_texture 1
-
-#define GLEW_ANGLE_depth_texture GLEW_GET_VAR(__GLEW_ANGLE_depth_texture)
-
-#endif /* GL_ANGLE_depth_texture */
-
-/* ----------------------- GL_ANGLE_framebuffer_blit ----------------------- */
-
-#ifndef GL_ANGLE_framebuffer_blit
-#define GL_ANGLE_framebuffer_blit 1
-
-#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
-#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
-#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
-
-typedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-
-#define glBlitFramebufferANGLE GLEW_GET_FUN(__glewBlitFramebufferANGLE)
-
-#define GLEW_ANGLE_framebuffer_blit GLEW_GET_VAR(__GLEW_ANGLE_framebuffer_blit)
-
-#endif /* GL_ANGLE_framebuffer_blit */
-
-/* -------------------- GL_ANGLE_framebuffer_multisample ------------------- */
-
-#ifndef GL_ANGLE_framebuffer_multisample
-#define GL_ANGLE_framebuffer_multisample 1
-
-#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
-#define GL_MAX_SAMPLES_ANGLE 0x8D57
-
-typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-
-#define glRenderbufferStorageMultisampleANGLE GLEW_GET_FUN(__glewRenderbufferStorageMultisampleANGLE)
-
-#define GLEW_ANGLE_framebuffer_multisample GLEW_GET_VAR(__GLEW_ANGLE_framebuffer_multisample)
-
-#endif /* GL_ANGLE_framebuffer_multisample */
-
-/* ----------------------- GL_ANGLE_instanced_arrays ----------------------- */
-
-#ifndef GL_ANGLE_instanced_arrays
-#define GL_ANGLE_instanced_arrays 1
-
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
-
-typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
-
-#define glDrawArraysInstancedANGLE GLEW_GET_FUN(__glewDrawArraysInstancedANGLE)
-#define glDrawElementsInstancedANGLE GLEW_GET_FUN(__glewDrawElementsInstancedANGLE)
-#define glVertexAttribDivisorANGLE GLEW_GET_FUN(__glewVertexAttribDivisorANGLE)
-
-#define GLEW_ANGLE_instanced_arrays GLEW_GET_VAR(__GLEW_ANGLE_instanced_arrays)
-
-#endif /* GL_ANGLE_instanced_arrays */
-
-/* -------------------- GL_ANGLE_pack_reverse_row_order -------------------- */
-
-#ifndef GL_ANGLE_pack_reverse_row_order
-#define GL_ANGLE_pack_reverse_row_order 1
-
-#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
-
-#define GLEW_ANGLE_pack_reverse_row_order GLEW_GET_VAR(__GLEW_ANGLE_pack_reverse_row_order)
-
-#endif /* GL_ANGLE_pack_reverse_row_order */
-
-/* ------------------------ GL_ANGLE_program_binary ------------------------ */
-
-#ifndef GL_ANGLE_program_binary
-#define GL_ANGLE_program_binary 1
-
-#define GL_PROGRAM_BINARY_ANGLE 0x93A6
-
-#define GLEW_ANGLE_program_binary GLEW_GET_VAR(__GLEW_ANGLE_program_binary)
-
-#endif /* GL_ANGLE_program_binary */
-
-/* ------------------- GL_ANGLE_texture_compression_dxt1 ------------------- */
-
-#ifndef GL_ANGLE_texture_compression_dxt1
-#define GL_ANGLE_texture_compression_dxt1 1
-
-#define GL_COMPRESSED_RGB_S3TC_DXT1_ANGLE 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_ANGLE 0x83F1
-#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
-#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
-
-#define GLEW_ANGLE_texture_compression_dxt1 GLEW_GET_VAR(__GLEW_ANGLE_texture_compression_dxt1)
-
-#endif /* GL_ANGLE_texture_compression_dxt1 */
-
-/* ------------------- GL_ANGLE_texture_compression_dxt3 ------------------- */
-
-#ifndef GL_ANGLE_texture_compression_dxt3
-#define GL_ANGLE_texture_compression_dxt3 1
-
-#define GL_COMPRESSED_RGB_S3TC_DXT1_ANGLE 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_ANGLE 0x83F1
-#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
-#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
-
-#define GLEW_ANGLE_texture_compression_dxt3 GLEW_GET_VAR(__GLEW_ANGLE_texture_compression_dxt3)
-
-#endif /* GL_ANGLE_texture_compression_dxt3 */
-
-/* ------------------- GL_ANGLE_texture_compression_dxt5 ------------------- */
-
-#ifndef GL_ANGLE_texture_compression_dxt5
-#define GL_ANGLE_texture_compression_dxt5 1
-
-#define GL_COMPRESSED_RGB_S3TC_DXT1_ANGLE 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_ANGLE 0x83F1
-#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
-#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
-
-#define GLEW_ANGLE_texture_compression_dxt5 GLEW_GET_VAR(__GLEW_ANGLE_texture_compression_dxt5)
-
-#endif /* GL_ANGLE_texture_compression_dxt5 */
-
-/* ------------------------- GL_ANGLE_texture_usage ------------------------ */
-
-#ifndef GL_ANGLE_texture_usage
-#define GL_ANGLE_texture_usage 1
-
-#define GL_TEXTURE_USAGE_ANGLE 0x93A2
-#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
-
-#define GLEW_ANGLE_texture_usage GLEW_GET_VAR(__GLEW_ANGLE_texture_usage)
-
-#endif /* GL_ANGLE_texture_usage */
-
-/* -------------------------- GL_ANGLE_timer_query ------------------------- */
-
-#ifndef GL_ANGLE_timer_query
-#define GL_ANGLE_timer_query 1
-
-#define GL_QUERY_COUNTER_BITS_ANGLE 0x8864
-#define GL_CURRENT_QUERY_ANGLE 0x8865
-#define GL_QUERY_RESULT_ANGLE 0x8866
-#define GL_QUERY_RESULT_AVAILABLE_ANGLE 0x8867
-#define GL_TIME_ELAPSED_ANGLE 0x88BF
-#define GL_TIMESTAMP_ANGLE 0x8E28
-
-typedef void (GLAPIENTRY * PFNGLBEGINQUERYANGLEPROC) (GLenum target, GLuint id);
-typedef void (GLAPIENTRY * PFNGLDELETEQUERIESANGLEPROC) (GLsizei n, const GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLENDQUERYANGLEPROC) (GLenum target);
-typedef void (GLAPIENTRY * PFNGLGENQUERIESANGLEPROC) (GLsizei n, GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTI64VANGLEPROC) (GLuint id, GLenum pname, GLint64* params);
-typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVANGLEPROC) (GLuint id, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUI64VANGLEPROC) (GLuint id, GLenum pname, GLuint64* params);
-typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVANGLEPROC) (GLuint id, GLenum pname, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLGETQUERYIVANGLEPROC) (GLenum target, GLenum pname, GLint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISQUERYANGLEPROC) (GLuint id);
-typedef void (GLAPIENTRY * PFNGLQUERYCOUNTERANGLEPROC) (GLuint id, GLenum target);
-
-#define glBeginQueryANGLE GLEW_GET_FUN(__glewBeginQueryANGLE)
-#define glDeleteQueriesANGLE GLEW_GET_FUN(__glewDeleteQueriesANGLE)
-#define glEndQueryANGLE GLEW_GET_FUN(__glewEndQueryANGLE)
-#define glGenQueriesANGLE GLEW_GET_FUN(__glewGenQueriesANGLE)
-#define glGetQueryObjecti64vANGLE GLEW_GET_FUN(__glewGetQueryObjecti64vANGLE)
-#define glGetQueryObjectivANGLE GLEW_GET_FUN(__glewGetQueryObjectivANGLE)
-#define glGetQueryObjectui64vANGLE GLEW_GET_FUN(__glewGetQueryObjectui64vANGLE)
-#define glGetQueryObjectuivANGLE GLEW_GET_FUN(__glewGetQueryObjectuivANGLE)
-#define glGetQueryivANGLE GLEW_GET_FUN(__glewGetQueryivANGLE)
-#define glIsQueryANGLE GLEW_GET_FUN(__glewIsQueryANGLE)
-#define glQueryCounterANGLE GLEW_GET_FUN(__glewQueryCounterANGLE)
-
-#define GLEW_ANGLE_timer_query GLEW_GET_VAR(__GLEW_ANGLE_timer_query)
-
-#endif /* GL_ANGLE_timer_query */
-
-/* ------------------- GL_ANGLE_translated_shader_source ------------------- */
-
-#ifndef GL_ANGLE_translated_shader_source
-#define GL_ANGLE_translated_shader_source 1
-
-#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
-
-typedef void (GLAPIENTRY * PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
-
-#define glGetTranslatedShaderSourceANGLE GLEW_GET_FUN(__glewGetTranslatedShaderSourceANGLE)
-
-#define GLEW_ANGLE_translated_shader_source GLEW_GET_VAR(__GLEW_ANGLE_translated_shader_source)
-
-#endif /* GL_ANGLE_translated_shader_source */
-
-/* ----------------------- GL_APPLE_aux_depth_stencil ---------------------- */
-
-#ifndef GL_APPLE_aux_depth_stencil
-#define GL_APPLE_aux_depth_stencil 1
-
-#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14
-
-#define GLEW_APPLE_aux_depth_stencil GLEW_GET_VAR(__GLEW_APPLE_aux_depth_stencil)
-
-#endif /* GL_APPLE_aux_depth_stencil */
-
-/* ------------------------ GL_APPLE_client_storage ------------------------ */
-
-#ifndef GL_APPLE_client_storage
-#define GL_APPLE_client_storage 1
-
-#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2
-
-#define GLEW_APPLE_client_storage GLEW_GET_VAR(__GLEW_APPLE_client_storage)
-
-#endif /* GL_APPLE_client_storage */
-
-/* ------------------------- GL_APPLE_element_array ------------------------ */
-
-#ifndef GL_APPLE_element_array
-#define GL_APPLE_element_array 1
-
-#define GL_ELEMENT_ARRAY_APPLE 0x8A0C
-#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D
-#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E
-
-typedef void (GLAPIENTRY * PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count);
-typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);
-typedef void (GLAPIENTRY * PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const void *pointer);
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint* first, const GLsizei *count, GLsizei primcount);
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint* first, const GLsizei *count, GLsizei primcount);
-
-#define glDrawElementArrayAPPLE GLEW_GET_FUN(__glewDrawElementArrayAPPLE)
-#define glDrawRangeElementArrayAPPLE GLEW_GET_FUN(__glewDrawRangeElementArrayAPPLE)
-#define glElementPointerAPPLE GLEW_GET_FUN(__glewElementPointerAPPLE)
-#define glMultiDrawElementArrayAPPLE GLEW_GET_FUN(__glewMultiDrawElementArrayAPPLE)
-#define glMultiDrawRangeElementArrayAPPLE GLEW_GET_FUN(__glewMultiDrawRangeElementArrayAPPLE)
-
-#define GLEW_APPLE_element_array GLEW_GET_VAR(__GLEW_APPLE_element_array)
-
-#endif /* GL_APPLE_element_array */
-
-/* ----------------------------- GL_APPLE_fence ---------------------------- */
-
-#ifndef GL_APPLE_fence
-#define GL_APPLE_fence 1
-
-#define GL_DRAW_PIXELS_APPLE 0x8A0A
-#define GL_FENCE_APPLE 0x8A0B
-
-typedef void (GLAPIENTRY * PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint* fences);
-typedef void (GLAPIENTRY * PFNGLFINISHFENCEAPPLEPROC) (GLuint fence);
-typedef void (GLAPIENTRY * PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name);
-typedef void (GLAPIENTRY * PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint* fences);
-typedef GLboolean (GLAPIENTRY * PFNGLISFENCEAPPLEPROC) (GLuint fence);
-typedef void (GLAPIENTRY * PFNGLSETFENCEAPPLEPROC) (GLuint fence);
-typedef GLboolean (GLAPIENTRY * PFNGLTESTFENCEAPPLEPROC) (GLuint fence);
-typedef GLboolean (GLAPIENTRY * PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name);
-
-#define glDeleteFencesAPPLE GLEW_GET_FUN(__glewDeleteFencesAPPLE)
-#define glFinishFenceAPPLE GLEW_GET_FUN(__glewFinishFenceAPPLE)
-#define glFinishObjectAPPLE GLEW_GET_FUN(__glewFinishObjectAPPLE)
-#define glGenFencesAPPLE GLEW_GET_FUN(__glewGenFencesAPPLE)
-#define glIsFenceAPPLE GLEW_GET_FUN(__glewIsFenceAPPLE)
-#define glSetFenceAPPLE GLEW_GET_FUN(__glewSetFenceAPPLE)
-#define glTestFenceAPPLE GLEW_GET_FUN(__glewTestFenceAPPLE)
-#define glTestObjectAPPLE GLEW_GET_FUN(__glewTestObjectAPPLE)
-
-#define GLEW_APPLE_fence GLEW_GET_VAR(__GLEW_APPLE_fence)
-
-#endif /* GL_APPLE_fence */
-
-/* ------------------------- GL_APPLE_float_pixels ------------------------- */
-
-#ifndef GL_APPLE_float_pixels
-#define GL_APPLE_float_pixels 1
-
-#define GL_HALF_APPLE 0x140B
-#define GL_RGBA_FLOAT32_APPLE 0x8814
-#define GL_RGB_FLOAT32_APPLE 0x8815
-#define GL_ALPHA_FLOAT32_APPLE 0x8816
-#define GL_INTENSITY_FLOAT32_APPLE 0x8817
-#define GL_LUMINANCE_FLOAT32_APPLE 0x8818
-#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819
-#define GL_RGBA_FLOAT16_APPLE 0x881A
-#define GL_RGB_FLOAT16_APPLE 0x881B
-#define GL_ALPHA_FLOAT16_APPLE 0x881C
-#define GL_INTENSITY_FLOAT16_APPLE 0x881D
-#define GL_LUMINANCE_FLOAT16_APPLE 0x881E
-#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F
-#define GL_COLOR_FLOAT_APPLE 0x8A0F
-
-#define GLEW_APPLE_float_pixels GLEW_GET_VAR(__GLEW_APPLE_float_pixels)
-
-#endif /* GL_APPLE_float_pixels */
-
-/* ---------------------- GL_APPLE_flush_buffer_range ---------------------- */
-
-#ifndef GL_APPLE_flush_buffer_range
-#define GL_APPLE_flush_buffer_range 1
-
-#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12
-#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13
-
-typedef void (GLAPIENTRY * PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size);
-
-#define glBufferParameteriAPPLE GLEW_GET_FUN(__glewBufferParameteriAPPLE)
-#define glFlushMappedBufferRangeAPPLE GLEW_GET_FUN(__glewFlushMappedBufferRangeAPPLE)
-
-#define GLEW_APPLE_flush_buffer_range GLEW_GET_VAR(__GLEW_APPLE_flush_buffer_range)
-
-#endif /* GL_APPLE_flush_buffer_range */
-
-/* ----------------------- GL_APPLE_object_purgeable ----------------------- */
-
-#ifndef GL_APPLE_object_purgeable
-#define GL_APPLE_object_purgeable 1
-
-#define GL_BUFFER_OBJECT_APPLE 0x85B3
-#define GL_RELEASED_APPLE 0x8A19
-#define GL_VOLATILE_APPLE 0x8A1A
-#define GL_RETAINED_APPLE 0x8A1B
-#define GL_UNDEFINED_APPLE 0x8A1C
-#define GL_PURGEABLE_APPLE 0x8A1D
-
-typedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint* params);
-typedef GLenum (GLAPIENTRY * PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);
-typedef GLenum (GLAPIENTRY * PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);
-
-#define glGetObjectParameterivAPPLE GLEW_GET_FUN(__glewGetObjectParameterivAPPLE)
-#define glObjectPurgeableAPPLE GLEW_GET_FUN(__glewObjectPurgeableAPPLE)
-#define glObjectUnpurgeableAPPLE GLEW_GET_FUN(__glewObjectUnpurgeableAPPLE)
-
-#define GLEW_APPLE_object_purgeable GLEW_GET_VAR(__GLEW_APPLE_object_purgeable)
-
-#endif /* GL_APPLE_object_purgeable */
-
-/* ------------------------- GL_APPLE_pixel_buffer ------------------------- */
-
-#ifndef GL_APPLE_pixel_buffer
-#define GL_APPLE_pixel_buffer 1
-
-#define GL_MIN_PBUFFER_VIEWPORT_DIMS_APPLE 0x8A10
-
-#define GLEW_APPLE_pixel_buffer GLEW_GET_VAR(__GLEW_APPLE_pixel_buffer)
-
-#endif /* GL_APPLE_pixel_buffer */
-
-/* ---------------------------- GL_APPLE_rgb_422 --------------------------- */
-
-#ifndef GL_APPLE_rgb_422
-#define GL_APPLE_rgb_422 1
-
-#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
-#define GL_RGB_422_APPLE 0x8A1F
-#define GL_RGB_RAW_422_APPLE 0x8A51
-
-#define GLEW_APPLE_rgb_422 GLEW_GET_VAR(__GLEW_APPLE_rgb_422)
-
-#endif /* GL_APPLE_rgb_422 */
-
-/* --------------------------- GL_APPLE_row_bytes -------------------------- */
-
-#ifndef GL_APPLE_row_bytes
-#define GL_APPLE_row_bytes 1
-
-#define GL_PACK_ROW_BYTES_APPLE 0x8A15
-#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16
-
-#define GLEW_APPLE_row_bytes GLEW_GET_VAR(__GLEW_APPLE_row_bytes)
-
-#endif /* GL_APPLE_row_bytes */
-
-/* ------------------------ GL_APPLE_specular_vector ----------------------- */
-
-#ifndef GL_APPLE_specular_vector
-#define GL_APPLE_specular_vector 1
-
-#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0
-
-#define GLEW_APPLE_specular_vector GLEW_GET_VAR(__GLEW_APPLE_specular_vector)
-
-#endif /* GL_APPLE_specular_vector */
-
-/* ------------------------- GL_APPLE_texture_range ------------------------ */
-
-#ifndef GL_APPLE_texture_range
-#define GL_APPLE_texture_range 1
-
-#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7
-#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8
-#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC
-#define GL_STORAGE_PRIVATE_APPLE 0x85BD
-#define GL_STORAGE_CACHED_APPLE 0x85BE
-#define GL_STORAGE_SHARED_APPLE 0x85BF
-
-typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, void **params);
-typedef void (GLAPIENTRY * PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, void *pointer);
-
-#define glGetTexParameterPointervAPPLE GLEW_GET_FUN(__glewGetTexParameterPointervAPPLE)
-#define glTextureRangeAPPLE GLEW_GET_FUN(__glewTextureRangeAPPLE)
-
-#define GLEW_APPLE_texture_range GLEW_GET_VAR(__GLEW_APPLE_texture_range)
-
-#endif /* GL_APPLE_texture_range */
-
-/* ------------------------ GL_APPLE_transform_hint ------------------------ */
-
-#ifndef GL_APPLE_transform_hint
-#define GL_APPLE_transform_hint 1
-
-#define GL_TRANSFORM_HINT_APPLE 0x85B1
-
-#define GLEW_APPLE_transform_hint GLEW_GET_VAR(__GLEW_APPLE_transform_hint)
-
-#endif /* GL_APPLE_transform_hint */
-
-/* ---------------------- GL_APPLE_vertex_array_object --------------------- */
-
-#ifndef GL_APPLE_vertex_array_object
-#define GL_APPLE_vertex_array_object 1
-
-#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5
-
-typedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array);
-typedef void (GLAPIENTRY * PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint* arrays);
-typedef void (GLAPIENTRY * PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint* arrays);
-typedef GLboolean (GLAPIENTRY * PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array);
-
-#define glBindVertexArrayAPPLE GLEW_GET_FUN(__glewBindVertexArrayAPPLE)
-#define glDeleteVertexArraysAPPLE GLEW_GET_FUN(__glewDeleteVertexArraysAPPLE)
-#define glGenVertexArraysAPPLE GLEW_GET_FUN(__glewGenVertexArraysAPPLE)
-#define glIsVertexArrayAPPLE GLEW_GET_FUN(__glewIsVertexArrayAPPLE)
-
-#define GLEW_APPLE_vertex_array_object GLEW_GET_VAR(__GLEW_APPLE_vertex_array_object)
-
-#endif /* GL_APPLE_vertex_array_object */
-
-/* ---------------------- GL_APPLE_vertex_array_range ---------------------- */
-
-#ifndef GL_APPLE_vertex_array_range
-#define GL_APPLE_vertex_array_range 1
-
-#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D
-#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E
-#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F
-#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE 0x8520
-#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521
-#define GL_STORAGE_CLIENT_APPLE 0x85B4
-#define GL_STORAGE_CACHED_APPLE 0x85BE
-#define GL_STORAGE_SHARED_APPLE 0x85BF
-
-typedef void (GLAPIENTRY * PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer);
-
-#define glFlushVertexArrayRangeAPPLE GLEW_GET_FUN(__glewFlushVertexArrayRangeAPPLE)
-#define glVertexArrayParameteriAPPLE GLEW_GET_FUN(__glewVertexArrayParameteriAPPLE)
-#define glVertexArrayRangeAPPLE GLEW_GET_FUN(__glewVertexArrayRangeAPPLE)
-
-#define GLEW_APPLE_vertex_array_range GLEW_GET_VAR(__GLEW_APPLE_vertex_array_range)
-
-#endif /* GL_APPLE_vertex_array_range */
-
-/* ------------------- GL_APPLE_vertex_program_evaluators ------------------ */
-
-#ifndef GL_APPLE_vertex_program_evaluators
-#define GL_APPLE_vertex_program_evaluators 1
-
-#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00
-#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01
-#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02
-#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03
-#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04
-#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05
-#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06
-#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07
-#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08
-#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09
-
-typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);
-typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);
-typedef GLboolean (GLAPIENTRY * PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname);
-typedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble* points);
-typedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat* points);
-typedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble* points);
-typedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat* points);
-
-#define glDisableVertexAttribAPPLE GLEW_GET_FUN(__glewDisableVertexAttribAPPLE)
-#define glEnableVertexAttribAPPLE GLEW_GET_FUN(__glewEnableVertexAttribAPPLE)
-#define glIsVertexAttribEnabledAPPLE GLEW_GET_FUN(__glewIsVertexAttribEnabledAPPLE)
-#define glMapVertexAttrib1dAPPLE GLEW_GET_FUN(__glewMapVertexAttrib1dAPPLE)
-#define glMapVertexAttrib1fAPPLE GLEW_GET_FUN(__glewMapVertexAttrib1fAPPLE)
-#define glMapVertexAttrib2dAPPLE GLEW_GET_FUN(__glewMapVertexAttrib2dAPPLE)
-#define glMapVertexAttrib2fAPPLE GLEW_GET_FUN(__glewMapVertexAttrib2fAPPLE)
-
-#define GLEW_APPLE_vertex_program_evaluators GLEW_GET_VAR(__GLEW_APPLE_vertex_program_evaluators)
-
-#endif /* GL_APPLE_vertex_program_evaluators */
-
-/* --------------------------- GL_APPLE_ycbcr_422 -------------------------- */
-
-#ifndef GL_APPLE_ycbcr_422
-#define GL_APPLE_ycbcr_422 1
-
-#define GL_YCBCR_422_APPLE 0x85B9
-
-#define GLEW_APPLE_ycbcr_422 GLEW_GET_VAR(__GLEW_APPLE_ycbcr_422)
-
-#endif /* GL_APPLE_ycbcr_422 */
-
-/* ------------------------ GL_ARB_ES2_compatibility ----------------------- */
-
-#ifndef GL_ARB_ES2_compatibility
-#define GL_ARB_ES2_compatibility 1
-
-#define GL_FIXED 0x140C
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
-#define GL_RGB565 0x8D62
-#define GL_LOW_FLOAT 0x8DF0
-#define GL_MEDIUM_FLOAT 0x8DF1
-#define GL_HIGH_FLOAT 0x8DF2
-#define GL_LOW_INT 0x8DF3
-#define GL_MEDIUM_INT 0x8DF4
-#define GL_HIGH_INT 0x8DF5
-#define GL_SHADER_BINARY_FORMATS 0x8DF8
-#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
-#define GL_SHADER_COMPILER 0x8DFA
-#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
-#define GL_MAX_VARYING_VECTORS 0x8DFC
-#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
-
-typedef int GLfixed;
-
-typedef void (GLAPIENTRY * PFNGLCLEARDEPTHFPROC) (GLclampf d);
-typedef void (GLAPIENTRY * PFNGLDEPTHRANGEFPROC) (GLclampf n, GLclampf f);
-typedef void (GLAPIENTRY * PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint* range, GLint *precision);
-typedef void (GLAPIENTRY * PFNGLRELEASESHADERCOMPILERPROC) (void);
-typedef void (GLAPIENTRY * PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint* shaders, GLenum binaryformat, const void*binary, GLsizei length);
-
-#define glClearDepthf GLEW_GET_FUN(__glewClearDepthf)
-#define glDepthRangef GLEW_GET_FUN(__glewDepthRangef)
-#define glGetShaderPrecisionFormat GLEW_GET_FUN(__glewGetShaderPrecisionFormat)
-#define glReleaseShaderCompiler GLEW_GET_FUN(__glewReleaseShaderCompiler)
-#define glShaderBinary GLEW_GET_FUN(__glewShaderBinary)
-
-#define GLEW_ARB_ES2_compatibility GLEW_GET_VAR(__GLEW_ARB_ES2_compatibility)
-
-#endif /* GL_ARB_ES2_compatibility */
-
-/* ----------------------- GL_ARB_ES3_1_compatibility ---------------------- */
-
-#ifndef GL_ARB_ES3_1_compatibility
-#define GL_ARB_ES3_1_compatibility 1
-
-typedef void (GLAPIENTRY * PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers);
-
-#define glMemoryBarrierByRegion GLEW_GET_FUN(__glewMemoryBarrierByRegion)
-
-#define GLEW_ARB_ES3_1_compatibility GLEW_GET_VAR(__GLEW_ARB_ES3_1_compatibility)
-
-#endif /* GL_ARB_ES3_1_compatibility */
-
-/* ------------------------ GL_ARB_ES3_compatibility ----------------------- */
-
-#ifndef GL_ARB_ES3_compatibility
-#define GL_ARB_ES3_compatibility 1
-
-#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
-#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
-#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
-#define GL_MAX_ELEMENT_INDEX 0x8D6B
-#define GL_COMPRESSED_R11_EAC 0x9270
-#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
-#define GL_COMPRESSED_RG11_EAC 0x9272
-#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
-#define GL_COMPRESSED_RGB8_ETC2 0x9274
-#define GL_COMPRESSED_SRGB8_ETC2 0x9275
-#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
-#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
-#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
-#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
-
-#define GLEW_ARB_ES3_compatibility GLEW_GET_VAR(__GLEW_ARB_ES3_compatibility)
-
-#endif /* GL_ARB_ES3_compatibility */
-
-/* ------------------------ GL_ARB_arrays_of_arrays ------------------------ */
-
-#ifndef GL_ARB_arrays_of_arrays
-#define GL_ARB_arrays_of_arrays 1
-
-#define GLEW_ARB_arrays_of_arrays GLEW_GET_VAR(__GLEW_ARB_arrays_of_arrays)
-
-#endif /* GL_ARB_arrays_of_arrays */
-
-/* -------------------------- GL_ARB_base_instance ------------------------- */
-
-#ifndef GL_ARB_base_instance
-#define GL_ARB_base_instance 1
-
-typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance);
-typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance);
-typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance);
-
-#define glDrawArraysInstancedBaseInstance GLEW_GET_FUN(__glewDrawArraysInstancedBaseInstance)
-#define glDrawElementsInstancedBaseInstance GLEW_GET_FUN(__glewDrawElementsInstancedBaseInstance)
-#define glDrawElementsInstancedBaseVertexBaseInstance GLEW_GET_FUN(__glewDrawElementsInstancedBaseVertexBaseInstance)
-
-#define GLEW_ARB_base_instance GLEW_GET_VAR(__GLEW_ARB_base_instance)
-
-#endif /* GL_ARB_base_instance */
-
-/* ------------------------ GL_ARB_bindless_texture ------------------------ */
-
-#ifndef GL_ARB_bindless_texture
-#define GL_ARB_bindless_texture 1
-
-#define GL_UNSIGNED_INT64_ARB 0x140F
-
-typedef GLuint64 (GLAPIENTRY * PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
-typedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture);
-typedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle);
-typedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle);
-typedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle);
-typedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access);
-typedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle);
-typedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64* values);
-typedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64* value);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT* v);
-
-#define glGetImageHandleARB GLEW_GET_FUN(__glewGetImageHandleARB)
-#define glGetTextureHandleARB GLEW_GET_FUN(__glewGetTextureHandleARB)
-#define glGetTextureSamplerHandleARB GLEW_GET_FUN(__glewGetTextureSamplerHandleARB)
-#define glGetVertexAttribLui64vARB GLEW_GET_FUN(__glewGetVertexAttribLui64vARB)
-#define glIsImageHandleResidentARB GLEW_GET_FUN(__glewIsImageHandleResidentARB)
-#define glIsTextureHandleResidentARB GLEW_GET_FUN(__glewIsTextureHandleResidentARB)
-#define glMakeImageHandleNonResidentARB GLEW_GET_FUN(__glewMakeImageHandleNonResidentARB)
-#define glMakeImageHandleResidentARB GLEW_GET_FUN(__glewMakeImageHandleResidentARB)
-#define glMakeTextureHandleNonResidentARB GLEW_GET_FUN(__glewMakeTextureHandleNonResidentARB)
-#define glMakeTextureHandleResidentARB GLEW_GET_FUN(__glewMakeTextureHandleResidentARB)
-#define glProgramUniformHandleui64ARB GLEW_GET_FUN(__glewProgramUniformHandleui64ARB)
-#define glProgramUniformHandleui64vARB GLEW_GET_FUN(__glewProgramUniformHandleui64vARB)
-#define glUniformHandleui64ARB GLEW_GET_FUN(__glewUniformHandleui64ARB)
-#define glUniformHandleui64vARB GLEW_GET_FUN(__glewUniformHandleui64vARB)
-#define glVertexAttribL1ui64ARB GLEW_GET_FUN(__glewVertexAttribL1ui64ARB)
-#define glVertexAttribL1ui64vARB GLEW_GET_FUN(__glewVertexAttribL1ui64vARB)
-
-#define GLEW_ARB_bindless_texture GLEW_GET_VAR(__GLEW_ARB_bindless_texture)
-
-#endif /* GL_ARB_bindless_texture */
-
-/* ----------------------- GL_ARB_blend_func_extended ---------------------- */
-
-#ifndef GL_ARB_blend_func_extended
-#define GL_ARB_blend_func_extended 1
-
-#define GL_SRC1_COLOR 0x88F9
-#define GL_ONE_MINUS_SRC1_COLOR 0x88FA
-#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB
-#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC
-
-typedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar * name);
-typedef GLint (GLAPIENTRY * PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar * name);
-
-#define glBindFragDataLocationIndexed GLEW_GET_FUN(__glewBindFragDataLocationIndexed)
-#define glGetFragDataIndex GLEW_GET_FUN(__glewGetFragDataIndex)
-
-#define GLEW_ARB_blend_func_extended GLEW_GET_VAR(__GLEW_ARB_blend_func_extended)
-
-#endif /* GL_ARB_blend_func_extended */
-
-/* ------------------------- GL_ARB_buffer_storage ------------------------- */
-
-#ifndef GL_ARB_buffer_storage
-#define GL_ARB_buffer_storage 1
-
-#define GL_MAP_READ_BIT 0x0001
-#define GL_MAP_WRITE_BIT 0x0002
-#define GL_MAP_PERSISTENT_BIT 0x00000040
-#define GL_MAP_COHERENT_BIT 0x00000080
-#define GL_DYNAMIC_STORAGE_BIT 0x0100
-#define GL_CLIENT_STORAGE_BIT 0x0200
-#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000
-#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F
-#define GL_BUFFER_STORAGE_FLAGS 0x8220
-
-typedef void (GLAPIENTRY * PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
-typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERSTORAGEEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
-
-#define glBufferStorage GLEW_GET_FUN(__glewBufferStorage)
-#define glNamedBufferStorageEXT GLEW_GET_FUN(__glewNamedBufferStorageEXT)
-
-#define GLEW_ARB_buffer_storage GLEW_GET_VAR(__GLEW_ARB_buffer_storage)
-
-#endif /* GL_ARB_buffer_storage */
-
-/* ---------------------------- GL_ARB_cl_event ---------------------------- */
-
-#ifndef GL_ARB_cl_event
-#define GL_ARB_cl_event 1
-
-#define GL_SYNC_CL_EVENT_ARB 0x8240
-#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241
-
-typedef struct _cl_context *cl_context;
-typedef struct _cl_event *cl_event;
-
-typedef GLsync (GLAPIENTRY * PFNGLCREATESYNCFROMCLEVENTARBPROC) (cl_context context, cl_event event, GLbitfield flags);
-
-#define glCreateSyncFromCLeventARB GLEW_GET_FUN(__glewCreateSyncFromCLeventARB)
-
-#define GLEW_ARB_cl_event GLEW_GET_VAR(__GLEW_ARB_cl_event)
-
-#endif /* GL_ARB_cl_event */
-
-/* ----------------------- GL_ARB_clear_buffer_object ---------------------- */
-
-#ifndef GL_ARB_clear_buffer_object
-#define GL_ARB_clear_buffer_object 1
-
-typedef void (GLAPIENTRY * PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
-typedef void (GLAPIENTRY * PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-typedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
-typedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-
-#define glClearBufferData GLEW_GET_FUN(__glewClearBufferData)
-#define glClearBufferSubData GLEW_GET_FUN(__glewClearBufferSubData)
-#define glClearNamedBufferDataEXT GLEW_GET_FUN(__glewClearNamedBufferDataEXT)
-#define glClearNamedBufferSubDataEXT GLEW_GET_FUN(__glewClearNamedBufferSubDataEXT)
-
-#define GLEW_ARB_clear_buffer_object GLEW_GET_VAR(__GLEW_ARB_clear_buffer_object)
-
-#endif /* GL_ARB_clear_buffer_object */
-
-/* -------------------------- GL_ARB_clear_texture ------------------------- */
-
-#ifndef GL_ARB_clear_texture
-#define GL_ARB_clear_texture 1
-
-#define GL_CLEAR_TEXTURE 0x9365
-
-typedef void (GLAPIENTRY * PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
-typedef void (GLAPIENTRY * PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
-
-#define glClearTexImage GLEW_GET_FUN(__glewClearTexImage)
-#define glClearTexSubImage GLEW_GET_FUN(__glewClearTexSubImage)
-
-#define GLEW_ARB_clear_texture GLEW_GET_VAR(__GLEW_ARB_clear_texture)
-
-#endif /* GL_ARB_clear_texture */
-
-/* -------------------------- GL_ARB_clip_control -------------------------- */
-
-#ifndef GL_ARB_clip_control
-#define GL_ARB_clip_control 1
-
-#define GL_LOWER_LEFT 0x8CA1
-#define GL_UPPER_LEFT 0x8CA2
-#define GL_CLIP_ORIGIN 0x935C
-#define GL_CLIP_DEPTH_MODE 0x935D
-#define GL_NEGATIVE_ONE_TO_ONE 0x935E
-#define GL_ZERO_TO_ONE 0x935F
-
-typedef void (GLAPIENTRY * PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum depth);
-
-#define glClipControl GLEW_GET_FUN(__glewClipControl)
-
-#define GLEW_ARB_clip_control GLEW_GET_VAR(__GLEW_ARB_clip_control)
-
-#endif /* GL_ARB_clip_control */
-
-/* ----------------------- GL_ARB_color_buffer_float ----------------------- */
-
-#ifndef GL_ARB_color_buffer_float
-#define GL_ARB_color_buffer_float 1
-
-#define GL_RGBA_FLOAT_MODE_ARB 0x8820
-#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A
-#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B
-#define GL_CLAMP_READ_COLOR_ARB 0x891C
-#define GL_FIXED_ONLY_ARB 0x891D
-
-typedef void (GLAPIENTRY * PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp);
-
-#define glClampColorARB GLEW_GET_FUN(__glewClampColorARB)
-
-#define GLEW_ARB_color_buffer_float GLEW_GET_VAR(__GLEW_ARB_color_buffer_float)
-
-#endif /* GL_ARB_color_buffer_float */
-
-/* -------------------------- GL_ARB_compatibility ------------------------- */
-
-#ifndef GL_ARB_compatibility
-#define GL_ARB_compatibility 1
-
-#define GLEW_ARB_compatibility GLEW_GET_VAR(__GLEW_ARB_compatibility)
-
-#endif /* GL_ARB_compatibility */
-
-/* ---------------- GL_ARB_compressed_texture_pixel_storage ---------------- */
-
-#ifndef GL_ARB_compressed_texture_pixel_storage
-#define GL_ARB_compressed_texture_pixel_storage 1
-
-#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127
-#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128
-#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129
-#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A
-#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B
-#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C
-#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D
-#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E
-
-#define GLEW_ARB_compressed_texture_pixel_storage GLEW_GET_VAR(__GLEW_ARB_compressed_texture_pixel_storage)
-
-#endif /* GL_ARB_compressed_texture_pixel_storage */
-
-/* ------------------------- GL_ARB_compute_shader ------------------------- */
-
-#ifndef GL_ARB_compute_shader
-#define GL_ARB_compute_shader 1
-
-#define GL_COMPUTE_SHADER_BIT 0x00000020
-#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
-#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
-#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
-#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265
-#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
-#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267
-#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED
-#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE
-#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
-#define GL_COMPUTE_SHADER 0x91B9
-#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB
-#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
-#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD
-#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE
-#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF
-
-typedef void (GLAPIENTRY * PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
-typedef void (GLAPIENTRY * PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);
-
-#define glDispatchCompute GLEW_GET_FUN(__glewDispatchCompute)
-#define glDispatchComputeIndirect GLEW_GET_FUN(__glewDispatchComputeIndirect)
-
-#define GLEW_ARB_compute_shader GLEW_GET_VAR(__GLEW_ARB_compute_shader)
-
-#endif /* GL_ARB_compute_shader */
-
-/* ------------------- GL_ARB_compute_variable_group_size ------------------ */
-
-#ifndef GL_ARB_compute_variable_group_size
-#define GL_ARB_compute_variable_group_size 1
-
-#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB
-#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF
-#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344
-#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345
-
-typedef void (GLAPIENTRY * PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z);
-
-#define glDispatchComputeGroupSizeARB GLEW_GET_FUN(__glewDispatchComputeGroupSizeARB)
-
-#define GLEW_ARB_compute_variable_group_size GLEW_GET_VAR(__GLEW_ARB_compute_variable_group_size)
-
-#endif /* GL_ARB_compute_variable_group_size */
-
-/* ------------------- GL_ARB_conditional_render_inverted ------------------ */
-
-#ifndef GL_ARB_conditional_render_inverted
-#define GL_ARB_conditional_render_inverted 1
-
-#define GL_QUERY_WAIT_INVERTED 0x8E17
-#define GL_QUERY_NO_WAIT_INVERTED 0x8E18
-#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19
-#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A
-
-#define GLEW_ARB_conditional_render_inverted GLEW_GET_VAR(__GLEW_ARB_conditional_render_inverted)
-
-#endif /* GL_ARB_conditional_render_inverted */
-
-/* ----------------------- GL_ARB_conservative_depth ----------------------- */
-
-#ifndef GL_ARB_conservative_depth
-#define GL_ARB_conservative_depth 1
-
-#define GLEW_ARB_conservative_depth GLEW_GET_VAR(__GLEW_ARB_conservative_depth)
-
-#endif /* GL_ARB_conservative_depth */
-
-/* --------------------------- GL_ARB_copy_buffer -------------------------- */
-
-#ifndef GL_ARB_copy_buffer
-#define GL_ARB_copy_buffer 1
-
-#define GL_COPY_READ_BUFFER 0x8F36
-#define GL_COPY_WRITE_BUFFER 0x8F37
-
-typedef void (GLAPIENTRY * PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size);
-
-#define glCopyBufferSubData GLEW_GET_FUN(__glewCopyBufferSubData)
-
-#define GLEW_ARB_copy_buffer GLEW_GET_VAR(__GLEW_ARB_copy_buffer)
-
-#endif /* GL_ARB_copy_buffer */
-
-/* --------------------------- GL_ARB_copy_image --------------------------- */
-
-#ifndef GL_ARB_copy_image
-#define GL_ARB_copy_image 1
-
-typedef void (GLAPIENTRY * PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-
-#define glCopyImageSubData GLEW_GET_FUN(__glewCopyImageSubData)
-
-#define GLEW_ARB_copy_image GLEW_GET_VAR(__GLEW_ARB_copy_image)
-
-#endif /* GL_ARB_copy_image */
-
-/* -------------------------- GL_ARB_cull_distance ------------------------- */
-
-#ifndef GL_ARB_cull_distance
-#define GL_ARB_cull_distance 1
-
-#define GL_MAX_CULL_DISTANCES 0x82F9
-#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA
-
-#define GLEW_ARB_cull_distance GLEW_GET_VAR(__GLEW_ARB_cull_distance)
-
-#endif /* GL_ARB_cull_distance */
-
-/* -------------------------- GL_ARB_debug_output -------------------------- */
-
-#ifndef GL_ARB_debug_output
-#define GL_ARB_debug_output 1
-
-#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
-#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
-#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244
-#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245
-#define GL_DEBUG_SOURCE_API_ARB 0x8246
-#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247
-#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248
-#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249
-#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A
-#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B
-#define GL_DEBUG_TYPE_ERROR_ARB 0x824C
-#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
-#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E
-#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F
-#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250
-#define GL_DEBUG_TYPE_OTHER_ARB 0x8251
-#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143
-#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144
-#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145
-#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
-#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
-#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
-
-typedef void (GLAPIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam);
-
-typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam);
-typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);
-typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf);
-typedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog);
-
-#define glDebugMessageCallbackARB GLEW_GET_FUN(__glewDebugMessageCallbackARB)
-#define glDebugMessageControlARB GLEW_GET_FUN(__glewDebugMessageControlARB)
-#define glDebugMessageInsertARB GLEW_GET_FUN(__glewDebugMessageInsertARB)
-#define glGetDebugMessageLogARB GLEW_GET_FUN(__glewGetDebugMessageLogARB)
-
-#define GLEW_ARB_debug_output GLEW_GET_VAR(__GLEW_ARB_debug_output)
-
-#endif /* GL_ARB_debug_output */
-
-/* ----------------------- GL_ARB_depth_buffer_float ----------------------- */
-
-#ifndef GL_ARB_depth_buffer_float
-#define GL_ARB_depth_buffer_float 1
-
-#define GL_DEPTH_COMPONENT32F 0x8CAC
-#define GL_DEPTH32F_STENCIL8 0x8CAD
-#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
-
-#define GLEW_ARB_depth_buffer_float GLEW_GET_VAR(__GLEW_ARB_depth_buffer_float)
-
-#endif /* GL_ARB_depth_buffer_float */
-
-/* --------------------------- GL_ARB_depth_clamp -------------------------- */
-
-#ifndef GL_ARB_depth_clamp
-#define GL_ARB_depth_clamp 1
-
-#define GL_DEPTH_CLAMP 0x864F
-
-#define GLEW_ARB_depth_clamp GLEW_GET_VAR(__GLEW_ARB_depth_clamp)
-
-#endif /* GL_ARB_depth_clamp */
-
-/* -------------------------- GL_ARB_depth_texture ------------------------- */
-
-#ifndef GL_ARB_depth_texture
-#define GL_ARB_depth_texture 1
-
-#define GL_DEPTH_COMPONENT16_ARB 0x81A5
-#define GL_DEPTH_COMPONENT24_ARB 0x81A6
-#define GL_DEPTH_COMPONENT32_ARB 0x81A7
-#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A
-#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B
-
-#define GLEW_ARB_depth_texture GLEW_GET_VAR(__GLEW_ARB_depth_texture)
-
-#endif /* GL_ARB_depth_texture */
-
-/* ----------------------- GL_ARB_derivative_control ----------------------- */
-
-#ifndef GL_ARB_derivative_control
-#define GL_ARB_derivative_control 1
-
-#define GLEW_ARB_derivative_control GLEW_GET_VAR(__GLEW_ARB_derivative_control)
-
-#endif /* GL_ARB_derivative_control */
-
-/* ----------------------- GL_ARB_direct_state_access ---------------------- */
-
-#ifndef GL_ARB_direct_state_access
-#define GL_ARB_direct_state_access 1
-
-#define GL_TEXTURE_TARGET 0x1006
-#define GL_QUERY_TARGET 0x82EA
-#define GL_TEXTURE_BINDING 0x82EB
-
-typedef void (GLAPIENTRY * PFNGLBINDTEXTUREUNITPROC) (GLuint unit, GLuint texture);
-typedef void (GLAPIENTRY * PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-typedef GLenum (GLAPIENTRY * PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint framebuffer, GLenum target);
-typedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERDATAPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
-typedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, GLfloat depth, GLint stencil);
-typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOPYNAMEDBUFFERSUBDATAPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLCREATEBUFFERSPROC) (GLsizei n, GLuint* buffers);
-typedef void (GLAPIENTRY * PFNGLCREATEFRAMEBUFFERSPROC) (GLsizei n, GLuint* framebuffers);
-typedef void (GLAPIENTRY * PFNGLCREATEPROGRAMPIPELINESPROC) (GLsizei n, GLuint* pipelines);
-typedef void (GLAPIENTRY * PFNGLCREATEQUERIESPROC) (GLenum target, GLsizei n, GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLCREATERENDERBUFFERSPROC) (GLsizei n, GLuint* renderbuffers);
-typedef void (GLAPIENTRY * PFNGLCREATESAMPLERSPROC) (GLsizei n, GLuint* samplers);
-typedef void (GLAPIENTRY * PFNGLCREATETEXTURESPROC) (GLenum target, GLsizei n, GLuint* textures);
-typedef void (GLAPIENTRY * PFNGLCREATETRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLCREATEVERTEXARRAYSPROC) (GLsizei n, GLuint* arrays);
-typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index);
-typedef void (GLAPIENTRY * PFNGLENABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index);
-typedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
-typedef void (GLAPIENTRY * PFNGLGENERATETEXTUREMIPMAPPROC) (GLuint texture);
-typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLsizei bufSize, void *pixels);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERI64VPROC) (GLuint buffer, GLenum pname, GLint64* params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERIVPROC) (GLuint buffer, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPOINTERVPROC) (GLuint buffer, GLenum pname, void** params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC) (GLuint framebuffer, GLenum pname, GLint* param);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC) (GLuint renderbuffer, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETQUERYBUFFEROBJECTI64VPROC) (GLuint id,GLuint buffer,GLenum pname,GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLGETQUERYBUFFEROBJECTIVPROC) (GLuint id,GLuint buffer,GLenum pname,GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLGETQUERYBUFFEROBJECTUI64VPROC) (GLuint id,GLuint buffer,GLenum pname,GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLGETQUERYBUFFEROBJECTUIVPROC) (GLuint id,GLuint buffer,GLenum pname,GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-typedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERFVPROC) (GLuint texture, GLint level, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERIVPROC) (GLuint texture, GLint level, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64* param);
-typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint* param);
-typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKIVPROC) (GLuint xfb, GLenum pname, GLint* param);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINDEXED64IVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint64* param);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINDEXEDIVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint* param);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYIVPROC) (GLuint vaobj, GLenum pname, GLint* param);
-typedef void (GLAPIENTRY * PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum* attachments);
-typedef void (GLAPIENTRY * PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void * (GLAPIENTRY * PFNGLMAPNAMEDBUFFERPROC) (GLuint buffer, GLenum access);
-typedef void * (GLAPIENTRY * PFNGLMAPNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERDATAPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
-typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERSTORAGEPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
-typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC) (GLuint framebuffer, GLenum mode);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC) (GLuint framebuffer, GLsizei n, const GLenum* bufs);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC) (GLuint framebuffer, GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC) (GLuint framebuffer, GLenum mode);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
-typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLTEXTUREBUFFERPROC) (GLuint texture, GLenum internalformat, GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLTEXTUREBUFFERRANGEPROC) (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, const GLuint* params);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFPROC) (GLuint texture, GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, const GLfloat* param);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIPROC) (GLuint texture, GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, const GLint* param);
-typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE1DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC) (GLuint xfb, GLuint index, GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC) (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef GLboolean (GLAPIENTRY * PFNGLUNMAPNAMEDBUFFERPROC) (GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYATTRIBBINDINGPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYATTRIBFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYATTRIBIFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYATTRIBLFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYBINDINGDIVISORPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYELEMENTBUFFERPROC) (GLuint vaobj, GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXBUFFERPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXBUFFERSPROC) (GLuint vaobj, GLuint first, GLsizei count, const GLuint* buffers, const GLintptr *offsets, const GLsizei *strides);
-
-#define glBindTextureUnit GLEW_GET_FUN(__glewBindTextureUnit)
-#define glBlitNamedFramebuffer GLEW_GET_FUN(__glewBlitNamedFramebuffer)
-#define glCheckNamedFramebufferStatus GLEW_GET_FUN(__glewCheckNamedFramebufferStatus)
-#define glClearNamedBufferData GLEW_GET_FUN(__glewClearNamedBufferData)
-#define glClearNamedBufferSubData GLEW_GET_FUN(__glewClearNamedBufferSubData)
-#define glClearNamedFramebufferfi GLEW_GET_FUN(__glewClearNamedFramebufferfi)
-#define glClearNamedFramebufferfv GLEW_GET_FUN(__glewClearNamedFramebufferfv)
-#define glClearNamedFramebufferiv GLEW_GET_FUN(__glewClearNamedFramebufferiv)
-#define glClearNamedFramebufferuiv GLEW_GET_FUN(__glewClearNamedFramebufferuiv)
-#define glCompressedTextureSubImage1D GLEW_GET_FUN(__glewCompressedTextureSubImage1D)
-#define glCompressedTextureSubImage2D GLEW_GET_FUN(__glewCompressedTextureSubImage2D)
-#define glCompressedTextureSubImage3D GLEW_GET_FUN(__glewCompressedTextureSubImage3D)
-#define glCopyNamedBufferSubData GLEW_GET_FUN(__glewCopyNamedBufferSubData)
-#define glCopyTextureSubImage1D GLEW_GET_FUN(__glewCopyTextureSubImage1D)
-#define glCopyTextureSubImage2D GLEW_GET_FUN(__glewCopyTextureSubImage2D)
-#define glCopyTextureSubImage3D GLEW_GET_FUN(__glewCopyTextureSubImage3D)
-#define glCreateBuffers GLEW_GET_FUN(__glewCreateBuffers)
-#define glCreateFramebuffers GLEW_GET_FUN(__glewCreateFramebuffers)
-#define glCreateProgramPipelines GLEW_GET_FUN(__glewCreateProgramPipelines)
-#define glCreateQueries GLEW_GET_FUN(__glewCreateQueries)
-#define glCreateRenderbuffers GLEW_GET_FUN(__glewCreateRenderbuffers)
-#define glCreateSamplers GLEW_GET_FUN(__glewCreateSamplers)
-#define glCreateTextures GLEW_GET_FUN(__glewCreateTextures)
-#define glCreateTransformFeedbacks GLEW_GET_FUN(__glewCreateTransformFeedbacks)
-#define glCreateVertexArrays GLEW_GET_FUN(__glewCreateVertexArrays)
-#define glDisableVertexArrayAttrib GLEW_GET_FUN(__glewDisableVertexArrayAttrib)
-#define glEnableVertexArrayAttrib GLEW_GET_FUN(__glewEnableVertexArrayAttrib)
-#define glFlushMappedNamedBufferRange GLEW_GET_FUN(__glewFlushMappedNamedBufferRange)
-#define glGenerateTextureMipmap GLEW_GET_FUN(__glewGenerateTextureMipmap)
-#define glGetCompressedTextureImage GLEW_GET_FUN(__glewGetCompressedTextureImage)
-#define glGetNamedBufferParameteri64v GLEW_GET_FUN(__glewGetNamedBufferParameteri64v)
-#define glGetNamedBufferParameteriv GLEW_GET_FUN(__glewGetNamedBufferParameteriv)
-#define glGetNamedBufferPointerv GLEW_GET_FUN(__glewGetNamedBufferPointerv)
-#define glGetNamedBufferSubData GLEW_GET_FUN(__glewGetNamedBufferSubData)
-#define glGetNamedFramebufferAttachmentParameteriv GLEW_GET_FUN(__glewGetNamedFramebufferAttachmentParameteriv)
-#define glGetNamedFramebufferParameteriv GLEW_GET_FUN(__glewGetNamedFramebufferParameteriv)
-#define glGetNamedRenderbufferParameteriv GLEW_GET_FUN(__glewGetNamedRenderbufferParameteriv)
-#define glGetQueryBufferObjecti64v GLEW_GET_FUN(__glewGetQueryBufferObjecti64v)
-#define glGetQueryBufferObjectiv GLEW_GET_FUN(__glewGetQueryBufferObjectiv)
-#define glGetQueryBufferObjectui64v GLEW_GET_FUN(__glewGetQueryBufferObjectui64v)
-#define glGetQueryBufferObjectuiv GLEW_GET_FUN(__glewGetQueryBufferObjectuiv)
-#define glGetTextureImage GLEW_GET_FUN(__glewGetTextureImage)
-#define glGetTextureLevelParameterfv GLEW_GET_FUN(__glewGetTextureLevelParameterfv)
-#define glGetTextureLevelParameteriv GLEW_GET_FUN(__glewGetTextureLevelParameteriv)
-#define glGetTextureParameterIiv GLEW_GET_FUN(__glewGetTextureParameterIiv)
-#define glGetTextureParameterIuiv GLEW_GET_FUN(__glewGetTextureParameterIuiv)
-#define glGetTextureParameterfv GLEW_GET_FUN(__glewGetTextureParameterfv)
-#define glGetTextureParameteriv GLEW_GET_FUN(__glewGetTextureParameteriv)
-#define glGetTransformFeedbacki64_v GLEW_GET_FUN(__glewGetTransformFeedbacki64_v)
-#define glGetTransformFeedbacki_v GLEW_GET_FUN(__glewGetTransformFeedbacki_v)
-#define glGetTransformFeedbackiv GLEW_GET_FUN(__glewGetTransformFeedbackiv)
-#define glGetVertexArrayIndexed64iv GLEW_GET_FUN(__glewGetVertexArrayIndexed64iv)
-#define glGetVertexArrayIndexediv GLEW_GET_FUN(__glewGetVertexArrayIndexediv)
-#define glGetVertexArrayiv GLEW_GET_FUN(__glewGetVertexArrayiv)
-#define glInvalidateNamedFramebufferData GLEW_GET_FUN(__glewInvalidateNamedFramebufferData)
-#define glInvalidateNamedFramebufferSubData GLEW_GET_FUN(__glewInvalidateNamedFramebufferSubData)
-#define glMapNamedBuffer GLEW_GET_FUN(__glewMapNamedBuffer)
-#define glMapNamedBufferRange GLEW_GET_FUN(__glewMapNamedBufferRange)
-#define glNamedBufferData GLEW_GET_FUN(__glewNamedBufferData)
-#define glNamedBufferStorage GLEW_GET_FUN(__glewNamedBufferStorage)
-#define glNamedBufferSubData GLEW_GET_FUN(__glewNamedBufferSubData)
-#define glNamedFramebufferDrawBuffer GLEW_GET_FUN(__glewNamedFramebufferDrawBuffer)
-#define glNamedFramebufferDrawBuffers GLEW_GET_FUN(__glewNamedFramebufferDrawBuffers)
-#define glNamedFramebufferParameteri GLEW_GET_FUN(__glewNamedFramebufferParameteri)
-#define glNamedFramebufferReadBuffer GLEW_GET_FUN(__glewNamedFramebufferReadBuffer)
-#define glNamedFramebufferRenderbuffer GLEW_GET_FUN(__glewNamedFramebufferRenderbuffer)
-#define glNamedFramebufferTexture GLEW_GET_FUN(__glewNamedFramebufferTexture)
-#define glNamedFramebufferTextureLayer GLEW_GET_FUN(__glewNamedFramebufferTextureLayer)
-#define glNamedRenderbufferStorage GLEW_GET_FUN(__glewNamedRenderbufferStorage)
-#define glNamedRenderbufferStorageMultisample GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisample)
-#define glTextureBuffer GLEW_GET_FUN(__glewTextureBuffer)
-#define glTextureBufferRange GLEW_GET_FUN(__glewTextureBufferRange)
-#define glTextureParameterIiv GLEW_GET_FUN(__glewTextureParameterIiv)
-#define glTextureParameterIuiv GLEW_GET_FUN(__glewTextureParameterIuiv)
-#define glTextureParameterf GLEW_GET_FUN(__glewTextureParameterf)
-#define glTextureParameterfv GLEW_GET_FUN(__glewTextureParameterfv)
-#define glTextureParameteri GLEW_GET_FUN(__glewTextureParameteri)
-#define glTextureParameteriv GLEW_GET_FUN(__glewTextureParameteriv)
-#define glTextureStorage1D GLEW_GET_FUN(__glewTextureStorage1D)
-#define glTextureStorage2D GLEW_GET_FUN(__glewTextureStorage2D)
-#define glTextureStorage2DMultisample GLEW_GET_FUN(__glewTextureStorage2DMultisample)
-#define glTextureStorage3D GLEW_GET_FUN(__glewTextureStorage3D)
-#define glTextureStorage3DMultisample GLEW_GET_FUN(__glewTextureStorage3DMultisample)
-#define glTextureSubImage1D GLEW_GET_FUN(__glewTextureSubImage1D)
-#define glTextureSubImage2D GLEW_GET_FUN(__glewTextureSubImage2D)
-#define glTextureSubImage3D GLEW_GET_FUN(__glewTextureSubImage3D)
-#define glTransformFeedbackBufferBase GLEW_GET_FUN(__glewTransformFeedbackBufferBase)
-#define glTransformFeedbackBufferRange GLEW_GET_FUN(__glewTransformFeedbackBufferRange)
-#define glUnmapNamedBuffer GLEW_GET_FUN(__glewUnmapNamedBuffer)
-#define glVertexArrayAttribBinding GLEW_GET_FUN(__glewVertexArrayAttribBinding)
-#define glVertexArrayAttribFormat GLEW_GET_FUN(__glewVertexArrayAttribFormat)
-#define glVertexArrayAttribIFormat GLEW_GET_FUN(__glewVertexArrayAttribIFormat)
-#define glVertexArrayAttribLFormat GLEW_GET_FUN(__glewVertexArrayAttribLFormat)
-#define glVertexArrayBindingDivisor GLEW_GET_FUN(__glewVertexArrayBindingDivisor)
-#define glVertexArrayElementBuffer GLEW_GET_FUN(__glewVertexArrayElementBuffer)
-#define glVertexArrayVertexBuffer GLEW_GET_FUN(__glewVertexArrayVertexBuffer)
-#define glVertexArrayVertexBuffers GLEW_GET_FUN(__glewVertexArrayVertexBuffers)
-
-#define GLEW_ARB_direct_state_access GLEW_GET_VAR(__GLEW_ARB_direct_state_access)
-
-#endif /* GL_ARB_direct_state_access */
-
-/* -------------------------- GL_ARB_draw_buffers -------------------------- */
-
-#ifndef GL_ARB_draw_buffers
-#define GL_ARB_draw_buffers 1
-
-#define GL_MAX_DRAW_BUFFERS_ARB 0x8824
-#define GL_DRAW_BUFFER0_ARB 0x8825
-#define GL_DRAW_BUFFER1_ARB 0x8826
-#define GL_DRAW_BUFFER2_ARB 0x8827
-#define GL_DRAW_BUFFER3_ARB 0x8828
-#define GL_DRAW_BUFFER4_ARB 0x8829
-#define GL_DRAW_BUFFER5_ARB 0x882A
-#define GL_DRAW_BUFFER6_ARB 0x882B
-#define GL_DRAW_BUFFER7_ARB 0x882C
-#define GL_DRAW_BUFFER8_ARB 0x882D
-#define GL_DRAW_BUFFER9_ARB 0x882E
-#define GL_DRAW_BUFFER10_ARB 0x882F
-#define GL_DRAW_BUFFER11_ARB 0x8830
-#define GL_DRAW_BUFFER12_ARB 0x8831
-#define GL_DRAW_BUFFER13_ARB 0x8832
-#define GL_DRAW_BUFFER14_ARB 0x8833
-#define GL_DRAW_BUFFER15_ARB 0x8834
-
-typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum* bufs);
-
-#define glDrawBuffersARB GLEW_GET_FUN(__glewDrawBuffersARB)
-
-#define GLEW_ARB_draw_buffers GLEW_GET_VAR(__GLEW_ARB_draw_buffers)
-
-#endif /* GL_ARB_draw_buffers */
-
-/* ----------------------- GL_ARB_draw_buffers_blend ----------------------- */
-
-#ifndef GL_ARB_draw_buffers_blend
-#define GL_ARB_draw_buffers_blend 1
-
-typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode);
-typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-typedef void (GLAPIENTRY * PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst);
-
-#define glBlendEquationSeparateiARB GLEW_GET_FUN(__glewBlendEquationSeparateiARB)
-#define glBlendEquationiARB GLEW_GET_FUN(__glewBlendEquationiARB)
-#define glBlendFuncSeparateiARB GLEW_GET_FUN(__glewBlendFuncSeparateiARB)
-#define glBlendFunciARB GLEW_GET_FUN(__glewBlendFunciARB)
-
-#define GLEW_ARB_draw_buffers_blend GLEW_GET_VAR(__GLEW_ARB_draw_buffers_blend)
-
-#endif /* GL_ARB_draw_buffers_blend */
-
-/* -------------------- GL_ARB_draw_elements_base_vertex ------------------- */
-
-#ifndef GL_ARB_draw_elements_base_vertex
-#define GL_ARB_draw_elements_base_vertex 1
-
-typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex);
-typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei* count, GLenum type, const void *const *indices, GLsizei primcount, const GLint *basevertex);
-
-#define glDrawElementsBaseVertex GLEW_GET_FUN(__glewDrawElementsBaseVertex)
-#define glDrawElementsInstancedBaseVertex GLEW_GET_FUN(__glewDrawElementsInstancedBaseVertex)
-#define glDrawRangeElementsBaseVertex GLEW_GET_FUN(__glewDrawRangeElementsBaseVertex)
-#define glMultiDrawElementsBaseVertex GLEW_GET_FUN(__glewMultiDrawElementsBaseVertex)
-
-#define GLEW_ARB_draw_elements_base_vertex GLEW_GET_VAR(__GLEW_ARB_draw_elements_base_vertex)
-
-#endif /* GL_ARB_draw_elements_base_vertex */
-
-/* -------------------------- GL_ARB_draw_indirect ------------------------- */
-
-#ifndef GL_ARB_draw_indirect
-#define GL_ARB_draw_indirect 1
-
-#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
-#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43
-
-typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect);
-typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect);
-
-#define glDrawArraysIndirect GLEW_GET_FUN(__glewDrawArraysIndirect)
-#define glDrawElementsIndirect GLEW_GET_FUN(__glewDrawElementsIndirect)
-
-#define GLEW_ARB_draw_indirect GLEW_GET_VAR(__GLEW_ARB_draw_indirect)
-
-#endif /* GL_ARB_draw_indirect */
-
-/* ------------------------- GL_ARB_draw_instanced ------------------------- */
-
-#ifndef GL_ARB_draw_instanced
-#define GL_ARB_draw_instanced 1
-
-#define GLEW_ARB_draw_instanced GLEW_GET_VAR(__GLEW_ARB_draw_instanced)
-
-#endif /* GL_ARB_draw_instanced */
-
-/* ------------------------ GL_ARB_enhanced_layouts ------------------------ */
-
-#ifndef GL_ARB_enhanced_layouts
-#define GL_ARB_enhanced_layouts 1
-
-#define GL_LOCATION_COMPONENT 0x934A
-#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B
-#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C
-
-#define GLEW_ARB_enhanced_layouts GLEW_GET_VAR(__GLEW_ARB_enhanced_layouts)
-
-#endif /* GL_ARB_enhanced_layouts */
-
-/* -------------------- GL_ARB_explicit_attrib_location -------------------- */
-
-#ifndef GL_ARB_explicit_attrib_location
-#define GL_ARB_explicit_attrib_location 1
-
-#define GLEW_ARB_explicit_attrib_location GLEW_GET_VAR(__GLEW_ARB_explicit_attrib_location)
-
-#endif /* GL_ARB_explicit_attrib_location */
-
-/* -------------------- GL_ARB_explicit_uniform_location ------------------- */
-
-#ifndef GL_ARB_explicit_uniform_location
-#define GL_ARB_explicit_uniform_location 1
-
-#define GL_MAX_UNIFORM_LOCATIONS 0x826E
-
-#define GLEW_ARB_explicit_uniform_location GLEW_GET_VAR(__GLEW_ARB_explicit_uniform_location)
-
-#endif /* GL_ARB_explicit_uniform_location */
-
-/* ------------------- GL_ARB_fragment_coord_conventions ------------------- */
-
-#ifndef GL_ARB_fragment_coord_conventions
-#define GL_ARB_fragment_coord_conventions 1
-
-#define GLEW_ARB_fragment_coord_conventions GLEW_GET_VAR(__GLEW_ARB_fragment_coord_conventions)
-
-#endif /* GL_ARB_fragment_coord_conventions */
-
-/* --------------------- GL_ARB_fragment_layer_viewport -------------------- */
-
-#ifndef GL_ARB_fragment_layer_viewport
-#define GL_ARB_fragment_layer_viewport 1
-
-#define GLEW_ARB_fragment_layer_viewport GLEW_GET_VAR(__GLEW_ARB_fragment_layer_viewport)
-
-#endif /* GL_ARB_fragment_layer_viewport */
-
-/* ------------------------ GL_ARB_fragment_program ------------------------ */
-
-#ifndef GL_ARB_fragment_program
-#define GL_ARB_fragment_program 1
-
-#define GL_FRAGMENT_PROGRAM_ARB 0x8804
-#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805
-#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806
-#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807
-#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808
-#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809
-#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A
-#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B
-#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C
-#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D
-#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E
-#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F
-#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810
-#define GL_MAX_TEXTURE_COORDS_ARB 0x8871
-#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872
-
-#define GLEW_ARB_fragment_program GLEW_GET_VAR(__GLEW_ARB_fragment_program)
-
-#endif /* GL_ARB_fragment_program */
-
-/* --------------------- GL_ARB_fragment_program_shadow -------------------- */
-
-#ifndef GL_ARB_fragment_program_shadow
-#define GL_ARB_fragment_program_shadow 1
-
-#define GLEW_ARB_fragment_program_shadow GLEW_GET_VAR(__GLEW_ARB_fragment_program_shadow)
-
-#endif /* GL_ARB_fragment_program_shadow */
-
-/* ------------------------- GL_ARB_fragment_shader ------------------------ */
-
-#ifndef GL_ARB_fragment_shader
-#define GL_ARB_fragment_shader 1
-
-#define GL_FRAGMENT_SHADER_ARB 0x8B30
-#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
-
-#define GLEW_ARB_fragment_shader GLEW_GET_VAR(__GLEW_ARB_fragment_shader)
-
-#endif /* GL_ARB_fragment_shader */
-
-/* ------------------- GL_ARB_framebuffer_no_attachments ------------------- */
-
-#ifndef GL_ARB_framebuffer_no_attachments
-#define GL_ARB_framebuffer_no_attachments 1
-
-#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310
-#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311
-#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312
-#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313
-#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
-#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315
-#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316
-#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317
-#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318
-
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param);
-
-#define glFramebufferParameteri GLEW_GET_FUN(__glewFramebufferParameteri)
-#define glGetFramebufferParameteriv GLEW_GET_FUN(__glewGetFramebufferParameteriv)
-#define glGetNamedFramebufferParameterivEXT GLEW_GET_FUN(__glewGetNamedFramebufferParameterivEXT)
-#define glNamedFramebufferParameteriEXT GLEW_GET_FUN(__glewNamedFramebufferParameteriEXT)
-
-#define GLEW_ARB_framebuffer_no_attachments GLEW_GET_VAR(__GLEW_ARB_framebuffer_no_attachments)
-
-#endif /* GL_ARB_framebuffer_no_attachments */
-
-/* ----------------------- GL_ARB_framebuffer_object ----------------------- */
-
-#ifndef GL_ARB_framebuffer_object
-#define GL_ARB_framebuffer_object 1
-
-#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
-#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
-#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
-#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
-#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
-#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
-#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
-#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
-#define GL_FRAMEBUFFER_DEFAULT 0x8218
-#define GL_FRAMEBUFFER_UNDEFINED 0x8219
-#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
-#define GL_INDEX 0x8222
-#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
-#define GL_DEPTH_STENCIL 0x84F9
-#define GL_UNSIGNED_INT_24_8 0x84FA
-#define GL_DEPTH24_STENCIL8 0x88F0
-#define GL_TEXTURE_STENCIL_SIZE 0x88F1
-#define GL_UNSIGNED_NORMALIZED 0x8C17
-#define GL_SRGB 0x8C40
-#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_RENDERBUFFER_BINDING 0x8CA7
-#define GL_READ_FRAMEBUFFER 0x8CA8
-#define GL_DRAW_FRAMEBUFFER 0x8CA9
-#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
-#define GL_RENDERBUFFER_SAMPLES 0x8CAB
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
-#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB
-#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC
-#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
-#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
-#define GL_COLOR_ATTACHMENT0 0x8CE0
-#define GL_COLOR_ATTACHMENT1 0x8CE1
-#define GL_COLOR_ATTACHMENT2 0x8CE2
-#define GL_COLOR_ATTACHMENT3 0x8CE3
-#define GL_COLOR_ATTACHMENT4 0x8CE4
-#define GL_COLOR_ATTACHMENT5 0x8CE5
-#define GL_COLOR_ATTACHMENT6 0x8CE6
-#define GL_COLOR_ATTACHMENT7 0x8CE7
-#define GL_COLOR_ATTACHMENT8 0x8CE8
-#define GL_COLOR_ATTACHMENT9 0x8CE9
-#define GL_COLOR_ATTACHMENT10 0x8CEA
-#define GL_COLOR_ATTACHMENT11 0x8CEB
-#define GL_COLOR_ATTACHMENT12 0x8CEC
-#define GL_COLOR_ATTACHMENT13 0x8CED
-#define GL_COLOR_ATTACHMENT14 0x8CEE
-#define GL_COLOR_ATTACHMENT15 0x8CEF
-#define GL_DEPTH_ATTACHMENT 0x8D00
-#define GL_STENCIL_ATTACHMENT 0x8D20
-#define GL_FRAMEBUFFER 0x8D40
-#define GL_RENDERBUFFER 0x8D41
-#define GL_RENDERBUFFER_WIDTH 0x8D42
-#define GL_RENDERBUFFER_HEIGHT 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
-#define GL_STENCIL_INDEX1 0x8D46
-#define GL_STENCIL_INDEX4 0x8D47
-#define GL_STENCIL_INDEX8 0x8D48
-#define GL_STENCIL_INDEX16 0x8D49
-#define GL_RENDERBUFFER_RED_SIZE 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
-#define GL_MAX_SAMPLES 0x8D57
-
-typedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
-typedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
-typedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
-typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint* framebuffers);
-typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint* renderbuffers);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer);
-typedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint* framebuffers);
-typedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint* renderbuffers);
-typedef void (GLAPIENTRY * PFNGLGENERATEMIPMAPPROC) (GLenum target);
-typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
-typedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
-typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-
-#define glBindFramebuffer GLEW_GET_FUN(__glewBindFramebuffer)
-#define glBindRenderbuffer GLEW_GET_FUN(__glewBindRenderbuffer)
-#define glBlitFramebuffer GLEW_GET_FUN(__glewBlitFramebuffer)
-#define glCheckFramebufferStatus GLEW_GET_FUN(__glewCheckFramebufferStatus)
-#define glDeleteFramebuffers GLEW_GET_FUN(__glewDeleteFramebuffers)
-#define glDeleteRenderbuffers GLEW_GET_FUN(__glewDeleteRenderbuffers)
-#define glFramebufferRenderbuffer GLEW_GET_FUN(__glewFramebufferRenderbuffer)
-#define glFramebufferTexture1D GLEW_GET_FUN(__glewFramebufferTexture1D)
-#define glFramebufferTexture2D GLEW_GET_FUN(__glewFramebufferTexture2D)
-#define glFramebufferTexture3D GLEW_GET_FUN(__glewFramebufferTexture3D)
-#define glFramebufferTextureLayer GLEW_GET_FUN(__glewFramebufferTextureLayer)
-#define glGenFramebuffers GLEW_GET_FUN(__glewGenFramebuffers)
-#define glGenRenderbuffers GLEW_GET_FUN(__glewGenRenderbuffers)
-#define glGenerateMipmap GLEW_GET_FUN(__glewGenerateMipmap)
-#define glGetFramebufferAttachmentParameteriv GLEW_GET_FUN(__glewGetFramebufferAttachmentParameteriv)
-#define glGetRenderbufferParameteriv GLEW_GET_FUN(__glewGetRenderbufferParameteriv)
-#define glIsFramebuffer GLEW_GET_FUN(__glewIsFramebuffer)
-#define glIsRenderbuffer GLEW_GET_FUN(__glewIsRenderbuffer)
-#define glRenderbufferStorage GLEW_GET_FUN(__glewRenderbufferStorage)
-#define glRenderbufferStorageMultisample GLEW_GET_FUN(__glewRenderbufferStorageMultisample)
-
-#define GLEW_ARB_framebuffer_object GLEW_GET_VAR(__GLEW_ARB_framebuffer_object)
-
-#endif /* GL_ARB_framebuffer_object */
-
-/* ------------------------ GL_ARB_framebuffer_sRGB ------------------------ */
-
-#ifndef GL_ARB_framebuffer_sRGB
-#define GL_ARB_framebuffer_sRGB 1
-
-#define GL_FRAMEBUFFER_SRGB 0x8DB9
-
-#define GLEW_ARB_framebuffer_sRGB GLEW_GET_VAR(__GLEW_ARB_framebuffer_sRGB)
-
-#endif /* GL_ARB_framebuffer_sRGB */
-
-/* ------------------------ GL_ARB_geometry_shader4 ------------------------ */
-
-#ifndef GL_ARB_geometry_shader4
-#define GL_ARB_geometry_shader4 1
-
-#define GL_LINES_ADJACENCY_ARB 0xA
-#define GL_LINE_STRIP_ADJACENCY_ARB 0xB
-#define GL_TRIANGLES_ADJACENCY_ARB 0xC
-#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0xD
-#define GL_PROGRAM_POINT_SIZE_ARB 0x8642
-#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
-#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9
-#define GL_GEOMETRY_SHADER_ARB 0x8DD9
-#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA
-#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB
-#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC
-#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD
-#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE
-#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF
-#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0
-#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1
-
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value);
-
-#define glFramebufferTextureARB GLEW_GET_FUN(__glewFramebufferTextureARB)
-#define glFramebufferTextureFaceARB GLEW_GET_FUN(__glewFramebufferTextureFaceARB)
-#define glFramebufferTextureLayerARB GLEW_GET_FUN(__glewFramebufferTextureLayerARB)
-#define glProgramParameteriARB GLEW_GET_FUN(__glewProgramParameteriARB)
-
-#define GLEW_ARB_geometry_shader4 GLEW_GET_VAR(__GLEW_ARB_geometry_shader4)
-
-#endif /* GL_ARB_geometry_shader4 */
-
-/* ----------------------- GL_ARB_get_program_binary ----------------------- */
-
-#ifndef GL_ARB_get_program_binary
-#define GL_ARB_get_program_binary 1
-
-#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
-#define GL_PROGRAM_BINARY_LENGTH 0x8741
-#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
-#define GL_PROGRAM_BINARY_FORMATS 0x87FF
-
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLenum *binaryFormat, void*binary);
-typedef void (GLAPIENTRY * PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
-typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
-
-#define glGetProgramBinary GLEW_GET_FUN(__glewGetProgramBinary)
-#define glProgramBinary GLEW_GET_FUN(__glewProgramBinary)
-#define glProgramParameteri GLEW_GET_FUN(__glewProgramParameteri)
-
-#define GLEW_ARB_get_program_binary GLEW_GET_VAR(__GLEW_ARB_get_program_binary)
-
-#endif /* GL_ARB_get_program_binary */
-
-/* ---------------------- GL_ARB_get_texture_sub_image --------------------- */
-
-#ifndef GL_ARB_get_texture_sub_image
-#define GL_ARB_get_texture_sub_image 1
-
-typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels);
-typedef void (GLAPIENTRY * PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-
-#define glGetCompressedTextureSubImage GLEW_GET_FUN(__glewGetCompressedTextureSubImage)
-#define glGetTextureSubImage GLEW_GET_FUN(__glewGetTextureSubImage)
-
-#define GLEW_ARB_get_texture_sub_image GLEW_GET_VAR(__GLEW_ARB_get_texture_sub_image)
-
-#endif /* GL_ARB_get_texture_sub_image */
-
-/* --------------------------- GL_ARB_gpu_shader5 -------------------------- */
-
-#ifndef GL_ARB_gpu_shader5
-#define GL_ARB_gpu_shader5 1
-
-#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F
-#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A
-#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B
-#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C
-#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D
-#define GL_MAX_VERTEX_STREAMS 0x8E71
-
-#define GLEW_ARB_gpu_shader5 GLEW_GET_VAR(__GLEW_ARB_gpu_shader5)
-
-#endif /* GL_ARB_gpu_shader5 */
-
-/* ------------------------- GL_ARB_gpu_shader_fp64 ------------------------ */
-
-#ifndef GL_ARB_gpu_shader_fp64
-#define GL_ARB_gpu_shader_fp64 1
-
-#define GL_DOUBLE_MAT2 0x8F46
-#define GL_DOUBLE_MAT3 0x8F47
-#define GL_DOUBLE_MAT4 0x8F48
-#define GL_DOUBLE_MAT2x3 0x8F49
-#define GL_DOUBLE_MAT2x4 0x8F4A
-#define GL_DOUBLE_MAT3x2 0x8F4B
-#define GL_DOUBLE_MAT3x4 0x8F4C
-#define GL_DOUBLE_MAT4x2 0x8F4D
-#define GL_DOUBLE_MAT4x3 0x8F4E
-#define GL_DOUBLE_VEC2 0x8FFC
-#define GL_DOUBLE_VEC3 0x8FFD
-#define GL_DOUBLE_VEC4 0x8FFE
-
-typedef void (GLAPIENTRY * PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1DPROC) (GLint location, GLdouble x);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-
-#define glGetUniformdv GLEW_GET_FUN(__glewGetUniformdv)
-#define glUniform1d GLEW_GET_FUN(__glewUniform1d)
-#define glUniform1dv GLEW_GET_FUN(__glewUniform1dv)
-#define glUniform2d GLEW_GET_FUN(__glewUniform2d)
-#define glUniform2dv GLEW_GET_FUN(__glewUniform2dv)
-#define glUniform3d GLEW_GET_FUN(__glewUniform3d)
-#define glUniform3dv GLEW_GET_FUN(__glewUniform3dv)
-#define glUniform4d GLEW_GET_FUN(__glewUniform4d)
-#define glUniform4dv GLEW_GET_FUN(__glewUniform4dv)
-#define glUniformMatrix2dv GLEW_GET_FUN(__glewUniformMatrix2dv)
-#define glUniformMatrix2x3dv GLEW_GET_FUN(__glewUniformMatrix2x3dv)
-#define glUniformMatrix2x4dv GLEW_GET_FUN(__glewUniformMatrix2x4dv)
-#define glUniformMatrix3dv GLEW_GET_FUN(__glewUniformMatrix3dv)
-#define glUniformMatrix3x2dv GLEW_GET_FUN(__glewUniformMatrix3x2dv)
-#define glUniformMatrix3x4dv GLEW_GET_FUN(__glewUniformMatrix3x4dv)
-#define glUniformMatrix4dv GLEW_GET_FUN(__glewUniformMatrix4dv)
-#define glUniformMatrix4x2dv GLEW_GET_FUN(__glewUniformMatrix4x2dv)
-#define glUniformMatrix4x3dv GLEW_GET_FUN(__glewUniformMatrix4x3dv)
-
-#define GLEW_ARB_gpu_shader_fp64 GLEW_GET_VAR(__GLEW_ARB_gpu_shader_fp64)
-
-#endif /* GL_ARB_gpu_shader_fp64 */
-
-/* ------------------------ GL_ARB_half_float_pixel ------------------------ */
-
-#ifndef GL_ARB_half_float_pixel
-#define GL_ARB_half_float_pixel 1
-
-#define GL_HALF_FLOAT_ARB 0x140B
-
-#define GLEW_ARB_half_float_pixel GLEW_GET_VAR(__GLEW_ARB_half_float_pixel)
-
-#endif /* GL_ARB_half_float_pixel */
-
-/* ------------------------ GL_ARB_half_float_vertex ----------------------- */
-
-#ifndef GL_ARB_half_float_vertex
-#define GL_ARB_half_float_vertex 1
-
-#define GL_HALF_FLOAT 0x140B
-
-#define GLEW_ARB_half_float_vertex GLEW_GET_VAR(__GLEW_ARB_half_float_vertex)
-
-#endif /* GL_ARB_half_float_vertex */
-
-/* ----------------------------- GL_ARB_imaging ---------------------------- */
-
-#ifndef GL_ARB_imaging
-#define GL_ARB_imaging 1
-
-#define GL_CONSTANT_COLOR 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
-#define GL_CONSTANT_ALPHA 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
-#define GL_BLEND_COLOR 0x8005
-#define GL_FUNC_ADD 0x8006
-#define GL_MIN 0x8007
-#define GL_MAX 0x8008
-#define GL_BLEND_EQUATION 0x8009
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#define GL_CONVOLUTION_1D 0x8010
-#define GL_CONVOLUTION_2D 0x8011
-#define GL_SEPARABLE_2D 0x8012
-#define GL_CONVOLUTION_BORDER_MODE 0x8013
-#define GL_CONVOLUTION_FILTER_SCALE 0x8014
-#define GL_CONVOLUTION_FILTER_BIAS 0x8015
-#define GL_REDUCE 0x8016
-#define GL_CONVOLUTION_FORMAT 0x8017
-#define GL_CONVOLUTION_WIDTH 0x8018
-#define GL_CONVOLUTION_HEIGHT 0x8019
-#define GL_MAX_CONVOLUTION_WIDTH 0x801A
-#define GL_MAX_CONVOLUTION_HEIGHT 0x801B
-#define GL_POST_CONVOLUTION_RED_SCALE 0x801C
-#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D
-#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E
-#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F
-#define GL_POST_CONVOLUTION_RED_BIAS 0x8020
-#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021
-#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022
-#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023
-#define GL_HISTOGRAM 0x8024
-#define GL_PROXY_HISTOGRAM 0x8025
-#define GL_HISTOGRAM_WIDTH 0x8026
-#define GL_HISTOGRAM_FORMAT 0x8027
-#define GL_HISTOGRAM_RED_SIZE 0x8028
-#define GL_HISTOGRAM_GREEN_SIZE 0x8029
-#define GL_HISTOGRAM_BLUE_SIZE 0x802A
-#define GL_HISTOGRAM_ALPHA_SIZE 0x802B
-#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C
-#define GL_HISTOGRAM_SINK 0x802D
-#define GL_MINMAX 0x802E
-#define GL_MINMAX_FORMAT 0x802F
-#define GL_MINMAX_SINK 0x8030
-#define GL_TABLE_TOO_LARGE 0x8031
-#define GL_COLOR_MATRIX 0x80B1
-#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2
-#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3
-#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4
-#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5
-#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6
-#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7
-#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8
-#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9
-#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA
-#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB
-#define GL_COLOR_TABLE 0x80D0
-#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1
-#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2
-#define GL_PROXY_COLOR_TABLE 0x80D3
-#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
-#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
-#define GL_COLOR_TABLE_SCALE 0x80D6
-#define GL_COLOR_TABLE_BIAS 0x80D7
-#define GL_COLOR_TABLE_FORMAT 0x80D8
-#define GL_COLOR_TABLE_WIDTH 0x80D9
-#define GL_COLOR_TABLE_RED_SIZE 0x80DA
-#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB
-#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC
-#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD
-#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE
-#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF
-#define GL_IGNORE_BORDER 0x8150
-#define GL_CONSTANT_BORDER 0x8151
-#define GL_WRAP_BORDER 0x8152
-#define GL_REPLICATE_BORDER 0x8153
-#define GL_CONVOLUTION_BORDER_COLOR 0x8154
-
-typedef void (GLAPIENTRY * PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table);
-typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image);
-typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image);
-typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params);
-typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params);
-typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (GLAPIENTRY * PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
-typedef void (GLAPIENTRY * PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, void *table);
-typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, void *image);
-typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
-typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GLAPIENTRY * PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum types, void *values);
-typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GLAPIENTRY * PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span);
-typedef void (GLAPIENTRY * PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
-typedef void (GLAPIENTRY * PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);
-typedef void (GLAPIENTRY * PFNGLRESETHISTOGRAMPROC) (GLenum target);
-typedef void (GLAPIENTRY * PFNGLRESETMINMAXPROC) (GLenum target);
-typedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column);
-
-#define glColorSubTable GLEW_GET_FUN(__glewColorSubTable)
-#define glColorTable GLEW_GET_FUN(__glewColorTable)
-#define glColorTableParameterfv GLEW_GET_FUN(__glewColorTableParameterfv)
-#define glColorTableParameteriv GLEW_GET_FUN(__glewColorTableParameteriv)
-#define glConvolutionFilter1D GLEW_GET_FUN(__glewConvolutionFilter1D)
-#define glConvolutionFilter2D GLEW_GET_FUN(__glewConvolutionFilter2D)
-#define glConvolutionParameterf GLEW_GET_FUN(__glewConvolutionParameterf)
-#define glConvolutionParameterfv GLEW_GET_FUN(__glewConvolutionParameterfv)
-#define glConvolutionParameteri GLEW_GET_FUN(__glewConvolutionParameteri)
-#define glConvolutionParameteriv GLEW_GET_FUN(__glewConvolutionParameteriv)
-#define glCopyColorSubTable GLEW_GET_FUN(__glewCopyColorSubTable)
-#define glCopyColorTable GLEW_GET_FUN(__glewCopyColorTable)
-#define glCopyConvolutionFilter1D GLEW_GET_FUN(__glewCopyConvolutionFilter1D)
-#define glCopyConvolutionFilter2D GLEW_GET_FUN(__glewCopyConvolutionFilter2D)
-#define glGetColorTable GLEW_GET_FUN(__glewGetColorTable)
-#define glGetColorTableParameterfv GLEW_GET_FUN(__glewGetColorTableParameterfv)
-#define glGetColorTableParameteriv GLEW_GET_FUN(__glewGetColorTableParameteriv)
-#define glGetConvolutionFilter GLEW_GET_FUN(__glewGetConvolutionFilter)
-#define glGetConvolutionParameterfv GLEW_GET_FUN(__glewGetConvolutionParameterfv)
-#define glGetConvolutionParameteriv GLEW_GET_FUN(__glewGetConvolutionParameteriv)
-#define glGetHistogram GLEW_GET_FUN(__glewGetHistogram)
-#define glGetHistogramParameterfv GLEW_GET_FUN(__glewGetHistogramParameterfv)
-#define glGetHistogramParameteriv GLEW_GET_FUN(__glewGetHistogramParameteriv)
-#define glGetMinmax GLEW_GET_FUN(__glewGetMinmax)
-#define glGetMinmaxParameterfv GLEW_GET_FUN(__glewGetMinmaxParameterfv)
-#define glGetMinmaxParameteriv GLEW_GET_FUN(__glewGetMinmaxParameteriv)
-#define glGetSeparableFilter GLEW_GET_FUN(__glewGetSeparableFilter)
-#define glHistogram GLEW_GET_FUN(__glewHistogram)
-#define glMinmax GLEW_GET_FUN(__glewMinmax)
-#define glResetHistogram GLEW_GET_FUN(__glewResetHistogram)
-#define glResetMinmax GLEW_GET_FUN(__glewResetMinmax)
-#define glSeparableFilter2D GLEW_GET_FUN(__glewSeparableFilter2D)
-
-#define GLEW_ARB_imaging GLEW_GET_VAR(__GLEW_ARB_imaging)
-
-#endif /* GL_ARB_imaging */
-
-/* ----------------------- GL_ARB_indirect_parameters ---------------------- */
-
-#ifndef GL_ARB_indirect_parameters
-#define GL_ARB_indirect_parameters 1
-
-#define GL_PARAMETER_BUFFER_ARB 0x80EE
-#define GL_PARAMETER_BUFFER_BINDING_ARB 0x80EF
-
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-
-#define glMultiDrawArraysIndirectCountARB GLEW_GET_FUN(__glewMultiDrawArraysIndirectCountARB)
-#define glMultiDrawElementsIndirectCountARB GLEW_GET_FUN(__glewMultiDrawElementsIndirectCountARB)
-
-#define GLEW_ARB_indirect_parameters GLEW_GET_VAR(__GLEW_ARB_indirect_parameters)
-
-#endif /* GL_ARB_indirect_parameters */
-
-/* ------------------------ GL_ARB_instanced_arrays ------------------------ */
-
-#ifndef GL_ARB_instanced_arrays
-#define GL_ARB_instanced_arrays 1
-
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE
-
-typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
-
-#define glDrawArraysInstancedARB GLEW_GET_FUN(__glewDrawArraysInstancedARB)
-#define glDrawElementsInstancedARB GLEW_GET_FUN(__glewDrawElementsInstancedARB)
-#define glVertexAttribDivisorARB GLEW_GET_FUN(__glewVertexAttribDivisorARB)
-
-#define GLEW_ARB_instanced_arrays GLEW_GET_VAR(__GLEW_ARB_instanced_arrays)
-
-#endif /* GL_ARB_instanced_arrays */
-
-/* ---------------------- GL_ARB_internalformat_query ---------------------- */
-
-#ifndef GL_ARB_internalformat_query
-#define GL_ARB_internalformat_query 1
-
-#define GL_NUM_SAMPLE_COUNTS 0x9380
-
-typedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params);
-
-#define glGetInternalformativ GLEW_GET_FUN(__glewGetInternalformativ)
-
-#define GLEW_ARB_internalformat_query GLEW_GET_VAR(__GLEW_ARB_internalformat_query)
-
-#endif /* GL_ARB_internalformat_query */
-
-/* ---------------------- GL_ARB_internalformat_query2 --------------------- */
-
-#ifndef GL_ARB_internalformat_query2
-#define GL_ARB_internalformat_query2 1
-
-#define GL_INTERNALFORMAT_SUPPORTED 0x826F
-#define GL_INTERNALFORMAT_PREFERRED 0x8270
-#define GL_INTERNALFORMAT_RED_SIZE 0x8271
-#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272
-#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273
-#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274
-#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275
-#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276
-#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277
-#define GL_INTERNALFORMAT_RED_TYPE 0x8278
-#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279
-#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A
-#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B
-#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C
-#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D
-#define GL_MAX_WIDTH 0x827E
-#define GL_MAX_HEIGHT 0x827F
-#define GL_MAX_DEPTH 0x8280
-#define GL_MAX_LAYERS 0x8281
-#define GL_MAX_COMBINED_DIMENSIONS 0x8282
-#define GL_COLOR_COMPONENTS 0x8283
-#define GL_DEPTH_COMPONENTS 0x8284
-#define GL_STENCIL_COMPONENTS 0x8285
-#define GL_COLOR_RENDERABLE 0x8286
-#define GL_DEPTH_RENDERABLE 0x8287
-#define GL_STENCIL_RENDERABLE 0x8288
-#define GL_FRAMEBUFFER_RENDERABLE 0x8289
-#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A
-#define GL_FRAMEBUFFER_BLEND 0x828B
-#define GL_READ_PIXELS 0x828C
-#define GL_READ_PIXELS_FORMAT 0x828D
-#define GL_READ_PIXELS_TYPE 0x828E
-#define GL_TEXTURE_IMAGE_FORMAT 0x828F
-#define GL_TEXTURE_IMAGE_TYPE 0x8290
-#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291
-#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292
-#define GL_MIPMAP 0x8293
-#define GL_MANUAL_GENERATE_MIPMAP 0x8294
-#define GL_AUTO_GENERATE_MIPMAP 0x8295
-#define GL_COLOR_ENCODING 0x8296
-#define GL_SRGB_READ 0x8297
-#define GL_SRGB_WRITE 0x8298
-#define GL_SRGB_DECODE_ARB 0x8299
-#define GL_FILTER 0x829A
-#define GL_VERTEX_TEXTURE 0x829B
-#define GL_TESS_CONTROL_TEXTURE 0x829C
-#define GL_TESS_EVALUATION_TEXTURE 0x829D
-#define GL_GEOMETRY_TEXTURE 0x829E
-#define GL_FRAGMENT_TEXTURE 0x829F
-#define GL_COMPUTE_TEXTURE 0x82A0
-#define GL_TEXTURE_SHADOW 0x82A1
-#define GL_TEXTURE_GATHER 0x82A2
-#define GL_TEXTURE_GATHER_SHADOW 0x82A3
-#define GL_SHADER_IMAGE_LOAD 0x82A4
-#define GL_SHADER_IMAGE_STORE 0x82A5
-#define GL_SHADER_IMAGE_ATOMIC 0x82A6
-#define GL_IMAGE_TEXEL_SIZE 0x82A7
-#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8
-#define GL_IMAGE_PIXEL_FORMAT 0x82A9
-#define GL_IMAGE_PIXEL_TYPE 0x82AA
-#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC
-#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD
-#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE
-#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF
-#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1
-#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2
-#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3
-#define GL_CLEAR_BUFFER 0x82B4
-#define GL_TEXTURE_VIEW 0x82B5
-#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6
-#define GL_FULL_SUPPORT 0x82B7
-#define GL_CAVEAT_SUPPORT 0x82B8
-#define GL_IMAGE_CLASS_4_X_32 0x82B9
-#define GL_IMAGE_CLASS_2_X_32 0x82BA
-#define GL_IMAGE_CLASS_1_X_32 0x82BB
-#define GL_IMAGE_CLASS_4_X_16 0x82BC
-#define GL_IMAGE_CLASS_2_X_16 0x82BD
-#define GL_IMAGE_CLASS_1_X_16 0x82BE
-#define GL_IMAGE_CLASS_4_X_8 0x82BF
-#define GL_IMAGE_CLASS_2_X_8 0x82C0
-#define GL_IMAGE_CLASS_1_X_8 0x82C1
-#define GL_IMAGE_CLASS_11_11_10 0x82C2
-#define GL_IMAGE_CLASS_10_10_10_2 0x82C3
-#define GL_VIEW_CLASS_128_BITS 0x82C4
-#define GL_VIEW_CLASS_96_BITS 0x82C5
-#define GL_VIEW_CLASS_64_BITS 0x82C6
-#define GL_VIEW_CLASS_48_BITS 0x82C7
-#define GL_VIEW_CLASS_32_BITS 0x82C8
-#define GL_VIEW_CLASS_24_BITS 0x82C9
-#define GL_VIEW_CLASS_16_BITS 0x82CA
-#define GL_VIEW_CLASS_8_BITS 0x82CB
-#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC
-#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD
-#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE
-#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF
-#define GL_VIEW_CLASS_RGTC1_RED 0x82D0
-#define GL_VIEW_CLASS_RGTC2_RG 0x82D1
-#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2
-#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3
-
-typedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64* params);
-
-#define glGetInternalformati64v GLEW_GET_FUN(__glewGetInternalformati64v)
-
-#define GLEW_ARB_internalformat_query2 GLEW_GET_VAR(__GLEW_ARB_internalformat_query2)
-
-#endif /* GL_ARB_internalformat_query2 */
-
-/* ----------------------- GL_ARB_invalidate_subdata ----------------------- */
-
-#ifndef GL_ARB_invalidate_subdata
-#define GL_ARB_invalidate_subdata 1
-
-typedef void (GLAPIENTRY * PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
-typedef void (GLAPIENTRY * PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum* attachments);
-typedef void (GLAPIENTRY * PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level);
-typedef void (GLAPIENTRY * PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
-
-#define glInvalidateBufferData GLEW_GET_FUN(__glewInvalidateBufferData)
-#define glInvalidateBufferSubData GLEW_GET_FUN(__glewInvalidateBufferSubData)
-#define glInvalidateFramebuffer GLEW_GET_FUN(__glewInvalidateFramebuffer)
-#define glInvalidateSubFramebuffer GLEW_GET_FUN(__glewInvalidateSubFramebuffer)
-#define glInvalidateTexImage GLEW_GET_FUN(__glewInvalidateTexImage)
-#define glInvalidateTexSubImage GLEW_GET_FUN(__glewInvalidateTexSubImage)
-
-#define GLEW_ARB_invalidate_subdata GLEW_GET_VAR(__GLEW_ARB_invalidate_subdata)
-
-#endif /* GL_ARB_invalidate_subdata */
-
-/* ---------------------- GL_ARB_map_buffer_alignment ---------------------- */
-
-#ifndef GL_ARB_map_buffer_alignment
-#define GL_ARB_map_buffer_alignment 1
-
-#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC
-
-#define GLEW_ARB_map_buffer_alignment GLEW_GET_VAR(__GLEW_ARB_map_buffer_alignment)
-
-#endif /* GL_ARB_map_buffer_alignment */
-
-/* ------------------------ GL_ARB_map_buffer_range ------------------------ */
-
-#ifndef GL_ARB_map_buffer_range
-#define GL_ARB_map_buffer_range 1
-
-#define GL_MAP_READ_BIT 0x0001
-#define GL_MAP_WRITE_BIT 0x0002
-#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
-#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
-#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
-#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
-
-typedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
-typedef void * (GLAPIENTRY * PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-
-#define glFlushMappedBufferRange GLEW_GET_FUN(__glewFlushMappedBufferRange)
-#define glMapBufferRange GLEW_GET_FUN(__glewMapBufferRange)
-
-#define GLEW_ARB_map_buffer_range GLEW_GET_VAR(__GLEW_ARB_map_buffer_range)
-
-#endif /* GL_ARB_map_buffer_range */
-
-/* ------------------------- GL_ARB_matrix_palette ------------------------- */
-
-#ifndef GL_ARB_matrix_palette
-#define GL_ARB_matrix_palette 1
-
-#define GL_MATRIX_PALETTE_ARB 0x8840
-#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841
-#define GL_MAX_PALETTE_MATRICES_ARB 0x8842
-#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843
-#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844
-#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845
-#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846
-#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847
-#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848
-#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849
-
-typedef void (GLAPIENTRY * PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index);
-typedef void (GLAPIENTRY * PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, void *pointer);
-typedef void (GLAPIENTRY * PFNGLMATRIXINDEXUBVARBPROC) (GLint size, GLubyte *indices);
-typedef void (GLAPIENTRY * PFNGLMATRIXINDEXUIVARBPROC) (GLint size, GLuint *indices);
-typedef void (GLAPIENTRY * PFNGLMATRIXINDEXUSVARBPROC) (GLint size, GLushort *indices);
-
-#define glCurrentPaletteMatrixARB GLEW_GET_FUN(__glewCurrentPaletteMatrixARB)
-#define glMatrixIndexPointerARB GLEW_GET_FUN(__glewMatrixIndexPointerARB)
-#define glMatrixIndexubvARB GLEW_GET_FUN(__glewMatrixIndexubvARB)
-#define glMatrixIndexuivARB GLEW_GET_FUN(__glewMatrixIndexuivARB)
-#define glMatrixIndexusvARB GLEW_GET_FUN(__glewMatrixIndexusvARB)
-
-#define GLEW_ARB_matrix_palette GLEW_GET_VAR(__GLEW_ARB_matrix_palette)
-
-#endif /* GL_ARB_matrix_palette */
-
-/* --------------------------- GL_ARB_multi_bind --------------------------- */
-
-#ifndef GL_ARB_multi_bind
-#define GL_ARB_multi_bind 1
-
-typedef void (GLAPIENTRY * PFNGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint* buffers);
-typedef void (GLAPIENTRY * PFNGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint* buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
-typedef void (GLAPIENTRY * PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint* textures);
-typedef void (GLAPIENTRY * PFNGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint* samplers);
-typedef void (GLAPIENTRY * PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint* textures);
-typedef void (GLAPIENTRY * PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint* buffers, const GLintptr *offsets, const GLsizei *strides);
-
-#define glBindBuffersBase GLEW_GET_FUN(__glewBindBuffersBase)
-#define glBindBuffersRange GLEW_GET_FUN(__glewBindBuffersRange)
-#define glBindImageTextures GLEW_GET_FUN(__glewBindImageTextures)
-#define glBindSamplers GLEW_GET_FUN(__glewBindSamplers)
-#define glBindTextures GLEW_GET_FUN(__glewBindTextures)
-#define glBindVertexBuffers GLEW_GET_FUN(__glewBindVertexBuffers)
-
-#define GLEW_ARB_multi_bind GLEW_GET_VAR(__GLEW_ARB_multi_bind)
-
-#endif /* GL_ARB_multi_bind */
-
-/* ----------------------- GL_ARB_multi_draw_indirect ---------------------- */
-
-#ifndef GL_ARB_multi_draw_indirect
-#define GL_ARB_multi_draw_indirect 1
-
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride);
-
-#define glMultiDrawArraysIndirect GLEW_GET_FUN(__glewMultiDrawArraysIndirect)
-#define glMultiDrawElementsIndirect GLEW_GET_FUN(__glewMultiDrawElementsIndirect)
-
-#define GLEW_ARB_multi_draw_indirect GLEW_GET_VAR(__GLEW_ARB_multi_draw_indirect)
-
-#endif /* GL_ARB_multi_draw_indirect */
-
-/* --------------------------- GL_ARB_multisample -------------------------- */
-
-#ifndef GL_ARB_multisample
-#define GL_ARB_multisample 1
-
-#define GL_MULTISAMPLE_ARB 0x809D
-#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F
-#define GL_SAMPLE_COVERAGE_ARB 0x80A0
-#define GL_SAMPLE_BUFFERS_ARB 0x80A8
-#define GL_SAMPLES_ARB 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB
-#define GL_MULTISAMPLE_BIT_ARB 0x20000000
-
-typedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert);
-
-#define glSampleCoverageARB GLEW_GET_FUN(__glewSampleCoverageARB)
-
-#define GLEW_ARB_multisample GLEW_GET_VAR(__GLEW_ARB_multisample)
-
-#endif /* GL_ARB_multisample */
-
-/* -------------------------- GL_ARB_multitexture -------------------------- */
-
-#ifndef GL_ARB_multitexture
-#define GL_ARB_multitexture 1
-
-#define GL_TEXTURE0_ARB 0x84C0
-#define GL_TEXTURE1_ARB 0x84C1
-#define GL_TEXTURE2_ARB 0x84C2
-#define GL_TEXTURE3_ARB 0x84C3
-#define GL_TEXTURE4_ARB 0x84C4
-#define GL_TEXTURE5_ARB 0x84C5
-#define GL_TEXTURE6_ARB 0x84C6
-#define GL_TEXTURE7_ARB 0x84C7
-#define GL_TEXTURE8_ARB 0x84C8
-#define GL_TEXTURE9_ARB 0x84C9
-#define GL_TEXTURE10_ARB 0x84CA
-#define GL_TEXTURE11_ARB 0x84CB
-#define GL_TEXTURE12_ARB 0x84CC
-#define GL_TEXTURE13_ARB 0x84CD
-#define GL_TEXTURE14_ARB 0x84CE
-#define GL_TEXTURE15_ARB 0x84CF
-#define GL_TEXTURE16_ARB 0x84D0
-#define GL_TEXTURE17_ARB 0x84D1
-#define GL_TEXTURE18_ARB 0x84D2
-#define GL_TEXTURE19_ARB 0x84D3
-#define GL_TEXTURE20_ARB 0x84D4
-#define GL_TEXTURE21_ARB 0x84D5
-#define GL_TEXTURE22_ARB 0x84D6
-#define GL_TEXTURE23_ARB 0x84D7
-#define GL_TEXTURE24_ARB 0x84D8
-#define GL_TEXTURE25_ARB 0x84D9
-#define GL_TEXTURE26_ARB 0x84DA
-#define GL_TEXTURE27_ARB 0x84DB
-#define GL_TEXTURE28_ARB 0x84DC
-#define GL_TEXTURE29_ARB 0x84DD
-#define GL_TEXTURE30_ARB 0x84DE
-#define GL_TEXTURE31_ARB 0x84DF
-#define GL_ACTIVE_TEXTURE_ARB 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
-#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
-
-typedef void (GLAPIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
-typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
-
-#define glActiveTextureARB GLEW_GET_FUN(__glewActiveTextureARB)
-#define glClientActiveTextureARB GLEW_GET_FUN(__glewClientActiveTextureARB)
-#define glMultiTexCoord1dARB GLEW_GET_FUN(__glewMultiTexCoord1dARB)
-#define glMultiTexCoord1dvARB GLEW_GET_FUN(__glewMultiTexCoord1dvARB)
-#define glMultiTexCoord1fARB GLEW_GET_FUN(__glewMultiTexCoord1fARB)
-#define glMultiTexCoord1fvARB GLEW_GET_FUN(__glewMultiTexCoord1fvARB)
-#define glMultiTexCoord1iARB GLEW_GET_FUN(__glewMultiTexCoord1iARB)
-#define glMultiTexCoord1ivARB GLEW_GET_FUN(__glewMultiTexCoord1ivARB)
-#define glMultiTexCoord1sARB GLEW_GET_FUN(__glewMultiTexCoord1sARB)
-#define glMultiTexCoord1svARB GLEW_GET_FUN(__glewMultiTexCoord1svARB)
-#define glMultiTexCoord2dARB GLEW_GET_FUN(__glewMultiTexCoord2dARB)
-#define glMultiTexCoord2dvARB GLEW_GET_FUN(__glewMultiTexCoord2dvARB)
-#define glMultiTexCoord2fARB GLEW_GET_FUN(__glewMultiTexCoord2fARB)
-#define glMultiTexCoord2fvARB GLEW_GET_FUN(__glewMultiTexCoord2fvARB)
-#define glMultiTexCoord2iARB GLEW_GET_FUN(__glewMultiTexCoord2iARB)
-#define glMultiTexCoord2ivARB GLEW_GET_FUN(__glewMultiTexCoord2ivARB)
-#define glMultiTexCoord2sARB GLEW_GET_FUN(__glewMultiTexCoord2sARB)
-#define glMultiTexCoord2svARB GLEW_GET_FUN(__glewMultiTexCoord2svARB)
-#define glMultiTexCoord3dARB GLEW_GET_FUN(__glewMultiTexCoord3dARB)
-#define glMultiTexCoord3dvARB GLEW_GET_FUN(__glewMultiTexCoord3dvARB)
-#define glMultiTexCoord3fARB GLEW_GET_FUN(__glewMultiTexCoord3fARB)
-#define glMultiTexCoord3fvARB GLEW_GET_FUN(__glewMultiTexCoord3fvARB)
-#define glMultiTexCoord3iARB GLEW_GET_FUN(__glewMultiTexCoord3iARB)
-#define glMultiTexCoord3ivARB GLEW_GET_FUN(__glewMultiTexCoord3ivARB)
-#define glMultiTexCoord3sARB GLEW_GET_FUN(__glewMultiTexCoord3sARB)
-#define glMultiTexCoord3svARB GLEW_GET_FUN(__glewMultiTexCoord3svARB)
-#define glMultiTexCoord4dARB GLEW_GET_FUN(__glewMultiTexCoord4dARB)
-#define glMultiTexCoord4dvARB GLEW_GET_FUN(__glewMultiTexCoord4dvARB)
-#define glMultiTexCoord4fARB GLEW_GET_FUN(__glewMultiTexCoord4fARB)
-#define glMultiTexCoord4fvARB GLEW_GET_FUN(__glewMultiTexCoord4fvARB)
-#define glMultiTexCoord4iARB GLEW_GET_FUN(__glewMultiTexCoord4iARB)
-#define glMultiTexCoord4ivARB GLEW_GET_FUN(__glewMultiTexCoord4ivARB)
-#define glMultiTexCoord4sARB GLEW_GET_FUN(__glewMultiTexCoord4sARB)
-#define glMultiTexCoord4svARB GLEW_GET_FUN(__glewMultiTexCoord4svARB)
-
-#define GLEW_ARB_multitexture GLEW_GET_VAR(__GLEW_ARB_multitexture)
-
-#endif /* GL_ARB_multitexture */
-
-/* ------------------------- GL_ARB_occlusion_query ------------------------ */
-
-#ifndef GL_ARB_occlusion_query
-#define GL_ARB_occlusion_query 1
-
-#define GL_QUERY_COUNTER_BITS_ARB 0x8864
-#define GL_CURRENT_QUERY_ARB 0x8865
-#define GL_QUERY_RESULT_ARB 0x8866
-#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
-#define GL_SAMPLES_PASSED_ARB 0x8914
-
-typedef void (GLAPIENTRY * PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id);
-typedef void (GLAPIENTRY * PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLENDQUERYARBPROC) (GLenum target);
-typedef void (GLAPIENTRY * PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISQUERYARBPROC) (GLuint id);
-
-#define glBeginQueryARB GLEW_GET_FUN(__glewBeginQueryARB)
-#define glDeleteQueriesARB GLEW_GET_FUN(__glewDeleteQueriesARB)
-#define glEndQueryARB GLEW_GET_FUN(__glewEndQueryARB)
-#define glGenQueriesARB GLEW_GET_FUN(__glewGenQueriesARB)
-#define glGetQueryObjectivARB GLEW_GET_FUN(__glewGetQueryObjectivARB)
-#define glGetQueryObjectuivARB GLEW_GET_FUN(__glewGetQueryObjectuivARB)
-#define glGetQueryivARB GLEW_GET_FUN(__glewGetQueryivARB)
-#define glIsQueryARB GLEW_GET_FUN(__glewIsQueryARB)
-
-#define GLEW_ARB_occlusion_query GLEW_GET_VAR(__GLEW_ARB_occlusion_query)
-
-#endif /* GL_ARB_occlusion_query */
-
-/* ------------------------ GL_ARB_occlusion_query2 ------------------------ */
-
-#ifndef GL_ARB_occlusion_query2
-#define GL_ARB_occlusion_query2 1
-
-#define GL_ANY_SAMPLES_PASSED 0x8C2F
-
-#define GLEW_ARB_occlusion_query2 GLEW_GET_VAR(__GLEW_ARB_occlusion_query2)
-
-#endif /* GL_ARB_occlusion_query2 */
-
-/* -------------------- GL_ARB_pipeline_statistics_query ------------------- */
-
-#ifndef GL_ARB_pipeline_statistics_query
-#define GL_ARB_pipeline_statistics_query 1
-
-#define GL_VERTICES_SUBMITTED_ARB 0x82EE
-#define GL_PRIMITIVES_SUBMITTED_ARB 0x82EF
-#define GL_VERTEX_SHADER_INVOCATIONS_ARB 0x82F0
-#define GL_TESS_CONTROL_SHADER_PATCHES_ARB 0x82F1
-#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 0x82F2
-#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 0x82F3
-#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB 0x82F4
-#define GL_COMPUTE_SHADER_INVOCATIONS_ARB 0x82F5
-#define GL_CLIPPING_INPUT_PRIMITIVES_ARB 0x82F6
-#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB 0x82F7
-#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F
-
-#define GLEW_ARB_pipeline_statistics_query GLEW_GET_VAR(__GLEW_ARB_pipeline_statistics_query)
-
-#endif /* GL_ARB_pipeline_statistics_query */
-
-/* ----------------------- GL_ARB_pixel_buffer_object ---------------------- */
-
-#ifndef GL_ARB_pixel_buffer_object
-#define GL_ARB_pixel_buffer_object 1
-
-#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF
-
-#define GLEW_ARB_pixel_buffer_object GLEW_GET_VAR(__GLEW_ARB_pixel_buffer_object)
-
-#endif /* GL_ARB_pixel_buffer_object */
-
-/* ------------------------ GL_ARB_point_parameters ------------------------ */
-
-#ifndef GL_ARB_point_parameters
-#define GL_ARB_point_parameters 1
-
-#define GL_POINT_SIZE_MIN_ARB 0x8126
-#define GL_POINT_SIZE_MAX_ARB 0x8127
-#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128
-#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129
-
-typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat* params);
-
-#define glPointParameterfARB GLEW_GET_FUN(__glewPointParameterfARB)
-#define glPointParameterfvARB GLEW_GET_FUN(__glewPointParameterfvARB)
-
-#define GLEW_ARB_point_parameters GLEW_GET_VAR(__GLEW_ARB_point_parameters)
-
-#endif /* GL_ARB_point_parameters */
-
-/* -------------------------- GL_ARB_point_sprite -------------------------- */
-
-#ifndef GL_ARB_point_sprite
-#define GL_ARB_point_sprite 1
-
-#define GL_POINT_SPRITE_ARB 0x8861
-#define GL_COORD_REPLACE_ARB 0x8862
-
-#define GLEW_ARB_point_sprite GLEW_GET_VAR(__GLEW_ARB_point_sprite)
-
-#endif /* GL_ARB_point_sprite */
-
-/* --------------------- GL_ARB_program_interface_query -------------------- */
-
-#ifndef GL_ARB_program_interface_query
-#define GL_ARB_program_interface_query 1
-
-#define GL_UNIFORM 0x92E1
-#define GL_UNIFORM_BLOCK 0x92E2
-#define GL_PROGRAM_INPUT 0x92E3
-#define GL_PROGRAM_OUTPUT 0x92E4
-#define GL_BUFFER_VARIABLE 0x92E5
-#define GL_SHADER_STORAGE_BLOCK 0x92E6
-#define GL_IS_PER_PATCH 0x92E7
-#define GL_VERTEX_SUBROUTINE 0x92E8
-#define GL_TESS_CONTROL_SUBROUTINE 0x92E9
-#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA
-#define GL_GEOMETRY_SUBROUTINE 0x92EB
-#define GL_FRAGMENT_SUBROUTINE 0x92EC
-#define GL_COMPUTE_SUBROUTINE 0x92ED
-#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE
-#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF
-#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0
-#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1
-#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2
-#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3
-#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4
-#define GL_ACTIVE_RESOURCES 0x92F5
-#define GL_MAX_NAME_LENGTH 0x92F6
-#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7
-#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8
-#define GL_NAME_LENGTH 0x92F9
-#define GL_TYPE 0x92FA
-#define GL_ARRAY_SIZE 0x92FB
-#define GL_OFFSET 0x92FC
-#define GL_BLOCK_INDEX 0x92FD
-#define GL_ARRAY_STRIDE 0x92FE
-#define GL_MATRIX_STRIDE 0x92FF
-#define GL_IS_ROW_MAJOR 0x9300
-#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301
-#define GL_BUFFER_BINDING 0x9302
-#define GL_BUFFER_DATA_SIZE 0x9303
-#define GL_NUM_ACTIVE_VARIABLES 0x9304
-#define GL_ACTIVE_VARIABLES 0x9305
-#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306
-#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307
-#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308
-#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309
-#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A
-#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B
-#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C
-#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D
-#define GL_LOCATION 0x930E
-#define GL_LOCATION_INDEX 0x930F
-
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint* params);
-typedef GLuint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar* name);
-typedef GLint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar* name);
-typedef GLint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar* name);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, GLchar *name);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei *length, GLint *params);
-
-#define glGetProgramInterfaceiv GLEW_GET_FUN(__glewGetProgramInterfaceiv)
-#define glGetProgramResourceIndex GLEW_GET_FUN(__glewGetProgramResourceIndex)
-#define glGetProgramResourceLocation GLEW_GET_FUN(__glewGetProgramResourceLocation)
-#define glGetProgramResourceLocationIndex GLEW_GET_FUN(__glewGetProgramResourceLocationIndex)
-#define glGetProgramResourceName GLEW_GET_FUN(__glewGetProgramResourceName)
-#define glGetProgramResourceiv GLEW_GET_FUN(__glewGetProgramResourceiv)
-
-#define GLEW_ARB_program_interface_query GLEW_GET_VAR(__GLEW_ARB_program_interface_query)
-
-#endif /* GL_ARB_program_interface_query */
-
-/* ------------------------ GL_ARB_provoking_vertex ------------------------ */
-
-#ifndef GL_ARB_provoking_vertex
-#define GL_ARB_provoking_vertex 1
-
-#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C
-#define GL_FIRST_VERTEX_CONVENTION 0x8E4D
-#define GL_LAST_VERTEX_CONVENTION 0x8E4E
-#define GL_PROVOKING_VERTEX 0x8E4F
-
-typedef void (GLAPIENTRY * PFNGLPROVOKINGVERTEXPROC) (GLenum mode);
-
-#define glProvokingVertex GLEW_GET_FUN(__glewProvokingVertex)
-
-#define GLEW_ARB_provoking_vertex GLEW_GET_VAR(__GLEW_ARB_provoking_vertex)
-
-#endif /* GL_ARB_provoking_vertex */
-
-/* ----------------------- GL_ARB_query_buffer_object ---------------------- */
-
-#ifndef GL_ARB_query_buffer_object
-#define GL_ARB_query_buffer_object 1
-
-#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000
-#define GL_QUERY_BUFFER 0x9192
-#define GL_QUERY_BUFFER_BINDING 0x9193
-#define GL_QUERY_RESULT_NO_WAIT 0x9194
-
-#define GLEW_ARB_query_buffer_object GLEW_GET_VAR(__GLEW_ARB_query_buffer_object)
-
-#endif /* GL_ARB_query_buffer_object */
-
-/* ------------------ GL_ARB_robust_buffer_access_behavior ----------------- */
-
-#ifndef GL_ARB_robust_buffer_access_behavior
-#define GL_ARB_robust_buffer_access_behavior 1
-
-#define GLEW_ARB_robust_buffer_access_behavior GLEW_GET_VAR(__GLEW_ARB_robust_buffer_access_behavior)
-
-#endif /* GL_ARB_robust_buffer_access_behavior */
-
-/* --------------------------- GL_ARB_robustness --------------------------- */
-
-#ifndef GL_ARB_robustness
-#define GL_ARB_robustness 1
-
-#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004
-#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
-#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253
-#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255
-#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
-#define GL_NO_RESET_NOTIFICATION_ARB 0x8261
-
-typedef GLenum (GLAPIENTRY * PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void);
-typedef void (GLAPIENTRY * PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* table);
-typedef void (GLAPIENTRY * PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void* img);
-typedef void (GLAPIENTRY * PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* image);
-typedef void (GLAPIENTRY * PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values);
-typedef void (GLAPIENTRY * PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint* v);
-typedef void (GLAPIENTRY * PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values);
-typedef void (GLAPIENTRY * PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat* values);
-typedef void (GLAPIENTRY * PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint* values);
-typedef void (GLAPIENTRY * PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort* values);
-typedef void (GLAPIENTRY * PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte* pattern);
-typedef void (GLAPIENTRY * PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void* row, GLsizei columnBufSize, void*column, void*span);
-typedef void (GLAPIENTRY * PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void* img);
-typedef void (GLAPIENTRY * PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void* data);
-
-#define glGetGraphicsResetStatusARB GLEW_GET_FUN(__glewGetGraphicsResetStatusARB)
-#define glGetnColorTableARB GLEW_GET_FUN(__glewGetnColorTableARB)
-#define glGetnCompressedTexImageARB GLEW_GET_FUN(__glewGetnCompressedTexImageARB)
-#define glGetnConvolutionFilterARB GLEW_GET_FUN(__glewGetnConvolutionFilterARB)
-#define glGetnHistogramARB GLEW_GET_FUN(__glewGetnHistogramARB)
-#define glGetnMapdvARB GLEW_GET_FUN(__glewGetnMapdvARB)
-#define glGetnMapfvARB GLEW_GET_FUN(__glewGetnMapfvARB)
-#define glGetnMapivARB GLEW_GET_FUN(__glewGetnMapivARB)
-#define glGetnMinmaxARB GLEW_GET_FUN(__glewGetnMinmaxARB)
-#define glGetnPixelMapfvARB GLEW_GET_FUN(__glewGetnPixelMapfvARB)
-#define glGetnPixelMapuivARB GLEW_GET_FUN(__glewGetnPixelMapuivARB)
-#define glGetnPixelMapusvARB GLEW_GET_FUN(__glewGetnPixelMapusvARB)
-#define glGetnPolygonStippleARB GLEW_GET_FUN(__glewGetnPolygonStippleARB)
-#define glGetnSeparableFilterARB GLEW_GET_FUN(__glewGetnSeparableFilterARB)
-#define glGetnTexImageARB GLEW_GET_FUN(__glewGetnTexImageARB)
-#define glGetnUniformdvARB GLEW_GET_FUN(__glewGetnUniformdvARB)
-#define glGetnUniformfvARB GLEW_GET_FUN(__glewGetnUniformfvARB)
-#define glGetnUniformivARB GLEW_GET_FUN(__glewGetnUniformivARB)
-#define glGetnUniformuivARB GLEW_GET_FUN(__glewGetnUniformuivARB)
-#define glReadnPixelsARB GLEW_GET_FUN(__glewReadnPixelsARB)
-
-#define GLEW_ARB_robustness GLEW_GET_VAR(__GLEW_ARB_robustness)
-
-#endif /* GL_ARB_robustness */
-
-/* ---------------- GL_ARB_robustness_application_isolation ---------------- */
-
-#ifndef GL_ARB_robustness_application_isolation
-#define GL_ARB_robustness_application_isolation 1
-
-#define GLEW_ARB_robustness_application_isolation GLEW_GET_VAR(__GLEW_ARB_robustness_application_isolation)
-
-#endif /* GL_ARB_robustness_application_isolation */
-
-/* ---------------- GL_ARB_robustness_share_group_isolation ---------------- */
-
-#ifndef GL_ARB_robustness_share_group_isolation
-#define GL_ARB_robustness_share_group_isolation 1
-
-#define GLEW_ARB_robustness_share_group_isolation GLEW_GET_VAR(__GLEW_ARB_robustness_share_group_isolation)
-
-#endif /* GL_ARB_robustness_share_group_isolation */
-
-/* ------------------------- GL_ARB_sample_shading ------------------------- */
-
-#ifndef GL_ARB_sample_shading
-#define GL_ARB_sample_shading 1
-
-#define GL_SAMPLE_SHADING_ARB 0x8C36
-#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37
-
-typedef void (GLAPIENTRY * PFNGLMINSAMPLESHADINGARBPROC) (GLclampf value);
-
-#define glMinSampleShadingARB GLEW_GET_FUN(__glewMinSampleShadingARB)
-
-#define GLEW_ARB_sample_shading GLEW_GET_VAR(__GLEW_ARB_sample_shading)
-
-#endif /* GL_ARB_sample_shading */
-
-/* ------------------------- GL_ARB_sampler_objects ------------------------ */
-
-#ifndef GL_ARB_sampler_objects
-#define GL_ARB_sampler_objects 1
-
-#define GL_SAMPLER_BINDING 0x8919
-
-typedef void (GLAPIENTRY * PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
-typedef void (GLAPIENTRY * PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint * samplers);
-typedef void (GLAPIENTRY * PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint* samplers);
-typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISSAMPLERPROC) (GLuint sampler);
-typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint* params);
-typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint* params);
-
-#define glBindSampler GLEW_GET_FUN(__glewBindSampler)
-#define glDeleteSamplers GLEW_GET_FUN(__glewDeleteSamplers)
-#define glGenSamplers GLEW_GET_FUN(__glewGenSamplers)
-#define glGetSamplerParameterIiv GLEW_GET_FUN(__glewGetSamplerParameterIiv)
-#define glGetSamplerParameterIuiv GLEW_GET_FUN(__glewGetSamplerParameterIuiv)
-#define glGetSamplerParameterfv GLEW_GET_FUN(__glewGetSamplerParameterfv)
-#define glGetSamplerParameteriv GLEW_GET_FUN(__glewGetSamplerParameteriv)
-#define glIsSampler GLEW_GET_FUN(__glewIsSampler)
-#define glSamplerParameterIiv GLEW_GET_FUN(__glewSamplerParameterIiv)
-#define glSamplerParameterIuiv GLEW_GET_FUN(__glewSamplerParameterIuiv)
-#define glSamplerParameterf GLEW_GET_FUN(__glewSamplerParameterf)
-#define glSamplerParameterfv GLEW_GET_FUN(__glewSamplerParameterfv)
-#define glSamplerParameteri GLEW_GET_FUN(__glewSamplerParameteri)
-#define glSamplerParameteriv GLEW_GET_FUN(__glewSamplerParameteriv)
-
-#define GLEW_ARB_sampler_objects GLEW_GET_VAR(__GLEW_ARB_sampler_objects)
-
-#endif /* GL_ARB_sampler_objects */
-
-/* ------------------------ GL_ARB_seamless_cube_map ----------------------- */
-
-#ifndef GL_ARB_seamless_cube_map
-#define GL_ARB_seamless_cube_map 1
-
-#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
-
-#define GLEW_ARB_seamless_cube_map GLEW_GET_VAR(__GLEW_ARB_seamless_cube_map)
-
-#endif /* GL_ARB_seamless_cube_map */
-
-/* ------------------ GL_ARB_seamless_cubemap_per_texture ------------------ */
-
-#ifndef GL_ARB_seamless_cubemap_per_texture
-#define GL_ARB_seamless_cubemap_per_texture 1
-
-#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
-
-#define GLEW_ARB_seamless_cubemap_per_texture GLEW_GET_VAR(__GLEW_ARB_seamless_cubemap_per_texture)
-
-#endif /* GL_ARB_seamless_cubemap_per_texture */
-
-/* --------------------- GL_ARB_separate_shader_objects -------------------- */
-
-#ifndef GL_ARB_separate_shader_objects
-#define GL_ARB_separate_shader_objects 1
-
-#define GL_VERTEX_SHADER_BIT 0x00000001
-#define GL_FRAGMENT_SHADER_BIT 0x00000002
-#define GL_GEOMETRY_SHADER_BIT 0x00000004
-#define GL_TESS_CONTROL_SHADER_BIT 0x00000008
-#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010
-#define GL_PROGRAM_SEPARABLE 0x8258
-#define GL_ACTIVE_PROGRAM 0x8259
-#define GL_PROGRAM_PIPELINE_BINDING 0x825A
-#define GL_ALL_SHADER_BITS 0xFFFFFFFF
-
-typedef void (GLAPIENTRY * PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);
-typedef void (GLAPIENTRY * PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);
-typedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar * const * strings);
-typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint* pipelines);
-typedef void (GLAPIENTRY * PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint* pipelines);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar *infoLog);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble x);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat x);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint x);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint x);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint x, GLint y);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint x, GLuint y);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint x, GLuint y, GLuint z);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
-typedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);
-
-#define glActiveShaderProgram GLEW_GET_FUN(__glewActiveShaderProgram)
-#define glBindProgramPipeline GLEW_GET_FUN(__glewBindProgramPipeline)
-#define glCreateShaderProgramv GLEW_GET_FUN(__glewCreateShaderProgramv)
-#define glDeleteProgramPipelines GLEW_GET_FUN(__glewDeleteProgramPipelines)
-#define glGenProgramPipelines GLEW_GET_FUN(__glewGenProgramPipelines)
-#define glGetProgramPipelineInfoLog GLEW_GET_FUN(__glewGetProgramPipelineInfoLog)
-#define glGetProgramPipelineiv GLEW_GET_FUN(__glewGetProgramPipelineiv)
-#define glIsProgramPipeline GLEW_GET_FUN(__glewIsProgramPipeline)
-#define glProgramUniform1d GLEW_GET_FUN(__glewProgramUniform1d)
-#define glProgramUniform1dv GLEW_GET_FUN(__glewProgramUniform1dv)
-#define glProgramUniform1f GLEW_GET_FUN(__glewProgramUniform1f)
-#define glProgramUniform1fv GLEW_GET_FUN(__glewProgramUniform1fv)
-#define glProgramUniform1i GLEW_GET_FUN(__glewProgramUniform1i)
-#define glProgramUniform1iv GLEW_GET_FUN(__glewProgramUniform1iv)
-#define glProgramUniform1ui GLEW_GET_FUN(__glewProgramUniform1ui)
-#define glProgramUniform1uiv GLEW_GET_FUN(__glewProgramUniform1uiv)
-#define glProgramUniform2d GLEW_GET_FUN(__glewProgramUniform2d)
-#define glProgramUniform2dv GLEW_GET_FUN(__glewProgramUniform2dv)
-#define glProgramUniform2f GLEW_GET_FUN(__glewProgramUniform2f)
-#define glProgramUniform2fv GLEW_GET_FUN(__glewProgramUniform2fv)
-#define glProgramUniform2i GLEW_GET_FUN(__glewProgramUniform2i)
-#define glProgramUniform2iv GLEW_GET_FUN(__glewProgramUniform2iv)
-#define glProgramUniform2ui GLEW_GET_FUN(__glewProgramUniform2ui)
-#define glProgramUniform2uiv GLEW_GET_FUN(__glewProgramUniform2uiv)
-#define glProgramUniform3d GLEW_GET_FUN(__glewProgramUniform3d)
-#define glProgramUniform3dv GLEW_GET_FUN(__glewProgramUniform3dv)
-#define glProgramUniform3f GLEW_GET_FUN(__glewProgramUniform3f)
-#define glProgramUniform3fv GLEW_GET_FUN(__glewProgramUniform3fv)
-#define glProgramUniform3i GLEW_GET_FUN(__glewProgramUniform3i)
-#define glProgramUniform3iv GLEW_GET_FUN(__glewProgramUniform3iv)
-#define glProgramUniform3ui GLEW_GET_FUN(__glewProgramUniform3ui)
-#define glProgramUniform3uiv GLEW_GET_FUN(__glewProgramUniform3uiv)
-#define glProgramUniform4d GLEW_GET_FUN(__glewProgramUniform4d)
-#define glProgramUniform4dv GLEW_GET_FUN(__glewProgramUniform4dv)
-#define glProgramUniform4f GLEW_GET_FUN(__glewProgramUniform4f)
-#define glProgramUniform4fv GLEW_GET_FUN(__glewProgramUniform4fv)
-#define glProgramUniform4i GLEW_GET_FUN(__glewProgramUniform4i)
-#define glProgramUniform4iv GLEW_GET_FUN(__glewProgramUniform4iv)
-#define glProgramUniform4ui GLEW_GET_FUN(__glewProgramUniform4ui)
-#define glProgramUniform4uiv GLEW_GET_FUN(__glewProgramUniform4uiv)
-#define glProgramUniformMatrix2dv GLEW_GET_FUN(__glewProgramUniformMatrix2dv)
-#define glProgramUniformMatrix2fv GLEW_GET_FUN(__glewProgramUniformMatrix2fv)
-#define glProgramUniformMatrix2x3dv GLEW_GET_FUN(__glewProgramUniformMatrix2x3dv)
-#define glProgramUniformMatrix2x3fv GLEW_GET_FUN(__glewProgramUniformMatrix2x3fv)
-#define glProgramUniformMatrix2x4dv GLEW_GET_FUN(__glewProgramUniformMatrix2x4dv)
-#define glProgramUniformMatrix2x4fv GLEW_GET_FUN(__glewProgramUniformMatrix2x4fv)
-#define glProgramUniformMatrix3dv GLEW_GET_FUN(__glewProgramUniformMatrix3dv)
-#define glProgramUniformMatrix3fv GLEW_GET_FUN(__glewProgramUniformMatrix3fv)
-#define glProgramUniformMatrix3x2dv GLEW_GET_FUN(__glewProgramUniformMatrix3x2dv)
-#define glProgramUniformMatrix3x2fv GLEW_GET_FUN(__glewProgramUniformMatrix3x2fv)
-#define glProgramUniformMatrix3x4dv GLEW_GET_FUN(__glewProgramUniformMatrix3x4dv)
-#define glProgramUniformMatrix3x4fv GLEW_GET_FUN(__glewProgramUniformMatrix3x4fv)
-#define glProgramUniformMatrix4dv GLEW_GET_FUN(__glewProgramUniformMatrix4dv)
-#define glProgramUniformMatrix4fv GLEW_GET_FUN(__glewProgramUniformMatrix4fv)
-#define glProgramUniformMatrix4x2dv GLEW_GET_FUN(__glewProgramUniformMatrix4x2dv)
-#define glProgramUniformMatrix4x2fv GLEW_GET_FUN(__glewProgramUniformMatrix4x2fv)
-#define glProgramUniformMatrix4x3dv GLEW_GET_FUN(__glewProgramUniformMatrix4x3dv)
-#define glProgramUniformMatrix4x3fv GLEW_GET_FUN(__glewProgramUniformMatrix4x3fv)
-#define glUseProgramStages GLEW_GET_FUN(__glewUseProgramStages)
-#define glValidateProgramPipeline GLEW_GET_FUN(__glewValidateProgramPipeline)
-
-#define GLEW_ARB_separate_shader_objects GLEW_GET_VAR(__GLEW_ARB_separate_shader_objects)
-
-#endif /* GL_ARB_separate_shader_objects */
-
-/* --------------------- GL_ARB_shader_atomic_counters --------------------- */
-
-#ifndef GL_ARB_shader_atomic_counters
-#define GL_ARB_shader_atomic_counters 1
-
-#define GL_ATOMIC_COUNTER_BUFFER 0x92C0
-#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1
-#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2
-#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3
-#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4
-#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5
-#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB
-#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
-#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD
-#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE
-#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF
-#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
-#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
-#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2
-#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3
-#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4
-#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5
-#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6
-#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7
-#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
-#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9
-#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA
-#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB
-#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
-
-typedef void (GLAPIENTRY * PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint* params);
-
-#define glGetActiveAtomicCounterBufferiv GLEW_GET_FUN(__glewGetActiveAtomicCounterBufferiv)
-
-#define GLEW_ARB_shader_atomic_counters GLEW_GET_VAR(__GLEW_ARB_shader_atomic_counters)
-
-#endif /* GL_ARB_shader_atomic_counters */
-
-/* ----------------------- GL_ARB_shader_bit_encoding ---------------------- */
-
-#ifndef GL_ARB_shader_bit_encoding
-#define GL_ARB_shader_bit_encoding 1
-
-#define GLEW_ARB_shader_bit_encoding GLEW_GET_VAR(__GLEW_ARB_shader_bit_encoding)
-
-#endif /* GL_ARB_shader_bit_encoding */
-
-/* --------------------- GL_ARB_shader_draw_parameters --------------------- */
-
-#ifndef GL_ARB_shader_draw_parameters
-#define GL_ARB_shader_draw_parameters 1
-
-#define GLEW_ARB_shader_draw_parameters GLEW_GET_VAR(__GLEW_ARB_shader_draw_parameters)
-
-#endif /* GL_ARB_shader_draw_parameters */
-
-/* ------------------------ GL_ARB_shader_group_vote ----------------------- */
-
-#ifndef GL_ARB_shader_group_vote
-#define GL_ARB_shader_group_vote 1
-
-#define GLEW_ARB_shader_group_vote GLEW_GET_VAR(__GLEW_ARB_shader_group_vote)
-
-#endif /* GL_ARB_shader_group_vote */
-
-/* --------------------- GL_ARB_shader_image_load_store -------------------- */
-
-#ifndef GL_ARB_shader_image_load_store
-#define GL_ARB_shader_image_load_store 1
-
-#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
-#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002
-#define GL_UNIFORM_BARRIER_BIT 0x00000004
-#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008
-#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
-#define GL_COMMAND_BARRIER_BIT 0x00000040
-#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080
-#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100
-#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200
-#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400
-#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
-#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000
-#define GL_MAX_IMAGE_UNITS 0x8F38
-#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39
-#define GL_IMAGE_BINDING_NAME 0x8F3A
-#define GL_IMAGE_BINDING_LEVEL 0x8F3B
-#define GL_IMAGE_BINDING_LAYERED 0x8F3C
-#define GL_IMAGE_BINDING_LAYER 0x8F3D
-#define GL_IMAGE_BINDING_ACCESS 0x8F3E
-#define GL_IMAGE_1D 0x904C
-#define GL_IMAGE_2D 0x904D
-#define GL_IMAGE_3D 0x904E
-#define GL_IMAGE_2D_RECT 0x904F
-#define GL_IMAGE_CUBE 0x9050
-#define GL_IMAGE_BUFFER 0x9051
-#define GL_IMAGE_1D_ARRAY 0x9052
-#define GL_IMAGE_2D_ARRAY 0x9053
-#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054
-#define GL_IMAGE_2D_MULTISAMPLE 0x9055
-#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056
-#define GL_INT_IMAGE_1D 0x9057
-#define GL_INT_IMAGE_2D 0x9058
-#define GL_INT_IMAGE_3D 0x9059
-#define GL_INT_IMAGE_2D_RECT 0x905A
-#define GL_INT_IMAGE_CUBE 0x905B
-#define GL_INT_IMAGE_BUFFER 0x905C
-#define GL_INT_IMAGE_1D_ARRAY 0x905D
-#define GL_INT_IMAGE_2D_ARRAY 0x905E
-#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F
-#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060
-#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061
-#define GL_UNSIGNED_INT_IMAGE_1D 0x9062
-#define GL_UNSIGNED_INT_IMAGE_2D 0x9063
-#define GL_UNSIGNED_INT_IMAGE_3D 0x9064
-#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065
-#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
-#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067
-#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068
-#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
-#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A
-#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B
-#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C
-#define GL_MAX_IMAGE_SAMPLES 0x906D
-#define GL_IMAGE_BINDING_FORMAT 0x906E
-#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
-#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
-#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
-#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA
-#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB
-#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC
-#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD
-#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE
-#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF
-#define GL_ALL_BARRIER_BITS 0xFFFFFFFF
-
-typedef void (GLAPIENTRY * PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
-typedef void (GLAPIENTRY * PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);
-
-#define glBindImageTexture GLEW_GET_FUN(__glewBindImageTexture)
-#define glMemoryBarrier GLEW_GET_FUN(__glewMemoryBarrier)
-
-#define GLEW_ARB_shader_image_load_store GLEW_GET_VAR(__GLEW_ARB_shader_image_load_store)
-
-#endif /* GL_ARB_shader_image_load_store */
-
-/* ------------------------ GL_ARB_shader_image_size ----------------------- */
-
-#ifndef GL_ARB_shader_image_size
-#define GL_ARB_shader_image_size 1
-
-#define GLEW_ARB_shader_image_size GLEW_GET_VAR(__GLEW_ARB_shader_image_size)
-
-#endif /* GL_ARB_shader_image_size */
-
-/* ------------------------- GL_ARB_shader_objects ------------------------- */
-
-#ifndef GL_ARB_shader_objects
-#define GL_ARB_shader_objects 1
-
-#define GL_PROGRAM_OBJECT_ARB 0x8B40
-#define GL_SHADER_OBJECT_ARB 0x8B48
-#define GL_OBJECT_TYPE_ARB 0x8B4E
-#define GL_OBJECT_SUBTYPE_ARB 0x8B4F
-#define GL_FLOAT_VEC2_ARB 0x8B50
-#define GL_FLOAT_VEC3_ARB 0x8B51
-#define GL_FLOAT_VEC4_ARB 0x8B52
-#define GL_INT_VEC2_ARB 0x8B53
-#define GL_INT_VEC3_ARB 0x8B54
-#define GL_INT_VEC4_ARB 0x8B55
-#define GL_BOOL_ARB 0x8B56
-#define GL_BOOL_VEC2_ARB 0x8B57
-#define GL_BOOL_VEC3_ARB 0x8B58
-#define GL_BOOL_VEC4_ARB 0x8B59
-#define GL_FLOAT_MAT2_ARB 0x8B5A
-#define GL_FLOAT_MAT3_ARB 0x8B5B
-#define GL_FLOAT_MAT4_ARB 0x8B5C
-#define GL_SAMPLER_1D_ARB 0x8B5D
-#define GL_SAMPLER_2D_ARB 0x8B5E
-#define GL_SAMPLER_3D_ARB 0x8B5F
-#define GL_SAMPLER_CUBE_ARB 0x8B60
-#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61
-#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62
-#define GL_SAMPLER_2D_RECT_ARB 0x8B63
-#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
-#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80
-#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
-#define GL_OBJECT_LINK_STATUS_ARB 0x8B82
-#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83
-#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
-#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85
-#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86
-#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87
-#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88
-
-typedef char GLcharARB;
-typedef unsigned int GLhandleARB;
-
-typedef void (GLAPIENTRY * PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj);
-typedef void (GLAPIENTRY * PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj);
-typedef GLhandleARB (GLAPIENTRY * PFNGLCREATEPROGRAMOBJECTARBPROC) (void);
-typedef GLhandleARB (GLAPIENTRY * PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType);
-typedef void (GLAPIENTRY * PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj);
-typedef void (GLAPIENTRY * PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj);
-typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei* length, GLint *size, GLenum *type, GLcharARB *name);
-typedef void (GLAPIENTRY * PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei* count, GLhandleARB *obj);
-typedef GLhandleARB (GLAPIENTRY * PFNGLGETHANDLEARBPROC) (GLenum pname);
-typedef void (GLAPIENTRY * PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB *infoLog);
-typedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB *source);
-typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB* name);
-typedef void (GLAPIENTRY * PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint* params);
-typedef void (GLAPIENTRY * PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj);
-typedef void (GLAPIENTRY * PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB ** string, const GLint *length);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj);
-typedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj);
-
-#define glAttachObjectARB GLEW_GET_FUN(__glewAttachObjectARB)
-#define glCompileShaderARB GLEW_GET_FUN(__glewCompileShaderARB)
-#define glCreateProgramObjectARB GLEW_GET_FUN(__glewCreateProgramObjectARB)
-#define glCreateShaderObjectARB GLEW_GET_FUN(__glewCreateShaderObjectARB)
-#define glDeleteObjectARB GLEW_GET_FUN(__glewDeleteObjectARB)
-#define glDetachObjectARB GLEW_GET_FUN(__glewDetachObjectARB)
-#define glGetActiveUniformARB GLEW_GET_FUN(__glewGetActiveUniformARB)
-#define glGetAttachedObjectsARB GLEW_GET_FUN(__glewGetAttachedObjectsARB)
-#define glGetHandleARB GLEW_GET_FUN(__glewGetHandleARB)
-#define glGetInfoLogARB GLEW_GET_FUN(__glewGetInfoLogARB)
-#define glGetObjectParameterfvARB GLEW_GET_FUN(__glewGetObjectParameterfvARB)
-#define glGetObjectParameterivARB GLEW_GET_FUN(__glewGetObjectParameterivARB)
-#define glGetShaderSourceARB GLEW_GET_FUN(__glewGetShaderSourceARB)
-#define glGetUniformLocationARB GLEW_GET_FUN(__glewGetUniformLocationARB)
-#define glGetUniformfvARB GLEW_GET_FUN(__glewGetUniformfvARB)
-#define glGetUniformivARB GLEW_GET_FUN(__glewGetUniformivARB)
-#define glLinkProgramARB GLEW_GET_FUN(__glewLinkProgramARB)
-#define glShaderSourceARB GLEW_GET_FUN(__glewShaderSourceARB)
-#define glUniform1fARB GLEW_GET_FUN(__glewUniform1fARB)
-#define glUniform1fvARB GLEW_GET_FUN(__glewUniform1fvARB)
-#define glUniform1iARB GLEW_GET_FUN(__glewUniform1iARB)
-#define glUniform1ivARB GLEW_GET_FUN(__glewUniform1ivARB)
-#define glUniform2fARB GLEW_GET_FUN(__glewUniform2fARB)
-#define glUniform2fvARB GLEW_GET_FUN(__glewUniform2fvARB)
-#define glUniform2iARB GLEW_GET_FUN(__glewUniform2iARB)
-#define glUniform2ivARB GLEW_GET_FUN(__glewUniform2ivARB)
-#define glUniform3fARB GLEW_GET_FUN(__glewUniform3fARB)
-#define glUniform3fvARB GLEW_GET_FUN(__glewUniform3fvARB)
-#define glUniform3iARB GLEW_GET_FUN(__glewUniform3iARB)
-#define glUniform3ivARB GLEW_GET_FUN(__glewUniform3ivARB)
-#define glUniform4fARB GLEW_GET_FUN(__glewUniform4fARB)
-#define glUniform4fvARB GLEW_GET_FUN(__glewUniform4fvARB)
-#define glUniform4iARB GLEW_GET_FUN(__glewUniform4iARB)
-#define glUniform4ivARB GLEW_GET_FUN(__glewUniform4ivARB)
-#define glUniformMatrix2fvARB GLEW_GET_FUN(__glewUniformMatrix2fvARB)
-#define glUniformMatrix3fvARB GLEW_GET_FUN(__glewUniformMatrix3fvARB)
-#define glUniformMatrix4fvARB GLEW_GET_FUN(__glewUniformMatrix4fvARB)
-#define glUseProgramObjectARB GLEW_GET_FUN(__glewUseProgramObjectARB)
-#define glValidateProgramARB GLEW_GET_FUN(__glewValidateProgramARB)
-
-#define GLEW_ARB_shader_objects GLEW_GET_VAR(__GLEW_ARB_shader_objects)
-
-#endif /* GL_ARB_shader_objects */
-
-/* ------------------------ GL_ARB_shader_precision ------------------------ */
-
-#ifndef GL_ARB_shader_precision
-#define GL_ARB_shader_precision 1
-
-#define GLEW_ARB_shader_precision GLEW_GET_VAR(__GLEW_ARB_shader_precision)
-
-#endif /* GL_ARB_shader_precision */
-
-/* ---------------------- GL_ARB_shader_stencil_export --------------------- */
-
-#ifndef GL_ARB_shader_stencil_export
-#define GL_ARB_shader_stencil_export 1
-
-#define GLEW_ARB_shader_stencil_export GLEW_GET_VAR(__GLEW_ARB_shader_stencil_export)
-
-#endif /* GL_ARB_shader_stencil_export */
-
-/* ------------------ GL_ARB_shader_storage_buffer_object ------------------ */
-
-#ifndef GL_ARB_shader_storage_buffer_object
-#define GL_ARB_shader_storage_buffer_object 1
-
-#define GL_SHADER_STORAGE_BARRIER_BIT 0x2000
-#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39
-#define GL_SHADER_STORAGE_BUFFER 0x90D2
-#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3
-#define GL_SHADER_STORAGE_BUFFER_START 0x90D4
-#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5
-#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
-#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7
-#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8
-#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9
-#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
-#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
-#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
-#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
-#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE
-#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
-
-typedef void (GLAPIENTRY * PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
-
-#define glShaderStorageBlockBinding GLEW_GET_FUN(__glewShaderStorageBlockBinding)
-
-#define GLEW_ARB_shader_storage_buffer_object GLEW_GET_VAR(__GLEW_ARB_shader_storage_buffer_object)
-
-#endif /* GL_ARB_shader_storage_buffer_object */
-
-/* ------------------------ GL_ARB_shader_subroutine ----------------------- */
-
-#ifndef GL_ARB_shader_subroutine
-#define GL_ARB_shader_subroutine 1
-
-#define GL_ACTIVE_SUBROUTINES 0x8DE5
-#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6
-#define GL_MAX_SUBROUTINES 0x8DE7
-#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8
-#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47
-#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48
-#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49
-#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A
-#define GL_COMPATIBLE_SUBROUTINES 0x8E4B
-
-typedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLchar *name);
-typedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLchar *name);
-typedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint* values);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint* values);
-typedef GLuint (GLAPIENTRY * PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar* name);
-typedef GLint (GLAPIENTRY * PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar* name);
-typedef void (GLAPIENTRY * PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint* indices);
-
-#define glGetActiveSubroutineName GLEW_GET_FUN(__glewGetActiveSubroutineName)
-#define glGetActiveSubroutineUniformName GLEW_GET_FUN(__glewGetActiveSubroutineUniformName)
-#define glGetActiveSubroutineUniformiv GLEW_GET_FUN(__glewGetActiveSubroutineUniformiv)
-#define glGetProgramStageiv GLEW_GET_FUN(__glewGetProgramStageiv)
-#define glGetSubroutineIndex GLEW_GET_FUN(__glewGetSubroutineIndex)
-#define glGetSubroutineUniformLocation GLEW_GET_FUN(__glewGetSubroutineUniformLocation)
-#define glGetUniformSubroutineuiv GLEW_GET_FUN(__glewGetUniformSubroutineuiv)
-#define glUniformSubroutinesuiv GLEW_GET_FUN(__glewUniformSubroutinesuiv)
-
-#define GLEW_ARB_shader_subroutine GLEW_GET_VAR(__GLEW_ARB_shader_subroutine)
-
-#endif /* GL_ARB_shader_subroutine */
-
-/* ------------------ GL_ARB_shader_texture_image_samples ------------------ */
-
-#ifndef GL_ARB_shader_texture_image_samples
-#define GL_ARB_shader_texture_image_samples 1
-
-#define GLEW_ARB_shader_texture_image_samples GLEW_GET_VAR(__GLEW_ARB_shader_texture_image_samples)
-
-#endif /* GL_ARB_shader_texture_image_samples */
-
-/* ----------------------- GL_ARB_shader_texture_lod ----------------------- */
-
-#ifndef GL_ARB_shader_texture_lod
-#define GL_ARB_shader_texture_lod 1
-
-#define GLEW_ARB_shader_texture_lod GLEW_GET_VAR(__GLEW_ARB_shader_texture_lod)
-
-#endif /* GL_ARB_shader_texture_lod */
-
-/* ---------------------- GL_ARB_shading_language_100 ---------------------- */
-
-#ifndef GL_ARB_shading_language_100
-#define GL_ARB_shading_language_100 1
-
-#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
-
-#define GLEW_ARB_shading_language_100 GLEW_GET_VAR(__GLEW_ARB_shading_language_100)
-
-#endif /* GL_ARB_shading_language_100 */
-
-/* -------------------- GL_ARB_shading_language_420pack -------------------- */
-
-#ifndef GL_ARB_shading_language_420pack
-#define GL_ARB_shading_language_420pack 1
-
-#define GLEW_ARB_shading_language_420pack GLEW_GET_VAR(__GLEW_ARB_shading_language_420pack)
-
-#endif /* GL_ARB_shading_language_420pack */
-
-/* -------------------- GL_ARB_shading_language_include -------------------- */
-
-#ifndef GL_ARB_shading_language_include
-#define GL_ARB_shading_language_include 1
-
-#define GL_SHADER_INCLUDE_ARB 0x8DAE
-#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9
-#define GL_NAMED_STRING_TYPE_ARB 0x8DEA
-
-typedef void (GLAPIENTRY * PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar* const *path, const GLint *length);
-typedef void (GLAPIENTRY * PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name, GLsizei bufSize, GLint *stringlen, GLchar *string);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar* name, GLenum pname, GLint *params);
-typedef GLboolean (GLAPIENTRY * PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name);
-typedef void (GLAPIENTRY * PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar* name, GLint stringlen, const GLchar *string);
-
-#define glCompileShaderIncludeARB GLEW_GET_FUN(__glewCompileShaderIncludeARB)
-#define glDeleteNamedStringARB GLEW_GET_FUN(__glewDeleteNamedStringARB)
-#define glGetNamedStringARB GLEW_GET_FUN(__glewGetNamedStringARB)
-#define glGetNamedStringivARB GLEW_GET_FUN(__glewGetNamedStringivARB)
-#define glIsNamedStringARB GLEW_GET_FUN(__glewIsNamedStringARB)
-#define glNamedStringARB GLEW_GET_FUN(__glewNamedStringARB)
-
-#define GLEW_ARB_shading_language_include GLEW_GET_VAR(__GLEW_ARB_shading_language_include)
-
-#endif /* GL_ARB_shading_language_include */
-
-/* -------------------- GL_ARB_shading_language_packing -------------------- */
-
-#ifndef GL_ARB_shading_language_packing
-#define GL_ARB_shading_language_packing 1
-
-#define GLEW_ARB_shading_language_packing GLEW_GET_VAR(__GLEW_ARB_shading_language_packing)
-
-#endif /* GL_ARB_shading_language_packing */
-
-/* ----------------------------- GL_ARB_shadow ----------------------------- */
-
-#ifndef GL_ARB_shadow
-#define GL_ARB_shadow 1
-
-#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C
-#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D
-#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E
-
-#define GLEW_ARB_shadow GLEW_GET_VAR(__GLEW_ARB_shadow)
-
-#endif /* GL_ARB_shadow */
-
-/* ------------------------- GL_ARB_shadow_ambient ------------------------- */
-
-#ifndef GL_ARB_shadow_ambient
-#define GL_ARB_shadow_ambient 1
-
-#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF
-
-#define GLEW_ARB_shadow_ambient GLEW_GET_VAR(__GLEW_ARB_shadow_ambient)
-
-#endif /* GL_ARB_shadow_ambient */
-
-/* -------------------------- GL_ARB_sparse_buffer ------------------------- */
-
-#ifndef GL_ARB_sparse_buffer
-#define GL_ARB_sparse_buffer 1
-
-#define GL_SPARSE_STORAGE_BIT_ARB 0x0400
-#define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8
-
-typedef void (GLAPIENTRY * PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit);
-
-#define glBufferPageCommitmentARB GLEW_GET_FUN(__glewBufferPageCommitmentARB)
-
-#define GLEW_ARB_sparse_buffer GLEW_GET_VAR(__GLEW_ARB_sparse_buffer)
-
-#endif /* GL_ARB_sparse_buffer */
-
-/* ------------------------- GL_ARB_sparse_texture ------------------------- */
-
-#ifndef GL_ARB_sparse_texture
-#define GL_ARB_sparse_texture 1
-
-#define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195
-#define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196
-#define GL_VIRTUAL_PAGE_SIZE_Z_ARB 0x9197
-#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB 0x9198
-#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199
-#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A
-#define GL_TEXTURE_SPARSE_ARB 0x91A6
-#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7
-#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8
-#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9
-#define GL_NUM_SPARSE_LEVELS_ARB 0x91AA
-
-typedef void (GLAPIENTRY * PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
-
-#define glTexPageCommitmentARB GLEW_GET_FUN(__glewTexPageCommitmentARB)
-#define glTexturePageCommitmentEXT GLEW_GET_FUN(__glewTexturePageCommitmentEXT)
-
-#define GLEW_ARB_sparse_texture GLEW_GET_VAR(__GLEW_ARB_sparse_texture)
-
-#endif /* GL_ARB_sparse_texture */
-
-/* ------------------------ GL_ARB_stencil_texturing ----------------------- */
-
-#ifndef GL_ARB_stencil_texturing
-#define GL_ARB_stencil_texturing 1
-
-#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA
-
-#define GLEW_ARB_stencil_texturing GLEW_GET_VAR(__GLEW_ARB_stencil_texturing)
-
-#endif /* GL_ARB_stencil_texturing */
-
-/* ------------------------------ GL_ARB_sync ------------------------------ */
-
-#ifndef GL_ARB_sync
-#define GL_ARB_sync 1
-
-#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
-#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
-#define GL_OBJECT_TYPE 0x9112
-#define GL_SYNC_CONDITION 0x9113
-#define GL_SYNC_STATUS 0x9114
-#define GL_SYNC_FLAGS 0x9115
-#define GL_SYNC_FENCE 0x9116
-#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
-#define GL_UNSIGNALED 0x9118
-#define GL_SIGNALED 0x9119
-#define GL_ALREADY_SIGNALED 0x911A
-#define GL_TIMEOUT_EXPIRED 0x911B
-#define GL_CONDITION_SATISFIED 0x911C
-#define GL_WAIT_FAILED 0x911D
-#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF
-
-typedef GLenum (GLAPIENTRY * PFNGLCLIENTWAITSYNCPROC) (GLsync GLsync,GLbitfield flags,GLuint64 timeout);
-typedef void (GLAPIENTRY * PFNGLDELETESYNCPROC) (GLsync GLsync);
-typedef GLsync (GLAPIENTRY * PFNGLFENCESYNCPROC) (GLenum condition,GLbitfield flags);
-typedef void (GLAPIENTRY * PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64* params);
-typedef void (GLAPIENTRY * PFNGLGETSYNCIVPROC) (GLsync GLsync,GLenum pname,GLsizei bufSize,GLsizei* length, GLint *values);
-typedef GLboolean (GLAPIENTRY * PFNGLISSYNCPROC) (GLsync GLsync);
-typedef void (GLAPIENTRY * PFNGLWAITSYNCPROC) (GLsync GLsync,GLbitfield flags,GLuint64 timeout);
-
-#define glClientWaitSync GLEW_GET_FUN(__glewClientWaitSync)
-#define glDeleteSync GLEW_GET_FUN(__glewDeleteSync)
-#define glFenceSync GLEW_GET_FUN(__glewFenceSync)
-#define glGetInteger64v GLEW_GET_FUN(__glewGetInteger64v)
-#define glGetSynciv GLEW_GET_FUN(__glewGetSynciv)
-#define glIsSync GLEW_GET_FUN(__glewIsSync)
-#define glWaitSync GLEW_GET_FUN(__glewWaitSync)
-
-#define GLEW_ARB_sync GLEW_GET_VAR(__GLEW_ARB_sync)
-
-#endif /* GL_ARB_sync */
-
-/* ----------------------- GL_ARB_tessellation_shader ---------------------- */
-
-#ifndef GL_ARB_tessellation_shader
-#define GL_ARB_tessellation_shader 1
-
-#define GL_PATCHES 0xE
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1
-#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C
-#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D
-#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E
-#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F
-#define GL_PATCH_VERTICES 0x8E72
-#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73
-#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74
-#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75
-#define GL_TESS_GEN_MODE 0x8E76
-#define GL_TESS_GEN_SPACING 0x8E77
-#define GL_TESS_GEN_VERTEX_ORDER 0x8E78
-#define GL_TESS_GEN_POINT_MODE 0x8E79
-#define GL_ISOLINES 0x8E7A
-#define GL_FRACTIONAL_ODD 0x8E7B
-#define GL_FRACTIONAL_EVEN 0x8E7C
-#define GL_MAX_PATCH_VERTICES 0x8E7D
-#define GL_MAX_TESS_GEN_LEVEL 0x8E7E
-#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F
-#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80
-#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81
-#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82
-#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83
-#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84
-#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85
-#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86
-#define GL_TESS_EVALUATION_SHADER 0x8E87
-#define GL_TESS_CONTROL_SHADER 0x8E88
-#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89
-#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A
-
-typedef void (GLAPIENTRY * PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat* values);
-typedef void (GLAPIENTRY * PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);
-
-#define glPatchParameterfv GLEW_GET_FUN(__glewPatchParameterfv)
-#define glPatchParameteri GLEW_GET_FUN(__glewPatchParameteri)
-
-#define GLEW_ARB_tessellation_shader GLEW_GET_VAR(__GLEW_ARB_tessellation_shader)
-
-#endif /* GL_ARB_tessellation_shader */
-
-/* ------------------------- GL_ARB_texture_barrier ------------------------ */
-
-#ifndef GL_ARB_texture_barrier
-#define GL_ARB_texture_barrier 1
-
-typedef void (GLAPIENTRY * PFNGLTEXTUREBARRIERPROC) (void);
-
-#define glTextureBarrier GLEW_GET_FUN(__glewTextureBarrier)
-
-#define GLEW_ARB_texture_barrier GLEW_GET_VAR(__GLEW_ARB_texture_barrier)
-
-#endif /* GL_ARB_texture_barrier */
-
-/* ---------------------- GL_ARB_texture_border_clamp ---------------------- */
-
-#ifndef GL_ARB_texture_border_clamp
-#define GL_ARB_texture_border_clamp 1
-
-#define GL_CLAMP_TO_BORDER_ARB 0x812D
-
-#define GLEW_ARB_texture_border_clamp GLEW_GET_VAR(__GLEW_ARB_texture_border_clamp)
-
-#endif /* GL_ARB_texture_border_clamp */
-
-/* ---------------------- GL_ARB_texture_buffer_object --------------------- */
-
-#ifndef GL_ARB_texture_buffer_object
-#define GL_ARB_texture_buffer_object 1
-
-#define GL_TEXTURE_BUFFER_ARB 0x8C2A
-#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B
-#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C
-#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D
-#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E
-
-typedef void (GLAPIENTRY * PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer);
-
-#define glTexBufferARB GLEW_GET_FUN(__glewTexBufferARB)
-
-#define GLEW_ARB_texture_buffer_object GLEW_GET_VAR(__GLEW_ARB_texture_buffer_object)
-
-#endif /* GL_ARB_texture_buffer_object */
-
-/* ------------------- GL_ARB_texture_buffer_object_rgb32 ------------------ */
-
-#ifndef GL_ARB_texture_buffer_object_rgb32
-#define GL_ARB_texture_buffer_object_rgb32 1
-
-#define GLEW_ARB_texture_buffer_object_rgb32 GLEW_GET_VAR(__GLEW_ARB_texture_buffer_object_rgb32)
-
-#endif /* GL_ARB_texture_buffer_object_rgb32 */
-
-/* ---------------------- GL_ARB_texture_buffer_range ---------------------- */
-
-#ifndef GL_ARB_texture_buffer_range
-#define GL_ARB_texture_buffer_range 1
-
-#define GL_TEXTURE_BUFFER_OFFSET 0x919D
-#define GL_TEXTURE_BUFFER_SIZE 0x919E
-#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F
-
-typedef void (GLAPIENTRY * PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (GLAPIENTRY * PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-
-#define glTexBufferRange GLEW_GET_FUN(__glewTexBufferRange)
-#define glTextureBufferRangeEXT GLEW_GET_FUN(__glewTextureBufferRangeEXT)
-
-#define GLEW_ARB_texture_buffer_range GLEW_GET_VAR(__GLEW_ARB_texture_buffer_range)
-
-#endif /* GL_ARB_texture_buffer_range */
-
-/* ----------------------- GL_ARB_texture_compression ---------------------- */
-
-#ifndef GL_ARB_texture_compression
-#define GL_ARB_texture_compression 1
-
-#define GL_COMPRESSED_ALPHA_ARB 0x84E9
-#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA
-#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB
-#define GL_COMPRESSED_INTENSITY_ARB 0x84EC
-#define GL_COMPRESSED_RGB_ARB 0x84ED
-#define GL_COMPRESSED_RGBA_ARB 0x84EE
-#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF
-#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0
-#define GL_TEXTURE_COMPRESSED_ARB 0x86A1
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
-
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, void *img);
-
-#define glCompressedTexImage1DARB GLEW_GET_FUN(__glewCompressedTexImage1DARB)
-#define glCompressedTexImage2DARB GLEW_GET_FUN(__glewCompressedTexImage2DARB)
-#define glCompressedTexImage3DARB GLEW_GET_FUN(__glewCompressedTexImage3DARB)
-#define glCompressedTexSubImage1DARB GLEW_GET_FUN(__glewCompressedTexSubImage1DARB)
-#define glCompressedTexSubImage2DARB GLEW_GET_FUN(__glewCompressedTexSubImage2DARB)
-#define glCompressedTexSubImage3DARB GLEW_GET_FUN(__glewCompressedTexSubImage3DARB)
-#define glGetCompressedTexImageARB GLEW_GET_FUN(__glewGetCompressedTexImageARB)
-
-#define GLEW_ARB_texture_compression GLEW_GET_VAR(__GLEW_ARB_texture_compression)
-
-#endif /* GL_ARB_texture_compression */
-
-/* -------------------- GL_ARB_texture_compression_bptc -------------------- */
-
-#ifndef GL_ARB_texture_compression_bptc
-#define GL_ARB_texture_compression_bptc 1
-
-#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
-#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
-#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
-#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
-
-#define GLEW_ARB_texture_compression_bptc GLEW_GET_VAR(__GLEW_ARB_texture_compression_bptc)
-
-#endif /* GL_ARB_texture_compression_bptc */
-
-/* -------------------- GL_ARB_texture_compression_rgtc -------------------- */
-
-#ifndef GL_ARB_texture_compression_rgtc
-#define GL_ARB_texture_compression_rgtc 1
-
-#define GL_COMPRESSED_RED_RGTC1 0x8DBB
-#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC
-#define GL_COMPRESSED_RG_RGTC2 0x8DBD
-#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE
-
-#define GLEW_ARB_texture_compression_rgtc GLEW_GET_VAR(__GLEW_ARB_texture_compression_rgtc)
-
-#endif /* GL_ARB_texture_compression_rgtc */
-
-/* ------------------------ GL_ARB_texture_cube_map ------------------------ */
-
-#ifndef GL_ARB_texture_cube_map
-#define GL_ARB_texture_cube_map 1
-
-#define GL_NORMAL_MAP_ARB 0x8511
-#define GL_REFLECTION_MAP_ARB 0x8512
-#define GL_TEXTURE_CUBE_MAP_ARB 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A
-#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C
-
-#define GLEW_ARB_texture_cube_map GLEW_GET_VAR(__GLEW_ARB_texture_cube_map)
-
-#endif /* GL_ARB_texture_cube_map */
-
-/* --------------------- GL_ARB_texture_cube_map_array --------------------- */
-
-#ifndef GL_ARB_texture_cube_map_array
-#define GL_ARB_texture_cube_map_array 1
-
-#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009
-#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A
-#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B
-#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C
-#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D
-#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E
-#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F
-
-#define GLEW_ARB_texture_cube_map_array GLEW_GET_VAR(__GLEW_ARB_texture_cube_map_array)
-
-#endif /* GL_ARB_texture_cube_map_array */
-
-/* ------------------------- GL_ARB_texture_env_add ------------------------ */
-
-#ifndef GL_ARB_texture_env_add
-#define GL_ARB_texture_env_add 1
-
-#define GLEW_ARB_texture_env_add GLEW_GET_VAR(__GLEW_ARB_texture_env_add)
-
-#endif /* GL_ARB_texture_env_add */
-
-/* ----------------------- GL_ARB_texture_env_combine ---------------------- */
-
-#ifndef GL_ARB_texture_env_combine
-#define GL_ARB_texture_env_combine 1
-
-#define GL_SUBTRACT_ARB 0x84E7
-#define GL_COMBINE_ARB 0x8570
-#define GL_COMBINE_RGB_ARB 0x8571
-#define GL_COMBINE_ALPHA_ARB 0x8572
-#define GL_RGB_SCALE_ARB 0x8573
-#define GL_ADD_SIGNED_ARB 0x8574
-#define GL_INTERPOLATE_ARB 0x8575
-#define GL_CONSTANT_ARB 0x8576
-#define GL_PRIMARY_COLOR_ARB 0x8577
-#define GL_PREVIOUS_ARB 0x8578
-#define GL_SOURCE0_RGB_ARB 0x8580
-#define GL_SOURCE1_RGB_ARB 0x8581
-#define GL_SOURCE2_RGB_ARB 0x8582
-#define GL_SOURCE0_ALPHA_ARB 0x8588
-#define GL_SOURCE1_ALPHA_ARB 0x8589
-#define GL_SOURCE2_ALPHA_ARB 0x858A
-#define GL_OPERAND0_RGB_ARB 0x8590
-#define GL_OPERAND1_RGB_ARB 0x8591
-#define GL_OPERAND2_RGB_ARB 0x8592
-#define GL_OPERAND0_ALPHA_ARB 0x8598
-#define GL_OPERAND1_ALPHA_ARB 0x8599
-#define GL_OPERAND2_ALPHA_ARB 0x859A
-
-#define GLEW_ARB_texture_env_combine GLEW_GET_VAR(__GLEW_ARB_texture_env_combine)
-
-#endif /* GL_ARB_texture_env_combine */
-
-/* ---------------------- GL_ARB_texture_env_crossbar ---------------------- */
-
-#ifndef GL_ARB_texture_env_crossbar
-#define GL_ARB_texture_env_crossbar 1
-
-#define GLEW_ARB_texture_env_crossbar GLEW_GET_VAR(__GLEW_ARB_texture_env_crossbar)
-
-#endif /* GL_ARB_texture_env_crossbar */
-
-/* ------------------------ GL_ARB_texture_env_dot3 ------------------------ */
-
-#ifndef GL_ARB_texture_env_dot3
-#define GL_ARB_texture_env_dot3 1
-
-#define GL_DOT3_RGB_ARB 0x86AE
-#define GL_DOT3_RGBA_ARB 0x86AF
-
-#define GLEW_ARB_texture_env_dot3 GLEW_GET_VAR(__GLEW_ARB_texture_env_dot3)
-
-#endif /* GL_ARB_texture_env_dot3 */
-
-/* -------------------------- GL_ARB_texture_float ------------------------- */
-
-#ifndef GL_ARB_texture_float
-#define GL_ARB_texture_float 1
-
-#define GL_RGBA32F_ARB 0x8814
-#define GL_RGB32F_ARB 0x8815
-#define GL_ALPHA32F_ARB 0x8816
-#define GL_INTENSITY32F_ARB 0x8817
-#define GL_LUMINANCE32F_ARB 0x8818
-#define GL_LUMINANCE_ALPHA32F_ARB 0x8819
-#define GL_RGBA16F_ARB 0x881A
-#define GL_RGB16F_ARB 0x881B
-#define GL_ALPHA16F_ARB 0x881C
-#define GL_INTENSITY16F_ARB 0x881D
-#define GL_LUMINANCE16F_ARB 0x881E
-#define GL_LUMINANCE_ALPHA16F_ARB 0x881F
-#define GL_TEXTURE_RED_TYPE_ARB 0x8C10
-#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11
-#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12
-#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13
-#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14
-#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15
-#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16
-#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17
-
-#define GLEW_ARB_texture_float GLEW_GET_VAR(__GLEW_ARB_texture_float)
-
-#endif /* GL_ARB_texture_float */
-
-/* ------------------------- GL_ARB_texture_gather ------------------------- */
-
-#ifndef GL_ARB_texture_gather
-#define GL_ARB_texture_gather 1
-
-#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F
-
-#define GLEW_ARB_texture_gather GLEW_GET_VAR(__GLEW_ARB_texture_gather)
-
-#endif /* GL_ARB_texture_gather */
-
-/* ------------------ GL_ARB_texture_mirror_clamp_to_edge ------------------ */
-
-#ifndef GL_ARB_texture_mirror_clamp_to_edge
-#define GL_ARB_texture_mirror_clamp_to_edge 1
-
-#define GL_MIRROR_CLAMP_TO_EDGE 0x8743
-
-#define GLEW_ARB_texture_mirror_clamp_to_edge GLEW_GET_VAR(__GLEW_ARB_texture_mirror_clamp_to_edge)
-
-#endif /* GL_ARB_texture_mirror_clamp_to_edge */
-
-/* --------------------- GL_ARB_texture_mirrored_repeat -------------------- */
-
-#ifndef GL_ARB_texture_mirrored_repeat
-#define GL_ARB_texture_mirrored_repeat 1
-
-#define GL_MIRRORED_REPEAT_ARB 0x8370
-
-#define GLEW_ARB_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_ARB_texture_mirrored_repeat)
-
-#endif /* GL_ARB_texture_mirrored_repeat */
-
-/* ----------------------- GL_ARB_texture_multisample ---------------------- */
-
-#ifndef GL_ARB_texture_multisample
-#define GL_ARB_texture_multisample 1
-
-#define GL_SAMPLE_POSITION 0x8E50
-#define GL_SAMPLE_MASK 0x8E51
-#define GL_SAMPLE_MASK_VALUE 0x8E52
-#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
-#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
-#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101
-#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
-#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103
-#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
-#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105
-#define GL_TEXTURE_SAMPLES 0x9106
-#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
-#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
-#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
-#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
-#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B
-#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
-#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
-#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
-#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
-#define GL_MAX_INTEGER_SAMPLES 0x9110
-
-typedef void (GLAPIENTRY * PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat* val);
-typedef void (GLAPIENTRY * PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask);
-typedef void (GLAPIENTRY * PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-
-#define glGetMultisamplefv GLEW_GET_FUN(__glewGetMultisamplefv)
-#define glSampleMaski GLEW_GET_FUN(__glewSampleMaski)
-#define glTexImage2DMultisample GLEW_GET_FUN(__glewTexImage2DMultisample)
-#define glTexImage3DMultisample GLEW_GET_FUN(__glewTexImage3DMultisample)
-
-#define GLEW_ARB_texture_multisample GLEW_GET_VAR(__GLEW_ARB_texture_multisample)
-
-#endif /* GL_ARB_texture_multisample */
-
-/* -------------------- GL_ARB_texture_non_power_of_two -------------------- */
-
-#ifndef GL_ARB_texture_non_power_of_two
-#define GL_ARB_texture_non_power_of_two 1
-
-#define GLEW_ARB_texture_non_power_of_two GLEW_GET_VAR(__GLEW_ARB_texture_non_power_of_two)
-
-#endif /* GL_ARB_texture_non_power_of_two */
-
-/* ---------------------- GL_ARB_texture_query_levels ---------------------- */
-
-#ifndef GL_ARB_texture_query_levels
-#define GL_ARB_texture_query_levels 1
-
-#define GLEW_ARB_texture_query_levels GLEW_GET_VAR(__GLEW_ARB_texture_query_levels)
-
-#endif /* GL_ARB_texture_query_levels */
-
-/* ------------------------ GL_ARB_texture_query_lod ----------------------- */
-
-#ifndef GL_ARB_texture_query_lod
-#define GL_ARB_texture_query_lod 1
-
-#define GLEW_ARB_texture_query_lod GLEW_GET_VAR(__GLEW_ARB_texture_query_lod)
-
-#endif /* GL_ARB_texture_query_lod */
-
-/* ------------------------ GL_ARB_texture_rectangle ----------------------- */
-
-#ifndef GL_ARB_texture_rectangle
-#define GL_ARB_texture_rectangle 1
-
-#define GL_TEXTURE_RECTANGLE_ARB 0x84F5
-#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6
-#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7
-#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8
-#define GL_SAMPLER_2D_RECT_ARB 0x8B63
-#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
-
-#define GLEW_ARB_texture_rectangle GLEW_GET_VAR(__GLEW_ARB_texture_rectangle)
-
-#endif /* GL_ARB_texture_rectangle */
-
-/* --------------------------- GL_ARB_texture_rg --------------------------- */
-
-#ifndef GL_ARB_texture_rg
-#define GL_ARB_texture_rg 1
-
-#define GL_COMPRESSED_RED 0x8225
-#define GL_COMPRESSED_RG 0x8226
-#define GL_RG 0x8227
-#define GL_RG_INTEGER 0x8228
-#define GL_R8 0x8229
-#define GL_R16 0x822A
-#define GL_RG8 0x822B
-#define GL_RG16 0x822C
-#define GL_R16F 0x822D
-#define GL_R32F 0x822E
-#define GL_RG16F 0x822F
-#define GL_RG32F 0x8230
-#define GL_R8I 0x8231
-#define GL_R8UI 0x8232
-#define GL_R16I 0x8233
-#define GL_R16UI 0x8234
-#define GL_R32I 0x8235
-#define GL_R32UI 0x8236
-#define GL_RG8I 0x8237
-#define GL_RG8UI 0x8238
-#define GL_RG16I 0x8239
-#define GL_RG16UI 0x823A
-#define GL_RG32I 0x823B
-#define GL_RG32UI 0x823C
-
-#define GLEW_ARB_texture_rg GLEW_GET_VAR(__GLEW_ARB_texture_rg)
-
-#endif /* GL_ARB_texture_rg */
-
-/* ----------------------- GL_ARB_texture_rgb10_a2ui ----------------------- */
-
-#ifndef GL_ARB_texture_rgb10_a2ui
-#define GL_ARB_texture_rgb10_a2ui 1
-
-#define GL_RGB10_A2UI 0x906F
-
-#define GLEW_ARB_texture_rgb10_a2ui GLEW_GET_VAR(__GLEW_ARB_texture_rgb10_a2ui)
-
-#endif /* GL_ARB_texture_rgb10_a2ui */
-
-/* ------------------------ GL_ARB_texture_stencil8 ------------------------ */
-
-#ifndef GL_ARB_texture_stencil8
-#define GL_ARB_texture_stencil8 1
-
-#define GL_STENCIL_INDEX 0x1901
-#define GL_STENCIL_INDEX8 0x8D48
-
-#define GLEW_ARB_texture_stencil8 GLEW_GET_VAR(__GLEW_ARB_texture_stencil8)
-
-#endif /* GL_ARB_texture_stencil8 */
-
-/* ------------------------- GL_ARB_texture_storage ------------------------ */
-
-#ifndef GL_ARB_texture_storage
-#define GL_ARB_texture_storage 1
-
-#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
-
-typedef void (GLAPIENTRY * PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GLAPIENTRY * PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-
-#define glTexStorage1D GLEW_GET_FUN(__glewTexStorage1D)
-#define glTexStorage2D GLEW_GET_FUN(__glewTexStorage2D)
-#define glTexStorage3D GLEW_GET_FUN(__glewTexStorage3D)
-#define glTextureStorage1DEXT GLEW_GET_FUN(__glewTextureStorage1DEXT)
-#define glTextureStorage2DEXT GLEW_GET_FUN(__glewTextureStorage2DEXT)
-#define glTextureStorage3DEXT GLEW_GET_FUN(__glewTextureStorage3DEXT)
-
-#define GLEW_ARB_texture_storage GLEW_GET_VAR(__GLEW_ARB_texture_storage)
-
-#endif /* GL_ARB_texture_storage */
-
-/* ------------------- GL_ARB_texture_storage_multisample ------------------ */
-
-#ifndef GL_ARB_texture_storage_multisample
-#define GL_ARB_texture_storage_multisample 1
-
-typedef void (GLAPIENTRY * PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-typedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-
-#define glTexStorage2DMultisample GLEW_GET_FUN(__glewTexStorage2DMultisample)
-#define glTexStorage3DMultisample GLEW_GET_FUN(__glewTexStorage3DMultisample)
-#define glTextureStorage2DMultisampleEXT GLEW_GET_FUN(__glewTextureStorage2DMultisampleEXT)
-#define glTextureStorage3DMultisampleEXT GLEW_GET_FUN(__glewTextureStorage3DMultisampleEXT)
-
-#define GLEW_ARB_texture_storage_multisample GLEW_GET_VAR(__GLEW_ARB_texture_storage_multisample)
-
-#endif /* GL_ARB_texture_storage_multisample */
-
-/* ------------------------- GL_ARB_texture_swizzle ------------------------ */
-
-#ifndef GL_ARB_texture_swizzle
-#define GL_ARB_texture_swizzle 1
-
-#define GL_TEXTURE_SWIZZLE_R 0x8E42
-#define GL_TEXTURE_SWIZZLE_G 0x8E43
-#define GL_TEXTURE_SWIZZLE_B 0x8E44
-#define GL_TEXTURE_SWIZZLE_A 0x8E45
-#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
-
-#define GLEW_ARB_texture_swizzle GLEW_GET_VAR(__GLEW_ARB_texture_swizzle)
-
-#endif /* GL_ARB_texture_swizzle */
-
-/* -------------------------- GL_ARB_texture_view -------------------------- */
-
-#ifndef GL_ARB_texture_view
-#define GL_ARB_texture_view 1
-
-#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB
-#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC
-#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD
-#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE
-#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
-
-typedef void (GLAPIENTRY * PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
-
-#define glTextureView GLEW_GET_FUN(__glewTextureView)
-
-#define GLEW_ARB_texture_view GLEW_GET_VAR(__GLEW_ARB_texture_view)
-
-#endif /* GL_ARB_texture_view */
-
-/* --------------------------- GL_ARB_timer_query -------------------------- */
-
-#ifndef GL_ARB_timer_query
-#define GL_ARB_timer_query 1
-
-#define GL_TIME_ELAPSED 0x88BF
-#define GL_TIMESTAMP 0x8E28
-
-typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64* params);
-typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64* params);
-typedef void (GLAPIENTRY * PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);
-
-#define glGetQueryObjecti64v GLEW_GET_FUN(__glewGetQueryObjecti64v)
-#define glGetQueryObjectui64v GLEW_GET_FUN(__glewGetQueryObjectui64v)
-#define glQueryCounter GLEW_GET_FUN(__glewQueryCounter)
-
-#define GLEW_ARB_timer_query GLEW_GET_VAR(__GLEW_ARB_timer_query)
-
-#endif /* GL_ARB_timer_query */
-
-/* ----------------------- GL_ARB_transform_feedback2 ---------------------- */
-
-#ifndef GL_ARB_transform_feedback2
-#define GL_ARB_transform_feedback2 1
-
-#define GL_TRANSFORM_FEEDBACK 0x8E22
-#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23
-#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24
-#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
-
-typedef void (GLAPIENTRY * PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
-typedef void (GLAPIENTRY * PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id);
-typedef void (GLAPIENTRY * PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint* ids);
-typedef GLboolean (GLAPIENTRY * PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
-typedef void (GLAPIENTRY * PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);
-typedef void (GLAPIENTRY * PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);
-
-#define glBindTransformFeedback GLEW_GET_FUN(__glewBindTransformFeedback)
-#define glDeleteTransformFeedbacks GLEW_GET_FUN(__glewDeleteTransformFeedbacks)
-#define glDrawTransformFeedback GLEW_GET_FUN(__glewDrawTransformFeedback)
-#define glGenTransformFeedbacks GLEW_GET_FUN(__glewGenTransformFeedbacks)
-#define glIsTransformFeedback GLEW_GET_FUN(__glewIsTransformFeedback)
-#define glPauseTransformFeedback GLEW_GET_FUN(__glewPauseTransformFeedback)
-#define glResumeTransformFeedback GLEW_GET_FUN(__glewResumeTransformFeedback)
-
-#define GLEW_ARB_transform_feedback2 GLEW_GET_VAR(__GLEW_ARB_transform_feedback2)
-
-#endif /* GL_ARB_transform_feedback2 */
-
-/* ----------------------- GL_ARB_transform_feedback3 ---------------------- */
-
-#ifndef GL_ARB_transform_feedback3
-#define GL_ARB_transform_feedback3 1
-
-#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70
-#define GL_MAX_VERTEX_STREAMS 0x8E71
-
-typedef void (GLAPIENTRY * PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id);
-typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream);
-typedef void (GLAPIENTRY * PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index);
-typedef void (GLAPIENTRY * PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint* params);
-
-#define glBeginQueryIndexed GLEW_GET_FUN(__glewBeginQueryIndexed)
-#define glDrawTransformFeedbackStream GLEW_GET_FUN(__glewDrawTransformFeedbackStream)
-#define glEndQueryIndexed GLEW_GET_FUN(__glewEndQueryIndexed)
-#define glGetQueryIndexediv GLEW_GET_FUN(__glewGetQueryIndexediv)
-
-#define GLEW_ARB_transform_feedback3 GLEW_GET_VAR(__GLEW_ARB_transform_feedback3)
-
-#endif /* GL_ARB_transform_feedback3 */
-
-/* ------------------ GL_ARB_transform_feedback_instanced ------------------ */
-
-#ifndef GL_ARB_transform_feedback_instanced
-#define GL_ARB_transform_feedback_instanced 1
-
-typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei primcount);
-typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei primcount);
-
-#define glDrawTransformFeedbackInstanced GLEW_GET_FUN(__glewDrawTransformFeedbackInstanced)
-#define glDrawTransformFeedbackStreamInstanced GLEW_GET_FUN(__glewDrawTransformFeedbackStreamInstanced)
-
-#define GLEW_ARB_transform_feedback_instanced GLEW_GET_VAR(__GLEW_ARB_transform_feedback_instanced)
-
-#endif /* GL_ARB_transform_feedback_instanced */
-
-/* ---------------- GL_ARB_transform_feedback_overflow_query --------------- */
-
-#ifndef GL_ARB_transform_feedback_overflow_query
-#define GL_ARB_transform_feedback_overflow_query 1
-
-#define GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB 0x82EC
-#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB 0x82ED
-
-#define GLEW_ARB_transform_feedback_overflow_query GLEW_GET_VAR(__GLEW_ARB_transform_feedback_overflow_query)
-
-#endif /* GL_ARB_transform_feedback_overflow_query */
-
-/* ------------------------ GL_ARB_transpose_matrix ------------------------ */
-
-#ifndef GL_ARB_transpose_matrix
-#define GL_ARB_transpose_matrix 1
-
-#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3
-#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4
-#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5
-#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6
-
-typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDARBPROC) (GLdouble m[16]);
-typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]);
-typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDARBPROC) (GLdouble m[16]);
-typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]);
-
-#define glLoadTransposeMatrixdARB GLEW_GET_FUN(__glewLoadTransposeMatrixdARB)
-#define glLoadTransposeMatrixfARB GLEW_GET_FUN(__glewLoadTransposeMatrixfARB)
-#define glMultTransposeMatrixdARB GLEW_GET_FUN(__glewMultTransposeMatrixdARB)
-#define glMultTransposeMatrixfARB GLEW_GET_FUN(__glewMultTransposeMatrixfARB)
-
-#define GLEW_ARB_transpose_matrix GLEW_GET_VAR(__GLEW_ARB_transpose_matrix)
-
-#endif /* GL_ARB_transpose_matrix */
-
-/* ---------------------- GL_ARB_uniform_buffer_object --------------------- */
-
-#ifndef GL_ARB_uniform_buffer_object
-#define GL_ARB_uniform_buffer_object 1
-
-#define GL_UNIFORM_BUFFER 0x8A11
-#define GL_UNIFORM_BUFFER_BINDING 0x8A28
-#define GL_UNIFORM_BUFFER_START 0x8A29
-#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
-#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
-#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C
-#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
-#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
-#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
-#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
-#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
-#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
-#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
-#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
-#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
-#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
-#define GL_UNIFORM_TYPE 0x8A37
-#define GL_UNIFORM_SIZE 0x8A38
-#define GL_UNIFORM_NAME_LENGTH 0x8A39
-#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
-#define GL_UNIFORM_OFFSET 0x8A3B
-#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
-#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
-#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
-#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
-#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
-#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
-#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
-#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
-#define GL_INVALID_INDEX 0xFFFFFFFF
-
-typedef void (GLAPIENTRY * PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
-typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformName);
-typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint* data);
-typedef GLuint (GLAPIENTRY * PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar* uniformBlockName);
-typedef void (GLAPIENTRY * PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* const * uniformNames, GLuint* uniformIndices);
-typedef void (GLAPIENTRY * PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
-
-#define glBindBufferBase GLEW_GET_FUN(__glewBindBufferBase)
-#define glBindBufferRange GLEW_GET_FUN(__glewBindBufferRange)
-#define glGetActiveUniformBlockName GLEW_GET_FUN(__glewGetActiveUniformBlockName)
-#define glGetActiveUniformBlockiv GLEW_GET_FUN(__glewGetActiveUniformBlockiv)
-#define glGetActiveUniformName GLEW_GET_FUN(__glewGetActiveUniformName)
-#define glGetActiveUniformsiv GLEW_GET_FUN(__glewGetActiveUniformsiv)
-#define glGetIntegeri_v GLEW_GET_FUN(__glewGetIntegeri_v)
-#define glGetUniformBlockIndex GLEW_GET_FUN(__glewGetUniformBlockIndex)
-#define glGetUniformIndices GLEW_GET_FUN(__glewGetUniformIndices)
-#define glUniformBlockBinding GLEW_GET_FUN(__glewUniformBlockBinding)
-
-#define GLEW_ARB_uniform_buffer_object GLEW_GET_VAR(__GLEW_ARB_uniform_buffer_object)
-
-#endif /* GL_ARB_uniform_buffer_object */
-
-/* ------------------------ GL_ARB_vertex_array_bgra ----------------------- */
-
-#ifndef GL_ARB_vertex_array_bgra
-#define GL_ARB_vertex_array_bgra 1
-
-#define GL_BGRA 0x80E1
-
-#define GLEW_ARB_vertex_array_bgra GLEW_GET_VAR(__GLEW_ARB_vertex_array_bgra)
-
-#endif /* GL_ARB_vertex_array_bgra */
-
-/* ----------------------- GL_ARB_vertex_array_object ---------------------- */
-
-#ifndef GL_ARB_vertex_array_object
-#define GL_ARB_vertex_array_object 1
-
-#define GL_VERTEX_ARRAY_BINDING 0x85B5
-
-typedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYPROC) (GLuint array);
-typedef void (GLAPIENTRY * PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint* arrays);
-typedef void (GLAPIENTRY * PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint* arrays);
-typedef GLboolean (GLAPIENTRY * PFNGLISVERTEXARRAYPROC) (GLuint array);
-
-#define glBindVertexArray GLEW_GET_FUN(__glewBindVertexArray)
-#define glDeleteVertexArrays GLEW_GET_FUN(__glewDeleteVertexArrays)
-#define glGenVertexArrays GLEW_GET_FUN(__glewGenVertexArrays)
-#define glIsVertexArray GLEW_GET_FUN(__glewIsVertexArray)
-
-#define GLEW_ARB_vertex_array_object GLEW_GET_VAR(__GLEW_ARB_vertex_array_object)
-
-#endif /* GL_ARB_vertex_array_object */
-
-/* ----------------------- GL_ARB_vertex_attrib_64bit ---------------------- */
-
-#ifndef GL_ARB_vertex_attrib_64bit
-#define GL_ARB_vertex_attrib_64bit 1
-
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer);
-
-#define glGetVertexAttribLdv GLEW_GET_FUN(__glewGetVertexAttribLdv)
-#define glVertexAttribL1d GLEW_GET_FUN(__glewVertexAttribL1d)
-#define glVertexAttribL1dv GLEW_GET_FUN(__glewVertexAttribL1dv)
-#define glVertexAttribL2d GLEW_GET_FUN(__glewVertexAttribL2d)
-#define glVertexAttribL2dv GLEW_GET_FUN(__glewVertexAttribL2dv)
-#define glVertexAttribL3d GLEW_GET_FUN(__glewVertexAttribL3d)
-#define glVertexAttribL3dv GLEW_GET_FUN(__glewVertexAttribL3dv)
-#define glVertexAttribL4d GLEW_GET_FUN(__glewVertexAttribL4d)
-#define glVertexAttribL4dv GLEW_GET_FUN(__glewVertexAttribL4dv)
-#define glVertexAttribLPointer GLEW_GET_FUN(__glewVertexAttribLPointer)
-
-#define GLEW_ARB_vertex_attrib_64bit GLEW_GET_VAR(__GLEW_ARB_vertex_attrib_64bit)
-
-#endif /* GL_ARB_vertex_attrib_64bit */
-
-/* ---------------------- GL_ARB_vertex_attrib_binding --------------------- */
-
-#ifndef GL_ARB_vertex_attrib_binding
-#define GL_ARB_vertex_attrib_binding 1
-
-#define GL_VERTEX_ATTRIB_BINDING 0x82D4
-#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5
-#define GL_VERTEX_BINDING_DIVISOR 0x82D6
-#define GL_VERTEX_BINDING_OFFSET 0x82D7
-#define GL_VERTEX_BINDING_STRIDE 0x82D8
-#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
-#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA
-#define GL_VERTEX_BINDING_BUFFER 0x8F4F
-
-typedef void (GLAPIENTRY * PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (GLAPIENTRY * PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);
-
-#define glBindVertexBuffer GLEW_GET_FUN(__glewBindVertexBuffer)
-#define glVertexArrayBindVertexBufferEXT GLEW_GET_FUN(__glewVertexArrayBindVertexBufferEXT)
-#define glVertexArrayVertexAttribBindingEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribBindingEXT)
-#define glVertexArrayVertexAttribFormatEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribFormatEXT)
-#define glVertexArrayVertexAttribIFormatEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribIFormatEXT)
-#define glVertexArrayVertexAttribLFormatEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribLFormatEXT)
-#define glVertexArrayVertexBindingDivisorEXT GLEW_GET_FUN(__glewVertexArrayVertexBindingDivisorEXT)
-#define glVertexAttribBinding GLEW_GET_FUN(__glewVertexAttribBinding)
-#define glVertexAttribFormat GLEW_GET_FUN(__glewVertexAttribFormat)
-#define glVertexAttribIFormat GLEW_GET_FUN(__glewVertexAttribIFormat)
-#define glVertexAttribLFormat GLEW_GET_FUN(__glewVertexAttribLFormat)
-#define glVertexBindingDivisor GLEW_GET_FUN(__glewVertexBindingDivisor)
-
-#define GLEW_ARB_vertex_attrib_binding GLEW_GET_VAR(__GLEW_ARB_vertex_attrib_binding)
-
-#endif /* GL_ARB_vertex_attrib_binding */
-
-/* -------------------------- GL_ARB_vertex_blend -------------------------- */
-
-#ifndef GL_ARB_vertex_blend
-#define GL_ARB_vertex_blend 1
-
-#define GL_MODELVIEW0_ARB 0x1700
-#define GL_MODELVIEW1_ARB 0x850A
-#define GL_MAX_VERTEX_UNITS_ARB 0x86A4
-#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5
-#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6
-#define GL_VERTEX_BLEND_ARB 0x86A7
-#define GL_CURRENT_WEIGHT_ARB 0x86A8
-#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9
-#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA
-#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB
-#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC
-#define GL_WEIGHT_ARRAY_ARB 0x86AD
-#define GL_MODELVIEW2_ARB 0x8722
-#define GL_MODELVIEW3_ARB 0x8723
-#define GL_MODELVIEW4_ARB 0x8724
-#define GL_MODELVIEW5_ARB 0x8725
-#define GL_MODELVIEW6_ARB 0x8726
-#define GL_MODELVIEW7_ARB 0x8727
-#define GL_MODELVIEW8_ARB 0x8728
-#define GL_MODELVIEW9_ARB 0x8729
-#define GL_MODELVIEW10_ARB 0x872A
-#define GL_MODELVIEW11_ARB 0x872B
-#define GL_MODELVIEW12_ARB 0x872C
-#define GL_MODELVIEW13_ARB 0x872D
-#define GL_MODELVIEW14_ARB 0x872E
-#define GL_MODELVIEW15_ARB 0x872F
-#define GL_MODELVIEW16_ARB 0x8730
-#define GL_MODELVIEW17_ARB 0x8731
-#define GL_MODELVIEW18_ARB 0x8732
-#define GL_MODELVIEW19_ARB 0x8733
-#define GL_MODELVIEW20_ARB 0x8734
-#define GL_MODELVIEW21_ARB 0x8735
-#define GL_MODELVIEW22_ARB 0x8736
-#define GL_MODELVIEW23_ARB 0x8737
-#define GL_MODELVIEW24_ARB 0x8738
-#define GL_MODELVIEW25_ARB 0x8739
-#define GL_MODELVIEW26_ARB 0x873A
-#define GL_MODELVIEW27_ARB 0x873B
-#define GL_MODELVIEW28_ARB 0x873C
-#define GL_MODELVIEW29_ARB 0x873D
-#define GL_MODELVIEW30_ARB 0x873E
-#define GL_MODELVIEW31_ARB 0x873F
-
-typedef void (GLAPIENTRY * PFNGLVERTEXBLENDARBPROC) (GLint count);
-typedef void (GLAPIENTRY * PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, void *pointer);
-typedef void (GLAPIENTRY * PFNGLWEIGHTBVARBPROC) (GLint size, GLbyte *weights);
-typedef void (GLAPIENTRY * PFNGLWEIGHTDVARBPROC) (GLint size, GLdouble *weights);
-typedef void (GLAPIENTRY * PFNGLWEIGHTFVARBPROC) (GLint size, GLfloat *weights);
-typedef void (GLAPIENTRY * PFNGLWEIGHTIVARBPROC) (GLint size, GLint *weights);
-typedef void (GLAPIENTRY * PFNGLWEIGHTSVARBPROC) (GLint size, GLshort *weights);
-typedef void (GLAPIENTRY * PFNGLWEIGHTUBVARBPROC) (GLint size, GLubyte *weights);
-typedef void (GLAPIENTRY * PFNGLWEIGHTUIVARBPROC) (GLint size, GLuint *weights);
-typedef void (GLAPIENTRY * PFNGLWEIGHTUSVARBPROC) (GLint size, GLushort *weights);
-
-#define glVertexBlendARB GLEW_GET_FUN(__glewVertexBlendARB)
-#define glWeightPointerARB GLEW_GET_FUN(__glewWeightPointerARB)
-#define glWeightbvARB GLEW_GET_FUN(__glewWeightbvARB)
-#define glWeightdvARB GLEW_GET_FUN(__glewWeightdvARB)
-#define glWeightfvARB GLEW_GET_FUN(__glewWeightfvARB)
-#define glWeightivARB GLEW_GET_FUN(__glewWeightivARB)
-#define glWeightsvARB GLEW_GET_FUN(__glewWeightsvARB)
-#define glWeightubvARB GLEW_GET_FUN(__glewWeightubvARB)
-#define glWeightuivARB GLEW_GET_FUN(__glewWeightuivARB)
-#define glWeightusvARB GLEW_GET_FUN(__glewWeightusvARB)
-
-#define GLEW_ARB_vertex_blend GLEW_GET_VAR(__GLEW_ARB_vertex_blend)
-
-#endif /* GL_ARB_vertex_blend */
-
-/* ---------------------- GL_ARB_vertex_buffer_object ---------------------- */
-
-#ifndef GL_ARB_vertex_buffer_object
-#define GL_ARB_vertex_buffer_object 1
-
-#define GL_BUFFER_SIZE_ARB 0x8764
-#define GL_BUFFER_USAGE_ARB 0x8765
-#define GL_ARRAY_BUFFER_ARB 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893
-#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895
-#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896
-#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897
-#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898
-#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899
-#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A
-#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B
-#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C
-#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D
-#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E
-#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F
-#define GL_READ_ONLY_ARB 0x88B8
-#define GL_WRITE_ONLY_ARB 0x88B9
-#define GL_READ_WRITE_ARB 0x88BA
-#define GL_BUFFER_ACCESS_ARB 0x88BB
-#define GL_BUFFER_MAPPED_ARB 0x88BC
-#define GL_BUFFER_MAP_POINTER_ARB 0x88BD
-#define GL_STREAM_DRAW_ARB 0x88E0
-#define GL_STREAM_READ_ARB 0x88E1
-#define GL_STREAM_COPY_ARB 0x88E2
-#define GL_STATIC_DRAW_ARB 0x88E4
-#define GL_STATIC_READ_ARB 0x88E5
-#define GL_STATIC_COPY_ARB 0x88E6
-#define GL_DYNAMIC_DRAW_ARB 0x88E8
-#define GL_DYNAMIC_READ_ARB 0x88E9
-#define GL_DYNAMIC_COPY_ARB 0x88EA
-
-typedef ptrdiff_t GLintptrARB;
-typedef ptrdiff_t GLsizeiptrARB;
-
-typedef void (GLAPIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage);
-typedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data);
-typedef void (GLAPIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint* buffers);
-typedef void (GLAPIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint* buffers);
-typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, void** params);
-typedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data);
-typedef GLboolean (GLAPIENTRY * PFNGLISBUFFERARBPROC) (GLuint buffer);
-typedef void * (GLAPIENTRY * PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);
-typedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERARBPROC) (GLenum target);
-
-#define glBindBufferARB GLEW_GET_FUN(__glewBindBufferARB)
-#define glBufferDataARB GLEW_GET_FUN(__glewBufferDataARB)
-#define glBufferSubDataARB GLEW_GET_FUN(__glewBufferSubDataARB)
-#define glDeleteBuffersARB GLEW_GET_FUN(__glewDeleteBuffersARB)
-#define glGenBuffersARB GLEW_GET_FUN(__glewGenBuffersARB)
-#define glGetBufferParameterivARB GLEW_GET_FUN(__glewGetBufferParameterivARB)
-#define glGetBufferPointervARB GLEW_GET_FUN(__glewGetBufferPointervARB)
-#define glGetBufferSubDataARB GLEW_GET_FUN(__glewGetBufferSubDataARB)
-#define glIsBufferARB GLEW_GET_FUN(__glewIsBufferARB)
-#define glMapBufferARB GLEW_GET_FUN(__glewMapBufferARB)
-#define glUnmapBufferARB GLEW_GET_FUN(__glewUnmapBufferARB)
-
-#define GLEW_ARB_vertex_buffer_object GLEW_GET_VAR(__GLEW_ARB_vertex_buffer_object)
-
-#endif /* GL_ARB_vertex_buffer_object */
-
-/* ------------------------- GL_ARB_vertex_program ------------------------- */
-
-#ifndef GL_ARB_vertex_program
-#define GL_ARB_vertex_program 1
-
-#define GL_COLOR_SUM_ARB 0x8458
-#define GL_VERTEX_PROGRAM_ARB 0x8620
-#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622
-#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623
-#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624
-#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625
-#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626
-#define GL_PROGRAM_LENGTH_ARB 0x8627
-#define GL_PROGRAM_STRING_ARB 0x8628
-#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E
-#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F
-#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640
-#define GL_CURRENT_MATRIX_ARB 0x8641
-#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
-#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643
-#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645
-#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B
-#define GL_PROGRAM_BINDING_ARB 0x8677
-#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869
-#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A
-#define GL_PROGRAM_ERROR_STRING_ARB 0x8874
-#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875
-#define GL_PROGRAM_FORMAT_ARB 0x8876
-#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0
-#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1
-#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2
-#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3
-#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4
-#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5
-#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6
-#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7
-#define GL_PROGRAM_PARAMETERS_ARB 0x88A8
-#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9
-#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA
-#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB
-#define GL_PROGRAM_ATTRIBS_ARB 0x88AC
-#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD
-#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE
-#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF
-#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0
-#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1
-#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2
-#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3
-#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4
-#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5
-#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6
-#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7
-#define GL_MATRIX0_ARB 0x88C0
-#define GL_MATRIX1_ARB 0x88C1
-#define GL_MATRIX2_ARB 0x88C2
-#define GL_MATRIX3_ARB 0x88C3
-#define GL_MATRIX4_ARB 0x88C4
-#define GL_MATRIX5_ARB 0x88C5
-#define GL_MATRIX6_ARB 0x88C6
-#define GL_MATRIX7_ARB 0x88C7
-#define GL_MATRIX8_ARB 0x88C8
-#define GL_MATRIX9_ARB 0x88C9
-#define GL_MATRIX10_ARB 0x88CA
-#define GL_MATRIX11_ARB 0x88CB
-#define GL_MATRIX12_ARB 0x88CC
-#define GL_MATRIX13_ARB 0x88CD
-#define GL_MATRIX14_ARB 0x88CE
-#define GL_MATRIX15_ARB 0x88CF
-#define GL_MATRIX16_ARB 0x88D0
-#define GL_MATRIX17_ARB 0x88D1
-#define GL_MATRIX18_ARB 0x88D2
-#define GL_MATRIX19_ARB 0x88D3
-#define GL_MATRIX20_ARB 0x88D4
-#define GL_MATRIX21_ARB 0x88D5
-#define GL_MATRIX22_ARB 0x88D6
-#define GL_MATRIX23_ARB 0x88D7
-#define GL_MATRIX24_ARB 0x88D8
-#define GL_MATRIX25_ARB 0x88D9
-#define GL_MATRIX26_ARB 0x88DA
-#define GL_MATRIX27_ARB 0x88DB
-#define GL_MATRIX28_ARB 0x88DC
-#define GL_MATRIX29_ARB 0x88DD
-#define GL_MATRIX30_ARB 0x88DE
-#define GL_MATRIX31_ARB 0x88DF
-
-typedef void (GLAPIENTRY * PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);
-typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint* programs);
-typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
-typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
-typedef void (GLAPIENTRY * PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint* programs);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, void *string);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, void** pointer);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMARBPROC) (GLuint program);
-typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const void *string);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-
-#define glBindProgramARB GLEW_GET_FUN(__glewBindProgramARB)
-#define glDeleteProgramsARB GLEW_GET_FUN(__glewDeleteProgramsARB)
-#define glDisableVertexAttribArrayARB GLEW_GET_FUN(__glewDisableVertexAttribArrayARB)
-#define glEnableVertexAttribArrayARB GLEW_GET_FUN(__glewEnableVertexAttribArrayARB)
-#define glGenProgramsARB GLEW_GET_FUN(__glewGenProgramsARB)
-#define glGetProgramEnvParameterdvARB GLEW_GET_FUN(__glewGetProgramEnvParameterdvARB)
-#define glGetProgramEnvParameterfvARB GLEW_GET_FUN(__glewGetProgramEnvParameterfvARB)
-#define glGetProgramLocalParameterdvARB GLEW_GET_FUN(__glewGetProgramLocalParameterdvARB)
-#define glGetProgramLocalParameterfvARB GLEW_GET_FUN(__glewGetProgramLocalParameterfvARB)
-#define glGetProgramStringARB GLEW_GET_FUN(__glewGetProgramStringARB)
-#define glGetProgramivARB GLEW_GET_FUN(__glewGetProgramivARB)
-#define glGetVertexAttribPointervARB GLEW_GET_FUN(__glewGetVertexAttribPointervARB)
-#define glGetVertexAttribdvARB GLEW_GET_FUN(__glewGetVertexAttribdvARB)
-#define glGetVertexAttribfvARB GLEW_GET_FUN(__glewGetVertexAttribfvARB)
-#define glGetVertexAttribivARB GLEW_GET_FUN(__glewGetVertexAttribivARB)
-#define glIsProgramARB GLEW_GET_FUN(__glewIsProgramARB)
-#define glProgramEnvParameter4dARB GLEW_GET_FUN(__glewProgramEnvParameter4dARB)
-#define glProgramEnvParameter4dvARB GLEW_GET_FUN(__glewProgramEnvParameter4dvARB)
-#define glProgramEnvParameter4fARB GLEW_GET_FUN(__glewProgramEnvParameter4fARB)
-#define glProgramEnvParameter4fvARB GLEW_GET_FUN(__glewProgramEnvParameter4fvARB)
-#define glProgramLocalParameter4dARB GLEW_GET_FUN(__glewProgramLocalParameter4dARB)
-#define glProgramLocalParameter4dvARB GLEW_GET_FUN(__glewProgramLocalParameter4dvARB)
-#define glProgramLocalParameter4fARB GLEW_GET_FUN(__glewProgramLocalParameter4fARB)
-#define glProgramLocalParameter4fvARB GLEW_GET_FUN(__glewProgramLocalParameter4fvARB)
-#define glProgramStringARB GLEW_GET_FUN(__glewProgramStringARB)
-#define glVertexAttrib1dARB GLEW_GET_FUN(__glewVertexAttrib1dARB)
-#define glVertexAttrib1dvARB GLEW_GET_FUN(__glewVertexAttrib1dvARB)
-#define glVertexAttrib1fARB GLEW_GET_FUN(__glewVertexAttrib1fARB)
-#define glVertexAttrib1fvARB GLEW_GET_FUN(__glewVertexAttrib1fvARB)
-#define glVertexAttrib1sARB GLEW_GET_FUN(__glewVertexAttrib1sARB)
-#define glVertexAttrib1svARB GLEW_GET_FUN(__glewVertexAttrib1svARB)
-#define glVertexAttrib2dARB GLEW_GET_FUN(__glewVertexAttrib2dARB)
-#define glVertexAttrib2dvARB GLEW_GET_FUN(__glewVertexAttrib2dvARB)
-#define glVertexAttrib2fARB GLEW_GET_FUN(__glewVertexAttrib2fARB)
-#define glVertexAttrib2fvARB GLEW_GET_FUN(__glewVertexAttrib2fvARB)
-#define glVertexAttrib2sARB GLEW_GET_FUN(__glewVertexAttrib2sARB)
-#define glVertexAttrib2svARB GLEW_GET_FUN(__glewVertexAttrib2svARB)
-#define glVertexAttrib3dARB GLEW_GET_FUN(__glewVertexAttrib3dARB)
-#define glVertexAttrib3dvARB GLEW_GET_FUN(__glewVertexAttrib3dvARB)
-#define glVertexAttrib3fARB GLEW_GET_FUN(__glewVertexAttrib3fARB)
-#define glVertexAttrib3fvARB GLEW_GET_FUN(__glewVertexAttrib3fvARB)
-#define glVertexAttrib3sARB GLEW_GET_FUN(__glewVertexAttrib3sARB)
-#define glVertexAttrib3svARB GLEW_GET_FUN(__glewVertexAttrib3svARB)
-#define glVertexAttrib4NbvARB GLEW_GET_FUN(__glewVertexAttrib4NbvARB)
-#define glVertexAttrib4NivARB GLEW_GET_FUN(__glewVertexAttrib4NivARB)
-#define glVertexAttrib4NsvARB GLEW_GET_FUN(__glewVertexAttrib4NsvARB)
-#define glVertexAttrib4NubARB GLEW_GET_FUN(__glewVertexAttrib4NubARB)
-#define glVertexAttrib4NubvARB GLEW_GET_FUN(__glewVertexAttrib4NubvARB)
-#define glVertexAttrib4NuivARB GLEW_GET_FUN(__glewVertexAttrib4NuivARB)
-#define glVertexAttrib4NusvARB GLEW_GET_FUN(__glewVertexAttrib4NusvARB)
-#define glVertexAttrib4bvARB GLEW_GET_FUN(__glewVertexAttrib4bvARB)
-#define glVertexAttrib4dARB GLEW_GET_FUN(__glewVertexAttrib4dARB)
-#define glVertexAttrib4dvARB GLEW_GET_FUN(__glewVertexAttrib4dvARB)
-#define glVertexAttrib4fARB GLEW_GET_FUN(__glewVertexAttrib4fARB)
-#define glVertexAttrib4fvARB GLEW_GET_FUN(__glewVertexAttrib4fvARB)
-#define glVertexAttrib4ivARB GLEW_GET_FUN(__glewVertexAttrib4ivARB)
-#define glVertexAttrib4sARB GLEW_GET_FUN(__glewVertexAttrib4sARB)
-#define glVertexAttrib4svARB GLEW_GET_FUN(__glewVertexAttrib4svARB)
-#define glVertexAttrib4ubvARB GLEW_GET_FUN(__glewVertexAttrib4ubvARB)
-#define glVertexAttrib4uivARB GLEW_GET_FUN(__glewVertexAttrib4uivARB)
-#define glVertexAttrib4usvARB GLEW_GET_FUN(__glewVertexAttrib4usvARB)
-#define glVertexAttribPointerARB GLEW_GET_FUN(__glewVertexAttribPointerARB)
-
-#define GLEW_ARB_vertex_program GLEW_GET_VAR(__GLEW_ARB_vertex_program)
-
-#endif /* GL_ARB_vertex_program */
-
-/* -------------------------- GL_ARB_vertex_shader ------------------------- */
-
-#ifndef GL_ARB_vertex_shader
-#define GL_ARB_vertex_shader 1
-
-#define GL_VERTEX_SHADER_ARB 0x8B31
-#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
-#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B
-#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C
-#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D
-#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89
-#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A
-
-typedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB* name);
-typedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei* length, GLint *size, GLenum *type, GLcharARB *name);
-typedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB* name);
-
-#define glBindAttribLocationARB GLEW_GET_FUN(__glewBindAttribLocationARB)
-#define glGetActiveAttribARB GLEW_GET_FUN(__glewGetActiveAttribARB)
-#define glGetAttribLocationARB GLEW_GET_FUN(__glewGetAttribLocationARB)
-
-#define GLEW_ARB_vertex_shader GLEW_GET_VAR(__GLEW_ARB_vertex_shader)
-
-#endif /* GL_ARB_vertex_shader */
-
-/* ------------------- GL_ARB_vertex_type_10f_11f_11f_rev ------------------ */
-
-#ifndef GL_ARB_vertex_type_10f_11f_11f_rev
-#define GL_ARB_vertex_type_10f_11f_11f_rev 1
-
-#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
-
-#define GLEW_ARB_vertex_type_10f_11f_11f_rev GLEW_GET_VAR(__GLEW_ARB_vertex_type_10f_11f_11f_rev)
-
-#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */
-
-/* ------------------- GL_ARB_vertex_type_2_10_10_10_rev ------------------- */
-
-#ifndef GL_ARB_vertex_type_2_10_10_10_rev
-#define GL_ARB_vertex_type_2_10_10_10_rev 1
-
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#define GL_INT_2_10_10_10_REV 0x8D9F
-
-typedef void (GLAPIENTRY * PFNGLCOLORP3UIPROC) (GLenum type, GLuint color);
-typedef void (GLAPIENTRY * PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint* color);
-typedef void (GLAPIENTRY * PFNGLCOLORP4UIPROC) (GLenum type, GLuint color);
-typedef void (GLAPIENTRY * PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint* color);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint* coords);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint* coords);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint* coords);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint* coords);
-typedef void (GLAPIENTRY * PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords);
-typedef void (GLAPIENTRY * PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint* coords);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint* color);
-typedef void (GLAPIENTRY * PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords);
-typedef void (GLAPIENTRY * PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint* coords);
-typedef void (GLAPIENTRY * PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords);
-typedef void (GLAPIENTRY * PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint* coords);
-typedef void (GLAPIENTRY * PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords);
-typedef void (GLAPIENTRY * PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint* coords);
-typedef void (GLAPIENTRY * PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords);
-typedef void (GLAPIENTRY * PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint* coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value);
-typedef void (GLAPIENTRY * PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value);
-typedef void (GLAPIENTRY * PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value);
-typedef void (GLAPIENTRY * PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint* value);
-
-#define glColorP3ui GLEW_GET_FUN(__glewColorP3ui)
-#define glColorP3uiv GLEW_GET_FUN(__glewColorP3uiv)
-#define glColorP4ui GLEW_GET_FUN(__glewColorP4ui)
-#define glColorP4uiv GLEW_GET_FUN(__glewColorP4uiv)
-#define glMultiTexCoordP1ui GLEW_GET_FUN(__glewMultiTexCoordP1ui)
-#define glMultiTexCoordP1uiv GLEW_GET_FUN(__glewMultiTexCoordP1uiv)
-#define glMultiTexCoordP2ui GLEW_GET_FUN(__glewMultiTexCoordP2ui)
-#define glMultiTexCoordP2uiv GLEW_GET_FUN(__glewMultiTexCoordP2uiv)
-#define glMultiTexCoordP3ui GLEW_GET_FUN(__glewMultiTexCoordP3ui)
-#define glMultiTexCoordP3uiv GLEW_GET_FUN(__glewMultiTexCoordP3uiv)
-#define glMultiTexCoordP4ui GLEW_GET_FUN(__glewMultiTexCoordP4ui)
-#define glMultiTexCoordP4uiv GLEW_GET_FUN(__glewMultiTexCoordP4uiv)
-#define glNormalP3ui GLEW_GET_FUN(__glewNormalP3ui)
-#define glNormalP3uiv GLEW_GET_FUN(__glewNormalP3uiv)
-#define glSecondaryColorP3ui GLEW_GET_FUN(__glewSecondaryColorP3ui)
-#define glSecondaryColorP3uiv GLEW_GET_FUN(__glewSecondaryColorP3uiv)
-#define glTexCoordP1ui GLEW_GET_FUN(__glewTexCoordP1ui)
-#define glTexCoordP1uiv GLEW_GET_FUN(__glewTexCoordP1uiv)
-#define glTexCoordP2ui GLEW_GET_FUN(__glewTexCoordP2ui)
-#define glTexCoordP2uiv GLEW_GET_FUN(__glewTexCoordP2uiv)
-#define glTexCoordP3ui GLEW_GET_FUN(__glewTexCoordP3ui)
-#define glTexCoordP3uiv GLEW_GET_FUN(__glewTexCoordP3uiv)
-#define glTexCoordP4ui GLEW_GET_FUN(__glewTexCoordP4ui)
-#define glTexCoordP4uiv GLEW_GET_FUN(__glewTexCoordP4uiv)
-#define glVertexAttribP1ui GLEW_GET_FUN(__glewVertexAttribP1ui)
-#define glVertexAttribP1uiv GLEW_GET_FUN(__glewVertexAttribP1uiv)
-#define glVertexAttribP2ui GLEW_GET_FUN(__glewVertexAttribP2ui)
-#define glVertexAttribP2uiv GLEW_GET_FUN(__glewVertexAttribP2uiv)
-#define glVertexAttribP3ui GLEW_GET_FUN(__glewVertexAttribP3ui)
-#define glVertexAttribP3uiv GLEW_GET_FUN(__glewVertexAttribP3uiv)
-#define glVertexAttribP4ui GLEW_GET_FUN(__glewVertexAttribP4ui)
-#define glVertexAttribP4uiv GLEW_GET_FUN(__glewVertexAttribP4uiv)
-#define glVertexP2ui GLEW_GET_FUN(__glewVertexP2ui)
-#define glVertexP2uiv GLEW_GET_FUN(__glewVertexP2uiv)
-#define glVertexP3ui GLEW_GET_FUN(__glewVertexP3ui)
-#define glVertexP3uiv GLEW_GET_FUN(__glewVertexP3uiv)
-#define glVertexP4ui GLEW_GET_FUN(__glewVertexP4ui)
-#define glVertexP4uiv GLEW_GET_FUN(__glewVertexP4uiv)
-
-#define GLEW_ARB_vertex_type_2_10_10_10_rev GLEW_GET_VAR(__GLEW_ARB_vertex_type_2_10_10_10_rev)
-
-#endif /* GL_ARB_vertex_type_2_10_10_10_rev */
-
-/* ------------------------- GL_ARB_viewport_array ------------------------- */
-
-#ifndef GL_ARB_viewport_array
-#define GL_ARB_viewport_array 1
-
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_VIEWPORT 0x0BA2
-#define GL_SCISSOR_BOX 0x0C10
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_MAX_VIEWPORTS 0x825B
-#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C
-#define GL_VIEWPORT_BOUNDS_RANGE 0x825D
-#define GL_LAYER_PROVOKING_VERTEX 0x825E
-#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F
-#define GL_UNDEFINED_VERTEX 0x8260
-#define GL_FIRST_VERTEX_CONVENTION 0x8E4D
-#define GL_LAST_VERTEX_CONVENTION 0x8E4E
-#define GL_PROVOKING_VERTEX 0x8E4F
-
-typedef void (GLAPIENTRY * PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLclampd * v);
-typedef void (GLAPIENTRY * PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLclampd n, GLclampd f);
-typedef void (GLAPIENTRY * PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble* data);
-typedef void (GLAPIENTRY * PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat* data);
-typedef void (GLAPIENTRY * PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint * v);
-typedef void (GLAPIENTRY * PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint * v);
-typedef void (GLAPIENTRY * PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat * v);
-typedef void (GLAPIENTRY * PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
-typedef void (GLAPIENTRY * PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat * v);
-
-#define glDepthRangeArrayv GLEW_GET_FUN(__glewDepthRangeArrayv)
-#define glDepthRangeIndexed GLEW_GET_FUN(__glewDepthRangeIndexed)
-#define glGetDoublei_v GLEW_GET_FUN(__glewGetDoublei_v)
-#define glGetFloati_v GLEW_GET_FUN(__glewGetFloati_v)
-#define glScissorArrayv GLEW_GET_FUN(__glewScissorArrayv)
-#define glScissorIndexed GLEW_GET_FUN(__glewScissorIndexed)
-#define glScissorIndexedv GLEW_GET_FUN(__glewScissorIndexedv)
-#define glViewportArrayv GLEW_GET_FUN(__glewViewportArrayv)
-#define glViewportIndexedf GLEW_GET_FUN(__glewViewportIndexedf)
-#define glViewportIndexedfv GLEW_GET_FUN(__glewViewportIndexedfv)
-
-#define GLEW_ARB_viewport_array GLEW_GET_VAR(__GLEW_ARB_viewport_array)
-
-#endif /* GL_ARB_viewport_array */
-
-/* --------------------------- GL_ARB_window_pos --------------------------- */
-
-#ifndef GL_ARB_window_pos
-#define GL_ARB_window_pos 1
-
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVARBPROC) (const GLdouble* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVARBPROC) (const GLfloat* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVARBPROC) (const GLint* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVARBPROC) (const GLshort* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVARBPROC) (const GLdouble* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVARBPROC) (const GLfloat* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVARBPROC) (const GLint* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVARBPROC) (const GLshort* p);
-
-#define glWindowPos2dARB GLEW_GET_FUN(__glewWindowPos2dARB)
-#define glWindowPos2dvARB GLEW_GET_FUN(__glewWindowPos2dvARB)
-#define glWindowPos2fARB GLEW_GET_FUN(__glewWindowPos2fARB)
-#define glWindowPos2fvARB GLEW_GET_FUN(__glewWindowPos2fvARB)
-#define glWindowPos2iARB GLEW_GET_FUN(__glewWindowPos2iARB)
-#define glWindowPos2ivARB GLEW_GET_FUN(__glewWindowPos2ivARB)
-#define glWindowPos2sARB GLEW_GET_FUN(__glewWindowPos2sARB)
-#define glWindowPos2svARB GLEW_GET_FUN(__glewWindowPos2svARB)
-#define glWindowPos3dARB GLEW_GET_FUN(__glewWindowPos3dARB)
-#define glWindowPos3dvARB GLEW_GET_FUN(__glewWindowPos3dvARB)
-#define glWindowPos3fARB GLEW_GET_FUN(__glewWindowPos3fARB)
-#define glWindowPos3fvARB GLEW_GET_FUN(__glewWindowPos3fvARB)
-#define glWindowPos3iARB GLEW_GET_FUN(__glewWindowPos3iARB)
-#define glWindowPos3ivARB GLEW_GET_FUN(__glewWindowPos3ivARB)
-#define glWindowPos3sARB GLEW_GET_FUN(__glewWindowPos3sARB)
-#define glWindowPos3svARB GLEW_GET_FUN(__glewWindowPos3svARB)
-
-#define GLEW_ARB_window_pos GLEW_GET_VAR(__GLEW_ARB_window_pos)
-
-#endif /* GL_ARB_window_pos */
-
-/* ------------------------- GL_ATIX_point_sprites ------------------------- */
-
-#ifndef GL_ATIX_point_sprites
-#define GL_ATIX_point_sprites 1
-
-#define GL_TEXTURE_POINT_MODE_ATIX 0x60B0
-#define GL_TEXTURE_POINT_ONE_COORD_ATIX 0x60B1
-#define GL_TEXTURE_POINT_SPRITE_ATIX 0x60B2
-#define GL_POINT_SPRITE_CULL_MODE_ATIX 0x60B3
-#define GL_POINT_SPRITE_CULL_CENTER_ATIX 0x60B4
-#define GL_POINT_SPRITE_CULL_CLIP_ATIX 0x60B5
-
-#define GLEW_ATIX_point_sprites GLEW_GET_VAR(__GLEW_ATIX_point_sprites)
-
-#endif /* GL_ATIX_point_sprites */
-
-/* ---------------------- GL_ATIX_texture_env_combine3 --------------------- */
-
-#ifndef GL_ATIX_texture_env_combine3
-#define GL_ATIX_texture_env_combine3 1
-
-#define GL_MODULATE_ADD_ATIX 0x8744
-#define GL_MODULATE_SIGNED_ADD_ATIX 0x8745
-#define GL_MODULATE_SUBTRACT_ATIX 0x8746
-
-#define GLEW_ATIX_texture_env_combine3 GLEW_GET_VAR(__GLEW_ATIX_texture_env_combine3)
-
-#endif /* GL_ATIX_texture_env_combine3 */
-
-/* ----------------------- GL_ATIX_texture_env_route ----------------------- */
-
-#ifndef GL_ATIX_texture_env_route
-#define GL_ATIX_texture_env_route 1
-
-#define GL_SECONDARY_COLOR_ATIX 0x8747
-#define GL_TEXTURE_OUTPUT_RGB_ATIX 0x8748
-#define GL_TEXTURE_OUTPUT_ALPHA_ATIX 0x8749
-
-#define GLEW_ATIX_texture_env_route GLEW_GET_VAR(__GLEW_ATIX_texture_env_route)
-
-#endif /* GL_ATIX_texture_env_route */
-
-/* ---------------- GL_ATIX_vertex_shader_output_point_size ---------------- */
-
-#ifndef GL_ATIX_vertex_shader_output_point_size
-#define GL_ATIX_vertex_shader_output_point_size 1
-
-#define GL_OUTPUT_POINT_SIZE_ATIX 0x610E
-
-#define GLEW_ATIX_vertex_shader_output_point_size GLEW_GET_VAR(__GLEW_ATIX_vertex_shader_output_point_size)
-
-#endif /* GL_ATIX_vertex_shader_output_point_size */
-
-/* -------------------------- GL_ATI_draw_buffers -------------------------- */
-
-#ifndef GL_ATI_draw_buffers
-#define GL_ATI_draw_buffers 1
-
-#define GL_MAX_DRAW_BUFFERS_ATI 0x8824
-#define GL_DRAW_BUFFER0_ATI 0x8825
-#define GL_DRAW_BUFFER1_ATI 0x8826
-#define GL_DRAW_BUFFER2_ATI 0x8827
-#define GL_DRAW_BUFFER3_ATI 0x8828
-#define GL_DRAW_BUFFER4_ATI 0x8829
-#define GL_DRAW_BUFFER5_ATI 0x882A
-#define GL_DRAW_BUFFER6_ATI 0x882B
-#define GL_DRAW_BUFFER7_ATI 0x882C
-#define GL_DRAW_BUFFER8_ATI 0x882D
-#define GL_DRAW_BUFFER9_ATI 0x882E
-#define GL_DRAW_BUFFER10_ATI 0x882F
-#define GL_DRAW_BUFFER11_ATI 0x8830
-#define GL_DRAW_BUFFER12_ATI 0x8831
-#define GL_DRAW_BUFFER13_ATI 0x8832
-#define GL_DRAW_BUFFER14_ATI 0x8833
-#define GL_DRAW_BUFFER15_ATI 0x8834
-
-typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum* bufs);
-
-#define glDrawBuffersATI GLEW_GET_FUN(__glewDrawBuffersATI)
-
-#define GLEW_ATI_draw_buffers GLEW_GET_VAR(__GLEW_ATI_draw_buffers)
-
-#endif /* GL_ATI_draw_buffers */
-
-/* -------------------------- GL_ATI_element_array ------------------------- */
-
-#ifndef GL_ATI_element_array
-#define GL_ATI_element_array 1
-
-#define GL_ELEMENT_ARRAY_ATI 0x8768
-#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769
-#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A
-
-typedef void (GLAPIENTRY * PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count);
-typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count);
-typedef void (GLAPIENTRY * PFNGLELEMENTPOINTERATIPROC) (GLenum type, const void *pointer);
-
-#define glDrawElementArrayATI GLEW_GET_FUN(__glewDrawElementArrayATI)
-#define glDrawRangeElementArrayATI GLEW_GET_FUN(__glewDrawRangeElementArrayATI)
-#define glElementPointerATI GLEW_GET_FUN(__glewElementPointerATI)
-
-#define GLEW_ATI_element_array GLEW_GET_VAR(__GLEW_ATI_element_array)
-
-#endif /* GL_ATI_element_array */
-
-/* ------------------------- GL_ATI_envmap_bumpmap ------------------------- */
-
-#ifndef GL_ATI_envmap_bumpmap
-#define GL_ATI_envmap_bumpmap 1
-
-#define GL_BUMP_ROT_MATRIX_ATI 0x8775
-#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776
-#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777
-#define GL_BUMP_TEX_UNITS_ATI 0x8778
-#define GL_DUDV_ATI 0x8779
-#define GL_DU8DV8_ATI 0x877A
-#define GL_BUMP_ENVMAP_ATI 0x877B
-#define GL_BUMP_TARGET_ATI 0x877C
-
-typedef void (GLAPIENTRY * PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param);
-typedef void (GLAPIENTRY * PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param);
-typedef void (GLAPIENTRY * PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param);
-typedef void (GLAPIENTRY * PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param);
-
-#define glGetTexBumpParameterfvATI GLEW_GET_FUN(__glewGetTexBumpParameterfvATI)
-#define glGetTexBumpParameterivATI GLEW_GET_FUN(__glewGetTexBumpParameterivATI)
-#define glTexBumpParameterfvATI GLEW_GET_FUN(__glewTexBumpParameterfvATI)
-#define glTexBumpParameterivATI GLEW_GET_FUN(__glewTexBumpParameterivATI)
-
-#define GLEW_ATI_envmap_bumpmap GLEW_GET_VAR(__GLEW_ATI_envmap_bumpmap)
-
-#endif /* GL_ATI_envmap_bumpmap */
-
-/* ------------------------- GL_ATI_fragment_shader ------------------------ */
-
-#ifndef GL_ATI_fragment_shader
-#define GL_ATI_fragment_shader 1
-
-#define GL_2X_BIT_ATI 0x00000001
-#define GL_RED_BIT_ATI 0x00000001
-#define GL_4X_BIT_ATI 0x00000002
-#define GL_COMP_BIT_ATI 0x00000002
-#define GL_GREEN_BIT_ATI 0x00000002
-#define GL_8X_BIT_ATI 0x00000004
-#define GL_BLUE_BIT_ATI 0x00000004
-#define GL_NEGATE_BIT_ATI 0x00000004
-#define GL_BIAS_BIT_ATI 0x00000008
-#define GL_HALF_BIT_ATI 0x00000008
-#define GL_QUARTER_BIT_ATI 0x00000010
-#define GL_EIGHTH_BIT_ATI 0x00000020
-#define GL_SATURATE_BIT_ATI 0x00000040
-#define GL_FRAGMENT_SHADER_ATI 0x8920
-#define GL_REG_0_ATI 0x8921
-#define GL_REG_1_ATI 0x8922
-#define GL_REG_2_ATI 0x8923
-#define GL_REG_3_ATI 0x8924
-#define GL_REG_4_ATI 0x8925
-#define GL_REG_5_ATI 0x8926
-#define GL_CON_0_ATI 0x8941
-#define GL_CON_1_ATI 0x8942
-#define GL_CON_2_ATI 0x8943
-#define GL_CON_3_ATI 0x8944
-#define GL_CON_4_ATI 0x8945
-#define GL_CON_5_ATI 0x8946
-#define GL_CON_6_ATI 0x8947
-#define GL_CON_7_ATI 0x8948
-#define GL_MOV_ATI 0x8961
-#define GL_ADD_ATI 0x8963
-#define GL_MUL_ATI 0x8964
-#define GL_SUB_ATI 0x8965
-#define GL_DOT3_ATI 0x8966
-#define GL_DOT4_ATI 0x8967
-#define GL_MAD_ATI 0x8968
-#define GL_LERP_ATI 0x8969
-#define GL_CND_ATI 0x896A
-#define GL_CND0_ATI 0x896B
-#define GL_DOT2_ADD_ATI 0x896C
-#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D
-#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E
-#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F
-#define GL_NUM_PASSES_ATI 0x8970
-#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971
-#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972
-#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973
-#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974
-#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975
-#define GL_SWIZZLE_STR_ATI 0x8976
-#define GL_SWIZZLE_STQ_ATI 0x8977
-#define GL_SWIZZLE_STR_DR_ATI 0x8978
-#define GL_SWIZZLE_STQ_DQ_ATI 0x8979
-#define GL_SWIZZLE_STRQ_ATI 0x897A
-#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B
-
-typedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
-typedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
-typedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
-typedef void (GLAPIENTRY * PFNGLBEGINFRAGMENTSHADERATIPROC) (void);
-typedef void (GLAPIENTRY * PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id);
-typedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
-typedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
-typedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
-typedef void (GLAPIENTRY * PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id);
-typedef void (GLAPIENTRY * PFNGLENDFRAGMENTSHADERATIPROC) (void);
-typedef GLuint (GLAPIENTRY * PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range);
-typedef void (GLAPIENTRY * PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle);
-typedef void (GLAPIENTRY * PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle);
-typedef void (GLAPIENTRY * PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat* value);
-
-#define glAlphaFragmentOp1ATI GLEW_GET_FUN(__glewAlphaFragmentOp1ATI)
-#define glAlphaFragmentOp2ATI GLEW_GET_FUN(__glewAlphaFragmentOp2ATI)
-#define glAlphaFragmentOp3ATI GLEW_GET_FUN(__glewAlphaFragmentOp3ATI)
-#define glBeginFragmentShaderATI GLEW_GET_FUN(__glewBeginFragmentShaderATI)
-#define glBindFragmentShaderATI GLEW_GET_FUN(__glewBindFragmentShaderATI)
-#define glColorFragmentOp1ATI GLEW_GET_FUN(__glewColorFragmentOp1ATI)
-#define glColorFragmentOp2ATI GLEW_GET_FUN(__glewColorFragmentOp2ATI)
-#define glColorFragmentOp3ATI GLEW_GET_FUN(__glewColorFragmentOp3ATI)
-#define glDeleteFragmentShaderATI GLEW_GET_FUN(__glewDeleteFragmentShaderATI)
-#define glEndFragmentShaderATI GLEW_GET_FUN(__glewEndFragmentShaderATI)
-#define glGenFragmentShadersATI GLEW_GET_FUN(__glewGenFragmentShadersATI)
-#define glPassTexCoordATI GLEW_GET_FUN(__glewPassTexCoordATI)
-#define glSampleMapATI GLEW_GET_FUN(__glewSampleMapATI)
-#define glSetFragmentShaderConstantATI GLEW_GET_FUN(__glewSetFragmentShaderConstantATI)
-
-#define GLEW_ATI_fragment_shader GLEW_GET_VAR(__GLEW_ATI_fragment_shader)
-
-#endif /* GL_ATI_fragment_shader */
-
-/* ------------------------ GL_ATI_map_object_buffer ----------------------- */
-
-#ifndef GL_ATI_map_object_buffer
-#define GL_ATI_map_object_buffer 1
-
-typedef void * (GLAPIENTRY * PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer);
-
-#define glMapObjectBufferATI GLEW_GET_FUN(__glewMapObjectBufferATI)
-#define glUnmapObjectBufferATI GLEW_GET_FUN(__glewUnmapObjectBufferATI)
-
-#define GLEW_ATI_map_object_buffer GLEW_GET_VAR(__GLEW_ATI_map_object_buffer)
-
-#endif /* GL_ATI_map_object_buffer */
-
-/* ----------------------------- GL_ATI_meminfo ---------------------------- */
-
-#ifndef GL_ATI_meminfo
-#define GL_ATI_meminfo 1
-
-#define GL_VBO_FREE_MEMORY_ATI 0x87FB
-#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
-#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
-
-#define GLEW_ATI_meminfo GLEW_GET_VAR(__GLEW_ATI_meminfo)
-
-#endif /* GL_ATI_meminfo */
-
-/* -------------------------- GL_ATI_pn_triangles -------------------------- */
-
-#ifndef GL_ATI_pn_triangles
-#define GL_ATI_pn_triangles 1
-
-#define GL_PN_TRIANGLES_ATI 0x87F0
-#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1
-#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2
-#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3
-#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4
-#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5
-#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6
-#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7
-#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8
-
-typedef void (GLAPIENTRY * PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param);
-
-#define glPNTrianglesfATI GLEW_GET_FUN(__glewPNTrianglesfATI)
-#define glPNTrianglesiATI GLEW_GET_FUN(__glewPNTrianglesiATI)
-
-#define GLEW_ATI_pn_triangles GLEW_GET_VAR(__GLEW_ATI_pn_triangles)
-
-#endif /* GL_ATI_pn_triangles */
-
-/* ------------------------ GL_ATI_separate_stencil ------------------------ */
-
-#ifndef GL_ATI_separate_stencil
-#define GL_ATI_separate_stencil 1
-
-#define GL_STENCIL_BACK_FUNC_ATI 0x8800
-#define GL_STENCIL_BACK_FAIL_ATI 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803
-
-typedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-typedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-
-#define glStencilFuncSeparateATI GLEW_GET_FUN(__glewStencilFuncSeparateATI)
-#define glStencilOpSeparateATI GLEW_GET_FUN(__glewStencilOpSeparateATI)
-
-#define GLEW_ATI_separate_stencil GLEW_GET_VAR(__GLEW_ATI_separate_stencil)
-
-#endif /* GL_ATI_separate_stencil */
-
-/* ----------------------- GL_ATI_shader_texture_lod ----------------------- */
-
-#ifndef GL_ATI_shader_texture_lod
-#define GL_ATI_shader_texture_lod 1
-
-#define GLEW_ATI_shader_texture_lod GLEW_GET_VAR(__GLEW_ATI_shader_texture_lod)
-
-#endif /* GL_ATI_shader_texture_lod */
-
-/* ---------------------- GL_ATI_text_fragment_shader ---------------------- */
-
-#ifndef GL_ATI_text_fragment_shader
-#define GL_ATI_text_fragment_shader 1
-
-#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200
-
-#define GLEW_ATI_text_fragment_shader GLEW_GET_VAR(__GLEW_ATI_text_fragment_shader)
-
-#endif /* GL_ATI_text_fragment_shader */
-
-/* --------------------- GL_ATI_texture_compression_3dc -------------------- */
-
-#ifndef GL_ATI_texture_compression_3dc
-#define GL_ATI_texture_compression_3dc 1
-
-#define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837
-
-#define GLEW_ATI_texture_compression_3dc GLEW_GET_VAR(__GLEW_ATI_texture_compression_3dc)
-
-#endif /* GL_ATI_texture_compression_3dc */
-
-/* ---------------------- GL_ATI_texture_env_combine3 ---------------------- */
-
-#ifndef GL_ATI_texture_env_combine3
-#define GL_ATI_texture_env_combine3 1
-
-#define GL_MODULATE_ADD_ATI 0x8744
-#define GL_MODULATE_SIGNED_ADD_ATI 0x8745
-#define GL_MODULATE_SUBTRACT_ATI 0x8746
-
-#define GLEW_ATI_texture_env_combine3 GLEW_GET_VAR(__GLEW_ATI_texture_env_combine3)
-
-#endif /* GL_ATI_texture_env_combine3 */
-
-/* -------------------------- GL_ATI_texture_float ------------------------- */
-
-#ifndef GL_ATI_texture_float
-#define GL_ATI_texture_float 1
-
-#define GL_RGBA_FLOAT32_ATI 0x8814
-#define GL_RGB_FLOAT32_ATI 0x8815
-#define GL_ALPHA_FLOAT32_ATI 0x8816
-#define GL_INTENSITY_FLOAT32_ATI 0x8817
-#define GL_LUMINANCE_FLOAT32_ATI 0x8818
-#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819
-#define GL_RGBA_FLOAT16_ATI 0x881A
-#define GL_RGB_FLOAT16_ATI 0x881B
-#define GL_ALPHA_FLOAT16_ATI 0x881C
-#define GL_INTENSITY_FLOAT16_ATI 0x881D
-#define GL_LUMINANCE_FLOAT16_ATI 0x881E
-#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F
-
-#define GLEW_ATI_texture_float GLEW_GET_VAR(__GLEW_ATI_texture_float)
-
-#endif /* GL_ATI_texture_float */
-
-/* ----------------------- GL_ATI_texture_mirror_once ---------------------- */
-
-#ifndef GL_ATI_texture_mirror_once
-#define GL_ATI_texture_mirror_once 1
-
-#define GL_MIRROR_CLAMP_ATI 0x8742
-#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743
-
-#define GLEW_ATI_texture_mirror_once GLEW_GET_VAR(__GLEW_ATI_texture_mirror_once)
-
-#endif /* GL_ATI_texture_mirror_once */
-
-/* ----------------------- GL_ATI_vertex_array_object ---------------------- */
-
-#ifndef GL_ATI_vertex_array_object
-#define GL_ATI_vertex_array_object 1
-
-#define GL_STATIC_ATI 0x8760
-#define GL_DYNAMIC_ATI 0x8761
-#define GL_PRESERVE_ATI 0x8762
-#define GL_DISCARD_ATI 0x8763
-#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764
-#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765
-#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766
-#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767
-
-typedef void (GLAPIENTRY * PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
-typedef void (GLAPIENTRY * PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer);
-typedef GLuint (GLAPIENTRY * PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const void *pointer, GLenum usage);
-typedef void (GLAPIENTRY * PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve);
-typedef void (GLAPIENTRY * PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
-
-#define glArrayObjectATI GLEW_GET_FUN(__glewArrayObjectATI)
-#define glFreeObjectBufferATI GLEW_GET_FUN(__glewFreeObjectBufferATI)
-#define glGetArrayObjectfvATI GLEW_GET_FUN(__glewGetArrayObjectfvATI)
-#define glGetArrayObjectivATI GLEW_GET_FUN(__glewGetArrayObjectivATI)
-#define glGetObjectBufferfvATI GLEW_GET_FUN(__glewGetObjectBufferfvATI)
-#define glGetObjectBufferivATI GLEW_GET_FUN(__glewGetObjectBufferivATI)
-#define glGetVariantArrayObjectfvATI GLEW_GET_FUN(__glewGetVariantArrayObjectfvATI)
-#define glGetVariantArrayObjectivATI GLEW_GET_FUN(__glewGetVariantArrayObjectivATI)
-#define glIsObjectBufferATI GLEW_GET_FUN(__glewIsObjectBufferATI)
-#define glNewObjectBufferATI GLEW_GET_FUN(__glewNewObjectBufferATI)
-#define glUpdateObjectBufferATI GLEW_GET_FUN(__glewUpdateObjectBufferATI)
-#define glVariantArrayObjectATI GLEW_GET_FUN(__glewVariantArrayObjectATI)
-
-#define GLEW_ATI_vertex_array_object GLEW_GET_VAR(__GLEW_ATI_vertex_array_object)
-
-#endif /* GL_ATI_vertex_array_object */
-
-/* ------------------- GL_ATI_vertex_attrib_array_object ------------------- */
-
-#ifndef GL_ATI_vertex_attrib_array_object
-#define GL_ATI_vertex_attrib_array_object 1
-
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);
-
-#define glGetVertexAttribArrayObjectfvATI GLEW_GET_FUN(__glewGetVertexAttribArrayObjectfvATI)
-#define glGetVertexAttribArrayObjectivATI GLEW_GET_FUN(__glewGetVertexAttribArrayObjectivATI)
-#define glVertexAttribArrayObjectATI GLEW_GET_FUN(__glewVertexAttribArrayObjectATI)
-
-#define GLEW_ATI_vertex_attrib_array_object GLEW_GET_VAR(__GLEW_ATI_vertex_attrib_array_object)
-
-#endif /* GL_ATI_vertex_attrib_array_object */
-
-/* ------------------------- GL_ATI_vertex_streams ------------------------- */
-
-#ifndef GL_ATI_vertex_streams
-#define GL_ATI_vertex_streams 1
-
-#define GL_MAX_VERTEX_STREAMS_ATI 0x876B
-#define GL_VERTEX_SOURCE_ATI 0x876C
-#define GL_VERTEX_STREAM0_ATI 0x876D
-#define GL_VERTEX_STREAM1_ATI 0x876E
-#define GL_VERTEX_STREAM2_ATI 0x876F
-#define GL_VERTEX_STREAM3_ATI 0x8770
-#define GL_VERTEX_STREAM4_ATI 0x8771
-#define GL_VERTEX_STREAM5_ATI 0x8772
-#define GL_VERTEX_STREAM6_ATI 0x8773
-#define GL_VERTEX_STREAM7_ATI 0x8774
-
-typedef void (GLAPIENTRY * PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream);
-typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte x, GLbyte y, GLbyte z);
-typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords);
-typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z);
-typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);
-typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords);
-
-#define glClientActiveVertexStreamATI GLEW_GET_FUN(__glewClientActiveVertexStreamATI)
-#define glNormalStream3bATI GLEW_GET_FUN(__glewNormalStream3bATI)
-#define glNormalStream3bvATI GLEW_GET_FUN(__glewNormalStream3bvATI)
-#define glNormalStream3dATI GLEW_GET_FUN(__glewNormalStream3dATI)
-#define glNormalStream3dvATI GLEW_GET_FUN(__glewNormalStream3dvATI)
-#define glNormalStream3fATI GLEW_GET_FUN(__glewNormalStream3fATI)
-#define glNormalStream3fvATI GLEW_GET_FUN(__glewNormalStream3fvATI)
-#define glNormalStream3iATI GLEW_GET_FUN(__glewNormalStream3iATI)
-#define glNormalStream3ivATI GLEW_GET_FUN(__glewNormalStream3ivATI)
-#define glNormalStream3sATI GLEW_GET_FUN(__glewNormalStream3sATI)
-#define glNormalStream3svATI GLEW_GET_FUN(__glewNormalStream3svATI)
-#define glVertexBlendEnvfATI GLEW_GET_FUN(__glewVertexBlendEnvfATI)
-#define glVertexBlendEnviATI GLEW_GET_FUN(__glewVertexBlendEnviATI)
-#define glVertexStream1dATI GLEW_GET_FUN(__glewVertexStream1dATI)
-#define glVertexStream1dvATI GLEW_GET_FUN(__glewVertexStream1dvATI)
-#define glVertexStream1fATI GLEW_GET_FUN(__glewVertexStream1fATI)
-#define glVertexStream1fvATI GLEW_GET_FUN(__glewVertexStream1fvATI)
-#define glVertexStream1iATI GLEW_GET_FUN(__glewVertexStream1iATI)
-#define glVertexStream1ivATI GLEW_GET_FUN(__glewVertexStream1ivATI)
-#define glVertexStream1sATI GLEW_GET_FUN(__glewVertexStream1sATI)
-#define glVertexStream1svATI GLEW_GET_FUN(__glewVertexStream1svATI)
-#define glVertexStream2dATI GLEW_GET_FUN(__glewVertexStream2dATI)
-#define glVertexStream2dvATI GLEW_GET_FUN(__glewVertexStream2dvATI)
-#define glVertexStream2fATI GLEW_GET_FUN(__glewVertexStream2fATI)
-#define glVertexStream2fvATI GLEW_GET_FUN(__glewVertexStream2fvATI)
-#define glVertexStream2iATI GLEW_GET_FUN(__glewVertexStream2iATI)
-#define glVertexStream2ivATI GLEW_GET_FUN(__glewVertexStream2ivATI)
-#define glVertexStream2sATI GLEW_GET_FUN(__glewVertexStream2sATI)
-#define glVertexStream2svATI GLEW_GET_FUN(__glewVertexStream2svATI)
-#define glVertexStream3dATI GLEW_GET_FUN(__glewVertexStream3dATI)
-#define glVertexStream3dvATI GLEW_GET_FUN(__glewVertexStream3dvATI)
-#define glVertexStream3fATI GLEW_GET_FUN(__glewVertexStream3fATI)
-#define glVertexStream3fvATI GLEW_GET_FUN(__glewVertexStream3fvATI)
-#define glVertexStream3iATI GLEW_GET_FUN(__glewVertexStream3iATI)
-#define glVertexStream3ivATI GLEW_GET_FUN(__glewVertexStream3ivATI)
-#define glVertexStream3sATI GLEW_GET_FUN(__glewVertexStream3sATI)
-#define glVertexStream3svATI GLEW_GET_FUN(__glewVertexStream3svATI)
-#define glVertexStream4dATI GLEW_GET_FUN(__glewVertexStream4dATI)
-#define glVertexStream4dvATI GLEW_GET_FUN(__glewVertexStream4dvATI)
-#define glVertexStream4fATI GLEW_GET_FUN(__glewVertexStream4fATI)
-#define glVertexStream4fvATI GLEW_GET_FUN(__glewVertexStream4fvATI)
-#define glVertexStream4iATI GLEW_GET_FUN(__glewVertexStream4iATI)
-#define glVertexStream4ivATI GLEW_GET_FUN(__glewVertexStream4ivATI)
-#define glVertexStream4sATI GLEW_GET_FUN(__glewVertexStream4sATI)
-#define glVertexStream4svATI GLEW_GET_FUN(__glewVertexStream4svATI)
-
-#define GLEW_ATI_vertex_streams GLEW_GET_VAR(__GLEW_ATI_vertex_streams)
-
-#endif /* GL_ATI_vertex_streams */
-
-/* --------------------------- GL_EXT_422_pixels --------------------------- */
-
-#ifndef GL_EXT_422_pixels
-#define GL_EXT_422_pixels 1
-
-#define GL_422_EXT 0x80CC
-#define GL_422_REV_EXT 0x80CD
-#define GL_422_AVERAGE_EXT 0x80CE
-#define GL_422_REV_AVERAGE_EXT 0x80CF
-
-#define GLEW_EXT_422_pixels GLEW_GET_VAR(__GLEW_EXT_422_pixels)
-
-#endif /* GL_EXT_422_pixels */
-
-/* ---------------------------- GL_EXT_Cg_shader --------------------------- */
-
-#ifndef GL_EXT_Cg_shader
-#define GL_EXT_Cg_shader 1
-
-#define GL_CG_VERTEX_SHADER_EXT 0x890E
-#define GL_CG_FRAGMENT_SHADER_EXT 0x890F
-
-#define GLEW_EXT_Cg_shader GLEW_GET_VAR(__GLEW_EXT_Cg_shader)
-
-#endif /* GL_EXT_Cg_shader */
-
-/* ------------------------------ GL_EXT_abgr ------------------------------ */
-
-#ifndef GL_EXT_abgr
-#define GL_EXT_abgr 1
-
-#define GL_ABGR_EXT 0x8000
-
-#define GLEW_EXT_abgr GLEW_GET_VAR(__GLEW_EXT_abgr)
-
-#endif /* GL_EXT_abgr */
-
-/* ------------------------------ GL_EXT_bgra ------------------------------ */
-
-#ifndef GL_EXT_bgra
-#define GL_EXT_bgra 1
-
-#define GL_BGR_EXT 0x80E0
-#define GL_BGRA_EXT 0x80E1
-
-#define GLEW_EXT_bgra GLEW_GET_VAR(__GLEW_EXT_bgra)
-
-#endif /* GL_EXT_bgra */
-
-/* ------------------------ GL_EXT_bindable_uniform ------------------------ */
-
-#ifndef GL_EXT_bindable_uniform
-#define GL_EXT_bindable_uniform 1
-
-#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2
-#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3
-#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4
-#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED
-#define GL_UNIFORM_BUFFER_EXT 0x8DEE
-#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF
-
-typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location);
-typedef GLintptr (GLAPIENTRY * PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location);
-typedef void (GLAPIENTRY * PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer);
-
-#define glGetUniformBufferSizeEXT GLEW_GET_FUN(__glewGetUniformBufferSizeEXT)
-#define glGetUniformOffsetEXT GLEW_GET_FUN(__glewGetUniformOffsetEXT)
-#define glUniformBufferEXT GLEW_GET_FUN(__glewUniformBufferEXT)
-
-#define GLEW_EXT_bindable_uniform GLEW_GET_VAR(__GLEW_EXT_bindable_uniform)
-
-#endif /* GL_EXT_bindable_uniform */
-
-/* --------------------------- GL_EXT_blend_color -------------------------- */
-
-#ifndef GL_EXT_blend_color
-#define GL_EXT_blend_color 1
-
-#define GL_CONSTANT_COLOR_EXT 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002
-#define GL_CONSTANT_ALPHA_EXT 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004
-#define GL_BLEND_COLOR_EXT 0x8005
-
-typedef void (GLAPIENTRY * PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-
-#define glBlendColorEXT GLEW_GET_FUN(__glewBlendColorEXT)
-
-#define GLEW_EXT_blend_color GLEW_GET_VAR(__GLEW_EXT_blend_color)
-
-#endif /* GL_EXT_blend_color */
-
-/* --------------------- GL_EXT_blend_equation_separate -------------------- */
-
-#ifndef GL_EXT_blend_equation_separate
-#define GL_EXT_blend_equation_separate 1
-
-#define GL_BLEND_EQUATION_RGB_EXT 0x8009
-#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D
-
-typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha);
-
-#define glBlendEquationSeparateEXT GLEW_GET_FUN(__glewBlendEquationSeparateEXT)
-
-#define GLEW_EXT_blend_equation_separate GLEW_GET_VAR(__GLEW_EXT_blend_equation_separate)
-
-#endif /* GL_EXT_blend_equation_separate */
-
-/* ----------------------- GL_EXT_blend_func_separate ---------------------- */
-
-#ifndef GL_EXT_blend_func_separate
-#define GL_EXT_blend_func_separate 1
-
-#define GL_BLEND_DST_RGB_EXT 0x80C8
-#define GL_BLEND_SRC_RGB_EXT 0x80C9
-#define GL_BLEND_DST_ALPHA_EXT 0x80CA
-#define GL_BLEND_SRC_ALPHA_EXT 0x80CB
-
-typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-
-#define glBlendFuncSeparateEXT GLEW_GET_FUN(__glewBlendFuncSeparateEXT)
-
-#define GLEW_EXT_blend_func_separate GLEW_GET_VAR(__GLEW_EXT_blend_func_separate)
-
-#endif /* GL_EXT_blend_func_separate */
-
-/* ------------------------- GL_EXT_blend_logic_op ------------------------- */
-
-#ifndef GL_EXT_blend_logic_op
-#define GL_EXT_blend_logic_op 1
-
-#define GLEW_EXT_blend_logic_op GLEW_GET_VAR(__GLEW_EXT_blend_logic_op)
-
-#endif /* GL_EXT_blend_logic_op */
-
-/* -------------------------- GL_EXT_blend_minmax -------------------------- */
-
-#ifndef GL_EXT_blend_minmax
-#define GL_EXT_blend_minmax 1
-
-#define GL_FUNC_ADD_EXT 0x8006
-#define GL_MIN_EXT 0x8007
-#define GL_MAX_EXT 0x8008
-#define GL_BLEND_EQUATION_EXT 0x8009
-
-typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode);
-
-#define glBlendEquationEXT GLEW_GET_FUN(__glewBlendEquationEXT)
-
-#define GLEW_EXT_blend_minmax GLEW_GET_VAR(__GLEW_EXT_blend_minmax)
-
-#endif /* GL_EXT_blend_minmax */
-
-/* ------------------------- GL_EXT_blend_subtract ------------------------- */
-
-#ifndef GL_EXT_blend_subtract
-#define GL_EXT_blend_subtract 1
-
-#define GL_FUNC_SUBTRACT_EXT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B
-
-#define GLEW_EXT_blend_subtract GLEW_GET_VAR(__GLEW_EXT_blend_subtract)
-
-#endif /* GL_EXT_blend_subtract */
-
-/* ------------------------ GL_EXT_clip_volume_hint ------------------------ */
-
-#ifndef GL_EXT_clip_volume_hint
-#define GL_EXT_clip_volume_hint 1
-
-#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0
-
-#define GLEW_EXT_clip_volume_hint GLEW_GET_VAR(__GLEW_EXT_clip_volume_hint)
-
-#endif /* GL_EXT_clip_volume_hint */
-
-/* ------------------------------ GL_EXT_cmyka ----------------------------- */
-
-#ifndef GL_EXT_cmyka
-#define GL_EXT_cmyka 1
-
-#define GL_CMYK_EXT 0x800C
-#define GL_CMYKA_EXT 0x800D
-#define GL_PACK_CMYK_HINT_EXT 0x800E
-#define GL_UNPACK_CMYK_HINT_EXT 0x800F
-
-#define GLEW_EXT_cmyka GLEW_GET_VAR(__GLEW_EXT_cmyka)
-
-#endif /* GL_EXT_cmyka */
-
-/* ------------------------- GL_EXT_color_subtable ------------------------- */
-
-#ifndef GL_EXT_color_subtable
-#define GL_EXT_color_subtable 1
-
-typedef void (GLAPIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
-
-#define glColorSubTableEXT GLEW_GET_FUN(__glewColorSubTableEXT)
-#define glCopyColorSubTableEXT GLEW_GET_FUN(__glewCopyColorSubTableEXT)
-
-#define GLEW_EXT_color_subtable GLEW_GET_VAR(__GLEW_EXT_color_subtable)
-
-#endif /* GL_EXT_color_subtable */
-
-/* ---------------------- GL_EXT_compiled_vertex_array --------------------- */
-
-#ifndef GL_EXT_compiled_vertex_array
-#define GL_EXT_compiled_vertex_array 1
-
-#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8
-#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9
-
-typedef void (GLAPIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
-typedef void (GLAPIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void);
-
-#define glLockArraysEXT GLEW_GET_FUN(__glewLockArraysEXT)
-#define glUnlockArraysEXT GLEW_GET_FUN(__glewUnlockArraysEXT)
-
-#define GLEW_EXT_compiled_vertex_array GLEW_GET_VAR(__GLEW_EXT_compiled_vertex_array)
-
-#endif /* GL_EXT_compiled_vertex_array */
-
-/* --------------------------- GL_EXT_convolution -------------------------- */
-
-#ifndef GL_EXT_convolution
-#define GL_EXT_convolution 1
-
-#define GL_CONVOLUTION_1D_EXT 0x8010
-#define GL_CONVOLUTION_2D_EXT 0x8011
-#define GL_SEPARABLE_2D_EXT 0x8012
-#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013
-#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014
-#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015
-#define GL_REDUCE_EXT 0x8016
-#define GL_CONVOLUTION_FORMAT_EXT 0x8017
-#define GL_CONVOLUTION_WIDTH_EXT 0x8018
-#define GL_CONVOLUTION_HEIGHT_EXT 0x8019
-#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A
-#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B
-#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C
-#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D
-#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E
-#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F
-#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020
-#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021
-#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022
-#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023
-
-typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image);
-typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image);
-typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *image);
-typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span);
-typedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column);
-
-#define glConvolutionFilter1DEXT GLEW_GET_FUN(__glewConvolutionFilter1DEXT)
-#define glConvolutionFilter2DEXT GLEW_GET_FUN(__glewConvolutionFilter2DEXT)
-#define glConvolutionParameterfEXT GLEW_GET_FUN(__glewConvolutionParameterfEXT)
-#define glConvolutionParameterfvEXT GLEW_GET_FUN(__glewConvolutionParameterfvEXT)
-#define glConvolutionParameteriEXT GLEW_GET_FUN(__glewConvolutionParameteriEXT)
-#define glConvolutionParameterivEXT GLEW_GET_FUN(__glewConvolutionParameterivEXT)
-#define glCopyConvolutionFilter1DEXT GLEW_GET_FUN(__glewCopyConvolutionFilter1DEXT)
-#define glCopyConvolutionFilter2DEXT GLEW_GET_FUN(__glewCopyConvolutionFilter2DEXT)
-#define glGetConvolutionFilterEXT GLEW_GET_FUN(__glewGetConvolutionFilterEXT)
-#define glGetConvolutionParameterfvEXT GLEW_GET_FUN(__glewGetConvolutionParameterfvEXT)
-#define glGetConvolutionParameterivEXT GLEW_GET_FUN(__glewGetConvolutionParameterivEXT)
-#define glGetSeparableFilterEXT GLEW_GET_FUN(__glewGetSeparableFilterEXT)
-#define glSeparableFilter2DEXT GLEW_GET_FUN(__glewSeparableFilter2DEXT)
-
-#define GLEW_EXT_convolution GLEW_GET_VAR(__GLEW_EXT_convolution)
-
-#endif /* GL_EXT_convolution */
-
-/* ------------------------ GL_EXT_coordinate_frame ------------------------ */
-
-#ifndef GL_EXT_coordinate_frame
-#define GL_EXT_coordinate_frame 1
-
-#define GL_TANGENT_ARRAY_EXT 0x8439
-#define GL_BINORMAL_ARRAY_EXT 0x843A
-#define GL_CURRENT_TANGENT_EXT 0x843B
-#define GL_CURRENT_BINORMAL_EXT 0x843C
-#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E
-#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F
-#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440
-#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441
-#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442
-#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443
-#define GL_MAP1_TANGENT_EXT 0x8444
-#define GL_MAP2_TANGENT_EXT 0x8445
-#define GL_MAP1_BINORMAL_EXT 0x8446
-#define GL_MAP2_BINORMAL_EXT 0x8447
-
-typedef void (GLAPIENTRY * PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, void *pointer);
-typedef void (GLAPIENTRY * PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, void *pointer);
-
-#define glBinormalPointerEXT GLEW_GET_FUN(__glewBinormalPointerEXT)
-#define glTangentPointerEXT GLEW_GET_FUN(__glewTangentPointerEXT)
-
-#define GLEW_EXT_coordinate_frame GLEW_GET_VAR(__GLEW_EXT_coordinate_frame)
-
-#endif /* GL_EXT_coordinate_frame */
-
-/* -------------------------- GL_EXT_copy_texture -------------------------- */
-
-#ifndef GL_EXT_copy_texture
-#define GL_EXT_copy_texture 1
-
-typedef void (GLAPIENTRY * PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-typedef void (GLAPIENTRY * PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-
-#define glCopyTexImage1DEXT GLEW_GET_FUN(__glewCopyTexImage1DEXT)
-#define glCopyTexImage2DEXT GLEW_GET_FUN(__glewCopyTexImage2DEXT)
-#define glCopyTexSubImage1DEXT GLEW_GET_FUN(__glewCopyTexSubImage1DEXT)
-#define glCopyTexSubImage2DEXT GLEW_GET_FUN(__glewCopyTexSubImage2DEXT)
-#define glCopyTexSubImage3DEXT GLEW_GET_FUN(__glewCopyTexSubImage3DEXT)
-
-#define GLEW_EXT_copy_texture GLEW_GET_VAR(__GLEW_EXT_copy_texture)
-
-#endif /* GL_EXT_copy_texture */
-
-/* --------------------------- GL_EXT_cull_vertex -------------------------- */
-
-#ifndef GL_EXT_cull_vertex
-#define GL_EXT_cull_vertex 1
-
-#define GL_CULL_VERTEX_EXT 0x81AA
-#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB
-#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC
-
-typedef void (GLAPIENTRY * PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat* params);
-
-#define glCullParameterdvEXT GLEW_GET_FUN(__glewCullParameterdvEXT)
-#define glCullParameterfvEXT GLEW_GET_FUN(__glewCullParameterfvEXT)
-
-#define GLEW_EXT_cull_vertex GLEW_GET_VAR(__GLEW_EXT_cull_vertex)
-
-#endif /* GL_EXT_cull_vertex */
-
-/* --------------------------- GL_EXT_debug_label -------------------------- */
-
-#ifndef GL_EXT_debug_label
-#define GL_EXT_debug_label 1
-
-#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
-#define GL_PROGRAM_OBJECT_EXT 0x8B40
-#define GL_SHADER_OBJECT_EXT 0x8B48
-#define GL_BUFFER_OBJECT_EXT 0x9151
-#define GL_QUERY_OBJECT_EXT 0x9153
-#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
-
-typedef void (GLAPIENTRY * PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei* length, GLchar *label);
-typedef void (GLAPIENTRY * PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar* label);
-
-#define glGetObjectLabelEXT GLEW_GET_FUN(__glewGetObjectLabelEXT)
-#define glLabelObjectEXT GLEW_GET_FUN(__glewLabelObjectEXT)
-
-#define GLEW_EXT_debug_label GLEW_GET_VAR(__GLEW_EXT_debug_label)
-
-#endif /* GL_EXT_debug_label */
-
-/* -------------------------- GL_EXT_debug_marker -------------------------- */
-
-#ifndef GL_EXT_debug_marker
-#define GL_EXT_debug_marker 1
-
-typedef void (GLAPIENTRY * PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar* marker);
-typedef void (GLAPIENTRY * PFNGLPOPGROUPMARKEREXTPROC) (void);
-typedef void (GLAPIENTRY * PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar* marker);
-
-#define glInsertEventMarkerEXT GLEW_GET_FUN(__glewInsertEventMarkerEXT)
-#define glPopGroupMarkerEXT GLEW_GET_FUN(__glewPopGroupMarkerEXT)
-#define glPushGroupMarkerEXT GLEW_GET_FUN(__glewPushGroupMarkerEXT)
-
-#define GLEW_EXT_debug_marker GLEW_GET_VAR(__GLEW_EXT_debug_marker)
-
-#endif /* GL_EXT_debug_marker */
-
-/* ------------------------ GL_EXT_depth_bounds_test ----------------------- */
-
-#ifndef GL_EXT_depth_bounds_test
-#define GL_EXT_depth_bounds_test 1
-
-#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890
-#define GL_DEPTH_BOUNDS_EXT 0x8891
-
-typedef void (GLAPIENTRY * PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax);
-
-#define glDepthBoundsEXT GLEW_GET_FUN(__glewDepthBoundsEXT)
-
-#define GLEW_EXT_depth_bounds_test GLEW_GET_VAR(__GLEW_EXT_depth_bounds_test)
-
-#endif /* GL_EXT_depth_bounds_test */
-
-/* ----------------------- GL_EXT_direct_state_access ---------------------- */
-
-#ifndef GL_EXT_direct_state_access
-#define GL_EXT_direct_state_access 1
-
-#define GL_PROGRAM_MATRIX_EXT 0x8E2D
-#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E
-#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F
-
-typedef void (GLAPIENTRY * PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture);
-typedef GLenum (GLAPIENTRY * PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target);
-typedef void (GLAPIENTRY * PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-typedef void (GLAPIENTRY * PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);
-typedef void (GLAPIENTRY * PFNGLDISABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index);
-typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index);
-typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array);
-typedef void (GLAPIENTRY * PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);
-typedef void (GLAPIENTRY * PFNGLENABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index);
-typedef void (GLAPIENTRY * PFNGLENABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index);
-typedef void (GLAPIENTRY * PFNGLENABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array);
-typedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum* bufs);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);
-typedef void (GLAPIENTRY * PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target);
-typedef void (GLAPIENTRY * PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target);
-typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, void *img);
-typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, void *img);
-typedef void (GLAPIENTRY * PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint* param);
-typedef void (GLAPIENTRY * PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-typedef void (GLAPIENTRY * PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, void** params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, void *string);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, void** params);
-typedef void (GLAPIENTRY * PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, void** params);
-typedef void (GLAPIENTRY * PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-typedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint* param);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINTEGERVEXTPROC) (GLuint vaobj, GLenum pname, GLint* param);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, void** param);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYPOINTERVEXTPROC) (GLuint vaobj, GLenum pname, void** param);
-typedef void * (GLAPIENTRY * PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access);
-typedef void * (GLAPIENTRY * PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef void (GLAPIENTRY * PFNGLMATRIXFRUSTUMEXTPROC) (GLenum matrixMode, GLdouble l, GLdouble r, GLdouble b, GLdouble t, GLdouble n, GLdouble f);
-typedef void (GLAPIENTRY * PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum matrixMode);
-typedef void (GLAPIENTRY * PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum matrixMode, const GLdouble* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum matrixMode, const GLfloat* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXLOADDEXTPROC) (GLenum matrixMode, const GLdouble* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXLOADFEXTPROC) (GLenum matrixMode, const GLfloat* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum matrixMode, const GLdouble* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum matrixMode, const GLfloat* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXMULTDEXTPROC) (GLenum matrixMode, const GLdouble* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXMULTFEXTPROC) (GLenum matrixMode, const GLfloat* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXORTHOEXTPROC) (GLenum matrixMode, GLdouble l, GLdouble r, GLdouble b, GLdouble t, GLdouble n, GLdouble f);
-typedef void (GLAPIENTRY * PFNGLMATRIXPOPEXTPROC) (GLenum matrixMode);
-typedef void (GLAPIENTRY * PFNGLMATRIXPUSHEXTPROC) (GLenum matrixMode);
-typedef void (GLAPIENTRY * PFNGLMATRIXROTATEDEXTPROC) (GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLMATRIXROTATEFEXTPROC) (GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLMATRIXSCALEDEXTPROC) (GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLMATRIXSCALEFEXTPROC) (GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (GLAPIENTRY * PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);
-typedef void (GLAPIENTRY * PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint* params);
-typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat* param);
-typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* param);
-typedef void (GLAPIENTRY * PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer);
-typedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
-typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-typedef void (GLAPIENTRY * PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
-typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
-typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint* params);
-typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint* params);
-typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string);
-typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
-typedef void (GLAPIENTRY * PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint* params);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat* param);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint* param);
-typedef void (GLAPIENTRY * PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer);
-typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef GLboolean (GLAPIENTRY * PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYINDEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYNORMALOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC) (GLuint vaobj, GLuint index, GLuint divisor);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-
-#define glBindMultiTextureEXT GLEW_GET_FUN(__glewBindMultiTextureEXT)
-#define glCheckNamedFramebufferStatusEXT GLEW_GET_FUN(__glewCheckNamedFramebufferStatusEXT)
-#define glClientAttribDefaultEXT GLEW_GET_FUN(__glewClientAttribDefaultEXT)
-#define glCompressedMultiTexImage1DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage1DEXT)
-#define glCompressedMultiTexImage2DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage2DEXT)
-#define glCompressedMultiTexImage3DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage3DEXT)
-#define glCompressedMultiTexSubImage1DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage1DEXT)
-#define glCompressedMultiTexSubImage2DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage2DEXT)
-#define glCompressedMultiTexSubImage3DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage3DEXT)
-#define glCompressedTextureImage1DEXT GLEW_GET_FUN(__glewCompressedTextureImage1DEXT)
-#define glCompressedTextureImage2DEXT GLEW_GET_FUN(__glewCompressedTextureImage2DEXT)
-#define glCompressedTextureImage3DEXT GLEW_GET_FUN(__glewCompressedTextureImage3DEXT)
-#define glCompressedTextureSubImage1DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage1DEXT)
-#define glCompressedTextureSubImage2DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage2DEXT)
-#define glCompressedTextureSubImage3DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage3DEXT)
-#define glCopyMultiTexImage1DEXT GLEW_GET_FUN(__glewCopyMultiTexImage1DEXT)
-#define glCopyMultiTexImage2DEXT GLEW_GET_FUN(__glewCopyMultiTexImage2DEXT)
-#define glCopyMultiTexSubImage1DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage1DEXT)
-#define glCopyMultiTexSubImage2DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage2DEXT)
-#define glCopyMultiTexSubImage3DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage3DEXT)
-#define glCopyTextureImage1DEXT GLEW_GET_FUN(__glewCopyTextureImage1DEXT)
-#define glCopyTextureImage2DEXT GLEW_GET_FUN(__glewCopyTextureImage2DEXT)
-#define glCopyTextureSubImage1DEXT GLEW_GET_FUN(__glewCopyTextureSubImage1DEXT)
-#define glCopyTextureSubImage2DEXT GLEW_GET_FUN(__glewCopyTextureSubImage2DEXT)
-#define glCopyTextureSubImage3DEXT GLEW_GET_FUN(__glewCopyTextureSubImage3DEXT)
-#define glDisableClientStateIndexedEXT GLEW_GET_FUN(__glewDisableClientStateIndexedEXT)
-#define glDisableClientStateiEXT GLEW_GET_FUN(__glewDisableClientStateiEXT)
-#define glDisableVertexArrayAttribEXT GLEW_GET_FUN(__glewDisableVertexArrayAttribEXT)
-#define glDisableVertexArrayEXT GLEW_GET_FUN(__glewDisableVertexArrayEXT)
-#define glEnableClientStateIndexedEXT GLEW_GET_FUN(__glewEnableClientStateIndexedEXT)
-#define glEnableClientStateiEXT GLEW_GET_FUN(__glewEnableClientStateiEXT)
-#define glEnableVertexArrayAttribEXT GLEW_GET_FUN(__glewEnableVertexArrayAttribEXT)
-#define glEnableVertexArrayEXT GLEW_GET_FUN(__glewEnableVertexArrayEXT)
-#define glFlushMappedNamedBufferRangeEXT GLEW_GET_FUN(__glewFlushMappedNamedBufferRangeEXT)
-#define glFramebufferDrawBufferEXT GLEW_GET_FUN(__glewFramebufferDrawBufferEXT)
-#define glFramebufferDrawBuffersEXT GLEW_GET_FUN(__glewFramebufferDrawBuffersEXT)
-#define glFramebufferReadBufferEXT GLEW_GET_FUN(__glewFramebufferReadBufferEXT)
-#define glGenerateMultiTexMipmapEXT GLEW_GET_FUN(__glewGenerateMultiTexMipmapEXT)
-#define glGenerateTextureMipmapEXT GLEW_GET_FUN(__glewGenerateTextureMipmapEXT)
-#define glGetCompressedMultiTexImageEXT GLEW_GET_FUN(__glewGetCompressedMultiTexImageEXT)
-#define glGetCompressedTextureImageEXT GLEW_GET_FUN(__glewGetCompressedTextureImageEXT)
-#define glGetDoubleIndexedvEXT GLEW_GET_FUN(__glewGetDoubleIndexedvEXT)
-#define glGetDoublei_vEXT GLEW_GET_FUN(__glewGetDoublei_vEXT)
-#define glGetFloatIndexedvEXT GLEW_GET_FUN(__glewGetFloatIndexedvEXT)
-#define glGetFloati_vEXT GLEW_GET_FUN(__glewGetFloati_vEXT)
-#define glGetFramebufferParameterivEXT GLEW_GET_FUN(__glewGetFramebufferParameterivEXT)
-#define glGetMultiTexEnvfvEXT GLEW_GET_FUN(__glewGetMultiTexEnvfvEXT)
-#define glGetMultiTexEnvivEXT GLEW_GET_FUN(__glewGetMultiTexEnvivEXT)
-#define glGetMultiTexGendvEXT GLEW_GET_FUN(__glewGetMultiTexGendvEXT)
-#define glGetMultiTexGenfvEXT GLEW_GET_FUN(__glewGetMultiTexGenfvEXT)
-#define glGetMultiTexGenivEXT GLEW_GET_FUN(__glewGetMultiTexGenivEXT)
-#define glGetMultiTexImageEXT GLEW_GET_FUN(__glewGetMultiTexImageEXT)
-#define glGetMultiTexLevelParameterfvEXT GLEW_GET_FUN(__glewGetMultiTexLevelParameterfvEXT)
-#define glGetMultiTexLevelParameterivEXT GLEW_GET_FUN(__glewGetMultiTexLevelParameterivEXT)
-#define glGetMultiTexParameterIivEXT GLEW_GET_FUN(__glewGetMultiTexParameterIivEXT)
-#define glGetMultiTexParameterIuivEXT GLEW_GET_FUN(__glewGetMultiTexParameterIuivEXT)
-#define glGetMultiTexParameterfvEXT GLEW_GET_FUN(__glewGetMultiTexParameterfvEXT)
-#define glGetMultiTexParameterivEXT GLEW_GET_FUN(__glewGetMultiTexParameterivEXT)
-#define glGetNamedBufferParameterivEXT GLEW_GET_FUN(__glewGetNamedBufferParameterivEXT)
-#define glGetNamedBufferPointervEXT GLEW_GET_FUN(__glewGetNamedBufferPointervEXT)
-#define glGetNamedBufferSubDataEXT GLEW_GET_FUN(__glewGetNamedBufferSubDataEXT)
-#define glGetNamedFramebufferAttachmentParameterivEXT GLEW_GET_FUN(__glewGetNamedFramebufferAttachmentParameterivEXT)
-#define glGetNamedProgramLocalParameterIivEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterIivEXT)
-#define glGetNamedProgramLocalParameterIuivEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterIuivEXT)
-#define glGetNamedProgramLocalParameterdvEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterdvEXT)
-#define glGetNamedProgramLocalParameterfvEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterfvEXT)
-#define glGetNamedProgramStringEXT GLEW_GET_FUN(__glewGetNamedProgramStringEXT)
-#define glGetNamedProgramivEXT GLEW_GET_FUN(__glewGetNamedProgramivEXT)
-#define glGetNamedRenderbufferParameterivEXT GLEW_GET_FUN(__glewGetNamedRenderbufferParameterivEXT)
-#define glGetPointerIndexedvEXT GLEW_GET_FUN(__glewGetPointerIndexedvEXT)
-#define glGetPointeri_vEXT GLEW_GET_FUN(__glewGetPointeri_vEXT)
-#define glGetTextureImageEXT GLEW_GET_FUN(__glewGetTextureImageEXT)
-#define glGetTextureLevelParameterfvEXT GLEW_GET_FUN(__glewGetTextureLevelParameterfvEXT)
-#define glGetTextureLevelParameterivEXT GLEW_GET_FUN(__glewGetTextureLevelParameterivEXT)
-#define glGetTextureParameterIivEXT GLEW_GET_FUN(__glewGetTextureParameterIivEXT)
-#define glGetTextureParameterIuivEXT GLEW_GET_FUN(__glewGetTextureParameterIuivEXT)
-#define glGetTextureParameterfvEXT GLEW_GET_FUN(__glewGetTextureParameterfvEXT)
-#define glGetTextureParameterivEXT GLEW_GET_FUN(__glewGetTextureParameterivEXT)
-#define glGetVertexArrayIntegeri_vEXT GLEW_GET_FUN(__glewGetVertexArrayIntegeri_vEXT)
-#define glGetVertexArrayIntegervEXT GLEW_GET_FUN(__glewGetVertexArrayIntegervEXT)
-#define glGetVertexArrayPointeri_vEXT GLEW_GET_FUN(__glewGetVertexArrayPointeri_vEXT)
-#define glGetVertexArrayPointervEXT GLEW_GET_FUN(__glewGetVertexArrayPointervEXT)
-#define glMapNamedBufferEXT GLEW_GET_FUN(__glewMapNamedBufferEXT)
-#define glMapNamedBufferRangeEXT GLEW_GET_FUN(__glewMapNamedBufferRangeEXT)
-#define glMatrixFrustumEXT GLEW_GET_FUN(__glewMatrixFrustumEXT)
-#define glMatrixLoadIdentityEXT GLEW_GET_FUN(__glewMatrixLoadIdentityEXT)
-#define glMatrixLoadTransposedEXT GLEW_GET_FUN(__glewMatrixLoadTransposedEXT)
-#define glMatrixLoadTransposefEXT GLEW_GET_FUN(__glewMatrixLoadTransposefEXT)
-#define glMatrixLoaddEXT GLEW_GET_FUN(__glewMatrixLoaddEXT)
-#define glMatrixLoadfEXT GLEW_GET_FUN(__glewMatrixLoadfEXT)
-#define glMatrixMultTransposedEXT GLEW_GET_FUN(__glewMatrixMultTransposedEXT)
-#define glMatrixMultTransposefEXT GLEW_GET_FUN(__glewMatrixMultTransposefEXT)
-#define glMatrixMultdEXT GLEW_GET_FUN(__glewMatrixMultdEXT)
-#define glMatrixMultfEXT GLEW_GET_FUN(__glewMatrixMultfEXT)
-#define glMatrixOrthoEXT GLEW_GET_FUN(__glewMatrixOrthoEXT)
-#define glMatrixPopEXT GLEW_GET_FUN(__glewMatrixPopEXT)
-#define glMatrixPushEXT GLEW_GET_FUN(__glewMatrixPushEXT)
-#define glMatrixRotatedEXT GLEW_GET_FUN(__glewMatrixRotatedEXT)
-#define glMatrixRotatefEXT GLEW_GET_FUN(__glewMatrixRotatefEXT)
-#define glMatrixScaledEXT GLEW_GET_FUN(__glewMatrixScaledEXT)
-#define glMatrixScalefEXT GLEW_GET_FUN(__glewMatrixScalefEXT)
-#define glMatrixTranslatedEXT GLEW_GET_FUN(__glewMatrixTranslatedEXT)
-#define glMatrixTranslatefEXT GLEW_GET_FUN(__glewMatrixTranslatefEXT)
-#define glMultiTexBufferEXT GLEW_GET_FUN(__glewMultiTexBufferEXT)
-#define glMultiTexCoordPointerEXT GLEW_GET_FUN(__glewMultiTexCoordPointerEXT)
-#define glMultiTexEnvfEXT GLEW_GET_FUN(__glewMultiTexEnvfEXT)
-#define glMultiTexEnvfvEXT GLEW_GET_FUN(__glewMultiTexEnvfvEXT)
-#define glMultiTexEnviEXT GLEW_GET_FUN(__glewMultiTexEnviEXT)
-#define glMultiTexEnvivEXT GLEW_GET_FUN(__glewMultiTexEnvivEXT)
-#define glMultiTexGendEXT GLEW_GET_FUN(__glewMultiTexGendEXT)
-#define glMultiTexGendvEXT GLEW_GET_FUN(__glewMultiTexGendvEXT)
-#define glMultiTexGenfEXT GLEW_GET_FUN(__glewMultiTexGenfEXT)
-#define glMultiTexGenfvEXT GLEW_GET_FUN(__glewMultiTexGenfvEXT)
-#define glMultiTexGeniEXT GLEW_GET_FUN(__glewMultiTexGeniEXT)
-#define glMultiTexGenivEXT GLEW_GET_FUN(__glewMultiTexGenivEXT)
-#define glMultiTexImage1DEXT GLEW_GET_FUN(__glewMultiTexImage1DEXT)
-#define glMultiTexImage2DEXT GLEW_GET_FUN(__glewMultiTexImage2DEXT)
-#define glMultiTexImage3DEXT GLEW_GET_FUN(__glewMultiTexImage3DEXT)
-#define glMultiTexParameterIivEXT GLEW_GET_FUN(__glewMultiTexParameterIivEXT)
-#define glMultiTexParameterIuivEXT GLEW_GET_FUN(__glewMultiTexParameterIuivEXT)
-#define glMultiTexParameterfEXT GLEW_GET_FUN(__glewMultiTexParameterfEXT)
-#define glMultiTexParameterfvEXT GLEW_GET_FUN(__glewMultiTexParameterfvEXT)
-#define glMultiTexParameteriEXT GLEW_GET_FUN(__glewMultiTexParameteriEXT)
-#define glMultiTexParameterivEXT GLEW_GET_FUN(__glewMultiTexParameterivEXT)
-#define glMultiTexRenderbufferEXT GLEW_GET_FUN(__glewMultiTexRenderbufferEXT)
-#define glMultiTexSubImage1DEXT GLEW_GET_FUN(__glewMultiTexSubImage1DEXT)
-#define glMultiTexSubImage2DEXT GLEW_GET_FUN(__glewMultiTexSubImage2DEXT)
-#define glMultiTexSubImage3DEXT GLEW_GET_FUN(__glewMultiTexSubImage3DEXT)
-#define glNamedBufferDataEXT GLEW_GET_FUN(__glewNamedBufferDataEXT)
-#define glNamedBufferSubDataEXT GLEW_GET_FUN(__glewNamedBufferSubDataEXT)
-#define glNamedCopyBufferSubDataEXT GLEW_GET_FUN(__glewNamedCopyBufferSubDataEXT)
-#define glNamedFramebufferRenderbufferEXT GLEW_GET_FUN(__glewNamedFramebufferRenderbufferEXT)
-#define glNamedFramebufferTexture1DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture1DEXT)
-#define glNamedFramebufferTexture2DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture2DEXT)
-#define glNamedFramebufferTexture3DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture3DEXT)
-#define glNamedFramebufferTextureEXT GLEW_GET_FUN(__glewNamedFramebufferTextureEXT)
-#define glNamedFramebufferTextureFaceEXT GLEW_GET_FUN(__glewNamedFramebufferTextureFaceEXT)
-#define glNamedFramebufferTextureLayerEXT GLEW_GET_FUN(__glewNamedFramebufferTextureLayerEXT)
-#define glNamedProgramLocalParameter4dEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4dEXT)
-#define glNamedProgramLocalParameter4dvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4dvEXT)
-#define glNamedProgramLocalParameter4fEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4fEXT)
-#define glNamedProgramLocalParameter4fvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4fvEXT)
-#define glNamedProgramLocalParameterI4iEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4iEXT)
-#define glNamedProgramLocalParameterI4ivEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4ivEXT)
-#define glNamedProgramLocalParameterI4uiEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4uiEXT)
-#define glNamedProgramLocalParameterI4uivEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4uivEXT)
-#define glNamedProgramLocalParameters4fvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameters4fvEXT)
-#define glNamedProgramLocalParametersI4ivEXT GLEW_GET_FUN(__glewNamedProgramLocalParametersI4ivEXT)
-#define glNamedProgramLocalParametersI4uivEXT GLEW_GET_FUN(__glewNamedProgramLocalParametersI4uivEXT)
-#define glNamedProgramStringEXT GLEW_GET_FUN(__glewNamedProgramStringEXT)
-#define glNamedRenderbufferStorageEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageEXT)
-#define glNamedRenderbufferStorageMultisampleCoverageEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisampleCoverageEXT)
-#define glNamedRenderbufferStorageMultisampleEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisampleEXT)
-#define glProgramUniform1fEXT GLEW_GET_FUN(__glewProgramUniform1fEXT)
-#define glProgramUniform1fvEXT GLEW_GET_FUN(__glewProgramUniform1fvEXT)
-#define glProgramUniform1iEXT GLEW_GET_FUN(__glewProgramUniform1iEXT)
-#define glProgramUniform1ivEXT GLEW_GET_FUN(__glewProgramUniform1ivEXT)
-#define glProgramUniform1uiEXT GLEW_GET_FUN(__glewProgramUniform1uiEXT)
-#define glProgramUniform1uivEXT GLEW_GET_FUN(__glewProgramUniform1uivEXT)
-#define glProgramUniform2fEXT GLEW_GET_FUN(__glewProgramUniform2fEXT)
-#define glProgramUniform2fvEXT GLEW_GET_FUN(__glewProgramUniform2fvEXT)
-#define glProgramUniform2iEXT GLEW_GET_FUN(__glewProgramUniform2iEXT)
-#define glProgramUniform2ivEXT GLEW_GET_FUN(__glewProgramUniform2ivEXT)
-#define glProgramUniform2uiEXT GLEW_GET_FUN(__glewProgramUniform2uiEXT)
-#define glProgramUniform2uivEXT GLEW_GET_FUN(__glewProgramUniform2uivEXT)
-#define glProgramUniform3fEXT GLEW_GET_FUN(__glewProgramUniform3fEXT)
-#define glProgramUniform3fvEXT GLEW_GET_FUN(__glewProgramUniform3fvEXT)
-#define glProgramUniform3iEXT GLEW_GET_FUN(__glewProgramUniform3iEXT)
-#define glProgramUniform3ivEXT GLEW_GET_FUN(__glewProgramUniform3ivEXT)
-#define glProgramUniform3uiEXT GLEW_GET_FUN(__glewProgramUniform3uiEXT)
-#define glProgramUniform3uivEXT GLEW_GET_FUN(__glewProgramUniform3uivEXT)
-#define glProgramUniform4fEXT GLEW_GET_FUN(__glewProgramUniform4fEXT)
-#define glProgramUniform4fvEXT GLEW_GET_FUN(__glewProgramUniform4fvEXT)
-#define glProgramUniform4iEXT GLEW_GET_FUN(__glewProgramUniform4iEXT)
-#define glProgramUniform4ivEXT GLEW_GET_FUN(__glewProgramUniform4ivEXT)
-#define glProgramUniform4uiEXT GLEW_GET_FUN(__glewProgramUniform4uiEXT)
-#define glProgramUniform4uivEXT GLEW_GET_FUN(__glewProgramUniform4uivEXT)
-#define glProgramUniformMatrix2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2fvEXT)
-#define glProgramUniformMatrix2x3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x3fvEXT)
-#define glProgramUniformMatrix2x4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x4fvEXT)
-#define glProgramUniformMatrix3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3fvEXT)
-#define glProgramUniformMatrix3x2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x2fvEXT)
-#define glProgramUniformMatrix3x4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x4fvEXT)
-#define glProgramUniformMatrix4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4fvEXT)
-#define glProgramUniformMatrix4x2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x2fvEXT)
-#define glProgramUniformMatrix4x3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x3fvEXT)
-#define glPushClientAttribDefaultEXT GLEW_GET_FUN(__glewPushClientAttribDefaultEXT)
-#define glTextureBufferEXT GLEW_GET_FUN(__glewTextureBufferEXT)
-#define glTextureImage1DEXT GLEW_GET_FUN(__glewTextureImage1DEXT)
-#define glTextureImage2DEXT GLEW_GET_FUN(__glewTextureImage2DEXT)
-#define glTextureImage3DEXT GLEW_GET_FUN(__glewTextureImage3DEXT)
-#define glTextureParameterIivEXT GLEW_GET_FUN(__glewTextureParameterIivEXT)
-#define glTextureParameterIuivEXT GLEW_GET_FUN(__glewTextureParameterIuivEXT)
-#define glTextureParameterfEXT GLEW_GET_FUN(__glewTextureParameterfEXT)
-#define glTextureParameterfvEXT GLEW_GET_FUN(__glewTextureParameterfvEXT)
-#define glTextureParameteriEXT GLEW_GET_FUN(__glewTextureParameteriEXT)
-#define glTextureParameterivEXT GLEW_GET_FUN(__glewTextureParameterivEXT)
-#define glTextureRenderbufferEXT GLEW_GET_FUN(__glewTextureRenderbufferEXT)
-#define glTextureSubImage1DEXT GLEW_GET_FUN(__glewTextureSubImage1DEXT)
-#define glTextureSubImage2DEXT GLEW_GET_FUN(__glewTextureSubImage2DEXT)
-#define glTextureSubImage3DEXT GLEW_GET_FUN(__glewTextureSubImage3DEXT)
-#define glUnmapNamedBufferEXT GLEW_GET_FUN(__glewUnmapNamedBufferEXT)
-#define glVertexArrayColorOffsetEXT GLEW_GET_FUN(__glewVertexArrayColorOffsetEXT)
-#define glVertexArrayEdgeFlagOffsetEXT GLEW_GET_FUN(__glewVertexArrayEdgeFlagOffsetEXT)
-#define glVertexArrayFogCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayFogCoordOffsetEXT)
-#define glVertexArrayIndexOffsetEXT GLEW_GET_FUN(__glewVertexArrayIndexOffsetEXT)
-#define glVertexArrayMultiTexCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayMultiTexCoordOffsetEXT)
-#define glVertexArrayNormalOffsetEXT GLEW_GET_FUN(__glewVertexArrayNormalOffsetEXT)
-#define glVertexArraySecondaryColorOffsetEXT GLEW_GET_FUN(__glewVertexArraySecondaryColorOffsetEXT)
-#define glVertexArrayTexCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayTexCoordOffsetEXT)
-#define glVertexArrayVertexAttribDivisorEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribDivisorEXT)
-#define glVertexArrayVertexAttribIOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribIOffsetEXT)
-#define glVertexArrayVertexAttribOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribOffsetEXT)
-#define glVertexArrayVertexOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexOffsetEXT)
-
-#define GLEW_EXT_direct_state_access GLEW_GET_VAR(__GLEW_EXT_direct_state_access)
-
-#endif /* GL_EXT_direct_state_access */
-
-/* -------------------------- GL_EXT_draw_buffers2 ------------------------- */
-
-#ifndef GL_EXT_draw_buffers2
-#define GL_EXT_draw_buffers2 1
-
-typedef void (GLAPIENTRY * PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-typedef void (GLAPIENTRY * PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
-typedef void (GLAPIENTRY * PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
-typedef void (GLAPIENTRY * PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum value, GLuint index, GLboolean* data);
-typedef void (GLAPIENTRY * PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum value, GLuint index, GLint* data);
-typedef GLboolean (GLAPIENTRY * PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index);
-
-#define glColorMaskIndexedEXT GLEW_GET_FUN(__glewColorMaskIndexedEXT)
-#define glDisableIndexedEXT GLEW_GET_FUN(__glewDisableIndexedEXT)
-#define glEnableIndexedEXT GLEW_GET_FUN(__glewEnableIndexedEXT)
-#define glGetBooleanIndexedvEXT GLEW_GET_FUN(__glewGetBooleanIndexedvEXT)
-#define glGetIntegerIndexedvEXT GLEW_GET_FUN(__glewGetIntegerIndexedvEXT)
-#define glIsEnabledIndexedEXT GLEW_GET_FUN(__glewIsEnabledIndexedEXT)
-
-#define GLEW_EXT_draw_buffers2 GLEW_GET_VAR(__GLEW_EXT_draw_buffers2)
-
-#endif /* GL_EXT_draw_buffers2 */
-
-/* ------------------------- GL_EXT_draw_instanced ------------------------- */
-
-#ifndef GL_EXT_draw_instanced
-#define GL_EXT_draw_instanced 1
-
-typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
-typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-
-#define glDrawArraysInstancedEXT GLEW_GET_FUN(__glewDrawArraysInstancedEXT)
-#define glDrawElementsInstancedEXT GLEW_GET_FUN(__glewDrawElementsInstancedEXT)
-
-#define GLEW_EXT_draw_instanced GLEW_GET_VAR(__GLEW_EXT_draw_instanced)
-
-#endif /* GL_EXT_draw_instanced */
-
-/* ----------------------- GL_EXT_draw_range_elements ---------------------- */
-
-#ifndef GL_EXT_draw_range_elements
-#define GL_EXT_draw_range_elements 1
-
-#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8
-#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9
-
-typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-
-#define glDrawRangeElementsEXT GLEW_GET_FUN(__glewDrawRangeElementsEXT)
-
-#define GLEW_EXT_draw_range_elements GLEW_GET_VAR(__GLEW_EXT_draw_range_elements)
-
-#endif /* GL_EXT_draw_range_elements */
-
-/* ---------------------------- GL_EXT_fog_coord --------------------------- */
-
-#ifndef GL_EXT_fog_coord
-#define GL_EXT_fog_coord 1
-
-#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450
-#define GL_FOG_COORDINATE_EXT 0x8451
-#define GL_FRAGMENT_DEPTH_EXT 0x8452
-#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453
-#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454
-#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455
-#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456
-#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457
-
-typedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);
-
-#define glFogCoordPointerEXT GLEW_GET_FUN(__glewFogCoordPointerEXT)
-#define glFogCoorddEXT GLEW_GET_FUN(__glewFogCoorddEXT)
-#define glFogCoorddvEXT GLEW_GET_FUN(__glewFogCoorddvEXT)
-#define glFogCoordfEXT GLEW_GET_FUN(__glewFogCoordfEXT)
-#define glFogCoordfvEXT GLEW_GET_FUN(__glewFogCoordfvEXT)
-
-#define GLEW_EXT_fog_coord GLEW_GET_VAR(__GLEW_EXT_fog_coord)
-
-#endif /* GL_EXT_fog_coord */
-
-/* ------------------------ GL_EXT_fragment_lighting ----------------------- */
-
-#ifndef GL_EXT_fragment_lighting
-#define GL_EXT_fragment_lighting 1
-
-#define GL_FRAGMENT_LIGHTING_EXT 0x8400
-#define GL_FRAGMENT_COLOR_MATERIAL_EXT 0x8401
-#define GL_FRAGMENT_COLOR_MATERIAL_FACE_EXT 0x8402
-#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_EXT 0x8403
-#define GL_MAX_FRAGMENT_LIGHTS_EXT 0x8404
-#define GL_MAX_ACTIVE_LIGHTS_EXT 0x8405
-#define GL_CURRENT_RASTER_NORMAL_EXT 0x8406
-#define GL_LIGHT_ENV_MODE_EXT 0x8407
-#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_EXT 0x8408
-#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_EXT 0x8409
-#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_EXT 0x840A
-#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_EXT 0x840B
-#define GL_FRAGMENT_LIGHT0_EXT 0x840C
-#define GL_FRAGMENT_LIGHT7_EXT 0x8413
-
-typedef void (GLAPIENTRY * PFNGLFRAGMENTCOLORMATERIALEXTPROC) (GLenum face, GLenum mode);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFEXTPROC) (GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVEXTPROC) (GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIEXTPROC) (GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVEXTPROC) (GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFEXTPROC) (GLenum light, GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVEXTPROC) (GLenum light, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIEXTPROC) (GLenum light, GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVEXTPROC) (GLenum light, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFEXTPROC) (GLenum face, GLenum pname, const GLfloat param);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFVEXTPROC) (GLenum face, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIEXTPROC) (GLenum face, GLenum pname, const GLint param);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVEXTPROC) (GLenum face, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVEXTPROC) (GLenum light, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVEXTPROC) (GLenum light, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVEXTPROC) (GLenum face, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVEXTPROC) (GLenum face, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLLIGHTENVIEXTPROC) (GLenum pname, GLint param);
-
-#define glFragmentColorMaterialEXT GLEW_GET_FUN(__glewFragmentColorMaterialEXT)
-#define glFragmentLightModelfEXT GLEW_GET_FUN(__glewFragmentLightModelfEXT)
-#define glFragmentLightModelfvEXT GLEW_GET_FUN(__glewFragmentLightModelfvEXT)
-#define glFragmentLightModeliEXT GLEW_GET_FUN(__glewFragmentLightModeliEXT)
-#define glFragmentLightModelivEXT GLEW_GET_FUN(__glewFragmentLightModelivEXT)
-#define glFragmentLightfEXT GLEW_GET_FUN(__glewFragmentLightfEXT)
-#define glFragmentLightfvEXT GLEW_GET_FUN(__glewFragmentLightfvEXT)
-#define glFragmentLightiEXT GLEW_GET_FUN(__glewFragmentLightiEXT)
-#define glFragmentLightivEXT GLEW_GET_FUN(__glewFragmentLightivEXT)
-#define glFragmentMaterialfEXT GLEW_GET_FUN(__glewFragmentMaterialfEXT)
-#define glFragmentMaterialfvEXT GLEW_GET_FUN(__glewFragmentMaterialfvEXT)
-#define glFragmentMaterialiEXT GLEW_GET_FUN(__glewFragmentMaterialiEXT)
-#define glFragmentMaterialivEXT GLEW_GET_FUN(__glewFragmentMaterialivEXT)
-#define glGetFragmentLightfvEXT GLEW_GET_FUN(__glewGetFragmentLightfvEXT)
-#define glGetFragmentLightivEXT GLEW_GET_FUN(__glewGetFragmentLightivEXT)
-#define glGetFragmentMaterialfvEXT GLEW_GET_FUN(__glewGetFragmentMaterialfvEXT)
-#define glGetFragmentMaterialivEXT GLEW_GET_FUN(__glewGetFragmentMaterialivEXT)
-#define glLightEnviEXT GLEW_GET_FUN(__glewLightEnviEXT)
-
-#define GLEW_EXT_fragment_lighting GLEW_GET_VAR(__GLEW_EXT_fragment_lighting)
-
-#endif /* GL_EXT_fragment_lighting */
-
-/* ------------------------ GL_EXT_framebuffer_blit ------------------------ */
-
-#ifndef GL_EXT_framebuffer_blit
-#define GL_EXT_framebuffer_blit 1
-
-#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6
-#define GL_READ_FRAMEBUFFER_EXT 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
-#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
-
-typedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-
-#define glBlitFramebufferEXT GLEW_GET_FUN(__glewBlitFramebufferEXT)
-
-#define GLEW_EXT_framebuffer_blit GLEW_GET_VAR(__GLEW_EXT_framebuffer_blit)
-
-#endif /* GL_EXT_framebuffer_blit */
-
-/* --------------------- GL_EXT_framebuffer_multisample -------------------- */
-
-#ifndef GL_EXT_framebuffer_multisample
-#define GL_EXT_framebuffer_multisample 1
-
-#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
-#define GL_MAX_SAMPLES_EXT 0x8D57
-
-typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-
-#define glRenderbufferStorageMultisampleEXT GLEW_GET_FUN(__glewRenderbufferStorageMultisampleEXT)
-
-#define GLEW_EXT_framebuffer_multisample GLEW_GET_VAR(__GLEW_EXT_framebuffer_multisample)
-
-#endif /* GL_EXT_framebuffer_multisample */
-
-/* --------------- GL_EXT_framebuffer_multisample_blit_scaled -------------- */
-
-#ifndef GL_EXT_framebuffer_multisample_blit_scaled
-#define GL_EXT_framebuffer_multisample_blit_scaled 1
-
-#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA
-#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB
-
-#define GLEW_EXT_framebuffer_multisample_blit_scaled GLEW_GET_VAR(__GLEW_EXT_framebuffer_multisample_blit_scaled)
-
-#endif /* GL_EXT_framebuffer_multisample_blit_scaled */
-
-/* ----------------------- GL_EXT_framebuffer_object ----------------------- */
-
-#ifndef GL_EXT_framebuffer_object
-#define GL_EXT_framebuffer_object 1
-
-#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
-#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
-#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
-#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
-#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
-#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
-#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
-#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
-#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
-#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
-#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
-#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
-#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
-#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
-#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
-#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
-#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
-#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
-#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
-#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
-#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
-#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
-#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
-#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
-#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
-#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
-#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
-#define GL_STENCIL_ATTACHMENT_EXT 0x8D20
-#define GL_FRAMEBUFFER_EXT 0x8D40
-#define GL_RENDERBUFFER_EXT 0x8D41
-#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
-#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
-#define GL_STENCIL_INDEX1_EXT 0x8D46
-#define GL_STENCIL_INDEX4_EXT 0x8D47
-#define GL_STENCIL_INDEX8_EXT 0x8D48
-#define GL_STENCIL_INDEX16_EXT 0x8D49
-#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
-
-typedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);
-typedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
-typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target);
-typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint* framebuffers);
-typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint* renderbuffers);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-typedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint* framebuffers);
-typedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint* renderbuffers);
-typedef void (GLAPIENTRY * PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);
-typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);
-typedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
-typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-
-#define glBindFramebufferEXT GLEW_GET_FUN(__glewBindFramebufferEXT)
-#define glBindRenderbufferEXT GLEW_GET_FUN(__glewBindRenderbufferEXT)
-#define glCheckFramebufferStatusEXT GLEW_GET_FUN(__glewCheckFramebufferStatusEXT)
-#define glDeleteFramebuffersEXT GLEW_GET_FUN(__glewDeleteFramebuffersEXT)
-#define glDeleteRenderbuffersEXT GLEW_GET_FUN(__glewDeleteRenderbuffersEXT)
-#define glFramebufferRenderbufferEXT GLEW_GET_FUN(__glewFramebufferRenderbufferEXT)
-#define glFramebufferTexture1DEXT GLEW_GET_FUN(__glewFramebufferTexture1DEXT)
-#define glFramebufferTexture2DEXT GLEW_GET_FUN(__glewFramebufferTexture2DEXT)
-#define glFramebufferTexture3DEXT GLEW_GET_FUN(__glewFramebufferTexture3DEXT)
-#define glGenFramebuffersEXT GLEW_GET_FUN(__glewGenFramebuffersEXT)
-#define glGenRenderbuffersEXT GLEW_GET_FUN(__glewGenRenderbuffersEXT)
-#define glGenerateMipmapEXT GLEW_GET_FUN(__glewGenerateMipmapEXT)
-#define glGetFramebufferAttachmentParameterivEXT GLEW_GET_FUN(__glewGetFramebufferAttachmentParameterivEXT)
-#define glGetRenderbufferParameterivEXT GLEW_GET_FUN(__glewGetRenderbufferParameterivEXT)
-#define glIsFramebufferEXT GLEW_GET_FUN(__glewIsFramebufferEXT)
-#define glIsRenderbufferEXT GLEW_GET_FUN(__glewIsRenderbufferEXT)
-#define glRenderbufferStorageEXT GLEW_GET_FUN(__glewRenderbufferStorageEXT)
-
-#define GLEW_EXT_framebuffer_object GLEW_GET_VAR(__GLEW_EXT_framebuffer_object)
-
-#endif /* GL_EXT_framebuffer_object */
-
-/* ------------------------ GL_EXT_framebuffer_sRGB ------------------------ */
-
-#ifndef GL_EXT_framebuffer_sRGB
-#define GL_EXT_framebuffer_sRGB 1
-
-#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
-#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA
-
-#define GLEW_EXT_framebuffer_sRGB GLEW_GET_VAR(__GLEW_EXT_framebuffer_sRGB)
-
-#endif /* GL_EXT_framebuffer_sRGB */
-
-/* ------------------------ GL_EXT_geometry_shader4 ------------------------ */
-
-#ifndef GL_EXT_geometry_shader4
-#define GL_EXT_geometry_shader4 1
-
-#define GL_LINES_ADJACENCY_EXT 0xA
-#define GL_LINE_STRIP_ADJACENCY_EXT 0xB
-#define GL_TRIANGLES_ADJACENCY_EXT 0xC
-#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0xD
-#define GL_PROGRAM_POINT_SIZE_EXT 0x8642
-#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B
-#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
-#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9
-#define GL_GEOMETRY_SHADER_EXT 0x8DD9
-#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA
-#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB
-#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC
-#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD
-#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE
-#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
-#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
-#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
-
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
-typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
-
-#define glFramebufferTextureEXT GLEW_GET_FUN(__glewFramebufferTextureEXT)
-#define glFramebufferTextureFaceEXT GLEW_GET_FUN(__glewFramebufferTextureFaceEXT)
-#define glProgramParameteriEXT GLEW_GET_FUN(__glewProgramParameteriEXT)
-
-#define GLEW_EXT_geometry_shader4 GLEW_GET_VAR(__GLEW_EXT_geometry_shader4)
-
-#endif /* GL_EXT_geometry_shader4 */
-
-/* --------------------- GL_EXT_gpu_program_parameters --------------------- */
-
-#ifndef GL_EXT_gpu_program_parameters
-#define GL_EXT_gpu_program_parameters 1
-
-typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat* params);
-
-#define glProgramEnvParameters4fvEXT GLEW_GET_FUN(__glewProgramEnvParameters4fvEXT)
-#define glProgramLocalParameters4fvEXT GLEW_GET_FUN(__glewProgramLocalParameters4fvEXT)
-
-#define GLEW_EXT_gpu_program_parameters GLEW_GET_VAR(__GLEW_EXT_gpu_program_parameters)
-
-#endif /* GL_EXT_gpu_program_parameters */
-
-/* --------------------------- GL_EXT_gpu_shader4 -------------------------- */
-
-#ifndef GL_EXT_gpu_shader4
-#define GL_EXT_gpu_shader4 1
-
-#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD
-#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0
-#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1
-#define GL_SAMPLER_BUFFER_EXT 0x8DC2
-#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3
-#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4
-#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5
-#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6
-#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7
-#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8
-#define GL_INT_SAMPLER_1D_EXT 0x8DC9
-#define GL_INT_SAMPLER_2D_EXT 0x8DCA
-#define GL_INT_SAMPLER_3D_EXT 0x8DCB
-#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC
-#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD
-#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE
-#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF
-#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0
-#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1
-#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2
-#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3
-#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4
-#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5
-#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6
-#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7
-#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
-
-typedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);
-typedef GLint (GLAPIENTRY * PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name);
-typedef void (GLAPIENTRY * PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-
-#define glBindFragDataLocationEXT GLEW_GET_FUN(__glewBindFragDataLocationEXT)
-#define glGetFragDataLocationEXT GLEW_GET_FUN(__glewGetFragDataLocationEXT)
-#define glGetUniformuivEXT GLEW_GET_FUN(__glewGetUniformuivEXT)
-#define glGetVertexAttribIivEXT GLEW_GET_FUN(__glewGetVertexAttribIivEXT)
-#define glGetVertexAttribIuivEXT GLEW_GET_FUN(__glewGetVertexAttribIuivEXT)
-#define glUniform1uiEXT GLEW_GET_FUN(__glewUniform1uiEXT)
-#define glUniform1uivEXT GLEW_GET_FUN(__glewUniform1uivEXT)
-#define glUniform2uiEXT GLEW_GET_FUN(__glewUniform2uiEXT)
-#define glUniform2uivEXT GLEW_GET_FUN(__glewUniform2uivEXT)
-#define glUniform3uiEXT GLEW_GET_FUN(__glewUniform3uiEXT)
-#define glUniform3uivEXT GLEW_GET_FUN(__glewUniform3uivEXT)
-#define glUniform4uiEXT GLEW_GET_FUN(__glewUniform4uiEXT)
-#define glUniform4uivEXT GLEW_GET_FUN(__glewUniform4uivEXT)
-#define glVertexAttribI1iEXT GLEW_GET_FUN(__glewVertexAttribI1iEXT)
-#define glVertexAttribI1ivEXT GLEW_GET_FUN(__glewVertexAttribI1ivEXT)
-#define glVertexAttribI1uiEXT GLEW_GET_FUN(__glewVertexAttribI1uiEXT)
-#define glVertexAttribI1uivEXT GLEW_GET_FUN(__glewVertexAttribI1uivEXT)
-#define glVertexAttribI2iEXT GLEW_GET_FUN(__glewVertexAttribI2iEXT)
-#define glVertexAttribI2ivEXT GLEW_GET_FUN(__glewVertexAttribI2ivEXT)
-#define glVertexAttribI2uiEXT GLEW_GET_FUN(__glewVertexAttribI2uiEXT)
-#define glVertexAttribI2uivEXT GLEW_GET_FUN(__glewVertexAttribI2uivEXT)
-#define glVertexAttribI3iEXT GLEW_GET_FUN(__glewVertexAttribI3iEXT)
-#define glVertexAttribI3ivEXT GLEW_GET_FUN(__glewVertexAttribI3ivEXT)
-#define glVertexAttribI3uiEXT GLEW_GET_FUN(__glewVertexAttribI3uiEXT)
-#define glVertexAttribI3uivEXT GLEW_GET_FUN(__glewVertexAttribI3uivEXT)
-#define glVertexAttribI4bvEXT GLEW_GET_FUN(__glewVertexAttribI4bvEXT)
-#define glVertexAttribI4iEXT GLEW_GET_FUN(__glewVertexAttribI4iEXT)
-#define glVertexAttribI4ivEXT GLEW_GET_FUN(__glewVertexAttribI4ivEXT)
-#define glVertexAttribI4svEXT GLEW_GET_FUN(__glewVertexAttribI4svEXT)
-#define glVertexAttribI4ubvEXT GLEW_GET_FUN(__glewVertexAttribI4ubvEXT)
-#define glVertexAttribI4uiEXT GLEW_GET_FUN(__glewVertexAttribI4uiEXT)
-#define glVertexAttribI4uivEXT GLEW_GET_FUN(__glewVertexAttribI4uivEXT)
-#define glVertexAttribI4usvEXT GLEW_GET_FUN(__glewVertexAttribI4usvEXT)
-#define glVertexAttribIPointerEXT GLEW_GET_FUN(__glewVertexAttribIPointerEXT)
-
-#define GLEW_EXT_gpu_shader4 GLEW_GET_VAR(__GLEW_EXT_gpu_shader4)
-
-#endif /* GL_EXT_gpu_shader4 */
-
-/* ---------------------------- GL_EXT_histogram --------------------------- */
-
-#ifndef GL_EXT_histogram
-#define GL_EXT_histogram 1
-
-#define GL_HISTOGRAM_EXT 0x8024
-#define GL_PROXY_HISTOGRAM_EXT 0x8025
-#define GL_HISTOGRAM_WIDTH_EXT 0x8026
-#define GL_HISTOGRAM_FORMAT_EXT 0x8027
-#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028
-#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029
-#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A
-#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B
-#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C
-#define GL_HISTOGRAM_SINK_EXT 0x802D
-#define GL_MINMAX_EXT 0x802E
-#define GL_MINMAX_FORMAT_EXT 0x802F
-#define GL_MINMAX_SINK_EXT 0x8030
-
-typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
-typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
-typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
-typedef void (GLAPIENTRY * PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink);
-typedef void (GLAPIENTRY * PFNGLRESETHISTOGRAMEXTPROC) (GLenum target);
-typedef void (GLAPIENTRY * PFNGLRESETMINMAXEXTPROC) (GLenum target);
-
-#define glGetHistogramEXT GLEW_GET_FUN(__glewGetHistogramEXT)
-#define glGetHistogramParameterfvEXT GLEW_GET_FUN(__glewGetHistogramParameterfvEXT)
-#define glGetHistogramParameterivEXT GLEW_GET_FUN(__glewGetHistogramParameterivEXT)
-#define glGetMinmaxEXT GLEW_GET_FUN(__glewGetMinmaxEXT)
-#define glGetMinmaxParameterfvEXT GLEW_GET_FUN(__glewGetMinmaxParameterfvEXT)
-#define glGetMinmaxParameterivEXT GLEW_GET_FUN(__glewGetMinmaxParameterivEXT)
-#define glHistogramEXT GLEW_GET_FUN(__glewHistogramEXT)
-#define glMinmaxEXT GLEW_GET_FUN(__glewMinmaxEXT)
-#define glResetHistogramEXT GLEW_GET_FUN(__glewResetHistogramEXT)
-#define glResetMinmaxEXT GLEW_GET_FUN(__glewResetMinmaxEXT)
-
-#define GLEW_EXT_histogram GLEW_GET_VAR(__GLEW_EXT_histogram)
-
-#endif /* GL_EXT_histogram */
-
-/* ----------------------- GL_EXT_index_array_formats ---------------------- */
-
-#ifndef GL_EXT_index_array_formats
-#define GL_EXT_index_array_formats 1
-
-#define GLEW_EXT_index_array_formats GLEW_GET_VAR(__GLEW_EXT_index_array_formats)
-
-#endif /* GL_EXT_index_array_formats */
-
-/* --------------------------- GL_EXT_index_func --------------------------- */
-
-#ifndef GL_EXT_index_func
-#define GL_EXT_index_func 1
-
-typedef void (GLAPIENTRY * PFNGLINDEXFUNCEXTPROC) (GLenum func, GLfloat ref);
-
-#define glIndexFuncEXT GLEW_GET_FUN(__glewIndexFuncEXT)
-
-#define GLEW_EXT_index_func GLEW_GET_VAR(__GLEW_EXT_index_func)
-
-#endif /* GL_EXT_index_func */
-
-/* ------------------------- GL_EXT_index_material ------------------------- */
-
-#ifndef GL_EXT_index_material
-#define GL_EXT_index_material 1
-
-typedef void (GLAPIENTRY * PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode);
-
-#define glIndexMaterialEXT GLEW_GET_FUN(__glewIndexMaterialEXT)
-
-#define GLEW_EXT_index_material GLEW_GET_VAR(__GLEW_EXT_index_material)
-
-#endif /* GL_EXT_index_material */
-
-/* -------------------------- GL_EXT_index_texture ------------------------- */
-
-#ifndef GL_EXT_index_texture
-#define GL_EXT_index_texture 1
-
-#define GLEW_EXT_index_texture GLEW_GET_VAR(__GLEW_EXT_index_texture)
-
-#endif /* GL_EXT_index_texture */
-
-/* -------------------------- GL_EXT_light_texture ------------------------- */
-
-#ifndef GL_EXT_light_texture
-#define GL_EXT_light_texture 1
-
-#define GL_FRAGMENT_MATERIAL_EXT 0x8349
-#define GL_FRAGMENT_NORMAL_EXT 0x834A
-#define GL_FRAGMENT_COLOR_EXT 0x834C
-#define GL_ATTENUATION_EXT 0x834D
-#define GL_SHADOW_ATTENUATION_EXT 0x834E
-#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F
-#define GL_TEXTURE_LIGHT_EXT 0x8350
-#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351
-#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352
-
-typedef void (GLAPIENTRY * PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode);
-typedef void (GLAPIENTRY * PFNGLTEXTURELIGHTEXTPROC) (GLenum pname);
-typedef void (GLAPIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode);
-
-#define glApplyTextureEXT GLEW_GET_FUN(__glewApplyTextureEXT)
-#define glTextureLightEXT GLEW_GET_FUN(__glewTextureLightEXT)
-#define glTextureMaterialEXT GLEW_GET_FUN(__glewTextureMaterialEXT)
-
-#define GLEW_EXT_light_texture GLEW_GET_VAR(__GLEW_EXT_light_texture)
-
-#endif /* GL_EXT_light_texture */
-
-/* ------------------------- GL_EXT_misc_attribute ------------------------- */
-
-#ifndef GL_EXT_misc_attribute
-#define GL_EXT_misc_attribute 1
-
-#define GLEW_EXT_misc_attribute GLEW_GET_VAR(__GLEW_EXT_misc_attribute)
-
-#endif /* GL_EXT_misc_attribute */
-
-/* ------------------------ GL_EXT_multi_draw_arrays ----------------------- */
-
-#ifndef GL_EXT_multi_draw_arrays
-#define GL_EXT_multi_draw_arrays 1
-
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint* first, const GLsizei *count, GLsizei primcount);
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, GLsizei* count, GLenum type, const void *const *indices, GLsizei primcount);
-
-#define glMultiDrawArraysEXT GLEW_GET_FUN(__glewMultiDrawArraysEXT)
-#define glMultiDrawElementsEXT GLEW_GET_FUN(__glewMultiDrawElementsEXT)
-
-#define GLEW_EXT_multi_draw_arrays GLEW_GET_VAR(__GLEW_EXT_multi_draw_arrays)
-
-#endif /* GL_EXT_multi_draw_arrays */
-
-/* --------------------------- GL_EXT_multisample -------------------------- */
-
-#ifndef GL_EXT_multisample
-#define GL_EXT_multisample 1
-
-#define GL_MULTISAMPLE_EXT 0x809D
-#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F
-#define GL_SAMPLE_MASK_EXT 0x80A0
-#define GL_1PASS_EXT 0x80A1
-#define GL_2PASS_0_EXT 0x80A2
-#define GL_2PASS_1_EXT 0x80A3
-#define GL_4PASS_0_EXT 0x80A4
-#define GL_4PASS_1_EXT 0x80A5
-#define GL_4PASS_2_EXT 0x80A6
-#define GL_4PASS_3_EXT 0x80A7
-#define GL_SAMPLE_BUFFERS_EXT 0x80A8
-#define GL_SAMPLES_EXT 0x80A9
-#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA
-#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB
-#define GL_SAMPLE_PATTERN_EXT 0x80AC
-#define GL_MULTISAMPLE_BIT_EXT 0x20000000
-
-typedef void (GLAPIENTRY * PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert);
-typedef void (GLAPIENTRY * PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern);
-
-#define glSampleMaskEXT GLEW_GET_FUN(__glewSampleMaskEXT)
-#define glSamplePatternEXT GLEW_GET_FUN(__glewSamplePatternEXT)
-
-#define GLEW_EXT_multisample GLEW_GET_VAR(__GLEW_EXT_multisample)
-
-#endif /* GL_EXT_multisample */
-
-/* ---------------------- GL_EXT_packed_depth_stencil ---------------------- */
-
-#ifndef GL_EXT_packed_depth_stencil
-#define GL_EXT_packed_depth_stencil 1
-
-#define GL_DEPTH_STENCIL_EXT 0x84F9
-#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
-#define GL_DEPTH24_STENCIL8_EXT 0x88F0
-#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
-
-#define GLEW_EXT_packed_depth_stencil GLEW_GET_VAR(__GLEW_EXT_packed_depth_stencil)
-
-#endif /* GL_EXT_packed_depth_stencil */
-
-/* -------------------------- GL_EXT_packed_float -------------------------- */
-
-#ifndef GL_EXT_packed_float
-#define GL_EXT_packed_float 1
-
-#define GL_R11F_G11F_B10F_EXT 0x8C3A
-#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B
-#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C
-
-#define GLEW_EXT_packed_float GLEW_GET_VAR(__GLEW_EXT_packed_float)
-
-#endif /* GL_EXT_packed_float */
-
-/* -------------------------- GL_EXT_packed_pixels ------------------------- */
-
-#ifndef GL_EXT_packed_pixels
-#define GL_EXT_packed_pixels 1
-
-#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032
-#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034
-#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035
-#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036
-
-#define GLEW_EXT_packed_pixels GLEW_GET_VAR(__GLEW_EXT_packed_pixels)
-
-#endif /* GL_EXT_packed_pixels */
-
-/* ------------------------ GL_EXT_paletted_texture ------------------------ */
-
-#ifndef GL_EXT_paletted_texture
-#define GL_EXT_paletted_texture 1
-
-#define GL_TEXTURE_1D 0x0DE0
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_PROXY_TEXTURE_1D 0x8063
-#define GL_PROXY_TEXTURE_2D 0x8064
-#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8
-#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9
-#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA
-#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB
-#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC
-#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD
-#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE
-#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF
-#define GL_COLOR_INDEX1_EXT 0x80E2
-#define GL_COLOR_INDEX2_EXT 0x80E3
-#define GL_COLOR_INDEX4_EXT 0x80E4
-#define GL_COLOR_INDEX8_EXT 0x80E5
-#define GL_COLOR_INDEX12_EXT 0x80E6
-#define GL_COLOR_INDEX16_EXT 0x80E7
-#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED
-#define GL_TEXTURE_CUBE_MAP_ARB 0x8513
-#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B
-
-typedef void (GLAPIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void *data);
-typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, void *data);
-typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params);
-
-#define glColorTableEXT GLEW_GET_FUN(__glewColorTableEXT)
-#define glGetColorTableEXT GLEW_GET_FUN(__glewGetColorTableEXT)
-#define glGetColorTableParameterfvEXT GLEW_GET_FUN(__glewGetColorTableParameterfvEXT)
-#define glGetColorTableParameterivEXT GLEW_GET_FUN(__glewGetColorTableParameterivEXT)
-
-#define GLEW_EXT_paletted_texture GLEW_GET_VAR(__GLEW_EXT_paletted_texture)
-
-#endif /* GL_EXT_paletted_texture */
-
-/* ----------------------- GL_EXT_pixel_buffer_object ---------------------- */
-
-#ifndef GL_EXT_pixel_buffer_object
-#define GL_EXT_pixel_buffer_object 1
-
-#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF
-
-#define GLEW_EXT_pixel_buffer_object GLEW_GET_VAR(__GLEW_EXT_pixel_buffer_object)
-
-#endif /* GL_EXT_pixel_buffer_object */
-
-/* ------------------------- GL_EXT_pixel_transform ------------------------ */
-
-#ifndef GL_EXT_pixel_transform
-#define GL_EXT_pixel_transform 1
-
-#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330
-#define GL_PIXEL_MAG_FILTER_EXT 0x8331
-#define GL_PIXEL_MIN_FILTER_EXT 0x8332
-#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333
-#define GL_CUBIC_EXT 0x8334
-#define GL_AVERAGE_EXT 0x8335
-#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336
-#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337
-#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338
-
-typedef void (GLAPIENTRY * PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, const GLfloat param);
-typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, const GLint param);
-typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params);
-
-#define glGetPixelTransformParameterfvEXT GLEW_GET_FUN(__glewGetPixelTransformParameterfvEXT)
-#define glGetPixelTransformParameterivEXT GLEW_GET_FUN(__glewGetPixelTransformParameterivEXT)
-#define glPixelTransformParameterfEXT GLEW_GET_FUN(__glewPixelTransformParameterfEXT)
-#define glPixelTransformParameterfvEXT GLEW_GET_FUN(__glewPixelTransformParameterfvEXT)
-#define glPixelTransformParameteriEXT GLEW_GET_FUN(__glewPixelTransformParameteriEXT)
-#define glPixelTransformParameterivEXT GLEW_GET_FUN(__glewPixelTransformParameterivEXT)
-
-#define GLEW_EXT_pixel_transform GLEW_GET_VAR(__GLEW_EXT_pixel_transform)
-
-#endif /* GL_EXT_pixel_transform */
-
-/* ------------------- GL_EXT_pixel_transform_color_table ------------------ */
-
-#ifndef GL_EXT_pixel_transform_color_table
-#define GL_EXT_pixel_transform_color_table 1
-
-#define GLEW_EXT_pixel_transform_color_table GLEW_GET_VAR(__GLEW_EXT_pixel_transform_color_table)
-
-#endif /* GL_EXT_pixel_transform_color_table */
-
-/* ------------------------ GL_EXT_point_parameters ------------------------ */
-
-#ifndef GL_EXT_point_parameters
-#define GL_EXT_point_parameters 1
-
-#define GL_POINT_SIZE_MIN_EXT 0x8126
-#define GL_POINT_SIZE_MAX_EXT 0x8127
-#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
-#define GL_DISTANCE_ATTENUATION_EXT 0x8129
-
-typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat* params);
-
-#define glPointParameterfEXT GLEW_GET_FUN(__glewPointParameterfEXT)
-#define glPointParameterfvEXT GLEW_GET_FUN(__glewPointParameterfvEXT)
-
-#define GLEW_EXT_point_parameters GLEW_GET_VAR(__GLEW_EXT_point_parameters)
-
-#endif /* GL_EXT_point_parameters */
-
-/* ------------------------- GL_EXT_polygon_offset ------------------------- */
-
-#ifndef GL_EXT_polygon_offset
-#define GL_EXT_polygon_offset 1
-
-#define GL_POLYGON_OFFSET_EXT 0x8037
-#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038
-#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039
-
-typedef void (GLAPIENTRY * PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias);
-
-#define glPolygonOffsetEXT GLEW_GET_FUN(__glewPolygonOffsetEXT)
-
-#define GLEW_EXT_polygon_offset GLEW_GET_VAR(__GLEW_EXT_polygon_offset)
-
-#endif /* GL_EXT_polygon_offset */
-
-/* ---------------------- GL_EXT_polygon_offset_clamp ---------------------- */
-
-#ifndef GL_EXT_polygon_offset_clamp
-#define GL_EXT_polygon_offset_clamp 1
-
-#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B
-
-typedef void (GLAPIENTRY * PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp);
-
-#define glPolygonOffsetClampEXT GLEW_GET_FUN(__glewPolygonOffsetClampEXT)
-
-#define GLEW_EXT_polygon_offset_clamp GLEW_GET_VAR(__GLEW_EXT_polygon_offset_clamp)
-
-#endif /* GL_EXT_polygon_offset_clamp */
-
-/* ----------------------- GL_EXT_post_depth_coverage ---------------------- */
-
-#ifndef GL_EXT_post_depth_coverage
-#define GL_EXT_post_depth_coverage 1
-
-#define GLEW_EXT_post_depth_coverage GLEW_GET_VAR(__GLEW_EXT_post_depth_coverage)
-
-#endif /* GL_EXT_post_depth_coverage */
-
-/* ------------------------ GL_EXT_provoking_vertex ------------------------ */
-
-#ifndef GL_EXT_provoking_vertex
-#define GL_EXT_provoking_vertex 1
-
-#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C
-#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D
-#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E
-#define GL_PROVOKING_VERTEX_EXT 0x8E4F
-
-typedef void (GLAPIENTRY * PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);
-
-#define glProvokingVertexEXT GLEW_GET_FUN(__glewProvokingVertexEXT)
-
-#define GLEW_EXT_provoking_vertex GLEW_GET_VAR(__GLEW_EXT_provoking_vertex)
-
-#endif /* GL_EXT_provoking_vertex */
-
-/* ----------------------- GL_EXT_raster_multisample ----------------------- */
-
-#ifndef GL_EXT_raster_multisample
-#define GL_EXT_raster_multisample 1
-
-#define GL_COLOR_SAMPLES_NV 0x8E20
-#define GL_RASTER_MULTISAMPLE_EXT 0x9327
-#define GL_RASTER_SAMPLES_EXT 0x9328
-#define GL_MAX_RASTER_SAMPLES_EXT 0x9329
-#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A
-#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B
-#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C
-#define GL_DEPTH_SAMPLES_NV 0x932D
-#define GL_STENCIL_SAMPLES_NV 0x932E
-#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F
-#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330
-#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331
-#define GL_COVERAGE_MODULATION_NV 0x9332
-#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333
-
-typedef void (GLAPIENTRY * PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components);
-typedef void (GLAPIENTRY * PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations);
-
-#define glCoverageModulationNV GLEW_GET_FUN(__glewCoverageModulationNV)
-#define glCoverageModulationTableNV GLEW_GET_FUN(__glewCoverageModulationTableNV)
-#define glGetCoverageModulationTableNV GLEW_GET_FUN(__glewGetCoverageModulationTableNV)
-#define glRasterSamplesEXT GLEW_GET_FUN(__glewRasterSamplesEXT)
-
-#define GLEW_EXT_raster_multisample GLEW_GET_VAR(__GLEW_EXT_raster_multisample)
-
-#endif /* GL_EXT_raster_multisample */
-
-/* ------------------------- GL_EXT_rescale_normal ------------------------- */
-
-#ifndef GL_EXT_rescale_normal
-#define GL_EXT_rescale_normal 1
-
-#define GL_RESCALE_NORMAL_EXT 0x803A
-
-#define GLEW_EXT_rescale_normal GLEW_GET_VAR(__GLEW_EXT_rescale_normal)
-
-#endif /* GL_EXT_rescale_normal */
-
-/* -------------------------- GL_EXT_scene_marker -------------------------- */
-
-#ifndef GL_EXT_scene_marker
-#define GL_EXT_scene_marker 1
-
-typedef void (GLAPIENTRY * PFNGLBEGINSCENEEXTPROC) (void);
-typedef void (GLAPIENTRY * PFNGLENDSCENEEXTPROC) (void);
-
-#define glBeginSceneEXT GLEW_GET_FUN(__glewBeginSceneEXT)
-#define glEndSceneEXT GLEW_GET_FUN(__glewEndSceneEXT)
-
-#define GLEW_EXT_scene_marker GLEW_GET_VAR(__GLEW_EXT_scene_marker)
-
-#endif /* GL_EXT_scene_marker */
-
-/* ------------------------- GL_EXT_secondary_color ------------------------ */
-
-#ifndef GL_EXT_secondary_color
-#define GL_EXT_secondary_color 1
-
-#define GL_COLOR_SUM_EXT 0x8458
-#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459
-#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A
-#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B
-#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C
-#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D
-#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E
-
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
-
-#define glSecondaryColor3bEXT GLEW_GET_FUN(__glewSecondaryColor3bEXT)
-#define glSecondaryColor3bvEXT GLEW_GET_FUN(__glewSecondaryColor3bvEXT)
-#define glSecondaryColor3dEXT GLEW_GET_FUN(__glewSecondaryColor3dEXT)
-#define glSecondaryColor3dvEXT GLEW_GET_FUN(__glewSecondaryColor3dvEXT)
-#define glSecondaryColor3fEXT GLEW_GET_FUN(__glewSecondaryColor3fEXT)
-#define glSecondaryColor3fvEXT GLEW_GET_FUN(__glewSecondaryColor3fvEXT)
-#define glSecondaryColor3iEXT GLEW_GET_FUN(__glewSecondaryColor3iEXT)
-#define glSecondaryColor3ivEXT GLEW_GET_FUN(__glewSecondaryColor3ivEXT)
-#define glSecondaryColor3sEXT GLEW_GET_FUN(__glewSecondaryColor3sEXT)
-#define glSecondaryColor3svEXT GLEW_GET_FUN(__glewSecondaryColor3svEXT)
-#define glSecondaryColor3ubEXT GLEW_GET_FUN(__glewSecondaryColor3ubEXT)
-#define glSecondaryColor3ubvEXT GLEW_GET_FUN(__glewSecondaryColor3ubvEXT)
-#define glSecondaryColor3uiEXT GLEW_GET_FUN(__glewSecondaryColor3uiEXT)
-#define glSecondaryColor3uivEXT GLEW_GET_FUN(__glewSecondaryColor3uivEXT)
-#define glSecondaryColor3usEXT GLEW_GET_FUN(__glewSecondaryColor3usEXT)
-#define glSecondaryColor3usvEXT GLEW_GET_FUN(__glewSecondaryColor3usvEXT)
-#define glSecondaryColorPointerEXT GLEW_GET_FUN(__glewSecondaryColorPointerEXT)
-
-#define GLEW_EXT_secondary_color GLEW_GET_VAR(__GLEW_EXT_secondary_color)
-
-#endif /* GL_EXT_secondary_color */
-
-/* --------------------- GL_EXT_separate_shader_objects -------------------- */
-
-#ifndef GL_EXT_separate_shader_objects
-#define GL_EXT_separate_shader_objects 1
-
-#define GL_ACTIVE_PROGRAM_EXT 0x8B8D
-
-typedef void (GLAPIENTRY * PFNGLACTIVEPROGRAMEXTPROC) (GLuint program);
-typedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar* string);
-typedef void (GLAPIENTRY * PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program);
-
-#define glActiveProgramEXT GLEW_GET_FUN(__glewActiveProgramEXT)
-#define glCreateShaderProgramEXT GLEW_GET_FUN(__glewCreateShaderProgramEXT)
-#define glUseShaderProgramEXT GLEW_GET_FUN(__glewUseShaderProgramEXT)
-
-#define GLEW_EXT_separate_shader_objects GLEW_GET_VAR(__GLEW_EXT_separate_shader_objects)
-
-#endif /* GL_EXT_separate_shader_objects */
-
-/* --------------------- GL_EXT_separate_specular_color -------------------- */
-
-#ifndef GL_EXT_separate_specular_color
-#define GL_EXT_separate_specular_color 1
-
-#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8
-#define GL_SINGLE_COLOR_EXT 0x81F9
-#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA
-
-#define GLEW_EXT_separate_specular_color GLEW_GET_VAR(__GLEW_EXT_separate_specular_color)
-
-#endif /* GL_EXT_separate_specular_color */
-
-/* ------------------- GL_EXT_shader_image_load_formatted ------------------ */
-
-#ifndef GL_EXT_shader_image_load_formatted
-#define GL_EXT_shader_image_load_formatted 1
-
-#define GLEW_EXT_shader_image_load_formatted GLEW_GET_VAR(__GLEW_EXT_shader_image_load_formatted)
-
-#endif /* GL_EXT_shader_image_load_formatted */
-
-/* --------------------- GL_EXT_shader_image_load_store -------------------- */
-
-#ifndef GL_EXT_shader_image_load_store
-#define GL_EXT_shader_image_load_store 1
-
-#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001
-#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002
-#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004
-#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008
-#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020
-#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040
-#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080
-#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100
-#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200
-#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400
-#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800
-#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000
-#define GL_MAX_IMAGE_UNITS_EXT 0x8F38
-#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39
-#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A
-#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B
-#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C
-#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D
-#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E
-#define GL_IMAGE_1D_EXT 0x904C
-#define GL_IMAGE_2D_EXT 0x904D
-#define GL_IMAGE_3D_EXT 0x904E
-#define GL_IMAGE_2D_RECT_EXT 0x904F
-#define GL_IMAGE_CUBE_EXT 0x9050
-#define GL_IMAGE_BUFFER_EXT 0x9051
-#define GL_IMAGE_1D_ARRAY_EXT 0x9052
-#define GL_IMAGE_2D_ARRAY_EXT 0x9053
-#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054
-#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055
-#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056
-#define GL_INT_IMAGE_1D_EXT 0x9057
-#define GL_INT_IMAGE_2D_EXT 0x9058
-#define GL_INT_IMAGE_3D_EXT 0x9059
-#define GL_INT_IMAGE_2D_RECT_EXT 0x905A
-#define GL_INT_IMAGE_CUBE_EXT 0x905B
-#define GL_INT_IMAGE_BUFFER_EXT 0x905C
-#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D
-#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E
-#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F
-#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060
-#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061
-#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062
-#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063
-#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064
-#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065
-#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066
-#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067
-#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068
-#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069
-#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A
-#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B
-#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C
-#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D
-#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E
-#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF
-
-typedef void (GLAPIENTRY * PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);
-typedef void (GLAPIENTRY * PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers);
-
-#define glBindImageTextureEXT GLEW_GET_FUN(__glewBindImageTextureEXT)
-#define glMemoryBarrierEXT GLEW_GET_FUN(__glewMemoryBarrierEXT)
-
-#define GLEW_EXT_shader_image_load_store GLEW_GET_VAR(__GLEW_EXT_shader_image_load_store)
-
-#endif /* GL_EXT_shader_image_load_store */
-
-/* ----------------------- GL_EXT_shader_integer_mix ----------------------- */
-
-#ifndef GL_EXT_shader_integer_mix
-#define GL_EXT_shader_integer_mix 1
-
-#define GLEW_EXT_shader_integer_mix GLEW_GET_VAR(__GLEW_EXT_shader_integer_mix)
-
-#endif /* GL_EXT_shader_integer_mix */
-
-/* -------------------------- GL_EXT_shadow_funcs -------------------------- */
-
-#ifndef GL_EXT_shadow_funcs
-#define GL_EXT_shadow_funcs 1
-
-#define GLEW_EXT_shadow_funcs GLEW_GET_VAR(__GLEW_EXT_shadow_funcs)
-
-#endif /* GL_EXT_shadow_funcs */
-
-/* --------------------- GL_EXT_shared_texture_palette --------------------- */
-
-#ifndef GL_EXT_shared_texture_palette
-#define GL_EXT_shared_texture_palette 1
-
-#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
-
-#define GLEW_EXT_shared_texture_palette GLEW_GET_VAR(__GLEW_EXT_shared_texture_palette)
-
-#endif /* GL_EXT_shared_texture_palette */
-
-/* ------------------------- GL_EXT_sparse_texture2 ------------------------ */
-
-#ifndef GL_EXT_sparse_texture2
-#define GL_EXT_sparse_texture2 1
-
-#define GLEW_EXT_sparse_texture2 GLEW_GET_VAR(__GLEW_EXT_sparse_texture2)
-
-#endif /* GL_EXT_sparse_texture2 */
-
-/* ------------------------ GL_EXT_stencil_clear_tag ----------------------- */
-
-#ifndef GL_EXT_stencil_clear_tag
-#define GL_EXT_stencil_clear_tag 1
-
-#define GL_STENCIL_TAG_BITS_EXT 0x88F2
-#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3
-
-#define GLEW_EXT_stencil_clear_tag GLEW_GET_VAR(__GLEW_EXT_stencil_clear_tag)
-
-#endif /* GL_EXT_stencil_clear_tag */
-
-/* ------------------------ GL_EXT_stencil_two_side ------------------------ */
-
-#ifndef GL_EXT_stencil_two_side
-#define GL_EXT_stencil_two_side 1
-
-#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910
-#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911
-
-typedef void (GLAPIENTRY * PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);
-
-#define glActiveStencilFaceEXT GLEW_GET_FUN(__glewActiveStencilFaceEXT)
-
-#define GLEW_EXT_stencil_two_side GLEW_GET_VAR(__GLEW_EXT_stencil_two_side)
-
-#endif /* GL_EXT_stencil_two_side */
-
-/* -------------------------- GL_EXT_stencil_wrap -------------------------- */
-
-#ifndef GL_EXT_stencil_wrap
-#define GL_EXT_stencil_wrap 1
-
-#define GL_INCR_WRAP_EXT 0x8507
-#define GL_DECR_WRAP_EXT 0x8508
-
-#define GLEW_EXT_stencil_wrap GLEW_GET_VAR(__GLEW_EXT_stencil_wrap)
-
-#endif /* GL_EXT_stencil_wrap */
-
-/* --------------------------- GL_EXT_subtexture --------------------------- */
-
-#ifndef GL_EXT_subtexture
-#define GL_EXT_subtexture 1
-
-typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-
-#define glTexSubImage1DEXT GLEW_GET_FUN(__glewTexSubImage1DEXT)
-#define glTexSubImage2DEXT GLEW_GET_FUN(__glewTexSubImage2DEXT)
-#define glTexSubImage3DEXT GLEW_GET_FUN(__glewTexSubImage3DEXT)
-
-#define GLEW_EXT_subtexture GLEW_GET_VAR(__GLEW_EXT_subtexture)
-
-#endif /* GL_EXT_subtexture */
-
-/* ----------------------------- GL_EXT_texture ---------------------------- */
-
-#ifndef GL_EXT_texture
-#define GL_EXT_texture 1
-
-#define GL_ALPHA4_EXT 0x803B
-#define GL_ALPHA8_EXT 0x803C
-#define GL_ALPHA12_EXT 0x803D
-#define GL_ALPHA16_EXT 0x803E
-#define GL_LUMINANCE4_EXT 0x803F
-#define GL_LUMINANCE8_EXT 0x8040
-#define GL_LUMINANCE12_EXT 0x8041
-#define GL_LUMINANCE16_EXT 0x8042
-#define GL_LUMINANCE4_ALPHA4_EXT 0x8043
-#define GL_LUMINANCE6_ALPHA2_EXT 0x8044
-#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
-#define GL_LUMINANCE12_ALPHA4_EXT 0x8046
-#define GL_LUMINANCE12_ALPHA12_EXT 0x8047
-#define GL_LUMINANCE16_ALPHA16_EXT 0x8048
-#define GL_INTENSITY_EXT 0x8049
-#define GL_INTENSITY4_EXT 0x804A
-#define GL_INTENSITY8_EXT 0x804B
-#define GL_INTENSITY12_EXT 0x804C
-#define GL_INTENSITY16_EXT 0x804D
-#define GL_RGB2_EXT 0x804E
-#define GL_RGB4_EXT 0x804F
-#define GL_RGB5_EXT 0x8050
-#define GL_RGB8_EXT 0x8051
-#define GL_RGB10_EXT 0x8052
-#define GL_RGB12_EXT 0x8053
-#define GL_RGB16_EXT 0x8054
-#define GL_RGBA2_EXT 0x8055
-#define GL_RGBA4_EXT 0x8056
-#define GL_RGB5_A1_EXT 0x8057
-#define GL_RGBA8_EXT 0x8058
-#define GL_RGB10_A2_EXT 0x8059
-#define GL_RGBA12_EXT 0x805A
-#define GL_RGBA16_EXT 0x805B
-#define GL_TEXTURE_RED_SIZE_EXT 0x805C
-#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D
-#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E
-#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F
-#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060
-#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061
-#define GL_REPLACE_EXT 0x8062
-#define GL_PROXY_TEXTURE_1D_EXT 0x8063
-#define GL_PROXY_TEXTURE_2D_EXT 0x8064
-
-#define GLEW_EXT_texture GLEW_GET_VAR(__GLEW_EXT_texture)
-
-#endif /* GL_EXT_texture */
-
-/* ---------------------------- GL_EXT_texture3D --------------------------- */
-
-#ifndef GL_EXT_texture3D
-#define GL_EXT_texture3D 1
-
-#define GL_PACK_SKIP_IMAGES_EXT 0x806B
-#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C
-#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D
-#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E
-#define GL_TEXTURE_3D_EXT 0x806F
-#define GL_PROXY_TEXTURE_3D_EXT 0x8070
-#define GL_TEXTURE_DEPTH_EXT 0x8071
-#define GL_TEXTURE_WRAP_R_EXT 0x8072
-#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073
-
-typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-
-#define glTexImage3DEXT GLEW_GET_FUN(__glewTexImage3DEXT)
-
-#define GLEW_EXT_texture3D GLEW_GET_VAR(__GLEW_EXT_texture3D)
-
-#endif /* GL_EXT_texture3D */
-
-/* -------------------------- GL_EXT_texture_array ------------------------- */
-
-#ifndef GL_EXT_texture_array
-#define GL_EXT_texture_array 1
-
-#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E
-#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
-#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18
-#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
-#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A
-#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
-#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
-#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
-
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-
-#define glFramebufferTextureLayerEXT GLEW_GET_FUN(__glewFramebufferTextureLayerEXT)
-
-#define GLEW_EXT_texture_array GLEW_GET_VAR(__GLEW_EXT_texture_array)
-
-#endif /* GL_EXT_texture_array */
-
-/* ---------------------- GL_EXT_texture_buffer_object --------------------- */
-
-#ifndef GL_EXT_texture_buffer_object
-#define GL_EXT_texture_buffer_object 1
-
-#define GL_TEXTURE_BUFFER_EXT 0x8C2A
-#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B
-#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C
-#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D
-#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E
-
-typedef void (GLAPIENTRY * PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
-
-#define glTexBufferEXT GLEW_GET_FUN(__glewTexBufferEXT)
-
-#define GLEW_EXT_texture_buffer_object GLEW_GET_VAR(__GLEW_EXT_texture_buffer_object)
-
-#endif /* GL_EXT_texture_buffer_object */
-
-/* -------------------- GL_EXT_texture_compression_dxt1 -------------------- */
-
-#ifndef GL_EXT_texture_compression_dxt1
-#define GL_EXT_texture_compression_dxt1 1
-
-#define GLEW_EXT_texture_compression_dxt1 GLEW_GET_VAR(__GLEW_EXT_texture_compression_dxt1)
-
-#endif /* GL_EXT_texture_compression_dxt1 */
-
-/* -------------------- GL_EXT_texture_compression_latc -------------------- */
-
-#ifndef GL_EXT_texture_compression_latc
-#define GL_EXT_texture_compression_latc 1
-
-#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
-#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
-#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
-#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
-
-#define GLEW_EXT_texture_compression_latc GLEW_GET_VAR(__GLEW_EXT_texture_compression_latc)
-
-#endif /* GL_EXT_texture_compression_latc */
-
-/* -------------------- GL_EXT_texture_compression_rgtc -------------------- */
-
-#ifndef GL_EXT_texture_compression_rgtc
-#define GL_EXT_texture_compression_rgtc 1
-
-#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB
-#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC
-#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD
-#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE
-
-#define GLEW_EXT_texture_compression_rgtc GLEW_GET_VAR(__GLEW_EXT_texture_compression_rgtc)
-
-#endif /* GL_EXT_texture_compression_rgtc */
-
-/* -------------------- GL_EXT_texture_compression_s3tc -------------------- */
-
-#ifndef GL_EXT_texture_compression_s3tc
-#define GL_EXT_texture_compression_s3tc 1
-
-#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
-#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
-#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
-
-#define GLEW_EXT_texture_compression_s3tc GLEW_GET_VAR(__GLEW_EXT_texture_compression_s3tc)
-
-#endif /* GL_EXT_texture_compression_s3tc */
-
-/* ------------------------ GL_EXT_texture_cube_map ------------------------ */
-
-#ifndef GL_EXT_texture_cube_map
-#define GL_EXT_texture_cube_map 1
-
-#define GL_NORMAL_MAP_EXT 0x8511
-#define GL_REFLECTION_MAP_EXT 0x8512
-#define GL_TEXTURE_CUBE_MAP_EXT 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A
-#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C
-
-#define GLEW_EXT_texture_cube_map GLEW_GET_VAR(__GLEW_EXT_texture_cube_map)
-
-#endif /* GL_EXT_texture_cube_map */
-
-/* ----------------------- GL_EXT_texture_edge_clamp ----------------------- */
-
-#ifndef GL_EXT_texture_edge_clamp
-#define GL_EXT_texture_edge_clamp 1
-
-#define GL_CLAMP_TO_EDGE_EXT 0x812F
-
-#define GLEW_EXT_texture_edge_clamp GLEW_GET_VAR(__GLEW_EXT_texture_edge_clamp)
-
-#endif /* GL_EXT_texture_edge_clamp */
-
-/* --------------------------- GL_EXT_texture_env -------------------------- */
-
-#ifndef GL_EXT_texture_env
-#define GL_EXT_texture_env 1
-
-#define GLEW_EXT_texture_env GLEW_GET_VAR(__GLEW_EXT_texture_env)
-
-#endif /* GL_EXT_texture_env */
-
-/* ------------------------- GL_EXT_texture_env_add ------------------------ */
-
-#ifndef GL_EXT_texture_env_add
-#define GL_EXT_texture_env_add 1
-
-#define GLEW_EXT_texture_env_add GLEW_GET_VAR(__GLEW_EXT_texture_env_add)
-
-#endif /* GL_EXT_texture_env_add */
-
-/* ----------------------- GL_EXT_texture_env_combine ---------------------- */
-
-#ifndef GL_EXT_texture_env_combine
-#define GL_EXT_texture_env_combine 1
-
-#define GL_COMBINE_EXT 0x8570
-#define GL_COMBINE_RGB_EXT 0x8571
-#define GL_COMBINE_ALPHA_EXT 0x8572
-#define GL_RGB_SCALE_EXT 0x8573
-#define GL_ADD_SIGNED_EXT 0x8574
-#define GL_INTERPOLATE_EXT 0x8575
-#define GL_CONSTANT_EXT 0x8576
-#define GL_PRIMARY_COLOR_EXT 0x8577
-#define GL_PREVIOUS_EXT 0x8578
-#define GL_SOURCE0_RGB_EXT 0x8580
-#define GL_SOURCE1_RGB_EXT 0x8581
-#define GL_SOURCE2_RGB_EXT 0x8582
-#define GL_SOURCE0_ALPHA_EXT 0x8588
-#define GL_SOURCE1_ALPHA_EXT 0x8589
-#define GL_SOURCE2_ALPHA_EXT 0x858A
-#define GL_OPERAND0_RGB_EXT 0x8590
-#define GL_OPERAND1_RGB_EXT 0x8591
-#define GL_OPERAND2_RGB_EXT 0x8592
-#define GL_OPERAND0_ALPHA_EXT 0x8598
-#define GL_OPERAND1_ALPHA_EXT 0x8599
-#define GL_OPERAND2_ALPHA_EXT 0x859A
-
-#define GLEW_EXT_texture_env_combine GLEW_GET_VAR(__GLEW_EXT_texture_env_combine)
-
-#endif /* GL_EXT_texture_env_combine */
-
-/* ------------------------ GL_EXT_texture_env_dot3 ------------------------ */
-
-#ifndef GL_EXT_texture_env_dot3
-#define GL_EXT_texture_env_dot3 1
-
-#define GL_DOT3_RGB_EXT 0x8740
-#define GL_DOT3_RGBA_EXT 0x8741
-
-#define GLEW_EXT_texture_env_dot3 GLEW_GET_VAR(__GLEW_EXT_texture_env_dot3)
-
-#endif /* GL_EXT_texture_env_dot3 */
-
-/* ------------------- GL_EXT_texture_filter_anisotropic ------------------- */
-
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_EXT_texture_filter_anisotropic 1
-
-#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
-#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
-
-#define GLEW_EXT_texture_filter_anisotropic GLEW_GET_VAR(__GLEW_EXT_texture_filter_anisotropic)
-
-#endif /* GL_EXT_texture_filter_anisotropic */
-
-/* ---------------------- GL_EXT_texture_filter_minmax --------------------- */
-
-#ifndef GL_EXT_texture_filter_minmax
-#define GL_EXT_texture_filter_minmax 1
-
-#define GL_TEXTURE_REDUCTION_MODE_EXT 0x9366
-#define GL_WEIGHTED_AVERAGE_EXT 0x9367
-
-#define GLEW_EXT_texture_filter_minmax GLEW_GET_VAR(__GLEW_EXT_texture_filter_minmax)
-
-#endif /* GL_EXT_texture_filter_minmax */
-
-/* ------------------------- GL_EXT_texture_integer ------------------------ */
-
-#ifndef GL_EXT_texture_integer
-#define GL_EXT_texture_integer 1
-
-#define GL_RGBA32UI_EXT 0x8D70
-#define GL_RGB32UI_EXT 0x8D71
-#define GL_ALPHA32UI_EXT 0x8D72
-#define GL_INTENSITY32UI_EXT 0x8D73
-#define GL_LUMINANCE32UI_EXT 0x8D74
-#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75
-#define GL_RGBA16UI_EXT 0x8D76
-#define GL_RGB16UI_EXT 0x8D77
-#define GL_ALPHA16UI_EXT 0x8D78
-#define GL_INTENSITY16UI_EXT 0x8D79
-#define GL_LUMINANCE16UI_EXT 0x8D7A
-#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B
-#define GL_RGBA8UI_EXT 0x8D7C
-#define GL_RGB8UI_EXT 0x8D7D
-#define GL_ALPHA8UI_EXT 0x8D7E
-#define GL_INTENSITY8UI_EXT 0x8D7F
-#define GL_LUMINANCE8UI_EXT 0x8D80
-#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81
-#define GL_RGBA32I_EXT 0x8D82
-#define GL_RGB32I_EXT 0x8D83
-#define GL_ALPHA32I_EXT 0x8D84
-#define GL_INTENSITY32I_EXT 0x8D85
-#define GL_LUMINANCE32I_EXT 0x8D86
-#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87
-#define GL_RGBA16I_EXT 0x8D88
-#define GL_RGB16I_EXT 0x8D89
-#define GL_ALPHA16I_EXT 0x8D8A
-#define GL_INTENSITY16I_EXT 0x8D8B
-#define GL_LUMINANCE16I_EXT 0x8D8C
-#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D
-#define GL_RGBA8I_EXT 0x8D8E
-#define GL_RGB8I_EXT 0x8D8F
-#define GL_ALPHA8I_EXT 0x8D90
-#define GL_INTENSITY8I_EXT 0x8D91
-#define GL_LUMINANCE8I_EXT 0x8D92
-#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93
-#define GL_RED_INTEGER_EXT 0x8D94
-#define GL_GREEN_INTEGER_EXT 0x8D95
-#define GL_BLUE_INTEGER_EXT 0x8D96
-#define GL_ALPHA_INTEGER_EXT 0x8D97
-#define GL_RGB_INTEGER_EXT 0x8D98
-#define GL_RGBA_INTEGER_EXT 0x8D99
-#define GL_BGR_INTEGER_EXT 0x8D9A
-#define GL_BGRA_INTEGER_EXT 0x8D9B
-#define GL_LUMINANCE_INTEGER_EXT 0x8D9C
-#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D
-#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E
-
-typedef void (GLAPIENTRY * PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha);
-typedef void (GLAPIENTRY * PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha);
-typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
-typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
-
-#define glClearColorIiEXT GLEW_GET_FUN(__glewClearColorIiEXT)
-#define glClearColorIuiEXT GLEW_GET_FUN(__glewClearColorIuiEXT)
-#define glGetTexParameterIivEXT GLEW_GET_FUN(__glewGetTexParameterIivEXT)
-#define glGetTexParameterIuivEXT GLEW_GET_FUN(__glewGetTexParameterIuivEXT)
-#define glTexParameterIivEXT GLEW_GET_FUN(__glewTexParameterIivEXT)
-#define glTexParameterIuivEXT GLEW_GET_FUN(__glewTexParameterIuivEXT)
-
-#define GLEW_EXT_texture_integer GLEW_GET_VAR(__GLEW_EXT_texture_integer)
-
-#endif /* GL_EXT_texture_integer */
-
-/* ------------------------ GL_EXT_texture_lod_bias ------------------------ */
-
-#ifndef GL_EXT_texture_lod_bias
-#define GL_EXT_texture_lod_bias 1
-
-#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD
-#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500
-#define GL_TEXTURE_LOD_BIAS_EXT 0x8501
-
-#define GLEW_EXT_texture_lod_bias GLEW_GET_VAR(__GLEW_EXT_texture_lod_bias)
-
-#endif /* GL_EXT_texture_lod_bias */
-
-/* ---------------------- GL_EXT_texture_mirror_clamp ---------------------- */
-
-#ifndef GL_EXT_texture_mirror_clamp
-#define GL_EXT_texture_mirror_clamp 1
-
-#define GL_MIRROR_CLAMP_EXT 0x8742
-#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743
-#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912
-
-#define GLEW_EXT_texture_mirror_clamp GLEW_GET_VAR(__GLEW_EXT_texture_mirror_clamp)
-
-#endif /* GL_EXT_texture_mirror_clamp */
-
-/* ------------------------- GL_EXT_texture_object ------------------------- */
-
-#ifndef GL_EXT_texture_object
-#define GL_EXT_texture_object 1
-
-#define GL_TEXTURE_PRIORITY_EXT 0x8066
-#define GL_TEXTURE_RESIDENT_EXT 0x8067
-#define GL_TEXTURE_1D_BINDING_EXT 0x8068
-#define GL_TEXTURE_2D_BINDING_EXT 0x8069
-#define GL_TEXTURE_3D_BINDING_EXT 0x806A
-
-typedef GLboolean (GLAPIENTRY * PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint* textures, GLboolean* residences);
-typedef void (GLAPIENTRY * PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture);
-typedef void (GLAPIENTRY * PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint* textures);
-typedef void (GLAPIENTRY * PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint* textures);
-typedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREEXTPROC) (GLuint texture);
-typedef void (GLAPIENTRY * PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint* textures, const GLclampf* priorities);
-
-#define glAreTexturesResidentEXT GLEW_GET_FUN(__glewAreTexturesResidentEXT)
-#define glBindTextureEXT GLEW_GET_FUN(__glewBindTextureEXT)
-#define glDeleteTexturesEXT GLEW_GET_FUN(__glewDeleteTexturesEXT)
-#define glGenTexturesEXT GLEW_GET_FUN(__glewGenTexturesEXT)
-#define glIsTextureEXT GLEW_GET_FUN(__glewIsTextureEXT)
-#define glPrioritizeTexturesEXT GLEW_GET_FUN(__glewPrioritizeTexturesEXT)
-
-#define GLEW_EXT_texture_object GLEW_GET_VAR(__GLEW_EXT_texture_object)
-
-#endif /* GL_EXT_texture_object */
-
-/* --------------------- GL_EXT_texture_perturb_normal --------------------- */
-
-#ifndef GL_EXT_texture_perturb_normal
-#define GL_EXT_texture_perturb_normal 1
-
-#define GL_PERTURB_EXT 0x85AE
-#define GL_TEXTURE_NORMAL_EXT 0x85AF
-
-typedef void (GLAPIENTRY * PFNGLTEXTURENORMALEXTPROC) (GLenum mode);
-
-#define glTextureNormalEXT GLEW_GET_FUN(__glewTextureNormalEXT)
-
-#define GLEW_EXT_texture_perturb_normal GLEW_GET_VAR(__GLEW_EXT_texture_perturb_normal)
-
-#endif /* GL_EXT_texture_perturb_normal */
-
-/* ------------------------ GL_EXT_texture_rectangle ----------------------- */
-
-#ifndef GL_EXT_texture_rectangle
-#define GL_EXT_texture_rectangle 1
-
-#define GL_TEXTURE_RECTANGLE_EXT 0x84F5
-#define GL_TEXTURE_BINDING_RECTANGLE_EXT 0x84F6
-#define GL_PROXY_TEXTURE_RECTANGLE_EXT 0x84F7
-#define GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT 0x84F8
-
-#define GLEW_EXT_texture_rectangle GLEW_GET_VAR(__GLEW_EXT_texture_rectangle)
-
-#endif /* GL_EXT_texture_rectangle */
-
-/* -------------------------- GL_EXT_texture_sRGB -------------------------- */
-
-#ifndef GL_EXT_texture_sRGB
-#define GL_EXT_texture_sRGB 1
-
-#define GL_SRGB_EXT 0x8C40
-#define GL_SRGB8_EXT 0x8C41
-#define GL_SRGB_ALPHA_EXT 0x8C42
-#define GL_SRGB8_ALPHA8_EXT 0x8C43
-#define GL_SLUMINANCE_ALPHA_EXT 0x8C44
-#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45
-#define GL_SLUMINANCE_EXT 0x8C46
-#define GL_SLUMINANCE8_EXT 0x8C47
-#define GL_COMPRESSED_SRGB_EXT 0x8C48
-#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49
-#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A
-#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
-#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
-
-#define GLEW_EXT_texture_sRGB GLEW_GET_VAR(__GLEW_EXT_texture_sRGB)
-
-#endif /* GL_EXT_texture_sRGB */
-
-/* ----------------------- GL_EXT_texture_sRGB_decode ---------------------- */
-
-#ifndef GL_EXT_texture_sRGB_decode
-#define GL_EXT_texture_sRGB_decode 1
-
-#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48
-#define GL_DECODE_EXT 0x8A49
-#define GL_SKIP_DECODE_EXT 0x8A4A
-
-#define GLEW_EXT_texture_sRGB_decode GLEW_GET_VAR(__GLEW_EXT_texture_sRGB_decode)
-
-#endif /* GL_EXT_texture_sRGB_decode */
-
-/* --------------------- GL_EXT_texture_shared_exponent -------------------- */
-
-#ifndef GL_EXT_texture_shared_exponent
-#define GL_EXT_texture_shared_exponent 1
-
-#define GL_RGB9_E5_EXT 0x8C3D
-#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E
-#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F
-
-#define GLEW_EXT_texture_shared_exponent GLEW_GET_VAR(__GLEW_EXT_texture_shared_exponent)
-
-#endif /* GL_EXT_texture_shared_exponent */
-
-/* -------------------------- GL_EXT_texture_snorm ------------------------- */
-
-#ifndef GL_EXT_texture_snorm
-#define GL_EXT_texture_snorm 1
-
-#define GL_RED_SNORM 0x8F90
-#define GL_RG_SNORM 0x8F91
-#define GL_RGB_SNORM 0x8F92
-#define GL_RGBA_SNORM 0x8F93
-#define GL_R8_SNORM 0x8F94
-#define GL_RG8_SNORM 0x8F95
-#define GL_RGB8_SNORM 0x8F96
-#define GL_RGBA8_SNORM 0x8F97
-#define GL_R16_SNORM 0x8F98
-#define GL_RG16_SNORM 0x8F99
-#define GL_RGB16_SNORM 0x8F9A
-#define GL_RGBA16_SNORM 0x8F9B
-#define GL_SIGNED_NORMALIZED 0x8F9C
-#define GL_ALPHA_SNORM 0x9010
-#define GL_LUMINANCE_SNORM 0x9011
-#define GL_LUMINANCE_ALPHA_SNORM 0x9012
-#define GL_INTENSITY_SNORM 0x9013
-#define GL_ALPHA8_SNORM 0x9014
-#define GL_LUMINANCE8_SNORM 0x9015
-#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016
-#define GL_INTENSITY8_SNORM 0x9017
-#define GL_ALPHA16_SNORM 0x9018
-#define GL_LUMINANCE16_SNORM 0x9019
-#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A
-#define GL_INTENSITY16_SNORM 0x901B
-
-#define GLEW_EXT_texture_snorm GLEW_GET_VAR(__GLEW_EXT_texture_snorm)
-
-#endif /* GL_EXT_texture_snorm */
-
-/* ------------------------- GL_EXT_texture_swizzle ------------------------ */
-
-#ifndef GL_EXT_texture_swizzle
-#define GL_EXT_texture_swizzle 1
-
-#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42
-#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43
-#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44
-#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45
-#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46
-
-#define GLEW_EXT_texture_swizzle GLEW_GET_VAR(__GLEW_EXT_texture_swizzle)
-
-#endif /* GL_EXT_texture_swizzle */
-
-/* --------------------------- GL_EXT_timer_query -------------------------- */
-
-#ifndef GL_EXT_timer_query
-#define GL_EXT_timer_query 1
-
-#define GL_TIME_ELAPSED_EXT 0x88BF
-
-typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params);
-typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params);
-
-#define glGetQueryObjecti64vEXT GLEW_GET_FUN(__glewGetQueryObjecti64vEXT)
-#define glGetQueryObjectui64vEXT GLEW_GET_FUN(__glewGetQueryObjectui64vEXT)
-
-#define GLEW_EXT_timer_query GLEW_GET_VAR(__GLEW_EXT_timer_query)
-
-#endif /* GL_EXT_timer_query */
-
-/* ----------------------- GL_EXT_transform_feedback ----------------------- */
-
-#ifndef GL_EXT_transform_feedback
-#define GL_EXT_transform_feedback 1
-
-#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76
-#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80
-#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83
-#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84
-#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85
-#define GL_PRIMITIVES_GENERATED_EXT 0x8C87
-#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88
-#define GL_RASTERIZER_DISCARD_EXT 0x8C89
-#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B
-#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C
-#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D
-#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E
-#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F
-
-typedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode);
-typedef void (GLAPIENTRY * PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void);
-typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei *size, GLenum *type, GLchar *name);
-typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar * const* varyings, GLenum bufferMode);
-
-#define glBeginTransformFeedbackEXT GLEW_GET_FUN(__glewBeginTransformFeedbackEXT)
-#define glBindBufferBaseEXT GLEW_GET_FUN(__glewBindBufferBaseEXT)
-#define glBindBufferOffsetEXT GLEW_GET_FUN(__glewBindBufferOffsetEXT)
-#define glBindBufferRangeEXT GLEW_GET_FUN(__glewBindBufferRangeEXT)
-#define glEndTransformFeedbackEXT GLEW_GET_FUN(__glewEndTransformFeedbackEXT)
-#define glGetTransformFeedbackVaryingEXT GLEW_GET_FUN(__glewGetTransformFeedbackVaryingEXT)
-#define glTransformFeedbackVaryingsEXT GLEW_GET_FUN(__glewTransformFeedbackVaryingsEXT)
-
-#define GLEW_EXT_transform_feedback GLEW_GET_VAR(__GLEW_EXT_transform_feedback)
-
-#endif /* GL_EXT_transform_feedback */
-
-/* -------------------------- GL_EXT_vertex_array -------------------------- */
-
-#ifndef GL_EXT_vertex_array
-#define GL_EXT_vertex_array 1
-
-#define GL_DOUBLE_EXT 0x140A
-#define GL_VERTEX_ARRAY_EXT 0x8074
-#define GL_NORMAL_ARRAY_EXT 0x8075
-#define GL_COLOR_ARRAY_EXT 0x8076
-#define GL_INDEX_ARRAY_EXT 0x8077
-#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078
-#define GL_EDGE_FLAG_ARRAY_EXT 0x8079
-#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A
-#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B
-#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C
-#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D
-#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E
-#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F
-#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080
-#define GL_COLOR_ARRAY_SIZE_EXT 0x8081
-#define GL_COLOR_ARRAY_TYPE_EXT 0x8082
-#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083
-#define GL_COLOR_ARRAY_COUNT_EXT 0x8084
-#define GL_INDEX_ARRAY_TYPE_EXT 0x8085
-#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086
-#define GL_INDEX_ARRAY_COUNT_EXT 0x8087
-#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088
-#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089
-#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A
-#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B
-#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C
-#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D
-#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E
-#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F
-#define GL_COLOR_ARRAY_POINTER_EXT 0x8090
-#define GL_INDEX_ARRAY_POINTER_EXT 0x8091
-#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092
-#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093
-
-typedef void (GLAPIENTRY * PFNGLARRAYELEMENTEXTPROC) (GLint i);
-typedef void (GLAPIENTRY * PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-typedef void (GLAPIENTRY * PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count);
-typedef void (GLAPIENTRY * PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean* pointer);
-typedef void (GLAPIENTRY * PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-typedef void (GLAPIENTRY * PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-typedef void (GLAPIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-
-#define glArrayElementEXT GLEW_GET_FUN(__glewArrayElementEXT)
-#define glColorPointerEXT GLEW_GET_FUN(__glewColorPointerEXT)
-#define glDrawArraysEXT GLEW_GET_FUN(__glewDrawArraysEXT)
-#define glEdgeFlagPointerEXT GLEW_GET_FUN(__glewEdgeFlagPointerEXT)
-#define glIndexPointerEXT GLEW_GET_FUN(__glewIndexPointerEXT)
-#define glNormalPointerEXT GLEW_GET_FUN(__glewNormalPointerEXT)
-#define glTexCoordPointerEXT GLEW_GET_FUN(__glewTexCoordPointerEXT)
-#define glVertexPointerEXT GLEW_GET_FUN(__glewVertexPointerEXT)
-
-#define GLEW_EXT_vertex_array GLEW_GET_VAR(__GLEW_EXT_vertex_array)
-
-#endif /* GL_EXT_vertex_array */
-
-/* ------------------------ GL_EXT_vertex_array_bgra ----------------------- */
-
-#ifndef GL_EXT_vertex_array_bgra
-#define GL_EXT_vertex_array_bgra 1
-
-#define GL_BGRA 0x80E1
-
-#define GLEW_EXT_vertex_array_bgra GLEW_GET_VAR(__GLEW_EXT_vertex_array_bgra)
-
-#endif /* GL_EXT_vertex_array_bgra */
-
-/* ----------------------- GL_EXT_vertex_attrib_64bit ---------------------- */
-
-#ifndef GL_EXT_vertex_attrib_64bit
-#define GL_EXT_vertex_attrib_64bit 1
-
-#define GL_DOUBLE_MAT2_EXT 0x8F46
-#define GL_DOUBLE_MAT3_EXT 0x8F47
-#define GL_DOUBLE_MAT4_EXT 0x8F48
-#define GL_DOUBLE_MAT2x3_EXT 0x8F49
-#define GL_DOUBLE_MAT2x4_EXT 0x8F4A
-#define GL_DOUBLE_MAT3x2_EXT 0x8F4B
-#define GL_DOUBLE_MAT3x4_EXT 0x8F4C
-#define GL_DOUBLE_MAT4x2_EXT 0x8F4D
-#define GL_DOUBLE_MAT4x3_EXT 0x8F4E
-#define GL_DOUBLE_VEC2_EXT 0x8FFC
-#define GL_DOUBLE_VEC3_EXT 0x8FFD
-#define GL_DOUBLE_VEC4_EXT 0x8FFE
-
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-
-#define glGetVertexAttribLdvEXT GLEW_GET_FUN(__glewGetVertexAttribLdvEXT)
-#define glVertexArrayVertexAttribLOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribLOffsetEXT)
-#define glVertexAttribL1dEXT GLEW_GET_FUN(__glewVertexAttribL1dEXT)
-#define glVertexAttribL1dvEXT GLEW_GET_FUN(__glewVertexAttribL1dvEXT)
-#define glVertexAttribL2dEXT GLEW_GET_FUN(__glewVertexAttribL2dEXT)
-#define glVertexAttribL2dvEXT GLEW_GET_FUN(__glewVertexAttribL2dvEXT)
-#define glVertexAttribL3dEXT GLEW_GET_FUN(__glewVertexAttribL3dEXT)
-#define glVertexAttribL3dvEXT GLEW_GET_FUN(__glewVertexAttribL3dvEXT)
-#define glVertexAttribL4dEXT GLEW_GET_FUN(__glewVertexAttribL4dEXT)
-#define glVertexAttribL4dvEXT GLEW_GET_FUN(__glewVertexAttribL4dvEXT)
-#define glVertexAttribLPointerEXT GLEW_GET_FUN(__glewVertexAttribLPointerEXT)
-
-#define GLEW_EXT_vertex_attrib_64bit GLEW_GET_VAR(__GLEW_EXT_vertex_attrib_64bit)
-
-#endif /* GL_EXT_vertex_attrib_64bit */
-
-/* -------------------------- GL_EXT_vertex_shader ------------------------- */
-
-#ifndef GL_EXT_vertex_shader
-#define GL_EXT_vertex_shader 1
-
-#define GL_VERTEX_SHADER_EXT 0x8780
-#define GL_VERTEX_SHADER_BINDING_EXT 0x8781
-#define GL_OP_INDEX_EXT 0x8782
-#define GL_OP_NEGATE_EXT 0x8783
-#define GL_OP_DOT3_EXT 0x8784
-#define GL_OP_DOT4_EXT 0x8785
-#define GL_OP_MUL_EXT 0x8786
-#define GL_OP_ADD_EXT 0x8787
-#define GL_OP_MADD_EXT 0x8788
-#define GL_OP_FRAC_EXT 0x8789
-#define GL_OP_MAX_EXT 0x878A
-#define GL_OP_MIN_EXT 0x878B
-#define GL_OP_SET_GE_EXT 0x878C
-#define GL_OP_SET_LT_EXT 0x878D
-#define GL_OP_CLAMP_EXT 0x878E
-#define GL_OP_FLOOR_EXT 0x878F
-#define GL_OP_ROUND_EXT 0x8790
-#define GL_OP_EXP_BASE_2_EXT 0x8791
-#define GL_OP_LOG_BASE_2_EXT 0x8792
-#define GL_OP_POWER_EXT 0x8793
-#define GL_OP_RECIP_EXT 0x8794
-#define GL_OP_RECIP_SQRT_EXT 0x8795
-#define GL_OP_SUB_EXT 0x8796
-#define GL_OP_CROSS_PRODUCT_EXT 0x8797
-#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798
-#define GL_OP_MOV_EXT 0x8799
-#define GL_OUTPUT_VERTEX_EXT 0x879A
-#define GL_OUTPUT_COLOR0_EXT 0x879B
-#define GL_OUTPUT_COLOR1_EXT 0x879C
-#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D
-#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E
-#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F
-#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0
-#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1
-#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2
-#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3
-#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4
-#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5
-#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6
-#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7
-#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8
-#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9
-#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA
-#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB
-#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC
-#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD
-#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE
-#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF
-#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0
-#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1
-#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2
-#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3
-#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4
-#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5
-#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6
-#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7
-#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8
-#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9
-#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA
-#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB
-#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC
-#define GL_OUTPUT_FOG_EXT 0x87BD
-#define GL_SCALAR_EXT 0x87BE
-#define GL_VECTOR_EXT 0x87BF
-#define GL_MATRIX_EXT 0x87C0
-#define GL_VARIANT_EXT 0x87C1
-#define GL_INVARIANT_EXT 0x87C2
-#define GL_LOCAL_CONSTANT_EXT 0x87C3
-#define GL_LOCAL_EXT 0x87C4
-#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5
-#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6
-#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7
-#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8
-#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CC
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CD
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE
-#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF
-#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0
-#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1
-#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2
-#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3
-#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4
-#define GL_X_EXT 0x87D5
-#define GL_Y_EXT 0x87D6
-#define GL_Z_EXT 0x87D7
-#define GL_W_EXT 0x87D8
-#define GL_NEGATIVE_X_EXT 0x87D9
-#define GL_NEGATIVE_Y_EXT 0x87DA
-#define GL_NEGATIVE_Z_EXT 0x87DB
-#define GL_NEGATIVE_W_EXT 0x87DC
-#define GL_ZERO_EXT 0x87DD
-#define GL_ONE_EXT 0x87DE
-#define GL_NEGATIVE_ONE_EXT 0x87DF
-#define GL_NORMALIZED_RANGE_EXT 0x87E0
-#define GL_FULL_RANGE_EXT 0x87E1
-#define GL_CURRENT_VERTEX_EXT 0x87E2
-#define GL_MVP_MATRIX_EXT 0x87E3
-#define GL_VARIANT_VALUE_EXT 0x87E4
-#define GL_VARIANT_DATATYPE_EXT 0x87E5
-#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6
-#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7
-#define GL_VARIANT_ARRAY_EXT 0x87E8
-#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9
-#define GL_INVARIANT_VALUE_EXT 0x87EA
-#define GL_INVARIANT_DATATYPE_EXT 0x87EB
-#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC
-#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED
-
-typedef void (GLAPIENTRY * PFNGLBEGINVERTEXSHADEREXTPROC) (void);
-typedef GLuint (GLAPIENTRY * PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value);
-typedef GLuint (GLAPIENTRY * PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value);
-typedef GLuint (GLAPIENTRY * PFNGLBINDPARAMETEREXTPROC) (GLenum value);
-typedef GLuint (GLAPIENTRY * PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value);
-typedef GLuint (GLAPIENTRY * PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value);
-typedef void (GLAPIENTRY * PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id);
-typedef void (GLAPIENTRY * PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id);
-typedef void (GLAPIENTRY * PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);
-typedef void (GLAPIENTRY * PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);
-typedef void (GLAPIENTRY * PFNGLENDVERTEXSHADEREXTPROC) (void);
-typedef void (GLAPIENTRY * PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);
-typedef GLuint (GLAPIENTRY * PFNGLGENSYMBOLSEXTPROC) (GLenum dataType, GLenum storageType, GLenum range, GLuint components);
-typedef GLuint (GLAPIENTRY * PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range);
-typedef void (GLAPIENTRY * PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
-typedef void (GLAPIENTRY * PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
-typedef void (GLAPIENTRY * PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
-typedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
-typedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
-typedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
-typedef void (GLAPIENTRY * PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
-typedef void (GLAPIENTRY * PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
-typedef void (GLAPIENTRY * PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
-typedef void (GLAPIENTRY * PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, void **data);
-typedef void (GLAPIENTRY * PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);
-typedef GLboolean (GLAPIENTRY * PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap);
-typedef void (GLAPIENTRY * PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, void *addr);
-typedef void (GLAPIENTRY * PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, void *addr);
-typedef void (GLAPIENTRY * PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1);
-typedef void (GLAPIENTRY * PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2);
-typedef void (GLAPIENTRY * PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);
-typedef void (GLAPIENTRY * PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
-typedef void (GLAPIENTRY * PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, void *addr);
-typedef void (GLAPIENTRY * PFNGLVARIANTBVEXTPROC) (GLuint id, GLbyte *addr);
-typedef void (GLAPIENTRY * PFNGLVARIANTDVEXTPROC) (GLuint id, GLdouble *addr);
-typedef void (GLAPIENTRY * PFNGLVARIANTFVEXTPROC) (GLuint id, GLfloat *addr);
-typedef void (GLAPIENTRY * PFNGLVARIANTIVEXTPROC) (GLuint id, GLint *addr);
-typedef void (GLAPIENTRY * PFNGLVARIANTSVEXTPROC) (GLuint id, GLshort *addr);
-typedef void (GLAPIENTRY * PFNGLVARIANTUBVEXTPROC) (GLuint id, GLubyte *addr);
-typedef void (GLAPIENTRY * PFNGLVARIANTUIVEXTPROC) (GLuint id, GLuint *addr);
-typedef void (GLAPIENTRY * PFNGLVARIANTUSVEXTPROC) (GLuint id, GLushort *addr);
-typedef void (GLAPIENTRY * PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
-
-#define glBeginVertexShaderEXT GLEW_GET_FUN(__glewBeginVertexShaderEXT)
-#define glBindLightParameterEXT GLEW_GET_FUN(__glewBindLightParameterEXT)
-#define glBindMaterialParameterEXT GLEW_GET_FUN(__glewBindMaterialParameterEXT)
-#define glBindParameterEXT GLEW_GET_FUN(__glewBindParameterEXT)
-#define glBindTexGenParameterEXT GLEW_GET_FUN(__glewBindTexGenParameterEXT)
-#define glBindTextureUnitParameterEXT GLEW_GET_FUN(__glewBindTextureUnitParameterEXT)
-#define glBindVertexShaderEXT GLEW_GET_FUN(__glewBindVertexShaderEXT)
-#define glDeleteVertexShaderEXT GLEW_GET_FUN(__glewDeleteVertexShaderEXT)
-#define glDisableVariantClientStateEXT GLEW_GET_FUN(__glewDisableVariantClientStateEXT)
-#define glEnableVariantClientStateEXT GLEW_GET_FUN(__glewEnableVariantClientStateEXT)
-#define glEndVertexShaderEXT GLEW_GET_FUN(__glewEndVertexShaderEXT)
-#define glExtractComponentEXT GLEW_GET_FUN(__glewExtractComponentEXT)
-#define glGenSymbolsEXT GLEW_GET_FUN(__glewGenSymbolsEXT)
-#define glGenVertexShadersEXT GLEW_GET_FUN(__glewGenVertexShadersEXT)
-#define glGetInvariantBooleanvEXT GLEW_GET_FUN(__glewGetInvariantBooleanvEXT)
-#define glGetInvariantFloatvEXT GLEW_GET_FUN(__glewGetInvariantFloatvEXT)
-#define glGetInvariantIntegervEXT GLEW_GET_FUN(__glewGetInvariantIntegervEXT)
-#define glGetLocalConstantBooleanvEXT GLEW_GET_FUN(__glewGetLocalConstantBooleanvEXT)
-#define glGetLocalConstantFloatvEXT GLEW_GET_FUN(__glewGetLocalConstantFloatvEXT)
-#define glGetLocalConstantIntegervEXT GLEW_GET_FUN(__glewGetLocalConstantIntegervEXT)
-#define glGetVariantBooleanvEXT GLEW_GET_FUN(__glewGetVariantBooleanvEXT)
-#define glGetVariantFloatvEXT GLEW_GET_FUN(__glewGetVariantFloatvEXT)
-#define glGetVariantIntegervEXT GLEW_GET_FUN(__glewGetVariantIntegervEXT)
-#define glGetVariantPointervEXT GLEW_GET_FUN(__glewGetVariantPointervEXT)
-#define glInsertComponentEXT GLEW_GET_FUN(__glewInsertComponentEXT)
-#define glIsVariantEnabledEXT GLEW_GET_FUN(__glewIsVariantEnabledEXT)
-#define glSetInvariantEXT GLEW_GET_FUN(__glewSetInvariantEXT)
-#define glSetLocalConstantEXT GLEW_GET_FUN(__glewSetLocalConstantEXT)
-#define glShaderOp1EXT GLEW_GET_FUN(__glewShaderOp1EXT)
-#define glShaderOp2EXT GLEW_GET_FUN(__glewShaderOp2EXT)
-#define glShaderOp3EXT GLEW_GET_FUN(__glewShaderOp3EXT)
-#define glSwizzleEXT GLEW_GET_FUN(__glewSwizzleEXT)
-#define glVariantPointerEXT GLEW_GET_FUN(__glewVariantPointerEXT)
-#define glVariantbvEXT GLEW_GET_FUN(__glewVariantbvEXT)
-#define glVariantdvEXT GLEW_GET_FUN(__glewVariantdvEXT)
-#define glVariantfvEXT GLEW_GET_FUN(__glewVariantfvEXT)
-#define glVariantivEXT GLEW_GET_FUN(__glewVariantivEXT)
-#define glVariantsvEXT GLEW_GET_FUN(__glewVariantsvEXT)
-#define glVariantubvEXT GLEW_GET_FUN(__glewVariantubvEXT)
-#define glVariantuivEXT GLEW_GET_FUN(__glewVariantuivEXT)
-#define glVariantusvEXT GLEW_GET_FUN(__glewVariantusvEXT)
-#define glWriteMaskEXT GLEW_GET_FUN(__glewWriteMaskEXT)
-
-#define GLEW_EXT_vertex_shader GLEW_GET_VAR(__GLEW_EXT_vertex_shader)
-
-#endif /* GL_EXT_vertex_shader */
-
-/* ------------------------ GL_EXT_vertex_weighting ------------------------ */
-
-#ifndef GL_EXT_vertex_weighting
-#define GL_EXT_vertex_weighting 1
-
-#define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3
-#define GL_MODELVIEW0_MATRIX_EXT 0x0BA6
-#define GL_MODELVIEW0_EXT 0x1700
-#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502
-#define GL_MODELVIEW1_MATRIX_EXT 0x8506
-#define GL_VERTEX_WEIGHTING_EXT 0x8509
-#define GL_MODELVIEW1_EXT 0x850A
-#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B
-#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C
-#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D
-#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E
-#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F
-#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510
-
-typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, void *pointer);
-typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);
-typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (GLfloat* weight);
-
-#define glVertexWeightPointerEXT GLEW_GET_FUN(__glewVertexWeightPointerEXT)
-#define glVertexWeightfEXT GLEW_GET_FUN(__glewVertexWeightfEXT)
-#define glVertexWeightfvEXT GLEW_GET_FUN(__glewVertexWeightfvEXT)
-
-#define GLEW_EXT_vertex_weighting GLEW_GET_VAR(__GLEW_EXT_vertex_weighting)
-
-#endif /* GL_EXT_vertex_weighting */
-
-/* ------------------------- GL_EXT_x11_sync_object ------------------------ */
-
-#ifndef GL_EXT_x11_sync_object
-#define GL_EXT_x11_sync_object 1
-
-#define GL_SYNC_X11_FENCE_EXT 0x90E1
-
-typedef GLsync (GLAPIENTRY * PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);
-
-#define glImportSyncEXT GLEW_GET_FUN(__glewImportSyncEXT)
-
-#define GLEW_EXT_x11_sync_object GLEW_GET_VAR(__GLEW_EXT_x11_sync_object)
-
-#endif /* GL_EXT_x11_sync_object */
-
-/* ---------------------- GL_GREMEDY_frame_terminator ---------------------- */
-
-#ifndef GL_GREMEDY_frame_terminator
-#define GL_GREMEDY_frame_terminator 1
-
-typedef void (GLAPIENTRY * PFNGLFRAMETERMINATORGREMEDYPROC) (void);
-
-#define glFrameTerminatorGREMEDY GLEW_GET_FUN(__glewFrameTerminatorGREMEDY)
-
-#define GLEW_GREMEDY_frame_terminator GLEW_GET_VAR(__GLEW_GREMEDY_frame_terminator)
-
-#endif /* GL_GREMEDY_frame_terminator */
-
-/* ------------------------ GL_GREMEDY_string_marker ----------------------- */
-
-#ifndef GL_GREMEDY_string_marker
-#define GL_GREMEDY_string_marker 1
-
-typedef void (GLAPIENTRY * PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void *string);
-
-#define glStringMarkerGREMEDY GLEW_GET_FUN(__glewStringMarkerGREMEDY)
-
-#define GLEW_GREMEDY_string_marker GLEW_GET_VAR(__GLEW_GREMEDY_string_marker)
-
-#endif /* GL_GREMEDY_string_marker */
-
-/* --------------------- GL_HP_convolution_border_modes -------------------- */
-
-#ifndef GL_HP_convolution_border_modes
-#define GL_HP_convolution_border_modes 1
-
-#define GLEW_HP_convolution_border_modes GLEW_GET_VAR(__GLEW_HP_convolution_border_modes)
-
-#endif /* GL_HP_convolution_border_modes */
-
-/* ------------------------- GL_HP_image_transform ------------------------- */
-
-#ifndef GL_HP_image_transform
-#define GL_HP_image_transform 1
-
-typedef void (GLAPIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, const GLfloat param);
-typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, const GLint param);
-typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint* params);
-
-#define glGetImageTransformParameterfvHP GLEW_GET_FUN(__glewGetImageTransformParameterfvHP)
-#define glGetImageTransformParameterivHP GLEW_GET_FUN(__glewGetImageTransformParameterivHP)
-#define glImageTransformParameterfHP GLEW_GET_FUN(__glewImageTransformParameterfHP)
-#define glImageTransformParameterfvHP GLEW_GET_FUN(__glewImageTransformParameterfvHP)
-#define glImageTransformParameteriHP GLEW_GET_FUN(__glewImageTransformParameteriHP)
-#define glImageTransformParameterivHP GLEW_GET_FUN(__glewImageTransformParameterivHP)
-
-#define GLEW_HP_image_transform GLEW_GET_VAR(__GLEW_HP_image_transform)
-
-#endif /* GL_HP_image_transform */
-
-/* -------------------------- GL_HP_occlusion_test ------------------------- */
-
-#ifndef GL_HP_occlusion_test
-#define GL_HP_occlusion_test 1
-
-#define GLEW_HP_occlusion_test GLEW_GET_VAR(__GLEW_HP_occlusion_test)
-
-#endif /* GL_HP_occlusion_test */
-
-/* ------------------------- GL_HP_texture_lighting ------------------------ */
-
-#ifndef GL_HP_texture_lighting
-#define GL_HP_texture_lighting 1
-
-#define GLEW_HP_texture_lighting GLEW_GET_VAR(__GLEW_HP_texture_lighting)
-
-#endif /* GL_HP_texture_lighting */
-
-/* --------------------------- GL_IBM_cull_vertex -------------------------- */
-
-#ifndef GL_IBM_cull_vertex
-#define GL_IBM_cull_vertex 1
-
-#define GL_CULL_VERTEX_IBM 103050
-
-#define GLEW_IBM_cull_vertex GLEW_GET_VAR(__GLEW_IBM_cull_vertex)
-
-#endif /* GL_IBM_cull_vertex */
-
-/* ---------------------- GL_IBM_multimode_draw_arrays --------------------- */
-
-#ifndef GL_IBM_multimode_draw_arrays
-#define GL_IBM_multimode_draw_arrays 1
-
-typedef void (GLAPIENTRY * PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum* mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
-typedef void (GLAPIENTRY * PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum* mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei primcount, GLint modestride);
-
-#define glMultiModeDrawArraysIBM GLEW_GET_FUN(__glewMultiModeDrawArraysIBM)
-#define glMultiModeDrawElementsIBM GLEW_GET_FUN(__glewMultiModeDrawElementsIBM)
-
-#define GLEW_IBM_multimode_draw_arrays GLEW_GET_VAR(__GLEW_IBM_multimode_draw_arrays)
-
-#endif /* GL_IBM_multimode_draw_arrays */
-
-/* ------------------------- GL_IBM_rasterpos_clip ------------------------- */
-
-#ifndef GL_IBM_rasterpos_clip
-#define GL_IBM_rasterpos_clip 1
-
-#define GL_RASTER_POSITION_UNCLIPPED_IBM 103010
-
-#define GLEW_IBM_rasterpos_clip GLEW_GET_VAR(__GLEW_IBM_rasterpos_clip)
-
-#endif /* GL_IBM_rasterpos_clip */
-
-/* --------------------------- GL_IBM_static_data -------------------------- */
-
-#ifndef GL_IBM_static_data
-#define GL_IBM_static_data 1
-
-#define GL_ALL_STATIC_DATA_IBM 103060
-#define GL_STATIC_VERTEX_ARRAY_IBM 103061
-
-#define GLEW_IBM_static_data GLEW_GET_VAR(__GLEW_IBM_static_data)
-
-#endif /* GL_IBM_static_data */
-
-/* --------------------- GL_IBM_texture_mirrored_repeat -------------------- */
-
-#ifndef GL_IBM_texture_mirrored_repeat
-#define GL_IBM_texture_mirrored_repeat 1
-
-#define GL_MIRRORED_REPEAT_IBM 0x8370
-
-#define GLEW_IBM_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_IBM_texture_mirrored_repeat)
-
-#endif /* GL_IBM_texture_mirrored_repeat */
-
-/* ----------------------- GL_IBM_vertex_array_lists ----------------------- */
-
-#ifndef GL_IBM_vertex_array_lists
-#define GL_IBM_vertex_array_lists 1
-
-#define GL_VERTEX_ARRAY_LIST_IBM 103070
-#define GL_NORMAL_ARRAY_LIST_IBM 103071
-#define GL_COLOR_ARRAY_LIST_IBM 103072
-#define GL_INDEX_ARRAY_LIST_IBM 103073
-#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074
-#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075
-#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076
-#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077
-#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080
-#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081
-#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082
-#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083
-#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084
-#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085
-#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086
-#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087
-
-typedef void (GLAPIENTRY * PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void** pointer, GLint ptrstride);
-typedef void (GLAPIENTRY * PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean ** pointer, GLint ptrstride);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void** pointer, GLint ptrstride);
-typedef void (GLAPIENTRY * PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void** pointer, GLint ptrstride);
-typedef void (GLAPIENTRY * PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void** pointer, GLint ptrstride);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void** pointer, GLint ptrstride);
-typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void** pointer, GLint ptrstride);
-typedef void (GLAPIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void** pointer, GLint ptrstride);
-
-#define glColorPointerListIBM GLEW_GET_FUN(__glewColorPointerListIBM)
-#define glEdgeFlagPointerListIBM GLEW_GET_FUN(__glewEdgeFlagPointerListIBM)
-#define glFogCoordPointerListIBM GLEW_GET_FUN(__glewFogCoordPointerListIBM)
-#define glIndexPointerListIBM GLEW_GET_FUN(__glewIndexPointerListIBM)
-#define glNormalPointerListIBM GLEW_GET_FUN(__glewNormalPointerListIBM)
-#define glSecondaryColorPointerListIBM GLEW_GET_FUN(__glewSecondaryColorPointerListIBM)
-#define glTexCoordPointerListIBM GLEW_GET_FUN(__glewTexCoordPointerListIBM)
-#define glVertexPointerListIBM GLEW_GET_FUN(__glewVertexPointerListIBM)
-
-#define GLEW_IBM_vertex_array_lists GLEW_GET_VAR(__GLEW_IBM_vertex_array_lists)
-
-#endif /* GL_IBM_vertex_array_lists */
-
-/* -------------------------- GL_INGR_color_clamp -------------------------- */
-
-#ifndef GL_INGR_color_clamp
-#define GL_INGR_color_clamp 1
-
-#define GL_RED_MIN_CLAMP_INGR 0x8560
-#define GL_GREEN_MIN_CLAMP_INGR 0x8561
-#define GL_BLUE_MIN_CLAMP_INGR 0x8562
-#define GL_ALPHA_MIN_CLAMP_INGR 0x8563
-#define GL_RED_MAX_CLAMP_INGR 0x8564
-#define GL_GREEN_MAX_CLAMP_INGR 0x8565
-#define GL_BLUE_MAX_CLAMP_INGR 0x8566
-#define GL_ALPHA_MAX_CLAMP_INGR 0x8567
-
-#define GLEW_INGR_color_clamp GLEW_GET_VAR(__GLEW_INGR_color_clamp)
-
-#endif /* GL_INGR_color_clamp */
-
-/* ------------------------- GL_INGR_interlace_read ------------------------ */
-
-#ifndef GL_INGR_interlace_read
-#define GL_INGR_interlace_read 1
-
-#define GL_INTERLACE_READ_INGR 0x8568
-
-#define GLEW_INGR_interlace_read GLEW_GET_VAR(__GLEW_INGR_interlace_read)
-
-#endif /* GL_INGR_interlace_read */
-
-/* ------------------- GL_INTEL_fragment_shader_ordering ------------------- */
-
-#ifndef GL_INTEL_fragment_shader_ordering
-#define GL_INTEL_fragment_shader_ordering 1
-
-#define GLEW_INTEL_fragment_shader_ordering GLEW_GET_VAR(__GLEW_INTEL_fragment_shader_ordering)
-
-#endif /* GL_INTEL_fragment_shader_ordering */
-
-/* -------------------------- GL_INTEL_map_texture ------------------------- */
-
-#ifndef GL_INTEL_map_texture
-#define GL_INTEL_map_texture 1
-
-#define GL_LAYOUT_DEFAULT_INTEL 0
-#define GL_LAYOUT_LINEAR_INTEL 1
-#define GL_LAYOUT_LINEAR_CPU_CACHED_INTEL 2
-#define GL_TEXTURE_MEMORY_LAYOUT_INTEL 0x83FF
-
-typedef void * (GLAPIENTRY * PFNGLMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level, GLbitfield access, GLint* stride, GLenum *layout);
-typedef void (GLAPIENTRY * PFNGLSYNCTEXTUREINTELPROC) (GLuint texture);
-typedef void (GLAPIENTRY * PFNGLUNMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level);
-
-#define glMapTexture2DINTEL GLEW_GET_FUN(__glewMapTexture2DINTEL)
-#define glSyncTextureINTEL GLEW_GET_FUN(__glewSyncTextureINTEL)
-#define glUnmapTexture2DINTEL GLEW_GET_FUN(__glewUnmapTexture2DINTEL)
-
-#define GLEW_INTEL_map_texture GLEW_GET_VAR(__GLEW_INTEL_map_texture)
-
-#endif /* GL_INTEL_map_texture */
-
-/* ------------------------ GL_INTEL_parallel_arrays ----------------------- */
-
-#ifndef GL_INTEL_parallel_arrays
-#define GL_INTEL_parallel_arrays 1
-
-#define GL_PARALLEL_ARRAYS_INTEL 0x83F4
-#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5
-#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6
-#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7
-#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8
-
-typedef void (GLAPIENTRY * PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer);
-typedef void (GLAPIENTRY * PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const void** pointer);
-typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer);
-typedef void (GLAPIENTRY * PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer);
-
-#define glColorPointervINTEL GLEW_GET_FUN(__glewColorPointervINTEL)
-#define glNormalPointervINTEL GLEW_GET_FUN(__glewNormalPointervINTEL)
-#define glTexCoordPointervINTEL GLEW_GET_FUN(__glewTexCoordPointervINTEL)
-#define glVertexPointervINTEL GLEW_GET_FUN(__glewVertexPointervINTEL)
-
-#define GLEW_INTEL_parallel_arrays GLEW_GET_VAR(__GLEW_INTEL_parallel_arrays)
-
-#endif /* GL_INTEL_parallel_arrays */
-
-/* ----------------------- GL_INTEL_performance_query ---------------------- */
-
-#ifndef GL_INTEL_performance_query
-#define GL_INTEL_performance_query 1
-
-#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x0000
-#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x0001
-#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9
-#define GL_PERFQUERY_FLUSH_INTEL 0x83FA
-#define GL_PERFQUERY_WAIT_INTEL 0x83FB
-#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0
-#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1
-#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2
-#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3
-#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4
-#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5
-#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8
-#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9
-#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA
-#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB
-#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC
-#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD
-#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE
-#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF
-#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500
-
-typedef void (GLAPIENTRY * PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (GLAPIENTRY * PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint* queryHandle);
-typedef void (GLAPIENTRY * PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (GLAPIENTRY * PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (GLAPIENTRY * PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint* queryId);
-typedef void (GLAPIENTRY * PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint* nextQueryId);
-typedef void (GLAPIENTRY * PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar* counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
-typedef void (GLAPIENTRY * PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten);
-typedef void (GLAPIENTRY * PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar* queryName, GLuint *queryId);
-typedef void (GLAPIENTRY * PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar* queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
-
-#define glBeginPerfQueryINTEL GLEW_GET_FUN(__glewBeginPerfQueryINTEL)
-#define glCreatePerfQueryINTEL GLEW_GET_FUN(__glewCreatePerfQueryINTEL)
-#define glDeletePerfQueryINTEL GLEW_GET_FUN(__glewDeletePerfQueryINTEL)
-#define glEndPerfQueryINTEL GLEW_GET_FUN(__glewEndPerfQueryINTEL)
-#define glGetFirstPerfQueryIdINTEL GLEW_GET_FUN(__glewGetFirstPerfQueryIdINTEL)
-#define glGetNextPerfQueryIdINTEL GLEW_GET_FUN(__glewGetNextPerfQueryIdINTEL)
-#define glGetPerfCounterInfoINTEL GLEW_GET_FUN(__glewGetPerfCounterInfoINTEL)
-#define glGetPerfQueryDataINTEL GLEW_GET_FUN(__glewGetPerfQueryDataINTEL)
-#define glGetPerfQueryIdByNameINTEL GLEW_GET_FUN(__glewGetPerfQueryIdByNameINTEL)
-#define glGetPerfQueryInfoINTEL GLEW_GET_FUN(__glewGetPerfQueryInfoINTEL)
-
-#define GLEW_INTEL_performance_query GLEW_GET_VAR(__GLEW_INTEL_performance_query)
-
-#endif /* GL_INTEL_performance_query */
-
-/* ------------------------ GL_INTEL_texture_scissor ----------------------- */
-
-#ifndef GL_INTEL_texture_scissor
-#define GL_INTEL_texture_scissor 1
-
-typedef void (GLAPIENTRY * PFNGLTEXSCISSORFUNCINTELPROC) (GLenum target, GLenum lfunc, GLenum hfunc);
-typedef void (GLAPIENTRY * PFNGLTEXSCISSORINTELPROC) (GLenum target, GLclampf tlow, GLclampf thigh);
-
-#define glTexScissorFuncINTEL GLEW_GET_FUN(__glewTexScissorFuncINTEL)
-#define glTexScissorINTEL GLEW_GET_FUN(__glewTexScissorINTEL)
-
-#define GLEW_INTEL_texture_scissor GLEW_GET_VAR(__GLEW_INTEL_texture_scissor)
-
-#endif /* GL_INTEL_texture_scissor */
-
-/* --------------------- GL_KHR_blend_equation_advanced -------------------- */
-
-#ifndef GL_KHR_blend_equation_advanced
-#define GL_KHR_blend_equation_advanced 1
-
-#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
-#define GL_MULTIPLY_KHR 0x9294
-#define GL_SCREEN_KHR 0x9295
-#define GL_OVERLAY_KHR 0x9296
-#define GL_DARKEN_KHR 0x9297
-#define GL_LIGHTEN_KHR 0x9298
-#define GL_COLORDODGE_KHR 0x9299
-#define GL_COLORBURN_KHR 0x929A
-#define GL_HARDLIGHT_KHR 0x929B
-#define GL_SOFTLIGHT_KHR 0x929C
-#define GL_DIFFERENCE_KHR 0x929E
-#define GL_EXCLUSION_KHR 0x92A0
-#define GL_HSL_HUE_KHR 0x92AD
-#define GL_HSL_SATURATION_KHR 0x92AE
-#define GL_HSL_COLOR_KHR 0x92AF
-#define GL_HSL_LUMINOSITY_KHR 0x92B0
-
-typedef void (GLAPIENTRY * PFNGLBLENDBARRIERKHRPROC) (void);
-
-#define glBlendBarrierKHR GLEW_GET_FUN(__glewBlendBarrierKHR)
-
-#define GLEW_KHR_blend_equation_advanced GLEW_GET_VAR(__GLEW_KHR_blend_equation_advanced)
-
-#endif /* GL_KHR_blend_equation_advanced */
-
-/* ---------------- GL_KHR_blend_equation_advanced_coherent ---------------- */
-
-#ifndef GL_KHR_blend_equation_advanced_coherent
-#define GL_KHR_blend_equation_advanced_coherent 1
-
-#define GLEW_KHR_blend_equation_advanced_coherent GLEW_GET_VAR(__GLEW_KHR_blend_equation_advanced_coherent)
-
-#endif /* GL_KHR_blend_equation_advanced_coherent */
-
-/* ---------------------- GL_KHR_context_flush_control --------------------- */
-
-#ifndef GL_KHR_context_flush_control
-#define GL_KHR_context_flush_control 1
-
-#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB
-#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC
-
-#define GLEW_KHR_context_flush_control GLEW_GET_VAR(__GLEW_KHR_context_flush_control)
-
-#endif /* GL_KHR_context_flush_control */
-
-/* ------------------------------ GL_KHR_debug ----------------------------- */
-
-#ifndef GL_KHR_debug
-#define GL_KHR_debug 1
-
-#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
-#define GL_STACK_OVERFLOW 0x0503
-#define GL_STACK_UNDERFLOW 0x0504
-#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
-#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
-#define GL_DEBUG_CALLBACK_FUNCTION 0x8244
-#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245
-#define GL_DEBUG_SOURCE_API 0x8246
-#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247
-#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248
-#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249
-#define GL_DEBUG_SOURCE_APPLICATION 0x824A
-#define GL_DEBUG_SOURCE_OTHER 0x824B
-#define GL_DEBUG_TYPE_ERROR 0x824C
-#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
-#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
-#define GL_DEBUG_TYPE_PORTABILITY 0x824F
-#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
-#define GL_DEBUG_TYPE_OTHER 0x8251
-#define GL_DEBUG_TYPE_MARKER 0x8268
-#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269
-#define GL_DEBUG_TYPE_POP_GROUP 0x826A
-#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
-#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C
-#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D
-#define GL_BUFFER 0x82E0
-#define GL_SHADER 0x82E1
-#define GL_PROGRAM 0x82E2
-#define GL_QUERY 0x82E3
-#define GL_PROGRAM_PIPELINE 0x82E4
-#define GL_SAMPLER 0x82E6
-#define GL_DISPLAY_LIST 0x82E7
-#define GL_MAX_LABEL_LENGTH 0x82E8
-#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143
-#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144
-#define GL_DEBUG_LOGGED_MESSAGES 0x9145
-#define GL_DEBUG_SEVERITY_HIGH 0x9146
-#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
-#define GL_DEBUG_SEVERITY_LOW 0x9148
-#define GL_DEBUG_OUTPUT 0x92E0
-
-typedef void (GLAPIENTRY *GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam);
-
-typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
-typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);
-typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf);
-typedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog);
-typedef void (GLAPIENTRY * PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar *label);
-typedef void (GLAPIENTRY * PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei* length, GLchar *label);
-typedef void (GLAPIENTRY * PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar* label);
-typedef void (GLAPIENTRY * PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar* label);
-typedef void (GLAPIENTRY * PFNGLPOPDEBUGGROUPPROC) (void);
-typedef void (GLAPIENTRY * PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar * message);
-
-#define glDebugMessageCallback GLEW_GET_FUN(__glewDebugMessageCallback)
-#define glDebugMessageControl GLEW_GET_FUN(__glewDebugMessageControl)
-#define glDebugMessageInsert GLEW_GET_FUN(__glewDebugMessageInsert)
-#define glGetDebugMessageLog GLEW_GET_FUN(__glewGetDebugMessageLog)
-#define glGetObjectLabel GLEW_GET_FUN(__glewGetObjectLabel)
-#define glGetObjectPtrLabel GLEW_GET_FUN(__glewGetObjectPtrLabel)
-#define glObjectLabel GLEW_GET_FUN(__glewObjectLabel)
-#define glObjectPtrLabel GLEW_GET_FUN(__glewObjectPtrLabel)
-#define glPopDebugGroup GLEW_GET_FUN(__glewPopDebugGroup)
-#define glPushDebugGroup GLEW_GET_FUN(__glewPushDebugGroup)
-
-#define GLEW_KHR_debug GLEW_GET_VAR(__GLEW_KHR_debug)
-
-#endif /* GL_KHR_debug */
-
-/* ------------------ GL_KHR_robust_buffer_access_behavior ----------------- */
-
-#ifndef GL_KHR_robust_buffer_access_behavior
-#define GL_KHR_robust_buffer_access_behavior 1
-
-#define GLEW_KHR_robust_buffer_access_behavior GLEW_GET_VAR(__GLEW_KHR_robust_buffer_access_behavior)
-
-#endif /* GL_KHR_robust_buffer_access_behavior */
-
-/* --------------------------- GL_KHR_robustness --------------------------- */
-
-#ifndef GL_KHR_robustness
-#define GL_KHR_robustness 1
-
-#define GL_CONTEXT_LOST 0x0507
-#define GL_LOSE_CONTEXT_ON_RESET 0x8252
-#define GL_GUILTY_CONTEXT_RESET 0x8253
-#define GL_INNOCENT_CONTEXT_RESET 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET 0x8255
-#define GL_RESET_NOTIFICATION_STRATEGY 0x8256
-#define GL_NO_RESET_NOTIFICATION 0x8261
-#define GL_CONTEXT_ROBUST_ACCESS 0x90F3
-
-typedef void (GLAPIENTRY * PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-
-#define glGetnUniformfv GLEW_GET_FUN(__glewGetnUniformfv)
-#define glGetnUniformiv GLEW_GET_FUN(__glewGetnUniformiv)
-#define glGetnUniformuiv GLEW_GET_FUN(__glewGetnUniformuiv)
-#define glReadnPixels GLEW_GET_FUN(__glewReadnPixels)
-
-#define GLEW_KHR_robustness GLEW_GET_VAR(__GLEW_KHR_robustness)
-
-#endif /* GL_KHR_robustness */
-
-/* ------------------ GL_KHR_texture_compression_astc_hdr ------------------ */
-
-#ifndef GL_KHR_texture_compression_astc_hdr
-#define GL_KHR_texture_compression_astc_hdr 1
-
-#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
-#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
-#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
-#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
-#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
-#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
-#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
-#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
-#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
-#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
-#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
-#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
-#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
-#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
-
-#define GLEW_KHR_texture_compression_astc_hdr GLEW_GET_VAR(__GLEW_KHR_texture_compression_astc_hdr)
-
-#endif /* GL_KHR_texture_compression_astc_hdr */
-
-/* ------------------ GL_KHR_texture_compression_astc_ldr ------------------ */
-
-#ifndef GL_KHR_texture_compression_astc_ldr
-#define GL_KHR_texture_compression_astc_ldr 1
-
-#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
-#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
-#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
-#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
-#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
-#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
-#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
-#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
-#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
-#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
-#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
-#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
-#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
-#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
-
-#define GLEW_KHR_texture_compression_astc_ldr GLEW_GET_VAR(__GLEW_KHR_texture_compression_astc_ldr)
-
-#endif /* GL_KHR_texture_compression_astc_ldr */
-
-/* -------------------------- GL_KTX_buffer_region ------------------------- */
-
-#ifndef GL_KTX_buffer_region
-#define GL_KTX_buffer_region 1
-
-#define GL_KTX_FRONT_REGION 0x0
-#define GL_KTX_BACK_REGION 0x1
-#define GL_KTX_Z_REGION 0x2
-#define GL_KTX_STENCIL_REGION 0x3
-
-typedef GLuint (GLAPIENTRY * PFNGLBUFFERREGIONENABLEDPROC) (void);
-typedef void (GLAPIENTRY * PFNGLDELETEBUFFERREGIONPROC) (GLenum region);
-typedef void (GLAPIENTRY * PFNGLDRAWBUFFERREGIONPROC) (GLuint region, GLint x, GLint y, GLsizei width, GLsizei height, GLint xDest, GLint yDest);
-typedef GLuint (GLAPIENTRY * PFNGLNEWBUFFERREGIONPROC) (GLenum region);
-typedef void (GLAPIENTRY * PFNGLREADBUFFERREGIONPROC) (GLuint region, GLint x, GLint y, GLsizei width, GLsizei height);
-
-#define glBufferRegionEnabled GLEW_GET_FUN(__glewBufferRegionEnabled)
-#define glDeleteBufferRegion GLEW_GET_FUN(__glewDeleteBufferRegion)
-#define glDrawBufferRegion GLEW_GET_FUN(__glewDrawBufferRegion)
-#define glNewBufferRegion GLEW_GET_FUN(__glewNewBufferRegion)
-#define glReadBufferRegion GLEW_GET_FUN(__glewReadBufferRegion)
-
-#define GLEW_KTX_buffer_region GLEW_GET_VAR(__GLEW_KTX_buffer_region)
-
-#endif /* GL_KTX_buffer_region */
-
-/* ------------------------- GL_MESAX_texture_stack ------------------------ */
-
-#ifndef GL_MESAX_texture_stack
-#define GL_MESAX_texture_stack 1
-
-#define GL_TEXTURE_1D_STACK_MESAX 0x8759
-#define GL_TEXTURE_2D_STACK_MESAX 0x875A
-#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B
-#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C
-#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D
-#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E
-
-#define GLEW_MESAX_texture_stack GLEW_GET_VAR(__GLEW_MESAX_texture_stack)
-
-#endif /* GL_MESAX_texture_stack */
-
-/* -------------------------- GL_MESA_pack_invert -------------------------- */
-
-#ifndef GL_MESA_pack_invert
-#define GL_MESA_pack_invert 1
-
-#define GL_PACK_INVERT_MESA 0x8758
-
-#define GLEW_MESA_pack_invert GLEW_GET_VAR(__GLEW_MESA_pack_invert)
-
-#endif /* GL_MESA_pack_invert */
-
-/* ------------------------- GL_MESA_resize_buffers ------------------------ */
-
-#ifndef GL_MESA_resize_buffers
-#define GL_MESA_resize_buffers 1
-
-typedef void (GLAPIENTRY * PFNGLRESIZEBUFFERSMESAPROC) (void);
-
-#define glResizeBuffersMESA GLEW_GET_FUN(__glewResizeBuffersMESA)
-
-#define GLEW_MESA_resize_buffers GLEW_GET_VAR(__GLEW_MESA_resize_buffers)
-
-#endif /* GL_MESA_resize_buffers */
-
-/* --------------------------- GL_MESA_window_pos -------------------------- */
-
-#ifndef GL_MESA_window_pos
-#define GL_MESA_window_pos 1
-
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVMESAPROC) (const GLint* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVMESAPROC) (const GLshort* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVMESAPROC) (const GLint* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVMESAPROC) (const GLshort* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS4IVMESAPROC) (const GLint* p);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (GLAPIENTRY * PFNGLWINDOWPOS4SVMESAPROC) (const GLshort* p);
-
-#define glWindowPos2dMESA GLEW_GET_FUN(__glewWindowPos2dMESA)
-#define glWindowPos2dvMESA GLEW_GET_FUN(__glewWindowPos2dvMESA)
-#define glWindowPos2fMESA GLEW_GET_FUN(__glewWindowPos2fMESA)
-#define glWindowPos2fvMESA GLEW_GET_FUN(__glewWindowPos2fvMESA)
-#define glWindowPos2iMESA GLEW_GET_FUN(__glewWindowPos2iMESA)
-#define glWindowPos2ivMESA GLEW_GET_FUN(__glewWindowPos2ivMESA)
-#define glWindowPos2sMESA GLEW_GET_FUN(__glewWindowPos2sMESA)
-#define glWindowPos2svMESA GLEW_GET_FUN(__glewWindowPos2svMESA)
-#define glWindowPos3dMESA GLEW_GET_FUN(__glewWindowPos3dMESA)
-#define glWindowPos3dvMESA GLEW_GET_FUN(__glewWindowPos3dvMESA)
-#define glWindowPos3fMESA GLEW_GET_FUN(__glewWindowPos3fMESA)
-#define glWindowPos3fvMESA GLEW_GET_FUN(__glewWindowPos3fvMESA)
-#define glWindowPos3iMESA GLEW_GET_FUN(__glewWindowPos3iMESA)
-#define glWindowPos3ivMESA GLEW_GET_FUN(__glewWindowPos3ivMESA)
-#define glWindowPos3sMESA GLEW_GET_FUN(__glewWindowPos3sMESA)
-#define glWindowPos3svMESA GLEW_GET_FUN(__glewWindowPos3svMESA)
-#define glWindowPos4dMESA GLEW_GET_FUN(__glewWindowPos4dMESA)
-#define glWindowPos4dvMESA GLEW_GET_FUN(__glewWindowPos4dvMESA)
-#define glWindowPos4fMESA GLEW_GET_FUN(__glewWindowPos4fMESA)
-#define glWindowPos4fvMESA GLEW_GET_FUN(__glewWindowPos4fvMESA)
-#define glWindowPos4iMESA GLEW_GET_FUN(__glewWindowPos4iMESA)
-#define glWindowPos4ivMESA GLEW_GET_FUN(__glewWindowPos4ivMESA)
-#define glWindowPos4sMESA GLEW_GET_FUN(__glewWindowPos4sMESA)
-#define glWindowPos4svMESA GLEW_GET_FUN(__glewWindowPos4svMESA)
-
-#define GLEW_MESA_window_pos GLEW_GET_VAR(__GLEW_MESA_window_pos)
-
-#endif /* GL_MESA_window_pos */
-
-/* ------------------------- GL_MESA_ycbcr_texture ------------------------- */
-
-#ifndef GL_MESA_ycbcr_texture
-#define GL_MESA_ycbcr_texture 1
-
-#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB
-#define GL_YCBCR_MESA 0x8757
-
-#define GLEW_MESA_ycbcr_texture GLEW_GET_VAR(__GLEW_MESA_ycbcr_texture)
-
-#endif /* GL_MESA_ycbcr_texture */
-
-/* ----------------------- GL_NVX_conditional_render ----------------------- */
-
-#ifndef GL_NVX_conditional_render
-#define GL_NVX_conditional_render 1
-
-typedef void (GLAPIENTRY * PFNGLBEGINCONDITIONALRENDERNVXPROC) (GLuint id);
-typedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERNVXPROC) (void);
-
-#define glBeginConditionalRenderNVX GLEW_GET_FUN(__glewBeginConditionalRenderNVX)
-#define glEndConditionalRenderNVX GLEW_GET_FUN(__glewEndConditionalRenderNVX)
-
-#define GLEW_NVX_conditional_render GLEW_GET_VAR(__GLEW_NVX_conditional_render)
-
-#endif /* GL_NVX_conditional_render */
-
-/* ------------------------- GL_NVX_gpu_memory_info ------------------------ */
-
-#ifndef GL_NVX_gpu_memory_info
-#define GL_NVX_gpu_memory_info 1
-
-#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
-#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
-#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
-#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
-#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
-
-#define GLEW_NVX_gpu_memory_info GLEW_GET_VAR(__GLEW_NVX_gpu_memory_info)
-
-#endif /* GL_NVX_gpu_memory_info */
-
-/* ------------------- GL_NV_bindless_multi_draw_indirect ------------------ */
-
-#ifndef GL_NV_bindless_multi_draw_indirect
-#define GL_NV_bindless_multi_draw_indirect 1
-
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
-
-#define glMultiDrawArraysIndirectBindlessNV GLEW_GET_FUN(__glewMultiDrawArraysIndirectBindlessNV)
-#define glMultiDrawElementsIndirectBindlessNV GLEW_GET_FUN(__glewMultiDrawElementsIndirectBindlessNV)
-
-#define GLEW_NV_bindless_multi_draw_indirect GLEW_GET_VAR(__GLEW_NV_bindless_multi_draw_indirect)
-
-#endif /* GL_NV_bindless_multi_draw_indirect */
-
-/* ---------------- GL_NV_bindless_multi_draw_indirect_count --------------- */
-
-#ifndef GL_NV_bindless_multi_draw_indirect_count
-#define GL_NV_bindless_multi_draw_indirect_count 1
-
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, const void *indirect, GLintptr drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount);
-typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, GLenum type, const void *indirect, GLintptr drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount);
-
-#define glMultiDrawArraysIndirectBindlessCountNV GLEW_GET_FUN(__glewMultiDrawArraysIndirectBindlessCountNV)
-#define glMultiDrawElementsIndirectBindlessCountNV GLEW_GET_FUN(__glewMultiDrawElementsIndirectBindlessCountNV)
-
-#define GLEW_NV_bindless_multi_draw_indirect_count GLEW_GET_VAR(__GLEW_NV_bindless_multi_draw_indirect_count)
-
-#endif /* GL_NV_bindless_multi_draw_indirect_count */
-
-/* ------------------------- GL_NV_bindless_texture ------------------------ */
-
-#ifndef GL_NV_bindless_texture
-#define GL_NV_bindless_texture 1
-
-typedef GLuint64 (GLAPIENTRY * PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
-typedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture);
-typedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler);
-typedef GLboolean (GLAPIENTRY * PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle);
-typedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
-typedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle);
-typedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access);
-typedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle);
-typedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64* values);
-typedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64* value);
-
-#define glGetImageHandleNV GLEW_GET_FUN(__glewGetImageHandleNV)
-#define glGetTextureHandleNV GLEW_GET_FUN(__glewGetTextureHandleNV)
-#define glGetTextureSamplerHandleNV GLEW_GET_FUN(__glewGetTextureSamplerHandleNV)
-#define glIsImageHandleResidentNV GLEW_GET_FUN(__glewIsImageHandleResidentNV)
-#define glIsTextureHandleResidentNV GLEW_GET_FUN(__glewIsTextureHandleResidentNV)
-#define glMakeImageHandleNonResidentNV GLEW_GET_FUN(__glewMakeImageHandleNonResidentNV)
-#define glMakeImageHandleResidentNV GLEW_GET_FUN(__glewMakeImageHandleResidentNV)
-#define glMakeTextureHandleNonResidentNV GLEW_GET_FUN(__glewMakeTextureHandleNonResidentNV)
-#define glMakeTextureHandleResidentNV GLEW_GET_FUN(__glewMakeTextureHandleResidentNV)
-#define glProgramUniformHandleui64NV GLEW_GET_FUN(__glewProgramUniformHandleui64NV)
-#define glProgramUniformHandleui64vNV GLEW_GET_FUN(__glewProgramUniformHandleui64vNV)
-#define glUniformHandleui64NV GLEW_GET_FUN(__glewUniformHandleui64NV)
-#define glUniformHandleui64vNV GLEW_GET_FUN(__glewUniformHandleui64vNV)
-
-#define GLEW_NV_bindless_texture GLEW_GET_VAR(__GLEW_NV_bindless_texture)
-
-#endif /* GL_NV_bindless_texture */
-
-/* --------------------- GL_NV_blend_equation_advanced --------------------- */
-
-#ifndef GL_NV_blend_equation_advanced
-#define GL_NV_blend_equation_advanced 1
-
-#define GL_XOR_NV 0x1506
-#define GL_RED_NV 0x1903
-#define GL_GREEN_NV 0x1904
-#define GL_BLUE_NV 0x1905
-#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280
-#define GL_BLEND_OVERLAP_NV 0x9281
-#define GL_UNCORRELATED_NV 0x9282
-#define GL_DISJOINT_NV 0x9283
-#define GL_CONJOINT_NV 0x9284
-#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285
-#define GL_SRC_NV 0x9286
-#define GL_DST_NV 0x9287
-#define GL_SRC_OVER_NV 0x9288
-#define GL_DST_OVER_NV 0x9289
-#define GL_SRC_IN_NV 0x928A
-#define GL_DST_IN_NV 0x928B
-#define GL_SRC_OUT_NV 0x928C
-#define GL_DST_OUT_NV 0x928D
-#define GL_SRC_ATOP_NV 0x928E
-#define GL_DST_ATOP_NV 0x928F
-#define GL_PLUS_NV 0x9291
-#define GL_PLUS_DARKER_NV 0x9292
-#define GL_MULTIPLY_NV 0x9294
-#define GL_SCREEN_NV 0x9295
-#define GL_OVERLAY_NV 0x9296
-#define GL_DARKEN_NV 0x9297
-#define GL_LIGHTEN_NV 0x9298
-#define GL_COLORDODGE_NV 0x9299
-#define GL_COLORBURN_NV 0x929A
-#define GL_HARDLIGHT_NV 0x929B
-#define GL_SOFTLIGHT_NV 0x929C
-#define GL_DIFFERENCE_NV 0x929E
-#define GL_MINUS_NV 0x929F
-#define GL_EXCLUSION_NV 0x92A0
-#define GL_CONTRAST_NV 0x92A1
-#define GL_INVERT_RGB_NV 0x92A3
-#define GL_LINEARDODGE_NV 0x92A4
-#define GL_LINEARBURN_NV 0x92A5
-#define GL_VIVIDLIGHT_NV 0x92A6
-#define GL_LINEARLIGHT_NV 0x92A7
-#define GL_PINLIGHT_NV 0x92A8
-#define GL_HARDMIX_NV 0x92A9
-#define GL_HSL_HUE_NV 0x92AD
-#define GL_HSL_SATURATION_NV 0x92AE
-#define GL_HSL_COLOR_NV 0x92AF
-#define GL_HSL_LUMINOSITY_NV 0x92B0
-#define GL_PLUS_CLAMPED_NV 0x92B1
-#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2
-#define GL_MINUS_CLAMPED_NV 0x92B3
-#define GL_INVERT_OVG_NV 0x92B4
-
-typedef void (GLAPIENTRY * PFNGLBLENDBARRIERNVPROC) (void);
-typedef void (GLAPIENTRY * PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value);
-
-#define glBlendBarrierNV GLEW_GET_FUN(__glewBlendBarrierNV)
-#define glBlendParameteriNV GLEW_GET_FUN(__glewBlendParameteriNV)
-
-#define GLEW_NV_blend_equation_advanced GLEW_GET_VAR(__GLEW_NV_blend_equation_advanced)
-
-#endif /* GL_NV_blend_equation_advanced */
-
-/* ----------------- GL_NV_blend_equation_advanced_coherent ---------------- */
-
-#ifndef GL_NV_blend_equation_advanced_coherent
-#define GL_NV_blend_equation_advanced_coherent 1
-
-#define GLEW_NV_blend_equation_advanced_coherent GLEW_GET_VAR(__GLEW_NV_blend_equation_advanced_coherent)
-
-#endif /* GL_NV_blend_equation_advanced_coherent */
-
-/* --------------------------- GL_NV_blend_square -------------------------- */
-
-#ifndef GL_NV_blend_square
-#define GL_NV_blend_square 1
-
-#define GLEW_NV_blend_square GLEW_GET_VAR(__GLEW_NV_blend_square)
-
-#endif /* GL_NV_blend_square */
-
-/* ------------------------- GL_NV_compute_program5 ------------------------ */
-
-#ifndef GL_NV_compute_program5
-#define GL_NV_compute_program5 1
-
-#define GL_COMPUTE_PROGRAM_NV 0x90FB
-#define GL_COMPUTE_PROGRAM_PARAMETER_BUFFER_NV 0x90FC
-
-#define GLEW_NV_compute_program5 GLEW_GET_VAR(__GLEW_NV_compute_program5)
-
-#endif /* GL_NV_compute_program5 */
-
-/* ------------------------ GL_NV_conditional_render ----------------------- */
-
-#ifndef GL_NV_conditional_render
-#define GL_NV_conditional_render 1
-
-#define GL_QUERY_WAIT_NV 0x8E13
-#define GL_QUERY_NO_WAIT_NV 0x8E14
-#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15
-#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16
-
-typedef void (GLAPIENTRY * PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);
-typedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERNVPROC) (void);
-
-#define glBeginConditionalRenderNV GLEW_GET_FUN(__glewBeginConditionalRenderNV)
-#define glEndConditionalRenderNV GLEW_GET_FUN(__glewEndConditionalRenderNV)
-
-#define GLEW_NV_conditional_render GLEW_GET_VAR(__GLEW_NV_conditional_render)
-
-#endif /* GL_NV_conditional_render */
-
-/* ----------------------- GL_NV_conservative_raster ----------------------- */
-
-#ifndef GL_NV_conservative_raster
-#define GL_NV_conservative_raster 1
-
-#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346
-#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347
-#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348
-#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349
-
-typedef void (GLAPIENTRY * PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits);
-
-#define glSubpixelPrecisionBiasNV GLEW_GET_FUN(__glewSubpixelPrecisionBiasNV)
-
-#define GLEW_NV_conservative_raster GLEW_GET_VAR(__GLEW_NV_conservative_raster)
-
-#endif /* GL_NV_conservative_raster */
-
-/* ----------------------- GL_NV_copy_depth_to_color ----------------------- */
-
-#ifndef GL_NV_copy_depth_to_color
-#define GL_NV_copy_depth_to_color 1
-
-#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E
-#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F
-
-#define GLEW_NV_copy_depth_to_color GLEW_GET_VAR(__GLEW_NV_copy_depth_to_color)
-
-#endif /* GL_NV_copy_depth_to_color */
-
-/* ---------------------------- GL_NV_copy_image --------------------------- */
-
-#ifndef GL_NV_copy_image
-#define GL_NV_copy_image 1
-
-typedef void (GLAPIENTRY * PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
-
-#define glCopyImageSubDataNV GLEW_GET_FUN(__glewCopyImageSubDataNV)
-
-#define GLEW_NV_copy_image GLEW_GET_VAR(__GLEW_NV_copy_image)
-
-#endif /* GL_NV_copy_image */
-
-/* -------------------------- GL_NV_deep_texture3D ------------------------- */
-
-#ifndef GL_NV_deep_texture3D
-#define GL_NV_deep_texture3D 1
-
-#define GL_MAX_DEEP_3D_TEXTURE_WIDTH_HEIGHT_NV 0x90D0
-#define GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV 0x90D1
-
-#define GLEW_NV_deep_texture3D GLEW_GET_VAR(__GLEW_NV_deep_texture3D)
-
-#endif /* GL_NV_deep_texture3D */
-
-/* ------------------------ GL_NV_depth_buffer_float ----------------------- */
-
-#ifndef GL_NV_depth_buffer_float
-#define GL_NV_depth_buffer_float 1
-
-#define GL_DEPTH_COMPONENT32F_NV 0x8DAB
-#define GL_DEPTH32F_STENCIL8_NV 0x8DAC
-#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD
-#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF
-
-typedef void (GLAPIENTRY * PFNGLCLEARDEPTHDNVPROC) (GLdouble depth);
-typedef void (GLAPIENTRY * PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax);
-typedef void (GLAPIENTRY * PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar);
-
-#define glClearDepthdNV GLEW_GET_FUN(__glewClearDepthdNV)
-#define glDepthBoundsdNV GLEW_GET_FUN(__glewDepthBoundsdNV)
-#define glDepthRangedNV GLEW_GET_FUN(__glewDepthRangedNV)
-
-#define GLEW_NV_depth_buffer_float GLEW_GET_VAR(__GLEW_NV_depth_buffer_float)
-
-#endif /* GL_NV_depth_buffer_float */
-
-/* --------------------------- GL_NV_depth_clamp --------------------------- */
-
-#ifndef GL_NV_depth_clamp
-#define GL_NV_depth_clamp 1
-
-#define GL_DEPTH_CLAMP_NV 0x864F
-
-#define GLEW_NV_depth_clamp GLEW_GET_VAR(__GLEW_NV_depth_clamp)
-
-#endif /* GL_NV_depth_clamp */
-
-/* ---------------------- GL_NV_depth_range_unclamped ---------------------- */
-
-#ifndef GL_NV_depth_range_unclamped
-#define GL_NV_depth_range_unclamped 1
-
-#define GL_SAMPLE_COUNT_BITS_NV 0x8864
-#define GL_CURRENT_SAMPLE_COUNT_QUERY_NV 0x8865
-#define GL_QUERY_RESULT_NV 0x8866
-#define GL_QUERY_RESULT_AVAILABLE_NV 0x8867
-#define GL_SAMPLE_COUNT_NV 0x8914
-
-#define GLEW_NV_depth_range_unclamped GLEW_GET_VAR(__GLEW_NV_depth_range_unclamped)
-
-#endif /* GL_NV_depth_range_unclamped */
-
-/* --------------------------- GL_NV_draw_texture -------------------------- */
-
-#ifndef GL_NV_draw_texture
-#define GL_NV_draw_texture 1
-
-typedef void (GLAPIENTRY * PFNGLDRAWTEXTURENVPROC) (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
-
-#define glDrawTextureNV GLEW_GET_FUN(__glewDrawTextureNV)
-
-#define GLEW_NV_draw_texture GLEW_GET_VAR(__GLEW_NV_draw_texture)
-
-#endif /* GL_NV_draw_texture */
-
-/* ---------------------------- GL_NV_evaluators --------------------------- */
-
-#ifndef GL_NV_evaluators
-#define GL_NV_evaluators 1
-
-#define GL_EVAL_2D_NV 0x86C0
-#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1
-#define GL_MAP_TESSELLATION_NV 0x86C2
-#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3
-#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4
-#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5
-#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6
-#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7
-#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8
-#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9
-#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA
-#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB
-#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC
-#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD
-#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE
-#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF
-#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0
-#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1
-#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2
-#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3
-#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4
-#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5
-#define GL_MAX_MAP_TESSELLATION_NV 0x86D6
-#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7
-
-typedef void (GLAPIENTRY * PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode);
-typedef void (GLAPIENTRY * PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void *points);
-typedef void (GLAPIENTRY * PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points);
-typedef void (GLAPIENTRY * PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint* params);
-
-#define glEvalMapsNV GLEW_GET_FUN(__glewEvalMapsNV)
-#define glGetMapAttribParameterfvNV GLEW_GET_FUN(__glewGetMapAttribParameterfvNV)
-#define glGetMapAttribParameterivNV GLEW_GET_FUN(__glewGetMapAttribParameterivNV)
-#define glGetMapControlPointsNV GLEW_GET_FUN(__glewGetMapControlPointsNV)
-#define glGetMapParameterfvNV GLEW_GET_FUN(__glewGetMapParameterfvNV)
-#define glGetMapParameterivNV GLEW_GET_FUN(__glewGetMapParameterivNV)
-#define glMapControlPointsNV GLEW_GET_FUN(__glewMapControlPointsNV)
-#define glMapParameterfvNV GLEW_GET_FUN(__glewMapParameterfvNV)
-#define glMapParameterivNV GLEW_GET_FUN(__glewMapParameterivNV)
-
-#define GLEW_NV_evaluators GLEW_GET_VAR(__GLEW_NV_evaluators)
-
-#endif /* GL_NV_evaluators */
-
-/* ----------------------- GL_NV_explicit_multisample ---------------------- */
-
-#ifndef GL_NV_explicit_multisample
-#define GL_NV_explicit_multisample 1
-
-#define GL_SAMPLE_POSITION_NV 0x8E50
-#define GL_SAMPLE_MASK_NV 0x8E51
-#define GL_SAMPLE_MASK_VALUE_NV 0x8E52
-#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53
-#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54
-#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55
-#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56
-#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57
-#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58
-#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59
-
-typedef void (GLAPIENTRY * PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat* val);
-typedef void (GLAPIENTRY * PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask);
-typedef void (GLAPIENTRY * PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer);
-
-#define glGetMultisamplefvNV GLEW_GET_FUN(__glewGetMultisamplefvNV)
-#define glSampleMaskIndexedNV GLEW_GET_FUN(__glewSampleMaskIndexedNV)
-#define glTexRenderbufferNV GLEW_GET_FUN(__glewTexRenderbufferNV)
-
-#define GLEW_NV_explicit_multisample GLEW_GET_VAR(__GLEW_NV_explicit_multisample)
-
-#endif /* GL_NV_explicit_multisample */
-
-/* ------------------------------ GL_NV_fence ------------------------------ */
-
-#ifndef GL_NV_fence
-#define GL_NV_fence 1
-
-#define GL_ALL_COMPLETED_NV 0x84F2
-#define GL_FENCE_STATUS_NV 0x84F3
-#define GL_FENCE_CONDITION_NV 0x84F4
-
-typedef void (GLAPIENTRY * PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint* fences);
-typedef void (GLAPIENTRY * PFNGLFINISHFENCENVPROC) (GLuint fence);
-typedef void (GLAPIENTRY * PFNGLGENFENCESNVPROC) (GLsizei n, GLuint* fences);
-typedef void (GLAPIENTRY * PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISFENCENVPROC) (GLuint fence);
-typedef void (GLAPIENTRY * PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
-typedef GLboolean (GLAPIENTRY * PFNGLTESTFENCENVPROC) (GLuint fence);
-
-#define glDeleteFencesNV GLEW_GET_FUN(__glewDeleteFencesNV)
-#define glFinishFenceNV GLEW_GET_FUN(__glewFinishFenceNV)
-#define glGenFencesNV GLEW_GET_FUN(__glewGenFencesNV)
-#define glGetFenceivNV GLEW_GET_FUN(__glewGetFenceivNV)
-#define glIsFenceNV GLEW_GET_FUN(__glewIsFenceNV)
-#define glSetFenceNV GLEW_GET_FUN(__glewSetFenceNV)
-#define glTestFenceNV GLEW_GET_FUN(__glewTestFenceNV)
-
-#define GLEW_NV_fence GLEW_GET_VAR(__GLEW_NV_fence)
-
-#endif /* GL_NV_fence */
-
-/* -------------------------- GL_NV_fill_rectangle ------------------------- */
-
-#ifndef GL_NV_fill_rectangle
-#define GL_NV_fill_rectangle 1
-
-#define GL_FILL_RECTANGLE_NV 0x933C
-
-#define GLEW_NV_fill_rectangle GLEW_GET_VAR(__GLEW_NV_fill_rectangle)
-
-#endif /* GL_NV_fill_rectangle */
-
-/* --------------------------- GL_NV_float_buffer -------------------------- */
-
-#ifndef GL_NV_float_buffer
-#define GL_NV_float_buffer 1
-
-#define GL_FLOAT_R_NV 0x8880
-#define GL_FLOAT_RG_NV 0x8881
-#define GL_FLOAT_RGB_NV 0x8882
-#define GL_FLOAT_RGBA_NV 0x8883
-#define GL_FLOAT_R16_NV 0x8884
-#define GL_FLOAT_R32_NV 0x8885
-#define GL_FLOAT_RG16_NV 0x8886
-#define GL_FLOAT_RG32_NV 0x8887
-#define GL_FLOAT_RGB16_NV 0x8888
-#define GL_FLOAT_RGB32_NV 0x8889
-#define GL_FLOAT_RGBA16_NV 0x888A
-#define GL_FLOAT_RGBA32_NV 0x888B
-#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C
-#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D
-#define GL_FLOAT_RGBA_MODE_NV 0x888E
-
-#define GLEW_NV_float_buffer GLEW_GET_VAR(__GLEW_NV_float_buffer)
-
-#endif /* GL_NV_float_buffer */
-
-/* --------------------------- GL_NV_fog_distance -------------------------- */
-
-#ifndef GL_NV_fog_distance
-#define GL_NV_fog_distance 1
-
-#define GL_FOG_DISTANCE_MODE_NV 0x855A
-#define GL_EYE_RADIAL_NV 0x855B
-#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C
-
-#define GLEW_NV_fog_distance GLEW_GET_VAR(__GLEW_NV_fog_distance)
-
-#endif /* GL_NV_fog_distance */
-
-/* -------------------- GL_NV_fragment_coverage_to_color ------------------- */
-
-#ifndef GL_NV_fragment_coverage_to_color
-#define GL_NV_fragment_coverage_to_color 1
-
-#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD
-#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE
-
-typedef void (GLAPIENTRY * PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color);
-
-#define glFragmentCoverageColorNV GLEW_GET_FUN(__glewFragmentCoverageColorNV)
-
-#define GLEW_NV_fragment_coverage_to_color GLEW_GET_VAR(__GLEW_NV_fragment_coverage_to_color)
-
-#endif /* GL_NV_fragment_coverage_to_color */
-
-/* ------------------------- GL_NV_fragment_program ------------------------ */
-
-#ifndef GL_NV_fragment_program
-#define GL_NV_fragment_program 1
-
-#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868
-#define GL_FRAGMENT_PROGRAM_NV 0x8870
-#define GL_MAX_TEXTURE_COORDS_NV 0x8871
-#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872
-#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873
-#define GL_PROGRAM_ERROR_STRING_NV 0x8874
-
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLdouble *params);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLfloat *params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, const GLdouble v[]);
-typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, const GLfloat v[]);
-
-#define glGetProgramNamedParameterdvNV GLEW_GET_FUN(__glewGetProgramNamedParameterdvNV)
-#define glGetProgramNamedParameterfvNV GLEW_GET_FUN(__glewGetProgramNamedParameterfvNV)
-#define glProgramNamedParameter4dNV GLEW_GET_FUN(__glewProgramNamedParameter4dNV)
-#define glProgramNamedParameter4dvNV GLEW_GET_FUN(__glewProgramNamedParameter4dvNV)
-#define glProgramNamedParameter4fNV GLEW_GET_FUN(__glewProgramNamedParameter4fNV)
-#define glProgramNamedParameter4fvNV GLEW_GET_FUN(__glewProgramNamedParameter4fvNV)
-
-#define GLEW_NV_fragment_program GLEW_GET_VAR(__GLEW_NV_fragment_program)
-
-#endif /* GL_NV_fragment_program */
-
-/* ------------------------ GL_NV_fragment_program2 ------------------------ */
-
-#ifndef GL_NV_fragment_program2
-#define GL_NV_fragment_program2 1
-
-#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4
-#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5
-#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6
-#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7
-#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8
-
-#define GLEW_NV_fragment_program2 GLEW_GET_VAR(__GLEW_NV_fragment_program2)
-
-#endif /* GL_NV_fragment_program2 */
-
-/* ------------------------ GL_NV_fragment_program4 ------------------------ */
-
-#ifndef GL_NV_fragment_program4
-#define GL_NV_fragment_program4 1
-
-#define GLEW_NV_fragment_program4 GLEW_GET_VAR(__GLEW_NV_fragment_program4)
-
-#endif /* GL_NV_fragment_program4 */
-
-/* --------------------- GL_NV_fragment_program_option --------------------- */
-
-#ifndef GL_NV_fragment_program_option
-#define GL_NV_fragment_program_option 1
-
-#define GLEW_NV_fragment_program_option GLEW_GET_VAR(__GLEW_NV_fragment_program_option)
-
-#endif /* GL_NV_fragment_program_option */
-
-/* -------------------- GL_NV_fragment_shader_interlock -------------------- */
-
-#ifndef GL_NV_fragment_shader_interlock
-#define GL_NV_fragment_shader_interlock 1
-
-#define GLEW_NV_fragment_shader_interlock GLEW_GET_VAR(__GLEW_NV_fragment_shader_interlock)
-
-#endif /* GL_NV_fragment_shader_interlock */
-
-/* -------------------- GL_NV_framebuffer_mixed_samples -------------------- */
-
-#ifndef GL_NV_framebuffer_mixed_samples
-#define GL_NV_framebuffer_mixed_samples 1
-
-#define GL_COLOR_SAMPLES_NV 0x8E20
-#define GL_RASTER_MULTISAMPLE_EXT 0x9327
-#define GL_RASTER_SAMPLES_EXT 0x9328
-#define GL_MAX_RASTER_SAMPLES_EXT 0x9329
-#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A
-#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B
-#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C
-#define GL_DEPTH_SAMPLES_NV 0x932D
-#define GL_STENCIL_SAMPLES_NV 0x932E
-#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F
-#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330
-#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331
-#define GL_COVERAGE_MODULATION_NV 0x9332
-#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333
-
-#define GLEW_NV_framebuffer_mixed_samples GLEW_GET_VAR(__GLEW_NV_framebuffer_mixed_samples)
-
-#endif /* GL_NV_framebuffer_mixed_samples */
-
-/* ----------------- GL_NV_framebuffer_multisample_coverage ---------------- */
-
-#ifndef GL_NV_framebuffer_multisample_coverage
-#define GL_NV_framebuffer_multisample_coverage 1
-
-#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB
-#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10
-#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11
-#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12
-
-typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
-
-#define glRenderbufferStorageMultisampleCoverageNV GLEW_GET_FUN(__glewRenderbufferStorageMultisampleCoverageNV)
-
-#define GLEW_NV_framebuffer_multisample_coverage GLEW_GET_VAR(__GLEW_NV_framebuffer_multisample_coverage)
-
-#endif /* GL_NV_framebuffer_multisample_coverage */
-
-/* ------------------------ GL_NV_geometry_program4 ------------------------ */
-
-#ifndef GL_NV_geometry_program4
-#define GL_NV_geometry_program4 1
-
-#define GL_GEOMETRY_PROGRAM_NV 0x8C26
-#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27
-#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28
-
-typedef void (GLAPIENTRY * PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit);
-
-#define glProgramVertexLimitNV GLEW_GET_FUN(__glewProgramVertexLimitNV)
-
-#define GLEW_NV_geometry_program4 GLEW_GET_VAR(__GLEW_NV_geometry_program4)
-
-#endif /* GL_NV_geometry_program4 */
-
-/* ------------------------- GL_NV_geometry_shader4 ------------------------ */
-
-#ifndef GL_NV_geometry_shader4
-#define GL_NV_geometry_shader4 1
-
-#define GLEW_NV_geometry_shader4 GLEW_GET_VAR(__GLEW_NV_geometry_shader4)
-
-#endif /* GL_NV_geometry_shader4 */
-
-/* ------------------- GL_NV_geometry_shader_passthrough ------------------- */
-
-#ifndef GL_NV_geometry_shader_passthrough
-#define GL_NV_geometry_shader_passthrough 1
-
-#define GLEW_NV_geometry_shader_passthrough GLEW_GET_VAR(__GLEW_NV_geometry_shader_passthrough)
-
-#endif /* GL_NV_geometry_shader_passthrough */
-
-/* --------------------------- GL_NV_gpu_program4 -------------------------- */
-
-#ifndef GL_NV_gpu_program4
-#define GL_NV_gpu_program4 1
-
-#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904
-#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905
-#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906
-#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907
-#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908
-#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909
-#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5
-#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6
-
-typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);
-
-#define glProgramEnvParameterI4iNV GLEW_GET_FUN(__glewProgramEnvParameterI4iNV)
-#define glProgramEnvParameterI4ivNV GLEW_GET_FUN(__glewProgramEnvParameterI4ivNV)
-#define glProgramEnvParameterI4uiNV GLEW_GET_FUN(__glewProgramEnvParameterI4uiNV)
-#define glProgramEnvParameterI4uivNV GLEW_GET_FUN(__glewProgramEnvParameterI4uivNV)
-#define glProgramEnvParametersI4ivNV GLEW_GET_FUN(__glewProgramEnvParametersI4ivNV)
-#define glProgramEnvParametersI4uivNV GLEW_GET_FUN(__glewProgramEnvParametersI4uivNV)
-#define glProgramLocalParameterI4iNV GLEW_GET_FUN(__glewProgramLocalParameterI4iNV)
-#define glProgramLocalParameterI4ivNV GLEW_GET_FUN(__glewProgramLocalParameterI4ivNV)
-#define glProgramLocalParameterI4uiNV GLEW_GET_FUN(__glewProgramLocalParameterI4uiNV)
-#define glProgramLocalParameterI4uivNV GLEW_GET_FUN(__glewProgramLocalParameterI4uivNV)
-#define glProgramLocalParametersI4ivNV GLEW_GET_FUN(__glewProgramLocalParametersI4ivNV)
-#define glProgramLocalParametersI4uivNV GLEW_GET_FUN(__glewProgramLocalParametersI4uivNV)
-
-#define GLEW_NV_gpu_program4 GLEW_GET_VAR(__GLEW_NV_gpu_program4)
-
-#endif /* GL_NV_gpu_program4 */
-
-/* --------------------------- GL_NV_gpu_program5 -------------------------- */
-
-#ifndef GL_NV_gpu_program5
-#define GL_NV_gpu_program5 1
-
-#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A
-#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B
-#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C
-#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D
-#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F
-
-#define GLEW_NV_gpu_program5 GLEW_GET_VAR(__GLEW_NV_gpu_program5)
-
-#endif /* GL_NV_gpu_program5 */
-
-/* -------------------- GL_NV_gpu_program5_mem_extended -------------------- */
-
-#ifndef GL_NV_gpu_program5_mem_extended
-#define GL_NV_gpu_program5_mem_extended 1
-
-#define GLEW_NV_gpu_program5_mem_extended GLEW_GET_VAR(__GLEW_NV_gpu_program5_mem_extended)
-
-#endif /* GL_NV_gpu_program5_mem_extended */
-
-/* ------------------------- GL_NV_gpu_program_fp64 ------------------------ */
-
-#ifndef GL_NV_gpu_program_fp64
-#define GL_NV_gpu_program_fp64 1
-
-#define GLEW_NV_gpu_program_fp64 GLEW_GET_VAR(__GLEW_NV_gpu_program_fp64)
-
-#endif /* GL_NV_gpu_program_fp64 */
-
-/* --------------------------- GL_NV_gpu_shader5 --------------------------- */
-
-#ifndef GL_NV_gpu_shader5
-#define GL_NV_gpu_shader5 1
-
-#define GL_INT64_NV 0x140E
-#define GL_UNSIGNED_INT64_NV 0x140F
-#define GL_INT8_NV 0x8FE0
-#define GL_INT8_VEC2_NV 0x8FE1
-#define GL_INT8_VEC3_NV 0x8FE2
-#define GL_INT8_VEC4_NV 0x8FE3
-#define GL_INT16_NV 0x8FE4
-#define GL_INT16_VEC2_NV 0x8FE5
-#define GL_INT16_VEC3_NV 0x8FE6
-#define GL_INT16_VEC4_NV 0x8FE7
-#define GL_INT64_VEC2_NV 0x8FE9
-#define GL_INT64_VEC3_NV 0x8FEA
-#define GL_INT64_VEC4_NV 0x8FEB
-#define GL_UNSIGNED_INT8_NV 0x8FEC
-#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED
-#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE
-#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF
-#define GL_UNSIGNED_INT16_NV 0x8FF0
-#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1
-#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2
-#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3
-#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5
-#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6
-#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7
-#define GL_FLOAT16_NV 0x8FF8
-#define GL_FLOAT16_VEC2_NV 0x8FF9
-#define GL_FLOAT16_VEC3_NV 0x8FFA
-#define GL_FLOAT16_VEC4_NV 0x8FFB
-
-typedef void (GLAPIENTRY * PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT* params);
-typedef void (GLAPIENTRY * PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT* params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);
-typedef void (GLAPIENTRY * PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);
-typedef void (GLAPIENTRY * PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-typedef void (GLAPIENTRY * PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-typedef void (GLAPIENTRY * PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);
-
-#define glGetUniformi64vNV GLEW_GET_FUN(__glewGetUniformi64vNV)
-#define glGetUniformui64vNV GLEW_GET_FUN(__glewGetUniformui64vNV)
-#define glProgramUniform1i64NV GLEW_GET_FUN(__glewProgramUniform1i64NV)
-#define glProgramUniform1i64vNV GLEW_GET_FUN(__glewProgramUniform1i64vNV)
-#define glProgramUniform1ui64NV GLEW_GET_FUN(__glewProgramUniform1ui64NV)
-#define glProgramUniform1ui64vNV GLEW_GET_FUN(__glewProgramUniform1ui64vNV)
-#define glProgramUniform2i64NV GLEW_GET_FUN(__glewProgramUniform2i64NV)
-#define glProgramUniform2i64vNV GLEW_GET_FUN(__glewProgramUniform2i64vNV)
-#define glProgramUniform2ui64NV GLEW_GET_FUN(__glewProgramUniform2ui64NV)
-#define glProgramUniform2ui64vNV GLEW_GET_FUN(__glewProgramUniform2ui64vNV)
-#define glProgramUniform3i64NV GLEW_GET_FUN(__glewProgramUniform3i64NV)
-#define glProgramUniform3i64vNV GLEW_GET_FUN(__glewProgramUniform3i64vNV)
-#define glProgramUniform3ui64NV GLEW_GET_FUN(__glewProgramUniform3ui64NV)
-#define glProgramUniform3ui64vNV GLEW_GET_FUN(__glewProgramUniform3ui64vNV)
-#define glProgramUniform4i64NV GLEW_GET_FUN(__glewProgramUniform4i64NV)
-#define glProgramUniform4i64vNV GLEW_GET_FUN(__glewProgramUniform4i64vNV)
-#define glProgramUniform4ui64NV GLEW_GET_FUN(__glewProgramUniform4ui64NV)
-#define glProgramUniform4ui64vNV GLEW_GET_FUN(__glewProgramUniform4ui64vNV)
-#define glUniform1i64NV GLEW_GET_FUN(__glewUniform1i64NV)
-#define glUniform1i64vNV GLEW_GET_FUN(__glewUniform1i64vNV)
-#define glUniform1ui64NV GLEW_GET_FUN(__glewUniform1ui64NV)
-#define glUniform1ui64vNV GLEW_GET_FUN(__glewUniform1ui64vNV)
-#define glUniform2i64NV GLEW_GET_FUN(__glewUniform2i64NV)
-#define glUniform2i64vNV GLEW_GET_FUN(__glewUniform2i64vNV)
-#define glUniform2ui64NV GLEW_GET_FUN(__glewUniform2ui64NV)
-#define glUniform2ui64vNV GLEW_GET_FUN(__glewUniform2ui64vNV)
-#define glUniform3i64NV GLEW_GET_FUN(__glewUniform3i64NV)
-#define glUniform3i64vNV GLEW_GET_FUN(__glewUniform3i64vNV)
-#define glUniform3ui64NV GLEW_GET_FUN(__glewUniform3ui64NV)
-#define glUniform3ui64vNV GLEW_GET_FUN(__glewUniform3ui64vNV)
-#define glUniform4i64NV GLEW_GET_FUN(__glewUniform4i64NV)
-#define glUniform4i64vNV GLEW_GET_FUN(__glewUniform4i64vNV)
-#define glUniform4ui64NV GLEW_GET_FUN(__glewUniform4ui64NV)
-#define glUniform4ui64vNV GLEW_GET_FUN(__glewUniform4ui64vNV)
-
-#define GLEW_NV_gpu_shader5 GLEW_GET_VAR(__GLEW_NV_gpu_shader5)
-
-#endif /* GL_NV_gpu_shader5 */
-
-/* ---------------------------- GL_NV_half_float --------------------------- */
-
-#ifndef GL_NV_half_float
-#define GL_NV_half_float 1
-
-#define GL_HALF_FLOAT_NV 0x140B
-
-typedef unsigned short GLhalf;
-
-typedef void (GLAPIENTRY * PFNGLCOLOR3HNVPROC) (GLhalf red, GLhalf green, GLhalf blue);
-typedef void (GLAPIENTRY * PFNGLCOLOR3HVNVPROC) (const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLCOLOR4HNVPROC) (GLhalf red, GLhalf green, GLhalf blue, GLhalf alpha);
-typedef void (GLAPIENTRY * PFNGLCOLOR4HVNVPROC) (const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDHNVPROC) (GLhalf fog);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDHVNVPROC) (const GLhalf* fog);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalf s);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalf s, GLhalf t);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalf s, GLhalf t, GLhalf r);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalf s, GLhalf t, GLhalf r, GLhalf q);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLNORMAL3HNVPROC) (GLhalf nx, GLhalf ny, GLhalf nz);
-typedef void (GLAPIENTRY * PFNGLNORMAL3HVNVPROC) (const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3HNVPROC) (GLhalf red, GLhalf green, GLhalf blue);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD1HNVPROC) (GLhalf s);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD1HVNVPROC) (const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD2HNVPROC) (GLhalf s, GLhalf t);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD2HVNVPROC) (const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD3HNVPROC) (GLhalf s, GLhalf t, GLhalf r);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD3HVNVPROC) (const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD4HNVPROC) (GLhalf s, GLhalf t, GLhalf r, GLhalf q);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD4HVNVPROC) (const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLVERTEX2HNVPROC) (GLhalf x, GLhalf y);
-typedef void (GLAPIENTRY * PFNGLVERTEX2HVNVPROC) (const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLVERTEX3HNVPROC) (GLhalf x, GLhalf y, GLhalf z);
-typedef void (GLAPIENTRY * PFNGLVERTEX3HVNVPROC) (const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLVERTEX4HNVPROC) (GLhalf x, GLhalf y, GLhalf z, GLhalf w);
-typedef void (GLAPIENTRY * PFNGLVERTEX4HVNVPROC) (const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalf x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalf x, GLhalf y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalf x, GLhalf y, GLhalf z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalf x, GLhalf y, GLhalf z, GLhalf w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTHNVPROC) (GLhalf weight);
-typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalf* weight);
-
-#define glColor3hNV GLEW_GET_FUN(__glewColor3hNV)
-#define glColor3hvNV GLEW_GET_FUN(__glewColor3hvNV)
-#define glColor4hNV GLEW_GET_FUN(__glewColor4hNV)
-#define glColor4hvNV GLEW_GET_FUN(__glewColor4hvNV)
-#define glFogCoordhNV GLEW_GET_FUN(__glewFogCoordhNV)
-#define glFogCoordhvNV GLEW_GET_FUN(__glewFogCoordhvNV)
-#define glMultiTexCoord1hNV GLEW_GET_FUN(__glewMultiTexCoord1hNV)
-#define glMultiTexCoord1hvNV GLEW_GET_FUN(__glewMultiTexCoord1hvNV)
-#define glMultiTexCoord2hNV GLEW_GET_FUN(__glewMultiTexCoord2hNV)
-#define glMultiTexCoord2hvNV GLEW_GET_FUN(__glewMultiTexCoord2hvNV)
-#define glMultiTexCoord3hNV GLEW_GET_FUN(__glewMultiTexCoord3hNV)
-#define glMultiTexCoord3hvNV GLEW_GET_FUN(__glewMultiTexCoord3hvNV)
-#define glMultiTexCoord4hNV GLEW_GET_FUN(__glewMultiTexCoord4hNV)
-#define glMultiTexCoord4hvNV GLEW_GET_FUN(__glewMultiTexCoord4hvNV)
-#define glNormal3hNV GLEW_GET_FUN(__glewNormal3hNV)
-#define glNormal3hvNV GLEW_GET_FUN(__glewNormal3hvNV)
-#define glSecondaryColor3hNV GLEW_GET_FUN(__glewSecondaryColor3hNV)
-#define glSecondaryColor3hvNV GLEW_GET_FUN(__glewSecondaryColor3hvNV)
-#define glTexCoord1hNV GLEW_GET_FUN(__glewTexCoord1hNV)
-#define glTexCoord1hvNV GLEW_GET_FUN(__glewTexCoord1hvNV)
-#define glTexCoord2hNV GLEW_GET_FUN(__glewTexCoord2hNV)
-#define glTexCoord2hvNV GLEW_GET_FUN(__glewTexCoord2hvNV)
-#define glTexCoord3hNV GLEW_GET_FUN(__glewTexCoord3hNV)
-#define glTexCoord3hvNV GLEW_GET_FUN(__glewTexCoord3hvNV)
-#define glTexCoord4hNV GLEW_GET_FUN(__glewTexCoord4hNV)
-#define glTexCoord4hvNV GLEW_GET_FUN(__glewTexCoord4hvNV)
-#define glVertex2hNV GLEW_GET_FUN(__glewVertex2hNV)
-#define glVertex2hvNV GLEW_GET_FUN(__glewVertex2hvNV)
-#define glVertex3hNV GLEW_GET_FUN(__glewVertex3hNV)
-#define glVertex3hvNV GLEW_GET_FUN(__glewVertex3hvNV)
-#define glVertex4hNV GLEW_GET_FUN(__glewVertex4hNV)
-#define glVertex4hvNV GLEW_GET_FUN(__glewVertex4hvNV)
-#define glVertexAttrib1hNV GLEW_GET_FUN(__glewVertexAttrib1hNV)
-#define glVertexAttrib1hvNV GLEW_GET_FUN(__glewVertexAttrib1hvNV)
-#define glVertexAttrib2hNV GLEW_GET_FUN(__glewVertexAttrib2hNV)
-#define glVertexAttrib2hvNV GLEW_GET_FUN(__glewVertexAttrib2hvNV)
-#define glVertexAttrib3hNV GLEW_GET_FUN(__glewVertexAttrib3hNV)
-#define glVertexAttrib3hvNV GLEW_GET_FUN(__glewVertexAttrib3hvNV)
-#define glVertexAttrib4hNV GLEW_GET_FUN(__glewVertexAttrib4hNV)
-#define glVertexAttrib4hvNV GLEW_GET_FUN(__glewVertexAttrib4hvNV)
-#define glVertexAttribs1hvNV GLEW_GET_FUN(__glewVertexAttribs1hvNV)
-#define glVertexAttribs2hvNV GLEW_GET_FUN(__glewVertexAttribs2hvNV)
-#define glVertexAttribs3hvNV GLEW_GET_FUN(__glewVertexAttribs3hvNV)
-#define glVertexAttribs4hvNV GLEW_GET_FUN(__glewVertexAttribs4hvNV)
-#define glVertexWeighthNV GLEW_GET_FUN(__glewVertexWeighthNV)
-#define glVertexWeighthvNV GLEW_GET_FUN(__glewVertexWeighthvNV)
-
-#define GLEW_NV_half_float GLEW_GET_VAR(__GLEW_NV_half_float)
-
-#endif /* GL_NV_half_float */
-
-/* ------------------- GL_NV_internalformat_sample_query ------------------- */
-
-#ifndef GL_NV_internalformat_sample_query
-#define GL_NV_internalformat_sample_query 1
-
-#define GL_MULTISAMPLES_NV 0x9371
-#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372
-#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373
-#define GL_CONFORMANT_NV 0x9374
-
-typedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint* params);
-
-#define glGetInternalformatSampleivNV GLEW_GET_FUN(__glewGetInternalformatSampleivNV)
-
-#define GLEW_NV_internalformat_sample_query GLEW_GET_VAR(__GLEW_NV_internalformat_sample_query)
-
-#endif /* GL_NV_internalformat_sample_query */
-
-/* ------------------------ GL_NV_light_max_exponent ----------------------- */
-
-#ifndef GL_NV_light_max_exponent
-#define GL_NV_light_max_exponent 1
-
-#define GL_MAX_SHININESS_NV 0x8504
-#define GL_MAX_SPOT_EXPONENT_NV 0x8505
-
-#define GLEW_NV_light_max_exponent GLEW_GET_VAR(__GLEW_NV_light_max_exponent)
-
-#endif /* GL_NV_light_max_exponent */
-
-/* ----------------------- GL_NV_multisample_coverage ---------------------- */
-
-#ifndef GL_NV_multisample_coverage
-#define GL_NV_multisample_coverage 1
-
-#define GL_COLOR_SAMPLES_NV 0x8E20
-
-#define GLEW_NV_multisample_coverage GLEW_GET_VAR(__GLEW_NV_multisample_coverage)
-
-#endif /* GL_NV_multisample_coverage */
-
-/* --------------------- GL_NV_multisample_filter_hint --------------------- */
-
-#ifndef GL_NV_multisample_filter_hint
-#define GL_NV_multisample_filter_hint 1
-
-#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534
-
-#define GLEW_NV_multisample_filter_hint GLEW_GET_VAR(__GLEW_NV_multisample_filter_hint)
-
-#endif /* GL_NV_multisample_filter_hint */
-
-/* ------------------------- GL_NV_occlusion_query ------------------------- */
-
-#ifndef GL_NV_occlusion_query
-#define GL_NV_occlusion_query 1
-
-#define GL_PIXEL_COUNTER_BITS_NV 0x8864
-#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865
-#define GL_PIXEL_COUNT_NV 0x8866
-#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867
-
-typedef void (GLAPIENTRY * PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id);
-typedef void (GLAPIENTRY * PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLENDOCCLUSIONQUERYNVPROC) (void);
-typedef void (GLAPIENTRY * PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id);
-
-#define glBeginOcclusionQueryNV GLEW_GET_FUN(__glewBeginOcclusionQueryNV)
-#define glDeleteOcclusionQueriesNV GLEW_GET_FUN(__glewDeleteOcclusionQueriesNV)
-#define glEndOcclusionQueryNV GLEW_GET_FUN(__glewEndOcclusionQueryNV)
-#define glGenOcclusionQueriesNV GLEW_GET_FUN(__glewGenOcclusionQueriesNV)
-#define glGetOcclusionQueryivNV GLEW_GET_FUN(__glewGetOcclusionQueryivNV)
-#define glGetOcclusionQueryuivNV GLEW_GET_FUN(__glewGetOcclusionQueryuivNV)
-#define glIsOcclusionQueryNV GLEW_GET_FUN(__glewIsOcclusionQueryNV)
-
-#define GLEW_NV_occlusion_query GLEW_GET_VAR(__GLEW_NV_occlusion_query)
-
-#endif /* GL_NV_occlusion_query */
-
-/* ----------------------- GL_NV_packed_depth_stencil ---------------------- */
-
-#ifndef GL_NV_packed_depth_stencil
-#define GL_NV_packed_depth_stencil 1
-
-#define GL_DEPTH_STENCIL_NV 0x84F9
-#define GL_UNSIGNED_INT_24_8_NV 0x84FA
-
-#define GLEW_NV_packed_depth_stencil GLEW_GET_VAR(__GLEW_NV_packed_depth_stencil)
-
-#endif /* GL_NV_packed_depth_stencil */
-
-/* --------------------- GL_NV_parameter_buffer_object --------------------- */
-
-#ifndef GL_NV_parameter_buffer_object
-#define GL_NV_parameter_buffer_object 1
-
-#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0
-#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1
-#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2
-#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3
-#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4
-
-typedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params);
-
-#define glProgramBufferParametersIivNV GLEW_GET_FUN(__glewProgramBufferParametersIivNV)
-#define glProgramBufferParametersIuivNV GLEW_GET_FUN(__glewProgramBufferParametersIuivNV)
-#define glProgramBufferParametersfvNV GLEW_GET_FUN(__glewProgramBufferParametersfvNV)
-
-#define GLEW_NV_parameter_buffer_object GLEW_GET_VAR(__GLEW_NV_parameter_buffer_object)
-
-#endif /* GL_NV_parameter_buffer_object */
-
-/* --------------------- GL_NV_parameter_buffer_object2 -------------------- */
-
-#ifndef GL_NV_parameter_buffer_object2
-#define GL_NV_parameter_buffer_object2 1
-
-#define GLEW_NV_parameter_buffer_object2 GLEW_GET_VAR(__GLEW_NV_parameter_buffer_object2)
-
-#endif /* GL_NV_parameter_buffer_object2 */
-
-/* -------------------------- GL_NV_path_rendering ------------------------- */
-
-#ifndef GL_NV_path_rendering
-#define GL_NV_path_rendering 1
-
-#define GL_CLOSE_PATH_NV 0x00
-#define GL_BOLD_BIT_NV 0x01
-#define GL_GLYPH_WIDTH_BIT_NV 0x01
-#define GL_GLYPH_HEIGHT_BIT_NV 0x02
-#define GL_ITALIC_BIT_NV 0x02
-#define GL_MOVE_TO_NV 0x02
-#define GL_RELATIVE_MOVE_TO_NV 0x03
-#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04
-#define GL_LINE_TO_NV 0x04
-#define GL_RELATIVE_LINE_TO_NV 0x05
-#define GL_HORIZONTAL_LINE_TO_NV 0x06
-#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07
-#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08
-#define GL_VERTICAL_LINE_TO_NV 0x08
-#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09
-#define GL_QUADRATIC_CURVE_TO_NV 0x0A
-#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B
-#define GL_CUBIC_CURVE_TO_NV 0x0C
-#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D
-#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E
-#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F
-#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10
-#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10
-#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11
-#define GL_SMALL_CCW_ARC_TO_NV 0x12
-#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13
-#define GL_SMALL_CW_ARC_TO_NV 0x14
-#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15
-#define GL_LARGE_CCW_ARC_TO_NV 0x16
-#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17
-#define GL_LARGE_CW_ARC_TO_NV 0x18
-#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19
-#define GL_CONIC_CURVE_TO_NV 0x1A
-#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B
-#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20
-#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40
-#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80
-#define GL_ROUNDED_RECT_NV 0xE8
-#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9
-#define GL_ROUNDED_RECT2_NV 0xEA
-#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB
-#define GL_ROUNDED_RECT4_NV 0xEC
-#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED
-#define GL_ROUNDED_RECT8_NV 0xEE
-#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF
-#define GL_RESTART_PATH_NV 0xF0
-#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2
-#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4
-#define GL_RECT_NV 0xF6
-#define GL_RELATIVE_RECT_NV 0xF7
-#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8
-#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA
-#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC
-#define GL_ARC_TO_NV 0xFE
-#define GL_RELATIVE_ARC_TO_NV 0xFF
-#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100
-#define GL_PRIMARY_COLOR_NV 0x852C
-#define GL_SECONDARY_COLOR_NV 0x852D
-#define GL_PRIMARY_COLOR 0x8577
-#define GL_PATH_FORMAT_SVG_NV 0x9070
-#define GL_PATH_FORMAT_PS_NV 0x9071
-#define GL_STANDARD_FONT_NAME_NV 0x9072
-#define GL_SYSTEM_FONT_NAME_NV 0x9073
-#define GL_FILE_NAME_NV 0x9074
-#define GL_PATH_STROKE_WIDTH_NV 0x9075
-#define GL_PATH_END_CAPS_NV 0x9076
-#define GL_PATH_INITIAL_END_CAP_NV 0x9077
-#define GL_PATH_TERMINAL_END_CAP_NV 0x9078
-#define GL_PATH_JOIN_STYLE_NV 0x9079
-#define GL_PATH_MITER_LIMIT_NV 0x907A
-#define GL_PATH_DASH_CAPS_NV 0x907B
-#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C
-#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D
-#define GL_PATH_DASH_OFFSET_NV 0x907E
-#define GL_PATH_CLIENT_LENGTH_NV 0x907F
-#define GL_PATH_FILL_MODE_NV 0x9080
-#define GL_PATH_FILL_MASK_NV 0x9081
-#define GL_PATH_FILL_COVER_MODE_NV 0x9082
-#define GL_PATH_STROKE_COVER_MODE_NV 0x9083
-#define GL_PATH_STROKE_MASK_NV 0x9084
-#define GL_PATH_STROKE_BOUND_NV 0x9086
-#define GL_COUNT_UP_NV 0x9088
-#define GL_COUNT_DOWN_NV 0x9089
-#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A
-#define GL_CONVEX_HULL_NV 0x908B
-#define GL_BOUNDING_BOX_NV 0x908D
-#define GL_TRANSLATE_X_NV 0x908E
-#define GL_TRANSLATE_Y_NV 0x908F
-#define GL_TRANSLATE_2D_NV 0x9090
-#define GL_TRANSLATE_3D_NV 0x9091
-#define GL_AFFINE_2D_NV 0x9092
-#define GL_AFFINE_3D_NV 0x9094
-#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096
-#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098
-#define GL_UTF8_NV 0x909A
-#define GL_UTF16_NV 0x909B
-#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C
-#define GL_PATH_COMMAND_COUNT_NV 0x909D
-#define GL_PATH_COORD_COUNT_NV 0x909E
-#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F
-#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0
-#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1
-#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2
-#define GL_SQUARE_NV 0x90A3
-#define GL_ROUND_NV 0x90A4
-#define GL_TRIANGULAR_NV 0x90A5
-#define GL_BEVEL_NV 0x90A6
-#define GL_MITER_REVERT_NV 0x90A7
-#define GL_MITER_TRUNCATE_NV 0x90A8
-#define GL_SKIP_MISSING_GLYPH_NV 0x90A9
-#define GL_USE_MISSING_GLYPH_NV 0x90AA
-#define GL_PATH_ERROR_POSITION_NV 0x90AB
-#define GL_PATH_FOG_GEN_MODE_NV 0x90AC
-#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD
-#define GL_ADJACENT_PAIRS_NV 0x90AE
-#define GL_FIRST_TO_REST_NV 0x90AF
-#define GL_PATH_GEN_MODE_NV 0x90B0
-#define GL_PATH_GEN_COEFF_NV 0x90B1
-#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2
-#define GL_PATH_GEN_COMPONENTS_NV 0x90B3
-#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4
-#define GL_MOVE_TO_RESETS_NV 0x90B5
-#define GL_MOVE_TO_CONTINUES_NV 0x90B6
-#define GL_PATH_STENCIL_FUNC_NV 0x90B7
-#define GL_PATH_STENCIL_REF_NV 0x90B8
-#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9
-#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD
-#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE
-#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF
-#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368
-#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369
-#define GL_FONT_UNAVAILABLE_NV 0x936A
-#define GL_FONT_UNINTELLIGIBLE_NV 0x936B
-#define GL_STANDARD_FONT_FORMAT_NV 0x936C
-#define GL_FRAGMENT_INPUT_NV 0x936D
-#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000
-#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000
-#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000
-#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000
-#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000
-#define GL_FONT_ASCENDER_BIT_NV 0x00200000
-#define GL_FONT_DESCENDER_BIT_NV 0x00400000
-#define GL_FONT_HEIGHT_BIT_NV 0x00800000
-#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000
-#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000
-#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000
-#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000
-#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000
-#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000
-
-typedef void (GLAPIENTRY * PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath);
-typedef void (GLAPIENTRY * PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (GLAPIENTRY * PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode);
-typedef void (GLAPIENTRY * PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (GLAPIENTRY * PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode);
-typedef void (GLAPIENTRY * PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range);
-typedef GLuint (GLAPIENTRY * PFNGLGENPATHSNVPROC) (GLsizei range);
-typedef void (GLAPIENTRY * PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint* value);
-typedef void (GLAPIENTRY * PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte* commands);
-typedef void (GLAPIENTRY * PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat* coords);
-typedef void (GLAPIENTRY * PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat* dashArray);
-typedef GLfloat (GLAPIENTRY * PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments);
-typedef void (GLAPIENTRY * PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat* metrics);
-typedef void (GLAPIENTRY * PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
-typedef void (GLAPIENTRY * PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint* value);
-typedef void (GLAPIENTRY * PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
-typedef void (GLAPIENTRY * PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint* value);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei *length, GLfloat *params);
-typedef void (GLAPIENTRY * PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
-typedef GLboolean (GLAPIENTRY * PFNGLISPATHNVPROC) (GLuint path);
-typedef GLboolean (GLAPIENTRY * PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y);
-typedef GLboolean (GLAPIENTRY * PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y);
-typedef void (GLAPIENTRY * PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat* m);
-typedef void (GLAPIENTRY * PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat* m);
-typedef void (GLAPIENTRY * PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat* coeffs);
-typedef void (GLAPIENTRY * PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte* commands, GLsizei numCoords, GLenum coordType, const void*coords);
-typedef void (GLAPIENTRY * PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (GLAPIENTRY * PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum zfunc);
-typedef void (GLAPIENTRY * PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat* dashArray);
-typedef void (GLAPIENTRY * PFNGLPATHFOGGENNVPROC) (GLenum genMode);
-typedef GLenum (GLAPIENTRY * PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef GLenum (GLAPIENTRY * PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
-typedef void (GLAPIENTRY * PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (GLAPIENTRY * PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void*charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef GLenum (GLAPIENTRY * PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (GLAPIENTRY * PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value);
-typedef void (GLAPIENTRY * PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat* value);
-typedef void (GLAPIENTRY * PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value);
-typedef void (GLAPIENTRY * PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint* value);
-typedef void (GLAPIENTRY * PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units);
-typedef void (GLAPIENTRY * PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask);
-typedef void (GLAPIENTRY * PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString);
-typedef void (GLAPIENTRY * PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte* commands, GLsizei numCoords, GLenum coordType, const void*coords);
-typedef void (GLAPIENTRY * PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (GLAPIENTRY * PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat* coeffs);
-typedef GLboolean (GLAPIENTRY * PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat* x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
-typedef void (GLAPIENTRY * PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat* coeffs);
-typedef void (GLAPIENTRY * PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-typedef void (GLAPIENTRY * PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask);
-typedef void (GLAPIENTRY * PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-typedef void (GLAPIENTRY * PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask);
-typedef void (GLAPIENTRY * PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (GLAPIENTRY * PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
-typedef void (GLAPIENTRY * PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (GLAPIENTRY * PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
-typedef void (GLAPIENTRY * PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat* transformValues);
-typedef void (GLAPIENTRY * PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint paths[], const GLfloat weights[]);
-
-#define glCopyPathNV GLEW_GET_FUN(__glewCopyPathNV)
-#define glCoverFillPathInstancedNV GLEW_GET_FUN(__glewCoverFillPathInstancedNV)
-#define glCoverFillPathNV GLEW_GET_FUN(__glewCoverFillPathNV)
-#define glCoverStrokePathInstancedNV GLEW_GET_FUN(__glewCoverStrokePathInstancedNV)
-#define glCoverStrokePathNV GLEW_GET_FUN(__glewCoverStrokePathNV)
-#define glDeletePathsNV GLEW_GET_FUN(__glewDeletePathsNV)
-#define glGenPathsNV GLEW_GET_FUN(__glewGenPathsNV)
-#define glGetPathColorGenfvNV GLEW_GET_FUN(__glewGetPathColorGenfvNV)
-#define glGetPathColorGenivNV GLEW_GET_FUN(__glewGetPathColorGenivNV)
-#define glGetPathCommandsNV GLEW_GET_FUN(__glewGetPathCommandsNV)
-#define glGetPathCoordsNV GLEW_GET_FUN(__glewGetPathCoordsNV)
-#define glGetPathDashArrayNV GLEW_GET_FUN(__glewGetPathDashArrayNV)
-#define glGetPathLengthNV GLEW_GET_FUN(__glewGetPathLengthNV)
-#define glGetPathMetricRangeNV GLEW_GET_FUN(__glewGetPathMetricRangeNV)
-#define glGetPathMetricsNV GLEW_GET_FUN(__glewGetPathMetricsNV)
-#define glGetPathParameterfvNV GLEW_GET_FUN(__glewGetPathParameterfvNV)
-#define glGetPathParameterivNV GLEW_GET_FUN(__glewGetPathParameterivNV)
-#define glGetPathSpacingNV GLEW_GET_FUN(__glewGetPathSpacingNV)
-#define glGetPathTexGenfvNV GLEW_GET_FUN(__glewGetPathTexGenfvNV)
-#define glGetPathTexGenivNV GLEW_GET_FUN(__glewGetPathTexGenivNV)
-#define glGetProgramResourcefvNV GLEW_GET_FUN(__glewGetProgramResourcefvNV)
-#define glInterpolatePathsNV GLEW_GET_FUN(__glewInterpolatePathsNV)
-#define glIsPathNV GLEW_GET_FUN(__glewIsPathNV)
-#define glIsPointInFillPathNV GLEW_GET_FUN(__glewIsPointInFillPathNV)
-#define glIsPointInStrokePathNV GLEW_GET_FUN(__glewIsPointInStrokePathNV)
-#define glMatrixLoad3x2fNV GLEW_GET_FUN(__glewMatrixLoad3x2fNV)
-#define glMatrixLoad3x3fNV GLEW_GET_FUN(__glewMatrixLoad3x3fNV)
-#define glMatrixLoadTranspose3x3fNV GLEW_GET_FUN(__glewMatrixLoadTranspose3x3fNV)
-#define glMatrixMult3x2fNV GLEW_GET_FUN(__glewMatrixMult3x2fNV)
-#define glMatrixMult3x3fNV GLEW_GET_FUN(__glewMatrixMult3x3fNV)
-#define glMatrixMultTranspose3x3fNV GLEW_GET_FUN(__glewMatrixMultTranspose3x3fNV)
-#define glPathColorGenNV GLEW_GET_FUN(__glewPathColorGenNV)
-#define glPathCommandsNV GLEW_GET_FUN(__glewPathCommandsNV)
-#define glPathCoordsNV GLEW_GET_FUN(__glewPathCoordsNV)
-#define glPathCoverDepthFuncNV GLEW_GET_FUN(__glewPathCoverDepthFuncNV)
-#define glPathDashArrayNV GLEW_GET_FUN(__glewPathDashArrayNV)
-#define glPathFogGenNV GLEW_GET_FUN(__glewPathFogGenNV)
-#define glPathGlyphIndexArrayNV GLEW_GET_FUN(__glewPathGlyphIndexArrayNV)
-#define glPathGlyphIndexRangeNV GLEW_GET_FUN(__glewPathGlyphIndexRangeNV)
-#define glPathGlyphRangeNV GLEW_GET_FUN(__glewPathGlyphRangeNV)
-#define glPathGlyphsNV GLEW_GET_FUN(__glewPathGlyphsNV)
-#define glPathMemoryGlyphIndexArrayNV GLEW_GET_FUN(__glewPathMemoryGlyphIndexArrayNV)
-#define glPathParameterfNV GLEW_GET_FUN(__glewPathParameterfNV)
-#define glPathParameterfvNV GLEW_GET_FUN(__glewPathParameterfvNV)
-#define glPathParameteriNV GLEW_GET_FUN(__glewPathParameteriNV)
-#define glPathParameterivNV GLEW_GET_FUN(__glewPathParameterivNV)
-#define glPathStencilDepthOffsetNV GLEW_GET_FUN(__glewPathStencilDepthOffsetNV)
-#define glPathStencilFuncNV GLEW_GET_FUN(__glewPathStencilFuncNV)
-#define glPathStringNV GLEW_GET_FUN(__glewPathStringNV)
-#define glPathSubCommandsNV GLEW_GET_FUN(__glewPathSubCommandsNV)
-#define glPathSubCoordsNV GLEW_GET_FUN(__glewPathSubCoordsNV)
-#define glPathTexGenNV GLEW_GET_FUN(__glewPathTexGenNV)
-#define glPointAlongPathNV GLEW_GET_FUN(__glewPointAlongPathNV)
-#define glProgramPathFragmentInputGenNV GLEW_GET_FUN(__glewProgramPathFragmentInputGenNV)
-#define glStencilFillPathInstancedNV GLEW_GET_FUN(__glewStencilFillPathInstancedNV)
-#define glStencilFillPathNV GLEW_GET_FUN(__glewStencilFillPathNV)
-#define glStencilStrokePathInstancedNV GLEW_GET_FUN(__glewStencilStrokePathInstancedNV)
-#define glStencilStrokePathNV GLEW_GET_FUN(__glewStencilStrokePathNV)
-#define glStencilThenCoverFillPathInstancedNV GLEW_GET_FUN(__glewStencilThenCoverFillPathInstancedNV)
-#define glStencilThenCoverFillPathNV GLEW_GET_FUN(__glewStencilThenCoverFillPathNV)
-#define glStencilThenCoverStrokePathInstancedNV GLEW_GET_FUN(__glewStencilThenCoverStrokePathInstancedNV)
-#define glStencilThenCoverStrokePathNV GLEW_GET_FUN(__glewStencilThenCoverStrokePathNV)
-#define glTransformPathNV GLEW_GET_FUN(__glewTransformPathNV)
-#define glWeightPathsNV GLEW_GET_FUN(__glewWeightPathsNV)
-
-#define GLEW_NV_path_rendering GLEW_GET_VAR(__GLEW_NV_path_rendering)
-
-#endif /* GL_NV_path_rendering */
-
-/* -------------------- GL_NV_path_rendering_shared_edge ------------------- */
-
-#ifndef GL_NV_path_rendering_shared_edge
-#define GL_NV_path_rendering_shared_edge 1
-
-#define GL_SHARED_EDGE_NV 0xC0
-
-#define GLEW_NV_path_rendering_shared_edge GLEW_GET_VAR(__GLEW_NV_path_rendering_shared_edge)
-
-#endif /* GL_NV_path_rendering_shared_edge */
-
-/* ------------------------- GL_NV_pixel_data_range ------------------------ */
-
-#ifndef GL_NV_pixel_data_range
-#define GL_NV_pixel_data_range 1
-
-#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878
-#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879
-#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A
-#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B
-#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C
-#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D
-
-typedef void (GLAPIENTRY * PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target);
-typedef void (GLAPIENTRY * PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, void *pointer);
-
-#define glFlushPixelDataRangeNV GLEW_GET_FUN(__glewFlushPixelDataRangeNV)
-#define glPixelDataRangeNV GLEW_GET_FUN(__glewPixelDataRangeNV)
-
-#define GLEW_NV_pixel_data_range GLEW_GET_VAR(__GLEW_NV_pixel_data_range)
-
-#endif /* GL_NV_pixel_data_range */
-
-/* --------------------------- GL_NV_point_sprite -------------------------- */
-
-#ifndef GL_NV_point_sprite
-#define GL_NV_point_sprite 1
-
-#define GL_POINT_SPRITE_NV 0x8861
-#define GL_COORD_REPLACE_NV 0x8862
-#define GL_POINT_SPRITE_R_MODE_NV 0x8863
-
-typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint* params);
-
-#define glPointParameteriNV GLEW_GET_FUN(__glewPointParameteriNV)
-#define glPointParameterivNV GLEW_GET_FUN(__glewPointParameterivNV)
-
-#define GLEW_NV_point_sprite GLEW_GET_VAR(__GLEW_NV_point_sprite)
-
-#endif /* GL_NV_point_sprite */
-
-/* -------------------------- GL_NV_present_video -------------------------- */
-
-#ifndef GL_NV_present_video
-#define GL_NV_present_video 1
-
-#define GL_FRAME_NV 0x8E26
-#define GL_FIELDS_NV 0x8E27
-#define GL_CURRENT_TIME_NV 0x8E28
-#define GL_NUM_FILL_STREAMS_NV 0x8E29
-#define GL_PRESENT_TIME_NV 0x8E2A
-#define GL_PRESENT_DURATION_NV 0x8E2B
-
-typedef void (GLAPIENTRY * PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT* params);
-typedef void (GLAPIENTRY * PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT* params);
-typedef void (GLAPIENTRY * PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint* params);
-typedef void (GLAPIENTRY * PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);
-typedef void (GLAPIENTRY * PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);
-
-#define glGetVideoi64vNV GLEW_GET_FUN(__glewGetVideoi64vNV)
-#define glGetVideoivNV GLEW_GET_FUN(__glewGetVideoivNV)
-#define glGetVideoui64vNV GLEW_GET_FUN(__glewGetVideoui64vNV)
-#define glGetVideouivNV GLEW_GET_FUN(__glewGetVideouivNV)
-#define glPresentFrameDualFillNV GLEW_GET_FUN(__glewPresentFrameDualFillNV)
-#define glPresentFrameKeyedNV GLEW_GET_FUN(__glewPresentFrameKeyedNV)
-
-#define GLEW_NV_present_video GLEW_GET_VAR(__GLEW_NV_present_video)
-
-#endif /* GL_NV_present_video */
-
-/* ------------------------ GL_NV_primitive_restart ------------------------ */
-
-#ifndef GL_NV_primitive_restart
-#define GL_NV_primitive_restart 1
-
-#define GL_PRIMITIVE_RESTART_NV 0x8558
-#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559
-
-typedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index);
-typedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTNVPROC) (void);
-
-#define glPrimitiveRestartIndexNV GLEW_GET_FUN(__glewPrimitiveRestartIndexNV)
-#define glPrimitiveRestartNV GLEW_GET_FUN(__glewPrimitiveRestartNV)
-
-#define GLEW_NV_primitive_restart GLEW_GET_VAR(__GLEW_NV_primitive_restart)
-
-#endif /* GL_NV_primitive_restart */
-
-/* ------------------------ GL_NV_register_combiners ----------------------- */
-
-#ifndef GL_NV_register_combiners
-#define GL_NV_register_combiners 1
-
-#define GL_REGISTER_COMBINERS_NV 0x8522
-#define GL_VARIABLE_A_NV 0x8523
-#define GL_VARIABLE_B_NV 0x8524
-#define GL_VARIABLE_C_NV 0x8525
-#define GL_VARIABLE_D_NV 0x8526
-#define GL_VARIABLE_E_NV 0x8527
-#define GL_VARIABLE_F_NV 0x8528
-#define GL_VARIABLE_G_NV 0x8529
-#define GL_CONSTANT_COLOR0_NV 0x852A
-#define GL_CONSTANT_COLOR1_NV 0x852B
-#define GL_PRIMARY_COLOR_NV 0x852C
-#define GL_SECONDARY_COLOR_NV 0x852D
-#define GL_SPARE0_NV 0x852E
-#define GL_SPARE1_NV 0x852F
-#define GL_DISCARD_NV 0x8530
-#define GL_E_TIMES_F_NV 0x8531
-#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532
-#define GL_UNSIGNED_IDENTITY_NV 0x8536
-#define GL_UNSIGNED_INVERT_NV 0x8537
-#define GL_EXPAND_NORMAL_NV 0x8538
-#define GL_EXPAND_NEGATE_NV 0x8539
-#define GL_HALF_BIAS_NORMAL_NV 0x853A
-#define GL_HALF_BIAS_NEGATE_NV 0x853B
-#define GL_SIGNED_IDENTITY_NV 0x853C
-#define GL_SIGNED_NEGATE_NV 0x853D
-#define GL_SCALE_BY_TWO_NV 0x853E
-#define GL_SCALE_BY_FOUR_NV 0x853F
-#define GL_SCALE_BY_ONE_HALF_NV 0x8540
-#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541
-#define GL_COMBINER_INPUT_NV 0x8542
-#define GL_COMBINER_MAPPING_NV 0x8543
-#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544
-#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545
-#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546
-#define GL_COMBINER_MUX_SUM_NV 0x8547
-#define GL_COMBINER_SCALE_NV 0x8548
-#define GL_COMBINER_BIAS_NV 0x8549
-#define GL_COMBINER_AB_OUTPUT_NV 0x854A
-#define GL_COMBINER_CD_OUTPUT_NV 0x854B
-#define GL_COMBINER_SUM_OUTPUT_NV 0x854C
-#define GL_MAX_GENERAL_COMBINERS_NV 0x854D
-#define GL_NUM_GENERAL_COMBINERS_NV 0x854E
-#define GL_COLOR_SUM_CLAMP_NV 0x854F
-#define GL_COMBINER0_NV 0x8550
-#define GL_COMBINER1_NV 0x8551
-#define GL_COMBINER2_NV 0x8552
-#define GL_COMBINER3_NV 0x8553
-#define GL_COMBINER4_NV 0x8554
-#define GL_COMBINER5_NV 0x8555
-#define GL_COMBINER6_NV 0x8556
-#define GL_COMBINER7_NV 0x8557
-
-typedef void (GLAPIENTRY * PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
-typedef void (GLAPIENTRY * PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
-typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
-typedef void (GLAPIENTRY * PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint* params);
-
-#define glCombinerInputNV GLEW_GET_FUN(__glewCombinerInputNV)
-#define glCombinerOutputNV GLEW_GET_FUN(__glewCombinerOutputNV)
-#define glCombinerParameterfNV GLEW_GET_FUN(__glewCombinerParameterfNV)
-#define glCombinerParameterfvNV GLEW_GET_FUN(__glewCombinerParameterfvNV)
-#define glCombinerParameteriNV GLEW_GET_FUN(__glewCombinerParameteriNV)
-#define glCombinerParameterivNV GLEW_GET_FUN(__glewCombinerParameterivNV)
-#define glFinalCombinerInputNV GLEW_GET_FUN(__glewFinalCombinerInputNV)
-#define glGetCombinerInputParameterfvNV GLEW_GET_FUN(__glewGetCombinerInputParameterfvNV)
-#define glGetCombinerInputParameterivNV GLEW_GET_FUN(__glewGetCombinerInputParameterivNV)
-#define glGetCombinerOutputParameterfvNV GLEW_GET_FUN(__glewGetCombinerOutputParameterfvNV)
-#define glGetCombinerOutputParameterivNV GLEW_GET_FUN(__glewGetCombinerOutputParameterivNV)
-#define glGetFinalCombinerInputParameterfvNV GLEW_GET_FUN(__glewGetFinalCombinerInputParameterfvNV)
-#define glGetFinalCombinerInputParameterivNV GLEW_GET_FUN(__glewGetFinalCombinerInputParameterivNV)
-
-#define GLEW_NV_register_combiners GLEW_GET_VAR(__GLEW_NV_register_combiners)
-
-#endif /* GL_NV_register_combiners */
-
-/* ----------------------- GL_NV_register_combiners2 ----------------------- */
-
-#ifndef GL_NV_register_combiners2
-#define GL_NV_register_combiners2 1
-
-#define GL_PER_STAGE_CONSTANTS_NV 0x8535
-
-typedef void (GLAPIENTRY * PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat* params);
-
-#define glCombinerStageParameterfvNV GLEW_GET_FUN(__glewCombinerStageParameterfvNV)
-#define glGetCombinerStageParameterfvNV GLEW_GET_FUN(__glewGetCombinerStageParameterfvNV)
-
-#define GLEW_NV_register_combiners2 GLEW_GET_VAR(__GLEW_NV_register_combiners2)
-
-#endif /* GL_NV_register_combiners2 */
-
-/* ------------------------- GL_NV_sample_locations ------------------------ */
-
-#ifndef GL_NV_sample_locations
-#define GL_NV_sample_locations 1
-
-#define GL_SAMPLE_LOCATION_NV 0x8E50
-#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D
-#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E
-#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F
-#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340
-#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341
-#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342
-#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343
-
-typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat* v);
-
-#define glFramebufferSampleLocationsfvNV GLEW_GET_FUN(__glewFramebufferSampleLocationsfvNV)
-#define glNamedFramebufferSampleLocationsfvNV GLEW_GET_FUN(__glewNamedFramebufferSampleLocationsfvNV)
-
-#define GLEW_NV_sample_locations GLEW_GET_VAR(__GLEW_NV_sample_locations)
-
-#endif /* GL_NV_sample_locations */
-
-/* ------------------ GL_NV_sample_mask_override_coverage ------------------ */
-
-#ifndef GL_NV_sample_mask_override_coverage
-#define GL_NV_sample_mask_override_coverage 1
-
-#define GLEW_NV_sample_mask_override_coverage GLEW_GET_VAR(__GLEW_NV_sample_mask_override_coverage)
-
-#endif /* GL_NV_sample_mask_override_coverage */
-
-/* ---------------------- GL_NV_shader_atomic_counters --------------------- */
-
-#ifndef GL_NV_shader_atomic_counters
-#define GL_NV_shader_atomic_counters 1
-
-#define GLEW_NV_shader_atomic_counters GLEW_GET_VAR(__GLEW_NV_shader_atomic_counters)
-
-#endif /* GL_NV_shader_atomic_counters */
-
-/* ----------------------- GL_NV_shader_atomic_float ----------------------- */
-
-#ifndef GL_NV_shader_atomic_float
-#define GL_NV_shader_atomic_float 1
-
-#define GLEW_NV_shader_atomic_float GLEW_GET_VAR(__GLEW_NV_shader_atomic_float)
-
-#endif /* GL_NV_shader_atomic_float */
-
-/* -------------------- GL_NV_shader_atomic_fp16_vector -------------------- */
-
-#ifndef GL_NV_shader_atomic_fp16_vector
-#define GL_NV_shader_atomic_fp16_vector 1
-
-#define GLEW_NV_shader_atomic_fp16_vector GLEW_GET_VAR(__GLEW_NV_shader_atomic_fp16_vector)
-
-#endif /* GL_NV_shader_atomic_fp16_vector */
-
-/* ----------------------- GL_NV_shader_atomic_int64 ----------------------- */
-
-#ifndef GL_NV_shader_atomic_int64
-#define GL_NV_shader_atomic_int64 1
-
-#define GLEW_NV_shader_atomic_int64 GLEW_GET_VAR(__GLEW_NV_shader_atomic_int64)
-
-#endif /* GL_NV_shader_atomic_int64 */
-
-/* ------------------------ GL_NV_shader_buffer_load ----------------------- */
-
-#ifndef GL_NV_shader_buffer_load
-#define GL_NV_shader_buffer_load 1
-
-#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D
-#define GL_GPU_ADDRESS_NV 0x8F34
-#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35
-
-typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT* params);
-typedef void (GLAPIENTRY * PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT* result);
-typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISBUFFERRESIDENTNVPROC) (GLenum target);
-typedef GLboolean (GLAPIENTRY * PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target);
-typedef void (GLAPIENTRY * PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access);
-typedef void (GLAPIENTRY * PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value);
-typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value);
-typedef void (GLAPIENTRY * PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value);
-
-#define glGetBufferParameterui64vNV GLEW_GET_FUN(__glewGetBufferParameterui64vNV)
-#define glGetIntegerui64vNV GLEW_GET_FUN(__glewGetIntegerui64vNV)
-#define glGetNamedBufferParameterui64vNV GLEW_GET_FUN(__glewGetNamedBufferParameterui64vNV)
-#define glIsBufferResidentNV GLEW_GET_FUN(__glewIsBufferResidentNV)
-#define glIsNamedBufferResidentNV GLEW_GET_FUN(__glewIsNamedBufferResidentNV)
-#define glMakeBufferNonResidentNV GLEW_GET_FUN(__glewMakeBufferNonResidentNV)
-#define glMakeBufferResidentNV GLEW_GET_FUN(__glewMakeBufferResidentNV)
-#define glMakeNamedBufferNonResidentNV GLEW_GET_FUN(__glewMakeNamedBufferNonResidentNV)
-#define glMakeNamedBufferResidentNV GLEW_GET_FUN(__glewMakeNamedBufferResidentNV)
-#define glProgramUniformui64NV GLEW_GET_FUN(__glewProgramUniformui64NV)
-#define glProgramUniformui64vNV GLEW_GET_FUN(__glewProgramUniformui64vNV)
-#define glUniformui64NV GLEW_GET_FUN(__glewUniformui64NV)
-#define glUniformui64vNV GLEW_GET_FUN(__glewUniformui64vNV)
-
-#define GLEW_NV_shader_buffer_load GLEW_GET_VAR(__GLEW_NV_shader_buffer_load)
-
-#endif /* GL_NV_shader_buffer_load */
-
-/* ------------------- GL_NV_shader_storage_buffer_object ------------------ */
-
-#ifndef GL_NV_shader_storage_buffer_object
-#define GL_NV_shader_storage_buffer_object 1
-
-#define GLEW_NV_shader_storage_buffer_object GLEW_GET_VAR(__GLEW_NV_shader_storage_buffer_object)
-
-#endif /* GL_NV_shader_storage_buffer_object */
-
-/* ----------------------- GL_NV_shader_thread_group ----------------------- */
-
-#ifndef GL_NV_shader_thread_group
-#define GL_NV_shader_thread_group 1
-
-#define GL_WARP_SIZE_NV 0x9339
-#define GL_WARPS_PER_SM_NV 0x933A
-#define GL_SM_COUNT_NV 0x933B
-
-#define GLEW_NV_shader_thread_group GLEW_GET_VAR(__GLEW_NV_shader_thread_group)
-
-#endif /* GL_NV_shader_thread_group */
-
-/* ---------------------- GL_NV_shader_thread_shuffle ---------------------- */
-
-#ifndef GL_NV_shader_thread_shuffle
-#define GL_NV_shader_thread_shuffle 1
-
-#define GLEW_NV_shader_thread_shuffle GLEW_GET_VAR(__GLEW_NV_shader_thread_shuffle)
-
-#endif /* GL_NV_shader_thread_shuffle */
-
-/* ---------------------- GL_NV_tessellation_program5 ---------------------- */
-
-#ifndef GL_NV_tessellation_program5
-#define GL_NV_tessellation_program5 1
-
-#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8
-#define GL_TESS_CONTROL_PROGRAM_NV 0x891E
-#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F
-#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74
-#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75
-
-#define GLEW_NV_tessellation_program5 GLEW_GET_VAR(__GLEW_NV_tessellation_program5)
-
-#endif /* GL_NV_tessellation_program5 */
-
-/* -------------------------- GL_NV_texgen_emboss -------------------------- */
-
-#ifndef GL_NV_texgen_emboss
-#define GL_NV_texgen_emboss 1
-
-#define GL_EMBOSS_LIGHT_NV 0x855D
-#define GL_EMBOSS_CONSTANT_NV 0x855E
-#define GL_EMBOSS_MAP_NV 0x855F
-
-#define GLEW_NV_texgen_emboss GLEW_GET_VAR(__GLEW_NV_texgen_emboss)
-
-#endif /* GL_NV_texgen_emboss */
-
-/* ------------------------ GL_NV_texgen_reflection ------------------------ */
-
-#ifndef GL_NV_texgen_reflection
-#define GL_NV_texgen_reflection 1
-
-#define GL_NORMAL_MAP_NV 0x8511
-#define GL_REFLECTION_MAP_NV 0x8512
-
-#define GLEW_NV_texgen_reflection GLEW_GET_VAR(__GLEW_NV_texgen_reflection)
-
-#endif /* GL_NV_texgen_reflection */
-
-/* ------------------------- GL_NV_texture_barrier ------------------------- */
-
-#ifndef GL_NV_texture_barrier
-#define GL_NV_texture_barrier 1
-
-typedef void (GLAPIENTRY * PFNGLTEXTUREBARRIERNVPROC) (void);
-
-#define glTextureBarrierNV GLEW_GET_FUN(__glewTextureBarrierNV)
-
-#define GLEW_NV_texture_barrier GLEW_GET_VAR(__GLEW_NV_texture_barrier)
-
-#endif /* GL_NV_texture_barrier */
-
-/* --------------------- GL_NV_texture_compression_vtc --------------------- */
-
-#ifndef GL_NV_texture_compression_vtc
-#define GL_NV_texture_compression_vtc 1
-
-#define GLEW_NV_texture_compression_vtc GLEW_GET_VAR(__GLEW_NV_texture_compression_vtc)
-
-#endif /* GL_NV_texture_compression_vtc */
-
-/* ----------------------- GL_NV_texture_env_combine4 ---------------------- */
-
-#ifndef GL_NV_texture_env_combine4
-#define GL_NV_texture_env_combine4 1
-
-#define GL_COMBINE4_NV 0x8503
-#define GL_SOURCE3_RGB_NV 0x8583
-#define GL_SOURCE3_ALPHA_NV 0x858B
-#define GL_OPERAND3_RGB_NV 0x8593
-#define GL_OPERAND3_ALPHA_NV 0x859B
-
-#define GLEW_NV_texture_env_combine4 GLEW_GET_VAR(__GLEW_NV_texture_env_combine4)
-
-#endif /* GL_NV_texture_env_combine4 */
-
-/* ---------------------- GL_NV_texture_expand_normal ---------------------- */
-
-#ifndef GL_NV_texture_expand_normal
-#define GL_NV_texture_expand_normal 1
-
-#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F
-
-#define GLEW_NV_texture_expand_normal GLEW_GET_VAR(__GLEW_NV_texture_expand_normal)
-
-#endif /* GL_NV_texture_expand_normal */
-
-/* ----------------------- GL_NV_texture_multisample ----------------------- */
-
-#ifndef GL_NV_texture_multisample
-#define GL_NV_texture_multisample 1
-
-#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045
-#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046
-
-typedef void (GLAPIENTRY * PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
-typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
-typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
-
-#define glTexImage2DMultisampleCoverageNV GLEW_GET_FUN(__glewTexImage2DMultisampleCoverageNV)
-#define glTexImage3DMultisampleCoverageNV GLEW_GET_FUN(__glewTexImage3DMultisampleCoverageNV)
-#define glTextureImage2DMultisampleCoverageNV GLEW_GET_FUN(__glewTextureImage2DMultisampleCoverageNV)
-#define glTextureImage2DMultisampleNV GLEW_GET_FUN(__glewTextureImage2DMultisampleNV)
-#define glTextureImage3DMultisampleCoverageNV GLEW_GET_FUN(__glewTextureImage3DMultisampleCoverageNV)
-#define glTextureImage3DMultisampleNV GLEW_GET_FUN(__glewTextureImage3DMultisampleNV)
-
-#define GLEW_NV_texture_multisample GLEW_GET_VAR(__GLEW_NV_texture_multisample)
-
-#endif /* GL_NV_texture_multisample */
-
-/* ------------------------ GL_NV_texture_rectangle ------------------------ */
-
-#ifndef GL_NV_texture_rectangle
-#define GL_NV_texture_rectangle 1
-
-#define GL_TEXTURE_RECTANGLE_NV 0x84F5
-#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6
-#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7
-#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8
-
-#define GLEW_NV_texture_rectangle GLEW_GET_VAR(__GLEW_NV_texture_rectangle)
-
-#endif /* GL_NV_texture_rectangle */
-
-/* -------------------------- GL_NV_texture_shader ------------------------- */
-
-#ifndef GL_NV_texture_shader
-#define GL_NV_texture_shader 1
-
-#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C
-#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D
-#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E
-#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9
-#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA
-#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB
-#define GL_DSDT_MAG_INTENSITY_NV 0x86DC
-#define GL_SHADER_CONSISTENT_NV 0x86DD
-#define GL_TEXTURE_SHADER_NV 0x86DE
-#define GL_SHADER_OPERATION_NV 0x86DF
-#define GL_CULL_MODES_NV 0x86E0
-#define GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1
-#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1
-#define GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2
-#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2
-#define GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3
-#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3
-#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4
-#define GL_CONST_EYE_NV 0x86E5
-#define GL_PASS_THROUGH_NV 0x86E6
-#define GL_CULL_FRAGMENT_NV 0x86E7
-#define GL_OFFSET_TEXTURE_2D_NV 0x86E8
-#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9
-#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA
-#define GL_DOT_PRODUCT_NV 0x86EC
-#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED
-#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE
-#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0
-#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1
-#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2
-#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3
-#define GL_HILO_NV 0x86F4
-#define GL_DSDT_NV 0x86F5
-#define GL_DSDT_MAG_NV 0x86F6
-#define GL_DSDT_MAG_VIB_NV 0x86F7
-#define GL_HILO16_NV 0x86F8
-#define GL_SIGNED_HILO_NV 0x86F9
-#define GL_SIGNED_HILO16_NV 0x86FA
-#define GL_SIGNED_RGBA_NV 0x86FB
-#define GL_SIGNED_RGBA8_NV 0x86FC
-#define GL_SIGNED_RGB_NV 0x86FE
-#define GL_SIGNED_RGB8_NV 0x86FF
-#define GL_SIGNED_LUMINANCE_NV 0x8701
-#define GL_SIGNED_LUMINANCE8_NV 0x8702
-#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703
-#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704
-#define GL_SIGNED_ALPHA_NV 0x8705
-#define GL_SIGNED_ALPHA8_NV 0x8706
-#define GL_SIGNED_INTENSITY_NV 0x8707
-#define GL_SIGNED_INTENSITY8_NV 0x8708
-#define GL_DSDT8_NV 0x8709
-#define GL_DSDT8_MAG8_NV 0x870A
-#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B
-#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C
-#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D
-#define GL_HI_SCALE_NV 0x870E
-#define GL_LO_SCALE_NV 0x870F
-#define GL_DS_SCALE_NV 0x8710
-#define GL_DT_SCALE_NV 0x8711
-#define GL_MAGNITUDE_SCALE_NV 0x8712
-#define GL_VIBRANCE_SCALE_NV 0x8713
-#define GL_HI_BIAS_NV 0x8714
-#define GL_LO_BIAS_NV 0x8715
-#define GL_DS_BIAS_NV 0x8716
-#define GL_DT_BIAS_NV 0x8717
-#define GL_MAGNITUDE_BIAS_NV 0x8718
-#define GL_VIBRANCE_BIAS_NV 0x8719
-#define GL_TEXTURE_BORDER_VALUES_NV 0x871A
-#define GL_TEXTURE_HI_SIZE_NV 0x871B
-#define GL_TEXTURE_LO_SIZE_NV 0x871C
-#define GL_TEXTURE_DS_SIZE_NV 0x871D
-#define GL_TEXTURE_DT_SIZE_NV 0x871E
-#define GL_TEXTURE_MAG_SIZE_NV 0x871F
-
-#define GLEW_NV_texture_shader GLEW_GET_VAR(__GLEW_NV_texture_shader)
-
-#endif /* GL_NV_texture_shader */
-
-/* ------------------------- GL_NV_texture_shader2 ------------------------- */
-
-#ifndef GL_NV_texture_shader2
-#define GL_NV_texture_shader2 1
-
-#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA
-#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB
-#define GL_DSDT_MAG_INTENSITY_NV 0x86DC
-#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF
-#define GL_HILO_NV 0x86F4
-#define GL_DSDT_NV 0x86F5
-#define GL_DSDT_MAG_NV 0x86F6
-#define GL_DSDT_MAG_VIB_NV 0x86F7
-#define GL_HILO16_NV 0x86F8
-#define GL_SIGNED_HILO_NV 0x86F9
-#define GL_SIGNED_HILO16_NV 0x86FA
-#define GL_SIGNED_RGBA_NV 0x86FB
-#define GL_SIGNED_RGBA8_NV 0x86FC
-#define GL_SIGNED_RGB_NV 0x86FE
-#define GL_SIGNED_RGB8_NV 0x86FF
-#define GL_SIGNED_LUMINANCE_NV 0x8701
-#define GL_SIGNED_LUMINANCE8_NV 0x8702
-#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703
-#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704
-#define GL_SIGNED_ALPHA_NV 0x8705
-#define GL_SIGNED_ALPHA8_NV 0x8706
-#define GL_SIGNED_INTENSITY_NV 0x8707
-#define GL_SIGNED_INTENSITY8_NV 0x8708
-#define GL_DSDT8_NV 0x8709
-#define GL_DSDT8_MAG8_NV 0x870A
-#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B
-#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C
-#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D
-
-#define GLEW_NV_texture_shader2 GLEW_GET_VAR(__GLEW_NV_texture_shader2)
-
-#endif /* GL_NV_texture_shader2 */
-
-/* ------------------------- GL_NV_texture_shader3 ------------------------- */
-
-#ifndef GL_NV_texture_shader3
-#define GL_NV_texture_shader3 1
-
-#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850
-#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851
-#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852
-#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853
-#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854
-#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855
-#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856
-#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857
-#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858
-#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859
-#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A
-#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B
-#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C
-#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D
-#define GL_HILO8_NV 0x885E
-#define GL_SIGNED_HILO8_NV 0x885F
-#define GL_FORCE_BLUE_TO_ONE_NV 0x8860
-
-#define GLEW_NV_texture_shader3 GLEW_GET_VAR(__GLEW_NV_texture_shader3)
-
-#endif /* GL_NV_texture_shader3 */
-
-/* ------------------------ GL_NV_transform_feedback ----------------------- */
-
-#ifndef GL_NV_transform_feedback
-#define GL_NV_transform_feedback 1
-
-#define GL_BACK_PRIMARY_COLOR_NV 0x8C77
-#define GL_BACK_SECONDARY_COLOR_NV 0x8C78
-#define GL_TEXTURE_COORD_NV 0x8C79
-#define GL_CLIP_DISTANCE_NV 0x8C7A
-#define GL_VERTEX_ID_NV 0x8C7B
-#define GL_PRIMITIVE_ID_NV 0x8C7C
-#define GL_GENERIC_ATTRIB_NV 0x8C7D
-#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E
-#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80
-#define GL_ACTIVE_VARYINGS_NV 0x8C81
-#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82
-#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83
-#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84
-#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85
-#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86
-#define GL_PRIMITIVES_GENERATED_NV 0x8C87
-#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88
-#define GL_RASTERIZER_DISCARD_NV 0x8C89
-#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B
-#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C
-#define GL_SEPARATE_ATTRIBS_NV 0x8C8D
-#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E
-#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F
-
-typedef void (GLAPIENTRY * PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name);
-typedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode);
-typedef void (GLAPIENTRY * PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer);
-typedef void (GLAPIENTRY * PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
-typedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKNVPROC) (void);
-typedef void (GLAPIENTRY * PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location);
-typedef GLint (GLAPIENTRY * PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name);
-typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode);
-typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
-
-#define glActiveVaryingNV GLEW_GET_FUN(__glewActiveVaryingNV)
-#define glBeginTransformFeedbackNV GLEW_GET_FUN(__glewBeginTransformFeedbackNV)
-#define glBindBufferBaseNV GLEW_GET_FUN(__glewBindBufferBaseNV)
-#define glBindBufferOffsetNV GLEW_GET_FUN(__glewBindBufferOffsetNV)
-#define glBindBufferRangeNV GLEW_GET_FUN(__glewBindBufferRangeNV)
-#define glEndTransformFeedbackNV GLEW_GET_FUN(__glewEndTransformFeedbackNV)
-#define glGetActiveVaryingNV GLEW_GET_FUN(__glewGetActiveVaryingNV)
-#define glGetTransformFeedbackVaryingNV GLEW_GET_FUN(__glewGetTransformFeedbackVaryingNV)
-#define glGetVaryingLocationNV GLEW_GET_FUN(__glewGetVaryingLocationNV)
-#define glTransformFeedbackAttribsNV GLEW_GET_FUN(__glewTransformFeedbackAttribsNV)
-#define glTransformFeedbackVaryingsNV GLEW_GET_FUN(__glewTransformFeedbackVaryingsNV)
-
-#define GLEW_NV_transform_feedback GLEW_GET_VAR(__GLEW_NV_transform_feedback)
-
-#endif /* GL_NV_transform_feedback */
-
-/* ----------------------- GL_NV_transform_feedback2 ----------------------- */
-
-#ifndef GL_NV_transform_feedback2
-#define GL_NV_transform_feedback2 1
-
-#define GL_TRANSFORM_FEEDBACK_NV 0x8E22
-#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23
-#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24
-#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25
-
-typedef void (GLAPIENTRY * PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id);
-typedef void (GLAPIENTRY * PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id);
-typedef void (GLAPIENTRY * PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint* ids);
-typedef GLboolean (GLAPIENTRY * PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id);
-typedef void (GLAPIENTRY * PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void);
-typedef void (GLAPIENTRY * PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void);
-
-#define glBindTransformFeedbackNV GLEW_GET_FUN(__glewBindTransformFeedbackNV)
-#define glDeleteTransformFeedbacksNV GLEW_GET_FUN(__glewDeleteTransformFeedbacksNV)
-#define glDrawTransformFeedbackNV GLEW_GET_FUN(__glewDrawTransformFeedbackNV)
-#define glGenTransformFeedbacksNV GLEW_GET_FUN(__glewGenTransformFeedbacksNV)
-#define glIsTransformFeedbackNV GLEW_GET_FUN(__glewIsTransformFeedbackNV)
-#define glPauseTransformFeedbackNV GLEW_GET_FUN(__glewPauseTransformFeedbackNV)
-#define glResumeTransformFeedbackNV GLEW_GET_FUN(__glewResumeTransformFeedbackNV)
-
-#define GLEW_NV_transform_feedback2 GLEW_GET_VAR(__GLEW_NV_transform_feedback2)
-
-#endif /* GL_NV_transform_feedback2 */
-
-/* ------------------ GL_NV_uniform_buffer_unified_memory ------------------ */
-
-#ifndef GL_NV_uniform_buffer_unified_memory
-#define GL_NV_uniform_buffer_unified_memory 1
-
-#define GL_UNIFORM_BUFFER_UNIFIED_NV 0x936E
-#define GL_UNIFORM_BUFFER_ADDRESS_NV 0x936F
-#define GL_UNIFORM_BUFFER_LENGTH_NV 0x9370
-
-#define GLEW_NV_uniform_buffer_unified_memory GLEW_GET_VAR(__GLEW_NV_uniform_buffer_unified_memory)
-
-#endif /* GL_NV_uniform_buffer_unified_memory */
-
-/* -------------------------- GL_NV_vdpau_interop -------------------------- */
-
-#ifndef GL_NV_vdpau_interop
-#define GL_NV_vdpau_interop 1
-
-#define GL_SURFACE_STATE_NV 0x86EB
-#define GL_SURFACE_REGISTERED_NV 0x86FD
-#define GL_SURFACE_MAPPED_NV 0x8700
-#define GL_WRITE_DISCARD_NV 0x88BE
-
-typedef GLintptr GLvdpauSurfaceNV;
-
-typedef void (GLAPIENTRY * PFNGLVDPAUFININVPROC) (void);
-typedef void (GLAPIENTRY * PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei* length, GLint *values);
-typedef void (GLAPIENTRY * PFNGLVDPAUINITNVPROC) (const void* vdpDevice, const void*getProcAddress);
-typedef void (GLAPIENTRY * PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface);
-typedef void (GLAPIENTRY * PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV* surfaces);
-typedef GLvdpauSurfaceNV (GLAPIENTRY * PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void* vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
-typedef GLvdpauSurfaceNV (GLAPIENTRY * PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const void* vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
-typedef void (GLAPIENTRY * PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access);
-typedef void (GLAPIENTRY * PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV* surfaces);
-typedef void (GLAPIENTRY * PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface);
-
-#define glVDPAUFiniNV GLEW_GET_FUN(__glewVDPAUFiniNV)
-#define glVDPAUGetSurfaceivNV GLEW_GET_FUN(__glewVDPAUGetSurfaceivNV)
-#define glVDPAUInitNV GLEW_GET_FUN(__glewVDPAUInitNV)
-#define glVDPAUIsSurfaceNV GLEW_GET_FUN(__glewVDPAUIsSurfaceNV)
-#define glVDPAUMapSurfacesNV GLEW_GET_FUN(__glewVDPAUMapSurfacesNV)
-#define glVDPAURegisterOutputSurfaceNV GLEW_GET_FUN(__glewVDPAURegisterOutputSurfaceNV)
-#define glVDPAURegisterVideoSurfaceNV GLEW_GET_FUN(__glewVDPAURegisterVideoSurfaceNV)
-#define glVDPAUSurfaceAccessNV GLEW_GET_FUN(__glewVDPAUSurfaceAccessNV)
-#define glVDPAUUnmapSurfacesNV GLEW_GET_FUN(__glewVDPAUUnmapSurfacesNV)
-#define glVDPAUUnregisterSurfaceNV GLEW_GET_FUN(__glewVDPAUUnregisterSurfaceNV)
-
-#define GLEW_NV_vdpau_interop GLEW_GET_VAR(__GLEW_NV_vdpau_interop)
-
-#endif /* GL_NV_vdpau_interop */
-
-/* ------------------------ GL_NV_vertex_array_range ----------------------- */
-
-#ifndef GL_NV_vertex_array_range
-#define GL_NV_vertex_array_range 1
-
-#define GL_VERTEX_ARRAY_RANGE_NV 0x851D
-#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E
-#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F
-#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520
-#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521
-
-typedef void (GLAPIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void);
-typedef void (GLAPIENTRY * PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, void *pointer);
-
-#define glFlushVertexArrayRangeNV GLEW_GET_FUN(__glewFlushVertexArrayRangeNV)
-#define glVertexArrayRangeNV GLEW_GET_FUN(__glewVertexArrayRangeNV)
-
-#define GLEW_NV_vertex_array_range GLEW_GET_VAR(__GLEW_NV_vertex_array_range)
-
-#endif /* GL_NV_vertex_array_range */
-
-/* ----------------------- GL_NV_vertex_array_range2 ----------------------- */
-
-#ifndef GL_NV_vertex_array_range2
-#define GL_NV_vertex_array_range2 1
-
-#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533
-
-#define GLEW_NV_vertex_array_range2 GLEW_GET_VAR(__GLEW_NV_vertex_array_range2)
-
-#endif /* GL_NV_vertex_array_range2 */
-
-/* ------------------- GL_NV_vertex_attrib_integer_64bit ------------------- */
-
-#ifndef GL_NV_vertex_attrib_integer_64bit
-#define GL_NV_vertex_attrib_integer_64bit 1
-
-#define GL_INT64_NV 0x140E
-#define GL_UNSIGNED_INT64_NV 0x140F
-
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT* params);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
-
-#define glGetVertexAttribLi64vNV GLEW_GET_FUN(__glewGetVertexAttribLi64vNV)
-#define glGetVertexAttribLui64vNV GLEW_GET_FUN(__glewGetVertexAttribLui64vNV)
-#define glVertexAttribL1i64NV GLEW_GET_FUN(__glewVertexAttribL1i64NV)
-#define glVertexAttribL1i64vNV GLEW_GET_FUN(__glewVertexAttribL1i64vNV)
-#define glVertexAttribL1ui64NV GLEW_GET_FUN(__glewVertexAttribL1ui64NV)
-#define glVertexAttribL1ui64vNV GLEW_GET_FUN(__glewVertexAttribL1ui64vNV)
-#define glVertexAttribL2i64NV GLEW_GET_FUN(__glewVertexAttribL2i64NV)
-#define glVertexAttribL2i64vNV GLEW_GET_FUN(__glewVertexAttribL2i64vNV)
-#define glVertexAttribL2ui64NV GLEW_GET_FUN(__glewVertexAttribL2ui64NV)
-#define glVertexAttribL2ui64vNV GLEW_GET_FUN(__glewVertexAttribL2ui64vNV)
-#define glVertexAttribL3i64NV GLEW_GET_FUN(__glewVertexAttribL3i64NV)
-#define glVertexAttribL3i64vNV GLEW_GET_FUN(__glewVertexAttribL3i64vNV)
-#define glVertexAttribL3ui64NV GLEW_GET_FUN(__glewVertexAttribL3ui64NV)
-#define glVertexAttribL3ui64vNV GLEW_GET_FUN(__glewVertexAttribL3ui64vNV)
-#define glVertexAttribL4i64NV GLEW_GET_FUN(__glewVertexAttribL4i64NV)
-#define glVertexAttribL4i64vNV GLEW_GET_FUN(__glewVertexAttribL4i64vNV)
-#define glVertexAttribL4ui64NV GLEW_GET_FUN(__glewVertexAttribL4ui64NV)
-#define glVertexAttribL4ui64vNV GLEW_GET_FUN(__glewVertexAttribL4ui64vNV)
-#define glVertexAttribLFormatNV GLEW_GET_FUN(__glewVertexAttribLFormatNV)
-
-#define GLEW_NV_vertex_attrib_integer_64bit GLEW_GET_VAR(__GLEW_NV_vertex_attrib_integer_64bit)
-
-#endif /* GL_NV_vertex_attrib_integer_64bit */
-
-/* ------------------- GL_NV_vertex_buffer_unified_memory ------------------ */
-
-#ifndef GL_NV_vertex_buffer_unified_memory
-#define GL_NV_vertex_buffer_unified_memory 1
-
-#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E
-#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F
-#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20
-#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21
-#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22
-#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23
-#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24
-#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25
-#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26
-#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27
-#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28
-#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29
-#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A
-#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B
-#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C
-#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D
-#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E
-#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F
-#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30
-#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31
-#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32
-#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33
-#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40
-#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41
-#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42
-
-typedef void (GLAPIENTRY * PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);
-typedef void (GLAPIENTRY * PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT result[]);
-typedef void (GLAPIENTRY * PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
-typedef void (GLAPIENTRY * PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
-
-#define glBufferAddressRangeNV GLEW_GET_FUN(__glewBufferAddressRangeNV)
-#define glColorFormatNV GLEW_GET_FUN(__glewColorFormatNV)
-#define glEdgeFlagFormatNV GLEW_GET_FUN(__glewEdgeFlagFormatNV)
-#define glFogCoordFormatNV GLEW_GET_FUN(__glewFogCoordFormatNV)
-#define glGetIntegerui64i_vNV GLEW_GET_FUN(__glewGetIntegerui64i_vNV)
-#define glIndexFormatNV GLEW_GET_FUN(__glewIndexFormatNV)
-#define glNormalFormatNV GLEW_GET_FUN(__glewNormalFormatNV)
-#define glSecondaryColorFormatNV GLEW_GET_FUN(__glewSecondaryColorFormatNV)
-#define glTexCoordFormatNV GLEW_GET_FUN(__glewTexCoordFormatNV)
-#define glVertexAttribFormatNV GLEW_GET_FUN(__glewVertexAttribFormatNV)
-#define glVertexAttribIFormatNV GLEW_GET_FUN(__glewVertexAttribIFormatNV)
-#define glVertexFormatNV GLEW_GET_FUN(__glewVertexFormatNV)
-
-#define GLEW_NV_vertex_buffer_unified_memory GLEW_GET_VAR(__GLEW_NV_vertex_buffer_unified_memory)
-
-#endif /* GL_NV_vertex_buffer_unified_memory */
-
-/* -------------------------- GL_NV_vertex_program ------------------------- */
-
-#ifndef GL_NV_vertex_program
-#define GL_NV_vertex_program 1
-
-#define GL_VERTEX_PROGRAM_NV 0x8620
-#define GL_VERTEX_STATE_PROGRAM_NV 0x8621
-#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623
-#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624
-#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625
-#define GL_CURRENT_ATTRIB_NV 0x8626
-#define GL_PROGRAM_LENGTH_NV 0x8627
-#define GL_PROGRAM_STRING_NV 0x8628
-#define GL_MODELVIEW_PROJECTION_NV 0x8629
-#define GL_IDENTITY_NV 0x862A
-#define GL_INVERSE_NV 0x862B
-#define GL_TRANSPOSE_NV 0x862C
-#define GL_INVERSE_TRANSPOSE_NV 0x862D
-#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E
-#define GL_MAX_TRACK_MATRICES_NV 0x862F
-#define GL_MATRIX0_NV 0x8630
-#define GL_MATRIX1_NV 0x8631
-#define GL_MATRIX2_NV 0x8632
-#define GL_MATRIX3_NV 0x8633
-#define GL_MATRIX4_NV 0x8634
-#define GL_MATRIX5_NV 0x8635
-#define GL_MATRIX6_NV 0x8636
-#define GL_MATRIX7_NV 0x8637
-#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640
-#define GL_CURRENT_MATRIX_NV 0x8641
-#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642
-#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643
-#define GL_PROGRAM_PARAMETER_NV 0x8644
-#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645
-#define GL_PROGRAM_TARGET_NV 0x8646
-#define GL_PROGRAM_RESIDENT_NV 0x8647
-#define GL_TRACK_MATRIX_NV 0x8648
-#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649
-#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A
-#define GL_PROGRAM_ERROR_POSITION_NV 0x864B
-#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650
-#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651
-#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652
-#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653
-#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654
-#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655
-#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656
-#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657
-#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658
-#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659
-#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A
-#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B
-#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C
-#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D
-#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E
-#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F
-#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660
-#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661
-#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662
-#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663
-#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664
-#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665
-#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666
-#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667
-#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668
-#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669
-#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A
-#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B
-#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C
-#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D
-#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E
-#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F
-#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670
-#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671
-#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672
-#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673
-#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674
-#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675
-#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676
-#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677
-#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678
-#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679
-#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A
-#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B
-#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C
-#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D
-#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E
-#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F
-
-typedef GLboolean (GLAPIENTRY * PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint* ids, GLboolean *residences);
-typedef void (GLAPIENTRY * PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id);
-typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte* program);
-typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, void** pointer);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint* params);
-typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMNVPROC) (GLuint id);
-typedef void (GLAPIENTRY * PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte* program);
-typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei num, const GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei num, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, GLuint* ids);
-typedef void (GLAPIENTRY * PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei n, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei n, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei n, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei n, const GLshort* v);
-typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei n, const GLubyte* v);
-
-#define glAreProgramsResidentNV GLEW_GET_FUN(__glewAreProgramsResidentNV)
-#define glBindProgramNV GLEW_GET_FUN(__glewBindProgramNV)
-#define glDeleteProgramsNV GLEW_GET_FUN(__glewDeleteProgramsNV)
-#define glExecuteProgramNV GLEW_GET_FUN(__glewExecuteProgramNV)
-#define glGenProgramsNV GLEW_GET_FUN(__glewGenProgramsNV)
-#define glGetProgramParameterdvNV GLEW_GET_FUN(__glewGetProgramParameterdvNV)
-#define glGetProgramParameterfvNV GLEW_GET_FUN(__glewGetProgramParameterfvNV)
-#define glGetProgramStringNV GLEW_GET_FUN(__glewGetProgramStringNV)
-#define glGetProgramivNV GLEW_GET_FUN(__glewGetProgramivNV)
-#define glGetTrackMatrixivNV GLEW_GET_FUN(__glewGetTrackMatrixivNV)
-#define glGetVertexAttribPointervNV GLEW_GET_FUN(__glewGetVertexAttribPointervNV)
-#define glGetVertexAttribdvNV GLEW_GET_FUN(__glewGetVertexAttribdvNV)
-#define glGetVertexAttribfvNV GLEW_GET_FUN(__glewGetVertexAttribfvNV)
-#define glGetVertexAttribivNV GLEW_GET_FUN(__glewGetVertexAttribivNV)
-#define glIsProgramNV GLEW_GET_FUN(__glewIsProgramNV)
-#define glLoadProgramNV GLEW_GET_FUN(__glewLoadProgramNV)
-#define glProgramParameter4dNV GLEW_GET_FUN(__glewProgramParameter4dNV)
-#define glProgramParameter4dvNV GLEW_GET_FUN(__glewProgramParameter4dvNV)
-#define glProgramParameter4fNV GLEW_GET_FUN(__glewProgramParameter4fNV)
-#define glProgramParameter4fvNV GLEW_GET_FUN(__glewProgramParameter4fvNV)
-#define glProgramParameters4dvNV GLEW_GET_FUN(__glewProgramParameters4dvNV)
-#define glProgramParameters4fvNV GLEW_GET_FUN(__glewProgramParameters4fvNV)
-#define glRequestResidentProgramsNV GLEW_GET_FUN(__glewRequestResidentProgramsNV)
-#define glTrackMatrixNV GLEW_GET_FUN(__glewTrackMatrixNV)
-#define glVertexAttrib1dNV GLEW_GET_FUN(__glewVertexAttrib1dNV)
-#define glVertexAttrib1dvNV GLEW_GET_FUN(__glewVertexAttrib1dvNV)
-#define glVertexAttrib1fNV GLEW_GET_FUN(__glewVertexAttrib1fNV)
-#define glVertexAttrib1fvNV GLEW_GET_FUN(__glewVertexAttrib1fvNV)
-#define glVertexAttrib1sNV GLEW_GET_FUN(__glewVertexAttrib1sNV)
-#define glVertexAttrib1svNV GLEW_GET_FUN(__glewVertexAttrib1svNV)
-#define glVertexAttrib2dNV GLEW_GET_FUN(__glewVertexAttrib2dNV)
-#define glVertexAttrib2dvNV GLEW_GET_FUN(__glewVertexAttrib2dvNV)
-#define glVertexAttrib2fNV GLEW_GET_FUN(__glewVertexAttrib2fNV)
-#define glVertexAttrib2fvNV GLEW_GET_FUN(__glewVertexAttrib2fvNV)
-#define glVertexAttrib2sNV GLEW_GET_FUN(__glewVertexAttrib2sNV)
-#define glVertexAttrib2svNV GLEW_GET_FUN(__glewVertexAttrib2svNV)
-#define glVertexAttrib3dNV GLEW_GET_FUN(__glewVertexAttrib3dNV)
-#define glVertexAttrib3dvNV GLEW_GET_FUN(__glewVertexAttrib3dvNV)
-#define glVertexAttrib3fNV GLEW_GET_FUN(__glewVertexAttrib3fNV)
-#define glVertexAttrib3fvNV GLEW_GET_FUN(__glewVertexAttrib3fvNV)
-#define glVertexAttrib3sNV GLEW_GET_FUN(__glewVertexAttrib3sNV)
-#define glVertexAttrib3svNV GLEW_GET_FUN(__glewVertexAttrib3svNV)
-#define glVertexAttrib4dNV GLEW_GET_FUN(__glewVertexAttrib4dNV)
-#define glVertexAttrib4dvNV GLEW_GET_FUN(__glewVertexAttrib4dvNV)
-#define glVertexAttrib4fNV GLEW_GET_FUN(__glewVertexAttrib4fNV)
-#define glVertexAttrib4fvNV GLEW_GET_FUN(__glewVertexAttrib4fvNV)
-#define glVertexAttrib4sNV GLEW_GET_FUN(__glewVertexAttrib4sNV)
-#define glVertexAttrib4svNV GLEW_GET_FUN(__glewVertexAttrib4svNV)
-#define glVertexAttrib4ubNV GLEW_GET_FUN(__glewVertexAttrib4ubNV)
-#define glVertexAttrib4ubvNV GLEW_GET_FUN(__glewVertexAttrib4ubvNV)
-#define glVertexAttribPointerNV GLEW_GET_FUN(__glewVertexAttribPointerNV)
-#define glVertexAttribs1dvNV GLEW_GET_FUN(__glewVertexAttribs1dvNV)
-#define glVertexAttribs1fvNV GLEW_GET_FUN(__glewVertexAttribs1fvNV)
-#define glVertexAttribs1svNV GLEW_GET_FUN(__glewVertexAttribs1svNV)
-#define glVertexAttribs2dvNV GLEW_GET_FUN(__glewVertexAttribs2dvNV)
-#define glVertexAttribs2fvNV GLEW_GET_FUN(__glewVertexAttribs2fvNV)
-#define glVertexAttribs2svNV GLEW_GET_FUN(__glewVertexAttribs2svNV)
-#define glVertexAttribs3dvNV GLEW_GET_FUN(__glewVertexAttribs3dvNV)
-#define glVertexAttribs3fvNV GLEW_GET_FUN(__glewVertexAttribs3fvNV)
-#define glVertexAttribs3svNV GLEW_GET_FUN(__glewVertexAttribs3svNV)
-#define glVertexAttribs4dvNV GLEW_GET_FUN(__glewVertexAttribs4dvNV)
-#define glVertexAttribs4fvNV GLEW_GET_FUN(__glewVertexAttribs4fvNV)
-#define glVertexAttribs4svNV GLEW_GET_FUN(__glewVertexAttribs4svNV)
-#define glVertexAttribs4ubvNV GLEW_GET_FUN(__glewVertexAttribs4ubvNV)
-
-#define GLEW_NV_vertex_program GLEW_GET_VAR(__GLEW_NV_vertex_program)
-
-#endif /* GL_NV_vertex_program */
-
-/* ------------------------ GL_NV_vertex_program1_1 ------------------------ */
-
-#ifndef GL_NV_vertex_program1_1
-#define GL_NV_vertex_program1_1 1
-
-#define GLEW_NV_vertex_program1_1 GLEW_GET_VAR(__GLEW_NV_vertex_program1_1)
-
-#endif /* GL_NV_vertex_program1_1 */
-
-/* ------------------------- GL_NV_vertex_program2 ------------------------- */
-
-#ifndef GL_NV_vertex_program2
-#define GL_NV_vertex_program2 1
-
-#define GLEW_NV_vertex_program2 GLEW_GET_VAR(__GLEW_NV_vertex_program2)
-
-#endif /* GL_NV_vertex_program2 */
-
-/* ---------------------- GL_NV_vertex_program2_option --------------------- */
-
-#ifndef GL_NV_vertex_program2_option
-#define GL_NV_vertex_program2_option 1
-
-#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4
-#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5
-
-#define GLEW_NV_vertex_program2_option GLEW_GET_VAR(__GLEW_NV_vertex_program2_option)
-
-#endif /* GL_NV_vertex_program2_option */
-
-/* ------------------------- GL_NV_vertex_program3 ------------------------- */
-
-#ifndef GL_NV_vertex_program3
-#define GL_NV_vertex_program3 1
-
-#define MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C
-
-#define GLEW_NV_vertex_program3 GLEW_GET_VAR(__GLEW_NV_vertex_program3)
-
-#endif /* GL_NV_vertex_program3 */
-
-/* ------------------------- GL_NV_vertex_program4 ------------------------- */
-
-#ifndef GL_NV_vertex_program4
-#define GL_NV_vertex_program4 1
-
-#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD
-
-#define GLEW_NV_vertex_program4 GLEW_GET_VAR(__GLEW_NV_vertex_program4)
-
-#endif /* GL_NV_vertex_program4 */
-
-/* -------------------------- GL_NV_video_capture -------------------------- */
-
-#ifndef GL_NV_video_capture
-#define GL_NV_video_capture 1
-
-#define GL_VIDEO_BUFFER_NV 0x9020
-#define GL_VIDEO_BUFFER_BINDING_NV 0x9021
-#define GL_FIELD_UPPER_NV 0x9022
-#define GL_FIELD_LOWER_NV 0x9023
-#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024
-#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025
-#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026
-#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027
-#define GL_VIDEO_BUFFER_PITCH_NV 0x9028
-#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029
-#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A
-#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B
-#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C
-#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D
-#define GL_PARTIAL_SUCCESS_NV 0x902E
-#define GL_SUCCESS_NV 0x902F
-#define GL_FAILURE_NV 0x9030
-#define GL_YCBYCR8_422_NV 0x9031
-#define GL_YCBAYCR8A_4224_NV 0x9032
-#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033
-#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034
-#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035
-#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036
-#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037
-#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038
-#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039
-#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A
-#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B
-#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C
-
-typedef void (GLAPIENTRY * PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot);
-typedef void (GLAPIENTRY * PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);
-typedef void (GLAPIENTRY * PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);
-typedef void (GLAPIENTRY * PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot);
-typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint* params);
-typedef GLenum (GLAPIENTRY * PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint* sequence_num, GLuint64EXT *capture_time);
-typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble* params);
-typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint* params);
-
-#define glBeginVideoCaptureNV GLEW_GET_FUN(__glewBeginVideoCaptureNV)
-#define glBindVideoCaptureStreamBufferNV GLEW_GET_FUN(__glewBindVideoCaptureStreamBufferNV)
-#define glBindVideoCaptureStreamTextureNV GLEW_GET_FUN(__glewBindVideoCaptureStreamTextureNV)
-#define glEndVideoCaptureNV GLEW_GET_FUN(__glewEndVideoCaptureNV)
-#define glGetVideoCaptureStreamdvNV GLEW_GET_FUN(__glewGetVideoCaptureStreamdvNV)
-#define glGetVideoCaptureStreamfvNV GLEW_GET_FUN(__glewGetVideoCaptureStreamfvNV)
-#define glGetVideoCaptureStreamivNV GLEW_GET_FUN(__glewGetVideoCaptureStreamivNV)
-#define glGetVideoCaptureivNV GLEW_GET_FUN(__glewGetVideoCaptureivNV)
-#define glVideoCaptureNV GLEW_GET_FUN(__glewVideoCaptureNV)
-#define glVideoCaptureStreamParameterdvNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterdvNV)
-#define glVideoCaptureStreamParameterfvNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterfvNV)
-#define glVideoCaptureStreamParameterivNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterivNV)
-
-#define GLEW_NV_video_capture GLEW_GET_VAR(__GLEW_NV_video_capture)
-
-#endif /* GL_NV_video_capture */
-
-/* ------------------------ GL_OES_byte_coordinates ------------------------ */
-
-#ifndef GL_OES_byte_coordinates
-#define GL_OES_byte_coordinates 1
-
-#define GLEW_OES_byte_coordinates GLEW_GET_VAR(__GLEW_OES_byte_coordinates)
-
-#endif /* GL_OES_byte_coordinates */
-
-/* ------------------- GL_OES_compressed_paletted_texture ------------------ */
-
-#ifndef GL_OES_compressed_paletted_texture
-#define GL_OES_compressed_paletted_texture 1
-
-#define GL_PALETTE4_RGB8_OES 0x8B90
-#define GL_PALETTE4_RGBA8_OES 0x8B91
-#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
-#define GL_PALETTE4_RGBA4_OES 0x8B93
-#define GL_PALETTE4_RGB5_A1_OES 0x8B94
-#define GL_PALETTE8_RGB8_OES 0x8B95
-#define GL_PALETTE8_RGBA8_OES 0x8B96
-#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
-#define GL_PALETTE8_RGBA4_OES 0x8B98
-#define GL_PALETTE8_RGB5_A1_OES 0x8B99
-
-#define GLEW_OES_compressed_paletted_texture GLEW_GET_VAR(__GLEW_OES_compressed_paletted_texture)
-
-#endif /* GL_OES_compressed_paletted_texture */
-
-/* --------------------------- GL_OES_read_format -------------------------- */
-
-#ifndef GL_OES_read_format
-#define GL_OES_read_format 1
-
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
-
-#define GLEW_OES_read_format GLEW_GET_VAR(__GLEW_OES_read_format)
-
-#endif /* GL_OES_read_format */
-
-/* ------------------------ GL_OES_single_precision ------------------------ */
-
-#ifndef GL_OES_single_precision
-#define GL_OES_single_precision 1
-
-typedef void (GLAPIENTRY * PFNGLCLEARDEPTHFOESPROC) (GLclampf depth);
-typedef void (GLAPIENTRY * PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat* equation);
-typedef void (GLAPIENTRY * PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f);
-typedef void (GLAPIENTRY * PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
-typedef void (GLAPIENTRY * PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat* equation);
-typedef void (GLAPIENTRY * PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
-
-#define glClearDepthfOES GLEW_GET_FUN(__glewClearDepthfOES)
-#define glClipPlanefOES GLEW_GET_FUN(__glewClipPlanefOES)
-#define glDepthRangefOES GLEW_GET_FUN(__glewDepthRangefOES)
-#define glFrustumfOES GLEW_GET_FUN(__glewFrustumfOES)
-#define glGetClipPlanefOES GLEW_GET_FUN(__glewGetClipPlanefOES)
-#define glOrthofOES GLEW_GET_FUN(__glewOrthofOES)
-
-#define GLEW_OES_single_precision GLEW_GET_VAR(__GLEW_OES_single_precision)
-
-#endif /* GL_OES_single_precision */
-
-/* ---------------------------- GL_OML_interlace --------------------------- */
-
-#ifndef GL_OML_interlace
-#define GL_OML_interlace 1
-
-#define GL_INTERLACE_OML 0x8980
-#define GL_INTERLACE_READ_OML 0x8981
-
-#define GLEW_OML_interlace GLEW_GET_VAR(__GLEW_OML_interlace)
-
-#endif /* GL_OML_interlace */
-
-/* ---------------------------- GL_OML_resample ---------------------------- */
-
-#ifndef GL_OML_resample
-#define GL_OML_resample 1
-
-#define GL_PACK_RESAMPLE_OML 0x8984
-#define GL_UNPACK_RESAMPLE_OML 0x8985
-#define GL_RESAMPLE_REPLICATE_OML 0x8986
-#define GL_RESAMPLE_ZERO_FILL_OML 0x8987
-#define GL_RESAMPLE_AVERAGE_OML 0x8988
-#define GL_RESAMPLE_DECIMATE_OML 0x8989
-
-#define GLEW_OML_resample GLEW_GET_VAR(__GLEW_OML_resample)
-
-#endif /* GL_OML_resample */
-
-/* ---------------------------- GL_OML_subsample --------------------------- */
-
-#ifndef GL_OML_subsample
-#define GL_OML_subsample 1
-
-#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982
-#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983
-
-#define GLEW_OML_subsample GLEW_GET_VAR(__GLEW_OML_subsample)
-
-#endif /* GL_OML_subsample */
-
-/* --------------------------- GL_PGI_misc_hints --------------------------- */
-
-#ifndef GL_PGI_misc_hints
-#define GL_PGI_misc_hints 1
-
-#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 107000
-#define GL_CONSERVE_MEMORY_HINT_PGI 107005
-#define GL_RECLAIM_MEMORY_HINT_PGI 107006
-#define GL_NATIVE_GRAPHICS_HANDLE_PGI 107010
-#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 107011
-#define GL_NATIVE_GRAPHICS_END_HINT_PGI 107012
-#define GL_ALWAYS_FAST_HINT_PGI 107020
-#define GL_ALWAYS_SOFT_HINT_PGI 107021
-#define GL_ALLOW_DRAW_OBJ_HINT_PGI 107022
-#define GL_ALLOW_DRAW_WIN_HINT_PGI 107023
-#define GL_ALLOW_DRAW_FRG_HINT_PGI 107024
-#define GL_ALLOW_DRAW_MEM_HINT_PGI 107025
-#define GL_STRICT_DEPTHFUNC_HINT_PGI 107030
-#define GL_STRICT_LIGHTING_HINT_PGI 107031
-#define GL_STRICT_SCISSOR_HINT_PGI 107032
-#define GL_FULL_STIPPLE_HINT_PGI 107033
-#define GL_CLIP_NEAR_HINT_PGI 107040
-#define GL_CLIP_FAR_HINT_PGI 107041
-#define GL_WIDE_LINE_HINT_PGI 107042
-#define GL_BACK_NORMALS_HINT_PGI 107043
-
-#define GLEW_PGI_misc_hints GLEW_GET_VAR(__GLEW_PGI_misc_hints)
-
-#endif /* GL_PGI_misc_hints */
-
-/* -------------------------- GL_PGI_vertex_hints -------------------------- */
-
-#ifndef GL_PGI_vertex_hints
-#define GL_PGI_vertex_hints 1
-
-#define GL_VERTEX23_BIT_PGI 0x00000004
-#define GL_VERTEX4_BIT_PGI 0x00000008
-#define GL_COLOR3_BIT_PGI 0x00010000
-#define GL_COLOR4_BIT_PGI 0x00020000
-#define GL_EDGEFLAG_BIT_PGI 0x00040000
-#define GL_INDEX_BIT_PGI 0x00080000
-#define GL_MAT_AMBIENT_BIT_PGI 0x00100000
-#define GL_VERTEX_DATA_HINT_PGI 107050
-#define GL_VERTEX_CONSISTENT_HINT_PGI 107051
-#define GL_MATERIAL_SIDE_HINT_PGI 107052
-#define GL_MAX_VERTEX_HINT_PGI 107053
-#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000
-#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000
-#define GL_MAT_EMISSION_BIT_PGI 0x00800000
-#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000
-#define GL_MAT_SHININESS_BIT_PGI 0x02000000
-#define GL_MAT_SPECULAR_BIT_PGI 0x04000000
-#define GL_NORMAL_BIT_PGI 0x08000000
-#define GL_TEXCOORD1_BIT_PGI 0x10000000
-#define GL_TEXCOORD2_BIT_PGI 0x20000000
-#define GL_TEXCOORD3_BIT_PGI 0x40000000
-#define GL_TEXCOORD4_BIT_PGI 0x80000000
-
-#define GLEW_PGI_vertex_hints GLEW_GET_VAR(__GLEW_PGI_vertex_hints)
-
-#endif /* GL_PGI_vertex_hints */
-
-/* ---------------------- GL_REGAL_ES1_0_compatibility --------------------- */
-
-#ifndef GL_REGAL_ES1_0_compatibility
-#define GL_REGAL_ES1_0_compatibility 1
-
-typedef int GLclampx;
-
-typedef void (GLAPIENTRY * PFNGLALPHAFUNCXPROC) (GLenum func, GLclampx ref);
-typedef void (GLAPIENTRY * PFNGLCLEARCOLORXPROC) (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-typedef void (GLAPIENTRY * PFNGLCLEARDEPTHXPROC) (GLclampx depth);
-typedef void (GLAPIENTRY * PFNGLCOLOR4XPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-typedef void (GLAPIENTRY * PFNGLDEPTHRANGEXPROC) (GLclampx zNear, GLclampx zFar);
-typedef void (GLAPIENTRY * PFNGLFOGXPROC) (GLenum pname, GLfixed param);
-typedef void (GLAPIENTRY * PFNGLFOGXVPROC) (GLenum pname, const GLfixed* params);
-typedef void (GLAPIENTRY * PFNGLFRUSTUMFPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-typedef void (GLAPIENTRY * PFNGLFRUSTUMXPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-typedef void (GLAPIENTRY * PFNGLLIGHTMODELXPROC) (GLenum pname, GLfixed param);
-typedef void (GLAPIENTRY * PFNGLLIGHTMODELXVPROC) (GLenum pname, const GLfixed* params);
-typedef void (GLAPIENTRY * PFNGLLIGHTXPROC) (GLenum light, GLenum pname, GLfixed param);
-typedef void (GLAPIENTRY * PFNGLLIGHTXVPROC) (GLenum light, GLenum pname, const GLfixed* params);
-typedef void (GLAPIENTRY * PFNGLLINEWIDTHXPROC) (GLfixed width);
-typedef void (GLAPIENTRY * PFNGLLOADMATRIXXPROC) (const GLfixed* m);
-typedef void (GLAPIENTRY * PFNGLMATERIALXPROC) (GLenum face, GLenum pname, GLfixed param);
-typedef void (GLAPIENTRY * PFNGLMATERIALXVPROC) (GLenum face, GLenum pname, const GLfixed* params);
-typedef void (GLAPIENTRY * PFNGLMULTMATRIXXPROC) (const GLfixed* m);
-typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4XPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-typedef void (GLAPIENTRY * PFNGLNORMAL3XPROC) (GLfixed nx, GLfixed ny, GLfixed nz);
-typedef void (GLAPIENTRY * PFNGLORTHOFPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-typedef void (GLAPIENTRY * PFNGLORTHOXPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-typedef void (GLAPIENTRY * PFNGLPOINTSIZEXPROC) (GLfixed size);
-typedef void (GLAPIENTRY * PFNGLPOLYGONOFFSETXPROC) (GLfixed factor, GLfixed units);
-typedef void (GLAPIENTRY * PFNGLROTATEXPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-typedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEXPROC) (GLclampx value, GLboolean invert);
-typedef void (GLAPIENTRY * PFNGLSCALEXPROC) (GLfixed x, GLfixed y, GLfixed z);
-typedef void (GLAPIENTRY * PFNGLTEXENVXPROC) (GLenum target, GLenum pname, GLfixed param);
-typedef void (GLAPIENTRY * PFNGLTEXENVXVPROC) (GLenum target, GLenum pname, const GLfixed* params);
-typedef void (GLAPIENTRY * PFNGLTEXPARAMETERXPROC) (GLenum target, GLenum pname, GLfixed param);
-typedef void (GLAPIENTRY * PFNGLTRANSLATEXPROC) (GLfixed x, GLfixed y, GLfixed z);
-
-#define glAlphaFuncx GLEW_GET_FUN(__glewAlphaFuncx)
-#define glClearColorx GLEW_GET_FUN(__glewClearColorx)
-#define glClearDepthx GLEW_GET_FUN(__glewClearDepthx)
-#define glColor4x GLEW_GET_FUN(__glewColor4x)
-#define glDepthRangex GLEW_GET_FUN(__glewDepthRangex)
-#define glFogx GLEW_GET_FUN(__glewFogx)
-#define glFogxv GLEW_GET_FUN(__glewFogxv)
-#define glFrustumf GLEW_GET_FUN(__glewFrustumf)
-#define glFrustumx GLEW_GET_FUN(__glewFrustumx)
-#define glLightModelx GLEW_GET_FUN(__glewLightModelx)
-#define glLightModelxv GLEW_GET_FUN(__glewLightModelxv)
-#define glLightx GLEW_GET_FUN(__glewLightx)
-#define glLightxv GLEW_GET_FUN(__glewLightxv)
-#define glLineWidthx GLEW_GET_FUN(__glewLineWidthx)
-#define glLoadMatrixx GLEW_GET_FUN(__glewLoadMatrixx)
-#define glMaterialx GLEW_GET_FUN(__glewMaterialx)
-#define glMaterialxv GLEW_GET_FUN(__glewMaterialxv)
-#define glMultMatrixx GLEW_GET_FUN(__glewMultMatrixx)
-#define glMultiTexCoord4x GLEW_GET_FUN(__glewMultiTexCoord4x)
-#define glNormal3x GLEW_GET_FUN(__glewNormal3x)
-#define glOrthof GLEW_GET_FUN(__glewOrthof)
-#define glOrthox GLEW_GET_FUN(__glewOrthox)
-#define glPointSizex GLEW_GET_FUN(__glewPointSizex)
-#define glPolygonOffsetx GLEW_GET_FUN(__glewPolygonOffsetx)
-#define glRotatex GLEW_GET_FUN(__glewRotatex)
-#define glSampleCoveragex GLEW_GET_FUN(__glewSampleCoveragex)
-#define glScalex GLEW_GET_FUN(__glewScalex)
-#define glTexEnvx GLEW_GET_FUN(__glewTexEnvx)
-#define glTexEnvxv GLEW_GET_FUN(__glewTexEnvxv)
-#define glTexParameterx GLEW_GET_FUN(__glewTexParameterx)
-#define glTranslatex GLEW_GET_FUN(__glewTranslatex)
-
-#define GLEW_REGAL_ES1_0_compatibility GLEW_GET_VAR(__GLEW_REGAL_ES1_0_compatibility)
-
-#endif /* GL_REGAL_ES1_0_compatibility */
-
-/* ---------------------- GL_REGAL_ES1_1_compatibility --------------------- */
-
-#ifndef GL_REGAL_ES1_1_compatibility
-#define GL_REGAL_ES1_1_compatibility 1
-
-typedef void (GLAPIENTRY * PFNGLCLIPPLANEFPROC) (GLenum plane, const GLfloat* equation);
-typedef void (GLAPIENTRY * PFNGLCLIPPLANEXPROC) (GLenum plane, const GLfixed* equation);
-typedef void (GLAPIENTRY * PFNGLGETCLIPPLANEFPROC) (GLenum pname, GLfloat eqn[4]);
-typedef void (GLAPIENTRY * PFNGLGETCLIPPLANEXPROC) (GLenum pname, GLfixed eqn[4]);
-typedef void (GLAPIENTRY * PFNGLGETFIXEDVPROC) (GLenum pname, GLfixed* params);
-typedef void (GLAPIENTRY * PFNGLGETLIGHTXVPROC) (GLenum light, GLenum pname, GLfixed* params);
-typedef void (GLAPIENTRY * PFNGLGETMATERIALXVPROC) (GLenum face, GLenum pname, GLfixed* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXENVXVPROC) (GLenum env, GLenum pname, GLfixed* params);
-typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERXVPROC) (GLenum target, GLenum pname, GLfixed* params);
-typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERXPROC) (GLenum pname, GLfixed param);
-typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERXVPROC) (GLenum pname, const GLfixed* params);
-typedef void (GLAPIENTRY * PFNGLPOINTSIZEPOINTEROESPROC) (GLenum type, GLsizei stride, const void *pointer);
-typedef void (GLAPIENTRY * PFNGLTEXPARAMETERXVPROC) (GLenum target, GLenum pname, const GLfixed* params);
-
-#define glClipPlanef GLEW_GET_FUN(__glewClipPlanef)
-#define glClipPlanex GLEW_GET_FUN(__glewClipPlanex)
-#define glGetClipPlanef GLEW_GET_FUN(__glewGetClipPlanef)
-#define glGetClipPlanex GLEW_GET_FUN(__glewGetClipPlanex)
-#define glGetFixedv GLEW_GET_FUN(__glewGetFixedv)
-#define glGetLightxv GLEW_GET_FUN(__glewGetLightxv)
-#define glGetMaterialxv GLEW_GET_FUN(__glewGetMaterialxv)
-#define glGetTexEnvxv GLEW_GET_FUN(__glewGetTexEnvxv)
-#define glGetTexParameterxv GLEW_GET_FUN(__glewGetTexParameterxv)
-#define glPointParameterx GLEW_GET_FUN(__glewPointParameterx)
-#define glPointParameterxv GLEW_GET_FUN(__glewPointParameterxv)
-#define glPointSizePointerOES GLEW_GET_FUN(__glewPointSizePointerOES)
-#define glTexParameterxv GLEW_GET_FUN(__glewTexParameterxv)
-
-#define GLEW_REGAL_ES1_1_compatibility GLEW_GET_VAR(__GLEW_REGAL_ES1_1_compatibility)
-
-#endif /* GL_REGAL_ES1_1_compatibility */
-
-/* ---------------------------- GL_REGAL_enable ---------------------------- */
-
-#ifndef GL_REGAL_enable
-#define GL_REGAL_enable 1
-
-#define GL_ERROR_REGAL 0x9322
-#define GL_DEBUG_REGAL 0x9323
-#define GL_LOG_REGAL 0x9324
-#define GL_EMULATION_REGAL 0x9325
-#define GL_DRIVER_REGAL 0x9326
-#define GL_MISSING_REGAL 0x9360
-#define GL_TRACE_REGAL 0x9361
-#define GL_CACHE_REGAL 0x9362
-#define GL_CODE_REGAL 0x9363
-#define GL_STATISTICS_REGAL 0x9364
-
-#define GLEW_REGAL_enable GLEW_GET_VAR(__GLEW_REGAL_enable)
-
-#endif /* GL_REGAL_enable */
-
-/* ------------------------- GL_REGAL_error_string ------------------------- */
-
-#ifndef GL_REGAL_error_string
-#define GL_REGAL_error_string 1
-
-typedef const GLchar* (GLAPIENTRY * PFNGLERRORSTRINGREGALPROC) (GLenum error);
-
-#define glErrorStringREGAL GLEW_GET_FUN(__glewErrorStringREGAL)
-
-#define GLEW_REGAL_error_string GLEW_GET_VAR(__GLEW_REGAL_error_string)
-
-#endif /* GL_REGAL_error_string */
-
-/* ------------------------ GL_REGAL_extension_query ----------------------- */
-
-#ifndef GL_REGAL_extension_query
-#define GL_REGAL_extension_query 1
-
-typedef GLboolean (GLAPIENTRY * PFNGLGETEXTENSIONREGALPROC) (const GLchar* ext);
-typedef GLboolean (GLAPIENTRY * PFNGLISSUPPORTEDREGALPROC) (const GLchar* ext);
-
-#define glGetExtensionREGAL GLEW_GET_FUN(__glewGetExtensionREGAL)
-#define glIsSupportedREGAL GLEW_GET_FUN(__glewIsSupportedREGAL)
-
-#define GLEW_REGAL_extension_query GLEW_GET_VAR(__GLEW_REGAL_extension_query)
-
-#endif /* GL_REGAL_extension_query */
-
-/* ------------------------------ GL_REGAL_log ----------------------------- */
-
-#ifndef GL_REGAL_log
-#define GL_REGAL_log 1
-
-#define GL_LOG_ERROR_REGAL 0x9319
-#define GL_LOG_WARNING_REGAL 0x931A
-#define GL_LOG_INFO_REGAL 0x931B
-#define GL_LOG_APP_REGAL 0x931C
-#define GL_LOG_DRIVER_REGAL 0x931D
-#define GL_LOG_INTERNAL_REGAL 0x931E
-#define GL_LOG_DEBUG_REGAL 0x931F
-#define GL_LOG_STATUS_REGAL 0x9320
-#define GL_LOG_HTTP_REGAL 0x9321
-
-typedef void (APIENTRY *GLLOGPROCREGAL)(GLenum stream, GLsizei length, const GLchar *message, void *context);
-
-typedef void (GLAPIENTRY * PFNGLLOGMESSAGECALLBACKREGALPROC) (GLLOGPROCREGAL callback);
-
-#define glLogMessageCallbackREGAL GLEW_GET_FUN(__glewLogMessageCallbackREGAL)
-
-#define GLEW_REGAL_log GLEW_GET_VAR(__GLEW_REGAL_log)
-
-#endif /* GL_REGAL_log */
-
-/* ------------------------- GL_REGAL_proc_address ------------------------- */
-
-#ifndef GL_REGAL_proc_address
-#define GL_REGAL_proc_address 1
-
-typedef void * (GLAPIENTRY * PFNGLGETPROCADDRESSREGALPROC) (const GLchar *name);
-
-#define glGetProcAddressREGAL GLEW_GET_FUN(__glewGetProcAddressREGAL)
-
-#define GLEW_REGAL_proc_address GLEW_GET_VAR(__GLEW_REGAL_proc_address)
-
-#endif /* GL_REGAL_proc_address */
-
-/* ----------------------- GL_REND_screen_coordinates ---------------------- */
-
-#ifndef GL_REND_screen_coordinates
-#define GL_REND_screen_coordinates 1
-
-#define GL_SCREEN_COORDINATES_REND 0x8490
-#define GL_INVERTED_SCREEN_W_REND 0x8491
-
-#define GLEW_REND_screen_coordinates GLEW_GET_VAR(__GLEW_REND_screen_coordinates)
-
-#endif /* GL_REND_screen_coordinates */
-
-/* ------------------------------- GL_S3_s3tc ------------------------------ */
-
-#ifndef GL_S3_s3tc
-#define GL_S3_s3tc 1
-
-#define GL_RGB_S3TC 0x83A0
-#define GL_RGB4_S3TC 0x83A1
-#define GL_RGBA_S3TC 0x83A2
-#define GL_RGBA4_S3TC 0x83A3
-#define GL_RGBA_DXT5_S3TC 0x83A4
-#define GL_RGBA4_DXT5_S3TC 0x83A5
-
-#define GLEW_S3_s3tc GLEW_GET_VAR(__GLEW_S3_s3tc)
-
-#endif /* GL_S3_s3tc */
-
-/* -------------------------- GL_SGIS_color_range -------------------------- */
-
-#ifndef GL_SGIS_color_range
-#define GL_SGIS_color_range 1
-
-#define GL_EXTENDED_RANGE_SGIS 0x85A5
-#define GL_MIN_RED_SGIS 0x85A6
-#define GL_MAX_RED_SGIS 0x85A7
-#define GL_MIN_GREEN_SGIS 0x85A8
-#define GL_MAX_GREEN_SGIS 0x85A9
-#define GL_MIN_BLUE_SGIS 0x85AA
-#define GL_MAX_BLUE_SGIS 0x85AB
-#define GL_MIN_ALPHA_SGIS 0x85AC
-#define GL_MAX_ALPHA_SGIS 0x85AD
-
-#define GLEW_SGIS_color_range GLEW_GET_VAR(__GLEW_SGIS_color_range)
-
-#endif /* GL_SGIS_color_range */
-
-/* ------------------------- GL_SGIS_detail_texture ------------------------ */
-
-#ifndef GL_SGIS_detail_texture
-#define GL_SGIS_detail_texture 1
-
-typedef void (GLAPIENTRY * PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat* points);
-typedef void (GLAPIENTRY * PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat* points);
-
-#define glDetailTexFuncSGIS GLEW_GET_FUN(__glewDetailTexFuncSGIS)
-#define glGetDetailTexFuncSGIS GLEW_GET_FUN(__glewGetDetailTexFuncSGIS)
-
-#define GLEW_SGIS_detail_texture GLEW_GET_VAR(__GLEW_SGIS_detail_texture)
-
-#endif /* GL_SGIS_detail_texture */
-
-/* -------------------------- GL_SGIS_fog_function ------------------------- */
-
-#ifndef GL_SGIS_fog_function
-#define GL_SGIS_fog_function 1
-
-typedef void (GLAPIENTRY * PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat* points);
-typedef void (GLAPIENTRY * PFNGLGETFOGFUNCSGISPROC) (GLfloat* points);
-
-#define glFogFuncSGIS GLEW_GET_FUN(__glewFogFuncSGIS)
-#define glGetFogFuncSGIS GLEW_GET_FUN(__glewGetFogFuncSGIS)
-
-#define GLEW_SGIS_fog_function GLEW_GET_VAR(__GLEW_SGIS_fog_function)
-
-#endif /* GL_SGIS_fog_function */
-
-/* ------------------------ GL_SGIS_generate_mipmap ------------------------ */
-
-#ifndef GL_SGIS_generate_mipmap
-#define GL_SGIS_generate_mipmap 1
-
-#define GL_GENERATE_MIPMAP_SGIS 0x8191
-#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
-
-#define GLEW_SGIS_generate_mipmap GLEW_GET_VAR(__GLEW_SGIS_generate_mipmap)
-
-#endif /* GL_SGIS_generate_mipmap */
-
-/* -------------------------- GL_SGIS_multisample -------------------------- */
-
-#ifndef GL_SGIS_multisample
-#define GL_SGIS_multisample 1
-
-#define GL_MULTISAMPLE_SGIS 0x809D
-#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F
-#define GL_SAMPLE_MASK_SGIS 0x80A0
-#define GL_1PASS_SGIS 0x80A1
-#define GL_2PASS_0_SGIS 0x80A2
-#define GL_2PASS_1_SGIS 0x80A3
-#define GL_4PASS_0_SGIS 0x80A4
-#define GL_4PASS_1_SGIS 0x80A5
-#define GL_4PASS_2_SGIS 0x80A6
-#define GL_4PASS_3_SGIS 0x80A7
-#define GL_SAMPLE_BUFFERS_SGIS 0x80A8
-#define GL_SAMPLES_SGIS 0x80A9
-#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA
-#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB
-#define GL_SAMPLE_PATTERN_SGIS 0x80AC
-
-typedef void (GLAPIENTRY * PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert);
-typedef void (GLAPIENTRY * PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern);
-
-#define glSampleMaskSGIS GLEW_GET_FUN(__glewSampleMaskSGIS)
-#define glSamplePatternSGIS GLEW_GET_FUN(__glewSamplePatternSGIS)
-
-#define GLEW_SGIS_multisample GLEW_GET_VAR(__GLEW_SGIS_multisample)
-
-#endif /* GL_SGIS_multisample */
-
-/* ------------------------- GL_SGIS_pixel_texture ------------------------- */
-
-#ifndef GL_SGIS_pixel_texture
-#define GL_SGIS_pixel_texture 1
-
-#define GLEW_SGIS_pixel_texture GLEW_GET_VAR(__GLEW_SGIS_pixel_texture)
-
-#endif /* GL_SGIS_pixel_texture */
-
-/* ----------------------- GL_SGIS_point_line_texgen ----------------------- */
-
-#ifndef GL_SGIS_point_line_texgen
-#define GL_SGIS_point_line_texgen 1
-
-#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0
-#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1
-#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2
-#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3
-#define GL_EYE_POINT_SGIS 0x81F4
-#define GL_OBJECT_POINT_SGIS 0x81F5
-#define GL_EYE_LINE_SGIS 0x81F6
-#define GL_OBJECT_LINE_SGIS 0x81F7
-
-#define GLEW_SGIS_point_line_texgen GLEW_GET_VAR(__GLEW_SGIS_point_line_texgen)
-
-#endif /* GL_SGIS_point_line_texgen */
-
-/* ------------------------ GL_SGIS_sharpen_texture ------------------------ */
-
-#ifndef GL_SGIS_sharpen_texture
-#define GL_SGIS_sharpen_texture 1
-
-typedef void (GLAPIENTRY * PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat* points);
-typedef void (GLAPIENTRY * PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat* points);
-
-#define glGetSharpenTexFuncSGIS GLEW_GET_FUN(__glewGetSharpenTexFuncSGIS)
-#define glSharpenTexFuncSGIS GLEW_GET_FUN(__glewSharpenTexFuncSGIS)
-
-#define GLEW_SGIS_sharpen_texture GLEW_GET_VAR(__GLEW_SGIS_sharpen_texture)
-
-#endif /* GL_SGIS_sharpen_texture */
-
-/* --------------------------- GL_SGIS_texture4D --------------------------- */
-
-#ifndef GL_SGIS_texture4D
-#define GL_SGIS_texture4D 1
-
-typedef void (GLAPIENTRY * PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLenum format, GLenum type, const void *pixels);
-
-#define glTexImage4DSGIS GLEW_GET_FUN(__glewTexImage4DSGIS)
-#define glTexSubImage4DSGIS GLEW_GET_FUN(__glewTexSubImage4DSGIS)
-
-#define GLEW_SGIS_texture4D GLEW_GET_VAR(__GLEW_SGIS_texture4D)
-
-#endif /* GL_SGIS_texture4D */
-
-/* ---------------------- GL_SGIS_texture_border_clamp --------------------- */
-
-#ifndef GL_SGIS_texture_border_clamp
-#define GL_SGIS_texture_border_clamp 1
-
-#define GL_CLAMP_TO_BORDER_SGIS 0x812D
-
-#define GLEW_SGIS_texture_border_clamp GLEW_GET_VAR(__GLEW_SGIS_texture_border_clamp)
-
-#endif /* GL_SGIS_texture_border_clamp */
-
-/* ----------------------- GL_SGIS_texture_edge_clamp ---------------------- */
-
-#ifndef GL_SGIS_texture_edge_clamp
-#define GL_SGIS_texture_edge_clamp 1
-
-#define GL_CLAMP_TO_EDGE_SGIS 0x812F
-
-#define GLEW_SGIS_texture_edge_clamp GLEW_GET_VAR(__GLEW_SGIS_texture_edge_clamp)
-
-#endif /* GL_SGIS_texture_edge_clamp */
-
-/* ------------------------ GL_SGIS_texture_filter4 ------------------------ */
-
-#ifndef GL_SGIS_texture_filter4
-#define GL_SGIS_texture_filter4 1
-
-typedef void (GLAPIENTRY * PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat* weights);
-typedef void (GLAPIENTRY * PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat* weights);
-
-#define glGetTexFilterFuncSGIS GLEW_GET_FUN(__glewGetTexFilterFuncSGIS)
-#define glTexFilterFuncSGIS GLEW_GET_FUN(__glewTexFilterFuncSGIS)
-
-#define GLEW_SGIS_texture_filter4 GLEW_GET_VAR(__GLEW_SGIS_texture_filter4)
-
-#endif /* GL_SGIS_texture_filter4 */
-
-/* -------------------------- GL_SGIS_texture_lod -------------------------- */
-
-#ifndef GL_SGIS_texture_lod
-#define GL_SGIS_texture_lod 1
-
-#define GL_TEXTURE_MIN_LOD_SGIS 0x813A
-#define GL_TEXTURE_MAX_LOD_SGIS 0x813B
-#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C
-#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D
-
-#define GLEW_SGIS_texture_lod GLEW_GET_VAR(__GLEW_SGIS_texture_lod)
-
-#endif /* GL_SGIS_texture_lod */
-
-/* ------------------------- GL_SGIS_texture_select ------------------------ */
-
-#ifndef GL_SGIS_texture_select
-#define GL_SGIS_texture_select 1
-
-#define GLEW_SGIS_texture_select GLEW_GET_VAR(__GLEW_SGIS_texture_select)
-
-#endif /* GL_SGIS_texture_select */
-
-/* ----------------------------- GL_SGIX_async ----------------------------- */
-
-#ifndef GL_SGIX_async
-#define GL_SGIX_async 1
-
-#define GL_ASYNC_MARKER_SGIX 0x8329
-
-typedef void (GLAPIENTRY * PFNGLASYNCMARKERSGIXPROC) (GLuint marker);
-typedef void (GLAPIENTRY * PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range);
-typedef GLint (GLAPIENTRY * PFNGLFINISHASYNCSGIXPROC) (GLuint* markerp);
-typedef GLuint (GLAPIENTRY * PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range);
-typedef GLboolean (GLAPIENTRY * PFNGLISASYNCMARKERSGIXPROC) (GLuint marker);
-typedef GLint (GLAPIENTRY * PFNGLPOLLASYNCSGIXPROC) (GLuint* markerp);
-
-#define glAsyncMarkerSGIX GLEW_GET_FUN(__glewAsyncMarkerSGIX)
-#define glDeleteAsyncMarkersSGIX GLEW_GET_FUN(__glewDeleteAsyncMarkersSGIX)
-#define glFinishAsyncSGIX GLEW_GET_FUN(__glewFinishAsyncSGIX)
-#define glGenAsyncMarkersSGIX GLEW_GET_FUN(__glewGenAsyncMarkersSGIX)
-#define glIsAsyncMarkerSGIX GLEW_GET_FUN(__glewIsAsyncMarkerSGIX)
-#define glPollAsyncSGIX GLEW_GET_FUN(__glewPollAsyncSGIX)
-
-#define GLEW_SGIX_async GLEW_GET_VAR(__GLEW_SGIX_async)
-
-#endif /* GL_SGIX_async */
-
-/* ------------------------ GL_SGIX_async_histogram ------------------------ */
-
-#ifndef GL_SGIX_async_histogram
-#define GL_SGIX_async_histogram 1
-
-#define GL_ASYNC_HISTOGRAM_SGIX 0x832C
-#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D
-
-#define GLEW_SGIX_async_histogram GLEW_GET_VAR(__GLEW_SGIX_async_histogram)
-
-#endif /* GL_SGIX_async_histogram */
-
-/* -------------------------- GL_SGIX_async_pixel -------------------------- */
-
-#ifndef GL_SGIX_async_pixel
-#define GL_SGIX_async_pixel 1
-
-#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C
-#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D
-#define GL_ASYNC_READ_PIXELS_SGIX 0x835E
-#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F
-#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360
-#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361
-
-#define GLEW_SGIX_async_pixel GLEW_GET_VAR(__GLEW_SGIX_async_pixel)
-
-#endif /* GL_SGIX_async_pixel */
-
-/* ----------------------- GL_SGIX_blend_alpha_minmax ---------------------- */
-
-#ifndef GL_SGIX_blend_alpha_minmax
-#define GL_SGIX_blend_alpha_minmax 1
-
-#define GL_ALPHA_MIN_SGIX 0x8320
-#define GL_ALPHA_MAX_SGIX 0x8321
-
-#define GLEW_SGIX_blend_alpha_minmax GLEW_GET_VAR(__GLEW_SGIX_blend_alpha_minmax)
-
-#endif /* GL_SGIX_blend_alpha_minmax */
-
-/* ---------------------------- GL_SGIX_clipmap ---------------------------- */
-
-#ifndef GL_SGIX_clipmap
-#define GL_SGIX_clipmap 1
-
-#define GLEW_SGIX_clipmap GLEW_GET_VAR(__GLEW_SGIX_clipmap)
-
-#endif /* GL_SGIX_clipmap */
-
-/* ---------------------- GL_SGIX_convolution_accuracy --------------------- */
-
-#ifndef GL_SGIX_convolution_accuracy
-#define GL_SGIX_convolution_accuracy 1
-
-#define GL_CONVOLUTION_HINT_SGIX 0x8316
-
-#define GLEW_SGIX_convolution_accuracy GLEW_GET_VAR(__GLEW_SGIX_convolution_accuracy)
-
-#endif /* GL_SGIX_convolution_accuracy */
-
-/* ------------------------- GL_SGIX_depth_texture ------------------------- */
-
-#ifndef GL_SGIX_depth_texture
-#define GL_SGIX_depth_texture 1
-
-#define GL_DEPTH_COMPONENT16_SGIX 0x81A5
-#define GL_DEPTH_COMPONENT24_SGIX 0x81A6
-#define GL_DEPTH_COMPONENT32_SGIX 0x81A7
-
-#define GLEW_SGIX_depth_texture GLEW_GET_VAR(__GLEW_SGIX_depth_texture)
-
-#endif /* GL_SGIX_depth_texture */
-
-/* -------------------------- GL_SGIX_flush_raster ------------------------- */
-
-#ifndef GL_SGIX_flush_raster
-#define GL_SGIX_flush_raster 1
-
-typedef void (GLAPIENTRY * PFNGLFLUSHRASTERSGIXPROC) (void);
-
-#define glFlushRasterSGIX GLEW_GET_FUN(__glewFlushRasterSGIX)
-
-#define GLEW_SGIX_flush_raster GLEW_GET_VAR(__GLEW_SGIX_flush_raster)
-
-#endif /* GL_SGIX_flush_raster */
-
-/* --------------------------- GL_SGIX_fog_offset -------------------------- */
-
-#ifndef GL_SGIX_fog_offset
-#define GL_SGIX_fog_offset 1
-
-#define GL_FOG_OFFSET_SGIX 0x8198
-#define GL_FOG_OFFSET_VALUE_SGIX 0x8199
-
-#define GLEW_SGIX_fog_offset GLEW_GET_VAR(__GLEW_SGIX_fog_offset)
-
-#endif /* GL_SGIX_fog_offset */
-
-/* -------------------------- GL_SGIX_fog_texture -------------------------- */
-
-#ifndef GL_SGIX_fog_texture
-#define GL_SGIX_fog_texture 1
-
-#define GL_FOG_PATCHY_FACTOR_SGIX 0
-#define GL_FRAGMENT_FOG_SGIX 0
-#define GL_TEXTURE_FOG_SGIX 0
-
-typedef void (GLAPIENTRY * PFNGLTEXTUREFOGSGIXPROC) (GLenum pname);
-
-#define glTextureFogSGIX GLEW_GET_FUN(__glewTextureFogSGIX)
-
-#define GLEW_SGIX_fog_texture GLEW_GET_VAR(__GLEW_SGIX_fog_texture)
-
-#endif /* GL_SGIX_fog_texture */
-
-/* ------------------- GL_SGIX_fragment_specular_lighting ------------------ */
-
-#ifndef GL_SGIX_fragment_specular_lighting
-#define GL_SGIX_fragment_specular_lighting 1
-
-typedef void (GLAPIENTRY * PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, const GLfloat param);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, const GLint param);
-typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum value, GLfloat* data);
-typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum value, GLint* data);
-typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* data);
-typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* data);
-
-#define glFragmentColorMaterialSGIX GLEW_GET_FUN(__glewFragmentColorMaterialSGIX)
-#define glFragmentLightModelfSGIX GLEW_GET_FUN(__glewFragmentLightModelfSGIX)
-#define glFragmentLightModelfvSGIX GLEW_GET_FUN(__glewFragmentLightModelfvSGIX)
-#define glFragmentLightModeliSGIX GLEW_GET_FUN(__glewFragmentLightModeliSGIX)
-#define glFragmentLightModelivSGIX GLEW_GET_FUN(__glewFragmentLightModelivSGIX)
-#define glFragmentLightfSGIX GLEW_GET_FUN(__glewFragmentLightfSGIX)
-#define glFragmentLightfvSGIX GLEW_GET_FUN(__glewFragmentLightfvSGIX)
-#define glFragmentLightiSGIX GLEW_GET_FUN(__glewFragmentLightiSGIX)
-#define glFragmentLightivSGIX GLEW_GET_FUN(__glewFragmentLightivSGIX)
-#define glFragmentMaterialfSGIX GLEW_GET_FUN(__glewFragmentMaterialfSGIX)
-#define glFragmentMaterialfvSGIX GLEW_GET_FUN(__glewFragmentMaterialfvSGIX)
-#define glFragmentMaterialiSGIX GLEW_GET_FUN(__glewFragmentMaterialiSGIX)
-#define glFragmentMaterialivSGIX GLEW_GET_FUN(__glewFragmentMaterialivSGIX)
-#define glGetFragmentLightfvSGIX GLEW_GET_FUN(__glewGetFragmentLightfvSGIX)
-#define glGetFragmentLightivSGIX GLEW_GET_FUN(__glewGetFragmentLightivSGIX)
-#define glGetFragmentMaterialfvSGIX GLEW_GET_FUN(__glewGetFragmentMaterialfvSGIX)
-#define glGetFragmentMaterialivSGIX GLEW_GET_FUN(__glewGetFragmentMaterialivSGIX)
-
-#define GLEW_SGIX_fragment_specular_lighting GLEW_GET_VAR(__GLEW_SGIX_fragment_specular_lighting)
-
-#endif /* GL_SGIX_fragment_specular_lighting */
-
-/* --------------------------- GL_SGIX_framezoom --------------------------- */
-
-#ifndef GL_SGIX_framezoom
-#define GL_SGIX_framezoom 1
-
-typedef void (GLAPIENTRY * PFNGLFRAMEZOOMSGIXPROC) (GLint factor);
-
-#define glFrameZoomSGIX GLEW_GET_FUN(__glewFrameZoomSGIX)
-
-#define GLEW_SGIX_framezoom GLEW_GET_VAR(__GLEW_SGIX_framezoom)
-
-#endif /* GL_SGIX_framezoom */
-
-/* --------------------------- GL_SGIX_interlace --------------------------- */
-
-#ifndef GL_SGIX_interlace
-#define GL_SGIX_interlace 1
-
-#define GL_INTERLACE_SGIX 0x8094
-
-#define GLEW_SGIX_interlace GLEW_GET_VAR(__GLEW_SGIX_interlace)
-
-#endif /* GL_SGIX_interlace */
-
-/* ------------------------- GL_SGIX_ir_instrument1 ------------------------ */
-
-#ifndef GL_SGIX_ir_instrument1
-#define GL_SGIX_ir_instrument1 1
-
-#define GLEW_SGIX_ir_instrument1 GLEW_GET_VAR(__GLEW_SGIX_ir_instrument1)
-
-#endif /* GL_SGIX_ir_instrument1 */
-
-/* ------------------------- GL_SGIX_list_priority ------------------------- */
-
-#ifndef GL_SGIX_list_priority
-#define GL_SGIX_list_priority 1
-
-#define GLEW_SGIX_list_priority GLEW_GET_VAR(__GLEW_SGIX_list_priority)
-
-#endif /* GL_SGIX_list_priority */
-
-/* ------------------------- GL_SGIX_pixel_texture ------------------------- */
-
-#ifndef GL_SGIX_pixel_texture
-#define GL_SGIX_pixel_texture 1
-
-typedef void (GLAPIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode);
-
-#define glPixelTexGenSGIX GLEW_GET_FUN(__glewPixelTexGenSGIX)
-
-#define GLEW_SGIX_pixel_texture GLEW_GET_VAR(__GLEW_SGIX_pixel_texture)
-
-#endif /* GL_SGIX_pixel_texture */
-
-/* ----------------------- GL_SGIX_pixel_texture_bits ---------------------- */
-
-#ifndef GL_SGIX_pixel_texture_bits
-#define GL_SGIX_pixel_texture_bits 1
-
-#define GLEW_SGIX_pixel_texture_bits GLEW_GET_VAR(__GLEW_SGIX_pixel_texture_bits)
-
-#endif /* GL_SGIX_pixel_texture_bits */
-
-/* ------------------------ GL_SGIX_reference_plane ------------------------ */
-
-#ifndef GL_SGIX_reference_plane
-#define GL_SGIX_reference_plane 1
-
-typedef void (GLAPIENTRY * PFNGLREFERENCEPLANESGIXPROC) (const GLdouble* equation);
-
-#define glReferencePlaneSGIX GLEW_GET_FUN(__glewReferencePlaneSGIX)
-
-#define GLEW_SGIX_reference_plane GLEW_GET_VAR(__GLEW_SGIX_reference_plane)
-
-#endif /* GL_SGIX_reference_plane */
-
-/* ---------------------------- GL_SGIX_resample --------------------------- */
-
-#ifndef GL_SGIX_resample
-#define GL_SGIX_resample 1
-
-#define GL_PACK_RESAMPLE_SGIX 0x842E
-#define GL_UNPACK_RESAMPLE_SGIX 0x842F
-#define GL_RESAMPLE_DECIMATE_SGIX 0x8430
-#define GL_RESAMPLE_REPLICATE_SGIX 0x8433
-#define GL_RESAMPLE_ZERO_FILL_SGIX 0x8434
-
-#define GLEW_SGIX_resample GLEW_GET_VAR(__GLEW_SGIX_resample)
-
-#endif /* GL_SGIX_resample */
-
-/* ----------------------------- GL_SGIX_shadow ---------------------------- */
-
-#ifndef GL_SGIX_shadow
-#define GL_SGIX_shadow 1
-
-#define GL_TEXTURE_COMPARE_SGIX 0x819A
-#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B
-#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C
-#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D
-
-#define GLEW_SGIX_shadow GLEW_GET_VAR(__GLEW_SGIX_shadow)
-
-#endif /* GL_SGIX_shadow */
-
-/* ------------------------- GL_SGIX_shadow_ambient ------------------------ */
-
-#ifndef GL_SGIX_shadow_ambient
-#define GL_SGIX_shadow_ambient 1
-
-#define GL_SHADOW_AMBIENT_SGIX 0x80BF
-
-#define GLEW_SGIX_shadow_ambient GLEW_GET_VAR(__GLEW_SGIX_shadow_ambient)
-
-#endif /* GL_SGIX_shadow_ambient */
-
-/* ----------------------------- GL_SGIX_sprite ---------------------------- */
-
-#ifndef GL_SGIX_sprite
-#define GL_SGIX_sprite 1
-
-typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param);
-typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param);
-typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, GLint* params);
-
-#define glSpriteParameterfSGIX GLEW_GET_FUN(__glewSpriteParameterfSGIX)
-#define glSpriteParameterfvSGIX GLEW_GET_FUN(__glewSpriteParameterfvSGIX)
-#define glSpriteParameteriSGIX GLEW_GET_FUN(__glewSpriteParameteriSGIX)
-#define glSpriteParameterivSGIX GLEW_GET_FUN(__glewSpriteParameterivSGIX)
-
-#define GLEW_SGIX_sprite GLEW_GET_VAR(__GLEW_SGIX_sprite)
-
-#endif /* GL_SGIX_sprite */
-
-/* ----------------------- GL_SGIX_tag_sample_buffer ----------------------- */
-
-#ifndef GL_SGIX_tag_sample_buffer
-#define GL_SGIX_tag_sample_buffer 1
-
-typedef void (GLAPIENTRY * PFNGLTAGSAMPLEBUFFERSGIXPROC) (void);
-
-#define glTagSampleBufferSGIX GLEW_GET_FUN(__glewTagSampleBufferSGIX)
-
-#define GLEW_SGIX_tag_sample_buffer GLEW_GET_VAR(__GLEW_SGIX_tag_sample_buffer)
-
-#endif /* GL_SGIX_tag_sample_buffer */
-
-/* ------------------------ GL_SGIX_texture_add_env ------------------------ */
-
-#ifndef GL_SGIX_texture_add_env
-#define GL_SGIX_texture_add_env 1
-
-#define GLEW_SGIX_texture_add_env GLEW_GET_VAR(__GLEW_SGIX_texture_add_env)
-
-#endif /* GL_SGIX_texture_add_env */
-
-/* -------------------- GL_SGIX_texture_coordinate_clamp ------------------- */
-
-#ifndef GL_SGIX_texture_coordinate_clamp
-#define GL_SGIX_texture_coordinate_clamp 1
-
-#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369
-#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A
-#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B
-
-#define GLEW_SGIX_texture_coordinate_clamp GLEW_GET_VAR(__GLEW_SGIX_texture_coordinate_clamp)
-
-#endif /* GL_SGIX_texture_coordinate_clamp */
-
-/* ------------------------ GL_SGIX_texture_lod_bias ----------------------- */
-
-#ifndef GL_SGIX_texture_lod_bias
-#define GL_SGIX_texture_lod_bias 1
-
-#define GLEW_SGIX_texture_lod_bias GLEW_GET_VAR(__GLEW_SGIX_texture_lod_bias)
-
-#endif /* GL_SGIX_texture_lod_bias */
-
-/* ---------------------- GL_SGIX_texture_multi_buffer --------------------- */
-
-#ifndef GL_SGIX_texture_multi_buffer
-#define GL_SGIX_texture_multi_buffer 1
-
-#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E
-
-#define GLEW_SGIX_texture_multi_buffer GLEW_GET_VAR(__GLEW_SGIX_texture_multi_buffer)
-
-#endif /* GL_SGIX_texture_multi_buffer */
-
-/* ------------------------- GL_SGIX_texture_range ------------------------- */
-
-#ifndef GL_SGIX_texture_range
-#define GL_SGIX_texture_range 1
-
-#define GL_RGB_SIGNED_SGIX 0x85E0
-#define GL_RGBA_SIGNED_SGIX 0x85E1
-#define GL_ALPHA_SIGNED_SGIX 0x85E2
-#define GL_LUMINANCE_SIGNED_SGIX 0x85E3
-#define GL_INTENSITY_SIGNED_SGIX 0x85E4
-#define GL_LUMINANCE_ALPHA_SIGNED_SGIX 0x85E5
-#define GL_RGB16_SIGNED_SGIX 0x85E6
-#define GL_RGBA16_SIGNED_SGIX 0x85E7
-#define GL_ALPHA16_SIGNED_SGIX 0x85E8
-#define GL_LUMINANCE16_SIGNED_SGIX 0x85E9
-#define GL_INTENSITY16_SIGNED_SGIX 0x85EA
-#define GL_LUMINANCE16_ALPHA16_SIGNED_SGIX 0x85EB
-#define GL_RGB_EXTENDED_RANGE_SGIX 0x85EC
-#define GL_RGBA_EXTENDED_RANGE_SGIX 0x85ED
-#define GL_ALPHA_EXTENDED_RANGE_SGIX 0x85EE
-#define GL_LUMINANCE_EXTENDED_RANGE_SGIX 0x85EF
-#define GL_INTENSITY_EXTENDED_RANGE_SGIX 0x85F0
-#define GL_LUMINANCE_ALPHA_EXTENDED_RANGE_SGIX 0x85F1
-#define GL_RGB16_EXTENDED_RANGE_SGIX 0x85F2
-#define GL_RGBA16_EXTENDED_RANGE_SGIX 0x85F3
-#define GL_ALPHA16_EXTENDED_RANGE_SGIX 0x85F4
-#define GL_LUMINANCE16_EXTENDED_RANGE_SGIX 0x85F5
-#define GL_INTENSITY16_EXTENDED_RANGE_SGIX 0x85F6
-#define GL_LUMINANCE16_ALPHA16_EXTENDED_RANGE_SGIX 0x85F7
-#define GL_MIN_LUMINANCE_SGIS 0x85F8
-#define GL_MAX_LUMINANCE_SGIS 0x85F9
-#define GL_MIN_INTENSITY_SGIS 0x85FA
-#define GL_MAX_INTENSITY_SGIS 0x85FB
-
-#define GLEW_SGIX_texture_range GLEW_GET_VAR(__GLEW_SGIX_texture_range)
-
-#endif /* GL_SGIX_texture_range */
-
-/* ----------------------- GL_SGIX_texture_scale_bias ---------------------- */
-
-#ifndef GL_SGIX_texture_scale_bias
-#define GL_SGIX_texture_scale_bias 1
-
-#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179
-#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A
-#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B
-#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C
-
-#define GLEW_SGIX_texture_scale_bias GLEW_GET_VAR(__GLEW_SGIX_texture_scale_bias)
-
-#endif /* GL_SGIX_texture_scale_bias */
-
-/* ------------------------- GL_SGIX_vertex_preclip ------------------------ */
-
-#ifndef GL_SGIX_vertex_preclip
-#define GL_SGIX_vertex_preclip 1
-
-#define GL_VERTEX_PRECLIP_SGIX 0x83EE
-#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF
-
-#define GLEW_SGIX_vertex_preclip GLEW_GET_VAR(__GLEW_SGIX_vertex_preclip)
-
-#endif /* GL_SGIX_vertex_preclip */
-
-/* ---------------------- GL_SGIX_vertex_preclip_hint ---------------------- */
-
-#ifndef GL_SGIX_vertex_preclip_hint
-#define GL_SGIX_vertex_preclip_hint 1
-
-#define GL_VERTEX_PRECLIP_SGIX 0x83EE
-#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF
-
-#define GLEW_SGIX_vertex_preclip_hint GLEW_GET_VAR(__GLEW_SGIX_vertex_preclip_hint)
-
-#endif /* GL_SGIX_vertex_preclip_hint */
-
-/* ----------------------------- GL_SGIX_ycrcb ----------------------------- */
-
-#ifndef GL_SGIX_ycrcb
-#define GL_SGIX_ycrcb 1
-
-#define GLEW_SGIX_ycrcb GLEW_GET_VAR(__GLEW_SGIX_ycrcb)
-
-#endif /* GL_SGIX_ycrcb */
-
-/* -------------------------- GL_SGI_color_matrix -------------------------- */
-
-#ifndef GL_SGI_color_matrix
-#define GL_SGI_color_matrix 1
-
-#define GL_COLOR_MATRIX_SGI 0x80B1
-#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2
-#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3
-#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4
-#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5
-#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6
-#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7
-#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8
-#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9
-#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA
-#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB
-
-#define GLEW_SGI_color_matrix GLEW_GET_VAR(__GLEW_SGI_color_matrix)
-
-#endif /* GL_SGI_color_matrix */
-
-/* --------------------------- GL_SGI_color_table -------------------------- */
-
-#ifndef GL_SGI_color_table
-#define GL_SGI_color_table 1
-
-#define GL_COLOR_TABLE_SGI 0x80D0
-#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1
-#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2
-#define GL_PROXY_COLOR_TABLE_SGI 0x80D3
-#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4
-#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5
-#define GL_COLOR_TABLE_SCALE_SGI 0x80D6
-#define GL_COLOR_TABLE_BIAS_SGI 0x80D7
-#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8
-#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9
-#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA
-#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB
-#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC
-#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD
-#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE
-#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF
-
-typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint* params);
-typedef void (GLAPIENTRY * PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table);
-typedef void (GLAPIENTRY * PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat* params);
-typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint* params);
-typedef void (GLAPIENTRY * PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, void *table);
-
-#define glColorTableParameterfvSGI GLEW_GET_FUN(__glewColorTableParameterfvSGI)
-#define glColorTableParameterivSGI GLEW_GET_FUN(__glewColorTableParameterivSGI)
-#define glColorTableSGI GLEW_GET_FUN(__glewColorTableSGI)
-#define glCopyColorTableSGI GLEW_GET_FUN(__glewCopyColorTableSGI)
-#define glGetColorTableParameterfvSGI GLEW_GET_FUN(__glewGetColorTableParameterfvSGI)
-#define glGetColorTableParameterivSGI GLEW_GET_FUN(__glewGetColorTableParameterivSGI)
-#define glGetColorTableSGI GLEW_GET_FUN(__glewGetColorTableSGI)
-
-#define GLEW_SGI_color_table GLEW_GET_VAR(__GLEW_SGI_color_table)
-
-#endif /* GL_SGI_color_table */
-
-/* ----------------------- GL_SGI_texture_color_table ---------------------- */
-
-#ifndef GL_SGI_texture_color_table
-#define GL_SGI_texture_color_table 1
-
-#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC
-#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD
-
-#define GLEW_SGI_texture_color_table GLEW_GET_VAR(__GLEW_SGI_texture_color_table)
-
-#endif /* GL_SGI_texture_color_table */
-
-/* ------------------------- GL_SUNX_constant_data ------------------------- */
-
-#ifndef GL_SUNX_constant_data
-#define GL_SUNX_constant_data 1
-
-#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5
-#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6
-
-typedef void (GLAPIENTRY * PFNGLFINISHTEXTURESUNXPROC) (void);
-
-#define glFinishTextureSUNX GLEW_GET_FUN(__glewFinishTextureSUNX)
-
-#define GLEW_SUNX_constant_data GLEW_GET_VAR(__GLEW_SUNX_constant_data)
-
-#endif /* GL_SUNX_constant_data */
-
-/* -------------------- GL_SUN_convolution_border_modes -------------------- */
-
-#ifndef GL_SUN_convolution_border_modes
-#define GL_SUN_convolution_border_modes 1
-
-#define GL_WRAP_BORDER_SUN 0x81D4
-
-#define GLEW_SUN_convolution_border_modes GLEW_GET_VAR(__GLEW_SUN_convolution_border_modes)
-
-#endif /* GL_SUN_convolution_border_modes */
-
-/* -------------------------- GL_SUN_global_alpha -------------------------- */
-
-#ifndef GL_SUN_global_alpha
-#define GL_SUN_global_alpha 1
-
-#define GL_GLOBAL_ALPHA_SUN 0x81D9
-#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA
-
-typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor);
-typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor);
-typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor);
-typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor);
-typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor);
-typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor);
-typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor);
-typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor);
-
-#define glGlobalAlphaFactorbSUN GLEW_GET_FUN(__glewGlobalAlphaFactorbSUN)
-#define glGlobalAlphaFactordSUN GLEW_GET_FUN(__glewGlobalAlphaFactordSUN)
-#define glGlobalAlphaFactorfSUN GLEW_GET_FUN(__glewGlobalAlphaFactorfSUN)
-#define glGlobalAlphaFactoriSUN GLEW_GET_FUN(__glewGlobalAlphaFactoriSUN)
-#define glGlobalAlphaFactorsSUN GLEW_GET_FUN(__glewGlobalAlphaFactorsSUN)
-#define glGlobalAlphaFactorubSUN GLEW_GET_FUN(__glewGlobalAlphaFactorubSUN)
-#define glGlobalAlphaFactoruiSUN GLEW_GET_FUN(__glewGlobalAlphaFactoruiSUN)
-#define glGlobalAlphaFactorusSUN GLEW_GET_FUN(__glewGlobalAlphaFactorusSUN)
-
-#define GLEW_SUN_global_alpha GLEW_GET_VAR(__GLEW_SUN_global_alpha)
-
-#endif /* GL_SUN_global_alpha */
-
-/* --------------------------- GL_SUN_mesh_array --------------------------- */
-
-#ifndef GL_SUN_mesh_array
-#define GL_SUN_mesh_array 1
-
-#define GL_QUAD_MESH_SUN 0x8614
-#define GL_TRIANGLE_MESH_SUN 0x8615
-
-#define GLEW_SUN_mesh_array GLEW_GET_VAR(__GLEW_SUN_mesh_array)
-
-#endif /* GL_SUN_mesh_array */
-
-/* ------------------------ GL_SUN_read_video_pixels ----------------------- */
-
-#ifndef GL_SUN_read_video_pixels
-#define GL_SUN_read_video_pixels 1
-
-typedef void (GLAPIENTRY * PFNGLREADVIDEOPIXELSSUNPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels);
-
-#define glReadVideoPixelsSUN GLEW_GET_FUN(__glewReadVideoPixelsSUN)
-
-#define GLEW_SUN_read_video_pixels GLEW_GET_VAR(__GLEW_SUN_read_video_pixels)
-
-#endif /* GL_SUN_read_video_pixels */
-
-/* --------------------------- GL_SUN_slice_accum -------------------------- */
-
-#ifndef GL_SUN_slice_accum
-#define GL_SUN_slice_accum 1
-
-#define GL_SLICE_ACCUM_SUN 0x85CC
-
-#define GLEW_SUN_slice_accum GLEW_GET_VAR(__GLEW_SUN_slice_accum)
-
-#endif /* GL_SUN_slice_accum */
-
-/* -------------------------- GL_SUN_triangle_list ------------------------- */
-
-#ifndef GL_SUN_triangle_list
-#define GL_SUN_triangle_list 1
-
-#define GL_RESTART_SUN 0x01
-#define GL_REPLACE_MIDDLE_SUN 0x02
-#define GL_REPLACE_OLDEST_SUN 0x03
-#define GL_TRIANGLE_LIST_SUN 0x81D7
-#define GL_REPLACEMENT_CODE_SUN 0x81D8
-#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0
-#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1
-#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2
-#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3
-#define GL_R1UI_V3F_SUN 0x85C4
-#define GL_R1UI_C4UB_V3F_SUN 0x85C5
-#define GL_R1UI_C3F_V3F_SUN 0x85C6
-#define GL_R1UI_N3F_V3F_SUN 0x85C7
-#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8
-#define GL_R1UI_T2F_V3F_SUN 0x85C9
-#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA
-#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB
-
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const void *pointer);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte* code);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint* code);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort* code);
-
-#define glReplacementCodePointerSUN GLEW_GET_FUN(__glewReplacementCodePointerSUN)
-#define glReplacementCodeubSUN GLEW_GET_FUN(__glewReplacementCodeubSUN)
-#define glReplacementCodeubvSUN GLEW_GET_FUN(__glewReplacementCodeubvSUN)
-#define glReplacementCodeuiSUN GLEW_GET_FUN(__glewReplacementCodeuiSUN)
-#define glReplacementCodeuivSUN GLEW_GET_FUN(__glewReplacementCodeuivSUN)
-#define glReplacementCodeusSUN GLEW_GET_FUN(__glewReplacementCodeusSUN)
-#define glReplacementCodeusvSUN GLEW_GET_FUN(__glewReplacementCodeusvSUN)
-
-#define GLEW_SUN_triangle_list GLEW_GET_VAR(__GLEW_SUN_triangle_list)
-
-#endif /* GL_SUN_triangle_list */
-
-/* ----------------------------- GL_SUN_vertex ----------------------------- */
-
-#ifndef GL_SUN_vertex
-#define GL_SUN_vertex 1
-
-typedef void (GLAPIENTRY * PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat* c, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* c, const GLfloat *n, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);
-typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte* c, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte* c, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* n, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *c, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint* rc, const GLubyte *c, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *n, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat* tc, const GLubyte *c, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *n, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat* tc, const GLfloat *v);
-
-#define glColor3fVertex3fSUN GLEW_GET_FUN(__glewColor3fVertex3fSUN)
-#define glColor3fVertex3fvSUN GLEW_GET_FUN(__glewColor3fVertex3fvSUN)
-#define glColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewColor4fNormal3fVertex3fSUN)
-#define glColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewColor4fNormal3fVertex3fvSUN)
-#define glColor4ubVertex2fSUN GLEW_GET_FUN(__glewColor4ubVertex2fSUN)
-#define glColor4ubVertex2fvSUN GLEW_GET_FUN(__glewColor4ubVertex2fvSUN)
-#define glColor4ubVertex3fSUN GLEW_GET_FUN(__glewColor4ubVertex3fSUN)
-#define glColor4ubVertex3fvSUN GLEW_GET_FUN(__glewColor4ubVertex3fvSUN)
-#define glNormal3fVertex3fSUN GLEW_GET_FUN(__glewNormal3fVertex3fSUN)
-#define glNormal3fVertex3fvSUN GLEW_GET_FUN(__glewNormal3fVertex3fvSUN)
-#define glReplacementCodeuiColor3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor3fVertex3fSUN)
-#define glReplacementCodeuiColor3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor3fVertex3fvSUN)
-#define glReplacementCodeuiColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4fNormal3fVertex3fSUN)
-#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4fNormal3fVertex3fvSUN)
-#define glReplacementCodeuiColor4ubVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4ubVertex3fSUN)
-#define glReplacementCodeuiColor4ubVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4ubVertex3fvSUN)
-#define glReplacementCodeuiNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiNormal3fVertex3fSUN)
-#define glReplacementCodeuiNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiNormal3fVertex3fvSUN)
-#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN)
-#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN)
-#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN)
-#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN)
-#define glReplacementCodeuiTexCoord2fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fVertex3fSUN)
-#define glReplacementCodeuiTexCoord2fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fVertex3fvSUN)
-#define glReplacementCodeuiVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiVertex3fSUN)
-#define glReplacementCodeuiVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiVertex3fvSUN)
-#define glTexCoord2fColor3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor3fVertex3fSUN)
-#define glTexCoord2fColor3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor3fVertex3fvSUN)
-#define glTexCoord2fColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor4fNormal3fVertex3fSUN)
-#define glTexCoord2fColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor4fNormal3fVertex3fvSUN)
-#define glTexCoord2fColor4ubVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor4ubVertex3fSUN)
-#define glTexCoord2fColor4ubVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor4ubVertex3fvSUN)
-#define glTexCoord2fNormal3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fNormal3fVertex3fSUN)
-#define glTexCoord2fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fNormal3fVertex3fvSUN)
-#define glTexCoord2fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fVertex3fSUN)
-#define glTexCoord2fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fVertex3fvSUN)
-#define glTexCoord4fColor4fNormal3fVertex4fSUN GLEW_GET_FUN(__glewTexCoord4fColor4fNormal3fVertex4fSUN)
-#define glTexCoord4fColor4fNormal3fVertex4fvSUN GLEW_GET_FUN(__glewTexCoord4fColor4fNormal3fVertex4fvSUN)
-#define glTexCoord4fVertex4fSUN GLEW_GET_FUN(__glewTexCoord4fVertex4fSUN)
-#define glTexCoord4fVertex4fvSUN GLEW_GET_FUN(__glewTexCoord4fVertex4fvSUN)
-
-#define GLEW_SUN_vertex GLEW_GET_VAR(__GLEW_SUN_vertex)
-
-#endif /* GL_SUN_vertex */
-
-/* -------------------------- GL_WIN_phong_shading ------------------------- */
-
-#ifndef GL_WIN_phong_shading
-#define GL_WIN_phong_shading 1
-
-#define GL_PHONG_WIN 0x80EA
-#define GL_PHONG_HINT_WIN 0x80EB
-
-#define GLEW_WIN_phong_shading GLEW_GET_VAR(__GLEW_WIN_phong_shading)
-
-#endif /* GL_WIN_phong_shading */
-
-/* -------------------------- GL_WIN_specular_fog -------------------------- */
-
-#ifndef GL_WIN_specular_fog
-#define GL_WIN_specular_fog 1
-
-#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC
-
-#define GLEW_WIN_specular_fog GLEW_GET_VAR(__GLEW_WIN_specular_fog)
-
-#endif /* GL_WIN_specular_fog */
-
-/* ---------------------------- GL_WIN_swap_hint --------------------------- */
-
-#ifndef GL_WIN_swap_hint
-#define GL_WIN_swap_hint 1
-
-typedef void (GLAPIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
-
-#define glAddSwapHintRectWIN GLEW_GET_FUN(__glewAddSwapHintRectWIN)
-
-#define GLEW_WIN_swap_hint GLEW_GET_VAR(__GLEW_WIN_swap_hint)
-
-#endif /* GL_WIN_swap_hint */
-
-/* ------------------------------------------------------------------------- */
-
-#if defined(GLEW_MX) && defined(_WIN32)
-#define GLEW_FUN_EXPORT
-#else
-#define GLEW_FUN_EXPORT GLEWAPI
-#endif /* GLEW_MX */
-
-#if defined(GLEW_MX)
-#define GLEW_VAR_EXPORT
-#else
-#define GLEW_VAR_EXPORT GLEWAPI
-#endif /* GLEW_MX */
-
-#if defined(GLEW_MX) && defined(_WIN32)
-struct GLEWContextStruct
-{
-#endif /* GLEW_MX */
-
-GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D;
-GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements;
-GLEW_FUN_EXPORT PFNGLTEXIMAGE3DPROC __glewTexImage3D;
-GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DPROC __glewTexSubImage3D;
-
-GLEW_FUN_EXPORT PFNGLACTIVETEXTUREPROC __glewActiveTexture;
-GLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE1DPROC __glewCompressedTexImage1D;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE2DPROC __glewCompressedTexImage2D;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DPROC __glewCompressedTexImage3D;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC __glewCompressedTexSubImage1D;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC __glewCompressedTexSubImage2D;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC __glewCompressedTexSubImage3D;
-GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXIMAGEPROC __glewGetCompressedTexImage;
-GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDPROC __glewLoadTransposeMatrixd;
-GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFPROC __glewLoadTransposeMatrixf;
-GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDPROC __glewMultTransposeMatrixd;
-GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFPROC __glewMultTransposeMatrixf;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DPROC __glewMultiTexCoord1d;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVPROC __glewMultiTexCoord1dv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FPROC __glewMultiTexCoord1f;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVPROC __glewMultiTexCoord1fv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IPROC __glewMultiTexCoord1i;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVPROC __glewMultiTexCoord1iv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SPROC __glewMultiTexCoord1s;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVPROC __glewMultiTexCoord1sv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DPROC __glewMultiTexCoord2d;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVPROC __glewMultiTexCoord2dv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FPROC __glewMultiTexCoord2f;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVPROC __glewMultiTexCoord2fv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IPROC __glewMultiTexCoord2i;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IVPROC __glewMultiTexCoord2iv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SPROC __glewMultiTexCoord2s;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SVPROC __glewMultiTexCoord2sv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DPROC __glewMultiTexCoord3d;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DVPROC __glewMultiTexCoord3dv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FPROC __glewMultiTexCoord3f;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FVPROC __glewMultiTexCoord3fv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IPROC __glewMultiTexCoord3i;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IVPROC __glewMultiTexCoord3iv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SPROC __glewMultiTexCoord3s;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SVPROC __glewMultiTexCoord3sv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DPROC __glewMultiTexCoord4d;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DVPROC __glewMultiTexCoord4dv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FPROC __glewMultiTexCoord4f;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FVPROC __glewMultiTexCoord4fv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IPROC __glewMultiTexCoord4i;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IVPROC __glewMultiTexCoord4iv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SPROC __glewMultiTexCoord4s;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SVPROC __glewMultiTexCoord4sv;
-GLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEPROC __glewSampleCoverage;
-
-GLEW_FUN_EXPORT PFNGLBLENDCOLORPROC __glewBlendColor;
-GLEW_FUN_EXPORT PFNGLBLENDEQUATIONPROC __glewBlendEquation;
-GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEPROC __glewBlendFuncSeparate;
-GLEW_FUN_EXPORT PFNGLFOGCOORDPOINTERPROC __glewFogCoordPointer;
-GLEW_FUN_EXPORT PFNGLFOGCOORDDPROC __glewFogCoordd;
-GLEW_FUN_EXPORT PFNGLFOGCOORDDVPROC __glewFogCoorddv;
-GLEW_FUN_EXPORT PFNGLFOGCOORDFPROC __glewFogCoordf;
-GLEW_FUN_EXPORT PFNGLFOGCOORDFVPROC __glewFogCoordfv;
-GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSPROC __glewMultiDrawArrays;
-GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSPROC __glewMultiDrawElements;
-GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFPROC __glewPointParameterf;
-GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVPROC __glewPointParameterfv;
-GLEW_FUN_EXPORT PFNGLPOINTPARAMETERIPROC __glewPointParameteri;
-GLEW_FUN_EXPORT PFNGLPOINTPARAMETERIVPROC __glewPointParameteriv;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BPROC __glewSecondaryColor3b;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BVPROC __glewSecondaryColor3bv;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DPROC __glewSecondaryColor3d;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DVPROC __glewSecondaryColor3dv;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FPROC __glewSecondaryColor3f;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FVPROC __glewSecondaryColor3fv;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IPROC __glewSecondaryColor3i;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IVPROC __glewSecondaryColor3iv;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SPROC __glewSecondaryColor3s;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SVPROC __glewSecondaryColor3sv;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBPROC __glewSecondaryColor3ub;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBVPROC __glewSecondaryColor3ubv;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIPROC __glewSecondaryColor3ui;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIVPROC __glewSecondaryColor3uiv;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USPROC __glewSecondaryColor3us;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USVPROC __glewSecondaryColor3usv;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERPROC __glewSecondaryColorPointer;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2DPROC __glewWindowPos2d;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2DVPROC __glewWindowPos2dv;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2FPROC __glewWindowPos2f;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2FVPROC __glewWindowPos2fv;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2IPROC __glewWindowPos2i;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2IVPROC __glewWindowPos2iv;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2SPROC __glewWindowPos2s;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2SVPROC __glewWindowPos2sv;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3DPROC __glewWindowPos3d;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3DVPROC __glewWindowPos3dv;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3FPROC __glewWindowPos3f;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3FVPROC __glewWindowPos3fv;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3IPROC __glewWindowPos3i;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3IVPROC __glewWindowPos3iv;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3SPROC __glewWindowPos3s;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3SVPROC __glewWindowPos3sv;
-
-GLEW_FUN_EXPORT PFNGLBEGINQUERYPROC __glewBeginQuery;
-GLEW_FUN_EXPORT PFNGLBINDBUFFERPROC __glewBindBuffer;
-GLEW_FUN_EXPORT PFNGLBUFFERDATAPROC __glewBufferData;
-GLEW_FUN_EXPORT PFNGLBUFFERSUBDATAPROC __glewBufferSubData;
-GLEW_FUN_EXPORT PFNGLDELETEBUFFERSPROC __glewDeleteBuffers;
-GLEW_FUN_EXPORT PFNGLDELETEQUERIESPROC __glewDeleteQueries;
-GLEW_FUN_EXPORT PFNGLENDQUERYPROC __glewEndQuery;
-GLEW_FUN_EXPORT PFNGLGENBUFFERSPROC __glewGenBuffers;
-GLEW_FUN_EXPORT PFNGLGENQUERIESPROC __glewGenQueries;
-GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERIVPROC __glewGetBufferParameteriv;
-GLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVPROC __glewGetBufferPointerv;
-GLEW_FUN_EXPORT PFNGLGETBUFFERSUBDATAPROC __glewGetBufferSubData;
-GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVPROC __glewGetQueryObjectiv;
-GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVPROC __glewGetQueryObjectuiv;
-GLEW_FUN_EXPORT PFNGLGETQUERYIVPROC __glewGetQueryiv;
-GLEW_FUN_EXPORT PFNGLISBUFFERPROC __glewIsBuffer;
-GLEW_FUN_EXPORT PFNGLISQUERYPROC __glewIsQuery;
-GLEW_FUN_EXPORT PFNGLMAPBUFFERPROC __glewMapBuffer;
-GLEW_FUN_EXPORT PFNGLUNMAPBUFFERPROC __glewUnmapBuffer;
-
-GLEW_FUN_EXPORT PFNGLATTACHSHADERPROC __glewAttachShader;
-GLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONPROC __glewBindAttribLocation;
-GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEPROC __glewBlendEquationSeparate;
-GLEW_FUN_EXPORT PFNGLCOMPILESHADERPROC __glewCompileShader;
-GLEW_FUN_EXPORT PFNGLCREATEPROGRAMPROC __glewCreateProgram;
-GLEW_FUN_EXPORT PFNGLCREATESHADERPROC __glewCreateShader;
-GLEW_FUN_EXPORT PFNGLDELETEPROGRAMPROC __glewDeleteProgram;
-GLEW_FUN_EXPORT PFNGLDELETESHADERPROC __glewDeleteShader;
-GLEW_FUN_EXPORT PFNGLDETACHSHADERPROC __glewDetachShader;
-GLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBARRAYPROC __glewDisableVertexAttribArray;
-GLEW_FUN_EXPORT PFNGLDRAWBUFFERSPROC __glewDrawBuffers;
-GLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBARRAYPROC __glewEnableVertexAttribArray;
-GLEW_FUN_EXPORT PFNGLGETACTIVEATTRIBPROC __glewGetActiveAttrib;
-GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMPROC __glewGetActiveUniform;
-GLEW_FUN_EXPORT PFNGLGETATTACHEDSHADERSPROC __glewGetAttachedShaders;
-GLEW_FUN_EXPORT PFNGLGETATTRIBLOCATIONPROC __glewGetAttribLocation;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMINFOLOGPROC __glewGetProgramInfoLog;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMIVPROC __glewGetProgramiv;
-GLEW_FUN_EXPORT PFNGLGETSHADERINFOLOGPROC __glewGetShaderInfoLog;
-GLEW_FUN_EXPORT PFNGLGETSHADERSOURCEPROC __glewGetShaderSource;
-GLEW_FUN_EXPORT PFNGLGETSHADERIVPROC __glewGetShaderiv;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMLOCATIONPROC __glewGetUniformLocation;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMFVPROC __glewGetUniformfv;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMIVPROC __glewGetUniformiv;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVPROC __glewGetVertexAttribPointerv;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVPROC __glewGetVertexAttribdv;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVPROC __glewGetVertexAttribfv;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVPROC __glewGetVertexAttribiv;
-GLEW_FUN_EXPORT PFNGLISPROGRAMPROC __glewIsProgram;
-GLEW_FUN_EXPORT PFNGLISSHADERPROC __glewIsShader;
-GLEW_FUN_EXPORT PFNGLLINKPROGRAMPROC __glewLinkProgram;
-GLEW_FUN_EXPORT PFNGLSHADERSOURCEPROC __glewShaderSource;
-GLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEPROC __glewStencilFuncSeparate;
-GLEW_FUN_EXPORT PFNGLSTENCILMASKSEPARATEPROC __glewStencilMaskSeparate;
-GLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEPROC __glewStencilOpSeparate;
-GLEW_FUN_EXPORT PFNGLUNIFORM1FPROC __glewUniform1f;
-GLEW_FUN_EXPORT PFNGLUNIFORM1FVPROC __glewUniform1fv;
-GLEW_FUN_EXPORT PFNGLUNIFORM1IPROC __glewUniform1i;
-GLEW_FUN_EXPORT PFNGLUNIFORM1IVPROC __glewUniform1iv;
-GLEW_FUN_EXPORT PFNGLUNIFORM2FPROC __glewUniform2f;
-GLEW_FUN_EXPORT PFNGLUNIFORM2FVPROC __glewUniform2fv;
-GLEW_FUN_EXPORT PFNGLUNIFORM2IPROC __glewUniform2i;
-GLEW_FUN_EXPORT PFNGLUNIFORM2IVPROC __glewUniform2iv;
-GLEW_FUN_EXPORT PFNGLUNIFORM3FPROC __glewUniform3f;
-GLEW_FUN_EXPORT PFNGLUNIFORM3FVPROC __glewUniform3fv;
-GLEW_FUN_EXPORT PFNGLUNIFORM3IPROC __glewUniform3i;
-GLEW_FUN_EXPORT PFNGLUNIFORM3IVPROC __glewUniform3iv;
-GLEW_FUN_EXPORT PFNGLUNIFORM4FPROC __glewUniform4f;
-GLEW_FUN_EXPORT PFNGLUNIFORM4FVPROC __glewUniform4fv;
-GLEW_FUN_EXPORT PFNGLUNIFORM4IPROC __glewUniform4i;
-GLEW_FUN_EXPORT PFNGLUNIFORM4IVPROC __glewUniform4iv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2FVPROC __glewUniformMatrix2fv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3FVPROC __glewUniformMatrix3fv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4FVPROC __glewUniformMatrix4fv;
-GLEW_FUN_EXPORT PFNGLUSEPROGRAMPROC __glewUseProgram;
-GLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMPROC __glewValidateProgram;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DPROC __glewVertexAttrib1d;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVPROC __glewVertexAttrib1dv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FPROC __glewVertexAttrib1f;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVPROC __glewVertexAttrib1fv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SPROC __glewVertexAttrib1s;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVPROC __glewVertexAttrib1sv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DPROC __glewVertexAttrib2d;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVPROC __glewVertexAttrib2dv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FPROC __glewVertexAttrib2f;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVPROC __glewVertexAttrib2fv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SPROC __glewVertexAttrib2s;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVPROC __glewVertexAttrib2sv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DPROC __glewVertexAttrib3d;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVPROC __glewVertexAttrib3dv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FPROC __glewVertexAttrib3f;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVPROC __glewVertexAttrib3fv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SPROC __glewVertexAttrib3s;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVPROC __glewVertexAttrib3sv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NBVPROC __glewVertexAttrib4Nbv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NIVPROC __glewVertexAttrib4Niv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NSVPROC __glewVertexAttrib4Nsv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBPROC __glewVertexAttrib4Nub;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBVPROC __glewVertexAttrib4Nubv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUIVPROC __glewVertexAttrib4Nuiv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUSVPROC __glewVertexAttrib4Nusv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4BVPROC __glewVertexAttrib4bv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DPROC __glewVertexAttrib4d;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVPROC __glewVertexAttrib4dv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FPROC __glewVertexAttrib4f;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVPROC __glewVertexAttrib4fv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4IVPROC __glewVertexAttrib4iv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SPROC __glewVertexAttrib4s;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVPROC __glewVertexAttrib4sv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVPROC __glewVertexAttrib4ubv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UIVPROC __glewVertexAttrib4uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4USVPROC __glewVertexAttrib4usv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERPROC __glewVertexAttribPointer;
-
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X3FVPROC __glewUniformMatrix2x3fv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X4FVPROC __glewUniformMatrix2x4fv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X2FVPROC __glewUniformMatrix3x2fv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X4FVPROC __glewUniformMatrix3x4fv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X2FVPROC __glewUniformMatrix4x2fv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X3FVPROC __glewUniformMatrix4x3fv;
-
-GLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERPROC __glewBeginConditionalRender;
-GLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKPROC __glewBeginTransformFeedback;
-GLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONPROC __glewBindFragDataLocation;
-GLEW_FUN_EXPORT PFNGLCLAMPCOLORPROC __glewClampColor;
-GLEW_FUN_EXPORT PFNGLCLEARBUFFERFIPROC __glewClearBufferfi;
-GLEW_FUN_EXPORT PFNGLCLEARBUFFERFVPROC __glewClearBufferfv;
-GLEW_FUN_EXPORT PFNGLCLEARBUFFERIVPROC __glewClearBufferiv;
-GLEW_FUN_EXPORT PFNGLCLEARBUFFERUIVPROC __glewClearBufferuiv;
-GLEW_FUN_EXPORT PFNGLCOLORMASKIPROC __glewColorMaski;
-GLEW_FUN_EXPORT PFNGLDISABLEIPROC __glewDisablei;
-GLEW_FUN_EXPORT PFNGLENABLEIPROC __glewEnablei;
-GLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERPROC __glewEndConditionalRender;
-GLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKPROC __glewEndTransformFeedback;
-GLEW_FUN_EXPORT PFNGLGETBOOLEANI_VPROC __glewGetBooleani_v;
-GLEW_FUN_EXPORT PFNGLGETFRAGDATALOCATIONPROC __glewGetFragDataLocation;
-GLEW_FUN_EXPORT PFNGLGETSTRINGIPROC __glewGetStringi;
-GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIIVPROC __glewGetTexParameterIiv;
-GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIUIVPROC __glewGetTexParameterIuiv;
-GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGPROC __glewGetTransformFeedbackVarying;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMUIVPROC __glewGetUniformuiv;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIIVPROC __glewGetVertexAttribIiv;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIUIVPROC __glewGetVertexAttribIuiv;
-GLEW_FUN_EXPORT PFNGLISENABLEDIPROC __glewIsEnabledi;
-GLEW_FUN_EXPORT PFNGLTEXPARAMETERIIVPROC __glewTexParameterIiv;
-GLEW_FUN_EXPORT PFNGLTEXPARAMETERIUIVPROC __glewTexParameterIuiv;
-GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSPROC __glewTransformFeedbackVaryings;
-GLEW_FUN_EXPORT PFNGLUNIFORM1UIPROC __glewUniform1ui;
-GLEW_FUN_EXPORT PFNGLUNIFORM1UIVPROC __glewUniform1uiv;
-GLEW_FUN_EXPORT PFNGLUNIFORM2UIPROC __glewUniform2ui;
-GLEW_FUN_EXPORT PFNGLUNIFORM2UIVPROC __glewUniform2uiv;
-GLEW_FUN_EXPORT PFNGLUNIFORM3UIPROC __glewUniform3ui;
-GLEW_FUN_EXPORT PFNGLUNIFORM3UIVPROC __glewUniform3uiv;
-GLEW_FUN_EXPORT PFNGLUNIFORM4UIPROC __glewUniform4ui;
-GLEW_FUN_EXPORT PFNGLUNIFORM4UIVPROC __glewUniform4uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IPROC __glewVertexAttribI1i;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IVPROC __glewVertexAttribI1iv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIPROC __glewVertexAttribI1ui;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIVPROC __glewVertexAttribI1uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IPROC __glewVertexAttribI2i;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IVPROC __glewVertexAttribI2iv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIPROC __glewVertexAttribI2ui;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIVPROC __glewVertexAttribI2uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IPROC __glewVertexAttribI3i;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IVPROC __glewVertexAttribI3iv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIPROC __glewVertexAttribI3ui;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIVPROC __glewVertexAttribI3uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4BVPROC __glewVertexAttribI4bv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IPROC __glewVertexAttribI4i;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IVPROC __glewVertexAttribI4iv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4SVPROC __glewVertexAttribI4sv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UBVPROC __glewVertexAttribI4ubv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIPROC __glewVertexAttribI4ui;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIVPROC __glewVertexAttribI4uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4USVPROC __glewVertexAttribI4usv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIPOINTERPROC __glewVertexAttribIPointer;
-
-GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDPROC __glewDrawArraysInstanced;
-GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDPROC __glewDrawElementsInstanced;
-GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTINDEXPROC __glewPrimitiveRestartIndex;
-GLEW_FUN_EXPORT PFNGLTEXBUFFERPROC __glewTexBuffer;
-
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREPROC __glewFramebufferTexture;
-GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERI64VPROC __glewGetBufferParameteri64v;
-GLEW_FUN_EXPORT PFNGLGETINTEGER64I_VPROC __glewGetInteger64i_v;
-
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORPROC __glewVertexAttribDivisor;
-
-GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEIPROC __glewBlendEquationSeparatei;
-GLEW_FUN_EXPORT PFNGLBLENDEQUATIONIPROC __glewBlendEquationi;
-GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEIPROC __glewBlendFuncSeparatei;
-GLEW_FUN_EXPORT PFNGLBLENDFUNCIPROC __glewBlendFunci;
-GLEW_FUN_EXPORT PFNGLMINSAMPLESHADINGPROC __glewMinSampleShading;
-
-GLEW_FUN_EXPORT PFNGLTBUFFERMASK3DFXPROC __glewTbufferMask3DFX;
-
-GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKAMDPROC __glewDebugMessageCallbackAMD;
-GLEW_FUN_EXPORT PFNGLDEBUGMESSAGEENABLEAMDPROC __glewDebugMessageEnableAMD;
-GLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTAMDPROC __glewDebugMessageInsertAMD;
-GLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGAMDPROC __glewGetDebugMessageLogAMD;
-
-GLEW_FUN_EXPORT PFNGLBLENDEQUATIONINDEXEDAMDPROC __glewBlendEquationIndexedAMD;
-GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC __glewBlendEquationSeparateIndexedAMD;
-GLEW_FUN_EXPORT PFNGLBLENDFUNCINDEXEDAMDPROC __glewBlendFuncIndexedAMD;
-GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC __glewBlendFuncSeparateIndexedAMD;
-
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPARAMETERIAMDPROC __glewVertexAttribParameteriAMD;
-
-GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC __glewMultiDrawArraysIndirectAMD;
-GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC __glewMultiDrawElementsIndirectAMD;
-
-GLEW_FUN_EXPORT PFNGLDELETENAMESAMDPROC __glewDeleteNamesAMD;
-GLEW_FUN_EXPORT PFNGLGENNAMESAMDPROC __glewGenNamesAMD;
-GLEW_FUN_EXPORT PFNGLISNAMEAMDPROC __glewIsNameAMD;
-
-GLEW_FUN_EXPORT PFNGLQUERYOBJECTPARAMETERUIAMDPROC __glewQueryObjectParameteruiAMD;
-
-GLEW_FUN_EXPORT PFNGLBEGINPERFMONITORAMDPROC __glewBeginPerfMonitorAMD;
-GLEW_FUN_EXPORT PFNGLDELETEPERFMONITORSAMDPROC __glewDeletePerfMonitorsAMD;
-GLEW_FUN_EXPORT PFNGLENDPERFMONITORAMDPROC __glewEndPerfMonitorAMD;
-GLEW_FUN_EXPORT PFNGLGENPERFMONITORSAMDPROC __glewGenPerfMonitorsAMD;
-GLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERDATAAMDPROC __glewGetPerfMonitorCounterDataAMD;
-GLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERINFOAMDPROC __glewGetPerfMonitorCounterInfoAMD;
-GLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC __glewGetPerfMonitorCounterStringAMD;
-GLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERSAMDPROC __glewGetPerfMonitorCountersAMD;
-GLEW_FUN_EXPORT PFNGLGETPERFMONITORGROUPSTRINGAMDPROC __glewGetPerfMonitorGroupStringAMD;
-GLEW_FUN_EXPORT PFNGLGETPERFMONITORGROUPSAMDPROC __glewGetPerfMonitorGroupsAMD;
-GLEW_FUN_EXPORT PFNGLSELECTPERFMONITORCOUNTERSAMDPROC __glewSelectPerfMonitorCountersAMD;
-
-GLEW_FUN_EXPORT PFNGLSETMULTISAMPLEFVAMDPROC __glewSetMultisamplefvAMD;
-
-GLEW_FUN_EXPORT PFNGLTEXSTORAGESPARSEAMDPROC __glewTexStorageSparseAMD;
-GLEW_FUN_EXPORT PFNGLTEXTURESTORAGESPARSEAMDPROC __glewTextureStorageSparseAMD;
-
-GLEW_FUN_EXPORT PFNGLSTENCILOPVALUEAMDPROC __glewStencilOpValueAMD;
-
-GLEW_FUN_EXPORT PFNGLTESSELLATIONFACTORAMDPROC __glewTessellationFactorAMD;
-GLEW_FUN_EXPORT PFNGLTESSELLATIONMODEAMDPROC __glewTessellationModeAMD;
-
-GLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFERANGLEPROC __glewBlitFramebufferANGLE;
-
-GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC __glewRenderbufferStorageMultisampleANGLE;
-
-GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDANGLEPROC __glewDrawArraysInstancedANGLE;
-GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDANGLEPROC __glewDrawElementsInstancedANGLE;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORANGLEPROC __glewVertexAttribDivisorANGLE;
-
-GLEW_FUN_EXPORT PFNGLBEGINQUERYANGLEPROC __glewBeginQueryANGLE;
-GLEW_FUN_EXPORT PFNGLDELETEQUERIESANGLEPROC __glewDeleteQueriesANGLE;
-GLEW_FUN_EXPORT PFNGLENDQUERYANGLEPROC __glewEndQueryANGLE;
-GLEW_FUN_EXPORT PFNGLGENQUERIESANGLEPROC __glewGenQueriesANGLE;
-GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTI64VANGLEPROC __glewGetQueryObjecti64vANGLE;
-GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVANGLEPROC __glewGetQueryObjectivANGLE;
-GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUI64VANGLEPROC __glewGetQueryObjectui64vANGLE;
-GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVANGLEPROC __glewGetQueryObjectuivANGLE;
-GLEW_FUN_EXPORT PFNGLGETQUERYIVANGLEPROC __glewGetQueryivANGLE;
-GLEW_FUN_EXPORT PFNGLISQUERYANGLEPROC __glewIsQueryANGLE;
-GLEW_FUN_EXPORT PFNGLQUERYCOUNTERANGLEPROC __glewQueryCounterANGLE;
-
-GLEW_FUN_EXPORT PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC __glewGetTranslatedShaderSourceANGLE;
-
-GLEW_FUN_EXPORT PFNGLDRAWELEMENTARRAYAPPLEPROC __glewDrawElementArrayAPPLE;
-GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC __glewDrawRangeElementArrayAPPLE;
-GLEW_FUN_EXPORT PFNGLELEMENTPOINTERAPPLEPROC __glewElementPointerAPPLE;
-GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC __glewMultiDrawElementArrayAPPLE;
-GLEW_FUN_EXPORT PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC __glewMultiDrawRangeElementArrayAPPLE;
-
-GLEW_FUN_EXPORT PFNGLDELETEFENCESAPPLEPROC __glewDeleteFencesAPPLE;
-GLEW_FUN_EXPORT PFNGLFINISHFENCEAPPLEPROC __glewFinishFenceAPPLE;
-GLEW_FUN_EXPORT PFNGLFINISHOBJECTAPPLEPROC __glewFinishObjectAPPLE;
-GLEW_FUN_EXPORT PFNGLGENFENCESAPPLEPROC __glewGenFencesAPPLE;
-GLEW_FUN_EXPORT PFNGLISFENCEAPPLEPROC __glewIsFenceAPPLE;
-GLEW_FUN_EXPORT PFNGLSETFENCEAPPLEPROC __glewSetFenceAPPLE;
-GLEW_FUN_EXPORT PFNGLTESTFENCEAPPLEPROC __glewTestFenceAPPLE;
-GLEW_FUN_EXPORT PFNGLTESTOBJECTAPPLEPROC __glewTestObjectAPPLE;
-
-GLEW_FUN_EXPORT PFNGLBUFFERPARAMETERIAPPLEPROC __glewBufferParameteriAPPLE;
-GLEW_FUN_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC __glewFlushMappedBufferRangeAPPLE;
-
-GLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERIVAPPLEPROC __glewGetObjectParameterivAPPLE;
-GLEW_FUN_EXPORT PFNGLOBJECTPURGEABLEAPPLEPROC __glewObjectPurgeableAPPLE;
-GLEW_FUN_EXPORT PFNGLOBJECTUNPURGEABLEAPPLEPROC __glewObjectUnpurgeableAPPLE;
-
-GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC __glewGetTexParameterPointervAPPLE;
-GLEW_FUN_EXPORT PFNGLTEXTURERANGEAPPLEPROC __glewTextureRangeAPPLE;
-
-GLEW_FUN_EXPORT PFNGLBINDVERTEXARRAYAPPLEPROC __glewBindVertexArrayAPPLE;
-GLEW_FUN_EXPORT PFNGLDELETEVERTEXARRAYSAPPLEPROC __glewDeleteVertexArraysAPPLE;
-GLEW_FUN_EXPORT PFNGLGENVERTEXARRAYSAPPLEPROC __glewGenVertexArraysAPPLE;
-GLEW_FUN_EXPORT PFNGLISVERTEXARRAYAPPLEPROC __glewIsVertexArrayAPPLE;
-
-GLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC __glewFlushVertexArrayRangeAPPLE;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYPARAMETERIAPPLEPROC __glewVertexArrayParameteriAPPLE;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGEAPPLEPROC __glewVertexArrayRangeAPPLE;
-
-GLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBAPPLEPROC __glewDisableVertexAttribAPPLE;
-GLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBAPPLEPROC __glewEnableVertexAttribAPPLE;
-GLEW_FUN_EXPORT PFNGLISVERTEXATTRIBENABLEDAPPLEPROC __glewIsVertexAttribEnabledAPPLE;
-GLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB1DAPPLEPROC __glewMapVertexAttrib1dAPPLE;
-GLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB1FAPPLEPROC __glewMapVertexAttrib1fAPPLE;
-GLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB2DAPPLEPROC __glewMapVertexAttrib2dAPPLE;
-GLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB2FAPPLEPROC __glewMapVertexAttrib2fAPPLE;
-
-GLEW_FUN_EXPORT PFNGLCLEARDEPTHFPROC __glewClearDepthf;
-GLEW_FUN_EXPORT PFNGLDEPTHRANGEFPROC __glewDepthRangef;
-GLEW_FUN_EXPORT PFNGLGETSHADERPRECISIONFORMATPROC __glewGetShaderPrecisionFormat;
-GLEW_FUN_EXPORT PFNGLRELEASESHADERCOMPILERPROC __glewReleaseShaderCompiler;
-GLEW_FUN_EXPORT PFNGLSHADERBINARYPROC __glewShaderBinary;
-
-GLEW_FUN_EXPORT PFNGLMEMORYBARRIERBYREGIONPROC __glewMemoryBarrierByRegion;
-
-GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC __glewDrawArraysInstancedBaseInstance;
-GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC __glewDrawElementsInstancedBaseInstance;
-GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC __glewDrawElementsInstancedBaseVertexBaseInstance;
-
-GLEW_FUN_EXPORT PFNGLGETIMAGEHANDLEARBPROC __glewGetImageHandleARB;
-GLEW_FUN_EXPORT PFNGLGETTEXTUREHANDLEARBPROC __glewGetTextureHandleARB;
-GLEW_FUN_EXPORT PFNGLGETTEXTURESAMPLERHANDLEARBPROC __glewGetTextureSamplerHandleARB;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLUI64VARBPROC __glewGetVertexAttribLui64vARB;
-GLEW_FUN_EXPORT PFNGLISIMAGEHANDLERESIDENTARBPROC __glewIsImageHandleResidentARB;
-GLEW_FUN_EXPORT PFNGLISTEXTUREHANDLERESIDENTARBPROC __glewIsTextureHandleResidentARB;
-GLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC __glewMakeImageHandleNonResidentARB;
-GLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLERESIDENTARBPROC __glewMakeImageHandleResidentARB;
-GLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC __glewMakeTextureHandleNonResidentARB;
-GLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLERESIDENTARBPROC __glewMakeTextureHandleResidentARB;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC __glewProgramUniformHandleui64ARB;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC __glewProgramUniformHandleui64vARB;
-GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64ARBPROC __glewUniformHandleui64ARB;
-GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64VARBPROC __glewUniformHandleui64vARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64ARBPROC __glewVertexAttribL1ui64ARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64VARBPROC __glewVertexAttribL1ui64vARB;
-
-GLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONINDEXEDPROC __glewBindFragDataLocationIndexed;
-GLEW_FUN_EXPORT PFNGLGETFRAGDATAINDEXPROC __glewGetFragDataIndex;
-
-GLEW_FUN_EXPORT PFNGLBUFFERSTORAGEPROC __glewBufferStorage;
-GLEW_FUN_EXPORT PFNGLNAMEDBUFFERSTORAGEEXTPROC __glewNamedBufferStorageEXT;
-
-GLEW_FUN_EXPORT PFNGLCREATESYNCFROMCLEVENTARBPROC __glewCreateSyncFromCLeventARB;
-
-GLEW_FUN_EXPORT PFNGLCLEARBUFFERDATAPROC __glewClearBufferData;
-GLEW_FUN_EXPORT PFNGLCLEARBUFFERSUBDATAPROC __glewClearBufferSubData;
-GLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERDATAEXTPROC __glewClearNamedBufferDataEXT;
-GLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC __glewClearNamedBufferSubDataEXT;
-
-GLEW_FUN_EXPORT PFNGLCLEARTEXIMAGEPROC __glewClearTexImage;
-GLEW_FUN_EXPORT PFNGLCLEARTEXSUBIMAGEPROC __glewClearTexSubImage;
-
-GLEW_FUN_EXPORT PFNGLCLIPCONTROLPROC __glewClipControl;
-
-GLEW_FUN_EXPORT PFNGLCLAMPCOLORARBPROC __glewClampColorARB;
-
-GLEW_FUN_EXPORT PFNGLDISPATCHCOMPUTEPROC __glewDispatchCompute;
-GLEW_FUN_EXPORT PFNGLDISPATCHCOMPUTEINDIRECTPROC __glewDispatchComputeIndirect;
-
-GLEW_FUN_EXPORT PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC __glewDispatchComputeGroupSizeARB;
-
-GLEW_FUN_EXPORT PFNGLCOPYBUFFERSUBDATAPROC __glewCopyBufferSubData;
-
-GLEW_FUN_EXPORT PFNGLCOPYIMAGESUBDATAPROC __glewCopyImageSubData;
-
-GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKARBPROC __glewDebugMessageCallbackARB;
-GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECONTROLARBPROC __glewDebugMessageControlARB;
-GLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTARBPROC __glewDebugMessageInsertARB;
-GLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGARBPROC __glewGetDebugMessageLogARB;
-
-GLEW_FUN_EXPORT PFNGLBINDTEXTUREUNITPROC __glewBindTextureUnit;
-GLEW_FUN_EXPORT PFNGLBLITNAMEDFRAMEBUFFERPROC __glewBlitNamedFramebuffer;
-GLEW_FUN_EXPORT PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC __glewCheckNamedFramebufferStatus;
-GLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERDATAPROC __glewClearNamedBufferData;
-GLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERSUBDATAPROC __glewClearNamedBufferSubData;
-GLEW_FUN_EXPORT PFNGLCLEARNAMEDFRAMEBUFFERFIPROC __glewClearNamedFramebufferfi;
-GLEW_FUN_EXPORT PFNGLCLEARNAMEDFRAMEBUFFERFVPROC __glewClearNamedFramebufferfv;
-GLEW_FUN_EXPORT PFNGLCLEARNAMEDFRAMEBUFFERIVPROC __glewClearNamedFramebufferiv;
-GLEW_FUN_EXPORT PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC __glewClearNamedFramebufferuiv;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC __glewCompressedTextureSubImage1D;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC __glewCompressedTextureSubImage2D;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC __glewCompressedTextureSubImage3D;
-GLEW_FUN_EXPORT PFNGLCOPYNAMEDBUFFERSUBDATAPROC __glewCopyNamedBufferSubData;
-GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE1DPROC __glewCopyTextureSubImage1D;
-GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE2DPROC __glewCopyTextureSubImage2D;
-GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE3DPROC __glewCopyTextureSubImage3D;
-GLEW_FUN_EXPORT PFNGLCREATEBUFFERSPROC __glewCreateBuffers;
-GLEW_FUN_EXPORT PFNGLCREATEFRAMEBUFFERSPROC __glewCreateFramebuffers;
-GLEW_FUN_EXPORT PFNGLCREATEPROGRAMPIPELINESPROC __glewCreateProgramPipelines;
-GLEW_FUN_EXPORT PFNGLCREATEQUERIESPROC __glewCreateQueries;
-GLEW_FUN_EXPORT PFNGLCREATERENDERBUFFERSPROC __glewCreateRenderbuffers;
-GLEW_FUN_EXPORT PFNGLCREATESAMPLERSPROC __glewCreateSamplers;
-GLEW_FUN_EXPORT PFNGLCREATETEXTURESPROC __glewCreateTextures;
-GLEW_FUN_EXPORT PFNGLCREATETRANSFORMFEEDBACKSPROC __glewCreateTransformFeedbacks;
-GLEW_FUN_EXPORT PFNGLCREATEVERTEXARRAYSPROC __glewCreateVertexArrays;
-GLEW_FUN_EXPORT PFNGLDISABLEVERTEXARRAYATTRIBPROC __glewDisableVertexArrayAttrib;
-GLEW_FUN_EXPORT PFNGLENABLEVERTEXARRAYATTRIBPROC __glewEnableVertexArrayAttrib;
-GLEW_FUN_EXPORT PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC __glewFlushMappedNamedBufferRange;
-GLEW_FUN_EXPORT PFNGLGENERATETEXTUREMIPMAPPROC __glewGenerateTextureMipmap;
-GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC __glewGetCompressedTextureImage;
-GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERI64VPROC __glewGetNamedBufferParameteri64v;
-GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERIVPROC __glewGetNamedBufferParameteriv;
-GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPOINTERVPROC __glewGetNamedBufferPointerv;
-GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERSUBDATAPROC __glewGetNamedBufferSubData;
-GLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC __glewGetNamedFramebufferAttachmentParameteriv;
-GLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC __glewGetNamedFramebufferParameteriv;
-GLEW_FUN_EXPORT PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC __glewGetNamedRenderbufferParameteriv;
-GLEW_FUN_EXPORT PFNGLGETQUERYBUFFEROBJECTI64VPROC __glewGetQueryBufferObjecti64v;
-GLEW_FUN_EXPORT PFNGLGETQUERYBUFFEROBJECTIVPROC __glewGetQueryBufferObjectiv;
-GLEW_FUN_EXPORT PFNGLGETQUERYBUFFEROBJECTUI64VPROC __glewGetQueryBufferObjectui64v;
-GLEW_FUN_EXPORT PFNGLGETQUERYBUFFEROBJECTUIVPROC __glewGetQueryBufferObjectuiv;
-GLEW_FUN_EXPORT PFNGLGETTEXTUREIMAGEPROC __glewGetTextureImage;
-GLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERFVPROC __glewGetTextureLevelParameterfv;
-GLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERIVPROC __glewGetTextureLevelParameteriv;
-GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIIVPROC __glewGetTextureParameterIiv;
-GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIUIVPROC __glewGetTextureParameterIuiv;
-GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERFVPROC __glewGetTextureParameterfv;
-GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIVPROC __glewGetTextureParameteriv;
-GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKI64_VPROC __glewGetTransformFeedbacki64_v;
-GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKI_VPROC __glewGetTransformFeedbacki_v;
-GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKIVPROC __glewGetTransformFeedbackiv;
-GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINDEXED64IVPROC __glewGetVertexArrayIndexed64iv;
-GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINDEXEDIVPROC __glewGetVertexArrayIndexediv;
-GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYIVPROC __glewGetVertexArrayiv;
-GLEW_FUN_EXPORT PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC __glewInvalidateNamedFramebufferData;
-GLEW_FUN_EXPORT PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC __glewInvalidateNamedFramebufferSubData;
-GLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFERPROC __glewMapNamedBuffer;
-GLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFERRANGEPROC __glewMapNamedBufferRange;
-GLEW_FUN_EXPORT PFNGLNAMEDBUFFERDATAPROC __glewNamedBufferData;
-GLEW_FUN_EXPORT PFNGLNAMEDBUFFERSTORAGEPROC __glewNamedBufferStorage;
-GLEW_FUN_EXPORT PFNGLNAMEDBUFFERSUBDATAPROC __glewNamedBufferSubData;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC __glewNamedFramebufferDrawBuffer;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC __glewNamedFramebufferDrawBuffers;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC __glewNamedFramebufferParameteri;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC __glewNamedFramebufferReadBuffer;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC __glewNamedFramebufferRenderbuffer;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREPROC __glewNamedFramebufferTexture;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC __glewNamedFramebufferTextureLayer;
-GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEPROC __glewNamedRenderbufferStorage;
-GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC __glewNamedRenderbufferStorageMultisample;
-GLEW_FUN_EXPORT PFNGLTEXTUREBUFFERPROC __glewTextureBuffer;
-GLEW_FUN_EXPORT PFNGLTEXTUREBUFFERRANGEPROC __glewTextureBufferRange;
-GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIIVPROC __glewTextureParameterIiv;
-GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIUIVPROC __glewTextureParameterIuiv;
-GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFPROC __glewTextureParameterf;
-GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFVPROC __glewTextureParameterfv;
-GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIPROC __glewTextureParameteri;
-GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIVPROC __glewTextureParameteriv;
-GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE1DPROC __glewTextureStorage1D;
-GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DPROC __glewTextureStorage2D;
-GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC __glewTextureStorage2DMultisample;
-GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DPROC __glewTextureStorage3D;
-GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC __glewTextureStorage3DMultisample;
-GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE1DPROC __glewTextureSubImage1D;
-GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE2DPROC __glewTextureSubImage2D;
-GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE3DPROC __glewTextureSubImage3D;
-GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC __glewTransformFeedbackBufferBase;
-GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC __glewTransformFeedbackBufferRange;
-GLEW_FUN_EXPORT PFNGLUNMAPNAMEDBUFFERPROC __glewUnmapNamedBuffer;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYATTRIBBINDINGPROC __glewVertexArrayAttribBinding;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYATTRIBFORMATPROC __glewVertexArrayAttribFormat;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYATTRIBIFORMATPROC __glewVertexArrayAttribIFormat;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYATTRIBLFORMATPROC __glewVertexArrayAttribLFormat;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYBINDINGDIVISORPROC __glewVertexArrayBindingDivisor;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYELEMENTBUFFERPROC __glewVertexArrayElementBuffer;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXBUFFERPROC __glewVertexArrayVertexBuffer;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXBUFFERSPROC __glewVertexArrayVertexBuffers;
-
-GLEW_FUN_EXPORT PFNGLDRAWBUFFERSARBPROC __glewDrawBuffersARB;
-
-GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEIARBPROC __glewBlendEquationSeparateiARB;
-GLEW_FUN_EXPORT PFNGLBLENDEQUATIONIARBPROC __glewBlendEquationiARB;
-GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEIARBPROC __glewBlendFuncSeparateiARB;
-GLEW_FUN_EXPORT PFNGLBLENDFUNCIARBPROC __glewBlendFunciARB;
-
-GLEW_FUN_EXPORT PFNGLDRAWELEMENTSBASEVERTEXPROC __glewDrawElementsBaseVertex;
-GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC __glewDrawElementsInstancedBaseVertex;
-GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC __glewDrawRangeElementsBaseVertex;
-GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC __glewMultiDrawElementsBaseVertex;
-
-GLEW_FUN_EXPORT PFNGLDRAWARRAYSINDIRECTPROC __glewDrawArraysIndirect;
-GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINDIRECTPROC __glewDrawElementsIndirect;
-
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERPARAMETERIPROC __glewFramebufferParameteri;
-GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERPARAMETERIVPROC __glewGetFramebufferParameteriv;
-GLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC __glewGetNamedFramebufferParameterivEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC __glewNamedFramebufferParameteriEXT;
-
-GLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFERPROC __glewBindFramebuffer;
-GLEW_FUN_EXPORT PFNGLBINDRENDERBUFFERPROC __glewBindRenderbuffer;
-GLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFERPROC __glewBlitFramebuffer;
-GLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus;
-GLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers;
-GLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer;
-GLEW_FUN_EXPORT PFNGLGENFRAMEBUFFERSPROC __glewGenFramebuffers;
-GLEW_FUN_EXPORT PFNGLGENRENDERBUFFERSPROC __glewGenRenderbuffers;
-GLEW_FUN_EXPORT PFNGLGENERATEMIPMAPPROC __glewGenerateMipmap;
-GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC __glewGetFramebufferAttachmentParameteriv;
-GLEW_FUN_EXPORT PFNGLGETRENDERBUFFERPARAMETERIVPROC __glewGetRenderbufferParameteriv;
-GLEW_FUN_EXPORT PFNGLISFRAMEBUFFERPROC __glewIsFramebuffer;
-GLEW_FUN_EXPORT PFNGLISRENDERBUFFERPROC __glewIsRenderbuffer;
-GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEPROC __glewRenderbufferStorage;
-GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC __glewRenderbufferStorageMultisample;
-
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREARBPROC __glewFramebufferTextureARB;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREFACEARBPROC __glewFramebufferTextureFaceARB;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERARBPROC __glewFramebufferTextureLayerARB;
-GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIARBPROC __glewProgramParameteriARB;
-
-GLEW_FUN_EXPORT PFNGLGETPROGRAMBINARYPROC __glewGetProgramBinary;
-GLEW_FUN_EXPORT PFNGLPROGRAMBINARYPROC __glewProgramBinary;
-GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIPROC __glewProgramParameteri;
-
-GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC __glewGetCompressedTextureSubImage;
-GLEW_FUN_EXPORT PFNGLGETTEXTURESUBIMAGEPROC __glewGetTextureSubImage;
-
-GLEW_FUN_EXPORT PFNGLGETUNIFORMDVPROC __glewGetUniformdv;
-GLEW_FUN_EXPORT PFNGLUNIFORM1DPROC __glewUniform1d;
-GLEW_FUN_EXPORT PFNGLUNIFORM1DVPROC __glewUniform1dv;
-GLEW_FUN_EXPORT PFNGLUNIFORM2DPROC __glewUniform2d;
-GLEW_FUN_EXPORT PFNGLUNIFORM2DVPROC __glewUniform2dv;
-GLEW_FUN_EXPORT PFNGLUNIFORM3DPROC __glewUniform3d;
-GLEW_FUN_EXPORT PFNGLUNIFORM3DVPROC __glewUniform3dv;
-GLEW_FUN_EXPORT PFNGLUNIFORM4DPROC __glewUniform4d;
-GLEW_FUN_EXPORT PFNGLUNIFORM4DVPROC __glewUniform4dv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2DVPROC __glewUniformMatrix2dv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X3DVPROC __glewUniformMatrix2x3dv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X4DVPROC __glewUniformMatrix2x4dv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3DVPROC __glewUniformMatrix3dv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X2DVPROC __glewUniformMatrix3x2dv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X4DVPROC __glewUniformMatrix3x4dv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4DVPROC __glewUniformMatrix4dv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X2DVPROC __glewUniformMatrix4x2dv;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X3DVPROC __glewUniformMatrix4x3dv;
-
-GLEW_FUN_EXPORT PFNGLCOLORSUBTABLEPROC __glewColorSubTable;
-GLEW_FUN_EXPORT PFNGLCOLORTABLEPROC __glewColorTable;
-GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERFVPROC __glewColorTableParameterfv;
-GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERIVPROC __glewColorTableParameteriv;
-GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER1DPROC __glewConvolutionFilter1D;
-GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER2DPROC __glewConvolutionFilter2D;
-GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFPROC __glewConvolutionParameterf;
-GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFVPROC __glewConvolutionParameterfv;
-GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIPROC __glewConvolutionParameteri;
-GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIVPROC __glewConvolutionParameteriv;
-GLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEPROC __glewCopyColorSubTable;
-GLEW_FUN_EXPORT PFNGLCOPYCOLORTABLEPROC __glewCopyColorTable;
-GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER1DPROC __glewCopyConvolutionFilter1D;
-GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER2DPROC __glewCopyConvolutionFilter2D;
-GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPROC __glewGetColorTable;
-GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVPROC __glewGetColorTableParameterfv;
-GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVPROC __glewGetColorTableParameteriv;
-GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONFILTERPROC __glewGetConvolutionFilter;
-GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERFVPROC __glewGetConvolutionParameterfv;
-GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERIVPROC __glewGetConvolutionParameteriv;
-GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPROC __glewGetHistogram;
-GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERFVPROC __glewGetHistogramParameterfv;
-GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERIVPROC __glewGetHistogramParameteriv;
-GLEW_FUN_EXPORT PFNGLGETMINMAXPROC __glewGetMinmax;
-GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERFVPROC __glewGetMinmaxParameterfv;
-GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERIVPROC __glewGetMinmaxParameteriv;
-GLEW_FUN_EXPORT PFNGLGETSEPARABLEFILTERPROC __glewGetSeparableFilter;
-GLEW_FUN_EXPORT PFNGLHISTOGRAMPROC __glewHistogram;
-GLEW_FUN_EXPORT PFNGLMINMAXPROC __glewMinmax;
-GLEW_FUN_EXPORT PFNGLRESETHISTOGRAMPROC __glewResetHistogram;
-GLEW_FUN_EXPORT PFNGLRESETMINMAXPROC __glewResetMinmax;
-GLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DPROC __glewSeparableFilter2D;
-
-GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC __glewMultiDrawArraysIndirectCountARB;
-GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC __glewMultiDrawElementsIndirectCountARB;
-
-GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDARBPROC __glewDrawArraysInstancedARB;
-GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDARBPROC __glewDrawElementsInstancedARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORARBPROC __glewVertexAttribDivisorARB;
-
-GLEW_FUN_EXPORT PFNGLGETINTERNALFORMATIVPROC __glewGetInternalformativ;
-
-GLEW_FUN_EXPORT PFNGLGETINTERNALFORMATI64VPROC __glewGetInternalformati64v;
-
-GLEW_FUN_EXPORT PFNGLINVALIDATEBUFFERDATAPROC __glewInvalidateBufferData;
-GLEW_FUN_EXPORT PFNGLINVALIDATEBUFFERSUBDATAPROC __glewInvalidateBufferSubData;
-GLEW_FUN_EXPORT PFNGLINVALIDATEFRAMEBUFFERPROC __glewInvalidateFramebuffer;
-GLEW_FUN_EXPORT PFNGLINVALIDATESUBFRAMEBUFFERPROC __glewInvalidateSubFramebuffer;
-GLEW_FUN_EXPORT PFNGLINVALIDATETEXIMAGEPROC __glewInvalidateTexImage;
-GLEW_FUN_EXPORT PFNGLINVALIDATETEXSUBIMAGEPROC __glewInvalidateTexSubImage;
-
-GLEW_FUN_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEPROC __glewFlushMappedBufferRange;
-GLEW_FUN_EXPORT PFNGLMAPBUFFERRANGEPROC __glewMapBufferRange;
-
-GLEW_FUN_EXPORT PFNGLCURRENTPALETTEMATRIXARBPROC __glewCurrentPaletteMatrixARB;
-GLEW_FUN_EXPORT PFNGLMATRIXINDEXPOINTERARBPROC __glewMatrixIndexPointerARB;
-GLEW_FUN_EXPORT PFNGLMATRIXINDEXUBVARBPROC __glewMatrixIndexubvARB;
-GLEW_FUN_EXPORT PFNGLMATRIXINDEXUIVARBPROC __glewMatrixIndexuivARB;
-GLEW_FUN_EXPORT PFNGLMATRIXINDEXUSVARBPROC __glewMatrixIndexusvARB;
-
-GLEW_FUN_EXPORT PFNGLBINDBUFFERSBASEPROC __glewBindBuffersBase;
-GLEW_FUN_EXPORT PFNGLBINDBUFFERSRANGEPROC __glewBindBuffersRange;
-GLEW_FUN_EXPORT PFNGLBINDIMAGETEXTURESPROC __glewBindImageTextures;
-GLEW_FUN_EXPORT PFNGLBINDSAMPLERSPROC __glewBindSamplers;
-GLEW_FUN_EXPORT PFNGLBINDTEXTURESPROC __glewBindTextures;
-GLEW_FUN_EXPORT PFNGLBINDVERTEXBUFFERSPROC __glewBindVertexBuffers;
-
-GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTPROC __glewMultiDrawArraysIndirect;
-GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTPROC __glewMultiDrawElementsIndirect;
-
-GLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEARBPROC __glewSampleCoverageARB;
-
-GLEW_FUN_EXPORT PFNGLACTIVETEXTUREARBPROC __glewActiveTextureARB;
-GLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREARBPROC __glewClientActiveTextureARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DARBPROC __glewMultiTexCoord1dARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVARBPROC __glewMultiTexCoord1dvARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FARBPROC __glewMultiTexCoord1fARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVARBPROC __glewMultiTexCoord1fvARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IARBPROC __glewMultiTexCoord1iARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVARBPROC __glewMultiTexCoord1ivARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SARBPROC __glewMultiTexCoord1sARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVARBPROC __glewMultiTexCoord1svARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DARBPROC __glewMultiTexCoord2dARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVARBPROC __glewMultiTexCoord2dvARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FARBPROC __glewMultiTexCoord2fARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVARBPROC __glewMultiTexCoord2fvARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IARBPROC __glewMultiTexCoord2iARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IVARBPROC __glewMultiTexCoord2ivARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SARBPROC __glewMultiTexCoord2sARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SVARBPROC __glewMultiTexCoord2svARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DARBPROC __glewMultiTexCoord3dARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DVARBPROC __glewMultiTexCoord3dvARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FARBPROC __glewMultiTexCoord3fARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FVARBPROC __glewMultiTexCoord3fvARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IARBPROC __glewMultiTexCoord3iARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IVARBPROC __glewMultiTexCoord3ivARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SARBPROC __glewMultiTexCoord3sARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SVARBPROC __glewMultiTexCoord3svARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DARBPROC __glewMultiTexCoord4dARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DVARBPROC __glewMultiTexCoord4dvARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FARBPROC __glewMultiTexCoord4fARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FVARBPROC __glewMultiTexCoord4fvARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IARBPROC __glewMultiTexCoord4iARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IVARBPROC __glewMultiTexCoord4ivARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SARBPROC __glewMultiTexCoord4sARB;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SVARBPROC __glewMultiTexCoord4svARB;
-
-GLEW_FUN_EXPORT PFNGLBEGINQUERYARBPROC __glewBeginQueryARB;
-GLEW_FUN_EXPORT PFNGLDELETEQUERIESARBPROC __glewDeleteQueriesARB;
-GLEW_FUN_EXPORT PFNGLENDQUERYARBPROC __glewEndQueryARB;
-GLEW_FUN_EXPORT PFNGLGENQUERIESARBPROC __glewGenQueriesARB;
-GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVARBPROC __glewGetQueryObjectivARB;
-GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVARBPROC __glewGetQueryObjectuivARB;
-GLEW_FUN_EXPORT PFNGLGETQUERYIVARBPROC __glewGetQueryivARB;
-GLEW_FUN_EXPORT PFNGLISQUERYARBPROC __glewIsQueryARB;
-
-GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFARBPROC __glewPointParameterfARB;
-GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVARBPROC __glewPointParameterfvARB;
-
-GLEW_FUN_EXPORT PFNGLGETPROGRAMINTERFACEIVPROC __glewGetProgramInterfaceiv;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCEINDEXPROC __glewGetProgramResourceIndex;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCELOCATIONPROC __glewGetProgramResourceLocation;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC __glewGetProgramResourceLocationIndex;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCENAMEPROC __glewGetProgramResourceName;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCEIVPROC __glewGetProgramResourceiv;
-
-GLEW_FUN_EXPORT PFNGLPROVOKINGVERTEXPROC __glewProvokingVertex;
-
-GLEW_FUN_EXPORT PFNGLGETGRAPHICSRESETSTATUSARBPROC __glewGetGraphicsResetStatusARB;
-GLEW_FUN_EXPORT PFNGLGETNCOLORTABLEARBPROC __glewGetnColorTableARB;
-GLEW_FUN_EXPORT PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC __glewGetnCompressedTexImageARB;
-GLEW_FUN_EXPORT PFNGLGETNCONVOLUTIONFILTERARBPROC __glewGetnConvolutionFilterARB;
-GLEW_FUN_EXPORT PFNGLGETNHISTOGRAMARBPROC __glewGetnHistogramARB;
-GLEW_FUN_EXPORT PFNGLGETNMAPDVARBPROC __glewGetnMapdvARB;
-GLEW_FUN_EXPORT PFNGLGETNMAPFVARBPROC __glewGetnMapfvARB;
-GLEW_FUN_EXPORT PFNGLGETNMAPIVARBPROC __glewGetnMapivARB;
-GLEW_FUN_EXPORT PFNGLGETNMINMAXARBPROC __glewGetnMinmaxARB;
-GLEW_FUN_EXPORT PFNGLGETNPIXELMAPFVARBPROC __glewGetnPixelMapfvARB;
-GLEW_FUN_EXPORT PFNGLGETNPIXELMAPUIVARBPROC __glewGetnPixelMapuivARB;
-GLEW_FUN_EXPORT PFNGLGETNPIXELMAPUSVARBPROC __glewGetnPixelMapusvARB;
-GLEW_FUN_EXPORT PFNGLGETNPOLYGONSTIPPLEARBPROC __glewGetnPolygonStippleARB;
-GLEW_FUN_EXPORT PFNGLGETNSEPARABLEFILTERARBPROC __glewGetnSeparableFilterARB;
-GLEW_FUN_EXPORT PFNGLGETNTEXIMAGEARBPROC __glewGetnTexImageARB;
-GLEW_FUN_EXPORT PFNGLGETNUNIFORMDVARBPROC __glewGetnUniformdvARB;
-GLEW_FUN_EXPORT PFNGLGETNUNIFORMFVARBPROC __glewGetnUniformfvARB;
-GLEW_FUN_EXPORT PFNGLGETNUNIFORMIVARBPROC __glewGetnUniformivARB;
-GLEW_FUN_EXPORT PFNGLGETNUNIFORMUIVARBPROC __glewGetnUniformuivARB;
-GLEW_FUN_EXPORT PFNGLREADNPIXELSARBPROC __glewReadnPixelsARB;
-
-GLEW_FUN_EXPORT PFNGLMINSAMPLESHADINGARBPROC __glewMinSampleShadingARB;
-
-GLEW_FUN_EXPORT PFNGLBINDSAMPLERPROC __glewBindSampler;
-GLEW_FUN_EXPORT PFNGLDELETESAMPLERSPROC __glewDeleteSamplers;
-GLEW_FUN_EXPORT PFNGLGENSAMPLERSPROC __glewGenSamplers;
-GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIIVPROC __glewGetSamplerParameterIiv;
-GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIUIVPROC __glewGetSamplerParameterIuiv;
-GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERFVPROC __glewGetSamplerParameterfv;
-GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIVPROC __glewGetSamplerParameteriv;
-GLEW_FUN_EXPORT PFNGLISSAMPLERPROC __glewIsSampler;
-GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIIVPROC __glewSamplerParameterIiv;
-GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIUIVPROC __glewSamplerParameterIuiv;
-GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERFPROC __glewSamplerParameterf;
-GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERFVPROC __glewSamplerParameterfv;
-GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIPROC __glewSamplerParameteri;
-GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIVPROC __glewSamplerParameteriv;
-
-GLEW_FUN_EXPORT PFNGLACTIVESHADERPROGRAMPROC __glewActiveShaderProgram;
-GLEW_FUN_EXPORT PFNGLBINDPROGRAMPIPELINEPROC __glewBindProgramPipeline;
-GLEW_FUN_EXPORT PFNGLCREATESHADERPROGRAMVPROC __glewCreateShaderProgramv;
-GLEW_FUN_EXPORT PFNGLDELETEPROGRAMPIPELINESPROC __glewDeleteProgramPipelines;
-GLEW_FUN_EXPORT PFNGLGENPROGRAMPIPELINESPROC __glewGenProgramPipelines;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMPIPELINEINFOLOGPROC __glewGetProgramPipelineInfoLog;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMPIPELINEIVPROC __glewGetProgramPipelineiv;
-GLEW_FUN_EXPORT PFNGLISPROGRAMPIPELINEPROC __glewIsProgramPipeline;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DPROC __glewProgramUniform1d;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DVPROC __glewProgramUniform1dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FPROC __glewProgramUniform1f;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FVPROC __glewProgramUniform1fv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IPROC __glewProgramUniform1i;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IVPROC __glewProgramUniform1iv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIPROC __glewProgramUniform1ui;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIVPROC __glewProgramUniform1uiv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DPROC __glewProgramUniform2d;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DVPROC __glewProgramUniform2dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FPROC __glewProgramUniform2f;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FVPROC __glewProgramUniform2fv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IPROC __glewProgramUniform2i;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IVPROC __glewProgramUniform2iv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIPROC __glewProgramUniform2ui;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIVPROC __glewProgramUniform2uiv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DPROC __glewProgramUniform3d;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DVPROC __glewProgramUniform3dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FPROC __glewProgramUniform3f;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FVPROC __glewProgramUniform3fv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IPROC __glewProgramUniform3i;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IVPROC __glewProgramUniform3iv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIPROC __glewProgramUniform3ui;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIVPROC __glewProgramUniform3uiv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DPROC __glewProgramUniform4d;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DVPROC __glewProgramUniform4dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FPROC __glewProgramUniform4f;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FVPROC __glewProgramUniform4fv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IPROC __glewProgramUniform4i;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IVPROC __glewProgramUniform4iv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIPROC __glewProgramUniform4ui;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIVPROC __glewProgramUniform4uiv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2DVPROC __glewProgramUniformMatrix2dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2FVPROC __glewProgramUniformMatrix2fv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC __glewProgramUniformMatrix2x3dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC __glewProgramUniformMatrix2x3fv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC __glewProgramUniformMatrix2x4dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC __glewProgramUniformMatrix2x4fv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3DVPROC __glewProgramUniformMatrix3dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3FVPROC __glewProgramUniformMatrix3fv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC __glewProgramUniformMatrix3x2dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC __glewProgramUniformMatrix3x2fv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC __glewProgramUniformMatrix3x4dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC __glewProgramUniformMatrix3x4fv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4DVPROC __glewProgramUniformMatrix4dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4FVPROC __glewProgramUniformMatrix4fv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC __glewProgramUniformMatrix4x2dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC __glewProgramUniformMatrix4x2fv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC __glewProgramUniformMatrix4x3dv;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC __glewProgramUniformMatrix4x3fv;
-GLEW_FUN_EXPORT PFNGLUSEPROGRAMSTAGESPROC __glewUseProgramStages;
-GLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMPIPELINEPROC __glewValidateProgramPipeline;
-
-GLEW_FUN_EXPORT PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC __glewGetActiveAtomicCounterBufferiv;
-
-GLEW_FUN_EXPORT PFNGLBINDIMAGETEXTUREPROC __glewBindImageTexture;
-GLEW_FUN_EXPORT PFNGLMEMORYBARRIERPROC __glewMemoryBarrier;
-
-GLEW_FUN_EXPORT PFNGLATTACHOBJECTARBPROC __glewAttachObjectARB;
-GLEW_FUN_EXPORT PFNGLCOMPILESHADERARBPROC __glewCompileShaderARB;
-GLEW_FUN_EXPORT PFNGLCREATEPROGRAMOBJECTARBPROC __glewCreateProgramObjectARB;
-GLEW_FUN_EXPORT PFNGLCREATESHADEROBJECTARBPROC __glewCreateShaderObjectARB;
-GLEW_FUN_EXPORT PFNGLDELETEOBJECTARBPROC __glewDeleteObjectARB;
-GLEW_FUN_EXPORT PFNGLDETACHOBJECTARBPROC __glewDetachObjectARB;
-GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMARBPROC __glewGetActiveUniformARB;
-GLEW_FUN_EXPORT PFNGLGETATTACHEDOBJECTSARBPROC __glewGetAttachedObjectsARB;
-GLEW_FUN_EXPORT PFNGLGETHANDLEARBPROC __glewGetHandleARB;
-GLEW_FUN_EXPORT PFNGLGETINFOLOGARBPROC __glewGetInfoLogARB;
-GLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERFVARBPROC __glewGetObjectParameterfvARB;
-GLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERIVARBPROC __glewGetObjectParameterivARB;
-GLEW_FUN_EXPORT PFNGLGETSHADERSOURCEARBPROC __glewGetShaderSourceARB;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMLOCATIONARBPROC __glewGetUniformLocationARB;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMFVARBPROC __glewGetUniformfvARB;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMIVARBPROC __glewGetUniformivARB;
-GLEW_FUN_EXPORT PFNGLLINKPROGRAMARBPROC __glewLinkProgramARB;
-GLEW_FUN_EXPORT PFNGLSHADERSOURCEARBPROC __glewShaderSourceARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM1FARBPROC __glewUniform1fARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM1FVARBPROC __glewUniform1fvARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM1IARBPROC __glewUniform1iARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM1IVARBPROC __glewUniform1ivARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM2FARBPROC __glewUniform2fARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM2FVARBPROC __glewUniform2fvARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM2IARBPROC __glewUniform2iARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM2IVARBPROC __glewUniform2ivARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM3FARBPROC __glewUniform3fARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM3FVARBPROC __glewUniform3fvARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM3IARBPROC __glewUniform3iARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM3IVARBPROC __glewUniform3ivARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM4FARBPROC __glewUniform4fARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM4FVARBPROC __glewUniform4fvARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM4IARBPROC __glewUniform4iARB;
-GLEW_FUN_EXPORT PFNGLUNIFORM4IVARBPROC __glewUniform4ivARB;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2FVARBPROC __glewUniformMatrix2fvARB;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3FVARBPROC __glewUniformMatrix3fvARB;
-GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4FVARBPROC __glewUniformMatrix4fvARB;
-GLEW_FUN_EXPORT PFNGLUSEPROGRAMOBJECTARBPROC __glewUseProgramObjectARB;
-GLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMARBPROC __glewValidateProgramARB;
-
-GLEW_FUN_EXPORT PFNGLSHADERSTORAGEBLOCKBINDINGPROC __glewShaderStorageBlockBinding;
-
-GLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINENAMEPROC __glewGetActiveSubroutineName;
-GLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC __glewGetActiveSubroutineUniformName;
-GLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC __glewGetActiveSubroutineUniformiv;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMSTAGEIVPROC __glewGetProgramStageiv;
-GLEW_FUN_EXPORT PFNGLGETSUBROUTINEINDEXPROC __glewGetSubroutineIndex;
-GLEW_FUN_EXPORT PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC __glewGetSubroutineUniformLocation;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMSUBROUTINEUIVPROC __glewGetUniformSubroutineuiv;
-GLEW_FUN_EXPORT PFNGLUNIFORMSUBROUTINESUIVPROC __glewUniformSubroutinesuiv;
-
-GLEW_FUN_EXPORT PFNGLCOMPILESHADERINCLUDEARBPROC __glewCompileShaderIncludeARB;
-GLEW_FUN_EXPORT PFNGLDELETENAMEDSTRINGARBPROC __glewDeleteNamedStringARB;
-GLEW_FUN_EXPORT PFNGLGETNAMEDSTRINGARBPROC __glewGetNamedStringARB;
-GLEW_FUN_EXPORT PFNGLGETNAMEDSTRINGIVARBPROC __glewGetNamedStringivARB;
-GLEW_FUN_EXPORT PFNGLISNAMEDSTRINGARBPROC __glewIsNamedStringARB;
-GLEW_FUN_EXPORT PFNGLNAMEDSTRINGARBPROC __glewNamedStringARB;
-
-GLEW_FUN_EXPORT PFNGLBUFFERPAGECOMMITMENTARBPROC __glewBufferPageCommitmentARB;
-
-GLEW_FUN_EXPORT PFNGLTEXPAGECOMMITMENTARBPROC __glewTexPageCommitmentARB;
-GLEW_FUN_EXPORT PFNGLTEXTUREPAGECOMMITMENTEXTPROC __glewTexturePageCommitmentEXT;
-
-GLEW_FUN_EXPORT PFNGLCLIENTWAITSYNCPROC __glewClientWaitSync;
-GLEW_FUN_EXPORT PFNGLDELETESYNCPROC __glewDeleteSync;
-GLEW_FUN_EXPORT PFNGLFENCESYNCPROC __glewFenceSync;
-GLEW_FUN_EXPORT PFNGLGETINTEGER64VPROC __glewGetInteger64v;
-GLEW_FUN_EXPORT PFNGLGETSYNCIVPROC __glewGetSynciv;
-GLEW_FUN_EXPORT PFNGLISSYNCPROC __glewIsSync;
-GLEW_FUN_EXPORT PFNGLWAITSYNCPROC __glewWaitSync;
-
-GLEW_FUN_EXPORT PFNGLPATCHPARAMETERFVPROC __glewPatchParameterfv;
-GLEW_FUN_EXPORT PFNGLPATCHPARAMETERIPROC __glewPatchParameteri;
-
-GLEW_FUN_EXPORT PFNGLTEXTUREBARRIERPROC __glewTextureBarrier;
-
-GLEW_FUN_EXPORT PFNGLTEXBUFFERARBPROC __glewTexBufferARB;
-
-GLEW_FUN_EXPORT PFNGLTEXBUFFERRANGEPROC __glewTexBufferRange;
-GLEW_FUN_EXPORT PFNGLTEXTUREBUFFERRANGEEXTPROC __glewTextureBufferRangeEXT;
-
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE1DARBPROC __glewCompressedTexImage1DARB;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE2DARBPROC __glewCompressedTexImage2DARB;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DARBPROC __glewCompressedTexImage3DARB;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC __glewCompressedTexSubImage1DARB;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC __glewCompressedTexSubImage2DARB;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC __glewCompressedTexSubImage3DARB;
-GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXIMAGEARBPROC __glewGetCompressedTexImageARB;
-
-GLEW_FUN_EXPORT PFNGLGETMULTISAMPLEFVPROC __glewGetMultisamplefv;
-GLEW_FUN_EXPORT PFNGLSAMPLEMASKIPROC __glewSampleMaski;
-GLEW_FUN_EXPORT PFNGLTEXIMAGE2DMULTISAMPLEPROC __glewTexImage2DMultisample;
-GLEW_FUN_EXPORT PFNGLTEXIMAGE3DMULTISAMPLEPROC __glewTexImage3DMultisample;
-
-GLEW_FUN_EXPORT PFNGLTEXSTORAGE1DPROC __glewTexStorage1D;
-GLEW_FUN_EXPORT PFNGLTEXSTORAGE2DPROC __glewTexStorage2D;
-GLEW_FUN_EXPORT PFNGLTEXSTORAGE3DPROC __glewTexStorage3D;
-GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE1DEXTPROC __glewTextureStorage1DEXT;
-GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DEXTPROC __glewTextureStorage2DEXT;
-GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DEXTPROC __glewTextureStorage3DEXT;
-
-GLEW_FUN_EXPORT PFNGLTEXSTORAGE2DMULTISAMPLEPROC __glewTexStorage2DMultisample;
-GLEW_FUN_EXPORT PFNGLTEXSTORAGE3DMULTISAMPLEPROC __glewTexStorage3DMultisample;
-GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC __glewTextureStorage2DMultisampleEXT;
-GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC __glewTextureStorage3DMultisampleEXT;
-
-GLEW_FUN_EXPORT PFNGLTEXTUREVIEWPROC __glewTextureView;
-
-GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTI64VPROC __glewGetQueryObjecti64v;
-GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUI64VPROC __glewGetQueryObjectui64v;
-GLEW_FUN_EXPORT PFNGLQUERYCOUNTERPROC __glewQueryCounter;
-
-GLEW_FUN_EXPORT PFNGLBINDTRANSFORMFEEDBACKPROC __glewBindTransformFeedback;
-GLEW_FUN_EXPORT PFNGLDELETETRANSFORMFEEDBACKSPROC __glewDeleteTransformFeedbacks;
-GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKPROC __glewDrawTransformFeedback;
-GLEW_FUN_EXPORT PFNGLGENTRANSFORMFEEDBACKSPROC __glewGenTransformFeedbacks;
-GLEW_FUN_EXPORT PFNGLISTRANSFORMFEEDBACKPROC __glewIsTransformFeedback;
-GLEW_FUN_EXPORT PFNGLPAUSETRANSFORMFEEDBACKPROC __glewPauseTransformFeedback;
-GLEW_FUN_EXPORT PFNGLRESUMETRANSFORMFEEDBACKPROC __glewResumeTransformFeedback;
-
-GLEW_FUN_EXPORT PFNGLBEGINQUERYINDEXEDPROC __glewBeginQueryIndexed;
-GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC __glewDrawTransformFeedbackStream;
-GLEW_FUN_EXPORT PFNGLENDQUERYINDEXEDPROC __glewEndQueryIndexed;
-GLEW_FUN_EXPORT PFNGLGETQUERYINDEXEDIVPROC __glewGetQueryIndexediv;
-
-GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC __glewDrawTransformFeedbackInstanced;
-GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC __glewDrawTransformFeedbackStreamInstanced;
-
-GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDARBPROC __glewLoadTransposeMatrixdARB;
-GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFARBPROC __glewLoadTransposeMatrixfARB;
-GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDARBPROC __glewMultTransposeMatrixdARB;
-GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFARBPROC __glewMultTransposeMatrixfARB;
-
-GLEW_FUN_EXPORT PFNGLBINDBUFFERBASEPROC __glewBindBufferBase;
-GLEW_FUN_EXPORT PFNGLBINDBUFFERRANGEPROC __glewBindBufferRange;
-GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC __glewGetActiveUniformBlockName;
-GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMBLOCKIVPROC __glewGetActiveUniformBlockiv;
-GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMNAMEPROC __glewGetActiveUniformName;
-GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMSIVPROC __glewGetActiveUniformsiv;
-GLEW_FUN_EXPORT PFNGLGETINTEGERI_VPROC __glewGetIntegeri_v;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMBLOCKINDEXPROC __glewGetUniformBlockIndex;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMINDICESPROC __glewGetUniformIndices;
-GLEW_FUN_EXPORT PFNGLUNIFORMBLOCKBINDINGPROC __glewUniformBlockBinding;
-
-GLEW_FUN_EXPORT PFNGLBINDVERTEXARRAYPROC __glewBindVertexArray;
-GLEW_FUN_EXPORT PFNGLDELETEVERTEXARRAYSPROC __glewDeleteVertexArrays;
-GLEW_FUN_EXPORT PFNGLGENVERTEXARRAYSPROC __glewGenVertexArrays;
-GLEW_FUN_EXPORT PFNGLISVERTEXARRAYPROC __glewIsVertexArray;
-
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLDVPROC __glewGetVertexAttribLdv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DPROC __glewVertexAttribL1d;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DVPROC __glewVertexAttribL1dv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DPROC __glewVertexAttribL2d;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DVPROC __glewVertexAttribL2dv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DPROC __glewVertexAttribL3d;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DVPROC __glewVertexAttribL3dv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DPROC __glewVertexAttribL4d;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DVPROC __glewVertexAttribL4dv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBLPOINTERPROC __glewVertexAttribLPointer;
-
-GLEW_FUN_EXPORT PFNGLBINDVERTEXBUFFERPROC __glewBindVertexBuffer;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC __glewVertexArrayBindVertexBufferEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC __glewVertexArrayVertexAttribBindingEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC __glewVertexArrayVertexAttribFormatEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC __glewVertexArrayVertexAttribIFormatEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC __glewVertexArrayVertexAttribLFormatEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC __glewVertexArrayVertexBindingDivisorEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBBINDINGPROC __glewVertexAttribBinding;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBFORMATPROC __glewVertexAttribFormat;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIFORMATPROC __glewVertexAttribIFormat;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBLFORMATPROC __glewVertexAttribLFormat;
-GLEW_FUN_EXPORT PFNGLVERTEXBINDINGDIVISORPROC __glewVertexBindingDivisor;
-
-GLEW_FUN_EXPORT PFNGLVERTEXBLENDARBPROC __glewVertexBlendARB;
-GLEW_FUN_EXPORT PFNGLWEIGHTPOINTERARBPROC __glewWeightPointerARB;
-GLEW_FUN_EXPORT PFNGLWEIGHTBVARBPROC __glewWeightbvARB;
-GLEW_FUN_EXPORT PFNGLWEIGHTDVARBPROC __glewWeightdvARB;
-GLEW_FUN_EXPORT PFNGLWEIGHTFVARBPROC __glewWeightfvARB;
-GLEW_FUN_EXPORT PFNGLWEIGHTIVARBPROC __glewWeightivARB;
-GLEW_FUN_EXPORT PFNGLWEIGHTSVARBPROC __glewWeightsvARB;
-GLEW_FUN_EXPORT PFNGLWEIGHTUBVARBPROC __glewWeightubvARB;
-GLEW_FUN_EXPORT PFNGLWEIGHTUIVARBPROC __glewWeightuivARB;
-GLEW_FUN_EXPORT PFNGLWEIGHTUSVARBPROC __glewWeightusvARB;
-
-GLEW_FUN_EXPORT PFNGLBINDBUFFERARBPROC __glewBindBufferARB;
-GLEW_FUN_EXPORT PFNGLBUFFERDATAARBPROC __glewBufferDataARB;
-GLEW_FUN_EXPORT PFNGLBUFFERSUBDATAARBPROC __glewBufferSubDataARB;
-GLEW_FUN_EXPORT PFNGLDELETEBUFFERSARBPROC __glewDeleteBuffersARB;
-GLEW_FUN_EXPORT PFNGLGENBUFFERSARBPROC __glewGenBuffersARB;
-GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERIVARBPROC __glewGetBufferParameterivARB;
-GLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVARBPROC __glewGetBufferPointervARB;
-GLEW_FUN_EXPORT PFNGLGETBUFFERSUBDATAARBPROC __glewGetBufferSubDataARB;
-GLEW_FUN_EXPORT PFNGLISBUFFERARBPROC __glewIsBufferARB;
-GLEW_FUN_EXPORT PFNGLMAPBUFFERARBPROC __glewMapBufferARB;
-GLEW_FUN_EXPORT PFNGLUNMAPBUFFERARBPROC __glewUnmapBufferARB;
-
-GLEW_FUN_EXPORT PFNGLBINDPROGRAMARBPROC __glewBindProgramARB;
-GLEW_FUN_EXPORT PFNGLDELETEPROGRAMSARBPROC __glewDeleteProgramsARB;
-GLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBARRAYARBPROC __glewDisableVertexAttribArrayARB;
-GLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBARRAYARBPROC __glewEnableVertexAttribArrayARB;
-GLEW_FUN_EXPORT PFNGLGENPROGRAMSARBPROC __glewGenProgramsARB;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMENVPARAMETERDVARBPROC __glewGetProgramEnvParameterdvARB;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMENVPARAMETERFVARBPROC __glewGetProgramEnvParameterfvARB;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC __glewGetProgramLocalParameterdvARB;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC __glewGetProgramLocalParameterfvARB;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMSTRINGARBPROC __glewGetProgramStringARB;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMIVARBPROC __glewGetProgramivARB;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVARBPROC __glewGetVertexAttribPointervARB;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVARBPROC __glewGetVertexAttribdvARB;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVARBPROC __glewGetVertexAttribfvARB;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVARBPROC __glewGetVertexAttribivARB;
-GLEW_FUN_EXPORT PFNGLISPROGRAMARBPROC __glewIsProgramARB;
-GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4DARBPROC __glewProgramEnvParameter4dARB;
-GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4DVARBPROC __glewProgramEnvParameter4dvARB;
-GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4FARBPROC __glewProgramEnvParameter4fARB;
-GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4FVARBPROC __glewProgramEnvParameter4fvARB;
-GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4DARBPROC __glewProgramLocalParameter4dARB;
-GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4DVARBPROC __glewProgramLocalParameter4dvARB;
-GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4FARBPROC __glewProgramLocalParameter4fARB;
-GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4FVARBPROC __glewProgramLocalParameter4fvARB;
-GLEW_FUN_EXPORT PFNGLPROGRAMSTRINGARBPROC __glewProgramStringARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DARBPROC __glewVertexAttrib1dARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVARBPROC __glewVertexAttrib1dvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FARBPROC __glewVertexAttrib1fARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVARBPROC __glewVertexAttrib1fvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SARBPROC __glewVertexAttrib1sARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVARBPROC __glewVertexAttrib1svARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DARBPROC __glewVertexAttrib2dARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVARBPROC __glewVertexAttrib2dvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FARBPROC __glewVertexAttrib2fARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVARBPROC __glewVertexAttrib2fvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SARBPROC __glewVertexAttrib2sARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVARBPROC __glewVertexAttrib2svARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DARBPROC __glewVertexAttrib3dARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVARBPROC __glewVertexAttrib3dvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FARBPROC __glewVertexAttrib3fARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVARBPROC __glewVertexAttrib3fvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SARBPROC __glewVertexAttrib3sARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVARBPROC __glewVertexAttrib3svARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NBVARBPROC __glewVertexAttrib4NbvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NIVARBPROC __glewVertexAttrib4NivARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NSVARBPROC __glewVertexAttrib4NsvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBARBPROC __glewVertexAttrib4NubARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBVARBPROC __glewVertexAttrib4NubvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUIVARBPROC __glewVertexAttrib4NuivARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUSVARBPROC __glewVertexAttrib4NusvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4BVARBPROC __glewVertexAttrib4bvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DARBPROC __glewVertexAttrib4dARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVARBPROC __glewVertexAttrib4dvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FARBPROC __glewVertexAttrib4fARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVARBPROC __glewVertexAttrib4fvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4IVARBPROC __glewVertexAttrib4ivARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SARBPROC __glewVertexAttrib4sARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVARBPROC __glewVertexAttrib4svARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVARBPROC __glewVertexAttrib4ubvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UIVARBPROC __glewVertexAttrib4uivARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4USVARBPROC __glewVertexAttrib4usvARB;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERARBPROC __glewVertexAttribPointerARB;
-
-GLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONARBPROC __glewBindAttribLocationARB;
-GLEW_FUN_EXPORT PFNGLGETACTIVEATTRIBARBPROC __glewGetActiveAttribARB;
-GLEW_FUN_EXPORT PFNGLGETATTRIBLOCATIONARBPROC __glewGetAttribLocationARB;
-
-GLEW_FUN_EXPORT PFNGLCOLORP3UIPROC __glewColorP3ui;
-GLEW_FUN_EXPORT PFNGLCOLORP3UIVPROC __glewColorP3uiv;
-GLEW_FUN_EXPORT PFNGLCOLORP4UIPROC __glewColorP4ui;
-GLEW_FUN_EXPORT PFNGLCOLORP4UIVPROC __glewColorP4uiv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP1UIPROC __glewMultiTexCoordP1ui;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP1UIVPROC __glewMultiTexCoordP1uiv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP2UIPROC __glewMultiTexCoordP2ui;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP2UIVPROC __glewMultiTexCoordP2uiv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP3UIPROC __glewMultiTexCoordP3ui;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP3UIVPROC __glewMultiTexCoordP3uiv;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP4UIPROC __glewMultiTexCoordP4ui;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP4UIVPROC __glewMultiTexCoordP4uiv;
-GLEW_FUN_EXPORT PFNGLNORMALP3UIPROC __glewNormalP3ui;
-GLEW_FUN_EXPORT PFNGLNORMALP3UIVPROC __glewNormalP3uiv;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLORP3UIPROC __glewSecondaryColorP3ui;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLORP3UIVPROC __glewSecondaryColorP3uiv;
-GLEW_FUN_EXPORT PFNGLTEXCOORDP1UIPROC __glewTexCoordP1ui;
-GLEW_FUN_EXPORT PFNGLTEXCOORDP1UIVPROC __glewTexCoordP1uiv;
-GLEW_FUN_EXPORT PFNGLTEXCOORDP2UIPROC __glewTexCoordP2ui;
-GLEW_FUN_EXPORT PFNGLTEXCOORDP2UIVPROC __glewTexCoordP2uiv;
-GLEW_FUN_EXPORT PFNGLTEXCOORDP3UIPROC __glewTexCoordP3ui;
-GLEW_FUN_EXPORT PFNGLTEXCOORDP3UIVPROC __glewTexCoordP3uiv;
-GLEW_FUN_EXPORT PFNGLTEXCOORDP4UIPROC __glewTexCoordP4ui;
-GLEW_FUN_EXPORT PFNGLTEXCOORDP4UIVPROC __glewTexCoordP4uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP1UIPROC __glewVertexAttribP1ui;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP1UIVPROC __glewVertexAttribP1uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP2UIPROC __glewVertexAttribP2ui;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP2UIVPROC __glewVertexAttribP2uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP3UIPROC __glewVertexAttribP3ui;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP3UIVPROC __glewVertexAttribP3uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP4UIPROC __glewVertexAttribP4ui;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP4UIVPROC __glewVertexAttribP4uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXP2UIPROC __glewVertexP2ui;
-GLEW_FUN_EXPORT PFNGLVERTEXP2UIVPROC __glewVertexP2uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXP3UIPROC __glewVertexP3ui;
-GLEW_FUN_EXPORT PFNGLVERTEXP3UIVPROC __glewVertexP3uiv;
-GLEW_FUN_EXPORT PFNGLVERTEXP4UIPROC __glewVertexP4ui;
-GLEW_FUN_EXPORT PFNGLVERTEXP4UIVPROC __glewVertexP4uiv;
-
-GLEW_FUN_EXPORT PFNGLDEPTHRANGEARRAYVPROC __glewDepthRangeArrayv;
-GLEW_FUN_EXPORT PFNGLDEPTHRANGEINDEXEDPROC __glewDepthRangeIndexed;
-GLEW_FUN_EXPORT PFNGLGETDOUBLEI_VPROC __glewGetDoublei_v;
-GLEW_FUN_EXPORT PFNGLGETFLOATI_VPROC __glewGetFloati_v;
-GLEW_FUN_EXPORT PFNGLSCISSORARRAYVPROC __glewScissorArrayv;
-GLEW_FUN_EXPORT PFNGLSCISSORINDEXEDPROC __glewScissorIndexed;
-GLEW_FUN_EXPORT PFNGLSCISSORINDEXEDVPROC __glewScissorIndexedv;
-GLEW_FUN_EXPORT PFNGLVIEWPORTARRAYVPROC __glewViewportArrayv;
-GLEW_FUN_EXPORT PFNGLVIEWPORTINDEXEDFPROC __glewViewportIndexedf;
-GLEW_FUN_EXPORT PFNGLVIEWPORTINDEXEDFVPROC __glewViewportIndexedfv;
-
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2DARBPROC __glewWindowPos2dARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2DVARBPROC __glewWindowPos2dvARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2FARBPROC __glewWindowPos2fARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2FVARBPROC __glewWindowPos2fvARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2IARBPROC __glewWindowPos2iARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2IVARBPROC __glewWindowPos2ivARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2SARBPROC __glewWindowPos2sARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2SVARBPROC __glewWindowPos2svARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3DARBPROC __glewWindowPos3dARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3DVARBPROC __glewWindowPos3dvARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3FARBPROC __glewWindowPos3fARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3FVARBPROC __glewWindowPos3fvARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3IARBPROC __glewWindowPos3iARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3IVARBPROC __glewWindowPos3ivARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3SARBPROC __glewWindowPos3sARB;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3SVARBPROC __glewWindowPos3svARB;
-
-GLEW_FUN_EXPORT PFNGLDRAWBUFFERSATIPROC __glewDrawBuffersATI;
-
-GLEW_FUN_EXPORT PFNGLDRAWELEMENTARRAYATIPROC __glewDrawElementArrayATI;
-GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTARRAYATIPROC __glewDrawRangeElementArrayATI;
-GLEW_FUN_EXPORT PFNGLELEMENTPOINTERATIPROC __glewElementPointerATI;
-
-GLEW_FUN_EXPORT PFNGLGETTEXBUMPPARAMETERFVATIPROC __glewGetTexBumpParameterfvATI;
-GLEW_FUN_EXPORT PFNGLGETTEXBUMPPARAMETERIVATIPROC __glewGetTexBumpParameterivATI;
-GLEW_FUN_EXPORT PFNGLTEXBUMPPARAMETERFVATIPROC __glewTexBumpParameterfvATI;
-GLEW_FUN_EXPORT PFNGLTEXBUMPPARAMETERIVATIPROC __glewTexBumpParameterivATI;
-
-GLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP1ATIPROC __glewAlphaFragmentOp1ATI;
-GLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP2ATIPROC __glewAlphaFragmentOp2ATI;
-GLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP3ATIPROC __glewAlphaFragmentOp3ATI;
-GLEW_FUN_EXPORT PFNGLBEGINFRAGMENTSHADERATIPROC __glewBeginFragmentShaderATI;
-GLEW_FUN_EXPORT PFNGLBINDFRAGMENTSHADERATIPROC __glewBindFragmentShaderATI;
-GLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP1ATIPROC __glewColorFragmentOp1ATI;
-GLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP2ATIPROC __glewColorFragmentOp2ATI;
-GLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP3ATIPROC __glewColorFragmentOp3ATI;
-GLEW_FUN_EXPORT PFNGLDELETEFRAGMENTSHADERATIPROC __glewDeleteFragmentShaderATI;
-GLEW_FUN_EXPORT PFNGLENDFRAGMENTSHADERATIPROC __glewEndFragmentShaderATI;
-GLEW_FUN_EXPORT PFNGLGENFRAGMENTSHADERSATIPROC __glewGenFragmentShadersATI;
-GLEW_FUN_EXPORT PFNGLPASSTEXCOORDATIPROC __glewPassTexCoordATI;
-GLEW_FUN_EXPORT PFNGLSAMPLEMAPATIPROC __glewSampleMapATI;
-GLEW_FUN_EXPORT PFNGLSETFRAGMENTSHADERCONSTANTATIPROC __glewSetFragmentShaderConstantATI;
-
-GLEW_FUN_EXPORT PFNGLMAPOBJECTBUFFERATIPROC __glewMapObjectBufferATI;
-GLEW_FUN_EXPORT PFNGLUNMAPOBJECTBUFFERATIPROC __glewUnmapObjectBufferATI;
-
-GLEW_FUN_EXPORT PFNGLPNTRIANGLESFATIPROC __glewPNTrianglesfATI;
-GLEW_FUN_EXPORT PFNGLPNTRIANGLESIATIPROC __glewPNTrianglesiATI;
-
-GLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEATIPROC __glewStencilFuncSeparateATI;
-GLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEATIPROC __glewStencilOpSeparateATI;
-
-GLEW_FUN_EXPORT PFNGLARRAYOBJECTATIPROC __glewArrayObjectATI;
-GLEW_FUN_EXPORT PFNGLFREEOBJECTBUFFERATIPROC __glewFreeObjectBufferATI;
-GLEW_FUN_EXPORT PFNGLGETARRAYOBJECTFVATIPROC __glewGetArrayObjectfvATI;
-GLEW_FUN_EXPORT PFNGLGETARRAYOBJECTIVATIPROC __glewGetArrayObjectivATI;
-GLEW_FUN_EXPORT PFNGLGETOBJECTBUFFERFVATIPROC __glewGetObjectBufferfvATI;
-GLEW_FUN_EXPORT PFNGLGETOBJECTBUFFERIVATIPROC __glewGetObjectBufferivATI;
-GLEW_FUN_EXPORT PFNGLGETVARIANTARRAYOBJECTFVATIPROC __glewGetVariantArrayObjectfvATI;
-GLEW_FUN_EXPORT PFNGLGETVARIANTARRAYOBJECTIVATIPROC __glewGetVariantArrayObjectivATI;
-GLEW_FUN_EXPORT PFNGLISOBJECTBUFFERATIPROC __glewIsObjectBufferATI;
-GLEW_FUN_EXPORT PFNGLNEWOBJECTBUFFERATIPROC __glewNewObjectBufferATI;
-GLEW_FUN_EXPORT PFNGLUPDATEOBJECTBUFFERATIPROC __glewUpdateObjectBufferATI;
-GLEW_FUN_EXPORT PFNGLVARIANTARRAYOBJECTATIPROC __glewVariantArrayObjectATI;
-
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC __glewGetVertexAttribArrayObjectfvATI;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC __glewGetVertexAttribArrayObjectivATI;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBARRAYOBJECTATIPROC __glewVertexAttribArrayObjectATI;
-
-GLEW_FUN_EXPORT PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC __glewClientActiveVertexStreamATI;
-GLEW_FUN_EXPORT PFNGLNORMALSTREAM3BATIPROC __glewNormalStream3bATI;
-GLEW_FUN_EXPORT PFNGLNORMALSTREAM3BVATIPROC __glewNormalStream3bvATI;
-GLEW_FUN_EXPORT PFNGLNORMALSTREAM3DATIPROC __glewNormalStream3dATI;
-GLEW_FUN_EXPORT PFNGLNORMALSTREAM3DVATIPROC __glewNormalStream3dvATI;
-GLEW_FUN_EXPORT PFNGLNORMALSTREAM3FATIPROC __glewNormalStream3fATI;
-GLEW_FUN_EXPORT PFNGLNORMALSTREAM3FVATIPROC __glewNormalStream3fvATI;
-GLEW_FUN_EXPORT PFNGLNORMALSTREAM3IATIPROC __glewNormalStream3iATI;
-GLEW_FUN_EXPORT PFNGLNORMALSTREAM3IVATIPROC __glewNormalStream3ivATI;
-GLEW_FUN_EXPORT PFNGLNORMALSTREAM3SATIPROC __glewNormalStream3sATI;
-GLEW_FUN_EXPORT PFNGLNORMALSTREAM3SVATIPROC __glewNormalStream3svATI;
-GLEW_FUN_EXPORT PFNGLVERTEXBLENDENVFATIPROC __glewVertexBlendEnvfATI;
-GLEW_FUN_EXPORT PFNGLVERTEXBLENDENVIATIPROC __glewVertexBlendEnviATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1DATIPROC __glewVertexStream1dATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1DVATIPROC __glewVertexStream1dvATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1FATIPROC __glewVertexStream1fATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1FVATIPROC __glewVertexStream1fvATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1IATIPROC __glewVertexStream1iATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1IVATIPROC __glewVertexStream1ivATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1SATIPROC __glewVertexStream1sATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1SVATIPROC __glewVertexStream1svATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2DATIPROC __glewVertexStream2dATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2DVATIPROC __glewVertexStream2dvATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2FATIPROC __glewVertexStream2fATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2FVATIPROC __glewVertexStream2fvATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2IATIPROC __glewVertexStream2iATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2IVATIPROC __glewVertexStream2ivATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2SATIPROC __glewVertexStream2sATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2SVATIPROC __glewVertexStream2svATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3DATIPROC __glewVertexStream3dATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3DVATIPROC __glewVertexStream3dvATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3FATIPROC __glewVertexStream3fATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3FVATIPROC __glewVertexStream3fvATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3IATIPROC __glewVertexStream3iATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3IVATIPROC __glewVertexStream3ivATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3SATIPROC __glewVertexStream3sATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3SVATIPROC __glewVertexStream3svATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4DATIPROC __glewVertexStream4dATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4DVATIPROC __glewVertexStream4dvATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4FATIPROC __glewVertexStream4fATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4FVATIPROC __glewVertexStream4fvATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IATIPROC __glewVertexStream4iATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IVATIPROC __glewVertexStream4ivATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SATIPROC __glewVertexStream4sATI;
-GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SVATIPROC __glewVertexStream4svATI;
-
-GLEW_FUN_EXPORT PFNGLGETUNIFORMBUFFERSIZEEXTPROC __glewGetUniformBufferSizeEXT;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMOFFSETEXTPROC __glewGetUniformOffsetEXT;
-GLEW_FUN_EXPORT PFNGLUNIFORMBUFFEREXTPROC __glewUniformBufferEXT;
-
-GLEW_FUN_EXPORT PFNGLBLENDCOLOREXTPROC __glewBlendColorEXT;
-
-GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEEXTPROC __glewBlendEquationSeparateEXT;
-
-GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEEXTPROC __glewBlendFuncSeparateEXT;
-
-GLEW_FUN_EXPORT PFNGLBLENDEQUATIONEXTPROC __glewBlendEquationEXT;
-
-GLEW_FUN_EXPORT PFNGLCOLORSUBTABLEEXTPROC __glewColorSubTableEXT;
-GLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEEXTPROC __glewCopyColorSubTableEXT;
-
-GLEW_FUN_EXPORT PFNGLLOCKARRAYSEXTPROC __glewLockArraysEXT;
-GLEW_FUN_EXPORT PFNGLUNLOCKARRAYSEXTPROC __glewUnlockArraysEXT;
-
-GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER1DEXTPROC __glewConvolutionFilter1DEXT;
-GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER2DEXTPROC __glewConvolutionFilter2DEXT;
-GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFEXTPROC __glewConvolutionParameterfEXT;
-GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFVEXTPROC __glewConvolutionParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIEXTPROC __glewConvolutionParameteriEXT;
-GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIVEXTPROC __glewConvolutionParameterivEXT;
-GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC __glewCopyConvolutionFilter1DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC __glewCopyConvolutionFilter2DEXT;
-GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONFILTEREXTPROC __glewGetConvolutionFilterEXT;
-GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC __glewGetConvolutionParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC __glewGetConvolutionParameterivEXT;
-GLEW_FUN_EXPORT PFNGLGETSEPARABLEFILTEREXTPROC __glewGetSeparableFilterEXT;
-GLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DEXTPROC __glewSeparableFilter2DEXT;
-
-GLEW_FUN_EXPORT PFNGLBINORMALPOINTEREXTPROC __glewBinormalPointerEXT;
-GLEW_FUN_EXPORT PFNGLTANGENTPOINTEREXTPROC __glewTangentPointerEXT;
-
-GLEW_FUN_EXPORT PFNGLCOPYTEXIMAGE1DEXTPROC __glewCopyTexImage1DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYTEXIMAGE2DEXTPROC __glewCopyTexImage2DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE1DEXTPROC __glewCopyTexSubImage1DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE2DEXTPROC __glewCopyTexSubImage2DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT;
-
-GLEW_FUN_EXPORT PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT;
-GLEW_FUN_EXPORT PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT;
-
-GLEW_FUN_EXPORT PFNGLGETOBJECTLABELEXTPROC __glewGetObjectLabelEXT;
-GLEW_FUN_EXPORT PFNGLLABELOBJECTEXTPROC __glewLabelObjectEXT;
-
-GLEW_FUN_EXPORT PFNGLINSERTEVENTMARKEREXTPROC __glewInsertEventMarkerEXT;
-GLEW_FUN_EXPORT PFNGLPOPGROUPMARKEREXTPROC __glewPopGroupMarkerEXT;
-GLEW_FUN_EXPORT PFNGLPUSHGROUPMARKEREXTPROC __glewPushGroupMarkerEXT;
-
-GLEW_FUN_EXPORT PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT;
-
-GLEW_FUN_EXPORT PFNGLBINDMULTITEXTUREEXTPROC __glewBindMultiTextureEXT;
-GLEW_FUN_EXPORT PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC __glewCheckNamedFramebufferStatusEXT;
-GLEW_FUN_EXPORT PFNGLCLIENTATTRIBDEFAULTEXTPROC __glewClientAttribDefaultEXT;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC __glewCompressedMultiTexImage1DEXT;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC __glewCompressedMultiTexImage2DEXT;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC __glewCompressedMultiTexImage3DEXT;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC __glewCompressedMultiTexSubImage1DEXT;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC __glewCompressedMultiTexSubImage2DEXT;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC __glewCompressedMultiTexSubImage3DEXT;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC __glewCompressedTextureImage1DEXT;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC __glewCompressedTextureImage2DEXT;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC __glewCompressedTextureImage3DEXT;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC __glewCompressedTextureSubImage1DEXT;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC __glewCompressedTextureSubImage2DEXT;
-GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC __glewCompressedTextureSubImage3DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYMULTITEXIMAGE1DEXTPROC __glewCopyMultiTexImage1DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYMULTITEXIMAGE2DEXTPROC __glewCopyMultiTexImage2DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC __glewCopyMultiTexSubImage1DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC __glewCopyMultiTexSubImage2DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC __glewCopyMultiTexSubImage3DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYTEXTUREIMAGE1DEXTPROC __glewCopyTextureImage1DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYTEXTUREIMAGE2DEXTPROC __glewCopyTextureImage2DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC __glewCopyTextureSubImage1DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC __glewCopyTextureSubImage2DEXT;
-GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC __glewCopyTextureSubImage3DEXT;
-GLEW_FUN_EXPORT PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC __glewDisableClientStateIndexedEXT;
-GLEW_FUN_EXPORT PFNGLDISABLECLIENTSTATEIEXTPROC __glewDisableClientStateiEXT;
-GLEW_FUN_EXPORT PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC __glewDisableVertexArrayAttribEXT;
-GLEW_FUN_EXPORT PFNGLDISABLEVERTEXARRAYEXTPROC __glewDisableVertexArrayEXT;
-GLEW_FUN_EXPORT PFNGLENABLECLIENTSTATEINDEXEDEXTPROC __glewEnableClientStateIndexedEXT;
-GLEW_FUN_EXPORT PFNGLENABLECLIENTSTATEIEXTPROC __glewEnableClientStateiEXT;
-GLEW_FUN_EXPORT PFNGLENABLEVERTEXARRAYATTRIBEXTPROC __glewEnableVertexArrayAttribEXT;
-GLEW_FUN_EXPORT PFNGLENABLEVERTEXARRAYEXTPROC __glewEnableVertexArrayEXT;
-GLEW_FUN_EXPORT PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC __glewFlushMappedNamedBufferRangeEXT;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC __glewFramebufferDrawBufferEXT;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC __glewFramebufferDrawBuffersEXT;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERREADBUFFEREXTPROC __glewFramebufferReadBufferEXT;
-GLEW_FUN_EXPORT PFNGLGENERATEMULTITEXMIPMAPEXTPROC __glewGenerateMultiTexMipmapEXT;
-GLEW_FUN_EXPORT PFNGLGENERATETEXTUREMIPMAPEXTPROC __glewGenerateTextureMipmapEXT;
-GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC __glewGetCompressedMultiTexImageEXT;
-GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC __glewGetCompressedTextureImageEXT;
-GLEW_FUN_EXPORT PFNGLGETDOUBLEINDEXEDVEXTPROC __glewGetDoubleIndexedvEXT;
-GLEW_FUN_EXPORT PFNGLGETDOUBLEI_VEXTPROC __glewGetDoublei_vEXT;
-GLEW_FUN_EXPORT PFNGLGETFLOATINDEXEDVEXTPROC __glewGetFloatIndexedvEXT;
-GLEW_FUN_EXPORT PFNGLGETFLOATI_VEXTPROC __glewGetFloati_vEXT;
-GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC __glewGetFramebufferParameterivEXT;
-GLEW_FUN_EXPORT PFNGLGETMULTITEXENVFVEXTPROC __glewGetMultiTexEnvfvEXT;
-GLEW_FUN_EXPORT PFNGLGETMULTITEXENVIVEXTPROC __glewGetMultiTexEnvivEXT;
-GLEW_FUN_EXPORT PFNGLGETMULTITEXGENDVEXTPROC __glewGetMultiTexGendvEXT;
-GLEW_FUN_EXPORT PFNGLGETMULTITEXGENFVEXTPROC __glewGetMultiTexGenfvEXT;
-GLEW_FUN_EXPORT PFNGLGETMULTITEXGENIVEXTPROC __glewGetMultiTexGenivEXT;
-GLEW_FUN_EXPORT PFNGLGETMULTITEXIMAGEEXTPROC __glewGetMultiTexImageEXT;
-GLEW_FUN_EXPORT PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC __glewGetMultiTexLevelParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC __glewGetMultiTexLevelParameterivEXT;
-GLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIIVEXTPROC __glewGetMultiTexParameterIivEXT;
-GLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIUIVEXTPROC __glewGetMultiTexParameterIuivEXT;
-GLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERFVEXTPROC __glewGetMultiTexParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIVEXTPROC __glewGetMultiTexParameterivEXT;
-GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC __glewGetNamedBufferParameterivEXT;
-GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPOINTERVEXTPROC __glewGetNamedBufferPointervEXT;
-GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERSUBDATAEXTPROC __glewGetNamedBufferSubDataEXT;
-GLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetNamedFramebufferAttachmentParameterivEXT;
-GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC __glewGetNamedProgramLocalParameterIivEXT;
-GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC __glewGetNamedProgramLocalParameterIuivEXT;
-GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC __glewGetNamedProgramLocalParameterdvEXT;
-GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC __glewGetNamedProgramLocalParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMSTRINGEXTPROC __glewGetNamedProgramStringEXT;
-GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMIVEXTPROC __glewGetNamedProgramivEXT;
-GLEW_FUN_EXPORT PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC __glewGetNamedRenderbufferParameterivEXT;
-GLEW_FUN_EXPORT PFNGLGETPOINTERINDEXEDVEXTPROC __glewGetPointerIndexedvEXT;
-GLEW_FUN_EXPORT PFNGLGETPOINTERI_VEXTPROC __glewGetPointeri_vEXT;
-GLEW_FUN_EXPORT PFNGLGETTEXTUREIMAGEEXTPROC __glewGetTextureImageEXT;
-GLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC __glewGetTextureLevelParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC __glewGetTextureLevelParameterivEXT;
-GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIIVEXTPROC __glewGetTextureParameterIivEXT;
-GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIUIVEXTPROC __glewGetTextureParameterIuivEXT;
-GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERFVEXTPROC __glewGetTextureParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIVEXTPROC __glewGetTextureParameterivEXT;
-GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC __glewGetVertexArrayIntegeri_vEXT;
-GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINTEGERVEXTPROC __glewGetVertexArrayIntegervEXT;
-GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC __glewGetVertexArrayPointeri_vEXT;
-GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYPOINTERVEXTPROC __glewGetVertexArrayPointervEXT;
-GLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFEREXTPROC __glewMapNamedBufferEXT;
-GLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFERRANGEEXTPROC __glewMapNamedBufferRangeEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXFRUSTUMEXTPROC __glewMatrixFrustumEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXLOADIDENTITYEXTPROC __glewMatrixLoadIdentityEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXLOADTRANSPOSEDEXTPROC __glewMatrixLoadTransposedEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXLOADTRANSPOSEFEXTPROC __glewMatrixLoadTransposefEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXLOADDEXTPROC __glewMatrixLoaddEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXLOADFEXTPROC __glewMatrixLoadfEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXMULTTRANSPOSEDEXTPROC __glewMatrixMultTransposedEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXMULTTRANSPOSEFEXTPROC __glewMatrixMultTransposefEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXMULTDEXTPROC __glewMatrixMultdEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXMULTFEXTPROC __glewMatrixMultfEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXORTHOEXTPROC __glewMatrixOrthoEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXPOPEXTPROC __glewMatrixPopEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXPUSHEXTPROC __glewMatrixPushEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXROTATEDEXTPROC __glewMatrixRotatedEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXROTATEFEXTPROC __glewMatrixRotatefEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXSCALEDEXTPROC __glewMatrixScaledEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXSCALEFEXTPROC __glewMatrixScalefEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXTRANSLATEDEXTPROC __glewMatrixTranslatedEXT;
-GLEW_FUN_EXPORT PFNGLMATRIXTRANSLATEFEXTPROC __glewMatrixTranslatefEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXBUFFEREXTPROC __glewMultiTexBufferEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORDPOINTEREXTPROC __glewMultiTexCoordPointerEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXENVFEXTPROC __glewMultiTexEnvfEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXENVFVEXTPROC __glewMultiTexEnvfvEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXENVIEXTPROC __glewMultiTexEnviEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXENVIVEXTPROC __glewMultiTexEnvivEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXGENDEXTPROC __glewMultiTexGendEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXGENDVEXTPROC __glewMultiTexGendvEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXGENFEXTPROC __glewMultiTexGenfEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXGENFVEXTPROC __glewMultiTexGenfvEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXGENIEXTPROC __glewMultiTexGeniEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXGENIVEXTPROC __glewMultiTexGenivEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXIMAGE1DEXTPROC __glewMultiTexImage1DEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXIMAGE2DEXTPROC __glewMultiTexImage2DEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXIMAGE3DEXTPROC __glewMultiTexImage3DEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIIVEXTPROC __glewMultiTexParameterIivEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIUIVEXTPROC __glewMultiTexParameterIuivEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERFEXTPROC __glewMultiTexParameterfEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERFVEXTPROC __glewMultiTexParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIEXTPROC __glewMultiTexParameteriEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIVEXTPROC __glewMultiTexParameterivEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXRENDERBUFFEREXTPROC __glewMultiTexRenderbufferEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE1DEXTPROC __glewMultiTexSubImage1DEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE2DEXTPROC __glewMultiTexSubImage2DEXT;
-GLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE3DEXTPROC __glewMultiTexSubImage3DEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDBUFFERDATAEXTPROC __glewNamedBufferDataEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDBUFFERSUBDATAEXTPROC __glewNamedBufferSubDataEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC __glewNamedCopyBufferSubDataEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC __glewNamedFramebufferRenderbufferEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC __glewNamedFramebufferTexture1DEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC __glewNamedFramebufferTexture2DEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC __glewNamedFramebufferTexture3DEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC __glewNamedFramebufferTextureEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC __glewNamedFramebufferTextureFaceEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC __glewNamedFramebufferTextureLayerEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC __glewNamedProgramLocalParameter4dEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC __glewNamedProgramLocalParameter4dvEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC __glewNamedProgramLocalParameter4fEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC __glewNamedProgramLocalParameter4fvEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC __glewNamedProgramLocalParameterI4iEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC __glewNamedProgramLocalParameterI4ivEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC __glewNamedProgramLocalParameterI4uiEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC __glewNamedProgramLocalParameterI4uivEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC __glewNamedProgramLocalParameters4fvEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC __glewNamedProgramLocalParametersI4ivEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC __glewNamedProgramLocalParametersI4uivEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMSTRINGEXTPROC __glewNamedProgramStringEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC __glewNamedRenderbufferStorageEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC __glewNamedRenderbufferStorageMultisampleCoverageEXT;
-GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewNamedRenderbufferStorageMultisampleEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FEXTPROC __glewProgramUniform1fEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FVEXTPROC __glewProgramUniform1fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IEXTPROC __glewProgramUniform1iEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IVEXTPROC __glewProgramUniform1ivEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIEXTPROC __glewProgramUniform1uiEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIVEXTPROC __glewProgramUniform1uivEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FEXTPROC __glewProgramUniform2fEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FVEXTPROC __glewProgramUniform2fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IEXTPROC __glewProgramUniform2iEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IVEXTPROC __glewProgramUniform2ivEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIEXTPROC __glewProgramUniform2uiEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIVEXTPROC __glewProgramUniform2uivEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FEXTPROC __glewProgramUniform3fEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FVEXTPROC __glewProgramUniform3fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IEXTPROC __glewProgramUniform3iEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IVEXTPROC __glewProgramUniform3ivEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIEXTPROC __glewProgramUniform3uiEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIVEXTPROC __glewProgramUniform3uivEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FEXTPROC __glewProgramUniform4fEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FVEXTPROC __glewProgramUniform4fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IEXTPROC __glewProgramUniform4iEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IVEXTPROC __glewProgramUniform4ivEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIEXTPROC __glewProgramUniform4uiEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIVEXTPROC __glewProgramUniform4uivEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC __glewProgramUniformMatrix2fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC __glewProgramUniformMatrix2x3fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC __glewProgramUniformMatrix2x4fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC __glewProgramUniformMatrix3fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC __glewProgramUniformMatrix3x2fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC __glewProgramUniformMatrix3x4fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC __glewProgramUniformMatrix4fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC __glewProgramUniformMatrix4x2fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC __glewProgramUniformMatrix4x3fvEXT;
-GLEW_FUN_EXPORT PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC __glewPushClientAttribDefaultEXT;
-GLEW_FUN_EXPORT PFNGLTEXTUREBUFFEREXTPROC __glewTextureBufferEXT;
-GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE1DEXTPROC __glewTextureImage1DEXT;
-GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DEXTPROC __glewTextureImage2DEXT;
-GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DEXTPROC __glewTextureImage3DEXT;
-GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIIVEXTPROC __glewTextureParameterIivEXT;
-GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIUIVEXTPROC __glewTextureParameterIuivEXT;
-GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFEXTPROC __glewTextureParameterfEXT;
-GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFVEXTPROC __glewTextureParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIEXTPROC __glewTextureParameteriEXT;
-GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIVEXTPROC __glewTextureParameterivEXT;
-GLEW_FUN_EXPORT PFNGLTEXTURERENDERBUFFEREXTPROC __glewTextureRenderbufferEXT;
-GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE1DEXTPROC __glewTextureSubImage1DEXT;
-GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE2DEXTPROC __glewTextureSubImage2DEXT;
-GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE3DEXTPROC __glewTextureSubImage3DEXT;
-GLEW_FUN_EXPORT PFNGLUNMAPNAMEDBUFFEREXTPROC __glewUnmapNamedBufferEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYCOLOROFFSETEXTPROC __glewVertexArrayColorOffsetEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC __glewVertexArrayEdgeFlagOffsetEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC __glewVertexArrayFogCoordOffsetEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYINDEXOFFSETEXTPROC __glewVertexArrayIndexOffsetEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC __glewVertexArrayMultiTexCoordOffsetEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYNORMALOFFSETEXTPROC __glewVertexArrayNormalOffsetEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC __glewVertexArraySecondaryColorOffsetEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC __glewVertexArrayTexCoordOffsetEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC __glewVertexArrayVertexAttribDivisorEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC __glewVertexArrayVertexAttribIOffsetEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC __glewVertexArrayVertexAttribOffsetEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC __glewVertexArrayVertexOffsetEXT;
-
-GLEW_FUN_EXPORT PFNGLCOLORMASKINDEXEDEXTPROC __glewColorMaskIndexedEXT;
-GLEW_FUN_EXPORT PFNGLDISABLEINDEXEDEXTPROC __glewDisableIndexedEXT;
-GLEW_FUN_EXPORT PFNGLENABLEINDEXEDEXTPROC __glewEnableIndexedEXT;
-GLEW_FUN_EXPORT PFNGLGETBOOLEANINDEXEDVEXTPROC __glewGetBooleanIndexedvEXT;
-GLEW_FUN_EXPORT PFNGLGETINTEGERINDEXEDVEXTPROC __glewGetIntegerIndexedvEXT;
-GLEW_FUN_EXPORT PFNGLISENABLEDINDEXEDEXTPROC __glewIsEnabledIndexedEXT;
-
-GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDEXTPROC __glewDrawArraysInstancedEXT;
-GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDEXTPROC __glewDrawElementsInstancedEXT;
-
-GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSEXTPROC __glewDrawRangeElementsEXT;
-
-GLEW_FUN_EXPORT PFNGLFOGCOORDPOINTEREXTPROC __glewFogCoordPointerEXT;
-GLEW_FUN_EXPORT PFNGLFOGCOORDDEXTPROC __glewFogCoorddEXT;
-GLEW_FUN_EXPORT PFNGLFOGCOORDDVEXTPROC __glewFogCoorddvEXT;
-GLEW_FUN_EXPORT PFNGLFOGCOORDFEXTPROC __glewFogCoordfEXT;
-GLEW_FUN_EXPORT PFNGLFOGCOORDFVEXTPROC __glewFogCoordfvEXT;
-
-GLEW_FUN_EXPORT PFNGLFRAGMENTCOLORMATERIALEXTPROC __glewFragmentColorMaterialEXT;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFEXTPROC __glewFragmentLightModelfEXT;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFVEXTPROC __glewFragmentLightModelfvEXT;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIEXTPROC __glewFragmentLightModeliEXT;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIVEXTPROC __glewFragmentLightModelivEXT;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFEXTPROC __glewFragmentLightfEXT;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFVEXTPROC __glewFragmentLightfvEXT;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIEXTPROC __glewFragmentLightiEXT;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIVEXTPROC __glewFragmentLightivEXT;
-GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFEXTPROC __glewFragmentMaterialfEXT;
-GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFVEXTPROC __glewFragmentMaterialfvEXT;
-GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIEXTPROC __glewFragmentMaterialiEXT;
-GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIVEXTPROC __glewFragmentMaterialivEXT;
-GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTFVEXTPROC __glewGetFragmentLightfvEXT;
-GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTIVEXTPROC __glewGetFragmentLightivEXT;
-GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALFVEXTPROC __glewGetFragmentMaterialfvEXT;
-GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALIVEXTPROC __glewGetFragmentMaterialivEXT;
-GLEW_FUN_EXPORT PFNGLLIGHTENVIEXTPROC __glewLightEnviEXT;
-
-GLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFEREXTPROC __glewBlitFramebufferEXT;
-
-GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewRenderbufferStorageMultisampleEXT;
-
-GLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFEREXTPROC __glewBindFramebufferEXT;
-GLEW_FUN_EXPORT PFNGLBINDRENDERBUFFEREXTPROC __glewBindRenderbufferEXT;
-GLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC __glewCheckFramebufferStatusEXT;
-GLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSEXTPROC __glewDeleteFramebuffersEXT;
-GLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSEXTPROC __glewDeleteRenderbuffersEXT;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC __glewFramebufferRenderbufferEXT;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DEXTPROC __glewFramebufferTexture1DEXT;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DEXTPROC __glewFramebufferTexture2DEXT;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DEXTPROC __glewFramebufferTexture3DEXT;
-GLEW_FUN_EXPORT PFNGLGENFRAMEBUFFERSEXTPROC __glewGenFramebuffersEXT;
-GLEW_FUN_EXPORT PFNGLGENRENDERBUFFERSEXTPROC __glewGenRenderbuffersEXT;
-GLEW_FUN_EXPORT PFNGLGENERATEMIPMAPEXTPROC __glewGenerateMipmapEXT;
-GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetFramebufferAttachmentParameterivEXT;
-GLEW_FUN_EXPORT PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC __glewGetRenderbufferParameterivEXT;
-GLEW_FUN_EXPORT PFNGLISFRAMEBUFFEREXTPROC __glewIsFramebufferEXT;
-GLEW_FUN_EXPORT PFNGLISRENDERBUFFEREXTPROC __glewIsRenderbufferEXT;
-GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEEXTPROC __glewRenderbufferStorageEXT;
-
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREEXTPROC __glewFramebufferTextureEXT;
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC __glewFramebufferTextureFaceEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIEXTPROC __glewProgramParameteriEXT;
-
-GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERS4FVEXTPROC __glewProgramEnvParameters4fvEXT;
-GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC __glewProgramLocalParameters4fvEXT;
-
-GLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONEXTPROC __glewBindFragDataLocationEXT;
-GLEW_FUN_EXPORT PFNGLGETFRAGDATALOCATIONEXTPROC __glewGetFragDataLocationEXT;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMUIVEXTPROC __glewGetUniformuivEXT;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIIVEXTPROC __glewGetVertexAttribIivEXT;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIUIVEXTPROC __glewGetVertexAttribIuivEXT;
-GLEW_FUN_EXPORT PFNGLUNIFORM1UIEXTPROC __glewUniform1uiEXT;
-GLEW_FUN_EXPORT PFNGLUNIFORM1UIVEXTPROC __glewUniform1uivEXT;
-GLEW_FUN_EXPORT PFNGLUNIFORM2UIEXTPROC __glewUniform2uiEXT;
-GLEW_FUN_EXPORT PFNGLUNIFORM2UIVEXTPROC __glewUniform2uivEXT;
-GLEW_FUN_EXPORT PFNGLUNIFORM3UIEXTPROC __glewUniform3uiEXT;
-GLEW_FUN_EXPORT PFNGLUNIFORM3UIVEXTPROC __glewUniform3uivEXT;
-GLEW_FUN_EXPORT PFNGLUNIFORM4UIEXTPROC __glewUniform4uiEXT;
-GLEW_FUN_EXPORT PFNGLUNIFORM4UIVEXTPROC __glewUniform4uivEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IEXTPROC __glewVertexAttribI1iEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IVEXTPROC __glewVertexAttribI1ivEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIEXTPROC __glewVertexAttribI1uiEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIVEXTPROC __glewVertexAttribI1uivEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IEXTPROC __glewVertexAttribI2iEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IVEXTPROC __glewVertexAttribI2ivEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIEXTPROC __glewVertexAttribI2uiEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIVEXTPROC __glewVertexAttribI2uivEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IEXTPROC __glewVertexAttribI3iEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IVEXTPROC __glewVertexAttribI3ivEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIEXTPROC __glewVertexAttribI3uiEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIVEXTPROC __glewVertexAttribI3uivEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4BVEXTPROC __glewVertexAttribI4bvEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IEXTPROC __glewVertexAttribI4iEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IVEXTPROC __glewVertexAttribI4ivEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4SVEXTPROC __glewVertexAttribI4svEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UBVEXTPROC __glewVertexAttribI4ubvEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIEXTPROC __glewVertexAttribI4uiEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIVEXTPROC __glewVertexAttribI4uivEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4USVEXTPROC __glewVertexAttribI4usvEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIPOINTEREXTPROC __glewVertexAttribIPointerEXT;
-
-GLEW_FUN_EXPORT PFNGLGETHISTOGRAMEXTPROC __glewGetHistogramEXT;
-GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERFVEXTPROC __glewGetHistogramParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERIVEXTPROC __glewGetHistogramParameterivEXT;
-GLEW_FUN_EXPORT PFNGLGETMINMAXEXTPROC __glewGetMinmaxEXT;
-GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERFVEXTPROC __glewGetMinmaxParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERIVEXTPROC __glewGetMinmaxParameterivEXT;
-GLEW_FUN_EXPORT PFNGLHISTOGRAMEXTPROC __glewHistogramEXT;
-GLEW_FUN_EXPORT PFNGLMINMAXEXTPROC __glewMinmaxEXT;
-GLEW_FUN_EXPORT PFNGLRESETHISTOGRAMEXTPROC __glewResetHistogramEXT;
-GLEW_FUN_EXPORT PFNGLRESETMINMAXEXTPROC __glewResetMinmaxEXT;
-
-GLEW_FUN_EXPORT PFNGLINDEXFUNCEXTPROC __glewIndexFuncEXT;
-
-GLEW_FUN_EXPORT PFNGLINDEXMATERIALEXTPROC __glewIndexMaterialEXT;
-
-GLEW_FUN_EXPORT PFNGLAPPLYTEXTUREEXTPROC __glewApplyTextureEXT;
-GLEW_FUN_EXPORT PFNGLTEXTURELIGHTEXTPROC __glewTextureLightEXT;
-GLEW_FUN_EXPORT PFNGLTEXTUREMATERIALEXTPROC __glewTextureMaterialEXT;
-
-GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSEXTPROC __glewMultiDrawArraysEXT;
-GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSEXTPROC __glewMultiDrawElementsEXT;
-
-GLEW_FUN_EXPORT PFNGLSAMPLEMASKEXTPROC __glewSampleMaskEXT;
-GLEW_FUN_EXPORT PFNGLSAMPLEPATTERNEXTPROC __glewSamplePatternEXT;
-
-GLEW_FUN_EXPORT PFNGLCOLORTABLEEXTPROC __glewColorTableEXT;
-GLEW_FUN_EXPORT PFNGLGETCOLORTABLEEXTPROC __glewGetColorTableEXT;
-GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVEXTPROC __glewGetColorTableParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVEXTPROC __glewGetColorTableParameterivEXT;
-
-GLEW_FUN_EXPORT PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC __glewGetPixelTransformParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC __glewGetPixelTransformParameterivEXT;
-GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERFEXTPROC __glewPixelTransformParameterfEXT;
-GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC __glewPixelTransformParameterfvEXT;
-GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERIEXTPROC __glewPixelTransformParameteriEXT;
-GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC __glewPixelTransformParameterivEXT;
-
-GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFEXTPROC __glewPointParameterfEXT;
-GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVEXTPROC __glewPointParameterfvEXT;
-
-GLEW_FUN_EXPORT PFNGLPOLYGONOFFSETEXTPROC __glewPolygonOffsetEXT;
-
-GLEW_FUN_EXPORT PFNGLPOLYGONOFFSETCLAMPEXTPROC __glewPolygonOffsetClampEXT;
-
-GLEW_FUN_EXPORT PFNGLPROVOKINGVERTEXEXTPROC __glewProvokingVertexEXT;
-
-GLEW_FUN_EXPORT PFNGLCOVERAGEMODULATIONNVPROC __glewCoverageModulationNV;
-GLEW_FUN_EXPORT PFNGLCOVERAGEMODULATIONTABLENVPROC __glewCoverageModulationTableNV;
-GLEW_FUN_EXPORT PFNGLGETCOVERAGEMODULATIONTABLENVPROC __glewGetCoverageModulationTableNV;
-GLEW_FUN_EXPORT PFNGLRASTERSAMPLESEXTPROC __glewRasterSamplesEXT;
-
-GLEW_FUN_EXPORT PFNGLBEGINSCENEEXTPROC __glewBeginSceneEXT;
-GLEW_FUN_EXPORT PFNGLENDSCENEEXTPROC __glewEndSceneEXT;
-
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BEXTPROC __glewSecondaryColor3bEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BVEXTPROC __glewSecondaryColor3bvEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DEXTPROC __glewSecondaryColor3dEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DVEXTPROC __glewSecondaryColor3dvEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FEXTPROC __glewSecondaryColor3fEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FVEXTPROC __glewSecondaryColor3fvEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IEXTPROC __glewSecondaryColor3iEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IVEXTPROC __glewSecondaryColor3ivEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SEXTPROC __glewSecondaryColor3sEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SVEXTPROC __glewSecondaryColor3svEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBEXTPROC __glewSecondaryColor3ubEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBVEXTPROC __glewSecondaryColor3ubvEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIEXTPROC __glewSecondaryColor3uiEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIVEXTPROC __glewSecondaryColor3uivEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USEXTPROC __glewSecondaryColor3usEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USVEXTPROC __glewSecondaryColor3usvEXT;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTEREXTPROC __glewSecondaryColorPointerEXT;
-
-GLEW_FUN_EXPORT PFNGLACTIVEPROGRAMEXTPROC __glewActiveProgramEXT;
-GLEW_FUN_EXPORT PFNGLCREATESHADERPROGRAMEXTPROC __glewCreateShaderProgramEXT;
-GLEW_FUN_EXPORT PFNGLUSESHADERPROGRAMEXTPROC __glewUseShaderProgramEXT;
-
-GLEW_FUN_EXPORT PFNGLBINDIMAGETEXTUREEXTPROC __glewBindImageTextureEXT;
-GLEW_FUN_EXPORT PFNGLMEMORYBARRIEREXTPROC __glewMemoryBarrierEXT;
-
-GLEW_FUN_EXPORT PFNGLACTIVESTENCILFACEEXTPROC __glewActiveStencilFaceEXT;
-
-GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE1DEXTPROC __glewTexSubImage1DEXT;
-GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE2DEXTPROC __glewTexSubImage2DEXT;
-GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT;
-
-GLEW_FUN_EXPORT PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT;
-
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT;
-
-GLEW_FUN_EXPORT PFNGLTEXBUFFEREXTPROC __glewTexBufferEXT;
-
-GLEW_FUN_EXPORT PFNGLCLEARCOLORIIEXTPROC __glewClearColorIiEXT;
-GLEW_FUN_EXPORT PFNGLCLEARCOLORIUIEXTPROC __glewClearColorIuiEXT;
-GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIIVEXTPROC __glewGetTexParameterIivEXT;
-GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIUIVEXTPROC __glewGetTexParameterIuivEXT;
-GLEW_FUN_EXPORT PFNGLTEXPARAMETERIIVEXTPROC __glewTexParameterIivEXT;
-GLEW_FUN_EXPORT PFNGLTEXPARAMETERIUIVEXTPROC __glewTexParameterIuivEXT;
-
-GLEW_FUN_EXPORT PFNGLARETEXTURESRESIDENTEXTPROC __glewAreTexturesResidentEXT;
-GLEW_FUN_EXPORT PFNGLBINDTEXTUREEXTPROC __glewBindTextureEXT;
-GLEW_FUN_EXPORT PFNGLDELETETEXTURESEXTPROC __glewDeleteTexturesEXT;
-GLEW_FUN_EXPORT PFNGLGENTEXTURESEXTPROC __glewGenTexturesEXT;
-GLEW_FUN_EXPORT PFNGLISTEXTUREEXTPROC __glewIsTextureEXT;
-GLEW_FUN_EXPORT PFNGLPRIORITIZETEXTURESEXTPROC __glewPrioritizeTexturesEXT;
-
-GLEW_FUN_EXPORT PFNGLTEXTURENORMALEXTPROC __glewTextureNormalEXT;
-
-GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTI64VEXTPROC __glewGetQueryObjecti64vEXT;
-GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUI64VEXTPROC __glewGetQueryObjectui64vEXT;
-
-GLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKEXTPROC __glewBeginTransformFeedbackEXT;
-GLEW_FUN_EXPORT PFNGLBINDBUFFERBASEEXTPROC __glewBindBufferBaseEXT;
-GLEW_FUN_EXPORT PFNGLBINDBUFFEROFFSETEXTPROC __glewBindBufferOffsetEXT;
-GLEW_FUN_EXPORT PFNGLBINDBUFFERRANGEEXTPROC __glewBindBufferRangeEXT;
-GLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKEXTPROC __glewEndTransformFeedbackEXT;
-GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC __glewGetTransformFeedbackVaryingEXT;
-GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC __glewTransformFeedbackVaryingsEXT;
-
-GLEW_FUN_EXPORT PFNGLARRAYELEMENTEXTPROC __glewArrayElementEXT;
-GLEW_FUN_EXPORT PFNGLCOLORPOINTEREXTPROC __glewColorPointerEXT;
-GLEW_FUN_EXPORT PFNGLDRAWARRAYSEXTPROC __glewDrawArraysEXT;
-GLEW_FUN_EXPORT PFNGLEDGEFLAGPOINTEREXTPROC __glewEdgeFlagPointerEXT;
-GLEW_FUN_EXPORT PFNGLINDEXPOINTEREXTPROC __glewIndexPointerEXT;
-GLEW_FUN_EXPORT PFNGLNORMALPOINTEREXTPROC __glewNormalPointerEXT;
-GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTEREXTPROC __glewTexCoordPointerEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXPOINTEREXTPROC __glewVertexPointerEXT;
-
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLDVEXTPROC __glewGetVertexAttribLdvEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC __glewVertexArrayVertexAttribLOffsetEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DEXTPROC __glewVertexAttribL1dEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DVEXTPROC __glewVertexAttribL1dvEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DEXTPROC __glewVertexAttribL2dEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DVEXTPROC __glewVertexAttribL2dvEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DEXTPROC __glewVertexAttribL3dEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DVEXTPROC __glewVertexAttribL3dvEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DEXTPROC __glewVertexAttribL4dEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DVEXTPROC __glewVertexAttribL4dvEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBLPOINTEREXTPROC __glewVertexAttribLPointerEXT;
-
-GLEW_FUN_EXPORT PFNGLBEGINVERTEXSHADEREXTPROC __glewBeginVertexShaderEXT;
-GLEW_FUN_EXPORT PFNGLBINDLIGHTPARAMETEREXTPROC __glewBindLightParameterEXT;
-GLEW_FUN_EXPORT PFNGLBINDMATERIALPARAMETEREXTPROC __glewBindMaterialParameterEXT;
-GLEW_FUN_EXPORT PFNGLBINDPARAMETEREXTPROC __glewBindParameterEXT;
-GLEW_FUN_EXPORT PFNGLBINDTEXGENPARAMETEREXTPROC __glewBindTexGenParameterEXT;
-GLEW_FUN_EXPORT PFNGLBINDTEXTUREUNITPARAMETEREXTPROC __glewBindTextureUnitParameterEXT;
-GLEW_FUN_EXPORT PFNGLBINDVERTEXSHADEREXTPROC __glewBindVertexShaderEXT;
-GLEW_FUN_EXPORT PFNGLDELETEVERTEXSHADEREXTPROC __glewDeleteVertexShaderEXT;
-GLEW_FUN_EXPORT PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC __glewDisableVariantClientStateEXT;
-GLEW_FUN_EXPORT PFNGLENABLEVARIANTCLIENTSTATEEXTPROC __glewEnableVariantClientStateEXT;
-GLEW_FUN_EXPORT PFNGLENDVERTEXSHADEREXTPROC __glewEndVertexShaderEXT;
-GLEW_FUN_EXPORT PFNGLEXTRACTCOMPONENTEXTPROC __glewExtractComponentEXT;
-GLEW_FUN_EXPORT PFNGLGENSYMBOLSEXTPROC __glewGenSymbolsEXT;
-GLEW_FUN_EXPORT PFNGLGENVERTEXSHADERSEXTPROC __glewGenVertexShadersEXT;
-GLEW_FUN_EXPORT PFNGLGETINVARIANTBOOLEANVEXTPROC __glewGetInvariantBooleanvEXT;
-GLEW_FUN_EXPORT PFNGLGETINVARIANTFLOATVEXTPROC __glewGetInvariantFloatvEXT;
-GLEW_FUN_EXPORT PFNGLGETINVARIANTINTEGERVEXTPROC __glewGetInvariantIntegervEXT;
-GLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC __glewGetLocalConstantBooleanvEXT;
-GLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTFLOATVEXTPROC __glewGetLocalConstantFloatvEXT;
-GLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTINTEGERVEXTPROC __glewGetLocalConstantIntegervEXT;
-GLEW_FUN_EXPORT PFNGLGETVARIANTBOOLEANVEXTPROC __glewGetVariantBooleanvEXT;
-GLEW_FUN_EXPORT PFNGLGETVARIANTFLOATVEXTPROC __glewGetVariantFloatvEXT;
-GLEW_FUN_EXPORT PFNGLGETVARIANTINTEGERVEXTPROC __glewGetVariantIntegervEXT;
-GLEW_FUN_EXPORT PFNGLGETVARIANTPOINTERVEXTPROC __glewGetVariantPointervEXT;
-GLEW_FUN_EXPORT PFNGLINSERTCOMPONENTEXTPROC __glewInsertComponentEXT;
-GLEW_FUN_EXPORT PFNGLISVARIANTENABLEDEXTPROC __glewIsVariantEnabledEXT;
-GLEW_FUN_EXPORT PFNGLSETINVARIANTEXTPROC __glewSetInvariantEXT;
-GLEW_FUN_EXPORT PFNGLSETLOCALCONSTANTEXTPROC __glewSetLocalConstantEXT;
-GLEW_FUN_EXPORT PFNGLSHADEROP1EXTPROC __glewShaderOp1EXT;
-GLEW_FUN_EXPORT PFNGLSHADEROP2EXTPROC __glewShaderOp2EXT;
-GLEW_FUN_EXPORT PFNGLSHADEROP3EXTPROC __glewShaderOp3EXT;
-GLEW_FUN_EXPORT PFNGLSWIZZLEEXTPROC __glewSwizzleEXT;
-GLEW_FUN_EXPORT PFNGLVARIANTPOINTEREXTPROC __glewVariantPointerEXT;
-GLEW_FUN_EXPORT PFNGLVARIANTBVEXTPROC __glewVariantbvEXT;
-GLEW_FUN_EXPORT PFNGLVARIANTDVEXTPROC __glewVariantdvEXT;
-GLEW_FUN_EXPORT PFNGLVARIANTFVEXTPROC __glewVariantfvEXT;
-GLEW_FUN_EXPORT PFNGLVARIANTIVEXTPROC __glewVariantivEXT;
-GLEW_FUN_EXPORT PFNGLVARIANTSVEXTPROC __glewVariantsvEXT;
-GLEW_FUN_EXPORT PFNGLVARIANTUBVEXTPROC __glewVariantubvEXT;
-GLEW_FUN_EXPORT PFNGLVARIANTUIVEXTPROC __glewVariantuivEXT;
-GLEW_FUN_EXPORT PFNGLVARIANTUSVEXTPROC __glewVariantusvEXT;
-GLEW_FUN_EXPORT PFNGLWRITEMASKEXTPROC __glewWriteMaskEXT;
-
-GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT;
-GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT;
-
-GLEW_FUN_EXPORT PFNGLIMPORTSYNCEXTPROC __glewImportSyncEXT;
-
-GLEW_FUN_EXPORT PFNGLFRAMETERMINATORGREMEDYPROC __glewFrameTerminatorGREMEDY;
-
-GLEW_FUN_EXPORT PFNGLSTRINGMARKERGREMEDYPROC __glewStringMarkerGREMEDY;
-
-GLEW_FUN_EXPORT PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC __glewGetImageTransformParameterfvHP;
-GLEW_FUN_EXPORT PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC __glewGetImageTransformParameterivHP;
-GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERFHPPROC __glewImageTransformParameterfHP;
-GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERFVHPPROC __glewImageTransformParameterfvHP;
-GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERIHPPROC __glewImageTransformParameteriHP;
-GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERIVHPPROC __glewImageTransformParameterivHP;
-
-GLEW_FUN_EXPORT PFNGLMULTIMODEDRAWARRAYSIBMPROC __glewMultiModeDrawArraysIBM;
-GLEW_FUN_EXPORT PFNGLMULTIMODEDRAWELEMENTSIBMPROC __glewMultiModeDrawElementsIBM;
-
-GLEW_FUN_EXPORT PFNGLCOLORPOINTERLISTIBMPROC __glewColorPointerListIBM;
-GLEW_FUN_EXPORT PFNGLEDGEFLAGPOINTERLISTIBMPROC __glewEdgeFlagPointerListIBM;
-GLEW_FUN_EXPORT PFNGLFOGCOORDPOINTERLISTIBMPROC __glewFogCoordPointerListIBM;
-GLEW_FUN_EXPORT PFNGLINDEXPOINTERLISTIBMPROC __glewIndexPointerListIBM;
-GLEW_FUN_EXPORT PFNGLNORMALPOINTERLISTIBMPROC __glewNormalPointerListIBM;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERLISTIBMPROC __glewSecondaryColorPointerListIBM;
-GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERLISTIBMPROC __glewTexCoordPointerListIBM;
-GLEW_FUN_EXPORT PFNGLVERTEXPOINTERLISTIBMPROC __glewVertexPointerListIBM;
-
-GLEW_FUN_EXPORT PFNGLMAPTEXTURE2DINTELPROC __glewMapTexture2DINTEL;
-GLEW_FUN_EXPORT PFNGLSYNCTEXTUREINTELPROC __glewSyncTextureINTEL;
-GLEW_FUN_EXPORT PFNGLUNMAPTEXTURE2DINTELPROC __glewUnmapTexture2DINTEL;
-
-GLEW_FUN_EXPORT PFNGLCOLORPOINTERVINTELPROC __glewColorPointervINTEL;
-GLEW_FUN_EXPORT PFNGLNORMALPOINTERVINTELPROC __glewNormalPointervINTEL;
-GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERVINTELPROC __glewTexCoordPointervINTEL;
-GLEW_FUN_EXPORT PFNGLVERTEXPOINTERVINTELPROC __glewVertexPointervINTEL;
-
-GLEW_FUN_EXPORT PFNGLBEGINPERFQUERYINTELPROC __glewBeginPerfQueryINTEL;
-GLEW_FUN_EXPORT PFNGLCREATEPERFQUERYINTELPROC __glewCreatePerfQueryINTEL;
-GLEW_FUN_EXPORT PFNGLDELETEPERFQUERYINTELPROC __glewDeletePerfQueryINTEL;
-GLEW_FUN_EXPORT PFNGLENDPERFQUERYINTELPROC __glewEndPerfQueryINTEL;
-GLEW_FUN_EXPORT PFNGLGETFIRSTPERFQUERYIDINTELPROC __glewGetFirstPerfQueryIdINTEL;
-GLEW_FUN_EXPORT PFNGLGETNEXTPERFQUERYIDINTELPROC __glewGetNextPerfQueryIdINTEL;
-GLEW_FUN_EXPORT PFNGLGETPERFCOUNTERINFOINTELPROC __glewGetPerfCounterInfoINTEL;
-GLEW_FUN_EXPORT PFNGLGETPERFQUERYDATAINTELPROC __glewGetPerfQueryDataINTEL;
-GLEW_FUN_EXPORT PFNGLGETPERFQUERYIDBYNAMEINTELPROC __glewGetPerfQueryIdByNameINTEL;
-GLEW_FUN_EXPORT PFNGLGETPERFQUERYINFOINTELPROC __glewGetPerfQueryInfoINTEL;
-
-GLEW_FUN_EXPORT PFNGLTEXSCISSORFUNCINTELPROC __glewTexScissorFuncINTEL;
-GLEW_FUN_EXPORT PFNGLTEXSCISSORINTELPROC __glewTexScissorINTEL;
-
-GLEW_FUN_EXPORT PFNGLBLENDBARRIERKHRPROC __glewBlendBarrierKHR;
-
-GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKPROC __glewDebugMessageCallback;
-GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECONTROLPROC __glewDebugMessageControl;
-GLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTPROC __glewDebugMessageInsert;
-GLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGPROC __glewGetDebugMessageLog;
-GLEW_FUN_EXPORT PFNGLGETOBJECTLABELPROC __glewGetObjectLabel;
-GLEW_FUN_EXPORT PFNGLGETOBJECTPTRLABELPROC __glewGetObjectPtrLabel;
-GLEW_FUN_EXPORT PFNGLOBJECTLABELPROC __glewObjectLabel;
-GLEW_FUN_EXPORT PFNGLOBJECTPTRLABELPROC __glewObjectPtrLabel;
-GLEW_FUN_EXPORT PFNGLPOPDEBUGGROUPPROC __glewPopDebugGroup;
-GLEW_FUN_EXPORT PFNGLPUSHDEBUGGROUPPROC __glewPushDebugGroup;
-
-GLEW_FUN_EXPORT PFNGLGETNUNIFORMFVPROC __glewGetnUniformfv;
-GLEW_FUN_EXPORT PFNGLGETNUNIFORMIVPROC __glewGetnUniformiv;
-GLEW_FUN_EXPORT PFNGLGETNUNIFORMUIVPROC __glewGetnUniformuiv;
-GLEW_FUN_EXPORT PFNGLREADNPIXELSPROC __glewReadnPixels;
-
-GLEW_FUN_EXPORT PFNGLBUFFERREGIONENABLEDPROC __glewBufferRegionEnabled;
-GLEW_FUN_EXPORT PFNGLDELETEBUFFERREGIONPROC __glewDeleteBufferRegion;
-GLEW_FUN_EXPORT PFNGLDRAWBUFFERREGIONPROC __glewDrawBufferRegion;
-GLEW_FUN_EXPORT PFNGLNEWBUFFERREGIONPROC __glewNewBufferRegion;
-GLEW_FUN_EXPORT PFNGLREADBUFFERREGIONPROC __glewReadBufferRegion;
-
-GLEW_FUN_EXPORT PFNGLRESIZEBUFFERSMESAPROC __glewResizeBuffersMESA;
-
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2DMESAPROC __glewWindowPos2dMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2DVMESAPROC __glewWindowPos2dvMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2FMESAPROC __glewWindowPos2fMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2FVMESAPROC __glewWindowPos2fvMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2IMESAPROC __glewWindowPos2iMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2IVMESAPROC __glewWindowPos2ivMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2SMESAPROC __glewWindowPos2sMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS2SVMESAPROC __glewWindowPos2svMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3DMESAPROC __glewWindowPos3dMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3DVMESAPROC __glewWindowPos3dvMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3FMESAPROC __glewWindowPos3fMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3FVMESAPROC __glewWindowPos3fvMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3IMESAPROC __glewWindowPos3iMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3IVMESAPROC __glewWindowPos3ivMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3SMESAPROC __glewWindowPos3sMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS3SVMESAPROC __glewWindowPos3svMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS4DMESAPROC __glewWindowPos4dMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS4DVMESAPROC __glewWindowPos4dvMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS4FMESAPROC __glewWindowPos4fMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS4FVMESAPROC __glewWindowPos4fvMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS4IMESAPROC __glewWindowPos4iMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS4IVMESAPROC __glewWindowPos4ivMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS4SMESAPROC __glewWindowPos4sMESA;
-GLEW_FUN_EXPORT PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA;
-
-GLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERNVXPROC __glewBeginConditionalRenderNVX;
-GLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERNVXPROC __glewEndConditionalRenderNVX;
-
-GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC __glewMultiDrawArraysIndirectBindlessNV;
-GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC __glewMultiDrawElementsIndirectBindlessNV;
-
-GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC __glewMultiDrawArraysIndirectBindlessCountNV;
-GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC __glewMultiDrawElementsIndirectBindlessCountNV;
-
-GLEW_FUN_EXPORT PFNGLGETIMAGEHANDLENVPROC __glewGetImageHandleNV;
-GLEW_FUN_EXPORT PFNGLGETTEXTUREHANDLENVPROC __glewGetTextureHandleNV;
-GLEW_FUN_EXPORT PFNGLGETTEXTURESAMPLERHANDLENVPROC __glewGetTextureSamplerHandleNV;
-GLEW_FUN_EXPORT PFNGLISIMAGEHANDLERESIDENTNVPROC __glewIsImageHandleResidentNV;
-GLEW_FUN_EXPORT PFNGLISTEXTUREHANDLERESIDENTNVPROC __glewIsTextureHandleResidentNV;
-GLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC __glewMakeImageHandleNonResidentNV;
-GLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLERESIDENTNVPROC __glewMakeImageHandleResidentNV;
-GLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC __glewMakeTextureHandleNonResidentNV;
-GLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLERESIDENTNVPROC __glewMakeTextureHandleResidentNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC __glewProgramUniformHandleui64NV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC __glewProgramUniformHandleui64vNV;
-GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64NVPROC __glewUniformHandleui64NV;
-GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64VNVPROC __glewUniformHandleui64vNV;
-
-GLEW_FUN_EXPORT PFNGLBLENDBARRIERNVPROC __glewBlendBarrierNV;
-GLEW_FUN_EXPORT PFNGLBLENDPARAMETERINVPROC __glewBlendParameteriNV;
-
-GLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERNVPROC __glewBeginConditionalRenderNV;
-GLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERNVPROC __glewEndConditionalRenderNV;
-
-GLEW_FUN_EXPORT PFNGLSUBPIXELPRECISIONBIASNVPROC __glewSubpixelPrecisionBiasNV;
-
-GLEW_FUN_EXPORT PFNGLCOPYIMAGESUBDATANVPROC __glewCopyImageSubDataNV;
-
-GLEW_FUN_EXPORT PFNGLCLEARDEPTHDNVPROC __glewClearDepthdNV;
-GLEW_FUN_EXPORT PFNGLDEPTHBOUNDSDNVPROC __glewDepthBoundsdNV;
-GLEW_FUN_EXPORT PFNGLDEPTHRANGEDNVPROC __glewDepthRangedNV;
-
-GLEW_FUN_EXPORT PFNGLDRAWTEXTURENVPROC __glewDrawTextureNV;
-
-GLEW_FUN_EXPORT PFNGLEVALMAPSNVPROC __glewEvalMapsNV;
-GLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERFVNVPROC __glewGetMapAttribParameterfvNV;
-GLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERIVNVPROC __glewGetMapAttribParameterivNV;
-GLEW_FUN_EXPORT PFNGLGETMAPCONTROLPOINTSNVPROC __glewGetMapControlPointsNV;
-GLEW_FUN_EXPORT PFNGLGETMAPPARAMETERFVNVPROC __glewGetMapParameterfvNV;
-GLEW_FUN_EXPORT PFNGLGETMAPPARAMETERIVNVPROC __glewGetMapParameterivNV;
-GLEW_FUN_EXPORT PFNGLMAPCONTROLPOINTSNVPROC __glewMapControlPointsNV;
-GLEW_FUN_EXPORT PFNGLMAPPARAMETERFVNVPROC __glewMapParameterfvNV;
-GLEW_FUN_EXPORT PFNGLMAPPARAMETERIVNVPROC __glewMapParameterivNV;
-
-GLEW_FUN_EXPORT PFNGLGETMULTISAMPLEFVNVPROC __glewGetMultisamplefvNV;
-GLEW_FUN_EXPORT PFNGLSAMPLEMASKINDEXEDNVPROC __glewSampleMaskIndexedNV;
-GLEW_FUN_EXPORT PFNGLTEXRENDERBUFFERNVPROC __glewTexRenderbufferNV;
-
-GLEW_FUN_EXPORT PFNGLDELETEFENCESNVPROC __glewDeleteFencesNV;
-GLEW_FUN_EXPORT PFNGLFINISHFENCENVPROC __glewFinishFenceNV;
-GLEW_FUN_EXPORT PFNGLGENFENCESNVPROC __glewGenFencesNV;
-GLEW_FUN_EXPORT PFNGLGETFENCEIVNVPROC __glewGetFenceivNV;
-GLEW_FUN_EXPORT PFNGLISFENCENVPROC __glewIsFenceNV;
-GLEW_FUN_EXPORT PFNGLSETFENCENVPROC __glewSetFenceNV;
-GLEW_FUN_EXPORT PFNGLTESTFENCENVPROC __glewTestFenceNV;
-
-GLEW_FUN_EXPORT PFNGLFRAGMENTCOVERAGECOLORNVPROC __glewFragmentCoverageColorNV;
-
-GLEW_FUN_EXPORT PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC __glewGetProgramNamedParameterdvNV;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC __glewGetProgramNamedParameterfvNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4DNVPROC __glewProgramNamedParameter4dNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC __glewProgramNamedParameter4dvNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4FNVPROC __glewProgramNamedParameter4fNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC __glewProgramNamedParameter4fvNV;
-
-GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC __glewRenderbufferStorageMultisampleCoverageNV;
-
-GLEW_FUN_EXPORT PFNGLPROGRAMVERTEXLIMITNVPROC __glewProgramVertexLimitNV;
-
-GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4INVPROC __glewProgramEnvParameterI4iNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4IVNVPROC __glewProgramEnvParameterI4ivNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4UINVPROC __glewProgramEnvParameterI4uiNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4UIVNVPROC __glewProgramEnvParameterI4uivNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERSI4IVNVPROC __glewProgramEnvParametersI4ivNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC __glewProgramEnvParametersI4uivNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4INVPROC __glewProgramLocalParameterI4iNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC __glewProgramLocalParameterI4ivNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4UINVPROC __glewProgramLocalParameterI4uiNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC __glewProgramLocalParameterI4uivNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC __glewProgramLocalParametersI4ivNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC __glewProgramLocalParametersI4uivNV;
-
-GLEW_FUN_EXPORT PFNGLGETUNIFORMI64VNVPROC __glewGetUniformi64vNV;
-GLEW_FUN_EXPORT PFNGLGETUNIFORMUI64VNVPROC __glewGetUniformui64vNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1I64NVPROC __glewProgramUniform1i64NV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1I64VNVPROC __glewProgramUniform1i64vNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UI64NVPROC __glewProgramUniform1ui64NV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UI64VNVPROC __glewProgramUniform1ui64vNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2I64NVPROC __glewProgramUniform2i64NV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2I64VNVPROC __glewProgramUniform2i64vNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UI64NVPROC __glewProgramUniform2ui64NV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UI64VNVPROC __glewProgramUniform2ui64vNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3I64NVPROC __glewProgramUniform3i64NV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3I64VNVPROC __glewProgramUniform3i64vNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UI64NVPROC __glewProgramUniform3ui64NV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UI64VNVPROC __glewProgramUniform3ui64vNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4I64NVPROC __glewProgramUniform4i64NV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4I64VNVPROC __glewProgramUniform4i64vNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UI64NVPROC __glewProgramUniform4ui64NV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UI64VNVPROC __glewProgramUniform4ui64vNV;
-GLEW_FUN_EXPORT PFNGLUNIFORM1I64NVPROC __glewUniform1i64NV;
-GLEW_FUN_EXPORT PFNGLUNIFORM1I64VNVPROC __glewUniform1i64vNV;
-GLEW_FUN_EXPORT PFNGLUNIFORM1UI64NVPROC __glewUniform1ui64NV;
-GLEW_FUN_EXPORT PFNGLUNIFORM1UI64VNVPROC __glewUniform1ui64vNV;
-GLEW_FUN_EXPORT PFNGLUNIFORM2I64NVPROC __glewUniform2i64NV;
-GLEW_FUN_EXPORT PFNGLUNIFORM2I64VNVPROC __glewUniform2i64vNV;
-GLEW_FUN_EXPORT PFNGLUNIFORM2UI64NVPROC __glewUniform2ui64NV;
-GLEW_FUN_EXPORT PFNGLUNIFORM2UI64VNVPROC __glewUniform2ui64vNV;
-GLEW_FUN_EXPORT PFNGLUNIFORM3I64NVPROC __glewUniform3i64NV;
-GLEW_FUN_EXPORT PFNGLUNIFORM3I64VNVPROC __glewUniform3i64vNV;
-GLEW_FUN_EXPORT PFNGLUNIFORM3UI64NVPROC __glewUniform3ui64NV;
-GLEW_FUN_EXPORT PFNGLUNIFORM3UI64VNVPROC __glewUniform3ui64vNV;
-GLEW_FUN_EXPORT PFNGLUNIFORM4I64NVPROC __glewUniform4i64NV;
-GLEW_FUN_EXPORT PFNGLUNIFORM4I64VNVPROC __glewUniform4i64vNV;
-GLEW_FUN_EXPORT PFNGLUNIFORM4UI64NVPROC __glewUniform4ui64NV;
-GLEW_FUN_EXPORT PFNGLUNIFORM4UI64VNVPROC __glewUniform4ui64vNV;
-
-GLEW_FUN_EXPORT PFNGLCOLOR3HNVPROC __glewColor3hNV;
-GLEW_FUN_EXPORT PFNGLCOLOR3HVNVPROC __glewColor3hvNV;
-GLEW_FUN_EXPORT PFNGLCOLOR4HNVPROC __glewColor4hNV;
-GLEW_FUN_EXPORT PFNGLCOLOR4HVNVPROC __glewColor4hvNV;
-GLEW_FUN_EXPORT PFNGLFOGCOORDHNVPROC __glewFogCoordhNV;
-GLEW_FUN_EXPORT PFNGLFOGCOORDHVNVPROC __glewFogCoordhvNV;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1HNVPROC __glewMultiTexCoord1hNV;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1HVNVPROC __glewMultiTexCoord1hvNV;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2HNVPROC __glewMultiTexCoord2hNV;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2HVNVPROC __glewMultiTexCoord2hvNV;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3HNVPROC __glewMultiTexCoord3hNV;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3HVNVPROC __glewMultiTexCoord3hvNV;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4HNVPROC __glewMultiTexCoord4hNV;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4HVNVPROC __glewMultiTexCoord4hvNV;
-GLEW_FUN_EXPORT PFNGLNORMAL3HNVPROC __glewNormal3hNV;
-GLEW_FUN_EXPORT PFNGLNORMAL3HVNVPROC __glewNormal3hvNV;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3HNVPROC __glewSecondaryColor3hNV;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3HVNVPROC __glewSecondaryColor3hvNV;
-GLEW_FUN_EXPORT PFNGLTEXCOORD1HNVPROC __glewTexCoord1hNV;
-GLEW_FUN_EXPORT PFNGLTEXCOORD1HVNVPROC __glewTexCoord1hvNV;
-GLEW_FUN_EXPORT PFNGLTEXCOORD2HNVPROC __glewTexCoord2hNV;
-GLEW_FUN_EXPORT PFNGLTEXCOORD2HVNVPROC __glewTexCoord2hvNV;
-GLEW_FUN_EXPORT PFNGLTEXCOORD3HNVPROC __glewTexCoord3hNV;
-GLEW_FUN_EXPORT PFNGLTEXCOORD3HVNVPROC __glewTexCoord3hvNV;
-GLEW_FUN_EXPORT PFNGLTEXCOORD4HNVPROC __glewTexCoord4hNV;
-GLEW_FUN_EXPORT PFNGLTEXCOORD4HVNVPROC __glewTexCoord4hvNV;
-GLEW_FUN_EXPORT PFNGLVERTEX2HNVPROC __glewVertex2hNV;
-GLEW_FUN_EXPORT PFNGLVERTEX2HVNVPROC __glewVertex2hvNV;
-GLEW_FUN_EXPORT PFNGLVERTEX3HNVPROC __glewVertex3hNV;
-GLEW_FUN_EXPORT PFNGLVERTEX3HVNVPROC __glewVertex3hvNV;
-GLEW_FUN_EXPORT PFNGLVERTEX4HNVPROC __glewVertex4hNV;
-GLEW_FUN_EXPORT PFNGLVERTEX4HVNVPROC __glewVertex4hvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1HNVPROC __glewVertexAttrib1hNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1HVNVPROC __glewVertexAttrib1hvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2HNVPROC __glewVertexAttrib2hNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2HVNVPROC __glewVertexAttrib2hvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3HNVPROC __glewVertexAttrib3hNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3HVNVPROC __glewVertexAttrib3hvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4HNVPROC __glewVertexAttrib4hNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4HVNVPROC __glewVertexAttrib4hvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1HVNVPROC __glewVertexAttribs1hvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2HVNVPROC __glewVertexAttribs2hvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3HVNVPROC __glewVertexAttribs3hvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4HVNVPROC __glewVertexAttribs4hvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTHNVPROC __glewVertexWeighthNV;
-GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTHVNVPROC __glewVertexWeighthvNV;
-
-GLEW_FUN_EXPORT PFNGLGETINTERNALFORMATSAMPLEIVNVPROC __glewGetInternalformatSampleivNV;
-
-GLEW_FUN_EXPORT PFNGLBEGINOCCLUSIONQUERYNVPROC __glewBeginOcclusionQueryNV;
-GLEW_FUN_EXPORT PFNGLDELETEOCCLUSIONQUERIESNVPROC __glewDeleteOcclusionQueriesNV;
-GLEW_FUN_EXPORT PFNGLENDOCCLUSIONQUERYNVPROC __glewEndOcclusionQueryNV;
-GLEW_FUN_EXPORT PFNGLGENOCCLUSIONQUERIESNVPROC __glewGenOcclusionQueriesNV;
-GLEW_FUN_EXPORT PFNGLGETOCCLUSIONQUERYIVNVPROC __glewGetOcclusionQueryivNV;
-GLEW_FUN_EXPORT PFNGLGETOCCLUSIONQUERYUIVNVPROC __glewGetOcclusionQueryuivNV;
-GLEW_FUN_EXPORT PFNGLISOCCLUSIONQUERYNVPROC __glewIsOcclusionQueryNV;
-
-GLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC __glewProgramBufferParametersIivNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC __glewProgramBufferParametersIuivNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC __glewProgramBufferParametersfvNV;
-
-GLEW_FUN_EXPORT PFNGLCOPYPATHNVPROC __glewCopyPathNV;
-GLEW_FUN_EXPORT PFNGLCOVERFILLPATHINSTANCEDNVPROC __glewCoverFillPathInstancedNV;
-GLEW_FUN_EXPORT PFNGLCOVERFILLPATHNVPROC __glewCoverFillPathNV;
-GLEW_FUN_EXPORT PFNGLCOVERSTROKEPATHINSTANCEDNVPROC __glewCoverStrokePathInstancedNV;
-GLEW_FUN_EXPORT PFNGLCOVERSTROKEPATHNVPROC __glewCoverStrokePathNV;
-GLEW_FUN_EXPORT PFNGLDELETEPATHSNVPROC __glewDeletePathsNV;
-GLEW_FUN_EXPORT PFNGLGENPATHSNVPROC __glewGenPathsNV;
-GLEW_FUN_EXPORT PFNGLGETPATHCOLORGENFVNVPROC __glewGetPathColorGenfvNV;
-GLEW_FUN_EXPORT PFNGLGETPATHCOLORGENIVNVPROC __glewGetPathColorGenivNV;
-GLEW_FUN_EXPORT PFNGLGETPATHCOMMANDSNVPROC __glewGetPathCommandsNV;
-GLEW_FUN_EXPORT PFNGLGETPATHCOORDSNVPROC __glewGetPathCoordsNV;
-GLEW_FUN_EXPORT PFNGLGETPATHDASHARRAYNVPROC __glewGetPathDashArrayNV;
-GLEW_FUN_EXPORT PFNGLGETPATHLENGTHNVPROC __glewGetPathLengthNV;
-GLEW_FUN_EXPORT PFNGLGETPATHMETRICRANGENVPROC __glewGetPathMetricRangeNV;
-GLEW_FUN_EXPORT PFNGLGETPATHMETRICSNVPROC __glewGetPathMetricsNV;
-GLEW_FUN_EXPORT PFNGLGETPATHPARAMETERFVNVPROC __glewGetPathParameterfvNV;
-GLEW_FUN_EXPORT PFNGLGETPATHPARAMETERIVNVPROC __glewGetPathParameterivNV;
-GLEW_FUN_EXPORT PFNGLGETPATHSPACINGNVPROC __glewGetPathSpacingNV;
-GLEW_FUN_EXPORT PFNGLGETPATHTEXGENFVNVPROC __glewGetPathTexGenfvNV;
-GLEW_FUN_EXPORT PFNGLGETPATHTEXGENIVNVPROC __glewGetPathTexGenivNV;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCEFVNVPROC __glewGetProgramResourcefvNV;
-GLEW_FUN_EXPORT PFNGLINTERPOLATEPATHSNVPROC __glewInterpolatePathsNV;
-GLEW_FUN_EXPORT PFNGLISPATHNVPROC __glewIsPathNV;
-GLEW_FUN_EXPORT PFNGLISPOINTINFILLPATHNVPROC __glewIsPointInFillPathNV;
-GLEW_FUN_EXPORT PFNGLISPOINTINSTROKEPATHNVPROC __glewIsPointInStrokePathNV;
-GLEW_FUN_EXPORT PFNGLMATRIXLOAD3X2FNVPROC __glewMatrixLoad3x2fNV;
-GLEW_FUN_EXPORT PFNGLMATRIXLOAD3X3FNVPROC __glewMatrixLoad3x3fNV;
-GLEW_FUN_EXPORT PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC __glewMatrixLoadTranspose3x3fNV;
-GLEW_FUN_EXPORT PFNGLMATRIXMULT3X2FNVPROC __glewMatrixMult3x2fNV;
-GLEW_FUN_EXPORT PFNGLMATRIXMULT3X3FNVPROC __glewMatrixMult3x3fNV;
-GLEW_FUN_EXPORT PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC __glewMatrixMultTranspose3x3fNV;
-GLEW_FUN_EXPORT PFNGLPATHCOLORGENNVPROC __glewPathColorGenNV;
-GLEW_FUN_EXPORT PFNGLPATHCOMMANDSNVPROC __glewPathCommandsNV;
-GLEW_FUN_EXPORT PFNGLPATHCOORDSNVPROC __glewPathCoordsNV;
-GLEW_FUN_EXPORT PFNGLPATHCOVERDEPTHFUNCNVPROC __glewPathCoverDepthFuncNV;
-GLEW_FUN_EXPORT PFNGLPATHDASHARRAYNVPROC __glewPathDashArrayNV;
-GLEW_FUN_EXPORT PFNGLPATHFOGGENNVPROC __glewPathFogGenNV;
-GLEW_FUN_EXPORT PFNGLPATHGLYPHINDEXARRAYNVPROC __glewPathGlyphIndexArrayNV;
-GLEW_FUN_EXPORT PFNGLPATHGLYPHINDEXRANGENVPROC __glewPathGlyphIndexRangeNV;
-GLEW_FUN_EXPORT PFNGLPATHGLYPHRANGENVPROC __glewPathGlyphRangeNV;
-GLEW_FUN_EXPORT PFNGLPATHGLYPHSNVPROC __glewPathGlyphsNV;
-GLEW_FUN_EXPORT PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC __glewPathMemoryGlyphIndexArrayNV;
-GLEW_FUN_EXPORT PFNGLPATHPARAMETERFNVPROC __glewPathParameterfNV;
-GLEW_FUN_EXPORT PFNGLPATHPARAMETERFVNVPROC __glewPathParameterfvNV;
-GLEW_FUN_EXPORT PFNGLPATHPARAMETERINVPROC __glewPathParameteriNV;
-GLEW_FUN_EXPORT PFNGLPATHPARAMETERIVNVPROC __glewPathParameterivNV;
-GLEW_FUN_EXPORT PFNGLPATHSTENCILDEPTHOFFSETNVPROC __glewPathStencilDepthOffsetNV;
-GLEW_FUN_EXPORT PFNGLPATHSTENCILFUNCNVPROC __glewPathStencilFuncNV;
-GLEW_FUN_EXPORT PFNGLPATHSTRINGNVPROC __glewPathStringNV;
-GLEW_FUN_EXPORT PFNGLPATHSUBCOMMANDSNVPROC __glewPathSubCommandsNV;
-GLEW_FUN_EXPORT PFNGLPATHSUBCOORDSNVPROC __glewPathSubCoordsNV;
-GLEW_FUN_EXPORT PFNGLPATHTEXGENNVPROC __glewPathTexGenNV;
-GLEW_FUN_EXPORT PFNGLPOINTALONGPATHNVPROC __glewPointAlongPathNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC __glewProgramPathFragmentInputGenNV;
-GLEW_FUN_EXPORT PFNGLSTENCILFILLPATHINSTANCEDNVPROC __glewStencilFillPathInstancedNV;
-GLEW_FUN_EXPORT PFNGLSTENCILFILLPATHNVPROC __glewStencilFillPathNV;
-GLEW_FUN_EXPORT PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC __glewStencilStrokePathInstancedNV;
-GLEW_FUN_EXPORT PFNGLSTENCILSTROKEPATHNVPROC __glewStencilStrokePathNV;
-GLEW_FUN_EXPORT PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC __glewStencilThenCoverFillPathInstancedNV;
-GLEW_FUN_EXPORT PFNGLSTENCILTHENCOVERFILLPATHNVPROC __glewStencilThenCoverFillPathNV;
-GLEW_FUN_EXPORT PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC __glewStencilThenCoverStrokePathInstancedNV;
-GLEW_FUN_EXPORT PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC __glewStencilThenCoverStrokePathNV;
-GLEW_FUN_EXPORT PFNGLTRANSFORMPATHNVPROC __glewTransformPathNV;
-GLEW_FUN_EXPORT PFNGLWEIGHTPATHSNVPROC __glewWeightPathsNV;
-
-GLEW_FUN_EXPORT PFNGLFLUSHPIXELDATARANGENVPROC __glewFlushPixelDataRangeNV;
-GLEW_FUN_EXPORT PFNGLPIXELDATARANGENVPROC __glewPixelDataRangeNV;
-
-GLEW_FUN_EXPORT PFNGLPOINTPARAMETERINVPROC __glewPointParameteriNV;
-GLEW_FUN_EXPORT PFNGLPOINTPARAMETERIVNVPROC __glewPointParameterivNV;
-
-GLEW_FUN_EXPORT PFNGLGETVIDEOI64VNVPROC __glewGetVideoi64vNV;
-GLEW_FUN_EXPORT PFNGLGETVIDEOIVNVPROC __glewGetVideoivNV;
-GLEW_FUN_EXPORT PFNGLGETVIDEOUI64VNVPROC __glewGetVideoui64vNV;
-GLEW_FUN_EXPORT PFNGLGETVIDEOUIVNVPROC __glewGetVideouivNV;
-GLEW_FUN_EXPORT PFNGLPRESENTFRAMEDUALFILLNVPROC __glewPresentFrameDualFillNV;
-GLEW_FUN_EXPORT PFNGLPRESENTFRAMEKEYEDNVPROC __glewPresentFrameKeyedNV;
-
-GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTINDEXNVPROC __glewPrimitiveRestartIndexNV;
-GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTNVPROC __glewPrimitiveRestartNV;
-
-GLEW_FUN_EXPORT PFNGLCOMBINERINPUTNVPROC __glewCombinerInputNV;
-GLEW_FUN_EXPORT PFNGLCOMBINEROUTPUTNVPROC __glewCombinerOutputNV;
-GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFNVPROC __glewCombinerParameterfNV;
-GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFVNVPROC __glewCombinerParameterfvNV;
-GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERINVPROC __glewCombinerParameteriNV;
-GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERIVNVPROC __glewCombinerParameterivNV;
-GLEW_FUN_EXPORT PFNGLFINALCOMBINERINPUTNVPROC __glewFinalCombinerInputNV;
-GLEW_FUN_EXPORT PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC __glewGetCombinerInputParameterfvNV;
-GLEW_FUN_EXPORT PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC __glewGetCombinerInputParameterivNV;
-GLEW_FUN_EXPORT PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC __glewGetCombinerOutputParameterfvNV;
-GLEW_FUN_EXPORT PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC __glewGetCombinerOutputParameterivNV;
-GLEW_FUN_EXPORT PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC __glewGetFinalCombinerInputParameterfvNV;
-GLEW_FUN_EXPORT PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC __glewGetFinalCombinerInputParameterivNV;
-
-GLEW_FUN_EXPORT PFNGLCOMBINERSTAGEPARAMETERFVNVPROC __glewCombinerStageParameterfvNV;
-GLEW_FUN_EXPORT PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC __glewGetCombinerStageParameterfvNV;
-
-GLEW_FUN_EXPORT PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC __glewFramebufferSampleLocationsfvNV;
-GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC __glewNamedFramebufferSampleLocationsfvNV;
-
-GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERUI64VNVPROC __glewGetBufferParameterui64vNV;
-GLEW_FUN_EXPORT PFNGLGETINTEGERUI64VNVPROC __glewGetIntegerui64vNV;
-GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC __glewGetNamedBufferParameterui64vNV;
-GLEW_FUN_EXPORT PFNGLISBUFFERRESIDENTNVPROC __glewIsBufferResidentNV;
-GLEW_FUN_EXPORT PFNGLISNAMEDBUFFERRESIDENTNVPROC __glewIsNamedBufferResidentNV;
-GLEW_FUN_EXPORT PFNGLMAKEBUFFERNONRESIDENTNVPROC __glewMakeBufferNonResidentNV;
-GLEW_FUN_EXPORT PFNGLMAKEBUFFERRESIDENTNVPROC __glewMakeBufferResidentNV;
-GLEW_FUN_EXPORT PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC __glewMakeNamedBufferNonResidentNV;
-GLEW_FUN_EXPORT PFNGLMAKENAMEDBUFFERRESIDENTNVPROC __glewMakeNamedBufferResidentNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMUI64NVPROC __glewProgramUniformui64NV;
-GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMUI64VNVPROC __glewProgramUniformui64vNV;
-GLEW_FUN_EXPORT PFNGLUNIFORMUI64NVPROC __glewUniformui64NV;
-GLEW_FUN_EXPORT PFNGLUNIFORMUI64VNVPROC __glewUniformui64vNV;
-
-GLEW_FUN_EXPORT PFNGLTEXTUREBARRIERNVPROC __glewTextureBarrierNV;
-
-GLEW_FUN_EXPORT PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTexImage2DMultisampleCoverageNV;
-GLEW_FUN_EXPORT PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTexImage3DMultisampleCoverageNV;
-GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTextureImage2DMultisampleCoverageNV;
-GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC __glewTextureImage2DMultisampleNV;
-GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTextureImage3DMultisampleCoverageNV;
-GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC __glewTextureImage3DMultisampleNV;
-
-GLEW_FUN_EXPORT PFNGLACTIVEVARYINGNVPROC __glewActiveVaryingNV;
-GLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKNVPROC __glewBeginTransformFeedbackNV;
-GLEW_FUN_EXPORT PFNGLBINDBUFFERBASENVPROC __glewBindBufferBaseNV;
-GLEW_FUN_EXPORT PFNGLBINDBUFFEROFFSETNVPROC __glewBindBufferOffsetNV;
-GLEW_FUN_EXPORT PFNGLBINDBUFFERRANGENVPROC __glewBindBufferRangeNV;
-GLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKNVPROC __glewEndTransformFeedbackNV;
-GLEW_FUN_EXPORT PFNGLGETACTIVEVARYINGNVPROC __glewGetActiveVaryingNV;
-GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC __glewGetTransformFeedbackVaryingNV;
-GLEW_FUN_EXPORT PFNGLGETVARYINGLOCATIONNVPROC __glewGetVaryingLocationNV;
-GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC __glewTransformFeedbackAttribsNV;
-GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC __glewTransformFeedbackVaryingsNV;
-
-GLEW_FUN_EXPORT PFNGLBINDTRANSFORMFEEDBACKNVPROC __glewBindTransformFeedbackNV;
-GLEW_FUN_EXPORT PFNGLDELETETRANSFORMFEEDBACKSNVPROC __glewDeleteTransformFeedbacksNV;
-GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKNVPROC __glewDrawTransformFeedbackNV;
-GLEW_FUN_EXPORT PFNGLGENTRANSFORMFEEDBACKSNVPROC __glewGenTransformFeedbacksNV;
-GLEW_FUN_EXPORT PFNGLISTRANSFORMFEEDBACKNVPROC __glewIsTransformFeedbackNV;
-GLEW_FUN_EXPORT PFNGLPAUSETRANSFORMFEEDBACKNVPROC __glewPauseTransformFeedbackNV;
-GLEW_FUN_EXPORT PFNGLRESUMETRANSFORMFEEDBACKNVPROC __glewResumeTransformFeedbackNV;
-
-GLEW_FUN_EXPORT PFNGLVDPAUFININVPROC __glewVDPAUFiniNV;
-GLEW_FUN_EXPORT PFNGLVDPAUGETSURFACEIVNVPROC __glewVDPAUGetSurfaceivNV;
-GLEW_FUN_EXPORT PFNGLVDPAUINITNVPROC __glewVDPAUInitNV;
-GLEW_FUN_EXPORT PFNGLVDPAUISSURFACENVPROC __glewVDPAUIsSurfaceNV;
-GLEW_FUN_EXPORT PFNGLVDPAUMAPSURFACESNVPROC __glewVDPAUMapSurfacesNV;
-GLEW_FUN_EXPORT PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC __glewVDPAURegisterOutputSurfaceNV;
-GLEW_FUN_EXPORT PFNGLVDPAUREGISTERVIDEOSURFACENVPROC __glewVDPAURegisterVideoSurfaceNV;
-GLEW_FUN_EXPORT PFNGLVDPAUSURFACEACCESSNVPROC __glewVDPAUSurfaceAccessNV;
-GLEW_FUN_EXPORT PFNGLVDPAUUNMAPSURFACESNVPROC __glewVDPAUUnmapSurfacesNV;
-GLEW_FUN_EXPORT PFNGLVDPAUUNREGISTERSURFACENVPROC __glewVDPAUUnregisterSurfaceNV;
-
-GLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGENVPROC __glewFlushVertexArrayRangeNV;
-GLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGENVPROC __glewVertexArrayRangeNV;
-
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLI64VNVPROC __glewGetVertexAttribLi64vNV;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLUI64VNVPROC __glewGetVertexAttribLui64vNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1I64NVPROC __glewVertexAttribL1i64NV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1I64VNVPROC __glewVertexAttribL1i64vNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64NVPROC __glewVertexAttribL1ui64NV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64VNVPROC __glewVertexAttribL1ui64vNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2I64NVPROC __glewVertexAttribL2i64NV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2I64VNVPROC __glewVertexAttribL2i64vNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2UI64NVPROC __glewVertexAttribL2ui64NV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2UI64VNVPROC __glewVertexAttribL2ui64vNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3I64NVPROC __glewVertexAttribL3i64NV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3I64VNVPROC __glewVertexAttribL3i64vNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3UI64NVPROC __glewVertexAttribL3ui64NV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3UI64VNVPROC __glewVertexAttribL3ui64vNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4I64NVPROC __glewVertexAttribL4i64NV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4I64VNVPROC __glewVertexAttribL4i64vNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4UI64NVPROC __glewVertexAttribL4ui64NV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4UI64VNVPROC __glewVertexAttribL4ui64vNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBLFORMATNVPROC __glewVertexAttribLFormatNV;
-
-GLEW_FUN_EXPORT PFNGLBUFFERADDRESSRANGENVPROC __glewBufferAddressRangeNV;
-GLEW_FUN_EXPORT PFNGLCOLORFORMATNVPROC __glewColorFormatNV;
-GLEW_FUN_EXPORT PFNGLEDGEFLAGFORMATNVPROC __glewEdgeFlagFormatNV;
-GLEW_FUN_EXPORT PFNGLFOGCOORDFORMATNVPROC __glewFogCoordFormatNV;
-GLEW_FUN_EXPORT PFNGLGETINTEGERUI64I_VNVPROC __glewGetIntegerui64i_vNV;
-GLEW_FUN_EXPORT PFNGLINDEXFORMATNVPROC __glewIndexFormatNV;
-GLEW_FUN_EXPORT PFNGLNORMALFORMATNVPROC __glewNormalFormatNV;
-GLEW_FUN_EXPORT PFNGLSECONDARYCOLORFORMATNVPROC __glewSecondaryColorFormatNV;
-GLEW_FUN_EXPORT PFNGLTEXCOORDFORMATNVPROC __glewTexCoordFormatNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBFORMATNVPROC __glewVertexAttribFormatNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIFORMATNVPROC __glewVertexAttribIFormatNV;
-GLEW_FUN_EXPORT PFNGLVERTEXFORMATNVPROC __glewVertexFormatNV;
-
-GLEW_FUN_EXPORT PFNGLAREPROGRAMSRESIDENTNVPROC __glewAreProgramsResidentNV;
-GLEW_FUN_EXPORT PFNGLBINDPROGRAMNVPROC __glewBindProgramNV;
-GLEW_FUN_EXPORT PFNGLDELETEPROGRAMSNVPROC __glewDeleteProgramsNV;
-GLEW_FUN_EXPORT PFNGLEXECUTEPROGRAMNVPROC __glewExecuteProgramNV;
-GLEW_FUN_EXPORT PFNGLGENPROGRAMSNVPROC __glewGenProgramsNV;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMPARAMETERDVNVPROC __glewGetProgramParameterdvNV;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMPARAMETERFVNVPROC __glewGetProgramParameterfvNV;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMSTRINGNVPROC __glewGetProgramStringNV;
-GLEW_FUN_EXPORT PFNGLGETPROGRAMIVNVPROC __glewGetProgramivNV;
-GLEW_FUN_EXPORT PFNGLGETTRACKMATRIXIVNVPROC __glewGetTrackMatrixivNV;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVNVPROC __glewGetVertexAttribPointervNV;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVNVPROC __glewGetVertexAttribdvNV;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVNVPROC __glewGetVertexAttribfvNV;
-GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVNVPROC __glewGetVertexAttribivNV;
-GLEW_FUN_EXPORT PFNGLISPROGRAMNVPROC __glewIsProgramNV;
-GLEW_FUN_EXPORT PFNGLLOADPROGRAMNVPROC __glewLoadProgramNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4DNVPROC __glewProgramParameter4dNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4DVNVPROC __glewProgramParameter4dvNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4FNVPROC __glewProgramParameter4fNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4FVNVPROC __glewProgramParameter4fvNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERS4DVNVPROC __glewProgramParameters4dvNV;
-GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERS4FVNVPROC __glewProgramParameters4fvNV;
-GLEW_FUN_EXPORT PFNGLREQUESTRESIDENTPROGRAMSNVPROC __glewRequestResidentProgramsNV;
-GLEW_FUN_EXPORT PFNGLTRACKMATRIXNVPROC __glewTrackMatrixNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DNVPROC __glewVertexAttrib1dNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVNVPROC __glewVertexAttrib1dvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FNVPROC __glewVertexAttrib1fNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVNVPROC __glewVertexAttrib1fvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SNVPROC __glewVertexAttrib1sNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVNVPROC __glewVertexAttrib1svNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DNVPROC __glewVertexAttrib2dNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVNVPROC __glewVertexAttrib2dvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FNVPROC __glewVertexAttrib2fNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVNVPROC __glewVertexAttrib2fvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SNVPROC __glewVertexAttrib2sNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVNVPROC __glewVertexAttrib2svNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DNVPROC __glewVertexAttrib3dNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVNVPROC __glewVertexAttrib3dvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FNVPROC __glewVertexAttrib3fNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVNVPROC __glewVertexAttrib3fvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SNVPROC __glewVertexAttrib3sNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVNVPROC __glewVertexAttrib3svNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DNVPROC __glewVertexAttrib4dNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVNVPROC __glewVertexAttrib4dvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FNVPROC __glewVertexAttrib4fNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVNVPROC __glewVertexAttrib4fvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SNVPROC __glewVertexAttrib4sNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVNVPROC __glewVertexAttrib4svNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBNVPROC __glewVertexAttrib4ubNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVNVPROC __glewVertexAttrib4ubvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERNVPROC __glewVertexAttribPointerNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1DVNVPROC __glewVertexAttribs1dvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1FVNVPROC __glewVertexAttribs1fvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1SVNVPROC __glewVertexAttribs1svNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2DVNVPROC __glewVertexAttribs2dvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2FVNVPROC __glewVertexAttribs2fvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2SVNVPROC __glewVertexAttribs2svNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3DVNVPROC __glewVertexAttribs3dvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3FVNVPROC __glewVertexAttribs3fvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3SVNVPROC __glewVertexAttribs3svNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4DVNVPROC __glewVertexAttribs4dvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4FVNVPROC __glewVertexAttribs4fvNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4SVNVPROC __glewVertexAttribs4svNV;
-GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4UBVNVPROC __glewVertexAttribs4ubvNV;
-
-GLEW_FUN_EXPORT PFNGLBEGINVIDEOCAPTURENVPROC __glewBeginVideoCaptureNV;
-GLEW_FUN_EXPORT PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC __glewBindVideoCaptureStreamBufferNV;
-GLEW_FUN_EXPORT PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC __glewBindVideoCaptureStreamTextureNV;
-GLEW_FUN_EXPORT PFNGLENDVIDEOCAPTURENVPROC __glewEndVideoCaptureNV;
-GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMDVNVPROC __glewGetVideoCaptureStreamdvNV;
-GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMFVNVPROC __glewGetVideoCaptureStreamfvNV;
-GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMIVNVPROC __glewGetVideoCaptureStreamivNV;
-GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTUREIVNVPROC __glewGetVideoCaptureivNV;
-GLEW_FUN_EXPORT PFNGLVIDEOCAPTURENVPROC __glewVideoCaptureNV;
-GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC __glewVideoCaptureStreamParameterdvNV;
-GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC __glewVideoCaptureStreamParameterfvNV;
-GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC __glewVideoCaptureStreamParameterivNV;
-
-GLEW_FUN_EXPORT PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES;
-GLEW_FUN_EXPORT PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES;
-GLEW_FUN_EXPORT PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES;
-GLEW_FUN_EXPORT PFNGLFRUSTUMFOESPROC __glewFrustumfOES;
-GLEW_FUN_EXPORT PFNGLGETCLIPPLANEFOESPROC __glewGetClipPlanefOES;
-GLEW_FUN_EXPORT PFNGLORTHOFOESPROC __glewOrthofOES;
-
-GLEW_FUN_EXPORT PFNGLALPHAFUNCXPROC __glewAlphaFuncx;
-GLEW_FUN_EXPORT PFNGLCLEARCOLORXPROC __glewClearColorx;
-GLEW_FUN_EXPORT PFNGLCLEARDEPTHXPROC __glewClearDepthx;
-GLEW_FUN_EXPORT PFNGLCOLOR4XPROC __glewColor4x;
-GLEW_FUN_EXPORT PFNGLDEPTHRANGEXPROC __glewDepthRangex;
-GLEW_FUN_EXPORT PFNGLFOGXPROC __glewFogx;
-GLEW_FUN_EXPORT PFNGLFOGXVPROC __glewFogxv;
-GLEW_FUN_EXPORT PFNGLFRUSTUMFPROC __glewFrustumf;
-GLEW_FUN_EXPORT PFNGLFRUSTUMXPROC __glewFrustumx;
-GLEW_FUN_EXPORT PFNGLLIGHTMODELXPROC __glewLightModelx;
-GLEW_FUN_EXPORT PFNGLLIGHTMODELXVPROC __glewLightModelxv;
-GLEW_FUN_EXPORT PFNGLLIGHTXPROC __glewLightx;
-GLEW_FUN_EXPORT PFNGLLIGHTXVPROC __glewLightxv;
-GLEW_FUN_EXPORT PFNGLLINEWIDTHXPROC __glewLineWidthx;
-GLEW_FUN_EXPORT PFNGLLOADMATRIXXPROC __glewLoadMatrixx;
-GLEW_FUN_EXPORT PFNGLMATERIALXPROC __glewMaterialx;
-GLEW_FUN_EXPORT PFNGLMATERIALXVPROC __glewMaterialxv;
-GLEW_FUN_EXPORT PFNGLMULTMATRIXXPROC __glewMultMatrixx;
-GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4XPROC __glewMultiTexCoord4x;
-GLEW_FUN_EXPORT PFNGLNORMAL3XPROC __glewNormal3x;
-GLEW_FUN_EXPORT PFNGLORTHOFPROC __glewOrthof;
-GLEW_FUN_EXPORT PFNGLORTHOXPROC __glewOrthox;
-GLEW_FUN_EXPORT PFNGLPOINTSIZEXPROC __glewPointSizex;
-GLEW_FUN_EXPORT PFNGLPOLYGONOFFSETXPROC __glewPolygonOffsetx;
-GLEW_FUN_EXPORT PFNGLROTATEXPROC __glewRotatex;
-GLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEXPROC __glewSampleCoveragex;
-GLEW_FUN_EXPORT PFNGLSCALEXPROC __glewScalex;
-GLEW_FUN_EXPORT PFNGLTEXENVXPROC __glewTexEnvx;
-GLEW_FUN_EXPORT PFNGLTEXENVXVPROC __glewTexEnvxv;
-GLEW_FUN_EXPORT PFNGLTEXPARAMETERXPROC __glewTexParameterx;
-GLEW_FUN_EXPORT PFNGLTRANSLATEXPROC __glewTranslatex;
-
-GLEW_FUN_EXPORT PFNGLCLIPPLANEFPROC __glewClipPlanef;
-GLEW_FUN_EXPORT PFNGLCLIPPLANEXPROC __glewClipPlanex;
-GLEW_FUN_EXPORT PFNGLGETCLIPPLANEFPROC __glewGetClipPlanef;
-GLEW_FUN_EXPORT PFNGLGETCLIPPLANEXPROC __glewGetClipPlanex;
-GLEW_FUN_EXPORT PFNGLGETFIXEDVPROC __glewGetFixedv;
-GLEW_FUN_EXPORT PFNGLGETLIGHTXVPROC __glewGetLightxv;
-GLEW_FUN_EXPORT PFNGLGETMATERIALXVPROC __glewGetMaterialxv;
-GLEW_FUN_EXPORT PFNGLGETTEXENVXVPROC __glewGetTexEnvxv;
-GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERXVPROC __glewGetTexParameterxv;
-GLEW_FUN_EXPORT PFNGLPOINTPARAMETERXPROC __glewPointParameterx;
-GLEW_FUN_EXPORT PFNGLPOINTPARAMETERXVPROC __glewPointParameterxv;
-GLEW_FUN_EXPORT PFNGLPOINTSIZEPOINTEROESPROC __glewPointSizePointerOES;
-GLEW_FUN_EXPORT PFNGLTEXPARAMETERXVPROC __glewTexParameterxv;
-
-GLEW_FUN_EXPORT PFNGLERRORSTRINGREGALPROC __glewErrorStringREGAL;
-
-GLEW_FUN_EXPORT PFNGLGETEXTENSIONREGALPROC __glewGetExtensionREGAL;
-GLEW_FUN_EXPORT PFNGLISSUPPORTEDREGALPROC __glewIsSupportedREGAL;
-
-GLEW_FUN_EXPORT PFNGLLOGMESSAGECALLBACKREGALPROC __glewLogMessageCallbackREGAL;
-
-GLEW_FUN_EXPORT PFNGLGETPROCADDRESSREGALPROC __glewGetProcAddressREGAL;
-
-GLEW_FUN_EXPORT PFNGLDETAILTEXFUNCSGISPROC __glewDetailTexFuncSGIS;
-GLEW_FUN_EXPORT PFNGLGETDETAILTEXFUNCSGISPROC __glewGetDetailTexFuncSGIS;
-
-GLEW_FUN_EXPORT PFNGLFOGFUNCSGISPROC __glewFogFuncSGIS;
-GLEW_FUN_EXPORT PFNGLGETFOGFUNCSGISPROC __glewGetFogFuncSGIS;
-
-GLEW_FUN_EXPORT PFNGLSAMPLEMASKSGISPROC __glewSampleMaskSGIS;
-GLEW_FUN_EXPORT PFNGLSAMPLEPATTERNSGISPROC __glewSamplePatternSGIS;
-
-GLEW_FUN_EXPORT PFNGLGETSHARPENTEXFUNCSGISPROC __glewGetSharpenTexFuncSGIS;
-GLEW_FUN_EXPORT PFNGLSHARPENTEXFUNCSGISPROC __glewSharpenTexFuncSGIS;
-
-GLEW_FUN_EXPORT PFNGLTEXIMAGE4DSGISPROC __glewTexImage4DSGIS;
-GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE4DSGISPROC __glewTexSubImage4DSGIS;
-
-GLEW_FUN_EXPORT PFNGLGETTEXFILTERFUNCSGISPROC __glewGetTexFilterFuncSGIS;
-GLEW_FUN_EXPORT PFNGLTEXFILTERFUNCSGISPROC __glewTexFilterFuncSGIS;
-
-GLEW_FUN_EXPORT PFNGLASYNCMARKERSGIXPROC __glewAsyncMarkerSGIX;
-GLEW_FUN_EXPORT PFNGLDELETEASYNCMARKERSSGIXPROC __glewDeleteAsyncMarkersSGIX;
-GLEW_FUN_EXPORT PFNGLFINISHASYNCSGIXPROC __glewFinishAsyncSGIX;
-GLEW_FUN_EXPORT PFNGLGENASYNCMARKERSSGIXPROC __glewGenAsyncMarkersSGIX;
-GLEW_FUN_EXPORT PFNGLISASYNCMARKERSGIXPROC __glewIsAsyncMarkerSGIX;
-GLEW_FUN_EXPORT PFNGLPOLLASYNCSGIXPROC __glewPollAsyncSGIX;
-
-GLEW_FUN_EXPORT PFNGLFLUSHRASTERSGIXPROC __glewFlushRasterSGIX;
-
-GLEW_FUN_EXPORT PFNGLTEXTUREFOGSGIXPROC __glewTextureFogSGIX;
-
-GLEW_FUN_EXPORT PFNGLFRAGMENTCOLORMATERIALSGIXPROC __glewFragmentColorMaterialSGIX;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFSGIXPROC __glewFragmentLightModelfSGIX;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFVSGIXPROC __glewFragmentLightModelfvSGIX;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELISGIXPROC __glewFragmentLightModeliSGIX;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIVSGIXPROC __glewFragmentLightModelivSGIX;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFSGIXPROC __glewFragmentLightfSGIX;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFVSGIXPROC __glewFragmentLightfvSGIX;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTISGIXPROC __glewFragmentLightiSGIX;
-GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIVSGIXPROC __glewFragmentLightivSGIX;
-GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFSGIXPROC __glewFragmentMaterialfSGIX;
-GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFVSGIXPROC __glewFragmentMaterialfvSGIX;
-GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALISGIXPROC __glewFragmentMaterialiSGIX;
-GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIVSGIXPROC __glewFragmentMaterialivSGIX;
-GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTFVSGIXPROC __glewGetFragmentLightfvSGIX;
-GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTIVSGIXPROC __glewGetFragmentLightivSGIX;
-GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALFVSGIXPROC __glewGetFragmentMaterialfvSGIX;
-GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALIVSGIXPROC __glewGetFragmentMaterialivSGIX;
-
-GLEW_FUN_EXPORT PFNGLFRAMEZOOMSGIXPROC __glewFrameZoomSGIX;
-
-GLEW_FUN_EXPORT PFNGLPIXELTEXGENSGIXPROC __glewPixelTexGenSGIX;
-
-GLEW_FUN_EXPORT PFNGLREFERENCEPLANESGIXPROC __glewReferencePlaneSGIX;
-
-GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERFSGIXPROC __glewSpriteParameterfSGIX;
-GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERFVSGIXPROC __glewSpriteParameterfvSGIX;
-GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERISGIXPROC __glewSpriteParameteriSGIX;
-GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERIVSGIXPROC __glewSpriteParameterivSGIX;
-
-GLEW_FUN_EXPORT PFNGLTAGSAMPLEBUFFERSGIXPROC __glewTagSampleBufferSGIX;
-
-GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERFVSGIPROC __glewColorTableParameterfvSGI;
-GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERIVSGIPROC __glewColorTableParameterivSGI;
-GLEW_FUN_EXPORT PFNGLCOLORTABLESGIPROC __glewColorTableSGI;
-GLEW_FUN_EXPORT PFNGLCOPYCOLORTABLESGIPROC __glewCopyColorTableSGI;
-GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVSGIPROC __glewGetColorTableParameterfvSGI;
-GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVSGIPROC __glewGetColorTableParameterivSGI;
-GLEW_FUN_EXPORT PFNGLGETCOLORTABLESGIPROC __glewGetColorTableSGI;
-
-GLEW_FUN_EXPORT PFNGLFINISHTEXTURESUNXPROC __glewFinishTextureSUNX;
-
-GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORBSUNPROC __glewGlobalAlphaFactorbSUN;
-GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORDSUNPROC __glewGlobalAlphaFactordSUN;
-GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORFSUNPROC __glewGlobalAlphaFactorfSUN;
-GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORISUNPROC __glewGlobalAlphaFactoriSUN;
-GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORSSUNPROC __glewGlobalAlphaFactorsSUN;
-GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUBSUNPROC __glewGlobalAlphaFactorubSUN;
-GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUISUNPROC __glewGlobalAlphaFactoruiSUN;
-GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUSSUNPROC __glewGlobalAlphaFactorusSUN;
-
-GLEW_FUN_EXPORT PFNGLREADVIDEOPIXELSSUNPROC __glewReadVideoPixelsSUN;
-
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEPOINTERSUNPROC __glewReplacementCodePointerSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUBSUNPROC __glewReplacementCodeubSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUBVSUNPROC __glewReplacementCodeubvSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUISUNPROC __glewReplacementCodeuiSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVSUNPROC __glewReplacementCodeuivSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUSSUNPROC __glewReplacementCodeusSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUSVSUNPROC __glewReplacementCodeusvSUN;
-
-GLEW_FUN_EXPORT PFNGLCOLOR3FVERTEX3FSUNPROC __glewColor3fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLCOLOR3FVERTEX3FVSUNPROC __glewColor3fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewColor4fNormal3fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewColor4fNormal3fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX2FSUNPROC __glewColor4ubVertex2fSUN;
-GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX2FVSUNPROC __glewColor4ubVertex2fvSUN;
-GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX3FSUNPROC __glewColor4ubVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX3FVSUNPROC __glewColor4ubVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLNORMAL3FVERTEX3FSUNPROC __glewNormal3fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLNORMAL3FVERTEX3FVSUNPROC __glewNormal3fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC __glewReplacementCodeuiColor3fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor3fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC __glewReplacementCodeuiColor4ubVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC __glewReplacementCodeuiColor4ubVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiNormal3fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiNormal3fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC __glewReplacementCodeuiVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC __glewReplacementCodeuiVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC __glewTexCoord2fColor3fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC __glewTexCoord2fColor3fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC __glewTexCoord2fColor4ubVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC __glewTexCoord2fColor4ubVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fNormal3fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fNormal3fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD2FVERTEX3FSUNPROC __glewTexCoord2fVertex3fSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD2FVERTEX3FVSUNPROC __glewTexCoord2fVertex3fvSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fvSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FSUNPROC __glewTexCoord4fVertex4fSUN;
-GLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FVSUNPROC __glewTexCoord4fVertex4fvSUN;
-
-GLEW_FUN_EXPORT PFNGLADDSWAPHINTRECTWINPROC __glewAddSwapHintRectWIN;
-
-#if defined(GLEW_MX) && !defined(_WIN32)
-struct GLEWContextStruct
-{
-#endif /* GLEW_MX */
-
-
-#if defined(GLEW_MX)
-GLEWHashList *GLEW_GL_EXTENSIONS;
-#endif /* GLEW_MX */
-
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2_1;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_3;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_4;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_5;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_0;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_1;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_0;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_1;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_2;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_3;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_0;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_1;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_2;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_3;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_4;
-GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_5;
-GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_multisample;
-GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_tbuffer;
-GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_texture_compression_FXT1;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_blend_minmax_factor;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_conservative_depth;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_debug_output;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_depth_clamp_separate;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_draw_buffers_blend;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_gcn_shader;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_gpu_shader_int64;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_interleaved_elements;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_multi_draw_indirect;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_name_gen_delete;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_occlusion_query_event;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_performance_monitor;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_pinned_memory;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_query_buffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_sample_positions;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_seamless_cubemap_per_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_atomic_counter_ops;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_stencil_export;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_stencil_value_export;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_trinary_minmax;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_sparse_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_stencil_operation_extended;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_texture_texture4;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_transform_feedback3_lines_triangles;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_transform_feedback4;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_layer;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_tessellator;
-GLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_viewport_index;
-GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_depth_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_framebuffer_blit;
-GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_framebuffer_multisample;
-GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_instanced_arrays;
-GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_pack_reverse_row_order;
-GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_program_binary;
-GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_texture_compression_dxt1;
-GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_texture_compression_dxt3;
-GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_texture_compression_dxt5;
-GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_texture_usage;
-GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_timer_query;
-GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_translated_shader_source;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_aux_depth_stencil;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_client_storage;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_element_array;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_fence;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_float_pixels;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_flush_buffer_range;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_object_purgeable;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_pixel_buffer;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_rgb_422;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_row_bytes;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_specular_vector;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_texture_range;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_transform_hint;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_array_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_array_range;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_program_evaluators;
-GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_ycbcr_422;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES2_compatibility;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES3_1_compatibility;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES3_compatibility;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_arrays_of_arrays;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_base_instance;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_bindless_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_blend_func_extended;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_buffer_storage;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_cl_event;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_clear_buffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_clear_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_clip_control;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_color_buffer_float;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_compatibility;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_compressed_texture_pixel_storage;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_compute_shader;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_compute_variable_group_size;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_conditional_render_inverted;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_conservative_depth;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_copy_buffer;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_copy_image;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_cull_distance;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_debug_output;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_buffer_float;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_clamp;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_derivative_control;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_direct_state_access;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_buffers;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_buffers_blend;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_elements_base_vertex;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_indirect;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_instanced;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_enhanced_layouts;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_explicit_attrib_location;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_explicit_uniform_location;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_coord_conventions;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_layer_viewport;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_program;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_program_shadow;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_shader;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_no_attachments;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_sRGB;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_geometry_shader4;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_get_program_binary;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_get_texture_sub_image;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader5;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader_fp64;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_half_float_pixel;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_half_float_vertex;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_imaging;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_indirect_parameters;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_instanced_arrays;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_internalformat_query;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_internalformat_query2;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_invalidate_subdata;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_map_buffer_alignment;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_map_buffer_range;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_matrix_palette;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multi_bind;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multi_draw_indirect;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multisample;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multitexture;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_occlusion_query;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_occlusion_query2;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_pipeline_statistics_query;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_pixel_buffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_point_parameters;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_point_sprite;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_program_interface_query;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_provoking_vertex;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_query_buffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_robust_buffer_access_behavior;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness_application_isolation;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness_share_group_isolation;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sample_shading;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sampler_objects;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_seamless_cube_map;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_seamless_cubemap_per_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_separate_shader_objects;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_atomic_counters;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_bit_encoding;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_draw_parameters;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_group_vote;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_image_load_store;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_image_size;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_objects;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_precision;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_stencil_export;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_storage_buffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_subroutine;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_texture_image_samples;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_texture_lod;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_100;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_420pack;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_include;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_packing;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shadow;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shadow_ambient;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sparse_buffer;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sparse_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_stencil_texturing;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sync;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_tessellation_shader;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_barrier;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_border_clamp;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_object_rgb32;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_range;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression_bptc;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression_rgtc;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_cube_map;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_cube_map_array;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_add;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_combine;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_crossbar;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_dot3;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_float;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_gather;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_mirror_clamp_to_edge;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_mirrored_repeat;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_multisample;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_non_power_of_two;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_query_levels;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_query_lod;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rectangle;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rg;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rgb10_a2ui;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_stencil8;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_storage;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_storage_multisample;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_swizzle;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_view;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_timer_query;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback2;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback3;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback_instanced;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback_overflow_query;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transpose_matrix;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_uniform_buffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_array_bgra;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_array_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_attrib_64bit;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_attrib_binding;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_blend;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_buffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_program;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_shader;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_type_10f_11f_11f_rev;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_type_2_10_10_10_rev;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_viewport_array;
-GLEW_VAR_EXPORT GLboolean __GLEW_ARB_window_pos;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_point_sprites;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_combine3;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_route;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_vertex_shader_output_point_size;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_draw_buffers;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_element_array;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_envmap_bumpmap;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_fragment_shader;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_map_object_buffer;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_meminfo;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_pn_triangles;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_separate_stencil;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_shader_texture_lod;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_text_fragment_shader;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_compression_3dc;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_env_combine3;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_float;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_mirror_once;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_array_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_attrib_array_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_streams;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_422_pixels;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_Cg_shader;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_abgr;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_bgra;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_bindable_uniform;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_color;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_equation_separate;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_func_separate;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_logic_op;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_minmax;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_subtract;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_clip_volume_hint;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_cmyka;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_color_subtable;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_compiled_vertex_array;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_convolution;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_coordinate_frame;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_copy_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_cull_vertex;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_debug_label;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_debug_marker;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_depth_bounds_test;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_direct_state_access;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_buffers2;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_instanced;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_range_elements;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_fog_coord;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_fragment_lighting;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_blit;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_multisample;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_multisample_blit_scaled;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_sRGB;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_geometry_shader4;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_gpu_program_parameters;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_gpu_shader4;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_histogram;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_array_formats;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_func;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_material;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_light_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_misc_attribute;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multi_draw_arrays;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multisample;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_depth_stencil;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_float;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_pixels;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_paletted_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_buffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_transform;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_transform_color_table;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_point_parameters;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_polygon_offset;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_polygon_offset_clamp;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_post_depth_coverage;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_provoking_vertex;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_raster_multisample;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_rescale_normal;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_scene_marker;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_secondary_color;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_shader_objects;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_specular_color;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_image_load_formatted;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_image_load_store;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_integer_mix;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shadow_funcs;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shared_texture_palette;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_sparse_texture2;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_clear_tag;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_two_side;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_wrap;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_subtexture;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture3D;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_array;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_buffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_dxt1;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_latc;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_rgtc;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_s3tc;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_cube_map;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_edge_clamp;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_add;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_combine;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_dot3;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_filter_anisotropic;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_filter_minmax;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_integer;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_lod_bias;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_mirror_clamp;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_perturb_normal;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_rectangle;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB_decode;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_shared_exponent;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_snorm;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_swizzle;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_timer_query;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_transform_feedback;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_array;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_array_bgra;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_attrib_64bit;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_shader;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_weighting;
-GLEW_VAR_EXPORT GLboolean __GLEW_EXT_x11_sync_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_frame_terminator;
-GLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_string_marker;
-GLEW_VAR_EXPORT GLboolean __GLEW_HP_convolution_border_modes;
-GLEW_VAR_EXPORT GLboolean __GLEW_HP_image_transform;
-GLEW_VAR_EXPORT GLboolean __GLEW_HP_occlusion_test;
-GLEW_VAR_EXPORT GLboolean __GLEW_HP_texture_lighting;
-GLEW_VAR_EXPORT GLboolean __GLEW_IBM_cull_vertex;
-GLEW_VAR_EXPORT GLboolean __GLEW_IBM_multimode_draw_arrays;
-GLEW_VAR_EXPORT GLboolean __GLEW_IBM_rasterpos_clip;
-GLEW_VAR_EXPORT GLboolean __GLEW_IBM_static_data;
-GLEW_VAR_EXPORT GLboolean __GLEW_IBM_texture_mirrored_repeat;
-GLEW_VAR_EXPORT GLboolean __GLEW_IBM_vertex_array_lists;
-GLEW_VAR_EXPORT GLboolean __GLEW_INGR_color_clamp;
-GLEW_VAR_EXPORT GLboolean __GLEW_INGR_interlace_read;
-GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_fragment_shader_ordering;
-GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_map_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_parallel_arrays;
-GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_performance_query;
-GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_texture_scissor;
-GLEW_VAR_EXPORT GLboolean __GLEW_KHR_blend_equation_advanced;
-GLEW_VAR_EXPORT GLboolean __GLEW_KHR_blend_equation_advanced_coherent;
-GLEW_VAR_EXPORT GLboolean __GLEW_KHR_context_flush_control;
-GLEW_VAR_EXPORT GLboolean __GLEW_KHR_debug;
-GLEW_VAR_EXPORT GLboolean __GLEW_KHR_robust_buffer_access_behavior;
-GLEW_VAR_EXPORT GLboolean __GLEW_KHR_robustness;
-GLEW_VAR_EXPORT GLboolean __GLEW_KHR_texture_compression_astc_hdr;
-GLEW_VAR_EXPORT GLboolean __GLEW_KHR_texture_compression_astc_ldr;
-GLEW_VAR_EXPORT GLboolean __GLEW_KTX_buffer_region;
-GLEW_VAR_EXPORT GLboolean __GLEW_MESAX_texture_stack;
-GLEW_VAR_EXPORT GLboolean __GLEW_MESA_pack_invert;
-GLEW_VAR_EXPORT GLboolean __GLEW_MESA_resize_buffers;
-GLEW_VAR_EXPORT GLboolean __GLEW_MESA_window_pos;
-GLEW_VAR_EXPORT GLboolean __GLEW_MESA_ycbcr_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_NVX_conditional_render;
-GLEW_VAR_EXPORT GLboolean __GLEW_NVX_gpu_memory_info;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_bindless_multi_draw_indirect;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_bindless_multi_draw_indirect_count;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_bindless_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_blend_equation_advanced;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_blend_equation_advanced_coherent;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_blend_square;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_compute_program5;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_conditional_render;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_conservative_raster;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_depth_to_color;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_image;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_deep_texture3D;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_buffer_float;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_clamp;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_range_unclamped;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_draw_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_evaluators;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_explicit_multisample;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_fence;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_fill_rectangle;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_float_buffer;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_fog_distance;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_coverage_to_color;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program2;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program4;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program_option;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_shader_interlock;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_framebuffer_mixed_samples;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_framebuffer_multisample_coverage;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_geometry_program4;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_geometry_shader4;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_geometry_shader_passthrough;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program4;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program5;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program5_mem_extended;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program_fp64;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_shader5;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_half_float;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_internalformat_sample_query;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_light_max_exponent;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_coverage;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_filter_hint;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_occlusion_query;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_packed_depth_stencil;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_parameter_buffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_parameter_buffer_object2;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_path_rendering;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_path_rendering_shared_edge;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_pixel_data_range;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_point_sprite;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_present_video;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_primitive_restart;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners2;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_sample_locations;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_sample_mask_override_coverage;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_counters;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_float;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_fp16_vector;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_int64;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_buffer_load;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_storage_buffer_object;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_thread_group;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_thread_shuffle;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_tessellation_program5;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_emboss;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_reflection;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_barrier;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_compression_vtc;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_env_combine4;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_expand_normal;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_multisample;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_rectangle;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader2;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader3;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_transform_feedback;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_transform_feedback2;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_uniform_buffer_unified_memory;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_vdpau_interop;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range2;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_attrib_integer_64bit;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_buffer_unified_memory;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program1_1;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2_option;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program3;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program4;
-GLEW_VAR_EXPORT GLboolean __GLEW_NV_video_capture;
-GLEW_VAR_EXPORT GLboolean __GLEW_OES_byte_coordinates;
-GLEW_VAR_EXPORT GLboolean __GLEW_OES_compressed_paletted_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_OES_read_format;
-GLEW_VAR_EXPORT GLboolean __GLEW_OES_single_precision;
-GLEW_VAR_EXPORT GLboolean __GLEW_OML_interlace;
-GLEW_VAR_EXPORT GLboolean __GLEW_OML_resample;
-GLEW_VAR_EXPORT GLboolean __GLEW_OML_subsample;
-GLEW_VAR_EXPORT GLboolean __GLEW_PGI_misc_hints;
-GLEW_VAR_EXPORT GLboolean __GLEW_PGI_vertex_hints;
-GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_ES1_0_compatibility;
-GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_ES1_1_compatibility;
-GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_enable;
-GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_error_string;
-GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_extension_query;
-GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_log;
-GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_proc_address;
-GLEW_VAR_EXPORT GLboolean __GLEW_REND_screen_coordinates;
-GLEW_VAR_EXPORT GLboolean __GLEW_S3_s3tc;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_color_range;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_detail_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_fog_function;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_generate_mipmap;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_multisample;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_pixel_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_point_line_texgen;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_sharpen_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture4D;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_border_clamp;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_edge_clamp;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_filter4;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_lod;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_select;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async_histogram;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async_pixel;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_blend_alpha_minmax;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_clipmap;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_convolution_accuracy;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_depth_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_flush_raster;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fog_offset;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fog_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fragment_specular_lighting;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_framezoom;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_interlace;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_ir_instrument1;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_list_priority;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_pixel_texture;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_pixel_texture_bits;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_reference_plane;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_resample;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_shadow;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_shadow_ambient;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_sprite;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_tag_sample_buffer;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_add_env;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_coordinate_clamp;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_lod_bias;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_multi_buffer;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_range;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_scale_bias;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_vertex_preclip;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_vertex_preclip_hint;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_ycrcb;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGI_color_matrix;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGI_color_table;
-GLEW_VAR_EXPORT GLboolean __GLEW_SGI_texture_color_table;
-GLEW_VAR_EXPORT GLboolean __GLEW_SUNX_constant_data;
-GLEW_VAR_EXPORT GLboolean __GLEW_SUN_convolution_border_modes;
-GLEW_VAR_EXPORT GLboolean __GLEW_SUN_global_alpha;
-GLEW_VAR_EXPORT GLboolean __GLEW_SUN_mesh_array;
-GLEW_VAR_EXPORT GLboolean __GLEW_SUN_read_video_pixels;
-GLEW_VAR_EXPORT GLboolean __GLEW_SUN_slice_accum;
-GLEW_VAR_EXPORT GLboolean __GLEW_SUN_triangle_list;
-GLEW_VAR_EXPORT GLboolean __GLEW_SUN_vertex;
-GLEW_VAR_EXPORT GLboolean __GLEW_WIN_phong_shading;
-GLEW_VAR_EXPORT GLboolean __GLEW_WIN_specular_fog;
-GLEW_VAR_EXPORT GLboolean __GLEW_WIN_swap_hint;
-
-#ifdef GLEW_MX
-}; /* GLEWContextStruct */
-#endif /* GLEW_MX */
-
-/* ------------------------------------------------------------------------- */
-
-/* error codes */
-#define GLEW_OK 0
-#define GLEW_NO_ERROR 0
-#define GLEW_ERROR_NO_GL_VERSION 1 /* missing GL version */
-#define GLEW_ERROR_GL_VERSION_10_ONLY 2 /* Need at least OpenGL 1.1 */
-#define GLEW_ERROR_GLX_VERSION_11_ONLY 3 /* Need at least GLX 1.2 */
-
-/* string codes */
-#define GLEW_VERSION 1
-#define GLEW_VERSION_MAJOR 2
-#define GLEW_VERSION_MINOR 3
-#define GLEW_VERSION_MICRO 4
-
-/* API */
-#ifdef GLEW_MX
-
-typedef struct GLEWContextStruct GLEWContext;
-GLEWAPI GLenum GLEWAPIENTRY glewContextInit (GLEWContext *ctx);
-GLEWAPI GLboolean GLEWAPIENTRY glewContextIsSupported (const GLEWContext *ctx, const char *name);
-
-#define glewInit() glewContextInit(glewGetContext())
-#define glewIsSupported(x) glewContextIsSupported(glewGetContext(), x)
-#define glewIsExtensionSupported(x) glewIsSupported(x)
-
-#define GLEW_GET_VAR(x) (*(const GLboolean*)&(glewGetContext()->x))
-#ifdef _WIN32
-# define GLEW_GET_FUN(x) glewGetContext()->x
-#else
-# define GLEW_GET_FUN(x) x
-#endif
-
-#else /* GLEW_MX */
-
-GLEWAPI GLenum GLEWAPIENTRY glewInit (void);
-GLEWAPI GLboolean GLEWAPIENTRY glewIsSupported (const char *name);
-#define glewIsExtensionSupported(x) glewIsSupported(x)
-
-#define GLEW_GET_VAR(x) (*(const GLboolean*)&x)
-#define GLEW_GET_FUN(x) x
-
-#endif /* GLEW_MX */
-
-GLEWAPI GLboolean glewExperimental;
-GLEWAPI GLboolean GLEWAPIENTRY glewGetExtension (const char *name);
-GLEWAPI const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error);
-GLEWAPI const GLubyte * GLEWAPIENTRY glewGetString (GLenum name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#ifdef GLEW_APIENTRY_DEFINED
-#undef GLEW_APIENTRY_DEFINED
-#undef APIENTRY
-#endif
-
-#ifdef GLEW_CALLBACK_DEFINED
-#undef GLEW_CALLBACK_DEFINED
-#undef CALLBACK
-#endif
-
-#ifdef GLEW_WINGDIAPI_DEFINED
-#undef GLEW_WINGDIAPI_DEFINED
-#undef WINGDIAPI
-#endif
-
-#undef GLAPI
-/* #undef GLEWAPI */
-
-#endif /* __glew_h__ */
diff --git a/Libraries/glew-urkle-core/include/GL/glxew.h b/Libraries/glew-urkle-core/include/GL/glxew.h
deleted file mode 100644
index 1d299ea7..00000000
--- a/Libraries/glew-urkle-core/include/GL/glxew.h
+++ /dev/null
@@ -1,1776 +0,0 @@
-/*
-** The OpenGL Extension Wrangler Library
-** Copyright (C) 2008-2014, Nigel Stewart <nigels[]users sourceforge net>
-** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
-** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
-** Copyright (C) 2002, Lev Povalahev
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-** * The name of the author may be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-** THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
- * Mesa 3-D graphics library
- * Version: 7.0
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
-** Copyright (c) 2007 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-#ifndef __glxew_h__
-#define __glxew_h__
-#define __GLXEW_H__
-
-#ifdef __glxext_h_
-#error glxext.h included before glxew.h
-#endif
-
-#if defined(GLX_H) || defined(__GLX_glx_h__) || defined(__glx_h__)
-#error glx.h included before glxew.h
-#endif
-
-#define __glxext_h_
-
-#define GLX_H
-#define __GLX_glx_h__
-#define __glx_h__
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xmd.h>
-#include <GL/glew.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* ---------------------------- GLX_VERSION_1_0 --------------------------- */
-
-#ifndef GLX_VERSION_1_0
-#define GLX_VERSION_1_0 1
-
-#define GLX_USE_GL 1
-#define GLX_BUFFER_SIZE 2
-#define GLX_LEVEL 3
-#define GLX_RGBA 4
-#define GLX_DOUBLEBUFFER 5
-#define GLX_STEREO 6
-#define GLX_AUX_BUFFERS 7
-#define GLX_RED_SIZE 8
-#define GLX_GREEN_SIZE 9
-#define GLX_BLUE_SIZE 10
-#define GLX_ALPHA_SIZE 11
-#define GLX_DEPTH_SIZE 12
-#define GLX_STENCIL_SIZE 13
-#define GLX_ACCUM_RED_SIZE 14
-#define GLX_ACCUM_GREEN_SIZE 15
-#define GLX_ACCUM_BLUE_SIZE 16
-#define GLX_ACCUM_ALPHA_SIZE 17
-#define GLX_BAD_SCREEN 1
-#define GLX_BAD_ATTRIBUTE 2
-#define GLX_NO_EXTENSION 3
-#define GLX_BAD_VISUAL 4
-#define GLX_BAD_CONTEXT 5
-#define GLX_BAD_VALUE 6
-#define GLX_BAD_ENUM 7
-
-typedef XID GLXDrawable;
-typedef XID GLXPixmap;
-#ifdef __sun
-typedef struct __glXContextRec *GLXContext;
-#else
-typedef struct __GLXcontextRec *GLXContext;
-#endif
-
-typedef unsigned int GLXVideoDeviceNV;
-
-extern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase);
-extern Bool glXQueryVersion (Display *dpy, int *major, int *minor);
-extern int glXGetConfig (Display *dpy, XVisualInfo *vis, int attrib, int *value);
-extern XVisualInfo* glXChooseVisual (Display *dpy, int screen, int *attribList);
-extern GLXPixmap glXCreateGLXPixmap (Display *dpy, XVisualInfo *vis, Pixmap pixmap);
-extern void glXDestroyGLXPixmap (Display *dpy, GLXPixmap pix);
-extern GLXContext glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
-extern void glXDestroyContext (Display *dpy, GLXContext ctx);
-extern Bool glXIsDirect (Display *dpy, GLXContext ctx);
-extern void glXCopyContext (Display *dpy, GLXContext src, GLXContext dst, GLulong mask);
-extern Bool glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx);
-extern GLXContext glXGetCurrentContext (void);
-extern GLXDrawable glXGetCurrentDrawable (void);
-extern void glXWaitGL (void);
-extern void glXWaitX (void);
-extern void glXSwapBuffers (Display *dpy, GLXDrawable drawable);
-extern void glXUseXFont (Font font, int first, int count, int listBase);
-
-#define GLXEW_VERSION_1_0 GLXEW_GET_VAR(__GLXEW_VERSION_1_0)
-
-#endif /* GLX_VERSION_1_0 */
-
-/* ---------------------------- GLX_VERSION_1_1 --------------------------- */
-
-#ifndef GLX_VERSION_1_1
-#define GLX_VERSION_1_1
-
-#define GLX_VENDOR 0x1
-#define GLX_VERSION 0x2
-#define GLX_EXTENSIONS 0x3
-
-extern const char* glXQueryExtensionsString (Display *dpy, int screen);
-extern const char* glXGetClientString (Display *dpy, int name);
-extern const char* glXQueryServerString (Display *dpy, int screen, int name);
-
-#define GLXEW_VERSION_1_1 GLXEW_GET_VAR(__GLXEW_VERSION_1_1)
-
-#endif /* GLX_VERSION_1_1 */
-
-/* ---------------------------- GLX_VERSION_1_2 ---------------------------- */
-
-#ifndef GLX_VERSION_1_2
-#define GLX_VERSION_1_2 1
-
-typedef Display* ( * PFNGLXGETCURRENTDISPLAYPROC) (void);
-
-#define glXGetCurrentDisplay GLXEW_GET_FUN(__glewXGetCurrentDisplay)
-
-#define GLXEW_VERSION_1_2 GLXEW_GET_VAR(__GLXEW_VERSION_1_2)
-
-#endif /* GLX_VERSION_1_2 */
-
-/* ---------------------------- GLX_VERSION_1_3 ---------------------------- */
-
-#ifndef GLX_VERSION_1_3
-#define GLX_VERSION_1_3 1
-
-#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
-#define GLX_RGBA_BIT 0x00000001
-#define GLX_WINDOW_BIT 0x00000001
-#define GLX_COLOR_INDEX_BIT 0x00000002
-#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
-#define GLX_PIXMAP_BIT 0x00000002
-#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
-#define GLX_PBUFFER_BIT 0x00000004
-#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
-#define GLX_AUX_BUFFERS_BIT 0x00000010
-#define GLX_CONFIG_CAVEAT 0x20
-#define GLX_DEPTH_BUFFER_BIT 0x00000020
-#define GLX_X_VISUAL_TYPE 0x22
-#define GLX_TRANSPARENT_TYPE 0x23
-#define GLX_TRANSPARENT_INDEX_VALUE 0x24
-#define GLX_TRANSPARENT_RED_VALUE 0x25
-#define GLX_TRANSPARENT_GREEN_VALUE 0x26
-#define GLX_TRANSPARENT_BLUE_VALUE 0x27
-#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
-#define GLX_STENCIL_BUFFER_BIT 0x00000040
-#define GLX_ACCUM_BUFFER_BIT 0x00000080
-#define GLX_NONE 0x8000
-#define GLX_SLOW_CONFIG 0x8001
-#define GLX_TRUE_COLOR 0x8002
-#define GLX_DIRECT_COLOR 0x8003
-#define GLX_PSEUDO_COLOR 0x8004
-#define GLX_STATIC_COLOR 0x8005
-#define GLX_GRAY_SCALE 0x8006
-#define GLX_STATIC_GRAY 0x8007
-#define GLX_TRANSPARENT_RGB 0x8008
-#define GLX_TRANSPARENT_INDEX 0x8009
-#define GLX_VISUAL_ID 0x800B
-#define GLX_SCREEN 0x800C
-#define GLX_NON_CONFORMANT_CONFIG 0x800D
-#define GLX_DRAWABLE_TYPE 0x8010
-#define GLX_RENDER_TYPE 0x8011
-#define GLX_X_RENDERABLE 0x8012
-#define GLX_FBCONFIG_ID 0x8013
-#define GLX_RGBA_TYPE 0x8014
-#define GLX_COLOR_INDEX_TYPE 0x8015
-#define GLX_MAX_PBUFFER_WIDTH 0x8016
-#define GLX_MAX_PBUFFER_HEIGHT 0x8017
-#define GLX_MAX_PBUFFER_PIXELS 0x8018
-#define GLX_PRESERVED_CONTENTS 0x801B
-#define GLX_LARGEST_PBUFFER 0x801C
-#define GLX_WIDTH 0x801D
-#define GLX_HEIGHT 0x801E
-#define GLX_EVENT_MASK 0x801F
-#define GLX_DAMAGED 0x8020
-#define GLX_SAVED 0x8021
-#define GLX_WINDOW 0x8022
-#define GLX_PBUFFER 0x8023
-#define GLX_PBUFFER_HEIGHT 0x8040
-#define GLX_PBUFFER_WIDTH 0x8041
-#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
-#define GLX_DONT_CARE 0xFFFFFFFF
-
-typedef XID GLXFBConfigID;
-typedef XID GLXPbuffer;
-typedef XID GLXWindow;
-typedef struct __GLXFBConfigRec *GLXFBConfig;
-
-typedef struct {
- int event_type;
- int draw_type;
- unsigned long serial;
- Bool send_event;
- Display *display;
- GLXDrawable drawable;
- unsigned int buffer_mask;
- unsigned int aux_buffer;
- int x, y;
- int width, height;
- int count;
-} GLXPbufferClobberEvent;
-typedef union __GLXEvent {
- GLXPbufferClobberEvent glxpbufferclobber;
- long pad[24];
-} GLXEvent;
-
-typedef GLXFBConfig* ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
-typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
-typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
-typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
-typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
-typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
-typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
-typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
-typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
-typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
-typedef GLXFBConfig* ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
-typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
-typedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
-typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
-typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
-typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
-typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
-
-#define glXChooseFBConfig GLXEW_GET_FUN(__glewXChooseFBConfig)
-#define glXCreateNewContext GLXEW_GET_FUN(__glewXCreateNewContext)
-#define glXCreatePbuffer GLXEW_GET_FUN(__glewXCreatePbuffer)
-#define glXCreatePixmap GLXEW_GET_FUN(__glewXCreatePixmap)
-#define glXCreateWindow GLXEW_GET_FUN(__glewXCreateWindow)
-#define glXDestroyPbuffer GLXEW_GET_FUN(__glewXDestroyPbuffer)
-#define glXDestroyPixmap GLXEW_GET_FUN(__glewXDestroyPixmap)
-#define glXDestroyWindow GLXEW_GET_FUN(__glewXDestroyWindow)
-#define glXGetCurrentReadDrawable GLXEW_GET_FUN(__glewXGetCurrentReadDrawable)
-#define glXGetFBConfigAttrib GLXEW_GET_FUN(__glewXGetFBConfigAttrib)
-#define glXGetFBConfigs GLXEW_GET_FUN(__glewXGetFBConfigs)
-#define glXGetSelectedEvent GLXEW_GET_FUN(__glewXGetSelectedEvent)
-#define glXGetVisualFromFBConfig GLXEW_GET_FUN(__glewXGetVisualFromFBConfig)
-#define glXMakeContextCurrent GLXEW_GET_FUN(__glewXMakeContextCurrent)
-#define glXQueryContext GLXEW_GET_FUN(__glewXQueryContext)
-#define glXQueryDrawable GLXEW_GET_FUN(__glewXQueryDrawable)
-#define glXSelectEvent GLXEW_GET_FUN(__glewXSelectEvent)
-
-#define GLXEW_VERSION_1_3 GLXEW_GET_VAR(__GLXEW_VERSION_1_3)
-
-#endif /* GLX_VERSION_1_3 */
-
-/* ---------------------------- GLX_VERSION_1_4 ---------------------------- */
-
-#ifndef GLX_VERSION_1_4
-#define GLX_VERSION_1_4 1
-
-#define GLX_SAMPLE_BUFFERS 100000
-#define GLX_SAMPLES 100001
-
-extern void ( * glXGetProcAddress (const GLubyte *procName)) (void);
-
-#define GLXEW_VERSION_1_4 GLXEW_GET_VAR(__GLXEW_VERSION_1_4)
-
-#endif /* GLX_VERSION_1_4 */
-
-/* -------------------------- GLX_3DFX_multisample ------------------------- */
-
-#ifndef GLX_3DFX_multisample
-#define GLX_3DFX_multisample 1
-
-#define GLX_SAMPLE_BUFFERS_3DFX 0x8050
-#define GLX_SAMPLES_3DFX 0x8051
-
-#define GLXEW_3DFX_multisample GLXEW_GET_VAR(__GLXEW_3DFX_multisample)
-
-#endif /* GLX_3DFX_multisample */
-
-/* ------------------------ GLX_AMD_gpu_association ------------------------ */
-
-#ifndef GLX_AMD_gpu_association
-#define GLX_AMD_gpu_association 1
-
-#define GLX_GPU_VENDOR_AMD 0x1F00
-#define GLX_GPU_RENDERER_STRING_AMD 0x1F01
-#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
-#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
-#define GLX_GPU_RAM_AMD 0x21A3
-#define GLX_GPU_CLOCK_AMD 0x21A4
-#define GLX_GPU_NUM_PIPES_AMD 0x21A5
-#define GLX_GPU_NUM_SIMD_AMD 0x21A6
-#define GLX_GPU_NUM_RB_AMD 0x21A7
-#define GLX_GPU_NUM_SPI_AMD 0x21A8
-
-typedef void ( * PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC) (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-typedef GLXContext ( * PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC) (unsigned int id, GLXContext share_list);
-typedef GLXContext ( * PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (unsigned int id, GLXContext share_context, const int* attribList);
-typedef Bool ( * PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC) (GLXContext ctx);
-typedef unsigned int ( * PFNGLXGETCONTEXTGPUIDAMDPROC) (GLXContext ctx);
-typedef GLXContext ( * PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
-typedef unsigned int ( * PFNGLXGETGPUIDSAMDPROC) (unsigned int maxCount, unsigned int* ids);
-typedef int ( * PFNGLXGETGPUINFOAMDPROC) (unsigned int id, int property, GLenum dataType, unsigned int size, void* data);
-typedef Bool ( * PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx);
-
-#define glXBlitContextFramebufferAMD GLXEW_GET_FUN(__glewXBlitContextFramebufferAMD)
-#define glXCreateAssociatedContextAMD GLXEW_GET_FUN(__glewXCreateAssociatedContextAMD)
-#define glXCreateAssociatedContextAttribsAMD GLXEW_GET_FUN(__glewXCreateAssociatedContextAttribsAMD)
-#define glXDeleteAssociatedContextAMD GLXEW_GET_FUN(__glewXDeleteAssociatedContextAMD)
-#define glXGetContextGPUIDAMD GLXEW_GET_FUN(__glewXGetContextGPUIDAMD)
-#define glXGetCurrentAssociatedContextAMD GLXEW_GET_FUN(__glewXGetCurrentAssociatedContextAMD)
-#define glXGetGPUIDsAMD GLXEW_GET_FUN(__glewXGetGPUIDsAMD)
-#define glXGetGPUInfoAMD GLXEW_GET_FUN(__glewXGetGPUInfoAMD)
-#define glXMakeAssociatedContextCurrentAMD GLXEW_GET_FUN(__glewXMakeAssociatedContextCurrentAMD)
-
-#define GLXEW_AMD_gpu_association GLXEW_GET_VAR(__GLXEW_AMD_gpu_association)
-
-#endif /* GLX_AMD_gpu_association */
-
-/* --------------------- GLX_ARB_context_flush_control --------------------- */
-
-#ifndef GLX_ARB_context_flush_control
-#define GLX_ARB_context_flush_control 1
-
-#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0x0000
-#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
-#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
-
-#define GLXEW_ARB_context_flush_control GLXEW_GET_VAR(__GLXEW_ARB_context_flush_control)
-
-#endif /* GLX_ARB_context_flush_control */
-
-/* ------------------------- GLX_ARB_create_context ------------------------ */
-
-#ifndef GLX_ARB_create_context
-#define GLX_ARB_create_context 1
-
-#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001
-#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
-#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
-#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
-#define GLX_CONTEXT_FLAGS_ARB 0x2094
-
-typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display* dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
-
-#define glXCreateContextAttribsARB GLXEW_GET_FUN(__glewXCreateContextAttribsARB)
-
-#define GLXEW_ARB_create_context GLXEW_GET_VAR(__GLXEW_ARB_create_context)
-
-#endif /* GLX_ARB_create_context */
-
-/* --------------------- GLX_ARB_create_context_profile -------------------- */
-
-#ifndef GLX_ARB_create_context_profile
-#define GLX_ARB_create_context_profile 1
-
-#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
-#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
-#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
-
-#define GLXEW_ARB_create_context_profile GLXEW_GET_VAR(__GLXEW_ARB_create_context_profile)
-
-#endif /* GLX_ARB_create_context_profile */
-
-/* ------------------- GLX_ARB_create_context_robustness ------------------- */
-
-#ifndef GLX_ARB_create_context_robustness
-#define GLX_ARB_create_context_robustness 1
-
-#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
-#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252
-#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
-#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261
-
-#define GLXEW_ARB_create_context_robustness GLXEW_GET_VAR(__GLXEW_ARB_create_context_robustness)
-
-#endif /* GLX_ARB_create_context_robustness */
-
-/* ------------------------- GLX_ARB_fbconfig_float ------------------------ */
-
-#ifndef GLX_ARB_fbconfig_float
-#define GLX_ARB_fbconfig_float 1
-
-#define GLX_RGBA_FLOAT_BIT 0x00000004
-#define GLX_RGBA_FLOAT_TYPE 0x20B9
-
-#define GLXEW_ARB_fbconfig_float GLXEW_GET_VAR(__GLXEW_ARB_fbconfig_float)
-
-#endif /* GLX_ARB_fbconfig_float */
-
-/* ------------------------ GLX_ARB_framebuffer_sRGB ----------------------- */
-
-#ifndef GLX_ARB_framebuffer_sRGB
-#define GLX_ARB_framebuffer_sRGB 1
-
-#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2
-
-#define GLXEW_ARB_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_ARB_framebuffer_sRGB)
-
-#endif /* GLX_ARB_framebuffer_sRGB */
-
-/* ------------------------ GLX_ARB_get_proc_address ----------------------- */
-
-#ifndef GLX_ARB_get_proc_address
-#define GLX_ARB_get_proc_address 1
-
-extern void ( * glXGetProcAddressARB (const GLubyte *procName)) (void);
-
-#define GLXEW_ARB_get_proc_address GLXEW_GET_VAR(__GLXEW_ARB_get_proc_address)
-
-#endif /* GLX_ARB_get_proc_address */
-
-/* -------------------------- GLX_ARB_multisample -------------------------- */
-
-#ifndef GLX_ARB_multisample
-#define GLX_ARB_multisample 1
-
-#define GLX_SAMPLE_BUFFERS_ARB 100000
-#define GLX_SAMPLES_ARB 100001
-
-#define GLXEW_ARB_multisample GLXEW_GET_VAR(__GLXEW_ARB_multisample)
-
-#endif /* GLX_ARB_multisample */
-
-/* ---------------- GLX_ARB_robustness_application_isolation --------------- */
-
-#ifndef GLX_ARB_robustness_application_isolation
-#define GLX_ARB_robustness_application_isolation 1
-
-#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
-
-#define GLXEW_ARB_robustness_application_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_application_isolation)
-
-#endif /* GLX_ARB_robustness_application_isolation */
-
-/* ---------------- GLX_ARB_robustness_share_group_isolation --------------- */
-
-#ifndef GLX_ARB_robustness_share_group_isolation
-#define GLX_ARB_robustness_share_group_isolation 1
-
-#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
-
-#define GLXEW_ARB_robustness_share_group_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_share_group_isolation)
-
-#endif /* GLX_ARB_robustness_share_group_isolation */
-
-/* ---------------------- GLX_ARB_vertex_buffer_object --------------------- */
-
-#ifndef GLX_ARB_vertex_buffer_object
-#define GLX_ARB_vertex_buffer_object 1
-
-#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095
-
-#define GLXEW_ARB_vertex_buffer_object GLXEW_GET_VAR(__GLXEW_ARB_vertex_buffer_object)
-
-#endif /* GLX_ARB_vertex_buffer_object */
-
-/* ----------------------- GLX_ATI_pixel_format_float ---------------------- */
-
-#ifndef GLX_ATI_pixel_format_float
-#define GLX_ATI_pixel_format_float 1
-
-#define GLX_RGBA_FLOAT_ATI_BIT 0x00000100
-
-#define GLXEW_ATI_pixel_format_float GLXEW_GET_VAR(__GLXEW_ATI_pixel_format_float)
-
-#endif /* GLX_ATI_pixel_format_float */
-
-/* ------------------------- GLX_ATI_render_texture ------------------------ */
-
-#ifndef GLX_ATI_render_texture
-#define GLX_ATI_render_texture 1
-
-#define GLX_BIND_TO_TEXTURE_RGB_ATI 0x9800
-#define GLX_BIND_TO_TEXTURE_RGBA_ATI 0x9801
-#define GLX_TEXTURE_FORMAT_ATI 0x9802
-#define GLX_TEXTURE_TARGET_ATI 0x9803
-#define GLX_MIPMAP_TEXTURE_ATI 0x9804
-#define GLX_TEXTURE_RGB_ATI 0x9805
-#define GLX_TEXTURE_RGBA_ATI 0x9806
-#define GLX_NO_TEXTURE_ATI 0x9807
-#define GLX_TEXTURE_CUBE_MAP_ATI 0x9808
-#define GLX_TEXTURE_1D_ATI 0x9809
-#define GLX_TEXTURE_2D_ATI 0x980A
-#define GLX_MIPMAP_LEVEL_ATI 0x980B
-#define GLX_CUBE_MAP_FACE_ATI 0x980C
-#define GLX_TEXTURE_CUBE_MAP_POSITIVE_X_ATI 0x980D
-#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_X_ATI 0x980E
-#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Y_ATI 0x980F
-#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Y_ATI 0x9810
-#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Z_ATI 0x9811
-#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Z_ATI 0x9812
-#define GLX_FRONT_LEFT_ATI 0x9813
-#define GLX_FRONT_RIGHT_ATI 0x9814
-#define GLX_BACK_LEFT_ATI 0x9815
-#define GLX_BACK_RIGHT_ATI 0x9816
-#define GLX_AUX0_ATI 0x9817
-#define GLX_AUX1_ATI 0x9818
-#define GLX_AUX2_ATI 0x9819
-#define GLX_AUX3_ATI 0x981A
-#define GLX_AUX4_ATI 0x981B
-#define GLX_AUX5_ATI 0x981C
-#define GLX_AUX6_ATI 0x981D
-#define GLX_AUX7_ATI 0x981E
-#define GLX_AUX8_ATI 0x981F
-#define GLX_AUX9_ATI 0x9820
-#define GLX_BIND_TO_TEXTURE_LUMINANCE_ATI 0x9821
-#define GLX_BIND_TO_TEXTURE_INTENSITY_ATI 0x9822
-
-typedef void ( * PFNGLXBINDTEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer);
-typedef void ( * PFNGLXDRAWABLEATTRIBATIPROC) (Display *dpy, GLXDrawable draw, const int *attrib_list);
-typedef void ( * PFNGLXRELEASETEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer);
-
-#define glXBindTexImageATI GLXEW_GET_FUN(__glewXBindTexImageATI)
-#define glXDrawableAttribATI GLXEW_GET_FUN(__glewXDrawableAttribATI)
-#define glXReleaseTexImageATI GLXEW_GET_FUN(__glewXReleaseTexImageATI)
-
-#define GLXEW_ATI_render_texture GLXEW_GET_VAR(__GLXEW_ATI_render_texture)
-
-#endif /* GLX_ATI_render_texture */
-
-/* --------------------------- GLX_EXT_buffer_age -------------------------- */
-
-#ifndef GLX_EXT_buffer_age
-#define GLX_EXT_buffer_age 1
-
-#define GLX_BACK_BUFFER_AGE_EXT 0x20F4
-
-#define GLXEW_EXT_buffer_age GLXEW_GET_VAR(__GLXEW_EXT_buffer_age)
-
-#endif /* GLX_EXT_buffer_age */
-
-/* ------------------- GLX_EXT_create_context_es2_profile ------------------ */
-
-#ifndef GLX_EXT_create_context_es2_profile
-#define GLX_EXT_create_context_es2_profile 1
-
-#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
-
-#define GLXEW_EXT_create_context_es2_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es2_profile)
-
-#endif /* GLX_EXT_create_context_es2_profile */
-
-/* ------------------- GLX_EXT_create_context_es_profile ------------------- */
-
-#ifndef GLX_EXT_create_context_es_profile
-#define GLX_EXT_create_context_es_profile 1
-
-#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
-
-#define GLXEW_EXT_create_context_es_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es_profile)
-
-#endif /* GLX_EXT_create_context_es_profile */
-
-/* --------------------- GLX_EXT_fbconfig_packed_float --------------------- */
-
-#ifndef GLX_EXT_fbconfig_packed_float
-#define GLX_EXT_fbconfig_packed_float 1
-
-#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008
-#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1
-
-#define GLXEW_EXT_fbconfig_packed_float GLXEW_GET_VAR(__GLXEW_EXT_fbconfig_packed_float)
-
-#endif /* GLX_EXT_fbconfig_packed_float */
-
-/* ------------------------ GLX_EXT_framebuffer_sRGB ----------------------- */
-
-#ifndef GLX_EXT_framebuffer_sRGB
-#define GLX_EXT_framebuffer_sRGB 1
-
-#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2
-
-#define GLXEW_EXT_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_EXT_framebuffer_sRGB)
-
-#endif /* GLX_EXT_framebuffer_sRGB */
-
-/* ------------------------- GLX_EXT_import_context ------------------------ */
-
-#ifndef GLX_EXT_import_context
-#define GLX_EXT_import_context 1
-
-#define GLX_SHARE_CONTEXT_EXT 0x800A
-#define GLX_VISUAL_ID_EXT 0x800B
-#define GLX_SCREEN_EXT 0x800C
-
-typedef XID GLXContextID;
-
-typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display* dpy, GLXContext context);
-typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);
-typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display* dpy, GLXContextID contextID);
-typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display* dpy, GLXContext context, int attribute,int *value);
-
-#define glXFreeContextEXT GLXEW_GET_FUN(__glewXFreeContextEXT)
-#define glXGetContextIDEXT GLXEW_GET_FUN(__glewXGetContextIDEXT)
-#define glXImportContextEXT GLXEW_GET_FUN(__glewXImportContextEXT)
-#define glXQueryContextInfoEXT GLXEW_GET_FUN(__glewXQueryContextInfoEXT)
-
-#define GLXEW_EXT_import_context GLXEW_GET_VAR(__GLXEW_EXT_import_context)
-
-#endif /* GLX_EXT_import_context */
-
-/* -------------------------- GLX_EXT_scene_marker ------------------------- */
-
-#ifndef GLX_EXT_scene_marker
-#define GLX_EXT_scene_marker 1
-
-#define GLXEW_EXT_scene_marker GLXEW_GET_VAR(__GLXEW_EXT_scene_marker)
-
-#endif /* GLX_EXT_scene_marker */
-
-/* -------------------------- GLX_EXT_stereo_tree -------------------------- */
-
-#ifndef GLX_EXT_stereo_tree
-#define GLX_EXT_stereo_tree 1
-
-#define GLX_STEREO_NOTIFY_EXT 0x00000000
-#define GLX_STEREO_NOTIFY_MASK_EXT 0x00000001
-#define GLX_STEREO_TREE_EXT 0x20F5
-
-#define GLXEW_EXT_stereo_tree GLXEW_GET_VAR(__GLXEW_EXT_stereo_tree)
-
-#endif /* GLX_EXT_stereo_tree */
-
-/* -------------------------- GLX_EXT_swap_control ------------------------- */
-
-#ifndef GLX_EXT_swap_control
-#define GLX_EXT_swap_control 1
-
-#define GLX_SWAP_INTERVAL_EXT 0x20F1
-#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
-
-typedef void ( * PFNGLXSWAPINTERVALEXTPROC) (Display* dpy, GLXDrawable drawable, int interval);
-
-#define glXSwapIntervalEXT GLXEW_GET_FUN(__glewXSwapIntervalEXT)
-
-#define GLXEW_EXT_swap_control GLXEW_GET_VAR(__GLXEW_EXT_swap_control)
-
-#endif /* GLX_EXT_swap_control */
-
-/* ----------------------- GLX_EXT_swap_control_tear ----------------------- */
-
-#ifndef GLX_EXT_swap_control_tear
-#define GLX_EXT_swap_control_tear 1
-
-#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3
-
-#define GLXEW_EXT_swap_control_tear GLXEW_GET_VAR(__GLXEW_EXT_swap_control_tear)
-
-#endif /* GLX_EXT_swap_control_tear */
-
-/* ---------------------- GLX_EXT_texture_from_pixmap ---------------------- */
-
-#ifndef GLX_EXT_texture_from_pixmap
-#define GLX_EXT_texture_from_pixmap 1
-
-#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
-#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
-#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
-#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
-#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
-#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
-#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
-#define GLX_Y_INVERTED_EXT 0x20D4
-#define GLX_TEXTURE_FORMAT_EXT 0x20D5
-#define GLX_TEXTURE_TARGET_EXT 0x20D6
-#define GLX_MIPMAP_TEXTURE_EXT 0x20D7
-#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
-#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
-#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
-#define GLX_TEXTURE_1D_EXT 0x20DB
-#define GLX_TEXTURE_2D_EXT 0x20DC
-#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD
-#define GLX_FRONT_LEFT_EXT 0x20DE
-#define GLX_FRONT_RIGHT_EXT 0x20DF
-#define GLX_BACK_LEFT_EXT 0x20E0
-#define GLX_BACK_RIGHT_EXT 0x20E1
-#define GLX_AUX0_EXT 0x20E2
-#define GLX_AUX1_EXT 0x20E3
-#define GLX_AUX2_EXT 0x20E4
-#define GLX_AUX3_EXT 0x20E5
-#define GLX_AUX4_EXT 0x20E6
-#define GLX_AUX5_EXT 0x20E7
-#define GLX_AUX6_EXT 0x20E8
-#define GLX_AUX7_EXT 0x20E9
-#define GLX_AUX8_EXT 0x20EA
-#define GLX_AUX9_EXT 0x20EB
-
-typedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer, const int *attrib_list);
-typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer);
-
-#define glXBindTexImageEXT GLXEW_GET_FUN(__glewXBindTexImageEXT)
-#define glXReleaseTexImageEXT GLXEW_GET_FUN(__glewXReleaseTexImageEXT)
-
-#define GLXEW_EXT_texture_from_pixmap GLXEW_GET_VAR(__GLXEW_EXT_texture_from_pixmap)
-
-#endif /* GLX_EXT_texture_from_pixmap */
-
-/* -------------------------- GLX_EXT_visual_info -------------------------- */
-
-#ifndef GLX_EXT_visual_info
-#define GLX_EXT_visual_info 1
-
-#define GLX_X_VISUAL_TYPE_EXT 0x22
-#define GLX_TRANSPARENT_TYPE_EXT 0x23
-#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
-#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
-#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
-#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
-#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
-#define GLX_NONE_EXT 0x8000
-#define GLX_TRUE_COLOR_EXT 0x8002
-#define GLX_DIRECT_COLOR_EXT 0x8003
-#define GLX_PSEUDO_COLOR_EXT 0x8004
-#define GLX_STATIC_COLOR_EXT 0x8005
-#define GLX_GRAY_SCALE_EXT 0x8006
-#define GLX_STATIC_GRAY_EXT 0x8007
-#define GLX_TRANSPARENT_RGB_EXT 0x8008
-#define GLX_TRANSPARENT_INDEX_EXT 0x8009
-
-#define GLXEW_EXT_visual_info GLXEW_GET_VAR(__GLXEW_EXT_visual_info)
-
-#endif /* GLX_EXT_visual_info */
-
-/* ------------------------- GLX_EXT_visual_rating ------------------------- */
-
-#ifndef GLX_EXT_visual_rating
-#define GLX_EXT_visual_rating 1
-
-#define GLX_VISUAL_CAVEAT_EXT 0x20
-#define GLX_SLOW_VISUAL_EXT 0x8001
-#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
-
-#define GLXEW_EXT_visual_rating GLXEW_GET_VAR(__GLXEW_EXT_visual_rating)
-
-#endif /* GLX_EXT_visual_rating */
-
-/* -------------------------- GLX_INTEL_swap_event ------------------------- */
-
-#ifndef GLX_INTEL_swap_event
-#define GLX_INTEL_swap_event 1
-
-#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180
-#define GLX_COPY_COMPLETE_INTEL 0x8181
-#define GLX_FLIP_COMPLETE_INTEL 0x8182
-#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000
-
-#define GLXEW_INTEL_swap_event GLXEW_GET_VAR(__GLXEW_INTEL_swap_event)
-
-#endif /* GLX_INTEL_swap_event */
-
-/* -------------------------- GLX_MESA_agp_offset -------------------------- */
-
-#ifndef GLX_MESA_agp_offset
-#define GLX_MESA_agp_offset 1
-
-typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void* pointer);
-
-#define glXGetAGPOffsetMESA GLXEW_GET_FUN(__glewXGetAGPOffsetMESA)
-
-#define GLXEW_MESA_agp_offset GLXEW_GET_VAR(__GLXEW_MESA_agp_offset)
-
-#endif /* GLX_MESA_agp_offset */
-
-/* ------------------------ GLX_MESA_copy_sub_buffer ----------------------- */
-
-#ifndef GLX_MESA_copy_sub_buffer
-#define GLX_MESA_copy_sub_buffer 1
-
-typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display* dpy, GLXDrawable drawable, int x, int y, int width, int height);
-
-#define glXCopySubBufferMESA GLXEW_GET_FUN(__glewXCopySubBufferMESA)
-
-#define GLXEW_MESA_copy_sub_buffer GLXEW_GET_VAR(__GLXEW_MESA_copy_sub_buffer)
-
-#endif /* GLX_MESA_copy_sub_buffer */
-
-/* ------------------------ GLX_MESA_pixmap_colormap ----------------------- */
-
-#ifndef GLX_MESA_pixmap_colormap
-#define GLX_MESA_pixmap_colormap 1
-
-typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display* dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
-
-#define glXCreateGLXPixmapMESA GLXEW_GET_FUN(__glewXCreateGLXPixmapMESA)
-
-#define GLXEW_MESA_pixmap_colormap GLXEW_GET_VAR(__GLXEW_MESA_pixmap_colormap)
-
-#endif /* GLX_MESA_pixmap_colormap */
-
-/* ------------------------ GLX_MESA_query_renderer ------------------------ */
-
-#ifndef GLX_MESA_query_renderer
-#define GLX_MESA_query_renderer 1
-
-#define GLX_RENDERER_VENDOR_ID_MESA 0x8183
-#define GLX_RENDERER_DEVICE_ID_MESA 0x8184
-#define GLX_RENDERER_VERSION_MESA 0x8185
-#define GLX_RENDERER_ACCELERATED_MESA 0x8186
-#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187
-#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188
-#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189
-#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A
-#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B
-#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C
-#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D
-#define GLX_RENDERER_ID_MESA 0x818E
-
-typedef Bool ( * PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int* value);
-typedef const char* ( * PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC) (int attribute);
-typedef Bool ( * PFNGLXQUERYRENDERERINTEGERMESAPROC) (Display* dpy, int screen, int renderer, int attribute, unsigned int *value);
-typedef const char* ( * PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display *dpy, int screen, int renderer, int attribute);
-
-#define glXQueryCurrentRendererIntegerMESA GLXEW_GET_FUN(__glewXQueryCurrentRendererIntegerMESA)
-#define glXQueryCurrentRendererStringMESA GLXEW_GET_FUN(__glewXQueryCurrentRendererStringMESA)
-#define glXQueryRendererIntegerMESA GLXEW_GET_FUN(__glewXQueryRendererIntegerMESA)
-#define glXQueryRendererStringMESA GLXEW_GET_FUN(__glewXQueryRendererStringMESA)
-
-#define GLXEW_MESA_query_renderer GLXEW_GET_VAR(__GLXEW_MESA_query_renderer)
-
-#endif /* GLX_MESA_query_renderer */
-
-/* ------------------------ GLX_MESA_release_buffers ----------------------- */
-
-#ifndef GLX_MESA_release_buffers
-#define GLX_MESA_release_buffers 1
-
-typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display* dpy, GLXDrawable d);
-
-#define glXReleaseBuffersMESA GLXEW_GET_FUN(__glewXReleaseBuffersMESA)
-
-#define GLXEW_MESA_release_buffers GLXEW_GET_VAR(__GLXEW_MESA_release_buffers)
-
-#endif /* GLX_MESA_release_buffers */
-
-/* ------------------------- GLX_MESA_set_3dfx_mode ------------------------ */
-
-#ifndef GLX_MESA_set_3dfx_mode
-#define GLX_MESA_set_3dfx_mode 1
-
-#define GLX_3DFX_WINDOW_MODE_MESA 0x1
-#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
-
-typedef GLboolean ( * PFNGLXSET3DFXMODEMESAPROC) (GLint mode);
-
-#define glXSet3DfxModeMESA GLXEW_GET_FUN(__glewXSet3DfxModeMESA)
-
-#define GLXEW_MESA_set_3dfx_mode GLXEW_GET_VAR(__GLXEW_MESA_set_3dfx_mode)
-
-#endif /* GLX_MESA_set_3dfx_mode */
-
-/* ------------------------- GLX_MESA_swap_control ------------------------- */
-
-#ifndef GLX_MESA_swap_control
-#define GLX_MESA_swap_control 1
-
-typedef int ( * PFNGLXGETSWAPINTERVALMESAPROC) (void);
-typedef int ( * PFNGLXSWAPINTERVALMESAPROC) (unsigned int interval);
-
-#define glXGetSwapIntervalMESA GLXEW_GET_FUN(__glewXGetSwapIntervalMESA)
-#define glXSwapIntervalMESA GLXEW_GET_FUN(__glewXSwapIntervalMESA)
-
-#define GLXEW_MESA_swap_control GLXEW_GET_VAR(__GLXEW_MESA_swap_control)
-
-#endif /* GLX_MESA_swap_control */
-
-/* --------------------------- GLX_NV_copy_buffer -------------------------- */
-
-#ifndef GLX_NV_copy_buffer
-#define GLX_NV_copy_buffer 1
-
-typedef void ( * PFNGLXCOPYBUFFERSUBDATANVPROC) (Display* dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-typedef void ( * PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display* dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-
-#define glXCopyBufferSubDataNV GLXEW_GET_FUN(__glewXCopyBufferSubDataNV)
-#define glXNamedCopyBufferSubDataNV GLXEW_GET_FUN(__glewXNamedCopyBufferSubDataNV)
-
-#define GLXEW_NV_copy_buffer GLXEW_GET_VAR(__GLXEW_NV_copy_buffer)
-
-#endif /* GLX_NV_copy_buffer */
-
-/* --------------------------- GLX_NV_copy_image --------------------------- */
-
-#ifndef GLX_NV_copy_image
-#define GLX_NV_copy_image 1
-
-typedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
-
-#define glXCopyImageSubDataNV GLXEW_GET_FUN(__glewXCopyImageSubDataNV)
-
-#define GLXEW_NV_copy_image GLXEW_GET_VAR(__GLXEW_NV_copy_image)
-
-#endif /* GLX_NV_copy_image */
-
-/* ------------------------ GLX_NV_delay_before_swap ----------------------- */
-
-#ifndef GLX_NV_delay_before_swap
-#define GLX_NV_delay_before_swap 1
-
-typedef Bool ( * PFNGLXDELAYBEFORESWAPNVPROC) (Display* dpy, GLXDrawable drawable, GLfloat seconds);
-
-#define glXDelayBeforeSwapNV GLXEW_GET_FUN(__glewXDelayBeforeSwapNV)
-
-#define GLXEW_NV_delay_before_swap GLXEW_GET_VAR(__GLXEW_NV_delay_before_swap)
-
-#endif /* GLX_NV_delay_before_swap */
-
-/* -------------------------- GLX_NV_float_buffer -------------------------- */
-
-#ifndef GLX_NV_float_buffer
-#define GLX_NV_float_buffer 1
-
-#define GLX_FLOAT_COMPONENTS_NV 0x20B0
-
-#define GLXEW_NV_float_buffer GLXEW_GET_VAR(__GLXEW_NV_float_buffer)
-
-#endif /* GLX_NV_float_buffer */
-
-/* ---------------------- GLX_NV_multisample_coverage ---------------------- */
-
-#ifndef GLX_NV_multisample_coverage
-#define GLX_NV_multisample_coverage 1
-
-#define GLX_COLOR_SAMPLES_NV 0x20B3
-#define GLX_COVERAGE_SAMPLES_NV 100001
-
-#define GLXEW_NV_multisample_coverage GLXEW_GET_VAR(__GLXEW_NV_multisample_coverage)
-
-#endif /* GLX_NV_multisample_coverage */
-
-/* -------------------------- GLX_NV_present_video ------------------------- */
-
-#ifndef GLX_NV_present_video
-#define GLX_NV_present_video 1
-
-#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0
-
-typedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display* dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
-typedef unsigned int* ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);
-
-#define glXBindVideoDeviceNV GLXEW_GET_FUN(__glewXBindVideoDeviceNV)
-#define glXEnumerateVideoDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoDevicesNV)
-
-#define GLXEW_NV_present_video GLXEW_GET_VAR(__GLXEW_NV_present_video)
-
-#endif /* GLX_NV_present_video */
-
-/* --------------------------- GLX_NV_swap_group --------------------------- */
-
-#ifndef GLX_NV_swap_group
-#define GLX_NV_swap_group 1
-
-typedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display* dpy, GLuint group, GLuint barrier);
-typedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint group);
-typedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display* dpy, int screen, GLuint *count);
-typedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display* dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
-typedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
-typedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display* dpy, int screen);
-
-#define glXBindSwapBarrierNV GLXEW_GET_FUN(__glewXBindSwapBarrierNV)
-#define glXJoinSwapGroupNV GLXEW_GET_FUN(__glewXJoinSwapGroupNV)
-#define glXQueryFrameCountNV GLXEW_GET_FUN(__glewXQueryFrameCountNV)
-#define glXQueryMaxSwapGroupsNV GLXEW_GET_FUN(__glewXQueryMaxSwapGroupsNV)
-#define glXQuerySwapGroupNV GLXEW_GET_FUN(__glewXQuerySwapGroupNV)
-#define glXResetFrameCountNV GLXEW_GET_FUN(__glewXResetFrameCountNV)
-
-#define GLXEW_NV_swap_group GLXEW_GET_VAR(__GLXEW_NV_swap_group)
-
-#endif /* GLX_NV_swap_group */
-
-/* ----------------------- GLX_NV_vertex_array_range ----------------------- */
-
-#ifndef GLX_NV_vertex_array_range
-#define GLX_NV_vertex_array_range 1
-
-typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);
-typedef void ( * PFNGLXFREEMEMORYNVPROC) (void *pointer);
-
-#define glXAllocateMemoryNV GLXEW_GET_FUN(__glewXAllocateMemoryNV)
-#define glXFreeMemoryNV GLXEW_GET_FUN(__glewXFreeMemoryNV)
-
-#define GLXEW_NV_vertex_array_range GLXEW_GET_VAR(__GLXEW_NV_vertex_array_range)
-
-#endif /* GLX_NV_vertex_array_range */
-
-/* -------------------------- GLX_NV_video_capture ------------------------- */
-
-#ifndef GLX_NV_video_capture
-#define GLX_NV_video_capture 1
-
-#define GLX_DEVICE_ID_NV 0x20CD
-#define GLX_UNIQUE_ID_NV 0x20CE
-#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
-
-typedef XID GLXVideoCaptureDeviceNV;
-
-typedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display* dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
-typedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display* dpy, int screen, int *nelements);
-typedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device);
-typedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
-typedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device);
-
-#define glXBindVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXBindVideoCaptureDeviceNV)
-#define glXEnumerateVideoCaptureDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoCaptureDevicesNV)
-#define glXLockVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXLockVideoCaptureDeviceNV)
-#define glXQueryVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXQueryVideoCaptureDeviceNV)
-#define glXReleaseVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoCaptureDeviceNV)
-
-#define GLXEW_NV_video_capture GLXEW_GET_VAR(__GLXEW_NV_video_capture)
-
-#endif /* GLX_NV_video_capture */
-
-/* ---------------------------- GLX_NV_video_out --------------------------- */
-
-#ifndef GLX_NV_video_out
-#define GLX_NV_video_out 1
-
-#define GLX_VIDEO_OUT_COLOR_NV 0x20C3
-#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4
-#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5
-#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
-#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
-#define GLX_VIDEO_OUT_FRAME_NV 0x20C8
-#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9
-#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA
-#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB
-#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC
-
-typedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display* dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
-typedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display* dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
-typedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
-typedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice);
-typedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display* dpy, GLXPbuffer pbuf);
-typedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display* dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
-
-#define glXBindVideoImageNV GLXEW_GET_FUN(__glewXBindVideoImageNV)
-#define glXGetVideoDeviceNV GLXEW_GET_FUN(__glewXGetVideoDeviceNV)
-#define glXGetVideoInfoNV GLXEW_GET_FUN(__glewXGetVideoInfoNV)
-#define glXReleaseVideoDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoDeviceNV)
-#define glXReleaseVideoImageNV GLXEW_GET_FUN(__glewXReleaseVideoImageNV)
-#define glXSendPbufferToVideoNV GLXEW_GET_FUN(__glewXSendPbufferToVideoNV)
-
-#define GLXEW_NV_video_out GLXEW_GET_VAR(__GLXEW_NV_video_out)
-
-#endif /* GLX_NV_video_out */
-
-/* -------------------------- GLX_OML_swap_method -------------------------- */
-
-#ifndef GLX_OML_swap_method
-#define GLX_OML_swap_method 1
-
-#define GLX_SWAP_METHOD_OML 0x8060
-#define GLX_SWAP_EXCHANGE_OML 0x8061
-#define GLX_SWAP_COPY_OML 0x8062
-#define GLX_SWAP_UNDEFINED_OML 0x8063
-
-#define GLXEW_OML_swap_method GLXEW_GET_VAR(__GLXEW_OML_swap_method)
-
-#endif /* GLX_OML_swap_method */
-
-/* -------------------------- GLX_OML_sync_control ------------------------- */
-
-#ifndef GLX_OML_sync_control
-#define GLX_OML_sync_control 1
-
-typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display* dpy, GLXDrawable drawable, int32_t* numerator, int32_t* denominator);
-typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, int64_t* sbc);
-typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
-typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t* ust, int64_t* msc, int64_t* sbc);
-typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_sbc, int64_t* ust, int64_t* msc, int64_t* sbc);
-
-#define glXGetMscRateOML GLXEW_GET_FUN(__glewXGetMscRateOML)
-#define glXGetSyncValuesOML GLXEW_GET_FUN(__glewXGetSyncValuesOML)
-#define glXSwapBuffersMscOML GLXEW_GET_FUN(__glewXSwapBuffersMscOML)
-#define glXWaitForMscOML GLXEW_GET_FUN(__glewXWaitForMscOML)
-#define glXWaitForSbcOML GLXEW_GET_FUN(__glewXWaitForSbcOML)
-
-#define GLXEW_OML_sync_control GLXEW_GET_VAR(__GLXEW_OML_sync_control)
-
-#endif /* GLX_OML_sync_control */
-
-/* ------------------------ GLX_SGIS_blended_overlay ----------------------- */
-
-#ifndef GLX_SGIS_blended_overlay
-#define GLX_SGIS_blended_overlay 1
-
-#define GLX_BLENDED_RGBA_SGIS 0x8025
-
-#define GLXEW_SGIS_blended_overlay GLXEW_GET_VAR(__GLXEW_SGIS_blended_overlay)
-
-#endif /* GLX_SGIS_blended_overlay */
-
-/* -------------------------- GLX_SGIS_color_range ------------------------- */
-
-#ifndef GLX_SGIS_color_range
-#define GLX_SGIS_color_range 1
-
-#define GLXEW_SGIS_color_range GLXEW_GET_VAR(__GLXEW_SGIS_color_range)
-
-#endif /* GLX_SGIS_color_range */
-
-/* -------------------------- GLX_SGIS_multisample ------------------------- */
-
-#ifndef GLX_SGIS_multisample
-#define GLX_SGIS_multisample 1
-
-#define GLX_SAMPLE_BUFFERS_SGIS 100000
-#define GLX_SAMPLES_SGIS 100001
-
-#define GLXEW_SGIS_multisample GLXEW_GET_VAR(__GLXEW_SGIS_multisample)
-
-#endif /* GLX_SGIS_multisample */
-
-/* ---------------------- GLX_SGIS_shared_multisample ---------------------- */
-
-#ifndef GLX_SGIS_shared_multisample
-#define GLX_SGIS_shared_multisample 1
-
-#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026
-#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027
-
-#define GLXEW_SGIS_shared_multisample GLXEW_GET_VAR(__GLXEW_SGIS_shared_multisample)
-
-#endif /* GLX_SGIS_shared_multisample */
-
-/* --------------------------- GLX_SGIX_fbconfig --------------------------- */
-
-#ifndef GLX_SGIX_fbconfig
-#define GLX_SGIX_fbconfig 1
-
-#define GLX_RGBA_BIT_SGIX 0x00000001
-#define GLX_WINDOW_BIT_SGIX 0x00000001
-#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002
-#define GLX_PIXMAP_BIT_SGIX 0x00000002
-#define GLX_SCREEN_EXT 0x800C
-#define GLX_DRAWABLE_TYPE_SGIX 0x8010
-#define GLX_RENDER_TYPE_SGIX 0x8011
-#define GLX_X_RENDERABLE_SGIX 0x8012
-#define GLX_FBCONFIG_ID_SGIX 0x8013
-#define GLX_RGBA_TYPE_SGIX 0x8014
-#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015
-
-typedef XID GLXFBConfigIDSGIX;
-typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
-
-typedef GLXFBConfigSGIX* ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
-typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
-typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, Pixmap pixmap);
-typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, int attribute, int *value);
-typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display* dpy, XVisualInfo *vis);
-typedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfig config);
-
-#define glXChooseFBConfigSGIX GLXEW_GET_FUN(__glewXChooseFBConfigSGIX)
-#define glXCreateContextWithConfigSGIX GLXEW_GET_FUN(__glewXCreateContextWithConfigSGIX)
-#define glXCreateGLXPixmapWithConfigSGIX GLXEW_GET_FUN(__glewXCreateGLXPixmapWithConfigSGIX)
-#define glXGetFBConfigAttribSGIX GLXEW_GET_FUN(__glewXGetFBConfigAttribSGIX)
-#define glXGetFBConfigFromVisualSGIX GLXEW_GET_FUN(__glewXGetFBConfigFromVisualSGIX)
-#define glXGetVisualFromFBConfigSGIX GLXEW_GET_FUN(__glewXGetVisualFromFBConfigSGIX)
-
-#define GLXEW_SGIX_fbconfig GLXEW_GET_VAR(__GLXEW_SGIX_fbconfig)
-
-#endif /* GLX_SGIX_fbconfig */
-
-/* --------------------------- GLX_SGIX_hyperpipe -------------------------- */
-
-#ifndef GLX_SGIX_hyperpipe
-#define GLX_SGIX_hyperpipe 1
-
-#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001
-#define GLX_PIPE_RECT_SGIX 0x00000001
-#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002
-#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002
-#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003
-#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004
-#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80
-#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91
-#define GLX_BAD_HYPERPIPE_SGIX 92
-#define GLX_HYPERPIPE_ID_SGIX 0x8030
-
-typedef struct {
- char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX];
- int networkId;
-} GLXHyperpipeNetworkSGIX;
-typedef struct {
- char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX];
- int XOrigin;
- int YOrigin;
- int maxHeight;
- int maxWidth;
-} GLXPipeRectLimits;
-typedef struct {
- char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX];
- int channel;
- unsigned int participationType;
- int timeSlice;
-} GLXHyperpipeConfigSGIX;
-typedef struct {
- char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX];
- int srcXOrigin;
- int srcYOrigin;
- int srcWidth;
- int srcHeight;
- int destXOrigin;
- int destYOrigin;
- int destWidth;
- int destHeight;
-} GLXPipeRect;
-
-typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId);
-typedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId);
-typedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
-typedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
-typedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
-typedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
-typedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes);
-typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes);
-
-#define glXBindHyperpipeSGIX GLXEW_GET_FUN(__glewXBindHyperpipeSGIX)
-#define glXDestroyHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXDestroyHyperpipeConfigSGIX)
-#define glXHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXHyperpipeAttribSGIX)
-#define glXHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXHyperpipeConfigSGIX)
-#define glXQueryHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeAttribSGIX)
-#define glXQueryHyperpipeBestAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeBestAttribSGIX)
-#define glXQueryHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeConfigSGIX)
-#define glXQueryHyperpipeNetworkSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeNetworkSGIX)
-
-#define GLXEW_SGIX_hyperpipe GLXEW_GET_VAR(__GLXEW_SGIX_hyperpipe)
-
-#endif /* GLX_SGIX_hyperpipe */
-
-/* ---------------------------- GLX_SGIX_pbuffer --------------------------- */
-
-#ifndef GLX_SGIX_pbuffer
-#define GLX_SGIX_pbuffer 1
-
-#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001
-#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002
-#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004
-#define GLX_PBUFFER_BIT_SGIX 0x00000004
-#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008
-#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010
-#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020
-#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040
-#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080
-#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100
-#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016
-#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017
-#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018
-#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019
-#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A
-#define GLX_PRESERVED_CONTENTS_SGIX 0x801B
-#define GLX_LARGEST_PBUFFER_SGIX 0x801C
-#define GLX_WIDTH_SGIX 0x801D
-#define GLX_HEIGHT_SGIX 0x801E
-#define GLX_EVENT_MASK_SGIX 0x801F
-#define GLX_DAMAGED_SGIX 0x8020
-#define GLX_SAVED_SGIX 0x8021
-#define GLX_WINDOW_SGIX 0x8022
-#define GLX_PBUFFER_SGIX 0x8023
-#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000
-
-typedef XID GLXPbufferSGIX;
-typedef struct { int type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; int event_type; int draw_type; unsigned int mask; int x, y; int width, height; int count; } GLXBufferClobberEventSGIX;
-
-typedef GLXPbuffer ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display* dpy, GLXFBConfig config, unsigned int width, unsigned int height, int *attrib_list);
-typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf);
-typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long *mask);
-typedef void ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf, int attribute, unsigned int *value);
-typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long mask);
-
-#define glXCreateGLXPbufferSGIX GLXEW_GET_FUN(__glewXCreateGLXPbufferSGIX)
-#define glXDestroyGLXPbufferSGIX GLXEW_GET_FUN(__glewXDestroyGLXPbufferSGIX)
-#define glXGetSelectedEventSGIX GLXEW_GET_FUN(__glewXGetSelectedEventSGIX)
-#define glXQueryGLXPbufferSGIX GLXEW_GET_FUN(__glewXQueryGLXPbufferSGIX)
-#define glXSelectEventSGIX GLXEW_GET_FUN(__glewXSelectEventSGIX)
-
-#define GLXEW_SGIX_pbuffer GLXEW_GET_VAR(__GLXEW_SGIX_pbuffer)
-
-#endif /* GLX_SGIX_pbuffer */
-
-/* ------------------------- GLX_SGIX_swap_barrier ------------------------- */
-
-#ifndef GLX_SGIX_swap_barrier
-#define GLX_SGIX_swap_barrier 1
-
-typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);
-typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);
-
-#define glXBindSwapBarrierSGIX GLXEW_GET_FUN(__glewXBindSwapBarrierSGIX)
-#define glXQueryMaxSwapBarriersSGIX GLXEW_GET_FUN(__glewXQueryMaxSwapBarriersSGIX)
-
-#define GLXEW_SGIX_swap_barrier GLXEW_GET_VAR(__GLXEW_SGIX_swap_barrier)
-
-#endif /* GLX_SGIX_swap_barrier */
-
-/* -------------------------- GLX_SGIX_swap_group -------------------------- */
-
-#ifndef GLX_SGIX_swap_group
-#define GLX_SGIX_swap_group 1
-
-typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);
-
-#define glXJoinSwapGroupSGIX GLXEW_GET_FUN(__glewXJoinSwapGroupSGIX)
-
-#define GLXEW_SGIX_swap_group GLXEW_GET_VAR(__GLXEW_SGIX_swap_group)
-
-#endif /* GLX_SGIX_swap_group */
-
-/* ------------------------- GLX_SGIX_video_resize ------------------------- */
-
-#ifndef GLX_SGIX_video_resize
-#define GLX_SGIX_video_resize 1
-
-#define GLX_SYNC_FRAME_SGIX 0x00000000
-#define GLX_SYNC_SWAP_SGIX 0x00000001
-
-typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display* display, int screen, int channel, Window window);
-typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int x, int y, int w, int h);
-typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display* display, int screen, int channel, GLenum synctype);
-typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display* display, int screen, int channel, int *x, int *y, int *w, int *h);
-typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
-
-#define glXBindChannelToWindowSGIX GLXEW_GET_FUN(__glewXBindChannelToWindowSGIX)
-#define glXChannelRectSGIX GLXEW_GET_FUN(__glewXChannelRectSGIX)
-#define glXChannelRectSyncSGIX GLXEW_GET_FUN(__glewXChannelRectSyncSGIX)
-#define glXQueryChannelDeltasSGIX GLXEW_GET_FUN(__glewXQueryChannelDeltasSGIX)
-#define glXQueryChannelRectSGIX GLXEW_GET_FUN(__glewXQueryChannelRectSGIX)
-
-#define GLXEW_SGIX_video_resize GLXEW_GET_VAR(__GLXEW_SGIX_video_resize)
-
-#endif /* GLX_SGIX_video_resize */
-
-/* ---------------------- GLX_SGIX_visual_select_group --------------------- */
-
-#ifndef GLX_SGIX_visual_select_group
-#define GLX_SGIX_visual_select_group 1
-
-#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028
-
-#define GLXEW_SGIX_visual_select_group GLXEW_GET_VAR(__GLXEW_SGIX_visual_select_group)
-
-#endif /* GLX_SGIX_visual_select_group */
-
-/* ---------------------------- GLX_SGI_cushion ---------------------------- */
-
-#ifndef GLX_SGI_cushion
-#define GLX_SGI_cushion 1
-
-typedef void ( * PFNGLXCUSHIONSGIPROC) (Display* dpy, Window window, float cushion);
-
-#define glXCushionSGI GLXEW_GET_FUN(__glewXCushionSGI)
-
-#define GLXEW_SGI_cushion GLXEW_GET_VAR(__GLXEW_SGI_cushion)
-
-#endif /* GLX_SGI_cushion */
-
-/* ----------------------- GLX_SGI_make_current_read ----------------------- */
-
-#ifndef GLX_SGI_make_current_read
-#define GLX_SGI_make_current_read 1
-
-typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);
-typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
-
-#define glXGetCurrentReadDrawableSGI GLXEW_GET_FUN(__glewXGetCurrentReadDrawableSGI)
-#define glXMakeCurrentReadSGI GLXEW_GET_FUN(__glewXMakeCurrentReadSGI)
-
-#define GLXEW_SGI_make_current_read GLXEW_GET_VAR(__GLXEW_SGI_make_current_read)
-
-#endif /* GLX_SGI_make_current_read */
-
-/* -------------------------- GLX_SGI_swap_control ------------------------- */
-
-#ifndef GLX_SGI_swap_control
-#define GLX_SGI_swap_control 1
-
-typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
-
-#define glXSwapIntervalSGI GLXEW_GET_FUN(__glewXSwapIntervalSGI)
-
-#define GLXEW_SGI_swap_control GLXEW_GET_VAR(__GLXEW_SGI_swap_control)
-
-#endif /* GLX_SGI_swap_control */
-
-/* --------------------------- GLX_SGI_video_sync -------------------------- */
-
-#ifndef GLX_SGI_video_sync
-#define GLX_SGI_video_sync 1
-
-typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int* count);
-typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int* count);
-
-#define glXGetVideoSyncSGI GLXEW_GET_FUN(__glewXGetVideoSyncSGI)
-#define glXWaitVideoSyncSGI GLXEW_GET_FUN(__glewXWaitVideoSyncSGI)
-
-#define GLXEW_SGI_video_sync GLXEW_GET_VAR(__GLXEW_SGI_video_sync)
-
-#endif /* GLX_SGI_video_sync */
-
-/* --------------------- GLX_SUN_get_transparent_index --------------------- */
-
-#ifndef GLX_SUN_get_transparent_index
-#define GLX_SUN_get_transparent_index 1
-
-typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display* dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex);
-
-#define glXGetTransparentIndexSUN GLXEW_GET_FUN(__glewXGetTransparentIndexSUN)
-
-#define GLXEW_SUN_get_transparent_index GLXEW_GET_VAR(__GLXEW_SUN_get_transparent_index)
-
-#endif /* GLX_SUN_get_transparent_index */
-
-/* -------------------------- GLX_SUN_video_resize ------------------------- */
-
-#ifndef GLX_SUN_video_resize
-#define GLX_SUN_video_resize 1
-
-#define GLX_VIDEO_RESIZE_SUN 0x8171
-#define GL_VIDEO_RESIZE_COMPENSATION_SUN 0x85CD
-
-typedef int ( * PFNGLXGETVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float* factor);
-typedef int ( * PFNGLXVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float factor);
-
-#define glXGetVideoResizeSUN GLXEW_GET_FUN(__glewXGetVideoResizeSUN)
-#define glXVideoResizeSUN GLXEW_GET_FUN(__glewXVideoResizeSUN)
-
-#define GLXEW_SUN_video_resize GLXEW_GET_VAR(__GLXEW_SUN_video_resize)
-
-#endif /* GLX_SUN_video_resize */
-
-/* ------------------------------------------------------------------------- */
-
-#ifdef GLEW_MX
-#define GLXEW_FUN_EXPORT GLEW_FUN_EXPORT
-#define GLXEW_VAR_EXPORT
-#else
-#define GLXEW_FUN_EXPORT GLEW_FUN_EXPORT
-#define GLXEW_VAR_EXPORT GLEW_VAR_EXPORT
-#endif /* GLEW_MX */
-
-GLXEW_FUN_EXPORT PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay;
-
-GLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGPROC __glewXChooseFBConfig;
-GLXEW_FUN_EXPORT PFNGLXCREATENEWCONTEXTPROC __glewXCreateNewContext;
-GLXEW_FUN_EXPORT PFNGLXCREATEPBUFFERPROC __glewXCreatePbuffer;
-GLXEW_FUN_EXPORT PFNGLXCREATEPIXMAPPROC __glewXCreatePixmap;
-GLXEW_FUN_EXPORT PFNGLXCREATEWINDOWPROC __glewXCreateWindow;
-GLXEW_FUN_EXPORT PFNGLXDESTROYPBUFFERPROC __glewXDestroyPbuffer;
-GLXEW_FUN_EXPORT PFNGLXDESTROYPIXMAPPROC __glewXDestroyPixmap;
-GLXEW_FUN_EXPORT PFNGLXDESTROYWINDOWPROC __glewXDestroyWindow;
-GLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLEPROC __glewXGetCurrentReadDrawable;
-GLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBPROC __glewXGetFBConfigAttrib;
-GLXEW_FUN_EXPORT PFNGLXGETFBCONFIGSPROC __glewXGetFBConfigs;
-GLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTPROC __glewXGetSelectedEvent;
-GLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGPROC __glewXGetVisualFromFBConfig;
-GLXEW_FUN_EXPORT PFNGLXMAKECONTEXTCURRENTPROC __glewXMakeContextCurrent;
-GLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTPROC __glewXQueryContext;
-GLXEW_FUN_EXPORT PFNGLXQUERYDRAWABLEPROC __glewXQueryDrawable;
-GLXEW_FUN_EXPORT PFNGLXSELECTEVENTPROC __glewXSelectEvent;
-
-GLXEW_FUN_EXPORT PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC __glewXBlitContextFramebufferAMD;
-GLXEW_FUN_EXPORT PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC __glewXCreateAssociatedContextAMD;
-GLXEW_FUN_EXPORT PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __glewXCreateAssociatedContextAttribsAMD;
-GLXEW_FUN_EXPORT PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC __glewXDeleteAssociatedContextAMD;
-GLXEW_FUN_EXPORT PFNGLXGETCONTEXTGPUIDAMDPROC __glewXGetContextGPUIDAMD;
-GLXEW_FUN_EXPORT PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC __glewXGetCurrentAssociatedContextAMD;
-GLXEW_FUN_EXPORT PFNGLXGETGPUIDSAMDPROC __glewXGetGPUIDsAMD;
-GLXEW_FUN_EXPORT PFNGLXGETGPUINFOAMDPROC __glewXGetGPUInfoAMD;
-GLXEW_FUN_EXPORT PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __glewXMakeAssociatedContextCurrentAMD;
-
-GLXEW_FUN_EXPORT PFNGLXCREATECONTEXTATTRIBSARBPROC __glewXCreateContextAttribsARB;
-
-GLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI;
-GLXEW_FUN_EXPORT PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI;
-GLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI;
-
-GLXEW_FUN_EXPORT PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT;
-GLXEW_FUN_EXPORT PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT;
-GLXEW_FUN_EXPORT PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT;
-GLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT;
-
-GLXEW_FUN_EXPORT PFNGLXSWAPINTERVALEXTPROC __glewXSwapIntervalEXT;
-
-GLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEEXTPROC __glewXBindTexImageEXT;
-GLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEEXTPROC __glewXReleaseTexImageEXT;
-
-GLXEW_FUN_EXPORT PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA;
-
-GLXEW_FUN_EXPORT PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA;
-
-GLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA;
-
-GLXEW_FUN_EXPORT PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC __glewXQueryCurrentRendererIntegerMESA;
-GLXEW_FUN_EXPORT PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC __glewXQueryCurrentRendererStringMESA;
-GLXEW_FUN_EXPORT PFNGLXQUERYRENDERERINTEGERMESAPROC __glewXQueryRendererIntegerMESA;
-GLXEW_FUN_EXPORT PFNGLXQUERYRENDERERSTRINGMESAPROC __glewXQueryRendererStringMESA;
-
-GLXEW_FUN_EXPORT PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA;
-
-GLXEW_FUN_EXPORT PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA;
-
-GLXEW_FUN_EXPORT PFNGLXGETSWAPINTERVALMESAPROC __glewXGetSwapIntervalMESA;
-GLXEW_FUN_EXPORT PFNGLXSWAPINTERVALMESAPROC __glewXSwapIntervalMESA;
-
-GLXEW_FUN_EXPORT PFNGLXCOPYBUFFERSUBDATANVPROC __glewXCopyBufferSubDataNV;
-GLXEW_FUN_EXPORT PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC __glewXNamedCopyBufferSubDataNV;
-
-GLXEW_FUN_EXPORT PFNGLXCOPYIMAGESUBDATANVPROC __glewXCopyImageSubDataNV;
-
-GLXEW_FUN_EXPORT PFNGLXDELAYBEFORESWAPNVPROC __glewXDelayBeforeSwapNV;
-
-GLXEW_FUN_EXPORT PFNGLXBINDVIDEODEVICENVPROC __glewXBindVideoDeviceNV;
-GLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEODEVICESNVPROC __glewXEnumerateVideoDevicesNV;
-
-GLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERNVPROC __glewXBindSwapBarrierNV;
-GLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPNVPROC __glewXJoinSwapGroupNV;
-GLXEW_FUN_EXPORT PFNGLXQUERYFRAMECOUNTNVPROC __glewXQueryFrameCountNV;
-GLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPGROUPSNVPROC __glewXQueryMaxSwapGroupsNV;
-GLXEW_FUN_EXPORT PFNGLXQUERYSWAPGROUPNVPROC __glewXQuerySwapGroupNV;
-GLXEW_FUN_EXPORT PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV;
-
-GLXEW_FUN_EXPORT PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV;
-GLXEW_FUN_EXPORT PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV;
-
-GLXEW_FUN_EXPORT PFNGLXBINDVIDEOCAPTUREDEVICENVPROC __glewXBindVideoCaptureDeviceNV;
-GLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC __glewXEnumerateVideoCaptureDevicesNV;
-GLXEW_FUN_EXPORT PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC __glewXLockVideoCaptureDeviceNV;
-GLXEW_FUN_EXPORT PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC __glewXQueryVideoCaptureDeviceNV;
-GLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC __glewXReleaseVideoCaptureDeviceNV;
-
-GLXEW_FUN_EXPORT PFNGLXBINDVIDEOIMAGENVPROC __glewXBindVideoImageNV;
-GLXEW_FUN_EXPORT PFNGLXGETVIDEODEVICENVPROC __glewXGetVideoDeviceNV;
-GLXEW_FUN_EXPORT PFNGLXGETVIDEOINFONVPROC __glewXGetVideoInfoNV;
-GLXEW_FUN_EXPORT PFNGLXRELEASEVIDEODEVICENVPROC __glewXReleaseVideoDeviceNV;
-GLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOIMAGENVPROC __glewXReleaseVideoImageNV;
-GLXEW_FUN_EXPORT PFNGLXSENDPBUFFERTOVIDEONVPROC __glewXSendPbufferToVideoNV;
-
-GLXEW_FUN_EXPORT PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML;
-GLXEW_FUN_EXPORT PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML;
-GLXEW_FUN_EXPORT PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML;
-GLXEW_FUN_EXPORT PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML;
-GLXEW_FUN_EXPORT PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML;
-
-GLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX;
-GLXEW_FUN_EXPORT PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX;
-GLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC __glewXCreateGLXPixmapWithConfigSGIX;
-GLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBSGIXPROC __glewXGetFBConfigAttribSGIX;
-GLXEW_FUN_EXPORT PFNGLXGETFBCONFIGFROMVISUALSGIXPROC __glewXGetFBConfigFromVisualSGIX;
-GLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGSGIXPROC __glewXGetVisualFromFBConfigSGIX;
-
-GLXEW_FUN_EXPORT PFNGLXBINDHYPERPIPESGIXPROC __glewXBindHyperpipeSGIX;
-GLXEW_FUN_EXPORT PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC __glewXDestroyHyperpipeConfigSGIX;
-GLXEW_FUN_EXPORT PFNGLXHYPERPIPEATTRIBSGIXPROC __glewXHyperpipeAttribSGIX;
-GLXEW_FUN_EXPORT PFNGLXHYPERPIPECONFIGSGIXPROC __glewXHyperpipeConfigSGIX;
-GLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC __glewXQueryHyperpipeAttribSGIX;
-GLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC __glewXQueryHyperpipeBestAttribSGIX;
-GLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPECONFIGSGIXPROC __glewXQueryHyperpipeConfigSGIX;
-GLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPENETWORKSGIXPROC __glewXQueryHyperpipeNetworkSGIX;
-
-GLXEW_FUN_EXPORT PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX;
-GLXEW_FUN_EXPORT PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX;
-GLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX;
-GLXEW_FUN_EXPORT PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX;
-GLXEW_FUN_EXPORT PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX;
-
-GLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX;
-GLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX;
-
-GLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX;
-
-GLXEW_FUN_EXPORT PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX;
-GLXEW_FUN_EXPORT PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX;
-GLXEW_FUN_EXPORT PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX;
-GLXEW_FUN_EXPORT PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX;
-GLXEW_FUN_EXPORT PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX;
-
-GLXEW_FUN_EXPORT PFNGLXCUSHIONSGIPROC __glewXCushionSGI;
-
-GLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI;
-GLXEW_FUN_EXPORT PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI;
-
-GLXEW_FUN_EXPORT PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI;
-
-GLXEW_FUN_EXPORT PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI;
-GLXEW_FUN_EXPORT PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI;
-
-GLXEW_FUN_EXPORT PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN;
-
-GLXEW_FUN_EXPORT PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN;
-GLXEW_FUN_EXPORT PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN;
-
-#if defined(GLEW_MX)
-struct GLXEWContextStruct
-{
-#endif /* GLEW_MX */
-
-
-#if defined(GLEW_MX)
-GLEWHashList *GLEW_GLX_EXTENSIONS;
-#endif /* GLEW_MX */
-
-GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_0;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_1;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_3;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_4;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_3DFX_multisample;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_AMD_gpu_association;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_context_flush_control;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_profile;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_robustness;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_fbconfig_float;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_framebuffer_sRGB;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_get_proc_address;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_multisample;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_application_isolation;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_share_group_isolation;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_vertex_buffer_object;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_pixel_format_float;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_render_texture;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_buffer_age;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es2_profile;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es_profile;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_fbconfig_packed_float;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_framebuffer_sRGB;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_import_context;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_scene_marker;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_stereo_tree;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control_tear;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_texture_from_pixmap;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_info;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_rating;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_INTEL_swap_event;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_agp_offset;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_copy_sub_buffer;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_pixmap_colormap;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_query_renderer;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_release_buffers;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_set_3dfx_mode;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_swap_control;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_copy_buffer;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_copy_image;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_delay_before_swap;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_float_buffer;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_multisample_coverage;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_present_video;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_swap_group;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_vertex_array_range;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_capture;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_out;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_OML_swap_method;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_OML_sync_control;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_blended_overlay;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_color_range;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_multisample;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_shared_multisample;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_fbconfig;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_hyperpipe;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_pbuffer;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_barrier;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_group;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_video_resize;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_visual_select_group;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_cushion;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_make_current_read;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_swap_control;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_video_sync;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_get_transparent_index;
-GLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_video_resize;
-
-#ifdef GLEW_MX
-}; /* GLXEWContextStruct */
-#endif /* GLEW_MX */
-
-/* ------------------------------------------------------------------------ */
-
-#ifdef GLEW_MX
-
-typedef struct GLXEWContextStruct GLXEWContext;
-GLEWAPI GLenum GLEWAPIENTRY glxewContextInit (GLXEWContext *ctx);
-GLEWAPI GLboolean GLEWAPIENTRY glxewContextIsSupported (const GLXEWContext *ctx, const char *name);
-
-#define glxewInit() glxewContextInit(glxewGetContext())
-#define glxewIsSupported(x) glxewContextIsSupported(glxewGetContext(), x)
-
-#define GLXEW_GET_VAR(x) (*(const GLboolean*)&(glxewGetContext()->x))
-#define GLXEW_GET_FUN(x) x
-
-#else /* GLEW_MX */
-
-#define GLXEW_GET_VAR(x) (*(const GLboolean*)&x)
-#define GLXEW_GET_FUN(x) x
-
-GLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name);
-
-#endif /* GLEW_MX */
-
-GLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __glxew_h__ */
diff --git a/Libraries/glew-urkle-core/include/GL/wglew.h b/Libraries/glew-urkle-core/include/GL/wglew.h
deleted file mode 100644
index 4566d289..00000000
--- a/Libraries/glew-urkle-core/include/GL/wglew.h
+++ /dev/null
@@ -1,1457 +0,0 @@
-/*
-** The OpenGL Extension Wrangler Library
-** Copyright (C) 2008-2014, Nigel Stewart <nigels[]users sourceforge net>
-** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
-** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
-** Copyright (C) 2002, Lev Povalahev
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-** * The name of the author may be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-** THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
-** Copyright (c) 2007 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-#ifndef __wglew_h__
-#define __wglew_h__
-#define __WGLEW_H__
-
-#ifdef __wglext_h_
-#error wglext.h included before wglew.h
-#endif
-
-#define __wglext_h_
-
-#if !defined(WINAPI)
-# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN 1
-# endif
-#include <windows.h>
-# undef WIN32_LEAN_AND_MEAN
-#endif
-
-/*
- * GLEW_STATIC needs to be set when using the static version.
- * GLEW_BUILD is set when building the DLL version.
- */
-#ifdef GLEW_STATIC
-# define GLEWAPI extern
-#else
-# ifdef GLEW_BUILD
-# define GLEWAPI extern __declspec(dllexport)
-# else
-# define GLEWAPI extern __declspec(dllimport)
-# endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* -------------------------- WGL_3DFX_multisample ------------------------- */
-
-#ifndef WGL_3DFX_multisample
-#define WGL_3DFX_multisample 1
-
-#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
-#define WGL_SAMPLES_3DFX 0x2061
-
-#define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample)
-
-#endif /* WGL_3DFX_multisample */
-
-/* ------------------------- WGL_3DL_stereo_control ------------------------ */
-
-#ifndef WGL_3DL_stereo_control
-#define WGL_3DL_stereo_control 1
-
-#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
-#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
-#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
-#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
-
-typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
-
-#define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL)
-
-#define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control)
-
-#endif /* WGL_3DL_stereo_control */
-
-/* ------------------------ WGL_AMD_gpu_association ------------------------ */
-
-#ifndef WGL_AMD_gpu_association
-#define WGL_AMD_gpu_association 1
-
-#define WGL_GPU_VENDOR_AMD 0x1F00
-#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
-#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
-#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
-#define WGL_GPU_RAM_AMD 0x21A3
-#define WGL_GPU_CLOCK_AMD 0x21A4
-#define WGL_GPU_NUM_PIPES_AMD 0x21A5
-#define WGL_GPU_NUM_SIMD_AMD 0x21A6
-#define WGL_GPU_NUM_RB_AMD 0x21A7
-#define WGL_GPU_NUM_SPI_AMD 0x21A8
-
-typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
-typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int* attribList);
-typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
-typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
-typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
-typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT* ids);
-typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data);
-typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
-
-#define wglBlitContextFramebufferAMD WGLEW_GET_FUN(__wglewBlitContextFramebufferAMD)
-#define wglCreateAssociatedContextAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAMD)
-#define wglCreateAssociatedContextAttribsAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAttribsAMD)
-#define wglDeleteAssociatedContextAMD WGLEW_GET_FUN(__wglewDeleteAssociatedContextAMD)
-#define wglGetContextGPUIDAMD WGLEW_GET_FUN(__wglewGetContextGPUIDAMD)
-#define wglGetCurrentAssociatedContextAMD WGLEW_GET_FUN(__wglewGetCurrentAssociatedContextAMD)
-#define wglGetGPUIDsAMD WGLEW_GET_FUN(__wglewGetGPUIDsAMD)
-#define wglGetGPUInfoAMD WGLEW_GET_FUN(__wglewGetGPUInfoAMD)
-#define wglMakeAssociatedContextCurrentAMD WGLEW_GET_FUN(__wglewMakeAssociatedContextCurrentAMD)
-
-#define WGLEW_AMD_gpu_association WGLEW_GET_VAR(__WGLEW_AMD_gpu_association)
-
-#endif /* WGL_AMD_gpu_association */
-
-/* ------------------------- WGL_ARB_buffer_region ------------------------- */
-
-#ifndef WGL_ARB_buffer_region
-#define WGL_ARB_buffer_region 1
-
-#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
-#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
-#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
-#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
-
-typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
-typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
-typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
-typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
-
-#define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB)
-#define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB)
-#define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB)
-#define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB)
-
-#define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region)
-
-#endif /* WGL_ARB_buffer_region */
-
-/* --------------------- WGL_ARB_context_flush_control --------------------- */
-
-#ifndef WGL_ARB_context_flush_control
-#define WGL_ARB_context_flush_control 1
-
-#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0x0000
-#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
-#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
-
-#define WGLEW_ARB_context_flush_control WGLEW_GET_VAR(__WGLEW_ARB_context_flush_control)
-
-#endif /* WGL_ARB_context_flush_control */
-
-/* ------------------------- WGL_ARB_create_context ------------------------ */
-
-#ifndef WGL_ARB_create_context
-#define WGL_ARB_create_context 1
-
-#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
-#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
-#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
-#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
-#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
-#define WGL_CONTEXT_FLAGS_ARB 0x2094
-#define ERROR_INVALID_VERSION_ARB 0x2095
-#define ERROR_INVALID_PROFILE_ARB 0x2096
-
-typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList);
-
-#define wglCreateContextAttribsARB WGLEW_GET_FUN(__wglewCreateContextAttribsARB)
-
-#define WGLEW_ARB_create_context WGLEW_GET_VAR(__WGLEW_ARB_create_context)
-
-#endif /* WGL_ARB_create_context */
-
-/* --------------------- WGL_ARB_create_context_profile -------------------- */
-
-#ifndef WGL_ARB_create_context_profile
-#define WGL_ARB_create_context_profile 1
-
-#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
-#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
-#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
-
-#define WGLEW_ARB_create_context_profile WGLEW_GET_VAR(__WGLEW_ARB_create_context_profile)
-
-#endif /* WGL_ARB_create_context_profile */
-
-/* ------------------- WGL_ARB_create_context_robustness ------------------- */
-
-#ifndef WGL_ARB_create_context_robustness
-#define WGL_ARB_create_context_robustness 1
-
-#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
-#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
-#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
-#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
-
-#define WGLEW_ARB_create_context_robustness WGLEW_GET_VAR(__WGLEW_ARB_create_context_robustness)
-
-#endif /* WGL_ARB_create_context_robustness */
-
-/* ----------------------- WGL_ARB_extensions_string ----------------------- */
-
-#ifndef WGL_ARB_extensions_string
-#define WGL_ARB_extensions_string 1
-
-typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
-
-#define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB)
-
-#define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string)
-
-#endif /* WGL_ARB_extensions_string */
-
-/* ------------------------ WGL_ARB_framebuffer_sRGB ----------------------- */
-
-#ifndef WGL_ARB_framebuffer_sRGB
-#define WGL_ARB_framebuffer_sRGB 1
-
-#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
-
-#define WGLEW_ARB_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_ARB_framebuffer_sRGB)
-
-#endif /* WGL_ARB_framebuffer_sRGB */
-
-/* ----------------------- WGL_ARB_make_current_read ----------------------- */
-
-#ifndef WGL_ARB_make_current_read
-#define WGL_ARB_make_current_read 1
-
-#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
-#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
-
-typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID);
-typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
-
-#define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB)
-#define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB)
-
-#define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read)
-
-#endif /* WGL_ARB_make_current_read */
-
-/* -------------------------- WGL_ARB_multisample -------------------------- */
-
-#ifndef WGL_ARB_multisample
-#define WGL_ARB_multisample 1
-
-#define WGL_SAMPLE_BUFFERS_ARB 0x2041
-#define WGL_SAMPLES_ARB 0x2042
-
-#define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample)
-
-#endif /* WGL_ARB_multisample */
-
-/* ---------------------------- WGL_ARB_pbuffer ---------------------------- */
-
-#ifndef WGL_ARB_pbuffer
-#define WGL_ARB_pbuffer 1
-
-#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
-#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
-#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
-#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
-#define WGL_PBUFFER_LARGEST_ARB 0x2033
-#define WGL_PBUFFER_WIDTH_ARB 0x2034
-#define WGL_PBUFFER_HEIGHT_ARB 0x2035
-#define WGL_PBUFFER_LOST_ARB 0x2036
-
-DECLARE_HANDLE(HPBUFFERARB);
-
-typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);
-typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
-typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
-typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue);
-typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
-
-#define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB)
-#define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB)
-#define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB)
-#define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB)
-#define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB)
-
-#define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer)
-
-#endif /* WGL_ARB_pbuffer */
-
-/* -------------------------- WGL_ARB_pixel_format ------------------------- */
-
-#ifndef WGL_ARB_pixel_format
-#define WGL_ARB_pixel_format 1
-
-#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
-#define WGL_DRAW_TO_WINDOW_ARB 0x2001
-#define WGL_DRAW_TO_BITMAP_ARB 0x2002
-#define WGL_ACCELERATION_ARB 0x2003
-#define WGL_NEED_PALETTE_ARB 0x2004
-#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
-#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
-#define WGL_SWAP_METHOD_ARB 0x2007
-#define WGL_NUMBER_OVERLAYS_ARB 0x2008
-#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
-#define WGL_TRANSPARENT_ARB 0x200A
-#define WGL_SHARE_DEPTH_ARB 0x200C
-#define WGL_SHARE_STENCIL_ARB 0x200D
-#define WGL_SHARE_ACCUM_ARB 0x200E
-#define WGL_SUPPORT_GDI_ARB 0x200F
-#define WGL_SUPPORT_OPENGL_ARB 0x2010
-#define WGL_DOUBLE_BUFFER_ARB 0x2011
-#define WGL_STEREO_ARB 0x2012
-#define WGL_PIXEL_TYPE_ARB 0x2013
-#define WGL_COLOR_BITS_ARB 0x2014
-#define WGL_RED_BITS_ARB 0x2015
-#define WGL_RED_SHIFT_ARB 0x2016
-#define WGL_GREEN_BITS_ARB 0x2017
-#define WGL_GREEN_SHIFT_ARB 0x2018
-#define WGL_BLUE_BITS_ARB 0x2019
-#define WGL_BLUE_SHIFT_ARB 0x201A
-#define WGL_ALPHA_BITS_ARB 0x201B
-#define WGL_ALPHA_SHIFT_ARB 0x201C
-#define WGL_ACCUM_BITS_ARB 0x201D
-#define WGL_ACCUM_RED_BITS_ARB 0x201E
-#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
-#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
-#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
-#define WGL_DEPTH_BITS_ARB 0x2022
-#define WGL_STENCIL_BITS_ARB 0x2023
-#define WGL_AUX_BUFFERS_ARB 0x2024
-#define WGL_NO_ACCELERATION_ARB 0x2025
-#define WGL_GENERIC_ACCELERATION_ARB 0x2026
-#define WGL_FULL_ACCELERATION_ARB 0x2027
-#define WGL_SWAP_EXCHANGE_ARB 0x2028
-#define WGL_SWAP_COPY_ARB 0x2029
-#define WGL_SWAP_UNDEFINED_ARB 0x202A
-#define WGL_TYPE_RGBA_ARB 0x202B
-#define WGL_TYPE_COLORINDEX_ARB 0x202C
-#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
-#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
-#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
-#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
-#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
-
-typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
-typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues);
-typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues);
-
-#define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB)
-#define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB)
-#define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB)
-
-#define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format)
-
-#endif /* WGL_ARB_pixel_format */
-
-/* ----------------------- WGL_ARB_pixel_format_float ---------------------- */
-
-#ifndef WGL_ARB_pixel_format_float
-#define WGL_ARB_pixel_format_float 1
-
-#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
-
-#define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float)
-
-#endif /* WGL_ARB_pixel_format_float */
-
-/* ------------------------- WGL_ARB_render_texture ------------------------ */
-
-#ifndef WGL_ARB_render_texture
-#define WGL_ARB_render_texture 1
-
-#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
-#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
-#define WGL_TEXTURE_FORMAT_ARB 0x2072
-#define WGL_TEXTURE_TARGET_ARB 0x2073
-#define WGL_MIPMAP_TEXTURE_ARB 0x2074
-#define WGL_TEXTURE_RGB_ARB 0x2075
-#define WGL_TEXTURE_RGBA_ARB 0x2076
-#define WGL_NO_TEXTURE_ARB 0x2077
-#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
-#define WGL_TEXTURE_1D_ARB 0x2079
-#define WGL_TEXTURE_2D_ARB 0x207A
-#define WGL_MIPMAP_LEVEL_ARB 0x207B
-#define WGL_CUBE_MAP_FACE_ARB 0x207C
-#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
-#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
-#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
-#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
-#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
-#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
-#define WGL_FRONT_LEFT_ARB 0x2083
-#define WGL_FRONT_RIGHT_ARB 0x2084
-#define WGL_BACK_LEFT_ARB 0x2085
-#define WGL_BACK_RIGHT_ARB 0x2086
-#define WGL_AUX0_ARB 0x2087
-#define WGL_AUX1_ARB 0x2088
-#define WGL_AUX2_ARB 0x2089
-#define WGL_AUX3_ARB 0x208A
-#define WGL_AUX4_ARB 0x208B
-#define WGL_AUX5_ARB 0x208C
-#define WGL_AUX6_ARB 0x208D
-#define WGL_AUX7_ARB 0x208E
-#define WGL_AUX8_ARB 0x208F
-#define WGL_AUX9_ARB 0x2090
-
-typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
-typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
-typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList);
-
-#define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB)
-#define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB)
-#define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB)
-
-#define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture)
-
-#endif /* WGL_ARB_render_texture */
-
-/* ---------------- WGL_ARB_robustness_application_isolation --------------- */
-
-#ifndef WGL_ARB_robustness_application_isolation
-#define WGL_ARB_robustness_application_isolation 1
-
-#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
-
-#define WGLEW_ARB_robustness_application_isolation WGLEW_GET_VAR(__WGLEW_ARB_robustness_application_isolation)
-
-#endif /* WGL_ARB_robustness_application_isolation */
-
-/* ---------------- WGL_ARB_robustness_share_group_isolation --------------- */
-
-#ifndef WGL_ARB_robustness_share_group_isolation
-#define WGL_ARB_robustness_share_group_isolation 1
-
-#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
-
-#define WGLEW_ARB_robustness_share_group_isolation WGLEW_GET_VAR(__WGLEW_ARB_robustness_share_group_isolation)
-
-#endif /* WGL_ARB_robustness_share_group_isolation */
-
-/* ----------------------- WGL_ATI_pixel_format_float ---------------------- */
-
-#ifndef WGL_ATI_pixel_format_float
-#define WGL_ATI_pixel_format_float 1
-
-#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
-#define GL_RGBA_FLOAT_MODE_ATI 0x8820
-#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835
-
-#define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float)
-
-#endif /* WGL_ATI_pixel_format_float */
-
-/* -------------------- WGL_ATI_render_texture_rectangle ------------------- */
-
-#ifndef WGL_ATI_render_texture_rectangle
-#define WGL_ATI_render_texture_rectangle 1
-
-#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5
-
-#define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle)
-
-#endif /* WGL_ATI_render_texture_rectangle */
-
-/* ------------------- WGL_EXT_create_context_es2_profile ------------------ */
-
-#ifndef WGL_EXT_create_context_es2_profile
-#define WGL_EXT_create_context_es2_profile 1
-
-#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
-
-#define WGLEW_EXT_create_context_es2_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es2_profile)
-
-#endif /* WGL_EXT_create_context_es2_profile */
-
-/* ------------------- WGL_EXT_create_context_es_profile ------------------- */
-
-#ifndef WGL_EXT_create_context_es_profile
-#define WGL_EXT_create_context_es_profile 1
-
-#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
-
-#define WGLEW_EXT_create_context_es_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es_profile)
-
-#endif /* WGL_EXT_create_context_es_profile */
-
-/* -------------------------- WGL_EXT_depth_float -------------------------- */
-
-#ifndef WGL_EXT_depth_float
-#define WGL_EXT_depth_float 1
-
-#define WGL_DEPTH_FLOAT_EXT 0x2040
-
-#define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float)
-
-#endif /* WGL_EXT_depth_float */
-
-/* ---------------------- WGL_EXT_display_color_table ---------------------- */
-
-#ifndef WGL_EXT_display_color_table
-#define WGL_EXT_display_color_table 1
-
-typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
-typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
-typedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
-typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length);
-
-#define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT)
-#define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT)
-#define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT)
-#define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT)
-
-#define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table)
-
-#endif /* WGL_EXT_display_color_table */
-
-/* ----------------------- WGL_EXT_extensions_string ----------------------- */
-
-#ifndef WGL_EXT_extensions_string
-#define WGL_EXT_extensions_string 1
-
-typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
-
-#define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT)
-
-#define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string)
-
-#endif /* WGL_EXT_extensions_string */
-
-/* ------------------------ WGL_EXT_framebuffer_sRGB ----------------------- */
-
-#ifndef WGL_EXT_framebuffer_sRGB
-#define WGL_EXT_framebuffer_sRGB 1
-
-#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
-
-#define WGLEW_EXT_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_EXT_framebuffer_sRGB)
-
-#endif /* WGL_EXT_framebuffer_sRGB */
-
-/* ----------------------- WGL_EXT_make_current_read ----------------------- */
-
-#ifndef WGL_EXT_make_current_read
-#define WGL_EXT_make_current_read 1
-
-#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
-
-typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID);
-typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
-
-#define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT)
-#define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT)
-
-#define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read)
-
-#endif /* WGL_EXT_make_current_read */
-
-/* -------------------------- WGL_EXT_multisample -------------------------- */
-
-#ifndef WGL_EXT_multisample
-#define WGL_EXT_multisample 1
-
-#define WGL_SAMPLE_BUFFERS_EXT 0x2041
-#define WGL_SAMPLES_EXT 0x2042
-
-#define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample)
-
-#endif /* WGL_EXT_multisample */
-
-/* ---------------------------- WGL_EXT_pbuffer ---------------------------- */
-
-#ifndef WGL_EXT_pbuffer
-#define WGL_EXT_pbuffer 1
-
-#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
-#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
-#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
-#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
-#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
-#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
-#define WGL_PBUFFER_LARGEST_EXT 0x2033
-#define WGL_PBUFFER_WIDTH_EXT 0x2034
-#define WGL_PBUFFER_HEIGHT_EXT 0x2035
-
-DECLARE_HANDLE(HPBUFFEREXT);
-
-typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);
-typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
-typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
-typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue);
-typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
-
-#define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT)
-#define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT)
-#define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT)
-#define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT)
-#define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT)
-
-#define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer)
-
-#endif /* WGL_EXT_pbuffer */
-
-/* -------------------------- WGL_EXT_pixel_format ------------------------- */
-
-#ifndef WGL_EXT_pixel_format
-#define WGL_EXT_pixel_format 1
-
-#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
-#define WGL_DRAW_TO_WINDOW_EXT 0x2001
-#define WGL_DRAW_TO_BITMAP_EXT 0x2002
-#define WGL_ACCELERATION_EXT 0x2003
-#define WGL_NEED_PALETTE_EXT 0x2004
-#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
-#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
-#define WGL_SWAP_METHOD_EXT 0x2007
-#define WGL_NUMBER_OVERLAYS_EXT 0x2008
-#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
-#define WGL_TRANSPARENT_EXT 0x200A
-#define WGL_TRANSPARENT_VALUE_EXT 0x200B
-#define WGL_SHARE_DEPTH_EXT 0x200C
-#define WGL_SHARE_STENCIL_EXT 0x200D
-#define WGL_SHARE_ACCUM_EXT 0x200E
-#define WGL_SUPPORT_GDI_EXT 0x200F
-#define WGL_SUPPORT_OPENGL_EXT 0x2010
-#define WGL_DOUBLE_BUFFER_EXT 0x2011
-#define WGL_STEREO_EXT 0x2012
-#define WGL_PIXEL_TYPE_EXT 0x2013
-#define WGL_COLOR_BITS_EXT 0x2014
-#define WGL_RED_BITS_EXT 0x2015
-#define WGL_RED_SHIFT_EXT 0x2016
-#define WGL_GREEN_BITS_EXT 0x2017
-#define WGL_GREEN_SHIFT_EXT 0x2018
-#define WGL_BLUE_BITS_EXT 0x2019
-#define WGL_BLUE_SHIFT_EXT 0x201A
-#define WGL_ALPHA_BITS_EXT 0x201B
-#define WGL_ALPHA_SHIFT_EXT 0x201C
-#define WGL_ACCUM_BITS_EXT 0x201D
-#define WGL_ACCUM_RED_BITS_EXT 0x201E
-#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
-#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
-#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
-#define WGL_DEPTH_BITS_EXT 0x2022
-#define WGL_STENCIL_BITS_EXT 0x2023
-#define WGL_AUX_BUFFERS_EXT 0x2024
-#define WGL_NO_ACCELERATION_EXT 0x2025
-#define WGL_GENERIC_ACCELERATION_EXT 0x2026
-#define WGL_FULL_ACCELERATION_EXT 0x2027
-#define WGL_SWAP_EXCHANGE_EXT 0x2028
-#define WGL_SWAP_COPY_EXT 0x2029
-#define WGL_SWAP_UNDEFINED_EXT 0x202A
-#define WGL_TYPE_RGBA_EXT 0x202B
-#define WGL_TYPE_COLORINDEX_EXT 0x202C
-
-typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
-typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues);
-typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues);
-
-#define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT)
-#define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT)
-#define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT)
-
-#define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format)
-
-#endif /* WGL_EXT_pixel_format */
-
-/* ------------------- WGL_EXT_pixel_format_packed_float ------------------- */
-
-#ifndef WGL_EXT_pixel_format_packed_float
-#define WGL_EXT_pixel_format_packed_float 1
-
-#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
-
-#define WGLEW_EXT_pixel_format_packed_float WGLEW_GET_VAR(__WGLEW_EXT_pixel_format_packed_float)
-
-#endif /* WGL_EXT_pixel_format_packed_float */
-
-/* -------------------------- WGL_EXT_swap_control ------------------------- */
-
-#ifndef WGL_EXT_swap_control
-#define WGL_EXT_swap_control 1
-
-typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
-typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
-
-#define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT)
-#define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT)
-
-#define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control)
-
-#endif /* WGL_EXT_swap_control */
-
-/* ----------------------- WGL_EXT_swap_control_tear ----------------------- */
-
-#ifndef WGL_EXT_swap_control_tear
-#define WGL_EXT_swap_control_tear 1
-
-#define WGLEW_EXT_swap_control_tear WGLEW_GET_VAR(__WGLEW_EXT_swap_control_tear)
-
-#endif /* WGL_EXT_swap_control_tear */
-
-/* --------------------- WGL_I3D_digital_video_control --------------------- */
-
-#ifndef WGL_I3D_digital_video_control
-#define WGL_I3D_digital_video_control 1
-
-#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
-#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
-#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
-#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
-
-typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);
-typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);
-
-#define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D)
-#define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D)
-
-#define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control)
-
-#endif /* WGL_I3D_digital_video_control */
-
-/* ----------------------------- WGL_I3D_gamma ----------------------------- */
-
-#ifndef WGL_I3D_gamma
-#define WGL_I3D_gamma 1
-
-#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
-#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
-
-typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue);
-typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);
-typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue);
-typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);
-
-#define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D)
-#define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D)
-#define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D)
-#define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D)
-
-#define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma)
-
-#endif /* WGL_I3D_gamma */
-
-/* ---------------------------- WGL_I3D_genlock ---------------------------- */
-
-#ifndef WGL_I3D_genlock
-#define WGL_I3D_genlock 1
-
-#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
-#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045
-#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046
-#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047
-#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
-#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
-#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
-#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
-#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
-
-typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
-typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
-typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
-typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
-typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
-typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
-typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate);
-typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay);
-typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge);
-typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource);
-typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag);
-typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay);
-
-#define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D)
-#define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D)
-#define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D)
-#define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D)
-#define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D)
-#define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D)
-#define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D)
-#define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D)
-#define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D)
-#define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D)
-#define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D)
-#define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D)
-
-#define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock)
-
-#endif /* WGL_I3D_genlock */
-
-/* -------------------------- WGL_I3D_image_buffer ------------------------- */
-
-#ifndef WGL_I3D_image_buffer
-#define WGL_I3D_image_buffer 1
-
-#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
-#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
-
-typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count);
-typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
-typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
-typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count);
-
-#define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D)
-#define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D)
-#define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D)
-#define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D)
-
-#define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer)
-
-#endif /* WGL_I3D_image_buffer */
-
-/* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */
-
-#ifndef WGL_I3D_swap_frame_lock
-#define WGL_I3D_swap_frame_lock 1
-
-typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID);
-typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID);
-typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag);
-typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag);
-
-#define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D)
-#define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D)
-#define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D)
-#define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D)
-
-#define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock)
-
-#endif /* WGL_I3D_swap_frame_lock */
-
-/* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */
-
-#ifndef WGL_I3D_swap_frame_usage
-#define WGL_I3D_swap_frame_usage 1
-
-typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
-typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
-typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage);
-typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
-
-#define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D)
-#define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D)
-#define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D)
-#define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D)
-
-#define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage)
-
-#endif /* WGL_I3D_swap_frame_usage */
-
-/* --------------------------- WGL_NV_DX_interop --------------------------- */
-
-#ifndef WGL_NV_DX_interop
-#define WGL_NV_DX_interop 1
-
-#define WGL_ACCESS_READ_ONLY_NV 0x0000
-#define WGL_ACCESS_READ_WRITE_NV 0x0001
-#define WGL_ACCESS_WRITE_DISCARD_NV 0x0002
-
-typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
-typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);
-typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
-typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void* dxDevice);
-typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void* dxObject, GLuint name, GLenum type, GLenum access);
-typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void* dxObject, HANDLE shareHandle);
-typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);
-typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
-
-#define wglDXCloseDeviceNV WGLEW_GET_FUN(__wglewDXCloseDeviceNV)
-#define wglDXLockObjectsNV WGLEW_GET_FUN(__wglewDXLockObjectsNV)
-#define wglDXObjectAccessNV WGLEW_GET_FUN(__wglewDXObjectAccessNV)
-#define wglDXOpenDeviceNV WGLEW_GET_FUN(__wglewDXOpenDeviceNV)
-#define wglDXRegisterObjectNV WGLEW_GET_FUN(__wglewDXRegisterObjectNV)
-#define wglDXSetResourceShareHandleNV WGLEW_GET_FUN(__wglewDXSetResourceShareHandleNV)
-#define wglDXUnlockObjectsNV WGLEW_GET_FUN(__wglewDXUnlockObjectsNV)
-#define wglDXUnregisterObjectNV WGLEW_GET_FUN(__wglewDXUnregisterObjectNV)
-
-#define WGLEW_NV_DX_interop WGLEW_GET_VAR(__WGLEW_NV_DX_interop)
-
-#endif /* WGL_NV_DX_interop */
-
-/* --------------------------- WGL_NV_DX_interop2 -------------------------- */
-
-#ifndef WGL_NV_DX_interop2
-#define WGL_NV_DX_interop2 1
-
-#define WGLEW_NV_DX_interop2 WGLEW_GET_VAR(__WGLEW_NV_DX_interop2)
-
-#endif /* WGL_NV_DX_interop2 */
-
-/* --------------------------- WGL_NV_copy_image --------------------------- */
-
-#ifndef WGL_NV_copy_image
-#define WGL_NV_copy_image 1
-
-typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
-
-#define wglCopyImageSubDataNV WGLEW_GET_FUN(__wglewCopyImageSubDataNV)
-
-#define WGLEW_NV_copy_image WGLEW_GET_VAR(__WGLEW_NV_copy_image)
-
-#endif /* WGL_NV_copy_image */
-
-/* ------------------------ WGL_NV_delay_before_swap ----------------------- */
-
-#ifndef WGL_NV_delay_before_swap
-#define WGL_NV_delay_before_swap 1
-
-typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);
-
-#define wglDelayBeforeSwapNV WGLEW_GET_FUN(__wglewDelayBeforeSwapNV)
-
-#define WGLEW_NV_delay_before_swap WGLEW_GET_VAR(__WGLEW_NV_delay_before_swap)
-
-#endif /* WGL_NV_delay_before_swap */
-
-/* -------------------------- WGL_NV_float_buffer -------------------------- */
-
-#ifndef WGL_NV_float_buffer
-#define WGL_NV_float_buffer 1
-
-#define WGL_FLOAT_COMPONENTS_NV 0x20B0
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
-#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
-#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
-#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
-#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
-
-#define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer)
-
-#endif /* WGL_NV_float_buffer */
-
-/* -------------------------- WGL_NV_gpu_affinity -------------------------- */
-
-#ifndef WGL_NV_gpu_affinity
-#define WGL_NV_gpu_affinity 1
-
-#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
-#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
-
-DECLARE_HANDLE(HGPUNV);
-typedef struct _GPU_DEVICE {
- DWORD cb;
- CHAR DeviceName[32];
- CHAR DeviceString[128];
- DWORD Flags;
- RECT rcVirtualScreen;
-} GPU_DEVICE, *PGPU_DEVICE;
-
-typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
-typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
-typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
-typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
-typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
-
-#define wglCreateAffinityDCNV WGLEW_GET_FUN(__wglewCreateAffinityDCNV)
-#define wglDeleteDCNV WGLEW_GET_FUN(__wglewDeleteDCNV)
-#define wglEnumGpuDevicesNV WGLEW_GET_FUN(__wglewEnumGpuDevicesNV)
-#define wglEnumGpusFromAffinityDCNV WGLEW_GET_FUN(__wglewEnumGpusFromAffinityDCNV)
-#define wglEnumGpusNV WGLEW_GET_FUN(__wglewEnumGpusNV)
-
-#define WGLEW_NV_gpu_affinity WGLEW_GET_VAR(__WGLEW_NV_gpu_affinity)
-
-#endif /* WGL_NV_gpu_affinity */
-
-/* ---------------------- WGL_NV_multisample_coverage ---------------------- */
-
-#ifndef WGL_NV_multisample_coverage
-#define WGL_NV_multisample_coverage 1
-
-#define WGL_COVERAGE_SAMPLES_NV 0x2042
-#define WGL_COLOR_SAMPLES_NV 0x20B9
-
-#define WGLEW_NV_multisample_coverage WGLEW_GET_VAR(__WGLEW_NV_multisample_coverage)
-
-#endif /* WGL_NV_multisample_coverage */
-
-/* -------------------------- WGL_NV_present_video ------------------------- */
-
-#ifndef WGL_NV_present_video
-#define WGL_NV_present_video 1
-
-#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
-
-DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
-
-typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int* piAttribList);
-typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV* phDeviceList);
-typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* piValue);
-
-#define wglBindVideoDeviceNV WGLEW_GET_FUN(__wglewBindVideoDeviceNV)
-#define wglEnumerateVideoDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoDevicesNV)
-#define wglQueryCurrentContextNV WGLEW_GET_FUN(__wglewQueryCurrentContextNV)
-
-#define WGLEW_NV_present_video WGLEW_GET_VAR(__WGLEW_NV_present_video)
-
-#endif /* WGL_NV_present_video */
-
-/* ---------------------- WGL_NV_render_depth_texture ---------------------- */
-
-#ifndef WGL_NV_render_depth_texture
-#define WGL_NV_render_depth_texture 1
-
-#define WGL_NO_TEXTURE_ARB 0x2077
-#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
-#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
-#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
-#define WGL_DEPTH_COMPONENT_NV 0x20A7
-
-#define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture)
-
-#endif /* WGL_NV_render_depth_texture */
-
-/* -------------------- WGL_NV_render_texture_rectangle -------------------- */
-
-#ifndef WGL_NV_render_texture_rectangle
-#define WGL_NV_render_texture_rectangle 1
-
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
-#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
-
-#define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle)
-
-#endif /* WGL_NV_render_texture_rectangle */
-
-/* --------------------------- WGL_NV_swap_group --------------------------- */
-
-#ifndef WGL_NV_swap_group
-#define WGL_NV_swap_group 1
-
-typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
-typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
-typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint* count);
-typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint *maxBarriers);
-typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint *barrier);
-typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
-
-#define wglBindSwapBarrierNV WGLEW_GET_FUN(__wglewBindSwapBarrierNV)
-#define wglJoinSwapGroupNV WGLEW_GET_FUN(__wglewJoinSwapGroupNV)
-#define wglQueryFrameCountNV WGLEW_GET_FUN(__wglewQueryFrameCountNV)
-#define wglQueryMaxSwapGroupsNV WGLEW_GET_FUN(__wglewQueryMaxSwapGroupsNV)
-#define wglQuerySwapGroupNV WGLEW_GET_FUN(__wglewQuerySwapGroupNV)
-#define wglResetFrameCountNV WGLEW_GET_FUN(__wglewResetFrameCountNV)
-
-#define WGLEW_NV_swap_group WGLEW_GET_VAR(__WGLEW_NV_swap_group)
-
-#endif /* WGL_NV_swap_group */
-
-/* ----------------------- WGL_NV_vertex_array_range ----------------------- */
-
-#ifndef WGL_NV_vertex_array_range
-#define WGL_NV_vertex_array_range 1
-
-typedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);
-typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
-
-#define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV)
-#define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV)
-
-#define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range)
-
-#endif /* WGL_NV_vertex_array_range */
-
-/* -------------------------- WGL_NV_video_capture ------------------------- */
-
-#ifndef WGL_NV_video_capture
-#define WGL_NV_video_capture 1
-
-#define WGL_UNIQUE_ID_NV 0x20CE
-#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
-
-DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
-
-typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
-typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV* phDeviceList);
-typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
-typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int* piValue);
-typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
-
-#define wglBindVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewBindVideoCaptureDeviceNV)
-#define wglEnumerateVideoCaptureDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoCaptureDevicesNV)
-#define wglLockVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewLockVideoCaptureDeviceNV)
-#define wglQueryVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewQueryVideoCaptureDeviceNV)
-#define wglReleaseVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoCaptureDeviceNV)
-
-#define WGLEW_NV_video_capture WGLEW_GET_VAR(__WGLEW_NV_video_capture)
-
-#endif /* WGL_NV_video_capture */
-
-/* -------------------------- WGL_NV_video_output -------------------------- */
-
-#ifndef WGL_NV_video_output
-#define WGL_NV_video_output 1
-
-#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
-#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
-#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
-#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
-#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
-#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
-#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
-#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
-#define WGL_VIDEO_OUT_FRAME 0x20C8
-#define WGL_VIDEO_OUT_FIELD_1 0x20C9
-#define WGL_VIDEO_OUT_FIELD_2 0x20CA
-#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
-#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
-
-DECLARE_HANDLE(HPVIDEODEV);
-
-typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
-typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV* hVideoDevice);
-typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
-typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
-typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
-typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long* pulCounterPbuffer, BOOL bBlock);
-
-#define wglBindVideoImageNV WGLEW_GET_FUN(__wglewBindVideoImageNV)
-#define wglGetVideoDeviceNV WGLEW_GET_FUN(__wglewGetVideoDeviceNV)
-#define wglGetVideoInfoNV WGLEW_GET_FUN(__wglewGetVideoInfoNV)
-#define wglReleaseVideoDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoDeviceNV)
-#define wglReleaseVideoImageNV WGLEW_GET_FUN(__wglewReleaseVideoImageNV)
-#define wglSendPbufferToVideoNV WGLEW_GET_FUN(__wglewSendPbufferToVideoNV)
-
-#define WGLEW_NV_video_output WGLEW_GET_VAR(__WGLEW_NV_video_output)
-
-#endif /* WGL_NV_video_output */
-
-/* -------------------------- WGL_OML_sync_control ------------------------- */
-
-#ifndef WGL_OML_sync_control
-#define WGL_OML_sync_control 1
-
-typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator);
-typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc);
-typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
-typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
-typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc);
-typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc);
-
-#define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML)
-#define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML)
-#define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML)
-#define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML)
-#define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML)
-#define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML)
-
-#define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control)
-
-#endif /* WGL_OML_sync_control */
-
-/* ------------------------------------------------------------------------- */
-
-#ifdef GLEW_MX
-#define WGLEW_FUN_EXPORT
-#define WGLEW_VAR_EXPORT
-#else
-#define WGLEW_FUN_EXPORT GLEW_FUN_EXPORT
-#define WGLEW_VAR_EXPORT GLEW_VAR_EXPORT
-#endif /* GLEW_MX */
-
-#ifdef GLEW_MX
-struct WGLEWContextStruct
-{
-#endif /* GLEW_MX */
-
-WGLEW_FUN_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL;
-
-WGLEW_FUN_EXPORT PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD;
-WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD;
-WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD;
-WGLEW_FUN_EXPORT PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD;
-WGLEW_FUN_EXPORT PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD;
-WGLEW_FUN_EXPORT PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD;
-WGLEW_FUN_EXPORT PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD;
-WGLEW_FUN_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD;
-WGLEW_FUN_EXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD;
-
-WGLEW_FUN_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB;
-WGLEW_FUN_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB;
-WGLEW_FUN_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB;
-WGLEW_FUN_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB;
-
-WGLEW_FUN_EXPORT PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB;
-
-WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB;
-
-WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB;
-WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB;
-
-WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB;
-WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB;
-WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB;
-WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB;
-WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB;
-
-WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB;
-WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB;
-WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB;
-
-WGLEW_FUN_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB;
-WGLEW_FUN_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB;
-WGLEW_FUN_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB;
-
-WGLEW_FUN_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT;
-WGLEW_FUN_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT;
-WGLEW_FUN_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT;
-WGLEW_FUN_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT;
-
-WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT;
-
-WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT;
-WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT;
-
-WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT;
-WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT;
-WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT;
-WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT;
-WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT;
-
-WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT;
-WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT;
-WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT;
-
-WGLEW_FUN_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT;
-WGLEW_FUN_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT;
-
-WGLEW_FUN_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D;
-WGLEW_FUN_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D;
-
-WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D;
-WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D;
-WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D;
-WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D;
-
-WGLEW_FUN_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D;
-WGLEW_FUN_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D;
-WGLEW_FUN_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D;
-WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D;
-WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D;
-WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D;
-WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D;
-WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D;
-WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D;
-WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D;
-WGLEW_FUN_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D;
-WGLEW_FUN_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D;
-
-WGLEW_FUN_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D;
-WGLEW_FUN_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D;
-WGLEW_FUN_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D;
-WGLEW_FUN_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D;
-
-WGLEW_FUN_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D;
-WGLEW_FUN_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D;
-WGLEW_FUN_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D;
-WGLEW_FUN_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D;
-
-WGLEW_FUN_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D;
-WGLEW_FUN_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D;
-WGLEW_FUN_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D;
-WGLEW_FUN_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D;
-
-WGLEW_FUN_EXPORT PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV;
-WGLEW_FUN_EXPORT PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV;
-WGLEW_FUN_EXPORT PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV;
-WGLEW_FUN_EXPORT PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV;
-WGLEW_FUN_EXPORT PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV;
-WGLEW_FUN_EXPORT PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV;
-WGLEW_FUN_EXPORT PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV;
-WGLEW_FUN_EXPORT PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV;
-
-WGLEW_FUN_EXPORT PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV;
-
-WGLEW_FUN_EXPORT PFNWGLDELAYBEFORESWAPNVPROC __wglewDelayBeforeSwapNV;
-
-WGLEW_FUN_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV;
-WGLEW_FUN_EXPORT PFNWGLDELETEDCNVPROC __wglewDeleteDCNV;
-WGLEW_FUN_EXPORT PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV;
-WGLEW_FUN_EXPORT PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV;
-WGLEW_FUN_EXPORT PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV;
-
-WGLEW_FUN_EXPORT PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV;
-WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV;
-WGLEW_FUN_EXPORT PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV;
-
-WGLEW_FUN_EXPORT PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV;
-WGLEW_FUN_EXPORT PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV;
-WGLEW_FUN_EXPORT PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV;
-WGLEW_FUN_EXPORT PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV;
-WGLEW_FUN_EXPORT PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV;
-WGLEW_FUN_EXPORT PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV;
-
-WGLEW_FUN_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV;
-WGLEW_FUN_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV;
-
-WGLEW_FUN_EXPORT PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV;
-WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV;
-WGLEW_FUN_EXPORT PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV;
-WGLEW_FUN_EXPORT PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV;
-WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV;
-
-WGLEW_FUN_EXPORT PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV;
-WGLEW_FUN_EXPORT PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV;
-WGLEW_FUN_EXPORT PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV;
-WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV;
-WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV;
-WGLEW_FUN_EXPORT PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV;
-
-WGLEW_FUN_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML;
-WGLEW_FUN_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML;
-WGLEW_FUN_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML;
-WGLEW_FUN_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML;
-WGLEW_FUN_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML;
-WGLEW_FUN_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML;
-
-#if defined(GLEW_MX)
-GLEWHashList *GLEW_WGL_EXTENSIONS;
-#endif /* GLEW_MX */
-
-WGLEW_VAR_EXPORT GLboolean __WGLEW_3DFX_multisample;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_3DL_stereo_control;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_AMD_gpu_association;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_buffer_region;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_context_flush_control;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_profile;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_robustness;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_extensions_string;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_framebuffer_sRGB;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_make_current_read;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_multisample;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pbuffer;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format_float;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_render_texture;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_robustness_application_isolation;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_robustness_share_group_isolation;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_pixel_format_float;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es2_profile;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es_profile;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_depth_float;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_display_color_table;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_extensions_string;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_framebuffer_sRGB;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_make_current_read;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_multisample;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pbuffer;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format_packed_float;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control_tear;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_digital_video_control;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_gamma;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_genlock;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_image_buffer;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop2;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_copy_image;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_delay_before_swap;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_float_buffer;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_gpu_affinity;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multisample_coverage;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_present_video;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_depth_texture;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_swap_group;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_vertex_array_range;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_capture;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_output;
-WGLEW_VAR_EXPORT GLboolean __WGLEW_OML_sync_control;
-
-#ifdef GLEW_MX
-}; /* WGLEWContextStruct */
-#endif /* GLEW_MX */
-
-/* ------------------------------------------------------------------------- */
-
-#ifdef GLEW_MX
-
-typedef struct WGLEWContextStruct WGLEWContext;
-GLEWAPI GLenum GLEWAPIENTRY wglewContextInit (WGLEWContext *ctx);
-GLEWAPI GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext *ctx, const char *name);
-
-#define wglewInit() wglewContextInit(wglewGetContext())
-#define wglewIsSupported(x) wglewContextIsSupported(wglewGetContext(), x)
-
-#define WGLEW_GET_VAR(x) (*(const GLboolean*)&(wglewGetContext()->x))
-#define WGLEW_GET_FUN(x) wglewGetContext()->x
-
-#else /* GLEW_MX */
-
-#define WGLEW_GET_VAR(x) (*(const GLboolean*)&x)
-#define WGLEW_GET_FUN(x) x
-
-GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name);
-
-#endif /* GLEW_MX */
-
-GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#undef GLEWAPI
-
-#endif /* __wglew_h__ */
diff --git a/Libraries/glew-urkle-core/src/glew.c b/Libraries/glew-urkle-core/src/glew.c
deleted file mode 100644
index 73901ca0..00000000
--- a/Libraries/glew-urkle-core/src/glew.c
+++ /dev/null
@@ -1,19764 +0,0 @@
-/*
-** The OpenGL Extension Wrangler Library
-** Copyright (C) 2008-2014, Nigel Stewart <nigels[]users sourceforge net>
-** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
-** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
-** Copyright (C) 2002, Lev Povalahev
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-** * The name of the author may be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-** THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <GL/glew.h>
-
-#if defined(_WIN32)
-# include <GL/wglew.h>
-#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
-# include <GL/glxew.h>
-#endif
-
-#include <stddef.h> /* For size_t */
-#include <stdlib.h> /* For free and calloc */
-
-
-/*
- * Define glewGetContext and related helper macros.
- */
-#ifdef GLEW_MX
-# define glewGetContext() ctx
-# ifdef _WIN32
-# define GLEW_CONTEXT_ARG_DEF_INIT GLEWContext* ctx
-# define GLEW_CONTEXT_ARG_VAR_INIT ctx
-# define wglewGetContext() ctx
-# define WGLEW_CONTEXT_ARG_DEF_INIT WGLEWContext* ctx
-# define WGLEW_CONTEXT_ARG_DEF_LIST WGLEWContext* ctx
-# else /* _WIN32 */
-# define GLEW_CONTEXT_ARG_DEF_INIT void
-# define GLEW_CONTEXT_ARG_VAR_INIT
-# define glxewGetContext() ctx
-# define GLXEW_CONTEXT_ARG_DEF_INIT void
-# define GLXEW_CONTEXT_ARG_DEF_LIST GLXEWContext* ctx
-# endif /* _WIN32 */
-# define GLEW_CONTEXT_ARG_DEF_LIST GLEWContext* ctx
-#else /* GLEW_MX */
-# define GLEW_CONTEXT_ARG_DEF_INIT void
-# define GLEW_CONTEXT_ARG_VAR_INIT
-# define GLEW_CONTEXT_ARG_DEF_LIST void
-# define WGLEW_CONTEXT_ARG_DEF_INIT void
-# define WGLEW_CONTEXT_ARG_DEF_LIST void
-# define GLXEW_CONTEXT_ARG_DEF_INIT void
-# define GLXEW_CONTEXT_ARG_DEF_LIST void
-#endif /* GLEW_MX */
-
-#if defined(GLEW_REGAL)
-
-/* In GLEW_REGAL mode we call direcly into the linked
- libRegal.so glGetProcAddressREGAL for looking up
- the GL function pointers. */
-
-# undef glGetProcAddressREGAL
-# ifdef WIN32
-extern void * __stdcall glGetProcAddressREGAL(const GLchar *name);
-static void * (__stdcall * regalGetProcAddress) (const GLchar *) = glGetProcAddressREGAL;
-# else
-extern void * glGetProcAddressREGAL(const GLchar *name);
-static void * (*regalGetProcAddress) (const GLchar *) = glGetProcAddressREGAL;
-# endif
-# define glGetProcAddressREGAL GLEW_GET_FUN(__glewGetProcAddressREGAL)
-
-#elif defined(__sgi) || defined (__sun) || defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
-#include <dlfcn.h>
-#include <stdio.h>
-
-void* dlGetProcAddress (const GLubyte* name)
-{
- static void* h = NULL;
- static void* gpa;
-
- if (h == NULL)
- {
- if ((h = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL)) == NULL) return NULL;
- gpa = dlsym(h, "glXGetProcAddress");
- }
-
- if (gpa != NULL)
- return ((void*(*)(const GLubyte*))gpa)(name);
- else
- return dlsym(h, (const char*)name);
-}
-#endif /* __sgi || __sun || GLEW_APPLE_GLX */
-
-#if defined(__APPLE__)
-#include <string.h>
-#include <AvailabilityMacros.h>
-
-#ifdef MAC_OS_X_VERSION_10_3
-
-#include <dlfcn.h>
-
-void* NSGLGetProcAddress (const GLubyte *name)
-{
- static void* image = NULL;
- void* addr;
- if (NULL == image)
- {
- image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
- }
- if( !image ) return NULL;
- addr = dlsym(image, (const char*)name);
- if( addr ) return addr;
-#ifdef GLEW_APPLE_GLX
- return dlGetProcAddress( name ); // try next for glx symbols
-#else
- return NULL;
-#endif
-}
-#else
-
-#include <mach-o/dyld.h>
-
-void* NSGLGetProcAddress (const GLubyte *name)
-{
- static const struct mach_header* image = NULL;
- NSSymbol symbol;
- char* symbolName;
- if (NULL == image)
- {
- image = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", NSADDIMAGE_OPTION_RETURN_ON_ERROR);
- }
- /* prepend a '_' for the Unix C symbol mangling convention */
- symbolName = malloc(strlen((const char*)name) + 2);
- strcpy(symbolName+1, (const char*)name);
- symbolName[0] = '_';
- symbol = NULL;
- /* if (NSIsSymbolNameDefined(symbolName))
- symbol = NSLookupAndBindSymbol(symbolName); */
- symbol = image ? NSLookupSymbolInImage(image, symbolName, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) : NULL;
- free(symbolName);
- if( symbol ) return NSAddressOfSymbol(symbol);
-#ifdef GLEW_APPLE_GLX
- return dlGetProcAddress( name ); // try next for glx symbols
-#else
- return NULL;
-#endif
-}
-#endif /* MAC_OS_X_VERSION_10_3 */
-#endif /* __APPLE__ */
-
-/*
- * Define glewGetProcAddress.
- */
-#if defined(GLEW_REGAL)
-# define glewGetProcAddress(name) regalGetProcAddress((const GLchar *) name)
-#elif defined(_WIN32)
-# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
-#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
-# define glewGetProcAddress(name) NSGLGetProcAddress(name)
-#elif defined(__sgi) || defined(__sun) || defined(__HAIKU__)
-# define glewGetProcAddress(name) dlGetProcAddress(name)
-#elif defined(__ANDROID__)
-# define glewGetProcAddress(name) NULL /* TODO */
-#elif defined(__native_client__)
-# define glewGetProcAddress(name) NULL /* TODO */
-#else /* __linux */
-# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
-#endif
-
-/*
- * Redefine GLEW_GET_VAR etc without const cast
- */
-
-#undef GLEW_GET_VAR
-#ifdef GLEW_MX
-# define GLEW_GET_VAR(x) (glewGetContext()->x)
-#else /* GLEW_MX */
-# define GLEW_GET_VAR(x) (x)
-#endif /* GLEW_MX */
-
-#ifdef WGLEW_GET_VAR
-# undef WGLEW_GET_VAR
-# ifdef GLEW_MX
-# define WGLEW_GET_VAR(x) (wglewGetContext()->x)
-# else /* GLEW_MX */
-# define WGLEW_GET_VAR(x) (x)
-# endif /* GLEW_MX */
-#endif /* WGLEW_GET_VAR */
-
-#ifdef GLXEW_GET_VAR
-# undef GLXEW_GET_VAR
-# ifdef GLEW_MX
-# define GLXEW_GET_VAR(x) (glxewGetContext()->x)
-# else /* GLEW_MX */
-# define GLXEW_GET_VAR(x) (x)
-# endif /* GLEW_MX */
-#endif /* GLXEW_GET_VAR */
-
-/*
- * GLEW, just like OpenGL or GLU, does not rely on the standard C library.
- * These functions implement the functionality required in this file.
- */
-static GLuint _glewStrLen (const GLubyte* s)
-{
- GLuint i=0;
- if (s == NULL) return 0;
- while (s[i] != '\0') i++;
- return i;
-}
-
-static GLuint _glewStrCLen (const GLubyte* s, GLubyte c)
-{
- GLuint i=0;
- if (s == NULL) return 0;
- while (s[i] != '\0' && s[i] != c) i++;
- return (s[i] == '\0' || s[i] == c) ? i : 0;
-}
-
-static GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n)
-{
- GLuint i=0;
- if(a == NULL || b == NULL)
- return (a == NULL && b == NULL && n == 0) ? GL_TRUE : GL_FALSE;
- while (i < n && a[i] != '\0' && b[i] != '\0' && a[i] == b[i]) i++;
- return i == n ? GL_TRUE : GL_FALSE;
-}
-
-static GLboolean _glewStrSame1 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
-{
- while (*na > 0 && (**a == ' ' || **a == '\n' || **a == '\r' || **a == '\t'))
- {
- (*a)++;
- (*na)--;
- }
- if(*na >= nb)
- {
- GLuint i=0;
- while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++;
- if(i == nb)
- {
- *a = *a + nb;
- *na = *na - nb;
- return GL_TRUE;
- }
- }
- return GL_FALSE;
-}
-
-static GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
-{
- if(*na >= nb)
- {
- GLuint i=0;
- while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++;
- if(i == nb)
- {
- *a = *a + nb;
- *na = *na - nb;
- return GL_TRUE;
- }
- }
- return GL_FALSE;
-}
-
-static GLboolean _glewStrSame3 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
-{
- if(*na >= nb)
- {
- GLuint i=0;
- while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++;
- if (i == nb && (*na == nb || (*a)[i] == ' ' || (*a)[i] == '\n' || (*a)[i] == '\r' || (*a)[i] == '\t'))
- {
- *a = *a + nb;
- *na = *na - nb;
- return GL_TRUE;
- }
- }
- return GL_FALSE;
-}
-
-struct GLEWHashListStruct
-{
- const GLubyte **list;
- GLuint size;
-};
-
-#if !defined(GLEW_MX)
-GLEWHashList *GLEW_GL_EXTENSIONS;
-#if defined(_WIN32)
-GLEWHashList *GLEW_WGL_EXTENSIONS;
-#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
-GLEWHashList *GLEW_GLX_EXTENSIONS;
-#endif
-#endif // !defined(GLEW_MX)
-
-/* A simple open addressing hashset for extensions */
-static GLuint hash_string(const GLubyte * key)
-{
- GLuint hash = 0;
- GLuint i = 0;
- GLuint len = _glewStrCLen(key, ' ');
- for (; i < len; ++i)
- {
- hash += key[i];
- hash += (hash << 10);
- hash ^= (hash >> 6);
- }
- hash += (hash << 3);
- hash ^= (hash >> 11);
- hash += (hash << 15);
-
- return hash;
-}
-
-
-static void _glewHashListFree(GLEWHashList *list)
-{
- if (list->list != NULL) {
- free( (void*)list->list);
- list->list = NULL;
- list->size = 0;
- }
-}
-
-
-static void _glewHashListAlloc(GLEWHashList *list, GLuint nelts)
-{
- GLuint size = nelts * 3 / 2;
- _glewHashListFree(list);
- list->list = calloc(size, sizeof(const GLubyte*));
- list->size = size;
-}
-
-static void _glewHashListInsert(GLEWHashList *list, const GLubyte *name)
-{
- GLuint hash = hash_string(name);
-
- if (list->list == NULL) return;
-
- while(list->list[hash % list->size] != NULL)
- hash++;
-
- list->list[hash % list->size] = name;
-}
-
-static GLboolean _glewHashListExists(GLEWHashList *list, const GLubyte *name)
-{
- GLuint hash;
- GLuint len;
-
- if (list->list == NULL) return GL_FALSE;
-
- hash = hash_string((const GLubyte*)name);
- len = _glewStrLen((const GLubyte*)name);
-
- /*
- * As the hashset is bigger than the number of extensions
- * this will eventually break.
- */
- while(1)
- {
- GLuint index = hash % list->size;
- GLuint n;
- if (list->list[index] == NULL)
- break;
-
- n = _glewStrCLen(list->list[index], ' ');
-
- if (len == n && _glewStrSame(list->list[index], (const GLubyte*)name, n)) return GL_TRUE;
- ++hash;
- }
-
- return GL_FALSE;
-}
-
-static GLboolean _glewBuildGL3ExtensionList(GLEWHashList *list)
-{
- GLint n, i;
- glGetIntegerv(GL_NUM_EXTENSIONS, &n);
- glGetStringi = (PFNGLGETSTRINGIPROC)glewGetProcAddress((const GLubyte*)"glGetStringi");
-
- _glewHashListAlloc(list, n);
- for (i = 0; i < n; ++i)
- {
- const GLubyte* extension = glGetStringi(GL_EXTENSIONS, i);
- _glewHashListInsert(list, extension);
- }
-
- return GL_TRUE;
-}
-/*
- * initialize the extension list hash from a extension string list
- */
-static GLboolean _glewBuildHashListFromString(const GLubyte* extensions, GLEWHashList *list)
-{
- const GLubyte* extStart;
- const GLubyte* extEnd;
- const GLubyte* p;
- GLuint extCount = 0;
-
- extStart = extensions;
- if (extStart == 0)
- extStart = (const GLubyte*)"";
- extEnd = extStart + _glewStrLen(extStart);
-
- // first scan to determine number of extensions
- p = extStart;
- while (p < extEnd)
- {
- GLuint n = _glewStrCLen(p, ' ');
- p += n + 1;
- ++extCount;
- }
-
- _glewHashListAlloc(list, extCount);
-
- // Second scan to populate the hash set
- p = extStart;
- while (p < extEnd)
- {
- GLuint n = _glewStrCLen(p, ' ');
- _glewHashListInsert(list, p);
- p += n+1;
- }
-
- return GL_TRUE;
-}
-#if !defined(_WIN32) || !defined(GLEW_MX)
-
-PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D = NULL;
-PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements = NULL;
-PFNGLTEXIMAGE3DPROC __glewTexImage3D = NULL;
-PFNGLTEXSUBIMAGE3DPROC __glewTexSubImage3D = NULL;
-
-PFNGLACTIVETEXTUREPROC __glewActiveTexture = NULL;
-PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture = NULL;
-PFNGLCOMPRESSEDTEXIMAGE1DPROC __glewCompressedTexImage1D = NULL;
-PFNGLCOMPRESSEDTEXIMAGE2DPROC __glewCompressedTexImage2D = NULL;
-PFNGLCOMPRESSEDTEXIMAGE3DPROC __glewCompressedTexImage3D = NULL;
-PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC __glewCompressedTexSubImage1D = NULL;
-PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC __glewCompressedTexSubImage2D = NULL;
-PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC __glewCompressedTexSubImage3D = NULL;
-PFNGLGETCOMPRESSEDTEXIMAGEPROC __glewGetCompressedTexImage = NULL;
-PFNGLLOADTRANSPOSEMATRIXDPROC __glewLoadTransposeMatrixd = NULL;
-PFNGLLOADTRANSPOSEMATRIXFPROC __glewLoadTransposeMatrixf = NULL;
-PFNGLMULTTRANSPOSEMATRIXDPROC __glewMultTransposeMatrixd = NULL;
-PFNGLMULTTRANSPOSEMATRIXFPROC __glewMultTransposeMatrixf = NULL;
-PFNGLMULTITEXCOORD1DPROC __glewMultiTexCoord1d = NULL;
-PFNGLMULTITEXCOORD1DVPROC __glewMultiTexCoord1dv = NULL;
-PFNGLMULTITEXCOORD1FPROC __glewMultiTexCoord1f = NULL;
-PFNGLMULTITEXCOORD1FVPROC __glewMultiTexCoord1fv = NULL;
-PFNGLMULTITEXCOORD1IPROC __glewMultiTexCoord1i = NULL;
-PFNGLMULTITEXCOORD1IVPROC __glewMultiTexCoord1iv = NULL;
-PFNGLMULTITEXCOORD1SPROC __glewMultiTexCoord1s = NULL;
-PFNGLMULTITEXCOORD1SVPROC __glewMultiTexCoord1sv = NULL;
-PFNGLMULTITEXCOORD2DPROC __glewMultiTexCoord2d = NULL;
-PFNGLMULTITEXCOORD2DVPROC __glewMultiTexCoord2dv = NULL;
-PFNGLMULTITEXCOORD2FPROC __glewMultiTexCoord2f = NULL;
-PFNGLMULTITEXCOORD2FVPROC __glewMultiTexCoord2fv = NULL;
-PFNGLMULTITEXCOORD2IPROC __glewMultiTexCoord2i = NULL;
-PFNGLMULTITEXCOORD2IVPROC __glewMultiTexCoord2iv = NULL;
-PFNGLMULTITEXCOORD2SPROC __glewMultiTexCoord2s = NULL;
-PFNGLMULTITEXCOORD2SVPROC __glewMultiTexCoord2sv = NULL;
-PFNGLMULTITEXCOORD3DPROC __glewMultiTexCoord3d = NULL;
-PFNGLMULTITEXCOORD3DVPROC __glewMultiTexCoord3dv = NULL;
-PFNGLMULTITEXCOORD3FPROC __glewMultiTexCoord3f = NULL;
-PFNGLMULTITEXCOORD3FVPROC __glewMultiTexCoord3fv = NULL;
-PFNGLMULTITEXCOORD3IPROC __glewMultiTexCoord3i = NULL;
-PFNGLMULTITEXCOORD3IVPROC __glewMultiTexCoord3iv = NULL;
-PFNGLMULTITEXCOORD3SPROC __glewMultiTexCoord3s = NULL;
-PFNGLMULTITEXCOORD3SVPROC __glewMultiTexCoord3sv = NULL;
-PFNGLMULTITEXCOORD4DPROC __glewMultiTexCoord4d = NULL;
-PFNGLMULTITEXCOORD4DVPROC __glewMultiTexCoord4dv = NULL;
-PFNGLMULTITEXCOORD4FPROC __glewMultiTexCoord4f = NULL;
-PFNGLMULTITEXCOORD4FVPROC __glewMultiTexCoord4fv = NULL;
-PFNGLMULTITEXCOORD4IPROC __glewMultiTexCoord4i = NULL;
-PFNGLMULTITEXCOORD4IVPROC __glewMultiTexCoord4iv = NULL;
-PFNGLMULTITEXCOORD4SPROC __glewMultiTexCoord4s = NULL;
-PFNGLMULTITEXCOORD4SVPROC __glewMultiTexCoord4sv = NULL;
-PFNGLSAMPLECOVERAGEPROC __glewSampleCoverage = NULL;
-
-PFNGLBLENDCOLORPROC __glewBlendColor = NULL;
-PFNGLBLENDEQUATIONPROC __glewBlendEquation = NULL;
-PFNGLBLENDFUNCSEPARATEPROC __glewBlendFuncSeparate = NULL;
-PFNGLFOGCOORDPOINTERPROC __glewFogCoordPointer = NULL;
-PFNGLFOGCOORDDPROC __glewFogCoordd = NULL;
-PFNGLFOGCOORDDVPROC __glewFogCoorddv = NULL;
-PFNGLFOGCOORDFPROC __glewFogCoordf = NULL;
-PFNGLFOGCOORDFVPROC __glewFogCoordfv = NULL;
-PFNGLMULTIDRAWARRAYSPROC __glewMultiDrawArrays = NULL;
-PFNGLMULTIDRAWELEMENTSPROC __glewMultiDrawElements = NULL;
-PFNGLPOINTPARAMETERFPROC __glewPointParameterf = NULL;
-PFNGLPOINTPARAMETERFVPROC __glewPointParameterfv = NULL;
-PFNGLPOINTPARAMETERIPROC __glewPointParameteri = NULL;
-PFNGLPOINTPARAMETERIVPROC __glewPointParameteriv = NULL;
-PFNGLSECONDARYCOLOR3BPROC __glewSecondaryColor3b = NULL;
-PFNGLSECONDARYCOLOR3BVPROC __glewSecondaryColor3bv = NULL;
-PFNGLSECONDARYCOLOR3DPROC __glewSecondaryColor3d = NULL;
-PFNGLSECONDARYCOLOR3DVPROC __glewSecondaryColor3dv = NULL;
-PFNGLSECONDARYCOLOR3FPROC __glewSecondaryColor3f = NULL;
-PFNGLSECONDARYCOLOR3FVPROC __glewSecondaryColor3fv = NULL;
-PFNGLSECONDARYCOLOR3IPROC __glewSecondaryColor3i = NULL;
-PFNGLSECONDARYCOLOR3IVPROC __glewSecondaryColor3iv = NULL;
-PFNGLSECONDARYCOLOR3SPROC __glewSecondaryColor3s = NULL;
-PFNGLSECONDARYCOLOR3SVPROC __glewSecondaryColor3sv = NULL;
-PFNGLSECONDARYCOLOR3UBPROC __glewSecondaryColor3ub = NULL;
-PFNGLSECONDARYCOLOR3UBVPROC __glewSecondaryColor3ubv = NULL;
-PFNGLSECONDARYCOLOR3UIPROC __glewSecondaryColor3ui = NULL;
-PFNGLSECONDARYCOLOR3UIVPROC __glewSecondaryColor3uiv = NULL;
-PFNGLSECONDARYCOLOR3USPROC __glewSecondaryColor3us = NULL;
-PFNGLSECONDARYCOLOR3USVPROC __glewSecondaryColor3usv = NULL;
-PFNGLSECONDARYCOLORPOINTERPROC __glewSecondaryColorPointer = NULL;
-PFNGLWINDOWPOS2DPROC __glewWindowPos2d = NULL;
-PFNGLWINDOWPOS2DVPROC __glewWindowPos2dv = NULL;
-PFNGLWINDOWPOS2FPROC __glewWindowPos2f = NULL;
-PFNGLWINDOWPOS2FVPROC __glewWindowPos2fv = NULL;
-PFNGLWINDOWPOS2IPROC __glewWindowPos2i = NULL;
-PFNGLWINDOWPOS2IVPROC __glewWindowPos2iv = NULL;
-PFNGLWINDOWPOS2SPROC __glewWindowPos2s = NULL;
-PFNGLWINDOWPOS2SVPROC __glewWindowPos2sv = NULL;
-PFNGLWINDOWPOS3DPROC __glewWindowPos3d = NULL;
-PFNGLWINDOWPOS3DVPROC __glewWindowPos3dv = NULL;
-PFNGLWINDOWPOS3FPROC __glewWindowPos3f = NULL;
-PFNGLWINDOWPOS3FVPROC __glewWindowPos3fv = NULL;
-PFNGLWINDOWPOS3IPROC __glewWindowPos3i = NULL;
-PFNGLWINDOWPOS3IVPROC __glewWindowPos3iv = NULL;
-PFNGLWINDOWPOS3SPROC __glewWindowPos3s = NULL;
-PFNGLWINDOWPOS3SVPROC __glewWindowPos3sv = NULL;
-
-PFNGLBEGINQUERYPROC __glewBeginQuery = NULL;
-PFNGLBINDBUFFERPROC __glewBindBuffer = NULL;
-PFNGLBUFFERDATAPROC __glewBufferData = NULL;
-PFNGLBUFFERSUBDATAPROC __glewBufferSubData = NULL;
-PFNGLDELETEBUFFERSPROC __glewDeleteBuffers = NULL;
-PFNGLDELETEQUERIESPROC __glewDeleteQueries = NULL;
-PFNGLENDQUERYPROC __glewEndQuery = NULL;
-PFNGLGENBUFFERSPROC __glewGenBuffers = NULL;
-PFNGLGENQUERIESPROC __glewGenQueries = NULL;
-PFNGLGETBUFFERPARAMETERIVPROC __glewGetBufferParameteriv = NULL;
-PFNGLGETBUFFERPOINTERVPROC __glewGetBufferPointerv = NULL;
-PFNGLGETBUFFERSUBDATAPROC __glewGetBufferSubData = NULL;
-PFNGLGETQUERYOBJECTIVPROC __glewGetQueryObjectiv = NULL;
-PFNGLGETQUERYOBJECTUIVPROC __glewGetQueryObjectuiv = NULL;
-PFNGLGETQUERYIVPROC __glewGetQueryiv = NULL;
-PFNGLISBUFFERPROC __glewIsBuffer = NULL;
-PFNGLISQUERYPROC __glewIsQuery = NULL;
-PFNGLMAPBUFFERPROC __glewMapBuffer = NULL;
-PFNGLUNMAPBUFFERPROC __glewUnmapBuffer = NULL;
-
-PFNGLATTACHSHADERPROC __glewAttachShader = NULL;
-PFNGLBINDATTRIBLOCATIONPROC __glewBindAttribLocation = NULL;
-PFNGLBLENDEQUATIONSEPARATEPROC __glewBlendEquationSeparate = NULL;
-PFNGLCOMPILESHADERPROC __glewCompileShader = NULL;
-PFNGLCREATEPROGRAMPROC __glewCreateProgram = NULL;
-PFNGLCREATESHADERPROC __glewCreateShader = NULL;
-PFNGLDELETEPROGRAMPROC __glewDeleteProgram = NULL;
-PFNGLDELETESHADERPROC __glewDeleteShader = NULL;
-PFNGLDETACHSHADERPROC __glewDetachShader = NULL;
-PFNGLDISABLEVERTEXATTRIBARRAYPROC __glewDisableVertexAttribArray = NULL;
-PFNGLDRAWBUFFERSPROC __glewDrawBuffers = NULL;
-PFNGLENABLEVERTEXATTRIBARRAYPROC __glewEnableVertexAttribArray = NULL;
-PFNGLGETACTIVEATTRIBPROC __glewGetActiveAttrib = NULL;
-PFNGLGETACTIVEUNIFORMPROC __glewGetActiveUniform = NULL;
-PFNGLGETATTACHEDSHADERSPROC __glewGetAttachedShaders = NULL;
-PFNGLGETATTRIBLOCATIONPROC __glewGetAttribLocation = NULL;
-PFNGLGETPROGRAMINFOLOGPROC __glewGetProgramInfoLog = NULL;
-PFNGLGETPROGRAMIVPROC __glewGetProgramiv = NULL;
-PFNGLGETSHADERINFOLOGPROC __glewGetShaderInfoLog = NULL;
-PFNGLGETSHADERSOURCEPROC __glewGetShaderSource = NULL;
-PFNGLGETSHADERIVPROC __glewGetShaderiv = NULL;
-PFNGLGETUNIFORMLOCATIONPROC __glewGetUniformLocation = NULL;
-PFNGLGETUNIFORMFVPROC __glewGetUniformfv = NULL;
-PFNGLGETUNIFORMIVPROC __glewGetUniformiv = NULL;
-PFNGLGETVERTEXATTRIBPOINTERVPROC __glewGetVertexAttribPointerv = NULL;
-PFNGLGETVERTEXATTRIBDVPROC __glewGetVertexAttribdv = NULL;
-PFNGLGETVERTEXATTRIBFVPROC __glewGetVertexAttribfv = NULL;
-PFNGLGETVERTEXATTRIBIVPROC __glewGetVertexAttribiv = NULL;
-PFNGLISPROGRAMPROC __glewIsProgram = NULL;
-PFNGLISSHADERPROC __glewIsShader = NULL;
-PFNGLLINKPROGRAMPROC __glewLinkProgram = NULL;
-PFNGLSHADERSOURCEPROC __glewShaderSource = NULL;
-PFNGLSTENCILFUNCSEPARATEPROC __glewStencilFuncSeparate = NULL;
-PFNGLSTENCILMASKSEPARATEPROC __glewStencilMaskSeparate = NULL;
-PFNGLSTENCILOPSEPARATEPROC __glewStencilOpSeparate = NULL;
-PFNGLUNIFORM1FPROC __glewUniform1f = NULL;
-PFNGLUNIFORM1FVPROC __glewUniform1fv = NULL;
-PFNGLUNIFORM1IPROC __glewUniform1i = NULL;
-PFNGLUNIFORM1IVPROC __glewUniform1iv = NULL;
-PFNGLUNIFORM2FPROC __glewUniform2f = NULL;
-PFNGLUNIFORM2FVPROC __glewUniform2fv = NULL;
-PFNGLUNIFORM2IPROC __glewUniform2i = NULL;
-PFNGLUNIFORM2IVPROC __glewUniform2iv = NULL;
-PFNGLUNIFORM3FPROC __glewUniform3f = NULL;
-PFNGLUNIFORM3FVPROC __glewUniform3fv = NULL;
-PFNGLUNIFORM3IPROC __glewUniform3i = NULL;
-PFNGLUNIFORM3IVPROC __glewUniform3iv = NULL;
-PFNGLUNIFORM4FPROC __glewUniform4f = NULL;
-PFNGLUNIFORM4FVPROC __glewUniform4fv = NULL;
-PFNGLUNIFORM4IPROC __glewUniform4i = NULL;
-PFNGLUNIFORM4IVPROC __glewUniform4iv = NULL;
-PFNGLUNIFORMMATRIX2FVPROC __glewUniformMatrix2fv = NULL;
-PFNGLUNIFORMMATRIX3FVPROC __glewUniformMatrix3fv = NULL;
-PFNGLUNIFORMMATRIX4FVPROC __glewUniformMatrix4fv = NULL;
-PFNGLUSEPROGRAMPROC __glewUseProgram = NULL;
-PFNGLVALIDATEPROGRAMPROC __glewValidateProgram = NULL;
-PFNGLVERTEXATTRIB1DPROC __glewVertexAttrib1d = NULL;
-PFNGLVERTEXATTRIB1DVPROC __glewVertexAttrib1dv = NULL;
-PFNGLVERTEXATTRIB1FPROC __glewVertexAttrib1f = NULL;
-PFNGLVERTEXATTRIB1FVPROC __glewVertexAttrib1fv = NULL;
-PFNGLVERTEXATTRIB1SPROC __glewVertexAttrib1s = NULL;
-PFNGLVERTEXATTRIB1SVPROC __glewVertexAttrib1sv = NULL;
-PFNGLVERTEXATTRIB2DPROC __glewVertexAttrib2d = NULL;
-PFNGLVERTEXATTRIB2DVPROC __glewVertexAttrib2dv = NULL;
-PFNGLVERTEXATTRIB2FPROC __glewVertexAttrib2f = NULL;
-PFNGLVERTEXATTRIB2FVPROC __glewVertexAttrib2fv = NULL;
-PFNGLVERTEXATTRIB2SPROC __glewVertexAttrib2s = NULL;
-PFNGLVERTEXATTRIB2SVPROC __glewVertexAttrib2sv = NULL;
-PFNGLVERTEXATTRIB3DPROC __glewVertexAttrib3d = NULL;
-PFNGLVERTEXATTRIB3DVPROC __glewVertexAttrib3dv = NULL;
-PFNGLVERTEXATTRIB3FPROC __glewVertexAttrib3f = NULL;
-PFNGLVERTEXATTRIB3FVPROC __glewVertexAttrib3fv = NULL;
-PFNGLVERTEXATTRIB3SPROC __glewVertexAttrib3s = NULL;
-PFNGLVERTEXATTRIB3SVPROC __glewVertexAttrib3sv = NULL;
-PFNGLVERTEXATTRIB4NBVPROC __glewVertexAttrib4Nbv = NULL;
-PFNGLVERTEXATTRIB4NIVPROC __glewVertexAttrib4Niv = NULL;
-PFNGLVERTEXATTRIB4NSVPROC __glewVertexAttrib4Nsv = NULL;
-PFNGLVERTEXATTRIB4NUBPROC __glewVertexAttrib4Nub = NULL;
-PFNGLVERTEXATTRIB4NUBVPROC __glewVertexAttrib4Nubv = NULL;
-PFNGLVERTEXATTRIB4NUIVPROC __glewVertexAttrib4Nuiv = NULL;
-PFNGLVERTEXATTRIB4NUSVPROC __glewVertexAttrib4Nusv = NULL;
-PFNGLVERTEXATTRIB4BVPROC __glewVertexAttrib4bv = NULL;
-PFNGLVERTEXATTRIB4DPROC __glewVertexAttrib4d = NULL;
-PFNGLVERTEXATTRIB4DVPROC __glewVertexAttrib4dv = NULL;
-PFNGLVERTEXATTRIB4FPROC __glewVertexAttrib4f = NULL;
-PFNGLVERTEXATTRIB4FVPROC __glewVertexAttrib4fv = NULL;
-PFNGLVERTEXATTRIB4IVPROC __glewVertexAttrib4iv = NULL;
-PFNGLVERTEXATTRIB4SPROC __glewVertexAttrib4s = NULL;
-PFNGLVERTEXATTRIB4SVPROC __glewVertexAttrib4sv = NULL;
-PFNGLVERTEXATTRIB4UBVPROC __glewVertexAttrib4ubv = NULL;
-PFNGLVERTEXATTRIB4UIVPROC __glewVertexAttrib4uiv = NULL;
-PFNGLVERTEXATTRIB4USVPROC __glewVertexAttrib4usv = NULL;
-PFNGLVERTEXATTRIBPOINTERPROC __glewVertexAttribPointer = NULL;
-
-PFNGLUNIFORMMATRIX2X3FVPROC __glewUniformMatrix2x3fv = NULL;
-PFNGLUNIFORMMATRIX2X4FVPROC __glewUniformMatrix2x4fv = NULL;
-PFNGLUNIFORMMATRIX3X2FVPROC __glewUniformMatrix3x2fv = NULL;
-PFNGLUNIFORMMATRIX3X4FVPROC __glewUniformMatrix3x4fv = NULL;
-PFNGLUNIFORMMATRIX4X2FVPROC __glewUniformMatrix4x2fv = NULL;
-PFNGLUNIFORMMATRIX4X3FVPROC __glewUniformMatrix4x3fv = NULL;
-
-PFNGLBEGINCONDITIONALRENDERPROC __glewBeginConditionalRender = NULL;
-PFNGLBEGINTRANSFORMFEEDBACKPROC __glewBeginTransformFeedback = NULL;
-PFNGLBINDFRAGDATALOCATIONPROC __glewBindFragDataLocation = NULL;
-PFNGLCLAMPCOLORPROC __glewClampColor = NULL;
-PFNGLCLEARBUFFERFIPROC __glewClearBufferfi = NULL;
-PFNGLCLEARBUFFERFVPROC __glewClearBufferfv = NULL;
-PFNGLCLEARBUFFERIVPROC __glewClearBufferiv = NULL;
-PFNGLCLEARBUFFERUIVPROC __glewClearBufferuiv = NULL;
-PFNGLCOLORMASKIPROC __glewColorMaski = NULL;
-PFNGLDISABLEIPROC __glewDisablei = NULL;
-PFNGLENABLEIPROC __glewEnablei = NULL;
-PFNGLENDCONDITIONALRENDERPROC __glewEndConditionalRender = NULL;
-PFNGLENDTRANSFORMFEEDBACKPROC __glewEndTransformFeedback = NULL;
-PFNGLGETBOOLEANI_VPROC __glewGetBooleani_v = NULL;
-PFNGLGETFRAGDATALOCATIONPROC __glewGetFragDataLocation = NULL;
-PFNGLGETSTRINGIPROC __glewGetStringi = NULL;
-PFNGLGETTEXPARAMETERIIVPROC __glewGetTexParameterIiv = NULL;
-PFNGLGETTEXPARAMETERIUIVPROC __glewGetTexParameterIuiv = NULL;
-PFNGLGETTRANSFORMFEEDBACKVARYINGPROC __glewGetTransformFeedbackVarying = NULL;
-PFNGLGETUNIFORMUIVPROC __glewGetUniformuiv = NULL;
-PFNGLGETVERTEXATTRIBIIVPROC __glewGetVertexAttribIiv = NULL;
-PFNGLGETVERTEXATTRIBIUIVPROC __glewGetVertexAttribIuiv = NULL;
-PFNGLISENABLEDIPROC __glewIsEnabledi = NULL;
-PFNGLTEXPARAMETERIIVPROC __glewTexParameterIiv = NULL;
-PFNGLTEXPARAMETERIUIVPROC __glewTexParameterIuiv = NULL;
-PFNGLTRANSFORMFEEDBACKVARYINGSPROC __glewTransformFeedbackVaryings = NULL;
-PFNGLUNIFORM1UIPROC __glewUniform1ui = NULL;
-PFNGLUNIFORM1UIVPROC __glewUniform1uiv = NULL;
-PFNGLUNIFORM2UIPROC __glewUniform2ui = NULL;
-PFNGLUNIFORM2UIVPROC __glewUniform2uiv = NULL;
-PFNGLUNIFORM3UIPROC __glewUniform3ui = NULL;
-PFNGLUNIFORM3UIVPROC __glewUniform3uiv = NULL;
-PFNGLUNIFORM4UIPROC __glewUniform4ui = NULL;
-PFNGLUNIFORM4UIVPROC __glewUniform4uiv = NULL;
-PFNGLVERTEXATTRIBI1IPROC __glewVertexAttribI1i = NULL;
-PFNGLVERTEXATTRIBI1IVPROC __glewVertexAttribI1iv = NULL;
-PFNGLVERTEXATTRIBI1UIPROC __glewVertexAttribI1ui = NULL;
-PFNGLVERTEXATTRIBI1UIVPROC __glewVertexAttribI1uiv = NULL;
-PFNGLVERTEXATTRIBI2IPROC __glewVertexAttribI2i = NULL;
-PFNGLVERTEXATTRIBI2IVPROC __glewVertexAttribI2iv = NULL;
-PFNGLVERTEXATTRIBI2UIPROC __glewVertexAttribI2ui = NULL;
-PFNGLVERTEXATTRIBI2UIVPROC __glewVertexAttribI2uiv = NULL;
-PFNGLVERTEXATTRIBI3IPROC __glewVertexAttribI3i = NULL;
-PFNGLVERTEXATTRIBI3IVPROC __glewVertexAttribI3iv = NULL;
-PFNGLVERTEXATTRIBI3UIPROC __glewVertexAttribI3ui = NULL;
-PFNGLVERTEXATTRIBI3UIVPROC __glewVertexAttribI3uiv = NULL;
-PFNGLVERTEXATTRIBI4BVPROC __glewVertexAttribI4bv = NULL;
-PFNGLVERTEXATTRIBI4IPROC __glewVertexAttribI4i = NULL;
-PFNGLVERTEXATTRIBI4IVPROC __glewVertexAttribI4iv = NULL;
-PFNGLVERTEXATTRIBI4SVPROC __glewVertexAttribI4sv = NULL;
-PFNGLVERTEXATTRIBI4UBVPROC __glewVertexAttribI4ubv = NULL;
-PFNGLVERTEXATTRIBI4UIPROC __glewVertexAttribI4ui = NULL;
-PFNGLVERTEXATTRIBI4UIVPROC __glewVertexAttribI4uiv = NULL;
-PFNGLVERTEXATTRIBI4USVPROC __glewVertexAttribI4usv = NULL;
-PFNGLVERTEXATTRIBIPOINTERPROC __glewVertexAttribIPointer = NULL;
-
-PFNGLDRAWARRAYSINSTANCEDPROC __glewDrawArraysInstanced = NULL;
-PFNGLDRAWELEMENTSINSTANCEDPROC __glewDrawElementsInstanced = NULL;
-PFNGLPRIMITIVERESTARTINDEXPROC __glewPrimitiveRestartIndex = NULL;
-PFNGLTEXBUFFERPROC __glewTexBuffer = NULL;
-
-PFNGLFRAMEBUFFERTEXTUREPROC __glewFramebufferTexture = NULL;
-PFNGLGETBUFFERPARAMETERI64VPROC __glewGetBufferParameteri64v = NULL;
-PFNGLGETINTEGER64I_VPROC __glewGetInteger64i_v = NULL;
-
-PFNGLVERTEXATTRIBDIVISORPROC __glewVertexAttribDivisor = NULL;
-
-PFNGLBLENDEQUATIONSEPARATEIPROC __glewBlendEquationSeparatei = NULL;
-PFNGLBLENDEQUATIONIPROC __glewBlendEquationi = NULL;
-PFNGLBLENDFUNCSEPARATEIPROC __glewBlendFuncSeparatei = NULL;
-PFNGLBLENDFUNCIPROC __glewBlendFunci = NULL;
-PFNGLMINSAMPLESHADINGPROC __glewMinSampleShading = NULL;
-
-PFNGLTBUFFERMASK3DFXPROC __glewTbufferMask3DFX = NULL;
-
-PFNGLDEBUGMESSAGECALLBACKAMDPROC __glewDebugMessageCallbackAMD = NULL;
-PFNGLDEBUGMESSAGEENABLEAMDPROC __glewDebugMessageEnableAMD = NULL;
-PFNGLDEBUGMESSAGEINSERTAMDPROC __glewDebugMessageInsertAMD = NULL;
-PFNGLGETDEBUGMESSAGELOGAMDPROC __glewGetDebugMessageLogAMD = NULL;
-
-PFNGLBLENDEQUATIONINDEXEDAMDPROC __glewBlendEquationIndexedAMD = NULL;
-PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC __glewBlendEquationSeparateIndexedAMD = NULL;
-PFNGLBLENDFUNCINDEXEDAMDPROC __glewBlendFuncIndexedAMD = NULL;
-PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC __glewBlendFuncSeparateIndexedAMD = NULL;
-
-PFNGLVERTEXATTRIBPARAMETERIAMDPROC __glewVertexAttribParameteriAMD = NULL;
-
-PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC __glewMultiDrawArraysIndirectAMD = NULL;
-PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC __glewMultiDrawElementsIndirectAMD = NULL;
-
-PFNGLDELETENAMESAMDPROC __glewDeleteNamesAMD = NULL;
-PFNGLGENNAMESAMDPROC __glewGenNamesAMD = NULL;
-PFNGLISNAMEAMDPROC __glewIsNameAMD = NULL;
-
-PFNGLQUERYOBJECTPARAMETERUIAMDPROC __glewQueryObjectParameteruiAMD = NULL;
-
-PFNGLBEGINPERFMONITORAMDPROC __glewBeginPerfMonitorAMD = NULL;
-PFNGLDELETEPERFMONITORSAMDPROC __glewDeletePerfMonitorsAMD = NULL;
-PFNGLENDPERFMONITORAMDPROC __glewEndPerfMonitorAMD = NULL;
-PFNGLGENPERFMONITORSAMDPROC __glewGenPerfMonitorsAMD = NULL;
-PFNGLGETPERFMONITORCOUNTERDATAAMDPROC __glewGetPerfMonitorCounterDataAMD = NULL;
-PFNGLGETPERFMONITORCOUNTERINFOAMDPROC __glewGetPerfMonitorCounterInfoAMD = NULL;
-PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC __glewGetPerfMonitorCounterStringAMD = NULL;
-PFNGLGETPERFMONITORCOUNTERSAMDPROC __glewGetPerfMonitorCountersAMD = NULL;
-PFNGLGETPERFMONITORGROUPSTRINGAMDPROC __glewGetPerfMonitorGroupStringAMD = NULL;
-PFNGLGETPERFMONITORGROUPSAMDPROC __glewGetPerfMonitorGroupsAMD = NULL;
-PFNGLSELECTPERFMONITORCOUNTERSAMDPROC __glewSelectPerfMonitorCountersAMD = NULL;
-
-PFNGLSETMULTISAMPLEFVAMDPROC __glewSetMultisamplefvAMD = NULL;
-
-PFNGLTEXSTORAGESPARSEAMDPROC __glewTexStorageSparseAMD = NULL;
-PFNGLTEXTURESTORAGESPARSEAMDPROC __glewTextureStorageSparseAMD = NULL;
-
-PFNGLSTENCILOPVALUEAMDPROC __glewStencilOpValueAMD = NULL;
-
-PFNGLTESSELLATIONFACTORAMDPROC __glewTessellationFactorAMD = NULL;
-PFNGLTESSELLATIONMODEAMDPROC __glewTessellationModeAMD = NULL;
-
-PFNGLBLITFRAMEBUFFERANGLEPROC __glewBlitFramebufferANGLE = NULL;
-
-PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC __glewRenderbufferStorageMultisampleANGLE = NULL;
-
-PFNGLDRAWARRAYSINSTANCEDANGLEPROC __glewDrawArraysInstancedANGLE = NULL;
-PFNGLDRAWELEMENTSINSTANCEDANGLEPROC __glewDrawElementsInstancedANGLE = NULL;
-PFNGLVERTEXATTRIBDIVISORANGLEPROC __glewVertexAttribDivisorANGLE = NULL;
-
-PFNGLBEGINQUERYANGLEPROC __glewBeginQueryANGLE = NULL;
-PFNGLDELETEQUERIESANGLEPROC __glewDeleteQueriesANGLE = NULL;
-PFNGLENDQUERYANGLEPROC __glewEndQueryANGLE = NULL;
-PFNGLGENQUERIESANGLEPROC __glewGenQueriesANGLE = NULL;
-PFNGLGETQUERYOBJECTI64VANGLEPROC __glewGetQueryObjecti64vANGLE = NULL;
-PFNGLGETQUERYOBJECTIVANGLEPROC __glewGetQueryObjectivANGLE = NULL;
-PFNGLGETQUERYOBJECTUI64VANGLEPROC __glewGetQueryObjectui64vANGLE = NULL;
-PFNGLGETQUERYOBJECTUIVANGLEPROC __glewGetQueryObjectuivANGLE = NULL;
-PFNGLGETQUERYIVANGLEPROC __glewGetQueryivANGLE = NULL;
-PFNGLISQUERYANGLEPROC __glewIsQueryANGLE = NULL;
-PFNGLQUERYCOUNTERANGLEPROC __glewQueryCounterANGLE = NULL;
-
-PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC __glewGetTranslatedShaderSourceANGLE = NULL;
-
-PFNGLDRAWELEMENTARRAYAPPLEPROC __glewDrawElementArrayAPPLE = NULL;
-PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC __glewDrawRangeElementArrayAPPLE = NULL;
-PFNGLELEMENTPOINTERAPPLEPROC __glewElementPointerAPPLE = NULL;
-PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC __glewMultiDrawElementArrayAPPLE = NULL;
-PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC __glewMultiDrawRangeElementArrayAPPLE = NULL;
-
-PFNGLDELETEFENCESAPPLEPROC __glewDeleteFencesAPPLE = NULL;
-PFNGLFINISHFENCEAPPLEPROC __glewFinishFenceAPPLE = NULL;
-PFNGLFINISHOBJECTAPPLEPROC __glewFinishObjectAPPLE = NULL;
-PFNGLGENFENCESAPPLEPROC __glewGenFencesAPPLE = NULL;
-PFNGLISFENCEAPPLEPROC __glewIsFenceAPPLE = NULL;
-PFNGLSETFENCEAPPLEPROC __glewSetFenceAPPLE = NULL;
-PFNGLTESTFENCEAPPLEPROC __glewTestFenceAPPLE = NULL;
-PFNGLTESTOBJECTAPPLEPROC __glewTestObjectAPPLE = NULL;
-
-PFNGLBUFFERPARAMETERIAPPLEPROC __glewBufferParameteriAPPLE = NULL;
-PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC __glewFlushMappedBufferRangeAPPLE = NULL;
-
-PFNGLGETOBJECTPARAMETERIVAPPLEPROC __glewGetObjectParameterivAPPLE = NULL;
-PFNGLOBJECTPURGEABLEAPPLEPROC __glewObjectPurgeableAPPLE = NULL;
-PFNGLOBJECTUNPURGEABLEAPPLEPROC __glewObjectUnpurgeableAPPLE = NULL;
-
-PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC __glewGetTexParameterPointervAPPLE = NULL;
-PFNGLTEXTURERANGEAPPLEPROC __glewTextureRangeAPPLE = NULL;
-
-PFNGLBINDVERTEXARRAYAPPLEPROC __glewBindVertexArrayAPPLE = NULL;
-PFNGLDELETEVERTEXARRAYSAPPLEPROC __glewDeleteVertexArraysAPPLE = NULL;
-PFNGLGENVERTEXARRAYSAPPLEPROC __glewGenVertexArraysAPPLE = NULL;
-PFNGLISVERTEXARRAYAPPLEPROC __glewIsVertexArrayAPPLE = NULL;
-
-PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC __glewFlushVertexArrayRangeAPPLE = NULL;
-PFNGLVERTEXARRAYPARAMETERIAPPLEPROC __glewVertexArrayParameteriAPPLE = NULL;
-PFNGLVERTEXARRAYRANGEAPPLEPROC __glewVertexArrayRangeAPPLE = NULL;
-
-PFNGLDISABLEVERTEXATTRIBAPPLEPROC __glewDisableVertexAttribAPPLE = NULL;
-PFNGLENABLEVERTEXATTRIBAPPLEPROC __glewEnableVertexAttribAPPLE = NULL;
-PFNGLISVERTEXATTRIBENABLEDAPPLEPROC __glewIsVertexAttribEnabledAPPLE = NULL;
-PFNGLMAPVERTEXATTRIB1DAPPLEPROC __glewMapVertexAttrib1dAPPLE = NULL;
-PFNGLMAPVERTEXATTRIB1FAPPLEPROC __glewMapVertexAttrib1fAPPLE = NULL;
-PFNGLMAPVERTEXATTRIB2DAPPLEPROC __glewMapVertexAttrib2dAPPLE = NULL;
-PFNGLMAPVERTEXATTRIB2FAPPLEPROC __glewMapVertexAttrib2fAPPLE = NULL;
-
-PFNGLCLEARDEPTHFPROC __glewClearDepthf = NULL;
-PFNGLDEPTHRANGEFPROC __glewDepthRangef = NULL;
-PFNGLGETSHADERPRECISIONFORMATPROC __glewGetShaderPrecisionFormat = NULL;
-PFNGLRELEASESHADERCOMPILERPROC __glewReleaseShaderCompiler = NULL;
-PFNGLSHADERBINARYPROC __glewShaderBinary = NULL;
-
-PFNGLMEMORYBARRIERBYREGIONPROC __glewMemoryBarrierByRegion = NULL;
-
-PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC __glewDrawArraysInstancedBaseInstance = NULL;
-PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC __glewDrawElementsInstancedBaseInstance = NULL;
-PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC __glewDrawElementsInstancedBaseVertexBaseInstance = NULL;
-
-PFNGLGETIMAGEHANDLEARBPROC __glewGetImageHandleARB = NULL;
-PFNGLGETTEXTUREHANDLEARBPROC __glewGetTextureHandleARB = NULL;
-PFNGLGETTEXTURESAMPLERHANDLEARBPROC __glewGetTextureSamplerHandleARB = NULL;
-PFNGLGETVERTEXATTRIBLUI64VARBPROC __glewGetVertexAttribLui64vARB = NULL;
-PFNGLISIMAGEHANDLERESIDENTARBPROC __glewIsImageHandleResidentARB = NULL;
-PFNGLISTEXTUREHANDLERESIDENTARBPROC __glewIsTextureHandleResidentARB = NULL;
-PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC __glewMakeImageHandleNonResidentARB = NULL;
-PFNGLMAKEIMAGEHANDLERESIDENTARBPROC __glewMakeImageHandleResidentARB = NULL;
-PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC __glewMakeTextureHandleNonResidentARB = NULL;
-PFNGLMAKETEXTUREHANDLERESIDENTARBPROC __glewMakeTextureHandleResidentARB = NULL;
-PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC __glewProgramUniformHandleui64ARB = NULL;
-PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC __glewProgramUniformHandleui64vARB = NULL;
-PFNGLUNIFORMHANDLEUI64ARBPROC __glewUniformHandleui64ARB = NULL;
-PFNGLUNIFORMHANDLEUI64VARBPROC __glewUniformHandleui64vARB = NULL;
-PFNGLVERTEXATTRIBL1UI64ARBPROC __glewVertexAttribL1ui64ARB = NULL;
-PFNGLVERTEXATTRIBL1UI64VARBPROC __glewVertexAttribL1ui64vARB = NULL;
-
-PFNGLBINDFRAGDATALOCATIONINDEXEDPROC __glewBindFragDataLocationIndexed = NULL;
-PFNGLGETFRAGDATAINDEXPROC __glewGetFragDataIndex = NULL;
-
-PFNGLBUFFERSTORAGEPROC __glewBufferStorage = NULL;
-PFNGLNAMEDBUFFERSTORAGEEXTPROC __glewNamedBufferStorageEXT = NULL;
-
-PFNGLCREATESYNCFROMCLEVENTARBPROC __glewCreateSyncFromCLeventARB = NULL;
-
-PFNGLCLEARBUFFERDATAPROC __glewClearBufferData = NULL;
-PFNGLCLEARBUFFERSUBDATAPROC __glewClearBufferSubData = NULL;
-PFNGLCLEARNAMEDBUFFERDATAEXTPROC __glewClearNamedBufferDataEXT = NULL;
-PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC __glewClearNamedBufferSubDataEXT = NULL;
-
-PFNGLCLEARTEXIMAGEPROC __glewClearTexImage = NULL;
-PFNGLCLEARTEXSUBIMAGEPROC __glewClearTexSubImage = NULL;
-
-PFNGLCLIPCONTROLPROC __glewClipControl = NULL;
-
-PFNGLCLAMPCOLORARBPROC __glewClampColorARB = NULL;
-
-PFNGLDISPATCHCOMPUTEPROC __glewDispatchCompute = NULL;
-PFNGLDISPATCHCOMPUTEINDIRECTPROC __glewDispatchComputeIndirect = NULL;
-
-PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC __glewDispatchComputeGroupSizeARB = NULL;
-
-PFNGLCOPYBUFFERSUBDATAPROC __glewCopyBufferSubData = NULL;
-
-PFNGLCOPYIMAGESUBDATAPROC __glewCopyImageSubData = NULL;
-
-PFNGLDEBUGMESSAGECALLBACKARBPROC __glewDebugMessageCallbackARB = NULL;
-PFNGLDEBUGMESSAGECONTROLARBPROC __glewDebugMessageControlARB = NULL;
-PFNGLDEBUGMESSAGEINSERTARBPROC __glewDebugMessageInsertARB = NULL;
-PFNGLGETDEBUGMESSAGELOGARBPROC __glewGetDebugMessageLogARB = NULL;
-
-PFNGLBINDTEXTUREUNITPROC __glewBindTextureUnit = NULL;
-PFNGLBLITNAMEDFRAMEBUFFERPROC __glewBlitNamedFramebuffer = NULL;
-PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC __glewCheckNamedFramebufferStatus = NULL;
-PFNGLCLEARNAMEDBUFFERDATAPROC __glewClearNamedBufferData = NULL;
-PFNGLCLEARNAMEDBUFFERSUBDATAPROC __glewClearNamedBufferSubData = NULL;
-PFNGLCLEARNAMEDFRAMEBUFFERFIPROC __glewClearNamedFramebufferfi = NULL;
-PFNGLCLEARNAMEDFRAMEBUFFERFVPROC __glewClearNamedFramebufferfv = NULL;
-PFNGLCLEARNAMEDFRAMEBUFFERIVPROC __glewClearNamedFramebufferiv = NULL;
-PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC __glewClearNamedFramebufferuiv = NULL;
-PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC __glewCompressedTextureSubImage1D = NULL;
-PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC __glewCompressedTextureSubImage2D = NULL;
-PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC __glewCompressedTextureSubImage3D = NULL;
-PFNGLCOPYNAMEDBUFFERSUBDATAPROC __glewCopyNamedBufferSubData = NULL;
-PFNGLCOPYTEXTURESUBIMAGE1DPROC __glewCopyTextureSubImage1D = NULL;
-PFNGLCOPYTEXTURESUBIMAGE2DPROC __glewCopyTextureSubImage2D = NULL;
-PFNGLCOPYTEXTURESUBIMAGE3DPROC __glewCopyTextureSubImage3D = NULL;
-PFNGLCREATEBUFFERSPROC __glewCreateBuffers = NULL;
-PFNGLCREATEFRAMEBUFFERSPROC __glewCreateFramebuffers = NULL;
-PFNGLCREATEPROGRAMPIPELINESPROC __glewCreateProgramPipelines = NULL;
-PFNGLCREATEQUERIESPROC __glewCreateQueries = NULL;
-PFNGLCREATERENDERBUFFERSPROC __glewCreateRenderbuffers = NULL;
-PFNGLCREATESAMPLERSPROC __glewCreateSamplers = NULL;
-PFNGLCREATETEXTURESPROC __glewCreateTextures = NULL;
-PFNGLCREATETRANSFORMFEEDBACKSPROC __glewCreateTransformFeedbacks = NULL;
-PFNGLCREATEVERTEXARRAYSPROC __glewCreateVertexArrays = NULL;
-PFNGLDISABLEVERTEXARRAYATTRIBPROC __glewDisableVertexArrayAttrib = NULL;
-PFNGLENABLEVERTEXARRAYATTRIBPROC __glewEnableVertexArrayAttrib = NULL;
-PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC __glewFlushMappedNamedBufferRange = NULL;
-PFNGLGENERATETEXTUREMIPMAPPROC __glewGenerateTextureMipmap = NULL;
-PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC __glewGetCompressedTextureImage = NULL;
-PFNGLGETNAMEDBUFFERPARAMETERI64VPROC __glewGetNamedBufferParameteri64v = NULL;
-PFNGLGETNAMEDBUFFERPARAMETERIVPROC __glewGetNamedBufferParameteriv = NULL;
-PFNGLGETNAMEDBUFFERPOINTERVPROC __glewGetNamedBufferPointerv = NULL;
-PFNGLGETNAMEDBUFFERSUBDATAPROC __glewGetNamedBufferSubData = NULL;
-PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC __glewGetNamedFramebufferAttachmentParameteriv = NULL;
-PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC __glewGetNamedFramebufferParameteriv = NULL;
-PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC __glewGetNamedRenderbufferParameteriv = NULL;
-PFNGLGETQUERYBUFFEROBJECTI64VPROC __glewGetQueryBufferObjecti64v = NULL;
-PFNGLGETQUERYBUFFEROBJECTIVPROC __glewGetQueryBufferObjectiv = NULL;
-PFNGLGETQUERYBUFFEROBJECTUI64VPROC __glewGetQueryBufferObjectui64v = NULL;
-PFNGLGETQUERYBUFFEROBJECTUIVPROC __glewGetQueryBufferObjectuiv = NULL;
-PFNGLGETTEXTUREIMAGEPROC __glewGetTextureImage = NULL;
-PFNGLGETTEXTURELEVELPARAMETERFVPROC __glewGetTextureLevelParameterfv = NULL;
-PFNGLGETTEXTURELEVELPARAMETERIVPROC __glewGetTextureLevelParameteriv = NULL;
-PFNGLGETTEXTUREPARAMETERIIVPROC __glewGetTextureParameterIiv = NULL;
-PFNGLGETTEXTUREPARAMETERIUIVPROC __glewGetTextureParameterIuiv = NULL;
-PFNGLGETTEXTUREPARAMETERFVPROC __glewGetTextureParameterfv = NULL;
-PFNGLGETTEXTUREPARAMETERIVPROC __glewGetTextureParameteriv = NULL;
-PFNGLGETTRANSFORMFEEDBACKI64_VPROC __glewGetTransformFeedbacki64_v = NULL;
-PFNGLGETTRANSFORMFEEDBACKI_VPROC __glewGetTransformFeedbacki_v = NULL;
-PFNGLGETTRANSFORMFEEDBACKIVPROC __glewGetTransformFeedbackiv = NULL;
-PFNGLGETVERTEXARRAYINDEXED64IVPROC __glewGetVertexArrayIndexed64iv = NULL;
-PFNGLGETVERTEXARRAYINDEXEDIVPROC __glewGetVertexArrayIndexediv = NULL;
-PFNGLGETVERTEXARRAYIVPROC __glewGetVertexArrayiv = NULL;
-PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC __glewInvalidateNamedFramebufferData = NULL;
-PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC __glewInvalidateNamedFramebufferSubData = NULL;
-PFNGLMAPNAMEDBUFFERPROC __glewMapNamedBuffer = NULL;
-PFNGLMAPNAMEDBUFFERRANGEPROC __glewMapNamedBufferRange = NULL;
-PFNGLNAMEDBUFFERDATAPROC __glewNamedBufferData = NULL;
-PFNGLNAMEDBUFFERSTORAGEPROC __glewNamedBufferStorage = NULL;
-PFNGLNAMEDBUFFERSUBDATAPROC __glewNamedBufferSubData = NULL;
-PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC __glewNamedFramebufferDrawBuffer = NULL;
-PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC __glewNamedFramebufferDrawBuffers = NULL;
-PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC __glewNamedFramebufferParameteri = NULL;
-PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC __glewNamedFramebufferReadBuffer = NULL;
-PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC __glewNamedFramebufferRenderbuffer = NULL;
-PFNGLNAMEDFRAMEBUFFERTEXTUREPROC __glewNamedFramebufferTexture = NULL;
-PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC __glewNamedFramebufferTextureLayer = NULL;
-PFNGLNAMEDRENDERBUFFERSTORAGEPROC __glewNamedRenderbufferStorage = NULL;
-PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC __glewNamedRenderbufferStorageMultisample = NULL;
-PFNGLTEXTUREBUFFERPROC __glewTextureBuffer = NULL;
-PFNGLTEXTUREBUFFERRANGEPROC __glewTextureBufferRange = NULL;
-PFNGLTEXTUREPARAMETERIIVPROC __glewTextureParameterIiv = NULL;
-PFNGLTEXTUREPARAMETERIUIVPROC __glewTextureParameterIuiv = NULL;
-PFNGLTEXTUREPARAMETERFPROC __glewTextureParameterf = NULL;
-PFNGLTEXTUREPARAMETERFVPROC __glewTextureParameterfv = NULL;
-PFNGLTEXTUREPARAMETERIPROC __glewTextureParameteri = NULL;
-PFNGLTEXTUREPARAMETERIVPROC __glewTextureParameteriv = NULL;
-PFNGLTEXTURESTORAGE1DPROC __glewTextureStorage1D = NULL;
-PFNGLTEXTURESTORAGE2DPROC __glewTextureStorage2D = NULL;
-PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC __glewTextureStorage2DMultisample = NULL;
-PFNGLTEXTURESTORAGE3DPROC __glewTextureStorage3D = NULL;
-PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC __glewTextureStorage3DMultisample = NULL;
-PFNGLTEXTURESUBIMAGE1DPROC __glewTextureSubImage1D = NULL;
-PFNGLTEXTURESUBIMAGE2DPROC __glewTextureSubImage2D = NULL;
-PFNGLTEXTURESUBIMAGE3DPROC __glewTextureSubImage3D = NULL;
-PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC __glewTransformFeedbackBufferBase = NULL;
-PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC __glewTransformFeedbackBufferRange = NULL;
-PFNGLUNMAPNAMEDBUFFERPROC __glewUnmapNamedBuffer = NULL;
-PFNGLVERTEXARRAYATTRIBBINDINGPROC __glewVertexArrayAttribBinding = NULL;
-PFNGLVERTEXARRAYATTRIBFORMATPROC __glewVertexArrayAttribFormat = NULL;
-PFNGLVERTEXARRAYATTRIBIFORMATPROC __glewVertexArrayAttribIFormat = NULL;
-PFNGLVERTEXARRAYATTRIBLFORMATPROC __glewVertexArrayAttribLFormat = NULL;
-PFNGLVERTEXARRAYBINDINGDIVISORPROC __glewVertexArrayBindingDivisor = NULL;
-PFNGLVERTEXARRAYELEMENTBUFFERPROC __glewVertexArrayElementBuffer = NULL;
-PFNGLVERTEXARRAYVERTEXBUFFERPROC __glewVertexArrayVertexBuffer = NULL;
-PFNGLVERTEXARRAYVERTEXBUFFERSPROC __glewVertexArrayVertexBuffers = NULL;
-
-PFNGLDRAWBUFFERSARBPROC __glewDrawBuffersARB = NULL;
-
-PFNGLBLENDEQUATIONSEPARATEIARBPROC __glewBlendEquationSeparateiARB = NULL;
-PFNGLBLENDEQUATIONIARBPROC __glewBlendEquationiARB = NULL;
-PFNGLBLENDFUNCSEPARATEIARBPROC __glewBlendFuncSeparateiARB = NULL;
-PFNGLBLENDFUNCIARBPROC __glewBlendFunciARB = NULL;
-
-PFNGLDRAWELEMENTSBASEVERTEXPROC __glewDrawElementsBaseVertex = NULL;
-PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC __glewDrawElementsInstancedBaseVertex = NULL;
-PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC __glewDrawRangeElementsBaseVertex = NULL;
-PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC __glewMultiDrawElementsBaseVertex = NULL;
-
-PFNGLDRAWARRAYSINDIRECTPROC __glewDrawArraysIndirect = NULL;
-PFNGLDRAWELEMENTSINDIRECTPROC __glewDrawElementsIndirect = NULL;
-
-PFNGLFRAMEBUFFERPARAMETERIPROC __glewFramebufferParameteri = NULL;
-PFNGLGETFRAMEBUFFERPARAMETERIVPROC __glewGetFramebufferParameteriv = NULL;
-PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC __glewGetNamedFramebufferParameterivEXT = NULL;
-PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC __glewNamedFramebufferParameteriEXT = NULL;
-
-PFNGLBINDFRAMEBUFFERPROC __glewBindFramebuffer = NULL;
-PFNGLBINDRENDERBUFFERPROC __glewBindRenderbuffer = NULL;
-PFNGLBLITFRAMEBUFFERPROC __glewBlitFramebuffer = NULL;
-PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus = NULL;
-PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers = NULL;
-PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers = NULL;
-PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer = NULL;
-PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D = NULL;
-PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D = NULL;
-PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D = NULL;
-PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer = NULL;
-PFNGLGENFRAMEBUFFERSPROC __glewGenFramebuffers = NULL;
-PFNGLGENRENDERBUFFERSPROC __glewGenRenderbuffers = NULL;
-PFNGLGENERATEMIPMAPPROC __glewGenerateMipmap = NULL;
-PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC __glewGetFramebufferAttachmentParameteriv = NULL;
-PFNGLGETRENDERBUFFERPARAMETERIVPROC __glewGetRenderbufferParameteriv = NULL;
-PFNGLISFRAMEBUFFERPROC __glewIsFramebuffer = NULL;
-PFNGLISRENDERBUFFERPROC __glewIsRenderbuffer = NULL;
-PFNGLRENDERBUFFERSTORAGEPROC __glewRenderbufferStorage = NULL;
-PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC __glewRenderbufferStorageMultisample = NULL;
-
-PFNGLFRAMEBUFFERTEXTUREARBPROC __glewFramebufferTextureARB = NULL;
-PFNGLFRAMEBUFFERTEXTUREFACEARBPROC __glewFramebufferTextureFaceARB = NULL;
-PFNGLFRAMEBUFFERTEXTURELAYERARBPROC __glewFramebufferTextureLayerARB = NULL;
-PFNGLPROGRAMPARAMETERIARBPROC __glewProgramParameteriARB = NULL;
-
-PFNGLGETPROGRAMBINARYPROC __glewGetProgramBinary = NULL;
-PFNGLPROGRAMBINARYPROC __glewProgramBinary = NULL;
-PFNGLPROGRAMPARAMETERIPROC __glewProgramParameteri = NULL;
-
-PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC __glewGetCompressedTextureSubImage = NULL;
-PFNGLGETTEXTURESUBIMAGEPROC __glewGetTextureSubImage = NULL;
-
-PFNGLGETUNIFORMDVPROC __glewGetUniformdv = NULL;
-PFNGLUNIFORM1DPROC __glewUniform1d = NULL;
-PFNGLUNIFORM1DVPROC __glewUniform1dv = NULL;
-PFNGLUNIFORM2DPROC __glewUniform2d = NULL;
-PFNGLUNIFORM2DVPROC __glewUniform2dv = NULL;
-PFNGLUNIFORM3DPROC __glewUniform3d = NULL;
-PFNGLUNIFORM3DVPROC __glewUniform3dv = NULL;
-PFNGLUNIFORM4DPROC __glewUniform4d = NULL;
-PFNGLUNIFORM4DVPROC __glewUniform4dv = NULL;
-PFNGLUNIFORMMATRIX2DVPROC __glewUniformMatrix2dv = NULL;
-PFNGLUNIFORMMATRIX2X3DVPROC __glewUniformMatrix2x3dv = NULL;
-PFNGLUNIFORMMATRIX2X4DVPROC __glewUniformMatrix2x4dv = NULL;
-PFNGLUNIFORMMATRIX3DVPROC __glewUniformMatrix3dv = NULL;
-PFNGLUNIFORMMATRIX3X2DVPROC __glewUniformMatrix3x2dv = NULL;
-PFNGLUNIFORMMATRIX3X4DVPROC __glewUniformMatrix3x4dv = NULL;
-PFNGLUNIFORMMATRIX4DVPROC __glewUniformMatrix4dv = NULL;
-PFNGLUNIFORMMATRIX4X2DVPROC __glewUniformMatrix4x2dv = NULL;
-PFNGLUNIFORMMATRIX4X3DVPROC __glewUniformMatrix4x3dv = NULL;
-
-PFNGLCOLORSUBTABLEPROC __glewColorSubTable = NULL;
-PFNGLCOLORTABLEPROC __glewColorTable = NULL;
-PFNGLCOLORTABLEPARAMETERFVPROC __glewColorTableParameterfv = NULL;
-PFNGLCOLORTABLEPARAMETERIVPROC __glewColorTableParameteriv = NULL;
-PFNGLCONVOLUTIONFILTER1DPROC __glewConvolutionFilter1D = NULL;
-PFNGLCONVOLUTIONFILTER2DPROC __glewConvolutionFilter2D = NULL;
-PFNGLCONVOLUTIONPARAMETERFPROC __glewConvolutionParameterf = NULL;
-PFNGLCONVOLUTIONPARAMETERFVPROC __glewConvolutionParameterfv = NULL;
-PFNGLCONVOLUTIONPARAMETERIPROC __glewConvolutionParameteri = NULL;
-PFNGLCONVOLUTIONPARAMETERIVPROC __glewConvolutionParameteriv = NULL;
-PFNGLCOPYCOLORSUBTABLEPROC __glewCopyColorSubTable = NULL;
-PFNGLCOPYCOLORTABLEPROC __glewCopyColorTable = NULL;
-PFNGLCOPYCONVOLUTIONFILTER1DPROC __glewCopyConvolutionFilter1D = NULL;
-PFNGLCOPYCONVOLUTIONFILTER2DPROC __glewCopyConvolutionFilter2D = NULL;
-PFNGLGETCOLORTABLEPROC __glewGetColorTable = NULL;
-PFNGLGETCOLORTABLEPARAMETERFVPROC __glewGetColorTableParameterfv = NULL;
-PFNGLGETCOLORTABLEPARAMETERIVPROC __glewGetColorTableParameteriv = NULL;
-PFNGLGETCONVOLUTIONFILTERPROC __glewGetConvolutionFilter = NULL;
-PFNGLGETCONVOLUTIONPARAMETERFVPROC __glewGetConvolutionParameterfv = NULL;
-PFNGLGETCONVOLUTIONPARAMETERIVPROC __glewGetConvolutionParameteriv = NULL;
-PFNGLGETHISTOGRAMPROC __glewGetHistogram = NULL;
-PFNGLGETHISTOGRAMPARAMETERFVPROC __glewGetHistogramParameterfv = NULL;
-PFNGLGETHISTOGRAMPARAMETERIVPROC __glewGetHistogramParameteriv = NULL;
-PFNGLGETMINMAXPROC __glewGetMinmax = NULL;
-PFNGLGETMINMAXPARAMETERFVPROC __glewGetMinmaxParameterfv = NULL;
-PFNGLGETMINMAXPARAMETERIVPROC __glewGetMinmaxParameteriv = NULL;
-PFNGLGETSEPARABLEFILTERPROC __glewGetSeparableFilter = NULL;
-PFNGLHISTOGRAMPROC __glewHistogram = NULL;
-PFNGLMINMAXPROC __glewMinmax = NULL;
-PFNGLRESETHISTOGRAMPROC __glewResetHistogram = NULL;
-PFNGLRESETMINMAXPROC __glewResetMinmax = NULL;
-PFNGLSEPARABLEFILTER2DPROC __glewSeparableFilter2D = NULL;
-
-PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC __glewMultiDrawArraysIndirectCountARB = NULL;
-PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC __glewMultiDrawElementsIndirectCountARB = NULL;
-
-PFNGLDRAWARRAYSINSTANCEDARBPROC __glewDrawArraysInstancedARB = NULL;
-PFNGLDRAWELEMENTSINSTANCEDARBPROC __glewDrawElementsInstancedARB = NULL;
-PFNGLVERTEXATTRIBDIVISORARBPROC __glewVertexAttribDivisorARB = NULL;
-
-PFNGLGETINTERNALFORMATIVPROC __glewGetInternalformativ = NULL;
-
-PFNGLGETINTERNALFORMATI64VPROC __glewGetInternalformati64v = NULL;
-
-PFNGLINVALIDATEBUFFERDATAPROC __glewInvalidateBufferData = NULL;
-PFNGLINVALIDATEBUFFERSUBDATAPROC __glewInvalidateBufferSubData = NULL;
-PFNGLINVALIDATEFRAMEBUFFERPROC __glewInvalidateFramebuffer = NULL;
-PFNGLINVALIDATESUBFRAMEBUFFERPROC __glewInvalidateSubFramebuffer = NULL;
-PFNGLINVALIDATETEXIMAGEPROC __glewInvalidateTexImage = NULL;
-PFNGLINVALIDATETEXSUBIMAGEPROC __glewInvalidateTexSubImage = NULL;
-
-PFNGLFLUSHMAPPEDBUFFERRANGEPROC __glewFlushMappedBufferRange = NULL;
-PFNGLMAPBUFFERRANGEPROC __glewMapBufferRange = NULL;
-
-PFNGLCURRENTPALETTEMATRIXARBPROC __glewCurrentPaletteMatrixARB = NULL;
-PFNGLMATRIXINDEXPOINTERARBPROC __glewMatrixIndexPointerARB = NULL;
-PFNGLMATRIXINDEXUBVARBPROC __glewMatrixIndexubvARB = NULL;
-PFNGLMATRIXINDEXUIVARBPROC __glewMatrixIndexuivARB = NULL;
-PFNGLMATRIXINDEXUSVARBPROC __glewMatrixIndexusvARB = NULL;
-
-PFNGLBINDBUFFERSBASEPROC __glewBindBuffersBase = NULL;
-PFNGLBINDBUFFERSRANGEPROC __glewBindBuffersRange = NULL;
-PFNGLBINDIMAGETEXTURESPROC __glewBindImageTextures = NULL;
-PFNGLBINDSAMPLERSPROC __glewBindSamplers = NULL;
-PFNGLBINDTEXTURESPROC __glewBindTextures = NULL;
-PFNGLBINDVERTEXBUFFERSPROC __glewBindVertexBuffers = NULL;
-
-PFNGLMULTIDRAWARRAYSINDIRECTPROC __glewMultiDrawArraysIndirect = NULL;
-PFNGLMULTIDRAWELEMENTSINDIRECTPROC __glewMultiDrawElementsIndirect = NULL;
-
-PFNGLSAMPLECOVERAGEARBPROC __glewSampleCoverageARB = NULL;
-
-PFNGLACTIVETEXTUREARBPROC __glewActiveTextureARB = NULL;
-PFNGLCLIENTACTIVETEXTUREARBPROC __glewClientActiveTextureARB = NULL;
-PFNGLMULTITEXCOORD1DARBPROC __glewMultiTexCoord1dARB = NULL;
-PFNGLMULTITEXCOORD1DVARBPROC __glewMultiTexCoord1dvARB = NULL;
-PFNGLMULTITEXCOORD1FARBPROC __glewMultiTexCoord1fARB = NULL;
-PFNGLMULTITEXCOORD1FVARBPROC __glewMultiTexCoord1fvARB = NULL;
-PFNGLMULTITEXCOORD1IARBPROC __glewMultiTexCoord1iARB = NULL;
-PFNGLMULTITEXCOORD1IVARBPROC __glewMultiTexCoord1ivARB = NULL;
-PFNGLMULTITEXCOORD1SARBPROC __glewMultiTexCoord1sARB = NULL;
-PFNGLMULTITEXCOORD1SVARBPROC __glewMultiTexCoord1svARB = NULL;
-PFNGLMULTITEXCOORD2DARBPROC __glewMultiTexCoord2dARB = NULL;
-PFNGLMULTITEXCOORD2DVARBPROC __glewMultiTexCoord2dvARB = NULL;
-PFNGLMULTITEXCOORD2FARBPROC __glewMultiTexCoord2fARB = NULL;
-PFNGLMULTITEXCOORD2FVARBPROC __glewMultiTexCoord2fvARB = NULL;
-PFNGLMULTITEXCOORD2IARBPROC __glewMultiTexCoord2iARB = NULL;
-PFNGLMULTITEXCOORD2IVARBPROC __glewMultiTexCoord2ivARB = NULL;
-PFNGLMULTITEXCOORD2SARBPROC __glewMultiTexCoord2sARB = NULL;
-PFNGLMULTITEXCOORD2SVARBPROC __glewMultiTexCoord2svARB = NULL;
-PFNGLMULTITEXCOORD3DARBPROC __glewMultiTexCoord3dARB = NULL;
-PFNGLMULTITEXCOORD3DVARBPROC __glewMultiTexCoord3dvARB = NULL;
-PFNGLMULTITEXCOORD3FARBPROC __glewMultiTexCoord3fARB = NULL;
-PFNGLMULTITEXCOORD3FVARBPROC __glewMultiTexCoord3fvARB = NULL;
-PFNGLMULTITEXCOORD3IARBPROC __glewMultiTexCoord3iARB = NULL;
-PFNGLMULTITEXCOORD3IVARBPROC __glewMultiTexCoord3ivARB = NULL;
-PFNGLMULTITEXCOORD3SARBPROC __glewMultiTexCoord3sARB = NULL;
-PFNGLMULTITEXCOORD3SVARBPROC __glewMultiTexCoord3svARB = NULL;
-PFNGLMULTITEXCOORD4DARBPROC __glewMultiTexCoord4dARB = NULL;
-PFNGLMULTITEXCOORD4DVARBPROC __glewMultiTexCoord4dvARB = NULL;
-PFNGLMULTITEXCOORD4FARBPROC __glewMultiTexCoord4fARB = NULL;
-PFNGLMULTITEXCOORD4FVARBPROC __glewMultiTexCoord4fvARB = NULL;
-PFNGLMULTITEXCOORD4IARBPROC __glewMultiTexCoord4iARB = NULL;
-PFNGLMULTITEXCOORD4IVARBPROC __glewMultiTexCoord4ivARB = NULL;
-PFNGLMULTITEXCOORD4SARBPROC __glewMultiTexCoord4sARB = NULL;
-PFNGLMULTITEXCOORD4SVARBPROC __glewMultiTexCoord4svARB = NULL;
-
-PFNGLBEGINQUERYARBPROC __glewBeginQueryARB = NULL;
-PFNGLDELETEQUERIESARBPROC __glewDeleteQueriesARB = NULL;
-PFNGLENDQUERYARBPROC __glewEndQueryARB = NULL;
-PFNGLGENQUERIESARBPROC __glewGenQueriesARB = NULL;
-PFNGLGETQUERYOBJECTIVARBPROC __glewGetQueryObjectivARB = NULL;
-PFNGLGETQUERYOBJECTUIVARBPROC __glewGetQueryObjectuivARB = NULL;
-PFNGLGETQUERYIVARBPROC __glewGetQueryivARB = NULL;
-PFNGLISQUERYARBPROC __glewIsQueryARB = NULL;
-
-PFNGLPOINTPARAMETERFARBPROC __glewPointParameterfARB = NULL;
-PFNGLPOINTPARAMETERFVARBPROC __glewPointParameterfvARB = NULL;
-
-PFNGLGETPROGRAMINTERFACEIVPROC __glewGetProgramInterfaceiv = NULL;
-PFNGLGETPROGRAMRESOURCEINDEXPROC __glewGetProgramResourceIndex = NULL;
-PFNGLGETPROGRAMRESOURCELOCATIONPROC __glewGetProgramResourceLocation = NULL;
-PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC __glewGetProgramResourceLocationIndex = NULL;
-PFNGLGETPROGRAMRESOURCENAMEPROC __glewGetProgramResourceName = NULL;
-PFNGLGETPROGRAMRESOURCEIVPROC __glewGetProgramResourceiv = NULL;
-
-PFNGLPROVOKINGVERTEXPROC __glewProvokingVertex = NULL;
-
-PFNGLGETGRAPHICSRESETSTATUSARBPROC __glewGetGraphicsResetStatusARB = NULL;
-PFNGLGETNCOLORTABLEARBPROC __glewGetnColorTableARB = NULL;
-PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC __glewGetnCompressedTexImageARB = NULL;
-PFNGLGETNCONVOLUTIONFILTERARBPROC __glewGetnConvolutionFilterARB = NULL;
-PFNGLGETNHISTOGRAMARBPROC __glewGetnHistogramARB = NULL;
-PFNGLGETNMAPDVARBPROC __glewGetnMapdvARB = NULL;
-PFNGLGETNMAPFVARBPROC __glewGetnMapfvARB = NULL;
-PFNGLGETNMAPIVARBPROC __glewGetnMapivARB = NULL;
-PFNGLGETNMINMAXARBPROC __glewGetnMinmaxARB = NULL;
-PFNGLGETNPIXELMAPFVARBPROC __glewGetnPixelMapfvARB = NULL;
-PFNGLGETNPIXELMAPUIVARBPROC __glewGetnPixelMapuivARB = NULL;
-PFNGLGETNPIXELMAPUSVARBPROC __glewGetnPixelMapusvARB = NULL;
-PFNGLGETNPOLYGONSTIPPLEARBPROC __glewGetnPolygonStippleARB = NULL;
-PFNGLGETNSEPARABLEFILTERARBPROC __glewGetnSeparableFilterARB = NULL;
-PFNGLGETNTEXIMAGEARBPROC __glewGetnTexImageARB = NULL;
-PFNGLGETNUNIFORMDVARBPROC __glewGetnUniformdvARB = NULL;
-PFNGLGETNUNIFORMFVARBPROC __glewGetnUniformfvARB = NULL;
-PFNGLGETNUNIFORMIVARBPROC __glewGetnUniformivARB = NULL;
-PFNGLGETNUNIFORMUIVARBPROC __glewGetnUniformuivARB = NULL;
-PFNGLREADNPIXELSARBPROC __glewReadnPixelsARB = NULL;
-
-PFNGLMINSAMPLESHADINGARBPROC __glewMinSampleShadingARB = NULL;
-
-PFNGLBINDSAMPLERPROC __glewBindSampler = NULL;
-PFNGLDELETESAMPLERSPROC __glewDeleteSamplers = NULL;
-PFNGLGENSAMPLERSPROC __glewGenSamplers = NULL;
-PFNGLGETSAMPLERPARAMETERIIVPROC __glewGetSamplerParameterIiv = NULL;
-PFNGLGETSAMPLERPARAMETERIUIVPROC __glewGetSamplerParameterIuiv = NULL;
-PFNGLGETSAMPLERPARAMETERFVPROC __glewGetSamplerParameterfv = NULL;
-PFNGLGETSAMPLERPARAMETERIVPROC __glewGetSamplerParameteriv = NULL;
-PFNGLISSAMPLERPROC __glewIsSampler = NULL;
-PFNGLSAMPLERPARAMETERIIVPROC __glewSamplerParameterIiv = NULL;
-PFNGLSAMPLERPARAMETERIUIVPROC __glewSamplerParameterIuiv = NULL;
-PFNGLSAMPLERPARAMETERFPROC __glewSamplerParameterf = NULL;
-PFNGLSAMPLERPARAMETERFVPROC __glewSamplerParameterfv = NULL;
-PFNGLSAMPLERPARAMETERIPROC __glewSamplerParameteri = NULL;
-PFNGLSAMPLERPARAMETERIVPROC __glewSamplerParameteriv = NULL;
-
-PFNGLACTIVESHADERPROGRAMPROC __glewActiveShaderProgram = NULL;
-PFNGLBINDPROGRAMPIPELINEPROC __glewBindProgramPipeline = NULL;
-PFNGLCREATESHADERPROGRAMVPROC __glewCreateShaderProgramv = NULL;
-PFNGLDELETEPROGRAMPIPELINESPROC __glewDeleteProgramPipelines = NULL;
-PFNGLGENPROGRAMPIPELINESPROC __glewGenProgramPipelines = NULL;
-PFNGLGETPROGRAMPIPELINEINFOLOGPROC __glewGetProgramPipelineInfoLog = NULL;
-PFNGLGETPROGRAMPIPELINEIVPROC __glewGetProgramPipelineiv = NULL;
-PFNGLISPROGRAMPIPELINEPROC __glewIsProgramPipeline = NULL;
-PFNGLPROGRAMUNIFORM1DPROC __glewProgramUniform1d = NULL;
-PFNGLPROGRAMUNIFORM1DVPROC __glewProgramUniform1dv = NULL;
-PFNGLPROGRAMUNIFORM1FPROC __glewProgramUniform1f = NULL;
-PFNGLPROGRAMUNIFORM1FVPROC __glewProgramUniform1fv = NULL;
-PFNGLPROGRAMUNIFORM1IPROC __glewProgramUniform1i = NULL;
-PFNGLPROGRAMUNIFORM1IVPROC __glewProgramUniform1iv = NULL;
-PFNGLPROGRAMUNIFORM1UIPROC __glewProgramUniform1ui = NULL;
-PFNGLPROGRAMUNIFORM1UIVPROC __glewProgramUniform1uiv = NULL;
-PFNGLPROGRAMUNIFORM2DPROC __glewProgramUniform2d = NULL;
-PFNGLPROGRAMUNIFORM2DVPROC __glewProgramUniform2dv = NULL;
-PFNGLPROGRAMUNIFORM2FPROC __glewProgramUniform2f = NULL;
-PFNGLPROGRAMUNIFORM2FVPROC __glewProgramUniform2fv = NULL;
-PFNGLPROGRAMUNIFORM2IPROC __glewProgramUniform2i = NULL;
-PFNGLPROGRAMUNIFORM2IVPROC __glewProgramUniform2iv = NULL;
-PFNGLPROGRAMUNIFORM2UIPROC __glewProgramUniform2ui = NULL;
-PFNGLPROGRAMUNIFORM2UIVPROC __glewProgramUniform2uiv = NULL;
-PFNGLPROGRAMUNIFORM3DPROC __glewProgramUniform3d = NULL;
-PFNGLPROGRAMUNIFORM3DVPROC __glewProgramUniform3dv = NULL;
-PFNGLPROGRAMUNIFORM3FPROC __glewProgramUniform3f = NULL;
-PFNGLPROGRAMUNIFORM3FVPROC __glewProgramUniform3fv = NULL;
-PFNGLPROGRAMUNIFORM3IPROC __glewProgramUniform3i = NULL;
-PFNGLPROGRAMUNIFORM3IVPROC __glewProgramUniform3iv = NULL;
-PFNGLPROGRAMUNIFORM3UIPROC __glewProgramUniform3ui = NULL;
-PFNGLPROGRAMUNIFORM3UIVPROC __glewProgramUniform3uiv = NULL;
-PFNGLPROGRAMUNIFORM4DPROC __glewProgramUniform4d = NULL;
-PFNGLPROGRAMUNIFORM4DVPROC __glewProgramUniform4dv = NULL;
-PFNGLPROGRAMUNIFORM4FPROC __glewProgramUniform4f = NULL;
-PFNGLPROGRAMUNIFORM4FVPROC __glewProgramUniform4fv = NULL;
-PFNGLPROGRAMUNIFORM4IPROC __glewProgramUniform4i = NULL;
-PFNGLPROGRAMUNIFORM4IVPROC __glewProgramUniform4iv = NULL;
-PFNGLPROGRAMUNIFORM4UIPROC __glewProgramUniform4ui = NULL;
-PFNGLPROGRAMUNIFORM4UIVPROC __glewProgramUniform4uiv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX2DVPROC __glewProgramUniformMatrix2dv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX2FVPROC __glewProgramUniformMatrix2fv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC __glewProgramUniformMatrix2x3dv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC __glewProgramUniformMatrix2x3fv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC __glewProgramUniformMatrix2x4dv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC __glewProgramUniformMatrix2x4fv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX3DVPROC __glewProgramUniformMatrix3dv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX3FVPROC __glewProgramUniformMatrix3fv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC __glewProgramUniformMatrix3x2dv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC __glewProgramUniformMatrix3x2fv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC __glewProgramUniformMatrix3x4dv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC __glewProgramUniformMatrix3x4fv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX4DVPROC __glewProgramUniformMatrix4dv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX4FVPROC __glewProgramUniformMatrix4fv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC __glewProgramUniformMatrix4x2dv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC __glewProgramUniformMatrix4x2fv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC __glewProgramUniformMatrix4x3dv = NULL;
-PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC __glewProgramUniformMatrix4x3fv = NULL;
-PFNGLUSEPROGRAMSTAGESPROC __glewUseProgramStages = NULL;
-PFNGLVALIDATEPROGRAMPIPELINEPROC __glewValidateProgramPipeline = NULL;
-
-PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC __glewGetActiveAtomicCounterBufferiv = NULL;
-
-PFNGLBINDIMAGETEXTUREPROC __glewBindImageTexture = NULL;
-PFNGLMEMORYBARRIERPROC __glewMemoryBarrier = NULL;
-
-PFNGLATTACHOBJECTARBPROC __glewAttachObjectARB = NULL;
-PFNGLCOMPILESHADERARBPROC __glewCompileShaderARB = NULL;
-PFNGLCREATEPROGRAMOBJECTARBPROC __glewCreateProgramObjectARB = NULL;
-PFNGLCREATESHADEROBJECTARBPROC __glewCreateShaderObjectARB = NULL;
-PFNGLDELETEOBJECTARBPROC __glewDeleteObjectARB = NULL;
-PFNGLDETACHOBJECTARBPROC __glewDetachObjectARB = NULL;
-PFNGLGETACTIVEUNIFORMARBPROC __glewGetActiveUniformARB = NULL;
-PFNGLGETATTACHEDOBJECTSARBPROC __glewGetAttachedObjectsARB = NULL;
-PFNGLGETHANDLEARBPROC __glewGetHandleARB = NULL;
-PFNGLGETINFOLOGARBPROC __glewGetInfoLogARB = NULL;
-PFNGLGETOBJECTPARAMETERFVARBPROC __glewGetObjectParameterfvARB = NULL;
-PFNGLGETOBJECTPARAMETERIVARBPROC __glewGetObjectParameterivARB = NULL;
-PFNGLGETSHADERSOURCEARBPROC __glewGetShaderSourceARB = NULL;
-PFNGLGETUNIFORMLOCATIONARBPROC __glewGetUniformLocationARB = NULL;
-PFNGLGETUNIFORMFVARBPROC __glewGetUniformfvARB = NULL;
-PFNGLGETUNIFORMIVARBPROC __glewGetUniformivARB = NULL;
-PFNGLLINKPROGRAMARBPROC __glewLinkProgramARB = NULL;
-PFNGLSHADERSOURCEARBPROC __glewShaderSourceARB = NULL;
-PFNGLUNIFORM1FARBPROC __glewUniform1fARB = NULL;
-PFNGLUNIFORM1FVARBPROC __glewUniform1fvARB = NULL;
-PFNGLUNIFORM1IARBPROC __glewUniform1iARB = NULL;
-PFNGLUNIFORM1IVARBPROC __glewUniform1ivARB = NULL;
-PFNGLUNIFORM2FARBPROC __glewUniform2fARB = NULL;
-PFNGLUNIFORM2FVARBPROC __glewUniform2fvARB = NULL;
-PFNGLUNIFORM2IARBPROC __glewUniform2iARB = NULL;
-PFNGLUNIFORM2IVARBPROC __glewUniform2ivARB = NULL;
-PFNGLUNIFORM3FARBPROC __glewUniform3fARB = NULL;
-PFNGLUNIFORM3FVARBPROC __glewUniform3fvARB = NULL;
-PFNGLUNIFORM3IARBPROC __glewUniform3iARB = NULL;
-PFNGLUNIFORM3IVARBPROC __glewUniform3ivARB = NULL;
-PFNGLUNIFORM4FARBPROC __glewUniform4fARB = NULL;
-PFNGLUNIFORM4FVARBPROC __glewUniform4fvARB = NULL;
-PFNGLUNIFORM4IARBPROC __glewUniform4iARB = NULL;
-PFNGLUNIFORM4IVARBPROC __glewUniform4ivARB = NULL;
-PFNGLUNIFORMMATRIX2FVARBPROC __glewUniformMatrix2fvARB = NULL;
-PFNGLUNIFORMMATRIX3FVARBPROC __glewUniformMatrix3fvARB = NULL;
-PFNGLUNIFORMMATRIX4FVARBPROC __glewUniformMatrix4fvARB = NULL;
-PFNGLUSEPROGRAMOBJECTARBPROC __glewUseProgramObjectARB = NULL;
-PFNGLVALIDATEPROGRAMARBPROC __glewValidateProgramARB = NULL;
-
-PFNGLSHADERSTORAGEBLOCKBINDINGPROC __glewShaderStorageBlockBinding = NULL;
-
-PFNGLGETACTIVESUBROUTINENAMEPROC __glewGetActiveSubroutineName = NULL;
-PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC __glewGetActiveSubroutineUniformName = NULL;
-PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC __glewGetActiveSubroutineUniformiv = NULL;
-PFNGLGETPROGRAMSTAGEIVPROC __glewGetProgramStageiv = NULL;
-PFNGLGETSUBROUTINEINDEXPROC __glewGetSubroutineIndex = NULL;
-PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC __glewGetSubroutineUniformLocation = NULL;
-PFNGLGETUNIFORMSUBROUTINEUIVPROC __glewGetUniformSubroutineuiv = NULL;
-PFNGLUNIFORMSUBROUTINESUIVPROC __glewUniformSubroutinesuiv = NULL;
-
-PFNGLCOMPILESHADERINCLUDEARBPROC __glewCompileShaderIncludeARB = NULL;
-PFNGLDELETENAMEDSTRINGARBPROC __glewDeleteNamedStringARB = NULL;
-PFNGLGETNAMEDSTRINGARBPROC __glewGetNamedStringARB = NULL;
-PFNGLGETNAMEDSTRINGIVARBPROC __glewGetNamedStringivARB = NULL;
-PFNGLISNAMEDSTRINGARBPROC __glewIsNamedStringARB = NULL;
-PFNGLNAMEDSTRINGARBPROC __glewNamedStringARB = NULL;
-
-PFNGLBUFFERPAGECOMMITMENTARBPROC __glewBufferPageCommitmentARB = NULL;
-
-PFNGLTEXPAGECOMMITMENTARBPROC __glewTexPageCommitmentARB = NULL;
-PFNGLTEXTUREPAGECOMMITMENTEXTPROC __glewTexturePageCommitmentEXT = NULL;
-
-PFNGLCLIENTWAITSYNCPROC __glewClientWaitSync = NULL;
-PFNGLDELETESYNCPROC __glewDeleteSync = NULL;
-PFNGLFENCESYNCPROC __glewFenceSync = NULL;
-PFNGLGETINTEGER64VPROC __glewGetInteger64v = NULL;
-PFNGLGETSYNCIVPROC __glewGetSynciv = NULL;
-PFNGLISSYNCPROC __glewIsSync = NULL;
-PFNGLWAITSYNCPROC __glewWaitSync = NULL;
-
-PFNGLPATCHPARAMETERFVPROC __glewPatchParameterfv = NULL;
-PFNGLPATCHPARAMETERIPROC __glewPatchParameteri = NULL;
-
-PFNGLTEXTUREBARRIERPROC __glewTextureBarrier = NULL;
-
-PFNGLTEXBUFFERARBPROC __glewTexBufferARB = NULL;
-
-PFNGLTEXBUFFERRANGEPROC __glewTexBufferRange = NULL;
-PFNGLTEXTUREBUFFERRANGEEXTPROC __glewTextureBufferRangeEXT = NULL;
-
-PFNGLCOMPRESSEDTEXIMAGE1DARBPROC __glewCompressedTexImage1DARB = NULL;
-PFNGLCOMPRESSEDTEXIMAGE2DARBPROC __glewCompressedTexImage2DARB = NULL;
-PFNGLCOMPRESSEDTEXIMAGE3DARBPROC __glewCompressedTexImage3DARB = NULL;
-PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC __glewCompressedTexSubImage1DARB = NULL;
-PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC __glewCompressedTexSubImage2DARB = NULL;
-PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC __glewCompressedTexSubImage3DARB = NULL;
-PFNGLGETCOMPRESSEDTEXIMAGEARBPROC __glewGetCompressedTexImageARB = NULL;
-
-PFNGLGETMULTISAMPLEFVPROC __glewGetMultisamplefv = NULL;
-PFNGLSAMPLEMASKIPROC __glewSampleMaski = NULL;
-PFNGLTEXIMAGE2DMULTISAMPLEPROC __glewTexImage2DMultisample = NULL;
-PFNGLTEXIMAGE3DMULTISAMPLEPROC __glewTexImage3DMultisample = NULL;
-
-PFNGLTEXSTORAGE1DPROC __glewTexStorage1D = NULL;
-PFNGLTEXSTORAGE2DPROC __glewTexStorage2D = NULL;
-PFNGLTEXSTORAGE3DPROC __glewTexStorage3D = NULL;
-PFNGLTEXTURESTORAGE1DEXTPROC __glewTextureStorage1DEXT = NULL;
-PFNGLTEXTURESTORAGE2DEXTPROC __glewTextureStorage2DEXT = NULL;
-PFNGLTEXTURESTORAGE3DEXTPROC __glewTextureStorage3DEXT = NULL;
-
-PFNGLTEXSTORAGE2DMULTISAMPLEPROC __glewTexStorage2DMultisample = NULL;
-PFNGLTEXSTORAGE3DMULTISAMPLEPROC __glewTexStorage3DMultisample = NULL;
-PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC __glewTextureStorage2DMultisampleEXT = NULL;
-PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC __glewTextureStorage3DMultisampleEXT = NULL;
-
-PFNGLTEXTUREVIEWPROC __glewTextureView = NULL;
-
-PFNGLGETQUERYOBJECTI64VPROC __glewGetQueryObjecti64v = NULL;
-PFNGLGETQUERYOBJECTUI64VPROC __glewGetQueryObjectui64v = NULL;
-PFNGLQUERYCOUNTERPROC __glewQueryCounter = NULL;
-
-PFNGLBINDTRANSFORMFEEDBACKPROC __glewBindTransformFeedback = NULL;
-PFNGLDELETETRANSFORMFEEDBACKSPROC __glewDeleteTransformFeedbacks = NULL;
-PFNGLDRAWTRANSFORMFEEDBACKPROC __glewDrawTransformFeedback = NULL;
-PFNGLGENTRANSFORMFEEDBACKSPROC __glewGenTransformFeedbacks = NULL;
-PFNGLISTRANSFORMFEEDBACKPROC __glewIsTransformFeedback = NULL;
-PFNGLPAUSETRANSFORMFEEDBACKPROC __glewPauseTransformFeedback = NULL;
-PFNGLRESUMETRANSFORMFEEDBACKPROC __glewResumeTransformFeedback = NULL;
-
-PFNGLBEGINQUERYINDEXEDPROC __glewBeginQueryIndexed = NULL;
-PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC __glewDrawTransformFeedbackStream = NULL;
-PFNGLENDQUERYINDEXEDPROC __glewEndQueryIndexed = NULL;
-PFNGLGETQUERYINDEXEDIVPROC __glewGetQueryIndexediv = NULL;
-
-PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC __glewDrawTransformFeedbackInstanced = NULL;
-PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC __glewDrawTransformFeedbackStreamInstanced = NULL;
-
-PFNGLLOADTRANSPOSEMATRIXDARBPROC __glewLoadTransposeMatrixdARB = NULL;
-PFNGLLOADTRANSPOSEMATRIXFARBPROC __glewLoadTransposeMatrixfARB = NULL;
-PFNGLMULTTRANSPOSEMATRIXDARBPROC __glewMultTransposeMatrixdARB = NULL;
-PFNGLMULTTRANSPOSEMATRIXFARBPROC __glewMultTransposeMatrixfARB = NULL;
-
-PFNGLBINDBUFFERBASEPROC __glewBindBufferBase = NULL;
-PFNGLBINDBUFFERRANGEPROC __glewBindBufferRange = NULL;
-PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC __glewGetActiveUniformBlockName = NULL;
-PFNGLGETACTIVEUNIFORMBLOCKIVPROC __glewGetActiveUniformBlockiv = NULL;
-PFNGLGETACTIVEUNIFORMNAMEPROC __glewGetActiveUniformName = NULL;
-PFNGLGETACTIVEUNIFORMSIVPROC __glewGetActiveUniformsiv = NULL;
-PFNGLGETINTEGERI_VPROC __glewGetIntegeri_v = NULL;
-PFNGLGETUNIFORMBLOCKINDEXPROC __glewGetUniformBlockIndex = NULL;
-PFNGLGETUNIFORMINDICESPROC __glewGetUniformIndices = NULL;
-PFNGLUNIFORMBLOCKBINDINGPROC __glewUniformBlockBinding = NULL;
-
-PFNGLBINDVERTEXARRAYPROC __glewBindVertexArray = NULL;
-PFNGLDELETEVERTEXARRAYSPROC __glewDeleteVertexArrays = NULL;
-PFNGLGENVERTEXARRAYSPROC __glewGenVertexArrays = NULL;
-PFNGLISVERTEXARRAYPROC __glewIsVertexArray = NULL;
-
-PFNGLGETVERTEXATTRIBLDVPROC __glewGetVertexAttribLdv = NULL;
-PFNGLVERTEXATTRIBL1DPROC __glewVertexAttribL1d = NULL;
-PFNGLVERTEXATTRIBL1DVPROC __glewVertexAttribL1dv = NULL;
-PFNGLVERTEXATTRIBL2DPROC __glewVertexAttribL2d = NULL;
-PFNGLVERTEXATTRIBL2DVPROC __glewVertexAttribL2dv = NULL;
-PFNGLVERTEXATTRIBL3DPROC __glewVertexAttribL3d = NULL;
-PFNGLVERTEXATTRIBL3DVPROC __glewVertexAttribL3dv = NULL;
-PFNGLVERTEXATTRIBL4DPROC __glewVertexAttribL4d = NULL;
-PFNGLVERTEXATTRIBL4DVPROC __glewVertexAttribL4dv = NULL;
-PFNGLVERTEXATTRIBLPOINTERPROC __glewVertexAttribLPointer = NULL;
-
-PFNGLBINDVERTEXBUFFERPROC __glewBindVertexBuffer = NULL;
-PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC __glewVertexArrayBindVertexBufferEXT = NULL;
-PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC __glewVertexArrayVertexAttribBindingEXT = NULL;
-PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC __glewVertexArrayVertexAttribFormatEXT = NULL;
-PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC __glewVertexArrayVertexAttribIFormatEXT = NULL;
-PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC __glewVertexArrayVertexAttribLFormatEXT = NULL;
-PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC __glewVertexArrayVertexBindingDivisorEXT = NULL;
-PFNGLVERTEXATTRIBBINDINGPROC __glewVertexAttribBinding = NULL;
-PFNGLVERTEXATTRIBFORMATPROC __glewVertexAttribFormat = NULL;
-PFNGLVERTEXATTRIBIFORMATPROC __glewVertexAttribIFormat = NULL;
-PFNGLVERTEXATTRIBLFORMATPROC __glewVertexAttribLFormat = NULL;
-PFNGLVERTEXBINDINGDIVISORPROC __glewVertexBindingDivisor = NULL;
-
-PFNGLVERTEXBLENDARBPROC __glewVertexBlendARB = NULL;
-PFNGLWEIGHTPOINTERARBPROC __glewWeightPointerARB = NULL;
-PFNGLWEIGHTBVARBPROC __glewWeightbvARB = NULL;
-PFNGLWEIGHTDVARBPROC __glewWeightdvARB = NULL;
-PFNGLWEIGHTFVARBPROC __glewWeightfvARB = NULL;
-PFNGLWEIGHTIVARBPROC __glewWeightivARB = NULL;
-PFNGLWEIGHTSVARBPROC __glewWeightsvARB = NULL;
-PFNGLWEIGHTUBVARBPROC __glewWeightubvARB = NULL;
-PFNGLWEIGHTUIVARBPROC __glewWeightuivARB = NULL;
-PFNGLWEIGHTUSVARBPROC __glewWeightusvARB = NULL;
-
-PFNGLBINDBUFFERARBPROC __glewBindBufferARB = NULL;
-PFNGLBUFFERDATAARBPROC __glewBufferDataARB = NULL;
-PFNGLBUFFERSUBDATAARBPROC __glewBufferSubDataARB = NULL;
-PFNGLDELETEBUFFERSARBPROC __glewDeleteBuffersARB = NULL;
-PFNGLGENBUFFERSARBPROC __glewGenBuffersARB = NULL;
-PFNGLGETBUFFERPARAMETERIVARBPROC __glewGetBufferParameterivARB = NULL;
-PFNGLGETBUFFERPOINTERVARBPROC __glewGetBufferPointervARB = NULL;
-PFNGLGETBUFFERSUBDATAARBPROC __glewGetBufferSubDataARB = NULL;
-PFNGLISBUFFERARBPROC __glewIsBufferARB = NULL;
-PFNGLMAPBUFFERARBPROC __glewMapBufferARB = NULL;
-PFNGLUNMAPBUFFERARBPROC __glewUnmapBufferARB = NULL;
-
-PFNGLBINDPROGRAMARBPROC __glewBindProgramARB = NULL;
-PFNGLDELETEPROGRAMSARBPROC __glewDeleteProgramsARB = NULL;
-PFNGLDISABLEVERTEXATTRIBARRAYARBPROC __glewDisableVertexAttribArrayARB = NULL;
-PFNGLENABLEVERTEXATTRIBARRAYARBPROC __glewEnableVertexAttribArrayARB = NULL;
-PFNGLGENPROGRAMSARBPROC __glewGenProgramsARB = NULL;
-PFNGLGETPROGRAMENVPARAMETERDVARBPROC __glewGetProgramEnvParameterdvARB = NULL;
-PFNGLGETPROGRAMENVPARAMETERFVARBPROC __glewGetProgramEnvParameterfvARB = NULL;
-PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC __glewGetProgramLocalParameterdvARB = NULL;
-PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC __glewGetProgramLocalParameterfvARB = NULL;
-PFNGLGETPROGRAMSTRINGARBPROC __glewGetProgramStringARB = NULL;
-PFNGLGETPROGRAMIVARBPROC __glewGetProgramivARB = NULL;
-PFNGLGETVERTEXATTRIBPOINTERVARBPROC __glewGetVertexAttribPointervARB = NULL;
-PFNGLGETVERTEXATTRIBDVARBPROC __glewGetVertexAttribdvARB = NULL;
-PFNGLGETVERTEXATTRIBFVARBPROC __glewGetVertexAttribfvARB = NULL;
-PFNGLGETVERTEXATTRIBIVARBPROC __glewGetVertexAttribivARB = NULL;
-PFNGLISPROGRAMARBPROC __glewIsProgramARB = NULL;
-PFNGLPROGRAMENVPARAMETER4DARBPROC __glewProgramEnvParameter4dARB = NULL;
-PFNGLPROGRAMENVPARAMETER4DVARBPROC __glewProgramEnvParameter4dvARB = NULL;
-PFNGLPROGRAMENVPARAMETER4FARBPROC __glewProgramEnvParameter4fARB = NULL;
-PFNGLPROGRAMENVPARAMETER4FVARBPROC __glewProgramEnvParameter4fvARB = NULL;
-PFNGLPROGRAMLOCALPARAMETER4DARBPROC __glewProgramLocalParameter4dARB = NULL;
-PFNGLPROGRAMLOCALPARAMETER4DVARBPROC __glewProgramLocalParameter4dvARB = NULL;
-PFNGLPROGRAMLOCALPARAMETER4FARBPROC __glewProgramLocalParameter4fARB = NULL;
-PFNGLPROGRAMLOCALPARAMETER4FVARBPROC __glewProgramLocalParameter4fvARB = NULL;
-PFNGLPROGRAMSTRINGARBPROC __glewProgramStringARB = NULL;
-PFNGLVERTEXATTRIB1DARBPROC __glewVertexAttrib1dARB = NULL;
-PFNGLVERTEXATTRIB1DVARBPROC __glewVertexAttrib1dvARB = NULL;
-PFNGLVERTEXATTRIB1FARBPROC __glewVertexAttrib1fARB = NULL;
-PFNGLVERTEXATTRIB1FVARBPROC __glewVertexAttrib1fvARB = NULL;
-PFNGLVERTEXATTRIB1SARBPROC __glewVertexAttrib1sARB = NULL;
-PFNGLVERTEXATTRIB1SVARBPROC __glewVertexAttrib1svARB = NULL;
-PFNGLVERTEXATTRIB2DARBPROC __glewVertexAttrib2dARB = NULL;
-PFNGLVERTEXATTRIB2DVARBPROC __glewVertexAttrib2dvARB = NULL;
-PFNGLVERTEXATTRIB2FARBPROC __glewVertexAttrib2fARB = NULL;
-PFNGLVERTEXATTRIB2FVARBPROC __glewVertexAttrib2fvARB = NULL;
-PFNGLVERTEXATTRIB2SARBPROC __glewVertexAttrib2sARB = NULL;
-PFNGLVERTEXATTRIB2SVARBPROC __glewVertexAttrib2svARB = NULL;
-PFNGLVERTEXATTRIB3DARBPROC __glewVertexAttrib3dARB = NULL;
-PFNGLVERTEXATTRIB3DVARBPROC __glewVertexAttrib3dvARB = NULL;
-PFNGLVERTEXATTRIB3FARBPROC __glewVertexAttrib3fARB = NULL;
-PFNGLVERTEXATTRIB3FVARBPROC __glewVertexAttrib3fvARB = NULL;
-PFNGLVERTEXATTRIB3SARBPROC __glewVertexAttrib3sARB = NULL;
-PFNGLVERTEXATTRIB3SVARBPROC __glewVertexAttrib3svARB = NULL;
-PFNGLVERTEXATTRIB4NBVARBPROC __glewVertexAttrib4NbvARB = NULL;
-PFNGLVERTEXATTRIB4NIVARBPROC __glewVertexAttrib4NivARB = NULL;
-PFNGLVERTEXATTRIB4NSVARBPROC __glewVertexAttrib4NsvARB = NULL;
-PFNGLVERTEXATTRIB4NUBARBPROC __glewVertexAttrib4NubARB = NULL;
-PFNGLVERTEXATTRIB4NUBVARBPROC __glewVertexAttrib4NubvARB = NULL;
-PFNGLVERTEXATTRIB4NUIVARBPROC __glewVertexAttrib4NuivARB = NULL;
-PFNGLVERTEXATTRIB4NUSVARBPROC __glewVertexAttrib4NusvARB = NULL;
-PFNGLVERTEXATTRIB4BVARBPROC __glewVertexAttrib4bvARB = NULL;
-PFNGLVERTEXATTRIB4DARBPROC __glewVertexAttrib4dARB = NULL;
-PFNGLVERTEXATTRIB4DVARBPROC __glewVertexAttrib4dvARB = NULL;
-PFNGLVERTEXATTRIB4FARBPROC __glewVertexAttrib4fARB = NULL;
-PFNGLVERTEXATTRIB4FVARBPROC __glewVertexAttrib4fvARB = NULL;
-PFNGLVERTEXATTRIB4IVARBPROC __glewVertexAttrib4ivARB = NULL;
-PFNGLVERTEXATTRIB4SARBPROC __glewVertexAttrib4sARB = NULL;
-PFNGLVERTEXATTRIB4SVARBPROC __glewVertexAttrib4svARB = NULL;
-PFNGLVERTEXATTRIB4UBVARBPROC __glewVertexAttrib4ubvARB = NULL;
-PFNGLVERTEXATTRIB4UIVARBPROC __glewVertexAttrib4uivARB = NULL;
-PFNGLVERTEXATTRIB4USVARBPROC __glewVertexAttrib4usvARB = NULL;
-PFNGLVERTEXATTRIBPOINTERARBPROC __glewVertexAttribPointerARB = NULL;
-
-PFNGLBINDATTRIBLOCATIONARBPROC __glewBindAttribLocationARB = NULL;
-PFNGLGETACTIVEATTRIBARBPROC __glewGetActiveAttribARB = NULL;
-PFNGLGETATTRIBLOCATIONARBPROC __glewGetAttribLocationARB = NULL;
-
-PFNGLCOLORP3UIPROC __glewColorP3ui = NULL;
-PFNGLCOLORP3UIVPROC __glewColorP3uiv = NULL;
-PFNGLCOLORP4UIPROC __glewColorP4ui = NULL;
-PFNGLCOLORP4UIVPROC __glewColorP4uiv = NULL;
-PFNGLMULTITEXCOORDP1UIPROC __glewMultiTexCoordP1ui = NULL;
-PFNGLMULTITEXCOORDP1UIVPROC __glewMultiTexCoordP1uiv = NULL;
-PFNGLMULTITEXCOORDP2UIPROC __glewMultiTexCoordP2ui = NULL;
-PFNGLMULTITEXCOORDP2UIVPROC __glewMultiTexCoordP2uiv = NULL;
-PFNGLMULTITEXCOORDP3UIPROC __glewMultiTexCoordP3ui = NULL;
-PFNGLMULTITEXCOORDP3UIVPROC __glewMultiTexCoordP3uiv = NULL;
-PFNGLMULTITEXCOORDP4UIPROC __glewMultiTexCoordP4ui = NULL;
-PFNGLMULTITEXCOORDP4UIVPROC __glewMultiTexCoordP4uiv = NULL;
-PFNGLNORMALP3UIPROC __glewNormalP3ui = NULL;
-PFNGLNORMALP3UIVPROC __glewNormalP3uiv = NULL;
-PFNGLSECONDARYCOLORP3UIPROC __glewSecondaryColorP3ui = NULL;
-PFNGLSECONDARYCOLORP3UIVPROC __glewSecondaryColorP3uiv = NULL;
-PFNGLTEXCOORDP1UIPROC __glewTexCoordP1ui = NULL;
-PFNGLTEXCOORDP1UIVPROC __glewTexCoordP1uiv = NULL;
-PFNGLTEXCOORDP2UIPROC __glewTexCoordP2ui = NULL;
-PFNGLTEXCOORDP2UIVPROC __glewTexCoordP2uiv = NULL;
-PFNGLTEXCOORDP3UIPROC __glewTexCoordP3ui = NULL;
-PFNGLTEXCOORDP3UIVPROC __glewTexCoordP3uiv = NULL;
-PFNGLTEXCOORDP4UIPROC __glewTexCoordP4ui = NULL;
-PFNGLTEXCOORDP4UIVPROC __glewTexCoordP4uiv = NULL;
-PFNGLVERTEXATTRIBP1UIPROC __glewVertexAttribP1ui = NULL;
-PFNGLVERTEXATTRIBP1UIVPROC __glewVertexAttribP1uiv = NULL;
-PFNGLVERTEXATTRIBP2UIPROC __glewVertexAttribP2ui = NULL;
-PFNGLVERTEXATTRIBP2UIVPROC __glewVertexAttribP2uiv = NULL;
-PFNGLVERTEXATTRIBP3UIPROC __glewVertexAttribP3ui = NULL;
-PFNGLVERTEXATTRIBP3UIVPROC __glewVertexAttribP3uiv = NULL;
-PFNGLVERTEXATTRIBP4UIPROC __glewVertexAttribP4ui = NULL;
-PFNGLVERTEXATTRIBP4UIVPROC __glewVertexAttribP4uiv = NULL;
-PFNGLVERTEXP2UIPROC __glewVertexP2ui = NULL;
-PFNGLVERTEXP2UIVPROC __glewVertexP2uiv = NULL;
-PFNGLVERTEXP3UIPROC __glewVertexP3ui = NULL;
-PFNGLVERTEXP3UIVPROC __glewVertexP3uiv = NULL;
-PFNGLVERTEXP4UIPROC __glewVertexP4ui = NULL;
-PFNGLVERTEXP4UIVPROC __glewVertexP4uiv = NULL;
-
-PFNGLDEPTHRANGEARRAYVPROC __glewDepthRangeArrayv = NULL;
-PFNGLDEPTHRANGEINDEXEDPROC __glewDepthRangeIndexed = NULL;
-PFNGLGETDOUBLEI_VPROC __glewGetDoublei_v = NULL;
-PFNGLGETFLOATI_VPROC __glewGetFloati_v = NULL;
-PFNGLSCISSORARRAYVPROC __glewScissorArrayv = NULL;
-PFNGLSCISSORINDEXEDPROC __glewScissorIndexed = NULL;
-PFNGLSCISSORINDEXEDVPROC __glewScissorIndexedv = NULL;
-PFNGLVIEWPORTARRAYVPROC __glewViewportArrayv = NULL;
-PFNGLVIEWPORTINDEXEDFPROC __glewViewportIndexedf = NULL;
-PFNGLVIEWPORTINDEXEDFVPROC __glewViewportIndexedfv = NULL;
-
-PFNGLWINDOWPOS2DARBPROC __glewWindowPos2dARB = NULL;
-PFNGLWINDOWPOS2DVARBPROC __glewWindowPos2dvARB = NULL;
-PFNGLWINDOWPOS2FARBPROC __glewWindowPos2fARB = NULL;
-PFNGLWINDOWPOS2FVARBPROC __glewWindowPos2fvARB = NULL;
-PFNGLWINDOWPOS2IARBPROC __glewWindowPos2iARB = NULL;
-PFNGLWINDOWPOS2IVARBPROC __glewWindowPos2ivARB = NULL;
-PFNGLWINDOWPOS2SARBPROC __glewWindowPos2sARB = NULL;
-PFNGLWINDOWPOS2SVARBPROC __glewWindowPos2svARB = NULL;
-PFNGLWINDOWPOS3DARBPROC __glewWindowPos3dARB = NULL;
-PFNGLWINDOWPOS3DVARBPROC __glewWindowPos3dvARB = NULL;
-PFNGLWINDOWPOS3FARBPROC __glewWindowPos3fARB = NULL;
-PFNGLWINDOWPOS3FVARBPROC __glewWindowPos3fvARB = NULL;
-PFNGLWINDOWPOS3IARBPROC __glewWindowPos3iARB = NULL;
-PFNGLWINDOWPOS3IVARBPROC __glewWindowPos3ivARB = NULL;
-PFNGLWINDOWPOS3SARBPROC __glewWindowPos3sARB = NULL;
-PFNGLWINDOWPOS3SVARBPROC __glewWindowPos3svARB = NULL;
-
-PFNGLDRAWBUFFERSATIPROC __glewDrawBuffersATI = NULL;
-
-PFNGLDRAWELEMENTARRAYATIPROC __glewDrawElementArrayATI = NULL;
-PFNGLDRAWRANGEELEMENTARRAYATIPROC __glewDrawRangeElementArrayATI = NULL;
-PFNGLELEMENTPOINTERATIPROC __glewElementPointerATI = NULL;
-
-PFNGLGETTEXBUMPPARAMETERFVATIPROC __glewGetTexBumpParameterfvATI = NULL;
-PFNGLGETTEXBUMPPARAMETERIVATIPROC __glewGetTexBumpParameterivATI = NULL;
-PFNGLTEXBUMPPARAMETERFVATIPROC __glewTexBumpParameterfvATI = NULL;
-PFNGLTEXBUMPPARAMETERIVATIPROC __glewTexBumpParameterivATI = NULL;
-
-PFNGLALPHAFRAGMENTOP1ATIPROC __glewAlphaFragmentOp1ATI = NULL;
-PFNGLALPHAFRAGMENTOP2ATIPROC __glewAlphaFragmentOp2ATI = NULL;
-PFNGLALPHAFRAGMENTOP3ATIPROC __glewAlphaFragmentOp3ATI = NULL;
-PFNGLBEGINFRAGMENTSHADERATIPROC __glewBeginFragmentShaderATI = NULL;
-PFNGLBINDFRAGMENTSHADERATIPROC __glewBindFragmentShaderATI = NULL;
-PFNGLCOLORFRAGMENTOP1ATIPROC __glewColorFragmentOp1ATI = NULL;
-PFNGLCOLORFRAGMENTOP2ATIPROC __glewColorFragmentOp2ATI = NULL;
-PFNGLCOLORFRAGMENTOP3ATIPROC __glewColorFragmentOp3ATI = NULL;
-PFNGLDELETEFRAGMENTSHADERATIPROC __glewDeleteFragmentShaderATI = NULL;
-PFNGLENDFRAGMENTSHADERATIPROC __glewEndFragmentShaderATI = NULL;
-PFNGLGENFRAGMENTSHADERSATIPROC __glewGenFragmentShadersATI = NULL;
-PFNGLPASSTEXCOORDATIPROC __glewPassTexCoordATI = NULL;
-PFNGLSAMPLEMAPATIPROC __glewSampleMapATI = NULL;
-PFNGLSETFRAGMENTSHADERCONSTANTATIPROC __glewSetFragmentShaderConstantATI = NULL;
-
-PFNGLMAPOBJECTBUFFERATIPROC __glewMapObjectBufferATI = NULL;
-PFNGLUNMAPOBJECTBUFFERATIPROC __glewUnmapObjectBufferATI = NULL;
-
-PFNGLPNTRIANGLESFATIPROC __glewPNTrianglesfATI = NULL;
-PFNGLPNTRIANGLESIATIPROC __glewPNTrianglesiATI = NULL;
-
-PFNGLSTENCILFUNCSEPARATEATIPROC __glewStencilFuncSeparateATI = NULL;
-PFNGLSTENCILOPSEPARATEATIPROC __glewStencilOpSeparateATI = NULL;
-
-PFNGLARRAYOBJECTATIPROC __glewArrayObjectATI = NULL;
-PFNGLFREEOBJECTBUFFERATIPROC __glewFreeObjectBufferATI = NULL;
-PFNGLGETARRAYOBJECTFVATIPROC __glewGetArrayObjectfvATI = NULL;
-PFNGLGETARRAYOBJECTIVATIPROC __glewGetArrayObjectivATI = NULL;
-PFNGLGETOBJECTBUFFERFVATIPROC __glewGetObjectBufferfvATI = NULL;
-PFNGLGETOBJECTBUFFERIVATIPROC __glewGetObjectBufferivATI = NULL;
-PFNGLGETVARIANTARRAYOBJECTFVATIPROC __glewGetVariantArrayObjectfvATI = NULL;
-PFNGLGETVARIANTARRAYOBJECTIVATIPROC __glewGetVariantArrayObjectivATI = NULL;
-PFNGLISOBJECTBUFFERATIPROC __glewIsObjectBufferATI = NULL;
-PFNGLNEWOBJECTBUFFERATIPROC __glewNewObjectBufferATI = NULL;
-PFNGLUPDATEOBJECTBUFFERATIPROC __glewUpdateObjectBufferATI = NULL;
-PFNGLVARIANTARRAYOBJECTATIPROC __glewVariantArrayObjectATI = NULL;
-
-PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC __glewGetVertexAttribArrayObjectfvATI = NULL;
-PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC __glewGetVertexAttribArrayObjectivATI = NULL;
-PFNGLVERTEXATTRIBARRAYOBJECTATIPROC __glewVertexAttribArrayObjectATI = NULL;
-
-PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC __glewClientActiveVertexStreamATI = NULL;
-PFNGLNORMALSTREAM3BATIPROC __glewNormalStream3bATI = NULL;
-PFNGLNORMALSTREAM3BVATIPROC __glewNormalStream3bvATI = NULL;
-PFNGLNORMALSTREAM3DATIPROC __glewNormalStream3dATI = NULL;
-PFNGLNORMALSTREAM3DVATIPROC __glewNormalStream3dvATI = NULL;
-PFNGLNORMALSTREAM3FATIPROC __glewNormalStream3fATI = NULL;
-PFNGLNORMALSTREAM3FVATIPROC __glewNormalStream3fvATI = NULL;
-PFNGLNORMALSTREAM3IATIPROC __glewNormalStream3iATI = NULL;
-PFNGLNORMALSTREAM3IVATIPROC __glewNormalStream3ivATI = NULL;
-PFNGLNORMALSTREAM3SATIPROC __glewNormalStream3sATI = NULL;
-PFNGLNORMALSTREAM3SVATIPROC __glewNormalStream3svATI = NULL;
-PFNGLVERTEXBLENDENVFATIPROC __glewVertexBlendEnvfATI = NULL;
-PFNGLVERTEXBLENDENVIATIPROC __glewVertexBlendEnviATI = NULL;
-PFNGLVERTEXSTREAM1DATIPROC __glewVertexStream1dATI = NULL;
-PFNGLVERTEXSTREAM1DVATIPROC __glewVertexStream1dvATI = NULL;
-PFNGLVERTEXSTREAM1FATIPROC __glewVertexStream1fATI = NULL;
-PFNGLVERTEXSTREAM1FVATIPROC __glewVertexStream1fvATI = NULL;
-PFNGLVERTEXSTREAM1IATIPROC __glewVertexStream1iATI = NULL;
-PFNGLVERTEXSTREAM1IVATIPROC __glewVertexStream1ivATI = NULL;
-PFNGLVERTEXSTREAM1SATIPROC __glewVertexStream1sATI = NULL;
-PFNGLVERTEXSTREAM1SVATIPROC __glewVertexStream1svATI = NULL;
-PFNGLVERTEXSTREAM2DATIPROC __glewVertexStream2dATI = NULL;
-PFNGLVERTEXSTREAM2DVATIPROC __glewVertexStream2dvATI = NULL;
-PFNGLVERTEXSTREAM2FATIPROC __glewVertexStream2fATI = NULL;
-PFNGLVERTEXSTREAM2FVATIPROC __glewVertexStream2fvATI = NULL;
-PFNGLVERTEXSTREAM2IATIPROC __glewVertexStream2iATI = NULL;
-PFNGLVERTEXSTREAM2IVATIPROC __glewVertexStream2ivATI = NULL;
-PFNGLVERTEXSTREAM2SATIPROC __glewVertexStream2sATI = NULL;
-PFNGLVERTEXSTREAM2SVATIPROC __glewVertexStream2svATI = NULL;
-PFNGLVERTEXSTREAM3DATIPROC __glewVertexStream3dATI = NULL;
-PFNGLVERTEXSTREAM3DVATIPROC __glewVertexStream3dvATI = NULL;
-PFNGLVERTEXSTREAM3FATIPROC __glewVertexStream3fATI = NULL;
-PFNGLVERTEXSTREAM3FVATIPROC __glewVertexStream3fvATI = NULL;
-PFNGLVERTEXSTREAM3IATIPROC __glewVertexStream3iATI = NULL;
-PFNGLVERTEXSTREAM3IVATIPROC __glewVertexStream3ivATI = NULL;
-PFNGLVERTEXSTREAM3SATIPROC __glewVertexStream3sATI = NULL;
-PFNGLVERTEXSTREAM3SVATIPROC __glewVertexStream3svATI = NULL;
-PFNGLVERTEXSTREAM4DATIPROC __glewVertexStream4dATI = NULL;
-PFNGLVERTEXSTREAM4DVATIPROC __glewVertexStream4dvATI = NULL;
-PFNGLVERTEXSTREAM4FATIPROC __glewVertexStream4fATI = NULL;
-PFNGLVERTEXSTREAM4FVATIPROC __glewVertexStream4fvATI = NULL;
-PFNGLVERTEXSTREAM4IATIPROC __glewVertexStream4iATI = NULL;
-PFNGLVERTEXSTREAM4IVATIPROC __glewVertexStream4ivATI = NULL;
-PFNGLVERTEXSTREAM4SATIPROC __glewVertexStream4sATI = NULL;
-PFNGLVERTEXSTREAM4SVATIPROC __glewVertexStream4svATI = NULL;
-
-PFNGLGETUNIFORMBUFFERSIZEEXTPROC __glewGetUniformBufferSizeEXT = NULL;
-PFNGLGETUNIFORMOFFSETEXTPROC __glewGetUniformOffsetEXT = NULL;
-PFNGLUNIFORMBUFFEREXTPROC __glewUniformBufferEXT = NULL;
-
-PFNGLBLENDCOLOREXTPROC __glewBlendColorEXT = NULL;
-
-PFNGLBLENDEQUATIONSEPARATEEXTPROC __glewBlendEquationSeparateEXT = NULL;
-
-PFNGLBLENDFUNCSEPARATEEXTPROC __glewBlendFuncSeparateEXT = NULL;
-
-PFNGLBLENDEQUATIONEXTPROC __glewBlendEquationEXT = NULL;
-
-PFNGLCOLORSUBTABLEEXTPROC __glewColorSubTableEXT = NULL;
-PFNGLCOPYCOLORSUBTABLEEXTPROC __glewCopyColorSubTableEXT = NULL;
-
-PFNGLLOCKARRAYSEXTPROC __glewLockArraysEXT = NULL;
-PFNGLUNLOCKARRAYSEXTPROC __glewUnlockArraysEXT = NULL;
-
-PFNGLCONVOLUTIONFILTER1DEXTPROC __glewConvolutionFilter1DEXT = NULL;
-PFNGLCONVOLUTIONFILTER2DEXTPROC __glewConvolutionFilter2DEXT = NULL;
-PFNGLCONVOLUTIONPARAMETERFEXTPROC __glewConvolutionParameterfEXT = NULL;
-PFNGLCONVOLUTIONPARAMETERFVEXTPROC __glewConvolutionParameterfvEXT = NULL;
-PFNGLCONVOLUTIONPARAMETERIEXTPROC __glewConvolutionParameteriEXT = NULL;
-PFNGLCONVOLUTIONPARAMETERIVEXTPROC __glewConvolutionParameterivEXT = NULL;
-PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC __glewCopyConvolutionFilter1DEXT = NULL;
-PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC __glewCopyConvolutionFilter2DEXT = NULL;
-PFNGLGETCONVOLUTIONFILTEREXTPROC __glewGetConvolutionFilterEXT = NULL;
-PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC __glewGetConvolutionParameterfvEXT = NULL;
-PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC __glewGetConvolutionParameterivEXT = NULL;
-PFNGLGETSEPARABLEFILTEREXTPROC __glewGetSeparableFilterEXT = NULL;
-PFNGLSEPARABLEFILTER2DEXTPROC __glewSeparableFilter2DEXT = NULL;
-
-PFNGLBINORMALPOINTEREXTPROC __glewBinormalPointerEXT = NULL;
-PFNGLTANGENTPOINTEREXTPROC __glewTangentPointerEXT = NULL;
-
-PFNGLCOPYTEXIMAGE1DEXTPROC __glewCopyTexImage1DEXT = NULL;
-PFNGLCOPYTEXIMAGE2DEXTPROC __glewCopyTexImage2DEXT = NULL;
-PFNGLCOPYTEXSUBIMAGE1DEXTPROC __glewCopyTexSubImage1DEXT = NULL;
-PFNGLCOPYTEXSUBIMAGE2DEXTPROC __glewCopyTexSubImage2DEXT = NULL;
-PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT = NULL;
-
-PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT = NULL;
-PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT = NULL;
-
-PFNGLGETOBJECTLABELEXTPROC __glewGetObjectLabelEXT = NULL;
-PFNGLLABELOBJECTEXTPROC __glewLabelObjectEXT = NULL;
-
-PFNGLINSERTEVENTMARKEREXTPROC __glewInsertEventMarkerEXT = NULL;
-PFNGLPOPGROUPMARKEREXTPROC __glewPopGroupMarkerEXT = NULL;
-PFNGLPUSHGROUPMARKEREXTPROC __glewPushGroupMarkerEXT = NULL;
-
-PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT = NULL;
-
-PFNGLBINDMULTITEXTUREEXTPROC __glewBindMultiTextureEXT = NULL;
-PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC __glewCheckNamedFramebufferStatusEXT = NULL;
-PFNGLCLIENTATTRIBDEFAULTEXTPROC __glewClientAttribDefaultEXT = NULL;
-PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC __glewCompressedMultiTexImage1DEXT = NULL;
-PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC __glewCompressedMultiTexImage2DEXT = NULL;
-PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC __glewCompressedMultiTexImage3DEXT = NULL;
-PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC __glewCompressedMultiTexSubImage1DEXT = NULL;
-PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC __glewCompressedMultiTexSubImage2DEXT = NULL;
-PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC __glewCompressedMultiTexSubImage3DEXT = NULL;
-PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC __glewCompressedTextureImage1DEXT = NULL;
-PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC __glewCompressedTextureImage2DEXT = NULL;
-PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC __glewCompressedTextureImage3DEXT = NULL;
-PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC __glewCompressedTextureSubImage1DEXT = NULL;
-PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC __glewCompressedTextureSubImage2DEXT = NULL;
-PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC __glewCompressedTextureSubImage3DEXT = NULL;
-PFNGLCOPYMULTITEXIMAGE1DEXTPROC __glewCopyMultiTexImage1DEXT = NULL;
-PFNGLCOPYMULTITEXIMAGE2DEXTPROC __glewCopyMultiTexImage2DEXT = NULL;
-PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC __glewCopyMultiTexSubImage1DEXT = NULL;
-PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC __glewCopyMultiTexSubImage2DEXT = NULL;
-PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC __glewCopyMultiTexSubImage3DEXT = NULL;
-PFNGLCOPYTEXTUREIMAGE1DEXTPROC __glewCopyTextureImage1DEXT = NULL;
-PFNGLCOPYTEXTUREIMAGE2DEXTPROC __glewCopyTextureImage2DEXT = NULL;
-PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC __glewCopyTextureSubImage1DEXT = NULL;
-PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC __glewCopyTextureSubImage2DEXT = NULL;
-PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC __glewCopyTextureSubImage3DEXT = NULL;
-PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC __glewDisableClientStateIndexedEXT = NULL;
-PFNGLDISABLECLIENTSTATEIEXTPROC __glewDisableClientStateiEXT = NULL;
-PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC __glewDisableVertexArrayAttribEXT = NULL;
-PFNGLDISABLEVERTEXARRAYEXTPROC __glewDisableVertexArrayEXT = NULL;
-PFNGLENABLECLIENTSTATEINDEXEDEXTPROC __glewEnableClientStateIndexedEXT = NULL;
-PFNGLENABLECLIENTSTATEIEXTPROC __glewEnableClientStateiEXT = NULL;
-PFNGLENABLEVERTEXARRAYATTRIBEXTPROC __glewEnableVertexArrayAttribEXT = NULL;
-PFNGLENABLEVERTEXARRAYEXTPROC __glewEnableVertexArrayEXT = NULL;
-PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC __glewFlushMappedNamedBufferRangeEXT = NULL;
-PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC __glewFramebufferDrawBufferEXT = NULL;
-PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC __glewFramebufferDrawBuffersEXT = NULL;
-PFNGLFRAMEBUFFERREADBUFFEREXTPROC __glewFramebufferReadBufferEXT = NULL;
-PFNGLGENERATEMULTITEXMIPMAPEXTPROC __glewGenerateMultiTexMipmapEXT = NULL;
-PFNGLGENERATETEXTUREMIPMAPEXTPROC __glewGenerateTextureMipmapEXT = NULL;
-PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC __glewGetCompressedMultiTexImageEXT = NULL;
-PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC __glewGetCompressedTextureImageEXT = NULL;
-PFNGLGETDOUBLEINDEXEDVEXTPROC __glewGetDoubleIndexedvEXT = NULL;
-PFNGLGETDOUBLEI_VEXTPROC __glewGetDoublei_vEXT = NULL;
-PFNGLGETFLOATINDEXEDVEXTPROC __glewGetFloatIndexedvEXT = NULL;
-PFNGLGETFLOATI_VEXTPROC __glewGetFloati_vEXT = NULL;
-PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC __glewGetFramebufferParameterivEXT = NULL;
-PFNGLGETMULTITEXENVFVEXTPROC __glewGetMultiTexEnvfvEXT = NULL;
-PFNGLGETMULTITEXENVIVEXTPROC __glewGetMultiTexEnvivEXT = NULL;
-PFNGLGETMULTITEXGENDVEXTPROC __glewGetMultiTexGendvEXT = NULL;
-PFNGLGETMULTITEXGENFVEXTPROC __glewGetMultiTexGenfvEXT = NULL;
-PFNGLGETMULTITEXGENIVEXTPROC __glewGetMultiTexGenivEXT = NULL;
-PFNGLGETMULTITEXIMAGEEXTPROC __glewGetMultiTexImageEXT = NULL;
-PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC __glewGetMultiTexLevelParameterfvEXT = NULL;
-PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC __glewGetMultiTexLevelParameterivEXT = NULL;
-PFNGLGETMULTITEXPARAMETERIIVEXTPROC __glewGetMultiTexParameterIivEXT = NULL;
-PFNGLGETMULTITEXPARAMETERIUIVEXTPROC __glewGetMultiTexParameterIuivEXT = NULL;
-PFNGLGETMULTITEXPARAMETERFVEXTPROC __glewGetMultiTexParameterfvEXT = NULL;
-PFNGLGETMULTITEXPARAMETERIVEXTPROC __glewGetMultiTexParameterivEXT = NULL;
-PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC __glewGetNamedBufferParameterivEXT = NULL;
-PFNGLGETNAMEDBUFFERPOINTERVEXTPROC __glewGetNamedBufferPointervEXT = NULL;
-PFNGLGETNAMEDBUFFERSUBDATAEXTPROC __glewGetNamedBufferSubDataEXT = NULL;
-PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetNamedFramebufferAttachmentParameterivEXT = NULL;
-PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC __glewGetNamedProgramLocalParameterIivEXT = NULL;
-PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC __glewGetNamedProgramLocalParameterIuivEXT = NULL;
-PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC __glewGetNamedProgramLocalParameterdvEXT = NULL;
-PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC __glewGetNamedProgramLocalParameterfvEXT = NULL;
-PFNGLGETNAMEDPROGRAMSTRINGEXTPROC __glewGetNamedProgramStringEXT = NULL;
-PFNGLGETNAMEDPROGRAMIVEXTPROC __glewGetNamedProgramivEXT = NULL;
-PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC __glewGetNamedRenderbufferParameterivEXT = NULL;
-PFNGLGETPOINTERINDEXEDVEXTPROC __glewGetPointerIndexedvEXT = NULL;
-PFNGLGETPOINTERI_VEXTPROC __glewGetPointeri_vEXT = NULL;
-PFNGLGETTEXTUREIMAGEEXTPROC __glewGetTextureImageEXT = NULL;
-PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC __glewGetTextureLevelParameterfvEXT = NULL;
-PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC __glewGetTextureLevelParameterivEXT = NULL;
-PFNGLGETTEXTUREPARAMETERIIVEXTPROC __glewGetTextureParameterIivEXT = NULL;
-PFNGLGETTEXTUREPARAMETERIUIVEXTPROC __glewGetTextureParameterIuivEXT = NULL;
-PFNGLGETTEXTUREPARAMETERFVEXTPROC __glewGetTextureParameterfvEXT = NULL;
-PFNGLGETTEXTUREPARAMETERIVEXTPROC __glewGetTextureParameterivEXT = NULL;
-PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC __glewGetVertexArrayIntegeri_vEXT = NULL;
-PFNGLGETVERTEXARRAYINTEGERVEXTPROC __glewGetVertexArrayIntegervEXT = NULL;
-PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC __glewGetVertexArrayPointeri_vEXT = NULL;
-PFNGLGETVERTEXARRAYPOINTERVEXTPROC __glewGetVertexArrayPointervEXT = NULL;
-PFNGLMAPNAMEDBUFFEREXTPROC __glewMapNamedBufferEXT = NULL;
-PFNGLMAPNAMEDBUFFERRANGEEXTPROC __glewMapNamedBufferRangeEXT = NULL;
-PFNGLMATRIXFRUSTUMEXTPROC __glewMatrixFrustumEXT = NULL;
-PFNGLMATRIXLOADIDENTITYEXTPROC __glewMatrixLoadIdentityEXT = NULL;
-PFNGLMATRIXLOADTRANSPOSEDEXTPROC __glewMatrixLoadTransposedEXT = NULL;
-PFNGLMATRIXLOADTRANSPOSEFEXTPROC __glewMatrixLoadTransposefEXT = NULL;
-PFNGLMATRIXLOADDEXTPROC __glewMatrixLoaddEXT = NULL;
-PFNGLMATRIXLOADFEXTPROC __glewMatrixLoadfEXT = NULL;
-PFNGLMATRIXMULTTRANSPOSEDEXTPROC __glewMatrixMultTransposedEXT = NULL;
-PFNGLMATRIXMULTTRANSPOSEFEXTPROC __glewMatrixMultTransposefEXT = NULL;
-PFNGLMATRIXMULTDEXTPROC __glewMatrixMultdEXT = NULL;
-PFNGLMATRIXMULTFEXTPROC __glewMatrixMultfEXT = NULL;
-PFNGLMATRIXORTHOEXTPROC __glewMatrixOrthoEXT = NULL;
-PFNGLMATRIXPOPEXTPROC __glewMatrixPopEXT = NULL;
-PFNGLMATRIXPUSHEXTPROC __glewMatrixPushEXT = NULL;
-PFNGLMATRIXROTATEDEXTPROC __glewMatrixRotatedEXT = NULL;
-PFNGLMATRIXROTATEFEXTPROC __glewMatrixRotatefEXT = NULL;
-PFNGLMATRIXSCALEDEXTPROC __glewMatrixScaledEXT = NULL;
-PFNGLMATRIXSCALEFEXTPROC __glewMatrixScalefEXT = NULL;
-PFNGLMATRIXTRANSLATEDEXTPROC __glewMatrixTranslatedEXT = NULL;
-PFNGLMATRIXTRANSLATEFEXTPROC __glewMatrixTranslatefEXT = NULL;
-PFNGLMULTITEXBUFFEREXTPROC __glewMultiTexBufferEXT = NULL;
-PFNGLMULTITEXCOORDPOINTEREXTPROC __glewMultiTexCoordPointerEXT = NULL;
-PFNGLMULTITEXENVFEXTPROC __glewMultiTexEnvfEXT = NULL;
-PFNGLMULTITEXENVFVEXTPROC __glewMultiTexEnvfvEXT = NULL;
-PFNGLMULTITEXENVIEXTPROC __glewMultiTexEnviEXT = NULL;
-PFNGLMULTITEXENVIVEXTPROC __glewMultiTexEnvivEXT = NULL;
-PFNGLMULTITEXGENDEXTPROC __glewMultiTexGendEXT = NULL;
-PFNGLMULTITEXGENDVEXTPROC __glewMultiTexGendvEXT = NULL;
-PFNGLMULTITEXGENFEXTPROC __glewMultiTexGenfEXT = NULL;
-PFNGLMULTITEXGENFVEXTPROC __glewMultiTexGenfvEXT = NULL;
-PFNGLMULTITEXGENIEXTPROC __glewMultiTexGeniEXT = NULL;
-PFNGLMULTITEXGENIVEXTPROC __glewMultiTexGenivEXT = NULL;
-PFNGLMULTITEXIMAGE1DEXTPROC __glewMultiTexImage1DEXT = NULL;
-PFNGLMULTITEXIMAGE2DEXTPROC __glewMultiTexImage2DEXT = NULL;
-PFNGLMULTITEXIMAGE3DEXTPROC __glewMultiTexImage3DEXT = NULL;
-PFNGLMULTITEXPARAMETERIIVEXTPROC __glewMultiTexParameterIivEXT = NULL;
-PFNGLMULTITEXPARAMETERIUIVEXTPROC __glewMultiTexParameterIuivEXT = NULL;
-PFNGLMULTITEXPARAMETERFEXTPROC __glewMultiTexParameterfEXT = NULL;
-PFNGLMULTITEXPARAMETERFVEXTPROC __glewMultiTexParameterfvEXT = NULL;
-PFNGLMULTITEXPARAMETERIEXTPROC __glewMultiTexParameteriEXT = NULL;
-PFNGLMULTITEXPARAMETERIVEXTPROC __glewMultiTexParameterivEXT = NULL;
-PFNGLMULTITEXRENDERBUFFEREXTPROC __glewMultiTexRenderbufferEXT = NULL;
-PFNGLMULTITEXSUBIMAGE1DEXTPROC __glewMultiTexSubImage1DEXT = NULL;
-PFNGLMULTITEXSUBIMAGE2DEXTPROC __glewMultiTexSubImage2DEXT = NULL;
-PFNGLMULTITEXSUBIMAGE3DEXTPROC __glewMultiTexSubImage3DEXT = NULL;
-PFNGLNAMEDBUFFERDATAEXTPROC __glewNamedBufferDataEXT = NULL;
-PFNGLNAMEDBUFFERSUBDATAEXTPROC __glewNamedBufferSubDataEXT = NULL;
-PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC __glewNamedCopyBufferSubDataEXT = NULL;
-PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC __glewNamedFramebufferRenderbufferEXT = NULL;
-PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC __glewNamedFramebufferTexture1DEXT = NULL;
-PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC __glewNamedFramebufferTexture2DEXT = NULL;
-PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC __glewNamedFramebufferTexture3DEXT = NULL;
-PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC __glewNamedFramebufferTextureEXT = NULL;
-PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC __glewNamedFramebufferTextureFaceEXT = NULL;
-PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC __glewNamedFramebufferTextureLayerEXT = NULL;
-PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC __glewNamedProgramLocalParameter4dEXT = NULL;
-PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC __glewNamedProgramLocalParameter4dvEXT = NULL;
-PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC __glewNamedProgramLocalParameter4fEXT = NULL;
-PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC __glewNamedProgramLocalParameter4fvEXT = NULL;
-PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC __glewNamedProgramLocalParameterI4iEXT = NULL;
-PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC __glewNamedProgramLocalParameterI4ivEXT = NULL;
-PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC __glewNamedProgramLocalParameterI4uiEXT = NULL;
-PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC __glewNamedProgramLocalParameterI4uivEXT = NULL;
-PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC __glewNamedProgramLocalParameters4fvEXT = NULL;
-PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC __glewNamedProgramLocalParametersI4ivEXT = NULL;
-PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC __glewNamedProgramLocalParametersI4uivEXT = NULL;
-PFNGLNAMEDPROGRAMSTRINGEXTPROC __glewNamedProgramStringEXT = NULL;
-PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC __glewNamedRenderbufferStorageEXT = NULL;
-PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC __glewNamedRenderbufferStorageMultisampleCoverageEXT = NULL;
-PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewNamedRenderbufferStorageMultisampleEXT = NULL;
-PFNGLPROGRAMUNIFORM1FEXTPROC __glewProgramUniform1fEXT = NULL;
-PFNGLPROGRAMUNIFORM1FVEXTPROC __glewProgramUniform1fvEXT = NULL;
-PFNGLPROGRAMUNIFORM1IEXTPROC __glewProgramUniform1iEXT = NULL;
-PFNGLPROGRAMUNIFORM1IVEXTPROC __glewProgramUniform1ivEXT = NULL;
-PFNGLPROGRAMUNIFORM1UIEXTPROC __glewProgramUniform1uiEXT = NULL;
-PFNGLPROGRAMUNIFORM1UIVEXTPROC __glewProgramUniform1uivEXT = NULL;
-PFNGLPROGRAMUNIFORM2FEXTPROC __glewProgramUniform2fEXT = NULL;
-PFNGLPROGRAMUNIFORM2FVEXTPROC __glewProgramUniform2fvEXT = NULL;
-PFNGLPROGRAMUNIFORM2IEXTPROC __glewProgramUniform2iEXT = NULL;
-PFNGLPROGRAMUNIFORM2IVEXTPROC __glewProgramUniform2ivEXT = NULL;
-PFNGLPROGRAMUNIFORM2UIEXTPROC __glewProgramUniform2uiEXT = NULL;
-PFNGLPROGRAMUNIFORM2UIVEXTPROC __glewProgramUniform2uivEXT = NULL;
-PFNGLPROGRAMUNIFORM3FEXTPROC __glewProgramUniform3fEXT = NULL;
-PFNGLPROGRAMUNIFORM3FVEXTPROC __glewProgramUniform3fvEXT = NULL;
-PFNGLPROGRAMUNIFORM3IEXTPROC __glewProgramUniform3iEXT = NULL;
-PFNGLPROGRAMUNIFORM3IVEXTPROC __glewProgramUniform3ivEXT = NULL;
-PFNGLPROGRAMUNIFORM3UIEXTPROC __glewProgramUniform3uiEXT = NULL;
-PFNGLPROGRAMUNIFORM3UIVEXTPROC __glewProgramUniform3uivEXT = NULL;
-PFNGLPROGRAMUNIFORM4FEXTPROC __glewProgramUniform4fEXT = NULL;
-PFNGLPROGRAMUNIFORM4FVEXTPROC __glewProgramUniform4fvEXT = NULL;
-PFNGLPROGRAMUNIFORM4IEXTPROC __glewProgramUniform4iEXT = NULL;
-PFNGLPROGRAMUNIFORM4IVEXTPROC __glewProgramUniform4ivEXT = NULL;
-PFNGLPROGRAMUNIFORM4UIEXTPROC __glewProgramUniform4uiEXT = NULL;
-PFNGLPROGRAMUNIFORM4UIVEXTPROC __glewProgramUniform4uivEXT = NULL;
-PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC __glewProgramUniformMatrix2fvEXT = NULL;
-PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC __glewProgramUniformMatrix2x3fvEXT = NULL;
-PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC __glewProgramUniformMatrix2x4fvEXT = NULL;
-PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC __glewProgramUniformMatrix3fvEXT = NULL;
-PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC __glewProgramUniformMatrix3x2fvEXT = NULL;
-PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC __glewProgramUniformMatrix3x4fvEXT = NULL;
-PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC __glewProgramUniformMatrix4fvEXT = NULL;
-PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC __glewProgramUniformMatrix4x2fvEXT = NULL;
-PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC __glewProgramUniformMatrix4x3fvEXT = NULL;
-PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC __glewPushClientAttribDefaultEXT = NULL;
-PFNGLTEXTUREBUFFEREXTPROC __glewTextureBufferEXT = NULL;
-PFNGLTEXTUREIMAGE1DEXTPROC __glewTextureImage1DEXT = NULL;
-PFNGLTEXTUREIMAGE2DEXTPROC __glewTextureImage2DEXT = NULL;
-PFNGLTEXTUREIMAGE3DEXTPROC __glewTextureImage3DEXT = NULL;
-PFNGLTEXTUREPARAMETERIIVEXTPROC __glewTextureParameterIivEXT = NULL;
-PFNGLTEXTUREPARAMETERIUIVEXTPROC __glewTextureParameterIuivEXT = NULL;
-PFNGLTEXTUREPARAMETERFEXTPROC __glewTextureParameterfEXT = NULL;
-PFNGLTEXTUREPARAMETERFVEXTPROC __glewTextureParameterfvEXT = NULL;
-PFNGLTEXTUREPARAMETERIEXTPROC __glewTextureParameteriEXT = NULL;
-PFNGLTEXTUREPARAMETERIVEXTPROC __glewTextureParameterivEXT = NULL;
-PFNGLTEXTURERENDERBUFFEREXTPROC __glewTextureRenderbufferEXT = NULL;
-PFNGLTEXTURESUBIMAGE1DEXTPROC __glewTextureSubImage1DEXT = NULL;
-PFNGLTEXTURESUBIMAGE2DEXTPROC __glewTextureSubImage2DEXT = NULL;
-PFNGLTEXTURESUBIMAGE3DEXTPROC __glewTextureSubImage3DEXT = NULL;
-PFNGLUNMAPNAMEDBUFFEREXTPROC __glewUnmapNamedBufferEXT = NULL;
-PFNGLVERTEXARRAYCOLOROFFSETEXTPROC __glewVertexArrayColorOffsetEXT = NULL;
-PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC __glewVertexArrayEdgeFlagOffsetEXT = NULL;
-PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC __glewVertexArrayFogCoordOffsetEXT = NULL;
-PFNGLVERTEXARRAYINDEXOFFSETEXTPROC __glewVertexArrayIndexOffsetEXT = NULL;
-PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC __glewVertexArrayMultiTexCoordOffsetEXT = NULL;
-PFNGLVERTEXARRAYNORMALOFFSETEXTPROC __glewVertexArrayNormalOffsetEXT = NULL;
-PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC __glewVertexArraySecondaryColorOffsetEXT = NULL;
-PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC __glewVertexArrayTexCoordOffsetEXT = NULL;
-PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC __glewVertexArrayVertexAttribDivisorEXT = NULL;
-PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC __glewVertexArrayVertexAttribIOffsetEXT = NULL;
-PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC __glewVertexArrayVertexAttribOffsetEXT = NULL;
-PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC __glewVertexArrayVertexOffsetEXT = NULL;
-
-PFNGLCOLORMASKINDEXEDEXTPROC __glewColorMaskIndexedEXT = NULL;
-PFNGLDISABLEINDEXEDEXTPROC __glewDisableIndexedEXT = NULL;
-PFNGLENABLEINDEXEDEXTPROC __glewEnableIndexedEXT = NULL;
-PFNGLGETBOOLEANINDEXEDVEXTPROC __glewGetBooleanIndexedvEXT = NULL;
-PFNGLGETINTEGERINDEXEDVEXTPROC __glewGetIntegerIndexedvEXT = NULL;
-PFNGLISENABLEDINDEXEDEXTPROC __glewIsEnabledIndexedEXT = NULL;
-
-PFNGLDRAWARRAYSINSTANCEDEXTPROC __glewDrawArraysInstancedEXT = NULL;
-PFNGLDRAWELEMENTSINSTANCEDEXTPROC __glewDrawElementsInstancedEXT = NULL;
-
-PFNGLDRAWRANGEELEMENTSEXTPROC __glewDrawRangeElementsEXT = NULL;
-
-PFNGLFOGCOORDPOINTEREXTPROC __glewFogCoordPointerEXT = NULL;
-PFNGLFOGCOORDDEXTPROC __glewFogCoorddEXT = NULL;
-PFNGLFOGCOORDDVEXTPROC __glewFogCoorddvEXT = NULL;
-PFNGLFOGCOORDFEXTPROC __glewFogCoordfEXT = NULL;
-PFNGLFOGCOORDFVEXTPROC __glewFogCoordfvEXT = NULL;
-
-PFNGLFRAGMENTCOLORMATERIALEXTPROC __glewFragmentColorMaterialEXT = NULL;
-PFNGLFRAGMENTLIGHTMODELFEXTPROC __glewFragmentLightModelfEXT = NULL;
-PFNGLFRAGMENTLIGHTMODELFVEXTPROC __glewFragmentLightModelfvEXT = NULL;
-PFNGLFRAGMENTLIGHTMODELIEXTPROC __glewFragmentLightModeliEXT = NULL;
-PFNGLFRAGMENTLIGHTMODELIVEXTPROC __glewFragmentLightModelivEXT = NULL;
-PFNGLFRAGMENTLIGHTFEXTPROC __glewFragmentLightfEXT = NULL;
-PFNGLFRAGMENTLIGHTFVEXTPROC __glewFragmentLightfvEXT = NULL;
-PFNGLFRAGMENTLIGHTIEXTPROC __glewFragmentLightiEXT = NULL;
-PFNGLFRAGMENTLIGHTIVEXTPROC __glewFragmentLightivEXT = NULL;
-PFNGLFRAGMENTMATERIALFEXTPROC __glewFragmentMaterialfEXT = NULL;
-PFNGLFRAGMENTMATERIALFVEXTPROC __glewFragmentMaterialfvEXT = NULL;
-PFNGLFRAGMENTMATERIALIEXTPROC __glewFragmentMaterialiEXT = NULL;
-PFNGLFRAGMENTMATERIALIVEXTPROC __glewFragmentMaterialivEXT = NULL;
-PFNGLGETFRAGMENTLIGHTFVEXTPROC __glewGetFragmentLightfvEXT = NULL;
-PFNGLGETFRAGMENTLIGHTIVEXTPROC __glewGetFragmentLightivEXT = NULL;
-PFNGLGETFRAGMENTMATERIALFVEXTPROC __glewGetFragmentMaterialfvEXT = NULL;
-PFNGLGETFRAGMENTMATERIALIVEXTPROC __glewGetFragmentMaterialivEXT = NULL;
-PFNGLLIGHTENVIEXTPROC __glewLightEnviEXT = NULL;
-
-PFNGLBLITFRAMEBUFFEREXTPROC __glewBlitFramebufferEXT = NULL;
-
-PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewRenderbufferStorageMultisampleEXT = NULL;
-
-PFNGLBINDFRAMEBUFFEREXTPROC __glewBindFramebufferEXT = NULL;
-PFNGLBINDRENDERBUFFEREXTPROC __glewBindRenderbufferEXT = NULL;
-PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC __glewCheckFramebufferStatusEXT = NULL;
-PFNGLDELETEFRAMEBUFFERSEXTPROC __glewDeleteFramebuffersEXT = NULL;
-PFNGLDELETERENDERBUFFERSEXTPROC __glewDeleteRenderbuffersEXT = NULL;
-PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC __glewFramebufferRenderbufferEXT = NULL;
-PFNGLFRAMEBUFFERTEXTURE1DEXTPROC __glewFramebufferTexture1DEXT = NULL;
-PFNGLFRAMEBUFFERTEXTURE2DEXTPROC __glewFramebufferTexture2DEXT = NULL;
-PFNGLFRAMEBUFFERTEXTURE3DEXTPROC __glewFramebufferTexture3DEXT = NULL;
-PFNGLGENFRAMEBUFFERSEXTPROC __glewGenFramebuffersEXT = NULL;
-PFNGLGENRENDERBUFFERSEXTPROC __glewGenRenderbuffersEXT = NULL;
-PFNGLGENERATEMIPMAPEXTPROC __glewGenerateMipmapEXT = NULL;
-PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetFramebufferAttachmentParameterivEXT = NULL;
-PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC __glewGetRenderbufferParameterivEXT = NULL;
-PFNGLISFRAMEBUFFEREXTPROC __glewIsFramebufferEXT = NULL;
-PFNGLISRENDERBUFFEREXTPROC __glewIsRenderbufferEXT = NULL;
-PFNGLRENDERBUFFERSTORAGEEXTPROC __glewRenderbufferStorageEXT = NULL;
-
-PFNGLFRAMEBUFFERTEXTUREEXTPROC __glewFramebufferTextureEXT = NULL;
-PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC __glewFramebufferTextureFaceEXT = NULL;
-PFNGLPROGRAMPARAMETERIEXTPROC __glewProgramParameteriEXT = NULL;
-
-PFNGLPROGRAMENVPARAMETERS4FVEXTPROC __glewProgramEnvParameters4fvEXT = NULL;
-PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC __glewProgramLocalParameters4fvEXT = NULL;
-
-PFNGLBINDFRAGDATALOCATIONEXTPROC __glewBindFragDataLocationEXT = NULL;
-PFNGLGETFRAGDATALOCATIONEXTPROC __glewGetFragDataLocationEXT = NULL;
-PFNGLGETUNIFORMUIVEXTPROC __glewGetUniformuivEXT = NULL;
-PFNGLGETVERTEXATTRIBIIVEXTPROC __glewGetVertexAttribIivEXT = NULL;
-PFNGLGETVERTEXATTRIBIUIVEXTPROC __glewGetVertexAttribIuivEXT = NULL;
-PFNGLUNIFORM1UIEXTPROC __glewUniform1uiEXT = NULL;
-PFNGLUNIFORM1UIVEXTPROC __glewUniform1uivEXT = NULL;
-PFNGLUNIFORM2UIEXTPROC __glewUniform2uiEXT = NULL;
-PFNGLUNIFORM2UIVEXTPROC __glewUniform2uivEXT = NULL;
-PFNGLUNIFORM3UIEXTPROC __glewUniform3uiEXT = NULL;
-PFNGLUNIFORM3UIVEXTPROC __glewUniform3uivEXT = NULL;
-PFNGLUNIFORM4UIEXTPROC __glewUniform4uiEXT = NULL;
-PFNGLUNIFORM4UIVEXTPROC __glewUniform4uivEXT = NULL;
-PFNGLVERTEXATTRIBI1IEXTPROC __glewVertexAttribI1iEXT = NULL;
-PFNGLVERTEXATTRIBI1IVEXTPROC __glewVertexAttribI1ivEXT = NULL;
-PFNGLVERTEXATTRIBI1UIEXTPROC __glewVertexAttribI1uiEXT = NULL;
-PFNGLVERTEXATTRIBI1UIVEXTPROC __glewVertexAttribI1uivEXT = NULL;
-PFNGLVERTEXATTRIBI2IEXTPROC __glewVertexAttribI2iEXT = NULL;
-PFNGLVERTEXATTRIBI2IVEXTPROC __glewVertexAttribI2ivEXT = NULL;
-PFNGLVERTEXATTRIBI2UIEXTPROC __glewVertexAttribI2uiEXT = NULL;
-PFNGLVERTEXATTRIBI2UIVEXTPROC __glewVertexAttribI2uivEXT = NULL;
-PFNGLVERTEXATTRIBI3IEXTPROC __glewVertexAttribI3iEXT = NULL;
-PFNGLVERTEXATTRIBI3IVEXTPROC __glewVertexAttribI3ivEXT = NULL;
-PFNGLVERTEXATTRIBI3UIEXTPROC __glewVertexAttribI3uiEXT = NULL;
-PFNGLVERTEXATTRIBI3UIVEXTPROC __glewVertexAttribI3uivEXT = NULL;
-PFNGLVERTEXATTRIBI4BVEXTPROC __glewVertexAttribI4bvEXT = NULL;
-PFNGLVERTEXATTRIBI4IEXTPROC __glewVertexAttribI4iEXT = NULL;
-PFNGLVERTEXATTRIBI4IVEXTPROC __glewVertexAttribI4ivEXT = NULL;
-PFNGLVERTEXATTRIBI4SVEXTPROC __glewVertexAttribI4svEXT = NULL;
-PFNGLVERTEXATTRIBI4UBVEXTPROC __glewVertexAttribI4ubvEXT = NULL;
-PFNGLVERTEXATTRIBI4UIEXTPROC __glewVertexAttribI4uiEXT = NULL;
-PFNGLVERTEXATTRIBI4UIVEXTPROC __glewVertexAttribI4uivEXT = NULL;
-PFNGLVERTEXATTRIBI4USVEXTPROC __glewVertexAttribI4usvEXT = NULL;
-PFNGLVERTEXATTRIBIPOINTEREXTPROC __glewVertexAttribIPointerEXT = NULL;
-
-PFNGLGETHISTOGRAMEXTPROC __glewGetHistogramEXT = NULL;
-PFNGLGETHISTOGRAMPARAMETERFVEXTPROC __glewGetHistogramParameterfvEXT = NULL;
-PFNGLGETHISTOGRAMPARAMETERIVEXTPROC __glewGetHistogramParameterivEXT = NULL;
-PFNGLGETMINMAXEXTPROC __glewGetMinmaxEXT = NULL;
-PFNGLGETMINMAXPARAMETERFVEXTPROC __glewGetMinmaxParameterfvEXT = NULL;
-PFNGLGETMINMAXPARAMETERIVEXTPROC __glewGetMinmaxParameterivEXT = NULL;
-PFNGLHISTOGRAMEXTPROC __glewHistogramEXT = NULL;
-PFNGLMINMAXEXTPROC __glewMinmaxEXT = NULL;
-PFNGLRESETHISTOGRAMEXTPROC __glewResetHistogramEXT = NULL;
-PFNGLRESETMINMAXEXTPROC __glewResetMinmaxEXT = NULL;
-
-PFNGLINDEXFUNCEXTPROC __glewIndexFuncEXT = NULL;
-
-PFNGLINDEXMATERIALEXTPROC __glewIndexMaterialEXT = NULL;
-
-PFNGLAPPLYTEXTUREEXTPROC __glewApplyTextureEXT = NULL;
-PFNGLTEXTURELIGHTEXTPROC __glewTextureLightEXT = NULL;
-PFNGLTEXTUREMATERIALEXTPROC __glewTextureMaterialEXT = NULL;
-
-PFNGLMULTIDRAWARRAYSEXTPROC __glewMultiDrawArraysEXT = NULL;
-PFNGLMULTIDRAWELEMENTSEXTPROC __glewMultiDrawElementsEXT = NULL;
-
-PFNGLSAMPLEMASKEXTPROC __glewSampleMaskEXT = NULL;
-PFNGLSAMPLEPATTERNEXTPROC __glewSamplePatternEXT = NULL;
-
-PFNGLCOLORTABLEEXTPROC __glewColorTableEXT = NULL;
-PFNGLGETCOLORTABLEEXTPROC __glewGetColorTableEXT = NULL;
-PFNGLGETCOLORTABLEPARAMETERFVEXTPROC __glewGetColorTableParameterfvEXT = NULL;
-PFNGLGETCOLORTABLEPARAMETERIVEXTPROC __glewGetColorTableParameterivEXT = NULL;
-
-PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC __glewGetPixelTransformParameterfvEXT = NULL;
-PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC __glewGetPixelTransformParameterivEXT = NULL;
-PFNGLPIXELTRANSFORMPARAMETERFEXTPROC __glewPixelTransformParameterfEXT = NULL;
-PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC __glewPixelTransformParameterfvEXT = NULL;
-PFNGLPIXELTRANSFORMPARAMETERIEXTPROC __glewPixelTransformParameteriEXT = NULL;
-PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC __glewPixelTransformParameterivEXT = NULL;
-
-PFNGLPOINTPARAMETERFEXTPROC __glewPointParameterfEXT = NULL;
-PFNGLPOINTPARAMETERFVEXTPROC __glewPointParameterfvEXT = NULL;
-
-PFNGLPOLYGONOFFSETEXTPROC __glewPolygonOffsetEXT = NULL;
-
-PFNGLPOLYGONOFFSETCLAMPEXTPROC __glewPolygonOffsetClampEXT = NULL;
-
-PFNGLPROVOKINGVERTEXEXTPROC __glewProvokingVertexEXT = NULL;
-
-PFNGLCOVERAGEMODULATIONNVPROC __glewCoverageModulationNV = NULL;
-PFNGLCOVERAGEMODULATIONTABLENVPROC __glewCoverageModulationTableNV = NULL;
-PFNGLGETCOVERAGEMODULATIONTABLENVPROC __glewGetCoverageModulationTableNV = NULL;
-PFNGLRASTERSAMPLESEXTPROC __glewRasterSamplesEXT = NULL;
-
-PFNGLBEGINSCENEEXTPROC __glewBeginSceneEXT = NULL;
-PFNGLENDSCENEEXTPROC __glewEndSceneEXT = NULL;
-
-PFNGLSECONDARYCOLOR3BEXTPROC __glewSecondaryColor3bEXT = NULL;
-PFNGLSECONDARYCOLOR3BVEXTPROC __glewSecondaryColor3bvEXT = NULL;
-PFNGLSECONDARYCOLOR3DEXTPROC __glewSecondaryColor3dEXT = NULL;
-PFNGLSECONDARYCOLOR3DVEXTPROC __glewSecondaryColor3dvEXT = NULL;
-PFNGLSECONDARYCOLOR3FEXTPROC __glewSecondaryColor3fEXT = NULL;
-PFNGLSECONDARYCOLOR3FVEXTPROC __glewSecondaryColor3fvEXT = NULL;
-PFNGLSECONDARYCOLOR3IEXTPROC __glewSecondaryColor3iEXT = NULL;
-PFNGLSECONDARYCOLOR3IVEXTPROC __glewSecondaryColor3ivEXT = NULL;
-PFNGLSECONDARYCOLOR3SEXTPROC __glewSecondaryColor3sEXT = NULL;
-PFNGLSECONDARYCOLOR3SVEXTPROC __glewSecondaryColor3svEXT = NULL;
-PFNGLSECONDARYCOLOR3UBEXTPROC __glewSecondaryColor3ubEXT = NULL;
-PFNGLSECONDARYCOLOR3UBVEXTPROC __glewSecondaryColor3ubvEXT = NULL;
-PFNGLSECONDARYCOLOR3UIEXTPROC __glewSecondaryColor3uiEXT = NULL;
-PFNGLSECONDARYCOLOR3UIVEXTPROC __glewSecondaryColor3uivEXT = NULL;
-PFNGLSECONDARYCOLOR3USEXTPROC __glewSecondaryColor3usEXT = NULL;
-PFNGLSECONDARYCOLOR3USVEXTPROC __glewSecondaryColor3usvEXT = NULL;
-PFNGLSECONDARYCOLORPOINTEREXTPROC __glewSecondaryColorPointerEXT = NULL;
-
-PFNGLACTIVEPROGRAMEXTPROC __glewActiveProgramEXT = NULL;
-PFNGLCREATESHADERPROGRAMEXTPROC __glewCreateShaderProgramEXT = NULL;
-PFNGLUSESHADERPROGRAMEXTPROC __glewUseShaderProgramEXT = NULL;
-
-PFNGLBINDIMAGETEXTUREEXTPROC __glewBindImageTextureEXT = NULL;
-PFNGLMEMORYBARRIEREXTPROC __glewMemoryBarrierEXT = NULL;
-
-PFNGLACTIVESTENCILFACEEXTPROC __glewActiveStencilFaceEXT = NULL;
-
-PFNGLTEXSUBIMAGE1DEXTPROC __glewTexSubImage1DEXT = NULL;
-PFNGLTEXSUBIMAGE2DEXTPROC __glewTexSubImage2DEXT = NULL;
-PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT = NULL;
-
-PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT = NULL;
-
-PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT = NULL;
-
-PFNGLTEXBUFFEREXTPROC __glewTexBufferEXT = NULL;
-
-PFNGLCLEARCOLORIIEXTPROC __glewClearColorIiEXT = NULL;
-PFNGLCLEARCOLORIUIEXTPROC __glewClearColorIuiEXT = NULL;
-PFNGLGETTEXPARAMETERIIVEXTPROC __glewGetTexParameterIivEXT = NULL;
-PFNGLGETTEXPARAMETERIUIVEXTPROC __glewGetTexParameterIuivEXT = NULL;
-PFNGLTEXPARAMETERIIVEXTPROC __glewTexParameterIivEXT = NULL;
-PFNGLTEXPARAMETERIUIVEXTPROC __glewTexParameterIuivEXT = NULL;
-
-PFNGLARETEXTURESRESIDENTEXTPROC __glewAreTexturesResidentEXT = NULL;
-PFNGLBINDTEXTUREEXTPROC __glewBindTextureEXT = NULL;
-PFNGLDELETETEXTURESEXTPROC __glewDeleteTexturesEXT = NULL;
-PFNGLGENTEXTURESEXTPROC __glewGenTexturesEXT = NULL;
-PFNGLISTEXTUREEXTPROC __glewIsTextureEXT = NULL;
-PFNGLPRIORITIZETEXTURESEXTPROC __glewPrioritizeTexturesEXT = NULL;
-
-PFNGLTEXTURENORMALEXTPROC __glewTextureNormalEXT = NULL;
-
-PFNGLGETQUERYOBJECTI64VEXTPROC __glewGetQueryObjecti64vEXT = NULL;
-PFNGLGETQUERYOBJECTUI64VEXTPROC __glewGetQueryObjectui64vEXT = NULL;
-
-PFNGLBEGINTRANSFORMFEEDBACKEXTPROC __glewBeginTransformFeedbackEXT = NULL;
-PFNGLBINDBUFFERBASEEXTPROC __glewBindBufferBaseEXT = NULL;
-PFNGLBINDBUFFEROFFSETEXTPROC __glewBindBufferOffsetEXT = NULL;
-PFNGLBINDBUFFERRANGEEXTPROC __glewBindBufferRangeEXT = NULL;
-PFNGLENDTRANSFORMFEEDBACKEXTPROC __glewEndTransformFeedbackEXT = NULL;
-PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC __glewGetTransformFeedbackVaryingEXT = NULL;
-PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC __glewTransformFeedbackVaryingsEXT = NULL;
-
-PFNGLARRAYELEMENTEXTPROC __glewArrayElementEXT = NULL;
-PFNGLCOLORPOINTEREXTPROC __glewColorPointerEXT = NULL;
-PFNGLDRAWARRAYSEXTPROC __glewDrawArraysEXT = NULL;
-PFNGLEDGEFLAGPOINTEREXTPROC __glewEdgeFlagPointerEXT = NULL;
-PFNGLINDEXPOINTEREXTPROC __glewIndexPointerEXT = NULL;
-PFNGLNORMALPOINTEREXTPROC __glewNormalPointerEXT = NULL;
-PFNGLTEXCOORDPOINTEREXTPROC __glewTexCoordPointerEXT = NULL;
-PFNGLVERTEXPOINTEREXTPROC __glewVertexPointerEXT = NULL;
-
-PFNGLGETVERTEXATTRIBLDVEXTPROC __glewGetVertexAttribLdvEXT = NULL;
-PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC __glewVertexArrayVertexAttribLOffsetEXT = NULL;
-PFNGLVERTEXATTRIBL1DEXTPROC __glewVertexAttribL1dEXT = NULL;
-PFNGLVERTEXATTRIBL1DVEXTPROC __glewVertexAttribL1dvEXT = NULL;
-PFNGLVERTEXATTRIBL2DEXTPROC __glewVertexAttribL2dEXT = NULL;
-PFNGLVERTEXATTRIBL2DVEXTPROC __glewVertexAttribL2dvEXT = NULL;
-PFNGLVERTEXATTRIBL3DEXTPROC __glewVertexAttribL3dEXT = NULL;
-PFNGLVERTEXATTRIBL3DVEXTPROC __glewVertexAttribL3dvEXT = NULL;
-PFNGLVERTEXATTRIBL4DEXTPROC __glewVertexAttribL4dEXT = NULL;
-PFNGLVERTEXATTRIBL4DVEXTPROC __glewVertexAttribL4dvEXT = NULL;
-PFNGLVERTEXATTRIBLPOINTEREXTPROC __glewVertexAttribLPointerEXT = NULL;
-
-PFNGLBEGINVERTEXSHADEREXTPROC __glewBeginVertexShaderEXT = NULL;
-PFNGLBINDLIGHTPARAMETEREXTPROC __glewBindLightParameterEXT = NULL;
-PFNGLBINDMATERIALPARAMETEREXTPROC __glewBindMaterialParameterEXT = NULL;
-PFNGLBINDPARAMETEREXTPROC __glewBindParameterEXT = NULL;
-PFNGLBINDTEXGENPARAMETEREXTPROC __glewBindTexGenParameterEXT = NULL;
-PFNGLBINDTEXTUREUNITPARAMETEREXTPROC __glewBindTextureUnitParameterEXT = NULL;
-PFNGLBINDVERTEXSHADEREXTPROC __glewBindVertexShaderEXT = NULL;
-PFNGLDELETEVERTEXSHADEREXTPROC __glewDeleteVertexShaderEXT = NULL;
-PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC __glewDisableVariantClientStateEXT = NULL;
-PFNGLENABLEVARIANTCLIENTSTATEEXTPROC __glewEnableVariantClientStateEXT = NULL;
-PFNGLENDVERTEXSHADEREXTPROC __glewEndVertexShaderEXT = NULL;
-PFNGLEXTRACTCOMPONENTEXTPROC __glewExtractComponentEXT = NULL;
-PFNGLGENSYMBOLSEXTPROC __glewGenSymbolsEXT = NULL;
-PFNGLGENVERTEXSHADERSEXTPROC __glewGenVertexShadersEXT = NULL;
-PFNGLGETINVARIANTBOOLEANVEXTPROC __glewGetInvariantBooleanvEXT = NULL;
-PFNGLGETINVARIANTFLOATVEXTPROC __glewGetInvariantFloatvEXT = NULL;
-PFNGLGETINVARIANTINTEGERVEXTPROC __glewGetInvariantIntegervEXT = NULL;
-PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC __glewGetLocalConstantBooleanvEXT = NULL;
-PFNGLGETLOCALCONSTANTFLOATVEXTPROC __glewGetLocalConstantFloatvEXT = NULL;
-PFNGLGETLOCALCONSTANTINTEGERVEXTPROC __glewGetLocalConstantIntegervEXT = NULL;
-PFNGLGETVARIANTBOOLEANVEXTPROC __glewGetVariantBooleanvEXT = NULL;
-PFNGLGETVARIANTFLOATVEXTPROC __glewGetVariantFloatvEXT = NULL;
-PFNGLGETVARIANTINTEGERVEXTPROC __glewGetVariantIntegervEXT = NULL;
-PFNGLGETVARIANTPOINTERVEXTPROC __glewGetVariantPointervEXT = NULL;
-PFNGLINSERTCOMPONENTEXTPROC __glewInsertComponentEXT = NULL;
-PFNGLISVARIANTENABLEDEXTPROC __glewIsVariantEnabledEXT = NULL;
-PFNGLSETINVARIANTEXTPROC __glewSetInvariantEXT = NULL;
-PFNGLSETLOCALCONSTANTEXTPROC __glewSetLocalConstantEXT = NULL;
-PFNGLSHADEROP1EXTPROC __glewShaderOp1EXT = NULL;
-PFNGLSHADEROP2EXTPROC __glewShaderOp2EXT = NULL;
-PFNGLSHADEROP3EXTPROC __glewShaderOp3EXT = NULL;
-PFNGLSWIZZLEEXTPROC __glewSwizzleEXT = NULL;
-PFNGLVARIANTPOINTEREXTPROC __glewVariantPointerEXT = NULL;
-PFNGLVARIANTBVEXTPROC __glewVariantbvEXT = NULL;
-PFNGLVARIANTDVEXTPROC __glewVariantdvEXT = NULL;
-PFNGLVARIANTFVEXTPROC __glewVariantfvEXT = NULL;
-PFNGLVARIANTIVEXTPROC __glewVariantivEXT = NULL;
-PFNGLVARIANTSVEXTPROC __glewVariantsvEXT = NULL;
-PFNGLVARIANTUBVEXTPROC __glewVariantubvEXT = NULL;
-PFNGLVARIANTUIVEXTPROC __glewVariantuivEXT = NULL;
-PFNGLVARIANTUSVEXTPROC __glewVariantusvEXT = NULL;
-PFNGLWRITEMASKEXTPROC __glewWriteMaskEXT = NULL;
-
-PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT = NULL;
-PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT = NULL;
-PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT = NULL;
-
-PFNGLIMPORTSYNCEXTPROC __glewImportSyncEXT = NULL;
-
-PFNGLFRAMETERMINATORGREMEDYPROC __glewFrameTerminatorGREMEDY = NULL;
-
-PFNGLSTRINGMARKERGREMEDYPROC __glewStringMarkerGREMEDY = NULL;
-
-PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC __glewGetImageTransformParameterfvHP = NULL;
-PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC __glewGetImageTransformParameterivHP = NULL;
-PFNGLIMAGETRANSFORMPARAMETERFHPPROC __glewImageTransformParameterfHP = NULL;
-PFNGLIMAGETRANSFORMPARAMETERFVHPPROC __glewImageTransformParameterfvHP = NULL;
-PFNGLIMAGETRANSFORMPARAMETERIHPPROC __glewImageTransformParameteriHP = NULL;
-PFNGLIMAGETRANSFORMPARAMETERIVHPPROC __glewImageTransformParameterivHP = NULL;
-
-PFNGLMULTIMODEDRAWARRAYSIBMPROC __glewMultiModeDrawArraysIBM = NULL;
-PFNGLMULTIMODEDRAWELEMENTSIBMPROC __glewMultiModeDrawElementsIBM = NULL;
-
-PFNGLCOLORPOINTERLISTIBMPROC __glewColorPointerListIBM = NULL;
-PFNGLEDGEFLAGPOINTERLISTIBMPROC __glewEdgeFlagPointerListIBM = NULL;
-PFNGLFOGCOORDPOINTERLISTIBMPROC __glewFogCoordPointerListIBM = NULL;
-PFNGLINDEXPOINTERLISTIBMPROC __glewIndexPointerListIBM = NULL;
-PFNGLNORMALPOINTERLISTIBMPROC __glewNormalPointerListIBM = NULL;
-PFNGLSECONDARYCOLORPOINTERLISTIBMPROC __glewSecondaryColorPointerListIBM = NULL;
-PFNGLTEXCOORDPOINTERLISTIBMPROC __glewTexCoordPointerListIBM = NULL;
-PFNGLVERTEXPOINTERLISTIBMPROC __glewVertexPointerListIBM = NULL;
-
-PFNGLMAPTEXTURE2DINTELPROC __glewMapTexture2DINTEL = NULL;
-PFNGLSYNCTEXTUREINTELPROC __glewSyncTextureINTEL = NULL;
-PFNGLUNMAPTEXTURE2DINTELPROC __glewUnmapTexture2DINTEL = NULL;
-
-PFNGLCOLORPOINTERVINTELPROC __glewColorPointervINTEL = NULL;
-PFNGLNORMALPOINTERVINTELPROC __glewNormalPointervINTEL = NULL;
-PFNGLTEXCOORDPOINTERVINTELPROC __glewTexCoordPointervINTEL = NULL;
-PFNGLVERTEXPOINTERVINTELPROC __glewVertexPointervINTEL = NULL;
-
-PFNGLBEGINPERFQUERYINTELPROC __glewBeginPerfQueryINTEL = NULL;
-PFNGLCREATEPERFQUERYINTELPROC __glewCreatePerfQueryINTEL = NULL;
-PFNGLDELETEPERFQUERYINTELPROC __glewDeletePerfQueryINTEL = NULL;
-PFNGLENDPERFQUERYINTELPROC __glewEndPerfQueryINTEL = NULL;
-PFNGLGETFIRSTPERFQUERYIDINTELPROC __glewGetFirstPerfQueryIdINTEL = NULL;
-PFNGLGETNEXTPERFQUERYIDINTELPROC __glewGetNextPerfQueryIdINTEL = NULL;
-PFNGLGETPERFCOUNTERINFOINTELPROC __glewGetPerfCounterInfoINTEL = NULL;
-PFNGLGETPERFQUERYDATAINTELPROC __glewGetPerfQueryDataINTEL = NULL;
-PFNGLGETPERFQUERYIDBYNAMEINTELPROC __glewGetPerfQueryIdByNameINTEL = NULL;
-PFNGLGETPERFQUERYINFOINTELPROC __glewGetPerfQueryInfoINTEL = NULL;
-
-PFNGLTEXSCISSORFUNCINTELPROC __glewTexScissorFuncINTEL = NULL;
-PFNGLTEXSCISSORINTELPROC __glewTexScissorINTEL = NULL;
-
-PFNGLBLENDBARRIERKHRPROC __glewBlendBarrierKHR = NULL;
-
-PFNGLDEBUGMESSAGECALLBACKPROC __glewDebugMessageCallback = NULL;
-PFNGLDEBUGMESSAGECONTROLPROC __glewDebugMessageControl = NULL;
-PFNGLDEBUGMESSAGEINSERTPROC __glewDebugMessageInsert = NULL;
-PFNGLGETDEBUGMESSAGELOGPROC __glewGetDebugMessageLog = NULL;
-PFNGLGETOBJECTLABELPROC __glewGetObjectLabel = NULL;
-PFNGLGETOBJECTPTRLABELPROC __glewGetObjectPtrLabel = NULL;
-PFNGLOBJECTLABELPROC __glewObjectLabel = NULL;
-PFNGLOBJECTPTRLABELPROC __glewObjectPtrLabel = NULL;
-PFNGLPOPDEBUGGROUPPROC __glewPopDebugGroup = NULL;
-PFNGLPUSHDEBUGGROUPPROC __glewPushDebugGroup = NULL;
-
-PFNGLGETNUNIFORMFVPROC __glewGetnUniformfv = NULL;
-PFNGLGETNUNIFORMIVPROC __glewGetnUniformiv = NULL;
-PFNGLGETNUNIFORMUIVPROC __glewGetnUniformuiv = NULL;
-PFNGLREADNPIXELSPROC __glewReadnPixels = NULL;
-
-PFNGLBUFFERREGIONENABLEDPROC __glewBufferRegionEnabled = NULL;
-PFNGLDELETEBUFFERREGIONPROC __glewDeleteBufferRegion = NULL;
-PFNGLDRAWBUFFERREGIONPROC __glewDrawBufferRegion = NULL;
-PFNGLNEWBUFFERREGIONPROC __glewNewBufferRegion = NULL;
-PFNGLREADBUFFERREGIONPROC __glewReadBufferRegion = NULL;
-
-PFNGLRESIZEBUFFERSMESAPROC __glewResizeBuffersMESA = NULL;
-
-PFNGLWINDOWPOS2DMESAPROC __glewWindowPos2dMESA = NULL;
-PFNGLWINDOWPOS2DVMESAPROC __glewWindowPos2dvMESA = NULL;
-PFNGLWINDOWPOS2FMESAPROC __glewWindowPos2fMESA = NULL;
-PFNGLWINDOWPOS2FVMESAPROC __glewWindowPos2fvMESA = NULL;
-PFNGLWINDOWPOS2IMESAPROC __glewWindowPos2iMESA = NULL;
-PFNGLWINDOWPOS2IVMESAPROC __glewWindowPos2ivMESA = NULL;
-PFNGLWINDOWPOS2SMESAPROC __glewWindowPos2sMESA = NULL;
-PFNGLWINDOWPOS2SVMESAPROC __glewWindowPos2svMESA = NULL;
-PFNGLWINDOWPOS3DMESAPROC __glewWindowPos3dMESA = NULL;
-PFNGLWINDOWPOS3DVMESAPROC __glewWindowPos3dvMESA = NULL;
-PFNGLWINDOWPOS3FMESAPROC __glewWindowPos3fMESA = NULL;
-PFNGLWINDOWPOS3FVMESAPROC __glewWindowPos3fvMESA = NULL;
-PFNGLWINDOWPOS3IMESAPROC __glewWindowPos3iMESA = NULL;
-PFNGLWINDOWPOS3IVMESAPROC __glewWindowPos3ivMESA = NULL;
-PFNGLWINDOWPOS3SMESAPROC __glewWindowPos3sMESA = NULL;
-PFNGLWINDOWPOS3SVMESAPROC __glewWindowPos3svMESA = NULL;
-PFNGLWINDOWPOS4DMESAPROC __glewWindowPos4dMESA = NULL;
-PFNGLWINDOWPOS4DVMESAPROC __glewWindowPos4dvMESA = NULL;
-PFNGLWINDOWPOS4FMESAPROC __glewWindowPos4fMESA = NULL;
-PFNGLWINDOWPOS4FVMESAPROC __glewWindowPos4fvMESA = NULL;
-PFNGLWINDOWPOS4IMESAPROC __glewWindowPos4iMESA = NULL;
-PFNGLWINDOWPOS4IVMESAPROC __glewWindowPos4ivMESA = NULL;
-PFNGLWINDOWPOS4SMESAPROC __glewWindowPos4sMESA = NULL;
-PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA = NULL;
-
-PFNGLBEGINCONDITIONALRENDERNVXPROC __glewBeginConditionalRenderNVX = NULL;
-PFNGLENDCONDITIONALRENDERNVXPROC __glewEndConditionalRenderNVX = NULL;
-
-PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC __glewMultiDrawArraysIndirectBindlessNV = NULL;
-PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC __glewMultiDrawElementsIndirectBindlessNV = NULL;
-
-PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC __glewMultiDrawArraysIndirectBindlessCountNV = NULL;
-PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC __glewMultiDrawElementsIndirectBindlessCountNV = NULL;
-
-PFNGLGETIMAGEHANDLENVPROC __glewGetImageHandleNV = NULL;
-PFNGLGETTEXTUREHANDLENVPROC __glewGetTextureHandleNV = NULL;
-PFNGLGETTEXTURESAMPLERHANDLENVPROC __glewGetTextureSamplerHandleNV = NULL;
-PFNGLISIMAGEHANDLERESIDENTNVPROC __glewIsImageHandleResidentNV = NULL;
-PFNGLISTEXTUREHANDLERESIDENTNVPROC __glewIsTextureHandleResidentNV = NULL;
-PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC __glewMakeImageHandleNonResidentNV = NULL;
-PFNGLMAKEIMAGEHANDLERESIDENTNVPROC __glewMakeImageHandleResidentNV = NULL;
-PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC __glewMakeTextureHandleNonResidentNV = NULL;
-PFNGLMAKETEXTUREHANDLERESIDENTNVPROC __glewMakeTextureHandleResidentNV = NULL;
-PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC __glewProgramUniformHandleui64NV = NULL;
-PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC __glewProgramUniformHandleui64vNV = NULL;
-PFNGLUNIFORMHANDLEUI64NVPROC __glewUniformHandleui64NV = NULL;
-PFNGLUNIFORMHANDLEUI64VNVPROC __glewUniformHandleui64vNV = NULL;
-
-PFNGLBLENDBARRIERNVPROC __glewBlendBarrierNV = NULL;
-PFNGLBLENDPARAMETERINVPROC __glewBlendParameteriNV = NULL;
-
-PFNGLBEGINCONDITIONALRENDERNVPROC __glewBeginConditionalRenderNV = NULL;
-PFNGLENDCONDITIONALRENDERNVPROC __glewEndConditionalRenderNV = NULL;
-
-PFNGLSUBPIXELPRECISIONBIASNVPROC __glewSubpixelPrecisionBiasNV = NULL;
-
-PFNGLCOPYIMAGESUBDATANVPROC __glewCopyImageSubDataNV = NULL;
-
-PFNGLCLEARDEPTHDNVPROC __glewClearDepthdNV = NULL;
-PFNGLDEPTHBOUNDSDNVPROC __glewDepthBoundsdNV = NULL;
-PFNGLDEPTHRANGEDNVPROC __glewDepthRangedNV = NULL;
-
-PFNGLDRAWTEXTURENVPROC __glewDrawTextureNV = NULL;
-
-PFNGLEVALMAPSNVPROC __glewEvalMapsNV = NULL;
-PFNGLGETMAPATTRIBPARAMETERFVNVPROC __glewGetMapAttribParameterfvNV = NULL;
-PFNGLGETMAPATTRIBPARAMETERIVNVPROC __glewGetMapAttribParameterivNV = NULL;
-PFNGLGETMAPCONTROLPOINTSNVPROC __glewGetMapControlPointsNV = NULL;
-PFNGLGETMAPPARAMETERFVNVPROC __glewGetMapParameterfvNV = NULL;
-PFNGLGETMAPPARAMETERIVNVPROC __glewGetMapParameterivNV = NULL;
-PFNGLMAPCONTROLPOINTSNVPROC __glewMapControlPointsNV = NULL;
-PFNGLMAPPARAMETERFVNVPROC __glewMapParameterfvNV = NULL;
-PFNGLMAPPARAMETERIVNVPROC __glewMapParameterivNV = NULL;
-
-PFNGLGETMULTISAMPLEFVNVPROC __glewGetMultisamplefvNV = NULL;
-PFNGLSAMPLEMASKINDEXEDNVPROC __glewSampleMaskIndexedNV = NULL;
-PFNGLTEXRENDERBUFFERNVPROC __glewTexRenderbufferNV = NULL;
-
-PFNGLDELETEFENCESNVPROC __glewDeleteFencesNV = NULL;
-PFNGLFINISHFENCENVPROC __glewFinishFenceNV = NULL;
-PFNGLGENFENCESNVPROC __glewGenFencesNV = NULL;
-PFNGLGETFENCEIVNVPROC __glewGetFenceivNV = NULL;
-PFNGLISFENCENVPROC __glewIsFenceNV = NULL;
-PFNGLSETFENCENVPROC __glewSetFenceNV = NULL;
-PFNGLTESTFENCENVPROC __glewTestFenceNV = NULL;
-
-PFNGLFRAGMENTCOVERAGECOLORNVPROC __glewFragmentCoverageColorNV = NULL;
-
-PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC __glewGetProgramNamedParameterdvNV = NULL;
-PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC __glewGetProgramNamedParameterfvNV = NULL;
-PFNGLPROGRAMNAMEDPARAMETER4DNVPROC __glewProgramNamedParameter4dNV = NULL;
-PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC __glewProgramNamedParameter4dvNV = NULL;
-PFNGLPROGRAMNAMEDPARAMETER4FNVPROC __glewProgramNamedParameter4fNV = NULL;
-PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC __glewProgramNamedParameter4fvNV = NULL;
-
-PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC __glewRenderbufferStorageMultisampleCoverageNV = NULL;
-
-PFNGLPROGRAMVERTEXLIMITNVPROC __glewProgramVertexLimitNV = NULL;
-
-PFNGLPROGRAMENVPARAMETERI4INVPROC __glewProgramEnvParameterI4iNV = NULL;
-PFNGLPROGRAMENVPARAMETERI4IVNVPROC __glewProgramEnvParameterI4ivNV = NULL;
-PFNGLPROGRAMENVPARAMETERI4UINVPROC __glewProgramEnvParameterI4uiNV = NULL;
-PFNGLPROGRAMENVPARAMETERI4UIVNVPROC __glewProgramEnvParameterI4uivNV = NULL;
-PFNGLPROGRAMENVPARAMETERSI4IVNVPROC __glewProgramEnvParametersI4ivNV = NULL;
-PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC __glewProgramEnvParametersI4uivNV = NULL;
-PFNGLPROGRAMLOCALPARAMETERI4INVPROC __glewProgramLocalParameterI4iNV = NULL;
-PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC __glewProgramLocalParameterI4ivNV = NULL;
-PFNGLPROGRAMLOCALPARAMETERI4UINVPROC __glewProgramLocalParameterI4uiNV = NULL;
-PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC __glewProgramLocalParameterI4uivNV = NULL;
-PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC __glewProgramLocalParametersI4ivNV = NULL;
-PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC __glewProgramLocalParametersI4uivNV = NULL;
-
-PFNGLGETUNIFORMI64VNVPROC __glewGetUniformi64vNV = NULL;
-PFNGLGETUNIFORMUI64VNVPROC __glewGetUniformui64vNV = NULL;
-PFNGLPROGRAMUNIFORM1I64NVPROC __glewProgramUniform1i64NV = NULL;
-PFNGLPROGRAMUNIFORM1I64VNVPROC __glewProgramUniform1i64vNV = NULL;
-PFNGLPROGRAMUNIFORM1UI64NVPROC __glewProgramUniform1ui64NV = NULL;
-PFNGLPROGRAMUNIFORM1UI64VNVPROC __glewProgramUniform1ui64vNV = NULL;
-PFNGLPROGRAMUNIFORM2I64NVPROC __glewProgramUniform2i64NV = NULL;
-PFNGLPROGRAMUNIFORM2I64VNVPROC __glewProgramUniform2i64vNV = NULL;
-PFNGLPROGRAMUNIFORM2UI64NVPROC __glewProgramUniform2ui64NV = NULL;
-PFNGLPROGRAMUNIFORM2UI64VNVPROC __glewProgramUniform2ui64vNV = NULL;
-PFNGLPROGRAMUNIFORM3I64NVPROC __glewProgramUniform3i64NV = NULL;
-PFNGLPROGRAMUNIFORM3I64VNVPROC __glewProgramUniform3i64vNV = NULL;
-PFNGLPROGRAMUNIFORM3UI64NVPROC __glewProgramUniform3ui64NV = NULL;
-PFNGLPROGRAMUNIFORM3UI64VNVPROC __glewProgramUniform3ui64vNV = NULL;
-PFNGLPROGRAMUNIFORM4I64NVPROC __glewProgramUniform4i64NV = NULL;
-PFNGLPROGRAMUNIFORM4I64VNVPROC __glewProgramUniform4i64vNV = NULL;
-PFNGLPROGRAMUNIFORM4UI64NVPROC __glewProgramUniform4ui64NV = NULL;
-PFNGLPROGRAMUNIFORM4UI64VNVPROC __glewProgramUniform4ui64vNV = NULL;
-PFNGLUNIFORM1I64NVPROC __glewUniform1i64NV = NULL;
-PFNGLUNIFORM1I64VNVPROC __glewUniform1i64vNV = NULL;
-PFNGLUNIFORM1UI64NVPROC __glewUniform1ui64NV = NULL;
-PFNGLUNIFORM1UI64VNVPROC __glewUniform1ui64vNV = NULL;
-PFNGLUNIFORM2I64NVPROC __glewUniform2i64NV = NULL;
-PFNGLUNIFORM2I64VNVPROC __glewUniform2i64vNV = NULL;
-PFNGLUNIFORM2UI64NVPROC __glewUniform2ui64NV = NULL;
-PFNGLUNIFORM2UI64VNVPROC __glewUniform2ui64vNV = NULL;
-PFNGLUNIFORM3I64NVPROC __glewUniform3i64NV = NULL;
-PFNGLUNIFORM3I64VNVPROC __glewUniform3i64vNV = NULL;
-PFNGLUNIFORM3UI64NVPROC __glewUniform3ui64NV = NULL;
-PFNGLUNIFORM3UI64VNVPROC __glewUniform3ui64vNV = NULL;
-PFNGLUNIFORM4I64NVPROC __glewUniform4i64NV = NULL;
-PFNGLUNIFORM4I64VNVPROC __glewUniform4i64vNV = NULL;
-PFNGLUNIFORM4UI64NVPROC __glewUniform4ui64NV = NULL;
-PFNGLUNIFORM4UI64VNVPROC __glewUniform4ui64vNV = NULL;
-
-PFNGLCOLOR3HNVPROC __glewColor3hNV = NULL;
-PFNGLCOLOR3HVNVPROC __glewColor3hvNV = NULL;
-PFNGLCOLOR4HNVPROC __glewColor4hNV = NULL;
-PFNGLCOLOR4HVNVPROC __glewColor4hvNV = NULL;
-PFNGLFOGCOORDHNVPROC __glewFogCoordhNV = NULL;
-PFNGLFOGCOORDHVNVPROC __glewFogCoordhvNV = NULL;
-PFNGLMULTITEXCOORD1HNVPROC __glewMultiTexCoord1hNV = NULL;
-PFNGLMULTITEXCOORD1HVNVPROC __glewMultiTexCoord1hvNV = NULL;
-PFNGLMULTITEXCOORD2HNVPROC __glewMultiTexCoord2hNV = NULL;
-PFNGLMULTITEXCOORD2HVNVPROC __glewMultiTexCoord2hvNV = NULL;
-PFNGLMULTITEXCOORD3HNVPROC __glewMultiTexCoord3hNV = NULL;
-PFNGLMULTITEXCOORD3HVNVPROC __glewMultiTexCoord3hvNV = NULL;
-PFNGLMULTITEXCOORD4HNVPROC __glewMultiTexCoord4hNV = NULL;
-PFNGLMULTITEXCOORD4HVNVPROC __glewMultiTexCoord4hvNV = NULL;
-PFNGLNORMAL3HNVPROC __glewNormal3hNV = NULL;
-PFNGLNORMAL3HVNVPROC __glewNormal3hvNV = NULL;
-PFNGLSECONDARYCOLOR3HNVPROC __glewSecondaryColor3hNV = NULL;
-PFNGLSECONDARYCOLOR3HVNVPROC __glewSecondaryColor3hvNV = NULL;
-PFNGLTEXCOORD1HNVPROC __glewTexCoord1hNV = NULL;
-PFNGLTEXCOORD1HVNVPROC __glewTexCoord1hvNV = NULL;
-PFNGLTEXCOORD2HNVPROC __glewTexCoord2hNV = NULL;
-PFNGLTEXCOORD2HVNVPROC __glewTexCoord2hvNV = NULL;
-PFNGLTEXCOORD3HNVPROC __glewTexCoord3hNV = NULL;
-PFNGLTEXCOORD3HVNVPROC __glewTexCoord3hvNV = NULL;
-PFNGLTEXCOORD4HNVPROC __glewTexCoord4hNV = NULL;
-PFNGLTEXCOORD4HVNVPROC __glewTexCoord4hvNV = NULL;
-PFNGLVERTEX2HNVPROC __glewVertex2hNV = NULL;
-PFNGLVERTEX2HVNVPROC __glewVertex2hvNV = NULL;
-PFNGLVERTEX3HNVPROC __glewVertex3hNV = NULL;
-PFNGLVERTEX3HVNVPROC __glewVertex3hvNV = NULL;
-PFNGLVERTEX4HNVPROC __glewVertex4hNV = NULL;
-PFNGLVERTEX4HVNVPROC __glewVertex4hvNV = NULL;
-PFNGLVERTEXATTRIB1HNVPROC __glewVertexAttrib1hNV = NULL;
-PFNGLVERTEXATTRIB1HVNVPROC __glewVertexAttrib1hvNV = NULL;
-PFNGLVERTEXATTRIB2HNVPROC __glewVertexAttrib2hNV = NULL;
-PFNGLVERTEXATTRIB2HVNVPROC __glewVertexAttrib2hvNV = NULL;
-PFNGLVERTEXATTRIB3HNVPROC __glewVertexAttrib3hNV = NULL;
-PFNGLVERTEXATTRIB3HVNVPROC __glewVertexAttrib3hvNV = NULL;
-PFNGLVERTEXATTRIB4HNVPROC __glewVertexAttrib4hNV = NULL;
-PFNGLVERTEXATTRIB4HVNVPROC __glewVertexAttrib4hvNV = NULL;
-PFNGLVERTEXATTRIBS1HVNVPROC __glewVertexAttribs1hvNV = NULL;
-PFNGLVERTEXATTRIBS2HVNVPROC __glewVertexAttribs2hvNV = NULL;
-PFNGLVERTEXATTRIBS3HVNVPROC __glewVertexAttribs3hvNV = NULL;
-PFNGLVERTEXATTRIBS4HVNVPROC __glewVertexAttribs4hvNV = NULL;
-PFNGLVERTEXWEIGHTHNVPROC __glewVertexWeighthNV = NULL;
-PFNGLVERTEXWEIGHTHVNVPROC __glewVertexWeighthvNV = NULL;
-
-PFNGLGETINTERNALFORMATSAMPLEIVNVPROC __glewGetInternalformatSampleivNV = NULL;
-
-PFNGLBEGINOCCLUSIONQUERYNVPROC __glewBeginOcclusionQueryNV = NULL;
-PFNGLDELETEOCCLUSIONQUERIESNVPROC __glewDeleteOcclusionQueriesNV = NULL;
-PFNGLENDOCCLUSIONQUERYNVPROC __glewEndOcclusionQueryNV = NULL;
-PFNGLGENOCCLUSIONQUERIESNVPROC __glewGenOcclusionQueriesNV = NULL;
-PFNGLGETOCCLUSIONQUERYIVNVPROC __glewGetOcclusionQueryivNV = NULL;
-PFNGLGETOCCLUSIONQUERYUIVNVPROC __glewGetOcclusionQueryuivNV = NULL;
-PFNGLISOCCLUSIONQUERYNVPROC __glewIsOcclusionQueryNV = NULL;
-
-PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC __glewProgramBufferParametersIivNV = NULL;
-PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC __glewProgramBufferParametersIuivNV = NULL;
-PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC __glewProgramBufferParametersfvNV = NULL;
-
-PFNGLCOPYPATHNVPROC __glewCopyPathNV = NULL;
-PFNGLCOVERFILLPATHINSTANCEDNVPROC __glewCoverFillPathInstancedNV = NULL;
-PFNGLCOVERFILLPATHNVPROC __glewCoverFillPathNV = NULL;
-PFNGLCOVERSTROKEPATHINSTANCEDNVPROC __glewCoverStrokePathInstancedNV = NULL;
-PFNGLCOVERSTROKEPATHNVPROC __glewCoverStrokePathNV = NULL;
-PFNGLDELETEPATHSNVPROC __glewDeletePathsNV = NULL;
-PFNGLGENPATHSNVPROC __glewGenPathsNV = NULL;
-PFNGLGETPATHCOLORGENFVNVPROC __glewGetPathColorGenfvNV = NULL;
-PFNGLGETPATHCOLORGENIVNVPROC __glewGetPathColorGenivNV = NULL;
-PFNGLGETPATHCOMMANDSNVPROC __glewGetPathCommandsNV = NULL;
-PFNGLGETPATHCOORDSNVPROC __glewGetPathCoordsNV = NULL;
-PFNGLGETPATHDASHARRAYNVPROC __glewGetPathDashArrayNV = NULL;
-PFNGLGETPATHLENGTHNVPROC __glewGetPathLengthNV = NULL;
-PFNGLGETPATHMETRICRANGENVPROC __glewGetPathMetricRangeNV = NULL;
-PFNGLGETPATHMETRICSNVPROC __glewGetPathMetricsNV = NULL;
-PFNGLGETPATHPARAMETERFVNVPROC __glewGetPathParameterfvNV = NULL;
-PFNGLGETPATHPARAMETERIVNVPROC __glewGetPathParameterivNV = NULL;
-PFNGLGETPATHSPACINGNVPROC __glewGetPathSpacingNV = NULL;
-PFNGLGETPATHTEXGENFVNVPROC __glewGetPathTexGenfvNV = NULL;
-PFNGLGETPATHTEXGENIVNVPROC __glewGetPathTexGenivNV = NULL;
-PFNGLGETPROGRAMRESOURCEFVNVPROC __glewGetProgramResourcefvNV = NULL;
-PFNGLINTERPOLATEPATHSNVPROC __glewInterpolatePathsNV = NULL;
-PFNGLISPATHNVPROC __glewIsPathNV = NULL;
-PFNGLISPOINTINFILLPATHNVPROC __glewIsPointInFillPathNV = NULL;
-PFNGLISPOINTINSTROKEPATHNVPROC __glewIsPointInStrokePathNV = NULL;
-PFNGLMATRIXLOAD3X2FNVPROC __glewMatrixLoad3x2fNV = NULL;
-PFNGLMATRIXLOAD3X3FNVPROC __glewMatrixLoad3x3fNV = NULL;
-PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC __glewMatrixLoadTranspose3x3fNV = NULL;
-PFNGLMATRIXMULT3X2FNVPROC __glewMatrixMult3x2fNV = NULL;
-PFNGLMATRIXMULT3X3FNVPROC __glewMatrixMult3x3fNV = NULL;
-PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC __glewMatrixMultTranspose3x3fNV = NULL;
-PFNGLPATHCOLORGENNVPROC __glewPathColorGenNV = NULL;
-PFNGLPATHCOMMANDSNVPROC __glewPathCommandsNV = NULL;
-PFNGLPATHCOORDSNVPROC __glewPathCoordsNV = NULL;
-PFNGLPATHCOVERDEPTHFUNCNVPROC __glewPathCoverDepthFuncNV = NULL;
-PFNGLPATHDASHARRAYNVPROC __glewPathDashArrayNV = NULL;
-PFNGLPATHFOGGENNVPROC __glewPathFogGenNV = NULL;
-PFNGLPATHGLYPHINDEXARRAYNVPROC __glewPathGlyphIndexArrayNV = NULL;
-PFNGLPATHGLYPHINDEXRANGENVPROC __glewPathGlyphIndexRangeNV = NULL;
-PFNGLPATHGLYPHRANGENVPROC __glewPathGlyphRangeNV = NULL;
-PFNGLPATHGLYPHSNVPROC __glewPathGlyphsNV = NULL;
-PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC __glewPathMemoryGlyphIndexArrayNV = NULL;
-PFNGLPATHPARAMETERFNVPROC __glewPathParameterfNV = NULL;
-PFNGLPATHPARAMETERFVNVPROC __glewPathParameterfvNV = NULL;
-PFNGLPATHPARAMETERINVPROC __glewPathParameteriNV = NULL;
-PFNGLPATHPARAMETERIVNVPROC __glewPathParameterivNV = NULL;
-PFNGLPATHSTENCILDEPTHOFFSETNVPROC __glewPathStencilDepthOffsetNV = NULL;
-PFNGLPATHSTENCILFUNCNVPROC __glewPathStencilFuncNV = NULL;
-PFNGLPATHSTRINGNVPROC __glewPathStringNV = NULL;
-PFNGLPATHSUBCOMMANDSNVPROC __glewPathSubCommandsNV = NULL;
-PFNGLPATHSUBCOORDSNVPROC __glewPathSubCoordsNV = NULL;
-PFNGLPATHTEXGENNVPROC __glewPathTexGenNV = NULL;
-PFNGLPOINTALONGPATHNVPROC __glewPointAlongPathNV = NULL;
-PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC __glewProgramPathFragmentInputGenNV = NULL;
-PFNGLSTENCILFILLPATHINSTANCEDNVPROC __glewStencilFillPathInstancedNV = NULL;
-PFNGLSTENCILFILLPATHNVPROC __glewStencilFillPathNV = NULL;
-PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC __glewStencilStrokePathInstancedNV = NULL;
-PFNGLSTENCILSTROKEPATHNVPROC __glewStencilStrokePathNV = NULL;
-PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC __glewStencilThenCoverFillPathInstancedNV = NULL;
-PFNGLSTENCILTHENCOVERFILLPATHNVPROC __glewStencilThenCoverFillPathNV = NULL;
-PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC __glewStencilThenCoverStrokePathInstancedNV = NULL;
-PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC __glewStencilThenCoverStrokePathNV = NULL;
-PFNGLTRANSFORMPATHNVPROC __glewTransformPathNV = NULL;
-PFNGLWEIGHTPATHSNVPROC __glewWeightPathsNV = NULL;
-
-PFNGLFLUSHPIXELDATARANGENVPROC __glewFlushPixelDataRangeNV = NULL;
-PFNGLPIXELDATARANGENVPROC __glewPixelDataRangeNV = NULL;
-
-PFNGLPOINTPARAMETERINVPROC __glewPointParameteriNV = NULL;
-PFNGLPOINTPARAMETERIVNVPROC __glewPointParameterivNV = NULL;
-
-PFNGLGETVIDEOI64VNVPROC __glewGetVideoi64vNV = NULL;
-PFNGLGETVIDEOIVNVPROC __glewGetVideoivNV = NULL;
-PFNGLGETVIDEOUI64VNVPROC __glewGetVideoui64vNV = NULL;
-PFNGLGETVIDEOUIVNVPROC __glewGetVideouivNV = NULL;
-PFNGLPRESENTFRAMEDUALFILLNVPROC __glewPresentFrameDualFillNV = NULL;
-PFNGLPRESENTFRAMEKEYEDNVPROC __glewPresentFrameKeyedNV = NULL;
-
-PFNGLPRIMITIVERESTARTINDEXNVPROC __glewPrimitiveRestartIndexNV = NULL;
-PFNGLPRIMITIVERESTARTNVPROC __glewPrimitiveRestartNV = NULL;
-
-PFNGLCOMBINERINPUTNVPROC __glewCombinerInputNV = NULL;
-PFNGLCOMBINEROUTPUTNVPROC __glewCombinerOutputNV = NULL;
-PFNGLCOMBINERPARAMETERFNVPROC __glewCombinerParameterfNV = NULL;
-PFNGLCOMBINERPARAMETERFVNVPROC __glewCombinerParameterfvNV = NULL;
-PFNGLCOMBINERPARAMETERINVPROC __glewCombinerParameteriNV = NULL;
-PFNGLCOMBINERPARAMETERIVNVPROC __glewCombinerParameterivNV = NULL;
-PFNGLFINALCOMBINERINPUTNVPROC __glewFinalCombinerInputNV = NULL;
-PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC __glewGetCombinerInputParameterfvNV = NULL;
-PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC __glewGetCombinerInputParameterivNV = NULL;
-PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC __glewGetCombinerOutputParameterfvNV = NULL;
-PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC __glewGetCombinerOutputParameterivNV = NULL;
-PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC __glewGetFinalCombinerInputParameterfvNV = NULL;
-PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC __glewGetFinalCombinerInputParameterivNV = NULL;
-
-PFNGLCOMBINERSTAGEPARAMETERFVNVPROC __glewCombinerStageParameterfvNV = NULL;
-PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC __glewGetCombinerStageParameterfvNV = NULL;
-
-PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC __glewFramebufferSampleLocationsfvNV = NULL;
-PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC __glewNamedFramebufferSampleLocationsfvNV = NULL;
-
-PFNGLGETBUFFERPARAMETERUI64VNVPROC __glewGetBufferParameterui64vNV = NULL;
-PFNGLGETINTEGERUI64VNVPROC __glewGetIntegerui64vNV = NULL;
-PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC __glewGetNamedBufferParameterui64vNV = NULL;
-PFNGLISBUFFERRESIDENTNVPROC __glewIsBufferResidentNV = NULL;
-PFNGLISNAMEDBUFFERRESIDENTNVPROC __glewIsNamedBufferResidentNV = NULL;
-PFNGLMAKEBUFFERNONRESIDENTNVPROC __glewMakeBufferNonResidentNV = NULL;
-PFNGLMAKEBUFFERRESIDENTNVPROC __glewMakeBufferResidentNV = NULL;
-PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC __glewMakeNamedBufferNonResidentNV = NULL;
-PFNGLMAKENAMEDBUFFERRESIDENTNVPROC __glewMakeNamedBufferResidentNV = NULL;
-PFNGLPROGRAMUNIFORMUI64NVPROC __glewProgramUniformui64NV = NULL;
-PFNGLPROGRAMUNIFORMUI64VNVPROC __glewProgramUniformui64vNV = NULL;
-PFNGLUNIFORMUI64NVPROC __glewUniformui64NV = NULL;
-PFNGLUNIFORMUI64VNVPROC __glewUniformui64vNV = NULL;
-
-PFNGLTEXTUREBARRIERNVPROC __glewTextureBarrierNV = NULL;
-
-PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTexImage2DMultisampleCoverageNV = NULL;
-PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTexImage3DMultisampleCoverageNV = NULL;
-PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTextureImage2DMultisampleCoverageNV = NULL;
-PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC __glewTextureImage2DMultisampleNV = NULL;
-PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTextureImage3DMultisampleCoverageNV = NULL;
-PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC __glewTextureImage3DMultisampleNV = NULL;
-
-PFNGLACTIVEVARYINGNVPROC __glewActiveVaryingNV = NULL;
-PFNGLBEGINTRANSFORMFEEDBACKNVPROC __glewBeginTransformFeedbackNV = NULL;
-PFNGLBINDBUFFERBASENVPROC __glewBindBufferBaseNV = NULL;
-PFNGLBINDBUFFEROFFSETNVPROC __glewBindBufferOffsetNV = NULL;
-PFNGLBINDBUFFERRANGENVPROC __glewBindBufferRangeNV = NULL;
-PFNGLENDTRANSFORMFEEDBACKNVPROC __glewEndTransformFeedbackNV = NULL;
-PFNGLGETACTIVEVARYINGNVPROC __glewGetActiveVaryingNV = NULL;
-PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC __glewGetTransformFeedbackVaryingNV = NULL;
-PFNGLGETVARYINGLOCATIONNVPROC __glewGetVaryingLocationNV = NULL;
-PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC __glewTransformFeedbackAttribsNV = NULL;
-PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC __glewTransformFeedbackVaryingsNV = NULL;
-
-PFNGLBINDTRANSFORMFEEDBACKNVPROC __glewBindTransformFeedbackNV = NULL;
-PFNGLDELETETRANSFORMFEEDBACKSNVPROC __glewDeleteTransformFeedbacksNV = NULL;
-PFNGLDRAWTRANSFORMFEEDBACKNVPROC __glewDrawTransformFeedbackNV = NULL;
-PFNGLGENTRANSFORMFEEDBACKSNVPROC __glewGenTransformFeedbacksNV = NULL;
-PFNGLISTRANSFORMFEEDBACKNVPROC __glewIsTransformFeedbackNV = NULL;
-PFNGLPAUSETRANSFORMFEEDBACKNVPROC __glewPauseTransformFeedbackNV = NULL;
-PFNGLRESUMETRANSFORMFEEDBACKNVPROC __glewResumeTransformFeedbackNV = NULL;
-
-PFNGLVDPAUFININVPROC __glewVDPAUFiniNV = NULL;
-PFNGLVDPAUGETSURFACEIVNVPROC __glewVDPAUGetSurfaceivNV = NULL;
-PFNGLVDPAUINITNVPROC __glewVDPAUInitNV = NULL;
-PFNGLVDPAUISSURFACENVPROC __glewVDPAUIsSurfaceNV = NULL;
-PFNGLVDPAUMAPSURFACESNVPROC __glewVDPAUMapSurfacesNV = NULL;
-PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC __glewVDPAURegisterOutputSurfaceNV = NULL;
-PFNGLVDPAUREGISTERVIDEOSURFACENVPROC __glewVDPAURegisterVideoSurfaceNV = NULL;
-PFNGLVDPAUSURFACEACCESSNVPROC __glewVDPAUSurfaceAccessNV = NULL;
-PFNGLVDPAUUNMAPSURFACESNVPROC __glewVDPAUUnmapSurfacesNV = NULL;
-PFNGLVDPAUUNREGISTERSURFACENVPROC __glewVDPAUUnregisterSurfaceNV = NULL;
-
-PFNGLFLUSHVERTEXARRAYRANGENVPROC __glewFlushVertexArrayRangeNV = NULL;
-PFNGLVERTEXARRAYRANGENVPROC __glewVertexArrayRangeNV = NULL;
-
-PFNGLGETVERTEXATTRIBLI64VNVPROC __glewGetVertexAttribLi64vNV = NULL;
-PFNGLGETVERTEXATTRIBLUI64VNVPROC __glewGetVertexAttribLui64vNV = NULL;
-PFNGLVERTEXATTRIBL1I64NVPROC __glewVertexAttribL1i64NV = NULL;
-PFNGLVERTEXATTRIBL1I64VNVPROC __glewVertexAttribL1i64vNV = NULL;
-PFNGLVERTEXATTRIBL1UI64NVPROC __glewVertexAttribL1ui64NV = NULL;
-PFNGLVERTEXATTRIBL1UI64VNVPROC __glewVertexAttribL1ui64vNV = NULL;
-PFNGLVERTEXATTRIBL2I64NVPROC __glewVertexAttribL2i64NV = NULL;
-PFNGLVERTEXATTRIBL2I64VNVPROC __glewVertexAttribL2i64vNV = NULL;
-PFNGLVERTEXATTRIBL2UI64NVPROC __glewVertexAttribL2ui64NV = NULL;
-PFNGLVERTEXATTRIBL2UI64VNVPROC __glewVertexAttribL2ui64vNV = NULL;
-PFNGLVERTEXATTRIBL3I64NVPROC __glewVertexAttribL3i64NV = NULL;
-PFNGLVERTEXATTRIBL3I64VNVPROC __glewVertexAttribL3i64vNV = NULL;
-PFNGLVERTEXATTRIBL3UI64NVPROC __glewVertexAttribL3ui64NV = NULL;
-PFNGLVERTEXATTRIBL3UI64VNVPROC __glewVertexAttribL3ui64vNV = NULL;
-PFNGLVERTEXATTRIBL4I64NVPROC __glewVertexAttribL4i64NV = NULL;
-PFNGLVERTEXATTRIBL4I64VNVPROC __glewVertexAttribL4i64vNV = NULL;
-PFNGLVERTEXATTRIBL4UI64NVPROC __glewVertexAttribL4ui64NV = NULL;
-PFNGLVERTEXATTRIBL4UI64VNVPROC __glewVertexAttribL4ui64vNV = NULL;
-PFNGLVERTEXATTRIBLFORMATNVPROC __glewVertexAttribLFormatNV = NULL;
-
-PFNGLBUFFERADDRESSRANGENVPROC __glewBufferAddressRangeNV = NULL;
-PFNGLCOLORFORMATNVPROC __glewColorFormatNV = NULL;
-PFNGLEDGEFLAGFORMATNVPROC __glewEdgeFlagFormatNV = NULL;
-PFNGLFOGCOORDFORMATNVPROC __glewFogCoordFormatNV = NULL;
-PFNGLGETINTEGERUI64I_VNVPROC __glewGetIntegerui64i_vNV = NULL;
-PFNGLINDEXFORMATNVPROC __glewIndexFormatNV = NULL;
-PFNGLNORMALFORMATNVPROC __glewNormalFormatNV = NULL;
-PFNGLSECONDARYCOLORFORMATNVPROC __glewSecondaryColorFormatNV = NULL;
-PFNGLTEXCOORDFORMATNVPROC __glewTexCoordFormatNV = NULL;
-PFNGLVERTEXATTRIBFORMATNVPROC __glewVertexAttribFormatNV = NULL;
-PFNGLVERTEXATTRIBIFORMATNVPROC __glewVertexAttribIFormatNV = NULL;
-PFNGLVERTEXFORMATNVPROC __glewVertexFormatNV = NULL;
-
-PFNGLAREPROGRAMSRESIDENTNVPROC __glewAreProgramsResidentNV = NULL;
-PFNGLBINDPROGRAMNVPROC __glewBindProgramNV = NULL;
-PFNGLDELETEPROGRAMSNVPROC __glewDeleteProgramsNV = NULL;
-PFNGLEXECUTEPROGRAMNVPROC __glewExecuteProgramNV = NULL;
-PFNGLGENPROGRAMSNVPROC __glewGenProgramsNV = NULL;
-PFNGLGETPROGRAMPARAMETERDVNVPROC __glewGetProgramParameterdvNV = NULL;
-PFNGLGETPROGRAMPARAMETERFVNVPROC __glewGetProgramParameterfvNV = NULL;
-PFNGLGETPROGRAMSTRINGNVPROC __glewGetProgramStringNV = NULL;
-PFNGLGETPROGRAMIVNVPROC __glewGetProgramivNV = NULL;
-PFNGLGETTRACKMATRIXIVNVPROC __glewGetTrackMatrixivNV = NULL;
-PFNGLGETVERTEXATTRIBPOINTERVNVPROC __glewGetVertexAttribPointervNV = NULL;
-PFNGLGETVERTEXATTRIBDVNVPROC __glewGetVertexAttribdvNV = NULL;
-PFNGLGETVERTEXATTRIBFVNVPROC __glewGetVertexAttribfvNV = NULL;
-PFNGLGETVERTEXATTRIBIVNVPROC __glewGetVertexAttribivNV = NULL;
-PFNGLISPROGRAMNVPROC __glewIsProgramNV = NULL;
-PFNGLLOADPROGRAMNVPROC __glewLoadProgramNV = NULL;
-PFNGLPROGRAMPARAMETER4DNVPROC __glewProgramParameter4dNV = NULL;
-PFNGLPROGRAMPARAMETER4DVNVPROC __glewProgramParameter4dvNV = NULL;
-PFNGLPROGRAMPARAMETER4FNVPROC __glewProgramParameter4fNV = NULL;
-PFNGLPROGRAMPARAMETER4FVNVPROC __glewProgramParameter4fvNV = NULL;
-PFNGLPROGRAMPARAMETERS4DVNVPROC __glewProgramParameters4dvNV = NULL;
-PFNGLPROGRAMPARAMETERS4FVNVPROC __glewProgramParameters4fvNV = NULL;
-PFNGLREQUESTRESIDENTPROGRAMSNVPROC __glewRequestResidentProgramsNV = NULL;
-PFNGLTRACKMATRIXNVPROC __glewTrackMatrixNV = NULL;
-PFNGLVERTEXATTRIB1DNVPROC __glewVertexAttrib1dNV = NULL;
-PFNGLVERTEXATTRIB1DVNVPROC __glewVertexAttrib1dvNV = NULL;
-PFNGLVERTEXATTRIB1FNVPROC __glewVertexAttrib1fNV = NULL;
-PFNGLVERTEXATTRIB1FVNVPROC __glewVertexAttrib1fvNV = NULL;
-PFNGLVERTEXATTRIB1SNVPROC __glewVertexAttrib1sNV = NULL;
-PFNGLVERTEXATTRIB1SVNVPROC __glewVertexAttrib1svNV = NULL;
-PFNGLVERTEXATTRIB2DNVPROC __glewVertexAttrib2dNV = NULL;
-PFNGLVERTEXATTRIB2DVNVPROC __glewVertexAttrib2dvNV = NULL;
-PFNGLVERTEXATTRIB2FNVPROC __glewVertexAttrib2fNV = NULL;
-PFNGLVERTEXATTRIB2FVNVPROC __glewVertexAttrib2fvNV = NULL;
-PFNGLVERTEXATTRIB2SNVPROC __glewVertexAttrib2sNV = NULL;
-PFNGLVERTEXATTRIB2SVNVPROC __glewVertexAttrib2svNV = NULL;
-PFNGLVERTEXATTRIB3DNVPROC __glewVertexAttrib3dNV = NULL;
-PFNGLVERTEXATTRIB3DVNVPROC __glewVertexAttrib3dvNV = NULL;
-PFNGLVERTEXATTRIB3FNVPROC __glewVertexAttrib3fNV = NULL;
-PFNGLVERTEXATTRIB3FVNVPROC __glewVertexAttrib3fvNV = NULL;
-PFNGLVERTEXATTRIB3SNVPROC __glewVertexAttrib3sNV = NULL;
-PFNGLVERTEXATTRIB3SVNVPROC __glewVertexAttrib3svNV = NULL;
-PFNGLVERTEXATTRIB4DNVPROC __glewVertexAttrib4dNV = NULL;
-PFNGLVERTEXATTRIB4DVNVPROC __glewVertexAttrib4dvNV = NULL;
-PFNGLVERTEXATTRIB4FNVPROC __glewVertexAttrib4fNV = NULL;
-PFNGLVERTEXATTRIB4FVNVPROC __glewVertexAttrib4fvNV = NULL;
-PFNGLVERTEXATTRIB4SNVPROC __glewVertexAttrib4sNV = NULL;
-PFNGLVERTEXATTRIB4SVNVPROC __glewVertexAttrib4svNV = NULL;
-PFNGLVERTEXATTRIB4UBNVPROC __glewVertexAttrib4ubNV = NULL;
-PFNGLVERTEXATTRIB4UBVNVPROC __glewVertexAttrib4ubvNV = NULL;
-PFNGLVERTEXATTRIBPOINTERNVPROC __glewVertexAttribPointerNV = NULL;
-PFNGLVERTEXATTRIBS1DVNVPROC __glewVertexAttribs1dvNV = NULL;
-PFNGLVERTEXATTRIBS1FVNVPROC __glewVertexAttribs1fvNV = NULL;
-PFNGLVERTEXATTRIBS1SVNVPROC __glewVertexAttribs1svNV = NULL;
-PFNGLVERTEXATTRIBS2DVNVPROC __glewVertexAttribs2dvNV = NULL;
-PFNGLVERTEXATTRIBS2FVNVPROC __glewVertexAttribs2fvNV = NULL;
-PFNGLVERTEXATTRIBS2SVNVPROC __glewVertexAttribs2svNV = NULL;
-PFNGLVERTEXATTRIBS3DVNVPROC __glewVertexAttribs3dvNV = NULL;
-PFNGLVERTEXATTRIBS3FVNVPROC __glewVertexAttribs3fvNV = NULL;
-PFNGLVERTEXATTRIBS3SVNVPROC __glewVertexAttribs3svNV = NULL;
-PFNGLVERTEXATTRIBS4DVNVPROC __glewVertexAttribs4dvNV = NULL;
-PFNGLVERTEXATTRIBS4FVNVPROC __glewVertexAttribs4fvNV = NULL;
-PFNGLVERTEXATTRIBS4SVNVPROC __glewVertexAttribs4svNV = NULL;
-PFNGLVERTEXATTRIBS4UBVNVPROC __glewVertexAttribs4ubvNV = NULL;
-
-PFNGLBEGINVIDEOCAPTURENVPROC __glewBeginVideoCaptureNV = NULL;
-PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC __glewBindVideoCaptureStreamBufferNV = NULL;
-PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC __glewBindVideoCaptureStreamTextureNV = NULL;
-PFNGLENDVIDEOCAPTURENVPROC __glewEndVideoCaptureNV = NULL;
-PFNGLGETVIDEOCAPTURESTREAMDVNVPROC __glewGetVideoCaptureStreamdvNV = NULL;
-PFNGLGETVIDEOCAPTURESTREAMFVNVPROC __glewGetVideoCaptureStreamfvNV = NULL;
-PFNGLGETVIDEOCAPTURESTREAMIVNVPROC __glewGetVideoCaptureStreamivNV = NULL;
-PFNGLGETVIDEOCAPTUREIVNVPROC __glewGetVideoCaptureivNV = NULL;
-PFNGLVIDEOCAPTURENVPROC __glewVideoCaptureNV = NULL;
-PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC __glewVideoCaptureStreamParameterdvNV = NULL;
-PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC __glewVideoCaptureStreamParameterfvNV = NULL;
-PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC __glewVideoCaptureStreamParameterivNV = NULL;
-
-PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES = NULL;
-PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES = NULL;
-PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES = NULL;
-PFNGLFRUSTUMFOESPROC __glewFrustumfOES = NULL;
-PFNGLGETCLIPPLANEFOESPROC __glewGetClipPlanefOES = NULL;
-PFNGLORTHOFOESPROC __glewOrthofOES = NULL;
-
-PFNGLALPHAFUNCXPROC __glewAlphaFuncx = NULL;
-PFNGLCLEARCOLORXPROC __glewClearColorx = NULL;
-PFNGLCLEARDEPTHXPROC __glewClearDepthx = NULL;
-PFNGLCOLOR4XPROC __glewColor4x = NULL;
-PFNGLDEPTHRANGEXPROC __glewDepthRangex = NULL;
-PFNGLFOGXPROC __glewFogx = NULL;
-PFNGLFOGXVPROC __glewFogxv = NULL;
-PFNGLFRUSTUMFPROC __glewFrustumf = NULL;
-PFNGLFRUSTUMXPROC __glewFrustumx = NULL;
-PFNGLLIGHTMODELXPROC __glewLightModelx = NULL;
-PFNGLLIGHTMODELXVPROC __glewLightModelxv = NULL;
-PFNGLLIGHTXPROC __glewLightx = NULL;
-PFNGLLIGHTXVPROC __glewLightxv = NULL;
-PFNGLLINEWIDTHXPROC __glewLineWidthx = NULL;
-PFNGLLOADMATRIXXPROC __glewLoadMatrixx = NULL;
-PFNGLMATERIALXPROC __glewMaterialx = NULL;
-PFNGLMATERIALXVPROC __glewMaterialxv = NULL;
-PFNGLMULTMATRIXXPROC __glewMultMatrixx = NULL;
-PFNGLMULTITEXCOORD4XPROC __glewMultiTexCoord4x = NULL;
-PFNGLNORMAL3XPROC __glewNormal3x = NULL;
-PFNGLORTHOFPROC __glewOrthof = NULL;
-PFNGLORTHOXPROC __glewOrthox = NULL;
-PFNGLPOINTSIZEXPROC __glewPointSizex = NULL;
-PFNGLPOLYGONOFFSETXPROC __glewPolygonOffsetx = NULL;
-PFNGLROTATEXPROC __glewRotatex = NULL;
-PFNGLSAMPLECOVERAGEXPROC __glewSampleCoveragex = NULL;
-PFNGLSCALEXPROC __glewScalex = NULL;
-PFNGLTEXENVXPROC __glewTexEnvx = NULL;
-PFNGLTEXENVXVPROC __glewTexEnvxv = NULL;
-PFNGLTEXPARAMETERXPROC __glewTexParameterx = NULL;
-PFNGLTRANSLATEXPROC __glewTranslatex = NULL;
-
-PFNGLCLIPPLANEFPROC __glewClipPlanef = NULL;
-PFNGLCLIPPLANEXPROC __glewClipPlanex = NULL;
-PFNGLGETCLIPPLANEFPROC __glewGetClipPlanef = NULL;
-PFNGLGETCLIPPLANEXPROC __glewGetClipPlanex = NULL;
-PFNGLGETFIXEDVPROC __glewGetFixedv = NULL;
-PFNGLGETLIGHTXVPROC __glewGetLightxv = NULL;
-PFNGLGETMATERIALXVPROC __glewGetMaterialxv = NULL;
-PFNGLGETTEXENVXVPROC __glewGetTexEnvxv = NULL;
-PFNGLGETTEXPARAMETERXVPROC __glewGetTexParameterxv = NULL;
-PFNGLPOINTPARAMETERXPROC __glewPointParameterx = NULL;
-PFNGLPOINTPARAMETERXVPROC __glewPointParameterxv = NULL;
-PFNGLPOINTSIZEPOINTEROESPROC __glewPointSizePointerOES = NULL;
-PFNGLTEXPARAMETERXVPROC __glewTexParameterxv = NULL;
-
-PFNGLERRORSTRINGREGALPROC __glewErrorStringREGAL = NULL;
-
-PFNGLGETEXTENSIONREGALPROC __glewGetExtensionREGAL = NULL;
-PFNGLISSUPPORTEDREGALPROC __glewIsSupportedREGAL = NULL;
-
-PFNGLLOGMESSAGECALLBACKREGALPROC __glewLogMessageCallbackREGAL = NULL;
-
-PFNGLGETPROCADDRESSREGALPROC __glewGetProcAddressREGAL = NULL;
-
-PFNGLDETAILTEXFUNCSGISPROC __glewDetailTexFuncSGIS = NULL;
-PFNGLGETDETAILTEXFUNCSGISPROC __glewGetDetailTexFuncSGIS = NULL;
-
-PFNGLFOGFUNCSGISPROC __glewFogFuncSGIS = NULL;
-PFNGLGETFOGFUNCSGISPROC __glewGetFogFuncSGIS = NULL;
-
-PFNGLSAMPLEMASKSGISPROC __glewSampleMaskSGIS = NULL;
-PFNGLSAMPLEPATTERNSGISPROC __glewSamplePatternSGIS = NULL;
-
-PFNGLGETSHARPENTEXFUNCSGISPROC __glewGetSharpenTexFuncSGIS = NULL;
-PFNGLSHARPENTEXFUNCSGISPROC __glewSharpenTexFuncSGIS = NULL;
-
-PFNGLTEXIMAGE4DSGISPROC __glewTexImage4DSGIS = NULL;
-PFNGLTEXSUBIMAGE4DSGISPROC __glewTexSubImage4DSGIS = NULL;
-
-PFNGLGETTEXFILTERFUNCSGISPROC __glewGetTexFilterFuncSGIS = NULL;
-PFNGLTEXFILTERFUNCSGISPROC __glewTexFilterFuncSGIS = NULL;
-
-PFNGLASYNCMARKERSGIXPROC __glewAsyncMarkerSGIX = NULL;
-PFNGLDELETEASYNCMARKERSSGIXPROC __glewDeleteAsyncMarkersSGIX = NULL;
-PFNGLFINISHASYNCSGIXPROC __glewFinishAsyncSGIX = NULL;
-PFNGLGENASYNCMARKERSSGIXPROC __glewGenAsyncMarkersSGIX = NULL;
-PFNGLISASYNCMARKERSGIXPROC __glewIsAsyncMarkerSGIX = NULL;
-PFNGLPOLLASYNCSGIXPROC __glewPollAsyncSGIX = NULL;
-
-PFNGLFLUSHRASTERSGIXPROC __glewFlushRasterSGIX = NULL;
-
-PFNGLTEXTUREFOGSGIXPROC __glewTextureFogSGIX = NULL;
-
-PFNGLFRAGMENTCOLORMATERIALSGIXPROC __glewFragmentColorMaterialSGIX = NULL;
-PFNGLFRAGMENTLIGHTMODELFSGIXPROC __glewFragmentLightModelfSGIX = NULL;
-PFNGLFRAGMENTLIGHTMODELFVSGIXPROC __glewFragmentLightModelfvSGIX = NULL;
-PFNGLFRAGMENTLIGHTMODELISGIXPROC __glewFragmentLightModeliSGIX = NULL;
-PFNGLFRAGMENTLIGHTMODELIVSGIXPROC __glewFragmentLightModelivSGIX = NULL;
-PFNGLFRAGMENTLIGHTFSGIXPROC __glewFragmentLightfSGIX = NULL;
-PFNGLFRAGMENTLIGHTFVSGIXPROC __glewFragmentLightfvSGIX = NULL;
-PFNGLFRAGMENTLIGHTISGIXPROC __glewFragmentLightiSGIX = NULL;
-PFNGLFRAGMENTLIGHTIVSGIXPROC __glewFragmentLightivSGIX = NULL;
-PFNGLFRAGMENTMATERIALFSGIXPROC __glewFragmentMaterialfSGIX = NULL;
-PFNGLFRAGMENTMATERIALFVSGIXPROC __glewFragmentMaterialfvSGIX = NULL;
-PFNGLFRAGMENTMATERIALISGIXPROC __glewFragmentMaterialiSGIX = NULL;
-PFNGLFRAGMENTMATERIALIVSGIXPROC __glewFragmentMaterialivSGIX = NULL;
-PFNGLGETFRAGMENTLIGHTFVSGIXPROC __glewGetFragmentLightfvSGIX = NULL;
-PFNGLGETFRAGMENTLIGHTIVSGIXPROC __glewGetFragmentLightivSGIX = NULL;
-PFNGLGETFRAGMENTMATERIALFVSGIXPROC __glewGetFragmentMaterialfvSGIX = NULL;
-PFNGLGETFRAGMENTMATERIALIVSGIXPROC __glewGetFragmentMaterialivSGIX = NULL;
-
-PFNGLFRAMEZOOMSGIXPROC __glewFrameZoomSGIX = NULL;
-
-PFNGLPIXELTEXGENSGIXPROC __glewPixelTexGenSGIX = NULL;
-
-PFNGLREFERENCEPLANESGIXPROC __glewReferencePlaneSGIX = NULL;
-
-PFNGLSPRITEPARAMETERFSGIXPROC __glewSpriteParameterfSGIX = NULL;
-PFNGLSPRITEPARAMETERFVSGIXPROC __glewSpriteParameterfvSGIX = NULL;
-PFNGLSPRITEPARAMETERISGIXPROC __glewSpriteParameteriSGIX = NULL;
-PFNGLSPRITEPARAMETERIVSGIXPROC __glewSpriteParameterivSGIX = NULL;
-
-PFNGLTAGSAMPLEBUFFERSGIXPROC __glewTagSampleBufferSGIX = NULL;
-
-PFNGLCOLORTABLEPARAMETERFVSGIPROC __glewColorTableParameterfvSGI = NULL;
-PFNGLCOLORTABLEPARAMETERIVSGIPROC __glewColorTableParameterivSGI = NULL;
-PFNGLCOLORTABLESGIPROC __glewColorTableSGI = NULL;
-PFNGLCOPYCOLORTABLESGIPROC __glewCopyColorTableSGI = NULL;
-PFNGLGETCOLORTABLEPARAMETERFVSGIPROC __glewGetColorTableParameterfvSGI = NULL;
-PFNGLGETCOLORTABLEPARAMETERIVSGIPROC __glewGetColorTableParameterivSGI = NULL;
-PFNGLGETCOLORTABLESGIPROC __glewGetColorTableSGI = NULL;
-
-PFNGLFINISHTEXTURESUNXPROC __glewFinishTextureSUNX = NULL;
-
-PFNGLGLOBALALPHAFACTORBSUNPROC __glewGlobalAlphaFactorbSUN = NULL;
-PFNGLGLOBALALPHAFACTORDSUNPROC __glewGlobalAlphaFactordSUN = NULL;
-PFNGLGLOBALALPHAFACTORFSUNPROC __glewGlobalAlphaFactorfSUN = NULL;
-PFNGLGLOBALALPHAFACTORISUNPROC __glewGlobalAlphaFactoriSUN = NULL;
-PFNGLGLOBALALPHAFACTORSSUNPROC __glewGlobalAlphaFactorsSUN = NULL;
-PFNGLGLOBALALPHAFACTORUBSUNPROC __glewGlobalAlphaFactorubSUN = NULL;
-PFNGLGLOBALALPHAFACTORUISUNPROC __glewGlobalAlphaFactoruiSUN = NULL;
-PFNGLGLOBALALPHAFACTORUSSUNPROC __glewGlobalAlphaFactorusSUN = NULL;
-
-PFNGLREADVIDEOPIXELSSUNPROC __glewReadVideoPixelsSUN = NULL;
-
-PFNGLREPLACEMENTCODEPOINTERSUNPROC __glewReplacementCodePointerSUN = NULL;
-PFNGLREPLACEMENTCODEUBSUNPROC __glewReplacementCodeubSUN = NULL;
-PFNGLREPLACEMENTCODEUBVSUNPROC __glewReplacementCodeubvSUN = NULL;
-PFNGLREPLACEMENTCODEUISUNPROC __glewReplacementCodeuiSUN = NULL;
-PFNGLREPLACEMENTCODEUIVSUNPROC __glewReplacementCodeuivSUN = NULL;
-PFNGLREPLACEMENTCODEUSSUNPROC __glewReplacementCodeusSUN = NULL;
-PFNGLREPLACEMENTCODEUSVSUNPROC __glewReplacementCodeusvSUN = NULL;
-
-PFNGLCOLOR3FVERTEX3FSUNPROC __glewColor3fVertex3fSUN = NULL;
-PFNGLCOLOR3FVERTEX3FVSUNPROC __glewColor3fVertex3fvSUN = NULL;
-PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewColor4fNormal3fVertex3fSUN = NULL;
-PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewColor4fNormal3fVertex3fvSUN = NULL;
-PFNGLCOLOR4UBVERTEX2FSUNPROC __glewColor4ubVertex2fSUN = NULL;
-PFNGLCOLOR4UBVERTEX2FVSUNPROC __glewColor4ubVertex2fvSUN = NULL;
-PFNGLCOLOR4UBVERTEX3FSUNPROC __glewColor4ubVertex3fSUN = NULL;
-PFNGLCOLOR4UBVERTEX3FVSUNPROC __glewColor4ubVertex3fvSUN = NULL;
-PFNGLNORMAL3FVERTEX3FSUNPROC __glewNormal3fVertex3fSUN = NULL;
-PFNGLNORMAL3FVERTEX3FVSUNPROC __glewNormal3fVertex3fvSUN = NULL;
-PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC __glewReplacementCodeuiColor3fVertex3fSUN = NULL;
-PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor3fVertex3fvSUN = NULL;
-PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fSUN = NULL;
-PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fvSUN = NULL;
-PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC __glewReplacementCodeuiColor4ubVertex3fSUN = NULL;
-PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC __glewReplacementCodeuiColor4ubVertex3fvSUN = NULL;
-PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiNormal3fVertex3fSUN = NULL;
-PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiNormal3fVertex3fvSUN = NULL;
-PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN = NULL;
-PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN = NULL;
-PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN = NULL;
-PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN = NULL;
-PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fSUN = NULL;
-PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fvSUN = NULL;
-PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC __glewReplacementCodeuiVertex3fSUN = NULL;
-PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC __glewReplacementCodeuiVertex3fvSUN = NULL;
-PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC __glewTexCoord2fColor3fVertex3fSUN = NULL;
-PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC __glewTexCoord2fColor3fVertex3fvSUN = NULL;
-PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fSUN = NULL;
-PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fvSUN = NULL;
-PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC __glewTexCoord2fColor4ubVertex3fSUN = NULL;
-PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC __glewTexCoord2fColor4ubVertex3fvSUN = NULL;
-PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fNormal3fVertex3fSUN = NULL;
-PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fNormal3fVertex3fvSUN = NULL;
-PFNGLTEXCOORD2FVERTEX3FSUNPROC __glewTexCoord2fVertex3fSUN = NULL;
-PFNGLTEXCOORD2FVERTEX3FVSUNPROC __glewTexCoord2fVertex3fvSUN = NULL;
-PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fSUN = NULL;
-PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fvSUN = NULL;
-PFNGLTEXCOORD4FVERTEX4FSUNPROC __glewTexCoord4fVertex4fSUN = NULL;
-PFNGLTEXCOORD4FVERTEX4FVSUNPROC __glewTexCoord4fVertex4fvSUN = NULL;
-
-PFNGLADDSWAPHINTRECTWINPROC __glewAddSwapHintRectWIN = NULL;
-
-#endif /* !WIN32 || !GLEW_MX */
-
-#if !defined(GLEW_MX)
-
-GLboolean __GLEW_VERSION_1_1 = GL_FALSE;
-GLboolean __GLEW_VERSION_1_2 = GL_FALSE;
-GLboolean __GLEW_VERSION_1_2_1 = GL_FALSE;
-GLboolean __GLEW_VERSION_1_3 = GL_FALSE;
-GLboolean __GLEW_VERSION_1_4 = GL_FALSE;
-GLboolean __GLEW_VERSION_1_5 = GL_FALSE;
-GLboolean __GLEW_VERSION_2_0 = GL_FALSE;
-GLboolean __GLEW_VERSION_2_1 = GL_FALSE;
-GLboolean __GLEW_VERSION_3_0 = GL_FALSE;
-GLboolean __GLEW_VERSION_3_1 = GL_FALSE;
-GLboolean __GLEW_VERSION_3_2 = GL_FALSE;
-GLboolean __GLEW_VERSION_3_3 = GL_FALSE;
-GLboolean __GLEW_VERSION_4_0 = GL_FALSE;
-GLboolean __GLEW_VERSION_4_1 = GL_FALSE;
-GLboolean __GLEW_VERSION_4_2 = GL_FALSE;
-GLboolean __GLEW_VERSION_4_3 = GL_FALSE;
-GLboolean __GLEW_VERSION_4_4 = GL_FALSE;
-GLboolean __GLEW_VERSION_4_5 = GL_FALSE;
-GLboolean __GLEW_3DFX_multisample = GL_FALSE;
-GLboolean __GLEW_3DFX_tbuffer = GL_FALSE;
-GLboolean __GLEW_3DFX_texture_compression_FXT1 = GL_FALSE;
-GLboolean __GLEW_AMD_blend_minmax_factor = GL_FALSE;
-GLboolean __GLEW_AMD_conservative_depth = GL_FALSE;
-GLboolean __GLEW_AMD_debug_output = GL_FALSE;
-GLboolean __GLEW_AMD_depth_clamp_separate = GL_FALSE;
-GLboolean __GLEW_AMD_draw_buffers_blend = GL_FALSE;
-GLboolean __GLEW_AMD_gcn_shader = GL_FALSE;
-GLboolean __GLEW_AMD_gpu_shader_int64 = GL_FALSE;
-GLboolean __GLEW_AMD_interleaved_elements = GL_FALSE;
-GLboolean __GLEW_AMD_multi_draw_indirect = GL_FALSE;
-GLboolean __GLEW_AMD_name_gen_delete = GL_FALSE;
-GLboolean __GLEW_AMD_occlusion_query_event = GL_FALSE;
-GLboolean __GLEW_AMD_performance_monitor = GL_FALSE;
-GLboolean __GLEW_AMD_pinned_memory = GL_FALSE;
-GLboolean __GLEW_AMD_query_buffer_object = GL_FALSE;
-GLboolean __GLEW_AMD_sample_positions = GL_FALSE;
-GLboolean __GLEW_AMD_seamless_cubemap_per_texture = GL_FALSE;
-GLboolean __GLEW_AMD_shader_atomic_counter_ops = GL_FALSE;
-GLboolean __GLEW_AMD_shader_stencil_export = GL_FALSE;
-GLboolean __GLEW_AMD_shader_stencil_value_export = GL_FALSE;
-GLboolean __GLEW_AMD_shader_trinary_minmax = GL_FALSE;
-GLboolean __GLEW_AMD_sparse_texture = GL_FALSE;
-GLboolean __GLEW_AMD_stencil_operation_extended = GL_FALSE;
-GLboolean __GLEW_AMD_texture_texture4 = GL_FALSE;
-GLboolean __GLEW_AMD_transform_feedback3_lines_triangles = GL_FALSE;
-GLboolean __GLEW_AMD_transform_feedback4 = GL_FALSE;
-GLboolean __GLEW_AMD_vertex_shader_layer = GL_FALSE;
-GLboolean __GLEW_AMD_vertex_shader_tessellator = GL_FALSE;
-GLboolean __GLEW_AMD_vertex_shader_viewport_index = GL_FALSE;
-GLboolean __GLEW_ANGLE_depth_texture = GL_FALSE;
-GLboolean __GLEW_ANGLE_framebuffer_blit = GL_FALSE;
-GLboolean __GLEW_ANGLE_framebuffer_multisample = GL_FALSE;
-GLboolean __GLEW_ANGLE_instanced_arrays = GL_FALSE;
-GLboolean __GLEW_ANGLE_pack_reverse_row_order = GL_FALSE;
-GLboolean __GLEW_ANGLE_program_binary = GL_FALSE;
-GLboolean __GLEW_ANGLE_texture_compression_dxt1 = GL_FALSE;
-GLboolean __GLEW_ANGLE_texture_compression_dxt3 = GL_FALSE;
-GLboolean __GLEW_ANGLE_texture_compression_dxt5 = GL_FALSE;
-GLboolean __GLEW_ANGLE_texture_usage = GL_FALSE;
-GLboolean __GLEW_ANGLE_timer_query = GL_FALSE;
-GLboolean __GLEW_ANGLE_translated_shader_source = GL_FALSE;
-GLboolean __GLEW_APPLE_aux_depth_stencil = GL_FALSE;
-GLboolean __GLEW_APPLE_client_storage = GL_FALSE;
-GLboolean __GLEW_APPLE_element_array = GL_FALSE;
-GLboolean __GLEW_APPLE_fence = GL_FALSE;
-GLboolean __GLEW_APPLE_float_pixels = GL_FALSE;
-GLboolean __GLEW_APPLE_flush_buffer_range = GL_FALSE;
-GLboolean __GLEW_APPLE_object_purgeable = GL_FALSE;
-GLboolean __GLEW_APPLE_pixel_buffer = GL_FALSE;
-GLboolean __GLEW_APPLE_rgb_422 = GL_FALSE;
-GLboolean __GLEW_APPLE_row_bytes = GL_FALSE;
-GLboolean __GLEW_APPLE_specular_vector = GL_FALSE;
-GLboolean __GLEW_APPLE_texture_range = GL_FALSE;
-GLboolean __GLEW_APPLE_transform_hint = GL_FALSE;
-GLboolean __GLEW_APPLE_vertex_array_object = GL_FALSE;
-GLboolean __GLEW_APPLE_vertex_array_range = GL_FALSE;
-GLboolean __GLEW_APPLE_vertex_program_evaluators = GL_FALSE;
-GLboolean __GLEW_APPLE_ycbcr_422 = GL_FALSE;
-GLboolean __GLEW_ARB_ES2_compatibility = GL_FALSE;
-GLboolean __GLEW_ARB_ES3_1_compatibility = GL_FALSE;
-GLboolean __GLEW_ARB_ES3_compatibility = GL_FALSE;
-GLboolean __GLEW_ARB_arrays_of_arrays = GL_FALSE;
-GLboolean __GLEW_ARB_base_instance = GL_FALSE;
-GLboolean __GLEW_ARB_bindless_texture = GL_FALSE;
-GLboolean __GLEW_ARB_blend_func_extended = GL_FALSE;
-GLboolean __GLEW_ARB_buffer_storage = GL_FALSE;
-GLboolean __GLEW_ARB_cl_event = GL_FALSE;
-GLboolean __GLEW_ARB_clear_buffer_object = GL_FALSE;
-GLboolean __GLEW_ARB_clear_texture = GL_FALSE;
-GLboolean __GLEW_ARB_clip_control = GL_FALSE;
-GLboolean __GLEW_ARB_color_buffer_float = GL_FALSE;
-GLboolean __GLEW_ARB_compatibility = GL_FALSE;
-GLboolean __GLEW_ARB_compressed_texture_pixel_storage = GL_FALSE;
-GLboolean __GLEW_ARB_compute_shader = GL_FALSE;
-GLboolean __GLEW_ARB_compute_variable_group_size = GL_FALSE;
-GLboolean __GLEW_ARB_conditional_render_inverted = GL_FALSE;
-GLboolean __GLEW_ARB_conservative_depth = GL_FALSE;
-GLboolean __GLEW_ARB_copy_buffer = GL_FALSE;
-GLboolean __GLEW_ARB_copy_image = GL_FALSE;
-GLboolean __GLEW_ARB_cull_distance = GL_FALSE;
-GLboolean __GLEW_ARB_debug_output = GL_FALSE;
-GLboolean __GLEW_ARB_depth_buffer_float = GL_FALSE;
-GLboolean __GLEW_ARB_depth_clamp = GL_FALSE;
-GLboolean __GLEW_ARB_depth_texture = GL_FALSE;
-GLboolean __GLEW_ARB_derivative_control = GL_FALSE;
-GLboolean __GLEW_ARB_direct_state_access = GL_FALSE;
-GLboolean __GLEW_ARB_draw_buffers = GL_FALSE;
-GLboolean __GLEW_ARB_draw_buffers_blend = GL_FALSE;
-GLboolean __GLEW_ARB_draw_elements_base_vertex = GL_FALSE;
-GLboolean __GLEW_ARB_draw_indirect = GL_FALSE;
-GLboolean __GLEW_ARB_draw_instanced = GL_FALSE;
-GLboolean __GLEW_ARB_enhanced_layouts = GL_FALSE;
-GLboolean __GLEW_ARB_explicit_attrib_location = GL_FALSE;
-GLboolean __GLEW_ARB_explicit_uniform_location = GL_FALSE;
-GLboolean __GLEW_ARB_fragment_coord_conventions = GL_FALSE;
-GLboolean __GLEW_ARB_fragment_layer_viewport = GL_FALSE;
-GLboolean __GLEW_ARB_fragment_program = GL_FALSE;
-GLboolean __GLEW_ARB_fragment_program_shadow = GL_FALSE;
-GLboolean __GLEW_ARB_fragment_shader = GL_FALSE;
-GLboolean __GLEW_ARB_framebuffer_no_attachments = GL_FALSE;
-GLboolean __GLEW_ARB_framebuffer_object = GL_FALSE;
-GLboolean __GLEW_ARB_framebuffer_sRGB = GL_FALSE;
-GLboolean __GLEW_ARB_geometry_shader4 = GL_FALSE;
-GLboolean __GLEW_ARB_get_program_binary = GL_FALSE;
-GLboolean __GLEW_ARB_get_texture_sub_image = GL_FALSE;
-GLboolean __GLEW_ARB_gpu_shader5 = GL_FALSE;
-GLboolean __GLEW_ARB_gpu_shader_fp64 = GL_FALSE;
-GLboolean __GLEW_ARB_half_float_pixel = GL_FALSE;
-GLboolean __GLEW_ARB_half_float_vertex = GL_FALSE;
-GLboolean __GLEW_ARB_imaging = GL_FALSE;
-GLboolean __GLEW_ARB_indirect_parameters = GL_FALSE;
-GLboolean __GLEW_ARB_instanced_arrays = GL_FALSE;
-GLboolean __GLEW_ARB_internalformat_query = GL_FALSE;
-GLboolean __GLEW_ARB_internalformat_query2 = GL_FALSE;
-GLboolean __GLEW_ARB_invalidate_subdata = GL_FALSE;
-GLboolean __GLEW_ARB_map_buffer_alignment = GL_FALSE;
-GLboolean __GLEW_ARB_map_buffer_range = GL_FALSE;
-GLboolean __GLEW_ARB_matrix_palette = GL_FALSE;
-GLboolean __GLEW_ARB_multi_bind = GL_FALSE;
-GLboolean __GLEW_ARB_multi_draw_indirect = GL_FALSE;
-GLboolean __GLEW_ARB_multisample = GL_FALSE;
-GLboolean __GLEW_ARB_multitexture = GL_FALSE;
-GLboolean __GLEW_ARB_occlusion_query = GL_FALSE;
-GLboolean __GLEW_ARB_occlusion_query2 = GL_FALSE;
-GLboolean __GLEW_ARB_pipeline_statistics_query = GL_FALSE;
-GLboolean __GLEW_ARB_pixel_buffer_object = GL_FALSE;
-GLboolean __GLEW_ARB_point_parameters = GL_FALSE;
-GLboolean __GLEW_ARB_point_sprite = GL_FALSE;
-GLboolean __GLEW_ARB_program_interface_query = GL_FALSE;
-GLboolean __GLEW_ARB_provoking_vertex = GL_FALSE;
-GLboolean __GLEW_ARB_query_buffer_object = GL_FALSE;
-GLboolean __GLEW_ARB_robust_buffer_access_behavior = GL_FALSE;
-GLboolean __GLEW_ARB_robustness = GL_FALSE;
-GLboolean __GLEW_ARB_robustness_application_isolation = GL_FALSE;
-GLboolean __GLEW_ARB_robustness_share_group_isolation = GL_FALSE;
-GLboolean __GLEW_ARB_sample_shading = GL_FALSE;
-GLboolean __GLEW_ARB_sampler_objects = GL_FALSE;
-GLboolean __GLEW_ARB_seamless_cube_map = GL_FALSE;
-GLboolean __GLEW_ARB_seamless_cubemap_per_texture = GL_FALSE;
-GLboolean __GLEW_ARB_separate_shader_objects = GL_FALSE;
-GLboolean __GLEW_ARB_shader_atomic_counters = GL_FALSE;
-GLboolean __GLEW_ARB_shader_bit_encoding = GL_FALSE;
-GLboolean __GLEW_ARB_shader_draw_parameters = GL_FALSE;
-GLboolean __GLEW_ARB_shader_group_vote = GL_FALSE;
-GLboolean __GLEW_ARB_shader_image_load_store = GL_FALSE;
-GLboolean __GLEW_ARB_shader_image_size = GL_FALSE;
-GLboolean __GLEW_ARB_shader_objects = GL_FALSE;
-GLboolean __GLEW_ARB_shader_precision = GL_FALSE;
-GLboolean __GLEW_ARB_shader_stencil_export = GL_FALSE;
-GLboolean __GLEW_ARB_shader_storage_buffer_object = GL_FALSE;
-GLboolean __GLEW_ARB_shader_subroutine = GL_FALSE;
-GLboolean __GLEW_ARB_shader_texture_image_samples = GL_FALSE;
-GLboolean __GLEW_ARB_shader_texture_lod = GL_FALSE;
-GLboolean __GLEW_ARB_shading_language_100 = GL_FALSE;
-GLboolean __GLEW_ARB_shading_language_420pack = GL_FALSE;
-GLboolean __GLEW_ARB_shading_language_include = GL_FALSE;
-GLboolean __GLEW_ARB_shading_language_packing = GL_FALSE;
-GLboolean __GLEW_ARB_shadow = GL_FALSE;
-GLboolean __GLEW_ARB_shadow_ambient = GL_FALSE;
-GLboolean __GLEW_ARB_sparse_buffer = GL_FALSE;
-GLboolean __GLEW_ARB_sparse_texture = GL_FALSE;
-GLboolean __GLEW_ARB_stencil_texturing = GL_FALSE;
-GLboolean __GLEW_ARB_sync = GL_FALSE;
-GLboolean __GLEW_ARB_tessellation_shader = GL_FALSE;
-GLboolean __GLEW_ARB_texture_barrier = GL_FALSE;
-GLboolean __GLEW_ARB_texture_border_clamp = GL_FALSE;
-GLboolean __GLEW_ARB_texture_buffer_object = GL_FALSE;
-GLboolean __GLEW_ARB_texture_buffer_object_rgb32 = GL_FALSE;
-GLboolean __GLEW_ARB_texture_buffer_range = GL_FALSE;
-GLboolean __GLEW_ARB_texture_compression = GL_FALSE;
-GLboolean __GLEW_ARB_texture_compression_bptc = GL_FALSE;
-GLboolean __GLEW_ARB_texture_compression_rgtc = GL_FALSE;
-GLboolean __GLEW_ARB_texture_cube_map = GL_FALSE;
-GLboolean __GLEW_ARB_texture_cube_map_array = GL_FALSE;
-GLboolean __GLEW_ARB_texture_env_add = GL_FALSE;
-GLboolean __GLEW_ARB_texture_env_combine = GL_FALSE;
-GLboolean __GLEW_ARB_texture_env_crossbar = GL_FALSE;
-GLboolean __GLEW_ARB_texture_env_dot3 = GL_FALSE;
-GLboolean __GLEW_ARB_texture_float = GL_FALSE;
-GLboolean __GLEW_ARB_texture_gather = GL_FALSE;
-GLboolean __GLEW_ARB_texture_mirror_clamp_to_edge = GL_FALSE;
-GLboolean __GLEW_ARB_texture_mirrored_repeat = GL_FALSE;
-GLboolean __GLEW_ARB_texture_multisample = GL_FALSE;
-GLboolean __GLEW_ARB_texture_non_power_of_two = GL_FALSE;
-GLboolean __GLEW_ARB_texture_query_levels = GL_FALSE;
-GLboolean __GLEW_ARB_texture_query_lod = GL_FALSE;
-GLboolean __GLEW_ARB_texture_rectangle = GL_FALSE;
-GLboolean __GLEW_ARB_texture_rg = GL_FALSE;
-GLboolean __GLEW_ARB_texture_rgb10_a2ui = GL_FALSE;
-GLboolean __GLEW_ARB_texture_stencil8 = GL_FALSE;
-GLboolean __GLEW_ARB_texture_storage = GL_FALSE;
-GLboolean __GLEW_ARB_texture_storage_multisample = GL_FALSE;
-GLboolean __GLEW_ARB_texture_swizzle = GL_FALSE;
-GLboolean __GLEW_ARB_texture_view = GL_FALSE;
-GLboolean __GLEW_ARB_timer_query = GL_FALSE;
-GLboolean __GLEW_ARB_transform_feedback2 = GL_FALSE;
-GLboolean __GLEW_ARB_transform_feedback3 = GL_FALSE;
-GLboolean __GLEW_ARB_transform_feedback_instanced = GL_FALSE;
-GLboolean __GLEW_ARB_transform_feedback_overflow_query = GL_FALSE;
-GLboolean __GLEW_ARB_transpose_matrix = GL_FALSE;
-GLboolean __GLEW_ARB_uniform_buffer_object = GL_FALSE;
-GLboolean __GLEW_ARB_vertex_array_bgra = GL_FALSE;
-GLboolean __GLEW_ARB_vertex_array_object = GL_FALSE;
-GLboolean __GLEW_ARB_vertex_attrib_64bit = GL_FALSE;
-GLboolean __GLEW_ARB_vertex_attrib_binding = GL_FALSE;
-GLboolean __GLEW_ARB_vertex_blend = GL_FALSE;
-GLboolean __GLEW_ARB_vertex_buffer_object = GL_FALSE;
-GLboolean __GLEW_ARB_vertex_program = GL_FALSE;
-GLboolean __GLEW_ARB_vertex_shader = GL_FALSE;
-GLboolean __GLEW_ARB_vertex_type_10f_11f_11f_rev = GL_FALSE;
-GLboolean __GLEW_ARB_vertex_type_2_10_10_10_rev = GL_FALSE;
-GLboolean __GLEW_ARB_viewport_array = GL_FALSE;
-GLboolean __GLEW_ARB_window_pos = GL_FALSE;
-GLboolean __GLEW_ATIX_point_sprites = GL_FALSE;
-GLboolean __GLEW_ATIX_texture_env_combine3 = GL_FALSE;
-GLboolean __GLEW_ATIX_texture_env_route = GL_FALSE;
-GLboolean __GLEW_ATIX_vertex_shader_output_point_size = GL_FALSE;
-GLboolean __GLEW_ATI_draw_buffers = GL_FALSE;
-GLboolean __GLEW_ATI_element_array = GL_FALSE;
-GLboolean __GLEW_ATI_envmap_bumpmap = GL_FALSE;
-GLboolean __GLEW_ATI_fragment_shader = GL_FALSE;
-GLboolean __GLEW_ATI_map_object_buffer = GL_FALSE;
-GLboolean __GLEW_ATI_meminfo = GL_FALSE;
-GLboolean __GLEW_ATI_pn_triangles = GL_FALSE;
-GLboolean __GLEW_ATI_separate_stencil = GL_FALSE;
-GLboolean __GLEW_ATI_shader_texture_lod = GL_FALSE;
-GLboolean __GLEW_ATI_text_fragment_shader = GL_FALSE;
-GLboolean __GLEW_ATI_texture_compression_3dc = GL_FALSE;
-GLboolean __GLEW_ATI_texture_env_combine3 = GL_FALSE;
-GLboolean __GLEW_ATI_texture_float = GL_FALSE;
-GLboolean __GLEW_ATI_texture_mirror_once = GL_FALSE;
-GLboolean __GLEW_ATI_vertex_array_object = GL_FALSE;
-GLboolean __GLEW_ATI_vertex_attrib_array_object = GL_FALSE;
-GLboolean __GLEW_ATI_vertex_streams = GL_FALSE;
-GLboolean __GLEW_EXT_422_pixels = GL_FALSE;
-GLboolean __GLEW_EXT_Cg_shader = GL_FALSE;
-GLboolean __GLEW_EXT_abgr = GL_FALSE;
-GLboolean __GLEW_EXT_bgra = GL_FALSE;
-GLboolean __GLEW_EXT_bindable_uniform = GL_FALSE;
-GLboolean __GLEW_EXT_blend_color = GL_FALSE;
-GLboolean __GLEW_EXT_blend_equation_separate = GL_FALSE;
-GLboolean __GLEW_EXT_blend_func_separate = GL_FALSE;
-GLboolean __GLEW_EXT_blend_logic_op = GL_FALSE;
-GLboolean __GLEW_EXT_blend_minmax = GL_FALSE;
-GLboolean __GLEW_EXT_blend_subtract = GL_FALSE;
-GLboolean __GLEW_EXT_clip_volume_hint = GL_FALSE;
-GLboolean __GLEW_EXT_cmyka = GL_FALSE;
-GLboolean __GLEW_EXT_color_subtable = GL_FALSE;
-GLboolean __GLEW_EXT_compiled_vertex_array = GL_FALSE;
-GLboolean __GLEW_EXT_convolution = GL_FALSE;
-GLboolean __GLEW_EXT_coordinate_frame = GL_FALSE;
-GLboolean __GLEW_EXT_copy_texture = GL_FALSE;
-GLboolean __GLEW_EXT_cull_vertex = GL_FALSE;
-GLboolean __GLEW_EXT_debug_label = GL_FALSE;
-GLboolean __GLEW_EXT_debug_marker = GL_FALSE;
-GLboolean __GLEW_EXT_depth_bounds_test = GL_FALSE;
-GLboolean __GLEW_EXT_direct_state_access = GL_FALSE;
-GLboolean __GLEW_EXT_draw_buffers2 = GL_FALSE;
-GLboolean __GLEW_EXT_draw_instanced = GL_FALSE;
-GLboolean __GLEW_EXT_draw_range_elements = GL_FALSE;
-GLboolean __GLEW_EXT_fog_coord = GL_FALSE;
-GLboolean __GLEW_EXT_fragment_lighting = GL_FALSE;
-GLboolean __GLEW_EXT_framebuffer_blit = GL_FALSE;
-GLboolean __GLEW_EXT_framebuffer_multisample = GL_FALSE;
-GLboolean __GLEW_EXT_framebuffer_multisample_blit_scaled = GL_FALSE;
-GLboolean __GLEW_EXT_framebuffer_object = GL_FALSE;
-GLboolean __GLEW_EXT_framebuffer_sRGB = GL_FALSE;
-GLboolean __GLEW_EXT_geometry_shader4 = GL_FALSE;
-GLboolean __GLEW_EXT_gpu_program_parameters = GL_FALSE;
-GLboolean __GLEW_EXT_gpu_shader4 = GL_FALSE;
-GLboolean __GLEW_EXT_histogram = GL_FALSE;
-GLboolean __GLEW_EXT_index_array_formats = GL_FALSE;
-GLboolean __GLEW_EXT_index_func = GL_FALSE;
-GLboolean __GLEW_EXT_index_material = GL_FALSE;
-GLboolean __GLEW_EXT_index_texture = GL_FALSE;
-GLboolean __GLEW_EXT_light_texture = GL_FALSE;
-GLboolean __GLEW_EXT_misc_attribute = GL_FALSE;
-GLboolean __GLEW_EXT_multi_draw_arrays = GL_FALSE;
-GLboolean __GLEW_EXT_multisample = GL_FALSE;
-GLboolean __GLEW_EXT_packed_depth_stencil = GL_FALSE;
-GLboolean __GLEW_EXT_packed_float = GL_FALSE;
-GLboolean __GLEW_EXT_packed_pixels = GL_FALSE;
-GLboolean __GLEW_EXT_paletted_texture = GL_FALSE;
-GLboolean __GLEW_EXT_pixel_buffer_object = GL_FALSE;
-GLboolean __GLEW_EXT_pixel_transform = GL_FALSE;
-GLboolean __GLEW_EXT_pixel_transform_color_table = GL_FALSE;
-GLboolean __GLEW_EXT_point_parameters = GL_FALSE;
-GLboolean __GLEW_EXT_polygon_offset = GL_FALSE;
-GLboolean __GLEW_EXT_polygon_offset_clamp = GL_FALSE;
-GLboolean __GLEW_EXT_post_depth_coverage = GL_FALSE;
-GLboolean __GLEW_EXT_provoking_vertex = GL_FALSE;
-GLboolean __GLEW_EXT_raster_multisample = GL_FALSE;
-GLboolean __GLEW_EXT_rescale_normal = GL_FALSE;
-GLboolean __GLEW_EXT_scene_marker = GL_FALSE;
-GLboolean __GLEW_EXT_secondary_color = GL_FALSE;
-GLboolean __GLEW_EXT_separate_shader_objects = GL_FALSE;
-GLboolean __GLEW_EXT_separate_specular_color = GL_FALSE;
-GLboolean __GLEW_EXT_shader_image_load_formatted = GL_FALSE;
-GLboolean __GLEW_EXT_shader_image_load_store = GL_FALSE;
-GLboolean __GLEW_EXT_shader_integer_mix = GL_FALSE;
-GLboolean __GLEW_EXT_shadow_funcs = GL_FALSE;
-GLboolean __GLEW_EXT_shared_texture_palette = GL_FALSE;
-GLboolean __GLEW_EXT_sparse_texture2 = GL_FALSE;
-GLboolean __GLEW_EXT_stencil_clear_tag = GL_FALSE;
-GLboolean __GLEW_EXT_stencil_two_side = GL_FALSE;
-GLboolean __GLEW_EXT_stencil_wrap = GL_FALSE;
-GLboolean __GLEW_EXT_subtexture = GL_FALSE;
-GLboolean __GLEW_EXT_texture = GL_FALSE;
-GLboolean __GLEW_EXT_texture3D = GL_FALSE;
-GLboolean __GLEW_EXT_texture_array = GL_FALSE;
-GLboolean __GLEW_EXT_texture_buffer_object = GL_FALSE;
-GLboolean __GLEW_EXT_texture_compression_dxt1 = GL_FALSE;
-GLboolean __GLEW_EXT_texture_compression_latc = GL_FALSE;
-GLboolean __GLEW_EXT_texture_compression_rgtc = GL_FALSE;
-GLboolean __GLEW_EXT_texture_compression_s3tc = GL_FALSE;
-GLboolean __GLEW_EXT_texture_cube_map = GL_FALSE;
-GLboolean __GLEW_EXT_texture_edge_clamp = GL_FALSE;
-GLboolean __GLEW_EXT_texture_env = GL_FALSE;
-GLboolean __GLEW_EXT_texture_env_add = GL_FALSE;
-GLboolean __GLEW_EXT_texture_env_combine = GL_FALSE;
-GLboolean __GLEW_EXT_texture_env_dot3 = GL_FALSE;
-GLboolean __GLEW_EXT_texture_filter_anisotropic = GL_FALSE;
-GLboolean __GLEW_EXT_texture_filter_minmax = GL_FALSE;
-GLboolean __GLEW_EXT_texture_integer = GL_FALSE;
-GLboolean __GLEW_EXT_texture_lod_bias = GL_FALSE;
-GLboolean __GLEW_EXT_texture_mirror_clamp = GL_FALSE;
-GLboolean __GLEW_EXT_texture_object = GL_FALSE;
-GLboolean __GLEW_EXT_texture_perturb_normal = GL_FALSE;
-GLboolean __GLEW_EXT_texture_rectangle = GL_FALSE;
-GLboolean __GLEW_EXT_texture_sRGB = GL_FALSE;
-GLboolean __GLEW_EXT_texture_sRGB_decode = GL_FALSE;
-GLboolean __GLEW_EXT_texture_shared_exponent = GL_FALSE;
-GLboolean __GLEW_EXT_texture_snorm = GL_FALSE;
-GLboolean __GLEW_EXT_texture_swizzle = GL_FALSE;
-GLboolean __GLEW_EXT_timer_query = GL_FALSE;
-GLboolean __GLEW_EXT_transform_feedback = GL_FALSE;
-GLboolean __GLEW_EXT_vertex_array = GL_FALSE;
-GLboolean __GLEW_EXT_vertex_array_bgra = GL_FALSE;
-GLboolean __GLEW_EXT_vertex_attrib_64bit = GL_FALSE;
-GLboolean __GLEW_EXT_vertex_shader = GL_FALSE;
-GLboolean __GLEW_EXT_vertex_weighting = GL_FALSE;
-GLboolean __GLEW_EXT_x11_sync_object = GL_FALSE;
-GLboolean __GLEW_GREMEDY_frame_terminator = GL_FALSE;
-GLboolean __GLEW_GREMEDY_string_marker = GL_FALSE;
-GLboolean __GLEW_HP_convolution_border_modes = GL_FALSE;
-GLboolean __GLEW_HP_image_transform = GL_FALSE;
-GLboolean __GLEW_HP_occlusion_test = GL_FALSE;
-GLboolean __GLEW_HP_texture_lighting = GL_FALSE;
-GLboolean __GLEW_IBM_cull_vertex = GL_FALSE;
-GLboolean __GLEW_IBM_multimode_draw_arrays = GL_FALSE;
-GLboolean __GLEW_IBM_rasterpos_clip = GL_FALSE;
-GLboolean __GLEW_IBM_static_data = GL_FALSE;
-GLboolean __GLEW_IBM_texture_mirrored_repeat = GL_FALSE;
-GLboolean __GLEW_IBM_vertex_array_lists = GL_FALSE;
-GLboolean __GLEW_INGR_color_clamp = GL_FALSE;
-GLboolean __GLEW_INGR_interlace_read = GL_FALSE;
-GLboolean __GLEW_INTEL_fragment_shader_ordering = GL_FALSE;
-GLboolean __GLEW_INTEL_map_texture = GL_FALSE;
-GLboolean __GLEW_INTEL_parallel_arrays = GL_FALSE;
-GLboolean __GLEW_INTEL_performance_query = GL_FALSE;
-GLboolean __GLEW_INTEL_texture_scissor = GL_FALSE;
-GLboolean __GLEW_KHR_blend_equation_advanced = GL_FALSE;
-GLboolean __GLEW_KHR_blend_equation_advanced_coherent = GL_FALSE;
-GLboolean __GLEW_KHR_context_flush_control = GL_FALSE;
-GLboolean __GLEW_KHR_debug = GL_FALSE;
-GLboolean __GLEW_KHR_robust_buffer_access_behavior = GL_FALSE;
-GLboolean __GLEW_KHR_robustness = GL_FALSE;
-GLboolean __GLEW_KHR_texture_compression_astc_hdr = GL_FALSE;
-GLboolean __GLEW_KHR_texture_compression_astc_ldr = GL_FALSE;
-GLboolean __GLEW_KTX_buffer_region = GL_FALSE;
-GLboolean __GLEW_MESAX_texture_stack = GL_FALSE;
-GLboolean __GLEW_MESA_pack_invert = GL_FALSE;
-GLboolean __GLEW_MESA_resize_buffers = GL_FALSE;
-GLboolean __GLEW_MESA_window_pos = GL_FALSE;
-GLboolean __GLEW_MESA_ycbcr_texture = GL_FALSE;
-GLboolean __GLEW_NVX_conditional_render = GL_FALSE;
-GLboolean __GLEW_NVX_gpu_memory_info = GL_FALSE;
-GLboolean __GLEW_NV_bindless_multi_draw_indirect = GL_FALSE;
-GLboolean __GLEW_NV_bindless_multi_draw_indirect_count = GL_FALSE;
-GLboolean __GLEW_NV_bindless_texture = GL_FALSE;
-GLboolean __GLEW_NV_blend_equation_advanced = GL_FALSE;
-GLboolean __GLEW_NV_blend_equation_advanced_coherent = GL_FALSE;
-GLboolean __GLEW_NV_blend_square = GL_FALSE;
-GLboolean __GLEW_NV_compute_program5 = GL_FALSE;
-GLboolean __GLEW_NV_conditional_render = GL_FALSE;
-GLboolean __GLEW_NV_conservative_raster = GL_FALSE;
-GLboolean __GLEW_NV_copy_depth_to_color = GL_FALSE;
-GLboolean __GLEW_NV_copy_image = GL_FALSE;
-GLboolean __GLEW_NV_deep_texture3D = GL_FALSE;
-GLboolean __GLEW_NV_depth_buffer_float = GL_FALSE;
-GLboolean __GLEW_NV_depth_clamp = GL_FALSE;
-GLboolean __GLEW_NV_depth_range_unclamped = GL_FALSE;
-GLboolean __GLEW_NV_draw_texture = GL_FALSE;
-GLboolean __GLEW_NV_evaluators = GL_FALSE;
-GLboolean __GLEW_NV_explicit_multisample = GL_FALSE;
-GLboolean __GLEW_NV_fence = GL_FALSE;
-GLboolean __GLEW_NV_fill_rectangle = GL_FALSE;
-GLboolean __GLEW_NV_float_buffer = GL_FALSE;
-GLboolean __GLEW_NV_fog_distance = GL_FALSE;
-GLboolean __GLEW_NV_fragment_coverage_to_color = GL_FALSE;
-GLboolean __GLEW_NV_fragment_program = GL_FALSE;
-GLboolean __GLEW_NV_fragment_program2 = GL_FALSE;
-GLboolean __GLEW_NV_fragment_program4 = GL_FALSE;
-GLboolean __GLEW_NV_fragment_program_option = GL_FALSE;
-GLboolean __GLEW_NV_fragment_shader_interlock = GL_FALSE;
-GLboolean __GLEW_NV_framebuffer_mixed_samples = GL_FALSE;
-GLboolean __GLEW_NV_framebuffer_multisample_coverage = GL_FALSE;
-GLboolean __GLEW_NV_geometry_program4 = GL_FALSE;
-GLboolean __GLEW_NV_geometry_shader4 = GL_FALSE;
-GLboolean __GLEW_NV_geometry_shader_passthrough = GL_FALSE;
-GLboolean __GLEW_NV_gpu_program4 = GL_FALSE;
-GLboolean __GLEW_NV_gpu_program5 = GL_FALSE;
-GLboolean __GLEW_NV_gpu_program5_mem_extended = GL_FALSE;
-GLboolean __GLEW_NV_gpu_program_fp64 = GL_FALSE;
-GLboolean __GLEW_NV_gpu_shader5 = GL_FALSE;
-GLboolean __GLEW_NV_half_float = GL_FALSE;
-GLboolean __GLEW_NV_internalformat_sample_query = GL_FALSE;
-GLboolean __GLEW_NV_light_max_exponent = GL_FALSE;
-GLboolean __GLEW_NV_multisample_coverage = GL_FALSE;
-GLboolean __GLEW_NV_multisample_filter_hint = GL_FALSE;
-GLboolean __GLEW_NV_occlusion_query = GL_FALSE;
-GLboolean __GLEW_NV_packed_depth_stencil = GL_FALSE;
-GLboolean __GLEW_NV_parameter_buffer_object = GL_FALSE;
-GLboolean __GLEW_NV_parameter_buffer_object2 = GL_FALSE;
-GLboolean __GLEW_NV_path_rendering = GL_FALSE;
-GLboolean __GLEW_NV_path_rendering_shared_edge = GL_FALSE;
-GLboolean __GLEW_NV_pixel_data_range = GL_FALSE;
-GLboolean __GLEW_NV_point_sprite = GL_FALSE;
-GLboolean __GLEW_NV_present_video = GL_FALSE;
-GLboolean __GLEW_NV_primitive_restart = GL_FALSE;
-GLboolean __GLEW_NV_register_combiners = GL_FALSE;
-GLboolean __GLEW_NV_register_combiners2 = GL_FALSE;
-GLboolean __GLEW_NV_sample_locations = GL_FALSE;
-GLboolean __GLEW_NV_sample_mask_override_coverage = GL_FALSE;
-GLboolean __GLEW_NV_shader_atomic_counters = GL_FALSE;
-GLboolean __GLEW_NV_shader_atomic_float = GL_FALSE;
-GLboolean __GLEW_NV_shader_atomic_fp16_vector = GL_FALSE;
-GLboolean __GLEW_NV_shader_atomic_int64 = GL_FALSE;
-GLboolean __GLEW_NV_shader_buffer_load = GL_FALSE;
-GLboolean __GLEW_NV_shader_storage_buffer_object = GL_FALSE;
-GLboolean __GLEW_NV_shader_thread_group = GL_FALSE;
-GLboolean __GLEW_NV_shader_thread_shuffle = GL_FALSE;
-GLboolean __GLEW_NV_tessellation_program5 = GL_FALSE;
-GLboolean __GLEW_NV_texgen_emboss = GL_FALSE;
-GLboolean __GLEW_NV_texgen_reflection = GL_FALSE;
-GLboolean __GLEW_NV_texture_barrier = GL_FALSE;
-GLboolean __GLEW_NV_texture_compression_vtc = GL_FALSE;
-GLboolean __GLEW_NV_texture_env_combine4 = GL_FALSE;
-GLboolean __GLEW_NV_texture_expand_normal = GL_FALSE;
-GLboolean __GLEW_NV_texture_multisample = GL_FALSE;
-GLboolean __GLEW_NV_texture_rectangle = GL_FALSE;
-GLboolean __GLEW_NV_texture_shader = GL_FALSE;
-GLboolean __GLEW_NV_texture_shader2 = GL_FALSE;
-GLboolean __GLEW_NV_texture_shader3 = GL_FALSE;
-GLboolean __GLEW_NV_transform_feedback = GL_FALSE;
-GLboolean __GLEW_NV_transform_feedback2 = GL_FALSE;
-GLboolean __GLEW_NV_uniform_buffer_unified_memory = GL_FALSE;
-GLboolean __GLEW_NV_vdpau_interop = GL_FALSE;
-GLboolean __GLEW_NV_vertex_array_range = GL_FALSE;
-GLboolean __GLEW_NV_vertex_array_range2 = GL_FALSE;
-GLboolean __GLEW_NV_vertex_attrib_integer_64bit = GL_FALSE;
-GLboolean __GLEW_NV_vertex_buffer_unified_memory = GL_FALSE;
-GLboolean __GLEW_NV_vertex_program = GL_FALSE;
-GLboolean __GLEW_NV_vertex_program1_1 = GL_FALSE;
-GLboolean __GLEW_NV_vertex_program2 = GL_FALSE;
-GLboolean __GLEW_NV_vertex_program2_option = GL_FALSE;
-GLboolean __GLEW_NV_vertex_program3 = GL_FALSE;
-GLboolean __GLEW_NV_vertex_program4 = GL_FALSE;
-GLboolean __GLEW_NV_video_capture = GL_FALSE;
-GLboolean __GLEW_OES_byte_coordinates = GL_FALSE;
-GLboolean __GLEW_OES_compressed_paletted_texture = GL_FALSE;
-GLboolean __GLEW_OES_read_format = GL_FALSE;
-GLboolean __GLEW_OES_single_precision = GL_FALSE;
-GLboolean __GLEW_OML_interlace = GL_FALSE;
-GLboolean __GLEW_OML_resample = GL_FALSE;
-GLboolean __GLEW_OML_subsample = GL_FALSE;
-GLboolean __GLEW_PGI_misc_hints = GL_FALSE;
-GLboolean __GLEW_PGI_vertex_hints = GL_FALSE;
-GLboolean __GLEW_REGAL_ES1_0_compatibility = GL_FALSE;
-GLboolean __GLEW_REGAL_ES1_1_compatibility = GL_FALSE;
-GLboolean __GLEW_REGAL_enable = GL_FALSE;
-GLboolean __GLEW_REGAL_error_string = GL_FALSE;
-GLboolean __GLEW_REGAL_extension_query = GL_FALSE;
-GLboolean __GLEW_REGAL_log = GL_FALSE;
-GLboolean __GLEW_REGAL_proc_address = GL_FALSE;
-GLboolean __GLEW_REND_screen_coordinates = GL_FALSE;
-GLboolean __GLEW_S3_s3tc = GL_FALSE;
-GLboolean __GLEW_SGIS_color_range = GL_FALSE;
-GLboolean __GLEW_SGIS_detail_texture = GL_FALSE;
-GLboolean __GLEW_SGIS_fog_function = GL_FALSE;
-GLboolean __GLEW_SGIS_generate_mipmap = GL_FALSE;
-GLboolean __GLEW_SGIS_multisample = GL_FALSE;
-GLboolean __GLEW_SGIS_pixel_texture = GL_FALSE;
-GLboolean __GLEW_SGIS_point_line_texgen = GL_FALSE;
-GLboolean __GLEW_SGIS_sharpen_texture = GL_FALSE;
-GLboolean __GLEW_SGIS_texture4D = GL_FALSE;
-GLboolean __GLEW_SGIS_texture_border_clamp = GL_FALSE;
-GLboolean __GLEW_SGIS_texture_edge_clamp = GL_FALSE;
-GLboolean __GLEW_SGIS_texture_filter4 = GL_FALSE;
-GLboolean __GLEW_SGIS_texture_lod = GL_FALSE;
-GLboolean __GLEW_SGIS_texture_select = GL_FALSE;
-GLboolean __GLEW_SGIX_async = GL_FALSE;
-GLboolean __GLEW_SGIX_async_histogram = GL_FALSE;
-GLboolean __GLEW_SGIX_async_pixel = GL_FALSE;
-GLboolean __GLEW_SGIX_blend_alpha_minmax = GL_FALSE;
-GLboolean __GLEW_SGIX_clipmap = GL_FALSE;
-GLboolean __GLEW_SGIX_convolution_accuracy = GL_FALSE;
-GLboolean __GLEW_SGIX_depth_texture = GL_FALSE;
-GLboolean __GLEW_SGIX_flush_raster = GL_FALSE;
-GLboolean __GLEW_SGIX_fog_offset = GL_FALSE;
-GLboolean __GLEW_SGIX_fog_texture = GL_FALSE;
-GLboolean __GLEW_SGIX_fragment_specular_lighting = GL_FALSE;
-GLboolean __GLEW_SGIX_framezoom = GL_FALSE;
-GLboolean __GLEW_SGIX_interlace = GL_FALSE;
-GLboolean __GLEW_SGIX_ir_instrument1 = GL_FALSE;
-GLboolean __GLEW_SGIX_list_priority = GL_FALSE;
-GLboolean __GLEW_SGIX_pixel_texture = GL_FALSE;
-GLboolean __GLEW_SGIX_pixel_texture_bits = GL_FALSE;
-GLboolean __GLEW_SGIX_reference_plane = GL_FALSE;
-GLboolean __GLEW_SGIX_resample = GL_FALSE;
-GLboolean __GLEW_SGIX_shadow = GL_FALSE;
-GLboolean __GLEW_SGIX_shadow_ambient = GL_FALSE;
-GLboolean __GLEW_SGIX_sprite = GL_FALSE;
-GLboolean __GLEW_SGIX_tag_sample_buffer = GL_FALSE;
-GLboolean __GLEW_SGIX_texture_add_env = GL_FALSE;
-GLboolean __GLEW_SGIX_texture_coordinate_clamp = GL_FALSE;
-GLboolean __GLEW_SGIX_texture_lod_bias = GL_FALSE;
-GLboolean __GLEW_SGIX_texture_multi_buffer = GL_FALSE;
-GLboolean __GLEW_SGIX_texture_range = GL_FALSE;
-GLboolean __GLEW_SGIX_texture_scale_bias = GL_FALSE;
-GLboolean __GLEW_SGIX_vertex_preclip = GL_FALSE;
-GLboolean __GLEW_SGIX_vertex_preclip_hint = GL_FALSE;
-GLboolean __GLEW_SGIX_ycrcb = GL_FALSE;
-GLboolean __GLEW_SGI_color_matrix = GL_FALSE;
-GLboolean __GLEW_SGI_color_table = GL_FALSE;
-GLboolean __GLEW_SGI_texture_color_table = GL_FALSE;
-GLboolean __GLEW_SUNX_constant_data = GL_FALSE;
-GLboolean __GLEW_SUN_convolution_border_modes = GL_FALSE;
-GLboolean __GLEW_SUN_global_alpha = GL_FALSE;
-GLboolean __GLEW_SUN_mesh_array = GL_FALSE;
-GLboolean __GLEW_SUN_read_video_pixels = GL_FALSE;
-GLboolean __GLEW_SUN_slice_accum = GL_FALSE;
-GLboolean __GLEW_SUN_triangle_list = GL_FALSE;
-GLboolean __GLEW_SUN_vertex = GL_FALSE;
-GLboolean __GLEW_WIN_phong_shading = GL_FALSE;
-GLboolean __GLEW_WIN_specular_fog = GL_FALSE;
-GLboolean __GLEW_WIN_swap_hint = GL_FALSE;
-
-#endif /* !GLEW_MX */
-
-#ifdef GL_VERSION_1_2
-
-static GLboolean _glewInit_GL_VERSION_1_2 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage3D")) == NULL) || r;
- r = ((glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElements")) == NULL) || r;
- r = ((glTexImage3D = (PFNGLTEXIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTexImage3D")) == NULL) || r;
- r = ((glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage3D")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_VERSION_1_2 */
-
-#ifdef GL_VERSION_1_2_1
-
-#endif /* GL_VERSION_1_2_1 */
-
-#ifdef GL_VERSION_1_3
-
-static GLboolean _glewInit_GL_VERSION_1_3 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glActiveTexture = (PFNGLACTIVETEXTUREPROC)glewGetProcAddress((const GLubyte*)"glActiveTexture")) == NULL) || r;
- r = ((glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)glewGetProcAddress((const GLubyte*)"glClientActiveTexture")) == NULL) || r;
- r = ((glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage1D")) == NULL) || r;
- r = ((glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage2D")) == NULL) || r;
- r = ((glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage3D")) == NULL) || r;
- r = ((glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage1D")) == NULL) || r;
- r = ((glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage2D")) == NULL) || r;
- r = ((glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage3D")) == NULL) || r;
- r = ((glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTexImage")) == NULL) || r;
- r = ((glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixd")) == NULL) || r;
- r = ((glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixf")) == NULL) || r;
- r = ((glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixd")) == NULL) || r;
- r = ((glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixf")) == NULL) || r;
- r = ((glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1d")) == NULL) || r;
- r = ((glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1dv")) == NULL) || r;
- r = ((glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1f")) == NULL) || r;
- r = ((glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1fv")) == NULL) || r;
- r = ((glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1i")) == NULL) || r;
- r = ((glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1iv")) == NULL) || r;
- r = ((glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1s")) == NULL) || r;
- r = ((glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1sv")) == NULL) || r;
- r = ((glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2d")) == NULL) || r;
- r = ((glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2dv")) == NULL) || r;
- r = ((glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2f")) == NULL) || r;
- r = ((glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2fv")) == NULL) || r;
- r = ((glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2i")) == NULL) || r;
- r = ((glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2iv")) == NULL) || r;
- r = ((glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2s")) == NULL) || r;
- r = ((glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2sv")) == NULL) || r;
- r = ((glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3d")) == NULL) || r;
- r = ((glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3dv")) == NULL) || r;
- r = ((glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3f")) == NULL) || r;
- r = ((glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3fv")) == NULL) || r;
- r = ((glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3i")) == NULL) || r;
- r = ((glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3iv")) == NULL) || r;
- r = ((glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3s")) == NULL) || r;
- r = ((glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3sv")) == NULL) || r;
- r = ((glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4d")) == NULL) || r;
- r = ((glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4dv")) == NULL) || r;
- r = ((glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4f")) == NULL) || r;
- r = ((glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4fv")) == NULL) || r;
- r = ((glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4i")) == NULL) || r;
- r = ((glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4iv")) == NULL) || r;
- r = ((glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4s")) == NULL) || r;
- r = ((glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4sv")) == NULL) || r;
- r = ((glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)glewGetProcAddress((const GLubyte*)"glSampleCoverage")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_VERSION_1_3 */
-
-#ifdef GL_VERSION_1_4
-
-static GLboolean _glewInit_GL_VERSION_1_4 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlendColor = (PFNGLBLENDCOLORPROC)glewGetProcAddress((const GLubyte*)"glBlendColor")) == NULL) || r;
- r = ((glBlendEquation = (PFNGLBLENDEQUATIONPROC)glewGetProcAddress((const GLubyte*)"glBlendEquation")) == NULL) || r;
- r = ((glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparate")) == NULL) || r;
- r = ((glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)glewGetProcAddress((const GLubyte*)"glFogCoordPointer")) == NULL) || r;
- r = ((glFogCoordd = (PFNGLFOGCOORDDPROC)glewGetProcAddress((const GLubyte*)"glFogCoordd")) == NULL) || r;
- r = ((glFogCoorddv = (PFNGLFOGCOORDDVPROC)glewGetProcAddress((const GLubyte*)"glFogCoorddv")) == NULL) || r;
- r = ((glFogCoordf = (PFNGLFOGCOORDFPROC)glewGetProcAddress((const GLubyte*)"glFogCoordf")) == NULL) || r;
- r = ((glFogCoordfv = (PFNGLFOGCOORDFVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordfv")) == NULL) || r;
- r = ((glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArrays")) == NULL) || r;
- r = ((glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElements")) == NULL) || r;
- r = ((glPointParameterf = (PFNGLPOINTPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glPointParameterf")) == NULL) || r;
- r = ((glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfv")) == NULL) || r;
- r = ((glPointParameteri = (PFNGLPOINTPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glPointParameteri")) == NULL) || r;
- r = ((glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glPointParameteriv")) == NULL) || r;
- r = ((glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3b")) == NULL) || r;
- r = ((glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3bv")) == NULL) || r;
- r = ((glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3d")) == NULL) || r;
- r = ((glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3dv")) == NULL) || r;
- r = ((glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3f")) == NULL) || r;
- r = ((glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3fv")) == NULL) || r;
- r = ((glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3i")) == NULL) || r;
- r = ((glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3iv")) == NULL) || r;
- r = ((glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3s")) == NULL) || r;
- r = ((glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3sv")) == NULL) || r;
- r = ((glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ub")) == NULL) || r;
- r = ((glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ubv")) == NULL) || r;
- r = ((glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ui")) == NULL) || r;
- r = ((glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3uiv")) == NULL) || r;
- r = ((glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3us")) == NULL) || r;
- r = ((glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3usv")) == NULL) || r;
- r = ((glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorPointer")) == NULL) || r;
- r = ((glWindowPos2d = (PFNGLWINDOWPOS2DPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2d")) == NULL) || r;
- r = ((glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dv")) == NULL) || r;
- r = ((glWindowPos2f = (PFNGLWINDOWPOS2FPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2f")) == NULL) || r;
- r = ((glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fv")) == NULL) || r;
- r = ((glWindowPos2i = (PFNGLWINDOWPOS2IPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2i")) == NULL) || r;
- r = ((glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2iv")) == NULL) || r;
- r = ((glWindowPos2s = (PFNGLWINDOWPOS2SPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2s")) == NULL) || r;
- r = ((glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2sv")) == NULL) || r;
- r = ((glWindowPos3d = (PFNGLWINDOWPOS3DPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3d")) == NULL) || r;
- r = ((glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dv")) == NULL) || r;
- r = ((glWindowPos3f = (PFNGLWINDOWPOS3FPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3f")) == NULL) || r;
- r = ((glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fv")) == NULL) || r;
- r = ((glWindowPos3i = (PFNGLWINDOWPOS3IPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3i")) == NULL) || r;
- r = ((glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3iv")) == NULL) || r;
- r = ((glWindowPos3s = (PFNGLWINDOWPOS3SPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3s")) == NULL) || r;
- r = ((glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3sv")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_VERSION_1_4 */
-
-#ifdef GL_VERSION_1_5
-
-static GLboolean _glewInit_GL_VERSION_1_5 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginQuery = (PFNGLBEGINQUERYPROC)glewGetProcAddress((const GLubyte*)"glBeginQuery")) == NULL) || r;
- r = ((glBindBuffer = (PFNGLBINDBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindBuffer")) == NULL) || r;
- r = ((glBufferData = (PFNGLBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glBufferData")) == NULL) || r;
- r = ((glBufferSubData = (PFNGLBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glBufferSubData")) == NULL) || r;
- r = ((glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteBuffers")) == NULL) || r;
- r = ((glDeleteQueries = (PFNGLDELETEQUERIESPROC)glewGetProcAddress((const GLubyte*)"glDeleteQueries")) == NULL) || r;
- r = ((glEndQuery = (PFNGLENDQUERYPROC)glewGetProcAddress((const GLubyte*)"glEndQuery")) == NULL) || r;
- r = ((glGenBuffers = (PFNGLGENBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glGenBuffers")) == NULL) || r;
- r = ((glGenQueries = (PFNGLGENQUERIESPROC)glewGetProcAddress((const GLubyte*)"glGenQueries")) == NULL) || r;
- r = ((glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameteriv")) == NULL) || r;
- r = ((glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)glewGetProcAddress((const GLubyte*)"glGetBufferPointerv")) == NULL) || r;
- r = ((glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glGetBufferSubData")) == NULL) || r;
- r = ((glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectiv")) == NULL) || r;
- r = ((glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectuiv")) == NULL) || r;
- r = ((glGetQueryiv = (PFNGLGETQUERYIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryiv")) == NULL) || r;
- r = ((glIsBuffer = (PFNGLISBUFFERPROC)glewGetProcAddress((const GLubyte*)"glIsBuffer")) == NULL) || r;
- r = ((glIsQuery = (PFNGLISQUERYPROC)glewGetProcAddress((const GLubyte*)"glIsQuery")) == NULL) || r;
- r = ((glMapBuffer = (PFNGLMAPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glMapBuffer")) == NULL) || r;
- r = ((glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glUnmapBuffer")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_VERSION_1_5 */
-
-#ifdef GL_VERSION_2_0
-
-static GLboolean _glewInit_GL_VERSION_2_0 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glAttachShader = (PFNGLATTACHSHADERPROC)glewGetProcAddress((const GLubyte*)"glAttachShader")) == NULL) || r;
- r = ((glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glBindAttribLocation")) == NULL) || r;
- r = ((glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparate")) == NULL) || r;
- r = ((glCompileShader = (PFNGLCOMPILESHADERPROC)glewGetProcAddress((const GLubyte*)"glCompileShader")) == NULL) || r;
- r = ((glCreateProgram = (PFNGLCREATEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glCreateProgram")) == NULL) || r;
- r = ((glCreateShader = (PFNGLCREATESHADERPROC)glewGetProcAddress((const GLubyte*)"glCreateShader")) == NULL) || r;
- r = ((glDeleteProgram = (PFNGLDELETEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgram")) == NULL) || r;
- r = ((glDeleteShader = (PFNGLDELETESHADERPROC)glewGetProcAddress((const GLubyte*)"glDeleteShader")) == NULL) || r;
- r = ((glDetachShader = (PFNGLDETACHSHADERPROC)glewGetProcAddress((const GLubyte*)"glDetachShader")) == NULL) || r;
- r = ((glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexAttribArray")) == NULL) || r;
- r = ((glDrawBuffers = (PFNGLDRAWBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffers")) == NULL) || r;
- r = ((glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexAttribArray")) == NULL) || r;
- r = ((glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)glewGetProcAddress((const GLubyte*)"glGetActiveAttrib")) == NULL) || r;
- r = ((glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniform")) == NULL) || r;
- r = ((glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)glewGetProcAddress((const GLubyte*)"glGetAttachedShaders")) == NULL) || r;
- r = ((glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetAttribLocation")) == NULL) || r;
- r = ((glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)glewGetProcAddress((const GLubyte*)"glGetProgramInfoLog")) == NULL) || r;
- r = ((glGetProgramiv = (PFNGLGETPROGRAMIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramiv")) == NULL) || r;
- r = ((glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)glewGetProcAddress((const GLubyte*)"glGetShaderInfoLog")) == NULL) || r;
- r = ((glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)glewGetProcAddress((const GLubyte*)"glGetShaderSource")) == NULL) || r;
- r = ((glGetShaderiv = (PFNGLGETSHADERIVPROC)glewGetProcAddress((const GLubyte*)"glGetShaderiv")) == NULL) || r;
- r = ((glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetUniformLocation")) == NULL) || r;
- r = ((glGetUniformfv = (PFNGLGETUNIFORMFVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformfv")) == NULL) || r;
- r = ((glGetUniformiv = (PFNGLGETUNIFORMIVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformiv")) == NULL) || r;
- r = ((glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribPointerv")) == NULL) || r;
- r = ((glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribdv")) == NULL) || r;
- r = ((glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribfv")) == NULL) || r;
- r = ((glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribiv")) == NULL) || r;
- r = ((glIsProgram = (PFNGLISPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glIsProgram")) == NULL) || r;
- r = ((glIsShader = (PFNGLISSHADERPROC)glewGetProcAddress((const GLubyte*)"glIsShader")) == NULL) || r;
- r = ((glLinkProgram = (PFNGLLINKPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glLinkProgram")) == NULL) || r;
- r = ((glShaderSource = (PFNGLSHADERSOURCEPROC)glewGetProcAddress((const GLubyte*)"glShaderSource")) == NULL) || r;
- r = ((glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glStencilFuncSeparate")) == NULL) || r;
- r = ((glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glStencilMaskSeparate")) == NULL) || r;
- r = ((glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glStencilOpSeparate")) == NULL) || r;
- r = ((glUniform1f = (PFNGLUNIFORM1FPROC)glewGetProcAddress((const GLubyte*)"glUniform1f")) == NULL) || r;
- r = ((glUniform1fv = (PFNGLUNIFORM1FVPROC)glewGetProcAddress((const GLubyte*)"glUniform1fv")) == NULL) || r;
- r = ((glUniform1i = (PFNGLUNIFORM1IPROC)glewGetProcAddress((const GLubyte*)"glUniform1i")) == NULL) || r;
- r = ((glUniform1iv = (PFNGLUNIFORM1IVPROC)glewGetProcAddress((const GLubyte*)"glUniform1iv")) == NULL) || r;
- r = ((glUniform2f = (PFNGLUNIFORM2FPROC)glewGetProcAddress((const GLubyte*)"glUniform2f")) == NULL) || r;
- r = ((glUniform2fv = (PFNGLUNIFORM2FVPROC)glewGetProcAddress((const GLubyte*)"glUniform2fv")) == NULL) || r;
- r = ((glUniform2i = (PFNGLUNIFORM2IPROC)glewGetProcAddress((const GLubyte*)"glUniform2i")) == NULL) || r;
- r = ((glUniform2iv = (PFNGLUNIFORM2IVPROC)glewGetProcAddress((const GLubyte*)"glUniform2iv")) == NULL) || r;
- r = ((glUniform3f = (PFNGLUNIFORM3FPROC)glewGetProcAddress((const GLubyte*)"glUniform3f")) == NULL) || r;
- r = ((glUniform3fv = (PFNGLUNIFORM3FVPROC)glewGetProcAddress((const GLubyte*)"glUniform3fv")) == NULL) || r;
- r = ((glUniform3i = (PFNGLUNIFORM3IPROC)glewGetProcAddress((const GLubyte*)"glUniform3i")) == NULL) || r;
- r = ((glUniform3iv = (PFNGLUNIFORM3IVPROC)glewGetProcAddress((const GLubyte*)"glUniform3iv")) == NULL) || r;
- r = ((glUniform4f = (PFNGLUNIFORM4FPROC)glewGetProcAddress((const GLubyte*)"glUniform4f")) == NULL) || r;
- r = ((glUniform4fv = (PFNGLUNIFORM4FVPROC)glewGetProcAddress((const GLubyte*)"glUniform4fv")) == NULL) || r;
- r = ((glUniform4i = (PFNGLUNIFORM4IPROC)glewGetProcAddress((const GLubyte*)"glUniform4i")) == NULL) || r;
- r = ((glUniform4iv = (PFNGLUNIFORM4IVPROC)glewGetProcAddress((const GLubyte*)"glUniform4iv")) == NULL) || r;
- r = ((glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2fv")) == NULL) || r;
- r = ((glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3fv")) == NULL) || r;
- r = ((glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4fv")) == NULL) || r;
- r = ((glUseProgram = (PFNGLUSEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glUseProgram")) == NULL) || r;
- r = ((glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glValidateProgram")) == NULL) || r;
- r = ((glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1d")) == NULL) || r;
- r = ((glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dv")) == NULL) || r;
- r = ((glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1f")) == NULL) || r;
- r = ((glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fv")) == NULL) || r;
- r = ((glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1s")) == NULL) || r;
- r = ((glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1sv")) == NULL) || r;
- r = ((glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2d")) == NULL) || r;
- r = ((glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dv")) == NULL) || r;
- r = ((glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2f")) == NULL) || r;
- r = ((glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fv")) == NULL) || r;
- r = ((glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2s")) == NULL) || r;
- r = ((glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2sv")) == NULL) || r;
- r = ((glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3d")) == NULL) || r;
- r = ((glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dv")) == NULL) || r;
- r = ((glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3f")) == NULL) || r;
- r = ((glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fv")) == NULL) || r;
- r = ((glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3s")) == NULL) || r;
- r = ((glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3sv")) == NULL) || r;
- r = ((glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nbv")) == NULL) || r;
- r = ((glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Niv")) == NULL) || r;
- r = ((glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nsv")) == NULL) || r;
- r = ((glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nub")) == NULL) || r;
- r = ((glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nubv")) == NULL) || r;
- r = ((glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nuiv")) == NULL) || r;
- r = ((glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nusv")) == NULL) || r;
- r = ((glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4bv")) == NULL) || r;
- r = ((glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4d")) == NULL) || r;
- r = ((glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dv")) == NULL) || r;
- r = ((glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4f")) == NULL) || r;
- r = ((glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fv")) == NULL) || r;
- r = ((glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4iv")) == NULL) || r;
- r = ((glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4s")) == NULL) || r;
- r = ((glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4sv")) == NULL) || r;
- r = ((glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubv")) == NULL) || r;
- r = ((glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4uiv")) == NULL) || r;
- r = ((glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4usv")) == NULL) || r;
- r = ((glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointer")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_VERSION_2_0 */
-
-#ifdef GL_VERSION_2_1
-
-static GLboolean _glewInit_GL_VERSION_2_1 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2x3fv")) == NULL) || r;
- r = ((glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2x4fv")) == NULL) || r;
- r = ((glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3x2fv")) == NULL) || r;
- r = ((glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3x4fv")) == NULL) || r;
- r = ((glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4x2fv")) == NULL) || r;
- r = ((glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4x3fv")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_VERSION_2_1 */
-
-#ifdef GL_VERSION_3_0
-
-
-static GLboolean _glewInit_GL_ARB_framebuffer_object(GLEW_CONTEXT_ARG_DEF_INIT);
-static GLboolean _glewInit_GL_ARB_map_buffer_range(GLEW_CONTEXT_ARG_DEF_INIT);
-static GLboolean _glewInit_GL_ARB_uniform_buffer_object(GLEW_CONTEXT_ARG_DEF_INIT);
-static GLboolean _glewInit_GL_ARB_vertex_array_object(GLEW_CONTEXT_ARG_DEF_INIT);
-static GLboolean _glewInit_GL_VERSION_3_0 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)glewGetProcAddress((const GLubyte*)"glBeginConditionalRender")) == NULL) || r;
- r = ((glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glBeginTransformFeedback")) == NULL) || r;
- r = ((glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)glewGetProcAddress((const GLubyte*)"glBindFragDataLocation")) == NULL) || r;
- r = ((glClampColor = (PFNGLCLAMPCOLORPROC)glewGetProcAddress((const GLubyte*)"glClampColor")) == NULL) || r;
- r = ((glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)glewGetProcAddress((const GLubyte*)"glClearBufferfi")) == NULL) || r;
- r = ((glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)glewGetProcAddress((const GLubyte*)"glClearBufferfv")) == NULL) || r;
- r = ((glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)glewGetProcAddress((const GLubyte*)"glClearBufferiv")) == NULL) || r;
- r = ((glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)glewGetProcAddress((const GLubyte*)"glClearBufferuiv")) == NULL) || r;
- r = ((glColorMaski = (PFNGLCOLORMASKIPROC)glewGetProcAddress((const GLubyte*)"glColorMaski")) == NULL) || r;
- r = ((glDisablei = (PFNGLDISABLEIPROC)glewGetProcAddress((const GLubyte*)"glDisablei")) == NULL) || r;
- r = ((glEnablei = (PFNGLENABLEIPROC)glewGetProcAddress((const GLubyte*)"glEnablei")) == NULL) || r;
- r = ((glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)glewGetProcAddress((const GLubyte*)"glEndConditionalRender")) == NULL) || r;
- r = ((glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glEndTransformFeedback")) == NULL) || r;
- r = ((glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)glewGetProcAddress((const GLubyte*)"glGetBooleani_v")) == NULL) || r;
- r = ((glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetFragDataLocation")) == NULL) || r;
- r = ((glGetStringi = (PFNGLGETSTRINGIPROC)glewGetProcAddress((const GLubyte*)"glGetStringi")) == NULL) || r;
- r = ((glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIiv")) == NULL) || r;
- r = ((glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIuiv")) == NULL) || r;
- r = ((glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbackVarying")) == NULL) || r;
- r = ((glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformuiv")) == NULL) || r;
- r = ((glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribIiv")) == NULL) || r;
- r = ((glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribIuiv")) == NULL) || r;
- r = ((glIsEnabledi = (PFNGLISENABLEDIPROC)glewGetProcAddress((const GLubyte*)"glIsEnabledi")) == NULL) || r;
- r = ((glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glTexParameterIiv")) == NULL) || r;
- r = ((glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glTexParameterIuiv")) == NULL) || r;
- r = ((glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackVaryings")) == NULL) || r;
- r = ((glUniform1ui = (PFNGLUNIFORM1UIPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui")) == NULL) || r;
- r = ((glUniform1uiv = (PFNGLUNIFORM1UIVPROC)glewGetProcAddress((const GLubyte*)"glUniform1uiv")) == NULL) || r;
- r = ((glUniform2ui = (PFNGLUNIFORM2UIPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui")) == NULL) || r;
- r = ((glUniform2uiv = (PFNGLUNIFORM2UIVPROC)glewGetProcAddress((const GLubyte*)"glUniform2uiv")) == NULL) || r;
- r = ((glUniform3ui = (PFNGLUNIFORM3UIPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui")) == NULL) || r;
- r = ((glUniform3uiv = (PFNGLUNIFORM3UIVPROC)glewGetProcAddress((const GLubyte*)"glUniform3uiv")) == NULL) || r;
- r = ((glUniform4ui = (PFNGLUNIFORM4UIPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui")) == NULL) || r;
- r = ((glUniform4uiv = (PFNGLUNIFORM4UIVPROC)glewGetProcAddress((const GLubyte*)"glUniform4uiv")) == NULL) || r;
- r = ((glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1i")) == NULL) || r;
- r = ((glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1iv")) == NULL) || r;
- r = ((glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1ui")) == NULL) || r;
- r = ((glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1uiv")) == NULL) || r;
- r = ((glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2i")) == NULL) || r;
- r = ((glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2iv")) == NULL) || r;
- r = ((glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2ui")) == NULL) || r;
- r = ((glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2uiv")) == NULL) || r;
- r = ((glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3i")) == NULL) || r;
- r = ((glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3iv")) == NULL) || r;
- r = ((glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3ui")) == NULL) || r;
- r = ((glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3uiv")) == NULL) || r;
- r = ((glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4bv")) == NULL) || r;
- r = ((glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4i")) == NULL) || r;
- r = ((glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4iv")) == NULL) || r;
- r = ((glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4sv")) == NULL) || r;
- r = ((glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4ubv")) == NULL) || r;
- r = ((glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4ui")) == NULL) || r;
- r = ((glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4uiv")) == NULL) || r;
- r = ((glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4usv")) == NULL) || r;
- r = ((glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribIPointer")) == NULL) || r;
-
- r = _glewInit_GL_ARB_framebuffer_object(GLEW_CONTEXT_ARG_VAR_INIT) || r;
- r = _glewInit_GL_ARB_map_buffer_range(GLEW_CONTEXT_ARG_VAR_INIT) || r;
- r = _glewInit_GL_ARB_uniform_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT) || r;
- r = _glewInit_GL_ARB_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT) || r;
-
- return r;
-}
-
-#endif /* GL_VERSION_3_0 */
-
-#ifdef GL_VERSION_3_1
-
-
-static GLboolean _glewInit_GL_ARB_copy_buffer(GLEW_CONTEXT_ARG_DEF_INIT);
-static GLboolean _glewInit_GL_VERSION_3_1 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstanced")) == NULL) || r;
- r = ((glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstanced")) == NULL) || r;
- r = ((glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveRestartIndex")) == NULL) || r;
- r = ((glTexBuffer = (PFNGLTEXBUFFERPROC)glewGetProcAddress((const GLubyte*)"glTexBuffer")) == NULL) || r;
-
- r = _glewInit_GL_ARB_copy_buffer(GLEW_CONTEXT_ARG_VAR_INIT) || r;
-
- return r;
-}
-
-#endif /* GL_VERSION_3_1 */
-
-#ifdef GL_VERSION_3_2
-
-
-static GLboolean _glewInit_GL_ARB_draw_elements_base_vertex(GLEW_CONTEXT_ARG_DEF_INIT);
-static GLboolean _glewInit_GL_ARB_provoking_vertex(GLEW_CONTEXT_ARG_DEF_INIT);
-static GLboolean _glewInit_GL_ARB_sync(GLEW_CONTEXT_ARG_DEF_INIT);
-static GLboolean _glewInit_GL_ARB_texture_multisample(GLEW_CONTEXT_ARG_DEF_INIT);
-static GLboolean _glewInit_GL_VERSION_3_2 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture")) == NULL) || r;
- r = ((glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameteri64v")) == NULL) || r;
- r = ((glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)glewGetProcAddress((const GLubyte*)"glGetInteger64i_v")) == NULL) || r;
-
- r = _glewInit_GL_ARB_draw_elements_base_vertex(GLEW_CONTEXT_ARG_VAR_INIT) || r;
- r = _glewInit_GL_ARB_provoking_vertex(GLEW_CONTEXT_ARG_VAR_INIT) || r;
- r = _glewInit_GL_ARB_sync(GLEW_CONTEXT_ARG_VAR_INIT) || r;
- r = _glewInit_GL_ARB_texture_multisample(GLEW_CONTEXT_ARG_VAR_INIT) || r;
-
- return r;
-}
-
-#endif /* GL_VERSION_3_2 */
-
-#ifdef GL_VERSION_3_3
-
-static GLboolean _glewInit_GL_VERSION_3_3 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribDivisor")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_VERSION_3_3 */
-
-#ifdef GL_VERSION_4_0
-
-static GLboolean _glewInit_GL_VERSION_4_0 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlendEquationSeparatei = (PFNGLBLENDEQUATIONSEPARATEIPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparatei")) == NULL) || r;
- r = ((glBlendEquationi = (PFNGLBLENDEQUATIONIPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationi")) == NULL) || r;
- r = ((glBlendFuncSeparatei = (PFNGLBLENDFUNCSEPARATEIPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparatei")) == NULL) || r;
- r = ((glBlendFunci = (PFNGLBLENDFUNCIPROC)glewGetProcAddress((const GLubyte*)"glBlendFunci")) == NULL) || r;
- r = ((glMinSampleShading = (PFNGLMINSAMPLESHADINGPROC)glewGetProcAddress((const GLubyte*)"glMinSampleShading")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_VERSION_4_0 */
-
-#ifdef GL_VERSION_4_1
-
-#endif /* GL_VERSION_4_1 */
-
-#ifdef GL_VERSION_4_2
-
-#endif /* GL_VERSION_4_2 */
-
-#ifdef GL_VERSION_4_3
-
-#endif /* GL_VERSION_4_3 */
-
-#ifdef GL_VERSION_4_4
-
-#endif /* GL_VERSION_4_4 */
-
-#ifdef GL_VERSION_4_5
-
-#endif /* GL_VERSION_4_5 */
-
-#ifdef GL_3DFX_multisample
-
-#endif /* GL_3DFX_multisample */
-
-#ifdef GL_3DFX_tbuffer
-
-static GLboolean _glewInit_GL_3DFX_tbuffer (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTbufferMask3DFX = (PFNGLTBUFFERMASK3DFXPROC)glewGetProcAddress((const GLubyte*)"glTbufferMask3DFX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_3DFX_tbuffer */
-
-#ifdef GL_3DFX_texture_compression_FXT1
-
-#endif /* GL_3DFX_texture_compression_FXT1 */
-
-#ifdef GL_AMD_blend_minmax_factor
-
-#endif /* GL_AMD_blend_minmax_factor */
-
-#ifdef GL_AMD_conservative_depth
-
-#endif /* GL_AMD_conservative_depth */
-
-#ifdef GL_AMD_debug_output
-
-static GLboolean _glewInit_GL_AMD_debug_output (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDebugMessageCallbackAMD = (PFNGLDEBUGMESSAGECALLBACKAMDPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageCallbackAMD")) == NULL) || r;
- r = ((glDebugMessageEnableAMD = (PFNGLDEBUGMESSAGEENABLEAMDPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageEnableAMD")) == NULL) || r;
- r = ((glDebugMessageInsertAMD = (PFNGLDEBUGMESSAGEINSERTAMDPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageInsertAMD")) == NULL) || r;
- r = ((glGetDebugMessageLogAMD = (PFNGLGETDEBUGMESSAGELOGAMDPROC)glewGetProcAddress((const GLubyte*)"glGetDebugMessageLogAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_AMD_debug_output */
-
-#ifdef GL_AMD_depth_clamp_separate
-
-#endif /* GL_AMD_depth_clamp_separate */
-
-#ifdef GL_AMD_draw_buffers_blend
-
-static GLboolean _glewInit_GL_AMD_draw_buffers_blend (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlendEquationIndexedAMD = (PFNGLBLENDEQUATIONINDEXEDAMDPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationIndexedAMD")) == NULL) || r;
- r = ((glBlendEquationSeparateIndexedAMD = (PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparateIndexedAMD")) == NULL) || r;
- r = ((glBlendFuncIndexedAMD = (PFNGLBLENDFUNCINDEXEDAMDPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncIndexedAMD")) == NULL) || r;
- r = ((glBlendFuncSeparateIndexedAMD = (PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparateIndexedAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_AMD_draw_buffers_blend */
-
-#ifdef GL_AMD_gcn_shader
-
-#endif /* GL_AMD_gcn_shader */
-
-#ifdef GL_AMD_gpu_shader_int64
-
-#endif /* GL_AMD_gpu_shader_int64 */
-
-#ifdef GL_AMD_interleaved_elements
-
-static GLboolean _glewInit_GL_AMD_interleaved_elements (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glVertexAttribParameteriAMD = (PFNGLVERTEXATTRIBPARAMETERIAMDPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribParameteriAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_AMD_interleaved_elements */
-
-#ifdef GL_AMD_multi_draw_indirect
-
-static GLboolean _glewInit_GL_AMD_multi_draw_indirect (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glMultiDrawArraysIndirectAMD = (PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirectAMD")) == NULL) || r;
- r = ((glMultiDrawElementsIndirectAMD = (PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirectAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_AMD_multi_draw_indirect */
-
-#ifdef GL_AMD_name_gen_delete
-
-static GLboolean _glewInit_GL_AMD_name_gen_delete (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDeleteNamesAMD = (PFNGLDELETENAMESAMDPROC)glewGetProcAddress((const GLubyte*)"glDeleteNamesAMD")) == NULL) || r;
- r = ((glGenNamesAMD = (PFNGLGENNAMESAMDPROC)glewGetProcAddress((const GLubyte*)"glGenNamesAMD")) == NULL) || r;
- r = ((glIsNameAMD = (PFNGLISNAMEAMDPROC)glewGetProcAddress((const GLubyte*)"glIsNameAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_AMD_name_gen_delete */
-
-#ifdef GL_AMD_occlusion_query_event
-
-static GLboolean _glewInit_GL_AMD_occlusion_query_event (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glQueryObjectParameteruiAMD = (PFNGLQUERYOBJECTPARAMETERUIAMDPROC)glewGetProcAddress((const GLubyte*)"glQueryObjectParameteruiAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_AMD_occlusion_query_event */
-
-#ifdef GL_AMD_performance_monitor
-
-static GLboolean _glewInit_GL_AMD_performance_monitor (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginPerfMonitorAMD = (PFNGLBEGINPERFMONITORAMDPROC)glewGetProcAddress((const GLubyte*)"glBeginPerfMonitorAMD")) == NULL) || r;
- r = ((glDeletePerfMonitorsAMD = (PFNGLDELETEPERFMONITORSAMDPROC)glewGetProcAddress((const GLubyte*)"glDeletePerfMonitorsAMD")) == NULL) || r;
- r = ((glEndPerfMonitorAMD = (PFNGLENDPERFMONITORAMDPROC)glewGetProcAddress((const GLubyte*)"glEndPerfMonitorAMD")) == NULL) || r;
- r = ((glGenPerfMonitorsAMD = (PFNGLGENPERFMONITORSAMDPROC)glewGetProcAddress((const GLubyte*)"glGenPerfMonitorsAMD")) == NULL) || r;
- r = ((glGetPerfMonitorCounterDataAMD = (PFNGLGETPERFMONITORCOUNTERDATAAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorCounterDataAMD")) == NULL) || r;
- r = ((glGetPerfMonitorCounterInfoAMD = (PFNGLGETPERFMONITORCOUNTERINFOAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorCounterInfoAMD")) == NULL) || r;
- r = ((glGetPerfMonitorCounterStringAMD = (PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorCounterStringAMD")) == NULL) || r;
- r = ((glGetPerfMonitorCountersAMD = (PFNGLGETPERFMONITORCOUNTERSAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorCountersAMD")) == NULL) || r;
- r = ((glGetPerfMonitorGroupStringAMD = (PFNGLGETPERFMONITORGROUPSTRINGAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorGroupStringAMD")) == NULL) || r;
- r = ((glGetPerfMonitorGroupsAMD = (PFNGLGETPERFMONITORGROUPSAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorGroupsAMD")) == NULL) || r;
- r = ((glSelectPerfMonitorCountersAMD = (PFNGLSELECTPERFMONITORCOUNTERSAMDPROC)glewGetProcAddress((const GLubyte*)"glSelectPerfMonitorCountersAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_AMD_performance_monitor */
-
-#ifdef GL_AMD_pinned_memory
-
-#endif /* GL_AMD_pinned_memory */
-
-#ifdef GL_AMD_query_buffer_object
-
-#endif /* GL_AMD_query_buffer_object */
-
-#ifdef GL_AMD_sample_positions
-
-static GLboolean _glewInit_GL_AMD_sample_positions (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glSetMultisamplefvAMD = (PFNGLSETMULTISAMPLEFVAMDPROC)glewGetProcAddress((const GLubyte*)"glSetMultisamplefvAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_AMD_sample_positions */
-
-#ifdef GL_AMD_seamless_cubemap_per_texture
-
-#endif /* GL_AMD_seamless_cubemap_per_texture */
-
-#ifdef GL_AMD_shader_atomic_counter_ops
-
-#endif /* GL_AMD_shader_atomic_counter_ops */
-
-#ifdef GL_AMD_shader_stencil_export
-
-#endif /* GL_AMD_shader_stencil_export */
-
-#ifdef GL_AMD_shader_stencil_value_export
-
-#endif /* GL_AMD_shader_stencil_value_export */
-
-#ifdef GL_AMD_shader_trinary_minmax
-
-#endif /* GL_AMD_shader_trinary_minmax */
-
-#ifdef GL_AMD_sparse_texture
-
-static GLboolean _glewInit_GL_AMD_sparse_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTexStorageSparseAMD = (PFNGLTEXSTORAGESPARSEAMDPROC)glewGetProcAddress((const GLubyte*)"glTexStorageSparseAMD")) == NULL) || r;
- r = ((glTextureStorageSparseAMD = (PFNGLTEXTURESTORAGESPARSEAMDPROC)glewGetProcAddress((const GLubyte*)"glTextureStorageSparseAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_AMD_sparse_texture */
-
-#ifdef GL_AMD_stencil_operation_extended
-
-static GLboolean _glewInit_GL_AMD_stencil_operation_extended (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glStencilOpValueAMD = (PFNGLSTENCILOPVALUEAMDPROC)glewGetProcAddress((const GLubyte*)"glStencilOpValueAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_AMD_stencil_operation_extended */
-
-#ifdef GL_AMD_texture_texture4
-
-#endif /* GL_AMD_texture_texture4 */
-
-#ifdef GL_AMD_transform_feedback3_lines_triangles
-
-#endif /* GL_AMD_transform_feedback3_lines_triangles */
-
-#ifdef GL_AMD_transform_feedback4
-
-#endif /* GL_AMD_transform_feedback4 */
-
-#ifdef GL_AMD_vertex_shader_layer
-
-#endif /* GL_AMD_vertex_shader_layer */
-
-#ifdef GL_AMD_vertex_shader_tessellator
-
-static GLboolean _glewInit_GL_AMD_vertex_shader_tessellator (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTessellationFactorAMD = (PFNGLTESSELLATIONFACTORAMDPROC)glewGetProcAddress((const GLubyte*)"glTessellationFactorAMD")) == NULL) || r;
- r = ((glTessellationModeAMD = (PFNGLTESSELLATIONMODEAMDPROC)glewGetProcAddress((const GLubyte*)"glTessellationModeAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_AMD_vertex_shader_tessellator */
-
-#ifdef GL_AMD_vertex_shader_viewport_index
-
-#endif /* GL_AMD_vertex_shader_viewport_index */
-
-#ifdef GL_ANGLE_depth_texture
-
-#endif /* GL_ANGLE_depth_texture */
-
-#ifdef GL_ANGLE_framebuffer_blit
-
-static GLboolean _glewInit_GL_ANGLE_framebuffer_blit (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlitFramebufferANGLE = (PFNGLBLITFRAMEBUFFERANGLEPROC)glewGetProcAddress((const GLubyte*)"glBlitFramebufferANGLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ANGLE_framebuffer_blit */
-
-#ifdef GL_ANGLE_framebuffer_multisample
-
-static GLboolean _glewInit_GL_ANGLE_framebuffer_multisample (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glRenderbufferStorageMultisampleANGLE = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisampleANGLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ANGLE_framebuffer_multisample */
-
-#ifdef GL_ANGLE_instanced_arrays
-
-static GLboolean _glewInit_GL_ANGLE_instanced_arrays (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawArraysInstancedANGLE = (PFNGLDRAWARRAYSINSTANCEDANGLEPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedANGLE")) == NULL) || r;
- r = ((glDrawElementsInstancedANGLE = (PFNGLDRAWELEMENTSINSTANCEDANGLEPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedANGLE")) == NULL) || r;
- r = ((glVertexAttribDivisorANGLE = (PFNGLVERTEXATTRIBDIVISORANGLEPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribDivisorANGLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ANGLE_instanced_arrays */
-
-#ifdef GL_ANGLE_pack_reverse_row_order
-
-#endif /* GL_ANGLE_pack_reverse_row_order */
-
-#ifdef GL_ANGLE_program_binary
-
-#endif /* GL_ANGLE_program_binary */
-
-#ifdef GL_ANGLE_texture_compression_dxt1
-
-#endif /* GL_ANGLE_texture_compression_dxt1 */
-
-#ifdef GL_ANGLE_texture_compression_dxt3
-
-#endif /* GL_ANGLE_texture_compression_dxt3 */
-
-#ifdef GL_ANGLE_texture_compression_dxt5
-
-#endif /* GL_ANGLE_texture_compression_dxt5 */
-
-#ifdef GL_ANGLE_texture_usage
-
-#endif /* GL_ANGLE_texture_usage */
-
-#ifdef GL_ANGLE_timer_query
-
-static GLboolean _glewInit_GL_ANGLE_timer_query (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginQueryANGLE = (PFNGLBEGINQUERYANGLEPROC)glewGetProcAddress((const GLubyte*)"glBeginQueryANGLE")) == NULL) || r;
- r = ((glDeleteQueriesANGLE = (PFNGLDELETEQUERIESANGLEPROC)glewGetProcAddress((const GLubyte*)"glDeleteQueriesANGLE")) == NULL) || r;
- r = ((glEndQueryANGLE = (PFNGLENDQUERYANGLEPROC)glewGetProcAddress((const GLubyte*)"glEndQueryANGLE")) == NULL) || r;
- r = ((glGenQueriesANGLE = (PFNGLGENQUERIESANGLEPROC)glewGetProcAddress((const GLubyte*)"glGenQueriesANGLE")) == NULL) || r;
- r = ((glGetQueryObjecti64vANGLE = (PFNGLGETQUERYOBJECTI64VANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjecti64vANGLE")) == NULL) || r;
- r = ((glGetQueryObjectivANGLE = (PFNGLGETQUERYOBJECTIVANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectivANGLE")) == NULL) || r;
- r = ((glGetQueryObjectui64vANGLE = (PFNGLGETQUERYOBJECTUI64VANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectui64vANGLE")) == NULL) || r;
- r = ((glGetQueryObjectuivANGLE = (PFNGLGETQUERYOBJECTUIVANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectuivANGLE")) == NULL) || r;
- r = ((glGetQueryivANGLE = (PFNGLGETQUERYIVANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetQueryivANGLE")) == NULL) || r;
- r = ((glIsQueryANGLE = (PFNGLISQUERYANGLEPROC)glewGetProcAddress((const GLubyte*)"glIsQueryANGLE")) == NULL) || r;
- r = ((glQueryCounterANGLE = (PFNGLQUERYCOUNTERANGLEPROC)glewGetProcAddress((const GLubyte*)"glQueryCounterANGLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ANGLE_timer_query */
-
-#ifdef GL_ANGLE_translated_shader_source
-
-static GLboolean _glewInit_GL_ANGLE_translated_shader_source (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetTranslatedShaderSourceANGLE = (PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetTranslatedShaderSourceANGLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ANGLE_translated_shader_source */
-
-#ifdef GL_APPLE_aux_depth_stencil
-
-#endif /* GL_APPLE_aux_depth_stencil */
-
-#ifdef GL_APPLE_client_storage
-
-#endif /* GL_APPLE_client_storage */
-
-#ifdef GL_APPLE_element_array
-
-static GLboolean _glewInit_GL_APPLE_element_array (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawElementArrayAPPLE = (PFNGLDRAWELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDrawElementArrayAPPLE")) == NULL) || r;
- r = ((glDrawRangeElementArrayAPPLE = (PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementArrayAPPLE")) == NULL) || r;
- r = ((glElementPointerAPPLE = (PFNGLELEMENTPOINTERAPPLEPROC)glewGetProcAddress((const GLubyte*)"glElementPointerAPPLE")) == NULL) || r;
- r = ((glMultiDrawElementArrayAPPLE = (PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementArrayAPPLE")) == NULL) || r;
- r = ((glMultiDrawRangeElementArrayAPPLE = (PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawRangeElementArrayAPPLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_APPLE_element_array */
-
-#ifdef GL_APPLE_fence
-
-static GLboolean _glewInit_GL_APPLE_fence (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDeleteFencesAPPLE = (PFNGLDELETEFENCESAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDeleteFencesAPPLE")) == NULL) || r;
- r = ((glFinishFenceAPPLE = (PFNGLFINISHFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFinishFenceAPPLE")) == NULL) || r;
- r = ((glFinishObjectAPPLE = (PFNGLFINISHOBJECTAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFinishObjectAPPLE")) == NULL) || r;
- r = ((glGenFencesAPPLE = (PFNGLGENFENCESAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGenFencesAPPLE")) == NULL) || r;
- r = ((glIsFenceAPPLE = (PFNGLISFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glIsFenceAPPLE")) == NULL) || r;
- r = ((glSetFenceAPPLE = (PFNGLSETFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glSetFenceAPPLE")) == NULL) || r;
- r = ((glTestFenceAPPLE = (PFNGLTESTFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTestFenceAPPLE")) == NULL) || r;
- r = ((glTestObjectAPPLE = (PFNGLTESTOBJECTAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTestObjectAPPLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_APPLE_fence */
-
-#ifdef GL_APPLE_float_pixels
-
-#endif /* GL_APPLE_float_pixels */
-
-#ifdef GL_APPLE_flush_buffer_range
-
-static GLboolean _glewInit_GL_APPLE_flush_buffer_range (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBufferParameteriAPPLE = (PFNGLBUFFERPARAMETERIAPPLEPROC)glewGetProcAddress((const GLubyte*)"glBufferParameteriAPPLE")) == NULL) || r;
- r = ((glFlushMappedBufferRangeAPPLE = (PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedBufferRangeAPPLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_APPLE_flush_buffer_range */
-
-#ifdef GL_APPLE_object_purgeable
-
-static GLboolean _glewInit_GL_APPLE_object_purgeable (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetObjectParameterivAPPLE = (PFNGLGETOBJECTPARAMETERIVAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGetObjectParameterivAPPLE")) == NULL) || r;
- r = ((glObjectPurgeableAPPLE = (PFNGLOBJECTPURGEABLEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glObjectPurgeableAPPLE")) == NULL) || r;
- r = ((glObjectUnpurgeableAPPLE = (PFNGLOBJECTUNPURGEABLEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glObjectUnpurgeableAPPLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_APPLE_object_purgeable */
-
-#ifdef GL_APPLE_pixel_buffer
-
-#endif /* GL_APPLE_pixel_buffer */
-
-#ifdef GL_APPLE_rgb_422
-
-#endif /* GL_APPLE_rgb_422 */
-
-#ifdef GL_APPLE_row_bytes
-
-#endif /* GL_APPLE_row_bytes */
-
-#ifdef GL_APPLE_specular_vector
-
-#endif /* GL_APPLE_specular_vector */
-
-#ifdef GL_APPLE_texture_range
-
-static GLboolean _glewInit_GL_APPLE_texture_range (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetTexParameterPointervAPPLE = (PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterPointervAPPLE")) == NULL) || r;
- r = ((glTextureRangeAPPLE = (PFNGLTEXTURERANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTextureRangeAPPLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_APPLE_texture_range */
-
-#ifdef GL_APPLE_transform_hint
-
-#endif /* GL_APPLE_transform_hint */
-
-#ifdef GL_APPLE_vertex_array_object
-
-static GLboolean _glewInit_GL_APPLE_vertex_array_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindVertexArrayAPPLE = (PFNGLBINDVERTEXARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glBindVertexArrayAPPLE")) == NULL) || r;
- r = ((glDeleteVertexArraysAPPLE = (PFNGLDELETEVERTEXARRAYSAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDeleteVertexArraysAPPLE")) == NULL) || r;
- r = ((glGenVertexArraysAPPLE = (PFNGLGENVERTEXARRAYSAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGenVertexArraysAPPLE")) == NULL) || r;
- r = ((glIsVertexArrayAPPLE = (PFNGLISVERTEXARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glIsVertexArrayAPPLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_APPLE_vertex_array_object */
-
-#ifdef GL_APPLE_vertex_array_range
-
-static GLboolean _glewInit_GL_APPLE_vertex_array_range (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFlushVertexArrayRangeAPPLE = (PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFlushVertexArrayRangeAPPLE")) == NULL) || r;
- r = ((glVertexArrayParameteriAPPLE = (PFNGLVERTEXARRAYPARAMETERIAPPLEPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayParameteriAPPLE")) == NULL) || r;
- r = ((glVertexArrayRangeAPPLE = (PFNGLVERTEXARRAYRANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayRangeAPPLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_APPLE_vertex_array_range */
-
-#ifdef GL_APPLE_vertex_program_evaluators
-
-static GLboolean _glewInit_GL_APPLE_vertex_program_evaluators (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDisableVertexAttribAPPLE = (PFNGLDISABLEVERTEXATTRIBAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexAttribAPPLE")) == NULL) || r;
- r = ((glEnableVertexAttribAPPLE = (PFNGLENABLEVERTEXATTRIBAPPLEPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexAttribAPPLE")) == NULL) || r;
- r = ((glIsVertexAttribEnabledAPPLE = (PFNGLISVERTEXATTRIBENABLEDAPPLEPROC)glewGetProcAddress((const GLubyte*)"glIsVertexAttribEnabledAPPLE")) == NULL) || r;
- r = ((glMapVertexAttrib1dAPPLE = (PFNGLMAPVERTEXATTRIB1DAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMapVertexAttrib1dAPPLE")) == NULL) || r;
- r = ((glMapVertexAttrib1fAPPLE = (PFNGLMAPVERTEXATTRIB1FAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMapVertexAttrib1fAPPLE")) == NULL) || r;
- r = ((glMapVertexAttrib2dAPPLE = (PFNGLMAPVERTEXATTRIB2DAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMapVertexAttrib2dAPPLE")) == NULL) || r;
- r = ((glMapVertexAttrib2fAPPLE = (PFNGLMAPVERTEXATTRIB2FAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMapVertexAttrib2fAPPLE")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_APPLE_vertex_program_evaluators */
-
-#ifdef GL_APPLE_ycbcr_422
-
-#endif /* GL_APPLE_ycbcr_422 */
-
-#ifdef GL_ARB_ES2_compatibility
-
-static GLboolean _glewInit_GL_ARB_ES2_compatibility (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glClearDepthf = (PFNGLCLEARDEPTHFPROC)glewGetProcAddress((const GLubyte*)"glClearDepthf")) == NULL) || r;
- r = ((glDepthRangef = (PFNGLDEPTHRANGEFPROC)glewGetProcAddress((const GLubyte*)"glDepthRangef")) == NULL) || r;
- r = ((glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC)glewGetProcAddress((const GLubyte*)"glGetShaderPrecisionFormat")) == NULL) || r;
- r = ((glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC)glewGetProcAddress((const GLubyte*)"glReleaseShaderCompiler")) == NULL) || r;
- r = ((glShaderBinary = (PFNGLSHADERBINARYPROC)glewGetProcAddress((const GLubyte*)"glShaderBinary")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_ES2_compatibility */
-
-#ifdef GL_ARB_ES3_1_compatibility
-
-static GLboolean _glewInit_GL_ARB_ES3_1_compatibility (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glMemoryBarrierByRegion = (PFNGLMEMORYBARRIERBYREGIONPROC)glewGetProcAddress((const GLubyte*)"glMemoryBarrierByRegion")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_ES3_1_compatibility */
-
-#ifdef GL_ARB_ES3_compatibility
-
-#endif /* GL_ARB_ES3_compatibility */
-
-#ifdef GL_ARB_arrays_of_arrays
-
-#endif /* GL_ARB_arrays_of_arrays */
-
-#ifdef GL_ARB_base_instance
-
-static GLboolean _glewInit_GL_ARB_base_instance (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawArraysInstancedBaseInstance = (PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedBaseInstance")) == NULL) || r;
- r = ((glDrawElementsInstancedBaseInstance = (PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedBaseInstance")) == NULL) || r;
- r = ((glDrawElementsInstancedBaseVertexBaseInstance = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedBaseVertexBaseInstance")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_base_instance */
-
-#ifdef GL_ARB_bindless_texture
-
-static GLboolean _glewInit_GL_ARB_bindless_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetImageHandleARB = (PFNGLGETIMAGEHANDLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetImageHandleARB")) == NULL) || r;
- r = ((glGetTextureHandleARB = (PFNGLGETTEXTUREHANDLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetTextureHandleARB")) == NULL) || r;
- r = ((glGetTextureSamplerHandleARB = (PFNGLGETTEXTURESAMPLERHANDLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetTextureSamplerHandleARB")) == NULL) || r;
- r = ((glGetVertexAttribLui64vARB = (PFNGLGETVERTEXATTRIBLUI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLui64vARB")) == NULL) || r;
- r = ((glIsImageHandleResidentARB = (PFNGLISIMAGEHANDLERESIDENTARBPROC)glewGetProcAddress((const GLubyte*)"glIsImageHandleResidentARB")) == NULL) || r;
- r = ((glIsTextureHandleResidentARB = (PFNGLISTEXTUREHANDLERESIDENTARBPROC)glewGetProcAddress((const GLubyte*)"glIsTextureHandleResidentARB")) == NULL) || r;
- r = ((glMakeImageHandleNonResidentARB = (PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC)glewGetProcAddress((const GLubyte*)"glMakeImageHandleNonResidentARB")) == NULL) || r;
- r = ((glMakeImageHandleResidentARB = (PFNGLMAKEIMAGEHANDLERESIDENTARBPROC)glewGetProcAddress((const GLubyte*)"glMakeImageHandleResidentARB")) == NULL) || r;
- r = ((glMakeTextureHandleNonResidentARB = (PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC)glewGetProcAddress((const GLubyte*)"glMakeTextureHandleNonResidentARB")) == NULL) || r;
- r = ((glMakeTextureHandleResidentARB = (PFNGLMAKETEXTUREHANDLERESIDENTARBPROC)glewGetProcAddress((const GLubyte*)"glMakeTextureHandleResidentARB")) == NULL) || r;
- r = ((glProgramUniformHandleui64ARB = (PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformHandleui64ARB")) == NULL) || r;
- r = ((glProgramUniformHandleui64vARB = (PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformHandleui64vARB")) == NULL) || r;
- r = ((glUniformHandleui64ARB = (PFNGLUNIFORMHANDLEUI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniformHandleui64ARB")) == NULL) || r;
- r = ((glUniformHandleui64vARB = (PFNGLUNIFORMHANDLEUI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniformHandleui64vARB")) == NULL) || r;
- r = ((glVertexAttribL1ui64ARB = (PFNGLVERTEXATTRIBL1UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1ui64ARB")) == NULL) || r;
- r = ((glVertexAttribL1ui64vARB = (PFNGLVERTEXATTRIBL1UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1ui64vARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_bindless_texture */
-
-#ifdef GL_ARB_blend_func_extended
-
-static GLboolean _glewInit_GL_ARB_blend_func_extended (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glBindFragDataLocationIndexed")) == NULL) || r;
- r = ((glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetFragDataIndex")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_blend_func_extended */
-
-#ifdef GL_ARB_buffer_storage
-
-static GLboolean _glewInit_GL_ARB_buffer_storage (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBufferStorage = (PFNGLBUFFERSTORAGEPROC)glewGetProcAddress((const GLubyte*)"glBufferStorage")) == NULL) || r;
- r = ((glNamedBufferStorageEXT = (PFNGLNAMEDBUFFERSTORAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferStorageEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_buffer_storage */
-
-#ifdef GL_ARB_cl_event
-
-static GLboolean _glewInit_GL_ARB_cl_event (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCreateSyncFromCLeventARB = (PFNGLCREATESYNCFROMCLEVENTARBPROC)glewGetProcAddress((const GLubyte*)"glCreateSyncFromCLeventARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_cl_event */
-
-#ifdef GL_ARB_clear_buffer_object
-
-static GLboolean _glewInit_GL_ARB_clear_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glClearBufferData = (PFNGLCLEARBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glClearBufferData")) == NULL) || r;
- r = ((glClearBufferSubData = (PFNGLCLEARBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glClearBufferSubData")) == NULL) || r;
- r = ((glClearNamedBufferDataEXT = (PFNGLCLEARNAMEDBUFFERDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glClearNamedBufferDataEXT")) == NULL) || r;
- r = ((glClearNamedBufferSubDataEXT = (PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glClearNamedBufferSubDataEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_clear_buffer_object */
-
-#ifdef GL_ARB_clear_texture
-
-static GLboolean _glewInit_GL_ARB_clear_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glClearTexImage = (PFNGLCLEARTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glClearTexImage")) == NULL) || r;
- r = ((glClearTexSubImage = (PFNGLCLEARTEXSUBIMAGEPROC)glewGetProcAddress((const GLubyte*)"glClearTexSubImage")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_clear_texture */
-
-#ifdef GL_ARB_clip_control
-
-static GLboolean _glewInit_GL_ARB_clip_control (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glClipControl = (PFNGLCLIPCONTROLPROC)glewGetProcAddress((const GLubyte*)"glClipControl")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_clip_control */
-
-#ifdef GL_ARB_color_buffer_float
-
-static GLboolean _glewInit_GL_ARB_color_buffer_float (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glClampColorARB = (PFNGLCLAMPCOLORARBPROC)glewGetProcAddress((const GLubyte*)"glClampColorARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_color_buffer_float */
-
-#ifdef GL_ARB_compatibility
-
-#endif /* GL_ARB_compatibility */
-
-#ifdef GL_ARB_compressed_texture_pixel_storage
-
-#endif /* GL_ARB_compressed_texture_pixel_storage */
-
-#ifdef GL_ARB_compute_shader
-
-static GLboolean _glewInit_GL_ARB_compute_shader (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDispatchCompute = (PFNGLDISPATCHCOMPUTEPROC)glewGetProcAddress((const GLubyte*)"glDispatchCompute")) == NULL) || r;
- r = ((glDispatchComputeIndirect = (PFNGLDISPATCHCOMPUTEINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glDispatchComputeIndirect")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_compute_shader */
-
-#ifdef GL_ARB_compute_variable_group_size
-
-static GLboolean _glewInit_GL_ARB_compute_variable_group_size (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDispatchComputeGroupSizeARB = (PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC)glewGetProcAddress((const GLubyte*)"glDispatchComputeGroupSizeARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_compute_variable_group_size */
-
-#ifdef GL_ARB_conditional_render_inverted
-
-#endif /* GL_ARB_conditional_render_inverted */
-
-#ifdef GL_ARB_conservative_depth
-
-#endif /* GL_ARB_conservative_depth */
-
-#ifdef GL_ARB_copy_buffer
-
-static GLboolean _glewInit_GL_ARB_copy_buffer (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glCopyBufferSubData")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_copy_buffer */
-
-#ifdef GL_ARB_copy_image
-
-static GLboolean _glewInit_GL_ARB_copy_image (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCopyImageSubData = (PFNGLCOPYIMAGESUBDATAPROC)glewGetProcAddress((const GLubyte*)"glCopyImageSubData")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_copy_image */
-
-#ifdef GL_ARB_cull_distance
-
-#endif /* GL_ARB_cull_distance */
-
-#ifdef GL_ARB_debug_output
-
-static GLboolean _glewInit_GL_ARB_debug_output (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageCallbackARB")) == NULL) || r;
- r = ((glDebugMessageControlARB = (PFNGLDEBUGMESSAGECONTROLARBPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageControlARB")) == NULL) || r;
- r = ((glDebugMessageInsertARB = (PFNGLDEBUGMESSAGEINSERTARBPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageInsertARB")) == NULL) || r;
- r = ((glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC)glewGetProcAddress((const GLubyte*)"glGetDebugMessageLogARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_debug_output */
-
-#ifdef GL_ARB_depth_buffer_float
-
-#endif /* GL_ARB_depth_buffer_float */
-
-#ifdef GL_ARB_depth_clamp
-
-#endif /* GL_ARB_depth_clamp */
-
-#ifdef GL_ARB_depth_texture
-
-#endif /* GL_ARB_depth_texture */
-
-#ifdef GL_ARB_derivative_control
-
-#endif /* GL_ARB_derivative_control */
-
-#ifdef GL_ARB_direct_state_access
-
-static GLboolean _glewInit_GL_ARB_direct_state_access (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindTextureUnit = (PFNGLBINDTEXTUREUNITPROC)glewGetProcAddress((const GLubyte*)"glBindTextureUnit")) == NULL) || r;
- r = ((glBlitNamedFramebuffer = (PFNGLBLITNAMEDFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBlitNamedFramebuffer")) == NULL) || r;
- r = ((glCheckNamedFramebufferStatus = (PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC)glewGetProcAddress((const GLubyte*)"glCheckNamedFramebufferStatus")) == NULL) || r;
- r = ((glClearNamedBufferData = (PFNGLCLEARNAMEDBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glClearNamedBufferData")) == NULL) || r;
- r = ((glClearNamedBufferSubData = (PFNGLCLEARNAMEDBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glClearNamedBufferSubData")) == NULL) || r;
- r = ((glClearNamedFramebufferfi = (PFNGLCLEARNAMEDFRAMEBUFFERFIPROC)glewGetProcAddress((const GLubyte*)"glClearNamedFramebufferfi")) == NULL) || r;
- r = ((glClearNamedFramebufferfv = (PFNGLCLEARNAMEDFRAMEBUFFERFVPROC)glewGetProcAddress((const GLubyte*)"glClearNamedFramebufferfv")) == NULL) || r;
- r = ((glClearNamedFramebufferiv = (PFNGLCLEARNAMEDFRAMEBUFFERIVPROC)glewGetProcAddress((const GLubyte*)"glClearNamedFramebufferiv")) == NULL) || r;
- r = ((glClearNamedFramebufferuiv = (PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC)glewGetProcAddress((const GLubyte*)"glClearNamedFramebufferuiv")) == NULL) || r;
- r = ((glCompressedTextureSubImage1D = (PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage1D")) == NULL) || r;
- r = ((glCompressedTextureSubImage2D = (PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage2D")) == NULL) || r;
- r = ((glCompressedTextureSubImage3D = (PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage3D")) == NULL) || r;
- r = ((glCopyNamedBufferSubData = (PFNGLCOPYNAMEDBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glCopyNamedBufferSubData")) == NULL) || r;
- r = ((glCopyTextureSubImage1D = (PFNGLCOPYTEXTURESUBIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage1D")) == NULL) || r;
- r = ((glCopyTextureSubImage2D = (PFNGLCOPYTEXTURESUBIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage2D")) == NULL) || r;
- r = ((glCopyTextureSubImage3D = (PFNGLCOPYTEXTURESUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage3D")) == NULL) || r;
- r = ((glCreateBuffers = (PFNGLCREATEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glCreateBuffers")) == NULL) || r;
- r = ((glCreateFramebuffers = (PFNGLCREATEFRAMEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glCreateFramebuffers")) == NULL) || r;
- r = ((glCreateProgramPipelines = (PFNGLCREATEPROGRAMPIPELINESPROC)glewGetProcAddress((const GLubyte*)"glCreateProgramPipelines")) == NULL) || r;
- r = ((glCreateQueries = (PFNGLCREATEQUERIESPROC)glewGetProcAddress((const GLubyte*)"glCreateQueries")) == NULL) || r;
- r = ((glCreateRenderbuffers = (PFNGLCREATERENDERBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glCreateRenderbuffers")) == NULL) || r;
- r = ((glCreateSamplers = (PFNGLCREATESAMPLERSPROC)glewGetProcAddress((const GLubyte*)"glCreateSamplers")) == NULL) || r;
- r = ((glCreateTextures = (PFNGLCREATETEXTURESPROC)glewGetProcAddress((const GLubyte*)"glCreateTextures")) == NULL) || r;
- r = ((glCreateTransformFeedbacks = (PFNGLCREATETRANSFORMFEEDBACKSPROC)glewGetProcAddress((const GLubyte*)"glCreateTransformFeedbacks")) == NULL) || r;
- r = ((glCreateVertexArrays = (PFNGLCREATEVERTEXARRAYSPROC)glewGetProcAddress((const GLubyte*)"glCreateVertexArrays")) == NULL) || r;
- r = ((glDisableVertexArrayAttrib = (PFNGLDISABLEVERTEXARRAYATTRIBPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexArrayAttrib")) == NULL) || r;
- r = ((glEnableVertexArrayAttrib = (PFNGLENABLEVERTEXARRAYATTRIBPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexArrayAttrib")) == NULL) || r;
- r = ((glFlushMappedNamedBufferRange = (PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedNamedBufferRange")) == NULL) || r;
- r = ((glGenerateTextureMipmap = (PFNGLGENERATETEXTUREMIPMAPPROC)glewGetProcAddress((const GLubyte*)"glGenerateTextureMipmap")) == NULL) || r;
- r = ((glGetCompressedTextureImage = (PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTextureImage")) == NULL) || r;
- r = ((glGetNamedBufferParameteri64v = (PFNGLGETNAMEDBUFFERPARAMETERI64VPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferParameteri64v")) == NULL) || r;
- r = ((glGetNamedBufferParameteriv = (PFNGLGETNAMEDBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferParameteriv")) == NULL) || r;
- r = ((glGetNamedBufferPointerv = (PFNGLGETNAMEDBUFFERPOINTERVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferPointerv")) == NULL) || r;
- r = ((glGetNamedBufferSubData = (PFNGLGETNAMEDBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferSubData")) == NULL) || r;
- r = ((glGetNamedFramebufferAttachmentParameteriv = (PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedFramebufferAttachmentParameteriv")) == NULL) || r;
- r = ((glGetNamedFramebufferParameteriv = (PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedFramebufferParameteriv")) == NULL) || r;
- r = ((glGetNamedRenderbufferParameteriv = (PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedRenderbufferParameteriv")) == NULL) || r;
- r = ((glGetQueryBufferObjecti64v = (PFNGLGETQUERYBUFFEROBJECTI64VPROC)glewGetProcAddress((const GLubyte*)"glGetQueryBufferObjecti64v")) == NULL) || r;
- r = ((glGetQueryBufferObjectiv = (PFNGLGETQUERYBUFFEROBJECTIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryBufferObjectiv")) == NULL) || r;
- r = ((glGetQueryBufferObjectui64v = (PFNGLGETQUERYBUFFEROBJECTUI64VPROC)glewGetProcAddress((const GLubyte*)"glGetQueryBufferObjectui64v")) == NULL) || r;
- r = ((glGetQueryBufferObjectuiv = (PFNGLGETQUERYBUFFEROBJECTUIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryBufferObjectuiv")) == NULL) || r;
- r = ((glGetTextureImage = (PFNGLGETTEXTUREIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetTextureImage")) == NULL) || r;
- r = ((glGetTextureLevelParameterfv = (PFNGLGETTEXTURELEVELPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureLevelParameterfv")) == NULL) || r;
- r = ((glGetTextureLevelParameteriv = (PFNGLGETTEXTURELEVELPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureLevelParameteriv")) == NULL) || r;
- r = ((glGetTextureParameterIiv = (PFNGLGETTEXTUREPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterIiv")) == NULL) || r;
- r = ((glGetTextureParameterIuiv = (PFNGLGETTEXTUREPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterIuiv")) == NULL) || r;
- r = ((glGetTextureParameterfv = (PFNGLGETTEXTUREPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterfv")) == NULL) || r;
- r = ((glGetTextureParameteriv = (PFNGLGETTEXTUREPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameteriv")) == NULL) || r;
- r = ((glGetTransformFeedbacki64_v = (PFNGLGETTRANSFORMFEEDBACKI64_VPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbacki64_v")) == NULL) || r;
- r = ((glGetTransformFeedbacki_v = (PFNGLGETTRANSFORMFEEDBACKI_VPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbacki_v")) == NULL) || r;
- r = ((glGetTransformFeedbackiv = (PFNGLGETTRANSFORMFEEDBACKIVPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbackiv")) == NULL) || r;
- r = ((glGetVertexArrayIndexed64iv = (PFNGLGETVERTEXARRAYINDEXED64IVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayIndexed64iv")) == NULL) || r;
- r = ((glGetVertexArrayIndexediv = (PFNGLGETVERTEXARRAYINDEXEDIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayIndexediv")) == NULL) || r;
- r = ((glGetVertexArrayiv = (PFNGLGETVERTEXARRAYIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayiv")) == NULL) || r;
- r = ((glInvalidateNamedFramebufferData = (PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glInvalidateNamedFramebufferData")) == NULL) || r;
- r = ((glInvalidateNamedFramebufferSubData = (PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glInvalidateNamedFramebufferSubData")) == NULL) || r;
- r = ((glMapNamedBuffer = (PFNGLMAPNAMEDBUFFERPROC)glewGetProcAddress((const GLubyte*)"glMapNamedBuffer")) == NULL) || r;
- r = ((glMapNamedBufferRange = (PFNGLMAPNAMEDBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glMapNamedBufferRange")) == NULL) || r;
- r = ((glNamedBufferData = (PFNGLNAMEDBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferData")) == NULL) || r;
- r = ((glNamedBufferStorage = (PFNGLNAMEDBUFFERSTORAGEPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferStorage")) == NULL) || r;
- r = ((glNamedBufferSubData = (PFNGLNAMEDBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferSubData")) == NULL) || r;
- r = ((glNamedFramebufferDrawBuffer = (PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferDrawBuffer")) == NULL) || r;
- r = ((glNamedFramebufferDrawBuffers = (PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferDrawBuffers")) == NULL) || r;
- r = ((glNamedFramebufferParameteri = (PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferParameteri")) == NULL) || r;
- r = ((glNamedFramebufferReadBuffer = (PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferReadBuffer")) == NULL) || r;
- r = ((glNamedFramebufferRenderbuffer = (PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferRenderbuffer")) == NULL) || r;
- r = ((glNamedFramebufferTexture = (PFNGLNAMEDFRAMEBUFFERTEXTUREPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTexture")) == NULL) || r;
- r = ((glNamedFramebufferTextureLayer = (PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTextureLayer")) == NULL) || r;
- r = ((glNamedRenderbufferStorage = (PFNGLNAMEDRENDERBUFFERSTORAGEPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorage")) == NULL) || r;
- r = ((glNamedRenderbufferStorageMultisample = (PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorageMultisample")) == NULL) || r;
- r = ((glTextureBuffer = (PFNGLTEXTUREBUFFERPROC)glewGetProcAddress((const GLubyte*)"glTextureBuffer")) == NULL) || r;
- r = ((glTextureBufferRange = (PFNGLTEXTUREBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glTextureBufferRange")) == NULL) || r;
- r = ((glTextureParameterIiv = (PFNGLTEXTUREPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterIiv")) == NULL) || r;
- r = ((glTextureParameterIuiv = (PFNGLTEXTUREPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterIuiv")) == NULL) || r;
- r = ((glTextureParameterf = (PFNGLTEXTUREPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterf")) == NULL) || r;
- r = ((glTextureParameterfv = (PFNGLTEXTUREPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterfv")) == NULL) || r;
- r = ((glTextureParameteri = (PFNGLTEXTUREPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glTextureParameteri")) == NULL) || r;
- r = ((glTextureParameteriv = (PFNGLTEXTUREPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glTextureParameteriv")) == NULL) || r;
- r = ((glTextureStorage1D = (PFNGLTEXTURESTORAGE1DPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage1D")) == NULL) || r;
- r = ((glTextureStorage2D = (PFNGLTEXTURESTORAGE2DPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2D")) == NULL) || r;
- r = ((glTextureStorage2DMultisample = (PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2DMultisample")) == NULL) || r;
- r = ((glTextureStorage3D = (PFNGLTEXTURESTORAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3D")) == NULL) || r;
- r = ((glTextureStorage3DMultisample = (PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3DMultisample")) == NULL) || r;
- r = ((glTextureSubImage1D = (PFNGLTEXTURESUBIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage1D")) == NULL) || r;
- r = ((glTextureSubImage2D = (PFNGLTEXTURESUBIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage2D")) == NULL) || r;
- r = ((glTextureSubImage3D = (PFNGLTEXTURESUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage3D")) == NULL) || r;
- r = ((glTransformFeedbackBufferBase = (PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackBufferBase")) == NULL) || r;
- r = ((glTransformFeedbackBufferRange = (PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackBufferRange")) == NULL) || r;
- r = ((glUnmapNamedBuffer = (PFNGLUNMAPNAMEDBUFFERPROC)glewGetProcAddress((const GLubyte*)"glUnmapNamedBuffer")) == NULL) || r;
- r = ((glVertexArrayAttribBinding = (PFNGLVERTEXARRAYATTRIBBINDINGPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayAttribBinding")) == NULL) || r;
- r = ((glVertexArrayAttribFormat = (PFNGLVERTEXARRAYATTRIBFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayAttribFormat")) == NULL) || r;
- r = ((glVertexArrayAttribIFormat = (PFNGLVERTEXARRAYATTRIBIFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayAttribIFormat")) == NULL) || r;
- r = ((glVertexArrayAttribLFormat = (PFNGLVERTEXARRAYATTRIBLFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayAttribLFormat")) == NULL) || r;
- r = ((glVertexArrayBindingDivisor = (PFNGLVERTEXARRAYBINDINGDIVISORPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayBindingDivisor")) == NULL) || r;
- r = ((glVertexArrayElementBuffer = (PFNGLVERTEXARRAYELEMENTBUFFERPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayElementBuffer")) == NULL) || r;
- r = ((glVertexArrayVertexBuffer = (PFNGLVERTEXARRAYVERTEXBUFFERPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexBuffer")) == NULL) || r;
- r = ((glVertexArrayVertexBuffers = (PFNGLVERTEXARRAYVERTEXBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexBuffers")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_direct_state_access */
-
-#ifdef GL_ARB_draw_buffers
-
-static GLboolean _glewInit_GL_ARB_draw_buffers (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffersARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_draw_buffers */
-
-#ifdef GL_ARB_draw_buffers_blend
-
-static GLboolean _glewInit_GL_ARB_draw_buffers_blend (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlendEquationSeparateiARB = (PFNGLBLENDEQUATIONSEPARATEIARBPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparateiARB")) == NULL) || r;
- r = ((glBlendEquationiARB = (PFNGLBLENDEQUATIONIARBPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationiARB")) == NULL) || r;
- r = ((glBlendFuncSeparateiARB = (PFNGLBLENDFUNCSEPARATEIARBPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparateiARB")) == NULL) || r;
- r = ((glBlendFunciARB = (PFNGLBLENDFUNCIARBPROC)glewGetProcAddress((const GLubyte*)"glBlendFunciARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_draw_buffers_blend */
-
-#ifdef GL_ARB_draw_elements_base_vertex
-
-static GLboolean _glewInit_GL_ARB_draw_elements_base_vertex (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsBaseVertex")) == NULL) || r;
- r = ((glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedBaseVertex")) == NULL) || r;
- r = ((glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementsBaseVertex")) == NULL) || r;
- r = ((glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsBaseVertex")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_draw_elements_base_vertex */
-
-#ifdef GL_ARB_draw_indirect
-
-static GLboolean _glewInit_GL_ARB_draw_indirect (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawArraysIndirect = (PFNGLDRAWARRAYSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysIndirect")) == NULL) || r;
- r = ((glDrawElementsIndirect = (PFNGLDRAWELEMENTSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsIndirect")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_draw_indirect */
-
-#ifdef GL_ARB_draw_instanced
-
-#endif /* GL_ARB_draw_instanced */
-
-#ifdef GL_ARB_enhanced_layouts
-
-#endif /* GL_ARB_enhanced_layouts */
-
-#ifdef GL_ARB_explicit_attrib_location
-
-#endif /* GL_ARB_explicit_attrib_location */
-
-#ifdef GL_ARB_explicit_uniform_location
-
-#endif /* GL_ARB_explicit_uniform_location */
-
-#ifdef GL_ARB_fragment_coord_conventions
-
-#endif /* GL_ARB_fragment_coord_conventions */
-
-#ifdef GL_ARB_fragment_layer_viewport
-
-#endif /* GL_ARB_fragment_layer_viewport */
-
-#ifdef GL_ARB_fragment_program
-
-#endif /* GL_ARB_fragment_program */
-
-#ifdef GL_ARB_fragment_program_shadow
-
-#endif /* GL_ARB_fragment_program_shadow */
-
-#ifdef GL_ARB_fragment_shader
-
-#endif /* GL_ARB_fragment_shader */
-
-#ifdef GL_ARB_framebuffer_no_attachments
-
-static GLboolean _glewInit_GL_ARB_framebuffer_no_attachments (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFramebufferParameteri = (PFNGLFRAMEBUFFERPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glFramebufferParameteri")) == NULL) || r;
- r = ((glGetFramebufferParameteriv = (PFNGLGETFRAMEBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferParameteriv")) == NULL) || r;
- r = ((glGetNamedFramebufferParameterivEXT = (PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedFramebufferParameterivEXT")) == NULL) || r;
- r = ((glNamedFramebufferParameteriEXT = (PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferParameteriEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_framebuffer_no_attachments */
-
-#ifdef GL_ARB_framebuffer_object
-
-static GLboolean _glewInit_GL_ARB_framebuffer_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindFramebuffer")) == NULL) || r;
- r = ((glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindRenderbuffer")) == NULL) || r;
- r = ((glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBlitFramebuffer")) == NULL) || r;
- r = ((glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)glewGetProcAddress((const GLubyte*)"glCheckFramebufferStatus")) == NULL) || r;
- r = ((glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteFramebuffers")) == NULL) || r;
- r = ((glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteRenderbuffers")) == NULL) || r;
- r = ((glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)glewGetProcAddress((const GLubyte*)"glFramebufferRenderbuffer")) == NULL) || r;
- r = ((glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture1D")) == NULL) || r;
- r = ((glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture2D")) == NULL) || r;
- r = ((glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture3D")) == NULL) || r;
- r = ((glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureLayer")) == NULL) || r;
- r = ((glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glGenFramebuffers")) == NULL) || r;
- r = ((glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glGenRenderbuffers")) == NULL) || r;
- r = ((glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)glewGetProcAddress((const GLubyte*)"glGenerateMipmap")) == NULL) || r;
- r = ((glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferAttachmentParameteriv")) == NULL) || r;
- r = ((glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetRenderbufferParameteriv")) == NULL) || r;
- r = ((glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glIsFramebuffer")) == NULL) || r;
- r = ((glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)glewGetProcAddress((const GLubyte*)"glIsRenderbuffer")) == NULL) || r;
- r = ((glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorage")) == NULL) || r;
- r = ((glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisample")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_framebuffer_object */
-
-#ifdef GL_ARB_framebuffer_sRGB
-
-#endif /* GL_ARB_framebuffer_sRGB */
-
-#ifdef GL_ARB_geometry_shader4
-
-static GLboolean _glewInit_GL_ARB_geometry_shader4 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFramebufferTextureARB = (PFNGLFRAMEBUFFERTEXTUREARBPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureARB")) == NULL) || r;
- r = ((glFramebufferTextureFaceARB = (PFNGLFRAMEBUFFERTEXTUREFACEARBPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureFaceARB")) == NULL) || r;
- r = ((glFramebufferTextureLayerARB = (PFNGLFRAMEBUFFERTEXTURELAYERARBPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureLayerARB")) == NULL) || r;
- r = ((glProgramParameteriARB = (PFNGLPROGRAMPARAMETERIARBPROC)glewGetProcAddress((const GLubyte*)"glProgramParameteriARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_geometry_shader4 */
-
-#ifdef GL_ARB_get_program_binary
-
-static GLboolean _glewInit_GL_ARB_get_program_binary (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC)glewGetProcAddress((const GLubyte*)"glGetProgramBinary")) == NULL) || r;
- r = ((glProgramBinary = (PFNGLPROGRAMBINARYPROC)glewGetProcAddress((const GLubyte*)"glProgramBinary")) == NULL) || r;
- r = ((glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glProgramParameteri")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_get_program_binary */
-
-#ifdef GL_ARB_get_texture_sub_image
-
-static GLboolean _glewInit_GL_ARB_get_texture_sub_image (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetCompressedTextureSubImage = (PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTextureSubImage")) == NULL) || r;
- r = ((glGetTextureSubImage = (PFNGLGETTEXTURESUBIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetTextureSubImage")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_get_texture_sub_image */
-
-#ifdef GL_ARB_gpu_shader5
-
-#endif /* GL_ARB_gpu_shader5 */
-
-#ifdef GL_ARB_gpu_shader_fp64
-
-static GLboolean _glewInit_GL_ARB_gpu_shader_fp64 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetUniformdv = (PFNGLGETUNIFORMDVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformdv")) == NULL) || r;
- r = ((glUniform1d = (PFNGLUNIFORM1DPROC)glewGetProcAddress((const GLubyte*)"glUniform1d")) == NULL) || r;
- r = ((glUniform1dv = (PFNGLUNIFORM1DVPROC)glewGetProcAddress((const GLubyte*)"glUniform1dv")) == NULL) || r;
- r = ((glUniform2d = (PFNGLUNIFORM2DPROC)glewGetProcAddress((const GLubyte*)"glUniform2d")) == NULL) || r;
- r = ((glUniform2dv = (PFNGLUNIFORM2DVPROC)glewGetProcAddress((const GLubyte*)"glUniform2dv")) == NULL) || r;
- r = ((glUniform3d = (PFNGLUNIFORM3DPROC)glewGetProcAddress((const GLubyte*)"glUniform3d")) == NULL) || r;
- r = ((glUniform3dv = (PFNGLUNIFORM3DVPROC)glewGetProcAddress((const GLubyte*)"glUniform3dv")) == NULL) || r;
- r = ((glUniform4d = (PFNGLUNIFORM4DPROC)glewGetProcAddress((const GLubyte*)"glUniform4d")) == NULL) || r;
- r = ((glUniform4dv = (PFNGLUNIFORM4DVPROC)glewGetProcAddress((const GLubyte*)"glUniform4dv")) == NULL) || r;
- r = ((glUniformMatrix2dv = (PFNGLUNIFORMMATRIX2DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2dv")) == NULL) || r;
- r = ((glUniformMatrix2x3dv = (PFNGLUNIFORMMATRIX2X3DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2x3dv")) == NULL) || r;
- r = ((glUniformMatrix2x4dv = (PFNGLUNIFORMMATRIX2X4DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2x4dv")) == NULL) || r;
- r = ((glUniformMatrix3dv = (PFNGLUNIFORMMATRIX3DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3dv")) == NULL) || r;
- r = ((glUniformMatrix3x2dv = (PFNGLUNIFORMMATRIX3X2DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3x2dv")) == NULL) || r;
- r = ((glUniformMatrix3x4dv = (PFNGLUNIFORMMATRIX3X4DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3x4dv")) == NULL) || r;
- r = ((glUniformMatrix4dv = (PFNGLUNIFORMMATRIX4DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4dv")) == NULL) || r;
- r = ((glUniformMatrix4x2dv = (PFNGLUNIFORMMATRIX4X2DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4x2dv")) == NULL) || r;
- r = ((glUniformMatrix4x3dv = (PFNGLUNIFORMMATRIX4X3DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4x3dv")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_gpu_shader_fp64 */
-
-#ifdef GL_ARB_half_float_pixel
-
-#endif /* GL_ARB_half_float_pixel */
-
-#ifdef GL_ARB_half_float_vertex
-
-#endif /* GL_ARB_half_float_vertex */
-
-#ifdef GL_ARB_imaging
-
-static GLboolean _glewInit_GL_ARB_imaging (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlendEquation = (PFNGLBLENDEQUATIONPROC)glewGetProcAddress((const GLubyte*)"glBlendEquation")) == NULL) || r;
- r = ((glColorSubTable = (PFNGLCOLORSUBTABLEPROC)glewGetProcAddress((const GLubyte*)"glColorSubTable")) == NULL) || r;
- r = ((glColorTable = (PFNGLCOLORTABLEPROC)glewGetProcAddress((const GLubyte*)"glColorTable")) == NULL) || r;
- r = ((glColorTableParameterfv = (PFNGLCOLORTABLEPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameterfv")) == NULL) || r;
- r = ((glColorTableParameteriv = (PFNGLCOLORTABLEPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameteriv")) == NULL) || r;
- r = ((glConvolutionFilter1D = (PFNGLCONVOLUTIONFILTER1DPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter1D")) == NULL) || r;
- r = ((glConvolutionFilter2D = (PFNGLCONVOLUTIONFILTER2DPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter2D")) == NULL) || r;
- r = ((glConvolutionParameterf = (PFNGLCONVOLUTIONPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterf")) == NULL) || r;
- r = ((glConvolutionParameterfv = (PFNGLCONVOLUTIONPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterfv")) == NULL) || r;
- r = ((glConvolutionParameteri = (PFNGLCONVOLUTIONPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameteri")) == NULL) || r;
- r = ((glConvolutionParameteriv = (PFNGLCONVOLUTIONPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameteriv")) == NULL) || r;
- r = ((glCopyColorSubTable = (PFNGLCOPYCOLORSUBTABLEPROC)glewGetProcAddress((const GLubyte*)"glCopyColorSubTable")) == NULL) || r;
- r = ((glCopyColorTable = (PFNGLCOPYCOLORTABLEPROC)glewGetProcAddress((const GLubyte*)"glCopyColorTable")) == NULL) || r;
- r = ((glCopyConvolutionFilter1D = (PFNGLCOPYCONVOLUTIONFILTER1DPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter1D")) == NULL) || r;
- r = ((glCopyConvolutionFilter2D = (PFNGLCOPYCONVOLUTIONFILTER2DPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter2D")) == NULL) || r;
- r = ((glGetColorTable = (PFNGLGETCOLORTABLEPROC)glewGetProcAddress((const GLubyte*)"glGetColorTable")) == NULL) || r;
- r = ((glGetColorTableParameterfv = (PFNGLGETCOLORTABLEPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterfv")) == NULL) || r;
- r = ((glGetColorTableParameteriv = (PFNGLGETCOLORTABLEPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameteriv")) == NULL) || r;
- r = ((glGetConvolutionFilter = (PFNGLGETCONVOLUTIONFILTERPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionFilter")) == NULL) || r;
- r = ((glGetConvolutionParameterfv = (PFNGLGETCONVOLUTIONPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameterfv")) == NULL) || r;
- r = ((glGetConvolutionParameteriv = (PFNGLGETCONVOLUTIONPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameteriv")) == NULL) || r;
- r = ((glGetHistogram = (PFNGLGETHISTOGRAMPROC)glewGetProcAddress((const GLubyte*)"glGetHistogram")) == NULL) || r;
- r = ((glGetHistogramParameterfv = (PFNGLGETHISTOGRAMPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameterfv")) == NULL) || r;
- r = ((glGetHistogramParameteriv = (PFNGLGETHISTOGRAMPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameteriv")) == NULL) || r;
- r = ((glGetMinmax = (PFNGLGETMINMAXPROC)glewGetProcAddress((const GLubyte*)"glGetMinmax")) == NULL) || r;
- r = ((glGetMinmaxParameterfv = (PFNGLGETMINMAXPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameterfv")) == NULL) || r;
- r = ((glGetMinmaxParameteriv = (PFNGLGETMINMAXPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameteriv")) == NULL) || r;
- r = ((glGetSeparableFilter = (PFNGLGETSEPARABLEFILTERPROC)glewGetProcAddress((const GLubyte*)"glGetSeparableFilter")) == NULL) || r;
- r = ((glHistogram = (PFNGLHISTOGRAMPROC)glewGetProcAddress((const GLubyte*)"glHistogram")) == NULL) || r;
- r = ((glMinmax = (PFNGLMINMAXPROC)glewGetProcAddress((const GLubyte*)"glMinmax")) == NULL) || r;
- r = ((glResetHistogram = (PFNGLRESETHISTOGRAMPROC)glewGetProcAddress((const GLubyte*)"glResetHistogram")) == NULL) || r;
- r = ((glResetMinmax = (PFNGLRESETMINMAXPROC)glewGetProcAddress((const GLubyte*)"glResetMinmax")) == NULL) || r;
- r = ((glSeparableFilter2D = (PFNGLSEPARABLEFILTER2DPROC)glewGetProcAddress((const GLubyte*)"glSeparableFilter2D")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_imaging */
-
-#ifdef GL_ARB_indirect_parameters
-
-static GLboolean _glewInit_GL_ARB_indirect_parameters (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glMultiDrawArraysIndirectCountARB = (PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirectCountARB")) == NULL) || r;
- r = ((glMultiDrawElementsIndirectCountARB = (PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirectCountARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_indirect_parameters */
-
-#ifdef GL_ARB_instanced_arrays
-
-static GLboolean _glewInit_GL_ARB_instanced_arrays (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawArraysInstancedARB = (PFNGLDRAWARRAYSINSTANCEDARBPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedARB")) == NULL) || r;
- r = ((glDrawElementsInstancedARB = (PFNGLDRAWELEMENTSINSTANCEDARBPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedARB")) == NULL) || r;
- r = ((glVertexAttribDivisorARB = (PFNGLVERTEXATTRIBDIVISORARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribDivisorARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_instanced_arrays */
-
-#ifdef GL_ARB_internalformat_query
-
-static GLboolean _glewInit_GL_ARB_internalformat_query (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetInternalformativ = (PFNGLGETINTERNALFORMATIVPROC)glewGetProcAddress((const GLubyte*)"glGetInternalformativ")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_internalformat_query */
-
-#ifdef GL_ARB_internalformat_query2
-
-static GLboolean _glewInit_GL_ARB_internalformat_query2 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetInternalformati64v = (PFNGLGETINTERNALFORMATI64VPROC)glewGetProcAddress((const GLubyte*)"glGetInternalformati64v")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_internalformat_query2 */
-
-#ifdef GL_ARB_invalidate_subdata
-
-static GLboolean _glewInit_GL_ARB_invalidate_subdata (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glInvalidateBufferData = (PFNGLINVALIDATEBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glInvalidateBufferData")) == NULL) || r;
- r = ((glInvalidateBufferSubData = (PFNGLINVALIDATEBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glInvalidateBufferSubData")) == NULL) || r;
- r = ((glInvalidateFramebuffer = (PFNGLINVALIDATEFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glInvalidateFramebuffer")) == NULL) || r;
- r = ((glInvalidateSubFramebuffer = (PFNGLINVALIDATESUBFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glInvalidateSubFramebuffer")) == NULL) || r;
- r = ((glInvalidateTexImage = (PFNGLINVALIDATETEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glInvalidateTexImage")) == NULL) || r;
- r = ((glInvalidateTexSubImage = (PFNGLINVALIDATETEXSUBIMAGEPROC)glewGetProcAddress((const GLubyte*)"glInvalidateTexSubImage")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_invalidate_subdata */
-
-#ifdef GL_ARB_map_buffer_alignment
-
-#endif /* GL_ARB_map_buffer_alignment */
-
-#ifdef GL_ARB_map_buffer_range
-
-static GLboolean _glewInit_GL_ARB_map_buffer_range (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedBufferRange")) == NULL) || r;
- r = ((glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glMapBufferRange")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_map_buffer_range */
-
-#ifdef GL_ARB_matrix_palette
-
-static GLboolean _glewInit_GL_ARB_matrix_palette (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCurrentPaletteMatrixARB = (PFNGLCURRENTPALETTEMATRIXARBPROC)glewGetProcAddress((const GLubyte*)"glCurrentPaletteMatrixARB")) == NULL) || r;
- r = ((glMatrixIndexPointerARB = (PFNGLMATRIXINDEXPOINTERARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexPointerARB")) == NULL) || r;
- r = ((glMatrixIndexubvARB = (PFNGLMATRIXINDEXUBVARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexubvARB")) == NULL) || r;
- r = ((glMatrixIndexuivARB = (PFNGLMATRIXINDEXUIVARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexuivARB")) == NULL) || r;
- r = ((glMatrixIndexusvARB = (PFNGLMATRIXINDEXUSVARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexusvARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_matrix_palette */
-
-#ifdef GL_ARB_multi_bind
-
-static GLboolean _glewInit_GL_ARB_multi_bind (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindBuffersBase = (PFNGLBINDBUFFERSBASEPROC)glewGetProcAddress((const GLubyte*)"glBindBuffersBase")) == NULL) || r;
- r = ((glBindBuffersRange = (PFNGLBINDBUFFERSRANGEPROC)glewGetProcAddress((const GLubyte*)"glBindBuffersRange")) == NULL) || r;
- r = ((glBindImageTextures = (PFNGLBINDIMAGETEXTURESPROC)glewGetProcAddress((const GLubyte*)"glBindImageTextures")) == NULL) || r;
- r = ((glBindSamplers = (PFNGLBINDSAMPLERSPROC)glewGetProcAddress((const GLubyte*)"glBindSamplers")) == NULL) || r;
- r = ((glBindTextures = (PFNGLBINDTEXTURESPROC)glewGetProcAddress((const GLubyte*)"glBindTextures")) == NULL) || r;
- r = ((glBindVertexBuffers = (PFNGLBINDVERTEXBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glBindVertexBuffers")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_multi_bind */
-
-#ifdef GL_ARB_multi_draw_indirect
-
-static GLboolean _glewInit_GL_ARB_multi_draw_indirect (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glMultiDrawArraysIndirect = (PFNGLMULTIDRAWARRAYSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirect")) == NULL) || r;
- r = ((glMultiDrawElementsIndirect = (PFNGLMULTIDRAWELEMENTSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirect")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_multi_draw_indirect */
-
-#ifdef GL_ARB_multisample
-
-static GLboolean _glewInit_GL_ARB_multisample (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glSampleCoverageARB = (PFNGLSAMPLECOVERAGEARBPROC)glewGetProcAddress((const GLubyte*)"glSampleCoverageARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_multisample */
-
-#ifdef GL_ARB_multitexture
-
-static GLboolean _glewInit_GL_ARB_multitexture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)glewGetProcAddress((const GLubyte*)"glActiveTextureARB")) == NULL) || r;
- r = ((glClientActiveTextureARB = (PFNGLCLIENTACTIVETEXTUREARBPROC)glewGetProcAddress((const GLubyte*)"glClientActiveTextureARB")) == NULL) || r;
- r = ((glMultiTexCoord1dARB = (PFNGLMULTITEXCOORD1DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1dARB")) == NULL) || r;
- r = ((glMultiTexCoord1dvARB = (PFNGLMULTITEXCOORD1DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1dvARB")) == NULL) || r;
- r = ((glMultiTexCoord1fARB = (PFNGLMULTITEXCOORD1FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1fARB")) == NULL) || r;
- r = ((glMultiTexCoord1fvARB = (PFNGLMULTITEXCOORD1FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1fvARB")) == NULL) || r;
- r = ((glMultiTexCoord1iARB = (PFNGLMULTITEXCOORD1IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1iARB")) == NULL) || r;
- r = ((glMultiTexCoord1ivARB = (PFNGLMULTITEXCOORD1IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1ivARB")) == NULL) || r;
- r = ((glMultiTexCoord1sARB = (PFNGLMULTITEXCOORD1SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1sARB")) == NULL) || r;
- r = ((glMultiTexCoord1svARB = (PFNGLMULTITEXCOORD1SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1svARB")) == NULL) || r;
- r = ((glMultiTexCoord2dARB = (PFNGLMULTITEXCOORD2DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2dARB")) == NULL) || r;
- r = ((glMultiTexCoord2dvARB = (PFNGLMULTITEXCOORD2DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2dvARB")) == NULL) || r;
- r = ((glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2fARB")) == NULL) || r;
- r = ((glMultiTexCoord2fvARB = (PFNGLMULTITEXCOORD2FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2fvARB")) == NULL) || r;
- r = ((glMultiTexCoord2iARB = (PFNGLMULTITEXCOORD2IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2iARB")) == NULL) || r;
- r = ((glMultiTexCoord2ivARB = (PFNGLMULTITEXCOORD2IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2ivARB")) == NULL) || r;
- r = ((glMultiTexCoord2sARB = (PFNGLMULTITEXCOORD2SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2sARB")) == NULL) || r;
- r = ((glMultiTexCoord2svARB = (PFNGLMULTITEXCOORD2SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2svARB")) == NULL) || r;
- r = ((glMultiTexCoord3dARB = (PFNGLMULTITEXCOORD3DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3dARB")) == NULL) || r;
- r = ((glMultiTexCoord3dvARB = (PFNGLMULTITEXCOORD3DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3dvARB")) == NULL) || r;
- r = ((glMultiTexCoord3fARB = (PFNGLMULTITEXCOORD3FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3fARB")) == NULL) || r;
- r = ((glMultiTexCoord3fvARB = (PFNGLMULTITEXCOORD3FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3fvARB")) == NULL) || r;
- r = ((glMultiTexCoord3iARB = (PFNGLMULTITEXCOORD3IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3iARB")) == NULL) || r;
- r = ((glMultiTexCoord3ivARB = (PFNGLMULTITEXCOORD3IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3ivARB")) == NULL) || r;
- r = ((glMultiTexCoord3sARB = (PFNGLMULTITEXCOORD3SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3sARB")) == NULL) || r;
- r = ((glMultiTexCoord3svARB = (PFNGLMULTITEXCOORD3SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3svARB")) == NULL) || r;
- r = ((glMultiTexCoord4dARB = (PFNGLMULTITEXCOORD4DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4dARB")) == NULL) || r;
- r = ((glMultiTexCoord4dvARB = (PFNGLMULTITEXCOORD4DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4dvARB")) == NULL) || r;
- r = ((glMultiTexCoord4fARB = (PFNGLMULTITEXCOORD4FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4fARB")) == NULL) || r;
- r = ((glMultiTexCoord4fvARB = (PFNGLMULTITEXCOORD4FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4fvARB")) == NULL) || r;
- r = ((glMultiTexCoord4iARB = (PFNGLMULTITEXCOORD4IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4iARB")) == NULL) || r;
- r = ((glMultiTexCoord4ivARB = (PFNGLMULTITEXCOORD4IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4ivARB")) == NULL) || r;
- r = ((glMultiTexCoord4sARB = (PFNGLMULTITEXCOORD4SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4sARB")) == NULL) || r;
- r = ((glMultiTexCoord4svARB = (PFNGLMULTITEXCOORD4SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4svARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_multitexture */
-
-#ifdef GL_ARB_occlusion_query
-
-static GLboolean _glewInit_GL_ARB_occlusion_query (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginQueryARB = (PFNGLBEGINQUERYARBPROC)glewGetProcAddress((const GLubyte*)"glBeginQueryARB")) == NULL) || r;
- r = ((glDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteQueriesARB")) == NULL) || r;
- r = ((glEndQueryARB = (PFNGLENDQUERYARBPROC)glewGetProcAddress((const GLubyte*)"glEndQueryARB")) == NULL) || r;
- r = ((glGenQueriesARB = (PFNGLGENQUERIESARBPROC)glewGetProcAddress((const GLubyte*)"glGenQueriesARB")) == NULL) || r;
- r = ((glGetQueryObjectivARB = (PFNGLGETQUERYOBJECTIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectivARB")) == NULL) || r;
- r = ((glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectuivARB")) == NULL) || r;
- r = ((glGetQueryivARB = (PFNGLGETQUERYIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetQueryivARB")) == NULL) || r;
- r = ((glIsQueryARB = (PFNGLISQUERYARBPROC)glewGetProcAddress((const GLubyte*)"glIsQueryARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_occlusion_query */
-
-#ifdef GL_ARB_occlusion_query2
-
-#endif /* GL_ARB_occlusion_query2 */
-
-#ifdef GL_ARB_pipeline_statistics_query
-
-#endif /* GL_ARB_pipeline_statistics_query */
-
-#ifdef GL_ARB_pixel_buffer_object
-
-#endif /* GL_ARB_pixel_buffer_object */
-
-#ifdef GL_ARB_point_parameters
-
-static GLboolean _glewInit_GL_ARB_point_parameters (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfARB")) == NULL) || r;
- r = ((glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfvARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_point_parameters */
-
-#ifdef GL_ARB_point_sprite
-
-#endif /* GL_ARB_point_sprite */
-
-#ifdef GL_ARB_program_interface_query
-
-static GLboolean _glewInit_GL_ARB_program_interface_query (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetProgramInterfaceiv = (PFNGLGETPROGRAMINTERFACEIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramInterfaceiv")) == NULL) || r;
- r = ((glGetProgramResourceIndex = (PFNGLGETPROGRAMRESOURCEINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceIndex")) == NULL) || r;
- r = ((glGetProgramResourceLocation = (PFNGLGETPROGRAMRESOURCELOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceLocation")) == NULL) || r;
- r = ((glGetProgramResourceLocationIndex = (PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceLocationIndex")) == NULL) || r;
- r = ((glGetProgramResourceName = (PFNGLGETPROGRAMRESOURCENAMEPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceName")) == NULL) || r;
- r = ((glGetProgramResourceiv = (PFNGLGETPROGRAMRESOURCEIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceiv")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_program_interface_query */
-
-#ifdef GL_ARB_provoking_vertex
-
-static GLboolean _glewInit_GL_ARB_provoking_vertex (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)glewGetProcAddress((const GLubyte*)"glProvokingVertex")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_provoking_vertex */
-
-#ifdef GL_ARB_query_buffer_object
-
-#endif /* GL_ARB_query_buffer_object */
-
-#ifdef GL_ARB_robust_buffer_access_behavior
-
-#endif /* GL_ARB_robust_buffer_access_behavior */
-
-#ifdef GL_ARB_robustness
-
-static GLboolean _glewInit_GL_ARB_robustness (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetGraphicsResetStatusARB = (PFNGLGETGRAPHICSRESETSTATUSARBPROC)glewGetProcAddress((const GLubyte*)"glGetGraphicsResetStatusARB")) == NULL) || r;
- r = ((glGetnColorTableARB = (PFNGLGETNCOLORTABLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetnColorTableARB")) == NULL) || r;
- r = ((glGetnCompressedTexImageARB = (PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"glGetnCompressedTexImageARB")) == NULL) || r;
- r = ((glGetnConvolutionFilterARB = (PFNGLGETNCONVOLUTIONFILTERARBPROC)glewGetProcAddress((const GLubyte*)"glGetnConvolutionFilterARB")) == NULL) || r;
- r = ((glGetnHistogramARB = (PFNGLGETNHISTOGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glGetnHistogramARB")) == NULL) || r;
- r = ((glGetnMapdvARB = (PFNGLGETNMAPDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnMapdvARB")) == NULL) || r;
- r = ((glGetnMapfvARB = (PFNGLGETNMAPFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnMapfvARB")) == NULL) || r;
- r = ((glGetnMapivARB = (PFNGLGETNMAPIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnMapivARB")) == NULL) || r;
- r = ((glGetnMinmaxARB = (PFNGLGETNMINMAXARBPROC)glewGetProcAddress((const GLubyte*)"glGetnMinmaxARB")) == NULL) || r;
- r = ((glGetnPixelMapfvARB = (PFNGLGETNPIXELMAPFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnPixelMapfvARB")) == NULL) || r;
- r = ((glGetnPixelMapuivARB = (PFNGLGETNPIXELMAPUIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnPixelMapuivARB")) == NULL) || r;
- r = ((glGetnPixelMapusvARB = (PFNGLGETNPIXELMAPUSVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnPixelMapusvARB")) == NULL) || r;
- r = ((glGetnPolygonStippleARB = (PFNGLGETNPOLYGONSTIPPLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetnPolygonStippleARB")) == NULL) || r;
- r = ((glGetnSeparableFilterARB = (PFNGLGETNSEPARABLEFILTERARBPROC)glewGetProcAddress((const GLubyte*)"glGetnSeparableFilterARB")) == NULL) || r;
- r = ((glGetnTexImageARB = (PFNGLGETNTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"glGetnTexImageARB")) == NULL) || r;
- r = ((glGetnUniformdvARB = (PFNGLGETNUNIFORMDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformdvARB")) == NULL) || r;
- r = ((glGetnUniformfvARB = (PFNGLGETNUNIFORMFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformfvARB")) == NULL) || r;
- r = ((glGetnUniformivARB = (PFNGLGETNUNIFORMIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformivARB")) == NULL) || r;
- r = ((glGetnUniformuivARB = (PFNGLGETNUNIFORMUIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformuivARB")) == NULL) || r;
- r = ((glReadnPixelsARB = (PFNGLREADNPIXELSARBPROC)glewGetProcAddress((const GLubyte*)"glReadnPixelsARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_robustness */
-
-#ifdef GL_ARB_robustness_application_isolation
-
-#endif /* GL_ARB_robustness_application_isolation */
-
-#ifdef GL_ARB_robustness_share_group_isolation
-
-#endif /* GL_ARB_robustness_share_group_isolation */
-
-#ifdef GL_ARB_sample_shading
-
-static GLboolean _glewInit_GL_ARB_sample_shading (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glMinSampleShadingARB = (PFNGLMINSAMPLESHADINGARBPROC)glewGetProcAddress((const GLubyte*)"glMinSampleShadingARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_sample_shading */
-
-#ifdef GL_ARB_sampler_objects
-
-static GLboolean _glewInit_GL_ARB_sampler_objects (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindSampler = (PFNGLBINDSAMPLERPROC)glewGetProcAddress((const GLubyte*)"glBindSampler")) == NULL) || r;
- r = ((glDeleteSamplers = (PFNGLDELETESAMPLERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteSamplers")) == NULL) || r;
- r = ((glGenSamplers = (PFNGLGENSAMPLERSPROC)glewGetProcAddress((const GLubyte*)"glGenSamplers")) == NULL) || r;
- r = ((glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glGetSamplerParameterIiv")) == NULL) || r;
- r = ((glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glGetSamplerParameterIuiv")) == NULL) || r;
- r = ((glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetSamplerParameterfv")) == NULL) || r;
- r = ((glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetSamplerParameteriv")) == NULL) || r;
- r = ((glIsSampler = (PFNGLISSAMPLERPROC)glewGetProcAddress((const GLubyte*)"glIsSampler")) == NULL) || r;
- r = ((glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameterIiv")) == NULL) || r;
- r = ((glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameterIuiv")) == NULL) || r;
- r = ((glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameterf")) == NULL) || r;
- r = ((glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameterfv")) == NULL) || r;
- r = ((glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameteri")) == NULL) || r;
- r = ((glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameteriv")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_sampler_objects */
-
-#ifdef GL_ARB_seamless_cube_map
-
-#endif /* GL_ARB_seamless_cube_map */
-
-#ifdef GL_ARB_seamless_cubemap_per_texture
-
-#endif /* GL_ARB_seamless_cubemap_per_texture */
-
-#ifdef GL_ARB_separate_shader_objects
-
-static GLboolean _glewInit_GL_ARB_separate_shader_objects (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glActiveShaderProgram = (PFNGLACTIVESHADERPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glActiveShaderProgram")) == NULL) || r;
- r = ((glBindProgramPipeline = (PFNGLBINDPROGRAMPIPELINEPROC)glewGetProcAddress((const GLubyte*)"glBindProgramPipeline")) == NULL) || r;
- r = ((glCreateShaderProgramv = (PFNGLCREATESHADERPROGRAMVPROC)glewGetProcAddress((const GLubyte*)"glCreateShaderProgramv")) == NULL) || r;
- r = ((glDeleteProgramPipelines = (PFNGLDELETEPROGRAMPIPELINESPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgramPipelines")) == NULL) || r;
- r = ((glGenProgramPipelines = (PFNGLGENPROGRAMPIPELINESPROC)glewGetProcAddress((const GLubyte*)"glGenProgramPipelines")) == NULL) || r;
- r = ((glGetProgramPipelineInfoLog = (PFNGLGETPROGRAMPIPELINEINFOLOGPROC)glewGetProcAddress((const GLubyte*)"glGetProgramPipelineInfoLog")) == NULL) || r;
- r = ((glGetProgramPipelineiv = (PFNGLGETPROGRAMPIPELINEIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramPipelineiv")) == NULL) || r;
- r = ((glIsProgramPipeline = (PFNGLISPROGRAMPIPELINEPROC)glewGetProcAddress((const GLubyte*)"glIsProgramPipeline")) == NULL) || r;
- r = ((glProgramUniform1d = (PFNGLPROGRAMUNIFORM1DPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1d")) == NULL) || r;
- r = ((glProgramUniform1dv = (PFNGLPROGRAMUNIFORM1DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1dv")) == NULL) || r;
- r = ((glProgramUniform1f = (PFNGLPROGRAMUNIFORM1FPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1f")) == NULL) || r;
- r = ((glProgramUniform1fv = (PFNGLPROGRAMUNIFORM1FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1fv")) == NULL) || r;
- r = ((glProgramUniform1i = (PFNGLPROGRAMUNIFORM1IPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i")) == NULL) || r;
- r = ((glProgramUniform1iv = (PFNGLPROGRAMUNIFORM1IVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1iv")) == NULL) || r;
- r = ((glProgramUniform1ui = (PFNGLPROGRAMUNIFORM1UIPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui")) == NULL) || r;
- r = ((glProgramUniform1uiv = (PFNGLPROGRAMUNIFORM1UIVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1uiv")) == NULL) || r;
- r = ((glProgramUniform2d = (PFNGLPROGRAMUNIFORM2DPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2d")) == NULL) || r;
- r = ((glProgramUniform2dv = (PFNGLPROGRAMUNIFORM2DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2dv")) == NULL) || r;
- r = ((glProgramUniform2f = (PFNGLPROGRAMUNIFORM2FPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2f")) == NULL) || r;
- r = ((glProgramUniform2fv = (PFNGLPROGRAMUNIFORM2FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2fv")) == NULL) || r;
- r = ((glProgramUniform2i = (PFNGLPROGRAMUNIFORM2IPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i")) == NULL) || r;
- r = ((glProgramUniform2iv = (PFNGLPROGRAMUNIFORM2IVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2iv")) == NULL) || r;
- r = ((glProgramUniform2ui = (PFNGLPROGRAMUNIFORM2UIPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui")) == NULL) || r;
- r = ((glProgramUniform2uiv = (PFNGLPROGRAMUNIFORM2UIVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2uiv")) == NULL) || r;
- r = ((glProgramUniform3d = (PFNGLPROGRAMUNIFORM3DPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3d")) == NULL) || r;
- r = ((glProgramUniform3dv = (PFNGLPROGRAMUNIFORM3DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3dv")) == NULL) || r;
- r = ((glProgramUniform3f = (PFNGLPROGRAMUNIFORM3FPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3f")) == NULL) || r;
- r = ((glProgramUniform3fv = (PFNGLPROGRAMUNIFORM3FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3fv")) == NULL) || r;
- r = ((glProgramUniform3i = (PFNGLPROGRAMUNIFORM3IPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i")) == NULL) || r;
- r = ((glProgramUniform3iv = (PFNGLPROGRAMUNIFORM3IVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3iv")) == NULL) || r;
- r = ((glProgramUniform3ui = (PFNGLPROGRAMUNIFORM3UIPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui")) == NULL) || r;
- r = ((glProgramUniform3uiv = (PFNGLPROGRAMUNIFORM3UIVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3uiv")) == NULL) || r;
- r = ((glProgramUniform4d = (PFNGLPROGRAMUNIFORM4DPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4d")) == NULL) || r;
- r = ((glProgramUniform4dv = (PFNGLPROGRAMUNIFORM4DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4dv")) == NULL) || r;
- r = ((glProgramUniform4f = (PFNGLPROGRAMUNIFORM4FPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4f")) == NULL) || r;
- r = ((glProgramUniform4fv = (PFNGLPROGRAMUNIFORM4FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4fv")) == NULL) || r;
- r = ((glProgramUniform4i = (PFNGLPROGRAMUNIFORM4IPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i")) == NULL) || r;
- r = ((glProgramUniform4iv = (PFNGLPROGRAMUNIFORM4IVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4iv")) == NULL) || r;
- r = ((glProgramUniform4ui = (PFNGLPROGRAMUNIFORM4UIPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui")) == NULL) || r;
- r = ((glProgramUniform4uiv = (PFNGLPROGRAMUNIFORM4UIVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4uiv")) == NULL) || r;
- r = ((glProgramUniformMatrix2dv = (PFNGLPROGRAMUNIFORMMATRIX2DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2dv")) == NULL) || r;
- r = ((glProgramUniformMatrix2fv = (PFNGLPROGRAMUNIFORMMATRIX2FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2fv")) == NULL) || r;
- r = ((glProgramUniformMatrix2x3dv = (PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x3dv")) == NULL) || r;
- r = ((glProgramUniformMatrix2x3fv = (PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x3fv")) == NULL) || r;
- r = ((glProgramUniformMatrix2x4dv = (PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x4dv")) == NULL) || r;
- r = ((glProgramUniformMatrix2x4fv = (PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x4fv")) == NULL) || r;
- r = ((glProgramUniformMatrix3dv = (PFNGLPROGRAMUNIFORMMATRIX3DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3dv")) == NULL) || r;
- r = ((glProgramUniformMatrix3fv = (PFNGLPROGRAMUNIFORMMATRIX3FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3fv")) == NULL) || r;
- r = ((glProgramUniformMatrix3x2dv = (PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x2dv")) == NULL) || r;
- r = ((glProgramUniformMatrix3x2fv = (PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x2fv")) == NULL) || r;
- r = ((glProgramUniformMatrix3x4dv = (PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x4dv")) == NULL) || r;
- r = ((glProgramUniformMatrix3x4fv = (PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x4fv")) == NULL) || r;
- r = ((glProgramUniformMatrix4dv = (PFNGLPROGRAMUNIFORMMATRIX4DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4dv")) == NULL) || r;
- r = ((glProgramUniformMatrix4fv = (PFNGLPROGRAMUNIFORMMATRIX4FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4fv")) == NULL) || r;
- r = ((glProgramUniformMatrix4x2dv = (PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x2dv")) == NULL) || r;
- r = ((glProgramUniformMatrix4x2fv = (PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x2fv")) == NULL) || r;
- r = ((glProgramUniformMatrix4x3dv = (PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x3dv")) == NULL) || r;
- r = ((glProgramUniformMatrix4x3fv = (PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x3fv")) == NULL) || r;
- r = ((glUseProgramStages = (PFNGLUSEPROGRAMSTAGESPROC)glewGetProcAddress((const GLubyte*)"glUseProgramStages")) == NULL) || r;
- r = ((glValidateProgramPipeline = (PFNGLVALIDATEPROGRAMPIPELINEPROC)glewGetProcAddress((const GLubyte*)"glValidateProgramPipeline")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_separate_shader_objects */
-
-#ifdef GL_ARB_shader_atomic_counters
-
-static GLboolean _glewInit_GL_ARB_shader_atomic_counters (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetActiveAtomicCounterBufferiv = (PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveAtomicCounterBufferiv")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_shader_atomic_counters */
-
-#ifdef GL_ARB_shader_bit_encoding
-
-#endif /* GL_ARB_shader_bit_encoding */
-
-#ifdef GL_ARB_shader_draw_parameters
-
-#endif /* GL_ARB_shader_draw_parameters */
-
-#ifdef GL_ARB_shader_group_vote
-
-#endif /* GL_ARB_shader_group_vote */
-
-#ifdef GL_ARB_shader_image_load_store
-
-static GLboolean _glewInit_GL_ARB_shader_image_load_store (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindImageTexture = (PFNGLBINDIMAGETEXTUREPROC)glewGetProcAddress((const GLubyte*)"glBindImageTexture")) == NULL) || r;
- r = ((glMemoryBarrier = (PFNGLMEMORYBARRIERPROC)glewGetProcAddress((const GLubyte*)"glMemoryBarrier")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_shader_image_load_store */
-
-#ifdef GL_ARB_shader_image_size
-
-#endif /* GL_ARB_shader_image_size */
-
-#ifdef GL_ARB_shader_objects
-
-static GLboolean _glewInit_GL_ARB_shader_objects (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glAttachObjectARB")) == NULL) || r;
- r = ((glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)glewGetProcAddress((const GLubyte*)"glCompileShaderARB")) == NULL) || r;
- r = ((glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glCreateProgramObjectARB")) == NULL) || r;
- r = ((glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glCreateShaderObjectARB")) == NULL) || r;
- r = ((glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteObjectARB")) == NULL) || r;
- r = ((glDetachObjectARB = (PFNGLDETACHOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glDetachObjectARB")) == NULL) || r;
- r = ((glGetActiveUniformARB = (PFNGLGETACTIVEUNIFORMARBPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformARB")) == NULL) || r;
- r = ((glGetAttachedObjectsARB = (PFNGLGETATTACHEDOBJECTSARBPROC)glewGetProcAddress((const GLubyte*)"glGetAttachedObjectsARB")) == NULL) || r;
- r = ((glGetHandleARB = (PFNGLGETHANDLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetHandleARB")) == NULL) || r;
- r = ((glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)glewGetProcAddress((const GLubyte*)"glGetInfoLogARB")) == NULL) || r;
- r = ((glGetObjectParameterfvARB = (PFNGLGETOBJECTPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetObjectParameterfvARB")) == NULL) || r;
- r = ((glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetObjectParameterivARB")) == NULL) || r;
- r = ((glGetShaderSourceARB = (PFNGLGETSHADERSOURCEARBPROC)glewGetProcAddress((const GLubyte*)"glGetShaderSourceARB")) == NULL) || r;
- r = ((glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformLocationARB")) == NULL) || r;
- r = ((glGetUniformfvARB = (PFNGLGETUNIFORMFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformfvARB")) == NULL) || r;
- r = ((glGetUniformivARB = (PFNGLGETUNIFORMIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformivARB")) == NULL) || r;
- r = ((glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glLinkProgramARB")) == NULL) || r;
- r = ((glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)glewGetProcAddress((const GLubyte*)"glShaderSourceARB")) == NULL) || r;
- r = ((glUniform1fARB = (PFNGLUNIFORM1FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1fARB")) == NULL) || r;
- r = ((glUniform1fvARB = (PFNGLUNIFORM1FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1fvARB")) == NULL) || r;
- r = ((glUniform1iARB = (PFNGLUNIFORM1IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1iARB")) == NULL) || r;
- r = ((glUniform1ivARB = (PFNGLUNIFORM1IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1ivARB")) == NULL) || r;
- r = ((glUniform2fARB = (PFNGLUNIFORM2FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2fARB")) == NULL) || r;
- r = ((glUniform2fvARB = (PFNGLUNIFORM2FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2fvARB")) == NULL) || r;
- r = ((glUniform2iARB = (PFNGLUNIFORM2IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2iARB")) == NULL) || r;
- r = ((glUniform2ivARB = (PFNGLUNIFORM2IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2ivARB")) == NULL) || r;
- r = ((glUniform3fARB = (PFNGLUNIFORM3FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3fARB")) == NULL) || r;
- r = ((glUniform3fvARB = (PFNGLUNIFORM3FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3fvARB")) == NULL) || r;
- r = ((glUniform3iARB = (PFNGLUNIFORM3IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3iARB")) == NULL) || r;
- r = ((glUniform3ivARB = (PFNGLUNIFORM3IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3ivARB")) == NULL) || r;
- r = ((glUniform4fARB = (PFNGLUNIFORM4FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4fARB")) == NULL) || r;
- r = ((glUniform4fvARB = (PFNGLUNIFORM4FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4fvARB")) == NULL) || r;
- r = ((glUniform4iARB = (PFNGLUNIFORM4IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4iARB")) == NULL) || r;
- r = ((glUniform4ivARB = (PFNGLUNIFORM4IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4ivARB")) == NULL) || r;
- r = ((glUniformMatrix2fvARB = (PFNGLUNIFORMMATRIX2FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2fvARB")) == NULL) || r;
- r = ((glUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3fvARB")) == NULL) || r;
- r = ((glUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4fvARB")) == NULL) || r;
- r = ((glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glUseProgramObjectARB")) == NULL) || r;
- r = ((glValidateProgramARB = (PFNGLVALIDATEPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glValidateProgramARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_shader_objects */
-
-#ifdef GL_ARB_shader_precision
-
-#endif /* GL_ARB_shader_precision */
-
-#ifdef GL_ARB_shader_stencil_export
-
-#endif /* GL_ARB_shader_stencil_export */
-
-#ifdef GL_ARB_shader_storage_buffer_object
-
-static GLboolean _glewInit_GL_ARB_shader_storage_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glShaderStorageBlockBinding = (PFNGLSHADERSTORAGEBLOCKBINDINGPROC)glewGetProcAddress((const GLubyte*)"glShaderStorageBlockBinding")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_shader_storage_buffer_object */
-
-#ifdef GL_ARB_shader_subroutine
-
-static GLboolean _glewInit_GL_ARB_shader_subroutine (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetActiveSubroutineName = (PFNGLGETACTIVESUBROUTINENAMEPROC)glewGetProcAddress((const GLubyte*)"glGetActiveSubroutineName")) == NULL) || r;
- r = ((glGetActiveSubroutineUniformName = (PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)glewGetProcAddress((const GLubyte*)"glGetActiveSubroutineUniformName")) == NULL) || r;
- r = ((glGetActiveSubroutineUniformiv = (PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveSubroutineUniformiv")) == NULL) || r;
- r = ((glGetProgramStageiv = (PFNGLGETPROGRAMSTAGEIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramStageiv")) == NULL) || r;
- r = ((glGetSubroutineIndex = (PFNGLGETSUBROUTINEINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetSubroutineIndex")) == NULL) || r;
- r = ((glGetSubroutineUniformLocation = (PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetSubroutineUniformLocation")) == NULL) || r;
- r = ((glGetUniformSubroutineuiv = (PFNGLGETUNIFORMSUBROUTINEUIVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformSubroutineuiv")) == NULL) || r;
- r = ((glUniformSubroutinesuiv = (PFNGLUNIFORMSUBROUTINESUIVPROC)glewGetProcAddress((const GLubyte*)"glUniformSubroutinesuiv")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_shader_subroutine */
-
-#ifdef GL_ARB_shader_texture_image_samples
-
-#endif /* GL_ARB_shader_texture_image_samples */
-
-#ifdef GL_ARB_shader_texture_lod
-
-#endif /* GL_ARB_shader_texture_lod */
-
-#ifdef GL_ARB_shading_language_100
-
-#endif /* GL_ARB_shading_language_100 */
-
-#ifdef GL_ARB_shading_language_420pack
-
-#endif /* GL_ARB_shading_language_420pack */
-
-#ifdef GL_ARB_shading_language_include
-
-static GLboolean _glewInit_GL_ARB_shading_language_include (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCompileShaderIncludeARB = (PFNGLCOMPILESHADERINCLUDEARBPROC)glewGetProcAddress((const GLubyte*)"glCompileShaderIncludeARB")) == NULL) || r;
- r = ((glDeleteNamedStringARB = (PFNGLDELETENAMEDSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteNamedStringARB")) == NULL) || r;
- r = ((glGetNamedStringARB = (PFNGLGETNAMEDSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glGetNamedStringARB")) == NULL) || r;
- r = ((glGetNamedStringivARB = (PFNGLGETNAMEDSTRINGIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetNamedStringivARB")) == NULL) || r;
- r = ((glIsNamedStringARB = (PFNGLISNAMEDSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glIsNamedStringARB")) == NULL) || r;
- r = ((glNamedStringARB = (PFNGLNAMEDSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glNamedStringARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_shading_language_include */
-
-#ifdef GL_ARB_shading_language_packing
-
-#endif /* GL_ARB_shading_language_packing */
-
-#ifdef GL_ARB_shadow
-
-#endif /* GL_ARB_shadow */
-
-#ifdef GL_ARB_shadow_ambient
-
-#endif /* GL_ARB_shadow_ambient */
-
-#ifdef GL_ARB_sparse_buffer
-
-static GLboolean _glewInit_GL_ARB_sparse_buffer (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBufferPageCommitmentARB = (PFNGLBUFFERPAGECOMMITMENTARBPROC)glewGetProcAddress((const GLubyte*)"glBufferPageCommitmentARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_sparse_buffer */
-
-#ifdef GL_ARB_sparse_texture
-
-static GLboolean _glewInit_GL_ARB_sparse_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTexPageCommitmentARB = (PFNGLTEXPAGECOMMITMENTARBPROC)glewGetProcAddress((const GLubyte*)"glTexPageCommitmentARB")) == NULL) || r;
- r = ((glTexturePageCommitmentEXT = (PFNGLTEXTUREPAGECOMMITMENTEXTPROC)glewGetProcAddress((const GLubyte*)"glTexturePageCommitmentEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_sparse_texture */
-
-#ifdef GL_ARB_stencil_texturing
-
-#endif /* GL_ARB_stencil_texturing */
-
-#ifdef GL_ARB_sync
-
-static GLboolean _glewInit_GL_ARB_sync (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)glewGetProcAddress((const GLubyte*)"glClientWaitSync")) == NULL) || r;
- r = ((glDeleteSync = (PFNGLDELETESYNCPROC)glewGetProcAddress((const GLubyte*)"glDeleteSync")) == NULL) || r;
- r = ((glFenceSync = (PFNGLFENCESYNCPROC)glewGetProcAddress((const GLubyte*)"glFenceSync")) == NULL) || r;
- r = ((glGetInteger64v = (PFNGLGETINTEGER64VPROC)glewGetProcAddress((const GLubyte*)"glGetInteger64v")) == NULL) || r;
- r = ((glGetSynciv = (PFNGLGETSYNCIVPROC)glewGetProcAddress((const GLubyte*)"glGetSynciv")) == NULL) || r;
- r = ((glIsSync = (PFNGLISSYNCPROC)glewGetProcAddress((const GLubyte*)"glIsSync")) == NULL) || r;
- r = ((glWaitSync = (PFNGLWAITSYNCPROC)glewGetProcAddress((const GLubyte*)"glWaitSync")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_sync */
-
-#ifdef GL_ARB_tessellation_shader
-
-static GLboolean _glewInit_GL_ARB_tessellation_shader (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glPatchParameterfv = (PFNGLPATCHPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glPatchParameterfv")) == NULL) || r;
- r = ((glPatchParameteri = (PFNGLPATCHPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glPatchParameteri")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_tessellation_shader */
-
-#ifdef GL_ARB_texture_barrier
-
-static GLboolean _glewInit_GL_ARB_texture_barrier (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTextureBarrier = (PFNGLTEXTUREBARRIERPROC)glewGetProcAddress((const GLubyte*)"glTextureBarrier")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_texture_barrier */
-
-#ifdef GL_ARB_texture_border_clamp
-
-#endif /* GL_ARB_texture_border_clamp */
-
-#ifdef GL_ARB_texture_buffer_object
-
-static GLboolean _glewInit_GL_ARB_texture_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTexBufferARB = (PFNGLTEXBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glTexBufferARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_texture_buffer_object */
-
-#ifdef GL_ARB_texture_buffer_object_rgb32
-
-#endif /* GL_ARB_texture_buffer_object_rgb32 */
-
-#ifdef GL_ARB_texture_buffer_range
-
-static GLboolean _glewInit_GL_ARB_texture_buffer_range (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTexBufferRange = (PFNGLTEXBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glTexBufferRange")) == NULL) || r;
- r = ((glTextureBufferRangeEXT = (PFNGLTEXTUREBUFFERRANGEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureBufferRangeEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_texture_buffer_range */
-
-#ifdef GL_ARB_texture_compression
-
-static GLboolean _glewInit_GL_ARB_texture_compression (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCompressedTexImage1DARB = (PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage1DARB")) == NULL) || r;
- r = ((glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage2DARB")) == NULL) || r;
- r = ((glCompressedTexImage3DARB = (PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage3DARB")) == NULL) || r;
- r = ((glCompressedTexSubImage1DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage1DARB")) == NULL) || r;
- r = ((glCompressedTexSubImage2DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage2DARB")) == NULL) || r;
- r = ((glCompressedTexSubImage3DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage3DARB")) == NULL) || r;
- r = ((glGetCompressedTexImageARB = (PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTexImageARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_texture_compression */
-
-#ifdef GL_ARB_texture_compression_bptc
-
-#endif /* GL_ARB_texture_compression_bptc */
-
-#ifdef GL_ARB_texture_compression_rgtc
-
-#endif /* GL_ARB_texture_compression_rgtc */
-
-#ifdef GL_ARB_texture_cube_map
-
-#endif /* GL_ARB_texture_cube_map */
-
-#ifdef GL_ARB_texture_cube_map_array
-
-#endif /* GL_ARB_texture_cube_map_array */
-
-#ifdef GL_ARB_texture_env_add
-
-#endif /* GL_ARB_texture_env_add */
-
-#ifdef GL_ARB_texture_env_combine
-
-#endif /* GL_ARB_texture_env_combine */
-
-#ifdef GL_ARB_texture_env_crossbar
-
-#endif /* GL_ARB_texture_env_crossbar */
-
-#ifdef GL_ARB_texture_env_dot3
-
-#endif /* GL_ARB_texture_env_dot3 */
-
-#ifdef GL_ARB_texture_float
-
-#endif /* GL_ARB_texture_float */
-
-#ifdef GL_ARB_texture_gather
-
-#endif /* GL_ARB_texture_gather */
-
-#ifdef GL_ARB_texture_mirror_clamp_to_edge
-
-#endif /* GL_ARB_texture_mirror_clamp_to_edge */
-
-#ifdef GL_ARB_texture_mirrored_repeat
-
-#endif /* GL_ARB_texture_mirrored_repeat */
-
-#ifdef GL_ARB_texture_multisample
-
-static GLboolean _glewInit_GL_ARB_texture_multisample (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)glewGetProcAddress((const GLubyte*)"glGetMultisamplefv")) == NULL) || r;
- r = ((glSampleMaski = (PFNGLSAMPLEMASKIPROC)glewGetProcAddress((const GLubyte*)"glSampleMaski")) == NULL) || r;
- r = ((glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexImage2DMultisample")) == NULL) || r;
- r = ((glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexImage3DMultisample")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_texture_multisample */
-
-#ifdef GL_ARB_texture_non_power_of_two
-
-#endif /* GL_ARB_texture_non_power_of_two */
-
-#ifdef GL_ARB_texture_query_levels
-
-#endif /* GL_ARB_texture_query_levels */
-
-#ifdef GL_ARB_texture_query_lod
-
-#endif /* GL_ARB_texture_query_lod */
-
-#ifdef GL_ARB_texture_rectangle
-
-#endif /* GL_ARB_texture_rectangle */
-
-#ifdef GL_ARB_texture_rg
-
-#endif /* GL_ARB_texture_rg */
-
-#ifdef GL_ARB_texture_rgb10_a2ui
-
-#endif /* GL_ARB_texture_rgb10_a2ui */
-
-#ifdef GL_ARB_texture_stencil8
-
-#endif /* GL_ARB_texture_stencil8 */
-
-#ifdef GL_ARB_texture_storage
-
-static GLboolean _glewInit_GL_ARB_texture_storage (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTexStorage1D = (PFNGLTEXSTORAGE1DPROC)glewGetProcAddress((const GLubyte*)"glTexStorage1D")) == NULL) || r;
- r = ((glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)glewGetProcAddress((const GLubyte*)"glTexStorage2D")) == NULL) || r;
- r = ((glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTexStorage3D")) == NULL) || r;
- glTextureStorage1DEXT = (PFNGLTEXTURESTORAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage1DEXT");
- glTextureStorage2DEXT = (PFNGLTEXTURESTORAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2DEXT");
- glTextureStorage3DEXT = (PFNGLTEXTURESTORAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3DEXT");
-
- return r;
-}
-
-#endif /* GL_ARB_texture_storage */
-
-#ifdef GL_ARB_texture_storage_multisample
-
-static GLboolean _glewInit_GL_ARB_texture_storage_multisample (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTexStorage2DMultisample = (PFNGLTEXSTORAGE2DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexStorage2DMultisample")) == NULL) || r;
- r = ((glTexStorage3DMultisample = (PFNGLTEXSTORAGE3DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexStorage3DMultisample")) == NULL) || r;
- glTextureStorage2DMultisampleEXT = (PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2DMultisampleEXT");
- glTextureStorage3DMultisampleEXT = (PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3DMultisampleEXT");
-
- return r;
-}
-
-#endif /* GL_ARB_texture_storage_multisample */
-
-#ifdef GL_ARB_texture_swizzle
-
-#endif /* GL_ARB_texture_swizzle */
-
-#ifdef GL_ARB_texture_view
-
-static GLboolean _glewInit_GL_ARB_texture_view (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTextureView = (PFNGLTEXTUREVIEWPROC)glewGetProcAddress((const GLubyte*)"glTextureView")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_texture_view */
-
-#ifdef GL_ARB_timer_query
-
-static GLboolean _glewInit_GL_ARB_timer_query (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjecti64v")) == NULL) || r;
- r = ((glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectui64v")) == NULL) || r;
- r = ((glQueryCounter = (PFNGLQUERYCOUNTERPROC)glewGetProcAddress((const GLubyte*)"glQueryCounter")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_timer_query */
-
-#ifdef GL_ARB_transform_feedback2
-
-static GLboolean _glewInit_GL_ARB_transform_feedback2 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glBindTransformFeedback")) == NULL) || r;
- r = ((glDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC)glewGetProcAddress((const GLubyte*)"glDeleteTransformFeedbacks")) == NULL) || r;
- r = ((glDrawTransformFeedback = (PFNGLDRAWTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedback")) == NULL) || r;
- r = ((glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC)glewGetProcAddress((const GLubyte*)"glGenTransformFeedbacks")) == NULL) || r;
- r = ((glIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glIsTransformFeedback")) == NULL) || r;
- r = ((glPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glPauseTransformFeedback")) == NULL) || r;
- r = ((glResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glResumeTransformFeedback")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_transform_feedback2 */
-
-#ifdef GL_ARB_transform_feedback3
-
-static GLboolean _glewInit_GL_ARB_transform_feedback3 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginQueryIndexed = (PFNGLBEGINQUERYINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glBeginQueryIndexed")) == NULL) || r;
- r = ((glDrawTransformFeedbackStream = (PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedbackStream")) == NULL) || r;
- r = ((glEndQueryIndexed = (PFNGLENDQUERYINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glEndQueryIndexed")) == NULL) || r;
- r = ((glGetQueryIndexediv = (PFNGLGETQUERYINDEXEDIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryIndexediv")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_transform_feedback3 */
-
-#ifdef GL_ARB_transform_feedback_instanced
-
-static GLboolean _glewInit_GL_ARB_transform_feedback_instanced (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawTransformFeedbackInstanced = (PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedbackInstanced")) == NULL) || r;
- r = ((glDrawTransformFeedbackStreamInstanced = (PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedbackStreamInstanced")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_transform_feedback_instanced */
-
-#ifdef GL_ARB_transform_feedback_overflow_query
-
-#endif /* GL_ARB_transform_feedback_overflow_query */
-
-#ifdef GL_ARB_transpose_matrix
-
-static GLboolean _glewInit_GL_ARB_transpose_matrix (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glLoadTransposeMatrixdARB = (PFNGLLOADTRANSPOSEMATRIXDARBPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixdARB")) == NULL) || r;
- r = ((glLoadTransposeMatrixfARB = (PFNGLLOADTRANSPOSEMATRIXFARBPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixfARB")) == NULL) || r;
- r = ((glMultTransposeMatrixdARB = (PFNGLMULTTRANSPOSEMATRIXDARBPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixdARB")) == NULL) || r;
- r = ((glMultTransposeMatrixfARB = (PFNGLMULTTRANSPOSEMATRIXFARBPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixfARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_transpose_matrix */
-
-#ifdef GL_ARB_uniform_buffer_object
-
-static GLboolean _glewInit_GL_ARB_uniform_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)glewGetProcAddress((const GLubyte*)"glBindBufferBase")) == NULL) || r;
- r = ((glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glBindBufferRange")) == NULL) || r;
- r = ((glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformBlockName")) == NULL) || r;
- r = ((glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformBlockiv")) == NULL) || r;
- r = ((glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformName")) == NULL) || r;
- r = ((glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformsiv")) == NULL) || r;
- r = ((glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)glewGetProcAddress((const GLubyte*)"glGetIntegeri_v")) == NULL) || r;
- r = ((glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetUniformBlockIndex")) == NULL) || r;
- r = ((glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)glewGetProcAddress((const GLubyte*)"glGetUniformIndices")) == NULL) || r;
- r = ((glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)glewGetProcAddress((const GLubyte*)"glUniformBlockBinding")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_uniform_buffer_object */
-
-#ifdef GL_ARB_vertex_array_bgra
-
-#endif /* GL_ARB_vertex_array_bgra */
-
-#ifdef GL_ARB_vertex_array_object
-
-static GLboolean _glewInit_GL_ARB_vertex_array_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)glewGetProcAddress((const GLubyte*)"glBindVertexArray")) == NULL) || r;
- r = ((glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)glewGetProcAddress((const GLubyte*)"glDeleteVertexArrays")) == NULL) || r;
- r = ((glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)glewGetProcAddress((const GLubyte*)"glGenVertexArrays")) == NULL) || r;
- r = ((glIsVertexArray = (PFNGLISVERTEXARRAYPROC)glewGetProcAddress((const GLubyte*)"glIsVertexArray")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_vertex_array_object */
-
-#ifdef GL_ARB_vertex_attrib_64bit
-
-static GLboolean _glewInit_GL_ARB_vertex_attrib_64bit (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetVertexAttribLdv = (PFNGLGETVERTEXATTRIBLDVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLdv")) == NULL) || r;
- r = ((glVertexAttribL1d = (PFNGLVERTEXATTRIBL1DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1d")) == NULL) || r;
- r = ((glVertexAttribL1dv = (PFNGLVERTEXATTRIBL1DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1dv")) == NULL) || r;
- r = ((glVertexAttribL2d = (PFNGLVERTEXATTRIBL2DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2d")) == NULL) || r;
- r = ((glVertexAttribL2dv = (PFNGLVERTEXATTRIBL2DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2dv")) == NULL) || r;
- r = ((glVertexAttribL3d = (PFNGLVERTEXATTRIBL3DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3d")) == NULL) || r;
- r = ((glVertexAttribL3dv = (PFNGLVERTEXATTRIBL3DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3dv")) == NULL) || r;
- r = ((glVertexAttribL4d = (PFNGLVERTEXATTRIBL4DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4d")) == NULL) || r;
- r = ((glVertexAttribL4dv = (PFNGLVERTEXATTRIBL4DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4dv")) == NULL) || r;
- r = ((glVertexAttribLPointer = (PFNGLVERTEXATTRIBLPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribLPointer")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_vertex_attrib_64bit */
-
-#ifdef GL_ARB_vertex_attrib_binding
-
-static GLboolean _glewInit_GL_ARB_vertex_attrib_binding (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindVertexBuffer = (PFNGLBINDVERTEXBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindVertexBuffer")) == NULL) || r;
- r = ((glVertexArrayBindVertexBufferEXT = (PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayBindVertexBufferEXT")) == NULL) || r;
- r = ((glVertexArrayVertexAttribBindingEXT = (PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribBindingEXT")) == NULL) || r;
- r = ((glVertexArrayVertexAttribFormatEXT = (PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribFormatEXT")) == NULL) || r;
- r = ((glVertexArrayVertexAttribIFormatEXT = (PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribIFormatEXT")) == NULL) || r;
- r = ((glVertexArrayVertexAttribLFormatEXT = (PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribLFormatEXT")) == NULL) || r;
- r = ((glVertexArrayVertexBindingDivisorEXT = (PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexBindingDivisorEXT")) == NULL) || r;
- r = ((glVertexAttribBinding = (PFNGLVERTEXATTRIBBINDINGPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribBinding")) == NULL) || r;
- r = ((glVertexAttribFormat = (PFNGLVERTEXATTRIBFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribFormat")) == NULL) || r;
- r = ((glVertexAttribIFormat = (PFNGLVERTEXATTRIBIFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribIFormat")) == NULL) || r;
- r = ((glVertexAttribLFormat = (PFNGLVERTEXATTRIBLFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribLFormat")) == NULL) || r;
- r = ((glVertexBindingDivisor = (PFNGLVERTEXBINDINGDIVISORPROC)glewGetProcAddress((const GLubyte*)"glVertexBindingDivisor")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_vertex_attrib_binding */
-
-#ifdef GL_ARB_vertex_blend
-
-static GLboolean _glewInit_GL_ARB_vertex_blend (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glVertexBlendARB = (PFNGLVERTEXBLENDARBPROC)glewGetProcAddress((const GLubyte*)"glVertexBlendARB")) == NULL) || r;
- r = ((glWeightPointerARB = (PFNGLWEIGHTPOINTERARBPROC)glewGetProcAddress((const GLubyte*)"glWeightPointerARB")) == NULL) || r;
- r = ((glWeightbvARB = (PFNGLWEIGHTBVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightbvARB")) == NULL) || r;
- r = ((glWeightdvARB = (PFNGLWEIGHTDVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightdvARB")) == NULL) || r;
- r = ((glWeightfvARB = (PFNGLWEIGHTFVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightfvARB")) == NULL) || r;
- r = ((glWeightivARB = (PFNGLWEIGHTIVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightivARB")) == NULL) || r;
- r = ((glWeightsvARB = (PFNGLWEIGHTSVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightsvARB")) == NULL) || r;
- r = ((glWeightubvARB = (PFNGLWEIGHTUBVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightubvARB")) == NULL) || r;
- r = ((glWeightuivARB = (PFNGLWEIGHTUIVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightuivARB")) == NULL) || r;
- r = ((glWeightusvARB = (PFNGLWEIGHTUSVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightusvARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_vertex_blend */
-
-#ifdef GL_ARB_vertex_buffer_object
-
-static GLboolean _glewInit_GL_ARB_vertex_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindBufferARB = (PFNGLBINDBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glBindBufferARB")) == NULL) || r;
- r = ((glBufferDataARB = (PFNGLBUFFERDATAARBPROC)glewGetProcAddress((const GLubyte*)"glBufferDataARB")) == NULL) || r;
- r = ((glBufferSubDataARB = (PFNGLBUFFERSUBDATAARBPROC)glewGetProcAddress((const GLubyte*)"glBufferSubDataARB")) == NULL) || r;
- r = ((glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteBuffersARB")) == NULL) || r;
- r = ((glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glGenBuffersARB")) == NULL) || r;
- r = ((glGetBufferParameterivARB = (PFNGLGETBUFFERPARAMETERIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameterivARB")) == NULL) || r;
- r = ((glGetBufferPointervARB = (PFNGLGETBUFFERPOINTERVARBPROC)glewGetProcAddress((const GLubyte*)"glGetBufferPointervARB")) == NULL) || r;
- r = ((glGetBufferSubDataARB = (PFNGLGETBUFFERSUBDATAARBPROC)glewGetProcAddress((const GLubyte*)"glGetBufferSubDataARB")) == NULL) || r;
- r = ((glIsBufferARB = (PFNGLISBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glIsBufferARB")) == NULL) || r;
- r = ((glMapBufferARB = (PFNGLMAPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glMapBufferARB")) == NULL) || r;
- r = ((glUnmapBufferARB = (PFNGLUNMAPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glUnmapBufferARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_vertex_buffer_object */
-
-#ifdef GL_ARB_vertex_program
-
-static GLboolean _glewInit_GL_ARB_vertex_program (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindProgramARB = (PFNGLBINDPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glBindProgramARB")) == NULL) || r;
- r = ((glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgramsARB")) == NULL) || r;
- r = ((glDisableVertexAttribArrayARB = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexAttribArrayARB")) == NULL) || r;
- r = ((glEnableVertexAttribArrayARB = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexAttribArrayARB")) == NULL) || r;
- r = ((glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC)glewGetProcAddress((const GLubyte*)"glGenProgramsARB")) == NULL) || r;
- r = ((glGetProgramEnvParameterdvARB = (PFNGLGETPROGRAMENVPARAMETERDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramEnvParameterdvARB")) == NULL) || r;
- r = ((glGetProgramEnvParameterfvARB = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramEnvParameterfvARB")) == NULL) || r;
- r = ((glGetProgramLocalParameterdvARB = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramLocalParameterdvARB")) == NULL) || r;
- r = ((glGetProgramLocalParameterfvARB = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramLocalParameterfvARB")) == NULL) || r;
- r = ((glGetProgramStringARB = (PFNGLGETPROGRAMSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramStringARB")) == NULL) || r;
- r = ((glGetProgramivARB = (PFNGLGETPROGRAMIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramivARB")) == NULL) || r;
- r = ((glGetVertexAttribPointervARB = (PFNGLGETVERTEXATTRIBPOINTERVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribPointervARB")) == NULL) || r;
- r = ((glGetVertexAttribdvARB = (PFNGLGETVERTEXATTRIBDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribdvARB")) == NULL) || r;
- r = ((glGetVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribfvARB")) == NULL) || r;
- r = ((glGetVertexAttribivARB = (PFNGLGETVERTEXATTRIBIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribivARB")) == NULL) || r;
- r = ((glIsProgramARB = (PFNGLISPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glIsProgramARB")) == NULL) || r;
- r = ((glProgramEnvParameter4dARB = (PFNGLPROGRAMENVPARAMETER4DARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4dARB")) == NULL) || r;
- r = ((glProgramEnvParameter4dvARB = (PFNGLPROGRAMENVPARAMETER4DVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4dvARB")) == NULL) || r;
- r = ((glProgramEnvParameter4fARB = (PFNGLPROGRAMENVPARAMETER4FARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4fARB")) == NULL) || r;
- r = ((glProgramEnvParameter4fvARB = (PFNGLPROGRAMENVPARAMETER4FVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4fvARB")) == NULL) || r;
- r = ((glProgramLocalParameter4dARB = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4dARB")) == NULL) || r;
- r = ((glProgramLocalParameter4dvARB = (PFNGLPROGRAMLOCALPARAMETER4DVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4dvARB")) == NULL) || r;
- r = ((glProgramLocalParameter4fARB = (PFNGLPROGRAMLOCALPARAMETER4FARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4fARB")) == NULL) || r;
- r = ((glProgramLocalParameter4fvARB = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4fvARB")) == NULL) || r;
- r = ((glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glProgramStringARB")) == NULL) || r;
- r = ((glVertexAttrib1dARB = (PFNGLVERTEXATTRIB1DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dARB")) == NULL) || r;
- r = ((glVertexAttrib1dvARB = (PFNGLVERTEXATTRIB1DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dvARB")) == NULL) || r;
- r = ((glVertexAttrib1fARB = (PFNGLVERTEXATTRIB1FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fARB")) == NULL) || r;
- r = ((glVertexAttrib1fvARB = (PFNGLVERTEXATTRIB1FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fvARB")) == NULL) || r;
- r = ((glVertexAttrib1sARB = (PFNGLVERTEXATTRIB1SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1sARB")) == NULL) || r;
- r = ((glVertexAttrib1svARB = (PFNGLVERTEXATTRIB1SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1svARB")) == NULL) || r;
- r = ((glVertexAttrib2dARB = (PFNGLVERTEXATTRIB2DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dARB")) == NULL) || r;
- r = ((glVertexAttrib2dvARB = (PFNGLVERTEXATTRIB2DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dvARB")) == NULL) || r;
- r = ((glVertexAttrib2fARB = (PFNGLVERTEXATTRIB2FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fARB")) == NULL) || r;
- r = ((glVertexAttrib2fvARB = (PFNGLVERTEXATTRIB2FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fvARB")) == NULL) || r;
- r = ((glVertexAttrib2sARB = (PFNGLVERTEXATTRIB2SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2sARB")) == NULL) || r;
- r = ((glVertexAttrib2svARB = (PFNGLVERTEXATTRIB2SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2svARB")) == NULL) || r;
- r = ((glVertexAttrib3dARB = (PFNGLVERTEXATTRIB3DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dARB")) == NULL) || r;
- r = ((glVertexAttrib3dvARB = (PFNGLVERTEXATTRIB3DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dvARB")) == NULL) || r;
- r = ((glVertexAttrib3fARB = (PFNGLVERTEXATTRIB3FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fARB")) == NULL) || r;
- r = ((glVertexAttrib3fvARB = (PFNGLVERTEXATTRIB3FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fvARB")) == NULL) || r;
- r = ((glVertexAttrib3sARB = (PFNGLVERTEXATTRIB3SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3sARB")) == NULL) || r;
- r = ((glVertexAttrib3svARB = (PFNGLVERTEXATTRIB3SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3svARB")) == NULL) || r;
- r = ((glVertexAttrib4NbvARB = (PFNGLVERTEXATTRIB4NBVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NbvARB")) == NULL) || r;
- r = ((glVertexAttrib4NivARB = (PFNGLVERTEXATTRIB4NIVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NivARB")) == NULL) || r;
- r = ((glVertexAttrib4NsvARB = (PFNGLVERTEXATTRIB4NSVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NsvARB")) == NULL) || r;
- r = ((glVertexAttrib4NubARB = (PFNGLVERTEXATTRIB4NUBARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NubARB")) == NULL) || r;
- r = ((glVertexAttrib4NubvARB = (PFNGLVERTEXATTRIB4NUBVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NubvARB")) == NULL) || r;
- r = ((glVertexAttrib4NuivARB = (PFNGLVERTEXATTRIB4NUIVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NuivARB")) == NULL) || r;
- r = ((glVertexAttrib4NusvARB = (PFNGLVERTEXATTRIB4NUSVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NusvARB")) == NULL) || r;
- r = ((glVertexAttrib4bvARB = (PFNGLVERTEXATTRIB4BVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4bvARB")) == NULL) || r;
- r = ((glVertexAttrib4dARB = (PFNGLVERTEXATTRIB4DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dARB")) == NULL) || r;
- r = ((glVertexAttrib4dvARB = (PFNGLVERTEXATTRIB4DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dvARB")) == NULL) || r;
- r = ((glVertexAttrib4fARB = (PFNGLVERTEXATTRIB4FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fARB")) == NULL) || r;
- r = ((glVertexAttrib4fvARB = (PFNGLVERTEXATTRIB4FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fvARB")) == NULL) || r;
- r = ((glVertexAttrib4ivARB = (PFNGLVERTEXATTRIB4IVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ivARB")) == NULL) || r;
- r = ((glVertexAttrib4sARB = (PFNGLVERTEXATTRIB4SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4sARB")) == NULL) || r;
- r = ((glVertexAttrib4svARB = (PFNGLVERTEXATTRIB4SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4svARB")) == NULL) || r;
- r = ((glVertexAttrib4ubvARB = (PFNGLVERTEXATTRIB4UBVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubvARB")) == NULL) || r;
- r = ((glVertexAttrib4uivARB = (PFNGLVERTEXATTRIB4UIVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4uivARB")) == NULL) || r;
- r = ((glVertexAttrib4usvARB = (PFNGLVERTEXATTRIB4USVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4usvARB")) == NULL) || r;
- r = ((glVertexAttribPointerARB = (PFNGLVERTEXATTRIBPOINTERARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointerARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_vertex_program */
-
-#ifdef GL_ARB_vertex_shader
-
-static GLboolean _glewInit_GL_ARB_vertex_shader (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC)glewGetProcAddress((const GLubyte*)"glBindAttribLocationARB")) == NULL) || r;
- r = ((glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC)glewGetProcAddress((const GLubyte*)"glGetActiveAttribARB")) == NULL) || r;
- r = ((glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)glewGetProcAddress((const GLubyte*)"glGetAttribLocationARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_vertex_shader */
-
-#ifdef GL_ARB_vertex_type_10f_11f_11f_rev
-
-#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */
-
-#ifdef GL_ARB_vertex_type_2_10_10_10_rev
-
-static GLboolean _glewInit_GL_ARB_vertex_type_2_10_10_10_rev (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
- GLboolean core = GL_FALSE;
-
- core = ((glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP1ui")) == NULL) || core;
- core = ((glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP1uiv")) == NULL) || core;
- core = ((glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP2ui")) == NULL) || core;
- core = ((glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP2uiv")) == NULL) || core;
- core = ((glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP3ui")) == NULL) || core;
- core = ((glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP3uiv")) == NULL) || core;
- core = ((glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP4ui")) == NULL) || core;
- core = ((glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP4uiv")) == NULL) || core;
- r = core;
-
- r = ((glColorP3ui = (PFNGLCOLORP3UIPROC)glewGetProcAddress((const GLubyte*)"glColorP3ui")) == NULL) || r;
- r = ((glColorP3uiv = (PFNGLCOLORP3UIVPROC)glewGetProcAddress((const GLubyte*)"glColorP3uiv")) == NULL) || r;
- r = ((glColorP4ui = (PFNGLCOLORP4UIPROC)glewGetProcAddress((const GLubyte*)"glColorP4ui")) == NULL) || r;
- r = ((glColorP4uiv = (PFNGLCOLORP4UIVPROC)glewGetProcAddress((const GLubyte*)"glColorP4uiv")) == NULL) || r;
- r = ((glMultiTexCoordP1ui = (PFNGLMULTITEXCOORDP1UIPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP1ui")) == NULL) || r;
- r = ((glMultiTexCoordP1uiv = (PFNGLMULTITEXCOORDP1UIVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP1uiv")) == NULL) || r;
- r = ((glMultiTexCoordP2ui = (PFNGLMULTITEXCOORDP2UIPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP2ui")) == NULL) || r;
- r = ((glMultiTexCoordP2uiv = (PFNGLMULTITEXCOORDP2UIVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP2uiv")) == NULL) || r;
- r = ((glMultiTexCoordP3ui = (PFNGLMULTITEXCOORDP3UIPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP3ui")) == NULL) || r;
- r = ((glMultiTexCoordP3uiv = (PFNGLMULTITEXCOORDP3UIVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP3uiv")) == NULL) || r;
- r = ((glMultiTexCoordP4ui = (PFNGLMULTITEXCOORDP4UIPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP4ui")) == NULL) || r;
- r = ((glMultiTexCoordP4uiv = (PFNGLMULTITEXCOORDP4UIVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP4uiv")) == NULL) || r;
- r = ((glNormalP3ui = (PFNGLNORMALP3UIPROC)glewGetProcAddress((const GLubyte*)"glNormalP3ui")) == NULL) || r;
- r = ((glNormalP3uiv = (PFNGLNORMALP3UIVPROC)glewGetProcAddress((const GLubyte*)"glNormalP3uiv")) == NULL) || r;
- r = ((glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorP3ui")) == NULL) || r;
- r = ((glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorP3uiv")) == NULL) || r;
- r = ((glTexCoordP1ui = (PFNGLTEXCOORDP1UIPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP1ui")) == NULL) || r;
- r = ((glTexCoordP1uiv = (PFNGLTEXCOORDP1UIVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP1uiv")) == NULL) || r;
- r = ((glTexCoordP2ui = (PFNGLTEXCOORDP2UIPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP2ui")) == NULL) || r;
- r = ((glTexCoordP2uiv = (PFNGLTEXCOORDP2UIVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP2uiv")) == NULL) || r;
- r = ((glTexCoordP3ui = (PFNGLTEXCOORDP3UIPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP3ui")) == NULL) || r;
- r = ((glTexCoordP3uiv = (PFNGLTEXCOORDP3UIVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP3uiv")) == NULL) || r;
- r = ((glTexCoordP4ui = (PFNGLTEXCOORDP4UIPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP4ui")) == NULL) || r;
- r = ((glTexCoordP4uiv = (PFNGLTEXCOORDP4UIVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP4uiv")) == NULL) || r;
- r = ((glVertexP2ui = (PFNGLVERTEXP2UIPROC)glewGetProcAddress((const GLubyte*)"glVertexP2ui")) == NULL) || r;
- r = ((glVertexP2uiv = (PFNGLVERTEXP2UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexP2uiv")) == NULL) || r;
- r = ((glVertexP3ui = (PFNGLVERTEXP3UIPROC)glewGetProcAddress((const GLubyte*)"glVertexP3ui")) == NULL) || r;
- r = ((glVertexP3uiv = (PFNGLVERTEXP3UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexP3uiv")) == NULL) || r;
- r = ((glVertexP4ui = (PFNGLVERTEXP4UIPROC)glewGetProcAddress((const GLubyte*)"glVertexP4ui")) == NULL) || r;
- r = ((glVertexP4uiv = (PFNGLVERTEXP4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexP4uiv")) == NULL) || r;
-
- // core 3.2+ only needs the core methods
- if (GLEW_VERSION_3_2 && !core)
- {
- r = 0;
- }
-
- return r;
-}
-
-#endif /* GL_ARB_vertex_type_2_10_10_10_rev */
-
-#ifdef GL_ARB_viewport_array
-
-static GLboolean _glewInit_GL_ARB_viewport_array (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDepthRangeArrayv = (PFNGLDEPTHRANGEARRAYVPROC)glewGetProcAddress((const GLubyte*)"glDepthRangeArrayv")) == NULL) || r;
- r = ((glDepthRangeIndexed = (PFNGLDEPTHRANGEINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glDepthRangeIndexed")) == NULL) || r;
- r = ((glGetDoublei_v = (PFNGLGETDOUBLEI_VPROC)glewGetProcAddress((const GLubyte*)"glGetDoublei_v")) == NULL) || r;
- r = ((glGetFloati_v = (PFNGLGETFLOATI_VPROC)glewGetProcAddress((const GLubyte*)"glGetFloati_v")) == NULL) || r;
- r = ((glScissorArrayv = (PFNGLSCISSORARRAYVPROC)glewGetProcAddress((const GLubyte*)"glScissorArrayv")) == NULL) || r;
- r = ((glScissorIndexed = (PFNGLSCISSORINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glScissorIndexed")) == NULL) || r;
- r = ((glScissorIndexedv = (PFNGLSCISSORINDEXEDVPROC)glewGetProcAddress((const GLubyte*)"glScissorIndexedv")) == NULL) || r;
- r = ((glViewportArrayv = (PFNGLVIEWPORTARRAYVPROC)glewGetProcAddress((const GLubyte*)"glViewportArrayv")) == NULL) || r;
- r = ((glViewportIndexedf = (PFNGLVIEWPORTINDEXEDFPROC)glewGetProcAddress((const GLubyte*)"glViewportIndexedf")) == NULL) || r;
- r = ((glViewportIndexedfv = (PFNGLVIEWPORTINDEXEDFVPROC)glewGetProcAddress((const GLubyte*)"glViewportIndexedfv")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_viewport_array */
-
-#ifdef GL_ARB_window_pos
-
-static GLboolean _glewInit_GL_ARB_window_pos (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glWindowPos2dARB = (PFNGLWINDOWPOS2DARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dARB")) == NULL) || r;
- r = ((glWindowPos2dvARB = (PFNGLWINDOWPOS2DVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dvARB")) == NULL) || r;
- r = ((glWindowPos2fARB = (PFNGLWINDOWPOS2FARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fARB")) == NULL) || r;
- r = ((glWindowPos2fvARB = (PFNGLWINDOWPOS2FVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fvARB")) == NULL) || r;
- r = ((glWindowPos2iARB = (PFNGLWINDOWPOS2IARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2iARB")) == NULL) || r;
- r = ((glWindowPos2ivARB = (PFNGLWINDOWPOS2IVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2ivARB")) == NULL) || r;
- r = ((glWindowPos2sARB = (PFNGLWINDOWPOS2SARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2sARB")) == NULL) || r;
- r = ((glWindowPos2svARB = (PFNGLWINDOWPOS2SVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2svARB")) == NULL) || r;
- r = ((glWindowPos3dARB = (PFNGLWINDOWPOS3DARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dARB")) == NULL) || r;
- r = ((glWindowPos3dvARB = (PFNGLWINDOWPOS3DVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dvARB")) == NULL) || r;
- r = ((glWindowPos3fARB = (PFNGLWINDOWPOS3FARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fARB")) == NULL) || r;
- r = ((glWindowPos3fvARB = (PFNGLWINDOWPOS3FVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fvARB")) == NULL) || r;
- r = ((glWindowPos3iARB = (PFNGLWINDOWPOS3IARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3iARB")) == NULL) || r;
- r = ((glWindowPos3ivARB = (PFNGLWINDOWPOS3IVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3ivARB")) == NULL) || r;
- r = ((glWindowPos3sARB = (PFNGLWINDOWPOS3SARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3sARB")) == NULL) || r;
- r = ((glWindowPos3svARB = (PFNGLWINDOWPOS3SVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3svARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ARB_window_pos */
-
-#ifdef GL_ATIX_point_sprites
-
-#endif /* GL_ATIX_point_sprites */
-
-#ifdef GL_ATIX_texture_env_combine3
-
-#endif /* GL_ATIX_texture_env_combine3 */
-
-#ifdef GL_ATIX_texture_env_route
-
-#endif /* GL_ATIX_texture_env_route */
-
-#ifdef GL_ATIX_vertex_shader_output_point_size
-
-#endif /* GL_ATIX_vertex_shader_output_point_size */
-
-#ifdef GL_ATI_draw_buffers
-
-static GLboolean _glewInit_GL_ATI_draw_buffers (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawBuffersATI = (PFNGLDRAWBUFFERSATIPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffersATI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ATI_draw_buffers */
-
-#ifdef GL_ATI_element_array
-
-static GLboolean _glewInit_GL_ATI_element_array (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawElementArrayATI = (PFNGLDRAWELEMENTARRAYATIPROC)glewGetProcAddress((const GLubyte*)"glDrawElementArrayATI")) == NULL) || r;
- r = ((glDrawRangeElementArrayATI = (PFNGLDRAWRANGEELEMENTARRAYATIPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementArrayATI")) == NULL) || r;
- r = ((glElementPointerATI = (PFNGLELEMENTPOINTERATIPROC)glewGetProcAddress((const GLubyte*)"glElementPointerATI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ATI_element_array */
-
-#ifdef GL_ATI_envmap_bumpmap
-
-static GLboolean _glewInit_GL_ATI_envmap_bumpmap (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetTexBumpParameterfvATI = (PFNGLGETTEXBUMPPARAMETERFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetTexBumpParameterfvATI")) == NULL) || r;
- r = ((glGetTexBumpParameterivATI = (PFNGLGETTEXBUMPPARAMETERIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetTexBumpParameterivATI")) == NULL) || r;
- r = ((glTexBumpParameterfvATI = (PFNGLTEXBUMPPARAMETERFVATIPROC)glewGetProcAddress((const GLubyte*)"glTexBumpParameterfvATI")) == NULL) || r;
- r = ((glTexBumpParameterivATI = (PFNGLTEXBUMPPARAMETERIVATIPROC)glewGetProcAddress((const GLubyte*)"glTexBumpParameterivATI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ATI_envmap_bumpmap */
-
-#ifdef GL_ATI_fragment_shader
-
-static GLboolean _glewInit_GL_ATI_fragment_shader (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glAlphaFragmentOp1ATI = (PFNGLALPHAFRAGMENTOP1ATIPROC)glewGetProcAddress((const GLubyte*)"glAlphaFragmentOp1ATI")) == NULL) || r;
- r = ((glAlphaFragmentOp2ATI = (PFNGLALPHAFRAGMENTOP2ATIPROC)glewGetProcAddress((const GLubyte*)"glAlphaFragmentOp2ATI")) == NULL) || r;
- r = ((glAlphaFragmentOp3ATI = (PFNGLALPHAFRAGMENTOP3ATIPROC)glewGetProcAddress((const GLubyte*)"glAlphaFragmentOp3ATI")) == NULL) || r;
- r = ((glBeginFragmentShaderATI = (PFNGLBEGINFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glBeginFragmentShaderATI")) == NULL) || r;
- r = ((glBindFragmentShaderATI = (PFNGLBINDFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glBindFragmentShaderATI")) == NULL) || r;
- r = ((glColorFragmentOp1ATI = (PFNGLCOLORFRAGMENTOP1ATIPROC)glewGetProcAddress((const GLubyte*)"glColorFragmentOp1ATI")) == NULL) || r;
- r = ((glColorFragmentOp2ATI = (PFNGLCOLORFRAGMENTOP2ATIPROC)glewGetProcAddress((const GLubyte*)"glColorFragmentOp2ATI")) == NULL) || r;
- r = ((glColorFragmentOp3ATI = (PFNGLCOLORFRAGMENTOP3ATIPROC)glewGetProcAddress((const GLubyte*)"glColorFragmentOp3ATI")) == NULL) || r;
- r = ((glDeleteFragmentShaderATI = (PFNGLDELETEFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glDeleteFragmentShaderATI")) == NULL) || r;
- r = ((glEndFragmentShaderATI = (PFNGLENDFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glEndFragmentShaderATI")) == NULL) || r;
- r = ((glGenFragmentShadersATI = (PFNGLGENFRAGMENTSHADERSATIPROC)glewGetProcAddress((const GLubyte*)"glGenFragmentShadersATI")) == NULL) || r;
- r = ((glPassTexCoordATI = (PFNGLPASSTEXCOORDATIPROC)glewGetProcAddress((const GLubyte*)"glPassTexCoordATI")) == NULL) || r;
- r = ((glSampleMapATI = (PFNGLSAMPLEMAPATIPROC)glewGetProcAddress((const GLubyte*)"glSampleMapATI")) == NULL) || r;
- r = ((glSetFragmentShaderConstantATI = (PFNGLSETFRAGMENTSHADERCONSTANTATIPROC)glewGetProcAddress((const GLubyte*)"glSetFragmentShaderConstantATI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ATI_fragment_shader */
-
-#ifdef GL_ATI_map_object_buffer
-
-static GLboolean _glewInit_GL_ATI_map_object_buffer (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glMapObjectBufferATI = (PFNGLMAPOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glMapObjectBufferATI")) == NULL) || r;
- r = ((glUnmapObjectBufferATI = (PFNGLUNMAPOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glUnmapObjectBufferATI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ATI_map_object_buffer */
-
-#ifdef GL_ATI_meminfo
-
-#endif /* GL_ATI_meminfo */
-
-#ifdef GL_ATI_pn_triangles
-
-static GLboolean _glewInit_GL_ATI_pn_triangles (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glPNTrianglesfATI = (PFNGLPNTRIANGLESFATIPROC)glewGetProcAddress((const GLubyte*)"glPNTrianglesfATI")) == NULL) || r;
- r = ((glPNTrianglesiATI = (PFNGLPNTRIANGLESIATIPROC)glewGetProcAddress((const GLubyte*)"glPNTrianglesiATI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ATI_pn_triangles */
-
-#ifdef GL_ATI_separate_stencil
-
-static GLboolean _glewInit_GL_ATI_separate_stencil (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glStencilFuncSeparateATI = (PFNGLSTENCILFUNCSEPARATEATIPROC)glewGetProcAddress((const GLubyte*)"glStencilFuncSeparateATI")) == NULL) || r;
- r = ((glStencilOpSeparateATI = (PFNGLSTENCILOPSEPARATEATIPROC)glewGetProcAddress((const GLubyte*)"glStencilOpSeparateATI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ATI_separate_stencil */
-
-#ifdef GL_ATI_shader_texture_lod
-
-#endif /* GL_ATI_shader_texture_lod */
-
-#ifdef GL_ATI_text_fragment_shader
-
-#endif /* GL_ATI_text_fragment_shader */
-
-#ifdef GL_ATI_texture_compression_3dc
-
-#endif /* GL_ATI_texture_compression_3dc */
-
-#ifdef GL_ATI_texture_env_combine3
-
-#endif /* GL_ATI_texture_env_combine3 */
-
-#ifdef GL_ATI_texture_float
-
-#endif /* GL_ATI_texture_float */
-
-#ifdef GL_ATI_texture_mirror_once
-
-#endif /* GL_ATI_texture_mirror_once */
-
-#ifdef GL_ATI_vertex_array_object
-
-static GLboolean _glewInit_GL_ATI_vertex_array_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glArrayObjectATI = (PFNGLARRAYOBJECTATIPROC)glewGetProcAddress((const GLubyte*)"glArrayObjectATI")) == NULL) || r;
- r = ((glFreeObjectBufferATI = (PFNGLFREEOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glFreeObjectBufferATI")) == NULL) || r;
- r = ((glGetArrayObjectfvATI = (PFNGLGETARRAYOBJECTFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetArrayObjectfvATI")) == NULL) || r;
- r = ((glGetArrayObjectivATI = (PFNGLGETARRAYOBJECTIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetArrayObjectivATI")) == NULL) || r;
- r = ((glGetObjectBufferfvATI = (PFNGLGETOBJECTBUFFERFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetObjectBufferfvATI")) == NULL) || r;
- r = ((glGetObjectBufferivATI = (PFNGLGETOBJECTBUFFERIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetObjectBufferivATI")) == NULL) || r;
- r = ((glGetVariantArrayObjectfvATI = (PFNGLGETVARIANTARRAYOBJECTFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVariantArrayObjectfvATI")) == NULL) || r;
- r = ((glGetVariantArrayObjectivATI = (PFNGLGETVARIANTARRAYOBJECTIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVariantArrayObjectivATI")) == NULL) || r;
- r = ((glIsObjectBufferATI = (PFNGLISOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glIsObjectBufferATI")) == NULL) || r;
- r = ((glNewObjectBufferATI = (PFNGLNEWOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glNewObjectBufferATI")) == NULL) || r;
- r = ((glUpdateObjectBufferATI = (PFNGLUPDATEOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glUpdateObjectBufferATI")) == NULL) || r;
- r = ((glVariantArrayObjectATI = (PFNGLVARIANTARRAYOBJECTATIPROC)glewGetProcAddress((const GLubyte*)"glVariantArrayObjectATI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ATI_vertex_array_object */
-
-#ifdef GL_ATI_vertex_attrib_array_object
-
-static GLboolean _glewInit_GL_ATI_vertex_attrib_array_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetVertexAttribArrayObjectfvATI = (PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribArrayObjectfvATI")) == NULL) || r;
- r = ((glGetVertexAttribArrayObjectivATI = (PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribArrayObjectivATI")) == NULL) || r;
- r = ((glVertexAttribArrayObjectATI = (PFNGLVERTEXATTRIBARRAYOBJECTATIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribArrayObjectATI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ATI_vertex_attrib_array_object */
-
-#ifdef GL_ATI_vertex_streams
-
-static GLboolean _glewInit_GL_ATI_vertex_streams (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glClientActiveVertexStreamATI = (PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC)glewGetProcAddress((const GLubyte*)"glClientActiveVertexStreamATI")) == NULL) || r;
- r = ((glNormalStream3bATI = (PFNGLNORMALSTREAM3BATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3bATI")) == NULL) || r;
- r = ((glNormalStream3bvATI = (PFNGLNORMALSTREAM3BVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3bvATI")) == NULL) || r;
- r = ((glNormalStream3dATI = (PFNGLNORMALSTREAM3DATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3dATI")) == NULL) || r;
- r = ((glNormalStream3dvATI = (PFNGLNORMALSTREAM3DVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3dvATI")) == NULL) || r;
- r = ((glNormalStream3fATI = (PFNGLNORMALSTREAM3FATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3fATI")) == NULL) || r;
- r = ((glNormalStream3fvATI = (PFNGLNORMALSTREAM3FVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3fvATI")) == NULL) || r;
- r = ((glNormalStream3iATI = (PFNGLNORMALSTREAM3IATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3iATI")) == NULL) || r;
- r = ((glNormalStream3ivATI = (PFNGLNORMALSTREAM3IVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3ivATI")) == NULL) || r;
- r = ((glNormalStream3sATI = (PFNGLNORMALSTREAM3SATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3sATI")) == NULL) || r;
- r = ((glNormalStream3svATI = (PFNGLNORMALSTREAM3SVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3svATI")) == NULL) || r;
- r = ((glVertexBlendEnvfATI = (PFNGLVERTEXBLENDENVFATIPROC)glewGetProcAddress((const GLubyte*)"glVertexBlendEnvfATI")) == NULL) || r;
- r = ((glVertexBlendEnviATI = (PFNGLVERTEXBLENDENVIATIPROC)glewGetProcAddress((const GLubyte*)"glVertexBlendEnviATI")) == NULL) || r;
- r = ((glVertexStream1dATI = (PFNGLVERTEXSTREAM1DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1dATI")) == NULL) || r;
- r = ((glVertexStream1dvATI = (PFNGLVERTEXSTREAM1DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1dvATI")) == NULL) || r;
- r = ((glVertexStream1fATI = (PFNGLVERTEXSTREAM1FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1fATI")) == NULL) || r;
- r = ((glVertexStream1fvATI = (PFNGLVERTEXSTREAM1FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1fvATI")) == NULL) || r;
- r = ((glVertexStream1iATI = (PFNGLVERTEXSTREAM1IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1iATI")) == NULL) || r;
- r = ((glVertexStream1ivATI = (PFNGLVERTEXSTREAM1IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1ivATI")) == NULL) || r;
- r = ((glVertexStream1sATI = (PFNGLVERTEXSTREAM1SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1sATI")) == NULL) || r;
- r = ((glVertexStream1svATI = (PFNGLVERTEXSTREAM1SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1svATI")) == NULL) || r;
- r = ((glVertexStream2dATI = (PFNGLVERTEXSTREAM2DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2dATI")) == NULL) || r;
- r = ((glVertexStream2dvATI = (PFNGLVERTEXSTREAM2DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2dvATI")) == NULL) || r;
- r = ((glVertexStream2fATI = (PFNGLVERTEXSTREAM2FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2fATI")) == NULL) || r;
- r = ((glVertexStream2fvATI = (PFNGLVERTEXSTREAM2FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2fvATI")) == NULL) || r;
- r = ((glVertexStream2iATI = (PFNGLVERTEXSTREAM2IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2iATI")) == NULL) || r;
- r = ((glVertexStream2ivATI = (PFNGLVERTEXSTREAM2IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2ivATI")) == NULL) || r;
- r = ((glVertexStream2sATI = (PFNGLVERTEXSTREAM2SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2sATI")) == NULL) || r;
- r = ((glVertexStream2svATI = (PFNGLVERTEXSTREAM2SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2svATI")) == NULL) || r;
- r = ((glVertexStream3dATI = (PFNGLVERTEXSTREAM3DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3dATI")) == NULL) || r;
- r = ((glVertexStream3dvATI = (PFNGLVERTEXSTREAM3DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3dvATI")) == NULL) || r;
- r = ((glVertexStream3fATI = (PFNGLVERTEXSTREAM3FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3fATI")) == NULL) || r;
- r = ((glVertexStream3fvATI = (PFNGLVERTEXSTREAM3FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3fvATI")) == NULL) || r;
- r = ((glVertexStream3iATI = (PFNGLVERTEXSTREAM3IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3iATI")) == NULL) || r;
- r = ((glVertexStream3ivATI = (PFNGLVERTEXSTREAM3IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3ivATI")) == NULL) || r;
- r = ((glVertexStream3sATI = (PFNGLVERTEXSTREAM3SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3sATI")) == NULL) || r;
- r = ((glVertexStream3svATI = (PFNGLVERTEXSTREAM3SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3svATI")) == NULL) || r;
- r = ((glVertexStream4dATI = (PFNGLVERTEXSTREAM4DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4dATI")) == NULL) || r;
- r = ((glVertexStream4dvATI = (PFNGLVERTEXSTREAM4DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4dvATI")) == NULL) || r;
- r = ((glVertexStream4fATI = (PFNGLVERTEXSTREAM4FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4fATI")) == NULL) || r;
- r = ((glVertexStream4fvATI = (PFNGLVERTEXSTREAM4FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4fvATI")) == NULL) || r;
- r = ((glVertexStream4iATI = (PFNGLVERTEXSTREAM4IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4iATI")) == NULL) || r;
- r = ((glVertexStream4ivATI = (PFNGLVERTEXSTREAM4IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4ivATI")) == NULL) || r;
- r = ((glVertexStream4sATI = (PFNGLVERTEXSTREAM4SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4sATI")) == NULL) || r;
- r = ((glVertexStream4svATI = (PFNGLVERTEXSTREAM4SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4svATI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_ATI_vertex_streams */
-
-#ifdef GL_EXT_422_pixels
-
-#endif /* GL_EXT_422_pixels */
-
-#ifdef GL_EXT_Cg_shader
-
-#endif /* GL_EXT_Cg_shader */
-
-#ifdef GL_EXT_abgr
-
-#endif /* GL_EXT_abgr */
-
-#ifdef GL_EXT_bgra
-
-#endif /* GL_EXT_bgra */
-
-#ifdef GL_EXT_bindable_uniform
-
-static GLboolean _glewInit_GL_EXT_bindable_uniform (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetUniformBufferSizeEXT = (PFNGLGETUNIFORMBUFFERSIZEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetUniformBufferSizeEXT")) == NULL) || r;
- r = ((glGetUniformOffsetEXT = (PFNGLGETUNIFORMOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glGetUniformOffsetEXT")) == NULL) || r;
- r = ((glUniformBufferEXT = (PFNGLUNIFORMBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glUniformBufferEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_bindable_uniform */
-
-#ifdef GL_EXT_blend_color
-
-static GLboolean _glewInit_GL_EXT_blend_color (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlendColorEXT = (PFNGLBLENDCOLOREXTPROC)glewGetProcAddress((const GLubyte*)"glBlendColorEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_blend_color */
-
-#ifdef GL_EXT_blend_equation_separate
-
-static GLboolean _glewInit_GL_EXT_blend_equation_separate (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlendEquationSeparateEXT = (PFNGLBLENDEQUATIONSEPARATEEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparateEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_blend_equation_separate */
-
-#ifdef GL_EXT_blend_func_separate
-
-static GLboolean _glewInit_GL_EXT_blend_func_separate (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparateEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_blend_func_separate */
-
-#ifdef GL_EXT_blend_logic_op
-
-#endif /* GL_EXT_blend_logic_op */
-
-#ifdef GL_EXT_blend_minmax
-
-static GLboolean _glewInit_GL_EXT_blend_minmax (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlendEquationEXT = (PFNGLBLENDEQUATIONEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_blend_minmax */
-
-#ifdef GL_EXT_blend_subtract
-
-#endif /* GL_EXT_blend_subtract */
-
-#ifdef GL_EXT_clip_volume_hint
-
-#endif /* GL_EXT_clip_volume_hint */
-
-#ifdef GL_EXT_cmyka
-
-#endif /* GL_EXT_cmyka */
-
-#ifdef GL_EXT_color_subtable
-
-static GLboolean _glewInit_GL_EXT_color_subtable (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glColorSubTableEXT = (PFNGLCOLORSUBTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glColorSubTableEXT")) == NULL) || r;
- r = ((glCopyColorSubTableEXT = (PFNGLCOPYCOLORSUBTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyColorSubTableEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_color_subtable */
-
-#ifdef GL_EXT_compiled_vertex_array
-
-static GLboolean _glewInit_GL_EXT_compiled_vertex_array (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glLockArraysEXT = (PFNGLLOCKARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glLockArraysEXT")) == NULL) || r;
- r = ((glUnlockArraysEXT = (PFNGLUNLOCKARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glUnlockArraysEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_compiled_vertex_array */
-
-#ifdef GL_EXT_convolution
-
-static GLboolean _glewInit_GL_EXT_convolution (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glConvolutionFilter1DEXT = (PFNGLCONVOLUTIONFILTER1DEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter1DEXT")) == NULL) || r;
- r = ((glConvolutionFilter2DEXT = (PFNGLCONVOLUTIONFILTER2DEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter2DEXT")) == NULL) || r;
- r = ((glConvolutionParameterfEXT = (PFNGLCONVOLUTIONPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterfEXT")) == NULL) || r;
- r = ((glConvolutionParameterfvEXT = (PFNGLCONVOLUTIONPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterfvEXT")) == NULL) || r;
- r = ((glConvolutionParameteriEXT = (PFNGLCONVOLUTIONPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameteriEXT")) == NULL) || r;
- r = ((glConvolutionParameterivEXT = (PFNGLCONVOLUTIONPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterivEXT")) == NULL) || r;
- r = ((glCopyConvolutionFilter1DEXT = (PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter1DEXT")) == NULL) || r;
- r = ((glCopyConvolutionFilter2DEXT = (PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter2DEXT")) == NULL) || r;
- r = ((glGetConvolutionFilterEXT = (PFNGLGETCONVOLUTIONFILTEREXTPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionFilterEXT")) == NULL) || r;
- r = ((glGetConvolutionParameterfvEXT = (PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameterfvEXT")) == NULL) || r;
- r = ((glGetConvolutionParameterivEXT = (PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameterivEXT")) == NULL) || r;
- r = ((glGetSeparableFilterEXT = (PFNGLGETSEPARABLEFILTEREXTPROC)glewGetProcAddress((const GLubyte*)"glGetSeparableFilterEXT")) == NULL) || r;
- r = ((glSeparableFilter2DEXT = (PFNGLSEPARABLEFILTER2DEXTPROC)glewGetProcAddress((const GLubyte*)"glSeparableFilter2DEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_convolution */
-
-#ifdef GL_EXT_coordinate_frame
-
-static GLboolean _glewInit_GL_EXT_coordinate_frame (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBinormalPointerEXT = (PFNGLBINORMALPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glBinormalPointerEXT")) == NULL) || r;
- r = ((glTangentPointerEXT = (PFNGLTANGENTPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glTangentPointerEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_coordinate_frame */
-
-#ifdef GL_EXT_copy_texture
-
-static GLboolean _glewInit_GL_EXT_copy_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCopyTexImage1DEXT = (PFNGLCOPYTEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexImage1DEXT")) == NULL) || r;
- r = ((glCopyTexImage2DEXT = (PFNGLCOPYTEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexImage2DEXT")) == NULL) || r;
- r = ((glCopyTexSubImage1DEXT = (PFNGLCOPYTEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage1DEXT")) == NULL) || r;
- r = ((glCopyTexSubImage2DEXT = (PFNGLCOPYTEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage2DEXT")) == NULL) || r;
- r = ((glCopyTexSubImage3DEXT = (PFNGLCOPYTEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage3DEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_copy_texture */
-
-#ifdef GL_EXT_cull_vertex
-
-static GLboolean _glewInit_GL_EXT_cull_vertex (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCullParameterdvEXT = (PFNGLCULLPARAMETERDVEXTPROC)glewGetProcAddress((const GLubyte*)"glCullParameterdvEXT")) == NULL) || r;
- r = ((glCullParameterfvEXT = (PFNGLCULLPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glCullParameterfvEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_cull_vertex */
-
-#ifdef GL_EXT_debug_label
-
-static GLboolean _glewInit_GL_EXT_debug_label (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetObjectLabelEXT = (PFNGLGETOBJECTLABELEXTPROC)glewGetProcAddress((const GLubyte*)"glGetObjectLabelEXT")) == NULL) || r;
- r = ((glLabelObjectEXT = (PFNGLLABELOBJECTEXTPROC)glewGetProcAddress((const GLubyte*)"glLabelObjectEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_debug_label */
-
-#ifdef GL_EXT_debug_marker
-
-static GLboolean _glewInit_GL_EXT_debug_marker (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glInsertEventMarkerEXT = (PFNGLINSERTEVENTMARKEREXTPROC)glewGetProcAddress((const GLubyte*)"glInsertEventMarkerEXT")) == NULL) || r;
- r = ((glPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC)glewGetProcAddress((const GLubyte*)"glPopGroupMarkerEXT")) == NULL) || r;
- r = ((glPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC)glewGetProcAddress((const GLubyte*)"glPushGroupMarkerEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_debug_marker */
-
-#ifdef GL_EXT_depth_bounds_test
-
-static GLboolean _glewInit_GL_EXT_depth_bounds_test (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDepthBoundsEXT = (PFNGLDEPTHBOUNDSEXTPROC)glewGetProcAddress((const GLubyte*)"glDepthBoundsEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_depth_bounds_test */
-
-#ifdef GL_EXT_direct_state_access
-
-static GLboolean _glewInit_GL_EXT_direct_state_access (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindMultiTextureEXT = (PFNGLBINDMULTITEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glBindMultiTextureEXT")) == NULL) || r;
- r = ((glCheckNamedFramebufferStatusEXT = (PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC)glewGetProcAddress((const GLubyte*)"glCheckNamedFramebufferStatusEXT")) == NULL) || r;
- r = ((glClientAttribDefaultEXT = (PFNGLCLIENTATTRIBDEFAULTEXTPROC)glewGetProcAddress((const GLubyte*)"glClientAttribDefaultEXT")) == NULL) || r;
- r = ((glCompressedMultiTexImage1DEXT = (PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexImage1DEXT")) == NULL) || r;
- r = ((glCompressedMultiTexImage2DEXT = (PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexImage2DEXT")) == NULL) || r;
- r = ((glCompressedMultiTexImage3DEXT = (PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexImage3DEXT")) == NULL) || r;
- r = ((glCompressedMultiTexSubImage1DEXT = (PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexSubImage1DEXT")) == NULL) || r;
- r = ((glCompressedMultiTexSubImage2DEXT = (PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexSubImage2DEXT")) == NULL) || r;
- r = ((glCompressedMultiTexSubImage3DEXT = (PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexSubImage3DEXT")) == NULL) || r;
- r = ((glCompressedTextureImage1DEXT = (PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureImage1DEXT")) == NULL) || r;
- r = ((glCompressedTextureImage2DEXT = (PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureImage2DEXT")) == NULL) || r;
- r = ((glCompressedTextureImage3DEXT = (PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureImage3DEXT")) == NULL) || r;
- r = ((glCompressedTextureSubImage1DEXT = (PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage1DEXT")) == NULL) || r;
- r = ((glCompressedTextureSubImage2DEXT = (PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage2DEXT")) == NULL) || r;
- r = ((glCompressedTextureSubImage3DEXT = (PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage3DEXT")) == NULL) || r;
- r = ((glCopyMultiTexImage1DEXT = (PFNGLCOPYMULTITEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexImage1DEXT")) == NULL) || r;
- r = ((glCopyMultiTexImage2DEXT = (PFNGLCOPYMULTITEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexImage2DEXT")) == NULL) || r;
- r = ((glCopyMultiTexSubImage1DEXT = (PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexSubImage1DEXT")) == NULL) || r;
- r = ((glCopyMultiTexSubImage2DEXT = (PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexSubImage2DEXT")) == NULL) || r;
- r = ((glCopyMultiTexSubImage3DEXT = (PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexSubImage3DEXT")) == NULL) || r;
- r = ((glCopyTextureImage1DEXT = (PFNGLCOPYTEXTUREIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureImage1DEXT")) == NULL) || r;
- r = ((glCopyTextureImage2DEXT = (PFNGLCOPYTEXTUREIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureImage2DEXT")) == NULL) || r;
- r = ((glCopyTextureSubImage1DEXT = (PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage1DEXT")) == NULL) || r;
- r = ((glCopyTextureSubImage2DEXT = (PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage2DEXT")) == NULL) || r;
- r = ((glCopyTextureSubImage3DEXT = (PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage3DEXT")) == NULL) || r;
- r = ((glDisableClientStateIndexedEXT = (PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableClientStateIndexedEXT")) == NULL) || r;
- r = ((glDisableClientStateiEXT = (PFNGLDISABLECLIENTSTATEIEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableClientStateiEXT")) == NULL) || r;
- r = ((glDisableVertexArrayAttribEXT = (PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexArrayAttribEXT")) == NULL) || r;
- r = ((glDisableVertexArrayEXT = (PFNGLDISABLEVERTEXARRAYEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexArrayEXT")) == NULL) || r;
- r = ((glEnableClientStateIndexedEXT = (PFNGLENABLECLIENTSTATEINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableClientStateIndexedEXT")) == NULL) || r;
- r = ((glEnableClientStateiEXT = (PFNGLENABLECLIENTSTATEIEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableClientStateiEXT")) == NULL) || r;
- r = ((glEnableVertexArrayAttribEXT = (PFNGLENABLEVERTEXARRAYATTRIBEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexArrayAttribEXT")) == NULL) || r;
- r = ((glEnableVertexArrayEXT = (PFNGLENABLEVERTEXARRAYEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexArrayEXT")) == NULL) || r;
- r = ((glFlushMappedNamedBufferRangeEXT = (PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedNamedBufferRangeEXT")) == NULL) || r;
- r = ((glFramebufferDrawBufferEXT = (PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferDrawBufferEXT")) == NULL) || r;
- r = ((glFramebufferDrawBuffersEXT = (PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferDrawBuffersEXT")) == NULL) || r;
- r = ((glFramebufferReadBufferEXT = (PFNGLFRAMEBUFFERREADBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferReadBufferEXT")) == NULL) || r;
- r = ((glGenerateMultiTexMipmapEXT = (PFNGLGENERATEMULTITEXMIPMAPEXTPROC)glewGetProcAddress((const GLubyte*)"glGenerateMultiTexMipmapEXT")) == NULL) || r;
- r = ((glGenerateTextureMipmapEXT = (PFNGLGENERATETEXTUREMIPMAPEXTPROC)glewGetProcAddress((const GLubyte*)"glGenerateTextureMipmapEXT")) == NULL) || r;
- r = ((glGetCompressedMultiTexImageEXT = (PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedMultiTexImageEXT")) == NULL) || r;
- r = ((glGetCompressedTextureImageEXT = (PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTextureImageEXT")) == NULL) || r;
- r = ((glGetDoubleIndexedvEXT = (PFNGLGETDOUBLEINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetDoubleIndexedvEXT")) == NULL) || r;
- r = ((glGetDoublei_vEXT = (PFNGLGETDOUBLEI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetDoublei_vEXT")) == NULL) || r;
- r = ((glGetFloatIndexedvEXT = (PFNGLGETFLOATINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFloatIndexedvEXT")) == NULL) || r;
- r = ((glGetFloati_vEXT = (PFNGLGETFLOATI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFloati_vEXT")) == NULL) || r;
- r = ((glGetFramebufferParameterivEXT = (PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferParameterivEXT")) == NULL) || r;
- r = ((glGetMultiTexEnvfvEXT = (PFNGLGETMULTITEXENVFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexEnvfvEXT")) == NULL) || r;
- r = ((glGetMultiTexEnvivEXT = (PFNGLGETMULTITEXENVIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexEnvivEXT")) == NULL) || r;
- r = ((glGetMultiTexGendvEXT = (PFNGLGETMULTITEXGENDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexGendvEXT")) == NULL) || r;
- r = ((glGetMultiTexGenfvEXT = (PFNGLGETMULTITEXGENFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexGenfvEXT")) == NULL) || r;
- r = ((glGetMultiTexGenivEXT = (PFNGLGETMULTITEXGENIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexGenivEXT")) == NULL) || r;
- r = ((glGetMultiTexImageEXT = (PFNGLGETMULTITEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexImageEXT")) == NULL) || r;
- r = ((glGetMultiTexLevelParameterfvEXT = (PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexLevelParameterfvEXT")) == NULL) || r;
- r = ((glGetMultiTexLevelParameterivEXT = (PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexLevelParameterivEXT")) == NULL) || r;
- r = ((glGetMultiTexParameterIivEXT = (PFNGLGETMULTITEXPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexParameterIivEXT")) == NULL) || r;
- r = ((glGetMultiTexParameterIuivEXT = (PFNGLGETMULTITEXPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexParameterIuivEXT")) == NULL) || r;
- r = ((glGetMultiTexParameterfvEXT = (PFNGLGETMULTITEXPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexParameterfvEXT")) == NULL) || r;
- r = ((glGetMultiTexParameterivEXT = (PFNGLGETMULTITEXPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexParameterivEXT")) == NULL) || r;
- r = ((glGetNamedBufferParameterivEXT = (PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferParameterivEXT")) == NULL) || r;
- r = ((glGetNamedBufferPointervEXT = (PFNGLGETNAMEDBUFFERPOINTERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferPointervEXT")) == NULL) || r;
- r = ((glGetNamedBufferSubDataEXT = (PFNGLGETNAMEDBUFFERSUBDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferSubDataEXT")) == NULL) || r;
- r = ((glGetNamedFramebufferAttachmentParameterivEXT = (PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedFramebufferAttachmentParameterivEXT")) == NULL) || r;
- r = ((glGetNamedProgramLocalParameterIivEXT = (PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramLocalParameterIivEXT")) == NULL) || r;
- r = ((glGetNamedProgramLocalParameterIuivEXT = (PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramLocalParameterIuivEXT")) == NULL) || r;
- r = ((glGetNamedProgramLocalParameterdvEXT = (PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramLocalParameterdvEXT")) == NULL) || r;
- r = ((glGetNamedProgramLocalParameterfvEXT = (PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramLocalParameterfvEXT")) == NULL) || r;
- r = ((glGetNamedProgramStringEXT = (PFNGLGETNAMEDPROGRAMSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramStringEXT")) == NULL) || r;
- r = ((glGetNamedProgramivEXT = (PFNGLGETNAMEDPROGRAMIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramivEXT")) == NULL) || r;
- r = ((glGetNamedRenderbufferParameterivEXT = (PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedRenderbufferParameterivEXT")) == NULL) || r;
- r = ((glGetPointerIndexedvEXT = (PFNGLGETPOINTERINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPointerIndexedvEXT")) == NULL) || r;
- r = ((glGetPointeri_vEXT = (PFNGLGETPOINTERI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPointeri_vEXT")) == NULL) || r;
- r = ((glGetTextureImageEXT = (PFNGLGETTEXTUREIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureImageEXT")) == NULL) || r;
- r = ((glGetTextureLevelParameterfvEXT = (PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureLevelParameterfvEXT")) == NULL) || r;
- r = ((glGetTextureLevelParameterivEXT = (PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureLevelParameterivEXT")) == NULL) || r;
- r = ((glGetTextureParameterIivEXT = (PFNGLGETTEXTUREPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterIivEXT")) == NULL) || r;
- r = ((glGetTextureParameterIuivEXT = (PFNGLGETTEXTUREPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterIuivEXT")) == NULL) || r;
- r = ((glGetTextureParameterfvEXT = (PFNGLGETTEXTUREPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterfvEXT")) == NULL) || r;
- r = ((glGetTextureParameterivEXT = (PFNGLGETTEXTUREPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterivEXT")) == NULL) || r;
- r = ((glGetVertexArrayIntegeri_vEXT = (PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayIntegeri_vEXT")) == NULL) || r;
- r = ((glGetVertexArrayIntegervEXT = (PFNGLGETVERTEXARRAYINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayIntegervEXT")) == NULL) || r;
- r = ((glGetVertexArrayPointeri_vEXT = (PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayPointeri_vEXT")) == NULL) || r;
- r = ((glGetVertexArrayPointervEXT = (PFNGLGETVERTEXARRAYPOINTERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayPointervEXT")) == NULL) || r;
- r = ((glMapNamedBufferEXT = (PFNGLMAPNAMEDBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glMapNamedBufferEXT")) == NULL) || r;
- r = ((glMapNamedBufferRangeEXT = (PFNGLMAPNAMEDBUFFERRANGEEXTPROC)glewGetProcAddress((const GLubyte*)"glMapNamedBufferRangeEXT")) == NULL) || r;
- r = ((glMatrixFrustumEXT = (PFNGLMATRIXFRUSTUMEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixFrustumEXT")) == NULL) || r;
- r = ((glMatrixLoadIdentityEXT = (PFNGLMATRIXLOADIDENTITYEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadIdentityEXT")) == NULL) || r;
- r = ((glMatrixLoadTransposedEXT = (PFNGLMATRIXLOADTRANSPOSEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadTransposedEXT")) == NULL) || r;
- r = ((glMatrixLoadTransposefEXT = (PFNGLMATRIXLOADTRANSPOSEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadTransposefEXT")) == NULL) || r;
- r = ((glMatrixLoaddEXT = (PFNGLMATRIXLOADDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoaddEXT")) == NULL) || r;
- r = ((glMatrixLoadfEXT = (PFNGLMATRIXLOADFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadfEXT")) == NULL) || r;
- r = ((glMatrixMultTransposedEXT = (PFNGLMATRIXMULTTRANSPOSEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultTransposedEXT")) == NULL) || r;
- r = ((glMatrixMultTransposefEXT = (PFNGLMATRIXMULTTRANSPOSEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultTransposefEXT")) == NULL) || r;
- r = ((glMatrixMultdEXT = (PFNGLMATRIXMULTDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultdEXT")) == NULL) || r;
- r = ((glMatrixMultfEXT = (PFNGLMATRIXMULTFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultfEXT")) == NULL) || r;
- r = ((glMatrixOrthoEXT = (PFNGLMATRIXORTHOEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixOrthoEXT")) == NULL) || r;
- r = ((glMatrixPopEXT = (PFNGLMATRIXPOPEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixPopEXT")) == NULL) || r;
- r = ((glMatrixPushEXT = (PFNGLMATRIXPUSHEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixPushEXT")) == NULL) || r;
- r = ((glMatrixRotatedEXT = (PFNGLMATRIXROTATEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixRotatedEXT")) == NULL) || r;
- r = ((glMatrixRotatefEXT = (PFNGLMATRIXROTATEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixRotatefEXT")) == NULL) || r;
- r = ((glMatrixScaledEXT = (PFNGLMATRIXSCALEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixScaledEXT")) == NULL) || r;
- r = ((glMatrixScalefEXT = (PFNGLMATRIXSCALEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixScalefEXT")) == NULL) || r;
- r = ((glMatrixTranslatedEXT = (PFNGLMATRIXTRANSLATEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixTranslatedEXT")) == NULL) || r;
- r = ((glMatrixTranslatefEXT = (PFNGLMATRIXTRANSLATEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixTranslatefEXT")) == NULL) || r;
- r = ((glMultiTexBufferEXT = (PFNGLMULTITEXBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexBufferEXT")) == NULL) || r;
- r = ((glMultiTexCoordPointerEXT = (PFNGLMULTITEXCOORDPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordPointerEXT")) == NULL) || r;
- r = ((glMultiTexEnvfEXT = (PFNGLMULTITEXENVFEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexEnvfEXT")) == NULL) || r;
- r = ((glMultiTexEnvfvEXT = (PFNGLMULTITEXENVFVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexEnvfvEXT")) == NULL) || r;
- r = ((glMultiTexEnviEXT = (PFNGLMULTITEXENVIEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexEnviEXT")) == NULL) || r;
- r = ((glMultiTexEnvivEXT = (PFNGLMULTITEXENVIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexEnvivEXT")) == NULL) || r;
- r = ((glMultiTexGendEXT = (PFNGLMULTITEXGENDEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGendEXT")) == NULL) || r;
- r = ((glMultiTexGendvEXT = (PFNGLMULTITEXGENDVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGendvEXT")) == NULL) || r;
- r = ((glMultiTexGenfEXT = (PFNGLMULTITEXGENFEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGenfEXT")) == NULL) || r;
- r = ((glMultiTexGenfvEXT = (PFNGLMULTITEXGENFVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGenfvEXT")) == NULL) || r;
- r = ((glMultiTexGeniEXT = (PFNGLMULTITEXGENIEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGeniEXT")) == NULL) || r;
- r = ((glMultiTexGenivEXT = (PFNGLMULTITEXGENIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGenivEXT")) == NULL) || r;
- r = ((glMultiTexImage1DEXT = (PFNGLMULTITEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexImage1DEXT")) == NULL) || r;
- r = ((glMultiTexImage2DEXT = (PFNGLMULTITEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexImage2DEXT")) == NULL) || r;
- r = ((glMultiTexImage3DEXT = (PFNGLMULTITEXIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexImage3DEXT")) == NULL) || r;
- r = ((glMultiTexParameterIivEXT = (PFNGLMULTITEXPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterIivEXT")) == NULL) || r;
- r = ((glMultiTexParameterIuivEXT = (PFNGLMULTITEXPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterIuivEXT")) == NULL) || r;
- r = ((glMultiTexParameterfEXT = (PFNGLMULTITEXPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterfEXT")) == NULL) || r;
- r = ((glMultiTexParameterfvEXT = (PFNGLMULTITEXPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterfvEXT")) == NULL) || r;
- r = ((glMultiTexParameteriEXT = (PFNGLMULTITEXPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameteriEXT")) == NULL) || r;
- r = ((glMultiTexParameterivEXT = (PFNGLMULTITEXPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterivEXT")) == NULL) || r;
- r = ((glMultiTexRenderbufferEXT = (PFNGLMULTITEXRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexRenderbufferEXT")) == NULL) || r;
- r = ((glMultiTexSubImage1DEXT = (PFNGLMULTITEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexSubImage1DEXT")) == NULL) || r;
- r = ((glMultiTexSubImage2DEXT = (PFNGLMULTITEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexSubImage2DEXT")) == NULL) || r;
- r = ((glMultiTexSubImage3DEXT = (PFNGLMULTITEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexSubImage3DEXT")) == NULL) || r;
- r = ((glNamedBufferDataEXT = (PFNGLNAMEDBUFFERDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferDataEXT")) == NULL) || r;
- r = ((glNamedBufferSubDataEXT = (PFNGLNAMEDBUFFERSUBDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferSubDataEXT")) == NULL) || r;
- r = ((glNamedCopyBufferSubDataEXT = (PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedCopyBufferSubDataEXT")) == NULL) || r;
- r = ((glNamedFramebufferRenderbufferEXT = (PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferRenderbufferEXT")) == NULL) || r;
- r = ((glNamedFramebufferTexture1DEXT = (PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTexture1DEXT")) == NULL) || r;
- r = ((glNamedFramebufferTexture2DEXT = (PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTexture2DEXT")) == NULL) || r;
- r = ((glNamedFramebufferTexture3DEXT = (PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTexture3DEXT")) == NULL) || r;
- r = ((glNamedFramebufferTextureEXT = (PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTextureEXT")) == NULL) || r;
- r = ((glNamedFramebufferTextureFaceEXT = (PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTextureFaceEXT")) == NULL) || r;
- r = ((glNamedFramebufferTextureLayerEXT = (PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTextureLayerEXT")) == NULL) || r;
- r = ((glNamedProgramLocalParameter4dEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameter4dEXT")) == NULL) || r;
- r = ((glNamedProgramLocalParameter4dvEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameter4dvEXT")) == NULL) || r;
- r = ((glNamedProgramLocalParameter4fEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameter4fEXT")) == NULL) || r;
- r = ((glNamedProgramLocalParameter4fvEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameter4fvEXT")) == NULL) || r;
- r = ((glNamedProgramLocalParameterI4iEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameterI4iEXT")) == NULL) || r;
- r = ((glNamedProgramLocalParameterI4ivEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameterI4ivEXT")) == NULL) || r;
- r = ((glNamedProgramLocalParameterI4uiEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameterI4uiEXT")) == NULL) || r;
- r = ((glNamedProgramLocalParameterI4uivEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameterI4uivEXT")) == NULL) || r;
- r = ((glNamedProgramLocalParameters4fvEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameters4fvEXT")) == NULL) || r;
- r = ((glNamedProgramLocalParametersI4ivEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParametersI4ivEXT")) == NULL) || r;
- r = ((glNamedProgramLocalParametersI4uivEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParametersI4uivEXT")) == NULL) || r;
- r = ((glNamedProgramStringEXT = (PFNGLNAMEDPROGRAMSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramStringEXT")) == NULL) || r;
- r = ((glNamedRenderbufferStorageEXT = (PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorageEXT")) == NULL) || r;
- r = ((glNamedRenderbufferStorageMultisampleCoverageEXT = (PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorageMultisampleCoverageEXT")) == NULL) || r;
- r = ((glNamedRenderbufferStorageMultisampleEXT = (PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorageMultisampleEXT")) == NULL) || r;
- r = ((glProgramUniform1fEXT = (PFNGLPROGRAMUNIFORM1FEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1fEXT")) == NULL) || r;
- r = ((glProgramUniform1fvEXT = (PFNGLPROGRAMUNIFORM1FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1fvEXT")) == NULL) || r;
- r = ((glProgramUniform1iEXT = (PFNGLPROGRAMUNIFORM1IEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1iEXT")) == NULL) || r;
- r = ((glProgramUniform1ivEXT = (PFNGLPROGRAMUNIFORM1IVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ivEXT")) == NULL) || r;
- r = ((glProgramUniform1uiEXT = (PFNGLPROGRAMUNIFORM1UIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1uiEXT")) == NULL) || r;
- r = ((glProgramUniform1uivEXT = (PFNGLPROGRAMUNIFORM1UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1uivEXT")) == NULL) || r;
- r = ((glProgramUniform2fEXT = (PFNGLPROGRAMUNIFORM2FEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2fEXT")) == NULL) || r;
- r = ((glProgramUniform2fvEXT = (PFNGLPROGRAMUNIFORM2FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2fvEXT")) == NULL) || r;
- r = ((glProgramUniform2iEXT = (PFNGLPROGRAMUNIFORM2IEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2iEXT")) == NULL) || r;
- r = ((glProgramUniform2ivEXT = (PFNGLPROGRAMUNIFORM2IVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ivEXT")) == NULL) || r;
- r = ((glProgramUniform2uiEXT = (PFNGLPROGRAMUNIFORM2UIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2uiEXT")) == NULL) || r;
- r = ((glProgramUniform2uivEXT = (PFNGLPROGRAMUNIFORM2UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2uivEXT")) == NULL) || r;
- r = ((glProgramUniform3fEXT = (PFNGLPROGRAMUNIFORM3FEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3fEXT")) == NULL) || r;
- r = ((glProgramUniform3fvEXT = (PFNGLPROGRAMUNIFORM3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3fvEXT")) == NULL) || r;
- r = ((glProgramUniform3iEXT = (PFNGLPROGRAMUNIFORM3IEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3iEXT")) == NULL) || r;
- r = ((glProgramUniform3ivEXT = (PFNGLPROGRAMUNIFORM3IVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ivEXT")) == NULL) || r;
- r = ((glProgramUniform3uiEXT = (PFNGLPROGRAMUNIFORM3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3uiEXT")) == NULL) || r;
- r = ((glProgramUniform3uivEXT = (PFNGLPROGRAMUNIFORM3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3uivEXT")) == NULL) || r;
- r = ((glProgramUniform4fEXT = (PFNGLPROGRAMUNIFORM4FEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4fEXT")) == NULL) || r;
- r = ((glProgramUniform4fvEXT = (PFNGLPROGRAMUNIFORM4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4fvEXT")) == NULL) || r;
- r = ((glProgramUniform4iEXT = (PFNGLPROGRAMUNIFORM4IEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4iEXT")) == NULL) || r;
- r = ((glProgramUniform4ivEXT = (PFNGLPROGRAMUNIFORM4IVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ivEXT")) == NULL) || r;
- r = ((glProgramUniform4uiEXT = (PFNGLPROGRAMUNIFORM4UIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4uiEXT")) == NULL) || r;
- r = ((glProgramUniform4uivEXT = (PFNGLPROGRAMUNIFORM4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4uivEXT")) == NULL) || r;
- r = ((glProgramUniformMatrix2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2fvEXT")) == NULL) || r;
- r = ((glProgramUniformMatrix2x3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x3fvEXT")) == NULL) || r;
- r = ((glProgramUniformMatrix2x4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x4fvEXT")) == NULL) || r;
- r = ((glProgramUniformMatrix3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3fvEXT")) == NULL) || r;
- r = ((glProgramUniformMatrix3x2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x2fvEXT")) == NULL) || r;
- r = ((glProgramUniformMatrix3x4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x4fvEXT")) == NULL) || r;
- r = ((glProgramUniformMatrix4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4fvEXT")) == NULL) || r;
- r = ((glProgramUniformMatrix4x2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x2fvEXT")) == NULL) || r;
- r = ((glProgramUniformMatrix4x3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x3fvEXT")) == NULL) || r;
- r = ((glPushClientAttribDefaultEXT = (PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC)glewGetProcAddress((const GLubyte*)"glPushClientAttribDefaultEXT")) == NULL) || r;
- r = ((glTextureBufferEXT = (PFNGLTEXTUREBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glTextureBufferEXT")) == NULL) || r;
- r = ((glTextureImage1DEXT = (PFNGLTEXTUREIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureImage1DEXT")) == NULL) || r;
- r = ((glTextureImage2DEXT = (PFNGLTEXTUREIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureImage2DEXT")) == NULL) || r;
- r = ((glTextureImage3DEXT = (PFNGLTEXTUREIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureImage3DEXT")) == NULL) || r;
- r = ((glTextureParameterIivEXT = (PFNGLTEXTUREPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterIivEXT")) == NULL) || r;
- r = ((glTextureParameterIuivEXT = (PFNGLTEXTUREPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterIuivEXT")) == NULL) || r;
- r = ((glTextureParameterfEXT = (PFNGLTEXTUREPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterfEXT")) == NULL) || r;
- r = ((glTextureParameterfvEXT = (PFNGLTEXTUREPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterfvEXT")) == NULL) || r;
- r = ((glTextureParameteriEXT = (PFNGLTEXTUREPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameteriEXT")) == NULL) || r;
- r = ((glTextureParameterivEXT = (PFNGLTEXTUREPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterivEXT")) == NULL) || r;
- r = ((glTextureRenderbufferEXT = (PFNGLTEXTURERENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glTextureRenderbufferEXT")) == NULL) || r;
- r = ((glTextureSubImage1DEXT = (PFNGLTEXTURESUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage1DEXT")) == NULL) || r;
- r = ((glTextureSubImage2DEXT = (PFNGLTEXTURESUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage2DEXT")) == NULL) || r;
- r = ((glTextureSubImage3DEXT = (PFNGLTEXTURESUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage3DEXT")) == NULL) || r;
- r = ((glUnmapNamedBufferEXT = (PFNGLUNMAPNAMEDBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glUnmapNamedBufferEXT")) == NULL) || r;
- r = ((glVertexArrayColorOffsetEXT = (PFNGLVERTEXARRAYCOLOROFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayColorOffsetEXT")) == NULL) || r;
- r = ((glVertexArrayEdgeFlagOffsetEXT = (PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayEdgeFlagOffsetEXT")) == NULL) || r;
- r = ((glVertexArrayFogCoordOffsetEXT = (PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayFogCoordOffsetEXT")) == NULL) || r;
- r = ((glVertexArrayIndexOffsetEXT = (PFNGLVERTEXARRAYINDEXOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayIndexOffsetEXT")) == NULL) || r;
- r = ((glVertexArrayMultiTexCoordOffsetEXT = (PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayMultiTexCoordOffsetEXT")) == NULL) || r;
- r = ((glVertexArrayNormalOffsetEXT = (PFNGLVERTEXARRAYNORMALOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayNormalOffsetEXT")) == NULL) || r;
- r = ((glVertexArraySecondaryColorOffsetEXT = (PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArraySecondaryColorOffsetEXT")) == NULL) || r;
- r = ((glVertexArrayTexCoordOffsetEXT = (PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayTexCoordOffsetEXT")) == NULL) || r;
- r = ((glVertexArrayVertexAttribDivisorEXT = (PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribDivisorEXT")) == NULL) || r;
- r = ((glVertexArrayVertexAttribIOffsetEXT = (PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribIOffsetEXT")) == NULL) || r;
- r = ((glVertexArrayVertexAttribOffsetEXT = (PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribOffsetEXT")) == NULL) || r;
- r = ((glVertexArrayVertexOffsetEXT = (PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexOffsetEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_direct_state_access */
-
-#ifdef GL_EXT_draw_buffers2
-
-static GLboolean _glewInit_GL_EXT_draw_buffers2 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glColorMaskIndexedEXT = (PFNGLCOLORMASKINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glColorMaskIndexedEXT")) == NULL) || r;
- r = ((glDisableIndexedEXT = (PFNGLDISABLEINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableIndexedEXT")) == NULL) || r;
- r = ((glEnableIndexedEXT = (PFNGLENABLEINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableIndexedEXT")) == NULL) || r;
- r = ((glGetBooleanIndexedvEXT = (PFNGLGETBOOLEANINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetBooleanIndexedvEXT")) == NULL) || r;
- r = ((glGetIntegerIndexedvEXT = (PFNGLGETINTEGERINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetIntegerIndexedvEXT")) == NULL) || r;
- r = ((glIsEnabledIndexedEXT = (PFNGLISENABLEDINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glIsEnabledIndexedEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_draw_buffers2 */
-
-#ifdef GL_EXT_draw_instanced
-
-static GLboolean _glewInit_GL_EXT_draw_instanced (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawArraysInstancedEXT = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedEXT")) == NULL) || r;
- r = ((glDrawElementsInstancedEXT = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_draw_instanced */
-
-#ifdef GL_EXT_draw_range_elements
-
-static GLboolean _glewInit_GL_EXT_draw_range_elements (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawRangeElementsEXT = (PFNGLDRAWRANGEELEMENTSEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementsEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_draw_range_elements */
-
-#ifdef GL_EXT_fog_coord
-
-static GLboolean _glewInit_GL_EXT_fog_coord (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFogCoordPointerEXT = (PFNGLFOGCOORDPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoordPointerEXT")) == NULL) || r;
- r = ((glFogCoorddEXT = (PFNGLFOGCOORDDEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoorddEXT")) == NULL) || r;
- r = ((glFogCoorddvEXT = (PFNGLFOGCOORDDVEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoorddvEXT")) == NULL) || r;
- r = ((glFogCoordfEXT = (PFNGLFOGCOORDFEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoordfEXT")) == NULL) || r;
- r = ((glFogCoordfvEXT = (PFNGLFOGCOORDFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoordfvEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_fog_coord */
-
-#ifdef GL_EXT_fragment_lighting
-
-static GLboolean _glewInit_GL_EXT_fragment_lighting (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFragmentColorMaterialEXT = (PFNGLFRAGMENTCOLORMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentColorMaterialEXT")) == NULL) || r;
- r = ((glFragmentLightModelfEXT = (PFNGLFRAGMENTLIGHTMODELFEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfEXT")) == NULL) || r;
- r = ((glFragmentLightModelfvEXT = (PFNGLFRAGMENTLIGHTMODELFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfvEXT")) == NULL) || r;
- r = ((glFragmentLightModeliEXT = (PFNGLFRAGMENTLIGHTMODELIEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModeliEXT")) == NULL) || r;
- r = ((glFragmentLightModelivEXT = (PFNGLFRAGMENTLIGHTMODELIVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelivEXT")) == NULL) || r;
- r = ((glFragmentLightfEXT = (PFNGLFRAGMENTLIGHTFEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfEXT")) == NULL) || r;
- r = ((glFragmentLightfvEXT = (PFNGLFRAGMENTLIGHTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfvEXT")) == NULL) || r;
- r = ((glFragmentLightiEXT = (PFNGLFRAGMENTLIGHTIEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightiEXT")) == NULL) || r;
- r = ((glFragmentLightivEXT = (PFNGLFRAGMENTLIGHTIVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightivEXT")) == NULL) || r;
- r = ((glFragmentMaterialfEXT = (PFNGLFRAGMENTMATERIALFEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfEXT")) == NULL) || r;
- r = ((glFragmentMaterialfvEXT = (PFNGLFRAGMENTMATERIALFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfvEXT")) == NULL) || r;
- r = ((glFragmentMaterialiEXT = (PFNGLFRAGMENTMATERIALIEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialiEXT")) == NULL) || r;
- r = ((glFragmentMaterialivEXT = (PFNGLFRAGMENTMATERIALIVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialivEXT")) == NULL) || r;
- r = ((glGetFragmentLightfvEXT = (PFNGLGETFRAGMENTLIGHTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightfvEXT")) == NULL) || r;
- r = ((glGetFragmentLightivEXT = (PFNGLGETFRAGMENTLIGHTIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightivEXT")) == NULL) || r;
- r = ((glGetFragmentMaterialfvEXT = (PFNGLGETFRAGMENTMATERIALFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialfvEXT")) == NULL) || r;
- r = ((glGetFragmentMaterialivEXT = (PFNGLGETFRAGMENTMATERIALIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialivEXT")) == NULL) || r;
- r = ((glLightEnviEXT = (PFNGLLIGHTENVIEXTPROC)glewGetProcAddress((const GLubyte*)"glLightEnviEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_fragment_lighting */
-
-#ifdef GL_EXT_framebuffer_blit
-
-static GLboolean _glewInit_GL_EXT_framebuffer_blit (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlitFramebufferEXT = (PFNGLBLITFRAMEBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glBlitFramebufferEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_framebuffer_blit */
-
-#ifdef GL_EXT_framebuffer_multisample
-
-static GLboolean _glewInit_GL_EXT_framebuffer_multisample (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisampleEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_framebuffer_multisample */
-
-#ifdef GL_EXT_framebuffer_multisample_blit_scaled
-
-#endif /* GL_EXT_framebuffer_multisample_blit_scaled */
-
-#ifdef GL_EXT_framebuffer_object
-
-static GLboolean _glewInit_GL_EXT_framebuffer_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindFramebufferEXT")) == NULL) || r;
- r = ((glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindRenderbufferEXT")) == NULL) || r;
- r = ((glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)glewGetProcAddress((const GLubyte*)"glCheckFramebufferStatusEXT")) == NULL) || r;
- r = ((glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteFramebuffersEXT")) == NULL) || r;
- r = ((glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteRenderbuffersEXT")) == NULL) || r;
- r = ((glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferRenderbufferEXT")) == NULL) || r;
- r = ((glFramebufferTexture1DEXT = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture1DEXT")) == NULL) || r;
- r = ((glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture2DEXT")) == NULL) || r;
- r = ((glFramebufferTexture3DEXT = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture3DEXT")) == NULL) || r;
- r = ((glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenFramebuffersEXT")) == NULL) || r;
- r = ((glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenRenderbuffersEXT")) == NULL) || r;
- r = ((glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)glewGetProcAddress((const GLubyte*)"glGenerateMipmapEXT")) == NULL) || r;
- r = ((glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferAttachmentParameterivEXT")) == NULL) || r;
- r = ((glGetRenderbufferParameterivEXT = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetRenderbufferParameterivEXT")) == NULL) || r;
- r = ((glIsFramebufferEXT = (PFNGLISFRAMEBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glIsFramebufferEXT")) == NULL) || r;
- r = ((glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glIsRenderbufferEXT")) == NULL) || r;
- r = ((glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_framebuffer_object */
-
-#ifdef GL_EXT_framebuffer_sRGB
-
-#endif /* GL_EXT_framebuffer_sRGB */
-
-#ifdef GL_EXT_geometry_shader4
-
-static GLboolean _glewInit_GL_EXT_geometry_shader4 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFramebufferTextureEXT = (PFNGLFRAMEBUFFERTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureEXT")) == NULL) || r;
- r = ((glFramebufferTextureFaceEXT = (PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureFaceEXT")) == NULL) || r;
- r = ((glProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramParameteriEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_geometry_shader4 */
-
-#ifdef GL_EXT_gpu_program_parameters
-
-static GLboolean _glewInit_GL_EXT_gpu_program_parameters (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glProgramEnvParameters4fvEXT = (PFNGLPROGRAMENVPARAMETERS4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameters4fvEXT")) == NULL) || r;
- r = ((glProgramLocalParameters4fvEXT = (PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameters4fvEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_gpu_program_parameters */
-
-#ifdef GL_EXT_gpu_shader4
-
-static GLboolean _glewInit_GL_EXT_gpu_shader4 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindFragDataLocationEXT = (PFNGLBINDFRAGDATALOCATIONEXTPROC)glewGetProcAddress((const GLubyte*)"glBindFragDataLocationEXT")) == NULL) || r;
- r = ((glGetFragDataLocationEXT = (PFNGLGETFRAGDATALOCATIONEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragDataLocationEXT")) == NULL) || r;
- r = ((glGetUniformuivEXT = (PFNGLGETUNIFORMUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetUniformuivEXT")) == NULL) || r;
- r = ((glGetVertexAttribIivEXT = (PFNGLGETVERTEXATTRIBIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribIivEXT")) == NULL) || r;
- r = ((glGetVertexAttribIuivEXT = (PFNGLGETVERTEXATTRIBIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribIuivEXT")) == NULL) || r;
- r = ((glUniform1uiEXT = (PFNGLUNIFORM1UIEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform1uiEXT")) == NULL) || r;
- r = ((glUniform1uivEXT = (PFNGLUNIFORM1UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform1uivEXT")) == NULL) || r;
- r = ((glUniform2uiEXT = (PFNGLUNIFORM2UIEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform2uiEXT")) == NULL) || r;
- r = ((glUniform2uivEXT = (PFNGLUNIFORM2UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform2uivEXT")) == NULL) || r;
- r = ((glUniform3uiEXT = (PFNGLUNIFORM3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform3uiEXT")) == NULL) || r;
- r = ((glUniform3uivEXT = (PFNGLUNIFORM3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform3uivEXT")) == NULL) || r;
- r = ((glUniform4uiEXT = (PFNGLUNIFORM4UIEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform4uiEXT")) == NULL) || r;
- r = ((glUniform4uivEXT = (PFNGLUNIFORM4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform4uivEXT")) == NULL) || r;
- r = ((glVertexAttribI1iEXT = (PFNGLVERTEXATTRIBI1IEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1iEXT")) == NULL) || r;
- r = ((glVertexAttribI1ivEXT = (PFNGLVERTEXATTRIBI1IVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1ivEXT")) == NULL) || r;
- r = ((glVertexAttribI1uiEXT = (PFNGLVERTEXATTRIBI1UIEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1uiEXT")) == NULL) || r;
- r = ((glVertexAttribI1uivEXT = (PFNGLVERTEXATTRIBI1UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1uivEXT")) == NULL) || r;
- r = ((glVertexAttribI2iEXT = (PFNGLVERTEXATTRIBI2IEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2iEXT")) == NULL) || r;
- r = ((glVertexAttribI2ivEXT = (PFNGLVERTEXATTRIBI2IVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2ivEXT")) == NULL) || r;
- r = ((glVertexAttribI2uiEXT = (PFNGLVERTEXATTRIBI2UIEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2uiEXT")) == NULL) || r;
- r = ((glVertexAttribI2uivEXT = (PFNGLVERTEXATTRIBI2UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2uivEXT")) == NULL) || r;
- r = ((glVertexAttribI3iEXT = (PFNGLVERTEXATTRIBI3IEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3iEXT")) == NULL) || r;
- r = ((glVertexAttribI3ivEXT = (PFNGLVERTEXATTRIBI3IVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3ivEXT")) == NULL) || r;
- r = ((glVertexAttribI3uiEXT = (PFNGLVERTEXATTRIBI3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3uiEXT")) == NULL) || r;
- r = ((glVertexAttribI3uivEXT = (PFNGLVERTEXATTRIBI3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3uivEXT")) == NULL) || r;
- r = ((glVertexAttribI4bvEXT = (PFNGLVERTEXATTRIBI4BVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4bvEXT")) == NULL) || r;
- r = ((glVertexAttribI4iEXT = (PFNGLVERTEXATTRIBI4IEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4iEXT")) == NULL) || r;
- r = ((glVertexAttribI4ivEXT = (PFNGLVERTEXATTRIBI4IVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4ivEXT")) == NULL) || r;
- r = ((glVertexAttribI4svEXT = (PFNGLVERTEXATTRIBI4SVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4svEXT")) == NULL) || r;
- r = ((glVertexAttribI4ubvEXT = (PFNGLVERTEXATTRIBI4UBVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4ubvEXT")) == NULL) || r;
- r = ((glVertexAttribI4uiEXT = (PFNGLVERTEXATTRIBI4UIEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4uiEXT")) == NULL) || r;
- r = ((glVertexAttribI4uivEXT = (PFNGLVERTEXATTRIBI4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4uivEXT")) == NULL) || r;
- r = ((glVertexAttribI4usvEXT = (PFNGLVERTEXATTRIBI4USVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4usvEXT")) == NULL) || r;
- r = ((glVertexAttribIPointerEXT = (PFNGLVERTEXATTRIBIPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribIPointerEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_gpu_shader4 */
-
-#ifdef GL_EXT_histogram
-
-static GLboolean _glewInit_GL_EXT_histogram (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetHistogramEXT = (PFNGLGETHISTOGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramEXT")) == NULL) || r;
- r = ((glGetHistogramParameterfvEXT = (PFNGLGETHISTOGRAMPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameterfvEXT")) == NULL) || r;
- r = ((glGetHistogramParameterivEXT = (PFNGLGETHISTOGRAMPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameterivEXT")) == NULL) || r;
- r = ((glGetMinmaxEXT = (PFNGLGETMINMAXEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxEXT")) == NULL) || r;
- r = ((glGetMinmaxParameterfvEXT = (PFNGLGETMINMAXPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameterfvEXT")) == NULL) || r;
- r = ((glGetMinmaxParameterivEXT = (PFNGLGETMINMAXPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameterivEXT")) == NULL) || r;
- r = ((glHistogramEXT = (PFNGLHISTOGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glHistogramEXT")) == NULL) || r;
- r = ((glMinmaxEXT = (PFNGLMINMAXEXTPROC)glewGetProcAddress((const GLubyte*)"glMinmaxEXT")) == NULL) || r;
- r = ((glResetHistogramEXT = (PFNGLRESETHISTOGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glResetHistogramEXT")) == NULL) || r;
- r = ((glResetMinmaxEXT = (PFNGLRESETMINMAXEXTPROC)glewGetProcAddress((const GLubyte*)"glResetMinmaxEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_histogram */
-
-#ifdef GL_EXT_index_array_formats
-
-#endif /* GL_EXT_index_array_formats */
-
-#ifdef GL_EXT_index_func
-
-static GLboolean _glewInit_GL_EXT_index_func (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glIndexFuncEXT = (PFNGLINDEXFUNCEXTPROC)glewGetProcAddress((const GLubyte*)"glIndexFuncEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_index_func */
-
-#ifdef GL_EXT_index_material
-
-static GLboolean _glewInit_GL_EXT_index_material (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glIndexMaterialEXT = (PFNGLINDEXMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glIndexMaterialEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_index_material */
-
-#ifdef GL_EXT_index_texture
-
-#endif /* GL_EXT_index_texture */
-
-#ifdef GL_EXT_light_texture
-
-static GLboolean _glewInit_GL_EXT_light_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glApplyTextureEXT = (PFNGLAPPLYTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glApplyTextureEXT")) == NULL) || r;
- r = ((glTextureLightEXT = (PFNGLTEXTURELIGHTEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureLightEXT")) == NULL) || r;
- r = ((glTextureMaterialEXT = (PFNGLTEXTUREMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureMaterialEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_light_texture */
-
-#ifdef GL_EXT_misc_attribute
-
-#endif /* GL_EXT_misc_attribute */
-
-#ifdef GL_EXT_multi_draw_arrays
-
-static GLboolean _glewInit_GL_EXT_multi_draw_arrays (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glMultiDrawArraysEXT = (PFNGLMULTIDRAWARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysEXT")) == NULL) || r;
- r = ((glMultiDrawElementsEXT = (PFNGLMULTIDRAWELEMENTSEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_multi_draw_arrays */
-
-#ifdef GL_EXT_multisample
-
-static GLboolean _glewInit_GL_EXT_multisample (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glSampleMaskEXT = (PFNGLSAMPLEMASKEXTPROC)glewGetProcAddress((const GLubyte*)"glSampleMaskEXT")) == NULL) || r;
- r = ((glSamplePatternEXT = (PFNGLSAMPLEPATTERNEXTPROC)glewGetProcAddress((const GLubyte*)"glSamplePatternEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_multisample */
-
-#ifdef GL_EXT_packed_depth_stencil
-
-#endif /* GL_EXT_packed_depth_stencil */
-
-#ifdef GL_EXT_packed_float
-
-#endif /* GL_EXT_packed_float */
-
-#ifdef GL_EXT_packed_pixels
-
-#endif /* GL_EXT_packed_pixels */
-
-#ifdef GL_EXT_paletted_texture
-
-static GLboolean _glewInit_GL_EXT_paletted_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glColorTableEXT = (PFNGLCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glColorTableEXT")) == NULL) || r;
- r = ((glGetColorTableEXT = (PFNGLGETCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableEXT")) == NULL) || r;
- r = ((glGetColorTableParameterfvEXT = (PFNGLGETCOLORTABLEPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterfvEXT")) == NULL) || r;
- r = ((glGetColorTableParameterivEXT = (PFNGLGETCOLORTABLEPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterivEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_paletted_texture */
-
-#ifdef GL_EXT_pixel_buffer_object
-
-#endif /* GL_EXT_pixel_buffer_object */
-
-#ifdef GL_EXT_pixel_transform
-
-static GLboolean _glewInit_GL_EXT_pixel_transform (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetPixelTransformParameterfvEXT = (PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPixelTransformParameterfvEXT")) == NULL) || r;
- r = ((glGetPixelTransformParameterivEXT = (PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPixelTransformParameterivEXT")) == NULL) || r;
- r = ((glPixelTransformParameterfEXT = (PFNGLPIXELTRANSFORMPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameterfEXT")) == NULL) || r;
- r = ((glPixelTransformParameterfvEXT = (PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameterfvEXT")) == NULL) || r;
- r = ((glPixelTransformParameteriEXT = (PFNGLPIXELTRANSFORMPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameteriEXT")) == NULL) || r;
- r = ((glPixelTransformParameterivEXT = (PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameterivEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_pixel_transform */
-
-#ifdef GL_EXT_pixel_transform_color_table
-
-#endif /* GL_EXT_pixel_transform_color_table */
-
-#ifdef GL_EXT_point_parameters
-
-static GLboolean _glewInit_GL_EXT_point_parameters (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glPointParameterfEXT = (PFNGLPOINTPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfEXT")) == NULL) || r;
- r = ((glPointParameterfvEXT = (PFNGLPOINTPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfvEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_point_parameters */
-
-#ifdef GL_EXT_polygon_offset
-
-static GLboolean _glewInit_GL_EXT_polygon_offset (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glPolygonOffsetEXT = (PFNGLPOLYGONOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glPolygonOffsetEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_polygon_offset */
-
-#ifdef GL_EXT_polygon_offset_clamp
-
-static GLboolean _glewInit_GL_EXT_polygon_offset_clamp (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glPolygonOffsetClampEXT = (PFNGLPOLYGONOFFSETCLAMPEXTPROC)glewGetProcAddress((const GLubyte*)"glPolygonOffsetClampEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_polygon_offset_clamp */
-
-#ifdef GL_EXT_post_depth_coverage
-
-#endif /* GL_EXT_post_depth_coverage */
-
-#ifdef GL_EXT_provoking_vertex
-
-static GLboolean _glewInit_GL_EXT_provoking_vertex (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glProvokingVertexEXT = (PFNGLPROVOKINGVERTEXEXTPROC)glewGetProcAddress((const GLubyte*)"glProvokingVertexEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_provoking_vertex */
-
-#ifdef GL_EXT_raster_multisample
-
-static GLboolean _glewInit_GL_EXT_raster_multisample (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCoverageModulationNV = (PFNGLCOVERAGEMODULATIONNVPROC)glewGetProcAddress((const GLubyte*)"glCoverageModulationNV")) == NULL) || r;
- r = ((glCoverageModulationTableNV = (PFNGLCOVERAGEMODULATIONTABLENVPROC)glewGetProcAddress((const GLubyte*)"glCoverageModulationTableNV")) == NULL) || r;
- r = ((glGetCoverageModulationTableNV = (PFNGLGETCOVERAGEMODULATIONTABLENVPROC)glewGetProcAddress((const GLubyte*)"glGetCoverageModulationTableNV")) == NULL) || r;
- r = ((glRasterSamplesEXT = (PFNGLRASTERSAMPLESEXTPROC)glewGetProcAddress((const GLubyte*)"glRasterSamplesEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_raster_multisample */
-
-#ifdef GL_EXT_rescale_normal
-
-#endif /* GL_EXT_rescale_normal */
-
-#ifdef GL_EXT_scene_marker
-
-static GLboolean _glewInit_GL_EXT_scene_marker (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginSceneEXT = (PFNGLBEGINSCENEEXTPROC)glewGetProcAddress((const GLubyte*)"glBeginSceneEXT")) == NULL) || r;
- r = ((glEndSceneEXT = (PFNGLENDSCENEEXTPROC)glewGetProcAddress((const GLubyte*)"glEndSceneEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_scene_marker */
-
-#ifdef GL_EXT_secondary_color
-
-static GLboolean _glewInit_GL_EXT_secondary_color (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glSecondaryColor3bEXT = (PFNGLSECONDARYCOLOR3BEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3bEXT")) == NULL) || r;
- r = ((glSecondaryColor3bvEXT = (PFNGLSECONDARYCOLOR3BVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3bvEXT")) == NULL) || r;
- r = ((glSecondaryColor3dEXT = (PFNGLSECONDARYCOLOR3DEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3dEXT")) == NULL) || r;
- r = ((glSecondaryColor3dvEXT = (PFNGLSECONDARYCOLOR3DVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3dvEXT")) == NULL) || r;
- r = ((glSecondaryColor3fEXT = (PFNGLSECONDARYCOLOR3FEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3fEXT")) == NULL) || r;
- r = ((glSecondaryColor3fvEXT = (PFNGLSECONDARYCOLOR3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3fvEXT")) == NULL) || r;
- r = ((glSecondaryColor3iEXT = (PFNGLSECONDARYCOLOR3IEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3iEXT")) == NULL) || r;
- r = ((glSecondaryColor3ivEXT = (PFNGLSECONDARYCOLOR3IVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ivEXT")) == NULL) || r;
- r = ((glSecondaryColor3sEXT = (PFNGLSECONDARYCOLOR3SEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3sEXT")) == NULL) || r;
- r = ((glSecondaryColor3svEXT = (PFNGLSECONDARYCOLOR3SVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3svEXT")) == NULL) || r;
- r = ((glSecondaryColor3ubEXT = (PFNGLSECONDARYCOLOR3UBEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ubEXT")) == NULL) || r;
- r = ((glSecondaryColor3ubvEXT = (PFNGLSECONDARYCOLOR3UBVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ubvEXT")) == NULL) || r;
- r = ((glSecondaryColor3uiEXT = (PFNGLSECONDARYCOLOR3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3uiEXT")) == NULL) || r;
- r = ((glSecondaryColor3uivEXT = (PFNGLSECONDARYCOLOR3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3uivEXT")) == NULL) || r;
- r = ((glSecondaryColor3usEXT = (PFNGLSECONDARYCOLOR3USEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3usEXT")) == NULL) || r;
- r = ((glSecondaryColor3usvEXT = (PFNGLSECONDARYCOLOR3USVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3usvEXT")) == NULL) || r;
- r = ((glSecondaryColorPointerEXT = (PFNGLSECONDARYCOLORPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorPointerEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_secondary_color */
-
-#ifdef GL_EXT_separate_shader_objects
-
-static GLboolean _glewInit_GL_EXT_separate_shader_objects (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glActiveProgramEXT = (PFNGLACTIVEPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glActiveProgramEXT")) == NULL) || r;
- r = ((glCreateShaderProgramEXT = (PFNGLCREATESHADERPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glCreateShaderProgramEXT")) == NULL) || r;
- r = ((glUseShaderProgramEXT = (PFNGLUSESHADERPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glUseShaderProgramEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_separate_shader_objects */
-
-#ifdef GL_EXT_separate_specular_color
-
-#endif /* GL_EXT_separate_specular_color */
-
-#ifdef GL_EXT_shader_image_load_formatted
-
-#endif /* GL_EXT_shader_image_load_formatted */
-
-#ifdef GL_EXT_shader_image_load_store
-
-static GLboolean _glewInit_GL_EXT_shader_image_load_store (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindImageTextureEXT = (PFNGLBINDIMAGETEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glBindImageTextureEXT")) == NULL) || r;
- r = ((glMemoryBarrierEXT = (PFNGLMEMORYBARRIEREXTPROC)glewGetProcAddress((const GLubyte*)"glMemoryBarrierEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_shader_image_load_store */
-
-#ifdef GL_EXT_shader_integer_mix
-
-#endif /* GL_EXT_shader_integer_mix */
-
-#ifdef GL_EXT_shadow_funcs
-
-#endif /* GL_EXT_shadow_funcs */
-
-#ifdef GL_EXT_shared_texture_palette
-
-#endif /* GL_EXT_shared_texture_palette */
-
-#ifdef GL_EXT_sparse_texture2
-
-#endif /* GL_EXT_sparse_texture2 */
-
-#ifdef GL_EXT_stencil_clear_tag
-
-#endif /* GL_EXT_stencil_clear_tag */
-
-#ifdef GL_EXT_stencil_two_side
-
-static GLboolean _glewInit_GL_EXT_stencil_two_side (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glActiveStencilFaceEXT = (PFNGLACTIVESTENCILFACEEXTPROC)glewGetProcAddress((const GLubyte*)"glActiveStencilFaceEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_stencil_two_side */
-
-#ifdef GL_EXT_stencil_wrap
-
-#endif /* GL_EXT_stencil_wrap */
-
-#ifdef GL_EXT_subtexture
-
-static GLboolean _glewInit_GL_EXT_subtexture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTexSubImage1DEXT = (PFNGLTEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage1DEXT")) == NULL) || r;
- r = ((glTexSubImage2DEXT = (PFNGLTEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage2DEXT")) == NULL) || r;
- r = ((glTexSubImage3DEXT = (PFNGLTEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage3DEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_subtexture */
-
-#ifdef GL_EXT_texture
-
-#endif /* GL_EXT_texture */
-
-#ifdef GL_EXT_texture3D
-
-static GLboolean _glewInit_GL_EXT_texture3D (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTexImage3DEXT = (PFNGLTEXIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexImage3DEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_texture3D */
-
-#ifdef GL_EXT_texture_array
-
-static GLboolean _glewInit_GL_EXT_texture_array (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFramebufferTextureLayerEXT = (PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureLayerEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_texture_array */
-
-#ifdef GL_EXT_texture_buffer_object
-
-static GLboolean _glewInit_GL_EXT_texture_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTexBufferEXT = (PFNGLTEXBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glTexBufferEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_texture_buffer_object */
-
-#ifdef GL_EXT_texture_compression_dxt1
-
-#endif /* GL_EXT_texture_compression_dxt1 */
-
-#ifdef GL_EXT_texture_compression_latc
-
-#endif /* GL_EXT_texture_compression_latc */
-
-#ifdef GL_EXT_texture_compression_rgtc
-
-#endif /* GL_EXT_texture_compression_rgtc */
-
-#ifdef GL_EXT_texture_compression_s3tc
-
-#endif /* GL_EXT_texture_compression_s3tc */
-
-#ifdef GL_EXT_texture_cube_map
-
-#endif /* GL_EXT_texture_cube_map */
-
-#ifdef GL_EXT_texture_edge_clamp
-
-#endif /* GL_EXT_texture_edge_clamp */
-
-#ifdef GL_EXT_texture_env
-
-#endif /* GL_EXT_texture_env */
-
-#ifdef GL_EXT_texture_env_add
-
-#endif /* GL_EXT_texture_env_add */
-
-#ifdef GL_EXT_texture_env_combine
-
-#endif /* GL_EXT_texture_env_combine */
-
-#ifdef GL_EXT_texture_env_dot3
-
-#endif /* GL_EXT_texture_env_dot3 */
-
-#ifdef GL_EXT_texture_filter_anisotropic
-
-#endif /* GL_EXT_texture_filter_anisotropic */
-
-#ifdef GL_EXT_texture_filter_minmax
-
-#endif /* GL_EXT_texture_filter_minmax */
-
-#ifdef GL_EXT_texture_integer
-
-static GLboolean _glewInit_GL_EXT_texture_integer (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glClearColorIiEXT = (PFNGLCLEARCOLORIIEXTPROC)glewGetProcAddress((const GLubyte*)"glClearColorIiEXT")) == NULL) || r;
- r = ((glClearColorIuiEXT = (PFNGLCLEARCOLORIUIEXTPROC)glewGetProcAddress((const GLubyte*)"glClearColorIuiEXT")) == NULL) || r;
- r = ((glGetTexParameterIivEXT = (PFNGLGETTEXPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIivEXT")) == NULL) || r;
- r = ((glGetTexParameterIuivEXT = (PFNGLGETTEXPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIuivEXT")) == NULL) || r;
- r = ((glTexParameterIivEXT = (PFNGLTEXPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTexParameterIivEXT")) == NULL) || r;
- r = ((glTexParameterIuivEXT = (PFNGLTEXPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTexParameterIuivEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_texture_integer */
-
-#ifdef GL_EXT_texture_lod_bias
-
-#endif /* GL_EXT_texture_lod_bias */
-
-#ifdef GL_EXT_texture_mirror_clamp
-
-#endif /* GL_EXT_texture_mirror_clamp */
-
-#ifdef GL_EXT_texture_object
-
-static GLboolean _glewInit_GL_EXT_texture_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glAreTexturesResidentEXT = (PFNGLARETEXTURESRESIDENTEXTPROC)glewGetProcAddress((const GLubyte*)"glAreTexturesResidentEXT")) == NULL) || r;
- r = ((glBindTextureEXT = (PFNGLBINDTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glBindTextureEXT")) == NULL) || r;
- r = ((glDeleteTexturesEXT = (PFNGLDELETETEXTURESEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteTexturesEXT")) == NULL) || r;
- r = ((glGenTexturesEXT = (PFNGLGENTEXTURESEXTPROC)glewGetProcAddress((const GLubyte*)"glGenTexturesEXT")) == NULL) || r;
- r = ((glIsTextureEXT = (PFNGLISTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glIsTextureEXT")) == NULL) || r;
- r = ((glPrioritizeTexturesEXT = (PFNGLPRIORITIZETEXTURESEXTPROC)glewGetProcAddress((const GLubyte*)"glPrioritizeTexturesEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_texture_object */
-
-#ifdef GL_EXT_texture_perturb_normal
-
-static GLboolean _glewInit_GL_EXT_texture_perturb_normal (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTextureNormalEXT = (PFNGLTEXTURENORMALEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureNormalEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_texture_perturb_normal */
-
-#ifdef GL_EXT_texture_rectangle
-
-#endif /* GL_EXT_texture_rectangle */
-
-#ifdef GL_EXT_texture_sRGB
-
-#endif /* GL_EXT_texture_sRGB */
-
-#ifdef GL_EXT_texture_sRGB_decode
-
-#endif /* GL_EXT_texture_sRGB_decode */
-
-#ifdef GL_EXT_texture_shared_exponent
-
-#endif /* GL_EXT_texture_shared_exponent */
-
-#ifdef GL_EXT_texture_snorm
-
-#endif /* GL_EXT_texture_snorm */
-
-#ifdef GL_EXT_texture_swizzle
-
-#endif /* GL_EXT_texture_swizzle */
-
-#ifdef GL_EXT_timer_query
-
-static GLboolean _glewInit_GL_EXT_timer_query (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetQueryObjecti64vEXT = (PFNGLGETQUERYOBJECTI64VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjecti64vEXT")) == NULL) || r;
- r = ((glGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectui64vEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_timer_query */
-
-#ifdef GL_EXT_transform_feedback
-
-static GLboolean _glewInit_GL_EXT_transform_feedback (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginTransformFeedbackEXT = (PFNGLBEGINTRANSFORMFEEDBACKEXTPROC)glewGetProcAddress((const GLubyte*)"glBeginTransformFeedbackEXT")) == NULL) || r;
- r = ((glBindBufferBaseEXT = (PFNGLBINDBUFFERBASEEXTPROC)glewGetProcAddress((const GLubyte*)"glBindBufferBaseEXT")) == NULL) || r;
- r = ((glBindBufferOffsetEXT = (PFNGLBINDBUFFEROFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glBindBufferOffsetEXT")) == NULL) || r;
- r = ((glBindBufferRangeEXT = (PFNGLBINDBUFFERRANGEEXTPROC)glewGetProcAddress((const GLubyte*)"glBindBufferRangeEXT")) == NULL) || r;
- r = ((glEndTransformFeedbackEXT = (PFNGLENDTRANSFORMFEEDBACKEXTPROC)glewGetProcAddress((const GLubyte*)"glEndTransformFeedbackEXT")) == NULL) || r;
- r = ((glGetTransformFeedbackVaryingEXT = (PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbackVaryingEXT")) == NULL) || r;
- r = ((glTransformFeedbackVaryingsEXT = (PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackVaryingsEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_transform_feedback */
-
-#ifdef GL_EXT_vertex_array
-
-static GLboolean _glewInit_GL_EXT_vertex_array (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glArrayElementEXT = (PFNGLARRAYELEMENTEXTPROC)glewGetProcAddress((const GLubyte*)"glArrayElementEXT")) == NULL) || r;
- r = ((glColorPointerEXT = (PFNGLCOLORPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glColorPointerEXT")) == NULL) || r;
- r = ((glDrawArraysEXT = (PFNGLDRAWARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysEXT")) == NULL) || r;
- r = ((glEdgeFlagPointerEXT = (PFNGLEDGEFLAGPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glEdgeFlagPointerEXT")) == NULL) || r;
- r = ((glIndexPointerEXT = (PFNGLINDEXPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glIndexPointerEXT")) == NULL) || r;
- r = ((glNormalPointerEXT = (PFNGLNORMALPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glNormalPointerEXT")) == NULL) || r;
- r = ((glTexCoordPointerEXT = (PFNGLTEXCOORDPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glTexCoordPointerEXT")) == NULL) || r;
- r = ((glVertexPointerEXT = (PFNGLVERTEXPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexPointerEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_vertex_array */
-
-#ifdef GL_EXT_vertex_array_bgra
-
-#endif /* GL_EXT_vertex_array_bgra */
-
-#ifdef GL_EXT_vertex_attrib_64bit
-
-static GLboolean _glewInit_GL_EXT_vertex_attrib_64bit (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetVertexAttribLdvEXT = (PFNGLGETVERTEXATTRIBLDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLdvEXT")) == NULL) || r;
- r = ((glVertexArrayVertexAttribLOffsetEXT = (PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribLOffsetEXT")) == NULL) || r;
- r = ((glVertexAttribL1dEXT = (PFNGLVERTEXATTRIBL1DEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1dEXT")) == NULL) || r;
- r = ((glVertexAttribL1dvEXT = (PFNGLVERTEXATTRIBL1DVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1dvEXT")) == NULL) || r;
- r = ((glVertexAttribL2dEXT = (PFNGLVERTEXATTRIBL2DEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2dEXT")) == NULL) || r;
- r = ((glVertexAttribL2dvEXT = (PFNGLVERTEXATTRIBL2DVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2dvEXT")) == NULL) || r;
- r = ((glVertexAttribL3dEXT = (PFNGLVERTEXATTRIBL3DEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3dEXT")) == NULL) || r;
- r = ((glVertexAttribL3dvEXT = (PFNGLVERTEXATTRIBL3DVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3dvEXT")) == NULL) || r;
- r = ((glVertexAttribL4dEXT = (PFNGLVERTEXATTRIBL4DEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4dEXT")) == NULL) || r;
- r = ((glVertexAttribL4dvEXT = (PFNGLVERTEXATTRIBL4DVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4dvEXT")) == NULL) || r;
- r = ((glVertexAttribLPointerEXT = (PFNGLVERTEXATTRIBLPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribLPointerEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_vertex_attrib_64bit */
-
-#ifdef GL_EXT_vertex_shader
-
-static GLboolean _glewInit_GL_EXT_vertex_shader (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginVertexShaderEXT = (PFNGLBEGINVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glBeginVertexShaderEXT")) == NULL) || r;
- r = ((glBindLightParameterEXT = (PFNGLBINDLIGHTPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindLightParameterEXT")) == NULL) || r;
- r = ((glBindMaterialParameterEXT = (PFNGLBINDMATERIALPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindMaterialParameterEXT")) == NULL) || r;
- r = ((glBindParameterEXT = (PFNGLBINDPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindParameterEXT")) == NULL) || r;
- r = ((glBindTexGenParameterEXT = (PFNGLBINDTEXGENPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindTexGenParameterEXT")) == NULL) || r;
- r = ((glBindTextureUnitParameterEXT = (PFNGLBINDTEXTUREUNITPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindTextureUnitParameterEXT")) == NULL) || r;
- r = ((glBindVertexShaderEXT = (PFNGLBINDVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindVertexShaderEXT")) == NULL) || r;
- r = ((glDeleteVertexShaderEXT = (PFNGLDELETEVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteVertexShaderEXT")) == NULL) || r;
- r = ((glDisableVariantClientStateEXT = (PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableVariantClientStateEXT")) == NULL) || r;
- r = ((glEnableVariantClientStateEXT = (PFNGLENABLEVARIANTCLIENTSTATEEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableVariantClientStateEXT")) == NULL) || r;
- r = ((glEndVertexShaderEXT = (PFNGLENDVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glEndVertexShaderEXT")) == NULL) || r;
- r = ((glExtractComponentEXT = (PFNGLEXTRACTCOMPONENTEXTPROC)glewGetProcAddress((const GLubyte*)"glExtractComponentEXT")) == NULL) || r;
- r = ((glGenSymbolsEXT = (PFNGLGENSYMBOLSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenSymbolsEXT")) == NULL) || r;
- r = ((glGenVertexShadersEXT = (PFNGLGENVERTEXSHADERSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenVertexShadersEXT")) == NULL) || r;
- r = ((glGetInvariantBooleanvEXT = (PFNGLGETINVARIANTBOOLEANVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetInvariantBooleanvEXT")) == NULL) || r;
- r = ((glGetInvariantFloatvEXT = (PFNGLGETINVARIANTFLOATVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetInvariantFloatvEXT")) == NULL) || r;
- r = ((glGetInvariantIntegervEXT = (PFNGLGETINVARIANTINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetInvariantIntegervEXT")) == NULL) || r;
- r = ((glGetLocalConstantBooleanvEXT = (PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetLocalConstantBooleanvEXT")) == NULL) || r;
- r = ((glGetLocalConstantFloatvEXT = (PFNGLGETLOCALCONSTANTFLOATVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetLocalConstantFloatvEXT")) == NULL) || r;
- r = ((glGetLocalConstantIntegervEXT = (PFNGLGETLOCALCONSTANTINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetLocalConstantIntegervEXT")) == NULL) || r;
- r = ((glGetVariantBooleanvEXT = (PFNGLGETVARIANTBOOLEANVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantBooleanvEXT")) == NULL) || r;
- r = ((glGetVariantFloatvEXT = (PFNGLGETVARIANTFLOATVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantFloatvEXT")) == NULL) || r;
- r = ((glGetVariantIntegervEXT = (PFNGLGETVARIANTINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantIntegervEXT")) == NULL) || r;
- r = ((glGetVariantPointervEXT = (PFNGLGETVARIANTPOINTERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantPointervEXT")) == NULL) || r;
- r = ((glInsertComponentEXT = (PFNGLINSERTCOMPONENTEXTPROC)glewGetProcAddress((const GLubyte*)"glInsertComponentEXT")) == NULL) || r;
- r = ((glIsVariantEnabledEXT = (PFNGLISVARIANTENABLEDEXTPROC)glewGetProcAddress((const GLubyte*)"glIsVariantEnabledEXT")) == NULL) || r;
- r = ((glSetInvariantEXT = (PFNGLSETINVARIANTEXTPROC)glewGetProcAddress((const GLubyte*)"glSetInvariantEXT")) == NULL) || r;
- r = ((glSetLocalConstantEXT = (PFNGLSETLOCALCONSTANTEXTPROC)glewGetProcAddress((const GLubyte*)"glSetLocalConstantEXT")) == NULL) || r;
- r = ((glShaderOp1EXT = (PFNGLSHADEROP1EXTPROC)glewGetProcAddress((const GLubyte*)"glShaderOp1EXT")) == NULL) || r;
- r = ((glShaderOp2EXT = (PFNGLSHADEROP2EXTPROC)glewGetProcAddress((const GLubyte*)"glShaderOp2EXT")) == NULL) || r;
- r = ((glShaderOp3EXT = (PFNGLSHADEROP3EXTPROC)glewGetProcAddress((const GLubyte*)"glShaderOp3EXT")) == NULL) || r;
- r = ((glSwizzleEXT = (PFNGLSWIZZLEEXTPROC)glewGetProcAddress((const GLubyte*)"glSwizzleEXT")) == NULL) || r;
- r = ((glVariantPointerEXT = (PFNGLVARIANTPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVariantPointerEXT")) == NULL) || r;
- r = ((glVariantbvEXT = (PFNGLVARIANTBVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantbvEXT")) == NULL) || r;
- r = ((glVariantdvEXT = (PFNGLVARIANTDVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantdvEXT")) == NULL) || r;
- r = ((glVariantfvEXT = (PFNGLVARIANTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantfvEXT")) == NULL) || r;
- r = ((glVariantivEXT = (PFNGLVARIANTIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantivEXT")) == NULL) || r;
- r = ((glVariantsvEXT = (PFNGLVARIANTSVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantsvEXT")) == NULL) || r;
- r = ((glVariantubvEXT = (PFNGLVARIANTUBVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantubvEXT")) == NULL) || r;
- r = ((glVariantuivEXT = (PFNGLVARIANTUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantuivEXT")) == NULL) || r;
- r = ((glVariantusvEXT = (PFNGLVARIANTUSVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantusvEXT")) == NULL) || r;
- r = ((glWriteMaskEXT = (PFNGLWRITEMASKEXTPROC)glewGetProcAddress((const GLubyte*)"glWriteMaskEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_vertex_shader */
-
-#ifdef GL_EXT_vertex_weighting
-
-static GLboolean _glewInit_GL_EXT_vertex_weighting (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glVertexWeightPointerEXT = (PFNGLVERTEXWEIGHTPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexWeightPointerEXT")) == NULL) || r;
- r = ((glVertexWeightfEXT = (PFNGLVERTEXWEIGHTFEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexWeightfEXT")) == NULL) || r;
- r = ((glVertexWeightfvEXT = (PFNGLVERTEXWEIGHTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexWeightfvEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_vertex_weighting */
-
-#ifdef GL_EXT_x11_sync_object
-
-static GLboolean _glewInit_GL_EXT_x11_sync_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glImportSyncEXT = (PFNGLIMPORTSYNCEXTPROC)glewGetProcAddress((const GLubyte*)"glImportSyncEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_EXT_x11_sync_object */
-
-#ifdef GL_GREMEDY_frame_terminator
-
-static GLboolean _glewInit_GL_GREMEDY_frame_terminator (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFrameTerminatorGREMEDY = (PFNGLFRAMETERMINATORGREMEDYPROC)glewGetProcAddress((const GLubyte*)"glFrameTerminatorGREMEDY")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_GREMEDY_frame_terminator */
-
-#ifdef GL_GREMEDY_string_marker
-
-static GLboolean _glewInit_GL_GREMEDY_string_marker (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glStringMarkerGREMEDY = (PFNGLSTRINGMARKERGREMEDYPROC)glewGetProcAddress((const GLubyte*)"glStringMarkerGREMEDY")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_GREMEDY_string_marker */
-
-#ifdef GL_HP_convolution_border_modes
-
-#endif /* GL_HP_convolution_border_modes */
-
-#ifdef GL_HP_image_transform
-
-static GLboolean _glewInit_GL_HP_image_transform (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetImageTransformParameterfvHP = (PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC)glewGetProcAddress((const GLubyte*)"glGetImageTransformParameterfvHP")) == NULL) || r;
- r = ((glGetImageTransformParameterivHP = (PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC)glewGetProcAddress((const GLubyte*)"glGetImageTransformParameterivHP")) == NULL) || r;
- r = ((glImageTransformParameterfHP = (PFNGLIMAGETRANSFORMPARAMETERFHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameterfHP")) == NULL) || r;
- r = ((glImageTransformParameterfvHP = (PFNGLIMAGETRANSFORMPARAMETERFVHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameterfvHP")) == NULL) || r;
- r = ((glImageTransformParameteriHP = (PFNGLIMAGETRANSFORMPARAMETERIHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameteriHP")) == NULL) || r;
- r = ((glImageTransformParameterivHP = (PFNGLIMAGETRANSFORMPARAMETERIVHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameterivHP")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_HP_image_transform */
-
-#ifdef GL_HP_occlusion_test
-
-#endif /* GL_HP_occlusion_test */
-
-#ifdef GL_HP_texture_lighting
-
-#endif /* GL_HP_texture_lighting */
-
-#ifdef GL_IBM_cull_vertex
-
-#endif /* GL_IBM_cull_vertex */
-
-#ifdef GL_IBM_multimode_draw_arrays
-
-static GLboolean _glewInit_GL_IBM_multimode_draw_arrays (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glMultiModeDrawArraysIBM = (PFNGLMULTIMODEDRAWARRAYSIBMPROC)glewGetProcAddress((const GLubyte*)"glMultiModeDrawArraysIBM")) == NULL) || r;
- r = ((glMultiModeDrawElementsIBM = (PFNGLMULTIMODEDRAWELEMENTSIBMPROC)glewGetProcAddress((const GLubyte*)"glMultiModeDrawElementsIBM")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_IBM_multimode_draw_arrays */
-
-#ifdef GL_IBM_rasterpos_clip
-
-#endif /* GL_IBM_rasterpos_clip */
-
-#ifdef GL_IBM_static_data
-
-#endif /* GL_IBM_static_data */
-
-#ifdef GL_IBM_texture_mirrored_repeat
-
-#endif /* GL_IBM_texture_mirrored_repeat */
-
-#ifdef GL_IBM_vertex_array_lists
-
-static GLboolean _glewInit_GL_IBM_vertex_array_lists (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glColorPointerListIBM = (PFNGLCOLORPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glColorPointerListIBM")) == NULL) || r;
- r = ((glEdgeFlagPointerListIBM = (PFNGLEDGEFLAGPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glEdgeFlagPointerListIBM")) == NULL) || r;
- r = ((glFogCoordPointerListIBM = (PFNGLFOGCOORDPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glFogCoordPointerListIBM")) == NULL) || r;
- r = ((glIndexPointerListIBM = (PFNGLINDEXPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glIndexPointerListIBM")) == NULL) || r;
- r = ((glNormalPointerListIBM = (PFNGLNORMALPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glNormalPointerListIBM")) == NULL) || r;
- r = ((glSecondaryColorPointerListIBM = (PFNGLSECONDARYCOLORPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorPointerListIBM")) == NULL) || r;
- r = ((glTexCoordPointerListIBM = (PFNGLTEXCOORDPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glTexCoordPointerListIBM")) == NULL) || r;
- r = ((glVertexPointerListIBM = (PFNGLVERTEXPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glVertexPointerListIBM")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_IBM_vertex_array_lists */
-
-#ifdef GL_INGR_color_clamp
-
-#endif /* GL_INGR_color_clamp */
-
-#ifdef GL_INGR_interlace_read
-
-#endif /* GL_INGR_interlace_read */
-
-#ifdef GL_INTEL_fragment_shader_ordering
-
-#endif /* GL_INTEL_fragment_shader_ordering */
-
-#ifdef GL_INTEL_map_texture
-
-static GLboolean _glewInit_GL_INTEL_map_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glMapTexture2DINTEL = (PFNGLMAPTEXTURE2DINTELPROC)glewGetProcAddress((const GLubyte*)"glMapTexture2DINTEL")) == NULL) || r;
- r = ((glSyncTextureINTEL = (PFNGLSYNCTEXTUREINTELPROC)glewGetProcAddress((const GLubyte*)"glSyncTextureINTEL")) == NULL) || r;
- r = ((glUnmapTexture2DINTEL = (PFNGLUNMAPTEXTURE2DINTELPROC)glewGetProcAddress((const GLubyte*)"glUnmapTexture2DINTEL")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_INTEL_map_texture */
-
-#ifdef GL_INTEL_parallel_arrays
-
-static GLboolean _glewInit_GL_INTEL_parallel_arrays (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glColorPointervINTEL = (PFNGLCOLORPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glColorPointervINTEL")) == NULL) || r;
- r = ((glNormalPointervINTEL = (PFNGLNORMALPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glNormalPointervINTEL")) == NULL) || r;
- r = ((glTexCoordPointervINTEL = (PFNGLTEXCOORDPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glTexCoordPointervINTEL")) == NULL) || r;
- r = ((glVertexPointervINTEL = (PFNGLVERTEXPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glVertexPointervINTEL")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_INTEL_parallel_arrays */
-
-#ifdef GL_INTEL_performance_query
-
-static GLboolean _glewInit_GL_INTEL_performance_query (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginPerfQueryINTEL = (PFNGLBEGINPERFQUERYINTELPROC)glewGetProcAddress((const GLubyte*)"glBeginPerfQueryINTEL")) == NULL) || r;
- r = ((glCreatePerfQueryINTEL = (PFNGLCREATEPERFQUERYINTELPROC)glewGetProcAddress((const GLubyte*)"glCreatePerfQueryINTEL")) == NULL) || r;
- r = ((glDeletePerfQueryINTEL = (PFNGLDELETEPERFQUERYINTELPROC)glewGetProcAddress((const GLubyte*)"glDeletePerfQueryINTEL")) == NULL) || r;
- r = ((glEndPerfQueryINTEL = (PFNGLENDPERFQUERYINTELPROC)glewGetProcAddress((const GLubyte*)"glEndPerfQueryINTEL")) == NULL) || r;
- r = ((glGetFirstPerfQueryIdINTEL = (PFNGLGETFIRSTPERFQUERYIDINTELPROC)glewGetProcAddress((const GLubyte*)"glGetFirstPerfQueryIdINTEL")) == NULL) || r;
- r = ((glGetNextPerfQueryIdINTEL = (PFNGLGETNEXTPERFQUERYIDINTELPROC)glewGetProcAddress((const GLubyte*)"glGetNextPerfQueryIdINTEL")) == NULL) || r;
- r = ((glGetPerfCounterInfoINTEL = (PFNGLGETPERFCOUNTERINFOINTELPROC)glewGetProcAddress((const GLubyte*)"glGetPerfCounterInfoINTEL")) == NULL) || r;
- r = ((glGetPerfQueryDataINTEL = (PFNGLGETPERFQUERYDATAINTELPROC)glewGetProcAddress((const GLubyte*)"glGetPerfQueryDataINTEL")) == NULL) || r;
- r = ((glGetPerfQueryIdByNameINTEL = (PFNGLGETPERFQUERYIDBYNAMEINTELPROC)glewGetProcAddress((const GLubyte*)"glGetPerfQueryIdByNameINTEL")) == NULL) || r;
- r = ((glGetPerfQueryInfoINTEL = (PFNGLGETPERFQUERYINFOINTELPROC)glewGetProcAddress((const GLubyte*)"glGetPerfQueryInfoINTEL")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_INTEL_performance_query */
-
-#ifdef GL_INTEL_texture_scissor
-
-static GLboolean _glewInit_GL_INTEL_texture_scissor (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTexScissorFuncINTEL = (PFNGLTEXSCISSORFUNCINTELPROC)glewGetProcAddress((const GLubyte*)"glTexScissorFuncINTEL")) == NULL) || r;
- r = ((glTexScissorINTEL = (PFNGLTEXSCISSORINTELPROC)glewGetProcAddress((const GLubyte*)"glTexScissorINTEL")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_INTEL_texture_scissor */
-
-#ifdef GL_KHR_blend_equation_advanced
-
-static GLboolean _glewInit_GL_KHR_blend_equation_advanced (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlendBarrierKHR = (PFNGLBLENDBARRIERKHRPROC)glewGetProcAddress((const GLubyte*)"glBlendBarrierKHR")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_KHR_blend_equation_advanced */
-
-#ifdef GL_KHR_blend_equation_advanced_coherent
-
-#endif /* GL_KHR_blend_equation_advanced_coherent */
-
-#ifdef GL_KHR_context_flush_control
-
-#endif /* GL_KHR_context_flush_control */
-
-#ifdef GL_KHR_debug
-
-static GLboolean _glewInit_GL_KHR_debug (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageCallback")) == NULL) || r;
- r = ((glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageControl")) == NULL) || r;
- r = ((glDebugMessageInsert = (PFNGLDEBUGMESSAGEINSERTPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageInsert")) == NULL) || r;
- r = ((glGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGPROC)glewGetProcAddress((const GLubyte*)"glGetDebugMessageLog")) == NULL) || r;
- r = ((glGetObjectLabel = (PFNGLGETOBJECTLABELPROC)glewGetProcAddress((const GLubyte*)"glGetObjectLabel")) == NULL) || r;
- r = ((glGetObjectPtrLabel = (PFNGLGETOBJECTPTRLABELPROC)glewGetProcAddress((const GLubyte*)"glGetObjectPtrLabel")) == NULL) || r;
- r = ((glObjectLabel = (PFNGLOBJECTLABELPROC)glewGetProcAddress((const GLubyte*)"glObjectLabel")) == NULL) || r;
- r = ((glObjectPtrLabel = (PFNGLOBJECTPTRLABELPROC)glewGetProcAddress((const GLubyte*)"glObjectPtrLabel")) == NULL) || r;
- r = ((glPopDebugGroup = (PFNGLPOPDEBUGGROUPPROC)glewGetProcAddress((const GLubyte*)"glPopDebugGroup")) == NULL) || r;
- r = ((glPushDebugGroup = (PFNGLPUSHDEBUGGROUPPROC)glewGetProcAddress((const GLubyte*)"glPushDebugGroup")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_KHR_debug */
-
-#ifdef GL_KHR_robust_buffer_access_behavior
-
-#endif /* GL_KHR_robust_buffer_access_behavior */
-
-#ifdef GL_KHR_robustness
-
-static GLboolean _glewInit_GL_KHR_robustness (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetnUniformfv = (PFNGLGETNUNIFORMFVPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformfv")) == NULL) || r;
- r = ((glGetnUniformiv = (PFNGLGETNUNIFORMIVPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformiv")) == NULL) || r;
- r = ((glGetnUniformuiv = (PFNGLGETNUNIFORMUIVPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformuiv")) == NULL) || r;
- r = ((glReadnPixels = (PFNGLREADNPIXELSPROC)glewGetProcAddress((const GLubyte*)"glReadnPixels")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_KHR_robustness */
-
-#ifdef GL_KHR_texture_compression_astc_hdr
-
-#endif /* GL_KHR_texture_compression_astc_hdr */
-
-#ifdef GL_KHR_texture_compression_astc_ldr
-
-#endif /* GL_KHR_texture_compression_astc_ldr */
-
-#ifdef GL_KTX_buffer_region
-
-static GLboolean _glewInit_GL_KTX_buffer_region (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBufferRegionEnabled = (PFNGLBUFFERREGIONENABLEDPROC)glewGetProcAddress((const GLubyte*)"glBufferRegionEnabled")) == NULL) || r;
- r = ((glDeleteBufferRegion = (PFNGLDELETEBUFFERREGIONPROC)glewGetProcAddress((const GLubyte*)"glDeleteBufferRegion")) == NULL) || r;
- r = ((glDrawBufferRegion = (PFNGLDRAWBUFFERREGIONPROC)glewGetProcAddress((const GLubyte*)"glDrawBufferRegion")) == NULL) || r;
- r = ((glNewBufferRegion = (PFNGLNEWBUFFERREGIONPROC)glewGetProcAddress((const GLubyte*)"glNewBufferRegion")) == NULL) || r;
- r = ((glReadBufferRegion = (PFNGLREADBUFFERREGIONPROC)glewGetProcAddress((const GLubyte*)"glReadBufferRegion")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_KTX_buffer_region */
-
-#ifdef GL_MESAX_texture_stack
-
-#endif /* GL_MESAX_texture_stack */
-
-#ifdef GL_MESA_pack_invert
-
-#endif /* GL_MESA_pack_invert */
-
-#ifdef GL_MESA_resize_buffers
-
-static GLboolean _glewInit_GL_MESA_resize_buffers (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glResizeBuffersMESA = (PFNGLRESIZEBUFFERSMESAPROC)glewGetProcAddress((const GLubyte*)"glResizeBuffersMESA")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_MESA_resize_buffers */
-
-#ifdef GL_MESA_window_pos
-
-static GLboolean _glewInit_GL_MESA_window_pos (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glWindowPos2dMESA = (PFNGLWINDOWPOS2DMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dMESA")) == NULL) || r;
- r = ((glWindowPos2dvMESA = (PFNGLWINDOWPOS2DVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dvMESA")) == NULL) || r;
- r = ((glWindowPos2fMESA = (PFNGLWINDOWPOS2FMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fMESA")) == NULL) || r;
- r = ((glWindowPos2fvMESA = (PFNGLWINDOWPOS2FVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fvMESA")) == NULL) || r;
- r = ((glWindowPos2iMESA = (PFNGLWINDOWPOS2IMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2iMESA")) == NULL) || r;
- r = ((glWindowPos2ivMESA = (PFNGLWINDOWPOS2IVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2ivMESA")) == NULL) || r;
- r = ((glWindowPos2sMESA = (PFNGLWINDOWPOS2SMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2sMESA")) == NULL) || r;
- r = ((glWindowPos2svMESA = (PFNGLWINDOWPOS2SVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2svMESA")) == NULL) || r;
- r = ((glWindowPos3dMESA = (PFNGLWINDOWPOS3DMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dMESA")) == NULL) || r;
- r = ((glWindowPos3dvMESA = (PFNGLWINDOWPOS3DVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dvMESA")) == NULL) || r;
- r = ((glWindowPos3fMESA = (PFNGLWINDOWPOS3FMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fMESA")) == NULL) || r;
- r = ((glWindowPos3fvMESA = (PFNGLWINDOWPOS3FVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fvMESA")) == NULL) || r;
- r = ((glWindowPos3iMESA = (PFNGLWINDOWPOS3IMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3iMESA")) == NULL) || r;
- r = ((glWindowPos3ivMESA = (PFNGLWINDOWPOS3IVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3ivMESA")) == NULL) || r;
- r = ((glWindowPos3sMESA = (PFNGLWINDOWPOS3SMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3sMESA")) == NULL) || r;
- r = ((glWindowPos3svMESA = (PFNGLWINDOWPOS3SVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3svMESA")) == NULL) || r;
- r = ((glWindowPos4dMESA = (PFNGLWINDOWPOS4DMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4dMESA")) == NULL) || r;
- r = ((glWindowPos4dvMESA = (PFNGLWINDOWPOS4DVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4dvMESA")) == NULL) || r;
- r = ((glWindowPos4fMESA = (PFNGLWINDOWPOS4FMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4fMESA")) == NULL) || r;
- r = ((glWindowPos4fvMESA = (PFNGLWINDOWPOS4FVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4fvMESA")) == NULL) || r;
- r = ((glWindowPos4iMESA = (PFNGLWINDOWPOS4IMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4iMESA")) == NULL) || r;
- r = ((glWindowPos4ivMESA = (PFNGLWINDOWPOS4IVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4ivMESA")) == NULL) || r;
- r = ((glWindowPos4sMESA = (PFNGLWINDOWPOS4SMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4sMESA")) == NULL) || r;
- r = ((glWindowPos4svMESA = (PFNGLWINDOWPOS4SVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4svMESA")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_MESA_window_pos */
-
-#ifdef GL_MESA_ycbcr_texture
-
-#endif /* GL_MESA_ycbcr_texture */
-
-#ifdef GL_NVX_conditional_render
-
-static GLboolean _glewInit_GL_NVX_conditional_render (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginConditionalRenderNVX = (PFNGLBEGINCONDITIONALRENDERNVXPROC)glewGetProcAddress((const GLubyte*)"glBeginConditionalRenderNVX")) == NULL) || r;
- r = ((glEndConditionalRenderNVX = (PFNGLENDCONDITIONALRENDERNVXPROC)glewGetProcAddress((const GLubyte*)"glEndConditionalRenderNVX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NVX_conditional_render */
-
-#ifdef GL_NVX_gpu_memory_info
-
-#endif /* GL_NVX_gpu_memory_info */
-
-#ifdef GL_NV_bindless_multi_draw_indirect
-
-static GLboolean _glewInit_GL_NV_bindless_multi_draw_indirect (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glMultiDrawArraysIndirectBindlessNV = (PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirectBindlessNV")) == NULL) || r;
- r = ((glMultiDrawElementsIndirectBindlessNV = (PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirectBindlessNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_bindless_multi_draw_indirect */
-
-#ifdef GL_NV_bindless_multi_draw_indirect_count
-
-static GLboolean _glewInit_GL_NV_bindless_multi_draw_indirect_count (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glMultiDrawArraysIndirectBindlessCountNV = (PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirectBindlessCountNV")) == NULL) || r;
- r = ((glMultiDrawElementsIndirectBindlessCountNV = (PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirectBindlessCountNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_bindless_multi_draw_indirect_count */
-
-#ifdef GL_NV_bindless_texture
-
-static GLboolean _glewInit_GL_NV_bindless_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetImageHandleNV = (PFNGLGETIMAGEHANDLENVPROC)glewGetProcAddress((const GLubyte*)"glGetImageHandleNV")) == NULL) || r;
- r = ((glGetTextureHandleNV = (PFNGLGETTEXTUREHANDLENVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureHandleNV")) == NULL) || r;
- r = ((glGetTextureSamplerHandleNV = (PFNGLGETTEXTURESAMPLERHANDLENVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureSamplerHandleNV")) == NULL) || r;
- r = ((glIsImageHandleResidentNV = (PFNGLISIMAGEHANDLERESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glIsImageHandleResidentNV")) == NULL) || r;
- r = ((glIsTextureHandleResidentNV = (PFNGLISTEXTUREHANDLERESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glIsTextureHandleResidentNV")) == NULL) || r;
- r = ((glMakeImageHandleNonResidentNV = (PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeImageHandleNonResidentNV")) == NULL) || r;
- r = ((glMakeImageHandleResidentNV = (PFNGLMAKEIMAGEHANDLERESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeImageHandleResidentNV")) == NULL) || r;
- r = ((glMakeTextureHandleNonResidentNV = (PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeTextureHandleNonResidentNV")) == NULL) || r;
- r = ((glMakeTextureHandleResidentNV = (PFNGLMAKETEXTUREHANDLERESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeTextureHandleResidentNV")) == NULL) || r;
- r = ((glProgramUniformHandleui64NV = (PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformHandleui64NV")) == NULL) || r;
- r = ((glProgramUniformHandleui64vNV = (PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformHandleui64vNV")) == NULL) || r;
- r = ((glUniformHandleui64NV = (PFNGLUNIFORMHANDLEUI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniformHandleui64NV")) == NULL) || r;
- r = ((glUniformHandleui64vNV = (PFNGLUNIFORMHANDLEUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniformHandleui64vNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_bindless_texture */
-
-#ifdef GL_NV_blend_equation_advanced
-
-static GLboolean _glewInit_GL_NV_blend_equation_advanced (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBlendBarrierNV = (PFNGLBLENDBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"glBlendBarrierNV")) == NULL) || r;
- r = ((glBlendParameteriNV = (PFNGLBLENDPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glBlendParameteriNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_blend_equation_advanced */
-
-#ifdef GL_NV_blend_equation_advanced_coherent
-
-#endif /* GL_NV_blend_equation_advanced_coherent */
-
-#ifdef GL_NV_blend_square
-
-#endif /* GL_NV_blend_square */
-
-#ifdef GL_NV_compute_program5
-
-#endif /* GL_NV_compute_program5 */
-
-#ifdef GL_NV_conditional_render
-
-static GLboolean _glewInit_GL_NV_conditional_render (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginConditionalRenderNV = (PFNGLBEGINCONDITIONALRENDERNVPROC)glewGetProcAddress((const GLubyte*)"glBeginConditionalRenderNV")) == NULL) || r;
- r = ((glEndConditionalRenderNV = (PFNGLENDCONDITIONALRENDERNVPROC)glewGetProcAddress((const GLubyte*)"glEndConditionalRenderNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_conditional_render */
-
-#ifdef GL_NV_conservative_raster
-
-static GLboolean _glewInit_GL_NV_conservative_raster (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glSubpixelPrecisionBiasNV = (PFNGLSUBPIXELPRECISIONBIASNVPROC)glewGetProcAddress((const GLubyte*)"glSubpixelPrecisionBiasNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_conservative_raster */
-
-#ifdef GL_NV_copy_depth_to_color
-
-#endif /* GL_NV_copy_depth_to_color */
-
-#ifdef GL_NV_copy_image
-
-static GLboolean _glewInit_GL_NV_copy_image (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCopyImageSubDataNV = (PFNGLCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glCopyImageSubDataNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_copy_image */
-
-#ifdef GL_NV_deep_texture3D
-
-#endif /* GL_NV_deep_texture3D */
-
-#ifdef GL_NV_depth_buffer_float
-
-static GLboolean _glewInit_GL_NV_depth_buffer_float (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glClearDepthdNV = (PFNGLCLEARDEPTHDNVPROC)glewGetProcAddress((const GLubyte*)"glClearDepthdNV")) == NULL) || r;
- r = ((glDepthBoundsdNV = (PFNGLDEPTHBOUNDSDNVPROC)glewGetProcAddress((const GLubyte*)"glDepthBoundsdNV")) == NULL) || r;
- r = ((glDepthRangedNV = (PFNGLDEPTHRANGEDNVPROC)glewGetProcAddress((const GLubyte*)"glDepthRangedNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_depth_buffer_float */
-
-#ifdef GL_NV_depth_clamp
-
-#endif /* GL_NV_depth_clamp */
-
-#ifdef GL_NV_depth_range_unclamped
-
-#endif /* GL_NV_depth_range_unclamped */
-
-#ifdef GL_NV_draw_texture
-
-static GLboolean _glewInit_GL_NV_draw_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDrawTextureNV = (PFNGLDRAWTEXTURENVPROC)glewGetProcAddress((const GLubyte*)"glDrawTextureNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_draw_texture */
-
-#ifdef GL_NV_evaluators
-
-static GLboolean _glewInit_GL_NV_evaluators (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glEvalMapsNV = (PFNGLEVALMAPSNVPROC)glewGetProcAddress((const GLubyte*)"glEvalMapsNV")) == NULL) || r;
- r = ((glGetMapAttribParameterfvNV = (PFNGLGETMAPATTRIBPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapAttribParameterfvNV")) == NULL) || r;
- r = ((glGetMapAttribParameterivNV = (PFNGLGETMAPATTRIBPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapAttribParameterivNV")) == NULL) || r;
- r = ((glGetMapControlPointsNV = (PFNGLGETMAPCONTROLPOINTSNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapControlPointsNV")) == NULL) || r;
- r = ((glGetMapParameterfvNV = (PFNGLGETMAPPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapParameterfvNV")) == NULL) || r;
- r = ((glGetMapParameterivNV = (PFNGLGETMAPPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapParameterivNV")) == NULL) || r;
- r = ((glMapControlPointsNV = (PFNGLMAPCONTROLPOINTSNVPROC)glewGetProcAddress((const GLubyte*)"glMapControlPointsNV")) == NULL) || r;
- r = ((glMapParameterfvNV = (PFNGLMAPPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glMapParameterfvNV")) == NULL) || r;
- r = ((glMapParameterivNV = (PFNGLMAPPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glMapParameterivNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_evaluators */
-
-#ifdef GL_NV_explicit_multisample
-
-static GLboolean _glewInit_GL_NV_explicit_multisample (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetMultisamplefvNV = (PFNGLGETMULTISAMPLEFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMultisamplefvNV")) == NULL) || r;
- r = ((glSampleMaskIndexedNV = (PFNGLSAMPLEMASKINDEXEDNVPROC)glewGetProcAddress((const GLubyte*)"glSampleMaskIndexedNV")) == NULL) || r;
- r = ((glTexRenderbufferNV = (PFNGLTEXRENDERBUFFERNVPROC)glewGetProcAddress((const GLubyte*)"glTexRenderbufferNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_explicit_multisample */
-
-#ifdef GL_NV_fence
-
-static GLboolean _glewInit_GL_NV_fence (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDeleteFencesNV = (PFNGLDELETEFENCESNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteFencesNV")) == NULL) || r;
- r = ((glFinishFenceNV = (PFNGLFINISHFENCENVPROC)glewGetProcAddress((const GLubyte*)"glFinishFenceNV")) == NULL) || r;
- r = ((glGenFencesNV = (PFNGLGENFENCESNVPROC)glewGetProcAddress((const GLubyte*)"glGenFencesNV")) == NULL) || r;
- r = ((glGetFenceivNV = (PFNGLGETFENCEIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetFenceivNV")) == NULL) || r;
- r = ((glIsFenceNV = (PFNGLISFENCENVPROC)glewGetProcAddress((const GLubyte*)"glIsFenceNV")) == NULL) || r;
- r = ((glSetFenceNV = (PFNGLSETFENCENVPROC)glewGetProcAddress((const GLubyte*)"glSetFenceNV")) == NULL) || r;
- r = ((glTestFenceNV = (PFNGLTESTFENCENVPROC)glewGetProcAddress((const GLubyte*)"glTestFenceNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_fence */
-
-#ifdef GL_NV_fill_rectangle
-
-#endif /* GL_NV_fill_rectangle */
-
-#ifdef GL_NV_float_buffer
-
-#endif /* GL_NV_float_buffer */
-
-#ifdef GL_NV_fog_distance
-
-#endif /* GL_NV_fog_distance */
-
-#ifdef GL_NV_fragment_coverage_to_color
-
-static GLboolean _glewInit_GL_NV_fragment_coverage_to_color (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFragmentCoverageColorNV = (PFNGLFRAGMENTCOVERAGECOLORNVPROC)glewGetProcAddress((const GLubyte*)"glFragmentCoverageColorNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_fragment_coverage_to_color */
-
-#ifdef GL_NV_fragment_program
-
-static GLboolean _glewInit_GL_NV_fragment_program (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetProgramNamedParameterdvNV = (PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramNamedParameterdvNV")) == NULL) || r;
- r = ((glGetProgramNamedParameterfvNV = (PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramNamedParameterfvNV")) == NULL) || r;
- r = ((glProgramNamedParameter4dNV = (PFNGLPROGRAMNAMEDPARAMETER4DNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4dNV")) == NULL) || r;
- r = ((glProgramNamedParameter4dvNV = (PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4dvNV")) == NULL) || r;
- r = ((glProgramNamedParameter4fNV = (PFNGLPROGRAMNAMEDPARAMETER4FNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4fNV")) == NULL) || r;
- r = ((glProgramNamedParameter4fvNV = (PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4fvNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_fragment_program */
-
-#ifdef GL_NV_fragment_program2
-
-#endif /* GL_NV_fragment_program2 */
-
-#ifdef GL_NV_fragment_program4
-
-#endif /* GL_NV_fragment_program4 */
-
-#ifdef GL_NV_fragment_program_option
-
-#endif /* GL_NV_fragment_program_option */
-
-#ifdef GL_NV_fragment_shader_interlock
-
-#endif /* GL_NV_fragment_shader_interlock */
-
-#ifdef GL_NV_framebuffer_mixed_samples
-
-#endif /* GL_NV_framebuffer_mixed_samples */
-
-#ifdef GL_NV_framebuffer_multisample_coverage
-
-static GLboolean _glewInit_GL_NV_framebuffer_multisample_coverage (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glRenderbufferStorageMultisampleCoverageNV = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisampleCoverageNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_framebuffer_multisample_coverage */
-
-#ifdef GL_NV_geometry_program4
-
-static GLboolean _glewInit_GL_NV_geometry_program4 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glProgramVertexLimitNV = (PFNGLPROGRAMVERTEXLIMITNVPROC)glewGetProcAddress((const GLubyte*)"glProgramVertexLimitNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_geometry_program4 */
-
-#ifdef GL_NV_geometry_shader4
-
-#endif /* GL_NV_geometry_shader4 */
-
-#ifdef GL_NV_geometry_shader_passthrough
-
-#endif /* GL_NV_geometry_shader_passthrough */
-
-#ifdef GL_NV_gpu_program4
-
-static GLboolean _glewInit_GL_NV_gpu_program4 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glProgramEnvParameterI4iNV = (PFNGLPROGRAMENVPARAMETERI4INVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameterI4iNV")) == NULL) || r;
- r = ((glProgramEnvParameterI4ivNV = (PFNGLPROGRAMENVPARAMETERI4IVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameterI4ivNV")) == NULL) || r;
- r = ((glProgramEnvParameterI4uiNV = (PFNGLPROGRAMENVPARAMETERI4UINVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameterI4uiNV")) == NULL) || r;
- r = ((glProgramEnvParameterI4uivNV = (PFNGLPROGRAMENVPARAMETERI4UIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameterI4uivNV")) == NULL) || r;
- r = ((glProgramEnvParametersI4ivNV = (PFNGLPROGRAMENVPARAMETERSI4IVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParametersI4ivNV")) == NULL) || r;
- r = ((glProgramEnvParametersI4uivNV = (PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParametersI4uivNV")) == NULL) || r;
- r = ((glProgramLocalParameterI4iNV = (PFNGLPROGRAMLOCALPARAMETERI4INVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameterI4iNV")) == NULL) || r;
- r = ((glProgramLocalParameterI4ivNV = (PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameterI4ivNV")) == NULL) || r;
- r = ((glProgramLocalParameterI4uiNV = (PFNGLPROGRAMLOCALPARAMETERI4UINVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameterI4uiNV")) == NULL) || r;
- r = ((glProgramLocalParameterI4uivNV = (PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameterI4uivNV")) == NULL) || r;
- r = ((glProgramLocalParametersI4ivNV = (PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParametersI4ivNV")) == NULL) || r;
- r = ((glProgramLocalParametersI4uivNV = (PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParametersI4uivNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_gpu_program4 */
-
-#ifdef GL_NV_gpu_program5
-
-#endif /* GL_NV_gpu_program5 */
-
-#ifdef GL_NV_gpu_program5_mem_extended
-
-#endif /* GL_NV_gpu_program5_mem_extended */
-
-#ifdef GL_NV_gpu_program_fp64
-
-#endif /* GL_NV_gpu_program_fp64 */
-
-#ifdef GL_NV_gpu_shader5
-
-static GLboolean _glewInit_GL_NV_gpu_shader5 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetUniformi64vNV = (PFNGLGETUNIFORMI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformi64vNV")) == NULL) || r;
- r = ((glGetUniformui64vNV = (PFNGLGETUNIFORMUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformui64vNV")) == NULL) || r;
- r = ((glProgramUniform1i64NV = (PFNGLPROGRAMUNIFORM1I64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i64NV")) == NULL) || r;
- r = ((glProgramUniform1i64vNV = (PFNGLPROGRAMUNIFORM1I64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i64vNV")) == NULL) || r;
- r = ((glProgramUniform1ui64NV = (PFNGLPROGRAMUNIFORM1UI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui64NV")) == NULL) || r;
- r = ((glProgramUniform1ui64vNV = (PFNGLPROGRAMUNIFORM1UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui64vNV")) == NULL) || r;
- r = ((glProgramUniform2i64NV = (PFNGLPROGRAMUNIFORM2I64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i64NV")) == NULL) || r;
- r = ((glProgramUniform2i64vNV = (PFNGLPROGRAMUNIFORM2I64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i64vNV")) == NULL) || r;
- r = ((glProgramUniform2ui64NV = (PFNGLPROGRAMUNIFORM2UI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui64NV")) == NULL) || r;
- r = ((glProgramUniform2ui64vNV = (PFNGLPROGRAMUNIFORM2UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui64vNV")) == NULL) || r;
- r = ((glProgramUniform3i64NV = (PFNGLPROGRAMUNIFORM3I64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i64NV")) == NULL) || r;
- r = ((glProgramUniform3i64vNV = (PFNGLPROGRAMUNIFORM3I64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i64vNV")) == NULL) || r;
- r = ((glProgramUniform3ui64NV = (PFNGLPROGRAMUNIFORM3UI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui64NV")) == NULL) || r;
- r = ((glProgramUniform3ui64vNV = (PFNGLPROGRAMUNIFORM3UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui64vNV")) == NULL) || r;
- r = ((glProgramUniform4i64NV = (PFNGLPROGRAMUNIFORM4I64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i64NV")) == NULL) || r;
- r = ((glProgramUniform4i64vNV = (PFNGLPROGRAMUNIFORM4I64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i64vNV")) == NULL) || r;
- r = ((glProgramUniform4ui64NV = (PFNGLPROGRAMUNIFORM4UI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui64NV")) == NULL) || r;
- r = ((glProgramUniform4ui64vNV = (PFNGLPROGRAMUNIFORM4UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui64vNV")) == NULL) || r;
- r = ((glUniform1i64NV = (PFNGLUNIFORM1I64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform1i64NV")) == NULL) || r;
- r = ((glUniform1i64vNV = (PFNGLUNIFORM1I64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform1i64vNV")) == NULL) || r;
- r = ((glUniform1ui64NV = (PFNGLUNIFORM1UI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui64NV")) == NULL) || r;
- r = ((glUniform1ui64vNV = (PFNGLUNIFORM1UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui64vNV")) == NULL) || r;
- r = ((glUniform2i64NV = (PFNGLUNIFORM2I64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform2i64NV")) == NULL) || r;
- r = ((glUniform2i64vNV = (PFNGLUNIFORM2I64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform2i64vNV")) == NULL) || r;
- r = ((glUniform2ui64NV = (PFNGLUNIFORM2UI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui64NV")) == NULL) || r;
- r = ((glUniform2ui64vNV = (PFNGLUNIFORM2UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui64vNV")) == NULL) || r;
- r = ((glUniform3i64NV = (PFNGLUNIFORM3I64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform3i64NV")) == NULL) || r;
- r = ((glUniform3i64vNV = (PFNGLUNIFORM3I64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform3i64vNV")) == NULL) || r;
- r = ((glUniform3ui64NV = (PFNGLUNIFORM3UI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui64NV")) == NULL) || r;
- r = ((glUniform3ui64vNV = (PFNGLUNIFORM3UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui64vNV")) == NULL) || r;
- r = ((glUniform4i64NV = (PFNGLUNIFORM4I64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform4i64NV")) == NULL) || r;
- r = ((glUniform4i64vNV = (PFNGLUNIFORM4I64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform4i64vNV")) == NULL) || r;
- r = ((glUniform4ui64NV = (PFNGLUNIFORM4UI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui64NV")) == NULL) || r;
- r = ((glUniform4ui64vNV = (PFNGLUNIFORM4UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui64vNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_gpu_shader5 */
-
-#ifdef GL_NV_half_float
-
-static GLboolean _glewInit_GL_NV_half_float (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glColor3hNV = (PFNGLCOLOR3HNVPROC)glewGetProcAddress((const GLubyte*)"glColor3hNV")) == NULL) || r;
- r = ((glColor3hvNV = (PFNGLCOLOR3HVNVPROC)glewGetProcAddress((const GLubyte*)"glColor3hvNV")) == NULL) || r;
- r = ((glColor4hNV = (PFNGLCOLOR4HNVPROC)glewGetProcAddress((const GLubyte*)"glColor4hNV")) == NULL) || r;
- r = ((glColor4hvNV = (PFNGLCOLOR4HVNVPROC)glewGetProcAddress((const GLubyte*)"glColor4hvNV")) == NULL) || r;
- r = ((glFogCoordhNV = (PFNGLFOGCOORDHNVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordhNV")) == NULL) || r;
- r = ((glFogCoordhvNV = (PFNGLFOGCOORDHVNVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordhvNV")) == NULL) || r;
- r = ((glMultiTexCoord1hNV = (PFNGLMULTITEXCOORD1HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1hNV")) == NULL) || r;
- r = ((glMultiTexCoord1hvNV = (PFNGLMULTITEXCOORD1HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1hvNV")) == NULL) || r;
- r = ((glMultiTexCoord2hNV = (PFNGLMULTITEXCOORD2HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2hNV")) == NULL) || r;
- r = ((glMultiTexCoord2hvNV = (PFNGLMULTITEXCOORD2HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2hvNV")) == NULL) || r;
- r = ((glMultiTexCoord3hNV = (PFNGLMULTITEXCOORD3HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3hNV")) == NULL) || r;
- r = ((glMultiTexCoord3hvNV = (PFNGLMULTITEXCOORD3HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3hvNV")) == NULL) || r;
- r = ((glMultiTexCoord4hNV = (PFNGLMULTITEXCOORD4HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4hNV")) == NULL) || r;
- r = ((glMultiTexCoord4hvNV = (PFNGLMULTITEXCOORD4HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4hvNV")) == NULL) || r;
- r = ((glNormal3hNV = (PFNGLNORMAL3HNVPROC)glewGetProcAddress((const GLubyte*)"glNormal3hNV")) == NULL) || r;
- r = ((glNormal3hvNV = (PFNGLNORMAL3HVNVPROC)glewGetProcAddress((const GLubyte*)"glNormal3hvNV")) == NULL) || r;
- r = ((glSecondaryColor3hNV = (PFNGLSECONDARYCOLOR3HNVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3hNV")) == NULL) || r;
- r = ((glSecondaryColor3hvNV = (PFNGLSECONDARYCOLOR3HVNVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3hvNV")) == NULL) || r;
- r = ((glTexCoord1hNV = (PFNGLTEXCOORD1HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord1hNV")) == NULL) || r;
- r = ((glTexCoord1hvNV = (PFNGLTEXCOORD1HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord1hvNV")) == NULL) || r;
- r = ((glTexCoord2hNV = (PFNGLTEXCOORD2HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2hNV")) == NULL) || r;
- r = ((glTexCoord2hvNV = (PFNGLTEXCOORD2HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2hvNV")) == NULL) || r;
- r = ((glTexCoord3hNV = (PFNGLTEXCOORD3HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord3hNV")) == NULL) || r;
- r = ((glTexCoord3hvNV = (PFNGLTEXCOORD3HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord3hvNV")) == NULL) || r;
- r = ((glTexCoord4hNV = (PFNGLTEXCOORD4HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4hNV")) == NULL) || r;
- r = ((glTexCoord4hvNV = (PFNGLTEXCOORD4HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4hvNV")) == NULL) || r;
- r = ((glVertex2hNV = (PFNGLVERTEX2HNVPROC)glewGetProcAddress((const GLubyte*)"glVertex2hNV")) == NULL) || r;
- r = ((glVertex2hvNV = (PFNGLVERTEX2HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertex2hvNV")) == NULL) || r;
- r = ((glVertex3hNV = (PFNGLVERTEX3HNVPROC)glewGetProcAddress((const GLubyte*)"glVertex3hNV")) == NULL) || r;
- r = ((glVertex3hvNV = (PFNGLVERTEX3HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertex3hvNV")) == NULL) || r;
- r = ((glVertex4hNV = (PFNGLVERTEX4HNVPROC)glewGetProcAddress((const GLubyte*)"glVertex4hNV")) == NULL) || r;
- r = ((glVertex4hvNV = (PFNGLVERTEX4HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertex4hvNV")) == NULL) || r;
- r = ((glVertexAttrib1hNV = (PFNGLVERTEXATTRIB1HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1hNV")) == NULL) || r;
- r = ((glVertexAttrib1hvNV = (PFNGLVERTEXATTRIB1HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1hvNV")) == NULL) || r;
- r = ((glVertexAttrib2hNV = (PFNGLVERTEXATTRIB2HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2hNV")) == NULL) || r;
- r = ((glVertexAttrib2hvNV = (PFNGLVERTEXATTRIB2HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2hvNV")) == NULL) || r;
- r = ((glVertexAttrib3hNV = (PFNGLVERTEXATTRIB3HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3hNV")) == NULL) || r;
- r = ((glVertexAttrib3hvNV = (PFNGLVERTEXATTRIB3HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3hvNV")) == NULL) || r;
- r = ((glVertexAttrib4hNV = (PFNGLVERTEXATTRIB4HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4hNV")) == NULL) || r;
- r = ((glVertexAttrib4hvNV = (PFNGLVERTEXATTRIB4HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4hvNV")) == NULL) || r;
- r = ((glVertexAttribs1hvNV = (PFNGLVERTEXATTRIBS1HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1hvNV")) == NULL) || r;
- r = ((glVertexAttribs2hvNV = (PFNGLVERTEXATTRIBS2HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2hvNV")) == NULL) || r;
- r = ((glVertexAttribs3hvNV = (PFNGLVERTEXATTRIBS3HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3hvNV")) == NULL) || r;
- r = ((glVertexAttribs4hvNV = (PFNGLVERTEXATTRIBS4HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4hvNV")) == NULL) || r;
- r = ((glVertexWeighthNV = (PFNGLVERTEXWEIGHTHNVPROC)glewGetProcAddress((const GLubyte*)"glVertexWeighthNV")) == NULL) || r;
- r = ((glVertexWeighthvNV = (PFNGLVERTEXWEIGHTHVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexWeighthvNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_half_float */
-
-#ifdef GL_NV_internalformat_sample_query
-
-static GLboolean _glewInit_GL_NV_internalformat_sample_query (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetInternalformatSampleivNV = (PFNGLGETINTERNALFORMATSAMPLEIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetInternalformatSampleivNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_internalformat_sample_query */
-
-#ifdef GL_NV_light_max_exponent
-
-#endif /* GL_NV_light_max_exponent */
-
-#ifdef GL_NV_multisample_coverage
-
-#endif /* GL_NV_multisample_coverage */
-
-#ifdef GL_NV_multisample_filter_hint
-
-#endif /* GL_NV_multisample_filter_hint */
-
-#ifdef GL_NV_occlusion_query
-
-static GLboolean _glewInit_GL_NV_occlusion_query (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginOcclusionQueryNV = (PFNGLBEGINOCCLUSIONQUERYNVPROC)glewGetProcAddress((const GLubyte*)"glBeginOcclusionQueryNV")) == NULL) || r;
- r = ((glDeleteOcclusionQueriesNV = (PFNGLDELETEOCCLUSIONQUERIESNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteOcclusionQueriesNV")) == NULL) || r;
- r = ((glEndOcclusionQueryNV = (PFNGLENDOCCLUSIONQUERYNVPROC)glewGetProcAddress((const GLubyte*)"glEndOcclusionQueryNV")) == NULL) || r;
- r = ((glGenOcclusionQueriesNV = (PFNGLGENOCCLUSIONQUERIESNVPROC)glewGetProcAddress((const GLubyte*)"glGenOcclusionQueriesNV")) == NULL) || r;
- r = ((glGetOcclusionQueryivNV = (PFNGLGETOCCLUSIONQUERYIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetOcclusionQueryivNV")) == NULL) || r;
- r = ((glGetOcclusionQueryuivNV = (PFNGLGETOCCLUSIONQUERYUIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetOcclusionQueryuivNV")) == NULL) || r;
- r = ((glIsOcclusionQueryNV = (PFNGLISOCCLUSIONQUERYNVPROC)glewGetProcAddress((const GLubyte*)"glIsOcclusionQueryNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_occlusion_query */
-
-#ifdef GL_NV_packed_depth_stencil
-
-#endif /* GL_NV_packed_depth_stencil */
-
-#ifdef GL_NV_parameter_buffer_object
-
-static GLboolean _glewInit_GL_NV_parameter_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glProgramBufferParametersIivNV = (PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramBufferParametersIivNV")) == NULL) || r;
- r = ((glProgramBufferParametersIuivNV = (PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramBufferParametersIuivNV")) == NULL) || r;
- r = ((glProgramBufferParametersfvNV = (PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramBufferParametersfvNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_parameter_buffer_object */
-
-#ifdef GL_NV_parameter_buffer_object2
-
-#endif /* GL_NV_parameter_buffer_object2 */
-
-#ifdef GL_NV_path_rendering
-
-static GLboolean _glewInit_GL_NV_path_rendering (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCopyPathNV = (PFNGLCOPYPATHNVPROC)glewGetProcAddress((const GLubyte*)"glCopyPathNV")) == NULL) || r;
- r = ((glCoverFillPathInstancedNV = (PFNGLCOVERFILLPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glCoverFillPathInstancedNV")) == NULL) || r;
- r = ((glCoverFillPathNV = (PFNGLCOVERFILLPATHNVPROC)glewGetProcAddress((const GLubyte*)"glCoverFillPathNV")) == NULL) || r;
- r = ((glCoverStrokePathInstancedNV = (PFNGLCOVERSTROKEPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glCoverStrokePathInstancedNV")) == NULL) || r;
- r = ((glCoverStrokePathNV = (PFNGLCOVERSTROKEPATHNVPROC)glewGetProcAddress((const GLubyte*)"glCoverStrokePathNV")) == NULL) || r;
- r = ((glDeletePathsNV = (PFNGLDELETEPATHSNVPROC)glewGetProcAddress((const GLubyte*)"glDeletePathsNV")) == NULL) || r;
- r = ((glGenPathsNV = (PFNGLGENPATHSNVPROC)glewGetProcAddress((const GLubyte*)"glGenPathsNV")) == NULL) || r;
- r = ((glGetPathColorGenfvNV = (PFNGLGETPATHCOLORGENFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathColorGenfvNV")) == NULL) || r;
- r = ((glGetPathColorGenivNV = (PFNGLGETPATHCOLORGENIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathColorGenivNV")) == NULL) || r;
- r = ((glGetPathCommandsNV = (PFNGLGETPATHCOMMANDSNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathCommandsNV")) == NULL) || r;
- r = ((glGetPathCoordsNV = (PFNGLGETPATHCOORDSNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathCoordsNV")) == NULL) || r;
- r = ((glGetPathDashArrayNV = (PFNGLGETPATHDASHARRAYNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathDashArrayNV")) == NULL) || r;
- r = ((glGetPathLengthNV = (PFNGLGETPATHLENGTHNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathLengthNV")) == NULL) || r;
- r = ((glGetPathMetricRangeNV = (PFNGLGETPATHMETRICRANGENVPROC)glewGetProcAddress((const GLubyte*)"glGetPathMetricRangeNV")) == NULL) || r;
- r = ((glGetPathMetricsNV = (PFNGLGETPATHMETRICSNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathMetricsNV")) == NULL) || r;
- r = ((glGetPathParameterfvNV = (PFNGLGETPATHPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathParameterfvNV")) == NULL) || r;
- r = ((glGetPathParameterivNV = (PFNGLGETPATHPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathParameterivNV")) == NULL) || r;
- r = ((glGetPathSpacingNV = (PFNGLGETPATHSPACINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathSpacingNV")) == NULL) || r;
- r = ((glGetPathTexGenfvNV = (PFNGLGETPATHTEXGENFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathTexGenfvNV")) == NULL) || r;
- r = ((glGetPathTexGenivNV = (PFNGLGETPATHTEXGENIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathTexGenivNV")) == NULL) || r;
- r = ((glGetProgramResourcefvNV = (PFNGLGETPROGRAMRESOURCEFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourcefvNV")) == NULL) || r;
- r = ((glInterpolatePathsNV = (PFNGLINTERPOLATEPATHSNVPROC)glewGetProcAddress((const GLubyte*)"glInterpolatePathsNV")) == NULL) || r;
- r = ((glIsPathNV = (PFNGLISPATHNVPROC)glewGetProcAddress((const GLubyte*)"glIsPathNV")) == NULL) || r;
- r = ((glIsPointInFillPathNV = (PFNGLISPOINTINFILLPATHNVPROC)glewGetProcAddress((const GLubyte*)"glIsPointInFillPathNV")) == NULL) || r;
- r = ((glIsPointInStrokePathNV = (PFNGLISPOINTINSTROKEPATHNVPROC)glewGetProcAddress((const GLubyte*)"glIsPointInStrokePathNV")) == NULL) || r;
- r = ((glMatrixLoad3x2fNV = (PFNGLMATRIXLOAD3X2FNVPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoad3x2fNV")) == NULL) || r;
- r = ((glMatrixLoad3x3fNV = (PFNGLMATRIXLOAD3X3FNVPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoad3x3fNV")) == NULL) || r;
- r = ((glMatrixLoadTranspose3x3fNV = (PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadTranspose3x3fNV")) == NULL) || r;
- r = ((glMatrixMult3x2fNV = (PFNGLMATRIXMULT3X2FNVPROC)glewGetProcAddress((const GLubyte*)"glMatrixMult3x2fNV")) == NULL) || r;
- r = ((glMatrixMult3x3fNV = (PFNGLMATRIXMULT3X3FNVPROC)glewGetProcAddress((const GLubyte*)"glMatrixMult3x3fNV")) == NULL) || r;
- r = ((glMatrixMultTranspose3x3fNV = (PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultTranspose3x3fNV")) == NULL) || r;
- r = ((glPathColorGenNV = (PFNGLPATHCOLORGENNVPROC)glewGetProcAddress((const GLubyte*)"glPathColorGenNV")) == NULL) || r;
- r = ((glPathCommandsNV = (PFNGLPATHCOMMANDSNVPROC)glewGetProcAddress((const GLubyte*)"glPathCommandsNV")) == NULL) || r;
- r = ((glPathCoordsNV = (PFNGLPATHCOORDSNVPROC)glewGetProcAddress((const GLubyte*)"glPathCoordsNV")) == NULL) || r;
- r = ((glPathCoverDepthFuncNV = (PFNGLPATHCOVERDEPTHFUNCNVPROC)glewGetProcAddress((const GLubyte*)"glPathCoverDepthFuncNV")) == NULL) || r;
- r = ((glPathDashArrayNV = (PFNGLPATHDASHARRAYNVPROC)glewGetProcAddress((const GLubyte*)"glPathDashArrayNV")) == NULL) || r;
- r = ((glPathFogGenNV = (PFNGLPATHFOGGENNVPROC)glewGetProcAddress((const GLubyte*)"glPathFogGenNV")) == NULL) || r;
- r = ((glPathGlyphIndexArrayNV = (PFNGLPATHGLYPHINDEXARRAYNVPROC)glewGetProcAddress((const GLubyte*)"glPathGlyphIndexArrayNV")) == NULL) || r;
- r = ((glPathGlyphIndexRangeNV = (PFNGLPATHGLYPHINDEXRANGENVPROC)glewGetProcAddress((const GLubyte*)"glPathGlyphIndexRangeNV")) == NULL) || r;
- r = ((glPathGlyphRangeNV = (PFNGLPATHGLYPHRANGENVPROC)glewGetProcAddress((const GLubyte*)"glPathGlyphRangeNV")) == NULL) || r;
- r = ((glPathGlyphsNV = (PFNGLPATHGLYPHSNVPROC)glewGetProcAddress((const GLubyte*)"glPathGlyphsNV")) == NULL) || r;
- r = ((glPathMemoryGlyphIndexArrayNV = (PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC)glewGetProcAddress((const GLubyte*)"glPathMemoryGlyphIndexArrayNV")) == NULL) || r;
- r = ((glPathParameterfNV = (PFNGLPATHPARAMETERFNVPROC)glewGetProcAddress((const GLubyte*)"glPathParameterfNV")) == NULL) || r;
- r = ((glPathParameterfvNV = (PFNGLPATHPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glPathParameterfvNV")) == NULL) || r;
- r = ((glPathParameteriNV = (PFNGLPATHPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glPathParameteriNV")) == NULL) || r;
- r = ((glPathParameterivNV = (PFNGLPATHPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glPathParameterivNV")) == NULL) || r;
- r = ((glPathStencilDepthOffsetNV = (PFNGLPATHSTENCILDEPTHOFFSETNVPROC)glewGetProcAddress((const GLubyte*)"glPathStencilDepthOffsetNV")) == NULL) || r;
- r = ((glPathStencilFuncNV = (PFNGLPATHSTENCILFUNCNVPROC)glewGetProcAddress((const GLubyte*)"glPathStencilFuncNV")) == NULL) || r;
- r = ((glPathStringNV = (PFNGLPATHSTRINGNVPROC)glewGetProcAddress((const GLubyte*)"glPathStringNV")) == NULL) || r;
- r = ((glPathSubCommandsNV = (PFNGLPATHSUBCOMMANDSNVPROC)glewGetProcAddress((const GLubyte*)"glPathSubCommandsNV")) == NULL) || r;
- r = ((glPathSubCoordsNV = (PFNGLPATHSUBCOORDSNVPROC)glewGetProcAddress((const GLubyte*)"glPathSubCoordsNV")) == NULL) || r;
- r = ((glPathTexGenNV = (PFNGLPATHTEXGENNVPROC)glewGetProcAddress((const GLubyte*)"glPathTexGenNV")) == NULL) || r;
- r = ((glPointAlongPathNV = (PFNGLPOINTALONGPATHNVPROC)glewGetProcAddress((const GLubyte*)"glPointAlongPathNV")) == NULL) || r;
- r = ((glProgramPathFragmentInputGenNV = (PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC)glewGetProcAddress((const GLubyte*)"glProgramPathFragmentInputGenNV")) == NULL) || r;
- r = ((glStencilFillPathInstancedNV = (PFNGLSTENCILFILLPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glStencilFillPathInstancedNV")) == NULL) || r;
- r = ((glStencilFillPathNV = (PFNGLSTENCILFILLPATHNVPROC)glewGetProcAddress((const GLubyte*)"glStencilFillPathNV")) == NULL) || r;
- r = ((glStencilStrokePathInstancedNV = (PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glStencilStrokePathInstancedNV")) == NULL) || r;
- r = ((glStencilStrokePathNV = (PFNGLSTENCILSTROKEPATHNVPROC)glewGetProcAddress((const GLubyte*)"glStencilStrokePathNV")) == NULL) || r;
- r = ((glStencilThenCoverFillPathInstancedNV = (PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glStencilThenCoverFillPathInstancedNV")) == NULL) || r;
- r = ((glStencilThenCoverFillPathNV = (PFNGLSTENCILTHENCOVERFILLPATHNVPROC)glewGetProcAddress((const GLubyte*)"glStencilThenCoverFillPathNV")) == NULL) || r;
- r = ((glStencilThenCoverStrokePathInstancedNV = (PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glStencilThenCoverStrokePathInstancedNV")) == NULL) || r;
- r = ((glStencilThenCoverStrokePathNV = (PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC)glewGetProcAddress((const GLubyte*)"glStencilThenCoverStrokePathNV")) == NULL) || r;
- r = ((glTransformPathNV = (PFNGLTRANSFORMPATHNVPROC)glewGetProcAddress((const GLubyte*)"glTransformPathNV")) == NULL) || r;
- r = ((glWeightPathsNV = (PFNGLWEIGHTPATHSNVPROC)glewGetProcAddress((const GLubyte*)"glWeightPathsNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_path_rendering */
-
-#ifdef GL_NV_path_rendering_shared_edge
-
-#endif /* GL_NV_path_rendering_shared_edge */
-
-#ifdef GL_NV_pixel_data_range
-
-static GLboolean _glewInit_GL_NV_pixel_data_range (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFlushPixelDataRangeNV = (PFNGLFLUSHPIXELDATARANGENVPROC)glewGetProcAddress((const GLubyte*)"glFlushPixelDataRangeNV")) == NULL) || r;
- r = ((glPixelDataRangeNV = (PFNGLPIXELDATARANGENVPROC)glewGetProcAddress((const GLubyte*)"glPixelDataRangeNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_pixel_data_range */
-
-#ifdef GL_NV_point_sprite
-
-static GLboolean _glewInit_GL_NV_point_sprite (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glPointParameteriNV = (PFNGLPOINTPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glPointParameteriNV")) == NULL) || r;
- r = ((glPointParameterivNV = (PFNGLPOINTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glPointParameterivNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_point_sprite */
-
-#ifdef GL_NV_present_video
-
-static GLboolean _glewInit_GL_NV_present_video (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetVideoi64vNV = (PFNGLGETVIDEOI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoi64vNV")) == NULL) || r;
- r = ((glGetVideoivNV = (PFNGLGETVIDEOIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoivNV")) == NULL) || r;
- r = ((glGetVideoui64vNV = (PFNGLGETVIDEOUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoui64vNV")) == NULL) || r;
- r = ((glGetVideouivNV = (PFNGLGETVIDEOUIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideouivNV")) == NULL) || r;
- r = ((glPresentFrameDualFillNV = (PFNGLPRESENTFRAMEDUALFILLNVPROC)glewGetProcAddress((const GLubyte*)"glPresentFrameDualFillNV")) == NULL) || r;
- r = ((glPresentFrameKeyedNV = (PFNGLPRESENTFRAMEKEYEDNVPROC)glewGetProcAddress((const GLubyte*)"glPresentFrameKeyedNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_present_video */
-
-#ifdef GL_NV_primitive_restart
-
-static GLboolean _glewInit_GL_NV_primitive_restart (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glPrimitiveRestartIndexNV = (PFNGLPRIMITIVERESTARTINDEXNVPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveRestartIndexNV")) == NULL) || r;
- r = ((glPrimitiveRestartNV = (PFNGLPRIMITIVERESTARTNVPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveRestartNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_primitive_restart */
-
-#ifdef GL_NV_register_combiners
-
-static GLboolean _glewInit_GL_NV_register_combiners (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCombinerInputNV = (PFNGLCOMBINERINPUTNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerInputNV")) == NULL) || r;
- r = ((glCombinerOutputNV = (PFNGLCOMBINEROUTPUTNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerOutputNV")) == NULL) || r;
- r = ((glCombinerParameterfNV = (PFNGLCOMBINERPARAMETERFNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameterfNV")) == NULL) || r;
- r = ((glCombinerParameterfvNV = (PFNGLCOMBINERPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameterfvNV")) == NULL) || r;
- r = ((glCombinerParameteriNV = (PFNGLCOMBINERPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameteriNV")) == NULL) || r;
- r = ((glCombinerParameterivNV = (PFNGLCOMBINERPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameterivNV")) == NULL) || r;
- r = ((glFinalCombinerInputNV = (PFNGLFINALCOMBINERINPUTNVPROC)glewGetProcAddress((const GLubyte*)"glFinalCombinerInputNV")) == NULL) || r;
- r = ((glGetCombinerInputParameterfvNV = (PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerInputParameterfvNV")) == NULL) || r;
- r = ((glGetCombinerInputParameterivNV = (PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerInputParameterivNV")) == NULL) || r;
- r = ((glGetCombinerOutputParameterfvNV = (PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerOutputParameterfvNV")) == NULL) || r;
- r = ((glGetCombinerOutputParameterivNV = (PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerOutputParameterivNV")) == NULL) || r;
- r = ((glGetFinalCombinerInputParameterfvNV = (PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetFinalCombinerInputParameterfvNV")) == NULL) || r;
- r = ((glGetFinalCombinerInputParameterivNV = (PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetFinalCombinerInputParameterivNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_register_combiners */
-
-#ifdef GL_NV_register_combiners2
-
-static GLboolean _glewInit_GL_NV_register_combiners2 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glCombinerStageParameterfvNV = (PFNGLCOMBINERSTAGEPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerStageParameterfvNV")) == NULL) || r;
- r = ((glGetCombinerStageParameterfvNV = (PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerStageParameterfvNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_register_combiners2 */
-
-#ifdef GL_NV_sample_locations
-
-static GLboolean _glewInit_GL_NV_sample_locations (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFramebufferSampleLocationsfvNV = (PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC)glewGetProcAddress((const GLubyte*)"glFramebufferSampleLocationsfvNV")) == NULL) || r;
- r = ((glNamedFramebufferSampleLocationsfvNV = (PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferSampleLocationsfvNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_sample_locations */
-
-#ifdef GL_NV_sample_mask_override_coverage
-
-#endif /* GL_NV_sample_mask_override_coverage */
-
-#ifdef GL_NV_shader_atomic_counters
-
-#endif /* GL_NV_shader_atomic_counters */
-
-#ifdef GL_NV_shader_atomic_float
-
-#endif /* GL_NV_shader_atomic_float */
-
-#ifdef GL_NV_shader_atomic_fp16_vector
-
-#endif /* GL_NV_shader_atomic_fp16_vector */
-
-#ifdef GL_NV_shader_atomic_int64
-
-#endif /* GL_NV_shader_atomic_int64 */
-
-#ifdef GL_NV_shader_buffer_load
-
-static GLboolean _glewInit_GL_NV_shader_buffer_load (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetBufferParameterui64vNV = (PFNGLGETBUFFERPARAMETERUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameterui64vNV")) == NULL) || r;
- r = ((glGetIntegerui64vNV = (PFNGLGETINTEGERUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetIntegerui64vNV")) == NULL) || r;
- r = ((glGetNamedBufferParameterui64vNV = (PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferParameterui64vNV")) == NULL) || r;
- r = ((glIsBufferResidentNV = (PFNGLISBUFFERRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glIsBufferResidentNV")) == NULL) || r;
- r = ((glIsNamedBufferResidentNV = (PFNGLISNAMEDBUFFERRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glIsNamedBufferResidentNV")) == NULL) || r;
- r = ((glMakeBufferNonResidentNV = (PFNGLMAKEBUFFERNONRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeBufferNonResidentNV")) == NULL) || r;
- r = ((glMakeBufferResidentNV = (PFNGLMAKEBUFFERRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeBufferResidentNV")) == NULL) || r;
- r = ((glMakeNamedBufferNonResidentNV = (PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeNamedBufferNonResidentNV")) == NULL) || r;
- r = ((glMakeNamedBufferResidentNV = (PFNGLMAKENAMEDBUFFERRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeNamedBufferResidentNV")) == NULL) || r;
- r = ((glProgramUniformui64NV = (PFNGLPROGRAMUNIFORMUI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformui64NV")) == NULL) || r;
- r = ((glProgramUniformui64vNV = (PFNGLPROGRAMUNIFORMUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformui64vNV")) == NULL) || r;
- r = ((glUniformui64NV = (PFNGLUNIFORMUI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniformui64NV")) == NULL) || r;
- r = ((glUniformui64vNV = (PFNGLUNIFORMUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniformui64vNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_shader_buffer_load */
-
-#ifdef GL_NV_shader_storage_buffer_object
-
-#endif /* GL_NV_shader_storage_buffer_object */
-
-#ifdef GL_NV_shader_thread_group
-
-#endif /* GL_NV_shader_thread_group */
-
-#ifdef GL_NV_shader_thread_shuffle
-
-#endif /* GL_NV_shader_thread_shuffle */
-
-#ifdef GL_NV_tessellation_program5
-
-#endif /* GL_NV_tessellation_program5 */
-
-#ifdef GL_NV_texgen_emboss
-
-#endif /* GL_NV_texgen_emboss */
-
-#ifdef GL_NV_texgen_reflection
-
-#endif /* GL_NV_texgen_reflection */
-
-#ifdef GL_NV_texture_barrier
-
-static GLboolean _glewInit_GL_NV_texture_barrier (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTextureBarrierNV = (PFNGLTEXTUREBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"glTextureBarrierNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_texture_barrier */
-
-#ifdef GL_NV_texture_compression_vtc
-
-#endif /* GL_NV_texture_compression_vtc */
-
-#ifdef GL_NV_texture_env_combine4
-
-#endif /* GL_NV_texture_env_combine4 */
-
-#ifdef GL_NV_texture_expand_normal
-
-#endif /* GL_NV_texture_expand_normal */
-
-#ifdef GL_NV_texture_multisample
-
-static GLboolean _glewInit_GL_NV_texture_multisample (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTexImage2DMultisampleCoverageNV = (PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTexImage2DMultisampleCoverageNV")) == NULL) || r;
- r = ((glTexImage3DMultisampleCoverageNV = (PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTexImage3DMultisampleCoverageNV")) == NULL) || r;
- r = ((glTextureImage2DMultisampleCoverageNV = (PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage2DMultisampleCoverageNV")) == NULL) || r;
- r = ((glTextureImage2DMultisampleNV = (PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage2DMultisampleNV")) == NULL) || r;
- r = ((glTextureImage3DMultisampleCoverageNV = (PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage3DMultisampleCoverageNV")) == NULL) || r;
- r = ((glTextureImage3DMultisampleNV = (PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage3DMultisampleNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_texture_multisample */
-
-#ifdef GL_NV_texture_rectangle
-
-#endif /* GL_NV_texture_rectangle */
-
-#ifdef GL_NV_texture_shader
-
-#endif /* GL_NV_texture_shader */
-
-#ifdef GL_NV_texture_shader2
-
-#endif /* GL_NV_texture_shader2 */
-
-#ifdef GL_NV_texture_shader3
-
-#endif /* GL_NV_texture_shader3 */
-
-#ifdef GL_NV_transform_feedback
-
-static GLboolean _glewInit_GL_NV_transform_feedback (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glActiveVaryingNV = (PFNGLACTIVEVARYINGNVPROC)glewGetProcAddress((const GLubyte*)"glActiveVaryingNV")) == NULL) || r;
- r = ((glBeginTransformFeedbackNV = (PFNGLBEGINTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glBeginTransformFeedbackNV")) == NULL) || r;
- r = ((glBindBufferBaseNV = (PFNGLBINDBUFFERBASENVPROC)glewGetProcAddress((const GLubyte*)"glBindBufferBaseNV")) == NULL) || r;
- r = ((glBindBufferOffsetNV = (PFNGLBINDBUFFEROFFSETNVPROC)glewGetProcAddress((const GLubyte*)"glBindBufferOffsetNV")) == NULL) || r;
- r = ((glBindBufferRangeNV = (PFNGLBINDBUFFERRANGENVPROC)glewGetProcAddress((const GLubyte*)"glBindBufferRangeNV")) == NULL) || r;
- r = ((glEndTransformFeedbackNV = (PFNGLENDTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glEndTransformFeedbackNV")) == NULL) || r;
- r = ((glGetActiveVaryingNV = (PFNGLGETACTIVEVARYINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveVaryingNV")) == NULL) || r;
- r = ((glGetTransformFeedbackVaryingNV = (PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbackVaryingNV")) == NULL) || r;
- r = ((glGetVaryingLocationNV = (PFNGLGETVARYINGLOCATIONNVPROC)glewGetProcAddress((const GLubyte*)"glGetVaryingLocationNV")) == NULL) || r;
- r = ((glTransformFeedbackAttribsNV = (PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackAttribsNV")) == NULL) || r;
- r = ((glTransformFeedbackVaryingsNV = (PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackVaryingsNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_transform_feedback */
-
-#ifdef GL_NV_transform_feedback2
-
-static GLboolean _glewInit_GL_NV_transform_feedback2 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBindTransformFeedbackNV = (PFNGLBINDTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glBindTransformFeedbackNV")) == NULL) || r;
- r = ((glDeleteTransformFeedbacksNV = (PFNGLDELETETRANSFORMFEEDBACKSNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteTransformFeedbacksNV")) == NULL) || r;
- r = ((glDrawTransformFeedbackNV = (PFNGLDRAWTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedbackNV")) == NULL) || r;
- r = ((glGenTransformFeedbacksNV = (PFNGLGENTRANSFORMFEEDBACKSNVPROC)glewGetProcAddress((const GLubyte*)"glGenTransformFeedbacksNV")) == NULL) || r;
- r = ((glIsTransformFeedbackNV = (PFNGLISTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glIsTransformFeedbackNV")) == NULL) || r;
- r = ((glPauseTransformFeedbackNV = (PFNGLPAUSETRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glPauseTransformFeedbackNV")) == NULL) || r;
- r = ((glResumeTransformFeedbackNV = (PFNGLRESUMETRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glResumeTransformFeedbackNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_transform_feedback2 */
-
-#ifdef GL_NV_uniform_buffer_unified_memory
-
-#endif /* GL_NV_uniform_buffer_unified_memory */
-
-#ifdef GL_NV_vdpau_interop
-
-static GLboolean _glewInit_GL_NV_vdpau_interop (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glVDPAUFiniNV = (PFNGLVDPAUFININVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUFiniNV")) == NULL) || r;
- r = ((glVDPAUGetSurfaceivNV = (PFNGLVDPAUGETSURFACEIVNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUGetSurfaceivNV")) == NULL) || r;
- r = ((glVDPAUInitNV = (PFNGLVDPAUINITNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUInitNV")) == NULL) || r;
- r = ((glVDPAUIsSurfaceNV = (PFNGLVDPAUISSURFACENVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUIsSurfaceNV")) == NULL) || r;
- r = ((glVDPAUMapSurfacesNV = (PFNGLVDPAUMAPSURFACESNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUMapSurfacesNV")) == NULL) || r;
- r = ((glVDPAURegisterOutputSurfaceNV = (PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC)glewGetProcAddress((const GLubyte*)"glVDPAURegisterOutputSurfaceNV")) == NULL) || r;
- r = ((glVDPAURegisterVideoSurfaceNV = (PFNGLVDPAUREGISTERVIDEOSURFACENVPROC)glewGetProcAddress((const GLubyte*)"glVDPAURegisterVideoSurfaceNV")) == NULL) || r;
- r = ((glVDPAUSurfaceAccessNV = (PFNGLVDPAUSURFACEACCESSNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUSurfaceAccessNV")) == NULL) || r;
- r = ((glVDPAUUnmapSurfacesNV = (PFNGLVDPAUUNMAPSURFACESNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUUnmapSurfacesNV")) == NULL) || r;
- r = ((glVDPAUUnregisterSurfaceNV = (PFNGLVDPAUUNREGISTERSURFACENVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUUnregisterSurfaceNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_vdpau_interop */
-
-#ifdef GL_NV_vertex_array_range
-
-static GLboolean _glewInit_GL_NV_vertex_array_range (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFlushVertexArrayRangeNV = (PFNGLFLUSHVERTEXARRAYRANGENVPROC)glewGetProcAddress((const GLubyte*)"glFlushVertexArrayRangeNV")) == NULL) || r;
- r = ((glVertexArrayRangeNV = (PFNGLVERTEXARRAYRANGENVPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayRangeNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_vertex_array_range */
-
-#ifdef GL_NV_vertex_array_range2
-
-#endif /* GL_NV_vertex_array_range2 */
-
-#ifdef GL_NV_vertex_attrib_integer_64bit
-
-static GLboolean _glewInit_GL_NV_vertex_attrib_integer_64bit (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetVertexAttribLi64vNV = (PFNGLGETVERTEXATTRIBLI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLi64vNV")) == NULL) || r;
- r = ((glGetVertexAttribLui64vNV = (PFNGLGETVERTEXATTRIBLUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLui64vNV")) == NULL) || r;
- r = ((glVertexAttribL1i64NV = (PFNGLVERTEXATTRIBL1I64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1i64NV")) == NULL) || r;
- r = ((glVertexAttribL1i64vNV = (PFNGLVERTEXATTRIBL1I64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1i64vNV")) == NULL) || r;
- r = ((glVertexAttribL1ui64NV = (PFNGLVERTEXATTRIBL1UI64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1ui64NV")) == NULL) || r;
- r = ((glVertexAttribL1ui64vNV = (PFNGLVERTEXATTRIBL1UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1ui64vNV")) == NULL) || r;
- r = ((glVertexAttribL2i64NV = (PFNGLVERTEXATTRIBL2I64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2i64NV")) == NULL) || r;
- r = ((glVertexAttribL2i64vNV = (PFNGLVERTEXATTRIBL2I64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2i64vNV")) == NULL) || r;
- r = ((glVertexAttribL2ui64NV = (PFNGLVERTEXATTRIBL2UI64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2ui64NV")) == NULL) || r;
- r = ((glVertexAttribL2ui64vNV = (PFNGLVERTEXATTRIBL2UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2ui64vNV")) == NULL) || r;
- r = ((glVertexAttribL3i64NV = (PFNGLVERTEXATTRIBL3I64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3i64NV")) == NULL) || r;
- r = ((glVertexAttribL3i64vNV = (PFNGLVERTEXATTRIBL3I64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3i64vNV")) == NULL) || r;
- r = ((glVertexAttribL3ui64NV = (PFNGLVERTEXATTRIBL3UI64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3ui64NV")) == NULL) || r;
- r = ((glVertexAttribL3ui64vNV = (PFNGLVERTEXATTRIBL3UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3ui64vNV")) == NULL) || r;
- r = ((glVertexAttribL4i64NV = (PFNGLVERTEXATTRIBL4I64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4i64NV")) == NULL) || r;
- r = ((glVertexAttribL4i64vNV = (PFNGLVERTEXATTRIBL4I64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4i64vNV")) == NULL) || r;
- r = ((glVertexAttribL4ui64NV = (PFNGLVERTEXATTRIBL4UI64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4ui64NV")) == NULL) || r;
- r = ((glVertexAttribL4ui64vNV = (PFNGLVERTEXATTRIBL4UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4ui64vNV")) == NULL) || r;
- r = ((glVertexAttribLFormatNV = (PFNGLVERTEXATTRIBLFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribLFormatNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_vertex_attrib_integer_64bit */
-
-#ifdef GL_NV_vertex_buffer_unified_memory
-
-static GLboolean _glewInit_GL_NV_vertex_buffer_unified_memory (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBufferAddressRangeNV = (PFNGLBUFFERADDRESSRANGENVPROC)glewGetProcAddress((const GLubyte*)"glBufferAddressRangeNV")) == NULL) || r;
- r = ((glColorFormatNV = (PFNGLCOLORFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glColorFormatNV")) == NULL) || r;
- r = ((glEdgeFlagFormatNV = (PFNGLEDGEFLAGFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glEdgeFlagFormatNV")) == NULL) || r;
- r = ((glFogCoordFormatNV = (PFNGLFOGCOORDFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordFormatNV")) == NULL) || r;
- r = ((glGetIntegerui64i_vNV = (PFNGLGETINTEGERUI64I_VNVPROC)glewGetProcAddress((const GLubyte*)"glGetIntegerui64i_vNV")) == NULL) || r;
- r = ((glIndexFormatNV = (PFNGLINDEXFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glIndexFormatNV")) == NULL) || r;
- r = ((glNormalFormatNV = (PFNGLNORMALFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glNormalFormatNV")) == NULL) || r;
- r = ((glSecondaryColorFormatNV = (PFNGLSECONDARYCOLORFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorFormatNV")) == NULL) || r;
- r = ((glTexCoordFormatNV = (PFNGLTEXCOORDFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordFormatNV")) == NULL) || r;
- r = ((glVertexAttribFormatNV = (PFNGLVERTEXATTRIBFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribFormatNV")) == NULL) || r;
- r = ((glVertexAttribIFormatNV = (PFNGLVERTEXATTRIBIFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribIFormatNV")) == NULL) || r;
- r = ((glVertexFormatNV = (PFNGLVERTEXFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glVertexFormatNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_vertex_buffer_unified_memory */
-
-#ifdef GL_NV_vertex_program
-
-static GLboolean _glewInit_GL_NV_vertex_program (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glAreProgramsResidentNV = (PFNGLAREPROGRAMSRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glAreProgramsResidentNV")) == NULL) || r;
- r = ((glBindProgramNV = (PFNGLBINDPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glBindProgramNV")) == NULL) || r;
- r = ((glDeleteProgramsNV = (PFNGLDELETEPROGRAMSNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgramsNV")) == NULL) || r;
- r = ((glExecuteProgramNV = (PFNGLEXECUTEPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glExecuteProgramNV")) == NULL) || r;
- r = ((glGenProgramsNV = (PFNGLGENPROGRAMSNVPROC)glewGetProcAddress((const GLubyte*)"glGenProgramsNV")) == NULL) || r;
- r = ((glGetProgramParameterdvNV = (PFNGLGETPROGRAMPARAMETERDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramParameterdvNV")) == NULL) || r;
- r = ((glGetProgramParameterfvNV = (PFNGLGETPROGRAMPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramParameterfvNV")) == NULL) || r;
- r = ((glGetProgramStringNV = (PFNGLGETPROGRAMSTRINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramStringNV")) == NULL) || r;
- r = ((glGetProgramivNV = (PFNGLGETPROGRAMIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramivNV")) == NULL) || r;
- r = ((glGetTrackMatrixivNV = (PFNGLGETTRACKMATRIXIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetTrackMatrixivNV")) == NULL) || r;
- r = ((glGetVertexAttribPointervNV = (PFNGLGETVERTEXATTRIBPOINTERVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribPointervNV")) == NULL) || r;
- r = ((glGetVertexAttribdvNV = (PFNGLGETVERTEXATTRIBDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribdvNV")) == NULL) || r;
- r = ((glGetVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribfvNV")) == NULL) || r;
- r = ((glGetVertexAttribivNV = (PFNGLGETVERTEXATTRIBIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribivNV")) == NULL) || r;
- r = ((glIsProgramNV = (PFNGLISPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glIsProgramNV")) == NULL) || r;
- r = ((glLoadProgramNV = (PFNGLLOADPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glLoadProgramNV")) == NULL) || r;
- r = ((glProgramParameter4dNV = (PFNGLPROGRAMPARAMETER4DNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4dNV")) == NULL) || r;
- r = ((glProgramParameter4dvNV = (PFNGLPROGRAMPARAMETER4DVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4dvNV")) == NULL) || r;
- r = ((glProgramParameter4fNV = (PFNGLPROGRAMPARAMETER4FNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4fNV")) == NULL) || r;
- r = ((glProgramParameter4fvNV = (PFNGLPROGRAMPARAMETER4FVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4fvNV")) == NULL) || r;
- r = ((glProgramParameters4dvNV = (PFNGLPROGRAMPARAMETERS4DVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameters4dvNV")) == NULL) || r;
- r = ((glProgramParameters4fvNV = (PFNGLPROGRAMPARAMETERS4FVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameters4fvNV")) == NULL) || r;
- r = ((glRequestResidentProgramsNV = (PFNGLREQUESTRESIDENTPROGRAMSNVPROC)glewGetProcAddress((const GLubyte*)"glRequestResidentProgramsNV")) == NULL) || r;
- r = ((glTrackMatrixNV = (PFNGLTRACKMATRIXNVPROC)glewGetProcAddress((const GLubyte*)"glTrackMatrixNV")) == NULL) || r;
- r = ((glVertexAttrib1dNV = (PFNGLVERTEXATTRIB1DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dNV")) == NULL) || r;
- r = ((glVertexAttrib1dvNV = (PFNGLVERTEXATTRIB1DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dvNV")) == NULL) || r;
- r = ((glVertexAttrib1fNV = (PFNGLVERTEXATTRIB1FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fNV")) == NULL) || r;
- r = ((glVertexAttrib1fvNV = (PFNGLVERTEXATTRIB1FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fvNV")) == NULL) || r;
- r = ((glVertexAttrib1sNV = (PFNGLVERTEXATTRIB1SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1sNV")) == NULL) || r;
- r = ((glVertexAttrib1svNV = (PFNGLVERTEXATTRIB1SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1svNV")) == NULL) || r;
- r = ((glVertexAttrib2dNV = (PFNGLVERTEXATTRIB2DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dNV")) == NULL) || r;
- r = ((glVertexAttrib2dvNV = (PFNGLVERTEXATTRIB2DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dvNV")) == NULL) || r;
- r = ((glVertexAttrib2fNV = (PFNGLVERTEXATTRIB2FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fNV")) == NULL) || r;
- r = ((glVertexAttrib2fvNV = (PFNGLVERTEXATTRIB2FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fvNV")) == NULL) || r;
- r = ((glVertexAttrib2sNV = (PFNGLVERTEXATTRIB2SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2sNV")) == NULL) || r;
- r = ((glVertexAttrib2svNV = (PFNGLVERTEXATTRIB2SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2svNV")) == NULL) || r;
- r = ((glVertexAttrib3dNV = (PFNGLVERTEXATTRIB3DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dNV")) == NULL) || r;
- r = ((glVertexAttrib3dvNV = (PFNGLVERTEXATTRIB3DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dvNV")) == NULL) || r;
- r = ((glVertexAttrib3fNV = (PFNGLVERTEXATTRIB3FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fNV")) == NULL) || r;
- r = ((glVertexAttrib3fvNV = (PFNGLVERTEXATTRIB3FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fvNV")) == NULL) || r;
- r = ((glVertexAttrib3sNV = (PFNGLVERTEXATTRIB3SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3sNV")) == NULL) || r;
- r = ((glVertexAttrib3svNV = (PFNGLVERTEXATTRIB3SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3svNV")) == NULL) || r;
- r = ((glVertexAttrib4dNV = (PFNGLVERTEXATTRIB4DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dNV")) == NULL) || r;
- r = ((glVertexAttrib4dvNV = (PFNGLVERTEXATTRIB4DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dvNV")) == NULL) || r;
- r = ((glVertexAttrib4fNV = (PFNGLVERTEXATTRIB4FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fNV")) == NULL) || r;
- r = ((glVertexAttrib4fvNV = (PFNGLVERTEXATTRIB4FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fvNV")) == NULL) || r;
- r = ((glVertexAttrib4sNV = (PFNGLVERTEXATTRIB4SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4sNV")) == NULL) || r;
- r = ((glVertexAttrib4svNV = (PFNGLVERTEXATTRIB4SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4svNV")) == NULL) || r;
- r = ((glVertexAttrib4ubNV = (PFNGLVERTEXATTRIB4UBNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubNV")) == NULL) || r;
- r = ((glVertexAttrib4ubvNV = (PFNGLVERTEXATTRIB4UBVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubvNV")) == NULL) || r;
- r = ((glVertexAttribPointerNV = (PFNGLVERTEXATTRIBPOINTERNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointerNV")) == NULL) || r;
- r = ((glVertexAttribs1dvNV = (PFNGLVERTEXATTRIBS1DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1dvNV")) == NULL) || r;
- r = ((glVertexAttribs1fvNV = (PFNGLVERTEXATTRIBS1FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1fvNV")) == NULL) || r;
- r = ((glVertexAttribs1svNV = (PFNGLVERTEXATTRIBS1SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1svNV")) == NULL) || r;
- r = ((glVertexAttribs2dvNV = (PFNGLVERTEXATTRIBS2DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2dvNV")) == NULL) || r;
- r = ((glVertexAttribs2fvNV = (PFNGLVERTEXATTRIBS2FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2fvNV")) == NULL) || r;
- r = ((glVertexAttribs2svNV = (PFNGLVERTEXATTRIBS2SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2svNV")) == NULL) || r;
- r = ((glVertexAttribs3dvNV = (PFNGLVERTEXATTRIBS3DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3dvNV")) == NULL) || r;
- r = ((glVertexAttribs3fvNV = (PFNGLVERTEXATTRIBS3FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3fvNV")) == NULL) || r;
- r = ((glVertexAttribs3svNV = (PFNGLVERTEXATTRIBS3SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3svNV")) == NULL) || r;
- r = ((glVertexAttribs4dvNV = (PFNGLVERTEXATTRIBS4DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4dvNV")) == NULL) || r;
- r = ((glVertexAttribs4fvNV = (PFNGLVERTEXATTRIBS4FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4fvNV")) == NULL) || r;
- r = ((glVertexAttribs4svNV = (PFNGLVERTEXATTRIBS4SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4svNV")) == NULL) || r;
- r = ((glVertexAttribs4ubvNV = (PFNGLVERTEXATTRIBS4UBVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4ubvNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_vertex_program */
-
-#ifdef GL_NV_vertex_program1_1
-
-#endif /* GL_NV_vertex_program1_1 */
-
-#ifdef GL_NV_vertex_program2
-
-#endif /* GL_NV_vertex_program2 */
-
-#ifdef GL_NV_vertex_program2_option
-
-#endif /* GL_NV_vertex_program2_option */
-
-#ifdef GL_NV_vertex_program3
-
-#endif /* GL_NV_vertex_program3 */
-
-#ifdef GL_NV_vertex_program4
-
-#endif /* GL_NV_vertex_program4 */
-
-#ifdef GL_NV_video_capture
-
-static GLboolean _glewInit_GL_NV_video_capture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glBeginVideoCaptureNV = (PFNGLBEGINVIDEOCAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glBeginVideoCaptureNV")) == NULL) || r;
- r = ((glBindVideoCaptureStreamBufferNV = (PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC)glewGetProcAddress((const GLubyte*)"glBindVideoCaptureStreamBufferNV")) == NULL) || r;
- r = ((glBindVideoCaptureStreamTextureNV = (PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC)glewGetProcAddress((const GLubyte*)"glBindVideoCaptureStreamTextureNV")) == NULL) || r;
- r = ((glEndVideoCaptureNV = (PFNGLENDVIDEOCAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glEndVideoCaptureNV")) == NULL) || r;
- r = ((glGetVideoCaptureStreamdvNV = (PFNGLGETVIDEOCAPTURESTREAMDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureStreamdvNV")) == NULL) || r;
- r = ((glGetVideoCaptureStreamfvNV = (PFNGLGETVIDEOCAPTURESTREAMFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureStreamfvNV")) == NULL) || r;
- r = ((glGetVideoCaptureStreamivNV = (PFNGLGETVIDEOCAPTURESTREAMIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureStreamivNV")) == NULL) || r;
- r = ((glGetVideoCaptureivNV = (PFNGLGETVIDEOCAPTUREIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureivNV")) == NULL) || r;
- r = ((glVideoCaptureNV = (PFNGLVIDEOCAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureNV")) == NULL) || r;
- r = ((glVideoCaptureStreamParameterdvNV = (PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureStreamParameterdvNV")) == NULL) || r;
- r = ((glVideoCaptureStreamParameterfvNV = (PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureStreamParameterfvNV")) == NULL) || r;
- r = ((glVideoCaptureStreamParameterivNV = (PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureStreamParameterivNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_NV_video_capture */
-
-#ifdef GL_OES_byte_coordinates
-
-#endif /* GL_OES_byte_coordinates */
-
-#ifdef GL_OES_compressed_paletted_texture
-
-#endif /* GL_OES_compressed_paletted_texture */
-
-#ifdef GL_OES_read_format
-
-#endif /* GL_OES_read_format */
-
-#ifdef GL_OES_single_precision
-
-static GLboolean _glewInit_GL_OES_single_precision (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glClearDepthfOES = (PFNGLCLEARDEPTHFOESPROC)glewGetProcAddress((const GLubyte*)"glClearDepthfOES")) == NULL) || r;
- r = ((glClipPlanefOES = (PFNGLCLIPPLANEFOESPROC)glewGetProcAddress((const GLubyte*)"glClipPlanefOES")) == NULL) || r;
- r = ((glDepthRangefOES = (PFNGLDEPTHRANGEFOESPROC)glewGetProcAddress((const GLubyte*)"glDepthRangefOES")) == NULL) || r;
- r = ((glFrustumfOES = (PFNGLFRUSTUMFOESPROC)glewGetProcAddress((const GLubyte*)"glFrustumfOES")) == NULL) || r;
- r = ((glGetClipPlanefOES = (PFNGLGETCLIPPLANEFOESPROC)glewGetProcAddress((const GLubyte*)"glGetClipPlanefOES")) == NULL) || r;
- r = ((glOrthofOES = (PFNGLORTHOFOESPROC)glewGetProcAddress((const GLubyte*)"glOrthofOES")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_OES_single_precision */
-
-#ifdef GL_OML_interlace
-
-#endif /* GL_OML_interlace */
-
-#ifdef GL_OML_resample
-
-#endif /* GL_OML_resample */
-
-#ifdef GL_OML_subsample
-
-#endif /* GL_OML_subsample */
-
-#ifdef GL_PGI_misc_hints
-
-#endif /* GL_PGI_misc_hints */
-
-#ifdef GL_PGI_vertex_hints
-
-#endif /* GL_PGI_vertex_hints */
-
-#ifdef GL_REGAL_ES1_0_compatibility
-
-static GLboolean _glewInit_GL_REGAL_ES1_0_compatibility (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glAlphaFuncx = (PFNGLALPHAFUNCXPROC)glewGetProcAddress((const GLubyte*)"glAlphaFuncx")) == NULL) || r;
- r = ((glClearColorx = (PFNGLCLEARCOLORXPROC)glewGetProcAddress((const GLubyte*)"glClearColorx")) == NULL) || r;
- r = ((glClearDepthx = (PFNGLCLEARDEPTHXPROC)glewGetProcAddress((const GLubyte*)"glClearDepthx")) == NULL) || r;
- r = ((glColor4x = (PFNGLCOLOR4XPROC)glewGetProcAddress((const GLubyte*)"glColor4x")) == NULL) || r;
- r = ((glDepthRangex = (PFNGLDEPTHRANGEXPROC)glewGetProcAddress((const GLubyte*)"glDepthRangex")) == NULL) || r;
- r = ((glFogx = (PFNGLFOGXPROC)glewGetProcAddress((const GLubyte*)"glFogx")) == NULL) || r;
- r = ((glFogxv = (PFNGLFOGXVPROC)glewGetProcAddress((const GLubyte*)"glFogxv")) == NULL) || r;
- r = ((glFrustumf = (PFNGLFRUSTUMFPROC)glewGetProcAddress((const GLubyte*)"glFrustumf")) == NULL) || r;
- r = ((glFrustumx = (PFNGLFRUSTUMXPROC)glewGetProcAddress((const GLubyte*)"glFrustumx")) == NULL) || r;
- r = ((glLightModelx = (PFNGLLIGHTMODELXPROC)glewGetProcAddress((const GLubyte*)"glLightModelx")) == NULL) || r;
- r = ((glLightModelxv = (PFNGLLIGHTMODELXVPROC)glewGetProcAddress((const GLubyte*)"glLightModelxv")) == NULL) || r;
- r = ((glLightx = (PFNGLLIGHTXPROC)glewGetProcAddress((const GLubyte*)"glLightx")) == NULL) || r;
- r = ((glLightxv = (PFNGLLIGHTXVPROC)glewGetProcAddress((const GLubyte*)"glLightxv")) == NULL) || r;
- r = ((glLineWidthx = (PFNGLLINEWIDTHXPROC)glewGetProcAddress((const GLubyte*)"glLineWidthx")) == NULL) || r;
- r = ((glLoadMatrixx = (PFNGLLOADMATRIXXPROC)glewGetProcAddress((const GLubyte*)"glLoadMatrixx")) == NULL) || r;
- r = ((glMaterialx = (PFNGLMATERIALXPROC)glewGetProcAddress((const GLubyte*)"glMaterialx")) == NULL) || r;
- r = ((glMaterialxv = (PFNGLMATERIALXVPROC)glewGetProcAddress((const GLubyte*)"glMaterialxv")) == NULL) || r;
- r = ((glMultMatrixx = (PFNGLMULTMATRIXXPROC)glewGetProcAddress((const GLubyte*)"glMultMatrixx")) == NULL) || r;
- r = ((glMultiTexCoord4x = (PFNGLMULTITEXCOORD4XPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4x")) == NULL) || r;
- r = ((glNormal3x = (PFNGLNORMAL3XPROC)glewGetProcAddress((const GLubyte*)"glNormal3x")) == NULL) || r;
- r = ((glOrthof = (PFNGLORTHOFPROC)glewGetProcAddress((const GLubyte*)"glOrthof")) == NULL) || r;
- r = ((glOrthox = (PFNGLORTHOXPROC)glewGetProcAddress((const GLubyte*)"glOrthox")) == NULL) || r;
- r = ((glPointSizex = (PFNGLPOINTSIZEXPROC)glewGetProcAddress((const GLubyte*)"glPointSizex")) == NULL) || r;
- r = ((glPolygonOffsetx = (PFNGLPOLYGONOFFSETXPROC)glewGetProcAddress((const GLubyte*)"glPolygonOffsetx")) == NULL) || r;
- r = ((glRotatex = (PFNGLROTATEXPROC)glewGetProcAddress((const GLubyte*)"glRotatex")) == NULL) || r;
- r = ((glSampleCoveragex = (PFNGLSAMPLECOVERAGEXPROC)glewGetProcAddress((const GLubyte*)"glSampleCoveragex")) == NULL) || r;
- r = ((glScalex = (PFNGLSCALEXPROC)glewGetProcAddress((const GLubyte*)"glScalex")) == NULL) || r;
- r = ((glTexEnvx = (PFNGLTEXENVXPROC)glewGetProcAddress((const GLubyte*)"glTexEnvx")) == NULL) || r;
- r = ((glTexEnvxv = (PFNGLTEXENVXVPROC)glewGetProcAddress((const GLubyte*)"glTexEnvxv")) == NULL) || r;
- r = ((glTexParameterx = (PFNGLTEXPARAMETERXPROC)glewGetProcAddress((const GLubyte*)"glTexParameterx")) == NULL) || r;
- r = ((glTranslatex = (PFNGLTRANSLATEXPROC)glewGetProcAddress((const GLubyte*)"glTranslatex")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_REGAL_ES1_0_compatibility */
-
-#ifdef GL_REGAL_ES1_1_compatibility
-
-static GLboolean _glewInit_GL_REGAL_ES1_1_compatibility (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glClipPlanef = (PFNGLCLIPPLANEFPROC)glewGetProcAddress((const GLubyte*)"glClipPlanef")) == NULL) || r;
- r = ((glClipPlanex = (PFNGLCLIPPLANEXPROC)glewGetProcAddress((const GLubyte*)"glClipPlanex")) == NULL) || r;
- r = ((glGetClipPlanef = (PFNGLGETCLIPPLANEFPROC)glewGetProcAddress((const GLubyte*)"glGetClipPlanef")) == NULL) || r;
- r = ((glGetClipPlanex = (PFNGLGETCLIPPLANEXPROC)glewGetProcAddress((const GLubyte*)"glGetClipPlanex")) == NULL) || r;
- r = ((glGetFixedv = (PFNGLGETFIXEDVPROC)glewGetProcAddress((const GLubyte*)"glGetFixedv")) == NULL) || r;
- r = ((glGetLightxv = (PFNGLGETLIGHTXVPROC)glewGetProcAddress((const GLubyte*)"glGetLightxv")) == NULL) || r;
- r = ((glGetMaterialxv = (PFNGLGETMATERIALXVPROC)glewGetProcAddress((const GLubyte*)"glGetMaterialxv")) == NULL) || r;
- r = ((glGetTexEnvxv = (PFNGLGETTEXENVXVPROC)glewGetProcAddress((const GLubyte*)"glGetTexEnvxv")) == NULL) || r;
- r = ((glGetTexParameterxv = (PFNGLGETTEXPARAMETERXVPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterxv")) == NULL) || r;
- r = ((glPointParameterx = (PFNGLPOINTPARAMETERXPROC)glewGetProcAddress((const GLubyte*)"glPointParameterx")) == NULL) || r;
- r = ((glPointParameterxv = (PFNGLPOINTPARAMETERXVPROC)glewGetProcAddress((const GLubyte*)"glPointParameterxv")) == NULL) || r;
- r = ((glPointSizePointerOES = (PFNGLPOINTSIZEPOINTEROESPROC)glewGetProcAddress((const GLubyte*)"glPointSizePointerOES")) == NULL) || r;
- r = ((glTexParameterxv = (PFNGLTEXPARAMETERXVPROC)glewGetProcAddress((const GLubyte*)"glTexParameterxv")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_REGAL_ES1_1_compatibility */
-
-#ifdef GL_REGAL_enable
-
-#endif /* GL_REGAL_enable */
-
-#ifdef GL_REGAL_error_string
-
-static GLboolean _glewInit_GL_REGAL_error_string (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glErrorStringREGAL = (PFNGLERRORSTRINGREGALPROC)glewGetProcAddress((const GLubyte*)"glErrorStringREGAL")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_REGAL_error_string */
-
-#ifdef GL_REGAL_extension_query
-
-static GLboolean _glewInit_GL_REGAL_extension_query (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetExtensionREGAL = (PFNGLGETEXTENSIONREGALPROC)glewGetProcAddress((const GLubyte*)"glGetExtensionREGAL")) == NULL) || r;
- r = ((glIsSupportedREGAL = (PFNGLISSUPPORTEDREGALPROC)glewGetProcAddress((const GLubyte*)"glIsSupportedREGAL")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_REGAL_extension_query */
-
-#ifdef GL_REGAL_log
-
-static GLboolean _glewInit_GL_REGAL_log (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glLogMessageCallbackREGAL = (PFNGLLOGMESSAGECALLBACKREGALPROC)glewGetProcAddress((const GLubyte*)"glLogMessageCallbackREGAL")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_REGAL_log */
-
-#ifdef GL_REGAL_proc_address
-
-static GLboolean _glewInit_GL_REGAL_proc_address (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetProcAddressREGAL = (PFNGLGETPROCADDRESSREGALPROC)glewGetProcAddress((const GLubyte*)"glGetProcAddressREGAL")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_REGAL_proc_address */
-
-#ifdef GL_REND_screen_coordinates
-
-#endif /* GL_REND_screen_coordinates */
-
-#ifdef GL_S3_s3tc
-
-#endif /* GL_S3_s3tc */
-
-#ifdef GL_SGIS_color_range
-
-#endif /* GL_SGIS_color_range */
-
-#ifdef GL_SGIS_detail_texture
-
-static GLboolean _glewInit_GL_SGIS_detail_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glDetailTexFuncSGIS = (PFNGLDETAILTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glDetailTexFuncSGIS")) == NULL) || r;
- r = ((glGetDetailTexFuncSGIS = (PFNGLGETDETAILTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetDetailTexFuncSGIS")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIS_detail_texture */
-
-#ifdef GL_SGIS_fog_function
-
-static GLboolean _glewInit_GL_SGIS_fog_function (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFogFuncSGIS = (PFNGLFOGFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glFogFuncSGIS")) == NULL) || r;
- r = ((glGetFogFuncSGIS = (PFNGLGETFOGFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetFogFuncSGIS")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIS_fog_function */
-
-#ifdef GL_SGIS_generate_mipmap
-
-#endif /* GL_SGIS_generate_mipmap */
-
-#ifdef GL_SGIS_multisample
-
-static GLboolean _glewInit_GL_SGIS_multisample (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glSampleMaskSGIS = (PFNGLSAMPLEMASKSGISPROC)glewGetProcAddress((const GLubyte*)"glSampleMaskSGIS")) == NULL) || r;
- r = ((glSamplePatternSGIS = (PFNGLSAMPLEPATTERNSGISPROC)glewGetProcAddress((const GLubyte*)"glSamplePatternSGIS")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIS_multisample */
-
-#ifdef GL_SGIS_pixel_texture
-
-#endif /* GL_SGIS_pixel_texture */
-
-#ifdef GL_SGIS_point_line_texgen
-
-#endif /* GL_SGIS_point_line_texgen */
-
-#ifdef GL_SGIS_sharpen_texture
-
-static GLboolean _glewInit_GL_SGIS_sharpen_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetSharpenTexFuncSGIS = (PFNGLGETSHARPENTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetSharpenTexFuncSGIS")) == NULL) || r;
- r = ((glSharpenTexFuncSGIS = (PFNGLSHARPENTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glSharpenTexFuncSGIS")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIS_sharpen_texture */
-
-#ifdef GL_SGIS_texture4D
-
-static GLboolean _glewInit_GL_SGIS_texture4D (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTexImage4DSGIS = (PFNGLTEXIMAGE4DSGISPROC)glewGetProcAddress((const GLubyte*)"glTexImage4DSGIS")) == NULL) || r;
- r = ((glTexSubImage4DSGIS = (PFNGLTEXSUBIMAGE4DSGISPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage4DSGIS")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIS_texture4D */
-
-#ifdef GL_SGIS_texture_border_clamp
-
-#endif /* GL_SGIS_texture_border_clamp */
-
-#ifdef GL_SGIS_texture_edge_clamp
-
-#endif /* GL_SGIS_texture_edge_clamp */
-
-#ifdef GL_SGIS_texture_filter4
-
-static GLboolean _glewInit_GL_SGIS_texture_filter4 (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGetTexFilterFuncSGIS = (PFNGLGETTEXFILTERFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetTexFilterFuncSGIS")) == NULL) || r;
- r = ((glTexFilterFuncSGIS = (PFNGLTEXFILTERFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glTexFilterFuncSGIS")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIS_texture_filter4 */
-
-#ifdef GL_SGIS_texture_lod
-
-#endif /* GL_SGIS_texture_lod */
-
-#ifdef GL_SGIS_texture_select
-
-#endif /* GL_SGIS_texture_select */
-
-#ifdef GL_SGIX_async
-
-static GLboolean _glewInit_GL_SGIX_async (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glAsyncMarkerSGIX = (PFNGLASYNCMARKERSGIXPROC)glewGetProcAddress((const GLubyte*)"glAsyncMarkerSGIX")) == NULL) || r;
- r = ((glDeleteAsyncMarkersSGIX = (PFNGLDELETEASYNCMARKERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glDeleteAsyncMarkersSGIX")) == NULL) || r;
- r = ((glFinishAsyncSGIX = (PFNGLFINISHASYNCSGIXPROC)glewGetProcAddress((const GLubyte*)"glFinishAsyncSGIX")) == NULL) || r;
- r = ((glGenAsyncMarkersSGIX = (PFNGLGENASYNCMARKERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glGenAsyncMarkersSGIX")) == NULL) || r;
- r = ((glIsAsyncMarkerSGIX = (PFNGLISASYNCMARKERSGIXPROC)glewGetProcAddress((const GLubyte*)"glIsAsyncMarkerSGIX")) == NULL) || r;
- r = ((glPollAsyncSGIX = (PFNGLPOLLASYNCSGIXPROC)glewGetProcAddress((const GLubyte*)"glPollAsyncSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIX_async */
-
-#ifdef GL_SGIX_async_histogram
-
-#endif /* GL_SGIX_async_histogram */
-
-#ifdef GL_SGIX_async_pixel
-
-#endif /* GL_SGIX_async_pixel */
-
-#ifdef GL_SGIX_blend_alpha_minmax
-
-#endif /* GL_SGIX_blend_alpha_minmax */
-
-#ifdef GL_SGIX_clipmap
-
-#endif /* GL_SGIX_clipmap */
-
-#ifdef GL_SGIX_convolution_accuracy
-
-#endif /* GL_SGIX_convolution_accuracy */
-
-#ifdef GL_SGIX_depth_texture
-
-#endif /* GL_SGIX_depth_texture */
-
-#ifdef GL_SGIX_flush_raster
-
-static GLboolean _glewInit_GL_SGIX_flush_raster (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFlushRasterSGIX = (PFNGLFLUSHRASTERSGIXPROC)glewGetProcAddress((const GLubyte*)"glFlushRasterSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIX_flush_raster */
-
-#ifdef GL_SGIX_fog_offset
-
-#endif /* GL_SGIX_fog_offset */
-
-#ifdef GL_SGIX_fog_texture
-
-static GLboolean _glewInit_GL_SGIX_fog_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTextureFogSGIX = (PFNGLTEXTUREFOGSGIXPROC)glewGetProcAddress((const GLubyte*)"glTextureFogSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIX_fog_texture */
-
-#ifdef GL_SGIX_fragment_specular_lighting
-
-static GLboolean _glewInit_GL_SGIX_fragment_specular_lighting (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFragmentColorMaterialSGIX = (PFNGLFRAGMENTCOLORMATERIALSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentColorMaterialSGIX")) == NULL) || r;
- r = ((glFragmentLightModelfSGIX = (PFNGLFRAGMENTLIGHTMODELFSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfSGIX")) == NULL) || r;
- r = ((glFragmentLightModelfvSGIX = (PFNGLFRAGMENTLIGHTMODELFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfvSGIX")) == NULL) || r;
- r = ((glFragmentLightModeliSGIX = (PFNGLFRAGMENTLIGHTMODELISGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModeliSGIX")) == NULL) || r;
- r = ((glFragmentLightModelivSGIX = (PFNGLFRAGMENTLIGHTMODELIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelivSGIX")) == NULL) || r;
- r = ((glFragmentLightfSGIX = (PFNGLFRAGMENTLIGHTFSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfSGIX")) == NULL) || r;
- r = ((glFragmentLightfvSGIX = (PFNGLFRAGMENTLIGHTFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfvSGIX")) == NULL) || r;
- r = ((glFragmentLightiSGIX = (PFNGLFRAGMENTLIGHTISGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightiSGIX")) == NULL) || r;
- r = ((glFragmentLightivSGIX = (PFNGLFRAGMENTLIGHTIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightivSGIX")) == NULL) || r;
- r = ((glFragmentMaterialfSGIX = (PFNGLFRAGMENTMATERIALFSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfSGIX")) == NULL) || r;
- r = ((glFragmentMaterialfvSGIX = (PFNGLFRAGMENTMATERIALFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfvSGIX")) == NULL) || r;
- r = ((glFragmentMaterialiSGIX = (PFNGLFRAGMENTMATERIALISGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialiSGIX")) == NULL) || r;
- r = ((glFragmentMaterialivSGIX = (PFNGLFRAGMENTMATERIALIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialivSGIX")) == NULL) || r;
- r = ((glGetFragmentLightfvSGIX = (PFNGLGETFRAGMENTLIGHTFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightfvSGIX")) == NULL) || r;
- r = ((glGetFragmentLightivSGIX = (PFNGLGETFRAGMENTLIGHTIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightivSGIX")) == NULL) || r;
- r = ((glGetFragmentMaterialfvSGIX = (PFNGLGETFRAGMENTMATERIALFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialfvSGIX")) == NULL) || r;
- r = ((glGetFragmentMaterialivSGIX = (PFNGLGETFRAGMENTMATERIALIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialivSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIX_fragment_specular_lighting */
-
-#ifdef GL_SGIX_framezoom
-
-static GLboolean _glewInit_GL_SGIX_framezoom (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFrameZoomSGIX = (PFNGLFRAMEZOOMSGIXPROC)glewGetProcAddress((const GLubyte*)"glFrameZoomSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIX_framezoom */
-
-#ifdef GL_SGIX_interlace
-
-#endif /* GL_SGIX_interlace */
-
-#ifdef GL_SGIX_ir_instrument1
-
-#endif /* GL_SGIX_ir_instrument1 */
-
-#ifdef GL_SGIX_list_priority
-
-#endif /* GL_SGIX_list_priority */
-
-#ifdef GL_SGIX_pixel_texture
-
-static GLboolean _glewInit_GL_SGIX_pixel_texture (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glPixelTexGenSGIX = (PFNGLPIXELTEXGENSGIXPROC)glewGetProcAddress((const GLubyte*)"glPixelTexGenSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIX_pixel_texture */
-
-#ifdef GL_SGIX_pixel_texture_bits
-
-#endif /* GL_SGIX_pixel_texture_bits */
-
-#ifdef GL_SGIX_reference_plane
-
-static GLboolean _glewInit_GL_SGIX_reference_plane (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glReferencePlaneSGIX = (PFNGLREFERENCEPLANESGIXPROC)glewGetProcAddress((const GLubyte*)"glReferencePlaneSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIX_reference_plane */
-
-#ifdef GL_SGIX_resample
-
-#endif /* GL_SGIX_resample */
-
-#ifdef GL_SGIX_shadow
-
-#endif /* GL_SGIX_shadow */
-
-#ifdef GL_SGIX_shadow_ambient
-
-#endif /* GL_SGIX_shadow_ambient */
-
-#ifdef GL_SGIX_sprite
-
-static GLboolean _glewInit_GL_SGIX_sprite (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glSpriteParameterfSGIX = (PFNGLSPRITEPARAMETERFSGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameterfSGIX")) == NULL) || r;
- r = ((glSpriteParameterfvSGIX = (PFNGLSPRITEPARAMETERFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameterfvSGIX")) == NULL) || r;
- r = ((glSpriteParameteriSGIX = (PFNGLSPRITEPARAMETERISGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameteriSGIX")) == NULL) || r;
- r = ((glSpriteParameterivSGIX = (PFNGLSPRITEPARAMETERIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameterivSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIX_sprite */
-
-#ifdef GL_SGIX_tag_sample_buffer
-
-static GLboolean _glewInit_GL_SGIX_tag_sample_buffer (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glTagSampleBufferSGIX = (PFNGLTAGSAMPLEBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glTagSampleBufferSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGIX_tag_sample_buffer */
-
-#ifdef GL_SGIX_texture_add_env
-
-#endif /* GL_SGIX_texture_add_env */
-
-#ifdef GL_SGIX_texture_coordinate_clamp
-
-#endif /* GL_SGIX_texture_coordinate_clamp */
-
-#ifdef GL_SGIX_texture_lod_bias
-
-#endif /* GL_SGIX_texture_lod_bias */
-
-#ifdef GL_SGIX_texture_multi_buffer
-
-#endif /* GL_SGIX_texture_multi_buffer */
-
-#ifdef GL_SGIX_texture_range
-
-#endif /* GL_SGIX_texture_range */
-
-#ifdef GL_SGIX_texture_scale_bias
-
-#endif /* GL_SGIX_texture_scale_bias */
-
-#ifdef GL_SGIX_vertex_preclip
-
-#endif /* GL_SGIX_vertex_preclip */
-
-#ifdef GL_SGIX_vertex_preclip_hint
-
-#endif /* GL_SGIX_vertex_preclip_hint */
-
-#ifdef GL_SGIX_ycrcb
-
-#endif /* GL_SGIX_ycrcb */
-
-#ifdef GL_SGI_color_matrix
-
-#endif /* GL_SGI_color_matrix */
-
-#ifdef GL_SGI_color_table
-
-static GLboolean _glewInit_GL_SGI_color_table (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glColorTableParameterfvSGI = (PFNGLCOLORTABLEPARAMETERFVSGIPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameterfvSGI")) == NULL) || r;
- r = ((glColorTableParameterivSGI = (PFNGLCOLORTABLEPARAMETERIVSGIPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameterivSGI")) == NULL) || r;
- r = ((glColorTableSGI = (PFNGLCOLORTABLESGIPROC)glewGetProcAddress((const GLubyte*)"glColorTableSGI")) == NULL) || r;
- r = ((glCopyColorTableSGI = (PFNGLCOPYCOLORTABLESGIPROC)glewGetProcAddress((const GLubyte*)"glCopyColorTableSGI")) == NULL) || r;
- r = ((glGetColorTableParameterfvSGI = (PFNGLGETCOLORTABLEPARAMETERFVSGIPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterfvSGI")) == NULL) || r;
- r = ((glGetColorTableParameterivSGI = (PFNGLGETCOLORTABLEPARAMETERIVSGIPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterivSGI")) == NULL) || r;
- r = ((glGetColorTableSGI = (PFNGLGETCOLORTABLESGIPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableSGI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SGI_color_table */
-
-#ifdef GL_SGI_texture_color_table
-
-#endif /* GL_SGI_texture_color_table */
-
-#ifdef GL_SUNX_constant_data
-
-static GLboolean _glewInit_GL_SUNX_constant_data (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glFinishTextureSUNX = (PFNGLFINISHTEXTURESUNXPROC)glewGetProcAddress((const GLubyte*)"glFinishTextureSUNX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SUNX_constant_data */
-
-#ifdef GL_SUN_convolution_border_modes
-
-#endif /* GL_SUN_convolution_border_modes */
-
-#ifdef GL_SUN_global_alpha
-
-static GLboolean _glewInit_GL_SUN_global_alpha (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glGlobalAlphaFactorbSUN = (PFNGLGLOBALALPHAFACTORBSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorbSUN")) == NULL) || r;
- r = ((glGlobalAlphaFactordSUN = (PFNGLGLOBALALPHAFACTORDSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactordSUN")) == NULL) || r;
- r = ((glGlobalAlphaFactorfSUN = (PFNGLGLOBALALPHAFACTORFSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorfSUN")) == NULL) || r;
- r = ((glGlobalAlphaFactoriSUN = (PFNGLGLOBALALPHAFACTORISUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactoriSUN")) == NULL) || r;
- r = ((glGlobalAlphaFactorsSUN = (PFNGLGLOBALALPHAFACTORSSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorsSUN")) == NULL) || r;
- r = ((glGlobalAlphaFactorubSUN = (PFNGLGLOBALALPHAFACTORUBSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorubSUN")) == NULL) || r;
- r = ((glGlobalAlphaFactoruiSUN = (PFNGLGLOBALALPHAFACTORUISUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactoruiSUN")) == NULL) || r;
- r = ((glGlobalAlphaFactorusSUN = (PFNGLGLOBALALPHAFACTORUSSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorusSUN")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SUN_global_alpha */
-
-#ifdef GL_SUN_mesh_array
-
-#endif /* GL_SUN_mesh_array */
-
-#ifdef GL_SUN_read_video_pixels
-
-static GLboolean _glewInit_GL_SUN_read_video_pixels (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glReadVideoPixelsSUN = (PFNGLREADVIDEOPIXELSSUNPROC)glewGetProcAddress((const GLubyte*)"glReadVideoPixelsSUN")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SUN_read_video_pixels */
-
-#ifdef GL_SUN_slice_accum
-
-#endif /* GL_SUN_slice_accum */
-
-#ifdef GL_SUN_triangle_list
-
-static GLboolean _glewInit_GL_SUN_triangle_list (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glReplacementCodePointerSUN = (PFNGLREPLACEMENTCODEPOINTERSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodePointerSUN")) == NULL) || r;
- r = ((glReplacementCodeubSUN = (PFNGLREPLACEMENTCODEUBSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeubSUN")) == NULL) || r;
- r = ((glReplacementCodeubvSUN = (PFNGLREPLACEMENTCODEUBVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeubvSUN")) == NULL) || r;
- r = ((glReplacementCodeuiSUN = (PFNGLREPLACEMENTCODEUISUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiSUN")) == NULL) || r;
- r = ((glReplacementCodeuivSUN = (PFNGLREPLACEMENTCODEUIVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuivSUN")) == NULL) || r;
- r = ((glReplacementCodeusSUN = (PFNGLREPLACEMENTCODEUSSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeusSUN")) == NULL) || r;
- r = ((glReplacementCodeusvSUN = (PFNGLREPLACEMENTCODEUSVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeusvSUN")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SUN_triangle_list */
-
-#ifdef GL_SUN_vertex
-
-static GLboolean _glewInit_GL_SUN_vertex (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glColor3fVertex3fSUN = (PFNGLCOLOR3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor3fVertex3fSUN")) == NULL) || r;
- r = ((glColor3fVertex3fvSUN = (PFNGLCOLOR3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor3fVertex3fvSUN")) == NULL) || r;
- r = ((glColor4fNormal3fVertex3fSUN = (PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4fNormal3fVertex3fSUN")) == NULL) || r;
- r = ((glColor4fNormal3fVertex3fvSUN = (PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4fNormal3fVertex3fvSUN")) == NULL) || r;
- r = ((glColor4ubVertex2fSUN = (PFNGLCOLOR4UBVERTEX2FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex2fSUN")) == NULL) || r;
- r = ((glColor4ubVertex2fvSUN = (PFNGLCOLOR4UBVERTEX2FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex2fvSUN")) == NULL) || r;
- r = ((glColor4ubVertex3fSUN = (PFNGLCOLOR4UBVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex3fSUN")) == NULL) || r;
- r = ((glColor4ubVertex3fvSUN = (PFNGLCOLOR4UBVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex3fvSUN")) == NULL) || r;
- r = ((glNormal3fVertex3fSUN = (PFNGLNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glNormal3fVertex3fSUN")) == NULL) || r;
- r = ((glNormal3fVertex3fvSUN = (PFNGLNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glNormal3fVertex3fvSUN")) == NULL) || r;
- r = ((glReplacementCodeuiColor3fVertex3fSUN = (PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor3fVertex3fSUN")) == NULL) || r;
- r = ((glReplacementCodeuiColor3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor3fVertex3fvSUN")) == NULL) || r;
- r = ((glReplacementCodeuiColor4fNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4fNormal3fVertex3fSUN")) == NULL) || r;
- r = ((glReplacementCodeuiColor4fNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4fNormal3fVertex3fvSUN")) == NULL) || r;
- r = ((glReplacementCodeuiColor4ubVertex3fSUN = (PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4ubVertex3fSUN")) == NULL) || r;
- r = ((glReplacementCodeuiColor4ubVertex3fvSUN = (PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4ubVertex3fvSUN")) == NULL) || r;
- r = ((glReplacementCodeuiNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiNormal3fVertex3fSUN")) == NULL) || r;
- r = ((glReplacementCodeuiNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiNormal3fVertex3fvSUN")) == NULL) || r;
- r = ((glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN")) == NULL) || r;
- r = ((glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN")) == NULL) || r;
- r = ((glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN")) == NULL) || r;
- r = ((glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN")) == NULL) || r;
- r = ((glReplacementCodeuiTexCoord2fVertex3fSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fVertex3fSUN")) == NULL) || r;
- r = ((glReplacementCodeuiTexCoord2fVertex3fvSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fVertex3fvSUN")) == NULL) || r;
- r = ((glReplacementCodeuiVertex3fSUN = (PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiVertex3fSUN")) == NULL) || r;
- r = ((glReplacementCodeuiVertex3fvSUN = (PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiVertex3fvSUN")) == NULL) || r;
- r = ((glTexCoord2fColor3fVertex3fSUN = (PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor3fVertex3fSUN")) == NULL) || r;
- r = ((glTexCoord2fColor3fVertex3fvSUN = (PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor3fVertex3fvSUN")) == NULL) || r;
- r = ((glTexCoord2fColor4fNormal3fVertex3fSUN = (PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4fNormal3fVertex3fSUN")) == NULL) || r;
- r = ((glTexCoord2fColor4fNormal3fVertex3fvSUN = (PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4fNormal3fVertex3fvSUN")) == NULL) || r;
- r = ((glTexCoord2fColor4ubVertex3fSUN = (PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4ubVertex3fSUN")) == NULL) || r;
- r = ((glTexCoord2fColor4ubVertex3fvSUN = (PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4ubVertex3fvSUN")) == NULL) || r;
- r = ((glTexCoord2fNormal3fVertex3fSUN = (PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fNormal3fVertex3fSUN")) == NULL) || r;
- r = ((glTexCoord2fNormal3fVertex3fvSUN = (PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fNormal3fVertex3fvSUN")) == NULL) || r;
- r = ((glTexCoord2fVertex3fSUN = (PFNGLTEXCOORD2FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fVertex3fSUN")) == NULL) || r;
- r = ((glTexCoord2fVertex3fvSUN = (PFNGLTEXCOORD2FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fVertex3fvSUN")) == NULL) || r;
- r = ((glTexCoord4fColor4fNormal3fVertex4fSUN = (PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fColor4fNormal3fVertex4fSUN")) == NULL) || r;
- r = ((glTexCoord4fColor4fNormal3fVertex4fvSUN = (PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fColor4fNormal3fVertex4fvSUN")) == NULL) || r;
- r = ((glTexCoord4fVertex4fSUN = (PFNGLTEXCOORD4FVERTEX4FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fVertex4fSUN")) == NULL) || r;
- r = ((glTexCoord4fVertex4fvSUN = (PFNGLTEXCOORD4FVERTEX4FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fVertex4fvSUN")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_SUN_vertex */
-
-#ifdef GL_WIN_phong_shading
-
-#endif /* GL_WIN_phong_shading */
-
-#ifdef GL_WIN_specular_fog
-
-#endif /* GL_WIN_specular_fog */
-
-#ifdef GL_WIN_swap_hint
-
-static GLboolean _glewInit_GL_WIN_swap_hint (GLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glAddSwapHintRectWIN = (PFNGLADDSWAPHINTRECTWINPROC)glewGetProcAddress((const GLubyte*)"glAddSwapHintRectWIN")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GL_WIN_swap_hint */
-
-/* ------------------------------------------------------------------------- */
-
-GLboolean GLEWAPIENTRY glewGetExtension (const char* name)
-{
-#if GLEW_MX
- GLEWContext *ctx = glewGetContext();
-#endif
- return _glewHashListExists(GLEW_GET_VAR(GLEW_GL_EXTENSIONS), (const GLubyte*)name);
-}
-
-/* ------------------------------------------------------------------------- */
-
-#ifndef GLEW_MX
-static
-#endif
-GLenum GLEWAPIENTRY glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
-{
- const GLubyte* s;
- GLuint dot;
- GLint major, minor;
- GLEWHashList *ext_hashlist;
-
- /* query opengl version */
- s = glGetString(GL_VERSION);
- dot = _glewStrCLen(s, '.');
- if (dot == 0)
- return GLEW_ERROR_NO_GL_VERSION;
-
- major = s[dot-1]-'0';
- minor = s[dot+1]-'0';
-
- if (minor < 0 || minor > 9)
- minor = 0;
- if (major<0 || major>9)
- return GLEW_ERROR_NO_GL_VERSION;
-
-
- if (major == 1 && minor == 0)
- {
- return GLEW_ERROR_GL_VERSION_10_ONLY;
- }
- else
- {
- GLEW_VERSION_4_5 = ( major > 4 ) || ( major == 4 && minor >= 5 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_4_4 = GLEW_VERSION_4_5 == GL_TRUE || ( major == 4 && minor >= 4 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_4_3 = GLEW_VERSION_4_4 == GL_TRUE || ( major == 4 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_4_2 = GLEW_VERSION_4_3 == GL_TRUE || ( major == 4 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_4_1 = GLEW_VERSION_4_2 == GL_TRUE || ( major == 4 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_4_0 = GLEW_VERSION_4_1 == GL_TRUE || ( major == 4 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_3_3 = GLEW_VERSION_4_0 == GL_TRUE || ( major == 3 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_3_2 = GLEW_VERSION_3_3 == GL_TRUE || ( major == 3 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_3_1 = GLEW_VERSION_3_2 == GL_TRUE || ( major == 3 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_3_0 = GLEW_VERSION_3_1 == GL_TRUE || ( major == 3 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_2_1 = GLEW_VERSION_3_0 == GL_TRUE || ( major == 2 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_2_0 = GLEW_VERSION_2_1 == GL_TRUE || ( major == 2 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_1_5 = GLEW_VERSION_2_0 == GL_TRUE || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_1_4 = GLEW_VERSION_1_5 == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_1_3 = GLEW_VERSION_1_4 == GL_TRUE || ( major == 1 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_1_2_1 = GLEW_VERSION_1_3 == GL_TRUE ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_1_2 = GLEW_VERSION_1_2_1 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
- GLEW_VERSION_1_1 = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
- }
-
- /* query opengl extensions string */
- GLEW_GET_VAR(GLEW_GL_EXTENSIONS) = calloc(1, sizeof(GLEWHashList));
-
- ext_hashlist = GLEW_GET_VAR(GLEW_GL_EXTENSIONS);
-
- if (major >= 3)
- {
- _glewBuildGL3ExtensionList(ext_hashlist);
- }
- else
- {
- const GLubyte* extensions = glGetString(GL_EXTENSIONS);
- _glewBuildHashListFromString(extensions, ext_hashlist);
- }
-
- /* initialize extensions */
-#ifdef GL_VERSION_1_2
- if (glewExperimental || GLEW_VERSION_1_2) GLEW_VERSION_1_2 = !_glewInit_GL_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_VERSION_1_2 */
-#ifdef GL_VERSION_1_2_1
-#endif /* GL_VERSION_1_2_1 */
-#ifdef GL_VERSION_1_3
- if (glewExperimental || GLEW_VERSION_1_3) GLEW_VERSION_1_3 = !_glewInit_GL_VERSION_1_3(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_VERSION_1_3 */
-#ifdef GL_VERSION_1_4
- if (glewExperimental || GLEW_VERSION_1_4) GLEW_VERSION_1_4 = !_glewInit_GL_VERSION_1_4(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_VERSION_1_4 */
-#ifdef GL_VERSION_1_5
- if (glewExperimental || GLEW_VERSION_1_5) GLEW_VERSION_1_5 = !_glewInit_GL_VERSION_1_5(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_VERSION_1_5 */
-#ifdef GL_VERSION_2_0
- if (glewExperimental || GLEW_VERSION_2_0) GLEW_VERSION_2_0 = !_glewInit_GL_VERSION_2_0(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_VERSION_2_0 */
-#ifdef GL_VERSION_2_1
- if (glewExperimental || GLEW_VERSION_2_1) GLEW_VERSION_2_1 = !_glewInit_GL_VERSION_2_1(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_VERSION_2_1 */
-#ifdef GL_VERSION_3_0
- if (glewExperimental || GLEW_VERSION_3_0) GLEW_VERSION_3_0 = !_glewInit_GL_VERSION_3_0(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_VERSION_3_0 */
-#ifdef GL_VERSION_3_1
- if (glewExperimental || GLEW_VERSION_3_1) GLEW_VERSION_3_1 = !_glewInit_GL_VERSION_3_1(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_VERSION_3_1 */
-#ifdef GL_VERSION_3_2
- if (glewExperimental || GLEW_VERSION_3_2) GLEW_VERSION_3_2 = !_glewInit_GL_VERSION_3_2(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_VERSION_3_2 */
-#ifdef GL_VERSION_3_3
- if (glewExperimental || GLEW_VERSION_3_3) GLEW_VERSION_3_3 = !_glewInit_GL_VERSION_3_3(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_VERSION_3_3 */
-#ifdef GL_VERSION_4_0
- if (glewExperimental || GLEW_VERSION_4_0) GLEW_VERSION_4_0 = !_glewInit_GL_VERSION_4_0(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_VERSION_4_0 */
-#ifdef GL_VERSION_4_1
-#endif /* GL_VERSION_4_1 */
-#ifdef GL_VERSION_4_2
-#endif /* GL_VERSION_4_2 */
-#ifdef GL_VERSION_4_3
-#endif /* GL_VERSION_4_3 */
-#ifdef GL_VERSION_4_4
-#endif /* GL_VERSION_4_4 */
-#ifdef GL_VERSION_4_5
-#endif /* GL_VERSION_4_5 */
-#ifdef GL_3DFX_multisample
- GLEW_3DFX_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_3DFX_multisample");
-#endif /* GL_3DFX_multisample */
-#ifdef GL_3DFX_tbuffer
- GLEW_3DFX_tbuffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_3DFX_tbuffer");
- if (glewExperimental || GLEW_3DFX_tbuffer) GLEW_3DFX_tbuffer = !_glewInit_GL_3DFX_tbuffer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_3DFX_tbuffer */
-#ifdef GL_3DFX_texture_compression_FXT1
- GLEW_3DFX_texture_compression_FXT1 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_3DFX_texture_compression_FXT1");
-#endif /* GL_3DFX_texture_compression_FXT1 */
-#ifdef GL_AMD_blend_minmax_factor
- GLEW_AMD_blend_minmax_factor = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_blend_minmax_factor");
-#endif /* GL_AMD_blend_minmax_factor */
-#ifdef GL_AMD_conservative_depth
- GLEW_AMD_conservative_depth = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_conservative_depth");
-#endif /* GL_AMD_conservative_depth */
-#ifdef GL_AMD_debug_output
- GLEW_AMD_debug_output = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_debug_output");
- if (glewExperimental || GLEW_AMD_debug_output) GLEW_AMD_debug_output = !_glewInit_GL_AMD_debug_output(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_AMD_debug_output */
-#ifdef GL_AMD_depth_clamp_separate
- GLEW_AMD_depth_clamp_separate = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_depth_clamp_separate");
-#endif /* GL_AMD_depth_clamp_separate */
-#ifdef GL_AMD_draw_buffers_blend
- GLEW_AMD_draw_buffers_blend = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_draw_buffers_blend");
- if (glewExperimental || GLEW_AMD_draw_buffers_blend) GLEW_AMD_draw_buffers_blend = !_glewInit_GL_AMD_draw_buffers_blend(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_AMD_draw_buffers_blend */
-#ifdef GL_AMD_gcn_shader
- GLEW_AMD_gcn_shader = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_gcn_shader");
-#endif /* GL_AMD_gcn_shader */
-#ifdef GL_AMD_gpu_shader_int64
- GLEW_AMD_gpu_shader_int64 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_gpu_shader_int64");
-#endif /* GL_AMD_gpu_shader_int64 */
-#ifdef GL_AMD_interleaved_elements
- GLEW_AMD_interleaved_elements = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_interleaved_elements");
- if (glewExperimental || GLEW_AMD_interleaved_elements) GLEW_AMD_interleaved_elements = !_glewInit_GL_AMD_interleaved_elements(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_AMD_interleaved_elements */
-#ifdef GL_AMD_multi_draw_indirect
- GLEW_AMD_multi_draw_indirect = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_multi_draw_indirect");
- if (glewExperimental || GLEW_AMD_multi_draw_indirect) GLEW_AMD_multi_draw_indirect = !_glewInit_GL_AMD_multi_draw_indirect(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_AMD_multi_draw_indirect */
-#ifdef GL_AMD_name_gen_delete
- GLEW_AMD_name_gen_delete = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_name_gen_delete");
- if (glewExperimental || GLEW_AMD_name_gen_delete) GLEW_AMD_name_gen_delete = !_glewInit_GL_AMD_name_gen_delete(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_AMD_name_gen_delete */
-#ifdef GL_AMD_occlusion_query_event
- GLEW_AMD_occlusion_query_event = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_occlusion_query_event");
- if (glewExperimental || GLEW_AMD_occlusion_query_event) GLEW_AMD_occlusion_query_event = !_glewInit_GL_AMD_occlusion_query_event(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_AMD_occlusion_query_event */
-#ifdef GL_AMD_performance_monitor
- GLEW_AMD_performance_monitor = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_performance_monitor");
- if (glewExperimental || GLEW_AMD_performance_monitor) GLEW_AMD_performance_monitor = !_glewInit_GL_AMD_performance_monitor(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_AMD_performance_monitor */
-#ifdef GL_AMD_pinned_memory
- GLEW_AMD_pinned_memory = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_pinned_memory");
-#endif /* GL_AMD_pinned_memory */
-#ifdef GL_AMD_query_buffer_object
- GLEW_AMD_query_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_query_buffer_object");
-#endif /* GL_AMD_query_buffer_object */
-#ifdef GL_AMD_sample_positions
- GLEW_AMD_sample_positions = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_sample_positions");
- if (glewExperimental || GLEW_AMD_sample_positions) GLEW_AMD_sample_positions = !_glewInit_GL_AMD_sample_positions(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_AMD_sample_positions */
-#ifdef GL_AMD_seamless_cubemap_per_texture
- GLEW_AMD_seamless_cubemap_per_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_seamless_cubemap_per_texture");
-#endif /* GL_AMD_seamless_cubemap_per_texture */
-#ifdef GL_AMD_shader_atomic_counter_ops
- GLEW_AMD_shader_atomic_counter_ops = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_shader_atomic_counter_ops");
-#endif /* GL_AMD_shader_atomic_counter_ops */
-#ifdef GL_AMD_shader_stencil_export
- GLEW_AMD_shader_stencil_export = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_shader_stencil_export");
-#endif /* GL_AMD_shader_stencil_export */
-#ifdef GL_AMD_shader_stencil_value_export
- GLEW_AMD_shader_stencil_value_export = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_shader_stencil_value_export");
-#endif /* GL_AMD_shader_stencil_value_export */
-#ifdef GL_AMD_shader_trinary_minmax
- GLEW_AMD_shader_trinary_minmax = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_shader_trinary_minmax");
-#endif /* GL_AMD_shader_trinary_minmax */
-#ifdef GL_AMD_sparse_texture
- GLEW_AMD_sparse_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_sparse_texture");
- if (glewExperimental || GLEW_AMD_sparse_texture) GLEW_AMD_sparse_texture = !_glewInit_GL_AMD_sparse_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_AMD_sparse_texture */
-#ifdef GL_AMD_stencil_operation_extended
- GLEW_AMD_stencil_operation_extended = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_stencil_operation_extended");
- if (glewExperimental || GLEW_AMD_stencil_operation_extended) GLEW_AMD_stencil_operation_extended = !_glewInit_GL_AMD_stencil_operation_extended(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_AMD_stencil_operation_extended */
-#ifdef GL_AMD_texture_texture4
- GLEW_AMD_texture_texture4 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_texture_texture4");
-#endif /* GL_AMD_texture_texture4 */
-#ifdef GL_AMD_transform_feedback3_lines_triangles
- GLEW_AMD_transform_feedback3_lines_triangles = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_transform_feedback3_lines_triangles");
-#endif /* GL_AMD_transform_feedback3_lines_triangles */
-#ifdef GL_AMD_transform_feedback4
- GLEW_AMD_transform_feedback4 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_transform_feedback4");
-#endif /* GL_AMD_transform_feedback4 */
-#ifdef GL_AMD_vertex_shader_layer
- GLEW_AMD_vertex_shader_layer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_vertex_shader_layer");
-#endif /* GL_AMD_vertex_shader_layer */
-#ifdef GL_AMD_vertex_shader_tessellator
- GLEW_AMD_vertex_shader_tessellator = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_vertex_shader_tessellator");
- if (glewExperimental || GLEW_AMD_vertex_shader_tessellator) GLEW_AMD_vertex_shader_tessellator = !_glewInit_GL_AMD_vertex_shader_tessellator(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_AMD_vertex_shader_tessellator */
-#ifdef GL_AMD_vertex_shader_viewport_index
- GLEW_AMD_vertex_shader_viewport_index = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_AMD_vertex_shader_viewport_index");
-#endif /* GL_AMD_vertex_shader_viewport_index */
-#ifdef GL_ANGLE_depth_texture
- GLEW_ANGLE_depth_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ANGLE_depth_texture");
-#endif /* GL_ANGLE_depth_texture */
-#ifdef GL_ANGLE_framebuffer_blit
- GLEW_ANGLE_framebuffer_blit = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ANGLE_framebuffer_blit");
- if (glewExperimental || GLEW_ANGLE_framebuffer_blit) GLEW_ANGLE_framebuffer_blit = !_glewInit_GL_ANGLE_framebuffer_blit(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ANGLE_framebuffer_blit */
-#ifdef GL_ANGLE_framebuffer_multisample
- GLEW_ANGLE_framebuffer_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ANGLE_framebuffer_multisample");
- if (glewExperimental || GLEW_ANGLE_framebuffer_multisample) GLEW_ANGLE_framebuffer_multisample = !_glewInit_GL_ANGLE_framebuffer_multisample(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ANGLE_framebuffer_multisample */
-#ifdef GL_ANGLE_instanced_arrays
- GLEW_ANGLE_instanced_arrays = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ANGLE_instanced_arrays");
- if (glewExperimental || GLEW_ANGLE_instanced_arrays) GLEW_ANGLE_instanced_arrays = !_glewInit_GL_ANGLE_instanced_arrays(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ANGLE_instanced_arrays */
-#ifdef GL_ANGLE_pack_reverse_row_order
- GLEW_ANGLE_pack_reverse_row_order = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ANGLE_pack_reverse_row_order");
-#endif /* GL_ANGLE_pack_reverse_row_order */
-#ifdef GL_ANGLE_program_binary
- GLEW_ANGLE_program_binary = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ANGLE_program_binary");
-#endif /* GL_ANGLE_program_binary */
-#ifdef GL_ANGLE_texture_compression_dxt1
- GLEW_ANGLE_texture_compression_dxt1 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ANGLE_texture_compression_dxt1");
-#endif /* GL_ANGLE_texture_compression_dxt1 */
-#ifdef GL_ANGLE_texture_compression_dxt3
- GLEW_ANGLE_texture_compression_dxt3 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ANGLE_texture_compression_dxt3");
-#endif /* GL_ANGLE_texture_compression_dxt3 */
-#ifdef GL_ANGLE_texture_compression_dxt5
- GLEW_ANGLE_texture_compression_dxt5 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ANGLE_texture_compression_dxt5");
-#endif /* GL_ANGLE_texture_compression_dxt5 */
-#ifdef GL_ANGLE_texture_usage
- GLEW_ANGLE_texture_usage = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ANGLE_texture_usage");
-#endif /* GL_ANGLE_texture_usage */
-#ifdef GL_ANGLE_timer_query
- GLEW_ANGLE_timer_query = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ANGLE_timer_query");
- if (glewExperimental || GLEW_ANGLE_timer_query) GLEW_ANGLE_timer_query = !_glewInit_GL_ANGLE_timer_query(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ANGLE_timer_query */
-#ifdef GL_ANGLE_translated_shader_source
- GLEW_ANGLE_translated_shader_source = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ANGLE_translated_shader_source");
- if (glewExperimental || GLEW_ANGLE_translated_shader_source) GLEW_ANGLE_translated_shader_source = !_glewInit_GL_ANGLE_translated_shader_source(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ANGLE_translated_shader_source */
-#ifdef GL_APPLE_aux_depth_stencil
- GLEW_APPLE_aux_depth_stencil = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_aux_depth_stencil");
-#endif /* GL_APPLE_aux_depth_stencil */
-#ifdef GL_APPLE_client_storage
- GLEW_APPLE_client_storage = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_client_storage");
-#endif /* GL_APPLE_client_storage */
-#ifdef GL_APPLE_element_array
- GLEW_APPLE_element_array = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_element_array");
- if (glewExperimental || GLEW_APPLE_element_array) GLEW_APPLE_element_array = !_glewInit_GL_APPLE_element_array(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_APPLE_element_array */
-#ifdef GL_APPLE_fence
- GLEW_APPLE_fence = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_fence");
- if (glewExperimental || GLEW_APPLE_fence) GLEW_APPLE_fence = !_glewInit_GL_APPLE_fence(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_APPLE_fence */
-#ifdef GL_APPLE_float_pixels
- GLEW_APPLE_float_pixels = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_float_pixels");
-#endif /* GL_APPLE_float_pixels */
-#ifdef GL_APPLE_flush_buffer_range
- GLEW_APPLE_flush_buffer_range = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_flush_buffer_range");
- if (glewExperimental || GLEW_APPLE_flush_buffer_range) GLEW_APPLE_flush_buffer_range = !_glewInit_GL_APPLE_flush_buffer_range(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_APPLE_flush_buffer_range */
-#ifdef GL_APPLE_object_purgeable
- GLEW_APPLE_object_purgeable = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_object_purgeable");
- if (glewExperimental || GLEW_APPLE_object_purgeable) GLEW_APPLE_object_purgeable = !_glewInit_GL_APPLE_object_purgeable(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_APPLE_object_purgeable */
-#ifdef GL_APPLE_pixel_buffer
- GLEW_APPLE_pixel_buffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_pixel_buffer");
-#endif /* GL_APPLE_pixel_buffer */
-#ifdef GL_APPLE_rgb_422
- GLEW_APPLE_rgb_422 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_rgb_422");
-#endif /* GL_APPLE_rgb_422 */
-#ifdef GL_APPLE_row_bytes
- GLEW_APPLE_row_bytes = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_row_bytes");
-#endif /* GL_APPLE_row_bytes */
-#ifdef GL_APPLE_specular_vector
- GLEW_APPLE_specular_vector = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_specular_vector");
-#endif /* GL_APPLE_specular_vector */
-#ifdef GL_APPLE_texture_range
- GLEW_APPLE_texture_range = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_texture_range");
- if (glewExperimental || GLEW_APPLE_texture_range) GLEW_APPLE_texture_range = !_glewInit_GL_APPLE_texture_range(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_APPLE_texture_range */
-#ifdef GL_APPLE_transform_hint
- GLEW_APPLE_transform_hint = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_transform_hint");
-#endif /* GL_APPLE_transform_hint */
-#ifdef GL_APPLE_vertex_array_object
- GLEW_APPLE_vertex_array_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_vertex_array_object");
- if (glewExperimental || GLEW_APPLE_vertex_array_object) GLEW_APPLE_vertex_array_object = !_glewInit_GL_APPLE_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_APPLE_vertex_array_object */
-#ifdef GL_APPLE_vertex_array_range
- GLEW_APPLE_vertex_array_range = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_vertex_array_range");
- if (glewExperimental || GLEW_APPLE_vertex_array_range) GLEW_APPLE_vertex_array_range = !_glewInit_GL_APPLE_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_APPLE_vertex_array_range */
-#ifdef GL_APPLE_vertex_program_evaluators
- GLEW_APPLE_vertex_program_evaluators = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_vertex_program_evaluators");
- if (glewExperimental || GLEW_APPLE_vertex_program_evaluators) GLEW_APPLE_vertex_program_evaluators = !_glewInit_GL_APPLE_vertex_program_evaluators(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_APPLE_vertex_program_evaluators */
-#ifdef GL_APPLE_ycbcr_422
- GLEW_APPLE_ycbcr_422 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_APPLE_ycbcr_422");
-#endif /* GL_APPLE_ycbcr_422 */
-#ifdef GL_ARB_ES2_compatibility
- GLEW_ARB_ES2_compatibility = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_ES2_compatibility");
- if (glewExperimental || GLEW_ARB_ES2_compatibility) GLEW_ARB_ES2_compatibility = !_glewInit_GL_ARB_ES2_compatibility(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_ES2_compatibility */
-#ifdef GL_ARB_ES3_1_compatibility
- GLEW_ARB_ES3_1_compatibility = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_ES3_1_compatibility");
- if (glewExperimental || GLEW_ARB_ES3_1_compatibility) GLEW_ARB_ES3_1_compatibility = !_glewInit_GL_ARB_ES3_1_compatibility(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_ES3_1_compatibility */
-#ifdef GL_ARB_ES3_compatibility
- GLEW_ARB_ES3_compatibility = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_ES3_compatibility");
-#endif /* GL_ARB_ES3_compatibility */
-#ifdef GL_ARB_arrays_of_arrays
- GLEW_ARB_arrays_of_arrays = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_arrays_of_arrays");
-#endif /* GL_ARB_arrays_of_arrays */
-#ifdef GL_ARB_base_instance
- GLEW_ARB_base_instance = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_base_instance");
- if (glewExperimental || GLEW_ARB_base_instance) GLEW_ARB_base_instance = !_glewInit_GL_ARB_base_instance(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_base_instance */
-#ifdef GL_ARB_bindless_texture
- GLEW_ARB_bindless_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_bindless_texture");
- if (glewExperimental || GLEW_ARB_bindless_texture) GLEW_ARB_bindless_texture = !_glewInit_GL_ARB_bindless_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_bindless_texture */
-#ifdef GL_ARB_blend_func_extended
- GLEW_ARB_blend_func_extended = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_blend_func_extended");
- if (glewExperimental || GLEW_ARB_blend_func_extended) GLEW_ARB_blend_func_extended = !_glewInit_GL_ARB_blend_func_extended(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_blend_func_extended */
-#ifdef GL_ARB_buffer_storage
- GLEW_ARB_buffer_storage = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_buffer_storage");
- if (glewExperimental || GLEW_ARB_buffer_storage) GLEW_ARB_buffer_storage = !_glewInit_GL_ARB_buffer_storage(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_buffer_storage */
-#ifdef GL_ARB_cl_event
- GLEW_ARB_cl_event = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_cl_event");
- if (glewExperimental || GLEW_ARB_cl_event) GLEW_ARB_cl_event = !_glewInit_GL_ARB_cl_event(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_cl_event */
-#ifdef GL_ARB_clear_buffer_object
- GLEW_ARB_clear_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_clear_buffer_object");
- if (glewExperimental || GLEW_ARB_clear_buffer_object) GLEW_ARB_clear_buffer_object = !_glewInit_GL_ARB_clear_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_clear_buffer_object */
-#ifdef GL_ARB_clear_texture
- GLEW_ARB_clear_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_clear_texture");
- if (glewExperimental || GLEW_ARB_clear_texture) GLEW_ARB_clear_texture = !_glewInit_GL_ARB_clear_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_clear_texture */
-#ifdef GL_ARB_clip_control
- GLEW_ARB_clip_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_clip_control");
- if (glewExperimental || GLEW_ARB_clip_control) GLEW_ARB_clip_control = !_glewInit_GL_ARB_clip_control(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_clip_control */
-#ifdef GL_ARB_color_buffer_float
- GLEW_ARB_color_buffer_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_color_buffer_float");
- if (glewExperimental || GLEW_ARB_color_buffer_float) GLEW_ARB_color_buffer_float = !_glewInit_GL_ARB_color_buffer_float(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_color_buffer_float */
-#ifdef GL_ARB_compatibility
- GLEW_ARB_compatibility = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_compatibility");
-#endif /* GL_ARB_compatibility */
-#ifdef GL_ARB_compressed_texture_pixel_storage
- GLEW_ARB_compressed_texture_pixel_storage = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_compressed_texture_pixel_storage");
-#endif /* GL_ARB_compressed_texture_pixel_storage */
-#ifdef GL_ARB_compute_shader
- GLEW_ARB_compute_shader = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_compute_shader");
- if (glewExperimental || GLEW_ARB_compute_shader) GLEW_ARB_compute_shader = !_glewInit_GL_ARB_compute_shader(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_compute_shader */
-#ifdef GL_ARB_compute_variable_group_size
- GLEW_ARB_compute_variable_group_size = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_compute_variable_group_size");
- if (glewExperimental || GLEW_ARB_compute_variable_group_size) GLEW_ARB_compute_variable_group_size = !_glewInit_GL_ARB_compute_variable_group_size(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_compute_variable_group_size */
-#ifdef GL_ARB_conditional_render_inverted
- GLEW_ARB_conditional_render_inverted = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_conditional_render_inverted");
-#endif /* GL_ARB_conditional_render_inverted */
-#ifdef GL_ARB_conservative_depth
- GLEW_ARB_conservative_depth = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_conservative_depth");
-#endif /* GL_ARB_conservative_depth */
-#ifdef GL_ARB_copy_buffer
- GLEW_ARB_copy_buffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_copy_buffer");
- if (glewExperimental || GLEW_ARB_copy_buffer) GLEW_ARB_copy_buffer = !_glewInit_GL_ARB_copy_buffer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_copy_buffer */
-#ifdef GL_ARB_copy_image
- GLEW_ARB_copy_image = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_copy_image");
- if (glewExperimental || GLEW_ARB_copy_image) GLEW_ARB_copy_image = !_glewInit_GL_ARB_copy_image(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_copy_image */
-#ifdef GL_ARB_cull_distance
- GLEW_ARB_cull_distance = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_cull_distance");
-#endif /* GL_ARB_cull_distance */
-#ifdef GL_ARB_debug_output
- GLEW_ARB_debug_output = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_debug_output");
- if (glewExperimental || GLEW_ARB_debug_output) GLEW_ARB_debug_output = !_glewInit_GL_ARB_debug_output(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_debug_output */
-#ifdef GL_ARB_depth_buffer_float
- GLEW_ARB_depth_buffer_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_depth_buffer_float");
-#endif /* GL_ARB_depth_buffer_float */
-#ifdef GL_ARB_depth_clamp
- GLEW_ARB_depth_clamp = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_depth_clamp");
-#endif /* GL_ARB_depth_clamp */
-#ifdef GL_ARB_depth_texture
- GLEW_ARB_depth_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_depth_texture");
-#endif /* GL_ARB_depth_texture */
-#ifdef GL_ARB_derivative_control
- GLEW_ARB_derivative_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_derivative_control");
-#endif /* GL_ARB_derivative_control */
-#ifdef GL_ARB_direct_state_access
- GLEW_ARB_direct_state_access = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_direct_state_access");
- if (glewExperimental || GLEW_ARB_direct_state_access) GLEW_ARB_direct_state_access = !_glewInit_GL_ARB_direct_state_access(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_direct_state_access */
-#ifdef GL_ARB_draw_buffers
- GLEW_ARB_draw_buffers = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_draw_buffers");
- if (glewExperimental || GLEW_ARB_draw_buffers) GLEW_ARB_draw_buffers = !_glewInit_GL_ARB_draw_buffers(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_draw_buffers */
-#ifdef GL_ARB_draw_buffers_blend
- GLEW_ARB_draw_buffers_blend = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_draw_buffers_blend");
- if (glewExperimental || GLEW_ARB_draw_buffers_blend) GLEW_ARB_draw_buffers_blend = !_glewInit_GL_ARB_draw_buffers_blend(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_draw_buffers_blend */
-#ifdef GL_ARB_draw_elements_base_vertex
- GLEW_ARB_draw_elements_base_vertex = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_draw_elements_base_vertex");
- if (glewExperimental || GLEW_ARB_draw_elements_base_vertex) GLEW_ARB_draw_elements_base_vertex = !_glewInit_GL_ARB_draw_elements_base_vertex(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_draw_elements_base_vertex */
-#ifdef GL_ARB_draw_indirect
- GLEW_ARB_draw_indirect = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_draw_indirect");
- if (glewExperimental || GLEW_ARB_draw_indirect) GLEW_ARB_draw_indirect = !_glewInit_GL_ARB_draw_indirect(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_draw_indirect */
-#ifdef GL_ARB_draw_instanced
- GLEW_ARB_draw_instanced = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_draw_instanced");
-#endif /* GL_ARB_draw_instanced */
-#ifdef GL_ARB_enhanced_layouts
- GLEW_ARB_enhanced_layouts = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_enhanced_layouts");
-#endif /* GL_ARB_enhanced_layouts */
-#ifdef GL_ARB_explicit_attrib_location
- GLEW_ARB_explicit_attrib_location = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_explicit_attrib_location");
-#endif /* GL_ARB_explicit_attrib_location */
-#ifdef GL_ARB_explicit_uniform_location
- GLEW_ARB_explicit_uniform_location = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_explicit_uniform_location");
-#endif /* GL_ARB_explicit_uniform_location */
-#ifdef GL_ARB_fragment_coord_conventions
- GLEW_ARB_fragment_coord_conventions = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_fragment_coord_conventions");
-#endif /* GL_ARB_fragment_coord_conventions */
-#ifdef GL_ARB_fragment_layer_viewport
- GLEW_ARB_fragment_layer_viewport = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_fragment_layer_viewport");
-#endif /* GL_ARB_fragment_layer_viewport */
-#ifdef GL_ARB_fragment_program
- GLEW_ARB_fragment_program = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_fragment_program");
-#endif /* GL_ARB_fragment_program */
-#ifdef GL_ARB_fragment_program_shadow
- GLEW_ARB_fragment_program_shadow = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_fragment_program_shadow");
-#endif /* GL_ARB_fragment_program_shadow */
-#ifdef GL_ARB_fragment_shader
- GLEW_ARB_fragment_shader = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_fragment_shader");
-#endif /* GL_ARB_fragment_shader */
-#ifdef GL_ARB_framebuffer_no_attachments
- GLEW_ARB_framebuffer_no_attachments = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_framebuffer_no_attachments");
- if (glewExperimental || GLEW_ARB_framebuffer_no_attachments) GLEW_ARB_framebuffer_no_attachments = !_glewInit_GL_ARB_framebuffer_no_attachments(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_framebuffer_no_attachments */
-#ifdef GL_ARB_framebuffer_object
- GLEW_ARB_framebuffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_framebuffer_object");
- if (glewExperimental || GLEW_ARB_framebuffer_object) GLEW_ARB_framebuffer_object = !_glewInit_GL_ARB_framebuffer_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_framebuffer_object */
-#ifdef GL_ARB_framebuffer_sRGB
- GLEW_ARB_framebuffer_sRGB = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_framebuffer_sRGB");
-#endif /* GL_ARB_framebuffer_sRGB */
-#ifdef GL_ARB_geometry_shader4
- GLEW_ARB_geometry_shader4 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_geometry_shader4");
- if (glewExperimental || GLEW_ARB_geometry_shader4) GLEW_ARB_geometry_shader4 = !_glewInit_GL_ARB_geometry_shader4(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_geometry_shader4 */
-#ifdef GL_ARB_get_program_binary
- GLEW_ARB_get_program_binary = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_get_program_binary");
- if (glewExperimental || GLEW_ARB_get_program_binary) GLEW_ARB_get_program_binary = !_glewInit_GL_ARB_get_program_binary(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_get_program_binary */
-#ifdef GL_ARB_get_texture_sub_image
- GLEW_ARB_get_texture_sub_image = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_get_texture_sub_image");
- if (glewExperimental || GLEW_ARB_get_texture_sub_image) GLEW_ARB_get_texture_sub_image = !_glewInit_GL_ARB_get_texture_sub_image(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_get_texture_sub_image */
-#ifdef GL_ARB_gpu_shader5
- GLEW_ARB_gpu_shader5 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_gpu_shader5");
-#endif /* GL_ARB_gpu_shader5 */
-#ifdef GL_ARB_gpu_shader_fp64
- GLEW_ARB_gpu_shader_fp64 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_gpu_shader_fp64");
- if (glewExperimental || GLEW_ARB_gpu_shader_fp64) GLEW_ARB_gpu_shader_fp64 = !_glewInit_GL_ARB_gpu_shader_fp64(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_gpu_shader_fp64 */
-#ifdef GL_ARB_half_float_pixel
- GLEW_ARB_half_float_pixel = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_half_float_pixel");
-#endif /* GL_ARB_half_float_pixel */
-#ifdef GL_ARB_half_float_vertex
- GLEW_ARB_half_float_vertex = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_half_float_vertex");
-#endif /* GL_ARB_half_float_vertex */
-#ifdef GL_ARB_imaging
- GLEW_ARB_imaging = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_imaging");
- if (glewExperimental || GLEW_ARB_imaging) GLEW_ARB_imaging = !_glewInit_GL_ARB_imaging(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_imaging */
-#ifdef GL_ARB_indirect_parameters
- GLEW_ARB_indirect_parameters = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_indirect_parameters");
- if (glewExperimental || GLEW_ARB_indirect_parameters) GLEW_ARB_indirect_parameters = !_glewInit_GL_ARB_indirect_parameters(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_indirect_parameters */
-#ifdef GL_ARB_instanced_arrays
- GLEW_ARB_instanced_arrays = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_instanced_arrays");
- if (glewExperimental || GLEW_ARB_instanced_arrays) GLEW_ARB_instanced_arrays = !_glewInit_GL_ARB_instanced_arrays(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_instanced_arrays */
-#ifdef GL_ARB_internalformat_query
- GLEW_ARB_internalformat_query = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_internalformat_query");
- if (glewExperimental || GLEW_ARB_internalformat_query) GLEW_ARB_internalformat_query = !_glewInit_GL_ARB_internalformat_query(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_internalformat_query */
-#ifdef GL_ARB_internalformat_query2
- GLEW_ARB_internalformat_query2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_internalformat_query2");
- if (glewExperimental || GLEW_ARB_internalformat_query2) GLEW_ARB_internalformat_query2 = !_glewInit_GL_ARB_internalformat_query2(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_internalformat_query2 */
-#ifdef GL_ARB_invalidate_subdata
- GLEW_ARB_invalidate_subdata = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_invalidate_subdata");
- if (glewExperimental || GLEW_ARB_invalidate_subdata) GLEW_ARB_invalidate_subdata = !_glewInit_GL_ARB_invalidate_subdata(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_invalidate_subdata */
-#ifdef GL_ARB_map_buffer_alignment
- GLEW_ARB_map_buffer_alignment = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_map_buffer_alignment");
-#endif /* GL_ARB_map_buffer_alignment */
-#ifdef GL_ARB_map_buffer_range
- GLEW_ARB_map_buffer_range = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_map_buffer_range");
- if (glewExperimental || GLEW_ARB_map_buffer_range) GLEW_ARB_map_buffer_range = !_glewInit_GL_ARB_map_buffer_range(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_map_buffer_range */
-#ifdef GL_ARB_matrix_palette
- GLEW_ARB_matrix_palette = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_matrix_palette");
- if (glewExperimental || GLEW_ARB_matrix_palette) GLEW_ARB_matrix_palette = !_glewInit_GL_ARB_matrix_palette(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_matrix_palette */
-#ifdef GL_ARB_multi_bind
- GLEW_ARB_multi_bind = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_multi_bind");
- if (glewExperimental || GLEW_ARB_multi_bind) GLEW_ARB_multi_bind = !_glewInit_GL_ARB_multi_bind(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_multi_bind */
-#ifdef GL_ARB_multi_draw_indirect
- GLEW_ARB_multi_draw_indirect = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_multi_draw_indirect");
- if (glewExperimental || GLEW_ARB_multi_draw_indirect) GLEW_ARB_multi_draw_indirect = !_glewInit_GL_ARB_multi_draw_indirect(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_multi_draw_indirect */
-#ifdef GL_ARB_multisample
- GLEW_ARB_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_multisample");
- if (glewExperimental || GLEW_ARB_multisample) GLEW_ARB_multisample = !_glewInit_GL_ARB_multisample(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_multisample */
-#ifdef GL_ARB_multitexture
- GLEW_ARB_multitexture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_multitexture");
- if (glewExperimental || GLEW_ARB_multitexture) GLEW_ARB_multitexture = !_glewInit_GL_ARB_multitexture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_multitexture */
-#ifdef GL_ARB_occlusion_query
- GLEW_ARB_occlusion_query = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_occlusion_query");
- if (glewExperimental || GLEW_ARB_occlusion_query) GLEW_ARB_occlusion_query = !_glewInit_GL_ARB_occlusion_query(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_occlusion_query */
-#ifdef GL_ARB_occlusion_query2
- GLEW_ARB_occlusion_query2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_occlusion_query2");
-#endif /* GL_ARB_occlusion_query2 */
-#ifdef GL_ARB_pipeline_statistics_query
- GLEW_ARB_pipeline_statistics_query = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_pipeline_statistics_query");
-#endif /* GL_ARB_pipeline_statistics_query */
-#ifdef GL_ARB_pixel_buffer_object
- GLEW_ARB_pixel_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_pixel_buffer_object");
-#endif /* GL_ARB_pixel_buffer_object */
-#ifdef GL_ARB_point_parameters
- GLEW_ARB_point_parameters = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_point_parameters");
- if (glewExperimental || GLEW_ARB_point_parameters) GLEW_ARB_point_parameters = !_glewInit_GL_ARB_point_parameters(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_point_parameters */
-#ifdef GL_ARB_point_sprite
- GLEW_ARB_point_sprite = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_point_sprite");
-#endif /* GL_ARB_point_sprite */
-#ifdef GL_ARB_program_interface_query
- GLEW_ARB_program_interface_query = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_program_interface_query");
- if (glewExperimental || GLEW_ARB_program_interface_query) GLEW_ARB_program_interface_query = !_glewInit_GL_ARB_program_interface_query(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_program_interface_query */
-#ifdef GL_ARB_provoking_vertex
- GLEW_ARB_provoking_vertex = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_provoking_vertex");
- if (glewExperimental || GLEW_ARB_provoking_vertex) GLEW_ARB_provoking_vertex = !_glewInit_GL_ARB_provoking_vertex(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_provoking_vertex */
-#ifdef GL_ARB_query_buffer_object
- GLEW_ARB_query_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_query_buffer_object");
-#endif /* GL_ARB_query_buffer_object */
-#ifdef GL_ARB_robust_buffer_access_behavior
- GLEW_ARB_robust_buffer_access_behavior = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_robust_buffer_access_behavior");
-#endif /* GL_ARB_robust_buffer_access_behavior */
-#ifdef GL_ARB_robustness
- GLEW_ARB_robustness = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_robustness");
- if (glewExperimental || GLEW_ARB_robustness) GLEW_ARB_robustness = !_glewInit_GL_ARB_robustness(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_robustness */
-#ifdef GL_ARB_robustness_application_isolation
- GLEW_ARB_robustness_application_isolation = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_robustness_application_isolation");
-#endif /* GL_ARB_robustness_application_isolation */
-#ifdef GL_ARB_robustness_share_group_isolation
- GLEW_ARB_robustness_share_group_isolation = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_robustness_share_group_isolation");
-#endif /* GL_ARB_robustness_share_group_isolation */
-#ifdef GL_ARB_sample_shading
- GLEW_ARB_sample_shading = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_sample_shading");
- if (glewExperimental || GLEW_ARB_sample_shading) GLEW_ARB_sample_shading = !_glewInit_GL_ARB_sample_shading(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_sample_shading */
-#ifdef GL_ARB_sampler_objects
- GLEW_ARB_sampler_objects = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_sampler_objects");
- if (glewExperimental || GLEW_ARB_sampler_objects) GLEW_ARB_sampler_objects = !_glewInit_GL_ARB_sampler_objects(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_sampler_objects */
-#ifdef GL_ARB_seamless_cube_map
- GLEW_ARB_seamless_cube_map = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_seamless_cube_map");
-#endif /* GL_ARB_seamless_cube_map */
-#ifdef GL_ARB_seamless_cubemap_per_texture
- GLEW_ARB_seamless_cubemap_per_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_seamless_cubemap_per_texture");
-#endif /* GL_ARB_seamless_cubemap_per_texture */
-#ifdef GL_ARB_separate_shader_objects
- GLEW_ARB_separate_shader_objects = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_separate_shader_objects");
- if (glewExperimental || GLEW_ARB_separate_shader_objects) GLEW_ARB_separate_shader_objects = !_glewInit_GL_ARB_separate_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_separate_shader_objects */
-#ifdef GL_ARB_shader_atomic_counters
- GLEW_ARB_shader_atomic_counters = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_atomic_counters");
- if (glewExperimental || GLEW_ARB_shader_atomic_counters) GLEW_ARB_shader_atomic_counters = !_glewInit_GL_ARB_shader_atomic_counters(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_shader_atomic_counters */
-#ifdef GL_ARB_shader_bit_encoding
- GLEW_ARB_shader_bit_encoding = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_bit_encoding");
-#endif /* GL_ARB_shader_bit_encoding */
-#ifdef GL_ARB_shader_draw_parameters
- GLEW_ARB_shader_draw_parameters = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_draw_parameters");
-#endif /* GL_ARB_shader_draw_parameters */
-#ifdef GL_ARB_shader_group_vote
- GLEW_ARB_shader_group_vote = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_group_vote");
-#endif /* GL_ARB_shader_group_vote */
-#ifdef GL_ARB_shader_image_load_store
- GLEW_ARB_shader_image_load_store = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_image_load_store");
- if (glewExperimental || GLEW_ARB_shader_image_load_store) GLEW_ARB_shader_image_load_store = !_glewInit_GL_ARB_shader_image_load_store(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_shader_image_load_store */
-#ifdef GL_ARB_shader_image_size
- GLEW_ARB_shader_image_size = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_image_size");
-#endif /* GL_ARB_shader_image_size */
-#ifdef GL_ARB_shader_objects
- GLEW_ARB_shader_objects = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_objects");
- if (glewExperimental || GLEW_ARB_shader_objects) GLEW_ARB_shader_objects = !_glewInit_GL_ARB_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_shader_objects */
-#ifdef GL_ARB_shader_precision
- GLEW_ARB_shader_precision = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_precision");
-#endif /* GL_ARB_shader_precision */
-#ifdef GL_ARB_shader_stencil_export
- GLEW_ARB_shader_stencil_export = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_stencil_export");
-#endif /* GL_ARB_shader_stencil_export */
-#ifdef GL_ARB_shader_storage_buffer_object
- GLEW_ARB_shader_storage_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_storage_buffer_object");
- if (glewExperimental || GLEW_ARB_shader_storage_buffer_object) GLEW_ARB_shader_storage_buffer_object = !_glewInit_GL_ARB_shader_storage_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_shader_storage_buffer_object */
-#ifdef GL_ARB_shader_subroutine
- GLEW_ARB_shader_subroutine = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_subroutine");
- if (glewExperimental || GLEW_ARB_shader_subroutine) GLEW_ARB_shader_subroutine = !_glewInit_GL_ARB_shader_subroutine(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_shader_subroutine */
-#ifdef GL_ARB_shader_texture_image_samples
- GLEW_ARB_shader_texture_image_samples = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_texture_image_samples");
-#endif /* GL_ARB_shader_texture_image_samples */
-#ifdef GL_ARB_shader_texture_lod
- GLEW_ARB_shader_texture_lod = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shader_texture_lod");
-#endif /* GL_ARB_shader_texture_lod */
-#ifdef GL_ARB_shading_language_100
- GLEW_ARB_shading_language_100 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shading_language_100");
-#endif /* GL_ARB_shading_language_100 */
-#ifdef GL_ARB_shading_language_420pack
- GLEW_ARB_shading_language_420pack = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shading_language_420pack");
-#endif /* GL_ARB_shading_language_420pack */
-#ifdef GL_ARB_shading_language_include
- GLEW_ARB_shading_language_include = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shading_language_include");
- if (glewExperimental || GLEW_ARB_shading_language_include) GLEW_ARB_shading_language_include = !_glewInit_GL_ARB_shading_language_include(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_shading_language_include */
-#ifdef GL_ARB_shading_language_packing
- GLEW_ARB_shading_language_packing = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shading_language_packing");
-#endif /* GL_ARB_shading_language_packing */
-#ifdef GL_ARB_shadow
- GLEW_ARB_shadow = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shadow");
-#endif /* GL_ARB_shadow */
-#ifdef GL_ARB_shadow_ambient
- GLEW_ARB_shadow_ambient = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_shadow_ambient");
-#endif /* GL_ARB_shadow_ambient */
-#ifdef GL_ARB_sparse_buffer
- GLEW_ARB_sparse_buffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_sparse_buffer");
- if (glewExperimental || GLEW_ARB_sparse_buffer) GLEW_ARB_sparse_buffer = !_glewInit_GL_ARB_sparse_buffer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_sparse_buffer */
-#ifdef GL_ARB_sparse_texture
- GLEW_ARB_sparse_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_sparse_texture");
- if (glewExperimental || GLEW_ARB_sparse_texture) GLEW_ARB_sparse_texture = !_glewInit_GL_ARB_sparse_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_sparse_texture */
-#ifdef GL_ARB_stencil_texturing
- GLEW_ARB_stencil_texturing = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_stencil_texturing");
-#endif /* GL_ARB_stencil_texturing */
-#ifdef GL_ARB_sync
- GLEW_ARB_sync = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_sync");
- if (glewExperimental || GLEW_ARB_sync) GLEW_ARB_sync = !_glewInit_GL_ARB_sync(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_sync */
-#ifdef GL_ARB_tessellation_shader
- GLEW_ARB_tessellation_shader = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_tessellation_shader");
- if (glewExperimental || GLEW_ARB_tessellation_shader) GLEW_ARB_tessellation_shader = !_glewInit_GL_ARB_tessellation_shader(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_tessellation_shader */
-#ifdef GL_ARB_texture_barrier
- GLEW_ARB_texture_barrier = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_barrier");
- if (glewExperimental || GLEW_ARB_texture_barrier) GLEW_ARB_texture_barrier = !_glewInit_GL_ARB_texture_barrier(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_texture_barrier */
-#ifdef GL_ARB_texture_border_clamp
- GLEW_ARB_texture_border_clamp = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_border_clamp");
-#endif /* GL_ARB_texture_border_clamp */
-#ifdef GL_ARB_texture_buffer_object
- GLEW_ARB_texture_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_buffer_object");
- if (glewExperimental || GLEW_ARB_texture_buffer_object) GLEW_ARB_texture_buffer_object = !_glewInit_GL_ARB_texture_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_texture_buffer_object */
-#ifdef GL_ARB_texture_buffer_object_rgb32
- GLEW_ARB_texture_buffer_object_rgb32 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_buffer_object_rgb32");
-#endif /* GL_ARB_texture_buffer_object_rgb32 */
-#ifdef GL_ARB_texture_buffer_range
- GLEW_ARB_texture_buffer_range = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_buffer_range");
- if (glewExperimental || GLEW_ARB_texture_buffer_range) GLEW_ARB_texture_buffer_range = !_glewInit_GL_ARB_texture_buffer_range(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_texture_buffer_range */
-#ifdef GL_ARB_texture_compression
- GLEW_ARB_texture_compression = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_compression");
- if (glewExperimental || GLEW_ARB_texture_compression) GLEW_ARB_texture_compression = !_glewInit_GL_ARB_texture_compression(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_texture_compression */
-#ifdef GL_ARB_texture_compression_bptc
- GLEW_ARB_texture_compression_bptc = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_compression_bptc");
-#endif /* GL_ARB_texture_compression_bptc */
-#ifdef GL_ARB_texture_compression_rgtc
- GLEW_ARB_texture_compression_rgtc = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_compression_rgtc");
-#endif /* GL_ARB_texture_compression_rgtc */
-#ifdef GL_ARB_texture_cube_map
- GLEW_ARB_texture_cube_map = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_cube_map");
-#endif /* GL_ARB_texture_cube_map */
-#ifdef GL_ARB_texture_cube_map_array
- GLEW_ARB_texture_cube_map_array = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_cube_map_array");
-#endif /* GL_ARB_texture_cube_map_array */
-#ifdef GL_ARB_texture_env_add
- GLEW_ARB_texture_env_add = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_env_add");
-#endif /* GL_ARB_texture_env_add */
-#ifdef GL_ARB_texture_env_combine
- GLEW_ARB_texture_env_combine = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_env_combine");
-#endif /* GL_ARB_texture_env_combine */
-#ifdef GL_ARB_texture_env_crossbar
- GLEW_ARB_texture_env_crossbar = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_env_crossbar");
-#endif /* GL_ARB_texture_env_crossbar */
-#ifdef GL_ARB_texture_env_dot3
- GLEW_ARB_texture_env_dot3 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_env_dot3");
-#endif /* GL_ARB_texture_env_dot3 */
-#ifdef GL_ARB_texture_float
- GLEW_ARB_texture_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_float");
-#endif /* GL_ARB_texture_float */
-#ifdef GL_ARB_texture_gather
- GLEW_ARB_texture_gather = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_gather");
-#endif /* GL_ARB_texture_gather */
-#ifdef GL_ARB_texture_mirror_clamp_to_edge
- GLEW_ARB_texture_mirror_clamp_to_edge = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_mirror_clamp_to_edge");
-#endif /* GL_ARB_texture_mirror_clamp_to_edge */
-#ifdef GL_ARB_texture_mirrored_repeat
- GLEW_ARB_texture_mirrored_repeat = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_mirrored_repeat");
-#endif /* GL_ARB_texture_mirrored_repeat */
-#ifdef GL_ARB_texture_multisample
- GLEW_ARB_texture_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_multisample");
- if (glewExperimental || GLEW_ARB_texture_multisample) GLEW_ARB_texture_multisample = !_glewInit_GL_ARB_texture_multisample(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_texture_multisample */
-#ifdef GL_ARB_texture_non_power_of_two
- GLEW_ARB_texture_non_power_of_two = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_non_power_of_two");
-#endif /* GL_ARB_texture_non_power_of_two */
-#ifdef GL_ARB_texture_query_levels
- GLEW_ARB_texture_query_levels = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_query_levels");
-#endif /* GL_ARB_texture_query_levels */
-#ifdef GL_ARB_texture_query_lod
- GLEW_ARB_texture_query_lod = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_query_lod");
-#endif /* GL_ARB_texture_query_lod */
-#ifdef GL_ARB_texture_rectangle
- GLEW_ARB_texture_rectangle = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_rectangle");
-#endif /* GL_ARB_texture_rectangle */
-#ifdef GL_ARB_texture_rg
- GLEW_ARB_texture_rg = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_rg");
-#endif /* GL_ARB_texture_rg */
-#ifdef GL_ARB_texture_rgb10_a2ui
- GLEW_ARB_texture_rgb10_a2ui = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_rgb10_a2ui");
-#endif /* GL_ARB_texture_rgb10_a2ui */
-#ifdef GL_ARB_texture_stencil8
- GLEW_ARB_texture_stencil8 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_stencil8");
-#endif /* GL_ARB_texture_stencil8 */
-#ifdef GL_ARB_texture_storage
- GLEW_ARB_texture_storage = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_storage");
- if (glewExperimental || GLEW_ARB_texture_storage) GLEW_ARB_texture_storage = !_glewInit_GL_ARB_texture_storage(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_texture_storage */
-#ifdef GL_ARB_texture_storage_multisample
- GLEW_ARB_texture_storage_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_storage_multisample");
- if (glewExperimental || GLEW_ARB_texture_storage_multisample) GLEW_ARB_texture_storage_multisample = !_glewInit_GL_ARB_texture_storage_multisample(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_texture_storage_multisample */
-#ifdef GL_ARB_texture_swizzle
- GLEW_ARB_texture_swizzle = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_swizzle");
-#endif /* GL_ARB_texture_swizzle */
-#ifdef GL_ARB_texture_view
- GLEW_ARB_texture_view = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_texture_view");
- if (glewExperimental || GLEW_ARB_texture_view) GLEW_ARB_texture_view = !_glewInit_GL_ARB_texture_view(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_texture_view */
-#ifdef GL_ARB_timer_query
- GLEW_ARB_timer_query = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_timer_query");
- if (glewExperimental || GLEW_ARB_timer_query) GLEW_ARB_timer_query = !_glewInit_GL_ARB_timer_query(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_timer_query */
-#ifdef GL_ARB_transform_feedback2
- GLEW_ARB_transform_feedback2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_transform_feedback2");
- if (glewExperimental || GLEW_ARB_transform_feedback2) GLEW_ARB_transform_feedback2 = !_glewInit_GL_ARB_transform_feedback2(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_transform_feedback2 */
-#ifdef GL_ARB_transform_feedback3
- GLEW_ARB_transform_feedback3 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_transform_feedback3");
- if (glewExperimental || GLEW_ARB_transform_feedback3) GLEW_ARB_transform_feedback3 = !_glewInit_GL_ARB_transform_feedback3(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_transform_feedback3 */
-#ifdef GL_ARB_transform_feedback_instanced
- GLEW_ARB_transform_feedback_instanced = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_transform_feedback_instanced");
- if (glewExperimental || GLEW_ARB_transform_feedback_instanced) GLEW_ARB_transform_feedback_instanced = !_glewInit_GL_ARB_transform_feedback_instanced(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_transform_feedback_instanced */
-#ifdef GL_ARB_transform_feedback_overflow_query
- GLEW_ARB_transform_feedback_overflow_query = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_transform_feedback_overflow_query");
-#endif /* GL_ARB_transform_feedback_overflow_query */
-#ifdef GL_ARB_transpose_matrix
- GLEW_ARB_transpose_matrix = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_transpose_matrix");
- if (glewExperimental || GLEW_ARB_transpose_matrix) GLEW_ARB_transpose_matrix = !_glewInit_GL_ARB_transpose_matrix(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_transpose_matrix */
-#ifdef GL_ARB_uniform_buffer_object
- GLEW_ARB_uniform_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_uniform_buffer_object");
- if (glewExperimental || GLEW_ARB_uniform_buffer_object) GLEW_ARB_uniform_buffer_object = !_glewInit_GL_ARB_uniform_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_uniform_buffer_object */
-#ifdef GL_ARB_vertex_array_bgra
- GLEW_ARB_vertex_array_bgra = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_vertex_array_bgra");
-#endif /* GL_ARB_vertex_array_bgra */
-#ifdef GL_ARB_vertex_array_object
- GLEW_ARB_vertex_array_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_vertex_array_object");
- if (glewExperimental || GLEW_ARB_vertex_array_object) GLEW_ARB_vertex_array_object = !_glewInit_GL_ARB_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_vertex_array_object */
-#ifdef GL_ARB_vertex_attrib_64bit
- GLEW_ARB_vertex_attrib_64bit = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_vertex_attrib_64bit");
- if (glewExperimental || GLEW_ARB_vertex_attrib_64bit) GLEW_ARB_vertex_attrib_64bit = !_glewInit_GL_ARB_vertex_attrib_64bit(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_vertex_attrib_64bit */
-#ifdef GL_ARB_vertex_attrib_binding
- GLEW_ARB_vertex_attrib_binding = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_vertex_attrib_binding");
- if (glewExperimental || GLEW_ARB_vertex_attrib_binding) GLEW_ARB_vertex_attrib_binding = !_glewInit_GL_ARB_vertex_attrib_binding(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_vertex_attrib_binding */
-#ifdef GL_ARB_vertex_blend
- GLEW_ARB_vertex_blend = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_vertex_blend");
- if (glewExperimental || GLEW_ARB_vertex_blend) GLEW_ARB_vertex_blend = !_glewInit_GL_ARB_vertex_blend(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_vertex_blend */
-#ifdef GL_ARB_vertex_buffer_object
- GLEW_ARB_vertex_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_vertex_buffer_object");
- if (glewExperimental || GLEW_ARB_vertex_buffer_object) GLEW_ARB_vertex_buffer_object = !_glewInit_GL_ARB_vertex_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_vertex_buffer_object */
-#ifdef GL_ARB_vertex_program
- GLEW_ARB_vertex_program = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_vertex_program");
- if (glewExperimental || GLEW_ARB_vertex_program) GLEW_ARB_vertex_program = !_glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_vertex_program */
-#ifdef GL_ARB_vertex_shader
- GLEW_ARB_vertex_shader = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_vertex_shader");
- if (glewExperimental || GLEW_ARB_vertex_shader) { GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); _glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); }
-#endif /* GL_ARB_vertex_shader */
-#ifdef GL_ARB_vertex_type_10f_11f_11f_rev
- GLEW_ARB_vertex_type_10f_11f_11f_rev = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_vertex_type_10f_11f_11f_rev");
-#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */
-#ifdef GL_ARB_vertex_type_2_10_10_10_rev
- GLEW_ARB_vertex_type_2_10_10_10_rev = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_vertex_type_2_10_10_10_rev");
- if (glewExperimental || GLEW_ARB_vertex_type_2_10_10_10_rev) GLEW_ARB_vertex_type_2_10_10_10_rev = !_glewInit_GL_ARB_vertex_type_2_10_10_10_rev(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_vertex_type_2_10_10_10_rev */
-#ifdef GL_ARB_viewport_array
- GLEW_ARB_viewport_array = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_viewport_array");
- if (glewExperimental || GLEW_ARB_viewport_array) GLEW_ARB_viewport_array = !_glewInit_GL_ARB_viewport_array(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_viewport_array */
-#ifdef GL_ARB_window_pos
- GLEW_ARB_window_pos = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ARB_window_pos");
- if (glewExperimental || GLEW_ARB_window_pos) GLEW_ARB_window_pos = !_glewInit_GL_ARB_window_pos(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ARB_window_pos */
-#ifdef GL_ATIX_point_sprites
- GLEW_ATIX_point_sprites = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATIX_point_sprites");
-#endif /* GL_ATIX_point_sprites */
-#ifdef GL_ATIX_texture_env_combine3
- GLEW_ATIX_texture_env_combine3 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATIX_texture_env_combine3");
-#endif /* GL_ATIX_texture_env_combine3 */
-#ifdef GL_ATIX_texture_env_route
- GLEW_ATIX_texture_env_route = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATIX_texture_env_route");
-#endif /* GL_ATIX_texture_env_route */
-#ifdef GL_ATIX_vertex_shader_output_point_size
- GLEW_ATIX_vertex_shader_output_point_size = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATIX_vertex_shader_output_point_size");
-#endif /* GL_ATIX_vertex_shader_output_point_size */
-#ifdef GL_ATI_draw_buffers
- GLEW_ATI_draw_buffers = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_draw_buffers");
- if (glewExperimental || GLEW_ATI_draw_buffers) GLEW_ATI_draw_buffers = !_glewInit_GL_ATI_draw_buffers(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ATI_draw_buffers */
-#ifdef GL_ATI_element_array
- GLEW_ATI_element_array = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_element_array");
- if (glewExperimental || GLEW_ATI_element_array) GLEW_ATI_element_array = !_glewInit_GL_ATI_element_array(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ATI_element_array */
-#ifdef GL_ATI_envmap_bumpmap
- GLEW_ATI_envmap_bumpmap = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_envmap_bumpmap");
- if (glewExperimental || GLEW_ATI_envmap_bumpmap) GLEW_ATI_envmap_bumpmap = !_glewInit_GL_ATI_envmap_bumpmap(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ATI_envmap_bumpmap */
-#ifdef GL_ATI_fragment_shader
- GLEW_ATI_fragment_shader = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_fragment_shader");
- if (glewExperimental || GLEW_ATI_fragment_shader) GLEW_ATI_fragment_shader = !_glewInit_GL_ATI_fragment_shader(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ATI_fragment_shader */
-#ifdef GL_ATI_map_object_buffer
- GLEW_ATI_map_object_buffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_map_object_buffer");
- if (glewExperimental || GLEW_ATI_map_object_buffer) GLEW_ATI_map_object_buffer = !_glewInit_GL_ATI_map_object_buffer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ATI_map_object_buffer */
-#ifdef GL_ATI_meminfo
- GLEW_ATI_meminfo = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_meminfo");
-#endif /* GL_ATI_meminfo */
-#ifdef GL_ATI_pn_triangles
- GLEW_ATI_pn_triangles = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_pn_triangles");
- if (glewExperimental || GLEW_ATI_pn_triangles) GLEW_ATI_pn_triangles = !_glewInit_GL_ATI_pn_triangles(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ATI_pn_triangles */
-#ifdef GL_ATI_separate_stencil
- GLEW_ATI_separate_stencil = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_separate_stencil");
- if (glewExperimental || GLEW_ATI_separate_stencil) GLEW_ATI_separate_stencil = !_glewInit_GL_ATI_separate_stencil(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ATI_separate_stencil */
-#ifdef GL_ATI_shader_texture_lod
- GLEW_ATI_shader_texture_lod = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_shader_texture_lod");
-#endif /* GL_ATI_shader_texture_lod */
-#ifdef GL_ATI_text_fragment_shader
- GLEW_ATI_text_fragment_shader = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_text_fragment_shader");
-#endif /* GL_ATI_text_fragment_shader */
-#ifdef GL_ATI_texture_compression_3dc
- GLEW_ATI_texture_compression_3dc = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_texture_compression_3dc");
-#endif /* GL_ATI_texture_compression_3dc */
-#ifdef GL_ATI_texture_env_combine3
- GLEW_ATI_texture_env_combine3 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_texture_env_combine3");
-#endif /* GL_ATI_texture_env_combine3 */
-#ifdef GL_ATI_texture_float
- GLEW_ATI_texture_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_texture_float");
-#endif /* GL_ATI_texture_float */
-#ifdef GL_ATI_texture_mirror_once
- GLEW_ATI_texture_mirror_once = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_texture_mirror_once");
-#endif /* GL_ATI_texture_mirror_once */
-#ifdef GL_ATI_vertex_array_object
- GLEW_ATI_vertex_array_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_vertex_array_object");
- if (glewExperimental || GLEW_ATI_vertex_array_object) GLEW_ATI_vertex_array_object = !_glewInit_GL_ATI_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ATI_vertex_array_object */
-#ifdef GL_ATI_vertex_attrib_array_object
- GLEW_ATI_vertex_attrib_array_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_vertex_attrib_array_object");
- if (glewExperimental || GLEW_ATI_vertex_attrib_array_object) GLEW_ATI_vertex_attrib_array_object = !_glewInit_GL_ATI_vertex_attrib_array_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ATI_vertex_attrib_array_object */
-#ifdef GL_ATI_vertex_streams
- GLEW_ATI_vertex_streams = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_ATI_vertex_streams");
- if (glewExperimental || GLEW_ATI_vertex_streams) GLEW_ATI_vertex_streams = !_glewInit_GL_ATI_vertex_streams(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_ATI_vertex_streams */
-#ifdef GL_EXT_422_pixels
- GLEW_EXT_422_pixels = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_422_pixels");
-#endif /* GL_EXT_422_pixels */
-#ifdef GL_EXT_Cg_shader
- GLEW_EXT_Cg_shader = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_Cg_shader");
-#endif /* GL_EXT_Cg_shader */
-#ifdef GL_EXT_abgr
- GLEW_EXT_abgr = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_abgr");
-#endif /* GL_EXT_abgr */
-#ifdef GL_EXT_bgra
- GLEW_EXT_bgra = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_bgra");
-#endif /* GL_EXT_bgra */
-#ifdef GL_EXT_bindable_uniform
- GLEW_EXT_bindable_uniform = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_bindable_uniform");
- if (glewExperimental || GLEW_EXT_bindable_uniform) GLEW_EXT_bindable_uniform = !_glewInit_GL_EXT_bindable_uniform(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_bindable_uniform */
-#ifdef GL_EXT_blend_color
- GLEW_EXT_blend_color = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_blend_color");
- if (glewExperimental || GLEW_EXT_blend_color) GLEW_EXT_blend_color = !_glewInit_GL_EXT_blend_color(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_blend_color */
-#ifdef GL_EXT_blend_equation_separate
- GLEW_EXT_blend_equation_separate = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_blend_equation_separate");
- if (glewExperimental || GLEW_EXT_blend_equation_separate) GLEW_EXT_blend_equation_separate = !_glewInit_GL_EXT_blend_equation_separate(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_blend_equation_separate */
-#ifdef GL_EXT_blend_func_separate
- GLEW_EXT_blend_func_separate = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_blend_func_separate");
- if (glewExperimental || GLEW_EXT_blend_func_separate) GLEW_EXT_blend_func_separate = !_glewInit_GL_EXT_blend_func_separate(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_blend_func_separate */
-#ifdef GL_EXT_blend_logic_op
- GLEW_EXT_blend_logic_op = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_blend_logic_op");
-#endif /* GL_EXT_blend_logic_op */
-#ifdef GL_EXT_blend_minmax
- GLEW_EXT_blend_minmax = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_blend_minmax");
- if (glewExperimental || GLEW_EXT_blend_minmax) GLEW_EXT_blend_minmax = !_glewInit_GL_EXT_blend_minmax(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_blend_minmax */
-#ifdef GL_EXT_blend_subtract
- GLEW_EXT_blend_subtract = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_blend_subtract");
-#endif /* GL_EXT_blend_subtract */
-#ifdef GL_EXT_clip_volume_hint
- GLEW_EXT_clip_volume_hint = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_clip_volume_hint");
-#endif /* GL_EXT_clip_volume_hint */
-#ifdef GL_EXT_cmyka
- GLEW_EXT_cmyka = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_cmyka");
-#endif /* GL_EXT_cmyka */
-#ifdef GL_EXT_color_subtable
- GLEW_EXT_color_subtable = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_color_subtable");
- if (glewExperimental || GLEW_EXT_color_subtable) GLEW_EXT_color_subtable = !_glewInit_GL_EXT_color_subtable(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_color_subtable */
-#ifdef GL_EXT_compiled_vertex_array
- GLEW_EXT_compiled_vertex_array = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_compiled_vertex_array");
- if (glewExperimental || GLEW_EXT_compiled_vertex_array) GLEW_EXT_compiled_vertex_array = !_glewInit_GL_EXT_compiled_vertex_array(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_compiled_vertex_array */
-#ifdef GL_EXT_convolution
- GLEW_EXT_convolution = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_convolution");
- if (glewExperimental || GLEW_EXT_convolution) GLEW_EXT_convolution = !_glewInit_GL_EXT_convolution(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_convolution */
-#ifdef GL_EXT_coordinate_frame
- GLEW_EXT_coordinate_frame = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_coordinate_frame");
- if (glewExperimental || GLEW_EXT_coordinate_frame) GLEW_EXT_coordinate_frame = !_glewInit_GL_EXT_coordinate_frame(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_coordinate_frame */
-#ifdef GL_EXT_copy_texture
- GLEW_EXT_copy_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_copy_texture");
- if (glewExperimental || GLEW_EXT_copy_texture) GLEW_EXT_copy_texture = !_glewInit_GL_EXT_copy_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_copy_texture */
-#ifdef GL_EXT_cull_vertex
- GLEW_EXT_cull_vertex = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_cull_vertex");
- if (glewExperimental || GLEW_EXT_cull_vertex) GLEW_EXT_cull_vertex = !_glewInit_GL_EXT_cull_vertex(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_cull_vertex */
-#ifdef GL_EXT_debug_label
- GLEW_EXT_debug_label = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_debug_label");
- if (glewExperimental || GLEW_EXT_debug_label) GLEW_EXT_debug_label = !_glewInit_GL_EXT_debug_label(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_debug_label */
-#ifdef GL_EXT_debug_marker
- GLEW_EXT_debug_marker = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_debug_marker");
- if (glewExperimental || GLEW_EXT_debug_marker) GLEW_EXT_debug_marker = !_glewInit_GL_EXT_debug_marker(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_debug_marker */
-#ifdef GL_EXT_depth_bounds_test
- GLEW_EXT_depth_bounds_test = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_depth_bounds_test");
- if (glewExperimental || GLEW_EXT_depth_bounds_test) GLEW_EXT_depth_bounds_test = !_glewInit_GL_EXT_depth_bounds_test(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_depth_bounds_test */
-#ifdef GL_EXT_direct_state_access
- GLEW_EXT_direct_state_access = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_direct_state_access");
- if (glewExperimental || GLEW_EXT_direct_state_access) GLEW_EXT_direct_state_access = !_glewInit_GL_EXT_direct_state_access(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_direct_state_access */
-#ifdef GL_EXT_draw_buffers2
- GLEW_EXT_draw_buffers2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_draw_buffers2");
- if (glewExperimental || GLEW_EXT_draw_buffers2) GLEW_EXT_draw_buffers2 = !_glewInit_GL_EXT_draw_buffers2(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_draw_buffers2 */
-#ifdef GL_EXT_draw_instanced
- GLEW_EXT_draw_instanced = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_draw_instanced");
- if (glewExperimental || GLEW_EXT_draw_instanced) GLEW_EXT_draw_instanced = !_glewInit_GL_EXT_draw_instanced(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_draw_instanced */
-#ifdef GL_EXT_draw_range_elements
- GLEW_EXT_draw_range_elements = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_draw_range_elements");
- if (glewExperimental || GLEW_EXT_draw_range_elements) GLEW_EXT_draw_range_elements = !_glewInit_GL_EXT_draw_range_elements(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_draw_range_elements */
-#ifdef GL_EXT_fog_coord
- GLEW_EXT_fog_coord = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_fog_coord");
- if (glewExperimental || GLEW_EXT_fog_coord) GLEW_EXT_fog_coord = !_glewInit_GL_EXT_fog_coord(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_fog_coord */
-#ifdef GL_EXT_fragment_lighting
- GLEW_EXT_fragment_lighting = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_fragment_lighting");
- if (glewExperimental || GLEW_EXT_fragment_lighting) GLEW_EXT_fragment_lighting = !_glewInit_GL_EXT_fragment_lighting(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_fragment_lighting */
-#ifdef GL_EXT_framebuffer_blit
- GLEW_EXT_framebuffer_blit = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_framebuffer_blit");
- if (glewExperimental || GLEW_EXT_framebuffer_blit) GLEW_EXT_framebuffer_blit = !_glewInit_GL_EXT_framebuffer_blit(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_framebuffer_blit */
-#ifdef GL_EXT_framebuffer_multisample
- GLEW_EXT_framebuffer_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_framebuffer_multisample");
- if (glewExperimental || GLEW_EXT_framebuffer_multisample) GLEW_EXT_framebuffer_multisample = !_glewInit_GL_EXT_framebuffer_multisample(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_framebuffer_multisample */
-#ifdef GL_EXT_framebuffer_multisample_blit_scaled
- GLEW_EXT_framebuffer_multisample_blit_scaled = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_framebuffer_multisample_blit_scaled");
-#endif /* GL_EXT_framebuffer_multisample_blit_scaled */
-#ifdef GL_EXT_framebuffer_object
- GLEW_EXT_framebuffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_framebuffer_object");
- if (glewExperimental || GLEW_EXT_framebuffer_object) GLEW_EXT_framebuffer_object = !_glewInit_GL_EXT_framebuffer_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_framebuffer_object */
-#ifdef GL_EXT_framebuffer_sRGB
- GLEW_EXT_framebuffer_sRGB = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_framebuffer_sRGB");
-#endif /* GL_EXT_framebuffer_sRGB */
-#ifdef GL_EXT_geometry_shader4
- GLEW_EXT_geometry_shader4 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_geometry_shader4");
- if (glewExperimental || GLEW_EXT_geometry_shader4) GLEW_EXT_geometry_shader4 = !_glewInit_GL_EXT_geometry_shader4(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_geometry_shader4 */
-#ifdef GL_EXT_gpu_program_parameters
- GLEW_EXT_gpu_program_parameters = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_gpu_program_parameters");
- if (glewExperimental || GLEW_EXT_gpu_program_parameters) GLEW_EXT_gpu_program_parameters = !_glewInit_GL_EXT_gpu_program_parameters(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_gpu_program_parameters */
-#ifdef GL_EXT_gpu_shader4
- GLEW_EXT_gpu_shader4 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_gpu_shader4");
- if (glewExperimental || GLEW_EXT_gpu_shader4) GLEW_EXT_gpu_shader4 = !_glewInit_GL_EXT_gpu_shader4(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_gpu_shader4 */
-#ifdef GL_EXT_histogram
- GLEW_EXT_histogram = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_histogram");
- if (glewExperimental || GLEW_EXT_histogram) GLEW_EXT_histogram = !_glewInit_GL_EXT_histogram(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_histogram */
-#ifdef GL_EXT_index_array_formats
- GLEW_EXT_index_array_formats = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_index_array_formats");
-#endif /* GL_EXT_index_array_formats */
-#ifdef GL_EXT_index_func
- GLEW_EXT_index_func = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_index_func");
- if (glewExperimental || GLEW_EXT_index_func) GLEW_EXT_index_func = !_glewInit_GL_EXT_index_func(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_index_func */
-#ifdef GL_EXT_index_material
- GLEW_EXT_index_material = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_index_material");
- if (glewExperimental || GLEW_EXT_index_material) GLEW_EXT_index_material = !_glewInit_GL_EXT_index_material(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_index_material */
-#ifdef GL_EXT_index_texture
- GLEW_EXT_index_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_index_texture");
-#endif /* GL_EXT_index_texture */
-#ifdef GL_EXT_light_texture
- GLEW_EXT_light_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_light_texture");
- if (glewExperimental || GLEW_EXT_light_texture) GLEW_EXT_light_texture = !_glewInit_GL_EXT_light_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_light_texture */
-#ifdef GL_EXT_misc_attribute
- GLEW_EXT_misc_attribute = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_misc_attribute");
-#endif /* GL_EXT_misc_attribute */
-#ifdef GL_EXT_multi_draw_arrays
- GLEW_EXT_multi_draw_arrays = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_multi_draw_arrays");
- if (glewExperimental || GLEW_EXT_multi_draw_arrays) GLEW_EXT_multi_draw_arrays = !_glewInit_GL_EXT_multi_draw_arrays(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_multi_draw_arrays */
-#ifdef GL_EXT_multisample
- GLEW_EXT_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_multisample");
- if (glewExperimental || GLEW_EXT_multisample) GLEW_EXT_multisample = !_glewInit_GL_EXT_multisample(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_multisample */
-#ifdef GL_EXT_packed_depth_stencil
- GLEW_EXT_packed_depth_stencil = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_packed_depth_stencil");
-#endif /* GL_EXT_packed_depth_stencil */
-#ifdef GL_EXT_packed_float
- GLEW_EXT_packed_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_packed_float");
-#endif /* GL_EXT_packed_float */
-#ifdef GL_EXT_packed_pixels
- GLEW_EXT_packed_pixels = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_packed_pixels");
-#endif /* GL_EXT_packed_pixels */
-#ifdef GL_EXT_paletted_texture
- GLEW_EXT_paletted_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_paletted_texture");
- if (glewExperimental || GLEW_EXT_paletted_texture) GLEW_EXT_paletted_texture = !_glewInit_GL_EXT_paletted_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_paletted_texture */
-#ifdef GL_EXT_pixel_buffer_object
- GLEW_EXT_pixel_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_pixel_buffer_object");
-#endif /* GL_EXT_pixel_buffer_object */
-#ifdef GL_EXT_pixel_transform
- GLEW_EXT_pixel_transform = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_pixel_transform");
- if (glewExperimental || GLEW_EXT_pixel_transform) GLEW_EXT_pixel_transform = !_glewInit_GL_EXT_pixel_transform(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_pixel_transform */
-#ifdef GL_EXT_pixel_transform_color_table
- GLEW_EXT_pixel_transform_color_table = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_pixel_transform_color_table");
-#endif /* GL_EXT_pixel_transform_color_table */
-#ifdef GL_EXT_point_parameters
- GLEW_EXT_point_parameters = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_point_parameters");
- if (glewExperimental || GLEW_EXT_point_parameters) GLEW_EXT_point_parameters = !_glewInit_GL_EXT_point_parameters(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_point_parameters */
-#ifdef GL_EXT_polygon_offset
- GLEW_EXT_polygon_offset = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_polygon_offset");
- if (glewExperimental || GLEW_EXT_polygon_offset) GLEW_EXT_polygon_offset = !_glewInit_GL_EXT_polygon_offset(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_polygon_offset */
-#ifdef GL_EXT_polygon_offset_clamp
- GLEW_EXT_polygon_offset_clamp = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_polygon_offset_clamp");
- if (glewExperimental || GLEW_EXT_polygon_offset_clamp) GLEW_EXT_polygon_offset_clamp = !_glewInit_GL_EXT_polygon_offset_clamp(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_polygon_offset_clamp */
-#ifdef GL_EXT_post_depth_coverage
- GLEW_EXT_post_depth_coverage = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_post_depth_coverage");
-#endif /* GL_EXT_post_depth_coverage */
-#ifdef GL_EXT_provoking_vertex
- GLEW_EXT_provoking_vertex = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_provoking_vertex");
- if (glewExperimental || GLEW_EXT_provoking_vertex) GLEW_EXT_provoking_vertex = !_glewInit_GL_EXT_provoking_vertex(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_provoking_vertex */
-#ifdef GL_EXT_raster_multisample
- GLEW_EXT_raster_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_raster_multisample");
- if (glewExperimental || GLEW_EXT_raster_multisample) GLEW_EXT_raster_multisample = !_glewInit_GL_EXT_raster_multisample(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_raster_multisample */
-#ifdef GL_EXT_rescale_normal
- GLEW_EXT_rescale_normal = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_rescale_normal");
-#endif /* GL_EXT_rescale_normal */
-#ifdef GL_EXT_scene_marker
- GLEW_EXT_scene_marker = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_scene_marker");
- if (glewExperimental || GLEW_EXT_scene_marker) GLEW_EXT_scene_marker = !_glewInit_GL_EXT_scene_marker(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_scene_marker */
-#ifdef GL_EXT_secondary_color
- GLEW_EXT_secondary_color = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_secondary_color");
- if (glewExperimental || GLEW_EXT_secondary_color) GLEW_EXT_secondary_color = !_glewInit_GL_EXT_secondary_color(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_secondary_color */
-#ifdef GL_EXT_separate_shader_objects
- GLEW_EXT_separate_shader_objects = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_separate_shader_objects");
- if (glewExperimental || GLEW_EXT_separate_shader_objects) GLEW_EXT_separate_shader_objects = !_glewInit_GL_EXT_separate_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_separate_shader_objects */
-#ifdef GL_EXT_separate_specular_color
- GLEW_EXT_separate_specular_color = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_separate_specular_color");
-#endif /* GL_EXT_separate_specular_color */
-#ifdef GL_EXT_shader_image_load_formatted
- GLEW_EXT_shader_image_load_formatted = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_shader_image_load_formatted");
-#endif /* GL_EXT_shader_image_load_formatted */
-#ifdef GL_EXT_shader_image_load_store
- GLEW_EXT_shader_image_load_store = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_shader_image_load_store");
- if (glewExperimental || GLEW_EXT_shader_image_load_store) GLEW_EXT_shader_image_load_store = !_glewInit_GL_EXT_shader_image_load_store(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_shader_image_load_store */
-#ifdef GL_EXT_shader_integer_mix
- GLEW_EXT_shader_integer_mix = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_shader_integer_mix");
-#endif /* GL_EXT_shader_integer_mix */
-#ifdef GL_EXT_shadow_funcs
- GLEW_EXT_shadow_funcs = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_shadow_funcs");
-#endif /* GL_EXT_shadow_funcs */
-#ifdef GL_EXT_shared_texture_palette
- GLEW_EXT_shared_texture_palette = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_shared_texture_palette");
-#endif /* GL_EXT_shared_texture_palette */
-#ifdef GL_EXT_sparse_texture2
- GLEW_EXT_sparse_texture2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_sparse_texture2");
-#endif /* GL_EXT_sparse_texture2 */
-#ifdef GL_EXT_stencil_clear_tag
- GLEW_EXT_stencil_clear_tag = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_stencil_clear_tag");
-#endif /* GL_EXT_stencil_clear_tag */
-#ifdef GL_EXT_stencil_two_side
- GLEW_EXT_stencil_two_side = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_stencil_two_side");
- if (glewExperimental || GLEW_EXT_stencil_two_side) GLEW_EXT_stencil_two_side = !_glewInit_GL_EXT_stencil_two_side(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_stencil_two_side */
-#ifdef GL_EXT_stencil_wrap
- GLEW_EXT_stencil_wrap = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_stencil_wrap");
-#endif /* GL_EXT_stencil_wrap */
-#ifdef GL_EXT_subtexture
- GLEW_EXT_subtexture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_subtexture");
- if (glewExperimental || GLEW_EXT_subtexture) GLEW_EXT_subtexture = !_glewInit_GL_EXT_subtexture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_subtexture */
-#ifdef GL_EXT_texture
- GLEW_EXT_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture");
-#endif /* GL_EXT_texture */
-#ifdef GL_EXT_texture3D
- GLEW_EXT_texture3D = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture3D");
- if (glewExperimental || GLEW_EXT_texture3D) GLEW_EXT_texture3D = !_glewInit_GL_EXT_texture3D(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_texture3D */
-#ifdef GL_EXT_texture_array
- GLEW_EXT_texture_array = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_array");
- if (glewExperimental || GLEW_EXT_texture_array) GLEW_EXT_texture_array = !_glewInit_GL_EXT_texture_array(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_texture_array */
-#ifdef GL_EXT_texture_buffer_object
- GLEW_EXT_texture_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_buffer_object");
- if (glewExperimental || GLEW_EXT_texture_buffer_object) GLEW_EXT_texture_buffer_object = !_glewInit_GL_EXT_texture_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_texture_buffer_object */
-#ifdef GL_EXT_texture_compression_dxt1
- GLEW_EXT_texture_compression_dxt1 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_compression_dxt1");
-#endif /* GL_EXT_texture_compression_dxt1 */
-#ifdef GL_EXT_texture_compression_latc
- GLEW_EXT_texture_compression_latc = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_compression_latc");
-#endif /* GL_EXT_texture_compression_latc */
-#ifdef GL_EXT_texture_compression_rgtc
- GLEW_EXT_texture_compression_rgtc = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_compression_rgtc");
-#endif /* GL_EXT_texture_compression_rgtc */
-#ifdef GL_EXT_texture_compression_s3tc
- GLEW_EXT_texture_compression_s3tc = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_compression_s3tc");
-#endif /* GL_EXT_texture_compression_s3tc */
-#ifdef GL_EXT_texture_cube_map
- GLEW_EXT_texture_cube_map = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_cube_map");
-#endif /* GL_EXT_texture_cube_map */
-#ifdef GL_EXT_texture_edge_clamp
- GLEW_EXT_texture_edge_clamp = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_edge_clamp");
-#endif /* GL_EXT_texture_edge_clamp */
-#ifdef GL_EXT_texture_env
- GLEW_EXT_texture_env = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_env");
-#endif /* GL_EXT_texture_env */
-#ifdef GL_EXT_texture_env_add
- GLEW_EXT_texture_env_add = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_env_add");
-#endif /* GL_EXT_texture_env_add */
-#ifdef GL_EXT_texture_env_combine
- GLEW_EXT_texture_env_combine = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_env_combine");
-#endif /* GL_EXT_texture_env_combine */
-#ifdef GL_EXT_texture_env_dot3
- GLEW_EXT_texture_env_dot3 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_env_dot3");
-#endif /* GL_EXT_texture_env_dot3 */
-#ifdef GL_EXT_texture_filter_anisotropic
- GLEW_EXT_texture_filter_anisotropic = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_filter_anisotropic");
-#endif /* GL_EXT_texture_filter_anisotropic */
-#ifdef GL_EXT_texture_filter_minmax
- GLEW_EXT_texture_filter_minmax = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_filter_minmax");
-#endif /* GL_EXT_texture_filter_minmax */
-#ifdef GL_EXT_texture_integer
- GLEW_EXT_texture_integer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_integer");
- if (glewExperimental || GLEW_EXT_texture_integer) GLEW_EXT_texture_integer = !_glewInit_GL_EXT_texture_integer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_texture_integer */
-#ifdef GL_EXT_texture_lod_bias
- GLEW_EXT_texture_lod_bias = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_lod_bias");
-#endif /* GL_EXT_texture_lod_bias */
-#ifdef GL_EXT_texture_mirror_clamp
- GLEW_EXT_texture_mirror_clamp = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_mirror_clamp");
-#endif /* GL_EXT_texture_mirror_clamp */
-#ifdef GL_EXT_texture_object
- GLEW_EXT_texture_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_object");
- if (glewExperimental || GLEW_EXT_texture_object) GLEW_EXT_texture_object = !_glewInit_GL_EXT_texture_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_texture_object */
-#ifdef GL_EXT_texture_perturb_normal
- GLEW_EXT_texture_perturb_normal = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_perturb_normal");
- if (glewExperimental || GLEW_EXT_texture_perturb_normal) GLEW_EXT_texture_perturb_normal = !_glewInit_GL_EXT_texture_perturb_normal(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_texture_perturb_normal */
-#ifdef GL_EXT_texture_rectangle
- GLEW_EXT_texture_rectangle = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_rectangle");
-#endif /* GL_EXT_texture_rectangle */
-#ifdef GL_EXT_texture_sRGB
- GLEW_EXT_texture_sRGB = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_sRGB");
-#endif /* GL_EXT_texture_sRGB */
-#ifdef GL_EXT_texture_sRGB_decode
- GLEW_EXT_texture_sRGB_decode = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_sRGB_decode");
-#endif /* GL_EXT_texture_sRGB_decode */
-#ifdef GL_EXT_texture_shared_exponent
- GLEW_EXT_texture_shared_exponent = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_shared_exponent");
-#endif /* GL_EXT_texture_shared_exponent */
-#ifdef GL_EXT_texture_snorm
- GLEW_EXT_texture_snorm = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_snorm");
-#endif /* GL_EXT_texture_snorm */
-#ifdef GL_EXT_texture_swizzle
- GLEW_EXT_texture_swizzle = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_texture_swizzle");
-#endif /* GL_EXT_texture_swizzle */
-#ifdef GL_EXT_timer_query
- GLEW_EXT_timer_query = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_timer_query");
- if (glewExperimental || GLEW_EXT_timer_query) GLEW_EXT_timer_query = !_glewInit_GL_EXT_timer_query(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_timer_query */
-#ifdef GL_EXT_transform_feedback
- GLEW_EXT_transform_feedback = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_transform_feedback");
- if (glewExperimental || GLEW_EXT_transform_feedback) GLEW_EXT_transform_feedback = !_glewInit_GL_EXT_transform_feedback(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_transform_feedback */
-#ifdef GL_EXT_vertex_array
- GLEW_EXT_vertex_array = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_vertex_array");
- if (glewExperimental || GLEW_EXT_vertex_array) GLEW_EXT_vertex_array = !_glewInit_GL_EXT_vertex_array(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_vertex_array */
-#ifdef GL_EXT_vertex_array_bgra
- GLEW_EXT_vertex_array_bgra = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_vertex_array_bgra");
-#endif /* GL_EXT_vertex_array_bgra */
-#ifdef GL_EXT_vertex_attrib_64bit
- GLEW_EXT_vertex_attrib_64bit = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_vertex_attrib_64bit");
- if (glewExperimental || GLEW_EXT_vertex_attrib_64bit) GLEW_EXT_vertex_attrib_64bit = !_glewInit_GL_EXT_vertex_attrib_64bit(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_vertex_attrib_64bit */
-#ifdef GL_EXT_vertex_shader
- GLEW_EXT_vertex_shader = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_vertex_shader");
- if (glewExperimental || GLEW_EXT_vertex_shader) GLEW_EXT_vertex_shader = !_glewInit_GL_EXT_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_vertex_shader */
-#ifdef GL_EXT_vertex_weighting
- GLEW_EXT_vertex_weighting = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_vertex_weighting");
- if (glewExperimental || GLEW_EXT_vertex_weighting) GLEW_EXT_vertex_weighting = !_glewInit_GL_EXT_vertex_weighting(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_vertex_weighting */
-#ifdef GL_EXT_x11_sync_object
- GLEW_EXT_x11_sync_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_EXT_x11_sync_object");
- if (glewExperimental || GLEW_EXT_x11_sync_object) GLEW_EXT_x11_sync_object = !_glewInit_GL_EXT_x11_sync_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_EXT_x11_sync_object */
-#ifdef GL_GREMEDY_frame_terminator
- GLEW_GREMEDY_frame_terminator = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_GREMEDY_frame_terminator");
- if (glewExperimental || GLEW_GREMEDY_frame_terminator) GLEW_GREMEDY_frame_terminator = !_glewInit_GL_GREMEDY_frame_terminator(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_GREMEDY_frame_terminator */
-#ifdef GL_GREMEDY_string_marker
- GLEW_GREMEDY_string_marker = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_GREMEDY_string_marker");
- if (glewExperimental || GLEW_GREMEDY_string_marker) GLEW_GREMEDY_string_marker = !_glewInit_GL_GREMEDY_string_marker(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_GREMEDY_string_marker */
-#ifdef GL_HP_convolution_border_modes
- GLEW_HP_convolution_border_modes = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_HP_convolution_border_modes");
-#endif /* GL_HP_convolution_border_modes */
-#ifdef GL_HP_image_transform
- GLEW_HP_image_transform = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_HP_image_transform");
- if (glewExperimental || GLEW_HP_image_transform) GLEW_HP_image_transform = !_glewInit_GL_HP_image_transform(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_HP_image_transform */
-#ifdef GL_HP_occlusion_test
- GLEW_HP_occlusion_test = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_HP_occlusion_test");
-#endif /* GL_HP_occlusion_test */
-#ifdef GL_HP_texture_lighting
- GLEW_HP_texture_lighting = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_HP_texture_lighting");
-#endif /* GL_HP_texture_lighting */
-#ifdef GL_IBM_cull_vertex
- GLEW_IBM_cull_vertex = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_IBM_cull_vertex");
-#endif /* GL_IBM_cull_vertex */
-#ifdef GL_IBM_multimode_draw_arrays
- GLEW_IBM_multimode_draw_arrays = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_IBM_multimode_draw_arrays");
- if (glewExperimental || GLEW_IBM_multimode_draw_arrays) GLEW_IBM_multimode_draw_arrays = !_glewInit_GL_IBM_multimode_draw_arrays(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_IBM_multimode_draw_arrays */
-#ifdef GL_IBM_rasterpos_clip
- GLEW_IBM_rasterpos_clip = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_IBM_rasterpos_clip");
-#endif /* GL_IBM_rasterpos_clip */
-#ifdef GL_IBM_static_data
- GLEW_IBM_static_data = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_IBM_static_data");
-#endif /* GL_IBM_static_data */
-#ifdef GL_IBM_texture_mirrored_repeat
- GLEW_IBM_texture_mirrored_repeat = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_IBM_texture_mirrored_repeat");
-#endif /* GL_IBM_texture_mirrored_repeat */
-#ifdef GL_IBM_vertex_array_lists
- GLEW_IBM_vertex_array_lists = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_IBM_vertex_array_lists");
- if (glewExperimental || GLEW_IBM_vertex_array_lists) GLEW_IBM_vertex_array_lists = !_glewInit_GL_IBM_vertex_array_lists(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_IBM_vertex_array_lists */
-#ifdef GL_INGR_color_clamp
- GLEW_INGR_color_clamp = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_INGR_color_clamp");
-#endif /* GL_INGR_color_clamp */
-#ifdef GL_INGR_interlace_read
- GLEW_INGR_interlace_read = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_INGR_interlace_read");
-#endif /* GL_INGR_interlace_read */
-#ifdef GL_INTEL_fragment_shader_ordering
- GLEW_INTEL_fragment_shader_ordering = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_INTEL_fragment_shader_ordering");
-#endif /* GL_INTEL_fragment_shader_ordering */
-#ifdef GL_INTEL_map_texture
- GLEW_INTEL_map_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_INTEL_map_texture");
- if (glewExperimental || GLEW_INTEL_map_texture) GLEW_INTEL_map_texture = !_glewInit_GL_INTEL_map_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_INTEL_map_texture */
-#ifdef GL_INTEL_parallel_arrays
- GLEW_INTEL_parallel_arrays = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_INTEL_parallel_arrays");
- if (glewExperimental || GLEW_INTEL_parallel_arrays) GLEW_INTEL_parallel_arrays = !_glewInit_GL_INTEL_parallel_arrays(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_INTEL_parallel_arrays */
-#ifdef GL_INTEL_performance_query
- GLEW_INTEL_performance_query = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_INTEL_performance_query");
- if (glewExperimental || GLEW_INTEL_performance_query) GLEW_INTEL_performance_query = !_glewInit_GL_INTEL_performance_query(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_INTEL_performance_query */
-#ifdef GL_INTEL_texture_scissor
- GLEW_INTEL_texture_scissor = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_INTEL_texture_scissor");
- if (glewExperimental || GLEW_INTEL_texture_scissor) GLEW_INTEL_texture_scissor = !_glewInit_GL_INTEL_texture_scissor(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_INTEL_texture_scissor */
-#ifdef GL_KHR_blend_equation_advanced
- GLEW_KHR_blend_equation_advanced = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_KHR_blend_equation_advanced");
- if (glewExperimental || GLEW_KHR_blend_equation_advanced) GLEW_KHR_blend_equation_advanced = !_glewInit_GL_KHR_blend_equation_advanced(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_KHR_blend_equation_advanced */
-#ifdef GL_KHR_blend_equation_advanced_coherent
- GLEW_KHR_blend_equation_advanced_coherent = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_KHR_blend_equation_advanced_coherent");
-#endif /* GL_KHR_blend_equation_advanced_coherent */
-#ifdef GL_KHR_context_flush_control
- GLEW_KHR_context_flush_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_KHR_context_flush_control");
-#endif /* GL_KHR_context_flush_control */
-#ifdef GL_KHR_debug
- GLEW_KHR_debug = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_KHR_debug");
- if (glewExperimental || GLEW_KHR_debug) GLEW_KHR_debug = !_glewInit_GL_KHR_debug(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_KHR_debug */
-#ifdef GL_KHR_robust_buffer_access_behavior
- GLEW_KHR_robust_buffer_access_behavior = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_KHR_robust_buffer_access_behavior");
-#endif /* GL_KHR_robust_buffer_access_behavior */
-#ifdef GL_KHR_robustness
- GLEW_KHR_robustness = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_KHR_robustness");
- if (glewExperimental || GLEW_KHR_robustness) GLEW_KHR_robustness = !_glewInit_GL_KHR_robustness(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_KHR_robustness */
-#ifdef GL_KHR_texture_compression_astc_hdr
- GLEW_KHR_texture_compression_astc_hdr = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_KHR_texture_compression_astc_hdr");
-#endif /* GL_KHR_texture_compression_astc_hdr */
-#ifdef GL_KHR_texture_compression_astc_ldr
- GLEW_KHR_texture_compression_astc_ldr = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_KHR_texture_compression_astc_ldr");
-#endif /* GL_KHR_texture_compression_astc_ldr */
-#ifdef GL_KTX_buffer_region
- GLEW_KTX_buffer_region = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_KTX_buffer_region");
- if (glewExperimental || GLEW_KTX_buffer_region) GLEW_KTX_buffer_region = !_glewInit_GL_KTX_buffer_region(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_KTX_buffer_region */
-#ifdef GL_MESAX_texture_stack
- GLEW_MESAX_texture_stack = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_MESAX_texture_stack");
-#endif /* GL_MESAX_texture_stack */
-#ifdef GL_MESA_pack_invert
- GLEW_MESA_pack_invert = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_MESA_pack_invert");
-#endif /* GL_MESA_pack_invert */
-#ifdef GL_MESA_resize_buffers
- GLEW_MESA_resize_buffers = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_MESA_resize_buffers");
- if (glewExperimental || GLEW_MESA_resize_buffers) GLEW_MESA_resize_buffers = !_glewInit_GL_MESA_resize_buffers(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_MESA_resize_buffers */
-#ifdef GL_MESA_window_pos
- GLEW_MESA_window_pos = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_MESA_window_pos");
- if (glewExperimental || GLEW_MESA_window_pos) GLEW_MESA_window_pos = !_glewInit_GL_MESA_window_pos(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_MESA_window_pos */
-#ifdef GL_MESA_ycbcr_texture
- GLEW_MESA_ycbcr_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_MESA_ycbcr_texture");
-#endif /* GL_MESA_ycbcr_texture */
-#ifdef GL_NVX_conditional_render
- GLEW_NVX_conditional_render = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NVX_conditional_render");
- if (glewExperimental || GLEW_NVX_conditional_render) GLEW_NVX_conditional_render = !_glewInit_GL_NVX_conditional_render(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NVX_conditional_render */
-#ifdef GL_NVX_gpu_memory_info
- GLEW_NVX_gpu_memory_info = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NVX_gpu_memory_info");
-#endif /* GL_NVX_gpu_memory_info */
-#ifdef GL_NV_bindless_multi_draw_indirect
- GLEW_NV_bindless_multi_draw_indirect = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_bindless_multi_draw_indirect");
- if (glewExperimental || GLEW_NV_bindless_multi_draw_indirect) GLEW_NV_bindless_multi_draw_indirect = !_glewInit_GL_NV_bindless_multi_draw_indirect(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_bindless_multi_draw_indirect */
-#ifdef GL_NV_bindless_multi_draw_indirect_count
- GLEW_NV_bindless_multi_draw_indirect_count = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_bindless_multi_draw_indirect_count");
- if (glewExperimental || GLEW_NV_bindless_multi_draw_indirect_count) GLEW_NV_bindless_multi_draw_indirect_count = !_glewInit_GL_NV_bindless_multi_draw_indirect_count(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_bindless_multi_draw_indirect_count */
-#ifdef GL_NV_bindless_texture
- GLEW_NV_bindless_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_bindless_texture");
- if (glewExperimental || GLEW_NV_bindless_texture) GLEW_NV_bindless_texture = !_glewInit_GL_NV_bindless_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_bindless_texture */
-#ifdef GL_NV_blend_equation_advanced
- GLEW_NV_blend_equation_advanced = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_blend_equation_advanced");
- if (glewExperimental || GLEW_NV_blend_equation_advanced) GLEW_NV_blend_equation_advanced = !_glewInit_GL_NV_blend_equation_advanced(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_blend_equation_advanced */
-#ifdef GL_NV_blend_equation_advanced_coherent
- GLEW_NV_blend_equation_advanced_coherent = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_blend_equation_advanced_coherent");
-#endif /* GL_NV_blend_equation_advanced_coherent */
-#ifdef GL_NV_blend_square
- GLEW_NV_blend_square = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_blend_square");
-#endif /* GL_NV_blend_square */
-#ifdef GL_NV_compute_program5
- GLEW_NV_compute_program5 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_compute_program5");
-#endif /* GL_NV_compute_program5 */
-#ifdef GL_NV_conditional_render
- GLEW_NV_conditional_render = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_conditional_render");
- if (glewExperimental || GLEW_NV_conditional_render) GLEW_NV_conditional_render = !_glewInit_GL_NV_conditional_render(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_conditional_render */
-#ifdef GL_NV_conservative_raster
- GLEW_NV_conservative_raster = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_conservative_raster");
- if (glewExperimental || GLEW_NV_conservative_raster) GLEW_NV_conservative_raster = !_glewInit_GL_NV_conservative_raster(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_conservative_raster */
-#ifdef GL_NV_copy_depth_to_color
- GLEW_NV_copy_depth_to_color = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_copy_depth_to_color");
-#endif /* GL_NV_copy_depth_to_color */
-#ifdef GL_NV_copy_image
- GLEW_NV_copy_image = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_copy_image");
- if (glewExperimental || GLEW_NV_copy_image) GLEW_NV_copy_image = !_glewInit_GL_NV_copy_image(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_copy_image */
-#ifdef GL_NV_deep_texture3D
- GLEW_NV_deep_texture3D = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_deep_texture3D");
-#endif /* GL_NV_deep_texture3D */
-#ifdef GL_NV_depth_buffer_float
- GLEW_NV_depth_buffer_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_depth_buffer_float");
- if (glewExperimental || GLEW_NV_depth_buffer_float) GLEW_NV_depth_buffer_float = !_glewInit_GL_NV_depth_buffer_float(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_depth_buffer_float */
-#ifdef GL_NV_depth_clamp
- GLEW_NV_depth_clamp = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_depth_clamp");
-#endif /* GL_NV_depth_clamp */
-#ifdef GL_NV_depth_range_unclamped
- GLEW_NV_depth_range_unclamped = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_depth_range_unclamped");
-#endif /* GL_NV_depth_range_unclamped */
-#ifdef GL_NV_draw_texture
- GLEW_NV_draw_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_draw_texture");
- if (glewExperimental || GLEW_NV_draw_texture) GLEW_NV_draw_texture = !_glewInit_GL_NV_draw_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_draw_texture */
-#ifdef GL_NV_evaluators
- GLEW_NV_evaluators = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_evaluators");
- if (glewExperimental || GLEW_NV_evaluators) GLEW_NV_evaluators = !_glewInit_GL_NV_evaluators(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_evaluators */
-#ifdef GL_NV_explicit_multisample
- GLEW_NV_explicit_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_explicit_multisample");
- if (glewExperimental || GLEW_NV_explicit_multisample) GLEW_NV_explicit_multisample = !_glewInit_GL_NV_explicit_multisample(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_explicit_multisample */
-#ifdef GL_NV_fence
- GLEW_NV_fence = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_fence");
- if (glewExperimental || GLEW_NV_fence) GLEW_NV_fence = !_glewInit_GL_NV_fence(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_fence */
-#ifdef GL_NV_fill_rectangle
- GLEW_NV_fill_rectangle = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_fill_rectangle");
-#endif /* GL_NV_fill_rectangle */
-#ifdef GL_NV_float_buffer
- GLEW_NV_float_buffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_float_buffer");
-#endif /* GL_NV_float_buffer */
-#ifdef GL_NV_fog_distance
- GLEW_NV_fog_distance = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_fog_distance");
-#endif /* GL_NV_fog_distance */
-#ifdef GL_NV_fragment_coverage_to_color
- GLEW_NV_fragment_coverage_to_color = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_fragment_coverage_to_color");
- if (glewExperimental || GLEW_NV_fragment_coverage_to_color) GLEW_NV_fragment_coverage_to_color = !_glewInit_GL_NV_fragment_coverage_to_color(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_fragment_coverage_to_color */
-#ifdef GL_NV_fragment_program
- GLEW_NV_fragment_program = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_fragment_program");
- if (glewExperimental || GLEW_NV_fragment_program) GLEW_NV_fragment_program = !_glewInit_GL_NV_fragment_program(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_fragment_program */
-#ifdef GL_NV_fragment_program2
- GLEW_NV_fragment_program2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_fragment_program2");
-#endif /* GL_NV_fragment_program2 */
-#ifdef GL_NV_fragment_program4
- GLEW_NV_fragment_program4 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_gpu_program4");
-#endif /* GL_NV_fragment_program4 */
-#ifdef GL_NV_fragment_program_option
- GLEW_NV_fragment_program_option = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_fragment_program_option");
-#endif /* GL_NV_fragment_program_option */
-#ifdef GL_NV_fragment_shader_interlock
- GLEW_NV_fragment_shader_interlock = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_fragment_shader_interlock");
-#endif /* GL_NV_fragment_shader_interlock */
-#ifdef GL_NV_framebuffer_mixed_samples
- GLEW_NV_framebuffer_mixed_samples = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_framebuffer_mixed_samples");
-#endif /* GL_NV_framebuffer_mixed_samples */
-#ifdef GL_NV_framebuffer_multisample_coverage
- GLEW_NV_framebuffer_multisample_coverage = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_framebuffer_multisample_coverage");
- if (glewExperimental || GLEW_NV_framebuffer_multisample_coverage) GLEW_NV_framebuffer_multisample_coverage = !_glewInit_GL_NV_framebuffer_multisample_coverage(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_framebuffer_multisample_coverage */
-#ifdef GL_NV_geometry_program4
- GLEW_NV_geometry_program4 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_gpu_program4");
- if (glewExperimental || GLEW_NV_geometry_program4) GLEW_NV_geometry_program4 = !_glewInit_GL_NV_geometry_program4(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_geometry_program4 */
-#ifdef GL_NV_geometry_shader4
- GLEW_NV_geometry_shader4 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_geometry_shader4");
-#endif /* GL_NV_geometry_shader4 */
-#ifdef GL_NV_geometry_shader_passthrough
- GLEW_NV_geometry_shader_passthrough = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_geometry_shader_passthrough");
-#endif /* GL_NV_geometry_shader_passthrough */
-#ifdef GL_NV_gpu_program4
- GLEW_NV_gpu_program4 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_gpu_program4");
- if (glewExperimental || GLEW_NV_gpu_program4) GLEW_NV_gpu_program4 = !_glewInit_GL_NV_gpu_program4(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_gpu_program4 */
-#ifdef GL_NV_gpu_program5
- GLEW_NV_gpu_program5 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_gpu_program5");
-#endif /* GL_NV_gpu_program5 */
-#ifdef GL_NV_gpu_program5_mem_extended
- GLEW_NV_gpu_program5_mem_extended = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_gpu_program5_mem_extended");
-#endif /* GL_NV_gpu_program5_mem_extended */
-#ifdef GL_NV_gpu_program_fp64
- GLEW_NV_gpu_program_fp64 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_gpu_program_fp64");
-#endif /* GL_NV_gpu_program_fp64 */
-#ifdef GL_NV_gpu_shader5
- GLEW_NV_gpu_shader5 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_gpu_shader5");
- if (glewExperimental || GLEW_NV_gpu_shader5) GLEW_NV_gpu_shader5 = !_glewInit_GL_NV_gpu_shader5(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_gpu_shader5 */
-#ifdef GL_NV_half_float
- GLEW_NV_half_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_half_float");
- if (glewExperimental || GLEW_NV_half_float) GLEW_NV_half_float = !_glewInit_GL_NV_half_float(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_half_float */
-#ifdef GL_NV_internalformat_sample_query
- GLEW_NV_internalformat_sample_query = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_internalformat_sample_query");
- if (glewExperimental || GLEW_NV_internalformat_sample_query) GLEW_NV_internalformat_sample_query = !_glewInit_GL_NV_internalformat_sample_query(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_internalformat_sample_query */
-#ifdef GL_NV_light_max_exponent
- GLEW_NV_light_max_exponent = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_light_max_exponent");
-#endif /* GL_NV_light_max_exponent */
-#ifdef GL_NV_multisample_coverage
- GLEW_NV_multisample_coverage = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_multisample_coverage");
-#endif /* GL_NV_multisample_coverage */
-#ifdef GL_NV_multisample_filter_hint
- GLEW_NV_multisample_filter_hint = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_multisample_filter_hint");
-#endif /* GL_NV_multisample_filter_hint */
-#ifdef GL_NV_occlusion_query
- GLEW_NV_occlusion_query = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_occlusion_query");
- if (glewExperimental || GLEW_NV_occlusion_query) GLEW_NV_occlusion_query = !_glewInit_GL_NV_occlusion_query(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_occlusion_query */
-#ifdef GL_NV_packed_depth_stencil
- GLEW_NV_packed_depth_stencil = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_packed_depth_stencil");
-#endif /* GL_NV_packed_depth_stencil */
-#ifdef GL_NV_parameter_buffer_object
- GLEW_NV_parameter_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_parameter_buffer_object");
- if (glewExperimental || GLEW_NV_parameter_buffer_object) GLEW_NV_parameter_buffer_object = !_glewInit_GL_NV_parameter_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_parameter_buffer_object */
-#ifdef GL_NV_parameter_buffer_object2
- GLEW_NV_parameter_buffer_object2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_parameter_buffer_object2");
-#endif /* GL_NV_parameter_buffer_object2 */
-#ifdef GL_NV_path_rendering
- GLEW_NV_path_rendering = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_path_rendering");
- if (glewExperimental || GLEW_NV_path_rendering) GLEW_NV_path_rendering = !_glewInit_GL_NV_path_rendering(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_path_rendering */
-#ifdef GL_NV_path_rendering_shared_edge
- GLEW_NV_path_rendering_shared_edge = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_path_rendering_shared_edge");
-#endif /* GL_NV_path_rendering_shared_edge */
-#ifdef GL_NV_pixel_data_range
- GLEW_NV_pixel_data_range = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_pixel_data_range");
- if (glewExperimental || GLEW_NV_pixel_data_range) GLEW_NV_pixel_data_range = !_glewInit_GL_NV_pixel_data_range(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_pixel_data_range */
-#ifdef GL_NV_point_sprite
- GLEW_NV_point_sprite = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_point_sprite");
- if (glewExperimental || GLEW_NV_point_sprite) GLEW_NV_point_sprite = !_glewInit_GL_NV_point_sprite(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_point_sprite */
-#ifdef GL_NV_present_video
- GLEW_NV_present_video = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_present_video");
- if (glewExperimental || GLEW_NV_present_video) GLEW_NV_present_video = !_glewInit_GL_NV_present_video(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_present_video */
-#ifdef GL_NV_primitive_restart
- GLEW_NV_primitive_restart = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_primitive_restart");
- if (glewExperimental || GLEW_NV_primitive_restart) GLEW_NV_primitive_restart = !_glewInit_GL_NV_primitive_restart(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_primitive_restart */
-#ifdef GL_NV_register_combiners
- GLEW_NV_register_combiners = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_register_combiners");
- if (glewExperimental || GLEW_NV_register_combiners) GLEW_NV_register_combiners = !_glewInit_GL_NV_register_combiners(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_register_combiners */
-#ifdef GL_NV_register_combiners2
- GLEW_NV_register_combiners2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_register_combiners2");
- if (glewExperimental || GLEW_NV_register_combiners2) GLEW_NV_register_combiners2 = !_glewInit_GL_NV_register_combiners2(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_register_combiners2 */
-#ifdef GL_NV_sample_locations
- GLEW_NV_sample_locations = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_sample_locations");
- if (glewExperimental || GLEW_NV_sample_locations) GLEW_NV_sample_locations = !_glewInit_GL_NV_sample_locations(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_sample_locations */
-#ifdef GL_NV_sample_mask_override_coverage
- GLEW_NV_sample_mask_override_coverage = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_sample_mask_override_coverage");
-#endif /* GL_NV_sample_mask_override_coverage */
-#ifdef GL_NV_shader_atomic_counters
- GLEW_NV_shader_atomic_counters = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_shader_atomic_counters");
-#endif /* GL_NV_shader_atomic_counters */
-#ifdef GL_NV_shader_atomic_float
- GLEW_NV_shader_atomic_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_shader_atomic_float");
-#endif /* GL_NV_shader_atomic_float */
-#ifdef GL_NV_shader_atomic_fp16_vector
- GLEW_NV_shader_atomic_fp16_vector = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_shader_atomic_fp16_vector");
-#endif /* GL_NV_shader_atomic_fp16_vector */
-#ifdef GL_NV_shader_atomic_int64
- GLEW_NV_shader_atomic_int64 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_shader_atomic_int64");
-#endif /* GL_NV_shader_atomic_int64 */
-#ifdef GL_NV_shader_buffer_load
- GLEW_NV_shader_buffer_load = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_shader_buffer_load");
- if (glewExperimental || GLEW_NV_shader_buffer_load) GLEW_NV_shader_buffer_load = !_glewInit_GL_NV_shader_buffer_load(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_shader_buffer_load */
-#ifdef GL_NV_shader_storage_buffer_object
- GLEW_NV_shader_storage_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_shader_storage_buffer_object");
-#endif /* GL_NV_shader_storage_buffer_object */
-#ifdef GL_NV_shader_thread_group
- GLEW_NV_shader_thread_group = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_shader_thread_group");
-#endif /* GL_NV_shader_thread_group */
-#ifdef GL_NV_shader_thread_shuffle
- GLEW_NV_shader_thread_shuffle = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_shader_thread_shuffle");
-#endif /* GL_NV_shader_thread_shuffle */
-#ifdef GL_NV_tessellation_program5
- GLEW_NV_tessellation_program5 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_gpu_program5");
-#endif /* GL_NV_tessellation_program5 */
-#ifdef GL_NV_texgen_emboss
- GLEW_NV_texgen_emboss = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_texgen_emboss");
-#endif /* GL_NV_texgen_emboss */
-#ifdef GL_NV_texgen_reflection
- GLEW_NV_texgen_reflection = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_texgen_reflection");
-#endif /* GL_NV_texgen_reflection */
-#ifdef GL_NV_texture_barrier
- GLEW_NV_texture_barrier = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_texture_barrier");
- if (glewExperimental || GLEW_NV_texture_barrier) GLEW_NV_texture_barrier = !_glewInit_GL_NV_texture_barrier(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_texture_barrier */
-#ifdef GL_NV_texture_compression_vtc
- GLEW_NV_texture_compression_vtc = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_texture_compression_vtc");
-#endif /* GL_NV_texture_compression_vtc */
-#ifdef GL_NV_texture_env_combine4
- GLEW_NV_texture_env_combine4 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_texture_env_combine4");
-#endif /* GL_NV_texture_env_combine4 */
-#ifdef GL_NV_texture_expand_normal
- GLEW_NV_texture_expand_normal = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_texture_expand_normal");
-#endif /* GL_NV_texture_expand_normal */
-#ifdef GL_NV_texture_multisample
- GLEW_NV_texture_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_texture_multisample");
- if (glewExperimental || GLEW_NV_texture_multisample) GLEW_NV_texture_multisample = !_glewInit_GL_NV_texture_multisample(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_texture_multisample */
-#ifdef GL_NV_texture_rectangle
- GLEW_NV_texture_rectangle = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_texture_rectangle");
-#endif /* GL_NV_texture_rectangle */
-#ifdef GL_NV_texture_shader
- GLEW_NV_texture_shader = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_texture_shader");
-#endif /* GL_NV_texture_shader */
-#ifdef GL_NV_texture_shader2
- GLEW_NV_texture_shader2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_texture_shader2");
-#endif /* GL_NV_texture_shader2 */
-#ifdef GL_NV_texture_shader3
- GLEW_NV_texture_shader3 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_texture_shader3");
-#endif /* GL_NV_texture_shader3 */
-#ifdef GL_NV_transform_feedback
- GLEW_NV_transform_feedback = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_transform_feedback");
- if (glewExperimental || GLEW_NV_transform_feedback) GLEW_NV_transform_feedback = !_glewInit_GL_NV_transform_feedback(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_transform_feedback */
-#ifdef GL_NV_transform_feedback2
- GLEW_NV_transform_feedback2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_transform_feedback2");
- if (glewExperimental || GLEW_NV_transform_feedback2) GLEW_NV_transform_feedback2 = !_glewInit_GL_NV_transform_feedback2(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_transform_feedback2 */
-#ifdef GL_NV_uniform_buffer_unified_memory
- GLEW_NV_uniform_buffer_unified_memory = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_uniform_buffer_unified_memory");
-#endif /* GL_NV_uniform_buffer_unified_memory */
-#ifdef GL_NV_vdpau_interop
- GLEW_NV_vdpau_interop = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_vdpau_interop");
- if (glewExperimental || GLEW_NV_vdpau_interop) GLEW_NV_vdpau_interop = !_glewInit_GL_NV_vdpau_interop(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_vdpau_interop */
-#ifdef GL_NV_vertex_array_range
- GLEW_NV_vertex_array_range = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_vertex_array_range");
- if (glewExperimental || GLEW_NV_vertex_array_range) GLEW_NV_vertex_array_range = !_glewInit_GL_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_vertex_array_range */
-#ifdef GL_NV_vertex_array_range2
- GLEW_NV_vertex_array_range2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_vertex_array_range2");
-#endif /* GL_NV_vertex_array_range2 */
-#ifdef GL_NV_vertex_attrib_integer_64bit
- GLEW_NV_vertex_attrib_integer_64bit = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_vertex_attrib_integer_64bit");
- if (glewExperimental || GLEW_NV_vertex_attrib_integer_64bit) GLEW_NV_vertex_attrib_integer_64bit = !_glewInit_GL_NV_vertex_attrib_integer_64bit(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_vertex_attrib_integer_64bit */
-#ifdef GL_NV_vertex_buffer_unified_memory
- GLEW_NV_vertex_buffer_unified_memory = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_vertex_buffer_unified_memory");
- if (glewExperimental || GLEW_NV_vertex_buffer_unified_memory) GLEW_NV_vertex_buffer_unified_memory = !_glewInit_GL_NV_vertex_buffer_unified_memory(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_vertex_buffer_unified_memory */
-#ifdef GL_NV_vertex_program
- GLEW_NV_vertex_program = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_vertex_program");
- if (glewExperimental || GLEW_NV_vertex_program) GLEW_NV_vertex_program = !_glewInit_GL_NV_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_vertex_program */
-#ifdef GL_NV_vertex_program1_1
- GLEW_NV_vertex_program1_1 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_vertex_program1_1");
-#endif /* GL_NV_vertex_program1_1 */
-#ifdef GL_NV_vertex_program2
- GLEW_NV_vertex_program2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_vertex_program2");
-#endif /* GL_NV_vertex_program2 */
-#ifdef GL_NV_vertex_program2_option
- GLEW_NV_vertex_program2_option = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_vertex_program2_option");
-#endif /* GL_NV_vertex_program2_option */
-#ifdef GL_NV_vertex_program3
- GLEW_NV_vertex_program3 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_vertex_program3");
-#endif /* GL_NV_vertex_program3 */
-#ifdef GL_NV_vertex_program4
- GLEW_NV_vertex_program4 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_gpu_program4");
-#endif /* GL_NV_vertex_program4 */
-#ifdef GL_NV_video_capture
- GLEW_NV_video_capture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_NV_video_capture");
- if (glewExperimental || GLEW_NV_video_capture) GLEW_NV_video_capture = !_glewInit_GL_NV_video_capture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_NV_video_capture */
-#ifdef GL_OES_byte_coordinates
- GLEW_OES_byte_coordinates = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_OES_byte_coordinates");
-#endif /* GL_OES_byte_coordinates */
-#ifdef GL_OES_compressed_paletted_texture
- GLEW_OES_compressed_paletted_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_OES_compressed_paletted_texture");
-#endif /* GL_OES_compressed_paletted_texture */
-#ifdef GL_OES_read_format
- GLEW_OES_read_format = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_OES_read_format");
-#endif /* GL_OES_read_format */
-#ifdef GL_OES_single_precision
- GLEW_OES_single_precision = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_OES_single_precision");
- if (glewExperimental || GLEW_OES_single_precision) GLEW_OES_single_precision = !_glewInit_GL_OES_single_precision(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_OES_single_precision */
-#ifdef GL_OML_interlace
- GLEW_OML_interlace = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_OML_interlace");
-#endif /* GL_OML_interlace */
-#ifdef GL_OML_resample
- GLEW_OML_resample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_OML_resample");
-#endif /* GL_OML_resample */
-#ifdef GL_OML_subsample
- GLEW_OML_subsample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_OML_subsample");
-#endif /* GL_OML_subsample */
-#ifdef GL_PGI_misc_hints
- GLEW_PGI_misc_hints = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_PGI_misc_hints");
-#endif /* GL_PGI_misc_hints */
-#ifdef GL_PGI_vertex_hints
- GLEW_PGI_vertex_hints = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_PGI_vertex_hints");
-#endif /* GL_PGI_vertex_hints */
-#ifdef GL_REGAL_ES1_0_compatibility
- GLEW_REGAL_ES1_0_compatibility = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_REGAL_ES1_0_compatibility");
- if (glewExperimental || GLEW_REGAL_ES1_0_compatibility) GLEW_REGAL_ES1_0_compatibility = !_glewInit_GL_REGAL_ES1_0_compatibility(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_REGAL_ES1_0_compatibility */
-#ifdef GL_REGAL_ES1_1_compatibility
- GLEW_REGAL_ES1_1_compatibility = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_REGAL_ES1_1_compatibility");
- if (glewExperimental || GLEW_REGAL_ES1_1_compatibility) GLEW_REGAL_ES1_1_compatibility = !_glewInit_GL_REGAL_ES1_1_compatibility(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_REGAL_ES1_1_compatibility */
-#ifdef GL_REGAL_enable
- GLEW_REGAL_enable = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_REGAL_enable");
-#endif /* GL_REGAL_enable */
-#ifdef GL_REGAL_error_string
- GLEW_REGAL_error_string = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_REGAL_error_string");
- if (glewExperimental || GLEW_REGAL_error_string) GLEW_REGAL_error_string = !_glewInit_GL_REGAL_error_string(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_REGAL_error_string */
-#ifdef GL_REGAL_extension_query
- GLEW_REGAL_extension_query = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_REGAL_extension_query");
- if (glewExperimental || GLEW_REGAL_extension_query) GLEW_REGAL_extension_query = !_glewInit_GL_REGAL_extension_query(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_REGAL_extension_query */
-#ifdef GL_REGAL_log
- GLEW_REGAL_log = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_REGAL_log");
- if (glewExperimental || GLEW_REGAL_log) GLEW_REGAL_log = !_glewInit_GL_REGAL_log(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_REGAL_log */
-#ifdef GL_REGAL_proc_address
- GLEW_REGAL_proc_address = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_REGAL_proc_address");
- if (glewExperimental || GLEW_REGAL_proc_address) GLEW_REGAL_proc_address = !_glewInit_GL_REGAL_proc_address(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_REGAL_proc_address */
-#ifdef GL_REND_screen_coordinates
- GLEW_REND_screen_coordinates = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_REND_screen_coordinates");
-#endif /* GL_REND_screen_coordinates */
-#ifdef GL_S3_s3tc
- GLEW_S3_s3tc = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_S3_s3tc");
-#endif /* GL_S3_s3tc */
-#ifdef GL_SGIS_color_range
- GLEW_SGIS_color_range = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_color_range");
-#endif /* GL_SGIS_color_range */
-#ifdef GL_SGIS_detail_texture
- GLEW_SGIS_detail_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_detail_texture");
- if (glewExperimental || GLEW_SGIS_detail_texture) GLEW_SGIS_detail_texture = !_glewInit_GL_SGIS_detail_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIS_detail_texture */
-#ifdef GL_SGIS_fog_function
- GLEW_SGIS_fog_function = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_fog_function");
- if (glewExperimental || GLEW_SGIS_fog_function) GLEW_SGIS_fog_function = !_glewInit_GL_SGIS_fog_function(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIS_fog_function */
-#ifdef GL_SGIS_generate_mipmap
- GLEW_SGIS_generate_mipmap = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_generate_mipmap");
-#endif /* GL_SGIS_generate_mipmap */
-#ifdef GL_SGIS_multisample
- GLEW_SGIS_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_multisample");
- if (glewExperimental || GLEW_SGIS_multisample) GLEW_SGIS_multisample = !_glewInit_GL_SGIS_multisample(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIS_multisample */
-#ifdef GL_SGIS_pixel_texture
- GLEW_SGIS_pixel_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_pixel_texture");
-#endif /* GL_SGIS_pixel_texture */
-#ifdef GL_SGIS_point_line_texgen
- GLEW_SGIS_point_line_texgen = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_point_line_texgen");
-#endif /* GL_SGIS_point_line_texgen */
-#ifdef GL_SGIS_sharpen_texture
- GLEW_SGIS_sharpen_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_sharpen_texture");
- if (glewExperimental || GLEW_SGIS_sharpen_texture) GLEW_SGIS_sharpen_texture = !_glewInit_GL_SGIS_sharpen_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIS_sharpen_texture */
-#ifdef GL_SGIS_texture4D
- GLEW_SGIS_texture4D = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_texture4D");
- if (glewExperimental || GLEW_SGIS_texture4D) GLEW_SGIS_texture4D = !_glewInit_GL_SGIS_texture4D(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIS_texture4D */
-#ifdef GL_SGIS_texture_border_clamp
- GLEW_SGIS_texture_border_clamp = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_texture_border_clamp");
-#endif /* GL_SGIS_texture_border_clamp */
-#ifdef GL_SGIS_texture_edge_clamp
- GLEW_SGIS_texture_edge_clamp = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_texture_edge_clamp");
-#endif /* GL_SGIS_texture_edge_clamp */
-#ifdef GL_SGIS_texture_filter4
- GLEW_SGIS_texture_filter4 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_texture_filter4");
- if (glewExperimental || GLEW_SGIS_texture_filter4) GLEW_SGIS_texture_filter4 = !_glewInit_GL_SGIS_texture_filter4(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIS_texture_filter4 */
-#ifdef GL_SGIS_texture_lod
- GLEW_SGIS_texture_lod = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_texture_lod");
-#endif /* GL_SGIS_texture_lod */
-#ifdef GL_SGIS_texture_select
- GLEW_SGIS_texture_select = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIS_texture_select");
-#endif /* GL_SGIS_texture_select */
-#ifdef GL_SGIX_async
- GLEW_SGIX_async = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_async");
- if (glewExperimental || GLEW_SGIX_async) GLEW_SGIX_async = !_glewInit_GL_SGIX_async(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIX_async */
-#ifdef GL_SGIX_async_histogram
- GLEW_SGIX_async_histogram = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_async_histogram");
-#endif /* GL_SGIX_async_histogram */
-#ifdef GL_SGIX_async_pixel
- GLEW_SGIX_async_pixel = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_async_pixel");
-#endif /* GL_SGIX_async_pixel */
-#ifdef GL_SGIX_blend_alpha_minmax
- GLEW_SGIX_blend_alpha_minmax = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_blend_alpha_minmax");
-#endif /* GL_SGIX_blend_alpha_minmax */
-#ifdef GL_SGIX_clipmap
- GLEW_SGIX_clipmap = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_clipmap");
-#endif /* GL_SGIX_clipmap */
-#ifdef GL_SGIX_convolution_accuracy
- GLEW_SGIX_convolution_accuracy = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_convolution_accuracy");
-#endif /* GL_SGIX_convolution_accuracy */
-#ifdef GL_SGIX_depth_texture
- GLEW_SGIX_depth_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_depth_texture");
-#endif /* GL_SGIX_depth_texture */
-#ifdef GL_SGIX_flush_raster
- GLEW_SGIX_flush_raster = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_flush_raster");
- if (glewExperimental || GLEW_SGIX_flush_raster) GLEW_SGIX_flush_raster = !_glewInit_GL_SGIX_flush_raster(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIX_flush_raster */
-#ifdef GL_SGIX_fog_offset
- GLEW_SGIX_fog_offset = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_fog_offset");
-#endif /* GL_SGIX_fog_offset */
-#ifdef GL_SGIX_fog_texture
- GLEW_SGIX_fog_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_fog_texture");
- if (glewExperimental || GLEW_SGIX_fog_texture) GLEW_SGIX_fog_texture = !_glewInit_GL_SGIX_fog_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIX_fog_texture */
-#ifdef GL_SGIX_fragment_specular_lighting
- GLEW_SGIX_fragment_specular_lighting = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_fragment_specular_lighting");
- if (glewExperimental || GLEW_SGIX_fragment_specular_lighting) GLEW_SGIX_fragment_specular_lighting = !_glewInit_GL_SGIX_fragment_specular_lighting(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIX_fragment_specular_lighting */
-#ifdef GL_SGIX_framezoom
- GLEW_SGIX_framezoom = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_framezoom");
- if (glewExperimental || GLEW_SGIX_framezoom) GLEW_SGIX_framezoom = !_glewInit_GL_SGIX_framezoom(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIX_framezoom */
-#ifdef GL_SGIX_interlace
- GLEW_SGIX_interlace = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_interlace");
-#endif /* GL_SGIX_interlace */
-#ifdef GL_SGIX_ir_instrument1
- GLEW_SGIX_ir_instrument1 = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_ir_instrument1");
-#endif /* GL_SGIX_ir_instrument1 */
-#ifdef GL_SGIX_list_priority
- GLEW_SGIX_list_priority = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_list_priority");
-#endif /* GL_SGIX_list_priority */
-#ifdef GL_SGIX_pixel_texture
- GLEW_SGIX_pixel_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_pixel_texture");
- if (glewExperimental || GLEW_SGIX_pixel_texture) GLEW_SGIX_pixel_texture = !_glewInit_GL_SGIX_pixel_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIX_pixel_texture */
-#ifdef GL_SGIX_pixel_texture_bits
- GLEW_SGIX_pixel_texture_bits = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_pixel_texture_bits");
-#endif /* GL_SGIX_pixel_texture_bits */
-#ifdef GL_SGIX_reference_plane
- GLEW_SGIX_reference_plane = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_reference_plane");
- if (glewExperimental || GLEW_SGIX_reference_plane) GLEW_SGIX_reference_plane = !_glewInit_GL_SGIX_reference_plane(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIX_reference_plane */
-#ifdef GL_SGIX_resample
- GLEW_SGIX_resample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_resample");
-#endif /* GL_SGIX_resample */
-#ifdef GL_SGIX_shadow
- GLEW_SGIX_shadow = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_shadow");
-#endif /* GL_SGIX_shadow */
-#ifdef GL_SGIX_shadow_ambient
- GLEW_SGIX_shadow_ambient = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_shadow_ambient");
-#endif /* GL_SGIX_shadow_ambient */
-#ifdef GL_SGIX_sprite
- GLEW_SGIX_sprite = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_sprite");
- if (glewExperimental || GLEW_SGIX_sprite) GLEW_SGIX_sprite = !_glewInit_GL_SGIX_sprite(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIX_sprite */
-#ifdef GL_SGIX_tag_sample_buffer
- GLEW_SGIX_tag_sample_buffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_tag_sample_buffer");
- if (glewExperimental || GLEW_SGIX_tag_sample_buffer) GLEW_SGIX_tag_sample_buffer = !_glewInit_GL_SGIX_tag_sample_buffer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGIX_tag_sample_buffer */
-#ifdef GL_SGIX_texture_add_env
- GLEW_SGIX_texture_add_env = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_texture_add_env");
-#endif /* GL_SGIX_texture_add_env */
-#ifdef GL_SGIX_texture_coordinate_clamp
- GLEW_SGIX_texture_coordinate_clamp = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_texture_coordinate_clamp");
-#endif /* GL_SGIX_texture_coordinate_clamp */
-#ifdef GL_SGIX_texture_lod_bias
- GLEW_SGIX_texture_lod_bias = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_texture_lod_bias");
-#endif /* GL_SGIX_texture_lod_bias */
-#ifdef GL_SGIX_texture_multi_buffer
- GLEW_SGIX_texture_multi_buffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_texture_multi_buffer");
-#endif /* GL_SGIX_texture_multi_buffer */
-#ifdef GL_SGIX_texture_range
- GLEW_SGIX_texture_range = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_texture_range");
-#endif /* GL_SGIX_texture_range */
-#ifdef GL_SGIX_texture_scale_bias
- GLEW_SGIX_texture_scale_bias = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_texture_scale_bias");
-#endif /* GL_SGIX_texture_scale_bias */
-#ifdef GL_SGIX_vertex_preclip
- GLEW_SGIX_vertex_preclip = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_vertex_preclip");
-#endif /* GL_SGIX_vertex_preclip */
-#ifdef GL_SGIX_vertex_preclip_hint
- GLEW_SGIX_vertex_preclip_hint = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_vertex_preclip_hint");
-#endif /* GL_SGIX_vertex_preclip_hint */
-#ifdef GL_SGIX_ycrcb
- GLEW_SGIX_ycrcb = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGIX_ycrcb");
-#endif /* GL_SGIX_ycrcb */
-#ifdef GL_SGI_color_matrix
- GLEW_SGI_color_matrix = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGI_color_matrix");
-#endif /* GL_SGI_color_matrix */
-#ifdef GL_SGI_color_table
- GLEW_SGI_color_table = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGI_color_table");
- if (glewExperimental || GLEW_SGI_color_table) GLEW_SGI_color_table = !_glewInit_GL_SGI_color_table(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SGI_color_table */
-#ifdef GL_SGI_texture_color_table
- GLEW_SGI_texture_color_table = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SGI_texture_color_table");
-#endif /* GL_SGI_texture_color_table */
-#ifdef GL_SUNX_constant_data
- GLEW_SUNX_constant_data = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SUNX_constant_data");
- if (glewExperimental || GLEW_SUNX_constant_data) GLEW_SUNX_constant_data = !_glewInit_GL_SUNX_constant_data(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SUNX_constant_data */
-#ifdef GL_SUN_convolution_border_modes
- GLEW_SUN_convolution_border_modes = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SUN_convolution_border_modes");
-#endif /* GL_SUN_convolution_border_modes */
-#ifdef GL_SUN_global_alpha
- GLEW_SUN_global_alpha = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SUN_global_alpha");
- if (glewExperimental || GLEW_SUN_global_alpha) GLEW_SUN_global_alpha = !_glewInit_GL_SUN_global_alpha(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SUN_global_alpha */
-#ifdef GL_SUN_mesh_array
- GLEW_SUN_mesh_array = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SUN_mesh_array");
-#endif /* GL_SUN_mesh_array */
-#ifdef GL_SUN_read_video_pixels
- GLEW_SUN_read_video_pixels = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SUN_read_video_pixels");
- if (glewExperimental || GLEW_SUN_read_video_pixels) GLEW_SUN_read_video_pixels = !_glewInit_GL_SUN_read_video_pixels(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SUN_read_video_pixels */
-#ifdef GL_SUN_slice_accum
- GLEW_SUN_slice_accum = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SUN_slice_accum");
-#endif /* GL_SUN_slice_accum */
-#ifdef GL_SUN_triangle_list
- GLEW_SUN_triangle_list = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SUN_triangle_list");
- if (glewExperimental || GLEW_SUN_triangle_list) GLEW_SUN_triangle_list = !_glewInit_GL_SUN_triangle_list(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SUN_triangle_list */
-#ifdef GL_SUN_vertex
- GLEW_SUN_vertex = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_SUN_vertex");
- if (glewExperimental || GLEW_SUN_vertex) GLEW_SUN_vertex = !_glewInit_GL_SUN_vertex(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_SUN_vertex */
-#ifdef GL_WIN_phong_shading
- GLEW_WIN_phong_shading = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_WIN_phong_shading");
-#endif /* GL_WIN_phong_shading */
-#ifdef GL_WIN_specular_fog
- GLEW_WIN_specular_fog = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_WIN_specular_fog");
-#endif /* GL_WIN_specular_fog */
-#ifdef GL_WIN_swap_hint
- GLEW_WIN_swap_hint = _glewHashListExists(ext_hashlist, (const GLubyte *)"GL_WIN_swap_hint");
- if (glewExperimental || GLEW_WIN_swap_hint) GLEW_WIN_swap_hint = !_glewInit_GL_WIN_swap_hint(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GL_WIN_swap_hint */
-
- return GLEW_OK;
-}
-
-
-#if defined(_WIN32)
-
-#if !defined(GLEW_MX)
-
-PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL = NULL;
-
-PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD = NULL;
-PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD = NULL;
-PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD = NULL;
-PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD = NULL;
-PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD = NULL;
-PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD = NULL;
-PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD = NULL;
-PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD = NULL;
-PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD = NULL;
-
-PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB = NULL;
-PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB = NULL;
-PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB = NULL;
-PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB = NULL;
-
-PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB = NULL;
-
-PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB = NULL;
-
-PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB = NULL;
-PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB = NULL;
-
-PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB = NULL;
-PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB = NULL;
-PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB = NULL;
-PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB = NULL;
-PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB = NULL;
-
-PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB = NULL;
-PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB = NULL;
-PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB = NULL;
-
-PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB = NULL;
-PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB = NULL;
-PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB = NULL;
-
-PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT = NULL;
-PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT = NULL;
-PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT = NULL;
-PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT = NULL;
-
-PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT = NULL;
-
-PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT = NULL;
-PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT = NULL;
-
-PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT = NULL;
-PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT = NULL;
-PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT = NULL;
-PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT = NULL;
-PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT = NULL;
-
-PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT = NULL;
-PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT = NULL;
-PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT = NULL;
-
-PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT = NULL;
-PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT = NULL;
-
-PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D = NULL;
-PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D = NULL;
-
-PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D = NULL;
-PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D = NULL;
-PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D = NULL;
-PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D = NULL;
-
-PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D = NULL;
-PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D = NULL;
-PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D = NULL;
-PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D = NULL;
-PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D = NULL;
-PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D = NULL;
-PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D = NULL;
-PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D = NULL;
-PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D = NULL;
-PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D = NULL;
-PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D = NULL;
-PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D = NULL;
-
-PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D = NULL;
-PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D = NULL;
-PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D = NULL;
-PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D = NULL;
-
-PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D = NULL;
-PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D = NULL;
-PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D = NULL;
-PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D = NULL;
-
-PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D = NULL;
-PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D = NULL;
-PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D = NULL;
-PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D = NULL;
-
-PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV = NULL;
-PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV = NULL;
-PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV = NULL;
-PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV = NULL;
-PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV = NULL;
-PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV = NULL;
-PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV = NULL;
-PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV = NULL;
-
-PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV = NULL;
-
-PFNWGLDELAYBEFORESWAPNVPROC __wglewDelayBeforeSwapNV = NULL;
-
-PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV = NULL;
-PFNWGLDELETEDCNVPROC __wglewDeleteDCNV = NULL;
-PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV = NULL;
-PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV = NULL;
-PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV = NULL;
-
-PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV = NULL;
-PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV = NULL;
-PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV = NULL;
-
-PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV = NULL;
-PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV = NULL;
-PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV = NULL;
-PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV = NULL;
-PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV = NULL;
-PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV = NULL;
-
-PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV = NULL;
-PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV = NULL;
-
-PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV = NULL;
-PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV = NULL;
-PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV = NULL;
-PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV = NULL;
-PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV = NULL;
-
-PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV = NULL;
-PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV = NULL;
-PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV = NULL;
-PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV = NULL;
-PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV = NULL;
-PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV = NULL;
-
-PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML = NULL;
-PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML = NULL;
-PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML = NULL;
-PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML = NULL;
-PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML = NULL;
-PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML = NULL;
-GLboolean __WGLEW_3DFX_multisample = GL_FALSE;
-GLboolean __WGLEW_3DL_stereo_control = GL_FALSE;
-GLboolean __WGLEW_AMD_gpu_association = GL_FALSE;
-GLboolean __WGLEW_ARB_buffer_region = GL_FALSE;
-GLboolean __WGLEW_ARB_context_flush_control = GL_FALSE;
-GLboolean __WGLEW_ARB_create_context = GL_FALSE;
-GLboolean __WGLEW_ARB_create_context_profile = GL_FALSE;
-GLboolean __WGLEW_ARB_create_context_robustness = GL_FALSE;
-GLboolean __WGLEW_ARB_extensions_string = GL_FALSE;
-GLboolean __WGLEW_ARB_framebuffer_sRGB = GL_FALSE;
-GLboolean __WGLEW_ARB_make_current_read = GL_FALSE;
-GLboolean __WGLEW_ARB_multisample = GL_FALSE;
-GLboolean __WGLEW_ARB_pbuffer = GL_FALSE;
-GLboolean __WGLEW_ARB_pixel_format = GL_FALSE;
-GLboolean __WGLEW_ARB_pixel_format_float = GL_FALSE;
-GLboolean __WGLEW_ARB_render_texture = GL_FALSE;
-GLboolean __WGLEW_ARB_robustness_application_isolation = GL_FALSE;
-GLboolean __WGLEW_ARB_robustness_share_group_isolation = GL_FALSE;
-GLboolean __WGLEW_ATI_pixel_format_float = GL_FALSE;
-GLboolean __WGLEW_ATI_render_texture_rectangle = GL_FALSE;
-GLboolean __WGLEW_EXT_create_context_es2_profile = GL_FALSE;
-GLboolean __WGLEW_EXT_create_context_es_profile = GL_FALSE;
-GLboolean __WGLEW_EXT_depth_float = GL_FALSE;
-GLboolean __WGLEW_EXT_display_color_table = GL_FALSE;
-GLboolean __WGLEW_EXT_extensions_string = GL_FALSE;
-GLboolean __WGLEW_EXT_framebuffer_sRGB = GL_FALSE;
-GLboolean __WGLEW_EXT_make_current_read = GL_FALSE;
-GLboolean __WGLEW_EXT_multisample = GL_FALSE;
-GLboolean __WGLEW_EXT_pbuffer = GL_FALSE;
-GLboolean __WGLEW_EXT_pixel_format = GL_FALSE;
-GLboolean __WGLEW_EXT_pixel_format_packed_float = GL_FALSE;
-GLboolean __WGLEW_EXT_swap_control = GL_FALSE;
-GLboolean __WGLEW_EXT_swap_control_tear = GL_FALSE;
-GLboolean __WGLEW_I3D_digital_video_control = GL_FALSE;
-GLboolean __WGLEW_I3D_gamma = GL_FALSE;
-GLboolean __WGLEW_I3D_genlock = GL_FALSE;
-GLboolean __WGLEW_I3D_image_buffer = GL_FALSE;
-GLboolean __WGLEW_I3D_swap_frame_lock = GL_FALSE;
-GLboolean __WGLEW_I3D_swap_frame_usage = GL_FALSE;
-GLboolean __WGLEW_NV_DX_interop = GL_FALSE;
-GLboolean __WGLEW_NV_DX_interop2 = GL_FALSE;
-GLboolean __WGLEW_NV_copy_image = GL_FALSE;
-GLboolean __WGLEW_NV_delay_before_swap = GL_FALSE;
-GLboolean __WGLEW_NV_float_buffer = GL_FALSE;
-GLboolean __WGLEW_NV_gpu_affinity = GL_FALSE;
-GLboolean __WGLEW_NV_multisample_coverage = GL_FALSE;
-GLboolean __WGLEW_NV_present_video = GL_FALSE;
-GLboolean __WGLEW_NV_render_depth_texture = GL_FALSE;
-GLboolean __WGLEW_NV_render_texture_rectangle = GL_FALSE;
-GLboolean __WGLEW_NV_swap_group = GL_FALSE;
-GLboolean __WGLEW_NV_vertex_array_range = GL_FALSE;
-GLboolean __WGLEW_NV_video_capture = GL_FALSE;
-GLboolean __WGLEW_NV_video_output = GL_FALSE;
-GLboolean __WGLEW_OML_sync_control = GL_FALSE;
-
-#endif /* !GLEW_MX */
-
-#ifdef WGL_3DFX_multisample
-
-#endif /* WGL_3DFX_multisample */
-
-#ifdef WGL_3DL_stereo_control
-
-static GLboolean _glewInit_WGL_3DL_stereo_control (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglSetStereoEmitterState3DL = (PFNWGLSETSTEREOEMITTERSTATE3DLPROC)glewGetProcAddress((const GLubyte*)"wglSetStereoEmitterState3DL")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_3DL_stereo_control */
-
-#ifdef WGL_AMD_gpu_association
-
-static GLboolean _glewInit_WGL_AMD_gpu_association (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglBlitContextFramebufferAMD = (PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC)glewGetProcAddress((const GLubyte*)"wglBlitContextFramebufferAMD")) == NULL) || r;
- r = ((wglCreateAssociatedContextAMD = (PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"wglCreateAssociatedContextAMD")) == NULL) || r;
- r = ((wglCreateAssociatedContextAttribsAMD = (PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC)glewGetProcAddress((const GLubyte*)"wglCreateAssociatedContextAttribsAMD")) == NULL) || r;
- r = ((wglDeleteAssociatedContextAMD = (PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"wglDeleteAssociatedContextAMD")) == NULL) || r;
- r = ((wglGetContextGPUIDAMD = (PFNWGLGETCONTEXTGPUIDAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetContextGPUIDAMD")) == NULL) || r;
- r = ((wglGetCurrentAssociatedContextAMD = (PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentAssociatedContextAMD")) == NULL) || r;
- r = ((wglGetGPUIDsAMD = (PFNWGLGETGPUIDSAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetGPUIDsAMD")) == NULL) || r;
- r = ((wglGetGPUInfoAMD = (PFNWGLGETGPUINFOAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetGPUInfoAMD")) == NULL) || r;
- r = ((wglMakeAssociatedContextCurrentAMD = (PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC)glewGetProcAddress((const GLubyte*)"wglMakeAssociatedContextCurrentAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_AMD_gpu_association */
-
-#ifdef WGL_ARB_buffer_region
-
-static GLboolean _glewInit_WGL_ARB_buffer_region (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglCreateBufferRegionARB = (PFNWGLCREATEBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglCreateBufferRegionARB")) == NULL) || r;
- r = ((wglDeleteBufferRegionARB = (PFNWGLDELETEBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglDeleteBufferRegionARB")) == NULL) || r;
- r = ((wglRestoreBufferRegionARB = (PFNWGLRESTOREBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglRestoreBufferRegionARB")) == NULL) || r;
- r = ((wglSaveBufferRegionARB = (PFNWGLSAVEBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglSaveBufferRegionARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_ARB_buffer_region */
-
-#ifdef WGL_ARB_context_flush_control
-
-#endif /* WGL_ARB_context_flush_control */
-
-#ifdef WGL_ARB_create_context
-
-static GLboolean _glewInit_WGL_ARB_create_context (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)glewGetProcAddress((const GLubyte*)"wglCreateContextAttribsARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_ARB_create_context */
-
-#ifdef WGL_ARB_create_context_profile
-
-#endif /* WGL_ARB_create_context_profile */
-
-#ifdef WGL_ARB_create_context_robustness
-
-#endif /* WGL_ARB_create_context_robustness */
-
-#ifdef WGL_ARB_extensions_string
-
-static GLboolean _glewInit_WGL_ARB_extensions_string (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_ARB_extensions_string */
-
-#ifdef WGL_ARB_framebuffer_sRGB
-
-#endif /* WGL_ARB_framebuffer_sRGB */
-
-#ifdef WGL_ARB_make_current_read
-
-static GLboolean _glewInit_WGL_ARB_make_current_read (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglGetCurrentReadDCARB = (PFNWGLGETCURRENTREADDCARBPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentReadDCARB")) == NULL) || r;
- r = ((wglMakeContextCurrentARB = (PFNWGLMAKECONTEXTCURRENTARBPROC)glewGetProcAddress((const GLubyte*)"wglMakeContextCurrentARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_ARB_make_current_read */
-
-#ifdef WGL_ARB_multisample
-
-#endif /* WGL_ARB_multisample */
-
-#ifdef WGL_ARB_pbuffer
-
-static GLboolean _glewInit_WGL_ARB_pbuffer (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglCreatePbufferARB = (PFNWGLCREATEPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"wglCreatePbufferARB")) == NULL) || r;
- r = ((wglDestroyPbufferARB = (PFNWGLDESTROYPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"wglDestroyPbufferARB")) == NULL) || r;
- r = ((wglGetPbufferDCARB = (PFNWGLGETPBUFFERDCARBPROC)glewGetProcAddress((const GLubyte*)"wglGetPbufferDCARB")) == NULL) || r;
- r = ((wglQueryPbufferARB = (PFNWGLQUERYPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"wglQueryPbufferARB")) == NULL) || r;
- r = ((wglReleasePbufferDCARB = (PFNWGLRELEASEPBUFFERDCARBPROC)glewGetProcAddress((const GLubyte*)"wglReleasePbufferDCARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_ARB_pbuffer */
-
-#ifdef WGL_ARB_pixel_format
-
-static GLboolean _glewInit_WGL_ARB_pixel_format (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)glewGetProcAddress((const GLubyte*)"wglChoosePixelFormatARB")) == NULL) || r;
- r = ((wglGetPixelFormatAttribfvARB = (PFNWGLGETPIXELFORMATATTRIBFVARBPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribfvARB")) == NULL) || r;
- r = ((wglGetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribivARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_ARB_pixel_format */
-
-#ifdef WGL_ARB_pixel_format_float
-
-#endif /* WGL_ARB_pixel_format_float */
-
-#ifdef WGL_ARB_render_texture
-
-static GLboolean _glewInit_WGL_ARB_render_texture (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglBindTexImageARB = (PFNWGLBINDTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"wglBindTexImageARB")) == NULL) || r;
- r = ((wglReleaseTexImageARB = (PFNWGLRELEASETEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"wglReleaseTexImageARB")) == NULL) || r;
- r = ((wglSetPbufferAttribARB = (PFNWGLSETPBUFFERATTRIBARBPROC)glewGetProcAddress((const GLubyte*)"wglSetPbufferAttribARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_ARB_render_texture */
-
-#ifdef WGL_ARB_robustness_application_isolation
-
-#endif /* WGL_ARB_robustness_application_isolation */
-
-#ifdef WGL_ARB_robustness_share_group_isolation
-
-#endif /* WGL_ARB_robustness_share_group_isolation */
-
-#ifdef WGL_ATI_pixel_format_float
-
-#endif /* WGL_ATI_pixel_format_float */
-
-#ifdef WGL_ATI_render_texture_rectangle
-
-#endif /* WGL_ATI_render_texture_rectangle */
-
-#ifdef WGL_EXT_create_context_es2_profile
-
-#endif /* WGL_EXT_create_context_es2_profile */
-
-#ifdef WGL_EXT_create_context_es_profile
-
-#endif /* WGL_EXT_create_context_es_profile */
-
-#ifdef WGL_EXT_depth_float
-
-#endif /* WGL_EXT_depth_float */
-
-#ifdef WGL_EXT_display_color_table
-
-static GLboolean _glewInit_WGL_EXT_display_color_table (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglBindDisplayColorTableEXT = (PFNWGLBINDDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglBindDisplayColorTableEXT")) == NULL) || r;
- r = ((wglCreateDisplayColorTableEXT = (PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglCreateDisplayColorTableEXT")) == NULL) || r;
- r = ((wglDestroyDisplayColorTableEXT = (PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglDestroyDisplayColorTableEXT")) == NULL) || r;
- r = ((wglLoadDisplayColorTableEXT = (PFNWGLLOADDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglLoadDisplayColorTableEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_EXT_display_color_table */
-
-#ifdef WGL_EXT_extensions_string
-
-static GLboolean _glewInit_WGL_EXT_extensions_string (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_EXT_extensions_string */
-
-#ifdef WGL_EXT_framebuffer_sRGB
-
-#endif /* WGL_EXT_framebuffer_sRGB */
-
-#ifdef WGL_EXT_make_current_read
-
-static GLboolean _glewInit_WGL_EXT_make_current_read (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglGetCurrentReadDCEXT = (PFNWGLGETCURRENTREADDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentReadDCEXT")) == NULL) || r;
- r = ((wglMakeContextCurrentEXT = (PFNWGLMAKECONTEXTCURRENTEXTPROC)glewGetProcAddress((const GLubyte*)"wglMakeContextCurrentEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_EXT_make_current_read */
-
-#ifdef WGL_EXT_multisample
-
-#endif /* WGL_EXT_multisample */
-
-#ifdef WGL_EXT_pbuffer
-
-static GLboolean _glewInit_WGL_EXT_pbuffer (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglCreatePbufferEXT = (PFNWGLCREATEPBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"wglCreatePbufferEXT")) == NULL) || r;
- r = ((wglDestroyPbufferEXT = (PFNWGLDESTROYPBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"wglDestroyPbufferEXT")) == NULL) || r;
- r = ((wglGetPbufferDCEXT = (PFNWGLGETPBUFFERDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetPbufferDCEXT")) == NULL) || r;
- r = ((wglQueryPbufferEXT = (PFNWGLQUERYPBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"wglQueryPbufferEXT")) == NULL) || r;
- r = ((wglReleasePbufferDCEXT = (PFNWGLRELEASEPBUFFERDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglReleasePbufferDCEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_EXT_pbuffer */
-
-#ifdef WGL_EXT_pixel_format
-
-static GLboolean _glewInit_WGL_EXT_pixel_format (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglChoosePixelFormatEXT = (PFNWGLCHOOSEPIXELFORMATEXTPROC)glewGetProcAddress((const GLubyte*)"wglChoosePixelFormatEXT")) == NULL) || r;
- r = ((wglGetPixelFormatAttribfvEXT = (PFNWGLGETPIXELFORMATATTRIBFVEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribfvEXT")) == NULL) || r;
- r = ((wglGetPixelFormatAttribivEXT = (PFNWGLGETPIXELFORMATATTRIBIVEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribivEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_EXT_pixel_format */
-
-#ifdef WGL_EXT_pixel_format_packed_float
-
-#endif /* WGL_EXT_pixel_format_packed_float */
-
-#ifdef WGL_EXT_swap_control
-
-static GLboolean _glewInit_WGL_EXT_swap_control (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetSwapIntervalEXT")) == NULL) || r;
- r = ((wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"wglSwapIntervalEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_EXT_swap_control */
-
-#ifdef WGL_EXT_swap_control_tear
-
-#endif /* WGL_EXT_swap_control_tear */
-
-#ifdef WGL_I3D_digital_video_control
-
-static GLboolean _glewInit_WGL_I3D_digital_video_control (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglGetDigitalVideoParametersI3D = (PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetDigitalVideoParametersI3D")) == NULL) || r;
- r = ((wglSetDigitalVideoParametersI3D = (PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetDigitalVideoParametersI3D")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_I3D_digital_video_control */
-
-#ifdef WGL_I3D_gamma
-
-static GLboolean _glewInit_WGL_I3D_gamma (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglGetGammaTableI3D = (PFNWGLGETGAMMATABLEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGammaTableI3D")) == NULL) || r;
- r = ((wglGetGammaTableParametersI3D = (PFNWGLGETGAMMATABLEPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGammaTableParametersI3D")) == NULL) || r;
- r = ((wglSetGammaTableI3D = (PFNWGLSETGAMMATABLEI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetGammaTableI3D")) == NULL) || r;
- r = ((wglSetGammaTableParametersI3D = (PFNWGLSETGAMMATABLEPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetGammaTableParametersI3D")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_I3D_gamma */
-
-#ifdef WGL_I3D_genlock
-
-static GLboolean _glewInit_WGL_I3D_genlock (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglDisableGenlockI3D = (PFNWGLDISABLEGENLOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglDisableGenlockI3D")) == NULL) || r;
- r = ((wglEnableGenlockI3D = (PFNWGLENABLEGENLOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglEnableGenlockI3D")) == NULL) || r;
- r = ((wglGenlockSampleRateI3D = (PFNWGLGENLOCKSAMPLERATEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSampleRateI3D")) == NULL) || r;
- r = ((wglGenlockSourceDelayI3D = (PFNWGLGENLOCKSOURCEDELAYI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSourceDelayI3D")) == NULL) || r;
- r = ((wglGenlockSourceEdgeI3D = (PFNWGLGENLOCKSOURCEEDGEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSourceEdgeI3D")) == NULL) || r;
- r = ((wglGenlockSourceI3D = (PFNWGLGENLOCKSOURCEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSourceI3D")) == NULL) || r;
- r = ((wglGetGenlockSampleRateI3D = (PFNWGLGETGENLOCKSAMPLERATEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSampleRateI3D")) == NULL) || r;
- r = ((wglGetGenlockSourceDelayI3D = (PFNWGLGETGENLOCKSOURCEDELAYI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSourceDelayI3D")) == NULL) || r;
- r = ((wglGetGenlockSourceEdgeI3D = (PFNWGLGETGENLOCKSOURCEEDGEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSourceEdgeI3D")) == NULL) || r;
- r = ((wglGetGenlockSourceI3D = (PFNWGLGETGENLOCKSOURCEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSourceI3D")) == NULL) || r;
- r = ((wglIsEnabledGenlockI3D = (PFNWGLISENABLEDGENLOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglIsEnabledGenlockI3D")) == NULL) || r;
- r = ((wglQueryGenlockMaxSourceDelayI3D = (PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC)glewGetProcAddress((const GLubyte*)"wglQueryGenlockMaxSourceDelayI3D")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_I3D_genlock */
-
-#ifdef WGL_I3D_image_buffer
-
-static GLboolean _glewInit_WGL_I3D_image_buffer (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglAssociateImageBufferEventsI3D = (PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC)glewGetProcAddress((const GLubyte*)"wglAssociateImageBufferEventsI3D")) == NULL) || r;
- r = ((wglCreateImageBufferI3D = (PFNWGLCREATEIMAGEBUFFERI3DPROC)glewGetProcAddress((const GLubyte*)"wglCreateImageBufferI3D")) == NULL) || r;
- r = ((wglDestroyImageBufferI3D = (PFNWGLDESTROYIMAGEBUFFERI3DPROC)glewGetProcAddress((const GLubyte*)"wglDestroyImageBufferI3D")) == NULL) || r;
- r = ((wglReleaseImageBufferEventsI3D = (PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC)glewGetProcAddress((const GLubyte*)"wglReleaseImageBufferEventsI3D")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_I3D_image_buffer */
-
-#ifdef WGL_I3D_swap_frame_lock
-
-static GLboolean _glewInit_WGL_I3D_swap_frame_lock (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglDisableFrameLockI3D = (PFNWGLDISABLEFRAMELOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglDisableFrameLockI3D")) == NULL) || r;
- r = ((wglEnableFrameLockI3D = (PFNWGLENABLEFRAMELOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglEnableFrameLockI3D")) == NULL) || r;
- r = ((wglIsEnabledFrameLockI3D = (PFNWGLISENABLEDFRAMELOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglIsEnabledFrameLockI3D")) == NULL) || r;
- r = ((wglQueryFrameLockMasterI3D = (PFNWGLQUERYFRAMELOCKMASTERI3DPROC)glewGetProcAddress((const GLubyte*)"wglQueryFrameLockMasterI3D")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_I3D_swap_frame_lock */
-
-#ifdef WGL_I3D_swap_frame_usage
-
-static GLboolean _glewInit_WGL_I3D_swap_frame_usage (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglBeginFrameTrackingI3D = (PFNWGLBEGINFRAMETRACKINGI3DPROC)glewGetProcAddress((const GLubyte*)"wglBeginFrameTrackingI3D")) == NULL) || r;
- r = ((wglEndFrameTrackingI3D = (PFNWGLENDFRAMETRACKINGI3DPROC)glewGetProcAddress((const GLubyte*)"wglEndFrameTrackingI3D")) == NULL) || r;
- r = ((wglGetFrameUsageI3D = (PFNWGLGETFRAMEUSAGEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetFrameUsageI3D")) == NULL) || r;
- r = ((wglQueryFrameTrackingI3D = (PFNWGLQUERYFRAMETRACKINGI3DPROC)glewGetProcAddress((const GLubyte*)"wglQueryFrameTrackingI3D")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_I3D_swap_frame_usage */
-
-#ifdef WGL_NV_DX_interop
-
-static GLboolean _glewInit_WGL_NV_DX_interop (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglDXCloseDeviceNV = (PFNWGLDXCLOSEDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglDXCloseDeviceNV")) == NULL) || r;
- r = ((wglDXLockObjectsNV = (PFNWGLDXLOCKOBJECTSNVPROC)glewGetProcAddress((const GLubyte*)"wglDXLockObjectsNV")) == NULL) || r;
- r = ((wglDXObjectAccessNV = (PFNWGLDXOBJECTACCESSNVPROC)glewGetProcAddress((const GLubyte*)"wglDXObjectAccessNV")) == NULL) || r;
- r = ((wglDXOpenDeviceNV = (PFNWGLDXOPENDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglDXOpenDeviceNV")) == NULL) || r;
- r = ((wglDXRegisterObjectNV = (PFNWGLDXREGISTEROBJECTNVPROC)glewGetProcAddress((const GLubyte*)"wglDXRegisterObjectNV")) == NULL) || r;
- r = ((wglDXSetResourceShareHandleNV = (PFNWGLDXSETRESOURCESHAREHANDLENVPROC)glewGetProcAddress((const GLubyte*)"wglDXSetResourceShareHandleNV")) == NULL) || r;
- r = ((wglDXUnlockObjectsNV = (PFNWGLDXUNLOCKOBJECTSNVPROC)glewGetProcAddress((const GLubyte*)"wglDXUnlockObjectsNV")) == NULL) || r;
- r = ((wglDXUnregisterObjectNV = (PFNWGLDXUNREGISTEROBJECTNVPROC)glewGetProcAddress((const GLubyte*)"wglDXUnregisterObjectNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_NV_DX_interop */
-
-#ifdef WGL_NV_DX_interop2
-
-#endif /* WGL_NV_DX_interop2 */
-
-#ifdef WGL_NV_copy_image
-
-static GLboolean _glewInit_WGL_NV_copy_image (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglCopyImageSubDataNV = (PFNWGLCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"wglCopyImageSubDataNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_NV_copy_image */
-
-#ifdef WGL_NV_delay_before_swap
-
-static GLboolean _glewInit_WGL_NV_delay_before_swap (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglDelayBeforeSwapNV = (PFNWGLDELAYBEFORESWAPNVPROC)glewGetProcAddress((const GLubyte*)"wglDelayBeforeSwapNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_NV_delay_before_swap */
-
-#ifdef WGL_NV_float_buffer
-
-#endif /* WGL_NV_float_buffer */
-
-#ifdef WGL_NV_gpu_affinity
-
-static GLboolean _glewInit_WGL_NV_gpu_affinity (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglCreateAffinityDCNV = (PFNWGLCREATEAFFINITYDCNVPROC)glewGetProcAddress((const GLubyte*)"wglCreateAffinityDCNV")) == NULL) || r;
- r = ((wglDeleteDCNV = (PFNWGLDELETEDCNVPROC)glewGetProcAddress((const GLubyte*)"wglDeleteDCNV")) == NULL) || r;
- r = ((wglEnumGpuDevicesNV = (PFNWGLENUMGPUDEVICESNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumGpuDevicesNV")) == NULL) || r;
- r = ((wglEnumGpusFromAffinityDCNV = (PFNWGLENUMGPUSFROMAFFINITYDCNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumGpusFromAffinityDCNV")) == NULL) || r;
- r = ((wglEnumGpusNV = (PFNWGLENUMGPUSNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumGpusNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_NV_gpu_affinity */
-
-#ifdef WGL_NV_multisample_coverage
-
-#endif /* WGL_NV_multisample_coverage */
-
-#ifdef WGL_NV_present_video
-
-static GLboolean _glewInit_WGL_NV_present_video (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglBindVideoDeviceNV = (PFNWGLBINDVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglBindVideoDeviceNV")) == NULL) || r;
- r = ((wglEnumerateVideoDevicesNV = (PFNWGLENUMERATEVIDEODEVICESNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumerateVideoDevicesNV")) == NULL) || r;
- r = ((wglQueryCurrentContextNV = (PFNWGLQUERYCURRENTCONTEXTNVPROC)glewGetProcAddress((const GLubyte*)"wglQueryCurrentContextNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_NV_present_video */
-
-#ifdef WGL_NV_render_depth_texture
-
-#endif /* WGL_NV_render_depth_texture */
-
-#ifdef WGL_NV_render_texture_rectangle
-
-#endif /* WGL_NV_render_texture_rectangle */
-
-#ifdef WGL_NV_swap_group
-
-static GLboolean _glewInit_WGL_NV_swap_group (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglBindSwapBarrierNV = (PFNWGLBINDSWAPBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"wglBindSwapBarrierNV")) == NULL) || r;
- r = ((wglJoinSwapGroupNV = (PFNWGLJOINSWAPGROUPNVPROC)glewGetProcAddress((const GLubyte*)"wglJoinSwapGroupNV")) == NULL) || r;
- r = ((wglQueryFrameCountNV = (PFNWGLQUERYFRAMECOUNTNVPROC)glewGetProcAddress((const GLubyte*)"wglQueryFrameCountNV")) == NULL) || r;
- r = ((wglQueryMaxSwapGroupsNV = (PFNWGLQUERYMAXSWAPGROUPSNVPROC)glewGetProcAddress((const GLubyte*)"wglQueryMaxSwapGroupsNV")) == NULL) || r;
- r = ((wglQuerySwapGroupNV = (PFNWGLQUERYSWAPGROUPNVPROC)glewGetProcAddress((const GLubyte*)"wglQuerySwapGroupNV")) == NULL) || r;
- r = ((wglResetFrameCountNV = (PFNWGLRESETFRAMECOUNTNVPROC)glewGetProcAddress((const GLubyte*)"wglResetFrameCountNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_NV_swap_group */
-
-#ifdef WGL_NV_vertex_array_range
-
-static GLboolean _glewInit_WGL_NV_vertex_array_range (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglAllocateMemoryNV = (PFNWGLALLOCATEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"wglAllocateMemoryNV")) == NULL) || r;
- r = ((wglFreeMemoryNV = (PFNWGLFREEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"wglFreeMemoryNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_NV_vertex_array_range */
-
-#ifdef WGL_NV_video_capture
-
-static GLboolean _glewInit_WGL_NV_video_capture (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglBindVideoCaptureDeviceNV = (PFNWGLBINDVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglBindVideoCaptureDeviceNV")) == NULL) || r;
- r = ((wglEnumerateVideoCaptureDevicesNV = (PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumerateVideoCaptureDevicesNV")) == NULL) || r;
- r = ((wglLockVideoCaptureDeviceNV = (PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglLockVideoCaptureDeviceNV")) == NULL) || r;
- r = ((wglQueryVideoCaptureDeviceNV = (PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglQueryVideoCaptureDeviceNV")) == NULL) || r;
- r = ((wglReleaseVideoCaptureDeviceNV = (PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglReleaseVideoCaptureDeviceNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_NV_video_capture */
-
-#ifdef WGL_NV_video_output
-
-static GLboolean _glewInit_WGL_NV_video_output (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglBindVideoImageNV = (PFNWGLBINDVIDEOIMAGENVPROC)glewGetProcAddress((const GLubyte*)"wglBindVideoImageNV")) == NULL) || r;
- r = ((wglGetVideoDeviceNV = (PFNWGLGETVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglGetVideoDeviceNV")) == NULL) || r;
- r = ((wglGetVideoInfoNV = (PFNWGLGETVIDEOINFONVPROC)glewGetProcAddress((const GLubyte*)"wglGetVideoInfoNV")) == NULL) || r;
- r = ((wglReleaseVideoDeviceNV = (PFNWGLRELEASEVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglReleaseVideoDeviceNV")) == NULL) || r;
- r = ((wglReleaseVideoImageNV = (PFNWGLRELEASEVIDEOIMAGENVPROC)glewGetProcAddress((const GLubyte*)"wglReleaseVideoImageNV")) == NULL) || r;
- r = ((wglSendPbufferToVideoNV = (PFNWGLSENDPBUFFERTOVIDEONVPROC)glewGetProcAddress((const GLubyte*)"wglSendPbufferToVideoNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_NV_video_output */
-
-#ifdef WGL_OML_sync_control
-
-static GLboolean _glewInit_WGL_OML_sync_control (WGLEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((wglGetMscRateOML = (PFNWGLGETMSCRATEOMLPROC)glewGetProcAddress((const GLubyte*)"wglGetMscRateOML")) == NULL) || r;
- r = ((wglGetSyncValuesOML = (PFNWGLGETSYNCVALUESOMLPROC)glewGetProcAddress((const GLubyte*)"wglGetSyncValuesOML")) == NULL) || r;
- r = ((wglSwapBuffersMscOML = (PFNWGLSWAPBUFFERSMSCOMLPROC)glewGetProcAddress((const GLubyte*)"wglSwapBuffersMscOML")) == NULL) || r;
- r = ((wglSwapLayerBuffersMscOML = (PFNWGLSWAPLAYERBUFFERSMSCOMLPROC)glewGetProcAddress((const GLubyte*)"wglSwapLayerBuffersMscOML")) == NULL) || r;
- r = ((wglWaitForMscOML = (PFNWGLWAITFORMSCOMLPROC)glewGetProcAddress((const GLubyte*)"wglWaitForMscOML")) == NULL) || r;
- r = ((wglWaitForSbcOML = (PFNWGLWAITFORSBCOMLPROC)glewGetProcAddress((const GLubyte*)"wglWaitForSbcOML")) == NULL) || r;
-
- return r;
-}
-
-#endif /* WGL_OML_sync_control */
-
-/* ------------------------------------------------------------------------- */
-
-static PFNWGLGETEXTENSIONSSTRINGARBPROC _wglewGetExtensionsStringARB = NULL;
-static PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglewGetExtensionsStringEXT = NULL;
-
-GLboolean GLEWAPIENTRY wglewGetExtension (const char* name)
-{
-#if GLEW_MX
- WGLEWContext *ctx = wglewGetContext();
-#endif
- return _glewHashListExists(WGLEW_GET_VAR(GLEW_WGL_EXTENSIONS), name);
-}
-
-GLenum GLEWAPIENTRY wglewContextInit (WGLEW_CONTEXT_ARG_DEF_LIST)
-{
- GLboolean crippled;
- const GLubyte* extensions;
- GLEWHashList *ext_hashlist;
-
- /* find wgl extension string query functions */
- _wglewGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringARB");
- _wglewGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT");
- /* query wgl extension string */
- if (_wglewGetExtensionsStringARB == NULL)
- if (_wglewGetExtensionsStringEXT == NULL)
- extensions = (const GLubyte*)"";
- else
- extensions = (const GLubyte*)_wglewGetExtensionsStringEXT();
- else
- extensions = (const GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC());
-
- WGLEW_GET_VAR(GLEW_WGL_EXTENSIONS) = calloc(1, sizeof(GLEWHashList));
-
- ext_hashlist = WGLEW_GET_VAR(GLEW_WGL_EXTENSIONS);
-
- _glewBuildHashListFromString(extensions, ext_hashlist);
-
- /* initialize extensions */
- crippled = _wglewGetExtensionsStringARB == NULL && _wglewGetExtensionsStringEXT == NULL;
-#ifdef WGL_3DFX_multisample
- WGLEW_3DFX_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_3DFX_multisample");
-#endif /* WGL_3DFX_multisample */
-#ifdef WGL_3DL_stereo_control
- WGLEW_3DL_stereo_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_3DL_stereo_control");
- if (glewExperimental || WGLEW_3DL_stereo_control|| crippled) WGLEW_3DL_stereo_control= !_glewInit_WGL_3DL_stereo_control(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_3DL_stereo_control */
-#ifdef WGL_AMD_gpu_association
- WGLEW_AMD_gpu_association = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_AMD_gpu_association");
- if (glewExperimental || WGLEW_AMD_gpu_association|| crippled) WGLEW_AMD_gpu_association= !_glewInit_WGL_AMD_gpu_association(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_AMD_gpu_association */
-#ifdef WGL_ARB_buffer_region
- WGLEW_ARB_buffer_region = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_buffer_region");
- if (glewExperimental || WGLEW_ARB_buffer_region|| crippled) WGLEW_ARB_buffer_region= !_glewInit_WGL_ARB_buffer_region(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_ARB_buffer_region */
-#ifdef WGL_ARB_context_flush_control
- WGLEW_ARB_context_flush_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_context_flush_control");
-#endif /* WGL_ARB_context_flush_control */
-#ifdef WGL_ARB_create_context
- WGLEW_ARB_create_context = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_create_context");
- if (glewExperimental || WGLEW_ARB_create_context|| crippled) WGLEW_ARB_create_context= !_glewInit_WGL_ARB_create_context(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_ARB_create_context */
-#ifdef WGL_ARB_create_context_profile
- WGLEW_ARB_create_context_profile = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_create_context_profile");
-#endif /* WGL_ARB_create_context_profile */
-#ifdef WGL_ARB_create_context_robustness
- WGLEW_ARB_create_context_robustness = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_create_context_robustness");
-#endif /* WGL_ARB_create_context_robustness */
-#ifdef WGL_ARB_extensions_string
- WGLEW_ARB_extensions_string = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_extensions_string");
- if (glewExperimental || WGLEW_ARB_extensions_string|| crippled) WGLEW_ARB_extensions_string= !_glewInit_WGL_ARB_extensions_string(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_ARB_extensions_string */
-#ifdef WGL_ARB_framebuffer_sRGB
- WGLEW_ARB_framebuffer_sRGB = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_framebuffer_sRGB");
-#endif /* WGL_ARB_framebuffer_sRGB */
-#ifdef WGL_ARB_make_current_read
- WGLEW_ARB_make_current_read = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_make_current_read");
- if (glewExperimental || WGLEW_ARB_make_current_read|| crippled) WGLEW_ARB_make_current_read= !_glewInit_WGL_ARB_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_ARB_make_current_read */
-#ifdef WGL_ARB_multisample
- WGLEW_ARB_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_multisample");
-#endif /* WGL_ARB_multisample */
-#ifdef WGL_ARB_pbuffer
- WGLEW_ARB_pbuffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_pbuffer");
- if (glewExperimental || WGLEW_ARB_pbuffer|| crippled) WGLEW_ARB_pbuffer= !_glewInit_WGL_ARB_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_ARB_pbuffer */
-#ifdef WGL_ARB_pixel_format
- WGLEW_ARB_pixel_format = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_pixel_format");
- if (glewExperimental || WGLEW_ARB_pixel_format|| crippled) WGLEW_ARB_pixel_format= !_glewInit_WGL_ARB_pixel_format(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_ARB_pixel_format */
-#ifdef WGL_ARB_pixel_format_float
- WGLEW_ARB_pixel_format_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_pixel_format_float");
-#endif /* WGL_ARB_pixel_format_float */
-#ifdef WGL_ARB_render_texture
- WGLEW_ARB_render_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_render_texture");
- if (glewExperimental || WGLEW_ARB_render_texture|| crippled) WGLEW_ARB_render_texture= !_glewInit_WGL_ARB_render_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_ARB_render_texture */
-#ifdef WGL_ARB_robustness_application_isolation
- WGLEW_ARB_robustness_application_isolation = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_robustness_application_isolation");
-#endif /* WGL_ARB_robustness_application_isolation */
-#ifdef WGL_ARB_robustness_share_group_isolation
- WGLEW_ARB_robustness_share_group_isolation = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ARB_robustness_share_group_isolation");
-#endif /* WGL_ARB_robustness_share_group_isolation */
-#ifdef WGL_ATI_pixel_format_float
- WGLEW_ATI_pixel_format_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ATI_pixel_format_float");
-#endif /* WGL_ATI_pixel_format_float */
-#ifdef WGL_ATI_render_texture_rectangle
- WGLEW_ATI_render_texture_rectangle = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_ATI_render_texture_rectangle");
-#endif /* WGL_ATI_render_texture_rectangle */
-#ifdef WGL_EXT_create_context_es2_profile
- WGLEW_EXT_create_context_es2_profile = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_create_context_es2_profile");
-#endif /* WGL_EXT_create_context_es2_profile */
-#ifdef WGL_EXT_create_context_es_profile
- WGLEW_EXT_create_context_es_profile = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_create_context_es_profile");
-#endif /* WGL_EXT_create_context_es_profile */
-#ifdef WGL_EXT_depth_float
- WGLEW_EXT_depth_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_depth_float");
-#endif /* WGL_EXT_depth_float */
-#ifdef WGL_EXT_display_color_table
- WGLEW_EXT_display_color_table = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_display_color_table");
- if (glewExperimental || WGLEW_EXT_display_color_table|| crippled) WGLEW_EXT_display_color_table= !_glewInit_WGL_EXT_display_color_table(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_EXT_display_color_table */
-#ifdef WGL_EXT_extensions_string
- WGLEW_EXT_extensions_string = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_extensions_string");
- if (glewExperimental || WGLEW_EXT_extensions_string|| crippled) WGLEW_EXT_extensions_string= !_glewInit_WGL_EXT_extensions_string(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_EXT_extensions_string */
-#ifdef WGL_EXT_framebuffer_sRGB
- WGLEW_EXT_framebuffer_sRGB = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_framebuffer_sRGB");
-#endif /* WGL_EXT_framebuffer_sRGB */
-#ifdef WGL_EXT_make_current_read
- WGLEW_EXT_make_current_read = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_make_current_read");
- if (glewExperimental || WGLEW_EXT_make_current_read|| crippled) WGLEW_EXT_make_current_read= !_glewInit_WGL_EXT_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_EXT_make_current_read */
-#ifdef WGL_EXT_multisample
- WGLEW_EXT_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_multisample");
-#endif /* WGL_EXT_multisample */
-#ifdef WGL_EXT_pbuffer
- WGLEW_EXT_pbuffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_pbuffer");
- if (glewExperimental || WGLEW_EXT_pbuffer|| crippled) WGLEW_EXT_pbuffer= !_glewInit_WGL_EXT_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_EXT_pbuffer */
-#ifdef WGL_EXT_pixel_format
- WGLEW_EXT_pixel_format = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_pixel_format");
- if (glewExperimental || WGLEW_EXT_pixel_format|| crippled) WGLEW_EXT_pixel_format= !_glewInit_WGL_EXT_pixel_format(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_EXT_pixel_format */
-#ifdef WGL_EXT_pixel_format_packed_float
- WGLEW_EXT_pixel_format_packed_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_pixel_format_packed_float");
-#endif /* WGL_EXT_pixel_format_packed_float */
-#ifdef WGL_EXT_swap_control
- WGLEW_EXT_swap_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_swap_control");
- if (glewExperimental || WGLEW_EXT_swap_control|| crippled) WGLEW_EXT_swap_control= !_glewInit_WGL_EXT_swap_control(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_EXT_swap_control */
-#ifdef WGL_EXT_swap_control_tear
- WGLEW_EXT_swap_control_tear = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_EXT_swap_control_tear");
-#endif /* WGL_EXT_swap_control_tear */
-#ifdef WGL_I3D_digital_video_control
- WGLEW_I3D_digital_video_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_I3D_digital_video_control");
- if (glewExperimental || WGLEW_I3D_digital_video_control|| crippled) WGLEW_I3D_digital_video_control= !_glewInit_WGL_I3D_digital_video_control(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_I3D_digital_video_control */
-#ifdef WGL_I3D_gamma
- WGLEW_I3D_gamma = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_I3D_gamma");
- if (glewExperimental || WGLEW_I3D_gamma|| crippled) WGLEW_I3D_gamma= !_glewInit_WGL_I3D_gamma(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_I3D_gamma */
-#ifdef WGL_I3D_genlock
- WGLEW_I3D_genlock = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_I3D_genlock");
- if (glewExperimental || WGLEW_I3D_genlock|| crippled) WGLEW_I3D_genlock= !_glewInit_WGL_I3D_genlock(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_I3D_genlock */
-#ifdef WGL_I3D_image_buffer
- WGLEW_I3D_image_buffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_I3D_image_buffer");
- if (glewExperimental || WGLEW_I3D_image_buffer|| crippled) WGLEW_I3D_image_buffer= !_glewInit_WGL_I3D_image_buffer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_I3D_image_buffer */
-#ifdef WGL_I3D_swap_frame_lock
- WGLEW_I3D_swap_frame_lock = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_I3D_swap_frame_lock");
- if (glewExperimental || WGLEW_I3D_swap_frame_lock|| crippled) WGLEW_I3D_swap_frame_lock= !_glewInit_WGL_I3D_swap_frame_lock(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_I3D_swap_frame_lock */
-#ifdef WGL_I3D_swap_frame_usage
- WGLEW_I3D_swap_frame_usage = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_I3D_swap_frame_usage");
- if (glewExperimental || WGLEW_I3D_swap_frame_usage|| crippled) WGLEW_I3D_swap_frame_usage= !_glewInit_WGL_I3D_swap_frame_usage(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_I3D_swap_frame_usage */
-#ifdef WGL_NV_DX_interop
- WGLEW_NV_DX_interop = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_DX_interop");
- if (glewExperimental || WGLEW_NV_DX_interop|| crippled) WGLEW_NV_DX_interop= !_glewInit_WGL_NV_DX_interop(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_NV_DX_interop */
-#ifdef WGL_NV_DX_interop2
- WGLEW_NV_DX_interop2 = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_DX_interop2");
-#endif /* WGL_NV_DX_interop2 */
-#ifdef WGL_NV_copy_image
- WGLEW_NV_copy_image = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_copy_image");
- if (glewExperimental || WGLEW_NV_copy_image|| crippled) WGLEW_NV_copy_image= !_glewInit_WGL_NV_copy_image(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_NV_copy_image */
-#ifdef WGL_NV_delay_before_swap
- WGLEW_NV_delay_before_swap = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_delay_before_swap");
- if (glewExperimental || WGLEW_NV_delay_before_swap|| crippled) WGLEW_NV_delay_before_swap= !_glewInit_WGL_NV_delay_before_swap(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_NV_delay_before_swap */
-#ifdef WGL_NV_float_buffer
- WGLEW_NV_float_buffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_float_buffer");
-#endif /* WGL_NV_float_buffer */
-#ifdef WGL_NV_gpu_affinity
- WGLEW_NV_gpu_affinity = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_gpu_affinity");
- if (glewExperimental || WGLEW_NV_gpu_affinity|| crippled) WGLEW_NV_gpu_affinity= !_glewInit_WGL_NV_gpu_affinity(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_NV_gpu_affinity */
-#ifdef WGL_NV_multisample_coverage
- WGLEW_NV_multisample_coverage = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_multisample_coverage");
-#endif /* WGL_NV_multisample_coverage */
-#ifdef WGL_NV_present_video
- WGLEW_NV_present_video = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_present_video");
- if (glewExperimental || WGLEW_NV_present_video|| crippled) WGLEW_NV_present_video= !_glewInit_WGL_NV_present_video(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_NV_present_video */
-#ifdef WGL_NV_render_depth_texture
- WGLEW_NV_render_depth_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_render_depth_texture");
-#endif /* WGL_NV_render_depth_texture */
-#ifdef WGL_NV_render_texture_rectangle
- WGLEW_NV_render_texture_rectangle = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_render_texture_rectangle");
-#endif /* WGL_NV_render_texture_rectangle */
-#ifdef WGL_NV_swap_group
- WGLEW_NV_swap_group = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_swap_group");
- if (glewExperimental || WGLEW_NV_swap_group|| crippled) WGLEW_NV_swap_group= !_glewInit_WGL_NV_swap_group(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_NV_swap_group */
-#ifdef WGL_NV_vertex_array_range
- WGLEW_NV_vertex_array_range = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_vertex_array_range");
- if (glewExperimental || WGLEW_NV_vertex_array_range|| crippled) WGLEW_NV_vertex_array_range= !_glewInit_WGL_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_NV_vertex_array_range */
-#ifdef WGL_NV_video_capture
- WGLEW_NV_video_capture = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_video_capture");
- if (glewExperimental || WGLEW_NV_video_capture|| crippled) WGLEW_NV_video_capture= !_glewInit_WGL_NV_video_capture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_NV_video_capture */
-#ifdef WGL_NV_video_output
- WGLEW_NV_video_output = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_NV_video_output");
- if (glewExperimental || WGLEW_NV_video_output|| crippled) WGLEW_NV_video_output= !_glewInit_WGL_NV_video_output(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_NV_video_output */
-#ifdef WGL_OML_sync_control
- WGLEW_OML_sync_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"WGL_OML_sync_control");
- if (glewExperimental || WGLEW_OML_sync_control|| crippled) WGLEW_OML_sync_control= !_glewInit_WGL_OML_sync_control(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* WGL_OML_sync_control */
-
- return GLEW_OK;
-}
-
-#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
-
-PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay = NULL;
-
-PFNGLXCHOOSEFBCONFIGPROC __glewXChooseFBConfig = NULL;
-PFNGLXCREATENEWCONTEXTPROC __glewXCreateNewContext = NULL;
-PFNGLXCREATEPBUFFERPROC __glewXCreatePbuffer = NULL;
-PFNGLXCREATEPIXMAPPROC __glewXCreatePixmap = NULL;
-PFNGLXCREATEWINDOWPROC __glewXCreateWindow = NULL;
-PFNGLXDESTROYPBUFFERPROC __glewXDestroyPbuffer = NULL;
-PFNGLXDESTROYPIXMAPPROC __glewXDestroyPixmap = NULL;
-PFNGLXDESTROYWINDOWPROC __glewXDestroyWindow = NULL;
-PFNGLXGETCURRENTREADDRAWABLEPROC __glewXGetCurrentReadDrawable = NULL;
-PFNGLXGETFBCONFIGATTRIBPROC __glewXGetFBConfigAttrib = NULL;
-PFNGLXGETFBCONFIGSPROC __glewXGetFBConfigs = NULL;
-PFNGLXGETSELECTEDEVENTPROC __glewXGetSelectedEvent = NULL;
-PFNGLXGETVISUALFROMFBCONFIGPROC __glewXGetVisualFromFBConfig = NULL;
-PFNGLXMAKECONTEXTCURRENTPROC __glewXMakeContextCurrent = NULL;
-PFNGLXQUERYCONTEXTPROC __glewXQueryContext = NULL;
-PFNGLXQUERYDRAWABLEPROC __glewXQueryDrawable = NULL;
-PFNGLXSELECTEVENTPROC __glewXSelectEvent = NULL;
-
-PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC __glewXBlitContextFramebufferAMD = NULL;
-PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC __glewXCreateAssociatedContextAMD = NULL;
-PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __glewXCreateAssociatedContextAttribsAMD = NULL;
-PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC __glewXDeleteAssociatedContextAMD = NULL;
-PFNGLXGETCONTEXTGPUIDAMDPROC __glewXGetContextGPUIDAMD = NULL;
-PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC __glewXGetCurrentAssociatedContextAMD = NULL;
-PFNGLXGETGPUIDSAMDPROC __glewXGetGPUIDsAMD = NULL;
-PFNGLXGETGPUINFOAMDPROC __glewXGetGPUInfoAMD = NULL;
-PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __glewXMakeAssociatedContextCurrentAMD = NULL;
-
-PFNGLXCREATECONTEXTATTRIBSARBPROC __glewXCreateContextAttribsARB = NULL;
-
-PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI = NULL;
-PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI = NULL;
-PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI = NULL;
-
-PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT = NULL;
-PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT = NULL;
-PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT = NULL;
-PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT = NULL;
-
-PFNGLXSWAPINTERVALEXTPROC __glewXSwapIntervalEXT = NULL;
-
-PFNGLXBINDTEXIMAGEEXTPROC __glewXBindTexImageEXT = NULL;
-PFNGLXRELEASETEXIMAGEEXTPROC __glewXReleaseTexImageEXT = NULL;
-
-PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA = NULL;
-
-PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA = NULL;
-
-PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA = NULL;
-
-PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC __glewXQueryCurrentRendererIntegerMESA = NULL;
-PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC __glewXQueryCurrentRendererStringMESA = NULL;
-PFNGLXQUERYRENDERERINTEGERMESAPROC __glewXQueryRendererIntegerMESA = NULL;
-PFNGLXQUERYRENDERERSTRINGMESAPROC __glewXQueryRendererStringMESA = NULL;
-
-PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA = NULL;
-
-PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA = NULL;
-
-PFNGLXGETSWAPINTERVALMESAPROC __glewXGetSwapIntervalMESA = NULL;
-PFNGLXSWAPINTERVALMESAPROC __glewXSwapIntervalMESA = NULL;
-
-PFNGLXCOPYBUFFERSUBDATANVPROC __glewXCopyBufferSubDataNV = NULL;
-PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC __glewXNamedCopyBufferSubDataNV = NULL;
-
-PFNGLXCOPYIMAGESUBDATANVPROC __glewXCopyImageSubDataNV = NULL;
-
-PFNGLXDELAYBEFORESWAPNVPROC __glewXDelayBeforeSwapNV = NULL;
-
-PFNGLXBINDVIDEODEVICENVPROC __glewXBindVideoDeviceNV = NULL;
-PFNGLXENUMERATEVIDEODEVICESNVPROC __glewXEnumerateVideoDevicesNV = NULL;
-
-PFNGLXBINDSWAPBARRIERNVPROC __glewXBindSwapBarrierNV = NULL;
-PFNGLXJOINSWAPGROUPNVPROC __glewXJoinSwapGroupNV = NULL;
-PFNGLXQUERYFRAMECOUNTNVPROC __glewXQueryFrameCountNV = NULL;
-PFNGLXQUERYMAXSWAPGROUPSNVPROC __glewXQueryMaxSwapGroupsNV = NULL;
-PFNGLXQUERYSWAPGROUPNVPROC __glewXQuerySwapGroupNV = NULL;
-PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV = NULL;
-
-PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV = NULL;
-PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV = NULL;
-
-PFNGLXBINDVIDEOCAPTUREDEVICENVPROC __glewXBindVideoCaptureDeviceNV = NULL;
-PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC __glewXEnumerateVideoCaptureDevicesNV = NULL;
-PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC __glewXLockVideoCaptureDeviceNV = NULL;
-PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC __glewXQueryVideoCaptureDeviceNV = NULL;
-PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC __glewXReleaseVideoCaptureDeviceNV = NULL;
-
-PFNGLXBINDVIDEOIMAGENVPROC __glewXBindVideoImageNV = NULL;
-PFNGLXGETVIDEODEVICENVPROC __glewXGetVideoDeviceNV = NULL;
-PFNGLXGETVIDEOINFONVPROC __glewXGetVideoInfoNV = NULL;
-PFNGLXRELEASEVIDEODEVICENVPROC __glewXReleaseVideoDeviceNV = NULL;
-PFNGLXRELEASEVIDEOIMAGENVPROC __glewXReleaseVideoImageNV = NULL;
-PFNGLXSENDPBUFFERTOVIDEONVPROC __glewXSendPbufferToVideoNV = NULL;
-
-PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML = NULL;
-PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML = NULL;
-PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML = NULL;
-PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML = NULL;
-PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML = NULL;
-
-PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX = NULL;
-PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX = NULL;
-PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC __glewXCreateGLXPixmapWithConfigSGIX = NULL;
-PFNGLXGETFBCONFIGATTRIBSGIXPROC __glewXGetFBConfigAttribSGIX = NULL;
-PFNGLXGETFBCONFIGFROMVISUALSGIXPROC __glewXGetFBConfigFromVisualSGIX = NULL;
-PFNGLXGETVISUALFROMFBCONFIGSGIXPROC __glewXGetVisualFromFBConfigSGIX = NULL;
-
-PFNGLXBINDHYPERPIPESGIXPROC __glewXBindHyperpipeSGIX = NULL;
-PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC __glewXDestroyHyperpipeConfigSGIX = NULL;
-PFNGLXHYPERPIPEATTRIBSGIXPROC __glewXHyperpipeAttribSGIX = NULL;
-PFNGLXHYPERPIPECONFIGSGIXPROC __glewXHyperpipeConfigSGIX = NULL;
-PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC __glewXQueryHyperpipeAttribSGIX = NULL;
-PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC __glewXQueryHyperpipeBestAttribSGIX = NULL;
-PFNGLXQUERYHYPERPIPECONFIGSGIXPROC __glewXQueryHyperpipeConfigSGIX = NULL;
-PFNGLXQUERYHYPERPIPENETWORKSGIXPROC __glewXQueryHyperpipeNetworkSGIX = NULL;
-
-PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX = NULL;
-PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX = NULL;
-PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX = NULL;
-PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX = NULL;
-PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX = NULL;
-
-PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX = NULL;
-PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX = NULL;
-
-PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX = NULL;
-
-PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX = NULL;
-PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX = NULL;
-PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX = NULL;
-PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX = NULL;
-PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX = NULL;
-
-PFNGLXCUSHIONSGIPROC __glewXCushionSGI = NULL;
-
-PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI = NULL;
-PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI = NULL;
-
-PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI = NULL;
-
-PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI = NULL;
-PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI = NULL;
-
-PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN = NULL;
-
-PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN = NULL;
-PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN = NULL;
-
-#if !defined(GLEW_MX)
-
-GLboolean __GLXEW_VERSION_1_0 = GL_FALSE;
-GLboolean __GLXEW_VERSION_1_1 = GL_FALSE;
-GLboolean __GLXEW_VERSION_1_2 = GL_FALSE;
-GLboolean __GLXEW_VERSION_1_3 = GL_FALSE;
-GLboolean __GLXEW_VERSION_1_4 = GL_FALSE;
-GLboolean __GLXEW_3DFX_multisample = GL_FALSE;
-GLboolean __GLXEW_AMD_gpu_association = GL_FALSE;
-GLboolean __GLXEW_ARB_context_flush_control = GL_FALSE;
-GLboolean __GLXEW_ARB_create_context = GL_FALSE;
-GLboolean __GLXEW_ARB_create_context_profile = GL_FALSE;
-GLboolean __GLXEW_ARB_create_context_robustness = GL_FALSE;
-GLboolean __GLXEW_ARB_fbconfig_float = GL_FALSE;
-GLboolean __GLXEW_ARB_framebuffer_sRGB = GL_FALSE;
-GLboolean __GLXEW_ARB_get_proc_address = GL_FALSE;
-GLboolean __GLXEW_ARB_multisample = GL_FALSE;
-GLboolean __GLXEW_ARB_robustness_application_isolation = GL_FALSE;
-GLboolean __GLXEW_ARB_robustness_share_group_isolation = GL_FALSE;
-GLboolean __GLXEW_ARB_vertex_buffer_object = GL_FALSE;
-GLboolean __GLXEW_ATI_pixel_format_float = GL_FALSE;
-GLboolean __GLXEW_ATI_render_texture = GL_FALSE;
-GLboolean __GLXEW_EXT_buffer_age = GL_FALSE;
-GLboolean __GLXEW_EXT_create_context_es2_profile = GL_FALSE;
-GLboolean __GLXEW_EXT_create_context_es_profile = GL_FALSE;
-GLboolean __GLXEW_EXT_fbconfig_packed_float = GL_FALSE;
-GLboolean __GLXEW_EXT_framebuffer_sRGB = GL_FALSE;
-GLboolean __GLXEW_EXT_import_context = GL_FALSE;
-GLboolean __GLXEW_EXT_scene_marker = GL_FALSE;
-GLboolean __GLXEW_EXT_stereo_tree = GL_FALSE;
-GLboolean __GLXEW_EXT_swap_control = GL_FALSE;
-GLboolean __GLXEW_EXT_swap_control_tear = GL_FALSE;
-GLboolean __GLXEW_EXT_texture_from_pixmap = GL_FALSE;
-GLboolean __GLXEW_EXT_visual_info = GL_FALSE;
-GLboolean __GLXEW_EXT_visual_rating = GL_FALSE;
-GLboolean __GLXEW_INTEL_swap_event = GL_FALSE;
-GLboolean __GLXEW_MESA_agp_offset = GL_FALSE;
-GLboolean __GLXEW_MESA_copy_sub_buffer = GL_FALSE;
-GLboolean __GLXEW_MESA_pixmap_colormap = GL_FALSE;
-GLboolean __GLXEW_MESA_query_renderer = GL_FALSE;
-GLboolean __GLXEW_MESA_release_buffers = GL_FALSE;
-GLboolean __GLXEW_MESA_set_3dfx_mode = GL_FALSE;
-GLboolean __GLXEW_MESA_swap_control = GL_FALSE;
-GLboolean __GLXEW_NV_copy_buffer = GL_FALSE;
-GLboolean __GLXEW_NV_copy_image = GL_FALSE;
-GLboolean __GLXEW_NV_delay_before_swap = GL_FALSE;
-GLboolean __GLXEW_NV_float_buffer = GL_FALSE;
-GLboolean __GLXEW_NV_multisample_coverage = GL_FALSE;
-GLboolean __GLXEW_NV_present_video = GL_FALSE;
-GLboolean __GLXEW_NV_swap_group = GL_FALSE;
-GLboolean __GLXEW_NV_vertex_array_range = GL_FALSE;
-GLboolean __GLXEW_NV_video_capture = GL_FALSE;
-GLboolean __GLXEW_NV_video_out = GL_FALSE;
-GLboolean __GLXEW_OML_swap_method = GL_FALSE;
-GLboolean __GLXEW_OML_sync_control = GL_FALSE;
-GLboolean __GLXEW_SGIS_blended_overlay = GL_FALSE;
-GLboolean __GLXEW_SGIS_color_range = GL_FALSE;
-GLboolean __GLXEW_SGIS_multisample = GL_FALSE;
-GLboolean __GLXEW_SGIS_shared_multisample = GL_FALSE;
-GLboolean __GLXEW_SGIX_fbconfig = GL_FALSE;
-GLboolean __GLXEW_SGIX_hyperpipe = GL_FALSE;
-GLboolean __GLXEW_SGIX_pbuffer = GL_FALSE;
-GLboolean __GLXEW_SGIX_swap_barrier = GL_FALSE;
-GLboolean __GLXEW_SGIX_swap_group = GL_FALSE;
-GLboolean __GLXEW_SGIX_video_resize = GL_FALSE;
-GLboolean __GLXEW_SGIX_visual_select_group = GL_FALSE;
-GLboolean __GLXEW_SGI_cushion = GL_FALSE;
-GLboolean __GLXEW_SGI_make_current_read = GL_FALSE;
-GLboolean __GLXEW_SGI_swap_control = GL_FALSE;
-GLboolean __GLXEW_SGI_video_sync = GL_FALSE;
-GLboolean __GLXEW_SUN_get_transparent_index = GL_FALSE;
-GLboolean __GLXEW_SUN_video_resize = GL_FALSE;
-
-#endif /* !GLEW_MX */
-
-#ifdef GLX_VERSION_1_2
-
-static GLboolean _glewInit_GLX_VERSION_1_2 (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXGetCurrentDisplay = (PFNGLXGETCURRENTDISPLAYPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentDisplay")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_VERSION_1_2 */
-
-#ifdef GLX_VERSION_1_3
-
-static GLboolean _glewInit_GLX_VERSION_1_3 (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)glewGetProcAddress((const GLubyte*)"glXChooseFBConfig")) == NULL) || r;
- r = ((glXCreateNewContext = (PFNGLXCREATENEWCONTEXTPROC)glewGetProcAddress((const GLubyte*)"glXCreateNewContext")) == NULL) || r;
- r = ((glXCreatePbuffer = (PFNGLXCREATEPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glXCreatePbuffer")) == NULL) || r;
- r = ((glXCreatePixmap = (PFNGLXCREATEPIXMAPPROC)glewGetProcAddress((const GLubyte*)"glXCreatePixmap")) == NULL) || r;
- r = ((glXCreateWindow = (PFNGLXCREATEWINDOWPROC)glewGetProcAddress((const GLubyte*)"glXCreateWindow")) == NULL) || r;
- r = ((glXDestroyPbuffer = (PFNGLXDESTROYPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glXDestroyPbuffer")) == NULL) || r;
- r = ((glXDestroyPixmap = (PFNGLXDESTROYPIXMAPPROC)glewGetProcAddress((const GLubyte*)"glXDestroyPixmap")) == NULL) || r;
- r = ((glXDestroyWindow = (PFNGLXDESTROYWINDOWPROC)glewGetProcAddress((const GLubyte*)"glXDestroyWindow")) == NULL) || r;
- r = ((glXGetCurrentReadDrawable = (PFNGLXGETCURRENTREADDRAWABLEPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentReadDrawable")) == NULL) || r;
- r = ((glXGetFBConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigAttrib")) == NULL) || r;
- r = ((glXGetFBConfigs = (PFNGLXGETFBCONFIGSPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigs")) == NULL) || r;
- r = ((glXGetSelectedEvent = (PFNGLXGETSELECTEDEVENTPROC)glewGetProcAddress((const GLubyte*)"glXGetSelectedEvent")) == NULL) || r;
- r = ((glXGetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)glewGetProcAddress((const GLubyte*)"glXGetVisualFromFBConfig")) == NULL) || r;
- r = ((glXMakeContextCurrent = (PFNGLXMAKECONTEXTCURRENTPROC)glewGetProcAddress((const GLubyte*)"glXMakeContextCurrent")) == NULL) || r;
- r = ((glXQueryContext = (PFNGLXQUERYCONTEXTPROC)glewGetProcAddress((const GLubyte*)"glXQueryContext")) == NULL) || r;
- r = ((glXQueryDrawable = (PFNGLXQUERYDRAWABLEPROC)glewGetProcAddress((const GLubyte*)"glXQueryDrawable")) == NULL) || r;
- r = ((glXSelectEvent = (PFNGLXSELECTEVENTPROC)glewGetProcAddress((const GLubyte*)"glXSelectEvent")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_VERSION_1_3 */
-
-#ifdef GLX_VERSION_1_4
-
-#endif /* GLX_VERSION_1_4 */
-
-#ifdef GLX_3DFX_multisample
-
-#endif /* GLX_3DFX_multisample */
-
-#ifdef GLX_AMD_gpu_association
-
-static GLboolean _glewInit_GLX_AMD_gpu_association (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXBlitContextFramebufferAMD = (PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC)glewGetProcAddress((const GLubyte*)"glXBlitContextFramebufferAMD")) == NULL) || r;
- r = ((glXCreateAssociatedContextAMD = (PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"glXCreateAssociatedContextAMD")) == NULL) || r;
- r = ((glXCreateAssociatedContextAttribsAMD = (PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC)glewGetProcAddress((const GLubyte*)"glXCreateAssociatedContextAttribsAMD")) == NULL) || r;
- r = ((glXDeleteAssociatedContextAMD = (PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"glXDeleteAssociatedContextAMD")) == NULL) || r;
- r = ((glXGetContextGPUIDAMD = (PFNGLXGETCONTEXTGPUIDAMDPROC)glewGetProcAddress((const GLubyte*)"glXGetContextGPUIDAMD")) == NULL) || r;
- r = ((glXGetCurrentAssociatedContextAMD = (PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentAssociatedContextAMD")) == NULL) || r;
- r = ((glXGetGPUIDsAMD = (PFNGLXGETGPUIDSAMDPROC)glewGetProcAddress((const GLubyte*)"glXGetGPUIDsAMD")) == NULL) || r;
- r = ((glXGetGPUInfoAMD = (PFNGLXGETGPUINFOAMDPROC)glewGetProcAddress((const GLubyte*)"glXGetGPUInfoAMD")) == NULL) || r;
- r = ((glXMakeAssociatedContextCurrentAMD = (PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC)glewGetProcAddress((const GLubyte*)"glXMakeAssociatedContextCurrentAMD")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_AMD_gpu_association */
-
-#ifdef GLX_ARB_context_flush_control
-
-#endif /* GLX_ARB_context_flush_control */
-
-#ifdef GLX_ARB_create_context
-
-static GLboolean _glewInit_GLX_ARB_create_context (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glewGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_ARB_create_context */
-
-#ifdef GLX_ARB_create_context_profile
-
-#endif /* GLX_ARB_create_context_profile */
-
-#ifdef GLX_ARB_create_context_robustness
-
-#endif /* GLX_ARB_create_context_robustness */
-
-#ifdef GLX_ARB_fbconfig_float
-
-#endif /* GLX_ARB_fbconfig_float */
-
-#ifdef GLX_ARB_framebuffer_sRGB
-
-#endif /* GLX_ARB_framebuffer_sRGB */
-
-#ifdef GLX_ARB_get_proc_address
-
-#endif /* GLX_ARB_get_proc_address */
-
-#ifdef GLX_ARB_multisample
-
-#endif /* GLX_ARB_multisample */
-
-#ifdef GLX_ARB_robustness_application_isolation
-
-#endif /* GLX_ARB_robustness_application_isolation */
-
-#ifdef GLX_ARB_robustness_share_group_isolation
-
-#endif /* GLX_ARB_robustness_share_group_isolation */
-
-#ifdef GLX_ARB_vertex_buffer_object
-
-#endif /* GLX_ARB_vertex_buffer_object */
-
-#ifdef GLX_ATI_pixel_format_float
-
-#endif /* GLX_ATI_pixel_format_float */
-
-#ifdef GLX_ATI_render_texture
-
-static GLboolean _glewInit_GLX_ATI_render_texture (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXBindTexImageATI = (PFNGLXBINDTEXIMAGEATIPROC)glewGetProcAddress((const GLubyte*)"glXBindTexImageATI")) == NULL) || r;
- r = ((glXDrawableAttribATI = (PFNGLXDRAWABLEATTRIBATIPROC)glewGetProcAddress((const GLubyte*)"glXDrawableAttribATI")) == NULL) || r;
- r = ((glXReleaseTexImageATI = (PFNGLXRELEASETEXIMAGEATIPROC)glewGetProcAddress((const GLubyte*)"glXReleaseTexImageATI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_ATI_render_texture */
-
-#ifdef GLX_EXT_buffer_age
-
-#endif /* GLX_EXT_buffer_age */
-
-#ifdef GLX_EXT_create_context_es2_profile
-
-#endif /* GLX_EXT_create_context_es2_profile */
-
-#ifdef GLX_EXT_create_context_es_profile
-
-#endif /* GLX_EXT_create_context_es_profile */
-
-#ifdef GLX_EXT_fbconfig_packed_float
-
-#endif /* GLX_EXT_fbconfig_packed_float */
-
-#ifdef GLX_EXT_framebuffer_sRGB
-
-#endif /* GLX_EXT_framebuffer_sRGB */
-
-#ifdef GLX_EXT_import_context
-
-static GLboolean _glewInit_GLX_EXT_import_context (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXFreeContextEXT = (PFNGLXFREECONTEXTEXTPROC)glewGetProcAddress((const GLubyte*)"glXFreeContextEXT")) == NULL) || r;
- r = ((glXGetContextIDEXT = (PFNGLXGETCONTEXTIDEXTPROC)glewGetProcAddress((const GLubyte*)"glXGetContextIDEXT")) == NULL) || r;
- r = ((glXImportContextEXT = (PFNGLXIMPORTCONTEXTEXTPROC)glewGetProcAddress((const GLubyte*)"glXImportContextEXT")) == NULL) || r;
- r = ((glXQueryContextInfoEXT = (PFNGLXQUERYCONTEXTINFOEXTPROC)glewGetProcAddress((const GLubyte*)"glXQueryContextInfoEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_EXT_import_context */
-
-#ifdef GLX_EXT_scene_marker
-
-#endif /* GLX_EXT_scene_marker */
-
-#ifdef GLX_EXT_stereo_tree
-
-#endif /* GLX_EXT_stereo_tree */
-
-#ifdef GLX_EXT_swap_control
-
-static GLboolean _glewInit_GLX_EXT_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_EXT_swap_control */
-
-#ifdef GLX_EXT_swap_control_tear
-
-#endif /* GLX_EXT_swap_control_tear */
-
-#ifdef GLX_EXT_texture_from_pixmap
-
-static GLboolean _glewInit_GLX_EXT_texture_from_pixmap (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glXBindTexImageEXT")) == NULL) || r;
- r = ((glXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glXReleaseTexImageEXT")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_EXT_texture_from_pixmap */
-
-#ifdef GLX_EXT_visual_info
-
-#endif /* GLX_EXT_visual_info */
-
-#ifdef GLX_EXT_visual_rating
-
-#endif /* GLX_EXT_visual_rating */
-
-#ifdef GLX_INTEL_swap_event
-
-#endif /* GLX_INTEL_swap_event */
-
-#ifdef GLX_MESA_agp_offset
-
-static GLboolean _glewInit_GLX_MESA_agp_offset (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXGetAGPOffsetMESA = (PFNGLXGETAGPOFFSETMESAPROC)glewGetProcAddress((const GLubyte*)"glXGetAGPOffsetMESA")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_MESA_agp_offset */
-
-#ifdef GLX_MESA_copy_sub_buffer
-
-static GLboolean _glewInit_GLX_MESA_copy_sub_buffer (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXCopySubBufferMESA = (PFNGLXCOPYSUBBUFFERMESAPROC)glewGetProcAddress((const GLubyte*)"glXCopySubBufferMESA")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_MESA_copy_sub_buffer */
-
-#ifdef GLX_MESA_pixmap_colormap
-
-static GLboolean _glewInit_GLX_MESA_pixmap_colormap (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXCreateGLXPixmapMESA = (PFNGLXCREATEGLXPIXMAPMESAPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPixmapMESA")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_MESA_pixmap_colormap */
-
-#ifdef GLX_MESA_query_renderer
-
-static GLboolean _glewInit_GLX_MESA_query_renderer (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXQueryCurrentRendererIntegerMESA = (PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)glewGetProcAddress((const GLubyte*)"glXQueryCurrentRendererIntegerMESA")) == NULL) || r;
- r = ((glXQueryCurrentRendererStringMESA = (PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC)glewGetProcAddress((const GLubyte*)"glXQueryCurrentRendererStringMESA")) == NULL) || r;
- r = ((glXQueryRendererIntegerMESA = (PFNGLXQUERYRENDERERINTEGERMESAPROC)glewGetProcAddress((const GLubyte*)"glXQueryRendererIntegerMESA")) == NULL) || r;
- r = ((glXQueryRendererStringMESA = (PFNGLXQUERYRENDERERSTRINGMESAPROC)glewGetProcAddress((const GLubyte*)"glXQueryRendererStringMESA")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_MESA_query_renderer */
-
-#ifdef GLX_MESA_release_buffers
-
-static GLboolean _glewInit_GLX_MESA_release_buffers (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXReleaseBuffersMESA = (PFNGLXRELEASEBUFFERSMESAPROC)glewGetProcAddress((const GLubyte*)"glXReleaseBuffersMESA")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_MESA_release_buffers */
-
-#ifdef GLX_MESA_set_3dfx_mode
-
-static GLboolean _glewInit_GLX_MESA_set_3dfx_mode (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXSet3DfxModeMESA = (PFNGLXSET3DFXMODEMESAPROC)glewGetProcAddress((const GLubyte*)"glXSet3DfxModeMESA")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_MESA_set_3dfx_mode */
-
-#ifdef GLX_MESA_swap_control
-
-static GLboolean _glewInit_GLX_MESA_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXGetSwapIntervalMESA = (PFNGLXGETSWAPINTERVALMESAPROC)glewGetProcAddress((const GLubyte*)"glXGetSwapIntervalMESA")) == NULL) || r;
- r = ((glXSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalMESA")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_MESA_swap_control */
-
-#ifdef GLX_NV_copy_buffer
-
-static GLboolean _glewInit_GLX_NV_copy_buffer (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXCopyBufferSubDataNV = (PFNGLXCOPYBUFFERSUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glXCopyBufferSubDataNV")) == NULL) || r;
- r = ((glXNamedCopyBufferSubDataNV = (PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glXNamedCopyBufferSubDataNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_NV_copy_buffer */
-
-#ifdef GLX_NV_copy_image
-
-static GLboolean _glewInit_GLX_NV_copy_image (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXCopyImageSubDataNV = (PFNGLXCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glXCopyImageSubDataNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_NV_copy_image */
-
-#ifdef GLX_NV_delay_before_swap
-
-static GLboolean _glewInit_GLX_NV_delay_before_swap (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXDelayBeforeSwapNV = (PFNGLXDELAYBEFORESWAPNVPROC)glewGetProcAddress((const GLubyte*)"glXDelayBeforeSwapNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_NV_delay_before_swap */
-
-#ifdef GLX_NV_float_buffer
-
-#endif /* GLX_NV_float_buffer */
-
-#ifdef GLX_NV_multisample_coverage
-
-#endif /* GLX_NV_multisample_coverage */
-
-#ifdef GLX_NV_present_video
-
-static GLboolean _glewInit_GLX_NV_present_video (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXBindVideoDeviceNV = (PFNGLXBINDVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXBindVideoDeviceNV")) == NULL) || r;
- r = ((glXEnumerateVideoDevicesNV = (PFNGLXENUMERATEVIDEODEVICESNVPROC)glewGetProcAddress((const GLubyte*)"glXEnumerateVideoDevicesNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_NV_present_video */
-
-#ifdef GLX_NV_swap_group
-
-static GLboolean _glewInit_GLX_NV_swap_group (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXBindSwapBarrierNV = (PFNGLXBINDSWAPBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"glXBindSwapBarrierNV")) == NULL) || r;
- r = ((glXJoinSwapGroupNV = (PFNGLXJOINSWAPGROUPNVPROC)glewGetProcAddress((const GLubyte*)"glXJoinSwapGroupNV")) == NULL) || r;
- r = ((glXQueryFrameCountNV = (PFNGLXQUERYFRAMECOUNTNVPROC)glewGetProcAddress((const GLubyte*)"glXQueryFrameCountNV")) == NULL) || r;
- r = ((glXQueryMaxSwapGroupsNV = (PFNGLXQUERYMAXSWAPGROUPSNVPROC)glewGetProcAddress((const GLubyte*)"glXQueryMaxSwapGroupsNV")) == NULL) || r;
- r = ((glXQuerySwapGroupNV = (PFNGLXQUERYSWAPGROUPNVPROC)glewGetProcAddress((const GLubyte*)"glXQuerySwapGroupNV")) == NULL) || r;
- r = ((glXResetFrameCountNV = (PFNGLXRESETFRAMECOUNTNVPROC)glewGetProcAddress((const GLubyte*)"glXResetFrameCountNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_NV_swap_group */
-
-#ifdef GLX_NV_vertex_array_range
-
-static GLboolean _glewInit_GLX_NV_vertex_array_range (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXAllocateMemoryNV = (PFNGLXALLOCATEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"glXAllocateMemoryNV")) == NULL) || r;
- r = ((glXFreeMemoryNV = (PFNGLXFREEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"glXFreeMemoryNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_NV_vertex_array_range */
-
-#ifdef GLX_NV_video_capture
-
-static GLboolean _glewInit_GLX_NV_video_capture (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXBindVideoCaptureDeviceNV = (PFNGLXBINDVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXBindVideoCaptureDeviceNV")) == NULL) || r;
- r = ((glXEnumerateVideoCaptureDevicesNV = (PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC)glewGetProcAddress((const GLubyte*)"glXEnumerateVideoCaptureDevicesNV")) == NULL) || r;
- r = ((glXLockVideoCaptureDeviceNV = (PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXLockVideoCaptureDeviceNV")) == NULL) || r;
- r = ((glXQueryVideoCaptureDeviceNV = (PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXQueryVideoCaptureDeviceNV")) == NULL) || r;
- r = ((glXReleaseVideoCaptureDeviceNV = (PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXReleaseVideoCaptureDeviceNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_NV_video_capture */
-
-#ifdef GLX_NV_video_out
-
-static GLboolean _glewInit_GLX_NV_video_out (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXBindVideoImageNV = (PFNGLXBINDVIDEOIMAGENVPROC)glewGetProcAddress((const GLubyte*)"glXBindVideoImageNV")) == NULL) || r;
- r = ((glXGetVideoDeviceNV = (PFNGLXGETVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoDeviceNV")) == NULL) || r;
- r = ((glXGetVideoInfoNV = (PFNGLXGETVIDEOINFONVPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoInfoNV")) == NULL) || r;
- r = ((glXReleaseVideoDeviceNV = (PFNGLXRELEASEVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXReleaseVideoDeviceNV")) == NULL) || r;
- r = ((glXReleaseVideoImageNV = (PFNGLXRELEASEVIDEOIMAGENVPROC)glewGetProcAddress((const GLubyte*)"glXReleaseVideoImageNV")) == NULL) || r;
- r = ((glXSendPbufferToVideoNV = (PFNGLXSENDPBUFFERTOVIDEONVPROC)glewGetProcAddress((const GLubyte*)"glXSendPbufferToVideoNV")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_NV_video_out */
-
-#ifdef GLX_OML_swap_method
-
-#endif /* GLX_OML_swap_method */
-
-#ifdef GLX_OML_sync_control
-
-static GLboolean _glewInit_GLX_OML_sync_control (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXGetMscRateOML = (PFNGLXGETMSCRATEOMLPROC)glewGetProcAddress((const GLubyte*)"glXGetMscRateOML")) == NULL) || r;
- r = ((glXGetSyncValuesOML = (PFNGLXGETSYNCVALUESOMLPROC)glewGetProcAddress((const GLubyte*)"glXGetSyncValuesOML")) == NULL) || r;
- r = ((glXSwapBuffersMscOML = (PFNGLXSWAPBUFFERSMSCOMLPROC)glewGetProcAddress((const GLubyte*)"glXSwapBuffersMscOML")) == NULL) || r;
- r = ((glXWaitForMscOML = (PFNGLXWAITFORMSCOMLPROC)glewGetProcAddress((const GLubyte*)"glXWaitForMscOML")) == NULL) || r;
- r = ((glXWaitForSbcOML = (PFNGLXWAITFORSBCOMLPROC)glewGetProcAddress((const GLubyte*)"glXWaitForSbcOML")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_OML_sync_control */
-
-#ifdef GLX_SGIS_blended_overlay
-
-#endif /* GLX_SGIS_blended_overlay */
-
-#ifdef GLX_SGIS_color_range
-
-#endif /* GLX_SGIS_color_range */
-
-#ifdef GLX_SGIS_multisample
-
-#endif /* GLX_SGIS_multisample */
-
-#ifdef GLX_SGIS_shared_multisample
-
-#endif /* GLX_SGIS_shared_multisample */
-
-#ifdef GLX_SGIX_fbconfig
-
-static GLboolean _glewInit_GLX_SGIX_fbconfig (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXChooseFBConfigSGIX = (PFNGLXCHOOSEFBCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXChooseFBConfigSGIX")) == NULL) || r;
- r = ((glXCreateContextWithConfigSGIX = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXCreateContextWithConfigSGIX")) == NULL) || r;
- r = ((glXCreateGLXPixmapWithConfigSGIX = (PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPixmapWithConfigSGIX")) == NULL) || r;
- r = ((glXGetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigAttribSGIX")) == NULL) || r;
- r = ((glXGetFBConfigFromVisualSGIX = (PFNGLXGETFBCONFIGFROMVISUALSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigFromVisualSGIX")) == NULL) || r;
- r = ((glXGetVisualFromFBConfigSGIX = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetVisualFromFBConfigSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_SGIX_fbconfig */
-
-#ifdef GLX_SGIX_hyperpipe
-
-static GLboolean _glewInit_GLX_SGIX_hyperpipe (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXBindHyperpipeSGIX = (PFNGLXBINDHYPERPIPESGIXPROC)glewGetProcAddress((const GLubyte*)"glXBindHyperpipeSGIX")) == NULL) || r;
- r = ((glXDestroyHyperpipeConfigSGIX = (PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXDestroyHyperpipeConfigSGIX")) == NULL) || r;
- r = ((glXHyperpipeAttribSGIX = (PFNGLXHYPERPIPEATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXHyperpipeAttribSGIX")) == NULL) || r;
- r = ((glXHyperpipeConfigSGIX = (PFNGLXHYPERPIPECONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXHyperpipeConfigSGIX")) == NULL) || r;
- r = ((glXQueryHyperpipeAttribSGIX = (PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryHyperpipeAttribSGIX")) == NULL) || r;
- r = ((glXQueryHyperpipeBestAttribSGIX = (PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryHyperpipeBestAttribSGIX")) == NULL) || r;
- r = ((glXQueryHyperpipeConfigSGIX = (PFNGLXQUERYHYPERPIPECONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryHyperpipeConfigSGIX")) == NULL) || r;
- r = ((glXQueryHyperpipeNetworkSGIX = (PFNGLXQUERYHYPERPIPENETWORKSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryHyperpipeNetworkSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_SGIX_hyperpipe */
-
-#ifdef GLX_SGIX_pbuffer
-
-static GLboolean _glewInit_GLX_SGIX_pbuffer (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXCreateGLXPbufferSGIX = (PFNGLXCREATEGLXPBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPbufferSGIX")) == NULL) || r;
- r = ((glXDestroyGLXPbufferSGIX = (PFNGLXDESTROYGLXPBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXDestroyGLXPbufferSGIX")) == NULL) || r;
- r = ((glXGetSelectedEventSGIX = (PFNGLXGETSELECTEDEVENTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetSelectedEventSGIX")) == NULL) || r;
- r = ((glXQueryGLXPbufferSGIX = (PFNGLXQUERYGLXPBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryGLXPbufferSGIX")) == NULL) || r;
- r = ((glXSelectEventSGIX = (PFNGLXSELECTEVENTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXSelectEventSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_SGIX_pbuffer */
-
-#ifdef GLX_SGIX_swap_barrier
-
-static GLboolean _glewInit_GLX_SGIX_swap_barrier (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXBindSwapBarrierSGIX = (PFNGLXBINDSWAPBARRIERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXBindSwapBarrierSGIX")) == NULL) || r;
- r = ((glXQueryMaxSwapBarriersSGIX = (PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryMaxSwapBarriersSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_SGIX_swap_barrier */
-
-#ifdef GLX_SGIX_swap_group
-
-static GLboolean _glewInit_GLX_SGIX_swap_group (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXJoinSwapGroupSGIX = (PFNGLXJOINSWAPGROUPSGIXPROC)glewGetProcAddress((const GLubyte*)"glXJoinSwapGroupSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_SGIX_swap_group */
-
-#ifdef GLX_SGIX_video_resize
-
-static GLboolean _glewInit_GLX_SGIX_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXBindChannelToWindowSGIX = (PFNGLXBINDCHANNELTOWINDOWSGIXPROC)glewGetProcAddress((const GLubyte*)"glXBindChannelToWindowSGIX")) == NULL) || r;
- r = ((glXChannelRectSGIX = (PFNGLXCHANNELRECTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXChannelRectSGIX")) == NULL) || r;
- r = ((glXChannelRectSyncSGIX = (PFNGLXCHANNELRECTSYNCSGIXPROC)glewGetProcAddress((const GLubyte*)"glXChannelRectSyncSGIX")) == NULL) || r;
- r = ((glXQueryChannelDeltasSGIX = (PFNGLXQUERYCHANNELDELTASSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryChannelDeltasSGIX")) == NULL) || r;
- r = ((glXQueryChannelRectSGIX = (PFNGLXQUERYCHANNELRECTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryChannelRectSGIX")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_SGIX_video_resize */
-
-#ifdef GLX_SGIX_visual_select_group
-
-#endif /* GLX_SGIX_visual_select_group */
-
-#ifdef GLX_SGI_cushion
-
-static GLboolean _glewInit_GLX_SGI_cushion (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXCushionSGI = (PFNGLXCUSHIONSGIPROC)glewGetProcAddress((const GLubyte*)"glXCushionSGI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_SGI_cushion */
-
-#ifdef GLX_SGI_make_current_read
-
-static GLboolean _glewInit_GLX_SGI_make_current_read (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXGetCurrentReadDrawableSGI = (PFNGLXGETCURRENTREADDRAWABLESGIPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentReadDrawableSGI")) == NULL) || r;
- r = ((glXMakeCurrentReadSGI = (PFNGLXMAKECURRENTREADSGIPROC)glewGetProcAddress((const GLubyte*)"glXMakeCurrentReadSGI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_SGI_make_current_read */
-
-#ifdef GLX_SGI_swap_control
-
-static GLboolean _glewInit_GLX_SGI_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalSGI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_SGI_swap_control */
-
-#ifdef GLX_SGI_video_sync
-
-static GLboolean _glewInit_GLX_SGI_video_sync (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXGetVideoSyncSGI = (PFNGLXGETVIDEOSYNCSGIPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoSyncSGI")) == NULL) || r;
- r = ((glXWaitVideoSyncSGI = (PFNGLXWAITVIDEOSYNCSGIPROC)glewGetProcAddress((const GLubyte*)"glXWaitVideoSyncSGI")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_SGI_video_sync */
-
-#ifdef GLX_SUN_get_transparent_index
-
-static GLboolean _glewInit_GLX_SUN_get_transparent_index (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXGetTransparentIndexSUN = (PFNGLXGETTRANSPARENTINDEXSUNPROC)glewGetProcAddress((const GLubyte*)"glXGetTransparentIndexSUN")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_SUN_get_transparent_index */
-
-#ifdef GLX_SUN_video_resize
-
-static GLboolean _glewInit_GLX_SUN_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT)
-{
- GLboolean r = GL_FALSE;
-
- r = ((glXGetVideoResizeSUN = (PFNGLXGETVIDEORESIZESUNPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoResizeSUN")) == NULL) || r;
- r = ((glXVideoResizeSUN = (PFNGLXVIDEORESIZESUNPROC)glewGetProcAddress((const GLubyte*)"glXVideoResizeSUN")) == NULL) || r;
-
- return r;
-}
-
-#endif /* GLX_SUN_video_resize */
-
-/* ------------------------------------------------------------------------ */
-
-GLboolean glxewGetExtension (const char* name)
-{
-#if GLEW_MX
- GLXEWContext *ctx = glxewGetContext();
-#endif
- return _glewHashListExists(GLXEW_GET_VAR(GLEW_GLX_EXTENSIONS), name);
-}
-
-GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
-{
- int major, minor;
- const GLubyte* extensions;
- GLEWHashList *ext_hashlist;
- /* initialize core GLX 1.2 */
- if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY;
- /* initialize flags */
- GLXEW_VERSION_1_0 = GL_TRUE;
- GLXEW_VERSION_1_1 = GL_TRUE;
- GLXEW_VERSION_1_2 = GL_TRUE;
- GLXEW_VERSION_1_3 = GL_TRUE;
- GLXEW_VERSION_1_4 = GL_TRUE;
- /* query GLX version */
- glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
- if (major == 1 && minor <= 3)
- {
- switch (minor)
- {
- case 3:
- GLXEW_VERSION_1_4 = GL_FALSE;
- break;
- case 2:
- GLXEW_VERSION_1_4 = GL_FALSE;
- GLXEW_VERSION_1_3 = GL_FALSE;
- break;
- default:
- return GLEW_ERROR_GLX_VERSION_11_ONLY;
- break;
- }
- }
- /* query GLX extension string */
- GLXEW_GET_VAR(GLEW_GLX_EXTENSIONS) = calloc(1, sizeof(GLEWHashList));
-
- ext_hashlist = GLXEW_GET_VAR(GLEW_GLX_EXTENSIONS);
-
- extensions = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS);
- _glewBuildHashListFromString(extensions, ext_hashlist);
-
- /* initialize extensions */
-#ifdef GLX_VERSION_1_3
- if (glewExperimental || GLXEW_VERSION_1_3) GLXEW_VERSION_1_3 = !_glewInit_GLX_VERSION_1_3(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_VERSION_1_3 */
-#ifdef GLX_3DFX_multisample
- GLXEW_3DFX_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_3DFX_multisample");
-#endif /* GLX_3DFX_multisample */
-#ifdef GLX_AMD_gpu_association
- GLXEW_AMD_gpu_association = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_AMD_gpu_association");
- if (glewExperimental || GLXEW_AMD_gpu_association) GLXEW_AMD_gpu_association = !_glewInit_GLX_AMD_gpu_association(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_AMD_gpu_association */
-#ifdef GLX_ARB_context_flush_control
- GLXEW_ARB_context_flush_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ARB_context_flush_control");
-#endif /* GLX_ARB_context_flush_control */
-#ifdef GLX_ARB_create_context
- GLXEW_ARB_create_context = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ARB_create_context");
- if (glewExperimental || GLXEW_ARB_create_context) GLXEW_ARB_create_context = !_glewInit_GLX_ARB_create_context(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_ARB_create_context */
-#ifdef GLX_ARB_create_context_profile
- GLXEW_ARB_create_context_profile = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ARB_create_context_profile");
-#endif /* GLX_ARB_create_context_profile */
-#ifdef GLX_ARB_create_context_robustness
- GLXEW_ARB_create_context_robustness = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ARB_create_context_robustness");
-#endif /* GLX_ARB_create_context_robustness */
-#ifdef GLX_ARB_fbconfig_float
- GLXEW_ARB_fbconfig_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ARB_fbconfig_float");
-#endif /* GLX_ARB_fbconfig_float */
-#ifdef GLX_ARB_framebuffer_sRGB
- GLXEW_ARB_framebuffer_sRGB = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ARB_framebuffer_sRGB");
-#endif /* GLX_ARB_framebuffer_sRGB */
-#ifdef GLX_ARB_get_proc_address
- GLXEW_ARB_get_proc_address = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ARB_get_proc_address");
-#endif /* GLX_ARB_get_proc_address */
-#ifdef GLX_ARB_multisample
- GLXEW_ARB_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ARB_multisample");
-#endif /* GLX_ARB_multisample */
-#ifdef GLX_ARB_robustness_application_isolation
- GLXEW_ARB_robustness_application_isolation = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ARB_robustness_application_isolation");
-#endif /* GLX_ARB_robustness_application_isolation */
-#ifdef GLX_ARB_robustness_share_group_isolation
- GLXEW_ARB_robustness_share_group_isolation = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ARB_robustness_share_group_isolation");
-#endif /* GLX_ARB_robustness_share_group_isolation */
-#ifdef GLX_ARB_vertex_buffer_object
- GLXEW_ARB_vertex_buffer_object = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ARB_vertex_buffer_object");
-#endif /* GLX_ARB_vertex_buffer_object */
-#ifdef GLX_ATI_pixel_format_float
- GLXEW_ATI_pixel_format_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ATI_pixel_format_float");
-#endif /* GLX_ATI_pixel_format_float */
-#ifdef GLX_ATI_render_texture
- GLXEW_ATI_render_texture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_ATI_render_texture");
- if (glewExperimental || GLXEW_ATI_render_texture) GLXEW_ATI_render_texture = !_glewInit_GLX_ATI_render_texture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_ATI_render_texture */
-#ifdef GLX_EXT_buffer_age
- GLXEW_EXT_buffer_age = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_buffer_age");
-#endif /* GLX_EXT_buffer_age */
-#ifdef GLX_EXT_create_context_es2_profile
- GLXEW_EXT_create_context_es2_profile = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_create_context_es2_profile");
-#endif /* GLX_EXT_create_context_es2_profile */
-#ifdef GLX_EXT_create_context_es_profile
- GLXEW_EXT_create_context_es_profile = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_create_context_es_profile");
-#endif /* GLX_EXT_create_context_es_profile */
-#ifdef GLX_EXT_fbconfig_packed_float
- GLXEW_EXT_fbconfig_packed_float = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_fbconfig_packed_float");
-#endif /* GLX_EXT_fbconfig_packed_float */
-#ifdef GLX_EXT_framebuffer_sRGB
- GLXEW_EXT_framebuffer_sRGB = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_framebuffer_sRGB");
-#endif /* GLX_EXT_framebuffer_sRGB */
-#ifdef GLX_EXT_import_context
- GLXEW_EXT_import_context = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_import_context");
- if (glewExperimental || GLXEW_EXT_import_context) GLXEW_EXT_import_context = !_glewInit_GLX_EXT_import_context(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_EXT_import_context */
-#ifdef GLX_EXT_scene_marker
- GLXEW_EXT_scene_marker = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_scene_marker");
-#endif /* GLX_EXT_scene_marker */
-#ifdef GLX_EXT_stereo_tree
- GLXEW_EXT_stereo_tree = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_stereo_tree");
-#endif /* GLX_EXT_stereo_tree */
-#ifdef GLX_EXT_swap_control
- GLXEW_EXT_swap_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_swap_control");
- if (glewExperimental || GLXEW_EXT_swap_control) GLXEW_EXT_swap_control = !_glewInit_GLX_EXT_swap_control(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_EXT_swap_control */
-#ifdef GLX_EXT_swap_control_tear
- GLXEW_EXT_swap_control_tear = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_swap_control_tear");
-#endif /* GLX_EXT_swap_control_tear */
-#ifdef GLX_EXT_texture_from_pixmap
- GLXEW_EXT_texture_from_pixmap = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_texture_from_pixmap");
- if (glewExperimental || GLXEW_EXT_texture_from_pixmap) GLXEW_EXT_texture_from_pixmap = !_glewInit_GLX_EXT_texture_from_pixmap(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_EXT_texture_from_pixmap */
-#ifdef GLX_EXT_visual_info
- GLXEW_EXT_visual_info = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_visual_info");
-#endif /* GLX_EXT_visual_info */
-#ifdef GLX_EXT_visual_rating
- GLXEW_EXT_visual_rating = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_EXT_visual_rating");
-#endif /* GLX_EXT_visual_rating */
-#ifdef GLX_INTEL_swap_event
- GLXEW_INTEL_swap_event = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_INTEL_swap_event");
-#endif /* GLX_INTEL_swap_event */
-#ifdef GLX_MESA_agp_offset
- GLXEW_MESA_agp_offset = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_MESA_agp_offset");
- if (glewExperimental || GLXEW_MESA_agp_offset) GLXEW_MESA_agp_offset = !_glewInit_GLX_MESA_agp_offset(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_MESA_agp_offset */
-#ifdef GLX_MESA_copy_sub_buffer
- GLXEW_MESA_copy_sub_buffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_MESA_copy_sub_buffer");
- if (glewExperimental || GLXEW_MESA_copy_sub_buffer) GLXEW_MESA_copy_sub_buffer = !_glewInit_GLX_MESA_copy_sub_buffer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_MESA_copy_sub_buffer */
-#ifdef GLX_MESA_pixmap_colormap
- GLXEW_MESA_pixmap_colormap = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_MESA_pixmap_colormap");
- if (glewExperimental || GLXEW_MESA_pixmap_colormap) GLXEW_MESA_pixmap_colormap = !_glewInit_GLX_MESA_pixmap_colormap(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_MESA_pixmap_colormap */
-#ifdef GLX_MESA_query_renderer
- GLXEW_MESA_query_renderer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_MESA_query_renderer");
- if (glewExperimental || GLXEW_MESA_query_renderer) GLXEW_MESA_query_renderer = !_glewInit_GLX_MESA_query_renderer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_MESA_query_renderer */
-#ifdef GLX_MESA_release_buffers
- GLXEW_MESA_release_buffers = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_MESA_release_buffers");
- if (glewExperimental || GLXEW_MESA_release_buffers) GLXEW_MESA_release_buffers = !_glewInit_GLX_MESA_release_buffers(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_MESA_release_buffers */
-#ifdef GLX_MESA_set_3dfx_mode
- GLXEW_MESA_set_3dfx_mode = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_MESA_set_3dfx_mode");
- if (glewExperimental || GLXEW_MESA_set_3dfx_mode) GLXEW_MESA_set_3dfx_mode = !_glewInit_GLX_MESA_set_3dfx_mode(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_MESA_set_3dfx_mode */
-#ifdef GLX_MESA_swap_control
- GLXEW_MESA_swap_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_MESA_swap_control");
- if (glewExperimental || GLXEW_MESA_swap_control) GLXEW_MESA_swap_control = !_glewInit_GLX_MESA_swap_control(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_MESA_swap_control */
-#ifdef GLX_NV_copy_buffer
- GLXEW_NV_copy_buffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_NV_copy_buffer");
- if (glewExperimental || GLXEW_NV_copy_buffer) GLXEW_NV_copy_buffer = !_glewInit_GLX_NV_copy_buffer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_NV_copy_buffer */
-#ifdef GLX_NV_copy_image
- GLXEW_NV_copy_image = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_NV_copy_image");
- if (glewExperimental || GLXEW_NV_copy_image) GLXEW_NV_copy_image = !_glewInit_GLX_NV_copy_image(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_NV_copy_image */
-#ifdef GLX_NV_delay_before_swap
- GLXEW_NV_delay_before_swap = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_NV_delay_before_swap");
- if (glewExperimental || GLXEW_NV_delay_before_swap) GLXEW_NV_delay_before_swap = !_glewInit_GLX_NV_delay_before_swap(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_NV_delay_before_swap */
-#ifdef GLX_NV_float_buffer
- GLXEW_NV_float_buffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_NV_float_buffer");
-#endif /* GLX_NV_float_buffer */
-#ifdef GLX_NV_multisample_coverage
- GLXEW_NV_multisample_coverage = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_NV_multisample_coverage");
-#endif /* GLX_NV_multisample_coverage */
-#ifdef GLX_NV_present_video
- GLXEW_NV_present_video = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_NV_present_video");
- if (glewExperimental || GLXEW_NV_present_video) GLXEW_NV_present_video = !_glewInit_GLX_NV_present_video(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_NV_present_video */
-#ifdef GLX_NV_swap_group
- GLXEW_NV_swap_group = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_NV_swap_group");
- if (glewExperimental || GLXEW_NV_swap_group) GLXEW_NV_swap_group = !_glewInit_GLX_NV_swap_group(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_NV_swap_group */
-#ifdef GLX_NV_vertex_array_range
- GLXEW_NV_vertex_array_range = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_NV_vertex_array_range");
- if (glewExperimental || GLXEW_NV_vertex_array_range) GLXEW_NV_vertex_array_range = !_glewInit_GLX_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_NV_vertex_array_range */
-#ifdef GLX_NV_video_capture
- GLXEW_NV_video_capture = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_NV_video_capture");
- if (glewExperimental || GLXEW_NV_video_capture) GLXEW_NV_video_capture = !_glewInit_GLX_NV_video_capture(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_NV_video_capture */
-#ifdef GLX_NV_video_out
- GLXEW_NV_video_out = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_NV_video_out");
- if (glewExperimental || GLXEW_NV_video_out) GLXEW_NV_video_out = !_glewInit_GLX_NV_video_out(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_NV_video_out */
-#ifdef GLX_OML_swap_method
- GLXEW_OML_swap_method = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_OML_swap_method");
-#endif /* GLX_OML_swap_method */
-#ifdef GLX_OML_sync_control
- GLXEW_OML_sync_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_OML_sync_control");
- if (glewExperimental || GLXEW_OML_sync_control) GLXEW_OML_sync_control = !_glewInit_GLX_OML_sync_control(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_OML_sync_control */
-#ifdef GLX_SGIS_blended_overlay
- GLXEW_SGIS_blended_overlay = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGIS_blended_overlay");
-#endif /* GLX_SGIS_blended_overlay */
-#ifdef GLX_SGIS_color_range
- GLXEW_SGIS_color_range = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGIS_color_range");
-#endif /* GLX_SGIS_color_range */
-#ifdef GLX_SGIS_multisample
- GLXEW_SGIS_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGIS_multisample");
-#endif /* GLX_SGIS_multisample */
-#ifdef GLX_SGIS_shared_multisample
- GLXEW_SGIS_shared_multisample = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGIS_shared_multisample");
-#endif /* GLX_SGIS_shared_multisample */
-#ifdef GLX_SGIX_fbconfig
- GLXEW_SGIX_fbconfig = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGIX_fbconfig");
- if (glewExperimental || GLXEW_SGIX_fbconfig) GLXEW_SGIX_fbconfig = !_glewInit_GLX_SGIX_fbconfig(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_SGIX_fbconfig */
-#ifdef GLX_SGIX_hyperpipe
- GLXEW_SGIX_hyperpipe = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGIX_hyperpipe");
- if (glewExperimental || GLXEW_SGIX_hyperpipe) GLXEW_SGIX_hyperpipe = !_glewInit_GLX_SGIX_hyperpipe(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_SGIX_hyperpipe */
-#ifdef GLX_SGIX_pbuffer
- GLXEW_SGIX_pbuffer = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGIX_pbuffer");
- if (glewExperimental || GLXEW_SGIX_pbuffer) GLXEW_SGIX_pbuffer = !_glewInit_GLX_SGIX_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_SGIX_pbuffer */
-#ifdef GLX_SGIX_swap_barrier
- GLXEW_SGIX_swap_barrier = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGIX_swap_barrier");
- if (glewExperimental || GLXEW_SGIX_swap_barrier) GLXEW_SGIX_swap_barrier = !_glewInit_GLX_SGIX_swap_barrier(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_SGIX_swap_barrier */
-#ifdef GLX_SGIX_swap_group
- GLXEW_SGIX_swap_group = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGIX_swap_group");
- if (glewExperimental || GLXEW_SGIX_swap_group) GLXEW_SGIX_swap_group = !_glewInit_GLX_SGIX_swap_group(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_SGIX_swap_group */
-#ifdef GLX_SGIX_video_resize
- GLXEW_SGIX_video_resize = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGIX_video_resize");
- if (glewExperimental || GLXEW_SGIX_video_resize) GLXEW_SGIX_video_resize = !_glewInit_GLX_SGIX_video_resize(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_SGIX_video_resize */
-#ifdef GLX_SGIX_visual_select_group
- GLXEW_SGIX_visual_select_group = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGIX_visual_select_group");
-#endif /* GLX_SGIX_visual_select_group */
-#ifdef GLX_SGI_cushion
- GLXEW_SGI_cushion = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGI_cushion");
- if (glewExperimental || GLXEW_SGI_cushion) GLXEW_SGI_cushion = !_glewInit_GLX_SGI_cushion(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_SGI_cushion */
-#ifdef GLX_SGI_make_current_read
- GLXEW_SGI_make_current_read = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGI_make_current_read");
- if (glewExperimental || GLXEW_SGI_make_current_read) GLXEW_SGI_make_current_read = !_glewInit_GLX_SGI_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_SGI_make_current_read */
-#ifdef GLX_SGI_swap_control
- GLXEW_SGI_swap_control = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGI_swap_control");
- if (glewExperimental || GLXEW_SGI_swap_control) GLXEW_SGI_swap_control = !_glewInit_GLX_SGI_swap_control(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_SGI_swap_control */
-#ifdef GLX_SGI_video_sync
- GLXEW_SGI_video_sync = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SGI_video_sync");
- if (glewExperimental || GLXEW_SGI_video_sync) GLXEW_SGI_video_sync = !_glewInit_GLX_SGI_video_sync(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_SGI_video_sync */
-#ifdef GLX_SUN_get_transparent_index
- GLXEW_SUN_get_transparent_index = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SUN_get_transparent_index");
- if (glewExperimental || GLXEW_SUN_get_transparent_index) GLXEW_SUN_get_transparent_index = !_glewInit_GLX_SUN_get_transparent_index(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_SUN_get_transparent_index */
-#ifdef GLX_SUN_video_resize
- GLXEW_SUN_video_resize = _glewHashListExists(ext_hashlist, (const GLubyte *)"GLX_SUN_video_resize");
- if (glewExperimental || GLXEW_SUN_video_resize) GLXEW_SUN_video_resize = !_glewInit_GLX_SUN_video_resize(GLEW_CONTEXT_ARG_VAR_INIT);
-#endif /* GLX_SUN_video_resize */
-
- return GLEW_OK;
-}
-
-#endif /* !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */
-
-/* ------------------------------------------------------------------------ */
-
-const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error)
-{
- static const GLubyte* _glewErrorString[] =
- {
- (const GLubyte*)"No error",
- (const GLubyte*)"Missing GL version",
- (const GLubyte*)"GL 1.1 and up are not supported",
- (const GLubyte*)"GLX 1.2 and up are not supported",
- (const GLubyte*)"Unknown error"
- };
- const size_t max_error = sizeof(_glewErrorString)/sizeof(*_glewErrorString) - 1;
- return _glewErrorString[(size_t)error > max_error ? max_error : (size_t)error];
-}
-
-const GLubyte * GLEWAPIENTRY glewGetString (GLenum name)
-{
- static const GLubyte* _glewString[] =
- {
- (const GLubyte*)NULL,
- (const GLubyte*)"1.11.0",
- (const GLubyte*)"1",
- (const GLubyte*)"11",
- (const GLubyte*)"0"
- };
- const size_t max_string = sizeof(_glewString)/sizeof(*_glewString) - 1;
- return _glewString[(size_t)name > max_string ? 0 : (size_t)name];
-}
-
-/* ------------------------------------------------------------------------ */
-
-GLboolean glewExperimental = GL_FALSE;
-
-#if !defined(GLEW_MX)
-
-#if defined(_WIN32)
-extern GLenum GLEWAPIENTRY wglewContextInit (void);
-#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
-extern GLenum GLEWAPIENTRY glxewContextInit (void);
-#endif /* _WIN32 */
-
-GLenum GLEWAPIENTRY glewInit (void)
-{
- GLenum r;
- r = glewContextInit();
- if ( r != 0 ) return r;
-#if defined(_WIN32)
- return wglewContextInit();
-#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */
- return glxewContextInit();
-#else
- return r;
-#endif /* _WIN32 */
-}
-
-#endif /* !GLEW_MX */
-#ifdef GLEW_MX
-GLboolean GLEWAPIENTRY glewContextIsSupported (const GLEWContext* ctx, const char* name)
-#else
-GLboolean GLEWAPIENTRY glewIsSupported (const char* name)
-#endif
-{
- GLubyte* pos = (GLubyte*)name;
- GLuint len = _glewStrLen(pos);
- GLboolean ret = GL_TRUE;
- while (ret && len > 0)
- {
- if (_glewStrSame1(&pos, &len, (const GLubyte*)"GL_", 3))
- {
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"VERSION_", 8))
- {
-#ifdef GL_VERSION_1_2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2", 3))
- {
- ret = GLEW_VERSION_1_2;
- continue;
- }
-#endif
-#ifdef GL_VERSION_1_2_1
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2_1", 5))
- {
- ret = GLEW_VERSION_1_2_1;
- continue;
- }
-#endif
-#ifdef GL_VERSION_1_3
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_3", 3))
- {
- ret = GLEW_VERSION_1_3;
- continue;
- }
-#endif
-#ifdef GL_VERSION_1_4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_4", 3))
- {
- ret = GLEW_VERSION_1_4;
- continue;
- }
-#endif
-#ifdef GL_VERSION_1_5
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_5", 3))
- {
- ret = GLEW_VERSION_1_5;
- continue;
- }
-#endif
-#ifdef GL_VERSION_2_0
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"2_0", 3))
- {
- ret = GLEW_VERSION_2_0;
- continue;
- }
-#endif
-#ifdef GL_VERSION_2_1
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"2_1", 3))
- {
- ret = GLEW_VERSION_2_1;
- continue;
- }
-#endif
-#ifdef GL_VERSION_3_0
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_0", 3))
- {
- ret = GLEW_VERSION_3_0;
- continue;
- }
-#endif
-#ifdef GL_VERSION_3_1
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_1", 3))
- {
- ret = GLEW_VERSION_3_1;
- continue;
- }
-#endif
-#ifdef GL_VERSION_3_2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_2", 3))
- {
- ret = GLEW_VERSION_3_2;
- continue;
- }
-#endif
-#ifdef GL_VERSION_3_3
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_3", 3))
- {
- ret = GLEW_VERSION_3_3;
- continue;
- }
-#endif
-#ifdef GL_VERSION_4_0
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_0", 3))
- {
- ret = GLEW_VERSION_4_0;
- continue;
- }
-#endif
-#ifdef GL_VERSION_4_1
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_1", 3))
- {
- ret = GLEW_VERSION_4_1;
- continue;
- }
-#endif
-#ifdef GL_VERSION_4_2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_2", 3))
- {
- ret = GLEW_VERSION_4_2;
- continue;
- }
-#endif
-#ifdef GL_VERSION_4_3
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_3", 3))
- {
- ret = GLEW_VERSION_4_3;
- continue;
- }
-#endif
-#ifdef GL_VERSION_4_4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_4", 3))
- {
- ret = GLEW_VERSION_4_4;
- continue;
- }
-#endif
-#ifdef GL_VERSION_4_5
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_5", 3))
- {
- ret = GLEW_VERSION_4_5;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5))
- {
-#ifdef GL_3DFX_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11))
- {
- ret = GLEW_3DFX_multisample;
- continue;
- }
-#endif
-#ifdef GL_3DFX_tbuffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"tbuffer", 7))
- {
- ret = GLEW_3DFX_tbuffer;
- continue;
- }
-#endif
-#ifdef GL_3DFX_texture_compression_FXT1
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_FXT1", 24))
- {
- ret = GLEW_3DFX_texture_compression_FXT1;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4))
- {
-#ifdef GL_AMD_blend_minmax_factor
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_minmax_factor", 19))
- {
- ret = GLEW_AMD_blend_minmax_factor;
- continue;
- }
-#endif
-#ifdef GL_AMD_conservative_depth
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_depth", 18))
- {
- ret = GLEW_AMD_conservative_depth;
- continue;
- }
-#endif
-#ifdef GL_AMD_debug_output
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_output", 12))
- {
- ret = GLEW_AMD_debug_output;
- continue;
- }
-#endif
-#ifdef GL_AMD_depth_clamp_separate
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp_separate", 20))
- {
- ret = GLEW_AMD_depth_clamp_separate;
- continue;
- }
-#endif
-#ifdef GL_AMD_draw_buffers_blend
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers_blend", 18))
- {
- ret = GLEW_AMD_draw_buffers_blend;
- continue;
- }
-#endif
-#ifdef GL_AMD_gcn_shader
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gcn_shader", 10))
- {
- ret = GLEW_AMD_gcn_shader;
- continue;
- }
-#endif
-#ifdef GL_AMD_gpu_shader_int64
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader_int64", 16))
- {
- ret = GLEW_AMD_gpu_shader_int64;
- continue;
- }
-#endif
-#ifdef GL_AMD_interleaved_elements
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"interleaved_elements", 20))
- {
- ret = GLEW_AMD_interleaved_elements;
- continue;
- }
-#endif
-#ifdef GL_AMD_multi_draw_indirect
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_indirect", 19))
- {
- ret = GLEW_AMD_multi_draw_indirect;
- continue;
- }
-#endif
-#ifdef GL_AMD_name_gen_delete
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"name_gen_delete", 15))
- {
- ret = GLEW_AMD_name_gen_delete;
- continue;
- }
-#endif
-#ifdef GL_AMD_occlusion_query_event
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query_event", 21))
- {
- ret = GLEW_AMD_occlusion_query_event;
- continue;
- }
-#endif
-#ifdef GL_AMD_performance_monitor
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"performance_monitor", 19))
- {
- ret = GLEW_AMD_performance_monitor;
- continue;
- }
-#endif
-#ifdef GL_AMD_pinned_memory
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pinned_memory", 13))
- {
- ret = GLEW_AMD_pinned_memory;
- continue;
- }
-#endif
-#ifdef GL_AMD_query_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_buffer_object", 19))
- {
- ret = GLEW_AMD_query_buffer_object;
- continue;
- }
-#endif
-#ifdef GL_AMD_sample_positions
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_positions", 16))
- {
- ret = GLEW_AMD_sample_positions;
- continue;
- }
-#endif
-#ifdef GL_AMD_seamless_cubemap_per_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cubemap_per_texture", 28))
- {
- ret = GLEW_AMD_seamless_cubemap_per_texture;
- continue;
- }
-#endif
-#ifdef GL_AMD_shader_atomic_counter_ops
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counter_ops", 25))
- {
- ret = GLEW_AMD_shader_atomic_counter_ops;
- continue;
- }
-#endif
-#ifdef GL_AMD_shader_stencil_export
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_stencil_export", 21))
- {
- ret = GLEW_AMD_shader_stencil_export;
- continue;
- }
-#endif
-#ifdef GL_AMD_shader_stencil_value_export
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_stencil_value_export", 27))
- {
- ret = GLEW_AMD_shader_stencil_value_export;
- continue;
- }
-#endif
-#ifdef GL_AMD_shader_trinary_minmax
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_trinary_minmax", 21))
- {
- ret = GLEW_AMD_shader_trinary_minmax;
- continue;
- }
-#endif
-#ifdef GL_AMD_sparse_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture", 14))
- {
- ret = GLEW_AMD_sparse_texture;
- continue;
- }
-#endif
-#ifdef GL_AMD_stencil_operation_extended
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_operation_extended", 26))
- {
- ret = GLEW_AMD_stencil_operation_extended;
- continue;
- }
-#endif
-#ifdef GL_AMD_texture_texture4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_texture4", 16))
- {
- ret = GLEW_AMD_texture_texture4;
- continue;
- }
-#endif
-#ifdef GL_AMD_transform_feedback3_lines_triangles
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback3_lines_triangles", 35))
- {
- ret = GLEW_AMD_transform_feedback3_lines_triangles;
- continue;
- }
-#endif
-#ifdef GL_AMD_transform_feedback4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback4", 19))
- {
- ret = GLEW_AMD_transform_feedback4;
- continue;
- }
-#endif
-#ifdef GL_AMD_vertex_shader_layer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_layer", 19))
- {
- ret = GLEW_AMD_vertex_shader_layer;
- continue;
- }
-#endif
-#ifdef GL_AMD_vertex_shader_tessellator
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_tessellator", 25))
- {
- ret = GLEW_AMD_vertex_shader_tessellator;
- continue;
- }
-#endif
-#ifdef GL_AMD_vertex_shader_viewport_index
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_viewport_index", 28))
- {
- ret = GLEW_AMD_vertex_shader_viewport_index;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"ANGLE_", 6))
- {
-#ifdef GL_ANGLE_depth_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13))
- {
- ret = GLEW_ANGLE_depth_texture;
- continue;
- }
-#endif
-#ifdef GL_ANGLE_framebuffer_blit
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_blit", 16))
- {
- ret = GLEW_ANGLE_framebuffer_blit;
- continue;
- }
-#endif
-#ifdef GL_ANGLE_framebuffer_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample", 23))
- {
- ret = GLEW_ANGLE_framebuffer_multisample;
- continue;
- }
-#endif
-#ifdef GL_ANGLE_instanced_arrays
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"instanced_arrays", 16))
- {
- ret = GLEW_ANGLE_instanced_arrays;
- continue;
- }
-#endif
-#ifdef GL_ANGLE_pack_reverse_row_order
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pack_reverse_row_order", 22))
- {
- ret = GLEW_ANGLE_pack_reverse_row_order;
- continue;
- }
-#endif
-#ifdef GL_ANGLE_program_binary
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"program_binary", 14))
- {
- ret = GLEW_ANGLE_program_binary;
- continue;
- }
-#endif
-#ifdef GL_ANGLE_texture_compression_dxt1
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt1", 24))
- {
- ret = GLEW_ANGLE_texture_compression_dxt1;
- continue;
- }
-#endif
-#ifdef GL_ANGLE_texture_compression_dxt3
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt3", 24))
- {
- ret = GLEW_ANGLE_texture_compression_dxt3;
- continue;
- }
-#endif
-#ifdef GL_ANGLE_texture_compression_dxt5
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt5", 24))
- {
- ret = GLEW_ANGLE_texture_compression_dxt5;
- continue;
- }
-#endif
-#ifdef GL_ANGLE_texture_usage
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_usage", 13))
- {
- ret = GLEW_ANGLE_texture_usage;
- continue;
- }
-#endif
-#ifdef GL_ANGLE_timer_query
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11))
- {
- ret = GLEW_ANGLE_timer_query;
- continue;
- }
-#endif
-#ifdef GL_ANGLE_translated_shader_source
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"translated_shader_source", 24))
- {
- ret = GLEW_ANGLE_translated_shader_source;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"APPLE_", 6))
- {
-#ifdef GL_APPLE_aux_depth_stencil
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"aux_depth_stencil", 17))
- {
- ret = GLEW_APPLE_aux_depth_stencil;
- continue;
- }
-#endif
-#ifdef GL_APPLE_client_storage
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"client_storage", 14))
- {
- ret = GLEW_APPLE_client_storage;
- continue;
- }
-#endif
-#ifdef GL_APPLE_element_array
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"element_array", 13))
- {
- ret = GLEW_APPLE_element_array;
- continue;
- }
-#endif
-#ifdef GL_APPLE_fence
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fence", 5))
- {
- ret = GLEW_APPLE_fence;
- continue;
- }
-#endif
-#ifdef GL_APPLE_float_pixels
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_pixels", 12))
- {
- ret = GLEW_APPLE_float_pixels;
- continue;
- }
-#endif
-#ifdef GL_APPLE_flush_buffer_range
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"flush_buffer_range", 18))
- {
- ret = GLEW_APPLE_flush_buffer_range;
- continue;
- }
-#endif
-#ifdef GL_APPLE_object_purgeable
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"object_purgeable", 16))
- {
- ret = GLEW_APPLE_object_purgeable;
- continue;
- }
-#endif
-#ifdef GL_APPLE_pixel_buffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer", 12))
- {
- ret = GLEW_APPLE_pixel_buffer;
- continue;
- }
-#endif
-#ifdef GL_APPLE_rgb_422
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"rgb_422", 7))
- {
- ret = GLEW_APPLE_rgb_422;
- continue;
- }
-#endif
-#ifdef GL_APPLE_row_bytes
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"row_bytes", 9))
- {
- ret = GLEW_APPLE_row_bytes;
- continue;
- }
-#endif
-#ifdef GL_APPLE_specular_vector
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"specular_vector", 15))
- {
- ret = GLEW_APPLE_specular_vector;
- continue;
- }
-#endif
-#ifdef GL_APPLE_texture_range
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_range", 13))
- {
- ret = GLEW_APPLE_texture_range;
- continue;
- }
-#endif
-#ifdef GL_APPLE_transform_hint
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_hint", 14))
- {
- ret = GLEW_APPLE_transform_hint;
- continue;
- }
-#endif
-#ifdef GL_APPLE_vertex_array_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19))
- {
- ret = GLEW_APPLE_vertex_array_object;
- continue;
- }
-#endif
-#ifdef GL_APPLE_vertex_array_range
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18))
- {
- ret = GLEW_APPLE_vertex_array_range;
- continue;
- }
-#endif
-#ifdef GL_APPLE_vertex_program_evaluators
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program_evaluators", 25))
- {
- ret = GLEW_APPLE_vertex_program_evaluators;
- continue;
- }
-#endif
-#ifdef GL_APPLE_ycbcr_422
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycbcr_422", 9))
- {
- ret = GLEW_APPLE_ycbcr_422;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4))
- {
-#ifdef GL_ARB_ES2_compatibility
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES2_compatibility", 17))
- {
- ret = GLEW_ARB_ES2_compatibility;
- continue;
- }
-#endif
-#ifdef GL_ARB_ES3_1_compatibility
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES3_1_compatibility", 19))
- {
- ret = GLEW_ARB_ES3_1_compatibility;
- continue;
- }
-#endif
-#ifdef GL_ARB_ES3_compatibility
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES3_compatibility", 17))
- {
- ret = GLEW_ARB_ES3_compatibility;
- continue;
- }
-#endif
-#ifdef GL_ARB_arrays_of_arrays
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"arrays_of_arrays", 16))
- {
- ret = GLEW_ARB_arrays_of_arrays;
- continue;
- }
-#endif
-#ifdef GL_ARB_base_instance
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"base_instance", 13))
- {
- ret = GLEW_ARB_base_instance;
- continue;
- }
-#endif
-#ifdef GL_ARB_bindless_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_texture", 16))
- {
- ret = GLEW_ARB_bindless_texture;
- continue;
- }
-#endif
-#ifdef GL_ARB_blend_func_extended
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_func_extended", 19))
- {
- ret = GLEW_ARB_blend_func_extended;
- continue;
- }
-#endif
-#ifdef GL_ARB_buffer_storage
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_storage", 14))
- {
- ret = GLEW_ARB_buffer_storage;
- continue;
- }
-#endif
-#ifdef GL_ARB_cl_event
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"cl_event", 8))
- {
- ret = GLEW_ARB_cl_event;
- continue;
- }
-#endif
-#ifdef GL_ARB_clear_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"clear_buffer_object", 19))
- {
- ret = GLEW_ARB_clear_buffer_object;
- continue;
- }
-#endif
-#ifdef GL_ARB_clear_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"clear_texture", 13))
- {
- ret = GLEW_ARB_clear_texture;
- continue;
- }
-#endif
-#ifdef GL_ARB_clip_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"clip_control", 12))
- {
- ret = GLEW_ARB_clip_control;
- continue;
- }
-#endif
-#ifdef GL_ARB_color_buffer_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_buffer_float", 18))
- {
- ret = GLEW_ARB_color_buffer_float;
- continue;
- }
-#endif
-#ifdef GL_ARB_compatibility
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"compatibility", 13))
- {
- ret = GLEW_ARB_compatibility;
- continue;
- }
-#endif
-#ifdef GL_ARB_compressed_texture_pixel_storage
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"compressed_texture_pixel_storage", 32))
- {
- ret = GLEW_ARB_compressed_texture_pixel_storage;
- continue;
- }
-#endif
-#ifdef GL_ARB_compute_shader
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"compute_shader", 14))
- {
- ret = GLEW_ARB_compute_shader;
- continue;
- }
-#endif
-#ifdef GL_ARB_compute_variable_group_size
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"compute_variable_group_size", 27))
- {
- ret = GLEW_ARB_compute_variable_group_size;
- continue;
- }
-#endif
-#ifdef GL_ARB_conditional_render_inverted
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"conditional_render_inverted", 27))
- {
- ret = GLEW_ARB_conditional_render_inverted;
- continue;
- }
-#endif
-#ifdef GL_ARB_conservative_depth
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_depth", 18))
- {
- ret = GLEW_ARB_conservative_depth;
- continue;
- }
-#endif
-#ifdef GL_ARB_copy_buffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_buffer", 11))
- {
- ret = GLEW_ARB_copy_buffer;
- continue;
- }
-#endif
-#ifdef GL_ARB_copy_image
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10))
- {
- ret = GLEW_ARB_copy_image;
- continue;
- }
-#endif
-#ifdef GL_ARB_cull_distance
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_distance", 13))
- {
- ret = GLEW_ARB_cull_distance;
- continue;
- }
-#endif
-#ifdef GL_ARB_debug_output
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_output", 12))
- {
- ret = GLEW_ARB_debug_output;
- continue;
- }
-#endif
-#ifdef GL_ARB_depth_buffer_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_buffer_float", 18))
- {
- ret = GLEW_ARB_depth_buffer_float;
- continue;
- }
-#endif
-#ifdef GL_ARB_depth_clamp
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp", 11))
- {
- ret = GLEW_ARB_depth_clamp;
- continue;
- }
-#endif
-#ifdef GL_ARB_depth_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13))
- {
- ret = GLEW_ARB_depth_texture;
- continue;
- }
-#endif
-#ifdef GL_ARB_derivative_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"derivative_control", 18))
- {
- ret = GLEW_ARB_derivative_control;
- continue;
- }
-#endif
-#ifdef GL_ARB_direct_state_access
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"direct_state_access", 19))
- {
- ret = GLEW_ARB_direct_state_access;
- continue;
- }
-#endif
-#ifdef GL_ARB_draw_buffers
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers", 12))
- {
- ret = GLEW_ARB_draw_buffers;
- continue;
- }
-#endif
-#ifdef GL_ARB_draw_buffers_blend
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers_blend", 18))
- {
- ret = GLEW_ARB_draw_buffers_blend;
- continue;
- }
-#endif
-#ifdef GL_ARB_draw_elements_base_vertex
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_elements_base_vertex", 25))
- {
- ret = GLEW_ARB_draw_elements_base_vertex;
- continue;
- }
-#endif
-#ifdef GL_ARB_draw_indirect
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_indirect", 13))
- {
- ret = GLEW_ARB_draw_indirect;
- continue;
- }
-#endif
-#ifdef GL_ARB_draw_instanced
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_instanced", 14))
- {
- ret = GLEW_ARB_draw_instanced;
- continue;
- }
-#endif
-#ifdef GL_ARB_enhanced_layouts
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"enhanced_layouts", 16))
- {
- ret = GLEW_ARB_enhanced_layouts;
- continue;
- }
-#endif
-#ifdef GL_ARB_explicit_attrib_location
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_attrib_location", 24))
- {
- ret = GLEW_ARB_explicit_attrib_location;
- continue;
- }
-#endif
-#ifdef GL_ARB_explicit_uniform_location
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_uniform_location", 25))
- {
- ret = GLEW_ARB_explicit_uniform_location;
- continue;
- }
-#endif
-#ifdef GL_ARB_fragment_coord_conventions
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_coord_conventions", 26))
- {
- ret = GLEW_ARB_fragment_coord_conventions;
- continue;
- }
-#endif
-#ifdef GL_ARB_fragment_layer_viewport
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_layer_viewport", 23))
- {
- ret = GLEW_ARB_fragment_layer_viewport;
- continue;
- }
-#endif
-#ifdef GL_ARB_fragment_program
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program", 16))
- {
- ret = GLEW_ARB_fragment_program;
- continue;
- }
-#endif
-#ifdef GL_ARB_fragment_program_shadow
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program_shadow", 23))
- {
- ret = GLEW_ARB_fragment_program_shadow;
- continue;
- }
-#endif
-#ifdef GL_ARB_fragment_shader
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader", 15))
- {
- ret = GLEW_ARB_fragment_shader;
- continue;
- }
-#endif
-#ifdef GL_ARB_framebuffer_no_attachments
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_no_attachments", 26))
- {
- ret = GLEW_ARB_framebuffer_no_attachments;
- continue;
- }
-#endif
-#ifdef GL_ARB_framebuffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_object", 18))
- {
- ret = GLEW_ARB_framebuffer_object;
- continue;
- }
-#endif
-#ifdef GL_ARB_framebuffer_sRGB
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16))
- {
- ret = GLEW_ARB_framebuffer_sRGB;
- continue;
- }
-#endif
-#ifdef GL_ARB_geometry_shader4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16))
- {
- ret = GLEW_ARB_geometry_shader4;
- continue;
- }
-#endif
-#ifdef GL_ARB_get_program_binary
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_program_binary", 18))
- {
- ret = GLEW_ARB_get_program_binary;
- continue;
- }
-#endif
-#ifdef GL_ARB_get_texture_sub_image
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_texture_sub_image", 21))
- {
- ret = GLEW_ARB_get_texture_sub_image;
- continue;
- }
-#endif
-#ifdef GL_ARB_gpu_shader5
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader5", 11))
- {
- ret = GLEW_ARB_gpu_shader5;
- continue;
- }
-#endif
-#ifdef GL_ARB_gpu_shader_fp64
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader_fp64", 15))
- {
- ret = GLEW_ARB_gpu_shader_fp64;
- continue;
- }
-#endif
-#ifdef GL_ARB_half_float_pixel
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float_pixel", 16))
- {
- ret = GLEW_ARB_half_float_pixel;
- continue;
- }
-#endif
-#ifdef GL_ARB_half_float_vertex
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float_vertex", 17))
- {
- ret = GLEW_ARB_half_float_vertex;
- continue;
- }
-#endif
-#ifdef GL_ARB_imaging
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"imaging", 7))
- {
- ret = GLEW_ARB_imaging;
- continue;
- }
-#endif
-#ifdef GL_ARB_indirect_parameters
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"indirect_parameters", 19))
- {
- ret = GLEW_ARB_indirect_parameters;
- continue;
- }
-#endif
-#ifdef GL_ARB_instanced_arrays
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"instanced_arrays", 16))
- {
- ret = GLEW_ARB_instanced_arrays;
- continue;
- }
-#endif
-#ifdef GL_ARB_internalformat_query
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_query", 20))
- {
- ret = GLEW_ARB_internalformat_query;
- continue;
- }
-#endif
-#ifdef GL_ARB_internalformat_query2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_query2", 21))
- {
- ret = GLEW_ARB_internalformat_query2;
- continue;
- }
-#endif
-#ifdef GL_ARB_invalidate_subdata
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"invalidate_subdata", 18))
- {
- ret = GLEW_ARB_invalidate_subdata;
- continue;
- }
-#endif
-#ifdef GL_ARB_map_buffer_alignment
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_buffer_alignment", 20))
- {
- ret = GLEW_ARB_map_buffer_alignment;
- continue;
- }
-#endif
-#ifdef GL_ARB_map_buffer_range
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_buffer_range", 16))
- {
- ret = GLEW_ARB_map_buffer_range;
- continue;
- }
-#endif
-#ifdef GL_ARB_matrix_palette
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"matrix_palette", 14))
- {
- ret = GLEW_ARB_matrix_palette;
- continue;
- }
-#endif
-#ifdef GL_ARB_multi_bind
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_bind", 10))
- {
- ret = GLEW_ARB_multi_bind;
- continue;
- }
-#endif
-#ifdef GL_ARB_multi_draw_indirect
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_indirect", 19))
- {
- ret = GLEW_ARB_multi_draw_indirect;
- continue;
- }
-#endif
-#ifdef GL_ARB_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11))
- {
- ret = GLEW_ARB_multisample;
- continue;
- }
-#endif
-#ifdef GL_ARB_multitexture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multitexture", 12))
- {
- ret = GLEW_ARB_multitexture;
- continue;
- }
-#endif
-#ifdef GL_ARB_occlusion_query
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query", 15))
- {
- ret = GLEW_ARB_occlusion_query;
- continue;
- }
-#endif
-#ifdef GL_ARB_occlusion_query2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query2", 16))
- {
- ret = GLEW_ARB_occlusion_query2;
- continue;
- }
-#endif
-#ifdef GL_ARB_pipeline_statistics_query
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pipeline_statistics_query", 25))
- {
- ret = GLEW_ARB_pipeline_statistics_query;
- continue;
- }
-#endif
-#ifdef GL_ARB_pixel_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer_object", 19))
- {
- ret = GLEW_ARB_pixel_buffer_object;
- continue;
- }
-#endif
-#ifdef GL_ARB_point_parameters
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_parameters", 16))
- {
- ret = GLEW_ARB_point_parameters;
- continue;
- }
-#endif
-#ifdef GL_ARB_point_sprite
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprite", 12))
- {
- ret = GLEW_ARB_point_sprite;
- continue;
- }
-#endif
-#ifdef GL_ARB_program_interface_query
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"program_interface_query", 23))
- {
- ret = GLEW_ARB_program_interface_query;
- continue;
- }
-#endif
-#ifdef GL_ARB_provoking_vertex
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"provoking_vertex", 16))
- {
- ret = GLEW_ARB_provoking_vertex;
- continue;
- }
-#endif
-#ifdef GL_ARB_query_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_buffer_object", 19))
- {
- ret = GLEW_ARB_query_buffer_object;
- continue;
- }
-#endif
-#ifdef GL_ARB_robust_buffer_access_behavior
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"robust_buffer_access_behavior", 29))
- {
- ret = GLEW_ARB_robust_buffer_access_behavior;
- continue;
- }
-#endif
-#ifdef GL_ARB_robustness
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness", 10))
- {
- ret = GLEW_ARB_robustness;
- continue;
- }
-#endif
-#ifdef GL_ARB_robustness_application_isolation
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32))
- {
- ret = GLEW_ARB_robustness_application_isolation;
- continue;
- }
-#endif
-#ifdef GL_ARB_robustness_share_group_isolation
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32))
- {
- ret = GLEW_ARB_robustness_share_group_isolation;
- continue;
- }
-#endif
-#ifdef GL_ARB_sample_shading
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_shading", 14))
- {
- ret = GLEW_ARB_sample_shading;
- continue;
- }
-#endif
-#ifdef GL_ARB_sampler_objects
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sampler_objects", 15))
- {
- ret = GLEW_ARB_sampler_objects;
- continue;
- }
-#endif
-#ifdef GL_ARB_seamless_cube_map
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cube_map", 17))
- {
- ret = GLEW_ARB_seamless_cube_map;
- continue;
- }
-#endif
-#ifdef GL_ARB_seamless_cubemap_per_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cubemap_per_texture", 28))
- {
- ret = GLEW_ARB_seamless_cubemap_per_texture;
- continue;
- }
-#endif
-#ifdef GL_ARB_separate_shader_objects
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_shader_objects", 23))
- {
- ret = GLEW_ARB_separate_shader_objects;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_atomic_counters
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counters", 22))
- {
- ret = GLEW_ARB_shader_atomic_counters;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_bit_encoding
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_bit_encoding", 19))
- {
- ret = GLEW_ARB_shader_bit_encoding;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_draw_parameters
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_draw_parameters", 22))
- {
- ret = GLEW_ARB_shader_draw_parameters;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_group_vote
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_group_vote", 17))
- {
- ret = GLEW_ARB_shader_group_vote;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_image_load_store
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_store", 23))
- {
- ret = GLEW_ARB_shader_image_load_store;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_image_size
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_size", 17))
- {
- ret = GLEW_ARB_shader_image_size;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_objects
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_objects", 14))
- {
- ret = GLEW_ARB_shader_objects;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_precision
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_precision", 16))
- {
- ret = GLEW_ARB_shader_precision;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_stencil_export
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_stencil_export", 21))
- {
- ret = GLEW_ARB_shader_stencil_export;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_storage_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_storage_buffer_object", 28))
- {
- ret = GLEW_ARB_shader_storage_buffer_object;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_subroutine
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_subroutine", 17))
- {
- ret = GLEW_ARB_shader_subroutine;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_texture_image_samples
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_image_samples", 28))
- {
- ret = GLEW_ARB_shader_texture_image_samples;
- continue;
- }
-#endif
-#ifdef GL_ARB_shader_texture_lod
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_lod", 18))
- {
- ret = GLEW_ARB_shader_texture_lod;
- continue;
- }
-#endif
-#ifdef GL_ARB_shading_language_100
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_100", 20))
- {
- ret = GLEW_ARB_shading_language_100;
- continue;
- }
-#endif
-#ifdef GL_ARB_shading_language_420pack
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_420pack", 24))
- {
- ret = GLEW_ARB_shading_language_420pack;
- continue;
- }
-#endif
-#ifdef GL_ARB_shading_language_include
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_include", 24))
- {
- ret = GLEW_ARB_shading_language_include;
- continue;
- }
-#endif
-#ifdef GL_ARB_shading_language_packing
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_packing", 24))
- {
- ret = GLEW_ARB_shading_language_packing;
- continue;
- }
-#endif
-#ifdef GL_ARB_shadow
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow", 6))
- {
- ret = GLEW_ARB_shadow;
- continue;
- }
-#endif
-#ifdef GL_ARB_shadow_ambient
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_ambient", 14))
- {
- ret = GLEW_ARB_shadow_ambient;
- continue;
- }
-#endif
-#ifdef GL_ARB_sparse_buffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_buffer", 13))
- {
- ret = GLEW_ARB_sparse_buffer;
- continue;
- }
-#endif
-#ifdef GL_ARB_sparse_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture", 14))
- {
- ret = GLEW_ARB_sparse_texture;
- continue;
- }
-#endif
-#ifdef GL_ARB_stencil_texturing
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_texturing", 17))
- {
- ret = GLEW_ARB_stencil_texturing;
- continue;
- }
-#endif
-#ifdef GL_ARB_sync
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync", 4))
- {
- ret = GLEW_ARB_sync;
- continue;
- }
-#endif
-#ifdef GL_ARB_tessellation_shader
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"tessellation_shader", 19))
- {
- ret = GLEW_ARB_tessellation_shader;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_barrier
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_barrier", 15))
- {
- ret = GLEW_ARB_texture_barrier;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_border_clamp
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_border_clamp", 20))
- {
- ret = GLEW_ARB_texture_border_clamp;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object", 21))
- {
- ret = GLEW_ARB_texture_buffer_object;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_buffer_object_rgb32
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object_rgb32", 27))
- {
- ret = GLEW_ARB_texture_buffer_object_rgb32;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_buffer_range
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_range", 20))
- {
- ret = GLEW_ARB_texture_buffer_range;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_compression
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression", 19))
- {
- ret = GLEW_ARB_texture_compression;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_compression_bptc
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_bptc", 24))
- {
- ret = GLEW_ARB_texture_compression_bptc;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_compression_rgtc
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_rgtc", 24))
- {
- ret = GLEW_ARB_texture_compression_rgtc;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_cube_map
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map", 16))
- {
- ret = GLEW_ARB_texture_cube_map;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_cube_map_array
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map_array", 22))
- {
- ret = GLEW_ARB_texture_cube_map_array;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_env_add
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_add", 15))
- {
- ret = GLEW_ARB_texture_env_add;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_env_combine
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine", 19))
- {
- ret = GLEW_ARB_texture_env_combine;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_env_crossbar
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_crossbar", 20))
- {
- ret = GLEW_ARB_texture_env_crossbar;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_env_dot3
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_dot3", 16))
- {
- ret = GLEW_ARB_texture_env_dot3;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_float", 13))
- {
- ret = GLEW_ARB_texture_float;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_gather
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_gather", 14))
- {
- ret = GLEW_ARB_texture_gather;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_mirror_clamp_to_edge
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_clamp_to_edge", 28))
- {
- ret = GLEW_ARB_texture_mirror_clamp_to_edge;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_mirrored_repeat
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirrored_repeat", 23))
- {
- ret = GLEW_ARB_texture_mirrored_repeat;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multisample", 19))
- {
- ret = GLEW_ARB_texture_multisample;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_non_power_of_two
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_non_power_of_two", 24))
- {
- ret = GLEW_ARB_texture_non_power_of_two;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_query_levels
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_query_levels", 20))
- {
- ret = GLEW_ARB_texture_query_levels;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_query_lod
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_query_lod", 17))
- {
- ret = GLEW_ARB_texture_query_lod;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_rectangle
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17))
- {
- ret = GLEW_ARB_texture_rectangle;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_rg
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rg", 10))
- {
- ret = GLEW_ARB_texture_rg;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_rgb10_a2ui
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rgb10_a2ui", 18))
- {
- ret = GLEW_ARB_texture_rgb10_a2ui;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_stencil8
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_stencil8", 16))
- {
- ret = GLEW_ARB_texture_stencil8;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_storage
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_storage", 15))
- {
- ret = GLEW_ARB_texture_storage;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_storage_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_storage_multisample", 27))
- {
- ret = GLEW_ARB_texture_storage_multisample;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_swizzle
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_swizzle", 15))
- {
- ret = GLEW_ARB_texture_swizzle;
- continue;
- }
-#endif
-#ifdef GL_ARB_texture_view
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_view", 12))
- {
- ret = GLEW_ARB_texture_view;
- continue;
- }
-#endif
-#ifdef GL_ARB_timer_query
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11))
- {
- ret = GLEW_ARB_timer_query;
- continue;
- }
-#endif
-#ifdef GL_ARB_transform_feedback2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback2", 19))
- {
- ret = GLEW_ARB_transform_feedback2;
- continue;
- }
-#endif
-#ifdef GL_ARB_transform_feedback3
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback3", 19))
- {
- ret = GLEW_ARB_transform_feedback3;
- continue;
- }
-#endif
-#ifdef GL_ARB_transform_feedback_instanced
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback_instanced", 28))
- {
- ret = GLEW_ARB_transform_feedback_instanced;
- continue;
- }
-#endif
-#ifdef GL_ARB_transform_feedback_overflow_query
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback_overflow_query", 33))
- {
- ret = GLEW_ARB_transform_feedback_overflow_query;
- continue;
- }
-#endif
-#ifdef GL_ARB_transpose_matrix
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"transpose_matrix", 16))
- {
- ret = GLEW_ARB_transpose_matrix;
- continue;
- }
-#endif
-#ifdef GL_ARB_uniform_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"uniform_buffer_object", 21))
- {
- ret = GLEW_ARB_uniform_buffer_object;
- continue;
- }
-#endif
-#ifdef GL_ARB_vertex_array_bgra
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_bgra", 17))
- {
- ret = GLEW_ARB_vertex_array_bgra;
- continue;
- }
-#endif
-#ifdef GL_ARB_vertex_array_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19))
- {
- ret = GLEW_ARB_vertex_array_object;
- continue;
- }
-#endif
-#ifdef GL_ARB_vertex_attrib_64bit
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_64bit", 19))
- {
- ret = GLEW_ARB_vertex_attrib_64bit;
- continue;
- }
-#endif
-#ifdef GL_ARB_vertex_attrib_binding
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_binding", 21))
- {
- ret = GLEW_ARB_vertex_attrib_binding;
- continue;
- }
-#endif
-#ifdef GL_ARB_vertex_blend
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_blend", 12))
- {
- ret = GLEW_ARB_vertex_blend;
- continue;
- }
-#endif
-#ifdef GL_ARB_vertex_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_object", 20))
- {
- ret = GLEW_ARB_vertex_buffer_object;
- continue;
- }
-#endif
-#ifdef GL_ARB_vertex_program
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program", 14))
- {
- ret = GLEW_ARB_vertex_program;
- continue;
- }
-#endif
-#ifdef GL_ARB_vertex_shader
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader", 13))
- {
- ret = GLEW_ARB_vertex_shader;
- continue;
- }
-#endif
-#ifdef GL_ARB_vertex_type_10f_11f_11f_rev
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_type_10f_11f_11f_rev", 27))
- {
- ret = GLEW_ARB_vertex_type_10f_11f_11f_rev;
- continue;
- }
-#endif
-#ifdef GL_ARB_vertex_type_2_10_10_10_rev
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_type_2_10_10_10_rev", 26))
- {
- ret = GLEW_ARB_vertex_type_2_10_10_10_rev;
- continue;
- }
-#endif
-#ifdef GL_ARB_viewport_array
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"viewport_array", 14))
- {
- ret = GLEW_ARB_viewport_array;
- continue;
- }
-#endif
-#ifdef GL_ARB_window_pos
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_pos", 10))
- {
- ret = GLEW_ARB_window_pos;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATIX_", 5))
- {
-#ifdef GL_ATIX_point_sprites
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprites", 13))
- {
- ret = GLEW_ATIX_point_sprites;
- continue;
- }
-#endif
-#ifdef GL_ATIX_texture_env_combine3
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine3", 20))
- {
- ret = GLEW_ATIX_texture_env_combine3;
- continue;
- }
-#endif
-#ifdef GL_ATIX_texture_env_route
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_route", 17))
- {
- ret = GLEW_ATIX_texture_env_route;
- continue;
- }
-#endif
-#ifdef GL_ATIX_vertex_shader_output_point_size
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_output_point_size", 31))
- {
- ret = GLEW_ATIX_vertex_shader_output_point_size;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4))
- {
-#ifdef GL_ATI_draw_buffers
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers", 12))
- {
- ret = GLEW_ATI_draw_buffers;
- continue;
- }
-#endif
-#ifdef GL_ATI_element_array
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"element_array", 13))
- {
- ret = GLEW_ATI_element_array;
- continue;
- }
-#endif
-#ifdef GL_ATI_envmap_bumpmap
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"envmap_bumpmap", 14))
- {
- ret = GLEW_ATI_envmap_bumpmap;
- continue;
- }
-#endif
-#ifdef GL_ATI_fragment_shader
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader", 15))
- {
- ret = GLEW_ATI_fragment_shader;
- continue;
- }
-#endif
-#ifdef GL_ATI_map_object_buffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_object_buffer", 17))
- {
- ret = GLEW_ATI_map_object_buffer;
- continue;
- }
-#endif
-#ifdef GL_ATI_meminfo
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"meminfo", 7))
- {
- ret = GLEW_ATI_meminfo;
- continue;
- }
-#endif
-#ifdef GL_ATI_pn_triangles
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pn_triangles", 12))
- {
- ret = GLEW_ATI_pn_triangles;
- continue;
- }
-#endif
-#ifdef GL_ATI_separate_stencil
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_stencil", 16))
- {
- ret = GLEW_ATI_separate_stencil;
- continue;
- }
-#endif
-#ifdef GL_ATI_shader_texture_lod
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_lod", 18))
- {
- ret = GLEW_ATI_shader_texture_lod;
- continue;
- }
-#endif
-#ifdef GL_ATI_text_fragment_shader
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"text_fragment_shader", 20))
- {
- ret = GLEW_ATI_text_fragment_shader;
- continue;
- }
-#endif
-#ifdef GL_ATI_texture_compression_3dc
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_3dc", 23))
- {
- ret = GLEW_ATI_texture_compression_3dc;
- continue;
- }
-#endif
-#ifdef GL_ATI_texture_env_combine3
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine3", 20))
- {
- ret = GLEW_ATI_texture_env_combine3;
- continue;
- }
-#endif
-#ifdef GL_ATI_texture_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_float", 13))
- {
- ret = GLEW_ATI_texture_float;
- continue;
- }
-#endif
-#ifdef GL_ATI_texture_mirror_once
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_once", 19))
- {
- ret = GLEW_ATI_texture_mirror_once;
- continue;
- }
-#endif
-#ifdef GL_ATI_vertex_array_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19))
- {
- ret = GLEW_ATI_vertex_array_object;
- continue;
- }
-#endif
-#ifdef GL_ATI_vertex_attrib_array_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_array_object", 26))
- {
- ret = GLEW_ATI_vertex_attrib_array_object;
- continue;
- }
-#endif
-#ifdef GL_ATI_vertex_streams
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_streams", 14))
- {
- ret = GLEW_ATI_vertex_streams;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4))
- {
-#ifdef GL_EXT_422_pixels
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"422_pixels", 10))
- {
- ret = GLEW_EXT_422_pixels;
- continue;
- }
-#endif
-#ifdef GL_EXT_Cg_shader
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"Cg_shader", 9))
- {
- ret = GLEW_EXT_Cg_shader;
- continue;
- }
-#endif
-#ifdef GL_EXT_abgr
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"abgr", 4))
- {
- ret = GLEW_EXT_abgr;
- continue;
- }
-#endif
-#ifdef GL_EXT_bgra
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"bgra", 4))
- {
- ret = GLEW_EXT_bgra;
- continue;
- }
-#endif
-#ifdef GL_EXT_bindable_uniform
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindable_uniform", 16))
- {
- ret = GLEW_EXT_bindable_uniform;
- continue;
- }
-#endif
-#ifdef GL_EXT_blend_color
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_color", 11))
- {
- ret = GLEW_EXT_blend_color;
- continue;
- }
-#endif
-#ifdef GL_EXT_blend_equation_separate
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_separate", 23))
- {
- ret = GLEW_EXT_blend_equation_separate;
- continue;
- }
-#endif
-#ifdef GL_EXT_blend_func_separate
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_func_separate", 19))
- {
- ret = GLEW_EXT_blend_func_separate;
- continue;
- }
-#endif
-#ifdef GL_EXT_blend_logic_op
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_logic_op", 14))
- {
- ret = GLEW_EXT_blend_logic_op;
- continue;
- }
-#endif
-#ifdef GL_EXT_blend_minmax
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_minmax", 12))
- {
- ret = GLEW_EXT_blend_minmax;
- continue;
- }
-#endif
-#ifdef GL_EXT_blend_subtract
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_subtract", 14))
- {
- ret = GLEW_EXT_blend_subtract;
- continue;
- }
-#endif
-#ifdef GL_EXT_clip_volume_hint
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"clip_volume_hint", 16))
- {
- ret = GLEW_EXT_clip_volume_hint;
- continue;
- }
-#endif
-#ifdef GL_EXT_cmyka
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"cmyka", 5))
- {
- ret = GLEW_EXT_cmyka;
- continue;
- }
-#endif
-#ifdef GL_EXT_color_subtable
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_subtable", 14))
- {
- ret = GLEW_EXT_color_subtable;
- continue;
- }
-#endif
-#ifdef GL_EXT_compiled_vertex_array
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"compiled_vertex_array", 21))
- {
- ret = GLEW_EXT_compiled_vertex_array;
- continue;
- }
-#endif
-#ifdef GL_EXT_convolution
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution", 11))
- {
- ret = GLEW_EXT_convolution;
- continue;
- }
-#endif
-#ifdef GL_EXT_coordinate_frame
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"coordinate_frame", 16))
- {
- ret = GLEW_EXT_coordinate_frame;
- continue;
- }
-#endif
-#ifdef GL_EXT_copy_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_texture", 12))
- {
- ret = GLEW_EXT_copy_texture;
- continue;
- }
-#endif
-#ifdef GL_EXT_cull_vertex
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_vertex", 11))
- {
- ret = GLEW_EXT_cull_vertex;
- continue;
- }
-#endif
-#ifdef GL_EXT_debug_label
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_label", 11))
- {
- ret = GLEW_EXT_debug_label;
- continue;
- }
-#endif
-#ifdef GL_EXT_debug_marker
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_marker", 12))
- {
- ret = GLEW_EXT_debug_marker;
- continue;
- }
-#endif
-#ifdef GL_EXT_depth_bounds_test
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_bounds_test", 17))
- {
- ret = GLEW_EXT_depth_bounds_test;
- continue;
- }
-#endif
-#ifdef GL_EXT_direct_state_access
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"direct_state_access", 19))
- {
- ret = GLEW_EXT_direct_state_access;
- continue;
- }
-#endif
-#ifdef GL_EXT_draw_buffers2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers2", 13))
- {
- ret = GLEW_EXT_draw_buffers2;
- continue;
- }
-#endif
-#ifdef GL_EXT_draw_instanced
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_instanced", 14))
- {
- ret = GLEW_EXT_draw_instanced;
- continue;
- }
-#endif
-#ifdef GL_EXT_draw_range_elements
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_range_elements", 19))
- {
- ret = GLEW_EXT_draw_range_elements;
- continue;
- }
-#endif
-#ifdef GL_EXT_fog_coord
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_coord", 9))
- {
- ret = GLEW_EXT_fog_coord;
- continue;
- }
-#endif
-#ifdef GL_EXT_fragment_lighting
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_lighting", 17))
- {
- ret = GLEW_EXT_fragment_lighting;
- continue;
- }
-#endif
-#ifdef GL_EXT_framebuffer_blit
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_blit", 16))
- {
- ret = GLEW_EXT_framebuffer_blit;
- continue;
- }
-#endif
-#ifdef GL_EXT_framebuffer_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample", 23))
- {
- ret = GLEW_EXT_framebuffer_multisample;
- continue;
- }
-#endif
-#ifdef GL_EXT_framebuffer_multisample_blit_scaled
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample_blit_scaled", 35))
- {
- ret = GLEW_EXT_framebuffer_multisample_blit_scaled;
- continue;
- }
-#endif
-#ifdef GL_EXT_framebuffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_object", 18))
- {
- ret = GLEW_EXT_framebuffer_object;
- continue;
- }
-#endif
-#ifdef GL_EXT_framebuffer_sRGB
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16))
- {
- ret = GLEW_EXT_framebuffer_sRGB;
- continue;
- }
-#endif
-#ifdef GL_EXT_geometry_shader4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16))
- {
- ret = GLEW_EXT_geometry_shader4;
- continue;
- }
-#endif
-#ifdef GL_EXT_gpu_program_parameters
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program_parameters", 22))
- {
- ret = GLEW_EXT_gpu_program_parameters;
- continue;
- }
-#endif
-#ifdef GL_EXT_gpu_shader4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader4", 11))
- {
- ret = GLEW_EXT_gpu_shader4;
- continue;
- }
-#endif
-#ifdef GL_EXT_histogram
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"histogram", 9))
- {
- ret = GLEW_EXT_histogram;
- continue;
- }
-#endif
-#ifdef GL_EXT_index_array_formats
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_array_formats", 19))
- {
- ret = GLEW_EXT_index_array_formats;
- continue;
- }
-#endif
-#ifdef GL_EXT_index_func
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_func", 10))
- {
- ret = GLEW_EXT_index_func;
- continue;
- }
-#endif
-#ifdef GL_EXT_index_material
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_material", 14))
- {
- ret = GLEW_EXT_index_material;
- continue;
- }
-#endif
-#ifdef GL_EXT_index_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_texture", 13))
- {
- ret = GLEW_EXT_index_texture;
- continue;
- }
-#endif
-#ifdef GL_EXT_light_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"light_texture", 13))
- {
- ret = GLEW_EXT_light_texture;
- continue;
- }
-#endif
-#ifdef GL_EXT_misc_attribute
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"misc_attribute", 14))
- {
- ret = GLEW_EXT_misc_attribute;
- continue;
- }
-#endif
-#ifdef GL_EXT_multi_draw_arrays
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_arrays", 17))
- {
- ret = GLEW_EXT_multi_draw_arrays;
- continue;
- }
-#endif
-#ifdef GL_EXT_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11))
- {
- ret = GLEW_EXT_multisample;
- continue;
- }
-#endif
-#ifdef GL_EXT_packed_depth_stencil
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_depth_stencil", 20))
- {
- ret = GLEW_EXT_packed_depth_stencil;
- continue;
- }
-#endif
-#ifdef GL_EXT_packed_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_float", 12))
- {
- ret = GLEW_EXT_packed_float;
- continue;
- }
-#endif
-#ifdef GL_EXT_packed_pixels
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_pixels", 13))
- {
- ret = GLEW_EXT_packed_pixels;
- continue;
- }
-#endif
-#ifdef GL_EXT_paletted_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"paletted_texture", 16))
- {
- ret = GLEW_EXT_paletted_texture;
- continue;
- }
-#endif
-#ifdef GL_EXT_pixel_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer_object", 19))
- {
- ret = GLEW_EXT_pixel_buffer_object;
- continue;
- }
-#endif
-#ifdef GL_EXT_pixel_transform
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_transform", 15))
- {
- ret = GLEW_EXT_pixel_transform;
- continue;
- }
-#endif
-#ifdef GL_EXT_pixel_transform_color_table
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_transform_color_table", 27))
- {
- ret = GLEW_EXT_pixel_transform_color_table;
- continue;
- }
-#endif
-#ifdef GL_EXT_point_parameters
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_parameters", 16))
- {
- ret = GLEW_EXT_point_parameters;
- continue;
- }
-#endif
-#ifdef GL_EXT_polygon_offset
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"polygon_offset", 14))
- {
- ret = GLEW_EXT_polygon_offset;
- continue;
- }
-#endif
-#ifdef GL_EXT_polygon_offset_clamp
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"polygon_offset_clamp", 20))
- {
- ret = GLEW_EXT_polygon_offset_clamp;
- continue;
- }
-#endif
-#ifdef GL_EXT_post_depth_coverage
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"post_depth_coverage", 19))
- {
- ret = GLEW_EXT_post_depth_coverage;
- continue;
- }
-#endif
-#ifdef GL_EXT_provoking_vertex
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"provoking_vertex", 16))
- {
- ret = GLEW_EXT_provoking_vertex;
- continue;
- }
-#endif
-#ifdef GL_EXT_raster_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"raster_multisample", 18))
- {
- ret = GLEW_EXT_raster_multisample;
- continue;
- }
-#endif
-#ifdef GL_EXT_rescale_normal
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"rescale_normal", 14))
- {
- ret = GLEW_EXT_rescale_normal;
- continue;
- }
-#endif
-#ifdef GL_EXT_scene_marker
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"scene_marker", 12))
- {
- ret = GLEW_EXT_scene_marker;
- continue;
- }
-#endif
-#ifdef GL_EXT_secondary_color
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"secondary_color", 15))
- {
- ret = GLEW_EXT_secondary_color;
- continue;
- }
-#endif
-#ifdef GL_EXT_separate_shader_objects
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_shader_objects", 23))
- {
- ret = GLEW_EXT_separate_shader_objects;
- continue;
- }
-#endif
-#ifdef GL_EXT_separate_specular_color
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_specular_color", 23))
- {
- ret = GLEW_EXT_separate_specular_color;
- continue;
- }
-#endif
-#ifdef GL_EXT_shader_image_load_formatted
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_formatted", 27))
- {
- ret = GLEW_EXT_shader_image_load_formatted;
- continue;
- }
-#endif
-#ifdef GL_EXT_shader_image_load_store
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_store", 23))
- {
- ret = GLEW_EXT_shader_image_load_store;
- continue;
- }
-#endif
-#ifdef GL_EXT_shader_integer_mix
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_integer_mix", 18))
- {
- ret = GLEW_EXT_shader_integer_mix;
- continue;
- }
-#endif
-#ifdef GL_EXT_shadow_funcs
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_funcs", 12))
- {
- ret = GLEW_EXT_shadow_funcs;
- continue;
- }
-#endif
-#ifdef GL_EXT_shared_texture_palette
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shared_texture_palette", 22))
- {
- ret = GLEW_EXT_shared_texture_palette;
- continue;
- }
-#endif
-#ifdef GL_EXT_sparse_texture2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture2", 15))
- {
- ret = GLEW_EXT_sparse_texture2;
- continue;
- }
-#endif
-#ifdef GL_EXT_stencil_clear_tag
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_clear_tag", 17))
- {
- ret = GLEW_EXT_stencil_clear_tag;
- continue;
- }
-#endif
-#ifdef GL_EXT_stencil_two_side
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_two_side", 16))
- {
- ret = GLEW_EXT_stencil_two_side;
- continue;
- }
-#endif
-#ifdef GL_EXT_stencil_wrap
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_wrap", 12))
- {
- ret = GLEW_EXT_stencil_wrap;
- continue;
- }
-#endif
-#ifdef GL_EXT_subtexture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"subtexture", 10))
- {
- ret = GLEW_EXT_subtexture;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture", 7))
- {
- ret = GLEW_EXT_texture;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture3D
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture3D", 9))
- {
- ret = GLEW_EXT_texture3D;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_array
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_array", 13))
- {
- ret = GLEW_EXT_texture_array;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object", 21))
- {
- ret = GLEW_EXT_texture_buffer_object;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_compression_dxt1
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt1", 24))
- {
- ret = GLEW_EXT_texture_compression_dxt1;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_compression_latc
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_latc", 24))
- {
- ret = GLEW_EXT_texture_compression_latc;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_compression_rgtc
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_rgtc", 24))
- {
- ret = GLEW_EXT_texture_compression_rgtc;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_compression_s3tc
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_s3tc", 24))
- {
- ret = GLEW_EXT_texture_compression_s3tc;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_cube_map
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map", 16))
- {
- ret = GLEW_EXT_texture_cube_map;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_edge_clamp
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_edge_clamp", 18))
- {
- ret = GLEW_EXT_texture_edge_clamp;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_env
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env", 11))
- {
- ret = GLEW_EXT_texture_env;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_env_add
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_add", 15))
- {
- ret = GLEW_EXT_texture_env_add;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_env_combine
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine", 19))
- {
- ret = GLEW_EXT_texture_env_combine;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_env_dot3
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_dot3", 16))
- {
- ret = GLEW_EXT_texture_env_dot3;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_filter_anisotropic
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_anisotropic", 26))
- {
- ret = GLEW_EXT_texture_filter_anisotropic;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_filter_minmax
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_minmax", 21))
- {
- ret = GLEW_EXT_texture_filter_minmax;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_integer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_integer", 15))
- {
- ret = GLEW_EXT_texture_integer;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_lod_bias
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod_bias", 16))
- {
- ret = GLEW_EXT_texture_lod_bias;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_mirror_clamp
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_clamp", 20))
- {
- ret = GLEW_EXT_texture_mirror_clamp;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_object", 14))
- {
- ret = GLEW_EXT_texture_object;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_perturb_normal
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_perturb_normal", 22))
- {
- ret = GLEW_EXT_texture_perturb_normal;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_rectangle
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17))
- {
- ret = GLEW_EXT_texture_rectangle;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_sRGB
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_sRGB", 12))
- {
- ret = GLEW_EXT_texture_sRGB;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_sRGB_decode
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_sRGB_decode", 19))
- {
- ret = GLEW_EXT_texture_sRGB_decode;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_shared_exponent
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shared_exponent", 23))
- {
- ret = GLEW_EXT_texture_shared_exponent;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_snorm
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_snorm", 13))
- {
- ret = GLEW_EXT_texture_snorm;
- continue;
- }
-#endif
-#ifdef GL_EXT_texture_swizzle
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_swizzle", 15))
- {
- ret = GLEW_EXT_texture_swizzle;
- continue;
- }
-#endif
-#ifdef GL_EXT_timer_query
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11))
- {
- ret = GLEW_EXT_timer_query;
- continue;
- }
-#endif
-#ifdef GL_EXT_transform_feedback
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback", 18))
- {
- ret = GLEW_EXT_transform_feedback;
- continue;
- }
-#endif
-#ifdef GL_EXT_vertex_array
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array", 12))
- {
- ret = GLEW_EXT_vertex_array;
- continue;
- }
-#endif
-#ifdef GL_EXT_vertex_array_bgra
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_bgra", 17))
- {
- ret = GLEW_EXT_vertex_array_bgra;
- continue;
- }
-#endif
-#ifdef GL_EXT_vertex_attrib_64bit
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_64bit", 19))
- {
- ret = GLEW_EXT_vertex_attrib_64bit;
- continue;
- }
-#endif
-#ifdef GL_EXT_vertex_shader
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader", 13))
- {
- ret = GLEW_EXT_vertex_shader;
- continue;
- }
-#endif
-#ifdef GL_EXT_vertex_weighting
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_weighting", 16))
- {
- ret = GLEW_EXT_vertex_weighting;
- continue;
- }
-#endif
-#ifdef GL_EXT_x11_sync_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"x11_sync_object", 15))
- {
- ret = GLEW_EXT_x11_sync_object;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"GREMEDY_", 8))
- {
-#ifdef GL_GREMEDY_frame_terminator
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"frame_terminator", 16))
- {
- ret = GLEW_GREMEDY_frame_terminator;
- continue;
- }
-#endif
-#ifdef GL_GREMEDY_string_marker
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"string_marker", 13))
- {
- ret = GLEW_GREMEDY_string_marker;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"HP_", 3))
- {
-#ifdef GL_HP_convolution_border_modes
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_border_modes", 24))
- {
- ret = GLEW_HP_convolution_border_modes;
- continue;
- }
-#endif
-#ifdef GL_HP_image_transform
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_transform", 15))
- {
- ret = GLEW_HP_image_transform;
- continue;
- }
-#endif
-#ifdef GL_HP_occlusion_test
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_test", 14))
- {
- ret = GLEW_HP_occlusion_test;
- continue;
- }
-#endif
-#ifdef GL_HP_texture_lighting
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lighting", 16))
- {
- ret = GLEW_HP_texture_lighting;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"IBM_", 4))
- {
-#ifdef GL_IBM_cull_vertex
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_vertex", 11))
- {
- ret = GLEW_IBM_cull_vertex;
- continue;
- }
-#endif
-#ifdef GL_IBM_multimode_draw_arrays
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multimode_draw_arrays", 21))
- {
- ret = GLEW_IBM_multimode_draw_arrays;
- continue;
- }
-#endif
-#ifdef GL_IBM_rasterpos_clip
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"rasterpos_clip", 14))
- {
- ret = GLEW_IBM_rasterpos_clip;
- continue;
- }
-#endif
-#ifdef GL_IBM_static_data
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"static_data", 11))
- {
- ret = GLEW_IBM_static_data;
- continue;
- }
-#endif
-#ifdef GL_IBM_texture_mirrored_repeat
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirrored_repeat", 23))
- {
- ret = GLEW_IBM_texture_mirrored_repeat;
- continue;
- }
-#endif
-#ifdef GL_IBM_vertex_array_lists
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_lists", 18))
- {
- ret = GLEW_IBM_vertex_array_lists;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"INGR_", 5))
- {
-#ifdef GL_INGR_color_clamp
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_clamp", 11))
- {
- ret = GLEW_INGR_color_clamp;
- continue;
- }
-#endif
-#ifdef GL_INGR_interlace_read
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace_read", 14))
- {
- ret = GLEW_INGR_interlace_read;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"INTEL_", 6))
- {
-#ifdef GL_INTEL_fragment_shader_ordering
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader_ordering", 24))
- {
- ret = GLEW_INTEL_fragment_shader_ordering;
- continue;
- }
-#endif
-#ifdef GL_INTEL_map_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_texture", 11))
- {
- ret = GLEW_INTEL_map_texture;
- continue;
- }
-#endif
-#ifdef GL_INTEL_parallel_arrays
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"parallel_arrays", 15))
- {
- ret = GLEW_INTEL_parallel_arrays;
- continue;
- }
-#endif
-#ifdef GL_INTEL_performance_query
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"performance_query", 17))
- {
- ret = GLEW_INTEL_performance_query;
- continue;
- }
-#endif
-#ifdef GL_INTEL_texture_scissor
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_scissor", 15))
- {
- ret = GLEW_INTEL_texture_scissor;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"KHR_", 4))
- {
-#ifdef GL_KHR_blend_equation_advanced
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced", 23))
- {
- ret = GLEW_KHR_blend_equation_advanced;
- continue;
- }
-#endif
-#ifdef GL_KHR_blend_equation_advanced_coherent
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced_coherent", 32))
- {
- ret = GLEW_KHR_blend_equation_advanced_coherent;
- continue;
- }
-#endif
-#ifdef GL_KHR_context_flush_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"context_flush_control", 21))
- {
- ret = GLEW_KHR_context_flush_control;
- continue;
- }
-#endif
-#ifdef GL_KHR_debug
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug", 5))
- {
- ret = GLEW_KHR_debug;
- continue;
- }
-#endif
-#ifdef GL_KHR_robust_buffer_access_behavior
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"robust_buffer_access_behavior", 29))
- {
- ret = GLEW_KHR_robust_buffer_access_behavior;
- continue;
- }
-#endif
-#ifdef GL_KHR_robustness
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness", 10))
- {
- ret = GLEW_KHR_robustness;
- continue;
- }
-#endif
-#ifdef GL_KHR_texture_compression_astc_hdr
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_astc_hdr", 28))
- {
- ret = GLEW_KHR_texture_compression_astc_hdr;
- continue;
- }
-#endif
-#ifdef GL_KHR_texture_compression_astc_ldr
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_astc_ldr", 28))
- {
- ret = GLEW_KHR_texture_compression_astc_ldr;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"KTX_", 4))
- {
-#ifdef GL_KTX_buffer_region
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_region", 13))
- {
- ret = GLEW_KTX_buffer_region;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESAX_", 6))
- {
-#ifdef GL_MESAX_texture_stack
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_stack", 13))
- {
- ret = GLEW_MESAX_texture_stack;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5))
- {
-#ifdef GL_MESA_pack_invert
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pack_invert", 11))
- {
- ret = GLEW_MESA_pack_invert;
- continue;
- }
-#endif
-#ifdef GL_MESA_resize_buffers
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"resize_buffers", 14))
- {
- ret = GLEW_MESA_resize_buffers;
- continue;
- }
-#endif
-#ifdef GL_MESA_window_pos
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_pos", 10))
- {
- ret = GLEW_MESA_window_pos;
- continue;
- }
-#endif
-#ifdef GL_MESA_ycbcr_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycbcr_texture", 13))
- {
- ret = GLEW_MESA_ycbcr_texture;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"NVX_", 4))
- {
-#ifdef GL_NVX_conditional_render
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"conditional_render", 18))
- {
- ret = GLEW_NVX_conditional_render;
- continue;
- }
-#endif
-#ifdef GL_NVX_gpu_memory_info
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_memory_info", 15))
- {
- ret = GLEW_NVX_gpu_memory_info;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3))
- {
-#ifdef GL_NV_bindless_multi_draw_indirect
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_multi_draw_indirect", 28))
- {
- ret = GLEW_NV_bindless_multi_draw_indirect;
- continue;
- }
-#endif
-#ifdef GL_NV_bindless_multi_draw_indirect_count
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_multi_draw_indirect_count", 34))
- {
- ret = GLEW_NV_bindless_multi_draw_indirect_count;
- continue;
- }
-#endif
-#ifdef GL_NV_bindless_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_texture", 16))
- {
- ret = GLEW_NV_bindless_texture;
- continue;
- }
-#endif
-#ifdef GL_NV_blend_equation_advanced
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced", 23))
- {
- ret = GLEW_NV_blend_equation_advanced;
- continue;
- }
-#endif
-#ifdef GL_NV_blend_equation_advanced_coherent
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced_coherent", 32))
- {
- ret = GLEW_NV_blend_equation_advanced_coherent;
- continue;
- }
-#endif
-#ifdef GL_NV_blend_square
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_square", 12))
- {
- ret = GLEW_NV_blend_square;
- continue;
- }
-#endif
-#ifdef GL_NV_compute_program5
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"compute_program5", 16))
- {
- ret = GLEW_NV_compute_program5;
- continue;
- }
-#endif
-#ifdef GL_NV_conditional_render
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"conditional_render", 18))
- {
- ret = GLEW_NV_conditional_render;
- continue;
- }
-#endif
-#ifdef GL_NV_conservative_raster
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_raster", 19))
- {
- ret = GLEW_NV_conservative_raster;
- continue;
- }
-#endif
-#ifdef GL_NV_copy_depth_to_color
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_depth_to_color", 19))
- {
- ret = GLEW_NV_copy_depth_to_color;
- continue;
- }
-#endif
-#ifdef GL_NV_copy_image
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10))
- {
- ret = GLEW_NV_copy_image;
- continue;
- }
-#endif
-#ifdef GL_NV_deep_texture3D
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"deep_texture3D", 14))
- {
- ret = GLEW_NV_deep_texture3D;
- continue;
- }
-#endif
-#ifdef GL_NV_depth_buffer_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_buffer_float", 18))
- {
- ret = GLEW_NV_depth_buffer_float;
- continue;
- }
-#endif
-#ifdef GL_NV_depth_clamp
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp", 11))
- {
- ret = GLEW_NV_depth_clamp;
- continue;
- }
-#endif
-#ifdef GL_NV_depth_range_unclamped
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_range_unclamped", 21))
- {
- ret = GLEW_NV_depth_range_unclamped;
- continue;
- }
-#endif
-#ifdef GL_NV_draw_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_texture", 12))
- {
- ret = GLEW_NV_draw_texture;
- continue;
- }
-#endif
-#ifdef GL_NV_evaluators
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"evaluators", 10))
- {
- ret = GLEW_NV_evaluators;
- continue;
- }
-#endif
-#ifdef GL_NV_explicit_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_multisample", 20))
- {
- ret = GLEW_NV_explicit_multisample;
- continue;
- }
-#endif
-#ifdef GL_NV_fence
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fence", 5))
- {
- ret = GLEW_NV_fence;
- continue;
- }
-#endif
-#ifdef GL_NV_fill_rectangle
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fill_rectangle", 14))
- {
- ret = GLEW_NV_fill_rectangle;
- continue;
- }
-#endif
-#ifdef GL_NV_float_buffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12))
- {
- ret = GLEW_NV_float_buffer;
- continue;
- }
-#endif
-#ifdef GL_NV_fog_distance
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_distance", 12))
- {
- ret = GLEW_NV_fog_distance;
- continue;
- }
-#endif
-#ifdef GL_NV_fragment_coverage_to_color
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_coverage_to_color", 26))
- {
- ret = GLEW_NV_fragment_coverage_to_color;
- continue;
- }
-#endif
-#ifdef GL_NV_fragment_program
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program", 16))
- {
- ret = GLEW_NV_fragment_program;
- continue;
- }
-#endif
-#ifdef GL_NV_fragment_program2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program2", 17))
- {
- ret = GLEW_NV_fragment_program2;
- continue;
- }
-#endif
-#ifdef GL_NV_fragment_program4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program4", 17))
- {
- ret = GLEW_NV_fragment_program4;
- continue;
- }
-#endif
-#ifdef GL_NV_fragment_program_option
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program_option", 23))
- {
- ret = GLEW_NV_fragment_program_option;
- continue;
- }
-#endif
-#ifdef GL_NV_fragment_shader_interlock
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader_interlock", 25))
- {
- ret = GLEW_NV_fragment_shader_interlock;
- continue;
- }
-#endif
-#ifdef GL_NV_framebuffer_mixed_samples
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_mixed_samples", 25))
- {
- ret = GLEW_NV_framebuffer_mixed_samples;
- continue;
- }
-#endif
-#ifdef GL_NV_framebuffer_multisample_coverage
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample_coverage", 32))
- {
- ret = GLEW_NV_framebuffer_multisample_coverage;
- continue;
- }
-#endif
-#ifdef GL_NV_geometry_program4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_program4", 17))
- {
- ret = GLEW_NV_geometry_program4;
- continue;
- }
-#endif
-#ifdef GL_NV_geometry_shader4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16))
- {
- ret = GLEW_NV_geometry_shader4;
- continue;
- }
-#endif
-#ifdef GL_NV_geometry_shader_passthrough
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader_passthrough", 27))
- {
- ret = GLEW_NV_geometry_shader_passthrough;
- continue;
- }
-#endif
-#ifdef GL_NV_gpu_program4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program4", 12))
- {
- ret = GLEW_NV_gpu_program4;
- continue;
- }
-#endif
-#ifdef GL_NV_gpu_program5
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program5", 12))
- {
- ret = GLEW_NV_gpu_program5;
- continue;
- }
-#endif
-#ifdef GL_NV_gpu_program5_mem_extended
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program5_mem_extended", 25))
- {
- ret = GLEW_NV_gpu_program5_mem_extended;
- continue;
- }
-#endif
-#ifdef GL_NV_gpu_program_fp64
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program_fp64", 16))
- {
- ret = GLEW_NV_gpu_program_fp64;
- continue;
- }
-#endif
-#ifdef GL_NV_gpu_shader5
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader5", 11))
- {
- ret = GLEW_NV_gpu_shader5;
- continue;
- }
-#endif
-#ifdef GL_NV_half_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float", 10))
- {
- ret = GLEW_NV_half_float;
- continue;
- }
-#endif
-#ifdef GL_NV_internalformat_sample_query
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_sample_query", 27))
- {
- ret = GLEW_NV_internalformat_sample_query;
- continue;
- }
-#endif
-#ifdef GL_NV_light_max_exponent
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"light_max_exponent", 18))
- {
- ret = GLEW_NV_light_max_exponent;
- continue;
- }
-#endif
-#ifdef GL_NV_multisample_coverage
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20))
- {
- ret = GLEW_NV_multisample_coverage;
- continue;
- }
-#endif
-#ifdef GL_NV_multisample_filter_hint
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_filter_hint", 23))
- {
- ret = GLEW_NV_multisample_filter_hint;
- continue;
- }
-#endif
-#ifdef GL_NV_occlusion_query
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query", 15))
- {
- ret = GLEW_NV_occlusion_query;
- continue;
- }
-#endif
-#ifdef GL_NV_packed_depth_stencil
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_depth_stencil", 20))
- {
- ret = GLEW_NV_packed_depth_stencil;
- continue;
- }
-#endif
-#ifdef GL_NV_parameter_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"parameter_buffer_object", 23))
- {
- ret = GLEW_NV_parameter_buffer_object;
- continue;
- }
-#endif
-#ifdef GL_NV_parameter_buffer_object2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"parameter_buffer_object2", 24))
- {
- ret = GLEW_NV_parameter_buffer_object2;
- continue;
- }
-#endif
-#ifdef GL_NV_path_rendering
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"path_rendering", 14))
- {
- ret = GLEW_NV_path_rendering;
- continue;
- }
-#endif
-#ifdef GL_NV_path_rendering_shared_edge
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"path_rendering_shared_edge", 26))
- {
- ret = GLEW_NV_path_rendering_shared_edge;
- continue;
- }
-#endif
-#ifdef GL_NV_pixel_data_range
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_data_range", 16))
- {
- ret = GLEW_NV_pixel_data_range;
- continue;
- }
-#endif
-#ifdef GL_NV_point_sprite
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprite", 12))
- {
- ret = GLEW_NV_point_sprite;
- continue;
- }
-#endif
-#ifdef GL_NV_present_video
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13))
- {
- ret = GLEW_NV_present_video;
- continue;
- }
-#endif
-#ifdef GL_NV_primitive_restart
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"primitive_restart", 17))
- {
- ret = GLEW_NV_primitive_restart;
- continue;
- }
-#endif
-#ifdef GL_NV_register_combiners
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"register_combiners", 18))
- {
- ret = GLEW_NV_register_combiners;
- continue;
- }
-#endif
-#ifdef GL_NV_register_combiners2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"register_combiners2", 19))
- {
- ret = GLEW_NV_register_combiners2;
- continue;
- }
-#endif
-#ifdef GL_NV_sample_locations
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_locations", 16))
- {
- ret = GLEW_NV_sample_locations;
- continue;
- }
-#endif
-#ifdef GL_NV_sample_mask_override_coverage
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_mask_override_coverage", 29))
- {
- ret = GLEW_NV_sample_mask_override_coverage;
- continue;
- }
-#endif
-#ifdef GL_NV_shader_atomic_counters
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counters", 22))
- {
- ret = GLEW_NV_shader_atomic_counters;
- continue;
- }
-#endif
-#ifdef GL_NV_shader_atomic_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_float", 19))
- {
- ret = GLEW_NV_shader_atomic_float;
- continue;
- }
-#endif
-#ifdef GL_NV_shader_atomic_fp16_vector
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_fp16_vector", 25))
- {
- ret = GLEW_NV_shader_atomic_fp16_vector;
- continue;
- }
-#endif
-#ifdef GL_NV_shader_atomic_int64
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_int64", 19))
- {
- ret = GLEW_NV_shader_atomic_int64;
- continue;
- }
-#endif
-#ifdef GL_NV_shader_buffer_load
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_buffer_load", 18))
- {
- ret = GLEW_NV_shader_buffer_load;
- continue;
- }
-#endif
-#ifdef GL_NV_shader_storage_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_storage_buffer_object", 28))
- {
- ret = GLEW_NV_shader_storage_buffer_object;
- continue;
- }
-#endif
-#ifdef GL_NV_shader_thread_group
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_thread_group", 19))
- {
- ret = GLEW_NV_shader_thread_group;
- continue;
- }
-#endif
-#ifdef GL_NV_shader_thread_shuffle
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_thread_shuffle", 21))
- {
- ret = GLEW_NV_shader_thread_shuffle;
- continue;
- }
-#endif
-#ifdef GL_NV_tessellation_program5
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"tessellation_program5", 21))
- {
- ret = GLEW_NV_tessellation_program5;
- continue;
- }
-#endif
-#ifdef GL_NV_texgen_emboss
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texgen_emboss", 13))
- {
- ret = GLEW_NV_texgen_emboss;
- continue;
- }
-#endif
-#ifdef GL_NV_texgen_reflection
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texgen_reflection", 17))
- {
- ret = GLEW_NV_texgen_reflection;
- continue;
- }
-#endif
-#ifdef GL_NV_texture_barrier
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_barrier", 15))
- {
- ret = GLEW_NV_texture_barrier;
- continue;
- }
-#endif
-#ifdef GL_NV_texture_compression_vtc
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_vtc", 23))
- {
- ret = GLEW_NV_texture_compression_vtc;
- continue;
- }
-#endif
-#ifdef GL_NV_texture_env_combine4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine4", 20))
- {
- ret = GLEW_NV_texture_env_combine4;
- continue;
- }
-#endif
-#ifdef GL_NV_texture_expand_normal
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_expand_normal", 21))
- {
- ret = GLEW_NV_texture_expand_normal;
- continue;
- }
-#endif
-#ifdef GL_NV_texture_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multisample", 19))
- {
- ret = GLEW_NV_texture_multisample;
- continue;
- }
-#endif
-#ifdef GL_NV_texture_rectangle
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17))
- {
- ret = GLEW_NV_texture_rectangle;
- continue;
- }
-#endif
-#ifdef GL_NV_texture_shader
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader", 14))
- {
- ret = GLEW_NV_texture_shader;
- continue;
- }
-#endif
-#ifdef GL_NV_texture_shader2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader2", 15))
- {
- ret = GLEW_NV_texture_shader2;
- continue;
- }
-#endif
-#ifdef GL_NV_texture_shader3
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader3", 15))
- {
- ret = GLEW_NV_texture_shader3;
- continue;
- }
-#endif
-#ifdef GL_NV_transform_feedback
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback", 18))
- {
- ret = GLEW_NV_transform_feedback;
- continue;
- }
-#endif
-#ifdef GL_NV_transform_feedback2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback2", 19))
- {
- ret = GLEW_NV_transform_feedback2;
- continue;
- }
-#endif
-#ifdef GL_NV_uniform_buffer_unified_memory
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"uniform_buffer_unified_memory", 29))
- {
- ret = GLEW_NV_uniform_buffer_unified_memory;
- continue;
- }
-#endif
-#ifdef GL_NV_vdpau_interop
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vdpau_interop", 13))
- {
- ret = GLEW_NV_vdpau_interop;
- continue;
- }
-#endif
-#ifdef GL_NV_vertex_array_range
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18))
- {
- ret = GLEW_NV_vertex_array_range;
- continue;
- }
-#endif
-#ifdef GL_NV_vertex_array_range2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range2", 19))
- {
- ret = GLEW_NV_vertex_array_range2;
- continue;
- }
-#endif
-#ifdef GL_NV_vertex_attrib_integer_64bit
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_integer_64bit", 27))
- {
- ret = GLEW_NV_vertex_attrib_integer_64bit;
- continue;
- }
-#endif
-#ifdef GL_NV_vertex_buffer_unified_memory
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_unified_memory", 28))
- {
- ret = GLEW_NV_vertex_buffer_unified_memory;
- continue;
- }
-#endif
-#ifdef GL_NV_vertex_program
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program", 14))
- {
- ret = GLEW_NV_vertex_program;
- continue;
- }
-#endif
-#ifdef GL_NV_vertex_program1_1
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program1_1", 17))
- {
- ret = GLEW_NV_vertex_program1_1;
- continue;
- }
-#endif
-#ifdef GL_NV_vertex_program2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program2", 15))
- {
- ret = GLEW_NV_vertex_program2;
- continue;
- }
-#endif
-#ifdef GL_NV_vertex_program2_option
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program2_option", 22))
- {
- ret = GLEW_NV_vertex_program2_option;
- continue;
- }
-#endif
-#ifdef GL_NV_vertex_program3
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program3", 15))
- {
- ret = GLEW_NV_vertex_program3;
- continue;
- }
-#endif
-#ifdef GL_NV_vertex_program4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program4", 15))
- {
- ret = GLEW_NV_vertex_program4;
- continue;
- }
-#endif
-#ifdef GL_NV_video_capture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13))
- {
- ret = GLEW_NV_video_capture;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"OES_", 4))
- {
-#ifdef GL_OES_byte_coordinates
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"byte_coordinates", 16))
- {
- ret = GLEW_OES_byte_coordinates;
- continue;
- }
-#endif
-#ifdef GL_OES_compressed_paletted_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"compressed_paletted_texture", 27))
- {
- ret = GLEW_OES_compressed_paletted_texture;
- continue;
- }
-#endif
-#ifdef GL_OES_read_format
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"read_format", 11))
- {
- ret = GLEW_OES_read_format;
- continue;
- }
-#endif
-#ifdef GL_OES_single_precision
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"single_precision", 16))
- {
- ret = GLEW_OES_single_precision;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4))
- {
-#ifdef GL_OML_interlace
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace", 9))
- {
- ret = GLEW_OML_interlace;
- continue;
- }
-#endif
-#ifdef GL_OML_resample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"resample", 8))
- {
- ret = GLEW_OML_resample;
- continue;
- }
-#endif
-#ifdef GL_OML_subsample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"subsample", 9))
- {
- ret = GLEW_OML_subsample;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"PGI_", 4))
- {
-#ifdef GL_PGI_misc_hints
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"misc_hints", 10))
- {
- ret = GLEW_PGI_misc_hints;
- continue;
- }
-#endif
-#ifdef GL_PGI_vertex_hints
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_hints", 12))
- {
- ret = GLEW_PGI_vertex_hints;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"REGAL_", 6))
- {
-#ifdef GL_REGAL_ES1_0_compatibility
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES1_0_compatibility", 19))
- {
- ret = GLEW_REGAL_ES1_0_compatibility;
- continue;
- }
-#endif
-#ifdef GL_REGAL_ES1_1_compatibility
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES1_1_compatibility", 19))
- {
- ret = GLEW_REGAL_ES1_1_compatibility;
- continue;
- }
-#endif
-#ifdef GL_REGAL_enable
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"enable", 6))
- {
- ret = GLEW_REGAL_enable;
- continue;
- }
-#endif
-#ifdef GL_REGAL_error_string
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"error_string", 12))
- {
- ret = GLEW_REGAL_error_string;
- continue;
- }
-#endif
-#ifdef GL_REGAL_extension_query
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"extension_query", 15))
- {
- ret = GLEW_REGAL_extension_query;
- continue;
- }
-#endif
-#ifdef GL_REGAL_log
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"log", 3))
- {
- ret = GLEW_REGAL_log;
- continue;
- }
-#endif
-#ifdef GL_REGAL_proc_address
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"proc_address", 12))
- {
- ret = GLEW_REGAL_proc_address;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"REND_", 5))
- {
-#ifdef GL_REND_screen_coordinates
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"screen_coordinates", 18))
- {
- ret = GLEW_REND_screen_coordinates;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"S3_", 3))
- {
-#ifdef GL_S3_s3tc
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"s3tc", 4))
- {
- ret = GLEW_S3_s3tc;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIS_", 5))
- {
-#ifdef GL_SGIS_color_range
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_range", 11))
- {
- ret = GLEW_SGIS_color_range;
- continue;
- }
-#endif
-#ifdef GL_SGIS_detail_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"detail_texture", 14))
- {
- ret = GLEW_SGIS_detail_texture;
- continue;
- }
-#endif
-#ifdef GL_SGIS_fog_function
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_function", 12))
- {
- ret = GLEW_SGIS_fog_function;
- continue;
- }
-#endif
-#ifdef GL_SGIS_generate_mipmap
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"generate_mipmap", 15))
- {
- ret = GLEW_SGIS_generate_mipmap;
- continue;
- }
-#endif
-#ifdef GL_SGIS_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11))
- {
- ret = GLEW_SGIS_multisample;
- continue;
- }
-#endif
-#ifdef GL_SGIS_pixel_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture", 13))
- {
- ret = GLEW_SGIS_pixel_texture;
- continue;
- }
-#endif
-#ifdef GL_SGIS_point_line_texgen
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_line_texgen", 17))
- {
- ret = GLEW_SGIS_point_line_texgen;
- continue;
- }
-#endif
-#ifdef GL_SGIS_sharpen_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sharpen_texture", 15))
- {
- ret = GLEW_SGIS_sharpen_texture;
- continue;
- }
-#endif
-#ifdef GL_SGIS_texture4D
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture4D", 9))
- {
- ret = GLEW_SGIS_texture4D;
- continue;
- }
-#endif
-#ifdef GL_SGIS_texture_border_clamp
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_border_clamp", 20))
- {
- ret = GLEW_SGIS_texture_border_clamp;
- continue;
- }
-#endif
-#ifdef GL_SGIS_texture_edge_clamp
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_edge_clamp", 18))
- {
- ret = GLEW_SGIS_texture_edge_clamp;
- continue;
- }
-#endif
-#ifdef GL_SGIS_texture_filter4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter4", 15))
- {
- ret = GLEW_SGIS_texture_filter4;
- continue;
- }
-#endif
-#ifdef GL_SGIS_texture_lod
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod", 11))
- {
- ret = GLEW_SGIS_texture_lod;
- continue;
- }
-#endif
-#ifdef GL_SGIS_texture_select
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_select", 14))
- {
- ret = GLEW_SGIS_texture_select;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIX_", 5))
- {
-#ifdef GL_SGIX_async
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"async", 5))
- {
- ret = GLEW_SGIX_async;
- continue;
- }
-#endif
-#ifdef GL_SGIX_async_histogram
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"async_histogram", 15))
- {
- ret = GLEW_SGIX_async_histogram;
- continue;
- }
-#endif
-#ifdef GL_SGIX_async_pixel
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"async_pixel", 11))
- {
- ret = GLEW_SGIX_async_pixel;
- continue;
- }
-#endif
-#ifdef GL_SGIX_blend_alpha_minmax
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_alpha_minmax", 18))
- {
- ret = GLEW_SGIX_blend_alpha_minmax;
- continue;
- }
-#endif
-#ifdef GL_SGIX_clipmap
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"clipmap", 7))
- {
- ret = GLEW_SGIX_clipmap;
- continue;
- }
-#endif
-#ifdef GL_SGIX_convolution_accuracy
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_accuracy", 20))
- {
- ret = GLEW_SGIX_convolution_accuracy;
- continue;
- }
-#endif
-#ifdef GL_SGIX_depth_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13))
- {
- ret = GLEW_SGIX_depth_texture;
- continue;
- }
-#endif
-#ifdef GL_SGIX_flush_raster
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"flush_raster", 12))
- {
- ret = GLEW_SGIX_flush_raster;
- continue;
- }
-#endif
-#ifdef GL_SGIX_fog_offset
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_offset", 10))
- {
- ret = GLEW_SGIX_fog_offset;
- continue;
- }
-#endif
-#ifdef GL_SGIX_fog_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_texture", 11))
- {
- ret = GLEW_SGIX_fog_texture;
- continue;
- }
-#endif
-#ifdef GL_SGIX_fragment_specular_lighting
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_specular_lighting", 26))
- {
- ret = GLEW_SGIX_fragment_specular_lighting;
- continue;
- }
-#endif
-#ifdef GL_SGIX_framezoom
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framezoom", 9))
- {
- ret = GLEW_SGIX_framezoom;
- continue;
- }
-#endif
-#ifdef GL_SGIX_interlace
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace", 9))
- {
- ret = GLEW_SGIX_interlace;
- continue;
- }
-#endif
-#ifdef GL_SGIX_ir_instrument1
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"ir_instrument1", 14))
- {
- ret = GLEW_SGIX_ir_instrument1;
- continue;
- }
-#endif
-#ifdef GL_SGIX_list_priority
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"list_priority", 13))
- {
- ret = GLEW_SGIX_list_priority;
- continue;
- }
-#endif
-#ifdef GL_SGIX_pixel_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture", 13))
- {
- ret = GLEW_SGIX_pixel_texture;
- continue;
- }
-#endif
-#ifdef GL_SGIX_pixel_texture_bits
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture_bits", 18))
- {
- ret = GLEW_SGIX_pixel_texture_bits;
- continue;
- }
-#endif
-#ifdef GL_SGIX_reference_plane
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"reference_plane", 15))
- {
- ret = GLEW_SGIX_reference_plane;
- continue;
- }
-#endif
-#ifdef GL_SGIX_resample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"resample", 8))
- {
- ret = GLEW_SGIX_resample;
- continue;
- }
-#endif
-#ifdef GL_SGIX_shadow
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow", 6))
- {
- ret = GLEW_SGIX_shadow;
- continue;
- }
-#endif
-#ifdef GL_SGIX_shadow_ambient
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_ambient", 14))
- {
- ret = GLEW_SGIX_shadow_ambient;
- continue;
- }
-#endif
-#ifdef GL_SGIX_sprite
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sprite", 6))
- {
- ret = GLEW_SGIX_sprite;
- continue;
- }
-#endif
-#ifdef GL_SGIX_tag_sample_buffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"tag_sample_buffer", 17))
- {
- ret = GLEW_SGIX_tag_sample_buffer;
- continue;
- }
-#endif
-#ifdef GL_SGIX_texture_add_env
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_add_env", 15))
- {
- ret = GLEW_SGIX_texture_add_env;
- continue;
- }
-#endif
-#ifdef GL_SGIX_texture_coordinate_clamp
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_coordinate_clamp", 24))
- {
- ret = GLEW_SGIX_texture_coordinate_clamp;
- continue;
- }
-#endif
-#ifdef GL_SGIX_texture_lod_bias
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod_bias", 16))
- {
- ret = GLEW_SGIX_texture_lod_bias;
- continue;
- }
-#endif
-#ifdef GL_SGIX_texture_multi_buffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multi_buffer", 20))
- {
- ret = GLEW_SGIX_texture_multi_buffer;
- continue;
- }
-#endif
-#ifdef GL_SGIX_texture_range
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_range", 13))
- {
- ret = GLEW_SGIX_texture_range;
- continue;
- }
-#endif
-#ifdef GL_SGIX_texture_scale_bias
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_scale_bias", 18))
- {
- ret = GLEW_SGIX_texture_scale_bias;
- continue;
- }
-#endif
-#ifdef GL_SGIX_vertex_preclip
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_preclip", 14))
- {
- ret = GLEW_SGIX_vertex_preclip;
- continue;
- }
-#endif
-#ifdef GL_SGIX_vertex_preclip_hint
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_preclip_hint", 19))
- {
- ret = GLEW_SGIX_vertex_preclip_hint;
- continue;
- }
-#endif
-#ifdef GL_SGIX_ycrcb
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycrcb", 5))
- {
- ret = GLEW_SGIX_ycrcb;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGI_", 4))
- {
-#ifdef GL_SGI_color_matrix
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_matrix", 12))
- {
- ret = GLEW_SGI_color_matrix;
- continue;
- }
-#endif
-#ifdef GL_SGI_color_table
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_table", 11))
- {
- ret = GLEW_SGI_color_table;
- continue;
- }
-#endif
-#ifdef GL_SGI_texture_color_table
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_color_table", 19))
- {
- ret = GLEW_SGI_texture_color_table;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUNX_", 5))
- {
-#ifdef GL_SUNX_constant_data
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"constant_data", 13))
- {
- ret = GLEW_SUNX_constant_data;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUN_", 4))
- {
-#ifdef GL_SUN_convolution_border_modes
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_border_modes", 24))
- {
- ret = GLEW_SUN_convolution_border_modes;
- continue;
- }
-#endif
-#ifdef GL_SUN_global_alpha
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"global_alpha", 12))
- {
- ret = GLEW_SUN_global_alpha;
- continue;
- }
-#endif
-#ifdef GL_SUN_mesh_array
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"mesh_array", 10))
- {
- ret = GLEW_SUN_mesh_array;
- continue;
- }
-#endif
-#ifdef GL_SUN_read_video_pixels
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"read_video_pixels", 17))
- {
- ret = GLEW_SUN_read_video_pixels;
- continue;
- }
-#endif
-#ifdef GL_SUN_slice_accum
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"slice_accum", 11))
- {
- ret = GLEW_SUN_slice_accum;
- continue;
- }
-#endif
-#ifdef GL_SUN_triangle_list
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"triangle_list", 13))
- {
- ret = GLEW_SUN_triangle_list;
- continue;
- }
-#endif
-#ifdef GL_SUN_vertex
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex", 6))
- {
- ret = GLEW_SUN_vertex;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"WIN_", 4))
- {
-#ifdef GL_WIN_phong_shading
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"phong_shading", 13))
- {
- ret = GLEW_WIN_phong_shading;
- continue;
- }
-#endif
-#ifdef GL_WIN_specular_fog
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"specular_fog", 12))
- {
- ret = GLEW_WIN_specular_fog;
- continue;
- }
-#endif
-#ifdef GL_WIN_swap_hint
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_hint", 9))
- {
- ret = GLEW_WIN_swap_hint;
- continue;
- }
-#endif
- }
- }
- ret = (len == 0);
- }
- return ret;
-}
-
-#if defined(_WIN32)
-
-#if defined(GLEW_MX)
-GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext* ctx, const char* name)
-#else
-GLboolean GLEWAPIENTRY wglewIsSupported (const char* name)
-#endif
-{
- GLubyte* pos = (GLubyte*)name;
- GLuint len = _glewStrLen(pos);
- GLboolean ret = GL_TRUE;
- while (ret && len > 0)
- {
- if (_glewStrSame1(&pos, &len, (const GLubyte*)"WGL_", 4))
- {
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5))
- {
-#ifdef WGL_3DFX_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11))
- {
- ret = WGLEW_3DFX_multisample;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DL_", 4))
- {
-#ifdef WGL_3DL_stereo_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"stereo_control", 14))
- {
- ret = WGLEW_3DL_stereo_control;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4))
- {
-#ifdef WGL_AMD_gpu_association
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_association", 15))
- {
- ret = WGLEW_AMD_gpu_association;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4))
- {
-#ifdef WGL_ARB_buffer_region
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_region", 13))
- {
- ret = WGLEW_ARB_buffer_region;
- continue;
- }
-#endif
-#ifdef WGL_ARB_context_flush_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"context_flush_control", 21))
- {
- ret = WGLEW_ARB_context_flush_control;
- continue;
- }
-#endif
-#ifdef WGL_ARB_create_context
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context", 14))
- {
- ret = WGLEW_ARB_create_context;
- continue;
- }
-#endif
-#ifdef WGL_ARB_create_context_profile
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_profile", 22))
- {
- ret = WGLEW_ARB_create_context_profile;
- continue;
- }
-#endif
-#ifdef WGL_ARB_create_context_robustness
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_robustness", 25))
- {
- ret = WGLEW_ARB_create_context_robustness;
- continue;
- }
-#endif
-#ifdef WGL_ARB_extensions_string
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"extensions_string", 17))
- {
- ret = WGLEW_ARB_extensions_string;
- continue;
- }
-#endif
-#ifdef WGL_ARB_framebuffer_sRGB
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16))
- {
- ret = WGLEW_ARB_framebuffer_sRGB;
- continue;
- }
-#endif
-#ifdef WGL_ARB_make_current_read
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17))
- {
- ret = WGLEW_ARB_make_current_read;
- continue;
- }
-#endif
-#ifdef WGL_ARB_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11))
- {
- ret = WGLEW_ARB_multisample;
- continue;
- }
-#endif
-#ifdef WGL_ARB_pbuffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7))
- {
- ret = WGLEW_ARB_pbuffer;
- continue;
- }
-#endif
-#ifdef WGL_ARB_pixel_format
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format", 12))
- {
- ret = WGLEW_ARB_pixel_format;
- continue;
- }
-#endif
-#ifdef WGL_ARB_pixel_format_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18))
- {
- ret = WGLEW_ARB_pixel_format_float;
- continue;
- }
-#endif
-#ifdef WGL_ARB_render_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture", 14))
- {
- ret = WGLEW_ARB_render_texture;
- continue;
- }
-#endif
-#ifdef WGL_ARB_robustness_application_isolation
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32))
- {
- ret = WGLEW_ARB_robustness_application_isolation;
- continue;
- }
-#endif
-#ifdef WGL_ARB_robustness_share_group_isolation
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32))
- {
- ret = WGLEW_ARB_robustness_share_group_isolation;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4))
- {
-#ifdef WGL_ATI_pixel_format_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18))
- {
- ret = WGLEW_ATI_pixel_format_float;
- continue;
- }
-#endif
-#ifdef WGL_ATI_render_texture_rectangle
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture_rectangle", 24))
- {
- ret = WGLEW_ATI_render_texture_rectangle;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4))
- {
-#ifdef WGL_EXT_create_context_es2_profile
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es2_profile", 26))
- {
- ret = WGLEW_EXT_create_context_es2_profile;
- continue;
- }
-#endif
-#ifdef WGL_EXT_create_context_es_profile
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es_profile", 25))
- {
- ret = WGLEW_EXT_create_context_es_profile;
- continue;
- }
-#endif
-#ifdef WGL_EXT_depth_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_float", 11))
- {
- ret = WGLEW_EXT_depth_float;
- continue;
- }
-#endif
-#ifdef WGL_EXT_display_color_table
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"display_color_table", 19))
- {
- ret = WGLEW_EXT_display_color_table;
- continue;
- }
-#endif
-#ifdef WGL_EXT_extensions_string
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"extensions_string", 17))
- {
- ret = WGLEW_EXT_extensions_string;
- continue;
- }
-#endif
-#ifdef WGL_EXT_framebuffer_sRGB
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16))
- {
- ret = WGLEW_EXT_framebuffer_sRGB;
- continue;
- }
-#endif
-#ifdef WGL_EXT_make_current_read
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17))
- {
- ret = WGLEW_EXT_make_current_read;
- continue;
- }
-#endif
-#ifdef WGL_EXT_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11))
- {
- ret = WGLEW_EXT_multisample;
- continue;
- }
-#endif
-#ifdef WGL_EXT_pbuffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7))
- {
- ret = WGLEW_EXT_pbuffer;
- continue;
- }
-#endif
-#ifdef WGL_EXT_pixel_format
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format", 12))
- {
- ret = WGLEW_EXT_pixel_format;
- continue;
- }
-#endif
-#ifdef WGL_EXT_pixel_format_packed_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_packed_float", 25))
- {
- ret = WGLEW_EXT_pixel_format_packed_float;
- continue;
- }
-#endif
-#ifdef WGL_EXT_swap_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12))
- {
- ret = WGLEW_EXT_swap_control;
- continue;
- }
-#endif
-#ifdef WGL_EXT_swap_control_tear
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control_tear", 17))
- {
- ret = WGLEW_EXT_swap_control_tear;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"I3D_", 4))
- {
-#ifdef WGL_I3D_digital_video_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"digital_video_control", 21))
- {
- ret = WGLEW_I3D_digital_video_control;
- continue;
- }
-#endif
-#ifdef WGL_I3D_gamma
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gamma", 5))
- {
- ret = WGLEW_I3D_gamma;
- continue;
- }
-#endif
-#ifdef WGL_I3D_genlock
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"genlock", 7))
- {
- ret = WGLEW_I3D_genlock;
- continue;
- }
-#endif
-#ifdef WGL_I3D_image_buffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_buffer", 12))
- {
- ret = WGLEW_I3D_image_buffer;
- continue;
- }
-#endif
-#ifdef WGL_I3D_swap_frame_lock
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_frame_lock", 15))
- {
- ret = WGLEW_I3D_swap_frame_lock;
- continue;
- }
-#endif
-#ifdef WGL_I3D_swap_frame_usage
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_frame_usage", 16))
- {
- ret = WGLEW_I3D_swap_frame_usage;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3))
- {
-#ifdef WGL_NV_DX_interop
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"DX_interop", 10))
- {
- ret = WGLEW_NV_DX_interop;
- continue;
- }
-#endif
-#ifdef WGL_NV_DX_interop2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"DX_interop2", 11))
- {
- ret = WGLEW_NV_DX_interop2;
- continue;
- }
-#endif
-#ifdef WGL_NV_copy_image
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10))
- {
- ret = WGLEW_NV_copy_image;
- continue;
- }
-#endif
-#ifdef WGL_NV_delay_before_swap
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"delay_before_swap", 17))
- {
- ret = WGLEW_NV_delay_before_swap;
- continue;
- }
-#endif
-#ifdef WGL_NV_float_buffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12))
- {
- ret = WGLEW_NV_float_buffer;
- continue;
- }
-#endif
-#ifdef WGL_NV_gpu_affinity
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_affinity", 12))
- {
- ret = WGLEW_NV_gpu_affinity;
- continue;
- }
-#endif
-#ifdef WGL_NV_multisample_coverage
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20))
- {
- ret = WGLEW_NV_multisample_coverage;
- continue;
- }
-#endif
-#ifdef WGL_NV_present_video
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13))
- {
- ret = WGLEW_NV_present_video;
- continue;
- }
-#endif
-#ifdef WGL_NV_render_depth_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_depth_texture", 20))
- {
- ret = WGLEW_NV_render_depth_texture;
- continue;
- }
-#endif
-#ifdef WGL_NV_render_texture_rectangle
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture_rectangle", 24))
- {
- ret = WGLEW_NV_render_texture_rectangle;
- continue;
- }
-#endif
-#ifdef WGL_NV_swap_group
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10))
- {
- ret = WGLEW_NV_swap_group;
- continue;
- }
-#endif
-#ifdef WGL_NV_vertex_array_range
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18))
- {
- ret = WGLEW_NV_vertex_array_range;
- continue;
- }
-#endif
-#ifdef WGL_NV_video_capture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13))
- {
- ret = WGLEW_NV_video_capture;
- continue;
- }
-#endif
-#ifdef WGL_NV_video_output
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_output", 12))
- {
- ret = WGLEW_NV_video_output;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4))
- {
-#ifdef WGL_OML_sync_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12))
- {
- ret = WGLEW_OML_sync_control;
- continue;
- }
-#endif
- }
- }
- ret = (len == 0);
- }
- return ret;
-}
-
-#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
-
-#if defined(GLEW_MX)
-GLboolean glxewContextIsSupported (const GLXEWContext* ctx, const char* name)
-#else
-GLboolean glxewIsSupported (const char* name)
-#endif
-{
- GLubyte* pos = (GLubyte*)name;
- GLuint len = _glewStrLen(pos);
- GLboolean ret = GL_TRUE;
- while (ret && len > 0)
- {
- if(_glewStrSame1(&pos, &len, (const GLubyte*)"GLX_", 4))
- {
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"VERSION_", 8))
- {
-#ifdef GLX_VERSION_1_2
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2", 3))
- {
- ret = GLXEW_VERSION_1_2;
- continue;
- }
-#endif
-#ifdef GLX_VERSION_1_3
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_3", 3))
- {
- ret = GLXEW_VERSION_1_3;
- continue;
- }
-#endif
-#ifdef GLX_VERSION_1_4
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_4", 3))
- {
- ret = GLXEW_VERSION_1_4;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5))
- {
-#ifdef GLX_3DFX_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11))
- {
- ret = GLXEW_3DFX_multisample;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4))
- {
-#ifdef GLX_AMD_gpu_association
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_association", 15))
- {
- ret = GLXEW_AMD_gpu_association;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4))
- {
-#ifdef GLX_ARB_context_flush_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"context_flush_control", 21))
- {
- ret = GLXEW_ARB_context_flush_control;
- continue;
- }
-#endif
-#ifdef GLX_ARB_create_context
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context", 14))
- {
- ret = GLXEW_ARB_create_context;
- continue;
- }
-#endif
-#ifdef GLX_ARB_create_context_profile
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_profile", 22))
- {
- ret = GLXEW_ARB_create_context_profile;
- continue;
- }
-#endif
-#ifdef GLX_ARB_create_context_robustness
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_robustness", 25))
- {
- ret = GLXEW_ARB_create_context_robustness;
- continue;
- }
-#endif
-#ifdef GLX_ARB_fbconfig_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig_float", 14))
- {
- ret = GLXEW_ARB_fbconfig_float;
- continue;
- }
-#endif
-#ifdef GLX_ARB_framebuffer_sRGB
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16))
- {
- ret = GLXEW_ARB_framebuffer_sRGB;
- continue;
- }
-#endif
-#ifdef GLX_ARB_get_proc_address
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_proc_address", 16))
- {
- ret = GLXEW_ARB_get_proc_address;
- continue;
- }
-#endif
-#ifdef GLX_ARB_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11))
- {
- ret = GLXEW_ARB_multisample;
- continue;
- }
-#endif
-#ifdef GLX_ARB_robustness_application_isolation
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32))
- {
- ret = GLXEW_ARB_robustness_application_isolation;
- continue;
- }
-#endif
-#ifdef GLX_ARB_robustness_share_group_isolation
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32))
- {
- ret = GLXEW_ARB_robustness_share_group_isolation;
- continue;
- }
-#endif
-#ifdef GLX_ARB_vertex_buffer_object
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_object", 20))
- {
- ret = GLXEW_ARB_vertex_buffer_object;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4))
- {
-#ifdef GLX_ATI_pixel_format_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18))
- {
- ret = GLXEW_ATI_pixel_format_float;
- continue;
- }
-#endif
-#ifdef GLX_ATI_render_texture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture", 14))
- {
- ret = GLXEW_ATI_render_texture;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4))
- {
-#ifdef GLX_EXT_buffer_age
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_age", 10))
- {
- ret = GLXEW_EXT_buffer_age;
- continue;
- }
-#endif
-#ifdef GLX_EXT_create_context_es2_profile
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es2_profile", 26))
- {
- ret = GLXEW_EXT_create_context_es2_profile;
- continue;
- }
-#endif
-#ifdef GLX_EXT_create_context_es_profile
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es_profile", 25))
- {
- ret = GLXEW_EXT_create_context_es_profile;
- continue;
- }
-#endif
-#ifdef GLX_EXT_fbconfig_packed_float
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig_packed_float", 21))
- {
- ret = GLXEW_EXT_fbconfig_packed_float;
- continue;
- }
-#endif
-#ifdef GLX_EXT_framebuffer_sRGB
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16))
- {
- ret = GLXEW_EXT_framebuffer_sRGB;
- continue;
- }
-#endif
-#ifdef GLX_EXT_import_context
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"import_context", 14))
- {
- ret = GLXEW_EXT_import_context;
- continue;
- }
-#endif
-#ifdef GLX_EXT_scene_marker
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"scene_marker", 12))
- {
- ret = GLXEW_EXT_scene_marker;
- continue;
- }
-#endif
-#ifdef GLX_EXT_stereo_tree
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"stereo_tree", 11))
- {
- ret = GLXEW_EXT_stereo_tree;
- continue;
- }
-#endif
-#ifdef GLX_EXT_swap_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12))
- {
- ret = GLXEW_EXT_swap_control;
- continue;
- }
-#endif
-#ifdef GLX_EXT_swap_control_tear
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control_tear", 17))
- {
- ret = GLXEW_EXT_swap_control_tear;
- continue;
- }
-#endif
-#ifdef GLX_EXT_texture_from_pixmap
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_from_pixmap", 19))
- {
- ret = GLXEW_EXT_texture_from_pixmap;
- continue;
- }
-#endif
-#ifdef GLX_EXT_visual_info
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_info", 11))
- {
- ret = GLXEW_EXT_visual_info;
- continue;
- }
-#endif
-#ifdef GLX_EXT_visual_rating
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_rating", 13))
- {
- ret = GLXEW_EXT_visual_rating;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"INTEL_", 6))
- {
-#ifdef GLX_INTEL_swap_event
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_event", 10))
- {
- ret = GLXEW_INTEL_swap_event;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5))
- {
-#ifdef GLX_MESA_agp_offset
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"agp_offset", 10))
- {
- ret = GLXEW_MESA_agp_offset;
- continue;
- }
-#endif
-#ifdef GLX_MESA_copy_sub_buffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_sub_buffer", 15))
- {
- ret = GLXEW_MESA_copy_sub_buffer;
- continue;
- }
-#endif
-#ifdef GLX_MESA_pixmap_colormap
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixmap_colormap", 15))
- {
- ret = GLXEW_MESA_pixmap_colormap;
- continue;
- }
-#endif
-#ifdef GLX_MESA_query_renderer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_renderer", 14))
- {
- ret = GLXEW_MESA_query_renderer;
- continue;
- }
-#endif
-#ifdef GLX_MESA_release_buffers
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"release_buffers", 15))
- {
- ret = GLXEW_MESA_release_buffers;
- continue;
- }
-#endif
-#ifdef GLX_MESA_set_3dfx_mode
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"set_3dfx_mode", 13))
- {
- ret = GLXEW_MESA_set_3dfx_mode;
- continue;
- }
-#endif
-#ifdef GLX_MESA_swap_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12))
- {
- ret = GLXEW_MESA_swap_control;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3))
- {
-#ifdef GLX_NV_copy_buffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_buffer", 11))
- {
- ret = GLXEW_NV_copy_buffer;
- continue;
- }
-#endif
-#ifdef GLX_NV_copy_image
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10))
- {
- ret = GLXEW_NV_copy_image;
- continue;
- }
-#endif
-#ifdef GLX_NV_delay_before_swap
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"delay_before_swap", 17))
- {
- ret = GLXEW_NV_delay_before_swap;
- continue;
- }
-#endif
-#ifdef GLX_NV_float_buffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12))
- {
- ret = GLXEW_NV_float_buffer;
- continue;
- }
-#endif
-#ifdef GLX_NV_multisample_coverage
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20))
- {
- ret = GLXEW_NV_multisample_coverage;
- continue;
- }
-#endif
-#ifdef GLX_NV_present_video
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13))
- {
- ret = GLXEW_NV_present_video;
- continue;
- }
-#endif
-#ifdef GLX_NV_swap_group
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10))
- {
- ret = GLXEW_NV_swap_group;
- continue;
- }
-#endif
-#ifdef GLX_NV_vertex_array_range
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18))
- {
- ret = GLXEW_NV_vertex_array_range;
- continue;
- }
-#endif
-#ifdef GLX_NV_video_capture
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13))
- {
- ret = GLXEW_NV_video_capture;
- continue;
- }
-#endif
-#ifdef GLX_NV_video_out
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_out", 9))
- {
- ret = GLXEW_NV_video_out;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4))
- {
-#ifdef GLX_OML_swap_method
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_method", 11))
- {
- ret = GLXEW_OML_swap_method;
- continue;
- }
-#endif
-#ifdef GLX_OML_sync_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12))
- {
- ret = GLXEW_OML_sync_control;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIS_", 5))
- {
-#ifdef GLX_SGIS_blended_overlay
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"blended_overlay", 15))
- {
- ret = GLXEW_SGIS_blended_overlay;
- continue;
- }
-#endif
-#ifdef GLX_SGIS_color_range
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_range", 11))
- {
- ret = GLXEW_SGIS_color_range;
- continue;
- }
-#endif
-#ifdef GLX_SGIS_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11))
- {
- ret = GLXEW_SGIS_multisample;
- continue;
- }
-#endif
-#ifdef GLX_SGIS_shared_multisample
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"shared_multisample", 18))
- {
- ret = GLXEW_SGIS_shared_multisample;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIX_", 5))
- {
-#ifdef GLX_SGIX_fbconfig
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig", 8))
- {
- ret = GLXEW_SGIX_fbconfig;
- continue;
- }
-#endif
-#ifdef GLX_SGIX_hyperpipe
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"hyperpipe", 9))
- {
- ret = GLXEW_SGIX_hyperpipe;
- continue;
- }
-#endif
-#ifdef GLX_SGIX_pbuffer
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7))
- {
- ret = GLXEW_SGIX_pbuffer;
- continue;
- }
-#endif
-#ifdef GLX_SGIX_swap_barrier
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_barrier", 12))
- {
- ret = GLXEW_SGIX_swap_barrier;
- continue;
- }
-#endif
-#ifdef GLX_SGIX_swap_group
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10))
- {
- ret = GLXEW_SGIX_swap_group;
- continue;
- }
-#endif
-#ifdef GLX_SGIX_video_resize
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_resize", 12))
- {
- ret = GLXEW_SGIX_video_resize;
- continue;
- }
-#endif
-#ifdef GLX_SGIX_visual_select_group
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_select_group", 19))
- {
- ret = GLXEW_SGIX_visual_select_group;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGI_", 4))
- {
-#ifdef GLX_SGI_cushion
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"cushion", 7))
- {
- ret = GLXEW_SGI_cushion;
- continue;
- }
-#endif
-#ifdef GLX_SGI_make_current_read
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17))
- {
- ret = GLXEW_SGI_make_current_read;
- continue;
- }
-#endif
-#ifdef GLX_SGI_swap_control
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12))
- {
- ret = GLXEW_SGI_swap_control;
- continue;
- }
-#endif
-#ifdef GLX_SGI_video_sync
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_sync", 10))
- {
- ret = GLXEW_SGI_video_sync;
- continue;
- }
-#endif
- }
- if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUN_", 4))
- {
-#ifdef GLX_SUN_get_transparent_index
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_transparent_index", 21))
- {
- ret = GLXEW_SUN_get_transparent_index;
- continue;
- }
-#endif
-#ifdef GLX_SUN_video_resize
- if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_resize", 12))
- {
- ret = GLXEW_SUN_video_resize;
- continue;
- }
-#endif
- }
- }
- ret = (len == 0);
- }
- return ret;
-}
-
-#endif /* _WIN32 */
diff --git a/Libraries/macogg/include/ogg/config_types.h b/Libraries/macogg/include/ogg/config_types.h
index 298226fe..c02ab7c5 100644
--- a/Libraries/macogg/include/ogg/config_types.h
+++ b/Libraries/macogg/include/ogg/config_types.h
@@ -1,6 +1,7 @@
#ifndef __CONFIG_TYPES_H__
#define __CONFIG_TYPES_H__
+#include <Compat/platform.h>
#if PLATFORM_UNIX
#include <stdint.h>
#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/CMakeLists.txt b/Libraries/nvidia-texture-tools-read-only/CMakeLists.txt
deleted file mode 100644
index 5bd9eafc..00000000
--- a/Libraries/nvidia-texture-tools-read-only/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
-PROJECT(NV)
-
-SET(NV_CMAKE_DIR "${NV_SOURCE_DIR}/cmake")
-SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${NV_CMAKE_DIR}")
-
-IF(WIN32)
- SET(GNUWIN32 "${NV_SOURCE_DIR}/extern/gnuwin32")
- SET(CMAKE_INCLUDE_PATH "${GNUWIN32}/include")
- SET(CMAKE_LIBRARY_PATH "${GNUWIN32}/lib")
-
- SET(GLUT_ROOT_PATH "${NV_SOURCE_DIR}/extern/glut")
-ENDIF(WIN32)
-
-INCLUDE(${NV_CMAKE_DIR}/OptimalOptions.cmake)
-MESSAGE(STATUS "Setting optimal options")
-MESSAGE(STATUS " Processor: ${NV_SYSTEM_PROCESSOR}")
-MESSAGE(STATUS " Compiler Flags: ${CMAKE_CXX_FLAGS}")
-
-IF(NVTT_SHARED)
- SET(NVCORE_SHARED TRUE)
- SET(NVMATH_SHARED TRUE)
- SET(NVIMAGE_SHARED TRUE)
-ENDIF(NVTT_SHARED)
-
-
-ADD_SUBDIRECTORY(src)
-
-IF(WIN32)
- ADD_SUBDIRECTORY(extern/gnuwin32)
-ENDIF(WIN32)
diff --git a/Libraries/nvidia-texture-tools-read-only/ChangeLog b/Libraries/nvidia-texture-tools-read-only/ChangeLog
deleted file mode 100644
index 67ffa2fb..00000000
--- a/Libraries/nvidia-texture-tools-read-only/ChangeLog
+++ /dev/null
@@ -1,86 +0,0 @@
-NVIDIA Texture Tools version 2.1.0
- * CTX1 CUDA compressor.
- * DXT1n CUDA compressor.
- * Support alpha premultiplication by Charles Nicholson. See issue 30.
- * Improved decompressor tool submitted by Amorilia. See issue 41.
- * Add support for YCoCg color transform. Fixes issue 18.
- * Add support for linear and swizzle transforms. Fixes issue 4.
- * Fix loading of EXR files using OpenEXR.
- * Use FreeImage as primary image loading library. Fixes issue 31. Reverted.
- * Output swizzle codes like AMD's tools.
- * Select the fastest CUDA device.
-
-NVIDIA Texture Tools version 2.0.4
- * Fix error in RGB format output; reported by jonsoh. See issue 49.
- * Added support RGB format dithering by jonsoh. Fixes issue 50 and 51.
- * Prevent infinite loop in indexMirror when width equal 1. Fixes issue 65.
- * Implement general scale filter, including upsampling.
-
-NVIDIA Texture Tools version 2.0.3
- * More accurate DXT3 compressor. Fixes issue 38.
- * Remove legacy compressors. Fix issue 34.
- * Check for single color in all compressors. Fixes issue 43.
- * Fix error in fast downsample filter, reported by Noel Llopis.
-
-NVIDIA Texture Tools version 2.0.2
- * Fix copy ctor error reported by Richard Sim.
- * Fix indexMirror error reported by Chris Lambert.
- * Fix vc8 post build command, reported by Richard Sim.
- * Fix RGBA modes with less than 32 bpp by Viktor Linder.
- * Fix alpha decompression by Amorilia. See issue 40.
- * Avoid default-initialized constructors for POD types, reported by Jim Tilander.
- * Add single color compresor for DXT1a.
- * Set swizzle code to ATI2 files. See issue 41.
-
-NVIDIA Texture Tools version 2.0.1
- * Fix memory leaks.
- * Pre-allocate device memory for CUDA compressor.
- * Add single color compressor. Thanks to Amir Ebrahimi.
- * Better CUDA error checking.
-
-NVIDIA Texture Tools version 2.0.0
- * Fixed PSNR formula in nvimgdiff.
- * Added support for arbitrary RGB formats.
- * Add support for DXT1a. Solves issue 1.
- * Refactor and improve compression quality of fast compressors.
- * Add cmake scripts to detect processor and chose compiler options.
- * Fix normal map decompression.
- * Evaluate angular deviation error for normal maps in nvimgdiff.
- * Fix DXT1 compression with custom color metrics.
- * Fix error in normal map generation from heightmap mipmaps.
- * Fix errors in estimateSize.
- * Fix errors when maxLevel is used.
- * Enable the use of BC5 not just for normal maps.
- * Add mirror wrapping mode, use by default.
- * Implement polyphase filters. Solves issue 3.
- * Add box and triangle filter sampling.
- * Refactor nvtt public interface.
- * Add resizing input options (setMaxExtents, setRoundMode). Solves issue 12.
- * Plain C and C# wrappers. Solves issue 22.
-
-NVIDIA Texture Tools version 0.9.4
- * Added support for input DDS files, including cube maps.
- * Added support for input PSD files.
- * Added nvdecompress tool.
- * Added nvimgdiff tool.
- * Added nvddsinfo tool.
- * CUDA compressor 22% faster.
- * DXT3 & DXT5 CUDA compressors.
- * Faster DXT5n CPU compressor.
- * Many bug fixes.
-
-NVIDIA Texture Tools version 0.9.3
- * Fix non power of two textures.
- * Fix estimateSize with rgb format.
- * Fix error in cuda compressor block limit.
-
-NVIDIA Texture Tools version 0.9.2
- * Improved alpha compression.
- * Improved fast DXT1 compression.
- * Documentation and release notes.
-
-NVIDIA Texture Tools version 0.9.1
- * Bug fix release.
-
-NVIDIA Texture Tools version 0.9.0
- * Private beta prerelease.
diff --git a/Libraries/nvidia-texture-tools-read-only/NVIDIA_Texture_Tools_LICENSE.txt b/Libraries/nvidia-texture-tools-read-only/NVIDIA_Texture_Tools_LICENSE.txt
deleted file mode 100644
index da5b6421..00000000
--- a/Libraries/nvidia-texture-tools-read-only/NVIDIA_Texture_Tools_LICENSE.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-NVIDIA Texture Tools 2.0 is licensed under the MIT license.
-
-Copyright (c) 2007 NVIDIA Corporation
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/Libraries/nvidia-texture-tools-read-only/NVIDIA_Texture_Tools_README.txt b/Libraries/nvidia-texture-tools-read-only/NVIDIA_Texture_Tools_README.txt
deleted file mode 100644
index f544a140..00000000
--- a/Libraries/nvidia-texture-tools-read-only/NVIDIA_Texture_Tools_README.txt
+++ /dev/null
@@ -1,167 +0,0 @@
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-NVIDIA Texture Tools
-README.txt
-Version 2.1
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
-TABLE OF CONTENTS
---------------------------------------------------------------------------------
-I. Instructions
-II. Contents
-III. Compilation Instructions
-IV. Using NVIDIA Texture Tools in your own applications
-V. Known Issues
-VI. Frequently Asked Questions
---------------------------------------------------------------------------------
-
-I. Introduction
---------------------------------------------------------------------------------
-
-This is our first alpha release of our new Texture Tools. The main highlights of
-this release are support for all DX10 texture formats, higher speed and improved
-compression quality.
-
-In addition to that it also comes with a hardware accelerated compressor that
-uses CUDA to compress blocks in parallel on the GPU and runs around 10 times
-faster than the CPU counterpart.
-
-You can obtain CUDA from our developer site at:
-
-http://developer.nvidia.com/object/cuda.html
-
-The source code of the Texture Tools is being released under the terms of
-the MIT license.
-
-
-II. Contents
---------------------------------------------------------------------------------
-
-This release contains only the source code of the texture compression library
-and an example commandline application that shows its use.
-
-
-III. Compilation Instructions
---------------------------------------------------------------------------------
-
-The compression library and the example can be compiled with Visual Studio 8 on
-Windows using the following solution file:
-
-project\vc8\nvtt.sln
-
-On most other platforms you can also use cmake. For more information about
-cmake, visit:
-
-http://www.cmake.org/
-
-On unix systems you can use the standard build procedure (assuming cmake is
-installed on your system):
-
-$ ./configure
-$ make
-$ sudo make install
-
-
-IV. Using NVIDIA Texture Tools
---------------------------------------------------------------------------------
-
-To use the NVIDIA Texture Tools in your own applications you just have to
-include the following header file:
-
-src/nvimage/nvtt/nvtt.h
-
-And include the nvtt library in your projects.
-
-The following file contains a simple example that shows how to use the library:
-
-src/nvimage/nvtt/compress.cpp
-
-The usage of the commandline tool is the following:
-
-$ nvcompress [options] infile [outfile]
-
-where 'infile' is and TGA, PNG, PSD, DDS or JPG file, 'outfile' is a DDS file
-and 'options' is one or more of the following:
-
-Input options:
- -color The input image is a color map (default).
- -normal The input image is a normal map.
- -tonormal Convert input to normal map.
- -clamp Clamp wrapping mode (default).
- -repeat Repeat wrapping mode.
- -nomips Disable mipmap generation.
-
-Compression options:
- -fast Fast compression.
- -nocuda Do not use cuda compressor.
- -rgb RGBA format
- -bc1 BC1 format (DXT1)
- -bc2 BC2 format (DXT3)
- -bc3 BC3 format (DXT5)
- -bc3n BC3 normal map format (DXT5n/RXGB)
- -bc4 BC4 format (ATI1)
- -bc5 BC5 format (3Dc/ATI2)
-
-In order to run the compiled example on a PC that doesn't have Microsoft Visual
-Studio 2003 installed, you will have to install the Microsoft Visual Studio 2003
-redistributable package that you can download at:
-
-http://go.microsoft.com/fwlink/?linkid=65127&clcid=0x409
-
-
-V. Known Issues
---------------------------------------------------------------------------------
-
-None so far. Please send suggestions and bug reports to:
-
-TextureTools@nvidia.com
-
-or report them at:
-
-http://code.google.com/p/nvidia-texture-tools/issues/list
-
-
-VI. Frequently Asked Questions
---------------------------------------------------------------------------------
-
-- Do the NVIDIA Texture Tools work on OSX?
-It currently compiles and runs properly, but it has not been tested extensively.
-In particular there may be endiannes errors in the code.
-
-
-- Do the NVIDIA Texture Tools work on Linux?
-Yes.
-
-
-- Do the NVIDIA Texture Tools work on Vista?
-Yes, but note that CUDA is not supported on Vista yet, so the tool is not hardware
-accelerated.
-
-
-- Is CUDA required?
-No. The Visual Studio solution file contains a configuration that allows you
-to compile the texture tools without CUDA support. The cmake scripts automatically
-detect the CUDA installation and use it only when available.
-
-
-- Where can I get CUDA?
-http://developer.nvidia.com/object/cuda.html
-
-
-- Why is feature XYZ not supported?
-In order to keep the code small and reduce maintenance costs we have limited the
-features available in our new texture tools. We also have open sourced the code, so
-that people can modify it and add their own favourite features.
-
-
-- Can I use the NVIDIA Texture Tools in my commercial application?
-Yes, the NVIDIA Texture Tools are licensed under the MIT license.
-
-
-- Can I use the NVIDIA Texture Tools in my GPL application?
-Yes, the MIT license is compatible with the GPL and LGPL licenses.
-
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/VERSION b/Libraries/nvidia-texture-tools-read-only/VERSION
deleted file mode 100644
index 7ec1d6db..00000000
--- a/Libraries/nvidia-texture-tools-read-only/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-2.1.0
diff --git a/Libraries/nvidia-texture-tools-read-only/bin/nvcompress.exe b/Libraries/nvidia-texture-tools-read-only/bin/nvcompress.exe
deleted file mode 100644
index 442d552c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/bin/nvcompress.exe
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/bin/nvtt.dll b/Libraries/nvidia-texture-tools-read-only/bin/nvtt.dll
deleted file mode 100644
index 68f55cd0..00000000
--- a/Libraries/nvidia-texture-tools-read-only/bin/nvtt.dll
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/buildpkg b/Libraries/nvidia-texture-tools-read-only/buildpkg
deleted file mode 100644
index 1622f8b0..00000000
--- a/Libraries/nvidia-texture-tools-read-only/buildpkg
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-tar zcvf nvidia-texture-tools-`cat VERSION`.tar.gz \
- --exclude '.*' --exclude debian --exclude '*~' --exclude buildpkg \
- --exclude build --exclude data --exclude tags --exclude Makefile \
- --exclude 'nvidia-texture-tools-*.tar.gz' \
- --transform 's,^,nvidia-texture-tools/,' *
diff --git a/Libraries/nvidia-texture-tools-read-only/cmake/DetermineProcessor.cmake b/Libraries/nvidia-texture-tools-read-only/cmake/DetermineProcessor.cmake
deleted file mode 100644
index 092464d9..00000000
--- a/Libraries/nvidia-texture-tools-read-only/cmake/DetermineProcessor.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-
-# Assume i586 by default.
-SET(NV_SYSTEM_PROCESSOR "i586")
-
-IF(UNIX)
- FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
- IF(CMAKE_UNAME)
- EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE NV_SYSTEM_PROCESSOR RETURN_VALUE val)
-
- IF("${val}" GREATER 0 OR NV_SYSTEM_PROCESSOR STREQUAL "unknown")
- EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE NV_SYSTEM_PROCESSOR RETURN_VALUE val)
- ENDIF("${val}" GREATER 0 OR NV_SYSTEM_PROCESSOR STREQUAL "unknown")
-
- # processor may have double quote in the name, and that needs to be removed
- STRING(REGEX REPLACE "\"" "" NV_SYSTEM_PROCESSOR "${NV_SYSTEM_PROCESSOR}")
- STRING(REGEX REPLACE "/" "_" NV_SYSTEM_PROCESSOR "${NV_SYSTEM_PROCESSOR}")
- ENDIF(CMAKE_UNAME)
-
- # Get extended processor information with:
- # `cat /proc/cpuinfo`
-
-ELSE(UNIX)
- IF(WIN32)
- # It's not OK to trust $ENV{PROCESSOR_ARCHITECTURE}: its value depends on the type of executable being run,
- # so a 32-bit cmake (the default binary distribution) will always say "x86" regardless of the actual target.
- IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
- SET (NV_SYSTEM_PROCESSOR "AMD64")
- ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
- SET (NV_SYSTEM_PROCESSOR "x86")
- ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
- ENDIF(WIN32)
-ENDIF(UNIX)
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/cmake/FindCUDA.cmake b/Libraries/nvidia-texture-tools-read-only/cmake/FindCUDA.cmake
deleted file mode 100644
index 9e5cdba5..00000000
--- a/Libraries/nvidia-texture-tools-read-only/cmake/FindCUDA.cmake
+++ /dev/null
@@ -1,164 +0,0 @@
-#
-# Try to find CUDA compiler, runtime libraries, and include path.
-# Once done this will define
-#
-# CUDA_FOUND
-# CUDA_INCLUDE_PATH
-# CUDA_RUNTIME_LIBRARY
-# CUDA_COMPILER
-#
-# It will also define the following macro:
-#
-# WRAP_CUDA
-#
-
-IF (WIN32)
- FIND_PROGRAM (CUDA_COMPILER nvcc.exe
- $ENV{CUDA_BIN_PATH}
- DOC "The CUDA Compiler")
-ELSE(WIN32)
- FIND_PROGRAM (CUDA_COMPILER nvcc
- $ENV{CUDA_BIN_PATH}
- /usr/local/cuda/bin
- DOC "The CUDA Compiler")
-ENDIF(WIN32)
-
-IF (CUDA_COMPILER)
- GET_FILENAME_COMPONENT (CUDA_COMPILER_DIR ${CUDA_COMPILER} PATH)
- GET_FILENAME_COMPONENT (CUDA_COMPILER_SUPER_DIR ${CUDA_COMPILER_DIR} PATH)
-ELSE (CUDA_COMPILER)
- SET (CUDA_COMPILER_DIR .)
- SET (CUDA_COMPILER_SUPER_DIR ..)
-ENDIF (CUDA_COMPILER)
-
-FIND_PATH (CUDA_INCLUDE_PATH cuda_runtime.h
- $ENV{CUDA_INC_PATH}
- ${CUDA_COMPILER_SUPER_DIR}/include
- DOC "The directory where CUDA headers reside")
-
-FIND_PATH (CUTIL_INCLUDE_PATH cutil.h
- "$ENV{NVSDKCUDA_ROOT}/common/inc"
- "$ENV{PROGRAMFILES}/NVIDIA Corporation/NVIDIA CUDA SDK/common/inc"
- DOC "The directory where the CUTIL headers reside")
-
-FIND_LIBRARY (CUDA_RUNTIME_LIBRARY
- NAMES cudart
- PATHS
- $ENV{CUDA_LIB_PATH}
- ${CUDA_COMPILER_SUPER_DIR}/lib
- ${CUDA_COMPILER_DIR}
- DOC "The CUDA runtime library")
-
-FIND_LIBRARY (CUTIL_LIBRARY
- NAMES cutil32 cutil64
- PATHS
- "$ENV{NVSDKCUDA_ROOT}/common/lib"
- "$ENV{PROGRAMFILES}/NVIDIA Corporation/NVIDIA CUDA SDK/common/lib"
- DOC "The CUTIL library")
-
-IF (CUDA_INCLUDE_PATH AND CUDA_RUNTIME_LIBRARY)
- SET (CUDA_FOUND TRUE)
-ELSE (CUDA_INCLUDE_PATH AND CUDA_RUNTIME_LIBRARY)
- SET (CUDA_FOUND FALSE)
-ENDIF (CUDA_INCLUDE_PATH AND CUDA_RUNTIME_LIBRARY)
-
-SET (CUDA_LIBRARIES ${CUDA_RUNTIME_LIBRARY})
-
-MARK_AS_ADVANCED (CUDA_FOUND CUDA_COMPILER CUDA_RUNTIME_LIBRARY)
-
-
-IF (CUTIL_INCLUDE_PATH AND CUTIL_LIBRARY)
- SET (CUTIL_FOUND 1 CACHE STRING "Set to 1 if CUDA is found, 0 otherwise")
-ELSE (CUTIL_INCLUDE_PATH AND CUTIL_LIBRARY)
- SET (CUTIL_FOUND 0 CACHE STRING "Set to 1 if CUDA is found, 0 otherwise")
-ENDIF (CUTIL_INCLUDE_PATH AND CUTIL_LIBRARY)
-
-SET (CUTIL_LIBRARIES ${CUTIL_LIBRARY})
-
-MARK_AS_ADVANCED (CUTIL_FOUND)
-
-
-#SET(CUDA_OPTIONS "-ncfe")
-SET(CUDA_OPTIONS "--host-compilation=C++")
-
-IF (CUDA_EMULATION)
- SET (CUDA_OPTIONS "${CUDA_OPTIONS} -deviceemu")
-ENDIF (CUDA_EMULATION)
-
-
-# Get include directories.
-MACRO(GET_CUDA_INC_DIRS _cuda_INC_DIRS)
- SET(${_cuda_INC_DIRS})
- GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
-
- FOREACH(_current ${_inc_DIRS})
- SET(${_cuda_INC_DIRS} ${${_cuda_INC_DIRS}} "-I" ${_current})
- ENDFOREACH(_current ${_inc_DIRS})
-
- SET(${_cuda_INC_DIRS} ${${_cuda_INC_DIRS}} "-I" ${CUDA_INCLUDE_PATH})
-
-# IF (CMAKE_SYTEM_INCLUDE_PATH)
-# SET(${_cuda_INC_DIRS} ${${_cuda_INC_DIRS}} "-I" ${CMAKE_SYSTEM_INCLUDE_PATH})
-# ENDIF (CMAKE_SYTEM_INCLUDE_PATH)
-# IF (CMAKE_INCLUDE_PATH)
-# SET(${_cuda_INC_DIRS} ${${_cuda_INC_DIRS}} "-I" ${CMAKE_INCLUDE_PATH})
-# ENDIF (CMAKE_INCLUDE_PATH)
-
-ENDMACRO(GET_CUDA_INC_DIRS)
-
-
-# Get file dependencies.
-MACRO (GET_CUFILE_DEPENDENCIES dependencies file)
- GET_FILENAME_COMPONENT(filepath ${file} PATH)
-
- # parse file for dependencies
- FILE(READ "${file}" CONTENTS)
- #STRING(REGEX MATCHALL "#[ \t]*include[ \t]+[<\"][^>\"]*" DEPS "${CONTENTS}")
- STRING(REGEX MATCHALL "#[ \t]*include[ \t]+\"[^\"]*" DEPS "${CONTENTS}")
-
- SET(${dependencies})
-
- FOREACH(DEP ${DEPS})
- STRING(REGEX REPLACE "#[ \t]*include[ \t]+\"" "" DEP "${DEP}")
-
- FIND_PATH(PATH_OF_${DEP} ${DEP}
- ${filepath})
-
- IF(NOT ${PATH_OF_${DEP}} STREQUAL PATH_OF_${DEP}-NOTFOUND)
- #MESSAGE("${file} : ${PATH_OF_${DEP}}/${DEP}")
- SET(${dependencies} ${${dependencies}} ${PATH_OF_${DEP}}/${DEP})
- ENDIF(NOT ${PATH_OF_${DEP}} STREQUAL PATH_OF_${DEP}-NOTFOUND)
-
- ENDFOREACH(DEP)
-
-ENDMACRO (GET_CUFILE_DEPENDENCIES)
-
-
-# WRAP_CUDA(outfile ...)
-MACRO (WRAP_CUDA outfiles)
- GET_CUDA_INC_DIRS(cuda_includes)
- #MESSAGE(${cuda_includes})
-
- FOREACH (CUFILE ${ARGN})
- GET_FILENAME_COMPONENT (CUFILE ${CUFILE} ABSOLUTE)
- GET_FILENAME_COMPONENT (CPPFILE ${CUFILE} NAME_WE)
- SET (CPPFILE ${CMAKE_CURRENT_BINARY_DIR}/${CPPFILE}.gen.cpp)
-
- GET_CUFILE_DEPENDENCIES(CUDEPS ${CUFILE})
- #MESSAGE("${CUDEPS}")
-
- ADD_CUSTOM_COMMAND (
- OUTPUT ${CPPFILE}
- COMMAND ${CUDA_COMPILER}
- ARGS -cuda ${cuda_includes} ${CUDA_OPTIONS} -o ${CPPFILE} ${CUFILE}
- MAIN_DEPENDENCY ${CUFILE}
- DEPENDS ${CUDEPS})
-
- #MACRO_ADD_FILE_DEPENDENCIES(${CUFILE} ${CPPFILE})
-
- SET (${outfiles} ${${outfiles}} ${CPPFILE})
- ENDFOREACH (CUFILE)
-
- SET_SOURCE_FILES_PROPERTIES(${outfiles} PROPERTIES GENERATED 1)
-
-ENDMACRO (WRAP_CUDA)
diff --git a/Libraries/nvidia-texture-tools-read-only/cmake/FindCg.cmake b/Libraries/nvidia-texture-tools-read-only/cmake/FindCg.cmake
deleted file mode 100644
index 4d4fc3db..00000000
--- a/Libraries/nvidia-texture-tools-read-only/cmake/FindCg.cmake
+++ /dev/null
@@ -1,172 +0,0 @@
-#
-# Try to find NVIDIA's Cg compiler, runtime libraries, and include path.
-# Once done this will define
-#
-# CG_FOUND =system has NVIDIA Cg and it can be used.
-# CG_INCLUDE_PATH = directory where cg.h resides
-# CG_LIBRARY = full path to libCg.so (Cg.DLL on win32)
-# CG_GL_LIBRARY = full path to libCgGL.so (CgGL.dll on win32)
-# CG_COMPILER = full path to cgc (cgc.exe on win32)
-#
-
-# On OSX default to using the framework version of Cg.
-IF (APPLE)
- INCLUDE(${CMAKE_ROOT}/Modules/CMakeFindFrameworks.cmake)
- SET(CG_FRAMEWORK_INCLUDES)
- CMAKE_FIND_FRAMEWORKS(Cg)
- IF (Cg_FRAMEWORKS)
- FOREACH(dir ${Cg_FRAMEWORKS})
- SET(CG_FRAMEWORK_INCLUDES ${CG_FRAMEWORK_INCLUDES}
- ${dir}/Headers ${dir}/PrivateHeaders)
- ENDFOREACH(dir)
-
- # Find the include dir
- FIND_PATH(CG_INCLUDE_PATH cg.h
- ${CG_FRAMEWORK_INCLUDES}
- )
-
- # Since we are using Cg framework, we must link to it.
- # Note, we use weak linking, so that it works even when Cg is not available.
- SET(CG_LIBRARY "-weak_framework Cg" CACHE STRING "Cg library")
- SET(CG_GL_LIBRARY "-weak_framework Cg" CACHE STRING "Cg GL library")
- ENDIF (Cg_FRAMEWORKS)
- FIND_PROGRAM(CG_COMPILER cgc
- /usr/bin
- /usr/local/bin
- DOC "The Cg compiler"
- )
-ELSE (APPLE)
- IF (WIN32)
-
- # When compiling 64-bit programs, the binaries and libs are in bin.x64 and lib.x64 directories,
-
- # This will have only effect for 64bit versions of cmake, when running the default 32bit version
- # both ProgramFiles and ProgramFiles(x86) point to the same place in Win64
- SET(PFx86_VARNAME "ProgramFiles(x86)")
- SET(PFx86 $ENV{${PFx86_VARNAME}})
-
- # Let's play safe in case we are cross compiling to 64 bit: for cgc it doesn't really matter
- FIND_PROGRAM( CG_COMPILER cgc
- $ENV{CG_BIN64_PATH}
- $ENV{CG_BIN_PATH}
- $ENV{PROGRAMFILES}/NVIDIA\ Corporation/Cg/bin
- $ENV{PFx86}/NVIDIA\ Corporation/Cg/bin
- $ENV{PROGRAMFILES}/Cg
- ${PROJECT_SOURCE_DIR}/../Cg
- DOC "The Cg Compiler"
- )
-
- IF (CG_COMPILER)
- GET_FILENAME_COMPONENT(CG_COMPILER_DIR ${CG_COMPILER} PATH)
- GET_FILENAME_COMPONENT(CG_COMPILER_SUPER_DIR ${CG_COMPILER_DIR} PATH)
- ELSE (CG_COMPILER)
- SET (CG_COMPILER_DIR .)
- SET (CG_COMPILER_SUPER_DIR ..)
- ENDIF (CG_COMPILER)
- FIND_PATH( CG_INCLUDE_PATH Cg/cg.h
- $ENV{CG_INC_PATH}
- $ENV{PROGRAMFILES}/NVIDIA\ Corporation/Cg/include
- $ENV{PROGRAMFILES}/Cg
- ${PROJECT_SOURCE_DIR}/../Cg
- ${CG_COMPILER_SUPER_DIR}/include
- ${CG_COMPILER_DIR}
- DOC "The directory where Cg/cg.h resides"
- )
-
- IF (NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
- FIND_LIBRARY( CG_LIBRARY
- NAMES Cg
- PATHS
- $ENV{CG_LIB64_PATH}
- $ENV{PROGRAMFILES}/NVIDIA\ Corporation/Cg/lib.x64
- $ENV{PFx86}/NVIDIA\ Corporation/Cg/lib.x64
- $ENV{PROGRAMFILES}/Cg
- $ENV{PFx86}/Cg
- ${PROJECT_SOURCE_DIR}/../Cg
- ${CG_COMPILER_SUPER_DIR}/lib.x64
- ${CG_COMPILER_DIR}
- DOC "The Cg runtime library (64-bit)"
- )
- FIND_LIBRARY( CG_GL_LIBRARY
- NAMES CgGL
- PATHS
- $ENV{CG_LIB64_PATH}
- $ENV{PROGRAMFILES}/NVIDIA\ Corporation/Cg/lib.x64
- $ENV{PFx86}/NVIDIA\ Corporation/Cg/lib.x64
- $ENV{PROGRAMFILES}/Cg
- $ENV{PFx86}/Cg
- ${PROJECT_SOURCE_DIR}/../Cg
- ${CG_COMPILER_SUPER_DIR}/lib.x64
- ${CG_COMPILER_DIR}
- DOC "The Cg GL runtime library (64-bit)"
- )
- ELSE(NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
- FIND_LIBRARY( CG_LIBRARY
- NAMES Cg
- PATHS
- $ENV{CG_LIB_PATH}
- $ENV{PROGRAMFILES}/NVIDIA\ Corporation/Cg/lib
- $ENV{PROGRAMFILES}/Cg
- ${PROJECT_SOURCE_DIR}/../Cg
- ${CG_COMPILER_SUPER_DIR}/lib
- ${CG_COMPILER_DIR}
- DOC "The Cg runtime library"
- )
- FIND_LIBRARY( CG_GL_LIBRARY
- NAMES CgGL
- PATHS
- $ENV{CG_LIB_PATH}
- $ENV{PROGRAMFILES}/NVIDIA\ Corporation/Cg/lib
- $ENV{PROGRAMFILES}/Cg
- ${PROJECT_SOURCE_DIR}/../Cg
- ${CG_COMPILER_SUPER_DIR}/lib
- ${CG_COMPILER_DIR}
- DOC "The Cg GL runtime library"
- )
- ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
-
- ELSE (WIN32)
- FIND_PROGRAM( CG_COMPILER cgc
- /usr/bin
- /usr/local/bin
- DOC "The Cg Compiler"
- )
- GET_FILENAME_COMPONENT(CG_COMPILER_DIR "${CG_COMPILER}" PATH)
- GET_FILENAME_COMPONENT(CG_COMPILER_SUPER_DIR "${CG_COMPILER_DIR}" PATH)
- FIND_PATH( CG_INCLUDE_PATH Cg/cg.h
- /usr/include
- /usr/local/include
- ${CG_COMPILER_SUPER_DIR}/include
- DOC "The directory where Cg/cg.h resides"
- )
- FIND_LIBRARY( CG_LIBRARY Cg
- PATHS
- /usr/lib64
- /usr/lib
- /usr/local/lib64
- /usr/local/lib
- ${CG_COMPILER_SUPER_DIR}/lib64
- ${CG_COMPILER_SUPER_DIR}/lib
- DOC "The Cg runtime library"
- )
- SET(CG_LIBRARY ${CG_LIBRARY} -lpthread)
- FIND_LIBRARY( CG_GL_LIBRARY CgGL
- PATHS
- /usr/lib64
- /usr/lib
- /usr/local/lib64
- /usr/local/lib
- ${CG_COMPILER_SUPER_DIR}/lib64
- ${CG_COMPILER_SUPER_DIR}/lib
- DOC "The Cg runtime library"
- )
- ENDIF (WIN32)
-ENDIF (APPLE)
-
-IF (CG_INCLUDE_PATH)
- SET( CG_FOUND 1 CACHE STRING "Set to 1 if CG is found, 0 otherwise")
-ELSE (CG_INCLUDE_PATH)
- SET( CG_FOUND 0 CACHE STRING "Set to 1 if CG is found, 0 otherwise")
-ENDIF (CG_INCLUDE_PATH)
-
-MARK_AS_ADVANCED( CG_FOUND )
diff --git a/Libraries/nvidia-texture-tools-read-only/cmake/FindDirectX.cmake b/Libraries/nvidia-texture-tools-read-only/cmake/FindDirectX.cmake
deleted file mode 100644
index 0177240e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/cmake/FindDirectX.cmake
+++ /dev/null
@@ -1,38 +0,0 @@
-
-IF (WIN32)
-
- FIND_PATH(DX9_INCLUDE_PATH d3d9.h
- PATHS
- "$ENV{DXSDK_DIR}/Include"
- "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include"
- DOC "The directory where D3D9.h resides")
-
- FIND_PATH(DX10_INCLUDE_PATH D3D10.h
- PATHS
- "$ENV{DXSDK_DIR}/Include"
- "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include"
- DOC "The directory where D3D10.h resides")
-
- FIND_LIBRARY(D3D10_LIBRARY d3d10.lib
- PATHS
- "$ENV{DXSDK_DIR}/Lib/x86"
- "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86"
- DOC "The directory where d3d10.lib resides")
-
- FIND_LIBRARY(D3DX10_LIBRARY d3dx10.lib
- PATHS
- "$ENV{DXSDK_DIR}/Lib/x86"
- "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86"
- DOC "The directory where d3dx10.lib resides")
-
- SET(DX10_LIBRARIES ${D3D10_LIBRARY} ${D3DX10_LIBRARY})
-
-ENDIF (WIN32)
-
-IF (DX10_INCLUDE_PATH)
- SET( DX10_FOUND 1 CACHE STRING "Set to 1 if CG is found, 0 otherwise")
-ELSE (DX10_INCLUDE_PATH)
- SET( DX10_FOUND 0 CACHE STRING "Set to 1 if CG is found, 0 otherwise")
-ENDIF (DX10_INCLUDE_PATH)
-
-MARK_AS_ADVANCED( DX10_FOUND )
diff --git a/Libraries/nvidia-texture-tools-read-only/cmake/FindFreeImage.cmake b/Libraries/nvidia-texture-tools-read-only/cmake/FindFreeImage.cmake
deleted file mode 100644
index 16ae7a30..00000000
--- a/Libraries/nvidia-texture-tools-read-only/cmake/FindFreeImage.cmake
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# Try to find the FreeImage library and include path.
-# Once done this will define
-#
-# FREEIMAGE_FOUND
-# FREEIMAGE_INCLUDE_PATH
-# FREEIMAGE_LIBRARY
-#
-
-IF (WIN32)
- FIND_PATH( FREEIMAGE_INCLUDE_PATH FreeImage.h
- ${PROJECT_SOURCE_DIR}/extern/FreeImage
- DOC "The directory where FreeImage.h resides")
- FIND_LIBRARY( FREEIMAGE_LIBRARY
- NAMES FreeImage freeimage
- PATHS
- ${PROJECT_SOURCE_DIR}/FreeImage
- DOC "The FreeImage library")
-ELSE (WIN32)
- FIND_PATH( FREEIMAGE_INCLUDE_PATH FreeImage.h
- /usr/include
- /usr/local/include
- /sw/include
- /opt/local/include
- DOC "The directory where FreeImage.h resides")
- FIND_LIBRARY( FREEIMAGE_LIBRARY
- NAMES FreeImage freeimage
- PATHS
- /usr/lib64
- /usr/lib
- /usr/local/lib64
- /usr/local/lib
- /sw/lib
- /opt/local/lib
- DOC "The FreeImage library")
-ENDIF (WIN32)
-
-SET(FREEIMAGE_LIBRARIES ${FREEIMAGE_LIBRARY})
-
-IF (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY)
- SET( FREEIMAGE_FOUND TRUE CACHE BOOL "Set to TRUE if GLEW is found, FALSE otherwise")
-ELSE (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY)
- SET( FREEIMAGE_FOUND FALSE CACHE BOOL "Set to TRUE if GLEW is found, FALSE otherwise")
-ENDIF (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY)
-
-MARK_AS_ADVANCED(
- FREEIMAGE_FOUND
- FREEIMAGE_LIBRARY
- FREEIMAGE_LIBRARIES
- FREEIMAGE_INCLUDE_PATH)
-
diff --git a/Libraries/nvidia-texture-tools-read-only/cmake/FindGLEW.cmake b/Libraries/nvidia-texture-tools-read-only/cmake/FindGLEW.cmake
deleted file mode 100644
index c791327c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/cmake/FindGLEW.cmake
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Try to find GLEW library and include path.
-# Once done this will define
-#
-# GLEW_FOUND
-# GLEW_INCLUDE_PATH
-# GLEW_LIBRARY
-#
-
-IF (WIN32)
- FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
- $ENV{PROGRAMFILES}/GLEW/include
- ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include
- DOC "The directory where GL/glew.h resides")
- IF (NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
- FIND_LIBRARY( GLEW_LIBRARY
- NAMES glew64 glew64s
- PATHS
- $ENV{PROGRAMFILES}/GLEW/lib
- ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
- ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
- DOC "The GLEW library (64-bit)"
- )
- ELSE(NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
- FIND_LIBRARY( GLEW_LIBRARY
- NAMES glew GLEW glew32 glew32s
- PATHS
- $ENV{PROGRAMFILES}/GLEW/lib
- ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
- ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
- DOC "The GLEW library"
- )
- ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
-ELSE (WIN32)
- FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
- /usr/include
- /usr/local/include
- /sw/include
- /opt/local/include
- DOC "The directory where GL/glew.h resides")
- FIND_LIBRARY( GLEW_LIBRARY
- NAMES GLEW glew
- PATHS
- /usr/lib64
- /usr/lib
- /usr/local/lib64
- /usr/local/lib
- /sw/lib
- /opt/local/lib
- DOC "The GLEW library")
-ENDIF (WIN32)
-
-IF (GLEW_INCLUDE_PATH)
- SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
-ELSE (GLEW_INCLUDE_PATH)
- SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
-ENDIF (GLEW_INCLUDE_PATH)
-
-MARK_AS_ADVANCED( GLEW_FOUND )
diff --git a/Libraries/nvidia-texture-tools-read-only/cmake/FindMaya.cmake b/Libraries/nvidia-texture-tools-read-only/cmake/FindMaya.cmake
deleted file mode 100644
index 3599329e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/cmake/FindMaya.cmake
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
-IF (WIN32)
-
- # Maya plugins can only be compiled with msvc
- IF (MSVC)
-
- FIND_PATH(MAYA_INCLUDE_PATH maya/MTypes.h
- PATHS
- "$ENV{PROGRAMFILES}/Autodesk/Maya8.5/include"
- "$ENV{MAYA_LOCATION}/include"
- DOC "The directory where MTypes.h resides")
-
- # Find maya version!
-
- FIND_LIBRARY(MAYA_FOUNDATION_LIBRARY Foundation
- PATHS
- "$ENV{PROGRAMFILES}/Autodesk/Maya8.5/lib"
- "$ENV{MAYA_LOCATION}/lib"
- DOC "The directory where Foundation.lib resides")
-
- FIND_LIBRARY(MAYA_OPENMAYA_LIBRARY OpenMaya
- PATHS
- "$ENV{PROGRAMFILES}/Autodesk/Maya8.5/lib"
- "$ENV{MAYA_LOCATION}/lib"
- DOC "The directory where OpenMaya.lib resides")
-
- FIND_LIBRARY(MAYA_OPENMAYAANIM_LIBRARY OpenMayaAnim
- PATHS
- "$ENV{PROGRAMFILES}/Autodesk/Maya8.5/lib"
- "$ENV{MAYA_LOCATION}/lib"
- DOC "The directory where OpenMayaAnim.lib resides")
-
- SET(MAYA_LIBRARIES
- ${MAYA_FOUNDATION_LIBRARY}
- ${MAYA_OPENMAYA_LIBRARY}
- ${MAYA_OPENMAYAANIM_LIBRARY})
-
- SET(MAYA_EXTENSION ".mll")
-
- ENDIF (MSVC)
-ELSE (WIN32)
-
- # On linux, check gcc version.
-
- # OSX and Linux
-
- FIND_PATH(MAYA_INCLUDE_PATH maya/MTypes.h
- PATHS
- /usr/autodesk/maya/include
- $ENV{MAYA_LOCATION}/include
- DOC "The directory where MTypes.h resides")
-
-# TODO
-
-ENDIF (WIN32)
-
-
-
-IF (MAYA_INCLUDE_PATH)
- SET( MAYA_FOUND 1 CACHE STRING "Set to 1 if Maya is found, 0 otherwise")
-ELSE (MAYA_INCLUDE_PATH)
- SET( MAYA_FOUND 0 CACHE STRING "Set to 1 if Maya is found, 0 otherwise")
-ENDIF (MAYA_INCLUDE_PATH)
-
-MARK_AS_ADVANCED( MAYA_FOUND )
diff --git a/Libraries/nvidia-texture-tools-read-only/cmake/FindOpenEXR.cmake b/Libraries/nvidia-texture-tools-read-only/cmake/FindOpenEXR.cmake
deleted file mode 100644
index 1ca4c8e8..00000000
--- a/Libraries/nvidia-texture-tools-read-only/cmake/FindOpenEXR.cmake
+++ /dev/null
@@ -1,79 +0,0 @@
-#
-# Try to find OpenEXR's libraries, and include path.
-# Once done this will define:
-#
-# OPENEXR_FOUND = OpenEXR found.
-# OPENEXR_INCLUDE_PATHS = OpenEXR include directories.
-# OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR.
-#
-
-INCLUDE(FindZLIB)
-
-
-IF(ZLIB_FOUND)
-
- SET(LIBRARY_PATHS
- /usr/lib
- /usr/local/lib
- /sw/lib
- /opt/local/lib
- $ENV{PROGRAM_FILES}/OpenEXR/lib/static)
-
- FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h
- PATH_SUFFIXES OpenEXR
- /usr/include
- /usr/local/include
- /sw/include
- /opt/local/include)
-
- FIND_LIBRARY(OPENEXR_HALF_LIBRARY
- NAMES Half
- PATHS ${LIBRARY_PATHS})
-
- FIND_LIBRARY(OPENEXR_IEX_LIBRARY
- NAMES Iex
- PATHS ${LIBRARY_PATHS})
-
- FIND_LIBRARY(OPENEXR_IMATH_LIBRARY
- NAMES Imath
- PATHS ${LIBRARY_PATHS})
-
- FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY
- NAMES IlmImf
- PATHS ${LIBRARY_PATHS})
-
- FIND_LIBRARY(OPENEXR_ILMTHREAD_LIBRARY
- NAMES IlmThread
- PATHS ${LIBRARY_PATHS})
-
-ENDIF(ZLIB_FOUND)
-
-#MESSAGE(STATUS ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ZLIB_LIBRARY})
-
-IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
- SET(OPENEXR_FOUND TRUE)
- SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE STRING "The include paths needed to use OpenEXR")
- SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${ZLIB_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR")
-
- IF(OPENEXR_ILMTHREAD_LIBRARY)
- SET(OPENEXR_LIBRARIES ${OPENEXR_LIBRARIES} ${OPENEXR_ILMTHREAD_LIBRARY})
- ENDIF(OPENEXR_ILMTHREAD_LIBRARY)
-ENDIF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
-
-IF(OPENEXR_FOUND)
- IF(NOT OPENEXR_FIND_QUIETLY)
- MESSAGE(STATUS "Found OpenEXR: ${OPENEXR_ILMIMF_LIBRARY}")
- ENDIF(NOT OPENEXR_FIND_QUIETLY)
-ELSE(OPENEXR_FOUND)
- IF(OPENEXR_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could not find OpenEXR library")
- ENDIF(OPENEXR_FIND_REQUIRED)
-ENDIF(OPENEXR_FOUND)
-
-MARK_AS_ADVANCED(
- OPENEXR_INCLUDE_PATHS
- OPENEXR_LIBRARIES
- OPENEXR_ILMIMF_LIBRARY
- OPENEXR_IMATH_LIBRARY
- OPENEXR_IEX_LIBRARY
- OPENEXR_HALF_LIBRARY)
diff --git a/Libraries/nvidia-texture-tools-read-only/cmake/OptimalOptions.cmake b/Libraries/nvidia-texture-tools-read-only/cmake/OptimalOptions.cmake
deleted file mode 100644
index 96f27003..00000000
--- a/Libraries/nvidia-texture-tools-read-only/cmake/OptimalOptions.cmake
+++ /dev/null
@@ -1,60 +0,0 @@
-
-INCLUDE(${NV_CMAKE_DIR}/DetermineProcessor.cmake)
-
-# Set optimal options for gcc:
-IF(CMAKE_COMPILER_IS_GNUCXX)
-
- IF(NV_SYSTEM_PROCESSOR STREQUAL "i586")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i586")
- ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "i586")
-
- IF(NV_SYSTEM_PROCESSOR STREQUAL "i686")
- #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
- #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -mtune=i686 -msse3")
- #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=pentium4")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=prescott")
- ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "i686")
-
- IF(NV_SYSTEM_PROCESSOR STREQUAL "x86_64")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=athlon64")
- #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=athlon64 -msse3")
- ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "x86_64")
-
- IF(NV_SYSTEM_PROCESSOR STREQUAL "powerpc")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=powerpc -faltivec -maltivec -mabi=altivec -mpowerpc-gfxopt")
-
- # ibook G4:
- #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=7450 -mtune=7450 -faltivec -maltivec -mabi=altivec -mpowerpc-gfxopt")
-
- # G5
- #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=G5 -faltivec -maltivec -mabi=altivec -mpowerpc-gfxopt")
-
- ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "powerpc")
-
-# IF(DARWIN)
-# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk")
-# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk")
-# ENDIF(DARWIN)
-
- IF(CMAKE_BUILD_TYPE STREQUAL "debug")
- ADD_DEFINITIONS(-D_DEBUG)
- ENDIF(CMAKE_BUILD_TYPE STREQUAL "debug")
-
-ENDIF(CMAKE_COMPILER_IS_GNUCXX)
-
-IF(MSVC)
- # @@ Some of these might only be available in VC8.
- # Code generation flags.
-# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2 /fp:fast")
-# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2 /fp:fast")
-
- # Optimization flags.
- SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} /O2 /Ob2 /Oi /Ot /Oy /GL")
- SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /O2 /Ob2 /Oi /Ot /Oy /GL")
- SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
- SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
- SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
-
- # Definitions.
- ADD_DEFINITIONS(-D__SSE2__ -D__SSE__ -D__MMX__)
-ENDIF(MSVC)
diff --git a/Libraries/nvidia-texture-tools-read-only/configure b/Libraries/nvidia-texture-tools-read-only/configure
deleted file mode 100644
index efea3e93..00000000
--- a/Libraries/nvidia-texture-tools-read-only/configure
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env sh
-
-BOLD="\033[1m"
-RED="\033[91m"
-GREEN="\033[92m"
-YELLOW="\033[93m"
-CYAN="\033[96m"
-NORMAL="\033[0m"
-
-# Make sure cmake is available.
-if command -v cmake >/dev/null 2>&1;
-then
- CMAKE=cmake
-else
- echo "Error - cmake is not available!"
- exit 2
-fi
-
-
-help=false
-build="Debug" # release
-prefix=/usr/local
-
-# Parse the args
-for i in "$@"
-do
- case $i in
- --help ) help=true ;;
- --debug ) build="Debug" ;;
- --release ) build="Release" ;;
- --prefix=* ) prefix="${i#--prefix=}" ;;
- --prefix=* ) prefix="${i#--prefix=}" ;;
- * ) echo "Unrecognised argument $i" ;;
- esac
-done
-
-if [ "$help" = "true" ]
-then
- echo "-----------------------------------------------"
- echo "nvidia-texture-tools "`cat VERSION`" configuration script"
- echo "-----------------------------------------------"
- echo
- echo "--help Show this message."
- echo "--debug Configure debug build."
- echo "--release Configure release build."
- echo "--prefix=path Installation prefix."
- echo "--include=path Include path."
- echo "--lib=path Library path."
- exit 0
-fi
-
-echo "-- Configuring nvidia-texture-tools "`cat VERSION`
-
-mkdir -p ./build
-cd ./build
-$CMAKE .. -DNVTT_SHARED=0 -DCMAKE_BUILD_TYPE=$build -DCMAKE_INSTALL_PREFIX=$prefix -G "Unix Makefiles" || exit 1
-cd ..
-
-echo ""
-echo -e "Your configure completed "$GREEN"successfully"$NORMAL", now type "$BOLD"make"$NORMAL
-echo ""
-
-cat > Makefile << EOF
-all:
- @make --no-print-directory -C build/
-install:
- @make install --no-print-directory -C build/
-clean:
- @make clean --no-print-directory -C build/
-distclean:
- @rm -Rf build/
-EOF
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/FreeImage.dll b/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/FreeImage.dll
deleted file mode 100644
index 05859a86..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/FreeImage.dll
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/FreeImage.h b/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/FreeImage.h
deleted file mode 100644
index b2dfaa41..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/FreeImage.h
+++ /dev/null
@@ -1,1046 +0,0 @@
-// ==========================================================
-// FreeImage 3
-//
-// Design and implementation by
-// - Floris van den Berg (flvdberg@wxs.nl)
-// - Hervé Drolon (drolon@infonie.fr)
-//
-// Contributors:
-// - Adam Gates (radad@xoasis.com)
-// - Alex Kwak
-// - Alexander Dymerets (sashad@te.net.ua)
-// - Detlev Vendt (detlev.vendt@brillit.de)
-// - Jan L. Nauta (jln@magentammt.com)
-// - Jani Kajala (janik@remedy.fi)
-// - Juergen Riecker (j.riecker@gmx.de)
-// - Karl-Heinz Bussian (khbussian@moss.de)
-// - Laurent Rocher (rocherl@club-internet.fr)
-// - Luca Piergentili (l.pierge@terra.es)
-// - Machiel ten Brinke (brinkem@uni-one.nl)
-// - Markus Loibl (markus.loibl@epost.de)
-// - Martin Weber (martweb@gmx.net)
-// - Matthias Wandel (mwandel@rim.net)
-// - Michal Novotny (michal@etc.cz)
-// - Petr Pytelka (pyta@lightcomp.com)
-// - Riley McNiff (rmcniff@marexgroup.com)
-// - Ryan Rubley (ryan@lostreality.org)
-// - Volker Gärtner (volkerg@gmx.at)
-//
-// This file is part of FreeImage 3
-//
-// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
-// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
-// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
-// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
-// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
-// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
-// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
-// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
-// THIS DISCLAIMER.
-//
-// Use at your own risk!
-// ==========================================================
-
-#ifndef FREEIMAGE_H
-#define FREEIMAGE_H
-
-// Version information ------------------------------------------------------
-
-#define FREEIMAGE_MAJOR_VERSION 3
-#define FREEIMAGE_MINOR_VERSION 10
-#define FREEIMAGE_RELEASE_SERIAL 0
-
-// Compiler options ---------------------------------------------------------
-
-#include <wchar.h> // needed for UNICODE functions
-
-#if defined(FREEIMAGE_LIB)
- #define DLL_API
- #define DLL_CALLCONV
-#else
- #if defined(_WIN32) || defined(__WIN32__)
- #define DLL_CALLCONV __stdcall
- // The following ifdef block is the standard way of creating macros which make exporting
- // from a DLL simpler. All files within this DLL are compiled with the FREEIMAGE_EXPORTS
- // symbol defined on the command line. this symbol should not be defined on any project
- // that uses this DLL. This way any other project whose source files include this file see
- // DLL_API functions as being imported from a DLL, wheras this DLL sees symbols
- // defined with this macro as being exported.
- #ifdef FREEIMAGE_EXPORTS
- #define DLL_API __declspec(dllexport)
- #else
- #define DLL_API __declspec(dllimport)
- #endif // FREEIMAGE_EXPORTS
- #else
- // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility)
- #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
- #ifndef GCC_HASCLASSVISIBILITY
- #define GCC_HASCLASSVISIBILITY
- #endif
- #endif // __GNUC__
- #define DLL_CALLCONV
- #if defined(GCC_HASCLASSVISIBILITY)
- #define DLL_API __attribute__ ((visibility("default")))
- #else
- #define DLL_API
- #endif
- #endif // WIN32 / !WIN32
-#endif // FREEIMAGE_LIB
-
-// Some versions of gcc may have BYTE_ORDER or __BYTE_ORDER defined
-// If your big endian system isn't being detected, add an OS specific check
-#if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || \
- (defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || \
- defined(__BIG_ENDIAN__)
-#define FREEIMAGE_BIGENDIAN
-#endif // BYTE_ORDER
-
-// This really only affects 24 and 32 bit formats, the rest are always RGB order.
-#define FREEIMAGE_COLORORDER_BGR 0
-#define FREEIMAGE_COLORORDER_RGB 1
-#if defined(__APPLE__) || defined(FREEIMAGE_BIGENDIAN)
-#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB
-#else
-#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR
-#endif
-
-// Ensure 4-byte enums if we're using Borland C++ compilers
-#if defined(__BORLANDC__)
-#pragma option push -b
-#endif
-
-// For C compatibility --------------------------------------------------------
-
-#ifdef __cplusplus
-#define FI_DEFAULT(x) = x
-#define FI_ENUM(x) enum x
-#define FI_STRUCT(x) struct x
-#else
-#define FI_DEFAULT(x)
-#define FI_ENUM(x) typedef int x; enum x
-#define FI_STRUCT(x) typedef struct x x; struct x
-#endif
-
-// Bitmap types -------------------------------------------------------------
-
-FI_STRUCT (FIBITMAP) { void *data; };
-FI_STRUCT (FIMULTIBITMAP) { void *data; };
-
-// Types used in the library (directly copied from Windows) -----------------
-
-#ifndef _WINDOWS_
-#define _WINDOWS_
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-#endif
-
-#ifndef _MSC_VER
-// define portable types for 32-bit / 64-bit OS
-#include <inttypes.h>
-typedef int32_t BOOL;
-typedef uint8_t BYTE;
-typedef uint16_t WORD;
-typedef uint32_t DWORD;
-typedef int32_t LONG;
-#else
-// MS is not C99 ISO compliant
-typedef long BOOL;
-typedef unsigned char BYTE;
-typedef unsigned short WORD;
-typedef unsigned long DWORD;
-typedef long LONG;
-#endif // _MSC_VER
-
-#if (defined(_WIN32) || defined(__WIN32__))
-#pragma pack(push, 1)
-#else
-#pragma pack(1)
-#endif // WIN32
-
-typedef struct tagRGBQUAD {
-#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
- BYTE rgbBlue;
- BYTE rgbGreen;
- BYTE rgbRed;
-#else
- BYTE rgbRed;
- BYTE rgbGreen;
- BYTE rgbBlue;
-#endif // FREEIMAGE_COLORORDER
- BYTE rgbReserved;
-} RGBQUAD;
-
-typedef struct tagRGBTRIPLE {
-#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
- BYTE rgbtBlue;
- BYTE rgbtGreen;
- BYTE rgbtRed;
-#else
- BYTE rgbtRed;
- BYTE rgbtGreen;
- BYTE rgbtBlue;
-#endif // FREEIMAGE_COLORORDER
-} RGBTRIPLE;
-
-#if (defined(_WIN32) || defined(__WIN32__))
-#pragma pack(pop)
-#else
-#pragma pack()
-#endif // WIN32
-
-typedef struct tagBITMAPINFOHEADER{
- DWORD biSize;
- LONG biWidth;
- LONG biHeight;
- WORD biPlanes;
- WORD biBitCount;
- DWORD biCompression;
- DWORD biSizeImage;
- LONG biXPelsPerMeter;
- LONG biYPelsPerMeter;
- DWORD biClrUsed;
- DWORD biClrImportant;
-} BITMAPINFOHEADER, *PBITMAPINFOHEADER;
-
-typedef struct tagBITMAPINFO {
- BITMAPINFOHEADER bmiHeader;
- RGBQUAD bmiColors[1];
-} BITMAPINFO, *PBITMAPINFO;
-
-#endif // _WINDOWS_
-
-// Types used in the library (specific to FreeImage) ------------------------
-
-#if (defined(_WIN32) || defined(__WIN32__))
-#pragma pack(push, 1)
-#else
-#pragma pack(1)
-#endif // WIN32
-
-/** 48-bit RGB
-*/
-typedef struct tagFIRGB16 {
- WORD red;
- WORD green;
- WORD blue;
-} FIRGB16;
-
-/** 64-bit RGBA
-*/
-typedef struct tagFIRGBA16 {
- WORD red;
- WORD green;
- WORD blue;
- WORD alpha;
-} FIRGBA16;
-
-/** 96-bit RGB Float
-*/
-typedef struct tagFIRGBF {
- float red;
- float green;
- float blue;
-} FIRGBF;
-
-/** 128-bit RGBA Float
-*/
-typedef struct tagFIRGBAF {
- float red;
- float green;
- float blue;
- float alpha;
-} FIRGBAF;
-
-/** Data structure for COMPLEX type (complex number)
-*/
-typedef struct tagFICOMPLEX {
- /// real part
- double r;
- /// imaginary part
- double i;
-} FICOMPLEX;
-
-#if (defined(_WIN32) || defined(__WIN32__))
-#pragma pack(pop)
-#else
-#pragma pack()
-#endif // WIN32
-
-// Indexes for byte arrays, masks and shifts for treating pixels as words ---
-// These coincide with the order of RGBQUAD and RGBTRIPLE -------------------
-
-#ifndef FREEIMAGE_BIGENDIAN
-#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
-// Little Endian (x86 / MS Windows, Linux) : BGR(A) order
-#define FI_RGBA_RED 2
-#define FI_RGBA_GREEN 1
-#define FI_RGBA_BLUE 0
-#define FI_RGBA_ALPHA 3
-#define FI_RGBA_RED_MASK 0x00FF0000
-#define FI_RGBA_GREEN_MASK 0x0000FF00
-#define FI_RGBA_BLUE_MASK 0x000000FF
-#define FI_RGBA_ALPHA_MASK 0xFF000000
-#define FI_RGBA_RED_SHIFT 16
-#define FI_RGBA_GREEN_SHIFT 8
-#define FI_RGBA_BLUE_SHIFT 0
-#define FI_RGBA_ALPHA_SHIFT 24
-#else
-// Little Endian (x86 / MaxOSX) : RGB(A) order
-#define FI_RGBA_RED 0
-#define FI_RGBA_GREEN 1
-#define FI_RGBA_BLUE 2
-#define FI_RGBA_ALPHA 3
-#define FI_RGBA_RED_MASK 0x000000FF
-#define FI_RGBA_GREEN_MASK 0x0000FF00
-#define FI_RGBA_BLUE_MASK 0x00FF0000
-#define FI_RGBA_ALPHA_MASK 0xFF000000
-#define FI_RGBA_RED_SHIFT 0
-#define FI_RGBA_GREEN_SHIFT 8
-#define FI_RGBA_BLUE_SHIFT 16
-#define FI_RGBA_ALPHA_SHIFT 24
-#endif // FREEIMAGE_COLORORDER
-#else
-#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
-// Big Endian (PPC / none) : BGR(A) order
-#define FI_RGBA_RED 2
-#define FI_RGBA_GREEN 1
-#define FI_RGBA_BLUE 0
-#define FI_RGBA_ALPHA 3
-#define FI_RGBA_RED_MASK 0x0000FF00
-#define FI_RGBA_GREEN_MASK 0x00FF0000
-#define FI_RGBA_BLUE_MASK 0xFF000000
-#define FI_RGBA_ALPHA_MASK 0x000000FF
-#define FI_RGBA_RED_SHIFT 8
-#define FI_RGBA_GREEN_SHIFT 16
-#define FI_RGBA_BLUE_SHIFT 24
-#define FI_RGBA_ALPHA_SHIFT 0
-#else
-// Big Endian (PPC / Linux, MaxOSX) : RGB(A) order
-#define FI_RGBA_RED 0
-#define FI_RGBA_GREEN 1
-#define FI_RGBA_BLUE 2
-#define FI_RGBA_ALPHA 3
-#define FI_RGBA_RED_MASK 0xFF000000
-#define FI_RGBA_GREEN_MASK 0x00FF0000
-#define FI_RGBA_BLUE_MASK 0x0000FF00
-#define FI_RGBA_ALPHA_MASK 0x000000FF
-#define FI_RGBA_RED_SHIFT 24
-#define FI_RGBA_GREEN_SHIFT 16
-#define FI_RGBA_BLUE_SHIFT 8
-#define FI_RGBA_ALPHA_SHIFT 0
-#endif // FREEIMAGE_COLORORDER
-#endif // FREEIMAGE_BIGENDIAN
-
-#define FI_RGBA_RGB_MASK (FI_RGBA_RED_MASK|FI_RGBA_GREEN_MASK|FI_RGBA_BLUE_MASK)
-
-// The 16bit macros only include masks and shifts, since each color element is not byte aligned
-
-#define FI16_555_RED_MASK 0x7C00
-#define FI16_555_GREEN_MASK 0x03E0
-#define FI16_555_BLUE_MASK 0x001F
-#define FI16_555_RED_SHIFT 10
-#define FI16_555_GREEN_SHIFT 5
-#define FI16_555_BLUE_SHIFT 0
-#define FI16_565_RED_MASK 0xF800
-#define FI16_565_GREEN_MASK 0x07E0
-#define FI16_565_BLUE_MASK 0x001F
-#define FI16_565_RED_SHIFT 11
-#define FI16_565_GREEN_SHIFT 5
-#define FI16_565_BLUE_SHIFT 0
-
-// ICC profile support ------------------------------------------------------
-
-#define FIICC_DEFAULT 0x00
-#define FIICC_COLOR_IS_CMYK 0x01
-
-FI_STRUCT (FIICCPROFILE) {
- WORD flags; // info flag
- DWORD size; // profile's size measured in bytes
- void *data; // points to a block of contiguous memory containing the profile
-};
-
-// Important enums ----------------------------------------------------------
-
-/** I/O image format identifiers.
-*/
-FI_ENUM(FREE_IMAGE_FORMAT) {
- FIF_UNKNOWN = -1,
- FIF_BMP = 0,
- FIF_ICO = 1,
- FIF_JPEG = 2,
- FIF_JNG = 3,
- FIF_KOALA = 4,
- FIF_LBM = 5,
- FIF_IFF = FIF_LBM,
- FIF_MNG = 6,
- FIF_PBM = 7,
- FIF_PBMRAW = 8,
- FIF_PCD = 9,
- FIF_PCX = 10,
- FIF_PGM = 11,
- FIF_PGMRAW = 12,
- FIF_PNG = 13,
- FIF_PPM = 14,
- FIF_PPMRAW = 15,
- FIF_RAS = 16,
- FIF_TARGA = 17,
- FIF_TIFF = 18,
- FIF_WBMP = 19,
- FIF_PSD = 20,
- FIF_CUT = 21,
- FIF_XBM = 22,
- FIF_XPM = 23,
- FIF_DDS = 24,
- FIF_GIF = 25,
- FIF_HDR = 26,
- FIF_FAXG3 = 27,
- FIF_SGI = 28,
- FIF_EXR = 29,
- FIF_J2K = 30,
- FIF_JP2 = 31
-};
-
-/** Image type used in FreeImage.
-*/
-FI_ENUM(FREE_IMAGE_TYPE) {
- FIT_UNKNOWN = 0, // unknown type
- FIT_BITMAP = 1, // standard image : 1-, 4-, 8-, 16-, 24-, 32-bit
- FIT_UINT16 = 2, // array of unsigned short : unsigned 16-bit
- FIT_INT16 = 3, // array of short : signed 16-bit
- FIT_UINT32 = 4, // array of unsigned long : unsigned 32-bit
- FIT_INT32 = 5, // array of long : signed 32-bit
- FIT_FLOAT = 6, // array of float : 32-bit IEEE floating point
- FIT_DOUBLE = 7, // array of double : 64-bit IEEE floating point
- FIT_COMPLEX = 8, // array of FICOMPLEX : 2 x 64-bit IEEE floating point
- FIT_RGB16 = 9, // 48-bit RGB image : 3 x 16-bit
- FIT_RGBA16 = 10, // 64-bit RGBA image : 4 x 16-bit
- FIT_RGBF = 11, // 96-bit RGB float image : 3 x 32-bit IEEE floating point
- FIT_RGBAF = 12 // 128-bit RGBA float image : 4 x 32-bit IEEE floating point
-};
-
-/** Image color type used in FreeImage.
-*/
-FI_ENUM(FREE_IMAGE_COLOR_TYPE) {
- FIC_MINISWHITE = 0, // min value is white
- FIC_MINISBLACK = 1, // min value is black
- FIC_RGB = 2, // RGB color model
- FIC_PALETTE = 3, // color map indexed
- FIC_RGBALPHA = 4, // RGB color model with alpha channel
- FIC_CMYK = 5 // CMYK color model
-};
-
-/** Color quantization algorithms.
-Constants used in FreeImage_ColorQuantize.
-*/
-FI_ENUM(FREE_IMAGE_QUANTIZE) {
- FIQ_WUQUANT = 0, // Xiaolin Wu color quantization algorithm
- FIQ_NNQUANT = 1 // NeuQuant neural-net quantization algorithm by Anthony Dekker
-};
-
-/** Dithering algorithms.
-Constants used in FreeImage_Dither.
-*/
-FI_ENUM(FREE_IMAGE_DITHER) {
- FID_FS = 0, // Floyd & Steinberg error diffusion
- FID_BAYER4x4 = 1, // Bayer ordered dispersed dot dithering (order 2 dithering matrix)
- FID_BAYER8x8 = 2, // Bayer ordered dispersed dot dithering (order 3 dithering matrix)
- FID_CLUSTER6x6 = 3, // Ordered clustered dot dithering (order 3 - 6x6 matrix)
- FID_CLUSTER8x8 = 4, // Ordered clustered dot dithering (order 4 - 8x8 matrix)
- FID_CLUSTER16x16= 5, // Ordered clustered dot dithering (order 8 - 16x16 matrix)
- FID_BAYER16x16 = 6 // Bayer ordered dispersed dot dithering (order 4 dithering matrix)
-};
-
-/** Lossless JPEG transformations
-Constants used in FreeImage_JPEGTransform
-*/
-FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
- FIJPEG_OP_NONE = 0, // no transformation
- FIJPEG_OP_FLIP_H = 1, // horizontal flip
- FIJPEG_OP_FLIP_V = 2, // vertical flip
- FIJPEG_OP_TRANSPOSE = 3, // transpose across UL-to-LR axis
- FIJPEG_OP_TRANSVERSE = 4, // transpose across UR-to-LL axis
- FIJPEG_OP_ROTATE_90 = 5, // 90-degree clockwise rotation
- FIJPEG_OP_ROTATE_180 = 6, // 180-degree rotation
- FIJPEG_OP_ROTATE_270 = 7 // 270-degree clockwise (or 90 ccw)
-};
-
-/** Tone mapping operators.
-Constants used in FreeImage_ToneMapping.
-*/
-FI_ENUM(FREE_IMAGE_TMO) {
- FITMO_DRAGO03 = 0, // Adaptive logarithmic mapping (F. Drago, 2003)
- FITMO_REINHARD05 = 1, // Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005)
- FITMO_FATTAL02 = 2 // Gradient domain high dynamic range compression (R. Fattal, 2002)
-};
-
-/** Upsampling / downsampling filters.
-Constants used in FreeImage_Rescale.
-*/
-FI_ENUM(FREE_IMAGE_FILTER) {
- FILTER_BOX = 0, // Box, pulse, Fourier window, 1st order (constant) b-spline
- FILTER_BICUBIC = 1, // Mitchell & Netravali's two-param cubic filter
- FILTER_BILINEAR = 2, // Bilinear filter
- FILTER_BSPLINE = 3, // 4th order (cubic) b-spline
- FILTER_CATMULLROM = 4, // Catmull-Rom spline, Overhauser spline
- FILTER_LANCZOS3 = 5 // Lanczos3 filter
-};
-
-/** Color channels.
-Constants used in color manipulation routines.
-*/
-FI_ENUM(FREE_IMAGE_COLOR_CHANNEL) {
- FICC_RGB = 0, // Use red, green and blue channels
- FICC_RED = 1, // Use red channel
- FICC_GREEN = 2, // Use green channel
- FICC_BLUE = 3, // Use blue channel
- FICC_ALPHA = 4, // Use alpha channel
- FICC_BLACK = 5, // Use black channel
- FICC_REAL = 6, // Complex images: use real part
- FICC_IMAG = 7, // Complex images: use imaginary part
- FICC_MAG = 8, // Complex images: use magnitude
- FICC_PHASE = 9 // Complex images: use phase
-};
-
-// Metadata support ---------------------------------------------------------
-
-/**
- Tag data type information (based on TIFF specifications)
-
- Note: RATIONALs are the ratio of two 32-bit integer values.
-*/
-FI_ENUM(FREE_IMAGE_MDTYPE) {
- FIDT_NOTYPE = 0, // placeholder
- FIDT_BYTE = 1, // 8-bit unsigned integer
- FIDT_ASCII = 2, // 8-bit bytes w/ last byte null
- FIDT_SHORT = 3, // 16-bit unsigned integer
- FIDT_LONG = 4, // 32-bit unsigned integer
- FIDT_RATIONAL = 5, // 64-bit unsigned fraction
- FIDT_SBYTE = 6, // 8-bit signed integer
- FIDT_UNDEFINED = 7, // 8-bit untyped data
- FIDT_SSHORT = 8, // 16-bit signed integer
- FIDT_SLONG = 9, // 32-bit signed integer
- FIDT_SRATIONAL = 10, // 64-bit signed fraction
- FIDT_FLOAT = 11, // 32-bit IEEE floating point
- FIDT_DOUBLE = 12, // 64-bit IEEE floating point
- FIDT_IFD = 13, // 32-bit unsigned integer (offset)
- FIDT_PALETTE = 14 // 32-bit RGBQUAD
-};
-
-/**
- Metadata models supported by FreeImage
-*/
-FI_ENUM(FREE_IMAGE_MDMODEL) {
- FIMD_NODATA = -1,
- FIMD_COMMENTS = 0, // single comment or keywords
- FIMD_EXIF_MAIN = 1, // Exif-TIFF metadata
- FIMD_EXIF_EXIF = 2, // Exif-specific metadata
- FIMD_EXIF_GPS = 3, // Exif GPS metadata
- FIMD_EXIF_MAKERNOTE = 4, // Exif maker note metadata
- FIMD_EXIF_INTEROP = 5, // Exif interoperability metadata
- FIMD_IPTC = 6, // IPTC/NAA metadata
- FIMD_XMP = 7, // Abobe XMP metadata
- FIMD_GEOTIFF = 8, // GeoTIFF metadata
- FIMD_ANIMATION = 9, // Animation metadata
- FIMD_CUSTOM = 10 // Used to attach other metadata types to a dib
-};
-
-/**
- Handle to a metadata model
-*/
-FI_STRUCT (FIMETADATA) { void *data; };
-
-/**
- Handle to a FreeImage tag
-*/
-FI_STRUCT (FITAG) { void *data; };
-
-// File IO routines ---------------------------------------------------------
-
-#ifndef FREEIMAGE_IO
-#define FREEIMAGE_IO
-
-typedef void* fi_handle;
-typedef unsigned (DLL_CALLCONV *FI_ReadProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
-typedef unsigned (DLL_CALLCONV *FI_WriteProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
-typedef int (DLL_CALLCONV *FI_SeekProc) (fi_handle handle, long offset, int origin);
-typedef long (DLL_CALLCONV *FI_TellProc) (fi_handle handle);
-
-#if (defined(_WIN32) || defined(__WIN32__))
-#pragma pack(push, 1)
-#else
-#pragma pack(1)
-#endif // WIN32
-
-FI_STRUCT(FreeImageIO) {
- FI_ReadProc read_proc; // pointer to the function used to read data
- FI_WriteProc write_proc; // pointer to the function used to write data
- FI_SeekProc seek_proc; // pointer to the function used to seek
- FI_TellProc tell_proc; // pointer to the function used to aquire the current position
-};
-
-#if (defined(_WIN32) || defined(__WIN32__))
-#pragma pack(pop)
-#else
-#pragma pack()
-#endif // WIN32
-
-/**
-Handle to a memory I/O stream
-*/
-FI_STRUCT (FIMEMORY) { void *data; };
-
-#endif // FREEIMAGE_IO
-
-// Plugin routines ----------------------------------------------------------
-
-#ifndef PLUGINS
-#define PLUGINS
-
-typedef const char *(DLL_CALLCONV *FI_FormatProc) ();
-typedef const char *(DLL_CALLCONV *FI_DescriptionProc) ();
-typedef const char *(DLL_CALLCONV *FI_ExtensionListProc) ();
-typedef const char *(DLL_CALLCONV *FI_RegExprProc) ();
-typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read);
-typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data);
-typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data);
-typedef int (DLL_CALLCONV *FI_PageCapabilityProc)(FreeImageIO *io, fi_handle handle, void *data);
-typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data);
-typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data);
-typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle);
-typedef const char *(DLL_CALLCONV *FI_MimeProc) ();
-typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp);
-typedef BOOL (DLL_CALLCONV *FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE type);
-typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)();
-
-FI_STRUCT (Plugin) {
- FI_FormatProc format_proc;
- FI_DescriptionProc description_proc;
- FI_ExtensionListProc extension_proc;
- FI_RegExprProc regexpr_proc;
- FI_OpenProc open_proc;
- FI_CloseProc close_proc;
- FI_PageCountProc pagecount_proc;
- FI_PageCapabilityProc pagecapability_proc;
- FI_LoadProc load_proc;
- FI_SaveProc save_proc;
- FI_ValidateProc validate_proc;
- FI_MimeProc mime_proc;
- FI_SupportsExportBPPProc supports_export_bpp_proc;
- FI_SupportsExportTypeProc supports_export_type_proc;
- FI_SupportsICCProfilesProc supports_icc_profiles_proc;
-};
-
-typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id);
-
-#endif // PLUGINS
-
-
-// Load / Save flag constants -----------------------------------------------
-
-#define BMP_DEFAULT 0
-#define BMP_SAVE_RLE 1
-#define CUT_DEFAULT 0
-#define DDS_DEFAULT 0
-#define EXR_DEFAULT 0 // save data as half with piz-based wavelet compression
-#define EXR_FLOAT 0x0001 // save data as float instead of as half (not recommended)
-#define EXR_NONE 0x0002 // save with no compression
-#define EXR_ZIP 0x0004 // save with zlib compression, in blocks of 16 scan lines
-#define EXR_PIZ 0x0008 // save with piz-based wavelet compression
-#define EXR_PXR24 0x0010 // save with lossy 24-bit float compression
-#define EXR_B44 0x0020 // save with lossy 44% float compression - goes to 22% when combined with EXR_LC
-#define EXR_LC 0x0040 // save images with one luminance and two chroma channels, rather than as RGB (lossy compression)
-#define FAXG3_DEFAULT 0
-#define GIF_DEFAULT 0
-#define GIF_LOAD256 1 // Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color
-#define GIF_PLAYBACK 2 // 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading
-#define HDR_DEFAULT 0
-#define ICO_DEFAULT 0
-#define ICO_MAKEALPHA 1 // convert to 32bpp and create an alpha channel from the AND-mask when loading
-#define IFF_DEFAULT 0
-#define J2K_DEFAULT 0 // save with a 16:1 rate
-#define JP2_DEFAULT 0 // save with a 16:1 rate
-#define JPEG_DEFAULT 0 // loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD)
-#define JPEG_FAST 0x0001 // load the file as fast as possible, sacrificing some quality
-#define JPEG_ACCURATE 0x0002 // load the file with the best quality, sacrificing some speed
-#define JPEG_CMYK 0x0004 // load separated CMYK "as is" (use | to combine with other load flags)
-#define JPEG_QUALITYSUPERB 0x80 // save with superb quality (100:1)
-#define JPEG_QUALITYGOOD 0x0100 // save with good quality (75:1)
-#define JPEG_QUALITYNORMAL 0x0200 // save with normal quality (50:1)
-#define JPEG_QUALITYAVERAGE 0x0400 // save with average quality (25:1)
-#define JPEG_QUALITYBAD 0x0800 // save with bad quality (10:1)
-#define JPEG_PROGRESSIVE 0x2000 // save as a progressive-JPEG (use | to combine with other save flags)
-#define KOALA_DEFAULT 0
-#define LBM_DEFAULT 0
-#define MNG_DEFAULT 0
-#define PCD_DEFAULT 0
-#define PCD_BASE 1 // load the bitmap sized 768 x 512
-#define PCD_BASEDIV4 2 // load the bitmap sized 384 x 256
-#define PCD_BASEDIV16 3 // load the bitmap sized 192 x 128
-#define PCX_DEFAULT 0
-#define PNG_DEFAULT 0
-#define PNG_IGNOREGAMMA 1 // avoid gamma correction
-#define PNM_DEFAULT 0
-#define PNM_SAVE_RAW 0 // If set the writer saves in RAW format (i.e. P4, P5 or P6)
-#define PNM_SAVE_ASCII 1 // If set the writer saves in ASCII format (i.e. P1, P2 or P3)
-#define PSD_DEFAULT 0
-#define RAS_DEFAULT 0
-#define SGI_DEFAULT 0
-#define TARGA_DEFAULT 0
-#define TARGA_LOAD_RGB888 1 // If set the loader converts RGB555 and ARGB8888 -> RGB888.
-#define TIFF_DEFAULT 0
-#define TIFF_CMYK 0x0001 // reads/stores tags for separated CMYK (use | to combine with compression flags)
-#define TIFF_PACKBITS 0x0100 // save using PACKBITS compression
-#define TIFF_DEFLATE 0x0200 // save using DEFLATE compression (a.k.a. ZLIB compression)
-#define TIFF_ADOBE_DEFLATE 0x0400 // save using ADOBE DEFLATE compression
-#define TIFF_NONE 0x0800 // save without any compression
-#define TIFF_CCITTFAX3 0x1000 // save using CCITT Group 3 fax encoding
-#define TIFF_CCITTFAX4 0x2000 // save using CCITT Group 4 fax encoding
-#define TIFF_LZW 0x4000 // save using LZW compression
-#define TIFF_JPEG 0x8000 // save using JPEG compression
-#define WBMP_DEFAULT 0
-#define XBM_DEFAULT 0
-#define XPM_DEFAULT 0
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Init / Error routines ----------------------------------------------------
-
-DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE));
-DLL_API void DLL_CALLCONV FreeImage_DeInitialise(void);
-
-// Version routines ---------------------------------------------------------
-
-DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(void);
-DLL_API const char *DLL_CALLCONV FreeImage_GetCopyrightMessage(void);
-
-// Message output functions -------------------------------------------------
-
-typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT fif, const char *msg);
-typedef void (DLL_CALLCONV *FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT fif, const char *msg);
-
-DLL_API void DLL_CALLCONV FreeImage_SetOutputMessageStdCall(FreeImage_OutputMessageFunctionStdCall omf);
-DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf);
-DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...);
-
-// Allocate / Clone / Unload routines ---------------------------------------
-
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Allocate(int width, int height, int bpp, unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp FI_DEFAULT(8), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
-DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib);
-DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib);
-
-// Load / Save routines -----------------------------------------------------
-
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0));
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadU(FREE_IMAGE_FORMAT fif, const wchar_t *filename, int flags FI_DEFAULT(0));
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
-DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0));
-DLL_API BOOL DLL_CALLCONV FreeImage_SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const wchar_t *filename, int flags FI_DEFAULT(0));
-DLL_API BOOL DLL_CALLCONV FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
-
-// Memory I/O stream routines -----------------------------------------------
-
-DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0));
-DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
-DLL_API BOOL DLL_CALLCONV FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags FI_DEFAULT(0));
-DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream);
-DLL_API BOOL DLL_CALLCONV FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin);
-DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes);
-DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
-DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
-DLL_API FIMULTIBITMAP *DLL_CALLCONV FreeImage_LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
-
-// Plugin Interface ---------------------------------------------------------
-
-DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterLocalPlugin(FI_InitProc proc_address, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0));
-DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterExternalPlugin(const char *path, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0));
-DLL_API int DLL_CALLCONV FreeImage_GetFIFCount(void);
-DLL_API int DLL_CALLCONV FreeImage_SetPluginEnabled(FREE_IMAGE_FORMAT fif, BOOL enable);
-DLL_API int DLL_CALLCONV FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif);
-DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFormat(const char *format);
-DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromMime(const char *mime);
-DLL_API const char *DLL_CALLCONV FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif);
-DLL_API const char *DLL_CALLCONV FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif);
-DLL_API const char *DLL_CALLCONV FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif);
-DLL_API const char *DLL_CALLCONV FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif);
-DLL_API const char *DLL_CALLCONV FreeImage_GetFIFMimeType(FREE_IMAGE_FORMAT fif);
-DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilename(const char *filename);
-DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilenameU(const wchar_t *filename);
-DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif);
-DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsWriting(FREE_IMAGE_FORMAT fif);
-DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp);
-DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportType(FREE_IMAGE_FORMAT fif, FREE_IMAGE_TYPE type);
-DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif);
-
-// Multipaging interface ----------------------------------------------------
-
-DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmap(FREE_IMAGE_FORMAT fif, const char *filename, BOOL create_new, BOOL read_only, BOOL keep_cache_in_memory FI_DEFAULT(FALSE), int flags FI_DEFAULT(0));
-DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0));
-DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap);
-DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data);
-DLL_API void DLL_CALLCONV FreeImage_InsertPage(FIMULTIBITMAP *bitmap, int page, FIBITMAP *data);
-DLL_API void DLL_CALLCONV FreeImage_DeletePage(FIMULTIBITMAP *bitmap, int page);
-DLL_API FIBITMAP * DLL_CALLCONV FreeImage_LockPage(FIMULTIBITMAP *bitmap, int page);
-DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *data, BOOL changed);
-DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source);
-DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count);
-
-// Filetype request routines ------------------------------------------------
-
-DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0));
-DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0));
-DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0));
-DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0));
-
-// Image type request routine -----------------------------------------------
-
-DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib);
-
-// FreeImage helper routines ------------------------------------------------
-
-DLL_API BOOL DLL_CALLCONV FreeImage_IsLittleEndian(void);
-DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
-DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
-
-
-// Pixel access routines ----------------------------------------------------
-
-DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib);
-DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline);
-
-DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value);
-DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
-DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value);
-DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
-
-// DIB info routines --------------------------------------------------------
-
-DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib);
-DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib);
-DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib);
-DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib);
-DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib);
-DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib);
-DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib);
-DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib);
-
-DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib);
-DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib);
-DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res);
-DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res);
-
-DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib);
-DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(FIBITMAP *dib);
-DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(FIBITMAP *dib);
-
-DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(FIBITMAP *dib);
-DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib);
-DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib);
-
-DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib);
-DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib);
-DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled);
-DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count);
-DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib);
-DLL_API void DLL_CALLCONV FreeImage_SetTransparentIndex(FIBITMAP *dib, int index);
-DLL_API int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib);
-
-DLL_API BOOL DLL_CALLCONV FreeImage_HasBackgroundColor(FIBITMAP *dib);
-DLL_API BOOL DLL_CALLCONV FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor);
-DLL_API BOOL DLL_CALLCONV FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor);
-
-
-// ICC profile routines -----------------------------------------------------
-
-DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib);
-DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size);
-DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib);
-
-// Line conversion routines -------------------------------------------------
-
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels);
-DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels);
-
-// Smart conversion routines ------------------------------------------------
-
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo4Bits(FIBITMAP *dib);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo8Bits(FIBITMAP *dib);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToGreyscale(FIBITMAP *dib);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits555(FIBITMAP *dib);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits565(FIBITMAP *dib);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo24Bits(FIBITMAP *dib);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo32Bits(FIBITMAP *dib);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize FI_DEFAULT(FIQ_WUQUANT), int PaletteSize FI_DEFAULT(256), int ReserveSize FI_DEFAULT(0), RGBQUAD *ReservePalette FI_DEFAULT(NULL));
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, BYTE T);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm);
-
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBits(BYTE *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE));
-DLL_API void DLL_CALLCONV FreeImage_ConvertToRawBits(BYTE *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE));
-
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBF(FIBITMAP *dib);
-
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToStandardType(FIBITMAP *src, BOOL scale_linear FI_DEFAULT(TRUE));
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToType(FIBITMAP *src, FREE_IMAGE_TYPE dst_type, BOOL scale_linear FI_DEFAULT(TRUE));
-
-// tone mapping operators
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ToneMapping(FIBITMAP *dib, FREE_IMAGE_TMO tmo, double first_param FI_DEFAULT(0), double second_param FI_DEFAULT(0));
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoDrago03(FIBITMAP *src, double gamma FI_DEFAULT(2.2), double exposure FI_DEFAULT(0));
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0));
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoFattal02(FIBITMAP *src, double color_saturation FI_DEFAULT(0.5), double attenuation FI_DEFAULT(0.85));
-
-// ZLib interface -----------------------------------------------------------
-
-DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
-DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
-DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
-DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
-DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size);
-
-// --------------------------------------------------------------------------
-// Metadata routines --------------------------------------------------------
-// --------------------------------------------------------------------------
-
-// tag creation / destruction
-DLL_API FITAG *DLL_CALLCONV FreeImage_CreateTag();
-DLL_API void DLL_CALLCONV FreeImage_DeleteTag(FITAG *tag);
-DLL_API FITAG *DLL_CALLCONV FreeImage_CloneTag(FITAG *tag);
-
-// tag getters and setters
-DLL_API const char *DLL_CALLCONV FreeImage_GetTagKey(FITAG *tag);
-DLL_API const char *DLL_CALLCONV FreeImage_GetTagDescription(FITAG *tag);
-DLL_API WORD DLL_CALLCONV FreeImage_GetTagID(FITAG *tag);
-DLL_API FREE_IMAGE_MDTYPE DLL_CALLCONV FreeImage_GetTagType(FITAG *tag);
-DLL_API DWORD DLL_CALLCONV FreeImage_GetTagCount(FITAG *tag);
-DLL_API DWORD DLL_CALLCONV FreeImage_GetTagLength(FITAG *tag);
-DLL_API const void *DLL_CALLCONV FreeImage_GetTagValue(FITAG *tag);
-
-DLL_API BOOL DLL_CALLCONV FreeImage_SetTagKey(FITAG *tag, const char *key);
-DLL_API BOOL DLL_CALLCONV FreeImage_SetTagDescription(FITAG *tag, const char *description);
-DLL_API BOOL DLL_CALLCONV FreeImage_SetTagID(FITAG *tag, WORD id);
-DLL_API BOOL DLL_CALLCONV FreeImage_SetTagType(FITAG *tag, FREE_IMAGE_MDTYPE type);
-DLL_API BOOL DLL_CALLCONV FreeImage_SetTagCount(FITAG *tag, DWORD count);
-DLL_API BOOL DLL_CALLCONV FreeImage_SetTagLength(FITAG *tag, DWORD length);
-DLL_API BOOL DLL_CALLCONV FreeImage_SetTagValue(FITAG *tag, const void *value);
-
-// iterator
-DLL_API FIMETADATA *DLL_CALLCONV FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag);
-DLL_API BOOL DLL_CALLCONV FreeImage_FindNextMetadata(FIMETADATA *mdhandle, FITAG **tag);
-DLL_API void DLL_CALLCONV FreeImage_FindCloseMetadata(FIMETADATA *mdhandle);
-
-// metadata setter and getter
-DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag);
-DLL_API BOOL DLL_CALLCONV FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag);
-
-// helpers
-DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib);
-
-// tag to C string conversion
-DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, FITAG *tag, char *Make FI_DEFAULT(NULL));
-
-// --------------------------------------------------------------------------
-// Image manipulation toolkit -----------------------------------------------
-// --------------------------------------------------------------------------
-
-// rotation and flipping
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask);
-DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib);
-DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib);
-DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE));
-
-// upsampling / downsampling
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pixel_size, BOOL convert FI_DEFAULT(TRUE));
-
-// color manipulation routines (point operations)
-DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel);
-DLL_API BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *dib, double gamma);
-DLL_API BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *dib, double percentage);
-DLL_API BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *dib, double percentage);
-DLL_API BOOL DLL_CALLCONV FreeImage_Invert(FIBITMAP *dib);
-DLL_API BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *dib, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel FI_DEFAULT(FICC_BLACK));
-DLL_API int DLL_CALLCONV FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contrast, double gamma, BOOL invert);
-DLL_API BOOL DLL_CALLCONV FreeImage_AdjustColors(FIBITMAP *dib, double brightness, double contrast, double gamma, BOOL invert FI_DEFAULT(FALSE));
-DLL_API unsigned DLL_CALLCONV FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolors, unsigned count, BOOL ignore_alpha, BOOL swap);
-DLL_API unsigned DLL_CALLCONV FreeImage_SwapColors(FIBITMAP *dib, RGBQUAD *color_a, RGBQUAD *color_b, BOOL ignore_alpha);
-DLL_API unsigned DLL_CALLCONV FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices, BYTE *dstindices, unsigned count, BOOL swap);
-DLL_API unsigned DLL_CALLCONV FreeImage_SwapPaletteIndices(FIBITMAP *dib, BYTE *index_a, BYTE *index_b);
-
-// channel processing routines
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetChannel(FIBITMAP *dib, FREE_IMAGE_COLOR_CHANNEL channel);
-DLL_API BOOL DLL_CALLCONV FreeImage_SetChannel(FIBITMAP *dib, FIBITMAP *dib8, FREE_IMAGE_COLOR_CHANNEL channel);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetComplexChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
-DLL_API BOOL DLL_CALLCONV FreeImage_SetComplexChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
-
-// copy / paste / composite routines
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Copy(FIBITMAP *dib, int left, int top, int right, int bottom);
-DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha);
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL));
-DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
-DLL_API BOOL DLL_CALLCONV FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib);
-
-// miscellaneous algorithms
-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle FI_DEFAULT(3));
-
-// restore the borland-specific enum size option
-#if defined(__BORLANDC__)
-#pragma option pop
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // FREEIMAGE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/FreeImage.lib b/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/FreeImage.lib
deleted file mode 100644
index 7e6e8259..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/FreeImage.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/Whatsnew.txt b/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/Whatsnew.txt
deleted file mode 100644
index e1199dc3..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/Whatsnew.txt
+++ /dev/null
@@ -1,898 +0,0 @@
-What's New for FreeImage
-
-* : fixed
-- : removed
-! : changed
-+ : added
-
-November 19th, 2007 - 3.10.0
-! FreeImage now uses libTIFF 3.9.0beta (CVS patch 2007-10-05)
-! FreeImage now uses OpenJPEG 1.2.0 (SVN patch 2007-07-13)
-! FreeImage now uses OpenEXR 1.6.1
-! FreeImage now uses libPNG 1.2.23
-! FreeImage now hides its internal functions and internal libraries when compiled with gcc
-- [Herve Drolon] removed VS C+ 6.0 project files : this IDE is no longer supported because of OpenEXR
-+ [Herve Drolon] added VS 2005 project files
-+ [Herve Drolon] added full support for the OpenEXR format
-+ [Herve Drolon] added full support for the JPEG-2000 format
-+ [Herve Drolon] added FreeImage_TmoFattal02 tone mapping operator
-+ [Ryan Rubley] added support for RGB vs BGR regardless of endian
-+ [Herve Drolon] added FreeImage_MultigridPoissonSolver
-+ [Carsten Klein] added FreeImage_PreMultiplyWithAlpha
-+ [Carsten Klein] added __stdcall version of FreeImage_OutputMessage
-+ [Carsten Klein] added new palette and color manipulation functions (see below) :
- added FreeImage_SetTransparentIndex
- added FreeImage_GetTransparentIndex
- added FreeImage_GetAdjustColorsLookupTable
- added FreeImage_AdjustColors
- added FreeImage_ApplyColorMapping
- added FreeImage_SwapColors
- added FreeImage_ApplyPaletteIndexMapping
- added FreeImage_SwapPaletteIndices
-* [Herve Drolon] fixed a bug in TIFF plugin when reading 8-bit + 8-bit alpha images
-* [Herve Drolon] fixed a bug in TIFF plugin when reading images with uncommon bitdepths
-* [rodrigo] fixed FreeImage exception handling under gcc (added -fexceptions to gcc compiler flags)
-* [Martin Dyring-Andersen] fixed GIF plugin crashing on some corrupted files
-* [Herve Drolon] fixed a bug with RLE encoding for 8-bit BMP images
-* [Herve Drolon] fixed GPS metadata being skipped when reading metadata in Exif images
-* [Herve Drolon] fixed a bug when reading OS/2 BMP images with a negative height
-* [Ryan Rubley] fixed a bug with loading of GIFs with large amounts of solid color areas
-* [Ryan Rubley] fixed OS X compile error in BitmapAccess.cpp
-* [Herve Drolon] fixed a bug in FreeImage_Paste when pasting non-standard image types
-* [Herve Drolon] saving 1-bit TIF with the TIFF_CCITTFAX3 flag is now compliant with the TIFF Class F specification
-* [Carsten Klein] fixed topdown parameter in FreeImage_ConvertFromRawBits and FreeImage_ConvertToRawBits being handled in reverse
-* [Herve Drolon] fixed a bug when reading some RLE-4 encoded BMP data
-* [Carsten Klein] conversion from 1-bit to 32-bit now keep possibly present transparency
-
-February 11th, 2007 - 3.9.3
-! FreeImage now uses libPNG 1.2.16
-! [Ryan Rubley/Ryan Davis] reworked the MacOSX makefile in order to fully support Universal Binary builds of FreeImage
-! [Herve Drolon] makefiles are now generated from VS2003 project files instead of VS6 project files
-! [Herve Drolon] changed JPEG load/save flag option values
-+ [Herve Drolon] added support for RGBAF images to FreeImage_ConvertToRGBF
-+ [Herve Drolon] FreeImage_Paste now works with any bitmap type
-+ [Herve Drolon] added full support for 64-bit RGBA images to the PNG and TIFF plugins
-+ [Jascha Wetzel] added JPEG downsampling feature to PluginJPEG:Load
-* [Thomas Chmielewski] fixed a bug in FreeImage_Dither and Bayer dithering, added FID_BAYER16x16
-* [Raphael Gaquer] greatly improved the speed of the GIF encoder
-* [Herve Drolon] fixed saving of metadata in the PNG plugin
-* [rampelstinskin] fixed transparency table to alpha channel conversion for 4-bit images in FreeImage_ConvertTo32Bits
-* [Scott Smith] added missing IPTC tag named "Country/PrimaryLocationCode"
-* [Herve Drolon] changed #include <stdint.h> by #include <inttypes.h> in FreeImage.h (needed by Solaris 9)
-* [Pierre Arnaud] fixed the use of FreeImage in low memory condition by checking some returned values of the malloc function
-* [Pierre Arnaud] fixed TagLib::getTagFieldName not being thread safe
-
-October 30th, 2006 - 3.9.2
-! FreeImage now uses libTIFF 3.8.2 (with patch 2006-10-13)
-+ [Herve Drolon] added full support for 16-bit greyscale and 48-bit RGB to the PNM plugin
-+ [Herve Drolon] added IPTC writing support to JPEG & TIFF plugins
-+ [Herve Drolon] added new Exif maker note tags
-+ [Herve Drolon] added FreeImage_JPEGCrop
-+ [Thorsten Radde] added support for 8-bit palettized bitmaps in FreeImage_RotateClassic
-+ [Matt Rice] added automatic call to FreeImage_Initialise / FreeImage_DeInitialise when using FreeImage as a .so
-+ [Martin Dyring-Andersen] added FreeImage_LoadMultiBitmapFromMemory to the multi-page API
-+ [Herve Drolon] added support for tiled TIFF images
-* [Carsten Klein] fixed a bug in FreeImage_SetMetadata occuring when deleting a tag
-* [Herve Drolon] fixed a bug in PNG plugin when reading Macromedia 'false' PNG files
-* [Thorsten Radde] added resolution support to PluginPSD
-* [Ryan Rubley] fixed a bug in PluginGIF occuring with interlaced GIF
-* [Ryan Rubley] fixed a bug in the multipage cache mechanism (internal FreeImage_FindBlock function)
-* [Thorsten Radde] fixed a stack corruption in TIFF plugin occuring when reading exif tags
-* [checkered] fixed a bug in the multipage cache mechanism causing VS2005 to crash on multipage files
-* [Herve Drolon] fixed a bug with transparency support of 1- and 4-bit images
-* [Roar Flolo] fixed a bug in PSD plugin when reading non compressed RGB images (alpha channel initialization)
-* [Nicolas Hatier] fixed a bug in PluginGIF when using the GIF_PLAYBACK flag
-* [Herve Drolon] fixed a bug in TIFF plugin when saving 8-bit images using LZW with differenciation
-* [Herve Drolon] fixed 64-bit compilation issue with LibPNG and assembler code
-
-July 16th, 2006 - 3.9.1
-* [Ryan Rubley] fixed a bug in PluginGIF plugin causing FreeImage to crash on malformed GIF files
-
-July 6th, 2006 - 3.9.0
-! FreeImage now uses libPNG 1.2.12
-! FreeImage now uses libTIFF 3.8.2 (with patch 2006-06-24)
-! FreeImage_Allocate/FreeImage_Allocate now set the resolution to 72 dpi instead of 0
-+ [Herve Drolon/Petr Pytelka] added a raw FAX G3 format loader
-+ [Herve Drolon] added support for most image types to FreeImage_Rescale
-+ [Herve Drolon] added FreeImage_MakeThumbnail
-+ [Herve Drolon] added support for 64-bit images to FreeImage_ConvertTo32Bits
-+ [Herve Drolon] added support for Exif tags to TIF plugin (read only)
-+ [Herve Drolon] added FreeImage_ReadMemory
-+ [Herve Drolon] added FreeImage_WriteMemory
-+ [Herve Drolon] added new Exif maker note tags
-+ [Sherman Wilcox] added a SGI file format loader
-+ [Herve Drolon] added support for separated images to PluginTIFF
-+ [Herve Drolon] added support for progressive-JPEG saving to PluginJPEG
-* [Carsten Klein] FreeImage_Dither and FreeImage_Threshold now work with palettized 8-bit dib
-* [Christophe Petit] fixed a bug in FreeImage_GetFIFFromFilenameU occuring with files without extension
-* [Leigh Brasington] fixed a bug in PluginGIF causing FreeImage not working on Win/98/ME
-* [Herve Drolon] fixed a bug in PluginTIFF with writing of JPEG-in-TIFF files
-* [Jojakim Stahl] fixed a bug occuring with 4-bit PCX files
-* [Sandor Szalacsi] fixed a bug in FreeImage_SetBackgroundColor (bkgnd clearing)
-* [Petr Pytelka] fixed PluginTIFF::_tiffSizeProc failing on some images
-* [Sherman Wilcox] fixed a bug in DDS plugin when loading images whose size is not a multiple of 4
-* [Sherman Wilcox] fixed a memory leak in PluginDDS::LoadDXT_Helper
-* [Sherman Wilcox] fixed DDS plugin bad behavior with invalid DDS files (such as files with zero length)
-* [Floris van den Berg] fixed a memory leak in the MultiPage cache mechanism
-* [Herve Drolon] replaced WIN32 #define by _WIN32 #define as this is needed by VS2005
-* [Herve Drolon] fixed a VS2005 error in FreeImage_DeletePage
-* [Petr Supina] fixed a pow(long,long) function not being standard ANSI C/C++
-* [Petr Supina] fixed FreeImage_FindBlock function not being standard ANSI C/C++
-* [Olaf Stoyke] added support for 64-bit Linux OS
-* [Craig Stark] fixed FreeImage support on Intel based Mac OS
-* [Herve Drolon] fixed PluginTIFF failing on bad fax tiff images (bad images are now loaded 'as is')
-* [Zack Simpson] fixed a bug occuring in rare situations with FreeImage_Aligned_Malloc
-
-September 5, 2005 - 3.8.0
-! FreeImage now uses libTIFF 3.7.3
-! FreeImage now uses ZLib 1.2.3
-+ [Herve Drolon] added support for 48-bit images to FreeImage_ConvertTo24Bits
-+ [Herve Drolon] added FreeImage_ConvertToGreyscale
-+ [Herve Drolon] added support for 16-bit greyscale images to FreeImage_ConvertTo8Bits
-+ [Petr Pytelka] added UNICODE functions (see below)
- added FreeImage_LoadU
- added FreeImage_SaveU
- added FreeImage_GetFIFFromFilenameU
- added FreeImage_GetFileTypeU
-+ [Herve Drolon] FreeImage_Copy now works with any bitmap type
-+ [Herve Drolon] added support for 1-bit images to FreeImage_Paste
-* [Ryan Rubley] fixed PluginGIF failing to link on some broken gcc versions
-* [Karl-Heinz Bussian] fixed a bug in LookupX11Color/LookupSVGColor with handling of grey color names
-* [Herve Drolon] FreeImage_Dither now uses FreeImage_ConvertToGreyscale and handles 4/8-bit palletized images
-* [Herve Drolon] FreeImage_Threshold now uses FreeImage_ConvertToGreyscale and handles 4/8-bit palletized images
-* [Craig Hockenberry] fixed PluginGIF::Save swapping the byte order for the height on big endian machines (e.g. PPC on Mac OS X.)
-* [Herve Drolon] fixed a bug in JPEG plugin when reading Exif maker notes from images produced by Nikon Editor
-* [Herve Drolon] fixed a bug in BMP plugin when reading some malformed RLE8 bmp
-* [Herve Drolon] fixed a bug in RAS plugin when loading 8-bit palettized images with less than 256 colors
-* [Herve Drolon] fixed a bug in FreeImage_Rescale with 16-,48-,64-bit images
-* [Herve Drolon] fixed a bug in the ICC profiles API when loading profile-less CMYK TIFF
-* [Herve Drolon] 4-bit PNG are now loaded as 4-bit and no longer converted to 8-bit
-* [Greg Ng] fixed a bug in FreeImage_ConvertToRGBF (FIT_BITMAP -> FIT_RGBF conversion)
-
-May 7, 2005 - 3.7.0
-! FreeImage now uses libTIFF 3.7.2
-! [Ryan Rubley] improved FreeImage_OpenMultiBitmap
-+ [Detlev Vendt] added FreeImage_ZLibGUnzip
-+ [Herve Drolon] added new image data types FIT_RGB16, FIT_RGBA16, FIT_RGBF, FIT_RGBAF
-+ [Herve Drolon] FreeImage_FlipHorizontal & FreeImage_FlipVertical now work with any bitmap type
-+ [Herve Drolon] added conversions to float and double in FreeImage_ConvertToType
-+ [Herve Drolon] added FreeImage_ConvertToRGBF
-+ [Herve Drolon] added support for 16-, 48- and 96-bit images to FreeImage_Rescale
-+ [Ryan Rubley] added FreeImage_ColorQuantizeEx
-+ [Ryan Rubley] added FIMD_ANIMATION and FIDT_PALETTE
-+ [Ryan Rubley] added brand new PluginGIF with full animation multipage and metadata support
-+ [Herve Drolon] added support for FIC_MINISWHITE 8-bit images to FreeImage_Rescale
-+ [Herve Drolon] added HDR (High Dynamic Range) format (loader & writer)
-+ [Herve Drolon] added support for 48-bit images in TIFF plugin
-+ [Herve Drolon] added support for 48-bit images in PNG plugin
-+ [Herve Drolon] added tone mapping operators (see below)
-+ added FreeImage_ToneMapping
-+ added FreeImage_TmoDrago03
-+ added FreeImage_TmoReinhard05
-+ [Petr Pytelka] added FreeImage_JPEGTransform
-* [Herve Drolon] allowed loading of corrupted JPEG with a premature end of file
-* [Herve Drolon] fixed a memory leak with loading of exif JPEG images
-* [Detlev Vendt] changed some 'pointer-to-int' casts to 'pointer-to-long' for 64bit machines
-* [Ryan Rubley] fixed a memory leak in the multipage API
-* [Ryan Rubley] updated VB6 wrapper generation for new functions
-* [Herve Drolon] fixed incorrect behavior when reading JPEG comments containing special characters
-* [Herve Drolon] fixed incorrect behavior when reading JPEG ICC profiles with a size greater than 64 KB
-* [Herve Drolon] fixed a bug in TIFF plugin when loading malformed multipage TIFF
-* [Herve Drolon] fixed PluginTIFF not being thread safe
-
-February 20, 2005 - 3.6.1
-* [Ryan Rubley] fixed a memory leak in the metadata API
-* [luedi] improved the robustness of FIBITMAP allocations
-
-February 13, 2005 - 3.6.0
-! FreeImage now uses libMNG 1.0.9
-! [Herve Drolon] improved the speed of FreeImage_Rescale
-! [Herve Drolon] improved FreeImage_RotateClassic (more compact code, a little faster)
-! [Herve Drolon] improved the metadata API using tag accessors
-+ [Detlev Vendt] added LZW support to PluginGIF:Save
-+ [Herve Drolon] added VS.Net 2003 project files
-+ [Herve Drolon] added VERSIONINFO resource to the DLL
-+ [Herve Drolon] added support for CMYK JPEG on loading
-+ [Petr Supina] added 16-bytes alignment to FIBITMAP palette and pixels starting address
-+ [Petr Supina] added support for MMX/SSE2 code in LibJPEG (based on Mozilla/Firefox code)
-+ [Herve Drolon] added TIFF_JPEG compression flag to the TIFF plugin
-+ [Detlev Vendt] added FreeImage_ZLibGZip
-+ [Detlev Vendt] added FreeImage_ZLibCRC32
-* [Detlev Vendt] fixed PluginPNG not being thread safe
-* [Herve Drolon] fixed compiler warning C4018 occuring with VS.Net 2003
-
-December 29, 2004 - 3.5.3
-! FreeImage now uses ZLib 1.2.2
-! FreeImage now uses libPNG 1.2.8
-! FreeImage now uses libTIFF 3.7.1
-! [Herve Drolon] improved FreeImage_RotateClassic
-! [Detlev Vendt] improved FreeImage_Rescale (more compact code, preserving 8-bpp colors)
-+ [Herve Drolon] added support for transparency saving in ICO plugin
-+ [Herve Drolon] added support for 1-bit images to FreeImage_RotateClassic
-+ [Herve Drolon] added FreeImage_SetDotsPerMeterX and FreeImage_SetDotsPerMeterY
-* [Nan Feng] fixed memory leak in FreeImage_DeleteTag (internal stuff)
-* [Nigel Stewart] added conditional #pragma with #ifdef _MSC_VER / #endif
-* [Herve Drolon] fixed the '65536 lines' limit on loading in PNM plugin
-
-November 27th, 2004 - 3.5.2
-* [Herve Drolon] fixed a second bug in FreeImage_Clone function
-
-November 26th, 2004 - 3.5.1
-+ [Riley McNiff] added FreeImage_ConvertTo4Bits
-* [Herve Drolon] fixed a buffer overrun with some ILBM images
-* [Riley McNiff] fixed a potential problem when reading TIFF resolution info
-* [Dimitar Atanasov] fixed a bug in FreeImage_Clone function
-* [Dimitar Atanasov] fixed several bugs in TIFF plugin
-
-November 1st, 2004 - 3.5.0
-! FreeImage now uses libPNG 1.2.7
-! FreeImage now uses libTIFF 3.7.0
-! FreeImage now uses libMNG 1.0.8
-! [Herve Drolon] improved TIFF LZW compression using a predictor
-! [Detlev Vendt] FreeImagesPlus: corrected references to FreeImage.h and FreeImage.lib
-+ [Herve Drolon] added support for loading/saving of 8-bit transparent TIFF
-+ [Riley McNiff] added support for 4-bit dib in FreeImage_Paste
-+ [Herve Drolon] added support for memory IO streams (see below)
-+ added FreeImage_OpenMemory
-+ added FreeImage_CloseMemory
-+ added FreeImage_LoadFromMemory
-+ added FreeImage_SaveToMemory
-+ added FreeImage_TellMemory
-+ added FreeImage_SeekMemory
-+ added FreeImage_AcquireMemory
-+ added FreeImage_GetFileTypeFromMemory
-+ [Petr Pytelka] added FreeImage_GetFIFMimeType to the plugins function list
-+ [Herve Drolon] added ICC profile support to JPEG plugin
-+ [Herve Drolon] added support for metadata (see below)
-+ added FreeImage_SetMetadata
-+ added FreeImage_GetMetadata
-+ added FreeImage_GetMetadataCount
-+ added FreeImage_TagToString
-+ added FreeImage_FindFirstMetadata
-+ added FreeImage_FindNextMetadata
-+ added FreeImage_FindCloseMetadata
-* [Riley McNiff] fixed a bug with FreeImage_SetPixelIndex and 4-bit images
-* [Petr Pytelka] fixed returned value in FreeImage_CloseMultiBitmap
-* [Petr Pytelka] fixed index of new page in FreeImage_InsertPage
-* [Aaron Shumate] fixed a minor bug in PNG plugin
-* [Aaron Shumate] fixed a bug in IFF plugin (odd-length chunks)
-* [Rupert Hewitt] fixed FreeImage not compiling on National Instruments Cvi Ccompiler
-* [Herve Drolon] fixed a bug in IFF plugin (ILBM data)
-* [Fred Harju] added a Makefile for Solaris 9
-* [Roddy Pratt] fixed FreeImage not linking under Borland C++ Builder
-* [Vadim Alexandrov] fixed a memory leak in the multipage API
-* [Herve Drolon] fixed a bug with DDS plugin behaviour on Big Endian OS
-* [Herve Drolon] fixed a bug with conversion of JPEG resolution info on saving
-
-July 8th, 2004 - 3.4.0
-! [Jim Keir] improved FreeImage_FlipVertical function
-! [Herve Drolon] LZW compression is now enabled in FreeImage
-+ [Karl-Heinz Bussian] added constants to FreeImage.h to get at compile time the library version
-+ [Karl-Heinz Bussian] added color lookup functions for X11 and SVG
-+ [Herve Drolon] added TIFF tags TIFF_CCITTFAX3, TIFF_CCITTFAX4 and TIFF_LZW
-+ [Detlev Vendt] added support for CMYK TIFF files with alpha channel
-+ [Detlev Vendt] added (re-introduction of) PluginGIF
-* [Herve Drolon] fixed a bug with loading of FAX TIFF images (introduced with LibTIFF 3.6.1)
-* [Herve Drolon] fixed a bug in Floyd-Steinberg dithering algorithm
-* [Herve Drolon] fixed a bug in Targa plugin save function
-* [Herve Drolon] fixed a bug in FreeImage_AdjustCurve function
-* [Ryan Rubley] fixed a bug with FreeImage_Rescale's filters accuracy
-* [Ryan Rubley] fixed a bug in NN quantizer
-* [Herve Drolon] fixed a bug with TIFF files containing additional Photoshop alpha channels
-* [James Rossfeld] fixed a memory leak with some PSD images
-* [Herve Drolon] fixed a bug with saving of 32-bit non transparent PNG images
-* [Alexandr Zamaraev] fixed FreeImage not compiling with mingw32
-* [Herve Drolon] fixed FreeImage not compiling with VC.NET (pow function needs casts)
-
-May 2, 2004 - 3.3.0
-! [Ryan Rubley] FreeImage has been ported to MacOSX and should also work on other big endian processors
-+ [Ryan Rubley] rewrote XPM plugin (better load support) and added save support
-+ [Ryan Rubley] added ICO_MAKEALPHA flag to ICO plugin
-+ [Ryan Rubley] Set/GetPixelColor now works with 16-bit pixels (555 or 565)
-+ [Herve Drolon] PNG plugin now supports loading and saving of unsigned 16-bit greyscale images
-* [Herve Drolon] fixed a bug with loading of 8-bit and 16-bit PNG with a 8-bit alpha channel
-* [Herve Drolon] fixed a bug in NN quantizer algorithm with handling of 4-byte boundary alignment.
-* [Herve Drolon] fixed a bug in PluginIFF Validate function
-* [Herve Drolon] fixed a minor design issue in FreeImage_GetFIFFromFormat
-* [Brad Schick] fixed some compiler warnings with VC++ 7.1
-* [Herve Drolon] fixed a bug with saving of 8-bit palettized images to 24-bit JPEG (channel inversion)
-
-March 16, 2004 - 3.2.1
-! [Volker Gärtner] improved the DDS plugin
-! [Herve Drolon] FreeImage_Rescale now works on 8-, 24- and 32-bit images
-! [Herve Drolon] FreeImage_Copy now works on 1-, 4-, 8-, 16-, 24- and 32-bit images
-* [Floris van den Berg] fixed a bug in the MultiPage cache mechanism
-* [Herve Drolon] fixed a bug with loading/saving of 8-bit transparent tga images
-* [Herve Drolon] fixed a bug with loading of 1-bit TIFF (introduced with LibTIFF 3.6.1)
-
-February 18, 2004 - 3.2.0
-! FreeImage now uses libTIFF 3.6.1
-+ [Herve Drolon] added FreeImage_HasBackgroundColor
-+ [Herve Drolon] added FreeImage_GetBackgroundColor
-+ [Herve Drolon] added FreeImage_SetBackgroundColor
-+ [Herve Drolon] added FreeImage_Composite
-+ [Herve Drolon] added ICC profile support to PNG plugin
-+ [Herve Drolon] added background color support to PNG plugin
-+ [Volker Gärtner] added support for DDS format (loader)
-* [Steve Johnson] improved FreeImage_OpenMultiBitmap/FreeImage_CloseMultiBitmap
-* [Steve Johnson] fixed a bug in FreeImage_InsertPage
-* [Herve Drolon] fixed a bug with JPEG compressed TIFF (red/blue swapping)
-* [Herve Drolon] fixed a bug in PluginTarga where 8-bit images were saved incorrectly
-
-January 26, 2004 - 3.1.0
-! FreeImage now uses ZLib 1.2.1
-+ [Herve Drolon] added support for integer, real and complex image types (see below)
-+ added FREE_IMAGE_TYPE enum
-+ added FreeImage_AllocateT
-+ added FreeImage_GetImageType
-+ added FreeImage_FIFSupportsExportType
-+ added FreeImage_ConvertToStandardType
-+ added FreeImage_ConvertToType
-+ added load/save support of all image types to TIFF plugin
-+ [Peter Lemmens] added a Validate function to TARGA plugin
-+ [Herve Drolon] added FreeImage_GetPixelIndex / FreeImage_SetPixelIndex
-+ [Herve Drolon] added FreeImage_GetPixelColor / FreeImage_SetPixelColor
-+ [Herve Drolon] added FreeImage_GetComplexChannel / FreeImage_SetComplexChannel
-* [Serge Ivanchenko] TIFF_DEFLATE compression is now enabled in TIFF plugin
-* [Herve Drolon] fixed a bug in NeuQuant color reduction algorithm
-
-November 16, 2003 - 3.0.4
-* [Tobias Persson] fixed FreeImage_GetChannel not working with FICC_ALPHA channel
-* [Detlev Vendt] fixed a minor bug with PNG plugin and PNG_IGNOREGAMMA flag
-* [Detlev Vendt] fixed a memory leak in PNG plugin save routine
-* [Detlev Vendt] fixed JPEG validation problem with .jpe files
-* [Ryan Rubley] added Source/LibTIFF/tif_extension.c to LibTIFF (needed for MacOSX)
-* [Herve Drolon] improved error handling in TIFF plugin
-+ [Karl-Heinz Bussian] added FreeImage_IsLittleEndian
-+ [Karl-Heinz Bussian] added JPEG save support for 8-bit miniswhite bitmaps (transparent conversion to minisblack)
-+ [Karl-Heinz Bussian] FreeImage_GetColorType now recognizes 8-bit FIC_MINISWHITE images
-! [Herve Drolon] FreeImage_Rescale now supports rescaling of 32-bit images with alpha channel
-! [Herve Drolon] FreeImage_Invert now supports inversion of 32-bit images with alpha channel
-! [Herve Drolon] FreeImage_AdjustCurve now supports working with FICC_ALPHA channel
-
-November 2, 2003 - 3.0.3
-* [Ryan Rubley] improved makefile for Linux
-* [Ryan Rubley] fixed FreeImage not compiling under MacOSX
-* [Detlev Vendt] fixed still present inconsistancy with 32bpp transparency handling
-* [Herve Drolon] fixed incorrect loading of 4-bit greyscale images in TIFF plugin
-
-October 27, 2003 - 3.0.2
-! FreeImage now uses libMNG 1.0.6
-* [Herve Drolon] fixed a boolean test in PluginCUT returning always false
-* [Herve Drolon] fixed a warning in PluginIFF generated with g++
-* [Linus Tan] fixed a bug in FreeImage_Copy
-* [Herve Drolon] fixed FreeImage not compiling under Linux (thanks to Michal)
-
-October 20, 2003 - 3.0.1
-
-! FreeImage now uses libTIFF 3.6.0
-* [Detlev Vendt] fixed incorrect definition of the FREE_IMAGE_FORMAT enum
-* [Detlev Vendt] fixed a potential crash problem with Load / Save routines
-* [Herve Drolon] fixed incorrect loading of 16-bit greyscale images in TIFF plugin
-* [Dennis Lim] fixed a memory leak in Floyd & Steinberg dithering routine
-* [Herve Drolon] fixed a bug in BMP loader (incorrect loading of RLE4 bmp)
-* [Detlev Vendt] fixed some inconsistancy with 32bpp transparency handling
-+ [David Boland] added a C# wrapper
-// Linux compatibility issues
-- [Michal Novotny] removed the round function in Utilities.h
-! [Herve Drolon] replaced the round routine by the clamp routine in PluginPCD
-+ [Herve Drolon] added _itoa version in Utilities.h
-* [Michal Novotny] fixed untyped consts not accepted by g++ in PluginBMP
-
-September 8, 2003 - 3.0.0
-- [Herve Drolon] removed deprecated functions
-- [Herve Drolon] removed deprecated flags (TARGA_LOAD_RGB555, ICO_*, except ICO_DEFAULT)
-- [Herve Drolon] removed the FreeImage pointer table (internal stuff)
-+ [Herve Drolon] added a C++ wrapper
-+ [Herve Drolon] added the FreeImage Toolkit (see below)
-+ added FreeImage_Rescale
-+ added FreeImage_RotateClassic
-+ added FreeImage_RotateEx
-+ added FreeImage_FlipHorizontal
-+ added FreeImage_FlipVertical
-+ added FreeImage_Invert
-+ added FreeImage_AdjustCurve
-+ added FreeImage_AdjustGamma
-+ added FreeImage_AdjustBrightness
-+ added FreeImage_AdjustContrast
-+ added FreeImage_GetHistogram
-+ added FreeImage_GetChannel
-+ added FreeImage_SetChannel
-+ added FreeImage_Copy
-+ added FreeImage_Paste
-+ [Karl-Heinz Bussian] added XPM loader
-+ [Karl-Heinz Bussian] added flags parameter to FreeImage_CloseMultiBitmap
-+ [Karl-Heinz Bussian] added JPEG save support for 8-bit palettized bitmaps (transparent conversion to 24-bit)
-+ [Herve Drolon] added interface to ZLib compression functions
-+ [Herve Drolon] added ICO format to the multipage API (loader & writer)
-+ [Herve Drolon] added a MIME type to all plugins
-* [Karl-Heinz Bussian] fixed incorrect conversion from 1-bit FIC_MINISWHITE bitmaps to 8-bit
-* [Herve Drolon] fixed a bug in FreeImage_CloseMultiBitmap
-* [Herve Drolon] fixed a potential memory leak in conversion functions (8-, 24-, 32-bit)
-* [Robert Walker] fixed incorrect conversion from 16-bit to 24-bit and 16-bit to 32-bit
-* [blurble] fixed TIFF validate signature problem (3DS files were recognized as TIFF)
-* [Kurt Jankowski-Tepe] fixed FreeImage not compiling on MinGW / LCC WIN32
-* [Jani Peltonen] fixed bug in PluginTARGA where 32-bit bitmaps are not always correctly flipped
-* [Detlev Vendt] fixed a bug with TIFF (memory leak with ICC profiles)
-
-May 25, 2003 - 2.6.1
-+ [Detlev Vendt] added FIC_CMYK to FREE_IMAGE_COLOR_TYPE
-+ [Detlev Vendt] added ICC profile support to the library (see below)
-+ added FreeImage_GetICCProfile
-+ added FreeImage_CreateICCProfile
-+ added FreeImage_DestroyICCProfile
-+ added FIICCPROFILE & FIICCPROFILE flags
-+ added plugin function FreeImage_FIFSupportsICCProfiles
-+ [Detlev Vendt] added ICC profile support for TIFF
-+ [Herve Drolon] added XBM (X11 Bitmap Format) support : loading
-* [Herve Drolon] fixed incorrect IFF file detection (thanks Floris)
-* [Herve Drolon] fixed incorrect conversion from 1/4-bit greyscale bitmaps to 8-bit
-* [Herve Drolon] fixed a bug in TIFF writer when saving 1,4,8 bit dib (introduced in 2.6.0, sorry)
-* [Herve Drolon] fixed a palette problem in TIFF loader when loading 1-bit b & w images
-* [Herve Drolon] improved FreeImage_Dither to handle any bitdepth
-
-May 5th, 2003 - 2.6.0
-! FreeImage now uses libPNG 1.2.5
-! FreeImage now uses libMNG 1.0.5
-! [Markus Loibl] ActiveX wrapper is now distributed in a separate release (since 2.5.5)
-! [Herve Drolon] the function FreeImage_Free is now deprecated : use FreeImage_Unload instead
-! [Herve Drolon] updated the generic samples and removed deprecated functions
-+ [Detlev Vendt] added CMYK support to TIFF save function
-+ [Detlev Vendt] added TIFF_SAVE_CMYK flag constant
-+ [Detlev Vendt] added 32-bit support (with transparency handling) to TIFF plugin
-+ [Herve Drolon] added FreeImage_Threshold
-+ [Herve Drolon] added FreeImage_Dither
-+ [Herve Drolon] added FREE_IMAGE_DITHER parameter to FreeImage_Dither
-* [Herve Drolon] improved error handling in PluginMNG
-* [Herve Drolon] improved TIFF flags handling in TIFF save function
-* [Herve Drolon] fixed a potential crash-problem in FreeImage_OutputMessage (in case of a null message)
-* [Detlev Vendt] fixed a bug with the deprecated FreeImage_GetBitsRowCol (trailling backslash behind the DEPRECATE macro)
-
-July 24th, 2002 - 2.5.5
-! FreeImage now uses libPNG 1.2.4
-! FreeImage now uses libMNG 1.0.4
-+ [Markus Loibl] added ActiveX wrapper
-
-June 22th, 2002 - 2.5.4
-* [Timothy Roughton] fixed FreeImage not compiling on LCC WIN32
-* [Markus Loibl] fixed PluginTIFF sometimes saving with wrong X/Y resolution
-* fixed crashbug when loading some RLE4 BMPs
-! FreeImage now uses LibPNG 1.2.3
-! [Markus Loibl] improved startup plugin locate handling code
-! [Gerhard Gruber] made some changes so that FreeImage compiles on VC5
-+ [Markus Loibl] added flags TIFF_PACKBITS, TIFF_DEFLATE, TIFF_ADOBE_DEFLATE and TIFF_NONE
-
-May 21th, 2002 - 2.5.3
-* fixed wrong colors when loading 16-bit grayscale TIFF
-* fixed crash-problem with FreeImageQt
-* fixed PluginTIFF saving some bitmaps flipped vertically
-* [Laurent Rocher] fixed bug in FreeImage_GetLockedPageNumbers
-* [Laurent Rocher] fixed bug in FreeImage_UnlockPage
-! FreeImage now uses libpng 1.2.2
-+ added TARGA save support
-+ added BMP RLE8 save support
-
-March 30th, 2002 - 2.5.2
-* fixed bug in PluginTARGA where 32-bit bitmaps are not always correctly flipped
-* fixed FreeImage_GetLockedPageNumber being mentioned in FreeImage.h
-* fixed crash bug when handling read-only multipage bitmaps
-- removed internal function FreeImage_GetExtraDataPointer
-! FreeImage now uses zlib 1.1.4
-+ added function FreeImage_GetLockedPageNumbers
-
-March 2nd 2002 - 2.5.1
-* fixed pluginTIFF not being able to save 32-bit bitmaps
-* fixed not being able to save PNM bitmaps through the LoadXXX wrappers
-* fixed a webcam generated BMP image being loaded with wrong colors
-! FI_ReadProc, FI_WriteProc, etc. do now carry the DLL_CALLCONV flag
-! the function FreeImage_GetBitsRowCol is now deprecated
-! FreeImage_SetTransparencyTable now taken an integer as count parameter
-! FreeImage_IsTransparent now always returns true for 32-bit bitmaps
-! PluginPNG::Save now ignores the result of FreeImage_IsTransparent
-! PluginTIFF now converts all 32-bit bitmaps to 24-bit, until our patch
- to fully support alpha in TIFF is applied in libtiff
-+ added full multi-paging support
-+ added octal and hexadecimal number support to FreeImage_OutputMessage
-
-January 3rd 2002 - 2.5.0
-* fixed bug in FreeImage_SaveJPEG
-* fixed bug in FreeImage_LoadMNG
-* fixed bug in FreeImage_LoadPNG
-* fixed small Visual C++ 5.0 compiler issue in PluginMNG.cpp
-* fixed FreeImage crashing on JPEG 6.0 encoded TIFFs
-! FreeImage now uses libTIFF 3.5.7
-! FreeImage now uses libPNG 1.2.1
-! all the FreeImage_LoadXXX and FreeImage_SaveXXX functions are now deprecated
-+ added Dr. Halo (*.cut) support
-+ added printf-like format string support to SetOutputMessage
-+ added basic multi-paging support: open, close, counting and grabbing
-+ added deprecation manager
-+ added FreeImage_Clone function
-
-October 3rd 2001 - 2.4.2
-* fixed missing BI_BITFIELDS support for 32-bit BMPs
-* fixed bug in FreeImage_ConvertLine16_555_To16_565 and vice versa
-* fixed bug in FreeImage_ConvertToRawBits
-* fixed PluginTIFF behaving incorrectly on PHOTOMETRIC_MASK images
-* fixed 16 bit TIFFs not loading correctly
-* fixed incorrect handling of CCITTFAX3 and CCITTFAX4 TIFFs
-* fixed JPEG encoded TIFFs not being supported
-! [Yours Detlev] patched libTIFF to handle EXTRASAMPLE_UNSPECIFIED
-! [Juergen Riecker] improved speed of PCX loading a lot
-! rewrote parts of FreeImage to improve support for c
-! the internal RGB555 and RGB565 macros now read BGR instead of RGB
-! FreeImage now uses libMNG 1.0.3
-! FreeImage now uses libPNG 1.2.0
-! FreeImage_Save now opens files with the "w+b" flag
-! renamed internal macro CalculateUsedColors to CalculateUsedPaletteEntries
-! enabling/disabling plugins no longer has effect on FIFSupportsReading
-! enabling/disabling plugins no longer has effect on FIFSupportsWriting
-+ added flag PNG_IGNOREGAMMA
-+ added function FreeImage_FIFSupportsExportBPP
-
-July 30th 2001 - 2.4.1
-* [Jan Nauta] fixed some plugin ids not being passed to plugins
-* [Jan Nauta] fixed some functions being natively called instead of indirect
-* [Jan Nauta] fixed BMPs with signature BA not being regognised
-* [Remo Eichenberger] fixed memory leak in the plugin system
-* fixed seek bug in PluginIFF's Validate
-* fixed transparency issue in PluginPNG
-* fixed uncaught exceptions in WUQuantizer and NNQuantizer
-* fixed some problems with PluginTARGA
-* fixed some problems with PluginICO
-* fixed some problems with PluginBMP
-! improved FreeImageQt's load function a little
-! tell/seek control for validation is now handled inside the plugin framework
-
-July 22th 2001 - 2.4.0
-* (Yours Detlev) fixed memory leak in FreeImage_GetFIFFromFilename
-* (Yours Detlev) fixed memory leak in the ICO plugin
-* (Yours Detlev) fixed memory leak in the PNG plugin
-* fixed potential NULL-pointer access bug in Plugin::AddNode
-* fixed problems with linking the static lib
-- removed LBM plugin. Its functionality is placed in the IFF plugin now
-- removed FreeImage_GetFIFByIndex
-! FreeImage now uses LibMNG 1.0.2
-! FreeImage_SetTransparent now only enables alpha when the bitmap is 8 or 32 bit
-! FreeImage_SetTransparencyTable now only enables alpha when the bitmap is 8 bit
-! FreeImage_LoadLBM now uses Mark Sibly's IFF plugin
-! FreeImage_SaveBMP now converts to 24-bit when bpp is 32 and transparency is off
-! FreeImage_SaveJPEG now converts to 24-bit when bpp is 32 and transparency is off
-! FreeImage_SavePNM now converts to 24-bit when bpp is 32 and transparency is off
-! FreeImage_SaveTIFF now converts to 24-bit when bpp is 32 and transparency is off
-+ [Mark Sibly] added IFF (ILBM) support
-+ added basic support for Photoshop files
-+ added mime type support (FreeImage_GetFIFFromMime)
-+ added functions FreeImage_SetPluginEnabled and FreeImage_IsPluginEnabled
- Disabling plugins modifies the behaviour of the following functions:
- * FreeImage_LoadFromHandle
- * FreeImage_SaveToHandle
- * FreeImage_FIFSupportsReading
- * FreeImage_FIFSupportsWriting
- * FreeImage_GetFIFFromFormat
- * FreeImage_GetFIFFromFilename
- * FreeImage_GetFIFFromMime
- * FreeImage_Validate
-
-June 30th 2001 - 2.3.2
-* fixed missing "targa" extension in targa extension list
-* fixed small memory leak in PluginList::AddNode
-* fixed 32 bit PNG saving suddenly disappeared from the distro?
-* fixed 'black line' bug in LoadTARGA
-- removed project FreeImageM2
-- removed FreeImage_Combine
-! FreeImage_RegisterLocalPlugin now receives a FI_InitProc as first parameter
-! FreeImage_GetFIFFromFilename now also takes the format id into account
-! cleanup up the code a little for PluginPCD and PluginPCX
-+ added static lib project
-
-June 11th 2001 - 2.3.1
-* [Machiel ten Brinke] fixed the loading of some 'ancient' TARGAs
-* [Rui Lopes] fixed some bugs in the external plugin registration
-* fixed the plugin system crashing when the init function isn't called
-- removed project FreeImagePy
-- removed 32 to 24 bit conversion while saving PNG in FreeImageQt
-! the scanline convert functions are now accessable in plugins
-! FreeImage now uses an STL map to store the plugin list
-! PluginSDK.h is now integrated into FreeImage.h
-! FreeImage_Register now receives the boolean parameter 'load_local_plugins_only'
-! FreeImage now uses LibPNG 1.0.12
-+ [Rui Lopes] added plugin for GIF reading/writing support
-+ added function FreeImage_SetTransparencyCount
-+ added support for 32 bit PNG saving
-+ added FreeImage_RegisterLocalPlugin to allow plugins inside apps
-+ added FreeImage_RegisterExternalPlugin to manually load DLLs
-+ added plugin for JBIG reading/writing support
-
-May 4th 2001 - 2.3.0
-* [Martin Weber] fixed some small bugs in the TARGA and BMP plugins
-* [Martin Weber] fixed tiny bug in new 16 bit conversions
-* [Martin Weber] fixed load flag inconsistency in the TARGA plugin
-* [Martin Weber] fixed plugin id / load reference inconsistency for PNM
-* [Jan Nauta] fixed bug in conversion 16 -> 16
-* [Herve Drolon] fixed small bug in 4-bit PCX loader
-- removed code that loads BMPs renamed to ICO in PluginICO
-! the flag TARGA_LOAD_RGB555 is now obsolete
-! the plugin list is now sorted internally
-! ConvertTo32Bits now stores the transparency table as alpha mask
-! FreeImage now uses LibMNG 1.0,1
-! FreeImage now uses LibPNG 1.0.11
-+ added external plugin support via DLLs
-+ added function FreeImage_GetFIFByIndex
-+ added internal function CalculateScanLine
-+ added transparency support for high-color PNGs
-+ added transparency support for high-color TIFFs
-+ added functions FreeImage_SetTransparent and FreeImage_IsTransparent
-+ added constant FIC_RGBALPHA to FREE_IMAGE_COLOR_TYPE
-
-April 5th 2001 - 2.2.0
-* [Remo Eichenberger] fixed small bug concerning DLLMain and static LIB generation
-* fixed 1-bit bitmaps not properly loading in FreeImageQt
-* fixed bug in conversion 16->16
-* FreeImage now uses LibPNG 1.0.10
-! [Martin Weber] improved loading of BMP files
-! [Martin Weber] improved loading of TARGA files
-! [Dave Larson] improved visual appearance after 16 conversions
-! FreeImageQt now converts 32-bit bitmaps to 24-bit when saving PNGs and JPEGs
-+ added functions FreeImage_Initialise and FreeImage_DeInitialise
-+ added internal plugins
-+ re-added combine/alphablend functions
-
-March 8th 2001 - 2.1.0
-* [Martin Hemming] fixed bug in 16-bit TARGA loading code
-* fixed PNG's with alpha masks not loading correctly
-! FreeImage is now dual-licensed: the FI-License and the GPL license
-! FreeImage now uses LibPNG 1.0.9
-! FreeImage now uses LibTIFF 3.5.6 Beta
-! FreeImage now uses LiBMNG 1.0.0
-! changed the ordering of the FREE_IMAGE_FORMAT table
-! improved linux support
-! improved test script
-+ added transparency table support to SavePNG
-+ added BI_BITFIELDS support to LoadBMP and SaveBMP
-+ added reading support for OS/2 2.x BMPs
-+ added support for MNG and JNG reading using LibMNG
-+ added support for Deluxe Paint reading
-+ added 'hot swap' support to the Core DLL
-+ added 'hot swap' support to FreeImage Qt
-+ added functions GetFIFFromFormat and GetFIFFromFilename
-+ added functions FIFSupportsReading and FIFSupportsWriting
-+ added function GetFIFRegExpr
-
-January 14th 2001 - 2.0.0
-* [Herve Drolon] fixed a bug in the conversion 4->8
-* [Herve Drolon] fixed a bug in metrics handling in SaveJPEG
-* [Herve Drolon] fixed a bug in the return value of the function SaveTIFF
-* fixed the presence of two WuQuantizer.cpp files in the distribution
-* fixed bug where a BMP renamed to ICO isn't loaded
-- removed FreeImage_ConvertToGreyScale. Use FreeImage_ConvertTo8Bits instead.
-- removed the boolean parameters from all conversion routines
-- removed page handling in LoadTIFF. A new range of functions will be added.
-! The void pointers used in FreeImage are now typed
-! LoadBMP now takes palettes in 24/32 bit images in respect
-! All effects and MMX functions are now stored in a new library (FreeEffects)
-! [Herve Drolon] fixed bug in FreeImage_GetColorType
-! [Herve Drolon] improved PCX loader. It can now read 1, 4, 8 and 24-bit images
-! [Manfred Tausch] improved FreeImage_Rotate
-! [Luca Piergentili] fixed crash bug when saving some 1-bit TIFFs
-! rewrote all bitdepth conversion routines making use of the new scanline converters
-! rewrote bitdepth conversion in FreeImageQt (uses less memory)
-! FreeImage is now compiled __stdcall
-+ [Herve Drolon] added WBMP (Wireless Bitmap Format) support: loading and saving
-+ [Herve Drolon] added 4, 16 and 32 bitdepth handling in GetColorType
-+ [Herve Drolon] added handling of 8-bit greyscale bitmaps in SaveJPEG
-+ [Herve Drolon] added NeuQuant color reduction algorithm to ColorQuantize
-+ added DLL_CALLCONV (calling convention) flag
-+ added bitmask support to all bitmaps
-+ added a series of functions converting scanlines from one bitdepth to another
-+ added functions ConvertFromRawBits and ConvertToRawBits
-+ added project FreeImageM2: Magenta II MMT bindings for FreeImage
-+ added basic foundation for linux support
-
-December 2th 2000 - 1.4.4
-* fixed small bug related to TIFFSetDirectory in FreeImage_LoadTIFF
-* fixed FreeImage_Rotate sometimes clipping too much pixels
-* fixed other small bug in FreeImage_Rotate
-* fixed FreeImage_Clone not taking the FREEIMAGEHEADER in account
-* fixed bug in FreeImageQt where 1-bit images are not correctly allocated
-* fixed FreeImage_Crop not copying the palette
-* fixed message function pointer crash bug
-* fixed bug where the palette wasn't copied when saving in FreeImageQt
-* fixed FreeImage_Clone not copying the transparency table
-- removed FreeImage_WritePaletteEntry
-! [Adam Gates] rewrote parts of FreeImage so that c compilers can handle it better
-! FreeImageQt doesn't statically link with the FreeImage lib anymore
-! FreeImageQt now uses atexit() to automatically unregister
-! rewrote parts of FreeImage_LoadBMP to increase speed
-+ [Markus Loibl] added metrics handling code to LoadBMP, LoadJPEG, LoadTIFF and LoadPCX
-+ added metrics handling code to FreeImageQt
-+ added functions FIQT_IsLoaded, FIQT_GetVersion and FIQT_GetCopyrightMessage
-+ added conversion 1 -> 16
-+ added FreeImage_SaveJPEG and JPEG quality settings
-+ added FreeImage_GetBitsRowCol
-+ added function FIQT_SetOutputMessage to FreeImageQt
-+ added FreeImage_GetFileTypeFromExtension and FIQT_GetFileTypeFromFormat
-+ added project FreeImagePy: python bindings for FreeImage
-
-November 7th 2000 - 1.4.3
-* fixed FreeImage_SavePNG crash bug
-* fixed slighly corrupt size filter in FreeImage_Combine
-* fixed FreeImage_SaveTIFF not saving 4-bit images
-* [Herve Drolon] fixed bug in FreeImage_LoadTIFF
-* [Herve Drolon] fixed bug in FreeImage_GetColorType
-- removed fclose from FreeImage_SavePNM (who put it there?)
-! rewrote FreeImage_Rotate
-! FreeImageQt now automatically detects which formats are supported by Qt and which not
-! FreeImage_Allocate now returns a void pointer
-! FreeImage_Unload is now called FreeImage_Free
-+ added 16-bit 5-5-5 support to FreeImage_LoadBMP
-+ added RLE_DELTA support to FreeImage_LoadBMP
-+ added directory support to FreeImage_LoadTIFF
-+ added functions dealing with transparency
-+ added transparency support to 8-bit PNG's in Qt
-+ added FREE_IMAGE_QUANTIZE parameter to FreeImage_ColorQuantize
-+ added custom FREEIMAGEHEADER header prepended to internal bitmaps
-+ added new documentation
-
-October 18th 2000 - 1.4.2
-* fixed FreeImage_SaveBMP storing an incorrect bfSize value in the BITMAPFILEHEADER
-* fixed bug where JPEG and PNG wouldn't load in FreeImageQt
-* fixed FreeImage_Mirror mirroring one pixel less than needed
-! FreeImage_MaskedCombine24 is now called FreeImage_MaskedCombine24Ex
-! FreeImage_MaskedCombine32 is now called FreeImage_MaskedCombine32Ex
-+ added 16-bit bitmap support to FreeImage_Mirror
-+ added 16-bit bitmap support to FreeImage_ConvertTo8Bits
-+ added simple version of FreeImage_MaskedCombine24
-+ added simple version of FreeImage_MaskedCombine32
-
-October 17th 2000 - 1.4.1
-* [Herve Drolon] fixed bug in FreeImage_ConvertTo8Bits
-* fixed bug in conversion with 16 -> 24 and 16 -> 32
-- removed static library support
-- removed all unnecessary files from LibTIFF, LibPNG, LibJPEG and ZLib
-- removed all absolute seeks from the library
-! FreeImageQt now makes use of the DLL distro
-! rebuilt the entire directory structure
-! improved handling of BMP
-! renamed FreeImage_MaskedCombine to FreeImage_MaskedCombine32
-+ [Alexander Dymerets] added 24-bit masked alpha blending with a seperate alpha mask
-+ added FreeImage_Rotate (known bug in degrees 76 to 106)
-+ added 4-bit bitmap support to FreeImage_ConvertTo16Bits
-+ added 8-bit bitmap support to FreeImage_ConvertTo16Bits
-+ added 32-bit bitmap support to FreeImage_ConvertTo16Bits
-+ added 32-bit bitmap support to FreeImage_Mirror
-+ added 16-bit 5-5-5 support to FreeImage_ConvertTo24Bits
-+ added 16-bit 5-5-5 support to FreeImage_ConvertTo32Bits
-
-October 2th 2000 - 1.4.0
-* [Jani Kajala] fixed bug in conversion with 4 -> 24 and 8 -> 32
-* [Jani Kajala] fixed bug in FreeImage_Flip
-* [Jani Kajala] fixed minor bug in FreeImage_LoadBMP
-- [Herve Drolon] removed PBMFlags, PGMFlags and PPMFlags
-- [Herve Drolon] removed FI_LoadGeneric
-- removed FreeImage_Win32.h
-! [Herve Drolon] changed FI_GetFileType
-! [Herve Drolon] replaced FI_LoadPBM, FI_LoadPGM and FI_LoadPPM with FI_LoadPNM
-! [Herve Drolon] improved FreeImage_LoadPNG
-! FreeImage_WritePaletteEntry is now exported
-+ [Herve Drolon] added FreeImage_SavePNG
-+ [Herve Drolon] added FreeImage_SavePNM and PNMFlags
-+ [Herve Drolon] added XXXFlags parameter to save functions
-+ [Herve Drolon] added FreeImage_LoadRAS and FIF_RAS
-+ added FreeImage_GetFileTypeFromExt
-
-September 7th 2000 - 1.3.5
-+ added conversion 4 -> 8 to FI_ConvertTo8Bits
-+ added simple version of FI_GetFileType
-+ added project FreeImageQt; a port of the library to the TrollTech library
-
-August 31th 2000 - 1.3.4
-* fixed 'ice effect' bug in new 24 bit PCX code
-* fixed some bugs with the conversion 16 -> 24 and 16 -> 32
-! FI_Blur now returns void
-! A debug build of the library now produces FreeImaged.dll and FreeImaged.lib
-! TARGA_LOAD_ARGB8888 is now called TARGA_LOAD_RGB888
-! Alpha channels are now automatically loaded unless TARGA_LOAD_RGB888 is specified
-! cleaned up the code a lot
-+ added 32-bit bitmap support to FreeImage_ConvertToGreyscale
-+ added support for 32-bit bottom-left TARGA images
-+ added internal functions FreeImage_WritePaletteEntry() and FreeImage_GetScanLine()
-+ added FreeImage_Win32.h, containing Windows functions needed to create DIBs
-+ added documentation through Doxygen
-
-July 30th 2000 - 1.3.3
-* [Jani Kajala] fixed some bugs with the conversion 4 -> 24 and 8 -> 24
-* [Jani Kajala] fixed some bugs with the conversion 4 -> 32 and 8 -> 32
-* fixed bug in FI_LoadPNM's ASCII number loader
-! [Herve Drolon] improved FI_LoadPNG
-! [Herve Drolon] changed FI_ConvertToGreyScale (added changeable macro for conversion)
-! improved FI_ConvertTo24Bits
-! improved FI_ConvertTo32Bits
-! freeImage now uses LibPNG 1.0.8
-+ [Herve Drolon] added FI_ColorQuantize, based on Wu's color quantizer
-+ added the conversion 1 -> 24
-+ added the conversion 1 -> 32
-+ added FI_ConvertTo8Bits
-+ added FI_Invert (very useful for image processing)
-+ added FI_GetColorType and 'enum FREE_IMAGE_COLOR_TYPE'
-
-June 30th 2000 - 1.3.2
-- removed color reduction functions from the project
-! [Herve Drolon] Improved FI_LoadTIFF code
-! renamed FI_ToGrayscale to FI_ConvertToGreyScale
-! renamed FI_IncreaseColors to FI_ConvertTo24Bits
-! LoadBMP now supports 32-bit bitmaps
-! [Jani Kajala] Improved FI_LoadTARGA and FI_LoadPCX code
-+ added FI_ConvertTo32Bits to convert a bitmap to 32-bit
-+ added FI_MaskCombine to combine two 32-bit bitmaps using a alpha mask
-+ added FI_AddAlphaMask to enrich a 32-bit bitmap with an alpha mask
-+ added FI_SaveTIFF
-+ added 16-bit bitmap (565) support to the ConvertToXXX functions.
-+ added FI_ConvertTo16Bits (555 and 565)
-
-June 1th 2000 - 1.3.1
-- removed Standard Template Library (STL) code
-* [Jani Kajala] fixed minor bug in FI_LoadTARGA
-* [Jani Kajala] fixed some minor bugs in FI_LoadPCX
-! streamlined FI_LoadJPEG a little
-! FreeImage now uses LibPNG 1.0.6
-! FreeImage now uses LibTIFF 3.5.5
-! FreeImage now uses malloc and free instead of new and delete
-+ introduced compiler flags to disable certain features in the DLL
-+ added experimental nearest color reduction (FI_ReduceColorsNearestColor)
-
-April 13th 2000 - 1.3.0
-* fixed some 8 bit PCX files loading incorrectly
-* fixed tiny bug in internally used CalculateUsedColors function
-- removed FI_SaveXPM. Only BMP is supported now.
-- removed Windows dependencies for easier porting
-! optimized FI_LoadKOALA a little
-! optimized FI_Combine using MMX technology
-! FI_Combine now receives an 'unsigned integer' as alpha blend parameter
-! FI_InCreaseColors and FI_ReduceColors don't dispose the old bitmap anymore
-+ added PNM support (PGM, PPM and PBM; both binary and ascii)
-+ [Alexander Dymerets] added FI_EnableMMX and FI_DisableMMX
-+ added various effect functions (FI_Blur, FI_Brighten and FI_Crop)
-
-March 1st 2000 - 1.2.1
-* fixed some 24 bit PCX files loading incorrectly
-
-February 8th 2000 - 1.2.0
-* fixed last bitmap data block in JPEG files being truncated
-* fixed 4/8 bit BMP's incorrectly loading when the palette is smaller than the bitcount predicts
-- removed FI_Load. There is no reliable way to identify all image formats
-- removed FI_SetJpegDecodeMode.
- Mode selection is now done using the 'DataEnum data' parameter of FI_LoadJPEG
-! read_proc/write_proc/tell_proc in FreeImageIO now are same as fread/fwrite/ftell
-+ added a 'DataEnum data' parameter to all FI_LoadXXX functions.
-+ added 16 bit TARGA support
-+ added RLE support for TARGA images
-+ added FI_GetDIBSize to get the size of a DIB in bytes
-+ added Kodak PhotoCD support (Base, Base/4 and Base/16 encoding)
-+ added KOALA support
-+ added FI_GetFileType. Note: there is no reliable way to identify TARGA, ICO and PCD. Therefore they have been excluded
-In KOALA files only the files converted by a C64 emulator can be identified.
-+ added FI_Combine to combine two 24-bit bitmaps with (optional) alpha blending
-
-January 15th 2000 - 1.1.1
-! FI_Copy is now called FI_Clone
-+ added FI_ToGrayscale to convert a color bitmap to grayscale
-+ added 32 bit TARGA support
-+ added FI_IncreaseColors to increase the bitmap bitdepth from 4/8 bit to 24 bit
-
-January 14th 2000 - 1.1.0
-* FI_MIRROR: fixed nibbles not being mirrored in 4 bit images
-* FI_MIRROR: fixed bits not being mirrored in 1 bit images
-* fixed improper loading of 1, 4 and 8 bit OS/2 BMP's
-* fixed some inconsistensies in the calculation of lines and pitches
-* fixed incorrectly loading of Huffman and FAX encoded TIFFs
-* fixed LoadTGA accepting 16 bit TGA's and returning corrupt DIB's
-- removed LZW support for TIFFs
-! FreeImage now uses LibTIFF 3.5.4
-+ added ICO support
-+ added overridable file I/O support in the form of FreeImageIO and fi_handle
-+ added FI_Load for generic image loading
-+ added FI_ReduceColors for color reduction
-+ added FI_Copy to copy a bitmap in memory
-
-January 5th 2000 - 1.0.0
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/license-fi.txt b/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/license-fi.txt
deleted file mode 100644
index 479fb4d5..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/license-fi.txt
+++ /dev/null
@@ -1,142 +0,0 @@
-FreeImage Public License - Version 1.0
----------------------------------------------
-
-1. Definitions.
-
-1.1. "Contributor" means each entity that creates or contributes to the creation of Modifications.
-
-1.2. "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor.
-
-1.3. "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof.
-
-1.4. "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data.
-
-1.5. "Executable" means Covered Code in any form other than Source Code.
-
-1.6. "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A.
-
-1.7. "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License.
-
-1.8. "License" means this document.
-
-1.9. "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a
-Modification is:
-
-A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications.
-
-B. Any new file that contains any part of the Original Code or previous Modifications.
-
-1.10. "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License.
-
-1.11. "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control
-compilation and installation of an Executable, or a list of source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge.
-
-1.12. "You" means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the
-direction or management of such entity, whether by contract or otherwise, or (b) ownership of fifty percent (50%) or more of the outstanding shares or beneficial ownership of such entity.
-
-2. Source Code License.
-
-2.1. The Initial Developer Grant.
-The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
-
-(a) to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, or as part of a Larger Work; and
-
-(b) under patents now or hereafter owned or controlled by Initial Developer, to make, have made, use and sell ("Utilize") the Original Code (or portions thereof), but solely to the extent that
-any such patent is reasonably necessary to enable You to Utilize the Original Code (or portions thereof) and not to any greater extent that may be necessary to Utilize further Modifications or
-combinations.
-
-2.2. Contributor Grant.
-Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
-
-(a) to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code or as part of a Larger Work; and
-
-(b) under patents now or hereafter owned or controlled by Contributor, to Utilize the Contributor Version (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Contributor Version (or portions thereof), and not to any greater extent that
-may be necessary to Utilize further Modifications or combinations.
-
-3. Distribution Obligations.
-
-3.1. Application of License.
-The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or
-restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5.
-
-3.2. Availability of Source Code.
-Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party.
-
-3.3. Description of Modifications.
-You must cause all Covered Code to which you contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code.
-
-3.4. Intellectual Property Matters
-
-(a) Third Party Claims.
-If You have knowledge that a party claims an intellectual property right in particular functionality or code (or its utilization under this License), you must include a text file with the source code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If you obtain such knowledge after You make Your Modification available as described in Section 3.2, You shall promptly modify the LEGAL file in all copies You make
-available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained.
-
-(b) Contributor APIs.
-If Your Modification is an application programming interface and You own or control patents which are reasonably necessary to implement that API, you must also include this information in the LEGAL file.
-
-3.5. Required Notices.
-You must duplicate the notice in Exhibit A in each file of the Source Code, and this License in any documentation for the Source Code, where You describe recipients' rights relating to Covered Code. If You created one or more Modification(s), You may add your name as a Contributor to the notice described in Exhibit A. If it is not possible to put such notice in a particular Source Code file due to its
-structure, then you must include such notice in a location (such as a relevant directory file) where a user would be likely to look for such a notice. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or
-liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of
-warranty, support, indemnity or liability terms You offer.
-
-3.6. Distribution of Executable Versions.
-You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You
-describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code under a license of Your choice, which may contain terms different from this License,
-provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.
-
-3.7. Larger Works.
-You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code.
-
-4. Inability to Comply Due to Statute or Regulation.
-
-If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.
-
-5. Application of this License.
-
-This License applies to code to which the Initial Developer has attached the notice in Exhibit A, and to related Covered Code.
-
-6. Versions of the License.
-
-6.1. New Versions.
-Floris van den Berg may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number.
-
-6.2. Effect of New Versions.
-Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Floris van den Berg
-No one other than Floris van den Berg has the right to modify the terms applicable to Covered Code created under this License.
-
-6.3. Derivative Works.
-If you create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), you must (a) rename Your license so that the phrases "FreeImage", `FreeImage Public License", "FIPL", or any confusingly similar phrase do not appear anywhere in your license and (b) otherwise make it clear that your version of the license contains terms which differ from the FreeImage Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.)
-
-7. DISCLAIMER OF WARRANTY.
-
-COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
-
-8. TERMINATION.
-
-This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.
-
-9. LIMITATION OF LIABILITY.
-
-UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
-EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
-
-10. U.S. GOVERNMENT END USERS.
-
-The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein.
-
-11. MISCELLANEOUS.
-
-This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by Dutch law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in, the The Netherlands: (a) unless otherwise agreed in writing, all disputes relating to this License (excepting any dispute relating to intellectual property rights) shall be subject to final and binding arbitration, with the losing party paying all costs of arbitration; (b) any arbitration relating to this Agreement shall be held in Almelo, The Netherlands; and (c) any litigation relating to this Agreement shall be subject to the jurisdiction of the court of Almelo, The Netherlands with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys fees and expenses. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License.
-
-12. RESPONSIBILITY FOR CLAIMS.
-
-Except in cases where another Contributor has failed to comply with Section 3.4, You are responsible for damages arising, directly or indirectly, out of Your utilization of rights under this License, based
-on the number of copies of Covered Code you made available, the revenues you received from utilizing such rights, and other relevant factors. You agree to work with affected parties to distribute
-responsibility on an equitable basis.
-
-EXHIBIT A.
-
-"The contents of this file are subject to the FreeImage Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://home.wxs.nl/~flvdberg/freeimage-license.txt
-
-Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. \ No newline at end of file
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/license-gpl.txt b/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/license-gpl.txt
deleted file mode 100644
index 1bcc46f5..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/FreeImage/license-gpl.txt
+++ /dev/null
@@ -1,342 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program 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 of the License, or
- (at your option) any later version.
-
- This program 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 this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/CMakeLists.txt b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/CMakeLists.txt
deleted file mode 100644
index a77e9a56..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-
-INSTALL(PROGRAMS
- bin/jpeg62.dll
- bin/libpng12.dll
- bin/libtiff3.dll
- bin/zlib1.dll
- DESTINATION bin)
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/jpeg62.dll b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/jpeg62.dll
deleted file mode 100644
index 21c03d55..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/jpeg62.dll
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/libpng12.dll b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/libpng12.dll
deleted file mode 100644
index c3aa866c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/libpng12.dll
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/libtiff3.dll b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/libtiff3.dll
deleted file mode 100644
index 9883c51a..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/libtiff3.dll
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/zlib1.dll b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/zlib1.dll
deleted file mode 100644
index 31996cd3..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/bin/zlib1.dll
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jconfig.h b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jconfig.h
deleted file mode 100644
index 160c978a..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jconfig.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* jconfig.h. Generated automatically by configure. */
-/* jconfig.cfg --- source file edited by configure script */
-/* see jconfig.doc for explanations */
-
-#define HAVE_PROTOTYPES
-#define HAVE_UNSIGNED_CHAR
-#define HAVE_UNSIGNED_SHORT
-
-#ifdef _WIN32
-# include <windows.h>
-/* Define "boolean" as unsigned char, not int, per Windows custom */
-# if !defined __RPCNDR_H__ || defined __MINGW32__ /* don't conflict if rpcndr.h already read */
-# ifndef boolean /* don't conflict if rpcndr.h already read */
- typedef unsigned char boolean;
-# endif /* boolean */
-# endif /* __RPCNDR_H__ */
-# define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
-# define USE_WINDOWS_MESSAGEBOX 1
-#endif /* _WIN32 */
-
-#undef void
-#undef const
-#undef CHAR_IS_UNSIGNED
-#define HAVE_STDDEF_H
-#define HAVE_STDLIB_H
-#undef NEED_BSD_STRINGS
-#undef NEED_SYS_TYPES_H
-#undef NEED_FAR_POINTERS
-#undef NEED_SHORT_EXTERNAL_NAMES
-/* Define this if you get warnings about undefined structures. */
-#undef INCOMPLETE_TYPES_BROKEN
-
-#ifdef JPEG_INTERNALS
-
-#undef RIGHT_SHIFT_IS_UNSIGNED
-#define INLINE __inline__
-/* These are for configuring the JPEG memory manager. */
-#undef DEFAULT_MAX_MEM
-#undef NO_MKTEMP
-
-#endif /* JPEG_INTERNALS */
-
-#ifdef JPEG_CJPEG_DJPEG
-
-#define BMP_SUPPORTED /* BMP image file format */
-#define GIF_SUPPORTED /* GIF image file format */
-#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
-#define RLE_SUPPORTED /* Utah RLE image file format */
-#define TARGA_SUPPORTED /* Targa image file format */
-
-#undef TWO_FILE_COMMANDLINE
-#undef NEED_SIGNAL_CATCHER
-#undef DONT_USE_B_MODE
-
-/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
-#undef PROGRESS_REPORT
-
-#endif /* JPEG_CJPEG_DJPEG */
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jerror.h b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jerror.h
deleted file mode 100644
index fcdf6a83..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jerror.h
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * jerror.h
- *
- * Copyright (C) 1994-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file defines the error and message codes for the JPEG library.
- * Edit this file to add new codes, or to translate the message strings to
- * some other language.
- * A set of error-reporting macros are defined too. Some applications using
- * the JPEG library may wish to include this file to get the error codes
- * and/or the macros.
- */
-
-/*
- * To define the enum list of message codes, include this file without
- * defining macro JMESSAGE. To create a message string table, include it
- * again with a suitable JMESSAGE definition (see jerror.c for an example).
- */
-#ifndef JMESSAGE
-#ifndef JERROR_H
-/* First time through, define the enum list */
-#define JMAKE_ENUM_LIST
-#else
-/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
-#define JMESSAGE(code,string)
-#endif /* JERROR_H */
-#endif /* JMESSAGE */
-
-#ifdef JMAKE_ENUM_LIST
-
-typedef enum {
-
-#define JMESSAGE(code,string) code ,
-
-#endif /* JMAKE_ENUM_LIST */
-
-JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
-
-/* For maintenance convenience, list is alphabetical by message code name */
-JMESSAGE(JERR_ARITH_NOTIMPL,
- "Sorry, there are legal restrictions on arithmetic coding")
-JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
-JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
-JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
-JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
-JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request")
-JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
-JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported")
-JMESSAGE(JERR_BAD_DROP_SAMPLING,
- "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c")
-JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")
-JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace")
-JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace")
-JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length")
-JMESSAGE(JERR_BAD_LIB_VERSION,
- "Wrong JPEG library version: library is %d, caller expects %d")
-JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan")
-JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d")
-JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d")
-JMESSAGE(JERR_BAD_PROGRESSION,
- "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d")
-JMESSAGE(JERR_BAD_PROG_SCRIPT,
- "Invalid progressive parameters at scan script entry %d")
-JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors")
-JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d")
-JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d")
-JMESSAGE(JERR_BAD_STRUCT_SIZE,
- "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u")
-JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access")
-JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small")
-JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here")
-JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet")
-JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d")
-JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request")
-JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d")
-JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x")
-JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d")
-JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d")
-JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)")
-JMESSAGE(JERR_EMS_READ, "Read from EMS failed")
-JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed")
-JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan")
-JMESSAGE(JERR_FILE_READ, "Input file read error")
-JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?")
-JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet")
-JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow")
-JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry")
-JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels")
-JMESSAGE(JERR_INPUT_EMPTY, "Empty input file")
-JMESSAGE(JERR_INPUT_EOF, "Premature end of input file")
-JMESSAGE(JERR_MISMATCHED_QUANT_TABLE,
- "Cannot transcode due to multiple use of quantization table %d")
-JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data")
-JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")
-JMESSAGE(JERR_NOTIMPL, "Not implemented yet")
-JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time")
-JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported")
-JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined")
-JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image")
-JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined")
-JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x")
-JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)")
-JMESSAGE(JERR_QUANT_COMPONENTS,
- "Cannot quantize more than %d color components")
-JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors")
-JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
-JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers")
-JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker")
-JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
-JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers")
-JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF")
-JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
-JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file")
-JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file")
-JMESSAGE(JERR_TFILE_WRITE,
- "Write failed on temporary file --- out of disk space?")
-JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines")
-JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x")
-JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up")
-JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation")
-JMESSAGE(JERR_XMS_READ, "Read from XMS failed")
-JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed")
-JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT)
-JMESSAGE(JMSG_VERSION, JVERSION)
-JMESSAGE(JTRC_16BIT_TABLES,
- "Caution: quantization tables are too coarse for baseline JPEG")
-JMESSAGE(JTRC_ADOBE,
- "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d")
-JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u")
-JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u")
-JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x")
-JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x")
-JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d")
-JMESSAGE(JTRC_DRI, "Define Restart Interval %u")
-JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u")
-JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u")
-JMESSAGE(JTRC_EOI, "End Of Image")
-JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d")
-JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d")
-JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,
- "Warning: thumbnail image size does not match data length %u")
-JMESSAGE(JTRC_JFIF_EXTENSION,
- "JFIF extension marker: type 0x%02x, length %u")
-JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image")
-JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u")
-JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")
-JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u")
-JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors")
-JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors")
-JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization")
-JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d")
-JMESSAGE(JTRC_RST, "RST%d")
-JMESSAGE(JTRC_SMOOTH_NOTIMPL,
- "Smoothing not supported with nonstandard sampling ratios")
-JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d")
-JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d")
-JMESSAGE(JTRC_SOI, "Start of Image")
-JMESSAGE(JTRC_SOS, "Start Of Scan: %d components")
-JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d")
-JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d")
-JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s")
-JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s")
-JMESSAGE(JTRC_THUMB_JPEG,
- "JFIF extension marker: JPEG-compressed thumbnail image, length %u")
-JMESSAGE(JTRC_THUMB_PALETTE,
- "JFIF extension marker: palette thumbnail image, length %u")
-JMESSAGE(JTRC_THUMB_RGB,
- "JFIF extension marker: RGB thumbnail image, length %u")
-JMESSAGE(JTRC_UNKNOWN_IDS,
- "Unrecognized component IDs %d %d %d, assuming YCbCr")
-JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u")
-JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u")
-JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d")
-JMESSAGE(JWRN_BOGUS_PROGRESSION,
- "Inconsistent progression sequence for component %d coefficient %d")
-JMESSAGE(JWRN_EXTRANEOUS_DATA,
- "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x")
-JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment")
-JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code")
-JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d")
-JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file")
-JMESSAGE(JWRN_MUST_RESYNC,
- "Corrupt JPEG data: found marker 0x%02x instead of RST%d")
-JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG")
-JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines")
-
-#ifdef JMAKE_ENUM_LIST
-
- JMSG_LASTMSGCODE
-} J_MESSAGE_CODE;
-
-#undef JMAKE_ENUM_LIST
-#endif /* JMAKE_ENUM_LIST */
-
-/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
-#undef JMESSAGE
-
-
-#ifndef JERROR_H
-#define JERROR_H
-
-/* Macros to simplify using the error and trace message stuff */
-/* The first parameter is either type of cinfo pointer */
-
-/* Fatal errors (print message and exit) */
-#define ERREXIT(cinfo,code) \
- ((cinfo)->err->msg_code = (code), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT1(cinfo,code,p1) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT2(cinfo,code,p1,p2) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (cinfo)->err->msg_parm.i[1] = (p2), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT3(cinfo,code,p1,p2,p3) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (cinfo)->err->msg_parm.i[1] = (p2), \
- (cinfo)->err->msg_parm.i[2] = (p3), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT4(cinfo,code,p1,p2,p3,p4) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (cinfo)->err->msg_parm.i[1] = (p2), \
- (cinfo)->err->msg_parm.i[2] = (p3), \
- (cinfo)->err->msg_parm.i[3] = (p4), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT6(cinfo,code,p1,p2,p3,p4,p5,p6) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (cinfo)->err->msg_parm.i[1] = (p2), \
- (cinfo)->err->msg_parm.i[2] = (p3), \
- (cinfo)->err->msg_parm.i[3] = (p4), \
- (cinfo)->err->msg_parm.i[4] = (p5), \
- (cinfo)->err->msg_parm.i[5] = (p6), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXITS(cinfo,code,str) \
- ((cinfo)->err->msg_code = (code), \
- strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-
-#define MAKESTMT(stuff) do { stuff } while (0)
-
-/* Nonfatal errors (we can keep going, but the data is probably corrupt) */
-#define WARNMS(cinfo,code) \
- ((cinfo)->err->msg_code = (code), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
-#define WARNMS1(cinfo,code,p1) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
-#define WARNMS2(cinfo,code,p1,p2) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (cinfo)->err->msg_parm.i[1] = (p2), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
-
-/* Informational/debugging messages */
-#define TRACEMS(cinfo,lvl,code) \
- ((cinfo)->err->msg_code = (code), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
-#define TRACEMS1(cinfo,lvl,code,p1) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
-#define TRACEMS2(cinfo,lvl,code,p1,p2) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (cinfo)->err->msg_parm.i[1] = (p2), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
-#define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \
- MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
- _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \
- (cinfo)->err->msg_code = (code); \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
-#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \
- MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
- _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
- (cinfo)->err->msg_code = (code); \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
-#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \
- MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
- _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
- _mp[4] = (p5); \
- (cinfo)->err->msg_code = (code); \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
-#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \
- MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
- _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
- _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \
- (cinfo)->err->msg_code = (code); \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
-#define TRACEMSS(cinfo,lvl,code,str) \
- ((cinfo)->err->msg_code = (code), \
- strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
-
-#endif /* JERROR_H */
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jmorecfg.h b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jmorecfg.h
deleted file mode 100644
index f54191b0..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jmorecfg.h
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- * jmorecfg.h
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains additional configuration options that customize the
- * JPEG software for special applications or support machine-dependent
- * optimizations. Most users will not need to touch this file.
- */
-
-
-/*
- * Define BITS_IN_JSAMPLE as either
- * 8 for 8-bit sample values (the usual setting)
- * 12 for 12-bit sample values
- * Only 8 and 12 are legal data precisions for lossy JPEG according to the
- * JPEG standard, and the IJG code does not support anything else!
- * We do not support run-time selection of data precision, sorry.
- */
-
-#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
-
-#if (defined (_MSC_VER) && (_MSC_VER >= 800))
-#define HAVE_UNSIGNED_CHAR
-#define HAVE_ALL_INTS
-#define EXTERN(type) extern type __cdecl
-#endif
-
-/*
- * Maximum number of components (color channels) allowed in JPEG image.
- * To meet the letter of the JPEG spec, set this to 255. However, darn
- * few applications need more than 4 channels (maybe 5 for CMYK + alpha
- * mask). We recommend 10 as a reasonable compromise; use 4 if you are
- * really short on memory. (Each allowed component costs a hundred or so
- * bytes of storage, whether actually used in an image or not.)
- */
-
-#define MAX_COMPONENTS 10 /* maximum number of image components */
-
-
-/*
- * Basic data types.
- * You may need to change these if you have a machine with unusual data
- * type sizes; for example, "char" not 8 bits, "short" not 16 bits,
- * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
- * but it had better be at least 16.
- */
-
-/* Representation of a single sample (pixel element value).
- * We frequently allocate large arrays of these, so it's important to keep
- * them small. But if you have memory to burn and access to char or short
- * arrays is very slow on your hardware, you might want to change these.
- */
-
-#if BITS_IN_JSAMPLE == 8
-/* JSAMPLE should be the smallest type that will hold the values 0..255.
- * You can use a signed char by having GETJSAMPLE mask it with 0xFF.
- */
-
-#ifdef HAVE_UNSIGNED_CHAR
-
-typedef unsigned char JSAMPLE;
-#define GETJSAMPLE(value) ((int) (value))
-
-#else /* not HAVE_UNSIGNED_CHAR */
-
-typedef char JSAMPLE;
-#ifdef CHAR_IS_UNSIGNED
-#define GETJSAMPLE(value) ((int) (value))
-#else
-#define GETJSAMPLE(value) ((int) (value) & 0xFF)
-#endif /* CHAR_IS_UNSIGNED */
-
-#endif /* HAVE_UNSIGNED_CHAR */
-
-#define MAXJSAMPLE 255
-#define CENTERJSAMPLE 128
-
-#endif /* BITS_IN_JSAMPLE == 8 */
-
-
-#if BITS_IN_JSAMPLE == 12
-/* JSAMPLE should be the smallest type that will hold the values 0..4095.
- * On nearly all machines "short" will do nicely.
- */
-
-typedef short JSAMPLE;
-#define GETJSAMPLE(value) ((int) (value))
-
-#define MAXJSAMPLE 4095
-#define CENTERJSAMPLE 2048
-
-#endif /* BITS_IN_JSAMPLE == 12 */
-
-
-/* Representation of a DCT frequency coefficient.
- * This should be a signed value of at least 16 bits; "short" is usually OK.
- * Again, we allocate large arrays of these, but you can change to int
- * if you have memory to burn and "short" is really slow.
- */
-
-typedef short JCOEF;
-
-
-/* Compressed datastreams are represented as arrays of JOCTET.
- * These must be EXACTLY 8 bits wide, at least once they are written to
- * external storage. Note that when using the stdio data source/destination
- * managers, this is also the data type passed to fread/fwrite.
- */
-
-#ifdef HAVE_UNSIGNED_CHAR
-
-typedef unsigned char JOCTET;
-#define GETJOCTET(value) (value)
-
-#else /* not HAVE_UNSIGNED_CHAR */
-
-typedef char JOCTET;
-#ifdef CHAR_IS_UNSIGNED
-#define GETJOCTET(value) (value)
-#else
-#define GETJOCTET(value) ((value) & 0xFF)
-#endif /* CHAR_IS_UNSIGNED */
-
-#endif /* HAVE_UNSIGNED_CHAR */
-
-
-/* These typedefs are used for various table entries and so forth.
- * They must be at least as wide as specified; but making them too big
- * won't cost a huge amount of memory, so we don't provide special
- * extraction code like we did for JSAMPLE. (In other words, these
- * typedefs live at a different point on the speed/space tradeoff curve.)
- */
-
-/* UINT8 must hold at least the values 0..255. */
-#ifndef HAVE_ALL_INTS
-
-#ifdef HAVE_UNSIGNED_CHAR
-typedef unsigned char UINT8;
-#else /* not HAVE_UNSIGNED_CHAR */
-#ifdef CHAR_IS_UNSIGNED
-typedef char UINT8;
-#else /* not CHAR_IS_UNSIGNED */
-typedef short UINT8;
-#endif /* CHAR_IS_UNSIGNED */
-#endif /* HAVE_UNSIGNED_CHAR */
-
-/* UINT16 must hold at least the values 0..65535. */
-
-#ifdef HAVE_UNSIGNED_SHORT
-typedef unsigned short UINT16;
-#else /* not HAVE_UNSIGNED_SHORT */
-typedef unsigned int UINT16;
-#endif /* HAVE_UNSIGNED_SHORT */
-
-/* INT16 must hold at least the values -32768..32767. */
-
-#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
-typedef short INT16;
-#endif
-
-/* INT32 must hold at least signed 32-bit values. */
-
-#if !defined(XMD_H) && !defined(_WIN32) /* X11/xmd.h correctly defines INT32 */
-typedef long INT32;
-#endif
-
-#endif /* HAVE_ALL_INTS */
-
-/* Datatype used for image dimensions. The JPEG standard only supports
- * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
- * "unsigned int" is sufficient on all machines. However, if you need to
- * handle larger images and you don't mind deviating from the spec, you
- * can change this datatype.
- */
-
-typedef unsigned int JDIMENSION;
-
-#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
-
-
-/* These macros are used in all function definitions and extern declarations.
- * You could modify them if you need to change function linkage conventions;
- * in particular, you'll need to do that to make the library a Windows DLL.
- * Another application is to make all functions global for use with debuggers
- * or code profilers that require it.
- */
-
-#ifdef _WIN32
-# if defined(ALL_STATIC)
-# if defined(JPEG_DLL)
-# undef JPEG_DLL
-# endif
-# if !defined(JPEG_STATIC)
-# define JPEG_STATIC
-# endif
-# endif
-# if defined(JPEG_DLL)
-# if defined(JPEG_STATIC)
-# undef JPEG_STATIC
-# endif
-# endif
-# if defined(JPEG_DLL)
-/* building a DLL */
-# define JPEG_IMPEXP __declspec(dllexport)
-# elif defined(JPEG_STATIC)
-/* building or linking to a static library */
-# define JPEG_IMPEXP
-# else
-/* linking to the DLL */
-# define JPEG_IMPEXP __declspec(dllimport)
-# endif
-# if !defined(JPEG_API)
-# define JPEG_API __cdecl
-# endif
-/* The only remaining magic that is necessary for cygwin */
-#elif defined(__CYGWIN__)
-# if !defined(JPEG_IMPEXP)
-# define JPEG_IMPEXP
-# endif
-# if !defined(JPEG_API)
-# define JPEG_API __cdecl
-# endif
-#endif
-
-/* Ensure our magic doesn't hurt other platforms */
-#if !defined(JPEG_IMPEXP)
-# define JPEG_IMPEXP
-#endif
-#if !defined(JPEG_API)
-# define JPEG_API
-#endif
-
-/* a function called through method pointers: */
-#define METHODDEF(type) static type
-/* a function used only in its module: */
-#define LOCAL(type) static type
-/* a function referenced thru EXTERNs: */
-#define GLOBAL(type) type JPEG_API
-/* a reference to a GLOBAL function: */
-#ifndef EXTERN
-# define EXTERN(type) extern JPEG_IMPEXP type JPEG_API
-/* a reference to a "GLOBAL" function exported by sourcefiles of utility progs */
-#endif /* EXTERN */
-#define EXTERN_1(type) extern type JPEG_API
-
-
-/* This macro is used to declare a "method", that is, a function pointer.
- * We want to supply prototype parameters if the compiler can cope.
- * Note that the arglist parameter must be parenthesized!
- * Again, you can customize this if you need special linkage keywords.
- */
-
-#ifdef HAVE_PROTOTYPES
-#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
-#else
-#define JMETHOD(type,methodname,arglist) type (*methodname) ()
-#endif
-
-
-/* Here is the pseudo-keyword for declaring pointers that must be "far"
- * on 80x86 machines. Most of the specialized coding for 80x86 is handled
- * by just saying "FAR *" where such a pointer is needed. In a few places
- * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
- */
-
-/* jmorecfg.h line 220 */
-/* HJH modification: several of the windows header files already define FAR
- because of this, the code below was changed so that it only tinkers with
- the FAR define if FAR is still undefined */
-#ifndef FAR
- #ifdef NEED_FAR_POINTERS
- #define FAR far
- #else
- #define FAR
- #endif
-#endif
-
-
-/*
- * On a few systems, type boolean and/or its values FALSE, TRUE may appear
- * in standard header files. Or you may have conflicts with application-
- * specific header files that you want to include together with these files.
- * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
- */
-
-#ifndef HAVE_BOOLEAN
-typedef int boolean;
-#endif
-#ifndef FALSE /* in case these macros already exist */
-#define FALSE 0 /* values of boolean */
-#endif
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-
-/*
- * The remaining options affect code selection within the JPEG library,
- * but they don't need to be visible to most applications using the library.
- * To minimize application namespace pollution, the symbols won't be
- * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
- */
-
-#ifdef JPEG_INTERNALS
-#define JPEG_INTERNAL_OPTIONS
-#endif
-
-#ifdef JPEG_INTERNAL_OPTIONS
-
-
-/*
- * These defines indicate whether to include various optional functions.
- * Undefining some of these symbols will produce a smaller but less capable
- * library. Note that you can leave certain source files out of the
- * compilation/linking process if you've #undef'd the corresponding symbols.
- * (You may HAVE to do that if your compiler doesn't like null source files.)
- */
-
-/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
-
-/* Capability options common to encoder and decoder: */
-
-#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
-#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
-#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
-
-/* Encoder capability options: */
-
-#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
-#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
-#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
-#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
-/* Note: if you selected 12-bit data precision, it is dangerous to turn off
- * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
- * precision, so jchuff.c normally uses entropy optimization to compute
- * usable tables for higher precision. If you don't want to do optimization,
- * you'll have to supply different default Huffman tables.
- * The exact same statements apply for progressive JPEG: the default tables
- * don't work for progressive mode. (This may get fixed, however.)
- */
-#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
-
-/* Decoder capability options: */
-
-#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
-#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
-#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
-#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
-#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
-#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
-#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
-#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
-#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
-#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
-
-/* more capability options later, no doubt */
-
-
-/*
- * Ordering of RGB data in scanlines passed to or from the application.
- * If your application wants to deal with data in the order B,G,R, just
- * change these macros. You can also deal with formats such as R,G,B,X
- * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
- * the offsets will also change the order in which colormap data is organized.
- * RESTRICTIONS:
- * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
- * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
- * useful if you are using JPEG color spaces other than YCbCr or grayscale.
- * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
- * is not 3 (they don't understand about dummy color components!). So you
- * can't use color quantization if you change that value.
- */
-
-#define RGB_RED 0 /* Offset of Red in an RGB scanline element */
-#define RGB_GREEN 1 /* Offset of Green */
-#define RGB_BLUE 2 /* Offset of Blue */
-#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
-
-
-/* Definitions for speed-related optimizations. */
-
-
-/* If your compiler supports inline functions, define INLINE
- * as the inline keyword; otherwise define it as empty.
- */
-
-#ifndef INLINE
-#ifdef __GNUC__ /* for instance, GNU C knows about inline */
-#define INLINE __inline__
-#endif
-#ifndef INLINE
-#define INLINE /* default is to define it as empty */
-#endif
-#endif
-
-
-/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
- * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
- * as short on such a machine. MULTIPLIER must be at least 16 bits wide.
- */
-
-#ifndef MULTIPLIER
-#define MULTIPLIER int /* type for fastest integer multiply */
-#endif
-
-
-/* FAST_FLOAT should be either float or double, whichever is done faster
- * by your compiler. (Note that this type is only used in the floating point
- * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
- * Typically, float is faster in ANSI C compilers, while double is faster in
- * pre-ANSI compilers (because they insist on converting to double anyway).
- * The code below therefore chooses float if we have ANSI-style prototypes.
- */
-
-#ifndef FAST_FLOAT
-#ifdef HAVE_PROTOTYPES
-#define FAST_FLOAT float
-#else
-#define FAST_FLOAT double
-#endif
-#endif
-
-#endif /* JPEG_INTERNAL_OPTIONS */
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jpeglib.h b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jpeglib.h
deleted file mode 100644
index 2091dbeb..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/jpeglib.h
+++ /dev/null
@@ -1,1110 +0,0 @@
-/*
- * jpeglib.h
- *
- * Copyright (C) 1991-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file defines the application interface for the JPEG library.
- * Most applications using the library need only include this file,
- * and perhaps jerror.h if they want to know the exact error codes.
- */
-
-#ifndef JPEGLIB_H
-#define JPEGLIB_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * First we include the configuration files that record how this
- * installation of the JPEG library is set up. jconfig.h can be
- * generated automatically for many systems. jmorecfg.h contains
- * manual configuration options that most people need not worry about.
- */
-
-#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */
-#include "jconfig.h" /* widely used configuration options */
-#endif
-#include "jmorecfg.h" /* seldom changed options */
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/* Version ID for the JPEG library.
- * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
- */
-
-#define JPEG_LIB_VERSION 62 /* Version 6b */
-
-
-/* Various constants determining the sizes of things.
- * All of these are specified by the JPEG standard, so don't change them
- * if you want to be compatible.
- */
-
-#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */
-#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */
-#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */
-#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */
-#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */
-#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */
-#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */
-/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard;
- * the PostScript DCT filter can emit files with many more than 10 blocks/MCU.
- * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU
- * to handle it. We even let you do this from the jconfig.h file. However,
- * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe
- * sometimes emits noncompliant files doesn't mean you should too.
- */
-#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */
-#ifndef D_MAX_BLOCKS_IN_MCU
-#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */
-#endif
-
-
-/* Data structures for images (arrays of samples and of DCT coefficients).
- * On 80x86 machines, the image arrays are too big for near pointers,
- * but the pointer arrays can fit in near memory.
- */
-
-typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */
-typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
-typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */
-
-typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */
-typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */
-typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */
-typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */
-
-typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */
-
-
-/* Types for JPEG compression parameters and working tables. */
-
-
-/* DCT coefficient quantization tables. */
-
-typedef struct {
- /* This array gives the coefficient quantizers in natural array order
- * (not the zigzag order in which they are stored in a JPEG DQT marker).
- * CAUTION: IJG versions prior to v6a kept this array in zigzag order.
- */
- UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */
- /* This field is used only during compression. It's initialized FALSE when
- * the table is created, and set TRUE when it's been output to the file.
- * You could suppress output of a table by setting this to TRUE.
- * (See jpeg_suppress_tables for an example.)
- */
- boolean sent_table; /* TRUE when table has been output */
-} JQUANT_TBL;
-
-
-/* Huffman coding tables. */
-
-typedef struct {
- /* These two fields directly represent the contents of a JPEG DHT marker */
- UINT8 bits[17]; /* bits[k] = # of symbols with codes of */
- /* length k bits; bits[0] is unused */
- UINT8 huffval[256]; /* The symbols, in order of incr code length */
- /* This field is used only during compression. It's initialized FALSE when
- * the table is created, and set TRUE when it's been output to the file.
- * You could suppress output of a table by setting this to TRUE.
- * (See jpeg_suppress_tables for an example.)
- */
- boolean sent_table; /* TRUE when table has been output */
-} JHUFF_TBL;
-
-
-/* Basic info about one component (color channel). */
-
-typedef struct {
- /* These values are fixed over the whole image. */
- /* For compression, they must be supplied by parameter setup; */
- /* for decompression, they are read from the SOF marker. */
- int component_id; /* identifier for this component (0..255) */
- int component_index; /* its index in SOF or cinfo->comp_info[] */
- int h_samp_factor; /* horizontal sampling factor (1..4) */
- int v_samp_factor; /* vertical sampling factor (1..4) */
- int quant_tbl_no; /* quantization table selector (0..3) */
- /* These values may vary between scans. */
- /* For compression, they must be supplied by parameter setup; */
- /* for decompression, they are read from the SOS marker. */
- /* The decompressor output side may not use these variables. */
- int dc_tbl_no; /* DC entropy table selector (0..3) */
- int ac_tbl_no; /* AC entropy table selector (0..3) */
-
- /* Remaining fields should be treated as private by applications. */
-
- /* These values are computed during compression or decompression startup: */
- /* Component's size in DCT blocks.
- * Any dummy blocks added to complete an MCU are not counted; therefore
- * these values do not depend on whether a scan is interleaved or not.
- */
- JDIMENSION width_in_blocks;
- JDIMENSION height_in_blocks;
- /* Size of a DCT block in samples. Always DCTSIZE for compression.
- * For decompression this is the size of the output from one DCT block,
- * reflecting any scaling we choose to apply during the IDCT step.
- * Values of 1,2,4,8 are likely to be supported. Note that different
- * components may receive different IDCT scalings.
- */
- int DCT_scaled_size;
- /* The downsampled dimensions are the component's actual, unpadded number
- * of samples at the main buffer (preprocessing/compression interface), thus
- * downsampled_width = ceil(image_width * Hi/Hmax)
- * and similarly for height. For decompression, IDCT scaling is included, so
- * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE)
- */
- JDIMENSION downsampled_width; /* actual width in samples */
- JDIMENSION downsampled_height; /* actual height in samples */
- /* This flag is used only for decompression. In cases where some of the
- * components will be ignored (eg grayscale output from YCbCr image),
- * we can skip most computations for the unused components.
- */
- boolean component_needed; /* do we need the value of this component? */
-
- /* These values are computed before starting a scan of the component. */
- /* The decompressor output side may not use these variables. */
- int MCU_width; /* number of blocks per MCU, horizontally */
- int MCU_height; /* number of blocks per MCU, vertically */
- int MCU_blocks; /* MCU_width * MCU_height */
- int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_scaled_size */
- int last_col_width; /* # of non-dummy blocks across in last MCU */
- int last_row_height; /* # of non-dummy blocks down in last MCU */
-
- /* Saved quantization table for component; NULL if none yet saved.
- * See jdinput.c comments about the need for this information.
- * This field is currently used only for decompression.
- */
- JQUANT_TBL * quant_table;
-
- /* Private per-component storage for DCT or IDCT subsystem. */
- void * dct_table;
-} jpeg_component_info;
-
-
-/* The script for encoding a multiple-scan file is an array of these: */
-
-typedef struct {
- int comps_in_scan; /* number of components encoded in this scan */
- int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */
- int Ss, Se; /* progressive JPEG spectral selection parms */
- int Ah, Al; /* progressive JPEG successive approx. parms */
-} jpeg_scan_info;
-
-/* The decompressor can save APPn and COM markers in a list of these: */
-
-typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr;
-
-struct jpeg_marker_struct {
- jpeg_saved_marker_ptr next; /* next in list, or NULL */
- UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */
- unsigned int original_length; /* # bytes of data in the file */
- unsigned int data_length; /* # bytes of data saved at data[] */
- JOCTET FAR * data; /* the data contained in the marker */
- /* the marker length word is not counted in data_length or original_length */
-};
-
-/* Known color spaces. */
-
-typedef enum {
- JCS_UNKNOWN, /* error/unspecified */
- JCS_GRAYSCALE, /* monochrome */
- JCS_RGB, /* red/green/blue */
- JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
- JCS_CMYK, /* C/M/Y/K */
- JCS_YCCK /* Y/Cb/Cr/K */
-} J_COLOR_SPACE;
-
-/* DCT/IDCT algorithm options. */
-
-typedef enum {
- JDCT_ISLOW, /* slow but accurate integer algorithm */
- JDCT_IFAST, /* faster, less accurate integer method */
- JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
-} J_DCT_METHOD;
-
-#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */
-#define JDCT_DEFAULT JDCT_ISLOW
-#endif
-#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */
-#define JDCT_FASTEST JDCT_IFAST
-#endif
-
-/* Dithering options for decompression. */
-
-typedef enum {
- JDITHER_NONE, /* no dithering */
- JDITHER_ORDERED, /* simple ordered dither */
- JDITHER_FS /* Floyd-Steinberg error diffusion dither */
-} J_DITHER_MODE;
-
-
-/* Common fields between JPEG compression and decompression master structs. */
-
-#define jpeg_common_fields \
- struct jpeg_error_mgr * err; /* Error handler module */\
- struct jpeg_memory_mgr * mem; /* Memory manager module */\
- struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\
- void * client_data; /* Available for use by application */\
- boolean is_decompressor; /* So common code can tell which is which */\
- int global_state /* For checking call sequence validity */
-
-/* Routines that are to be used by both halves of the library are declared
- * to receive a pointer to this structure. There are no actual instances of
- * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
- */
-struct jpeg_common_struct {
- jpeg_common_fields; /* Fields common to both master struct types */
- /* Additional fields follow in an actual jpeg_compress_struct or
- * jpeg_decompress_struct. All three structs must agree on these
- * initial fields! (This would be a lot cleaner in C++.)
- */
-};
-
-typedef struct jpeg_common_struct * j_common_ptr;
-typedef struct jpeg_compress_struct * j_compress_ptr;
-typedef struct jpeg_decompress_struct * j_decompress_ptr;
-
-
-/* Master record for a compression instance */
-
-struct jpeg_compress_struct {
- jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */
-
- /* Destination for compressed data */
- struct jpeg_destination_mgr * dest;
-
- /* Description of source image --- these fields must be filled in by
- * outer application before starting compression. in_color_space must
- * be correct before you can even call jpeg_set_defaults().
- */
-
- JDIMENSION image_width; /* input image width */
- JDIMENSION image_height; /* input image height */
- int input_components; /* # of color components in input image */
- J_COLOR_SPACE in_color_space; /* colorspace of input image */
-
- double input_gamma; /* image gamma of input image */
-
- /* Compression parameters --- these fields must be set before calling
- * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to
- * initialize everything to reasonable defaults, then changing anything
- * the application specifically wants to change. That way you won't get
- * burnt when new parameters are added. Also note that there are several
- * helper routines to simplify changing parameters.
- */
-
- int data_precision; /* bits of precision in image data */
-
- int num_components; /* # of color components in JPEG image */
- J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
-
- jpeg_component_info * comp_info;
- /* comp_info[i] describes component that appears i'th in SOF */
-
- JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
- /* ptrs to coefficient quantization tables, or NULL if not defined */
-
- JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
- JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
- /* ptrs to Huffman coding tables, or NULL if not defined */
-
- UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
- UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
- UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
-
- int num_scans; /* # of entries in scan_info array */
- const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */
- /* The default value of scan_info is NULL, which causes a single-scan
- * sequential JPEG file to be emitted. To create a multi-scan file,
- * set num_scans and scan_info to point to an array of scan definitions.
- */
-
- boolean raw_data_in; /* TRUE=caller supplies downsampled data */
- boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
- boolean optimize_coding; /* TRUE=optimize entropy encoding parms */
- boolean CCIR601_sampling; /* TRUE=first samples are cosited */
- int smoothing_factor; /* 1..100, or 0 for no input smoothing */
- J_DCT_METHOD dct_method; /* DCT algorithm selector */
-
- /* The restart interval can be specified in absolute MCUs by setting
- * restart_interval, or in MCU rows by setting restart_in_rows
- * (in which case the correct restart_interval will be figured
- * for each scan).
- */
- unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
- int restart_in_rows; /* if > 0, MCU rows per restart interval */
-
- /* Parameters controlling emission of special markers. */
-
- boolean write_JFIF_header; /* should a JFIF marker be written? */
- UINT8 JFIF_major_version; /* What to write for the JFIF version number */
- UINT8 JFIF_minor_version;
- /* These three values are not used by the JPEG code, merely copied */
- /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */
- /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */
- /* ratio is defined by X_density/Y_density even when density_unit=0. */
- UINT8 density_unit; /* JFIF code for pixel size units */
- UINT16 X_density; /* Horizontal pixel density */
- UINT16 Y_density; /* Vertical pixel density */
- boolean write_Adobe_marker; /* should an Adobe marker be written? */
-
- /* State variable: index of next scanline to be written to
- * jpeg_write_scanlines(). Application may use this to control its
- * processing loop, e.g., "while (next_scanline < image_height)".
- */
-
- JDIMENSION next_scanline; /* 0 .. image_height-1 */
-
- /* Remaining fields are known throughout compressor, but generally
- * should not be touched by a surrounding application.
- */
-
- /*
- * These fields are computed during compression startup
- */
- boolean progressive_mode; /* TRUE if scan script uses progressive mode */
- int max_h_samp_factor; /* largest h_samp_factor */
- int max_v_samp_factor; /* largest v_samp_factor */
-
- JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
- /* The coefficient controller receives data in units of MCU rows as defined
- * for fully interleaved scans (whether the JPEG file is interleaved or not).
- * There are v_samp_factor * DCTSIZE sample rows of each component in an
- * "iMCU" (interleaved MCU) row.
- */
-
- /*
- * These fields are valid during any one scan.
- * They describe the components and MCUs actually appearing in the scan.
- */
- int comps_in_scan; /* # of JPEG components in this scan */
- jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
- /* *cur_comp_info[i] describes component that appears i'th in SOS */
-
- JDIMENSION MCUs_per_row; /* # of MCUs across the image */
- JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
-
- int blocks_in_MCU; /* # of DCT blocks per MCU */
- int MCU_membership[C_MAX_BLOCKS_IN_MCU];
- /* MCU_membership[i] is index in cur_comp_info of component owning */
- /* i'th block in an MCU */
-
- int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
-
- /*
- * Links to compression subobjects (methods and private variables of modules)
- */
- struct jpeg_comp_master * master;
- struct jpeg_c_main_controller * main;
- struct jpeg_c_prep_controller * prep;
- struct jpeg_c_coef_controller * coef;
- struct jpeg_marker_writer * marker;
- struct jpeg_color_converter * cconvert;
- struct jpeg_downsampler * downsample;
- struct jpeg_forward_dct * fdct;
- struct jpeg_entropy_encoder * entropy;
- jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */
- int script_space_size;
-};
-
-
-/* Master record for a decompression instance */
-
-struct jpeg_decompress_struct {
- jpeg_common_fields; /* Fields shared with jpeg_compress_struct */
-
- /* Source of compressed data */
- struct jpeg_source_mgr * src;
-
- /* Basic description of image --- filled in by jpeg_read_header(). */
- /* Application may inspect these values to decide how to process image. */
-
- JDIMENSION image_width; /* nominal image width (from SOF marker) */
- JDIMENSION image_height; /* nominal image height */
- int num_components; /* # of color components in JPEG image */
- J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
-
- /* Decompression processing parameters --- these fields must be set before
- * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes
- * them to default values.
- */
-
- J_COLOR_SPACE out_color_space; /* colorspace for output */
-
- unsigned int scale_num, scale_denom; /* fraction by which to scale image */
-
- double output_gamma; /* image gamma wanted in output */
-
- boolean buffered_image; /* TRUE=multiple output passes */
- boolean raw_data_out; /* TRUE=downsampled data wanted */
-
- J_DCT_METHOD dct_method; /* IDCT algorithm selector */
- boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */
- boolean do_block_smoothing; /* TRUE=apply interblock smoothing */
-
- boolean quantize_colors; /* TRUE=colormapped output wanted */
- /* the following are ignored if not quantize_colors: */
- J_DITHER_MODE dither_mode; /* type of color dithering to use */
- boolean two_pass_quantize; /* TRUE=use two-pass color quantization */
- int desired_number_of_colors; /* max # colors to use in created colormap */
- /* these are significant only in buffered-image mode: */
- boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */
- boolean enable_external_quant;/* enable future use of external colormap */
- boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */
-
- /* Description of actual output image that will be returned to application.
- * These fields are computed by jpeg_start_decompress().
- * You can also use jpeg_calc_output_dimensions() to determine these values
- * in advance of calling jpeg_start_decompress().
- */
-
- JDIMENSION output_width; /* scaled image width */
- JDIMENSION output_height; /* scaled image height */
- int out_color_components; /* # of color components in out_color_space */
- int output_components; /* # of color components returned */
- /* output_components is 1 (a colormap index) when quantizing colors;
- * otherwise it equals out_color_components.
- */
- int rec_outbuf_height; /* min recommended height of scanline buffer */
- /* If the buffer passed to jpeg_read_scanlines() is less than this many rows
- * high, space and time will be wasted due to unnecessary data copying.
- * Usually rec_outbuf_height will be 1 or 2, at most 4.
- */
-
- /* When quantizing colors, the output colormap is described by these fields.
- * The application can supply a colormap by setting colormap non-NULL before
- * calling jpeg_start_decompress; otherwise a colormap is created during
- * jpeg_start_decompress or jpeg_start_output.
- * The map has out_color_components rows and actual_number_of_colors columns.
- */
- int actual_number_of_colors; /* number of entries in use */
- JSAMPARRAY colormap; /* The color map as a 2-D pixel array */
-
- /* State variables: these variables indicate the progress of decompression.
- * The application may examine these but must not modify them.
- */
-
- /* Row index of next scanline to be read from jpeg_read_scanlines().
- * Application may use this to control its processing loop, e.g.,
- * "while (output_scanline < output_height)".
- */
- JDIMENSION output_scanline; /* 0 .. output_height-1 */
-
- /* Current input scan number and number of iMCU rows completed in scan.
- * These indicate the progress of the decompressor input side.
- */
- int input_scan_number; /* Number of SOS markers seen so far */
- JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */
-
- /* The "output scan number" is the notional scan being displayed by the
- * output side. The decompressor will not allow output scan/row number
- * to get ahead of input scan/row, but it can fall arbitrarily far behind.
- */
- int output_scan_number; /* Nominal scan number being displayed */
- JDIMENSION output_iMCU_row; /* Number of iMCU rows read */
-
- /* Current progression status. coef_bits[c][i] indicates the precision
- * with which component c's DCT coefficient i (in zigzag order) is known.
- * It is -1 when no data has yet been received, otherwise it is the point
- * transform (shift) value for the most recent scan of the coefficient
- * (thus, 0 at completion of the progression).
- * This pointer is NULL when reading a non-progressive file.
- */
- int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */
-
- /* Internal JPEG parameters --- the application usually need not look at
- * these fields. Note that the decompressor output side may not use
- * any parameters that can change between scans.
- */
-
- /* Quantization and Huffman tables are carried forward across input
- * datastreams when processing abbreviated JPEG datastreams.
- */
-
- JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
- /* ptrs to coefficient quantization tables, or NULL if not defined */
-
- JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
- JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
- /* ptrs to Huffman coding tables, or NULL if not defined */
-
- /* These parameters are never carried across datastreams, since they
- * are given in SOF/SOS markers or defined to be reset by SOI.
- */
-
- int data_precision; /* bits of precision in image data */
-
- jpeg_component_info * comp_info;
- /* comp_info[i] describes component that appears i'th in SOF */
-
- boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */
- boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
-
- UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
- UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
- UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
-
- unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */
-
- /* These fields record data obtained from optional markers recognized by
- * the JPEG library.
- */
- boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */
- /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */
- UINT8 JFIF_major_version; /* JFIF version number */
- UINT8 JFIF_minor_version;
- UINT8 density_unit; /* JFIF code for pixel size units */
- UINT16 X_density; /* Horizontal pixel density */
- UINT16 Y_density; /* Vertical pixel density */
- boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
- UINT8 Adobe_transform; /* Color transform code from Adobe marker */
-
- boolean CCIR601_sampling; /* TRUE=first samples are cosited */
-
- /* Aside from the specific data retained from APPn markers known to the
- * library, the uninterpreted contents of any or all APPn and COM markers
- * can be saved in a list for examination by the application.
- */
- jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */
-
- /* Remaining fields are known throughout decompressor, but generally
- * should not be touched by a surrounding application.
- */
-
- /*
- * These fields are computed during decompression startup
- */
- int max_h_samp_factor; /* largest h_samp_factor */
- int max_v_samp_factor; /* largest v_samp_factor */
-
- int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */
-
- JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */
- /* The coefficient controller's input and output progress is measured in
- * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows
- * in fully interleaved JPEG scans, but are used whether the scan is
- * interleaved or not. We define an iMCU row as v_samp_factor DCT block
- * rows of each component. Therefore, the IDCT output contains
- * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.
- */
-
- JSAMPLE * sample_range_limit; /* table for fast range-limiting */
-
- /*
- * These fields are valid during any one scan.
- * They describe the components and MCUs actually appearing in the scan.
- * Note that the decompressor output side must not use these fields.
- */
- int comps_in_scan; /* # of JPEG components in this scan */
- jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
- /* *cur_comp_info[i] describes component that appears i'th in SOS */
-
- JDIMENSION MCUs_per_row; /* # of MCUs across the image */
- JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
-
- int blocks_in_MCU; /* # of DCT blocks per MCU */
- int MCU_membership[D_MAX_BLOCKS_IN_MCU];
- /* MCU_membership[i] is index in cur_comp_info of component owning */
- /* i'th block in an MCU */
-
- int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
-
- /* This field is shared between entropy decoder and marker parser.
- * It is either zero or the code of a JPEG marker that has been
- * read from the data source, but has not yet been processed.
- */
- int unread_marker;
-
- /*
- * Links to decompression subobjects (methods, private variables of modules)
- */
- struct jpeg_decomp_master * master;
- struct jpeg_d_main_controller * main;
- struct jpeg_d_coef_controller * coef;
- struct jpeg_d_post_controller * post;
- struct jpeg_input_controller * inputctl;
- struct jpeg_marker_reader * marker;
- struct jpeg_entropy_decoder * entropy;
- struct jpeg_inverse_dct * idct;
- struct jpeg_upsampler * upsample;
- struct jpeg_color_deconverter * cconvert;
- struct jpeg_color_quantizer * cquantize;
-};
-
-
-/* "Object" declarations for JPEG modules that may be supplied or called
- * directly by the surrounding application.
- * As with all objects in the JPEG library, these structs only define the
- * publicly visible methods and state variables of a module. Additional
- * private fields may exist after the public ones.
- */
-
-
-/* Error handler object */
-
-struct jpeg_error_mgr {
- /* Error exit handler: does not return to caller */
- JMETHOD(void, error_exit, (j_common_ptr cinfo));
- /* Conditionally emit a trace or warning message */
- JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level));
- /* Routine that actually outputs a trace or error message */
- JMETHOD(void, output_message, (j_common_ptr cinfo));
- /* Format a message string for the most recent JPEG error or message */
- JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer));
-#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
- /* Reset error state variables at start of a new image */
- JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
-
- /* The message ID code and any parameters are saved here.
- * A message can have one string parameter or up to 8 int parameters.
- */
- int msg_code;
-#define JMSG_STR_PARM_MAX 80
- union {
- int i[8];
- char s[JMSG_STR_PARM_MAX];
- } msg_parm;
-
- /* Standard state variables for error facility */
-
- int trace_level; /* max msg_level that will be displayed */
-
- /* For recoverable corrupt-data errors, we emit a warning message,
- * but keep going unless emit_message chooses to abort. emit_message
- * should count warnings in num_warnings. The surrounding application
- * can check for bad data by seeing if num_warnings is nonzero at the
- * end of processing.
- */
- long num_warnings; /* number of corrupt-data warnings */
-
- /* These fields point to the table(s) of error message strings.
- * An application can change the table pointer to switch to a different
- * message list (typically, to change the language in which errors are
- * reported). Some applications may wish to add additional error codes
- * that will be handled by the JPEG library error mechanism; the second
- * table pointer is used for this purpose.
- *
- * First table includes all errors generated by JPEG library itself.
- * Error code 0 is reserved for a "no such error string" message.
- */
- const char * const * jpeg_message_table; /* Library errors */
- int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */
- /* Second table can be added by application (see cjpeg/djpeg for example).
- * It contains strings numbered first_addon_message..last_addon_message.
- */
- const char * const * addon_message_table; /* Non-library errors */
- int first_addon_message; /* code for first string in addon table */
- int last_addon_message; /* code for last string in addon table */
-};
-
-
-/* Progress monitor object */
-
-struct jpeg_progress_mgr {
- JMETHOD(void, progress_monitor, (j_common_ptr cinfo));
-
- long pass_counter; /* work units completed in this pass */
- long pass_limit; /* total number of work units in this pass */
- int completed_passes; /* passes completed so far */
- int total_passes; /* total number of passes expected */
-};
-
-
-/* Data destination object for compression */
-
-struct jpeg_destination_mgr {
- JOCTET * next_output_byte; /* => next byte to write in buffer */
- size_t free_in_buffer; /* # of byte spaces remaining in buffer */
-
- JMETHOD(void, init_destination, (j_compress_ptr cinfo));
- JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo));
- JMETHOD(void, term_destination, (j_compress_ptr cinfo));
-};
-
-
-/* Data source object for decompression */
-
-struct jpeg_source_mgr {
- const JOCTET * next_input_byte; /* => next byte to read from buffer */
- size_t bytes_in_buffer; /* # of bytes remaining in buffer */
-
- JMETHOD(void, init_source, (j_decompress_ptr cinfo));
- JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo));
- JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes));
- JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired));
- JMETHOD(void, term_source, (j_decompress_ptr cinfo));
-};
-
-
-/* Memory manager object.
- * Allocates "small" objects (a few K total), "large" objects (tens of K),
- * and "really big" objects (virtual arrays with backing store if needed).
- * The memory manager does not allow individual objects to be freed; rather,
- * each created object is assigned to a pool, and whole pools can be freed
- * at once. This is faster and more convenient than remembering exactly what
- * to free, especially where malloc()/free() are not too speedy.
- * NB: alloc routines never return NULL. They exit to error_exit if not
- * successful.
- */
-
-#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */
-#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */
-#define JPOOL_NUMPOOLS 2
-
-typedef struct jvirt_sarray_control * jvirt_sarray_ptr;
-typedef struct jvirt_barray_control * jvirt_barray_ptr;
-
-
-struct jpeg_memory_mgr {
- /* Method pointers */
- JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id,
- size_t sizeofobject));
- JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id,
- size_t sizeofobject));
- JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id,
- JDIMENSION samplesperrow,
- JDIMENSION numrows));
- JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id,
- JDIMENSION blocksperrow,
- JDIMENSION numrows));
- JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,
- int pool_id,
- boolean pre_zero,
- JDIMENSION samplesperrow,
- JDIMENSION numrows,
- JDIMENSION maxaccess));
- JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo,
- int pool_id,
- boolean pre_zero,
- JDIMENSION blocksperrow,
- JDIMENSION numrows,
- JDIMENSION maxaccess));
- JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo));
- JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo,
- jvirt_sarray_ptr ptr,
- JDIMENSION start_row,
- JDIMENSION num_rows,
- boolean writable));
- JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo,
- jvirt_barray_ptr ptr,
- JDIMENSION start_row,
- JDIMENSION num_rows,
- boolean writable));
- JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id));
- JMETHOD(void, self_destruct, (j_common_ptr cinfo));
-
- /* Limit on memory allocation for this JPEG object. (Note that this is
- * merely advisory, not a guaranteed maximum; it only affects the space
- * used for virtual-array buffers.) May be changed by outer application
- * after creating the JPEG object.
- */
- long max_memory_to_use;
-
- /* Maximum allocation request accepted by alloc_large. */
- long max_alloc_chunk;
-};
-
-
-/* Routine signature for application-supplied marker processing methods.
- * Need not pass marker code since it is stored in cinfo->unread_marker.
- */
-typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
-
-
-/* Declarations for routines called by application.
- * The JPP macro hides prototype parameters from compilers that can't cope.
- * Note JPP requires double parentheses.
- */
-
-#ifdef HAVE_PROTOTYPES
-#define JPP(arglist) arglist
-#else
-#define JPP(arglist) ()
-#endif
-
-
-/* Short forms of external names for systems with brain-damaged linkers.
- * We shorten external names to be unique in the first six letters, which
- * is good enough for all known systems.
- * (If your compiler itself needs names to be unique in less than 15
- * characters, you are out of luck. Get a better compiler.)
- */
-
-#ifdef NEED_SHORT_EXTERNAL_NAMES
-#define jpeg_std_error jStdError
-#define jpeg_CreateCompress jCreaCompress
-#define jpeg_CreateDecompress jCreaDecompress
-#define jpeg_destroy_compress jDestCompress
-#define jpeg_destroy_decompress jDestDecompress
-#define jpeg_stdio_dest jStdDest
-#define jpeg_stdio_src jStdSrc
-#define jpeg_set_defaults jSetDefaults
-#define jpeg_set_colorspace jSetColorspace
-#define jpeg_default_colorspace jDefColorspace
-#define jpeg_set_quality jSetQuality
-#define jpeg_set_linear_quality jSetLQuality
-#define jpeg_add_quant_table jAddQuantTable
-#define jpeg_quality_scaling jQualityScaling
-#define jpeg_simple_progression jSimProgress
-#define jpeg_suppress_tables jSuppressTables
-#define jpeg_alloc_quant_table jAlcQTable
-#define jpeg_alloc_huff_table jAlcHTable
-#define jpeg_start_compress jStrtCompress
-#define jpeg_write_scanlines jWrtScanlines
-#define jpeg_finish_compress jFinCompress
-#define jpeg_write_raw_data jWrtRawData
-#define jpeg_write_marker jWrtMarker
-#define jpeg_write_m_header jWrtMHeader
-#define jpeg_write_m_byte jWrtMByte
-#define jpeg_write_tables jWrtTables
-#define jpeg_read_header jReadHeader
-#define jpeg_start_decompress jStrtDecompress
-#define jpeg_read_scanlines jReadScanlines
-#define jpeg_finish_decompress jFinDecompress
-#define jpeg_read_raw_data jReadRawData
-#define jpeg_has_multiple_scans jHasMultScn
-#define jpeg_start_output jStrtOutput
-#define jpeg_finish_output jFinOutput
-#define jpeg_input_complete jInComplete
-#define jpeg_new_colormap jNewCMap
-#define jpeg_consume_input jConsumeInput
-#define jpeg_calc_output_dimensions jCalcDimensions
-#define jpeg_save_markers jSaveMarkers
-#define jpeg_set_marker_processor jSetMarker
-#define jpeg_read_coefficients jReadCoefs
-#define jpeg_write_coefficients jWrtCoefs
-#define jpeg_copy_critical_parameters jCopyCrit
-#define jpeg_abort_compress jAbrtCompress
-#define jpeg_abort_decompress jAbrtDecompress
-#define jpeg_abort jAbort
-#define jpeg_destroy jDestroy
-#define jpeg_resync_to_restart jResyncRestart
-#endif /* NEED_SHORT_EXTERNAL_NAMES */
-
-
-/* Default error-management setup */
-EXTERN(struct jpeg_error_mgr *) jpeg_std_error
- JPP((struct jpeg_error_mgr * err));
-
-/* Initialization of JPEG compression objects.
- * jpeg_create_compress() and jpeg_create_decompress() are the exported
- * names that applications should call. These expand to calls on
- * jpeg_CreateCompress and jpeg_CreateDecompress with additional information
- * passed for version mismatch checking.
- * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx.
- */
-#define jpeg_create_compress(cinfo) \
- jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
- (size_t) sizeof(struct jpeg_compress_struct))
-#define jpeg_create_decompress(cinfo) \
- jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
- (size_t) sizeof(struct jpeg_decompress_struct))
-EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo,
- int version, size_t structsize));
-EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo,
- int version, size_t structsize));
-/* Destruction of JPEG compression objects */
-EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo));
-EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));
-
-/* Standard data source and destination managers: stdio streams. */
-/* Caller is responsible for opening the file before and closing after. */
-EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
-EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
-
-/* Default parameter setup for compression */
-EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo));
-/* Compression parameter setup aids */
-EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo,
- J_COLOR_SPACE colorspace));
-EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo));
-EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,
- boolean force_baseline));
-EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo,
- int scale_factor,
- boolean force_baseline));
-EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
- const unsigned int *basic_table,
- int scale_factor,
- boolean force_baseline));
-EXTERN(int) jpeg_quality_scaling JPP((int quality));
-EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo));
-EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo,
- boolean suppress));
-EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo));
-EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo));
-
-/* Main entry points for compression */
-EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo,
- boolean write_all_tables));
-EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo,
- JSAMPARRAY scanlines,
- JDIMENSION num_lines));
-EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo));
-
-/* Replaces jpeg_write_scanlines when writing raw downsampled data. */
-EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo,
- JSAMPIMAGE data,
- JDIMENSION num_lines));
-
-/* Write a special marker. See libjpeg.doc concerning safe usage. */
-EXTERN(void) jpeg_write_marker
- JPP((j_compress_ptr cinfo, int marker,
- const JOCTET * dataptr, unsigned int datalen));
-/* Same, but piecemeal. */
-EXTERN(void) jpeg_write_m_header
- JPP((j_compress_ptr cinfo, int marker, unsigned int datalen));
-EXTERN(void) jpeg_write_m_byte
- JPP((j_compress_ptr cinfo, int val));
-
-/* Alternate compression function: just write an abbreviated table file */
-EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo));
-
-/* Decompression startup: read start of JPEG datastream to see what's there */
-EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
- boolean require_image));
-/* Return value is one of: */
-#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */
-#define JPEG_HEADER_OK 1 /* Found valid image datastream */
-#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */
-/* If you pass require_image = TRUE (normal case), you need not check for
- * a TABLES_ONLY return code; an abbreviated file will cause an error exit.
- * JPEG_SUSPENDED is only possible if you use a data source module that can
- * give a suspension return (the stdio source module doesn't).
- */
-
-/* Main entry points for decompression */
-EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo));
-EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo,
- JSAMPARRAY scanlines,
- JDIMENSION max_lines));
-EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo));
-
-/* Replaces jpeg_read_scanlines when reading raw downsampled data. */
-EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo,
- JSAMPIMAGE data,
- JDIMENSION max_lines));
-
-/* Additional entry points for buffered-image mode. */
-EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo));
-EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo,
- int scan_number));
-EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo));
-EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo));
-EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo));
-EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo));
-/* Return value is one of: */
-/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */
-#define JPEG_REACHED_SOS 1 /* Reached start of new scan */
-#define JPEG_REACHED_EOI 2 /* Reached end of image */
-#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */
-#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */
-
-/* Precalculate output dimensions for current decompression parameters. */
-EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));
-
-/* Control saving of COM and APPn markers into marker_list. */
-EXTERN(void) jpeg_save_markers
- JPP((j_decompress_ptr cinfo, int marker_code,
- unsigned int length_limit));
-
-/* Install a special processing method for COM or APPn markers. */
-EXTERN(void) jpeg_set_marker_processor
- JPP((j_decompress_ptr cinfo, int marker_code,
- jpeg_marker_parser_method routine));
-
-/* Read or write raw DCT coefficients --- useful for lossless transcoding. */
-EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo));
-EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo,
- jvirt_barray_ptr * coef_arrays));
-EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo,
- j_compress_ptr dstinfo));
-
-/* If you choose to abort compression or decompression before completing
- * jpeg_finish_(de)compress, then you need to clean up to release memory,
- * temporary files, etc. You can just call jpeg_destroy_(de)compress
- * if you're done with the JPEG object, but if you want to clean it up and
- * reuse it, call this:
- */
-EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo));
-EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo));
-
-/* Generic versions of jpeg_abort and jpeg_destroy that work on either
- * flavor of JPEG object. These may be more convenient in some places.
- */
-EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo));
-EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo));
-
-/* Default restart-marker-resync procedure for use by data source modules */
-EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo,
- int desired));
-
-
-/* These marker codes are exported since applications and data source modules
- * are likely to want to use them.
- */
-
-#define JPEG_RST0 0xD0 /* RST0 marker code */
-#define JPEG_EOI 0xD9 /* EOI marker code */
-#define JPEG_APP0 0xE0 /* APP0 marker code */
-#define JPEG_COM 0xFE /* COM marker code */
-
-
-/* If we have a brain-damaged compiler that emits warnings (or worse, errors)
- * for structure definitions that are never filled in, keep it quiet by
- * supplying dummy definitions for the various substructures.
- */
-
-#ifdef INCOMPLETE_TYPES_BROKEN
-#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */
-struct jvirt_sarray_control { long dummy; };
-struct jvirt_barray_control { long dummy; };
-struct jpeg_comp_master { long dummy; };
-struct jpeg_c_main_controller { long dummy; };
-struct jpeg_c_prep_controller { long dummy; };
-struct jpeg_c_coef_controller { long dummy; };
-struct jpeg_marker_writer { long dummy; };
-struct jpeg_color_converter { long dummy; };
-struct jpeg_downsampler { long dummy; };
-struct jpeg_forward_dct { long dummy; };
-struct jpeg_entropy_encoder { long dummy; };
-struct jpeg_decomp_master { long dummy; };
-struct jpeg_d_main_controller { long dummy; };
-struct jpeg_d_coef_controller { long dummy; };
-struct jpeg_d_post_controller { long dummy; };
-struct jpeg_input_controller { long dummy; };
-struct jpeg_marker_reader { long dummy; };
-struct jpeg_entropy_decoder { long dummy; };
-struct jpeg_inverse_dct { long dummy; };
-struct jpeg_upsampler { long dummy; };
-struct jpeg_color_deconverter { long dummy; };
-struct jpeg_color_quantizer { long dummy; };
-#endif /* JPEG_INTERNALS */
-#endif /* INCOMPLETE_TYPES_BROKEN */
-
-#ifdef __cplusplus
-}
-#endif
-
-/*
- * The JPEG library modules define JPEG_INTERNALS before including this file.
- * The internal structure declarations are read only when that is true.
- * Applications using the library should not include jpegint.h, but may wish
- * to include jerror.h.
- */
-
-#ifdef JPEG_INTERNALS
-#include "jpegint.h" /* fetch private declarations */
-#include "jerror.h" /* fetch error codes too */
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* JPEGLIB_H */
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/png.h b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/png.h
deleted file mode 100644
index 18c60518..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/png.h
+++ /dev/null
@@ -1,3551 +0,0 @@
-
-/* png.h - header file for PNG reference library
- *
- * libpng version 1.2.24 - December 14, 2007
- * Copyright (c) 1998-2007 Glenn Randers-Pehrson
- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
- *
- * Authors and maintainers:
- * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
- * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- * libpng versions 0.97, January 1998, through 1.2.24 - December 14, 2007: Glenn
- * See also "Contributing Authors", below.
- *
- * Note about libpng version numbers:
- *
- * Due to various miscommunications, unforeseen code incompatibilities
- * and occasional factors outside the authors' control, version numbering
- * on the library has not always been consistent and straightforward.
- * The following table summarizes matters since version 0.89c, which was
- * the first widely used release:
- *
- * source png.h png.h shared-lib
- * version string int version
- * ------- ------ ----- ----------
- * 0.89c "1.0 beta 3" 0.89 89 1.0.89
- * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90]
- * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95]
- * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96]
- * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97]
- * 0.97c 0.97 97 2.0.97
- * 0.98 0.98 98 2.0.98
- * 0.99 0.99 98 2.0.99
- * 0.99a-m 0.99 99 2.0.99
- * 1.00 1.00 100 2.1.0 [100 should be 10000]
- * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000]
- * 1.0.1 png.h string is 10001 2.1.0
- * 1.0.1a-e identical to the 10002 from here on, the shared library
- * 1.0.2 source version) 10002 is 2.V where V is the source code
- * 1.0.2a-b 10003 version, except as noted.
- * 1.0.3 10003
- * 1.0.3a-d 10004
- * 1.0.4 10004
- * 1.0.4a-f 10005
- * 1.0.5 (+ 2 patches) 10005
- * 1.0.5a-d 10006
- * 1.0.5e-r 10100 (not source compatible)
- * 1.0.5s-v 10006 (not binary compatible)
- * 1.0.6 (+ 3 patches) 10006 (still binary incompatible)
- * 1.0.6d-f 10007 (still binary incompatible)
- * 1.0.6g 10007
- * 1.0.6h 10007 10.6h (testing xy.z so-numbering)
- * 1.0.6i 10007 10.6i
- * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
- * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible)
- * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
- * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
- * 1.0.7 1 10007 (still compatible)
- * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4
- * 1.0.8rc1 1 10008 2.1.0.8rc1
- * 1.0.8 1 10008 2.1.0.8
- * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6
- * 1.0.9rc1 1 10009 2.1.0.9rc1
- * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10
- * 1.0.9rc2 1 10009 2.1.0.9rc2
- * 1.0.9 1 10009 2.1.0.9
- * 1.0.10beta1 1 10010 2.1.0.10beta1
- * 1.0.10rc1 1 10010 2.1.0.10rc1
- * 1.0.10 1 10010 2.1.0.10
- * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
- * 1.0.11rc1 1 10011 2.1.0.11rc1
- * 1.0.11 1 10011 2.1.0.11
- * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2
- * 1.0.12rc1 2 10012 2.1.0.12rc1
- * 1.0.12 2 10012 2.1.0.12
- * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned)
- * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2
- * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5
- * 1.2.0rc1 3 10200 3.1.2.0rc1
- * 1.2.0 3 10200 3.1.2.0
- * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4
- * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2
- * 1.2.1 3 10201 3.1.2.1
- * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6
- * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1
- * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1
- * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1
- * 1.0.13 10 10013 10.so.0.1.0.13
- * 1.2.2 12 10202 12.so.0.1.2.2
- * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6
- * 1.2.3 12 10203 12.so.0.1.2.3
- * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3
- * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1
- * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1
- * 1.0.14 10 10014 10.so.0.1.0.14
- * 1.2.4 13 10204 12.so.0.1.2.4
- * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2
- * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3
- * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3
- * 1.0.15 10 10015 10.so.0.1.0.15
- * 1.2.5 13 10205 12.so.0.1.2.5
- * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4
- * 1.0.16 10 10016 10.so.0.1.0.16
- * 1.2.6 13 10206 12.so.0.1.2.6
- * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2
- * 1.0.17rc1 10 10017 10.so.0.1.0.17rc1
- * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1
- * 1.0.17 10 10017 10.so.0.1.0.17
- * 1.2.7 13 10207 12.so.0.1.2.7
- * 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5
- * 1.0.18rc1-5 10 10018 10.so.0.1.0.18rc1-5
- * 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5
- * 1.0.18 10 10018 10.so.0.1.0.18
- * 1.2.8 13 10208 12.so.0.1.2.8
- * 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3
- * 1.2.9beta4-11 13 10209 12.so.0.9[.0]
- * 1.2.9rc1 13 10209 12.so.0.9[.0]
- * 1.2.9 13 10209 12.so.0.9[.0]
- * 1.2.10beta1-8 13 10210 12.so.0.10[.0]
- * 1.2.10rc1-3 13 10210 12.so.0.10[.0]
- * 1.2.10 13 10210 12.so.0.10[.0]
- * 1.2.11beta1-4 13 10211 12.so.0.11[.0]
- * 1.0.19rc1-5 10 10019 10.so.0.19[.0]
- * 1.2.11rc1-5 13 10211 12.so.0.11[.0]
- * 1.0.19 10 10019 10.so.0.19[.0]
- * 1.2.11 13 10211 12.so.0.11[.0]
- * 1.0.20 10 10020 10.so.0.20[.0]
- * 1.2.12 13 10212 12.so.0.12[.0]
- * 1.2.13beta1 13 10213 12.so.0.13[.0]
- * 1.0.21 10 10021 10.so.0.21[.0]
- * 1.2.13 13 10213 12.so.0.13[.0]
- * 1.2.14beta1-2 13 10214 12.so.0.14[.0]
- * 1.0.22rc1 10 10022 10.so.0.22[.0]
- * 1.2.14rc1 13 10214 12.so.0.14[.0]
- * 1.0.22 10 10022 10.so.0.22[.0]
- * 1.2.14 13 10214 12.so.0.14[.0]
- * 1.2.15beta1-6 13 10215 12.so.0.15[.0]
- * 1.0.23rc1-5 10 10023 10.so.0.23[.0]
- * 1.2.15rc1-5 13 10215 12.so.0.15[.0]
- * 1.0.23 10 10023 10.so.0.23[.0]
- * 1.2.15 13 10215 12.so.0.15[.0]
- * 1.2.16beta1-2 13 10216 12.so.0.16[.0]
- * 1.2.16rc1 13 10216 12.so.0.16[.0]
- * 1.0.24 10 10024 10.so.0.24[.0]
- * 1.2.16 13 10216 12.so.0.16[.0]
- * 1.2.17beta1-2 13 10217 12.so.0.17[.0]
- * 1.0.25rc1 10 10025 10.so.0.25[.0]
- * 1.2.17rc1-3 13 10217 12.so.0.17[.0]
- * 1.0.25 10 10025 10.so.0.25[.0]
- * 1.2.17 13 10217 12.so.0.17[.0]
- * 1.0.26 10 10026 10.so.0.26[.0]
- * 1.2.18 13 10218 12.so.0.18[.0]
- * 1.2.19beta1-31 13 10219 12.so.0.19[.0]
- * 1.0.27rc1-6 10 10027 10.so.0.27[.0]
- * 1.2.19rc1-6 13 10219 12.so.0.19[.0]
- * 1.0.27 10 10027 10.so.0.27[.0]
- * 1.2.19 13 10219 12.so.0.19[.0]
- * 1.2.20beta01-04 13 10220 12.so.0.20[.0]
- * 1.0.28rc1-6 10 10028 10.so.0.28[.0]
- * 1.2.20rc1-6 13 10220 12.so.0.20[.0]
- * 1.0.28 10 10028 10.so.0.28[.0]
- * 1.2.20 13 10220 12.so.0.20[.0]
- * 1.2.21beta1-2 13 10221 12.so.0.21[.0]
- * 1.2.21rc1-3 13 10221 12.so.0.21[.0]
- * 1.0.29 10 10029 10.so.0.29[.0]
- * 1.2.21 13 10221 12.so.0.21[.0]
- * 1.2.22beta1-4 13 10222 12.so.0.22[.0]
- * 1.0.30rc1 10 10030 10.so.0.30[.0]
- * 1.2.22rc1 13 10222 12.so.0.22[.0]
- * 1.0.30 10 10030 10.so.0.30[.0]
- * 1.2.22 13 10222 12.so.0.22[.0]
- * 1.2.23beta01-05 13 10223 12.so.0.23[.0]
- * 1.2.23rc01 13 10223 12.so.0.23[.0]
- * 1.2.23 13 10223 12.so.0.23[.0]
- * 1.2.24beta01-02 13 10224 12.so.0.24[.0]
- * 1.2.24rc01 13 10224 12.so.0.24[.0]
- * 1.2.24 13 10224 12.so.0.24[.0]
- *
- * Henceforth the source version will match the shared-library major
- * and minor numbers; the shared-library major version number will be
- * used for changes in backward compatibility, as it is intended. The
- * PNG_LIBPNG_VER macro, which is not used within libpng but is available
- * for applications, is an unsigned integer of the form xyyzz corresponding
- * to the source version x.y.z (leading zeros in y and z). Beta versions
- * were given the previous public release number plus a letter, until
- * version 1.0.6j; from then on they were given the upcoming public
- * release number plus "betaNN" or "rcN".
- *
- * Binary incompatibility exists only when applications make direct access
- * to the info_ptr or png_ptr members through png.h, and the compiled
- * application is loaded with a different version of the library.
- *
- * DLLNUM will change each time there are forward or backward changes
- * in binary compatibility (e.g., when a new feature is added).
- *
- * See libpng.txt or libpng.3 for more information. The PNG specification
- * is available as a W3C Recommendation and as an ISO Specification,
- * <http://www.w3.org/TR/2003/REC-PNG-20031110/
- */
-
-/*
- * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
- *
- * If you modify libpng you may insert additional notices immediately following
- * this sentence.
- *
- * libpng versions 1.2.6, August 15, 2004, through 1.2.24, December 14, 2007, are
- * Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
- * distributed according to the same disclaimer and license as libpng-1.2.5
- * with the following individual added to the list of Contributing Authors:
- *
- * Cosmin Truta
- *
- * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
- * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
- * distributed according to the same disclaimer and license as libpng-1.0.6
- * with the following individuals added to the list of Contributing Authors:
- *
- * Simon-Pierre Cadieux
- * Eric S. Raymond
- * Gilles Vollant
- *
- * and with the following additions to the disclaimer:
- *
- * There is no warranty against interference with your enjoyment of the
- * library or against infringement. There is no warranty that our
- * efforts or the library will fulfill any of your particular purposes
- * or needs. This library is provided with all faults, and the entire
- * risk of satisfactory quality, performance, accuracy, and effort is with
- * the user.
- *
- * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are
- * distributed according to the same disclaimer and license as libpng-0.96,
- * with the following individuals added to the list of Contributing Authors:
- *
- * Tom Lane
- * Glenn Randers-Pehrson
- * Willem van Schaik
- *
- * libpng versions 0.89, June 1996, through 0.96, May 1997, are
- * Copyright (c) 1996, 1997 Andreas Dilger
- * Distributed according to the same disclaimer and license as libpng-0.88,
- * with the following individuals added to the list of Contributing Authors:
- *
- * John Bowler
- * Kevin Bracey
- * Sam Bushell
- * Magnus Holmgren
- * Greg Roelofs
- * Tom Tanner
- *
- * libpng versions 0.5, May 1995, through 0.88, January 1996, are
- * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
- *
- * For the purposes of this copyright and license, "Contributing Authors"
- * is defined as the following set of individuals:
- *
- * Andreas Dilger
- * Dave Martindale
- * Guy Eric Schalnat
- * Paul Schmidt
- * Tim Wegner
- *
- * The PNG Reference Library is supplied "AS IS". The Contributing Authors
- * and Group 42, Inc. disclaim all warranties, expressed or implied,
- * including, without limitation, the warranties of merchantability and of
- * fitness for any purpose. The Contributing Authors and Group 42, Inc.
- * assume no liability for direct, indirect, incidental, special, exemplary,
- * or consequential damages, which may result from the use of the PNG
- * Reference Library, even if advised of the possibility of such damage.
- *
- * Permission is hereby granted to use, copy, modify, and distribute this
- * source code, or portions hereof, for any purpose, without fee, subject
- * to the following restrictions:
- *
- * 1. The origin of this source code must not be misrepresented.
- *
- * 2. Altered versions must be plainly marked as such and
- * must not be misrepresented as being the original source.
- *
- * 3. This Copyright notice may not be removed or altered from
- * any source or altered source distribution.
- *
- * The Contributing Authors and Group 42, Inc. specifically permit, without
- * fee, and encourage the use of this source code as a component to
- * supporting the PNG file format in commercial products. If you use this
- * source code in a product, acknowledgment is not required but would be
- * appreciated.
- */
-
-/*
- * A "png_get_copyright" function is available, for convenient use in "about"
- * boxes and the like:
- *
- * printf("%s",png_get_copyright(NULL));
- *
- * Also, the PNG logo (in PNG format, of course) is supplied in the
- * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
- */
-
-/*
- * Libpng is OSI Certified Open Source Software. OSI Certified is a
- * certification mark of the Open Source Initiative.
- */
-
-/*
- * The contributing authors would like to thank all those who helped
- * with testing, bug fixes, and patience. This wouldn't have been
- * possible without all of you.
- *
- * Thanks to Frank J. T. Wojcik for helping with the documentation.
- */
-
-/*
- * Y2K compliance in libpng:
- * =========================
- *
- * December 14, 2007
- *
- * Since the PNG Development group is an ad-hoc body, we can't make
- * an official declaration.
- *
- * This is your unofficial assurance that libpng from version 0.71 and
- * upward through 1.2.24 are Y2K compliant. It is my belief that earlier
- * versions were also Y2K compliant.
- *
- * Libpng only has three year fields. One is a 2-byte unsigned integer
- * that will hold years up to 65535. The other two hold the date in text
- * format, and will hold years up to 9999.
- *
- * The integer is
- * "png_uint_16 year" in png_time_struct.
- *
- * The strings are
- * "png_charp time_buffer" in png_struct and
- * "near_time_buffer", which is a local character string in png.c.
- *
- * There are seven time-related functions:
- * png.c: png_convert_to_rfc_1123() in png.c
- * (formerly png_convert_to_rfc_1152() in error)
- * png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
- * png_convert_from_time_t() in pngwrite.c
- * png_get_tIME() in pngget.c
- * png_handle_tIME() in pngrutil.c, called in pngread.c
- * png_set_tIME() in pngset.c
- * png_write_tIME() in pngwutil.c, called in pngwrite.c
- *
- * All handle dates properly in a Y2K environment. The
- * png_convert_from_time_t() function calls gmtime() to convert from system
- * clock time, which returns (year - 1900), which we properly convert to
- * the full 4-digit year. There is a possibility that applications using
- * libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
- * function, or that they are incorrectly passing only a 2-digit year
- * instead of "year - 1900" into the png_convert_from_struct_tm() function,
- * but this is not under our control. The libpng documentation has always
- * stated that it works with 4-digit years, and the APIs have been
- * documented as such.
- *
- * The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
- * integer to hold the year, and can hold years as large as 65535.
- *
- * zlib, upon which libpng depends, is also Y2K compliant. It contains
- * no date-related code.
- *
- * Glenn Randers-Pehrson
- * libpng maintainer
- * PNG Development Group
- */
-
-#ifndef PNG_H
-#define PNG_H
-
-/* This is not the place to learn how to use libpng. The file libpng.txt
- * describes how to use libpng, and the file example.c summarizes it
- * with some code on which to build. This file is useful for looking
- * at the actual function definitions and structure components.
- */
-
-/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.2.24"
-#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.2.24 - December 14, 2007\n"
-
-#define PNG_LIBPNG_VER_SONUM 0
-#define PNG_LIBPNG_VER_DLLNUM 13
-
-/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
-#define PNG_LIBPNG_VER_MAJOR 1
-#define PNG_LIBPNG_VER_MINOR 2
-#define PNG_LIBPNG_VER_RELEASE 24
-/* This should match the numeric part of the final component of
- * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
-
-#define PNG_LIBPNG_VER_BUILD 0
-
-/* Release Status */
-#define PNG_LIBPNG_BUILD_ALPHA 1
-#define PNG_LIBPNG_BUILD_BETA 2
-#define PNG_LIBPNG_BUILD_RC 3
-#define PNG_LIBPNG_BUILD_STABLE 4
-#define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
-
-/* Release-Specific Flags */
-#define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with
- PNG_LIBPNG_BUILD_STABLE only */
-#define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with
- PNG_LIBPNG_BUILD_SPECIAL */
-#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
- PNG_LIBPNG_BUILD_PRIVATE */
-
-#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
-
-/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
- * We must not include leading zeros.
- * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
- * version 1.0.0 was mis-numbered 100 instead of 10000). From
- * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */
-#define PNG_LIBPNG_VER 10224 /* 1.2.24 */
-
-#ifndef PNG_VERSION_INFO_ONLY
-/* include the compression library's header */
-#include "zlib.h"
-#endif
-
-/* include all user configurable info, including optional assembler routines */
-#include "pngconf.h"
-
-/*
- * Added at libpng-1.2.8 */
-/* Ref MSDN: Private as priority over Special
- * VS_FF_PRIVATEBUILD File *was not* built using standard release
- * procedures. If this value is given, the StringFileInfo block must
- * contain a PrivateBuild string.
- *
- * VS_FF_SPECIALBUILD File *was* built by the original company using
- * standard release procedures but is a variation of the standard
- * file of the same version number. If this value is given, the
- * StringFileInfo block must contain a SpecialBuild string.
- */
-
-#if defined(PNG_USER_PRIVATEBUILD)
-# define PNG_LIBPNG_BUILD_TYPE \
- (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)
-#else
-# if defined(PNG_LIBPNG_SPECIALBUILD)
-# define PNG_LIBPNG_BUILD_TYPE \
- (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)
-# else
-# define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE)
-# endif
-#endif
-
-#ifndef PNG_VERSION_INFO_ONLY
-
-/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/* This file is arranged in several sections. The first section contains
- * structure and type definitions. The second section contains the external
- * library functions, while the third has the internal library functions,
- * which applications aren't expected to use directly.
- */
-
-#ifndef PNG_NO_TYPECAST_NULL
-#define int_p_NULL (int *)NULL
-#define png_bytep_NULL (png_bytep)NULL
-#define png_bytepp_NULL (png_bytepp)NULL
-#define png_doublep_NULL (png_doublep)NULL
-#define png_error_ptr_NULL (png_error_ptr)NULL
-#define png_flush_ptr_NULL (png_flush_ptr)NULL
-#define png_free_ptr_NULL (png_free_ptr)NULL
-#define png_infopp_NULL (png_infopp)NULL
-#define png_malloc_ptr_NULL (png_malloc_ptr)NULL
-#define png_read_status_ptr_NULL (png_read_status_ptr)NULL
-#define png_rw_ptr_NULL (png_rw_ptr)NULL
-#define png_structp_NULL (png_structp)NULL
-#define png_uint_16p_NULL (png_uint_16p)NULL
-#define png_voidp_NULL (png_voidp)NULL
-#define png_write_status_ptr_NULL (png_write_status_ptr)NULL
-#else
-#define int_p_NULL NULL
-#define png_bytep_NULL NULL
-#define png_bytepp_NULL NULL
-#define png_doublep_NULL NULL
-#define png_error_ptr_NULL NULL
-#define png_flush_ptr_NULL NULL
-#define png_free_ptr_NULL NULL
-#define png_infopp_NULL NULL
-#define png_malloc_ptr_NULL NULL
-#define png_read_status_ptr_NULL NULL
-#define png_rw_ptr_NULL NULL
-#define png_structp_NULL NULL
-#define png_uint_16p_NULL NULL
-#define png_voidp_NULL NULL
-#define png_write_status_ptr_NULL NULL
-#endif
-
-/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
-#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
-/* Version information for C files, stored in png.c. This had better match
- * the version above.
- */
-#ifdef PNG_USE_GLOBAL_ARRAYS
-PNG_EXPORT_VAR (PNG_CONST char) png_libpng_ver[18];
- /* need room for 99.99.99beta99z */
-#else
-#define png_libpng_ver png_get_header_ver(NULL)
-#endif
-
-#ifdef PNG_USE_GLOBAL_ARRAYS
-/* This was removed in version 1.0.5c */
-/* Structures to facilitate easy interlacing. See png.c for more details */
-PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_start[7];
-PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_inc[7];
-PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_ystart[7];
-PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_yinc[7];
-PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_mask[7];
-PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_dsp_mask[7];
-/* This isn't currently used. If you need it, see png.c for more details.
-PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_height[7];
-*/
-#endif
-
-#endif /* PNG_NO_EXTERN */
-
-/* Three color definitions. The order of the red, green, and blue, (and the
- * exact size) is not important, although the size of the fields need to
- * be png_byte or png_uint_16 (as defined below).
- */
-typedef struct png_color_struct
-{
- png_byte red;
- png_byte green;
- png_byte blue;
-} png_color;
-typedef png_color FAR * png_colorp;
-typedef png_color FAR * FAR * png_colorpp;
-
-typedef struct png_color_16_struct
-{
- png_byte index; /* used for palette files */
- png_uint_16 red; /* for use in red green blue files */
- png_uint_16 green;
- png_uint_16 blue;
- png_uint_16 gray; /* for use in grayscale files */
-} png_color_16;
-typedef png_color_16 FAR * png_color_16p;
-typedef png_color_16 FAR * FAR * png_color_16pp;
-
-typedef struct png_color_8_struct
-{
- png_byte red; /* for use in red green blue files */
- png_byte green;
- png_byte blue;
- png_byte gray; /* for use in grayscale files */
- png_byte alpha; /* for alpha channel files */
-} png_color_8;
-typedef png_color_8 FAR * png_color_8p;
-typedef png_color_8 FAR * FAR * png_color_8pp;
-
-/*
- * The following two structures are used for the in-core representation
- * of sPLT chunks.
- */
-typedef struct png_sPLT_entry_struct
-{
- png_uint_16 red;
- png_uint_16 green;
- png_uint_16 blue;
- png_uint_16 alpha;
- png_uint_16 frequency;
-} png_sPLT_entry;
-typedef png_sPLT_entry FAR * png_sPLT_entryp;
-typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp;
-
-/* When the depth of the sPLT palette is 8 bits, the color and alpha samples
- * occupy the LSB of their respective members, and the MSB of each member
- * is zero-filled. The frequency member always occupies the full 16 bits.
- */
-
-typedef struct png_sPLT_struct
-{
- png_charp name; /* palette name */
- png_byte depth; /* depth of palette samples */
- png_sPLT_entryp entries; /* palette entries */
- png_int_32 nentries; /* number of palette entries */
-} png_sPLT_t;
-typedef png_sPLT_t FAR * png_sPLT_tp;
-typedef png_sPLT_t FAR * FAR * png_sPLT_tpp;
-
-#ifdef PNG_TEXT_SUPPORTED
-/* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file,
- * and whether that contents is compressed or not. The "key" field
- * points to a regular zero-terminated C string. The "text", "lang", and
- * "lang_key" fields can be regular C strings, empty strings, or NULL pointers.
- * However, the * structure returned by png_get_text() will always contain
- * regular zero-terminated C strings (possibly empty), never NULL pointers,
- * so they can be safely used in printf() and other string-handling functions.
- */
-typedef struct png_text_struct
-{
- int compression; /* compression value:
- -1: tEXt, none
- 0: zTXt, deflate
- 1: iTXt, none
- 2: iTXt, deflate */
- png_charp key; /* keyword, 1-79 character description of "text" */
- png_charp text; /* comment, may be an empty string (ie "")
- or a NULL pointer */
- png_size_t text_length; /* length of the text string */
-#ifdef PNG_iTXt_SUPPORTED
- png_size_t itxt_length; /* length of the itxt string */
- png_charp lang; /* language code, 0-79 characters
- or a NULL pointer */
- png_charp lang_key; /* keyword translated UTF-8 string, 0 or more
- chars or a NULL pointer */
-#endif
-} png_text;
-typedef png_text FAR * png_textp;
-typedef png_text FAR * FAR * png_textpp;
-#endif
-
-/* Supported compression types for text in PNG files (tEXt, and zTXt).
- * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */
-#define PNG_TEXT_COMPRESSION_NONE_WR -3
-#define PNG_TEXT_COMPRESSION_zTXt_WR -2
-#define PNG_TEXT_COMPRESSION_NONE -1
-#define PNG_TEXT_COMPRESSION_zTXt 0
-#define PNG_ITXT_COMPRESSION_NONE 1
-#define PNG_ITXT_COMPRESSION_zTXt 2
-#define PNG_TEXT_COMPRESSION_LAST 3 /* Not a valid value */
-
-/* png_time is a way to hold the time in an machine independent way.
- * Two conversions are provided, both from time_t and struct tm. There
- * is no portable way to convert to either of these structures, as far
- * as I know. If you know of a portable way, send it to me. As a side
- * note - PNG has always been Year 2000 compliant!
- */
-typedef struct png_time_struct
-{
- png_uint_16 year; /* full year, as in, 1995 */
- png_byte month; /* month of year, 1 - 12 */
- png_byte day; /* day of month, 1 - 31 */
- png_byte hour; /* hour of day, 0 - 23 */
- png_byte minute; /* minute of hour, 0 - 59 */
- png_byte second; /* second of minute, 0 - 60 (for leap seconds) */
-} png_time;
-typedef png_time FAR * png_timep;
-typedef png_time FAR * FAR * png_timepp;
-
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
-/* png_unknown_chunk is a structure to hold queued chunks for which there is
- * no specific support. The idea is that we can use this to queue
- * up private chunks for output even though the library doesn't actually
- * know about their semantics.
- */
-#define PNG_CHUNK_NAME_LENGTH 5
-typedef struct png_unknown_chunk_t
-{
- png_byte name[PNG_CHUNK_NAME_LENGTH];
- png_byte *data;
- png_size_t size;
-
- /* libpng-using applications should NOT directly modify this byte. */
- png_byte location; /* mode of operation at read time */
-}
-png_unknown_chunk;
-typedef png_unknown_chunk FAR * png_unknown_chunkp;
-typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;
-#endif
-
-/* png_info is a structure that holds the information in a PNG file so
- * that the application can find out the characteristics of the image.
- * If you are reading the file, this structure will tell you what is
- * in the PNG file. If you are writing the file, fill in the information
- * you want to put into the PNG file, then call png_write_info().
- * The names chosen should be very close to the PNG specification, so
- * consult that document for information about the meaning of each field.
- *
- * With libpng < 0.95, it was only possible to directly set and read the
- * the values in the png_info_struct, which meant that the contents and
- * order of the values had to remain fixed. With libpng 0.95 and later,
- * however, there are now functions that abstract the contents of
- * png_info_struct from the application, so this makes it easier to use
- * libpng with dynamic libraries, and even makes it possible to use
- * libraries that don't have all of the libpng ancillary chunk-handing
- * functionality.
- *
- * In any case, the order of the parameters in png_info_struct should NOT
- * be changed for as long as possible to keep compatibility with applications
- * that use the old direct-access method with png_info_struct.
- *
- * The following members may have allocated storage attached that should be
- * cleaned up before the structure is discarded: palette, trans, text,
- * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
- * splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
- * are automatically freed when the info structure is deallocated, if they were
- * allocated internally by libpng. This behavior can be changed by means
- * of the png_data_freer() function.
- *
- * More allocation details: all the chunk-reading functions that
- * change these members go through the corresponding png_set_*
- * functions. A function to clear these members is available: see
- * png_free_data(). The png_set_* functions do not depend on being
- * able to point info structure members to any of the storage they are
- * passed (they make their own copies), EXCEPT that the png_set_text
- * functions use the same storage passed to them in the text_ptr or
- * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
- * functions do not make their own copies.
- */
-typedef struct png_info_struct
-{
- /* the following are necessary for every PNG file */
- png_uint_32 width; /* width of image in pixels (from IHDR) */
- png_uint_32 height; /* height of image in pixels (from IHDR) */
- png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
- png_uint_32 rowbytes; /* bytes needed to hold an untransformed row */
- png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
- png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
- png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
- png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
- png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */
- /* The following three should have been named *_method not *_type */
- png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
- png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
- png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
-
- /* The following is informational only on read, and not used on writes. */
- png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
- png_byte pixel_depth; /* number of bits per pixel */
- png_byte spare_byte; /* to align the data, and for future use */
- png_byte signature[8]; /* magic bytes read by libpng from start of file */
-
- /* The rest of the data is optional. If you are reading, check the
- * valid field to see if the information in these are valid. If you
- * are writing, set the valid field to those chunks you want written,
- * and initialize the appropriate fields below.
- */
-
-#if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
- /* The gAMA chunk describes the gamma characteristics of the system
- * on which the image was created, normally in the range [1.0, 2.5].
- * Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
- */
- float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
-#endif
-
-#if defined(PNG_sRGB_SUPPORTED)
- /* GR-P, 0.96a */
- /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
- png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
-#endif
-
-#if defined(PNG_TEXT_SUPPORTED)
- /* The tEXt, and zTXt chunks contain human-readable textual data in
- * uncompressed, compressed, and optionally compressed forms, respectively.
- * The data in "text" is an array of pointers to uncompressed,
- * null-terminated C strings. Each chunk has a keyword that describes the
- * textual data contained in that chunk. Keywords are not required to be
- * unique, and the text string may be empty. Any number of text chunks may
- * be in an image.
- */
- int num_text; /* number of comments read/to write */
- int max_text; /* current size of text array */
- png_textp text; /* array of comments read/to write */
-#endif /* PNG_TEXT_SUPPORTED */
-
-#if defined(PNG_tIME_SUPPORTED)
- /* The tIME chunk holds the last time the displayed image data was
- * modified. See the png_time struct for the contents of this struct.
- */
- png_time mod_time;
-#endif
-
-#if defined(PNG_sBIT_SUPPORTED)
- /* The sBIT chunk specifies the number of significant high-order bits
- * in the pixel data. Values are in the range [1, bit_depth], and are
- * only specified for the channels in the pixel data. The contents of
- * the low-order bits is not specified. Data is valid if
- * (valid & PNG_INFO_sBIT) is non-zero.
- */
- png_color_8 sig_bit; /* significant bits in color channels */
-#endif
-
-#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
-defined(PNG_READ_BACKGROUND_SUPPORTED)
- /* The tRNS chunk supplies transparency data for paletted images and
- * other image types that don't need a full alpha channel. There are
- * "num_trans" transparency values for a paletted image, stored in the
- * same order as the palette colors, starting from index 0. Values
- * for the data are in the range [0, 255], ranging from fully transparent
- * to fully opaque, respectively. For non-paletted images, there is a
- * single color specified that should be treated as fully transparent.
- * Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
- */
- png_bytep trans; /* transparent values for paletted image */
- png_color_16 trans_values; /* transparent color for non-palette image */
-#endif
-
-#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- /* The bKGD chunk gives the suggested image background color if the
- * display program does not have its own background color and the image
- * is needs to composited onto a background before display. The colors
- * in "background" are normally in the same color space/depth as the
- * pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
- */
- png_color_16 background;
-#endif
-
-#if defined(PNG_oFFs_SUPPORTED)
- /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
- * and downwards from the top-left corner of the display, page, or other
- * application-specific co-ordinate space. See the PNG_OFFSET_ defines
- * below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
- */
- png_int_32 x_offset; /* x offset on page */
- png_int_32 y_offset; /* y offset on page */
- png_byte offset_unit_type; /* offset units type */
-#endif
-
-#if defined(PNG_pHYs_SUPPORTED)
- /* The pHYs chunk gives the physical pixel density of the image for
- * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
- * defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
- */
- png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
- png_uint_32 y_pixels_per_unit; /* vertical pixel density */
- png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
-#endif
-
-#if defined(PNG_hIST_SUPPORTED)
- /* The hIST chunk contains the relative frequency or importance of the
- * various palette entries, so that a viewer can intelligently select a
- * reduced-color palette, if required. Data is an array of "num_palette"
- * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
- * is non-zero.
- */
- png_uint_16p hist;
-#endif
-
-#ifdef PNG_cHRM_SUPPORTED
- /* The cHRM chunk describes the CIE color characteristics of the monitor
- * on which the PNG was created. This data allows the viewer to do gamut
- * mapping of the input image to ensure that the viewer sees the same
- * colors in the image as the creator. Values are in the range
- * [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
- */
-#ifdef PNG_FLOATING_POINT_SUPPORTED
- float x_white;
- float y_white;
- float x_red;
- float y_red;
- float x_green;
- float y_green;
- float x_blue;
- float y_blue;
-#endif
-#endif
-
-#if defined(PNG_pCAL_SUPPORTED)
- /* The pCAL chunk describes a transformation between the stored pixel
- * values and original physical data values used to create the image.
- * The integer range [0, 2^bit_depth - 1] maps to the floating-point
- * range given by [pcal_X0, pcal_X1], and are further transformed by a
- * (possibly non-linear) transformation function given by "pcal_type"
- * and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
- * defines below, and the PNG-Group's PNG extensions document for a
- * complete description of the transformations and how they should be
- * implemented, and for a description of the ASCII parameter strings.
- * Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
- */
- png_charp pcal_purpose; /* pCAL chunk description string */
- png_int_32 pcal_X0; /* minimum value */
- png_int_32 pcal_X1; /* maximum value */
- png_charp pcal_units; /* Latin-1 string giving physical units */
- png_charpp pcal_params; /* ASCII strings containing parameter values */
- png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */
- png_byte pcal_nparams; /* number of parameters given in pcal_params */
-#endif
-
-/* New members added in libpng-1.0.6 */
-#ifdef PNG_FREE_ME_SUPPORTED
- png_uint_32 free_me; /* flags items libpng is responsible for freeing */
-#endif
-
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
- /* storage for unknown chunks that the library doesn't recognize. */
- png_unknown_chunkp unknown_chunks;
- png_size_t unknown_chunks_num;
-#endif
-
-#if defined(PNG_iCCP_SUPPORTED)
- /* iCCP chunk data. */
- png_charp iccp_name; /* profile name */
- png_charp iccp_profile; /* International Color Consortium profile data */
- /* Note to maintainer: should be png_bytep */
- png_uint_32 iccp_proflen; /* ICC profile data length */
- png_byte iccp_compression; /* Always zero */
-#endif
-
-#if defined(PNG_sPLT_SUPPORTED)
- /* data on sPLT chunks (there may be more than one). */
- png_sPLT_tp splt_palettes;
- png_uint_32 splt_palettes_num;
-#endif
-
-#if defined(PNG_sCAL_SUPPORTED)
- /* The sCAL chunk describes the actual physical dimensions of the
- * subject matter of the graphic. The chunk contains a unit specification
- * a byte value, and two ASCII strings representing floating-point
- * values. The values are width and height corresponsing to one pixel
- * in the image. This external representation is converted to double
- * here. Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.
- */
- png_byte scal_unit; /* unit of physical scale */
-#ifdef PNG_FLOATING_POINT_SUPPORTED
- double scal_pixel_width; /* width of one pixel */
- double scal_pixel_height; /* height of one pixel */
-#endif
-#ifdef PNG_FIXED_POINT_SUPPORTED
- png_charp scal_s_width; /* string containing height */
- png_charp scal_s_height; /* string containing width */
-#endif
-#endif
-
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
- /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */
- /* Data valid if (valid & PNG_INFO_IDAT) non-zero */
- png_bytepp row_pointers; /* the image bits */
-#endif
-
-#if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
- png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */
-#endif
-
-#if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
- png_fixed_point int_x_white;
- png_fixed_point int_y_white;
- png_fixed_point int_x_red;
- png_fixed_point int_y_red;
- png_fixed_point int_x_green;
- png_fixed_point int_y_green;
- png_fixed_point int_x_blue;
- png_fixed_point int_y_blue;
-#endif
-
-} png_info;
-
-typedef png_info FAR * png_infop;
-typedef png_info FAR * FAR * png_infopp;
-
-/* Maximum positive integer used in PNG is (2^31)-1 */
-#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
-#define PNG_UINT_32_MAX ((png_uint_32)(-1))
-#define PNG_SIZE_MAX ((png_size_t)(-1))
-#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
-/* PNG_MAX_UINT is deprecated; use PNG_UINT_31_MAX instead. */
-#define PNG_MAX_UINT PNG_UINT_31_MAX
-#endif
-
-/* These describe the color_type field in png_info. */
-/* color type masks */
-#define PNG_COLOR_MASK_PALETTE 1
-#define PNG_COLOR_MASK_COLOR 2
-#define PNG_COLOR_MASK_ALPHA 4
-
-/* color types. Note that not all combinations are legal */
-#define PNG_COLOR_TYPE_GRAY 0
-#define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
-#define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR)
-#define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
-#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
-/* aliases */
-#define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA
-#define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA
-
-/* This is for compression type. PNG 1.0-1.2 only define the single type. */
-#define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */
-#define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE
-
-/* This is for filter type. PNG 1.0-1.2 only define the single type. */
-#define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */
-#define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */
-#define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE
-
-/* These are for the interlacing type. These values should NOT be changed. */
-#define PNG_INTERLACE_NONE 0 /* Non-interlaced image */
-#define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */
-#define PNG_INTERLACE_LAST 2 /* Not a valid value */
-
-/* These are for the oFFs chunk. These values should NOT be changed. */
-#define PNG_OFFSET_PIXEL 0 /* Offset in pixels */
-#define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */
-#define PNG_OFFSET_LAST 2 /* Not a valid value */
-
-/* These are for the pCAL chunk. These values should NOT be changed. */
-#define PNG_EQUATION_LINEAR 0 /* Linear transformation */
-#define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */
-#define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */
-#define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */
-#define PNG_EQUATION_LAST 4 /* Not a valid value */
-
-/* These are for the sCAL chunk. These values should NOT be changed. */
-#define PNG_SCALE_UNKNOWN 0 /* unknown unit (image scale) */
-#define PNG_SCALE_METER 1 /* meters per pixel */
-#define PNG_SCALE_RADIAN 2 /* radians per pixel */
-#define PNG_SCALE_LAST 3 /* Not a valid value */
-
-/* These are for the pHYs chunk. These values should NOT be changed. */
-#define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */
-#define PNG_RESOLUTION_METER 1 /* pixels/meter */
-#define PNG_RESOLUTION_LAST 2 /* Not a valid value */
-
-/* These are for the sRGB chunk. These values should NOT be changed. */
-#define PNG_sRGB_INTENT_PERCEPTUAL 0
-#define PNG_sRGB_INTENT_RELATIVE 1
-#define PNG_sRGB_INTENT_SATURATION 2
-#define PNG_sRGB_INTENT_ABSOLUTE 3
-#define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */
-
-/* This is for text chunks */
-#define PNG_KEYWORD_MAX_LENGTH 79
-
-/* Maximum number of entries in PLTE/sPLT/tRNS arrays */
-#define PNG_MAX_PALETTE_LENGTH 256
-
-/* These determine if an ancillary chunk's data has been successfully read
- * from the PNG header, or if the application has filled in the corresponding
- * data in the info_struct to be written into the output file. The values
- * of the PNG_INFO_<chunk> defines should NOT be changed.
- */
-#define PNG_INFO_gAMA 0x0001
-#define PNG_INFO_sBIT 0x0002
-#define PNG_INFO_cHRM 0x0004
-#define PNG_INFO_PLTE 0x0008
-#define PNG_INFO_tRNS 0x0010
-#define PNG_INFO_bKGD 0x0020
-#define PNG_INFO_hIST 0x0040
-#define PNG_INFO_pHYs 0x0080
-#define PNG_INFO_oFFs 0x0100
-#define PNG_INFO_tIME 0x0200
-#define PNG_INFO_pCAL 0x0400
-#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */
-#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
-#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
-#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
-#define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */
-
-/* This is used for the transformation routines, as some of them
- * change these values for the row. It also should enable using
- * the routines for other purposes.
- */
-typedef struct png_row_info_struct
-{
- png_uint_32 width; /* width of row */
- png_uint_32 rowbytes; /* number of bytes in row */
- png_byte color_type; /* color type of row */
- png_byte bit_depth; /* bit depth of row */
- png_byte channels; /* number of channels (1, 2, 3, or 4) */
- png_byte pixel_depth; /* bits per pixel (depth * channels) */
-} png_row_info;
-
-typedef png_row_info FAR * png_row_infop;
-typedef png_row_info FAR * FAR * png_row_infopp;
-
-/* These are the function types for the I/O functions and for the functions
- * that allow the user to override the default I/O functions with his or her
- * own. The png_error_ptr type should match that of user-supplied warning
- * and error functions, while the png_rw_ptr type should match that of the
- * user read/write data functions.
- */
-typedef struct png_struct_def png_struct;
-typedef png_struct FAR * png_structp;
-
-typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp));
-typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t));
-typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp));
-typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32,
- int));
-typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32,
- int));
-
-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop));
-typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop));
-typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
- png_uint_32, int));
-#endif
-
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
- defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
- defined(PNG_LEGACY_SUPPORTED)
-typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
- png_row_infop, png_bytep));
-#endif
-
-#if defined(PNG_USER_CHUNKS_SUPPORTED)
-typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
-#endif
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
-typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
-#endif
-
-/* Transform masks for the high-level interface */
-#define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */
-#define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */
-#define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */
-#define PNG_TRANSFORM_PACKING 0x0004 /* read and write */
-#define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */
-#define PNG_TRANSFORM_EXPAND 0x0010 /* read only */
-#define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */
-#define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */
-#define PNG_TRANSFORM_BGR 0x0080 /* read and write */
-#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */
-#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */
-#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */
-#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */
-
-/* Flags for MNG supported features */
-#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
-#define PNG_FLAG_MNG_FILTER_64 0x04
-#define PNG_ALL_MNG_FEATURES 0x05
-
-typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));
-typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));
-
-/* The structure that holds the information to read and write PNG files.
- * The only people who need to care about what is inside of this are the
- * people who will be modifying the library for their own special needs.
- * It should NOT be accessed directly by an application, except to store
- * the jmp_buf.
- */
-
-struct png_struct_def
-{
-#ifdef PNG_SETJMP_SUPPORTED
- jmp_buf jmpbuf; /* used in png_error */
-#endif
- png_error_ptr error_fn; /* function for printing errors and aborting */
- png_error_ptr warning_fn; /* function for printing warnings */
- png_voidp error_ptr; /* user supplied struct for error functions */
- png_rw_ptr write_data_fn; /* function for writing output data */
- png_rw_ptr read_data_fn; /* function for reading input data */
- png_voidp io_ptr; /* ptr to application struct for I/O functions */
-
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
- png_user_transform_ptr read_user_transform_fn; /* user read transform */
-#endif
-
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
- png_user_transform_ptr write_user_transform_fn; /* user write transform */
-#endif
-
-/* These were added in libpng-1.0.2 */
-#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
- defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
- png_voidp user_transform_ptr; /* user supplied struct for user transform */
- png_byte user_transform_depth; /* bit depth of user transformed pixels */
- png_byte user_transform_channels; /* channels in user transformed pixels */
-#endif
-#endif
-
- png_uint_32 mode; /* tells us where we are in the PNG file */
- png_uint_32 flags; /* flags indicating various things to libpng */
- png_uint_32 transformations; /* which transformations to perform */
-
- z_stream zstream; /* pointer to decompression structure (below) */
- png_bytep zbuf; /* buffer for zlib */
- png_size_t zbuf_size; /* size of zbuf */
- int zlib_level; /* holds zlib compression level */
- int zlib_method; /* holds zlib compression method */
- int zlib_window_bits; /* holds zlib compression window bits */
- int zlib_mem_level; /* holds zlib compression memory level */
- int zlib_strategy; /* holds zlib compression strategy */
-
- png_uint_32 width; /* width of image in pixels */
- png_uint_32 height; /* height of image in pixels */
- png_uint_32 num_rows; /* number of rows in current pass */
- png_uint_32 usr_width; /* width of row at start of write */
- png_uint_32 rowbytes; /* size of row in bytes */
- png_uint_32 irowbytes; /* size of current interlaced row in bytes */
- png_uint_32 iwidth; /* width of current interlaced row in pixels */
- png_uint_32 row_number; /* current row in interlace pass */
- png_bytep prev_row; /* buffer to save previous (unfiltered) row */
- png_bytep row_buf; /* buffer to save current (unfiltered) row */
-#ifndef PNG_NO_WRITE_FILTERING
- png_bytep sub_row; /* buffer to save "sub" row when filtering */
- png_bytep up_row; /* buffer to save "up" row when filtering */
- png_bytep avg_row; /* buffer to save "avg" row when filtering */
- png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
-#endif
- png_row_info row_info; /* used for transformation routines */
-
- png_uint_32 idat_size; /* current IDAT size for read */
- png_uint_32 crc; /* current chunk CRC value */
- png_colorp palette; /* palette from the input file */
- png_uint_16 num_palette; /* number of color entries in palette */
- png_uint_16 num_trans; /* number of transparency values */
- png_byte chunk_name[5]; /* null-terminated name of current chunk */
- png_byte compression; /* file compression type (always 0) */
- png_byte filter; /* file filter type (always 0) */
- png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
- png_byte pass; /* current interlace pass (0 - 6) */
- png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
- png_byte color_type; /* color type of file */
- png_byte bit_depth; /* bit depth of file */
- png_byte usr_bit_depth; /* bit depth of users row */
- png_byte pixel_depth; /* number of bits per pixel */
- png_byte channels; /* number of channels in file */
- png_byte usr_channels; /* channels at start of write */
- png_byte sig_bytes; /* magic bytes read/written from start of file */
-
-#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
-#ifdef PNG_LEGACY_SUPPORTED
- png_byte filler; /* filler byte for pixel expansion */
-#else
- png_uint_16 filler; /* filler bytes for pixel expansion */
-#endif
-#endif
-
-#if defined(PNG_bKGD_SUPPORTED)
- png_byte background_gamma_type;
-# ifdef PNG_FLOATING_POINT_SUPPORTED
- float background_gamma;
-# endif
- png_color_16 background; /* background color in screen gamma space */
-#if defined(PNG_READ_GAMMA_SUPPORTED)
- png_color_16 background_1; /* background normalized to gamma 1.0 */
-#endif
-#endif /* PNG_bKGD_SUPPORTED */
-
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
- png_flush_ptr output_flush_fn;/* Function for flushing output */
- png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
- png_uint_32 flush_rows; /* number of rows written since last flush */
-#endif
-
-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- int gamma_shift; /* number of "insignificant" bits 16-bit gamma */
-#ifdef PNG_FLOATING_POINT_SUPPORTED
- float gamma; /* file gamma value */
- float screen_gamma; /* screen gamma value (display_exponent) */
-#endif
-#endif
-
-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- png_bytep gamma_table; /* gamma table for 8-bit depth files */
- png_bytep gamma_from_1; /* converts from 1.0 to screen */
- png_bytep gamma_to_1; /* converts from file to 1.0 */
- png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
- png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
- png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
-#endif
-
-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
- png_color_8 sig_bit; /* significant bits in each available channel */
-#endif
-
-#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
- png_color_8 shift; /* shift for significant bit tranformation */
-#endif
-
-#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
- || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- png_bytep trans; /* transparency values for paletted files */
- png_color_16 trans_values; /* transparency values for non-paletted files */
-#endif
-
- png_read_status_ptr read_row_fn; /* called after each row is decoded */
- png_write_status_ptr write_row_fn; /* called after each row is encoded */
-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
- png_progressive_info_ptr info_fn; /* called after header data fully read */
- png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */
- png_progressive_end_ptr end_fn; /* called after image is complete */
- png_bytep save_buffer_ptr; /* current location in save_buffer */
- png_bytep save_buffer; /* buffer for previously read data */
- png_bytep current_buffer_ptr; /* current location in current_buffer */
- png_bytep current_buffer; /* buffer for recently used data */
- png_uint_32 push_length; /* size of current input chunk */
- png_uint_32 skip_length; /* bytes to skip in input data */
- png_size_t save_buffer_size; /* amount of data now in save_buffer */
- png_size_t save_buffer_max; /* total size of save_buffer */
- png_size_t buffer_size; /* total amount of available input data */
- png_size_t current_buffer_size; /* amount of data now in current_buffer */
- int process_mode; /* what push library is currently doing */
- int cur_palette; /* current push library palette index */
-
-# if defined(PNG_TEXT_SUPPORTED)
- png_size_t current_text_size; /* current size of text input data */
- png_size_t current_text_left; /* how much text left to read in input */
- png_charp current_text; /* current text chunk buffer */
- png_charp current_text_ptr; /* current location in current_text */
-# endif /* PNG_TEXT_SUPPORTED */
-#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
-
-#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
-/* for the Borland special 64K segment handler */
- png_bytepp offset_table_ptr;
- png_bytep offset_table;
- png_uint_16 offset_table_number;
- png_uint_16 offset_table_count;
- png_uint_16 offset_table_count_free;
-#endif
-
-#if defined(PNG_READ_DITHER_SUPPORTED)
- png_bytep palette_lookup; /* lookup table for dithering */
- png_bytep dither_index; /* index translation for palette files */
-#endif
-
-#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
- png_uint_16p hist; /* histogram */
-#endif
-
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
- png_byte heuristic_method; /* heuristic for row filter selection */
- png_byte num_prev_filters; /* number of weights for previous rows */
- png_bytep prev_filters; /* filter type(s) of previous row(s) */
- png_uint_16p filter_weights; /* weight(s) for previous line(s) */
- png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
- png_uint_16p filter_costs; /* relative filter calculation cost */
- png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
-#endif
-
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
- png_charp time_buffer; /* String to hold RFC 1123 time text */
-#endif
-
-/* New members added in libpng-1.0.6 */
-
-#ifdef PNG_FREE_ME_SUPPORTED
- png_uint_32 free_me; /* flags items libpng is responsible for freeing */
-#endif
-
-#if defined(PNG_USER_CHUNKS_SUPPORTED)
- png_voidp user_chunk_ptr;
- png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
-#endif
-
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
- int num_chunk_list;
- png_bytep chunk_list;
-#endif
-
-/* New members added in libpng-1.0.3 */
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
- png_byte rgb_to_gray_status;
- /* These were changed from png_byte in libpng-1.0.6 */
- png_uint_16 rgb_to_gray_red_coeff;
- png_uint_16 rgb_to_gray_green_coeff;
- png_uint_16 rgb_to_gray_blue_coeff;
-#endif
-
-/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
-#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
- defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
- defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
-/* changed from png_byte to png_uint_32 at version 1.2.0 */
-#ifdef PNG_1_0_X
- png_byte mng_features_permitted;
-#else
- png_uint_32 mng_features_permitted;
-#endif /* PNG_1_0_X */
-#endif
-
-/* New member added in libpng-1.0.7 */
-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- png_fixed_point int_gamma;
-#endif
-
-/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
- png_byte filter_type;
-#endif
-
-#if defined(PNG_1_0_X)
-/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */
- png_uint_32 row_buf_size;
-#endif
-
-/* New members added in libpng-1.2.0 */
-#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
-# if !defined(PNG_1_0_X)
-# if defined(PNG_MMX_CODE_SUPPORTED)
- png_byte mmx_bitdepth_threshold;
- png_uint_32 mmx_rowbytes_threshold;
-# endif
- png_uint_32 asm_flags;
-# endif
-#endif
-
-/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
-#ifdef PNG_USER_MEM_SUPPORTED
- png_voidp mem_ptr; /* user supplied struct for mem functions */
- png_malloc_ptr malloc_fn; /* function for allocating memory */
- png_free_ptr free_fn; /* function for freeing memory */
-#endif
-
-/* New member added in libpng-1.0.13 and 1.2.0 */
- png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
-
-#if defined(PNG_READ_DITHER_SUPPORTED)
-/* The following three members were added at version 1.0.14 and 1.2.4 */
- png_bytep dither_sort; /* working sort array */
- png_bytep index_to_palette; /* where the original index currently is */
- /* in the palette */
- png_bytep palette_to_index; /* which original index points to this */
- /* palette color */
-#endif
-
-/* New members added in libpng-1.0.16 and 1.2.6 */
- png_byte compression_type;
-
-#ifdef PNG_SET_USER_LIMITS_SUPPORTED
- png_uint_32 user_width_max;
- png_uint_32 user_height_max;
-#endif
-
-/* New member added in libpng-1.0.25 and 1.2.17 */
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
- /* storage for unknown chunk that the library doesn't recognize. */
- png_unknown_chunk unknown_chunk;
-#endif
-};
-
-
-/* This triggers a compiler error in png.c, if png.c and png.h
- * do not agree upon the version number.
- */
-typedef png_structp version_1_2_24;
-
-typedef png_struct FAR * FAR * png_structpp;
-
-/* Here are the function definitions most commonly used. This is not
- * the place to find out how to use libpng. See libpng.txt for the
- * full explanation, see example.c for the summary. This just provides
- * a simple one line description of the use of each function.
- */
-
-/* Returns the version number of the library */
-extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void));
-
-/* Tell lib we have already handled the first <num_bytes> magic bytes.
- * Handling more than 8 bytes from the beginning of the file is an error.
- */
-extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr,
- int num_bytes));
-
-/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
- * PNG file. Returns zero if the supplied bytes match the 8-byte PNG
- * signature, and non-zero otherwise. Having num_to_check == 0 or
- * start > 7 will always fail (ie return non-zero).
- */
-extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,
- png_size_t num_to_check));
-
-/* Simple signature checking function. This is the same as calling
- * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
- */
-extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num));
-
-/* Allocate and initialize png_ptr struct for reading, and any other memory. */
-extern PNG_EXPORT(png_structp,png_create_read_struct)
- PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
- png_error_ptr error_fn, png_error_ptr warn_fn));
-
-/* Allocate and initialize png_ptr struct for writing, and any other memory */
-extern PNG_EXPORT(png_structp,png_create_write_struct)
- PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
- png_error_ptr error_fn, png_error_ptr warn_fn));
-
-#ifdef PNG_WRITE_SUPPORTED
-extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size)
- PNGARG((png_structp png_ptr));
-#endif
-
-#ifdef PNG_WRITE_SUPPORTED
-extern PNG_EXPORT(void,png_set_compression_buffer_size)
- PNGARG((png_structp png_ptr, png_uint_32 size));
-#endif
-
-/* Reset the compression stream */
-extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
-
-/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */
-#ifdef PNG_USER_MEM_SUPPORTED
-extern PNG_EXPORT(png_structp,png_create_read_struct_2)
- PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
- png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
- png_malloc_ptr malloc_fn, png_free_ptr free_fn));
-extern PNG_EXPORT(png_structp,png_create_write_struct_2)
- PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
- png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
- png_malloc_ptr malloc_fn, png_free_ptr free_fn));
-#endif
-
-/* Write a PNG chunk - size, type, (optional) data, CRC. */
-extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr,
- png_bytep chunk_name, png_bytep data, png_size_t length));
-
-/* Write the start of a PNG chunk - length and chunk name. */
-extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr,
- png_bytep chunk_name, png_uint_32 length));
-
-/* Write the data of a PNG chunk started with png_write_chunk_start(). */
-extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr,
- png_bytep data, png_size_t length));
-
-/* Finish a chunk started with png_write_chunk_start() (includes CRC). */
-extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr));
-
-/* Allocate and initialize the info structure */
-extern PNG_EXPORT(png_infop,png_create_info_struct)
- PNGARG((png_structp png_ptr));
-
-#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
-/* Initialize the info structure (old interface - DEPRECATED) */
-extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr));
-#undef png_info_init
-#define png_info_init(info_ptr) png_info_init_3(&info_ptr,\
- png_sizeof(png_info));
-#endif
-
-extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,
- png_size_t png_info_struct_size));
-
-/* Writes all the PNG information before the image. */
-extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
-/* read the information before the actual image data. */
-extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-#endif
-
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
-extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)
- PNGARG((png_structp png_ptr, png_timep ptime));
-#endif
-
-#if !defined(_WIN32_WCE)
-/* "time.h" functions are not supported on WindowsCE */
-#if defined(PNG_WRITE_tIME_SUPPORTED)
-/* convert from a struct tm to png_time */
-extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,
- struct tm FAR * ttime));
-
-/* convert from time_t to png_time. Uses gmtime() */
-extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,
- time_t ttime));
-#endif /* PNG_WRITE_tIME_SUPPORTED */
-#endif /* _WIN32_WCE */
-
-#if defined(PNG_READ_EXPAND_SUPPORTED)
-/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
-extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr));
-#if !defined(PNG_1_0_X)
-extern PNG_EXPORT(void,png_set_expand_gray_1_2_4_to_8) PNGARG((png_structp
- png_ptr));
-#endif
-extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr));
-extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr));
-#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
-/* Deprecated */
-extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr));
-#endif
-#endif
-
-#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
-/* Use blue, green, red order for pixels. */
-extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr));
-#endif
-
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
-/* Expand the grayscale to 24-bit RGB if necessary. */
-extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr));
-#endif
-
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
-/* Reduce RGB to grayscale. */
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr,
- int error_action, double red, double green ));
-#endif
-extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr,
- int error_action, png_fixed_point red, png_fixed_point green ));
-extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp
- png_ptr));
-#endif
-
-extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,
- png_colorp palette));
-
-#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
-extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr));
-#endif
-
-#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
- defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
-extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr));
-#endif
-
-#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
- defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
-extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr));
-#endif
-
-#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
-/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */
-extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr,
- png_uint_32 filler, int flags));
-/* The values of the PNG_FILLER_ defines should NOT be changed */
-#define PNG_FILLER_BEFORE 0
-#define PNG_FILLER_AFTER 1
-/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
-#if !defined(PNG_1_0_X)
-extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr,
- png_uint_32 filler, int flags));
-#endif
-#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */
-
-#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
-/* Swap bytes in 16-bit depth files. */
-extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr));
-#endif
-
-#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
-/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */
-extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr));
-#endif
-
-#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
-/* Swap packing order of pixels in bytes. */
-extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr));
-#endif
-
-#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
-/* Converts files to legal bit depths. */
-extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr,
- png_color_8p true_bits));
-#endif
-
-#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
- defined(PNG_WRITE_INTERLACING_SUPPORTED)
-/* Have the code handle the interlacing. Returns the number of passes. */
-extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr));
-#endif
-
-#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
-/* Invert monochrome files */
-extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr));
-#endif
-
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
-/* Handle alpha and tRNS by replacing with a background color. */
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,
- png_color_16p background_color, int background_gamma_code,
- int need_expand, double background_gamma));
-#endif
-#define PNG_BACKGROUND_GAMMA_UNKNOWN 0
-#define PNG_BACKGROUND_GAMMA_SCREEN 1
-#define PNG_BACKGROUND_GAMMA_FILE 2
-#define PNG_BACKGROUND_GAMMA_UNIQUE 3
-#endif
-
-#if defined(PNG_READ_16_TO_8_SUPPORTED)
-/* strip the second byte of information from a 16-bit depth file. */
-extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));
-#endif
-
-#if defined(PNG_READ_DITHER_SUPPORTED)
-/* Turn on dithering, and reduce the palette to the number of colors available. */
-extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr,
- png_colorp palette, int num_palette, int maximum_colors,
- png_uint_16p histogram, int full_dither));
-#endif
-
-#if defined(PNG_READ_GAMMA_SUPPORTED)
-/* Handle gamma correction. Screen_gamma=(display_exponent) */
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,
- double screen_gamma, double default_file_gamma));
-#endif
-#endif
-
-#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
-#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
- defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
-/* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */
-/* Deprecated and will be removed. Use png_permit_mng_features() instead. */
-extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr,
- int empty_plte_permitted));
-#endif
-#endif
-
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
-/* Set how many lines between output flushes - 0 for no flushing */
-extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));
-/* Flush the current PNG output buffer */
-extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr));
-#endif
-
-/* optional update palette with requested transformations */
-extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr));
-
-/* optional call to update the users info structure */
-extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
-/* read one or more rows of image data. */
-extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,
- png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));
-#endif
-
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
-/* read a row of data. */
-extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,
- png_bytep row,
- png_bytep display_row));
-#endif
-
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
-/* read the whole image into memory at once. */
-extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr,
- png_bytepp image));
-#endif
-
-/* write a row of image data */
-extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr,
- png_bytep row));
-
-/* write a few rows of image data */
-extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr,
- png_bytepp row, png_uint_32 num_rows));
-
-/* write the image data */
-extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr,
- png_bytepp image));
-
-/* writes the end of the PNG file. */
-extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
-/* read the end of the PNG file. */
-extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-#endif
-
-/* free any memory associated with the png_info_struct */
-extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr,
- png_infopp info_ptr_ptr));
-
-/* free any memory associated with the png_struct and the png_info_structs */
-extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp
- png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
-
-/* free all memory used by the read (old method - NOT DLL EXPORTED) */
-/* Debian note: exporting as it is required by legacy applications */
-extern PNG_EXPORT(void,png_read_destroy) PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_infop end_info_ptr));
-
-/* free any memory associated with the png_struct and the png_info_structs */
-extern PNG_EXPORT(void,png_destroy_write_struct)
- PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
-
-/* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
-/* Debian note: exporting as it is required by legacy applications */
-extern PNG_EXPORT(void,png_write_destroy) PNGARG((png_structp png_ptr));
-
-/* set the libpng method of handling chunk CRC errors */
-extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,
- int crit_action, int ancil_action));
-
-/* Values for png_set_crc_action() to say how to handle CRC errors in
- * ancillary and critical chunks, and whether to use the data contained
- * therein. Note that it is impossible to "discard" data in a critical
- * chunk. For versions prior to 0.90, the action was always error/quit,
- * whereas in version 0.90 and later, the action for CRC errors in ancillary
- * chunks is warn/discard. These values should NOT be changed.
- *
- * value action:critical action:ancillary
- */
-#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */
-#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */
-#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */
-#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */
-#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */
-#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */
-
-/* These functions give the user control over the scan-line filtering in
- * libpng and the compression methods used by zlib. These functions are
- * mainly useful for testing, as the defaults should work with most users.
- * Those users who are tight on memory or want faster performance at the
- * expense of compression can modify them. See the compression library
- * header file (zlib.h) for an explination of the compression functions.
- */
-
-/* set the filtering method(s) used by libpng. Currently, the only valid
- * value for "method" is 0.
- */
-extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method,
- int filters));
-
-/* Flags for png_set_filter() to say which filters to use. The flags
- * are chosen so that they don't conflict with real filter types
- * below, in case they are supplied instead of the #defined constants.
- * These values should NOT be changed.
- */
-#define PNG_NO_FILTERS 0x00
-#define PNG_FILTER_NONE 0x08
-#define PNG_FILTER_SUB 0x10
-#define PNG_FILTER_UP 0x20
-#define PNG_FILTER_AVG 0x40
-#define PNG_FILTER_PAETH 0x80
-#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
- PNG_FILTER_AVG | PNG_FILTER_PAETH)
-
-/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
- * These defines should NOT be changed.
- */
-#define PNG_FILTER_VALUE_NONE 0
-#define PNG_FILTER_VALUE_SUB 1
-#define PNG_FILTER_VALUE_UP 2
-#define PNG_FILTER_VALUE_AVG 3
-#define PNG_FILTER_VALUE_PAETH 4
-#define PNG_FILTER_VALUE_LAST 5
-
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */
-/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
- * defines, either the default (minimum-sum-of-absolute-differences), or
- * the experimental method (weighted-minimum-sum-of-absolute-differences).
- *
- * Weights are factors >= 1.0, indicating how important it is to keep the
- * filter type consistent between rows. Larger numbers mean the current
- * filter is that many times as likely to be the same as the "num_weights"
- * previous filters. This is cumulative for each previous row with a weight.
- * There needs to be "num_weights" values in "filter_weights", or it can be
- * NULL if the weights aren't being specified. Weights have no influence on
- * the selection of the first row filter. Well chosen weights can (in theory)
- * improve the compression for a given image.
- *
- * Costs are factors >= 1.0 indicating the relative decoding costs of a
- * filter type. Higher costs indicate more decoding expense, and are
- * therefore less likely to be selected over a filter with lower computational
- * costs. There needs to be a value in "filter_costs" for each valid filter
- * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
- * setting the costs. Costs try to improve the speed of decompression without
- * unduly increasing the compressed image size.
- *
- * A negative weight or cost indicates the default value is to be used, and
- * values in the range [0.0, 1.0) indicate the value is to remain unchanged.
- * The default values for both weights and costs are currently 1.0, but may
- * change if good general weighting/cost heuristics can be found. If both
- * the weights and costs are set to 1.0, this degenerates the WEIGHTED method
- * to the UNWEIGHTED method, but with added encoding time/computation.
- */
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
- int heuristic_method, int num_weights, png_doublep filter_weights,
- png_doublep filter_costs));
-#endif
-#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
-
-/* Heuristic used for row filter selection. These defines should NOT be
- * changed.
- */
-#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */
-#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */
-#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
-#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */
-
-/* Set the library compression level. Currently, valid values range from
- * 0 - 9, corresponding directly to the zlib compression levels 0 - 9
- * (0 - no compression, 9 - "maximal" compression). Note that tests have
- * shown that zlib compression levels 3-6 usually perform as well as level 9
- * for PNG images, and do considerably fewer caclulations. In the future,
- * these values may not correspond directly to the zlib compression levels.
- */
-extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr,
- int level));
-
-extern PNG_EXPORT(void,png_set_compression_mem_level)
- PNGARG((png_structp png_ptr, int mem_level));
-
-extern PNG_EXPORT(void,png_set_compression_strategy)
- PNGARG((png_structp png_ptr, int strategy));
-
-extern PNG_EXPORT(void,png_set_compression_window_bits)
- PNGARG((png_structp png_ptr, int window_bits));
-
-extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr,
- int method));
-
-/* These next functions are called for input/output, memory, and error
- * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
- * and call standard C I/O routines such as fread(), fwrite(), and
- * fprintf(). These functions can be made to use other I/O routines
- * at run time for those applications that need to handle I/O in a
- * different manner by calling png_set_???_fn(). See libpng.txt for
- * more information.
- */
-
-#if !defined(PNG_NO_STDIO)
-/* Initialize the input/output for the PNG file to the default functions. */
-extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp));
-#endif
-
-/* Replace the (error and abort), and warning functions with user
- * supplied functions. If no messages are to be printed you must still
- * write and use replacement functions. The replacement error_fn should
- * still do a longjmp to the last setjmp location if you are using this
- * method of error handling. If error_fn or warning_fn is NULL, the
- * default function will be used.
- */
-
-extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr,
- png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
-
-/* Return the user pointer associated with the error functions */
-extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr));
-
-/* Replace the default data output functions with a user supplied one(s).
- * If buffered output is not used, then output_flush_fn can be set to NULL.
- * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time
- * output_flush_fn will be ignored (and thus can be NULL).
- */
-extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr,
- png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
-
-/* Replace the default data input function with a user supplied one. */
-extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr,
- png_voidp io_ptr, png_rw_ptr read_data_fn));
-
-/* Return the user pointer associated with the I/O functions */
-extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr));
-
-extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr,
- png_read_status_ptr read_row_fn));
-
-extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr,
- png_write_status_ptr write_row_fn));
-
-#ifdef PNG_USER_MEM_SUPPORTED
-/* Replace the default memory allocation functions with user supplied one(s). */
-extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr,
- png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn));
-/* Return the user pointer associated with the memory functions */
-extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr));
-#endif
-
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
- defined(PNG_LEGACY_SUPPORTED)
-extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp
- png_ptr, png_user_transform_ptr read_user_transform_fn));
-#endif
-
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
- defined(PNG_LEGACY_SUPPORTED)
-extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp
- png_ptr, png_user_transform_ptr write_user_transform_fn));
-#endif
-
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
- defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
- defined(PNG_LEGACY_SUPPORTED)
-extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp
- png_ptr, png_voidp user_transform_ptr, int user_transform_depth,
- int user_transform_channels));
-/* Return the user pointer associated with the user transform functions */
-extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr)
- PNGARG((png_structp png_ptr));
-#endif
-
-#ifdef PNG_USER_CHUNKS_SUPPORTED
-extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr,
- png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
-extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp
- png_ptr));
-#endif
-
-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-/* Sets the function callbacks for the push reader, and a pointer to a
- * user-defined structure available to the callback functions.
- */
-extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr,
- png_voidp progressive_ptr,
- png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
- png_progressive_end_ptr end_fn));
-
-/* returns the user pointer associated with the push read functions */
-extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)
- PNGARG((png_structp png_ptr));
-
-/* function to be called when data becomes available */
-extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));
-
-/* function that combines rows. Not very much different than the
- * png_combine_row() call. Is this even used?????
- */
-extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
- png_bytep old_row, png_bytep new_row));
-#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
-
-extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
- png_uint_32 size));
-
-#if defined(PNG_1_0_X)
-# define png_malloc_warn png_malloc
-#else
-/* Added at libpng version 1.2.4 */
-extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,
- png_uint_32 size));
-#endif
-
-/* frees a pointer allocated by png_malloc() */
-extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
-
-#if defined(PNG_1_0_X)
-/* Function to allocate memory for zlib. */
-extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items,
- uInt size));
-
-/* Function to free memory for zlib */
-extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr));
-#endif
-
-/* Free data that was allocated internally */
-extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 free_me, int num));
-#ifdef PNG_FREE_ME_SUPPORTED
-/* Reassign responsibility for freeing existing data, whether allocated
- * by libpng or by the application */
-extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
- png_infop info_ptr, int freer, png_uint_32 mask));
-#endif
-/* assignments for png_data_freer */
-#define PNG_DESTROY_WILL_FREE_DATA 1
-#define PNG_SET_WILL_FREE_DATA 1
-#define PNG_USER_WILL_FREE_DATA 2
-/* Flags for png_ptr->free_me and info_ptr->free_me */
-#define PNG_FREE_HIST 0x0008
-#define PNG_FREE_ICCP 0x0010
-#define PNG_FREE_SPLT 0x0020
-#define PNG_FREE_ROWS 0x0040
-#define PNG_FREE_PCAL 0x0080
-#define PNG_FREE_SCAL 0x0100
-#define PNG_FREE_UNKN 0x0200
-#define PNG_FREE_LIST 0x0400
-#define PNG_FREE_PLTE 0x1000
-#define PNG_FREE_TRNS 0x2000
-#define PNG_FREE_TEXT 0x4000
-#define PNG_FREE_ALL 0x7fff
-#define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
-
-#ifdef PNG_USER_MEM_SUPPORTED
-extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,
- png_uint_32 size));
-extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr,
- png_voidp ptr));
-#endif
-
-extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr,
- png_voidp s1, png_voidp s2, png_uint_32 size));
-
-extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr,
- png_voidp s1, int value, png_uint_32 size));
-
-#if defined(USE_FAR_KEYWORD) /* memory model conversion function */
-extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
- int check));
-#endif /* USE_FAR_KEYWORD */
-
-#ifndef PNG_NO_ERROR_TEXT
-/* Fatal error in PNG image of libpng - can't continue */
-extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
- png_const_charp error_message));
-
-/* The same, but the chunk name is prepended to the error string. */
-extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,
- png_const_charp error_message));
-#else
-/* Fatal error in PNG image of libpng - can't continue */
-extern PNG_EXPORT(void,png_err) PNGARG((png_structp png_ptr));
-#endif
-
-#ifndef PNG_NO_WARNINGS
-/* Non-fatal error in libpng. Can continue, but may have a problem. */
-extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,
- png_const_charp warning_message));
-
-#ifdef PNG_READ_SUPPORTED
-/* Non-fatal error in libpng, chunk name is prepended to message. */
-extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,
- png_const_charp warning_message));
-#endif /* PNG_READ_SUPPORTED */
-#endif /* PNG_NO_WARNINGS */
-
-/* The png_set_<chunk> functions are for storing values in the png_info_struct.
- * Similarly, the png_get_<chunk> calls are used to read values from the
- * png_info_struct, either storing the parameters in the passed variables, or
- * setting pointers into the png_info_struct where the data is stored. The
- * png_get_<chunk> functions return a non-zero value if the data was available
- * in info_ptr, or return zero and do not change any of the parameters if the
- * data was not available.
- *
- * These functions should be used instead of directly accessing png_info
- * to avoid problems with future changes in the size and internal layout of
- * png_info_struct.
- */
-/* Returns "flag" if chunk data is valid in info_ptr. */
-extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr,
-png_infop info_ptr, png_uint_32 flag));
-
-/* Returns number of bytes needed to hold a transformed row. */
-extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr,
-png_infop info_ptr));
-
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
-/* Returns row_pointers, which is an array of pointers to scanlines that was
-returned from png_read_png(). */
-extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr,
-png_infop info_ptr));
-/* Set row_pointers, which is an array of pointers to scanlines for use
-by png_write_png(). */
-extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_bytepp row_pointers));
-#endif
-
-/* Returns number of color channels in image. */
-extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr,
-png_infop info_ptr));
-
-#ifdef PNG_EASY_ACCESS_SUPPORTED
-/* Returns image width in pixels. */
-extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-
-/* Returns image height in pixels. */
-extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-
-/* Returns image bit_depth. */
-extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-
-/* Returns image color_type. */
-extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-
-/* Returns image filter_type. */
-extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-
-/* Returns image interlace_type. */
-extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-
-/* Returns image compression_type. */
-extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-
-/* Returns image resolution in pixels per meter, from pHYs chunk data. */
-extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-
-/* Returns pixel aspect ratio, computed from pHYs chunk data. */
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-#endif
-
-/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
-extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp
-png_ptr, png_infop info_ptr));
-
-#endif /* PNG_EASY_ACCESS_SUPPORTED */
-
-/* Returns pointer to signature string read from PNG header */
-extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,
-png_infop info_ptr));
-
-#if defined(PNG_bKGD_SUPPORTED)
-extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_color_16p *background));
-#endif
-
-#if defined(PNG_bKGD_SUPPORTED)
-extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_color_16p background));
-#endif
-
-#if defined(PNG_cHRM_SUPPORTED)
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr,
- png_infop info_ptr, double *white_x, double *white_y, double *red_x,
- double *red_y, double *green_x, double *green_y, double *blue_x,
- double *blue_y));
-#endif
-#ifdef PNG_FIXED_POINT_SUPPORTED
-extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point
- *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y,
- png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point
- *int_blue_x, png_fixed_point *int_blue_y));
-#endif
-#endif
-
-#if defined(PNG_cHRM_SUPPORTED)
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr,
- png_infop info_ptr, double white_x, double white_y, double red_x,
- double red_y, double green_x, double green_y, double blue_x, double blue_y));
-#endif
-#ifdef PNG_FIXED_POINT_SUPPORTED
-extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y,
- png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
- int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
- png_fixed_point int_blue_y));
-#endif
-#endif
-
-#if defined(PNG_gAMA_SUPPORTED)
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,
- png_infop info_ptr, double *file_gamma));
-#endif
-extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_fixed_point *int_file_gamma));
-#endif
-
-#if defined(PNG_gAMA_SUPPORTED)
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr,
- png_infop info_ptr, double file_gamma));
-#endif
-extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_fixed_point int_file_gamma));
-#endif
-
-#if defined(PNG_hIST_SUPPORTED)
-extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_16p *hist));
-#endif
-
-#if defined(PNG_hIST_SUPPORTED)
-extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_16p hist));
-#endif
-
-extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 *width, png_uint_32 *height,
- int *bit_depth, int *color_type, int *interlace_method,
- int *compression_method, int *filter_method));
-
-extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,
- int color_type, int interlace_method, int compression_method,
- int filter_method));
-
-#if defined(PNG_oFFs_SUPPORTED)
-extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
- int *unit_type));
-#endif
-
-#if defined(PNG_oFFs_SUPPORTED)
-extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y,
- int unit_type));
-#endif
-
-#if defined(PNG_pCAL_SUPPORTED)
-extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1,
- int *type, int *nparams, png_charp *units, png_charpp *params));
-#endif
-
-#if defined(PNG_pCAL_SUPPORTED)
-extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1,
- int type, int nparams, png_charp units, png_charpp params));
-#endif
-
-#if defined(PNG_pHYs_SUPPORTED)
-extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
-#endif
-
-#if defined(PNG_pHYs_SUPPORTED)
-extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));
-#endif
-
-extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_colorp *palette, int *num_palette));
-
-extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_colorp palette, int num_palette));
-
-#if defined(PNG_sBIT_SUPPORTED)
-extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_color_8p *sig_bit));
-#endif
-
-#if defined(PNG_sBIT_SUPPORTED)
-extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_color_8p sig_bit));
-#endif
-
-#if defined(PNG_sRGB_SUPPORTED)
-extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr,
- png_infop info_ptr, int *intent));
-#endif
-
-#if defined(PNG_sRGB_SUPPORTED)
-extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr,
- png_infop info_ptr, int intent));
-extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,
- png_infop info_ptr, int intent));
-#endif
-
-#if defined(PNG_iCCP_SUPPORTED)
-extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_charpp name, int *compression_type,
- png_charpp profile, png_uint_32 *proflen));
- /* Note to maintainer: profile should be png_bytepp */
-#endif
-
-#if defined(PNG_iCCP_SUPPORTED)
-extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_charp name, int compression_type,
- png_charp profile, png_uint_32 proflen));
- /* Note to maintainer: profile should be png_bytep */
-#endif
-
-#if defined(PNG_sPLT_SUPPORTED)
-extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_sPLT_tpp entries));
-#endif
-
-#if defined(PNG_sPLT_SUPPORTED)
-extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_sPLT_tp entries, int nentries));
-#endif
-
-#if defined(PNG_TEXT_SUPPORTED)
-/* png_get_text also returns the number of text chunks in *num_text */
-extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_textp *text_ptr, int *num_text));
-#endif
-
-/*
- * Note while png_set_text() will accept a structure whose text,
- * language, and translated keywords are NULL pointers, the structure
- * returned by png_get_text will always contain regular
- * zero-terminated C strings. They might be empty strings but
- * they will never be NULL pointers.
- */
-
-#if defined(PNG_TEXT_SUPPORTED)
-extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_textp text_ptr, int num_text));
-#endif
-
-#if defined(PNG_tIME_SUPPORTED)
-extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_timep *mod_time));
-#endif
-
-#if defined(PNG_tIME_SUPPORTED)
-extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_timep mod_time));
-#endif
-
-#if defined(PNG_tRNS_SUPPORTED)
-extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_bytep *trans, int *num_trans,
- png_color_16p *trans_values));
-#endif
-
-#if defined(PNG_tRNS_SUPPORTED)
-extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_bytep trans, int num_trans,
- png_color_16p trans_values));
-#endif
-
-#if defined(PNG_tRNS_SUPPORTED)
-#endif
-
-#if defined(PNG_sCAL_SUPPORTED)
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr,
- png_infop info_ptr, int *unit, double *width, double *height));
-#else
-#ifdef PNG_FIXED_POINT_SUPPORTED
-extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr,
- png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight));
-#endif
-#endif
-#endif /* PNG_sCAL_SUPPORTED */
-
-#if defined(PNG_sCAL_SUPPORTED)
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr,
- png_infop info_ptr, int unit, double width, double height));
-#else
-#ifdef PNG_FIXED_POINT_SUPPORTED
-extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,
- png_infop info_ptr, int unit, png_charp swidth, png_charp sheight));
-#endif
-#endif
-#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
-
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
-/* provide a list of chunks and how they are to be handled, if the built-in
- handling or default unknown chunk handling is not desired. Any chunks not
- listed will be handled in the default manner. The IHDR and IEND chunks
- must not be listed.
- keep = 0: follow default behaviour
- = 1: do not keep
- = 2: keep only if safe-to-copy
- = 3: keep even if unsafe-to-copy
-*/
-extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp
- png_ptr, int keep, png_bytep chunk_list, int num_chunks));
-extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns));
-extern PNG_EXPORT(void, png_set_unknown_chunk_location)
- PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location));
-extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
- png_ptr, png_infop info_ptr, png_unknown_chunkpp entries));
-#endif
-#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
-PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep
- chunk_name));
-#endif
-
-/* Png_free_data() will turn off the "valid" flag for anything it frees.
- If you need to turn it off for a chunk that your application has freed,
- you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */
-extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr,
- png_infop info_ptr, int mask));
-
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
-/* The "params" pointer is currently not used and is for future expansion. */
-extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr,
- png_infop info_ptr,
- int transforms,
- png_voidp params));
-extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
- png_infop info_ptr,
- int transforms,
- png_voidp params));
-#endif
-
-/* Define PNG_DEBUG at compile time for debugging information. Higher
- * numbers for PNG_DEBUG mean more debugging information. This has
- * only been added since version 0.95 so it is not implemented throughout
- * libpng yet, but more support will be added as needed.
- */
-#ifdef PNG_DEBUG
-#if (PNG_DEBUG > 0)
-#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
-#include <crtdbg.h>
-#if (PNG_DEBUG > 1)
-#define png_debug(l,m) _RPT0(_CRT_WARN,m)
-#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1)
-#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2)
-#endif
-#else /* PNG_DEBUG_FILE || !_MSC_VER */
-#ifndef PNG_DEBUG_FILE
-#define PNG_DEBUG_FILE stderr
-#endif /* PNG_DEBUG_FILE */
-#if (PNG_DEBUG > 1)
-#define png_debug(l,m) \
-{ \
- int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
- (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
-}
-#define png_debug1(l,m,p1) \
-{ \
- int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
- (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
-}
-#define png_debug2(l,m,p1,p2) \
-{ \
- int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
- (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
-}
-#endif /* (PNG_DEBUG > 1) */
-#endif /* _MSC_VER */
-#endif /* (PNG_DEBUG > 0) */
-#endif /* PNG_DEBUG */
-#ifndef png_debug
-#define png_debug(l, m)
-#endif
-#ifndef png_debug1
-#define png_debug1(l, m, p1)
-#endif
-#ifndef png_debug2
-#define png_debug2(l, m, p1, p2)
-#endif
-
-extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr));
-extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr));
-extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr));
-extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
-
-#ifdef PNG_MNG_FEATURES_SUPPORTED
-extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
- png_ptr, png_uint_32 mng_features_permitted));
-#endif
-
-/* For use in png_set_keep_unknown, added to version 1.2.6 */
-#define PNG_HANDLE_CHUNK_AS_DEFAULT 0
-#define PNG_HANDLE_CHUNK_NEVER 1
-#define PNG_HANDLE_CHUNK_IF_SAFE 2
-#define PNG_HANDLE_CHUNK_ALWAYS 3
-
-/* Added to version 1.2.0 */
-#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
-#if defined(PNG_MMX_CODE_SUPPORTED)
-#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */
-#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */
-#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04
-#define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08
-#define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10
-#define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20
-#define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40
-#define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80
-#define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */
-
-#define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
- | PNG_ASM_FLAG_MMX_READ_INTERLACE \
- | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
- | PNG_ASM_FLAG_MMX_READ_FILTER_UP \
- | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
- | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH )
-#define PNG_MMX_WRITE_FLAGS ( 0 )
-
-#define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \
- | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU \
- | PNG_MMX_READ_FLAGS \
- | PNG_MMX_WRITE_FLAGS )
-
-#define PNG_SELECT_READ 1
-#define PNG_SELECT_WRITE 2
-#endif /* PNG_MMX_CODE_SUPPORTED */
-
-#if !defined(PNG_1_0_X)
-/* pngget.c */
-extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask)
- PNGARG((int flag_select, int *compilerID));
-
-/* pngget.c */
-extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask)
- PNGARG((int flag_select));
-
-/* pngget.c */
-extern PNG_EXPORT(png_uint_32,png_get_asm_flags)
- PNGARG((png_structp png_ptr));
-
-/* pngget.c */
-extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold)
- PNGARG((png_structp png_ptr));
-
-/* pngget.c */
-extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold)
- PNGARG((png_structp png_ptr));
-
-/* pngset.c */
-extern PNG_EXPORT(void,png_set_asm_flags)
- PNGARG((png_structp png_ptr, png_uint_32 asm_flags));
-
-/* pngset.c */
-extern PNG_EXPORT(void,png_set_mmx_thresholds)
- PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold,
- png_uint_32 mmx_rowbytes_threshold));
-
-#endif /* PNG_1_0_X */
-
-#if !defined(PNG_1_0_X)
-/* png.c, pnggccrd.c, or pngvcrd.c */
-extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
-#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
-
-/* Strip the prepended error numbers ("#nnn ") from error and warning
- * messages before passing them to the error or warning handler. */
-#ifdef PNG_ERROR_NUMBERS_SUPPORTED
-extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
- png_ptr, png_uint_32 strip_mode));
-#endif
-
-#endif /* PNG_1_0_X */
-
-/* Added at libpng-1.2.6 */
-#ifdef PNG_SET_USER_LIMITS_SUPPORTED
-extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp
- png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max));
-extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp
- png_ptr));
-extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
- png_ptr));
-#endif
-
-/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
-
-#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
-/* With these routines we avoid an integer divide, which will be slower on
- * most machines. However, it does take more operations than the corresponding
- * divide method, so it may be slower on a few RISC systems. There are two
- * shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
- *
- * Note that the rounding factors are NOT supposed to be the same! 128 and
- * 32768 are correct for the NODIV code; 127 and 32767 are correct for the
- * standard method.
- *
- * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
- */
-
- /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
-
-# define png_composite(composite, fg, alpha, bg) \
- { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \
- + (png_uint_16)(bg)*(png_uint_16)(255 - \
- (png_uint_16)(alpha)) + (png_uint_16)128); \
- (composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
-
-# define png_composite_16(composite, fg, alpha, bg) \
- { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \
- + (png_uint_32)(bg)*(png_uint_32)(65535L - \
- (png_uint_32)(alpha)) + (png_uint_32)32768L); \
- (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
-
-#else /* standard method using integer division */
-
-# define png_composite(composite, fg, alpha, bg) \
- (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \
- (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
- (png_uint_16)127) / 255)
-
-# define png_composite_16(composite, fg, alpha, bg) \
- (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
- (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \
- (png_uint_32)32767) / (png_uint_32)65535L)
-
-#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
-
-/* Inline macros to do direct reads of bytes from the input buffer. These
- * require that you are using an architecture that uses PNG byte ordering
- * (MSB first) and supports unaligned data storage. I think that PowerPC
- * in big-endian mode and 680x0 are the only ones that will support this.
- * The x86 line of processors definitely do not. The png_get_int_32()
- * routine also assumes we are using two's complement format for negative
- * values, which is almost certainly true.
- */
-#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)
-# define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
-# define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
-# define png_get_int_32(buf) ( *((png_int_32p) (buf)))
-#else
-extern PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf));
-extern PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf));
-extern PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf));
-#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
-extern PNG_EXPORT(png_uint_32,png_get_uint_31)
- PNGARG((png_structp png_ptr, png_bytep buf));
-/* No png_get_int_16 -- may be added if there's a real need for it. */
-
-/* Place a 32-bit number into a buffer in PNG byte order (big-endian).
- */
-extern PNG_EXPORT(void,png_save_uint_32)
- PNGARG((png_bytep buf, png_uint_32 i));
-extern PNG_EXPORT(void,png_save_int_32)
- PNGARG((png_bytep buf, png_int_32 i));
-
-/* Place a 16-bit number into a buffer in PNG byte order.
- * The parameter is declared unsigned int, not png_uint_16,
- * just to avoid potential problems on pre-ANSI C compilers.
- */
-extern PNG_EXPORT(void,png_save_uint_16)
- PNGARG((png_bytep buf, unsigned int i));
-/* No png_save_int_16 -- may be added if there's a real need for it. */
-
-/* ************************************************************************* */
-
-/* These next functions are used internally in the code. They generally
- * shouldn't be used unless you are writing code to add or replace some
- * functionality in libpng. More information about most functions can
- * be found in the files where the functions are located.
- */
-
-
-/* Various modes of operation, that are visible to applications because
- * they are used for unknown chunk location.
- */
-#define PNG_HAVE_IHDR 0x01
-#define PNG_HAVE_PLTE 0x02
-#define PNG_HAVE_IDAT 0x04
-#define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */
-#define PNG_HAVE_IEND 0x10
-
-#if defined(PNG_INTERNAL)
-
-/* More modes of operation. Note that after an init, mode is set to
- * zero automatically when the structure is created.
- */
-#define PNG_HAVE_gAMA 0x20
-#define PNG_HAVE_cHRM 0x40
-#define PNG_HAVE_sRGB 0x80
-#define PNG_HAVE_CHUNK_HEADER 0x100
-#define PNG_WROTE_tIME 0x200
-#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
-#define PNG_BACKGROUND_IS_GRAY 0x800
-#define PNG_HAVE_PNG_SIGNATURE 0x1000
-#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
-
-/* flags for the transformations the PNG library does on the image data */
-#define PNG_BGR 0x0001
-#define PNG_INTERLACE 0x0002
-#define PNG_PACK 0x0004
-#define PNG_SHIFT 0x0008
-#define PNG_SWAP_BYTES 0x0010
-#define PNG_INVERT_MONO 0x0020
-#define PNG_DITHER 0x0040
-#define PNG_BACKGROUND 0x0080
-#define PNG_BACKGROUND_EXPAND 0x0100
- /* 0x0200 unused */
-#define PNG_16_TO_8 0x0400
-#define PNG_RGBA 0x0800
-#define PNG_EXPAND 0x1000
-#define PNG_GAMMA 0x2000
-#define PNG_GRAY_TO_RGB 0x4000
-#define PNG_FILLER 0x8000L
-#define PNG_PACKSWAP 0x10000L
-#define PNG_SWAP_ALPHA 0x20000L
-#define PNG_STRIP_ALPHA 0x40000L
-#define PNG_INVERT_ALPHA 0x80000L
-#define PNG_USER_TRANSFORM 0x100000L
-#define PNG_RGB_TO_GRAY_ERR 0x200000L
-#define PNG_RGB_TO_GRAY_WARN 0x400000L
-#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */
- /* 0x800000L Unused */
-#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
-#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
- /* 0x4000000L unused */
- /* 0x8000000L unused */
- /* 0x10000000L unused */
- /* 0x20000000L unused */
- /* 0x40000000L unused */
-
-/* flags for png_create_struct */
-#define PNG_STRUCT_PNG 0x0001
-#define PNG_STRUCT_INFO 0x0002
-
-/* Scaling factor for filter heuristic weighting calculations */
-#define PNG_WEIGHT_SHIFT 8
-#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
-#define PNG_COST_SHIFT 3
-#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
-
-/* flags for the png_ptr->flags rather than declaring a byte for each one */
-#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
-#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002
-#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004
-#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008
-#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010
-#define PNG_FLAG_ZLIB_FINISHED 0x0020
-#define PNG_FLAG_ROW_INIT 0x0040
-#define PNG_FLAG_FILLER_AFTER 0x0080
-#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100
-#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
-#define PNG_FLAG_CRC_CRITICAL_USE 0x0400
-#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
-#define PNG_FLAG_FREE_PLTE 0x1000
-#define PNG_FLAG_FREE_TRNS 0x2000
-#define PNG_FLAG_FREE_HIST 0x4000
-#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
-#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
-#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L
-#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L
-#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L
-#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L
-#define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */
-#define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */
- /* 0x800000L unused */
- /* 0x1000000L unused */
- /* 0x2000000L unused */
- /* 0x4000000L unused */
- /* 0x8000000L unused */
- /* 0x10000000L unused */
- /* 0x20000000L unused */
- /* 0x40000000L unused */
-
-#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
- PNG_FLAG_CRC_ANCILLARY_NOWARN)
-
-#define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \
- PNG_FLAG_CRC_CRITICAL_IGNORE)
-
-#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \
- PNG_FLAG_CRC_CRITICAL_MASK)
-
-/* save typing and make code easier to understand */
-
-#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
- abs((int)((c1).green) - (int)((c2).green)) + \
- abs((int)((c1).blue) - (int)((c2).blue)))
-
-/* Added to libpng-1.2.6 JB */
-#define PNG_ROWBYTES(pixel_bits, width) \
- ((pixel_bits) >= 8 ? \
- ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \
- (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) )
-
-/* PNG_OUT_OF_RANGE returns true if value is outside the range
- ideal-delta..ideal+delta. Each argument is evaluated twice.
- "ideal" and "delta" should be constants, normally simple
- integers, "value" a variable. Added to libpng-1.2.6 JB */
-#define PNG_OUT_OF_RANGE(value, ideal, delta) \
- ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
-
-/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
-#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
-/* place to hold the signature string for a PNG file. */
-#ifdef PNG_USE_GLOBAL_ARRAYS
- PNG_EXPORT_VAR (PNG_CONST png_byte FARDATA) png_sig[8];
-#else
-#endif
-#endif /* PNG_NO_EXTERN */
-
-/* Constant strings for known chunk types. If you need to add a chunk,
- * define the name here, and add an invocation of the macro in png.c and
- * wherever it's needed.
- */
-#define PNG_IHDR png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
-#define PNG_IDAT png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
-#define PNG_IEND png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
-#define PNG_PLTE png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
-#define PNG_bKGD png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
-#define PNG_cHRM png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
-#define PNG_gAMA png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
-#define PNG_hIST png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
-#define PNG_iCCP png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
-#define PNG_iTXt png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
-#define PNG_oFFs png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
-#define PNG_pCAL png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
-#define PNG_sCAL png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
-#define PNG_pHYs png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
-#define PNG_sBIT png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
-#define PNG_sPLT png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
-#define PNG_sRGB png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
-#define PNG_tEXt png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
-#define PNG_tIME png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
-#define PNG_tRNS png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
-#define PNG_zTXt png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
-
-#ifdef PNG_USE_GLOBAL_ARRAYS
-PNG_EXPORT_VAR (png_byte FARDATA) png_IHDR[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_IDAT[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_IEND[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_PLTE[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_bKGD[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_cHRM[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_gAMA[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_hIST[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_iCCP[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_iTXt[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_oFFs[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_pCAL[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_sCAL[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_pHYs[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_sBIT[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_sPLT[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_sRGB[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_tEXt[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_tIME[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_tRNS[5];
-PNG_EXPORT_VAR (png_byte FARDATA) png_zTXt[5];
-#endif /* PNG_USE_GLOBAL_ARRAYS */
-
-#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
-/* Initialize png_ptr struct for reading, and allocate any other memory.
- * (old interface - DEPRECATED - use png_create_read_struct instead).
- */
-extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
-#undef png_read_init
-#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
- PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));
-#endif
-
-extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
- png_const_charp user_png_ver, png_size_t png_struct_size));
-#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
-extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
- png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
- png_info_size));
-#endif
-
-#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
-/* Initialize png_ptr struct for writing, and allocate any other memory.
- * (old interface - DEPRECATED - use png_create_write_struct instead).
- */
-extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
-#undef png_write_init
-#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \
- PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));
-#endif
-
-extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
- png_const_charp user_png_ver, png_size_t png_struct_size));
-extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
- png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
- png_info_size));
-
-/* Allocate memory for an internal libpng struct */
-PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
-
-/* Free memory from internal libpng struct */
-PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
-
-PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
- malloc_fn, png_voidp mem_ptr));
-PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
- png_free_ptr free_fn, png_voidp mem_ptr));
-
-/* Free any memory that info_ptr points to and reset struct. */
-PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-
-#ifndef PNG_1_0_X
-/* Function to allocate memory for zlib. */
-PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
-
-/* Function to free memory for zlib */
-PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
-
-#ifdef PNG_SIZE_T
-/* Function to convert a sizeof an item to png_sizeof item */
- PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size));
-#endif
-
-/* Next four functions are used internally as callbacks. PNGAPI is required
- * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */
-
-PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
- png_bytep data, png_size_t length));
-
-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
- png_bytep buffer, png_size_t length));
-#endif
-
-PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
- png_bytep data, png_size_t length));
-
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
-#if !defined(PNG_NO_STDIO)
-PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
-#endif
-#endif
-#else /* PNG_1_0_X */
-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr,
- png_bytep buffer, png_size_t length));
-#endif
-#endif /* PNG_1_0_X */
-
-/* Reset the CRC variable */
-PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
-
-/* Write the "data" buffer to whatever output you are using. */
-PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
- png_size_t length));
-
-/* Read data from whatever input you are using into the "data" buffer */
-PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
- png_size_t length));
-
-/* Read bytes into buf, and update png_ptr->crc */
-PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
- png_size_t length));
-
-/* Decompress data in a chunk that uses compression */
-#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
- defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
-PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr,
- int comp_type, png_charp chunkdata, png_size_t chunklength,
- png_size_t prefix_length, png_size_t *data_length));
-#endif
-
-/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
-PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
-
-/* Read the CRC from the file and compare it to the libpng calculated CRC */
-PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
-
-/* Calculate the CRC over a section of data. Note that we are only
- * passing a maximum of 64K on systems that have this as a memory limit,
- * since this is the maximum buffer size we can specify.
- */
-PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
- png_size_t length));
-
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
-PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
-#endif
-
-/* simple function to write the signature */
-PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));
-
-/* write various chunks */
-
-/* Write the IHDR chunk, and update the png_struct with the necessary
- * information.
- */
-PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
- png_uint_32 height,
- int bit_depth, int color_type, int compression_method, int filter_method,
- int interlace_method));
-
-PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
- png_uint_32 num_pal));
-
-PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
- png_size_t length));
-
-PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
-
-#if defined(PNG_WRITE_gAMA_SUPPORTED)
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
-#endif
-#ifdef PNG_FIXED_POINT_SUPPORTED
-PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point
- file_gamma));
-#endif
-#endif
-
-#if defined(PNG_WRITE_sBIT_SUPPORTED)
-PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
- int color_type));
-#endif
-
-#if defined(PNG_WRITE_cHRM_SUPPORTED)
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
- double white_x, double white_y,
- double red_x, double red_y, double green_x, double green_y,
- double blue_x, double blue_y));
-#endif
-#ifdef PNG_FIXED_POINT_SUPPORTED
-PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
- png_fixed_point int_white_x, png_fixed_point int_white_y,
- png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
- int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
- png_fixed_point int_blue_y));
-#endif
-#endif
-
-#if defined(PNG_WRITE_sRGB_SUPPORTED)
-PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
- int intent));
-#endif
-
-#if defined(PNG_WRITE_iCCP_SUPPORTED)
-PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
- png_charp name, int compression_type,
- png_charp profile, int proflen));
- /* Note to maintainer: profile should be png_bytep */
-#endif
-
-#if defined(PNG_WRITE_sPLT_SUPPORTED)
-PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
- png_sPLT_tp palette));
-#endif
-
-#if defined(PNG_WRITE_tRNS_SUPPORTED)
-PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
- png_color_16p values, int number, int color_type));
-#endif
-
-#if defined(PNG_WRITE_bKGD_SUPPORTED)
-PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
- png_color_16p values, int color_type));
-#endif
-
-#if defined(PNG_WRITE_hIST_SUPPORTED)
-PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
- int num_hist));
-#endif
-
-#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
- defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
-PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
- png_charp key, png_charpp new_key));
-#endif
-
-#if defined(PNG_WRITE_tEXt_SUPPORTED)
-PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
- png_charp text, png_size_t text_len));
-#endif
-
-#if defined(PNG_WRITE_zTXt_SUPPORTED)
-PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
- png_charp text, png_size_t text_len, int compression));
-#endif
-
-#if defined(PNG_WRITE_iTXt_SUPPORTED)
-PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
- int compression, png_charp key, png_charp lang, png_charp lang_key,
- png_charp text));
-#endif
-
-#if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */
-PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_textp text_ptr, int num_text));
-#endif
-
-#if defined(PNG_WRITE_oFFs_SUPPORTED)
-PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
- png_int_32 x_offset, png_int_32 y_offset, int unit_type));
-#endif
-
-#if defined(PNG_WRITE_pCAL_SUPPORTED)
-PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
- png_int_32 X0, png_int_32 X1, int type, int nparams,
- png_charp units, png_charpp params));
-#endif
-
-#if defined(PNG_WRITE_pHYs_SUPPORTED)
-PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
- png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
- int unit_type));
-#endif
-
-#if defined(PNG_WRITE_tIME_SUPPORTED)
-PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
- png_timep mod_time));
-#endif
-
-#if defined(PNG_WRITE_sCAL_SUPPORTED)
-#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
-PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
- int unit, double width, double height));
-#else
-#ifdef PNG_FIXED_POINT_SUPPORTED
-PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
- int unit, png_charp width, png_charp height));
-#endif
-#endif
-#endif
-
-/* Called when finished processing a row of data */
-PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
-
-/* Internal use only. Called before first row of data */
-PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
-
-#if defined(PNG_READ_GAMMA_SUPPORTED)
-PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr));
-#endif
-
-/* combine a row of data, dealing with alpha, etc. if requested */
-PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
- int mask));
-
-#if defined(PNG_READ_INTERLACING_SUPPORTED)
-/* expand an interlaced row */
-/* OLD pre-1.0.9 interface:
-PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
- png_bytep row, int pass, png_uint_32 transformations));
- */
-PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
-#endif
-
-/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */
-
-#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
-/* grab pixels out of a row for an interlaced pass */
-PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
- png_bytep row, int pass));
-#endif
-
-/* unfilter a row */
-PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
- png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
-
-/* Choose the best filter to use and filter the row data */
-PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
- png_row_infop row_info));
-
-/* Write out the filtered row. */
-PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
- png_bytep filtered_row));
-/* finish a row while reading, dealing with interlacing passes, etc. */
-PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
-
-/* initialize the row buffers, etc. */
-PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
-/* optional call to update the users info structure */
-PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-
-/* these are the functions that do the transformations */
-#if defined(PNG_READ_FILLER_SUPPORTED)
-PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
- png_bytep row, png_uint_32 filler, png_uint_32 flags));
-#endif
-
-#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
-PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
- png_bytep row));
-#endif
-
-#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
-PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
- png_bytep row));
-#endif
-
-#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
-PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
- png_bytep row));
-#endif
-
-#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
-PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
- png_bytep row));
-#endif
-
-#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
- defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
-PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
- png_bytep row, png_uint_32 flags));
-#endif
-
-#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
-PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
-#endif
-
-#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
-PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
-#endif
-
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
-PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
- row_info, png_bytep row));
-#endif
-
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
-PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
- png_bytep row));
-#endif
-
-#if defined(PNG_READ_PACK_SUPPORTED)
-PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
-#endif
-
-#if defined(PNG_READ_SHIFT_SUPPORTED)
-PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
- png_color_8p sig_bits));
-#endif
-
-#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
-PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
-#endif
-
-#if defined(PNG_READ_16_TO_8_SUPPORTED)
-PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
-#endif
-
-#if defined(PNG_READ_DITHER_SUPPORTED)
-PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
- png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
-
-# if defined(PNG_CORRECT_PALETTE_SUPPORTED)
-PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
- png_colorp palette, int num_palette));
-# endif
-#endif
-
-#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
-PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
-#endif
-
-#if defined(PNG_WRITE_PACK_SUPPORTED)
-PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
- png_bytep row, png_uint_32 bit_depth));
-#endif
-
-#if defined(PNG_WRITE_SHIFT_SUPPORTED)
-PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
- png_color_8p bit_depth));
-#endif
-
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
-#if defined(PNG_READ_GAMMA_SUPPORTED)
-PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
- png_color_16p trans_values, png_color_16p background,
- png_color_16p background_1,
- png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
- png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
- png_uint_16pp gamma_16_to_1, int gamma_shift));
-#else
-PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
- png_color_16p trans_values, png_color_16p background));
-#endif
-#endif
-
-#if defined(PNG_READ_GAMMA_SUPPORTED)
-PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
- png_bytep gamma_table, png_uint_16pp gamma_16_table,
- int gamma_shift));
-#endif
-
-#if defined(PNG_READ_EXPAND_SUPPORTED)
-PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
- png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
-PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
- png_bytep row, png_color_16p trans_value));
-#endif
-
-/* The following decodes the appropriate chunks, and does error correction,
- * then calls the appropriate callback for the chunk if it is valid.
- */
-
-/* decode the IHDR chunk */
-PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-
-#if defined(PNG_READ_bKGD_SUPPORTED)
-PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_cHRM_SUPPORTED)
-PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_gAMA_SUPPORTED)
-PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_hIST_SUPPORTED)
-PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_iCCP_SUPPORTED)
-extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif /* PNG_READ_iCCP_SUPPORTED */
-
-#if defined(PNG_READ_iTXt_SUPPORTED)
-PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_oFFs_SUPPORTED)
-PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_pCAL_SUPPORTED)
-PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_pHYs_SUPPORTED)
-PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_sBIT_SUPPORTED)
-PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_sCAL_SUPPORTED)
-PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_sPLT_SUPPORTED)
-extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif /* PNG_READ_sPLT_SUPPORTED */
-
-#if defined(PNG_READ_sRGB_SUPPORTED)
-PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_tEXt_SUPPORTED)
-PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_tIME_SUPPORTED)
-PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_tRNS_SUPPORTED)
-PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-#if defined(PNG_READ_zTXt_SUPPORTED)
-PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
-#endif
-
-PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
-
-PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
- png_bytep chunk_name));
-
-/* handle the transformations for reading and writing */
-PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
-PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
-
-PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
-
-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
-PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
- png_uint_32 length));
-PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
-PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
-PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
- png_bytep buffer, png_size_t buffer_length));
-PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
-PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
- png_bytep buffer, png_size_t buffer_length));
-PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
-PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
-PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
-PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
-#if defined(PNG_READ_tEXt_SUPPORTED)
-PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
-PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
-PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
-PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-#endif
-#if defined(PNG_READ_iTXt_SUPPORTED)
-PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
-PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-#endif
-
-#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
-
-#ifdef PNG_MNG_FEATURES_SUPPORTED
-PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
- png_bytep row));
-PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
- png_bytep row));
-#endif
-
-#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
-#if defined(PNG_MMX_CODE_SUPPORTED)
-/* png.c */ /* PRIVATE */
-PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));
-#endif
-#endif
-
-#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
-PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr,
-png_infop info_ptr));
-
-PNG_EXTERN png_uint_32 png_get_x_pixels_per_inch PNGARG((png_structp png_ptr,
-png_infop info_ptr));
-
-PNG_EXTERN png_uint_32 png_get_y_pixels_per_inch PNGARG((png_structp png_ptr,
-png_infop info_ptr));
-
-PNG_EXTERN float png_get_x_offset_inches PNGARG((png_structp png_ptr,
-png_infop info_ptr));
-
-PNG_EXTERN float png_get_y_offset_inches PNGARG((png_structp png_ptr,
-png_infop info_ptr));
-
-#if defined(PNG_pHYs_SUPPORTED)
-PNG_EXTERN png_uint_32 png_get_pHYs_dpi PNGARG((png_structp png_ptr,
-png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
-#endif /* PNG_pHYs_SUPPORTED */
-#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
-
-/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
-
-#endif /* PNG_INTERNAL */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* PNG_VERSION_INFO_ONLY */
-/* do not put anything past this line */
-#endif /* PNG_H */
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/pngconf.h b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/pngconf.h
deleted file mode 100644
index d2f8d813..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/pngconf.h
+++ /dev/null
@@ -1,1481 +0,0 @@
-
-/* pngconf.h - machine configurable file for libpng
- *
- * libpng version 1.2.24 - December 14, 2007
- * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2007 Glenn Randers-Pehrson
- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
- */
-
-/* Any machine specific code is near the front of this file, so if you
- * are configuring libpng for a machine, you may want to read the section
- * starting here down to where it starts to typedef png_color, png_text,
- * and png_info.
- */
-
-#ifndef PNGCONF_H
-#define PNGCONF_H
-
-#define PNG_1_2_X
-
-/*
- * PNG_USER_CONFIG has to be defined on the compiler command line. This
- * includes the resource compiler for Windows DLL configurations.
- */
-#ifdef PNG_USER_CONFIG
-# ifndef PNG_USER_PRIVATEBUILD
-# define PNG_USER_PRIVATEBUILD
-# endif
-#include "pngusr.h"
-#endif
-
-/* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
-#ifdef PNG_CONFIGURE_LIBPNG
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#endif
-
-/*
- * Added at libpng-1.2.8
- *
- * If you create a private DLL you need to define in "pngusr.h" the followings:
- * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
- * the DLL was built>
- * e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
- * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
- * distinguish your DLL from those of the official release. These
- * correspond to the trailing letters that come after the version
- * number and must match your private DLL name>
- * e.g. // private DLL "libpng13gx.dll"
- * #define PNG_USER_DLLFNAME_POSTFIX "gx"
- *
- * The following macros are also at your disposal if you want to complete the
- * DLL VERSIONINFO structure.
- * - PNG_USER_VERSIONINFO_COMMENTS
- * - PNG_USER_VERSIONINFO_COMPANYNAME
- * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
- */
-
-#ifdef __STDC__
-#ifdef SPECIALBUILD
-# pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
- are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
-#endif
-
-#ifdef PRIVATEBUILD
-# pragma message("PRIVATEBUILD is deprecated.\
- Use PNG_USER_PRIVATEBUILD instead.")
-# define PNG_USER_PRIVATEBUILD PRIVATEBUILD
-#endif
-#endif /* __STDC__ */
-
-#ifndef PNG_VERSION_INFO_ONLY
-
-/* End of material added to libpng-1.2.8 */
-
-/* Added at libpng-1.2.19, removed at libpng-1.2.20 because it caused trouble
- Restored at libpng-1.2.21 */
-#if !defined(PNG_NO_WARN_UNINITIALIZED_ROW) && \
- !defined(PNG_WARN_UNINITIALIZED_ROW)
-# define PNG_WARN_UNINITIALIZED_ROW 1
-#endif
-/* End of material added at libpng-1.2.19/1.2.21 */
-
-/* This is the size of the compression buffer, and thus the size of
- * an IDAT chunk. Make this whatever size you feel is best for your
- * machine. One of these will be allocated per png_struct. When this
- * is full, it writes the data to the disk, and does some other
- * calculations. Making this an extremely small size will slow
- * the library down, but you may want to experiment to determine
- * where it becomes significant, if you are concerned with memory
- * usage. Note that zlib allocates at least 32Kb also. For readers,
- * this describes the size of the buffer available to read the data in.
- * Unless this gets smaller than the size of a row (compressed),
- * it should not make much difference how big this is.
- */
-
-#ifndef PNG_ZBUF_SIZE
-# define PNG_ZBUF_SIZE 8192
-#endif
-
-/* Enable if you want a write-only libpng */
-
-#ifndef PNG_NO_READ_SUPPORTED
-# define PNG_READ_SUPPORTED
-#endif
-
-/* Enable if you want a read-only libpng */
-
-#ifndef PNG_NO_WRITE_SUPPORTED
-# define PNG_WRITE_SUPPORTED
-#endif
-
-/* Enabled by default in 1.2.0. You can disable this if you don't need to
- support PNGs that are embedded in MNG datastreams */
-#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
-# ifndef PNG_MNG_FEATURES_SUPPORTED
-# define PNG_MNG_FEATURES_SUPPORTED
-# endif
-#endif
-
-#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
-# ifndef PNG_FLOATING_POINT_SUPPORTED
-# define PNG_FLOATING_POINT_SUPPORTED
-# endif
-#endif
-
-/* If you are running on a machine where you cannot allocate more
- * than 64K of memory at once, uncomment this. While libpng will not
- * normally need that much memory in a chunk (unless you load up a very
- * large file), zlib needs to know how big of a chunk it can use, and
- * libpng thus makes sure to check any memory allocation to verify it
- * will fit into memory.
-#define PNG_MAX_MALLOC_64K
- */
-#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
-# define PNG_MAX_MALLOC_64K
-#endif
-
-/* Special munging to support doing things the 'cygwin' way:
- * 'Normal' png-on-win32 defines/defaults:
- * PNG_BUILD_DLL -- building dll
- * PNG_USE_DLL -- building an application, linking to dll
- * (no define) -- building static library, or building an
- * application and linking to the static lib
- * 'Cygwin' defines/defaults:
- * PNG_BUILD_DLL -- (ignored) building the dll
- * (no define) -- (ignored) building an application, linking to the dll
- * PNG_STATIC -- (ignored) building the static lib, or building an
- * application that links to the static lib.
- * ALL_STATIC -- (ignored) building various static libs, or building an
- * application that links to the static libs.
- * Thus,
- * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
- * this bit of #ifdefs will define the 'correct' config variables based on
- * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
- * unnecessary.
- *
- * Also, the precedence order is:
- * ALL_STATIC (since we can't #undef something outside our namespace)
- * PNG_BUILD_DLL
- * PNG_STATIC
- * (nothing) == PNG_USE_DLL
- *
- * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
- * of auto-import in binutils, we no longer need to worry about
- * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore,
- * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
- * to __declspec() stuff. However, we DO need to worry about
- * PNG_BUILD_DLL and PNG_STATIC because those change some defaults
- * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
- */
-#if defined(__CYGWIN__)
-# if defined(ALL_STATIC)
-# if defined(PNG_BUILD_DLL)
-# undef PNG_BUILD_DLL
-# endif
-# if defined(PNG_USE_DLL)
-# undef PNG_USE_DLL
-# endif
-# if defined(PNG_DLL)
-# undef PNG_DLL
-# endif
-# if !defined(PNG_STATIC)
-# define PNG_STATIC
-# endif
-# else
-# if defined (PNG_BUILD_DLL)
-# if defined(PNG_STATIC)
-# undef PNG_STATIC
-# endif
-# if defined(PNG_USE_DLL)
-# undef PNG_USE_DLL
-# endif
-# if !defined(PNG_DLL)
-# define PNG_DLL
-# endif
-# else
-# if defined(PNG_STATIC)
-# if defined(PNG_USE_DLL)
-# undef PNG_USE_DLL
-# endif
-# if defined(PNG_DLL)
-# undef PNG_DLL
-# endif
-# else
-# if !defined(PNG_USE_DLL)
-# define PNG_USE_DLL
-# endif
-# if !defined(PNG_DLL)
-# define PNG_DLL
-# endif
-# endif
-# endif
-# endif
-#endif
-
-/* This protects us against compilers that run on a windowing system
- * and thus don't have or would rather us not use the stdio types:
- * stdin, stdout, and stderr. The only one currently used is stderr
- * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will
- * prevent these from being compiled and used. #defining PNG_NO_STDIO
- * will also prevent these, plus will prevent the entire set of stdio
- * macros and functions (FILE *, printf, etc.) from being compiled and used,
- * unless (PNG_DEBUG > 0) has been #defined.
- *
- * #define PNG_NO_CONSOLE_IO
- * #define PNG_NO_STDIO
- */
-
-#if defined(_WIN32_WCE)
-# include <windows.h>
- /* Console I/O functions are not supported on WindowsCE */
-# define PNG_NO_CONSOLE_IO
-# ifdef PNG_DEBUG
-# undef PNG_DEBUG
-# endif
-#endif
-
-#ifdef PNG_BUILD_DLL
-# ifndef PNG_CONSOLE_IO_SUPPORTED
-# ifndef PNG_NO_CONSOLE_IO
-# define PNG_NO_CONSOLE_IO
-# endif
-# endif
-#endif
-
-# ifdef PNG_NO_STDIO
-# ifndef PNG_NO_CONSOLE_IO
-# define PNG_NO_CONSOLE_IO
-# endif
-# ifdef PNG_DEBUG
-# if (PNG_DEBUG > 0)
-# include <stdio.h>
-# endif
-# endif
-# else
-# if !defined(_WIN32_WCE)
-/* "stdio.h" functions are not supported on WindowsCE */
-# include <stdio.h>
-# endif
-# endif
-
-/* This macro protects us against machines that don't have function
- * prototypes (ie K&R style headers). If your compiler does not handle
- * function prototypes, define this macro and use the included ansi2knr.
- * I've always been able to use _NO_PROTO as the indicator, but you may
- * need to drag the empty declaration out in front of here, or change the
- * ifdef to suit your own needs.
- */
-#ifndef PNGARG
-
-#ifdef OF /* zlib prototype munger */
-# define PNGARG(arglist) OF(arglist)
-#else
-
-#ifdef _NO_PROTO
-# define PNGARG(arglist) ()
-# ifndef PNG_TYPECAST_NULL
-# define PNG_TYPECAST_NULL
-# endif
-#else
-# define PNGARG(arglist) arglist
-#endif /* _NO_PROTO */
-
-
-#endif /* OF */
-
-#endif /* PNGARG */
-
-/* Try to determine if we are compiling on a Mac. Note that testing for
- * just __MWERKS__ is not good enough, because the Codewarrior is now used
- * on non-Mac platforms.
- */
-#ifndef MACOS
-# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
- defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
-# define MACOS
-# endif
-#endif
-
-/* enough people need this for various reasons to include it here */
-#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
-# include <sys/types.h>
-#endif
-
-#if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
-# define PNG_SETJMP_SUPPORTED
-#endif
-
-#ifdef PNG_SETJMP_SUPPORTED
-/* This is an attempt to force a single setjmp behaviour on Linux. If
- * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
- */
-
-# ifdef __linux__
-# ifdef _BSD_SOURCE
-# define PNG_SAVE_BSD_SOURCE
-# undef _BSD_SOURCE
-# endif
-# ifdef _SETJMP_H
- /* If you encounter a compiler error here, see the explanation
- * near the end of INSTALL.
- */
- __pngconf.h__ already includes setjmp.h;
- __dont__ include it again.;
-# endif
-# endif /* __linux__ */
-
- /* include setjmp.h for error handling */
-# include <setjmp.h>
-
-# ifdef __linux__
-# ifdef PNG_SAVE_BSD_SOURCE
-# ifndef _BSD_SOURCE
-# define _BSD_SOURCE
-# endif
-# undef PNG_SAVE_BSD_SOURCE
-# endif
-# endif /* __linux__ */
-#endif /* PNG_SETJMP_SUPPORTED */
-
-#ifdef BSD
-# include <strings.h>
-#else
-# include <string.h>
-#endif
-
-/* Other defines for things like memory and the like can go here. */
-#ifdef PNG_INTERNAL
-
-#include <stdlib.h>
-
-/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
- * aren't usually used outside the library (as far as I know), so it is
- * debatable if they should be exported at all. In the future, when it is
- * possible to have run-time registry of chunk-handling functions, some of
- * these will be made available again.
-#define PNG_EXTERN extern
- */
-#define PNG_EXTERN
-
-/* Other defines specific to compilers can go here. Try to keep
- * them inside an appropriate ifdef/endif pair for portability.
- */
-
-#if defined(PNG_FLOATING_POINT_SUPPORTED)
-# if defined(MACOS)
- /* We need to check that <math.h> hasn't already been included earlier
- * as it seems it doesn't agree with <fp.h>, yet we should really use
- * <fp.h> if possible.
- */
-# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
-# include <fp.h>
-# endif
-# else
-# include <math.h>
-# endif
-# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
- /* Amiga SAS/C: We must include builtin FPU functions when compiling using
- * MATH=68881
- */
-# include <m68881.h>
-# endif
-#endif
-
-/* Codewarrior on NT has linking problems without this. */
-#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
-# define PNG_ALWAYS_EXTERN
-#endif
-
-/* This provides the non-ANSI (far) memory allocation routines. */
-#if defined(__TURBOC__) && defined(__MSDOS__)
-# include <mem.h>
-# include <alloc.h>
-#endif
-
-/* I have no idea why is this necessary... */
-#if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
- defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
-# include <malloc.h>
-#endif
-
-/* This controls how fine the dithering gets. As this allocates
- * a largish chunk of memory (32K), those who are not as concerned
- * with dithering quality can decrease some or all of these.
- */
-#ifndef PNG_DITHER_RED_BITS
-# define PNG_DITHER_RED_BITS 5
-#endif
-#ifndef PNG_DITHER_GREEN_BITS
-# define PNG_DITHER_GREEN_BITS 5
-#endif
-#ifndef PNG_DITHER_BLUE_BITS
-# define PNG_DITHER_BLUE_BITS 5
-#endif
-
-/* This controls how fine the gamma correction becomes when you
- * are only interested in 8 bits anyway. Increasing this value
- * results in more memory being used, and more pow() functions
- * being called to fill in the gamma tables. Don't set this value
- * less then 8, and even that may not work (I haven't tested it).
- */
-
-#ifndef PNG_MAX_GAMMA_8
-# define PNG_MAX_GAMMA_8 11
-#endif
-
-/* This controls how much a difference in gamma we can tolerate before
- * we actually start doing gamma conversion.
- */
-#ifndef PNG_GAMMA_THRESHOLD
-# define PNG_GAMMA_THRESHOLD 0.05
-#endif
-
-#endif /* PNG_INTERNAL */
-
-/* The following uses const char * instead of char * for error
- * and warning message functions, so some compilers won't complain.
- * If you do not want to use const, define PNG_NO_CONST here.
- */
-
-#ifndef PNG_NO_CONST
-# define PNG_CONST const
-#else
-# define PNG_CONST
-#endif
-
-/* The following defines give you the ability to remove code from the
- * library that you will not be using. I wish I could figure out how to
- * automate this, but I can't do that without making it seriously hard
- * on the users. So if you are not using an ability, change the #define
- * to and #undef, and that part of the library will not be compiled. If
- * your linker can't find a function, you may want to make sure the
- * ability is defined here. Some of these depend upon some others being
- * defined. I haven't figured out all the interactions here, so you may
- * have to experiment awhile to get everything to compile. If you are
- * creating or using a shared library, you probably shouldn't touch this,
- * as it will affect the size of the structures, and this will cause bad
- * things to happen if the library and/or application ever change.
- */
-
-/* Any features you will not be using can be undef'ed here */
-
-/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
- * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
- * on the compile line, then pick and choose which ones to define without
- * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
- * if you only want to have a png-compliant reader/writer but don't need
- * any of the extra transformations. This saves about 80 kbytes in a
- * typical installation of the library. (PNG_NO_* form added in version
- * 1.0.1c, for consistency)
- */
-
-/* The size of the png_text structure changed in libpng-1.0.6 when
- * iTXt support was added. iTXt support was turned off by default through
- * libpng-1.2.x, to support old apps that malloc the png_text structure
- * instead of calling png_set_text() and letting libpng malloc it. It
- * was turned on by default in libpng-1.3.0.
- */
-
-#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
-# ifndef PNG_NO_iTXt_SUPPORTED
-# define PNG_NO_iTXt_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_iTXt
-# define PNG_NO_READ_iTXt
-# endif
-# ifndef PNG_NO_WRITE_iTXt
-# define PNG_NO_WRITE_iTXt
-# endif
-#endif
-
-#if !defined(PNG_NO_iTXt_SUPPORTED)
-# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
-# define PNG_READ_iTXt
-# endif
-# if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
-# define PNG_WRITE_iTXt
-# endif
-#endif
-
-/* The following support, added after version 1.0.0, can be turned off here en
- * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
- * with old applications that require the length of png_struct and png_info
- * to remain unchanged.
- */
-
-#ifdef PNG_LEGACY_SUPPORTED
-# define PNG_NO_FREE_ME
-# define PNG_NO_READ_UNKNOWN_CHUNKS
-# define PNG_NO_WRITE_UNKNOWN_CHUNKS
-# define PNG_NO_READ_USER_CHUNKS
-# define PNG_NO_READ_iCCP
-# define PNG_NO_WRITE_iCCP
-# define PNG_NO_READ_iTXt
-# define PNG_NO_WRITE_iTXt
-# define PNG_NO_READ_sCAL
-# define PNG_NO_WRITE_sCAL
-# define PNG_NO_READ_sPLT
-# define PNG_NO_WRITE_sPLT
-# define PNG_NO_INFO_IMAGE
-# define PNG_NO_READ_RGB_TO_GRAY
-# define PNG_NO_READ_USER_TRANSFORM
-# define PNG_NO_WRITE_USER_TRANSFORM
-# define PNG_NO_USER_MEM
-# define PNG_NO_READ_EMPTY_PLTE
-# define PNG_NO_MNG_FEATURES
-# define PNG_NO_FIXED_POINT_SUPPORTED
-#endif
-
-/* Ignore attempt to turn off both floating and fixed point support */
-#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
- !defined(PNG_NO_FIXED_POINT_SUPPORTED)
-# define PNG_FIXED_POINT_SUPPORTED
-#endif
-
-#ifndef PNG_NO_FREE_ME
-# define PNG_FREE_ME_SUPPORTED
-#endif
-
-#if defined(PNG_READ_SUPPORTED)
-
-#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
- !defined(PNG_NO_READ_TRANSFORMS)
-# define PNG_READ_TRANSFORMS_SUPPORTED
-#endif
-
-#ifdef PNG_READ_TRANSFORMS_SUPPORTED
-# ifndef PNG_NO_READ_EXPAND
-# define PNG_READ_EXPAND_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_SHIFT
-# define PNG_READ_SHIFT_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_PACK
-# define PNG_READ_PACK_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_BGR
-# define PNG_READ_BGR_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_SWAP
-# define PNG_READ_SWAP_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_PACKSWAP
-# define PNG_READ_PACKSWAP_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_INVERT
-# define PNG_READ_INVERT_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_DITHER
-# define PNG_READ_DITHER_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_BACKGROUND
-# define PNG_READ_BACKGROUND_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_16_TO_8
-# define PNG_READ_16_TO_8_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_FILLER
-# define PNG_READ_FILLER_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_GAMMA
-# define PNG_READ_GAMMA_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_GRAY_TO_RGB
-# define PNG_READ_GRAY_TO_RGB_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_SWAP_ALPHA
-# define PNG_READ_SWAP_ALPHA_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_INVERT_ALPHA
-# define PNG_READ_INVERT_ALPHA_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_STRIP_ALPHA
-# define PNG_READ_STRIP_ALPHA_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_USER_TRANSFORM
-# define PNG_READ_USER_TRANSFORM_SUPPORTED
-# endif
-# ifndef PNG_NO_READ_RGB_TO_GRAY
-# define PNG_READ_RGB_TO_GRAY_SUPPORTED
-# endif
-#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
-
-#if !defined(PNG_NO_PROGRESSIVE_READ) && \
- !defined(PNG_PROGRESSIVE_READ_SUPPORTED) /* if you don't do progressive */
-# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
-#endif /* about interlacing capability! You'll */
- /* still have interlacing unless you change the following line: */
-
-#define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
-
-#ifndef PNG_NO_READ_COMPOSITE_NODIV
-# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
-# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
-# endif
-#endif
-
-#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
-/* Deprecated, will be removed from version 2.0.0.
- Use PNG_MNG_FEATURES_SUPPORTED instead. */
-#ifndef PNG_NO_READ_EMPTY_PLTE
-# define PNG_READ_EMPTY_PLTE_SUPPORTED
-#endif
-#endif
-
-#endif /* PNG_READ_SUPPORTED */
-
-#if defined(PNG_WRITE_SUPPORTED)
-
-# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
- !defined(PNG_NO_WRITE_TRANSFORMS)
-# define PNG_WRITE_TRANSFORMS_SUPPORTED
-#endif
-
-#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
-# ifndef PNG_NO_WRITE_SHIFT
-# define PNG_WRITE_SHIFT_SUPPORTED
-# endif
-# ifndef PNG_NO_WRITE_PACK
-# define PNG_WRITE_PACK_SUPPORTED
-# endif
-# ifndef PNG_NO_WRITE_BGR
-# define PNG_WRITE_BGR_SUPPORTED
-# endif
-# ifndef PNG_NO_WRITE_SWAP
-# define PNG_WRITE_SWAP_SUPPORTED
-# endif
-# ifndef PNG_NO_WRITE_PACKSWAP
-# define PNG_WRITE_PACKSWAP_SUPPORTED
-# endif
-# ifndef PNG_NO_WRITE_INVERT
-# define PNG_WRITE_INVERT_SUPPORTED
-# endif
-# ifndef PNG_NO_WRITE_FILLER
-# define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */
-# endif
-# ifndef PNG_NO_WRITE_SWAP_ALPHA
-# define PNG_WRITE_SWAP_ALPHA_SUPPORTED
-# endif
-# ifndef PNG_NO_WRITE_INVERT_ALPHA
-# define PNG_WRITE_INVERT_ALPHA_SUPPORTED
-# endif
-# ifndef PNG_NO_WRITE_USER_TRANSFORM
-# define PNG_WRITE_USER_TRANSFORM_SUPPORTED
-# endif
-#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
-
-#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
- !defined(PNG_WRITE_INTERLACING_SUPPORTED)
-#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
- encoders, but can cause trouble
- if left undefined */
-#endif
-
-#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
- !defined(PNG_WRITE_WEIGHTED_FILTER) && \
- defined(PNG_FLOATING_POINT_SUPPORTED)
-# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-#endif
-
-#ifndef PNG_NO_WRITE_FLUSH
-# define PNG_WRITE_FLUSH_SUPPORTED
-#endif
-
-#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
-/* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
-#ifndef PNG_NO_WRITE_EMPTY_PLTE
-# define PNG_WRITE_EMPTY_PLTE_SUPPORTED
-#endif
-#endif
-
-#endif /* PNG_WRITE_SUPPORTED */
-
-#ifndef PNG_1_0_X
-# ifndef PNG_NO_ERROR_NUMBERS
-# define PNG_ERROR_NUMBERS_SUPPORTED
-# endif
-#endif /* PNG_1_0_X */
-
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
- defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
-# ifndef PNG_NO_USER_TRANSFORM_PTR
-# define PNG_USER_TRANSFORM_PTR_SUPPORTED
-# endif
-#endif
-
-#ifndef PNG_NO_STDIO
-# define PNG_TIME_RFC1123_SUPPORTED
-#endif
-
-/* This adds extra functions in pngget.c for accessing data from the
- * info pointer (added in version 0.99)
- * png_get_image_width()
- * png_get_image_height()
- * png_get_bit_depth()
- * png_get_color_type()
- * png_get_compression_type()
- * png_get_filter_type()
- * png_get_interlace_type()
- * png_get_pixel_aspect_ratio()
- * png_get_pixels_per_meter()
- * png_get_x_offset_pixels()
- * png_get_y_offset_pixels()
- * png_get_x_offset_microns()
- * png_get_y_offset_microns()
- */
-#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
-# define PNG_EASY_ACCESS_SUPPORTED
-#endif
-
-/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
- * and removed from version 1.2.20. The following will be removed
- * from libpng-1.4.0
-*/
-
-#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_OPTIMIZED_CODE)
-# ifndef PNG_OPTIMIZED_CODE_SUPPORTED
-# define PNG_OPTIMIZED_CODE_SUPPORTED
-# endif
-#endif
-
-#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE) && defined(__i386__)
-# ifndef PNG_ASSEMBLER_CODE_SUPPORTED
-# define PNG_ASSEMBLER_CODE_SUPPORTED
-# endif
-
-# if defined(__GNUC__) && defined(__x86_64__) && (__GNUC__ < 4)
- /* work around 64-bit gcc compiler bugs in gcc-3.x */
-# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
-# define PNG_NO_MMX_CODE
-# endif
-# endif
-
-# if defined(__APPLE__)
-# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
-# define PNG_NO_MMX_CODE
-# endif
-# endif
-
-# if (defined(__MWERKS__) && ((__MWERKS__ < 0x0900) || macintosh))
-# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
-# define PNG_NO_MMX_CODE
-# endif
-# endif
-
-# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
-# define PNG_MMX_CODE_SUPPORTED
-# endif
-
-#endif
-/* end of obsolete code to be removed from libpng-1.4.0 */
-
-#if !defined(PNG_1_0_X)
-#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
-# define PNG_USER_MEM_SUPPORTED
-#endif
-#endif /* PNG_1_0_X */
-
-/* Added at libpng-1.2.6 */
-#if !defined(PNG_1_0_X)
-#ifndef PNG_SET_USER_LIMITS_SUPPORTED
-#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
-# define PNG_SET_USER_LIMITS_SUPPORTED
-#endif
-#endif
-#endif /* PNG_1_0_X */
-
-/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter
- * how large, set these limits to 0x7fffffffL
- */
-#ifndef PNG_USER_WIDTH_MAX
-# define PNG_USER_WIDTH_MAX 1000000L
-#endif
-#ifndef PNG_USER_HEIGHT_MAX
-# define PNG_USER_HEIGHT_MAX 1000000L
-#endif
-
-/* These are currently experimental features, define them if you want */
-
-/* very little testing */
-/*
-#ifdef PNG_READ_SUPPORTED
-# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
-# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
-# endif
-#endif
-*/
-
-/* This is only for PowerPC big-endian and 680x0 systems */
-/* some testing */
-/*
-#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
-# define PNG_READ_BIG_ENDIAN_SUPPORTED
-#endif
-*/
-
-/* Buggy compilers (e.g., gcc 2.7.2.2) need this */
-/*
-#define PNG_NO_POINTER_INDEXING
-*/
-
-/* These functions are turned off by default, as they will be phased out. */
-/*
-#define PNG_USELESS_TESTS_SUPPORTED
-#define PNG_CORRECT_PALETTE_SUPPORTED
-*/
-
-/* Any chunks you are not interested in, you can undef here. The
- * ones that allocate memory may be expecially important (hIST,
- * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info
- * a bit smaller.
- */
-
-#if defined(PNG_READ_SUPPORTED) && \
- !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
- !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
-# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
-#endif
-
-#if defined(PNG_WRITE_SUPPORTED) && \
- !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
- !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
-# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
-#endif
-
-#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
-
-#ifdef PNG_NO_READ_TEXT
-# define PNG_NO_READ_iTXt
-# define PNG_NO_READ_tEXt
-# define PNG_NO_READ_zTXt
-#endif
-#ifndef PNG_NO_READ_bKGD
-# define PNG_READ_bKGD_SUPPORTED
-# define PNG_bKGD_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_cHRM
-# define PNG_READ_cHRM_SUPPORTED
-# define PNG_cHRM_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_gAMA
-# define PNG_READ_gAMA_SUPPORTED
-# define PNG_gAMA_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_hIST
-# define PNG_READ_hIST_SUPPORTED
-# define PNG_hIST_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_iCCP
-# define PNG_READ_iCCP_SUPPORTED
-# define PNG_iCCP_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_iTXt
-# ifndef PNG_READ_iTXt_SUPPORTED
-# define PNG_READ_iTXt_SUPPORTED
-# endif
-# ifndef PNG_iTXt_SUPPORTED
-# define PNG_iTXt_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_READ_oFFs
-# define PNG_READ_oFFs_SUPPORTED
-# define PNG_oFFs_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_pCAL
-# define PNG_READ_pCAL_SUPPORTED
-# define PNG_pCAL_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_sCAL
-# define PNG_READ_sCAL_SUPPORTED
-# define PNG_sCAL_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_pHYs
-# define PNG_READ_pHYs_SUPPORTED
-# define PNG_pHYs_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_sBIT
-# define PNG_READ_sBIT_SUPPORTED
-# define PNG_sBIT_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_sPLT
-# define PNG_READ_sPLT_SUPPORTED
-# define PNG_sPLT_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_sRGB
-# define PNG_READ_sRGB_SUPPORTED
-# define PNG_sRGB_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_tEXt
-# define PNG_READ_tEXt_SUPPORTED
-# define PNG_tEXt_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_tIME
-# define PNG_READ_tIME_SUPPORTED
-# define PNG_tIME_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_tRNS
-# define PNG_READ_tRNS_SUPPORTED
-# define PNG_tRNS_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_zTXt
-# define PNG_READ_zTXt_SUPPORTED
-# define PNG_zTXt_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
-# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
-# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
-# define PNG_UNKNOWN_CHUNKS_SUPPORTED
-# endif
-# ifndef PNG_NO_HANDLE_AS_UNKNOWN
-# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
-# endif
-#endif
-#if !defined(PNG_NO_READ_USER_CHUNKS) && \
- defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
-# define PNG_READ_USER_CHUNKS_SUPPORTED
-# define PNG_USER_CHUNKS_SUPPORTED
-# ifdef PNG_NO_READ_UNKNOWN_CHUNKS
-# undef PNG_NO_READ_UNKNOWN_CHUNKS
-# endif
-# ifdef PNG_NO_HANDLE_AS_UNKNOWN
-# undef PNG_NO_HANDLE_AS_UNKNOWN
-# endif
-#endif
-#ifndef PNG_NO_READ_OPT_PLTE
-# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
-#endif /* optional PLTE chunk in RGB and RGBA images */
-#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
- defined(PNG_READ_zTXt_SUPPORTED)
-# define PNG_READ_TEXT_SUPPORTED
-# define PNG_TEXT_SUPPORTED
-#endif
-
-#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
-
-#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
-
-#ifdef PNG_NO_WRITE_TEXT
-# define PNG_NO_WRITE_iTXt
-# define PNG_NO_WRITE_tEXt
-# define PNG_NO_WRITE_zTXt
-#endif
-#ifndef PNG_NO_WRITE_bKGD
-# define PNG_WRITE_bKGD_SUPPORTED
-# ifndef PNG_bKGD_SUPPORTED
-# define PNG_bKGD_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_cHRM
-# define PNG_WRITE_cHRM_SUPPORTED
-# ifndef PNG_cHRM_SUPPORTED
-# define PNG_cHRM_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_gAMA
-# define PNG_WRITE_gAMA_SUPPORTED
-# ifndef PNG_gAMA_SUPPORTED
-# define PNG_gAMA_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_hIST
-# define PNG_WRITE_hIST_SUPPORTED
-# ifndef PNG_hIST_SUPPORTED
-# define PNG_hIST_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_iCCP
-# define PNG_WRITE_iCCP_SUPPORTED
-# ifndef PNG_iCCP_SUPPORTED
-# define PNG_iCCP_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_iTXt
-# ifndef PNG_WRITE_iTXt_SUPPORTED
-# define PNG_WRITE_iTXt_SUPPORTED
-# endif
-# ifndef PNG_iTXt_SUPPORTED
-# define PNG_iTXt_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_oFFs
-# define PNG_WRITE_oFFs_SUPPORTED
-# ifndef PNG_oFFs_SUPPORTED
-# define PNG_oFFs_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_pCAL
-# define PNG_WRITE_pCAL_SUPPORTED
-# ifndef PNG_pCAL_SUPPORTED
-# define PNG_pCAL_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_sCAL
-# define PNG_WRITE_sCAL_SUPPORTED
-# ifndef PNG_sCAL_SUPPORTED
-# define PNG_sCAL_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_pHYs
-# define PNG_WRITE_pHYs_SUPPORTED
-# ifndef PNG_pHYs_SUPPORTED
-# define PNG_pHYs_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_sBIT
-# define PNG_WRITE_sBIT_SUPPORTED
-# ifndef PNG_sBIT_SUPPORTED
-# define PNG_sBIT_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_sPLT
-# define PNG_WRITE_sPLT_SUPPORTED
-# ifndef PNG_sPLT_SUPPORTED
-# define PNG_sPLT_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_sRGB
-# define PNG_WRITE_sRGB_SUPPORTED
-# ifndef PNG_sRGB_SUPPORTED
-# define PNG_sRGB_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_tEXt
-# define PNG_WRITE_tEXt_SUPPORTED
-# ifndef PNG_tEXt_SUPPORTED
-# define PNG_tEXt_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_tIME
-# define PNG_WRITE_tIME_SUPPORTED
-# ifndef PNG_tIME_SUPPORTED
-# define PNG_tIME_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_tRNS
-# define PNG_WRITE_tRNS_SUPPORTED
-# ifndef PNG_tRNS_SUPPORTED
-# define PNG_tRNS_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_zTXt
-# define PNG_WRITE_zTXt_SUPPORTED
-# ifndef PNG_zTXt_SUPPORTED
-# define PNG_zTXt_SUPPORTED
-# endif
-#endif
-#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
-# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
-# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
-# define PNG_UNKNOWN_CHUNKS_SUPPORTED
-# endif
-# ifndef PNG_NO_HANDLE_AS_UNKNOWN
-# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
-# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
-# endif
-# endif
-#endif
-#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
- defined(PNG_WRITE_zTXt_SUPPORTED)
-# define PNG_WRITE_TEXT_SUPPORTED
-# ifndef PNG_TEXT_SUPPORTED
-# define PNG_TEXT_SUPPORTED
-# endif
-#endif
-
-#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
-
-/* Turn this off to disable png_read_png() and
- * png_write_png() and leave the row_pointers member
- * out of the info structure.
- */
-#ifndef PNG_NO_INFO_IMAGE
-# define PNG_INFO_IMAGE_SUPPORTED
-#endif
-
-/* need the time information for reading tIME chunks */
-#if defined(PNG_tIME_SUPPORTED)
-# if !defined(_WIN32_WCE)
- /* "time.h" functions are not supported on WindowsCE */
-# include <time.h>
-# endif
-#endif
-
-/* Some typedefs to get us started. These should be safe on most of the
- * common platforms. The typedefs should be at least as large as the
- * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
- * don't have to be exactly that size. Some compilers dislike passing
- * unsigned shorts as function parameters, so you may be better off using
- * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may
- * want to have unsigned int for png_uint_32 instead of unsigned long.
- */
-
-typedef unsigned long png_uint_32;
-typedef long png_int_32;
-typedef unsigned short png_uint_16;
-typedef short png_int_16;
-typedef unsigned char png_byte;
-
-/* This is usually size_t. It is typedef'ed just in case you need it to
- change (I'm not sure if you will or not, so I thought I'd be safe) */
-#ifdef PNG_SIZE_T
- typedef PNG_SIZE_T png_size_t;
-# define png_sizeof(x) png_convert_size(sizeof (x))
-#else
- typedef size_t png_size_t;
-# define png_sizeof(x) sizeof (x)
-#endif
-
-/* The following is needed for medium model support. It cannot be in the
- * PNG_INTERNAL section. Needs modification for other compilers besides
- * MSC. Model independent support declares all arrays and pointers to be
- * large using the far keyword. The zlib version used must also support
- * model independent data. As of version zlib 1.0.4, the necessary changes
- * have been made in zlib. The USE_FAR_KEYWORD define triggers other
- * changes that are needed. (Tim Wegner)
- */
-
-/* Separate compiler dependencies (problem here is that zlib.h always
- defines FAR. (SJT) */
-#ifdef __BORLANDC__
-# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
-# define LDATA 1
-# else
-# define LDATA 0
-# endif
- /* GRR: why is Cygwin in here? Cygwin is not Borland C... */
-# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
-# define PNG_MAX_MALLOC_64K
-# if (LDATA != 1)
-# ifndef FAR
-# define FAR __far
-# endif
-# define USE_FAR_KEYWORD
-# endif /* LDATA != 1 */
- /* Possibly useful for moving data out of default segment.
- * Uncomment it if you want. Could also define FARDATA as
- * const if your compiler supports it. (SJT)
-# define FARDATA FAR
- */
-# endif /* __WIN32__, __FLAT__, __CYGWIN__ */
-#endif /* __BORLANDC__ */
-
-
-/* Suggest testing for specific compiler first before testing for
- * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
- * making reliance oncertain keywords suspect. (SJT)
- */
-
-/* MSC Medium model */
-#if defined(FAR)
-# if defined(M_I86MM)
-# define USE_FAR_KEYWORD
-# define FARDATA FAR
-# include <dos.h>
-# endif
-#endif
-
-/* SJT: default case */
-#ifndef FAR
-# define FAR
-#endif
-
-/* At this point FAR is always defined */
-#ifndef FARDATA
-# define FARDATA
-#endif
-
-/* Typedef for floating-point numbers that are converted
- to fixed-point with a multiple of 100,000, e.g., int_gamma */
-typedef png_int_32 png_fixed_point;
-
-/* Add typedefs for pointers */
-typedef void FAR * png_voidp;
-typedef png_byte FAR * png_bytep;
-typedef png_uint_32 FAR * png_uint_32p;
-typedef png_int_32 FAR * png_int_32p;
-typedef png_uint_16 FAR * png_uint_16p;
-typedef png_int_16 FAR * png_int_16p;
-typedef PNG_CONST char FAR * png_const_charp;
-typedef char FAR * png_charp;
-typedef png_fixed_point FAR * png_fixed_point_p;
-
-#ifndef PNG_NO_STDIO
-#if defined(_WIN32_WCE)
-typedef HANDLE png_FILE_p;
-#else
-typedef FILE * png_FILE_p;
-#endif
-#endif
-
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-typedef double FAR * png_doublep;
-#endif
-
-/* Pointers to pointers; i.e. arrays */
-typedef png_byte FAR * FAR * png_bytepp;
-typedef png_uint_32 FAR * FAR * png_uint_32pp;
-typedef png_int_32 FAR * FAR * png_int_32pp;
-typedef png_uint_16 FAR * FAR * png_uint_16pp;
-typedef png_int_16 FAR * FAR * png_int_16pp;
-typedef PNG_CONST char FAR * FAR * png_const_charpp;
-typedef char FAR * FAR * png_charpp;
-typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-typedef double FAR * FAR * png_doublepp;
-#endif
-
-/* Pointers to pointers to pointers; i.e., pointer to array */
-typedef char FAR * FAR * FAR * png_charppp;
-
-#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
-/* SPC - Is this stuff deprecated? */
-/* It'll be removed as of libpng-1.3.0 - GR-P */
-/* libpng typedefs for types in zlib. If zlib changes
- * or another compression library is used, then change these.
- * Eliminates need to change all the source files.
- */
-typedef charf * png_zcharp;
-typedef charf * FAR * png_zcharpp;
-typedef z_stream FAR * png_zstreamp;
-#endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */
-
-/*
- * Define PNG_BUILD_DLL if the module being built is a Windows
- * LIBPNG DLL.
- *
- * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
- * It is equivalent to Microsoft predefined macro _DLL that is
- * automatically defined when you compile using the share
- * version of the CRT (C Run-Time library)
- *
- * The cygwin mods make this behavior a little different:
- * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
- * Define PNG_STATIC if you are building a static library for use with cygwin,
- * -or- if you are building an application that you want to link to the
- * static library.
- * PNG_USE_DLL is defined by default (no user action needed) unless one of
- * the other flags is defined.
- */
-
-#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
-# define PNG_DLL
-#endif
-/* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
- * When building a static lib, default to no GLOBAL ARRAYS, but allow
- * command-line override
- */
-#if defined(__CYGWIN__)
-# if !defined(PNG_STATIC)
-# if defined(PNG_USE_GLOBAL_ARRAYS)
-# undef PNG_USE_GLOBAL_ARRAYS
-# endif
-# if !defined(PNG_USE_LOCAL_ARRAYS)
-# define PNG_USE_LOCAL_ARRAYS
-# endif
-# else
-# if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
-# if defined(PNG_USE_GLOBAL_ARRAYS)
-# undef PNG_USE_GLOBAL_ARRAYS
-# endif
-# endif
-# endif
-# if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
-# define PNG_USE_LOCAL_ARRAYS
-# endif
-#endif
-
-/* Do not use global arrays (helps with building DLL's)
- * They are no longer used in libpng itself, since version 1.0.5c,
- * but might be required for some pre-1.0.5c applications.
- */
-#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
-# if defined(PNG_NO_GLOBAL_ARRAYS) || \
- (defined(__GNUC__) && defined(PNG_DLL)) || defined(_MSC_VER)
-# define PNG_USE_LOCAL_ARRAYS
-# else
-# define PNG_USE_GLOBAL_ARRAYS
-# endif
-#endif
-
-#if defined(__CYGWIN__)
-# undef PNGAPI
-# define PNGAPI __cdecl
-# undef PNG_IMPEXP
-# define PNG_IMPEXP
-#endif
-
-/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
- * you may get warnings regarding the linkage of png_zalloc and png_zfree.
- * Don't ignore those warnings; you must also reset the default calling
- * convention in your compiler to match your PNGAPI, and you must build
- * zlib and your applications the same way you build libpng.
- */
-
-#if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
-# ifndef PNG_NO_MODULEDEF
-# define PNG_NO_MODULEDEF
-# endif
-#endif
-
-#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
-# define PNG_IMPEXP
-#endif
-
-#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
- (( defined(_Windows) || defined(_WINDOWS) || \
- defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
-
-# ifndef PNGAPI
-# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
-# define PNGAPI __cdecl
-# else
-# define PNGAPI _cdecl
-# endif
-# endif
-
-# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
- 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
-# define PNG_IMPEXP
-# endif
-
-# if !defined(PNG_IMPEXP)
-
-# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
-# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
-
- /* Borland/Microsoft */
-# if defined(_MSC_VER) || defined(__BORLANDC__)
-# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
-# define PNG_EXPORT PNG_EXPORT_TYPE1
-# else
-# define PNG_EXPORT PNG_EXPORT_TYPE2
-# if defined(PNG_BUILD_DLL)
-# define PNG_IMPEXP __export
-# else
-# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
- VC++ */
-# endif /* Exists in Borland C++ for
- C++ classes (== huge) */
-# endif
-# endif
-
-# if !defined(PNG_IMPEXP)
-# if defined(PNG_BUILD_DLL)
-# define PNG_IMPEXP __declspec(dllexport)
-# else
-# define PNG_IMPEXP __declspec(dllimport)
-# endif
-# endif
-# endif /* PNG_IMPEXP */
-#else /* !(DLL || non-cygwin WINDOWS) */
-# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
-# ifndef PNGAPI
-# define PNGAPI _System
-# endif
-# else
-# if 0 /* ... other platforms, with other meanings */
-# endif
-# endif
-#endif
-
-#ifndef PNGAPI
-# define PNGAPI
-#endif
-#ifndef PNG_IMPEXP
-# define PNG_IMPEXP
-#endif
-
-#ifdef PNG_BUILDSYMS
-# ifndef PNG_EXPORT
-# define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
-# endif
-# ifdef PNG_USE_GLOBAL_ARRAYS
-# ifndef PNG_EXPORT_VAR
-# define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT
-# endif
-# endif
-#endif
-
-#ifndef PNG_EXPORT
-# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
-#endif
-
-#ifdef PNG_USE_GLOBAL_ARRAYS
-# ifndef PNG_EXPORT_VAR
-# define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
-# endif
-#endif
-
-/* User may want to use these so they are not in PNG_INTERNAL. Any library
- * functions that are passed far data must be model independent.
- */
-
-#ifndef PNG_ABORT
-# define PNG_ABORT() abort()
-#endif
-
-#ifdef PNG_SETJMP_SUPPORTED
-# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
-#else
-# define png_jmpbuf(png_ptr) \
- (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
-#endif
-
-#if defined(USE_FAR_KEYWORD) /* memory model independent fns */
-/* use this to make far-to-near assignments */
-# define CHECK 1
-# define NOCHECK 0
-# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
-# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
-# define png_snprintf _fsnprintf /* Added to v 1.2.19 */
-# define png_strlen _fstrlen
-# define png_memcmp _fmemcmp /* SJT: added */
-# define png_memcpy _fmemcpy
-# define png_memset _fmemset
-#else /* use the usual functions */
-# define CVT_PTR(ptr) (ptr)
-# define CVT_PTR_NOCHECK(ptr) (ptr)
-# ifndef PNG_NO_SNPRINTF
-# ifdef _MSC_VER
-# define png_snprintf _snprintf /* Added to v 1.2.19 */
-# define png_snprintf2 _snprintf
-# define png_snprintf6 _snprintf
-# else
-# define png_snprintf snprintf /* Added to v 1.2.19 */
-# define png_snprintf2 snprintf
-# define png_snprintf6 snprintf
-# endif
-# else
- /* You don't have or don't want to use snprintf(). Caution: Using
- * sprintf instead of snprintf exposes your application to accidental
- * or malevolent buffer overflows. If you don't have snprintf()
- * as a general rule you should provide one (you can get one from
- * Portable OpenSSH). */
-# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
-# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
-# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
- sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
-# endif
-# define png_strlen strlen
-# define png_memcmp memcmp /* SJT: added */
-# define png_memcpy memcpy
-# define png_memset memset
-#endif
-/* End of memory model independent support */
-
-/* Just a little check that someone hasn't tried to define something
- * contradictory.
- */
-#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
-# undef PNG_ZBUF_SIZE
-# define PNG_ZBUF_SIZE 65536L
-#endif
-
-/* Added at libpng-1.2.8 */
-#endif /* PNG_VERSION_INFO_ONLY */
-
-#endif /* PNGCONF_H */
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiff.h b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiff.h
deleted file mode 100644
index 6330795b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiff.h
+++ /dev/null
@@ -1,647 +0,0 @@
-/* $Id: tiff.h,v 1.42 2005/12/23 15:10:45 dron Exp $ */
-
-/*
- * Copyright (c) 1988-1997 Sam Leffler
- * Copyright (c) 1991-1997 Silicon Graphics, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that (i) the above copyright notices and this permission notice appear in
- * all copies of the software and related documentation, and (ii) the names of
- * Sam Leffler and Silicon Graphics may not be used in any advertising or
- * publicity relating to the software without the specific, prior written
- * permission of Sam Leffler and Silicon Graphics.
- *
- * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- *
- * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
- * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
- * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
- * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#ifndef _TIFF_
-#define _TIFF_
-
-#include "tiffconf.h"
-
-/*
- * Tag Image File Format (TIFF)
- *
- * Based on Rev 6.0 from:
- * Developer's Desk
- * Aldus Corporation
- * 411 First Ave. South
- * Suite 200
- * Seattle, WA 98104
- * 206-622-5500
- *
- * (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf)
- *
- * For Big TIFF design notes see the following link
- * http://gdal.maptools.org/twiki/bin/view/libtiff/BigTIFFDesign
- */
-#define TIFF_VERSION 42
-#define TIFF_BIGTIFF_VERSION 43
-
-#define TIFF_BIGENDIAN 0x4d4d
-#define TIFF_LITTLEENDIAN 0x4949
-#define MDI_LITTLEENDIAN 0x5045
-#define MDI_BIGENDIAN 0x4550
-/*
- * Intrinsic data types required by the file format:
- *
- * 8-bit quantities int8/uint8
- * 16-bit quantities int16/uint16
- * 32-bit quantities int32/uint32
- * strings unsigned char*
- */
-
-#ifndef HAVE_INT8
-typedef signed char int8; /* NB: non-ANSI compilers may not grok */
-#endif
-typedef unsigned char uint8;
-#ifndef HAVE_INT16
-typedef short int16;
-#endif
-typedef unsigned short uint16; /* sizeof (uint16) must == 2 */
-#if SIZEOF_INT == 4
-#ifndef HAVE_INT32
-typedef int int32;
-#endif
-typedef unsigned int uint32; /* sizeof (uint32) must == 4 */
-#elif SIZEOF_LONG == 4
-#ifndef HAVE_INT32
-typedef long int32;
-#endif
-typedef unsigned long uint32; /* sizeof (uint32) must == 4 */
-#endif
-
-/* For TIFFReassignTagToIgnore */
-enum TIFFIgnoreSense /* IGNORE tag table */
-{
- TIS_STORE,
- TIS_EXTRACT,
- TIS_EMPTY
-};
-
-/*
- * TIFF header.
- */
-typedef struct {
- uint16 tiff_magic; /* magic number (defines byte order) */
-#define TIFF_MAGIC_SIZE 2
- uint16 tiff_version; /* TIFF version number */
-#define TIFF_VERSION_SIZE 2
- uint32 tiff_diroff; /* byte offset to first directory */
-#define TIFF_DIROFFSET_SIZE 4
-} TIFFHeader;
-
-
-/*
- * TIFF Image File Directories are comprised of a table of field
- * descriptors of the form shown below. The table is sorted in
- * ascending order by tag. The values associated with each entry are
- * disjoint and may appear anywhere in the file (so long as they are
- * placed on a word boundary).
- *
- * If the value is 4 bytes or less, then it is placed in the offset
- * field to save space. If the value is less than 4 bytes, it is
- * left-justified in the offset field.
- */
-typedef struct {
- uint16 tdir_tag; /* see below */
- uint16 tdir_type; /* data type; see below */
- uint32 tdir_count; /* number of items; length in spec */
- uint32 tdir_offset; /* byte offset to field data */
-} TIFFDirEntry;
-
-/*
- * NB: In the comments below,
- * - items marked with a + are obsoleted by revision 5.0,
- * - items marked with a ! are introduced in revision 6.0.
- * - items marked with a % are introduced post revision 6.0.
- * - items marked with a $ are obsoleted by revision 6.0.
- * - items marked with a & are introduced by Adobe DNG specification.
- */
-
-/*
- * Tag data type information.
- *
- * Note: RATIONALs are the ratio of two 32-bit integer values.
- */
-typedef enum {
- TIFF_NOTYPE = 0, /* placeholder */
- TIFF_BYTE = 1, /* 8-bit unsigned integer */
- TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */
- TIFF_SHORT = 3, /* 16-bit unsigned integer */
- TIFF_LONG = 4, /* 32-bit unsigned integer */
- TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */
- TIFF_SBYTE = 6, /* !8-bit signed integer */
- TIFF_UNDEFINED = 7, /* !8-bit untyped data */
- TIFF_SSHORT = 8, /* !16-bit signed integer */
- TIFF_SLONG = 9, /* !32-bit signed integer */
- TIFF_SRATIONAL = 10, /* !64-bit signed fraction */
- TIFF_FLOAT = 11, /* !32-bit IEEE floating point */
- TIFF_DOUBLE = 12, /* !64-bit IEEE floating point */
- TIFF_IFD = 13 /* %32-bit unsigned integer (offset) */
-} TIFFDataType;
-
-/*
- * TIFF Tag Definitions.
- */
-#define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */
-#define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */
-#define FILETYPE_PAGE 0x2 /* one page of many */
-#define FILETYPE_MASK 0x4 /* transparency mask */
-#define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */
-#define OFILETYPE_IMAGE 1 /* full resolution image data */
-#define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */
-#define OFILETYPE_PAGE 3 /* one page of many */
-#define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */
-#define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */
-#define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */
-#define TIFFTAG_COMPRESSION 259 /* data compression technique */
-#define COMPRESSION_NONE 1 /* dump mode */
-#define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */
-#define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */
-#define COMPRESSION_CCITT_T4 3 /* CCITT T.4 (TIFF 6 name) */
-#define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */
-#define COMPRESSION_CCITT_T6 4 /* CCITT T.6 (TIFF 6 name) */
-#define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */
-#define COMPRESSION_OJPEG 6 /* !6.0 JPEG */
-#define COMPRESSION_JPEG 7 /* %JPEG DCT compression */
-#define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */
-#define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */
-#define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */
-#define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */
-/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
-#define COMPRESSION_IT8CTPAD 32895 /* IT8 CT w/padding */
-#define COMPRESSION_IT8LW 32896 /* IT8 Linework RLE */
-#define COMPRESSION_IT8MP 32897 /* IT8 Monochrome picture */
-#define COMPRESSION_IT8BL 32898 /* IT8 Binary line art */
-/* compression codes 32908-32911 are reserved for Pixar */
-#define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */
-#define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */
-#define COMPRESSION_DEFLATE 32946 /* Deflate compression */
-#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression,
- as recognized by Adobe */
-/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
-#define COMPRESSION_DCS 32947 /* Kodak DCS encoding */
-#define COMPRESSION_JBIG 34661 /* ISO JBIG */
-#define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */
-#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
-#define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */
-#define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */
-#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */
-#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */
-#define PHOTOMETRIC_RGB 2 /* RGB color model */
-#define PHOTOMETRIC_PALETTE 3 /* color map indexed */
-#define PHOTOMETRIC_MASK 4 /* $holdout mask */
-#define PHOTOMETRIC_SEPARATED 5 /* !color separations */
-#define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */
-#define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */
-#define PHOTOMETRIC_ICCLAB 9 /* ICC L*a*b* [Adobe TIFF Technote 4] */
-#define PHOTOMETRIC_ITULAB 10 /* ITU L*a*b* */
-#define PHOTOMETRIC_LOGL 32844 /* CIE Log2(L) */
-#define PHOTOMETRIC_LOGLUV 32845 /* CIE Log2(L) (u',v') */
-#define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */
-#define THRESHHOLD_BILEVEL 1 /* b&w art scan */
-#define THRESHHOLD_HALFTONE 2 /* or dithered scan */
-#define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */
-#define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */
-#define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */
-#define TIFFTAG_FILLORDER 266 /* data order within a byte */
-#define FILLORDER_MSB2LSB 1 /* most significant -> least */
-#define FILLORDER_LSB2MSB 2 /* least significant -> most */
-#define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */
-#define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */
-#define TIFFTAG_MAKE 271 /* scanner manufacturer name */
-#define TIFFTAG_MODEL 272 /* scanner model name/number */
-#define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */
-#define TIFFTAG_ORIENTATION 274 /* +image orientation */
-#define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */
-#define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */
-#define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */
-#define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */
-#define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */
-#define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */
-#define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */
-#define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */
-#define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */
-#define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */
-#define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */
-#define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */
-#define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */
-#define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */
-#define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */
-#define TIFFTAG_PLANARCONFIG 284 /* storage organization */
-#define PLANARCONFIG_CONTIG 1 /* single image plane */
-#define PLANARCONFIG_SEPARATE 2 /* separate planes of data */
-#define TIFFTAG_PAGENAME 285 /* page name image is from */
-#define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */
-#define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */
-#define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */
-#define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */
-#define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */
-#define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */
-#define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */
-#define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */
-#define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */
-#define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */
-#define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */
-#define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */
-#define TIFFTAG_T4OPTIONS 292 /* TIFF 6.0 proper name alias */
-#define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */
-#define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */
-#define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */
-#define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */
-#define TIFFTAG_T6OPTIONS 293 /* TIFF 6.0 proper name */
-#define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */
-#define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */
-#define RESUNIT_NONE 1 /* no meaningful units */
-#define RESUNIT_INCH 2 /* english */
-#define RESUNIT_CENTIMETER 3 /* metric */
-#define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */
-#define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */
-#define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */
-#define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */
-#define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */
-#define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */
-#define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */
-#define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */
-#define TIFFTAG_SOFTWARE 305 /* name & release */
-#define TIFFTAG_DATETIME 306 /* creation date and time */
-#define TIFFTAG_ARTIST 315 /* creator of image */
-#define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */
-#define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */
-#define PREDICTOR_NONE 1 /* no prediction scheme used */
-#define PREDICTOR_HORIZONTAL 2 /* horizontal differencing */
-#define PREDICTOR_FLOATINGPOINT 3 /* floating point predictor */
-#define TIFFTAG_WHITEPOINT 318 /* image white point */
-#define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */
-#define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */
-#define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */
-#define TIFFTAG_TILEWIDTH 322 /* !tile width in pixels */
-#define TIFFTAG_TILELENGTH 323 /* !tile height in pixels */
-#define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */
-#define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */
-#define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */
-#define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */
-#define CLEANFAXDATA_CLEAN 0 /* no errors detected */
-#define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */
-#define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */
-#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
-#define TIFFTAG_SUBIFD 330 /* subimage descriptors */
-#define TIFFTAG_INKSET 332 /* !inks in separated image */
-#define INKSET_CMYK 1 /* !cyan-magenta-yellow-black color */
-#define INKSET_MULTIINK 2 /* !multi-ink or hi-fi color */
-#define TIFFTAG_INKNAMES 333 /* !ascii names of inks */
-#define TIFFTAG_NUMBEROFINKS 334 /* !number of inks */
-#define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */
-#define TIFFTAG_TARGETPRINTER 337 /* !separation target */
-#define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */
-#define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */
-#define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */
-#define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */
-#define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */
-#define SAMPLEFORMAT_UINT 1 /* !unsigned integer data */
-#define SAMPLEFORMAT_INT 2 /* !signed integer data */
-#define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */
-#define SAMPLEFORMAT_VOID 4 /* !untyped data */
-#define SAMPLEFORMAT_COMPLEXINT 5 /* !complex signed int */
-#define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */
-#define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */
-#define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */
-#define TIFFTAG_CLIPPATH 343 /* %ClipPath
- [Adobe TIFF technote 2] */
-#define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits
- [Adobe TIFF technote 2] */
-#define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits
- [Adobe TIFF technote 2] */
-#define TIFFTAG_INDEXED 346 /* %Indexed
- [Adobe TIFF Technote 3] */
-#define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */
-#define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */
-/*
- * Tags 512-521 are obsoleted by Technical Note #2 which specifies a
- * revised JPEG-in-TIFF scheme.
- */
-#define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */
-#define JPEGPROC_BASELINE 1 /* !baseline sequential */
-#define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */
-#define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */
-#define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */
-#define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */
-#define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */
-#define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */
-#define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */
-#define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */
-#define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */
-#define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */
-#define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */
-#define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */
-#define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */
-#define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */
-#define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */
-#define TIFFTAG_XMLPACKET 700 /* %XML packet
- [Adobe XMP Specification,
- January 2004 */
-#define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID
- [Adobe TIFF technote] */
-/* tags 32952-32956 are private tags registered to Island Graphics */
-#define TIFFTAG_REFPTS 32953 /* image reference points */
-#define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */
-#define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */
-#define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */
-/* tags 32995-32999 are private tags registered to SGI */
-#define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */
-#define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */
-#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
-#define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */
-/* tags 33300-33309 are private tags registered to Pixar */
-/*
- * TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH
- * are set when an image has been cropped out of a larger image.
- * They reflect the size of the original uncropped image.
- * The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used
- * to determine the position of the smaller image in the larger one.
- */
-#define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 /* full image size in x */
-#define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 /* full image size in y */
- /* Tags 33302-33306 are used to identify special image modes and data
- * used by Pixar's texture formats.
- */
-#define TIFFTAG_PIXAR_TEXTUREFORMAT 33302 /* texture map format */
-#define TIFFTAG_PIXAR_WRAPMODES 33303 /* s & t wrap modes */
-#define TIFFTAG_PIXAR_FOVCOT 33304 /* cotan(fov) for env. maps */
-#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305
-#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
-/* tag 33405 is a private tag registered to Eastman Kodak */
-#define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */
-/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
-#define TIFFTAG_COPYRIGHT 33432 /* copyright string */
-/* IPTC TAG from RichTIFF specifications */
-#define TIFFTAG_RICHTIFFIPTC 33723
-/* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
-#define TIFFTAG_IT8SITE 34016 /* site name */
-#define TIFFTAG_IT8COLORSEQUENCE 34017 /* color seq. [RGB,CMYK,etc] */
-#define TIFFTAG_IT8HEADER 34018 /* DDES Header */
-#define TIFFTAG_IT8RASTERPADDING 34019 /* raster scanline padding */
-#define TIFFTAG_IT8BITSPERRUNLENGTH 34020 /* # of bits in short run */
-#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */
-#define TIFFTAG_IT8COLORTABLE 34022 /* LW colortable */
-#define TIFFTAG_IT8IMAGECOLORINDICATOR 34023 /* BP/BL image color switch */
-#define TIFFTAG_IT8BKGCOLORINDICATOR 34024 /* BP/BL bg color switch */
-#define TIFFTAG_IT8IMAGECOLORVALUE 34025 /* BP/BL image color value */
-#define TIFFTAG_IT8BKGCOLORVALUE 34026 /* BP/BL bg color value */
-#define TIFFTAG_IT8PIXELINTENSITYRANGE 34027 /* MP pixel intensity value */
-#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */
-#define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */
-#define TIFFTAG_IT8HCUSAGE 34030 /* HC usage indicator */
-#define TIFFTAG_IT8TRAPINDICATOR 34031 /* Trapping indicator
- (untrapped=0, trapped=1) */
-#define TIFFTAG_IT8CMYKEQUIVALENT 34032 /* CMYK color equivalents */
-/* tags 34232-34236 are private tags registered to Texas Instruments */
-#define TIFFTAG_FRAMECOUNT 34232 /* Sequence Frame Count */
-/* tag 34377 is private tag registered to Adobe for PhotoShop */
-#define TIFFTAG_PHOTOSHOP 34377
-/* tags 34665, 34853 and 40965 are documented in EXIF specification */
-#define TIFFTAG_EXIFIFD 34665 /* Pointer to EXIF private directory */
-/* tag 34750 is a private tag registered to Adobe? */
-#define TIFFTAG_ICCPROFILE 34675 /* ICC profile data */
-/* tag 34750 is a private tag registered to Pixel Magic */
-#define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */
-#define TIFFTAG_GPSIFD 34853 /* Pointer to GPS private directory */
-/* tags 34908-34914 are private tags registered to SGI */
-#define TIFFTAG_FAXRECVPARAMS 34908 /* encoded Class 2 ses. parms */
-#define TIFFTAG_FAXSUBADDRESS 34909 /* received SubAddr string */
-#define TIFFTAG_FAXRECVTIME 34910 /* receive time (secs) */
-#define TIFFTAG_FAXDCS 34911 /* encoded fax ses. params, Table 2/T.30 */
-/* tags 37439-37443 are registered to SGI <gregl@sgi.com> */
-#define TIFFTAG_STONITS 37439 /* Sample value to Nits */
-/* tag 34929 is a private tag registered to FedEx */
-#define TIFFTAG_FEDEX_EDR 34929 /* unknown use */
-#define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */
-/* Adobe Digital Negative (DNG) format tags */
-#define TIFFTAG_DNGVERSION 50706 /* &DNG version number */
-#define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */
-#define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */
-#define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model
- name */
-#define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space
- mapping */
-#define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */
-#define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */
-#define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for
- the BlackLevel tag */
-#define TIFFTAG_BLACKLEVEL 50714 /* &zero light encoding level */
-#define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level
- differences (columns) */
-#define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level
- differences (rows) */
-#define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding
- level */
-#define TIFFTAG_DEFAULTSCALE 50718 /* &default scale factors */
-#define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image
- area */
-#define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image
- area */
-#define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space
- transformation matrix 1 */
-#define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space
- transformation matrix 2 */
-#define TIFFTAG_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */
-#define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */
-#define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction
- matrix 1 */
-#define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction
- matrix 2 */
-#define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw
- values*/
-#define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in
- linear reference space */
-#define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in
- x-y chromaticity
- coordinates */
-#define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero
- point */
-#define TIFFTAG_BASELINENOISE 50731 /* &relative noise level */
-#define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of
- sharpening */
-#define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of
- the green pixels in the
- blue/green rows track the
- values of the green pixels
- in the red/green rows */
-#define TIFFTAG_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */
-#define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */
-#define TIFFTAG_LENSINFO 50736 /* info about the lens */
-#define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */
-#define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the
- camera's anti-alias filter */
-#define TIFFTAG_SHADOWSCALE 50739 /* &used by Adobe Camera Raw */
-#define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */
-#define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote
- tag is safe to preserve
- along with the rest of the
- EXIF data */
-#define TIFFTAG_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */
-#define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */
-#define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */
-#define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for
- the raw image data */
-#define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original
- raw file */
-#define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original
- raw file */
-#define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels
- of the sensor */
-#define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates
- of fully masked pixels */
-#define TIFFTAG_ASSHOTICCPROFILE 50831 /* &these two tags used to */
-#define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832 /* map cameras's color space
- into ICC profile space */
-#define TIFFTAG_CURRENTICCPROFILE 50833 /* & */
-#define TIFFTAG_CURRENTPREPROFILEMATRIX 50834 /* & */
-/* tag 65535 is an undefined tag used by Eastman Kodak */
-#define TIFFTAG_DCSHUESHIFTVALUES 65535 /* hue shift correction data */
-
-/*
- * The following are ``pseudo tags'' that can be used to control
- * codec-specific functionality. These tags are not written to file.
- * Note that these values start at 0xffff+1 so that they'll never
- * collide with Aldus-assigned tags.
- *
- * If you want your private pseudo tags ``registered'' (i.e. added to
- * this file), please post a bug report via the tracking system at
- * http://www.remotesensing.org/libtiff/bugs.html with the appropriate
- * C definitions to add.
- */
-#define TIFFTAG_FAXMODE 65536 /* Group 3/4 format control */
-#define FAXMODE_CLASSIC 0x0000 /* default, include RTC */
-#define FAXMODE_NORTC 0x0001 /* no RTC at end of data */
-#define FAXMODE_NOEOL 0x0002 /* no EOL code at end of row */
-#define FAXMODE_BYTEALIGN 0x0004 /* byte align row */
-#define FAXMODE_WORDALIGN 0x0008 /* word align row */
-#define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */
-#define TIFFTAG_JPEGQUALITY 65537 /* Compression quality level */
-/* Note: quality level is on the IJG 0-100 scale. Default value is 75 */
-#define TIFFTAG_JPEGCOLORMODE 65538 /* Auto RGB<=>YCbCr convert? */
-#define JPEGCOLORMODE_RAW 0x0000 /* no conversion (default) */
-#define JPEGCOLORMODE_RGB 0x0001 /* do auto conversion */
-#define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */
-#define JPEGTABLESMODE_QUANT 0x0001 /* include quantization tbls */
-#define JPEGTABLESMODE_HUFF 0x0002 /* include Huffman tbls */
-/* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */
-#define TIFFTAG_FAXFILLFUNC 65540 /* G3/G4 fill function */
-#define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */
-#define PIXARLOGDATAFMT_8BIT 0 /* regular u_char samples */
-#define PIXARLOGDATAFMT_8BITABGR 1 /* ABGR-order u_chars */
-#define PIXARLOGDATAFMT_11BITLOG 2 /* 11-bit log-encoded (raw) */
-#define PIXARLOGDATAFMT_12BITPICIO 3 /* as per PICIO (1.0==2048) */
-#define PIXARLOGDATAFMT_16BIT 4 /* signed short samples */
-#define PIXARLOGDATAFMT_FLOAT 5 /* IEEE float samples */
-/* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */
-#define TIFFTAG_DCSIMAGERTYPE 65550 /* imager model & filter */
-#define DCSIMAGERMODEL_M3 0 /* M3 chip (1280 x 1024) */
-#define DCSIMAGERMODEL_M5 1 /* M5 chip (1536 x 1024) */
-#define DCSIMAGERMODEL_M6 2 /* M6 chip (3072 x 2048) */
-#define DCSIMAGERFILTER_IR 0 /* infrared filter */
-#define DCSIMAGERFILTER_MONO 1 /* monochrome filter */
-#define DCSIMAGERFILTER_CFA 2 /* color filter array */
-#define DCSIMAGERFILTER_OTHER 3 /* other filter */
-#define TIFFTAG_DCSINTERPMODE 65551 /* interpolation mode */
-#define DCSINTERPMODE_NORMAL 0x0 /* whole image, default */
-#define DCSINTERPMODE_PREVIEW 0x1 /* preview of image (384x256) */
-#define TIFFTAG_DCSBALANCEARRAY 65552 /* color balance values */
-#define TIFFTAG_DCSCORRECTMATRIX 65553 /* color correction values */
-#define TIFFTAG_DCSGAMMA 65554 /* gamma value */
-#define TIFFTAG_DCSTOESHOULDERPTS 65555 /* toe & shoulder points */
-#define TIFFTAG_DCSCALIBRATIONFD 65556 /* calibration file desc */
-/* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */
-#define TIFFTAG_ZIPQUALITY 65557 /* compression quality level */
-#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */
-/* 65559 is allocated to Oceana Matrix <dev@oceana.com> */
-#define TIFFTAG_DCSCLIPRECTANGLE 65559 /* area of image to acquire */
-#define TIFFTAG_SGILOGDATAFMT 65560 /* SGILog user data format */
-#define SGILOGDATAFMT_FLOAT 0 /* IEEE float samples */
-#define SGILOGDATAFMT_16BIT 1 /* 16-bit samples */
-#define SGILOGDATAFMT_RAW 2 /* uninterpreted data */
-#define SGILOGDATAFMT_8BIT 3 /* 8-bit RGB monitor values */
-#define TIFFTAG_SGILOGENCODE 65561 /* SGILog data encoding control*/
-#define SGILOGENCODE_NODITHER 0 /* do not dither encoded values*/
-#define SGILOGENCODE_RANDITHER 1 /* randomly dither encd values */
-
-/*
- * EXIF tags
- */
-#define EXIFTAG_EXPOSURETIME 33434 /* Exposure time */
-#define EXIFTAG_FNUMBER 33437 /* F number */
-#define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */
-#define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */
-#define EXIFTAG_ISOSPEEDRATINGS 34855 /* ISO speed rating */
-#define EXIFTAG_OECF 34856 /* Optoelectric conversion
- factor */
-#define EXIFTAG_EXIFVERSION 36864 /* Exif version */
-#define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original
- data generation */
-#define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital
- data generation */
-#define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */
-#define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */
-#define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */
-#define EXIFTAG_APERTUREVALUE 37378 /* Aperture */
-#define EXIFTAG_BRIGHTNESSVALUE 37379 /* Brightness */
-#define EXIFTAG_EXPOSUREBIASVALUE 37380 /* Exposure bias */
-#define EXIFTAG_MAXAPERTUREVALUE 37381 /* Maximum lens aperture */
-#define EXIFTAG_SUBJECTDISTANCE 37382 /* Subject distance */
-#define EXIFTAG_METERINGMODE 37383 /* Metering mode */
-#define EXIFTAG_LIGHTSOURCE 37384 /* Light source */
-#define EXIFTAG_FLASH 37385 /* Flash */
-#define EXIFTAG_FOCALLENGTH 37386 /* Lens focal length */
-#define EXIFTAG_SUBJECTAREA 37396 /* Subject area */
-#define EXIFTAG_MAKERNOTE 37500 /* Manufacturer notes */
-#define EXIFTAG_USERCOMMENT 37510 /* User comments */
-#define EXIFTAG_SUBSECTIME 37520 /* DateTime subseconds */
-#define EXIFTAG_SUBSECTIMEORIGINAL 37521 /* DateTimeOriginal subseconds */
-#define EXIFTAG_SUBSECTIMEDIGITIZED 37522 /* DateTimeDigitized subseconds */
-#define EXIFTAG_FLASHPIXVERSION 40960 /* Supported Flashpix version */
-#define EXIFTAG_COLORSPACE 40961 /* Color space information */
-#define EXIFTAG_PIXELXDIMENSION 40962 /* Valid image width */
-#define EXIFTAG_PIXELYDIMENSION 40963 /* Valid image height */
-#define EXIFTAG_RELATEDSOUNDFILE 40964 /* Related audio file */
-#define EXIFTAG_FLASHENERGY 41483 /* Flash energy */
-#define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484 /* Spatial frequency response */
-#define EXIFTAG_FOCALPLANEXRESOLUTION 41486 /* Focal plane X resolution */
-#define EXIFTAG_FOCALPLANEYRESOLUTION 41487 /* Focal plane Y resolution */
-#define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488 /* Focal plane resolution unit */
-#define EXIFTAG_SUBJECTLOCATION 41492 /* Subject location */
-#define EXIFTAG_EXPOSUREINDEX 41493 /* Exposure index */
-#define EXIFTAG_SENSINGMETHOD 41495 /* Sensing method */
-#define EXIFTAG_FILESOURCE 41728 /* File source */
-#define EXIFTAG_SCENETYPE 41729 /* Scene type */
-#define EXIFTAG_CFAPATTERN 41730 /* CFA pattern */
-#define EXIFTAG_CUSTOMRENDERED 41985 /* Custom image processing */
-#define EXIFTAG_EXPOSUREMODE 41986 /* Exposure mode */
-#define EXIFTAG_WHITEBALANCE 41987 /* White balance */
-#define EXIFTAG_DIGITALZOOMRATIO 41988 /* Digital zoom ratio */
-#define EXIFTAG_FOCALLENGTHIN35MMFILM 41989 /* Focal length in 35 mm film */
-#define EXIFTAG_SCENECAPTURETYPE 41990 /* Scene capture type */
-#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
-#define EXIFTAG_CONTRAST 41992 /* Contrast */
-#define EXIFTAG_SATURATION 41993 /* Saturation */
-#define EXIFTAG_SHARPNESS 41994 /* Sharpness */
-#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995 /* Device settings description */
-#define EXIFTAG_SUBJECTDISTANCERANGE 41996 /* Subject distance range */
-#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
-#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
-#define EXIFTAG_IMAGEUNIQUEID 42016 /* Unique image ID */
-
-#endif /* _TIFF_ */
-
-/* vim: set ts=8 sts=8 sw=8 noet: */
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiffconf.h b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiffconf.h
deleted file mode 100644
index bf889386..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiffconf.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* libtiff/tiffconf.h. Generated by configure. */
-/*
- Configuration defines for installed libtiff.
- This file maintained for backward compatibility. Do not use definitions
- from this file in your programs.
-*/
-
-#ifndef _TIFFCONF_
-#define _TIFFCONF_
-
-/* Define to 1 if the system has the type `int16'. */
-/* #undef HAVE_INT16 */
-
-/* Define to 1 if the system has the type `int32'. */
-/* #undef HAVE_INT32 */
-
-/* Define to 1 if the system has the type `int8'. */
-/* #undef HAVE_INT8 */
-
-/* The size of a `int', as computed by sizeof. */
-#define SIZEOF_INT 4
-
-/* The size of a `long', as computed by sizeof. */
-#define SIZEOF_LONG 4
-
-/* Compatibility stuff. */
-
-/* Define as 0 or 1 according to the floating point format suported by the
- machine */
-#define HAVE_IEEEFP 1
-
-/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
-#define HOST_FILLORDER FILLORDER_LSB2MSB
-
-/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
- (Intel) */
-#define HOST_BIGENDIAN 0
-
-/* Support CCITT Group 3 & 4 algorithms */
-#define CCITT_SUPPORT 1
-
-/* Support JPEG compression (requires IJG JPEG library) */
-#define JPEG_SUPPORT 1
-
-/* Support LogLuv high dynamic range encoding */
-#define LOGLUV_SUPPORT 1
-
-/* Support LZW algorithm */
-#define LZW_SUPPORT 1
-
-/* Support NeXT 2-bit RLE algorithm */
-#define NEXT_SUPPORT 1
-
-/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
- fails with unpatched IJG JPEG library) */
-/* #undef OJPEG_SUPPORT */
-
-/* Support Macintosh PackBits algorithm */
-#define PACKBITS_SUPPORT 1
-
-/* Support Pixar log-format algorithm (requires Zlib) */
-#define PIXARLOG_SUPPORT 1
-
-/* Support ThunderScan 4-bit RLE algorithm */
-#define THUNDER_SUPPORT 1
-
-/* Support Deflate compression */
-#define ZIP_SUPPORT 1
-
-/* Support strip chopping (whether or not to convert single-strip uncompressed
- images to mutiple strips of ~8Kb to reduce memory usage) */
-#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
-
-/* Enable SubIFD tag (330) support */
-#define SUBIFD_SUPPORT 1
-
-/* Treat extra sample as alpha (default enabled). The RGBA interface will
- treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
- packages produce RGBA files but don't mark the alpha properly. */
-#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1
-
-/* Pick up YCbCr subsampling info from the JPEG data stream to support files
- lacking the tag (default enabled). */
-#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
-
-/* Support MS MDI magic number files as TIFF */
-#define MDI_SUPPORT 1
-
-/*
- * Feature support definitions.
- * XXX: These macros are obsoleted. Don't use them in your apps!
- * Macros stays here for backward compatibility and should be always defined.
- */
-#define COLORIMETRY_SUPPORT
-#define YCBCR_SUPPORT
-#define CMYK_SUPPORT
-#define ICC_SUPPORT
-#define PHOTOSHOP_SUPPORT
-#define IPTC_SUPPORT
-
-#endif /* _TIFFCONF_ */
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiffio.h b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiffio.h
deleted file mode 100644
index 52654b59..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiffio.h
+++ /dev/null
@@ -1,549 +0,0 @@
-/* $Id: tiffio.h,v 1.50 2006/03/21 16:37:51 dron Exp $ */
-
-/*
- * Copyright (c) 1988-1997 Sam Leffler
- * Copyright (c) 1991-1997 Silicon Graphics, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that (i) the above copyright notices and this permission notice appear in
- * all copies of the software and related documentation, and (ii) the names of
- * Sam Leffler and Silicon Graphics may not be used in any advertising or
- * publicity relating to the software without the specific, prior written
- * permission of Sam Leffler and Silicon Graphics.
- *
- * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- *
- * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
- * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
- * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
- * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#ifndef _TIFFIO_
-#define _TIFFIO_
-
-#ifndef __GNUC__
-# define __DLL_IMPORT__ __declspec(dllimport)
-# define __DLL_EXPORT__ __declspec(dllexport)
-#else
-# define __DLL_IMPORT__ __attribute__((dllimport)) extern
-# define __DLL_EXPORT__ __attribute__((dllexport)) extern
-#endif
-
-#if (defined __WIN32__) || (defined _WIN32)
-# ifdef BUILD_LIBTIFF_DLL
-# define LIBTIFF_DLL_IMPEXP __DLL_EXPORT__
-# elif defined(LIBTIFF_STATIC)
-# define LIBTIFF_DLL_IMPEXP
-# elif defined (USE_LIBTIFF_DLL)
-# define LIBTIFF_DLL_IMPEXP __DLL_IMPORT__
-# elif defined (USE_LIBTIFF_STATIC)
-# define LIBTIFF_DLL_IMPEXP
-# else /* assume USE_LIBTIFF_DLL */
-# define LIBTIFF_DLL_IMPEXP __DLL_IMPORT__
-# endif
-#else /* __WIN32__ */
-# define LIBTIFF_DLL_IMPEXP
-#endif
-
-/*
- * TIFF I/O Library Definitions.
- */
-#include "tiff.h"
-#include "tiffvers.h"
-
-/*
- * TIFF is defined as an incomplete type to hide the
- * library's internal data structures from clients.
- */
-typedef struct tiff TIFF;
-
-/*
- * The following typedefs define the intrinsic size of
- * data types used in the *exported* interfaces. These
- * definitions depend on the proper definition of types
- * in tiff.h. Note also that the varargs interface used
- * to pass tag types and values uses the types defined in
- * tiff.h directly.
- *
- * NB: ttag_t is unsigned int and not unsigned short because
- * ANSI C requires that the type before the ellipsis be a
- * promoted type (i.e. one of int, unsigned int, pointer,
- * or double) and because we defined pseudo-tags that are
- * outside the range of legal Aldus-assigned tags.
- * NB: tsize_t is int32 and not uint32 because some functions
- * return -1.
- * NB: toff_t is not off_t for many reasons; TIFFs max out at
- * 32-bit file offsets being the most important, and to ensure
- * that it is unsigned, rather than signed.
- */
-typedef uint32 ttag_t; /* directory tag */
-typedef uint16 tdir_t; /* directory index */
-typedef uint16 tsample_t; /* sample number */
-typedef uint32 tstrip_t; /* strip number */
-typedef uint32 ttile_t; /* tile number */
-typedef int32 tsize_t; /* i/o size in bytes */
-typedef void* tdata_t; /* image data ref */
-typedef uint32 toff_t; /* file offset */
-
-#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
-#define __WIN32__
-#endif
-
-/*
- * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c
- * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).
- *
- * By default tif_unix.c is assumed.
- */
-
-#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
-# define BINMODE "b"
-# if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
-# define AVOID_WIN32_FILEIO
-# endif
-# include <fcntl.h>
-# include <io.h>
-# ifdef SET_BINARY
-# undef SET_BINARY
-# endif /* SET_BINARY */
-# define SET_BINARY(f) do {if (!_isatty(f)) _setmode(f,_O_BINARY);} while (0)
-#else /* Windows */
-# define BINMODE
-# define SET_BINARY(f) (void)0
-#endif /* Windows */
-
-#if defined(USE_WIN32_FILEIO)
-# define VC_EXTRALEAN
-# include <windows.h>
-# ifdef __WIN32__
-DECLARE_HANDLE(thandle_t); /* Win32 file handle */
-# else
-typedef HFILE thandle_t; /* client data handle */
-# endif /* __WIN32__ */
-#else
-typedef void* thandle_t; /* client data handle */
-#endif /* USE_WIN32_FILEIO */
-
-#ifndef NULL
-# define NULL (void *)0
-#endif
-
-/*
- * Flags to pass to TIFFPrintDirectory to control
- * printing of data structures that are potentially
- * very large. Bit-or these flags to enable printing
- * multiple items.
- */
-#define TIFFPRINT_NONE 0x0 /* no extra info */
-#define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */
-#define TIFFPRINT_CURVES 0x2 /* color/gray response curves */
-#define TIFFPRINT_COLORMAP 0x4 /* colormap */
-#define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */
-#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */
-#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */
-
-/*
- * Colour conversion stuff
- */
-
-/* reference white */
-#define D65_X0 (95.0470F)
-#define D65_Y0 (100.0F)
-#define D65_Z0 (108.8827F)
-
-#define D50_X0 (96.4250F)
-#define D50_Y0 (100.0F)
-#define D50_Z0 (82.4680F)
-
-/* Structure for holding information about a display device. */
-
-typedef unsigned char TIFFRGBValue; /* 8-bit samples */
-
-typedef struct {
- float d_mat[3][3]; /* XYZ -> luminance matrix */
- float d_YCR; /* Light o/p for reference white */
- float d_YCG;
- float d_YCB;
- uint32 d_Vrwr; /* Pixel values for ref. white */
- uint32 d_Vrwg;
- uint32 d_Vrwb;
- float d_Y0R; /* Residual light for black pixel */
- float d_Y0G;
- float d_Y0B;
- float d_gammaR; /* Gamma values for the three guns */
- float d_gammaG;
- float d_gammaB;
-} TIFFDisplay;
-
-typedef struct { /* YCbCr->RGB support */
- TIFFRGBValue* clamptab; /* range clamping table */
- int* Cr_r_tab;
- int* Cb_b_tab;
- int32* Cr_g_tab;
- int32* Cb_g_tab;
- int32* Y_tab;
-} TIFFYCbCrToRGB;
-
-typedef struct { /* CIE Lab 1976->RGB support */
- int range; /* Size of conversion table */
-#define CIELABTORGB_TABLE_RANGE 1500
- float rstep, gstep, bstep;
- float X0, Y0, Z0; /* Reference white point */
- TIFFDisplay display;
- float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */
- float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */
- float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */
-} TIFFCIELabToRGB;
-
-/*
- * RGBA-style image support.
- */
-typedef struct _TIFFRGBAImage TIFFRGBAImage;
-/*
- * The image reading and conversion routines invoke
- * ``put routines'' to copy/image/whatever tiles of
- * raw image data. A default set of routines are
- * provided to convert/copy raw image data to 8-bit
- * packed ABGR format rasters. Applications can supply
- * alternate routines that unpack the data into a
- * different format or, for example, unpack the data
- * and draw the unpacked raster on the display.
- */
-typedef void (*tileContigRoutine)
- (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
- unsigned char*);
-typedef void (*tileSeparateRoutine)
- (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
- unsigned char*, unsigned char*, unsigned char*, unsigned char*);
-/*
- * RGBA-reader state.
- */
-struct _TIFFRGBAImage {
- TIFF* tif; /* image handle */
- int stoponerr; /* stop on read error */
- int isContig; /* data is packed/separate */
- int alpha; /* type of alpha data present */
- uint32 width; /* image width */
- uint32 height; /* image height */
- uint16 bitspersample; /* image bits/sample */
- uint16 samplesperpixel; /* image samples/pixel */
- uint16 orientation; /* image orientation */
- uint16 req_orientation; /* requested orientation */
- uint16 photometric; /* image photometric interp */
- uint16* redcmap; /* colormap pallete */
- uint16* greencmap;
- uint16* bluecmap;
- /* get image data routine */
- int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
- union {
- void (*any)(TIFFRGBAImage*);
- tileContigRoutine contig;
- tileSeparateRoutine separate;
- } put; /* put decoded strip/tile */
- TIFFRGBValue* Map; /* sample mapping array */
- uint32** BWmap; /* black&white map */
- uint32** PALmap; /* palette image map */
- TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
- TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
-
- int row_offset;
- int col_offset;
-};
-
-/*
- * Macros for extracting components from the
- * packed ABGR form returned by TIFFReadRGBAImage.
- */
-#define TIFFGetR(abgr) ((abgr) & 0xff)
-#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)
-#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)
-#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)
-
-/*
- * A CODEC is a software package that implements decoding,
- * encoding, or decoding+encoding of a compression algorithm.
- * The library provides a collection of builtin codecs.
- * More codecs may be registered through calls to the library
- * and/or the builtin implementations may be overridden.
- */
-typedef int (*TIFFInitMethod)(TIFF*, int);
-typedef struct {
- char* name;
- uint16 scheme;
- TIFFInitMethod init;
-} TIFFCodec;
-
-#include <stdio.h>
-#include <stdarg.h>
-
-/* share internal LogLuv conversion routines? */
-#ifndef LOGLUV_PUBLIC
-#define LOGLUV_PUBLIC 1
-#endif
-
-#if defined(c_plusplus) || defined(__cplusplus)
-extern "C" {
-#endif
-typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
-typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
-typedef tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
-typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
-typedef int (*TIFFCloseProc)(thandle_t);
-typedef toff_t (*TIFFSizeProc)(thandle_t);
-typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);
-typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);
-typedef void (*TIFFExtendProc)(TIFF*);
-
-LIBTIFF_DLL_IMPEXP const char* TIFFGetVersion(void);
-
-LIBTIFF_DLL_IMPEXP const TIFFCodec* TIFFFindCODEC(uint16);
-LIBTIFF_DLL_IMPEXP TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
-LIBTIFF_DLL_IMPEXP void TIFFUnRegisterCODEC(TIFFCodec*);
-LIBTIFF_DLL_IMPEXP int TIFFIsCODECConfigured(uint16);
-LIBTIFF_DLL_IMPEXP TIFFCodec* TIFFGetConfiguredCODECs(void);
-
-/*
- * Auxiliary functions.
- */
-
-LIBTIFF_DLL_IMPEXP tdata_t _TIFFmalloc(tsize_t);
-LIBTIFF_DLL_IMPEXP tdata_t _TIFFrealloc(tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP void _TIFFmemset(tdata_t, int, tsize_t);
-LIBTIFF_DLL_IMPEXP void _TIFFmemcpy(tdata_t, const tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP int _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP void _TIFFfree(tdata_t);
-
-/*
-** Stuff, related to tag handling and creating custom tags.
-*/
-LIBTIFF_DLL_IMPEXP int TIFFGetTagListCount( TIFF * );
-LIBTIFF_DLL_IMPEXP ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );
-
-#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
-#define TIFF_VARIABLE -1 /* marker for variable length tags */
-#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */
-#define TIFF_VARIABLE2 -3 /* marker for uint32 var-length tags */
-
-#define FIELD_CUSTOM 65
-
-typedef struct {
- ttag_t field_tag; /* field's tag */
- short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
- short field_writecount; /* write count/TIFF_VARIABLE */
- TIFFDataType field_type; /* type of associated data */
- unsigned short field_bit; /* bit in fieldsset bit vector */
- unsigned char field_oktochange; /* if true, can change while writing */
- unsigned char field_passcount; /* if true, pass dir count on set */
- char *field_name; /* ASCII name */
-} TIFFFieldInfo;
-
-typedef struct _TIFFTagValue {
- const TIFFFieldInfo *info;
- int count;
- void *value;
-} TIFFTagValue;
-
-LIBTIFF_DLL_IMPEXP void TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
-LIBTIFF_DLL_IMPEXP const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);
-LIBTIFF_DLL_IMPEXP const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *,
- TIFFDataType);
-LIBTIFF_DLL_IMPEXP const TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);
-LIBTIFF_DLL_IMPEXP const TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *);
-
-typedef int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
-typedef int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
-typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
-
-typedef struct {
- TIFFVSetMethod vsetfield; /* tag set routine */
- TIFFVGetMethod vgetfield; /* tag get routine */
- TIFFPrintMethod printdir; /* directory print routine */
-} TIFFTagMethods;
-
-LIBTIFF_DLL_IMPEXP TIFFTagMethods *TIFFAccessTagMethods( TIFF * );
-LIBTIFF_DLL_IMPEXP void *TIFFGetClientInfo( TIFF *, const char * );
-LIBTIFF_DLL_IMPEXP void TIFFSetClientInfo( TIFF *, void *, const char * );
-
-LIBTIFF_DLL_IMPEXP void TIFFCleanup(TIFF*);
-LIBTIFF_DLL_IMPEXP void TIFFClose(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFFlush(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFFlushData(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFGetField(TIFF*, ttag_t, ...);
-LIBTIFF_DLL_IMPEXP int TIFFVGetField(TIFF*, ttag_t, va_list);
-LIBTIFF_DLL_IMPEXP int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...);
-LIBTIFF_DLL_IMPEXP int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list);
-LIBTIFF_DLL_IMPEXP int TIFFReadDirectory(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFReadCustomDirectory(TIFF*, toff_t, const TIFFFieldInfo[],
- size_t);
-LIBTIFF_DLL_IMPEXP int TIFFReadEXIFDirectory(TIFF*, toff_t);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFScanlineSize(TIFF*);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFRasterScanlineSize(TIFF*);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFStripSize(TIFF*);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFRawStripSize(TIFF*, tstrip_t);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFVStripSize(TIFF*, uint32);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFTileRowSize(TIFF*);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFTileSize(TIFF*);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFVTileSize(TIFF*, uint32);
-LIBTIFF_DLL_IMPEXP uint32 TIFFDefaultStripSize(TIFF*, uint32);
-LIBTIFF_DLL_IMPEXP void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
-LIBTIFF_DLL_IMPEXP int TIFFFileno(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFSetFileno(TIFF*, int);
-LIBTIFF_DLL_IMPEXP thandle_t TIFFClientdata(TIFF*);
-LIBTIFF_DLL_IMPEXP thandle_t TIFFSetClientdata(TIFF*, thandle_t);
-LIBTIFF_DLL_IMPEXP int TIFFGetMode(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFSetMode(TIFF*, int);
-LIBTIFF_DLL_IMPEXP int TIFFIsTiled(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFIsByteSwapped(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFIsUpSampled(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFIsMSB2LSB(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFIsBigEndian(TIFF*);
-LIBTIFF_DLL_IMPEXP TIFFReadWriteProc TIFFGetReadProc(TIFF*);
-LIBTIFF_DLL_IMPEXP TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
-LIBTIFF_DLL_IMPEXP TIFFSeekProc TIFFGetSeekProc(TIFF*);
-LIBTIFF_DLL_IMPEXP TIFFCloseProc TIFFGetCloseProc(TIFF*);
-LIBTIFF_DLL_IMPEXP TIFFSizeProc TIFFGetSizeProc(TIFF*);
-LIBTIFF_DLL_IMPEXP TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
-LIBTIFF_DLL_IMPEXP TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
-LIBTIFF_DLL_IMPEXP uint32 TIFFCurrentRow(TIFF*);
-LIBTIFF_DLL_IMPEXP tdir_t TIFFCurrentDirectory(TIFF*);
-LIBTIFF_DLL_IMPEXP tdir_t TIFFNumberOfDirectories(TIFF*);
-LIBTIFF_DLL_IMPEXP uint32 TIFFCurrentDirOffset(TIFF*);
-LIBTIFF_DLL_IMPEXP tstrip_t TIFFCurrentStrip(TIFF*);
-LIBTIFF_DLL_IMPEXP ttile_t TIFFCurrentTile(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP int TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP int TIFFSetupStrips(TIFF *);
-LIBTIFF_DLL_IMPEXP int TIFFWriteCheck(TIFF*, int, const char *);
-LIBTIFF_DLL_IMPEXP void TIFFFreeDirectory(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFCreateDirectory(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFLastDirectory(TIFF*);
-LIBTIFF_DLL_IMPEXP int TIFFSetDirectory(TIFF*, tdir_t);
-LIBTIFF_DLL_IMPEXP int TIFFSetSubDirectory(TIFF*, uint32);
-LIBTIFF_DLL_IMPEXP int TIFFUnlinkDirectory(TIFF*, tdir_t);
-LIBTIFF_DLL_IMPEXP int TIFFSetField(TIFF*, ttag_t, ...);
-LIBTIFF_DLL_IMPEXP int TIFFVSetField(TIFF*, ttag_t, va_list);
-LIBTIFF_DLL_IMPEXP int TIFFWriteDirectory(TIFF *);
-LIBTIFF_DLL_IMPEXP int TIFFCheckpointDirectory(TIFF *);
-LIBTIFF_DLL_IMPEXP int TIFFRewriteDirectory(TIFF *);
-LIBTIFF_DLL_IMPEXP int TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int);
-
-#if defined(c_plusplus) || defined(__cplusplus)
-LIBTIFF_DLL_IMPEXP void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
-LIBTIFF_DLL_IMPEXP int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
-LIBTIFF_DLL_IMPEXP int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
-LIBTIFF_DLL_IMPEXP int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
-LIBTIFF_DLL_IMPEXP int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
- int = ORIENTATION_BOTLEFT, int = 0);
-#else
-LIBTIFF_DLL_IMPEXP void TIFFPrintDirectory(TIFF*, FILE*, long);
-LIBTIFF_DLL_IMPEXP int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);
-LIBTIFF_DLL_IMPEXP int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);
-LIBTIFF_DLL_IMPEXP int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
-LIBTIFF_DLL_IMPEXP int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
-#endif
-
-LIBTIFF_DLL_IMPEXP int TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );
-LIBTIFF_DLL_IMPEXP int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
-LIBTIFF_DLL_IMPEXP int TIFFRGBAImageOK(TIFF*, char [1024]);
-LIBTIFF_DLL_IMPEXP int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
-LIBTIFF_DLL_IMPEXP int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
-LIBTIFF_DLL_IMPEXP void TIFFRGBAImageEnd(TIFFRGBAImage*);
-LIBTIFF_DLL_IMPEXP TIFF* TIFFOpen(const char*, const char*);
-# ifdef __WIN32__
-LIBTIFF_DLL_IMPEXP TIFF* TIFFOpenW(const wchar_t*, const char*);
-# endif /* __WIN32__ */
-LIBTIFF_DLL_IMPEXP TIFF* TIFFFdOpen(int, const char*, const char*);
-LIBTIFF_DLL_IMPEXP TIFF* TIFFClientOpen(const char*, const char*,
- thandle_t,
- TIFFReadWriteProc, TIFFReadWriteProc,
- TIFFSeekProc, TIFFCloseProc,
- TIFFSizeProc,
- TIFFMapFileProc, TIFFUnmapFileProc);
-LIBTIFF_DLL_IMPEXP const char* TIFFFileName(TIFF*);
-LIBTIFF_DLL_IMPEXP const char* TIFFSetFileName(TIFF*, const char *);
-LIBTIFF_DLL_IMPEXP void TIFFError(const char*, const char*, ...);
-LIBTIFF_DLL_IMPEXP void TIFFErrorExt(thandle_t, const char*, const char*, ...);
-LIBTIFF_DLL_IMPEXP void TIFFWarning(const char*, const char*, ...);
-LIBTIFF_DLL_IMPEXP void TIFFWarningExt(thandle_t, const char*, const char*, ...);
-LIBTIFF_DLL_IMPEXP TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
-LIBTIFF_DLL_IMPEXP TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
-LIBTIFF_DLL_IMPEXP TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
-LIBTIFF_DLL_IMPEXP TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
-LIBTIFF_DLL_IMPEXP TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
-LIBTIFF_DLL_IMPEXP ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t);
-LIBTIFF_DLL_IMPEXP int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t);
-LIBTIFF_DLL_IMPEXP ttile_t TIFFNumberOfTiles(TIFF*);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFReadTile(TIFF*,
- tdata_t, uint32, uint32, uint32, tsample_t);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFWriteTile(TIFF*,
- tdata_t, uint32, uint32, uint32, tsample_t);
-LIBTIFF_DLL_IMPEXP tstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t);
-LIBTIFF_DLL_IMPEXP tstrip_t TIFFNumberOfStrips(TIFF*);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
-LIBTIFF_DLL_IMPEXP int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */
-LIBTIFF_DLL_IMPEXP void TIFFSetWriteOffset(TIFF*, toff_t);
-LIBTIFF_DLL_IMPEXP void TIFFSwabShort(uint16*);
-LIBTIFF_DLL_IMPEXP void TIFFSwabLong(uint32*);
-LIBTIFF_DLL_IMPEXP void TIFFSwabDouble(double*);
-LIBTIFF_DLL_IMPEXP void TIFFSwabArrayOfShort(uint16*, unsigned long);
-LIBTIFF_DLL_IMPEXP void TIFFSwabArrayOfTriples(uint8*, unsigned long);
-LIBTIFF_DLL_IMPEXP void TIFFSwabArrayOfLong(uint32*, unsigned long);
-LIBTIFF_DLL_IMPEXP void TIFFSwabArrayOfDouble(double*, unsigned long);
-LIBTIFF_DLL_IMPEXP void TIFFReverseBits(unsigned char *, unsigned long);
-LIBTIFF_DLL_IMPEXP const unsigned char* TIFFGetBitRevTable(int);
-
-#ifdef LOGLUV_PUBLIC
-#define U_NEU 0.210526316
-#define V_NEU 0.473684211
-#define UVSCALE 410.
-LIBTIFF_DLL_IMPEXP double LogL16toY(int);
-LIBTIFF_DLL_IMPEXP double LogL10toY(int);
-LIBTIFF_DLL_IMPEXP void XYZtoRGB24(float*, uint8*);
-LIBTIFF_DLL_IMPEXP int uv_decode(double*, double*, int);
-LIBTIFF_DLL_IMPEXP void LogLuv24toXYZ(uint32, float*);
-LIBTIFF_DLL_IMPEXP void LogLuv32toXYZ(uint32, float*);
-#if defined(c_plusplus) || defined(__cplusplus)
-LIBTIFF_DLL_IMPEXP int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
-LIBTIFF_DLL_IMPEXP int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
-LIBTIFF_DLL_IMPEXP int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
-LIBTIFF_DLL_IMPEXP uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
-LIBTIFF_DLL_IMPEXP uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
-#else
-LIBTIFF_DLL_IMPEXP int LogL16fromY(double, int);
-LIBTIFF_DLL_IMPEXP int LogL10fromY(double, int);
-LIBTIFF_DLL_IMPEXP int uv_encode(double, double, int);
-LIBTIFF_DLL_IMPEXP uint32 LogLuv24fromXYZ(float*, int);
-LIBTIFF_DLL_IMPEXP uint32 LogLuv32fromXYZ(float*, int);
-#endif
-#endif /* LOGLUV_PUBLIC */
-
-LIBTIFF_DLL_IMPEXP int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
-LIBTIFF_DLL_IMPEXP void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
- float *, float *, float *);
-LIBTIFF_DLL_IMPEXP void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
- uint32 *, uint32 *, uint32 *);
-
-LIBTIFF_DLL_IMPEXP int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
-LIBTIFF_DLL_IMPEXP void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
- uint32 *, uint32 *, uint32 *);
-
-#if defined(c_plusplus) || defined(__cplusplus)
-}
-#endif
-
-#endif /* _TIFFIO_ */
-
-/* vim: set ts=8 sts=8 sw=8 noet: */
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiffvers.h b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiffvers.h
deleted file mode 100644
index 9744f8d3..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/tiffvers.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.8.2\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
-/*
- * This define can be used in code that requires
- * compilation-related definitions specific to a
- * version or versions of the library. Runtime
- * version checking should be done based on the
- * string returned by TIFFGetVersion.
- */
-#define TIFFLIB_VERSION 20060323
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/zconf.h b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/zconf.h
deleted file mode 100644
index 03a9431c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/zconf.h
+++ /dev/null
@@ -1,332 +0,0 @@
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZCONF_H
-#define ZCONF_H
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- */
-#ifdef Z_PREFIX
-# define deflateInit_ z_deflateInit_
-# define deflate z_deflate
-# define deflateEnd z_deflateEnd
-# define inflateInit_ z_inflateInit_
-# define inflate z_inflate
-# define inflateEnd z_inflateEnd
-# define deflateInit2_ z_deflateInit2_
-# define deflateSetDictionary z_deflateSetDictionary
-# define deflateCopy z_deflateCopy
-# define deflateReset z_deflateReset
-# define deflateParams z_deflateParams
-# define deflateBound z_deflateBound
-# define deflatePrime z_deflatePrime
-# define inflateInit2_ z_inflateInit2_
-# define inflateSetDictionary z_inflateSetDictionary
-# define inflateSync z_inflateSync
-# define inflateSyncPoint z_inflateSyncPoint
-# define inflateCopy z_inflateCopy
-# define inflateReset z_inflateReset
-# define inflateBack z_inflateBack
-# define inflateBackEnd z_inflateBackEnd
-# define compress z_compress
-# define compress2 z_compress2
-# define compressBound z_compressBound
-# define uncompress z_uncompress
-# define adler32 z_adler32
-# define crc32 z_crc32
-# define get_crc_table z_get_crc_table
-# define zError z_zError
-
-# define alloc_func z_alloc_func
-# define free_func z_free_func
-# define in_func z_in_func
-# define out_func z_out_func
-# define Byte z_Byte
-# define uInt z_uInt
-# define uLong z_uLong
-# define Bytef z_Bytef
-# define charf z_charf
-# define intf z_intf
-# define uIntf z_uIntf
-# define uLongf z_uLongf
-# define voidpf z_voidpf
-# define voidp z_voidp
-#endif
-
-#if defined(__MSDOS__) && !defined(MSDOS)
-# define MSDOS
-#endif
-#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
-# define OS2
-#endif
-#if defined(_WINDOWS) && !defined(WINDOWS)
-# define WINDOWS
-#endif
-#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
-# ifndef WIN32
-# define WIN32
-# endif
-#endif
-#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
-# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
-# ifndef SYS16BIT
-# define SYS16BIT
-# endif
-# endif
-#endif
-
-/*
- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
- * than 64k bytes at a time (needed on systems with 16-bit int).
- */
-#ifdef SYS16BIT
-# define MAXSEG_64K
-#endif
-#ifdef MSDOS
-# define UNALIGNED_OK
-#endif
-
-#ifdef __STDC_VERSION__
-# ifndef STDC
-# define STDC
-# endif
-# if __STDC_VERSION__ >= 199901L
-# ifndef STDC99
-# define STDC99
-# endif
-# endif
-#endif
-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
-# define STDC
-#endif
-
-#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
-# define STDC
-#endif
-
-#ifndef STDC
-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-# define const /* note: need a more gentle solution here */
-# endif
-#endif
-
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
-# define NO_DUMMY_DECL
-#endif
-
-/* Maximum value for memLevel in deflateInit2 */
-#ifndef MAX_MEM_LEVEL
-# ifdef MAXSEG_64K
-# define MAX_MEM_LEVEL 8
-# else
-# define MAX_MEM_LEVEL 9
-# endif
-#endif
-
-/* Maximum value for windowBits in deflateInit2 and inflateInit2.
- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
- * created by gzip. (Files created by minigzip can still be extracted by
- * gzip.)
- */
-#ifndef MAX_WBITS
-# define MAX_WBITS 15 /* 32K LZ77 window */
-#endif
-
-/* The memory requirements for deflate are (in bytes):
- (1 << (windowBits+2)) + (1 << (memLevel+9))
- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
- plus a few kilobytes for small objects. For example, if you want to reduce
- the default memory requirements from 256K to 128K, compile with
- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
- Of course this will generally degrade compression (there's no free lunch).
-
- The memory requirements for inflate are (in bytes) 1 << windowBits
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
- for small objects.
-*/
-
- /* Type declarations */
-
-#ifndef OF /* function prototypes */
-# ifdef STDC
-# define OF(args) args
-# else
-# define OF(args) ()
-# endif
-#endif
-
-/* The following definitions for FAR are needed only for MSDOS mixed
- * model programming (small or medium model with some far allocations).
- * This was tested only with MSC; for other MSDOS compilers you may have
- * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
- * just define FAR to be empty.
- */
-#ifdef SYS16BIT
-# if defined(M_I86SM) || defined(M_I86MM)
- /* MSC small or medium model */
-# define SMALL_MEDIUM
-# ifdef _MSC_VER
-# define FAR _far
-# else
-# define FAR far
-# endif
-# endif
-# if (defined(__SMALL__) || defined(__MEDIUM__))
- /* Turbo C small or medium model */
-# define SMALL_MEDIUM
-# ifdef __BORLANDC__
-# define FAR _far
-# else
-# define FAR far
-# endif
-# endif
-#endif
-
-#if defined(WINDOWS) || defined(WIN32)
- /* If building or using zlib as a DLL, define ZLIB_DLL.
- * This is not mandatory, but it offers a little performance increase.
- */
-# ifdef ZLIB_DLL
-# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
-# ifdef ZLIB_INTERNAL
-# define ZEXTERN extern __declspec(dllexport)
-# else
-# define ZEXTERN extern __declspec(dllimport)
-# endif
-# endif
-# endif /* ZLIB_DLL */
- /* If building or using zlib with the WINAPI/WINAPIV calling convention,
- * define ZLIB_WINAPI.
- * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
- */
-# ifdef ZLIB_WINAPI
-# ifdef FAR
-# undef FAR
-# endif
-# include <windows.h>
- /* No need for _export, use ZLIB.DEF instead. */
- /* For complete Windows compatibility, use WINAPI, not __stdcall. */
-# define ZEXPORT WINAPI
-# ifdef WIN32
-# define ZEXPORTVA WINAPIV
-# else
-# define ZEXPORTVA FAR CDECL
-# endif
-# endif
-#endif
-
-#if defined (__BEOS__)
-# ifdef ZLIB_DLL
-# ifdef ZLIB_INTERNAL
-# define ZEXPORT __declspec(dllexport)
-# define ZEXPORTVA __declspec(dllexport)
-# else
-# define ZEXPORT __declspec(dllimport)
-# define ZEXPORTVA __declspec(dllimport)
-# endif
-# endif
-#endif
-
-#ifndef ZEXTERN
-# define ZEXTERN extern
-#endif
-#ifndef ZEXPORT
-# define ZEXPORT
-#endif
-#ifndef ZEXPORTVA
-# define ZEXPORTVA
-#endif
-
-#ifndef FAR
-# define FAR
-#endif
-
-#if !defined(__MACTYPES__)
-typedef unsigned char Byte; /* 8 bits */
-#endif
-typedef unsigned int uInt; /* 16 bits or more */
-typedef unsigned long uLong; /* 32 bits or more */
-
-#ifdef SMALL_MEDIUM
- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
-# define Bytef Byte FAR
-#else
- typedef Byte FAR Bytef;
-#endif
-typedef char FAR charf;
-typedef int FAR intf;
-typedef uInt FAR uIntf;
-typedef uLong FAR uLongf;
-
-#ifdef STDC
- typedef void const *voidpc;
- typedef void FAR *voidpf;
- typedef void *voidp;
-#else
- typedef Byte const *voidpc;
- typedef Byte FAR *voidpf;
- typedef Byte *voidp;
-#endif
-
-#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
-# include <sys/types.h> /* for off_t */
-# include <unistd.h> /* for SEEK_* and off_t */
-# ifdef VMS
-# include <unixio.h> /* for off_t */
-# endif
-# define z_off_t off_t
-#endif
-#ifndef SEEK_SET
-# define SEEK_SET 0 /* Seek from beginning of file. */
-# define SEEK_CUR 1 /* Seek from current position. */
-# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
-#endif
-#ifndef z_off_t
-# define z_off_t long
-#endif
-
-#if defined(__OS400__)
-# define NO_vsnprintf
-#endif
-
-#if defined(__MVS__)
-# define NO_vsnprintf
-# ifdef FAR
-# undef FAR
-# endif
-#endif
-
-/* MVS linker does not support external names larger than 8 bytes */
-#if defined(__MVS__)
-# pragma map(deflateInit_,"DEIN")
-# pragma map(deflateInit2_,"DEIN2")
-# pragma map(deflateEnd,"DEEND")
-# pragma map(deflateBound,"DEBND")
-# pragma map(inflateInit_,"ININ")
-# pragma map(inflateInit2_,"ININ2")
-# pragma map(inflateEnd,"INEND")
-# pragma map(inflateSync,"INSY")
-# pragma map(inflateSetDictionary,"INSEDI")
-# pragma map(compressBound,"CMBND")
-# pragma map(inflate_table,"INTABL")
-# pragma map(inflate_fast,"INFA")
-# pragma map(inflate_copyright,"INCOPY")
-#endif
-
-#endif /* ZCONF_H */
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/zlib.h b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/zlib.h
deleted file mode 100644
index 02281792..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/include/zlib.h
+++ /dev/null
@@ -1,1357 +0,0 @@
-/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.2.3, July 18th, 2005
-
- Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jean-loup Gailly Mark Adler
- jloup@gzip.org madler@alumni.caltech.edu
-
-
- The data format used by the zlib library is described by RFCs (Request for
- Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
- (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
-*/
-
-#ifndef ZLIB_H
-#define ZLIB_H
-
-#include "zconf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ZLIB_VERSION "1.2.3"
-#define ZLIB_VERNUM 0x1230
-
-/*
- The 'zlib' compression library provides in-memory compression and
- decompression functions, including integrity checks of the uncompressed
- data. This version of the library supports only one compression method
- (deflation) but other algorithms will be added later and will have the same
- stream interface.
-
- Compression can be done in a single step if the buffers are large
- enough (for example if an input file is mmap'ed), or can be done by
- repeated calls of the compression function. In the latter case, the
- application must provide more input and/or consume the output
- (providing more output space) before each call.
-
- The compressed data format used by default by the in-memory functions is
- the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
- around a deflate stream, which is itself documented in RFC 1951.
-
- The library also supports reading and writing files in gzip (.gz) format
- with an interface similar to that of stdio using the functions that start
- with "gz". The gzip format is different from the zlib format. gzip is a
- gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
-
- This library can optionally read and write gzip streams in memory as well.
-
- The zlib format was designed to be compact and fast for use in memory
- and on communications channels. The gzip format was designed for single-
- file compression on file systems, has a larger header than zlib to maintain
- directory information, and uses a different, slower check method than zlib.
-
- The library does not install any signal handler. The decoder checks
- the consistency of the compressed data, so the library should never
- crash even in case of corrupted input.
-*/
-
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void (*free_func) OF((voidpf opaque, voidpf address));
-
-struct internal_state;
-
-typedef struct z_stream_s {
- Bytef *next_in; /* next input byte */
- uInt avail_in; /* number of bytes available at next_in */
- uLong total_in; /* total nb of input bytes read so far */
-
- Bytef *next_out; /* next output byte should be put there */
- uInt avail_out; /* remaining free space at next_out */
- uLong total_out; /* total nb of bytes output so far */
-
- char *msg; /* last error message, NULL if no error */
- struct internal_state FAR *state; /* not visible by applications */
-
- alloc_func zalloc; /* used to allocate the internal state */
- free_func zfree; /* used to free the internal state */
- voidpf opaque; /* private data object passed to zalloc and zfree */
-
- int data_type; /* best guess about the data type: binary or text */
- uLong adler; /* adler32 value of the uncompressed data */
- uLong reserved; /* reserved for future use */
-} z_stream;
-
-typedef z_stream FAR *z_streamp;
-
-/*
- gzip header information passed to and from zlib routines. See RFC 1952
- for more details on the meanings of these fields.
-*/
-typedef struct gz_header_s {
- int text; /* true if compressed data believed to be text */
- uLong time; /* modification time */
- int xflags; /* extra flags (not used when writing a gzip file) */
- int os; /* operating system */
- Bytef *extra; /* pointer to extra field or Z_NULL if none */
- uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
- uInt extra_max; /* space at extra (only when reading header) */
- Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
- uInt name_max; /* space at name (only when reading header) */
- Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
- uInt comm_max; /* space at comment (only when reading header) */
- int hcrc; /* true if there was or will be a header crc */
- int done; /* true when done reading gzip header (not used
- when writing a gzip file) */
-} gz_header;
-
-typedef gz_header FAR *gz_headerp;
-
-/*
- The application must update next_in and avail_in when avail_in has
- dropped to zero. It must update next_out and avail_out when avail_out
- has dropped to zero. The application must initialize zalloc, zfree and
- opaque before calling the init function. All other fields are set by the
- compression library and must not be updated by the application.
-
- The opaque value provided by the application will be passed as the first
- parameter for calls of zalloc and zfree. This can be useful for custom
- memory management. The compression library attaches no meaning to the
- opaque value.
-
- zalloc must return Z_NULL if there is not enough memory for the object.
- If zlib is used in a multi-threaded application, zalloc and zfree must be
- thread safe.
-
- On 16-bit systems, the functions zalloc and zfree must be able to allocate
- exactly 65536 bytes, but will not be required to allocate more than this
- if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
- pointers returned by zalloc for objects of exactly 65536 bytes *must*
- have their offset normalized to zero. The default allocation function
- provided by this library ensures this (see zutil.c). To reduce memory
- requirements and avoid any allocation of 64K objects, at the expense of
- compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
-
- The fields total_in and total_out can be used for statistics or
- progress reports. After compression, total_in holds the total size of
- the uncompressed data and may be saved for use in the decompressor
- (particularly if the decompressor wants to decompress everything in
- a single step).
-*/
-
- /* constants */
-
-#define Z_NO_FLUSH 0
-#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
-#define Z_SYNC_FLUSH 2
-#define Z_FULL_FLUSH 3
-#define Z_FINISH 4
-#define Z_BLOCK 5
-/* Allowed flush values; see deflate() and inflate() below for details */
-
-#define Z_OK 0
-#define Z_STREAM_END 1
-#define Z_NEED_DICT 2
-#define Z_ERRNO (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR (-3)
-#define Z_MEM_ERROR (-4)
-#define Z_BUF_ERROR (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative
- * values are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION 0
-#define Z_BEST_SPEED 1
-#define Z_BEST_COMPRESSION 9
-#define Z_DEFAULT_COMPRESSION (-1)
-/* compression levels */
-
-#define Z_FILTERED 1
-#define Z_HUFFMAN_ONLY 2
-#define Z_RLE 3
-#define Z_FIXED 4
-#define Z_DEFAULT_STRATEGY 0
-/* compression strategy; see deflateInit2() below for details */
-
-#define Z_BINARY 0
-#define Z_TEXT 1
-#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
-#define Z_UNKNOWN 2
-/* Possible values of the data_type field (though see inflate()) */
-
-#define Z_DEFLATED 8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
-
-#define zlib_version zlibVersion()
-/* for compatibility with versions < 1.0.2 */
-
- /* basic functions */
-
-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
- If the first character differs, the library code actually used is
- not compatible with the zlib.h header file used by the application.
- This check is automatically made by deflateInit and inflateInit.
- */
-
-/*
-ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
-
- Initializes the internal stream state for compression. The fields
- zalloc, zfree and opaque must be initialized before by the caller.
- If zalloc and zfree are set to Z_NULL, deflateInit updates them to
- use default allocation functions.
-
- The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
- 1 gives best speed, 9 gives best compression, 0 gives no compression at
- all (the input data is simply copied a block at a time).
- Z_DEFAULT_COMPRESSION requests a default compromise between speed and
- compression (currently equivalent to level 6).
-
- deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if level is not a valid compression level,
- Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
- with the version assumed by the caller (ZLIB_VERSION).
- msg is set to null if there is no error message. deflateInit does not
- perform any compression: this will be done by deflate().
-*/
-
-
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
-/*
- deflate compresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce some
- output latency (reading input without producing any output) except when
- forced to flush.
-
- The detailed semantics are as follows. deflate performs one or both of the
- following actions:
-
- - Compress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in and avail_in are updated and
- processing will resume at this point for the next call of deflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. This action is forced if the parameter flush is non zero.
- Forcing flush frequently degrades the compression ratio, so this parameter
- should be set only when necessary (in interactive applications).
- Some output may be provided even if flush is not set.
-
- Before the call of deflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating avail_in or avail_out accordingly; avail_out
- should never be zero before the call. The application can consume the
- compressed output when it wants, for example when the output buffer is full
- (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
- and with zero avail_out, it must be called again after making room in the
- output buffer because there might be more output pending.
-
- Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
- decide how much data to accumualte before producing output, in order to
- maximize compression.
-
- If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
- flushed to the output buffer and the output is aligned on a byte boundary, so
- that the decompressor can get all input data available so far. (In particular
- avail_in is zero after the call if enough output space has been provided
- before the call.) Flushing may degrade compression for some compression
- algorithms and so it should be used only when necessary.
-
- If flush is set to Z_FULL_FLUSH, all output is flushed as with
- Z_SYNC_FLUSH, and the compression state is reset so that decompression can
- restart from this point if previous compressed data has been damaged or if
- random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
- compression.
-
- If deflate returns with avail_out == 0, this function must be called again
- with the same value of the flush parameter and more output space (updated
- avail_out), until the flush is complete (deflate returns with non-zero
- avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
- avail_out is greater than six to avoid repeated flush markers due to
- avail_out == 0 on return.
-
- If the parameter flush is set to Z_FINISH, pending input is processed,
- pending output is flushed and deflate returns with Z_STREAM_END if there
- was enough output space; if deflate returns with Z_OK, this function must be
- called again with Z_FINISH and more output space (updated avail_out) but no
- more input data, until it returns with Z_STREAM_END or an error. After
- deflate has returned Z_STREAM_END, the only possible operations on the
- stream are deflateReset or deflateEnd.
-
- Z_FINISH can be used immediately after deflateInit if all the compression
- is to be done in a single step. In this case, avail_out must be at least
- the value returned by deflateBound (see below). If deflate does not return
- Z_STREAM_END, then it must be called again as described above.
-
- deflate() sets strm->adler to the adler32 checksum of all input read
- so far (that is, total_in bytes).
-
- deflate() may update strm->data_type if it can make a good guess about
- the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
- binary. This field is only for information purposes and does not affect
- the compression algorithm in any manner.
-
- deflate() returns Z_OK if some progress has been made (more input
- processed or more output produced), Z_STREAM_END if all input has been
- consumed and all output has been produced (only when flush is set to
- Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
- if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
- (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
- fatal, and deflate() can be called again with more input and more output
- space to continue compressing.
-*/
-
-
-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
-
- deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
- stream state was inconsistent, Z_DATA_ERROR if the stream was freed
- prematurely (some input or output was discarded). In the error case,
- msg may be set but then points to a static string (which must not be
- deallocated).
-*/
-
-
-/*
-ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
-
- Initializes the internal stream state for decompression. The fields
- next_in, avail_in, zalloc, zfree and opaque must be initialized before by
- the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
- value depends on the compression method), inflateInit determines the
- compression method from the zlib header and allocates all data structures
- accordingly; otherwise the allocation will be deferred to the first call of
- inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
- use default allocation functions.
-
- inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
- version assumed by the caller. msg is set to null if there is no error
- message. inflateInit does not perform any decompression apart from reading
- the zlib header if present: this will be done by inflate(). (So next_in and
- avail_in may be modified, but next_out and avail_out are unchanged.)
-*/
-
-
-ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
-/*
- inflate decompresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce
- some output latency (reading input without producing any output) except when
- forced to flush.
-
- The detailed semantics are as follows. inflate performs one or both of the
- following actions:
-
- - Decompress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in is updated and processing
- will resume at this point for the next call of inflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. inflate() provides as much output as possible, until there
- is no more input data or no more space in the output buffer (see below
- about the flush parameter).
-
- Before the call of inflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating the next_* and avail_* values accordingly.
- The application can consume the uncompressed output when it wants, for
- example when the output buffer is full (avail_out == 0), or after each
- call of inflate(). If inflate returns Z_OK and with zero avail_out, it
- must be called again after making room in the output buffer because there
- might be more output pending.
-
- The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
- Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
- output as possible to the output buffer. Z_BLOCK requests that inflate() stop
- if and when it gets to the next deflate block boundary. When decoding the
- zlib or gzip format, this will cause inflate() to return immediately after
- the header and before the first block. When doing a raw inflate, inflate()
- will go ahead and process the first block, and will return when it gets to
- the end of that block, or when it runs out of data.
-
- The Z_BLOCK option assists in appending to or combining deflate streams.
- Also to assist in this, on return inflate() will set strm->data_type to the
- number of unused bits in the last byte taken from strm->next_in, plus 64
- if inflate() is currently decoding the last block in the deflate stream,
- plus 128 if inflate() returned immediately after decoding an end-of-block
- code or decoding the complete header up to just before the first byte of the
- deflate stream. The end-of-block will not be indicated until all of the
- uncompressed data from that block has been written to strm->next_out. The
- number of unused bits may in general be greater than seven, except when
- bit 7 of data_type is set, in which case the number of unused bits will be
- less than eight.
-
- inflate() should normally be called until it returns Z_STREAM_END or an
- error. However if all decompression is to be performed in a single step
- (a single call of inflate), the parameter flush should be set to
- Z_FINISH. In this case all pending input is processed and all pending
- output is flushed; avail_out must be large enough to hold all the
- uncompressed data. (The size of the uncompressed data may have been saved
- by the compressor for this purpose.) The next operation on this stream must
- be inflateEnd to deallocate the decompression state. The use of Z_FINISH
- is never required, but can be used to inform inflate that a faster approach
- may be used for the single inflate() call.
-
- In this implementation, inflate() always flushes as much output as
- possible to the output buffer, and always uses the faster approach on the
- first call. So the only effect of the flush parameter in this implementation
- is on the return value of inflate(), as noted below, or when it returns early
- because Z_BLOCK is used.
-
- If a preset dictionary is needed after this call (see inflateSetDictionary
- below), inflate sets strm->adler to the adler32 checksum of the dictionary
- chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
- strm->adler to the adler32 checksum of all output produced so far (that is,
- total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
- below. At the end of the stream, inflate() checks that its computed adler32
- checksum is equal to that saved by the compressor and returns Z_STREAM_END
- only if the checksum is correct.
-
- inflate() will decompress and check either zlib-wrapped or gzip-wrapped
- deflate data. The header type is detected automatically. Any information
- contained in the gzip header is not retained, so applications that need that
- information should instead use raw inflate, see inflateInit2() below, or
- inflateBack() and perform their own processing of the gzip header and
- trailer.
-
- inflate() returns Z_OK if some progress has been made (more input processed
- or more output produced), Z_STREAM_END if the end of the compressed data has
- been reached and all uncompressed output has been produced, Z_NEED_DICT if a
- preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
- corrupted (input stream not conforming to the zlib format or incorrect check
- value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
- if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
- Z_BUF_ERROR if no progress is possible or if there was not enough room in the
- output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
- inflate() can be called again with more input and more output space to
- continue decompressing. If Z_DATA_ERROR is returned, the application may then
- call inflateSync() to look for a good compression block if a partial recovery
- of the data is desired.
-*/
-
-
-ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
-
- inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
- was inconsistent. In the error case, msg may be set but then points to a
- static string (which must not be deallocated).
-*/
-
- /* Advanced functions */
-
-/*
- The following functions are needed only in some special applications.
-*/
-
-/*
-ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
- int level,
- int method,
- int windowBits,
- int memLevel,
- int strategy));
-
- This is another version of deflateInit with more compression options. The
- fields next_in, zalloc, zfree and opaque must be initialized before by
- the caller.
-
- The method parameter is the compression method. It must be Z_DEFLATED in
- this version of the library.
-
- The windowBits parameter is the base two logarithm of the window size
- (the size of the history buffer). It should be in the range 8..15 for this
- version of the library. Larger values of this parameter result in better
- compression at the expense of memory usage. The default value is 15 if
- deflateInit is used instead.
-
- windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
- determines the window size. deflate() will then generate raw deflate data
- with no zlib header or trailer, and will not compute an adler32 check value.
-
- windowBits can also be greater than 15 for optional gzip encoding. Add
- 16 to windowBits to write a simple gzip header and trailer around the
- compressed data instead of a zlib wrapper. The gzip header will have no
- file name, no extra data, no comment, no modification time (set to zero),
- no header crc, and the operating system will be set to 255 (unknown). If a
- gzip stream is being written, strm->adler is a crc32 instead of an adler32.
-
- The memLevel parameter specifies how much memory should be allocated
- for the internal compression state. memLevel=1 uses minimum memory but
- is slow and reduces compression ratio; memLevel=9 uses maximum memory
- for optimal speed. The default value is 8. See zconf.h for total memory
- usage as a function of windowBits and memLevel.
-
- The strategy parameter is used to tune the compression algorithm. Use the
- value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
- filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
- string match), or Z_RLE to limit match distances to one (run-length
- encoding). Filtered data consists mostly of small values with a somewhat
- random distribution. In this case, the compression algorithm is tuned to
- compress them better. The effect of Z_FILTERED is to force more Huffman
- coding and less string matching; it is somewhat intermediate between
- Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
- Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
- parameter only affects the compression ratio but not the correctness of the
- compressed output even if it is not set appropriately. Z_FIXED prevents the
- use of dynamic Huffman codes, allowing for a simpler decoder for special
- applications.
-
- deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
- method). msg is set to null if there is no error message. deflateInit2 does
- not perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the compression dictionary from the given byte sequence
- without producing any compressed output. This function must be called
- immediately after deflateInit, deflateInit2 or deflateReset, before any
- call of deflate. The compressor and decompressor must use exactly the same
- dictionary (see inflateSetDictionary).
-
- The dictionary should consist of strings (byte sequences) that are likely
- to be encountered later in the data to be compressed, with the most commonly
- used strings preferably put towards the end of the dictionary. Using a
- dictionary is most useful when the data to be compressed is short and can be
- predicted with good accuracy; the data can then be compressed better than
- with the default empty dictionary.
-
- Depending on the size of the compression data structures selected by
- deflateInit or deflateInit2, a part of the dictionary may in effect be
- discarded, for example if the dictionary is larger than the window size in
- deflate or deflate2. Thus the strings most likely to be useful should be
- put at the end of the dictionary, not at the front. In addition, the
- current implementation of deflate will use at most the window size minus
- 262 bytes of the provided dictionary.
-
- Upon return of this function, strm->adler is set to the adler32 value
- of the dictionary; the decompressor may later use this value to determine
- which dictionary has been used by the compressor. (The adler32 value
- applies to the whole dictionary even if only a subset of the dictionary is
- actually used by the compressor.) If a raw deflate was requested, then the
- adler32 value is not computed and strm->adler is not set.
-
- deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
- inconsistent (for example if deflate has already been called for this stream
- or if the compression method is bsort). deflateSetDictionary does not
- perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream.
-
- This function can be useful when several compression strategies will be
- tried, for example when there are several ways of pre-processing the input
- data with a filter. The streams that will be discarded should then be freed
- by calling deflateEnd. Note that deflateCopy duplicates the internal
- compression state which can be quite large, so this strategy is slow and
- can consume lots of memory.
-
- deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being NULL). msg is left unchanged in both source and
- destination.
-*/
-
-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
-/*
- This function is equivalent to deflateEnd followed by deflateInit,
- but does not free and reallocate all the internal compression state.
- The stream will keep the same compression level and any other attributes
- that may have been set by deflateInit2.
-
- deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
- int level,
- int strategy));
-/*
- Dynamically update the compression level and compression strategy. The
- interpretation of level and strategy is as in deflateInit2. This can be
- used to switch between compression and straight copy of the input data, or
- to switch to a different kind of input data requiring a different
- strategy. If the compression level is changed, the input available so far
- is compressed with the old level (and may be flushed); the new level will
- take effect only at the next call of deflate().
-
- Before the call of deflateParams, the stream state must be set as for
- a call of deflate(), since the currently available input may have to
- be compressed and flushed. In particular, strm->avail_out must be non-zero.
-
- deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
- stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
- if strm->avail_out was zero.
-*/
-
-ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
- int good_length,
- int max_lazy,
- int nice_length,
- int max_chain));
-/*
- Fine tune deflate's internal compression parameters. This should only be
- used by someone who understands the algorithm used by zlib's deflate for
- searching for the best matching string, and even then only by the most
- fanatic optimizer trying to squeeze out the last compressed bit for their
- specific input data. Read the deflate.c source code for the meaning of the
- max_lazy, good_length, nice_length, and max_chain parameters.
-
- deflateTune() can be called after deflateInit() or deflateInit2(), and
- returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
- */
-
-ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
- uLong sourceLen));
-/*
- deflateBound() returns an upper bound on the compressed size after
- deflation of sourceLen bytes. It must be called after deflateInit()
- or deflateInit2(). This would be used to allocate an output buffer
- for deflation in a single pass, and so would be called before deflate().
-*/
-
-ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
- int bits,
- int value));
-/*
- deflatePrime() inserts bits in the deflate output stream. The intent
- is that this function is used to start off the deflate output with the
- bits leftover from a previous deflate stream when appending to it. As such,
- this function can only be used for raw deflate, and must be used before the
- first deflate() call after a deflateInit2() or deflateReset(). bits must be
- less than or equal to 16, and that many of the least significant bits of
- value will be inserted in the output.
-
- deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
- gz_headerp head));
-/*
- deflateSetHeader() provides gzip header information for when a gzip
- stream is requested by deflateInit2(). deflateSetHeader() may be called
- after deflateInit2() or deflateReset() and before the first call of
- deflate(). The text, time, os, extra field, name, and comment information
- in the provided gz_header structure are written to the gzip header (xflag is
- ignored -- the extra flags are set according to the compression level). The
- caller must assure that, if not Z_NULL, name and comment are terminated with
- a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
- available there. If hcrc is true, a gzip header crc is included. Note that
- the current versions of the command-line version of gzip (up through version
- 1.3.x) do not support header crc's, and will report that it is a "multi-part
- gzip file" and give up.
-
- If deflateSetHeader is not used, the default gzip header has text false,
- the time set to zero, and os set to 255, with no extra, name, or comment
- fields. The gzip header is returned to the default state by deflateReset().
-
- deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
- int windowBits));
-
- This is another version of inflateInit with an extra parameter. The
- fields next_in, avail_in, zalloc, zfree and opaque must be initialized
- before by the caller.
-
- The windowBits parameter is the base two logarithm of the maximum window
- size (the size of the history buffer). It should be in the range 8..15 for
- this version of the library. The default value is 15 if inflateInit is used
- instead. windowBits must be greater than or equal to the windowBits value
- provided to deflateInit2() while compressing, or it must be equal to 15 if
- deflateInit2() was not used. If a compressed stream with a larger window
- size is given as input, inflate() will return with the error code
- Z_DATA_ERROR instead of trying to allocate a larger window.
-
- windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
- determines the window size. inflate() will then process raw deflate data,
- not looking for a zlib or gzip header, not generating a check value, and not
- looking for any check values for comparison at the end of the stream. This
- is for use with other formats that use the deflate compressed data format
- such as zip. Those formats provide their own check values. If a custom
- format is developed using the raw deflate format for compressed data, it is
- recommended that a check value such as an adler32 or a crc32 be applied to
- the uncompressed data as is done in the zlib, gzip, and zip formats. For
- most applications, the zlib format should be used as is. Note that comments
- above on the use in deflateInit2() applies to the magnitude of windowBits.
-
- windowBits can also be greater than 15 for optional gzip decoding. Add
- 32 to windowBits to enable zlib and gzip decoding with automatic header
- detection, or add 16 to decode only the gzip format (the zlib format will
- return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is
- a crc32 instead of an adler32.
-
- inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
- is set to null if there is no error message. inflateInit2 does not perform
- any decompression apart from reading the zlib header if present: this will
- be done by inflate(). (So next_in and avail_in may be modified, but next_out
- and avail_out are unchanged.)
-*/
-
-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the decompression dictionary from the given uncompressed byte
- sequence. This function must be called immediately after a call of inflate,
- if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
- can be determined from the adler32 value returned by that call of inflate.
- The compressor and decompressor must use exactly the same dictionary (see
- deflateSetDictionary). For raw inflate, this function can be called
- immediately after inflateInit2() or inflateReset() and before any call of
- inflate() to set the dictionary. The application must insure that the
- dictionary that was used for compression is provided.
-
- inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
- inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
- expected one (incorrect adler32 value). inflateSetDictionary does not
- perform any decompression: this will be done by subsequent calls of
- inflate().
-*/
-
-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
-/*
- Skips invalid compressed data until a full flush point (see above the
- description of deflate with Z_FULL_FLUSH) can be found, or until all
- available input is skipped. No output is provided.
-
- inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
- if no more input was provided, Z_DATA_ERROR if no flush point has been found,
- or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
- case, the application may save the current current value of total_in which
- indicates where valid compressed data was found. In the error case, the
- application may repeatedly call inflateSync, providing more input each time,
- until success or end of the input data.
-*/
-
-ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream.
-
- This function can be useful when randomly accessing a large stream. The
- first pass through the stream can periodically record the inflate state,
- allowing restarting inflate at those points when randomly accessing the
- stream.
-
- inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being NULL). msg is left unchanged in both source and
- destination.
-*/
-
-ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
-/*
- This function is equivalent to inflateEnd followed by inflateInit,
- but does not free and reallocate all the internal decompression state.
- The stream will keep attributes that may have been set by inflateInit2.
-
- inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
- int bits,
- int value));
-/*
- This function inserts bits in the inflate input stream. The intent is
- that this function is used to start inflating at a bit position in the
- middle of a byte. The provided bits will be used before any bytes are used
- from next_in. This function should only be used with raw inflate, and
- should be used before the first inflate() call after inflateInit2() or
- inflateReset(). bits must be less than or equal to 16, and that many of the
- least significant bits of value will be inserted in the input.
-
- inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
- gz_headerp head));
-/*
- inflateGetHeader() requests that gzip header information be stored in the
- provided gz_header structure. inflateGetHeader() may be called after
- inflateInit2() or inflateReset(), and before the first call of inflate().
- As inflate() processes the gzip stream, head->done is zero until the header
- is completed, at which time head->done is set to one. If a zlib stream is
- being decoded, then head->done is set to -1 to indicate that there will be
- no gzip header information forthcoming. Note that Z_BLOCK can be used to
- force inflate() to return immediately after header processing is complete
- and before any actual data is decompressed.
-
- The text, time, xflags, and os fields are filled in with the gzip header
- contents. hcrc is set to true if there is a header CRC. (The header CRC
- was valid if done is set to one.) If extra is not Z_NULL, then extra_max
- contains the maximum number of bytes to write to extra. Once done is true,
- extra_len contains the actual extra field length, and extra contains the
- extra field, or that field truncated if extra_max is less than extra_len.
- If name is not Z_NULL, then up to name_max characters are written there,
- terminated with a zero unless the length is greater than name_max. If
- comment is not Z_NULL, then up to comm_max characters are written there,
- terminated with a zero unless the length is greater than comm_max. When
- any of extra, name, or comment are not Z_NULL and the respective field is
- not present in the header, then that field is set to Z_NULL to signal its
- absence. This allows the use of deflateSetHeader() with the returned
- structure to duplicate the header. However if those fields are set to
- allocated memory, then the application will need to save those pointers
- elsewhere so that they can be eventually freed.
-
- If inflateGetHeader is not used, then the header information is simply
- discarded. The header is always checked for validity, including the header
- CRC if present. inflateReset() will reset the process to discard the header
- information. The application would need to call inflateGetHeader() again to
- retrieve the header from the next gzip stream.
-
- inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
- unsigned char FAR *window));
-
- Initialize the internal stream state for decompression using inflateBack()
- calls. The fields zalloc, zfree and opaque in strm must be initialized
- before the call. If zalloc and zfree are Z_NULL, then the default library-
- derived memory allocation routines are used. windowBits is the base two
- logarithm of the window size, in the range 8..15. window is a caller
- supplied buffer of that size. Except for special applications where it is
- assured that deflate was used with small window sizes, windowBits must be 15
- and a 32K byte window must be supplied to be able to decompress general
- deflate streams.
-
- See inflateBack() for the usage of these routines.
-
- inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
- the paramaters are invalid, Z_MEM_ERROR if the internal state could not
- be allocated, or Z_VERSION_ERROR if the version of the library does not
- match the version of the header file.
-*/
-
-typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
-typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
-
-ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
- in_func in, void FAR *in_desc,
- out_func out, void FAR *out_desc));
-/*
- inflateBack() does a raw inflate with a single call using a call-back
- interface for input and output. This is more efficient than inflate() for
- file i/o applications in that it avoids copying between the output and the
- sliding window by simply making the window itself the output buffer. This
- function trusts the application to not change the output buffer passed by
- the output function, at least until inflateBack() returns.
-
- inflateBackInit() must be called first to allocate the internal state
- and to initialize the state with the user-provided window buffer.
- inflateBack() may then be used multiple times to inflate a complete, raw
- deflate stream with each call. inflateBackEnd() is then called to free
- the allocated state.
-
- A raw deflate stream is one with no zlib or gzip header or trailer.
- This routine would normally be used in a utility that reads zip or gzip
- files and writes out uncompressed files. The utility would decode the
- header and process the trailer on its own, hence this routine expects
- only the raw deflate stream to decompress. This is different from the
- normal behavior of inflate(), which expects either a zlib or gzip header and
- trailer around the deflate stream.
-
- inflateBack() uses two subroutines supplied by the caller that are then
- called by inflateBack() for input and output. inflateBack() calls those
- routines until it reads a complete deflate stream and writes out all of the
- uncompressed data, or until it encounters an error. The function's
- parameters and return types are defined above in the in_func and out_func
- typedefs. inflateBack() will call in(in_desc, &buf) which should return the
- number of bytes of provided input, and a pointer to that input in buf. If
- there is no input available, in() must return zero--buf is ignored in that
- case--and inflateBack() will return a buffer error. inflateBack() will call
- out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
- should return zero on success, or non-zero on failure. If out() returns
- non-zero, inflateBack() will return with an error. Neither in() nor out()
- are permitted to change the contents of the window provided to
- inflateBackInit(), which is also the buffer that out() uses to write from.
- The length written by out() will be at most the window size. Any non-zero
- amount of input may be provided by in().
-
- For convenience, inflateBack() can be provided input on the first call by
- setting strm->next_in and strm->avail_in. If that input is exhausted, then
- in() will be called. Therefore strm->next_in must be initialized before
- calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
- immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
- must also be initialized, and then if strm->avail_in is not zero, input will
- initially be taken from strm->next_in[0 .. strm->avail_in - 1].
-
- The in_desc and out_desc parameters of inflateBack() is passed as the
- first parameter of in() and out() respectively when they are called. These
- descriptors can be optionally used to pass any information that the caller-
- supplied in() and out() functions need to do their job.
-
- On return, inflateBack() will set strm->next_in and strm->avail_in to
- pass back any unused input that was provided by the last in() call. The
- return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
- if in() or out() returned an error, Z_DATA_ERROR if there was a format
- error in the deflate stream (in which case strm->msg is set to indicate the
- nature of the error), or Z_STREAM_ERROR if the stream was not properly
- initialized. In the case of Z_BUF_ERROR, an input or output error can be
- distinguished using strm->next_in which will be Z_NULL only if in() returned
- an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
- out() returning non-zero. (in() will always be called before out(), so
- strm->next_in is assured to be defined if out() returns non-zero.) Note
- that inflateBack() cannot return Z_OK.
-*/
-
-ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
-/*
- All memory allocated by inflateBackInit() is freed.
-
- inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
- state was inconsistent.
-*/
-
-ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
-/* Return flags indicating compile-time options.
-
- Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
- 1.0: size of uInt
- 3.2: size of uLong
- 5.4: size of voidpf (pointer)
- 7.6: size of z_off_t
-
- Compiler, assembler, and debug options:
- 8: DEBUG
- 9: ASMV or ASMINF -- use ASM code
- 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
- 11: 0 (reserved)
-
- One-time table building (smaller code, but not thread-safe if true):
- 12: BUILDFIXED -- build static block decoding tables when needed
- 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
- 14,15: 0 (reserved)
-
- Library content (indicates missing functionality):
- 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
- deflate code when not needed)
- 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
- and decode gzip streams (to avoid linking crc code)
- 18-19: 0 (reserved)
-
- Operation variations (changes in library functionality):
- 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
- 21: FASTEST -- deflate algorithm with only one, lowest compression level
- 22,23: 0 (reserved)
-
- The sprintf variant used by gzprintf (zero is best):
- 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
- 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
- 26: 0 = returns value, 1 = void -- 1 means inferred string length returned
-
- Remainder:
- 27-31: 0 (reserved)
- */
-
-
- /* utility functions */
-
-/*
- The following utility functions are implemented on top of the
- basic stream-oriented functions. To simplify the interface, some
- default options are assumed (compression level and memory usage,
- standard memory allocation functions). The source code of these
- utility functions can easily be modified if you need special options.
-*/
-
-ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Compresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be at least the value returned
- by compressBound(sourceLen). Upon exit, destLen is the actual size of the
- compressed buffer.
- This function can be used to compress a whole file at once if the
- input file is mmap'ed.
- compress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer.
-*/
-
-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen,
- int level));
-/*
- Compresses the source buffer into the destination buffer. The level
- parameter has the same meaning as in deflateInit. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
- destination buffer, which must be at least the value returned by
- compressBound(sourceLen). Upon exit, destLen is the actual size of the
- compressed buffer.
-
- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
- Z_STREAM_ERROR if the level parameter is invalid.
-*/
-
-ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
-/*
- compressBound() returns an upper bound on the compressed size after
- compress() or compress2() on sourceLen bytes. It would be used before
- a compress() or compress2() call to allocate the destination buffer.
-*/
-
-ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be large enough to hold the
- entire uncompressed data. (The size of the uncompressed data must have
- been saved previously by the compressor and transmitted to the decompressor
- by some mechanism outside the scope of this compression library.)
- Upon exit, destLen is the actual size of the compressed buffer.
- This function can be used to decompress a whole file at once if the
- input file is mmap'ed.
-
- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
-*/
-
-
-typedef voidp gzFile;
-
-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
-/*
- Opens a gzip (.gz) file for reading or writing. The mode parameter
- is as in fopen ("rb" or "wb") but can also include a compression level
- ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
- Huffman only compression as in "wb1h", or 'R' for run-length encoding
- as in "wb1R". (See the description of deflateInit2 for more information
- about the strategy parameter.)
-
- gzopen can be used to read a file which is not in gzip format; in this
- case gzread will directly read from the file without decompression.
-
- gzopen returns NULL if the file could not be opened or if there was
- insufficient memory to allocate the (de)compression state; errno
- can be checked to distinguish the two cases (if errno is zero, the
- zlib error is Z_MEM_ERROR). */
-
-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
-/*
- gzdopen() associates a gzFile with the file descriptor fd. File
- descriptors are obtained from calls like open, dup, creat, pipe or
- fileno (in the file has been previously opened with fopen).
- The mode parameter is as in gzopen.
- The next call of gzclose on the returned gzFile will also close the
- file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
- descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
- gzdopen returns NULL if there was insufficient memory to allocate
- the (de)compression state.
-*/
-
-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
-/*
- Dynamically update the compression level or strategy. See the description
- of deflateInit2 for the meaning of these parameters.
- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
- opened for writing.
-*/
-
-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
-/*
- Reads the given number of uncompressed bytes from the compressed file.
- If the input file was not in gzip format, gzread copies the given number
- of bytes into the buffer.
- gzread returns the number of uncompressed bytes actually read (0 for
- end of file, -1 for error). */
-
-ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
- voidpc buf, unsigned len));
-/*
- Writes the given number of uncompressed bytes into the compressed file.
- gzwrite returns the number of uncompressed bytes actually written
- (0 in case of error).
-*/
-
-ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
-/*
- Converts, formats, and writes the args to the compressed file under
- control of the format string, as in fprintf. gzprintf returns the number of
- uncompressed bytes actually written (0 in case of error). The number of
- uncompressed bytes written is limited to 4095. The caller should assure that
- this limit is not exceeded. If it is exceeded, then gzprintf() will return
- return an error (0) with nothing written. In this case, there may also be a
- buffer overflow with unpredictable consequences, which is possible only if
- zlib was compiled with the insecure functions sprintf() or vsprintf()
- because the secure snprintf() or vsnprintf() functions were not available.
-*/
-
-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
-/*
- Writes the given null-terminated string to the compressed file, excluding
- the terminating null character.
- gzputs returns the number of characters written, or -1 in case of error.
-*/
-
-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
-/*
- Reads bytes from the compressed file until len-1 characters are read, or
- a newline character is read and transferred to buf, or an end-of-file
- condition is encountered. The string is then terminated with a null
- character.
- gzgets returns buf, or Z_NULL in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
-/*
- Writes c, converted to an unsigned char, into the compressed file.
- gzputc returns the value that was written, or -1 in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
-/*
- Reads one byte from the compressed file. gzgetc returns this byte
- or -1 in case of end of file or error.
-*/
-
-ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
-/*
- Push one character back onto the stream to be read again later.
- Only one character of push-back is allowed. gzungetc() returns the
- character pushed, or -1 on failure. gzungetc() will fail if a
- character has been pushed but not read yet, or if c is -1. The pushed
- character will be discarded if the stream is repositioned with gzseek()
- or gzrewind().
-*/
-
-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
-/*
- Flushes all pending output into the compressed file. The parameter
- flush is as in the deflate() function. The return value is the zlib
- error number (see function gzerror below). gzflush returns Z_OK if
- the flush parameter is Z_FINISH and all output could be flushed.
- gzflush should be called only when strictly necessary because it can
- degrade compression.
-*/
-
-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
- z_off_t offset, int whence));
-/*
- Sets the starting position for the next gzread or gzwrite on the
- given compressed file. The offset represents a number of bytes in the
- uncompressed data stream. The whence parameter is defined as in lseek(2);
- the value SEEK_END is not supported.
- If the file is opened for reading, this function is emulated but can be
- extremely slow. If the file is opened for writing, only forward seeks are
- supported; gzseek then compresses a sequence of zeroes up to the new
- starting position.
-
- gzseek returns the resulting offset location as measured in bytes from
- the beginning of the uncompressed stream, or -1 in case of error, in
- particular if the file is opened for writing and the new starting position
- would be before the current position.
-*/
-
-ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
-/*
- Rewinds the given file. This function is supported only for reading.
-
- gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
-*/
-
-ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
-/*
- Returns the starting position for the next gzread or gzwrite on the
- given compressed file. This position represents a number of bytes in the
- uncompressed data stream.
-
- gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
-*/
-
-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
-/*
- Returns 1 when EOF has previously been detected reading the given
- input stream, otherwise zero.
-*/
-
-ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
-/*
- Returns 1 if file is being read directly without decompression, otherwise
- zero.
-*/
-
-ZEXTERN int ZEXPORT gzclose OF((gzFile file));
-/*
- Flushes all pending output if necessary, closes the compressed file
- and deallocates all the (de)compression state. The return value is the zlib
- error number (see function gzerror below).
-*/
-
-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
-/*
- Returns the error message for the last error which occurred on the
- given compressed file. errnum is set to zlib error number. If an
- error occurred in the file system and not in the compression library,
- errnum is set to Z_ERRNO and the application may consult errno
- to get the exact error code.
-*/
-
-ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
-/*
- Clears the error and end-of-file flags for file. This is analogous to the
- clearerr() function in stdio. This is useful for continuing to read a gzip
- file that is being written concurrently.
-*/
-
- /* checksum functions */
-
-/*
- These functions are not related to compression but are exported
- anyway because they might be useful in applications using the
- compression library.
-*/
-
-ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
-/*
- Update a running Adler-32 checksum with the bytes buf[0..len-1] and
- return the updated checksum. If buf is NULL, this function returns
- the required initial value for the checksum.
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
- much faster. Usage example:
-
- uLong adler = adler32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- adler = adler32(adler, buffer, length);
- }
- if (adler != original_adler) error();
-*/
-
-ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
- z_off_t len2));
-/*
- Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
- and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
- each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
- seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
-*/
-
-ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
-/*
- Update a running CRC-32 with the bytes buf[0..len-1] and return the
- updated CRC-32. If buf is NULL, this function returns the required initial
- value for the for the crc. Pre- and post-conditioning (one's complement) is
- performed within this function so it shouldn't be done by the application.
- Usage example:
-
- uLong crc = crc32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- crc = crc32(crc, buffer, length);
- }
- if (crc != original_crc) error();
-*/
-
-ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
-
-/*
- Combine two CRC-32 check values into one. For two sequences of bytes,
- seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
- calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
- check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
- len2.
-*/
-
-
- /* various hacks, don't look :) */
-
-/* deflateInit and inflateInit are macros to allow checking the zlib version
- * and the compiler's view of z_stream:
- */
-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
- int windowBits, int memLevel,
- int strategy, const char *version,
- int stream_size));
-ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
- unsigned char FAR *window,
- const char *version,
- int stream_size));
-#define deflateInit(strm, level) \
- deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit(strm) \
- inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
-#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
- deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
- (strategy), ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit2(strm, windowBits) \
- inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
-#define inflateBackInit(strm, windowBits, window) \
- inflateBackInit_((strm), (windowBits), (window), \
- ZLIB_VERSION, sizeof(z_stream))
-
-
-#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
- struct internal_state {int dummy;}; /* hack for buggy compilers */
-#endif
-
-ZEXTERN const char * ZEXPORT zError OF((int));
-ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
-ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ZLIB_H */
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/jpeg.def b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/jpeg.def
deleted file mode 100644
index 8861af16..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/jpeg.def
+++ /dev/null
@@ -1,103 +0,0 @@
-; h:\mingw\3.3.1\bin\dlltool.exe --output-def=jpeg.def jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o jfdctint.o jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o jcomapi.o jutils.o jerror.o jmemmgr.o jmemnobs.o jpeg-dllversion.o jpeg-dll-res.o
-EXPORTS
- jcopy_block_row @ 1 ;
- jcopy_sample_rows @ 2 ;
- jdiv_round_up @ 3 ;
- jinit_1pass_quantizer @ 4 ;
- jinit_2pass_quantizer @ 5 ;
- jinit_c_coef_controller @ 6 ;
- jinit_c_main_controller @ 7 ;
- jinit_c_master_control @ 8 ;
- jinit_c_prep_controller @ 9 ;
- jinit_color_converter @ 10 ;
- jinit_color_deconverter @ 11 ;
- jinit_compress_master @ 12 ;
- jinit_d_coef_controller @ 13 ;
- jinit_d_main_controller @ 14 ;
- jinit_d_post_controller @ 15 ;
- jinit_downsampler @ 16 ;
- jinit_forward_dct @ 17 ;
- jinit_huff_decoder @ 18 ;
- jinit_huff_encoder @ 19 ;
- jinit_input_controller @ 20 ;
- jinit_inverse_dct @ 21 ;
- jinit_marker_reader @ 22 ;
- jinit_marker_writer @ 23 ;
- jinit_master_decompress @ 24 ;
- jinit_memory_mgr @ 25 ;
- jinit_merged_upsampler @ 26 ;
- jinit_phuff_decoder @ 27 ;
- jinit_phuff_encoder @ 28 ;
- jinit_upsampler @ 29 ;
- jpeg_CreateCompress @ 30 ;
- jpeg_CreateDecompress @ 31 ;
- jpeg_abort @ 32 ;
- jpeg_abort_compress @ 33 ;
- jpeg_abort_decompress @ 34 ;
- jpeg_add_quant_table @ 35 ;
- jpeg_alloc_huff_table @ 36 ;
- jpeg_alloc_quant_table @ 37 ;
- jpeg_calc_output_dimensions @ 38 ;
- jpeg_consume_input @ 39 ;
- jpeg_copy_critical_parameters @ 40 ;
- jpeg_default_colorspace @ 41 ;
- jpeg_destroy @ 42 ;
- jpeg_destroy_compress @ 43 ;
- jpeg_destroy_decompress @ 44 ;
- jpeg_fdct_float @ 45 ;
- jpeg_fdct_ifast @ 46 ;
- jpeg_fdct_islow @ 47 ;
- jpeg_fill_bit_buffer @ 48 ;
- jpeg_finish_compress @ 49 ;
- jpeg_finish_decompress @ 50 ;
- jpeg_finish_output @ 51 ;
- jpeg_free_large @ 52 ;
- jpeg_free_small @ 53 ;
- jpeg_gen_optimal_table @ 54 ;
- jpeg_get_large @ 55 ;
- jpeg_get_small @ 56 ;
- jpeg_has_multiple_scans @ 57 ;
- jpeg_huff_decode @ 58 ;
- jpeg_idct_1x1 @ 59 ;
- jpeg_idct_2x2 @ 60 ;
- jpeg_idct_4x4 @ 61 ;
- jpeg_idct_float @ 62 ;
- jpeg_idct_ifast @ 63 ;
- jpeg_idct_islow @ 64 ;
- jpeg_input_complete @ 65 ;
- jpeg_make_c_derived_tbl @ 66 ;
- jpeg_make_d_derived_tbl @ 67 ;
- jpeg_mem_available @ 68 ;
- jpeg_mem_init @ 69 ;
- jpeg_mem_term @ 70 ;
- jpeg_new_colormap @ 71 ;
- jpeg_open_backing_store @ 72 ;
- jpeg_quality_scaling @ 73 ;
- jpeg_read_coefficients @ 74 ;
- jpeg_read_header @ 75 ;
- jpeg_read_raw_data @ 76 ;
- jpeg_read_scanlines @ 77 ;
- jpeg_resync_to_restart @ 78 ;
- jpeg_save_markers @ 79 ;
- jpeg_set_colorspace @ 80 ;
- jpeg_set_defaults @ 81 ;
- jpeg_set_linear_quality @ 82 ;
- jpeg_set_marker_processor @ 83 ;
- jpeg_set_quality @ 84 ;
- jpeg_simple_progression @ 85 ;
- jpeg_start_compress @ 86 ;
- jpeg_start_decompress @ 87 ;
- jpeg_start_output @ 88 ;
- jpeg_std_error @ 89 ;
- jpeg_stdio_dest @ 90 ;
- jpeg_stdio_src @ 91 ;
- jpeg_suppress_tables @ 92 ;
- jpeg_write_coefficients @ 93 ;
- jpeg_write_m_byte @ 94 ;
- jpeg_write_m_header @ 95 ;
- jpeg_write_marker @ 96 ;
- jpeg_write_raw_data @ 97 ;
- jpeg_write_scanlines @ 98 ;
- jpeg_write_tables @ 99 ;
- jround_up @ 100 ;
- jzero_far @ 101 ;
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/jpeg.lib b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/jpeg.lib
deleted file mode 100644
index 8fc184aa..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/jpeg.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libpng.def b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libpng.def
deleted file mode 100644
index 31ff9128..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libpng.def
+++ /dev/null
@@ -1,372 +0,0 @@
-; h:\mingw\3.3.1\bin\dlltool.exe --export-all-symbols --output-def=libpng.def png.dll.o pngset.dll.o pngget.dll.o pngrutil.dll.o pngtrans.dll.o pngwutil.dll.o pngread.dll.o pngrio.dll.o pngwio.dll.o pngwrite.dll.o pngrtran.dll.o pngwtran.dll.o pngmem.dll.o pngerror.dll.o pngpread.dll.o pnggccrd.dll.o libpng-dllversion.dll.o libpng-dll-res.o
-EXPORTS
- ActiveMask @ 1 DATA ;
- ActiveMask2 @ 2 DATA ;
- ActiveMaskEnd @ 3 DATA ;
- DllGetVersion @ 4 ;
- HBClearMask @ 5 DATA ;
- LBCarryMask @ 6 DATA ;
- ShiftBpp @ 7 DATA ;
- ShiftRem @ 8 DATA ;
- png_IDAT @ 9 DATA ;
- png_IEND @ 10 DATA ;
- png_IHDR @ 11 DATA ;
- png_PLTE @ 12 DATA ;
- png_access_version_number @ 13 ;
- png_bKGD @ 14 DATA ;
- png_build_gamma_table @ 15 ;
- png_build_grayscale_palette @ 16 ;
- png_cHRM @ 17 DATA ;
- png_calculate_crc @ 18 ;
- png_check_chunk_name @ 19 ;
- png_check_keyword @ 20 ;
- png_check_sig @ 21 ;
- png_chunk_error @ 22 ;
- png_chunk_warning @ 23 ;
- png_combine_row @ 24 ;
- png_convert_from_struct_tm @ 25 ;
- png_convert_from_time_t @ 26 ;
- png_convert_to_rfc1123 @ 27 ;
- png_crc_error @ 28 ;
- png_crc_finish @ 29 ;
- png_crc_read @ 30 ;
- png_create_info_struct @ 31 ;
- png_create_read_struct @ 32 ;
- png_create_read_struct_2 @ 33 ;
- png_create_struct @ 34 ;
- png_create_struct_2 @ 35 ;
- png_create_write_struct @ 36 ;
- png_create_write_struct_2 @ 37 ;
- png_data_freer @ 38 ;
- png_decompress_chunk @ 39 ;
- png_default_flush @ 40 ;
- png_default_read_data @ 41 ;
- png_default_write_data @ 42 ;
- png_destroy_info_struct @ 43 ;
- png_destroy_read_struct @ 44 ;
- png_destroy_struct @ 45 ;
- png_destroy_struct_2 @ 46 ;
- png_destroy_write_struct @ 47 ;
- png_do_background @ 48 ;
- png_do_bgr @ 49 ;
- png_do_chop @ 50 ;
- png_do_dither @ 51 ;
- png_do_expand @ 52 ;
- png_do_expand_palette @ 53 ;
- png_do_gamma @ 54 ;
- png_do_gray_to_rgb @ 55 ;
- png_do_invert @ 56 ;
- png_do_pack @ 57 ;
- png_do_packswap @ 58 ;
- png_do_read_filler @ 59 ;
- png_do_read_interlace @ 60 ;
- png_do_read_intrapixel @ 61 ;
- png_do_read_invert_alpha @ 62 ;
- png_do_read_swap_alpha @ 63 ;
- png_do_read_transformations @ 64 ;
- png_do_rgb_to_gray @ 65 ;
- png_do_shift @ 66 ;
- png_do_strip_filler @ 67 ;
- png_do_swap @ 68 ;
- png_do_unpack @ 69 ;
- png_do_unshift @ 70 ;
- png_do_write_interlace @ 71 ;
- png_do_write_intrapixel @ 72 ;
- png_do_write_invert_alpha @ 73 ;
- png_do_write_swap_alpha @ 74 ;
- png_do_write_transformations @ 75 ;
- png_error @ 76 ;
- png_flush @ 77 ;
- png_free @ 78 ;
- png_free_data @ 79 ;
- png_free_default @ 80 ;
- png_gAMA @ 81 DATA ;
- png_get_IHDR @ 82 ;
- png_get_PLTE @ 83 ;
- png_get_asm_flagmask @ 84 ;
- png_get_asm_flags @ 85 ;
- png_get_bKGD @ 86 ;
- png_get_bit_depth @ 87 ;
- png_get_cHRM @ 88 ;
- png_get_cHRM_fixed @ 89 ;
- png_get_channels @ 90 ;
- png_get_color_type @ 91 ;
- png_get_compression_buffer_size @ 92 ;
- png_get_compression_type @ 93 ;
- png_get_copyright @ 94 ;
- png_get_error_ptr @ 95 ;
- png_get_filter_type @ 96 ;
- png_get_gAMA @ 97 ;
- png_get_gAMA_fixed @ 98 ;
- png_get_hIST @ 99 ;
- png_get_header_ver @ 100 ;
- png_get_header_version @ 101 ;
- png_get_iCCP @ 102 ;
- png_get_image_height @ 103 ;
- png_get_image_width @ 104 ;
- png_get_int_32 @ 105 ;
- png_get_interlace_type @ 106 ;
- png_get_io_ptr @ 107 ;
- png_get_libpng_ver @ 108 ;
- png_get_mem_ptr @ 109 ;
- png_get_mmx_bitdepth_threshold @ 110 ;
- png_get_mmx_flagmask @ 111 ;
- png_get_mmx_rowbytes_threshold @ 112 ;
- png_get_oFFs @ 113 ;
- png_get_pCAL @ 114 ;
- png_get_pHYs @ 115 ;
- png_get_pixel_aspect_ratio @ 116 ;
- png_get_pixels_per_meter @ 117 ;
- png_get_progressive_ptr @ 118 ;
- png_get_rgb_to_gray_status @ 119 ;
- png_get_rowbytes @ 120 ;
- png_get_rows @ 121 ;
- png_get_sBIT @ 122 ;
- png_get_sCAL @ 123 ;
- png_get_sPLT @ 124 ;
- png_get_sRGB @ 125 ;
- png_get_signature @ 126 ;
- png_get_tIME @ 127 ;
- png_get_tRNS @ 128 ;
- png_get_text @ 129 ;
- png_get_uint_16 @ 130 ;
- png_get_uint_31 @ 131 ;
- png_get_uint_32 @ 132 ;
- png_get_unknown_chunks @ 133 ;
- png_get_user_chunk_ptr @ 134 ;
- png_get_user_height_max @ 135 ;
- png_get_user_transform_ptr @ 136 ;
- png_get_user_width_max @ 137 ;
- png_get_valid @ 138 ;
- png_get_x_offset_microns @ 139 ;
- png_get_x_offset_pixels @ 140 ;
- png_get_x_pixels_per_meter @ 141 ;
- png_get_y_offset_microns @ 142 ;
- png_get_y_offset_pixels @ 143 ;
- png_get_y_pixels_per_meter @ 144 ;
- png_hIST @ 145 DATA ;
- png_handle_IEND @ 146 ;
- png_handle_IHDR @ 147 ;
- png_handle_PLTE @ 148 ;
- png_handle_as_unknown @ 149 ;
- png_handle_bKGD @ 150 ;
- png_handle_cHRM @ 151 ;
- png_handle_gAMA @ 152 ;
- png_handle_hIST @ 153 ;
- png_handle_iCCP @ 154 ;
- png_handle_oFFs @ 155 ;
- png_handle_pCAL @ 156 ;
- png_handle_pHYs @ 157 ;
- png_handle_sBIT @ 158 ;
- png_handle_sCAL @ 159 ;
- png_handle_sPLT @ 160 ;
- png_handle_sRGB @ 161 ;
- png_handle_tEXt @ 162 ;
- png_handle_tIME @ 163 ;
- png_handle_tRNS @ 164 ;
- png_handle_unknown @ 165 ;
- png_handle_zTXt @ 166 ;
- png_iCCP @ 167 DATA ;
- png_iTXt @ 168 DATA ;
- png_info_destroy @ 169 ;
- png_info_init @ 170 ;
- png_info_init_3 @ 171 ;
- png_init_io @ 172 ;
- png_init_mmx_flags @ 173 ;
- png_init_read_transformations @ 174 ;
- png_libpng_ver @ 175 DATA ;
- png_malloc @ 176 ;
- png_malloc_default @ 177 ;
- png_malloc_warn @ 178 ;
- png_memcpy_check @ 179 ;
- png_memset_check @ 180 ;
- png_mmx_support @ 181 ;
- png_oFFs @ 182 DATA ;
- png_pCAL @ 183 DATA ;
- png_pHYs @ 184 DATA ;
- png_pass_dsp_mask @ 185 DATA ;
- png_pass_inc @ 186 DATA ;
- png_pass_mask @ 187 DATA ;
- png_pass_start @ 188 DATA ;
- png_pass_width @ 189 DATA ;
- png_pass_yinc @ 190 DATA ;
- png_pass_ystart @ 191 DATA ;
- png_permit_empty_plte @ 192 ;
- png_permit_mng_features @ 193 ;
- png_process_IDAT_data @ 194 ;
- png_process_data @ 195 ;
- png_process_some_data @ 196 ;
- png_progressive_combine_row @ 197 ;
- png_push_crc_finish @ 198 ;
- png_push_crc_skip @ 199 ;
- png_push_fill_buffer @ 200 ;
- png_push_handle_tEXt @ 201 ;
- png_push_handle_unknown @ 202 ;
- png_push_handle_zTXt @ 203 ;
- png_push_have_end @ 204 ;
- png_push_have_info @ 205 ;
- png_push_have_row @ 206 ;
- png_push_process_row @ 207 ;
- png_push_read_IDAT @ 208 ;
- png_push_read_chunk @ 209 ;
- png_push_read_sig @ 210 ;
- png_push_read_tEXt @ 211 ;
- png_push_read_zTXt @ 212 ;
- png_push_restore_buffer @ 213 ;
- png_push_save_buffer @ 214 ;
- png_read_data @ 215 ;
- png_read_destroy @ 216 ;
- png_read_end @ 217 ;
- png_read_filter_row @ 218 ;
- png_read_finish_row @ 219 ;
- png_read_image @ 220 ;
- png_read_info @ 221 ;
- png_read_init @ 222 ;
- png_read_init_2 @ 223 ;
- png_read_init_3 @ 224 ;
- png_read_png @ 225 ;
- png_read_push_finish_row @ 226 ;
- png_read_row @ 227 ;
- png_read_rows @ 228 ;
- png_read_start_row @ 229 ;
- png_read_transform_info @ 230 ;
- png_read_update_info @ 231 ;
- png_reset_crc @ 232 ;
- png_reset_zstream @ 233 ;
- png_sBIT @ 234 DATA ;
- png_sCAL @ 235 DATA ;
- png_sPLT @ 236 DATA ;
- png_sRGB @ 237 DATA ;
- png_save_int_32 @ 238 ;
- png_save_uint_16 @ 239 ;
- png_save_uint_32 @ 240 ;
- png_set_IHDR @ 241 ;
- png_set_PLTE @ 242 ;
- png_set_add_alpha @ 243 ;
- png_set_asm_flags @ 244 ;
- png_set_bKGD @ 245 ;
- png_set_background @ 246 ;
- png_set_bgr @ 247 ;
- png_set_cHRM @ 248 ;
- png_set_cHRM_fixed @ 249 ;
- png_set_compression_buffer_size @ 250 ;
- png_set_compression_level @ 251 ;
- png_set_compression_mem_level @ 252 ;
- png_set_compression_method @ 253 ;
- png_set_compression_strategy @ 254 ;
- png_set_compression_window_bits @ 255 ;
- png_set_crc_action @ 256 ;
- png_set_dither @ 257 ;
- png_set_error_fn @ 258 ;
- png_set_expand @ 259 ;
- png_set_filler @ 260 ;
- png_set_filter @ 261 ;
- png_set_filter_heuristics @ 262 ;
- png_set_flush @ 263 ;
- png_set_gAMA @ 264 ;
- png_set_gAMA_fixed @ 265 ;
- png_set_gamma @ 266 ;
- png_set_gray_1_2_4_to_8 @ 267 ;
- png_set_gray_to_rgb @ 268 ;
- png_set_hIST @ 269 ;
- png_set_iCCP @ 270 ;
- png_set_interlace_handling @ 271 ;
- png_set_invalid @ 272 ;
- png_set_invert_alpha @ 273 ;
- png_set_invert_mono @ 274 ;
- png_set_keep_unknown_chunks @ 275 ;
- png_set_mem_fn @ 276 ;
- png_set_mmx_thresholds @ 277 ;
- png_set_oFFs @ 278 ;
- png_set_pCAL @ 279 ;
- png_set_pHYs @ 280 ;
- png_set_packing @ 281 ;
- png_set_packswap @ 282 ;
- png_set_palette_to_rgb @ 283 ;
- png_set_progressive_read_fn @ 284 ;
- png_set_read_fn @ 285 ;
- png_set_read_status_fn @ 286 ;
- png_set_read_user_chunk_fn @ 287 ;
- png_set_read_user_transform_fn @ 288 ;
- png_set_rgb_to_gray @ 289 ;
- png_set_rgb_to_gray_fixed @ 290 ;
- png_set_rows @ 291 ;
- png_set_sBIT @ 292 ;
- png_set_sCAL @ 293 ;
- png_set_sPLT @ 294 ;
- png_set_sRGB @ 295 ;
- png_set_sRGB_gAMA_and_cHRM @ 296 ;
- png_set_shift @ 297 ;
- png_set_sig_bytes @ 298 ;
- png_set_strip_16 @ 299 ;
- png_set_strip_alpha @ 300 ;
- png_set_strip_error_numbers @ 301 ;
- png_set_swap @ 302 ;
- png_set_swap_alpha @ 303 ;
- png_set_tIME @ 304 ;
- png_set_tRNS @ 305 ;
- png_set_tRNS_to_alpha @ 306 ;
- png_set_text @ 307 ;
- png_set_text_2 @ 308 ;
- png_set_unknown_chunk_location @ 309 ;
- png_set_unknown_chunks @ 310 ;
- png_set_user_limits @ 311 ;
- png_set_user_transform_info @ 312 ;
- png_set_write_fn @ 313 ;
- png_set_write_status_fn @ 314 ;
- png_set_write_user_transform_fn @ 315 ;
- png_sig @ 316 DATA ;
- png_sig_cmp @ 317 ;
- png_squelch_warnings @ 318 ;
- png_start_read_image @ 319 ;
- png_tEXt @ 320 DATA ;
- png_tIME @ 321 DATA ;
- png_tRNS @ 322 DATA ;
- png_warning @ 323 ;
- png_write_IDAT @ 324 ;
- png_write_IEND @ 325 ;
- png_write_IHDR @ 326 ;
- png_write_PLTE @ 327 ;
- png_write_bKGD @ 328 ;
- png_write_cHRM @ 329 ;
- png_write_cHRM_fixed @ 330 ;
- png_write_chunk @ 331 ;
- png_write_chunk_data @ 332 ;
- png_write_chunk_end @ 333 ;
- png_write_chunk_start @ 334 ;
- png_write_data @ 335 ;
- png_write_destroy @ 336 ;
- png_write_end @ 337 ;
- png_write_filtered_row @ 338 ;
- png_write_find_filter @ 339 ;
- png_write_finish_row @ 340 ;
- png_write_flush @ 341 ;
- png_write_gAMA @ 342 ;
- png_write_gAMA_fixed @ 343 ;
- png_write_hIST @ 344 ;
- png_write_iCCP @ 345 ;
- png_write_image @ 346 ;
- png_write_info @ 347 ;
- png_write_info_before_PLTE @ 348 ;
- png_write_init @ 349 ;
- png_write_init_2 @ 350 ;
- png_write_init_3 @ 351 ;
- png_write_oFFs @ 352 ;
- png_write_pCAL @ 353 ;
- png_write_pHYs @ 354 ;
- png_write_png @ 355 ;
- png_write_row @ 356 ;
- png_write_rows @ 357 ;
- png_write_sBIT @ 358 ;
- png_write_sCAL @ 359 ;
- png_write_sPLT @ 360 ;
- png_write_sRGB @ 361 ;
- png_write_sig @ 362 ;
- png_write_start_row @ 363 ;
- png_write_tEXt @ 364 ;
- png_write_tIME @ 365 ;
- png_write_tRNS @ 366 ;
- png_write_zTXt @ 367 ;
- png_zTXt @ 368 DATA ;
- png_zalloc @ 369 ;
- png_zfree @ 370 ;
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libpng.lib b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libpng.lib
deleted file mode 100644
index 072162f3..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libpng.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libpng12.def b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libpng12.def
deleted file mode 100644
index 0ce5ca98..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libpng12.def
+++ /dev/null
@@ -1,239 +0,0 @@
-LIBRARY libpng12.dll
-EXPORTS
-DllGetVersion
-png_IDAT DATA
-png_IEND DATA
-png_IHDR DATA
-png_PLTE DATA
-png_access_version_number
-png_bKGD DATA
-png_build_grayscale_palette
-png_cHRM DATA
-png_check_sig
-png_chunk_error
-png_chunk_warning
-png_convert_from_struct_tm
-png_convert_from_time_t
-png_convert_to_rfc1123
-png_create_info_struct
-png_create_read_struct
-png_create_read_struct_2
-png_create_write_struct
-png_create_write_struct_2
-png_data_freer
-png_destroy_info_struct
-png_destroy_read_struct
-png_destroy_write_struct
-png_error
-png_free
-png_free_data
-png_free_default
-png_gAMA DATA
-png_get_IHDR
-png_get_PLTE
-png_get_asm_flagmask
-png_get_asm_flags
-png_get_bKGD
-png_get_bit_depth
-png_get_cHRM
-png_get_cHRM_fixed
-png_get_channels
-png_get_color_type
-png_get_compression_buffer_size
-png_get_compression_type
-png_get_copyright
-png_get_error_ptr
-png_get_filter_type
-png_get_gAMA
-png_get_gAMA_fixed
-png_get_hIST
-png_get_header_ver
-png_get_header_version
-png_get_iCCP
-png_get_image_height
-png_get_image_width
-png_get_int_32
-png_get_interlace_type
-png_get_io_ptr
-png_get_libpng_ver
-png_get_mem_ptr
-png_get_mmx_bitdepth_threshold
-png_get_mmx_flagmask
-png_get_mmx_rowbytes_threshold
-png_get_oFFs
-png_get_pCAL
-png_get_pHYs
-png_get_pixel_aspect_ratio
-png_get_pixels_per_meter
-png_get_progressive_ptr
-png_get_rgb_to_gray_status
-png_get_rowbytes
-png_get_rows
-png_get_sBIT
-png_get_sCAL
-png_get_sPLT
-png_get_sRGB
-png_get_signature
-png_get_tIME
-png_get_tRNS
-png_get_text
-png_get_uint_16
-png_get_uint_31
-png_get_uint_32
-png_get_unknown_chunks
-png_get_user_chunk_ptr
-png_get_user_height_max
-png_get_user_transform_ptr
-png_get_user_width_max
-png_get_valid
-png_get_x_offset_microns
-png_get_x_offset_pixels
-png_get_x_pixels_per_meter
-png_get_y_offset_microns
-png_get_y_offset_pixels
-png_get_y_pixels_per_meter
-png_hIST DATA
-png_handle_as_unknown
-png_iCCP DATA
-png_iTXt DATA
-png_info_init
-png_info_init_3
-png_init_io
-png_libpng_ver DATA
-png_malloc
-png_malloc_default
-png_malloc_warn
-png_memcpy_check
-png_memset_check
-png_mmx_support
-png_oFFs DATA
-png_pCAL DATA
-png_pHYs DATA
-png_pass_dsp_mask DATA
-png_pass_inc DATA
-png_pass_mask DATA
-png_pass_start DATA
-png_pass_yinc DATA
-png_pass_ystart DATA
-png_permit_empty_plte
-png_permit_mng_features
-png_process_data
-png_progressive_combine_row
-png_read_destroy
-png_read_end
-png_read_image
-png_read_info
-png_read_init
-png_read_init_2
-png_read_init_3
-png_read_png
-png_read_row
-png_read_rows
-png_read_update_info
-png_reset_zstream
-png_sBIT DATA
-png_sCAL DATA
-png_sPLT DATA
-png_sRGB DATA
-png_save_int_32
-png_save_uint_16
-png_save_uint_32
-png_set_IHDR
-png_set_PLTE
-png_set_add_alpha
-png_set_asm_flags
-png_set_bKGD
-png_set_background
-png_set_bgr
-png_set_cHRM
-png_set_cHRM_fixed
-png_set_compression_buffer_size
-png_set_compression_level
-png_set_compression_mem_level
-png_set_compression_method
-png_set_compression_strategy
-png_set_compression_window_bits
-png_set_crc_action
-png_set_dither
-png_set_error_fn
-png_set_expand
-png_set_expand_gray_1_2_4_to_8
-png_set_filler
-png_set_filter
-png_set_filter_heuristics
-png_set_flush
-png_set_gAMA
-png_set_gAMA_fixed
-png_set_gamma
-png_set_gray_1_2_4_to_8
-png_set_gray_to_rgb
-png_set_hIST
-png_set_iCCP
-png_set_interlace_handling
-png_set_invalid
-png_set_invert_alpha
-png_set_invert_mono
-png_set_keep_unknown_chunks
-png_set_mem_fn
-png_set_mmx_thresholds
-png_set_oFFs
-png_set_pCAL
-png_set_pHYs
-png_set_packing
-png_set_packswap
-png_set_palette_to_rgb
-png_set_progressive_read_fn
-png_set_read_fn
-png_set_read_status_fn
-png_set_read_user_chunk_fn
-png_set_read_user_transform_fn
-png_set_rgb_to_gray
-png_set_rgb_to_gray_fixed
-png_set_rows
-png_set_sBIT
-png_set_sCAL
-png_set_sPLT
-png_set_sRGB
-png_set_sRGB_gAMA_and_cHRM
-png_set_shift
-png_set_sig_bytes
-png_set_strip_16
-png_set_strip_alpha
-png_set_strip_error_numbers
-png_set_swap
-png_set_swap_alpha
-png_set_tIME
-png_set_tRNS
-png_set_tRNS_to_alpha
-png_set_text
-png_set_unknown_chunk_location
-png_set_unknown_chunks
-png_set_user_limits
-png_set_user_transform_info
-png_set_write_fn
-png_set_write_status_fn
-png_set_write_user_transform_fn
-png_sig DATA
-png_sig_cmp
-png_start_read_image
-png_tEXt DATA
-png_tIME DATA
-png_tRNS DATA
-png_warning
-png_write_chunk
-png_write_chunk_data
-png_write_chunk_end
-png_write_chunk_start
-png_write_destroy
-png_write_end
-png_write_flush
-png_write_image
-png_write_info
-png_write_info_before_PLTE
-png_write_init
-png_write_init_2
-png_write_init_3
-png_write_png
-png_write_row
-png_write_rows
-png_zTXt DATA
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libtiff.def b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libtiff.def
deleted file mode 100644
index d430edd8..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/libtiff.def
+++ /dev/null
@@ -1,154 +0,0 @@
-; g:\mingw\3.3.1\bin\dlltool.exe --output-def=libtiff.def tif_aux.o tif_close.o tif_codec.o tif_color.o tif_compress.o tif_dir.o tif_dirinfo.o tif_dirread.o tif_dirwrite.o tif_dumpmode.o tif_error.o tif_extension.o tif_fax3.o tif_fax3sm.o tif_flush.o tif_getimage.o tif_jpeg.o tif_luv.o tif_lzw.o tif_next.o tif_ojpeg.o tif_open.o tif_packbits.o tif_pixarlog.o tif_predict.o tif_print.o tif_read.o tif_strip.o tif_swab.o tif_thunder.o tif_tile.o tif_unix.o tif_version.o tif_warning.o tif_write.o tif_zip.o libtiff-dllversion.o libtiff-dll-res.o
-EXPORTS
- DllGetVersion @ 1 ;
- LogL10fromY @ 2 ;
- LogL10toY @ 3 ;
- LogL16fromY @ 4 ;
- LogL16toY @ 5 ;
- LogLuv24fromXYZ @ 6 ;
- LogLuv24toXYZ @ 7 ;
- LogLuv32fromXYZ @ 8 ;
- LogLuv32toXYZ @ 9 ;
- TIFFAccessTagMethods @ 10 ;
- TIFFCIELabToRGBInit @ 11 ;
- TIFFCIELabToXYZ @ 12 ;
- TIFFCheckTile @ 13 ;
- TIFFCheckpointDirectory @ 14 ;
- TIFFCleanup @ 15 ;
- TIFFClientOpen @ 16 ;
- TIFFClientdata @ 17 ;
- TIFFClose @ 18 ;
- TIFFComputeStrip @ 19 ;
- TIFFComputeTile @ 20 ;
- TIFFCreateDirectory @ 21 ;
- TIFFCurrentDirOffset @ 22 ;
- TIFFCurrentDirectory @ 23 ;
- TIFFCurrentRow @ 24 ;
- TIFFCurrentStrip @ 25 ;
- TIFFCurrentTile @ 26 ;
- TIFFDataWidth @ 27 ;
- TIFFDefaultStripSize @ 28 ;
- TIFFDefaultTileSize @ 29 ;
- TIFFError @ 30 ;
- TIFFErrorExt @ 31 ;
- TIFFFdOpen @ 32 ;
- TIFFFieldWithName @ 33 ;
- TIFFFieldWithTag @ 34 ;
- TIFFFileName @ 35 ;
- TIFFFileno @ 36 ;
- TIFFFindCODEC @ 37 ;
- TIFFFindFieldInfo @ 38 ;
- TIFFFindFieldInfoByName @ 39 ;
- TIFFFlush @ 40 ;
- TIFFFlushData @ 41 ;
- TIFFFreeDirectory @ 42 ;
- TIFFGetBitRevTable @ 43 ;
- TIFFGetClientInfo @ 44 ;
- TIFFGetCloseProc @ 45 ;
- TIFFGetConfiguredCODECs @ 46 ;
- TIFFGetField @ 47 ;
- TIFFGetFieldDefaulted @ 48 ;
- TIFFGetMapFileProc @ 49 ;
- TIFFGetMode @ 50 ;
- TIFFGetReadProc @ 51 ;
- TIFFGetSeekProc @ 52 ;
- TIFFGetSizeProc @ 53 ;
- TIFFGetTagListCount @ 54 ;
- TIFFGetTagListEntry @ 55 ;
- TIFFGetUnmapFileProc @ 56 ;
- TIFFGetVersion @ 57 ;
- TIFFGetWriteProc @ 58 ;
- TIFFIsBigEndian @ 59 ;
- TIFFIsByteSwapped @ 60 ;
- TIFFIsCODECConfigured @ 61 ;
- TIFFIsMSB2LSB @ 62 ;
- TIFFIsTiled @ 63 ;
- TIFFIsUpSampled @ 64 ;
- TIFFLastDirectory @ 65 ;
- TIFFMergeFieldInfo @ 66 ;
- TIFFNumberOfDirectories @ 67 ;
- TIFFNumberOfStrips @ 68 ;
- TIFFNumberOfTiles @ 69 ;
- TIFFOpen @ 70 ;
- TIFFOpenW @ 71 ;
- TIFFPrintDirectory @ 72 ;
- TIFFRGBAImageBegin @ 73 ;
- TIFFRGBAImageEnd @ 74 ;
- TIFFRGBAImageGet @ 75 ;
- TIFFRGBAImageOK @ 76 ;
- TIFFRasterScanlineSize @ 77 ;
- TIFFRawStripSize @ 78 ;
- TIFFReadBufferSetup @ 79 ;
- TIFFReadCustomDirectory @ 80 ;
- TIFFReadDirectory @ 81 ;
- TIFFReadEXIFDirectory @ 82 ;
- TIFFReadEncodedStrip @ 83 ;
- TIFFReadEncodedTile @ 84 ;
- TIFFReadRGBAImage @ 85 ;
- TIFFReadRGBAImageOriented @ 86 ;
- TIFFReadRGBAStrip @ 87 ;
- TIFFReadRGBATile @ 88 ;
- TIFFReadRawStrip @ 89 ;
- TIFFReadRawTile @ 90 ;
- TIFFReadScanline @ 91 ;
- TIFFReadTile @ 92 ;
- TIFFReassignTagToIgnore @ 93 ;
- TIFFRegisterCODEC @ 94 ;
- TIFFReverseBits @ 95 ;
- TIFFRewriteDirectory @ 96 ;
- TIFFScanlineSize @ 97 ;
- TIFFSetClientInfo @ 98 ;
- TIFFSetClientdata @ 99 ;
- TIFFSetDirectory @ 100 ;
- TIFFSetErrorHandler @ 101 ;
- TIFFSetErrorHandlerExt @ 102 ;
- TIFFSetField @ 103 ;
- TIFFSetFileName @ 104 ;
- TIFFSetFileno @ 105 ;
- TIFFSetMode @ 106 ;
- TIFFSetSubDirectory @ 107 ;
- TIFFSetTagExtender @ 108 ;
- TIFFSetWarningHandler @ 109 ;
- TIFFSetWarningHandlerExt @ 110 ;
- TIFFSetWriteOffset @ 111 ;
- TIFFSetupStrips @ 112 ;
- TIFFStripSize @ 113 ;
- TIFFSwabArrayOfDouble @ 114 ;
- TIFFSwabArrayOfLong @ 115 ;
- TIFFSwabArrayOfShort @ 116 ;
- TIFFSwabArrayOfTriples @ 117 ;
- TIFFSwabDouble @ 118 ;
- TIFFSwabLong @ 119 ;
- TIFFSwabShort @ 120 ;
- TIFFTileRowSize @ 121 ;
- TIFFTileSize @ 122 ;
- TIFFUnRegisterCODEC @ 123 ;
- TIFFUnlinkDirectory @ 124 ;
- TIFFVGetField @ 125 ;
- TIFFVGetFieldDefaulted @ 126 ;
- TIFFVSetField @ 127 ;
- TIFFVStripSize @ 128 ;
- TIFFVTileSize @ 129 ;
- TIFFWarning @ 130 ;
- TIFFWarningExt @ 131 ;
- TIFFWriteBufferSetup @ 132 ;
- TIFFWriteCheck @ 133 ;
- TIFFWriteDirectory @ 134 ;
- TIFFWriteEncodedStrip @ 135 ;
- TIFFWriteEncodedTile @ 136 ;
- TIFFWriteRawStrip @ 137 ;
- TIFFWriteRawTile @ 138 ;
- TIFFWriteScanline @ 139 ;
- TIFFWriteTile @ 140 ;
- TIFFXYZToRGB @ 141 ;
- TIFFYCbCrToRGBInit @ 142 ;
- TIFFYCbCrtoRGB @ 143 ;
- XYZtoRGB24 @ 144 ;
- _TIFFfree @ 145 ;
- _TIFFmalloc @ 146 ;
- _TIFFmemcmp @ 147 ;
- _TIFFmemcpy @ 148 ;
- _TIFFmemset @ 149 ;
- _TIFFrealloc @ 150 ;
- uv_decode @ 151 ;
- uv_encode @ 152 ;
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/tiff.lib b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/tiff.lib
deleted file mode 100644
index 77519673..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/tiff.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/zlib.def b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/zlib.def
deleted file mode 100644
index 6381eccc..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/zlib.def
+++ /dev/null
@@ -1,75 +0,0 @@
-; h:\mingw\3.3.1\bin\dlltool.exe --export-all-symbols --output-def=zlib.def adler32.pic.o compress.pic.o crc32.pic.o gzio.pic.o uncompr.pic.o deflate.pic.o trees.pic.o zutil.pic.o inflate.pic.o infback.pic.o inftrees.pic.o inffast.pic.o zlib-dllversion.o zlib-dll-res.o
-EXPORTS
- DllGetVersion @ 1 ;
- _dist_code @ 2 DATA ;
- _length_code @ 3 DATA ;
- _tr_align @ 4 ;
- _tr_flush_block @ 5 ;
- _tr_init @ 6 ;
- _tr_stored_block @ 7 ;
- _tr_tally @ 8 ;
- adler32 @ 9 ;
- adler32_combine @ 10 ;
- compress @ 11 ;
- compress2 @ 12 ;
- compressBound @ 13 ;
- crc32 @ 14 ;
- crc32_combine @ 15 ;
- deflate @ 16 ;
- deflateBound @ 17 ;
- deflateCopy @ 18 ;
- deflateEnd @ 19 ;
- deflateInit2_ @ 20 ;
- deflateInit_ @ 21 ;
- deflateParams @ 22 ;
- deflatePrime @ 23 ;
- deflateReset @ 24 ;
- deflateSetDictionary @ 25 ;
- deflateSetHeader @ 26 ;
- deflateTune @ 27 ;
- deflate_copyright @ 28 DATA ;
- get_crc_table @ 29 ;
- gzclearerr @ 30 ;
- gzclose @ 31 ;
- gzdirect @ 32 ;
- gzdopen @ 33 ;
- gzeof @ 34 ;
- gzerror @ 35 ;
- gzflush @ 36 ;
- gzgetc @ 37 ;
- gzgets @ 38 ;
- gzopen @ 39 ;
- gzprintf @ 40 ;
- gzputc @ 41 ;
- gzputs @ 42 ;
- gzread @ 43 ;
- gzrewind @ 44 ;
- gzseek @ 45 ;
- gzsetparams @ 46 ;
- gztell @ 47 ;
- gzungetc @ 48 ;
- gzwrite @ 49 ;
- inflate @ 50 ;
- inflateBack @ 51 ;
- inflateBackEnd @ 52 ;
- inflateBackInit_ @ 53 ;
- inflateCopy @ 54 ;
- inflateEnd @ 55 ;
- inflateGetHeader @ 56 ;
- inflateInit2_ @ 57 ;
- inflateInit_ @ 58 ;
- inflatePrime @ 59 ;
- inflateReset @ 60 ;
- inflateSetDictionary @ 61 ;
- inflateSync @ 62 ;
- inflateSyncPoint @ 63 ;
- inflate_copyright @ 64 DATA ;
- inflate_fast @ 65 ;
- inflate_table @ 66 ;
- uncompress @ 67 ;
- zError @ 68 ;
- z_errmsg @ 69 DATA ;
- zcalloc @ 70 ;
- zcfree @ 71 ;
- zlibCompileFlags @ 72 ;
- zlibVersion @ 73 ;
diff --git a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/zlib.lib b/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/zlib.lib
deleted file mode 100644
index d43be7f0..00000000
--- a/Libraries/nvidia-texture-tools-read-only/extern/gnuwin32/lib/zlib.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/include/nvtt/nvtt.h b/Libraries/nvidia-texture-tools-read-only/include/nvtt/nvtt.h
deleted file mode 100644
index fb281724..00000000
--- a/Libraries/nvidia-texture-tools-read-only/include/nvtt/nvtt.h
+++ /dev/null
@@ -1,408 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_H
-#define NV_TT_H
-
-// Function linkage
-#if NVTT_SHARED
-
-#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined __MINGW32__
-# ifdef NVTT_EXPORTS
-# define NVTT_API __declspec(dllexport)
-# else
-# define NVTT_API __declspec(dllimport)
-# endif
-#endif
-
-#if defined __GNUC__ >= 4
-# ifdef NVTT_EXPORTS
-# define NVTT_API __attribute__((visibility("default")))
-# endif
-#endif
-
-#endif // NVTT_SHARED
-
-#if !defined NVTT_API
-# define NVTT_API
-#endif
-
-#define NVTT_VERSION 201
-
-#define NVTT_FORBID_COPY(Class) \
- private: \
- Class(const Class &); \
- void operator=(const Class &); \
- public: \
-
-#define NVTT_DECLARE_PIMPL(Class) \
- public: \
- struct Private; \
- Private & m
-
-
-// Public interface.
-namespace nvtt
-{
- // Forward declarations.
- struct Texture;
-
- /// Supported compression formats.
- enum Format
- {
- // No compression.
- Format_RGB,
- Format_RGBA = Format_RGB,
-
- // DX9 formats.
- Format_DXT1,
- Format_DXT1a, // DXT1 with binary alpha.
- Format_DXT3,
- Format_DXT5,
- Format_DXT5n, // Compressed HILO: R=0, G=x, B=0, A=y
-
- // DX10 formats.
- Format_BC1 = Format_DXT1,
- Format_BC1a = Format_DXT1a,
- Format_BC2 = Format_DXT3,
- Format_BC3 = Format_DXT5,
- Format_BC3n = Format_DXT5n,
- Format_BC4, // ATI1
- Format_BC5, // 3DC, ATI2
-
- Format_DXT1n,
- Format_CTX1,
- };
-
- /// Pixel types.
- enum PixelType
- {
- PixelType_UnsignedNorm,
- PixelType_SignedNorm,
- PixelType_UnsignedInt,
- PixelType_SignedInt,
- PixelType_Float,
- };
-
- /// Quality modes.
- enum Quality
- {
- Quality_Fastest,
- Quality_Normal,
- Quality_Production,
- Quality_Highest,
- };
-
- /// Compression options. This class describes the desired compression format and other compression settings.
- struct CompressionOptions
- {
- NVTT_FORBID_COPY(CompressionOptions);
- NVTT_DECLARE_PIMPL(CompressionOptions);
-
- NVTT_API CompressionOptions();
- NVTT_API ~CompressionOptions();
-
- NVTT_API void reset();
-
- NVTT_API void setFormat(Format format);
- NVTT_API void setQuality(Quality quality);
- NVTT_API void setColorWeights(float red, float green, float blue, float alpha = 1.0f);
-
- NVTT_API void setExternalCompressor(const char * name);
-
- // Set color mask to describe the RGB/RGBA format.
- NVTT_API void setPixelFormat(unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask);
- NVTT_API void setPixelFormat(unsigned char rsize, unsigned char gsize, unsigned char bsize, unsigned char asize);
-
- NVTT_API void setPixelType(PixelType pixelType);
-
- NVTT_API void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold = 127);
- };
-
- /*
- // DXGI_FORMAT_R16G16_FLOAT
- compressionOptions.setPixelType(PixelType_Float);
- compressionOptions.setPixelFormat2(16, 16, 0, 0);
-
- // DXGI_FORMAT_R32G32B32A32_FLOAT
- compressionOptions.setPixelType(PixelType_Float);
- compressionOptions.setPixelFormat2(32, 32, 32, 32);
- */
-
-
- /// Wrap modes.
- enum WrapMode
- {
- WrapMode_Clamp,
- WrapMode_Repeat,
- WrapMode_Mirror,
- };
-
- /// Texture types.
- enum TextureType
- {
- TextureType_2D,
- TextureType_Cube,
- // TextureType_3D,
- };
-
- /// Input formats.
- enum InputFormat
- {
- InputFormat_BGRA_8UB,
- InputFormat_RGBA_32F,
- };
-
- /// Mipmap downsampling filters.
- enum MipmapFilter
- {
- MipmapFilter_Box, ///< Box filter is quite good and very fast.
- MipmapFilter_Triangle, ///< Triangle filter blurs the results too much, but that might be what you want.
- MipmapFilter_Kaiser, ///< Kaiser-windowed Sinc filter is the best downsampling filter.
- };
-
- /// Texture resize filters.
- enum ResizeFilter
- {
- ResizeFilter_Box,
- ResizeFilter_Triangle,
- ResizeFilter_Kaiser,
- ResizeFilter_Mitchell,
- };
-
- /// Color transformation.
- enum ColorTransform
- {
- ColorTransform_None,
- ColorTransform_Linear, ///< Not implemented.
- ColorTransform_Swizzle, ///< Not implemented.
- ColorTransform_YCoCg, ///< Transform into r=Co, g=Cg, b=0, a=Y
- ColorTransform_ScaledYCoCg, ///< Not implemented.
- };
-
- /// Extents rounding mode.
- enum RoundMode
- {
- RoundMode_None,
- RoundMode_ToNextPowerOfTwo,
- RoundMode_ToNearestPowerOfTwo,
- RoundMode_ToPreviousPowerOfTwo,
- };
-
- /// Alpha mode.
- enum AlphaMode
- {
- AlphaMode_None,
- AlphaMode_Transparency,
- AlphaMode_Premultiplied,
- };
-
- /// Input options. Specify format and layout of the input texture.
- struct InputOptions
- {
- NVTT_FORBID_COPY(InputOptions);
- NVTT_DECLARE_PIMPL(InputOptions);
-
- NVTT_API InputOptions();
- NVTT_API ~InputOptions();
-
- // Set default options.
- NVTT_API void reset();
-
- // Setup input layout.
- NVTT_API void setTextureLayout(TextureType type, int w, int h, int d = 1);
- NVTT_API void resetTextureLayout();
-
- // Set mipmap data. Copies the data.
- NVTT_API bool setMipmapData(const void * data, int w, int h, int d = 1, int face = 0, int mipmap = 0);
- NVTT_API bool setMipmapChannelData(const void * data, int channel, int w, int h, int d = 1, int face = 0, int mipmap = 0);
-
- // Describe the format of the input.
- NVTT_API void setFormat(InputFormat format);
-
- // Set the way the input alpha channel is interpreted. @@ Not implemented!
- NVTT_API void setAlphaMode(AlphaMode alphaMode);
-
- // Set gamma settings.
- NVTT_API void setGamma(float inputGamma, float outputGamma);
-
- // Set texture wrappign mode.
- NVTT_API void setWrapMode(WrapMode mode);
-
- // Set mipmapping options.
- NVTT_API void setMipmapFilter(MipmapFilter filter);
- NVTT_API void setMipmapGeneration(bool enabled, int maxLevel = -1);
- NVTT_API void setKaiserParameters(float width, float alpha, float stretch);
-
- // Set normal map options.
- NVTT_API void setNormalMap(bool b);
- NVTT_API void setConvertToNormalMap(bool convert);
- NVTT_API void setHeightEvaluation(float redScale, float greenScale, float blueScale, float alphaScale);
- NVTT_API void setNormalFilter(float sm, float medium, float big, float large);
- NVTT_API void setNormalizeMipmaps(bool b);
-
- // Set color transforms.
- NVTT_API void setColorTransform(ColorTransform t);
- NVTT_API void setLinearTransform(int channel, float w0, float w1, float w2, float w3);
- NVTT_API void setLinearTransform(int channel, float w0, float w1, float w2, float w3, float offset);
- NVTT_API void setSwizzleTransform(int x, int y, int z, int w);
-
- // Set resizing options.
- NVTT_API void setMaxExtents(int d);
- NVTT_API void setRoundMode(RoundMode mode);
-
- // Set whether or not to premultiply color by alpha
- NVTT_API void setPremultiplyAlpha(bool b);
- };
-
-
- /// Output handler.
- struct OutputHandler
- {
- virtual ~OutputHandler() {}
-
- /// Indicate the start of a new compressed image that's part of the final texture.
- virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel) = 0;
-
- /// Output data. Compressed data is output as soon as it's generated to minimize memory allocations.
- virtual bool writeData(const void * data, int size) = 0;
- };
-
- /// Error codes.
- enum Error
- {
- Error_Unknown,
- Error_InvalidInput,
- Error_UnsupportedFeature,
- Error_CudaError,
- Error_FileOpen,
- Error_FileWrite,
- Error_UnsupportedOutputFormat,
- };
-
- /// Error handler.
- struct ErrorHandler
- {
- virtual ~ErrorHandler() {}
-
- // Signal error.
- virtual void error(Error e) = 0;
- };
-
- /// Container.
- enum Container
- {
- Container_DDS,
- Container_DDS10,
- };
-
-
- /// Output Options. This class holds pointers to the interfaces that are used to report the output of
- /// the compressor to the user.
- struct OutputOptions
- {
- NVTT_FORBID_COPY(OutputOptions);
- NVTT_DECLARE_PIMPL(OutputOptions);
-
- NVTT_API OutputOptions();
- NVTT_API ~OutputOptions();
-
- // Set default options.
- NVTT_API void reset();
-
- NVTT_API void setFileName(const char * fileName);
-
- NVTT_API void setOutputHandler(OutputHandler * outputHandler);
- NVTT_API void setErrorHandler(ErrorHandler * errorHandler);
- NVTT_API void setOutputHeader(bool outputHeader);
- NVTT_API void setContainer(Container container);
- };
-
-
- /// Texture compressor.
- struct Compressor
- {
- NVTT_FORBID_COPY(Compressor);
- NVTT_DECLARE_PIMPL(Compressor);
-
- NVTT_API Compressor();
- NVTT_API ~Compressor();
-
- NVTT_API void enableCudaAcceleration(bool enable);
- NVTT_API bool isCudaAccelerationEnabled() const;
-
- // Main entrypoint of the compression library.
- NVTT_API bool process(const InputOptions & inputOptions, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const;
-
- // Estimate the size of compressing the input with the given options.
- NVTT_API int estimateSize(const InputOptions & inputOptions, const CompressionOptions & compressionOptions) const;
-
- NVTT_API void outputCompressed(const Texture & tex, const OutputOptions & outputOptions);
- };
-
-
- /// Texture data.
- struct Texture
- {
- NVTT_DECLARE_PIMPL(Texture);
-
- NVTT_API Texture();
- NVTT_API ~Texture();
-
- Texture(const Texture & tex);
- void operator=(const Texture & tex);
-
- NVTT_API bool load(const char * fileName); // @@ Input callbacks?
-
- NVTT_API void setType(TextureType type);
- NVTT_API void setTexture2D(InputFormat format, int w, int h, int idx, void * data);
-
- // Resizing
- NVTT_API void resize(int w, int h, ResizeFilter filter);
- NVTT_API bool buildMipmap(MipmapFilter filter);
-
- // Color transforms.
- NVTT_API void toLinear(float gamma);
- NVTT_API void toGamma(float gamma);
- NVTT_API void transform(const float w0[4], const float w1[4], const float w2[4], const float w3[4], const float offset[4]);
- NVTT_API void swizzle(int r, int g, int b, int a);
- NVTT_API void scaleBias(int channel, float scale, float bias);
- NVTT_API void normalize();
- NVTT_API void blend(float r, float g, float b, float a);
- NVTT_API void premultiplyAlpha();
- };
-
-
- // Return string for the given error code.
- NVTT_API const char * errorString(Error e);
-
- // Return NVTT version.
- NVTT_API unsigned int version();
-
- // Set callbacks.
- //NVTT_API void setErrorCallback(ErrorCallback callback);
- //NVTT_API void setMemoryCallbacks(...);
-
-} // nvtt namespace
-
-#endif // NV_TT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/include/nvtt/nvtt_wrapper.h b/Libraries/nvidia-texture-tools-read-only/include/nvtt/nvtt_wrapper.h
deleted file mode 100644
index 977a14d3..00000000
--- a/Libraries/nvidia-texture-tools-read-only/include/nvtt/nvtt_wrapper.h
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NVTT_WRAPPER_H
-#define NVTT_WRAPPER_H
-
-// Function linkage
-#if NVTT_SHARED
-
-#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined __MINGW32__
-# ifdef NVTT_EXPORTS
-# define NVTT_API __declspec(dllexport)
-# else
-# define NVTT_API __declspec(dllimport)
-# endif
-#endif
-
-#if defined __GNUC__ >= 4
-# ifdef NVTT_EXPORTS
-# define NVTT_API __attribute__((visibility("default")))
-# endif
-#endif
-
-#endif // NVTT_SHARED
-
-#if !defined NVTT_API
-# define NVTT_API
-#endif
-
-#define NVTT_VERSION 201
-
-#ifdef __cplusplus
-typedef struct nvtt::InputOptions NvttInputOptions;
-typedef struct nvtt::CompressionOptions NvttCompressionOptions;
-typedef struct nvtt::OutputOptions NvttOutputOptions;
-typedef struct nvtt::Compressor NvttCompressor;
-#else
-typedef struct NvttInputOptions NvttInputOptions;
-typedef struct NvttCompressionOptions NvttCompressionOptions;
-typedef struct NvttOutputOptions NvttOutputOptions;
-typedef struct NvttCompressor NvttCompressor;
-#endif
-
-/// Supported compression formats.
-typedef enum
-{
- // No compression.
- NVTT_Format_RGB,
- NVTT_Format_RGBA = NVTT_Format_RGB,
-
- // DX9 formats.
- NVTT_Format_DXT1,
- NVTT_Format_DXT1a,
- NVTT_Format_DXT3,
- NVTT_Format_DXT5,
- NVTT_Format_DXT5n,
-
- // DX10 formats.
- NVTT_Format_BC1 = NVTT_Format_DXT1,
- NVTT_Format_BC1a = NVTT_Format_DXT1a,
- NVTT_Format_BC2 = NVTT_Format_DXT3,
- NVTT_Format_BC3 = NVTT_Format_DXT5,
- NVTT_Format_BC3n = NVTT_Format_DXT5n,
- NVTT_Format_BC4,
- NVTT_Format_BC5,
-} NvttFormat;
-
-/// Quality modes.
-typedef enum
-{
- NVTT_Quality_Fastest,
- NVTT_Quality_Normal,
- NVTT_Quality_Production,
- NVTT_Quality_Highest,
-} NvttQuality;
-
-/// Wrap modes.
-typedef enum
-{
- NVTT_WrapMode_Clamp,
- NVTT_WrapMode_Repeat,
- NVTT_WrapMode_Mirror,
-} NvttWrapMode;
-
-/// Texture types.
-typedef enum
-{
- NVTT_TextureType_2D,
- NVTT_TextureType_Cube,
-} NvttTextureType;
-
-/// Input formats.
-typedef enum
-{
- NVTT_InputFormat_BGRA_8UB,
-} NvttInputFormat;
-
-/// Mipmap downsampling filters.
-typedef enum
-{
- NVTT_MipmapFilter_Box,
- NVTT_MipmapFilter_Triangle,
- NVTT_MipmapFilter_Kaiser,
-} NvttMipmapFilter;
-
-/// Color transformation.
-typedef enum
-{
- NVTT_ColorTransform_None,
- NVTT_ColorTransform_Linear,
-} NvttColorTransform;
-
-/// Extents rounding mode.
-typedef enum
-{
- NVTT_RoundMode_None,
- NVTT_RoundMode_ToNextPowerOfTwo,
- NVTT_RoundMode_ToNearestPowerOfTwo,
- NVTT_RoundMode_ToPreviousPowerOfTwo,
-} NvttRoundMode;
-
-/// Alpha mode.
-typedef enum
-{
- NVTT_AlphaMode_None,
- NVTT_AlphaMode_Transparency,
- NVTT_AlphaMode_Premultiplied,
-} NvttAlphaMode;
-
-typedef enum
-{
- NVTT_Error_InvalidInput,
- NVTT_Error_UserInterruption,
- NVTT_Error_UnsupportedFeature,
- NVTT_Error_CudaError,
- NVTT_Error_Unknown,
- NVTT_Error_FileOpen,
- NVTT_Error_FileWrite,
- NVTT_Error_UnsupportedOutputFormat,
-} NvttError;
-
-typedef enum
-{
- NVTT_False,
- NVTT_True,
-} NvttBoolean;
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Callbacks
-//typedef void (* nvttErrorHandler)(NvttError e);
-//typedef void (* nvttOutputHandler)(const void * data, int size);
-//typedef void (* nvttImageHandler)(int size, int width, int height, int depth, int face, int miplevel);
-
-
-// InputOptions class.
-NVTT_API NvttInputOptions * nvttCreateInputOptions();
-NVTT_API void nvttDestroyInputOptions(NvttInputOptions * inputOptions);
-
-NVTT_API void nvttSetInputOptionsTextureLayout(NvttInputOptions * inputOptions, NvttTextureType type, int w, int h, int d);
-NVTT_API void nvttResetInputOptionsTextureLayout(NvttInputOptions * inputOptions);
-NVTT_API NvttBoolean nvttSetInputOptionsMipmapData(NvttInputOptions * inputOptions, const void * data, int w, int h, int d, int face, int mipmap);
-NVTT_API void nvttSetInputOptionsFormat(NvttInputOptions * inputOptions, NvttInputFormat format);
-NVTT_API void nvttSetInputOptionsAlphaMode(NvttInputOptions * inputOptions, NvttAlphaMode alphaMode);
-NVTT_API void nvttSetInputOptionsGamma(NvttInputOptions * inputOptions, float inputGamma, float outputGamma);
-NVTT_API void nvttSetInputOptionsWrapMode(NvttInputOptions * inputOptions, NvttWrapMode mode);
-NVTT_API void nvttSetInputOptionsMipmapFilter(NvttInputOptions * inputOptions, NvttMipmapFilter filter);
-NVTT_API void nvttSetInputOptionsMipmapGeneration(NvttInputOptions * inputOptions, NvttBoolean enabled, int maxLevel);
-NVTT_API void nvttSetInputOptionsKaiserParameters(NvttInputOptions * inputOptions, float width, float alpha, float stretch);
-NVTT_API void nvttSetInputOptionsNormalMap(NvttInputOptions * inputOptions, NvttBoolean b);
-NVTT_API void nvttSetInputOptionsConvertToNormalMap(NvttInputOptions * inputOptions, NvttBoolean convert);
-NVTT_API void nvttSetInputOptionsHeightEvaluation(NvttInputOptions * inputOptions, float redScale, float greenScale, float blueScale, float alphaScale);
-NVTT_API void nvttSetInputOptionsNormalFilter(NvttInputOptions * inputOptions, float sm, float medium, float big, float large);
-NVTT_API void nvttSetInputOptionsNormalizeMipmaps(NvttInputOptions * inputOptions, NvttBoolean b);
-NVTT_API void nvttSetInputOptionsColorTransform(NvttInputOptions * inputOptions, NvttColorTransform t);
-NVTT_API void nvttSetInputOptionsLinearTransform(NvttInputOptions * inputOptions, int channel, float w0, float w1, float w2, float w3);
-NVTT_API void nvttSetInputOptionsMaxExtents(NvttInputOptions * inputOptions, int dim);
-NVTT_API void nvttSetInputOptionsRoundMode(NvttInputOptions * inputOptions, NvttRoundMode mode);
-
-
-// CompressionOptions class.
-NVTT_API NvttCompressionOptions * nvttCreateCompressionOptions();
-NVTT_API void nvttDestroyCompressionOptions(NvttCompressionOptions * compressionOptions);
-
-NVTT_API void nvttSetCompressionOptionsFormat(NvttCompressionOptions * compressionOptions, NvttFormat format);
-NVTT_API void nvttSetCompressionOptionsQuality(NvttCompressionOptions * compressionOptions, NvttQuality quality);
-NVTT_API void nvttSetCompressionOptionsColorWeights(NvttCompressionOptions * compressionOptions, float red, float green, float blue, float alpha);
-NVTT_API void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask);
-NVTT_API void nvttSetCompressionOptionsQuantization(NvttCompressionOptions * compressionOptions, NvttBoolean colorDithering, NvttBoolean alphaDithering, NvttBoolean binaryAlpha, int alphaThreshold);
-
-
-// OutputOptions class.
-NVTT_API NvttOutputOptions * nvttCreateOutputOptions();
-NVTT_API void nvttDestroyOutputOptions(NvttOutputOptions * outputOptions);
-
-NVTT_API void nvttSetOutputOptionsFileName(NvttOutputOptions * outputOptions, const char * fileName);
-NVTT_API void nvttSetOutputOptionsOutputHeader(NvttOutputOptions * outputOptions, NvttBoolean b);
-//NVTT_API void nvttSetOutputOptionsErrorHandler(NvttOutputOptions * outputOptions, nvttErrorHandler errorHandler);
-//NVTT_API void nvttSetOutputOptionsOutputHandler(NvttOutputOptions * outputOptions, nvttOutputHandler outputHandler, nvttImageHandler imageHandler);
-
-
-// Compressor class.
-NVTT_API NvttCompressor * nvttCreateCompressor();
-NVTT_API void nvttDestroyCompressor(NvttCompressor * compressor);
-
-NVTT_API NvttBoolean nvttCompress(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions, const NvttOutputOptions * outputOptions);
-NVTT_API int nvttEstimateSize(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions);
-
-
-// Global functions.
-NVTT_API const char * nvttErrorString(NvttError e);
-NVTT_API unsigned int nvttVersion();
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // NVTT_WRAPPER_H
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvcore.a b/Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvcore.a
deleted file mode 100644
index 1286987c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvcore.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvimage.a b/Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvimage.a
deleted file mode 100644
index 7f66e3bd..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvimage.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvmath.a b/Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvmath.a
deleted file mode 100644
index 70df711c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvmath.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvtt.a b/Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvtt.a
deleted file mode 100644
index 5e5268ff..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/linux32/libnvtt.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/linux32/libposh.a b/Libraries/nvidia-texture-tools-read-only/lib/linux32/libposh.a
deleted file mode 100644
index 1cb9e13d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/linux32/libposh.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/linux32/libsquish.a b/Libraries/nvidia-texture-tools-read-only/lib/linux32/libsquish.a
deleted file mode 100644
index 6918e184..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/linux32/libsquish.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvcore.a b/Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvcore.a
deleted file mode 100644
index 0cb139df..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvcore.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvimage.a b/Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvimage.a
deleted file mode 100644
index 3a9e545b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvimage.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvmath.a b/Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvmath.a
deleted file mode 100644
index 05bb1bc1..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvmath.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvtt.a b/Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvtt.a
deleted file mode 100644
index 0f3cd008..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/linux64/libnvtt.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/linux64/libposh.a b/Libraries/nvidia-texture-tools-read-only/lib/linux64/libposh.a
deleted file mode 100644
index 07b1a5fb..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/linux64/libposh.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/linux64/libsquish.a b/Libraries/nvidia-texture-tools-read-only/lib/linux64/libsquish.a
deleted file mode 100644
index 63d0d600..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/linux64/libsquish.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/mac/libnvcore.a b/Libraries/nvidia-texture-tools-read-only/lib/mac/libnvcore.a
deleted file mode 100644
index ca1e89cf..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/mac/libnvcore.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/mac/libnvimage.a b/Libraries/nvidia-texture-tools-read-only/lib/mac/libnvimage.a
deleted file mode 100644
index 35032d39..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/mac/libnvimage.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/mac/libnvmath.a b/Libraries/nvidia-texture-tools-read-only/lib/mac/libnvmath.a
deleted file mode 100644
index 4c69ac1f..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/mac/libnvmath.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/mac/libnvtt.a b/Libraries/nvidia-texture-tools-read-only/lib/mac/libnvtt.a
deleted file mode 100644
index ea99c145..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/mac/libnvtt.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/mac/libposh.a b/Libraries/nvidia-texture-tools-read-only/lib/mac/libposh.a
deleted file mode 100644
index 4297e655..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/mac/libposh.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/mac/libsquish.a b/Libraries/nvidia-texture-tools-read-only/lib/mac/libsquish.a
deleted file mode 100644
index 5a440ebe..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/mac/libsquish.a
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvcore.lib b/Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvcore.lib
deleted file mode 100644
index 1af58c6f..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvcore.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvimage.lib b/Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvimage.lib
deleted file mode 100644
index 6bc2f173..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvimage.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvmath.lib b/Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvmath.lib
deleted file mode 100644
index 4365f2ba..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvmath.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvtt.lib b/Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvtt.lib
deleted file mode 100644
index 943b508a..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/win32debug/nvtt.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/win32debug/posh.lib b/Libraries/nvidia-texture-tools-read-only/lib/win32debug/posh.lib
deleted file mode 100644
index 5b5bb9dc..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/win32debug/posh.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/win32debug/squish.lib b/Libraries/nvidia-texture-tools-read-only/lib/win32debug/squish.lib
deleted file mode 100644
index 271a58f6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/win32debug/squish.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/win32release/nvcore.lib b/Libraries/nvidia-texture-tools-read-only/lib/win32release/nvcore.lib
deleted file mode 100644
index 706af7b3..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/win32release/nvcore.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/win32release/nvimage.lib b/Libraries/nvidia-texture-tools-read-only/lib/win32release/nvimage.lib
deleted file mode 100644
index a9affbdc..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/win32release/nvimage.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/win32release/nvmath.lib b/Libraries/nvidia-texture-tools-read-only/lib/win32release/nvmath.lib
deleted file mode 100644
index 29d1ab7d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/win32release/nvmath.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/win32release/nvtt.lib b/Libraries/nvidia-texture-tools-read-only/lib/win32release/nvtt.lib
deleted file mode 100644
index 966722de..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/win32release/nvtt.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/win32release/posh.lib b/Libraries/nvidia-texture-tools-read-only/lib/win32release/posh.lib
deleted file mode 100644
index 31a8e3cd..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/win32release/posh.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/lib/win32release/squish.lib b/Libraries/nvidia-texture-tools-read-only/lib/win32release/squish.lib
deleted file mode 100644
index 22a1b6e8..00000000
--- a/Libraries/nvidia-texture-tools-read-only/lib/win32release/squish.lib
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/Nvidia.TextureTools/Nvidia.TextureTools.csproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/Nvidia.TextureTools/Nvidia.TextureTools.csproj
deleted file mode 100644
index 60b97b27..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/Nvidia.TextureTools/Nvidia.TextureTools.csproj
+++ /dev/null
@@ -1,47 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{CAB55C39-8FA9-4912-98D9-E52669C8911D}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Nvidia.TextureTools</RootNamespace>
- <AssemblyName>Nvidia.TextureTools</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="TextureTools.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project> \ No newline at end of file
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/Nvidia.TextureTools/Properties/AssemblyInfo.cs b/Libraries/nvidia-texture-tools-read-only/project/vc8/Nvidia.TextureTools/Properties/AssemblyInfo.cs
deleted file mode 100644
index 91a64038..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/Nvidia.TextureTools/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Nvidia.TextureTools")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("NVIDIA Corporation")]
-[assembly: AssemblyProduct("Nvidia.TextureTools")]
-[assembly: AssemblyCopyright("Copyright © NVIDIA 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("5fa03fb3-b7a3-4ba8-90e7-545929731356")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/Nvidia.TextureTools/TextureTools.cs b/Libraries/nvidia-texture-tools-read-only/project/vc8/Nvidia.TextureTools/TextureTools.cs
deleted file mode 100644
index b9b2698b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/Nvidia.TextureTools/TextureTools.cs
+++ /dev/null
@@ -1,526 +0,0 @@
-using System;
-using System.Security;
-using System.Runtime.InteropServices;
-
-namespace Nvidia.TextureTools
-{
- #region Enums
-
- #region public enum Format
- /// <summary>
- /// Compression format.
- /// </summary>
- public enum Format
- {
- // No compression.
- RGB,
- RGBA = RGB,
-
- // DX9 formats.
- DXT1,
- DXT1a,
- DXT3,
- DXT5,
- DXT5n,
-
- // DX10 formats.
- BC1 = DXT1,
- BC1a = DXT1a,
- BC2 = DXT3,
- BC3 = DXT5,
- BC3n = DXT5n,
- BC4,
- BC5,
- }
- #endregion
-
- #region public enum Quality
- /// <summary>
- /// Quality modes.
- /// </summary>
- public enum Quality
- {
- Fastest,
- Normal,
- Production,
- Highest,
- }
- #endregion
-
- #region public enum WrapMode
- /// <summary>
- /// Wrap modes.
- /// </summary>
- public enum WrapMode
- {
- Clamp,
- Repeat,
- Mirror,
- }
- #endregion
-
- #region public enum TextureType
- /// <summary>
- /// Texture types.
- /// </summary>
- public enum TextureType
- {
- Texture2D,
- TextureCube,
- }
- #endregion
-
- #region public enum InputFormat
- /// <summary>
- /// Input formats.
- /// </summary>
- public enum InputFormat
- {
- BGRA_8UB
- }
- #endregion
-
- #region public enum MipmapFilter
- /// <summary>
- /// Mipmap downsampling filters.
- /// </summary>
- public enum MipmapFilter
- {
- Box,
- Triangle,
- Kaiser
- }
- #endregion
-
- #region public enum ColorTransform
- /// <summary>
- /// Color transformation.
- /// </summary>
- public enum ColorTransform
- {
- None,
- Linear
- }
- #endregion
-
- #region public enum RoundMode
- /// <summary>
- /// Extents rounding mode.
- /// </summary>
- public enum RoundMode
- {
- None,
- ToNextPowerOfTwo,
- ToNearestPowerOfTwo,
- ToPreviousPowerOfTwo
- }
- #endregion
-
- #region public enum AlphaMode
- /// <summary>
- /// Alpha mode.
- /// </summary>
- public enum AlphaMode
- {
- None,
- Transparency,
- Premultiplied
- }
- #endregion
-
- #region public enum Error
- /// <summary>
- /// Error codes.
- /// </summary>
- public enum Error
- {
- InvalidInput,
- UserInterruption,
- UnsupportedFeature,
- CudaError,
- Unknown,
- FileOpen,
- FileWrite,
- }
- #endregion
-
- #endregion
-
- #region public class InputOptions
- /// <summary>
- /// Input options.
- /// </summary>
- public class InputOptions
- {
- #region Bindings
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static IntPtr nvttCreateInputOptions();
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttDestroyInputOptions(IntPtr inputOptions);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsTextureLayout(IntPtr inputOptions, TextureType type, int w, int h, int d);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttResetInputOptionsTextureLayout(IntPtr inputOptions);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static bool nvttSetInputOptionsMipmapData(IntPtr inputOptions, IntPtr data, int w, int h, int d, int face, int mipmap);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsFormat(IntPtr inputOptions, InputFormat format);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsAlphaMode(IntPtr inputOptions, AlphaMode alphaMode);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsGamma(IntPtr inputOptions, float inputGamma, float outputGamma);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsWrapMode(IntPtr inputOptions, WrapMode mode);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsMipmapFilter(IntPtr inputOptions, MipmapFilter filter);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsMipmapGeneration(IntPtr inputOptions, bool generateMipmaps, int maxLevel);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsKaiserParameters(IntPtr inputOptions, float width, float alpha, float stretch);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsNormalMap(IntPtr inputOptions, bool b);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsConvertToNormalMap(IntPtr inputOptions, bool convert);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsHeightEvaluation(IntPtr inputOptions, float redScale, float greenScale, float blueScale, float alphaScale);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsNormalFilter(IntPtr inputOptions, float small, float medium, float big, float large);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsNormalizeMipmaps(IntPtr inputOptions, bool b);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsColorTransform(IntPtr inputOptions, ColorTransform t);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsLinearTransfrom(IntPtr inputOptions, int channel, float w0, float w1, float w2, float w3);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsMaxExtents(IntPtr inputOptions, int d);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsRoundMode(IntPtr inputOptions, RoundMode mode);
- #endregion
-
- internal IntPtr options;
-
- public InputOptions()
- {
- options = nvttCreateInputOptions();
- }
- ~InputOptions()
- {
- nvttDestroyInputOptions(options);
- }
-
- public void SetTextureLayout(TextureType type, int w, int h, int d)
- {
- nvttSetInputOptionsTextureLayout(options, type, w, h, d);
- }
- public void ResetTextureLayout()
- {
- nvttResetInputOptionsTextureLayout(options);
- }
-
- public void SetMipmapData(IntPtr data, int width, int height, int depth, int face, int mipmap)
- {
- nvttSetInputOptionsMipmapData(options, data, width, height, depth, face, mipmap);
- }
-
- public void SetFormat(InputFormat format)
- {
- nvttSetInputOptionsFormat(options, format);
- }
-
- public void SetAlphaMode(AlphaMode alphaMode)
- {
- nvttSetInputOptionsAlphaMode(options, alphaMode);
- }
-
- public void SetGamma(float inputGamma, float outputGamma)
- {
- nvttSetInputOptionsGamma(options, inputGamma, outputGamma);
- }
-
- public void SetWrapMode(WrapMode wrapMode)
- {
- nvttSetInputOptionsWrapMode(options, wrapMode);
- }
-
- public void SetMipmapFilter(MipmapFilter filter)
- {
- nvttSetInputOptionsMipmapFilter(options, filter);
- }
-
- public void SetMipmapGeneration(bool enabled)
- {
- nvttSetInputOptionsMipmapGeneration(options, enabled, -1);
- }
-
- public void SetMipmapGeneration(bool enabled, int maxLevel)
- {
- nvttSetInputOptionsMipmapGeneration(options, enabled, maxLevel);
- }
-
- public void SetKaiserParameters(float width, float alpha, float stretch)
- {
- nvttSetInputOptionsKaiserParameters(options, width, alpha, stretch);
- }
-
- public void SetNormalMap(bool b)
- {
- nvttSetInputOptionsNormalMap(options, b);
- }
-
- public void SetConvertToNormalMap(bool convert)
- {
- nvttSetInputOptionsConvertToNormalMap(options, convert);
- }
-
- public void SetHeightEvaluation(float redScale, float greenScale, float blueScale, float alphaScale)
- {
- nvttSetInputOptionsHeightEvaluation(options, redScale, greenScale, blueScale, alphaScale);
- }
-
- public void SetNormalFilter(float small, float medium, float big, float large)
- {
- nvttSetInputOptionsNormalFilter(options, small, medium, big, large);
- }
-
- public void SetNormalizeMipmaps(bool b)
- {
- nvttSetInputOptionsNormalizeMipmaps(options, b);
- }
-
- public void SetColorTransform(ColorTransform t)
- {
- nvttSetInputOptionsColorTransform(options, t);
- }
-
- public void SetLinearTransfrom(int channel, float w0, float w1, float w2, float w3)
- {
- nvttSetInputOptionsLinearTransfrom(options, channel, w0, w1, w2, w3);
- }
-
- public void SetMaxExtents(int dim)
- {
- nvttSetInputOptionsMaxExtents(options, dim);
- }
-
- public void SetRoundMode(RoundMode mode)
- {
- nvttSetInputOptionsRoundMode(options, mode);
- }
- }
- #endregion
-
- #region public class CompressionOptions
- /// <summary>
- /// Compression options.
- /// </summary>
- public class CompressionOptions
- {
- #region Bindings
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static IntPtr nvttCreateCompressionOptions();
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttDestroyCompressionOptions(IntPtr compressionOptions);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetCompressionOptionsFormat(IntPtr compressionOptions, Format format);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetCompressionOptionsQuality(IntPtr compressionOptions, Quality quality);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetCompressionOptionsColorWeights(IntPtr compressionOptions, float red, float green, float blue, float alpha);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetCompressionOptionsPixelFormat(IntPtr compressionOptions, uint bitcount, uint rmask, uint gmask, uint bmask, uint amask);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetCompressionOptionsQuantization(IntPtr compressionOptions, bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold);
- #endregion
-
- internal IntPtr options;
-
- public CompressionOptions()
- {
- options = nvttCreateCompressionOptions();
- }
- ~CompressionOptions()
- {
- nvttDestroyCompressionOptions(options);
- }
-
- public void SetFormat(Format format)
- {
- nvttSetCompressionOptionsFormat(options, format);
- }
-
- public void SetQuality(Quality quality)
- {
- nvttSetCompressionOptionsQuality(options, quality);
- }
-
- public void SetColorWeights(float red, float green, float blue)
- {
- nvttSetCompressionOptionsColorWeights(options, red, green, blue, 1.0f);
- }
-
- public void SetColorWeights(float red, float green, float blue, float alpha)
- {
- nvttSetCompressionOptionsColorWeights(options, red, green, blue, alpha);
- }
-
- public void SetPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
- {
- nvttSetCompressionOptionsPixelFormat(options, bitcount, rmask, gmask, bmask, amask);
- }
-
- public void SetQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha)
- {
- nvttSetCompressionOptionsQuantization(options, colorDithering, alphaDithering, binaryAlpha, 127);
- }
-
- public void SetQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold)
- {
- nvttSetCompressionOptionsQuantization(options, colorDithering, alphaDithering, binaryAlpha, alphaThreshold);
- }
- }
- #endregion
-
- #region public class OutputOptions
- /// <summary>
- /// Output options.
- /// </summary>
- public class OutputOptions
- {
- #region Delegates
- public delegate void ErrorHandler(Error error);
- private delegate void WriteDataDelegate(IntPtr data, int size);
- private delegate void ImageDelegate(int size, int width, int height, int depth, int face, int miplevel);
- #endregion
-
- #region Bindings
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static IntPtr nvttCreateOutputOptions();
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttDestroyOutputOptions(IntPtr outputOptions);
-
- [DllImport("nvtt", CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetOutputOptionsFileName(IntPtr outputOptions, string fileName);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetOutputOptionsErrorHandler(IntPtr outputOptions, ErrorHandler errorHandler);
-
- private void ErrorCallback(Error error)
- {
- if (Error != null) Error(error);
- }
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetOutputOptionsOutputHeader(IntPtr outputOptions, bool b);
-
- //[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- //private extern static void nvttSetOutputOptionsOutputHandler(IntPtr outputOptions, WriteDataDelegate writeData, ImageDelegate image);
-
- #endregion
-
- internal IntPtr options;
-
- public OutputOptions()
- {
- options = nvttCreateOutputOptions();
- nvttSetOutputOptionsErrorHandler(options, new ErrorHandler(ErrorCallback));
- }
- ~OutputOptions()
- {
- nvttDestroyOutputOptions(options);
- }
-
- public void SetFileName(string fileName)
- {
- nvttSetOutputOptionsFileName(options, fileName);
- }
-
- public event ErrorHandler Error;
-
- public void SetOutputHeader(bool b)
- {
- nvttSetOutputOptionsOutputHeader(options, b);
- }
-
- // @@ Add OutputHandler interface.
- }
- #endregion
-
- #region public static class Compressor
- public class Compressor
- {
- #region Bindings
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static IntPtr nvttCreateCompressor();
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttDestroyCompressor(IntPtr compressor);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static bool nvttCompress(IntPtr compressor, IntPtr inputOptions, IntPtr compressionOptions, IntPtr outputOptions);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static int nvttEstimateSize(IntPtr compressor, IntPtr inputOptions, IntPtr compressionOptions);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private static extern IntPtr nvttErrorString(Error error);
-
- #endregion
-
- internal IntPtr compressor;
-
- public Compressor()
- {
- compressor = nvttCreateCompressor();
- }
-
- ~Compressor()
- {
- nvttDestroyCompressor(compressor);
- }
-
- public bool Compress(InputOptions input, CompressionOptions compression, OutputOptions output)
- {
- return nvttCompress(compressor, input.options, compression.options, output.options);
- }
-
- public int EstimateSize(InputOptions input, CompressionOptions compression)
- {
- return nvttEstimateSize(compressor, input.options, compression.options);
- }
-
- public static string ErrorString(Error error)
- {
- return Marshal.PtrToStringAnsi(nvttErrorString(error));
- }
-
- }
- #endregion
-
-} // Nvidia.TextureTools namespace
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/PhotoshopExporter/PhotoshopExporter.cpp b/Libraries/nvidia-texture-tools-read-only/project/vc8/PhotoshopExporter/PhotoshopExporter.cpp
deleted file mode 100644
index cee60788..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/PhotoshopExporter/PhotoshopExporter.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-
-#include "PhotoshopExporter.h"
-
-#include <Plugin.h>
-
-SPBasicSuite * sSPBasic = NULL;
-
-
-
-void InitGlobals (Ptr globalPtr)
-{
- Globals * globals = (Globals *)globalPtr;
-
- // Set default values.
- globals->queryForParameters = true;
-}
-
-
-
-
-DLLExport MACPASCAL void PluginMain (const short selector,
- void *exportParamBlock,
- long *data,
- short *result)
-{
- if (selector == exportSelectorAbout)
- {
- sSPBasic = ((AboutRecord*)exportParamBlock)->sSPBasic;
- //DoAbout((AboutRecordPtr)exportParamBlock);
- }
- else
- {
- sSPBasic = ((ExportRecordPtr)exportParamBlock)->sSPBasic;
-
- // Allocate and initialize globals.
- Ptr globalPtr = AllocateGlobals ((uint32)result, (uint32)exportParamBlock, ((ExportRecordPtr)exportParamBlock)->handleProcs, sizeof(Globals), data, InitGlobals);
-
- if (globalPtr == NULL)
- {
- *result = memFullErr;
- return;
- }
-
- // Get our "globals" variable assigned as a Global Pointer struct with the
- // data we've returned:
- Globals * globals = (Globals *)globalPtr;
-
-
- //-----------------------------------------------------------------------
- // (3) Dispatch selector.
- //-----------------------------------------------------------------------
-
- switch (selector)
- {
- case exportSelectorPrepare:
- // DoPrepare(globals);
- break;
- case exportSelectorStart:
- // DoStart(globals);
- break;
- case exportSelectorContinue:
- // DoContinue(globals);
- break;
- case exportSelectorFinish:
- // DoFinish(globals);
- break;
- }
-
- // unlock handle pointing to parameter block and data so it can move
- // if memory gets shuffled:
- if ((Handle)*data != NULL)
- {
- PIUnlockHandle((Handle)*data);
- }
- }
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/PhotoshopExporter/PhotoshopExporter.h b/Libraries/nvidia-texture-tools-read-only/project/vc8/PhotoshopExporter/PhotoshopExporter.h
deleted file mode 100644
index 5136e42b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/PhotoshopExporter/PhotoshopExporter.h
+++ /dev/null
@@ -1,27 +0,0 @@
-
-#ifndef NV_PHOTOSHOP_EXPORTER_H
-#define NV_PHOTOSHOP_EXPORTER_H
-
-#include <PIExport.h> // Export Photoshop header file.
-#include <PIUtilities.h> // SDK Utility library.
-
-// Photoshop crazyness:
-//#define gResult (*(globals->result))
-#define gStuff (globals->exportParamBlock)
-
-
-// This is our structure that we use to pass globals between routines:
-struct Globals
-{
- short * result; // Must always be first in Globals.
- ExportRecord * exportParamBlock; // Must always be second in Globals.
-
- Boolean queryForParameters;
-
- // ...
-
-};
-
-
-
-#endif // NV_PHOTOSHOP_EXPORTER_H
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/PhotoshopExporter/PhotoshopExporter.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/PhotoshopExporter/PhotoshopExporter.vcproj
deleted file mode 100644
index d0c9ffbb..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/PhotoshopExporter/PhotoshopExporter.vcproj
+++ /dev/null
@@ -1,234 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="PhotoshopExporter"
- ProjectGUID="{6CD8908D-06E4-4FD7-907A-0A1BDA67198F}"
- RootNamespace="PhotoshopExporter"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PHOTOSHOPEXPORTER_EXPORTS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\photoshopapi\photoshop;..\..\..\extern\photoshopapi\pica_sp;..\..\..\extern\photoshopapi\common\includes;..\..\..\extern\photoshopapi\general"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PHOTOSHOPEXPORTER_EXPORTS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\PhotoshopExporter.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\PhotoshopExporter.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- <Filter
- Name="Common Sources"
- >
- <File
- RelativePath="..\..\..\extern\photoshopapi\common\sources\DialogUtilitiesWin.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\extern\photoshopapi\common\sources\FileUtilities.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\extern\photoshopapi\common\sources\FileUtilitiesWin.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\extern\photoshopapi\common\sources\PIDLLInstance.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\extern\photoshopapi\common\sources\PIUSuites.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\extern\photoshopapi\common\sources\PIUtilities.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\extern\photoshopapi\common\sources\PIUtilitiesWin.cpp"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/nvassemble.rc b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/nvassemble.rc
deleted file mode 100644
index 842ded19..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/nvassemble.rc
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/nvassemble.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/nvassemble.vcproj
deleted file mode 100644
index d0052fa6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/nvassemble.vcproj
+++ /dev/null
@@ -1,352 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="nvassemble"
- ProjectGUID="{3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- AdditionalLibraryDirectories="..\..\..\extern\FreeImage"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- AdditionalLibraryDirectories="..\..\..\extern\FreeImage"
- LinkTimeCodeGeneration="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\assemble.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\cmdline.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvassemble.rc"
- >
- </File>
- <File
- RelativePath=".\nvidia.ico"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/nvidia.ico b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/nvidia.ico
deleted file mode 100644
index 6aa721e6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/nvidia.ico
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/resource.h
deleted file mode 100644
index e765787d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvassemble/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvcompress.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/nvcompress.rc b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/nvcompress.rc
deleted file mode 100644
index 842ded19..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/nvcompress.rc
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/nvcompress.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/nvcompress.vcproj
deleted file mode 100644
index a37c0c59..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/nvcompress.vcproj
+++ /dev/null
@@ -1,688 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="nvcompress"
- ProjectGUID="{88079E38-83AA-4E8A-B18A-66A78D1B058B}"
- RootNamespace="nvcompress"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVDXT_SHARED"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug (no cuda)|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug (no cuda)|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVDXT_SHARED"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release (no cuda)|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release (no cuda)|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- WholeProgramOptimization="true"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
- RuntimeLibrary="2"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- LinkTimeCodeGeneration="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\compress.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\cmdline.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvcompress.rc"
- >
- </File>
- <File
- RelativePath=".\nvidia.ico"
- DeploymentContent="true"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/nvidia.ico b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/nvidia.ico
deleted file mode 100644
index 6aa721e6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/nvidia.ico
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/resource.h
deleted file mode 100644
index e765787d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcompress/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvcompress.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvconfig.h b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvconfig.h
deleted file mode 100644
index 6979b690..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvconfig.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef NV_CONFIG
-#define NV_CONFIG
-
-//#cmakedefine HAVE_UNISTD_H
-#define HAVE_STDARG_H
-//#cmakedefine HAVE_SIGNAL_H
-//#cmakedefine HAVE_EXECINFO_H
-#define HAVE_MALLOC_H
-
-#if !defined(_M_X64)
-#define HAVE_PNG
-#define HAVE_JPEG
-#define HAVE_TIFF
-//#define HAVE_FREEIMAGE
-#endif
-
-#endif // NV_CONFIG
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcore/nvcore.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcore/nvcore.vcproj
deleted file mode 100644
index e7f76937..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvcore/nvcore.vcproj
+++ /dev/null
@@ -1,374 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="nvcore"
- ProjectGUID="{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}"
- RootNamespace="nvcore"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvcore\Debug.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\FileSystem.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Library.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Memory.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\StrLib.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\TextReader.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\TextWriter.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvcore\Containers.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Debug.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\DefsVcWin32.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\FileSystem.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Library.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Memory.h"
- >
- </File>
- <File
- RelativePath="..\nvconfig.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\nvcore.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Ptr.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\StdStream.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Stream.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\StrLib.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\TextReader.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\TextWriter.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/nvddsinfo.rc b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/nvddsinfo.rc
deleted file mode 100644
index 842ded19..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/nvddsinfo.rc
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/nvddsinfo.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/nvddsinfo.vcproj
deleted file mode 100644
index bade0dc4..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/nvddsinfo.vcproj
+++ /dev/null
@@ -1,351 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="nvddsinfo"
- ProjectGUID="{841B73C5-C679-4EEF-A50A-7D6106642B49}"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- AdditionalLibraryDirectories="..\..\..\extern\FreeImage"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- AdditionalLibraryDirectories="..\..\..\extern\FreeImage"
- LinkTimeCodeGeneration="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\ddsinfo.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\cmdline.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvddsinfo.rc"
- >
- </File>
- <File
- RelativePath=".\nvidia.ico"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/nvidia.ico b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/nvidia.ico
deleted file mode 100644
index 6aa721e6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/nvidia.ico
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/resource.h
deleted file mode 100644
index e765787d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvddsinfo/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvcompress.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/nvdecompress.rc b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/nvdecompress.rc
deleted file mode 100644
index 842ded19..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/nvdecompress.rc
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/nvdecompress.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/nvdecompress.vcproj
deleted file mode 100644
index 99658739..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/nvdecompress.vcproj
+++ /dev/null
@@ -1,381 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="nvdecompress"
- ProjectGUID="{75A0527D-BFC9-49C3-B46B-CD1A901D5927}"
- RootNamespace="nvdecompress"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVDXT_SHARED"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="false"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\FreeImage"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\decompress.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\cmdline.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvdecompress.rc"
- >
- </File>
- <File
- RelativePath=".\nvidia.ico"
- DeploymentContent="true"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/nvidia.ico b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/nvidia.ico
deleted file mode 100644
index 6aa721e6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/nvidia.ico
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/resource.h
deleted file mode 100644
index e765787d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvdecompress/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvcompress.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimage/nvimage.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimage/nvimage.vcproj
deleted file mode 100644
index 6858999c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimage/nvimage.vcproj
+++ /dev/null
@@ -1,382 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="nvimage"
- ProjectGUID="{4046F392-A18B-4C66-9639-3EABFFF5D531}"
- RootNamespace="nvimage"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;..\..\..\extern\FreeImage"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;..\..\..\extern\FreeImage"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;..\..\..\extern\FreeImage"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;..\..\..\extern\FreeImage"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvimage\BlockDXT.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\ColorBlock.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\ColorSpace.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\DirectDrawSurface.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\Filter.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\FloatImage.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\Image.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\ImageIO.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\NormalMap.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\Quantize.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvimage\BlockDXT.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\ColorBlock.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\ColorSpace.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\DirectDrawSurface.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\Filter.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\FloatImage.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\Image.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\ImageIO.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\NormalMap.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\nvimage.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\PsdFile.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\Quantize.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\TgaFile.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/nvidia.ico b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/nvidia.ico
deleted file mode 100644
index 6aa721e6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/nvidia.ico
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/nvimgdiff.rc b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/nvimgdiff.rc
deleted file mode 100644
index 842ded19..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/nvimgdiff.rc
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/nvimgdiff.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/nvimgdiff.vcproj
deleted file mode 100644
index e8a60a57..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/nvimgdiff.vcproj
+++ /dev/null
@@ -1,381 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="nvimgdiff"
- ProjectGUID="{05A59E8B-EA70-4F22-89E8-E0927BA13064}"
- RootNamespace="nvimgdiff"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVDXT_SHARED"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="false"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\imgdiff.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\cmdline.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvidia.ico"
- DeploymentContent="true"
- >
- </File>
- <File
- RelativePath=".\nvimgdiff.rc"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/resource.h
deleted file mode 100644
index e765787d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvimgdiff/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvcompress.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvmath/nvmath.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvmath/nvmath.vcproj
deleted file mode 100644
index ad93a680..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvmath/nvmath.vcproj
+++ /dev/null
@@ -1,330 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="nvmath"
- ProjectGUID="{50C465FE-B308-42BC-894D-89484482AF06}"
- RootNamespace="nvmath"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvmath\Fitting.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Half.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Plane.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvmath\Box.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Color.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Fitting.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Half.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Matrix.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Plane.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Vector.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt.sln b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt.sln
deleted file mode 100644
index 93a637a7..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt.sln
+++ /dev/null
@@ -1,359 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvtt", "nvtt\nvtt.vcproj", "{1AEB7681-57D8-48EE-813D-5C41CC38B647}"
- ProjectSection(ProjectDependencies) = postProject
- {CE017322-01FC-4851-9C8B-64E9A8E26C38} = {CE017322-01FC-4851-9C8B-64E9A8E26C38}
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvcompress", "nvcompress\nvcompress.vcproj", "{88079E38-83AA-4E8A-B18A-66A78D1B058B}"
- ProjectSection(ProjectDependencies) = postProject
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- {1AEB7681-57D8-48EE-813D-5C41CC38B647} = {1AEB7681-57D8-48EE-813D-5C41CC38B647}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvimage", "nvimage\nvimage.vcproj", "{4046F392-A18B-4C66-9639-3EABFFF5D531}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvcore", "nvcore\nvcore.vcproj", "{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvmath", "nvmath\nvmath.vcproj", "{50C465FE-B308-42BC-894D-89484482AF06}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "squish", "squish\squish.vcproj", "{CE017322-01FC-4851-9C8B-64E9A8E26C38}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvddsinfo", "nvddsinfo\nvddsinfo.vcproj", "{841B73C5-C679-4EEF-A50A-7D6106642B49}"
- ProjectSection(ProjectDependencies) = postProject
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvdecompress", "nvdecompress\nvdecompress.vcproj", "{75A0527D-BFC9-49C3-B46B-CD1A901D5927}"
- ProjectSection(ProjectDependencies) = postProject
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvimgdiff", "nvimgdiff\nvimgdiff.vcproj", "{05A59E8B-EA70-4F22-89E8-E0927BA13064}"
- ProjectSection(ProjectDependencies) = postProject
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvassemble", "nvassemble\nvassemble.vcproj", "{3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}"
- ProjectSection(ProjectDependencies) = postProject
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvzoom", "nvzoom\nvzoom.vcproj", "{51999D3E-EF22-4BDD-965F-4201034D3DCE}"
- ProjectSection(ProjectDependencies) = postProject
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nvidia.TextureTools", "Nvidia.TextureTools\Nvidia.TextureTools.csproj", "{CAB55C39-8FA9-4912-98D9-E52669C8911D}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress", "stress\stress.vcproj", "{317B694E-B5C1-42A6-956F-FC12B69175A6}"
- ProjectSection(ProjectDependencies) = postProject
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- {1AEB7681-57D8-48EE-813D-5C41CC38B647} = {1AEB7681-57D8-48EE-813D-5C41CC38B647}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PhotoshopExporter", "PhotoshopExporter\PhotoshopExporter.vcproj", "{6CD8908D-06E4-4FD7-907A-0A1BDA67198F}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug (no cuda)|Any CPU = Debug (no cuda)|Any CPU
- Debug (no cuda)|Win32 = Debug (no cuda)|Win32
- Debug (no cuda)|x64 = Debug (no cuda)|x64
- Debug|Any CPU = Debug|Any CPU
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release (no cuda)|Any CPU = Release (no cuda)|Any CPU
- Release (no cuda)|Win32 = Release (no cuda)|Win32
- Release (no cuda)|x64 = Release (no cuda)|x64
- Release|Any CPU = Release|Any CPU
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|Any CPU.ActiveCfg = Debug (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|Any CPU.Build.0 = Debug (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|Win32.ActiveCfg = Debug (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|Win32.Build.0 = Debug (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|x64.ActiveCfg = Debug (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|Any CPU.ActiveCfg = Debug|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|Any CPU.Build.0 = Debug|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|Win32.ActiveCfg = Debug|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|Win32.Build.0 = Debug|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|x64.ActiveCfg = Debug|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|Any CPU.ActiveCfg = Release (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|Any CPU.Build.0 = Release (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|Win32.ActiveCfg = Release (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|Win32.Build.0 = Release (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|x64.ActiveCfg = Release (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|Any CPU.ActiveCfg = Release|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|Any CPU.Build.0 = Release|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|Win32.ActiveCfg = Release|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|Win32.Build.0 = Release|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|x64.ActiveCfg = Release|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|Any CPU.ActiveCfg = Debug (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|Win32.ActiveCfg = Debug (no cuda)|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|Win32.Build.0 = Debug (no cuda)|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|x64.ActiveCfg = Debug (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|x64.Build.0 = Debug (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|Any CPU.ActiveCfg = Debug|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|Win32.ActiveCfg = Debug|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|Win32.Build.0 = Debug|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|x64.ActiveCfg = Debug|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|x64.Build.0 = Debug|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|Any CPU.ActiveCfg = Release (no cuda)|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|Win32.ActiveCfg = Release (no cuda)|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|Win32.Build.0 = Release (no cuda)|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|x64.ActiveCfg = Release (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|x64.Build.0 = Release (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|Any CPU.ActiveCfg = Release|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|Win32.ActiveCfg = Release|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|Win32.Build.0 = Release|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|x64.ActiveCfg = Release|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|x64.Build.0 = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|Any CPU.ActiveCfg = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|Win32.ActiveCfg = Debug|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|Win32.Build.0 = Debug|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|x64.ActiveCfg = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|x64.Build.0 = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|x64.Build.0 = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|Any CPU.ActiveCfg = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|Win32.ActiveCfg = Release|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|Win32.Build.0 = Release|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|x64.ActiveCfg = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|x64.Build.0 = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|Any CPU.ActiveCfg = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|Win32.ActiveCfg = Debug|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|Win32.Build.0 = Debug|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|x64.ActiveCfg = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|x64.Build.0 = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|x64.Build.0 = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|Any CPU.ActiveCfg = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|Win32.ActiveCfg = Release|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|Win32.Build.0 = Release|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|x64.ActiveCfg = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|x64.Build.0 = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug|Any CPU.ActiveCfg = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug|Win32.ActiveCfg = Debug|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug|Win32.Build.0 = Debug|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug|x64.ActiveCfg = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug|x64.Build.0 = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|x64.Build.0 = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release|Any CPU.ActiveCfg = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release|Win32.ActiveCfg = Release|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Release|Win32.Build.0 = Release|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Release|x64.ActiveCfg = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release|x64.Build.0 = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|Any CPU.ActiveCfg = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|Win32.ActiveCfg = Debug|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|Win32.Build.0 = Debug|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|x64.ActiveCfg = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|x64.Build.0 = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|x64.Build.0 = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|Any CPU.ActiveCfg = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|Win32.ActiveCfg = Release|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|Win32.Build.0 = Release|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|x64.ActiveCfg = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|x64.Build.0 = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|Any CPU.ActiveCfg = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|Win32.ActiveCfg = Debug|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|Win32.Build.0 = Debug|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|x64.ActiveCfg = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|x64.Build.0 = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|x64.Build.0 = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|Any CPU.ActiveCfg = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|Win32.ActiveCfg = Release|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|Win32.Build.0 = Release|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|x64.ActiveCfg = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|x64.Build.0 = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|Any CPU.ActiveCfg = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|Win32.ActiveCfg = Debug|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|Win32.Build.0 = Debug|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|x64.ActiveCfg = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|x64.Build.0 = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|x64.Build.0 = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|Any CPU.ActiveCfg = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|Win32.ActiveCfg = Release|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|Win32.Build.0 = Release|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|x64.ActiveCfg = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|x64.Build.0 = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|Any CPU.ActiveCfg = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|Win32.ActiveCfg = Debug|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|Win32.Build.0 = Debug|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|x64.ActiveCfg = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|x64.Build.0 = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|x64.Build.0 = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|Any CPU.ActiveCfg = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|Win32.ActiveCfg = Release|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|Win32.Build.0 = Release|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|x64.ActiveCfg = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|x64.Build.0 = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|Any CPU.ActiveCfg = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|Win32.ActiveCfg = Debug|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|Win32.Build.0 = Debug|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|x64.ActiveCfg = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|x64.Build.0 = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|x64.Build.0 = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|Any CPU.ActiveCfg = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|Win32.ActiveCfg = Release|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|Win32.Build.0 = Release|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|x64.ActiveCfg = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|x64.Build.0 = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|Any CPU.ActiveCfg = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|Win32.ActiveCfg = Debug|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|Win32.Build.0 = Debug|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|x64.ActiveCfg = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|x64.Build.0 = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|x64.Build.0 = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|Any CPU.ActiveCfg = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|Win32.ActiveCfg = Release|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|Win32.Build.0 = Release|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|x64.ActiveCfg = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|x64.Build.0 = Release|x64
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|Any CPU.Build.0 = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|Win32.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|x64.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|Win32.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|x64.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|Any CPU.ActiveCfg = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|Any CPU.Build.0 = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|Win32.ActiveCfg = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|x64.ActiveCfg = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|Any CPU.Build.0 = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|Win32.ActiveCfg = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|x64.ActiveCfg = Release|Any CPU
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|x64.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|Any CPU.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|Win32.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|Win32.Build.0 = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|x64.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|x64.ActiveCfg = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|Any CPU.ActiveCfg = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|Win32.ActiveCfg = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|Win32.Build.0 = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|x64.ActiveCfg = Release|Win32
- {6CD8908D-06E4-4FD7-907A-0A1BDA67198F}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|Win32
- {6CD8908D-06E4-4FD7-907A-0A1BDA67198F}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {6CD8908D-06E4-4FD7-907A-0A1BDA67198F}.Debug (no cuda)|x64.ActiveCfg = Debug|Win32
- {6CD8908D-06E4-4FD7-907A-0A1BDA67198F}.Debug|Any CPU.ActiveCfg = Debug|Win32
- {6CD8908D-06E4-4FD7-907A-0A1BDA67198F}.Debug|Win32.ActiveCfg = Debug|Win32
- {6CD8908D-06E4-4FD7-907A-0A1BDA67198F}.Debug|x64.ActiveCfg = Debug|Win32
- {6CD8908D-06E4-4FD7-907A-0A1BDA67198F}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32
- {6CD8908D-06E4-4FD7-907A-0A1BDA67198F}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {6CD8908D-06E4-4FD7-907A-0A1BDA67198F}.Release (no cuda)|x64.ActiveCfg = Release|Win32
- {6CD8908D-06E4-4FD7-907A-0A1BDA67198F}.Release|Any CPU.ActiveCfg = Release|Win32
- {6CD8908D-06E4-4FD7-907A-0A1BDA67198F}.Release|Win32.ActiveCfg = Release|Win32
- {6CD8908D-06E4-4FD7-907A-0A1BDA67198F}.Release|x64.ActiveCfg = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt/nvtt.rc b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt/nvtt.rc
deleted file mode 100644
index fed5ab71..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt/nvtt.rc
+++ /dev/null
@@ -1,102 +0,0 @@
-// Microsoft Visual C++ 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
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 2,1,0,0
- PRODUCTVERSION 2,1,0,0
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "NVIDIA Corporation"
- VALUE "FileDescription", "NVIDIA Texture Tools Dynamic Link Library"
- VALUE "FileVersion", "2, 1, 0, 0"
- VALUE "InternalName", "nvtt"
- VALUE "LegalCopyright", "Copyright (C) 2007"
- VALUE "OriginalFilename", "nvtt.dll"
- VALUE "ProductName", "NVIDIA Texture Tools Dynamic Link Library"
- VALUE "ProductVersion", "2, 1, 0, 0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt/nvtt.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt/nvtt.vcproj
deleted file mode 100644
index 82492395..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt/nvtt.vcproj
+++ /dev/null
@@ -1,949 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="nvtt"
- ProjectGUID="{1AEB7681-57D8-48EE-813D-5C41CC38B647}"
- RootNamespace="nvtt"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include;$(CUDA_INC_PATH)"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib cudart.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage;$(CUDA_LIB_PATH)"
- GenerateDebugInformation="true"
- SubSystem="2"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- Description="Copying header files..."
- CommandLine="xcopy /y /f /i &quot;$(SolutionDir)\..\..\src\nvtt\nvtt*.h&quot; &quot;$(SolutionDir)\$(ConfigurationName).$(PlatformName)\include\nvtt\&quot;"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- EnableIntrinsicFunctions="true"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include;$(CUDA_INC_PATH)"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib cudart.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage;$(CUDA_LIB_PATH)"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- Description="Copying header files..."
- CommandLine="xcopy /y /f /i &quot;$(SolutionDir)\..\..\src\nvtt\nvtt*.h&quot; &quot;$(SolutionDir)\$(ConfigurationName).$(PlatformName)\include\nvtt\&quot;"
- />
- </Configuration>
- <Configuration
- Name="Debug (no cuda)|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include;"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="2"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- Description="Copying header files..."
- CommandLine="xcopy /y /f /i &quot;$(SolutionDir)\..\..\src\nvtt\nvtt*.h&quot; &quot;$(SolutionDir)\$(ConfigurationName).$(PlatformName)\include\nvtt\&quot;"
- />
- </Configuration>
- <Configuration
- Name="Release (no cuda)|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- EnableIntrinsicFunctions="true"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include;"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage;$(CUDA_LIB_PATH)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- Description="Copying header files..."
- CommandLine="xcopy /y /f /i &quot;$(SolutionDir)\..\..\src\nvtt\nvtt*.h&quot; &quot;$(SolutionDir)\$(ConfigurationName).$(PlatformName)\include\nvtt\&quot;"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include;$(CUDA_INC_PATH)"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="cudart.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\FreeImage;&quot;$(CUDA_LIB_PATH)&quot;"
- GenerateDebugInformation="true"
- SubSystem="2"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- EnableIntrinsicFunctions="true"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include;$(CUDA_INC_PATH)"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="cudart.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\FreeImage;&quot;$(CUDA_LIB_PATH)&quot;"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug (no cuda)|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="2"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release (no cuda)|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- EnableIntrinsicFunctions="true"
- OmitFramePointers="true"
- WholeProgramOptimization="true"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\FreeImage"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- LinkTimeCodeGeneration="1"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\CompressDXT.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\CompressionOptions.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\CompressKernel.cu"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="&quot;$(CUDA_BIN_PATH)\nvcc.exe&quot; -keep -ccbin &quot;$(VCInstallDir)bin&quot; -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MDd -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
- AdditionalDependencies="CudaMath.h;../SingleColorLookup.h"
- Outputs="$(IntDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="&quot;$(CUDA_BIN_PATH)\nvcc.exe&quot; -keep -ccbin &quot;$(VCInstallDir)bin&quot; -c -DNDEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/O2,/Zi,/MD -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
- AdditionalDependencies="CudaMath.h;../SingleColorLookup.h"
- Outputs="$(IntDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug (no cuda)|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="$(CUDA_BIN_PATH)\nvcc.exe -ccbin &quot;$(VCInstallDir)bin&quot; -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MDd -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
- AdditionalDependencies="CudaMath.h;../SingleColorLookup.h"
- Outputs="$(IntDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release (no cuda)|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="$(CUDA_BIN_PATH)\nvcc.exe -ccbin &quot;$(VCInstallDir)bin&quot; -c -DNDEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/O2,/Zi,/MD -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
- AdditionalDependencies="CudaMath.h;../SingleColorLookup.h"
- Outputs="$(IntDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="&quot;$(CUDA_BIN_PATH)\nvcc.exe&quot; -keep -ccbin &quot;$(VCInstallDir)bin&quot; -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MDd -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
- AdditionalDependencies="CudaMath.h"
- Outputs="$(IntDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="&quot;$(CUDA_BIN_PATH)\nvcc.exe&quot; -keep -ccbin &quot;$(VCInstallDir)bin&quot; -c -DNDEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/O2,/Zi,/MD -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
- AdditionalDependencies="CudaMath.h"
- Outputs="$(IntDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug (no cuda)|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release (no cuda)|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\Compressor.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\CompressRGB.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\ConvolveKernel.cu"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug (no cuda)|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release (no cuda)|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug (no cuda)|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release (no cuda)|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\CudaCompressDXT.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\CudaUtils.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\InputOptions.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\nvtt.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\nvtt_wrapper.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\OptimalCompressDXT.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\OutputOptions.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\QuickCompressDXT.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\cuda\Bitmaps.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\CompressDXT.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\CompressionOptions.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\Compressor.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\CompressRGB.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\CudaCompressDXT.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\CudaMath.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\CudaUtils.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\InputOptions.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\nvtt.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\nvtt_wrapper.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\OptimalCompressDXT.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\OutputOptions.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\QuickCompressDXT.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvtt.rc"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt/resource.h
deleted file mode 100644
index 4df7169c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvtt/resource.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvtt.rc
-
-// 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/Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/nvidia.ico b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/nvidia.ico
deleted file mode 100644
index 6aa721e6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/nvidia.ico
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/nvzoom.rc b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/nvzoom.rc
deleted file mode 100644
index 842ded19..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/nvzoom.rc
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/nvzoom.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/nvzoom.vcproj
deleted file mode 100644
index 4fa08ac5..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/nvzoom.vcproj
+++ /dev/null
@@ -1,381 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="nvzoom"
- ProjectGUID="{51999D3E-EF22-4BDD-965F-4201034D3DCE}"
- RootNamespace="nvzoom"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVDXT_SHARED"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="false"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\FreeImage"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\resize.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\cmdline.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvidia.ico"
- DeploymentContent="true"
- >
- </File>
- <File
- RelativePath=".\nvzoom.rc"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/resource.h
deleted file mode 100644
index e765787d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/nvzoom/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvcompress.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/squish/squish.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/squish/squish.vcproj
deleted file mode 100644
index 64a0528b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/squish/squish.vcproj
+++ /dev/null
@@ -1,358 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="squish"
- ProjectGUID="{CE017322-01FC-4851-9C8B-64E9A8E26C38}"
- RootNamespace="squish"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\squish\clusterfit.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\colourblock.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\colourfit.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\colourset.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\fastclusterfit.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\maths.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\weightedclusterfit.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\squish\clusterfit.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\colourblock.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\colourfit.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\colourset.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\fastclusterfit.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\maths.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\simd.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\simd_sse.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\squish.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\weightedclusterfit.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc8/stress/stress.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc8/stress/stress.vcproj
deleted file mode 100644
index c61df416..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc8/stress/stress.vcproj
+++ /dev/null
@@ -1,205 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="stress"
- ProjectGUID="{317B694E-B5C1-42A6-956F-FC12B69175A6}"
- RootNamespace="stress"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="FreeImage.lib jpeg.lib libpng.lib tiff.lib zlib.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;..\..\..\extern\FreeImage"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tests\stress.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/Nvidia.TextureTools/Nvidia.TextureTools.csproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/Nvidia.TextureTools/Nvidia.TextureTools.csproj
deleted file mode 100644
index 06a2fab8..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/Nvidia.TextureTools/Nvidia.TextureTools.csproj
+++ /dev/null
@@ -1,53 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.21022</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{CAB55C39-8FA9-4912-98D9-E52669C8911D}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Nvidia.TextureTools</RootNamespace>
- <AssemblyName>Nvidia.TextureTools</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="TextureTools.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project> \ No newline at end of file
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/Nvidia.TextureTools/Properties/AssemblyInfo.cs b/Libraries/nvidia-texture-tools-read-only/project/vc9/Nvidia.TextureTools/Properties/AssemblyInfo.cs
deleted file mode 100644
index 91a64038..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/Nvidia.TextureTools/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Nvidia.TextureTools")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("NVIDIA Corporation")]
-[assembly: AssemblyProduct("Nvidia.TextureTools")]
-[assembly: AssemblyCopyright("Copyright © NVIDIA 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("5fa03fb3-b7a3-4ba8-90e7-545929731356")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/Nvidia.TextureTools/TextureTools.cs b/Libraries/nvidia-texture-tools-read-only/project/vc9/Nvidia.TextureTools/TextureTools.cs
deleted file mode 100644
index b9b2698b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/Nvidia.TextureTools/TextureTools.cs
+++ /dev/null
@@ -1,526 +0,0 @@
-using System;
-using System.Security;
-using System.Runtime.InteropServices;
-
-namespace Nvidia.TextureTools
-{
- #region Enums
-
- #region public enum Format
- /// <summary>
- /// Compression format.
- /// </summary>
- public enum Format
- {
- // No compression.
- RGB,
- RGBA = RGB,
-
- // DX9 formats.
- DXT1,
- DXT1a,
- DXT3,
- DXT5,
- DXT5n,
-
- // DX10 formats.
- BC1 = DXT1,
- BC1a = DXT1a,
- BC2 = DXT3,
- BC3 = DXT5,
- BC3n = DXT5n,
- BC4,
- BC5,
- }
- #endregion
-
- #region public enum Quality
- /// <summary>
- /// Quality modes.
- /// </summary>
- public enum Quality
- {
- Fastest,
- Normal,
- Production,
- Highest,
- }
- #endregion
-
- #region public enum WrapMode
- /// <summary>
- /// Wrap modes.
- /// </summary>
- public enum WrapMode
- {
- Clamp,
- Repeat,
- Mirror,
- }
- #endregion
-
- #region public enum TextureType
- /// <summary>
- /// Texture types.
- /// </summary>
- public enum TextureType
- {
- Texture2D,
- TextureCube,
- }
- #endregion
-
- #region public enum InputFormat
- /// <summary>
- /// Input formats.
- /// </summary>
- public enum InputFormat
- {
- BGRA_8UB
- }
- #endregion
-
- #region public enum MipmapFilter
- /// <summary>
- /// Mipmap downsampling filters.
- /// </summary>
- public enum MipmapFilter
- {
- Box,
- Triangle,
- Kaiser
- }
- #endregion
-
- #region public enum ColorTransform
- /// <summary>
- /// Color transformation.
- /// </summary>
- public enum ColorTransform
- {
- None,
- Linear
- }
- #endregion
-
- #region public enum RoundMode
- /// <summary>
- /// Extents rounding mode.
- /// </summary>
- public enum RoundMode
- {
- None,
- ToNextPowerOfTwo,
- ToNearestPowerOfTwo,
- ToPreviousPowerOfTwo
- }
- #endregion
-
- #region public enum AlphaMode
- /// <summary>
- /// Alpha mode.
- /// </summary>
- public enum AlphaMode
- {
- None,
- Transparency,
- Premultiplied
- }
- #endregion
-
- #region public enum Error
- /// <summary>
- /// Error codes.
- /// </summary>
- public enum Error
- {
- InvalidInput,
- UserInterruption,
- UnsupportedFeature,
- CudaError,
- Unknown,
- FileOpen,
- FileWrite,
- }
- #endregion
-
- #endregion
-
- #region public class InputOptions
- /// <summary>
- /// Input options.
- /// </summary>
- public class InputOptions
- {
- #region Bindings
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static IntPtr nvttCreateInputOptions();
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttDestroyInputOptions(IntPtr inputOptions);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsTextureLayout(IntPtr inputOptions, TextureType type, int w, int h, int d);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttResetInputOptionsTextureLayout(IntPtr inputOptions);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static bool nvttSetInputOptionsMipmapData(IntPtr inputOptions, IntPtr data, int w, int h, int d, int face, int mipmap);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsFormat(IntPtr inputOptions, InputFormat format);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsAlphaMode(IntPtr inputOptions, AlphaMode alphaMode);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsGamma(IntPtr inputOptions, float inputGamma, float outputGamma);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsWrapMode(IntPtr inputOptions, WrapMode mode);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsMipmapFilter(IntPtr inputOptions, MipmapFilter filter);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsMipmapGeneration(IntPtr inputOptions, bool generateMipmaps, int maxLevel);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsKaiserParameters(IntPtr inputOptions, float width, float alpha, float stretch);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsNormalMap(IntPtr inputOptions, bool b);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsConvertToNormalMap(IntPtr inputOptions, bool convert);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsHeightEvaluation(IntPtr inputOptions, float redScale, float greenScale, float blueScale, float alphaScale);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsNormalFilter(IntPtr inputOptions, float small, float medium, float big, float large);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsNormalizeMipmaps(IntPtr inputOptions, bool b);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsColorTransform(IntPtr inputOptions, ColorTransform t);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsLinearTransfrom(IntPtr inputOptions, int channel, float w0, float w1, float w2, float w3);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsMaxExtents(IntPtr inputOptions, int d);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetInputOptionsRoundMode(IntPtr inputOptions, RoundMode mode);
- #endregion
-
- internal IntPtr options;
-
- public InputOptions()
- {
- options = nvttCreateInputOptions();
- }
- ~InputOptions()
- {
- nvttDestroyInputOptions(options);
- }
-
- public void SetTextureLayout(TextureType type, int w, int h, int d)
- {
- nvttSetInputOptionsTextureLayout(options, type, w, h, d);
- }
- public void ResetTextureLayout()
- {
- nvttResetInputOptionsTextureLayout(options);
- }
-
- public void SetMipmapData(IntPtr data, int width, int height, int depth, int face, int mipmap)
- {
- nvttSetInputOptionsMipmapData(options, data, width, height, depth, face, mipmap);
- }
-
- public void SetFormat(InputFormat format)
- {
- nvttSetInputOptionsFormat(options, format);
- }
-
- public void SetAlphaMode(AlphaMode alphaMode)
- {
- nvttSetInputOptionsAlphaMode(options, alphaMode);
- }
-
- public void SetGamma(float inputGamma, float outputGamma)
- {
- nvttSetInputOptionsGamma(options, inputGamma, outputGamma);
- }
-
- public void SetWrapMode(WrapMode wrapMode)
- {
- nvttSetInputOptionsWrapMode(options, wrapMode);
- }
-
- public void SetMipmapFilter(MipmapFilter filter)
- {
- nvttSetInputOptionsMipmapFilter(options, filter);
- }
-
- public void SetMipmapGeneration(bool enabled)
- {
- nvttSetInputOptionsMipmapGeneration(options, enabled, -1);
- }
-
- public void SetMipmapGeneration(bool enabled, int maxLevel)
- {
- nvttSetInputOptionsMipmapGeneration(options, enabled, maxLevel);
- }
-
- public void SetKaiserParameters(float width, float alpha, float stretch)
- {
- nvttSetInputOptionsKaiserParameters(options, width, alpha, stretch);
- }
-
- public void SetNormalMap(bool b)
- {
- nvttSetInputOptionsNormalMap(options, b);
- }
-
- public void SetConvertToNormalMap(bool convert)
- {
- nvttSetInputOptionsConvertToNormalMap(options, convert);
- }
-
- public void SetHeightEvaluation(float redScale, float greenScale, float blueScale, float alphaScale)
- {
- nvttSetInputOptionsHeightEvaluation(options, redScale, greenScale, blueScale, alphaScale);
- }
-
- public void SetNormalFilter(float small, float medium, float big, float large)
- {
- nvttSetInputOptionsNormalFilter(options, small, medium, big, large);
- }
-
- public void SetNormalizeMipmaps(bool b)
- {
- nvttSetInputOptionsNormalizeMipmaps(options, b);
- }
-
- public void SetColorTransform(ColorTransform t)
- {
- nvttSetInputOptionsColorTransform(options, t);
- }
-
- public void SetLinearTransfrom(int channel, float w0, float w1, float w2, float w3)
- {
- nvttSetInputOptionsLinearTransfrom(options, channel, w0, w1, w2, w3);
- }
-
- public void SetMaxExtents(int dim)
- {
- nvttSetInputOptionsMaxExtents(options, dim);
- }
-
- public void SetRoundMode(RoundMode mode)
- {
- nvttSetInputOptionsRoundMode(options, mode);
- }
- }
- #endregion
-
- #region public class CompressionOptions
- /// <summary>
- /// Compression options.
- /// </summary>
- public class CompressionOptions
- {
- #region Bindings
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static IntPtr nvttCreateCompressionOptions();
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttDestroyCompressionOptions(IntPtr compressionOptions);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetCompressionOptionsFormat(IntPtr compressionOptions, Format format);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetCompressionOptionsQuality(IntPtr compressionOptions, Quality quality);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetCompressionOptionsColorWeights(IntPtr compressionOptions, float red, float green, float blue, float alpha);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetCompressionOptionsPixelFormat(IntPtr compressionOptions, uint bitcount, uint rmask, uint gmask, uint bmask, uint amask);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetCompressionOptionsQuantization(IntPtr compressionOptions, bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold);
- #endregion
-
- internal IntPtr options;
-
- public CompressionOptions()
- {
- options = nvttCreateCompressionOptions();
- }
- ~CompressionOptions()
- {
- nvttDestroyCompressionOptions(options);
- }
-
- public void SetFormat(Format format)
- {
- nvttSetCompressionOptionsFormat(options, format);
- }
-
- public void SetQuality(Quality quality)
- {
- nvttSetCompressionOptionsQuality(options, quality);
- }
-
- public void SetColorWeights(float red, float green, float blue)
- {
- nvttSetCompressionOptionsColorWeights(options, red, green, blue, 1.0f);
- }
-
- public void SetColorWeights(float red, float green, float blue, float alpha)
- {
- nvttSetCompressionOptionsColorWeights(options, red, green, blue, alpha);
- }
-
- public void SetPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
- {
- nvttSetCompressionOptionsPixelFormat(options, bitcount, rmask, gmask, bmask, amask);
- }
-
- public void SetQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha)
- {
- nvttSetCompressionOptionsQuantization(options, colorDithering, alphaDithering, binaryAlpha, 127);
- }
-
- public void SetQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold)
- {
- nvttSetCompressionOptionsQuantization(options, colorDithering, alphaDithering, binaryAlpha, alphaThreshold);
- }
- }
- #endregion
-
- #region public class OutputOptions
- /// <summary>
- /// Output options.
- /// </summary>
- public class OutputOptions
- {
- #region Delegates
- public delegate void ErrorHandler(Error error);
- private delegate void WriteDataDelegate(IntPtr data, int size);
- private delegate void ImageDelegate(int size, int width, int height, int depth, int face, int miplevel);
- #endregion
-
- #region Bindings
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static IntPtr nvttCreateOutputOptions();
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttDestroyOutputOptions(IntPtr outputOptions);
-
- [DllImport("nvtt", CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetOutputOptionsFileName(IntPtr outputOptions, string fileName);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetOutputOptionsErrorHandler(IntPtr outputOptions, ErrorHandler errorHandler);
-
- private void ErrorCallback(Error error)
- {
- if (Error != null) Error(error);
- }
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttSetOutputOptionsOutputHeader(IntPtr outputOptions, bool b);
-
- //[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- //private extern static void nvttSetOutputOptionsOutputHandler(IntPtr outputOptions, WriteDataDelegate writeData, ImageDelegate image);
-
- #endregion
-
- internal IntPtr options;
-
- public OutputOptions()
- {
- options = nvttCreateOutputOptions();
- nvttSetOutputOptionsErrorHandler(options, new ErrorHandler(ErrorCallback));
- }
- ~OutputOptions()
- {
- nvttDestroyOutputOptions(options);
- }
-
- public void SetFileName(string fileName)
- {
- nvttSetOutputOptionsFileName(options, fileName);
- }
-
- public event ErrorHandler Error;
-
- public void SetOutputHeader(bool b)
- {
- nvttSetOutputOptionsOutputHeader(options, b);
- }
-
- // @@ Add OutputHandler interface.
- }
- #endregion
-
- #region public static class Compressor
- public class Compressor
- {
- #region Bindings
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static IntPtr nvttCreateCompressor();
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static void nvttDestroyCompressor(IntPtr compressor);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static bool nvttCompress(IntPtr compressor, IntPtr inputOptions, IntPtr compressionOptions, IntPtr outputOptions);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private extern static int nvttEstimateSize(IntPtr compressor, IntPtr inputOptions, IntPtr compressionOptions);
-
- [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
- private static extern IntPtr nvttErrorString(Error error);
-
- #endregion
-
- internal IntPtr compressor;
-
- public Compressor()
- {
- compressor = nvttCreateCompressor();
- }
-
- ~Compressor()
- {
- nvttDestroyCompressor(compressor);
- }
-
- public bool Compress(InputOptions input, CompressionOptions compression, OutputOptions output)
- {
- return nvttCompress(compressor, input.options, compression.options, output.options);
- }
-
- public int EstimateSize(InputOptions input, CompressionOptions compression)
- {
- return nvttEstimateSize(compressor, input.options, compression.options);
- }
-
- public static string ErrorString(Error error)
- {
- return Marshal.PtrToStringAnsi(nvttErrorString(error));
- }
-
- }
- #endregion
-
-} // Nvidia.TextureTools namespace
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/nvassemble.rc b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/nvassemble.rc
deleted file mode 100644
index 842ded19..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/nvassemble.rc
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/nvassemble.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/nvassemble.vcproj
deleted file mode 100644
index 874a4d8a..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/nvassemble.vcproj
+++ /dev/null
@@ -1,353 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="nvassemble"
- ProjectGUID="{3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}"
- RootNamespace="nvassemble"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\assemble.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\cmdline.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvassemble.rc"
- >
- </File>
- <File
- RelativePath=".\nvidia.ico"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/nvidia.ico b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/nvidia.ico
deleted file mode 100644
index 6aa721e6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/nvidia.ico
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/resource.h
deleted file mode 100644
index e765787d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvassemble/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvcompress.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/nvcompress.rc b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/nvcompress.rc
deleted file mode 100644
index 842ded19..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/nvcompress.rc
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/nvcompress.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/nvcompress.vcproj
deleted file mode 100644
index ca56a085..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/nvcompress.vcproj
+++ /dev/null
@@ -1,683 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="nvcompress"
- ProjectGUID="{88079E38-83AA-4E8A-B18A-66A78D1B058B}"
- RootNamespace="nvcompress"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVDXT_SHARED"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- EnableFiberSafeOptimizations="true"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug (no cuda)|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug (no cuda)|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVDXT_SHARED"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release (no cuda)|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- StringPooling="true"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release (no cuda)|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- WholeProgramOptimization="true"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
- RuntimeLibrary="2"
- WarningLevel="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- LinkTimeCodeGeneration="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\compress.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\cmdline.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvcompress.rc"
- >
- </File>
- <File
- RelativePath=".\nvidia.ico"
- DeploymentContent="true"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/nvidia.ico b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/nvidia.ico
deleted file mode 100644
index 6aa721e6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/nvidia.ico
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/resource.h
deleted file mode 100644
index e765787d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcompress/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvcompress.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvconfig.h b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvconfig.h
deleted file mode 100644
index ffe00a13..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvconfig.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef NV_CONFIG
-#define NV_CONFIG
-
-//#cmakedefine HAVE_UNISTD_H
-#define HAVE_STDARG_H
-//#cmakedefine HAVE_SIGNAL_H
-//#cmakedefine HAVE_EXECINFO_H
-#define HAVE_MALLOC_H
-
-#if !defined(_M_X64)
-#define HAVE_PNG
-#define HAVE_JPEG
-//#define HAVE_TIFF
-#endif
-
-#endif // NV_CONFIG
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcore/nvcore.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcore/nvcore.vcproj
deleted file mode 100644
index 699bdde7..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvcore/nvcore.vcproj
+++ /dev/null
@@ -1,363 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="nvcore"
- ProjectGUID="{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}"
- RootNamespace="nvcore"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- EnableFiberSafeOptimizations="true"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvcore\Debug.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Library.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Memory.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\StrLib.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\TextReader.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\TextWriter.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvcore\Containers.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Debug.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\DefsVcWin32.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Library.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Memory.h"
- >
- </File>
- <File
- RelativePath="..\nvconfig.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\nvcore.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\Ptr.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\StrLib.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\TextReader.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvcore\TextWriter.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/nvddsinfo.rc b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/nvddsinfo.rc
deleted file mode 100644
index 842ded19..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/nvddsinfo.rc
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/nvddsinfo.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/nvddsinfo.vcproj
deleted file mode 100644
index 808f28f8..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/nvddsinfo.vcproj
+++ /dev/null
@@ -1,352 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="nvddsinfo"
- ProjectGUID="{841B73C5-C679-4EEF-A50A-7D6106642B49}"
- RootNamespace="nvddsinfo"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\ddsinfo.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\cmdline.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvddsinfo.rc"
- >
- </File>
- <File
- RelativePath=".\nvidia.ico"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/nvidia.ico b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/nvidia.ico
deleted file mode 100644
index 6aa721e6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/nvidia.ico
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/resource.h
deleted file mode 100644
index e765787d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvddsinfo/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvcompress.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/nvdecompress.rc b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/nvdecompress.rc
deleted file mode 100644
index 842ded19..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/nvdecompress.rc
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/nvdecompress.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/nvdecompress.vcproj
deleted file mode 100644
index 48dcf9a1..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/nvdecompress.vcproj
+++ /dev/null
@@ -1,377 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="nvdecompress"
- ProjectGUID="{75A0527D-BFC9-49C3-B46B-CD1A901D5927}"
- RootNamespace="nvdecompress"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVDXT_SHARED"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="false"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\decompress.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\cmdline.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvdecompress.rc"
- >
- </File>
- <File
- RelativePath=".\nvidia.ico"
- DeploymentContent="true"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/nvidia.ico b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/nvidia.ico
deleted file mode 100644
index 6aa721e6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/nvidia.ico
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/resource.h
deleted file mode 100644
index e765787d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvdecompress/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvcompress.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimage/nvimage.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimage/nvimage.vcproj
deleted file mode 100644
index d018c11d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimage/nvimage.vcproj
+++ /dev/null
@@ -1,385 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="nvimage"
- ProjectGUID="{4046F392-A18B-4C66-9639-3EABFFF5D531}"
- RootNamespace="nvimage"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvimage\BlockDXT.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\ColorBlock.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\ColorSpace.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\DirectDrawSurface.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\Filter.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\FloatImage.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\Image.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\ImageIO.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\NormalMap.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\Quantize.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvimage\BlockDXT.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\ColorBlock.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\ColorSpace.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\DirectDrawSurface.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\Filter.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\FloatImage.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\Image.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\ImageIO.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\NormalMap.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\nvimage.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\PsdFile.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\Quantize.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvimage\TgaFile.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/nvidia.ico b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/nvidia.ico
deleted file mode 100644
index 6aa721e6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/nvidia.ico
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/nvimgdiff.rc b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/nvimgdiff.rc
deleted file mode 100644
index 842ded19..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/nvimgdiff.rc
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/nvimgdiff.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/nvimgdiff.vcproj
deleted file mode 100644
index e1ff4586..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/nvimgdiff.vcproj
+++ /dev/null
@@ -1,377 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="nvimgdiff"
- ProjectGUID="{05A59E8B-EA70-4F22-89E8-E0927BA13064}"
- RootNamespace="nvimgdiff"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVDXT_SHARED"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="false"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\imgdiff.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\cmdline.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvidia.ico"
- DeploymentContent="true"
- >
- </File>
- <File
- RelativePath=".\nvimgdiff.rc"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/resource.h
deleted file mode 100644
index e765787d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvimgdiff/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvcompress.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvmath/nvmath.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvmath/nvmath.vcproj
deleted file mode 100644
index ab41b528..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvmath/nvmath.vcproj
+++ /dev/null
@@ -1,319 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="nvmath"
- ProjectGUID="{50C465FE-B308-42BC-894D-89484482AF06}"
- RootNamespace="nvmath"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- EnableFiberSafeOptimizations="true"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvmath\Plane.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvmath\Box.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Color.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Matrix.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Plane.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Vector.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt.sln b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt.sln
deleted file mode 100644
index 03892bd5..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt.sln
+++ /dev/null
@@ -1,451 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvtt", "nvtt\nvtt.vcproj", "{1AEB7681-57D8-48EE-813D-5C41CC38B647}"
- ProjectSection(ProjectDependencies) = postProject
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- {CE017322-01FC-4851-9C8B-64E9A8E26C38} = {CE017322-01FC-4851-9C8B-64E9A8E26C38}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvcompress", "nvcompress\nvcompress.vcproj", "{88079E38-83AA-4E8A-B18A-66A78D1B058B}"
- ProjectSection(ProjectDependencies) = postProject
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {1AEB7681-57D8-48EE-813D-5C41CC38B647} = {1AEB7681-57D8-48EE-813D-5C41CC38B647}
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvimage", "nvimage\nvimage.vcproj", "{4046F392-A18B-4C66-9639-3EABFFF5D531}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvcore", "nvcore\nvcore.vcproj", "{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvmath", "nvmath\nvmath.vcproj", "{50C465FE-B308-42BC-894D-89484482AF06}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "squish", "squish\squish.vcproj", "{CE017322-01FC-4851-9C8B-64E9A8E26C38}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvddsinfo", "nvddsinfo\nvddsinfo.vcproj", "{841B73C5-C679-4EEF-A50A-7D6106642B49}"
- ProjectSection(ProjectDependencies) = postProject
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvdecompress", "nvdecompress\nvdecompress.vcproj", "{75A0527D-BFC9-49C3-B46B-CD1A901D5927}"
- ProjectSection(ProjectDependencies) = postProject
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvimgdiff", "nvimgdiff\nvimgdiff.vcproj", "{05A59E8B-EA70-4F22-89E8-E0927BA13064}"
- ProjectSection(ProjectDependencies) = postProject
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvassemble", "nvassemble\nvassemble.vcproj", "{3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}"
- ProjectSection(ProjectDependencies) = postProject
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvzoom", "nvzoom\nvzoom.vcproj", "{51999D3E-EF22-4BDD-965F-4201034D3DCE}"
- ProjectSection(ProjectDependencies) = postProject
- {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
- {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nvidia.TextureTools", "Nvidia.TextureTools\Nvidia.TextureTools.csproj", "{CAB55C39-8FA9-4912-98D9-E52669C8911D}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress", "stress\stress.vcproj", "{317B694E-B5C1-42A6-956F-FC12B69175A6}"
- ProjectSection(ProjectDependencies) = postProject
- {1AEB7681-57D8-48EE-813D-5C41CC38B647} = {1AEB7681-57D8-48EE-813D-5C41CC38B647}
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug (no cuda)|Any CPU = Debug (no cuda)|Any CPU
- Debug (no cuda)|Mixed Platforms = Debug (no cuda)|Mixed Platforms
- Debug (no cuda)|Win32 = Debug (no cuda)|Win32
- Debug (no cuda)|x64 = Debug (no cuda)|x64
- Debug|Any CPU = Debug|Any CPU
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release (no cuda)|Any CPU = Release (no cuda)|Any CPU
- Release (no cuda)|Mixed Platforms = Release (no cuda)|Mixed Platforms
- Release (no cuda)|Win32 = Release (no cuda)|Win32
- Release (no cuda)|x64 = Release (no cuda)|x64
- Release|Any CPU = Release|Any CPU
- Release|Mixed Platforms = Release|Mixed Platforms
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|Any CPU.ActiveCfg = Debug (no cuda)|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug (no cuda)|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug (no cuda)|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|Win32.ActiveCfg = Debug (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|Win32.Build.0 = Debug (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|x64.ActiveCfg = Debug (no cuda)|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|x64.Build.0 = Debug (no cuda)|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|Any CPU.ActiveCfg = Debug|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|Mixed Platforms.Build.0 = Debug|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|Win32.ActiveCfg = Debug|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|Win32.Build.0 = Debug|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|x64.ActiveCfg = Debug|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|x64.Build.0 = Debug|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|Any CPU.ActiveCfg = Release (no cuda)|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release (no cuda)|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|Mixed Platforms.Build.0 = Release (no cuda)|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|Win32.ActiveCfg = Release (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|Win32.Build.0 = Release (no cuda)|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|x64.ActiveCfg = Release (no cuda)|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|x64.Build.0 = Release (no cuda)|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|Any CPU.ActiveCfg = Release|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|Mixed Platforms.ActiveCfg = Release|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|Mixed Platforms.Build.0 = Release|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|Win32.ActiveCfg = Release|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|Win32.Build.0 = Release|Win32
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|x64.ActiveCfg = Release|x64
- {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|x64.Build.0 = Release|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|Any CPU.ActiveCfg = Debug (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|Win32.ActiveCfg = Debug (no cuda)|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|Win32.Build.0 = Debug (no cuda)|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|x64.ActiveCfg = Debug (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|x64.Build.0 = Debug (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|Any CPU.ActiveCfg = Debug|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|Mixed Platforms.Build.0 = Debug|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|Win32.ActiveCfg = Debug|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|Win32.Build.0 = Debug|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|x64.ActiveCfg = Debug|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|x64.Build.0 = Debug|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|Any CPU.ActiveCfg = Release (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|Mixed Platforms.Build.0 = Release (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|Win32.ActiveCfg = Release (no cuda)|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|Win32.Build.0 = Release (no cuda)|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|x64.ActiveCfg = Release (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|x64.Build.0 = Release (no cuda)|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|Any CPU.ActiveCfg = Release|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|Mixed Platforms.ActiveCfg = Release|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|Mixed Platforms.Build.0 = Release|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|Win32.ActiveCfg = Release|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|Win32.Build.0 = Release|Win32
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|x64.ActiveCfg = Release|x64
- {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|x64.Build.0 = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|Any CPU.ActiveCfg = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|Mixed Platforms.Build.0 = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|Win32.ActiveCfg = Debug|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|Win32.Build.0 = Debug|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|x64.ActiveCfg = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|x64.Build.0 = Debug|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|Mixed Platforms.Build.0 = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|x64.Build.0 = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|Any CPU.ActiveCfg = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|Mixed Platforms.ActiveCfg = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|Mixed Platforms.Build.0 = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|Win32.ActiveCfg = Release|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|Win32.Build.0 = Release|Win32
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|x64.ActiveCfg = Release|x64
- {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|x64.Build.0 = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|Any CPU.ActiveCfg = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|Mixed Platforms.Build.0 = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|Win32.ActiveCfg = Debug|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|Win32.Build.0 = Debug|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|x64.ActiveCfg = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|x64.Build.0 = Debug|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|Mixed Platforms.Build.0 = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|x64.Build.0 = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|Any CPU.ActiveCfg = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|Mixed Platforms.ActiveCfg = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|Mixed Platforms.Build.0 = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|Win32.ActiveCfg = Release|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|Win32.Build.0 = Release|Win32
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|x64.ActiveCfg = Release|x64
- {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|x64.Build.0 = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug|Any CPU.ActiveCfg = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug|Mixed Platforms.Build.0 = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug|Win32.ActiveCfg = Debug|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug|Win32.Build.0 = Debug|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug|x64.ActiveCfg = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Debug|x64.Build.0 = Debug|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|Mixed Platforms.Build.0 = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|x64.Build.0 = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release|Any CPU.ActiveCfg = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release|Mixed Platforms.ActiveCfg = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release|Mixed Platforms.Build.0 = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release|Win32.ActiveCfg = Release|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Release|Win32.Build.0 = Release|Win32
- {50C465FE-B308-42BC-894D-89484482AF06}.Release|x64.ActiveCfg = Release|x64
- {50C465FE-B308-42BC-894D-89484482AF06}.Release|x64.Build.0 = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|Any CPU.ActiveCfg = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|Mixed Platforms.Build.0 = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|Win32.ActiveCfg = Debug|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|Win32.Build.0 = Debug|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|x64.ActiveCfg = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|x64.Build.0 = Debug|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|Mixed Platforms.Build.0 = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|x64.Build.0 = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|Any CPU.ActiveCfg = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|Mixed Platforms.ActiveCfg = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|Mixed Platforms.Build.0 = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|Win32.ActiveCfg = Release|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|Win32.Build.0 = Release|Win32
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|x64.ActiveCfg = Release|x64
- {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|x64.Build.0 = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|Any CPU.ActiveCfg = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|Mixed Platforms.Build.0 = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|Win32.ActiveCfg = Debug|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|Win32.Build.0 = Debug|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|x64.ActiveCfg = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|x64.Build.0 = Debug|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|Mixed Platforms.Build.0 = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|x64.Build.0 = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|Any CPU.ActiveCfg = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|Mixed Platforms.ActiveCfg = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|Mixed Platforms.Build.0 = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|Win32.ActiveCfg = Release|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|Win32.Build.0 = Release|Win32
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|x64.ActiveCfg = Release|x64
- {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|x64.Build.0 = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|Any CPU.ActiveCfg = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|Mixed Platforms.Build.0 = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|Win32.ActiveCfg = Debug|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|Win32.Build.0 = Debug|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|x64.ActiveCfg = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|x64.Build.0 = Debug|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|Mixed Platforms.Build.0 = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|x64.Build.0 = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|Any CPU.ActiveCfg = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|Mixed Platforms.ActiveCfg = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|Mixed Platforms.Build.0 = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|Win32.ActiveCfg = Release|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|Win32.Build.0 = Release|Win32
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|x64.ActiveCfg = Release|x64
- {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|x64.Build.0 = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|Any CPU.ActiveCfg = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|Mixed Platforms.Build.0 = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|Win32.ActiveCfg = Debug|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|Win32.Build.0 = Debug|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|x64.ActiveCfg = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|x64.Build.0 = Debug|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|Mixed Platforms.Build.0 = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|x64.Build.0 = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|Any CPU.ActiveCfg = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|Mixed Platforms.ActiveCfg = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|Mixed Platforms.Build.0 = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|Win32.ActiveCfg = Release|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|Win32.Build.0 = Release|Win32
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|x64.ActiveCfg = Release|x64
- {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|x64.Build.0 = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|Any CPU.ActiveCfg = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|Mixed Platforms.Build.0 = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|Win32.ActiveCfg = Debug|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|Win32.Build.0 = Debug|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|x64.ActiveCfg = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|x64.Build.0 = Debug|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|Mixed Platforms.Build.0 = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|x64.Build.0 = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|Any CPU.ActiveCfg = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|Mixed Platforms.ActiveCfg = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|Mixed Platforms.Build.0 = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|Win32.ActiveCfg = Release|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|Win32.Build.0 = Release|Win32
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|x64.ActiveCfg = Release|x64
- {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|x64.Build.0 = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|x64.Build.0 = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|Any CPU.ActiveCfg = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|Mixed Platforms.Build.0 = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|Win32.ActiveCfg = Debug|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|Win32.Build.0 = Debug|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|x64.ActiveCfg = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|x64.Build.0 = Debug|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|Mixed Platforms.Build.0 = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|x64.ActiveCfg = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|x64.Build.0 = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|Any CPU.ActiveCfg = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|Mixed Platforms.ActiveCfg = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|Mixed Platforms.Build.0 = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|Win32.ActiveCfg = Release|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|Win32.Build.0 = Release|Win32
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|x64.ActiveCfg = Release|x64
- {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|x64.Build.0 = Release|x64
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|Any CPU.Build.0 = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|Win32.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|x64.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|Win32.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|x64.ActiveCfg = Debug|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|Any CPU.ActiveCfg = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|Any CPU.Build.0 = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|Mixed Platforms.Build.0 = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|Win32.ActiveCfg = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|x64.ActiveCfg = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|Any CPU.Build.0 = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|Win32.ActiveCfg = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|Win32.Build.0 = Release|Any CPU
- {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|x64.ActiveCfg = Release|Any CPU
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|Mixed Platforms.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|Mixed Platforms.Build.0 = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|x64.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|Any CPU.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|Mixed Platforms.Build.0 = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|Win32.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|Win32.Build.0 = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|x64.ActiveCfg = Debug|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|Mixed Platforms.ActiveCfg = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|Mixed Platforms.Build.0 = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|Win32.Build.0 = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|x64.ActiveCfg = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|Any CPU.ActiveCfg = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|Mixed Platforms.ActiveCfg = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|Mixed Platforms.Build.0 = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|Win32.ActiveCfg = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|Win32.Build.0 = Release|Win32
- {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|x64.ActiveCfg = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt/nvtt.rc b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt/nvtt.rc
deleted file mode 100644
index fed5ab71..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt/nvtt.rc
+++ /dev/null
@@ -1,102 +0,0 @@
-// Microsoft Visual C++ 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
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 2,1,0,0
- PRODUCTVERSION 2,1,0,0
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "NVIDIA Corporation"
- VALUE "FileDescription", "NVIDIA Texture Tools Dynamic Link Library"
- VALUE "FileVersion", "2, 1, 0, 0"
- VALUE "InternalName", "nvtt"
- VALUE "LegalCopyright", "Copyright (C) 2007"
- VALUE "OriginalFilename", "nvtt.dll"
- VALUE "ProductName", "NVIDIA Texture Tools Dynamic Link Library"
- VALUE "ProductVersion", "2, 1, 0, 0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt/nvtt.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt/nvtt.vcproj
deleted file mode 100644
index 9875da17..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt/nvtt.vcproj
+++ /dev/null
@@ -1,957 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="nvtt"
- ProjectGUID="{1AEB7681-57D8-48EE-813D-5C41CC38B647}"
- RootNamespace="nvtt"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;$(CUDA_INC_PATH)"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib cudart.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;&quot;$(CUDA_LIB_PATH)&quot;"
- GenerateDebugInformation="true"
- SubSystem="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- Description="Copying header files..."
- CommandLine="xcopy /y /f /i &quot;$(SolutionDir)\..\..\src\nvtt\nvtt*.h&quot; &quot;$(SolutionDir)\$(ConfigurationName).$(PlatformName)\include\nvtt\&quot;"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;$(CUDA_INC_PATH)"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="cudart.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;&quot;$(CUDA_LIB_PATH)&quot;"
- GenerateDebugInformation="true"
- SubSystem="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- EnableFiberSafeOptimizations="true"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;$(CUDA_INC_PATH)"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib cudart.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;&quot;$(CUDA_LIB_PATH)&quot;"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- Description="Copying header files..."
- CommandLine="xcopy /y /f /i &quot;$(SolutionDir)\..\..\src\nvtt\nvtt*.h&quot; &quot;$(SolutionDir)\$(ConfigurationName).$(PlatformName)\include\nvtt\&quot;"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- EnableIntrinsicFunctions="true"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;$(CUDA_INC_PATH)"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="cudart.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;&quot;$(CUDA_LIB_PATH)&quot;"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug (no cuda)|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;"
- GenerateDebugInformation="true"
- SubSystem="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- Description="Copying header files..."
- CommandLine="xcopy /y /f /i &quot;$(SolutionDir)\..\..\src\nvtt\nvtt*.h&quot; &quot;$(SolutionDir)\$(ConfigurationName).$(PlatformName)\include\nvtt\&quot;"
- />
- </Configuration>
- <Configuration
- Name="Debug (no cuda)|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release (no cuda)|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- EnableIntrinsicFunctions="true"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include;"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- StringPooling="true"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib;"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- Description="Copying header files..."
- CommandLine="xcopy /y /f /i &quot;$(SolutionDir)\..\..\src\nvtt\nvtt*.h&quot; &quot;$(SolutionDir)\$(ConfigurationName).$(PlatformName)\include\nvtt\&quot;"
- />
- </Configuration>
- <Configuration
- Name="Release (no cuda)|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- EnableIntrinsicFunctions="true"
- OmitFramePointers="true"
- WholeProgramOptimization="true"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- WarningLevel="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- LinkTimeCodeGeneration="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\CompressDXT.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\CompressionOptions.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\CompressKernel.cu"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="&quot;$(CUDA_BIN_PATH)\nvcc.exe&quot; -keep -ccbin &quot;$(VCInstallDir)bin&quot; -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Od,/Zi,/RTC1,/MDd -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
- AdditionalDependencies="CudaMath.h"
- Outputs="$(IntDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="&quot;$(CUDA_BIN_PATH)\nvcc.exe&quot; -keep -ccbin &quot;$(VCInstallDir)bin&quot; -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Od,/Zi,/RTC1,/MDd -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
- AdditionalDependencies="CudaMath.h"
- Outputs="$(IntDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="&quot;$(CUDA_BIN_PATH)\nvcc.exe&quot; -keep -ccbin &quot;$(VCInstallDir)bin&quot; -c -DNDEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/O2,/Zi,/MD -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
- AdditionalDependencies="CudaMath.h"
- Outputs="$(IntDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="&quot;$(CUDA_BIN_PATH)\nvcc.exe&quot; -keep -ccbin &quot;$(VCInstallDir)bin&quot; -c -DNDEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/O2,/Zi,/MD -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
- AdditionalDependencies="CudaMath.h"
- Outputs="$(IntDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug (no cuda)|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="$(CUDA_BIN_PATH)\nvcc.exe -ccbin &quot;$(VCInstallDir)bin&quot; -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MDd -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
- AdditionalDependencies="CudaMath.h"
- Outputs="$(IntDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug (no cuda)|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release (no cuda)|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="$(CUDA_BIN_PATH)\nvcc.exe -ccbin &quot;$(VCInstallDir)bin&quot; -c -DNDEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/O2,/Zi,/MD -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
- AdditionalDependencies="CudaMath.h"
- Outputs="$(IntDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release (no cuda)|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\Compressor.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\CompressRGB.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\ConvolveKernel.cu"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug (no cuda)|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug (no cuda)|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release (no cuda)|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release (no cuda)|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\CudaCompressDXT.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\CudaUtils.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Half.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\InputOptions.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\nvtt.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\nvtt_wrapper.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\OptimalCompressDXT.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\OutputOptions.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\QuickCompressDXT.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\cuda\Bitmaps.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\CompressDXT.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\CompressionOptions.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\Compressor.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\CompressRGB.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\CudaCompressDXT.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\CudaMath.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\cuda\CudaUtils.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvmath\Half.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\InputOptions.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\nvtt.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\nvtt_wrapper.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\OptimalCompressDXT.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\OutputOptions.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\QuickCompressDXT.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvtt.rc"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt/resource.h
deleted file mode 100644
index 4df7169c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvtt/resource.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvtt.rc
-
-// 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/Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/nvidia.ico b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/nvidia.ico
deleted file mode 100644
index 6aa721e6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/nvidia.ico
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/nvzoom.rc b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/nvzoom.rc
deleted file mode 100644
index 842ded19..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/nvzoom.rc
+++ /dev/null
Binary files differ
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/nvzoom.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/nvzoom.vcproj
deleted file mode 100644
index 136017be..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/nvzoom.vcproj
+++ /dev/null
@@ -1,377 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="nvzoom"
- ProjectGUID="{51999D3E-EF22-4BDD-965F-4201034D3DCE}"
- RootNamespace="nvzoom"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVDXT_SHARED"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\extern\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- GenerateDebugInformation="false"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\extern\gnuwin32\lib"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\resize.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tools\cmdline.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\nvidia.ico"
- DeploymentContent="true"
- >
- </File>
- <File
- RelativePath=".\nvzoom.rc"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/resource.h b/Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/resource.h
deleted file mode 100644
index e765787d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/nvzoom/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by nvcompress.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/squish/squish.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/squish/squish.vcproj
deleted file mode 100644
index a02a43cf..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/squish/squish.vcproj
+++ /dev/null
@@ -1,359 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="squish"
- ProjectGUID="{CE017322-01FC-4851-9C8B-64E9A8E26C38}"
- RootNamespace="squish"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- EnableFiberSafeOptimizations="true"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__;SQUISH_USE_SSE = 2"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="4"
- CharacterSet="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\squish\clusterfit.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\colourblock.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\colourfit.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\colourset.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\fastclusterfit.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\maths.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\weightedclusterfit.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\squish\clusterfit.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\colourblock.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\colourfit.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\colourset.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\fastclusterfit.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\maths.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\simd.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\simd_sse.h"
- >
- </File>
- <File
- RelativePath="..\..\..\src\nvtt\squish\weightedclusterfit.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/project/vc9/stress/stress.vcproj b/Libraries/nvidia-texture-tools-read-only/project/vc9/stress/stress.vcproj
deleted file mode 100644
index 410f758d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/project/vc9/stress/stress.vcproj
+++ /dev/null
@@ -1,201 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="stress"
- ProjectGUID="{317B694E-B5C1-42A6-956F-FC12B69175A6}"
- RootNamespace="stress"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)\$(PlatformName)"
- IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- AdditionalIncludeDirectories="..;..\..\..\src"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- StringPooling="true"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\..\src\nvtt\tests\stress.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Libraries/nvidia-texture-tools-read-only/src/CMakeLists.txt b/Libraries/nvidia-texture-tools-read-only/src/CMakeLists.txt
deleted file mode 100644
index 871902fa..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/CMakeLists.txt
+++ /dev/null
@@ -1,136 +0,0 @@
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
-
-SUBDIRS(nvcore)
-SUBDIRS(nvmath)
-SUBDIRS(nvimage)
-SUBDIRS(nvtt)
-
-# OpenGL
-INCLUDE(FindOpenGL)
-IF(OPENGL_FOUND)
- MESSAGE(STATUS "Looking for OpenGL - found")
-ELSE(OPENGL_FOUND)
- MESSAGE(STATUS "Looking for OpenGL - not found")
-ENDIF(OPENGL_FOUND)
-
-# GLUT
-INCLUDE(FindGLUT)
-IF(GLUT_FOUND)
- MESSAGE(STATUS "Looking for GLUT - found")
-ELSE(GLUT_FOUND)
- MESSAGE(STATUS "Looking for GLUT - not found")
-ENDIF(GLUT_FOUND)
-
-# DirectX
-INCLUDE(${NV_CMAKE_DIR}/FindDirectX.cmake)
-IF(DX10_FOUND)
- MESSAGE(STATUS "Looking for DirectX - found")
-ELSE(DX10_FOUND)
- MESSAGE(STATUS "Looking for DirectX - not found")
-ENDIF(DX10_FOUND)
-
-# GLEW
-INCLUDE(${NV_CMAKE_DIR}/FindGLEW.cmake)
-IF(GLEW_FOUND)
- MESSAGE(STATUS "Looking for GLEW - found")
-ELSE(GLEW_FOUND)
- MESSAGE(STATUS "Looking for GLEW - not found")
-ENDIF(GLEW_FOUND)
-
-# Cg
-INCLUDE(${NV_CMAKE_DIR}/FindCg.cmake)
-IF(CG_FOUND)
- MESSAGE(STATUS "Looking for Cg - found")
-ELSE(CG_FOUND)
- MESSAGE(STATUS "Looking for Cg - not found")
-ENDIF(CG_FOUND)
-
-# CUDA
-INCLUDE(${NV_CMAKE_DIR}/FindCUDA.cmake)
-IF(CUDA_FOUND)
- SET(HAVE_CUDA ${CUDA_FOUND} CACHE BOOL "Set to TRUE if CUDA is found, FALSE otherwise")
- MESSAGE(STATUS "Looking for CUDA - found")
- IF(CUTIL_FOUND)
- MESSAGE(STATUS "Looking for CUTIL - found")
- ELSE(CUTIL_FOUND)
- MESSAGE(STATUS "Looking for CUTIL - not found")
- ENDIF(CUTIL_FOUND)
-ELSE(CUDA_FOUND)
- MESSAGE(STATUS "Looking for CUDA - not found")
-ENDIF(CUDA_FOUND)
-
-# Maya
-INCLUDE(${NV_CMAKE_DIR}/FindMaya.cmake)
-IF(MAYA_FOUND)
- SET(HAVE_MAYA ${MAYA_FOUND} CACHE BOOL "Set to TRUE if Maya is found, FALSE otherwise")
- MESSAGE(STATUS "Looking for Maya - found")
-ELSE(MAYA_FOUND)
- MESSAGE(STATUS "Looking for Maya - not found")
-ENDIF(MAYA_FOUND)
-
-# JPEG
-INCLUDE(FindJPEG)
-IF(JPEG_FOUND)
- SET(HAVE_JPEG ${JPEG_FOUND} CACHE BOOL "Set to TRUE if JPEG is found, FALSE otherwise")
- MESSAGE(STATUS "Looking for JPEG - found")
-ELSE(JPEG_FOUND)
- MESSAGE(STATUS "Looking for JPEG - not found")
-ENDIF(JPEG_FOUND)
-
-# PNG
-INCLUDE(FindPNG)
-IF(PNG_FOUND)
- SET(HAVE_PNG ${PNG_FOUND} CACHE BOOL "Set to TRUE if PNG is found, FALSE otherwise")
- MESSAGE(STATUS "Looking for PNG - found")
-ELSE(PNG_FOUND)
- MESSAGE(STATUS "Looking for PNG - not found")
-ENDIF(PNG_FOUND)
-
-# TIFF
-#SET(TIFF_NAMES libtiff)
-#INCLUDE(FindTIFF)
-#IF(TIFF_FOUND)
-# SET(HAVE_TIFF ${TIFF_FOUND} CACHE BOOL "Set to TRUE if TIFF is found, FALSE otherwise")
-# MESSAGE(STATUS "Looking for TIFF - found")
-#ELSE(TIFF_FOUND)
-# MESSAGE(STATUS "Looking for TIFF - not found")
-#ENDIF(TIFF_FOUND)
-
-# OpenEXR
-INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
-IF(OPENEXR_FOUND)
- SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
- MESSAGE(STATUS "Looking for OpenEXR - found")
-ELSE(OPENEXR_FOUND)
- MESSAGE(STATUS "Looking for OpenEXR - not found")
-ENDIF(OPENEXR_FOUND)
-
-# FreeImage
-INCLUDE(${NV_CMAKE_DIR}/FindFreeImage.cmake)
-IF(FREEIMAGE_FOUND)
- SET(HAVE_FREEIMAGE ${FREEIMAGE_FOUND} CACHE BOOL "Set to TRUE if FreeImage is found, FALSE otherwise")
- MESSAGE(STATUS "Looking for FreeImage - found")
-ELSE(FREEIMAGE_FOUND)
- MESSAGE(STATUS "Looking for FreeImage - not found")
-ENDIF(FREEIMAGE_FOUND)
-
-# Qt
-FIND_PACKAGE(Qt4)
-
-# Threads
-FIND_PACKAGE(Threads)
-
-# configuration file
-INCLUDE(CheckIncludeFiles)
-
-CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
-CHECK_INCLUDE_FILES(stdarg.h HAVE_STDARG_H)
-CHECK_INCLUDE_FILES(signal.h HAVE_SIGNAL_H)
-CHECK_INCLUDE_FILES(execinfo.h HAVE_EXECINFO_H)
-CHECK_INCLUDE_FILES(malloc.h HAVE_MALLOC_H)
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/nvconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/nvconfig.h)
-
-#INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/nvconfig.h DESTINATION include)
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvconfig.h.in b/Libraries/nvidia-texture-tools-read-only/src/nvconfig.h.in
deleted file mode 100644
index a4911ee0..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvconfig.h.in
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef NV_CONFIG
-#define NV_CONFIG
-
-#cmakedefine HAVE_UNISTD_H
-#cmakedefine HAVE_STDARG_H
-#cmakedefine HAVE_SIGNAL_H
-#cmakedefine HAVE_EXECINFO_H
-#cmakedefine HAVE_MALLOC_H
-
-#cmakedefine HAVE_PNG
-#cmakedefine HAVE_JPEG
-#cmakedefine HAVE_TIFF
-#cmakedefine HAVE_OPENEXR
-#cmakedefine HAVE_FREEIMAGE
-
-#cmakedefine HAVE_MAYA
-
-#endif // NV_CONFIG
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Algorithms.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Algorithms.h
deleted file mode 100644
index 9a257dde..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Algorithms.h
+++ /dev/null
@@ -1,154 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_ALGORITHMS_H
-#define NV_CORE_ALGORITHMS_H
-
-#include <nvcore/nvcore.h>
-
-namespace nv
-{
-
- /// Return the maximum of two values.
- template <typename T>
- inline const T & max(const T & a, const T & b)
- {
- //return std::max(a, b);
- if( a < b ) {
- return b;
- }
- return a;
- }
-
- /// Return the minimum of two values.
- template <typename T>
- inline const T & min(const T & a, const T & b)
- {
- //return std::min(a, b);
- if( b < a ) {
- return b;
- }
- return a;
- }
-
- /// Clamp between two values.
- template <typename T>
- inline const T & clamp(const T & x, const T & a, const T & b)
- {
- return min(max(x, a), b);
- }
-
- /// Delete all the elements of a container.
- template <typename T>
- void deleteAll(T & container)
- {
- for (typename T::PseudoIndex i = container.start(); !container.isDone(i); container.advance(i))
- {
- delete container[i];
- }
- }
-
- // @@ Should swap be implemented here?
-
-
-
- template <typename T, template <typename T2> class C>
- void sort(C<T> & container)
- {
- introsortLoop(container, 0, container.count());
- insertionSort(container, 0, container.count());
- }
-
- template <typename T, template <typename T2> class C>
- void sort(C<T> & container, uint begin, uint end)
- {
- if (begin < end)
- {
- introsortLoop(container, begin, end);
- insertionSort(container, begin, end);
- }
- }
-
- template <typename T, template <typename T2> class C>
- void insertionSort(C<T> & container)
- {
- insertionSort(container, 0, container.count());
- }
-
- template <typename T, template <typename T2> class C>
- void insertionSort(C<T> & container, uint begin, uint end)
- {
- for (uint i = begin + 1; i != end; ++i)
- {
- T value = container[i];
-
- uint j = i;
- while (j != begin && container[j-1] > value)
- {
- container[j] = container[j-1];
- --j;
- }
- if (i != j)
- {
- container[j] = value;
- }
- }
- }
-
- template <typename T, template <typename T2> class C>
- void introsortLoop(C<T> & container, uint begin, uint end)
- {
- while (end-begin > 16)
- {
- uint p = partition(container, begin, end, medianof3(container, begin, begin+((end-begin)/2)+1, end-1));
- introsortLoop(container, p, end);
- end = p;
- }
- }
-
- template <typename T, template <typename T2> class C>
- uint partition(C<T> & a, uint begin, uint end, const T & x)
- {
- int i = begin, j = end;
- while (true)
- {
- while (a[i] < x) ++i;
- --j;
- while (x < a[j]) --j;
- if (i >= j)
- return i;
- swap(a[i], a[j]);
- i++;
- }
- }
-
- template <typename T, template <typename T2> class C>
- const T & medianof3(C<T> & a, uint lo, uint mid, uint hi)
- {
- if (a[mid] < a[lo])
- {
- if (a[hi] < a[mid])
- {
- return a[mid];
- }
- else
- {
- return (a[hi] < a[lo]) ? a[hi] : a[lo];
- }
- }
- else
- {
- if (a[hi] < a[mid])
- {
- return (a[hi] < a[lo]) ? a[lo] : a[hi];
- }
- else
- {
- return a[mid];
- }
- }
- }
-
-
-} // nv namespace
-
-#endif // NV_CORE_ALGORITHMS_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/BitArray.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/BitArray.h
deleted file mode 100644
index 695dd7a5..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/BitArray.h
+++ /dev/null
@@ -1,168 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_BITARRAY_H
-#define NV_CORE_BITARRAY_H
-
-#include <nvcore/nvcore.h>
-#include <nvcore/Containers.h>
-
-namespace nv
-{
-
-/// Count the bits of @a x.
-inline uint bitsSet(uint8 x) {
- uint count = 0;
- for(; x != 0; x >>= 1) {
- count += (x & 1);
- }
- return count;
-}
-
-
-/// Count the bits of @a x.
-inline uint bitsSet(uint32 x, int bits) {
- uint count = 0;
- for(; x != 0 && bits != 0; x >>= 1, bits--) {
- count += (x & 1);
- }
- return count;
-}
-
-
-/// Simple bit array.
-class BitArray
-{
-public:
-
- /// Default ctor.
- BitArray() {}
-
- /// Ctor with initial m_size.
- BitArray(uint sz)
- {
- resize(sz);
- }
-
- /// Get array m_size.
- uint size() const { return m_size; }
-
- /// Clear array m_size.
- void clear() { resize(0); }
-
- /// Set array m_size.
- void resize(uint sz)
- {
- m_size = sz;
- m_bitArray.resize( (m_size + 7) >> 3 );
- }
-
- /// Get bit.
- bool bitAt(uint b) const
- {
- nvDebugCheck( b < m_size );
- return (m_bitArray[b >> 3] & (1 << (b & 7))) != 0;
- }
-
- /// Set a bit.
- void setBitAt(uint b)
- {
- nvDebugCheck( b < m_size );
- m_bitArray[b >> 3] |= (1 << (b & 7));
- }
-
- /// Clear a bit.
- void clearBitAt( uint b )
- {
- nvDebugCheck( b < m_size );
- m_bitArray[b >> 3] &= ~(1 << (b & 7));
- }
-
- /// Clear all the bits.
- void clearAll()
- {
- memset(m_bitArray.mutableBuffer(), 0, m_bitArray.size());
- }
-
- /// Set all the bits.
- void setAll()
- {
- memset(m_bitArray.mutableBuffer(), 0xFF, m_bitArray.size());
- }
-
- /// Toggle all the bits.
- void toggleAll()
- {
- const uint byte_num = m_bitArray.size();
- for(uint b = 0; b < byte_num; b++) {
- m_bitArray[b] ^= 0xFF;
- }
- }
-
- /// Get a byte of the bit array.
- const uint8 & byteAt(uint index) const
- {
- return m_bitArray[index];
- }
-
- /// Set the given byte of the byte array.
- void setByteAt(uint index, uint8 b)
- {
- m_bitArray[index] = b;
- }
-
- /// Count the number of bits set.
- uint countSetBits() const
- {
- const uint num = m_bitArray.size();
- if( num == 0 ) {
- return 0;
- }
-
- uint count = 0;
- for(uint i = 0; i < num - 1; i++) {
- count += bitsSet(m_bitArray[i]);
- }
- count += bitsSet(m_bitArray[num-1], m_size & 0x7);
-
- //piDebugCheck(count + countClearBits() == m_size);
- return count;
- }
-
- /// Count the number of bits clear.
- uint countClearBits() const {
-
- const uint num = m_bitArray.size();
- if( num == 0 ) {
- return 0;
- }
-
- uint count = 0;
- for(uint i = 0; i < num - 1; i++) {
- count += bitsSet(~m_bitArray[i]);
- }
- count += bitsSet(~m_bitArray[num-1], m_size & 0x7);
-
- //piDebugCheck(count + countSetBits() == m_size);
- return count;
- }
-
- friend void swap(BitArray & a, BitArray & b)
- {
- swap(a.m_size, b.m_size);
- swap(a.m_bitArray, b.m_bitArray);
- }
-
-
-private:
-
- /// Number of bits stored.
- uint m_size;
-
- /// Array of bits.
- Array<uint8> m_bitArray;
-
-};
-
-} // nv namespace
-
-#endif // _PI_CORE_BITARRAY_H_
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/CMakeLists.txt b/Libraries/nvidia-texture-tools-read-only/src/nvcore/CMakeLists.txt
deleted file mode 100644
index fd9777dc..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/CMakeLists.txt
+++ /dev/null
@@ -1,88 +0,0 @@
-PROJECT(nvcore)
-ADD_SUBDIRECTORY(poshlib)
-
-SET(CORE_SRCS
- nvcore.h
- DefsGnucDarwin.h
- DefsGnucLinux.h
- DefsGnucWin32.h
- DefsVcWin32.h
- Ptr.h
- RefCounted.h
- RefCounted.cpp
- BitArray.h
- Memory.h
- Memory.cpp
- Debug.h
- Debug.cpp
- Containers.h
- StrLib.h
- StrLib.cpp
- Stream.h
- StdStream.h
- TextReader.h
- TextReader.cpp
- TextWriter.h
- TextWriter.cpp
- Tokenizer.h
- Tokenizer.cpp
- Radix.h
- Radix.cpp
- CpuInfo.h
- CpuInfo.cpp
- Algorithms.h
- Timer.h
- Library.h
- Library.cpp
- FileSystem.h
- FileSystem.cpp)
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-
-# For Windows64 in MSVC we need to add the assembly version of vsscanf
-IF(MSVC AND NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
- SET(VSSCANF_ASM_NAME "vsscanf_proxy_win64")
- IF(MSVC_IDE)
- # $(IntDir) is a macro expanded to the intermediate directory of the selected solution configuration
- SET(VSSCANF_ASM_INTDIR "$(IntDir)")
- ELSE(MSVC_IDE)
- # For some reason the NMake generator doesn't work properly with the generated .obj source:
- # it requires the absolute path. So this is a hack which worked as of cmake 2.6.0 patch 0
- GET_FILENAME_COMPONENT(VSSCANF_ASM_INTDIR
- "${nvcore_BINARY_DIR}/CMakeFiles/nvcore.dir" ABSOLUTE)
- ENDIF(MSVC_IDE)
-
- SET(VSSCANF_ASM_SRC "${CMAKE_CURRENT_SOURCE_DIR}/${VSSCANF_ASM_NAME}.masm")
- SET(VSSCANF_ASM_OBJ "${VSSCANF_ASM_INTDIR}/${VSSCANF_ASM_NAME}.obj")
-
- # Adds the assembly output to the sources and adds the custom command to generate it
- SET(CORE_SRCS
- ${CORE_SRCS}
- ${VSSCANF_ASM_OBJ}
- )
- ADD_CUSTOM_COMMAND(OUTPUT ${VSSCANF_ASM_OBJ}
- MAIN_DEPENDENCY ${VSSCANF_ASM_SRC}
- COMMAND ml64
- ARGS /nologo /Fo ${VSSCANF_ASM_OBJ} /c /Cx ${VSSCANF_ASM_SRC}
- )
-ENDIF(MSVC AND NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
-
-# targets
-ADD_DEFINITIONS(-DNVCORE_EXPORTS)
-
-IF(UNIX)
- SET(LIBS ${LIBS} ${CMAKE_DL_LIBS})
-ENDIF(UNIX)
-
-IF(NVCORE_SHARED)
- ADD_LIBRARY(nvcore SHARED ${CORE_SRCS})
-ELSE(NVCORE_SHARED)
- ADD_LIBRARY(nvcore ${CORE_SRCS})
-ENDIF(NVCORE_SHARED)
-
-TARGET_LINK_LIBRARIES(nvcore ${LIBS})
-
-INSTALL(TARGETS nvcore
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib/static)
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Constraints.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Constraints.h
deleted file mode 100644
index 08b9c8b4..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Constraints.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_ALGORITHMS_H
-#define NV_CORE_ALGORITHMS_H
-
-#include <nvcore/nvcore.h>
-
-namespace nv
-{
- // Cool constraints from "Imperfect C++"
-
- // must_be_pod
- template <typename T>
- struct must_be_pod
- {
- static void constraints()
- {
- union { T T_is_not_POD_type; };
- }
- };
-
- // must_be_pod_or_void
- template <typename T>
- struct must_be_pod_or_void
- {
- static void constraints()
- {
- union { T T_is_not_POD_type; };
- }
- };
- template <> struct must_be_pod_or_void<void> {};
-
- // size_of
- template <typename T>
- struct size_of
- {
- enum { value = sizeof(T) };
- };
- template <>
- struct size_of<void>
- {
- enum { value = 0 };
- };
-
- // must_be_same_size
- template <typename T1, typename T2>
- struct must_be_same_size
- {
- static void constraints()
- {
- const int T1_not_same_size_as_T2 = size_of<T1>::value == size_of<T2>::value;
- int i[T1_not_same_size_as_T2];
- }
- };
-
-
-} // nv namespace
-
-#endif // NV_CORE_ALGORITHMS_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Containers.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Containers.h
deleted file mode 100644
index 2bbbe610..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Containers.h
+++ /dev/null
@@ -1,1011 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_CONTAINER_H
-#define NV_CORE_CONTAINER_H
-
-/*
-These containers are based on Thatcher Ulrich <tu@tulrich.com> containers,
-donated to the Public Domain.
-
-I've also borrowed some ideas from the Qt toolkit, specially the cool
-foreach iterator.
-
-TODO
-Do not use memmove in insert & remove, use copy ctors instead.
-*/
-
-
-// nvcore
-#include <nvcore/nvcore.h>
-#include <nvcore/Memory.h>
-#include <nvcore/Debug.h>
-//#include <nvcore/Stream.h>
-
-#include <string.h> // memmove
-#include <new> // for placement new
-
-
-#if NV_CC_GNUC // If typeof is available:
-
-#define NV_FOREACH(i, container) \
- typedef typeof(container) NV_STRING_JOIN2(cont,__LINE__); \
- for(NV_STRING_JOIN2(cont,__LINE__)::PseudoIndex i((container).start()); !(container).isDone(i); (container).advance(i))
-/*
-#define NV_FOREACH(i, container) \
- for(typename typeof(container)::PseudoIndex i((container).start()); !(container).isDone(i); (container).advance(i))
-*/
-
-#else // If typeof not available:
-
-struct PseudoIndexWrapper {
- template <typename T>
- PseudoIndexWrapper(const T & container) {
- nvStaticCheck(sizeof(typename T::PseudoIndex) <= sizeof(memory));
- new (memory) typename T::PseudoIndex(container.start());
- }
- // PseudoIndex cannot have a dtor!
-
- template <typename T> typename T::PseudoIndex & operator()(const T * container) {
- return *reinterpret_cast<typename T::PseudoIndex *>(memory);
- }
- template <typename T> const typename T::PseudoIndex & operator()(const T * container) const {
- return *reinterpret_cast<const typename T::PseudoIndex *>(memory);
- }
-
- uint8 memory[4]; // Increase the size if we have bigger enumerators.
-};
-
-#define NV_FOREACH(i, container) \
- for(PseudoIndexWrapper i(container); !(container).isDone(i(&(container))); (container).advance(i(&(container))))
-
-#endif
-
-// Declare foreach keyword.
-#if !defined NV_NO_USE_KEYWORDS
-# define foreach NV_FOREACH
-#endif
-
-
-
-namespace nv
-{
- // Templates
-
- /// Swap two values.
- template <typename T>
- inline void swap(T & a, T & b)
- {
- T temp = a;
- a = b;
- b = temp;
- }
-
- template <typename Key> struct hash
- {
- inline uint sdbm_hash(const void * data_in, uint size, uint h = 5381)
- {
- const uint8 * data = (const uint8 *) data_in;
- uint i = 0;
- while (i < size) {
- h = (h << 16) + (h << 6) - h + (uint) data[i++];
- }
- return h;
- }
-
- uint operator()(const Key & k) {
- return sdbm_hash(&k, sizeof(Key));
- }
- };
- template <> struct hash<int>
- {
- uint operator()(int x) const { return x; }
- };
- template <> struct hash<uint>
- {
- uint operator()(uint x) const { return x; }
- };
-
-
- /** Return the next power of two.
- * @see http://graphics.stanford.edu/~seander/bithacks.html
- * @warning Behaviour for 0 is undefined.
- * @note isPowerOfTwo(x) == true -> nextPowerOfTwo(x) == x
- * @note nextPowerOfTwo(x) = 2 << log2(x-1)
- */
- inline uint nextPowerOfTwo( uint x )
- {
- nvDebugCheck( x != 0 );
- #if 1 // On modern CPUs this is supposed to be as fast as using the bsr instruction.
- x--;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- return x+1;
- #else
- uint p = 1;
- while( x > p ) {
- p += p;
- }
- return p;
- #endif
- }
-
- /// Return true if @a n is a power of two.
- inline bool isPowerOfTwo( uint n )
- {
- return (n & (n-1)) == 0;
- }
-
-
- /**
- * Replacement for std::vector that is easier to debug and provides
- * some nice foreach enumerators.
- */
- template<typename T>
- class NVCORE_CLASS Array {
- public:
-
- /// Ctor.
- Array() : m_buffer(NULL), m_size(0), m_buffer_size(0)
- {
- }
-
- /// Copy ctor.
- Array( const Array & a ) : m_buffer(NULL), m_size(0), m_buffer_size(0)
- {
- copy(a.m_buffer, a.m_size);
- }
-
- /// Ctor that initializes the vector with the given elements.
- Array( const T * ptr, int num ) : m_buffer(NULL), m_size(0), m_buffer_size(0)
- {
- copy(ptr, num);
- }
-
- /// Allocate array.
- explicit Array(uint capacity) : m_buffer(NULL), m_size(0), m_buffer_size(0)
- {
- allocate(capacity);
- }
-
-
- /// Dtor.
- ~Array()
- {
- clear();
- allocate(0);
- }
-
-
- /// Const and save vector access.
- const T & operator[]( uint index ) const
- {
- nvDebugCheck(index < m_size);
- return m_buffer[index];
- }
-
- /// Safe vector access.
- T & operator[] ( uint index )
- {
- nvDebugCheck(index < m_size);
- return m_buffer[index];
- }
-
-
- /// Get vector size.
- uint size() const { return m_size; }
-
- /// Get vector size.
- uint count() const { return m_size; }
-
- /// Get const vector pointer.
- const T * buffer() const { return m_buffer; }
-
- /// Get vector pointer.
- T * mutableBuffer() { return m_buffer; }
-
- /// Is vector empty.
- bool isEmpty() const { return m_size == 0; }
-
- /// Is a null vector.
- bool isNull() const { return m_buffer == NULL; }
-
-
- /// Push an element at the end of the vector.
- void push_back( const T & val )
- {
- uint new_size = m_size + 1;
-
- if (new_size > m_buffer_size)
- {
- const T copy(val); // create a copy in case value is inside of this array.
- resize(new_size);
- m_buffer[new_size-1] = copy;
- }
- else
- {
- m_size = new_size;
- new(m_buffer+new_size-1) T(val);
- }
- }
- void pushBack( const T & val )
- {
- push_back(val);
- }
- void append( const T & val )
- {
- push_back(val);
- }
-
- /// Qt like push operator.
- Array<T> & operator<< ( T & t )
- {
- push_back(t);
- return *this;
- }
-
- /// Pop and return element at the end of the vector.
- void pop_back()
- {
- nvDebugCheck( m_size > 0 );
- resize( m_size - 1 );
- }
- void popBack()
- {
- pop_back();
- }
-
- /// Get back element.
- const T & back() const
- {
- nvDebugCheck( m_size > 0 );
- return m_buffer[m_size-1];
- }
-
- /// Get back element.
- T & back()
- {
- nvDebugCheck( m_size > 0 );
- return m_buffer[m_size-1];
- }
-
- /// Get front element.
- const T & front() const
- {
- nvDebugCheck( m_size > 0 );
- return m_buffer[0];
- }
-
- /// Get front element.
- T & front()
- {
- nvDebugCheck( m_size > 0 );
- return m_buffer[0];
- }
-
- /// Check if the given element is contained in the array.
- bool contains(const T & e) const
- {
- for (uint i = 0; i < m_size; i++) {
- if (m_buffer[i] == e) return true;
- }
- return false;
- }
-
- /// Remove the element at the given index. This is an expensive operation!
- void removeAt( uint index )
- {
- nvCheck(index >= 0 && index < m_size);
-
- if( m_size == 1 ) {
- clear();
- }
- else {
- m_buffer[index].~T();
-
- memmove( m_buffer+index, m_buffer+index+1, sizeof(T) * (m_size - 1 - index) );
- m_size--;
- }
- }
-
- /// Remove the first instance of the given element.
- void remove(const T & element)
- {
- for(PseudoIndex i = start(); !isDone(i); advance(i)) {
- removeAt(i);
- break;
- }
- }
-
- /// Insert the given element at the given index shifting all the elements up.
- void insertAt( uint index, const T & val = T() )
- {
- nvCheck( index >= 0 && index <= m_size );
-
- resize( m_size + 1 );
-
- if( index < m_size - 1 ) {
- memmove( m_buffer+index+1, m_buffer+index, sizeof(T) * (m_size - 1 - index) );
- }
-
- // Copy-construct into the newly opened slot.
- new(m_buffer+index) T(val);
- }
-
- /// Append the given data to our vector.
- void append(const Array<T> & other)
- {
- append(other.m_buffer, other.m_size);
- }
-
- /// Append the given data to our vector.
- void append(const T other[], uint count)
- {
- if( count > 0 ) {
- const uint old_size = m_size;
- resize(m_size + count);
- // Must use operator=() to copy elements, in case of side effects (e.g. ref-counting).
- for( uint i = 0; i < count; i++ ) {
- m_buffer[old_size + i] = other[i];
- }
- }
- }
-
-
- /// Remove the given element by replacing it with the last one.
- void replaceWithLast(uint index)
- {
- nvDebugCheck( index < m_size );
- m_buffer[index] = back();
- (m_buffer+m_size-1)->~T();
- m_size--;
- }
-
-
- /// Resize the vector preserving existing elements.
- void resize(uint new_size)
- {
- uint i;
- uint old_size = m_size;
- m_size = new_size;
-
- // Destruct old elements (if we're shrinking).
- for( i = new_size; i < old_size; i++ ) {
- (m_buffer+i)->~T(); // Explicit call to the destructor
- }
-
- if( m_size == 0 ) {
- //Allocate(0); // Don't shrink automatically.
- }
- else if( m_size <= m_buffer_size/* && m_size > m_buffer_size >> 1*/) {
- // don't compact yet.
- nvDebugCheck(m_buffer != NULL);
- }
- else {
- uint new_buffer_size;
- if( m_buffer_size == 0 ) {
- // first allocation
- new_buffer_size = m_size;
- }
- else {
- // growing
- new_buffer_size = m_size + (m_size >> 2);
- }
- allocate( new_buffer_size );
- }
-
- // Call default constructors
- for( i = old_size; i < new_size; i++ ) {
- new(m_buffer+i) T; // placement new
- }
- }
-
-
- /// Resize the vector preserving existing elements and initializing the
- /// new ones with the given value.
- void resize( uint new_size, const T &elem )
- {
- uint i;
- uint old_size = m_size;
- m_size = new_size;
-
- // Destruct old elements (if we're shrinking).
- for( i = new_size; i < old_size; i++ ) {
- (m_buffer+i)->~T(); // Explicit call to the destructor
- }
-
- if( m_size == 0 ) {
- //Allocate(0); // Don't shrink automatically.
- }
- else if( m_size <= m_buffer_size && m_size > m_buffer_size >> 1 ) {
- // don't compact yet.
- }
- else {
- uint new_buffer_size;
- if( m_buffer_size == 0 ) {
- // first allocation
- new_buffer_size = m_size;
- }
- else {
- // growing
- new_buffer_size = m_size + (m_size >> 2);
- }
- allocate( new_buffer_size );
- }
-
- // Call copy constructors
- for( i = old_size; i < new_size; i++ ) {
- new(m_buffer+i) T( elem ); // placement new
- }
- }
-
- /// Tighten the memory used by the container.
- void tighten()
- {
- // TODO Reallocate only if worth.
- }
-
- /// Clear the buffer.
- void clear()
- {
- resize(0);
- }
-
- /// Shrink the allocated vector.
- void shrink()
- {
- if( m_size < m_buffer_size ) {
- allocate(m_size);
- }
- }
-
- /// Preallocate space.
- void reserve(uint desired_size)
- {
- if( desired_size > m_buffer_size ) {
- allocate( desired_size );
- }
- }
-
- /// Copy memory to our vector. Resizes the vector if needed.
- void copy( const T * ptr, uint num )
- {
- resize( num );
- for(uint i = 0; i < m_size; i++) {
- m_buffer[i] = ptr[i];
- }
- }
-
- /// Assignment operator.
- void operator=( const Array<T> & a )
- {
- copy( a.m_buffer, a.m_size );
- }
-
- /*
- /// Array serialization.
- friend Stream & operator<< ( Stream & s, Array<T> & p )
- {
- if( s.isLoading() ) {
- uint size;
- s << size;
- p.resize( size );
- }
- else {
- s << p.m_size;
- }
-
- for( uint i = 0; i < p.m_size; i++ ) {
- s << p.m_buffer[i];
- }
-
- return s;
- }
- */
-
- // Array enumerator.
- typedef uint PseudoIndex;
-
- PseudoIndex start() const { return 0; }
- bool isDone(const PseudoIndex & i) const { nvDebugCheck(i <= this->m_size); return i == this->m_size; };
- void advance(PseudoIndex & i) const { nvDebugCheck(i <= this->m_size); i++; }
-
- #if NV_CC_MSVC
- T & operator[]( const PseudoIndexWrapper & i ) {
- return m_buffer[i(this)];
- }
- const T & operator[]( const PseudoIndexWrapper & i ) const {
- return m_buffer[i(this)];
- }
- #endif
-
-
- /// Swap the members of this vector and the given vector.
- friend void swap(Array<T> & a, Array<T> & b)
- {
- swap(a.m_buffer, b.m_buffer);
- swap(a.m_size, b.m_size);
- swap(a.m_buffer_size, b.m_buffer_size);
- }
-
-
- private:
-
- /// Change buffer size.
- void allocate( uint rsize )
- {
- m_buffer_size = rsize;
-
- // free the buffer.
- if( m_buffer_size == 0 ) {
- if( m_buffer ) {
- free( m_buffer );
- m_buffer = NULL;
- }
- }
-
- // realloc the buffer
- else {
- if( m_buffer ) m_buffer = (T *) realloc<T>( m_buffer, m_buffer_size );
- else m_buffer = (T *) malloc<T>( m_buffer_size );
- }
- }
-
-
- private:
- T * m_buffer;
- uint m_size;
- uint m_buffer_size;
- };
-
-
-
- /** Thatcher Ulrich's hash table.
- *
- * Hash table, linear probing, internal chaining. One
- * interesting/nice thing about this implementation is that the table
- * itself is a flat chunk of memory containing no pointers, only
- * relative indices. If the key and value types of the hash contain
- * no pointers, then the hash can be serialized using raw IO. Could
- * come in handy.
- *
- * Never shrinks, unless you explicitly clear() it. Expands on
- * demand, though. For best results, if you know roughly how big your
- * table will be, default it to that size when you create it.
- */
- template<typename T, typename U, typename hash_functor = hash<T> >
- class NVCORE_CLASS HashMap
- {
- NV_FORBID_COPY(HashMap)
- public:
-
- /// Default ctor.
- HashMap() : entry_count(0), size_mask(-1), table(NULL) { }
-
- /// Ctor with size hint.
- explicit HashMap(int size_hint) : entry_count(0), size_mask(-1), table(NULL) { setCapacity(size_hint); }
-
- /// Dtor.
- ~HashMap() { clear(); }
-
-
- /// Set a new or existing value under the key, to the value.
- void set(const T& key, const U& value)
- {
- int index = findIndex(key);
- if (index >= 0)
- {
- E(index).value = value;
- return;
- }
-
- // Entry under key doesn't exist.
- add(key, value);
- }
-
-
- /// Add a new value to the hash table, under the specified key.
- void add(const T& key, const U& value)
- {
- nvCheck(findIndex(key) == -1);
-
- checkExpand();
- nvCheck(table != NULL);
- entry_count++;
-
- const uint hash_value = hash_functor()(key);
- const int index = hash_value & size_mask;
-
- Entry * natural_entry = &(E(index));
-
- if (natural_entry->isEmpty())
- {
- // Put the new entry in.
- new (natural_entry) Entry(key, value, -1, hash_value);
- }
- else
- {
- // Find a blank spot.
- int blank_index = index;
- for (;;)
- {
- blank_index = (blank_index + 1) & size_mask;
- if (E(blank_index).isEmpty()) break; // found it
- }
- Entry * blank_entry = &E(blank_index);
-
- if (int(natural_entry->hash_value & size_mask) == index)
- {
- // Collision. Link into this chain.
-
- // Move existing list head.
- new (blank_entry) Entry(*natural_entry); // placement new, copy ctor
-
- // Put the new info in the natural entry.
- natural_entry->key = key;
- natural_entry->value = value;
- natural_entry->next_in_chain = blank_index;
- natural_entry->hash_value = hash_value;
- }
- else
- {
- // Existing entry does not naturally
- // belong in this slot. Existing
- // entry must be moved.
-
- // Find natural location of collided element (i.e. root of chain)
- int collided_index = natural_entry->hash_value & size_mask;
- for (;;)
- {
- Entry * e = &E(collided_index);
- if (e->next_in_chain == index)
- {
- // Here's where we need to splice.
- new (blank_entry) Entry(*natural_entry);
- e->next_in_chain = blank_index;
- break;
- }
- collided_index = e->next_in_chain;
- nvCheck(collided_index >= 0 && collided_index <= size_mask);
- }
-
- // Put the new data in the natural entry.
- natural_entry->key = key;
- natural_entry->value = value;
- natural_entry->hash_value = hash_value;
- natural_entry->next_in_chain = -1;
- }
- }
- }
-
-
- /// Remove the first value under the specified key.
- bool remove(const T& key)
- {
- if (table == NULL)
- {
- return false;
- }
-
- int index = findIndex(key);
- if (index < 0)
- {
- return false;
- }
-
- Entry * entry = &E(index);
-
- if( entry->isEndOfChain() ) {
- entry->clear();
- }
- else {
- // Get next entry.
- Entry & next_entry = E(entry->next_in_chain);
-
- // Copy next entry in this place.
- new (entry) Entry(next_entry);
-
- next_entry.clear();
- }
-
- entry_count--;
-
- return true;
- }
-
-
- /// Remove all entries from the hash table.
- void clear()
- {
- if (table != NULL)
- {
- // Delete the entries.
- for (int i = 0, n = size_mask; i <= n; i++)
- {
- Entry * e = &E(i);
- if (e->isEmpty() == false)
- {
- e->clear();
- }
- }
- free(table);
- table = NULL;
- entry_count = 0;
- size_mask = -1;
- }
- }
-
-
- /// Returns true if the hash is empty.
- bool isEmpty() const
- {
- return table == NULL || entry_count == 0;
- }
-
-
- /** Retrieve the value under the given key.
- *
- * If there's no value under the key, then return false and leave
- * *value alone.
- *
- * If there is a value, return true, and set *value to the entry's
- * value.
- *
- * If value == NULL, return true or false according to the
- * presence of the key, but don't touch *value.
- */
- bool get(const T& key, U* value = NULL) const
- {
- int index = findIndex(key);
- if (index >= 0)
- {
- if (value) {
- *value = E(index).value; // take care with side-effects!
- }
- return true;
- }
- return false;
- }
-
- /// Determine if the given key is contained in the hash.
- bool contains(const T & key) const
- {
- return get(key);
- }
-
- /// Number of entries in the hash.
- int size()
- {
- return entry_count;
- }
-
- /// Number of entries in the hash.
- int count()
- {
- return size();
- }
-
-
- /**
- * Resize the hash table to fit one more entry. Often this
- * doesn't involve any action.
- */
- void checkExpand()
- {
- if (table == NULL) {
- // Initial creation of table. Make a minimum-sized table.
- setRawCapacity(16);
- }
- else if (entry_count * 3 > (size_mask + 1) * 2) {
- // Table is more than 2/3rds full. Expand.
- setRawCapacity(entry_count * 2);
- }
- }
-
-
- /// Hint the bucket count to >= n.
- void resize(int n)
- {
- // Not really sure what this means in relation to
- // STLport's hash_map... they say they "increase the
- // bucket count to at least n" -- but does that mean
- // their real capacity after resize(n) is more like
- // n*2 (since they do linked-list chaining within
- // buckets?).
- setCapacity(n);
- }
-
- /**
- * Size the hash so that it can comfortably contain the given
- * number of elements. If the hash already contains more
- * elements than new_size, then this may be a no-op.
- */
- void setCapacity(int new_size)
- {
- int new_raw_size = (new_size * 3) / 2;
- if (new_raw_size < size()) { return; }
-
- setRawCapacity(new_raw_size);
- }
-
- /// Behaves much like std::pair.
- struct Entry
- {
- int next_in_chain; // internal chaining for collisions
- uint hash_value; // avoids recomputing. Worthwhile?
- T key;
- U value;
-
- Entry() : next_in_chain(-2) {}
- Entry(const Entry& e)
- : next_in_chain(e.next_in_chain), hash_value(e.hash_value), key(e.key), value(e.value)
- {
- }
- Entry(const T& k, const U& v, int next, int hash)
- : next_in_chain(next), hash_value(hash), key(k), value(v)
- {
- }
- bool isEmpty() const { return next_in_chain == -2; }
- bool isEndOfChain() const { return next_in_chain == -1; }
-
- void clear()
- {
- key.~T(); // placement delete
- value.~U(); // placement delete
- next_in_chain = -2;
- }
- };
-
-
- // HashMap enumerator.
- typedef int PseudoIndex;
- PseudoIndex start() const { PseudoIndex i = 0; findNext(i); return i; }
- bool isDone(const PseudoIndex & i) const { nvDebugCheck(i <= size_mask+1); return i == size_mask+1; };
- void advance(PseudoIndex & i) const { nvDebugCheck(i <= size_mask+1); i++; findNext(i); }
-
- #if NV_CC_GNUC
- Entry & operator[]( const PseudoIndex & i ) {
- return E(i);
- }
- const Entry & operator[]( const PseudoIndex & i ) const {
- return E(i);
- }
- #elif NV_CC_MSVC
- Entry & operator[]( const PseudoIndexWrapper & i ) {
- return E(i(this));
- }
- const Entry & operator[]( const PseudoIndexWrapper & i ) const {
- return E(i(this));
- }
- #endif
-
-
-
- private:
-
- // Find the index of the matching entry. If no match, then return -1.
- int findIndex(const T& key) const
- {
- if (table == NULL) return -1;
-
- uint hash_value = hash_functor()(key);
- int index = hash_value & size_mask;
-
- const Entry * e = &E(index);
- if (e->isEmpty()) return -1;
- if (int(e->hash_value & size_mask) != index) return -1; // occupied by a collider
-
- for (;;)
- {
- nvCheck((e->hash_value & size_mask) == (hash_value & size_mask));
-
- if (e->hash_value == hash_value && e->key == key)
- {
- // Found it.
- return index;
- }
- nvDebugCheck(! (e->key == key)); // keys are equal, but hash differs!
-
- // Keep looking through the chain.
- index = e->next_in_chain;
- if (index == -1) break; // end of chain
-
- nvCheck(index >= 0 && index <= size_mask);
- e = &E(index);
-
- nvCheck(e->isEmpty() == false);
- }
- return -1;
- }
-
- // Helpers.
- Entry & E(int index)
- {
- nvDebugCheck(table != NULL);
- nvDebugCheck(index >= 0 && index <= size_mask);
- return table[index];
- }
- const Entry & E(int index) const
- {
- nvDebugCheck(table != NULL);
- nvDebugCheck(index >= 0 && index <= size_mask);
- return table[index];
- }
-
-
- /**
- * Resize the hash table to the given size (Rehash the
- * contents of the current table). The arg is the number of
- * hash table entries, not the number of elements we should
- * actually contain (which will be less than this).
- */
- void setRawCapacity(int new_size)
- {
- if (new_size <= 0) {
- // Special case.
- clear();
- return;
- }
-
- // Force new_size to be a power of two.
- new_size = nextPowerOfTwo(new_size);
-
- HashMap<T, U, hash_functor> new_hash;
- new_hash.table = (Entry *) malloc<T>(new_size);
- nvDebugCheck(new_hash.table != NULL);
-
- new_hash.entry_count = 0;
- new_hash.size_mask = new_size - 1;
- for (int i = 0; i < new_size; i++)
- {
- new_hash.E(i).next_in_chain = -2; // mark empty
- }
-
- // Copy stuff to new_hash
- if (table != NULL)
- {
- for (int i = 0, n = size_mask; i <= n; i++)
- {
- Entry * e = &E(i);
- if (e->isEmpty() == false)
- {
- // Insert old entry into new hash.
- new_hash.add(e->key, e->value);
- e->clear(); // placement delete of old element
- }
- }
-
- // Delete our old data buffer.
- free(table);
- }
-
- // Steal new_hash's data.
- entry_count = new_hash.entry_count;
- size_mask = new_hash.size_mask;
- table = new_hash.table;
- new_hash.entry_count = 0;
- new_hash.size_mask = -1;
- new_hash.table = NULL;
- }
-
- // Move the enumerator to the next valid element.
- void findNext(PseudoIndex & i) const {
- while (i <= size_mask && E(i).isEmpty()) {
- i++;
- }
- }
-
-
- int entry_count;
- int size_mask;
- Entry * table;
-
- };
-
-
-
-} // nv namespace
-
-#endif // NV_CORE_CONTAINER_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/CpuInfo.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvcore/CpuInfo.cpp
deleted file mode 100644
index 9c09f041..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/CpuInfo.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvcore/CpuInfo.h>
-#include <nvcore/Debug.h>
-
-using namespace nv;
-
-#if NV_OS_WIN32
-
-#define _WIN32_WINNT 0x0501
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
-
-static bool isWow64()
-{
- LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
-
- BOOL bIsWow64 = FALSE;
-
- if (NULL != fnIsWow64Process)
- {
- if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64))
- {
- return false;
- }
- }
-
- return bIsWow64 == TRUE;
-}
-
-#endif // NV_OS_WIN32
-
-
-#if NV_OS_LINUX
-#include <string.h>
-#include <sched.h>
-#endif // NV_OS_LINUX
-
-#if NV_OS_DARWIN
-#include <sys/types.h>
-#include <sys/sysctl.h>
-#endif // NV_OS_DARWIN
-
-// Initialize the data and the local defines, which are designed
-// to match the positions in cpuid
-uint CpuInfo::m_cpu = ~0x0;
-uint CpuInfo::m_procCount = 0;
-#define NV_CPUINFO_MMX_MASK (1<<23)
-#define NV_CPUINFO_SSE_MASK (1<<25)
-#define NV_CPUINFO_SSE2_MASK (1<<26)
-#define NV_CPUINFO_SSE3_MASK (1)
-
-
-uint CpuInfo::processorCount()
-{
- if (m_procCount == 0) {
-#if NV_OS_WIN32
- SYSTEM_INFO sysInfo;
-
- typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
-
- if (isWow64())
- {
- GetNativeSystemInfo(&sysInfo);
- }
- else
- {
- GetSystemInfo(&sysInfo);
- }
-
- uint count = (uint)sysInfo.dwNumberOfProcessors;
- m_procCount = count;
-
-#elif NV_OS_LINUX
-
- // Code from x264 (July 6 snapshot) cpu.c:271
- uint bit;
- uint np;
- cpu_set_t p_aff;
- memset( &p_aff, 0, sizeof(p_aff) );
- sched_getaffinity( 0, sizeof(p_aff), &p_aff );
- for( np = 0, bit = 0; bit < sizeof(p_aff); bit++ )
- np += (((uint8 *)&p_aff)[bit / 8] >> (bit % 8)) & 1;
- m_procCount = np;
-
-#elif NV_OS_DARWIN
-
- // Code from x264 (July 6 snapshot) cpu.c:286
- uint numberOfCPUs;
- size_t length = sizeof( numberOfCPUs );
- if( sysctlbyname("hw.ncpu", &numberOfCPUs, &length, NULL, 0) )
- {
- numberOfCPUs = 1;
- }
- m_procCount = numberOfCPUs;
-
-#else
- m_procCount = 1;
-#endif
- }
- nvDebugCheck(m_procCount > 0);
- return m_procCount;
-}
-
-uint CpuInfo::coreCount()
-{
- return 1;
-}
-
-bool CpuInfo::hasMMX()
-{
- return (cpu() & NV_CPUINFO_MMX_MASK) != 0;
-}
-
-bool CpuInfo::hasSSE()
-{
- return (cpu() & NV_CPUINFO_SSE_MASK) != 0;
-}
-
-bool CpuInfo::hasSSE2()
-{
- return (cpu() & NV_CPUINFO_SSE2_MASK) != 0;
-}
-
-bool CpuInfo::hasSSE3()
-{
- return (cpu() & NV_CPUINFO_SSE3_MASK) != 0;
-}
-
-inline int CpuInfo::cpu() {
- if (m_cpu == ~0x0) {
- m_cpu = 0;
-
-#if NV_CC_MSVC
- int CPUInfo[4] = {-1};
- __cpuid(CPUInfo, /*InfoType*/ 1);
-
- if (CPUInfo[2] & NV_CPUINFO_SSE3_MASK) {
- m_cpu |= NV_CPUINFO_SSE3_MASK;
- }
- if (CPUInfo[3] & NV_CPUINFO_MMX_MASK) {
- m_cpu |= NV_CPUINFO_MMX_MASK;
- }
- if (CPUInfo[3] & NV_CPUINFO_SSE_MASK) {
- m_cpu |= NV_CPUINFO_SSE_MASK;
- }
- if (CPUInfo[3] & NV_CPUINFO_SSE2_MASK) {
- m_cpu |= NV_CPUINFO_SSE2_MASK;
- }
-#elif NV_CC_GNUC
- // TODO: add the proper inline assembly
-#if NV_CPU_X86
-
-#elif NV_CPU_X86_64
-
-#endif // NV_CPU_X86_64
-#endif // NV_CC_GNUC
- }
- return m_cpu;
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/CpuInfo.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/CpuInfo.h
deleted file mode 100644
index 964d0983..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/CpuInfo.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_CPUINFO_H
-#define NV_CORE_CPUINFO_H
-
-#include <nvcore/nvcore.h>
-
-#if NV_CC_MSVC
-#if _MSC_VER >= 1400
-# include <intrin.h> // __rdtsc
-#endif
-#endif
-
-
-namespace nv
-{
-
- // CPU Information.
- class CpuInfo
- {
- protected:
- static int cpu();
-
- private:
- // Cache of the CPU data
- static uint m_cpu;
- static uint m_procCount;
-
- public:
- static uint processorCount();
- static uint coreCount();
-
- static bool hasMMX();
- static bool hasSSE();
- static bool hasSSE2();
- static bool hasSSE3();
- };
-
-#if NV_CC_MSVC
-#if _MSC_VER < 1400
- inline uint64 rdtsc()
- {
- uint64 t;
- __asm rdtsc
- __asm mov DWORD PTR [t], eax
- __asm mov DWORD PTR [t+4], edx
- return t;
- }
-#else
- #pragma intrinsic(__rdtsc)
-
- inline uint64 rdtsc()
- {
- return __rdtsc();
- }
-#endif
-#endif
-
-#if NV_CC_GNUC
-
-#if defined(__i386__)
-
- inline /*volatile*/ uint64 rdtsc()
- {
- uint64 x;
- //__asm__ volatile ("rdtsc" : "=A" (x));
- __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
- return x;
- }
-
-#elif defined(__x86_64__)
-
- static __inline__ uint64 rdtsc(void)
- {
- unsigned int hi, lo;
- __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
- return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 );
- }
-
-#elif defined(__powerpc__)
-
- static __inline__ uint64 rdtsc(void)
- {
- uint64 result=0;
- unsigned long int upper, lower, tmp;
- __asm__ volatile(
- "0: \n"
- "\tmftbu %0 \n"
- "\tmftb %1 \n"
- "\tmftbu %2 \n"
- "\tcmpw %2,%0 \n"
- "\tbne 0b \n"
- : "=r"(upper),"=r"(lower),"=r"(tmp)
- );
- result = upper;
- result = result<<32;
- result = result|lower;
-
- return(result);
- }
-
-#endif
-
-#endif // NV_CC_GNUC
-
-
-} // nv namespace
-
-#endif // NV_CORE_CPUINFO_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Debug.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Debug.cpp
deleted file mode 100644
index 62c222bc..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Debug.cpp
+++ /dev/null
@@ -1,537 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvcore/Debug.h>
-#include <nvcore/StrLib.h>
-
-// Extern
-#if NV_OS_WIN32 //&& NV_CC_MSVC
-# define WIN32_LEAN_AND_MEAN
-# define VC_EXTRALEAN
-# include <windows.h>
-# include <direct.h>
-# if NV_CC_MSVC
-# include <crtdbg.h>
-# if _MSC_VER < 1300
-# define DECLSPEC_DEPRECATED
- // VC6: change this path to your Platform SDK headers
-# include <dbghelp.h> // must be XP version of file
-// include "M:\\dev7\\vs\\devtools\\common\\win32sdk\\include\\dbghelp.h"
-# else
- // VC7: ships with updated headers
-# include <dbghelp.h>
-# endif
-# endif
-#endif
-
-#if !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
-# include <signal.h>
-#endif
-
-#if NV_OS_LINUX && defined(HAVE_EXECINFO_H)
-# include <execinfo.h> // backtrace
-# if NV_CC_GNUC // defined(HAVE_CXXABI_H)
-# include <cxxabi.h>
-# endif
-#endif
-
-#if NV_OS_DARWIN
-# include <unistd.h> // getpid
-# include <sys/types.h>
-# include <sys/sysctl.h> // sysctl
-# include <sys/ucontext.h>
-# undef HAVE_EXECINFO_H
-# if defined(HAVE_EXECINFO_H) // only after OSX 10.5
-# include <execinfo.h> // backtrace
-# if NV_CC_GNUC // defined(HAVE_CXXABI_H)
-# include <cxxabi.h>
-# endif
-# endif
-#endif
-
-#include <stdexcept> // std::runtime_error
-#undef assert // defined on mingw
-
-using namespace nv;
-
-namespace
-{
-
- static MessageHandler * s_message_handler = NULL;
- static AssertHandler * s_assert_handler = NULL;
-
- static bool s_sig_handler_enabled = false;
-
-#if NV_OS_WIN32 && NV_CC_MSVC
-
- // Old exception filter.
- static LPTOP_LEVEL_EXCEPTION_FILTER s_old_exception_filter = NULL;
-
-#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
-
- // Old signal handlers.
- struct sigaction s_old_sigsegv;
- struct sigaction s_old_sigtrap;
- struct sigaction s_old_sigfpe;
- struct sigaction s_old_sigbus;
-
-#endif
-
-
-#if NV_OS_WIN32 && NV_CC_MSVC
-
- // TODO write minidump
-
- static LONG WINAPI nvTopLevelFilter( struct _EXCEPTION_POINTERS * pExceptionInfo)
- {
- NV_UNUSED(pExceptionInfo);
- /* BOOL (WINAPI * Dump) (HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION );
-
- AutoString dbghelp_path(512);
- getcwd(dbghelp_path, 512);
- dbghelp_path.Append("\\DbgHelp.dll");
- nvTranslatePath(dbghelp_path);
-
- PiLibrary DbgHelp_lib(dbghelp_path, true);
-
- if( !DbgHelp_lib.IsValid() ) {
- nvDebug("*** 'DbgHelp.dll' not found.\n");
- return EXCEPTION_CONTINUE_SEARCH;
- }
-
- if( !DbgHelp_lib.BindSymbol( (void **)&Dump, "MiniDumpWriteDump" ) ) {
- nvDebug("*** 'DbgHelp.dll' too old.\n");
- return EXCEPTION_CONTINUE_SEARCH;
- }
-
- // create the file
- HANDLE hFile = ::CreateFile( "nv.dmp", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
- if( hFile == INVALID_HANDLE_VALUE ) {
- nvDebug("*** Failed to create dump file.\n");
- return EXCEPTION_CONTINUE_SEARCH;
- }
-
-
- _MINIDUMP_EXCEPTION_INFORMATION ExInfo;
-
- ExInfo.ThreadId = ::GetCurrentThreadId();
- ExInfo.ExceptionPointers = pExceptionInfo;
- ExInfo.ClientPointers = NULL;
-
- // write the dump
- bool ok = Dump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL )!=0;
- ::CloseHandle(hFile);
-
- if( !ok ) {
- nvDebug("*** Failed to save dump file.\n");
- return EXCEPTION_CONTINUE_SEARCH;
- }
-
- nvDebug("--- Dump file saved.\n");
- */
- return EXCEPTION_CONTINUE_SEARCH;
- }
-
-#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) // NV_OS_LINUX || NV_OS_DARWIN
-
-#if defined(HAVE_EXECINFO_H) // NV_OS_LINUX
-
- static bool nvHasStackTrace() {
-#if NV_OS_DARWIN
- return backtrace != NULL;
-#else
- return true;
-#endif
- }
-
- static void nvPrintStackTrace(void * trace[], int size, int start=0) {
- char ** string_array = backtrace_symbols(trace, size);
-
- nvDebug( "\nDumping stacktrace:\n" );
- for(int i = start; i < size-1; i++ ) {
-# if NV_CC_GNUC // defined(HAVE_CXXABI_H)
- char * begin = strchr(string_array[i], '(');
- char * end = strchr(string_array[i], '+');
- if( begin != 0 && begin < end ) {
- int stat;
- *end = '\0';
- *begin = '\0';
- char * module = string_array[i];
- char * name = abi::__cxa_demangle(begin+1, 0, 0, &stat);
- if( name == NULL || begin[1] != '_' || begin[2] != 'Z' ) {
- nvDebug( " In: [%s] '%s'\n", module, begin+1 );
- }
- else {
- nvDebug( " In: [%s] '%s'\n", module, name );
- }
- free(name);
- }
- else {
- nvDebug( " In: '%s'\n", string_array[i] );
- }
-# else
- nvDebug( " In: '%s'\n", string_array[i] );
-# endif
- }
- nvDebug("\n");
-
- free(string_array);
- }
-
-#endif // defined(HAVE_EXECINFO_H)
-
- static void * callerAddress(void * secret)
- {
-# if NV_OS_DARWIN
-# if defined(_STRUCT_MCONTEXT)
-# if NV_CPU_PPC
- ucontext_t * ucp = (ucontext_t *)secret;
- return (void *) ucp->uc_mcontext->__ss.__srr0;
-# elif NV_CPU_X86
- ucontext_t * ucp = (ucontext_t *)secret;
- return (void *) ucp->uc_mcontext->__ss.__eip;
-# endif
-# else
-# if NV_CPU_PPC
- ucontext_t * ucp = (ucontext_t *)secret;
- return (void *) ucp->uc_mcontext->ss.srr0;
-# elif NV_CPU_X86
- ucontext_t * ucp = (ucontext_t *)secret;
- return (void *) ucp->uc_mcontext->ss.eip;
-# endif
-# endif
-# else
-# if NV_CPU_X86_64
- // #define REG_RIP REG_INDEX(rip) // seems to be 16
- ucontext_t * ucp = (ucontext_t *)secret;
- return (void *)ucp->uc_mcontext.gregs[REG_RIP];
-# elif NV_CPU_X86
- ucontext_t * ucp = (ucontext_t *)secret;
- return (void *)ucp->uc_mcontext.gregs[14/*REG_EIP*/];
-# elif NV_CPU_PPC
- ucontext_t * ucp = (ucontext_t *)secret;
- return (void *) ucp->uc_mcontext.regs->nip;
-# endif
-# endif
-
- // How to obtain the instruction pointers in different platforms, from mlton's source code.
- // http://mlton.org/
- // OpenBSD && NetBSD
- // ucp->sc_eip
- // FreeBSD:
- // ucp->uc_mcontext.mc_eip
- // HPUX:
- // ucp->uc_link
- // Solaris:
- // ucp->uc_mcontext.gregs[REG_PC]
- // Linux hppa:
- // uc->uc_mcontext.sc_iaoq[0] & ~0x3UL
- // Linux sparc:
- // ((struct sigcontext*) secret)->sigc_regs.tpc
- // Linux sparc64:
- // ((struct sigcontext*) secret)->si_regs.pc
-
- // potentially correct for other archs:
- // Linux alpha: ucp->m_context.sc_pc
- // Linux arm: ucp->m_context.ctx.arm_pc
- // Linux ia64: ucp->m_context.sc_ip & ~0x3UL
- // Linux mips: ucp->m_context.sc_pc
- // Linux s390: ucp->m_context.sregs->regs.psw.addr
- }
-
- static void nvSigHandler(int sig, siginfo_t *info, void *secret)
- {
- void * pnt = callerAddress(secret);
-
- // Do something useful with siginfo_t
- if (sig == SIGSEGV) {
- if (pnt != NULL) nvDebug("Got signal %d, faulty address is %p, from %p\n", sig, info->si_addr, pnt);
- else nvDebug("Got signal %d, faulty address is %p\n", sig, info->si_addr);
- }
- else if(sig == SIGTRAP) {
- nvDebug("Breakpoint hit.\n");
- }
- else {
- nvDebug("Got signal %d\n", sig);
- }
-
-# if defined(HAVE_EXECINFO_H)
- if (nvHasStackTrace()) // in case of weak linking
- {
- void * trace[64];
- int size = backtrace(trace, 64);
-
- if (pnt != NULL) {
- // Overwrite sigaction with caller's address.
- trace[1] = pnt;
- }
-
- nvPrintStackTrace(trace, size, 1);
- }
-# endif // defined(HAVE_EXECINFO_H)
-
- exit(0);
- }
-
-#endif // defined(HAVE_SIGNAL_H)
-
-
-
-#if NV_OS_WIN32 //&& NV_CC_MSVC
-
- /** Win32 asset handler. */
- struct Win32AssertHandler : public AssertHandler
- {
- // Code from Daniel Vogel.
- static bool isDebuggerPresent()
- {
- bool result = false;
-
- HINSTANCE kern_lib = LoadLibraryExA( "kernel32.dll", NULL, 0 );
- if( kern_lib ) {
- FARPROC lIsDebuggerPresent = GetProcAddress( kern_lib, "IsDebuggerPresent" );
- if( lIsDebuggerPresent && lIsDebuggerPresent() ) {
- result = true;
- }
-
- FreeLibrary( kern_lib );
- }
- return result;
- }
-
- // Flush the message queue. This is necessary for the message box to show up.
- static void flushMessageQueue()
- {
- MSG msg;
- while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) {
- if( msg.message == WM_QUIT ) break;
- TranslateMessage( &msg );
- DispatchMessage( &msg );
- }
- }
-
- // Assert handler method.
- virtual int assert( const char * exp, const char * file, int line, const char * func/*=NULL*/ )
- {
- int ret = NV_ABORT_EXIT;
-
- StringBuilder error_string;
- if( func != NULL ) {
- error_string.format( "*** Assertion failed: %s\n On file: %s\n On function: %s\n On line: %d\n ", exp, file, func, line );
- nvDebug( error_string );
- }
- else {
- error_string.format( "*** Assertion failed: %s\n On file: %s\n On line: %d\n ", exp, file, line );
- nvDebug( error_string );
- }
-
- #if _DEBUG
-
- if( isDebuggerPresent() ) {
- return NV_ABORT_DEBUG;
- }
-
- flushMessageQueue();
- int action = MessageBoxA(NULL, error_string, "Assertion failed", MB_ABORTRETRYIGNORE|MB_ICONERROR);
- switch( action ) {
- case IDRETRY:
- ret = NV_ABORT_DEBUG;
- break;
- case IDIGNORE:
- ret = NV_ABORT_IGNORE;
- break;
- case IDABORT:
- default:
- ret = NV_ABORT_EXIT;
- break;
- }
- /*if( _CrtDbgReport( _CRT_ASSERT, file, line, module, exp ) == 1 ) {
- return NV_ABORT_DEBUG;
- }*/
-
- #endif
-
- if( ret == NV_ABORT_EXIT ) {
- // Exit cleanly.
- throw std::runtime_error("Assertion failed");
- }
-
- return ret;
- }
- };
-
-#else
-
- /** Unix asset handler. */
- struct UnixAssertHandler : public AssertHandler
- {
- bool isDebuggerPresent()
- {
-# if NV_OS_DARWIN
- int mib[4];
- struct kinfo_proc info;
- size_t size;
- mib[0] = CTL_KERN;
- mib[1] = KERN_PROC;
- mib[2] = KERN_PROC_PID;
- mib[3] = getpid();
- size = sizeof(info);
- info.kp_proc.p_flag = 0;
- sysctl(mib,4,&info,&size,NULL,0);
- return ((info.kp_proc.p_flag & P_TRACED) == P_TRACED);
-# else
- // if ppid != sid, some process spawned our app, probably a debugger.
- return getsid(getpid()) != getppid();
-# endif
- }
-
- // Assert handler method.
- virtual int assert(const char * exp, const char * file, int line, const char * func)
- {
- if( func != NULL ) {
- nvDebug( "*** Assertion failed: %s\n On file: %s\n On function: %s\n On line: %d\n ", exp, file, func, line );
- }
- else {
- nvDebug( "*** Assertion failed: %s\n On file: %s\n On line: %d\n ", exp, file, line );
- }
-
-# if _DEBUG
- if( isDebuggerPresent() ) {
- return NV_ABORT_DEBUG;
- }
-# endif
-
-# if defined(HAVE_EXECINFO_H)
- if (nvHasStackTrace())
- {
- void * trace[64];
- int size = backtrace(trace, 64);
- nvPrintStackTrace(trace, size, 3);
- }
-# endif
-
- // Exit cleanly.
- throw std::runtime_error("Assertion failed");
- }
- };
-
-#endif
-
-} // namespace
-
-
-/// Handle assertion through the asset handler.
-int nvAbort(const char * exp, const char * file, int line, const char * func)
-{
-#if NV_OS_WIN32 //&& NV_CC_MSVC
- static Win32AssertHandler s_default_assert_handler;
-#else
- static UnixAssertHandler s_default_assert_handler;
-#endif
-
- if( s_assert_handler != NULL ) {
- return s_assert_handler->assert( exp, file, line, func );
- }
- else {
- return s_default_assert_handler.assert( exp, file, line, func );
- }
-}
-
-
-/// Shows a message through the message handler.
-void NV_CDECL nvDebug(const char *msg, ...)
-{
- va_list arg;
- va_start(arg,msg);
- if( s_message_handler != NULL ) {
- s_message_handler->log( msg, arg );
- }
- va_end(arg);
-}
-
-
-/// Dump debug info.
-void debug::dumpInfo()
-{
-#if !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) && defined(HAVE_EXECINFO_H)
- if (nvHasStackTrace())
- {
- void * trace[64];
- int size = backtrace(trace, 64);
- nvPrintStackTrace(trace, size, 1);
- }
-#endif
-}
-
-
-/// Set the debug message handler.
-void debug::setMessageHandler(MessageHandler * message_handler)
-{
- s_message_handler = message_handler;
-}
-
-/// Reset the debug message handler.
-void debug::resetMessageHandler()
-{
- s_message_handler = NULL;
-}
-
-/// Set the assert handler.
-void debug::setAssertHandler(AssertHandler * assert_handler)
-{
- s_assert_handler = assert_handler;
-}
-
-/// Reset the assert handler.
-void debug::resetAssertHandler()
-{
- s_assert_handler = NULL;
-}
-
-
-/// Enable signal handler.
-void debug::enableSigHandler()
-{
- nvCheck(s_sig_handler_enabled != true);
- s_sig_handler_enabled = true;
-
-#if NV_OS_WIN32 && NV_CC_MSVC
-
- s_old_exception_filter = ::SetUnhandledExceptionFilter( nvTopLevelFilter );
-
-#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
-
- // Install our signal handler
- struct sigaction sa;
- sa.sa_sigaction = nvSigHandler;
- sigemptyset (&sa.sa_mask);
- sa.sa_flags = SA_ONSTACK | SA_RESTART | SA_SIGINFO;
-
- sigaction(SIGSEGV, &sa, &s_old_sigsegv);
- sigaction(SIGTRAP, &sa, &s_old_sigtrap);
- sigaction(SIGFPE, &sa, &s_old_sigfpe);
- sigaction(SIGBUS, &sa, &s_old_sigbus);
-
-#endif
-}
-
-/// Disable signal handler.
-void debug::disableSigHandler()
-{
- nvCheck(s_sig_handler_enabled == true);
- s_sig_handler_enabled = false;
-
-#if NV_OS_WIN32 && NV_CC_MSVC
-
- ::SetUnhandledExceptionFilter( s_old_exception_filter );
- s_old_exception_filter = NULL;
-
-#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
-
- sigaction(SIGSEGV, &s_old_sigsegv, NULL);
- sigaction(SIGTRAP, &s_old_sigtrap, NULL);
- sigaction(SIGFPE, &s_old_sigfpe, NULL);
- sigaction(SIGBUS, &s_old_sigbus, NULL);
-
-#endif
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Debug.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Debug.h
deleted file mode 100644
index c0c8df38..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Debug.h
+++ /dev/null
@@ -1,130 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_DEBUG_H
-#define NV_CORE_DEBUG_H
-
-#include <nvcore/nvcore.h>
-
-#if defined(HAVE_STDARG_H)
-# include <stdarg.h> // va_list
-#endif
-
-#define NV_ABORT_DEBUG 1
-#define NV_ABORT_IGNORE 2
-#define NV_ABORT_EXIT 3
-
-#undef assert // avoid conflicts with assert method.
-
-#define nvNoAssert(exp) \
- do { \
- (void)sizeof(exp); \
- } while(0)
-
-#if NV_NO_ASSERT
-
-# define nvAssert(exp) nvNoAssert(exp)
-# define nvCheck(exp) nvNoAssert(exp)
-# define nvDebugAssert(exp) nvNoAssert(exp)
-# define nvDebugCheck(exp) nvNoAssert(exp)
-# define nvDebugBreak() nvNoAssert(0)
-
-#else // NV_NO_ASSERT
-
-# if NV_CC_MSVC
- // @@ Does this work in msvc-6 and earlier?
- // @@ Do I have to include <intrin.h> ?
-# define nvDebugBreak() __debugbreak()
- // define nvDebugBreak() __asm int 3
-# elif NV_CC_GNUC && NV_CPU_PPC && NV_OS_DARWIN
-# define nvDebugBreak() __asm__ volatile ("trap");
-# elif NV_CC_GNUC && NV_CPU_X86 && NV_OS_DARWIN
-# define nvDebugBreak() __asm__ volatile ("int3");
-# elif NV_CC_GNUC && NV_CPU_X86
-# define nvDebugBreak() __asm__ ( "int %0" : :"I"(3) )
-# else
-# include <signal.h>
-# define nvDebugBreak() raise(SIGTRAP);
- // define nvDebugBreak() *((int *)(0)) = 0
-# endif
-
-# define nvAssertMacro(exp) \
- do { \
- if(!(exp)) { \
- if( nvAbort(#exp, __FILE__, __LINE__, __FUNC__) == NV_ABORT_DEBUG ) { \
- nvDebugBreak(); \
- } \
- } \
- } while(false)
-
-# define nvAssert(exp) nvAssertMacro(exp)
-# define nvCheck(exp) nvAssertMacro(exp)
-
-# if defined(_DEBUG)
-# define nvDebugAssert(exp) nvAssertMacro(exp)
-# define nvDebugCheck(exp) nvAssertMacro(exp)
-# else // _DEBUG
-# define nvDebugAssert(exp) nvNoAssert(exp)
-# define nvDebugCheck(exp) nvNoAssert(exp)
-# endif // _DEBUG
-
-#endif // NV_NO_ASSERT
-
-// Use nvAssume for very simple expresions only: nvAssume(0), nvAssume(value == true), etc.
-#if defined(_DEBUG)
-# if NV_CC_MSVC
-# define nvAssume(exp) __assume(exp)
-# else
-# define nvAssume(exp) nvCheck(exp)
-# endif
-#else
-# define nvAssume(exp) nvCheck(exp)
-#endif
-
-
-#define nvError(x) nvAbort(x, __FILE__, __LINE__, __FUNC__)
-#define nvWarning(x) nvDebug("*** Warning %s/%d: %s\n", __FILE__, __LINE__, (x))
-
-
-#if PI_CC_MSVC
-// @@ I'm not sure it's a good idea to use the default static assert.
-# define nvStaticCheck(x) _STATIC_ASSERT(x)
-#else
-# define nvStaticCheck(x) typedef char NV_DO_STRING_JOIN2(__static_assert_,__LINE__)[(x)]
-// define nvStaticCheck(x) switch(0) { case 0: case x:; }
-#endif
-
-NVCORE_API int nvAbort(const char *exp, const char *file, int line, const char * func = 0);
-NVCORE_API void NV_CDECL nvDebug( const char *msg, ... ) __attribute__((format (printf, 1, 2)));
-
-namespace nv
-{
- /** Message handler interface. */
- struct MessageHandler {
- virtual void log(const char * str, va_list arg) = 0;
- virtual ~MessageHandler() {}
- };
-
- /** Assert handler interface. */
- struct AssertHandler {
- virtual int assert(const char *exp, const char *file, int line, const char *func = 0) = 0;
- virtual ~AssertHandler() {}
- };
-
-
- namespace debug
- {
- NVCORE_API void dumpInfo();
-
- NVCORE_API void setMessageHandler( MessageHandler * messageHandler );
- NVCORE_API void resetMessageHandler();
-
- NVCORE_API void setAssertHandler( AssertHandler * assertHanlder );
- NVCORE_API void resetAssertHandler();
-
- NVCORE_API void enableSigHandler();
- NVCORE_API void disableSigHandler();
- }
-
-} // nv namespace
-
-#endif // NV_CORE_DEBUG_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsGnucDarwin.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsGnucDarwin.h
deleted file mode 100644
index 5442b790..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsGnucDarwin.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef NV_CORE_H
-#error "Do not include this file directly."
-#endif
-
-#include <stdint.h> // uint8_t, int8_t, ...
-
-// Function linkage
-#define DLL_IMPORT
-#if __GNUC__ >= 4
-# define DLL_EXPORT __attribute__((visibility("default")))
-# define DLL_EXPORT_CLASS DLL_EXPORT
-#else
-# define DLL_EXPORT
-# define DLL_EXPORT_CLASS
-#endif
-
-// Function calling modes
-#if NV_CPU_X86
-# define NV_CDECL __attribute__((cdecl))
-# define NV_STDCALL __attribute__((stdcall))
-#else
-# define NV_CDECL
-# define NV_STDCALL
-#endif
-
-#define NV_FASTCALL __attribute__((fastcall))
-#define NV_FORCEINLINE __attribute__((always_inline))
-#define NV_DEPRECATED __attribute__((deprecated))
-
-#if __GNUC__ > 2
-#define NV_PURE __attribute__((pure))
-#define NV_CONST __attribute__((const))
-#else
-#define NV_PURE
-#define NV_CONST
-#endif
-
-// Define __FUNC__ properly.
-#if __STDC_VERSION__ < 199901L
-# if __GNUC__ >= 2
-# define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__
-# else
-# define __FUNC__ "<unknown>"
-# endif
-#else
-# define __FUNC__ __PRETTY_FUNCTION__
-#endif
-
-#define restrict __restrict__
-
-
-// Type definitions
-typedef uint8_t uint8;
-typedef int8_t int8;
-
-typedef uint16_t uint16;
-typedef int16_t int16;
-
-typedef uint32_t uint32;
-typedef int32_t int32;
-
-typedef uint64_t uint64;
-typedef int64_t int64;
-
-// Aliases
-typedef uint32 uint;
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsGnucLinux.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsGnucLinux.h
deleted file mode 100644
index a8e2a29b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsGnucLinux.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef NV_CORE_H
-#error "Do not include this file directly."
-#endif
-
-// Function linkage
-#define DLL_IMPORT
-#if __GNUC__ >= 4
-# define DLL_EXPORT __attribute__((visibility("default")))
-# define DLL_EXPORT_CLASS DLL_EXPORT
-#else
-# define DLL_EXPORT
-# define DLL_EXPORT_CLASS
-#endif
-
-// Function calling modes
-#if NV_CPU_X86
-# define NV_CDECL __attribute__((cdecl))
-# define NV_STDCALL __attribute__((stdcall))
-#else
-# define NV_CDECL
-# define NV_STDCALL
-#endif
-
-#define NV_FASTCALL __attribute__((fastcall))
-#define NV_FORCEINLINE __attribute__((always_inline))
-#define NV_DEPRECATED __attribute__((deprecated))
-
-
-#if __GNUC__ > 2
-#define NV_PURE __attribute__((pure))
-#define NV_CONST __attribute__((const))
-#else
-#define NV_PURE
-#define NV_CONST
-#endif
-
-// Define __FUNC__ properly.
-#if __STDC_VERSION__ < 199901L
-# if __GNUC__ >= 2
-# define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__
-# else
-# define __FUNC__ "<unknown>"
-# endif
-#else
-# define __FUNC__ __PRETTY_FUNCTION__
-#endif
-
-#define restrict __restrict__
-
-
-// Type definitions
-typedef unsigned char uint8;
-typedef signed char int8;
-
-typedef unsigned short uint16;
-typedef signed short int16;
-
-typedef unsigned int uint32;
-typedef signed int int32;
-
-typedef unsigned long long uint64;
-typedef signed long long int64;
-
-// Aliases
-typedef uint32 uint;
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsGnucWin32.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsGnucWin32.h
deleted file mode 100644
index 2f8e3cc5..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsGnucWin32.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef NV_CORE_H
-#error "Do not include this file directly."
-#endif
-
-// Function linkage
-#define DLL_IMPORT __declspec(dllimport)
-#define DLL_EXPORT __declspec(dllexport)
-#define DLL_EXPORT_CLASS DLL_EXPORT
-
-// Function calling modes
-#if NV_CPU_X86
-# define NV_CDECL __attribute__((cdecl))
-# define NV_STDCALL __attribute__((stdcall))
-#else
-# define NV_CDECL
-# define NV_STDCALL
-#endif
-
-#define NV_FASTCALL __attribute__((fastcall))
-#define NV_FORCEINLINE __attribute__((always_inline))
-#define NV_DEPRECATED __attribute__((deprecated))
-
-#if __GNUC__ > 2
-#define NV_PURE __attribute__((pure))
-#define NV_CONST __attribute__((const))
-#else
-#define NV_PURE
-#define NV_CONST
-#endif
-
-// Define __FUNC__ properly.
-#if __STDC_VERSION__ < 199901L
-# if __GNUC__ >= 2
-# define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__
-# else
-# define __FUNC__ "<unknown>"
-# endif
-#else
-# define __FUNC__ __PRETTY_FUNCTION__
-#endif
-
-#define restrict __restrict__
-
-
-// Type definitions
-typedef unsigned char uint8;
-typedef signed char int8;
-
-typedef unsigned short uint16;
-typedef signed short int16;
-
-typedef unsigned int uint32;
-typedef signed int int32;
-
-typedef unsigned long long uint64;
-typedef signed long long int64;
-
-// Aliases
-typedef uint32 uint;
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsVcWin32.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsVcWin32.h
deleted file mode 100644
index c1b6d36b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/DefsVcWin32.h
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef NV_CORE_H
-#error "Do not include this file directly."
-#endif
-
-// Function linkage
-#define DLL_IMPORT __declspec(dllimport)
-#define DLL_EXPORT __declspec(dllexport)
-#define DLL_EXPORT_CLASS DLL_EXPORT
-
-// Function calling modes
-#define NV_CDECL __cdecl
-#define NV_STDCALL __stdcall
-#define NV_FASTCALL __fastcall
-#define NV_FORCEINLINE __forceinline
-#define NV_DEPRECATED
-
-#define NV_PURE
-#define NV_CONST
-
-// Set standard function names.
-#define snprintf _snprintf
-#if _MSC_VER < 1500
-# define vsnprintf _vsnprintf
-#endif
-#define vsscanf _vsscanf
-#define chdir _chdir
-#define getcwd _getcwd
-
-#define va_copy(a, b) a = b
-
-#if !defined restrict
-#define restrict
-#endif
-
-// Ignore gcc attributes.
-#define __attribute__(X)
-
-#if !defined __FUNC__
-#define __FUNC__ __FUNCTION__
-#endif
-
-
-// Type definitions
-typedef unsigned char uint8;
-typedef signed char int8;
-
-typedef unsigned short uint16;
-typedef signed short int16;
-
-typedef unsigned int uint32;
-typedef signed int int32;
-
-typedef unsigned __int64 uint64;
-typedef signed __int64 int64;
-
-// Aliases
-typedef uint32 uint;
-
-
-// Unwanted VC++ warnings to disable.
-/*
-#pragma warning(disable : 4244) // conversion to float, possible loss of data
-#pragma warning(disable : 4245) // conversion from 'enum ' to 'unsigned long', signed/unsigned mismatch
-#pragma warning(disable : 4100) // unreferenced formal parameter
-#pragma warning(disable : 4514) // unreferenced inline function has been removed
-#pragma warning(disable : 4710) // inline function not expanded
-#pragma warning(disable : 4127) // Conditional expression is constant
-#pragma warning(disable : 4305) // truncation from 'const double' to 'float'
-#pragma warning(disable : 4505) // unreferenced local function has been removed
-
-#pragma warning(disable : 4702) // unreachable code in inline expanded function
-#pragma warning(disable : 4711) // function selected for automatic inlining
-#pragma warning(disable : 4725) // Pentium fdiv bug
-
-#pragma warning(disable : 4786) // Identifier was truncated and cannot be debugged.
-
-#pragma warning(disable : 4675) // resolved overload was found by argument-dependent lookup
-*/
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/FileSystem.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvcore/FileSystem.cpp
deleted file mode 100644
index 07478c98..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/FileSystem.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// This code is in the public domain -- castano@gmail.com
-
-#include "FileSystem.h"
-#include <nvcore/nvcore.h>
-
-#if NV_OS_WIN32
-//#include <shlwapi.h> // PathFileExists
-#include <windows.h> // GetFileAttributes
-#include <direct.h> // _mkdir
-#else
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
-using namespace nv;
-
-
-bool FileSystem::exists(const char * path)
-{
-#if NV_OS_UNIX
- return access(path, F_OK|R_OK) == 0;
- //struct stat buf;
- //return stat(path, &buf) == 0;
-#elif NV_OS_WIN32
- // PathFileExists requires linking to shlwapi.lib
- //return PathFileExists(path) != 0;
- return GetFileAttributes(path) != 0xFFFFFFFF;
-#else
- if (FILE * fp = fopen(path, "r"))
- {
- fclose(fp);
- return true;
- }
- return false;
-#endif
-}
-
-bool FileSystem::createDirectory(const char * path)
-{
-#if NV_OS_WIN32
- return _mkdir(path) != -1;
-#else
- return mkdir(path, 0777) != -1;
-#endif
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/FileSystem.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/FileSystem.h
deleted file mode 100644
index 8b1224ab..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/FileSystem.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// This code is in the public domain -- castano@gmail.com
-
-#ifndef NV_CORE_FILESYSTEM_H
-#define NV_CORE_FILESYSTEM_H
-
-
-namespace nv
-{
-
- namespace FileSystem
- {
-
- bool exists(const char * path);
- bool createDirectory(const char * path);
-
- } // FileSystem namespace
-
-} // nv namespace
-
-
-#endif // NV_CORE_FILESYSTEM_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Library.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Library.cpp
deleted file mode 100644
index 179239cc..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Library.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-#include "Library.h"
-#include "Debug.h"
-
-#if NV_OS_WIN32
-#define WIN32_LEAN_AND_MEAN
-#define VC_EXTRALEAN
-#include <windows.h>
-#else
-#include <dlfcn.h>
-#endif
-
-
-
-void * nvLoadLibrary(const char * name)
-{
-#if NV_OS_WIN32
- return (void *)LoadLibraryExA( name, NULL, 0 );
-#else
- return dlopen(name, RTLD_LAZY);
-#endif
-}
-
-void nvUnloadLibrary(void * handle)
-{
- nvDebugCheck(handle != NULL);
-#if NV_OS_WIN32
- FreeLibrary((HMODULE)handle);
-#else
- dlclose(handle);
-#endif
-}
-
-void * nvBindSymbol(void * handle, const char * symbol)
-{
-#if NV_OS_WIN32
- return (void *)GetProcAddress((HMODULE)handle, symbol);
-#else
- return (void *)dlsym(handle, symbol);
-#endif
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Library.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Library.h
deleted file mode 100644
index ee7d416e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Library.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// This code is in the public domain -- castano@gmail.com
-
-#ifndef NV_CORE_LIBRARY_H
-#define NV_CORE_LIBRARY_H
-
-#include <nvcore/nvcore.h>
-
-#if NV_OS_WIN32
-#define LIBRARY_NAME(name) #name ".dll"
-#elif NV_OS_DARWIN
-#define NV_LIBRARY_NAME(name) "lib" #name ".dylib"
-#else
-#define NV_LIBRARY_NAME(name) "lib" #name ".so"
-#endif
-
-NVCORE_API void * nvLoadLibrary(const char * name);
-NVCORE_API void nvUnloadLibrary(void * lib);
-NVCORE_API void * nvBindSymbol(void * lib, const char * symbol);
-
-class NVCORE_CLASS Library
-{
-public:
- Library(const char * name)
- {
- handle = nvLoadLibrary(name);
- }
- ~Library()
- {
- if (isValid())
- {
- nvUnloadLibrary(handle);
- }
- }
-
- bool isValid() const
- {
- return handle != NULL;
- }
-
- void * bindSymbol(const char * symbol)
- {
- return nvBindSymbol(handle, symbol);
- }
-
-private:
- void * handle;
-};
-
-
-#endif // NV_CORE_LIBRARY_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Memory.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Memory.cpp
deleted file mode 100644
index 50745e78..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Memory.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-// This code is in the public domain -- Ignacio Castaño <castano@gmail.com>
-
-#include "Memory.h"
-#include "Debug.h"
-
-#include <stdlib.h>
-
-#define USE_EFENCE 0
-
-#if USE_EFENCE
-extern "C" void *EF_malloc(size_t size);
-extern "C" void *EF_realloc(void * oldBuffer, size_t newSize);
-extern "C" void EF_free(void * address);
-#endif
-
-using namespace nv;
-
-#if NV_OVERRIDE_ALLOC
-
-void * malloc(size_t size)
-{
-#if USE_EFENCE
- return EF_malloc(size);
-#else
- return ::malloc(size);
-#endif
-}
-
-void * debug_malloc(size_t size, const char * file, int line)
-{
- NV_UNUSED(file);
- NV_UNUSED(line);
-#if USE_EFENCE
- return EF_malloc(size);
-#else
- return ::malloc(size);
-#endif
-}
-
-void free(void * ptr)
-{
-#if USE_EFENCE
- return EF_free(const_cast<void *>(ptr));
-#else
- ::free(const_cast<void *>(ptr));
-#endif
-}
-
-void * realloc(void * ptr, size_t size)
-{
- nvDebugCheck(ptr != NULL || size != 0); // undefined realloc behavior.
-#if USE_EFENCE
- return EF_realloc(ptr, size);
-#else
- return ::realloc(ptr, size);
-#endif
-}
-
-/* No need to override this unless we want line info.
-void * operator new (size_t size) throw()
-{
- return malloc(size);
-}
-
-void operator delete (void *p) throw()
-{
- free(p);
-}
-
-void * operator new [] (size_t size) throw()
-{
- return malloc(size);
-}
-
-void operator delete [] (void * p) throw()
-{
- free(p);
-}
-*/
-
-#if 0 // Code from Apple:
-void* operator new(std::size_t sz) throw (std::bad_alloc)
-{
- void *result = std::malloc (sz == 0 ? 1 : sz);
- if (result == NULL)
- throw std::bad_alloc();
- gNewCounter++;
- return result;
-}
-void operator delete(void* p) throw()
-{
- if (p == NULL)
- return;
- std::free (p);
- gDeleteCounter++;
-}
-
-/* These are the 'nothrow' versions of the above operators.
- The system version will try to call a std::new_handler if they
- fail, but your overriding versions are not required to do this. */
-void* operator new(std::size_t sz, const std::nothrow_t&) throw()
-{
- try {
- void * result = ::operator new (sz); // calls our overridden operator new
- return result;
- } catch (std::bad_alloc &) {
- return NULL;
- }
-}
-void operator delete(void* p, const std::nothrow_t&) throw()
-{
- ::operator delete (p);
-}
-
-#endif // 0
-
-#endif // NV_OVERRIDE_ALLOC
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Memory.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Memory.h
deleted file mode 100644
index 6599cc63..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Memory.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// This code is in the public domain -- Ignacio Castaño <castano@gmail.com>
-
-#pragma once
-#ifndef NV_CORE_MEMORY_H
-#define NV_CORE_MEMORY_H
-
-#include "nvcore.h"
-
-#include <stdlib.h> // malloc(), realloc() and free()
-#include <stddef.h> // size_t
-
-#include <new> // new and delete
-
-
-#if NV_CC_GNUC
-# define NV_ALIGN_16 __attribute__ ((__aligned__ (16)))
-#else
-# define NV_ALIGN_16 __declspec(align(16))
-#endif
-
-
-#define NV_OVERRIDE_ALLOC 0
-
-#if NV_OVERRIDE_ALLOC
-
-// Custom memory allocator
-extern "C" {
- NVCORE_API void * malloc(size_t size);
- NVCORE_API void * debug_malloc(size_t size, const char * file, int line);
- NVCORE_API void free(void * ptr);
- NVCORE_API void * realloc(void * ptr, size_t size);
-}
-
-/*
-#ifdef _DEBUG
-#define new new(__FILE__, __LINE__)
-#define malloc(i) debug_malloc(i, __FILE__, __LINE__)
-#endif
-*/
-
-#endif
-
-namespace nv {
-
- // C++ helpers.
- template <typename T> NV_FORCEINLINE T * malloc(size_t count) {
- return (T *)::malloc(sizeof(T) * count);
- }
-
- template <typename T> NV_FORCEINLINE T * realloc(T * ptr, size_t count) {
- return (T *)::realloc(ptr, sizeof(T) * count);
- }
-
- template <typename T> NV_FORCEINLINE void free(const T * ptr) {
- ::free((void *)ptr);
- }
-
-} // nv namespace
-
-#endif // NV_CORE_MEMORY_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Prefetch.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Prefetch.h
deleted file mode 100644
index 90a8b529..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Prefetch.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_PREFETCH_H
-#define NV_CORE_PREFETCH_H
-
-#include <nvcore/nvcore.h>
-
-// nvPrefetch
-#if NV_CC_GNUC
-
-#define nvPrefetch(ptr) __builtin_prefetch(ptr)
-
-#elif NV_CC_MSVC
-
-// Uses SSE Intrinsics for both x86 and x86_64
-#include <xmmintrin.h>
-
-__forceinline void nvPrefetch(const void * mem)
-{
- _mm_prefetch(static_cast<const char*>(mem), _MM_HINT_T0); /* prefetcht0 */
-// _mm_prefetch(static_cast<const char*>(mem), _MM_HINT_NTA); /* prefetchnta */
-}
-#else
-
-// do nothing in other case.
-#define nvPrefetch(ptr)
-
-#endif // NV_CC_MSVC
-
-#endif // NV_CORE_PREFETCH_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Ptr.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Ptr.h
deleted file mode 100644
index c22317bc..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Ptr.h
+++ /dev/null
@@ -1,267 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_PTR_H
-#define NV_CORE_PTR_H
-
-#include <nvcore/nvcore.h>
-#include <nvcore/Debug.h>
-
-#include <stdio.h> // NULL
-
-#define NV_DECLARE_PTR(Class) \
- typedef SmartPtr<class Class> Class ## Ptr; \
- typedef SmartPtr<const class Class> ClassConst ## Ptr
-
-
-namespace nv
-{
-
-/** Simple auto pointer template class.
- *
- * This is very similar to the standard auto_ptr class, but with some
- * additional limitations to make its use less error prone:
- * - Copy constructor and assignment operator are disabled.
- * - reset method is removed.
- *
- * The semantics of the standard auto_ptr are not clear and change depending
- * on the std implementation. For a discussion of the problems of auto_ptr read:
- * http://www.awprofessional.com/content/images/020163371X/autoptrupdate\auto_ptr_update.html
- */
-template <class T>
-class AutoPtr
-{
- NV_FORBID_COPY(AutoPtr);
- NV_FORBID_HEAPALLOC();
-public:
-
- /// Ctor.
- AutoPtr(T * p = NULL) : m_ptr(p) { }
-
- template <class Q>
- AutoPtr(Q * p) : m_ptr(static_cast<T *>(p)) { }
-
- /** Dtor. Deletes owned pointer. */
- ~AutoPtr() {
- delete m_ptr;
- m_ptr = NULL;
- }
-
- /** Delete owned pointer and assign new one. */
- void operator=( T * p ) {
- if (p != m_ptr)
- {
- delete m_ptr;
- m_ptr = p;
- }
- }
-
- /** Member access. */
- T * operator -> () const {
- nvDebugCheck(m_ptr != NULL);
- return m_ptr;
- }
-
- /** Get reference. */
- T & operator*() const {
- nvDebugCheck(m_ptr != NULL);
- return *m_ptr;
- }
-
- /** Get pointer. */
- T * ptr() const { return m_ptr; }
-
- /** Relinquish ownership of the underlying pointer and returns that pointer. */
- T * release() {
- T * tmp = m_ptr;
- m_ptr = NULL;
- return tmp;
- }
-
- /** Const pointer equal comparation. */
- friend bool operator == (const AutoPtr<T> & ap, const T * const p) {
- return (ap.ptr() == p);
- }
-
- /** Const pointer nequal comparation. */
- friend bool operator != (const AutoPtr<T> & ap, const T * const p) {
- return (ap.ptr() != p);
- }
-
- /** Const pointer equal comparation. */
- friend bool operator == (const T * const p, const AutoPtr<T> & ap) {
- return (ap.ptr() == p);
- }
-
- /** Const pointer nequal comparation. */
- friend bool operator != (const T * const p, const AutoPtr<T> & ap) {
- return (ap.ptr() != p);
- }
-
-private:
- T * m_ptr;
-};
-
-
-/// Smart pointer template class.
-template <class BaseClass>
-class SmartPtr {
-public:
-
- // BaseClass must implement addRef() and release().
- typedef SmartPtr<BaseClass> ThisType;
-
- /// Default ctor.
- SmartPtr() : m_ptr(NULL)
- {
- }
-
- /** Other type assignment. */
- template <class OtherBase>
- SmartPtr( const SmartPtr<OtherBase> & tc )
- {
- m_ptr = static_cast<BaseClass *>( tc.ptr() );
- if( m_ptr ) {
- m_ptr->addRef();
- }
- }
-
- /** Copy ctor. */
- SmartPtr( const ThisType & bc )
- {
- m_ptr = bc.ptr();
- if( m_ptr ) {
- m_ptr->addRef();
- }
- }
-
- /** Copy cast ctor. SmartPtr(NULL) is valid. */
- explicit SmartPtr( BaseClass * bc )
- {
- m_ptr = bc;
- if( m_ptr ) {
- m_ptr->addRef();
- }
- }
-
- /** Dtor. */
- ~SmartPtr()
- {
- set(NULL);
- }
-
-
- /** @name Accessors: */
- //@{
- /** -> operator. */
- BaseClass * operator -> () const
- {
- nvCheck( m_ptr != NULL );
- return m_ptr;
- }
-
- /** * operator. */
- BaseClass & operator*() const
- {
- nvCheck( m_ptr != NULL );
- return *m_ptr;
- }
-
- /** Get pointer. */
- BaseClass * ptr() const
- {
- return m_ptr;
- }
- //@}
-
-
- /** @name Mutators: */
- //@{
- /** Other type assignment. */
- template <class OtherBase>
- void operator = ( const SmartPtr<OtherBase> & tc )
- {
- set( static_cast<BaseClass *>(tc.ptr()) );
- }
-
- /** This type assignment. */
- void operator = ( const ThisType & bc )
- {
- set( bc.ptr() );
- }
-
- /** Pointer assignment. */
- void operator = ( BaseClass * bc )
- {
- set( bc );
- }
- //@}
-
-
- /** @name Comparators: */
- //@{
- /** Other type equal comparation. */
- template <class OtherBase>
- bool operator == ( const SmartPtr<OtherBase> & other ) const
- {
- return m_ptr == other.ptr();
- }
-
- /** This type equal comparation. */
- bool operator == ( const ThisType & bc ) const
- {
- return m_ptr == bc.ptr();
- }
-
- /** Const pointer equal comparation. */
- bool operator == ( const BaseClass * const bc ) const
- {
- return m_ptr == bc;
- }
-
- /** Other type not equal comparation. */
- template <class OtherBase>
- bool operator != ( const SmartPtr<OtherBase> & other ) const
- {
- return m_ptr != other.ptr();
- }
-
- /** Other type not equal comparation. */
- bool operator != ( const ThisType & bc ) const
- {
- return m_ptr != bc.ptr();
- }
-
- /** Const pointer not equal comparation. */
- bool operator != (const BaseClass * const bc) const
- {
- return m_ptr != bc;
- }
-
- /** This type lower than comparation. */
- bool operator < (const ThisType & p) const
- {
- return m_ptr < p.ptr();
- }
- //@}
-
-private:
-
- /** Set this pointer. */
- void set( BaseClass * p )
- {
- if( m_ptr != p ) {
- if( m_ptr ) m_ptr->release();
- if( p ) p->addRef();
- m_ptr = p;
- }
- }
-
-private:
-
- BaseClass * m_ptr;
-
-};
-
-} // nv namespace
-
-#endif // NV_CORE_PTR_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Radix.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Radix.cpp
deleted file mode 100644
index 245292fd..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Radix.cpp
+++ /dev/null
@@ -1,484 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Contains source code from the article "Radix Sort Revisited".
- * \file Radix.cpp
- * \author Pierre Terdiman
- * \date April, 4, 2000
- */
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-// References:
-// http://www.codercorner.com/RadixSortRevisited.htm
-// http://www.stereopsis.com/radix.html
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Revisited Radix Sort.
- * This is my new radix routine:
- * - it uses indices and doesn't recopy the values anymore, hence wasting less ram
- * - it creates all the histograms in one run instead of four
- * - it sorts words faster than dwords and bytes faster than words
- * - it correctly sorts negative floating-point values by patching the offsets
- * - it automatically takes advantage of temporal coherence
- * - multiple keys support is a side effect of temporal coherence
- * - it may be worth recoding in asm... (mainly to use FCOMI, FCMOV, etc) [it's probably memory-bound anyway]
- *
- * History:
- * - 08.15.98: very first version
- * - 04.04.00: recoded for the radix article
- * - 12.xx.00: code lifting
- * - 09.18.01: faster CHECK_PASS_VALIDITY thanks to Mark D. Shattuck (who provided other tips, not included here)
- * - 10.11.01: added local ram support
- * - 01.20.02: bugfix! In very particular cases the last pass was skipped in the float code-path, leading to incorrect sorting......
- * - 01.02.02: - "mIndices" renamed => "mRanks". That's a rank sorter after all.
- * - ranks are not "reset" anymore, but implicit on first calls
- * - 07.05.02: offsets rewritten with one less indirection.
- * - 11.03.02: "bool" replaced with RadixHint enum
- * - 07.15.04: stack-based radix added
- * - we want to use the radix sort but without making it static, and without allocating anything.
- * - we internally allocate two arrays of ranks. Each of them has N uint32s to sort N values.
- * - 1Mb/2/sizeof(uint32) = 131072 values max, at the same time.
- * - 09.22.04: - adapted to MacOS by Chris Lamb
- * - 01.12.06: - added optimizations suggested by Kyle Hubert
- * - 04.06.08: - Fix bug negative zero sorting bug by Ignacio Castaño
- *
- * \class RadixSort
- * \author Pierre Terdiman
- * \version 1.5
- * \date August, 15, 1998
- */
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Header
-
-#include <nvcore/Radix.h>
-
-#include <string.h> // memset
-
-//using namespace IceCore;
-
-#define INVALIDATE_RANKS mCurrentSize|=0x80000000
-#define VALIDATE_RANKS mCurrentSize&=0x7fffffff
-#define CURRENT_SIZE (mCurrentSize&0x7fffffff)
-#define INVALID_RANKS (mCurrentSize&0x80000000)
-
-#if NV_BIG_ENDIAN
- #define H0_OFFSET 768
- #define H1_OFFSET 512
- #define H2_OFFSET 256
- #define H3_OFFSET 0
- #define BYTES_INC (3-j)
-#else
- #define H0_OFFSET 0
- #define H1_OFFSET 256
- #define H2_OFFSET 512
- #define H3_OFFSET 768
- #define BYTES_INC j
-#endif
-
-#define CREATE_HISTOGRAMS(type, buffer) \
- /* Clear counters/histograms */ \
- memset(mHistogram, 0, 256*4*sizeof(uint32)); \
- \
- /* Prepare to count */ \
- const uint8* p = (const uint8*)input; \
- const uint8* pe = &p[nb*4]; \
- uint32* h0= &mHistogram[H0_OFFSET]; /* Histogram for first pass (LSB) */ \
- uint32* h1= &mHistogram[H1_OFFSET]; /* Histogram for second pass */ \
- uint32* h2= &mHistogram[H2_OFFSET]; /* Histogram for third pass */ \
- uint32* h3= &mHistogram[H3_OFFSET]; /* Histogram for last pass (MSB) */ \
- \
- bool AlreadySorted = true; /* Optimism... */ \
- \
- if(INVALID_RANKS) \
- { \
- /* Prepare for temporal coherence */ \
- type* Running = (type*)buffer; \
- type PrevVal = *Running; \
- \
- while(p!=pe) \
- { \
- /* Read input buffer in previous sorted order */ \
- type Val = *Running++; \
- /* Check whether already sorted or not */ \
- if(Val<PrevVal) { AlreadySorted = false; break; } /* Early out */ \
- /* Update for next iteration */ \
- PrevVal = Val; \
- \
- /* Create histograms */ \
- h0[*p++]++; h1[*p++]++; h2[*p++]++; h3[*p++]++; \
- } \
- \
- /* If all input values are already sorted, we just have to return and leave the */ \
- /* previous list unchanged. That way the routine may take advantage of temporal */ \
- /* coherence, for example when used to sort transparent faces. */ \
- if(AlreadySorted) \
- { \
- mNbHits++; \
- for(uint32 i=0;i<nb;i++) mRanks[i] = i; \
- return *this; \
- } \
- } \
- else \
- { \
- /* Prepare for temporal coherence */ \
- const uint32* Indices = mRanks; \
- type PrevVal = (type)buffer[*Indices]; \
- \
- while(p!=pe) \
- { \
- /* Read input buffer in previous sorted order */ \
- type Val = (type)buffer[*Indices++]; \
- /* Check whether already sorted or not */ \
- if(Val<PrevVal) { AlreadySorted = false; break; } /* Early out */ \
- /* Update for next iteration */ \
- PrevVal = Val; \
- \
- /* Create histograms */ \
- h0[*p++]++; h1[*p++]++; h2[*p++]++; h3[*p++]++; \
- } \
- \
- /* If all input values are already sorted, we just have to return and leave the */ \
- /* previous list unchanged. That way the routine may take advantage of temporal */ \
- /* coherence, for example when used to sort transparent faces. */ \
- if(AlreadySorted) { mNbHits++; return *this; } \
- } \
- \
- /* Else there has been an early out and we must finish computing the histograms */ \
- while(p!=pe) \
- { \
- /* Create histograms without the previous overhead */ \
- h0[*p++]++; h1[*p++]++; h2[*p++]++; h3[*p++]++; \
- }
-
-#define CHECK_PASS_VALIDITY(pass) \
- /* Shortcut to current counters */ \
- const uint32* CurCount = &mHistogram[pass<<8]; \
- \
- /* Reset flag. The sorting pass is supposed to be performed. (default) */ \
- bool PerformPass = true; \
- \
- /* Check pass validity */ \
- \
- /* If all values have the same byte, sorting is useless. */ \
- /* It may happen when sorting bytes or words instead of dwords. */ \
- /* This routine actually sorts words faster than dwords, and bytes */ \
- /* faster than words. Standard running time (O(4*n))is reduced to O(2*n) */ \
- /* for words and O(n) for bytes. Running time for floats depends on actual values... */ \
- \
- /* Get first byte */ \
- uint8 UniqueVal = *(((uint8*)input)+pass); \
- \
- /* Check that byte's counter */ \
- if(CurCount[UniqueVal]==nb) PerformPass=false;
-
-using namespace nv;
-
-/// Constructor.
-RadixSort::RadixSort() : mRanks(NULL), mRanks2(NULL), mCurrentSize(0), mTotalCalls(0), mNbHits(0), mDeleteRanks(true)
-{
- // Initialize indices
- INVALIDATE_RANKS;
-}
-
-/// Destructor.
-RadixSort::~RadixSort()
-{
- // Release everything
- if(mDeleteRanks)
- {
- delete [] mRanks2;
- delete [] mRanks;
- }
-}
-
-/// Resizes the inner lists.
-/// \param nb [in] new size (number of dwords)
-/// \return true if success
-bool RadixSort::resize(uint32 nb)
-{
- if(mDeleteRanks)
- {
- // Free previously used ram
- delete [] mRanks2;
- delete [] mRanks;
-
- // Get some fresh one
- mRanks = new uint32[nb];
- mRanks2 = new uint32[nb];
- }
- return true;
-
-}
-
-inline void RadixSort::checkResize(uint32 nb)
-{
- uint32 CurSize = CURRENT_SIZE;
- if(nb!=CurSize)
- {
- if(nb>CurSize) resize(nb);
- mCurrentSize = nb;
- INVALIDATE_RANKS;
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Main sort routine.
- * This one is for integer values. After the call, mIndices contains a list of indices in sorted order, i.e. in the order you may process your data.
- * \param input [in] a list of integer values to sort
- * \param nb [in] number of values to sort
- * \param signedvalues [in] true to handle negative values, false if you know your input buffer only contains positive values
- * \return Self-Reference
- */
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-RadixSort& RadixSort::sort(const uint32* input, uint32 nb, bool signedValues/*=true*/)
-{
- // Checkings
- if(!input || !nb || nb&0x80000000) return *this;
-
- // Stats
- mTotalCalls++;
-
- // Resize lists if needed
- checkResize(nb);
-
- // Allocate histograms & offsets on the stack
- uint32 mHistogram[256*4];
- uint32* mLink[256];
-
- // Create histograms (counters). Counters for all passes are created in one run.
- // Pros: read input buffer once instead of four times
- // Cons: mHistogram is 4Kb instead of 1Kb
- // We must take care of signed/unsigned values for temporal coherence.... I just
- // have 2 code paths even if just a single opcode changes. Self-modifying code, someone?
- if(!signedValues) { CREATE_HISTOGRAMS(uint32, input); }
- else { CREATE_HISTOGRAMS(int32, input); }
-
- // Radix sort, j is the pass number (0=LSB, 3=MSB)
- for(uint32 j=0;j<4;j++)
- {
- CHECK_PASS_VALIDITY(j);
-
- // Sometimes the fourth (negative) pass is skipped because all numbers are negative and the MSB is 0xFF (for example). This is
- // not a problem, numbers are correctly sorted anyway.
- if(PerformPass)
- {
- // Should we care about negative values?
- if(j!=3 || !signedValues)
- {
- // Here we deal with positive values only
-
- // Create offsets
- mLink[0] = mRanks2;
- for(uint32 i=1;i<256;i++) mLink[i] = mLink[i-1] + CurCount[i-1];
- }
- else
- {
- // This is a special case to correctly handle negative integers. They're sorted in the right order but at the wrong place.
- mLink[128] = mRanks2;
- for(uint32 i=129;i<256;i++) mLink[i] = mLink[i-1] + CurCount[i-1];
-
- mLink[0] = mLink[255] + CurCount[255];
- for(uint32 i=1;i<128;i++) mLink[i] = mLink[i-1] + CurCount[i-1];
- }
-
- // Perform Radix Sort
- const uint8* InputBytes = (const uint8*)input;
- InputBytes += BYTES_INC;
- if(INVALID_RANKS)
- {
- for(uint32 i=0;i<nb;i++) *mLink[InputBytes[i<<2]]++ = i;
- VALIDATE_RANKS;
- }
- else
- {
- const uint32* Indices = mRanks;
- const uint32* IndicesEnd = &mRanks[nb];
- while(Indices!=IndicesEnd)
- {
- uint32 id = *Indices++;
- *mLink[InputBytes[id<<2]]++ = id;
- }
- }
-
- // Swap pointers for next pass. Valid indices - the most recent ones - are in mRanks after the swap.
- uint32* Tmp = mRanks;
- mRanks = mRanks2;
- mRanks2 = Tmp;
- }
- }
- return *this;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Main sort routine.
- * This one is for floating-point values. After the call, mIndices contains a list of indices in sorted order, i.e. in the order you may process your data.
- * \param input [in] a list of floating-point values to sort
- * \param nb [in] number of values to sort
- * \return Self-Reference
- * \warning only sorts IEEE floating-point values
- */
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-RadixSort& RadixSort::sort(const float* input2, uint32 nb)
-{
- // Checkings
- if(!input2 || !nb || nb&0x80000000) return *this;
-
- // Stats
- mTotalCalls++;
-
- const uint32* input = (const uint32*)input2;
-
- // Resize lists if needed
- checkResize(nb);
-
- // Allocate histograms & offsets on the stack
- uint32 mHistogram[256*4];
- uint32* mLink[256];
-
- // Create histograms (counters). Counters for all passes are created in one run.
- // Pros: read input buffer once instead of four times
- // Cons: mHistogram is 4Kb instead of 1Kb
- // Floating-point values are always supposed to be signed values, so there's only one code path there.
- // Please note the floating point comparison needed for temporal coherence! Although the resulting asm code
- // is dreadful, this is surprisingly not such a performance hit - well, I suppose that's a big one on first
- // generation Pentiums....We can't make comparison on integer representations because, as Chris said, it just
- // wouldn't work with mixed positive/negative values....
- { CREATE_HISTOGRAMS(float, input2); }
-
- // Radix sort, j is the pass number (0=LSB, 3=MSB)
- for(uint32 j=0;j<4;j++)
- {
- // Should we care about negative values?
- if(j!=3)
- {
- // Here we deal with positive values only
- CHECK_PASS_VALIDITY(j);
-
- if(PerformPass)
- {
- // Create offsets
- mLink[0] = mRanks2;
- for(uint32 i=1;i<256;i++) mLink[i] = mLink[i-1] + CurCount[i-1];
-
- // Perform Radix Sort
- const uint8* InputBytes = (const uint8*)input;
- InputBytes += BYTES_INC;
- if(INVALID_RANKS)
- {
- for(uint32 i=0;i<nb;i++) *mLink[InputBytes[i<<2]]++ = i;
- VALIDATE_RANKS;
- }
- else
- {
- const uint32* Indices = mRanks;
- const uint32* IndicesEnd = &mRanks[nb];
- while(Indices!=IndicesEnd)
- {
- uint32 id = *Indices++;
- *mLink[InputBytes[id<<2]]++ = id;
- }
- }
-
- // Swap pointers for next pass. Valid indices - the most recent ones - are in mRanks after the swap.
- uint32* Tmp = mRanks;
- mRanks = mRanks2;
- mRanks2 = Tmp;
- }
- }
- else
- {
- // This is a special case to correctly handle negative values
- CHECK_PASS_VALIDITY(j);
-
- if(PerformPass)
- {
- mLink[255] = mRanks2 + CurCount[255];
- for(uint32 i = 254; i > 126; i--) mLink[i] = mLink[i+1] + CurCount[i];
- mLink[0] = mLink[127] + CurCount[127];
- for(uint32 i = 1; i < 127; i++) mLink[i] = mLink[i-1] + CurCount[i-1];
-
- // Perform Radix Sort
- if(INVALID_RANKS)
- {
- for(uint32 i=0;i<nb;i++)
- {
- uint32 Radix = input[i]>>24; // Radix byte, same as above. AND is useless here (uint32).
- // ### cmp to be killed. Not good. Later.
- if(Radix<128) *mLink[Radix]++ = i; // Number is positive, same as above
- else *(--mLink[Radix]) = i; // Number is negative, flip the sorting order
- }
- VALIDATE_RANKS;
- }
- else
- {
- for(uint32 i=0;i<nb;i++)
- {
- uint32 Radix = input[mRanks[i]]>>24; // Radix byte, same as above. AND is useless here (uint32).
- // ### cmp to be killed. Not good. Later.
- if(Radix<128) *mLink[Radix]++ = mRanks[i]; // Number is positive, same as above
- else *(--mLink[Radix]) = mRanks[i]; // Number is negative, flip the sorting order
- }
- }
- // Swap pointers for next pass. Valid indices - the most recent ones - are in mRanks after the swap.
- uint32* Tmp = mRanks;
- mRanks = mRanks2;
- mRanks2 = Tmp;
- }
- else
- {
- // The pass is useless, yet we still have to reverse the order of current list if all values are negative.
- if(UniqueVal>=128)
- {
- if(INVALID_RANKS)
- {
- // ###Possible?
- for(uint32 i=0;i<nb;i++) mRanks2[i] = nb-i-1;
- VALIDATE_RANKS;
- }
- else
- {
- for(uint32 i=0;i<nb;i++) mRanks2[i] = mRanks[nb-i-1];
- }
-
- // Swap pointers for next pass. Valid indices - the most recent ones - are in mRanks after the swap.
- uint32* Tmp = mRanks;
- mRanks = mRanks2;
- mRanks2 = Tmp;
- }
- }
- }
- }
- return *this;
-}
-
-
-bool RadixSort::setRankBuffers(uint32* ranks0, uint32* ranks1)
-{
- if(!ranks0 || !ranks1) return false;
-
- mRanks = ranks0;
- mRanks2 = ranks1;
- mDeleteRanks = false;
-
- return true;
-}
-
-RadixSort & RadixSort::sort(const Array<int> & input)
-{
- return sort((const uint32 *)input.buffer(), input.count(), true);
-}
-
-RadixSort & RadixSort::sort(const Array<uint> & input)
-{
- return sort(input.buffer(), input.count(), false);
-}
-
-RadixSort & RadixSort::sort(const Array<float> & input)
-{
- return sort(input.buffer(), input.count());
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Radix.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Radix.h
deleted file mode 100644
index 35cd8843..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Radix.h
+++ /dev/null
@@ -1,73 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Contains source code from the article "Radix Sort Revisited".
- * \file Radix.h
- * \author Pierre Terdiman
- * \date April, 4, 2000
- */
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Guard
-#ifndef NV_CORE_RADIXSORT_H
-#define NV_CORE_RADIXSORT_H
-
-#include <nvcore/nvcore.h>
-#include <nvcore/Containers.h>
-
-namespace nv
-{
-
- class NVCORE_CLASS RadixSort
- {
- NV_FORBID_COPY(RadixSort);
- public:
- // Constructor/Destructor
- RadixSort();
- ~RadixSort();
-
- // Sorting methods
- RadixSort & sort(const uint32* input, uint32 nb, bool signedValues=true);
- RadixSort & sort(const float* input, uint32 nb);
-
- // Helpers
- RadixSort & sort(const Array<int> & input);
- RadixSort & sort(const Array<uint> & input);
- RadixSort & sort(const Array<float> & input);
-
-
- //! Access to results. mRanks is a list of indices in sorted order, i.e. in the order you may further process your data
- inline /*const*/ uint32 * ranks() /*const*/ { return mRanks; }
-
- //! mIndices2 gets trashed on calling the sort routine, but otherwise you can recycle it the way you want.
- inline uint32 * recyclable() const { return mRanks2; }
-
- // Stats
- //! Returns the total number of calls to the radix sorter.
- inline uint32 totalCalls() const { return mTotalCalls; }
-
- //! Returns the number of early exits due to temporal coherence.
- inline uint32 hits() const { return mNbHits; }
-
- bool setRankBuffers(uint32* ranks0, uint32* ranks1);
-
- private:
- uint32 mCurrentSize; //!< Current size of the indices list
- uint32 * mRanks; //!< Two lists, swapped each pass
- uint32 * mRanks2;
-
- // Stats
- uint32 mTotalCalls; //!< Total number of calls to the sort routine
- uint32 mNbHits; //!< Number of early exits due to coherence
-
- // Stack-radix
- bool mDeleteRanks; //!<
-
- // Internal methods
- void checkResize(uint32 nb);
- bool resize(uint32 nb);
- };
-
-} // nv namespace
-
-#endif // NV_CORE_RADIXSORT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/RefCounted.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvcore/RefCounted.cpp
deleted file mode 100644
index 595c74c8..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/RefCounted.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include "RefCounted.h"
-
-using namespace nv;
-
-int nv::RefCounted::s_total_ref_count = 0;
-int nv::RefCounted::s_total_obj_count = 0;
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/RefCounted.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/RefCounted.h
deleted file mode 100644
index 309b2ad1..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/RefCounted.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_REFCOUNTED_H
-#define NV_CORE_REFCOUNTED_H
-
-#include <nvcore/nvcore.h>
-#include <nvcore/Debug.h>
-
-
-namespace nv
-{
-
- /// Reference counted base class to be used with SmartPtr and WeakPtr.
- class RefCounted
- {
- NV_FORBID_COPY(RefCounted);
- public:
-
- /// Ctor.
- RefCounted() : m_count(0)/*, m_weak_proxy(NULL)*/
- {
- s_total_obj_count++;
- }
-
- /// Virtual dtor.
- virtual ~RefCounted()
- {
- nvCheck( m_count == 0 );
- nvCheck( s_total_obj_count > 0 );
- s_total_obj_count--;
- }
-
-
- /// Increase reference count.
- uint addRef() const
- {
- s_total_ref_count++;
- m_count++;
- return m_count;
- }
-
-
- /// Decrease reference count and remove when 0.
- uint release() const
- {
- nvCheck( m_count > 0 );
-
- s_total_ref_count--;
- m_count--;
- if( m_count == 0 ) {
- // releaseWeakProxy();
- delete this;
- return 0;
- }
- return m_count;
- }
- /*
- /// Get weak proxy.
- WeakProxy * getWeakProxy() const
- {
- if (m_weak_proxy == NULL) {
- m_weak_proxy = new WeakProxy;
- m_weak_proxy->AddRef();
- }
- return m_weak_proxy;
- }
-
- /// Release the weak proxy.
- void releaseWeakProxy() const
- {
- if (m_weak_proxy != NULL) {
- m_weak_proxy->NotifyObjectDied();
- m_weak_proxy->Release();
- m_weak_proxy = NULL;
- }
- }
- */
- /** @name Debug methods: */
- //@{
- /// Get reference count.
- int refCount() const
- {
- return m_count;
- }
-
- /// Get total number of objects.
- static int totalObjectCount()
- {
- return s_total_obj_count;
- }
-
- /// Get total number of references.
- static int totalReferenceCount()
- {
- return s_total_ref_count;
- }
- //@}
-
-
- private:
-
- NVCORE_API static int s_total_ref_count;
- NVCORE_API static int s_total_obj_count;
-
- mutable int m_count;
- // mutable WeakProxy * weak_proxy;
-
- };
-
-
-} // nv namespace
-
-
-#endif // NV_CORE_REFCOUNTED_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/StdStream.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/StdStream.h
deleted file mode 100644
index 43046124..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/StdStream.h
+++ /dev/null
@@ -1,369 +0,0 @@
-#ifndef NV_STDSTREAM_H
-#define NV_STDSTREAM_H
-
-#include <nvcore/Stream.h>
-
-#include <stdio.h> // fopen
-#include <string.h> // memcpy
-#include <exception> // std::exception
-
-namespace nv
-{
-
-// Portable version of fopen.
-inline FILE * fileOpen(const char * fileName, const char * mode)
-{
- nvCheck(fileName != NULL);
-#if NV_CC_MSVC && _MSC_VER >= 1400
- FILE * fp;
- if (fopen_s(&fp, fileName, mode) == 0) {
- return fp;
- }
- return NULL;
-#else
- return fopen(fileName, mode);
-#endif
-}
-
-
-/// Base stdio stream.
-class NVCORE_CLASS StdStream : public Stream
-{
- NV_FORBID_COPY(StdStream);
-public:
-
- /// Ctor.
- StdStream( FILE * fp, bool autoclose=true ) :
- m_fp(fp), m_autoclose(autoclose) { }
-
- /// Dtor.
- virtual ~StdStream()
- {
- if( m_fp != NULL && m_autoclose ) {
- fclose( m_fp );
- }
- }
-
-
- /** @name Stream implementation. */
- //@{
- virtual void seek( uint pos )
- {
- nvDebugCheck(m_fp != NULL);
- nvDebugCheck(pos < size());
- fseek(m_fp, pos, SEEK_SET);
- }
-
- virtual uint tell() const
- {
- nvDebugCheck(m_fp != NULL);
- return ftell(m_fp);
- }
-
- virtual uint size() const
- {
- nvDebugCheck(m_fp != NULL);
- uint pos = ftell(m_fp);
- fseek(m_fp, 0, SEEK_END);
- uint end = ftell(m_fp);
- fseek(m_fp, pos, SEEK_SET);
- return end;
- }
-
- virtual bool isError() const
- {
- return m_fp == NULL || ferror( m_fp ) != 0;
- }
-
- virtual void clearError()
- {
- nvDebugCheck(m_fp != NULL);
- clearerr(m_fp);
- }
-
- virtual bool isAtEnd() const
- {
- nvDebugCheck(m_fp != NULL);
- return feof( m_fp ) != 0;
- }
-
- /// Always true.
- virtual bool isSeekable() const { return true; }
- //@}
-
-protected:
-
- FILE * m_fp;
- bool m_autoclose;
-
-};
-
-
-/// Standard output stream.
-class NVCORE_CLASS StdOutputStream : public StdStream
-{
- NV_FORBID_COPY(StdOutputStream);
-public:
-
- /// Construct stream by file name.
- StdOutputStream( const char * name ) :
- StdStream(fileOpen(name, "wb")) { }
-
- /// Construct stream by file handle.
- StdOutputStream( FILE * fp, bool autoclose=true ) : StdStream(fp, autoclose)
- {
- }
-
- /** @name Stream implementation. */
- //@{
- /// Write data.
- virtual uint serialize( void * data, uint len )
- {
- nvDebugCheck(data != NULL);
- nvDebugCheck(m_fp != NULL);
- return (uint)fwrite(data, 1, len, m_fp);
- }
-
- virtual bool isLoading() const
- {
- return false;
- }
-
- virtual bool isSaving() const
- {
- return true;
- }
- //@}
-
-};
-
-
-/// Standard input stream.
-class NVCORE_CLASS StdInputStream : public StdStream
-{
- NV_FORBID_COPY(StdInputStream);
-public:
-
- /// Construct stream by file name.
- StdInputStream( const char * name ) :
- StdStream(fileOpen(name, "rb")) { }
-
- /// Construct stream by file handle.
- StdInputStream( FILE * fp, bool autoclose=true ) : StdStream(fp, autoclose)
- {
- }
-
- /** @name Stream implementation. */
- //@{
- /// Read data.
- virtual uint serialize( void * data, uint len )
- {
- nvDebugCheck(data != NULL);
- nvDebugCheck(m_fp != NULL);
- return (uint)fread(data, 1, len, m_fp);
- }
-
- virtual bool isLoading() const
- {
- return true;
- }
-
- virtual bool isSaving() const
- {
- return false;
- }
- //@}
-};
-
-
-
-/// Memory input stream.
-class NVCORE_CLASS MemoryInputStream : public Stream
-{
- NV_FORBID_COPY(MemoryInputStream);
-public:
-
- /// Ctor.
- MemoryInputStream( const uint8 * mem, uint size ) :
- m_mem(mem), m_ptr(mem), m_size(size) { }
-
- /** @name Stream implementation. */
- //@{
- /// Read data.
- virtual uint serialize( void * data, uint len )
- {
- nvDebugCheck(data != NULL);
- nvDebugCheck(!isError());
-
- uint left = m_size - tell();
- if (len > left) len = left;
-
- memcpy( data, m_ptr, len );
- m_ptr += len;
-
- return len;
- }
-
- virtual void seek( uint pos )
- {
- nvDebugCheck(!isError());
- m_ptr = m_mem + pos;
- nvDebugCheck(!isError());
- }
-
- virtual uint tell() const
- {
- nvDebugCheck(m_ptr >= m_mem);
- return uint(m_ptr - m_mem);
- }
-
- virtual uint size() const
- {
- return m_size;
- }
-
- virtual bool isError() const
- {
- return m_mem == NULL || m_ptr > m_mem + m_size || m_ptr < m_mem;
- }
-
- virtual void clearError()
- {
- // Nothing to do.
- }
-
- virtual bool isAtEnd() const
- {
- return m_ptr == m_mem + m_size;
- }
-
- /// Always true.
- virtual bool isSeekable() const
- {
- return true;
- }
-
- virtual bool isLoading() const
- {
- return true;
- }
-
- virtual bool isSaving() const
- {
- return false;
- }
- //@}
-
-
-private:
-
- const uint8 * m_mem;
- const uint8 * m_ptr;
- uint m_size;
-
-};
-
-
-/// Protected input stream.
-class NVCORE_CLASS ProtectedStream : public Stream
-{
- NV_FORBID_COPY(ProtectedStream);
-public:
-
- /// Ctor.
- ProtectedStream( Stream & s ) : m_s(&s), m_autodelete(false)
- {
- }
-
- /// Ctor.
- ProtectedStream( Stream * s, bool autodelete = true ) :
- m_s(s), m_autodelete(autodelete)
- {
- nvDebugCheck(m_s != NULL);
- }
-
- /// Dtor.
- virtual ~ProtectedStream()
- {
- if( m_autodelete ) {
- delete m_s;
- }
- }
-
- /** @name Stream implementation. */
- //@{
- /// Read data.
- virtual uint serialize( void * data, uint len )
- {
- nvDebugCheck(data != NULL);
- len = m_s->serialize( data, len );
-
- if( m_s->isError() ) {
- throw std::exception();
- }
-
- return len;
- }
-
- virtual void seek( uint pos )
- {
- m_s->seek( pos );
-
- if( m_s->isError() ) {
- throw std::exception();
- }
- }
-
- virtual uint tell() const
- {
- return m_s->tell();
- }
-
- virtual uint size() const
- {
- return m_s->size();
- }
-
- virtual bool isError() const
- {
- return m_s->isError();
- }
-
- virtual void clearError()
- {
- m_s->clearError();
- }
-
- virtual bool isAtEnd() const
- {
- return m_s->isAtEnd();
- }
-
- virtual bool isSeekable() const
- {
- return m_s->isSeekable();
- }
-
- virtual bool isLoading() const
- {
- return m_s->isLoading();
- }
-
- virtual bool isSaving() const
- {
- return m_s->isSaving();
- }
- //@}
-
-
-private:
-
- Stream * const m_s;
- bool const m_autodelete;
-
-};
-
-} // nv namespace
-
-
-#endif // NV_STDSTREAM_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/StrLib.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvcore/StrLib.cpp
deleted file mode 100644
index af7dd724..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/StrLib.cpp
+++ /dev/null
@@ -1,586 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvcore/StrLib.h>
-
-#include <math.h> // log
-#include <stdio.h> // vsnprintf
-
-#if NV_CC_MSVC
-#include <stdarg.h> // vsnprintf
-#endif
-
-#if NV_OS_WIN32
-#define NV_PATH_SEPARATOR '\\'
-#else
-#define NV_PATH_SEPARATOR '/'
-#endif
-
-using namespace nv;
-
-namespace
-{
- static char * strAlloc(uint size)
- {
- return static_cast<char *>(malloc(size));
- }
-
- static char * strReAlloc(char * str, uint size)
- {
- return static_cast<char *>(realloc(str, size));
- }
-
- static void strFree(const char * str)
- {
- return free(const_cast<char *>(str));
- }
-
- /*static char * strDup( const char * str )
- {
- nvDebugCheck( str != NULL );
- uint len = uint(strlen( str ) + 1);
- char * dup = strAlloc( len );
- memcpy( dup, str, len );
- return dup;
- }*/
-
- // helper function for integer to string conversion.
- static char * i2a( uint i, char *a, uint r )
- {
- if( i / r > 0 ) {
- a = i2a( i / r, a, r );
- }
- *a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i % r];
- return a + 1;
- }
-
- // Locale independent functions.
- static inline char toUpper( char c ) {
- return (c<'a' || c>'z') ? (c) : (c+'A'-'a');
- }
- static inline char toLower( char c ) {
- return (c<'A' || c>'Z') ? (c) : (c+'a'-'A');
- }
- static inline bool isAlpha( char c ) {
- return (c>='a' && c<='z') || (c>='A' && c<='Z');
- }
- static inline bool isDigit( char c ) {
- return c>='0' && c<='9';
- }
- static inline bool isAlnum( char c ) {
- return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9');
- }
-
-}
-
-int nv::strCmp(const char * s1, const char * s2)
-{
- nvDebugCheck(s1 != NULL);
- nvDebugCheck(s2 != NULL);
- return strcmp(s1, s2);
-}
-
-int nv::strCaseCmp(const char * s1, const char * s2)
-{
- nvDebugCheck(s1 != NULL);
- nvDebugCheck(s1 != NULL);
-#if NV_CC_MSVC
- return _stricmp(s1, s2);
-#else
- return strcasecmp(s1, s2);
-#endif
-}
-
-void nv::strCpy(char * dst, int size, const char * src)
-{
- nvDebugCheck(dst != NULL);
- nvDebugCheck(src != NULL);
-#if NV_CC_MSVC && _MSC_VER >= 1400
- strcpy_s(dst, size, src);
-#else
- NV_UNUSED(size);
- strcpy(dst, src);
-#endif
-}
-
-void nv::strCpy(char * dst, int size, const char * src, int len)
-{
- nvDebugCheck(dst != NULL);
- nvDebugCheck(src != NULL);
-#if NV_CC_MSVC && _MSC_VER >= 1400
- strncpy_s(dst, size, src, len);
-#else
- NV_UNUSED(size);
- strncpy(dst, src, len);
-#endif
-}
-
-void nv::strCat(char * dst, int size, const char * src)
-{
- nvDebugCheck(dst != NULL);
- nvDebugCheck(src != NULL);
-#if NV_CC_MSVC && _MSC_VER >= 1400
- strcat_s(dst, size, src);
-#else
- NV_UNUSED(size);
- strcat(dst, src);
-#endif
-}
-
-
-/** Pattern matching routine. I don't remember where did I get this. */
-bool nv::strMatch(const char * str, const char * pat)
-{
- nvDebugCheck(str != NULL);
- nvDebugCheck(pat != NULL);
-
- char c2;
-
- while (true) {
- if (*pat==0) {
- if (*str==0) return true;
- else return false;
- }
- if ((*str==0) && (*pat!='*')) return false;
- if (*pat=='*') {
- pat++;
- if (*pat==0) return true;
- while (true) {
- if (strMatch(str, pat)) return true;
- if (*str==0) return false;
- str++;
- }
- }
- if (*pat=='?') goto match;
- if (*pat=='[') {
- pat++;
- while (true) {
- if ((*pat==']') || (*pat==0)) return false;
- if (*pat==*str) break;
- if (pat[1] == '-') {
- c2 = pat[2];
- if (c2==0) return false;
- if ((*pat<=*str) && (c2>=*str)) break;
- if ((*pat>=*str) && (c2<=*str)) break;
- pat+=2;
- }
- pat++;
- }
- while (*pat!=']') {
- if (*pat==0) {
- pat--;
- break;
- }
- pat++;
- }
- goto match;
- }
-
- if (*pat == NV_PATH_SEPARATOR) {
- pat++;
- if (*pat==0) return false;
- }
- if (*pat!=*str) return false;
-
-match:
- pat++;
- str++;
- }
-}
-
-
-
-/** Empty string. */
-StringBuilder::StringBuilder() : m_size(0), m_str(NULL)
-{
-}
-
-/** Preallocate space. */
-StringBuilder::StringBuilder( int size_hint ) : m_size(size_hint)
-{
- nvDebugCheck(m_size > 0);
- m_str = strAlloc(m_size);
- *m_str = '\0';
-}
-
-/** Copy ctor. */
-StringBuilder::StringBuilder( const StringBuilder & s ) : m_size(0), m_str(NULL)
-{
- copy(s);
-}
-
-/** Copy string. */
-StringBuilder::StringBuilder( const char * s ) : m_size(0), m_str(NULL)
-{
- copy(s);
-}
-
-/** Delete the string. */
-StringBuilder::~StringBuilder()
-{
- m_size = 0;
- strFree(m_str);
- m_str = NULL;
-}
-
-
-/** Format a string safely. */
-StringBuilder & StringBuilder::format( const char * fmt, ... )
-{
- nvDebugCheck(fmt != NULL);
- va_list arg;
- va_start( arg, fmt );
-
- format( fmt, arg );
-
- va_end( arg );
-
- return *this;
-}
-
-
-/** Format a string safely. */
-StringBuilder & StringBuilder::format( const char * fmt, va_list arg )
-{
- nvDebugCheck(fmt != NULL);
-
- if( m_size == 0 ) {
- m_size = 64;
- m_str = strAlloc( m_size );
- }
-
- va_list tmp;
- va_copy(tmp, arg);
-#if NV_CC_MSVC && _MSC_VER >= 1400
- int n = vsnprintf_s(m_str, m_size, _TRUNCATE, fmt, tmp);
-#else
- int n = vsnprintf(m_str, m_size, fmt, tmp);
-#endif
- va_end(tmp);
-
- while( n < 0 || n >= int(m_size) ) {
- if( n > -1 ) {
- m_size = n + 1;
- }
- else {
- m_size *= 2;
- }
-
- m_str = strReAlloc(m_str, m_size);
-
- va_copy(tmp, arg);
-#if NV_CC_MSVC && _MSC_VER >= 1400
- n = vsnprintf_s(m_str, m_size, _TRUNCATE, fmt, tmp);
-#else
- n = vsnprintf(m_str, m_size, fmt, tmp);
-#endif
- va_end(tmp);
- }
-
- nvDebugCheck(n < int(m_size));
-
- // Make sure it's null terminated.
- nvDebugCheck(m_str[n] == '\0');
- //str[n] = '\0';
-
- return *this;
-}
-
-
-/** Append a string. */
-StringBuilder & StringBuilder::append( const char * s )
-{
- nvDebugCheck(s != NULL);
-
- const uint slen = uint(strlen( s ));
-
- if( m_str == NULL ) {
- m_size = slen + 1;
- m_str = strAlloc(m_size);
- strCpy( m_str, m_size, s );
- }
- else {
-
- const uint len = uint(strlen( m_str ));
-
- if( m_size < len + slen + 1 ) {
- m_size = len + slen + 1;
- m_str = strReAlloc(m_str, m_size);
- }
-
- strCat( m_str, m_size, s );
- }
-
- return *this;
-}
-
-
-/** Append a formatted string. */
-StringBuilder & StringBuilder::appendFormat( const char * format, ... )
-{
- nvDebugCheck( format != NULL );
-
- va_list arg;
- va_start( arg, format );
-
- appendFormat( format, arg );
-
- va_end( arg );
-
- return *this;
-}
-
-
-/** Append a formatted string. */
-StringBuilder & StringBuilder::appendFormat( const char * format, va_list arg )
-{
- nvDebugCheck( format != NULL );
-
- va_list tmp;
- va_copy(tmp, arg);
-
- StringBuilder tmp_str;
- tmp_str.format( format, tmp );
- append( tmp_str );
-
- va_end(tmp);
-
- return *this;
-}
-
-
-/** Convert number to string in the given base. */
-StringBuilder & StringBuilder::number( int i, int base )
-{
- nvCheck( base >= 2 );
- nvCheck( base <= 36 );
-
- // @@ This needs to be done correctly.
- // length = floor(log(i, base));
- uint len = uint(log(float(i)) / log(float(base)) + 2); // one more if negative
- reserve(len);
-
- if( i < 0 ) {
- *m_str = '-';
- *i2a(uint(-i), m_str+1, base) = 0;
- }
- else {
- *i2a(i, m_str, base) = 0;
- }
-
- return *this;
-}
-
-
-/** Convert number to string in the given base. */
-StringBuilder & StringBuilder::number( uint i, int base )
-{
- nvCheck( base >= 2 );
- nvCheck( base <= 36 );
-
- // @@ This needs to be done correctly.
- // length = floor(log(i, base));
- uint len = uint(log(float(i)) / log(float(base)) - 0.5f + 1);
- reserve(len);
-
- *i2a(i, m_str, base) = 0;
-
- return *this;
-}
-
-
-/** Resize the string preserving the contents. */
-StringBuilder & StringBuilder::reserve( uint size_hint )
-{
- nvCheck(size_hint != 0);
- if( size_hint > m_size ) {
- m_str = strReAlloc(m_str, size_hint);
- m_size = size_hint;
- }
- return *this;
-}
-
-
-/** Copy a string safely. */
-StringBuilder & StringBuilder::copy( const char * s )
-{
- nvCheck( s != NULL );
- uint str_size = uint(strlen( s )) + 1;
- reserve(str_size);
- strCpy( m_str, str_size, s );
- return *this;
-}
-
-
-/** Copy an StringBuilder. */
-StringBuilder & StringBuilder::copy( const StringBuilder & s )
-{
- if( s.m_str == NULL ) {
- nvCheck( s.m_size == 0 );
- m_size = 0;
- strFree( m_str );
- m_str = NULL;
- }
- else {
- reserve( s.m_size );
- strCpy( m_str, s.m_size, s.m_str );
- }
- return *this;
-}
-
-/** Reset the string. */
-void StringBuilder::reset()
-{
- m_size = 0;
- strFree( m_str );
- m_str = NULL;
-}
-
-
-/// Get the file name from a path.
-const char * Path::fileName() const
-{
- return fileName(m_str);
-}
-
-
-/// Get the extension from a file path.
-const char * Path::extension() const
-{
- return extension(m_str);
-}
-
-
-/// Toggles path separators (ie. \\ into /).
-void Path::translatePath()
-{
- nvCheck( m_str != NULL );
-
- for(int i = 0; ; i++) {
- if( m_str[i] == '\0' ) break;
-#if NV_PATH_SEPARATOR == '/'
- if( m_str[i] == '\\' ) m_str[i] = NV_PATH_SEPARATOR;
-#else
- if( m_str[i] == '/' ) m_str[i] = NV_PATH_SEPARATOR;
-#endif
- }
-}
-
-
-/**
- * Strip the file name from a path.
- * @warning path cannot end with '/' o '\\', can't it?
- */
-void Path::stripFileName()
-{
- nvCheck( m_str != NULL );
-
- int length = (int)strlen(m_str) - 1;
- while (length > 0 && m_str[length] != '/' && m_str[length] != '\\'){
- length--;
- }
- if( length ) {
- m_str[length+1] = 0;
- }
- else {
- m_str[0] = 0;
- }
-}
-
-
-/// Strip the extension from a path name.
-void Path::stripExtension()
-{
- nvCheck( m_str != NULL );
-
- int length = (int)strlen(m_str) - 1;
- while( length > 0 && m_str[length] != '.' ) {
- length--;
- if( m_str[length] == NV_PATH_SEPARATOR ) {
- return; // no extension
- }
- }
- if( length ) {
- m_str[length] = 0;
- }
-}
-
-
-/// Get the path separator.
-// static
-char Path::separator()
-{
- return NV_PATH_SEPARATOR;
-}
-
-// static
-const char * Path::fileName(const char * str)
-{
- nvCheck( str != NULL );
-
- int length = (int)strlen(str) - 1;
- while( length >= 0 && str[length] != separator() ) {
- length--;
- }
-
- return &str[length+1];
-}
-
-// static
-const char * Path::extension(const char * str)
-{
- nvCheck( str != NULL );
-
- int length, l;
- l = length = (int)strlen( str );
- while( length > 0 && str[length] != '.' ) {
- length--;
- if( str[length] == separator() ) {
- return &str[l]; // no extension
- }
- }
- if( length == 0 ) {
- return &str[l];
- }
- return &str[length];
-}
-
-
-// static
-String String::s_null(String::null);
-
-/// Clone this string
-String String::clone() const
-{
- String str(data);
- return str;
-}
-
-void String::setString(const char * str)
-{
- if( str == NULL ) {
- data = s_null.data;
- }
- else {
- allocString( str );
- }
- addRef();
-}
-
-void String::setString(const char * str, int length)
-{
- nvDebugCheck(str != NULL);
-
- allocString(str, length);
- addRef();
-}
-
-void String::setString(const StringBuilder & str)
-{
- if( str.str() == NULL ) {
- data = s_null.data;
- }
- else {
- allocString(str);
- }
- addRef();
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/StrLib.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/StrLib.h
deleted file mode 100644
index 1af07d3d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/StrLib.h
+++ /dev/null
@@ -1,352 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_STRING_H
-#define NV_CORE_STRING_H
-
-#include <nvcore/nvcore.h>
-#include <nvcore/Containers.h> // swap
-
-#include <string.h> // strlen, strcmp, etc.
-
-
-namespace nv
-{
-
- uint strHash(const char * str, uint h) NV_PURE;
-
- /// String hash based on Bernstein's hash.
- inline uint strHash(const char * data, uint h = 5381)
- {
- uint i;
- while(data[i] != 0) {
- h = (33 * h) ^ uint(data[i]);
- i++;
- }
- return h;
- }
-
- template <> struct hash<const char *> {
- uint operator()(const char * str) const { return strHash(str); }
- };
-
- NVCORE_API int strCaseCmp(const char * s1, const char * s2) NV_PURE;
- NVCORE_API int strCmp(const char * s1, const char * s2) NV_PURE;
- NVCORE_API void strCpy(char * dst, int size, const char * src);
- NVCORE_API void strCpy(char * dst, int size, const char * src, int len);
- NVCORE_API void strCat(char * dst, int size, const char * src);
-
- NVCORE_API bool strMatch(const char * str, const char * pat) NV_PURE;
-
-
- /// String builder.
- class NVCORE_CLASS StringBuilder
- {
- public:
-
- StringBuilder();
- explicit StringBuilder( int size_hint );
- StringBuilder( const char * str );
- StringBuilder( const StringBuilder & );
-
- ~StringBuilder();
-
- StringBuilder & format( const char * format, ... ) __attribute__((format (printf, 2, 3)));
- StringBuilder & format( const char * format, va_list arg );
-
- StringBuilder & append( const char * str );
- StringBuilder & appendFormat( const char * format, ... ) __attribute__((format (printf, 2, 3)));
- StringBuilder & appendFormat( const char * format, va_list arg );
-
- StringBuilder & number( int i, int base = 10 );
- StringBuilder & number( uint i, int base = 10 );
-
- StringBuilder & reserve( uint size_hint );
- StringBuilder & copy( const char * str );
- StringBuilder & copy( const StringBuilder & str );
-
- StringBuilder & toLower();
- StringBuilder & toUpper();
-
- void reset();
- bool isNull() const { return m_size == 0; }
-
- // const char * accessors
- operator const char * () const { return m_str; }
- operator char * () { return m_str; }
- const char * str() const { return m_str; }
- char * str() { return m_str; }
-
- /// Implement value semantics.
- StringBuilder & operator=( const StringBuilder & s ) {
- return copy(s);
- }
-
- /// Implement value semantics.
- StringBuilder & operator=( const char * s ) {
- return copy(s);
- }
-
- /// Equal operator.
- bool operator==( const StringBuilder & s ) const {
- if (s.isNull()) return isNull();
- else if (isNull()) return false;
- else return strcmp(s.m_str, m_str) != 0;
- }
-
- /// Return the exact length.
- uint length() const { return isNull() ? 0 : uint(strlen(m_str)); }
-
- /// Return the size of the string container.
- uint capacity() const { return m_size; }
-
- /// Return the hash of the string.
- uint hash() const { return isNull() ? 0 : strHash(m_str); }
-
- /// Swap strings.
- friend void swap(StringBuilder & a, StringBuilder & b) {
- nv::swap(a.m_size, b.m_size);
- nv::swap(a.m_str, b.m_str);
- }
-
- protected:
-
- /// Size of the string container.
- uint m_size;
-
- /// String.
- char * m_str;
-
- };
-
-
- /// Path string. @@ This should be called PathBuilder.
- class NVCORE_CLASS Path : public StringBuilder
- {
- public:
- Path() : StringBuilder() {}
- explicit Path(int size_hint) : StringBuilder(size_hint) {}
- Path(const char * str) : StringBuilder(str) {}
- Path(const Path & path) : StringBuilder(path) {}
-
- const char * fileName() const;
- const char * extension() const;
-
- void translatePath();
-
- void stripFileName();
- void stripExtension();
-
- // statics
- static char separator();
- static const char * fileName(const char *);
- static const char * extension(const char *);
- };
-
-
- /// String class.
- class NVCORE_CLASS String
- {
- public:
-
- /// Constructs a null string. @sa isNull()
- String()
- {
- data = s_null.data;
- addRef();
- }
-
- /// Constructs a shared copy of str.
- String(const String & str)
- {
- data = str.data;
- addRef();
- }
-
- /// Constructs a shared string from a standard string.
- String(const char * str)
- {
- setString(str);
- }
-
- /// Constructs a shared string from a standard string.
- String(const char * str, int length)
- {
- setString(str, length);
- }
-
- /// Constructs a shared string from a StringBuilder.
- String(const StringBuilder & str)
- {
- setString(str);
- }
-
- /// Dtor.
- ~String()
- {
- nvDebugCheck(data != NULL);
- release();
- }
-
- String clone() const;
-
- /// Release the current string and allocate a new one.
- const String & operator=( const char * str )
- {
- release();
- setString( str );
- return *this;
- }
-
- /// Release the current string and allocate a new one.
- const String & operator=( const StringBuilder & str )
- {
- release();
- setString( str );
- return *this;
- }
-
- /// Implement value semantics.
- String & operator=( const String & str )
- {
- if (str.data != data)
- {
- release();
- data = str.data;
- addRef();
- }
- return *this;
- }
-
- /// Equal operator.
- bool operator==( const String & str ) const
- {
- nvDebugCheck(data != NULL);
- nvDebugCheck(str.data != NULL);
- if( str.data == data ) {
- return true;
- }
- return strcmp(data, str.data) == 0;
- }
-
- /// Equal operator.
- bool operator==( const char * str ) const
- {
- nvDebugCheck(data != NULL);
- nvCheck(str != NULL); // Use isNull!
- return strcmp(data, str) == 0;
- }
-
- /// Not equal operator.
- bool operator!=( const String & str ) const
- {
- nvDebugCheck(data != NULL);
- nvDebugCheck(str.data != NULL);
- if( str.data == data ) {
- return false;
- }
- return strcmp(data, str.data) != 0;
- }
-
- /// Not equal operator.
- bool operator!=( const char * str ) const
- {
- nvDebugCheck(data != NULL);
- nvCheck(str != NULL); // Use isNull!
- return strcmp(data, str) != 0;
- }
-
- /// Returns true if this string is the null string.
- bool isNull() const { nvDebugCheck(data != NULL); return data == s_null.data; }
-
- /// Return the exact length.
- uint length() const { nvDebugCheck(data != NULL); return uint(strlen(data)); }
-
- /// Return the hash of the string.
- uint hash() const { nvDebugCheck(data != NULL); return strHash(data); }
-
- /// const char * cast operator.
- operator const char * () const { nvDebugCheck(data != NULL); return data; }
-
- /// Get string pointer.
- const char * str() const { nvDebugCheck(data != NULL); return data; }
-
-
- private:
-
- enum null_t { null };
-
- // Private constructor for null string.
- String(null_t) {
- setString("");
- }
-
- // Add reference count.
- void addRef() {
- nvDebugCheck(data != NULL);
- setRefCount(getRefCount() + 1);
- }
-
- // Decrease reference count.
- void release() {
- nvDebugCheck(data != NULL);
-
- const uint16 count = getRefCount();
- setRefCount(count - 1);
- if( count - 1 == 0 ) {
- free(data - 2);
- data = NULL;
- }
- }
-
- uint16 getRefCount() const {
- return *reinterpret_cast<const uint16 *>(data - 2);
- }
-
- void setRefCount(uint16 count) {
- nvCheck(count < 0xFFFF);
- *reinterpret_cast<uint16 *>(const_cast<char *>(data - 2)) = uint16(count);
- }
-
- void setData(const char * str) {
- data = str + 2;
- }
-
- void allocString(const char * str)
- {
- allocString(str, (int)strlen(str));
- }
-
- void allocString(const char * str, int len)
- {
- const char * ptr = malloc<char>(2 + len + 1);
-
- setData( ptr );
- setRefCount( 0 );
-
- // Copy string.
- strCpy(const_cast<char *>(data), len+1, str, len);
-
- // Add terminating character.
- const_cast<char *>(data)[len] = '\0';
- }
-
- void setString(const char * str);
- void setString(const char * str, int length);
- void setString(const StringBuilder & str);
-
- /// Swap strings.
- friend void swap(String & a, String & b) {
- swap(a.data, b.data);
- }
-
- private:
-
- NVCORE_API static String s_null;
-
- const char * data;
-
- };
-
-} // nv namespace
-
-#endif // NV_CORE_STRING_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Stream.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Stream.h
deleted file mode 100644
index 4a35120f..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Stream.h
+++ /dev/null
@@ -1,160 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NVCORE_STREAM_H
-#define NVCORE_STREAM_H
-
-#include <nvcore/nvcore.h>
-#include <nvcore/Debug.h>
-
-namespace nv
-{
-
-/// Base stream class.
-class NVCORE_CLASS Stream {
-public:
-
- enum ByteOrder {
- LittleEndian = false,
- BigEndian = true,
- };
-
- /// Get the byte order of the system.
- static ByteOrder getSystemByteOrder() {
-# if NV_LITTLE_ENDIAN
- return LittleEndian;
-# else
- return BigEndian;
-# endif
- }
-
-
- /// Ctor.
- Stream() : m_byteOrder(LittleEndian) { }
-
- /// Virtual destructor.
- virtual ~Stream() {}
-
- /// Set byte order.
- void setByteOrder(ByteOrder bo) { m_byteOrder = bo; }
-
- /// Get byte order.
- ByteOrder byteOrder() const { return m_byteOrder; }
-
-
- /// Serialize the given data.
- virtual uint serialize( void * data, uint len ) = 0;
-
- /// Move to the given position in the archive.
- virtual void seek( uint pos ) = 0;
-
- /// Return the current position in the archive.
- virtual uint tell() const = 0;
-
- /// Return the current size of the archive.
- virtual uint size() const = 0;
-
- /// Determine if there has been any error.
- virtual bool isError() const = 0;
-
- /// Clear errors.
- virtual void clearError() = 0;
-
- /// Return true if the stream is at the end.
- virtual bool isAtEnd() const = 0;
-
- /// Return true if the stream is seekable.
- virtual bool isSeekable() const = 0;
-
- /// Return true if this is an input stream.
- virtual bool isLoading() const = 0;
-
- /// Return true if this is an output stream.
- virtual bool isSaving() const = 0;
-
-
- // friends
- friend Stream & operator<<( Stream & s, bool & c ) {
-# if NV_OS_DARWIN
- nvStaticCheck(sizeof(bool) == 4);
- uint8 b = c ? 1 : 0;
- s.serialize( &b, 1 );
- c = (b == 1);
-# else
- nvStaticCheck(sizeof(bool) == 1);
- s.serialize( &c, 1 );
-# endif
- return s;
- }
- friend Stream & operator<<( Stream & s, char & c ) {
- nvStaticCheck(sizeof(char) == 1);
- s.serialize( &c, 1 );
- return s;
- }
- friend Stream & operator<<( Stream & s, uint8 & c ) {
- nvStaticCheck(sizeof(uint8) == 1);
- s.serialize( &c, 1 );
- return s;
- }
- friend Stream & operator<<( Stream & s, int8 & c ) {
- nvStaticCheck(sizeof(int8) == 1);
- s.serialize( &c, 1 );
- return s;
- }
- friend Stream & operator<<( Stream & s, uint16 & c ) {
- nvStaticCheck(sizeof(uint16) == 2);
- return s.byteOrderSerialize( &c, 2 );
- }
- friend Stream & operator<<( Stream & s, int16 & c ) {
- nvStaticCheck(sizeof(int16) == 2);
- return s.byteOrderSerialize( &c, 2 );
- }
- friend Stream & operator<<( Stream & s, uint32 & c ) {
- nvStaticCheck(sizeof(uint32) == 4);
- return s.byteOrderSerialize( &c, 4 );
- }
- friend Stream & operator<<( Stream & s, int32 & c ) {
- nvStaticCheck(sizeof(int32) == 4);
- return s.byteOrderSerialize( &c, 4 );
- }
- friend Stream & operator<<( Stream & s, uint64 & c ) {
- nvStaticCheck(sizeof(uint64) == 8);
- return s.byteOrderSerialize( &c, 8 );
- }
- friend Stream & operator<<( Stream & s, int64 & c ) {
- nvStaticCheck(sizeof(int64) == 8);
- return s.byteOrderSerialize( &c, 8 );
- }
- friend Stream & operator<<( Stream & s, float & c ) {
- nvStaticCheck(sizeof(float) == 4);
- return s.byteOrderSerialize( &c, 4 );
- }
- friend Stream & operator<<( Stream & s, double & c ) {
- nvStaticCheck(sizeof(double) == 8);
- return s.byteOrderSerialize( &c, 8 );
- }
-
-protected:
-
- /// Serialize in the stream byte order.
- Stream & byteOrderSerialize( void * v, uint len ) {
- if( m_byteOrder == getSystemByteOrder() ) {
- serialize( v, len );
- }
- else {
- for( uint i = len; i > 0; i-- ) {
- serialize( (uint8 *)v + i - 1, 1 );
- }
- }
- return *this;
- }
-
-
-private:
-
- ByteOrder m_byteOrder;
-
-};
-
-} // nv namespace
-
-#endif // NV_STREAM_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/TextReader.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvcore/TextReader.cpp
deleted file mode 100644
index 8795c594..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/TextReader.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvcore/TextReader.h>
-
-using namespace nv;
-
-/// Peek next character.
-char TextReader::peek()
-{
- nvDebugCheck(m_stream != NULL);
- nvDebugCheck(m_stream->isSeekable());
-
- if (m_stream->isAtEnd()) {
- return 0;
- }
-
- uint pos = m_stream->tell();
-
- char c;
- m_stream->serialize(&c, 1);
- m_stream->seek(pos);
- return c;
-}
-
-/// Read a single char.
-char TextReader::read()
-{
- nvDebugCheck(m_stream != NULL);
-
- char c;
- m_stream->serialize(&c, 1);
-
- if( m_stream->isAtEnd() ) {
- return 0;
- }
-
- return c;
-}
-
-/// Read from the current location to the end of the stream.
-const char * TextReader::readToEnd()
-{
- nvDebugCheck(m_stream != NULL);
- const int size = m_stream->size();
-
- m_text.clear();
-
- m_text.reserve(size + 1);
- m_text.resize(size);
-
- m_stream->serialize(m_text.mutableBuffer(), size);
- m_text.pushBack('\0');
-
- return m_text.buffer();
-}
-
-/// Read from the current location to the end of the line.
-const char * TextReader::readLine()
-{
- m_text.clear();
-
- if (m_stream->isAtEnd()) {
- return NULL;
- }
-
- while (true) {
- char c = read();
-
- if (c == 0 || c == '\n') {
- break;
- }
- else if (c == '\r') {
- if( peek() == '\n' ) {
- read();
- }
- break;
- }
-
- m_text.pushBack(c);
- }
-
- m_text.pushBack('\0');
- return m_text.buffer();
-}
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/TextReader.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/TextReader.h
deleted file mode 100644
index b3d6d374..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/TextReader.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NVCORE_TEXTREADER_H
-#define NVCORE_TEXTREADER_H
-
-#include <nvcore/nvcore.h>
-#include <nvcore/Stream.h>
-#include <nvcore/Containers.h>
-
-namespace nv
-{
-
-/// Text reader.
-class NVCORE_CLASS TextReader {
-public:
-
- /// Ctor.
- TextReader(Stream * stream) : m_stream(stream), m_text(512) {
- nvCheck(stream != NULL);
- nvCheck(stream->isLoading());
- }
-
- char peek();
- char read();
-
- const char *readToEnd();
-
- // Returns a temporary string.
- const char * readLine();
-
-private:
- Stream * m_stream;
- Array<char> m_text;
-};
-
-} // nv namespace
-
-#endif // NVCORE_TEXTREADER_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/TextWriter.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvcore/TextWriter.cpp
deleted file mode 100644
index f5e1783a..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/TextWriter.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvcore/TextWriter.h>
-
-using namespace nv;
-
-
-/// Constructor
-TextWriter::TextWriter(Stream * s) :
- s(s),
- str(1024)
-{
- nvCheck(s != NULL);
- nvCheck(s->isSaving());
-}
-
-void TextWriter::writeString(const char * str)
-{
- nvDebugCheck(s != NULL);
- s->serialize(const_cast<char *>(str), (int)strlen(str));
-}
-
-void TextWriter::writeString(const char * str, uint len)
-{
- nvDebugCheck(s != NULL);
- s->serialize(const_cast<char *>(str), len);
-}
-
-void TextWriter::write(const char * format, ...)
-{
- va_list arg;
- va_start(arg,format);
- str.format(format, arg);
- writeString(str.str(), str.length());
- va_end(arg);
-}
-
-void TextWriter::write(const char * format, va_list arg)
-{
- va_list tmp;
- va_copy(tmp, arg);
- str.format(format, arg);
- writeString(str.str(), str.length());
- va_end(tmp);
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/TextWriter.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/TextWriter.h
deleted file mode 100644
index 155373cf..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/TextWriter.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NVCORE_TEXTWRITER_H
-#define NVCORE_TEXTWRITER_H
-
-#include <nvcore/nvcore.h>
-#include <nvcore/Stream.h>
-#include <nvcore/StrLib.h>
-
-namespace nv
-{
-
- /// Text writer.
- class NVCORE_CLASS TextWriter
- {
- public:
-
- TextWriter(Stream * s);
-
- void writeString(const char * str);
- void writeString(const char * str, uint len);
- void write(const char * format, ...) __attribute__((format (printf, 2, 3)));
- void write(const char * format, va_list arg);
-
- private:
-
- Stream * s;
-
- // Temporary string.
- StringBuilder str;
-
- };
-
-
- inline TextWriter & operator<<( TextWriter & tw, int i)
- {
- tw.write("%d", i);
- return tw;
- }
-
- inline TextWriter & operator<<( TextWriter & tw, uint i)
- {
- tw.write("%u", i);
- return tw;
- }
-
- inline TextWriter & operator<<( TextWriter & tw, float f)
- {
- tw.write("%f", f);
- return tw;
- }
-
- inline TextWriter & operator<<( TextWriter & tw, const char * str)
- {
- tw.writeString(str);
- return tw;
- }
-
-} // nv namespace
-
-
-
-
-
-#endif // NVCORE_TEXTWRITER_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/ThreadLocalStorage.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/ThreadLocalStorage.h
deleted file mode 100644
index f71a07df..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/ThreadLocalStorage.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_THREADLOCALSTORAGE_H
-#define NV_CORE_THREADLOCALSTORAGE_H
-
-#include <nvcore/nvcore.h>
-
-// ThreadLocal<Context> context;
-//
-// context.allocate();
-//
-// context = new Context();
-// context->member();
-// context = NULL;
-//
-// context.free();
-
-#if NV_CC_GNUC
-
-#elif NV_CC_MSVC
-
-template <class T>
-class ThreadLocal
-{
-public:
- ThreadLocal() : index(0) {}
- ~ThreadLocal() { nvCheck(index == 0); }
-
- void allocate()
- {
- index = TlsAlloc();
- }
- void free()
- {
- delete ptr();
- TlsFree(index);
- index = 0;
- }
- bool isValid()
- {
- return index != 0;
- }
-
- void operator=( T * p )
- {
- if (p != ptr())
- {
- delete ptr();
- TlsSetValue(index, p);
- }
- }
-
- T * operator -> () const
- {
- return ptr();
- }
-
- T & operator*() const
- {
- return *ptr();
- }
-
- T * ptr() const {
- return static_cast<T *>(TlsGetValue(index));
- }
-
- DWORD index;
-};
-
-
-#endif // NV_CC_MSVC
-
-#endif // NV_CORE_THREADLOCALSTORAGE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Timer.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Timer.h
deleted file mode 100644
index ebdf3cec..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Timer.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// This code is in the public domain -- castano@gmail.com
-
-#ifndef NV_CORE_TIMER_H
-#define NV_CORE_TIMER_H
-
-#include <nvcore/nvcore.h>
-
-#include <time.h> //clock
-
-class NVCORE_CLASS Timer
-{
-public:
- Timer() {}
-
- void start() { m_start = clock(); }
- int elapsed() const { return (1000 * (clock() - m_start)) / CLOCKS_PER_SEC; }
-
-private:
- clock_t m_start;
-};
-
-#endif // NV_CORE_TIMER_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Tokenizer.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Tokenizer.cpp
deleted file mode 100644
index b2ec4cd4..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Tokenizer.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvcore/Tokenizer.h>
-#include <nvcore/StrLib.h>
-
-#include <stdio.h> // vsscanf
-#include <stdarg.h> // va_list
-#include <stdlib.h> // atof, atoi
-
-#if NV_CC_MSVC
-#if defined NV_CPU_X86
-/* vsscanf for Win32
- * Written 5/2003 by <mgix@mgix.com>
- * This code is in the Public Domain
- */
-
-#include <malloc.h> // alloca
-//#include <string.h>
-
-static int vsscanf(const char * buffer, const char * format, va_list argPtr)
-{
- // Get an upper bound for the # of args
- size_t count = 0;
- const char *p = format;
- while(1) {
- char c = *(p++);
- if(c==0) break;
- if(c=='%' && (p[0]!='*' && p[0]!='%')) ++count;
- }
-
- // Make a local stack
- size_t stackSize = (2+count)*sizeof(void*);
- void **newStack = (void**)alloca(stackSize);
-
- // Fill local stack the way sscanf likes it
- newStack[0] = (void*)buffer;
- newStack[1] = (void*)format;
- memcpy(newStack+2, argPtr, count*sizeof(void*));
-
- // @@ Use: CALL DWORD PTR [sscanf]
-
- // Warp into system sscanf with new stack
- int result;
- void *savedESP;
- __asm
- {
- mov savedESP, esp
- mov esp, newStack
-#if _MSC_VER >= 1400
- call DWORD PTR [sscanf_s]
-#else
- call DWORD PTR [sscanf]
-#endif
- mov esp, savedESP
- mov result, eax
- }
- return result;
-}
-#elif defined NV_CPU_X86_64
-
-/* Prototype of the helper assembly function */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int vsscanf_proxy_win64(const char * buffer, const char * format, va_list argPtr, __int64 count);
-
-#ifdef __cplusplus
-}
-#endif
-
-/* MASM64 version of the above vsscanf */
-static int vsscanf(const char * buffer, const char * format, va_list argPtr)
-{
- // Get an upper bound for the # of args
- __int64 count = 0;
- const char *p = format;
- while(1) {
- char c = *(p++);
- if(c==0) break;
- if(c=='%' && (p[0]!='*' && p[0]!='%')) ++count;
- }
- return vsscanf_proxy_win64(buffer, format, argPtr, count);
-}
-
-/*#error vsscanf doesn't work on MSVC for x64*/
-#else
-#error Unknown processor for MSVC
-#endif
-#endif // NV_CC_MSVC
-
-using namespace nv;
-
-Token::Token() :
- m_str(""), m_len(0)
-{
-}
-
-Token::Token(const Token & token) :
- m_str(token.m_str), m_len(token.m_len)
-{
-}
-
-Token::Token(const char * str, int len) :
- m_str(str), m_len(len)
-{
-}
-
-bool Token::operator==(const char * str) const
-{
- return strncmp(m_str, str, m_len) == 0;
-}
-bool Token::operator!=(const char * str) const
-{
- return strncmp(m_str, str, m_len) != 0;
-}
-
-bool Token::isNull()
-{
- return m_len != 0;
-}
-
-float Token::toFloat() const
-{
- return float(atof(m_str));
-}
-
-int Token::toInt() const
-{
- return atoi(m_str);
-}
-
-uint Token::toUnsignedInt() const
-{
- // @@ TBD
- return uint(atoi(m_str));
-}
-
-String Token::toString() const
-{
- return String(m_str, m_len);
-}
-
-bool Token::parse(const char * format, int count, ...) const
-{
- va_list arg;
- va_start(arg, count);
-
- int readCount = vsscanf(m_str, format, arg);
-
- va_end(arg);
-
- return readCount == count;
-}
-
-
-Tokenizer::Tokenizer(Stream * stream) :
- m_reader(stream), m_lineNumber(0), m_columnNumber(0), m_delimiters("{}()="), m_spaces(" \t")
-{
-}
-
-bool Tokenizer::nextLine(bool skipEmptyLines /*= true*/)
-{
- do {
- if (!readLine()) {
- return false;
- }
- }
- while (!readToken() && skipEmptyLines);
-
- return true;
-}
-
-bool Tokenizer::nextToken(bool skipEndOfLine /*= false*/)
-{
- if (!readToken()) {
- if (!skipEndOfLine) {
- return false;
- }
- else {
- return nextLine(true);
- }
- }
- return true;
-}
-
-bool Tokenizer::readToken()
-{
- skipSpaces();
-
- const char * begin = m_line + m_columnNumber;
-
- if (*begin == '\0') {
- return false;
- }
-
- char c = readChar();
- if (isDelimiter(c)) {
- m_token = Token(begin, 1);
- return true;
- }
-
- // @@ Add support for quoted tokens "", ''
-
- int len = 0;
- while (!isDelimiter(c) && !isSpace(c) && c != '\0') {
- c = readChar();
- len++;
- }
- m_columnNumber--;
-
- m_token = Token(begin, len);
-
- return true;
-}
-
-char Tokenizer::readChar()
-{
- return m_line[m_columnNumber++];
-}
-
-bool Tokenizer::readLine()
-{
- m_lineNumber++;
- m_columnNumber = 0;
- m_line = m_reader.readLine();
- return m_line != NULL;
-}
-
-void Tokenizer::skipSpaces()
-{
- while (isSpace(readChar())) {}
- m_columnNumber--;
-}
-
-bool Tokenizer::isSpace(char c)
-{
- uint i = 0;
- while (m_spaces[i] != '\0') {
- if (c == m_spaces[i]) {
- return true;
- }
- i++;
- }
- return false;
-}
-
-bool Tokenizer::isDelimiter(char c)
-{
- uint i = 0;
- while (m_delimiters[i] != '\0') {
- if (c == m_delimiters[i]) {
- return true;
- }
- i++;
- }
- return false;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Tokenizer.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/Tokenizer.h
deleted file mode 100644
index 48579c88..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/Tokenizer.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_TOKENIZER_H
-#define NV_CORE_TOKENIZER_H
-
-#include <nvcore/nvcore.h>
-#include <nvcore/Stream.h>
-#include <nvcore/TextReader.h>
-#include <nvcore/StrLib.h>
-
-namespace nv
-{
- /// A token produced by the Tokenizer.
- class NVCORE_CLASS Token
- {
- public:
- Token();
- Token(const Token & token);
- Token(const char * str, int len);
-
- bool operator==(const char * str) const;
- bool operator!=(const char * str) const;
-
- bool isNull();
-
- float toFloat() const;
- int toInt() const;
- uint toUnsignedInt() const;
- String toString() const;
-
- bool parse(const char * format, int count, ...) const __attribute__((format (scanf, 2, 4)));
-
- private:
- const char * m_str;
- int m_len;
- };
-
- /// Exception thrown by the tokenizer.
- class TokenizerException
- {
- public:
- TokenizerException(int line, int column) : m_line(line), m_column(column) {}
-
- int line() const { return m_line; }
- int column() const { return m_column; }
-
- private:
- int m_line;
- int m_column;
- };
-
- // @@ Use enums instead of bools for clarity!
- //enum SkipEmptyLines { skipEmptyLines, noSkipEmptyLines };
- //enum SkipEndOfLine { skipEndOfLine, noSkipEndOfLine };
-
- /// A simple stream tokenizer.
- class NVCORE_CLASS Tokenizer
- {
- public:
- Tokenizer(Stream * stream);
-
- bool nextLine(bool skipEmptyLines = true);
- bool nextToken(bool skipEndOfLine = false);
-
- const Token & token() const { return m_token; }
-
- int lineNumber() const { return m_lineNumber; }
- int columnNumber() const { return m_columnNumber; }
-
- void setDelimiters(const char * str) { m_delimiters = str; }
- const char * delimiters() const { return m_delimiters; }
-
- void setSpaces(const char * str) { m_spaces = str; }
- const char * spaces() const { return m_spaces; }
-
- private:
- char readChar();
- bool readLine();
- bool readToken();
- void skipSpaces();
- bool isSpace(char c);
- bool isDelimiter(char c);
-
- private:
- TextReader m_reader;
- const char * m_line;
- Token m_token;
-
- int m_lineNumber;
- int m_columnNumber;
-
- const char * m_delimiters;
- const char * m_spaces;
- };
-
-} // nv namespace
-
-
-#endif // NV_CORE_TOKENIZER_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/nvcore.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/nvcore.h
deleted file mode 100644
index 469f6adb..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/nvcore.h
+++ /dev/null
@@ -1,172 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_CORE_H
-#define NV_CORE_H
-
-// cmake config
-#include <nvconfig.h>
-
-// Function linkage
-#if NVCORE_SHARED
-#ifdef NVCORE_EXPORTS
-#define NVCORE_API DLL_EXPORT
-#define NVCORE_CLASS DLL_EXPORT_CLASS
-#else
-#define NVCORE_API DLL_IMPORT
-#define NVCORE_CLASS DLL_IMPORT
-#endif
-#else // NVCORE_SHARED
-#define NVCORE_API
-#define NVCORE_CLASS
-#endif // NVCORE_SHARED
-
-
-// Platform definitions
-#include "poshlib/posh.h"
-
-// OS:
-// NV_OS_WIN32
-// NV_OS_WIN64
-// NV_OS_MINGW
-// NV_OS_CYGWIN
-// NV_OS_LINUX
-// NV_OS_UNIX
-// NV_OS_DARWIN
-
-#define NV_OS_STRING POSH_OS_STRING
-
-#if defined POSH_OS_LINUX
-# define NV_OS_LINUX 1
-# define NV_OS_UNIX 1
-#elif defined POSH_OS_CYGWIN32
-# define NV_OS_CYGWIN 1
-#elif defined POSH_OS_MINGW
-# define NV_OS_MINGW 1
-# define NV_OS_WIN32 1
-#elif defined POSH_OS_OSX
-# define NV_OS_DARWIN 1
-# define NV_OS_UNIX 1
-#elif defined POSH_OS_UNIX
-# define NV_OS_UNIX 1
-#elif defined POSH_OS_WIN32
-# define NV_OS_WIN32 1
-#elif defined POSH_OS_WIN64
-# define NV_OS_WIN64 1
-#else
-# error "Unsupported OS"
-#endif
-
-
-// CPUs:
-// NV_CPU_X86
-// NV_CPU_X86_64
-// NV_CPU_PPC
-
-#define NV_CPU_STRING POSH_CPU_STRING
-
-#if defined POSH_CPU_X86_64
-# define NV_CPU_X86_64 1
-#elif defined POSH_CPU_X86
-# define NV_CPU_X86 1
-#elif defined POSH_CPU_PPC
-# define NV_CPU_PPC 1
-#else
-# error "Unsupported CPU"
-#endif
-
-
-// Compiler:
-// NV_CC_GNUC
-// NV_CC_MSVC
-// @@ NV_CC_MSVC6
-// @@ NV_CC_MSVC7
-// @@ NV_CC_MSVC8
-
-#if defined POSH_COMPILER_GCC
-# define NV_CC_GNUC 1
-# define NV_CC_STRING "gcc"
-#elif defined POSH_COMPILER_MSVC
-# define NV_CC_MSVC 1
-# define NV_CC_STRING "msvc"
-#else
-# error "Unsupported compiler"
-#endif
-
-
-// Endiannes:
-#define NV_LITTLE_ENDIAN POSH_LITTLE_ENDIAN
-#define NV_BIG_ENDIAN POSH_BIG_ENDIAN
-#define NV_ENDIAN_STRING POSH_ENDIAN_STRING
-
-
-// Version string:
-#define NV_VERSION_STRING \
- NV_OS_STRING "/" NV_CC_STRING "/" NV_CPU_STRING"/" \
- NV_ENDIAN_STRING"-endian - " __DATE__ "-" __TIME__
-
-
-/// Disable copy constructor and assignment operator.
-/// @hideinitializer
-#define NV_FORBID_COPY(C) \
- private: \
- C( const C & ); \
- C &operator=( const C & );
-
-
-/// Disable dynamic allocation on the heap.
-/// See Prohibiting Heap-Based Objects in More Effective C++.
-/// @hideinitializer
-#define NV_FORBID_HEAPALLOC() \
- private: \
- static void *operator new(size_t size); \
- static void *operator new[](size_t size);
-
-// String concatenation macros.
-#define NV_STRING_JOIN2(arg1, arg2) NV_DO_STRING_JOIN2(arg1, arg2)
-#define NV_DO_STRING_JOIN2(arg1, arg2) arg1 ## arg2
-#define NV_STRING_JOIN3(arg1, arg2, arg3) NV_DO_STRING_JOIN3(arg1, arg2, arg3)
-#define NV_DO_STRING_JOIN3(arg1, arg2, arg3) arg1 ## arg2 ## arg3
-
-// Startup initialization macro.
-#define NV_AT_STARTUP(some_code) \
- namespace { \
- static struct NV_STRING_JOIN2(AtStartup_, __LINE__) { \
- NV_STRING_JOIN2(AtStartup_, __LINE__)() { some_code; } \
- } \
- NV_STRING_JOIN3(AtStartup_, __LINE__, Instance); \
- };
-
-/// Indicate the compiler that the parameter is not used to suppress compier warnings.
-/// @hideinitializer
-#define NV_UNUSED(a) ((a)=(a))
-
-/// Null index. @@ Move this somewhere else... This could have collisions with other definitions!
-#define NIL uint(~0)
-
-/// Null pointer.
-#ifndef NULL
-#define NULL 0
-#endif
-
-// Platform includes
-#if NV_CC_MSVC
-# if NV_OS_WIN32
-# include "DefsVcWin32.h"
-# else
-# error "MSVC: Platform not supported"
-# endif
-#elif NV_CC_GNUC
-# if NV_OS_LINUX
-# include "DefsGnucLinux.h"
-# elif NV_OS_DARWIN
-# include "DefsGnucDarwin.h"
-# elif NV_OS_MINGW
-# include "DefsGnucWin32.h"
-# elif NV_OS_CYGWIN
-# error "GCC: Cygwin not supported"
-# else
-# error "GCC: Platform not supported"
-# endif
-#endif
-
-#endif // NV_CORE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/poshlib/CMakeLists.txt b/Libraries/nvidia-texture-tools-read-only/src/nvcore/poshlib/CMakeLists.txt
deleted file mode 100644
index a0f639ef..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/poshlib/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-
-SET(POSHLIB_SRCS
- posh.c
- posh.h)
-
-ADD_LIBRARY(posh STATIC ${POSHLIB_SRCS})
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/poshlib/posh.c b/Libraries/nvidia-texture-tools-read-only/src/nvcore/poshlib/posh.c
deleted file mode 100644
index bd3fcc66..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/poshlib/posh.c
+++ /dev/null
@@ -1,1006 +0,0 @@
-/*
-LICENSE:
-
-Copyright (c) 2004, Brian Hook
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- * The names of this package'ss contributors contributors may not
- be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-/**
- @file posh.c
- @author Brian Hook
- @date 2002
- @brief Portable Open Source Harness primary source file
-*/
-#include "posh.h"
-
-#if !defined FORCE_DOXYGEN
-
-#if !defined POSH_NO_FLOAT
-# define POSH_FLOAT_STRING "enabled"
-#else
-# define POSH_FLOAT_STRING "disabled"
-#endif
-
-#if defined POSH_64BIT_INTEGER
-# define POSH_64BIT_INTEGER_STRING "yes"
-#else
-# define POSH_64BIT_INTEGER_STRING "no"
-#endif
-
-#if defined POSH_64BIT_POINTER
-# define POSH_POINTER_STRING "64-bits"
-#else
-# define POSH_POINTER_STRING "32-bits"
-#endif
-
-#if defined POSH_LITTLE_ENDIAN
-# define IS_BIG_ENDIAN 0
-
-# define NATIVE16 POSH_LittleU16
-# define NATIVE32 POSH_LittleU32
-# define NATIVE64 POSH_LittleU64
-# define FOREIGN16 POSH_BigU16
-# define FOREIGN32 POSH_BigU32
-# define FOREIGN64 POSH_BigU64
-#else
-# define IS_BIG_ENDIAN 1
-
-# define NATIVE16 POSH_BigU16
-# define NATIVE32 POSH_BigU32
-# define NATIVE64 POSH_BigU64
-# define FOREIGN16 POSH_LittleU16
-# define FOREIGN32 POSH_LittleU32
-# define FOREIGN64 POSH_LittleU64
-#endif /* POSH_LITTLE_ENDIAN */
-
-static
-int
-s_testBigEndian( void )
-{
- union
- {
- posh_byte_t c[ 4 ];
- posh_u32_t i;
- } u;
-
- u.i= 1;
-
- if ( u.c[ 0 ] == 1 )
- {
- return 0;
- }
- return 1;
-}
-
-static
-const char *
-s_testSerialization( void )
-{
- posh_byte_t serbuf[ 8 ];
- posh_u16_t tmp16;
- posh_u32_t tmp32;
-
- /* 16-bit serialization */
- POSH_WriteU16ToLittle( serbuf, 0xABCD );
- if ( ( tmp16 = POSH_ReadU16FromLittle( serbuf ) ) != 0xABCD )
- {
- return "*ERROR: failed little-endian 16-bit serialization test";
- }
-
- POSH_WriteU16ToBig( serbuf, 0xABCD );
- if ( ( tmp16 = POSH_ReadU16FromBig( serbuf ) ) != 0xABCD )
- {
- return "*ERROR: failed big-endian 16-bit serialization test";
- }
-
- /* 32-bit serialization */
- POSH_WriteU32ToLittle( serbuf, 0xABCD1234L );
- if ( ( tmp32 = POSH_ReadU32FromLittle( serbuf ) ) != 0xABCD1234 )
- {
- return "*ERROR: failed little-endian 32-bit serialization test";
- }
-
- POSH_WriteU32ToBig( serbuf, 0xABCD1234L );
- if ( ( tmp32 = POSH_ReadU32FromBig( serbuf ) ) != 0xABCD1234 )
- {
- return "*ERROR: failed big-endian 32-bit serialization test";
- }
-
-#if defined POSH_64BIT_INTEGER
- {
-#define REF64 POSH_U64(0xFEDCBA9876543210)
-
- posh_u64_t tmp64;
-
- POSH_WriteU64ToLittle( serbuf, REF64 );
-
- if ( ( tmp64 = POSH_ReadU64FromLittle( serbuf ) ) != REF64 )
- {
- return "*ERROR: failed little-endian 64-bit serialization test";
- }
-
- POSH_WriteU64ToBig( serbuf, REF64 );
-
- if ( ( tmp64 = POSH_ReadU64FromBig( serbuf ) ) != REF64 )
- {
- return "*ERROR: failed big-endian 64-bit serialization test";
- }
- }
-#endif
-
- return 0;
-}
-
-#if !defined POSH_NO_FLOAT
-static
-const char *
-s_testFloatingPoint( void )
-{
- float fRef = 10.0f/30.0f;
- double dRef = 10.0/30.0;
- posh_byte_t dbuf[ 8 ];
- float fTmp;
- double dTmp;
-
- fTmp = POSH_FloatFromLittleBits( POSH_LittleFloatBits( fRef ) );
-
- if ( fTmp != fRef )
- {
- return "*ERROR: POSH little endian floating point conversion failed. Please report this to poshlib@poshlib.org!\n";
- }
-
- fTmp = POSH_FloatFromBigBits( POSH_BigFloatBits( fRef ) );
- if ( fTmp != fRef )
- {
- return "*ERROR: POSH big endian floating point conversion failed. Please report this to poshlib@poshlib.org!\n";
- }
-
- POSH_DoubleBits( dRef, dbuf );
-
- dTmp = POSH_DoubleFromBits( dbuf );
-
- if ( dTmp != dRef )
- {
- return "*ERROR: POSH double precision floating point serialization failed. Please report this to poshlib@poshlib.org!\n";
- }
-
- return 0;
-}
-#endif /* !defined POSH_NO_FLOAT */
-
-static
-const char *
-s_testEndianess( void )
-{
- /* check endianess */
- if ( s_testBigEndian() != IS_BIG_ENDIAN )
- {
- return "*ERROR: POSH compile time endianess does not match run-time endianess verification. Please report this to poshlib@poshlib.org!\n";
- }
-
- /* make sure our endian swap routines work */
- if ( ( NATIVE32( 0x11223344L ) != 0x11223344L ) ||
- ( FOREIGN32( 0x11223344L ) != 0x44332211L ) ||
- ( NATIVE16( 0x1234 ) != 0x1234 ) ||
- ( FOREIGN16( 0x1234 ) != 0x3412 ) )
- {
- return "*ERROR: POSH endianess macro selection failed. Please report this to poshlib@poshlib.org!\n";
- }
-
- /* test serialization routines */
-
- return 0;
-}
-#endif /* !defined FORCE_DOXYGEN */
-
-/**
- Returns a string describing this platform's basic attributes.
-
- POSH_GetArchString() reports on an architecture's statically determined
- attributes. In addition, it will perform run-time verification checks
- to make sure the various platform specific functions work. If an error
- occurs, please contact me at poshlib@poshlib.org so we can try to resolve
- what the specific failure case is.
- @returns a string describing this platform on success, or a string in the
- form "*ERROR: [text]" on failure. You can simply check to see if
- the first character returned is '*' to verify an error condition.
-*/
-const char *
-POSH_GetArchString( void )
-{
- const char *err;
- const char *s = "OS:.............."POSH_OS_STRING"\n"
- "CPU:............."POSH_CPU_STRING"\n"
- "endian:.........."POSH_ENDIAN_STRING"\n"
- "ptr size:........"POSH_POINTER_STRING"\n"
- "64-bit ints......"POSH_64BIT_INTEGER_STRING"\n"
- "floating point..."POSH_FLOAT_STRING"\n"
- "compiler........."POSH_COMPILER_STRING"\n";
-
- /* test endianess */
- err = s_testEndianess();
-
- if ( err != 0 )
- {
- return err;
- }
-
- /* test serialization */
- err = s_testSerialization();
-
- if ( err != 0 )
- {
- return err;
- }
-
-#if !defined POSH_NO_FLOAT
- /* check that our floating point support is correct */
- err = s_testFloatingPoint();
-
- if ( err != 0 )
- {
- return err;
- }
-
-#endif
-
- return s;
-}
-
-/* ---------------------------------------------------------------------------*/
-/* BYTE SWAPPING SUPPORT */
-/* ---------------------------------------------------------------------------*/
-/**
- * Byte swaps a 16-bit unsigned value
- *
- @ingroup ByteSwapFunctions
- @param v [in] unsigned 16-bit input value to swap
- @returns a byte swapped version of v
- */
-posh_u16_t
-POSH_SwapU16( posh_u16_t v )
-{
- posh_u16_t swapped;
-
- swapped = v << 8;
- swapped |= v >> 8;
-
- return swapped;
-}
-
-/**
- * Byte swaps a 16-bit signed value
- *
- @ingroup ByteSwapFunctions
- @param v [in] signed 16-bit input value to swap
- @returns a byte swapped version of v
- @remarks This just calls back to the unsigned version, since byte swapping
- is independent of sign. However, we still provide this function to
- avoid signed/unsigned mismatch compiler warnings.
- */
-posh_i16_t
-POSH_SwapI16( posh_i16_t v )
-{
- return ( posh_i16_t ) POSH_SwapU16( v );
-}
-
-/**
- * Byte swaps a 32-bit unsigned value
- *
- @ingroup ByteSwapFunctions
- @param v [in] unsigned 32-bit input value to swap
- @returns a byte swapped version of v
- */
-posh_u32_t
-POSH_SwapU32( posh_u32_t v )
-{
- posh_u32_t swapped;
-
- swapped = ( v & 0xFF ) << 24;
- swapped |= ( v & 0xFF00 ) << 8;
- swapped |= ( v >> 8 ) & 0xFF00;
- swapped |= ( v >> 24 );
-
- return swapped;
-}
-
-/**
- * Byte swaps a 32-bit signed value
- *
- @ingroup ByteSwapFunctions
- @param v [in] signed 32-bit input value to swap
- @returns a byte swapped version of v
- @remarks This just calls back to the unsigned version, since byte swapping
- is independent of sign. However, we still provide this function to
- avoid signed/unsigned mismatch compiler warnings.
- */
-posh_i32_t
-POSH_SwapI32( posh_i32_t v )
-{
- return ( posh_i32_t ) POSH_SwapU32( ( posh_u32_t ) v );
-}
-
-#if defined POSH_64BIT_INTEGER
-/**
- * Byte swaps a 64-bit unsigned value
-
- @param v [in] a 64-bit input value to swap
- @ingroup SixtyFourBit
- @returns a byte swapped version of v
-*/
-posh_u64_t
-POSH_SwapU64( posh_u64_t v )
-{
- posh_byte_t tmp;
- union {
- posh_byte_t bytes[ 8 ];
- posh_u64_t u64;
- } u;
-
- u.u64 = v;
-
- tmp = u.bytes[ 0 ]; u.bytes[ 0 ] = u.bytes[ 7 ]; u.bytes[ 7 ] = tmp;
- tmp = u.bytes[ 1 ]; u.bytes[ 1 ] = u.bytes[ 6 ]; u.bytes[ 6 ] = tmp;
- tmp = u.bytes[ 2 ]; u.bytes[ 2 ] = u.bytes[ 5 ]; u.bytes[ 5 ] = tmp;
- tmp = u.bytes[ 3 ]; u.bytes[ 3 ] = u.bytes[ 4 ]; u.bytes[ 4 ] = tmp;
-
- return u.u64;
-}
-
-/**
- * Byte swaps a 64-bit signed value
-
- @param v [in] a 64-bit input value to swap
- @ingroup SixtyFourBit
- @returns a byte swapped version of v
-*/
-posh_i64_t
-POSH_SwapI64( posh_i64_t v )
-{
- return ( posh_i64_t ) POSH_SwapU64( ( posh_u64_t ) v );
-}
-
-#endif /* defined POSH_64BIT_INTEGER */
-
-/* ---------------------------------------------------------------------------*/
-/* IN-MEMORY SERIALIZATION */
-/* ---------------------------------------------------------------------------*/
-
-/**
- * Writes an unsigned 16-bit value to a little endian buffer
-
- @ingroup MemoryBuffer
- @param dst [out] pointer to the destination buffer, may not be NULL. Alignment doesn't matter.
- @param value [in] host-endian unsigned 16-bit value
- @returns a pointer to the location two bytes after dst
- @remarks does no validation of the inputs
-*/
-posh_u16_t *
-POSH_WriteU16ToLittle( void *dst, posh_u16_t value )
-{
- posh_u16_t *p16 = ( posh_u16_t * ) dst;
- posh_byte_t *p = ( posh_byte_t * ) dst;
-
- p[ 0 ] = value & 0xFF;
- p[ 1 ] = ( value & 0xFF00) >> 8;
-
- return p16 + 1;
-}
-
-/**
- * Writes a signed 16-bit value to a little endian buffer
-
- @ingroup MemoryBuffer
- @param dst [out] pointer to the destination buffer, may not be NULL
- @param value [in] host-endian signed 16-bit value
- @returns a pointer to the location two bytes after dst
- @remarks does no validation of the inputs. This simply calls
- POSH_WriteU16ToLittle() with appropriate casting.
-*/
-posh_i16_t *
-POSH_WriteI16ToLittle( void *dst, posh_i16_t value )
-{
- return ( posh_i16_t * ) POSH_WriteU16ToLittle( dst, ( posh_u16_t ) value );
-}
-
-/**
- * Writes an unsigned 32-bit value to a little endian buffer
-
- @ingroup MemoryBuffer
- @param dst [out] pointer to the destination buffer, may not be NULL
- @param value [in] host-endian signed 32-bit value
- @returns a pointer to the location four bytes after dst
- @remarks does no validation of the inputs.
-*/
-posh_u32_t *
-POSH_WriteU32ToLittle( void *dst, posh_u32_t value )
-{
- posh_u32_t *p32 = ( posh_u32_t * ) dst;
- posh_byte_t *p = ( posh_byte_t * ) dst;
-
- p[ 0 ] = ( value & 0xFF );
- p[ 1 ] = ( value & 0xFF00 ) >> 8;
- p[ 2 ] = ( value & 0xFF0000 ) >> 16;
- p[ 3 ] = ( value & 0xFF000000 ) >> 24;
-
- return p32 + 1;
-}
-
-/**
- * Writes a signed 32-bit value to a little endian buffer
-
- @ingroup MemoryBuffer
- @param dst [out] pointer to the destination buffer, may not be NULL
- @param value [in] host-endian signed 32-bit value
- @returns a pointer to the location four bytes after dst
- @remarks does no validation of the inputs. This simply calls
- POSH_WriteU32ToLittle() with appropriate casting.
-*/
-posh_i32_t *
-POSH_WriteI32ToLittle( void *dst, posh_i32_t value )
-{
- return ( posh_i32_t * ) POSH_WriteU32ToLittle( dst, ( posh_u32_t ) value );
-}
-
-/**
- * Writes an unsigned 16-bit value to a big endian buffer
-
- @ingroup MemoryBuffer
- @param dst [out] pointer to the destination buffer, may not be NULL
- @param value [in] host-endian unsigned 16-bit value
- @returns a pointer to the location two bytes after dst
- @remarks does no validation of the inputs
-*/
-posh_u16_t *
-POSH_WriteU16ToBig( void *dst, posh_u16_t value )
-{
- posh_u16_t *p16 = ( posh_u16_t * ) dst;
- posh_byte_t *p = ( posh_byte_t * ) dst;
-
- p[ 1 ] = ( value & 0xFF );
- p[ 0 ] = ( value & 0xFF00 ) >> 8;
-
- return p16 + 1;
-}
-
-/**
- * Writes a signed 16-bit value to a big endian buffer
-
- @ingroup MemoryBuffer
- @param dst [out] pointer to the destination buffer, may not be NULL
- @param value [in] host-endian signed 16-bit value
- @returns a pointer to the location two bytes after dst
- @remarks does no validation of the inputs. This simply calls
- POSH_WriteU16ToLittle() with appropriate casting.
-*/
-posh_i16_t *
-POSH_WriteI16ToBig( void *dst, posh_i16_t value )
-{
- return ( posh_i16_t * ) POSH_WriteU16ToBig( dst, ( posh_u16_t ) value );
-}
-
-/**
- * Writes an unsigned 32-bit value to a big endian buffer
-
- @ingroup MemoryBuffer
- @param dst [out] pointer to the destination buffer, may not be NULL
- @param value [in] host-endian unsigned 32-bit value
- @returns a pointer to the location four bytes after dst
- @remarks does no validation of the inputs.
-*/
-posh_u32_t *
-POSH_WriteU32ToBig( void *dst, posh_u32_t value )
-{
- posh_u32_t *p32 = ( posh_u32_t * ) dst;
- posh_byte_t *p = ( posh_byte_t * ) dst;
-
- p[ 3 ] = ( value & 0xFF );
- p[ 2 ] = ( value & 0xFF00 ) >> 8;
- p[ 1 ] = ( value & 0xFF0000 ) >> 16;
- p[ 0 ] = ( value & 0xFF000000 ) >> 24;
-
- return p32 + 1;
-}
-
-/**
- * Writes a signed 32-bit value to a big endian buffer
-
- @ingroup MemoryBuffer
- @param dst [out] pointer to the destination buffer, may not be NULL
- @param value [in] host-endian signed 32-bit value
- @returns a pointer to the location four bytes after dst
- @remarks does no validation of the inputs. This simply calls
- POSH_WriteU32ToBig() with appropriate casting.
-*/
-posh_i32_t *
-POSH_WriteI32ToBig( void *dst, posh_i32_t value )
-{
- return ( posh_i32_t * ) POSH_WriteU32ToBig( dst, ( posh_u32_t ) value );
-}
-
-#if defined POSH_64BIT_INTEGER
-/**
- * Writes an unsigned 64-bit value to a little-endian buffer
-
- @ingroup SixtyFourBit
- @param dst [out] pointer to the destination buffer, may not be NULL
- @param value [in] host-endian unsigned 64-bit value
- @returns a pointer to the location eight bytes after dst
- @remarks does no validation of the inputs.
-*/
-posh_u64_t *
-POSH_WriteU64ToLittle( void *dst, posh_u64_t value )
-{
- posh_u64_t *p64 = ( posh_u64_t * ) dst;
- posh_byte_t *p = ( posh_byte_t * ) dst;
- int i;
-
- for ( i = 0; i < 8; i++, value >>= 8 )
- {
- p[ i ] = ( posh_byte_t ) ( value & 0xFF );
- }
-
- return p64 + 1;
-}
-
-/**
- * Writes a signed 64-bit value to a little-endian buffer
-
- @ingroup SixtyFourBit
- @param dst [out] pointer to the destination buffer, may not be NULL
- @param value [in] host-endian unsigned 64-bit value
- @returns a pointer to the location eight bytes after dst
- @remarks does no validation of the inputs.
-*/
-posh_i64_t *
-POSH_WriteI64ToLittle( void *dst, posh_i64_t value )
-{
- return ( posh_i64_t * ) POSH_WriteU64ToLittle( dst, ( posh_u64_t ) value );
-}
-
-/**
- * Writes an unsigned 64-bit value to a big-endian buffer
-
- @ingroup SixtyFourBit
- @param dst [out] pointer to the destination buffer, may not be NULL
- @param value [in] host-endian unsigned 64-bit value
- @returns a pointer to the location eight bytes after dst
- @remarks does no validation of the inputs.
-*/
-posh_u64_t *
-POSH_WriteU64ToBig( void *dst, posh_u64_t value )
-{
- posh_u64_t *p64 = ( posh_u64_t * ) dst;
- posh_byte_t *p = ( posh_byte_t * ) dst;
- int i;
-
- for ( i = 0; i < 8; i++, value >>= 8 )
- {
- p[ 7-i ] = ( posh_byte_t ) ( value & 0xFF );
- }
-
- return p64 + 8;
-}
-
-/**
- * Writes a signed 64-bit value to a big-endian buffer
-
- @ingroup SixtyFourBit
- @param dst [out] pointer to the destination buffer, may not be NULL
- @param value [in] host-endian signed 64-bit value
- @returns a pointer to the location eight bytes after dst
- @remarks does no validation of the inputs.
-*/
-posh_i64_t *
-POSH_WriteI64ToBig( void *dst, posh_i64_t value )
-{
- return ( posh_i64_t * ) POSH_WriteU64ToBig( dst, ( posh_u64_t ) value );
-}
-
-#endif /* POSH_64BIT_INTEGER */
-
-/* ---------------------------------------------------------------------------*/
-/* IN-MEMORY DESERIALIZATION */
-/* ---------------------------------------------------------------------------*/
-
-/**
- * Reads an unsigned 16-bit value from a little-endian buffer
- @ingroup MemoryBuffer
- @param src [in] source buffer
- @returns host-endian unsigned 16-bit value
-*/
-posh_u16_t
-POSH_ReadU16FromLittle( const void *src )
-{
- posh_u16_t v = 0;
- posh_byte_t *p = ( posh_byte_t * ) src;
-
- v |= p[ 0 ];
- v |= ( ( posh_u16_t ) p[ 1 ] ) << 8;
-
- return v;
-}
-
-/**
- * Reads a signed 16-bit value from a little-endian buffer
- @ingroup MemoryBuffer
- @param src [in] source buffer
- @returns host-endian signed 16-bit value
-*/
-posh_i16_t
-POSH_ReadI16FromLittle( const void *src )
-{
- return ( posh_i16_t ) POSH_ReadU16FromLittle( src );
-}
-
-/**
- * Reads an unsigned 32-bit value from a little-endian buffer
- @ingroup MemoryBuffer
- @param src [in] source buffer
- @returns host-endian unsigned 32-bit value
-*/
-posh_u32_t
-POSH_ReadU32FromLittle( const void *src )
-{
- posh_u32_t v = 0;
- posh_byte_t *p = ( posh_byte_t * ) src;
-
- v |= p[ 0 ];
- v |= ( ( posh_u32_t ) p[ 1 ] ) << 8;
- v |= ( ( posh_u32_t ) p[ 2 ] ) << 16;
- v |= ( ( posh_u32_t ) p[ 3 ] ) << 24;
-
- return v;
-}
-
-/**
- * Reads a signed 32-bit value from a little-endian buffer
- @ingroup MemoryBuffer
- @param src [in] source buffer
- @returns host-endian signed 32-bit value
-*/
-posh_i32_t
-POSH_ReadI32FromLittle( const void *src )
-{
- return ( posh_i32_t ) POSH_ReadU32FromLittle( src );
-}
-
-
-/**
- * Reads an unsigned 16-bit value from a big-endian buffer
- @ingroup MemoryBuffer
- @param src [in] source buffer
- @returns host-endian unsigned 16-bit value
-*/
-posh_u16_t
-POSH_ReadU16FromBig( const void *src )
-{
- posh_u16_t v = 0;
- posh_byte_t *p = ( posh_byte_t * ) src;
-
- v |= p[ 1 ];
- v |= ( ( posh_u16_t ) p[ 0 ] ) << 8;
-
- return v;
-}
-
-/**
- * Reads a signed 16-bit value from a big-endian buffer
- @ingroup MemoryBuffer
- @param src [in] source buffer
- @returns host-endian signed 16-bit value
-*/
-posh_i16_t
-POSH_ReadI16FromBig( const void *src )
-{
- return ( posh_i16_t ) POSH_ReadU16FromBig( src );
-}
-
-/**
- * Reads an unsigned 32-bit value from a big-endian buffer
- @ingroup MemoryBuffer
- @param src [in] source buffer
- @returns host-endian unsigned 32-bit value
-*/
-posh_u32_t
-POSH_ReadU32FromBig( const void *src )
-{
- posh_u32_t v = 0;
- posh_byte_t *p = ( posh_byte_t * ) src;
-
- v |= p[ 3 ];
- v |= ( ( posh_u32_t ) p[ 2 ] ) << 8;
- v |= ( ( posh_u32_t ) p[ 1 ] ) << 16;
- v |= ( ( posh_u32_t ) p[ 0 ] ) << 24;
-
- return v;
-}
-
-/**
- * Reads a signed 32-bit value from a big-endian buffer
- @ingroup MemoryBuffer
- @param src [in] source buffer
- @returns host-endian signed 32-bit value
-*/
-posh_i32_t
-POSH_ReadI32FromBig( const void *src )
-{
- return POSH_BigI32( (*(const posh_i32_t*)src ) );
-}
-
-#if defined POSH_64BIT_INTEGER
-
-/**
- * Reads an unsigned 64-bit value from a little-endian buffer
- @param src [in] source buffer
- @returns host-endian unsigned 32-bit value
-*/
-posh_u64_t
-POSH_ReadU64FromLittle( const void *src )
-{
- posh_u64_t v = 0;
- posh_byte_t *p = ( posh_byte_t * ) src;
- int i;
-
- for ( i = 0; i < 8; i++ )
- {
- v |= ( ( posh_u64_t ) p[ i ] ) << (i*8);
- }
-
- return v;
-}
-
-/**
- * Reads a signed 64-bit value from a little-endian buffer
- @param src [in] source buffer
- @returns host-endian signed 32-bit value
-*/
-posh_i64_t
-POSH_ReadI64FromLittle( const void *src )
-{
- return ( posh_i64_t ) POSH_ReadU64FromLittle( src );
-}
-
-/**
- * Reads an unsigned 64-bit value from a big-endian buffer
- @param src [in] source buffer
- @returns host-endian unsigned 32-bit value
-*/
-posh_u64_t
-POSH_ReadU64FromBig( const void *src )
-{
- posh_u64_t v = 0;
- posh_byte_t *p = ( posh_byte_t * ) src;
- int i;
-
- for ( i = 0; i < 8; i++ )
- {
- v |= ( ( posh_u64_t ) p[ 7-i ] ) << (i*8);
- }
-
- return v;
-}
-
-/**
- * Reads an signed 64-bit value from a big-endian buffer
- @param src [in] source buffer
- @returns host-endian signed 32-bit value
-*/
-posh_i64_t
-POSH_ReadI64FromBig( const void *src )
-{
- return ( posh_i64_t ) POSH_ReadU64FromBig( src );
-}
-
-#endif /* POSH_64BIT_INTEGER */
-
-/* ---------------------------------------------------------------------------*/
-/* FLOATING POINT SUPPORT */
-/* ---------------------------------------------------------------------------*/
-
-#if !defined POSH_NO_FLOAT
-
-/** @ingroup FloatingPoint
- @param[in] f floating point value
- @returns a little-endian bit representation of f
- */
-posh_u32_t
-POSH_LittleFloatBits( float f )
-{
- union
- {
- float f32;
- posh_u32_t u32;
- } u;
-
- u.f32 = f;
-
- return POSH_LittleU32( u.u32 );
-}
-
-/**
- * Extracts raw big-endian bits from a 32-bit floating point value
- *
- @ingroup FloatingPoint
- @param f [in] floating point value
- @returns a big-endian bit representation of f
- */
-posh_u32_t
-POSH_BigFloatBits( float f )
-{
- union
- {
- float f32;
- posh_u32_t u32;
- } u;
-
- u.f32 = f;
-
- return POSH_BigU32( u.u32 );
-}
-
-/**
- * Extracts raw, little-endian bit representation from a 64-bit double.
- *
- @param d [in] 64-bit double precision value
- @param dst [out] 8-byte storage buffer
- @ingroup FloatingPoint
- @returns the raw bits used to represent the value 'd', in the form dst[0]=LSB
- */
-void
-POSH_DoubleBits( double d, posh_byte_t dst[ 8 ] )
-{
- union
- {
- double d64;
- posh_byte_t bytes[ 8 ];
- } u;
-
- u.d64 = d;
-
-#if defined POSH_LITTLE_ENDIAN
- dst[ 0 ] = u.bytes[ 0 ];
- dst[ 1 ] = u.bytes[ 1 ];
- dst[ 2 ] = u.bytes[ 2 ];
- dst[ 3 ] = u.bytes[ 3 ];
- dst[ 4 ] = u.bytes[ 4 ];
- dst[ 5 ] = u.bytes[ 5 ];
- dst[ 6 ] = u.bytes[ 6 ];
- dst[ 7 ] = u.bytes[ 7 ];
-#else
- dst[ 0 ] = u.bytes[ 7 ];
- dst[ 1 ] = u.bytes[ 6 ];
- dst[ 2 ] = u.bytes[ 5 ];
- dst[ 3 ] = u.bytes[ 4 ];
- dst[ 4 ] = u.bytes[ 3 ];
- dst[ 5 ] = u.bytes[ 2 ];
- dst[ 6 ] = u.bytes[ 1 ];
- dst[ 7 ] = u.bytes[ 0 ];
-#endif
-}
-
-/**
- * Creates a double-precision, 64-bit floating point value from a set of raw,
- * little-endian bits
-
- @ingroup FloatingPoint
- @param src [in] little-endian byte representation of 64-bit double precision
- floating point value
- @returns double precision floating point representation of the raw bits
- @remarks No error checking is performed, so there are no guarantees that the
- result is a valid number, nor is there any check to ensure that src is
- non-NULL. BE CAREFUL USING THIS.
- */
-double
-POSH_DoubleFromBits( const posh_byte_t src[ 8 ] )
-{
- union
- {
- double d64;
- posh_byte_t bytes[ 8 ];
- } u;
-
-#if defined POSH_LITTLE_ENDIAN
- u.bytes[ 0 ] = src[ 0 ];
- u.bytes[ 1 ] = src[ 1 ];
- u.bytes[ 2 ] = src[ 2 ];
- u.bytes[ 3 ] = src[ 3 ];
- u.bytes[ 4 ] = src[ 4 ];
- u.bytes[ 5 ] = src[ 5 ];
- u.bytes[ 6 ] = src[ 6 ];
- u.bytes[ 7 ] = src[ 7 ];
-#else
- u.bytes[ 0 ] = src[ 7 ];
- u.bytes[ 1 ] = src[ 6 ];
- u.bytes[ 2 ] = src[ 5 ];
- u.bytes[ 3 ] = src[ 4 ];
- u.bytes[ 4 ] = src[ 3 ];
- u.bytes[ 5 ] = src[ 2 ];
- u.bytes[ 6 ] = src[ 1 ];
- u.bytes[ 7 ] = src[ 0 ];
-#endif
-
- return u.d64;
-}
-
-/**
- * Creates a floating point number from little endian bits
- *
- @ingroup FloatingPoint
- @param bits [in] raw floating point bits in little-endian form
- @returns a floating point number based on the given bit representation
- @remarks No error checking is performed, so there are no guarantees that the
- result is a valid number. BE CAREFUL USING THIS.
- */
-float
-POSH_FloatFromLittleBits( posh_u32_t bits )
-{
- union
- {
- float f32;
- posh_u32_t u32;
- } u;
-
- u.u32 = bits;
-#if defined POSH_BIG_ENDIAN
- u.u32 = POSH_SwapU32( u.u32 );
-#endif
-
- return u.f32;
-}
-
-/**
- * Creates a floating point number from big-endian bits
- *
- @ingroup FloatingPoint
- @param bits [in] raw floating point bits in big-endian form
- @returns a floating point number based on the given bit representation
- @remarks No error checking is performed, so there are no guarantees that the
- result is a valid number. BE CAREFUL USING THIS.
- */
-float
-POSH_FloatFromBigBits( posh_u32_t bits )
-{
- union
- {
- float f32;
- posh_u32_t u32;
- } u;
-
- u.u32 = bits;
-#if defined POSH_LITTLE_ENDIAN
- u.u32 = POSH_SwapU32( u.u32 );
-#endif
-
- return u.f32;
-}
-
-#endif /* !defined POSH_NO_FLOAT */
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/poshlib/posh.h b/Libraries/nvidia-texture-tools-read-only/src/nvcore/poshlib/posh.h
deleted file mode 100644
index 3a7c3819..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/poshlib/posh.h
+++ /dev/null
@@ -1,1007 +0,0 @@
-/**
-@file posh.h
-@author Brian Hook
-@version 1.3.001
-
-Header file for POSH, the Portable Open Source Harness project.
-
-NOTE: Unlike most header files, this one is designed to be included
-multiple times, which is why it does not have the @#ifndef/@#define
-preamble.
-
-POSH relies on environment specified preprocessor symbols in order
-to infer as much as possible about the target OS/architecture and
-the host compiler capabilities.
-
-NOTE: POSH is simple and focused. It attempts to provide basic
-functionality and information, but it does NOT attempt to emulate
-missing functionality. I am also not willing to make POSH dirty
-and hackish to support truly ancient and/or outmoded and/or bizarre
-technologies such as non-ANSI compilers, systems with non-IEEE
-floating point formats, segmented 16-bit operating systems, etc.
-
-Please refer to the accompanying HTML documentation or visit
-http://www.poshlib.org for more information on how to use POSH.
-
-LICENSE:
-
-Copyright (c) 2004, Brian Hook
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- * The names of this package'ss contributors contributors may not
- be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-REVISION:
-
-I've been lax about revision histories, so this starts at, um, 1.3.001.
-Sorry for any inconveniences.
-
-1.3.001 - 2/23/2006 - Incorporated fix for bug reported by Bill Cary,
- where I was not detecting Visual Studio
- compilation on x86-64 systems. Added check for
- _M_X64 which should fix that.
-
-*/
-/*
-I have yet to find an authoritative reference on preprocessor
-symbols, but so far this is what I've gleaned:
-
-GNU GCC/G++:
- - __GNUC__: GNU C version
- - __GNUG__: GNU C++ compiler
- - __sun__ : on Sun platforms
- - __svr4__: on Solaris and other SysV R4 platforms
- - __mips__: on MIPS processor platforms
- - __sparc_v9__: on Sparc 64-bit CPUs
- - __sparcv9: 64-bit Solaris
- - __MIPSEL__: mips processor, compiled for little endian
- - __MIPSEB__: mips processor, compiled for big endian
- - _R5900: MIPS/Sony/Toshiba R5900 (PS2)
- - mc68000: 68K
- - m68000: 68K
- - m68k: 68K
- - __palmos__: PalmOS
-
-Intel C/C++ Compiler:
- - __ECC : compiler version, IA64 only
- - __EDG__
- - __ELF__
- - __GXX_ABI_VERSION
- - __i386 : IA-32 only
- - __i386__ : IA-32 only
- - i386 : IA-32 only
- - __ia64 : IA-64 only
- - __ia64__ : IA-64 only
- - ia64 : IA-64 only
- - __ICC : IA-32 only
- - __INTEL_COMPILER : IA-32 or IA-64, newer versions only
-
-Apple's C/C++ Compiler for OS X:
- - __APPLE_CC__
- - __APPLE__
- - __BIG_ENDIAN__
- - __APPLE__
- - __ppc__
- - __MACH__
-
-DJGPP:
- - __MSDOS__
- - __unix__
- - __unix
- - __GNUC__
- - __GO32
- - DJGPP
- - __i386, __i386, i386
-
-Cray's C compiler:
- - _ADDR64: if 64-bit pointers
- - _UNICOS:
- - __unix:
-
-SGI's CC compiler predefines the following (and more) with -ansi:
- - __sgi
- - __unix
- - __host_mips
- - _SYSTYPE_SVR4
- - __mips
- - _MIPSEB
- - anyone know if there is a predefined symbol for the compiler?!
-
-MinGW:
- - as GnuC but also defines _WIN32, __WIN32, WIN32, _X86_, __i386, __i386__, and several others
- - __MINGW32__
-
-Cygwin:
- - as Gnu C, but also
- - __unix__
- - __CYGWIN32__
-
-Microsoft Visual Studio predefines the following:
- - _MSC_VER
- - _WIN32: on Win32
- - _M_IX6 (on x86 systems)
- - _M_X64: on x86-64 systems
- - _M_ALPHA (on DEC AXP systems)
- - _SH3: WinCE, Hitachi SH-3
- - _MIPS: WinCE, MIPS
- - _ARM: WinCE, ARM
-
-Sun's C Compiler:
- - sun and _sun
- - unix and _unix
- - sparc and _sparc (SPARC systems only)
- - i386 and _i386 (x86 systems only)
- - __SVR4 (Solaris only)
- - __sparcv9: 64-bit solaris
- - __SUNPRO_C
- - _LP64: defined in 64-bit LP64 mode, but only if <sys/types.h> is included
-
-Borland C/C++ predefines the following:
- - __BORLANDC__:
-
-DEC/Compaq C/C++ on Alpha:
- - __alpha
- - __arch64__
- - __unix__ (on Tru64 Unix)
- - __osf__
- - __DECC
- - __DECCXX (C++ compilation)
- - __DECC_VER
- - __DECCXX_VER
-
-IBM's AIX compiler:
- - __64BIT__ if 64-bit mode
- - _AIX
- - __IBMC__: C compiler version
- - __IBMCPP__: C++ compiler version
- - _LONG_LONG: compiler allows long long
-
-Watcom:
- - __WATCOMC__
- - __DOS__ : if targeting DOS
- - __386__ : if 32-bit support
- - __WIN32__ : if targetin 32-bit Windows
-
-HP-UX C/C++ Compiler:
- - __hpux
- - __unix
- - __hppa (on PA-RISC)
- - __LP64__: if compiled in 64-bit mode
-
-Metrowerks:
- - __MWERKS__
- - __powerpc__
- - _powerc
- - __MC68K__
- - macintosh when compiling for MacOS
- - __INTEL__ for x86 targets
- - __POWERPC__
-
-*/
-
-/*
-** ----------------------------------------------------------------------------
-** Include <limits.h> optionally
-** ----------------------------------------------------------------------------
-*/
-#ifdef POSH_USE_LIMITS_H
-# include <limits.h>
-#endif
-
-/*
-** ----------------------------------------------------------------------------
-** Determine compilation environment
-** ----------------------------------------------------------------------------
-*/
-#if defined __ECC || defined __ICC || defined __INTEL_COMPILER
-# define POSH_COMPILER_STRING "Intel C/C++"
-# define POSH_COMPILER_INTEL 1
-#endif
-
-#if ( defined __host_mips || defined __sgi ) && !defined __GNUC__
-# define POSH_COMPILER_STRING "MIPSpro C/C++"
-# define POSH_COMPILER_MIPSPRO 1
-#endif
-
-#if defined __hpux && !defined __GNUC__
-# define POSH_COMPILER_STRING "HP-UX CC"
-# define POSH_COMPILER_HPCC 1
-#endif
-
-#if defined __GNUC__
-# define POSH_COMPILER_STRING "Gnu GCC"
-# define POSH_COMPILER_GCC 1
-#endif
-
-#if defined __APPLE_CC__
- /* we don't define the compiler string here, let it be GNU */
-# define POSH_COMPILER_APPLECC 1
-#endif
-
-#if defined __IBMC__ || defined __IBMCPP__
-# define POSH_COMPILER_STRING "IBM C/C++"
-# define POSH_COMPILER_IBM 1
-#endif
-
-#if defined _MSC_VER
-# define POSH_COMPILER_STRING "Microsoft Visual C++"
-# define POSH_COMPILER_MSVC 1
-#endif
-
-#if defined __SUNPRO_C
-# define POSH_COMPILER_STRING "Sun Pro"
-# define POSH_COMPILER_SUN 1
-#endif
-
-#if defined __BORLANDC__
-# define POSH_COMPILER_STRING "Borland C/C++"
-# define POSH_COMPILER_BORLAND 1
-#endif
-
-#if defined __MWERKS__
-# define POSH_COMPILER_STRING "MetroWerks CodeWarrior"
-# define POSH_COMPILER_METROWERKS 1
-#endif
-
-#if defined __DECC || defined __DECCXX
-# define POSH_COMPILER_STRING "Compaq/DEC C/C++"
-# define POSH_COMPILER_DEC 1
-#endif
-
-#if defined __WATCOMC__
-# define POSH_COMPILER_STRING "Watcom C/C++"
-# define POSH_COMPILER_WATCOM 1
-#endif
-
-#if !defined POSH_COMPILER_STRING
-# define POSH_COMPILER_STRING "Unknown compiler"
-#endif
-
-/*
-** ----------------------------------------------------------------------------
-** Determine target operating system
-** ----------------------------------------------------------------------------
-*/
-#if defined linux || defined __linux__
-# define POSH_OS_LINUX 1
-# define POSH_OS_STRING "Linux"
-#endif
-
-#if defined __CYGWIN32__
-# define POSH_OS_CYGWIN32 1
-# define POSH_OS_STRING "Cygwin"
-#endif
-
-#if defined GEKKO
-# define POSH_OS_GAMECUBE
-# define __powerpc__
-# define POSH_OS_STRING "GameCube"
-#endif
-
-#if defined __MINGW32__
-# define POSH_OS_MINGW 1
-# define POSH_OS_STRING "MinGW"
-#endif
-
-#if defined GO32 && defined DJGPP && defined __MSDOS__
-# define POSH_OS_GO32 1
-# define POSH_OS_STRING "GO32/MS-DOS"
-#endif
-
-/* NOTE: make sure you use /bt=DOS if compiling for 32-bit DOS,
- otherwise Watcom assumes host=target */
-#if defined __WATCOMC__ && defined __386__ && defined __DOS__
-# define POSH_OS_DOS32 1
-# define POSH_OS_STRING "DOS/32-bit"
-#endif
-
-#if defined _UNICOS
-# define POSH_OS_UNICOS 1
-# define POSH_OS_STRING "UNICOS"
-#endif
-
-#if ( defined __MWERKS__ && defined __powerc && !defined macintosh ) || defined __APPLE_CC__ || defined macosx
-# define POSH_OS_OSX 1
-# define POSH_OS_STRING "MacOS X"
-#endif
-
-#if defined __sun__ || defined sun || defined __sun || defined __solaris__
-# if defined __SVR4 || defined __svr4__ || defined __solaris__
-# define POSH_OS_STRING "Solaris"
-# define POSH_OS_SOLARIS 1
-# endif
-# if !defined POSH_OS_STRING
-# define POSH_OS_STRING "SunOS"
-# define POSH_OS_SUNOS 1
-# endif
-#endif
-
-#if defined __sgi__ || defined sgi || defined __sgi
-# define POSH_OS_IRIX 1
-# define POSH_OS_STRING "Irix"
-#endif
-
-#if defined __hpux__ || defined __hpux
-# define POSH_OS_HPUX 1
-# define POSH_OS_STRING "HP-UX"
-#endif
-
-#if defined _AIX
-# define POSH_OS_AIX 1
-# define POSH_OS_STRING "AIX"
-#endif
-
-#if ( defined __alpha && defined __osf__ )
-# define POSH_OS_TRU64 1
-# define POSH_OS_STRING "Tru64"
-#endif
-
-#if defined __BEOS__ || defined __beos__
-# define POSH_OS_BEOS 1
-# define POSH_OS_STRING "BeOS"
-#endif
-
-#if defined amiga || defined amigados || defined AMIGA || defined _AMIGA
-# define POSH_OS_AMIGA 1
-# define POSH_OS_STRING "Amiga"
-#endif
-
-#if defined __unix__
-# define POSH_OS_UNIX 1
-# if !defined POSH_OS_STRING
-# define POSH_OS_STRING "Unix-like(generic)"
-# endif
-#endif
-
-#if defined _WIN32_WCE
-# define POSH_OS_WINCE 1
-# define POSH_OS_STRING "Windows CE"
-#endif
-
-#if defined _XBOX
-# define POSH_OS_XBOX 1
-# define POSH_OS_STRING "XBOX"
-#endif
-
-#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__
-# define POSH_OS_WIN32 1
-# if !defined POSH_OS_XBOX
-# if defined _WIN64
-# define POSH_OS_WIN64 1
-# define POSH_OS_STRING "Win64"
-# else
-# if !defined POSH_OS_STRING
-# define POSH_OS_STRING "Win32"
-# endif
-# endif
-# endif
-#endif
-
-#if defined __palmos__
-# define POSH_OS_PALM 1
-# define POSH_OS_STRING "PalmOS"
-#endif
-
-#if defined THINK_C || defined macintosh
-# define POSH_OS_MACOS 1
-# define POSH_OS_STRING "MacOS"
-#endif
-
-/*
-** -----------------------------------------------------------------------------
-** Determine target CPU
-** -----------------------------------------------------------------------------
-*/
-
-#if defined GEKKO
-# define POSH_CPU_PPC750 1
-# define POSH_CPU_STRING "IBM PowerPC 750 (NGC)"
-#endif
-
-#if defined mc68000 || defined m68k || defined __MC68K__ || defined m68000
-# define POSH_CPU_68K 1
-# define POSH_CPU_STRING "MC68000"
-#endif
-
-#if defined __PPC__ || defined __POWERPC__ || defined powerpc || defined _POWER || defined __ppc__ || defined __powerpc__
-# define POSH_CPU_PPC 1
-# if !defined POSH_CPU_STRING
-# if defined __powerpc64__
-# define POSH_CPU_STRING "PowerPC64"
-# else
-# define POSH_CPU_STRING "PowerPC"
-# endif
-# endif
-#endif
-
-#if defined _CRAYT3E || defined _CRAYMPP
-# define POSH_CPU_CRAYT3E 1 /* target processor is a DEC Alpha 21164 used in a Cray T3E*/
-# define POSH_CPU_STRING "Cray T3E (Alpha 21164)"
-#endif
-
-#if defined CRAY || defined _CRAY && !defined _CRAYT3E
-# error Non-AXP Cray systems not supported
-#endif
-
-#if defined _SH3
-# define POSH_CPU_SH3 1
-# define POSH_CPU_STRING "Hitachi SH-3"
-#endif
-
-#if defined __sh4__ || defined __SH4__
-# define POSH_CPU_SH3 1
-# define POSH_CPU_SH4 1
-# define POSH_CPU_STRING "Hitachi SH-4"
-#endif
-
-#if defined __sparc__ || defined __sparc
-# if defined __arch64__ || defined __sparcv9 || defined __sparc_v9__
-# define POSH_CPU_SPARC64 1
-# define POSH_CPU_STRING "Sparc/64"
-# else
-# define POSH_CPU_STRING "Sparc/32"
-# endif
-# define POSH_CPU_SPARC 1
-#endif
-
-#if defined ARM || defined __arm__ || defined _ARM
-# define POSH_CPU_STRONGARM 1
-# define POSH_CPU_STRING "ARM"
-#endif
-
-#if defined mips || defined __mips__ || defined __MIPS__ || defined _MIPS
-# define POSH_CPU_MIPS 1
-# if defined _R5900
-# define POSH_CPU_STRING "MIPS R5900 (PS2)"
-# else
-# define POSH_CPU_STRING "MIPS"
-# endif
-#endif
-
-#if defined __ia64 || defined _M_IA64 || defined __ia64__
-# define POSH_CPU_IA64 1
-# define POSH_CPU_STRING "IA64"
-#endif
-
-#if defined __X86__ || defined __i386__ || defined i386 || defined _M_IX86 || defined __386__ || defined __x86_64__ || defined _M_X64
-# define POSH_CPU_X86 1
-# if defined __x86_64__ || defined _M_X64
-# define POSH_CPU_X86_64 1
-# endif
-# if defined POSH_CPU_X86_64
-# define POSH_CPU_STRING "AMD x86-64"
-# else
-# define POSH_CPU_STRING "Intel 386+"
-# endif
-#endif
-
-#if defined __alpha || defined alpha || defined _M_ALPHA || defined __alpha__
-# define POSH_CPU_AXP 1
-# define POSH_CPU_STRING "AXP"
-#endif
-
-#if defined __hppa || defined hppa
-# define POSH_CPU_HPPA 1
-# define POSH_CPU_STRING "PA-RISC"
-#endif
-
-#if !defined POSH_CPU_STRING
-# error POSH cannot determine target CPU
-# define POSH_CPU_STRING "Unknown" /* this is here for Doxygen's benefit */
-#endif
-
-/*
-** -----------------------------------------------------------------------------
-** Attempt to autodetect building for embedded on Sony PS2
-** -----------------------------------------------------------------------------
-*/
-#if !defined POSH_OS_STRING
-# if !defined FORCE_DOXYGEN
-# define POSH_OS_EMBEDDED 1
-# endif
-# if defined _R5900
-# define POSH_OS_STRING "Sony PS2(embedded)"
-# else
-# define POSH_OS_STRING "Embedded/Unknown"
-# endif
-#endif
-
-/*
-** ---------------------------------------------------------------------------
-** Handle cdecl, stdcall, fastcall, etc.
-** ---------------------------------------------------------------------------
-*/
-#if defined POSH_CPU_X86 && !defined POSH_CPU_X86_64
-# if defined __GNUC__
-# define POSH_CDECL __attribute__((cdecl))
-# define POSH_STDCALL __attribute__((stdcall))
-# define POSH_FASTCALL __attribute__((fastcall))
-# elif ( defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ || defined __MWERKS__ )
-# define POSH_CDECL __cdecl
-# define POSH_STDCALL __stdcall
-# define POSH_FASTCALL __fastcall
-# endif
-#else
-# define POSH_CDECL
-# define POSH_STDCALL
-# define POSH_FASTCALL
-#endif
-
-/*
-** ---------------------------------------------------------------------------
-** Define POSH_IMPORTEXPORT signature based on POSH_DLL and POSH_BUILDING_LIB
-** ---------------------------------------------------------------------------
-*/
-
-/*
-** We undefine this so that multiple inclusions will work
-*/
-#if defined POSH_IMPORTEXPORT
-# undef POSH_IMPORTEXPORT
-#endif
-
-#if defined POSH_DLL
-# if defined POSH_OS_WIN32
-# if defined _MSC_VER
-# if ( _MSC_VER >= 800 )
-# if defined POSH_BUILDING_LIB
-# define POSH_IMPORTEXPORT __declspec( dllexport )
-# else
-# define POSH_IMPORTEXPORT __declspec( dllimport )
-# endif
-# else
-# if defined POSH_BUILDING_LIB
-# define POSH_IMPORTEXPORT __export
-# else
-# define POSH_IMPORTEXPORT
-# endif
-# endif
-# endif /* defined _MSC_VER */
-# if defined __BORLANDC__
-# if ( __BORLANDC__ >= 0x500 )
-# if defined POSH_BUILDING_LIB
-# define POSH_IMPORTEXPORT __declspec( dllexport )
-# else
-# define POSH_IMPORTEXPORT __declspec( dllimport )
-# endif
-# else
-# if defined POSH_BUILDING_LIB
-# define POSH_IMPORTEXPORT __export
-# else
-# define POSH_IMPORTEXPORT
-# endif
-# endif
-# endif /* defined __BORLANDC__ */
- /* for all other compilers, we're just making a blanket assumption */
-# if defined __GNUC__ || defined __WATCOMC__ || defined __MWERKS__
-# if defined POSH_BUILDING_LIB
-# define POSH_IMPORTEXPORT __declspec( dllexport )
-# else
-# define POSH_IMPORTEXPORT __declspec( dllimport )
-# endif
-# endif /* all other compilers */
-# if !defined POSH_IMPORTEXPORT
-# error Building DLLs not supported on this compiler (poshlib@poshlib.org if you know how)
-# endif
-# endif /* defined POSH_OS_WIN32 */
-#endif
-
-/* On pretty much everything else, we can thankfully just ignore this */
-#if !defined POSH_IMPORTEXPORT
-# define POSH_IMPORTEXPORT
-#endif
-
-#if defined FORCE_DOXYGEN
-# define POSH_DLL
-# define POSH_BUILDING_LIB
-# undef POSH_DLL
-# undef POSH_BUILDING_LIB
-#endif
-
-/*
-** ----------------------------------------------------------------------------
-** (Re)define POSH_PUBLIC_API export signature
-** ----------------------------------------------------------------------------
-*/
-#ifdef POSH_PUBLIC_API
-# undef POSH_PUBLIC_API
-#endif
-
-#if ( ( defined _MSC_VER ) && ( _MSC_VER < 800 ) ) || ( defined __BORLANDC__ && ( __BORLANDC__ < 0x500 ) )
-# define POSH_PUBLIC_API(rtype) extern rtype POSH_IMPORTEXPORT
-#else
-# define POSH_PUBLIC_API(rtype) extern POSH_IMPORTEXPORT rtype
-#endif
-
-/*
-** ----------------------------------------------------------------------------
-** Try to infer endianess. Basically we just go through the CPUs we know are
-** little endian, and assume anything that isn't one of those is big endian.
-** As a sanity check, we also do this with operating systems we know are
-** little endian, such as Windows. Some processors are bi-endian, such as
-** the MIPS series, so we have to be careful about those.
-** ----------------------------------------------------------------------------
-*/
-#if defined POSH_CPU_X86 || defined POSH_CPU_AXP || defined POSH_CPU_STRONGARM || defined POSH_OS_WIN32 || defined POSH_OS_WINCE || defined __MIPSEL__
-# define POSH_ENDIAN_STRING "little"
-# define POSH_LITTLE_ENDIAN 1
-#else
-# define POSH_ENDIAN_STRING "big"
-# define POSH_BIG_ENDIAN 1
-#endif
-
-#if defined FORCE_DOXYGEN
-# define POSH_LITTLE_ENDIAN
-#endif
-
-/*
-** ----------------------------------------------------------------------------
-** Cross-platform compile time assertion macro
-** ----------------------------------------------------------------------------
-*/
-#define POSH_COMPILE_TIME_ASSERT(name, x) typedef int _POSH_dummy_ ## name[(x) ? 1 : -1 ]
-
-/*
-** ----------------------------------------------------------------------------
-** 64-bit Integer
-**
-** We don't require 64-bit support, nor do we emulate its functionality, we
-** simply export it if it's available. Since we can't count on <limits.h>
-** for 64-bit support, we ignore the POSH_USE_LIMITS_H directive.
-** ----------------------------------------------------------------------------
-*/
-#if defined ( __LP64__ ) || defined ( __powerpc64__ ) || defined POSH_CPU_SPARC64
-# define POSH_64BIT_INTEGER 1
-typedef long posh_i64_t;
-typedef unsigned long posh_u64_t;
-# define POSH_I64( x ) ((posh_i64_t)x)
-# define POSH_U64( x ) ((posh_u64_t)x)
-# define POSH_I64_PRINTF_PREFIX "l"
-#elif defined _MSC_VER || defined __BORLANDC__ || defined __WATCOMC__ || ( defined __alpha && defined __DECC )
-# define POSH_64BIT_INTEGER 1
-typedef __int64 posh_i64_t;
-typedef unsigned __int64 posh_u64_t;
-# define POSH_I64( x ) ((posh_i64_t)x)
-# define POSH_U64( x ) ((posh_u64_t)x)
-# define POSH_I64_PRINTF_PREFIX "I64"
-#elif defined __GNUC__ || defined __MWERKS__ || defined __SUNPRO_C || defined __SUNPRO_CC || defined __APPLE_CC__ || defined POSH_OS_IRIX || defined _LONG_LONG || defined _CRAYC
-# define POSH_64BIT_INTEGER 1
-typedef long long posh_i64_t;
-typedef unsigned long long posh_u64_t;
-# define POSH_U64( x ) ((posh_u64_t)(x##LL))
-# define POSH_I64( x ) ((posh_i64_t)(x##LL))
-# define POSH_I64_PRINTF_PREFIX "ll"
-#endif
-
-/* hack */
-/*#ifdef __MINGW32__
-#undef POSH_I64
-#undef POSH_U64
-#undef POSH_I64_PRINTF_PREFIX
-#define POSH_I64( x ) ((posh_i64_t)x)
-#define POSH_U64( x ) ((posh_u64_t)x)
-#define POSH_I64_PRINTF_PREFIX "I64"
-#endif*/
-
-#ifdef FORCE_DOXYGEN
-typedef long long posh_i64_t;
-typedef unsigned long posh_u64_t;
-# define POSH_64BIT_INTEGER
-# define POSH_I64_PRINTF_PREFIX
-# define POSH_I64(x)
-# define POSH_U64(x)
-#endif
-
-/** Minimum value for a 64-bit signed integer */
-#define POSH_I64_MIN POSH_I64(0x8000000000000000)
-/** Maximum value for a 64-bit signed integer */
-#define POSH_I64_MAX POSH_I64(0x7FFFFFFFFFFFFFFF)
-/** Minimum value for a 64-bit unsigned integer */
-#define POSH_U64_MIN POSH_U64(0)
-/** Maximum value for a 64-bit unsigned integer */
-#define POSH_U64_MAX POSH_U64(0xFFFFFFFFFFFFFFFF)
-
-/* ----------------------------------------------------------------------------
-** Basic Sized Types
-**
-** These types are expected to be EXACTLY sized so you can use them for
-** serialization.
-** ----------------------------------------------------------------------------
-*/
-#define POSH_FALSE 0
-#define POSH_TRUE 1
-
-typedef int posh_bool_t;
-typedef unsigned char posh_byte_t;
-
-/* NOTE: These assume that CHAR_BIT is 8!! */
-typedef unsigned char posh_u8_t;
-typedef signed char posh_i8_t;
-
-#if defined POSH_USE_LIMITS_H
-# if CHAR_BITS > 8
-# error This machine uses 9-bit characters. This is a warning, you can comment this out now.
-# endif /* CHAR_BITS > 8 */
-
-/* 16-bit */
-# if ( USHRT_MAX == 65535 )
- typedef unsigned short posh_u16_t;
- typedef short posh_i16_t;
-# else
- /* Yes, in theory there could still be a 16-bit character type and shorts are
- 32-bits in size...if you find such an architecture, let me know =P */
-# error No 16-bit type found
-# endif
-
-/* 32-bit */
-# if ( INT_MAX == 2147483647 )
- typedef unsigned posh_u32_t;
- typedef int posh_i32_t;
-# elif ( LONG_MAX == 2147483647 )
- typedef unsigned long posh_u32_t;
- typedef long posh_i32_t;
-# else
- error No 32-bit type found
-# endif
-
-#else /* POSH_USE_LIMITS_H */
-
- typedef unsigned short posh_u16_t;
- typedef short posh_i16_t;
-
-# if !defined POSH_OS_PALM
- typedef unsigned posh_u32_t;
- typedef int posh_i32_t;
-# else
- typedef unsigned long posh_u32_t;
- typedef long posh_i32_t;
-# endif
-#endif
-
-/** Minimum value for a byte */
-#define POSH_BYTE_MIN 0
-/** Maximum value for an 8-bit unsigned value */
-#define POSH_BYTE_MAX 255
-/** Minimum value for a byte */
-#define POSH_I16_MIN ( ( posh_i16_t ) 0x8000 )
-/** Maximum value for a 16-bit signed value */
-#define POSH_I16_MAX ( ( posh_i16_t ) 0x7FFF )
-/** Minimum value for a 16-bit unsigned value */
-#define POSH_U16_MIN 0
-/** Maximum value for a 16-bit unsigned value */
-#define POSH_U16_MAX ( ( posh_u16_t ) 0xFFFF )
-/** Minimum value for a 32-bit signed value */
-#define POSH_I32_MIN ( ( posh_i32_t ) 0x80000000 )
-/** Maximum value for a 32-bit signed value */
-#define POSH_I32_MAX ( ( posh_i32_t ) 0x7FFFFFFF )
-/** Minimum value for a 32-bit unsigned value */
-#define POSH_U32_MIN 0
-/** Maximum value for a 32-bit unsigned value */
-#define POSH_U32_MAX ( ( posh_u32_t ) 0xFFFFFFFF )
-
-/*
-** ----------------------------------------------------------------------------
-** Sanity checks on expected sizes
-** ----------------------------------------------------------------------------
-*/
-#if !defined FORCE_DOXYGEN
-
-POSH_COMPILE_TIME_ASSERT(posh_byte_t, sizeof(posh_byte_t) == 1);
-POSH_COMPILE_TIME_ASSERT(posh_u8_t, sizeof(posh_u8_t) == 1);
-POSH_COMPILE_TIME_ASSERT(posh_i8_t, sizeof(posh_i8_t) == 1);
-POSH_COMPILE_TIME_ASSERT(posh_u16_t, sizeof(posh_u16_t) == 2);
-POSH_COMPILE_TIME_ASSERT(posh_i16_t, sizeof(posh_i16_t) == 2);
-POSH_COMPILE_TIME_ASSERT(posh_u32_t, sizeof(posh_u32_t) == 4);
-POSH_COMPILE_TIME_ASSERT(posh_i32_t, sizeof(posh_i32_t) == 4);
-
-#if !defined POSH_NO_FLOAT
- POSH_COMPILE_TIME_ASSERT(posh_testfloat_t, sizeof(float)==4 );
- POSH_COMPILE_TIME_ASSERT(posh_testdouble_t, sizeof(double)==8);
-#endif
-
-#if defined POSH_64BIT_INTEGER
- POSH_COMPILE_TIME_ASSERT(posh_u64_t, sizeof(posh_u64_t) == 8);
- POSH_COMPILE_TIME_ASSERT(posh_i64_t, sizeof(posh_i64_t) == 8);
-#endif
-
-#endif
-
-/*
-** ----------------------------------------------------------------------------
-** 64-bit pointer support
-** ----------------------------------------------------------------------------
-*/
-#if defined POSH_CPU_AXP && ( defined POSH_OS_TRU64 || defined POSH_OS_LINUX )
-# define POSH_64BIT_POINTER 1
-#endif
-
-#if defined POSH_CPU_X86_64 && defined POSH_OS_LINUX
-# define POSH_64BIT_POINTER 1
-#endif
-
-#if defined POSH_CPU_SPARC64 || defined POSH_OS_WIN64 || defined __64BIT__ || defined __LP64 || defined _LP64 || defined __LP64__ || defined _ADDR64 || defined _CRAYC
-# define POSH_64BIT_POINTER 1
-#endif
-
-#if defined POSH_64BIT_POINTER
- POSH_COMPILE_TIME_ASSERT( posh_64bit_pointer, sizeof( void * ) == 8 );
-#elif !defined FORCE_DOXYGEN
-/* if this assertion is hit then you're on a system that either has 64-bit
- addressing and we didn't catch it, or you're on a system with 16-bit
- pointers. In the latter case, POSH doesn't actually care, we're just
- triggering this assertion to make sure you're aware of the situation,
- so feel free to delete it.
-
- If this assertion is triggered on a known 32 or 64-bit platform,
- please let us know (poshlib@poshlib.org) */
- POSH_COMPILE_TIME_ASSERT( posh_32bit_pointer, sizeof( void * ) == 4 );
-#endif
-
-#if defined FORCE_DOXYGEN
-# define POSH_64BIT_POINTER
-#endif
-
-/*
-** ----------------------------------------------------------------------------
-** POSH Utility Functions
-**
-** These are optional POSH utility functions that are not required if you don't
-** need anything except static checking of your host and target environment.
-**
-** These functions are NOT wrapped with POSH_PUBLIC_API because I didn't want
-** to enforce their export if your own library is only using them internally.
-** ----------------------------------------------------------------------------
-*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-const char *POSH_GetArchString( void );
-
-#if !defined POSH_NO_FLOAT
-
-posh_u32_t POSH_LittleFloatBits( float f );
-posh_u32_t POSH_BigFloatBits( float f );
-float POSH_FloatFromLittleBits( posh_u32_t bits );
-float POSH_FloatFromBigBits( posh_u32_t bits );
-
-void POSH_DoubleBits( double d, posh_byte_t dst[ 8 ] );
-double POSH_DoubleFromBits( const posh_byte_t src[ 8 ] );
-
-/* unimplemented
-float *POSH_WriteFloatToLittle( void *dst, float f );
-float *POSH_WriteFloatToBig( void *dst, float f );
-float POSH_ReadFloatFromLittle( const void *src );
-float POSH_ReadFloatFromBig( const void *src );
-
-double *POSH_WriteDoubleToLittle( void *dst, double d );
-double *POSH_WriteDoubleToBig( void *dst, double d );
-double POSH_ReadDoubleFromLittle( const void *src );
-double POSH_ReadDoubleFromBig( const void *src );
-*/
-#endif /* !defined POSH_NO_FLOAT */
-
-#if defined FORCE_DOXYGEN
-# define POSH_NO_FLOAT
-# undef POSH_NO_FLOAT
-#endif
-
-extern posh_u16_t POSH_SwapU16( posh_u16_t u );
-extern posh_i16_t POSH_SwapI16( posh_i16_t u );
-extern posh_u32_t POSH_SwapU32( posh_u32_t u );
-extern posh_i32_t POSH_SwapI32( posh_i32_t u );
-
-#if defined POSH_64BIT_INTEGER
-
-extern posh_u64_t POSH_SwapU64( posh_u64_t u );
-extern posh_i64_t POSH_SwapI64( posh_i64_t u );
-
-#endif /*POSH_64BIT_INTEGER */
-
-extern posh_u16_t *POSH_WriteU16ToLittle( void *dst, posh_u16_t value );
-extern posh_i16_t *POSH_WriteI16ToLittle( void *dst, posh_i16_t value );
-extern posh_u32_t *POSH_WriteU32ToLittle( void *dst, posh_u32_t value );
-extern posh_i32_t *POSH_WriteI32ToLittle( void *dst, posh_i32_t value );
-
-extern posh_u16_t *POSH_WriteU16ToBig( void *dst, posh_u16_t value );
-extern posh_i16_t *POSH_WriteI16ToBig( void *dst, posh_i16_t value );
-extern posh_u32_t *POSH_WriteU32ToBig( void *dst, posh_u32_t value );
-extern posh_i32_t *POSH_WriteI32ToBig( void *dst, posh_i32_t value );
-
-extern posh_u16_t POSH_ReadU16FromLittle( const void *src );
-extern posh_i16_t POSH_ReadI16FromLittle( const void *src );
-extern posh_u32_t POSH_ReadU32FromLittle( const void *src );
-extern posh_i32_t POSH_ReadI32FromLittle( const void *src );
-
-extern posh_u16_t POSH_ReadU16FromBig( const void *src );
-extern posh_i16_t POSH_ReadI16FromBig( const void *src );
-extern posh_u32_t POSH_ReadU32FromBig( const void *src );
-extern posh_i32_t POSH_ReadI32FromBig( const void *src );
-
-#if defined POSH_64BIT_INTEGER
-extern posh_u64_t *POSH_WriteU64ToLittle( void *dst, posh_u64_t value );
-extern posh_i64_t *POSH_WriteI64ToLittle( void *dst, posh_i64_t value );
-extern posh_u64_t *POSH_WriteU64ToBig( void *dst, posh_u64_t value );
-extern posh_i64_t *POSH_WriteI64ToBig( void *dst, posh_i64_t value );
-
-extern posh_u64_t POSH_ReadU64FromLittle( const void *src );
-extern posh_i64_t POSH_ReadI64FromLittle( const void *src );
-extern posh_u64_t POSH_ReadU64FromBig( const void *src );
-extern posh_i64_t POSH_ReadI64FromBig( const void *src );
-#endif /* POSH_64BIT_INTEGER */
-
-#if defined POSH_LITTLE_ENDIAN
-
-# define POSH_LittleU16(x) (x)
-# define POSH_LittleU32(x) (x)
-# define POSH_LittleI16(x) (x)
-# define POSH_LittleI32(x) (x)
-# if defined POSH_64BIT_INTEGER
-# define POSH_LittleU64(x) (x)
-# define POSH_LittleI64(x) (x)
-# endif /* defined POSH_64BIT_INTEGER */
-
-# define POSH_BigU16(x) POSH_SwapU16(x)
-# define POSH_BigU32(x) POSH_SwapU32(x)
-# define POSH_BigI16(x) POSH_SwapI16(x)
-# define POSH_BigI32(x) POSH_SwapI32(x)
-# if defined POSH_64BIT_INTEGER
-# define POSH_BigU64(x) POSH_SwapU64(x)
-# define POSH_BigI64(x) POSH_SwapI64(x)
-# endif /* defined POSH_64BIT_INTEGER */
-
-#else
-
-# define POSH_BigU16(x) (x)
-# define POSH_BigU32(x) (x)
-# define POSH_BigI16(x) (x)
-# define POSH_BigI32(x) (x)
-
-# if defined POSH_64BIT_INTEGER
-# define POSH_BigU64(x) (x)
-# define POSH_BigI64(x) (x)
-# endif /* POSH_64BIT_INTEGER */
-
-# define POSH_LittleU16(x) POSH_SwapU16(x)
-# define POSH_LittleU32(x) POSH_SwapU32(x)
-# define POSH_LittleI16(x) POSH_SwapI16(x)
-# define POSH_LittleI32(x) POSH_SwapI32(x)
-
-# if defined POSH_64BIT_INTEGER
-# define POSH_LittleU64(x) POSH_SwapU64(x)
-# define POSH_LittleI64(x) POSH_SwapI64(x)
-# endif /* POSH_64BIT_INTEGER */
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvcore/vsscanf_proxy_win64.masm b/Libraries/nvidia-texture-tools-read-only/src/nvcore/vsscanf_proxy_win64.masm
deleted file mode 100644
index faf7c08b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvcore/vsscanf_proxy_win64.masm
+++ /dev/null
@@ -1,124 +0,0 @@
-; MASM x64 version of
-; vsscanf for Win32
-; originally written 5/2003 by <mgix@mgix.com>
-;
-; This was done because MSVC does not accept inline assembly code
-; for the x64 platform, so this file implements almost the whole
-; module in assembly using the amd64 ABI
-;
-; 06/17/2008 by edgarv [at] nvidia com
-
-; Definition of memcpy
-memcpy PROTO dest:Ptr, src:Ptr, numbytes:QWORD
-
-; Definition of sscanf
-sscanf PROTO buffer:Ptr Byte, format:Ptr Byte, args:VARARG
-
-
-
-; Start a code segment named "_TEXT" by default
-.CODE
-
-; Entry point of our function: at this point we can use
-; named parameters
-ALIGN 16
-PUBLIC vsscanf_proxy_win64
-
-; Because the x64 code uses the fast call convention, only
-; the arguments beyond the 4th one are available from the stack.
-; The first four parameters are in RCX, RDX, R8 and R9
-
-; Parameters:
-; const char* buffer
-; const char* format
-; va_list argPtr
-; size_t count
-vsscanf_proxy_win64 PROC, \
- buffer:PTR Byte, format:PTR Byte, argPtr:PTR, count:QWORD
-
- ; Allocates space for our local variable, savedRDP
- sub rsp, 08h
-
- ; Copies the parameters from the registers to the memory: before warping to
- ; sscanf we will call memcpy, and those registers can just dissapear!
- mov buffer, rcx
- mov format, rdx
- mov argPtr, r8
- mov count, r9
-
-
- ; Allocate extra space in the stack for (2+count)*sizeof(void*),
- ; this is (2+count)*(8)
- mov r10, r9
- add r10, 2 ; count += 2
- sal r10, 3 ; count *= 8
- add r10, 0fh ; To force alignment to 16bytes
- and r10, 0fffffffffffffff0h
- sub rsp, r10 ; Actual stack allocation
-
-
- ; Continues by copying all the arguments in the "alloca" space
- mov [rsp], rcx ; newStack[0] = (void*)buffer;
- mov [rsp + 08h], rdx ; newStack[1] = (void*)format;
-
- ; Calls memcpy(newStack+2, argPtr, count*sizeof(void*));
- mov rcx, rsp
- add rcx, 010h ; newStack+2
- mov rdx, r8 ; argPtr
- mov r8, r9
- sal r8, 3 ; count*sizeof(void*)
-
- ; Prepares extra stack space as required by the ABI for 4 arguments, and calls memcpy
- sub rsp, 020h
- call memcpy
-
- ; Restore the stack
- add rsp, 020h
-
- ; Saves rsp in memory
- mov qword ptr [rbp - 8], rsp
-
- ; Does exactly the same trick as before: warp into system sscanf with the new stack,
- ; but this time we also setup the arguments in the registers according to the amd64 ABI
-
- ; If there was at least one argument (after buffer and format), we need to copy that
- ; to r8, and if there was a second one we must copy that to r9
- ; (the first arguments to sscanf are always the buffer and the format)
- mov r10, count
-
- ; Copy the first argument to r8 (if it exists)
- cmp r10, 0
- je args_memcpy
- mov r8, [rsp + 10h]
-
- ; Copy the second argument to r9 (if it exists)
- cmp r10, 1
- je args_memcpy
- mov r9, [rsp + 18h]
-
-args_memcpy:
-
- ; Copies the buffer and format to rcx and rdx
- mov rdx, [rsp + 08h]
- mov rcx, [rsp]
-
- ; Finally, calls sscanf using the current stack
- call sscanf
-
- ; At this point the return value is alreay in rax
-
- ; Restores rsp
- mov rsp, qword ptr [rbp - 8]
-
- ; Undoes the alloca
- add rsp, r10
-
- ; Restores the space for local variables
- add rsp, 08h
-
- ; Remember, the return value is already in rax since the sscanf call
- ret
-
-vsscanf_proxy_win64 ENDP
-
-END
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/BlockDXT.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/BlockDXT.cpp
deleted file mode 100644
index d7052665..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/BlockDXT.cpp
+++ /dev/null
@@ -1,625 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include "BlockDXT.h"
-
-#include <nvimage/ColorBlock.h>
-
-#include <nvcore/Stream.h>
-#include <nvcore/Containers.h> // swap
-
-
-using namespace nv;
-
-
-/*----------------------------------------------------------------------------
- BlockDXT1
-----------------------------------------------------------------------------*/
-
-uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const
-{
- // Does bit expansion before interpolation.
- color_array[0].b = (col0.b << 3) | (col0.b >> 2);
- color_array[0].g = (col0.g << 2) | (col0.g >> 4);
- color_array[0].r = (col0.r << 3) | (col0.r >> 2);
- color_array[0].a = 0xFF;
-
- // @@ Same as above, but faster?
-// Color32 c;
-// c.u = ((col0.u << 3) & 0xf8) | ((col0.u << 5) & 0xfc00) | ((col0.u << 8) & 0xf80000);
-// c.u |= (c.u >> 5) & 0x070007;
-// c.u |= (c.u >> 6) & 0x000300;
-// color_array[0].u = c.u;
-
- color_array[1].r = (col1.r << 3) | (col1.r >> 2);
- color_array[1].g = (col1.g << 2) | (col1.g >> 4);
- color_array[1].b = (col1.b << 3) | (col1.b >> 2);
- color_array[1].a = 0xFF;
-
- // @@ Same as above, but faster?
-// c.u = ((col1.u << 3) & 0xf8) | ((col1.u << 5) & 0xfc00) | ((col1.u << 8) & 0xf80000);
-// c.u |= (c.u >> 5) & 0x070007;
-// c.u |= (c.u >> 6) & 0x000300;
-// color_array[1].u = c.u;
-
- if( col0.u > col1.u ) {
- // Four-color block: derive the other two colors.
- color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3;
- color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
- color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3;
- color_array[2].a = 0xFF;
-
- color_array[3].r = (2 * color_array[1].r + color_array[0].r) / 3;
- color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3;
- color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3;
- color_array[3].a = 0xFF;
-
- return 4;
- }
- else {
- // Three-color block: derive the other color.
- color_array[2].r = (color_array[0].r + color_array[1].r) / 2;
- color_array[2].g = (color_array[0].g + color_array[1].g) / 2;
- color_array[2].b = (color_array[0].b + color_array[1].b) / 2;
- color_array[2].a = 0xFF;
-
- // Set all components to 0 to match DXT specs.
- color_array[3].r = 0x00; // color_array[2].r;
- color_array[3].g = 0x00; // color_array[2].g;
- color_array[3].b = 0x00; // color_array[2].b;
- color_array[3].a = 0x00;
-
- return 3;
- }
-}
-
-
-uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
-{
- // Does bit expansion before interpolation.
- color_array[0].b = col0.b * 22 / 8;
- color_array[0].g = (col0.g << 2) | (col0.g >> 4);
- color_array[0].r = col0.r * 22 / 8;
- color_array[0].a = 0xFF;
-
- color_array[1].r = col1.r * 22 / 8;
- color_array[1].g = (col1.g << 2) | (col1.g >> 4);
- color_array[1].b = col1.b * 22 / 8;
- color_array[1].a = 0xFF;
-
- if( col0.u > col1.u ) {
- // Four-color block: derive the other two colors.
- color_array[2].r = (2 * col0.r + col1.r) * 22 / 8;
- color_array[2].g = (256 * color_array[0].g + (color_array[1].g - color_array[0].g)/4 + 128 + (color_array[1].g - color_array[0].g) * 80) / 256;
- color_array[2].b = (2 * col0.b + col1.b) * 22 / 8;
- color_array[2].a = 0xFF;
-
- color_array[3].r = (2 * col1.r + col0.r) * 22 / 8;
- color_array[3].g = (256 * color_array[1].g + (color_array[0].g - color_array[1].g)/4 + 128 + (color_array[0].g - color_array[1].g) * 80) / 256;
- color_array[3].b = (2 * col1.b + col0.b) * 22 / 8;
- color_array[3].a = 0xFF;
-
- return 4;
- }
- else {
- // Three-color block: derive the other color.
- color_array[2].r = (col0.r + col1.r) * 33 / 8;
- color_array[2].g = (256 * color_array[0].g + (color_array[1].g - color_array[0].g)/4 + 128 + (color_array[1].g - color_array[0].g) * 128) / 256;
- color_array[2].b = (col0.b + col1.b) * 33 / 8;
- color_array[2].a = 0xFF;
-
- // Set all components to 0 to match DXT specs.
- color_array[3].r = 0x00; // color_array[2].r;
- color_array[3].g = 0x00; // color_array[2].g;
- color_array[3].b = 0x00; // color_array[2].b;
- color_array[3].a = 0x00;
-
- return 3;
- }
-}
-
-// Evaluate palette assuming 3 color block.
-void BlockDXT1::evaluatePalette3(Color32 color_array[4]) const
-{
- color_array[0].b = (col0.b << 3) | (col0.b >> 2);
- color_array[0].g = (col0.g << 2) | (col0.g >> 4);
- color_array[0].r = (col0.r << 3) | (col0.r >> 2);
- color_array[0].a = 0xFF;
-
- color_array[1].r = (col1.r << 3) | (col1.r >> 2);
- color_array[1].g = (col1.g << 2) | (col1.g >> 4);
- color_array[1].b = (col1.b << 3) | (col1.b >> 2);
- color_array[1].a = 0xFF;
-
- // Three-color block: derive the other color.
- color_array[2].r = (color_array[0].r + color_array[1].r) / 2;
- color_array[2].g = (color_array[0].g + color_array[1].g) / 2;
- color_array[2].b = (color_array[0].b + color_array[1].b) / 2;
- color_array[2].a = 0xFF;
-
- // Set all components to 0 to match DXT specs.
- color_array[3].r = 0x00; // color_array[2].r;
- color_array[3].g = 0x00; // color_array[2].g;
- color_array[3].b = 0x00; // color_array[2].b;
- color_array[3].a = 0x00;
-}
-
-// Evaluate palette assuming 4 color block.
-void BlockDXT1::evaluatePalette4(Color32 color_array[4]) const
-{
- color_array[0].b = (col0.b << 3) | (col0.b >> 2);
- color_array[0].g = (col0.g << 2) | (col0.g >> 4);
- color_array[0].r = (col0.r << 3) | (col0.r >> 2);
- color_array[0].a = 0xFF;
-
- color_array[1].r = (col1.r << 3) | (col1.r >> 2);
- color_array[1].g = (col1.g << 2) | (col1.g >> 4);
- color_array[1].b = (col1.b << 3) | (col1.b >> 2);
- color_array[1].a = 0xFF;
-
- // Four-color block: derive the other two colors.
- color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3;
- color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
- color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3;
- color_array[2].a = 0xFF;
-
- color_array[3].r = (2 * color_array[1].r + color_array[0].r) / 3;
- color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3;
- color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3;
- color_array[3].a = 0xFF;
-}
-
-
-void BlockDXT1::decodeBlock(ColorBlock * block) const
-{
- nvDebugCheck(block != NULL);
-
- // Decode color block.
- Color32 color_array[4];
- evaluatePalette(color_array);
-
- // Write color block.
- for( uint j = 0; j < 4; j++ ) {
- for( uint i = 0; i < 4; i++ ) {
- uint idx = (row[j] >> (2 * i)) & 3;
- block->color(i, j) = color_array[idx];
- }
- }
-}
-
-void BlockDXT1::setIndices(int * idx)
-{
- indices = 0;
- for(uint i = 0; i < 16; i++) {
- indices |= (idx[i] & 3) << (2 * i);
- }
-}
-
-
-/// Flip DXT1 block vertically.
-inline void BlockDXT1::flip4()
-{
- swap(row[0], row[3]);
- swap(row[1], row[2]);
-}
-
-/// Flip half DXT1 block vertically.
-inline void BlockDXT1::flip2()
-{
- swap(row[0], row[1]);
-}
-
-
-/*----------------------------------------------------------------------------
- BlockDXT3
-----------------------------------------------------------------------------*/
-
-void BlockDXT3::decodeBlock(ColorBlock * block) const
-{
- nvDebugCheck(block != NULL);
-
- // Decode color.
- color.decodeBlock(block);
-
- // Decode alpha.
- alpha.decodeBlock(block);
-}
-
-void AlphaBlockDXT3::decodeBlock(ColorBlock * block) const
-{
- nvDebugCheck(block != NULL);
-
- block->color(0x0).a = (alpha0 << 4) | alpha0;
- block->color(0x1).a = (alpha1 << 4) | alpha1;
- block->color(0x2).a = (alpha2 << 4) | alpha2;
- block->color(0x3).a = (alpha3 << 4) | alpha3;
- block->color(0x4).a = (alpha4 << 4) | alpha4;
- block->color(0x5).a = (alpha5 << 4) | alpha5;
- block->color(0x6).a = (alpha6 << 4) | alpha6;
- block->color(0x7).a = (alpha7 << 4) | alpha7;
- block->color(0x8).a = (alpha8 << 4) | alpha8;
- block->color(0x9).a = (alpha9 << 4) | alpha9;
- block->color(0xA).a = (alphaA << 4) | alphaA;
- block->color(0xB).a = (alphaB << 4) | alphaB;
- block->color(0xC).a = (alphaC << 4) | alphaC;
- block->color(0xD).a = (alphaD << 4) | alphaD;
- block->color(0xE).a = (alphaE << 4) | alphaE;
- block->color(0xF).a = (alphaF << 4) | alphaF;
-}
-
-/// Flip DXT3 alpha block vertically.
-void AlphaBlockDXT3::flip4()
-{
- swap(row[0], row[3]);
- swap(row[1], row[2]);
-}
-
-/// Flip half DXT3 alpha block vertically.
-void AlphaBlockDXT3::flip2()
-{
- swap(row[0], row[1]);
-}
-
-/// Flip DXT3 block vertically.
-void BlockDXT3::flip4()
-{
- alpha.flip4();
- color.flip4();
-}
-
-/// Flip half DXT3 block vertically.
-void BlockDXT3::flip2()
-{
- alpha.flip2();
- color.flip2();
-}
-
-
-/*----------------------------------------------------------------------------
- BlockDXT5
-----------------------------------------------------------------------------*/
-
-void AlphaBlockDXT5::evaluatePalette(uint8 alpha[8]) const
-{
- if (alpha0 > alpha1) {
- evaluatePalette8(alpha);
- }
- else {
- evaluatePalette6(alpha);
- }
-}
-
-void AlphaBlockDXT5::evaluatePalette8(uint8 alpha[8]) const
-{
- // 8-alpha block: derive the other six alphas.
- // Bit code 000 = alpha0, 001 = alpha1, others are interpolated.
- alpha[0] = alpha0;
- alpha[1] = alpha1;
- alpha[2] = (6 * alpha[0] + 1 * alpha[1]) / 7; // bit code 010
- alpha[3] = (5 * alpha[0] + 2 * alpha[1]) / 7; // bit code 011
- alpha[4] = (4 * alpha[0] + 3 * alpha[1]) / 7; // bit code 100
- alpha[5] = (3 * alpha[0] + 4 * alpha[1]) / 7; // bit code 101
- alpha[6] = (2 * alpha[0] + 5 * alpha[1]) / 7; // bit code 110
- alpha[7] = (1 * alpha[0] + 6 * alpha[1]) / 7; // bit code 111
-}
-
-void AlphaBlockDXT5::evaluatePalette6(uint8 alpha[8]) const
-{
- // 6-alpha block.
- // Bit code 000 = alpha0, 001 = alpha1, others are interpolated.
- alpha[0] = alpha0;
- alpha[1] = alpha1;
- alpha[2] = (4 * alpha[0] + 1 * alpha[1]) / 5; // Bit code 010
- alpha[3] = (3 * alpha[0] + 2 * alpha[1]) / 5; // Bit code 011
- alpha[4] = (2 * alpha[0] + 3 * alpha[1]) / 5; // Bit code 100
- alpha[5] = (1 * alpha[0] + 4 * alpha[1]) / 5; // Bit code 101
- alpha[6] = 0x00; // Bit code 110
- alpha[7] = 0xFF; // Bit code 111
-}
-
-void AlphaBlockDXT5::indices(uint8 index_array[16]) const
-{
- index_array[0x0] = bits0;
- index_array[0x1] = bits1;
- index_array[0x2] = bits2;
- index_array[0x3] = bits3;
- index_array[0x4] = bits4;
- index_array[0x5] = bits5;
- index_array[0x6] = bits6;
- index_array[0x7] = bits7;
- index_array[0x8] = bits8;
- index_array[0x9] = bits9;
- index_array[0xA] = bitsA;
- index_array[0xB] = bitsB;
- index_array[0xC] = bitsC;
- index_array[0xD] = bitsD;
- index_array[0xE] = bitsE;
- index_array[0xF] = bitsF;
-}
-
-uint AlphaBlockDXT5::index(uint index) const
-{
- nvDebugCheck(index < 16);
-
- int offset = (3 * index + 16);
- return uint((this->u >> offset) & 0x7);
-}
-
-void AlphaBlockDXT5::setIndex(uint index, uint value)
-{
- nvDebugCheck(index < 16);
- nvDebugCheck(value < 8);
-
- int offset = (3 * index + 16);
- uint64 mask = uint64(0x7) << offset;
- this->u = (this->u & ~mask) | (uint64(value) << offset);
-}
-
-void AlphaBlockDXT5::decodeBlock(ColorBlock * block) const
-{
- nvDebugCheck(block != NULL);
-
- uint8 alpha_array[8];
- evaluatePalette(alpha_array);
-
- uint8 index_array[16];
- indices(index_array);
-
- for(uint i = 0; i < 16; i++) {
- block->color(i).a = alpha_array[index_array[i]];
- }
-}
-
-void AlphaBlockDXT5::flip4()
-{
- uint64 * b = (uint64 *)this;
-
- // @@ The masks might have to be byte swapped.
- uint64 tmp = (*b & POSH_U64(0x000000000000FFFF));
- tmp |= (*b & POSH_U64(0x000000000FFF0000)) << 36;
- tmp |= (*b & POSH_U64(0x000000FFF0000000)) << 12;
- tmp |= (*b & POSH_U64(0x000FFF0000000000)) >> 12;
- tmp |= (*b & POSH_U64(0xFFF0000000000000)) >> 36;
-
- *b = tmp;
-}
-
-void AlphaBlockDXT5::flip2()
-{
- uint * b = (uint *)this;
-
- // @@ The masks might have to be byte swapped.
- uint tmp = (*b & 0xFF000000);
- tmp |= (*b & 0x00000FFF) << 12;
- tmp |= (*b & 0x00FFF000) >> 12;
-
- *b = tmp;
-}
-
-void BlockDXT5::decodeBlock(ColorBlock * block) const
-{
- nvDebugCheck(block != NULL);
-
- // Decode color.
- color.decodeBlock(block);
-
- // Decode alpha.
- alpha.decodeBlock(block);
-
-}
-
-/// Flip DXT5 block vertically.
-void BlockDXT5::flip4()
-{
- alpha.flip4();
- color.flip4();
-}
-
-/// Flip half DXT5 block vertically.
-void BlockDXT5::flip2()
-{
- alpha.flip2();
- color.flip2();
-}
-
-
-/// Decode ATI1 block.
-void BlockATI1::decodeBlock(ColorBlock * block) const
-{
- uint8 alpha_array[8];
- alpha.evaluatePalette(alpha_array);
-
- uint8 index_array[16];
- alpha.indices(index_array);
-
- for(uint i = 0; i < 16; i++) {
- Color32 & c = block->color(i);
- c.b = c.g = c.r = alpha_array[index_array[i]];
- c.a = 255;
- }
-}
-
-/// Flip ATI1 block vertically.
-void BlockATI1::flip4()
-{
- alpha.flip4();
-}
-
-/// Flip half ATI1 block vertically.
-void BlockATI1::flip2()
-{
- alpha.flip2();
-}
-
-
-/// Decode ATI2 block.
-void BlockATI2::decodeBlock(ColorBlock * block) const
-{
- uint8 alpha_array[8];
- uint8 index_array[16];
-
- x.evaluatePalette(alpha_array);
- x.indices(index_array);
-
- for(uint i = 0; i < 16; i++) {
- Color32 & c = block->color(i);
- c.r = alpha_array[index_array[i]];
- }
-
- y.evaluatePalette(alpha_array);
- y.indices(index_array);
-
- for(uint i = 0; i < 16; i++) {
- Color32 & c = block->color(i);
- c.g = alpha_array[index_array[i]];
- c.b = 0;
- c.a = 255;
- }
-}
-
-/// Flip ATI2 block vertically.
-void BlockATI2::flip4()
-{
- x.flip4();
- y.flip4();
-}
-
-/// Flip half ATI2 block vertically.
-void BlockATI2::flip2()
-{
- x.flip2();
- y.flip2();
-}
-
-
-void BlockCTX1::evaluatePalette(Color32 color_array[4]) const
-{
- // Does bit expansion before interpolation.
- color_array[0].b = 0x00;
- color_array[0].g = col0[1];
- color_array[0].r = col0[0];
- color_array[0].a = 0xFF;
-
- color_array[1].r = 0x00;
- color_array[1].g = col0[1];
- color_array[1].b = col1[0];
- color_array[1].a = 0xFF;
-
- color_array[2].r = 0x00;
- color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
- color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3;
- color_array[2].a = 0xFF;
-
- color_array[3].r = 0x00;
- color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3;
- color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3;
- color_array[3].a = 0xFF;
-}
-
-void BlockCTX1::decodeBlock(ColorBlock * block) const
-{
- nvDebugCheck(block != NULL);
-
- // Decode color block.
- Color32 color_array[4];
- evaluatePalette(color_array);
-
- // Write color block.
- for( uint j = 0; j < 4; j++ ) {
- for( uint i = 0; i < 4; i++ ) {
- uint idx = (row[j] >> (2 * i)) & 3;
- block->color(i, j) = color_array[idx];
- }
- }
-}
-
-void BlockCTX1::setIndices(int * idx)
-{
- indices = 0;
- for(uint i = 0; i < 16; i++) {
- indices |= (idx[i] & 3) << (2 * i);
- }
-}
-
-
-/// Flip CTX1 block vertically.
-inline void BlockCTX1::flip4()
-{
- swap(row[0], row[3]);
- swap(row[1], row[2]);
-}
-
-/// Flip half CTX1 block vertically.
-inline void BlockCTX1::flip2()
-{
- swap(row[0], row[1]);
-}
-
-
-
-
-Stream & nv::operator<<(Stream & stream, BlockDXT1 & block)
-{
- stream << block.col0.u << block.col1.u;
- stream.serialize(&block.indices, sizeof(block.indices));
- return stream;
-}
-
-Stream & nv::operator<<(Stream & stream, AlphaBlockDXT3 & block)
-{
- stream.serialize(&block, sizeof(block));
- return stream;
-}
-
-Stream & nv::operator<<(Stream & stream, BlockDXT3 & block)
-{
- return stream << block.alpha << block.color;
-}
-
-Stream & nv::operator<<(Stream & stream, AlphaBlockDXT5 & block)
-{
- stream.serialize(&block, sizeof(block));
- return stream;
-}
-
-Stream & nv::operator<<(Stream & stream, BlockDXT5 & block)
-{
- return stream << block.alpha << block.color;
-}
-
-Stream & nv::operator<<(Stream & stream, BlockATI1 & block)
-{
- return stream << block.alpha;
-}
-
-Stream & nv::operator<<(Stream & stream, BlockATI2 & block)
-{
- return stream << block.x << block.y;
-}
-
-Stream & nv::operator<<(Stream & stream, BlockCTX1 & block)
-{
- stream.serialize(&block, sizeof(block));
- return stream;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/BlockDXT.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/BlockDXT.h
deleted file mode 100644
index 6510e96d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/BlockDXT.h
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_IMAGE_BLOCKDXT_H
-#define NV_IMAGE_BLOCKDXT_H
-
-#include <nvmath/Color.h>
-
-#include <nvimage/nvimage.h>
-
-namespace nv
-{
- struct ColorBlock;
- class Stream;
-
-
- /// DXT1 block.
- struct BlockDXT1
- {
- Color16 col0;
- Color16 col1;
- union {
- uint8 row[4];
- uint indices;
- };
-
- bool isFourColorMode() const;
-
- uint evaluatePalette(Color32 color_array[4]) const;
- uint evaluatePaletteNV5x(Color32 color_array[4]) const;
-
- void evaluatePalette3(Color32 color_array[4]) const;
- void evaluatePalette4(Color32 color_array[4]) const;
-
- void decodeBlock(ColorBlock * block) const;
-
- void setIndices(int * idx);
-
- void flip4();
- void flip2();
- };
-
- /// Return true if the block uses four color mode, false otherwise.
- inline bool BlockDXT1::isFourColorMode() const
- {
- return col0.u > col1.u;
- }
-
-
- /// DXT3 alpha block with explicit alpha.
- struct AlphaBlockDXT3
- {
- union {
- struct {
- uint alpha0 : 4;
- uint alpha1 : 4;
- uint alpha2 : 4;
- uint alpha3 : 4;
- uint alpha4 : 4;
- uint alpha5 : 4;
- uint alpha6 : 4;
- uint alpha7 : 4;
- uint alpha8 : 4;
- uint alpha9 : 4;
- uint alphaA : 4;
- uint alphaB : 4;
- uint alphaC : 4;
- uint alphaD : 4;
- uint alphaE : 4;
- uint alphaF : 4;
- };
- uint16 row[4];
- };
-
- void decodeBlock(ColorBlock * block) const;
-
- void flip4();
- void flip2();
- };
-
-
- /// DXT3 block.
- struct BlockDXT3
- {
- AlphaBlockDXT3 alpha;
- BlockDXT1 color;
-
- void decodeBlock(ColorBlock * block) const;
-
- void flip4();
- void flip2();
- };
-
-
- /// DXT5 alpha block.
- struct AlphaBlockDXT5
- {
- union {
- struct {
- uint64 alpha0 : 8; // 8
- uint64 alpha1 : 8; // 16
- uint64 bits0 : 3; // 3 - 19
- uint64 bits1 : 3; // 6 - 22
- uint64 bits2 : 3; // 9 - 25
- uint64 bits3 : 3; // 12 - 28
- uint64 bits4 : 3; // 15 - 31
- uint64 bits5 : 3; // 18 - 34
- uint64 bits6 : 3; // 21 - 37
- uint64 bits7 : 3; // 24 - 40
- uint64 bits8 : 3; // 27 - 43
- uint64 bits9 : 3; // 30 - 46
- uint64 bitsA : 3; // 33 - 49
- uint64 bitsB : 3; // 36 - 52
- uint64 bitsC : 3; // 39 - 55
- uint64 bitsD : 3; // 42 - 58
- uint64 bitsE : 3; // 45 - 61
- uint64 bitsF : 3; // 48 - 64
- };
- uint64 u;
- };
-
- void evaluatePalette(uint8 alpha[8]) const;
- void evaluatePalette8(uint8 alpha[8]) const;
- void evaluatePalette6(uint8 alpha[8]) const;
- void indices(uint8 index_array[16]) const;
-
- uint index(uint index) const;
- void setIndex(uint index, uint value);
-
- void decodeBlock(ColorBlock * block) const;
-
- void flip4();
- void flip2();
- };
-
-
- /// DXT5 block.
- struct BlockDXT5
- {
- AlphaBlockDXT5 alpha;
- BlockDXT1 color;
-
- void decodeBlock(ColorBlock * block) const;
-
- void flip4();
- void flip2();
- };
-
- /// ATI1 block.
- struct BlockATI1
- {
- AlphaBlockDXT5 alpha;
-
- void decodeBlock(ColorBlock * block) const;
-
- void flip4();
- void flip2();
- };
-
- /// ATI2 block.
- struct BlockATI2
- {
- AlphaBlockDXT5 x;
- AlphaBlockDXT5 y;
-
- void decodeBlock(ColorBlock * block) const;
-
- void flip4();
- void flip2();
- };
-
- /// CTX1 block.
- struct BlockCTX1
- {
- uint8 col0[2];
- uint8 col1[2];
- union {
- uint8 row[4];
- uint indices;
- };
-
- void evaluatePalette(Color32 color_array[4]) const;
- void setIndices(int * idx);
-
- void decodeBlock(ColorBlock * block) const;
-
- void flip4();
- void flip2();
- };
-
-
- // Serialization functions.
- NVIMAGE_API Stream & operator<<(Stream & stream, BlockDXT1 & block);
- NVIMAGE_API Stream & operator<<(Stream & stream, AlphaBlockDXT3 & block);
- NVIMAGE_API Stream & operator<<(Stream & stream, BlockDXT3 & block);
- NVIMAGE_API Stream & operator<<(Stream & stream, AlphaBlockDXT5 & block);
- NVIMAGE_API Stream & operator<<(Stream & stream, BlockDXT5 & block);
- NVIMAGE_API Stream & operator<<(Stream & stream, BlockATI1 & block);
- NVIMAGE_API Stream & operator<<(Stream & stream, BlockATI2 & block);
- NVIMAGE_API Stream & operator<<(Stream & stream, BlockCTX1 & block);
-
-} // nv namespace
-
-#endif // NV_IMAGE_BLOCKDXT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/CMakeLists.txt b/Libraries/nvidia-texture-tools-read-only/src/nvimage/CMakeLists.txt
deleted file mode 100644
index 0d8ceba6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/CMakeLists.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-PROJECT(nvimage)
-
-SET(IMAGE_SRCS
- nvimage.h
- FloatImage.h
- FloatImage.cpp
- Filter.h
- Filter.cpp
- Image.h
- Image.cpp
- ImageIO.h
- ImageIO.cpp
- ColorBlock.h
- ColorBlock.cpp
- BlockDXT.h
- BlockDXT.cpp
- HoleFilling.h
- HoleFilling.cpp
- DirectDrawSurface.h
- DirectDrawSurface.cpp
- Quantize.h
- Quantize.cpp
- NormalMap.h
- NormalMap.cpp
- NormalMipmap.h
- NormalMipmap.cpp
- PsdFile.h
- TgaFile.h
- ColorSpace.h
- ColorSpace.cpp)
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-
-IF(PNG_FOUND)
- SET(LIBS ${LIBS} ${PNG_LIBRARIES})
- INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
-ENDIF(PNG_FOUND)
-
-IF(JPEG_FOUND)
- SET(LIBS ${LIBS} ${JPEG_LIBRARIES})
- INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
-ENDIF(JPEG_FOUND)
-
-IF(TIFF_FOUND)
- SET(LIBS ${LIBS} ${TIFF_LIBRARIES})
- INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
-ENDIF(TIFF_FOUND)
-
-IF(OPENEXR_FOUND)
- SET(LIBS ${LIBS} ${OPENEXR_LIBRARIES})
- INCLUDE_DIRECTORIES(${OPENEXR_INCLUDE_PATHS})
-ENDIF(OPENEXR_FOUND)
-
-IF(FREEIMAGE_FOUND)
- SET(LIBS ${LIBS} ${FREEIMAGE_LIBRARIES})
- INCLUDE_DIRECTORIES(${FREEIMAGE_INCLUDE_PATH})
-ENDIF(FREEIMAGE_FOUND)
-
-# targets
-ADD_DEFINITIONS(-DNVIMAGE_EXPORTS)
-
-IF(NVIMAGE_SHARED)
- ADD_LIBRARY(nvimage SHARED ${IMAGE_SRCS})
-ELSE(NVIMAGE_SHARED)
- ADD_LIBRARY(nvimage ${IMAGE_SRCS})
-ENDIF(NVIMAGE_SHARED)
-
-TARGET_LINK_LIBRARIES(nvimage ${LIBS} nvcore nvmath posh)
-
-INSTALL(TARGETS nvimage
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib/static)
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorBlock.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorBlock.cpp
deleted file mode 100644
index 2c9945f6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorBlock.cpp
+++ /dev/null
@@ -1,429 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvcore/Containers.h> // swap
-#include <nvmath/Box.h>
-#include <nvimage/ColorBlock.h>
-#include <nvimage/Image.h>
-
-using namespace nv;
-
-namespace {
-
- // Get approximate luminance.
- inline static uint colorLuminance(Color32 c)
- {
- return c.r + c.g + c.b;
- }
-
- // Get the euclidean distance between the given colors.
- inline static uint colorDistance(Color32 c0, Color32 c1)
- {
- return (c0.r - c1.r) * (c0.r - c1.r) + (c0.g - c1.g) * (c0.g - c1.g) + (c0.b - c1.b) * (c0.b - c1.b);
- }
-
-} // namespace`
-
-
-/// Default constructor.
-ColorBlock::ColorBlock()
-{
-}
-
-/// Init the color block from an array of colors.
-ColorBlock::ColorBlock(const uint * linearImage)
-{
- for(uint i = 0; i < 16; i++) {
- color(i) = Color32(linearImage[i]);
- }
-}
-
-/// Init the color block with the contents of the given block.
-ColorBlock::ColorBlock(const ColorBlock & block)
-{
- for(uint i = 0; i < 16; i++) {
- color(i) = block.color(i);
- }
-}
-
-
-/// Initialize this color block.
-ColorBlock::ColorBlock(const Image * img, uint x, uint y)
-{
- init(img, x, y);
-}
-
-void ColorBlock::init(const Image * img, uint x, uint y)
-{
- nvDebugCheck(img != NULL);
-
- const uint bw = min(img->width() - x, 4U);
- const uint bh = min(img->height() - y, 4U);
-
- nvDebugCheck(bw != 0);
- nvDebugCheck(bh != 0);
-
- static int remainder[] = {
- 0, 0, 0, 0,
- 0, 1, 0, 1,
- 0, 1, 2, 0,
- 0, 1, 2, 3,
- };
-
- // Blocks that are smaller than 4x4 are handled by repeating the pixels.
- // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :(
-
- for(uint i = 0; i < 4; i++) {
- //const int by = i % bh;
- const int by = remainder[(bh - 1) * 4 + i];
- for(uint e = 0; e < 4; e++) {
- //const int bx = e % bw;
- const int bx = remainder[(bw - 1) * 4 + e];
- color(e, i) = img->pixel(x + bx, y + by);
- }
- }
-}
-
-
-void ColorBlock::swizzleDXT5n()
-{
- for(int i = 0; i < 16; i++)
- {
- Color32 c = m_color[i];
- m_color[i] = Color32(0xFF, c.g, 0, c.r);
- }
-}
-
-void ColorBlock::splatX()
-{
- for(int i = 0; i < 16; i++)
- {
- uint8 x = m_color[i].r;
- m_color[i] = Color32(x, x, x, x);
- }
-}
-
-void ColorBlock::splatY()
-{
- for(int i = 0; i < 16; i++)
- {
- uint8 y = m_color[i].g;
- m_color[i] = Color32(y, y, y, y);
- }
-}
-
-/// Returns true if the block has a single color.
-bool ColorBlock::isSingleColor() const
-{
- Color32 mask(0xFF, 0xFF, 0xFF, 0x00);
- uint u = m_color[0].u & mask.u;
-
- for (int i = 1; i < 16; i++)
- {
- if (u != (m_color[i].u & mask.u))
- {
- return false;
- }
- }
-
- return true;
-}
-
-/// Returns true if the block has a single color, ignoring transparent pixels.
-bool ColorBlock::isSingleColorNoAlpha() const
-{
- Color32 c;
- int i;
- for(i = 0; i < 16; i++)
- {
- if (m_color[i].a != 0) c = m_color[i];
- }
-
- Color32 mask(0xFF, 0xFF, 0xFF, 0x00);
- uint u = c.u & mask.u;
-
- for(; i < 16; i++)
- {
- if (u != (m_color[i].u & mask.u))
- {
- return false;
- }
- }
-
- return true;
-}
-
-/// Count number of unique colors in this color block.
-uint ColorBlock::countUniqueColors() const
-{
- uint count = 0;
-
- // @@ This does not have to be o(n^2)
- for(int i = 0; i < 16; i++)
- {
- bool unique = true;
- for(int j = 0; j < i; j++) {
- if( m_color[i] != m_color[j] ) {
- unique = false;
- }
- }
-
- if( unique ) {
- count++;
- }
- }
-
- return count;
-}
-
-/// Get average color of the block.
-Color32 ColorBlock::averageColor() const
-{
- uint r, g, b, a;
- r = g = b = a = 0;
-
- for(uint i = 0; i < 16; i++) {
- r += m_color[i].r;
- g += m_color[i].g;
- b += m_color[i].b;
- a += m_color[i].a;
- }
-
- return Color32(uint8(r / 16), uint8(g / 16), uint8(b / 16), uint8(a / 16));
-}
-
-/// Return true if the block is not fully opaque.
-bool ColorBlock::hasAlpha() const
-{
- for (uint i = 0; i < 16; i++)
- {
- if (m_color[i].a != 255) return true;
- }
- return false;
-}
-
-
-/// Get diameter color range.
-void ColorBlock::diameterRange(Color32 * start, Color32 * end) const
-{
- nvDebugCheck(start != NULL);
- nvDebugCheck(end != NULL);
-
- Color32 c0, c1;
- uint best_dist = 0;
-
- for(int i = 0; i < 16; i++) {
- for (int j = i+1; j < 16; j++) {
- uint dist = colorDistance(m_color[i], m_color[j]);
- if( dist > best_dist ) {
- best_dist = dist;
- c0 = m_color[i];
- c1 = m_color[j];
- }
- }
- }
-
- *start = c0;
- *end = c1;
-}
-
-/// Get luminance color range.
-void ColorBlock::luminanceRange(Color32 * start, Color32 * end) const
-{
- nvDebugCheck(start != NULL);
- nvDebugCheck(end != NULL);
-
- Color32 minColor, maxColor;
- uint minLuminance, maxLuminance;
-
- maxLuminance = minLuminance = colorLuminance(m_color[0]);
-
- for(uint i = 1; i < 16; i++)
- {
- uint luminance = colorLuminance(m_color[i]);
-
- if (luminance > maxLuminance) {
- maxLuminance = luminance;
- maxColor = m_color[i];
- }
- else if (luminance < minLuminance) {
- minLuminance = luminance;
- minColor = m_color[i];
- }
- }
-
- *start = minColor;
- *end = maxColor;
-}
-
-/// Get color range based on the bounding box.
-void ColorBlock::boundsRange(Color32 * start, Color32 * end) const
-{
- nvDebugCheck(start != NULL);
- nvDebugCheck(end != NULL);
-
- Color32 minColor(255, 255, 255);
- Color32 maxColor(0, 0, 0);
-
- for(uint i = 0; i < 16; i++)
- {
- if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; }
- if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; }
- if (m_color[i].b < minColor.b) { minColor.b = m_color[i].b; }
- if (m_color[i].r > maxColor.r) { maxColor.r = m_color[i].r; }
- if (m_color[i].g > maxColor.g) { maxColor.g = m_color[i].g; }
- if (m_color[i].b > maxColor.b) { maxColor.b = m_color[i].b; }
- }
-
- // Offset range by 1/16 of the extents
- Color32 inset;
- inset.r = (maxColor.r - minColor.r) >> 4;
- inset.g = (maxColor.g - minColor.g) >> 4;
- inset.b = (maxColor.b - minColor.b) >> 4;
-
- minColor.r = (minColor.r + inset.r <= 255) ? minColor.r + inset.r : 255;
- minColor.g = (minColor.g + inset.g <= 255) ? minColor.g + inset.g : 255;
- minColor.b = (minColor.b + inset.b <= 255) ? minColor.b + inset.b : 255;
-
- maxColor.r = (maxColor.r >= inset.r) ? maxColor.r - inset.r : 0;
- maxColor.g = (maxColor.g >= inset.g) ? maxColor.g - inset.g : 0;
- maxColor.b = (maxColor.b >= inset.b) ? maxColor.b - inset.b : 0;
-
- *start = minColor;
- *end = maxColor;
-}
-
-/// Get color range based on the bounding box.
-void ColorBlock::boundsRangeAlpha(Color32 * start, Color32 * end) const
-{
- nvDebugCheck(start != NULL);
- nvDebugCheck(end != NULL);
-
- Color32 minColor(255, 255, 255, 255);
- Color32 maxColor(0, 0, 0, 0);
-
- for(uint i = 0; i < 16; i++)
- {
- if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; }
- if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; }
- if (m_color[i].b < minColor.b) { minColor.b = m_color[i].b; }
- if (m_color[i].a < minColor.a) { minColor.a = m_color[i].a; }
- if (m_color[i].r > maxColor.r) { maxColor.r = m_color[i].r; }
- if (m_color[i].g > maxColor.g) { maxColor.g = m_color[i].g; }
- if (m_color[i].b > maxColor.b) { maxColor.b = m_color[i].b; }
- if (m_color[i].a > maxColor.a) { maxColor.a = m_color[i].a; }
- }
-
- // Offset range by 1/16 of the extents
- Color32 inset;
- inset.r = (maxColor.r - minColor.r) >> 4;
- inset.g = (maxColor.g - minColor.g) >> 4;
- inset.b = (maxColor.b - minColor.b) >> 4;
- inset.a = (maxColor.a - minColor.a) >> 4;
-
- minColor.r = (minColor.r + inset.r <= 255) ? minColor.r + inset.r : 255;
- minColor.g = (minColor.g + inset.g <= 255) ? minColor.g + inset.g : 255;
- minColor.b = (minColor.b + inset.b <= 255) ? minColor.b + inset.b : 255;
- minColor.a = (minColor.a + inset.a <= 255) ? minColor.a + inset.a : 255;
-
- maxColor.r = (maxColor.r >= inset.r) ? maxColor.r - inset.r : 0;
- maxColor.g = (maxColor.g >= inset.g) ? maxColor.g - inset.g : 0;
- maxColor.b = (maxColor.b >= inset.b) ? maxColor.b - inset.b : 0;
- maxColor.a = (maxColor.a >= inset.a) ? maxColor.a - inset.a : 0;
-
- *start = minColor;
- *end = maxColor;
-}
-
-
-/// Sort colors by abosolute value in their 16 bit representation.
-void ColorBlock::sortColorsByAbsoluteValue()
-{
- // Dummy selection sort.
- for( uint a = 0; a < 16; a++ ) {
- uint max = a;
- Color16 cmax(m_color[a]);
-
- for( uint b = a+1; b < 16; b++ ) {
- Color16 cb(m_color[b]);
-
- if( cb.u > cmax.u ) {
- max = b;
- cmax = cb;
- }
- }
- swap( m_color[a], m_color[max] );
- }
-}
-
-
-/// Find extreme colors in the given axis.
-void ColorBlock::computeRange(Vector3::Arg axis, Color32 * start, Color32 * end) const
-{
- nvDebugCheck(start != NULL);
- nvDebugCheck(end != NULL);
-
- int mini, maxi;
- mini = maxi = 0;
-
- float min, max;
- min = max = dot(Vector3(m_color[0].r, m_color[0].g, m_color[0].b), axis);
-
- for(uint i = 1; i < 16; i++)
- {
- const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b);
-
- float val = dot(vec, axis);
- if( val < min ) {
- mini = i;
- min = val;
- }
- else if( val > max ) {
- maxi = i;
- max = val;
- }
- }
-
- *start = m_color[mini];
- *end = m_color[maxi];
-}
-
-
-/// Sort colors in the given axis.
-void ColorBlock::sortColors(const Vector3 & axis)
-{
- float luma_array[16];
-
- for(uint i = 0; i < 16; i++) {
- const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b);
- luma_array[i] = dot(vec, axis);
- }
-
- // Dummy selection sort.
- for( uint a = 0; a < 16; a++ ) {
- uint min = a;
- for( uint b = a+1; b < 16; b++ ) {
- if( luma_array[b] < luma_array[min] ) {
- min = b;
- }
- }
- swap( luma_array[a], luma_array[min] );
- swap( m_color[a], m_color[min] );
- }
-}
-
-
-/// Get the volume of the color block.
-float ColorBlock::volume() const
-{
- Box bounds;
- bounds.clearBounds();
-
- for(int i = 0; i < 16; i++) {
- const Vector3 point(m_color[i].r, m_color[i].g, m_color[i].b);
- bounds.addPointToBounds(point);
- }
-
- return bounds.volume();
-}
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorBlock.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorBlock.h
deleted file mode 100644
index 53ba76be..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorBlock.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_IMAGE_COLORBLOCK_H
-#define NV_IMAGE_COLORBLOCK_H
-
-#include <nvmath/Color.h>
-
-namespace nv
-{
- class Image;
-
- /// Uncompressed 4x4 color block.
- struct ColorBlock
- {
- ColorBlock();
- ColorBlock(const uint * linearImage);
- ColorBlock(const ColorBlock & block);
- ColorBlock(const Image * img, uint x, uint y);
-
- void init(const Image * img, uint x, uint y);
-
- void swizzleDXT5n();
- void splatX();
- void splatY();
-
- bool isSingleColor() const;
- bool isSingleColorNoAlpha() const;
- uint countUniqueColors() const;
- Color32 averageColor() const;
- bool hasAlpha() const;
-
- void diameterRange(Color32 * start, Color32 * end) const;
- void luminanceRange(Color32 * start, Color32 * end) const;
- void boundsRange(Color32 * start, Color32 * end) const;
- void boundsRangeAlpha(Color32 * start, Color32 * end) const;
-
- void sortColorsByAbsoluteValue();
-
- void computeRange(const Vector3 & axis, Color32 * start, Color32 * end) const;
- void sortColors(const Vector3 & axis);
-
- float volume() const;
-
- // Accessors
- const Color32 * colors() const;
-
- Color32 color(uint i) const;
- Color32 & color(uint i);
-
- Color32 color(uint x, uint y) const;
- Color32 & color(uint x, uint y);
-
- private:
-
- Color32 m_color[4*4];
-
- };
-
-
- /// Get pointer to block colors.
- inline const Color32 * ColorBlock::colors() const
- {
- return m_color;
- }
-
- /// Get block color.
- inline Color32 ColorBlock::color(uint i) const
- {
- nvDebugCheck(i < 16);
- return m_color[i];
- }
-
- /// Get block color.
- inline Color32 & ColorBlock::color(uint i)
- {
- nvDebugCheck(i < 16);
- return m_color[i];
- }
-
- /// Get block color.
- inline Color32 ColorBlock::color(uint x, uint y) const
- {
- nvDebugCheck(x < 4 && y < 4);
- return m_color[y * 4 + x];
- }
-
- /// Get block color.
- inline Color32 & ColorBlock::color(uint x, uint y)
- {
- nvDebugCheck(x < 4 && y < 4);
- return m_color[y * 4 + x];
- }
-
-} // nv namespace
-
-#endif // NV_IMAGE_COLORBLOCK_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorSpace.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorSpace.cpp
deleted file mode 100644
index b9f8a755..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorSpace.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// This code is in the public domain -- jim@tilander.org
-
-#include <nvcore/nvcore.h>
-
-#include <nvmath/Color.h>
-#include <nvimage/Image.h>
-
-#include "ColorSpace.h"
-
-namespace nv
-{
- void ColorSpace::RGBtoYCoCg_R(Image* img)
- {
- const uint w = img->width();
- const uint h = img->height();
-
- for( uint y=0; y < h; y++ )
- {
- for( uint x=0; x < w; x++ )
- {
- Color32 pixel = img->pixel(x, y);
-
- const int r = pixel.r;
- const int g = pixel.g;
- const int b = pixel.b;
-
- const int Co = r - b;
- const int t = b + Co/2;
- const int Cg = g - t;
- const int Y = t + Cg/2;
-
- // Just saturate the chroma here (we loose out of one bit in each channel)
- // this just means that we won't have as high dynamic range. Perhaps a better option
- // is to loose the least significant bit instead?
- pixel.r = clamp(Co + 128, 0, 255);
- pixel.g = clamp(Cg + 128, 0, 255);
- pixel.b = 0;
- pixel.a = Y;
- }
- }
- }
-
- void ColorSpace::YCoCg_RtoRGB(Image* img)
- {
- const uint w = img->width();
- const uint h = img->height();
-
- for( uint y=0; y < h; y++ )
- {
- for( uint x=0; x < w; x++ )
- {
- Color32 pixel = img->pixel(x, y);
-
- const int Co = (int)pixel.r - 128;
- const int Cg = (int)pixel.g - 128;
- const int Y = pixel.a;
-
- const int t = Y - Cg/2;
- const int g = Cg + t;
- const int b = t - Co/2;
- const int r = b + Co;
-
- pixel.r = r;
- pixel.g = g;
- pixel.b = b;
- pixel.a = 1;
- }
- }
- }
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorSpace.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorSpace.h
deleted file mode 100644
index 56f99f0b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ColorSpace.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// This code is in the public domain -- jim@tilander.org
-
-#ifndef NV_IMAGE_COLORSPACE_H
-#define NV_IMAGE_COLORSPACE_H
-
-namespace nv
-{
- class Image;
-
- // Defines simple mappings between different color spaces and encodes them in the
- // input image.
- namespace ColorSpace
- {
- void RGBtoYCoCg_R(Image* img);
- void YCoCg_RtoRGB(Image* img);
- }
-}
-
-
-
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ConeMap.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/ConeMap.cpp
deleted file mode 100644
index ef7bb856..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ConeMap.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvcore/Ptr.h>
-
-#include <nvmath/Color.h>
-
-#include <nvimage/NormalMap.h>
-#include <nvimage/Filter.h>
-#include <nvimage/FloatImage.h>
-#include <nvimage/Image.h>
-
-using namespace nv;
-
-
-static float processPixel(const FloatImage * img, uint x, uint y)
-{
- nvDebugCheck(img != NULL);
-
- const uint w = img->width();
- const uint h = img->height();
-
- float d = img->pixel(x, y, 0);
-
- float fx0 = (float) x / w;
- float fy0 = (float) y / h;
-
- float best_ratio = INF;
- uint best_x = w;
- uint best_y = h;
-
- for (uint yy = 0; yy < h; yy++)
- {
- for (uint xx = 0; xx < w; xx++)
- {
- float ch = d - img->pixel(xx, yy, 0);
-
- if (ch > 0)
- {
- float dx = float(xx - x);
- float dy = float(yy - y);
-
- float ratio = (dx * dx + dy * dy) / ch;
-
- if (ratio < best_ratio)
- {
- best_x = xx;
- best_y = yy;
- }
- }
- }
- }
-
- if (best_x != w)
- {
- nvDebugCheck(best_y !=h);
-
- float dx = float(best_x - x) / w;
- float dy = float(best_y - y) / h;
-
- float cw = sqrtf(dx*dx + dy*dy);
- float ch = d - img->pixel(xx, yy, 0);
-
- return min(1, sqrtf(cw / ch));
- }
-
- return 1;
-}
-
-
-// Create cone map using the given kernels.
-FloatImage * createConeMap(const Image * img, Vector4::Arg heightWeights)
-{
- nvCheck(img != NULL);
-
- const uint w = img->width();
- const uint h = img->height();
-
- AutoPtr<FloatImage> fimage(new FloatImage());
- //fimage->allocate(2, w, h);
- fimage->allocate(4, w, h);
-
- // Compute height and store in red channel:
- float * heightChannel = fimage->channel(0);
- for(uint i = 0; i < w*h; i++)
- {
- Vector4 color = toVector4(img->pixel(i));
- heightChannel[i] = dot(color, heightWeights);
- }
-
- // Compute cones:
- for(uint y = 0; y < h; y++)
- {
- for(uint x = 0; x < w; x++)
- {
- processPixel(fimage, x, y);
- }
- }
-
- return fimage.release();
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ConeMap.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/ConeMap.h
deleted file mode 100644
index 0c79533a..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ConeMap.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_IMAGE_CONEMAP_H
-#define NV_IMAGE_CONEMAP_H
-
-#include <nvmath/Vector.h>
-#include <nvimage/nvimage.h>
-
-namespace nv
-{
- class Image;
- class FloatImage;
-
- FloatImage * createConeMap(const Image * img, Vector4::Arg heightWeights);
-
-} // nv namespace
-
-#endif // NV_IMAGE_CONEMAP_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/DirectDrawSurface.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/DirectDrawSurface.cpp
deleted file mode 100644
index e74c4d52..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/DirectDrawSurface.cpp
+++ /dev/null
@@ -1,1405 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvimage/DirectDrawSurface.h>
-#include <nvimage/ColorBlock.h>
-#include <nvimage/Image.h>
-#include <nvimage/BlockDXT.h>
-#include <nvimage/PixelFormat.h>
-
-#include <nvcore/Debug.h>
-#include <nvcore/Containers.h> // max
-#include <nvcore/StdStream.h>
-
-#include <string.h> // memset
-
-
-using namespace nv;
-
-#if !defined(MAKEFOURCC)
-# define MAKEFOURCC(ch0, ch1, ch2, ch3) \
- (uint(uint8(ch0)) | (uint(uint8(ch1)) << 8) | \
- (uint(uint8(ch2)) << 16) | (uint(uint8(ch3)) << 24 ))
-#endif
-
-namespace
-{
- static const uint FOURCC_DDS = MAKEFOURCC('D', 'D', 'S', ' ');
- static const uint FOURCC_DXT1 = MAKEFOURCC('D', 'X', 'T', '1');
- static const uint FOURCC_DXT2 = MAKEFOURCC('D', 'X', 'T', '2');
- static const uint FOURCC_DXT3 = MAKEFOURCC('D', 'X', 'T', '3');
- static const uint FOURCC_DXT4 = MAKEFOURCC('D', 'X', 'T', '4');
- static const uint FOURCC_DXT5 = MAKEFOURCC('D', 'X', 'T', '5');
- static const uint FOURCC_RXGB = MAKEFOURCC('R', 'X', 'G', 'B');
- static const uint FOURCC_ATI1 = MAKEFOURCC('A', 'T', 'I', '1');
- static const uint FOURCC_ATI2 = MAKEFOURCC('A', 'T', 'I', '2');
-
- static const uint FOURCC_A2XY = MAKEFOURCC('A', '2', 'X', 'Y');
-
- static const uint FOURCC_DX10 = MAKEFOURCC('D', 'X', '1', '0');
-
- // 32 bit RGB formats.
- static const uint D3DFMT_R8G8B8 = 20;
- static const uint D3DFMT_A8R8G8B8 = 21;
- static const uint D3DFMT_X8R8G8B8 = 22;
- static const uint D3DFMT_R5G6B5 = 23;
- static const uint D3DFMT_X1R5G5B5 = 24;
- static const uint D3DFMT_A1R5G5B5 = 25;
- static const uint D3DFMT_A4R4G4B4 = 26;
- static const uint D3DFMT_R3G3B2 = 27;
- static const uint D3DFMT_A8 = 28;
- static const uint D3DFMT_A8R3G3B2 = 29;
- static const uint D3DFMT_X4R4G4B4 = 30;
- static const uint D3DFMT_A2B10G10R10 = 31;
- static const uint D3DFMT_A8B8G8R8 = 32;
- static const uint D3DFMT_X8B8G8R8 = 33;
- static const uint D3DFMT_G16R16 = 34;
- static const uint D3DFMT_A2R10G10B10 = 35;
-
- static const uint D3DFMT_A16B16G16R16 = 36;
-
- // Palette formats.
- static const uint D3DFMT_A8P8 = 40;
- static const uint D3DFMT_P8 = 41;
-
- // Luminance formats.
- static const uint D3DFMT_L8 = 50;
- static const uint D3DFMT_A8L8 = 51;
- static const uint D3DFMT_A4L4 = 52;
- static const uint D3DFMT_L16 = 81;
-
- // Floating point formats
- static const uint D3DFMT_R16F = 111;
- static const uint D3DFMT_G16R16F = 112;
- static const uint D3DFMT_A16B16G16R16F = 113;
- static const uint D3DFMT_R32F = 114;
- static const uint D3DFMT_G32R32F = 115;
- static const uint D3DFMT_A32B32G32R32F = 116;
-
- static const uint DDSD_CAPS = 0x00000001U;
- static const uint DDSD_PIXELFORMAT = 0x00001000U;
- static const uint DDSD_WIDTH = 0x00000004U;
- static const uint DDSD_HEIGHT = 0x00000002U;
- static const uint DDSD_PITCH = 0x00000008U;
- static const uint DDSD_MIPMAPCOUNT = 0x00020000U;
- static const uint DDSD_LINEARSIZE = 0x00080000U;
- static const uint DDSD_DEPTH = 0x00800000U;
-
- static const uint DDSCAPS_COMPLEX = 0x00000008U;
- static const uint DDSCAPS_TEXTURE = 0x00001000U;
- static const uint DDSCAPS_MIPMAP = 0x00400000U;
- static const uint DDSCAPS2_VOLUME = 0x00200000U;
- static const uint DDSCAPS2_CUBEMAP = 0x00000200U;
-
- static const uint DDSCAPS2_CUBEMAP_POSITIVEX = 0x00000400U;
- static const uint DDSCAPS2_CUBEMAP_NEGATIVEX = 0x00000800U;
- static const uint DDSCAPS2_CUBEMAP_POSITIVEY = 0x00001000U;
- static const uint DDSCAPS2_CUBEMAP_NEGATIVEY = 0x00002000U;
- static const uint DDSCAPS2_CUBEMAP_POSITIVEZ = 0x00004000U;
- static const uint DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x00008000U;
- static const uint DDSCAPS2_CUBEMAP_ALL_FACES = 0x0000FC00U;
-
- static const uint DDPF_ALPHAPIXELS = 0x00000001U;
- static const uint DDPF_ALPHA = 0x00000002U;
- static const uint DDPF_FOURCC = 0x00000004U;
- static const uint DDPF_RGB = 0x00000040U;
- static const uint DDPF_PALETTEINDEXED1 = 0x00000800U;
- static const uint DDPF_PALETTEINDEXED2 = 0x00001000U;
- static const uint DDPF_PALETTEINDEXED4 = 0x00000008U;
- static const uint DDPF_PALETTEINDEXED8 = 0x00000020U;
- static const uint DDPF_LUMINANCE = 0x00020000U;
- static const uint DDPF_ALPHAPREMULT = 0x00008000U;
- static const uint DDPF_NORMAL = 0x80000000U; // @@ Custom nv flag.
-
- // DX10 formats.
- enum DXGI_FORMAT
- {
- DXGI_FORMAT_UNKNOWN = 0,
-
- DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
- DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
- DXGI_FORMAT_R32G32B32A32_UINT = 3,
- DXGI_FORMAT_R32G32B32A32_SINT = 4,
-
- DXGI_FORMAT_R32G32B32_TYPELESS = 5,
- DXGI_FORMAT_R32G32B32_FLOAT = 6,
- DXGI_FORMAT_R32G32B32_UINT = 7,
- DXGI_FORMAT_R32G32B32_SINT = 8,
-
- DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
- DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
- DXGI_FORMAT_R16G16B16A16_UNORM = 11,
- DXGI_FORMAT_R16G16B16A16_UINT = 12,
- DXGI_FORMAT_R16G16B16A16_SNORM = 13,
- DXGI_FORMAT_R16G16B16A16_SINT = 14,
-
- DXGI_FORMAT_R32G32_TYPELESS = 15,
- DXGI_FORMAT_R32G32_FLOAT = 16,
- DXGI_FORMAT_R32G32_UINT = 17,
- DXGI_FORMAT_R32G32_SINT = 18,
-
- DXGI_FORMAT_R32G8X24_TYPELESS = 19,
- DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
- DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
- DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
-
- DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
- DXGI_FORMAT_R10G10B10A2_UNORM = 24,
- DXGI_FORMAT_R10G10B10A2_UINT = 25,
-
- DXGI_FORMAT_R11G11B10_FLOAT = 26,
-
- DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
- DXGI_FORMAT_R8G8B8A8_UNORM = 28,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
- DXGI_FORMAT_R8G8B8A8_UINT = 30,
- DXGI_FORMAT_R8G8B8A8_SNORM = 31,
- DXGI_FORMAT_R8G8B8A8_SINT = 32,
-
- DXGI_FORMAT_R16G16_TYPELESS = 33,
- DXGI_FORMAT_R16G16_FLOAT = 34,
- DXGI_FORMAT_R16G16_UNORM = 35,
- DXGI_FORMAT_R16G16_UINT = 36,
- DXGI_FORMAT_R16G16_SNORM = 37,
- DXGI_FORMAT_R16G16_SINT = 38,
-
- DXGI_FORMAT_R32_TYPELESS = 39,
- DXGI_FORMAT_D32_FLOAT = 40,
- DXGI_FORMAT_R32_FLOAT = 41,
- DXGI_FORMAT_R32_UINT = 42,
- DXGI_FORMAT_R32_SINT = 43,
-
- DXGI_FORMAT_R24G8_TYPELESS = 44,
- DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
- DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
-
- DXGI_FORMAT_R8G8_TYPELESS = 48,
- DXGI_FORMAT_R8G8_UNORM = 49,
- DXGI_FORMAT_R8G8_UINT = 50,
- DXGI_FORMAT_R8G8_SNORM = 51,
- DXGI_FORMAT_R8G8_SINT = 52,
-
- DXGI_FORMAT_R16_TYPELESS = 53,
- DXGI_FORMAT_R16_FLOAT = 54,
- DXGI_FORMAT_D16_UNORM = 55,
- DXGI_FORMAT_R16_UNORM = 56,
- DXGI_FORMAT_R16_UINT = 57,
- DXGI_FORMAT_R16_SNORM = 58,
- DXGI_FORMAT_R16_SINT = 59,
-
- DXGI_FORMAT_R8_TYPELESS = 60,
- DXGI_FORMAT_R8_UNORM = 61,
- DXGI_FORMAT_R8_UINT = 62,
- DXGI_FORMAT_R8_SNORM = 63,
- DXGI_FORMAT_R8_SINT = 64,
- DXGI_FORMAT_A8_UNORM = 65,
-
- DXGI_FORMAT_R1_UNORM = 66,
-
- DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
-
- DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
- DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
-
- DXGI_FORMAT_BC1_TYPELESS = 70,
- DXGI_FORMAT_BC1_UNORM = 71,
- DXGI_FORMAT_BC1_UNORM_SRGB = 72,
-
- DXGI_FORMAT_BC2_TYPELESS = 73,
- DXGI_FORMAT_BC2_UNORM = 74,
- DXGI_FORMAT_BC2_UNORM_SRGB = 75,
-
- DXGI_FORMAT_BC3_TYPELESS = 76,
- DXGI_FORMAT_BC3_UNORM = 77,
- DXGI_FORMAT_BC3_UNORM_SRGB = 78,
-
- DXGI_FORMAT_BC4_TYPELESS = 79,
- DXGI_FORMAT_BC4_UNORM = 80,
- DXGI_FORMAT_BC4_SNORM = 81,
-
- DXGI_FORMAT_BC5_TYPELESS = 82,
- DXGI_FORMAT_BC5_UNORM = 83,
- DXGI_FORMAT_BC5_SNORM = 84,
-
- DXGI_FORMAT_B5G6R5_UNORM = 85,
- DXGI_FORMAT_B5G5R5A1_UNORM = 86,
- DXGI_FORMAT_B8G8R8A8_UNORM = 87,
- DXGI_FORMAT_B8G8R8X8_UNORM = 88,
- };
-
- enum D3D10_RESOURCE_DIMENSION
- {
- D3D10_RESOURCE_DIMENSION_UNKNOWN = 0,
- D3D10_RESOURCE_DIMENSION_BUFFER = 1,
- D3D10_RESOURCE_DIMENSION_TEXTURE1D = 2,
- D3D10_RESOURCE_DIMENSION_TEXTURE2D = 3,
- D3D10_RESOURCE_DIMENSION_TEXTURE3D = 4,
- };
-
-
- const char * getDxgiFormatString(DXGI_FORMAT dxgiFormat)
- {
-#define CASE(format) case DXGI_FORMAT_##format: return #format
- switch(dxgiFormat)
- {
- CASE(UNKNOWN);
-
- CASE(R32G32B32A32_TYPELESS);
- CASE(R32G32B32A32_FLOAT);
- CASE(R32G32B32A32_UINT);
- CASE(R32G32B32A32_SINT);
-
- CASE(R32G32B32_TYPELESS);
- CASE(R32G32B32_FLOAT);
- CASE(R32G32B32_UINT);
- CASE(R32G32B32_SINT);
-
- CASE(R16G16B16A16_TYPELESS);
- CASE(R16G16B16A16_FLOAT);
- CASE(R16G16B16A16_UNORM);
- CASE(R16G16B16A16_UINT);
- CASE(R16G16B16A16_SNORM);
- CASE(R16G16B16A16_SINT);
-
- CASE(R32G32_TYPELESS);
- CASE(R32G32_FLOAT);
- CASE(R32G32_UINT);
- CASE(R32G32_SINT);
-
- CASE(R32G8X24_TYPELESS);
- CASE(D32_FLOAT_S8X24_UINT);
- CASE(R32_FLOAT_X8X24_TYPELESS);
- CASE(X32_TYPELESS_G8X24_UINT);
-
- CASE(R10G10B10A2_TYPELESS);
- CASE(R10G10B10A2_UNORM);
- CASE(R10G10B10A2_UINT);
-
- CASE(R11G11B10_FLOAT);
-
- CASE(R8G8B8A8_TYPELESS);
- CASE(R8G8B8A8_UNORM);
- CASE(R8G8B8A8_UNORM_SRGB);
- CASE(R8G8B8A8_UINT);
- CASE(R8G8B8A8_SNORM);
- CASE(R8G8B8A8_SINT);
-
- CASE(R16G16_TYPELESS);
- CASE(R16G16_FLOAT);
- CASE(R16G16_UNORM);
- CASE(R16G16_UINT);
- CASE(R16G16_SNORM);
- CASE(R16G16_SINT);
-
- CASE(R32_TYPELESS);
- CASE(D32_FLOAT);
- CASE(R32_FLOAT);
- CASE(R32_UINT);
- CASE(R32_SINT);
-
- CASE(R24G8_TYPELESS);
- CASE(D24_UNORM_S8_UINT);
- CASE(R24_UNORM_X8_TYPELESS);
- CASE(X24_TYPELESS_G8_UINT);
-
- CASE(R8G8_TYPELESS);
- CASE(R8G8_UNORM);
- CASE(R8G8_UINT);
- CASE(R8G8_SNORM);
- CASE(R8G8_SINT);
-
- CASE(R16_TYPELESS);
- CASE(R16_FLOAT);
- CASE(D16_UNORM);
- CASE(R16_UNORM);
- CASE(R16_UINT);
- CASE(R16_SNORM);
- CASE(R16_SINT);
-
- CASE(R8_TYPELESS);
- CASE(R8_UNORM);
- CASE(R8_UINT);
- CASE(R8_SNORM);
- CASE(R8_SINT);
- CASE(A8_UNORM);
-
- CASE(R1_UNORM);
-
- CASE(R9G9B9E5_SHAREDEXP);
-
- CASE(R8G8_B8G8_UNORM);
- CASE(G8R8_G8B8_UNORM);
-
- CASE(BC1_TYPELESS);
- CASE(BC1_UNORM);
- CASE(BC1_UNORM_SRGB);
-
- CASE(BC2_TYPELESS);
- CASE(BC2_UNORM);
- CASE(BC2_UNORM_SRGB);
-
- CASE(BC3_TYPELESS);
- CASE(BC3_UNORM);
- CASE(BC3_UNORM_SRGB);
-
- CASE(BC4_TYPELESS);
- CASE(BC4_UNORM);
- CASE(BC4_SNORM);
-
- CASE(BC5_TYPELESS);
- CASE(BC5_UNORM);
- CASE(BC5_SNORM);
-
- CASE(B5G6R5_UNORM);
- CASE(B5G5R5A1_UNORM);
- CASE(B8G8R8A8_UNORM);
- CASE(B8G8R8X8_UNORM);
-
- default:
- return "UNKNOWN";
- }
-#undef CASE
- }
-
- const char * getD3d10ResourceDimensionString(D3D10_RESOURCE_DIMENSION resourceDimension)
- {
- switch(resourceDimension)
- {
- default:
- case D3D10_RESOURCE_DIMENSION_UNKNOWN: return "UNKNOWN";
- case D3D10_RESOURCE_DIMENSION_BUFFER: return "BUFFER";
- case D3D10_RESOURCE_DIMENSION_TEXTURE1D: return "TEXTURE1D";
- case D3D10_RESOURCE_DIMENSION_TEXTURE2D: return "TEXTURE2D";
- case D3D10_RESOURCE_DIMENSION_TEXTURE3D: return "TEXTURE3D";
- }
- }
-
-} // namespace
-
-namespace nv
-{
- static Stream & operator<< (Stream & s, DDSPixelFormat & pf)
- {
- nvStaticCheck(sizeof(DDSPixelFormat) == 32);
- s << pf.size;
- s << pf.flags;
- s << pf.fourcc;
- s << pf.bitcount;
- s << pf.rmask;
- s << pf.gmask;
- s << pf.bmask;
- s << pf.amask;
- return s;
- }
-
- static Stream & operator<< (Stream & s, DDSCaps & caps)
- {
- nvStaticCheck(sizeof(DDSCaps) == 16);
- s << caps.caps1;
- s << caps.caps2;
- s << caps.caps3;
- s << caps.caps4;
- return s;
- }
-
- static Stream & operator<< (Stream & s, DDSHeader10 & header)
- {
- nvStaticCheck(sizeof(DDSHeader10) == 20);
- s << header.dxgiFormat;
- s << header.resourceDimension;
- s << header.miscFlag;
- s << header.arraySize;
- s << header.reserved;
- return s;
- }
-
- Stream & operator<< (Stream & s, DDSHeader & header)
- {
- nvStaticCheck(sizeof(DDSHeader) == 148);
- s << header.fourcc;
- s << header.size;
- s << header.flags;
- s << header.height;
- s << header.width;
- s << header.pitch;
- s << header.depth;
- s << header.mipmapcount;
- s.serialize(header.reserved, 11 * sizeof(uint));
- s << header.pf;
- s << header.caps;
- s << header.notused;
-
- if (header.hasDX10Header())
- {
- s << header.header10;
- }
-
- return s;
- }
-
-} // nv namespace
-
-/* Not used!
-namespace
-{
- struct FormatDescriptor
- {
- uint format;
- uint bitcount;
- uint rmask;
- uint gmask;
- uint bmask;
- uint amask;
- };
-
- static const FormatDescriptor s_d3dFormats[] =
- {
- { D3DFMT_R8G8B8, 24, 0xFF0000, 0xFF00, 0xFF, 0 },
- { D3DFMT_A8R8G8B8, 32, 0xFF0000, 0xFF00, 0xFF, 0xFF000000 }, // DXGI_FORMAT_B8G8R8A8_UNORM
- { D3DFMT_X8R8G8B8, 32, 0xFF0000, 0xFF00, 0xFF, 0 }, // DXGI_FORMAT_B8G8R8X8_UNORM
- { D3DFMT_R5G6B5, 16, 0xF800, 0x7E0, 0x1F, 0 }, // DXGI_FORMAT_B5G6R5_UNORM
- { D3DFMT_X1R5G5B5, 16, 0x7C00, 0x3E0, 0x1F, 0 },
- { D3DFMT_A1R5G5B5, 16, 0x7C00, 0x3E0, 0x1F, 0x8000 }, // DXGI_FORMAT_B5G5R5A1_UNORM
- { D3DFMT_A4R4G4B4, 16, 0xF00, 0xF0, 0xF, 0xF000 },
- { D3DFMT_R3G3B2, 8, 0xE0, 0x1C, 0x3, 0 },
- { D3DFMT_A8, 8, 0, 0, 0, 8 }, // DXGI_FORMAT_A8_UNORM
- { D3DFMT_A8R3G3B2, 16, 0xE0, 0x1C, 0x3, 0xFF00 },
- { D3DFMT_X4R4G4B4, 16, 0xF00, 0xF0, 0xF, 0 },
- { D3DFMT_A2B10G10R10, 32, 0x3FF, 0xFFC00, 0x3FF00000, 0xC0000000 }, // DXGI_FORMAT_R10G10B10A2
- { D3DFMT_A8B8G8R8, 32, 0xFF, 0xFF00, 0xFF0000, 0xFF000000 }, // DXGI_FORMAT_R8G8B8A8_UNORM
- { D3DFMT_X8B8G8R8, 32, 0xFF, 0xFF00, 0xFF0000, 0 },
- { D3DFMT_G16R16, 32, 0xFFFF, 0xFFFF0000, 0, 0 }, // DXGI_FORMAT_R16G16_UNORM
- { D3DFMT_A2R10G10B10, 32, 0x3FF00000, 0xFFC00, 0x3FF, 0xC0000000 },
-
- { D3DFMT_L8, 8, 8, 0, 0, 0 }, // DXGI_FORMAT_R8_UNORM
- { D3DFMT_L16, 16, 16, 0, 0, 0 }, // DXGI_FORMAT_R16_UNORM
- };
-
- static const uint s_d3dFormatCount = sizeof(s_d3dFormats) / sizeof(s_d3dFormats[0]);
-
- static uint findD3D9Format(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
- {
- for (int i = 0; i < s_d3dFormatCount; i++)
- {
- if (s_d3dFormats[i].bitcount == bitcount &&
- s_d3dFormats[i].rmask == rmask &&
- s_d3dFormats[i].gmask == gmask &&
- s_d3dFormats[i].bmask == bmask &&
- s_d3dFormats[i].amask == amask)
- {
- return s_d3dFormats[i].format;
- }
- }
-
- return 0;
- }
-
-} // nv namespace
-*/
-
-DDSHeader::DDSHeader()
-{
- this->fourcc = FOURCC_DDS;
- this->size = 124;
- this->flags = (DDSD_CAPS|DDSD_PIXELFORMAT);
- this->height = 0;
- this->width = 0;
- this->pitch = 0;
- this->depth = 0;
- this->mipmapcount = 0;
- memset(this->reserved, 0, sizeof(this->reserved));
-
- // Store version information on the reserved header attributes.
- this->reserved[9] = MAKEFOURCC('N', 'V', 'T', 'T');
- this->reserved[10] = (2 << 16) | (1 << 8) | (0); // major.minor.revision
-
- this->pf.size = 32;
- this->pf.flags = 0;
- this->pf.fourcc = 0;
- this->pf.bitcount = 0;
- this->pf.rmask = 0;
- this->pf.gmask = 0;
- this->pf.bmask = 0;
- this->pf.amask = 0;
- this->caps.caps1 = DDSCAPS_TEXTURE;
- this->caps.caps2 = 0;
- this->caps.caps3 = 0;
- this->caps.caps4 = 0;
- this->notused = 0;
-
- this->header10.dxgiFormat = DXGI_FORMAT_UNKNOWN;
- this->header10.resourceDimension = D3D10_RESOURCE_DIMENSION_UNKNOWN;
- this->header10.miscFlag = 0;
- this->header10.arraySize = 0;
- this->header10.reserved = 0;
-}
-
-void DDSHeader::setWidth(uint w)
-{
- this->flags |= DDSD_WIDTH;
- this->width = w;
-}
-
-void DDSHeader::setHeight(uint h)
-{
- this->flags |= DDSD_HEIGHT;
- this->height = h;
-}
-
-void DDSHeader::setDepth(uint d)
-{
- this->flags |= DDSD_DEPTH;
- this->depth = d;
-}
-
-void DDSHeader::setMipmapCount(uint count)
-{
- if (count == 0 || count == 1)
- {
- this->flags &= ~DDSD_MIPMAPCOUNT;
- this->mipmapcount = 0;
-
- if (this->caps.caps2 == 0) {
- this->caps.caps1 = DDSCAPS_TEXTURE;
- }
- else {
- this->caps.caps1 = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX;
- }
- }
- else
- {
- this->flags |= DDSD_MIPMAPCOUNT;
- this->mipmapcount = count;
-
- this->caps.caps1 |= DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
- }
-}
-
-void DDSHeader::setTexture2D()
-{
- this->header10.resourceDimension = D3D10_RESOURCE_DIMENSION_TEXTURE2D;
- this->header10.arraySize = 1;
-}
-
-void DDSHeader::setTexture3D()
-{
- this->caps.caps2 = DDSCAPS2_VOLUME;
-
- this->header10.resourceDimension = D3D10_RESOURCE_DIMENSION_TEXTURE3D;
- this->header10.arraySize = 1;
-}
-
-void DDSHeader::setTextureCube()
-{
- this->caps.caps1 |= DDSCAPS_COMPLEX;
- this->caps.caps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_ALL_FACES;
-
- this->header10.resourceDimension = D3D10_RESOURCE_DIMENSION_TEXTURE2D;
- this->header10.arraySize = 6;
-}
-
-void DDSHeader::setLinearSize(uint size)
-{
- this->flags &= ~DDSD_PITCH;
- this->flags |= DDSD_LINEARSIZE;
- this->pitch = size;
-}
-
-void DDSHeader::setPitch(uint pitch)
-{
- this->flags &= ~DDSD_LINEARSIZE;
- this->flags |= DDSD_PITCH;
- this->pitch = pitch;
-}
-
-void DDSHeader::setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3)
-{
- // set fourcc pixel format.
- this->pf.flags = DDPF_FOURCC;
- this->pf.fourcc = MAKEFOURCC(c0, c1, c2, c3);
-
- this->pf.bitcount = 0;
- this->pf.rmask = 0;
- this->pf.gmask = 0;
- this->pf.bmask = 0;
- this->pf.amask = 0;
-}
-
-void DDSHeader::setFormatCode(uint32 code)
-{
- // set fourcc pixel format.
- this->pf.flags = DDPF_FOURCC;
- this->pf.fourcc = code;
-
- this->pf.bitcount = 0;
- this->pf.rmask = 0;
- this->pf.gmask = 0;
- this->pf.bmask = 0;
- this->pf.amask = 0;
-}
-
-void DDSHeader::setSwizzleCode(uint8 c0, uint8 c1, uint8 c2, uint8 c3)
-{
- this->pf.bitcount = MAKEFOURCC(c0, c1, c2, c3);
-}
-
-
-void DDSHeader::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
-{
- // Make sure the masks are correct.
- nvCheck((rmask & gmask) == 0);
- nvCheck((rmask & bmask) == 0);
- nvCheck((rmask & amask) == 0);
- nvCheck((gmask & bmask) == 0);
- nvCheck((gmask & amask) == 0);
- nvCheck((bmask & amask) == 0);
-
- this->pf.flags = DDPF_RGB;
-
- if (amask != 0) {
- this->pf.flags |= DDPF_ALPHAPIXELS;
- }
-
- if (bitcount == 0)
- {
- // Compute bit count from the masks.
- uint total = rmask | gmask | bmask | amask;
- while(total != 0) {
- bitcount++;
- total >>= 1;
- }
- }
-
- nvCheck(bitcount > 0 && bitcount <= 32);
-
- // Align to 8.
- if (bitcount <= 8) bitcount = 8;
- else if (bitcount <= 16) bitcount = 16;
- else if (bitcount <= 24) bitcount = 24;
- else bitcount = 32;
-
- this->pf.fourcc = 0; //findD3D9Format(bitcount, rmask, gmask, bmask, amask);
- this->pf.bitcount = bitcount;
- this->pf.rmask = rmask;
- this->pf.gmask = gmask;
- this->pf.bmask = bmask;
- this->pf.amask = amask;
-}
-
-void DDSHeader::setDX10Format(uint format)
-{
- //this->pf.flags = 0;
- this->pf.fourcc = FOURCC_DX10;
- this->header10.dxgiFormat = format;
-}
-
-void DDSHeader::setNormalFlag(bool b)
-{
- if (b) this->pf.flags |= DDPF_NORMAL;
- else this->pf.flags &= ~DDPF_NORMAL;
-}
-
-void DDSHeader::swapBytes()
-{
- this->fourcc = POSH_LittleU32(this->fourcc);
- this->size = POSH_LittleU32(this->size);
- this->flags = POSH_LittleU32(this->flags);
- this->height = POSH_LittleU32(this->height);
- this->width = POSH_LittleU32(this->width);
- this->pitch = POSH_LittleU32(this->pitch);
- this->depth = POSH_LittleU32(this->depth);
- this->mipmapcount = POSH_LittleU32(this->mipmapcount);
-
- for(int i = 0; i < 11; i++) {
- this->reserved[i] = POSH_LittleU32(this->reserved[i]);
- }
-
- this->pf.size = POSH_LittleU32(this->pf.size);
- this->pf.flags = POSH_LittleU32(this->pf.flags);
- this->pf.fourcc = POSH_LittleU32(this->pf.fourcc);
- this->pf.bitcount = POSH_LittleU32(this->pf.bitcount);
- this->pf.rmask = POSH_LittleU32(this->pf.rmask);
- this->pf.gmask = POSH_LittleU32(this->pf.gmask);
- this->pf.bmask = POSH_LittleU32(this->pf.bmask);
- this->pf.amask = POSH_LittleU32(this->pf.amask);
- this->caps.caps1 = POSH_LittleU32(this->caps.caps1);
- this->caps.caps2 = POSH_LittleU32(this->caps.caps2);
- this->caps.caps3 = POSH_LittleU32(this->caps.caps3);
- this->caps.caps4 = POSH_LittleU32(this->caps.caps4);
- this->notused = POSH_LittleU32(this->notused);
-
- this->header10.dxgiFormat = POSH_LittleU32(this->header10.dxgiFormat);
- this->header10.resourceDimension = POSH_LittleU32(this->header10.resourceDimension);
- this->header10.miscFlag = POSH_LittleU32(this->header10.miscFlag);
- this->header10.arraySize = POSH_LittleU32(this->header10.arraySize);
- this->header10.reserved = POSH_LittleU32(this->header10.reserved);
-}
-
-bool DDSHeader::hasDX10Header() const
-{
- return this->pf.fourcc == FOURCC_DX10; // @@ This is according to AMD
- //return this->pf.flags == 0; // @@ This is according to MS
-}
-
-
-
-DirectDrawSurface::DirectDrawSurface(const char * name) : stream(new StdInputStream(name))
-{
- if (!stream->isError())
- {
- (*stream) << header;
- }
-}
-
-DirectDrawSurface::~DirectDrawSurface()
-{
- delete stream;
-}
-
-bool DirectDrawSurface::isValid() const
-{
- if (stream->isError())
- {
- return false;
- }
-
- if (header.fourcc != FOURCC_DDS || header.size != 124)
- {
- return false;
- }
-
- const uint required = (DDSD_WIDTH|DDSD_HEIGHT/*|DDSD_CAPS|DDSD_PIXELFORMAT*/);
- if( (header.flags & required) != required ) {
- return false;
- }
-
- if (header.pf.size != 32) {
- return false;
- }
-
- if( !(header.caps.caps1 & DDSCAPS_TEXTURE) ) {
- return false;
- }
-
- return true;
-}
-
-bool DirectDrawSurface::isSupported() const
-{
- nvDebugCheck(isValid());
-
- if (header.hasDX10Header())
- {
- if (header.header10.dxgiFormat == DXGI_FORMAT_BC1_UNORM ||
- header.header10.dxgiFormat == DXGI_FORMAT_BC2_UNORM ||
- header.header10.dxgiFormat == DXGI_FORMAT_BC3_UNORM ||
- header.header10.dxgiFormat == DXGI_FORMAT_BC4_UNORM ||
- header.header10.dxgiFormat == DXGI_FORMAT_BC5_UNORM)
- {
- return true;
- }
-
- return false;
- }
- else
- {
- if (header.pf.flags & DDPF_FOURCC)
- {
- if (header.pf.fourcc != FOURCC_DXT1 &&
- header.pf.fourcc != FOURCC_DXT2 &&
- header.pf.fourcc != FOURCC_DXT3 &&
- header.pf.fourcc != FOURCC_DXT4 &&
- header.pf.fourcc != FOURCC_DXT5 &&
- header.pf.fourcc != FOURCC_RXGB &&
- header.pf.fourcc != FOURCC_ATI1 &&
- header.pf.fourcc != FOURCC_ATI2)
- {
- // Unknown fourcc code.
- return false;
- }
- }
- else if (header.pf.flags & DDPF_RGB)
- {
- // All RGB formats are supported now.
- }
- else
- {
- return false;
- }
-
- if (isTextureCube() && (header.caps.caps2 & DDSCAPS2_CUBEMAP_ALL_FACES) != DDSCAPS2_CUBEMAP_ALL_FACES)
- {
- // Cubemaps must contain all faces.
- return false;
- }
-
- if (isTexture3D())
- {
- // @@ 3D textures not supported yet.
- return false;
- }
- }
-
- return true;
-}
-
-bool DirectDrawSurface::hasAlpha() const
-{
- if (header.hasDX10Header())
- {
- // @@ TODO: Update with all formats.
- return
- header.header10.dxgiFormat == DXGI_FORMAT_BC1_UNORM ||
- header.header10.dxgiFormat == DXGI_FORMAT_BC2_UNORM ||
- header.header10.dxgiFormat == DXGI_FORMAT_BC3_UNORM;
- }
- else
- {
- if (header.pf.flags & DDPF_RGB)
- {
- return header.pf.amask != 0;
- }
- else if (header.pf.flags & DDPF_FOURCC)
- {
- if (header.pf.fourcc == FOURCC_RXGB ||
- header.pf.fourcc == FOURCC_ATI1 ||
- header.pf.fourcc == FOURCC_ATI2 ||
- header.pf.flags & DDPF_NORMAL)
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- return false;
- }
-}
-
-uint DirectDrawSurface::mipmapCount() const
-{
- nvDebugCheck(isValid());
- if (header.flags & DDSD_MIPMAPCOUNT) return header.mipmapcount;
- else return 1;
-}
-
-
-uint DirectDrawSurface::width() const
-{
- nvDebugCheck(isValid());
- if (header.flags & DDSD_WIDTH) return header.width;
- else return 1;
-}
-
-uint DirectDrawSurface::height() const
-{
- nvDebugCheck(isValid());
- if (header.flags & DDSD_HEIGHT) return header.height;
- else return 1;
-}
-
-uint DirectDrawSurface::depth() const
-{
- nvDebugCheck(isValid());
- if (header.flags & DDSD_DEPTH) return header.depth;
- else return 1;
-}
-
-bool DirectDrawSurface::isTexture1D() const
-{
- nvDebugCheck(isValid());
- if (header.hasDX10Header())
- {
- return header.header10.resourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE1D;
- }
- return false;
-}
-
-bool DirectDrawSurface::isTexture2D() const
-{
- nvDebugCheck(isValid());
- if (header.hasDX10Header())
- {
- return header.header10.resourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE2D;
- }
- else
- {
- return !isTexture3D() && !isTextureCube();
- }
-}
-
-bool DirectDrawSurface::isTexture3D() const
-{
- nvDebugCheck(isValid());
- if (header.hasDX10Header())
- {
- return header.header10.resourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE3D;
- }
- else
- {
- return (header.caps.caps2 & DDSCAPS2_VOLUME) != 0;
- }
-}
-
-bool DirectDrawSurface::isTextureCube() const
-{
- nvDebugCheck(isValid());
- return (header.caps.caps2 & DDSCAPS2_CUBEMAP) != 0;
-}
-
-void DirectDrawSurface::setNormalFlag(bool b)
-{
- nvDebugCheck(isValid());
- header.setNormalFlag(b);
-}
-
-void DirectDrawSurface::mipmap(Image * img, uint face, uint mipmap)
-{
- nvDebugCheck(isValid());
-
- stream->seek(offset(face, mipmap));
-
- uint w = width();
- uint h = height();
-
- // Compute width and height.
- for (uint m = 0; m < mipmap; m++)
- {
- w = max(1U, w / 2);
- h = max(1U, h / 2);
- }
-
- img->allocate(w, h);
-
- if (hasAlpha())
- {
- img->setFormat(Image::Format_ARGB);
- }
- else
- {
- img->setFormat(Image::Format_RGB);
- }
-
- if (header.hasDX10Header())
- {
- // So far only block formats supported.
- readBlockImage(img);
- }
- else
- {
- if (header.pf.flags & DDPF_RGB)
- {
- readLinearImage(img);
- }
- else if (header.pf.flags & DDPF_FOURCC)
- {
- readBlockImage(img);
- }
- }
-}
-
-void DirectDrawSurface::readLinearImage(Image * img)
-{
- nvDebugCheck(stream != NULL);
- nvDebugCheck(img != NULL);
-
- const uint w = img->width();
- const uint h = img->height();
-
- uint rshift, rsize;
- PixelFormat::maskShiftAndSize(header.pf.rmask, &rshift, &rsize);
-
- uint gshift, gsize;
- PixelFormat::maskShiftAndSize(header.pf.gmask, &gshift, &gsize);
-
- uint bshift, bsize;
- PixelFormat::maskShiftAndSize(header.pf.bmask, &bshift, &bsize);
-
- uint ashift, asize;
- PixelFormat::maskShiftAndSize(header.pf.amask, &ashift, &asize);
-
- uint byteCount = (header.pf.bitcount + 7) / 8;
-
- // Read linear RGB images.
- for (uint y = 0; y < h; y++)
- {
- for (uint x = 0; x < w; x++)
- {
- uint c = 0;
- stream->serialize(&c, byteCount);
-
- Color32 pixel(0, 0, 0, 0xFF);
- pixel.r = PixelFormat::convert(c >> rshift, rsize, 8);
- pixel.g = PixelFormat::convert(c >> gshift, gsize, 8);
- pixel.b = PixelFormat::convert(c >> bshift, bsize, 8);
- pixel.a = PixelFormat::convert(c >> ashift, asize, 8);
-
- img->pixel(x, y) = pixel;
- }
- }
-}
-
-void DirectDrawSurface::readBlockImage(Image * img)
-{
- nvDebugCheck(stream != NULL);
- nvDebugCheck(img != NULL);
-
- const uint w = img->width();
- const uint h = img->height();
-
- const uint bw = (w + 3) / 4;
- const uint bh = (h + 3) / 4;
-
- for (uint by = 0; by < bh; by++)
- {
- for (uint bx = 0; bx < bw; bx++)
- {
- ColorBlock block;
-
- // Read color block.
- readBlock(&block);
-
- // Write color block.
- for (uint y = 0; y < min(4U, h-4*by); y++)
- {
- for (uint x = 0; x < min(4U, w-4*bx); x++)
- {
- img->pixel(4*bx+x, 4*by+y) = block.color(x, y);
- }
- }
- }
- }
-}
-
-static Color32 buildNormal(uint8 x, uint8 y)
-{
- float nx = 2 * (x / 255.0f) - 1;
- float ny = 2 * (y / 255.0f) - 1;
- float nz = 0.0f;
- if (1 - nx*nx - ny*ny > 0) nz = sqrtf(1 - nx*nx - ny*ny);
- uint8 z = clamp(int(255.0f * (nz + 1) / 2.0f), 0, 255);
-
- return Color32(x, y, z);
-}
-
-
-void DirectDrawSurface::readBlock(ColorBlock * rgba)
-{
- nvDebugCheck(stream != NULL);
- nvDebugCheck(rgba != NULL);
-
- uint fourcc = header.pf.fourcc;
-
- // Map DX10 block formats to fourcc codes.
- if (header.hasDX10Header())
- {
- if (header.header10.dxgiFormat == DXGI_FORMAT_BC1_UNORM) fourcc = FOURCC_DXT1;
- if (header.header10.dxgiFormat == DXGI_FORMAT_BC2_UNORM) fourcc = FOURCC_DXT3;
- if (header.header10.dxgiFormat == DXGI_FORMAT_BC3_UNORM) fourcc = FOURCC_DXT5;
- if (header.header10.dxgiFormat == DXGI_FORMAT_BC4_UNORM) fourcc = FOURCC_ATI1;
- if (header.header10.dxgiFormat == DXGI_FORMAT_BC5_UNORM) fourcc = FOURCC_ATI2;
- }
-
-
- if (fourcc == FOURCC_DXT1)
- {
- BlockDXT1 block;
- *stream << block;
- block.decodeBlock(rgba);
- }
- else if (fourcc == FOURCC_DXT2 ||
- header.pf.fourcc == FOURCC_DXT3)
- {
- BlockDXT3 block;
- *stream << block;
- block.decodeBlock(rgba);
- }
- else if (fourcc == FOURCC_DXT4 ||
- header.pf.fourcc == FOURCC_DXT5 ||
- header.pf.fourcc == FOURCC_RXGB)
- {
- BlockDXT5 block;
- *stream << block;
- block.decodeBlock(rgba);
-
- if (fourcc == FOURCC_RXGB)
- {
- // Swap R & A.
- for (int i = 0; i < 16; i++)
- {
- Color32 & c = rgba->color(i);
- uint tmp = c.r;
- c.r = c.a;
- c.a = tmp;
- }
- }
- }
- else if (fourcc == FOURCC_ATI1)
- {
- BlockATI1 block;
- *stream << block;
- block.decodeBlock(rgba);
- }
- else if (fourcc == FOURCC_ATI2)
- {
- BlockATI2 block;
- *stream << block;
- block.decodeBlock(rgba);
- }
-
- // If normal flag set, convert to normal.
- if (header.pf.flags & DDPF_NORMAL)
- {
- if (fourcc == FOURCC_ATI2)
- {
- for (int i = 0; i < 16; i++)
- {
- Color32 & c = rgba->color(i);
- c = buildNormal(c.r, c.g);
- }
- }
- else if (fourcc == FOURCC_DXT5)
- {
- for (int i = 0; i < 16; i++)
- {
- Color32 & c = rgba->color(i);
- c = buildNormal(c.a, c.g);
- }
- }
- }
-}
-
-
-uint DirectDrawSurface::blockSize() const
-{
- switch(header.pf.fourcc)
- {
- case FOURCC_DXT1:
- case FOURCC_ATI1:
- return 8;
- case FOURCC_DXT2:
- case FOURCC_DXT3:
- case FOURCC_DXT4:
- case FOURCC_DXT5:
- case FOURCC_RXGB:
- case FOURCC_ATI2:
- return 16;
- case FOURCC_DX10:
- switch(header.header10.dxgiFormat)
- {
- case DXGI_FORMAT_BC1_TYPELESS:
- case DXGI_FORMAT_BC1_UNORM:
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- case DXGI_FORMAT_BC4_TYPELESS:
- case DXGI_FORMAT_BC4_UNORM:
- case DXGI_FORMAT_BC4_SNORM:
- return 8;
- case DXGI_FORMAT_BC2_TYPELESS:
- case DXGI_FORMAT_BC2_UNORM:
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- case DXGI_FORMAT_BC3_TYPELESS:
- case DXGI_FORMAT_BC3_UNORM:
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- case DXGI_FORMAT_BC5_TYPELESS:
- case DXGI_FORMAT_BC5_UNORM:
- case DXGI_FORMAT_BC5_SNORM:
- return 16;
- };
- };
-
- // Not a block image.
- return 0;
-}
-
-uint DirectDrawSurface::mipmapSize(uint mipmap) const
-{
- uint w = width();
- uint h = height();
- uint d = depth();
-
- for (uint m = 0; m < mipmap; m++)
- {
- w = max(1U, w / 2);
- h = max(1U, h / 2);
- d = max(1U, d / 2);
- }
-
- if (header.pf.flags & DDPF_FOURCC)
- {
- // @@ How are 3D textures aligned?
- w = (w + 3) / 4;
- h = (h + 3) / 4;
- return blockSize() * w * h;
- }
- else
- {
- nvDebugCheck(header.pf.flags & DDPF_RGB);
-
- // Align pixels to bytes.
- uint byteCount = (header.pf.bitcount + 7) / 8;
-
- // Align pitch to 4 bytes.
- uint pitch = 4 * ((w * byteCount + 3) / 4);
-
- return pitch * h * d;
- }
-}
-
-uint DirectDrawSurface::faceSize() const
-{
- const uint count = mipmapCount();
- uint size = 0;
-
- for (uint m = 0; m < count; m++)
- {
- size += mipmapSize(m);
- }
-
- return size;
-}
-
-uint DirectDrawSurface::offset(const uint face, const uint mipmap)
-{
- uint size = 128; // sizeof(DDSHeader);
-
- if (header.hasDX10Header())
- {
- size += 20; // sizeof(DDSHeader10);
- }
-
- if (face != 0)
- {
- size += face * faceSize();
- }
-
- for (uint m = 0; m < mipmap; m++)
- {
- size += mipmapSize(m);
- }
-
- return size;
-}
-
-
-void DirectDrawSurface::printInfo() const
-{
- printf("Flags: 0x%.8X\n", header.flags);
- if (header.flags & DDSD_CAPS) printf("\tDDSD_CAPS\n");
- if (header.flags & DDSD_PIXELFORMAT) printf("\tDDSD_PIXELFORMAT\n");
- if (header.flags & DDSD_WIDTH) printf("\tDDSD_WIDTH\n");
- if (header.flags & DDSD_HEIGHT) printf("\tDDSD_HEIGHT\n");
- if (header.flags & DDSD_DEPTH) printf("\tDDSD_DEPTH\n");
- if (header.flags & DDSD_PITCH) printf("\tDDSD_PITCH\n");
- if (header.flags & DDSD_LINEARSIZE) printf("\tDDSD_LINEARSIZE\n");
- if (header.flags & DDSD_MIPMAPCOUNT) printf("\tDDSD_MIPMAPCOUNT\n");
-
- printf("Height: %d\n", header.height);
- printf("Width: %d\n", header.width);
- printf("Depth: %d\n", header.depth);
- if (header.flags & DDSD_PITCH) printf("Pitch: %d\n", header.pitch);
- else if (header.flags & DDSD_LINEARSIZE) printf("Linear size: %d\n", header.pitch);
- printf("Mipmap count: %d\n", header.mipmapcount);
-
- printf("Pixel Format:\n");
- printf("\tFlags: 0x%.8X\n", header.pf.flags);
- if (header.pf.flags & DDPF_RGB) printf("\t\tDDPF_RGB\n");
- if (header.pf.flags & DDPF_FOURCC) printf("\t\tDDPF_FOURCC\n");
- if (header.pf.flags & DDPF_ALPHAPIXELS) printf("\t\tDDPF_ALPHAPIXELS\n");
- if (header.pf.flags & DDPF_ALPHA) printf("\t\tDDPF_ALPHA\n");
- if (header.pf.flags & DDPF_PALETTEINDEXED1) printf("\t\tDDPF_PALETTEINDEXED1\n");
- if (header.pf.flags & DDPF_PALETTEINDEXED2) printf("\t\tDDPF_PALETTEINDEXED2\n");
- if (header.pf.flags & DDPF_PALETTEINDEXED4) printf("\t\tDDPF_PALETTEINDEXED4\n");
- if (header.pf.flags & DDPF_PALETTEINDEXED8) printf("\t\tDDPF_PALETTEINDEXED8\n");
- if (header.pf.flags & DDPF_ALPHAPREMULT) printf("\t\tDDPF_ALPHAPREMULT\n");
- if (header.pf.flags & DDPF_NORMAL) printf("\t\tDDPF_NORMAL\n");
-
- printf("\tFourCC: '%c%c%c%c'\n",
- ((header.pf.fourcc >> 0) & 0xFF),
- ((header.pf.fourcc >> 8) & 0xFF),
- ((header.pf.fourcc >> 16) & 0xFF),
- ((header.pf.fourcc >> 24) & 0xFF));
- if ((header.pf.fourcc & DDPF_FOURCC) && (header.pf.bitcount != 0))
- {
- printf("\tSwizzle: '%c%c%c%c'\n",
- (header.pf.bitcount >> 0) & 0xFF,
- (header.pf.bitcount >> 8) & 0xFF,
- (header.pf.bitcount >> 16) & 0xFF,
- (header.pf.bitcount >> 24) & 0xFF);
- }
- else
- {
- printf("\tBit count: %d\n", header.pf.bitcount);
- }
- printf("\tRed mask: 0x%.8X\n", header.pf.rmask);
- printf("\tGreen mask: 0x%.8X\n", header.pf.gmask);
- printf("\tBlue mask: 0x%.8X\n", header.pf.bmask);
- printf("\tAlpha mask: 0x%.8X\n", header.pf.amask);
-
- printf("Caps:\n");
- printf("\tCaps 1: 0x%.8X\n", header.caps.caps1);
- if (header.caps.caps1 & DDSCAPS_COMPLEX) printf("\t\tDDSCAPS_COMPLEX\n");
- if (header.caps.caps1 & DDSCAPS_TEXTURE) printf("\t\tDDSCAPS_TEXTURE\n");
- if (header.caps.caps1 & DDSCAPS_MIPMAP) printf("\t\tDDSCAPS_MIPMAP\n");
-
- printf("\tCaps 2: 0x%.8X\n", header.caps.caps2);
- if (header.caps.caps2 & DDSCAPS2_VOLUME) printf("\t\tDDSCAPS2_VOLUME\n");
- else if (header.caps.caps2 & DDSCAPS2_CUBEMAP)
- {
- printf("\t\tDDSCAPS2_CUBEMAP\n");
- if ((header.caps.caps2 & DDSCAPS2_CUBEMAP_ALL_FACES) == DDSCAPS2_CUBEMAP_ALL_FACES) printf("\t\tDDSCAPS2_CUBEMAP_ALL_FACES\n");
- else {
- if (header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEX) printf("\t\tDDSCAPS2_CUBEMAP_POSITIVEX\n");
- if (header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEX) printf("\t\tDDSCAPS2_CUBEMAP_NEGATIVEX\n");
- if (header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEY) printf("\t\tDDSCAPS2_CUBEMAP_POSITIVEY\n");
- if (header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEY) printf("\t\tDDSCAPS2_CUBEMAP_NEGATIVEY\n");
- if (header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEZ) printf("\t\tDDSCAPS2_CUBEMAP_POSITIVEZ\n");
- if (header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEZ) printf("\t\tDDSCAPS2_CUBEMAP_NEGATIVEZ\n");
- }
- }
-
- printf("\tCaps 3: 0x%.8X\n", header.caps.caps3);
- printf("\tCaps 4: 0x%.8X\n", header.caps.caps4);
-
- if (header.hasDX10Header())
- {
- printf("DX10 Header:\n");
- printf("\tDXGI Format: %u (%s)\n", header.header10.dxgiFormat, getDxgiFormatString((DXGI_FORMAT)header.header10.dxgiFormat));
- printf("\tResource dimension: %u (%s)\n", header.header10.resourceDimension, getD3d10ResourceDimensionString((D3D10_RESOURCE_DIMENSION)header.header10.resourceDimension));
- printf("\tMisc flag: %u\n", header.header10.miscFlag);
- printf("\tArray size: %u\n", header.header10.arraySize);
- }
-
- if (header.reserved[9] == MAKEFOURCC('N', 'V', 'T', 'T'))
- {
- int major = (header.reserved[10] >> 16) & 0xFF;
- int minor = (header.reserved[10] >> 8) & 0xFF;
- int revision= header.reserved[10] & 0xFF;
-
- printf("Version:\n");
- printf("\tNVIDIA Texture Tools %d.%d.%d\n", major, minor, revision);
- }
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/DirectDrawSurface.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/DirectDrawSurface.h
deleted file mode 100644
index 918a6f91..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/DirectDrawSurface.h
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_IMAGE_DIRECTDRAWSURFACE_H
-#define NV_IMAGE_DIRECTDRAWSURFACE_H
-
-#include <nvimage/nvimage.h>
-
-namespace nv
-{
- class Image;
- class Stream;
- struct ColorBlock;
-
- struct NVIMAGE_CLASS DDSPixelFormat
- {
- uint size;
- uint flags;
- uint fourcc;
- uint bitcount;
- uint rmask;
- uint gmask;
- uint bmask;
- uint amask;
- };
-
- struct NVIMAGE_CLASS DDSCaps
- {
- uint caps1;
- uint caps2;
- uint caps3;
- uint caps4;
- };
-
- /// DDS file header for DX10.
- struct NVIMAGE_CLASS DDSHeader10
- {
- uint dxgiFormat;
- uint resourceDimension;
- uint miscFlag;
- uint arraySize;
- uint reserved;
- };
-
- /// DDS file header.
- struct NVIMAGE_CLASS DDSHeader
- {
- uint fourcc;
- uint size;
- uint flags;
- uint height;
- uint width;
- uint pitch;
- uint depth;
- uint mipmapcount;
- uint reserved[11];
- DDSPixelFormat pf;
- DDSCaps caps;
- uint notused;
- DDSHeader10 header10;
-
-
- // Helper methods.
- DDSHeader();
-
- void setWidth(uint w);
- void setHeight(uint h);
- void setDepth(uint d);
- void setMipmapCount(uint count);
- void setTexture2D();
- void setTexture3D();
- void setTextureCube();
- void setLinearSize(uint size);
- void setPitch(uint pitch);
- void setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3);
- void setFormatCode(uint code);
- void setSwizzleCode(uint8 c0, uint8 c1, uint8 c2, uint8 c3);
- void setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask);
- void setDX10Format(uint format);
- void setNormalFlag(bool b);
-
- void swapBytes();
-
- bool hasDX10Header() const;
- };
-
- NVIMAGE_API Stream & operator<< (Stream & s, DDSHeader & header);
-
-
- /// DirectDraw Surface. (DDS)
- class NVIMAGE_CLASS DirectDrawSurface
- {
- public:
- DirectDrawSurface(const char * file);
- ~DirectDrawSurface();
-
- bool isValid() const;
- bool isSupported() const;
-
- bool hasAlpha() const;
-
- uint mipmapCount() const;
- uint width() const;
- uint height() const;
- uint depth() const;
- bool isTexture1D() const;
- bool isTexture2D() const;
- bool isTexture3D() const;
- bool isTextureCube() const;
-
- void setNormalFlag(bool b);
-
- void mipmap(Image * img, uint f, uint m);
- // void mipmap(FloatImage * img, uint f, uint m);
-
- void printInfo() const;
-
- private:
-
- uint blockSize() const;
- uint faceSize() const;
- uint mipmapSize(uint m) const;
-
- uint offset(uint f, uint m);
-
- void readLinearImage(Image * img);
- void readBlockImage(Image * img);
- void readBlock(ColorBlock * rgba);
-
-
- private:
- Stream * const stream;
- DDSHeader header;
- DDSHeader10 header10;
- };
-
-} // nv namespace
-
-#endif // NV_IMAGE_DIRECTDRAWSURFACE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/Filter.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/Filter.cpp
deleted file mode 100644
index 8edddfa1..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/Filter.cpp
+++ /dev/null
@@ -1,605 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-/** @file Filter.cpp
- * @brief Image filters.
- *
- * Jonathan Blow articles:
- * http://number-none.com/product/Mipmapping, Part 1/index.html
- * http://number-none.com/product/Mipmapping, Part 2/index.html
- *
- * References from Thacher Ulrich:
- * See _Graphics Gems III_ "General Filtered Image Rescaling", Dale A. Schumacher
- * http://tog.acm.org/GraphicsGems/gemsiii/filter.c
- *
- * References from Paul Heckbert:
- * A.V. Oppenheim, R.W. Schafer, Digital Signal Processing, Prentice-Hall, 1975
- *
- * R.W. Hamming, Digital Filters, Prentice-Hall, Englewood Cliffs, NJ, 1983
- *
- * W.K. Pratt, Digital Image Processing, John Wiley and Sons, 1978
- *
- * H.S. Hou, H.C. Andrews, "Cubic Splines for Image Interpolation and
- * Digital Filtering", IEEE Trans. Acoustics, Speech, and Signal Proc.,
- * vol. ASSP-26, no. 6, Dec. 1978, pp. 508-517
- *
- * Paul Heckbert's zoom library.
- * http://www.xmission.com/~legalize/zoom.html
- *
- * Reconstruction Filters in Computer Graphics
- * http://www.mentallandscape.com/Papers_siggraph88.pdf
- *
- * More references:
- * http://www.worldserver.com/turk/computergraphics/ResamplingFilters.pdf
- * http://www.dspguide.com/ch16.htm
- */
-
-#include "Filter.h"
-
-#include <nvmath/Vector.h> // Vector4
-#include <nvcore/Containers.h> // swap
-
-using namespace nv;
-
-namespace
-{
- // Sinc function.
- inline static float sincf(const float x)
- {
- if (fabs(x) < NV_EPSILON) {
- //return 1.0;
- return 1.0f + x*x*(-1.0f/6.0f + x*x*1.0f/120.0f);
- }
- else {
- return sin(x) / x;
- }
- }
-
- // Bessel function of the first kind from Jon Blow's article.
- // http://mathworld.wolfram.com/BesselFunctionoftheFirstKind.html
- // http://en.wikipedia.org/wiki/Bessel_function
- inline static float bessel0(float x)
- {
- const float EPSILON_RATIO = 1e-6f;
- float xh, sum, pow, ds;
- int k;
-
- xh = 0.5f * x;
- sum = 1.0f;
- pow = 1.0f;
- k = 0;
- ds = 1.0;
- while (ds > sum * EPSILON_RATIO) {
- ++k;
- pow = pow * (xh / k);
- ds = pow * pow;
- sum = sum + ds;
- }
-
- return sum;
- }
-
- /*// Alternative bessel function from Paul Heckbert.
- static float _bessel0(float x)
- {
- const float EPSILON_RATIO = 1E-6;
- float sum = 1.0f;
- float y = x * x / 4.0f;
- float t = y;
- for(int i = 2; t > EPSILON_RATIO; i++) {
- sum += t;
- t *= y / float(i * i);
- }
- return sum;
- }*/
-
-} // namespace
-
-
-Filter::Filter(float width) : m_width(width)
-{
-}
-
-/*virtual*/ Filter::~Filter()
-{
-}
-
-float Filter::sampleDelta(float x, float scale) const
-{
- return evaluate((x + 0.5f)* scale);
-}
-
-float Filter::sampleBox(float x, float scale, int samples) const
-{
- float sum = 0;
- float isamples = 1.0f / float(samples);
-
- for(int s = 0; s < samples; s++)
- {
- float p = (x + (float(s) + 0.5f) * isamples) * scale;
- float value = evaluate(p);
- sum += value;
- }
-
- return sum * isamples;
-}
-
-float Filter::sampleTriangle(float x, float scale, int samples) const
-{
- float sum = 0;
- float isamples = 1.0f / float(samples);
-
- for(int s = 0; s < samples; s++)
- {
- float offset = (2 * float(s) + 1.0f) * isamples;
- float p = (x + offset - 0.5f) * scale;
- float value = evaluate(p);
-
- float weight = offset;
- if (weight > 1.0f) weight = 2.0f - weight;
-
- sum += value * weight;
- }
-
- return 2 * sum * isamples;
-}
-
-
-
-
-
-BoxFilter::BoxFilter() : Filter(0.5f) {}
-BoxFilter::BoxFilter(float width) : Filter(width) {}
-
-float BoxFilter::evaluate(float x) const
-{
- if (fabs(x) <= m_width) return 1.0f;
- else return 0.0f;
-}
-
-
-TriangleFilter::TriangleFilter() : Filter(1.0f) {}
-TriangleFilter::TriangleFilter(float width) : Filter(width) {}
-
-float TriangleFilter::evaluate(float x) const
-{
- x = fabs(x);
- if( x < m_width ) return m_width - x;
- return 0.0f;
-}
-
-
-QuadraticFilter::QuadraticFilter() : Filter(1.5f) {}
-
-float QuadraticFilter::evaluate(float x) const
-{
- x = fabs(x);
- if( x < 0.5f ) return 0.75f - x * x;
- if( x < 1.5f ) {
- float t = x - 1.5f;
- return 0.5f * t * t;
- }
- return 0.0f;
-}
-
-
-CubicFilter::CubicFilter() : Filter(1.0f) {}
-
-float CubicFilter::evaluate(float x) const
-{
- // f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1
- x = fabs(x);
- if( x < 1.0f ) return((2.0f * x - 3.0f) * x * x + 1.0f);
- return 0.0f;
-}
-
-
-BSplineFilter::BSplineFilter() : Filter(2.0f) {}
-
-float BSplineFilter::evaluate(float x) const
-{
- x = fabs(x);
- if( x < 1.0f ) return (4.0f + x * x * (-6.0f + x * 3.0f)) / 6.0f;
- if( x < 2.0f ) {
- float t = 2.0f - x;
- return t * t * t / 6.0f;
- }
- return 0.0f;
-}
-
-
-MitchellFilter::MitchellFilter() : Filter(2.0f) { setParameters(1.0f/3.0f, 1.0f/3.0f); }
-
-float MitchellFilter::evaluate(float x) const
-{
- x = fabs(x);
- if( x < 1.0f ) return p0 + x * x * (p2 + x * p3);
- if( x < 2.0f ) return q0 + x * (q1 + x * (q2 + x * q3));
- return 0.0f;
-}
-
-void MitchellFilter::setParameters(float b, float c)
-{
- p0 = (6.0f - 2.0f * b) / 6.0f;
- p2 = (-18.0f + 12.0f * b + 6.0f * c) / 6.0f;
- p3 = (12.0f - 9.0f * b - 6.0f * c) / 6.0f;
- q0 = (8.0f * b + 24.0f * c) / 6.0f;
- q1 = (-12.0f * b - 48.0f * c) / 6.0f;
- q2 = (6.0f * b + 30.0f * c) / 6.0f;
- q3 = (-b - 6.0f * c) / 6.0f;
-}
-
-
-LanczosFilter::LanczosFilter() : Filter(3.0f) {}
-
-float LanczosFilter::evaluate(float x) const
-{
- x = fabs(x);
- if( x < 3.0f ) return sincf(PI * x) * sincf(PI * x / 3.0f);
- return 0.0f;
-}
-
-
-SincFilter::SincFilter(float w) : Filter(w) {}
-
-float SincFilter::evaluate(float x) const
-{
- return sincf(PI * x);
-}
-
-
-KaiserFilter::KaiserFilter(float w) : Filter(w) { setParameters(4.0f, 1.0f); }
-
-float KaiserFilter::evaluate(float x) const
-{
- const float sinc_value = sincf(PI * x * stretch);
- const float t = x / m_width;
- if ((1 - t * t) >= 0) return sinc_value * bessel0(alpha * sqrtf(1 - t * t)) / bessel0(alpha);
- else return 0;
-}
-
-void KaiserFilter::setParameters(float alpha, float stretch)
-{
- this->alpha = alpha;
- this->stretch = stretch;
-}
-
-
-
-/// Ctor.
-Kernel1::Kernel1(const Filter & f, int iscale, int samples/*= 32*/)
-{
- nvDebugCheck(iscale > 1);
- nvDebugCheck(samples > 0);
-
- const float scale = 1.0f / iscale;
-
- m_width = f.width() * iscale;
- m_windowSize = (int)ceilf(2 * m_width);
- m_data = new float[m_windowSize];
-
- const float offset = float(m_windowSize) / 2;
-
- float total = 0.0f;
- for (int i = 0; i < m_windowSize; i++)
- {
- const float sample = f.sampleBox(i - offset, scale, samples);
- m_data[i] = sample;
- total += sample;
- }
-
- const float inv = 1.0f / total;
- for (int i = 0; i < m_windowSize; i++)
- {
- m_data[i] *= inv;
- }
-}
-
-/// Dtor.
-Kernel1::~Kernel1()
-{
- delete m_data;
-}
-
-/// Print the kernel for debugging purposes.
-void Kernel1::debugPrint()
-{
- for (int i = 0; i < m_windowSize; i++) {
- nvDebug("%d: %f\n", i, m_data[i]);
- }
-}
-
-
-
-/// Ctor.
-Kernel2::Kernel2(uint ws) : m_windowSize(ws)
-{
- m_data = new float[m_windowSize * m_windowSize];
-}
-
-/// Copy ctor.
-Kernel2::Kernel2(const Kernel2 & k) : m_windowSize(k.m_windowSize)
-{
- m_data = new float[m_windowSize * m_windowSize];
- for (uint i = 0; i < m_windowSize * m_windowSize; i++) {
- m_data[i] = k.m_data[i];
- }
-}
-
-
-/// Dtor.
-Kernel2::~Kernel2()
-{
- delete m_data;
-}
-
-/// Normalize the filter.
-void Kernel2::normalize()
-{
- float total = 0.0f;
- for(uint i = 0; i < m_windowSize*m_windowSize; i++) {
- total += fabs(m_data[i]);
- }
-
- float inv = 1.0f / total;
- for(uint i = 0; i < m_windowSize*m_windowSize; i++) {
- m_data[i] *= inv;
- }
-}
-
-/// Transpose the kernel.
-void Kernel2::transpose()
-{
- for(uint i = 0; i < m_windowSize; i++) {
- for(uint j = i+1; j < m_windowSize; j++) {
- swap(m_data[i*m_windowSize + j], m_data[j*m_windowSize + i]);
- }
- }
-}
-
-/// Init laplacian filter, usually used for sharpening.
-void Kernel2::initLaplacian()
-{
- nvDebugCheck(m_windowSize == 3);
-// m_data[0] = -1; m_data[1] = -1; m_data[2] = -1;
-// m_data[3] = -1; m_data[4] = +8; m_data[5] = -1;
-// m_data[6] = -1; m_data[7] = -1; m_data[8] = -1;
-
- m_data[0] = +0; m_data[1] = -1; m_data[2] = +0;
- m_data[3] = -1; m_data[4] = +4; m_data[5] = -1;
- m_data[6] = +0; m_data[7] = -1; m_data[8] = +0;
-
-// m_data[0] = +1; m_data[1] = -2; m_data[2] = +1;
-// m_data[3] = -2; m_data[4] = +4; m_data[5] = -2;
-// m_data[6] = +1; m_data[7] = -2; m_data[8] = +1;
-}
-
-
-/// Init simple edge detection filter.
-void Kernel2::initEdgeDetection()
-{
- nvCheck(m_windowSize == 3);
- m_data[0] = 0; m_data[1] = 0; m_data[2] = 0;
- m_data[3] =-1; m_data[4] = 0; m_data[5] = 1;
- m_data[6] = 0; m_data[7] = 0; m_data[8] = 0;
-}
-
-/// Init sobel filter.
-void Kernel2::initSobel()
-{
- if (m_windowSize == 3)
- {
- m_data[0] = -1; m_data[1] = 0; m_data[2] = 1;
- m_data[3] = -2; m_data[4] = 0; m_data[5] = 2;
- m_data[6] = -1; m_data[7] = 0; m_data[8] = 1;
- }
- else if (m_windowSize == 5)
- {
- float elements[] = {
- -1, -2, 0, 2, 1,
- -2, -3, 0, 3, 2,
- -3, -4, 0, 4, 3,
- -2, -3, 0, 3, 2,
- -1, -2, 0, 2, 1
- };
-
- for (int i = 0; i < 5*5; i++) {
- m_data[i] = elements[i];
- }
- }
- else if (m_windowSize == 7)
- {
- float elements[] = {
- -1, -2, -3, 0, 3, 2, 1,
- -2, -3, -4, 0, 4, 3, 2,
- -3, -4, -5, 0, 5, 4, 3,
- -4, -5, -6, 0, 6, 5, 4,
- -3, -4, -5, 0, 5, 4, 3,
- -2, -3, -4, 0, 4, 3, 2,
- -1, -2, -3, 0, 3, 2, 1
- };
-
- for (int i = 0; i < 7*7; i++) {
- m_data[i] = elements[i];
- }
- }
- else if (m_windowSize == 9)
- {
- float elements[] = {
- -1, -2, -3, -4, 0, 4, 3, 2, 1,
- -2, -3, -4, -5, 0, 5, 4, 3, 2,
- -3, -4, -5, -6, 0, 6, 5, 4, 3,
- -4, -5, -6, -7, 0, 7, 6, 5, 4,
- -5, -6, -7, -8, 0, 8, 7, 6, 5,
- -4, -5, -6, -7, 0, 7, 6, 5, 4,
- -3, -4, -5, -6, 0, 6, 5, 4, 3,
- -2, -3, -4, -5, 0, 5, 4, 3, 2,
- -1, -2, -3, -4, 0, 4, 3, 2, 1
- };
-
- for (int i = 0; i < 9*9; i++) {
- m_data[i] = elements[i];
- }
- }
-}
-
-/// Init prewitt filter.
-void Kernel2::initPrewitt()
-{
- if (m_windowSize == 3)
- {
- m_data[0] = -1; m_data[1] = 0; m_data[2] = -1;
- m_data[3] = -1; m_data[4] = 0; m_data[5] = -1;
- m_data[6] = -1; m_data[7] = 0; m_data[8] = -1;
- }
- else if (m_windowSize == 5)
- {
- // @@ Is this correct?
- float elements[] = {
- -2, -1, 0, 1, 2,
- -2, -1, 0, 1, 2,
- -2, -1, 0, 1, 2,
- -2, -1, 0, 1, 2,
- -2, -1, 0, 1, 2
- };
-
- for (int i = 0; i < 5*5; i++) {
- m_data[i] = elements[i];
- }
- }
-}
-
-/// Init blended sobel filter.
-void Kernel2::initBlendedSobel(const Vector4 & scale)
-{
- nvCheck(m_windowSize == 9);
-
- {
- const float elements[] = {
- -1, -2, -3, -4, 0, 4, 3, 2, 1,
- -2, -3, -4, -5, 0, 5, 4, 3, 2,
- -3, -4, -5, -6, 0, 6, 5, 4, 3,
- -4, -5, -6, -7, 0, 7, 6, 5, 4,
- -5, -6, -7, -8, 0, 8, 7, 6, 5,
- -4, -5, -6, -7, 0, 7, 6, 5, 4,
- -3, -4, -5, -6, 0, 6, 5, 4, 3,
- -2, -3, -4, -5, 0, 5, 4, 3, 2,
- -1, -2, -3, -4, 0, 4, 3, 2, 1
- };
-
- for (int i = 0; i < 9*9; i++) {
- m_data[i] = elements[i] * scale.w();
- }
- }
- {
- const float elements[] = {
- -1, -2, -3, 0, 3, 2, 1,
- -2, -3, -4, 0, 4, 3, 2,
- -3, -4, -5, 0, 5, 4, 3,
- -4, -5, -6, 0, 6, 5, 4,
- -3, -4, -5, 0, 5, 4, 3,
- -2, -3, -4, 0, 4, 3, 2,
- -1, -2, -3, 0, 3, 2, 1,
- };
-
- for (int i = 0; i < 7; i++) {
- for (int e = 0; e < 7; e++) {
- m_data[(i + 1) * 9 + e + 1] += elements[i * 7 + e] * scale.z();
- }
- }
- }
- {
- const float elements[] = {
- -1, -2, 0, 2, 1,
- -2, -3, 0, 3, 2,
- -3, -4, 0, 4, 3,
- -2, -3, 0, 3, 2,
- -1, -2, 0, 2, 1
- };
-
- for (int i = 0; i < 5; i++) {
- for (int e = 0; e < 5; e++) {
- m_data[(i + 2) * 9 + e + 2] += elements[i * 5 + e] * scale.y();
- }
- }
- }
- {
- const float elements[] = {
- -1, 0, 1,
- -2, 0, 2,
- -1, 0, 1,
- };
-
- for (int i = 0; i < 3; i++) {
- for (int e = 0; e < 3; e++) {
- m_data[(i + 3) * 9 + e + 3] += elements[i * 3 + e] * scale.x();
- }
- }
- }
-}
-
-
-PolyphaseKernel::PolyphaseKernel(const Filter & f, uint srcLength, uint dstLength, int samples/*= 32*/)
-{
- nvDebugCheck(samples > 0);
-
- float scale = float(dstLength) / float(srcLength);
- const float iscale = 1.0f / scale;
-
- if (scale > 1) {
- // Upsampling.
- samples = 1;
- scale = 1;
- }
-
- m_length = dstLength;
- m_width = f.width() * iscale;
- m_windowSize = (int)ceilf(m_width * 2) + 1;
-
- m_data = new float[m_windowSize * m_length];
- memset(m_data, 0, sizeof(float) * m_windowSize * m_length);
-
- for (uint i = 0; i < m_length; i++)
- {
- const float center = (0.5f + i) * iscale;
-
- const int left = (int)floorf(center - m_width);
- const int right = (int)ceilf(center + m_width);
- nvDebugCheck(right - left <= m_windowSize);
-
- float total = 0.0f;
- for (int j = 0; j < m_windowSize; j++)
- {
- const float sample = f.sampleBox(left + j - center, scale, samples);
-
- m_data[i * m_windowSize + j] = sample;
- total += sample;
- }
-
- // normalize weights.
- for (int j = 0; j < m_windowSize; j++)
- {
- m_data[i * m_windowSize + j] /= total;
- }
- }
-}
-
-PolyphaseKernel::~PolyphaseKernel()
-{
- delete [] m_data;
-}
-
-
-/// Print the kernel for debugging purposes.
-void PolyphaseKernel::debugPrint() const
-{
- for (uint i = 0; i < m_length; i++)
- {
- nvDebug("%d: ", i);
- for (int j = 0; j < m_windowSize; j++)
- {
- nvDebug(" %6.4f", m_data[i * m_windowSize + j]);
- }
- nvDebug("\n");
- }
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/Filter.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/Filter.h
deleted file mode 100644
index 89b56065..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/Filter.h
+++ /dev/null
@@ -1,219 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_IMAGE_FILTER_H
-#define NV_IMAGE_FILTER_H
-
-#include <nvimage/nvimage.h>
-#include <nvcore/Debug.h>
-
-namespace nv
-{
- class Vector4;
-
- /// Base filter class.
- class NVIMAGE_CLASS Filter
- {
- public:
- Filter(float width);
- virtual ~Filter();
-
- float width() const { return m_width; }
- float sampleDelta(float x, float scale) const;
- float sampleBox(float x, float scale, int samples) const;
- float sampleTriangle(float x, float scale, int samples) const;
-
- virtual float evaluate(float x) const = 0;
-
- protected:
- const float m_width;
- };
-
- // Box filter.
- class NVIMAGE_CLASS BoxFilter : public Filter
- {
- public:
- BoxFilter();
- BoxFilter(float width);
- virtual float evaluate(float x) const;
- };
-
- // Triangle (bilinear/tent) filter.
- class NVIMAGE_CLASS TriangleFilter : public Filter
- {
- public:
- TriangleFilter();
- TriangleFilter(float width);
- virtual float evaluate(float x) const;
- };
-
- // Quadratic (bell) filter.
- class NVIMAGE_CLASS QuadraticFilter : public Filter
- {
- public:
- QuadraticFilter();
- virtual float evaluate(float x) const;
- };
-
- // Cubic filter from Thatcher Ulrich.
- class NVIMAGE_CLASS CubicFilter : public Filter
- {
- public:
- CubicFilter();
- virtual float evaluate(float x) const;
- };
-
- // Cubic b-spline filter from Paul Heckbert.
- class NVIMAGE_CLASS BSplineFilter : public Filter
- {
- public:
- BSplineFilter();
- virtual float evaluate(float x) const;
- };
-
- /// Mitchell & Netravali's two-param cubic
- /// @see "Reconstruction Filters in Computer Graphics", SIGGRAPH 88
- class NVIMAGE_CLASS MitchellFilter : public Filter
- {
- public:
- MitchellFilter();
- virtual float evaluate(float x) const;
-
- void setParameters(float b, float c);
-
- private:
- float p0, p2, p3;
- float q0, q1, q2, q3;
- };
-
- // Lanczos3 filter.
- class NVIMAGE_CLASS LanczosFilter : public Filter
- {
- public:
- LanczosFilter();
- virtual float evaluate(float x) const;
- };
-
- // Sinc filter.
- class NVIMAGE_CLASS SincFilter : public Filter
- {
- public:
- SincFilter(float w);
- virtual float evaluate(float x) const;
- };
-
- // Kaiser filter.
- class NVIMAGE_CLASS KaiserFilter : public Filter
- {
- public:
- KaiserFilter(float w);
- virtual float evaluate(float x) const;
-
- void setParameters(float a, float stretch);
-
- private:
- float alpha;
- float stretch;
- };
-
-
-
- /// A 1D kernel. Used to precompute filter weights.
- class NVIMAGE_CLASS Kernel1
- {
- NV_FORBID_COPY(Kernel1);
- public:
- Kernel1(const Filter & f, int iscale, int samples = 32);
- ~Kernel1();
-
- float valueAt(uint x) const {
- nvDebugCheck(x < (uint)m_windowSize);
- return m_data[x];
- }
-
- int windowSize() const {
- return m_windowSize;
- }
-
- float width() const {
- return m_width;
- }
-
- void debugPrint();
-
- private:
- int m_windowSize;
- float m_width;
- float * m_data;
- };
-
-
- /// A 2D kernel.
- class NVIMAGE_CLASS Kernel2
- {
- public:
- Kernel2(uint width);
- Kernel2(const Kernel2 & k);
- ~Kernel2();
-
- void normalize();
- void transpose();
-
- float valueAt(uint x, uint y) const {
- return m_data[y * m_windowSize + x];
- }
-
- uint windowSize() const {
- return m_windowSize;
- }
-
- void initLaplacian();
- void initEdgeDetection();
- void initSobel();
- void initPrewitt();
-
- void initBlendedSobel(const Vector4 & scale);
-
- private:
- const uint m_windowSize;
- float * m_data;
- };
-
-
- /// A 1D polyphase kernel
- class NVIMAGE_CLASS PolyphaseKernel
- {
- NV_FORBID_COPY(PolyphaseKernel);
- public:
- PolyphaseKernel(const Filter & f, uint srcLength, uint dstLength, int samples = 32);
- ~PolyphaseKernel();
-
- int windowSize() const {
- return m_windowSize;
- }
-
- uint length() const {
- return m_length;
- }
-
- float width() const {
- return m_width;
- }
-
- float valueAt(uint column, uint x) const {
- nvDebugCheck(column < m_length);
- nvDebugCheck(x < (uint)m_windowSize);
- return m_data[column * m_windowSize + x];
- }
-
- void debugPrint() const;
-
- private:
- int m_windowSize;
- uint m_length;
- float m_width;
- float * m_data;
- };
-
-} // nv namespace
-
-#endif // NV_IMAGE_FILTER_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/FloatImage.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/FloatImage.cpp
deleted file mode 100644
index 28229bc4..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/FloatImage.cpp
+++ /dev/null
@@ -1,960 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include "FloatImage.h"
-#include "Filter.h"
-#include "Image.h"
-
-#include <nvmath/Color.h>
-#include <nvmath/Matrix.h>
-
-#include <nvcore/Containers.h>
-#include <nvcore/Ptr.h>
-
-#include <math.h>
-
-
-using namespace nv;
-
-namespace
-{
- static int iround(float f)
- {
- return int(f);
- }
-
- static int ifloor(float f)
- {
- return int(floor(f));
- }
-
- static float frac(float f)
- {
- return f - floor(f);
- }
-
- static int mirror(int x, int w)
- {
- x = abs(x);
- while (x >= w) {
- x = 2 * w - x - 2;
- }
- return x;
- }
-}
-
-
-/// Ctor.
-FloatImage::FloatImage() : m_width(0), m_height(0),
- m_componentNum(0), m_count(0), m_mem(NULL)
-{
-}
-
-/// Ctor. Init from image.
-FloatImage::FloatImage(const Image * img) : m_width(0), m_height(0),
- m_componentNum(0), m_count(0), m_mem(NULL)
-{
- initFrom(img);
-}
-
-/// Dtor.
-FloatImage::~FloatImage()
-{
- free();
-}
-
-
-/// Init the floating point image from a regular image.
-void FloatImage::initFrom(const Image * img)
-{
- nvCheck(img != NULL);
-
- allocate(4, img->width(), img->height());
-
- float * red_channel = channel(0);
- float * green_channel = channel(1);
- float * blue_channel = channel(2);
- float * alpha_channel = channel(3);
-
- const uint count = m_width * m_height;
- for(uint i = 0; i < count; i++) {
- Color32 pixel = img->pixel(i);
- red_channel[i] = float(pixel.r) / 255.0f;
- green_channel[i] = float(pixel.g) / 255.0f;
- blue_channel[i] = float(pixel.b) / 255.0f;
- alpha_channel[i] = float(pixel.a) / 255.0f;
- }
-}
-
-/// Convert the floating point image to a regular image.
-Image * FloatImage::createImage(uint base_component/*= 0*/, uint num/*= 4*/) const
-{
- nvCheck(num <= 4);
- nvCheck(base_component + num <= m_componentNum);
-
- AutoPtr<Image> img(new Image());
- img->allocate(m_width, m_height);
-
- const uint size = m_width * m_height;
- for(uint i = 0; i < size; i++) {
-
- uint c;
- uint8 rgba[4]= {0, 0, 0, 0xff};
-
- for(c = 0; c < num; c++) {
- float f = m_mem[size * (base_component + c) + i];
- rgba[c] = nv::clamp(int(255.0f * f), 0, 255);
- }
-
- img->pixel(i) = Color32(rgba[0], rgba[1], rgba[2], rgba[3]);
- }
-
- return img.release();
-}
-
-
-/// Convert the floating point image to a regular image. Correct gamma of rgb, but not alpha.
-Image * FloatImage::createImageGammaCorrect(float gamma/*= 2.2f*/) const
-{
- nvCheck(m_componentNum == 4);
-
- AutoPtr<Image> img(new Image());
- img->allocate(m_width, m_height);
-
- const float * rChannel = this->channel(0);
- const float * gChannel = this->channel(1);
- const float * bChannel = this->channel(2);
- const float * aChannel = this->channel(3);
-
- const uint size = m_width * m_height;
- for(uint i = 0; i < size; i++)
- {
- const uint8 r = nv::clamp(int(255.0f * pow(rChannel[i], 1.0f/gamma)), 0, 255);
- const uint8 g = nv::clamp(int(255.0f * pow(gChannel[i], 1.0f/gamma)), 0, 255);
- const uint8 b = nv::clamp(int(255.0f * pow(bChannel[i], 1.0f/gamma)), 0, 255);
- const uint8 a = nv::clamp(int(255.0f * aChannel[i]), 0, 255);
-
- img->pixel(i) = Color32(r, g, b, a);
- }
-
- return img.release();
-}
-
-/// Allocate a 2d float image of the given format and the given extents.
-void FloatImage::allocate(uint c, uint w, uint h)
-{
- free();
-
- m_width = w;
- m_height = h;
- m_componentNum = c;
- m_count = w * h * c;
- m_mem = malloc<float>(m_count);
-}
-
-/// Free the image, but don't clear the members.
-void FloatImage::free()
-{
- ::free( m_mem );
- m_mem = NULL;
-}
-
-void FloatImage::clear(float f/*=0.0f*/)
-{
- for(uint i = 0; i < m_count; i++) {
- m_mem[i] = f;
- }
-}
-
-void FloatImage::normalize(uint base_component)
-{
- nvCheck(base_component + 3 <= m_componentNum);
-
- float * xChannel = this->channel(base_component + 0);
- float * yChannel = this->channel(base_component + 1);
- float * zChannel = this->channel(base_component + 2);
-
- const uint size = m_width * m_height;
- for(uint i = 0; i < size; i++) {
-
- Vector3 normal(xChannel[i], yChannel[i], zChannel[i]);
- normal = normalizeSafe(normal, Vector3(zero), 0.0f);
-
- xChannel[i] = normal.x();
- yChannel[i] = normal.y();
- zChannel[i] = normal.z();
- }
-}
-
-void FloatImage::packNormals(uint base_component)
-{
- scaleBias(base_component, 3, 0.5f, 1.0f);
-}
-
-void FloatImage::expandNormals(uint base_component)
-{
- scaleBias(base_component, 3, 2, -0.5);
-}
-
-void FloatImage::scaleBias(uint base_component, uint num, float scale, float bias)
-{
- const uint size = m_width * m_height;
-
- for(uint c = 0; c < num; c++) {
- float * ptr = this->channel(base_component + c);
-
- for(uint i = 0; i < size; i++) {
- ptr[i] = scale * (ptr[i] + bias);
- }
- }
-}
-
-/// Clamp the elements of the image.
-void FloatImage::clamp(float low, float high)
-{
- for(uint i = 0; i < m_count; i++) {
- m_mem[i] = nv::clamp(m_mem[i], low, high);
- }
-}
-
-/// From gamma to linear space.
-void FloatImage::toLinear(uint base_component, uint num, float gamma /*= 2.2f*/)
-{
- exponentiate(base_component, num, gamma);
-}
-
-/// From linear to gamma space.
-void FloatImage::toGamma(uint base_component, uint num, float gamma /*= 2.2f*/)
-{
- exponentiate(base_component, num, 1.0f/gamma);
-}
-
-/// Exponentiate the elements of the image.
-void FloatImage::exponentiate(uint base_component, uint num, float power)
-{
- const uint size = m_width * m_height;
-
- for(uint c = 0; c < num; c++) {
- float * ptr = this->channel(base_component + c);
-
- for(uint i = 0; i < size; i++) {
- ptr[i] = pow(ptr[i], power);
- }
- }
-}
-
-/// Apply linear transform.
-void FloatImage::transform(uint base_component, const Matrix & m, Vector4::Arg offset)
-{
- nvCheck(base_component + 4 <= m_componentNum);
-
- const uint size = m_width * m_height;
-
- float * r = this->channel(base_component + 0);
- float * g = this->channel(base_component + 1);
- float * b = this->channel(base_component + 2);
- float * a = this->channel(base_component + 3);
-
- for (uint i = 0; i < size; i++)
- {
- Vector4 color = nv::transform(m, Vector4(*r, *g, *b, *a)) + offset;
-
- *r++ = color.x();
- *g++ = color.y();
- *b++ = color.z();
- *a++ = color.w();
- }
-}
-
-void FloatImage::swizzle(uint base_component, uint r, uint g, uint b, uint a)
-{
- nvCheck(base_component + 4 <= m_componentNum);
- nvCheck(r < 7 && g < 7 && b < 7 && a < 7);
-
- const uint size = m_width * m_height;
-
- float consts[] = { 1.0f, 0.0f, -1.0f };
- float * c[7];
- c[0] = this->channel(base_component + 0);
- c[1] = this->channel(base_component + 1);
- c[2] = this->channel(base_component + 2);
- c[3] = this->channel(base_component + 3);
- c[4] = consts;
- c[5] = consts + 1;
- c[6] = consts + 2;
-
- for (uint i = 0; i < size; i++)
- {
- float tmp[4] = { *c[r], *c[g], *c[b], *c[a] };
-
- *c[0]++ = tmp[0];
- *c[1]++ = tmp[1];
- *c[2]++ = tmp[2];
- *c[3]++ = tmp[3];
- }
-}
-
-float FloatImage::sampleNearest(const float x, const float y, const int c, const WrapMode wm) const
-{
- if( wm == WrapMode_Clamp ) return sampleNearestClamp(x, y, c);
- else if( wm == WrapMode_Repeat ) return sampleNearestRepeat(x, y, c);
- else /*if( wm == WrapMode_Mirror )*/ return sampleNearestMirror(x, y, c);
-}
-
-float FloatImage::sampleLinear(const float x, const float y, const int c, const WrapMode wm) const
-{
- if( wm == WrapMode_Clamp ) return sampleLinearClamp(x, y, c);
- else if( wm == WrapMode_Repeat ) return sampleLinearRepeat(x, y, c);
- else /*if( wm == WrapMode_Mirror )*/ return sampleLinearMirror(x, y, c);
-}
-
-float FloatImage::sampleNearestClamp(const float x, const float y, const int c) const
-{
- int ix = ::clamp(iround(x * m_width), 0, m_width-1);
- int iy = ::clamp(iround(y * m_height), 0, m_height-1);
- return pixel(ix, iy, c);
-}
-
-float FloatImage::sampleNearestRepeat(const float x, const float y, const int c) const
-{
- int ix = iround(frac(x) * m_width);
- int iy = iround(frac(y) * m_height);
- return pixel(ix, iy, c);
-}
-
-float FloatImage::sampleNearestMirror(const float x, const float y, const int c) const
-{
- int ix = mirror(iround(x * m_width), m_width);
- int iy = mirror(iround(y * m_height), m_height);
- return pixel(ix, iy, c);
-}
-
-float FloatImage::sampleLinearClamp(float x, float y, const int c) const
-{
- const int w = m_width;
- const int h = m_height;
-
- x *= w;
- y *= h;
-
- const float fracX = frac(x);
- const float fracY = frac(y);
-
- const int ix0 = ::clamp(ifloor(x), 0, w-1);
- const int iy0 = ::clamp(ifloor(y), 0, h-1);
- const int ix1 = ::clamp(ifloor(x)+1, 0, w-1);
- const int iy1 = ::clamp(ifloor(y)+1, 0, h-1);
-
- float f1 = pixel(ix0, iy0, c);
- float f2 = pixel(ix1, iy0, c);
- float f3 = pixel(ix0, iy1, c);
- float f4 = pixel(ix1, iy1, c);
-
- float i1 = lerp(f1, f2, fracX);
- float i2 = lerp(f3, f4, fracX);
-
- return lerp(i1, i2, fracY);
-}
-
-float FloatImage::sampleLinearRepeat(float x, float y, int c) const
-{
- const int w = m_width;
- const int h = m_height;
-
- const float fracX = frac(x * w);
- const float fracY = frac(y * h);
-
- int ix0 = ifloor(frac(x) * w);
- int iy0 = ifloor(frac(y) * h);
- int ix1 = ifloor(frac(x + 1.0f/w) * w);
- int iy1 = ifloor(frac(y + 1.0f/h) * h);
-
- float f1 = pixel(ix0, iy0, c);
- float f2 = pixel(ix1, iy0, c);
- float f3 = pixel(ix0, iy1, c);
- float f4 = pixel(ix1, iy1, c);
-
- float i1 = lerp(f1, f2, fracX);
- float i2 = lerp(f3, f4, fracX);
-
- return lerp(i1, i2, fracY);
-}
-
-float FloatImage::sampleLinearMirror(float x, float y, int c) const
-{
- const int w = m_width;
- const int h = m_height;
-
- x *= w;
- y *= h;
-
- const float fracX = frac(x);
- const float fracY = frac(y);
-
- int ix0 = mirror(iround(x), w);
- int iy0 = mirror(iround(y), h);
- int ix1 = mirror(iround(x) + 1, w);
- int iy1 = mirror(iround(y) + 1, h);
-
- float f1 = pixel(ix0, iy0, c);
- float f2 = pixel(ix1, iy0, c);
- float f3 = pixel(ix0, iy1, c);
- float f4 = pixel(ix1, iy1, c);
-
- float i1 = lerp(f1, f2, fracX);
- float i2 = lerp(f3, f4, fracX);
-
- return lerp(i1, i2, fracY);
-}
-
-
-/// Fast downsampling using box filter.
-///
-/// The extents of the image are divided by two and rounded down.
-///
-/// When the size of the image is odd, this uses a polyphase box filter as explained in:
-/// http://developer.nvidia.com/object/np2_mipmapping.html
-///
-FloatImage * FloatImage::fastDownSample() const
-{
- nvDebugCheck(m_width != 1 || m_height != 1);
-
- AutoPtr<FloatImage> dst_image( new FloatImage() );
-
- const uint w = max(1, m_width / 2);
- const uint h = max(1, m_height / 2);
- dst_image->allocate(m_componentNum, w, h);
-
- // 1D box filter.
- if (m_width == 1 || m_height == 1)
- {
- const uint n = w * h;
-
- if ((m_width * m_height) & 1)
- {
- const float scale = 1.0f / (2 * n + 1);
-
- for(uint c = 0; c < m_componentNum; c++)
- {
- const float * src = this->channel(c);
- float * dst = dst_image->channel(c);
-
- for(uint x = 0; x < n; x++)
- {
- const float w0 = float(n - x);
- const float w1 = float(n - 0);
- const float w2 = float(1 + x);
-
- *dst++ = scale * (w0 * src[0] + w1 * src[1] + w2 * src[2]);
- src += 2;
- }
- }
- }
- else
- {
- for(uint c = 0; c < m_componentNum; c++)
- {
- const float * src = this->channel(c);
- float * dst = dst_image->channel(c);
-
- for(uint x = 0; x < n; x++)
- {
- *dst = 0.5f * (src[0] + src[1]);
- dst++;
- src += 2;
- }
- }
- }
- }
-
- // Regular box filter.
- else if ((m_width & 1) == 0 && (m_height & 1) == 0)
- {
- for(uint c = 0; c < m_componentNum; c++)
- {
- const float * src = this->channel(c);
- float * dst = dst_image->channel(c);
-
- for(uint y = 0; y < h; y++)
- {
- for(uint x = 0; x < w; x++)
- {
- *dst = 0.25f * (src[0] + src[1] + src[m_width] + src[m_width + 1]);
- dst++;
- src += 2;
- }
-
- src += m_width;
- }
- }
- }
-
- // Polyphase filters.
- else if (m_width & 1 && m_height & 1)
- {
- nvDebugCheck(m_width == 2 * w + 1);
- nvDebugCheck(m_height == 2 * h + 1);
-
- const float scale = 1.0f / (m_width * m_height);
-
- for(uint c = 0; c < m_componentNum; c++)
- {
- const float * src = this->channel(c);
- float * dst = dst_image->channel(c);
-
- for(uint y = 0; y < h; y++)
- {
- const float v0 = float(h - y);
- const float v1 = float(h - 0);
- const float v2 = float(1 + y);
-
- for (uint x = 0; x < w; x++)
- {
- const float w0 = float(w - x);
- const float w1 = float(w - 0);
- const float w2 = float(1 + x);
-
- float f = 0.0f;
- f += v0 * (w0 * src[0 * m_width + 2 * x] + w1 * src[0 * m_width + 2 * x + 1] + w2 * src[0 * m_width + 2 * x + 2]);
- f += v1 * (w0 * src[1 * m_width + 2 * x] + w1 * src[1 * m_width + 2 * x + 1] + w2 * src[0 * m_width + 2 * x + 2]);
- f += v2 * (w0 * src[2 * m_width + 2 * x] + w1 * src[2 * m_width + 2 * x + 1] + w2 * src[0 * m_width + 2 * x + 2]);
-
- *dst = f * scale;
- dst++;
- }
-
- src += 2 * m_width;
- }
- }
- }
- else if (m_width & 1)
- {
- nvDebugCheck(m_width == 2 * w + 1);
- const float scale = 1.0f / (2 * m_width);
-
- for(uint c = 0; c < m_componentNum; c++)
- {
- const float * src = this->channel(c);
- float * dst = dst_image->channel(c);
-
- for(uint y = 0; y < h; y++)
- {
- for (uint x = 0; x < w; x++)
- {
- const float w0 = float(w - x);
- const float w1 = float(w - 0);
- const float w2 = float(1 + x);
-
- float f = 0.0f;
- f += w0 * (src[2 * x + 0] + src[m_width + 2 * x + 0]);
- f += w1 * (src[2 * x + 1] + src[m_width + 2 * x + 1]);
- f += w2 * (src[2 * x + 2] + src[m_width + 2 * x + 2]);
-
- *dst = f * scale;
- dst++;
- }
-
- src += 2 * m_width;
- }
- }
- }
- else if (m_height & 1)
- {
- nvDebugCheck(m_height == 2 * h + 1);
-
- const float scale = 1.0f / (2 * m_height);
-
- for(uint c = 0; c < m_componentNum; c++)
- {
- const float * src = this->channel(c);
- float * dst = dst_image->channel(c);
-
- for(uint y = 0; y < h; y++)
- {
- const float v0 = float(h - y);
- const float v1 = float(h - 0);
- const float v2 = float(1 + y);
-
- for (uint x = 0; x < w; x++)
- {
- float f = 0.0f;
- f += v0 * (src[0 * m_width + 2 * x] + src[0 * m_width + 2 * x + 1]);
- f += v1 * (src[1 * m_width + 2 * x] + src[1 * m_width + 2 * x + 1]);
- f += v2 * (src[2 * m_width + 2 * x] + src[2 * m_width + 2 * x + 1]);
-
- *dst = f * scale;
- dst++;
- }
-
- src += 2 * m_width;
- }
- }
- }
-
- return dst_image.release();
-}
-
-/// Downsample applying a 1D kernel separately in each dimension.
-FloatImage * FloatImage::downSample(const Filter & filter, WrapMode wm) const
-{
- const uint w = max(1, m_width / 2);
- const uint h = max(1, m_height / 2);
-
- return resize(filter, w, h, wm);
-}
-
-/// Downsample applying a 1D kernel separately in each dimension.
-FloatImage * FloatImage::downSample(const Filter & filter, WrapMode wm, uint alpha) const
-{
- const uint w = max(1, m_width / 2);
- const uint h = max(1, m_height / 2);
-
- return resize(filter, w, h, wm, alpha);
-}
-
-
-/// Downsample applying a 1D kernel separately in each dimension.
-FloatImage * FloatImage::resize(const Filter & filter, uint w, uint h, WrapMode wm) const
-{
- // @@ Use monophase filters when frac(m_width / w) == 0
-
- AutoPtr<FloatImage> tmp_image( new FloatImage() );
- AutoPtr<FloatImage> dst_image( new FloatImage() );
-
- PolyphaseKernel xkernel(filter, m_width, w, 32);
- PolyphaseKernel ykernel(filter, m_height, h, 32);
-
- // @@ Select fastest filtering order:
- //if (w * m_height <= h * m_width)
- {
- tmp_image->allocate(m_componentNum, w, m_height);
- dst_image->allocate(m_componentNum, w, h);
-
- Array<float> tmp_column(h);
- tmp_column.resize(h);
-
- for (uint c = 0; c < m_componentNum; c++)
- {
- float * tmp_channel = tmp_image->channel(c);
-
- for (uint y = 0; y < m_height; y++) {
- this->applyKernelHorizontal(xkernel, y, c, wm, tmp_channel + y * w);
- }
-
- float * dst_channel = dst_image->channel(c);
-
- for (uint x = 0; x < w; x++) {
- tmp_image->applyKernelVertical(ykernel, x, c, wm, tmp_column.mutableBuffer());
-
- for (uint y = 0; y < h; y++) {
- dst_channel[y * w + x] = tmp_column[y];
- }
- }
- }
- }
- /*else
- {
- tmp_image->allocate(m_componentNum, m_width, h);
- dst_image->allocate(m_componentNum, w, h);
-
- Array<float> tmp_column(h);
- tmp_column.resize(h);
-
- for (uint c = 0; c < m_componentNum; c++)
- {
- float * tmp_channel = tmp_image->channel(c);
-
- for (uint x = 0; x < w; x++) {
- tmp_image->applyKernelVertical(ykernel, x, c, wm, tmp_column.mutableBuffer());
-
- for (uint y = 0; y < h; y++) {
- tmp_channel[y * w + x] = tmp_column[y];
- }
- }
-
- float * dst_channel = dst_image->channel(c);
-
- for (uint y = 0; y < m_height; y++) {
- this->applyKernelHorizontal(xkernel, y, c, wm, dst_channel + y * w);
- }
- }
- }*/
-
- return dst_image.release();
-}
-
-/// Downsample applying a 1D kernel separately in each dimension.
-FloatImage * FloatImage::resize(const Filter & filter, uint w, uint h, WrapMode wm, uint alpha) const
-{
- nvCheck(alpha < m_componentNum);
-
- AutoPtr<FloatImage> tmp_image( new FloatImage() );
- AutoPtr<FloatImage> dst_image( new FloatImage() );
-
- PolyphaseKernel xkernel(filter, m_width, w, 32);
- PolyphaseKernel ykernel(filter, m_height, h, 32);
-
- {
- tmp_image->allocate(m_componentNum, w, m_height);
- dst_image->allocate(m_componentNum, w, h);
-
- Array<float> tmp_column(h);
- tmp_column.resize(h);
-
- for (uint c = 0; c < m_componentNum; c++)
- {
- float * tmp_channel = tmp_image->channel(c);
-
- for (uint y = 0; y < m_height; y++) {
- this->applyKernelHorizontal(xkernel, y, c, alpha, wm, tmp_channel + y * w);
- }
- }
-
- // Process all channels before applying vertical kernel to make sure alpha has been computed.
-
- for (uint c = 0; c < m_componentNum; c++)
- {
- float * dst_channel = dst_image->channel(c);
-
- for (uint x = 0; x < w; x++) {
- tmp_image->applyKernelVertical(ykernel, x, c, alpha, wm, tmp_column.mutableBuffer());
-
- for (uint y = 0; y < h; y++) {
- dst_channel[y * w + x] = tmp_column[y];
- }
- }
- }
- }
-
- return dst_image.release();
-}
-
-
-
-/// Apply 2D kernel at the given coordinates and return result.
-float FloatImage::applyKernel(const Kernel2 * k, int x, int y, uint c, WrapMode wm) const
-{
- nvDebugCheck(k != NULL);
-
- const uint kernelWindow = k->windowSize();
- const int kernelOffset = int(kernelWindow / 2) - 1;
-
- const float * channel = this->channel(c);
-
- float sum = 0.0f;
- for (uint i = 0; i < kernelWindow; i++)
- {
- const int src_y = int(y + i) - kernelOffset;
-
- for (uint e = 0; e < kernelWindow; e++)
- {
- const int src_x = int(x + e) - kernelOffset;
-
- int idx = this->index(src_x, src_y, wm);
-
- sum += k->valueAt(e, i) * channel[idx];
- }
- }
-
- return sum;
-}
-
-
-/// Apply 1D vertical kernel at the given coordinates and return result.
-float FloatImage::applyKernelVertical(const Kernel1 * k, int x, int y, uint c, WrapMode wm) const
-{
- nvDebugCheck(k != NULL);
-
- const uint kernelWindow = k->windowSize();
- const int kernelOffset = int(kernelWindow / 2) - 1;
-
- const float * channel = this->channel(c);
-
- float sum = 0.0f;
- for (uint i = 0; i < kernelWindow; i++)
- {
- const int src_y = int(y + i) - kernelOffset;
- const int idx = this->index(x, src_y, wm);
-
- sum += k->valueAt(i) * channel[idx];
- }
-
- return sum;
-}
-
-/// Apply 1D horizontal kernel at the given coordinates and return result.
-float FloatImage::applyKernelHorizontal(const Kernel1 * k, int x, int y, uint c, WrapMode wm) const
-{
- nvDebugCheck(k != NULL);
-
- const uint kernelWindow = k->windowSize();
- const int kernelOffset = int(kernelWindow / 2) - 1;
-
- const float * channel = this->channel(c);
-
- float sum = 0.0f;
- for (uint e = 0; e < kernelWindow; e++)
- {
- const int src_x = int(x + e) - kernelOffset;
- const int idx = this->index(src_x, y, wm);
-
- sum += k->valueAt(e) * channel[idx];
- }
-
- return sum;
-}
-
-
-/// Apply 1D vertical kernel at the given coordinates and return result.
-void FloatImage::applyKernelVertical(const PolyphaseKernel & k, int x, uint c, WrapMode wm, float * __restrict output) const
-{
- const uint length = k.length();
- const float scale = float(length) / float(m_height);
- const float iscale = 1.0f / scale;
-
- const float width = k.width();
- const int windowSize = k.windowSize();
-
- const float * channel = this->channel(c);
-
- for (uint i = 0; i < length; i++)
- {
- const float center = (0.5f + i) * iscale;
-
- const int left = (int)floorf(center - width);
- const int right = (int)ceilf(center + width);
- nvCheck(right - left <= windowSize);
-
- float sum = 0;
- for (int j = 0; j < windowSize; ++j)
- {
- const int idx = this->index(x, j+left, wm);
-
- sum += k.valueAt(i, j) * channel[idx];
- }
-
- output[i] = sum;
- }
-}
-
-/// Apply 1D horizontal kernel at the given coordinates and return result.
-void FloatImage::applyKernelHorizontal(const PolyphaseKernel & k, int y, uint c, WrapMode wm, float * __restrict output) const
-{
- const uint length = k.length();
- const float scale = float(length) / float(m_width);
- const float iscale = 1.0f / scale;
-
- const float width = k.width();
- const int windowSize = k.windowSize();
-
- const float * channel = this->channel(c);
-
- for (uint i = 0; i < length; i++)
- {
- const float center = (0.5f + i) * iscale;
-
- const int left = (int)floorf(center - width);
- const int right = (int)ceilf(center + width);
- nvDebugCheck(right - left <= windowSize);
-
- float sum = 0;
- for (int j = 0; j < windowSize; ++j)
- {
- const int idx = this->index(left + j, y, wm);
-
- sum += k.valueAt(i, j) * channel[idx];
- }
-
- output[i] = sum;
- }
-}
-
-
-/// Apply 1D vertical kernel at the given coordinates and return result.
-void FloatImage::applyKernelVertical(const PolyphaseKernel & k, int x, uint c, uint a, WrapMode wm, float * __restrict output) const
-{
- const uint length = k.length();
- const float scale = float(length) / float(m_height);
- const float iscale = 1.0f / scale;
-
- const float width = k.width();
- const int windowSize = k.windowSize();
-
- const float * channel = this->channel(c);
- const float * alpha = this->channel(a);
-
- for (uint i = 0; i < length; i++)
- {
- const float center = (0.5f + i) * iscale;
-
- const int left = (int)floorf(center - width);
- const int right = (int)ceilf(center + width);
- nvCheck(right - left <= windowSize);
-
- float norm = 0;
- float sum = 0;
- for (int j = 0; j < windowSize; ++j)
- {
- const int idx = this->index(x, j+left, wm);
-
- float w = k.valueAt(i, j) * (alpha[idx] + (1.0f / 256.0f));
- norm += w;
- sum += w * channel[idx];
- }
-
- output[i] = sum / norm;
- }
-}
-
-/// Apply 1D horizontal kernel at the given coordinates and return result.
-void FloatImage::applyKernelHorizontal(const PolyphaseKernel & k, int y, uint c, uint a, WrapMode wm, float * __restrict output) const
-{
- const uint length = k.length();
- const float scale = float(length) / float(m_width);
- const float iscale = 1.0f / scale;
-
- const float width = k.width();
- const int windowSize = k.windowSize();
-
- const float * channel = this->channel(c);
- const float * alpha = this->channel(a);
-
- for (uint i = 0; i < length; i++)
- {
- const float center = (0.5f + i) * iscale;
-
- const int left = (int)floorf(center - width);
- const int right = (int)ceilf(center + width);
- nvDebugCheck(right - left <= windowSize);
-
- float norm = 0.0f;
- float sum = 0;
- for (int j = 0; j < windowSize; ++j)
- {
- const int idx = this->index(left + j, y, wm);
-
- float w = k.valueAt(i, j) * (alpha[idx] + (1.0f / 256.0f));
- norm += w;
- sum += w * channel[idx];
- }
-
- output[i] = sum / norm;
- }
-}
-
-FloatImage* FloatImage::clone() const
-{
- FloatImage* copy = new FloatImage();
- copy->m_width = m_width;
- copy->m_height = m_height;
- copy->m_componentNum = m_componentNum;
- copy->m_count = m_count;
-
- if(m_mem)
- {
- copy->allocate(m_componentNum, m_width, m_height);
- memcpy(copy->m_mem, m_mem, m_count * sizeof(float));
- }
-
- return copy;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/FloatImage.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/FloatImage.h
deleted file mode 100644
index 6caffa24..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/FloatImage.h
+++ /dev/null
@@ -1,274 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_IMAGE_FLOATIMAGE_H
-#define NV_IMAGE_FLOATIMAGE_H
-
-#include <nvimage/nvimage.h>
-
-#include <nvmath/Vector.h>
-
-#include <nvcore/Debug.h>
-#include <nvcore/Algorithms.h> // clamp
-
-#include <stdlib.h> // abs
-
-
-namespace nv
-{
-class Vector4;
-class Matrix;
-class Image;
-class Filter;
-class Kernel1;
-class Kernel2;
-class PolyphaseKernel;
-
-/// Multicomponent floating point image class.
-class FloatImage
-{
-public:
-
- enum WrapMode {
- WrapMode_Clamp,
- WrapMode_Repeat,
- WrapMode_Mirror
- };
-
- NVIMAGE_API FloatImage();
- NVIMAGE_API FloatImage(const Image * img);
- NVIMAGE_API virtual ~FloatImage();
-
- /** @name Conversion. */
- //@{
- NVIMAGE_API void initFrom(const Image * img);
- NVIMAGE_API Image * createImage(uint base_component = 0, uint num = 4) const;
- NVIMAGE_API Image * createImageGammaCorrect(float gamma = 2.2f) const;
- //@}
-
- /** @name Allocation. */
- //@{
- NVIMAGE_API void allocate(uint c, uint w, uint h);
- NVIMAGE_API void free(); // Does not clear members.
- //@}
-
- /** @name Manipulation. */
- //@{
- NVIMAGE_API void clear(float f=0.0f);
-
- NVIMAGE_API void normalize(uint base_component);
-
- NVIMAGE_API void packNormals(uint base_component);
- NVIMAGE_API void expandNormals(uint base_component);
- NVIMAGE_API void scaleBias(uint base_component, uint num, float scale, float add);
-
- //NVIMAGE_API void clamp(uint base_component, uint num);
- NVIMAGE_API void clamp(float low, float high);
-
- NVIMAGE_API void toLinear(uint base_component, uint num, float gamma = 2.2f);
- NVIMAGE_API void toGamma(uint base_component, uint num, float gamma = 2.2f);
- NVIMAGE_API void exponentiate(uint base_component, uint num, float power);
-
- NVIMAGE_API void transform(uint base_component, const Matrix & m, const Vector4 & offset);
- NVIMAGE_API void swizzle(uint base_component, uint r, uint g, uint b, uint a);
-
- NVIMAGE_API FloatImage * fastDownSample() const;
- NVIMAGE_API FloatImage * downSample(const Filter & filter, WrapMode wm) const;
- NVIMAGE_API FloatImage * downSample(const Filter & filter, WrapMode wm, uint alpha) const;
- NVIMAGE_API FloatImage * resize(const Filter & filter, uint w, uint h, WrapMode wm) const;
- NVIMAGE_API FloatImage * resize(const Filter & filter, uint w, uint h, WrapMode wm, uint alpha) const;
-
- //NVIMAGE_API FloatImage * downSample(const Kernel1 & filter, WrapMode wm) const;
- //NVIMAGE_API FloatImage * downSample(const Kernel1 & filter, uint w, uint h, WrapMode wm) const;
- //@}
-
- NVIMAGE_API float applyKernel(const Kernel2 * k, int x, int y, uint c, WrapMode wm) const;
- NVIMAGE_API float applyKernelVertical(const Kernel1 * k, int x, int y, uint c, WrapMode wm) const;
- NVIMAGE_API float applyKernelHorizontal(const Kernel1 * k, int x, int y, uint c, WrapMode wm) const;
- NVIMAGE_API void applyKernelVertical(const PolyphaseKernel & k, int x, uint c, WrapMode wm, float * output) const;
- NVIMAGE_API void applyKernelHorizontal(const PolyphaseKernel & k, int y, uint c, WrapMode wm, float * output) const;
- NVIMAGE_API void applyKernelVertical(const PolyphaseKernel & k, int x, uint c, uint a, WrapMode wm, float * output) const;
- NVIMAGE_API void applyKernelHorizontal(const PolyphaseKernel & k, int y, uint c, uint a, WrapMode wm, float * output) const;
-
-
- uint width() const { return m_width; }
- uint height() const { return m_height; }
- uint componentNum() const { return m_componentNum; }
- uint count() const { return m_count; }
-
-
- /** @name Pixel access. */
- //@{
- const float * channel(uint c) const;
- float * channel(uint c);
-
- const float * scanline(uint y, uint c) const;
- float * scanline(uint y, uint c);
-
- void setPixel(float f, uint x, uint y, uint c);
- void addPixel(float f, uint x, uint y, uint c);
- float pixel(uint x, uint y, uint c) const;
-
- void setPixel(float f, uint idx);
- float pixel(uint idx) const;
-
- float sampleNearest(float x, float y, int c, WrapMode wm) const;
- float sampleLinear(float x, float y, int c, WrapMode wm) const;
-
- float sampleNearestClamp(float x, float y, int c) const;
- float sampleNearestRepeat(float x, float y, int c) const;
- float sampleNearestMirror(float x, float y, int c) const;
-
- float sampleLinearClamp(float x, float y, int c) const;
- float sampleLinearRepeat(float x, float y, int c) const;
- float sampleLinearMirror(float x, float y, int c) const;
- //@}
-
-
- FloatImage* clone() const;
-
-public:
-
- uint index(uint x, uint y) const;
- uint indexClamp(int x, int y) const;
- uint indexRepeat(int x, int y) const;
- uint indexMirror(int x, int y) const;
- uint index(int x, int y, WrapMode wm) const;
-
-public:
-
- uint16 m_width; ///< Width of the texture.
- uint16 m_height; ///< Height of the texture.
- uint32 m_componentNum; ///< Number of components.
- uint32 m_count; ///< Image pixel count.
- float * m_mem;
-
-};
-
-
-/// Get const channel pointer.
-inline const float * FloatImage::channel(uint c) const
-{
- nvDebugCheck(m_mem != NULL);
- nvDebugCheck(c < m_componentNum);
- return m_mem + c * m_width * m_height;
-}
-
-/// Get channel pointer.
-inline float * FloatImage::channel(uint c) {
- nvDebugCheck(m_mem != NULL);
- nvDebugCheck(c < m_componentNum);
- return m_mem + c * m_width * m_height;
-}
-
-/// Get const scanline pointer.
-inline const float * FloatImage::scanline(uint y, uint c) const
-{
- nvDebugCheck(y < m_height);
- return channel(c) + y * m_width;
-}
-
-/// Get scanline pointer.
-inline float * FloatImage::scanline(uint y, uint c)
-{
- nvDebugCheck(y < m_height);
- return channel(c) + y * m_width;
-}
-
-/// Set pixel component.
-inline void FloatImage::setPixel(float f, uint x, uint y, uint c)
-{
- nvDebugCheck(m_mem != NULL);
- nvDebugCheck(x < m_width);
- nvDebugCheck(y < m_height);
- nvDebugCheck(c < m_componentNum);
- m_mem[(c * m_height + y) * m_width + x] = f;
-}
-
-/// Add to pixel component.
-inline void FloatImage::addPixel(float f, uint x, uint y, uint c)
-{
- nvDebugCheck(m_mem != NULL);
- nvDebugCheck(x < m_width);
- nvDebugCheck(y < m_height);
- nvDebugCheck(c < m_componentNum);
- m_mem[(c * m_height + y) * m_width + x] += f;
-}
-
-/// Get pixel component.
-inline float FloatImage::pixel(uint x, uint y, uint c) const
-{
- nvDebugCheck(m_mem != NULL);
- nvDebugCheck(x < m_width);
- nvDebugCheck(y < m_height);
- nvDebugCheck(c < m_componentNum);
- return m_mem[(c * m_height + y) * m_width + x];
-}
-
-/// Set pixel component.
-inline void FloatImage::setPixel(float f, uint idx)
-{
- nvDebugCheck(idx < m_count);
- m_mem[idx] = f;
-}
-
-/// Get pixel component.
-inline float FloatImage::pixel(uint idx) const
-{
- nvDebugCheck(idx < m_count);
- return m_mem[idx];
-}
-
-inline uint FloatImage::index(uint x, uint y) const
-{
- nvDebugCheck(x < m_width);
- nvDebugCheck(y < m_height);
- return y * m_width + x;
-}
-
-inline uint FloatImage::indexClamp(int x, int y) const
-{
- return nv::clamp(y, int(0), int(m_height-1)) * m_width + nv::clamp(x, int(0), int(m_width-1));
-}
-
-inline int repeat_remainder(int a, int b)
-{
- if (a >= 0) return a % b;
- else return (a + 1) % b + b - 1;
-}
-
-inline uint FloatImage::indexRepeat(int x, int y) const
-{
- return repeat_remainder(y, m_height) * m_width + repeat_remainder(x, m_width);
-}
-
-inline uint FloatImage::indexMirror(int x, int y) const
-{
- if (m_width == 1) x = 0;
-
- x = abs(x);
- while (x >= m_width) {
- x = abs(m_width + m_width - x - 2);
- }
-
- if (m_height == 1) y = 0;
-
- y = abs(y);
- while (y >= m_height) {
- y = abs(m_height + m_height - y - 2);
- }
-
- return index(x, y);
-}
-
-inline uint FloatImage::index(int x, int y, WrapMode wm) const
-{
- if (wm == WrapMode_Clamp) return indexClamp(x, y);
- if (wm == WrapMode_Repeat) return indexRepeat(x, y);
- /*if (wm == WrapMode_Mirror)*/ return indexMirror(x, y);
-}
-
-} // nv namespace
-
-
-
-#endif // NV_IMAGE_FLOATIMAGE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/HoleFilling.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/HoleFilling.cpp
deleted file mode 100644
index 363f97b3..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/HoleFilling.cpp
+++ /dev/null
@@ -1,849 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvimage/HoleFilling.h>
-#include <nvimage/FloatImage.h>
-
-#include <nvmath/nvmath.h>
-
-#include <nvcore/Containers.h>
-#include <nvcore/Ptr.h>
-
-
-using namespace nv;
-
-float BitMap::sampleLinearClamp(float x, float y) const
-{
- const float fracX = x - floor(x);
- const float fracY = y - floor(y);
-
- const uint ix0 = ::clamp(uint(floor(x)), 0U, m_width-1);
- const uint iy0 = ::clamp(uint(floor(y)), 0U, m_height-1);
- const uint ix1 = ::clamp(uint(floor(x))+1, 0U, m_width-1);
- const uint iy1 = ::clamp(uint(floor(y))+1, 0U, m_height-1);
-
- float f1 = bitAt(ix0, iy0);
- float f2 = bitAt(ix1, iy0);
- float f3 = bitAt(ix0, iy1);
- float f4 = bitAt(ix1, iy1);
-
- float i1 = lerp(f1, f2, fracX);
- float i2 = lerp(f3, f4, fracX);
-
- return lerp(i1, i2, fracY);
-}
-
-
-// This is a variation of Sapiro's inpainting method.
-void nv::fillExtrapolate(int passCount, FloatImage * img, BitMap * bmap)
-{
- nvCheck(img != NULL);
- nvCheck(bmap != NULL);
-
- const int w = img->width();
- const int h = img->height();
- const int count = img->componentNum();
-
- nvCheck(bmap->width() == uint(w));
- nvCheck(bmap->height() == uint(h));
-
- AutoPtr<BitMap> newbmap(new BitMap(w, h));
- newbmap->clearAll();
-
- for(int p = 0; p < passCount; p++)
- {
- for(int c = 0; c < count; c++)
- {
- float * channel = img->channel(c);
-
- for(int y = 0; y < h; y++) {
- for(int x = 0; x < w; x++) {
-
- if (bmap->bitAt(x, y)) {
- // Not a hole.
- newbmap->setBitAt(x, y);
- continue;
- }
-
- const bool west = bmap->bitAt(img->indexClamp(x-1, y));
- const bool east = bmap->bitAt(img->indexClamp(x+1, y));
- const bool north = bmap->bitAt(img->indexClamp(x, y-1));
- const bool south = bmap->bitAt(img->indexClamp(x, y+1));
- const bool northwest = bmap->bitAt(img->indexClamp(x-1, y-1));
- const bool northeast = bmap->bitAt(img->indexClamp(x+1, y-1));
- const bool southwest = bmap->bitAt(img->indexClamp(x-1, y+1));
- const bool southeast = bmap->bitAt(img->indexClamp(x+1, y+1));
-
- int num = west + east + north + south + northwest + northeast + southwest + southeast;
-
- if (num != 0) {
-
- float average = 0.0f;
- if (num == 3 && west && northwest && southwest) {
- average = channel[img->indexClamp(x-1, y)];
- }
- else if (num == 3 && east && northeast && southeast) {
- average = channel[img->indexClamp(x+1, y)];
- }
- else if (num == 3 && north && northwest && northeast) {
- average = channel[img->indexClamp(x, y-1)];
- }
- else if (num == 3 && south && southwest && southeast) {
- average = channel[img->indexClamp(x, y+1)];
- }
- else {
- float total = 0.0f;
- if (west) { average += 1 * channel[img->indexClamp(x-1, y)]; total += 1; }
- if (east) { average += 1 * channel[img->indexClamp(x+1, y)]; total += 1; }
- if (north) { average += 1 * channel[img->indexClamp(x, y-1)]; total += 1; }
- if (south) { average += 1 * channel[img->indexClamp(x, y+1)]; total += 1; }
-
- if (northwest) { average += channel[img->indexClamp(x-1, y-1)]; ++total; }
- if (northeast) { average += channel[img->indexClamp(x+1, y-1)]; ++total; }
- if (southwest) { average += channel[img->indexClamp(x-1, y+1)]; ++total; }
- if (southeast) { average += channel[img->indexClamp(x+1, y+1)]; ++total; }
-
- average /= total;
- }
-
- channel[img->indexClamp(x, y)] = average;
- newbmap->setBitAt(x, y);
- }
- }
- }
- }
-
- // Update the bit mask.
- swap(*newbmap, *bmap);
- }
-}
-
-
-namespace {
-
- struct Neighbor {
- uint16 x;
- uint16 y;
- uint32 d;
- };
-
- // Compute euclidean squared distance.
- static uint dist( uint16 ax, uint16 ay, uint16 bx, uint16 by ) {
- int dx = bx - ax;
- int dy = by - ay;
- return uint(dx*dx + dy*dy);
- }
-
- // Check neighbour, this is the core of the EDT algorithm.
- static void checkNeighbour( int x, int y, Neighbor * e, const Neighbor & n ) {
- nvDebugCheck(e != NULL);
-
- uint d = dist( x, y, n.x, n.y );
- if( d < e->d ) {
- e->x = n.x;
- e->y = n.y;
- e->d = d;
- }
- }
-
-} // namespace
-
-// Voronoi filling using EDT-4
-// This implementation is based on Danielsson's algorithm published in:
-// "Euclidean Distance Mapping" Per-Erik Danielsson, Computer Graphics and Image Processing, 14, 1980
-void nv::fillVoronoi(FloatImage * img, const BitMap * bmap)
-{
- nvCheck(img != NULL);
-
- const int w = img->width();
- const int h = img->height();
- const int count = img->componentNum();
-
- nvCheck(bmap->width() == uint(w));
- nvCheck(bmap->height() == uint(h));
-
- Array<Neighbor> edm;
- edm.resize(w * h);
-
- int x, y;
- int x0, x1, y0, y1;
-
- // Init edm.
- for( y = 0; y < h; y++ ) {
- for( x = 0; x < w; x++ ) {
- if( bmap->bitAt(x, y) ) {
- edm[y * w + x].x = x;
- edm[y * w + x].y = y;
- edm[y * w + x].d = 0;
- }
- else {
- edm[y * w + x].x = w;
- edm[y * w + x].y = h;
- edm[y * w + x].d = w*w + h*h;
- }
- }
- }
-
- // First pass.
- for( y = 0; y < h; y++ ) {
- for( x = 0; x < w; x++ ) {
- x0 = clamp(x-1, 0, w-1); // @@ Wrap?
- x1 = clamp(x+1, 0, w-1);
- y0 = clamp(y-1, 0, h-1);
-
- Neighbor & e = edm[y * w + x];
- checkNeighbour(x, y, &e, edm[y0 * w + x0]);
- checkNeighbour(x, y, &e, edm[y0 * w + x]);
- checkNeighbour(x, y, &e, edm[y0 * w + x1]);
- checkNeighbour(x, y, &e, edm[y * w + x0]);
- }
-
- for( x = w-1; x >= 0; x-- ) {
- x1 = clamp(x+1, 0, w-1);
-
- Neighbor & e = edm[y * w + x];
- checkNeighbour(x, y, &e, edm[y * w + x1]);
- }
- }
-
- // Third pass.
- for( y = h-1; y >= 0; y-- ) {
- for( x = w-1; x >= 0; x-- ) {
- x0 = clamp(x-1, 0, w-1);
- x1 = clamp(x+1, 0, w-1);
- y1 = clamp(y+1, 0, h-1);
-
- Neighbor & e = edm[y * w + x];
- checkNeighbour(x, y, &e, edm[y * w + x1]);
- checkNeighbour(x, y, &e, edm[y1 * w + x0]);
- checkNeighbour(x, y, &e, edm[y1 * w + x]);
- checkNeighbour(x, y, &e, edm[y1 * w + x1]);
- }
-
- for( x = 0; x < w; x++ ) {
- x0 = clamp(x-1, 0, w-1);
-
- Neighbor & e = edm[y * w + x];
- checkNeighbour(x, y, &e, edm[y * w + x0]);
- }
- }
-
- // Fill empty holes.
- for( y = 0; y < h; y++ ) {
- for( x = 0; x < w; x++ ) {
- const int sx = edm[y * w + x].x;
- const int sy = edm[y * w + x].y;
-
- if (sx < w && sy < h)
- {
- if (sx != x || sy != y) {
- for(int c = 0; c < count; c++ ) {
- img->setPixel(img->pixel(sx, sy, c), x, y, c);
- }
- }
- }
- }
- }
-
-}
-
-
-static bool downsample(const FloatImage * src, const BitMap * srcMask, const FloatImage ** _dst, const BitMap ** _dstMask)
-{
- const uint w = src->width();
- const uint h = src->height();
- const uint count = src->componentNum();
-
- // count holes in srcMask, return false if fully filled.
- uint holes = 0;
- for(uint y = 0; y < h; y++) {
- for(uint x = 0; x < w; x++) {
- holes += srcMask->bitAt(x, y) == 0;
- }
- }
- if (holes == 0 || (w == 2 || h == 2)) {
- // Stop when no holes or when the texture is very small.
- return false;
- }
-
- // Apply box filter to image and mask and return true.
- const uint nw = w / 2;
- const uint nh = h / 2;
-
- FloatImage * dst = new FloatImage();
- dst->allocate(count, nw, nh);
-
- BitMap * dstMask = new BitMap(nw, nh);
- dstMask->clearAll();
-
- for(uint c = 0; c < count; c++) {
- for(uint y = 0; y < nh; y++) {
- for(uint x = 0; x < nw; x++) {
-
- const uint x0 = 2 * x + 0;
- const uint x1 = 2 * x + 1;
- const uint y0 = 2 * y + 0;
- const uint y1 = 2 * y + 1;
-
- const float f0 = src->pixel(x0, y0, c);
- const float f1 = src->pixel(x1, y0, c);
- const float f2 = src->pixel(x0, y1, c);
- const float f3 = src->pixel(x1, y1, c);
-
- const bool b0 = srcMask->bitAt(x0, y0);
- const bool b1 = srcMask->bitAt(x1, y0);
- const bool b2 = srcMask->bitAt(x0, y1);
- const bool b3 = srcMask->bitAt(x1, y1);
-
- if (b0 || b1 || b2 || b3) {
- // Set bit mask.
- dstMask->setBitAt(x, y);
-
- // Set pixel.
- float value = 0.0f;
- int total = 0;
- if (b0) { value += f0; total++; }
- if (b1) { value += f1; total++; }
- if (b2) { value += f2; total++; }
- if (b3) { value += f3; total++; }
- dst->setPixel(value / total, x, y, c);
- }
- }
- }
- }
-
- *_dst = dst;
- *_dstMask = dstMask;
-
- return true;
-}
-
-// This is the filter used in the Lumigraph paper.
-void nv::fillPullPush(FloatImage * img, const BitMap * bmap)
-{
- nvCheck(img != NULL);
-
- const uint count = img->componentNum();
- const uint w = img->width();
- const uint h = img->height();
- const uint num = log2(max(w,h));
-
- // Build mipmap chain.
- Array<const FloatImage *> mipmaps(num);
- Array<const BitMap *> mipmapMasks(num);
-
- mipmaps.append(img);
- mipmapMasks.append(bmap);
-
- const FloatImage * current;
- const BitMap * currentMask;
-
- // Compute mipmap chain.
- while(downsample(mipmaps.back(), mipmapMasks.back(), &current, &currentMask))
- {
- mipmaps.append(current);
- mipmapMasks.append(currentMask);
- }
-
- // Sample mipmaps until non-hole is found.
- for(uint y = 0; y < h; y++) {
- for(uint x = 0; x < w; x++) {
-
- int sx = x;
- int sy = y;
- //float sx = x;
- //float sy = y;
-
- const uint levelCount = mipmaps.count();
- for (uint l = 0; l < levelCount; l++)
- {
- //const float fx = sx / mipmaps[l]->width();
- //const float fy = sy / mipmaps[l]->height();
-
- if (mipmapMasks[l]->bitAt(sx, sy))
- {
- // Sample mipmaps[l](sx, sy) and copy to img(x, y)
- for(uint c = 0; c < count; c++) {
- //img->setPixel(mipmaps[l]->linear_clamp(fx, fy, c), x, y, c);
- img->setPixel(mipmaps[l]->pixel(sx, sy, c), x, y, c);
- }
- break;
- }
-
- sx /= 2;
- sy /= 2;
- }
- }
- }
-
- // Don't delete the original image and mask.
- mipmaps[0] = NULL;
- mipmapMasks[0] = NULL;
-
- // Delete the mipmaps.
- deleteAll(mipmaps);
- deleteAll(mipmapMasks);
-}
-
-// It looks much cooler with trilinear filtering
-void nv::fillPullPushLinear(FloatImage * img, const BitMap * bmap)
-{
- nvCheck(img != NULL);
-
- const uint count = img->componentNum();
- const uint w = img->width();
- const uint h = img->height();
- const uint num = log2(max(w,h));
-
- // Build mipmap chain.
- Array<const FloatImage *> mipmaps(num);
- Array<const BitMap *> mipmapMasks(num);
-
- mipmaps.append(img);
- mipmapMasks.append(bmap);
-
- const FloatImage * current;
- const BitMap * currentMask;
-
- // Compute mipmap chain.
- while(downsample(mipmaps.back(), mipmapMasks.back(), &current, &currentMask))
- {
- mipmaps.append(current);
- mipmapMasks.append(currentMask);
- }
-
- // Sample mipmaps until non-hole is found.
- for(uint y = 0; y < h; y++) {
- for(uint x = 0; x < w; x++) {
-
- float sx = x;
- float sy = y;
-
- float coverageSum = 0.0f;
-
- const uint levelCount = mipmaps.count();
- for (uint l = 0; l < levelCount; l++)
- {
- const float fx = sx / mipmaps[l]->width();
- const float fy = sy / mipmaps[l]->height();
-
- float coverage = mipmapMasks[l]->sampleLinearClamp(sx, sy);
-
- if (coverage > 0.0f)
- {
- // Sample mipmaps[l](sx, sy) and copy to img(x, y)
- for(uint c = 0; c < count; c++) {
- img->addPixel((1 - coverageSum) * mipmaps[l]->sampleLinearClamp(fx, fy, c), x, y, c);
- }
-
- coverageSum += coverage;
-
- if (coverageSum >= 1.0f)
- {
- break;
- }
- }
-
- sx /= 2;
- sy /= 2;
- }
- }
- }
-
- // Don't delete the original image and mask.
- mipmaps[0] = NULL;
- mipmapMasks[0] = NULL;
-
- // Delete the mipmaps.
- deleteAll(mipmaps);
- deleteAll(mipmapMasks);
-}
-
-
-
-/*
-
-This Code is from Charles Bloom:
-
-DoPixelSeamFix
-10-20-02
-
-Looks in the 5x5 local neighborhood (LocalPixels) of the desired pixel to fill.
-It tries to build a quadratic model of the neighborhood surface to use in
-extrapolating. You need 5 pixels to establish a 2d quadratic curve.
-
-This is really just a nice generic way to extrapolate pixels. It also happens
-to work great for seam-fixing.
-
-Note that I'm working on normals, but I treat them just as 3 scalars and normalize
-at the end. To be more correct, I would work on the surface of a sphere, but that
-just seems like way too much work.
-
-*/
-
-struct LocalPixels
-{
- // 5x5 neighborhood
- // the center is at result
- // index [y][x]
- bool fill[5][5];
- float data[5][5];
-
- mutable float result;
- mutable float weight;
-
- bool Quad3SubH(float * pQ, int row) const
- {
- const bool * pFill = fill[row];
- const float * pDat = data[row];
-
- if ( pFill[1] && pFill[2] && pFill[3] )
- {
- // good row
- *pQ = pDat[1] - 2.f * pDat[2] + pDat[3];
- return true;
- }
- else if ( pFill[0] && pFill[1] && pFill[2] )
- {
- // good row
- *pQ = pDat[0] - 2.f * pDat[1] + pDat[2];
- return true;
- }
- else if ( pFill[2] && pFill[3] && pFill[4] )
- {
- // good row
- *pQ = pDat[2] - 2.f * pDat[3] + pDat[4];
- return true;
- }
- return false;
- }
-
- // improve result with a horizontal quad in row 1 and/or
- bool Quad3SubV(float * pQ, int col) const
- {
- if ( fill[1][col] && fill[2][col] && fill[3][col] )
- {
- // good row
- *pQ = data[1][col] - 2.f * data[2][col] + data[3][col];
- return true;
- }
- else if ( fill[0][col] && fill[1][col] && fill[2][col] )
- {
- // good row
- *pQ = data[0][col] - 2.f * data[1][col] + data[2][col];
- return true;
- }
- else if ( fill[2][col] && fill[3][col] && fill[4][col] )
- {
- // good row
- *pQ = data[2][col] - 2.f * data[3][col] + data[4][col];
- return true;
- }
- return false;
- }
-
- bool Quad3H(float * pQ) const
- {
- if (!Quad3SubH(pQ,1))
- {
- return Quad3SubH(pQ,3);
- }
- float q = 0.0f; // initializer not needed, just make it shut up
- if (Quad3SubH(&q, 3))
- {
- // got q and pQ
- *pQ = (*pQ+q)*0.5f;
- }
- return true;
- }
-
- bool Quad3V(float * pQ) const
- {
- if (!Quad3SubV(pQ, 1))
- {
- return Quad3SubV(pQ, 3);
- }
- float q = 0.0f; // initializer not needed, just make it shut up
- if (Quad3SubV(&q, 3))
- {
- // got q and pQ
- *pQ = (*pQ + q) * 0.5f;
- }
- return true;
- }
- // Quad returns ([0]+[2] - 2.f*[1])
- // a common want is [1] - ([0]+[2])*0.5f ;
- // so use -0.5f*Quad
-
- bool tryQuads() const
- {
- bool res = false;
-
- // look for a pair that straddles the middle:
- if ( fill[2][1] && fill[2][3] )
- {
- // got horizontal straddle
- float q;
- if ( Quad3H(&q) )
- {
- result += (data[2][1] + data[2][3] - q) * 0.5f;
- weight += 1.f;
- res = true;
- }
- }
- if ( fill[1][2] && fill[3][2] )
- {
- // got vertical straddle
- float q;
- if ( Quad3V(&q) )
- {
- result += (data[1][2] + data[3][2] - q) * 0.5f;
- weight += 1.f;
- res = true;
- }
- }
-
- // look for pairs that lead into the middle :
- if ( fill[2][0] && fill[2][1] )
- {
- // got left-side pair
- float q;
- if ( Quad3H(&q) )
- {
- result += data[2][1]*2.f - data[2][0] + q;
- weight += 1.f;
- res = true;
- }
- }
- if ( fill[2][3] && fill[2][4] )
- {
- // got right-side pair
- float q;
- if ( Quad3H(&q) )
- {
- result += data[2][3]*2.f - data[2][4] + q;
- weight += 1.f;
- res = true;
- }
- }
- if ( fill[0][2] && fill[1][2] )
- {
- // got left-side pair
- float q;
- if ( Quad3V(&q) )
- {
- result += data[1][2]*2.f - data[0][2] + q;
- weight += 1.f;
- res = true;
- }
- }
- if ( fill[3][2] && fill[4][2] )
- {
- // got right-side pair
- float q;
- if ( Quad3V(&q) )
- {
- result += data[3][2]*2.f - data[4][2] + q;
- weight += 1.f;
- res = true;
- }
- }
- return res;
- }
-
- bool tryPlanar() const
- {
- // four cases :
- const int indices[] =
- {
- 2,1, 1,2, 1,1,
- 2,1, 3,2, 3,1,
- 2,3, 1,2, 1,3,
- 2,3, 3,2, 3,3
- };
- bool res = false;
- for (int i = 0; i < 4; i++)
- {
- const int * I = indices + i*6;
- if (!fill[ I[0] ][ I[1] ])
- continue;
- if (!fill[ I[2] ][ I[3] ])
- continue;
- if (!fill[ I[4] ][ I[5] ])
- continue;
-
- result += data[ I[0] ][ I[1] ] + data[ I[2] ][ I[3] ] - data[ I[4] ][ I[5] ];
- weight += 1.0f;
- res = true;
- }
- return res;
- }
-
- bool tryTwos() const
- {
- bool res = false;
-
- if (fill[2][1] && fill[2][3])
- {
- result += (data[2][1] + data[2][3]) * 0.5f;
- weight += 1.0f;
- res = true;
- }
- if (fill[1][2] && fill[3][2])
- {
- result += (data[1][2] + data[3][2]) * 0.5f;
- weight += 1.0f;
- res = true;
- }
-
- // four side-rotates :
- const int indices[] =
- {
- 2,1, 2,0,
- 2,3, 2,4,
- 1,2, 0,2,
- 3,2, 4,2,
- };
- for (int i = 0; i < 4; i++)
- {
- const int * I = indices + i*4;
- if (!fill[ I[0] ][ I[1] ])
- continue;
- if (!fill[ I[2] ][ I[3] ])
- continue;
-
- result += data[ I[0] ][ I[1] ]*2.0f - data[ I[2] ][ I[3] ];
- weight += 1.0f;
- res = true;
- }
-
- return res;
- }
-
- bool doLocalPixelFill() const
- {
- result = 0.0f;
- weight = 0.0f;
-
- if (tryQuads()) {
- return true;
- }
-
- if (tryPlanar()) {
- return true;
- }
-
- return tryTwos();
- }
-
-}; // struct LocalPixels
-
-
-
-// This is a quadratic extrapolation filter from Charles Bloom (DoPixelSeamFix). Used with his permission.
-void nv::fillQuadraticExtrapolate(int passCount, FloatImage * img, BitMap * bmap, int coverageIndex /*= -1*/)
-{
- nvCheck(passCount > 0);
- nvCheck(img != NULL);
- nvCheck(bmap != NULL);
-
- const int w = img->width();
- const int h = img->height();
- const int count = img->componentNum();
-
- nvCheck(bmap->width() == uint(w));
- nvCheck(bmap->height() == uint(h));
-
- AutoPtr<BitMap> newbmap( new BitMap(w, h) );
- newbmap->clearAll();
-
- float * coverageChannel = NULL;
- if (coverageIndex != -1)
- {
- coverageChannel = img->channel(coverageIndex);
- }
-
- int firstChannel = -1;
-
- for (int p = 0; p < passCount; p++)
- {
- for (int c = 0; c < count; c++)
- {
- if (c == coverageIndex) continue;
- if (firstChannel == -1) firstChannel = c;
-
- float * channel = img->channel(c);
-
- for (int yb = 0; yb < h; yb++) {
- for (int xb = 0; xb < w; xb++) {
-
- if (bmap->bitAt(xb, yb)) {
- // Not a hole.
- newbmap->setBitAt(xb, yb);
- continue;
- }
-
- int numFill = 0;
-
- LocalPixels lp;
- for (int ny = 0; ny < 5; ny++)
- {
- int y = (yb + ny - 2);
- if ( y < 0 || y >= h )
- {
- // out of range
- for(int i = 0; i < 5; i++)
- {
- lp.fill[ny][i] = false;
- }
- continue;
- }
-
- for (int nx = 0; nx < 5; nx++)
- {
- int x = (xb + nx - 2);
- if (x < 0 || x >= w)
- {
- lp.fill[ny][nx] = false;
- }
- else
- {
- int idx = img->index(x, y);
- if (!bmap->bitAt(idx))
- {
- lp.fill[ny][nx] = false;
- }
- else
- {
- lp.fill[ny][nx] = true;
- lp.data[ny][nx] = channel[idx];
- numFill++;
- }
- }
- }
- }
-
- // need at least 3 to do anything decent
- if (numFill < 2)
- continue;
-
- nvDebugCheck(lp.fill[2][2] == false);
-
- if (lp.doLocalPixelFill())
- {
- const int idx = img->index(xb, yb);
- channel[idx] = lp.result / lp.weight;
-
- if (c == firstChannel)
- {
- //coverageChannel[idx] /= lp.weight; // @@ Not sure what this was for, coverageChannel[idx] is always zero.
- newbmap->setBitAt(xb, yb);
- }
- }
- }
- }
- }
-
- // Update the bit mask.
- swap(*newbmap, *bmap);
- }
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/HoleFilling.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/HoleFilling.h
deleted file mode 100644
index cb97911c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/HoleFilling.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_IMAGE_HOLEFILLING_H
-#define NV_IMAGE_HOLEFILLING_H
-
-#include <nvcore/BitArray.h>
-#include <nvimage/nvimage.h>
-
-namespace nv
-{
- class FloatImage;
-
- /// Bit mask.
- class BitMap
- {
- public:
- BitMap(uint w, uint h) :
- m_width(w), m_height(h), m_bitArray(w*h)
- {
- }
-
- uint width() const { return m_width; }
- uint height() const { return m_height; }
-
- float sampleLinearClamp(float x, float y) const;
-
- bool bitAt(uint x, uint y) const
- {
- nvDebugCheck(x < m_width && y < m_height);
- return m_bitArray.bitAt(y * m_width + x);
- }
- bool bitAt(uint idx) const
- {
- return m_bitArray.bitAt(idx);
- }
-
- void setBitAt(uint x, uint y)
- {
- nvDebugCheck(x < m_width && y < m_height);
- m_bitArray.setBitAt(y * m_width + x);
- }
- void setBitAt(uint idx)
- {
- m_bitArray.setBitAt(idx);
- }
-
- void clearBitAt(uint x, uint y)
- {
- nvDebugCheck(x < m_width && y < m_height);
- m_bitArray.clearBitAt(y * m_width + x);
- }
- void clearBitAt(uint idx)
- {
- m_bitArray.clearBitAt(idx);
- }
-
- void clearAll()
- {
- m_bitArray.clearAll();
- }
-
- void setAll()
- {
- m_bitArray.setAll();
- }
-
- void toggleAll()
- {
- m_bitArray.toggleAll();
- }
-
- friend void swap(BitMap & a, BitMap & b)
- {
- nvCheck(a.m_width == b.m_width);
- nvCheck(a.m_height == b.m_height);
- //swap(const_cast<uint &>(a.m_width), const_cast<uint &>(b.m_width));
- //swap(const_cast<uint &>(a.m_height), const_cast<uint &>(b.m_height));
- swap(a.m_bitArray, b.m_bitArray);
- }
-
- private:
-
- const uint m_width;
- const uint m_height;
- BitArray m_bitArray;
-
- };
-
- NVIMAGE_API void fillVoronoi(FloatImage * img, const BitMap * bmap);
- NVIMAGE_API void fillPullPush(FloatImage * img, const BitMap * bmap);
- NVIMAGE_API void fillPullPushLinear(FloatImage * img, const BitMap * bmap);
-
- NVIMAGE_API void fillExtrapolate(int passCount, FloatImage * img, BitMap * bmap);
- NVIMAGE_API void fillQuadraticExtrapolate(int passCount, FloatImage * img, BitMap * bmap, int coverageIndex = -1);
-
-} // nv namespace
-
-#endif // NV_IMAGE_HOLEFILLING_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/Image.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/Image.cpp
deleted file mode 100644
index 5097da81..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/Image.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvimage/Image.h>
-#include <nvimage/ImageIO.h>
-
-#include <nvmath/Color.h>
-
-#include <nvcore/Debug.h>
-#include <nvcore/Ptr.h>
-#include <nvcore/Containers.h> // swap
-
-
-using namespace nv;
-
-Image::Image() : m_width(0), m_height(0), m_format(Format_RGB), m_data(NULL)
-{
-}
-
-Image::Image(const Image & img) : m_data(NULL)
-{
- allocate(img.m_width, img.m_height);
- m_format = img.m_format;
- memcpy(m_data, img.m_data, sizeof(Color32) * m_width * m_height);
-}
-
-Image::~Image()
-{
- free();
-}
-
-const Image & Image::operator=(const Image & img)
-{
- allocate(img.m_width, img.m_height);
- m_format = img.m_format;
- memcpy(m_data, img.m_data, sizeof(Color32) * m_width * m_height);
- return *this;
-}
-
-
-void Image::allocate(uint w, uint h)
-{
- free();
- m_width = w;
- m_height = h;
- m_data = malloc<Color32>(w * h);
-}
-
-bool Image::load(const char * name)
-{
- free();
-
- AutoPtr<Image> img(ImageIO::load(name));
- if (img == NULL) {
- return false;
- }
-
- swap(m_width, img->m_width);
- swap(m_height, img->m_height);
- swap(m_format, img->m_format);
- swap(m_data, img->m_data);
-
- return true;
-}
-
-void Image::wrap(void * data, uint w, uint h)
-{
- free();
- m_data = (Color32 *)data;
- m_width = w;
- m_height = h;
-}
-
-void Image::unwrap()
-{
- m_data = NULL;
- m_width = 0;
- m_height = 0;
-}
-
-
-void Image::free()
-{
- ::free(m_data);
- m_data = NULL;
-}
-
-
-uint Image::width() const
-{
- return m_width;
-}
-
-uint Image::height() const
-{
- return m_height;
-}
-
-const Color32 * Image::scanline(uint h) const
-{
- nvDebugCheck(h < m_height);
- return m_data + h * m_width;
-}
-
-Color32 * Image::scanline(uint h)
-{
- nvDebugCheck(h < m_height);
- return m_data + h * m_width;
-}
-
-const Color32 * Image::pixels() const
-{
- return m_data;
-}
-
-Color32 * Image::pixels()
-{
- return m_data;
-}
-
-const Color32 & Image::pixel(uint idx) const
-{
- nvDebugCheck(idx < m_width * m_height);
- return m_data[idx];
-}
-
-Color32 & Image::pixel(uint idx)
-{
- nvDebugCheck(idx < m_width * m_height);
- return m_data[idx];
-}
-
-
-Image::Format Image::format() const
-{
- return m_format;
-}
-
-void Image::setFormat(Image::Format f)
-{
- m_format = f;
-}
-
-void Image::fill(Color32 c)
-{
- const uint size = m_width * m_height;
- for (uint i = 0; i < size; ++i)
- {
- m_data[i] = c;
- }
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/Image.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/Image.h
deleted file mode 100644
index da1b0c5e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/Image.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_IMAGE_IMAGE_H
-#define NV_IMAGE_IMAGE_H
-
-#include <nvcore/Debug.h>
-#include <nvimage/nvimage.h>
-
-namespace nv
-{
- class Color32;
-
- /// 32 bit RGBA image.
- class NVIMAGE_CLASS Image
- {
- public:
-
- enum Format
- {
- Format_RGB,
- Format_ARGB,
- };
-
- Image();
- Image(const Image & img);
- ~Image();
-
- const Image & operator=(const Image & img);
-
-
- void allocate(uint w, uint h);
- bool load(const char * name);
-
- void wrap(void * data, uint w, uint h);
- void unwrap();
-
- uint width() const;
- uint height() const;
-
- const Color32 * scanline(uint h) const;
- Color32 * scanline(uint h);
-
- const Color32 * pixels() const;
- Color32 * pixels();
-
- const Color32 & pixel(uint idx) const;
- Color32 & pixel(uint idx);
-
- const Color32 & pixel(uint x, uint y) const;
- Color32 & pixel(uint x, uint y);
-
- Format format() const;
- void setFormat(Format f);
-
- void fill(Color32 c);
-
- private:
- void free();
-
- private:
- uint m_width;
- uint m_height;
- Format m_format;
- Color32 * m_data;
- };
-
-
- inline const Color32 & Image::pixel(uint x, uint y) const
- {
- nvDebugCheck(x < width() && y < height());
- return pixel(y * width() + x);
- }
-
- inline Color32 & Image::pixel(uint x, uint y)
- {
- nvDebugCheck(x < width() && y < height());
- return pixel(y * width() + x);
- }
-
-} // nv namespace
-
-
-#endif // NV_IMAGE_IMAGE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ImageIO.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/ImageIO.cpp
deleted file mode 100644
index 3e254b94..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ImageIO.cpp
+++ /dev/null
@@ -1,1825 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include "ImageIO.h"
-#include "Image.h"
-#include "FloatImage.h"
-#include "TgaFile.h"
-#include "PsdFile.h"
-
-#include <nvmath/Color.h>
-
-#include <nvcore/Ptr.h>
-#include <nvcore/Containers.h>
-#include <nvcore/StrLib.h>
-#include <nvcore/StdStream.h>
-//#include <nvcore/Tokenizer.h> // @@ Disable temporarily
-#include <nvcore/TextWriter.h>
-
-// Extern
-#if defined(HAVE_JPEG)
-extern "C" {
-# include <jpeglib.h>
-}
-#endif
-
-#if defined(HAVE_PNG)
-# include <png.h>
-#endif
-
-#if defined(HAVE_TIFF)
-# define _TIFF_DATA_TYPEDEFS_
-# include <tiffio.h>
-#endif
-
-#if defined(HAVE_OPENEXR)
-# include <ImfIO.h>
-# include <ImathBox.h>
-# include <ImfChannelList.h>
-# include <ImfInputFile.h>
-# include <ImfOutputFile.h>
-# include <ImfArray.h>
-#endif
-
-#if defined(HAVE_FREEIMAGE)
-# include <FreeImage.h>
-#endif
-
-using namespace nv;
-
-namespace {
-
- // Array of image load plugins.
-// static HashMap<String, ImageInput_Plugin> s_plugin_load_map;
-
- // Array of image save plugins.
-// static HashMap<String, ImageOutput_Plugin> s_plugin_save_map;
-
- struct Color555 {
- uint16 b : 5;
- uint16 g : 5;
- uint16 r : 5;
- };
-
-} // namespace
-
-#if defined(HAVE_FREEIMAGE)
-static Image * loadFreeImage(FREE_IMAGE_FORMAT fif, Stream & s);
-static FloatImage * loadFloatFreeImage(FREE_IMAGE_FORMAT fif, Stream & s);
-#endif
-
-Image * nv::ImageIO::load(const char * fileName)
-{
- nvDebugCheck(fileName != NULL);
-
- StdInputStream stream(fileName);
-
- if (stream.isError()) {
- return NULL;
- }
-
- return ImageIO::load(fileName, stream);
-}
-
-Image * nv::ImageIO::load(const char * fileName, Stream & s)
-{
- nvDebugCheck(fileName != NULL);
- nvDebugCheck(s.isLoading());
-
- const char * extension = Path::extension(fileName);
-
- if (strCaseCmp(extension, ".tga") == 0) {
- return ImageIO::loadTGA(s);
- }
-#if defined(HAVE_FREEIMAGE)
- FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(fileName);
- if (fif != FIF_UNKNOWN && FreeImage_FIFSupportsReading(fif)) {
- return loadFreeImage(fif, s);
- }
-#endif
-#if defined(HAVE_JPEG)
- if (strCaseCmp(extension, ".jpg") == 0 || strCaseCmp(extension, ".jpeg") == 0) {
- return loadJPG(s);
- }
-#endif
-#if defined(HAVE_PNG)
- if (strCaseCmp(extension, ".png") == 0) {
- return loadPNG(s);
- }
-#endif
-
- if (strCaseCmp(extension, ".psd") == 0) {
- return loadPSD(s);
- }
-
- // @@ use image plugins?
-
- return NULL;
-}
-
-bool nv::ImageIO::save(const char * fileName, Stream & s, const Image * img)
-{
- nvDebugCheck(fileName != NULL);
- nvDebugCheck(s.isSaving());
- nvDebugCheck(img != NULL);
-
- const char * extension = Path::extension(fileName);
-
- if (strCaseCmp(extension, ".tga") == 0) {
- return ImageIO::saveTGA(s, img);
- }
-
- return false;
-}
-
-bool nv::ImageIO::save(const char * fileName, const Image * img)
-{
- nvDebugCheck(fileName != NULL);
- nvDebugCheck(img != NULL);
-
- StdOutputStream stream(fileName);
- if (stream.isError())
- {
- return false;
- }
-
- return ImageIO::save(fileName, stream, img);
-}
-
-FloatImage * nv::ImageIO::loadFloat(const char * fileName)
-{
- nvDebugCheck(fileName != NULL);
-
- StdInputStream stream(fileName);
-
- if (stream.isError()) {
- return NULL;
- }
-
- return loadFloat(fileName, stream);
-}
-
-FloatImage * nv::ImageIO::loadFloat(const char * fileName, Stream & s)
-{
- nvDebugCheck(fileName != NULL);
-
- const char * extension = Path::extension(fileName);
-
-#if defined(HAVE_TIFF)
- if (strCaseCmp(extension, ".tif") == 0 || strCaseCmp(extension, ".tiff") == 0) {
- return loadFloatTIFF(fileName, s);
- }
-#endif
-#if defined(HAVE_OPENEXR)
- if (strCaseCmp(extension, ".exr") == 0) {
- return loadFloatEXR(fileName, s);
- }
-#endif
-#if defined(HAVE_FREEIMAGE)
- FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(fileName);
- if (fif != FIF_UNKNOWN && FreeImage_FIFSupportsReading(fif)) {
- return loadFloatFreeImage(fif, s);
- }
-#endif
-
-/* // @@ Disable temporarily
- if (strCaseCmp(extension, ".pfm") == 0) {
- return loadFloatPFM(fileName, s);
- }
- if (strCaseCmp(extension, ".hdr") == 0) {
- return loadGridFloat(fileName, s);
- }
-*/
-
- return NULL;
-}
-
-
-bool nv::ImageIO::saveFloat(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components)
-{
- const char * extension = Path::extension(fileName);
-
-#if defined(HAVE_OPENEXR)
- if (strCaseCmp(extension, ".exr") == 0)
- {
- return ImageIO::saveFloatEXR(fileName, fimage, base_component, num_components);
- }
-#endif
-
-#if defined(HAVE_TIFF)
- if (strCaseCmp(extension, ".tif") == 0 || strCaseCmp(extension, ".tiff") == 0)
- {
- return ImageIO::saveFloatTIFF(fileName, fimage, base_component, num_components);
- }
-#endif
-
-/* // @@ Disable Temporarily
- if (strCaseCmp(extension, ".pfm") == 0)
- {
-// return ImageIO::saveFloatPFM(fileName, fimage, base_component, num_components);
- }
-*/
-
- if (num_components == 3 || num_components == 4)
- {
- AutoPtr<Image> image(fimage->createImage(base_component, num_components));
- nvCheck(image != NULL);
-
- if (num_components == 4)
- {
- image->setFormat(Image::Format_ARGB);
- }
-
- return ImageIO::save(fileName, image.ptr());
- }
-
- return false;
-}
-
-
-/// Load TGA image.
-Image * nv::ImageIO::loadTGA(Stream & s)
-{
- nvCheck(!s.isError());
- nvCheck(s.isLoading());
-
- TgaHeader tga;
- s << tga;
- s.seek(TgaHeader::Size + tga.id_length);
-
- // Get header info.
- bool rle = false;
- bool pal = false;
- bool rgb = false;
- bool grey = false;
-
- switch( tga.image_type ) {
- case TGA_TYPE_RLE_INDEXED:
- rle = true;
- // no break is intended!
- case TGA_TYPE_INDEXED:
- if( tga.colormap_type!=1 || tga.colormap_size!=24 || tga.colormap_length>256 ) {
- nvDebug( "*** ImageIO::loadTGA: Error, only 24bit paletted images are supported.\n" );
- return NULL;
- }
- pal = true;
- break;
-
- case TGA_TYPE_RLE_RGB:
- rle = true;
- // no break is intended!
- case TGA_TYPE_RGB:
- rgb = true;
- break;
-
- case TGA_TYPE_RLE_GREY:
- rle = true;
- // no break is intended!
- case TGA_TYPE_GREY:
- grey = true;
- break;
-
- default:
- nvDebug( "*** ImageIO::loadTGA: Error, unsupported image type.\n" );
- return NULL;
- }
-
- const uint pixel_size = (tga.pixel_size/8);
- nvDebugCheck(pixel_size <= 4);
-
- const uint size = tga.width * tga.height * pixel_size;
-
-
- // Read palette
- uint8 palette[768];
- if( pal ) {
- nvDebugCheck(tga.colormap_length < 256);
- s.serialize(palette, 3 * tga.colormap_length);
- }
-
- // Decode image.
- uint8 * mem = new uint8[size];
- if( rle ) {
- // Decompress image in src.
- uint8 * dst = mem;
- int num = size;
-
- while (num > 0) {
- // Get packet header
- uint8 c;
- s << c;
-
- uint count = (c & 0x7f) + 1;
- num -= count * pixel_size;
-
- if (c & 0x80) {
- // RLE pixels.
- uint8 pixel[4]; // uint8 pixel[pixel_size];
- s.serialize( pixel, pixel_size );
- do {
- memcpy(dst, pixel, pixel_size);
- dst += pixel_size;
- } while (--count);
- }
- else {
- // Raw pixels.
- count *= pixel_size;
- //file->Read8(dst, count);
- s.serialize(dst, count);
- dst += count;
- }
- }
- }
- else {
- s.serialize(mem, size);
- }
-
- // Allocate image.
- AutoPtr<Image> img(new Image());
- img->allocate(tga.width, tga.height);
-
- int lstep;
- Color32 * dst;
- if( tga.flags & TGA_ORIGIN_UPPER ) {
- lstep = tga.width;
- dst = img->pixels();
- }
- else {
- lstep = - tga.width;
- dst = img->pixels() + (tga.height-1) * tga.width;
- }
-
- // Write image.
- uint8 * src = mem;
- if( pal ) {
- for( int y = 0; y < tga.height; y++ ) {
- for( int x = 0; x < tga.width; x++ ) {
- uint8 idx = *src++;
- dst[x].setBGRA(palette[3*idx+0], palette[3*idx+1], palette[3*idx+2], 0xFF);
- }
- dst += lstep;
- }
- }
- else if( grey ) {
- img->setFormat(Image::Format_ARGB);
-
- for( int y = 0; y < tga.height; y++ ) {
- for( int x = 0; x < tga.width; x++ ) {
- dst[x].setBGRA(*src, *src, *src, *src);
- src++;
- }
- dst += lstep;
- }
- }
- else {
-
- if( tga.pixel_size == 16 ) {
- for( int y = 0; y < tga.height; y++ ) {
- for( int x = 0; x < tga.width; x++ ) {
- Color555 c = *reinterpret_cast<Color555 *>(src);
- uint8 b = (c.b << 3) | (c.b >> 2);
- uint8 g = (c.g << 3) | (c.g >> 2);
- uint8 r = (c.r << 3) | (c.r >> 2);
- dst[x].setBGRA(b, g, r, 0xFF);
- src += 2;
- }
- dst += lstep;
- }
- }
- else if( tga.pixel_size == 24 ) {
- for( int y = 0; y < tga.height; y++ ) {
- for( int x = 0; x < tga.width; x++ ) {
- dst[x].setBGRA(src[0], src[1], src[2], 0xFF);
- src += 3;
- }
- dst += lstep;
- }
- }
- else if( tga.pixel_size == 32 ) {
- img->setFormat(Image::Format_ARGB);
-
- for( int y = 0; y < tga.height; y++ ) {
- for( int x = 0; x < tga.width; x++ ) {
- dst[x].setBGRA(src[0], src[1], src[2], src[3]);
- src += 4;
- }
- dst += lstep;
- }
- }
- }
-
- // free uncompressed data.
- delete [] mem;
-
- return img.release();
-}
-
-/// Save TGA image.
-bool nv::ImageIO::saveTGA(Stream & s, const Image * img)
-{
- nvCheck(!s.isError());
- nvCheck(img != NULL);
- nvCheck(img->pixels() != NULL);
-
- TgaFile tga;
- tga.head.id_length = 0;
- tga.head.colormap_type = 0;
- tga.head.image_type = TGA_TYPE_RGB;
-
- tga.head.colormap_index = 0;
- tga.head.colormap_length = 0;
- tga.head.colormap_size = 0;
-
- tga.head.x_origin = 0;
- tga.head.y_origin = 0;
- tga.head.width = img->width();
- tga.head.height = img->height();
- if(img->format() == Image::Format_ARGB) {
- tga.head.pixel_size = 32;
- tga.head.flags = TGA_ORIGIN_UPPER | TGA_HAS_ALPHA;
- }
- else {
- tga.head.pixel_size = 24;
- tga.head.flags = TGA_ORIGIN_UPPER;
- }
-
- // @@ Serialize directly.
- tga.allocate();
-
- const uint n = img->width() * img->height();
- if(img->format() == Image::Format_ARGB) {
- for(uint i = 0; i < n; i++) {
- Color32 color = img->pixel(i);
- tga.mem[4 * i + 0] = color.b;
- tga.mem[4 * i + 1] = color.g;
- tga.mem[4 * i + 2] = color.r;
- tga.mem[4 * i + 3] = color.a;
- }
- }
- else {
- for(uint i = 0; i < n; i++) {
- Color32 color = img->pixel(i);
- tga.mem[3 * i + 0] = color.b;
- tga.mem[3 * i + 1] = color.g;
- tga.mem[3 * i + 2] = color.r;
- }
- }
-
- s << tga;
-
- tga.free();
-
- return true;
-}
-
-/// Load PSD image.
-Image * nv::ImageIO::loadPSD(Stream & s)
-{
- nvCheck(!s.isError());
- nvCheck(s.isLoading());
-
- s.setByteOrder(Stream::BigEndian);
-
- PsdHeader header;
- s << header;
-
- if (!header.isValid())
- {
- printf("invalid header!\n");
- return NULL;
- }
-
- if (!header.isSupported())
- {
- printf("unsupported file!\n");
- return NULL;
- }
-
- int tmp;
-
- // Skip mode data.
- s << tmp;
- s.seek(s.tell() + tmp);
-
- // Skip image resources.
- s << tmp;
- s.seek(s.tell() + tmp);
-
- // Skip the reserved data.
- s << tmp;
- s.seek(s.tell() + tmp);
-
- // Find out if the data is compressed.
- // Known values:
- // 0: no compression
- // 1: RLE compressed
- uint16 compression;
- s << compression;
-
- if (compression > 1) {
- // Unknown compression type.
- return NULL;
- }
-
- uint channel_num = header.channel_count;
-
- AutoPtr<Image> img(new Image());
- img->allocate(header.width, header.height);
-
- if (channel_num < 4)
- {
- // Clear the image.
- img->fill(Color32(0, 0, 0, 0xFF));
- }
- else
- {
- // Enable alpha.
- img->setFormat(Image::Format_ARGB);
-
- // Ignore remaining channels.
- channel_num = 4;
- }
-
-
- const uint pixel_count = header.height * header.width;
-
- static const uint components[4] = {2, 1, 0, 3};
-
- if (compression)
- {
- s.seek(s.tell() + header.height * header.channel_count * sizeof(uint16));
-
- // Read RLE data.
- for (uint channel = 0; channel < channel_num; channel++)
- {
- uint8 * ptr = (uint8 *)img->pixels() + components[channel];
-
- uint count = 0;
- while( count < pixel_count )
- {
- if (s.isAtEnd()) return NULL;
-
- uint8 c;
- s << c;
-
- uint len = c;
- if (len < 128)
- {
- // Copy next len+1 bytes literally.
- len++;
- count += len;
- if (count > pixel_count) return NULL;
-
- while (len != 0)
- {
- s << *ptr;
- ptr += 4;
- len--;
- }
- }
- else if (len > 128)
- {
- // Next -len+1 bytes in the dest are replicated from next source byte.
- // (Interpret len as a negative 8-bit int.)
- len ^= 0xFF;
- len += 2;
- count += len;
- if (s.isAtEnd() || count > pixel_count) return NULL;
-
- uint8 val;
- s << val;
- while( len != 0 ) {
- *ptr = val;
- ptr += 4;
- len--;
- }
- }
- else if( len == 128 ) {
- // No-op.
- }
- }
- }
- }
- else
- {
- // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...)
- // where each channel consists of an 8-bit value for each pixel in the image.
-
- // Read the data by channel.
- for (uint channel = 0; channel < channel_num; channel++)
- {
- uint8 * ptr = (uint8 *)img->pixels() + components[channel];
-
- // Read the data.
- uint count = pixel_count;
- while (count != 0)
- {
- s << *ptr;
- ptr += 4;
- count--;
- }
- }
- }
-
- return img.release();
-}
-
-
-#if defined(HAVE_FREEIMAGE)
-
-unsigned DLL_CALLCONV ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle)
-{
- Stream * s = (Stream *) handle;
- s->serialize(buffer, size * count);
- return count;
-}
-
-int DLL_CALLCONV SeekProc(fi_handle handle, long offset, int origin)
-{
- Stream * s = (Stream *) handle;
-
- switch(origin) {
- case SEEK_SET :
- s->seek(offset);
- break;
- case SEEK_CUR :
- s->seek(s->tell() + offset);
- break;
- default :
- return 1;
- }
-
- return 0;
-}
-
-long DLL_CALLCONV TellProc(fi_handle handle)
-{
- Stream * s = (Stream *) handle;
- return s->tell();
-}
-
-
-Image * loadFreeImage(FREE_IMAGE_FORMAT fif, Stream & s)
-{
- nvCheck(!s.isError());
-
- FreeImageIO io;
- io.read_proc = ReadProc;
- io.write_proc = NULL;
- io.seek_proc = SeekProc;
- io.tell_proc = TellProc;
-
- FIBITMAP * bitmap = FreeImage_LoadFromHandle(fif, &io, (fi_handle)&s, 0);
-
- if (bitmap == NULL)
- {
- return NULL;
- }
-
- const int w = FreeImage_GetWidth(bitmap);
- const int h = FreeImage_GetHeight(bitmap);
-
- if (FreeImage_GetImageType(bitmap) == FIT_BITMAP)
- {
- if (FreeImage_GetBPP(bitmap) != 32)
- {
- FIBITMAP * tmp = FreeImage_ConvertTo32Bits(bitmap);
- FreeImage_Unload(bitmap);
- bitmap = tmp;
- }
- }
- else
- {
- // @@ Use tone mapping?
- FIBITMAP * tmp = FreeImage_ConvertToType(bitmap, FIT_BITMAP, true);
- FreeImage_Unload(bitmap);
- bitmap = tmp;
- }
-
-
- Image * image = new Image();
- image->allocate(w, h);
-
- // Copy the image over to our internal format, FreeImage has the scanlines bottom to top though.
- for (int y=0; y < h; y++)
- {
- const void * src = FreeImage_GetScanLine(bitmap, h - y - 1);
- void * dst = image->scanline(y);
-
- memcpy(dst, src, 4 * w);
- }
-
- FreeImage_Unload(bitmap);
-
- return image;
-}
-
-FloatImage * loadFloatFreeImage(FREE_IMAGE_FORMAT fif, Stream & s)
-{
- nvCheck(!s.isError());
-
- FreeImageIO io;
- io.read_proc = ReadProc;
- io.write_proc = NULL;
- io.seek_proc = SeekProc;
- io.tell_proc = TellProc;
-
- FIBITMAP * bitmap = FreeImage_LoadFromHandle(fif, &io, (fi_handle)&s, 0);
-
- if (bitmap == NULL)
- {
- return NULL;
- }
-
- const int w = FreeImage_GetWidth(bitmap);
- const int h = FreeImage_GetHeight(bitmap);
-
- FREE_IMAGE_TYPE fit = FreeImage_GetImageType(bitmap);
-
- FloatImage * floatImage = new FloatImage();
-
- switch (fit)
- {
- case FIT_FLOAT:
- floatImage->allocate(1, w, h);
-
- for (int y=0; y < h; y++)
- {
- const float * src = (const float *)FreeImage_GetScanLine(bitmap, h - y - 1 );
- float * dst = floatImage->scanline(y, 0);
-
- for (int x=0; x < w; x++)
- {
- dst[x] = src[x];
- }
- }
- break;
- case FIT_COMPLEX:
- floatImage->allocate(2, w, h);
-
- for (int y=0; y < h; y++)
- {
- const FICOMPLEX * src = (const FICOMPLEX *)FreeImage_GetScanLine(bitmap, h - y - 1 );
-
- float * dst_real = floatImage->scanline(y, 0);
- float * dst_imag = floatImage->scanline(y, 1);
-
- for (int x=0; x < w; x++)
- {
- dst_real[x] = (float)src[x].r;
- dst_imag[x] = (float)src[x].i;
- }
- }
- break;
- case FIT_RGBF:
- floatImage->allocate(3, w, h);
-
- for (int y=0; y < h; y++)
- {
- const FIRGBF * src = (const FIRGBF *)FreeImage_GetScanLine(bitmap, h - y - 1 );
-
- float * dst_red = floatImage->scanline(y, 0);
- float * dst_green = floatImage->scanline(y, 1);
- float * dst_blue = floatImage->scanline(y, 2);
-
- for (int x=0; x < w; x++)
- {
- dst_red[x] = src[x].red;
- dst_green[x] = src[x].green;
- dst_blue[x] = src[x].blue;
- }
- }
- break;
- case FIT_RGBAF:
- floatImage->allocate(4, w, h);
-
- for (int y=0; y < h; y++)
- {
- const FIRGBAF * src = (const FIRGBAF *)FreeImage_GetScanLine(bitmap, h - y - 1 );
-
- float * dst_red = floatImage->scanline(y, 0);
- float * dst_green = floatImage->scanline(y, 1);
- float * dst_blue = floatImage->scanline(y, 2);
- float * dst_alpha = floatImage->scanline(y, 3);
-
- for (int x=0; x < w; x++)
- {
- dst_red[x] = src[x].red;
- dst_green[x] = src[x].green;
- dst_blue[x] = src[x].blue;
- dst_alpha[x] = src[x].alpha;
- }
- }
- break;
- default:
- delete floatImage;
- floatImage = NULL;
- }
-
- FreeImage_Unload(bitmap);
-
- return floatImage;
-}
-
-#endif // defined(HAVE_FREEIMAGE)
-
-
-#if defined(HAVE_PNG)
-
-static void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
-{
- nvDebugCheck(png_ptr != NULL);
-
- Stream * s = (Stream *)png_get_io_ptr(png_ptr);
- s->serialize(data, (int)length);
-
- if (s->isError()) {
- png_error(png_ptr, "Read Error");
- }
-}
-
-
-Image * nv::ImageIO::loadPNG(Stream & s)
-{
- nvCheck(!s.isError());
-
- // Set up a read buffer and check the library version
- png_structp png_ptr;
- png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- if (png_ptr == NULL) {
- // nvDebug( "*** LoadPNG: Error allocating read buffer in file '%s'.\n", name );
- return false;
- }
-
- // Allocate/initialize a memory block for the image information
- png_infop info_ptr = png_create_info_struct(png_ptr);
- if (info_ptr == NULL) {
- png_destroy_read_struct(&png_ptr, NULL, NULL);
- // nvDebug( "*** LoadPNG: Error allocating image information for '%s'.\n", name );
- return false;
- }
-
- // Set up the error handling
- if (setjmp(png_jmpbuf(png_ptr))) {
- png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
- // nvDebug( "*** LoadPNG: Error reading png file '%s'.\n", name );
- return false;
- }
-
- // Set up the I/O functions.
- png_set_read_fn(png_ptr, (void*)&s, user_read_data);
-
-
- // Retrieve the image header information
- png_uint_32 width, height;
- int bit_depth, color_type, interlace_type;
- png_read_info(png_ptr, info_ptr);
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL);
-
-
- if (color_type == PNG_COLOR_TYPE_PALETTE && bit_depth <= 8) {
- // Convert indexed images to RGB.
- png_set_expand(png_ptr);
- }
- else if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
- // Convert grayscale to RGB.
- png_set_expand(png_ptr);
- }
- else if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
- // Expand images with transparency to full alpha channels
- // so the data will be available as RGBA quartets.
- png_set_expand(png_ptr);
- }
- else if (bit_depth < 8) {
- // If we have < 8 scale it up to 8.
- //png_set_expand(png_ptr);
- png_set_packing(png_ptr);
- }
-
- // Reduce bit depth.
- if (bit_depth == 16) {
- png_set_strip_16(png_ptr);
- }
-
- // Represent gray as RGB
- if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
- png_set_gray_to_rgb(png_ptr);
- }
-
- // Convert to RGBA filling alpha with 0xFF.
- if (!(color_type & PNG_COLOR_MASK_ALPHA)) {
- png_set_filler(png_ptr, 0xFF, PNG_FILLER_AFTER);
- }
-
- // @todo Choose gamma according to the platform?
- double screen_gamma = 2.2;
- int intent;
- if (png_get_sRGB(png_ptr, info_ptr, &intent)) {
- png_set_gamma(png_ptr, screen_gamma, 0.45455);
- }
- else {
- double image_gamma;
- if (png_get_gAMA(png_ptr, info_ptr, &image_gamma)) {
- png_set_gamma(png_ptr, screen_gamma, image_gamma);
- }
- else {
- png_set_gamma(png_ptr, screen_gamma, 0.45455);
- }
- }
-
- // Perform the selected transforms.
- png_read_update_info(png_ptr, info_ptr);
-
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL);
-
- AutoPtr<Image> img(new Image());
- img->allocate(width, height);
-
- // Set internal format flags.
- if(color_type & PNG_COLOR_MASK_COLOR) {
- //img->flags |= PI_IF_HAS_COLOR;
- }
- if(color_type & PNG_COLOR_MASK_ALPHA) {
- //img->flags |= PI_IF_HAS_ALPHA;
- img->setFormat(Image::Format_ARGB);
- }
-
- // Read the image
- uint8 * pixels = (uint8 *)img->pixels();
- png_bytep * row_data = new png_bytep[sizeof(png_byte) * height];
- for (uint i = 0; i < height; i++) {
- row_data[i] = &(pixels[width * 4 * i]);
- }
-
- png_read_image(png_ptr, row_data);
- delete [] row_data;
-
- // Finish things up
- png_read_end(png_ptr, info_ptr);
- png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-
- // RGBA to BGRA.
- uint num = width * height;
- for(uint i = 0; i < num; i++)
- {
- Color32 c = img->pixel(i);
- img->pixel(i) = Color32(c.b, c.g, c.r, c.a);
- }
-
- // Compute alpha channel if needed.
- /*if( img->flags & PI_IU_BUMPMAP || img->flags & PI_IU_ALPHAMAP ) {
- if( img->flags & PI_IF_HAS_COLOR && !(img->flags & PI_IF_HAS_ALPHA)) {
- img->ComputeAlphaFromColor();
- }
- }*/
-
- return img.release();
-}
-
-#endif // defined(HAVE_PNG)
-
-#if defined(HAVE_JPEG)
-
-static void init_source (j_decompress_ptr /*cinfo*/){
-}
-
-static boolean fill_input_buffer (j_decompress_ptr cinfo){
- struct jpeg_source_mgr * src = cinfo->src;
- static JOCTET FakeEOI[] = { 0xFF, JPEG_EOI };
-
- // Generate warning
- nvDebug("jpeglib: Premature end of file\n");
-
- // Insert a fake EOI marker
- src->next_input_byte = FakeEOI;
- src->bytes_in_buffer = 2;
-
- return TRUE;
-}
-
-static void skip_input_data (j_decompress_ptr cinfo, long num_bytes) {
- struct jpeg_source_mgr * src = cinfo->src;
-
- if(num_bytes >= (long)src->bytes_in_buffer) {
- fill_input_buffer(cinfo);
- return;
- }
-
- src->bytes_in_buffer -= num_bytes;
- src->next_input_byte += num_bytes;
-}
-
-static void term_source (j_decompress_ptr /*cinfo*/){
- // no work necessary here
-}
-
-
-Image * nv::ImageIO::loadJPG(Stream & s)
-{
- nvCheck(!s.isError());
-
- // Read the entire file.
- Array<uint8> byte_array;
- byte_array.resize(s.size());
- s.serialize(byte_array.mutableBuffer(), s.size());
-
- jpeg_decompress_struct cinfo;
- jpeg_error_mgr jerr;
-
- cinfo.err = jpeg_std_error(&jerr);
- jpeg_create_decompress(&cinfo);
-
- cinfo.src = (struct jpeg_source_mgr *) (*cinfo.mem->alloc_small)
- ((j_common_ptr) &cinfo, JPOOL_PERMANENT, sizeof(struct jpeg_source_mgr));
- cinfo.src->init_source = init_source;
- cinfo.src->fill_input_buffer = fill_input_buffer;
- cinfo.src->skip_input_data = skip_input_data;
- cinfo.src->resync_to_restart = jpeg_resync_to_restart; // use default method
- cinfo.src->term_source = term_source;
- cinfo.src->bytes_in_buffer = byte_array.size();
- cinfo.src->next_input_byte = byte_array.buffer();
-
- jpeg_read_header(&cinfo, TRUE);
- jpeg_start_decompress(&cinfo);
-
- /*
- cinfo.do_fancy_upsampling = FALSE; // fast decompression
- cinfo.dct_method = JDCT_FLOAT; // Choose floating point DCT method.
- */
-
- uint8 * tmp_buffer = new uint8 [cinfo.output_width * cinfo.output_height * cinfo.num_components];
- uint8 * scanline = tmp_buffer;
-
- while( cinfo.output_scanline < cinfo.output_height ){
- int num_scanlines = jpeg_read_scanlines (&cinfo, &scanline, 1);
- scanline += num_scanlines * cinfo.output_width * cinfo.num_components;
- }
-
- jpeg_finish_decompress(&cinfo);
-
- AutoPtr<Image> img(new Image());
- img->allocate(cinfo.output_width, cinfo.output_height);
-
- Color32 * dst = img->pixels();
- const int size = img->height() * img->width();
- const uint8 * src = tmp_buffer;
-
- if( cinfo.num_components == 3 ) {
- img->setFormat(Image::Format_RGB);
- for( int i = 0; i < size; i++ ) {
- *dst++ = Color32(src[0], src[1], src[2]);
- src += 3;
- }
- }
- else {
- img->setFormat(Image::Format_ARGB);
- for( int i = 0; i < size; i++ ) {
- *dst++ = Color32(*src, *src, *src, *src);
- src++;
- }
- }
-
- delete [] tmp_buffer;
- jpeg_destroy_decompress (&cinfo);
-
- return img.release();
-}
-
-#endif // defined(HAVE_JPEG)
-
-#if defined(HAVE_TIFF)
-
-/*
-static tsize_t tiffReadWriteProc(thandle_t h, tdata_t ptr, tsize_t size)
-{
- Stream * s = (Stream *)h;
- nvDebugCheck(s != NULL);
-
- s->serialize(ptr, size);
-
- return size;
-}
-
-static toff_t tiffSeekProc(thandle_t h, toff_t offset, int whence)
-{
- Stream * s = (Stream *)h;
- nvDebugCheck(s != NULL);
-
- if (!s->isSeekable())
- {
- return (toff_t)-1;
- }
-
- if (whence == SEEK_SET)
- {
- s->seek(offset);
- }
- else if (whence == SEEK_CUR)
- {
- s->seek(s->tell() + offset);
- }
- else if (whence == SEEK_END)
- {
- s->seek(s->size() + offset);
- }
-
- return s->tell();
-}
-
-static int tiffCloseProc(thandle_t)
-{
- return 0;
-}
-
-static toff_t tiffSizeProc(thandle_t h)
-{
- Stream * s = (Stream *)h;
- nvDebugCheck(s != NULL);
- return s->size();
-}
-
-static int tiffMapFileProc(thandle_t, tdata_t*, toff_t*)
-{
- // @@ TODO, Implement these functions.
- return -1;
-}
-
-static void tiffUnmapFileProc(thandle_t, tdata_t, toff_t)
-{
- // @@ TODO, Implement these functions.
-}
-*/
-
-FloatImage * nv::ImageIO::loadFloatTIFF(const char * fileName, Stream & s)
-{
- nvCheck(!s.isError());
-
- TIFF * tif = TIFFOpen(fileName, "r");
- //TIFF * tif = TIFFClientOpen(fileName, "r", &s, tiffReadWriteProc, tiffReadWriteProc, tiffSeekProc, tiffCloseProc, tiffSizeProc, tiffMapFileProc, tiffUnmapFileProc);
-
- if (!tif)
- {
- nvDebug("Can't open '%s' for reading\n", fileName);
- return NULL;
- }
-
- ::uint16 spp, bpp, format;
- ::uint32 width, height;
- TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height);
- TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width);
- TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bpp);
- TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &spp);
- TIFFGetField(tif, TIFFTAG_SAMPLEFORMAT, &format);
-
- if (bpp != 8 && bpp != 16 && bpp != 32) {
- nvDebug("Can't load '%s', only 1 sample per pixel supported\n", fileName);
- TIFFClose(tif);
- return NULL;
- }
-
- AutoPtr<FloatImage> fimage(new FloatImage());
- fimage->allocate(spp, width, height);
-
- int linesize = TIFFScanlineSize(tif);
- tdata_t buf = (::uint8 *)malloc(linesize);
-
- for (uint y = 0; y < height; y++)
- {
- TIFFReadScanline(tif, buf, y, 0);
-
- for (uint c=0; c<spp; c++ )
- {
- float * dst = fimage->scanline(y, c);
-
- for(uint x = 0; x < width; x++)
- {
- if (bpp == 8)
- {
- dst[x] = float(((::uint8 *)buf)[x*spp+c]) / float(0xFF);
- }
- else if (bpp == 16)
- {
- dst[x] = float(((::uint16 *)buf)[x*spp+c]) / float(0xFFFF);
- }
- else if (bpp == 32)
- {
- if (format==SAMPLEFORMAT_IEEEFP)
- {
- dst[x] = float(((float *)buf)[x*spp+c]);
- }
- else
- {
- dst[x] = float(((::uint32 *)buf)[x*spp+c] >> 8) / float(0xFFFFFF);
- }
-
- }
-
- }
- }
- }
-
- free(buf);
-
- TIFFClose(tif);
-
- return fimage.release();
-}
-
-bool nv::ImageIO::saveFloatTIFF(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components)
-{
- nvCheck(fileName != NULL);
- nvCheck(fimage != NULL);
- nvCheck(base_component + num_components <= fimage->componentNum());
-
- const int iW = fimage->width();
- const int iH = fimage->height();
- const int iC = num_components;
-
- TIFF * image = TIFFOpen(fileName, "w");
-
- // Open the TIFF file
- if (image == NULL)
- {
- nvDebug("Could not open '%s' for writing\n", fileName);
- return false;
- }
-
- TIFFSetField(image, TIFFTAG_IMAGEWIDTH, iW);
- TIFFSetField(image, TIFFTAG_IMAGELENGTH, iH);
- TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, iC);
- TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
- TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, 32);
-
- uint32 rowsperstrip = TIFFDefaultStripSize(image, (uint32)-1);
-
- TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
- TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS);
- if (num_components == 3)
- {
- // Set this so that it can be visualized with pfstools.
- TIFFSetField(image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
- }
- TIFFSetField(image, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
- TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
-
- float * scanline = new float[iW * iC];
- for (int y = 0; y < iH; y++)
- {
- for (int c = 0; c < iC; c++)
- {
- const float * src = fimage->scanline(y, base_component + c);
- for (int x = 0; x < iW; x++) scanline[x * iC + c] = src[x];
- }
- if (TIFFWriteScanline(image, scanline, y, 0)==-1)
- {
- nvDebug("Error writing scanline %d\n", y);
- return false;
- }
- }
- delete [] scanline;
-
- // Close the file
- TIFFClose(image);
- return true;
-}
-
-#endif
-
-#if defined(HAVE_OPENEXR)
-
-namespace
-{
- class ExrStream : public Imf::IStream
- {
- public:
- ExrStream(const char * name, Stream & s) : Imf::IStream(name), m_stream(s)
- {
- nvDebugCheck(s.isLoading());
- }
-
- virtual bool read(char c[], int n)
- {
- m_stream.serialize(c, n);
-
- if (m_stream.isError())
- {
- throw Iex::InputExc("I/O error.");
- }
-
- return m_stream.isAtEnd();
- }
-
- virtual Imf::Int64 tellg()
- {
- return m_stream.tell();
- }
-
- virtual void seekg(Imf::Int64 pos)
- {
- nvDebugCheck(pos >= 0 && pos < UINT_MAX);
- m_stream.seek((uint)pos);
- }
-
- virtual void clear()
- {
- m_stream.clearError();
- }
-
- private:
- Stream & m_stream;
- };
-
- static int channelIndexFromName(const char* name)
- {
- char c = tolower(name[0]);
- switch (c)
- {
- default:
- case 'r':
- return 0;
- case 'g':
- return 1;
- case 'b':
- return 2;
- case 'a':
- return 3;
- }
- }
-
-} // namespace
-
-FloatImage * nv::ImageIO::loadFloatEXR(const char * fileName, Stream & s)
-{
- nvCheck(s.isLoading());
- nvCheck(!s.isError());
-
- ExrStream stream(fileName, s);
- Imf::InputFile inputFile(stream);
-
- Imath::Box2i box = inputFile.header().dataWindow();
-
- int width = box.max.x - box.min.y + 1;
- int height = box.max.x - box.min.y + 1;
-
- const Imf::ChannelList & channels = inputFile.header().channels();
-
- // Count channels.
- uint channelCount= 0;
- for (Imf::ChannelList::ConstIterator it = channels.begin(); it != channels.end(); ++it)
- {
- channelCount++;
- }
-
- // Allocate FloatImage.
- AutoPtr<FloatImage> fimage(new FloatImage());
- fimage->allocate(channelCount, width, height);
-
- // Describe image's layout with a framebuffer.
- Imf::FrameBuffer frameBuffer;
- uint i = 0;
- for (Imf::ChannelList::ConstIterator it = channels.begin(); it != channels.end(); ++it, ++i)
- {
- int channelIndex = channelIndexFromName(it.name());
- frameBuffer.insert(it.name(), Imf::Slice(Imf::FLOAT, (char *)fimage->channel(channelIndex), sizeof(float), sizeof(float) * width));
- }
-
- // Read it.
- inputFile.setFrameBuffer (frameBuffer);
- inputFile.readPixels (box.min.y, box.max.y);
-
- return fimage.release();
-}
-
-bool nv::ImageIO::saveFloatEXR(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components)
-{
- nvCheck(fileName != NULL);
- nvCheck(fimage != NULL);
- nvCheck(base_component + num_components <= fimage->componentNum());
- nvCheck(num_components > 0 && num_components <= 4);
-
- const int w = fimage->width();
- const int h = fimage->height();
-
- const char * channelNames[] = {"R", "G", "B", "A"};
-
- Imf::Header header (w, h);
-
- for (uint c = 0; c < num_components; c++)
- {
- header.channels().insert(channelNames[c], Imf::Channel(Imf::FLOAT));
- }
-
- Imf::OutputFile file(fileName, header);
- Imf::FrameBuffer frameBuffer;
-
- for (uint c = 0; c < num_components; c++)
- {
- char * channel = (char *) fimage->channel(base_component + c);
- frameBuffer.insert(channelNames[c], Imf::Slice(Imf::FLOAT, channel, sizeof(float), sizeof(float) * w));
- }
-
- file.setFrameBuffer(frameBuffer);
- file.writePixels(h);
-
- return true;
-}
-
-#endif // defined(HAVE_OPENEXR)
-
-#if 0 // @@ Disable temporarily.
-
-FloatImage * nv::ImageIO::loadFloatPFM(const char * fileName, Stream & s)
-{
- nvCheck(s.isLoading());
- nvCheck(!s.isError());
-
- Tokenizer parser(&s);
-
- parser.nextToken();
-
- bool grayscale;
- if (parser.token() == "PF")
- {
- grayscale = false;
- }
- else if (parser.token() == "Pf")
- {
- grayscale = true;
- }
- else
- {
- // Invalid file.
- return NULL;
- }
-
- parser.nextLine();
-
- int width = parser.token().toInt(); parser.nextToken();
- int height = parser.token().toInt();
-
- parser.nextLine();
-
- float scaleFactor = parser.token().toFloat();
-
- if (scaleFactor >= 0)
- {
- s.setByteOrder(Stream::BigEndian);
- }
- else
- {
- s.setByteOrder(Stream::LittleEndian);
- }
- scaleFactor = fabsf(scaleFactor);
-
- // Allocate image.
- AutoPtr<FloatImage> fimage(new FloatImage());
-
- if (grayscale)
- {
- fimage->allocate(1, width, height);
-
- float * channel = fimage->channel(0);
-
- for (int i = 0; i < width * height; i++)
- {
- s << channel[i];
- }
- }
- else
- {
- fimage->allocate(3, width, height);
-
- float * rchannel = fimage->channel(0);
- float * gchannel = fimage->channel(1);
- float * bchannel = fimage->channel(2);
-
- for (int i = 0; i < width * height; i++)
- {
- s << rchannel[i] << gchannel[i] << bchannel[i];
- }
- }
-
- return fimage.release();
-}
-
-bool nv::ImageIO::saveFloatPFM(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components)
-{
- nvCheck(fileName != NULL);
- nvCheck(fimage != NULL);
- nvCheck(fimage->componentNum() <= base_component + num_components);
- nvCheck(num_components == 1 || num_components == 3);
-
- StdOutputStream stream(fileName);
- TextWriter writer(&stream);
-
- if (num_components == 1) writer.write("Pf\n");
- else /*if (num_components == 3)*/ writer.write("PF\n");
-
- int w = fimage->width();
- int h = fimage->height();
- writer.write("%d %d\n", w, h);
- writer.write("%f\n", -1.0f); // little endian with 1.0 scale.
-
- if (num_components == 1)
- {
- float * channel = const_cast<float *>(fimage->channel(0));
-
- for (int i = 0; i < w * h; i++)
- {
- stream << channel[i];
- }
- }
- else
- {
- float * rchannel = const_cast<float *>(fimage->channel(0));
- float * gchannel = const_cast<float *>(fimage->channel(1));
- float * bchannel = const_cast<float *>(fimage->channel(2));
-
- for (int i = 0; i < w * h; i++)
- {
- stream << rchannel[i] << gchannel[i] << bchannel[i];
- }
- }
-
- return true;
-}
-
-//#pragma warning(disable : 4996)
-
-NVIMAGE_API FloatImage * nv::ImageIO::loadGridFloat(const char * fileName, Stream & s)
-{
- nvCheck(s.isLoading());
- nvCheck(!s.isError());
-
- Tokenizer parser(&s);
-
- parser.nextLine();
-
- if (parser.token() != "ncols")
- {
- nvDebug("Failed to find 'ncols' token in file '%s'.\n", fileName);
- return NULL;
- }
-
- parser.nextToken(true);
- const int nCols = parser.token().toInt();
-
- parser.nextToken(true);
- if (parser.token() != "nrows")
- {
- nvDebug("Failed to find 'nrows' token in file '%s'.\n", fileName);
- return NULL;
- }
-
- parser.nextToken(true);
- const int nRows = parser.token().toInt();
-
- /* There's a byte order defined in the header. We could read it. However, here we
- just assume that it matches the platform's byte order.
- // There is then a bunch of data that we don't care about (lat, long definitions, etc).
- for (int i=0; i!=9; ++i)
- parser.nextToken(true);
-
- if (parser.token() != "byteorder")
- return NULL;
-
- parser.nextToken(true);
-
- const Stream::ByteOrder byteOrder = (parser.token() == "LSBFIRST")? Stream::LittleEndian: Stream::BigEndian;
- */
-
- // GridFloat comes in two files: an ASCII header which was parsed above (.hdr) and a big blob
- // of binary data in a .flt file.
- Path dataPath(fileName);
- dataPath.stripExtension();
- dataPath.append(".flt");
-
- // Open the binary data.
- FILE* file = fopen(dataPath.fileName(), "rb");
- if (!file)
- {
- nvDebug("Failed to find GridFloat blob file '%s' corresponding to '%s'.\n", dataPath.fileName(), fileName);
- return NULL;
- }
-
- // Allocate image.
- AutoPtr<FloatImage> fimage(new FloatImage());
- fimage->allocate(1, nCols, nRows);
-
- float * channel = fimage->channel(0);
-
- // The binary blob is defined to be in row-major order, containing IEEE floats.
- // So we can just slurp it in. Theoretically, we ought to use the byte order.
- const size_t nRead = fread((void*) channel, sizeof(float), nRows * nCols, file);
- fclose(file);
-
- return fimage.release();
-}
-#endif
-
-#if 0
-
-/** Save PNG*/
-static bool SavePNG(const PiImage * img, const char * name) {
- nvCheck( img != NULL );
- nvCheck( img->mem != NULL );
-
- if( piStrCmp(piExtension(name), ".png" ) != 0 ) {
- return false;
- }
-
- if( img->flags & PI_IT_CUBEMAP ) {
- nvDebug("*** Cannot save cubemaps as PNG.");
- return false;
- }
- if( img->flags & PI_IT_DDS ) {
- nvDebug("*** Cannot save DDS surface as PNG.");
- return false;
- }
-
- nvDebug( "--- Saving '%s'.\n", name );
-
- PiAutoPtr<PiStream> ar( PiFileSystem::CreateFileWriter( name ) );
- if( ar == NULL ) {
- nvDebug( "*** SavePNG: Error, cannot save file '%s'.\n", name );
- return false;
- }
-
-/*
-public class PNGEnc {
-
- public static function encode(img:BitmapData):ByteArray {
- // Create output byte array
- var png:ByteArray = new ByteArray();
- // Write PNG signature
- png.writeUnsignedInt(0x89504e47);
- png.writeUnsignedInt(0x0D0A1A0A);
- // Build IHDR chunk
- var IHDR:ByteArray = new ByteArray();
- IHDR.writeInt(img.width);
- IHDR.writeInt(img.height);
- IHDR.writeUnsignedInt(0x08060000); // 32bit RGBA
- IHDR.writeByte(0);
- writeChunk(png,0x49484452,IHDR);
- // Build IDAT chunk
- var IDAT:ByteArray= new ByteArray();
- for(var i:int=0;i < img.height;i++) {
- // no filter
- IDAT.writeByte(0);
- var p:uint;
- if ( !img.transparent ) {
- for(var j:int=0;j < img.width;j++) {
- p = img.getPixel(j,i);
- IDAT.writeUnsignedInt(
- uint(((p&0xFFFFFF) << 8)|0xFF));
- }
- } else {
- for(var j:int=0;j < img.width;j++) {
- p = img.getPixel32(j,i);
- IDAT.writeUnsignedInt(
- uint(((p&0xFFFFFF) << 8)|
- (shr(p,24))));
- }
- }
- }
- IDAT.compress();
- writeChunk(png,0x49444154,IDAT);
- // Build IEND chunk
- writeChunk(png,0x49454E44,null);
- // return PNG
- return png;
- }
-
- private static var crcTable:Array;
- private static var crcTableComputed:Boolean = false;
-
- private static function writeChunk(png:ByteArray,
- type:uint, data:ByteArray) {
- if (!crcTableComputed) {
- crcTableComputed = true;
- crcTable = [];
- for (var n:uint = 0; n < 256; n++) {
- var c:uint = n;
- for (var k:uint = 0; k < 8; k++) {
- if (c & 1) {
- c = uint(uint(0xedb88320) ^
- uint(c >>> 1));
- } else {
- c = uint(c >>> 1);
- }
- }
- crcTable[n] = c;
- }
- }
- var len:uint = 0;
- if (data != null) {
- len = data.length;
- }
- png.writeUnsignedInt(len);
- var p:uint = png.position;
- png.writeUnsignedInt(type);
- if ( data != null ) {
- png.writeBytes(data);
- }
- var e:uint = png.position;
- png.position = p;
- var c:uint = 0xffffffff;
- for (var i:int = 0; i < (e-p); i++) {
- c = uint(crcTable[
- (c ^ png.readUnsignedByte()) &
- uint(0xff)] ^ uint(c >>> 8));
- }
- c = uint(c^uint(0xffffffff));
- png.position = e;
- png.writeUnsignedInt(c);
- }
-}
-*/
-}
-
-#endif // 0
-
-#if 0
-
-
-namespace ImageIO {
-
- /** Init ImageIO plugins. */
- void InitPlugins() {
- // AddInputPlugin( "", LoadANY );
- AddInputPlugin( "tga", LoadTGA );
-#if HAVE_PNG
- AddInputPlugin( "png", LoadPNG );
-#endif
-#if HAVE_JPEG
- AddInputPlugin( "jpg", LoadJPG );
-#endif
- AddInputPlugin( "dds", LoadDDS );
-
- AddOutputPlugin( "tga", SaveTGA );
- }
-
- /** Reset ImageIO plugins. */
- void ResetPlugins() {
- s_plugin_load_map.Clear();
- s_plugin_save_map.Clear();
- }
-
- /** Add an input plugin. */
- void AddInputPlugin( const char * ext, ImageInput_Plugin plugin ) {
- s_plugin_load_map.Add(ext, plugin);
- }
-
- /** Add an output plugin. */
- void AddOutputPlugin( const char * ext, ImageOutput_Plugin plugin ) {
- s_plugin_save_map.Add(ext, plugin);
- }
-
-
- bool Load(PiImage * img, const char * name, PiStream & stream) {
-
- // Get name extension.
- const char * extension = piExtension(name);
-
- // Skip the dot.
- if( *extension == '.' ) {
- extension++;
- }
-
- // Lookup plugin in the map.
- ImageInput_Plugin plugin = NULL;
- if( s_plugin_load_map.Get(extension, &plugin) ) {
- return plugin(img, stream);
- }
-
- /*foreach(i, s_plugin_load_map) {
- nvDebug("%s %s %d\n", s_plugin_load_map[i].key.GetStr(), extension, 0 == strcmp(extension, s_plugin_load_map[i].key));
- }
-
- nvDebug("No plugin found for '%s' %d.\n", extension, s_plugin_load_map.Size());*/
-
- return false;
- }
-
- bool Save(const PiImage * img, const char * name, PiStream & stream) {
-
- // Get name extension.
- const char * extension = piExtension(name);
-
- // Skip the dot.
- if( *extension == '.' ) {
- extension++;
- }
-
- // Lookup plugin in the map.
- ImageOutput_Plugin plugin = NULL;
- if( s_plugin_save_map.Get(extension, &plugin) ) {
- return plugin(img, stream);
- }
-
- return false;
- }
-
-} // ImageIO
-
-#endif // 0
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ImageIO.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/ImageIO.h
deleted file mode 100644
index 852217e3..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/ImageIO.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_IMAGE_IMAGEIO_H
-#define NV_IMAGE_IMAGEIO_H
-
-#include <nvimage/nvimage.h>
-
-namespace nv
-{
- class Image;
- class FloatImage;
- class Stream;
-
- namespace ImageIO
- {
- NVIMAGE_API Image * load(const char * fileName);
- NVIMAGE_API Image * load(const char * fileName, Stream & s);
-
- NVIMAGE_API FloatImage * loadFloat(const char * fileName);
- NVIMAGE_API FloatImage * loadFloat(const char * fileName, Stream & s);
-
- NVIMAGE_API bool save(const char * fileName, Stream & s, const Image * img);
- NVIMAGE_API bool save(const char * fileName, const Image * img);
- NVIMAGE_API bool saveFloat(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components);
-
- NVIMAGE_API Image * loadTGA(Stream & s);
- NVIMAGE_API bool saveTGA(Stream & s, const Image * img);
-
- NVIMAGE_API Image * loadPSD(Stream & s);
-
-#if defined(HAVE_PNG)
- NVIMAGE_API Image * loadPNG(Stream & s);
-#endif
-
-#if defined(HAVE_JPEG)
- NVIMAGE_API Image * loadJPG(Stream & s);
-#endif
-
-#if defined(HAVE_TIFF)
- NVIMAGE_API FloatImage * loadFloatTIFF(const char * fileName, Stream & s);
-
- NVIMAGE_API bool saveFloatTIFF(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components);
-#endif
-
-#if defined(HAVE_OPENEXR)
- NVIMAGE_API FloatImage * loadFloatEXR(const char * fileName, Stream & s);
-
- NVIMAGE_API bool saveFloatEXR(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components);
-#endif
-/*
- NVIMAGE_API FloatImage * loadFloatPFM(const char * fileName, Stream & s);
- NVIMAGE_API bool saveFloatPFM(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components);
-
- // GridFloat is a simple, open format for terrain elevation data. See http://ned.usgs.gov/Ned/faq.asp.
- // Expects: 1) fileName will be an ".hdr" header file, 2) there will also exist a corresponding float data
- // blob in a ".flt" file. (This is what USGS gives you.)
- NVIMAGE_API FloatImage * loadGridFloat(const char * fileName, Stream & s);
-*/
- } // ImageIO namespace
-
-} // nv namespace
-
-
-#endif // NV_IMAGE_IMAGEIO_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMap.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMap.cpp
deleted file mode 100644
index 2ece5744..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMap.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvimage/NormalMap.h>
-#include <nvimage/Filter.h>
-#include <nvimage/FloatImage.h>
-#include <nvimage/Image.h>
-
-#include <nvmath/Color.h>
-
-#include <nvcore/Ptr.h>
-
-
-using namespace nv;
-
-// Create normal map using the given kernels.
-static FloatImage * createNormalMap(const Image * img, FloatImage::WrapMode wm, Vector4::Arg heightWeights, const Kernel2 * kdu, const Kernel2 * kdv)
-{
- nvCheck(kdu != NULL);
- nvCheck(kdv != NULL);
- nvCheck(img != NULL);
-
- const uint w = img->width();
- const uint h = img->height();
-
- AutoPtr<FloatImage> fimage(new FloatImage());
- fimage->allocate(4, w, h);
-
- // Compute height and store in alpha channel:
- float * alphaChannel = fimage->channel(3);
- for(uint i = 0; i < w*h; i++)
- {
- Vector4 color = toVector4(img->pixel(i));
- alphaChannel[i] = dot(color, heightWeights);
- }
-
- float heightScale = 1.0f / 16.0f; // @@ Use a user defined factor.
-
- for(uint y = 0; y < h; y++)
- {
- for(uint x = 0; x < w; x++)
- {
- const float du = fimage->applyKernel(kdu, x, y, 3, wm);
- const float dv = fimage->applyKernel(kdv, x, y, 3, wm);
-
- Vector3 n = normalize(Vector3(du, dv, heightScale));
-
- fimage->setPixel(0.5f * n.x() + 0.5f, x, y, 0);
- fimage->setPixel(0.5f * n.y() + 0.5f, x, y, 1);
- fimage->setPixel(0.5f * n.z() + 0.5f, x, y, 2);
- }
- }
-
- return fimage.release();
-}
-
-
-/// Create normal map using the given filter.
-FloatImage * nv::createNormalMap(const Image * img, FloatImage::WrapMode wm, Vector4::Arg heightWeights, NormalMapFilter filter /*= Sobel3x3*/)
-{
- nvCheck(img != NULL);
-
- // Init the kernels.
- Kernel2 * kdu = NULL;
- Kernel2 * kdv = NULL;
-
- switch(filter)
- {
- case NormalMapFilter_Sobel3x3:
- kdu = new Kernel2(3);
- break;
- case NormalMapFilter_Sobel5x5:
- kdu = new Kernel2(5);
- break;
- case NormalMapFilter_Sobel7x7:
- kdu = new Kernel2(7);
- break;
- case NormalMapFilter_Sobel9x9:
- kdu = new Kernel2(9);
- break;
- default:
- nvDebugCheck(false);
- };
-
- kdu->initSobel();
- kdu->normalize();
-
- kdv = new Kernel2(*kdu);
- kdv->transpose();
-
- return ::createNormalMap(img, wm, heightWeights, kdu, kdv);
-}
-
-
-/// Create normal map combining multiple sobel filters.
-FloatImage * nv::createNormalMap(const Image * img, FloatImage::WrapMode wm, Vector4::Arg heightWeights, Vector4::Arg filterWeights)
-{
- nvCheck(img != NULL);
-
- Kernel2 * kdu = NULL;
- Kernel2 * kdv = NULL;
-
- kdu = new Kernel2(9);
- kdu->initBlendedSobel(filterWeights);
- kdu->normalize();
-
- kdv = new Kernel2(*kdu);
- kdv->transpose();
-
- return ::createNormalMap(img, wm, heightWeights, kdu, kdv);
-}
-
-/// Normalize the given image in place.
-void nv::normalizeNormalMap(FloatImage * img)
-{
- nvCheck(img != NULL);
- img->expandNormals(0);
- img->normalize(0);
- img->packNormals(0);
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMap.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMap.h
deleted file mode 100644
index 670ead45..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMap.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_IMAGE_NORMALMAP_H
-#define NV_IMAGE_NORMALMAP_H
-
-#include <nvmath/Vector.h>
-#include <nvimage/nvimage.h>
-#include <nvimage/FloatImage.h>
-
-
-namespace nv
-{
- class Image;
-
- enum NormalMapFilter
- {
- NormalMapFilter_Sobel3x3, // fine detail
- NormalMapFilter_Sobel5x5, // medium detail
- NormalMapFilter_Sobel7x7, // large detail
- NormalMapFilter_Sobel9x9, // very large
- };
-
- FloatImage * createNormalMap(const Image * img, FloatImage::WrapMode wm, Vector4::Arg heightWeights, NormalMapFilter filter = NormalMapFilter_Sobel3x3);
-
- FloatImage * createNormalMap(const Image * img, FloatImage::WrapMode wm, Vector4::Arg heightWeights, Vector4::Arg filterWeights);
-
- void normalizeNormalMap(FloatImage * img);
-
- // @@ Add generation of DU/DV maps.
-
-
-} // nv namespace
-
-#endif // NV_IMAGE_NORMALMAP_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMipmap.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMipmap.cpp
deleted file mode 100644
index 63ea49e0..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMipmap.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvimage/NormalMipmap.h>
-#include <nvimage/FloatImage.h>
-
-#include <nvmath/Montecarlo.h>
-#include <nvmath/SphericalHarmonic.h>
-
-#include <nvcore/Ptr.h>
-
-
-using namespace nv;
-
-FloatImage * nv::createNormalMipmapMap(const FloatImage * img)
-{
- nvDebugCheck(img != NULL);
-
- uint w = img->width();
- uint h = img->height();
-
- uint hw = w / 2;
- uint hh = h / 2;
-
- FloatImage dotImg;
- dotImg.allocate(1, w, h);
-
- FloatImage shImg;
- shImg.allocate(9, hw, hh);
-
- SampleDistribution distribution(256);
- const uint sampleCount = distribution.sampleCount();
-
- for (uint d = 0; d < sampleCount; d++)
- {
- const float * xChannel = img->channel(0);
- const float * yChannel = img->channel(1);
- const float * zChannel = img->channel(2);
-
- Vector3 dir = distribution.sampleDir(d);
-
- Sh2 basis;
- basis.eval(dir);
-
- for(uint i = 0; i < w*h; i++)
- {
- Vector3 normal(xChannel[i], yChannel[i], zChannel[i]);
- normal = normalizeSafe(normal, Vector3(zero), 0.0f);
-
- dotImg.setPixel(dot(dir, normal), d);
- }
-
- // @@ It would be nice to have a fastDownSample that took an existing image as an argument, to avoid allocations.
- AutoPtr<FloatImage> dotMip(dotImg.fastDownSample());
-
- for(uint p = 0; p < hw*hh; p++)
- {
- float f = dotMip->pixel(p);
-
- // Project irradiance to sh basis and accumulate.
- for (uint i = 0; i < 9; i++)
- {
- float & sum = shImg.channel(i)[p];
- sum += f * basis.elemAt(i);
- }
- }
- }
-
-
-
- FloatImage * normalMipmap = new FloatImage;
- normalMipmap->allocate(4, hw, hh);
-
- // Precompute the clamped cosine radiance transfer.
- Sh2 prt;
- prt.cosineTransfer();
-
- // Allocate outside the loop.
- Sh2 sh;
-
- for(uint p = 0; p < hw*hh; p++)
- {
- for (uint i = 0; i < 9; i++)
- {
- sh.elemAt(i) = shImg.channel(i)[p];
- }
-
- // Convolve sh irradiance by radiance transfer.
- sh *= prt;
-
- // Now sh(0) is the ambient occlusion.
- // and sh(1) is the normal direction.
-
- // Should we use SVD to fit only the normals to the SH?
-
- }
-
- return normalMipmap;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMipmap.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMipmap.h
deleted file mode 100644
index fc367277..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/NormalMipmap.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_IMAGE_NORMALMIPMAP_H
-#define NV_IMAGE_NORMALMIPMAP_H
-
-#include <nvimage/nvimage.h>
-
-
-namespace nv
-{
- class FloatImage;
-
- FloatImage * createNormalMipmapMap(const FloatImage * img);
-
-} // nv namespace
-
-#endif // NV_IMAGE_NORMALMIPMAP_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/PixelFormat.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/PixelFormat.h
deleted file mode 100644
index 0106f3d9..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/PixelFormat.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_IMAGE_PIXELFORMAT_H
-#define NV_IMAGE_PIXELFORMAT_H
-
-#include <nvimage/nvimage.h>
-
-
-namespace nv
-{
- namespace PixelFormat
- {
-
- // Convert component @a c having @a inbits to the returned value having @a outbits.
- inline uint convert(uint c, uint inbits, uint outbits)
- {
- if (inbits == 0)
- {
- return 0;
- }
- else if (inbits >= outbits)
- {
- // truncate
- return c >> (inbits - outbits);
- }
- else
- {
- // bitexpand
- return (c << (outbits - inbits)) | convert(c, inbits, outbits - inbits);
- }
- }
-
- // Get pixel component shift and size given its mask.
- inline void maskShiftAndSize(uint mask, uint * shift, uint * size)
- {
- if (!mask)
- {
- *shift = 0;
- *size = 0;
- return;
- }
-
- *shift = 0;
- while((mask & 1) == 0) {
- ++(*shift);
- mask >>= 1;
- }
-
- *size = 0;
- while((mask & 1) == 1) {
- ++(*size);
- mask >>= 1;
- }
- }
-
- } // PixelFormat namespace
-
-} // nv namespace
-
-
-#endif // NV_IMAGE_PIXELFORMAT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/PsdFile.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/PsdFile.h
deleted file mode 100644
index 41379edd..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/PsdFile.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_IMAGE_PSDFILE_H
-#define NV_IMAGE_PSDFILE_H
-
-#include <nvcore/Stream.h>
-
-namespace nv
-{
- enum PsdColorMode
- {
- PsdColorMode_Bitmap = 0,
- PsdColorMode_GrayScale = 1,
- PsdColorMode_Indexed = 2,
- PsdColorMode_RGB = 3,
- PsdColorMode_CMYK = 4,
- PsdColorMode_MultiChannel = 7,
- PsdColorMode_DuoTone = 8,
- PsdColorMode_LabColor = 9
- };
-
- /// PSD header.
- struct PsdHeader
- {
- uint32 signature;
- uint16 version;
- uint8 reserved[6];
- uint16 channel_count;
- uint32 height;
- uint32 width;
- uint16 depth;
- uint16 color_mode;
-
- bool isValid() const
- {
- return signature == 0x38425053; // '8BPS'
- }
-
- bool isSupported() const
- {
- if (version != 1) {
- nvDebug("*** bad version number %u\n", version);
- return false;
- }
- if (channel_count > 4) {
- return false;
- }
- if (depth != 8) {
- return false;
- }
- if (color_mode != PsdColorMode_RGB) {
- return false;
- }
- return true;
- }
- };
-
-
- inline Stream & operator<< (Stream & s, PsdHeader & head)
- {
- s << head.signature << head.version;
- for (int i = 0; i < 6; i++) {
- s << head.reserved[i];
- }
- return s << head.channel_count << head.height << head.width << head.depth << head.color_mode;
- }
-
-} // nv namespace
-
-#endif // NV_IMAGE_PSDFILE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/Quantize.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvimage/Quantize.cpp
deleted file mode 100644
index 56812bd4..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/Quantize.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-/*
-http://www.visgraf.impa.br/Courses/ip00/proj/Dithering1/floyd_steinberg_dithering.html
-http://www.gamedev.net/reference/articles/article341.asp
-
-@@ Look at LPS: http://www.cs.rit.edu/~pga/pics2000/i.html
-
-This is a really nice guide to dithering algorithms:
-http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT
-
-@@ This code needs to be reviewed, I'm not sure it's correct.
-*/
-
-#include <nvimage/Quantize.h>
-#include <nvimage/Image.h>
-#include <nvimage/PixelFormat.h>
-
-#include <nvmath/Color.h>
-
-#include <nvcore/Containers.h> // swap
-
-
-using namespace nv;
-
-
-// Simple quantization.
-void nv::Quantize::BinaryAlpha( Image * image, int alpha_threshold /*= 127*/ )
-{
- nvCheck(image != NULL);
-
- const uint w = image->width();
- const uint h = image->height();
-
- for(uint y = 0; y < h; y++) {
- for(uint x = 0; x < w; x++) {
-
- Color32 pixel = image->pixel(x, y);
-
- // Convert color.
- if( pixel.a > alpha_threshold ) pixel.a = 255;
- else pixel.a = 0;
-
- // Store color.
- image->pixel(x, y) = pixel;
- }
- }
-}
-
-
-// Simple quantization.
-void nv::Quantize::RGB16( Image * image )
-{
- Truncate(image, 5, 6, 5, 8);
-}
-
-// Alpha quantization.
-void nv::Quantize::Alpha4( Image * image )
-{
- Truncate(image, 8, 8, 8, 4);
-}
-
-
-// Error diffusion. Floyd Steinberg.
-void nv::Quantize::FloydSteinberg_RGB16( Image * image )
-{
- FloydSteinberg(image, 5, 6, 5, 8);
-}
-
-
-// Error diffusion. Floyd Steinberg.
-void nv::Quantize::FloydSteinberg_BinaryAlpha( Image * image, int alpha_threshold /*= 127*/ )
-{
- nvCheck(image != NULL);
-
- const uint w = image->width();
- const uint h = image->height();
-
- // @@ Use fixed point?
- float * row0 = new float[(w+2)];
- float * row1 = new float[(w+2)];
- memset(row0, 0, sizeof(float)*(w+2));
- memset(row1, 0, sizeof(float)*(w+2));
-
- for(uint y = 0; y < h; y++) {
- for(uint x = 0; x < w; x++) {
-
- Color32 pixel = image->pixel(x, y);
-
- // Add error.
- int alpha = int(pixel.a) + int(row0[1+x]);
-
- // Convert color.
- if( alpha > alpha_threshold ) pixel.a = 255;
- else pixel.a = 0;
-
- // Store color.
- image->pixel(x, y) = pixel;
-
- // Compute new error.
- float diff = float(alpha - pixel.a);
-
- // Propagate new error.
- row0[1+x+1] += 7.0f / 16.0f * diff;
- row1[1+x-1] += 3.0f / 16.0f * diff;
- row1[1+x+0] += 5.0f / 16.0f * diff;
- row1[1+x+1] += 1.0f / 16.0f * diff;
- }
-
- swap(row0, row1);
- memset(row1, 0, sizeof(float)*(w+2));
- }
-
- delete [] row0;
- delete [] row1;
-}
-
-
-// Error diffusion. Floyd Steinberg.
-void nv::Quantize::FloydSteinberg_Alpha4( Image * image )
-{
- FloydSteinberg(image, 8, 8, 8, 4);
-}
-
-
-void nv::Quantize::Truncate(Image * image, uint rsize, uint gsize, uint bsize, uint asize)
-{
- nvCheck(image != NULL);
-
- const uint w = image->width();
- const uint h = image->height();
-
- for(uint y = 0; y < h; y++) {
- for(uint x = 0; x < w; x++) {
-
- Color32 pixel = image->pixel(x, y);
-
- // Convert to our desired size, and reconstruct.
- pixel.r = PixelFormat::convert(pixel.r, 8, rsize);
- pixel.r = PixelFormat::convert(pixel.r, rsize, 8);
-
- pixel.g = PixelFormat::convert(pixel.g, 8, gsize);
- pixel.g = PixelFormat::convert(pixel.g, gsize, 8);
-
- pixel.b = PixelFormat::convert(pixel.b, 8, bsize);
- pixel.b = PixelFormat::convert(pixel.b, bsize, 8);
-
- pixel.a = PixelFormat::convert(pixel.a, 8, asize);
- pixel.a = PixelFormat::convert(pixel.a, asize, 8);
-
- // Store color.
- image->pixel(x, y) = pixel;
- }
- }
-}
-
-
-// Error diffusion. Floyd Steinberg.
-void nv::Quantize::FloydSteinberg(Image * image, uint rsize, uint gsize, uint bsize, uint asize)
-{
- nvCheck(image != NULL);
-
- const uint w = image->width();
- const uint h = image->height();
-
- Vector4 * row0 = new Vector4[w+2];
- Vector4 * row1 = new Vector4[w+2];
- memset(row0, 0, sizeof(Vector4)*(w+2));
- memset(row1, 0, sizeof(Vector4)*(w+2));
-
- for (uint y = 0; y < h; y++) {
- for (uint x = 0; x < w; x++) {
-
- Color32 pixel = image->pixel(x, y);
-
- // Add error.
- pixel.r = clamp(int(pixel.r) + int(row0[1+x].x()), 0, 255);
- pixel.g = clamp(int(pixel.g) + int(row0[1+x].y()), 0, 255);
- pixel.b = clamp(int(pixel.b) + int(row0[1+x].z()), 0, 255);
- pixel.a = clamp(int(pixel.a) + int(row0[1+x].w()), 0, 255);
-
- int r = pixel.r;
- int g = pixel.g;
- int b = pixel.b;
- int a = pixel.a;
-
- // Convert to our desired size, and reconstruct.
- r = PixelFormat::convert(r, 8, rsize);
- r = PixelFormat::convert(r, rsize, 8);
-
- g = PixelFormat::convert(g, 8, gsize);
- g = PixelFormat::convert(g, gsize, 8);
-
- b = PixelFormat::convert(b, 8, bsize);
- b = PixelFormat::convert(b, bsize, 8);
-
- a = PixelFormat::convert(a, 8, asize);
- a = PixelFormat::convert(a, asize, 8);
-
- // Store color.
- image->pixel(x, y) = Color32(r, g, b, a);
-
- // Compute new error.
- Vector4 diff(float(int(pixel.r) - r), float(int(pixel.g) - g), float(int(pixel.b) - b), float(int(pixel.a) - a));
-
- // Propagate new error.
- row0[1+x+1] += 7.0f / 16.0f * diff;
- row1[1+x-1] += 3.0f / 16.0f * diff;
- row1[1+x+0] += 5.0f / 16.0f * diff;
- row1[1+x+1] += 1.0f / 16.0f * diff;
- }
-
- swap(row0, row1);
- memset(row1, 0, sizeof(Vector4)*(w+2));
- }
-
- delete [] row0;
- delete [] row1;
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/Quantize.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/Quantize.h
deleted file mode 100644
index 5b4a9555..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/Quantize.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_IMAGE_QUANTIZE_H
-#define NV_IMAGE_QUANTIZE_H
-
-#include <nvimage/nvimage.h>
-
-
-namespace nv
-{
- class Image;
-
- namespace Quantize
- {
- void RGB16(Image * img);
- void BinaryAlpha(Image * img, int alpha_threshold = 127);
- void Alpha4(Image * img);
-
- void FloydSteinberg_RGB16(Image * img);
- void FloydSteinberg_BinaryAlpha(Image * img, int alpha_threshold = 127);
- void FloydSteinberg_Alpha4(Image * img);
-
- void Truncate(Image * image, uint rsize, uint gsize, uint bsize, uint asize);
- void FloydSteinberg(Image * image, uint rsize, uint gsize, uint bsize, uint asize);
-
- // @@ Add palette quantization algorithms!
- }
-}
-
-
-#endif // NV_IMAGE_QUANTIZE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/TgaFile.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/TgaFile.h
deleted file mode 100644
index bdbfce54..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/TgaFile.h
+++ /dev/null
@@ -1,105 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_IMAGE_TGAFILE_H
-#define NV_IMAGE_TGAFILE_H
-
-#include <nvcore/Stream.h>
-
-namespace nv
-{
-
-// TGA types
-enum TGAType {
- TGA_TYPE_INDEXED = 1,
- TGA_TYPE_RGB = 2,
- TGA_TYPE_GREY = 3,
- TGA_TYPE_RLE_INDEXED = 9,
- TGA_TYPE_RLE_RGB = 10,
- TGA_TYPE_RLE_GREY = 11
-};
-
-#define TGA_INTERLEAVE_MASK 0xc0
-#define TGA_INTERLEAVE_NONE 0x00
-#define TGA_INTERLEAVE_2WAY 0x40
-#define TGA_INTERLEAVE_4WAY 0x80
-
-#define TGA_ORIGIN_MASK 0x30
-#define TGA_ORIGIN_LEFT 0x00
-#define TGA_ORIGIN_RIGHT 0x10
-#define TGA_ORIGIN_LOWER 0x00
-#define TGA_ORIGIN_UPPER 0x20
-
-#define TGA_HAS_ALPHA 0x0F
-
-
-/// Tga Header.
-struct TgaHeader {
- uint8 id_length;
- uint8 colormap_type;
- uint8 image_type;
- uint16 colormap_index;
- uint16 colormap_length;
- uint8 colormap_size;
- uint16 x_origin;
- uint16 y_origin;
- uint16 width;
- uint16 height;
- uint8 pixel_size;
- uint8 flags;
-
- enum { Size = 18 }; //const static int SIZE = 18;
-};
-
-
-/// Tga File.
-struct TgaFile {
-
- TgaFile() {
- mem = NULL;
- }
- ~TgaFile() {
- free();
- }
-
- uint size() const {
- return head.width * head.height * (head.pixel_size / 8);
- }
- void allocate() {
- nvCheck( mem == NULL );
- mem = new uint8[size()];
- }
- void free() {
- delete [] mem;
- mem = NULL;
- }
-
- TgaHeader head;
- uint8 * mem;
-};
-
-
-inline Stream & operator<< (Stream & s, TgaHeader & head)
-{
- s << head.id_length << head.colormap_type << head.image_type;
- s << head.colormap_index << head.colormap_length << head.colormap_size;
- s << head.x_origin << head.y_origin << head.width << head.height;
- s << head.pixel_size << head.flags;
- return s;
-}
-
-inline Stream & operator<< (Stream & s, TgaFile & tga)
-{
- s << tga.head;
-
- if( s.isLoading() ) {
- tga.allocate();
- }
-
- s.serialize( tga.mem, tga.size() );
-
- return s;
-}
-
-} // nv namespace
-
-#endif // NV_IMAGE_TGAFILE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvimage/nvimage.h b/Libraries/nvidia-texture-tools-read-only/src/nvimage/nvimage.h
deleted file mode 100644
index beb39650..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvimage/nvimage.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_IMAGE_H
-#define NV_IMAGE_H
-
-#include <nvcore/nvcore.h>
-
-// Function linkage
-#if NVIMAGE_SHARED
-#ifdef NVIMAGE_EXPORTS
-#define NVIMAGE_API DLL_EXPORT
-#define NVIMAGE_CLASS DLL_EXPORT_CLASS
-#else
-#define NVIMAGE_API DLL_IMPORT
-#define NVIMAGE_CLASS DLL_IMPORT
-#endif
-#else
-#define NVIMAGE_API
-#define NVIMAGE_CLASS
-#endif
-
-#endif // NV_IMAGE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Basis.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Basis.cpp
deleted file mode 100644
index 76660bb0..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Basis.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvmath/Basis.h>
-
-using namespace nv;
-
-
-/// Normalize basis vectors.
-void Basis::normalize(float epsilon /*= NV_EPSILON*/)
-{
- normal = ::normalize(normal, epsilon);
- tangent = ::normalize(tangent, epsilon);
- bitangent = ::normalize(bitangent, epsilon);
-}
-
-
-/// Gram-Schmidt orthogonalization.
-/// @note Works only if the vectors are close to orthogonal.
-void Basis::orthonormalize(float epsilon /*= NV_EPSILON*/)
-{
- // N' = |N|
- // T' = |T - (N' dot T) N'|
- // B' = |B - (N' dot B) N' - (T' dot B) T'|
-
- normal = ::normalize(normal, epsilon);
-
- tangent -= normal * dot(normal, tangent);
- tangent = ::normalize(tangent, epsilon);
-
- bitangent -= normal * dot(normal, bitangent);
- bitangent -= tangent * dot(tangent, bitangent);
- bitangent = ::normalize(bitangent, epsilon);
-}
-
-
-/// Robust orthonormalization.
-/// Returns an orthonormal basis even when the original is degenerate.
-void Basis::robustOrthonormalize(float epsilon /*= NV_EPSILON*/)
-{
- if (length(normal) < epsilon)
- {
- normal = cross(tangent, bitangent);
-
- if (length(normal) < epsilon)
- {
- tangent = Vector3(1, 0, 0);
- bitangent = Vector3(0, 1, 0);
- normal = Vector3(0, 0, 1);
- return;
- }
- }
- normal = nv::normalize(normal, epsilon);
-
- tangent -= normal * dot(normal, tangent);
- bitangent -= normal * dot(normal, bitangent);
-
- if (length(tangent) < epsilon)
- {
- if (length(bitangent) < epsilon)
- {
- buildFrameForDirection(normal);
- }
- else
- {
- tangent = cross(bitangent, normal);
- nvCheck(isNormalized(tangent, epsilon));
- }
- }
- else
- {
-#if 0
- tangent = nv::normalize(tangent, epsilon);
- bitangent -= tangent * dot(tangent, bitangent);
-
- if (length(bitangent) < epsilon)
- {
- bitangent = cross(tangent, normal);
- nvCheck(isNormalized(bitangent));
- }
- else
- {
- bitangent = nv::normalize(bitangent, epsilon);
- }
-#else
- if (length(bitangent) < epsilon)
- {
- bitangent = cross(tangent, normal);
- nvCheck(isNormalized(bitangent));
- }
- else
- {
- tangent = nv::normalize(tangent);
- bitangent = nv::normalize(bitangent);
-
- Vector3 bisector;
- if (length(tangent + bitangent) < epsilon)
- {
- bisector = tangent;
- }
- else
- {
- bisector = nv::normalize(tangent + bitangent);
- }
- Vector3 axis = cross(bisector, normal);
-
- nvDebugCheck(isNormalized(axis, epsilon));
- nvDebugCheck(equal(dot(axis, tangent), -dot(axis, bitangent), epsilon));
-
- if (dot(axis, tangent) > 0)
- {
- tangent = nv::normalize(bisector + axis);
- bitangent = nv::normalize(bisector - axis);
- }
- else
- {
- tangent = nv::normalize(bisector - axis);
- bitangent = nv::normalize(bisector + axis);
- }
- }
-#endif
- }
-
- /*// Check vector lengths.
- if (!isNormalized(normal, epsilon))
- {
- nvDebug("%f %f %f\n", normal.x(), normal.y(), normal.z());
- nvDebug("%f %f %f\n", tangent.x(), tangent.y(), tangent.z());
- nvDebug("%f %f %f\n", bitangent.x(), bitangent.y(), bitangent.z());
- }*/
-
- nvCheck(isNormalized(normal, epsilon));
- nvCheck(isNormalized(tangent, epsilon));
- nvCheck(isNormalized(bitangent, epsilon));
-
- // Check vector angles.
- nvCheck(equal(dot(normal, tangent), 0.0f, epsilon));
- nvCheck(equal(dot(normal, bitangent), 0.0f, epsilon));
- nvCheck(equal(dot(tangent, bitangent), 0.0f, epsilon));
-
- // Check vector orientation.
- const float det = dot(cross(normal, tangent), bitangent);
- nvCheck(equal(det, 1.0f, epsilon) || equal(det, -1.0f, epsilon));
-}
-
-
-/// Build an arbitrary frame for the given direction.
-void Basis::buildFrameForDirection(Vector3::Arg d)
-{
- nvCheck(isNormalized(d));
- normal = d;
-
- // Choose minimum axis.
- if (fabsf(normal.x()) < fabsf(normal.y()) && fabsf(normal.x()) < fabsf(normal.z()))
- {
- tangent = Vector3(1, 0, 0);
- }
- else if (fabsf(normal.y()) < fabsf(normal.z()))
- {
- tangent = Vector3(0, 1, 0);
- }
- else
- {
- tangent = Vector3(0, 0, 1);
- }
-
- // Ortogonalize
- tangent -= normal * dot(normal, tangent);
- tangent = ::normalize(tangent);
-
- bitangent = cross(normal, tangent);
-}
-
-bool Basis::isValid() const
-{
- if (equal(normal, Vector3(zero))) return false;
- if (equal(tangent, Vector3(zero))) return false;
- if (equal(bitangent, Vector3(zero))) return false;
-
- if (equal(determinant(), 0.0f)) return false;
-
- return true;
-}
-
-
-/// Transform by this basis. (From this basis to object space).
-Vector3 Basis::transform(Vector3::Arg v) const
-{
- Vector3 o = tangent * v.x();
- o += bitangent * v.y();
- o += normal * v.z();
- return o;
-}
-
-/// Transform by the transpose. (From object space to this basis).
-Vector3 Basis::transformT(Vector3::Arg v)
-{
- return Vector3(dot(tangent, v), dot(bitangent, v), dot(normal, v));
-}
-
-/// Transform by the inverse. (From object space to this basis).
-/// @note Uses Cramer's rule so the inverse is not accurate if the basis is ill-conditioned.
-Vector3 Basis::transformI(Vector3::Arg v) const
-{
- const float det = determinant();
- nvDebugCheck(!equal(det, 0.0f, 0.0f));
-
- const float idet = 1.0f / det;
-
- // Rows of the inverse matrix.
- Vector3 r0(
- (bitangent.y() * normal.z() - bitangent.z() * normal.y()),
- -(bitangent.x() * normal.z() - bitangent.z() * normal.x()),
- (bitangent.x() * normal.y() - bitangent.y() * normal.x()));
-
- Vector3 r1(
- -(tangent.y() * normal.z() - tangent.z() * normal.y()),
- (tangent.x() * normal.z() - tangent.z() * normal.x()),
- -(tangent.x() * normal.y() - tangent.y() * normal.x()));
-
- Vector3 r2(
- (tangent.y() * bitangent.z() - tangent.z() * bitangent.y()),
- -(tangent.x() * bitangent.z() - tangent.z() * bitangent.x()),
- (tangent.x() * bitangent.y() - tangent.y() * bitangent.x()));
-
- return Vector3(dot(v, r0), dot(v, r1), dot(v, r2)) * idet;
-}
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Basis.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Basis.h
deleted file mode 100644
index 0626437d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Basis.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_BASIS_H
-#define NV_MATH_BASIS_H
-
-#include <nvmath/nvmath.h>
-#include <nvmath/Vector.h>
-#include <nvmath/Matrix.h>
-
-namespace nv
-{
-
- /// Basis class to compute tangent space basis, ortogonalizations and to
- /// transform vectors from one space to another.
- class Basis
- {
- public:
-
- /// Create a null basis.
- Basis() : tangent(0, 0, 0), bitangent(0, 0, 0), normal(0, 0, 0) {}
-
- /// Create a basis given three vectors.
- Basis(Vector3::Arg n, Vector3::Arg t, Vector3::Arg b) : tangent(t), bitangent(b), normal(n) {}
-
- /// Create a basis with the given tangent vectors and the handness.
- Basis(Vector3::Arg n, Vector3::Arg t, float sign)
- {
- build(n, t, sign);
- }
-
- NVMATH_API void normalize(float epsilon = NV_EPSILON);
- NVMATH_API void orthonormalize(float epsilon = NV_EPSILON);
- NVMATH_API void robustOrthonormalize(float epsilon = NV_EPSILON);
- NVMATH_API void buildFrameForDirection(Vector3::Arg d);
-
- /// Calculate the determinant [ F G N ] to obtain the handness of the basis.
- float handness() const
- {
- return determinant() > 0.0f ? 1.0f : -1.0f;
- }
-
- /// Build a basis from 2 vectors and a handness flag.
- void build(Vector3::Arg n, Vector3::Arg t, float sign)
- {
- normal = n;
- tangent = t;
- bitangent = sign * cross(t, n);
- }
-
- /// Compute the determinant of this basis.
- float determinant() const
- {
- return
- tangent.x() * bitangent.y() * normal.z() - tangent.z() * bitangent.y() * normal.x() +
- tangent.y() * bitangent.z() * normal.x() - tangent.y() * bitangent.x() * normal.z() +
- tangent.z() * bitangent.x() * normal.y() - tangent.x() * bitangent.z() * normal.y();
- }
-
- bool isValid() const;
-
- // Get transform matrix for this basis.
- NVMATH_API Matrix matrix() const;
-
- // Transform by this basis. (From this basis to object space).
- NVMATH_API Vector3 transform(Vector3::Arg v) const;
-
- // Transform by the transpose. (From object space to this basis).
- NVMATH_API Vector3 transformT(Vector3::Arg v);
-
- // Transform by the inverse. (From object space to this basis).
- NVMATH_API Vector3 transformI(Vector3::Arg v) const;
-
-
- Vector3 tangent;
- Vector3 bitangent;
- Vector3 normal;
- };
-
-} // nv namespace
-
-#endif // NV_MATH_BASIS_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Bezier.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Bezier.cpp
deleted file mode 100644
index f108b2d2..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Bezier.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include "Bezier.h"
-
-
-using namespace nv;
-
-
-static void deCasteljau(float u, Vector3::Arg p0, Vector3::Arg p1, Vector3::Arg p2, Vector3::Arg p3, Vector3 * p)
-{
- Vector3 q0 = lerp(p0, p1, u);
- Vector3 q1 = lerp(p1, p2, u);
- Vector3 q2 = lerp(p2, p3, u);
- Vector3 r0 = lerp(q0, q1, u);
- Vector3 r1 = lerp(q1, q2, u);
-
- *p = lerp(r0, r1, u);
-}
-
-static void deCasteljau(float u, Vector3::Arg p0, Vector3::Arg p1, Vector3::Arg p2, Vector3::Arg p3, Vector3 * p, Vector3 * dp)
-{
- Vector3 q0 = lerp(p0, p1, u);
- Vector3 q1 = lerp(p1, p2, u);
- Vector3 q2 = lerp(p2, p3, u);
- Vector3 r0 = lerp(q0, q1, u);
- Vector3 r1 = lerp(q1, q2, u);
-
- *dp = r0 - r1;
- *p = lerp(r0, r1, u);
-}
-
-
-void nv::evaluateCubicBezierPatch(float u, float v,
- Vector3::Arg p0, Vector3::Arg p1, Vector3::Arg p2, Vector3::Arg p3,
- Vector3::Arg p4, Vector3::Arg p5, Vector3::Arg p6, Vector3::Arg p7,
- Vector3::Arg p8, Vector3::Arg p9, Vector3::Arg pA, Vector3::Arg pB,
- Vector3::Arg pC, Vector3::Arg pD, Vector3::Arg pE, Vector3::Arg pF,
- Vector3 * pos, Vector3 * du, Vector3 * dv)
-{
-#if 0
- Vector2 L0(1-u,1-v);
- Vector2 L1(u,v);
-
- Vector2 Q0 = L0 * L0;
- Vector2 Q1 = 2 * L0 * L1;
- Vector2 Q2 = L1 * L1;
-
- Vector2 B0 = L0 * L0 * L0;
- Vector2 B1 = 3 * L0 * L0 * L1;
- Vector2 B2 = 3 * L1 * L1 * L0;
- Vector2 B3 = L1 * L1 * L1;
-
- *pos =
- (B0.x() * p0 + B1.x() * p1 + B2.x() * p2 + B3.x() * p3) * B0.y() +
- (B0.x() * p4 + B1.x() * p5 + B2.x() * p6 + B3.x() * p7) * B1.y() +
- (B0.x() * p8 + B1.x() * p9 + B2.x() * pA + B3.x() * pB) * B2.y() +
- (B0.x() * pC + B1.x() * pD + B2.x() * pE + B3.x() * pF) * B3.y();
-
- *du =
- ((p0-p1) * B0.y() + (p4-p5) * B1.y() + (p8-p9) * B2.y() + (pC-pD) * B3.y()) * Q0.x() +
- ((p1-p2) * B0.y() + (p5-p6) * B1.y() + (p9-pA) * B2.y() + (pD-pE) * B3.y()) * Q1.x() +
- ((p2-p3) * B0.y() + (p6-p7) * B1.y() + (pA-pB) * B2.y() + (pE-pF) * B3.y()) * Q2.x();
-
- *dv =
- ((p0-p4) * B0.x() + (p1-p5) * B1.x() + (p2-p6) * B2.x() + (p3-p7) * B3.x()) * Q0.y() +
- ((p4-p8) * B0.x() + (p5-p9) * B1.x() + (p6-pA) * B2.x() + (p7-pB) * B3.x()) * Q1.y() +
- ((p8-pC) * B0.x() + (p9-pD) * B1.x() + (pA-pE) * B2.x() + (pB-pF) * B3.x()) * Q2.y();
-#else
- Vector3 t0, t1, t2, t3;
- Vector3 q0, q1, q2, q3;
-
- deCasteljau(u, p0, p1, p2, p3, &q0, &t0);
- deCasteljau(u, p4, p5, p6, p7, &q1, &t1);
- deCasteljau(u, p8, p9, pA, pB, &q2, &t2);
- deCasteljau(u, pC, pD, pE, pF, &q3, &t3);
-
- deCasteljau(v, q0, q1, q2, q3, pos, dv);
- deCasteljau(v, t0, t1, t2, t3, du);
-#endif
-}
-
-
-void nv::degreeElevate(Vector3::Arg p0, Vector3::Arg p1, Vector3::Arg p2, Vector3::Arg p3,
- Vector3 * q0, Vector3 * q1, Vector3 * q2, Vector3 * q3, Vector3 * q4)
-{
-}
-
-void nv::evaluateQuarticBezierTriangle(float u, float v,
- Vector3::Arg p0, Vector3::Arg p1, Vector3::Arg p2, Vector3::Arg p3, Vector3::Arg p4,
- Vector3::Arg p5, Vector3::Arg p6, Vector3::Arg p7, Vector3::Arg p8,
- Vector3::Arg p9, Vector3::Arg pA, Vector3::Arg pB,
- Vector3::Arg pC, Vector3::Arg pD,
- Vector3::Arg pE,
- Vector3 * pos, Vector3 * du, Vector3 * dv)
-{
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Bezier.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Bezier.h
deleted file mode 100644
index 2efe18aa..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Bezier.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_BEZIER_H
-#define NV_MATH_BEZIER_H
-
-#include <nvmath/nvmath.h>
-#include <nvmath/Vector.h>
-
-namespace nv
-{
-
- void evaluateCubicBezierPatch(float u, float v,
- Vector3::Arg p0, Vector3::Arg p1, Vector3::Arg p2, Vector3::Arg p3,
- Vector3::Arg p4, Vector3::Arg p5, Vector3::Arg p6, Vector3::Arg p7,
- Vector3::Arg p8, Vector3::Arg p9, Vector3::Arg pA, Vector3::Arg pB,
- Vector3::Arg pC, Vector3::Arg pD, Vector3::Arg pE, Vector3::Arg pF,
- Vector3 * pos, Vector3 * du, Vector3 * dv);
-
- void degreeElevate(Vector3::Arg p0, Vector3::Arg p1, Vector3::Arg p2, Vector3::Arg p3,
- Vector3 * q0, Vector3 * q1, Vector3 * q2, Vector3 * q3, Vector3 * q4);
-
- void evaluateQuarticBezierTriangle(float u, float v,
- Vector3::Arg p0, Vector3::Arg p1, Vector3::Arg p2, Vector3::Arg p3, Vector3::Arg p4,
- Vector3::Arg p5, Vector3::Arg p6, Vector3::Arg p7, Vector3::Arg p8,
- Vector3::Arg p9, Vector3::Arg pA, Vector3::Arg pB,
- Vector3::Arg pC, Vector3::Arg pD,
- Vector3::Arg pE,
- Vector3 * pos, Vector3 * du, Vector3 * dv);
-
-
-} // nv namespace
-
-#endif // NV_MATH_BEZIER_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Box.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Box.h
deleted file mode 100644
index ed88a1b4..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Box.h
+++ /dev/null
@@ -1,145 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_BOX_H
-#define NV_MATH_BOX_H
-
-#include <nvmath/Vector.h>
-
-#include <float.h> // FLT_MAX
-
-namespace nv
-{
-class Stream;
-
-/// Axis Aligned Bounding Box.
-class Box
-{
-public:
-
- /// Default ctor.
- Box() { };
-
- /// Copy ctor.
- Box( const Box & b ) : m_mins(b.m_mins), m_maxs(b.m_maxs) { }
-
- /// Init ctor.
- Box( Vector3::Arg mins, Vector3::Arg maxs ) : m_mins(mins), m_maxs(maxs) { }
-
- // Cast operators.
- operator const float * () const { return reinterpret_cast<const float *>(this); }
-
- // Min corner of the box.
- Vector3 minCorner() const { return m_mins; }
- Vector3 & minCorner() { return m_mins; }
-
- // Max corner of the box.
- Vector3 maxCorner() const { return m_maxs; }
- Vector3 & maxCorner() { return m_maxs; }
-
- /// Clear the bounds.
- void clearBounds()
- {
- m_mins.set(FLT_MAX, FLT_MAX, FLT_MAX);
- m_maxs.set(-FLT_MAX, -FLT_MAX, -FLT_MAX);
- }
-
- /// Build a cube centered on center and with edge = 2*dist
- void cube(Vector3::Arg center, float dist)
- {
- setCenterExtents(center, Vector3(dist, dist, dist));
- }
-
- /// Build a box, given center and extents.
- void setCenterExtents(Vector3::Arg center, Vector3::Arg extents)
- {
- m_mins = center - extents;
- m_maxs = center + extents;
- }
-
- /// Get box center.
- Vector3 center() const
- {
- return (m_mins + m_maxs) * 0.5f;
- }
-
- /// Return extents of the box.
- Vector3 extents() const
- {
- return (m_maxs - m_mins) * 0.5f;
- }
-
- /// Return extents of the box.
- scalar extents(uint axis) const
- {
- nvDebugCheck(axis < 3);
- if (axis == 0) return (m_maxs.x() - m_mins.x()) * 0.5f;
- if (axis == 1) return (m_maxs.y() - m_mins.y()) * 0.5f;
- if (axis == 2) return (m_maxs.z() - m_mins.z()) * 0.5f;
- nvAssume(false);
- return 0.0f;
- }
-
- /// Add a point to this box.
- void addPointToBounds(Vector3::Arg p)
- {
- m_mins = min(m_mins, p);
- m_maxs = max(m_maxs, p);
- }
-
- /// Add a box to this box.
- void addBoxToBounds(const Box & b)
- {
- m_mins = min(m_mins, b.m_mins);
- m_maxs = max(m_maxs, b.m_maxs);
- }
-
- /// Translate box.
- void translate(Vector3::Arg v)
- {
- m_mins += v;
- m_maxs += v;
- }
-
- /// Scale the box.
- void scale(float s)
- {
- m_mins *= s;
- m_maxs *= s;
- }
-
- /// Get the area of the box.
- float area() const
- {
- const Vector3 d = extents();
- return 8.0f * (d.x()*d.y() + d.x()*d.z() + d.y()*d.z());
- }
-
- /// Get the volume of the box.
- float volume() const
- {
- Vector3 d = extents();
- return 8.0f * (d.x() * d.y() * d.z());
- }
-
- /// Return true if the box contains the given point.
- bool contains(Vector3::Arg p) const
- {
- return
- m_mins.x() < p.x() && m_mins.y() < p.y() && m_mins.z() < p.z() &&
- m_maxs.x() > p.x() && m_maxs.y() > p.y() && m_maxs.z() > p.z();
- }
-
- friend Stream & operator<< (Stream & s, Box & box);
-
-private:
-
- Vector3 m_mins;
- Vector3 m_maxs;
-};
-
-
-
-} // nv namespace
-
-
-#endif // NV_MATH_BOX_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/CMakeLists.txt b/Libraries/nvidia-texture-tools-read-only/src/nvmath/CMakeLists.txt
deleted file mode 100644
index bfe9bbfe..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-PROJECT(nvmath)
-
-SET(MATH_SRCS
- nvmath.h
- Vector.h
- Matrix.h
- Quaternion.h
- Plane.h Plane.cpp
- Box.h
- Color.h
- Frustum.h Frustum.cpp
- Montecarlo.h Montecarlo.cpp
- Random.h Random.cpp
- SphericalHarmonic.h SphericalHarmonic.cpp
- Basis.h Basis.cpp
- Triangle.h Triangle.cpp TriBox.cpp
- Polygon.h Polygon.cpp
- TypeSerialization.h TypeSerialization.cpp
- Sparse.h Sparse.cpp
- Solver.h Solver.cpp
- KahanSum.h
- Half.h Half.cpp
- Fitting.h Fitting.cpp
- Bezier.h Bezier.cpp)
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-
-# targets
-ADD_DEFINITIONS(-DNVMATH_EXPORTS)
-
-IF(NVMATH_SHARED)
- ADD_LIBRARY(nvmath SHARED ${MATH_SRCS})
-ELSE(NVMATH_SHARED)
- ADD_LIBRARY(nvmath ${MATH_SRCS})
-ENDIF(NVMATH_SHARED)
-
-TARGET_LINK_LIBRARIES(nvmath ${LIBS} nvcore)
-
-INSTALL(TARGETS nvmath
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib/static)
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Color.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Color.h
deleted file mode 100644
index b6d548b6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Color.h
+++ /dev/null
@@ -1,179 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_COLOR_H
-#define NV_MATH_COLOR_H
-
-#include <nvcore/Debug.h>
-#include <nvmath/Vector.h>
-
-namespace nv
-{
-
-/// 64 bit color stored as BGRA.
-class NVMATH_CLASS Color64
-{
-public:
- Color64() { }
- Color64(const Color64 & c) : u(c.u) { }
- Color64(uint16 R, uint16 G, uint16 B, uint16 A) { setRGBA(R, G, B, A); }
- explicit Color64(uint64 U) : u(U) { }
-
- void setRGBA(uint16 R, uint16 G, uint16 B, uint16 A)
- {
- r = R;
- g = G;
- b = B;
- a = A;
- }
-
- operator uint64 () const {
- return u;
- }
-
- union {
- struct {
-#if NV_LITTLE_ENDIAN
- uint16 r, a, b, g;
-#else
- uint16 a: 16;
- uint16 r: 16;
- uint16 g: 16;
- uint16 b: 16;
-#endif
- };
- uint64 u;
- };
-};
-
-/// 32 bit color stored as BGRA.
-class NVMATH_CLASS Color32
-{
-public:
- Color32() { }
- Color32(const Color32 & c) : u(c.u) { }
- Color32(uint8 R, uint8 G, uint8 B) { setRGBA(R, G, B, 0xFF); }
- Color32(uint8 R, uint8 G, uint8 B, uint8 A) { setRGBA( R, G, B, A); }
- //Color32(uint8 c[4]) { setRGBA(c[0], c[1], c[2], c[3]); }
- //Color32(float R, float G, float B) { setRGBA(uint(R*255), uint(G*255), uint(B*255), 0xFF); }
- //Color32(float R, float G, float B, float A) { setRGBA(uint(R*255), uint(G*255), uint(B*255), uint(A*255)); }
- explicit Color32(uint32 U) : u(U) { }
-
- void setRGBA(uint8 R, uint8 G, uint8 B, uint8 A)
- {
- r = R;
- g = G;
- b = B;
- a = A;
- }
-
- void setBGRA(uint8 B, uint8 G, uint8 R, uint8 A = 0xFF)
- {
- r = R;
- g = G;
- b = B;
- a = A;
- }
-
- operator uint32 () const {
- return u;
- }
-
- union {
- struct {
-#if NV_LITTLE_ENDIAN
- uint8 b, g, r, a;
-#else
- uint8 a: 8;
- uint8 r: 8;
- uint8 g: 8;
- uint8 b: 8;
-#endif
- };
- uint32 u;
- };
-};
-
-
-/// 16 bit 565 BGR color.
-class NVMATH_CLASS Color16
-{
-public:
- Color16() { }
- Color16(const Color16 & c) : u(c.u) { }
- explicit Color16(uint16 U) : u(U) { }
-
- union {
- struct {
-#if NV_LITTLE_ENDIAN
- uint16 b : 5;
- uint16 g : 6;
- uint16 r : 5;
-#else
- uint16 r : 5;
- uint16 g : 6;
- uint16 b : 5;
-#endif
- };
- uint16 u;
- };
-};
-
-
-/// Clamp color components.
-inline Vector3 colorClamp(Vector3::Arg c)
-{
- return Vector3(clamp(c.x(), 0.0f, 1.0f), clamp(c.y(), 0.0f, 1.0f), clamp(c.z(), 0.0f, 1.0f));
-}
-
-/// Clamp without allowing the hue to change.
-inline Vector3 colorNormalize(Vector3::Arg c)
-{
- float scale = 1.0f;
- if (c.x() > scale) scale = c.x();
- if (c.y() > scale) scale = c.y();
- if (c.z() > scale) scale = c.z();
- return c / scale;
-}
-
-/// Convert Color32 to Color16.
-inline Color16 toColor16(Color32 c)
-{
- Color16 color;
- // rrrrrggggggbbbbb
- // rrrrr000gggggg00bbbbb000
-// color.u = (c.u >> 3) & 0x1F;
-// color.u |= (c.u >> 5) & 0x7E0;
-// color.u |= (c.u >> 8) & 0xF800;
-
- color.r = c.r >> 3;
- color.g = c.g >> 2;
- color.b = c.b >> 3;
- return color;
-}
-
-
-/// Promote 16 bit color to 32 bit using regular bit expansion.
-inline Color32 toColor32(Color16 c)
-{
- Color32 color;
-// c.u = ((col0.u << 3) & 0xf8) | ((col0.u << 5) & 0xfc00) | ((col0.u << 8) & 0xf80000);
-// c.u |= (c.u >> 5) & 0x070007;
-// c.u |= (c.u >> 6) & 0x000300;
-
- color.b = (c.b << 3) | (c.b >> 2);
- color.g = (c.g << 2) | (c.g >> 4);
- color.r = (c.r << 3) | (c.r >> 2);
- color.a = 0xFF;
-
- return color;
-}
-
-inline Vector4 toVector4(Color32 c)
-{
- const float scale = 1.0f / 255.0f;
- return Vector4(c.r * scale, c.g * scale, c.b * scale, c.a * scale);
-}
-
-} // nv namespace
-
-#endif // NV_MATH_COLOR_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Fitting.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Fitting.cpp
deleted file mode 100644
index 11b3ec60..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Fitting.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-// This code is in the public domain -- icastano@gmail.com
-
-#include "Fitting.h"
-
-#include <nvcore/Algorithms.h> // max
-#include <nvcore/Containers.h> // swap
-#include <float.h> // FLT_MAX
-
-using namespace nv;
-
-
-Vector3 nv::ComputeCentroid(int n, const Vector3 * points, const float * weights, Vector3::Arg metric)
-{
- Vector3 centroid(zero);
- float total = 0.0f;
-
- for (int i = 0; i < n; i++)
- {
- total += weights[i];
- centroid += weights[i]*points[i];
- }
- centroid /= total;
-
- return centroid;
-}
-
-
-void nv::ComputeCovariance(int n, const Vector3 * points, const float * weights, Vector3::Arg metric, float * covariance)
-{
- // compute the centroid
- Vector3 centroid = ComputeCentroid(n, points, weights, metric);
-
- // compute covariance matrix
- for (int i = 0; i < 6; i++)
- {
- covariance[i] = 0.0f;
- }
-
- for (int i = 0; i < n; i++)
- {
- Vector3 a = (points[i] - centroid) * metric;
- Vector3 b = weights[i]*a;
-
- covariance[0] += a.x()*b.x();
- covariance[1] += a.x()*b.y();
- covariance[2] += a.x()*b.z();
- covariance[3] += a.y()*b.y();
- covariance[4] += a.y()*b.z();
- covariance[5] += a.z()*b.z();
- }
-}
-
-Vector3 nv::ComputePrincipalComponent(int n, const Vector3 * points, const float * weights, Vector3::Arg metric)
-{
- float matrix[6];
- ComputeCovariance(n, points, weights, metric, matrix);
-
- if (matrix[0] == 0 || matrix[3] == 0 || matrix[5] == 0)
- {
- return Vector3(zero);
- }
-
- const int NUM = 8;
-
- Vector3 v(1, 1, 1);
- for (int i = 0; i < NUM; i++)
- {
- float x = v.x() * matrix[0] + v.y() * matrix[1] + v.z() * matrix[2];
- float y = v.x() * matrix[1] + v.y() * matrix[3] + v.z() * matrix[4];
- float z = v.x() * matrix[2] + v.y() * matrix[4] + v.z() * matrix[5];
-
- float norm = max(max(x, y), z);
-
- v = Vector3(x, y, z) / norm;
- }
-
- return v;
-}
-
-
-
-int nv::Compute4Means(int n, const Vector3 * points, const float * weights, Vector3::Arg metric, Vector3 * cluster)
-{
- Vector3 centroid = ComputeCentroid(n, points, weights, metric);
-
- // Compute principal component.
- Vector3 principal = ComputePrincipalComponent(n, points, weights, metric);
-
- // Pick initial solution.
- int mini, maxi;
- mini = maxi = 0;
-
- float mindps, maxdps;
- mindps = maxdps = dot(points[0] - centroid, principal);
-
- for (int i = 1; i < n; ++i)
- {
- float dps = dot(points[i] - centroid, principal);
-
- if (dps < mindps) {
- mindps = dps;
- mini = i;
- }
- else {
- maxdps = dps;
- maxi = i;
- }
- }
-
- cluster[0] = centroid + mindps * principal;
- cluster[1] = centroid + maxdps * principal;
- cluster[2] = (2 * cluster[0] + cluster[1]) / 3;
- cluster[3] = (2 * cluster[1] + cluster[0]) / 3;
-
- // Now we have to iteratively refine the clusters.
- while (true)
- {
- Vector3 newCluster[4] = { Vector3(zero), Vector3(zero), Vector3(zero), Vector3(zero) };
- float total[4] = {0, 0, 0, 0};
-
- for (int i = 0; i < n; ++i)
- {
- // Find nearest cluster.
- int nearest = 0;
- float mindist = FLT_MAX;
- for (int j = 0; j < 4; j++)
- {
- float dist = length_squared((cluster[j] - points[i]) * metric);
- if (dist < mindist)
- {
- mindist = dist;
- nearest = j;
- }
- }
-
- newCluster[nearest] += weights[i] * points[i];
- total[nearest] += weights[i];
- }
-
- for (int j = 0; j < 4; j++)
- {
- if (total[j] != 0)
- newCluster[j] /= total[j];
- }
-
- if (equal(cluster[0], newCluster[0]) && equal(cluster[1], newCluster[1]) &&
- equal(cluster[2], newCluster[2]) && equal(cluster[3], newCluster[3]))
- {
- return (total[0] != 0) + (total[1] != 0) + (total[2] != 0) + (total[3] != 0);
- }
-
- cluster[0] = newCluster[0];
- cluster[1] = newCluster[1];
- cluster[2] = newCluster[2];
- cluster[3] = newCluster[3];
-
- // Sort clusters by weight.
- for (int i = 0; i < 4; i++)
- {
- for (int j = i; j > 0 && total[j] > total[j - 1]; j--)
- {
- swap( total[j], total[j - 1] );
- swap( cluster[j], cluster[j - 1] );
- }
- }
- }
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Fitting.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Fitting.h
deleted file mode 100644
index b2eeb15b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Fitting.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// This code is in the public domain -- icastano@gmail.com
-
-#ifndef NV_MATH_FITTING_H
-#define NV_MATH_FITTING_H
-
-#include <nvmath/nvmath.h>
-#include <nvmath/Vector.h>
-
-namespace nv
-{
-
- Vector3 ComputeCentroid(int n, const Vector3 * points, const float * weights, Vector3::Arg metric);
- void ComputeCovariance(int n, const Vector3 * points, const float * weights, Vector3::Arg metric, float * covariance);
- Vector3 ComputePrincipalComponent(int n, const Vector3 * points, const float * weights, Vector3::Arg metric);
-
- // Returns number of clusters [1-4].
- int Compute4Means(int n, const Vector3 * points, const float * weights, Vector3::Arg metric, Vector3 * cluster);
-
-} // nv namespace
-
-#endif // NV_MATH_FITTING_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Frustum.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Frustum.cpp
deleted file mode 100644
index 60f6607c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Frustum.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include "Frustum.h"
-#include "Box.h"
-#include "Matrix.h"
-
-namespace nv
-{
- Frustum::Frustum(float fovy, float aspect, float near, float far)
- {
- // Define a frustum looking along the -ve z axis.
- planes[NEAR] = Plane(Vector3(0,0,1), near);
- planes[FAR] = Plane(Vector3(0,0,-1), far);
-
- const Vector3 origin(zero);
- const float tanfy = tan(fovy/2.0f);
- planes[TOP] = Plane(Vector3( 1.0f, 0.0f, tanfy * aspect), origin);
- planes[BOTTOM] = Plane(Vector3(-1.0f, 0.0f, tanfy * aspect), origin);
-
- planes[RIGHT] = Plane(Vector3(0.0f, 1.0f, tanfy), origin);
- planes[LEFT] = Plane(Vector3(0.0f, -1.0f, tanfy), origin);
-
- for(int p = 0; p < Frustum::PLANE_COUNT; ++p)
- planes[p] = normalize(planes[p]);
- }
-
- static void getAllCorners(const Box& boxy, Vector3 c[])
- {
- c[0] = boxy.minCorner();
- c[1] = boxy.maxCorner();
- c[2] = Vector3(c[0].x(), c[1].y(), c[0].z());
- c[3] = Vector3(c[0].x(), c[1].y(), c[1].z());
- c[4] = Vector3(c[0].x(), c[0].y(), c[1].z());
- c[5] = Vector3(c[1].x(), c[1].y(), c[0].z());
- c[6] = Vector3(c[1].x(), c[0].y(), c[0].z());
- c[7] = Vector3(c[1].x(), c[0].y(), c[1].z());
- }
-
- bool Frustum::intersects(const Box& boxy) const
- {
- const int N_CORNERS = 8;
- Vector3 boxCorners[N_CORNERS];
- getAllCorners(boxy, boxCorners);
-
- // test all 8 corners against the 6 sides
- // if all points are behind 1 specific plane, we are out
- // if we are in with all points, then we are fully in
- for(int p = 0; p < Frustum::PLANE_COUNT; ++p)
- {
- int iInCount = N_CORNERS;
-
- for(int i = 0; i < N_CORNERS; ++i)
- {
- // test point [i] against the planes
- if (distance(planes[p], boxCorners[i]) > 0.0f)
- --iInCount;
- }
-
- // were all the points outside of plane p?
- if (iInCount == 0)
- return false;
- }
-
- return true;
- }
-
- Frustum transformFrustum(const Matrix& m, const Frustum& f)
- {
- Frustum result;
-
- for (int i=0; i!=Frustum::PLANE_COUNT; ++i)
- result.planes[i] = transformPlane(m, f.planes[i]);
-
- return result;
- }
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Frustum.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Frustum.h
deleted file mode 100644
index 5a331ad4..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Frustum.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_FRUSTUM_H
-#define NV_MATH_FRUSTUM_H
-
-#include <nvmath/Plane.h>
-
-namespace nv
-{
- class Box;
-
- class NVMATH_CLASS Frustum
- {
- public:
- // Construct a frustum from typical view parameters. fovy has the same meaning as for glut_perspective_reshaper.
- // The resulting frustum is centred at the origin, pointing along the z-axis.
- Frustum() {}
- Frustum(float fovy, float aspect, float near, float far);
-
- // Unlike some intersection methods, we don't bother to distinguish intersects
- // from contains. A true result could indicate either.
- bool intersects(const Box&) const;
-
- private:
- friend Frustum transformFrustum(const Matrix&, const Frustum&);
-
- enum PlaneIndices { NEAR, LEFT, RIGHT, TOP, BOTTOM, FAR, PLANE_COUNT };
- Plane planes[PLANE_COUNT];
- };
-
- Frustum transformFrustum(const Matrix&, const Frustum&);
-}
-
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Half.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Half.cpp
deleted file mode 100644
index da5b013f..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Half.cpp
+++ /dev/null
@@ -1,563 +0,0 @@
-// Branch-free implementation of half-precision (16 bit) floating point
-// Copyright 2006 Mike Acton <macton@gmail.com>
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the "Software"),
-// to deal in the Software without restriction, including without limitation
-// the rights to use, copy, modify, merge, publish, distribute, sublicense,
-// and/or sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE
-//
-// Half-precision floating point format
-// ------------------------------------
-//
-// | Field | Last | First | Note
-// |----------|------|-------|----------
-// | Sign | 15 | 15 |
-// | Exponent | 14 | 10 | Bias = 15
-// | Mantissa | 9 | 0 |
-//
-// Compiling
-// ---------
-//
-// Preferred compile flags for GCC:
-// -O3 -fstrict-aliasing -std=c99 -pedantic -Wall -Wstrict-aliasing
-//
-// This file is a C99 source file, intended to be compiled with a C99
-// compliant compiler. However, for the moment it remains combatible
-// with C++98. Therefore if you are using a compiler that poorly implements
-// C standards (e.g. MSVC), it may be compiled as C++. This is not
-// guaranteed for future versions.
-//
-// Features
-// --------
-//
-// * QNaN + <x> = QNaN
-// * <x> + +INF = +INF
-// * <x> - -INF = -INF
-// * INF - INF = SNaN
-// * Denormalized values
-// * Difference of ZEROs is always +ZERO
-// * Sum round with guard + round + sticky bit (grs)
-// * And of course... no branching
-//
-// Precision of Sum
-// ----------------
-//
-// (SUM) uint16 z = half_add( x, y );
-// (DIFFERENCE) uint16 z = half_add( x, -y );
-//
-// Will have exactly (0 ulps difference) the same result as:
-// (For 32 bit IEEE 784 floating point and same rounding mode)
-//
-// union FLOAT_32
-// {
-// float f32;
-// uint32 u32;
-// };
-//
-// union FLOAT_32 fx = { .u32 = half_to_float( x ) };
-// union FLOAT_32 fy = { .u32 = half_to_float( y ) };
-// union FLOAT_32 fz = { .f32 = fx.f32 + fy.f32 };
-// uint16 z = float_to_half( fz );
-//
-
-#include "Half.h"
-#include <stdio.h>
-
-// Load immediate
-static inline uint32 _uint32_li( uint32 a )
-{
- return (a);
-}
-
-// Decrement
-static inline uint32 _uint32_dec( uint32 a )
-{
- return (a - 1);
-}
-
-// Complement
-static inline uint32 _uint32_not( uint32 a )
-{
- return (~a);
-}
-
-// Negate
-static inline uint32 _uint32_neg( uint32 a )
-{
-#if NV_CC_MSVC
- // prevent msvc warning.
- return ~a + 1;
-#else
- return (-a);
-#endif
-}
-
-// Extend sign
-static inline uint32 _uint32_ext( uint32 a )
-{
- return (((int32)a)>>31);
-}
-
-// And
-static inline uint32 _uint32_and( uint32 a, uint32 b )
-{
- return (a & b);
-}
-
-// And with Complement
-static inline uint32 _uint32_andc( uint32 a, uint32 b )
-{
- return (a & ~b);
-}
-
-// Or
-static inline uint32 _uint32_or( uint32 a, uint32 b )
-{
- return (a | b);
-}
-
-// Shift Right Logical
-static inline uint32 _uint32_srl( uint32 a, int sa )
-{
- return (a >> sa);
-}
-
-// Shift Left Logical
-static inline uint32 _uint32_sll( uint32 a, int sa )
-{
- return (a << sa);
-}
-
-// Add
-static inline uint32 _uint32_add( uint32 a, uint32 b )
-{
- return (a + b);
-}
-
-// Subtract
-static inline uint32 _uint32_sub( uint32 a, uint32 b )
-{
- return (a - b);
-}
-
-// Select on Sign bit
-static inline uint32 _uint32_sels( uint32 test, uint32 a, uint32 b )
-{
- const uint32 mask = _uint32_ext( test );
- const uint32 sel_a = _uint32_and( a, mask );
- const uint32 sel_b = _uint32_andc( b, mask );
- const uint32 result = _uint32_or( sel_a, sel_b );
-
- return (result);
-}
-
-// Load Immediate
-static inline uint16 _uint16_li( uint16 a )
-{
- return (a);
-}
-
-// Extend sign
-static inline uint16 _uint16_ext( uint16 a )
-{
- return (((int16)a)>>15);
-}
-
-// Negate
-static inline uint16 _uint16_neg( uint16 a )
-{
- return (-a);
-}
-
-// Complement
-static inline uint16 _uint16_not( uint16 a )
-{
- return (~a);
-}
-
-// Decrement
-static inline uint16 _uint16_dec( uint16 a )
-{
- return (a - 1);
-}
-
-// Shift Left Logical
-static inline uint16 _uint16_sll( uint16 a, int sa )
-{
- return (a << sa);
-}
-
-// Shift Right Logical
-static inline uint16 _uint16_srl( uint16 a, int sa )
-{
- return (a >> sa);
-}
-
-// Add
-static inline uint16 _uint16_add( uint16 a, uint16 b )
-{
- return (a + b);
-}
-
-// Subtract
-static inline uint16 _uint16_sub( uint16 a, uint16 b )
-{
- return (a - b);
-}
-
-// And
-static inline uint16 _uint16_and( uint16 a, uint16 b )
-{
- return (a & b);
-}
-
-// Or
-static inline uint16 _uint16_or( uint16 a, uint16 b )
-{
- return (a | b);
-}
-
-// Exclusive Or
-static inline uint16 _uint16_xor( uint16 a, uint16 b )
-{
- return (a ^ b);
-}
-
-// And with Complement
-static inline uint16 _uint16_andc( uint16 a, uint16 b )
-{
- return (a & ~b);
-}
-
-// And then Shift Right Logical
-static inline uint16 _uint16_andsrl( uint16 a, uint16 b, int sa )
-{
- return ((a & b) >> sa);
-}
-
-// Shift Right Logical then Mask
-static inline uint16 _uint16_srlm( uint16 a, int sa, uint16 mask )
-{
- return ((a >> sa) & mask);
-}
-
-// Add then Mask
-static inline uint16 _uint16_addm( uint16 a, uint16 b, uint16 mask )
-{
- return ((a + b) & mask);
-}
-
-
-// Select on Sign bit
-static inline uint16 _uint16_sels( uint16 test, uint16 a, uint16 b )
-{
- const uint16 mask = _uint16_ext( test );
- const uint16 sel_a = _uint16_and( a, mask );
- const uint16 sel_b = _uint16_andc( b, mask );
- const uint16 result = _uint16_or( sel_a, sel_b );
-
- return (result);
-}
-
-// Count Leading Zeros
-static inline uint32 _uint32_cntlz( uint32 x )
-{
-#ifdef __GNUC__
- /* On PowerPC, this will map to insn: cntlzw */
- /* On Pentium, this will map to insn: clz */
- uint32 nlz = __builtin_clz( x );
- return (nlz);
-#else
- const uint32 x0 = _uint32_srl( x, 1 );
- const uint32 x1 = _uint32_or( x, x0 );
- const uint32 x2 = _uint32_srl( x1, 2 );
- const uint32 x3 = _uint32_or( x1, x2 );
- const uint32 x4 = _uint32_srl( x3, 4 );
- const uint32 x5 = _uint32_or( x3, x4 );
- const uint32 x6 = _uint32_srl( x5, 8 );
- const uint32 x7 = _uint32_or( x5, x6 );
- const uint32 x8 = _uint32_srl( x7, 16 );
- const uint32 x9 = _uint32_or( x7, x8 );
- const uint32 xA = _uint32_not( x9 );
- const uint32 xB = _uint32_srl( xA, 1 );
- const uint32 xC = _uint32_and( xB, 0x55555555 );
- const uint32 xD = _uint32_sub( xA, xC );
- const uint32 xE = _uint32_and( xD, 0x33333333 );
- const uint32 xF = _uint32_srl( xD, 2 );
- const uint32 x10 = _uint32_and( xF, 0x33333333 );
- const uint32 x11 = _uint32_add( xE, x10 );
- const uint32 x12 = _uint32_srl( x11, 4 );
- const uint32 x13 = _uint32_add( x11, x12 );
- const uint32 x14 = _uint32_and( x13, 0x0f0f0f0f );
- const uint32 x15 = _uint32_srl( x14, 8 );
- const uint32 x16 = _uint32_add( x14, x15 );
- const uint32 x17 = _uint32_srl( x16, 16 );
- const uint32 x18 = _uint32_add( x16, x17 );
- const uint32 x19 = _uint32_and( x18, 0x0000003f );
- return ( x19 );
-#endif
-}
-
-// Count Leading Zeros
-static inline uint16 _uint16_cntlz( uint16 x )
-{
-#ifdef __GNUC__
- /* On PowerPC, this will map to insn: cntlzw */
- /* On Pentium, this will map to insn: clz */
- uint32 x32 = _uint32_sll( x, 16 );
- uint16 nlz = (uint16)__builtin_clz( x32 );
- return (nlz);
-#else
- const uint16 x0 = _uint16_srl( x, 1 );
- const uint16 x1 = _uint16_or( x, x0 );
- const uint16 x2 = _uint16_srl( x1, 2 );
- const uint16 x3 = _uint16_or( x1, x2 );
- const uint16 x4 = _uint16_srl( x3, 4 );
- const uint16 x5 = _uint16_or( x3, x4 );
- const uint16 x6 = _uint16_srl( x5, 8 );
- const uint16 x7 = _uint16_or( x5, x6 );
- const uint16 x8 = _uint16_not( x7 );
- const uint16 x9 = _uint16_srlm( x8, 1, 0x5555 );
- const uint16 xA = _uint16_sub( x8, x9 );
- const uint16 xB = _uint16_and( xA, 0x3333 );
- const uint16 xC = _uint16_srlm( xA, 2, 0x3333 );
- const uint16 xD = _uint16_add( xB, xC );
- const uint16 xE = _uint16_srl( xD, 4 );
- const uint16 xF = _uint16_addm( xD, xE, 0x0f0f );
- const uint16 x10 = _uint16_srl( xF, 8 );
- const uint16 x11 = _uint16_addm( xF, x10, 0x001f );
- return ( x11 );
-#endif
-}
-
-uint16
-half_from_float( uint32 f )
-{
- const uint32 one = _uint32_li( 0x00000001 );
- const uint32 f_e_mask = _uint32_li( 0x7f800000 );
- const uint32 f_m_mask = _uint32_li( 0x007fffff );
- const uint32 f_s_mask = _uint32_li( 0x80000000 );
- const uint32 h_e_mask = _uint32_li( 0x00007c00 );
- const uint32 f_e_pos = _uint32_li( 0x00000017 );
- const uint32 f_m_round_bit = _uint32_li( 0x00001000 );
- const uint32 h_nan_em_min = _uint32_li( 0x00007c01 );
- const uint32 f_h_s_pos_offset = _uint32_li( 0x00000010 );
- const uint32 f_m_hidden_bit = _uint32_li( 0x00800000 );
- const uint32 f_h_m_pos_offset = _uint32_li( 0x0000000d );
- const uint32 f_h_bias_offset = _uint32_li( 0x38000000 );
- const uint32 f_m_snan_mask = _uint32_li( 0x003fffff );
- const uint16 h_snan_mask = _uint32_li( 0x00007e00 );
- const uint32 f_e = _uint32_and( f, f_e_mask );
- const uint32 f_m = _uint32_and( f, f_m_mask );
- const uint32 f_s = _uint32_and( f, f_s_mask );
- const uint32 f_e_h_bias = _uint32_sub( f_e, f_h_bias_offset );
- const uint32 f_e_h_bias_amount = _uint32_srl( f_e_h_bias, f_e_pos );
- const uint32 f_m_round_mask = _uint32_and( f_m, f_m_round_bit );
- const uint32 f_m_round_offset = _uint32_sll( f_m_round_mask, one );
- const uint32 f_m_rounded = _uint32_add( f_m, f_m_round_offset );
- const uint32 f_m_rounded_overflow = _uint32_and( f_m_rounded, f_m_hidden_bit );
- const uint32 f_m_denorm_sa = _uint32_sub( one, f_e_h_bias_amount );
- const uint32 f_m_with_hidden = _uint32_or( f_m_rounded, f_m_hidden_bit );
- const uint32 f_m_denorm = _uint32_srl( f_m_with_hidden, f_m_denorm_sa );
- const uint32 f_em_norm_packed = _uint32_or( f_e_h_bias, f_m_rounded );
- const uint32 f_e_overflow = _uint32_add( f_e_h_bias, f_m_hidden_bit );
- const uint32 h_s = _uint32_srl( f_s, f_h_s_pos_offset );
- const uint32 h_m_nan = _uint32_srl( f_m, f_h_m_pos_offset );
- const uint32 h_m_denorm = _uint32_srl( f_m_denorm, f_h_m_pos_offset );
- const uint32 h_em_norm = _uint32_srl( f_em_norm_packed, f_h_m_pos_offset );
- const uint32 h_em_overflow = _uint32_srl( f_e_overflow, f_h_m_pos_offset );
- const uint32 is_e_eqz_msb = _uint32_dec( f_e );
- const uint32 is_m_nez_msb = _uint32_neg( f_m );
- const uint32 is_h_m_nan_nez_msb = _uint32_neg( h_m_nan );
- const uint32 is_e_nflagged_msb = _uint32_sub( f_e, f_e_mask );
- const uint32 is_ninf_msb = _uint32_or( is_e_nflagged_msb, is_m_nez_msb );
- const uint32 is_underflow_msb = _uint32_sub( is_e_eqz_msb, f_h_bias_offset );
- const uint32 is_nan_nunderflow_msb = _uint32_or( is_h_m_nan_nez_msb, is_e_nflagged_msb );
- const uint32 is_m_snan_msb = _uint32_sub( f_m_snan_mask, f_m );
- const uint32 is_snan_msb = _uint32_andc( is_m_snan_msb, is_e_nflagged_msb );
- const uint32 is_overflow_msb = _uint32_neg( f_m_rounded_overflow );
- const uint32 h_nan_underflow_result = _uint32_sels( is_nan_nunderflow_msb, h_em_norm, h_nan_em_min );
- const uint32 h_inf_result = _uint32_sels( is_ninf_msb, h_nan_underflow_result, h_e_mask );
- const uint32 h_underflow_result = _uint32_sels( is_underflow_msb, h_m_denorm, h_inf_result );
- const uint32 h_overflow_result = _uint32_sels( is_overflow_msb, h_em_overflow, h_underflow_result );
- const uint32 h_em_result = _uint32_sels( is_snan_msb, h_snan_mask, h_overflow_result );
- const uint32 h_result = _uint32_or( h_em_result, h_s );
-
- return (h_result);
-}
-
-uint32
-half_to_float( uint16 h )
-{
- const uint32 h_e_mask = _uint32_li( 0x00007c00 );
- const uint32 h_m_mask = _uint32_li( 0x000003ff );
- const uint32 h_s_mask = _uint32_li( 0x00008000 );
- const uint32 h_f_s_pos_offset = _uint32_li( 0x00000010 );
- const uint32 h_f_e_pos_offset = _uint32_li( 0x0000000d );
- const uint32 h_f_bias_offset = _uint32_li( 0x0001c000 );
- const uint32 f_e_mask = _uint32_li( 0x7f800000 );
- const uint32 f_m_mask = _uint32_li( 0x007fffff );
- const uint32 h_f_e_denorm_bias = _uint32_li( 0x0000007e );
- const uint32 h_f_m_denorm_sa_bias = _uint32_li( 0x00000008 );
- const uint32 f_e_pos = _uint32_li( 0x00000017 );
- const uint32 h_e_mask_minus_one = _uint32_li( 0x00007bff );
- const uint32 h_e = _uint32_and( h, h_e_mask );
- const uint32 h_m = _uint32_and( h, h_m_mask );
- const uint32 h_s = _uint32_and( h, h_s_mask );
- const uint32 h_e_f_bias = _uint32_add( h_e, h_f_bias_offset );
- const uint32 h_m_nlz = _uint32_cntlz( h_m );
- const uint32 f_s = _uint32_sll( h_s, h_f_s_pos_offset );
- const uint32 f_e = _uint32_sll( h_e_f_bias, h_f_e_pos_offset );
- const uint32 f_m = _uint32_sll( h_m, h_f_e_pos_offset );
- const uint32 f_em = _uint32_or( f_e, f_m );
- const uint32 h_f_m_sa = _uint32_sub( h_m_nlz, h_f_m_denorm_sa_bias );
- const uint32 f_e_denorm_unpacked = _uint32_sub( h_f_e_denorm_bias, h_f_m_sa );
- const uint32 h_f_m = _uint32_sll( h_m, h_f_m_sa );
- const uint32 f_m_denorm = _uint32_and( h_f_m, f_m_mask );
- const uint32 f_e_denorm = _uint32_sll( f_e_denorm_unpacked, f_e_pos );
- const uint32 f_em_denorm = _uint32_or( f_e_denorm, f_m_denorm );
- const uint32 f_em_nan = _uint32_or( f_e_mask, f_m );
- const uint32 is_e_eqz_msb = _uint32_dec( h_e );
- const uint32 is_m_nez_msb = _uint32_neg( h_m );
- const uint32 is_e_flagged_msb = _uint32_sub( h_e_mask_minus_one, h_e );
- const uint32 is_zero_msb = _uint32_andc( is_e_eqz_msb, is_m_nez_msb );
- const uint32 is_inf_msb = _uint32_andc( is_e_flagged_msb, is_m_nez_msb );
- const uint32 is_denorm_msb = _uint32_and( is_m_nez_msb, is_e_eqz_msb );
- const uint32 is_nan_msb = _uint32_and( is_e_flagged_msb, is_m_nez_msb );
- const uint32 is_zero = _uint32_ext( is_zero_msb );
- const uint32 f_zero_result = _uint32_andc( f_em, is_zero );
- const uint32 f_denorm_result = _uint32_sels( is_denorm_msb, f_em_denorm, f_zero_result );
- const uint32 f_inf_result = _uint32_sels( is_inf_msb, f_e_mask, f_denorm_result );
- const uint32 f_nan_result = _uint32_sels( is_nan_msb, f_em_nan, f_inf_result );
- const uint32 f_result = _uint32_or( f_s, f_nan_result );
-
- return (f_result);
-}
-
-uint16
-half_add( uint16 x, uint16 y )
-{
- const uint16 one = _uint16_li( 0x0001 );
- const uint16 msb_to_lsb_sa = _uint16_li( 0x000f );
- const uint16 h_s_mask = _uint16_li( 0x8000 );
- const uint16 h_e_mask = _uint16_li( 0x7c00 );
- const uint16 h_m_mask = _uint16_li( 0x03ff );
- const uint16 h_m_msb_mask = _uint16_li( 0x2000 );
- const uint16 h_m_msb_sa = _uint16_li( 0x000d );
- const uint16 h_m_hidden = _uint16_li( 0x0400 );
- const uint16 h_e_pos = _uint16_li( 0x000a );
- const uint16 h_e_bias_minus_one = _uint16_li( 0x000e );
- const uint16 h_m_grs_carry = _uint16_li( 0x4000 );
- const uint16 h_m_grs_carry_pos = _uint16_li( 0x000e );
- const uint16 h_grs_size = _uint16_li( 0x0003 );
- const uint16 h_snan = _uint16_li( 0xfe00 );
- const uint16 h_e_mask_minus_one = _uint16_li( 0x7bff );
- const uint16 h_grs_round_carry = _uint16_sll( one, h_grs_size );
- const uint16 h_grs_round_mask = _uint16_sub( h_grs_round_carry, one );
- const uint16 x_e = _uint16_and( x, h_e_mask );
- const uint16 y_e = _uint16_and( y, h_e_mask );
- const uint16 is_y_e_larger_msb = _uint16_sub( x_e, y_e );
- const uint16 a = _uint16_sels( is_y_e_larger_msb, y, x);
- const uint16 a_s = _uint16_and( a, h_s_mask );
- const uint16 a_e = _uint16_and( a, h_e_mask );
- const uint16 a_m_no_hidden_bit = _uint16_and( a, h_m_mask );
- const uint16 a_em_no_hidden_bit = _uint16_or( a_e, a_m_no_hidden_bit );
- const uint16 b = _uint16_sels( is_y_e_larger_msb, x, y);
- const uint16 b_s = _uint16_and( b, h_s_mask );
- const uint16 b_e = _uint16_and( b, h_e_mask );
- const uint16 b_m_no_hidden_bit = _uint16_and( b, h_m_mask );
- const uint16 b_em_no_hidden_bit = _uint16_or( b_e, b_m_no_hidden_bit );
- const uint16 is_diff_sign_msb = _uint16_xor( a_s, b_s );
- const uint16 is_a_inf_msb = _uint16_sub( h_e_mask_minus_one, a_em_no_hidden_bit );
- const uint16 is_b_inf_msb = _uint16_sub( h_e_mask_minus_one, b_em_no_hidden_bit );
- const uint16 is_undenorm_msb = _uint16_dec( a_e );
- const uint16 is_undenorm = _uint16_ext( is_undenorm_msb );
- const uint16 is_both_inf_msb = _uint16_and( is_a_inf_msb, is_b_inf_msb );
- const uint16 is_invalid_inf_op_msb = _uint16_and( is_both_inf_msb, b_s );
- const uint16 is_a_e_nez_msb = _uint16_neg( a_e );
- const uint16 is_b_e_nez_msb = _uint16_neg( b_e );
- const uint16 is_a_e_nez = _uint16_ext( is_a_e_nez_msb );
- const uint16 is_b_e_nez = _uint16_ext( is_b_e_nez_msb );
- const uint16 a_m_hidden_bit = _uint16_and( is_a_e_nez, h_m_hidden );
- const uint16 b_m_hidden_bit = _uint16_and( is_b_e_nez, h_m_hidden );
- const uint16 a_m_no_grs = _uint16_or( a_m_no_hidden_bit, a_m_hidden_bit );
- const uint16 b_m_no_grs = _uint16_or( b_m_no_hidden_bit, b_m_hidden_bit );
- const uint16 diff_e = _uint16_sub( a_e, b_e );
- const uint16 a_e_unbias = _uint16_sub( a_e, h_e_bias_minus_one );
- const uint16 a_m = _uint16_sll( a_m_no_grs, h_grs_size );
- const uint16 a_e_biased = _uint16_srl( a_e, h_e_pos );
- const uint16 m_sa_unbias = _uint16_srl( a_e_unbias, h_e_pos );
- const uint16 m_sa_default = _uint16_srl( diff_e, h_e_pos );
- const uint16 m_sa_unbias_mask = _uint16_andc( is_a_e_nez_msb, is_b_e_nez_msb );
- const uint16 m_sa = _uint16_sels( m_sa_unbias_mask, m_sa_unbias, m_sa_default );
- const uint16 b_m_no_sticky = _uint16_sll( b_m_no_grs, h_grs_size );
- const uint16 sh_m = _uint16_srl( b_m_no_sticky, m_sa );
- const uint16 sticky_overflow = _uint16_sll( one, m_sa );
- const uint16 sticky_mask = _uint16_dec( sticky_overflow );
- const uint16 sticky_collect = _uint16_and( b_m_no_sticky, sticky_mask );
- const uint16 is_sticky_set_msb = _uint16_neg( sticky_collect );
- const uint16 sticky = _uint16_srl( is_sticky_set_msb, msb_to_lsb_sa);
- const uint16 b_m = _uint16_or( sh_m, sticky );
- const uint16 is_c_m_ab_pos_msb = _uint16_sub( b_m, a_m );
- const uint16 c_inf = _uint16_or( a_s, h_e_mask );
- const uint16 c_m_sum = _uint16_add( a_m, b_m );
- const uint16 c_m_diff_ab = _uint16_sub( a_m, b_m );
- const uint16 c_m_diff_ba = _uint16_sub( b_m, a_m );
- const uint16 c_m_smag_diff = _uint16_sels( is_c_m_ab_pos_msb, c_m_diff_ab, c_m_diff_ba );
- const uint16 c_s_diff = _uint16_sels( is_c_m_ab_pos_msb, a_s, b_s );
- const uint16 c_s = _uint16_sels( is_diff_sign_msb, c_s_diff, a_s );
- const uint16 c_m_smag_diff_nlz = _uint16_cntlz( c_m_smag_diff );
- const uint16 diff_norm_sa = _uint16_sub( c_m_smag_diff_nlz, one );
- const uint16 is_diff_denorm_msb = _uint16_sub( a_e_biased, diff_norm_sa );
- const uint16 is_diff_denorm = _uint16_ext( is_diff_denorm_msb );
- const uint16 is_a_or_b_norm_msb = _uint16_neg( a_e_biased );
- const uint16 diff_denorm_sa = _uint16_dec( a_e_biased );
- const uint16 c_m_diff_denorm = _uint16_sll( c_m_smag_diff, diff_denorm_sa );
- const uint16 c_m_diff_norm = _uint16_sll( c_m_smag_diff, diff_norm_sa );
- const uint16 c_e_diff_norm = _uint16_sub( a_e_biased, diff_norm_sa );
- const uint16 c_m_diff_ab_norm = _uint16_sels( is_diff_denorm_msb, c_m_diff_denorm, c_m_diff_norm );
- const uint16 c_e_diff_ab_norm = _uint16_andc( c_e_diff_norm, is_diff_denorm );
- const uint16 c_m_diff = _uint16_sels( is_a_or_b_norm_msb, c_m_diff_ab_norm, c_m_smag_diff );
- const uint16 c_e_diff = _uint16_sels( is_a_or_b_norm_msb, c_e_diff_ab_norm, a_e_biased );
- const uint16 is_diff_eqz_msb = _uint16_dec( c_m_diff );
- const uint16 is_diff_exactly_zero_msb = _uint16_and( is_diff_sign_msb, is_diff_eqz_msb );
- const uint16 is_diff_exactly_zero = _uint16_ext( is_diff_exactly_zero_msb );
- const uint16 c_m_added = _uint16_sels( is_diff_sign_msb, c_m_diff, c_m_sum );
- const uint16 c_e_added = _uint16_sels( is_diff_sign_msb, c_e_diff, a_e_biased );
- const uint16 c_m_carry = _uint16_and( c_m_added, h_m_grs_carry );
- const uint16 is_c_m_carry_msb = _uint16_neg( c_m_carry );
- const uint16 c_e_hidden_offset = _uint16_andsrl( c_m_added, h_m_grs_carry, h_m_grs_carry_pos );
- const uint16 c_m_sub_hidden = _uint16_srl( c_m_added, one );
- const uint16 c_m_no_hidden = _uint16_sels( is_c_m_carry_msb, c_m_sub_hidden, c_m_added );
- const uint16 c_e_no_hidden = _uint16_add( c_e_added, c_e_hidden_offset );
- const uint16 c_m_no_hidden_msb = _uint16_and( c_m_no_hidden, h_m_msb_mask );
- const uint16 undenorm_m_msb_odd = _uint16_srl( c_m_no_hidden_msb, h_m_msb_sa );
- const uint16 undenorm_fix_e = _uint16_and( is_undenorm, undenorm_m_msb_odd );
- const uint16 c_e_fixed = _uint16_add( c_e_no_hidden, undenorm_fix_e );
- const uint16 c_m_round_amount = _uint16_and( c_m_no_hidden, h_grs_round_mask );
- const uint16 c_m_rounded = _uint16_add( c_m_no_hidden, c_m_round_amount );
- const uint16 c_m_round_overflow = _uint16_andsrl( c_m_rounded, h_m_grs_carry, h_m_grs_carry_pos );
- const uint16 c_e_rounded = _uint16_add( c_e_fixed, c_m_round_overflow );
- const uint16 c_m_no_grs = _uint16_srlm( c_m_rounded, h_grs_size, h_m_mask );
- const uint16 c_e = _uint16_sll( c_e_rounded, h_e_pos );
- const uint16 c_em = _uint16_or( c_e, c_m_no_grs );
- const uint16 c_normal = _uint16_or( c_s, c_em );
- const uint16 c_inf_result = _uint16_sels( is_a_inf_msb, c_inf, c_normal );
- const uint16 c_zero_result = _uint16_andc( c_inf_result, is_diff_exactly_zero );
- const uint16 c_result = _uint16_sels( is_invalid_inf_op_msb, h_snan, c_zero_result );
-
- return (c_result);
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Half.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Half.h
deleted file mode 100644
index 2dfd51ab..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Half.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef NV_MATH_HALF_H
-#define NV_MATH_HALF_H
-
-#include <nvmath/nvmath.h>
-
-uint32 half_to_float( uint16 h );
-uint16 half_from_float( uint32 f );
-
-#endif /* NV_MATH_HALF_H */
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/KahanSum.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/KahanSum.h
deleted file mode 100644
index dac706f0..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/KahanSum.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_KAHANSUM_H
-#define NV_MATH_KAHANSUM_H
-
-#include <nvmath/nvmath.h>
-
-namespace nv
-{
-
- class KahanSum
- {
- public:
- KahanSum() : accum(0.0f), err(0) {};
-
- void add(float f)
- {
- float compensated = f + err;
- float tmp = accum + compensated;
- err = accum - tmp;
- err += compensated;
- accum = tmp;
- }
-
- float sum() const
- {
- return accum;
- }
-
- private:
- float accum;
- float err;
- };
-
-} // nv namespace
-
-
-#endif // NV_MATH_KAHANSUM_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Matrix.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Matrix.h
deleted file mode 100644
index 8a76896c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Matrix.h
+++ /dev/null
@@ -1,1017 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_MATRIX_H
-#define NV_MATH_MATRIX_H
-
-#include <nvmath/nvmath.h>
-#include <nvmath/Vector.h>
-
-namespace nv
-{
-
-// @@ Use scalar defined in Vector.h, but should use a template instead.
-
-/// 4x4 transformation matrix.
-/// -# Matrices are stored in memory in column major order.
-/// -# Points are to be though of as column vectors.
-/// -# Transformation of a point p by a matrix M is: p' = M * p
-class NVMATH_CLASS Matrix
-{
-public:
- typedef Matrix const & Arg;
-
- Matrix();
- Matrix(zero_t);
- Matrix(identity_t);
- Matrix(const Matrix & m);
- Matrix(Vector4::Arg v0, Vector4::Arg v1, Vector4::Arg v2, Vector4::Arg v3);
- Matrix(const scalar m[]); // m is assumed to contain 16 elements
-
- scalar data(uint idx) const;
- scalar & data(uint idx);
- scalar get(uint row, uint col) const;
- scalar operator()(uint row, uint col) const;
- scalar & operator()(uint row, uint col);
- const scalar * ptr() const;
-
- Vector4 row(uint i) const;
- Vector4 column(uint i) const;
-
- void scale(scalar s);
- void scale(Vector3::Arg s);
- void translate(Vector3::Arg t);
- void rotate(scalar theta, scalar v0, scalar v1, scalar v2);
- scalar determinant() const;
-
- void apply(Matrix::Arg m);
-
-private:
- scalar m_data[16];
-};
-
-
-inline Matrix::Matrix()
-{
-}
-
-inline Matrix::Matrix(zero_t)
-{
- for(int i = 0; i < 16; i++) {
- m_data[i] = 0.0f;
- }
-}
-
-inline Matrix::Matrix(identity_t)
-{
- for(int i = 0; i < 4; i++) {
- for(int j = 0; j < 4; j++) {
- m_data[4*j+i] = (i == j) ? 1.0f : 0.0f;
- }
- }
-}
-
-inline Matrix::Matrix(const Matrix & m)
-{
- for(int i = 0; i < 16; i++) {
- m_data[i] = m.m_data[i];
- }
-}
-
-inline Matrix::Matrix(Vector4::Arg v0, Vector4::Arg v1, Vector4::Arg v2, Vector4::Arg v3)
-{
- m_data[ 0] = v0.x(); m_data[ 1] = v0.y(); m_data[ 2] = v0.z(); m_data[ 3] = v0.w();
- m_data[ 4] = v1.x(); m_data[ 5] = v1.y(); m_data[ 6] = v1.z(); m_data[ 7] = v1.w();
- m_data[ 8] = v2.x(); m_data[ 9] = v2.y(); m_data[10] = v2.z(); m_data[11] = v2.w();
- m_data[12] = v3.x(); m_data[13] = v3.y(); m_data[14] = v3.z(); m_data[15] = v3.w();
-}
-
-inline Matrix::Matrix(const scalar m[])
-{
- for(int i = 0; i < 16; i++) {
- m_data[i] = m[i];
- }
-}
-
-
-// Accessors
-inline scalar Matrix::data(uint idx) const
-{
- nvDebugCheck(idx < 16);
- return m_data[idx];
-}
-inline scalar & Matrix::data(uint idx)
-{
- nvDebugCheck(idx < 16);
- return m_data[idx];
-}
-inline scalar Matrix::get(uint row, uint col) const
-{
- nvDebugCheck(row < 4 && col < 4);
- return m_data[col * 4 + row];
-}
-inline scalar Matrix::operator()(uint row, uint col) const
-{
- nvDebugCheck(row < 4 && col < 4);
- return m_data[col * 4 + row];
-}
-inline scalar & Matrix::operator()(uint row, uint col)
-{
- nvDebugCheck(row < 4 && col < 4);
- return m_data[col * 4 + row];
-}
-
-inline const scalar * Matrix::ptr() const
-{
- return m_data;
-}
-
-inline Vector4 Matrix::row(uint i) const
-{
- nvDebugCheck(i < 4);
- return Vector4(get(i, 0), get(i, 1), get(i, 2), get(i, 3));
-}
-
-inline Vector4 Matrix::column(uint i) const
-{
- nvDebugCheck(i < 4);
- return Vector4(get(0, i), get(1, i), get(2, i), get(3, i));
-}
-
-/// Apply scale.
-inline void Matrix::scale(scalar s)
-{
- m_data[0] *= s; m_data[1] *= s; m_data[2] *= s; m_data[3] *= s;
- m_data[4] *= s; m_data[5] *= s; m_data[6] *= s; m_data[7] *= s;
- m_data[8] *= s; m_data[9] *= s; m_data[10] *= s; m_data[11] *= s;
- m_data[12] *= s; m_data[13] *= s; m_data[14] *= s; m_data[15] *= s;
-}
-
-/// Apply scale.
-inline void Matrix::scale(Vector3::Arg s)
-{
- m_data[0] *= s.x(); m_data[1] *= s.x(); m_data[2] *= s.x(); m_data[3] *= s.x();
- m_data[4] *= s.y(); m_data[5] *= s.y(); m_data[6] *= s.y(); m_data[7] *= s.y();
- m_data[8] *= s.z(); m_data[9] *= s.z(); m_data[10] *= s.z(); m_data[11] *= s.z();
-}
-
-/// Apply translation.
-inline void Matrix::translate(Vector3::Arg t)
-{
- m_data[12] = m_data[0] * t.x() + m_data[4] * t.y() + m_data[8] * t.z() + m_data[12];
- m_data[13] = m_data[1] * t.x() + m_data[5] * t.y() + m_data[9] * t.z() + m_data[13];
- m_data[14] = m_data[2] * t.x() + m_data[6] * t.y() + m_data[10] * t.z() + m_data[14];
- m_data[15] = m_data[3] * t.x() + m_data[7] * t.y() + m_data[11] * t.z() + m_data[15];
-}
-
-Matrix rotation(scalar theta, scalar v0, scalar v1, scalar v2);
-
-/// Apply rotation.
-inline void Matrix::rotate(scalar theta, scalar v0, scalar v1, scalar v2)
-{
- Matrix R(rotation(theta, v0, v1, v2));
- apply(R);
-}
-
-/// Apply transform.
-inline void Matrix::apply(Matrix::Arg m)
-{
- nvDebugCheck(this != &m);
-
- for(int i = 0; i < 4; i++) {
- const scalar ai0 = get(i,0), ai1 = get(i,1), ai2 = get(i,2), ai3 = get(i,3);
- m_data[0 + i] = ai0 * m(0,0) + ai1 * m(1,0) + ai2 * m(2,0) + ai3 * m(3,0);
- m_data[4 + i] = ai0 * m(0,1) + ai1 * m(1,1) + ai2 * m(2,1) + ai3 * m(3,1);
- m_data[8 + i] = ai0 * m(0,2) + ai1 * m(1,2) + ai2 * m(2,2) + ai3 * m(3,2);
- m_data[12+ i] = ai0 * m(0,3) + ai1 * m(1,3) + ai2 * m(2,3) + ai3 * m(3,3);
- }
-}
-
-/// Get scale matrix.
-inline Matrix scale(Vector3::Arg s)
-{
- Matrix m(identity);
- m(0,0) = s.x();
- m(1,1) = s.y();
- m(2,2) = s.z();
- return m;
-}
-
-/// Get scale matrix.
-inline Matrix scale(scalar s)
-{
- Matrix m(identity);
- m(0,0) = m(1,1) = m(2,2) = s;
- return m;
-}
-
-/// Get translation matrix.
-inline Matrix translation(Vector3::Arg t)
-{
- Matrix m(identity);
- m(0,3) = t.x();
- m(1,3) = t.y();
- m(2,3) = t.z();
- return m;
-}
-
-/// Get rotation matrix.
-inline Matrix rotation(scalar theta, scalar v0, scalar v1, scalar v2)
-{
- scalar cost = cosf(theta);
- scalar sint = sinf(theta);
-
- Matrix m(identity);
-
- if( 1 == v0 && 0 == v1 && 0 == v2 ) {
- m(1,1) = cost; m(2,1) = -sint;
- m(1,2) = sint; m(2,2) = cost;
- }
- else if( 0 == v0 && 1 == v1 && 0 == v2 ) {
- m(0,0) = cost; m(2,0) = sint;
- m(1,2) = -sint; m(2,2) = cost;
- }
- else if( 0 == v0 && 0 == v1 && 1 == v2 ) {
- m(0,0) = cost; m(1,0) = -sint;
- m(0,1) = sint; m(1,1) = cost;
- }
- else {
- scalar a2, b2, c2;
- a2 = v0 * v0;
- b2 = v1 * v1;
- c2 = v2 * v2;
-
- scalar iscale = 1.0f / sqrtf(a2 + b2 + c2);
- v0 *= iscale;
- v1 *= iscale;
- v2 *= iscale;
-
- scalar abm, acm, bcm;
- scalar mcos, asin, bsin, csin;
- mcos = 1.0f - cost;
- abm = v0 * v1 * mcos;
- acm = v0 * v2 * mcos;
- bcm = v1 * v2 * mcos;
- asin = v0 * sint;
- bsin = v1 * sint;
- csin = v2 * sint;
- m(0,0) = a2 * mcos + cost;
- m(1,0) = abm - csin;
- m(2,0) = acm + bsin;
- m(3,0) = abm + csin;
- m(1,1) = b2 * mcos + cost;
- m(2,1) = bcm - asin;
- m(3,1) = acm - bsin;
- m(1,2) = bcm + asin;
- m(2,2) = c2 * mcos + cost;
- }
- return m;
-}
-
-//Matrix rotation(scalar yaw, scalar pitch, scalar roll);
-//Matrix skew(scalar angle, Vector3::Arg v1, Vector3::Arg v2);
-
-/// Get frustum matrix.
-inline Matrix frustum(scalar xmin, scalar xmax, scalar ymin, scalar ymax, scalar zNear, scalar zFar)
-{
- Matrix m(zero);
-
- scalar doubleznear = 2.0f * zNear;
- scalar one_deltax = 1.0f / (xmax - xmin);
- scalar one_deltay = 1.0f / (ymax - ymin);
- scalar one_deltaz = 1.0f / (zFar - zNear);
-
- m(0,0) = doubleznear * one_deltax;
- m(1,1) = doubleznear * one_deltay;
- m(0,2) = (xmax + xmin) * one_deltax;
- m(1,2) = (ymax + ymin) * one_deltay;
- m(2,2) = -(zFar + zNear) * one_deltaz;
- m(3,2) = -1.0f;
- m(2,3) = -(zFar * doubleznear) * one_deltaz;
-
- return m;
-}
-
-/// Get infinite frustum matrix.
-inline Matrix frustum(scalar xmin, scalar xmax, scalar ymin, scalar ymax, scalar zNear)
-{
- Matrix m(zero);
-
- scalar doubleznear = 2.0f * zNear;
- scalar one_deltax = 1.0f / (xmax - xmin);
- scalar one_deltay = 1.0f / (ymax - ymin);
- scalar nudge = 1.0; // 0.999;
-
- m(0,0) = doubleznear * one_deltax;
- m(1,1) = doubleznear * one_deltay;
- m(0,2) = (xmax + xmin) * one_deltax;
- m(1,2) = (ymax + ymin) * one_deltay;
- m(2,2) = -1.0f * nudge;
- m(3,2) = -1.0f;
- m(2,3) = -doubleznear * nudge;
-
- return m;
-}
-
-/// Get perspective matrix.
-inline Matrix perspective(scalar fovy, scalar aspect, scalar zNear, scalar zFar)
-{
- scalar xmax = zNear * tan(fovy / 2);
- scalar xmin = -xmax;
-
- scalar ymax = xmax / aspect;
- scalar ymin = -ymax;
-
- return frustum(xmin, xmax, ymin, ymax, zNear, zFar);
-}
-
-/// Get infinite perspective matrix.
-inline Matrix perspective(scalar fovy, scalar aspect, scalar zNear)
-{
- scalar x = zNear * tan(fovy / 2);
- scalar y = x / aspect;
- return frustum( -x, x, -y, y, zNear );
-}
-
-/// Get matrix determinant.
-inline scalar Matrix::determinant() const
-{
- return
- m_data[3] * m_data[6] * m_data[ 9] * m_data[12] - m_data[2] * m_data[7] * m_data[ 9] * m_data[12] - m_data[3] * m_data[5] * m_data[10] * m_data[12] + m_data[1] * m_data[7] * m_data[10] * m_data[12] +
- m_data[2] * m_data[5] * m_data[11] * m_data[12] - m_data[1] * m_data[6] * m_data[11] * m_data[12] - m_data[3] * m_data[6] * m_data[ 8] * m_data[13] + m_data[2] * m_data[7] * m_data[ 8] * m_data[13] +
- m_data[3] * m_data[4] * m_data[10] * m_data[13] - m_data[0] * m_data[7] * m_data[10] * m_data[13] - m_data[2] * m_data[4] * m_data[11] * m_data[13] + m_data[0] * m_data[6] * m_data[11] * m_data[13] +
- m_data[3] * m_data[5] * m_data[ 8] * m_data[14] - m_data[1] * m_data[7] * m_data[ 8] * m_data[14] - m_data[3] * m_data[4] * m_data[ 9] * m_data[14] + m_data[0] * m_data[7] * m_data[ 9] * m_data[14] +
- m_data[1] * m_data[4] * m_data[11] * m_data[14] - m_data[0] * m_data[5] * m_data[11] * m_data[14] - m_data[2] * m_data[5] * m_data[ 8] * m_data[15] + m_data[1] * m_data[6] * m_data[ 8] * m_data[15] +
- m_data[2] * m_data[4] * m_data[ 9] * m_data[15] - m_data[0] * m_data[6] * m_data[ 9] * m_data[15] - m_data[1] * m_data[4] * m_data[10] * m_data[15] + m_data[0] * m_data[5] * m_data[10] * m_data[15];
-}
-
-inline Matrix transpose(Matrix::Arg m)
-{
- Matrix r;
- for (int i = 0; i < 4; i++)
- {
- for (int j = 0; j < 4; j++)
- {
- r(i, j) = m(j, i);
- }
- }
- return r;
-}
-
-inline Matrix inverse(Matrix::Arg m)
-{
- Matrix r;
- r.data( 0) = m.data(6)*m.data(11)*m.data(13) - m.data(7)*m.data(10)*m.data(13) + m.data(7)*m.data(9)*m.data(14) - m.data(5)*m.data(11)*m.data(14) - m.data(6)*m.data(9)*m.data(15) + m.data(5)*m.data(10)*m.data(15);
- r.data( 1) = m.data(3)*m.data(10)*m.data(13) - m.data(2)*m.data(11)*m.data(13) - m.data(3)*m.data(9)*m.data(14) + m.data(1)*m.data(11)*m.data(14) + m.data(2)*m.data(9)*m.data(15) - m.data(1)*m.data(10)*m.data(15);
- r.data( 2) = m.data(2)*m.data( 7)*m.data(13) - m.data(3)*m.data( 6)*m.data(13) + m.data(3)*m.data(5)*m.data(14) - m.data(1)*m.data( 7)*m.data(14) - m.data(2)*m.data(5)*m.data(15) + m.data(1)*m.data( 6)*m.data(15);
- r.data( 3) = m.data(3)*m.data( 6)*m.data( 9) - m.data(2)*m.data( 7)*m.data( 9) - m.data(3)*m.data(5)*m.data(10) + m.data(1)*m.data( 7)*m.data(10) + m.data(2)*m.data(5)*m.data(11) - m.data(1)*m.data( 6)*m.data(11);
- r.data( 4) = m.data(7)*m.data(10)*m.data(12) - m.data(6)*m.data(11)*m.data(12) - m.data(7)*m.data(8)*m.data(14) + m.data(4)*m.data(11)*m.data(14) + m.data(6)*m.data(8)*m.data(15) - m.data(4)*m.data(10)*m.data(15);
- r.data( 5) = m.data(2)*m.data(11)*m.data(12) - m.data(3)*m.data(10)*m.data(12) + m.data(3)*m.data(8)*m.data(14) - m.data(0)*m.data(11)*m.data(14) - m.data(2)*m.data(8)*m.data(15) + m.data(0)*m.data(10)*m.data(15);
- r.data( 6) = m.data(3)*m.data( 6)*m.data(12) - m.data(2)*m.data( 7)*m.data(12) - m.data(3)*m.data(4)*m.data(14) + m.data(0)*m.data( 7)*m.data(14) + m.data(2)*m.data(4)*m.data(15) - m.data(0)*m.data( 6)*m.data(15);
- r.data( 7) = m.data(2)*m.data( 7)*m.data( 8) - m.data(3)*m.data( 6)*m.data( 8) + m.data(3)*m.data(4)*m.data(10) - m.data(0)*m.data( 7)*m.data(10) - m.data(2)*m.data(4)*m.data(11) + m.data(0)*m.data( 6)*m.data(11);
- r.data( 8) = m.data(5)*m.data(11)*m.data(12) - m.data(7)*m.data( 9)*m.data(12) + m.data(7)*m.data(8)*m.data(13) - m.data(4)*m.data(11)*m.data(13) - m.data(5)*m.data(8)*m.data(15) + m.data(4)*m.data( 9)*m.data(15);
- r.data( 9) = m.data(3)*m.data( 9)*m.data(12) - m.data(1)*m.data(11)*m.data(12) - m.data(3)*m.data(8)*m.data(13) + m.data(0)*m.data(11)*m.data(13) + m.data(1)*m.data(8)*m.data(15) - m.data(0)*m.data( 9)*m.data(15);
- r.data(10) = m.data(1)*m.data( 7)*m.data(12) - m.data(3)*m.data( 5)*m.data(12) + m.data(3)*m.data(4)*m.data(13) - m.data(0)*m.data( 7)*m.data(13) - m.data(1)*m.data(4)*m.data(15) + m.data(0)*m.data( 5)*m.data(15);
- r.data(11) = m.data(3)*m.data( 5)*m.data( 8) - m.data(1)*m.data( 7)*m.data( 8) - m.data(3)*m.data(4)*m.data( 9) + m.data(0)*m.data( 7)*m.data( 9) + m.data(1)*m.data(4)*m.data(11) - m.data(0)*m.data( 5)*m.data(11);
- r.data(12) = m.data(6)*m.data( 9)*m.data(12) - m.data(5)*m.data(10)*m.data(12) - m.data(6)*m.data(8)*m.data(13) + m.data(4)*m.data(10)*m.data(13) + m.data(5)*m.data(8)*m.data(14) - m.data(4)*m.data( 9)*m.data(14);
- r.data(13) = m.data(1)*m.data(10)*m.data(12) - m.data(2)*m.data( 9)*m.data(12) + m.data(2)*m.data(8)*m.data(13) - m.data(0)*m.data(10)*m.data(13) - m.data(1)*m.data(8)*m.data(14) + m.data(0)*m.data( 9)*m.data(14);
- r.data(14) = m.data(2)*m.data( 5)*m.data(12) - m.data(1)*m.data( 6)*m.data(12) - m.data(2)*m.data(4)*m.data(13) + m.data(0)*m.data( 6)*m.data(13) + m.data(1)*m.data(4)*m.data(14) - m.data(0)*m.data( 5)*m.data(14);
- r.data(15) = m.data(1)*m.data( 6)*m.data( 8) - m.data(2)*m.data( 5)*m.data( 8) + m.data(2)*m.data(4)*m.data( 9) - m.data(0)*m.data( 6)*m.data( 9) - m.data(1)*m.data(4)*m.data(10) + m.data(0)*m.data( 5)*m.data(10);
- r.scale(1.0f / m.determinant());
- return r;
-}
-
-inline Matrix isometryInverse(Matrix::Arg m)
-{
- Matrix r(identity);
-
- // transposed 3x3 upper left matrix
- for (int i = 0; i < 3; i++)
- {
- for (int j = 0; j < 3; j++)
- {
- r(i, j) = m(j, i);
- }
- }
-
- // translate by the negative offsets
- r.translate(-Vector3(m.data(12), m.data(13), m.data(14)));
-
- return r;
-}
-
-//Matrix affineInverse(Matrix::Arg m);
-
-/// Transform the given 3d point with the given matrix.
-inline Vector3 transformPoint(Matrix::Arg m, Vector3::Arg p)
-{
- return Vector3(
- p.x() * m(0,0) + p.y() * m(0,1) + p.z() * m(0,2) + m(0,3),
- p.x() * m(1,0) + p.y() * m(1,1) + p.z() * m(1,2) + m(1,3),
- p.x() * m(2,0) + p.y() * m(2,1) + p.z() * m(2,2) + m(2,3));
-}
-
-/// Transform the given 3d vector with the given matrix.
-inline Vector3 transformVector(Matrix::Arg m, Vector3::Arg p)
-{
- return Vector3(
- p.x() * m(0,0) + p.y() * m(0,1) + p.z() * m(0,2),
- p.x() * m(1,0) + p.y() * m(1,1) + p.z() * m(1,2),
- p.x() * m(2,0) + p.y() * m(2,1) + p.z() * m(2,2));
-}
-
-/// Transform the given 4d vector with the given matrix.
-inline Vector4 transform(Matrix::Arg m, Vector4::Arg p)
-{
- return Vector4(
- p.x() * m(0,0) + p.y() * m(0,1) + p.z() * m(0,2) + p.w() * m(0,3),
- p.x() * m(1,0) + p.y() * m(1,1) + p.z() * m(1,2) + p.w() * m(1,3),
- p.x() * m(2,0) + p.y() * m(2,1) + p.z() * m(2,2) + p.w() * m(2,3),
- p.x() * m(3,0) + p.y() * m(3,1) + p.z() * m(3,2) + p.w() * m(3,3));
-}
-
-inline Matrix mul(Matrix::Arg a, Matrix::Arg b)
-{
- // @@ Is this the right order? mul(a, b) = b * a
- Matrix m = a;
- m.apply(b);
- return m;
-}
-
-} // nv namespace
-
-
-
-
-#if 0
- /** @name Special matrices. */
- //@{
- /** Generate a translation matrix. */
- void TranslationMatrix(const Vec3 & v) {
- data[0] = 1; data[1] = 0; data[2] = 0; data[3] = 0;
- data[4] = 0; data[5] = 1; data[6] = 0; data[7] = 0;
- data[8] = 0; data[9] = 0; data[10] = 1; data[11] = 0;
- data[12] = v.x; data[13] = v.y; data[14] = v.z; data[15] = 1;
- }
-
- /** Rotate theta degrees around v. */
- void RotationMatrix( scalar theta, scalar v0, scalar v1, scalar v2 ) {
- scalar cost = cos(theta);
- scalar sint = sin(theta);
-
- if( 1 == v0 && 0 == v1 && 0 == v2 ) {
- data[0] = 1.0f; data[1] = 0.0f; data[2] = 0.0f; data[3] = 0.0f;
- data[4] = 0.0f; data[5] = cost; data[6] = -sint;data[7] = 0.0f;
- data[8] = 0.0f; data[9] = sint; data[10] = cost;data[11] = 0.0f;
- data[12] = 0.0f;data[13] = 0.0f;data[14] = 0.0f;data[15] = 1.0f;
- }
- else if( 0 == v0 && 1 == v1 && 0 == v2 ) {
- data[0] = cost; data[1] = 0.0f; data[2] = sint; data[3] = 0.0f;
- data[4] = 0.0f; data[5] = 1.0f; data[6] = 0.0f; data[7] = 0.0f;
- data[8] = -sint;data[9] = 0.0f;data[10] = cost; data[11] = 0.0f;
- data[12] = 0.0f;data[13] = 0.0f;data[14] = 0.0f;data[15] = 1.0f;
- }
- else if( 0 == v0 && 0 == v1 && 1 == v2 ) {
- data[0] = cost; data[1] = -sint;data[2] = 0.0f; data[3] = 0.0f;
- data[4] = sint; data[5] = cost; data[6] = 0.0f; data[7] = 0.0f;
- data[8] = 0.0f; data[9] = 0.0f; data[10] = 1.0f;data[11] = 0.0f;
- data[12] = 0.0f;data[13] = 0.0f;data[14] = 0.0f;data[15] = 1.0f;
- }
- else {
- //we need scale a,b,c to unit length.
- scalar a2, b2, c2;
- a2 = v0 * v0;
- b2 = v1 * v1;
- c2 = v2 * v2;
-
- scalar iscale = 1.0f / sqrtf(a2 + b2 + c2);
- v0 *= iscale;
- v1 *= iscale;
- v2 *= iscale;
-
- scalar abm, acm, bcm;
- scalar mcos, asin, bsin, csin;
- mcos = 1.0f - cost;
- abm = v0 * v1 * mcos;
- acm = v0 * v2 * mcos;
- bcm = v1 * v2 * mcos;
- asin = v0 * sint;
- bsin = v1 * sint;
- csin = v2 * sint;
- data[0] = a2 * mcos + cost;
- data[1] = abm - csin;
- data[2] = acm + bsin;
- data[3] = abm + csin;
- data[4] = 0.0f;
- data[5] = b2 * mcos + cost;
- data[6] = bcm - asin;
- data[7] = acm - bsin;
- data[8] = 0.0f;
- data[9] = bcm + asin;
- data[10] = c2 * mcos + cost;
- data[11] = 0.0f;
- data[12] = 0.0f;
- data[13] = 0.0f;
- data[14] = 0.0f;
- data[15] = 1.0f;
- }
- }
-
- /*
- void SkewMatrix(scalar angle, const Vec3 & v1, const Vec3 & v2) {
- v1.Normalize();
- v2.Normalize();
-
- Vec3 v3;
- v3.Cross(v1, v2);
- v3.Normalize();
-
- // Get skew factor.
- scalar costheta = Vec3DotProduct(v1, v2);
- scalar sintheta = Real.Sqrt(1 - costheta * costheta);
- scalar skew = tan(Trig.DegreesToRadians(angle) + acos(sintheta)) * sintheta - costheta;
-
- // Build orthonormal matrix.
- v1 = FXVector3.Cross(v3, v2);
- v1.Normalize();
-
- Matrix R = Matrix::Identity;
- R[0, 0] = v3.X; // Not sure this is in the correct order...
- R[1, 0] = v3.Y;
- R[2, 0] = v3.Z;
- R[0, 1] = v1.X;
- R[1, 1] = v1.Y;
- R[2, 1] = v1.Z;
- R[0, 2] = v2.X;
- R[1, 2] = v2.Y;
- R[2, 2] = v2.Z;
-
- // Build skew matrix.
- Matrix S = Matrix::Identity;
- S[2, 1] = -skew;
-
- // Return skew transform.
- return R * S * R.Transpose; // Not sure this is in the correct order...
- }
- */
-
- /**
- * Generate rotation matrix for the euler angles. This is the same as computing
- * 3 rotation matrices and multiplying them together in our custom order.
- *
- * @todo Have to recompute this code for our new convention.
- **/
- void RotationMatrix( scalar yaw, scalar pitch, scalar roll ) {
- scalar sy = sin(yaw+ToRadian(90));
- scalar cy = cos(yaw+ToRadian(90));
- scalar sp = sin(pitch-ToRadian(90));
- scalar cp = cos(pitch-ToRadian(90));
- scalar sr = sin(roll);
- scalar cr = cos(roll);
-
- data[0] = cr*cy + sr*sp*sy;
- data[1] = cp*sy;
- data[2] = -sr*cy + cr*sp*sy;
- data[3] = 0;
-
- data[4] = -cr*sy + sr*sp*cy;
- data[5] = cp*cy;
- data[6] = sr*sy + cr*sp*cy;
- data[7] = 0;
-
- data[8] = sr*cp;
- data[9] = -sp;
- data[10] = cr*cp;
- data[11] = 0;
-
- data[12] = 0;
- data[13] = 0;
- data[14] = 0;
- data[15] = 1;
- }
-
- /** Create a frustum matrix with the far plane at the infinity. */
- void Frustum( scalar xmin, scalar xmax, scalar ymin, scalar ymax, scalar zNear, scalar zFar ) {
- scalar one_deltax, one_deltay, one_deltaz, doubleznear;
-
- doubleznear = 2.0f * zNear;
- one_deltax = 1.0f / (xmax - xmin);
- one_deltay = 1.0f / (ymax - ymin);
- one_deltaz = 1.0f / (zFar - zNear);
-
- data[0] = (scalar)(doubleznear * one_deltax);
- data[1] = 0.0f;
- data[2] = 0.0f;
- data[3] = 0.0f;
- data[4] = 0.0f;
- data[5] = (scalar)(doubleznear * one_deltay);
- data[6] = 0.f;
- data[7] = 0.f;
- data[8] = (scalar)((xmax + xmin) * one_deltax);
- data[9] = (scalar)((ymax + ymin) * one_deltay);
- data[10] = (scalar)(-(zFar + zNear) * one_deltaz);
- data[11] = -1.f;
- data[12] = 0.f;
- data[13] = 0.f;
- data[14] = (scalar)(-(zFar * doubleznear) * one_deltaz);
- data[15] = 0.f;
- }
-
- /** Create a frustum matrix with the far plane at the infinity. */
- void FrustumInf( scalar xmin, scalar xmax, scalar ymin, scalar ymax, scalar zNear ) {
- scalar one_deltax, one_deltay, doubleznear, nudge;
-
- doubleznear = 2.0f * zNear;
- one_deltax = 1.0f / (xmax - xmin);
- one_deltay = 1.0f / (ymax - ymin);
- nudge = 1.0; // 0.999;
-
- data[0] = doubleznear * one_deltax;
- data[1] = 0.0f;
- data[2] = 0.0f;
- data[3] = 0.0f;
-
- data[4] = 0.0f;
- data[5] = doubleznear * one_deltay;
- data[6] = 0.f;
- data[7] = 0.f;
-
- data[8] = (xmax + xmin) * one_deltax;
- data[9] = (ymax + ymin) * one_deltay;
- data[10] = -1.0f * nudge;
- data[11] = -1.0f;
-
- data[12] = 0.f;
- data[13] = 0.f;
- data[14] = -doubleznear * nudge;
- data[15] = 0.f;
- }
-
- /** Create an inverse frustum matrix with the far plane at the infinity. */
- void FrustumInfInv( scalar left, scalar right, scalar bottom, scalar top, scalar zNear ) {
- // this matrix is wrong (not tested scalarly) I think it should be transposed.
- data[0] = (right - left) / (2 * zNear);
- data[1] = 0;
- data[2] = 0;
- data[3] = (right + left) / (2 * zNear);
- data[4] = 0;
- data[5] = (top - bottom) / (2 * zNear);
- data[6] = 0;
- data[7] = (top + bottom) / (2 * zNear);
- data[8] = 0;
- data[9] = 0;
- data[10] = 0;
- data[11] = -1;
- data[12] = 0;
- data[13] = 0;
- data[14] = -1 / (2 * zNear);
- data[15] = 1 / (2 * zNear);
- }
-
- /** Create an homogeneous projection matrix. */
- void Perspective( scalar fov, scalar aspect, scalar zNear, scalar zFar ) {
- scalar xmin, xmax, ymin, ymax;
-
- xmax = zNear * tan( fov/2 );
- xmin = -xmax;
-
- ymax = xmax / aspect;
- ymin = -ymax;
-
- Frustum(xmin, xmax, ymin, ymax, zNear, zFar);
- }
-
- /** Create a projection matrix with the far plane at the infinity. */
- void PerspectiveInf( scalar fov, scalar aspect, scalar zNear ) {
- scalar x = zNear * tan( fov/2 );
- scalar y = x / aspect;
- FrustumInf( -x, x, -y, y, zNear );
- }
-
- /** Create an inverse projection matrix with far plane at the infinity. */
- void PerspectiveInfInv( scalar fov, scalar aspect, scalar zNear ) {
- scalar x = zNear * tan( fov/2 );
- scalar y = x / aspect;
- FrustumInfInv( -x, x, -y, y, zNear );
- }
-
- /** Build bone matrix from quatertion and offset. */
- void BoneMatrix(const Quat & q, const Vec3 & offset) {
- scalar x2, y2, z2, xx, xy, xz, yy, yz, zz, wx, wy, wz;
-
- // calculate coefficients
- x2 = q.x + q.x;
- y2 = q.y + q.y;
- z2 = q.z + q.z;
-
- xx = q.x * x2; xy = q.x * y2; xz = q.x * z2;
- yy = q.y * y2; yz = q.y * z2; zz = q.z * z2;
- wx = q.w * x2; wy = q.w * y2; wz = q.w * z2;
-
- data[0] = 1.0f - (yy + zz);
- data[1] = xy - wz;
- data[2] = xz + wy;
- data[3] = 0.0f;
-
- data[4] = xy + wz;
- data[5] = 1.0f - (xx + zz);
- data[6] = yz - wx;
- data[7] = 0.0f;
-
- data[8] = xz - wy;
- data[9] = yz + wx;
- data[10] = 1.0f - (xx + yy);
- data[11] = 0.0f;
-
- data[12] = offset.x;
- data[13] = offset.y;
- data[14] = offset.z;
- data[15] = 1.0f;
- }
-
- //@}
-
-
- /** @name Transformations: */
- //@{
-
- /** Apply a general scale. */
- void Scale( scalar x, scalar y, scalar z ) {
- data[0] *= x; data[4] *= y; data[8] *= z;
- data[1] *= x; data[5] *= y; data[9] *= z;
- data[2] *= x; data[6] *= y; data[10] *= z;
- data[3] *= x; data[7] *= y; data[11] *= z;
- }
-
- /** Apply a rotation of theta degrees around the axis v*/
- void Rotate( scalar theta, const Vec3 & v ) {
- Matrix b;
- b.RotationMatrix( theta, v[0], v[1], v[2] );
- Multiply4x3( b );
- }
-
- /** Apply a rotation of theta degrees around the axis v*/
- void Rotate( scalar theta, scalar v0, scalar v1, scalar v2 ) {
- Matrix b;
- b.RotationMatrix( theta, v0, v1, v2 );
- Multiply4x3( b );
- }
-
- /**
- * Translate the matrix by t. This is the same as multiplying by a
- * translation matrix with the given offset.
- * this = T * this
- */
- void Translate( const Vec3 &t ) {
- data[12] = data[0] * t.x + data[4] * t.y + data[8] * t.z + data[12];
- data[13] = data[1] * t.x + data[5] * t.y + data[9] * t.z + data[13];
- data[14] = data[2] * t.x + data[6] * t.y + data[10] * t.z + data[14];
- data[15] = data[3] * t.x + data[7] * t.y + data[11] * t.z + data[15];
- }
-
- /**
- * Translate the matrix by x, y, z. This is the same as multiplying by a
- * translation matrix with the given offsets.
- */
- void Translate( scalar x, scalar y, scalar z ) {
- data[12] = data[0] * x + data[4] * y + data[8] * z + data[12];
- data[13] = data[1] * x + data[5] * y + data[9] * z + data[13];
- data[14] = data[2] * x + data[6] * y + data[10] * z + data[14];
- data[15] = data[3] * x + data[7] * y + data[11] * z + data[15];
- }
-
- /** Compute the transposed matrix. */
- void Transpose() {
- piSwap(data[1], data[4]);
- piSwap(data[2], data[8]);
- piSwap(data[6], data[9]);
- piSwap(data[3], data[12]);
- piSwap(data[7], data[13]);
- piSwap(data[11], data[14]);
- }
-
- /** Compute the inverse of a rigid-body/isometry/orthonormal matrix. */
- void IsometryInverse() {
- // transposed 3x3 upper left matrix
- piSwap(data[1], data[4]);
- piSwap(data[2], data[8]);
- piSwap(data[6], data[9]);
-
- // translate by the negative offsets
- Vec3 v(-data[12], -data[13], -data[14]);
- data[12] = data[13] = data[14] = 0;
- Translate(v);
- }
-
- /** Compute the inverse of the affine portion of this matrix. */
- void AffineInverse() {
- data[12] = data[13] = data[14] = 0;
- Transpose();
- }
- //@}
-
- /** @name Matrix operations: */
- //@{
-
- /** Return the determinant of this matrix. */
- scalar Determinant() const {
- return data[0] * data[5] * data[10] * data[15] +
- data[1] * data[6] * data[11] * data[12] +
- data[2] * data[7] * data[ 8] * data[13] +
- data[3] * data[4] * data[ 9] * data[14] -
- data[3] * data[6] * data[ 9] * data[12] -
- data[2] * data[5] * data[ 8] * data[15] -
- data[1] * data[4] * data[11] * data[14] -
- data[0] * data[7] * data[10] * data[12];
- }
-
-
- /** Standard matrix product: this *= B. */
- void Multiply4x4( const Matrix & restrict B ) {
- Multiply4x4(*this, B);
- }
-
- /** Standard matrix product: this = A * B. this != B*/
- void Multiply4x4( const Matrix & A, const Matrix & restrict B ) {
- piDebugCheck(this != &B);
-
- for(int i = 0; i < 4; i++) {
- const scalar ai0 = A(i,0), ai1 = A(i,1), ai2 = A(i,2), ai3 = A(i,3);
- GetElem(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0);
- GetElem(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1);
- GetElem(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2);
- GetElem(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3);
- }
-
- /* Unrolled but does not allow this == A
- data[0] = A.data[0] * B.data[0] + A.data[4] * B.data[1] + A.data[8] * B.data[2] + A.data[12] * B.data[3];
- data[1] = A.data[1] * B.data[0] + A.data[5] * B.data[1] + A.data[9] * B.data[2] + A.data[13] * B.data[3];
- data[2] = A.data[2] * B.data[0] + A.data[6] * B.data[1] + A.data[10] * B.data[2] + A.data[14] * B.data[3];
- data[3] = A.data[3] * B.data[0] + A.data[7] * B.data[1] + A.data[11] * B.data[2] + A.data[15] * B.data[3];
- data[4] = A.data[0] * B.data[4] + A.data[4] * B.data[5] + A.data[8] * B.data[6] + A.data[12] * B.data[7];
- data[5] = A.data[1] * B.data[4] + A.data[5] * B.data[5] + A.data[9] * B.data[6] + A.data[13] * B.data[7];
- data[6] = A.data[2] * B.data[4] + A.data[6] * B.data[5] + A.data[10] * B.data[6] + A.data[14] * B.data[7];
- data[7] = A.data[3] * B.data[4] + A.data[7] * B.data[5] + A.data[11] * B.data[6] + A.data[15] * B.data[7];
- data[8] = A.data[0] * B.data[8] + A.data[4] * B.data[9] + A.data[8] * B.data[10] + A.data[12] * B.data[11];
- data[9] = A.data[1] * B.data[8] + A.data[5] * B.data[9] + A.data[9] * B.data[10] + A.data[13] * B.data[11];
- data[10]= A.data[2] * B.data[8] + A.data[6] * B.data[9] + A.data[10] * B.data[10] + A.data[14] * B.data[11];
- data[11]= A.data[3] * B.data[8] + A.data[7] * B.data[9] + A.data[11] * B.data[10] + A.data[15] * B.data[11];
- data[12]= A.data[0] * B.data[12] + A.data[4] * B.data[13] + A.data[8] * B.data[14] + A.data[12] * B.data[15];
- data[13]= A.data[1] * B.data[12] + A.data[5] * B.data[13] + A.data[9] * B.data[14] + A.data[13] * B.data[15];
- data[14]= A.data[2] * B.data[12] + A.data[6] * B.data[13] + A.data[10] * B.data[14] + A.data[14] * B.data[15];
- data[15]= A.data[3] * B.data[12] + A.data[7] * B.data[13] + A.data[11] * B.data[14] + A.data[15] * B.data[15];
- */
- }
-
- /** Standard matrix product: this *= B. */
- void Multiply4x3( const Matrix & restrict B ) {
- Multiply4x3(*this, B);
- }
-
- /** Standard product of matrices, where the last row is [0 0 0 1]. */
- void Multiply4x3( const Matrix & A, const Matrix & restrict B ) {
- piDebugCheck(this != &B);
-
- for(int i = 0; i < 3; i++) {
- const scalar ai0 = A(i,0), ai1 = A(i,1), ai2 = A(i,2), ai3 = A(i,3);
- GetElem(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0);
- GetElem(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1);
- GetElem(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2);
- GetElem(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3);
- }
- data[3] = 0.0f; data[7] = 0.0f; data[11] = 0.0f; data[15] = 1.0f;
-
- /* Unrolled but does not allow this == A
- data[0] = a.data[0] * b.data[0] + a.data[4] * b.data[1] + a.data[8] * b.data[2] + a.data[12] * b.data[3];
- data[1] = a.data[1] * b.data[0] + a.data[5] * b.data[1] + a.data[9] * b.data[2] + a.data[13] * b.data[3];
- data[2] = a.data[2] * b.data[0] + a.data[6] * b.data[1] + a.data[10] * b.data[2] + a.data[14] * b.data[3];
- data[3] = 0.0f;
- data[4] = a.data[0] * b.data[4] + a.data[4] * b.data[5] + a.data[8] * b.data[6] + a.data[12] * b.data[7];
- data[5] = a.data[1] * b.data[4] + a.data[5] * b.data[5] + a.data[9] * b.data[6] + a.data[13] * b.data[7];
- data[6] = a.data[2] * b.data[4] + a.data[6] * b.data[5] + a.data[10] * b.data[6] + a.data[14] * b.data[7];
- data[7] = 0.0f;
- data[8] = a.data[0] * b.data[8] + a.data[4] * b.data[9] + a.data[8] * b.data[10] + a.data[12] * b.data[11];
- data[9] = a.data[1] * b.data[8] + a.data[5] * b.data[9] + a.data[9] * b.data[10] + a.data[13] * b.data[11];
- data[10]= a.data[2] * b.data[8] + a.data[6] * b.data[9] + a.data[10] * b.data[10] + a.data[14] * b.data[11];
- data[11]= 0.0f;
- data[12]= a.data[0] * b.data[12] + a.data[4] * b.data[13] + a.data[8] * b.data[14] + a.data[12] * b.data[15];
- data[13]= a.data[1] * b.data[12] + a.data[5] * b.data[13] + a.data[9] * b.data[14] + a.data[13] * b.data[15];
- data[14]= a.data[2] * b.data[12] + a.data[6] * b.data[13] + a.data[10] * b.data[14] + a.data[14] * b.data[15];
- data[15]= 1.0f;
- */
- }
- //@}
-
-
- /** @name Vector operations: */
- //@{
-
- /** Transform 3d vector (w=0). */
- void TransformVec3(const Vec3 & restrict orig, Vec3 * restrict dest) const {
- piDebugCheck(&orig != dest);
- dest->x = orig.x * data[0] + orig.y * data[4] + orig.z * data[8];
- dest->y = orig.x * data[1] + orig.y * data[5] + orig.z * data[9];
- dest->z = orig.x * data[2] + orig.y * data[6] + orig.z * data[10];
- }
- /** Transform 3d vector by the transpose (w=0). */
- void TransformVec3T(const Vec3 & restrict orig, Vec3 * restrict dest) const {
- piDebugCheck(&orig != dest);
- dest->x = orig.x * data[0] + orig.y * data[1] + orig.z * data[2];
- dest->y = orig.x * data[4] + orig.y * data[5] + orig.z * data[6];
- dest->z = orig.x * data[8] + orig.y * data[9] + orig.z * data[10];
- }
-
- /** Transform a 3d homogeneous vector, where the fourth coordinate is assumed to be 1. */
- void TransformPoint(const Vec3 & restrict orig, Vec3 * restrict dest) const {
- piDebugCheck(&orig != dest);
- dest->x = orig.x * data[0] + orig.y * data[4] + orig.z * data[8] + data[12];
- dest->y = orig.x * data[1] + orig.y * data[5] + orig.z * data[9] + data[13];
- dest->z = orig.x * data[2] + orig.y * data[6] + orig.z * data[10] + data[14];
- }
-
- /** Transform a point, normalize it, and return w. */
- scalar TransformPointAndNormalize(const Vec3 & restrict orig, Vec3 * restrict dest) const {
- piDebugCheck(&orig != dest);
- scalar w;
- dest->x = orig.x * data[0] + orig.y * data[4] + orig.z * data[8] + data[12];
- dest->y = orig.x * data[1] + orig.y * data[5] + orig.z * data[9] + data[13];
- dest->z = orig.x * data[2] + orig.y * data[6] + orig.z * data[10] + data[14];
- w = 1 / (orig.x * data[3] + orig.y * data[7] + orig.z * data[11] + data[15]);
- *dest *= w;
- return w;
- }
-
- /** Transform a point and return w. */
- scalar TransformPointReturnW(const Vec3 & restrict orig, Vec3 * restrict dest) const {
- piDebugCheck(&orig != dest);
- dest->x = orig.x * data[0] + orig.y * data[4] + orig.z * data[8] + data[12];
- dest->y = orig.x * data[1] + orig.y * data[5] + orig.z * data[9] + data[13];
- dest->z = orig.x * data[2] + orig.y * data[6] + orig.z * data[10] + data[14];
- return orig.x * data[3] + orig.y * data[7] + orig.z * data[11] + data[15];
- }
-
- /** Transform a normalized 3d point by a 4d matrix and return the resulting 4d vector. */
- void TransformVec4(const Vec3 & orig, Vec4 * dest) const {
- dest->x = orig.x * data[0] + orig.y * data[4] + orig.z * data[8] + data[12];
- dest->y = orig.x * data[1] + orig.y * data[5] + orig.z * data[9] + data[13];
- dest->z = orig.x * data[2] + orig.y * data[6] + orig.z * data[10] + data[14];
- dest->w = orig.x * data[3] + orig.y * data[7] + orig.z * data[11] + data[15];
- }
- //@}
-
- /** @name Matrix analysis. */
- //@{
-
- /** Get the ZYZ euler angles from the matrix. Assumes the matrix is orthonormal. */
- void GetEulerAnglesZYZ(scalar * s, scalar * t, scalar * r) const {
- if( GetElem(2,2) < 1.0f ) {
- if( GetElem(2,2) > -1.0f ) {
- // cs*ct*cr-ss*sr -ss*ct*cr-cs*sr st*cr
- // cs*ct*sr+ss*cr -ss*ct*sr+cs*cr st*sr
- // -cs*st ss*st ct
- *s = atan2(GetElem(1,2), -GetElem(0,2));
- *t = acos(GetElem(2,2));
- *r = atan2(GetElem(2,1), GetElem(2,0));
- }
- else {
- // -c(s-r) s(s-r) 0
- // s(s-r) c(s-r) 0
- // 0 0 -1
- *s = atan2(GetElem(0, 1), -GetElem(0, 0)); // = s-r
- *t = PI;
- *r = 0;
- }
- }
- else {
- // c(s+r) -s(s+r) 0
- // s(s+r) c(s+r) 0
- // 0 0 1
- *s = atan2(GetElem(0, 1), GetElem(0, 0)); // = s+r
- *t = 0;
- *r = 0;
- }
- }
-
- //@}
-
- MATHLIB_API friend PiStream & operator<< ( PiStream & s, Matrix & m );
-
- /** Print to debug output. */
- void Print() const {
- piDebug( "[ %5.2f %5.2f %5.2f %5.2f ]\n", data[0], data[4], data[8], data[12] );
- piDebug( "[ %5.2f %5.2f %5.2f %5.2f ]\n", data[1], data[5], data[9], data[13] );
- piDebug( "[ %5.2f %5.2f %5.2f %5.2f ]\n", data[2], data[6], data[10], data[14] );
- piDebug( "[ %5.2f %5.2f %5.2f %5.2f ]\n", data[3], data[7], data[11], data[15] );
- }
-
-
-public:
-
- scalar data[16];
-
-};
-#endif
-
-
-
-
-#endif // NV_MATH_MATRIX_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Montecarlo.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Montecarlo.cpp
deleted file mode 100644
index 1fddd139..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Montecarlo.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvmath/Montecarlo.h>
-
-using namespace nv;
-
-
-void SampleDistribution::redistribute(Method method/*=Method_NRook*/, Distribution dist/*=Distribution_Cosine*/)
-{
- switch(method)
- {
- case Method_Random:
- redistributeRandom(dist);
- break;
- case Method_Stratified:
- redistributeStratified(dist);
- break;
- case Method_NRook:
- redistributeNRook(dist);
- break;
- };
-}
-
-void SampleDistribution::redistributeRandom(const Distribution dist)
-{
- const uint sampleCount = m_sampleArray.count();
-
- // This is the worst method possible!
- for(uint i = 0; i < sampleCount; i++)
- {
- float x = m_rand.getFloat();
- float y = m_rand.getFloat();
-
- setSample(i, dist, x, y);
- }
-}
-
-
-void SampleDistribution::redistributeStratified(const Distribution dist)
-{
- const uint sampleCount = m_sampleArray.count();
- const uint sqrtSampleCount = uint(sqrtf(float(sampleCount)));
-
- nvDebugCheck(sqrtSampleCount*sqrtSampleCount == sampleCount); // Must use exact powers!
-
- // Create a uniform distribution of points on the hemisphere with low variance.
- for(uint v = 0, i = 0; v < sqrtSampleCount; v++) {
- for(uint u = 0; u < sqrtSampleCount; u++, i++) {
- float x = (u + m_rand.getFloat()) / float(sqrtSampleCount);
- float y = (v + m_rand.getFloat()) / float(sqrtSampleCount);
-
- setSample(i, dist, x, y);
- }
- }
-}
-
-
-/** Multi-Stage N-rooks Sampling Method.
- * See: http://www.acm.org/jgt/papers/WangSung9/9
- */
-void SampleDistribution::multiStageNRooks(const int size, int* cells)
-{
- if (size == 1) {
- return;
- }
-
- int size1 = size >> 1;
- int size2 = size >> 1;
-
- if (size & 1) {
- if (m_rand.getFloat() > 0.5) {
- size1++;
- }
- else {
- size2++;
- }
- }
-
- int* upper_cells = new int[size1];
- int* lower_cells = new int[size2];
-
- int i, j;
- for(i = 0, j = 0; i < size - 1; i += 2, j++) {
- if (m_rand.get() & 1) {
- upper_cells[j] = cells[i];
- lower_cells[j] = cells[i + 1];
- }
- else {
- upper_cells[j] = cells[i + 1];
- lower_cells[j] = cells[i];
- }
- }
-
- if (size1 != size2) {
- if (size1 > size2) {
- upper_cells[j] = cells[i];
- }
- else {
- lower_cells[j] = cells[i];
- }
- }
-
- multiStageNRooks(size1, upper_cells);
- memcpy(cells, upper_cells, size1 * sizeof(int));
- delete [] upper_cells;
-
- multiStageNRooks(size2, lower_cells);
- memcpy(cells + size1, lower_cells, size2 * sizeof(int));
- delete [] lower_cells;
-}
-
-
-void SampleDistribution::redistributeNRook(const Distribution dist)
-{
- const uint sampleCount = m_sampleArray.count();
-
- // Generate nrook cells
- int * cells = new int[sampleCount];
- for(uint32 i = 0; i < sampleCount; i++)
- {
- cells[i] = i;
- }
- multiStageNRooks(sampleCount, cells);
-
- for(uint i = 0; i < sampleCount; i++)
- {
- float x = (i + m_rand.getFloat()) / sampleCount;
- float y = (cells[i] + m_rand.getFloat()) / sampleCount;
-
- setSample(i, dist, x, y);
- }
-
- delete [] cells;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Montecarlo.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Montecarlo.h
deleted file mode 100644
index 20c8abc7..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Montecarlo.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_MONTECARLO_H
-#define NV_MATH_MONTECARLO_H
-
-#include <nvmath/Vector.h>
-#include <nvmath/Random.h>
-
-namespace nv
-{
-
-/// A random sample distribution.
-class SampleDistribution
-{
-public:
-
- // Sampling method.
- enum Method {
- Method_Random,
- Method_Stratified,
- Method_NRook
- };
-
- // Distribution functions.
- enum Distribution {
- Distribution_UniformSphere,
- Distribution_UniformHemisphere,
- Distribution_CosineHemisphere
- };
-
- /// Constructor.
- SampleDistribution(uint num)
- {
- m_sampleArray.resize(num);
- }
-
- uint count() const { return m_sampleArray.count(); }
-
- void redistribute(Method method=Method_NRook, Distribution dist=Distribution_CosineHemisphere);
-
- /// Get parametric coordinates of the sample.
- Vector2 sample(int i) const { return m_sampleArray[i].uv; }
-
- /// Get sample direction.
- Vector3 sampleDir(int i) const { return m_sampleArray[i].dir; }
-
- /// Get number of samples.
- uint sampleCount() const { return m_sampleArray.count(); }
-
-private:
-
- void redistributeRandom(const Distribution dist);
- void redistributeStratified(const Distribution dist);
- void multiStageNRooks(const int size, int* cells);
- void redistributeNRook(const Distribution dist);
-
-
- /// A sample of the random distribution.
- struct Sample
- {
- /// Set sample given the 3d coordinates.
- void setDir(float x, float y, float z) {
- dir.set(x, y, z);
- uv.set(acosf(z), atan2f(y, x));
- }
-
- /// Set sample given the 2d parametric coordinates.
- void setUV(float u, float v) {
- uv.set(u, v);
- dir.set(sinf(u) * cosf(v), sinf(u) * sinf(v), cosf(u));
- }
-
- Vector2 uv;
- Vector3 dir;
- };
-
- inline void setSample(uint i, Distribution dist, float x, float y)
- {
- // Map uniform distribution in the square to desired domain.
- if( dist == Distribution_UniformSphere ) {
- m_sampleArray[i].setUV(acosf(1 - 2 * x), 2 * PI * y);
- }
- else if( dist == Distribution_UniformHemisphere ) {
- m_sampleArray[i].setUV(acosf(x), 2 * PI * y);
- }
- else {
- nvDebugCheck(dist == Distribution_CosineHemisphere);
- m_sampleArray[i].setUV(acosf(sqrtf(x)), 2 * PI * y);
- }
- }
-
-
- /// Random seed.
- MTRand m_rand;
-
- /// Samples.
- Array<Sample> m_sampleArray;
-
-};
-
-} // nv namespace
-
-#endif // NV_MATH_MONTECARLO_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Plane.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Plane.cpp
deleted file mode 100644
index 979c099e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Plane.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include "Plane.h"
-#include "Matrix.h"
-
-namespace nv
-{
- Plane transformPlane(const Matrix& m, Plane::Arg p)
- {
- Vector3 newVec = transformVector(m, p.vector());
-
- Vector3 ptInPlane = p.offset() * p.vector();
- ptInPlane = transformPoint(m, ptInPlane);
-
- return Plane(newVec, ptInPlane);
- }
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Plane.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Plane.h
deleted file mode 100644
index 8a2f57d9..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Plane.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_PLANE_H
-#define NV_MATH_PLANE_H
-
-#include <nvmath/nvmath.h>
-#include <nvmath/Vector.h>
-
-namespace nv
-{
- class Matrix;
-
-
- class NVMATH_CLASS Plane
- {
- public:
- typedef Plane const & Arg;
-
- Plane();
- Plane(float x, float y, float z, float w);
- Plane(Vector4::Arg v);
- Plane(Vector3::Arg v, float d);
- Plane(Vector3::Arg normal, Vector3::Arg point);
-
- const Plane & operator=(Plane::Arg v);
-
- Vector3 vector() const;
- scalar offset() const;
-
- const Vector4 & asVector() const;
- Vector4 & asVector();
-
- void operator*=(scalar s);
-
- private:
- Vector4 p;
- };
-
- inline Plane::Plane() {}
- inline Plane::Plane(float x, float y, float z, float w) : p(x, y, z, w) {}
- inline Plane::Plane(Vector4::Arg v) : p(v) {}
- inline Plane::Plane(Vector3::Arg v, float d) : p(v, d) {}
- inline Plane::Plane(Vector3::Arg normal, Vector3::Arg point) : p(normal, dot(normal, point)) {}
-
- inline const Plane & Plane::operator=(Plane::Arg v) { p = v.p; return *this; }
-
- inline Vector3 Plane::vector() const { return p.xyz(); }
- inline scalar Plane::offset() const { return p.w(); }
-
- inline const Vector4 & Plane::asVector() const { return p; }
- inline Vector4 & Plane::asVector() { return p; }
-
- // Normalize plane.
- inline Plane normalize(Plane::Arg plane, float epsilon = NV_EPSILON)
- {
- const float len = length(plane.vector());
- nvDebugCheck(!isZero(len, epsilon));
- const float inv = 1.0f / len;
- return Plane(plane.asVector() * inv);
- }
-
- // Get the signed distance from the given point to this plane.
- inline float distance(Plane::Arg plane, Vector3::Arg point)
- {
- return dot(plane.vector(), point) - plane.offset();
- }
-
- inline void Plane::operator*=(scalar s)
- {
- scale(p, s);
- }
-
- Plane transformPlane(const Matrix&, Plane::Arg);
-
-} // nv namespace
-
-#endif // NV_MATH_PLANE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Polygon.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Polygon.cpp
deleted file mode 100644
index c5f6282f..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Polygon.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-// This code is in the public domain -- Ignacio Castaño <castanyo@yahoo.es>
-
-#include <nvmath/Polygon.h>
-
-#include <nvmath/Triangle.h>
-#include <nvmath/Plane.h>
-
-using namespace nv;
-
-
-Polygon::Polygon()
-{
-}
-
-Polygon::Polygon(const Triangle & t)
-{
- pointArray.resize(3);
- pointArray[0] = t.v[0];
- pointArray[1] = t.v[1];
- pointArray[2] = t.v[2];
-}
-
-Polygon::Polygon(const Vector3 * points, uint vertexCount)
-{
- pointArray.resize(vertexCount);
-
- for (uint i = 0; i < vertexCount; i++)
- {
- pointArray[i] = points[i];
- }
-}
-
-
-/// Compute polygon area.
-float Polygon::area() const
-{
- float total = 0;
-
- const uint pointCount = pointArray.count();
- for (uint i = 2; i < pointCount; i++)
- {
- Vector3 v1 = pointArray[i-1] - pointArray[0];
- Vector3 v2 = pointArray[i] - pointArray[0];
-
- total += 0.5f * length(cross(v1, v2));
- }
-
- return total;
-}
-
-/// Get the bounds of the polygon.
-Box Polygon::bounds() const
-{
- Box bounds;
- bounds.clearBounds();
- foreach(p, pointArray)
- {
- bounds.addPointToBounds(pointArray[p]);
- }
- return bounds;
-}
-
-
-/// Get the plane of the polygon.
-Plane Polygon::plane() const
-{
- // @@ Do something better than this?
- Vector3 n = cross(pointArray[1] - pointArray[0], pointArray[2] - pointArray[0]);
- return Vector4(n, dot(n, pointArray[0]));
-}
-
-
-/// Clip polygon to box.
-uint Polygon::clipTo(const Box & box)
-{
- const Plane posX( 1, 0, 0, box.maxCorner().x());
- const Plane negX(-1, 0, 0,-box.minCorner().x());
- const Plane posY( 0, 1, 0, box.maxCorner().y());
- const Plane negY( 0,-1, 0,-box.minCorner().y());
- const Plane posZ( 0, 0, 1, box.maxCorner().z());
- const Plane negZ( 0, 0,-1,-box.minCorner().z());
-
- if (clipTo(posX) == 0) return 0;
- if (clipTo(negX) == 0) return 0;
- if (clipTo(posY) == 0) return 0;
- if (clipTo(negY) == 0) return 0;
- if (clipTo(posZ) == 0) return 0;
- if (clipTo(negZ) == 0) return 0;
-
- return pointArray.count();
-}
-
-
-/// Clip polygon to plane.
-uint Polygon::clipTo(const Plane & plane)
-{
- int count = 0;
-
- const uint pointCount = pointArray.count();
-
- Array<Vector3> newPointArray(pointCount + 1); // @@ Do not create copy every time.
-
- Vector3 prevPoint = pointArray[pointCount - 1];
- float prevDist = dot(plane.vector(), prevPoint) - plane.offset();
-
- for (uint i = 0; i < pointCount; i++)
- {
- const Vector3 point = pointArray[i];
- float dist = dot(plane.vector(), point) - plane.offset();
-
- // @@ Handle points on plane better.
-
- if (dist <= 0) // interior.
- {
- if (prevDist > 0) // exterior
- {
- // Add segment intersection point.
- Vector3 dp = point - prevPoint;
-
- float t = dist / prevDist;
- newPointArray.append(point - dp * t);
- }
-
- // Add interior point.
- newPointArray.append(point);
- }
- else if (dist > 0 && prevDist < 0)
- {
- // Add segment intersection point.
- Vector3 dp = point - prevPoint;
-
- float t = dist / prevDist;
- newPointArray.append(point - dp * t);
- }
-
- prevPoint = point;
- prevDist = dist;
- }
-
- swap(pointArray, newPointArray);
-
- return count;
-}
-
-
-void Polygon::removeColinearPoints()
-{
- const uint pointCount = pointArray.count();
-
- Array<Vector3> newPointArray(pointCount);
-
- for (uint i = 0 ; i < pointCount; i++)
- {
- int j = (i + 1) % pointCount;
- int k = (i + pointCount - 1) % pointCount;
-
- Vector3 v1 = normalize(pointArray[j] - pointArray[i]);
- Vector3 v2 = normalize(pointArray[i] - pointArray[k]);
-
- if (dot(v1, v2) < 0.999)
- {
- newPointArray.append(pointArray[i]);
- }
- }
-
- swap(pointArray, newPointArray);
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Polygon.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Polygon.h
deleted file mode 100644
index e70463a8..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Polygon.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// This code is in the public domain -- Ignacio Castaño <castanyo@yahoo.es>
-
-#ifndef NV_MATH_POLYGON_H
-#define NV_MATH_POLYGON_H
-
-#include <nvcore/Containers.h>
-
-#include <nvmath/nvmath.h>
-#include <nvmath/Vector.h>
-#include <nvmath/Box.h>
-
-namespace nv
-{
- class Box;
- class Plane;
- class Triangle;
-
-
- class Polygon
- {
- NV_FORBID_COPY(Polygon);
- public:
-
- Polygon();
- Polygon(const Triangle & t);
- Polygon(const Vector3 * points, uint vertexCount);
-
- float area() const;
- Box bounds() const;
- Plane plane() const;
-
- uint clipTo(const Box & box);
- uint clipTo(const Plane & plane);
-
- void removeColinearPoints();
-
- private:
-
- Array<Vector3> pointArray;
- };
-
-
-} // nv namespace
-
-#endif // NV_MATH_POLYGON_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Quaternion.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Quaternion.h
deleted file mode 100644
index 1002ff99..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Quaternion.h
+++ /dev/null
@@ -1,179 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_QUATERNION_H
-#define NV_MATH_QUATERNION_H
-
-#include <nvmath/nvmath.h>
-#include <nvmath/Vector.h>
-
-namespace nv
-{
-
- class NVMATH_CLASS Quaternion
- {
- public:
- typedef Quaternion const & Arg;
-
- Quaternion();
- explicit Quaternion(zero_t);
- Quaternion(float x, float y, float z, float w);
- Quaternion(Vector4::Arg v);
-
- const Quaternion & operator=(Quaternion::Arg v);
-
- scalar x() const;
- scalar y() const;
- scalar z() const;
- scalar w() const;
-
- const Vector4 & asVector() const;
- Vector4 & asVector();
-
- private:
- Vector4 q;
- };
-
- inline Quaternion::Quaternion() {}
- inline Quaternion::Quaternion(zero_t) : q(zero) {}
- inline Quaternion::Quaternion(float x, float y, float z, float w) : q(x, y, z, w) {}
- inline Quaternion::Quaternion(Vector4::Arg v) : q(v) {}
-
- inline const Quaternion & Quaternion::operator=(Quaternion::Arg v) { q = v.q; return *this; }
-
- inline scalar Quaternion::x() const { return q.x(); }
- inline scalar Quaternion::y() const { return q.y(); }
- inline scalar Quaternion::z() const { return q.z(); }
- inline scalar Quaternion::w() const { return q.w(); }
-
- inline const Vector4 & Quaternion::asVector() const { return q; }
- inline Vector4 & Quaternion::asVector() { return q; }
-
-
- inline Quaternion mul(Quaternion::Arg a, Quaternion::Arg b)
- {
- return Quaternion(
- + a.x() * b.w() + a.y()*b.z() - a.z()*b.y() + a.w()*b.x(),
- - a.x() * b.z() + a.y()*b.w() + a.z()*b.x() + a.w()*b.y(),
- + a.x() * b.y() - a.y()*b.x() + a.z()*b.w() + a.w()*b.z(),
- - a.x() * b.x() - a.y()*b.y() - a.z()*b.z() + a.w()*b.w());
- }
-
- inline Quaternion mul(Quaternion::Arg a, Vector3::Arg b)
- {
- return Quaternion(
- + a.y()*b.z() - a.z()*b.y() + a.w()*b.x(),
- - a.x() * b.z() + a.z()*b.x() + a.w()*b.y(),
- + a.x() * b.y() - a.y()*b.x() + a.w()*b.z(),
- - a.x() * b.x() - a.y()*b.y() - a.z()*b.z() );
- }
-
- inline Quaternion mul(Vector3::Arg a, Quaternion::Arg b)
- {
- return Quaternion(
- + a.x() * b.w() + a.y()*b.z() - a.z()*b.y(),
- - a.x() * b.z() + a.y()*b.w() + a.z()*b.x(),
- + a.x() * b.y() - a.y()*b.x() + a.z()*b.w(),
- - a.x() * b.x() - a.y()*b.y() - a.z()*b.z());
- }
-
- inline Quaternion operator *(Quaternion::Arg a, Quaternion::Arg b)
- {
- return mul(a, b);
- }
-
- inline Quaternion operator *(Quaternion::Arg a, Vector3::Arg b)
- {
- return mul(a, b);
- }
-
- inline Quaternion operator *(Vector3::Arg a, Quaternion::Arg b)
- {
- return mul(a, b);
- }
-
-
- inline Quaternion scale(Quaternion::Arg q, float s)
- {
- return scale(q.asVector(), s);
- }
- inline Quaternion operator *(Quaternion::Arg q, float s)
- {
- return scale(q, s);
- }
- inline Quaternion operator *(float s, Quaternion::Arg q)
- {
- return scale(q, s);
- }
-
- inline Quaternion scale(Quaternion::Arg q, Vector4::Arg s)
- {
- return scale(q.asVector(), s);
- }
- /*inline Quaternion operator *(Quaternion::Arg q, Vector4::Arg s)
- {
- return scale(q, s);
- }
- inline Quaternion operator *(Vector4::Arg s, Quaternion::Arg q)
- {
- return scale(q, s);
- }*/
-
- inline Quaternion conjugate(Quaternion::Arg q)
- {
- return scale(q, Vector4(-1, -1, -1, 1));
- }
-
- inline float length(Quaternion::Arg q)
- {
- return length(q.asVector());
- }
-
- inline bool isNormalized(Quaternion::Arg q, float epsilon = NV_NORMAL_EPSILON)
- {
- return equal(length(q), 1, epsilon);
- }
-
- inline Quaternion normalize(Quaternion::Arg q, float epsilon = NV_EPSILON)
- {
- float l = length(q);
- nvDebugCheck(!isZero(l, epsilon));
- Quaternion n = scale(q, 1.0f / l);
- nvDebugCheck(isNormalized(n));
- return n;
- }
-
- inline Quaternion inverse(Quaternion::Arg q)
- {
- return conjugate(normalize(q));
- }
-
- /// Create a rotation quaternion for @a angle alpha around normal vector @a v.
- inline Quaternion axisAngle(Vector3::Arg v, float alpha)
- {
- float s = sinf(alpha * 0.5f);
- float c = cosf(alpha * 0.5f);
- return Quaternion(Vector4(v * s, c));
- }
-
- inline Vector3 imag(Quaternion::Arg q)
- {
- return q.asVector().xyz();
- }
-
- inline float real(Quaternion::Arg q)
- {
- return q.w();
- }
-
-
- /// Transform vector.
- inline Vector3 transform(Quaternion::Arg q, Vector3::Arg v)
- {
- Quaternion t = q * v * conjugate(q);
- return imag(t);
- }
-
-
-} // nv namespace
-
-#endif // NV_MATH_QUATERNION_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Random.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Random.cpp
deleted file mode 100644
index 6178134f..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Random.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvmath/Random.h>
-#include <time.h>
-
-using namespace nv;
-
-// Statics
-const uint16 Rand48::a0 = 0xE66D;
-const uint16 Rand48::a1 = 0xDEEC;
-const uint16 Rand48::a2 = 0x0005;
-const uint16 Rand48::c0 = 0x000B;
-
-
-/// Get a random seed based on the current time.
-uint Rand::randomSeed()
-{
- return (uint)time(NULL);
-}
-
-
-void MTRand::initialize( uint32 seed )
-{
- // Initialize generator state with seed
- // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier.
- // In previous versions, most significant bits (MSBs) of the seed affect
- // only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto.
- uint32 *s = state;
- uint32 *r = state;
- int i = 1;
- *s++ = seed & 0xffffffffUL;
- for( ; i < N; ++i )
- {
- *s++ = ( 1812433253UL * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffUL;
- r++;
- }
-}
-
-
-void MTRand::reload()
-{
- // Generate N new values in state
- // Made clearer and faster by Matthew Bellew (matthew.bellew@home.com)
- uint32 *p = state;
- int i;
- for( i = N - M; i--; ++p )
- *p = twist( p[M], p[0], p[1] );
- for( i = M; --i; ++p )
- *p = twist( p[M-N], p[0], p[1] );
- *p = twist( p[M-N], p[0], state[0] );
-
- left = N, next = state;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Random.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Random.h
deleted file mode 100644
index 0f76949e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Random.h
+++ /dev/null
@@ -1,368 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_RANDOM_H
-#define NV_MATH_RANDOM_H
-
-#include <nvcore/Containers.h> // nextPowerOfTwo
-#include <nvmath/nvmath.h>
-
-namespace nv
-{
-
-/// Interface of the random number generators.
-class Rand
-{
-public:
-
- virtual ~Rand() {}
-
- enum time_e { Time };
-
- /// Provide a new seed.
- virtual void seed( uint s ) { /* empty */ };
-
- /// Get an integer random number.
- virtual uint get() = 0;
-
- /// Get a random number on [0, max] interval.
- uint getRange( uint max )
- {
- uint n;
- // uint mask = Bitmask( max );
- // do { n = Get() & mask; } while( n > max );
- uint np2 = nextPowerOfTwo( max );
- do { n = get() & (np2-1); } while( n > max );
- return n;
- }
-
- /// Random number on [0.0, 1.0] interval.
- float getFloat()
- {
- union
- {
- uint32 i;
- float f;
- } pun;
-
- pun.i = 0x3f800000UL | (get() & 0x007fffffUL);
- return pun.f - 1.0f;
- }
-
- /*
- /// Random number on [0.0, 1.0] interval.
- double getReal()
- {
- return double(get()) * (1.0/4294967295.0); // 2^32-1
- }
-
- /// Random number on [0.0, 1.0) interval.
- double getRealExclusive()
- {
- return double(get()) * (1.0/4294967296.0); // 2^32
- }
- */
-
- /// Get the max value of the random number.
- uint max() const { return 4294967295U; }
-
- // Get a random seed.
- static uint randomSeed();
-
-};
-
-
-/// Very simple random number generator with low storage requirements.
-class SimpleRand : public Rand
-{
-public:
-
- /// Constructor that uses the current time as the seed.
- SimpleRand( time_e )
- {
- seed(randomSeed());
- }
-
- /// Constructor that uses the given seed.
- SimpleRand( uint s = 0 )
- {
- seed(s);
- }
-
- /// Set the given seed.
- virtual void seed( uint s )
- {
- current = s;
- }
-
- /// Get a random number.
- virtual uint get()
- {
- return current = current * 1103515245 + 12345;
- }
-
-private:
-
- uint current;
-
-};
-
-
-/// Mersenne twister random number generator.
-class MTRand : public Rand
-{
-public:
-
- enum { N = 624 }; // length of state vector
- enum { M = 397 };
-
- /// Constructor that uses the current time as the seed.
- MTRand( time_e )
- {
- seed(randomSeed());
- }
-
- /// Constructor that uses the given seed.
- MTRand( uint s = 0 )
- {
- seed(s);
- }
-
- /// Constructor that uses the given seeds.
- NVMATH_API MTRand( const uint * seed_array, uint length );
-
-
- /// Provide a new seed.
- virtual void seed( uint s )
- {
- initialize(s);
- reload();
- }
-
- /// Get a random number between 0 - 65536.
- virtual uint get()
- {
- // Pull a 32-bit integer from the generator state
- // Every other access function simply transforms the numbers extracted here
- if( left == 0 ) {
- reload();
- }
- left--;
-
- uint s1;
- s1 = *next++;
- s1 ^= (s1 >> 11);
- s1 ^= (s1 << 7) & 0x9d2c5680U;
- s1 ^= (s1 << 15) & 0xefc60000U;
- return ( s1 ^ (s1 >> 18) );
- };
-
-
-private:
-
- NVMATH_API void initialize( uint32 seed );
- NVMATH_API void reload();
-
- uint hiBit( uint u ) const { return u & 0x80000000U; }
- uint loBit( uint u ) const { return u & 0x00000001U; }
- uint loBits( uint u ) const { return u & 0x7fffffffU; }
- uint mixBits( uint u, uint v ) const { return hiBit(u) | loBits(v); }
- uint twist( uint m, uint s0, uint s1 ) const { return m ^ (mixBits(s0,s1)>>1) ^ ((~loBit(s1)+1) & 0x9908b0dfU); }
-
-private:
-
- uint state[N]; // internal state
- uint * next; // next value to get from state
- int left; // number of values left before reload needed
-
-};
-
-
-
-/** George Marsaglia's random number generator.
- * Code based on Thatcher Ulrich public domain source code:
- * http://cvs.sourceforge.net/viewcvs.py/tu-testbed/tu-testbed/base/tu_random.cpp?rev=1.7&view=auto
- *
- * PRNG code adapted from the complimentary-multiply-with-carry
- * code in the article: George Marsaglia, "Seeds for Random Number
- * Generators", Communications of the ACM, May 2003, Vol 46 No 5,
- * pp90-93.
- *
- * The article says:
- *
- * "Any one of the choices for seed table size and multiplier will
- * provide a RNG that has passed extensive tests of randomness,
- * particularly those in [3], yet is simple and fast --
- * approximately 30 million random 32-bit integers per second on a
- * 850MHz PC. The period is a*b^n, where a is the multiplier, n
- * the size of the seed table and b=2^32-1. (a is chosen so that
- * b is a primitive root of the prime a*b^n + 1.)"
- *
- * [3] Marsaglia, G., Zaman, A., and Tsang, W. Toward a universal
- * random number generator. _Statistics and Probability Letters
- * 8_ (1990), 35-39.
- */
-class GMRand : public Rand
-{
-public:
-
- enum { SEED_COUNT = 8 };
-
-// const uint64 a = 123471786; // for SEED_COUNT=1024
-// const uint64 a = 123554632; // for SEED_COUNT=512
-// const uint64 a = 8001634; // for SEED_COUNT=255
-// const uint64 a = 8007626; // for SEED_COUNT=128
-// const uint64 a = 647535442; // for SEED_COUNT=64
-// const uint64 a = 547416522; // for SEED_COUNT=32
-// const uint64 a = 487198574; // for SEED_COUNT=16
-// const uint64 a = 716514398U; // for SEED_COUNT=8
- enum { a = 716514398U };
-
-
- GMRand( time_e )
- {
- seed(randomSeed());
- }
-
- GMRand(uint s = 987654321)
- {
- seed(s);
- }
-
-
- /// Provide a new seed.
- virtual void seed( uint s )
- {
- c = 362436;
- i = SEED_COUNT - 1;
-
- for(int i = 0; i < SEED_COUNT; i++) {
- s = s ^ (s << 13);
- s = s ^ (s >> 17);
- s = s ^ (s << 5);
- Q[i] = s;
- }
- }
-
- /// Get a random number between 0 - 65536.
- virtual uint get()
- {
- const uint32 r = 0xFFFFFFFE;
-
- uint64 t;
- uint32 x;
-
- i = (i + 1) & (SEED_COUNT - 1);
- t = a * Q[i] + c;
- c = uint32(t >> 32);
- x = uint32(t + c);
-
- if( x < c ) {
- x++;
- c++;
- }
-
- uint32 val = r - x;
- Q[i] = val;
- return val;
- };
-
-
-private:
-
- uint32 c;
- uint32 i;
- uint32 Q[8];
-
-};
-
-
-/** Random number implementation from the GNU Sci. Lib. (GSL).
- * Adapted from Nicholas Chapman version:
- *
- * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
- * This is the Unix rand48() generator. The generator returns the
- * upper 32 bits from each term of the sequence,
- *
- * x_{n+1} = (a x_n + c) mod m
- *
- * using 48-bit unsigned arithmetic, with a = 0x5DEECE66D , c = 0xB
- * and m = 2^48. The seed specifies the upper 32 bits of the initial
- * value, x_1, with the lower 16 bits set to 0x330E.
- *
- * The theoretical value of x_{10001} is 244131582646046.
- *
- * The period of this generator is ? FIXME (probably around 2^48).
- */
-class Rand48 : public Rand
-{
-public:
-
- Rand48( time_e )
- {
- seed(randomSeed());
- }
-
- Rand48( uint s = 0x1234ABCD )
- {
- seed(s);
- }
-
-
- /** Set the given seed. */
- virtual void seed( uint s ) {
- vstate.x0 = 0x330E;
- vstate.x1 = uint16(s & 0xFFFF);
- vstate.x2 = uint16((s >> 16) & 0xFFFF);
- }
-
- /** Get a random number. */
- virtual uint get() {
-
- advance();
-
- uint x1 = vstate.x1;
- uint x2 = vstate.x2;
- return (x2 << 16) + x1;
- }
-
-
-private:
-
- void advance()
- {
- /* work with unsigned long ints throughout to get correct integer
- promotions of any unsigned short ints */
- const uint32 x0 = vstate.x0;
- const uint32 x1 = vstate.x1;
- const uint32 x2 = vstate.x2;
-
- uint32 a;
- a = a0 * x0 + c0;
-
- vstate.x0 = uint16(a & 0xFFFF);
- a >>= 16;
-
- /* although the next line may overflow we only need the top 16 bits
- in the following stage, so it does not matter */
-
- a += a0 * x1 + a1 * x0;
- vstate.x1 = uint16(a & 0xFFFF);
-
- a >>= 16;
- a += a0 * x2 + a1 * x1 + a2 * x0;
- vstate.x2 = uint16(a & 0xFFFF);
- }
-
-
-private:
- NVMATH_API static const uint16 a0, a1, a2, c0;
-
- struct rand48_state_t {
- uint16 x0, x1, x2;
- } vstate;
-
-};
-
-} // nv namespace
-
-#endif // NV_MATH_RANDOM_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Solver.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Solver.cpp
deleted file mode 100644
index b8eabbf7..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Solver.cpp
+++ /dev/null
@@ -1,739 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvmath/Solver.h>
-
-using namespace nv;
-
-namespace
-{
- class Preconditioner
- {
- public:
- // Virtual dtor.
- virtual ~Preconditioner() { }
-
- // Apply preconditioning step.
- virtual void apply(const FullVector & x, FullVector & y) const = 0;
- };
-
-
- // Jacobi preconditioner.
- class JacobiPreconditioner : public Preconditioner
- {
- public:
-
- JacobiPreconditioner(const SparseMatrix & M, bool symmetric) : m_inverseDiagonal(M.width())
- {
- nvCheck(M.isSquare());
-
- for(uint x = 0; x < M.width(); x++)
- {
- float elem = M.getCoefficient(x, x);
- nvDebugCheck( elem != 0.0f );
-
- if (symmetric)
- {
- m_inverseDiagonal[x] = 1.0f / sqrt(fabs(elem));
- }
- else
- {
- m_inverseDiagonal[x] = 1.0f / elem;
- }
- }
- }
-
- void apply(const FullVector & x, FullVector & y) const
- {
- nvDebugCheck(x.dimension() == m_inverseDiagonal.dimension());
- nvDebugCheck(y.dimension() == m_inverseDiagonal.dimension());
-
- // @@ Wrap vector component-wise product into a separate function.
- const uint D = x.dimension();
- for (uint i = 0; i < D; i++)
- {
- y[i] = m_inverseDiagonal[i] * x[i];
- }
- }
-
- private:
-
- FullVector m_inverseDiagonal;
-
- };
-
-} // namespace
-
-
-static int ConjugateGradientSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon);
-static int ConjugateGradientSolver(const Preconditioner & preconditioner, const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon);
-
-
-// Solve the symmetric system: At·A·x = At·b
-void nv::LeastSquaresSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon/*1e-5f*/)
-{
- nvDebugCheck(A.width() == x.dimension());
- nvDebugCheck(A.height() == b.dimension());
- nvDebugCheck(A.height() >= A.width()); // @@ If height == width we could solve it directly...
-
- const uint D = A.width();
-
- SparseMatrix At(A.height(), A.width());
- transpose(A, At);
-
- FullVector Atb(D);
- //mult(Transposed, A, b, Atb);
- mult(At, b, Atb);
-
- SparseMatrix AtA(D);
- //mult(Transposed, A, NoTransposed, A, AtA);
- mult(At, A, AtA);
-
- SymmetricSolver(AtA, Atb, x, epsilon);
-}
-
-
-// See section 10.4.3 in: Mesh Parameterization: Theory and Practice, Siggraph Course Notes, August 2007
-void nv::LeastSquaresSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, const uint * lockedParameters, uint lockedCount, float epsilon/*= 1e-5f*/)
-{
- nvDebugCheck(A.width() == x.dimension());
- nvDebugCheck(A.height() == b.dimension());
- nvDebugCheck(A.height() >= A.width() - lockedCount);
-
- // @@ This is not the most efficient way of building a system with reduced degrees of freedom. It would be faster to do it on the fly.
-
- const uint D = A.width() - lockedCount;
- nvDebugCheck(D > 0);
-
- // Compute: b - Al * xl
- FullVector b_Alxl(b);
-
- for (uint y = 0; y < A.height(); y++)
- {
- const uint count = A.getRow(y).count();
- for (uint e = 0; e < count; e++)
- {
- uint column = A.getRow(y)[e].x;
-
- bool isFree = true;
- for (uint i = 0; i < lockedCount; i++)
- {
- isFree &= (lockedParameters[i] != column);
- }
-
- if (!isFree)
- {
- b_Alxl[y] -= x[column] * A.getRow(y)[e].v;
- }
- }
- }
-
- // Remove locked columns from A.
- SparseMatrix Af(D, A.height());
-
- for (uint y = 0; y < A.height(); y++)
- {
- const uint count = A.getRow(y).count();
- for (uint e = 0; e < count; e++)
- {
- uint column = A.getRow(y)[e].x;
- uint ix = column;
-
- bool isFree = true;
- for (uint i = 0; i < lockedCount; i++)
- {
- isFree &= (lockedParameters[i] != column);
- if (column > lockedParameters[i]) ix--; // shift columns
- }
-
- if (isFree)
- {
- Af.setCoefficient(ix, y, A.getRow(y)[e].v);
- }
- }
- }
-
- // Remove elements from x
- FullVector xf(D);
-
- for (uint i = 0, j = 0; i < A.width(); i++)
- {
- bool isFree = true;
- for (uint l = 0; l < lockedCount; l++)
- {
- isFree &= (lockedParameters[l] != i);
- }
-
- if (isFree)
- {
- xf[j++] = x[i];
- }
- }
-
- // Solve reduced system.
- LeastSquaresSolver(Af, b_Alxl, xf, epsilon);
-
- // Copy results back to x.
- for (uint i = 0, j = 0; i < A.width(); i++)
- {
- bool isFree = true;
- for (uint l = 0; l < lockedCount; l++)
- {
- isFree &= (lockedParameters[l] != i);
- }
-
- if (isFree)
- {
- x[i] = xf[j++];
- }
- }
-}
-
-
-void nv::SymmetricSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon/*1e-5f*/)
-{
- nvDebugCheck(A.height() == A.width());
- nvDebugCheck(A.height() == b.dimension());
- nvDebugCheck(b.dimension() == x.dimension());
-
- JacobiPreconditioner jacobi(A, true);
- ConjugateGradientSolver(jacobi, A, b, x, epsilon);
-
-// ConjugateGradientSolver(A, b, x, epsilon);
-}
-
-
-/**
- * Compute the solution of the sparse linear system Ab=x using the Conjugate
- * Gradient method.
- *
- * Solving sparse linear systems:
- * (1) A·x = b
- *
- * The conjugate gradient algorithm solves (1) only in the case that A is
- * symmetric and positive definite. It is based on the idea of minimizing the
- * function
- *
- * (2) f(x) = 1/2·x·A·x - b·x
- *
- * This function is minimized when its gradient
- *
- * (3) df = A·x - b
- *
- * is zero, which is equivalent to (1). The minimization is carried out by
- * generating a succession of search directions p.k and improved minimizers x.k.
- * At each stage a quantity alfa.k is found that minimizes f(x.k + alfa.k·p.k),
- * and x.k+1 is set equal to the new point x.k + alfa.k·p.k. The p.k and x.k are
- * built up in such a way that x.k+1 is also the minimizer of f over the whole
- * vector space of directions already taken, {p.1, p.2, . . . , p.k}. After N
- * iterations you arrive at the minimizer over the entire vector space, i.e., the
- * solution to (1).
- *
- * For a really good explanation of the method see:
- *
- * "An Introduction to the Conjugate Gradient Method Without the Agonizing Pain",
- * Jonhathan Richard Shewchuk.
- *
-**/
-/*static*/ int ConjugateGradientSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon)
-{
- nvDebugCheck( A.isSquare() );
- nvDebugCheck( A.width() == b.dimension() );
- nvDebugCheck( A.width() == x.dimension() );
-
- int i = 0;
- const int D = A.width();
- const int i_max = 4 * D; // Convergence should be linear, but in some cases, it's not.
-
- FullVector r(D); // residual
- FullVector p(D); // search direction
- FullVector q(D); //
- float delta_0;
- float delta_old;
- float delta_new;
- float alpha;
- float beta;
-
- // r = b - A·x;
- copy(b, r);
- sgemv(-1, A, x, 1, r);
-
- // p = r;
- copy(r, p);
-
- delta_new = dot( r, r );
- delta_0 = delta_new;
-
- while (i < i_max && delta_new > epsilon*epsilon*delta_0)
- {
- i++;
-
- // q = A·p
- mult(A, p, q);
-
- // alpha = delta_new / p·q
- alpha = delta_new / dot( p, q );
-
- // x = alfa·p + x
- saxpy(alpha, p, x);
-
- if ((i & 31) == 0) // recompute r after 32 steps
- {
- // r = b - A·x
- copy(b, r);
- sgemv(-1, A, x, 1, r);
- }
- else
- {
- // r = r - alpha·q
- saxpy(-alpha, q, r);
- }
-
- delta_old = delta_new;
- delta_new = dot( r, r );
-
- beta = delta_new / delta_old;
-
- // p = beta·p + r
- scal(beta, p);
- saxpy(1, r, p);
- }
-
- return i;
-}
-
-
-// Conjugate gradient with preconditioner.
-/*static*/ int ConjugateGradientSolver(const Preconditioner & preconditioner, const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon)
-{
- nvDebugCheck( A.isSquare() );
- nvDebugCheck( A.width() == b.dimension() );
- nvDebugCheck( A.width() == x.dimension() );
-
- int i = 0;
- const int D = A.width();
- const int i_max = 4 * D; // Convergence should be linear, but in some cases, it's not.
-
- FullVector r(D); // residual
- FullVector p(D); // search direction
- FullVector q(D); //
- FullVector s(D); // preconditioned
- float delta_0;
- float delta_old;
- float delta_new;
- float alpha;
- float beta;
-
- // r = b - A·x
- copy(b, r);
- sgemv(-1, A, x, 1, r);
-
-
- // p = M^-1 · r
- preconditioner.apply(r, p);
- //copy(r, p);
-
-
- delta_new = dot(r, p);
- delta_0 = delta_new;
-
- while (i < i_max && delta_new > epsilon*epsilon*delta_0)
- {
- i++;
-
- // q = A·p
- mult(A, p, q);
-
- // alpha = delta_new / p·q
- alpha = delta_new / dot(p, q);
-
- // x = alfa·p + x
- saxpy(alpha, p, x);
-
- if ((i & 31) == 0) // recompute r after 32 steps
- {
- // r = b - A·x
- copy(b, r);
- sgemv(-1, A, x, 1, r);
- }
- else
- {
- // r = r - alfa·q
- saxpy(-alpha, q, r);
- }
-
- // s = M^-1 · r
- preconditioner.apply(r, s);
- //copy(r, s);
-
- delta_old = delta_new;
- delta_new = dot( r, s );
-
- beta = delta_new / delta_old;
-
- // p = s + beta·p
- scal(beta, p);
- saxpy(1, s, p);
- }
-
- return i;
-}
-
-
-#if 0 // Nonsymmetric solvers
-
-/** Bi-conjugate gradient method. */
-MATHLIB_API int BiConjugateGradientSolve( const SparseMatrix &A, const DenseVector &b, DenseVector &x, float epsilon ) {
- piDebugCheck( A.IsSquare() );
- piDebugCheck( A.Width() == b.Dim() );
- piDebugCheck( A.Width() == x.Dim() );
-
- int i = 0;
- const int D = A.Width();
- const int i_max = 4 * D;
-
- float resid;
- float rho_1 = 0;
- float rho_2 = 0;
- float alpha;
- float beta;
-
- DenseVector r(D);
- DenseVector rtilde(D);
- DenseVector p(D);
- DenseVector ptilde(D);
- DenseVector q(D);
- DenseVector qtilde(D);
- DenseVector tmp(D); // temporal vector.
-
- // r = b - A·x;
- A.Product( x, tmp );
- r.Sub( b, tmp );
-
- // rtilde = r
- rtilde.Set( r );
-
- // p = r;
- p.Set( r );
-
- // ptilde = rtilde
- ptilde.Set( rtilde );
-
-
-
- float normb = b.Norm();
- if( normb == 0.0 ) normb = 1;
-
- // test convergence
- resid = r.Norm() / normb;
- if( resid < epsilon ) {
- // method converges?
- return 0;
- }
-
-
- while( i < i_max ) {
-
- i++;
-
- rho_1 = DenseVectorDotProduct( r, rtilde );
-
- if( rho_1 == 0 ) {
- // method fails.
- return -i;
- }
-
- if (i == 1) {
- p.Set( r );
- ptilde.Set( rtilde );
- }
- else {
- beta = rho_1 / rho_2;
-
- // p = r + beta * p;
- p.Mad( r, p, beta );
-
- // ptilde = ztilde + beta * ptilde;
- ptilde.Mad( rtilde, ptilde, beta );
- }
-
- // q = A * p;
- A.Product( p, q );
-
- // qtilde = A^t * ptilde;
- A.TransProduct( ptilde, qtilde );
-
- alpha = rho_1 / DenseVectorDotProduct( ptilde, q );
-
- // x += alpha * p;
- x.Mad( x, p, alpha );
-
- // r -= alpha * q;
- r.Mad( r, q, -alpha );
-
- // rtilde -= alpha * qtilde;
- rtilde.Mad( rtilde, qtilde, -alpha );
-
- rho_2 = rho_1;
-
- // test convergence
- resid = r.Norm() / normb;
- if( resid < epsilon ) {
- // method converges
- return i;
- }
- }
-
- return i;
-}
-
-
-/** Bi-conjugate gradient stabilized method. */
-int BiCGSTABSolve( const SparseMatrix &A, const DenseVector &b, DenseVector &x, float epsilon ) {
- piDebugCheck( A.IsSquare() );
- piDebugCheck( A.Width() == b.Dim() );
- piDebugCheck( A.Width() == x.Dim() );
-
- int i = 0;
- const int D = A.Width();
- const int i_max = 2 * D;
-
-
- float resid;
- float rho_1 = 0;
- float rho_2 = 0;
- float alpha = 0;
- float beta = 0;
- float omega = 0;
-
- DenseVector p(D);
- DenseVector phat(D);
- DenseVector s(D);
- DenseVector shat(D);
- DenseVector t(D);
- DenseVector v(D);
-
- DenseVector r(D);
- DenseVector rtilde(D);
-
- DenseVector tmp(D);
-
- // r = b - A·x;
- A.Product( x, tmp );
- r.Sub( b, tmp );
-
- // rtilde = r
- rtilde.Set( r );
-
-
- float normb = b.Norm();
- if( normb == 0.0 ) normb = 1;
-
- // test convergence
- resid = r.Norm() / normb;
- if( resid < epsilon ) {
- // method converges?
- return 0;
- }
-
-
- while( i<i_max ) {
-
- i++;
-
- rho_1 = DenseVectorDotProduct( rtilde, r );
- if( rho_1 == 0 ) {
- // method fails
- return -i;
- }
-
-
- if( i == 1 ) {
- p.Set( r );
- }
- else {
- beta = (rho_1 / rho_2) * (alpha / omega);
-
- // p = r + beta * (p - omega * v);
- p.Mad( p, v, -omega );
- p.Mad( r, p, beta );
- }
-
- //phat = M.solve(p);
- phat.Set( p );
- //Precond( &phat, p );
-
- //v = A * phat;
- A.Product( phat, v );
-
- alpha = rho_1 / DenseVectorDotProduct( rtilde, v );
-
- // s = r - alpha * v;
- s.Mad( r, v, -alpha );
-
-
- resid = s.Norm() / normb;
- if( resid < epsilon ) {
- // x += alpha * phat;
- x.Mad( x, phat, alpha );
- return i;
- }
-
- //shat = M.solve(s);
- shat.Set( s );
- //Precond( &shat, s );
-
- //t = A * shat;
- A.Product( shat, t );
-
- omega = DenseVectorDotProduct( t, s ) / DenseVectorDotProduct( t, t );
-
- // x += alpha * phat + omega * shat;
- x.Mad( x, shat, omega );
- x.Mad( x, phat, alpha );
-
- //r = s - omega * t;
- r.Mad( s, t, -omega );
-
- rho_2 = rho_1;
-
- resid = r.Norm() / normb;
- if( resid < epsilon ) {
- return i;
- }
-
- if( omega == 0 ) {
- return -i; // ???
- }
- }
-
- return i;
-}
-
-
-/** Bi-conjugate gradient stabilized method. */
-int BiCGSTABPrecondSolve( const SparseMatrix &A, const DenseVector &b, DenseVector &x, const IPreconditioner &M, float epsilon ) {
- piDebugCheck( A.IsSquare() );
- piDebugCheck( A.Width() == b.Dim() );
- piDebugCheck( A.Width() == x.Dim() );
-
- int i = 0;
- const int D = A.Width();
- const int i_max = D;
-// const int i_max = 1000;
-
-
- float resid;
- float rho_1 = 0;
- float rho_2 = 0;
- float alpha = 0;
- float beta = 0;
- float omega = 0;
-
- DenseVector p(D);
- DenseVector phat(D);
- DenseVector s(D);
- DenseVector shat(D);
- DenseVector t(D);
- DenseVector v(D);
-
- DenseVector r(D);
- DenseVector rtilde(D);
-
- DenseVector tmp(D);
-
- // r = b - A·x;
- A.Product( x, tmp );
- r.Sub( b, tmp );
-
- // rtilde = r
- rtilde.Set( r );
-
-
- float normb = b.Norm();
- if( normb == 0.0 ) normb = 1;
-
- // test convergence
- resid = r.Norm() / normb;
- if( resid < epsilon ) {
- // method converges?
- return 0;
- }
-
-
- while( i<i_max ) {
-
- i++;
-
- rho_1 = DenseVectorDotProduct( rtilde, r );
- if( rho_1 == 0 ) {
- // method fails
- return -i;
- }
-
-
- if( i == 1 ) {
- p.Set( r );
- }
- else {
- beta = (rho_1 / rho_2) * (alpha / omega);
-
- // p = r + beta * (p - omega * v);
- p.Mad( p, v, -omega );
- p.Mad( r, p, beta );
- }
-
- //phat = M.solve(p);
- //phat.Set( p );
- M.Precond( &phat, p );
-
- //v = A * phat;
- A.Product( phat, v );
-
- alpha = rho_1 / DenseVectorDotProduct( rtilde, v );
-
- // s = r - alpha * v;
- s.Mad( r, v, -alpha );
-
-
- resid = s.Norm() / normb;
-
- //printf( "--- Iteration %d: residual = %f\n", i, resid );
-
- if( resid < epsilon ) {
- // x += alpha * phat;
- x.Mad( x, phat, alpha );
- return i;
- }
-
- //shat = M.solve(s);
- //shat.Set( s );
- M.Precond( &shat, s );
-
- //t = A * shat;
- A.Product( shat, t );
-
- omega = DenseVectorDotProduct( t, s ) / DenseVectorDotProduct( t, t );
-
- // x += alpha * phat + omega * shat;
- x.Mad( x, shat, omega );
- x.Mad( x, phat, alpha );
-
- //r = s - omega * t;
- r.Mad( s, t, -omega );
-
- rho_2 = rho_1;
-
- resid = r.Norm() / normb;
- if( resid < epsilon ) {
- return i;
- }
-
- if( omega == 0 ) {
- return -i; // ???
- }
- }
-
- return i;
-}
-
-#endif
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Solver.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Solver.h
deleted file mode 100644
index 066a23d2..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Solver.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_SOLVER_H
-#define NV_MATH_SOLVER_H
-
-#include <nvmath/Sparse.h>
-
-namespace nv
-{
-
- // Linear solvers.
- NVMATH_API void LeastSquaresSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon = 1e-5f);
- NVMATH_API void LeastSquaresSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, const uint * lockedParameters, uint lockedCount, float epsilon = 1e-5f);
- NVMATH_API void SymmetricSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon = 1e-5f);
-// NVMATH_API void NonSymmetricSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon = 1e-5f);
-
-} // nv namespace
-
-
-#endif // NV_MATH_SOLVER_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Sparse.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Sparse.cpp
deleted file mode 100644
index 47e7c71c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Sparse.cpp
+++ /dev/null
@@ -1,862 +0,0 @@
-// This code is in the public domain -- Ignacio Castaño <castanyo@yahoo.es>
-
-#include <nvmath/Sparse.h>
-#include <nvmath/KahanSum.h>
-
-using namespace nv;
-
-
-/// Ctor.
-FullVector::FullVector(uint dim)
-{
- m_array.resize(dim);
-}
-
-/// Copy ctor.
-FullVector::FullVector(const FullVector & v) : m_array(v.m_array)
-{
-}
-
-/// Copy operator
-const FullVector & FullVector::operator=(const FullVector & v)
-{
- nvCheck(dimension() == v.dimension());
-
- m_array = v.m_array;
-
- return *this;
-}
-
-
-void FullVector::fill(float f)
-{
- const uint dim = dimension();
- for (uint i = 0; i < dim; i++)
- {
- m_array[i] = f;
- }
-}
-
-void FullVector::operator+= (const FullVector & v)
-{
- nvDebugCheck(dimension() == v.dimension());
-
- const uint dim = dimension();
- for (uint i = 0; i < dim; i++)
- {
- m_array[i] += v.m_array[i];
- }
-}
-
-void FullVector::operator-= (const FullVector & v)
-{
- nvDebugCheck(dimension() == v.dimension());
-
- const uint dim = dimension();
- for (uint i = 0; i < dim; i++)
- {
- m_array[i] -= v.m_array[i];
- }
-}
-
-void FullVector::operator*= (const FullVector & v)
-{
- nvDebugCheck(dimension() == v.dimension());
-
- const uint dim = dimension();
- for (uint i = 0; i < dim; i++)
- {
- m_array[i] *= v.m_array[i];
- }
-}
-
-void FullVector::operator+= (float f)
-{
- const uint dim = dimension();
- for (uint i = 0; i < dim; i++)
- {
- m_array[i] += f;
- }
-}
-
-void FullVector::operator-= (float f)
-{
- const uint dim = dimension();
- for (uint i = 0; i < dim; i++)
- {
- m_array[i] -= f;
- }
-}
-
-void FullVector::operator*= (float f)
-{
- const uint dim = dimension();
- for (uint i = 0; i < dim; i++)
- {
- m_array[i] *= f;
- }
-}
-
-
-void nv::saxpy(float a, const FullVector & x, FullVector & y)
-{
- nvDebugCheck(x.dimension() == y.dimension());
-
- const uint dim = x.dimension();
- for (uint i = 0; i < dim; i++)
- {
- y[i] += a * x[i];
- }
-}
-
-void nv::copy(const FullVector & x, FullVector & y)
-{
- nvDebugCheck(x.dimension() == y.dimension());
-
- const uint dim = x.dimension();
- for (uint i = 0; i < dim; i++)
- {
- y[i] = x[i];
- }
-}
-
-void nv::scal(float a, FullVector & x)
-{
- const uint dim = x.dimension();
- for (uint i = 0; i < dim; i++)
- {
- x[i] *= a;
- }
-}
-
-float nv::dot(const FullVector & x, const FullVector & y)
-{
- nvDebugCheck(x.dimension() == y.dimension());
-
- const uint dim = x.dimension();
-
- /*float sum = 0;
- for (uint i = 0; i < dim; i++)
- {
- sum += x[i] * y[i];
- }
- return sum;*/
-
- KahanSum kahan;
-
- for (uint i = 0; i < dim; i++)
- {
- kahan.add(x[i] * y[i]);
- }
-
- return kahan.sum();
-}
-
-
-FullMatrix::FullMatrix(uint d) : m_width(d), m_height(d)
-{
- m_array.resize(d*d, 0.0f);
-}
-
-FullMatrix::FullMatrix(uint w, uint h) : m_width(w), m_height(h)
-{
- m_array.resize(w*h, 0.0f);
-}
-
-FullMatrix::FullMatrix(const FullMatrix & m) : m_width(m.m_width), m_height(m.m_height)
-{
- m_array = m.m_array;
-}
-
-const FullMatrix & FullMatrix::operator=(const FullMatrix & m)
-{
- nvCheck(width() == m.width());
- nvCheck(height() == m.height());
-
- m_array = m.m_array;
-
- return *this;
-}
-
-
-float FullMatrix::getCoefficient(uint x, uint y) const
-{
- nvDebugCheck( x < width() );
- nvDebugCheck( y < height() );
-
- return m_array[y * width() + x];
-}
-
-void FullMatrix::setCoefficient(uint x, uint y, float f)
-{
- nvDebugCheck( x < width() );
- nvDebugCheck( y < height() );
-
- m_array[y * width() + x] = f;
-}
-
-void FullMatrix::addCoefficient(uint x, uint y, float f)
-{
- nvDebugCheck( x < width() );
- nvDebugCheck( y < height() );
-
- m_array[y * width() + x] += f;
-}
-
-void FullMatrix::mulCoefficient(uint x, uint y, float f)
-{
- nvDebugCheck( x < width() );
- nvDebugCheck( y < height() );
-
- m_array[y * width() + x] *= f;
-}
-
-float FullMatrix::dotRow(uint y, const FullVector & v) const
-{
- nvDebugCheck( v.dimension() == width() );
- nvDebugCheck( y < height() );
-
- float sum = 0;
-
- const uint count = v.dimension();
- for (uint i = 0; i < count; i++)
- {
- sum += m_array[y * count + i] * v[i];
- }
-
- return sum;
-}
-
-void FullMatrix::madRow(uint y, float alpha, FullVector & v) const
-{
- nvDebugCheck( v.dimension() == width() );
- nvDebugCheck( y < height() );
-
- const uint count = v.dimension();
- for (uint i = 0; i < count; i++)
- {
- v[i] += m_array[y * count + i];
- }
-}
-
-
-// y = M * x
-void nv::mult(const FullMatrix & M, const FullVector & x, FullVector & y)
-{
- mult(NoTransposed, M, x, y);
-}
-
-void nv::mult(Transpose TM, const FullMatrix & M, const FullVector & x, FullVector & y)
-{
- const uint w = M.width();
- const uint h = M.height();
-
- if (TM == Transposed)
- {
- nvDebugCheck( h == x.dimension() );
- nvDebugCheck( w == y.dimension() );
-
- y.fill(0.0f);
-
- for (uint i = 0; i < h; i++)
- {
- M.madRow(i, x[i], y);
- }
- }
- else
- {
- nvDebugCheck( w == x.dimension() );
- nvDebugCheck( h == y.dimension() );
-
- for (uint i = 0; i < h; i++)
- {
- y[i] = M.dotRow(i, x);
- }
- }
-}
-
-// y = alpha*A*x + beta*y
-void nv::sgemv(float alpha, const FullMatrix & A, const FullVector & x, float beta, FullVector & y)
-{
- sgemv(alpha, NoTransposed, A, x, beta, y);
-}
-
-void nv::sgemv(float alpha, Transpose TA, const FullMatrix & A, const FullVector & x, float beta, FullVector & y)
-{
- const uint w = A.width();
- const uint h = A.height();
-
- if (TA == Transposed)
- {
- nvDebugCheck( h == x.dimension() );
- nvDebugCheck( w == y.dimension() );
-
- for (uint i = 0; i < h; i++)
- {
- A.madRow(i, alpha * x[i], y);
- }
- }
- else
- {
- nvDebugCheck( w == x.dimension() );
- nvDebugCheck( h == y.dimension() );
-
- for (uint i = 0; i < h; i++)
- {
- y[i] = alpha * A.dotRow(i, x) + beta * y[i];
- }
- }
-}
-
-
-// Multiply a row of A by a column of B.
-static float dot(uint j, Transpose TA, const FullMatrix & A, uint i, Transpose TB, const FullMatrix & B)
-{
- const uint w = (TA == NoTransposed) ? A.width() : A.height();
- nvDebugCheck(w == (TB == NoTransposed) ? B.height() : A.width());
-
- float sum = 0.0f;
-
- for (uint k = 0; k < w; k++)
- {
- const float a = (TA == NoTransposed) ? A.getCoefficient(k, j) : A.getCoefficient(j, k); // @@ Move branches out of the loop?
- const float b = (TB == NoTransposed) ? B.getCoefficient(i, k) : A.getCoefficient(k, i);
- sum += a * b;
- }
-
- return sum;
-}
-
-
-// C = A * B
-void nv::mult(const FullMatrix & A, const FullMatrix & B, FullMatrix & C)
-{
- mult(NoTransposed, A, NoTransposed, B, C);
-}
-
-void nv::mult(Transpose TA, const FullMatrix & A, Transpose TB, const FullMatrix & B, FullMatrix & C)
-{
- sgemm(1.0f, TA, A, TB, B, 0.0f, C);
-}
-
-// C = alpha*A*B + beta*C
-void nv::sgemm(float alpha, const FullMatrix & A, const FullMatrix & B, float beta, FullMatrix & C)
-{
- sgemm(alpha, NoTransposed, A, NoTransposed, B, beta, C);
-}
-
-void nv::sgemm(float alpha, Transpose TA, const FullMatrix & A, Transpose TB, const FullMatrix & B, float beta, FullMatrix & C)
-{
- const uint w = C.width();
- const uint h = C.height();
-
- uint aw = (TA == NoTransposed) ? A.width() : A.height();
- uint ah = (TA == NoTransposed) ? A.height() : A.width();
- uint bw = (TB == NoTransposed) ? B.width() : B.height();
- uint bh = (TB == NoTransposed) ? B.height() : B.width();
-
- nvDebugCheck(aw == bh);
- nvDebugCheck(bw == ah);
- nvDebugCheck(w == bw);
- nvDebugCheck(h == ah);
-
- for (uint y = 0; y < h; y++)
- {
- for (uint x = 0; x < w; x++)
- {
- float c = alpha * ::dot(x, TA, A, y, TB, B) + beta * C.getCoefficient(x, y);
- C.setCoefficient(x, y, c);
- }
- }
-}
-
-
-
-
-
-/// Ctor. Init the size of the sparse matrix.
-SparseMatrix::SparseMatrix(uint d) : m_width(d)
-{
- m_array.resize(d);
-}
-
-/// Ctor. Init the size of the sparse matrix.
-SparseMatrix::SparseMatrix(uint w, uint h) : m_width(w)
-{
- m_array.resize(h);
-}
-
-SparseMatrix::SparseMatrix(const SparseMatrix & m) : m_width(m.m_width)
-{
- m_array = m.m_array;
-}
-
-const SparseMatrix & SparseMatrix::operator=(const SparseMatrix & m)
-{
- nvCheck(width() == m.width());
- nvCheck(height() == m.height());
-
- m_array = m.m_array;
-
- return *this;
-}
-
-
-// x is column, y is row
-float SparseMatrix::getCoefficient(uint x, uint y) const
-{
- nvDebugCheck( x < width() );
- nvDebugCheck( y < height() );
-
- const uint count = m_array[y].count();
- for (uint i = 0; i < count; i++)
- {
- if (m_array[y][i].x == x) return m_array[y][i].v;
- }
-
- return 0.0f;
-}
-
-void SparseMatrix::setCoefficient(uint x, uint y, float f)
-{
- nvDebugCheck( x < width() );
- nvDebugCheck( y < height() );
-
- const uint count = m_array[y].count();
- for (uint i = 0; i < count; i++)
- {
- if (m_array[y][i].x == x)
- {
- m_array[y][i].v = f;
- return;
- }
- }
-
- if (f != 0.0f)
- {
- Coefficient c = { x, f };
- m_array[y].append( c );
- }
-}
-
-void SparseMatrix::addCoefficient(uint x, uint y, float f)
-{
- nvDebugCheck( x < width() );
- nvDebugCheck( y < height() );
-
- if (f != 0.0f)
- {
- const uint count = m_array[y].count();
- for (uint i = 0; i < count; i++)
- {
- if (m_array[y][i].x == x)
- {
- m_array[y][i].v += f;
- return;
- }
- }
-
- Coefficient c = { x, f };
- m_array[y].append( c );
- }
-}
-
-void SparseMatrix::mulCoefficient(uint x, uint y, float f)
-{
- nvDebugCheck( x < width() );
- nvDebugCheck( y < height() );
-
- const uint count = m_array[y].count();
- for (uint i = 0; i < count; i++)
- {
- if (m_array[y][i].x == x)
- {
- m_array[y][i].v *= f;
- return;
- }
- }
-
- if (f != 0.0f)
- {
- Coefficient c = { x, f };
- m_array[y].append( c );
- }
-}
-
-
-float SparseMatrix::sumRow(uint y) const
-{
- nvDebugCheck( y < height() );
-
- const uint count = m_array[y].count();
-
- /*float sum = 0;
- for (uint i = 0; i < count; i++)
- {
- sum += m_array[y][i].v;
- }
- return sum;*/
-
- KahanSum kahan;
-
- for (uint i = 0; i < count; i++)
- {
- kahan.add(m_array[y][i].v);
- }
-
- return kahan.sum();
-}
-
-float SparseMatrix::dotRow(uint y, const FullVector & v) const
-{
- nvDebugCheck( y < height() );
-
- const uint count = m_array[y].count();
-
- /*float sum = 0;
- for (uint i = 0; i < count; i++)
- {
- sum += m_array[y][i].v * v[m_array[y][i].x];
- }
- return sum;*/
-
- KahanSum kahan;
-
- for (uint i = 0; i < count; i++)
- {
- kahan.add(m_array[y][i].v * v[m_array[y][i].x]);
- }
-
- return kahan.sum();
-}
-
-void SparseMatrix::madRow(uint y, float alpha, FullVector & v) const
-{
- nvDebugCheck(y < height());
-
- const uint count = m_array[y].count();
- for (uint i = 0; i < count; i++)
- {
- v[m_array[y][i].x] += alpha * m_array[y][i].v;
- }
-}
-
-
-void SparseMatrix::clearRow(uint y)
-{
- nvDebugCheck( y < height() );
-
- m_array[y].clear();
-}
-
-void SparseMatrix::scaleRow(uint y, float f)
-{
- nvDebugCheck( y < height() );
-
- const uint count = m_array[y].count();
- for (uint i = 0; i < count; i++)
- {
- m_array[y][i].v *= f;
- }
-}
-
-void SparseMatrix::normalizeRow(uint y)
-{
- nvDebugCheck( y < height() );
-
- float norm = 0.0f;
-
- const uint count = m_array[y].count();
- for (uint i = 0; i < count; i++)
- {
- float f = m_array[y][i].v;
- norm += f * f;
- }
-
- scaleRow(y, 1.0f / sqrtf(norm));
-}
-
-
-void SparseMatrix::clearColumn(uint x)
-{
- nvDebugCheck(x < width());
-
- for (uint y = 0; y < height(); y++)
- {
- const uint count = m_array[y].count();
- for (uint e = 0; e < count; e++)
- {
- if (m_array[y][e].x == x)
- {
- m_array[y][e].v = 0.0f;
- break;
- }
- }
- }
-}
-
-void SparseMatrix::scaleColumn(uint x, float f)
-{
- nvDebugCheck(x < width());
-
- for (uint y = 0; y < height(); y++)
- {
- const uint count = m_array[y].count();
- for (uint e = 0; e < count; e++)
- {
- if (m_array[y][e].x == x)
- {
- m_array[y][e].v *= f;
- break;
- }
- }
- }
-}
-
-const Array<SparseMatrix::Coefficient> & SparseMatrix::getRow(uint y) const
-{
- return m_array[y];
-}
-
-
-// y = M * x
-void nv::mult(const SparseMatrix & M, const FullVector & x, FullVector & y)
-{
- mult(NoTransposed, M, x, y);
-}
-
-void nv::mult(Transpose TM, const SparseMatrix & M, const FullVector & x, FullVector & y)
-{
- const uint w = M.width();
- const uint h = M.height();
-
- if (TM == Transposed)
- {
- nvDebugCheck( h == x.dimension() );
- nvDebugCheck( w == y.dimension() );
-
- y.fill(0.0f);
-
- for (uint i = 0; i < h; i++)
- {
- M.madRow(i, x[i], y);
- }
- }
- else
- {
- nvDebugCheck( w == x.dimension() );
- nvDebugCheck( h == y.dimension() );
-
- for (uint i = 0; i < h; i++)
- {
- y[i] = M.dotRow(i, x);
- }
- }
-}
-
-// y = alpha*A*x + beta*y
-void nv::sgemv(float alpha, const SparseMatrix & A, const FullVector & x, float beta, FullVector & y)
-{
- sgemv(alpha, NoTransposed, A, x, beta, y);
-}
-
-void nv::sgemv(float alpha, Transpose TA, const SparseMatrix & A, const FullVector & x, float beta, FullVector & y)
-{
- const uint w = A.width();
- const uint h = A.height();
-
- if (TA == Transposed)
- {
- nvDebugCheck( h == x.dimension() );
- nvDebugCheck( w == y.dimension() );
-
- for (uint i = 0; i < h; i++)
- {
- A.madRow(i, alpha * x[i], y);
- }
- }
- else
- {
- nvDebugCheck( w == x.dimension() );
- nvDebugCheck( h == y.dimension() );
-
- for (uint i = 0; i < h; i++)
- {
- y[i] = alpha * A.dotRow(i, x) + beta * y[i];
- }
- }
-}
-
-
-// dot y-row of A by x-column of B
-static float dotRowColumn(int y, const SparseMatrix & A, int x, const SparseMatrix & B)
-{
- const Array<SparseMatrix::Coefficient> & row = A.getRow(y);
-
- const uint count = row.count();
-
- /*float sum = 0.0f;
- for (uint i = 0; i < count; i++)
- {
- const SparseMatrix::Coefficient & c = row[i];
- sum += c.v * B.getCoefficient(x, c.x);
- }
- return sum;*/
-
- KahanSum kahan;
- for (uint i = 0; i < count; i++)
- {
- const SparseMatrix::Coefficient & c = row[i];
- kahan.add(c.v * B.getCoefficient(x, c.x));
- }
-
- return kahan.sum();
-}
-
-// dot y-row of A by x-row of B
-static float dotRowRow(int y, const SparseMatrix & A, int x, const SparseMatrix & B)
-{
- const Array<SparseMatrix::Coefficient> & row = A.getRow(y);
-
- const uint count = row.count();
-
- /*float sum = 0.0f;
- for (uint i = 0; i < count; i++)
- {
- const SparseMatrix::Coefficient & c = row[i];
- sum += c.v * B.getCoefficient(c.x, x);
- }
- //return sum;*/
-
- KahanSum kahan;
- for (uint i = 0; i < count; i++)
- {
- const SparseMatrix::Coefficient & c = row[i];
- kahan.add(c.v * B.getCoefficient(c.x, x));
- }
-
- return kahan.sum();
-}
-
-// dot y-column of A by x-column of B
-static float dotColumnColumn(int y, const SparseMatrix & A, int x, const SparseMatrix & B)
-{
- nvDebugCheck(A.height() == B.height());
-
- const uint h = A.height();
-
- /*float sum = 0.0f;
- for (uint i = 0; i < h; i++)
- {
- sum += A.getCoefficient(y, i) * B.getCoefficient(x, i);
- }
- //return sum;*/
-
- KahanSum kahan;
- for (uint i = 0; i < h; i++)
- {
- kahan.add(A.getCoefficient(y, i) * B.getCoefficient(x, i));
- }
-
- return kahan.sum();
-}
-
-
-void nv::transpose(const SparseMatrix & A, SparseMatrix & B)
-{
- nvDebugCheck(A.width() == B.height());
- nvDebugCheck(B.width() == A.height());
-
- const uint w = A.width();
- for (uint x = 0; x < w; x++)
- {
- B.clearRow(x);
- }
-
- const uint h = A.height();
- for (uint y = 0; y < h; y++)
- {
- const Array<SparseMatrix::Coefficient> & row = A.getRow(y);
-
- const uint count = row.count();
- for (uint i = 0; i < count; i++)
- {
- const SparseMatrix::Coefficient & c = row[i];
- nvDebugCheck(c.x < w);
-
- B.setCoefficient(y, c.x, c.v);
- }
- }
-}
-
-// C = A * B
-void nv::mult(const SparseMatrix & A, const SparseMatrix & B, SparseMatrix & C)
-{
- mult(NoTransposed, A, NoTransposed, B, C);
-}
-
-void nv::mult(Transpose TA, const SparseMatrix & A, Transpose TB, const SparseMatrix & B, SparseMatrix & C)
-{
- sgemm(1.0f, TA, A, TB, B, 0.0f, C);
-}
-
-// C = alpha*A*B + beta*C
-void nv::sgemm(float alpha, const SparseMatrix & A, const SparseMatrix & B, float beta, SparseMatrix & C)
-{
- sgemm(alpha, NoTransposed, A, NoTransposed, B, beta, C);
-}
-
-void nv::sgemm(float alpha, Transpose TA, const SparseMatrix & A, Transpose TB, const SparseMatrix & B, float beta, SparseMatrix & C)
-{
- const uint w = C.width();
- const uint h = C.height();
-
- uint aw = (TA == NoTransposed) ? A.width() : A.height();
- uint ah = (TA == NoTransposed) ? A.height() : A.width();
- uint bw = (TB == NoTransposed) ? B.width() : B.height();
- uint bh = (TB == NoTransposed) ? B.height() : B.width();
-
- nvDebugCheck(aw == bh);
- nvDebugCheck(bw == ah);
- nvDebugCheck(w == bw);
- nvDebugCheck(h == ah);
-
-
- for (uint y = 0; y < h; y++)
- {
- for (uint x = 0; x < w; x++)
- {
- float c = beta * C.getCoefficient(x, y);
-
- if (TA == NoTransposed && TB == NoTransposed)
- {
- // dot y-row of A by x-column of B.
- c += alpha * dotRowColumn(y, A, x, B);
- }
- else if (TA == Transposed && TB == Transposed)
- {
- // dot y-column of A by x-row of B.
- c += alpha * dotRowColumn(x, B, y, A);
- }
- else if (TA == Transposed && TB == NoTransposed)
- {
- // dot y-column of A by x-column of B.
- c += alpha * dotColumnColumn(y, A, x, B);
- }
- else if (TA == NoTransposed && TB == Transposed)
- {
- // dot y-row of A by x-row of B.
- c += alpha * dotRowRow(y, A, x, B);
- }
-
- C.setCoefficient(x, y, c);
- }
- }
-}
-
-// C = At * A
-void nv::sqm(const SparseMatrix & A, SparseMatrix & C)
-{
- // This is quite expensive...
- mult(Transposed, A, NoTransposed, A, C);
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Sparse.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Sparse.h
deleted file mode 100644
index 54a2cc85..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Sparse.h
+++ /dev/null
@@ -1,200 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_SPARSE_H
-#define NV_MATH_SPARSE_H
-
-#include <nvcore/Containers.h>
-#include <nvmath/nvmath.h>
-
-// Full and sparse vector and matrix classes. BLAS subset.
-
-namespace nv
-{
- class FullVector;
- class FullMatrix;
- class SparseMatrix;
-
-
- /// Fixed size vector class.
- class FullVector
- {
- public:
-
- FullVector(uint dim);
- FullVector(const FullVector & v);
-
- const FullVector & operator=(const FullVector & v);
-
- uint dimension() const { return m_array.count(); }
-
- const float & operator[]( uint index ) const { return m_array[index]; }
- float & operator[] ( uint index ) { return m_array[index]; }
-
- void fill(float f);
-
- void operator+= (const FullVector & v);
- void operator-= (const FullVector & v);
- void operator*= (const FullVector & v);
-
- void operator+= (float f);
- void operator-= (float f);
- void operator*= (float f);
-
-
- private:
-
- Array<float> m_array;
-
- };
-
- // Pseudo-BLAS interface.
- NVMATH_API void saxpy(float a, const FullVector & x, FullVector & y); // y = a * x + y
- NVMATH_API void copy(const FullVector & x, FullVector & y);
- NVMATH_API void scal(float a, FullVector & x);
- NVMATH_API float dot(const FullVector & x, const FullVector & y);
-
-
- enum Transpose
- {
- NoTransposed = 0,
- Transposed = 1
- };
-
- /// Full matrix class.
- class FullMatrix
- {
- public:
-
- FullMatrix(uint d);
- FullMatrix(uint w, uint h);
- FullMatrix(const FullMatrix & m);
-
- const FullMatrix & operator=(const FullMatrix & m);
-
- uint width() const { return m_width; }
- uint height() const { return m_height; }
- bool isSquare() const { return m_width == m_height; }
-
- float getCoefficient(uint x, uint y) const;
-
- void setCoefficient(uint x, uint y, float f);
- void addCoefficient(uint x, uint y, float f);
- void mulCoefficient(uint x, uint y, float f);
-
- float dotRow(uint y, const FullVector & v) const;
- void madRow(uint y, float alpha, FullVector & v) const;
-
- protected:
-
- bool isValid() const {
- return m_array.size() == (m_width * m_height);
- }
-
- private:
-
- const uint m_width;
- const uint m_height;
- Array<float> m_array;
-
- };
-
- NVMATH_API void mult(const FullMatrix & M, const FullVector & x, FullVector & y);
- NVMATH_API void mult(Transpose TM, const FullMatrix & M, const FullVector & x, FullVector & y);
-
- // y = alpha*A*x + beta*y
- NVMATH_API void sgemv(float alpha, const FullMatrix & A, const FullVector & x, float beta, FullVector & y);
- NVMATH_API void sgemv(float alpha, Transpose TA, const FullMatrix & A, const FullVector & x, float beta, FullVector & y);
-
- NVMATH_API void mult(const FullMatrix & A, const FullMatrix & B, FullMatrix & C);
- NVMATH_API void mult(Transpose TA, const FullMatrix & A, Transpose TB, const FullMatrix & B, FullMatrix & C);
-
- // C = alpha*A*B + beta*C
- NVMATH_API void sgemm(float alpha, const FullMatrix & A, const FullMatrix & B, float beta, FullMatrix & C);
- NVMATH_API void sgemm(float alpha, Transpose TA, const FullMatrix & A, Transpose TB, const FullMatrix & B, float beta, FullMatrix & C);
-
-
- /**
- * Sparse matrix class. The matrix is assumed to be sparse and to have
- * very few non-zero elements, for this reason it's stored in indexed
- * format. To multiply column vectors efficiently, the matrix stores
- * the elements in indexed-column order, there is a list of indexed
- * elements for each row of the matrix. As with the FullVector the
- * dimension of the matrix is constant.
- **/
- class SparseMatrix
- {
- friend class FullMatrix;
- public:
-
- // An element of the sparse array.
- struct Coefficient {
- uint x; // column
- float v; // value
- };
-
-
- public:
-
- SparseMatrix(uint d);
- SparseMatrix(uint w, uint h);
- SparseMatrix(const SparseMatrix & m);
-
- const SparseMatrix & operator=(const SparseMatrix & m);
-
-
- uint width() const { return m_width; }
- uint height() const { return m_array.count(); }
- bool isSquare() const { return width() == height(); }
-
- float getCoefficient(uint x, uint y) const; // x is column, y is row
-
- void setCoefficient(uint x, uint y, float f);
- void addCoefficient(uint x, uint y, float f);
- void mulCoefficient(uint x, uint y, float f);
-
- float sumRow(uint y) const;
- float dotRow(uint y, const FullVector & v) const;
- void madRow(uint y, float alpha, FullVector & v) const;
-
- void clearRow(uint y);
- void scaleRow(uint y, float f);
- void normalizeRow(uint y);
-
- void clearColumn(uint x);
- void scaleColumn(uint x, float f);
-
- const Array<Coefficient> & getRow(uint y) const;
-
- private:
-
- /// Number of columns.
- const uint m_width;
-
- /// Array of matrix elements.
- Array< Array<Coefficient> > m_array;
-
- };
-
- NVMATH_API void transpose(const SparseMatrix & A, SparseMatrix & B);
-
- NVMATH_API void mult(const SparseMatrix & M, const FullVector & x, FullVector & y);
- NVMATH_API void mult(Transpose TM, const SparseMatrix & M, const FullVector & x, FullVector & y);
-
- // y = alpha*A*x + beta*y
- NVMATH_API void sgemv(float alpha, const SparseMatrix & A, const FullVector & x, float beta, FullVector & y);
- NVMATH_API void sgemv(float alpha, Transpose TA, const SparseMatrix & A, const FullVector & x, float beta, FullVector & y);
-
- NVMATH_API void mult(const SparseMatrix & A, const SparseMatrix & B, SparseMatrix & C);
- NVMATH_API void mult(Transpose TA, const SparseMatrix & A, Transpose TB, const SparseMatrix & B, SparseMatrix & C);
-
- // C = alpha*A*B + beta*C
- NVMATH_API void sgemm(float alpha, const SparseMatrix & A, const SparseMatrix & B, float beta, SparseMatrix & C);
- NVMATH_API void sgemm(float alpha, Transpose TA, const SparseMatrix & A, Transpose TB, const SparseMatrix & B, float beta, SparseMatrix & C);
-
- // C = At * A
- NVMATH_API void sqm(const SparseMatrix & A, SparseMatrix & C);
-
-} // nv namespace
-
-
-#endif // NV_MATH_SPARSE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/SphericalHarmonic.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/SphericalHarmonic.cpp
deleted file mode 100644
index e632bcbc..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/SphericalHarmonic.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvmath/SphericalHarmonic.h>
-
-using namespace nv;
-
-
-namespace
-{
-
- // Basic integer factorial.
- inline static int factorial( int v )
- {
- const static int fac_table[] = { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800 };
-
- if(v <= 11){
- return fac_table[v];
- }
-
- int result = v;
- while (--v > 0) {
- result *= v;
- }
- return result;
- }
-
-
- // Double factorial.
- // Defined as: n!! = n*(n - 2)*(n - 4)..., n!!(0,-1) = 1.
- inline static int doubleFactorial( int x )
- {
- if (x == 0 || x == -1) {
- return 1;
- }
-
- int result = x;
- while ((x -= 2) > 0) {
- result *= x;
- }
-
- return result;
- }
-
- /// Normalization constant for spherical harmonic.
- /// @param l is the band.
- /// @param m is the argument, in the range [0, m]
- inline static float K( int l, int m )
- {
- nvDebugCheck( m >= 0 );
- return sqrtf(((2 * l + 1) * factorial(l - m)) / (4 * PI * factorial(l + m)));
- }
-
- /// Normalization constant for hemispherical harmonic.
- inline static float HK( int l, int m )
- {
- nvDebugCheck( m >= 0 );
- return sqrtf(((2 * l + 1) * factorial(l - m)) / (2 * PI * factorial(l + m)));
- }
-
- /// Evaluate Legendre polynomial. */
- static float legendre( int l, int m, float x )
- {
- // piDebugCheck( m >= 0 );
- // piDebugCheck( m <= l );
- // piDebugCheck( fabs(x) <= 1 );
-
- // Rule 2 needs no previous results
- if (l == m) {
- return powf(-1.0f, float(m)) * doubleFactorial(2 * m - 1) * powf(1 - x*x, 0.5f * m);
- }
-
- // Rule 3 requires the result for the same argument of the previous band
- if (l == m + 1) {
- return x * (2 * m + 1) * legendrePolynomial(m, m, x);
- }
-
- // Main reccurence used by rule 1 that uses result of the same argument from
- // the previous two bands
- return (x * (2 * l - 1) * legendrePolynomial(l - 1, m, x) - (l + m - 1) * legendrePolynomial(l - 2, m, x)) / (l - m);
- }
-
-
- template <int l, int m> float legendre(float x);
-
- template <> float legendre<0, 0>(float ) {
- return 1;
- }
-
- template <> float legendre<1, 0>(float x) {
- return x;
- }
- template <> float legendre<1, 1>(float x) {
- return -sqrtf(1 - x * x);
- }
-
- template <> float legendre<2, 0>(float x) {
- return -0.5f + (3 * x * x) / 2;
- }
- template <> float legendre<2, 1>(float x) {
- return -3 * x * sqrtf(1 - x * x);
- }
- template <> float legendre<2, 2>(float x) {
- return -3 * (-1 + x * x);
- }
-
- template <> float legendre<3, 0>(float x) {
- return -(3 * x) / 2 + (5 * x * x * x) / 2;
- }
- template <> float legendre<3, 1>(float x) {
- return -3 * sqrtf(1 - x * x) / 2 * (-1 + 5 * x * x);
- }
- template <> float legendre<3, 2>(float x) {
- return -15 * (-x + x * x * x);
- }
- template <> float legendre<3, 3>(float x) {
- return -15 * powf(1 - x * x, 1.5f);
- }
-
- template <> float legendre<4, 0>(float x) {
- return 0.125f * (3.0f - 30.0f * x * x + 35.0f * x * x * x * x);
- }
- template <> float legendre<4, 1>(float x) {
- return -2.5f * x * sqrtf(1.0f - x * x) * (7.0f * x * x - 3.0f);
- }
- template <> float legendre<4, 2>(float x) {
- return -7.5f * (1.0f - 8.0f * x * x + 7.0f * x * x * x * x);
- }
- template <> float legendre<4, 3>(float x) {
- return -105.0f * x * powf(1 - x * x, 1.5f);
- }
- template <> float legendre<4, 4>(float x) {
- return 105.0f * (x * x - 1.0f) * (x * x - 1.0f);
- }
-
-} // namespace
-
-
-float nv::legendrePolynomial(int l, int m, float x)
-{
- switch(l)
- {
- case 0:
- return legendre<0, 0>(x);
- case 1:
- if(m == 0) return legendre<1, 0>(x);
- return legendre<1, 1>(x);
- case 2:
- if(m == 0) return legendre<2, 0>(x);
- else if(m == 1) return legendre<2, 1>(x);
- return legendre<2, 2>(x);
- case 3:
- if(m == 0) return legendre<3, 0>(x);
- else if(m == 1) return legendre<3, 1>(x);
- else if(m == 2) return legendre<3, 2>(x);
- return legendre<3, 3>(x);
- case 4:
- if(m == 0) return legendre<4, 0>(x);
- else if(m == 1) return legendre<4, 1>(x);
- else if(m == 2) return legendre<4, 2>(x);
- else if(m == 3) return legendre<4, 3>(x);
- else return legendre<4, 4>(x);
- }
-
- // Fallback to the expensive version.
- return legendre(l, m, x);
-}
-
-
-/**
- * Evaluate the spherical harmonic function for the given angles.
- * @param l is the band.
- * @param m is the argument, in the range [-l,l]
- * @param theta is the altitude, in the range [0, PI]
- * @param phi is the azimuth, in the range [0, 2*PI]
- */
-float nv::y( int l, int m, float theta, float phi )
-{
- if( m == 0 ) {
- // K(l, 0) = sqrt((2*l+1)/(4*PI))
- return sqrtf((2 * l + 1) / (4 * PI)) * legendrePolynomial(l, 0, cosf(theta));
- }
- else if( m > 0 ) {
- return sqrtf(2.0f) * K(l, m) * cosf(m * phi) * legendrePolynomial(l, m, cosf(theta));
- }
- else {
- return sqrtf(2.0f) * K(l, -m) * sinf(-m * phi) * legendrePolynomial(l, -m, cosf(theta));
- }
-}
-
-
-/**
- * Real spherical harmonic function of an unit vector. Uses the following
- * equalities to call the angular function:
- * x = sin(theta)*cos(phi)
- * y = sin(theta)*sin(phi)
- * z = cos(theta)
- */
-float nv::y( int l, int m, Vector3::Arg v )
-{
- float theta = acosf(v.z());
- float phi = atan2f(v.y(), v.x());
- return y( l, m, theta, phi );
-}
-
-
-/**
- * Evaluate the hemispherical harmonic function for the given angles.
- * @param l is the band.
- * @param m is the argument, in the range [-l,l]
- * @param theta is the altitude, in the range [0, PI/2]
- * @param phi is the azimuth, in the range [0, 2*PI]
- */
-float nv::hy( int l, int m, float theta, float phi )
-{
- if( m == 0 ) {
- // HK(l, 0) = sqrt((2*l+1)/(2*PI))
- return sqrtf((2 * l + 1) / (2 * PI)) * legendrePolynomial(l, 0, 2*cosf(theta)-1);
- }
- else if( m > 0 ) {
- return sqrtf(2.0f) * HK(l, m) * cosf(m * phi) * legendrePolynomial(l, m, 2*cosf(theta)-1);
- }
- else {
- return sqrtf(2.0f) * HK(l, -m) * sinf(-m * phi) * legendrePolynomial(l, -m, 2*cosf(theta)-1);
- }
-}
-
-
-/**
- * Real hemispherical harmonic function of an unit vector. Uses the following
- * equalities to call the angular function:
- * x = sin(theta)*cos(phi)
- * y = sin(theta)*sin(phi)
- * z = cos(theta)
- */
-float nv::hy( int l, int m, Vector3::Arg v )
-{
- float theta = acosf(v.z());
- float phi = atan2f(v.y(), v.x());
- return y( l, m, theta, phi );
-}
-
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/SphericalHarmonic.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/SphericalHarmonic.h
deleted file mode 100644
index a925d938..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/SphericalHarmonic.h
+++ /dev/null
@@ -1,420 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_SPHERICALHARMONIC_H
-#define NV_MATH_SPHERICALHARMONIC_H
-
-#include <string.h> // memcpy
-#include <nvmath/Vector.h>
-
-namespace nv
-{
-
- NVMATH_API float legendrePolynomial( int l, int m, float x ) NV_CONST;
- NVMATH_API float y( int l, int m, float theta, float phi ) NV_CONST;
- NVMATH_API float y( int l, int m, Vector3::Arg v ) NV_CONST;
- NVMATH_API float hy( int l, int m, float theta, float phi ) NV_CONST;
- NVMATH_API float hy( int l, int m, Vector3::Arg v ) NV_CONST;
-
- class Sh;
- float dot(const Sh & a, const Sh & b) NV_CONST;
-
-
- /// Spherical harmonic class.
- class Sh
- {
- friend class Sh2;
- friend class ShMatrix;
- public:
-
- /// Construct a spherical harmonic of the given order.
- Sh(int o) : m_order(o)
- {
- m_elemArray = new float[basisNum()];
- }
-
- /// Copy constructor.
- Sh(const Sh & sh) : m_order(sh.order())
- {
- m_elemArray = new float[basisNum()];
- memcpy(m_elemArray, sh.m_elemArray, sizeof(float) * basisNum());
- }
-
- /// Destructor.
- ~Sh()
- {
- delete [] m_elemArray;
- m_elemArray = NULL;
- }
-
- /// Get number of bands.
- static int bandNum(int order) {
- return order + 1;
- }
-
- /// Get number of sh basis.
- static int basisNum(int order) {
- return (order + 1) * (order + 1);
- }
-
- /// Get the index for the given coefficients.
- static int index( int l, int m ) {
- return l * l + l + m;
- }
-
- /// Get sh order.
- int order() const
- {
- return m_order;
- }
-
- /// Get sh order.
- int bandNum() const
- {
- return bandNum(m_order);
- }
-
- /// Get sh order.
- int basisNum() const
- {
- return basisNum(m_order);
- }
-
- /// Get sh coefficient indexed by l,m.
- float elem( int l, int m ) const
- {
- return m_elemArray[index(l, m)];
- }
-
- /// Get sh coefficient indexed by l,m.
- float & elem( int l, int m )
- {
- return m_elemArray[index(l, m)];
- }
-
-
- /// Get sh coefficient indexed by i.
- float elemAt( int i ) const {
- return m_elemArray[i];
- }
-
- /// Get sh coefficient indexed by i.
- float & elemAt( int i )
- {
- return m_elemArray[i];
- }
-
-
- /// Reset the sh coefficients.
- void reset()
- {
- for( int i = 0; i < basisNum(); i++ ) {
- m_elemArray[i] = 0.0f;
- }
- }
-
- /// Copy spherical harmonic.
- void operator= ( const Sh & sh )
- {
- nvDebugCheck(order() <= sh.order());
-
- for(int i = 0; i < basisNum(); i++) {
- m_elemArray[i] = sh.m_elemArray[i];
- }
- }
-
- /// Add spherical harmonics.
- void operator+= ( const Sh & sh )
- {
- nvDebugCheck(order() == sh.order());
-
- for(int i = 0; i < basisNum(); i++) {
- m_elemArray[i] += sh.m_elemArray[i];
- }
- }
-
- /// Substract spherical harmonics.
- void operator-= ( const Sh & sh )
- {
- nvDebugCheck(order() == sh.order());
-
- for(int i = 0; i < basisNum(); i++) {
- m_elemArray[i] -= sh.m_elemArray[i];
- }
- }
-
- // Not exactly convolution, nor product.
- void operator*= ( const Sh & sh )
- {
- nvDebugCheck(order() == sh.order());
-
- for(int i = 0; i < basisNum(); i++) {
- m_elemArray[i] *= sh.m_elemArray[i];
- }
- }
-
- /// Scale spherical harmonics.
- void operator*= ( float f )
- {
- for(int i = 0; i < basisNum(); i++) {
- m_elemArray[i] *= f;
- }
- }
-
- /// Add scaled spherical harmonics.
- void addScaled( const Sh & sh, float f )
- {
- nvDebugCheck(order() == sh.order());
-
- for(int i = 0; i < basisNum(); i++) {
- m_elemArray[i] += sh.m_elemArray[i] * f;
- }
- }
-
-
- /*/// Add a weighted sample to the sh coefficients.
- void AddSample( const Vec3 & dir, const Color3f & color, float w=1.0f ) {
- for(int l = 0; l <= order; l++) {
- for(int m = -l; m <= l; m++) {
- Color3f & elem = GetElem(l, m);
- elem.Mad( elem, color, w * y(l, m, dir) );
- }
- }
- }*/
-
- /// Evaluate
- void eval(Vector3::Arg dir)
- {
- for(int l = 0; l <= m_order; l++) {
- for(int m = -l; m <= l; m++) {
- elem(l, m) = y(l, m, dir);
- }
- }
- }
-
-
- /// Evaluate the spherical harmonic function.
- float sample(Vector3::Arg dir) const
- {
- Sh sh(order());
- sh.eval(dir);
-
- return dot(sh, *this);
- }
-
-
- protected:
-
- const int m_order;
- float * m_elemArray;
-
- };
-
-
- /// Compute dot product of the spherical harmonics.
- inline float dot(const Sh & a, const Sh & b)
- {
- nvDebugCheck(a.order() == b.order());
-
- float sum = 0;
- for( int i = 0; i < Sh::basisNum(a.order()); i++ ) {
- sum += a.elemAt(i) * b.elemAt(i);
- }
-
- return sum;
- }
-
-
- /// Second order spherical harmonic.
- class Sh2 : public Sh
- {
- public:
-
- /// Constructor.
- Sh2() : Sh(2) {}
-
- /// Copy constructor.
- Sh2(const Sh2 & sh) : Sh(sh) {}
-
- /// Spherical harmonic resulting from projecting the clamped cosine transfer function to the SH basis.
- void cosineTransfer()
- {
- const float c1 = 0.282095f; // K(0, 0)
- const float c2 = 0.488603f; // K(1, 0)
- const float c3 = 1.092548f; // sqrt(15.0f / PI) / 2.0f = K(2, -2)
- const float c4 = 0.315392f; // sqrt(5.0f / PI) / 4.0f) = K(2, 0)
- const float c5 = 0.546274f; // sqrt(15.0f / PI) / 4.0f) = K(2, 2)
-
- const float normalization = PI * 16.0f / 17.0f;
-
- const float const1 = c1 * normalization * 1.0f;
- const float const2 = c2 * normalization * (2.0f / 3.0f);
- const float const3 = c3 * normalization * (1.0f / 4.0f);
- const float const4 = c4 * normalization * (1.0f / 4.0f);
- const float const5 = c5 * normalization * (1.0f / 4.0f);
-
- m_elemArray[0] = const1;
-
- m_elemArray[1] = -const2;
- m_elemArray[2] = const2;
- m_elemArray[3] = -const2;
-
- m_elemArray[4] = const3;
- m_elemArray[5] = -const3;
- m_elemArray[6] = const4;
- m_elemArray[7] = -const3;
- m_elemArray[8] = const5;
- }
- };
-
-
-
-#if 0
-
-/// Spherical harmonic matrix.
-class ShMatrix
-{
-public:
-
- /// Create an identity matrix of the given order.
- ShMatrix(int o = 2) : order(o), identity(true)
- {
- nvCheck(order > 0);
- e = new float[Size()];
- band = new float *[GetBandNum()];
- setupBands();
- }
-
- /// Destroy and free matrix elements.
- ~ShMatrix()
- {
- delete e;
- delete band;
- }
-
- /// Set identity matrix.
- void setIdentity()
- {
- identity = true;
- }
-
- /// Return true if this is an identity matrix, false in other case.
- bool isIdentity() const {
- return identity;
- }
-
- /// Get number of bands of this matrix.
- int bandNum() const
- {
- return order+1;
- }
-
- /// Get total number of elements in the matrix.
- int size() const
- {
- int size = 0;
- for( int i = 0; i < bandNum(); i++ ) {
- size += SQ(i * 2 + 1);
- }
- return size;
- }
-
- /// Get element at the given raw index.
- float elem(const int idx) const
- {
- return e[idx];
- }
-
- /// Get element at the given with the given indices.
- float & elem( const int b, const int x, const int y )
- {
- nvDebugCheck(b >= 0);
- nvDebugCheck(b < bandNum());
- return band[b][(b + y) * (b * 2 + 1) + (b + x)];
- }
-
- /// Get element at the given with the given indices.
- float elem( const int b, const int x, const int y ) const
- {
- nvDebugCheck(b >= 0);
- nvDebugCheck(b < bandNum());
- return band[b][(b + y) * (b * 2 + 1) + (b + x)];
- }
-
- /** Copy matrix. */
- void Copy( const ShMatrix & m )
- {
- nvDebugCheck(order == m.order);
- memcpy(e, m.e, Size() * sizeof(float));
- }
-
- /** Rotate the given coefficients. */
- void transform( const Sh & restrict source, Sh * restrict dest ) const {
- piCheck( &source != dest ); // Make sure there's no aliasing.
- piCheck( dest->order <= order );
- piCheck( order <= source.order );
-
- if( identity ) {
- *dest = source;
- return;
- }
-
- // Loop through each band.
- for( int l = 0; l <= dest->order; l++ ) {
-
- for( int mo = -l; mo <= l; mo++ ) {
-
- Color3f rgb = Color3f::Black;
-
- for( int mi = -l; mi <= l; mi++ ) {
- rgb.Mad( rgb, source.elem(l, mi), elem(l, mo, mi) );
- }
-
- dest->elem(l, mo) = rgb;
- }
- }
- }
-
-
- MATHLIB_API void multiply( const ShMatrix &A, const ShMatrix &B );
- MATHLIB_API void rotation( const Matrix & m );
- MATHLIB_API void rotation( int axis, float angles );
- MATHLIB_API void print();
-
-
-private:
-
- // @@ These could be static indices precomputed only once.
- /// Setup the band pointers.
- void setupBands()
- {
- int size = 0;
- for( int i = 0; i < bandNum(); i++ ) {
- band[i] = &e[size];
- size += SQ(i * 2 + 1);
- }
- }
-
-
-private:
-
- // Matrix order.
- const int m_order;
-
- // Identity flag for quick transform.
- bool m_identity;
-
- // Array of elements.
- float * m_e;
-
- // Band pointers.
- float ** m_band;
-
-};
-
-#endif // 0
-
-
-
-} // nv namespace
-
-#endif // NV_MATH_SPHERICALHARMONIC_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/TriBox.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/TriBox.cpp
deleted file mode 100644
index f58af138..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/TriBox.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/********************************************************/
-/* AABB-triangle overlap test code */
-/* by Tomas Akenine-Möller */
-/* Function: int triBoxOverlap(float boxcenter[3], */
-/* float boxhalfsize[3],float triverts[3][3]); */
-/* History: */
-/* 2001-03-05: released the code in its first version */
-/* 2001-06-18: changed the order of the tests, faster */
-/* */
-/* Acknowledgement: Many thanks to Pierre Terdiman for */
-/* suggestions and discussions on how to optimize code. */
-/* Thanks to David Hunt for finding a ">="-bug! */
-/********************************************************/
-
-#include <nvmath/Vector.h>
-#include <nvmath/Triangle.h>
-
-using namespace nv;
-
-#define X 0
-#define Y 1
-#define Z 2
-
-#define FINDMINMAX(x0,x1,x2,min,max) \
- min = max = x0; \
- if(x1<min) min=x1;\
- if(x1>max) max=x1;\
- if(x2<min) min=x2;\
- if(x2>max) max=x2;
-
-
-static bool planeBoxOverlap(Vector3::Arg normal, Vector3::Arg vert, Vector3::Arg maxbox) // -NJMP-
-{
- Vector3 vmin, vmax;
-
- float signs[3] = {1, 1, 1};
- if (normal.x() <= 0.0f) signs[0] = -1;
- if (normal.y() <= 0.0f) signs[1] = -1;
- if (normal.z() <= 0.0f) signs[2] = -1;
-
- Vector3 sign(signs[0], signs[1], signs[2]);
- vmin = -scale(sign, maxbox) - vert;
- vmax = scale(sign, maxbox) - vert;
-
- if (dot(normal, vmin) > 0.0f) return false;
- if (dot(normal, vmax) >= 0.0f) return true;
-
- return false;
-}
-
-
-/*======================== X-tests ========================*/
-#define AXISTEST_X01(a, b, fa, fb) \
- p0 = a*v0.y() - b*v0.z(); \
- p2 = a*v2.y() - b*v2.z(); \
- if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \
- rad = fa * boxhalfsize.y() + fb * boxhalfsize.z(); \
- if(min>rad || max<-rad) return false;
-
-#define AXISTEST_X2(a, b, fa, fb) \
- p0 = a*v0.y() - b*v0.z(); \
- p1 = a*v1.y() - b*v1.z(); \
- if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
- rad = fa * boxhalfsize.y() + fb * boxhalfsize.z(); \
- if(min>rad || max<-rad) return false;
-
-/*======================== Y-tests ========================*/
-#define AXISTEST_Y02(a, b, fa, fb) \
- p0 = -a*v0.x() + b*v0.z(); \
- p2 = -a*v2.x() + b*v2.z(); \
- if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \
- rad = fa * boxhalfsize.x() + fb * boxhalfsize.z(); \
- if(min>rad || max<-rad) return false;
-
-#define AXISTEST_Y1(a, b, fa, fb) \
- p0 = -a*v0.x() + b*v0.z(); \
- p1 = -a*v1.x() + b*v1.z(); \
- if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
- rad = fa * boxhalfsize.x() + fb * boxhalfsize.z(); \
- if(min>rad || max<-rad) return false;
-
-/*======================== Z-tests ========================*/
-
-#define AXISTEST_Z12(a, b, fa, fb) \
- p1 = a*v1.x() - b*v1.y(); \
- p2 = a*v2.x() - b*v2.y(); \
- if(p2<p1) {min=p2; max=p1;} else {min=p1; max=p2;} \
- rad = fa * boxhalfsize.x() + fb * boxhalfsize.y(); \
- if(min>rad || max<-rad) return false;
-
-#define AXISTEST_Z0(a, b, fa, fb) \
- p0 = a*v0.x() - b*v0.y(); \
- p1 = a*v1.x() - b*v1.y(); \
- if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
- rad = fa * boxhalfsize.x() + fb * boxhalfsize.y(); \
- if(min>rad || max<-rad) return false;
-
-
-bool nv::triBoxOverlap(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const Triangle & tri)
-{
- // use separating axis theorem to test overlap between triangle and box
- // need to test for overlap in these directions:
- // 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle
- // we do not even need to test these)
- // 2) normal of the triangle
- // 3) crossproduct(edge from tri, {x,y,z}-directin)
- // this gives 3x3=9 more tests
- Vector3 v0, v1, v2;
- float min, max, p0, p1, p2, rad, fex, fey, fez;
- Vector3 normal, e0, e1, e2;
-
- // This is the fastest branch on Sun.
- // move everything so that the boxcenter is in (0,0,0)
- v0 = tri.v[0] - boxcenter;
- v1 = tri.v[1] - boxcenter;
- v2 = tri.v[2] - boxcenter;
-
- // Compute triangle edges.
- e0 = v1 - v0; // tri edge 0
- e1 = v2 - v1; // tri edge 1
- e2 = v0 - v2; // tri edge 2
-
- // Bullet 3:
- // test the 9 tests first (this was faster)
- fex = fabsf(e0.x());
- fey = fabsf(e0.y());
- fez = fabsf(e0.z());
- AXISTEST_X01(e0.z(), e0.y(), fez, fey);
- AXISTEST_Y02(e0.z(), e0.x(), fez, fex);
- AXISTEST_Z12(e0.y(), e0.x(), fey, fex);
-
- fex = fabsf(e1.x());
- fey = fabsf(e1.y());
- fez = fabsf(e1.z());
- AXISTEST_X01(e1.z(), e1.y(), fez, fey);
- AXISTEST_Y02(e1.z(), e1.x(), fez, fex);
- AXISTEST_Z0(e1.y(), e1.x(), fey, fex);
-
- fex = fabsf(e2.x());
- fey = fabsf(e2.y());
- fez = fabsf(e2.z());
- AXISTEST_X2(e2.z(), e2.y(), fez, fey);
- AXISTEST_Y1(e2.z(), e2.x(), fez, fex);
- AXISTEST_Z12(e2.y(), e2.x(), fey, fex);
-
- // Bullet 1:
- // first test overlap in the {x,y,z}-directions
- // find min, max of the triangle each direction, and test for overlap in
- // that direction -- this is equivalent to testing a minimal AABB around
- // the triangle against the AABB
-
- // test in X-direction
- FINDMINMAX(v0.x(), v1.x(), v2.x(), min, max);
- if(min > boxhalfsize.x() || max < -boxhalfsize.x()) return false;
-
- // test in Y-direction
- FINDMINMAX(v0.y(), v1.y(), v2.y(), min, max);
- if(min > boxhalfsize.y() || max < -boxhalfsize.y()) return false;
-
- // test in Z-direction
- FINDMINMAX(v0.z(), v1.z(), v2.z(), min, max);
- if(min > boxhalfsize.z() || max < -boxhalfsize.z()) return false;
-
- // Bullet 2:
- // test if the box intersects the plane of the triangle
- // compute plane equation of triangle: normal*x+d=0
- normal = cross(e0, e1);
-
- return planeBoxOverlap(normal, v0, boxhalfsize);
-}
-
-
-bool nv::triBoxOverlapNoBounds(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const Triangle & tri)
-{
- // use separating axis theorem to test overlap between triangle and box
- // need to test for overlap in these directions:
- // 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle
- // we do not even need to test these)
- // 2) normal of the triangle
- // 3) crossproduct(edge from tri, {x,y,z}-directin)
- // this gives 3x3=9 more tests
- Vector3 v0, v1, v2;
- float min, max, p0, p1, p2, rad, fex, fey, fez;
- Vector3 normal, e0, e1, e2;
-
- // This is the fastest branch on Sun.
- // move everything so that the boxcenter is in (0,0,0)
- v0 = tri.v[0] - boxcenter;
- v1 = tri.v[1] - boxcenter;
- v2 = tri.v[2] - boxcenter;
-
- // Compute triangle edges.
- e0 = v1 - v0; // tri edge 0
- e1 = v2 - v1; // tri edge 1
- e2 = v0 - v2; // tri edge 2
-
- // Bullet 3:
- // test the 9 tests first (this was faster)
- fex = fabsf(e0.x());
- fey = fabsf(e0.y());
- fez = fabsf(e0.z());
- AXISTEST_X01(e0.z(), e0.y(), fez, fey);
- AXISTEST_Y02(e0.z(), e0.x(), fez, fex);
- AXISTEST_Z12(e0.y(), e0.x(), fey, fex);
-
- fex = fabsf(e1.x());
- fey = fabsf(e1.y());
- fez = fabsf(e1.z());
- AXISTEST_X01(e1.z(), e1.y(), fez, fey);
- AXISTEST_Y02(e1.z(), e1.x(), fez, fex);
- AXISTEST_Z0(e1.y(), e1.x(), fey, fex);
-
- fex = fabsf(e2.x());
- fey = fabsf(e2.y());
- fez = fabsf(e2.z());
- AXISTEST_X2(e2.z(), e2.y(), fez, fey);
- AXISTEST_Y1(e2.z(), e2.x(), fez, fex);
- AXISTEST_Z12(e2.y(), e2.x(), fey, fex);
-
- // Bullet 2:
- // test if the box intersects the plane of the triangle
- // compute plane equation of triangle: normal*x+d=0
- normal = cross(e0, e1);
-
- return planeBoxOverlap(normal, v0, boxhalfsize);
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Triangle.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Triangle.cpp
deleted file mode 100644
index f0052979..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Triangle.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-// This code is in the public domain -- Ignacio Castaño <castanyo@yahoo.es>
-
-#include <nvmath/Triangle.h>
-
-using namespace nv;
-
-
-/// Tomas Möller, barycentric ray-triangle test.
-bool rayTest_Moller(const Triangle & t, Vector3::Arg orig, Vector3::Arg dir, float * out_t, float * out_u, float * out_v)
-{
- // find vectors for two edges sharing vert0
- Vector3 e1 = t.v[1] - t.v[0];
- Vector3 e2 = t.v[2] - t.v[0];
-
- // begin calculating determinant - also used to calculate U parameter
- Vector3 pvec = cross(dir, e2);
-
- // if determinant is near zero, ray lies in plane of triangle
- float det = dot(e1, pvec);
- if (det < -NV_EPSILON) {
- return false;
- }
-
- // calculate distance from vert0 to ray origin
- Vector3 tvec = orig - t.v[0];
-
- // calculate U parameter and test bounds
- float u = dot(tvec, pvec);
- if( u < 0.0f || u > det ) {
- return false;
- }
-
- // prepare to test V parameter
- Vector3 qvec = cross(tvec, e1);
-
- // calculate V parameter and test bounds
- float v = dot(dir, qvec);
- if (v < 0.0f || u + v > det) {
- return false;
- }
-
- // calculate t, scale parameters, ray intersects triangle
- float inv_det = 1.0f / det;
- *out_t = dot(e2, qvec) * inv_det;
- *out_u = u * inv_det; // v
- *out_v = v * inv_det; // 1-(u+v)
-
- return true;
-}
-
-
-
-
-
-#if 0
-
-
-// IC: This code is adapted from my Pi.MathLib code, based on Moller-Trumbore triangle test.
-FXVector3 edge1, edge2, pvec, tvec, qvec;
-
-edge1 = tri.V1 - tri.V0;
-edge2 = tri.V2 - tri.V0;
-
-pvec.Cross(ray.Direction, edge2);
-
-float det = FXVector3.Dot(edge1, pvec);
-
-// calculate distance from vert0 to ray origin.
-FXVector3 tvec = ray.Origin - vert0;
-
-if( det < 0 )
-{
- // calculate U parameter and test bounds.
- float u = FXVector3.Dot(tvec, pvec);
- if (u > 0.0 || u < det)
- {
- return false;
- }
-
- // prepare to test V parameter.
- qvec.Cross(tvec, edge1);
-
- // calculate V parameter and test bounds.
- float v = FXVector3.Dot(dir, qvec);
-
- return v <= 0.0 && u + v >= det;
-}
-else
-{
- // calculate U parameter and test bounds.
- float u = FXVector3.Dot(tvec, pvec);
- if (u < 0.0 || u > det)
- {
- return false;
- }
-
- // prepare to test V parameter.
- qvec.Cross(tvec, edge1);
-
- // calculate V parameter and test bounds.
- float v = FXVector3.Dot(dir, qvec);
-
- return v >= 0.0 && u + v <= det;
-}
-
-
-
-/**
- * Dan Sunday, parametric ray-triangle test.
- */
-// Output: *I = intersection point (when it exists)
-// Return: -1 = triangle is degenerate (a segment or point)
-// 0 = disjoint (no intersect)
-// 1 = intersect in unique point I1
-// 2 = are in the same plane
-bool RayTriangleTest( const Vec3 &p0, const Vec3 &p1,
- const Vec3 &v0, const Vec3 &v1, const Vec3 &v2, const Vec3 &n,
- Vec3 &I ) {
- Vec3 u, v; // triangle vectors
- Vec3 dir, w0, w; // ray vectors
- float r, a, b; // params to calc ray-plane intersect
-
- // get triangle edge vectors and plane normal
- u.Sub( v1, v0 );
- v.Sub( v2, v0 );
-
- dir.Sub( p1, p0 ); // ray direction vector
- w0.Sub( p0, v0 );
- a = Vec3DotProduct( n, w0 );
- b = Vec3DotProduct( n, dir );
-
- if( fabs(b) < TI_EPSILON ) // ray is parallel to triangle plane
- return false;
-
-
- // get intersect point of ray with triangle plane
- r = -a / b;
- if( r < 0.0f ) // ray goes away from triangle
- return false; // => no intersect
-
- // for a segment, also test if (r > 1.0) => no intersect
-
- I.Mad( p0, dir, r ); // intersect point of ray and plane
-
- // is I inside T?
- float uu, uv, vv, wu, wv, D;
- uu = Vec3DotProduct( u, u );
- uv = Vec3DotProduct( u, v );
- vv = Vec3DotProduct( v, v );
- w = I - v0;
- wu = Vec3DotProduct( w, u );
- wv = Vec3DotProduct( w, v );
- D = uv * uv - uu * vv;
-
- // get and test parametric coords
- float s, t;
- s = (uv * wv - vv * wu) / D;
- if( s<0.0 || s > 1.0) // I is outside T
- return false;
- t = (uv * wu - uu * wv) / D;
- if( t<0.0 || (s + t) > 1.0) // I is outside T
- return false;
-
- return true; // I is in T
-}
-
-
-#endif // 0
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Triangle.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Triangle.h
deleted file mode 100644
index 7cd8db5e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Triangle.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// This code is in the public domain -- Ignacio Castaño <castanyo@yahoo.es>
-
-#ifndef NV_MATH_TRIANGLE_H
-#define NV_MATH_TRIANGLE_H
-
-#include <nvmath/nvmath.h>
-#include <nvmath/Vector.h>
-#include <nvmath/Box.h>
-
-namespace nv
-{
-
- /// Triangle class with three vertices.
- class Triangle
- {
- public:
- Triangle() {};
-
- Triangle(Vector3::Arg v0, Vector3::Arg v1, Vector3::Arg v2)
- {
- v[0] = v0;
- v[1] = v1;
- v[2] = v2;
- }
-
- /// Get the bounds of the triangle.
- Box bounds() const
- {
- Box bounds;
- bounds.clearBounds();
- bounds.addPointToBounds(v[0]);
- bounds.addPointToBounds(v[1]);
- bounds.addPointToBounds(v[2]);
- return bounds;
- }
-
- Vector4 plane() const
- {
- Vector3 n = cross(v[1]-v[0], v[2]-v[0]);
- return Vector4(n, dot(n, v[0]));
- }
-
- Vector3 v[3];
- };
-
-
- // Tomas Akenine-Möller box-triangle test.
- NVMATH_API bool triBoxOverlap(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const Triangle & triangle);
- NVMATH_API bool triBoxOverlapNoBounds(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const Triangle & triangle);
-
-
- // Moller ray triangle test.
- NVMATH_API bool rayTest_Moller(const Triangle & t, Vector3::Arg orig, Vector3::Arg dir, float * out_t, float * out_u, float * out_v);
-
- inline bool rayTest(const Triangle & t, Vector3::Arg orig, Vector3::Arg dir, float * out_t, float * out_u, float * out_v)
- {
- return rayTest_Moller(t, orig, dir, out_t, out_u, out_v);
- }
-
- inline bool overlap(const Triangle & t, const Box & b)
- {
- Vector3 center = b.center();
- Vector3 extents = b.extents();
- return triBoxOverlap(center, extents, t);
- }
-
- inline bool overlap(const Box & b, const Triangle & t)
- {
- return overlap(t, b);
- }
-
- inline bool overlapNoBounds(const Triangle & t, const Box & b)
- {
- Vector3 center = b.center();
- Vector3 extents = b.extents();
- return triBoxOverlapNoBounds(center, extents, t);
- }
-
-} // nv namespace
-
-#endif // NV_MATH_TRIANGLE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/TypeSerialization.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvmath/TypeSerialization.cpp
deleted file mode 100644
index b55608c5..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/TypeSerialization.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#include <nvcore/Stream.h>
-
-#include <nvmath/Vector.h>
-#include <nvmath/Matrix.h>
-#include <nvmath/Quaternion.h>
-#include <nvmath/Basis.h>
-#include <nvmath/Box.h>
-#include <nvmath/Plane.h>
-
-#include <nvmath/TypeSerialization.h>
-
-using namespace nv;
-
-Stream & nv::operator<< (Stream & s, Vector2 & v)
-{
- float x = v.x();
- float y = v.y();
-
- s << x << y;
-
- if (s.isLoading())
- {
- v.set(x, y);
- }
-
- return s;
-}
-
-Stream & nv::operator<< (Stream & s, Vector3 & v)
-{
- float x = v.x();
- float y = v.y();
- float z = v.z();
-
- s << x << y << z;
-
- if (s.isLoading())
- {
- v.set(x, y, z);
- }
-
- return s;
-}
-
-Stream & nv::operator<< (Stream & s, Vector4 & v)
-{
- float x = v.x();
- float y = v.y();
- float z = v.z();
- float w = v.w();
-
- s << x << y << z << w;
-
- if (s.isLoading())
- {
- v.set(x, y, z, w);
- }
-
- return s;
-}
-
-Stream & nv::operator<< (Stream & s, Matrix & m)
-{
- return s;
-}
-
-Stream & nv::operator<< (Stream & s, Quaternion & q)
-{
- return s << q.asVector();
-}
-
-Stream & nv::operator<< (Stream & s, Basis & basis)
-{
- return s << basis.tangent << basis.bitangent << basis.normal;
-}
-
-Stream & nv::operator<< (Stream & s, Box & box)
-{
- return s << box.m_mins << box.m_maxs;
-}
-
-Stream & nv::operator<< (Stream & s, Plane & plane)
-{
- return s << plane.asVector();
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/TypeSerialization.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/TypeSerialization.h
deleted file mode 100644
index ccda4606..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/TypeSerialization.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_TYPESERIALIZATION_H
-#define NV_MATH_TYPESERIALIZATION_H
-
-#include <nvmath/nvmath.h>
-
-namespace nv
-{
- class Stream;
-
- class Vector2;
- class Vector3;
- class Vector4;
-
- class Matrix;
- class Quaternion;
- class Basis;
- class Box;
- class Plane;
-
- NVMATH_API Stream & operator<< (Stream & s, Vector2 & obj);
- NVMATH_API Stream & operator<< (Stream & s, Vector3 & obj);
- NVMATH_API Stream & operator<< (Stream & s, Vector4 & obj);
-
- NVMATH_API Stream & operator<< (Stream & s, Matrix & obj);
- NVMATH_API Stream & operator<< (Stream & s, Quaternion & obj);
- NVMATH_API Stream & operator<< (Stream & s, Basis & obj);
- NVMATH_API Stream & operator<< (Stream & s, Box & obj);
- NVMATH_API Stream & operator<< (Stream & s, Plane & obj);
-
-} // nv namespace
-
-#endif // NV_MATH_TYPESERIALIZATION_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Vector.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/Vector.h
deleted file mode 100644
index 329531ab..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/Vector.h
+++ /dev/null
@@ -1,872 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_VECTOR_H
-#define NV_MATH_VECTOR_H
-
-#include <nvmath/nvmath.h>
-#include <nvcore/Algorithms.h> // min, max
-
-namespace nv
-{
-
-enum zero_t { zero };
-enum identity_t { identity };
-
-// I should probably use templates.
-typedef float scalar;
-
-class NVMATH_CLASS Vector2
-{
-public:
- typedef Vector2 const & Arg;
-
- Vector2();
- explicit Vector2(zero_t);
- explicit Vector2(scalar f);
- Vector2(scalar x, scalar y);
- Vector2(Vector2::Arg v);
-
- const Vector2 & operator=(Vector2::Arg v);
- void setComponent(uint idx, scalar f);
-
- scalar x() const;
- scalar y() const;
-
- scalar component(uint idx) const;
-
- const scalar * ptr() const;
-
- void set(scalar x, scalar y);
-
- Vector2 operator-() const;
- void operator+=(Vector2::Arg v);
- void operator-=(Vector2::Arg v);
- void operator*=(scalar s);
- void operator*=(Vector2::Arg v);
-
- friend bool operator==(Vector2::Arg a, Vector2::Arg b);
- friend bool operator!=(Vector2::Arg a, Vector2::Arg b);
-
-private:
- scalar m_x, m_y;
-};
-
-
-class NVMATH_CLASS Vector3
-{
-public:
- typedef Vector3 const & Arg;
-
- Vector3();
- explicit Vector3(zero_t);
- Vector3(scalar x, scalar y, scalar z);
- Vector3(Vector2::Arg v, scalar z);
- Vector3(Vector3::Arg v);
-
- const Vector3 & operator=(Vector3::Arg v);
-
- scalar x() const;
- scalar y() const;
- scalar z() const;
-
- const Vector2 & xy() const;
-
- scalar component(uint idx) const;
- void setComponent(uint idx, scalar f);
-
- const scalar * ptr() const;
-
- void set(scalar x, scalar y, scalar z);
-
- Vector3 operator-() const;
- void operator+=(Vector3::Arg v);
- void operator-=(Vector3::Arg v);
- void operator*=(scalar s);
- void operator/=(scalar s);
- void operator*=(Vector3::Arg v);
-
- friend bool operator==(Vector3::Arg a, Vector3::Arg b);
- friend bool operator!=(Vector3::Arg a, Vector3::Arg b);
-
-private:
- scalar m_x, m_y, m_z;
-};
-
-
-class NVMATH_CLASS Vector4
-{
-public:
- typedef Vector4 const & Arg;
-
- Vector4();
- explicit Vector4(zero_t);
- Vector4(scalar x, scalar y, scalar z, scalar w);
- Vector4(Vector2::Arg v, scalar z, scalar w);
- Vector4(Vector3::Arg v, scalar w);
- Vector4(Vector4::Arg v);
-// Vector4(const Quaternion & v);
-
- const Vector4 & operator=(Vector4::Arg v);
-
- scalar x() const;
- scalar y() const;
- scalar z() const;
- scalar w() const;
-
- const Vector2 & xy() const;
- const Vector3 & xyz() const;
-
- scalar component(uint idx) const;
- void setComponent(uint idx, scalar f);
-
- const scalar * ptr() const;
-
- void set(scalar x, scalar y, scalar z, scalar w);
-
- Vector4 operator-() const;
- void operator+=(Vector4::Arg v);
- void operator-=(Vector4::Arg v);
- void operator*=(scalar s);
- void operator*=(Vector4::Arg v);
-
- friend bool operator==(Vector4::Arg a, Vector4::Arg b);
- friend bool operator!=(Vector4::Arg a, Vector4::Arg b);
-
-private:
- scalar m_x, m_y, m_z, m_w;
-};
-
-
-// Vector2
-
-inline Vector2::Vector2() {}
-inline Vector2::Vector2(zero_t) : m_x(0.0f), m_y(0.0f) {}
-inline Vector2::Vector2(scalar f) : m_x(f), m_y(f) {}
-inline Vector2::Vector2(scalar x, scalar y) : m_x(x), m_y(y) {}
-inline Vector2::Vector2(Vector2::Arg v) : m_x(v.x()), m_y(v.y()) {}
-
-inline const Vector2 & Vector2::operator=(Vector2::Arg v)
-{
- m_x = v.x();
- m_y = v.y();
- return *this;
-}
-
-inline scalar Vector2::x() const { return m_x; }
-inline scalar Vector2::y() const { return m_y; }
-
-inline scalar Vector2::component(uint idx) const
-{
- nvDebugCheck(idx < 2);
- if (idx == 0) return x();
- if (idx == 1) return y();
- nvAssume(false);
- return 0.0f;
-}
-
-inline void Vector2::setComponent(uint idx, float f)
-{
- nvDebugCheck(idx < 2);
- if (idx == 0) m_x = f;
- else if (idx == 1) m_y = f;
-}
-
-
-inline const scalar * Vector2::ptr() const
-{
- return &m_x;
-}
-
-inline void Vector2::set(scalar x, scalar y)
-{
- m_x = x;
- m_y = y;
-}
-
-inline Vector2 Vector2::operator-() const
-{
- return Vector2(-m_x, -m_y);
-}
-
-inline void Vector2::operator+=(Vector2::Arg v)
-{
- m_x += v.m_x;
- m_y += v.m_y;
-}
-
-inline void Vector2::operator-=(Vector2::Arg v)
-{
- m_x -= v.m_x;
- m_y -= v.m_y;
-}
-
-inline void Vector2::operator*=(scalar s)
-{
- m_x *= s;
- m_y *= s;
-}
-
-inline void Vector2::operator*=(Vector2::Arg v)
-{
- m_x *= v.m_x;
- m_y *= v.m_y;
-}
-
-inline bool operator==(Vector2::Arg a, Vector2::Arg b)
-{
- return a.m_x == b.m_x && a.m_y == b.m_y;
-}
-inline bool operator!=(Vector2::Arg a, Vector2::Arg b)
-{
- return a.m_x != b.m_x || a.m_y != b.m_y;
-}
-
-
-// Vector3
-
-inline Vector3::Vector3() {}
-inline Vector3::Vector3(zero_t) : m_x(0.0f), m_y(0.0f), m_z(0.0f) {}
-inline Vector3::Vector3(scalar x, scalar y, scalar z) : m_x(x), m_y(y), m_z(z) {}
-inline Vector3::Vector3(Vector2::Arg v, scalar z) : m_x(v.x()), m_y(v.y()), m_z(z) {}
-inline Vector3::Vector3(Vector3::Arg v) : m_x(v.x()), m_y(v.y()), m_z(v.z()) {}
-
-inline const Vector3 & Vector3::operator=(Vector3::Arg v)
-{
- m_x = v.m_x;
- m_y = v.m_y;
- m_z = v.m_z;
- return *this;
-}
-
-inline scalar Vector3::x() const { return m_x; }
-inline scalar Vector3::y() const { return m_y; }
-inline scalar Vector3::z() const { return m_z; }
-
-inline const Vector2 & Vector3::xy() const
-{
- return *(Vector2 *)this;
-}
-
-inline scalar Vector3::component(uint idx) const
-{
- nvDebugCheck(idx < 3);
- if (idx == 0) return m_x;
- if (idx == 1) return m_y;
- if (idx == 2) return m_z;
- nvAssume(false);
- return 0.0f;
-}
-
-inline void Vector3::setComponent(uint idx, float f)
-{
- nvDebugCheck(idx < 3);
- if (idx == 0) m_x = f;
- else if (idx == 1) m_y = f;
- else if (idx == 2) m_z = f;
-}
-
-inline const scalar * Vector3::ptr() const
-{
- return &m_x;
-}
-
-inline void Vector3::set(scalar x, scalar y, scalar z)
-{
- m_x = x;
- m_y = y;
- m_z = z;
-}
-
-inline Vector3 Vector3::operator-() const
-{
- return Vector3(-m_x, -m_y, -m_z);
-}
-
-inline void Vector3::operator+=(Vector3::Arg v)
-{
- m_x += v.m_x;
- m_y += v.m_y;
- m_z += v.m_z;
-}
-
-inline void Vector3::operator-=(Vector3::Arg v)
-{
- m_x -= v.m_x;
- m_y -= v.m_y;
- m_z -= v.m_z;
-}
-
-inline void Vector3::operator*=(scalar s)
-{
- m_x *= s;
- m_y *= s;
- m_z *= s;
-}
-
-inline void Vector3::operator/=(scalar s)
-{
- float is = 1.0f / s;
- m_x *= is;
- m_y *= is;
- m_z *= is;
-}
-
-inline void Vector3::operator*=(Vector3::Arg v)
-{
- m_x *= v.m_x;
- m_y *= v.m_y;
- m_z *= v.m_z;
-}
-
-inline bool operator==(Vector3::Arg a, Vector3::Arg b)
-{
- return a.m_x == b.m_x && a.m_y == b.m_y && a.m_z == b.m_z;
-}
-inline bool operator!=(Vector3::Arg a, Vector3::Arg b)
-{
- return a.m_x != b.m_x || a.m_y != b.m_y || a.m_z != b.m_z;
-}
-
-
-// Vector4
-
-inline Vector4::Vector4() {}
-inline Vector4::Vector4(zero_t) : m_x(0.0f), m_y(0.0f), m_z(0.0f), m_w(0.0f) {}
-inline Vector4::Vector4(scalar x, scalar y, scalar z, scalar w) : m_x(x), m_y(y), m_z(z), m_w(w) {}
-inline Vector4::Vector4(Vector2::Arg v, scalar z, scalar w) : m_x(v.x()), m_y(v.y()), m_z(z), m_w(w) {}
-inline Vector4::Vector4(Vector3::Arg v, scalar w) : m_x(v.x()), m_y(v.y()), m_z(v.z()), m_w(w) {}
-inline Vector4::Vector4(Vector4::Arg v) : m_x(v.x()), m_y(v.y()), m_z(v.z()), m_w(v.w()) {}
-
-inline const Vector4 & Vector4::operator=(const Vector4 & v)
-{
- m_x = v.m_x;
- m_y = v.m_y;
- m_z = v.m_z;
- m_w = v.m_w;
- return *this;
-}
-
-inline scalar Vector4::x() const { return m_x; }
-inline scalar Vector4::y() const { return m_y; }
-inline scalar Vector4::z() const { return m_z; }
-inline scalar Vector4::w() const { return m_w; }
-
-inline const Vector2 & Vector4::xy() const
-{
- return *(Vector2 *)this;
-}
-
-inline const Vector3 & Vector4::xyz() const
-{
- return *(Vector3 *)this;
-}
-
-inline scalar Vector4::component(uint idx) const
-{
- nvDebugCheck(idx < 4);
- if (idx == 0) return x();
- if (idx == 1) return y();
- if (idx == 2) return z();
- if (idx == 3) return w();
- nvAssume(false);
- return 0.0f;
-}
-
-inline void Vector4::setComponent(uint idx, float f)
-{
- nvDebugCheck(idx < 4);
- if (idx == 0) m_x = f;
- else if (idx == 1) m_y = f;
- else if (idx == 2) m_z = f;
- else if (idx == 3) m_w = f;
-}
-
-inline const scalar * Vector4::ptr() const
-{
- return &m_x;
-}
-
-inline void Vector4::set(scalar x, scalar y, scalar z, scalar w)
-{
- m_x = x;
- m_y = y;
- m_z = z;
- m_w = w;
-}
-
-inline Vector4 Vector4::operator-() const
-{
- return Vector4(-m_x, -m_y, -m_z, -m_w);
-}
-
-inline void Vector4::operator+=(Vector4::Arg v)
-{
- m_x += v.m_x;
- m_y += v.m_y;
- m_z += v.m_z;
- m_w += v.m_w;
-}
-
-inline void Vector4::operator-=(Vector4::Arg v)
-{
- m_x -= v.m_x;
- m_y -= v.m_y;
- m_z -= v.m_z;
- m_w -= v.m_w;
-}
-
-inline void Vector4::operator*=(scalar s)
-{
- m_x *= s;
- m_y *= s;
- m_z *= s;
- m_w *= s;
-}
-
-inline void Vector4::operator*=(Vector4::Arg v)
-{
- m_x *= v.m_x;
- m_y *= v.m_y;
- m_z *= v.m_z;
- m_w *= v.m_w;
-}
-
-inline bool operator==(Vector4::Arg a, Vector4::Arg b)
-{
- return a.m_x == b.m_x && a.m_y == b.m_y && a.m_z == b.m_z && a.m_w == b.m_w;
-}
-inline bool operator!=(Vector4::Arg a, Vector4::Arg b)
-{
- return a.m_x != b.m_x || a.m_y != b.m_y || a.m_z != b.m_z || a.m_w != b.m_w;
-}
-
-
-
-// Functions
-
-
-// Vector2
-
-inline Vector2 add(Vector2::Arg a, Vector2::Arg b)
-{
- return Vector2(a.x() + b.x(), a.y() + b.y());
-}
-inline Vector2 operator+(Vector2::Arg a, Vector2::Arg b)
-{
- return add(a, b);
-}
-
-inline Vector2 sub(Vector2::Arg a, Vector2::Arg b)
-{
- return Vector2(a.x() - b.x(), a.y() - b.y());
-}
-inline Vector2 operator-(Vector2::Arg a, Vector2::Arg b)
-{
- return sub(a, b);
-}
-
-inline Vector2 scale(Vector2::Arg v, scalar s)
-{
- return Vector2(v.x() * s, v.y() * s);
-}
-
-inline Vector2 scale(Vector2::Arg v, Vector2::Arg s)
-{
- return Vector2(v.x() * s.x(), v.y() * s.y());
-}
-
-inline Vector2 operator*(Vector2::Arg v, scalar s)
-{
- return scale(v, s);
-}
-
-inline Vector2 operator*(Vector2::Arg v1, Vector2::Arg v2)
-{
- return Vector2(v1.x()*v2.x(), v1.y()*v2.y());
-}
-
-inline Vector2 operator*(scalar s, Vector2::Arg v)
-{
- return scale(v, s);
-}
-
-inline scalar dot(Vector2::Arg a, Vector2::Arg b)
-{
- return a.x() * b.x() + a.y() * b.y();
-}
-
-inline scalar length_squared(Vector2::Arg v)
-{
- return v.x() * v.x() + v.y() * v.y();
-}
-
-inline scalar length(Vector2::Arg v)
-{
- return sqrtf(length_squared(v));
-}
-
-inline scalar inverse_length(Vector2::Arg v)
-{
- return 1.0f / sqrtf(length_squared(v));
-}
-
-inline bool isNormalized(Vector2::Arg v, float epsilon = NV_NORMAL_EPSILON)
-{
- return equal(length(v), 1, epsilon);
-}
-
-inline Vector2 normalize(Vector2::Arg v, float epsilon = NV_EPSILON)
-{
- float l = length(v);
- nvDebugCheck(!isZero(l, epsilon));
- Vector2 n = scale(v, 1.0f / l);
- nvDebugCheck(isNormalized(n));
- return n;
-}
-
-inline Vector2 normalizeSafe(Vector2::Arg v, Vector2::Arg fallback, float epsilon = NV_EPSILON)
-{
- float l = length(v);
- if (isZero(l, epsilon)) {
- return fallback;
- }
- return scale(v, 1.0f / l);
-}
-
-
-inline bool equal(Vector2::Arg v1, Vector2::Arg v2, float epsilon = NV_EPSILON)
-{
- return equal(v1.x(), v2.x(), epsilon) && equal(v1.y(), v2.y(), epsilon);
-}
-
-inline Vector2 min(Vector2::Arg a, Vector2::Arg b)
-{
- return Vector2(min(a.x(), b.x()), min(a.y(), b.y()));
-}
-
-inline Vector2 max(Vector2::Arg a, Vector2::Arg b)
-{
- return Vector2(max(a.x(), b.x()), max(a.y(), b.y()));
-}
-
-inline bool isValid(Vector2::Arg v)
-{
- return isFinite(v.x()) && isFinite(v.y());
-}
-
-
-// Vector3
-
-inline Vector3 add(Vector3::Arg a, Vector3::Arg b)
-{
- return Vector3(a.x() + b.x(), a.y() + b.y(), a.z() + b.z());
-}
-inline Vector3 add(Vector3::Arg a, float b)
-{
- return Vector3(a.x() + b, a.y() + b, a.z() + b);
-}
-inline Vector3 operator+(Vector3::Arg a, Vector3::Arg b)
-{
- return add(a, b);
-}
-inline Vector3 operator+(Vector3::Arg a, float b)
-{
- return add(a, b);
-}
-
-inline Vector3 sub(Vector3::Arg a, Vector3::Arg b)
-{
- return Vector3(a.x() - b.x(), a.y() - b.y(), a.z() - b.z());
-}
-inline Vector3 sub(Vector3::Arg a, float b)
-{
- return Vector3(a.x() - b, a.y() - b, a.z() - b);
-}
-inline Vector3 operator-(Vector3::Arg a, Vector3::Arg b)
-{
- return sub(a, b);
-}
-inline Vector3 operator-(Vector3::Arg a, float b)
-{
- return sub(a, b);
-}
-
-inline Vector3 cross(Vector3::Arg a, Vector3::Arg b)
-{
- return Vector3(a.y() * b.z() - a.z() * b.y(), a.z() * b.x() - a.x() * b.z(), a.x() * b.y() - a.y() * b.x());
-}
-
-inline Vector3 scale(Vector3::Arg v, scalar s)
-{
- return Vector3(v.x() * s, v.y() * s, v.z() * s);
-}
-
-inline Vector3 scale(Vector3::Arg v, Vector3::Arg s)
-{
- return Vector3(v.x() * s.x(), v.y() * s.y(), v.z() * s.z());
-}
-
-inline Vector3 operator*(Vector3::Arg v, scalar s)
-{
- return scale(v, s);
-}
-
-inline Vector3 operator*(scalar s, Vector3::Arg v)
-{
- return scale(v, s);
-}
-
-inline Vector3 operator*(Vector3::Arg v, Vector3::Arg s)
-{
- return scale(v, s);
-}
-
-inline Vector3 operator/(Vector3::Arg v, scalar s)
-{
- return scale(v, 1.0f/s);
-}
-
-inline Vector3 add_scaled(Vector3::Arg a, Vector3::Arg b, scalar s)
-{
- return Vector3(a.x() + b.x() * s, a.y() + b.y() * s, a.z() + b.z() * s);
-}
-
-inline Vector3 lerp(Vector3::Arg v1, Vector3::Arg v2, scalar t)
-{
- const scalar s = 1.0f - t;
- return Vector3(v1.x() * s + t * v2.x(), v1.y() * s + t * v2.y(), v1.z() * s + t * v2.z());
-}
-
-inline scalar dot(Vector3::Arg a, Vector3::Arg b)
-{
- return a.x() * b.x() + a.y() * b.y() + a.z() * b.z();
-}
-
-inline scalar length_squared(Vector3::Arg v)
-{
- return v.x() * v.x() + v.y() * v.y() + v.z() * v.z();
-}
-
-inline scalar length(Vector3::Arg v)
-{
- return sqrtf(length_squared(v));
-}
-
-inline scalar inverse_length(Vector3::Arg v)
-{
- return 1.0f / sqrtf(length_squared(v));
-}
-
-inline bool isNormalized(Vector3::Arg v, float epsilon = NV_NORMAL_EPSILON)
-{
- return equal(length(v), 1, epsilon);
-}
-
-inline Vector3 normalize(Vector3::Arg v, float epsilon = NV_EPSILON)
-{
- float l = length(v);
- nvDebugCheck(!isZero(l, epsilon));
- Vector3 n = scale(v, 1.0f / l);
- nvDebugCheck(isNormalized(n));
- return n;
-}
-
-inline Vector3 normalizeSafe(Vector3::Arg v, Vector3::Arg fallback, float epsilon = NV_EPSILON)
-{
- float l = length(v);
- if (isZero(l, epsilon)) {
- return fallback;
- }
- return scale(v, 1.0f / l);
-}
-
-inline bool equal(Vector3::Arg v1, Vector3::Arg v2, float epsilon = NV_EPSILON)
-{
- return equal(v1.x(), v2.x(), epsilon) && equal(v1.y(), v2.y(), epsilon) && equal(v1.z(), v2.z(), epsilon);
-}
-
-inline Vector3 min(Vector3::Arg a, Vector3::Arg b)
-{
- return Vector3(min(a.x(), b.x()), min(a.y(), b.y()), min(a.z(), b.z()));
-}
-
-inline Vector3 max(Vector3::Arg a, Vector3::Arg b)
-{
- return Vector3(max(a.x(), b.x()), max(a.y(), b.y()), max(a.z(), b.z()));
-}
-
-inline Vector3 clamp(Vector3::Arg v, float min, float max)
-{
- return Vector3(clamp(v.x(), min, max), clamp(v.y(), min, max), clamp(v.z(), min, max));
-}
-
-inline bool isValid(Vector3::Arg v)
-{
- return isFinite(v.x()) && isFinite(v.y()) && isFinite(v.z());
-}
-
-/*
-Vector3 transform(Quaternion, vector3);
-Vector3 transform_point(matrix34, vector3);
-Vector3 transform_vector(matrix34, vector3);
-Vector3 transform_point(matrix44, vector3);
-Vector3 transform_vector(matrix44, vector3);
-*/
-
-// Vector4
-
-inline Vector4 add(Vector4::Arg a, Vector4::Arg b)
-{
- return Vector4(a.x() + b.x(), a.y() + b.y(), a.z() + b.z(), a.w() + b.w());
-}
-inline Vector4 operator+(Vector4::Arg a, Vector4::Arg b)
-{
- return add(a, b);
-}
-
-inline Vector4 sub(Vector4::Arg a, Vector4::Arg b)
-{
- return Vector4(a.x() - b.x(), a.y() - b.y(), a.z() - b.z(), a.w() - b.w());
-}
-inline Vector4 operator-(Vector4::Arg a, Vector4::Arg b)
-{
- return sub(a, b);
-}
-
-inline Vector4 scale(Vector4::Arg v, scalar s)
-{
- return Vector4(v.x() * s, v.y() * s, v.z() * s, v.w() * s);
-}
-
-inline Vector4 scale(Vector4::Arg v, Vector4::Arg s)
-{
- return Vector4(v.x() * s.x(), v.y() * s.y(), v.z() * s.z(), v.w() * s.w());
-}
-
-inline Vector4 operator*(Vector4::Arg v, scalar s)
-{
- return scale(v, s);
-}
-
-inline Vector4 operator*(scalar s, Vector4::Arg v)
-{
- return scale(v, s);
-}
-
-inline Vector4 operator/(Vector4::Arg v, scalar s)
-{
- return scale(v, 1.0f/s);
-}
-
-inline Vector4 add_scaled(Vector4::Arg a, Vector4::Arg b, scalar s)
-{
- return Vector4(a.x() + b.x() * s, a.y() + b.y() * s, a.z() + b.z() * s, a.w() + b.w() * s);
-}
-
-inline scalar dot(Vector4::Arg a, Vector4::Arg b)
-{
- return a.x() * b.x() + a.y() * b.y() + a.z() * b.z() + a.w() * b.w();
-}
-
-inline scalar length_squared(Vector4::Arg v)
-{
- return v.x() * v.x() + v.y() * v.y() + v.z() * v.z() + v.w() * v.w();
-}
-
-inline scalar length(Vector4::Arg v)
-{
- return sqrtf(length_squared(v));
-}
-
-inline scalar inverse_length(Vector4::Arg v)
-{
- return 1.0f / sqrtf(length_squared(v));
-}
-
-inline bool isNormalized(Vector4::Arg v, float epsilon = NV_NORMAL_EPSILON)
-{
- return equal(length(v), 1, epsilon);
-}
-
-inline Vector4 normalize(Vector4::Arg v, float epsilon = NV_EPSILON)
-{
- float l = length(v);
- nvDebugCheck(!isZero(l, epsilon));
- Vector4 n = scale(v, 1.0f / l);
- nvDebugCheck(isNormalized(n));
- return n;
-}
-
-inline Vector4 normalizeSafe(Vector4::Arg v, Vector4::Arg fallback, float epsilon = NV_EPSILON)
-{
- float l = length(v);
- if (isZero(l, epsilon)) {
- return fallback;
- }
- return scale(v, 1.0f / l);
-}
-
-inline bool equal(Vector4::Arg v1, Vector4::Arg v2, float epsilon = NV_EPSILON)
-{
- return equal(v1.x(), v2.x(), epsilon) && equal(v1.y(), v2.y(), epsilon) && equal(v1.z(), v2.z(), epsilon) && equal(v1.w(), v2.w(), epsilon);
-}
-
-inline Vector4 min(Vector4::Arg a, Vector4::Arg b)
-{
- return Vector4(min(a.x(), b.x()), min(a.y(), b.y()), min(a.z(), b.z()), min(a.w(), b.w()));
-}
-
-inline Vector4 max(Vector4::Arg a, Vector4::Arg b)
-{
- return Vector4(max(a.x(), b.x()), max(a.y(), b.y()), max(a.z(), b.z()), max(a.w(), b.w()));
-}
-
-inline bool isValid(Vector4::Arg v)
-{
- return isFinite(v.x()) && isFinite(v.y()) && isFinite(v.z()) && isFinite(v.w());
-}
-
-
-
-/*
-vector4 transform(matrix34, vector4);
-vector4 transform(matrix44, vector4);
-*/
-
-/*
-Quaternion mul(Quaternion, Quaternion); // rotational composition
-Quaternion conjugate(Quaternion);
-Quaternion inverse(Quaternion);
-Quaternion axis_angle(const Vector3 & v, scalar s);
-*/
-
-/*
-matrix34 add(matrix34, matrix34); // note: implicit '1' stays as '1'
-matrix34 operator+(matrix34, matrix34);
-matrix34 sub(matrix34, matrix34); // note: implicit '1' stays as '1'
-matrix34 operator-(matrix34, matrix34);
-matrix34 mul(matrix34, matrix34);
-matrix34 operator*(matrix34, matrix34);
-matrix34 mul(matrix34, quaternion4); // rotation multiplication
-matrix34 operator*(matrix34, quaternion4); // rotation multiplication
-matrix34 translation(vector3);
-matrix34 rotation(quaternion4);
-matrix34 rotation(vector3, scalar); // axis/angle
-
-matrix44 add(matrix44, matrix44);
-matrix44 operator+(matrix44, matrix44);
-matrix44 sub(matrix44, matrix44);
-matrix44 operator-(matrix44, matrix44);
-matrix44 mul(matrix44, matrix44);
-matrix44 operator*(matrix44, matrix44);
-matrix44 mul(matrix44, quaternion4); // rotation multiplication
-matrix44 operator*(matrix44, quaternion4); // rotation multiplication
-matrix44 invert(matrix34);
-matrix44 invert(matrix44);
-matrix44 transpose(matrix34);
-matrix44 transpose(matrix44);
-*/
-
-} // nv namespace
-
-#endif // NV_MATH_VECTOR_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvmath/nvmath.h b/Libraries/nvidia-texture-tools-read-only/src/nvmath/nvmath.h
deleted file mode 100644
index 1bba967b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvmath/nvmath.h
+++ /dev/null
@@ -1,146 +0,0 @@
-// This code is in the public domain -- castanyo@yahoo.es
-
-#ifndef NV_MATH_H
-#define NV_MATH_H
-
-#include <nvcore/nvcore.h>
-#include <nvcore/Debug.h>
-
-#include <math.h>
-
-// Function linkage
-#if NVMATH_SHARED
-#ifdef NVMATH_EXPORTS
-#define NVMATH_API DLL_EXPORT
-#define NVMATH_CLASS DLL_EXPORT_CLASS
-#else
-#define NVMATH_API DLL_IMPORT
-#define NVMATH_CLASS DLL_IMPORT
-#endif
-#else // NVMATH_SHARED
-#define NVMATH_API
-#define NVMATH_CLASS
-#endif // NVMATH_SHARED
-
-#ifndef PI
-#define PI float(3.1415926535897932384626433833)
-#endif
-
-#define NV_EPSILON (0.0001f)
-#define NV_NORMAL_EPSILON (0.001f)
-
-/*
-#define SQ(r) ((r)*(r))
-
-#define SIGN_BITMASK 0x80000000
-
-/// Integer representation of a floating-point value.
-#define IR(x) ((uint32 &)(x))
-
-/// Absolute integer representation of a floating-point value
-#define AIR(x) (IR(x) & 0x7fffffff)
-
-/// Floating-point representation of an integer value.
-#define FR(x) ((float&)(x))
-
-/// Integer-based comparison of a floating point value.
-/// Don't use it blindly, it can be faster or slower than the FPU comparison, depends on the context.
-#define IS_NEGATIVE_FLOAT(x) (IR(x)&SIGN_BITMASK)
-*/
-
-inline float sqrt_assert(const float f)
-{
- nvDebugCheck(f >= 0.0f);
- return sqrtf(f);
-}
-
-inline float acos_assert(const float f)
-{
- nvDebugCheck(f >= -1.0f && f <= 1.0f);
- return acosf(f);
-}
-
-inline float asin_assert(const float f)
-{
- nvDebugCheck(f >= -1.0f && f <= 1.0f);
- return asinf(f);
-}
-
-// Replace default functions with asserting ones.
-#define sqrt sqrt_assert
-#define sqrtf sqrt_assert
-#define acos acos_assert
-#define acosf acos_assert
-#define asin asin_assert
-#define asinf asin_assert
-
-#if NV_OS_WIN32
-#include <float.h>
-#endif
-
-namespace nv
-{
-inline float toRadian(float degree) { return degree * (PI / 180.0f); }
-inline float toDegree(float radian) { return radian * (180.0f / PI); }
-
-inline bool equal(const float f0, const float f1, const float epsilon = NV_EPSILON)
-{
- return fabs(f0-f1) <= epsilon;
-}
-
-inline bool isZero(const float f, const float epsilon = NV_EPSILON)
-{
- return fabs(f) <= epsilon;
-}
-
-inline bool isFinite(const float f)
-{
-#if NV_OS_WIN32
- return _finite(f) != 0;
-#elif NV_OS_DARWIN
- return isfinite(f);
-#elif NV_OS_LINUX
- return finitef(f);
-#else
-# error "isFinite not supported"
-#endif
-//return std::isfinite (f);
-//return finite (f);
-}
-
-inline bool isNan(const float f)
-{
-#if NV_OS_WIN32
- return _isnan(f) != 0;
-#elif NV_OS_DARWIN
- return isnan(f);
-#elif NV_OS_LINUX
- return isnanf(f);
-#else
-# error "isNan not supported"
-#endif
-}
-
-inline uint log2(uint i)
-{
- uint value = 0;
- while( i >>= 1 ) {
- value++;
- }
- return value;
-}
-
-inline float lerp(float f0, float f1, float t)
-{
- const float s = 1.0f - t;
- return f0 * s + f1 * t;
-}
-
-inline float square(float f)
-{
- return f * f;
-}
-
-} // nv
-
-#endif // NV_MATH_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CMakeLists.txt b/Libraries/nvidia-texture-tools-read-only/src/nvtt/CMakeLists.txt
deleted file mode 100644
index ea5cc943..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CMakeLists.txt
+++ /dev/null
@@ -1,120 +0,0 @@
-PROJECT(nvtt)
-
-ADD_SUBDIRECTORY(squish)
-
-SET(NVTT_SRCS
- nvtt.h
- nvtt.cpp
- Compressor.h
- Compressor.cpp
- nvtt_wrapper.h
- nvtt_wrapper.cpp
- CompressDXT.h
- CompressDXT.cpp
- CompressRGB.h
- CompressRGB.cpp
- QuickCompressDXT.h
- QuickCompressDXT.cpp
- OptimalCompressDXT.h
- OptimalCompressDXT.cpp
- SingleColorLookup.h
- CompressionOptions.h
- CompressionOptions.cpp
- InputOptions.h
- InputOptions.cpp
- OutputOptions.h
- OutputOptions.cpp
- Texture.h Texture.cpp
- cuda/CudaUtils.h
- cuda/CudaUtils.cpp
- cuda/CudaMath.h
- cuda/Bitmaps.h
- cuda/CudaCompressDXT.h
- cuda/CudaCompressDXT.cpp)
-
-IF(CUDA_FOUND)
- ADD_DEFINITIONS(-DHAVE_CUDA)
- WRAP_CUDA(CUDA_SRCS cuda/CompressKernel.cu)
- SET(NVTT_SRCS ${NVTT_SRCS} ${CUDA_SRCS})
- SET(LIBS ${LIBS} ${CUDA_LIBRARIES})
- INCLUDE_DIRECTORIES(${CUDA_INCLUDE_PATH})
-ENDIF(CUDA_FOUND)
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-
-ADD_DEFINITIONS(-DNVTT_EXPORTS)
-
-IF(NVTT_SHARED)
- ADD_LIBRARY(nvtt SHARED ${NVTT_SRCS})
-ELSE(NVTT_SHARED)
- ADD_LIBRARY(nvtt ${NVTT_SRCS})
-ENDIF(NVTT_SHARED)
-
-TARGET_LINK_LIBRARIES(nvtt ${LIBS} nvcore nvmath nvimage squish)
-
-INSTALL(TARGETS nvtt
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib/static)
-
-INSTALL(FILES nvtt.h DESTINATION include/nvtt)
-
-
-
-# test executables
-ADD_EXECUTABLE(nvcompress tools/compress.cpp tools/cmdline.h)
-TARGET_LINK_LIBRARIES(nvcompress nvcore nvmath nvimage nvtt)
-
-ADD_EXECUTABLE(nvdecompress tools/decompress.cpp tools/cmdline.h)
-TARGET_LINK_LIBRARIES(nvdecompress nvcore nvmath nvimage)
-
-ADD_EXECUTABLE(nvddsinfo tools/ddsinfo.cpp tools/cmdline.h)
-TARGET_LINK_LIBRARIES(nvddsinfo nvcore nvmath nvimage)
-
-ADD_EXECUTABLE(nvimgdiff tools/imgdiff.cpp tools/cmdline.h)
-TARGET_LINK_LIBRARIES(nvimgdiff nvcore nvmath nvimage)
-
-ADD_EXECUTABLE(nvassemble tools/assemble.cpp tools/cmdline.h)
-TARGET_LINK_LIBRARIES(nvassemble nvcore nvmath nvimage)
-
-ADD_EXECUTABLE(filtertest tests/filtertest.cpp tools/cmdline.h)
-TARGET_LINK_LIBRARIES(filtertest nvcore nvmath nvimage)
-
-ADD_EXECUTABLE(nvtestsuite tests/stress.cpp tools/cmdline.h)
-TARGET_LINK_LIBRARIES(nvtestsuite nvcore nvmath nvimage nvtt)
-
-ADD_EXECUTABLE(nvzoom tools/resize.cpp tools/cmdline.h)
-TARGET_LINK_LIBRARIES(nvzoom nvcore nvmath nvimage)
-
-INSTALL(TARGETS nvcompress nvdecompress nvddsinfo nvimgdiff nvassemble nvzoom nvtestsuite DESTINATION bin)
-
-#include_directories("/usr/include/ffmpeg/")
-#ADD_EXECUTABLE(nvmpegenc tools/mpegenc.cpp tools/cmdline.h)
-#TARGET_LINK_LIBRARIES(nvmpegenc nvcore nvmath nvimage avcodec z)
-#INSTALL(TARGETS nvmpegenc DESTINATION bin)
-
-# UI tools
-IF(QT4_FOUND) # AND NOT MSVC)
- SET(QT_USE_QTOPENGL TRUE)
- INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
-
- SET(SRCS
- tools/ui/main.cpp
- tools/ui/configdialog.h
- tools/ui/configdialog.cpp)
-
- SET(LIBS
- nvtt
- ${QT_QTCORE_LIBRARY}
- ${QT_QTGUI_LIBRARY}
- ${QT_QTOPENGL_LIBRARY})
-
- QT4_WRAP_UI(UICS tools/ui/configdialog.ui)
- QT4_WRAP_CPP(MOCS tools/ui/configdialog.h)
- #QT4_ADD_RESOURCES(RCCS tools/ui/configdialog.rc)
-
- ADD_EXECUTABLE(nvcompressui MACOSX_BUNDLE ${SRCS} ${UICS} ${MOCS})
- TARGET_LINK_LIBRARIES(nvcompressui ${LIBS})
-
-ENDIF(QT4_FOUND) # AND NOT MSVC)
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressDXT.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressDXT.cpp
deleted file mode 100644
index 44d8377f..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressDXT.cpp
+++ /dev/null
@@ -1,649 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvcore/Memory.h>
-
-#include <nvimage/Image.h>
-#include <nvimage/ColorBlock.h>
-#include <nvimage/BlockDXT.h>
-
-#include "nvtt.h"
-#include "CompressDXT.h"
-#include "QuickCompressDXT.h"
-#include "OptimalCompressDXT.h"
-#include "CompressionOptions.h"
-#include "OutputOptions.h"
-
-// squish
-#include "squish/colourset.h"
-#include "squish/fastclusterfit.h"
-#include "squish/weightedclusterfit.h"
-
-
-// s3_quant
-#if defined(HAVE_S3QUANT)
-#include "extern/s3tc/s3_quant.h"
-#endif
-
-// ati tc
-#if defined(HAVE_ATITC)
-#include "extern/atitc/ATI_Compress.h"
-#endif
-
-// squish
-#if defined(HAVE_SQUISH)
-#include "extern/squish/squish.h"
-#endif
-
-
-using namespace nv;
-using namespace nvtt;
-
-
-nv::FastCompressor::FastCompressor() : m_image(NULL), m_alphaMode(AlphaMode_None)
-{
-}
-
-nv::FastCompressor::~FastCompressor()
-{
-}
-
-void nv::FastCompressor::setImage(const Image * image, nvtt::AlphaMode alphaMode)
-{
- m_image = image;
- m_alphaMode = alphaMode;
-}
-
-void nv::FastCompressor::compressDXT1(const OutputOptions::Private & outputOptions)
-{
- const uint w = m_image->width();
- const uint h = m_image->height();
-
- ColorBlock rgba;
- BlockDXT1 block;
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
- rgba.init(m_image, x, y);
-
- QuickCompress::compressDXT1(rgba, &block);
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&block, sizeof(block));
- }
- }
- }
-}
-
-
-void nv::FastCompressor::compressDXT1a(const OutputOptions::Private & outputOptions)
-{
- const uint w = m_image->width();
- const uint h = m_image->height();
-
- ColorBlock rgba;
- BlockDXT1 block;
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
- rgba.init(m_image, x, y);
-
- QuickCompress::compressDXT1a(rgba, &block);
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&block, sizeof(block));
- }
- }
- }
-}
-
-
-void nv::FastCompressor::compressDXT3(const nvtt::OutputOptions::Private & outputOptions)
-{
- const uint w = m_image->width();
- const uint h = m_image->height();
-
- ColorBlock rgba;
- BlockDXT3 block;
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
- rgba.init(m_image, x, y);
-
- QuickCompress::compressDXT3(rgba, &block);
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&block, sizeof(block));
- }
- }
- }
-}
-
-
-void nv::FastCompressor::compressDXT5(const nvtt::OutputOptions::Private & outputOptions)
-{
- const uint w = m_image->width();
- const uint h = m_image->height();
-
- ColorBlock rgba;
- BlockDXT5 block;
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
- rgba.init(m_image, x, y);
-
- QuickCompress::compressDXT5(rgba, &block, 0);
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&block, sizeof(block));
- }
- }
- }
-}
-
-
-void nv::FastCompressor::compressDXT5n(const nvtt::OutputOptions::Private & outputOptions)
-{
- const uint w = m_image->width();
- const uint h = m_image->height();
-
- ColorBlock rgba;
- BlockDXT5 block;
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
- rgba.init(m_image, x, y);
-
- rgba.swizzleDXT5n();
-
- QuickCompress::compressDXT5(rgba, &block, 0);
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&block, sizeof(block));
- }
- }
- }
-}
-
-
-nv::SlowCompressor::SlowCompressor() : m_image(NULL), m_alphaMode(AlphaMode_None)
-{
-}
-
-nv::SlowCompressor::~SlowCompressor()
-{
-}
-
-void nv::SlowCompressor::setImage(const Image * image, nvtt::AlphaMode alphaMode)
-{
- m_image = image;
- m_alphaMode = alphaMode;
-}
-
-void nv::SlowCompressor::compressDXT1(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
-{
- const uint w = m_image->width();
- const uint h = m_image->height();
-
- ColorBlock rgba;
- BlockDXT1 block;
-
- nvsquish::WeightedClusterFit fit;
- //nvsquish::ClusterFit fit;
- //nvsquish::FastClusterFit fit;
- fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z());
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
-
- rgba.init(m_image, x, y);
-
- if (rgba.isSingleColor())
- {
- OptimalCompress::compressDXT1(rgba.color(0), &block);
- }
- else
- {
- nvsquish::ColourSet colours((uint8 *)rgba.colors(), 0, true);
- fit.SetColourSet(&colours, nvsquish::kDxt1);
- fit.Compress(&block);
- }
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&block, sizeof(block));
- }
- }
- }
-}
-
-
-void nv::SlowCompressor::compressDXT1a(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
-{
- const uint w = m_image->width();
- const uint h = m_image->height();
-
- ColorBlock rgba;
- BlockDXT1 block;
-
- nvsquish::WeightedClusterFit fit;
- fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z());
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
-
- rgba.init(m_image, x, y);
-
- bool anyAlpha = false;
- bool allAlpha = true;
-
- for (uint i = 0; i < 16; i++)
- {
- if (rgba.color(i).a < 128) anyAlpha = true;
- else allAlpha = false;
- }
-
- if ((!anyAlpha && rgba.isSingleColor() || allAlpha))
- {
- OptimalCompress::compressDXT1a(rgba.color(0), &block);
- }
- else
- {
- nvsquish::ColourSet colours((uint8 *)rgba.colors(), nvsquish::kDxt1|nvsquish::kWeightColourByAlpha);
- fit.SetColourSet(&colours, nvsquish::kDxt1);
- fit.Compress(&block);
- }
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&block, sizeof(block));
- }
- }
- }
-}
-
-
-void nv::SlowCompressor::compressDXT3(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
-{
- const uint w = m_image->width();
- const uint h = m_image->height();
-
- ColorBlock rgba;
- BlockDXT3 block;
-
- nvsquish::WeightedClusterFit fit;
- fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z());
-
- int flags = 0;
- if (m_alphaMode == AlphaMode_Transparency)
- {
- flags = nvsquish::kWeightColourByAlpha;
- }
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
-
- rgba.init(m_image, x, y);
-
- // Compress explicit alpha.
- OptimalCompress::compressDXT3A(rgba, &block.alpha);
-
- // Compress color.
- if (rgba.isSingleColor())
- {
- OptimalCompress::compressDXT1(rgba.color(0), &block.color);
- }
- else
- {
- nvsquish::ColourSet colours((uint8 *)rgba.colors(), flags);
- fit.SetColourSet(&colours, 0);
- fit.Compress(&block.color);
- }
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&block, sizeof(block));
- }
- }
- }
-}
-
-void nv::SlowCompressor::compressDXT5(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
-{
- const uint w = m_image->width();
- const uint h = m_image->height();
-
- ColorBlock rgba;
- BlockDXT5 block;
-
- nvsquish::WeightedClusterFit fit;
- fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z());
-
- int flags = 0;
- if (m_alphaMode == AlphaMode_Transparency)
- {
- flags = nvsquish::kWeightColourByAlpha;
- }
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
-
- rgba.init(m_image, x, y);
-
- // Compress alpha.
- if (compressionOptions.quality == Quality_Highest)
- {
- OptimalCompress::compressDXT5A(rgba, &block.alpha);
- }
- else
- {
- QuickCompress::compressDXT5A(rgba, &block.alpha);
- }
-
- // Compress color.
- if (rgba.isSingleColor())
- {
- OptimalCompress::compressDXT1(rgba.color(0), &block.color);
- }
- else
- {
- nvsquish::ColourSet colours((uint8 *)rgba.colors(), flags);
- fit.SetColourSet(&colours, 0);
- fit.Compress(&block.color);
- }
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&block, sizeof(block));
- }
- }
- }
-}
-
-
-void nv::SlowCompressor::compressDXT5n(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
-{
- const uint w = m_image->width();
- const uint h = m_image->height();
-
- ColorBlock rgba;
- BlockDXT5 block;
-
- nvsquish::WeightedClusterFit fit;
- fit.SetMetric(0, 1, 0);
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
-
- rgba.init(m_image, x, y);
-
- rgba.swizzleDXT5n();
-
- // Compress X.
- if (compressionOptions.quality == Quality_Highest)
- {
- OptimalCompress::compressDXT5A(rgba, &block.alpha);
- }
- else
- {
- QuickCompress::compressDXT5A(rgba, &block.alpha);
- }
-
- // Compress Y.
- //OptimalCompress::compressDXT1G(rgba, &block.color);
-
- /*if (rgba.isSingleColor())
- {
- OptimalCompress::compressDXT1G(rgba.color(0), &block.color);
- }
- else*/
- {
- nvsquish::ColourSet colours((uint8 *)rgba.colors(), 0);
- fit.SetColourSet(&colours, 0);
- fit.Compress(&block.color);
- }
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&block, sizeof(block));
- }
- }
- }
-}
-
-
-void nv::SlowCompressor::compressBC4(const CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions)
-{
- const uint w = m_image->width();
- const uint h = m_image->height();
-
- ColorBlock rgba;
- AlphaBlockDXT5 block;
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
-
- rgba.init(m_image, x, y);
-
- if (compressionOptions.quality == Quality_Highest)
- {
- OptimalCompress::compressDXT5A(rgba, &block);
- }
- else
- {
- QuickCompress::compressDXT5A(rgba, &block);
- }
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&block, sizeof(block));
- }
- }
- }
-}
-
-
-void nv::SlowCompressor::compressBC5(const CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions)
-{
- const uint w = m_image->width();
- const uint h = m_image->height();
-
- ColorBlock xcolor;
- ColorBlock ycolor;
-
- BlockATI2 block;
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
-
- xcolor.init(m_image, x, y);
- xcolor.splatX();
-
- ycolor.init(m_image, x, y);
- ycolor.splatY();
-
- if (compressionOptions.quality == Quality_Highest)
- {
- OptimalCompress::compressDXT5A(xcolor, &block.x);
- OptimalCompress::compressDXT5A(ycolor, &block.y);
- }
- else
- {
- QuickCompress::compressDXT5A(xcolor, &block.x);
- QuickCompress::compressDXT5A(ycolor, &block.y);
- }
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&block, sizeof(block));
- }
- }
- }
-}
-
-
-#if defined(HAVE_S3QUANT)
-
-void nv::s3CompressDXT1(const Image * image, const nvtt::OutputOptions::Private & outputOptions)
-{
- const uint w = image->width();
- const uint h = image->height();
-
- float error = 0.0f;
-
- BlockDXT1 dxtBlock3;
- BlockDXT1 dxtBlock4;
- ColorBlock block;
-
- for (uint y = 0; y < h; y += 4) {
- for (uint x = 0; x < w; x += 4) {
- block.init(image, x, y);
-
- // Init rgb block.
- RGBBlock rgbBlock;
- rgbBlock.n = 16;
- for (uint i = 0; i < 16; i++) {
- rgbBlock.colorChannel[i][0] = clamp(float(block.color(i).r) / 255.0f, 0.0f, 1.0f);
- rgbBlock.colorChannel[i][1] = clamp(float(block.color(i).g) / 255.0f, 0.0f, 1.0f);
- rgbBlock.colorChannel[i][2] = clamp(float(block.color(i).b) / 255.0f, 0.0f, 1.0f);
- }
- rgbBlock.weight[0] = 1.0f;
- rgbBlock.weight[1] = 1.0f;
- rgbBlock.weight[2] = 1.0f;
-
- rgbBlock.inLevel = 4;
- CodeRGBBlock(&rgbBlock);
-
- // Copy results to DXT block.
- dxtBlock4.col0.r = rgbBlock.endPoint[0][0];
- dxtBlock4.col0.g = rgbBlock.endPoint[0][1];
- dxtBlock4.col0.b = rgbBlock.endPoint[0][2];
-
- dxtBlock4.col1.r = rgbBlock.endPoint[1][0];
- dxtBlock4.col1.g = rgbBlock.endPoint[1][1];
- dxtBlock4.col1.b = rgbBlock.endPoint[1][2];
-
- dxtBlock4.setIndices(rgbBlock.index);
-
- if (dxtBlock4.col0.u < dxtBlock4.col1.u) {
- swap(dxtBlock4.col0.u, dxtBlock4.col1.u);
- dxtBlock4.indices ^= 0x55555555;
- }
-
- uint error4 = blockError(block, dxtBlock4);
-
- rgbBlock.inLevel = 3;
-
- CodeRGBBlock(&rgbBlock);
-
- // Copy results to DXT block.
- dxtBlock3.col0.r = rgbBlock.endPoint[0][0];
- dxtBlock3.col0.g = rgbBlock.endPoint[0][1];
- dxtBlock3.col0.b = rgbBlock.endPoint[0][2];
-
- dxtBlock3.col1.r = rgbBlock.endPoint[1][0];
- dxtBlock3.col1.g = rgbBlock.endPoint[1][1];
- dxtBlock3.col1.b = rgbBlock.endPoint[1][2];
-
- dxtBlock3.setIndices(rgbBlock.index);
-
- if (dxtBlock3.col0.u > dxtBlock3.col1.u) {
- swap(dxtBlock3.col0.u, dxtBlock3.col1.u);
- dxtBlock3.indices ^= (~dxtBlock3.indices >> 1) & 0x55555555;
- }
-
- uint error3 = blockError(block, dxtBlock3);
-
- if (error3 < error4) {
- error += error3;
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&dxtBlock3, sizeof(dxtBlock3));
- }
- }
- else {
- error += error4;
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(&dxtBlock4, sizeof(dxtBlock4));
- }
- }
- }
- }
-
- printf("error = %f\n", error/((w+3)/4 * (h+3)/4));
-}
-
-#endif // defined(HAVE_S3QUANT)
-
-
-#if defined(HAVE_ATITC)
-
-void nv::atiCompressDXT1(const Image * image, const OutputOptions::Private & outputOptions)
-{
- // Init source texture
- ATI_TC_Texture srcTexture;
- srcTexture.dwSize = sizeof(srcTexture);
- srcTexture.dwWidth = image->width();
- srcTexture.dwHeight = image->height();
- srcTexture.dwPitch = image->width() * 4;
- srcTexture.format = ATI_TC_FORMAT_ARGB_8888;
- srcTexture.dwDataSize = ATI_TC_CalculateBufferSize(&srcTexture);
- srcTexture.pData = (ATI_TC_BYTE*) image->pixels();
-
- // Init dest texture
- ATI_TC_Texture destTexture;
- destTexture.dwSize = sizeof(destTexture);
- destTexture.dwWidth = image->width();
- destTexture.dwHeight = image->height();
- destTexture.dwPitch = 0;
- destTexture.format = ATI_TC_FORMAT_DXT1;
- destTexture.dwDataSize = ATI_TC_CalculateBufferSize(&destTexture);
- destTexture.pData = (ATI_TC_BYTE*) malloc(destTexture.dwDataSize);
-
- // Compress
- ATI_TC_ConvertTexture(&srcTexture, &destTexture, NULL, NULL, NULL, NULL);
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(destTexture.pData, destTexture.dwDataSize);
- }
-}
-
-#endif // defined(HAVE_ATITC)
-
-#if defined(HAVE_SQUISH)
-
-void nv::squishCompressDXT1(const Image * image, const OutputOptions::Private & outputOptions)
-{
- Image img(*image);
- int count = img.width() * img.height();
- for (int i = 0; i < count; i++)
- {
- Color32 c = img.pixel(i);
- img.pixel(i) = Color32(c.b, c.g, c.r, c.a);
- }
-
- int size = squish::GetStorageRequirements(img.width(), img.height(), squish::kDxt1);
- void * blocks = malloc(size);
-
- squish::CompressImage((const squish::u8 *)img.pixels(), img.width(), img.height(), blocks, squish::kDxt1 | squish::kColourClusterFit);
-
- if (outputOptions.outputHandler != NULL) {
- outputOptions.outputHandler->writeData(blocks, size);
- }
-}
-
-#endif // defined(HAVE_SQUISH) \ No newline at end of file
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressDXT.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressDXT.h
deleted file mode 100644
index a20d768e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressDXT.h
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_COMPRESSDXT_H
-#define NV_TT_COMPRESSDXT_H
-
-#include <nvimage/nvimage.h>
-#include "nvtt.h"
-
-namespace nv
-{
- class Image;
- class FloatImage;
-
- class FastCompressor
- {
- public:
- FastCompressor();
- ~FastCompressor();
-
- void setImage(const Image * image, nvtt::AlphaMode alphaMode);
-
- void compressDXT1(const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT1a(const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT3(const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT5(const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT5n(const nvtt::OutputOptions::Private & outputOptions);
-
- private:
- const Image * m_image;
- nvtt::AlphaMode m_alphaMode;
- };
-
- class SlowCompressor
- {
- public:
- SlowCompressor();
- ~SlowCompressor();
-
- void setImage(const Image * image, nvtt::AlphaMode alphaMode);
-
- void compressDXT1(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT1a(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT3(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT5(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT5n(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
- void compressBC4(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
- void compressBC5(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
-
- private:
- const Image * m_image;
- nvtt::AlphaMode m_alphaMode;
- };
-
- // External compressors.
-#if defined(HAVE_S3QUANT)
- void s3CompressDXT1(const Image * image, const nvtt::OutputOptions::Private & outputOptions);
-#endif
-
-#if defined(HAVE_ATITC)
- void atiCompressDXT1(const Image * image, const nvtt::OutputOptions::Private & outputOptions);
-#endif
-
-#if defined(HAVE_SQUISH)
- void squishCompressDXT1(const Image * image, const nvtt::OutputOptions::Private & outputOptions);
-#endif
-
-} // nv namespace
-
-
-#endif // NV_TT_COMPRESSDXT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressRGB.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressRGB.cpp
deleted file mode 100644
index 29f88a72..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressRGB.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include "CompressRGB.h"
-#include "CompressionOptions.h"
-#include "OutputOptions.h"
-
-#include <nvimage/Image.h>
-#include <nvimage/FloatImage.h>
-#include <nvimage/PixelFormat.h>
-
-#include <nvmath/Color.h>
-#include <nvmath/Half.h>
-
-#include <nvcore/Debug.h>
-
-using namespace nv;
-using namespace nvtt;
-
-namespace
-{
-
- inline uint computePitch(uint w, uint bitsize)
- {
- uint p = w * ((bitsize + 7) / 8);
-
- // Align to 32 bits.
- return ((p + 3) / 4) * 4;
- }
-
- inline void convert_to_a8r8g8b8(const void * src, void * dst, uint w)
- {
- memcpy(dst, src, 4 * w);
- }
-
- inline void convert_to_x8r8g8b8(const void * src, void * dst, uint w)
- {
- memcpy(dst, src, 4 * w);
- }
-
-} // namespace
-
-
-// Pixel format converter.
-void nv::compressRGB(const Image * image, const OutputOptions::Private & outputOptions, const CompressionOptions::Private & compressionOptions)
-{
- nvCheck(image != NULL);
-
- const uint w = image->width();
- const uint h = image->height();
-
- uint bitCount;
- uint rmask, rshift, rsize;
- uint gmask, gshift, gsize;
- uint bmask, bshift, bsize;
- uint amask, ashift, asize;
-
- if (compressionOptions.bitcount != 0)
- {
- bitCount = compressionOptions.bitcount;
- nvCheck(bitCount == 8 || bitCount == 16 || bitCount == 24 || bitCount == 32);
-
- rmask = compressionOptions.rmask;
- gmask = compressionOptions.gmask;
- bmask = compressionOptions.bmask;
- amask = compressionOptions.amask;
-
- PixelFormat::maskShiftAndSize(rmask, &rshift, &rsize);
- PixelFormat::maskShiftAndSize(gmask, &gshift, &gsize);
- PixelFormat::maskShiftAndSize(bmask, &bshift, &bsize);
- PixelFormat::maskShiftAndSize(amask, &ashift, &asize);
- }
- else
- {
- rsize = compressionOptions.rsize;
- gsize = compressionOptions.gsize;
- bsize = compressionOptions.bsize;
- asize = compressionOptions.asize;
-
- bitCount = rsize + gsize + bsize + asize;
- nvCheck(bitCount <= 32);
-
- ashift = 0;
- bshift = ashift + asize;
- gshift = bshift + bsize;
- rshift = gshift + gsize;
-
- rmask = ((1 << rsize) - 1) << rshift;
- gmask = ((1 << gsize) - 1) << gshift;
- bmask = ((1 << bsize) - 1) << bshift;
- amask = ((1 << asize) - 1) << ashift;
- }
-
- const uint byteCount = bitCount / 8;
-
-
- // Determine pitch.
- uint pitch = computePitch(w, bitCount);
-
- uint8 * dst = malloc<uint8>(pitch + 4);
-
- for (uint y = 0; y < h; y++)
- {
- const Color32 * src = image->scanline(y);
-
- if (bitCount == 32 && rmask == 0xFF0000 && gmask == 0xFF00 && bmask == 0xFF && amask == 0xFF000000)
- {
- convert_to_a8r8g8b8(src, dst, w);
- }
- else if (bitCount == 32 && rmask == 0xFF0000 && gmask == 0xFF00 && bmask == 0xFF && amask == 0)
- {
- convert_to_x8r8g8b8(src, dst, w);
- }
- else
- {
- // Generic pixel format conversion.
- for (uint x = 0; x < w; x++)
- {
- uint c = 0;
- c |= PixelFormat::convert(src[x].r, 8, rsize) << rshift;
- c |= PixelFormat::convert(src[x].g, 8, gsize) << gshift;
- c |= PixelFormat::convert(src[x].b, 8, bsize) << bshift;
- c |= PixelFormat::convert(src[x].a, 8, asize) << ashift;
-
- // Output one byte at a time.
- for (uint i = 0; i < byteCount; i++)
- {
- *(dst + x * byteCount + i) = (c >> (i * 8)) & 0xFF;
- }
- }
-
- // Zero padding.
- for (uint x = w; x < pitch; x++)
- {
- *(dst + x) = 0;
- }
- }
-
- if (outputOptions.outputHandler != NULL)
- {
- outputOptions.outputHandler->writeData(dst, pitch);
- }
- }
-
- free(dst);
-}
-
-
-void nv::compressRGB(const FloatImage * image, const OutputOptions::Private & outputOptions, const CompressionOptions::Private & compressionOptions)
-{
- nvCheck(image != NULL);
-
- const uint w = image->width();
- const uint h = image->height();
-
- const uint rsize = compressionOptions.rsize;
- const uint gsize = compressionOptions.gsize;
- const uint bsize = compressionOptions.bsize;
- const uint asize = compressionOptions.asize;
-
- nvCheck(rsize == 0 || rsize == 16 || rsize == 32);
- nvCheck(gsize == 0 || gsize == 16 || gsize == 32);
- nvCheck(bsize == 0 || bsize == 16 || bsize == 32);
- nvCheck(asize == 0 || asize == 16 || asize == 32);
-
- const uint bitCount = rsize + gsize + bsize + asize;
- const uint byteCount = bitCount / 8;
- const uint pitch = w * byteCount;
-
- uint8 * dst = (uint8 *)malloc<uint8>(pitch);
-
- for (uint y = 0; y < h; y++)
- {
- const float * rchannel = image->scanline(y, 0);
- const float * gchannel = image->scanline(y, 1);
- const float * bchannel = image->scanline(y, 2);
- const float * achannel = image->scanline(y, 3);
-
- union FLOAT
- {
- float f;
- uint32 u;
- };
-
- uint8 * ptr = dst;
-
- for (uint x = 0; x < w; x++)
- {
- FLOAT r, g, b, a;
- r.f = rchannel[x];
- g.f = gchannel[x];
- b.f = bchannel[x];
- a.f = achannel[x];
-
- if (rsize == 32) *((uint32 *)ptr) = r.u;
- else if (rsize == 16) *((uint16 *)ptr) = half_from_float(r.u);
- ptr += rsize / 8;
-
- if (gsize == 32) *((uint32 *)ptr) = g.u;
- else if (gsize == 16) *((uint16 *)ptr) = half_from_float(g.u);
- ptr += gsize / 8;
-
- if (bsize == 32) *((uint32 *)ptr) = b.u;
- else if (bsize == 16) *((uint16 *)ptr) = half_from_float(b.u);
- ptr += bsize / 8;
-
- if (asize == 32) *((uint32 *)ptr) = a.u;
- else if (asize == 16) *((uint16 *)ptr) = half_from_float(a.u);
- ptr += asize / 8;
- }
-
- if (outputOptions.outputHandler != NULL)
- {
- outputOptions.outputHandler->writeData(dst, pitch);
- }
- }
-
- free(dst);
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressRGB.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressRGB.h
deleted file mode 100644
index 64eb6c83..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressRGB.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_COMPRESSRGB_H
-#define NV_TT_COMPRESSRGB_H
-
-#include "nvtt.h"
-
-namespace nv
-{
- class Image;
- class FloatImage;
-
- // Pixel format converter.
- void compressRGB(const Image * image, const nvtt::OutputOptions::Private & outputOptions, const nvtt::CompressionOptions::Private & compressionOptions);
- void compressRGB(const FloatImage * image, const nvtt::OutputOptions::Private & outputOptions, const nvtt::CompressionOptions::Private & compressionOptions);
-
-} // nv namespace
-
-
-#endif // NV_TT_COMPRESSDXT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressionOptions.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressionOptions.cpp
deleted file mode 100644
index aa1af77b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressionOptions.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include "nvtt.h"
-#include "CompressionOptions.h"
-
-using namespace nv;
-using namespace nvtt;
-
-
-/// Constructor. Sets compression options to the default values.
-CompressionOptions::CompressionOptions() : m(*new CompressionOptions::Private())
-{
- reset();
-}
-
-
-/// Destructor.
-CompressionOptions::~CompressionOptions()
-{
- delete &m;
-}
-
-
-/// Set default compression options.
-void CompressionOptions::reset()
-{
- m.format = Format_DXT1;
- m.quality = Quality_Normal;
- m.colorWeight.set(1.0f, 1.0f, 1.0f, 1.0f);
-
- m.bitcount = 32;
- m.bmask = 0x000000FF;
- m.gmask = 0x0000FF00;
- m.rmask = 0x00FF0000;
- m.amask = 0xFF000000;
-
- m.enableColorDithering = false;
- m.enableAlphaDithering = false;
- m.binaryAlpha = false;
- m.alphaThreshold = 127;
-}
-
-
-/// Set desired compression format.
-void CompressionOptions::setFormat(Format format)
-{
- m.format = format;
-}
-
-
-/// Set compression quality settings.
-void CompressionOptions::setQuality(Quality quality)
-{
- m.quality = quality;
-}
-
-
-/// Set the weights of each color channel.
-/// The choice for these values is subjective. In many case uniform color weights
-/// (1.0, 1.0, 1.0) work very well. A popular choice is to use the NTSC luma encoding
-/// weights (0.2126, 0.7152, 0.0722), but I think that blue contributes to our
-/// perception more than a 7%. A better choice in my opinion is (3, 4, 2).
-void CompressionOptions::setColorWeights(float red, float green, float blue, float alpha/*=1.0f*/)
-{
-// float total = red + green + blue;
-// float x = red / total;
-// float y = green / total;
-// m.colorWeight.set(x, y, 1.0f - x - y);
- m.colorWeight.set(red, green, blue, alpha);
-}
-
-
-/// Set color mask to describe the RGB/RGBA format.
-void CompressionOptions::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
-{
- // Validate arguments.
- nvCheck(bitcount == 8 || bitcount == 16 || bitcount == 24 || bitcount == 32);
- nvCheck((rmask & gmask) == 0);
- nvCheck((rmask & bmask) == 0);
- nvCheck((rmask & amask) == 0);
- nvCheck((gmask & bmask) == 0);
- nvCheck((gmask & amask) == 0);
- nvCheck((bmask & amask) == 0);
-
- if (bitcount != 32)
- {
- uint maxMask = (1 << bitcount);
- nvCheck(maxMask > rmask);
- nvCheck(maxMask > gmask);
- nvCheck(maxMask > bmask);
- nvCheck(maxMask > amask);
- }
-
- m.bitcount = bitcount;
- m.rmask = rmask;
- m.gmask = gmask;
- m.bmask = bmask;
- m.amask = amask;
-
- m.rsize = 0;
- m.gsize = 0;
- m.bsize = 0;
- m.asize = 0;
-}
-
-void CompressionOptions::setPixelFormat(uint8 rsize, uint8 gsize, uint8 bsize, uint8 asize)
-{
- nvCheck(rsize <= 32 || gsize <= 32 || bsize <= 32 || asize <= 32);
-
- m.bitcount = 0;
- m.rmask = 0;
- m.gmask = 0;
- m.bmask = 0;
- m.amask = 0;
-
- m.rsize = rsize;
- m.gsize = gsize;
- m.bsize = bsize;
- m.asize = asize;
-}
-
-/// Set pixel type.
-void CompressionOptions::setPixelType(PixelType pixelType)
-{
- m.pixelType = pixelType;
-}
-
-
-/// Use external compressor.
-void CompressionOptions::setExternalCompressor(const char * name)
-{
- m.externalCompressor = name;
-}
-
-/// Set quantization options.
-/// @warning Do not enable dithering unless you know what you are doing. Quantization
-/// introduces errors. It's better to let the compressor quantize the result to
-/// minimize the error, instead of quantizing the data before handling it to
-/// the compressor.
-void CompressionOptions::setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold/*= 127*/)
-{
- nvCheck(alphaThreshold >= 0 && alphaThreshold < 256);
- m.enableColorDithering = colorDithering;
- m.enableAlphaDithering = alphaDithering;
- m.binaryAlpha = binaryAlpha;
- m.alphaThreshold = alphaThreshold;
-}
-
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressionOptions.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressionOptions.h
deleted file mode 100644
index 73035b65..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/CompressionOptions.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_COMPRESSIONOPTIONS_H
-#define NV_TT_COMPRESSIONOPTIONS_H
-
-#include <nvcore/StrLib.h>
-#include <nvmath/Vector.h>
-#include "nvtt.h"
-
-namespace nvtt
-{
-
- struct CompressionOptions::Private
- {
- Format format;
-
- Quality quality;
-
- nv::Vector4 colorWeight;
-
- // Pixel format description.
- uint bitcount;
- uint rmask;
- uint gmask;
- uint bmask;
- uint amask;
- uint8 rsize;
- uint8 gsize;
- uint8 bsize;
- uint8 asize;
-
- PixelType pixelType;
-
- nv::String externalCompressor;
-
- // Quantization.
- bool enableColorDithering;
- bool enableAlphaDithering;
- bool binaryAlpha;
- int alphaThreshold; // reference value used for binary alpha quantization.
- };
-
-} // nvtt namespace
-
-
-#endif // NV_TT_COMPRESSIONOPTIONS_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/Compressor.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/Compressor.cpp
deleted file mode 100644
index 34066493..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/Compressor.cpp
+++ /dev/null
@@ -1,1148 +0,0 @@
-// Copyright NVIDIA Corporation 2008 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvtt/nvtt.h>
-
-#include <nvcore/Memory.h>
-#include <nvcore/Ptr.h>
-
-#include <nvimage/DirectDrawSurface.h>
-#include <nvimage/ColorBlock.h>
-#include <nvimage/BlockDXT.h>
-#include <nvimage/Image.h>
-#include <nvimage/FloatImage.h>
-#include <nvimage/Filter.h>
-#include <nvimage/Quantize.h>
-#include <nvimage/NormalMap.h>
-#include <nvimage/PixelFormat.h>
-#include <nvimage/ColorSpace.h>
-
-#include "Compressor.h"
-#include "InputOptions.h"
-#include "CompressionOptions.h"
-#include "OutputOptions.h"
-
-#include "CompressDXT.h"
-#include "CompressRGB.h"
-#include "cuda/CudaUtils.h"
-#include "cuda/CudaCompressDXT.h"
-
-
-using namespace nv;
-using namespace nvtt;
-
-
-namespace
-{
-
- static int blockSize(Format format)
- {
- if (format == Format_DXT1 || format == Format_DXT1a || format == Format_DXT1n) {
- return 8;
- }
- else if (format == Format_DXT3) {
- return 16;
- }
- else if (format == Format_DXT5 || format == Format_DXT5n) {
- return 16;
- }
- else if (format == Format_BC4) {
- return 8;
- }
- else if (format == Format_BC5) {
- return 16;
- }
- else if (format == Format_CTX1) {
- return 8;
- }
- return 0;
- }
-
- inline uint computePitch(uint w, uint bitsize)
- {
- uint p = w * ((bitsize + 7) / 8);
-
- // Align to 32 bits.
- return ((p + 3) / 4) * 4;
- }
-
- static int computeImageSize(uint w, uint h, uint d, uint bitCount, Format format)
- {
- if (format == Format_RGBA) {
- return d * h * computePitch(w, bitCount);
- }
- else {
- // @@ Handle 3D textures. DXT and VTC have different behaviors.
- return ((w + 3) / 4) * ((h + 3) / 4) * blockSize(format);
- }
- }
-
-} // namespace
-
-namespace nvtt
-{
- // Mipmap could be:
- // - a pointer to an input image.
- // - a fixed point image.
- // - a floating point image.
- struct Mipmap
- {
- Mipmap() : m_inputImage(NULL) {}
- ~Mipmap() {}
-
- // Reference input image.
- void setFromInput(const InputOptions::Private & inputOptions, uint idx)
- {
- m_inputImage = inputOptions.image(idx);
- m_fixedImage = NULL;
- m_floatImage = NULL;
-
- if (const FloatImage * floatImage = inputOptions.floatImage(idx))
- {
- m_floatImage = floatImage->clone();
- }
- }
-
- // Assign and take ownership of given image.
- void setImage(FloatImage * image)
- {
- m_inputImage = NULL;
- m_fixedImage = NULL;
- m_floatImage = image;
- }
-
-
- // Convert linear float image to fixed image ready for compression.
- void toFixedImage(const InputOptions::Private & inputOptions)
- {
- if (this->asFixedImage() == NULL)
- {
- nvDebugCheck(m_floatImage != NULL);
-
- if (inputOptions.isNormalMap || inputOptions.outputGamma == 1.0f)
- {
- m_fixedImage = m_floatImage->createImage();
- }
- else
- {
- m_fixedImage = m_floatImage->createImageGammaCorrect(inputOptions.outputGamma);
- }
- }
- }
-
- // Convert input image to linear float image.
- void toFloatImage(const InputOptions::Private & inputOptions)
- {
- if (m_floatImage == NULL)
- {
- nvDebugCheck(this->asFixedImage() != NULL);
-
- m_floatImage = new FloatImage(this->asFixedImage());
-
- if (inputOptions.isNormalMap)
- {
- // Expand normals to [-1, 1] range.
- // floatImage->expandNormals(0);
- }
- else if (inputOptions.inputGamma != 1.0f)
- {
- // Convert to linear space.
- m_floatImage->toLinear(0, 3, inputOptions.inputGamma);
- }
- }
- }
-
- const FloatImage * asFloatImage() const
- {
- return m_floatImage.ptr();
- }
-
- FloatImage * asMutableFloatImage()
- {
- m_inputImage = NULL;
- return m_floatImage.ptr();
- }
-
- const Image * asFixedImage() const
- {
- if (m_inputImage != NULL)
- {
- return m_inputImage;
- }
- return m_fixedImage.ptr();
- }
-
- Image * asMutableFixedImage()
- {
- if (m_inputImage != NULL)
- {
- // Do not modify input image, create a copy.
- m_fixedImage = new Image(*m_inputImage);
- m_inputImage = NULL;
- }
- return m_fixedImage.ptr();
- }
-
-
- private:
- const Image * m_inputImage;
- AutoPtr<Image> m_fixedImage;
- AutoPtr<FloatImage> m_floatImage;
- };
-
-} // nvtt namespace
-
-
-Compressor::Compressor() : m(*new Compressor::Private())
-{
- // CUDA initialization.
- m.cudaSupported = cuda::isHardwarePresent();
- m.cudaEnabled = m.cudaSupported;
-
- if (m.cudaEnabled)
- {
- // Select fastest CUDA device.
- int device = cuda::getFastestDevice();
- cuda::setDevice(device);
-
- m.cuda = new CudaCompressor();
-
- if (!m.cuda->isValid())
- {
- m.cudaEnabled = false;
- m.cuda = NULL;
- }
- }
-}
-
-Compressor::~Compressor()
-{
- delete &m;
-}
-
-
-/// Enable CUDA acceleration.
-void Compressor::enableCudaAcceleration(bool enable)
-{
- if (m.cudaSupported)
- {
- m.cudaEnabled = enable;
- }
-
- if (m.cudaEnabled && m.cuda == NULL)
- {
- // Select fastest CUDA device.
- int device = cuda::getFastestDevice();
- cuda::setDevice(device);
-
- m.cuda = new CudaCompressor();
-
- if (!m.cuda->isValid())
- {
- m.cudaEnabled = false;
- m.cuda = NULL;
- }
- }
-}
-
-/// Check if CUDA acceleration is enabled.
-bool Compressor::isCudaAccelerationEnabled() const
-{
- return m.cudaEnabled;
-}
-
-
-/// Compress the input texture with the given compression options.
-bool Compressor::process(const InputOptions & inputOptions, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const
-{
- return m.compress(inputOptions.m, compressionOptions.m, outputOptions.m);
-}
-
-
-/// Estimate the size of compressing the input with the given options.
-int Compressor::estimateSize(const InputOptions & inputOptions, const CompressionOptions & compressionOptions) const
-{
- return m.estimateSize(inputOptions.m, compressionOptions.m);
-}
-
-
-
-
-bool Compressor::Private::compress(const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const
-{
- // Make sure enums match.
- nvStaticCheck(FloatImage::WrapMode_Clamp == (FloatImage::WrapMode)WrapMode_Clamp);
- nvStaticCheck(FloatImage::WrapMode_Mirror == (FloatImage::WrapMode)WrapMode_Mirror);
- nvStaticCheck(FloatImage::WrapMode_Repeat == (FloatImage::WrapMode)WrapMode_Repeat);
-
- // Get output handler.
- if (!outputOptions.openFile())
- {
- if (outputOptions.errorHandler) outputOptions.errorHandler->error(Error_FileOpen);
- return false;
- }
-
- inputOptions.computeTargetExtents();
-
- // Output DDS header.
- if (!outputHeader(inputOptions, compressionOptions, outputOptions))
- {
- return false;
- }
-
- for (uint f = 0; f < inputOptions.faceCount; f++)
- {
- if (!compressMipmaps(f, inputOptions, compressionOptions, outputOptions))
- {
- return false;
- }
- }
-
- outputOptions.closeFile();
-
- return true;
-}
-
-
-// Output DDS header.
-bool Compressor::Private::outputHeader(const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const
-{
- // Output DDS header.
- if (outputOptions.outputHandler == NULL || !outputOptions.outputHeader)
- {
- return true;
- }
-
- if (outputOptions.container == Container_DDS || outputOptions.container == Container_DDS10)
- {
- DDSHeader header;
-
- header.setWidth(inputOptions.targetWidth);
- header.setHeight(inputOptions.targetHeight);
-
- int mipmapCount = inputOptions.realMipmapCount();
- nvDebugCheck(mipmapCount > 0);
-
- header.setMipmapCount(mipmapCount);
-
- bool supported = true;
-
- if (outputOptions.container == Container_DDS10)
- {
- if (compressionOptions.format == Format_RGBA)
- {
- if (compressionOptions.bitcount == 16)
- {
- // B5G6R5_UNORM
- // B5G5R5A1_UNORM
- supported = false;
- }
- else if (compressionOptions.bitcount == 32)
- {
- // B8G8R8A8_UNORM
- // B8G8R8X8_UNORM
- // R8G8B8A8_UNORM
- // R10G10B10A2_UNORM
- supported = false;
- }
- else {
- supported = false;
- }
- }
- else
- {
- if (compressionOptions.format == Format_DXT1 || compressionOptions.format == Format_DXT1a || compressionOptions.format == Format_DXT1n) {
- header.setDX10Format(71);
- if (inputOptions.isNormalMap) header.setNormalFlag(true);
- }
- else if (compressionOptions.format == Format_DXT3) {
- header.setDX10Format(74);
- }
- else if (compressionOptions.format == Format_DXT5) {
- header.setDX10Format(77);
- }
- else if (compressionOptions.format == Format_DXT5n) {
- header.setDX10Format(77);
- if (inputOptions.isNormalMap) header.setNormalFlag(true);
- }
- else if (compressionOptions.format == Format_BC4) {
- header.setDX10Format(80);
- }
- else if (compressionOptions.format == Format_BC5) {
- header.setDX10Format(83);
- if (inputOptions.isNormalMap) header.setNormalFlag(true);
- }
- else {
- supported = false;
- }
- }
- }
- else
- {
- if (compressionOptions.format == Format_RGBA)
- {
- header.setPitch(computePitch(inputOptions.targetWidth, compressionOptions.bitcount));
-
- if (compressionOptions.bitcount != 0)
- {
- header.setPixelFormat(compressionOptions.bitcount, compressionOptions.rmask, compressionOptions.gmask, compressionOptions.bmask, compressionOptions.amask);
- }
- else
- {
- if (compressionOptions.pixelType == PixelType_Float)
- {
- if (compressionOptions.rsize == 16 && compressionOptions.gsize == 0 && compressionOptions.bsize == 0 && compressionOptions.asize == 0)
- {
- header.setFormatCode(111); // D3DFMT_R16F
- }
- else if (compressionOptions.rsize == 16 && compressionOptions.gsize == 16 && compressionOptions.bsize == 0 && compressionOptions.asize == 0)
- {
- header.setFormatCode(112); // D3DFMT_G16R16F
- }
- else if (compressionOptions.rsize == 16 && compressionOptions.gsize == 16 && compressionOptions.bsize == 16 && compressionOptions.asize == 16)
- {
- header.setFormatCode(113); // D3DFMT_A16B16G16R16F
- }
- else if (compressionOptions.rsize == 32 && compressionOptions.gsize == 0 && compressionOptions.bsize == 0 && compressionOptions.asize == 0)
- {
- header.setFormatCode(114); // D3DFMT_R32F
- }
- else if (compressionOptions.rsize == 32 && compressionOptions.gsize == 32 && compressionOptions.bsize == 0 && compressionOptions.asize == 0)
- {
- header.setFormatCode(115); // D3DFMT_G32R32F
- }
- else if (compressionOptions.rsize == 32 && compressionOptions.gsize == 32 && compressionOptions.bsize == 32 && compressionOptions.asize == 32)
- {
- header.setFormatCode(116); // D3DFMT_A32B32G32R32F
- }
- else
- {
- supported = false;
- }
- }
- else
- {
- supported = false;
- }
- }
- }
- else
- {
- header.setLinearSize(computeImageSize(inputOptions.targetWidth, inputOptions.targetHeight, inputOptions.targetDepth, compressionOptions.bitcount, compressionOptions.format));
-
- if (compressionOptions.format == Format_DXT1 || compressionOptions.format == Format_DXT1a || compressionOptions.format == Format_DXT1n) {
- header.setFourCC('D', 'X', 'T', '1');
- if (inputOptions.isNormalMap) header.setNormalFlag(true);
- }
- else if (compressionOptions.format == Format_DXT3) {
- header.setFourCC('D', 'X', 'T', '3');
- }
- else if (compressionOptions.format == Format_DXT5) {
- header.setFourCC('D', 'X', 'T', '5');
- }
- else if (compressionOptions.format == Format_DXT5n) {
- header.setFourCC('D', 'X', 'T', '5');
- if (inputOptions.isNormalMap) {
- header.setNormalFlag(true);
- header.setSwizzleCode('A', '2', 'D', '5');
- //header.setSwizzleCode('x', 'G', 'x', 'R');
- }
- }
- else if (compressionOptions.format == Format_BC4) {
- header.setFourCC('A', 'T', 'I', '1');
- }
- else if (compressionOptions.format == Format_BC5) {
- header.setFourCC('A', 'T', 'I', '2');
- if (inputOptions.isNormalMap) {
- header.setNormalFlag(true);
- header.setSwizzleCode('A', '2', 'X', 'Y');
- }
- }
- else if (compressionOptions.format == Format_CTX1) {
- header.setFourCC('C', 'T', 'X', '1');
- if (inputOptions.isNormalMap) header.setNormalFlag(true);
- }
- else {
- supported = false;
- }
- }
- }
-
- if (!supported)
- {
- // This container does not support the requested format.
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_UnsupportedOutputFormat);
- }
-
- return false;
- }
-
- if (inputOptions.textureType == TextureType_2D) {
- header.setTexture2D();
- }
- else if (inputOptions.textureType == TextureType_Cube) {
- header.setTextureCube();
- }
- /*else if (inputOptions.textureType == TextureType_3D) {
- header.setTexture3D();
- header.setDepth(inputOptions.targetDepth);
- }*/
-
- // Swap bytes if necessary.
- header.swapBytes();
-
- uint headerSize = 128;
- if (header.hasDX10Header())
- {
- nvStaticCheck(sizeof(DDSHeader) == 128 + 20);
- headerSize = 128 + 20;
- }
-
- bool writeSucceed = outputOptions.outputHandler->writeData(&header, headerSize);
- if (!writeSucceed && outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_FileWrite);
- }
-
- return writeSucceed;
- }
-
- return true;
-}
-
-
-bool Compressor::Private::compressMipmaps(uint f, const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const
-{
- uint w = inputOptions.targetWidth;
- uint h = inputOptions.targetHeight;
- uint d = inputOptions.targetDepth;
-
- Mipmap mipmap;
-
- const uint mipmapCount = inputOptions.realMipmapCount();
- nvDebugCheck(mipmapCount > 0);
-
- for (uint m = 0; m < mipmapCount; m++)
- {
- if (outputOptions.outputHandler)
- {
- int size = computeImageSize(w, h, d, compressionOptions.bitcount, compressionOptions.format);
- outputOptions.outputHandler->beginImage(size, w, h, d, f, m);
- }
-
- if (!initMipmap(mipmap, inputOptions, w, h, d, f, m))
- {
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_InvalidInput);
- return false;
- }
- }
-
- if (compressionOptions.pixelType == PixelType_Float)
- {
- mipmap.toFloatImage(inputOptions);
-
- // @@ Convert to linear space.
- }
- else
- {
- // Convert linear float image to fixed image ready for compression.
- mipmap.toFixedImage(inputOptions);
-
- if (inputOptions.premultiplyAlpha)
- {
- premultiplyAlphaMipmap(mipmap, inputOptions);
- }
-
- // Apply gamma space color transforms:
- if (inputOptions.colorTransform == ColorTransform_YCoCg)
- {
- ColorSpace::RGBtoYCoCg_R(mipmap.asMutableFixedImage());
- }
- else if (inputOptions.colorTransform == ColorTransform_ScaledYCoCg)
- {
- // @@ TODO
- //ColorSpace::RGBtoYCoCg_R(mipmap.asMutableFixedImage());
- }
-
- quantizeMipmap(mipmap, compressionOptions);
- }
-
- compressMipmap(mipmap, inputOptions, compressionOptions, outputOptions);
-
- // Compute extents of next mipmap:
- w = max(1U, w / 2);
- h = max(1U, h / 2);
- d = max(1U, d / 2);
- }
-
- return true;
-}
-
-bool Compressor::Private::initMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions, uint w, uint h, uint d, uint f, uint m) const
-{
- // Find image from input.
- int inputIdx = findExactMipmap(inputOptions, w, h, d, f);
-
- if ((inputIdx == -1 || inputOptions.convertToNormalMap) && m != 0)
- {
- // Generate from last, when mipmap not found, or normal map conversion enabled.
- downsampleMipmap(mipmap, inputOptions);
- }
- else
- {
- if (inputIdx != -1)
- {
- // If input mipmap found, then get from input.
- mipmap.setFromInput(inputOptions, inputIdx);
- }
- else
- {
- // If not found, resize closest mipmap.
- inputIdx = findClosestMipmap(inputOptions, w, h, d, f);
-
- if (inputIdx == -1)
- {
- return false;
- }
-
- mipmap.setFromInput(inputOptions, inputIdx);
-
- scaleMipmap(mipmap, inputOptions, w, h, d);
- }
-
- processInputImage(mipmap, inputOptions);
- }
-
- return true;
-}
-
-int Compressor::Private::findExactMipmap(const InputOptions::Private & inputOptions, uint w, uint h, uint d, uint f) const
-{
- for (int m = 0; m < int(inputOptions.mipmapCount); m++)
- {
- int idx = f * inputOptions.mipmapCount + m;
- const InputOptions::Private::InputImage & inputImage = inputOptions.images[idx];
-
- if (inputImage.width == int(w) && inputImage.height == int(h) && inputImage.depth == int(d))
- {
- if (inputImage.hasValidData())
- {
- return idx;
- }
- return -1;
- }
- else if (inputImage.width < int(w) || inputImage.height < int(h) || inputImage.depth < int(d))
- {
- return -1;
- }
- }
-
- return -1;
-}
-
-int Compressor::Private::findClosestMipmap(const InputOptions::Private & inputOptions, uint w, uint h, uint d, uint f) const
-{
- int bestIdx = -1;
-
- for (int m = 0; m < int(inputOptions.mipmapCount); m++)
- {
- int idx = f * inputOptions.mipmapCount + m;
- const InputOptions::Private::InputImage & inputImage = inputOptions.images[idx];
-
- if (inputImage.hasValidData())
- {
- int difference = (inputImage.width - w) + (inputImage.height - h) + (inputImage.depth - d);
-
- if (difference < 0)
- {
- if (bestIdx == -1)
- {
- bestIdx = idx;
- }
-
- return bestIdx;
- }
-
- bestIdx = idx;
- }
- }
-
- return bestIdx;
-}
-
-// Create mipmap from the given image.
-void Compressor::Private::downsampleMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions) const
-{
- // Make sure that floating point linear representation is available.
- mipmap.toFloatImage(inputOptions);
-
- const FloatImage * floatImage = mipmap.asFloatImage();
- FloatImage::WrapMode wrapMode = (FloatImage::WrapMode)inputOptions.wrapMode;
-
- if (inputOptions.alphaMode == AlphaMode_Transparency)
- {
- if (inputOptions.mipmapFilter == MipmapFilter_Box)
- {
- BoxFilter filter;
- mipmap.setImage(floatImage->downSample(filter, wrapMode, 3));
- }
- else if (inputOptions.mipmapFilter == MipmapFilter_Triangle)
- {
- TriangleFilter filter;
- mipmap.setImage(floatImage->downSample(filter, wrapMode, 3));
- }
- else /*if (inputOptions.mipmapFilter == MipmapFilter_Kaiser)*/
- {
- nvDebugCheck(inputOptions.mipmapFilter == MipmapFilter_Kaiser);
- KaiserFilter filter(inputOptions.kaiserWidth);
- filter.setParameters(inputOptions.kaiserAlpha, inputOptions.kaiserStretch);
- mipmap.setImage(floatImage->downSample(filter, wrapMode, 3));
- }
- }
- else
- {
- if (inputOptions.mipmapFilter == MipmapFilter_Box)
- {
- // Use fast downsample.
- mipmap.setImage(floatImage->fastDownSample());
- }
- else if (inputOptions.mipmapFilter == MipmapFilter_Triangle)
- {
- TriangleFilter filter;
- mipmap.setImage(floatImage->downSample(filter, wrapMode));
- }
- else /*if (inputOptions.mipmapFilter == MipmapFilter_Kaiser)*/
- {
- nvDebugCheck(inputOptions.mipmapFilter == MipmapFilter_Kaiser);
- KaiserFilter filter(inputOptions.kaiserWidth);
- filter.setParameters(inputOptions.kaiserAlpha, inputOptions.kaiserStretch);
- mipmap.setImage(floatImage->downSample(filter, wrapMode));
- }
- }
-
- // Normalize mipmap.
- if ((inputOptions.isNormalMap || inputOptions.convertToNormalMap) && inputOptions.normalizeMipmaps)
- {
- normalizeNormalMap(mipmap.asMutableFloatImage());
- }
-}
-
-
-void Compressor::Private::scaleMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions, uint w, uint h, uint d) const
-{
- mipmap.toFloatImage(inputOptions);
-
- // @@ Add more filters.
- // @@ Select different filters for downscaling and reconstruction.
-
- // Resize image.
- BoxFilter boxFilter;
-
- if (inputOptions.alphaMode == AlphaMode_Transparency)
- {
- mipmap.setImage(mipmap.asFloatImage()->resize(boxFilter, w, h, (FloatImage::WrapMode)inputOptions.wrapMode, 3));
- }
- else
- {
- mipmap.setImage(mipmap.asFloatImage()->resize(boxFilter, w, h, (FloatImage::WrapMode)inputOptions.wrapMode));
- }
-}
-
-
-void Compressor::Private::premultiplyAlphaMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions) const
-{
- nvDebugCheck(mipmap.asFixedImage() != NULL);
-
- Image * image = mipmap.asMutableFixedImage();
-
- const uint w = image->width();
- const uint h = image->height();
-
- const uint count = w * h;
-
- for (uint i = 0; i < count; ++i)
- {
- Color32 c = image->pixel(i);
-
- c.r = (uint(c.r) * uint(c.a)) >> 8;
- c.g = (uint(c.g) * uint(c.a)) >> 8;
- c.b = (uint(c.b) * uint(c.a)) >> 8;
-
- image->pixel(i) = c;
- }
-}
-
-// Process an input image: Convert to normal map, normalize, or convert to linear space.
-void Compressor::Private::processInputImage(Mipmap & mipmap, const InputOptions::Private & inputOptions) const
-{
- if (inputOptions.convertToNormalMap)
- {
- mipmap.toFixedImage(inputOptions);
-
- Vector4 heightScale = inputOptions.heightFactors;
- mipmap.setImage(createNormalMap(mipmap.asFixedImage(), (FloatImage::WrapMode)inputOptions.wrapMode, heightScale, inputOptions.bumpFrequencyScale));
- }
- else if (inputOptions.isNormalMap)
- {
- if (inputOptions.normalizeMipmaps)
- {
- // If floating point image available, normalize in place.
- if (mipmap.asFloatImage() == NULL)
- {
- FloatImage * floatImage = new FloatImage(mipmap.asFixedImage());
- normalizeNormalMap(floatImage);
- mipmap.setImage(floatImage);
- }
- else
- {
- normalizeNormalMap(mipmap.asMutableFloatImage());
- mipmap.setImage(mipmap.asMutableFloatImage());
- }
- }
- }
- else
- {
- if (inputOptions.inputGamma != inputOptions.outputGamma ||
- inputOptions.colorTransform == ColorTransform_Linear ||
- inputOptions.colorTransform == ColorTransform_Swizzle)
- {
- mipmap.toFloatImage(inputOptions);
- }
-
- // Apply linear transforms in linear space.
- if (inputOptions.colorTransform == ColorTransform_Linear)
- {
- FloatImage * image = mipmap.asMutableFloatImage();
- nvDebugCheck(image != NULL);
-
- Vector4 offset(
- inputOptions.colorOffsets[0],
- inputOptions.colorOffsets[1],
- inputOptions.colorOffsets[2],
- inputOptions.colorOffsets[3]);
-
- image->transform(0, inputOptions.linearTransform, offset);
- }
- else if (inputOptions.colorTransform == ColorTransform_Swizzle)
- {
- FloatImage * image = mipmap.asMutableFloatImage();
- nvDebugCheck(image != NULL);
-
- image->swizzle(0, inputOptions.swizzleTransform[0], inputOptions.swizzleTransform[1], inputOptions.swizzleTransform[2], inputOptions.swizzleTransform[3]);
- }
- }
-}
-
-
-// Quantize the given mipmap according to the compression options.
-void Compressor::Private::quantizeMipmap(Mipmap & mipmap, const CompressionOptions::Private & compressionOptions) const
-{
- nvDebugCheck(mipmap.asFixedImage() != NULL);
-
- if (compressionOptions.binaryAlpha)
- {
- if (compressionOptions.enableAlphaDithering)
- {
- Quantize::FloydSteinberg_BinaryAlpha(mipmap.asMutableFixedImage(), compressionOptions.alphaThreshold);
- }
- else
- {
- Quantize::BinaryAlpha(mipmap.asMutableFixedImage(), compressionOptions.alphaThreshold);
- }
- }
-
- if (compressionOptions.enableColorDithering || compressionOptions.enableAlphaDithering)
- {
- uint rsize = 8;
- uint gsize = 8;
- uint bsize = 8;
- uint asize = 8;
-
- if (compressionOptions.enableColorDithering)
- {
- if (compressionOptions.format >= Format_DXT1 && compressionOptions.format <= Format_DXT5)
- {
- rsize = 5;
- gsize = 6;
- bsize = 5;
- }
- else if (compressionOptions.format == Format_RGB)
- {
- uint rshift, gshift, bshift;
- PixelFormat::maskShiftAndSize(compressionOptions.rmask, &rshift, &rsize);
- PixelFormat::maskShiftAndSize(compressionOptions.gmask, &gshift, &gsize);
- PixelFormat::maskShiftAndSize(compressionOptions.bmask, &bshift, &bsize);
- }
- }
-
- if (compressionOptions.enableAlphaDithering)
- {
- if (compressionOptions.format == Format_DXT3)
- {
- asize = 4;
- }
- else if (compressionOptions.format == Format_RGB)
- {
- uint ashift;
- PixelFormat::maskShiftAndSize(compressionOptions.amask, &ashift, &asize);
- }
- }
-
- if (compressionOptions.binaryAlpha)
- {
- asize = 8; // Already quantized.
- }
-
- Quantize::FloydSteinberg(mipmap.asMutableFixedImage(), rsize, gsize, bsize, asize);
- }
-}
-
-
-// Compress the given mipmap.
-bool Compressor::Private::compressMipmap(const Mipmap & mipmap, const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const
-{
- if (compressionOptions.format == Format_RGBA)
- {
- // Pixel format conversion.
- if (compressionOptions.pixelType == PixelType_Float)
- {
- compressRGB(mipmap.asFloatImage(), outputOptions, compressionOptions);
- }
- else
- {
- compressRGB(mipmap.asFixedImage(), outputOptions, compressionOptions);
- }
- }
- else
- {
- const Image * image = mipmap.asFixedImage();
- nvDebugCheck(image != NULL);
-
- // @@ Use FastCompressor::isSupported(compressionOptions.format) to chose compressor.
-
- FastCompressor fast;
- fast.setImage(image, inputOptions.alphaMode);
-
- SlowCompressor slow;
- slow.setImage(image, inputOptions.alphaMode);
-
- if (compressionOptions.format == Format_DXT1)
- {
-#if defined(HAVE_S3QUANT)
- if (compressionOptions.externalCompressor == "s3")
- {
- s3CompressDXT1(image, outputOptions);
- }
- else
-#endif
-
-#if defined(HAVE_ATITC)
- if (compressionOptions.externalCompressor == "ati")
- {
- atiCompressDXT1(image, outputOptions);
- }
- else
-#endif
-
-#if defined(HAVE_SQUISH)
- if (compressionOptions.externalCompressor == "squish")
- {
- squishCompressDXT1(image, outputOptions);
- }
- else
-#endif
-
- if (compressionOptions.quality == Quality_Fastest)
- {
- fast.compressDXT1(outputOptions);
- }
- else
- {
- if (cudaEnabled)
- {
- nvDebugCheck(cudaSupported);
- cuda->setImage(image, inputOptions.alphaMode);
- cuda->compressDXT1(compressionOptions, outputOptions);
- //cuda->compressDXT1_Tex(compressionOptions, outputOptions);
- }
- else
- {
- slow.compressDXT1(compressionOptions, outputOptions);
- }
- }
- }
- else if (compressionOptions.format == Format_DXT1a)
- {
- if (compressionOptions.quality == Quality_Fastest)
- {
- fast.compressDXT1a(outputOptions);
- }
- else
- {
- if (cudaEnabled)
- {
- nvDebugCheck(cudaSupported);
- /*cuda*/slow.compressDXT1a(compressionOptions, outputOptions);
- }
- else
- {
- slow.compressDXT1a(compressionOptions, outputOptions);
- }
- }
- }
- else if (compressionOptions.format == Format_DXT1n)
- {
- if (cudaEnabled)
- {
- nvDebugCheck(cudaSupported);
- cuda->setImage(image, inputOptions.alphaMode);
- cuda->compressDXT1n(compressionOptions, outputOptions);
- }
- else
- {
- if (outputOptions.errorHandler) outputOptions.errorHandler->error(Error_UnsupportedFeature);
- }
- }
- else if (compressionOptions.format == Format_DXT3)
- {
- if (compressionOptions.quality == Quality_Fastest)
- {
- fast.compressDXT3(outputOptions);
- }
- else
- {
- if (cudaEnabled)
- {
- nvDebugCheck(cudaSupported);
- cuda->setImage(image, inputOptions.alphaMode);
- cuda->compressDXT3(compressionOptions, outputOptions);
- }
- else
- {
- slow.compressDXT3(compressionOptions, outputOptions);
- }
- }
- }
- else if (compressionOptions.format == Format_DXT5)
- {
- if (compressionOptions.quality == Quality_Fastest)
- {
- fast.compressDXT5(outputOptions);
- }
- else
- {
- if (cudaEnabled)
- {
- nvDebugCheck(cudaSupported);
- cuda->setImage(image, inputOptions.alphaMode);
- cuda->compressDXT5(compressionOptions, outputOptions);
- }
- else
- {
- slow.compressDXT5(compressionOptions, outputOptions);
- }
- }
- }
- else if (compressionOptions.format == Format_DXT5n)
- {
- if (compressionOptions.quality == Quality_Fastest)
- {
- fast.compressDXT5n(outputOptions);
- }
- else
- {
- /*if (cudaEnabled)
- {
- nvDebugCheck(cudaSupported);
- cuda->setImage(image, inputOptions.alphaMode);
- cuda->compressDXT5n(compressionOptions, outputOptions);
- }
- else*/
- {
- slow.compressDXT5n(compressionOptions, outputOptions);
- }
- }
- }
- else if (compressionOptions.format == Format_BC4)
- {
- slow.compressBC4(compressionOptions, outputOptions);
- }
- else if (compressionOptions.format == Format_BC5)
- {
- slow.compressBC5(compressionOptions, outputOptions);
- }
- else if (compressionOptions.format == Format_CTX1)
- {
- if (cudaEnabled)
- {
- nvDebugCheck(cudaSupported);
- cuda->setImage(image, inputOptions.alphaMode);
- cuda->compressCTX1(compressionOptions, outputOptions);
- }
- else
- {
- if (outputOptions.errorHandler) outputOptions.errorHandler->error(Error_UnsupportedFeature);
- }
- }
- }
-
- return true;
-}
-
-
-int Compressor::Private::estimateSize(const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions) const
-{
- const Format format = compressionOptions.format;
-
- uint bitCount = compressionOptions.bitcount;
- if (format == Format_RGBA && bitCount == 0) bitCount = compressionOptions.rsize + compressionOptions.gsize + compressionOptions.bsize + compressionOptions.asize;
-
- inputOptions.computeTargetExtents();
-
- uint mipmapCount = inputOptions.realMipmapCount();
-
- int size = 0;
-
- for (uint f = 0; f < inputOptions.faceCount; f++)
- {
- uint w = inputOptions.targetWidth;
- uint h = inputOptions.targetHeight;
- uint d = inputOptions.targetDepth;
-
- for (uint m = 0; m < mipmapCount; m++)
- {
- size += computeImageSize(w, h, d, bitCount, format);
-
- // Compute extents of next mipmap:
- w = max(1U, w / 2);
- h = max(1U, h / 2);
- d = max(1U, d / 2);
- }
- }
-
- return size;
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/Compressor.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/Compressor.h
deleted file mode 100644
index 26f19166..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/Compressor.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright NVIDIA Corporation 2008 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_COMPRESSOR_H
-#define NV_TT_COMPRESSOR_H
-
-#include <nvcore/Ptr.h>
-
-#include <nvtt/cuda/CudaCompressDXT.h>
-
-#include "nvtt.h"
-
-namespace nv
-{
- class Image;
-}
-
-namespace nvtt
-{
- struct Mipmap;
-
- struct Compressor::Private
- {
- Private() {}
-
- bool compress(const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const;
- int estimateSize(const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions) const;
-
- private:
-
- bool outputHeader(const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const;
- bool compressMipmaps(uint f, const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const;
-
- bool initMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions, uint w, uint h, uint d, uint f, uint m) const;
-
- int findExactMipmap(const InputOptions::Private & inputOptions, uint w, uint h, uint d, uint f) const;
- int findClosestMipmap(const InputOptions::Private & inputOptions, uint w, uint h, uint d, uint f) const;
-
- void downsampleMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions) const;
- void scaleMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions, uint w, uint h, uint d) const;
- void premultiplyAlphaMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions) const;
- void processInputImage(Mipmap & mipmap, const InputOptions::Private & inputOptions) const;
- void quantizeMipmap(Mipmap & mipmap, const CompressionOptions::Private & compressionOptions) const;
- bool compressMipmap(const Mipmap & mipmap, const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const;
-
-
- public:
-
- bool cudaSupported;
- bool cudaEnabled;
-
- nv::AutoPtr<nv::CudaCompressor> cuda;
-
- };
-
-} // nvtt namespace
-
-
-#endif // NV_TT_COMPRESSOR_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/InputOptions.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/InputOptions.cpp
deleted file mode 100644
index e8f94ea7..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/InputOptions.cpp
+++ /dev/null
@@ -1,555 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <string.h> // memcpy
-
-#include <nvcore/Containers.h> // nextPowerOfTwo
-#include <nvcore/Memory.h>
-
-#include <nvmath/Color.h>
-
-#include "nvtt.h"
-#include "InputOptions.h"
-
-using namespace nv;
-using namespace nvtt;
-
-namespace
-{
-
- static uint countMipmaps(int w, int h, int d)
- {
- uint mipmap = 0;
-
- while (w != 1 || h != 1 || d != 1) {
- w = max(1, w / 2);
- h = max(1, h / 2);
- d = max(1, d / 2);
- mipmap++;
- }
-
- return mipmap + 1;
- }
-
- // 1 -> 1, 2 -> 2, 3 -> 2, 4 -> 4, 5 -> 4, ...
- static uint previousPowerOfTwo(const uint v)
- {
- return nextPowerOfTwo(v + 1) / 2;
- }
-
- static uint nearestPowerOfTwo(const uint v)
- {
- const uint np2 = nextPowerOfTwo(v);
- const uint pp2 = previousPowerOfTwo(v);
-
- if (np2 - v <= v - pp2)
- {
- return np2;
- }
- else
- {
- return pp2;
- }
- }
-
-} // namespace
-
-
-/// Constructor.
-InputOptions::InputOptions() : m(*new InputOptions::Private())
-{
- reset();
-}
-
-// Delete images.
-InputOptions::~InputOptions()
-{
- resetTextureLayout();
-
- delete &m;
-}
-
-
-// Reset input options.
-void InputOptions::reset()
-{
- m.wrapMode = WrapMode_Mirror;
- m.textureType = TextureType_2D;
- m.inputFormat = InputFormat_BGRA_8UB;
-
- m.alphaMode = AlphaMode_Transparency;
-
- m.inputGamma = 2.2f;
- m.outputGamma = 2.2f;
-
- m.colorTransform = ColorTransform_None;
- m.linearTransform = Matrix(identity);
- for (int i = 0; i < 4; i++) m.colorOffsets[i] = 0;
- for (int i = 0; i < 4; i++) m.swizzleTransform[i] = i;
-
- m.generateMipmaps = true;
- m.maxLevel = -1;
- m.mipmapFilter = MipmapFilter_Box;
-
- m.kaiserWidth = 3;
- m.kaiserAlpha = 4.0f;
- m.kaiserStretch = 1.0f;
-
- m.isNormalMap = false;
- m.normalizeMipmaps = true;
- m.convertToNormalMap = false;
- m.heightFactors.set(0.0f, 0.0f, 0.0f, 1.0f);
- m.bumpFrequencyScale = Vector4(1.0f, 0.5f, 0.25f, 0.125f) / (1.0f + 0.5f + 0.25f + 0.125f);
-
- m.maxExtent = 0;
- m.roundMode = RoundMode_None;
-
- m.premultiplyAlpha = false;
-}
-
-
-// Setup the input image.
-void InputOptions::setTextureLayout(TextureType type, int width, int height, int depth /*= 1*/)
-{
- // Validate arguments.
- nvCheck(width >= 0);
- nvCheck(height >= 0);
- nvCheck(depth >= 0);
-
- // Correct arguments.
- if (width == 0) width = 1;
- if (height == 0) height = 1;
- if (depth == 0) depth = 1;
-
- // Delete previous images.
- resetTextureLayout();
-
- m.textureType = type;
-
- // Allocate images.
- m.mipmapCount = countMipmaps(width, height, depth);
- m.faceCount = (type == TextureType_Cube) ? 6 : 1;
- m.imageCount = m.mipmapCount * m.faceCount;
-
- m.images = new Private::InputImage[m.imageCount];
-
- for(uint f = 0; f < m.faceCount; f++)
- {
- uint w = width;
- uint h = height;
- uint d = depth;
-
- for (uint mipLevel = 0; mipLevel < m.mipmapCount; mipLevel++)
- {
- Private::InputImage & img = m.images[f * m.mipmapCount + mipLevel];
- img.width = w;
- img.height = h;
- img.depth = d;
- img.mipLevel = mipLevel;
- img.face = f;
-
- img.uint8data = NULL;
- img.floatdata = NULL;
-
- w = max(1U, w / 2);
- h = max(1U, h / 2);
- d = max(1U, d / 2);
- }
- }
-}
-
-
-void InputOptions::resetTextureLayout()
-{
- if (m.images != NULL)
- {
- // Delete image array.
- delete [] m.images;
- m.images = NULL;
-
- m.faceCount = 0;
- m.mipmapCount = 0;
- m.imageCount = 0;
- }
-}
-
-
-// Copies the data to our internal structures.
-bool InputOptions::setMipmapData(const void * data, int width, int height, int depth /*= 1*/, int face /*= 0*/, int mipLevel /*= 0*/)
-{
- nvCheck(depth == 1);
-
- const int idx = face * m.mipmapCount + mipLevel;
-
- if (m.images[idx].width != width || m.images[idx].height != height || m.images[idx].depth != depth || m.images[idx].mipLevel != mipLevel || m.images[idx].face != face)
- {
- // Invalid dimension or index.
- return false;
- }
-
- switch(m.inputFormat)
- {
- case InputFormat_BGRA_8UB:
- if (Image * image = new nv::Image())
- {
- image->allocate(width, height);
- memcpy(image->pixels(), data, width * height * 4);
- m.images[idx].uint8data = image;
- }
- else
- {
- // @@ Out of memory error.
- return false;
- }
- break;
- case InputFormat_RGBA_32F:
- if (FloatImage * image = new nv::FloatImage())
- {
- const float * floatData = (const float *)data;
- image->allocate(4, width, height);
-
- for (int c = 0; c < 4; c++)
- {
- float * channel = image->channel(c);
- for (int i = 0; i < width * height; i++)
- {
- channel[i] = floatData[i*4 + c];
- }
- }
-
- m.images[idx].floatdata = image;
- }
- else
- {
- // @@ Out of memory error.
- return false;
- }
- break;
- default:
- return false;
- }
-
- return true;
-}
-
-
-// Copies data
-bool InputOptions::setMipmapChannelData(const void * data, int channel, int width, int height, int depth /*= 1*/, int face /*= 0*/, int mipLevel /*= 0*/)
-{
- nvCheck(depth == 1);
- nvCheck(channel >= 0 && channel < 4);
-
- const int idx = face * m.mipmapCount + mipLevel;
-
- if (m.images[idx].width != width || m.images[idx].height != height || m.images[idx].depth != depth || m.images[idx].mipLevel != mipLevel || m.images[idx].face != face)
- {
- // Invalid dimension or index.
- return false;
- }
-
- // Allocate image if not allocated already.
- if (m.inputFormat == InputFormat_BGRA_8UB)
- {
- m.images[idx].floatdata = NULL;
- if (m.images[idx].uint8data == NULL)
- {
- m.images[idx].uint8data = new Image();
- m.images[idx].uint8data->allocate(width, height);
- m.images[idx].uint8data->fill(Color32(0,0,0,0));
- }
- }
- else if (m.inputFormat == InputFormat_RGBA_32F)
- {
- m.images[idx].uint8data = NULL;
- if (m.images[idx].floatdata == NULL)
- {
- m.images[idx].floatdata = new FloatImage();
- m.images[idx].floatdata->allocate(4, width, height);
- m.images[idx].floatdata->clear();
- }
-
-
- }
- else
- {
- m.images[idx].floatdata = NULL;
- m.images[idx].uint8data = NULL;
- return false;
- }
-
- // Copy channel data to image.
- if (m.inputFormat == InputFormat_BGRA_8UB)
- {
- // @@ TODO
- }
- else if (m.inputFormat == InputFormat_RGBA_32F)
- {
- const float * floatData = (const float *)data;
- float * channelPtr = m.images[idx].floatdata->channel(channel);
-
- for (int i = 0; i < width * height; i++)
- {
- channelPtr[i] = floatData[i];
- }
- }
-
- return true;
-}
-
-
-/// Describe the format of the input.
-void InputOptions::setFormat(InputFormat format)
-{
- m.inputFormat = format;
-}
-
-
-/// Set the way the input alpha channel is interpreted.
-void InputOptions::setAlphaMode(AlphaMode alphaMode)
-{
- m.alphaMode = alphaMode;
-}
-
-
-/// Set gamma settings.
-void InputOptions::setGamma(float inputGamma, float outputGamma)
-{
- m.inputGamma = inputGamma;
- m.outputGamma = outputGamma;
-}
-
-
-/// Set texture wrappign mode.
-void InputOptions::setWrapMode(WrapMode mode)
-{
- m.wrapMode = mode;
-}
-
-
-/// Set mipmap filter.
-void InputOptions::setMipmapFilter(MipmapFilter filter)
-{
- m.mipmapFilter = filter;
-}
-
-/// Set mipmap generation.
-void InputOptions::setMipmapGeneration(bool enabled, int maxLevel/*= -1*/)
-{
- m.generateMipmaps = enabled;
- m.maxLevel = maxLevel;
-}
-
-/// Set Kaiser filter parameters.
-void InputOptions::setKaiserParameters(float width, float alpha, float stretch)
-{
- m.kaiserWidth = width;
- m.kaiserAlpha = alpha;
- m.kaiserStretch = stretch;
-}
-
-/// Indicate whether input is a normal map or not.
-void InputOptions::setNormalMap(bool b)
-{
- m.isNormalMap = b;
-}
-
-/// Enable normal map conversion.
-void InputOptions::setConvertToNormalMap(bool convert)
-{
- m.convertToNormalMap = convert;
-}
-
-/// Set height evaluation factors.
-void InputOptions::setHeightEvaluation(float redScale, float greenScale, float blueScale, float alphaScale)
-{
- // Do not normalize height factors.
-// float total = redScale + greenScale + blueScale + alphaScale;
- m.heightFactors = Vector4(redScale, greenScale, blueScale, alphaScale);
-}
-
-/// Set normal map conversion filter.
-void InputOptions::setNormalFilter(float small, float medium, float big, float large)
-{
- float total = small + medium + big + large;
- m.bumpFrequencyScale = Vector4(small, medium, big, large) / total;
-}
-
-/// Enable mipmap normalization.
-void InputOptions::setNormalizeMipmaps(bool normalize)
-{
- m.normalizeMipmaps = normalize;
-}
-
-/// Set color transform.
-void InputOptions::setColorTransform(ColorTransform t)
-{
- m.colorTransform = t;
-}
-
-// Set linear transform for the given channel.
-void InputOptions::setLinearTransform(int channel, float w0, float w1, float w2, float w3)
-{
- nvCheck(channel >= 0 && channel < 4);
-
- m.linearTransform(channel, 0) = w0;
- m.linearTransform(channel, 1) = w1;
- m.linearTransform(channel, 2) = w2;
- m.linearTransform(channel, 3) = w3;
-}
-
-void InputOptions::setLinearTransform(int channel, float w0, float w1, float w2, float w3, float offset)
-{
- nvCheck(channel >= 0 && channel < 4);
-
- setLinearTransform(channel, w0, w1, w2, w3);
-
- m.colorOffsets[channel] = offset;
-}
-
-void InputOptions::setSwizzleTransform(int x, int y, int z, int w)
-{
- nvCheck(x >= 0 && x <= 6);
- nvCheck(y >= 0 && y <= 6);
- nvCheck(z >= 0 && z <= 6);
- nvCheck(w >= 0 && w <= 6);
-
- m.swizzleTransform[0] = x;
- m.swizzleTransform[1] = y;
- m.swizzleTransform[2] = z;
- m.swizzleTransform[3] = w;
-}
-
-void InputOptions::setMaxExtents(int e)
-{
- nvDebugCheck(e > 0);
- m.maxExtent = e;
-}
-
-void InputOptions::setRoundMode(RoundMode mode)
-{
- m.roundMode = mode;
-}
-
-void InputOptions::setPremultiplyAlpha(bool b)
-{
- m.premultiplyAlpha = b;
-}
-
-void InputOptions::Private::computeTargetExtents() const
-{
- nvCheck(images != NULL);
-
- uint maxExtent = this->maxExtent;
- if (roundMode != RoundMode_None)
- {
- // rounded max extent should never be higher than original max extent.
- maxExtent = previousPowerOfTwo(maxExtent);
- }
-
- uint w = images->width;
- uint h = images->height;
- uint d = images->depth;
-
- nvDebugCheck(w > 0);
- nvDebugCheck(h > 0);
- nvDebugCheck(d > 0);
-
- // Scale extents without changing aspect ratio.
- uint maxwhd = max(max(w, h), d);
- if (maxExtent != 0 && maxwhd > maxExtent)
- {
- w = max((w * maxExtent) / maxwhd, 1U);
- h = max((h * maxExtent) / maxwhd, 1U);
- d = max((d * maxExtent) / maxwhd, 1U);
- }
-
- // Round to power of two.
- if (roundMode == RoundMode_ToNextPowerOfTwo)
- {
- w = nextPowerOfTwo(w);
- h = nextPowerOfTwo(h);
- d = nextPowerOfTwo(d);
- }
- else if (roundMode == RoundMode_ToNearestPowerOfTwo)
- {
- w = nearestPowerOfTwo(w);
- h = nearestPowerOfTwo(h);
- d = nearestPowerOfTwo(d);
- }
- else if (roundMode == RoundMode_ToPreviousPowerOfTwo)
- {
- w = previousPowerOfTwo(w);
- h = previousPowerOfTwo(h);
- d = previousPowerOfTwo(d);
- }
-
- this->targetWidth = w;
- this->targetHeight = h;
- this->targetDepth = d;
-
- this->targetMipmapCount = countMipmaps(w, h, d);
-}
-
-
-// Return real number of mipmaps, including first level.
-// computeTargetExtents should have been called before.
-int InputOptions::Private::realMipmapCount() const
-{
- int mipmapCount = targetMipmapCount;
-
- if (!generateMipmaps) mipmapCount = 1;
- else if (maxLevel != -1 && maxLevel < mipmapCount - 1) mipmapCount = maxLevel + 1;
-
- return mipmapCount;
-}
-
-
-const Image * InputOptions::Private::image(uint face, uint mipmap) const
-{
- nvDebugCheck(face < faceCount);
- nvDebugCheck(mipmap < mipmapCount);
-
- const InputImage & image = this->images[face * mipmapCount + mipmap];
- nvDebugCheck(image.face == face);
- nvDebugCheck(image.mipLevel == mipmap);
-
- return image.uint8data.ptr();
-}
-
-const Image * InputOptions::Private::image(uint idx) const
-{
- nvDebugCheck(idx < faceCount * mipmapCount);
-
- const InputImage & image = this->images[idx];
-
- return image.uint8data.ptr();
-}
-
-const FloatImage * InputOptions::Private::floatImage(uint idx) const
-{
- nvDebugCheck(idx < faceCount * mipmapCount);
-
- const InputImage & image = this->images[idx];
-
- return image.floatdata.ptr();
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/InputOptions.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/InputOptions.h
deleted file mode 100644
index 444a7ca0..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/InputOptions.h
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_INPUTOPTIONS_H
-#define NV_TT_INPUTOPTIONS_H
-
-#include <nvcore/Ptr.h>
-#include <nvmath/Vector.h>
-#include <nvmath/Matrix.h>
-#include <nvimage/Image.h>
-#include <nvimage/FloatImage.h>
-#include "nvtt.h"
-
-namespace nvtt
-{
-
- struct InputOptions::Private
- {
- Private() : images(NULL) {}
-
- WrapMode wrapMode;
- TextureType textureType;
- InputFormat inputFormat;
- AlphaMode alphaMode;
-
- uint faceCount;
- uint mipmapCount;
- uint imageCount;
-
- struct InputImage;
- InputImage * images;
-
- // Gamma conversion.
- float inputGamma;
- float outputGamma;
-
- // Color transform.
- ColorTransform colorTransform;
- nv::Matrix linearTransform;
- float colorOffsets[4];
- uint swizzleTransform[4];
-
- // Mipmap generation options.
- bool generateMipmaps;
- int maxLevel;
- MipmapFilter mipmapFilter;
-
- // Kaiser filter parameters.
- float kaiserWidth;
- float kaiserAlpha;
- float kaiserStretch;
-
- // Normal map options.
- bool isNormalMap;
- bool normalizeMipmaps;
- bool convertToNormalMap;
- nv::Vector4 heightFactors;
- nv::Vector4 bumpFrequencyScale;
-
- // Adjust extents.
- uint maxExtent;
- RoundMode roundMode;
-
- bool premultiplyAlpha;
-
- // @@ These are computed in nvtt::compress, so they should be mutable or stored elsewhere...
- mutable uint targetWidth;
- mutable uint targetHeight;
- mutable uint targetDepth;
- mutable uint targetMipmapCount;
-
- void computeTargetExtents() const;
-
- int realMipmapCount() const;
-
- const nv::Image * image(uint face, uint mipmap) const;
- const nv::Image * image(uint idx) const;
-
- const nv::FloatImage * floatImage(uint idx) const;
-
- };
-
- // Internal image structure.
- struct InputOptions::Private::InputImage
- {
- InputImage() {}
-
- bool hasValidData() const { return uint8data != NULL || floatdata != NULL; }
-
- int mipLevel;
- int face;
-
- int width;
- int height;
- int depth;
-
- nv::AutoPtr<nv::Image> uint8data;
- nv::AutoPtr<nv::FloatImage> floatdata;
- };
-
-} // nvtt namespace
-
-#endif // NV_TT_INPUTOPTIONS_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/OptimalCompressDXT.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/OptimalCompressDXT.cpp
deleted file mode 100644
index 24a49ca8..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/OptimalCompressDXT.cpp
+++ /dev/null
@@ -1,445 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include "OptimalCompressDXT.h"
-#include "SingleColorLookup.h"
-
-#include <nvimage/ColorBlock.h>
-#include <nvimage/BlockDXT.h>
-
-#include <nvmath/Color.h>
-
-#include <nvcore/Containers.h> // swap
-
-#include <limits.h>
-
-using namespace nv;
-using namespace OptimalCompress;
-
-
-
-namespace
-{
- static int greenDistance(int g0, int g1)
- {
- //return abs(g0 - g1);
- int d = g0 - g1;
- return d * d;
- }
-
- static int alphaDistance(int a0, int a1)
- {
- //return abs(a0 - a1);
- int d = a0 - a1;
- return d * d;
- }
-
- static uint nearestGreen4(uint green, uint maxGreen, uint minGreen)
- {
- uint bias = maxGreen + (maxGreen - minGreen) / 6;
-
- uint index = 0;
- if (maxGreen - minGreen != 0) index = clamp(3 * (bias - green) / (maxGreen - minGreen), 0U, 3U);
-
- return (index * minGreen + (3 - index) * maxGreen) / 3;
- }
-
- static int computeGreenError(const ColorBlock & rgba, const BlockDXT1 * block, int bestError = INT_MAX)
- {
- nvDebugCheck(block != NULL);
-
- // uint g0 = (block->col0.g << 2) | (block->col0.g >> 4);
- // uint g1 = (block->col1.g << 2) | (block->col1.g >> 4);
-
- int palette[4];
- palette[0] = (block->col0.g << 2) | (block->col0.g >> 4);
- palette[1] = (block->col1.g << 2) | (block->col1.g >> 4);
- palette[2] = (2 * palette[0] + palette[1]) / 3;
- palette[3] = (2 * palette[1] + palette[0]) / 3;
-
- int totalError = 0;
- for (int i = 0; i < 16; i++)
- {
- const int green = rgba.color(i).g;
-
- int error = greenDistance(green, palette[0]);
- error = min(error, greenDistance(green, palette[1]));
- error = min(error, greenDistance(green, palette[2]));
- error = min(error, greenDistance(green, palette[3]));
-
- totalError += error;
-
- // totalError += nearestGreen4(green, g0, g1);
-
- if (totalError > bestError)
- {
- // early out
- return totalError;
- }
- }
-
- return totalError;
- }
-
- static uint computeGreenIndices(const ColorBlock & rgba, const Color32 palette[4])
- {
- const int color0 = palette[0].g;
- const int color1 = palette[1].g;
- const int color2 = palette[2].g;
- const int color3 = palette[3].g;
-
- uint indices = 0;
- for (int i = 0; i < 16; i++)
- {
- const int color = rgba.color(i).g;
-
- uint d0 = greenDistance(color0, color);
- uint d1 = greenDistance(color1, color);
- uint d2 = greenDistance(color2, color);
- uint d3 = greenDistance(color3, color);
-
- uint b0 = d0 > d3;
- uint b1 = d1 > d2;
- uint b2 = d0 > d2;
- uint b3 = d1 > d3;
- uint b4 = d2 > d3;
-
- uint x0 = b1 & b2;
- uint x1 = b0 & b3;
- uint x2 = b0 & b4;
-
- indices |= (x2 | ((x0 | x1) << 1)) << (2 * i);
- }
-
- return indices;
- }
-
- // Choose quantized color that produces less error. Used by DXT3 compressor.
- inline static uint quantize4(uint8 a)
- {
- int q0 = max(int(a >> 4) - 1, 0);
- int q1 = (a >> 4);
- int q2 = min(int(a >> 4) + 1, 0xF);
-
- q0 = (q0 << 4) | q0;
- q1 = (q1 << 4) | q1;
- q2 = (q2 << 4) | q2;
-
- int d0 = alphaDistance(q0, a);
- int d1 = alphaDistance(q1, a);
- int d2 = alphaDistance(q2, a);
-
- if (d0 < d1 && d0 < d2) return q0 >> 4;
- if (d1 < d2) return q1 >> 4;
- return q2 >> 4;
- }
-
- static uint nearestAlpha8(uint alpha, uint maxAlpha, uint minAlpha)
- {
- float bias = maxAlpha + float(maxAlpha - minAlpha) / (2.0f * 7.0f);
- float scale = 7.0f / float(maxAlpha - minAlpha);
-
- uint index = (uint)clamp((bias - float(alpha)) * scale, 0.0f, 7.0f);
-
- return (index * minAlpha + (7 - index) * maxAlpha) / 7;
- }
-
- static uint computeAlphaError8(const ColorBlock & rgba, const AlphaBlockDXT5 * block, int bestError = INT_MAX)
- {
- int totalError = 0;
-
- for (uint i = 0; i < 16; i++)
- {
- uint8 alpha = rgba.color(i).a;
-
- totalError += alphaDistance(alpha, nearestAlpha8(alpha, block->alpha0, block->alpha1));
-
- if (totalError > bestError)
- {
- // early out
- return totalError;
- }
- }
-
- return totalError;
- }
-
- static uint computeAlphaError(const ColorBlock & rgba, const AlphaBlockDXT5 * block, int bestError = INT_MAX)
- {
- uint8 alphas[8];
- block->evaluatePalette(alphas);
-
- int totalError = 0;
-
- for (uint i = 0; i < 16; i++)
- {
- uint8 alpha = rgba.color(i).a;
-
- int minDist = INT_MAX;
- for (uint p = 0; p < 8; p++)
- {
- int dist = alphaDistance(alpha, alphas[p]);
- minDist = min(dist, minDist);
- }
-
- totalError += minDist;
-
- if (totalError > bestError)
- {
- // early out
- return totalError;
- }
- }
-
- return totalError;
- }
-
- static void computeAlphaIndices(const ColorBlock & rgba, AlphaBlockDXT5 * block)
- {
- uint8 alphas[8];
- block->evaluatePalette(alphas);
-
- for (uint i = 0; i < 16; i++)
- {
- uint8 alpha = rgba.color(i).a;
-
- int minDist = INT_MAX;
- int bestIndex = 8;
- for (uint p = 0; p < 8; p++)
- {
- int dist = alphaDistance(alpha, alphas[p]);
-
- if (dist < minDist)
- {
- minDist = dist;
- bestIndex = p;
- }
- }
- nvDebugCheck(bestIndex < 8);
-
- block->setIndex(i, bestIndex);
- }
- }
-
-} // namespace
-
-
-
-
-
-// Single color compressor, based on:
-// https://mollyrocket.com/forums/viewtopic.php?t=392
-void OptimalCompress::compressDXT1(Color32 c, BlockDXT1 * dxtBlock)
-{
- dxtBlock->col0.r = OMatch5[c.r][0];
- dxtBlock->col0.g = OMatch6[c.g][0];
- dxtBlock->col0.b = OMatch5[c.b][0];
- dxtBlock->col1.r = OMatch5[c.r][1];
- dxtBlock->col1.g = OMatch6[c.g][1];
- dxtBlock->col1.b = OMatch5[c.b][1];
- dxtBlock->indices = 0xaaaaaaaa;
-
- if (dxtBlock->col0.u < dxtBlock->col1.u)
- {
- swap(dxtBlock->col0.u, dxtBlock->col1.u);
- dxtBlock->indices ^= 0x55555555;
- }
-}
-
-void OptimalCompress::compressDXT1a(Color32 rgba, BlockDXT1 * dxtBlock)
-{
- if (rgba.a < 128)
- {
- dxtBlock->col0.u = 0;
- dxtBlock->col1.u = 0;
- dxtBlock->indices = 0xFFFFFFFF;
- }
- else
- {
- compressDXT1(rgba, dxtBlock);
- }
-}
-
-void OptimalCompress::compressDXT1G(uint8 g, BlockDXT1 * dxtBlock)
-{
- dxtBlock->col0.r = 31;
- dxtBlock->col0.g = OMatch6[g][0];
- dxtBlock->col0.b = 0;
- dxtBlock->col1.r = 31;
- dxtBlock->col1.g = OMatch6[g][1];
- dxtBlock->col1.b = 0;
- dxtBlock->indices = 0xaaaaaaaa;
-
- if (dxtBlock->col0.u < dxtBlock->col1.u)
- {
- swap(dxtBlock->col0.u, dxtBlock->col1.u);
- dxtBlock->indices ^= 0x55555555;
- }
-}
-
-
-// Brute force green channel compressor
-void OptimalCompress::compressDXT1G(const ColorBlock & rgba, BlockDXT1 * block)
-{
- nvDebugCheck(block != NULL);
-
- uint8 ming = 63;
- uint8 maxg = 0;
-
- bool isSingleColor = true;
- uint8 singleColor = rgba.color(0).g;
-
- // Get min/max green.
- for (uint i = 0; i < 16; i++)
- {
- uint8 green = (rgba.color(i).g + 1) >> 2;
- ming = min(ming, green);
- maxg = max(maxg, green);
-
- if (rgba.color(i).g != singleColor) isSingleColor = false;
- }
-
- if (isSingleColor)
- {
- compressDXT1G(singleColor, block);
- return;
- }
-
- block->col0.r = 31;
- block->col1.r = 31;
- block->col0.g = maxg;
- block->col1.g = ming;
- block->col0.b = 0;
- block->col1.b = 0;
-
- int bestError = computeGreenError(rgba, block);
- int bestg0 = maxg;
- int bestg1 = ming;
-
- // Expand search space a bit.
- const int greenExpand = 4;
- ming = (ming <= greenExpand) ? 0 : ming - greenExpand;
- maxg = (maxg >= 63-greenExpand) ? 63 : maxg + greenExpand;
-
- for (int g0 = ming+1; g0 <= maxg; g0++)
- {
- for (int g1 = ming; g1 < g0; g1++)
- {
- block->col0.g = g0;
- block->col1.g = g1;
- int error = computeGreenError(rgba, block, bestError);
-
- if (error < bestError)
- {
- bestError = error;
- bestg0 = g0;
- bestg1 = g1;
- }
- }
- }
-
- block->col0.g = bestg0;
- block->col1.g = bestg1;
-
- nvDebugCheck(bestg0 == bestg1 || block->isFourColorMode());
-
-
- Color32 palette[4];
- block->evaluatePalette(palette);
- block->indices = computeGreenIndices(rgba, palette);
-}
-
-void OptimalCompress::compressDXT3A(const ColorBlock & rgba, AlphaBlockDXT3 * dxtBlock)
-{
- dxtBlock->alpha0 = quantize4(rgba.color(0).a);
- dxtBlock->alpha1 = quantize4(rgba.color(1).a);
- dxtBlock->alpha2 = quantize4(rgba.color(2).a);
- dxtBlock->alpha3 = quantize4(rgba.color(3).a);
- dxtBlock->alpha4 = quantize4(rgba.color(4).a);
- dxtBlock->alpha5 = quantize4(rgba.color(5).a);
- dxtBlock->alpha6 = quantize4(rgba.color(6).a);
- dxtBlock->alpha7 = quantize4(rgba.color(7).a);
- dxtBlock->alpha8 = quantize4(rgba.color(8).a);
- dxtBlock->alpha9 = quantize4(rgba.color(9).a);
- dxtBlock->alphaA = quantize4(rgba.color(10).a);
- dxtBlock->alphaB = quantize4(rgba.color(11).a);
- dxtBlock->alphaC = quantize4(rgba.color(12).a);
- dxtBlock->alphaD = quantize4(rgba.color(13).a);
- dxtBlock->alphaE = quantize4(rgba.color(14).a);
- dxtBlock->alphaF = quantize4(rgba.color(15).a);
-}
-
-
-void OptimalCompress::compressDXT5A(const ColorBlock & rgba, AlphaBlockDXT5 * dxtBlock)
-{
- uint8 mina = 255;
- uint8 maxa = 0;
-
- // Get min/max alpha.
- for (uint i = 0; i < 16; i++)
- {
- uint8 alpha = rgba.color(i).a;
- mina = min(mina, alpha);
- maxa = max(maxa, alpha);
- }
-
- dxtBlock->alpha0 = maxa;
- dxtBlock->alpha1 = mina;
-
- if (maxa - mina > 8)
- {
- int besterror = computeAlphaError(rgba, dxtBlock);
- int besta0 = maxa;
- int besta1 = mina;
-
- // Expand search space a bit.
- const int alphaExpand = 8;
- mina = (mina <= alphaExpand) ? 0 : mina - alphaExpand;
- maxa = (maxa >= 255-alphaExpand) ? 255 : maxa + alphaExpand;
-
- for (int a0 = mina+9; a0 < maxa; a0++)
- {
- for (int a1 = mina; a1 < a0-8; a1++)
- {
- nvDebugCheck(a0 - a1 > 8);
-
- dxtBlock->alpha0 = a0;
- dxtBlock->alpha1 = a1;
- int error = computeAlphaError(rgba, dxtBlock, besterror);
-
- if (error < besterror)
- {
- besterror = error;
- besta0 = a0;
- besta1 = a1;
- }
- }
- }
-
- dxtBlock->alpha0 = besta0;
- dxtBlock->alpha1 = besta1;
- }
-
- computeAlphaIndices(rgba, dxtBlock);
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/OptimalCompressDXT.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/OptimalCompressDXT.h
deleted file mode 100644
index 3d7aad27..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/OptimalCompressDXT.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright NVIDIA Corporation 2008 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_OPTIMALCOMPRESSDXT_H
-#define NV_TT_OPTIMALCOMPRESSDXT_H
-
-#include <nvimage/nvimage.h>
-
-#include <nvmath/Color.h>
-
-namespace nv
-{
- struct ColorBlock;
- struct BlockDXT1;
- struct BlockDXT3;
- struct BlockDXT5;
- struct AlphaBlockDXT3;
- struct AlphaBlockDXT5;
-
- namespace OptimalCompress
- {
- void compressDXT1(Color32 rgba, BlockDXT1 * dxtBlock);
- void compressDXT1a(Color32 rgba, BlockDXT1 * dxtBlock);
- void compressDXT1G(uint8 g, BlockDXT1 * dxtBlock);
-
- void compressDXT1G(const ColorBlock & rgba, BlockDXT1 * block);
- void compressDXT3A(const ColorBlock & rgba, AlphaBlockDXT3 * dxtBlock);
- void compressDXT5A(const ColorBlock & rgba, AlphaBlockDXT5 * dxtBlock);
- }
-} // nv namespace
-
-#endif // NV_TT_OPTIMALCOMPRESSDXT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/OutputOptions.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/OutputOptions.cpp
deleted file mode 100644
index f8b8bc38..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/OutputOptions.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include "OutputOptions.h"
-
-using namespace nvtt;
-
-
-OutputOptions::OutputOptions() : m(*new OutputOptions::Private())
-{
- reset();
-}
-
-OutputOptions::~OutputOptions()
-{
- delete &m;
-}
-
-/// Set default output options.
-void OutputOptions::reset()
-{
- m.fileName.reset();
- m.outputHandler = NULL;
- m.errorHandler = NULL;
- m.outputHeader = true;
- m.container = Container_DDS;
-}
-
-
-/// Set output file name.
-void OutputOptions::setFileName(const char * fileName)
-{
- m.fileName = fileName;
- m.outputHandler = NULL;
-}
-
-/// Set output handler.
-void OutputOptions::setOutputHandler(OutputHandler * outputHandler)
-{
- m.fileName.reset();
- m.outputHandler = outputHandler;
-}
-
-/// Set error handler.
-void OutputOptions::setErrorHandler(ErrorHandler * errorHandler)
-{
- m.errorHandler = errorHandler;
-}
-
-/// Set output header.
-void OutputOptions::setOutputHeader(bool outputHeader)
-{
- m.outputHeader = outputHeader;
-}
-
-/// Set container.
-void OutputOptions::setContainer(Container container)
-{
- m.container = container;
-}
-
-
-bool OutputOptions::Private::openFile() const
-{
- if (!fileName.isNull())
- {
- nvCheck(outputHandler == NULL);
-
- DefaultOutputHandler * oh = new DefaultOutputHandler(fileName.str());
- if (oh->stream.isError())
- {
- return false;
- }
-
- outputHandler = oh;
- }
-
- return true;
-}
-
-void OutputOptions::Private::closeFile() const
-{
- if (!fileName.isNull())
- {
- delete outputHandler;
- outputHandler = NULL;
- }
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/OutputOptions.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/OutputOptions.h
deleted file mode 100644
index 56f885f6..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/OutputOptions.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_OUTPUTOPTIONS_H
-#define NV_TT_OUTPUTOPTIONS_H
-
-#include <nvcore/StrLib.h>
-#include <nvcore/StdStream.h>
-#include "nvtt.h"
-
-namespace nvtt
-{
-
- struct DefaultOutputHandler : public nvtt::OutputHandler
- {
- DefaultOutputHandler(const char * fileName) : stream(fileName) {}
-
- virtual ~DefaultOutputHandler()
- {
- }
-
- virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel)
- {
- // ignore.
- }
-
- // Output data.
- virtual bool writeData(const void * data, int size)
- {
- stream.serialize(const_cast<void *>(data), size);
-
- //return !stream.isError();
- return true;
- }
-
- nv::StdOutputStream stream;
- };
-
-
- struct OutputOptions::Private
- {
- nv::Path fileName;
-
- mutable OutputHandler * outputHandler;
- ErrorHandler * errorHandler;
- bool outputHeader;
- Container container;
-
- bool openFile() const;
- void closeFile() const;
- };
-
-
-} // nvtt namespace
-
-
-#endif // NV_TT_OUTPUTOPTIONS_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/QuickCompressDXT.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/QuickCompressDXT.cpp
deleted file mode 100644
index 04196a40..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/QuickCompressDXT.cpp
+++ /dev/null
@@ -1,635 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvcore/Containers.h> // swap
-
-#include <nvmath/Color.h>
-#include <nvmath/Fitting.h>
-
-#include <nvimage/ColorBlock.h>
-#include <nvimage/BlockDXT.h>
-
-#include "QuickCompressDXT.h"
-#include "OptimalCompressDXT.h"
-
-
-using namespace nv;
-using namespace QuickCompress;
-
-
-
-inline static void extractColorBlockRGB(const ColorBlock & rgba, Vector3 block[16])
-{
- for (int i = 0; i < 16; i++)
- {
- const Color32 c = rgba.color(i);
- block[i] = Vector3(c.r, c.g, c.b);
- }
-}
-
-inline static uint extractColorBlockRGBA(const ColorBlock & rgba, Vector3 block[16])
-{
- int num = 0;
-
- for (int i = 0; i < 16; i++)
- {
- const Color32 c = rgba.color(i);
- if (c.a > 127)
- {
- block[num++] = Vector3(c.r, c.g, c.b);
- }
- }
-
- return num;
-}
-
-
-// find minimum and maximum colors based on bounding box in color space
-inline static void findMinMaxColorsBox(const Vector3 * block, uint num, Vector3 * restrict maxColor, Vector3 * restrict minColor)
-{
- *maxColor = Vector3(0, 0, 0);
- *minColor = Vector3(255, 255, 255);
-
- for (uint i = 0; i < num; i++)
- {
- *maxColor = max(*maxColor, block[i]);
- *minColor = min(*minColor, block[i]);
- }
-}
-
-
-inline static void selectDiagonal(const Vector3 * block, uint num, Vector3 * restrict maxColor, Vector3 * restrict minColor)
-{
- Vector3 center = (*maxColor + *minColor) * 0.5;
-
- Vector2 covariance = Vector2(zero);
- for (uint i = 0; i < num; i++)
- {
- Vector3 t = block[i] - center;
- covariance += t.xy() * t.z();
- }
-
- float x0 = maxColor->x();
- float y0 = maxColor->y();
- float x1 = minColor->x();
- float y1 = minColor->y();
-
- if (covariance.x() < 0) {
- swap(x0, x1);
- }
- if (covariance.y() < 0) {
- swap(y0, y1);
- }
-
- maxColor->set(x0, y0, maxColor->z());
- minColor->set(x1, y1, minColor->z());
-}
-
-inline static void insetBBox(Vector3 * restrict maxColor, Vector3 * restrict minColor)
-{
- Vector3 inset = (*maxColor - *minColor) / 16.0f - (8.0f / 255.0f) / 16.0f;
- *maxColor = clamp(*maxColor - inset, 0.0f, 255.0f);
- *minColor = clamp(*minColor + inset, 0.0f, 255.0f);
-}
-
-inline static uint16 roundAndExpand(Vector3 * restrict v)
-{
- uint r = uint(clamp(v->x() * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f);
- uint g = uint(clamp(v->y() * (63.0f / 255.0f), 0.0f, 63.0f) + 0.5f);
- uint b = uint(clamp(v->z() * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f);
-
- uint16 w = (r << 11) | (g << 5) | b;
-
- r = (r << 3) | (r >> 2);
- g = (g << 2) | (g >> 4);
- b = (b << 3) | (b >> 2);
- *v = Vector3(float(r), float(g), float(b));
-
- return w;
-}
-
-inline static float colorDistance(Vector3::Arg c0, Vector3::Arg c1)
-{
- return dot(c0-c1, c0-c1);
-}
-
-inline static uint computeIndices4(const Vector3 block[16], Vector3::Arg maxColor, Vector3::Arg minColor)
-{
- Vector3 palette[4];
- palette[0] = maxColor;
- palette[1] = minColor;
- palette[2] = lerp(palette[0], palette[1], 1.0f / 3.0f);
- palette[3] = lerp(palette[0], palette[1], 2.0f / 3.0f);
-
- uint indices = 0;
- for(int i = 0; i < 16; i++)
- {
- float d0 = colorDistance(palette[0], block[i]);
- float d1 = colorDistance(palette[1], block[i]);
- float d2 = colorDistance(palette[2], block[i]);
- float d3 = colorDistance(palette[3], block[i]);
-
- uint b0 = d0 > d3;
- uint b1 = d1 > d2;
- uint b2 = d0 > d2;
- uint b3 = d1 > d3;
- uint b4 = d2 > d3;
-
- uint x0 = b1 & b2;
- uint x1 = b0 & b3;
- uint x2 = b0 & b4;
-
- indices |= (x2 | ((x0 | x1) << 1)) << (2 * i);
- }
-
- return indices;
-}
-
-inline static float evaluatePaletteError4(const Vector3 block[16], Vector3::Arg maxColor, Vector3::Arg minColor)
-{
- Vector3 palette[4];
- palette[0] = maxColor;
- palette[1] = minColor;
- palette[2] = lerp(palette[0], palette[1], 1.0f / 3.0f);
- palette[3] = lerp(palette[0], palette[1], 2.0f / 3.0f);
-
- float total = 0.0f;
- for (int i = 0; i < 16; i++)
- {
- float d0 = colorDistance(palette[0], block[i]);
- float d1 = colorDistance(palette[1], block[i]);
- float d2 = colorDistance(palette[2], block[i]);
- float d3 = colorDistance(palette[3], block[i]);
-
- total += min(min(d0, d1), min(d2, d3));
- }
-
- return total;
-}
-
-inline static uint computeIndices3(const ColorBlock & rgba, Vector3::Arg maxColor, Vector3::Arg minColor)
-{
- Vector3 palette[4];
- palette[0] = minColor;
- palette[1] = maxColor;
- palette[2] = (palette[0] + palette[1]) * 0.5f;
-
- uint indices = 0;
- for(int i = 0; i < 16; i++)
- {
- Color32 c = rgba.color(i);
- Vector3 color = Vector3(c.r, c.g, c.b);
-
- float d0 = colorDistance(palette[0], color);
- float d1 = colorDistance(palette[1], color);
- float d2 = colorDistance(palette[2], color);
-
- uint index;
- if (c.a < 128) index = 3;
- else if (d0 < d1 && d0 < d2) index = 0;
- else if (d1 < d2) index = 1;
- else index = 2;
-
- indices |= index << (2 * i);
- }
-
- return indices;
-}
-
-
-static void optimizeEndPoints4(Vector3 block[16], BlockDXT1 * dxtBlock)
-{
- float alpha2_sum = 0.0f;
- float beta2_sum = 0.0f;
- float alphabeta_sum = 0.0f;
- Vector3 alphax_sum(zero);
- Vector3 betax_sum(zero);
-
- for( int i = 0; i < 16; ++i )
- {
- const uint bits = dxtBlock->indices >> (2 * i);
-
- float beta = float(bits & 1);
- if (bits & 2) beta = (1 + beta) / 3.0f;
- float alpha = 1.0f - beta;
-
- alpha2_sum += alpha * alpha;
- beta2_sum += beta * beta;
- alphabeta_sum += alpha * beta;
- alphax_sum += alpha * block[i];
- betax_sum += beta * block[i];
- }
-
- float denom = alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum;
- if (equal(denom, 0.0f)) return;
-
- float factor = 1.0f / denom;
-
- Vector3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- Vector3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- a = clamp(a, 0, 255);
- b = clamp(b, 0, 255);
-
- uint16 color0 = roundAndExpand(&a);
- uint16 color1 = roundAndExpand(&b);
-
- if (color0 < color1)
- {
- swap(a, b);
- swap(color0, color1);
- }
-
- dxtBlock->col0 = Color16(color0);
- dxtBlock->col1 = Color16(color1);
- dxtBlock->indices = computeIndices4(block, a, b);
-}
-
-/*static void optimizeEndPoints3(Vector3 block[16], BlockDXT1 * dxtBlock)
-{
- float alpha2_sum = 0.0f;
- float beta2_sum = 0.0f;
- float alphabeta_sum = 0.0f;
- Vector3 alphax_sum(zero);
- Vector3 betax_sum(zero);
-
- for( int i = 0; i < 16; ++i )
- {
- const uint bits = dxtBlock->indices >> (2 * i);
-
- float beta = (bits & 1);
- if (bits & 2) beta = 0.5f;
- float alpha = 1.0f - beta;
-
- alpha2_sum += alpha * alpha;
- beta2_sum += beta * beta;
- alphabeta_sum += alpha * beta;
- alphax_sum += alpha * block[i];
- betax_sum += beta * block[i];
- }
-
- float denom = alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum;
- if (equal(denom, 0.0f)) return;
-
- float factor = 1.0f / denom;
-
- Vector3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- Vector3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- a = clamp(a, 0, 255);
- b = clamp(b, 0, 255);
-
- uint16 color0 = roundAndExpand(&a);
- uint16 color1 = roundAndExpand(&b);
-
- if (color0 < color1)
- {
- swap(a, b);
- swap(color0, color1);
- }
-
- dxtBlock->col0 = Color16(color1);
- dxtBlock->col1 = Color16(color0);
- dxtBlock->indices = computeIndices3(block, a, b);
-}*/
-
-namespace
-{
-
- static uint computeAlphaIndices(const ColorBlock & rgba, AlphaBlockDXT5 * block)
- {
- uint8 alphas[8];
- block->evaluatePalette(alphas);
-
- uint totalError = 0;
-
- for (uint i = 0; i < 16; i++)
- {
- uint8 alpha = rgba.color(i).a;
-
- uint besterror = 256*256;
- uint best = 8;
- for(uint p = 0; p < 8; p++)
- {
- int d = alphas[p] - alpha;
- uint error = d * d;
-
- if (error < besterror)
- {
- besterror = error;
- best = p;
- }
- }
- nvDebugCheck(best < 8);
-
- totalError += besterror;
- block->setIndex(i, best);
- }
-
- return totalError;
- }
-
- static void optimizeAlpha8(const ColorBlock & rgba, AlphaBlockDXT5 * block)
- {
- float alpha2_sum = 0;
- float beta2_sum = 0;
- float alphabeta_sum = 0;
- float alphax_sum = 0;
- float betax_sum = 0;
-
- for (int i = 0; i < 16; i++)
- {
- uint idx = block->index(i);
- float alpha;
- if (idx < 2) alpha = 1.0f - idx;
- else alpha = (8.0f - idx) / 7.0f;
-
- float beta = 1 - alpha;
-
- alpha2_sum += alpha * alpha;
- beta2_sum += beta * beta;
- alphabeta_sum += alpha * beta;
- alphax_sum += alpha * rgba.color(i).a;
- betax_sum += beta * rgba.color(i).a;
- }
-
- const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- float a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- float b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- uint alpha0 = uint(min(max(a, 0.0f), 255.0f));
- uint alpha1 = uint(min(max(b, 0.0f), 255.0f));
-
- if (alpha0 < alpha1)
- {
- swap(alpha0, alpha1);
-
- // Flip indices:
- for (int i = 0; i < 16; i++)
- {
- uint idx = block->index(i);
- if (idx < 2) block->setIndex(i, 1 - idx);
- else block->setIndex(i, 9 - idx);
- }
- }
- else if (alpha0 == alpha1)
- {
- for (int i = 0; i < 16; i++)
- {
- block->setIndex(i, 0);
- }
- }
-
- block->alpha0 = alpha0;
- block->alpha1 = alpha1;
- }
-
- /*
- static void optimizeAlpha6(const ColorBlock & rgba, AlphaBlockDXT5 * block)
- {
- float alpha2_sum = 0;
- float beta2_sum = 0;
- float alphabeta_sum = 0;
- float alphax_sum = 0;
- float betax_sum = 0;
-
- for (int i = 0; i < 16; i++)
- {
- uint8 x = rgba.color(i).a;
- if (x == 0 || x == 255) continue;
-
- uint bits = block->index(i);
- if (bits == 6 || bits == 7) continue;
-
- float alpha;
- if (bits == 0) alpha = 1.0f;
- else if (bits == 1) alpha = 0.0f;
- else alpha = (6.0f - block->index(i)) / 5.0f;
-
- float beta = 1 - alpha;
-
- alpha2_sum += alpha * alpha;
- beta2_sum += beta * beta;
- alphabeta_sum += alpha * beta;
- alphax_sum += alpha * x;
- betax_sum += beta * x;
- }
-
- const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- float a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- float b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- uint alpha0 = uint(min(max(a, 0.0f), 255.0f));
- uint alpha1 = uint(min(max(b, 0.0f), 255.0f));
-
- if (alpha0 > alpha1)
- {
- swap(alpha0, alpha1);
- }
-
- block->alpha0 = alpha0;
- block->alpha1 = alpha1;
- }
- */
-
- static bool sameIndices(const AlphaBlockDXT5 & block0, const AlphaBlockDXT5 & block1)
- {
- const uint64 mask = ~uint64(0xFFFF);
- return (block0.u | mask) == (block1.u | mask);
- }
-
-} // namespace
-
-
-
-void QuickCompress::compressDXT1(const ColorBlock & rgba, BlockDXT1 * dxtBlock)
-{
- if (rgba.isSingleColor())
- {
- OptimalCompress::compressDXT1(rgba.color(0), dxtBlock);
- }
- else
- {
- // read block
- Vector3 block[16];
- extractColorBlockRGB(rgba, block);
-
-#if 1
- // find min and max colors
- Vector3 maxColor, minColor;
- findMinMaxColorsBox(block, 16, &maxColor, &minColor);
-
- selectDiagonal(block, 16, &maxColor, &minColor);
-
- insetBBox(&maxColor, &minColor);
-#else
- float weights[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
- Vector3 cluster[4];
- int count = Compute4Means(16, block, weights, Vector3(1, 1, 1), cluster);
-
- Vector3 maxColor, minColor;
- float bestError = FLT_MAX;
-
- for (int i = 1; i < 4; i++)
- {
- for (int j = 0; j < i; j++)
- {
- uint16 color0 = roundAndExpand(&cluster[i]);
- uint16 color1 = roundAndExpand(&cluster[j]);
-
- float error = evaluatePaletteError4(block, cluster[i], cluster[j]);
- if (error < bestError) {
- bestError = error;
- maxColor = cluster[i];
- minColor = cluster[j];
- }
- }
- }
-#endif
-
- uint16 color0 = roundAndExpand(&maxColor);
- uint16 color1 = roundAndExpand(&minColor);
-
- if (color0 < color1)
- {
- swap(maxColor, minColor);
- swap(color0, color1);
- }
-
- dxtBlock->col0 = Color16(color0);
- dxtBlock->col1 = Color16(color1);
- dxtBlock->indices = computeIndices4(block, maxColor, minColor);
-
- optimizeEndPoints4(block, dxtBlock);
- }
-}
-
-
-void QuickCompress::compressDXT1a(const ColorBlock & rgba, BlockDXT1 * dxtBlock)
-{
- bool hasAlpha = false;
-
- for (uint i = 0; i < 16; i++)
- {
- if (rgba.color(i).a < 128) {
- hasAlpha = true;
- break;
- }
- }
-
- if (!hasAlpha)
- {
- compressDXT1(rgba, dxtBlock);
- }
- // @@ Handle single RGB, with varying alpha? We need tables for single color compressor in 3 color mode.
- //else if (rgba.isSingleColorNoAlpha()) { ... }
- else
- {
- // read block
- Vector3 block[16];
- uint num = extractColorBlockRGBA(rgba, block);
-
- // find min and max colors
- Vector3 maxColor, minColor;
- findMinMaxColorsBox(block, num, &maxColor, &minColor);
-
- selectDiagonal(block, num, &maxColor, &minColor);
-
- insetBBox(&maxColor, &minColor);
-
- uint16 color0 = roundAndExpand(&maxColor);
- uint16 color1 = roundAndExpand(&minColor);
-
- if (color0 < color1)
- {
- swap(maxColor, minColor);
- swap(color0, color1);
- }
-
- dxtBlock->col0 = Color16(color1);
- dxtBlock->col1 = Color16(color0);
- dxtBlock->indices = computeIndices3(rgba, maxColor, minColor);
-
- // optimizeEndPoints(block, dxtBlock);
- }
-}
-
-
-void QuickCompress::compressDXT3(const ColorBlock & rgba, BlockDXT3 * dxtBlock)
-{
- compressDXT1(rgba, &dxtBlock->color);
- OptimalCompress::compressDXT3A(rgba, &dxtBlock->alpha);
-}
-
-
-void QuickCompress::compressDXT5A(const ColorBlock & rgba, AlphaBlockDXT5 * dxtBlock, int iterationCount/*=8*/)
-{
- uint8 alpha0 = 0;
- uint8 alpha1 = 255;
-
- // Get min/max alpha.
- for (uint i = 0; i < 16; i++)
- {
- uint8 alpha = rgba.color(i).a;
- alpha0 = max(alpha0, alpha);
- alpha1 = min(alpha1, alpha);
- }
-
- AlphaBlockDXT5 block;
- block.alpha0 = alpha0 - (alpha0 - alpha1) / 34;
- block.alpha1 = alpha1 + (alpha0 - alpha1) / 34;
- uint besterror = computeAlphaIndices(rgba, &block);
-
- AlphaBlockDXT5 bestblock = block;
-
- for (int i = 0; i < iterationCount; i++)
- {
- optimizeAlpha8(rgba, &block);
- uint error = computeAlphaIndices(rgba, &block);
-
- if (error >= besterror)
- {
- // No improvement, stop.
- break;
- }
- if (sameIndices(block, bestblock))
- {
- bestblock = block;
- break;
- }
-
- besterror = error;
- bestblock = block;
- };
-
- // Copy best block to result;
- *dxtBlock = bestblock;
-}
-
-void QuickCompress::compressDXT5(const ColorBlock & rgba, BlockDXT5 * dxtBlock, int iterationCount/*=8*/)
-{
- compressDXT1(rgba, &dxtBlock->color);
- compressDXT5A(rgba, &dxtBlock->alpha, iterationCount);
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/QuickCompressDXT.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/QuickCompressDXT.h
deleted file mode 100644
index 1297daae..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/QuickCompressDXT.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_QUICKCOMPRESSDXT_H
-#define NV_TT_QUICKCOMPRESSDXT_H
-
-#include <nvimage/nvimage.h>
-
-namespace nv
-{
- struct ColorBlock;
- struct BlockDXT1;
- struct BlockDXT3;
- struct BlockDXT5;
- struct AlphaBlockDXT3;
- struct AlphaBlockDXT5;
-
- namespace QuickCompress
- {
- void compressDXT1(const ColorBlock & rgba, BlockDXT1 * dxtBlock);
- void compressDXT1a(const ColorBlock & rgba, BlockDXT1 * dxtBlock);
-
- void compressDXT3(const ColorBlock & rgba, BlockDXT3 * dxtBlock);
-
- void compressDXT5A(const ColorBlock & rgba, AlphaBlockDXT5 * dxtBlock, int iterationCount=8);
- void compressDXT5(const ColorBlock & rgba, BlockDXT5 * dxtBlock, int iterationCount=8);
- }
-} // nv namespace
-
-#endif // NV_TT_QUICKCOMPRESSDXT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/SingleColorLookup.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/SingleColorLookup.h
deleted file mode 100644
index 63d04628..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/SingleColorLookup.h
+++ /dev/null
@@ -1,580 +0,0 @@
-
-/*
-static int Mul8Bit(int a, int b)
-{
- int t = a * b + 128;
- return (t + (t >> 8)) >> 8;
-}
-
-static void PrepareOptTable(uint8 * Table, const uint8 * expand, int size)
-{
- for (int i = 0; i < 256; i++)
- {
- int bestErr = 256;
-
- for (int min = 0; min < size; min++)
- {
- for (int max = 0; max < size; max++)
- {
- int mine = expand[min];
- int maxe = expand[max];
- int err = abs(maxe + Mul8Bit(mine-maxe, 0x55) - i);
-
- if (err < bestErr)
- {
- Table[i*2+0] = max;
- Table[i*2+1] = min;
- bestErr = err;
- }
- }
- }
- }
-}
-
-
-void initTables()
-{
- uint8 Expand5[32];
- uint8 Expand6[64];
-
- for(sInt i=0;i<32;i++)
- Expand5[i] = (i<<3)|(i>>2);
-
- for(sInt i=0;i<64;i++)
- Expand6[i] = (i<<2)|(i>>4);
-
- PrepareOptTable(OMatch5, Expand5, 32)
- PrepareOptTable(OMatch6, Expand6, 64)
-};
-*/
-
-#if __CUDACC__
-__constant__ unsigned short
-#else
-const static uint8
-#endif
-OMatch5[256][2] =
-{
- {0x00, 0x00},
- {0x00, 0x00},
- {0x00, 0x01},
- {0x00, 0x01},
- {0x01, 0x00},
- {0x01, 0x00},
- {0x01, 0x00},
- {0x01, 0x01},
- {0x01, 0x01},
- {0x01, 0x01},
- {0x02, 0x00},
- {0x02, 0x00},
- {0x02, 0x00},
- {0x02, 0x01},
- {0x00, 0x05},
- {0x03, 0x00},
- {0x03, 0x00},
- {0x03, 0x00},
- {0x03, 0x01},
- {0x03, 0x01},
- {0x03, 0x01},
- {0x03, 0x02},
- {0x04, 0x00},
- {0x04, 0x00},
- {0x03, 0x03},
- {0x04, 0x01},
- {0x05, 0x00},
- {0x05, 0x00},
- {0x05, 0x00},
- {0x05, 0x01},
- {0x05, 0x01},
- {0x05, 0x01},
- {0x03, 0x06},
- {0x06, 0x00},
- {0x06, 0x00},
- {0x06, 0x01},
- {0x04, 0x05},
- {0x07, 0x00},
- {0x07, 0x00},
- {0x07, 0x00},
- {0x07, 0x01},
- {0x07, 0x01},
- {0x07, 0x01},
- {0x07, 0x02},
- {0x08, 0x00},
- {0x08, 0x00},
- {0x07, 0x03},
- {0x08, 0x01},
- {0x09, 0x00},
- {0x09, 0x00},
- {0x09, 0x00},
- {0x09, 0x01},
- {0x09, 0x01},
- {0x09, 0x01},
- {0x07, 0x06},
- {0x0A, 0x00},
- {0x0A, 0x00},
- {0x0A, 0x01},
- {0x08, 0x05},
- {0x0B, 0x00},
- {0x0B, 0x00},
- {0x0B, 0x00},
- {0x0B, 0x01},
- {0x0B, 0x01},
- {0x0B, 0x01},
- {0x0B, 0x02},
- {0x0C, 0x00},
- {0x0C, 0x00},
- {0x0B, 0x03},
- {0x0C, 0x01},
- {0x0D, 0x00},
- {0x0D, 0x00},
- {0x0D, 0x00},
- {0x0D, 0x01},
- {0x0D, 0x01},
- {0x0D, 0x01},
- {0x0B, 0x06},
- {0x0E, 0x00},
- {0x0E, 0x00},
- {0x0E, 0x01},
- {0x0C, 0x05},
- {0x0F, 0x00},
- {0x0F, 0x00},
- {0x0F, 0x00},
- {0x0F, 0x01},
- {0x0F, 0x01},
- {0x0F, 0x01},
- {0x0F, 0x02},
- {0x10, 0x00},
- {0x10, 0x00},
- {0x0F, 0x03},
- {0x10, 0x01},
- {0x11, 0x00},
- {0x11, 0x00},
- {0x11, 0x00},
- {0x11, 0x01},
- {0x11, 0x01},
- {0x11, 0x01},
- {0x0F, 0x06},
- {0x12, 0x00},
- {0x12, 0x00},
- {0x12, 0x01},
- {0x10, 0x05},
- {0x13, 0x00},
- {0x13, 0x00},
- {0x13, 0x00},
- {0x13, 0x01},
- {0x13, 0x01},
- {0x13, 0x01},
- {0x13, 0x02},
- {0x14, 0x00},
- {0x14, 0x00},
- {0x13, 0x03},
- {0x14, 0x01},
- {0x15, 0x00},
- {0x15, 0x00},
- {0x15, 0x00},
- {0x15, 0x01},
- {0x15, 0x01},
- {0x15, 0x01},
- {0x13, 0x06},
- {0x16, 0x00},
- {0x16, 0x00},
- {0x16, 0x01},
- {0x14, 0x05},
- {0x17, 0x00},
- {0x17, 0x00},
- {0x17, 0x00},
- {0x17, 0x01},
- {0x17, 0x01},
- {0x17, 0x01},
- {0x17, 0x02},
- {0x18, 0x00},
- {0x18, 0x00},
- {0x17, 0x03},
- {0x18, 0x01},
- {0x19, 0x00},
- {0x19, 0x00},
- {0x19, 0x00},
- {0x19, 0x01},
- {0x19, 0x01},
- {0x19, 0x01},
- {0x17, 0x06},
- {0x1A, 0x00},
- {0x1A, 0x00},
- {0x1A, 0x01},
- {0x18, 0x05},
- {0x1B, 0x00},
- {0x1B, 0x00},
- {0x1B, 0x00},
- {0x1B, 0x01},
- {0x1B, 0x01},
- {0x1B, 0x01},
- {0x1B, 0x02},
- {0x1C, 0x00},
- {0x1C, 0x00},
- {0x1B, 0x03},
- {0x1C, 0x01},
- {0x1D, 0x00},
- {0x1D, 0x00},
- {0x1D, 0x00},
- {0x1D, 0x01},
- {0x1D, 0x01},
- {0x1D, 0x01},
- {0x1B, 0x06},
- {0x1E, 0x00},
- {0x1E, 0x00},
- {0x1E, 0x01},
- {0x1C, 0x05},
- {0x1F, 0x00},
- {0x1F, 0x00},
- {0x1F, 0x00},
- {0x1F, 0x01},
- {0x1F, 0x01},
- {0x1F, 0x01},
- {0x1F, 0x02},
- {0x1E, 0x04},
- {0x1F, 0x03},
- {0x1F, 0x03},
- {0x1C, 0x09},
- {0x1F, 0x04},
- {0x1F, 0x04},
- {0x1F, 0x04},
- {0x1F, 0x05},
- {0x1F, 0x05},
- {0x1F, 0x05},
- {0x1F, 0x06},
- {0x1E, 0x08},
- {0x1F, 0x07},
- {0x1F, 0x07},
- {0x1C, 0x0D},
- {0x1F, 0x08},
- {0x1F, 0x08},
- {0x1F, 0x08},
- {0x1F, 0x09},
- {0x1F, 0x09},
- {0x1F, 0x09},
- {0x1F, 0x0A},
- {0x1E, 0x0C},
- {0x1F, 0x0B},
- {0x1F, 0x0B},
- {0x1C, 0x11},
- {0x1F, 0x0C},
- {0x1F, 0x0C},
- {0x1F, 0x0C},
- {0x1F, 0x0D},
- {0x1F, 0x0D},
- {0x1F, 0x0D},
- {0x1F, 0x0E},
- {0x1E, 0x10},
- {0x1F, 0x0F},
- {0x1F, 0x0F},
- {0x1C, 0x15},
- {0x1F, 0x10},
- {0x1F, 0x10},
- {0x1F, 0x10},
- {0x1F, 0x11},
- {0x1F, 0x11},
- {0x1F, 0x11},
- {0x1F, 0x12},
- {0x1E, 0x14},
- {0x1F, 0x13},
- {0x1F, 0x13},
- {0x1C, 0x19},
- {0x1F, 0x14},
- {0x1F, 0x14},
- {0x1F, 0x14},
- {0x1F, 0x15},
- {0x1F, 0x15},
- {0x1F, 0x15},
- {0x1F, 0x16},
- {0x1E, 0x18},
- {0x1F, 0x17},
- {0x1F, 0x17},
- {0x1C, 0x1D},
- {0x1F, 0x18},
- {0x1F, 0x18},
- {0x1F, 0x18},
- {0x1F, 0x19},
- {0x1F, 0x19},
- {0x1F, 0x19},
- {0x1F, 0x1A},
- {0x1E, 0x1C},
- {0x1F, 0x1B},
- {0x1F, 0x1B},
- {0x1F, 0x1B},
- {0x1F, 0x1C},
- {0x1F, 0x1C},
- {0x1F, 0x1C},
- {0x1F, 0x1D},
- {0x1F, 0x1D},
- {0x1F, 0x1D},
- {0x1F, 0x1E},
- {0x1F, 0x1E},
- {0x1F, 0x1F},
- {0x1F, 0x1F},
-};
-
-#if __CUDACC__
-__constant__ unsigned short
-#else
-const static uint8
-#endif
-OMatch6[256][2] =
-{
- {0x00, 0x00},
- {0x00, 0x01},
- {0x01, 0x00},
- {0x01, 0x00},
- {0x01, 0x01},
- {0x02, 0x00},
- {0x02, 0x00},
- {0x02, 0x01},
- {0x03, 0x00},
- {0x03, 0x01},
- {0x04, 0x00},
- {0x04, 0x00},
- {0x04, 0x01},
- {0x05, 0x00},
- {0x05, 0x00},
- {0x05, 0x01},
- {0x06, 0x00},
- {0x06, 0x01},
- {0x07, 0x00},
- {0x07, 0x00},
- {0x07, 0x01},
- {0x08, 0x00},
- {0x00, 0x10},
- {0x08, 0x01},
- {0x09, 0x00},
- {0x09, 0x01},
- {0x01, 0x11},
- {0x0A, 0x00},
- {0x0A, 0x01},
- {0x0B, 0x00},
- {0x03, 0x10},
- {0x0B, 0x01},
- {0x0C, 0x00},
- {0x0C, 0x01},
- {0x04, 0x11},
- {0x0D, 0x00},
- {0x0D, 0x01},
- {0x0E, 0x00},
- {0x06, 0x10},
- {0x0E, 0x01},
- {0x0F, 0x00},
- {0x0F, 0x01},
- {0x07, 0x11},
- {0x10, 0x00},
- {0x0F, 0x03},
- {0x10, 0x01},
- {0x11, 0x00},
- {0x11, 0x01},
- {0x0F, 0x06},
- {0x12, 0x00},
- {0x12, 0x01},
- {0x13, 0x00},
- {0x0F, 0x09},
- {0x13, 0x01},
- {0x14, 0x00},
- {0x14, 0x01},
- {0x0F, 0x0C},
- {0x15, 0x00},
- {0x15, 0x01},
- {0x16, 0x00},
- {0x0F, 0x0F},
- {0x16, 0x01},
- {0x17, 0x00},
- {0x17, 0x01},
- {0x0F, 0x12},
- {0x18, 0x00},
- {0x18, 0x01},
- {0x19, 0x00},
- {0x11, 0x10},
- {0x19, 0x01},
- {0x1A, 0x00},
- {0x1A, 0x01},
- {0x12, 0x11},
- {0x1B, 0x00},
- {0x1B, 0x01},
- {0x1C, 0x00},
- {0x14, 0x10},
- {0x1C, 0x01},
- {0x1D, 0x00},
- {0x1D, 0x01},
- {0x15, 0x11},
- {0x1E, 0x00},
- {0x1E, 0x01},
- {0x1F, 0x00},
- {0x17, 0x10},
- {0x1F, 0x01},
- {0x1F, 0x02},
- {0x20, 0x00},
- {0x20, 0x01},
- {0x21, 0x00},
- {0x1F, 0x05},
- {0x21, 0x01},
- {0x22, 0x00},
- {0x22, 0x01},
- {0x1F, 0x08},
- {0x23, 0x00},
- {0x23, 0x01},
- {0x24, 0x00},
- {0x1F, 0x0B},
- {0x24, 0x01},
- {0x25, 0x00},
- {0x25, 0x01},
- {0x1F, 0x0E},
- {0x26, 0x00},
- {0x26, 0x01},
- {0x27, 0x00},
- {0x1F, 0x11},
- {0x27, 0x01},
- {0x28, 0x00},
- {0x28, 0x01},
- {0x20, 0x11},
- {0x29, 0x00},
- {0x29, 0x01},
- {0x2A, 0x00},
- {0x22, 0x10},
- {0x2A, 0x01},
- {0x2B, 0x00},
- {0x2B, 0x01},
- {0x23, 0x11},
- {0x2C, 0x00},
- {0x2C, 0x01},
- {0x2D, 0x00},
- {0x25, 0x10},
- {0x2D, 0x01},
- {0x2E, 0x00},
- {0x2E, 0x01},
- {0x26, 0x11},
- {0x2F, 0x00},
- {0x2F, 0x01},
- {0x2F, 0x02},
- {0x30, 0x00},
- {0x30, 0x01},
- {0x2F, 0x04},
- {0x31, 0x00},
- {0x31, 0x01},
- {0x32, 0x00},
- {0x2F, 0x07},
- {0x32, 0x01},
- {0x33, 0x00},
- {0x33, 0x01},
- {0x2F, 0x0A},
- {0x34, 0x00},
- {0x34, 0x01},
- {0x35, 0x00},
- {0x2F, 0x0D},
- {0x35, 0x01},
- {0x36, 0x00},
- {0x36, 0x01},
- {0x2F, 0x10},
- {0x37, 0x00},
- {0x37, 0x01},
- {0x38, 0x00},
- {0x30, 0x10},
- {0x38, 0x01},
- {0x39, 0x00},
- {0x39, 0x01},
- {0x31, 0x11},
- {0x3A, 0x00},
- {0x3A, 0x01},
- {0x3B, 0x00},
- {0x33, 0x10},
- {0x3B, 0x01},
- {0x3C, 0x00},
- {0x3C, 0x01},
- {0x34, 0x11},
- {0x3D, 0x00},
- {0x3D, 0x01},
- {0x3E, 0x00},
- {0x36, 0x10},
- {0x3E, 0x01},
- {0x3F, 0x00},
- {0x3F, 0x01},
- {0x37, 0x11},
- {0x3F, 0x02},
- {0x3F, 0x03},
- {0x3F, 0x04},
- {0x39, 0x10},
- {0x3F, 0x05},
- {0x3F, 0x06},
- {0x3F, 0x07},
- {0x3A, 0x11},
- {0x3F, 0x08},
- {0x3F, 0x09},
- {0x3F, 0x0A},
- {0x3C, 0x10},
- {0x3F, 0x0B},
- {0x3F, 0x0C},
- {0x3F, 0x0D},
- {0x3D, 0x11},
- {0x3F, 0x0E},
- {0x3F, 0x0F},
- {0x36, 0x21},
- {0x3F, 0x10},
- {0x3F, 0x11},
- {0x3F, 0x12},
- {0x38, 0x20},
- {0x3F, 0x13},
- {0x3F, 0x14},
- {0x3F, 0x15},
- {0x39, 0x21},
- {0x3F, 0x16},
- {0x3F, 0x17},
- {0x3F, 0x18},
- {0x3B, 0x20},
- {0x3F, 0x19},
- {0x3F, 0x1A},
- {0x3F, 0x1B},
- {0x3C, 0x21},
- {0x3F, 0x1C},
- {0x3F, 0x1D},
- {0x3F, 0x1E},
- {0x3E, 0x20},
- {0x3F, 0x1F},
- {0x3F, 0x20},
- {0x37, 0x30},
- {0x3F, 0x21},
- {0x3F, 0x22},
- {0x3F, 0x23},
- {0x38, 0x31},
- {0x3F, 0x24},
- {0x3F, 0x25},
- {0x3F, 0x26},
- {0x3A, 0x30},
- {0x3F, 0x27},
- {0x3F, 0x28},
- {0x3F, 0x29},
- {0x3B, 0x31},
- {0x3F, 0x2A},
- {0x3F, 0x2B},
- {0x3F, 0x2C},
- {0x3D, 0x30},
- {0x3F, 0x2D},
- {0x3F, 0x2E},
- {0x3F, 0x2F},
- {0x3E, 0x31},
- {0x3F, 0x30},
- {0x3F, 0x31},
- {0x3F, 0x31},
- {0x3F, 0x32},
- {0x3F, 0x33},
- {0x3F, 0x34},
- {0x3F, 0x34},
- {0x3F, 0x35},
- {0x3F, 0x36},
- {0x3F, 0x37},
- {0x3F, 0x37},
- {0x3F, 0x38},
- {0x3F, 0x39},
- {0x3F, 0x3A},
- {0x3F, 0x3A},
- {0x3F, 0x3B},
- {0x3F, 0x3C},
- {0x3F, 0x3D},
- {0x3F, 0x3D},
- {0x3F, 0x3E},
- {0x3F, 0x3F},
-};
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/Texture.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/Texture.cpp
deleted file mode 100644
index 9d02291d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/Texture.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include "Texture.h"
-
-using namespace nvtt;
-
-
-Texture::Texture() : m(*new Texture::Private())
-{
-}
-
-Texture::~Texture()
-{
- delete &m;
-}
-
-Texture::Texture(const Texture & tex) : m(*new Texture::Private())
-{
- // @@ Not implemented.
-}
-
-void Texture::operator=(const Texture & tex)
-{
- // @@ Not implemented.
-}
-
-bool Texture::load(const char * fileName)
-{
- // @@ Not implemented.
- return false;
-}
-
-void Texture::setType(TextureType type)
-{
- m.type = type;
-}
-
-void Texture::setTexture2D(InputFormat format, int w, int h, int idx, void * data)
-{
- // @@ Not implemented.
-}
-
-void Texture::resize(int w, int h, ResizeFilter filter)
-{
- // if cubemap, make sure w==h.s
- // @@ Not implemented.
-}
-
-bool Texture::buildMipmap(MipmapFilter filter)
-{
- // @@ Not implemented.
- return false;
-}
-
-// Color transforms.
-void Texture::toLinear(float gamma)
-{
- foreach(i, m.imageArray)
- {
- m.imageArray[i].toLinear(0, 3, gamma);
- }
-}
-
-void Texture::toGamma(float gamma)
-{
- foreach(i, m.imageArray)
- {
- m.imageArray[i].toGamma(0, 3, gamma);
- }
-}
-
-void Texture::transform(const float w0[4], const float w1[4], const float w2[4], const float w3[4], const float offset[4])
-{
- // @@ Not implemented.
-}
-
-void Texture::swizzle(int r, int g, int b, int a)
-{
- foreach(i, m.imageArray)
- {
- m.imageArray[i].swizzle(0, r, g, b, a);
- }
-}
-
-void Texture::scaleBias(int channel, float scale, float bias)
-{
- foreach(i, m.imageArray)
- {
- m.imageArray[i].scaleBias(channel, 1, scale, bias);
- }
-}
-
-void Texture::normalize()
-{
- foreach(i, m.imageArray)
- {
- m.imageArray[i].normalize(0);
- }
-}
-
-void Texture::blend(float r, float g, float b, float a)
-{
- // @@ Not implemented.
-}
-
-void Texture::premultiplyAlpha()
-{
- // @@ Not implemented.
-}
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/Texture.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/Texture.h
deleted file mode 100644
index de09aed2..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/Texture.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_TEXTURE_H
-#define NV_TT_TEXTURE_H
-
-#include "nvtt.h"
-
-#include <nvcore/Containers.h>
-
-#include <nvimage/Image.h>
-#include <nvimage/FloatImage.h>
-
-namespace nvtt
-{
-
- struct Texture::Private
- {
- TextureType type;
- nv::Array<nv::FloatImage> imageArray;
- };
-
-
-} // nvtt namespace
-
-
-#endif // NV_TT_TEXTURE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/Bitmaps.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/Bitmaps.h
deleted file mode 100644
index bd736555..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/Bitmaps.h
+++ /dev/null
@@ -1,1886 +0,0 @@
-
-
-/*
-static void doPrecomputation()
-{
- uint bitmaps[1024];
-
- int indices[16];
- int num = 0;
-
- // Compute bitmaps with 3 clusters:
-
- // first cluster [0,i) is at the start
- for( int m = 0; m < 16; ++m )
- {
- indices[m] = 0;
- }
- const int imax = 15;
- for( int i = imax; i >= 0; --i )
- {
- // second cluster [i,j) is half along
- for( int m = i; m < 16; ++m )
- {
- indices[m] = 2;
- }
- const int jmax = ( i == 0 ) ? 15 : 16;
- for( int j = jmax; j >= i; --j )
- {
- // last cluster [j,k) is at the end
- if( j < 16 )
- {
- indices[j] = 1;
- }
-
- uint bitmap = 0;
-
- for(int p = 0; p < 16; p++) {
- bitmap |= indices[p] << (p * 2);
- }
-
- bitmaps[num] = bitmap;
-
- num++;
- }
- }
- nvDebugCheck(num == 151);
-
- // Align to 160.
- for(int i = 0; i < 9; i++)
- {
- bitmaps[num] = 0x555AA000;
- num++;
- }
- nvDebugCheck(num == 160);
-
- // Append bitmaps with 4 clusters:
-
- // first cluster [0,i) is at the start
- for( int m = 0; m < 16; ++m )
- {
- indices[m] = 0;
- }
- for( int i = imax; i >= 0; --i )
- {
- // second cluster [i,j) is one third along
- for( int m = i; m < 16; ++m )
- {
- indices[m] = 2;
- }
- const int jmax = ( i == 0 ) ? 15 : 16;
- for( int j = jmax; j >= i; --j )
- {
- // third cluster [j,k) is two thirds along
- for( int m = j; m < 16; ++m )
- {
- indices[m] = 3;
- }
-
- int kmax = ( j == 0 ) ? 15 : 16;
- for( int k = kmax; k >= j; --k )
- {
- // last cluster [k,n) is at the end
- if( k < 16 )
- {
- indices[k] = 1;
- }
-
- uint bitmap = 0;
-
- bool hasThree = false;
- for(int p = 0; p < 16; p++) {
- bitmap |= indices[p] << (p * 2);
-
- if (indices[p] == 3) hasThree = true;
- }
-
- if (hasThree) {
- bitmaps[num] = bitmap;
- num++;
- }
- }
- }
- }
- nvDebugCheck(num == 975);
-
- // Align to 1024.
- for(int i = 0; i < 49; i++)
- {
- bitmaps[num] = 0x555AA000;
- num++;
- }
-
- nvDebugCheck(num == 1024);
-
- printf("uint bitmaps[992] =\n{\n");
- for (int i = 0; i < 992; i++)
- {
- printf("\t0x%.8X,\n", bitmaps[i]);
- }
- printf("};\n");
-}
-*/
-
-
-const static uint s_bitmapTable[992] =
-{
- 0x80000000,
- 0x40000000,
- 0xA0000000,
- 0x60000000,
- 0x50000000,
- 0xA8000000,
- 0x68000000,
- 0x58000000,
- 0x54000000,
- 0xAA000000,
- 0x6A000000,
- 0x5A000000,
- 0x56000000,
- 0x55000000,
- 0xAA800000,
- 0x6A800000,
- 0x5A800000,
- 0x56800000,
- 0x55800000,
- 0x55400000,
- 0xAAA00000,
- 0x6AA00000,
- 0x5AA00000,
- 0x56A00000,
- 0x55A00000,
- 0x55600000,
- 0x55500000,
- 0xAAA80000,
- 0x6AA80000,
- 0x5AA80000,
- 0x56A80000,
- 0x55A80000,
- 0x55680000,
- 0x55580000,
- 0x55540000,
- 0xAAAA0000,
- 0x6AAA0000,
- 0x5AAA0000,
- 0x56AA0000,
- 0x55AA0000,
- 0x556A0000,
- 0x555A0000,
- 0x55560000,
- 0x55550000,
- 0xAAAA8000,
- 0x6AAA8000,
- 0x5AAA8000,
- 0x56AA8000,
- 0x55AA8000,
- 0x556A8000,
- 0x555A8000,
- 0x55568000,
- 0x55558000,
- 0x55554000,
- 0xAAAAA000,
- 0x6AAAA000,
- 0x5AAAA000,
- 0x56AAA000,
- 0x55AAA000,
- 0x556AA000,
- 0x555AA000,
- 0x5556A000,
- 0x5555A000,
- 0x55556000,
- 0x55555000,
- 0xAAAAA800,
- 0x6AAAA800,
- 0x5AAAA800,
- 0x56AAA800,
- 0x55AAA800,
- 0x556AA800,
- 0x555AA800,
- 0x5556A800,
- 0x5555A800,
- 0x55556800,
- 0x55555800,
- 0x55555400,
- 0xAAAAAA00,
- 0x6AAAAA00,
- 0x5AAAAA00,
- 0x56AAAA00,
- 0x55AAAA00,
- 0x556AAA00,
- 0x555AAA00,
- 0x5556AA00,
- 0x5555AA00,
- 0x55556A00,
- 0x55555A00,
- 0x55555600,
- 0x55555500,
- 0xAAAAAA80,
- 0x6AAAAA80,
- 0x5AAAAA80,
- 0x56AAAA80,
- 0x55AAAA80,
- 0x556AAA80,
- 0x555AAA80,
- 0x5556AA80,
- 0x5555AA80,
- 0x55556A80,
- 0x55555A80,
- 0x55555680,
- 0x55555580,
- 0x55555540,
- 0xAAAAAAA0,
- 0x6AAAAAA0,
- 0x5AAAAAA0,
- 0x56AAAAA0,
- 0x55AAAAA0,
- 0x556AAAA0,
- 0x555AAAA0,
- 0x5556AAA0,
- 0x5555AAA0,
- 0x55556AA0,
- 0x55555AA0,
- 0x555556A0,
- 0x555555A0,
- 0x55555560,
- 0x55555550,
- 0xAAAAAAA8,
- 0x6AAAAAA8,
- 0x5AAAAAA8,
- 0x56AAAAA8,
- 0x55AAAAA8,
- 0x556AAAA8,
- 0x555AAAA8,
- 0x5556AAA8,
- 0x5555AAA8,
- 0x55556AA8,
- 0x55555AA8,
- 0x555556A8,
- 0x555555A8,
- 0x55555568,
- 0x55555558,
- 0x55555554,
- 0x6AAAAAAA,
- 0x5AAAAAAA,
- 0x56AAAAAA,
- 0x55AAAAAA,
- 0x556AAAAA,
- 0x555AAAAA,
- 0x5556AAAA,
- 0x5555AAAA,
- 0x55556AAA,
- 0x55555AAA,
- 0x555556AA,
- 0x555555AA,
- 0x5555556A,
- 0x5555555A,
- 0x55555556,
- 0x55555555,
- 0x55555555,
- 0x55555555,
- 0x55555555,
- 0x55555555,
- 0x55555555,
- 0x55555555,
- 0x55555555,
- 0x55555555,
- 0x55555555,
- 0xC0000000,
- 0xE0000000,
- 0xF0000000,
- 0x70000000,
- 0xE8000000,
- 0xF8000000,
- 0x78000000,
- 0xFC000000,
- 0x7C000000,
- 0x5C000000,
- 0xEA000000,
- 0xFA000000,
- 0x7A000000,
- 0xFE000000,
- 0x7E000000,
- 0x5E000000,
- 0xFF000000,
- 0x7F000000,
- 0x5F000000,
- 0x57000000,
- 0xEA800000,
- 0xFA800000,
- 0x7A800000,
- 0xFE800000,
- 0x7E800000,
- 0x5E800000,
- 0xFF800000,
- 0x7F800000,
- 0x5F800000,
- 0x57800000,
- 0xFFC00000,
- 0x7FC00000,
- 0x5FC00000,
- 0x57C00000,
- 0x55C00000,
- 0xEAA00000,
- 0xFAA00000,
- 0x7AA00000,
- 0xFEA00000,
- 0x7EA00000,
- 0x5EA00000,
- 0xFFA00000,
- 0x7FA00000,
- 0x5FA00000,
- 0x57A00000,
- 0xFFE00000,
- 0x7FE00000,
- 0x5FE00000,
- 0x57E00000,
- 0x55E00000,
- 0xFFF00000,
- 0x7FF00000,
- 0x5FF00000,
- 0x57F00000,
- 0x55F00000,
- 0x55700000,
- 0xEAA80000,
- 0xFAA80000,
- 0x7AA80000,
- 0xFEA80000,
- 0x7EA80000,
- 0x5EA80000,
- 0xFFA80000,
- 0x7FA80000,
- 0x5FA80000,
- 0x57A80000,
- 0xFFE80000,
- 0x7FE80000,
- 0x5FE80000,
- 0x57E80000,
- 0x55E80000,
- 0xFFF80000,
- 0x7FF80000,
- 0x5FF80000,
- 0x57F80000,
- 0x55F80000,
- 0x55780000,
- 0xFFFC0000,
- 0x7FFC0000,
- 0x5FFC0000,
- 0x57FC0000,
- 0x55FC0000,
- 0x557C0000,
- 0x555C0000,
- 0xEAAA0000,
- 0xFAAA0000,
- 0x7AAA0000,
- 0xFEAA0000,
- 0x7EAA0000,
- 0x5EAA0000,
- 0xFFAA0000,
- 0x7FAA0000,
- 0x5FAA0000,
- 0x57AA0000,
- 0xFFEA0000,
- 0x7FEA0000,
- 0x5FEA0000,
- 0x57EA0000,
- 0x55EA0000,
- 0xFFFA0000,
- 0x7FFA0000,
- 0x5FFA0000,
- 0x57FA0000,
- 0x55FA0000,
- 0x557A0000,
- 0xFFFE0000,
- 0x7FFE0000,
- 0x5FFE0000,
- 0x57FE0000,
- 0x55FE0000,
- 0x557E0000,
- 0x555E0000,
- 0xFFFF0000,
- 0x7FFF0000,
- 0x5FFF0000,
- 0x57FF0000,
- 0x55FF0000,
- 0x557F0000,
- 0x555F0000,
- 0x55570000,
- 0xEAAA8000,
- 0xFAAA8000,
- 0x7AAA8000,
- 0xFEAA8000,
- 0x7EAA8000,
- 0x5EAA8000,
- 0xFFAA8000,
- 0x7FAA8000,
- 0x5FAA8000,
- 0x57AA8000,
- 0xFFEA8000,
- 0x7FEA8000,
- 0x5FEA8000,
- 0x57EA8000,
- 0x55EA8000,
- 0xFFFA8000,
- 0x7FFA8000,
- 0x5FFA8000,
- 0x57FA8000,
- 0x55FA8000,
- 0x557A8000,
- 0xFFFE8000,
- 0x7FFE8000,
- 0x5FFE8000,
- 0x57FE8000,
- 0x55FE8000,
- 0x557E8000,
- 0x555E8000,
- 0xFFFF8000,
- 0x7FFF8000,
- 0x5FFF8000,
- 0x57FF8000,
- 0x55FF8000,
- 0x557F8000,
- 0x555F8000,
- 0x55578000,
- 0xFFFFC000,
- 0x7FFFC000,
- 0x5FFFC000,
- 0x57FFC000,
- 0x55FFC000,
- 0x557FC000,
- 0x555FC000,
- 0x5557C000,
- 0x5555C000,
- 0xEAAAA000,
- 0xFAAAA000,
- 0x7AAAA000,
- 0xFEAAA000,
- 0x7EAAA000,
- 0x5EAAA000,
- 0xFFAAA000,
- 0x7FAAA000,
- 0x5FAAA000,
- 0x57AAA000,
- 0xFFEAA000,
- 0x7FEAA000,
- 0x5FEAA000,
- 0x57EAA000,
- 0x55EAA000,
- 0xFFFAA000,
- 0x7FFAA000,
- 0x5FFAA000,
- 0x57FAA000,
- 0x55FAA000,
- 0x557AA000,
- 0xFFFEA000,
- 0x7FFEA000,
- 0x5FFEA000,
- 0x57FEA000,
- 0x55FEA000,
- 0x557EA000,
- 0x555EA000,
- 0xFFFFA000,
- 0x7FFFA000,
- 0x5FFFA000,
- 0x57FFA000,
- 0x55FFA000,
- 0x557FA000,
- 0x555FA000,
- 0x5557A000,
- 0xFFFFE000,
- 0x7FFFE000,
- 0x5FFFE000,
- 0x57FFE000,
- 0x55FFE000,
- 0x557FE000,
- 0x555FE000,
- 0x5557E000,
- 0x5555E000,
- 0xFFFFF000,
- 0x7FFFF000,
- 0x5FFFF000,
- 0x57FFF000,
- 0x55FFF000,
- 0x557FF000,
- 0x555FF000,
- 0x5557F000,
- 0x5555F000,
- 0x55557000,
- 0xEAAAA800,
- 0xFAAAA800,
- 0x7AAAA800,
- 0xFEAAA800,
- 0x7EAAA800,
- 0x5EAAA800,
- 0xFFAAA800,
- 0x7FAAA800,
- 0x5FAAA800,
- 0x57AAA800,
- 0xFFEAA800,
- 0x7FEAA800,
- 0x5FEAA800,
- 0x57EAA800,
- 0x55EAA800,
- 0xFFFAA800,
- 0x7FFAA800,
- 0x5FFAA800,
- 0x57FAA800,
- 0x55FAA800,
- 0x557AA800,
- 0xFFFEA800,
- 0x7FFEA800,
- 0x5FFEA800,
- 0x57FEA800,
- 0x55FEA800,
- 0x557EA800,
- 0x555EA800,
- 0xFFFFA800,
- 0x7FFFA800,
- 0x5FFFA800,
- 0x57FFA800,
- 0x55FFA800,
- 0x557FA800,
- 0x555FA800,
- 0x5557A800,
- 0xFFFFE800,
- 0x7FFFE800,
- 0x5FFFE800,
- 0x57FFE800,
- 0x55FFE800,
- 0x557FE800,
- 0x555FE800,
- 0x5557E800,
- 0x5555E800,
- 0xFFFFF800,
- 0x7FFFF800,
- 0x5FFFF800,
- 0x57FFF800,
- 0x55FFF800,
- 0x557FF800,
- 0x555FF800,
- 0x5557F800,
- 0x5555F800,
- 0x55557800,
- 0xFFFFFC00,
- 0x7FFFFC00,
- 0x5FFFFC00,
- 0x57FFFC00,
- 0x55FFFC00,
- 0x557FFC00,
- 0x555FFC00,
- 0x5557FC00,
- 0x5555FC00,
- 0x55557C00,
- 0x55555C00,
- 0xEAAAAA00,
- 0xFAAAAA00,
- 0x7AAAAA00,
- 0xFEAAAA00,
- 0x7EAAAA00,
- 0x5EAAAA00,
- 0xFFAAAA00,
- 0x7FAAAA00,
- 0x5FAAAA00,
- 0x57AAAA00,
- 0xFFEAAA00,
- 0x7FEAAA00,
- 0x5FEAAA00,
- 0x57EAAA00,
- 0x55EAAA00,
- 0xFFFAAA00,
- 0x7FFAAA00,
- 0x5FFAAA00,
- 0x57FAAA00,
- 0x55FAAA00,
- 0x557AAA00,
- 0xFFFEAA00,
- 0x7FFEAA00,
- 0x5FFEAA00,
- 0x57FEAA00,
- 0x55FEAA00,
- 0x557EAA00,
- 0x555EAA00,
- 0xFFFFAA00,
- 0x7FFFAA00,
- 0x5FFFAA00,
- 0x57FFAA00,
- 0x55FFAA00,
- 0x557FAA00,
- 0x555FAA00,
- 0x5557AA00,
- 0xFFFFEA00,
- 0x7FFFEA00,
- 0x5FFFEA00,
- 0x57FFEA00,
- 0x55FFEA00,
- 0x557FEA00,
- 0x555FEA00,
- 0x5557EA00,
- 0x5555EA00,
- 0xFFFFFA00,
- 0x7FFFFA00,
- 0x5FFFFA00,
- 0x57FFFA00,
- 0x55FFFA00,
- 0x557FFA00,
- 0x555FFA00,
- 0x5557FA00,
- 0x5555FA00,
- 0x55557A00,
- 0xFFFFFE00,
- 0x7FFFFE00,
- 0x5FFFFE00,
- 0x57FFFE00,
- 0x55FFFE00,
- 0x557FFE00,
- 0x555FFE00,
- 0x5557FE00,
- 0x5555FE00,
- 0x55557E00,
- 0x55555E00,
- 0xFFFFFF00,
- 0x7FFFFF00,
- 0x5FFFFF00,
- 0x57FFFF00,
- 0x55FFFF00,
- 0x557FFF00,
- 0x555FFF00,
- 0x5557FF00,
- 0x5555FF00,
- 0x55557F00,
- 0x55555F00,
- 0x55555700,
- 0xEAAAAA80,
- 0xFAAAAA80,
- 0x7AAAAA80,
- 0xFEAAAA80,
- 0x7EAAAA80,
- 0x5EAAAA80,
- 0xFFAAAA80,
- 0x7FAAAA80,
- 0x5FAAAA80,
- 0x57AAAA80,
- 0xFFEAAA80,
- 0x7FEAAA80,
- 0x5FEAAA80,
- 0x57EAAA80,
- 0x55EAAA80,
- 0xFFFAAA80,
- 0x7FFAAA80,
- 0x5FFAAA80,
- 0x57FAAA80,
- 0x55FAAA80,
- 0x557AAA80,
- 0xFFFEAA80,
- 0x7FFEAA80,
- 0x5FFEAA80,
- 0x57FEAA80,
- 0x55FEAA80,
- 0x557EAA80,
- 0x555EAA80,
- 0xFFFFAA80,
- 0x7FFFAA80,
- 0x5FFFAA80,
- 0x57FFAA80,
- 0x55FFAA80,
- 0x557FAA80,
- 0x555FAA80,
- 0x5557AA80,
- 0xFFFFEA80,
- 0x7FFFEA80,
- 0x5FFFEA80,
- 0x57FFEA80,
- 0x55FFEA80,
- 0x557FEA80,
- 0x555FEA80,
- 0x5557EA80,
- 0x5555EA80,
- 0xFFFFFA80,
- 0x7FFFFA80,
- 0x5FFFFA80,
- 0x57FFFA80,
- 0x55FFFA80,
- 0x557FFA80,
- 0x555FFA80,
- 0x5557FA80,
- 0x5555FA80,
- 0x55557A80,
- 0xFFFFFE80,
- 0x7FFFFE80,
- 0x5FFFFE80,
- 0x57FFFE80,
- 0x55FFFE80,
- 0x557FFE80,
- 0x555FFE80,
- 0x5557FE80,
- 0x5555FE80,
- 0x55557E80,
- 0x55555E80,
- 0xFFFFFF80,
- 0x7FFFFF80,
- 0x5FFFFF80,
- 0x57FFFF80,
- 0x55FFFF80,
- 0x557FFF80,
- 0x555FFF80,
- 0x5557FF80,
- 0x5555FF80,
- 0x55557F80,
- 0x55555F80,
- 0x55555780,
- 0xFFFFFFC0,
- 0x7FFFFFC0,
- 0x5FFFFFC0,
- 0x57FFFFC0,
- 0x55FFFFC0,
- 0x557FFFC0,
- 0x555FFFC0,
- 0x5557FFC0,
- 0x5555FFC0,
- 0x55557FC0,
- 0x55555FC0,
- 0x555557C0,
- 0x555555C0,
- 0xEAAAAAA0,
- 0xFAAAAAA0,
- 0x7AAAAAA0,
- 0xFEAAAAA0,
- 0x7EAAAAA0,
- 0x5EAAAAA0,
- 0xFFAAAAA0,
- 0x7FAAAAA0,
- 0x5FAAAAA0,
- 0x57AAAAA0,
- 0xFFEAAAA0,
- 0x7FEAAAA0,
- 0x5FEAAAA0,
- 0x57EAAAA0,
- 0x55EAAAA0,
- 0xFFFAAAA0,
- 0x7FFAAAA0,
- 0x5FFAAAA0,
- 0x57FAAAA0,
- 0x55FAAAA0,
- 0x557AAAA0,
- 0xFFFEAAA0,
- 0x7FFEAAA0,
- 0x5FFEAAA0,
- 0x57FEAAA0,
- 0x55FEAAA0,
- 0x557EAAA0,
- 0x555EAAA0,
- 0xFFFFAAA0,
- 0x7FFFAAA0,
- 0x5FFFAAA0,
- 0x57FFAAA0,
- 0x55FFAAA0,
- 0x557FAAA0,
- 0x555FAAA0,
- 0x5557AAA0,
- 0xFFFFEAA0,
- 0x7FFFEAA0,
- 0x5FFFEAA0,
- 0x57FFEAA0,
- 0x55FFEAA0,
- 0x557FEAA0,
- 0x555FEAA0,
- 0x5557EAA0,
- 0x5555EAA0,
- 0xFFFFFAA0,
- 0x7FFFFAA0,
- 0x5FFFFAA0,
- 0x57FFFAA0,
- 0x55FFFAA0,
- 0x557FFAA0,
- 0x555FFAA0,
- 0x5557FAA0,
- 0x5555FAA0,
- 0x55557AA0,
- 0xFFFFFEA0,
- 0x7FFFFEA0,
- 0x5FFFFEA0,
- 0x57FFFEA0,
- 0x55FFFEA0,
- 0x557FFEA0,
- 0x555FFEA0,
- 0x5557FEA0,
- 0x5555FEA0,
- 0x55557EA0,
- 0x55555EA0,
- 0xFFFFFFA0,
- 0x7FFFFFA0,
- 0x5FFFFFA0,
- 0x57FFFFA0,
- 0x55FFFFA0,
- 0x557FFFA0,
- 0x555FFFA0,
- 0x5557FFA0,
- 0x5555FFA0,
- 0x55557FA0,
- 0x55555FA0,
- 0x555557A0,
- 0xFFFFFFE0,
- 0x7FFFFFE0,
- 0x5FFFFFE0,
- 0x57FFFFE0,
- 0x55FFFFE0,
- 0x557FFFE0,
- 0x555FFFE0,
- 0x5557FFE0,
- 0x5555FFE0,
- 0x55557FE0,
- 0x55555FE0,
- 0x555557E0,
- 0x555555E0,
- 0xFFFFFFF0,
- 0x7FFFFFF0,
- 0x5FFFFFF0,
- 0x57FFFFF0,
- 0x55FFFFF0,
- 0x557FFFF0,
- 0x555FFFF0,
- 0x5557FFF0,
- 0x5555FFF0,
- 0x55557FF0,
- 0x55555FF0,
- 0x555557F0,
- 0x555555F0,
- 0x55555570,
- 0xEAAAAAA8,
- 0xFAAAAAA8,
- 0x7AAAAAA8,
- 0xFEAAAAA8,
- 0x7EAAAAA8,
- 0x5EAAAAA8,
- 0xFFAAAAA8,
- 0x7FAAAAA8,
- 0x5FAAAAA8,
- 0x57AAAAA8,
- 0xFFEAAAA8,
- 0x7FEAAAA8,
- 0x5FEAAAA8,
- 0x57EAAAA8,
- 0x55EAAAA8,
- 0xFFFAAAA8,
- 0x7FFAAAA8,
- 0x5FFAAAA8,
- 0x57FAAAA8,
- 0x55FAAAA8,
- 0x557AAAA8,
- 0xFFFEAAA8,
- 0x7FFEAAA8,
- 0x5FFEAAA8,
- 0x57FEAAA8,
- 0x55FEAAA8,
- 0x557EAAA8,
- 0x555EAAA8,
- 0xFFFFAAA8,
- 0x7FFFAAA8,
- 0x5FFFAAA8,
- 0x57FFAAA8,
- 0x55FFAAA8,
- 0x557FAAA8,
- 0x555FAAA8,
- 0x5557AAA8,
- 0xFFFFEAA8,
- 0x7FFFEAA8,
- 0x5FFFEAA8,
- 0x57FFEAA8,
- 0x55FFEAA8,
- 0x557FEAA8,
- 0x555FEAA8,
- 0x5557EAA8,
- 0x5555EAA8,
- 0xFFFFFAA8,
- 0x7FFFFAA8,
- 0x5FFFFAA8,
- 0x57FFFAA8,
- 0x55FFFAA8,
- 0x557FFAA8,
- 0x555FFAA8,
- 0x5557FAA8,
- 0x5555FAA8,
- 0x55557AA8,
- 0xFFFFFEA8,
- 0x7FFFFEA8,
- 0x5FFFFEA8,
- 0x57FFFEA8,
- 0x55FFFEA8,
- 0x557FFEA8,
- 0x555FFEA8,
- 0x5557FEA8,
- 0x5555FEA8,
- 0x55557EA8,
- 0x55555EA8,
- 0xFFFFFFA8,
- 0x7FFFFFA8,
- 0x5FFFFFA8,
- 0x57FFFFA8,
- 0x55FFFFA8,
- 0x557FFFA8,
- 0x555FFFA8,
- 0x5557FFA8,
- 0x5555FFA8,
- 0x55557FA8,
- 0x55555FA8,
- 0x555557A8,
- 0xFFFFFFE8,
- 0x7FFFFFE8,
- 0x5FFFFFE8,
- 0x57FFFFE8,
- 0x55FFFFE8,
- 0x557FFFE8,
- 0x555FFFE8,
- 0x5557FFE8,
- 0x5555FFE8,
- 0x55557FE8,
- 0x55555FE8,
- 0x555557E8,
- 0x555555E8,
- 0xFFFFFFF8,
- 0x7FFFFFF8,
- 0x5FFFFFF8,
- 0x57FFFFF8,
- 0x55FFFFF8,
- 0x557FFFF8,
- 0x555FFFF8,
- 0x5557FFF8,
- 0x5555FFF8,
- 0x55557FF8,
- 0x55555FF8,
- 0x555557F8,
- 0x555555F8,
- 0x55555578,
- 0xFFFFFFFC,
- 0x7FFFFFFC,
- 0x5FFFFFFC,
- 0x57FFFFFC,
- 0x55FFFFFC,
- 0x557FFFFC,
- 0x555FFFFC,
- 0x5557FFFC,
- 0x5555FFFC,
- 0x55557FFC,
- 0x55555FFC,
- 0x555557FC,
- 0x555555FC,
- 0x5555557C,
- 0x5555555C,
- 0xEAAAAAAA,
- 0xFAAAAAAA,
- 0x7AAAAAAA,
- 0xFEAAAAAA,
- 0x7EAAAAAA,
- 0x5EAAAAAA,
- 0xFFAAAAAA,
- 0x7FAAAAAA,
- 0x5FAAAAAA,
- 0x57AAAAAA,
- 0xFFEAAAAA,
- 0x7FEAAAAA,
- 0x5FEAAAAA,
- 0x57EAAAAA,
- 0x55EAAAAA,
- 0xFFFAAAAA,
- 0x7FFAAAAA,
- 0x5FFAAAAA,
- 0x57FAAAAA,
- 0x55FAAAAA,
- 0x557AAAAA,
- 0xFFFEAAAA,
- 0x7FFEAAAA,
- 0x5FFEAAAA,
- 0x57FEAAAA,
- 0x55FEAAAA,
- 0x557EAAAA,
- 0x555EAAAA,
- 0xFFFFAAAA,
- 0x7FFFAAAA,
- 0x5FFFAAAA,
- 0x57FFAAAA,
- 0x55FFAAAA,
- 0x557FAAAA,
- 0x555FAAAA,
- 0x5557AAAA,
- 0xFFFFEAAA,
- 0x7FFFEAAA,
- 0x5FFFEAAA,
- 0x57FFEAAA,
- 0x55FFEAAA,
- 0x557FEAAA,
- 0x555FEAAA,
- 0x5557EAAA,
- 0x5555EAAA,
- 0xFFFFFAAA,
- 0x7FFFFAAA,
- 0x5FFFFAAA,
- 0x57FFFAAA,
- 0x55FFFAAA,
- 0x557FFAAA,
- 0x555FFAAA,
- 0x5557FAAA,
- 0x5555FAAA,
- 0x55557AAA,
- 0xFFFFFEAA,
- 0x7FFFFEAA,
- 0x5FFFFEAA,
- 0x57FFFEAA,
- 0x55FFFEAA,
- 0x557FFEAA,
- 0x555FFEAA,
- 0x5557FEAA,
- 0x5555FEAA,
- 0x55557EAA,
- 0x55555EAA,
- 0xFFFFFFAA,
- 0x7FFFFFAA,
- 0x5FFFFFAA,
- 0x57FFFFAA,
- 0x55FFFFAA,
- 0x557FFFAA,
- 0x555FFFAA,
- 0x5557FFAA,
- 0x5555FFAA,
- 0x55557FAA,
- 0x55555FAA,
- 0x555557AA,
- 0xFFFFFFEA,
- 0x7FFFFFEA,
- 0x5FFFFFEA,
- 0x57FFFFEA,
- 0x55FFFFEA,
- 0x557FFFEA,
- 0x555FFFEA,
- 0x5557FFEA,
- 0x5555FFEA,
- 0x55557FEA,
- 0x55555FEA,
- 0x555557EA,
- 0x555555EA,
- 0xFFFFFFFA,
- 0x7FFFFFFA,
- 0x5FFFFFFA,
- 0x57FFFFFA,
- 0x55FFFFFA,
- 0x557FFFFA,
- 0x555FFFFA,
- 0x5557FFFA,
- 0x5555FFFA,
- 0x55557FFA,
- 0x55555FFA,
- 0x555557FA,
- 0x555555FA,
- 0x5555557A,
- 0xFFFFFFFE,
- 0x7FFFFFFE,
- 0x5FFFFFFE,
- 0x57FFFFFE,
- 0x55FFFFFE,
- 0x557FFFFE,
- 0x555FFFFE,
- 0x5557FFFE,
- 0x5555FFFE,
- 0x55557FFE,
- 0x55555FFE,
- 0x555557FE,
- 0x555555FE,
- 0x5555557E,
- 0x5555555E,
- 0x7FFFFFFF,
- 0x5FFFFFFF,
- 0x57FFFFFF,
- 0x55FFFFFF,
- 0x557FFFFF,
- 0x555FFFFF,
- 0x5557FFFF,
- 0x5555FFFF,
- 0x55557FFF,
- 0x55555FFF,
- 0x555557FF,
- 0x555555FF,
- 0x5555557F,
- 0x5555555F,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
- 0x55555557,
-};
-
-
-/*
-void precomp()
-{
- unsigned int bitmaps[1024];
-
- int num = 0;
-
- printf("const static uint s_bitmapTableCTX[704] =\n{\n");
-
- for (int a = 1; a <= 15; a++)
- {
- for (int b = a; b <= 15; b++)
- {
- for (int c = b; c <= 15; c++)
- {
- int indices[16];
-
- int i = 0;
- for(; i < a; i++) {
- indices[i] = 0;
- }
- for(; i < a+b; i++) {
- indices[i] = 2;
- }
- for(; i < a+b+c; i++) {
- indices[i] = 3;
- }
- for(; i < 16; i++) {
- indices[i] = 1;
- }
-
- unsigned int bm = 0;
- for(i = 0; i < 16; i++) {
- bm |= indices[i] << (i * 2);
- }
-
- printf("\t0x%8X, // %d %d %d %d\n", bm, a-0, b-a, c-b, 16-c);
-
- bitmaps[num] = bm;
- num++;
- }
- }
- }
-
- // Align to 32: 680 -> 704
- while (num < 704)
- {
- printf("\t0x80000000,\n");
-
- bitmaps[num] = 0x80000000; // 15 0 0 1;
- num++;
- }
-
- printf("}; // num = %d\n", num);
-}
-*/
-
-const static uint s_bitmapTableCTX[704] =
-{
- 0x55555578, // 1 0 0 15
- 0x555555F8, // 1 0 1 14
- 0x555557F8, // 1 0 2 13
- 0x55555FF8, // 1 0 3 12
- 0x55557FF8, // 1 0 4 11
- 0x5555FFF8, // 1 0 5 10
- 0x5557FFF8, // 1 0 6 9
- 0x555FFFF8, // 1 0 7 8
- 0x557FFFF8, // 1 0 8 7
- 0x55FFFFF8, // 1 0 9 6
- 0x57FFFFF8, // 1 0 10 5
- 0x5FFFFFF8, // 1 0 11 4
- 0x7FFFFFF8, // 1 0 12 3
- 0xFFFFFFF8, // 1 0 13 2
- 0xFFFFFFF8, // 1 0 14 1
- 0x555557E8, // 1 1 0 14
- 0x55555FE8, // 1 1 1 13
- 0x55557FE8, // 1 1 2 12
- 0x5555FFE8, // 1 1 3 11
- 0x5557FFE8, // 1 1 4 10
- 0x555FFFE8, // 1 1 5 9
- 0x557FFFE8, // 1 1 6 8
- 0x55FFFFE8, // 1 1 7 7
- 0x57FFFFE8, // 1 1 8 6
- 0x5FFFFFE8, // 1 1 9 5
- 0x7FFFFFE8, // 1 1 10 4
- 0xFFFFFFE8, // 1 1 11 3
- 0xFFFFFFE8, // 1 1 12 2
- 0xFFFFFFE8, // 1 1 13 1
- 0x55557FA8, // 1 2 0 13
- 0x5555FFA8, // 1 2 1 12
- 0x5557FFA8, // 1 2 2 11
- 0x555FFFA8, // 1 2 3 10
- 0x557FFFA8, // 1 2 4 9
- 0x55FFFFA8, // 1 2 5 8
- 0x57FFFFA8, // 1 2 6 7
- 0x5FFFFFA8, // 1 2 7 6
- 0x7FFFFFA8, // 1 2 8 5
- 0xFFFFFFA8, // 1 2 9 4
- 0xFFFFFFA8, // 1 2 10 3
- 0xFFFFFFA8, // 1 2 11 2
- 0xFFFFFFA8, // 1 2 12 1
- 0x5557FEA8, // 1 3 0 12
- 0x555FFEA8, // 1 3 1 11
- 0x557FFEA8, // 1 3 2 10
- 0x55FFFEA8, // 1 3 3 9
- 0x57FFFEA8, // 1 3 4 8
- 0x5FFFFEA8, // 1 3 5 7
- 0x7FFFFEA8, // 1 3 6 6
- 0xFFFFFEA8, // 1 3 7 5
- 0xFFFFFEA8, // 1 3 8 4
- 0xFFFFFEA8, // 1 3 9 3
- 0xFFFFFEA8, // 1 3 10 2
- 0xFFFFFEA8, // 1 3 11 1
- 0x557FFAA8, // 1 4 0 11
- 0x55FFFAA8, // 1 4 1 10
- 0x57FFFAA8, // 1 4 2 9
- 0x5FFFFAA8, // 1 4 3 8
- 0x7FFFFAA8, // 1 4 4 7
- 0xFFFFFAA8, // 1 4 5 6
- 0xFFFFFAA8, // 1 4 6 5
- 0xFFFFFAA8, // 1 4 7 4
- 0xFFFFFAA8, // 1 4 8 3
- 0xFFFFFAA8, // 1 4 9 2
- 0xFFFFFAA8, // 1 4 10 1
- 0x57FFEAA8, // 1 5 0 10
- 0x5FFFEAA8, // 1 5 1 9
- 0x7FFFEAA8, // 1 5 2 8
- 0xFFFFEAA8, // 1 5 3 7
- 0xFFFFEAA8, // 1 5 4 6
- 0xFFFFEAA8, // 1 5 5 5
- 0xFFFFEAA8, // 1 5 6 4
- 0xFFFFEAA8, // 1 5 7 3
- 0xFFFFEAA8, // 1 5 8 2
- 0xFFFFEAA8, // 1 5 9 1
- 0x7FFFAAA8, // 1 6 0 9
- 0xFFFFAAA8, // 1 6 1 8
- 0xFFFFAAA8, // 1 6 2 7
- 0xFFFFAAA8, // 1 6 3 6
- 0xFFFFAAA8, // 1 6 4 5
- 0xFFFFAAA8, // 1 6 5 4
- 0xFFFFAAA8, // 1 6 6 3
- 0xFFFFAAA8, // 1 6 7 2
- 0xFFFFAAA8, // 1 6 8 1
- 0xFFFEAAA8, // 1 7 0 8
- 0xFFFEAAA8, // 1 7 1 7
- 0xFFFEAAA8, // 1 7 2 6
- 0xFFFEAAA8, // 1 7 3 5
- 0xFFFEAAA8, // 1 7 4 4
- 0xFFFEAAA8, // 1 7 5 3
- 0xFFFEAAA8, // 1 7 6 2
- 0xFFFEAAA8, // 1 7 7 1
- 0xFFFAAAA8, // 1 8 0 7
- 0xFFFAAAA8, // 1 8 1 6
- 0xFFFAAAA8, // 1 8 2 5
- 0xFFFAAAA8, // 1 8 3 4
- 0xFFFAAAA8, // 1 8 4 3
- 0xFFFAAAA8, // 1 8 5 2
- 0xFFFAAAA8, // 1 8 6 1
- 0xFFEAAAA8, // 1 9 0 6
- 0xFFEAAAA8, // 1 9 1 5
- 0xFFEAAAA8, // 1 9 2 4
- 0xFFEAAAA8, // 1 9 3 3
- 0xFFEAAAA8, // 1 9 4 2
- 0xFFEAAAA8, // 1 9 5 1
- 0xFFAAAAA8, // 1 10 0 5
- 0xFFAAAAA8, // 1 10 1 4
- 0xFFAAAAA8, // 1 10 2 3
- 0xFFAAAAA8, // 1 10 3 2
- 0xFFAAAAA8, // 1 10 4 1
- 0xFEAAAAA8, // 1 11 0 4
- 0xFEAAAAA8, // 1 11 1 3
- 0xFEAAAAA8, // 1 11 2 2
- 0xFEAAAAA8, // 1 11 3 1
- 0xFAAAAAA8, // 1 12 0 3
- 0xFAAAAAA8, // 1 12 1 2
- 0xFAAAAAA8, // 1 12 2 1
- 0xEAAAAAA8, // 1 13 0 2
- 0xEAAAAAA8, // 1 13 1 1
- 0xAAAAAAA8, // 1 14 0 1
- 0x55555FA0, // 2 0 0 14
- 0x55557FA0, // 2 0 1 13
- 0x5555FFA0, // 2 0 2 12
- 0x5557FFA0, // 2 0 3 11
- 0x555FFFA0, // 2 0 4 10
- 0x557FFFA0, // 2 0 5 9
- 0x55FFFFA0, // 2 0 6 8
- 0x57FFFFA0, // 2 0 7 7
- 0x5FFFFFA0, // 2 0 8 6
- 0x7FFFFFA0, // 2 0 9 5
- 0xFFFFFFA0, // 2 0 10 4
- 0xFFFFFFA0, // 2 0 11 3
- 0xFFFFFFA0, // 2 0 12 2
- 0xFFFFFFA0, // 2 0 13 1
- 0x5555FEA0, // 2 1 0 13
- 0x5557FEA0, // 2 1 1 12
- 0x555FFEA0, // 2 1 2 11
- 0x557FFEA0, // 2 1 3 10
- 0x55FFFEA0, // 2 1 4 9
- 0x57FFFEA0, // 2 1 5 8
- 0x5FFFFEA0, // 2 1 6 7
- 0x7FFFFEA0, // 2 1 7 6
- 0xFFFFFEA0, // 2 1 8 5
- 0xFFFFFEA0, // 2 1 9 4
- 0xFFFFFEA0, // 2 1 10 3
- 0xFFFFFEA0, // 2 1 11 2
- 0xFFFFFEA0, // 2 1 12 1
- 0x555FFAA0, // 2 2 0 12
- 0x557FFAA0, // 2 2 1 11
- 0x55FFFAA0, // 2 2 2 10
- 0x57FFFAA0, // 2 2 3 9
- 0x5FFFFAA0, // 2 2 4 8
- 0x7FFFFAA0, // 2 2 5 7
- 0xFFFFFAA0, // 2 2 6 6
- 0xFFFFFAA0, // 2 2 7 5
- 0xFFFFFAA0, // 2 2 8 4
- 0xFFFFFAA0, // 2 2 9 3
- 0xFFFFFAA0, // 2 2 10 2
- 0xFFFFFAA0, // 2 2 11 1
- 0x55FFEAA0, // 2 3 0 11
- 0x57FFEAA0, // 2 3 1 10
- 0x5FFFEAA0, // 2 3 2 9
- 0x7FFFEAA0, // 2 3 3 8
- 0xFFFFEAA0, // 2 3 4 7
- 0xFFFFEAA0, // 2 3 5 6
- 0xFFFFEAA0, // 2 3 6 5
- 0xFFFFEAA0, // 2 3 7 4
- 0xFFFFEAA0, // 2 3 8 3
- 0xFFFFEAA0, // 2 3 9 2
- 0xFFFFEAA0, // 2 3 10 1
- 0x5FFFAAA0, // 2 4 0 10
- 0x7FFFAAA0, // 2 4 1 9
- 0xFFFFAAA0, // 2 4 2 8
- 0xFFFFAAA0, // 2 4 3 7
- 0xFFFFAAA0, // 2 4 4 6
- 0xFFFFAAA0, // 2 4 5 5
- 0xFFFFAAA0, // 2 4 6 4
- 0xFFFFAAA0, // 2 4 7 3
- 0xFFFFAAA0, // 2 4 8 2
- 0xFFFFAAA0, // 2 4 9 1
- 0xFFFEAAA0, // 2 5 0 9
- 0xFFFEAAA0, // 2 5 1 8
- 0xFFFEAAA0, // 2 5 2 7
- 0xFFFEAAA0, // 2 5 3 6
- 0xFFFEAAA0, // 2 5 4 5
- 0xFFFEAAA0, // 2 5 5 4
- 0xFFFEAAA0, // 2 5 6 3
- 0xFFFEAAA0, // 2 5 7 2
- 0xFFFEAAA0, // 2 5 8 1
- 0xFFFAAAA0, // 2 6 0 8
- 0xFFFAAAA0, // 2 6 1 7
- 0xFFFAAAA0, // 2 6 2 6
- 0xFFFAAAA0, // 2 6 3 5
- 0xFFFAAAA0, // 2 6 4 4
- 0xFFFAAAA0, // 2 6 5 3
- 0xFFFAAAA0, // 2 6 6 2
- 0xFFFAAAA0, // 2 6 7 1
- 0xFFEAAAA0, // 2 7 0 7
- 0xFFEAAAA0, // 2 7 1 6
- 0xFFEAAAA0, // 2 7 2 5
- 0xFFEAAAA0, // 2 7 3 4
- 0xFFEAAAA0, // 2 7 4 3
- 0xFFEAAAA0, // 2 7 5 2
- 0xFFEAAAA0, // 2 7 6 1
- 0xFFAAAAA0, // 2 8 0 6
- 0xFFAAAAA0, // 2 8 1 5
- 0xFFAAAAA0, // 2 8 2 4
- 0xFFAAAAA0, // 2 8 3 3
- 0xFFAAAAA0, // 2 8 4 2
- 0xFFAAAAA0, // 2 8 5 1
- 0xFEAAAAA0, // 2 9 0 5
- 0xFEAAAAA0, // 2 9 1 4
- 0xFEAAAAA0, // 2 9 2 3
- 0xFEAAAAA0, // 2 9 3 2
- 0xFEAAAAA0, // 2 9 4 1
- 0xFAAAAAA0, // 2 10 0 4
- 0xFAAAAAA0, // 2 10 1 3
- 0xFAAAAAA0, // 2 10 2 2
- 0xFAAAAAA0, // 2 10 3 1
- 0xEAAAAAA0, // 2 11 0 3
- 0xEAAAAAA0, // 2 11 1 2
- 0xEAAAAAA0, // 2 11 2 1
- 0xAAAAAAA0, // 2 12 0 2
- 0xAAAAAAA0, // 2 12 1 1
- 0xAAAAAAA0, // 2 13 0 1
- 0x5557FA80, // 3 0 0 13
- 0x555FFA80, // 3 0 1 12
- 0x557FFA80, // 3 0 2 11
- 0x55FFFA80, // 3 0 3 10
- 0x57FFFA80, // 3 0 4 9
- 0x5FFFFA80, // 3 0 5 8
- 0x7FFFFA80, // 3 0 6 7
- 0xFFFFFA80, // 3 0 7 6
- 0xFFFFFA80, // 3 0 8 5
- 0xFFFFFA80, // 3 0 9 4
- 0xFFFFFA80, // 3 0 10 3
- 0xFFFFFA80, // 3 0 11 2
- 0xFFFFFA80, // 3 0 12 1
- 0x557FEA80, // 3 1 0 12
- 0x55FFEA80, // 3 1 1 11
- 0x57FFEA80, // 3 1 2 10
- 0x5FFFEA80, // 3 1 3 9
- 0x7FFFEA80, // 3 1 4 8
- 0xFFFFEA80, // 3 1 5 7
- 0xFFFFEA80, // 3 1 6 6
- 0xFFFFEA80, // 3 1 7 5
- 0xFFFFEA80, // 3 1 8 4
- 0xFFFFEA80, // 3 1 9 3
- 0xFFFFEA80, // 3 1 10 2
- 0xFFFFEA80, // 3 1 11 1
- 0x57FFAA80, // 3 2 0 11
- 0x5FFFAA80, // 3 2 1 10
- 0x7FFFAA80, // 3 2 2 9
- 0xFFFFAA80, // 3 2 3 8
- 0xFFFFAA80, // 3 2 4 7
- 0xFFFFAA80, // 3 2 5 6
- 0xFFFFAA80, // 3 2 6 5
- 0xFFFFAA80, // 3 2 7 4
- 0xFFFFAA80, // 3 2 8 3
- 0xFFFFAA80, // 3 2 9 2
- 0xFFFFAA80, // 3 2 10 1
- 0x7FFEAA80, // 3 3 0 10
- 0xFFFEAA80, // 3 3 1 9
- 0xFFFEAA80, // 3 3 2 8
- 0xFFFEAA80, // 3 3 3 7
- 0xFFFEAA80, // 3 3 4 6
- 0xFFFEAA80, // 3 3 5 5
- 0xFFFEAA80, // 3 3 6 4
- 0xFFFEAA80, // 3 3 7 3
- 0xFFFEAA80, // 3 3 8 2
- 0xFFFEAA80, // 3 3 9 1
- 0xFFFAAA80, // 3 4 0 9
- 0xFFFAAA80, // 3 4 1 8
- 0xFFFAAA80, // 3 4 2 7
- 0xFFFAAA80, // 3 4 3 6
- 0xFFFAAA80, // 3 4 4 5
- 0xFFFAAA80, // 3 4 5 4
- 0xFFFAAA80, // 3 4 6 3
- 0xFFFAAA80, // 3 4 7 2
- 0xFFFAAA80, // 3 4 8 1
- 0xFFEAAA80, // 3 5 0 8
- 0xFFEAAA80, // 3 5 1 7
- 0xFFEAAA80, // 3 5 2 6
- 0xFFEAAA80, // 3 5 3 5
- 0xFFEAAA80, // 3 5 4 4
- 0xFFEAAA80, // 3 5 5 3
- 0xFFEAAA80, // 3 5 6 2
- 0xFFEAAA80, // 3 5 7 1
- 0xFFAAAA80, // 3 6 0 7
- 0xFFAAAA80, // 3 6 1 6
- 0xFFAAAA80, // 3 6 2 5
- 0xFFAAAA80, // 3 6 3 4
- 0xFFAAAA80, // 3 6 4 3
- 0xFFAAAA80, // 3 6 5 2
- 0xFFAAAA80, // 3 6 6 1
- 0xFEAAAA80, // 3 7 0 6
- 0xFEAAAA80, // 3 7 1 5
- 0xFEAAAA80, // 3 7 2 4
- 0xFEAAAA80, // 3 7 3 3
- 0xFEAAAA80, // 3 7 4 2
- 0xFEAAAA80, // 3 7 5 1
- 0xFAAAAA80, // 3 8 0 5
- 0xFAAAAA80, // 3 8 1 4
- 0xFAAAAA80, // 3 8 2 3
- 0xFAAAAA80, // 3 8 3 2
- 0xFAAAAA80, // 3 8 4 1
- 0xEAAAAA80, // 3 9 0 4
- 0xEAAAAA80, // 3 9 1 3
- 0xEAAAAA80, // 3 9 2 2
- 0xEAAAAA80, // 3 9 3 1
- 0xAAAAAA80, // 3 10 0 3
- 0xAAAAAA80, // 3 10 1 2
- 0xAAAAAA80, // 3 10 2 1
- 0xAAAAAA80, // 3 11 0 2
- 0xAAAAAA80, // 3 11 1 1
- 0xAAAAAA80, // 3 12 0 1
- 0x55FFAA00, // 4 0 0 12
- 0x57FFAA00, // 4 0 1 11
- 0x5FFFAA00, // 4 0 2 10
- 0x7FFFAA00, // 4 0 3 9
- 0xFFFFAA00, // 4 0 4 8
- 0xFFFFAA00, // 4 0 5 7
- 0xFFFFAA00, // 4 0 6 6
- 0xFFFFAA00, // 4 0 7 5
- 0xFFFFAA00, // 4 0 8 4
- 0xFFFFAA00, // 4 0 9 3
- 0xFFFFAA00, // 4 0 10 2
- 0xFFFFAA00, // 4 0 11 1
- 0x5FFEAA00, // 4 1 0 11
- 0x7FFEAA00, // 4 1 1 10
- 0xFFFEAA00, // 4 1 2 9
- 0xFFFEAA00, // 4 1 3 8
- 0xFFFEAA00, // 4 1 4 7
- 0xFFFEAA00, // 4 1 5 6
- 0xFFFEAA00, // 4 1 6 5
- 0xFFFEAA00, // 4 1 7 4
- 0xFFFEAA00, // 4 1 8 3
- 0xFFFEAA00, // 4 1 9 2
- 0xFFFEAA00, // 4 1 10 1
- 0xFFFAAA00, // 4 2 0 10
- 0xFFFAAA00, // 4 2 1 9
- 0xFFFAAA00, // 4 2 2 8
- 0xFFFAAA00, // 4 2 3 7
- 0xFFFAAA00, // 4 2 4 6
- 0xFFFAAA00, // 4 2 5 5
- 0xFFFAAA00, // 4 2 6 4
- 0xFFFAAA00, // 4 2 7 3
- 0xFFFAAA00, // 4 2 8 2
- 0xFFFAAA00, // 4 2 9 1
- 0xFFEAAA00, // 4 3 0 9
- 0xFFEAAA00, // 4 3 1 8
- 0xFFEAAA00, // 4 3 2 7
- 0xFFEAAA00, // 4 3 3 6
- 0xFFEAAA00, // 4 3 4 5
- 0xFFEAAA00, // 4 3 5 4
- 0xFFEAAA00, // 4 3 6 3
- 0xFFEAAA00, // 4 3 7 2
- 0xFFEAAA00, // 4 3 8 1
- 0xFFAAAA00, // 4 4 0 8
- 0xFFAAAA00, // 4 4 1 7
- 0xFFAAAA00, // 4 4 2 6
- 0xFFAAAA00, // 4 4 3 5
- 0xFFAAAA00, // 4 4 4 4
- 0xFFAAAA00, // 4 4 5 3
- 0xFFAAAA00, // 4 4 6 2
- 0xFFAAAA00, // 4 4 7 1
- 0xFEAAAA00, // 4 5 0 7
- 0xFEAAAA00, // 4 5 1 6
- 0xFEAAAA00, // 4 5 2 5
- 0xFEAAAA00, // 4 5 3 4
- 0xFEAAAA00, // 4 5 4 3
- 0xFEAAAA00, // 4 5 5 2
- 0xFEAAAA00, // 4 5 6 1
- 0xFAAAAA00, // 4 6 0 6
- 0xFAAAAA00, // 4 6 1 5
- 0xFAAAAA00, // 4 6 2 4
- 0xFAAAAA00, // 4 6 3 3
- 0xFAAAAA00, // 4 6 4 2
- 0xFAAAAA00, // 4 6 5 1
- 0xEAAAAA00, // 4 7 0 5
- 0xEAAAAA00, // 4 7 1 4
- 0xEAAAAA00, // 4 7 2 3
- 0xEAAAAA00, // 4 7 3 2
- 0xEAAAAA00, // 4 7 4 1
- 0xAAAAAA00, // 4 8 0 4
- 0xAAAAAA00, // 4 8 1 3
- 0xAAAAAA00, // 4 8 2 2
- 0xAAAAAA00, // 4 8 3 1
- 0xAAAAAA00, // 4 9 0 3
- 0xAAAAAA00, // 4 9 1 2
- 0xAAAAAA00, // 4 9 2 1
- 0xAAAAAA00, // 4 10 0 2
- 0xAAAAAA00, // 4 10 1 1
- 0xAAAAAA00, // 4 11 0 1
- 0x7FFAA800, // 5 0 0 11
- 0xFFFAA800, // 5 0 1 10
- 0xFFFAA800, // 5 0 2 9
- 0xFFFAA800, // 5 0 3 8
- 0xFFFAA800, // 5 0 4 7
- 0xFFFAA800, // 5 0 5 6
- 0xFFFAA800, // 5 0 6 5
- 0xFFFAA800, // 5 0 7 4
- 0xFFFAA800, // 5 0 8 3
- 0xFFFAA800, // 5 0 9 2
- 0xFFFAA800, // 5 0 10 1
- 0xFFEAA800, // 5 1 0 10
- 0xFFEAA800, // 5 1 1 9
- 0xFFEAA800, // 5 1 2 8
- 0xFFEAA800, // 5 1 3 7
- 0xFFEAA800, // 5 1 4 6
- 0xFFEAA800, // 5 1 5 5
- 0xFFEAA800, // 5 1 6 4
- 0xFFEAA800, // 5 1 7 3
- 0xFFEAA800, // 5 1 8 2
- 0xFFEAA800, // 5 1 9 1
- 0xFFAAA800, // 5 2 0 9
- 0xFFAAA800, // 5 2 1 8
- 0xFFAAA800, // 5 2 2 7
- 0xFFAAA800, // 5 2 3 6
- 0xFFAAA800, // 5 2 4 5
- 0xFFAAA800, // 5 2 5 4
- 0xFFAAA800, // 5 2 6 3
- 0xFFAAA800, // 5 2 7 2
- 0xFFAAA800, // 5 2 8 1
- 0xFEAAA800, // 5 3 0 8
- 0xFEAAA800, // 5 3 1 7
- 0xFEAAA800, // 5 3 2 6
- 0xFEAAA800, // 5 3 3 5
- 0xFEAAA800, // 5 3 4 4
- 0xFEAAA800, // 5 3 5 3
- 0xFEAAA800, // 5 3 6 2
- 0xFEAAA800, // 5 3 7 1
- 0xFAAAA800, // 5 4 0 7
- 0xFAAAA800, // 5 4 1 6
- 0xFAAAA800, // 5 4 2 5
- 0xFAAAA800, // 5 4 3 4
- 0xFAAAA800, // 5 4 4 3
- 0xFAAAA800, // 5 4 5 2
- 0xFAAAA800, // 5 4 6 1
- 0xEAAAA800, // 5 5 0 6
- 0xEAAAA800, // 5 5 1 5
- 0xEAAAA800, // 5 5 2 4
- 0xEAAAA800, // 5 5 3 3
- 0xEAAAA800, // 5 5 4 2
- 0xEAAAA800, // 5 5 5 1
- 0xAAAAA800, // 5 6 0 5
- 0xAAAAA800, // 5 6 1 4
- 0xAAAAA800, // 5 6 2 3
- 0xAAAAA800, // 5 6 3 2
- 0xAAAAA800, // 5 6 4 1
- 0xAAAAA800, // 5 7 0 4
- 0xAAAAA800, // 5 7 1 3
- 0xAAAAA800, // 5 7 2 2
- 0xAAAAA800, // 5 7 3 1
- 0xAAAAA800, // 5 8 0 3
- 0xAAAAA800, // 5 8 1 2
- 0xAAAAA800, // 5 8 2 1
- 0xAAAAA800, // 5 9 0 2
- 0xAAAAA800, // 5 9 1 1
- 0xAAAAA800, // 5 10 0 1
- 0xFFAAA000, // 6 0 0 10
- 0xFFAAA000, // 6 0 1 9
- 0xFFAAA000, // 6 0 2 8
- 0xFFAAA000, // 6 0 3 7
- 0xFFAAA000, // 6 0 4 6
- 0xFFAAA000, // 6 0 5 5
- 0xFFAAA000, // 6 0 6 4
- 0xFFAAA000, // 6 0 7 3
- 0xFFAAA000, // 6 0 8 2
- 0xFFAAA000, // 6 0 9 1
- 0xFEAAA000, // 6 1 0 9
- 0xFEAAA000, // 6 1 1 8
- 0xFEAAA000, // 6 1 2 7
- 0xFEAAA000, // 6 1 3 6
- 0xFEAAA000, // 6 1 4 5
- 0xFEAAA000, // 6 1 5 4
- 0xFEAAA000, // 6 1 6 3
- 0xFEAAA000, // 6 1 7 2
- 0xFEAAA000, // 6 1 8 1
- 0xFAAAA000, // 6 2 0 8
- 0xFAAAA000, // 6 2 1 7
- 0xFAAAA000, // 6 2 2 6
- 0xFAAAA000, // 6 2 3 5
- 0xFAAAA000, // 6 2 4 4
- 0xFAAAA000, // 6 2 5 3
- 0xFAAAA000, // 6 2 6 2
- 0xFAAAA000, // 6 2 7 1
- 0xEAAAA000, // 6 3 0 7
- 0xEAAAA000, // 6 3 1 6
- 0xEAAAA000, // 6 3 2 5
- 0xEAAAA000, // 6 3 3 4
- 0xEAAAA000, // 6 3 4 3
- 0xEAAAA000, // 6 3 5 2
- 0xEAAAA000, // 6 3 6 1
- 0xAAAAA000, // 6 4 0 6
- 0xAAAAA000, // 6 4 1 5
- 0xAAAAA000, // 6 4 2 4
- 0xAAAAA000, // 6 4 3 3
- 0xAAAAA000, // 6 4 4 2
- 0xAAAAA000, // 6 4 5 1
- 0xAAAAA000, // 6 5 0 5
- 0xAAAAA000, // 6 5 1 4
- 0xAAAAA000, // 6 5 2 3
- 0xAAAAA000, // 6 5 3 2
- 0xAAAAA000, // 6 5 4 1
- 0xAAAAA000, // 6 6 0 4
- 0xAAAAA000, // 6 6 1 3
- 0xAAAAA000, // 6 6 2 2
- 0xAAAAA000, // 6 6 3 1
- 0xAAAAA000, // 6 7 0 3
- 0xAAAAA000, // 6 7 1 2
- 0xAAAAA000, // 6 7 2 1
- 0xAAAAA000, // 6 8 0 2
- 0xAAAAA000, // 6 8 1 1
- 0xAAAAA000, // 6 9 0 1
- 0xFAAA8000, // 7 0 0 9
- 0xFAAA8000, // 7 0 1 8
- 0xFAAA8000, // 7 0 2 7
- 0xFAAA8000, // 7 0 3 6
- 0xFAAA8000, // 7 0 4 5
- 0xFAAA8000, // 7 0 5 4
- 0xFAAA8000, // 7 0 6 3
- 0xFAAA8000, // 7 0 7 2
- 0xFAAA8000, // 7 0 8 1
- 0xEAAA8000, // 7 1 0 8
- 0xEAAA8000, // 7 1 1 7
- 0xEAAA8000, // 7 1 2 6
- 0xEAAA8000, // 7 1 3 5
- 0xEAAA8000, // 7 1 4 4
- 0xEAAA8000, // 7 1 5 3
- 0xEAAA8000, // 7 1 6 2
- 0xEAAA8000, // 7 1 7 1
- 0xAAAA8000, // 7 2 0 7
- 0xAAAA8000, // 7 2 1 6
- 0xAAAA8000, // 7 2 2 5
- 0xAAAA8000, // 7 2 3 4
- 0xAAAA8000, // 7 2 4 3
- 0xAAAA8000, // 7 2 5 2
- 0xAAAA8000, // 7 2 6 1
- 0xAAAA8000, // 7 3 0 6
- 0xAAAA8000, // 7 3 1 5
- 0xAAAA8000, // 7 3 2 4
- 0xAAAA8000, // 7 3 3 3
- 0xAAAA8000, // 7 3 4 2
- 0xAAAA8000, // 7 3 5 1
- 0xAAAA8000, // 7 4 0 5
- 0xAAAA8000, // 7 4 1 4
- 0xAAAA8000, // 7 4 2 3
- 0xAAAA8000, // 7 4 3 2
- 0xAAAA8000, // 7 4 4 1
- 0xAAAA8000, // 7 5 0 4
- 0xAAAA8000, // 7 5 1 3
- 0xAAAA8000, // 7 5 2 2
- 0xAAAA8000, // 7 5 3 1
- 0xAAAA8000, // 7 6 0 3
- 0xAAAA8000, // 7 6 1 2
- 0xAAAA8000, // 7 6 2 1
- 0xAAAA8000, // 7 7 0 2
- 0xAAAA8000, // 7 7 1 1
- 0xAAAA8000, // 7 8 0 1
- 0xAAAA0000, // 8 0 0 8
- 0xAAAA0000, // 8 0 1 7
- 0xAAAA0000, // 8 0 2 6
- 0xAAAA0000, // 8 0 3 5
- 0xAAAA0000, // 8 0 4 4
- 0xAAAA0000, // 8 0 5 3
- 0xAAAA0000, // 8 0 6 2
- 0xAAAA0000, // 8 0 7 1
- 0xAAAA0000, // 8 1 0 7
- 0xAAAA0000, // 8 1 1 6
- 0xAAAA0000, // 8 1 2 5
- 0xAAAA0000, // 8 1 3 4
- 0xAAAA0000, // 8 1 4 3
- 0xAAAA0000, // 8 1 5 2
- 0xAAAA0000, // 8 1 6 1
- 0xAAAA0000, // 8 2 0 6
- 0xAAAA0000, // 8 2 1 5
- 0xAAAA0000, // 8 2 2 4
- 0xAAAA0000, // 8 2 3 3
- 0xAAAA0000, // 8 2 4 2
- 0xAAAA0000, // 8 2 5 1
- 0xAAAA0000, // 8 3 0 5
- 0xAAAA0000, // 8 3 1 4
- 0xAAAA0000, // 8 3 2 3
- 0xAAAA0000, // 8 3 3 2
- 0xAAAA0000, // 8 3 4 1
- 0xAAAA0000, // 8 4 0 4
- 0xAAAA0000, // 8 4 1 3
- 0xAAAA0000, // 8 4 2 2
- 0xAAAA0000, // 8 4 3 1
- 0xAAAA0000, // 8 5 0 3
- 0xAAAA0000, // 8 5 1 2
- 0xAAAA0000, // 8 5 2 1
- 0xAAAA0000, // 8 6 0 2
- 0xAAAA0000, // 8 6 1 1
- 0xAAAA0000, // 8 7 0 1
- 0xAAA80000, // 9 0 0 7
- 0xAAA80000, // 9 0 1 6
- 0xAAA80000, // 9 0 2 5
- 0xAAA80000, // 9 0 3 4
- 0xAAA80000, // 9 0 4 3
- 0xAAA80000, // 9 0 5 2
- 0xAAA80000, // 9 0 6 1
- 0xAAA80000, // 9 1 0 6
- 0xAAA80000, // 9 1 1 5
- 0xAAA80000, // 9 1 2 4
- 0xAAA80000, // 9 1 3 3
- 0xAAA80000, // 9 1 4 2
- 0xAAA80000, // 9 1 5 1
- 0xAAA80000, // 9 2 0 5
- 0xAAA80000, // 9 2 1 4
- 0xAAA80000, // 9 2 2 3
- 0xAAA80000, // 9 2 3 2
- 0xAAA80000, // 9 2 4 1
- 0xAAA80000, // 9 3 0 4
- 0xAAA80000, // 9 3 1 3
- 0xAAA80000, // 9 3 2 2
- 0xAAA80000, // 9 3 3 1
- 0xAAA80000, // 9 4 0 3
- 0xAAA80000, // 9 4 1 2
- 0xAAA80000, // 9 4 2 1
- 0xAAA80000, // 9 5 0 2
- 0xAAA80000, // 9 5 1 1
- 0xAAA80000, // 9 6 0 1
- 0xAAA00000, // 10 0 0 6
- 0xAAA00000, // 10 0 1 5
- 0xAAA00000, // 10 0 2 4
- 0xAAA00000, // 10 0 3 3
- 0xAAA00000, // 10 0 4 2
- 0xAAA00000, // 10 0 5 1
- 0xAAA00000, // 10 1 0 5
- 0xAAA00000, // 10 1 1 4
- 0xAAA00000, // 10 1 2 3
- 0xAAA00000, // 10 1 3 2
- 0xAAA00000, // 10 1 4 1
- 0xAAA00000, // 10 2 0 4
- 0xAAA00000, // 10 2 1 3
- 0xAAA00000, // 10 2 2 2
- 0xAAA00000, // 10 2 3 1
- 0xAAA00000, // 10 3 0 3
- 0xAAA00000, // 10 3 1 2
- 0xAAA00000, // 10 3 2 1
- 0xAAA00000, // 10 4 0 2
- 0xAAA00000, // 10 4 1 1
- 0xAAA00000, // 10 5 0 1
- 0xAA800000, // 11 0 0 5
- 0xAA800000, // 11 0 1 4
- 0xAA800000, // 11 0 2 3
- 0xAA800000, // 11 0 3 2
- 0xAA800000, // 11 0 4 1
- 0xAA800000, // 11 1 0 4
- 0xAA800000, // 11 1 1 3
- 0xAA800000, // 11 1 2 2
- 0xAA800000, // 11 1 3 1
- 0xAA800000, // 11 2 0 3
- 0xAA800000, // 11 2 1 2
- 0xAA800000, // 11 2 2 1
- 0xAA800000, // 11 3 0 2
- 0xAA800000, // 11 3 1 1
- 0xAA800000, // 11 4 0 1
- 0xAA000000, // 12 0 0 4
- 0xAA000000, // 12 0 1 3
- 0xAA000000, // 12 0 2 2
- 0xAA000000, // 12 0 3 1
- 0xAA000000, // 12 1 0 3
- 0xAA000000, // 12 1 1 2
- 0xAA000000, // 12 1 2 1
- 0xAA000000, // 12 2 0 2
- 0xAA000000, // 12 2 1 1
- 0xAA000000, // 12 3 0 1
- 0xA8000000, // 13 0 0 3
- 0xA8000000, // 13 0 1 2
- 0xA8000000, // 13 0 2 1
- 0xA8000000, // 13 1 0 2
- 0xA8000000, // 13 1 1 1
- 0xA8000000, // 13 2 0 1
- 0xA0000000, // 14 0 0 2
- 0xA0000000, // 14 0 1 1
- 0xA0000000, // 14 1 0 1
- 0x80000000, // 15 0 0 1
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
- 0x80000000,
-};
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CompressKernel.cu b/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CompressKernel.cu
deleted file mode 100644
index 27f237e3..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CompressKernel.cu
+++ /dev/null
@@ -1,1733 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <math.h>
-#include <float.h> // FLT_MAX
-
-#include "CudaMath.h"
-
-#include "../SingleColorLookup.h"
-
-#define NUM_THREADS 64 // Number of threads per block.
-
-#if __DEVICE_EMULATION__
-#define __debugsync() __syncthreads()
-#else
-#define __debugsync()
-#endif
-
-typedef unsigned char uchar;
-typedef unsigned short ushort;
-typedef unsigned int uint;
-
-template <class T>
-__device__ inline void swap(T & a, T & b)
-{
- T tmp = a;
- a = b;
- b = tmp;
-}
-
-__constant__ float3 kColorMetric = { 1.0f, 1.0f, 1.0f };
-__constant__ float3 kColorMetricSqr = { 1.0f, 1.0f, 1.0f };
-
-// Some kernels read the input through texture.
-texture<uchar4, 2, cudaReadModeNormalizedFloat> tex;
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Sort colors
-////////////////////////////////////////////////////////////////////////////////
-__device__ void sortColors(const float * values, int * ranks)
-{
-#if __DEVICE_EMULATION__
- if (threadIdx.x == 0)
- {
- for (int tid = 0; tid < 16; tid++)
- {
- int rank = 0;
- for (int i = 0; i < 16; i++)
- {
- rank += (values[i] < values[tid]);
- }
-
- ranks[tid] = rank;
- }
-
- // Resolve elements with the same index.
- for (int i = 0; i < 15; i++)
- {
- for (int tid = 0; tid < 16; tid++)
- {
- if (tid > i && ranks[tid] == ranks[i]) ++ranks[tid];
- }
- }
- }
-#else
- const int tid = threadIdx.x;
-
- int rank = 0;
-
- #pragma unroll
- for (int i = 0; i < 16; i++)
- {
- rank += (values[i] < values[tid]);
- }
-
- ranks[tid] = rank;
-
- // Resolve elements with the same index.
- #pragma unroll
- for (int i = 0; i < 15; i++)
- {
- if (tid > i && ranks[tid] == ranks[i]) ++ranks[tid];
- }
-#endif
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Load color block to shared mem
-////////////////////////////////////////////////////////////////////////////////
-__device__ void loadColorBlock(const uint * image, float3 colors[16], float3 sums[16], int xrefs[16], int * sameColor)
-{
- const int bid = blockIdx.x;
- const int idx = threadIdx.x;
-
- __shared__ float dps[16];
-
- if (idx < 16)
- {
- // Read color and copy to shared mem.
- uint c = image[(bid) * 16 + idx];
-
- colors[idx].z = ((c >> 0) & 0xFF) * (1.0f / 255.0f);
- colors[idx].y = ((c >> 8) & 0xFF) * (1.0f / 255.0f);
- colors[idx].x = ((c >> 16) & 0xFF) * (1.0f / 255.0f);
-
- // No need to synchronize, 16 < warp size.
- __debugsync();
-
- // Sort colors along the best fit line.
- colorSums(colors, sums);
- float3 axis = bestFitLine(colors, sums[0], kColorMetric);
-
- *sameColor = (axis == make_float3(0, 0, 0));
-
- dps[idx] = dot(colors[idx], axis);
-
- __debugsync();
-
- sortColors(dps, xrefs);
-
- float3 tmp = colors[idx];
- __debugsync();
- colors[xrefs[idx]] = tmp;
- }
-#if __DEVICE_EMULATION__
- else
- {
- __debugsync();
- __debugsync();
- __debugsync();
- }
-#endif
-}
-
-__device__ void loadColorBlockTex(uint bn, uint w, float3 colors[16], float3 sums[16], int xrefs[16], int * sameColor)
-{
- const int bid = blockIdx.x;
- const int idx = threadIdx.x;
-
- __shared__ float dps[16];
-
- if (idx < 16)
- {
- float x = 4 * ((bn + bid) % w) + idx % 4;
- float y = 4 * ((bn + bid) / w) + idx / 4;
-
- // Read color and copy to shared mem.
- float4 c = tex2D(tex, x, y);
-
- colors[idx].x = c.z;
- colors[idx].y = c.y;
- colors[idx].z = c.x;
-
- // No need to synchronize, 16 < warp size.
- __debugsync();
-
- // Sort colors along the best fit line.
- colorSums(colors, sums);
- float3 axis = bestFitLine(colors, sums[0], kColorMetric);
-
- *sameColor = (axis == make_float3(0, 0, 0));
-
- dps[idx] = dot(colors[idx], axis);
-
- __debugsync();
-
- sortColors(dps, xrefs);
-
- float3 tmp = colors[idx];
- __debugsync();
- colors[xrefs[idx]] = tmp;
- }
-#if __DEVICE_EMULATION__
- else
- {
- __debugsync();
- __debugsync();
- __debugsync();
- }
-#endif
-
-}
-
-
-__device__ void loadColorBlock(const uint * image, float3 colors[16], float3 sums[16], float weights[16], int xrefs[16], int * sameColor)
-{
- const int bid = blockIdx.x;
- const int idx = threadIdx.x;
-
- __shared__ float3 rawColors[16];
- __shared__ float dps[16];
-
- if (idx < 16)
- {
- // Read color and copy to shared mem.
- uint c = image[(bid) * 16 + idx];
-
- rawColors[idx].z = ((c >> 0) & 0xFF) * (1.0f / 255.0f);
- rawColors[idx].y = ((c >> 8) & 0xFF) * (1.0f / 255.0f);
- rawColors[idx].x = ((c >> 16) & 0xFF) * (1.0f / 255.0f);
- weights[idx] = (((c >> 24) & 0xFF) + 1) * (1.0f / 256.0f);
-
- colors[idx] = rawColors[idx] * weights[idx];
-
- // No need to synchronize, 16 < warp size.
- __debugsync();
-
- // Sort colors along the best fit line.
- colorSums(colors, sums);
- float3 axis = bestFitLine(colors, sums[0], kColorMetric);
-
- *sameColor = (axis == make_float3(0, 0, 0));
-
- dps[idx] = dot(rawColors[idx], axis);
-
- __debugsync();
-
- sortColors(dps, xrefs);
-
- float3 tmp = colors[idx];
- float w = weights[idx];
- __debugsync();
- colors[xrefs[idx]] = tmp;
- weights[xrefs[idx]] = w;
- }
-#if __DEVICE_EMULATION__
- else
- {
- __debugsync();
- __debugsync();
- __debugsync();
- }
-#endif
-}
-
-__device__ void loadColorBlock(const uint * image, float2 colors[16], float2 sums[16], int xrefs[16], int * sameColor)
-{
- const int bid = blockIdx.x;
- const int idx = threadIdx.x;
-
- __shared__ float dps[16];
-
- if (idx < 16)
- {
- // Read color and copy to shared mem.
- uint c = image[(bid) * 16 + idx];
-
- colors[idx].y = ((c >> 8) & 0xFF) * (1.0f / 255.0f);
- colors[idx].x = ((c >> 16) & 0xFF) * (1.0f / 255.0f);
-
- // No need to synchronize, 16 < warp size.
- __debugsync();
-
- // Sort colors along the best fit line.
- colorSums(colors, sums);
- float2 axis = bestFitLine(colors, sums[0]);
-
- *sameColor = (axis == make_float2(0, 0));
-
- dps[idx] = dot(colors[idx], axis);
-
- __debugsync();
-
- sortColors(dps, xrefs);
-
- float2 tmp = colors[idx];
- __debugsync();
- colors[xrefs[idx]] = tmp;
- }
-#if __DEVICE_EMULATION__
- else
- {
- __debugsync();
- __debugsync();
- __debugsync();
- }
-#endif
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Round color to RGB565 and expand
-////////////////////////////////////////////////////////////////////////////////
-inline __device__ float3 roundAndExpand565(float3 v, ushort * w)
-{
- uint x = __float2uint_rn(__saturatef(v.x) * 31.0f);
- uint y = __float2uint_rn(__saturatef(v.y) * 63.0f);
- uint z = __float2uint_rn(__saturatef(v.z) * 31.0f);
- *w = (x << 11) | (y << 5) | z;
- v.x = __uint2float_rn(x) * 1.0f / 31.0f;
- v.y = __uint2float_rn(y) * 1.0f / 63.0f;
- v.z = __uint2float_rn(z) * 1.0f / 31.0f;
- return v;
-}
-
-inline __device__ float2 roundAndExpand56(float2 v, ushort * w)
-{
- uint x = __float2uint_rn(__saturatef(v.x) * 31.0f);
- uint y = __float2uint_rn(__saturatef(v.y) * 63.0f);
- *w = (x << 11) | (y << 5);
- v.x = __uint2float_rn(x) * 1.0f / 31.0f;
- v.y = __uint2float_rn(y) * 1.0f / 63.0f;
- return v;
-}
-
-inline __device__ float2 roundAndExpand88(float2 v, ushort * w)
-{
- uint x = __float2uint_rn(__saturatef(v.x) * 255.0f);
- uint y = __float2uint_rn(__saturatef(v.y) * 255.0f);
- *w = (x << 8) | y;
- v.x = __uint2float_rn(x) * 1.0f / 255.0f;
- v.y = __uint2float_rn(y) * 1.0f / 255.0f;
- return v;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Evaluate permutations
-////////////////////////////////////////////////////////////////////////////////
-__device__ float evalPermutation4(const float3 * colors, uint permutation, ushort * start, ushort * end)
-{
- // Compute endpoints using least squares.
- float alpha2_sum = 0.0f;
- float beta2_sum = 0.0f;
- float alphabeta_sum = 0.0f;
- float3 alphax_sum = make_float3(0.0f, 0.0f, 0.0f);
- float3 betax_sum = make_float3(0.0f, 0.0f, 0.0f);
-
- // Compute alpha & beta for this permutation.
- for (int i = 0; i < 16; i++)
- {
- const uint bits = permutation >> (2*i);
-
- float beta = (bits & 1);
- if (bits & 2) beta = (1 + beta) / 3.0f;
- float alpha = 1.0f - beta;
-
- alpha2_sum += alpha * alpha;
- beta2_sum += beta * beta;
- alphabeta_sum += alpha * beta;
- alphax_sum += alpha * colors[i];
- betax_sum += beta * colors[i];
- }
-
- const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- float3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- float3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- // Round a, b to the closest 5-6-5 color and expand...
- a = roundAndExpand565(a, start);
- b = roundAndExpand565(b, end);
-
- // compute the error
- float3 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum);
-
- return dot(e, kColorMetricSqr);
-}
-
-__device__ float evalPermutation3(const float3 * colors, uint permutation, ushort * start, ushort * end)
-{
- // Compute endpoints using least squares.
- float alpha2_sum = 0.0f;
- float beta2_sum = 0.0f;
- float alphabeta_sum = 0.0f;
- float3 alphax_sum = make_float3(0.0f, 0.0f, 0.0f);
- float3 betax_sum = make_float3(0.0f, 0.0f, 0.0f);
-
- // Compute alpha & beta for this permutation.
- for (int i = 0; i < 16; i++)
- {
- const uint bits = permutation >> (2*i);
-
- float beta = (bits & 1);
- if (bits & 2) beta = 0.5f;
- float alpha = 1.0f - beta;
-
- alpha2_sum += alpha * alpha;
- beta2_sum += beta * beta;
- alphabeta_sum += alpha * beta;
- alphax_sum += alpha * colors[i];
- betax_sum += beta * colors[i];
- }
-
- const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- float3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- float3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- // Round a, b to the closest 5-6-5 color and expand...
- a = roundAndExpand565(a, start);
- b = roundAndExpand565(b, end);
-
- // compute the error
- float3 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum);
-
- return dot(e, kColorMetricSqr);
-}
-
-__constant__ const float alphaTable4[4] = { 9.0f, 0.0f, 6.0f, 3.0f };
-__constant__ const float alphaTable3[4] = { 4.0f, 0.0f, 2.0f, 2.0f };
-__constant__ const uint prods4[4] = { 0x090000,0x000900,0x040102,0x010402 };
-__constant__ const uint prods3[4] = { 0x040000,0x000400,0x040101,0x010401 };
-
-__device__ float evalPermutation4(const float3 * colors, float3 color_sum, uint permutation, ushort * start, ushort * end)
-{
- // Compute endpoints using least squares.
- float3 alphax_sum = make_float3(0.0f, 0.0f, 0.0f);
- uint akku = 0;
-
- // Compute alpha & beta for this permutation.
- #pragma unroll
- for (int i = 0; i < 16; i++)
- {
- const uint bits = permutation >> (2*i);
-
- alphax_sum += alphaTable4[bits & 3] * colors[i];
- akku += prods4[bits & 3];
- }
-
- float alpha2_sum = float(akku >> 16);
- float beta2_sum = float((akku >> 8) & 0xff);
- float alphabeta_sum = float(akku & 0xff);
- float3 betax_sum = 9.0f * color_sum - alphax_sum;
-
- const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- float3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- float3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- // Round a, b to the closest 5-6-5 color and expand...
- a = roundAndExpand565(a, start);
- b = roundAndExpand565(b, end);
-
- // compute the error
- float3 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum);
-
- return (1.0f / 9.0f) * dot(e, kColorMetricSqr);
-}
-
-__device__ float evalPermutation3(const float3 * colors, float3 color_sum, uint permutation, ushort * start, ushort * end)
-{
- // Compute endpoints using least squares.
- float3 alphax_sum = make_float3(0.0f, 0.0f, 0.0f);
- uint akku = 0;
-
- // Compute alpha & beta for this permutation.
- #pragma unroll
- for (int i = 0; i < 16; i++)
- {
- const uint bits = permutation >> (2*i);
-
- alphax_sum += alphaTable3[bits & 3] * colors[i];
- akku += prods3[bits & 3];
- }
-
- float alpha2_sum = float(akku >> 16);
- float beta2_sum = float((akku >> 8) & 0xff);
- float alphabeta_sum = float(akku & 0xff);
- float3 betax_sum = 4.0f * color_sum - alphax_sum;
-
- const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- float3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- float3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- // Round a, b to the closest 5-6-5 color and expand...
- a = roundAndExpand565(a, start);
- b = roundAndExpand565(b, end);
-
- // compute the error
- float3 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum);
-
- return (1.0f / 4.0f) * dot(e, kColorMetricSqr);
-}
-
-__device__ float evalPermutation4(const float3 * colors, const float * weights, float3 color_sum, uint permutation, ushort * start, ushort * end)
-{
- // Compute endpoints using least squares.
- float alpha2_sum = 0.0f;
- float beta2_sum = 0.0f;
- float alphabeta_sum = 0.0f;
- float3 alphax_sum = make_float3(0.0f, 0.0f, 0.0f);
-
- // Compute alpha & beta for this permutation.
- for (int i = 0; i < 16; i++)
- {
- const uint bits = permutation >> (2*i);
-
- float beta = (bits & 1);
- if (bits & 2) beta = (1 + beta) / 3.0f;
- float alpha = 1.0f - beta;
-
- alpha2_sum += alpha * alpha * weights[i];
- beta2_sum += beta * beta * weights[i];
- alphabeta_sum += alpha * beta * weights[i];
- alphax_sum += alpha * colors[i];
- }
-
- float3 betax_sum = color_sum - alphax_sum;
-
- const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- float3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- float3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- // Round a, b to the closest 5-6-5 color and expand...
- a = roundAndExpand565(a, start);
- b = roundAndExpand565(b, end);
-
- // compute the error
- float3 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum);
-
- return dot(e, kColorMetricSqr);
-}
-
-/*
-__device__ float evalPermutation3(const float3 * colors, const float * weights, uint permutation, ushort * start, ushort * end)
-{
- // Compute endpoints using least squares.
- float alpha2_sum = 0.0f;
- float beta2_sum = 0.0f;
- float alphabeta_sum = 0.0f;
- float3 alphax_sum = make_float3(0.0f, 0.0f, 0.0f);
-
- // Compute alpha & beta for this permutation.
- for (int i = 0; i < 16; i++)
- {
- const uint bits = permutation >> (2*i);
-
- float beta = (bits & 1);
- if (bits & 2) beta = 0.5f;
- float alpha = 1.0f - beta;
-
- alpha2_sum += alpha * alpha * weights[i];
- beta2_sum += beta * beta * weights[i];
- alphabeta_sum += alpha * beta * weights[i];
- alphax_sum += alpha * colors[i];
- }
-
- float3 betax_sum = color_sum - alphax_sum;
-
- const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- float3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- float3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- // Round a, b to the closest 5-6-5 color and expand...
- a = roundAndExpand565(a, start);
- b = roundAndExpand565(b, end);
-
- // compute the error
- float3 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum);
-
- return dot(e, kColorMetricSqr);
-}
-*/
-
-__device__ float evalPermutation4(const float2 * colors, float2 color_sum, uint permutation, ushort * start, ushort * end)
-{
- // Compute endpoints using least squares.
- float2 alphax_sum = make_float2(0.0f, 0.0f);
- uint akku = 0;
-
- // Compute alpha & beta for this permutation.
- #pragma unroll
- for (int i = 0; i < 16; i++)
- {
- const uint bits = permutation >> (2*i);
-
- alphax_sum += alphaTable4[bits & 3] * colors[i];
- akku += prods4[bits & 3];
- }
-
- float alpha2_sum = float(akku >> 16);
- float beta2_sum = float((akku >> 8) & 0xff);
- float alphabeta_sum = float(akku & 0xff);
- float2 betax_sum = 9.0f * color_sum - alphax_sum;
-
- const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- float2 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- float2 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- // Round a, b to the closest 5-6 color and expand...
- a = roundAndExpand56(a, start);
- b = roundAndExpand56(b, end);
-
- // compute the error
- float2 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum);
-
- return (1.0f / 9.0f) * (e.x + e.y);
-}
-
-__device__ float evalPermutation3(const float2 * colors, float2 color_sum, uint permutation, ushort * start, ushort * end)
-{
- // Compute endpoints using least squares.
- float2 alphax_sum = make_float2(0.0f, 0.0f);
- uint akku = 0;
-
- // Compute alpha & beta for this permutation.
- #pragma unroll
- for (int i = 0; i < 16; i++)
- {
- const uint bits = permutation >> (2*i);
-
- alphax_sum += alphaTable3[bits & 3] * colors[i];
- akku += prods3[bits & 3];
- }
-
- float alpha2_sum = float(akku >> 16);
- float beta2_sum = float((akku >> 8) & 0xff);
- float alphabeta_sum = float(akku & 0xff);
- float2 betax_sum = 4.0f * color_sum - alphax_sum;
-
- const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- float2 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- float2 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- // Round a, b to the closest 5-6 color and expand...
- a = roundAndExpand56(a, start);
- b = roundAndExpand56(b, end);
-
- // compute the error
- float2 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum);
-
- return (1.0f / 4.0f) * (e.x + e.y);
-}
-
-__device__ float evalPermutationCTX(const float2 * colors, float2 color_sum, uint permutation, ushort * start, ushort * end)
-{
- // Compute endpoints using least squares.
- float2 alphax_sum = make_float2(0.0f, 0.0f);
- uint akku = 0;
-
- // Compute alpha & beta for this permutation.
- #pragma unroll
- for (int i = 0; i < 16; i++)
- {
- const uint bits = permutation >> (2*i);
-
- alphax_sum += alphaTable4[bits & 3] * colors[i];
- akku += prods4[bits & 3];
- }
-
- float alpha2_sum = float(akku >> 16);
- float beta2_sum = float((akku >> 8) & 0xff);
- float alphabeta_sum = float(akku & 0xff);
- float2 betax_sum = 9.0f * color_sum - alphax_sum;
-
- const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- float2 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- float2 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- // Round a, b to the closest 8-8 color and expand...
- a = roundAndExpand88(a, start);
- b = roundAndExpand88(b, end);
-
- // compute the error
- float2 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum);
-
- return (1.0f / 9.0f) * (e.x + e.y);
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Evaluate all permutations
-////////////////////////////////////////////////////////////////////////////////
-__device__ void evalAllPermutations(const float3 * colors, float3 colorSum, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors)
-{
- const int idx = threadIdx.x;
-
- float bestError = FLT_MAX;
-
- __shared__ uint s_permutations[160];
-
- for(int i = 0; i < 16; i++)
- {
- int pidx = idx + NUM_THREADS * i;
- if (pidx >= 992) break;
-
- ushort start, end;
- uint permutation = permutations[pidx];
- if (pidx < 160) s_permutations[pidx] = permutation;
-
- float error = evalPermutation4(colors, colorSum, permutation, &start, &end);
-
- if (error < bestError)
- {
- bestError = error;
- bestPermutation = permutation;
- bestStart = start;
- bestEnd = end;
- }
- }
-
- if (bestStart < bestEnd)
- {
- swap(bestEnd, bestStart);
- bestPermutation ^= 0x55555555; // Flip indices.
- }
-
- for(int i = 0; i < 3; i++)
- {
- int pidx = idx + NUM_THREADS * i;
- if (pidx >= 160) break;
-
- ushort start, end;
- uint permutation = s_permutations[pidx];
- float error = evalPermutation3(colors, colorSum, permutation, &start, &end);
-
- if (error < bestError)
- {
- bestError = error;
- bestPermutation = permutation;
- bestStart = start;
- bestEnd = end;
-
- if (bestStart > bestEnd)
- {
- swap(bestEnd, bestStart);
- bestPermutation ^= (~bestPermutation >> 1) & 0x55555555; // Flip indices.
- }
- }
- }
-
- errors[idx] = bestError;
-}
-
-/*
-__device__ void evalAllPermutations(const float3 * colors, const float * weights, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors)
-{
- const int idx = threadIdx.x;
-
- float bestError = FLT_MAX;
-
- __shared__ uint s_permutations[160];
-
- for(int i = 0; i < 16; i++)
- {
- int pidx = idx + NUM_THREADS * i;
- if (pidx >= 992) break;
-
- ushort start, end;
- uint permutation = permutations[pidx];
- if (pidx < 160) s_permutations[pidx] = permutation;
-
- float error = evalPermutation4(colors, weights, permutation, &start, &end);
-
- if (error < bestError)
- {
- bestError = error;
- bestPermutation = permutation;
- bestStart = start;
- bestEnd = end;
- }
- }
-
- if (bestStart < bestEnd)
- {
- swap(bestEnd, bestStart);
- bestPermutation ^= 0x55555555; // Flip indices.
- }
-
- for(int i = 0; i < 3; i++)
- {
- int pidx = idx + NUM_THREADS * i;
- if (pidx >= 160) break;
-
- ushort start, end;
- uint permutation = s_permutations[pidx];
- float error = evalPermutation3(colors, weights, permutation, &start, &end);
-
- if (error < bestError)
- {
- bestError = error;
- bestPermutation = permutation;
- bestStart = start;
- bestEnd = end;
-
- if (bestStart > bestEnd)
- {
- swap(bestEnd, bestStart);
- bestPermutation ^= (~bestPermutation >> 1) & 0x55555555; // Flip indices.
- }
- }
- }
-
- errors[idx] = bestError;
-}
-*/
-
-__device__ void evalAllPermutations(const float2 * colors, float2 colorSum, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors)
-{
- const int idx = threadIdx.x;
-
- float bestError = FLT_MAX;
-
- __shared__ uint s_permutations[160];
-
- for(int i = 0; i < 16; i++)
- {
- int pidx = idx + NUM_THREADS * i;
- if (pidx >= 992) break;
-
- ushort start, end;
- uint permutation = permutations[pidx];
- if (pidx < 160) s_permutations[pidx] = permutation;
-
- float error = evalPermutation4(colors, colorSum, permutation, &start, &end);
-
- if (error < bestError)
- {
- bestError = error;
- bestPermutation = permutation;
- bestStart = start;
- bestEnd = end;
- }
- }
-
- if (bestStart < bestEnd)
- {
- swap(bestEnd, bestStart);
- bestPermutation ^= 0x55555555; // Flip indices.
- }
-
- for(int i = 0; i < 3; i++)
- {
- int pidx = idx + NUM_THREADS * i;
- if (pidx >= 160) break;
-
- ushort start, end;
- uint permutation = s_permutations[pidx];
- float error = evalPermutation3(colors, colorSum, permutation, &start, &end);
-
- if (error < bestError)
- {
- bestError = error;
- bestPermutation = permutation;
- bestStart = start;
- bestEnd = end;
-
- if (bestStart > bestEnd)
- {
- swap(bestEnd, bestStart);
- bestPermutation ^= (~bestPermutation >> 1) & 0x55555555; // Flip indices.
- }
- }
- }
-
- errors[idx] = bestError;
-}
-
-__device__ void evalLevel4Permutations(const float3 * colors, float3 colorSum, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors)
-{
- const int idx = threadIdx.x;
-
- float bestError = FLT_MAX;
-
- for(int i = 0; i < 16; i++)
- {
- int pidx = idx + NUM_THREADS * i;
- if (pidx >= 992) break;
-
- ushort start, end;
- uint permutation = permutations[pidx];
-
- float error = evalPermutation4(colors, colorSum, permutation, &start, &end);
-
- if (error < bestError)
- {
- bestError = error;
- bestPermutation = permutation;
- bestStart = start;
- bestEnd = end;
- }
- }
-
- if (bestStart < bestEnd)
- {
- swap(bestEnd, bestStart);
- bestPermutation ^= 0x55555555; // Flip indices.
- }
-
- errors[idx] = bestError;
-}
-
-__device__ void evalLevel4Permutations(const float3 * colors, const float * weights, float3 colorSum, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors)
-{
- const int idx = threadIdx.x;
-
- float bestError = FLT_MAX;
-
- for(int i = 0; i < 16; i++)
- {
- int pidx = idx + NUM_THREADS * i;
- if (pidx >= 992) break;
-
- ushort start, end;
- uint permutation = permutations[pidx];
-
- float error = evalPermutation4(colors, weights, colorSum, permutation, &start, &end);
-
- if (error < bestError)
- {
- bestError = error;
- bestPermutation = permutation;
- bestStart = start;
- bestEnd = end;
- }
- }
-
- if (bestStart < bestEnd)
- {
- swap(bestEnd, bestStart);
- bestPermutation ^= 0x55555555; // Flip indices.
- }
-
- errors[idx] = bestError;
-}
-
-__device__ void evalAllPermutationsCTX(const float2 * colors, float2 colorSum, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors)
-{
- const int idx = threadIdx.x;
-
- float bestError = FLT_MAX;
-
- for(int i = 0; i < 16; i++)
- {
- int pidx = idx + NUM_THREADS * i;
- if (pidx >= 704) break;
-
- ushort start, end;
- uint permutation = permutations[pidx];
-
- float error = evalPermutationCTX(colors, colorSum, permutation, &start, &end);
-
- if (error < bestError)
- {
- bestError = error;
- bestPermutation = permutation;
- bestStart = start;
- bestEnd = end;
- }
- }
-
- if (bestStart < bestEnd)
- {
- swap(bestEnd, bestStart);
- bestPermutation ^= 0x55555555; // Flip indices.
- }
-
- errors[idx] = bestError;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Find index with minimum error
-////////////////////////////////////////////////////////////////////////////////
-__device__ int findMinError(float * errors)
-{
- const int idx = threadIdx.x;
-
- __shared__ int indices[NUM_THREADS];
- indices[idx] = idx;
-
-#if __DEVICE_EMULATION__
- for(int d = NUM_THREADS/2; d > 0; d >>= 1)
- {
- __syncthreads();
-
- if (idx < d)
- {
- float err0 = errors[idx];
- float err1 = errors[idx + d];
-
- if (err1 < err0) {
- errors[idx] = err1;
- indices[idx] = indices[idx + d];
- }
- }
- }
-#else
- for(int d = NUM_THREADS/2; d > 32; d >>= 1)
- {
- __syncthreads();
-
- if (idx < d)
- {
- float err0 = errors[idx];
- float err1 = errors[idx + d];
-
- if (err1 < err0) {
- errors[idx] = err1;
- indices[idx] = indices[idx + d];
- }
- }
- }
-
- __syncthreads();
-
- // unroll last 6 iterations
- if (idx < 32)
- {
- if (errors[idx + 32] < errors[idx]) {
- errors[idx] = errors[idx + 32];
- indices[idx] = indices[idx + 32];
- }
- if (errors[idx + 16] < errors[idx]) {
- errors[idx] = errors[idx + 16];
- indices[idx] = indices[idx + 16];
- }
- if (errors[idx + 8] < errors[idx]) {
- errors[idx] = errors[idx + 8];
- indices[idx] = indices[idx + 8];
- }
- if (errors[idx + 4] < errors[idx]) {
- errors[idx] = errors[idx + 4];
- indices[idx] = indices[idx + 4];
- }
- if (errors[idx + 2] < errors[idx]) {
- errors[idx] = errors[idx + 2];
- indices[idx] = indices[idx + 2];
- }
- if (errors[idx + 1] < errors[idx]) {
- errors[idx] = errors[idx + 1];
- indices[idx] = indices[idx + 1];
- }
- }
-#endif
-
- __syncthreads();
-
- return indices[0];
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Save DXT block
-////////////////////////////////////////////////////////////////////////////////
-__device__ void saveBlockDXT1(ushort start, ushort end, uint permutation, int xrefs[16], uint2 * result)
-{
- const int bid = blockIdx.x;
-
- if (start == end)
- {
- permutation = 0;
- }
-
- // Reorder permutation.
- uint indices = 0;
- for(int i = 0; i < 16; i++)
- {
- int ref = xrefs[i];
- indices |= ((permutation >> (2 * ref)) & 3) << (2 * i);
- }
-
- // Write endpoints.
- result[bid].x = (end << 16) | start;
-
- // Write palette indices.
- result[bid].y = indices;
-}
-
-__device__ void saveBlockCTX1(ushort start, ushort end, uint permutation, int xrefs[16], uint2 * result)
-{
- saveBlockDXT1(start, end, permutation, xrefs, result);
-}
-
-__device__ void saveSingleColorBlockDXT1(float3 color, uint2 * result)
-{
- const int bid = blockIdx.x;
-
- int r = color.x * 255;
- int g = color.y * 255;
- int b = color.z * 255;
-
- ushort color0 = (OMatch5[r][0] << 11) | (OMatch6[g][0] << 5) | OMatch5[b][0];
- ushort color1 = (OMatch5[r][1] << 11) | (OMatch6[g][1] << 5) | OMatch5[b][1];
-
- if (color0 < color1)
- {
- result[bid].x = (color0 << 16) | color1;
- result[bid].y = 0xffffffff;
- }
- else
- {
- result[bid].x = (color1 << 16) | color0;
- result[bid].y = 0xaaaaaaaa;
- }
-}
-
-__device__ void saveSingleColorBlockDXT1(float2 color, uint2 * result)
-{
- const int bid = blockIdx.x;
-
- int r = color.x * 255;
- int g = color.y * 255;
-
- ushort color0 = (OMatch5[r][0] << 11) | (OMatch6[g][0] << 5);
- ushort color1 = (OMatch5[r][1] << 11) | (OMatch6[g][1] << 5);
-
- if (color0 < color1)
- {
- result[bid].x = (color0 << 16) | color1;
- result[bid].y = 0xffffffff;
- }
- else
- {
- result[bid].x = (color1 << 16) | color0;
- result[bid].y = 0xaaaaaaaa;
- }
-}
-
-__device__ void saveSingleColorBlockCTX1(float2 color, uint2 * result)
-{
- const int bid = blockIdx.x;
-
- int r = color.x * 255;
- int g = color.y * 255;
-
- ushort color0 = (r << 8) | (g);
-
- result[bid].x = (color0 << 16) | color0;
- result[bid].y = 0x00000000;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Compress color block
-////////////////////////////////////////////////////////////////////////////////
-__global__ void compressDXT1(const uint * permutations, const uint * image, uint2 * result)
-{
- __shared__ float3 colors[16];
- __shared__ float3 sums[16];
- __shared__ int xrefs[16];
- __shared__ int sameColor;
-
- loadColorBlock(image, colors, sums, xrefs, &sameColor);
-
- __syncthreads();
-
- if (sameColor)
- {
- if (threadIdx.x == 0) saveSingleColorBlockDXT1(colors[0], result);
- return;
- }
-
- ushort bestStart, bestEnd;
- uint bestPermutation;
-
- __shared__ float errors[NUM_THREADS];
-
- evalAllPermutations(colors, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors);
-
- // Use a parallel reduction to find minimum error.
- const int minIdx = findMinError(errors);
-
- // Only write the result of the winner thread.
- if (threadIdx.x == minIdx)
- {
- saveBlockDXT1(bestStart, bestEnd, bestPermutation, xrefs, result);
- }
-}
-
-__global__ void compressDXT1_Tex(uint bn, uint w, const uint * permutations, uint2 * result)
-{
- __shared__ float3 colors[16];
- __shared__ float3 sums[16];
- __shared__ int xrefs[16];
- __shared__ int sameColor;
-
- loadColorBlockTex(bn, w, colors, sums, xrefs, &sameColor);
-
- __syncthreads();
-
- if (sameColor)
- {
- if (threadIdx.x == 0) saveSingleColorBlockDXT1(colors[0], result);
- return;
- }
-
- ushort bestStart, bestEnd;
- uint bestPermutation;
-
- __shared__ float errors[NUM_THREADS];
-
- evalAllPermutations(colors, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors);
-
- // Use a parallel reduction to find minimum error.
- const int minIdx = findMinError(errors);
-
- // Only write the result of the winner thread.
- if (threadIdx.x == minIdx)
- {
- saveBlockDXT1(bestStart, bestEnd, bestPermutation, xrefs, result);
- }
-}
-
-
-__global__ void compressLevel4DXT1(const uint * permutations, const uint * image, uint2 * result)
-{
- __shared__ float3 colors[16];
- __shared__ float3 sums[16];
- __shared__ int xrefs[16];
- __shared__ int sameColor;
-
- loadColorBlock(image, colors, sums, xrefs, &sameColor);
-
- __syncthreads();
-
- if (sameColor)
- {
- if (threadIdx.x == 0) saveSingleColorBlockDXT1(colors[0], result);
- return;
- }
-
- ushort bestStart, bestEnd;
- uint bestPermutation;
-
- __shared__ float errors[NUM_THREADS];
-
- evalLevel4Permutations(colors, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors);
-
- // Use a parallel reduction to find minimum error.
- const int minIdx = findMinError(errors);
-
- // Only write the result of the winner thread.
- if (threadIdx.x == minIdx)
- {
- saveBlockDXT1(bestStart, bestEnd, bestPermutation, xrefs, result);
- }
-}
-
-__global__ void compressWeightedDXT1(const uint * permutations, const uint * image, uint2 * result)
-{
- __shared__ float3 colors[16];
- __shared__ float3 sums[16];
- __shared__ float weights[16];
- __shared__ int xrefs[16];
- __shared__ int sameColor;
-
- loadColorBlock(image, colors, sums, weights, xrefs, &sameColor);
-
- __syncthreads();
-
- if (sameColor)
- {
- if (threadIdx.x == 0) saveSingleColorBlockDXT1(colors[0], result);
- return;
- }
-
- ushort bestStart, bestEnd;
- uint bestPermutation;
-
- __shared__ float errors[NUM_THREADS];
-
- evalLevel4Permutations(colors, weights, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors);
-
- // Use a parallel reduction to find minimum error.
- int minIdx = findMinError(errors);
-
- // Only write the result of the winner thread.
- if (threadIdx.x == minIdx)
- {
- saveBlockDXT1(bestStart, bestEnd, bestPermutation, xrefs, result);
- }
-}
-
-
-__global__ void compressNormalDXT1(const uint * permutations, const uint * image, uint2 * result)
-{
- __shared__ float2 colors[16];
- __shared__ float2 sums[16];
- __shared__ int xrefs[16];
- __shared__ int sameColor;
-
- loadColorBlock(image, colors, sums, xrefs, &sameColor);
-
- __syncthreads();
-
- if (sameColor)
- {
- if (threadIdx.x == 0) saveSingleColorBlockDXT1(colors[0], result);
- return;
- }
-
- ushort bestStart, bestEnd;
- uint bestPermutation;
-
- __shared__ float errors[NUM_THREADS];
-
- evalAllPermutations(colors, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors);
-
- // Use a parallel reduction to find minimum error.
- const int minIdx = findMinError(errors);
-
- // Only write the result of the winner thread.
- if (threadIdx.x == minIdx)
- {
- saveBlockDXT1(bestStart, bestEnd, bestPermutation, xrefs, result);
- }
-}
-
-__global__ void compressCTX1(const uint * permutations, const uint * image, uint2 * result)
-{
- __shared__ float2 colors[16];
- __shared__ float2 sums[16];
- __shared__ int xrefs[16];
- __shared__ int sameColor;
-
- loadColorBlock(image, colors, sums, xrefs, &sameColor);
-
- __syncthreads();
-
- if (sameColor)
- {
- if (threadIdx.x == 0) saveSingleColorBlockCTX1(colors[0], result);
- return;
- }
-
- ushort bestStart, bestEnd;
- uint bestPermutation;
-
- __shared__ float errors[NUM_THREADS];
-
- evalAllPermutationsCTX(colors, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors);
-
- // Use a parallel reduction to find minimum error.
- const int minIdx = findMinError(errors);
-
- // Only write the result of the winner thread.
- if (threadIdx.x == minIdx)
- {
- saveBlockCTX1(bestStart, bestEnd, bestPermutation, xrefs, result);
- }
-}
-
-
-/*
-__device__ float computeError(const float weights[16], uchar a0, uchar a1)
-{
- float palette[6];
- palette[0] = (6.0f/7.0f * a0 + 1.0f/7.0f * a1);
- palette[1] = (5.0f/7.0f * a0 + 2.0f/7.0f * a1);
- palette[2] = (4.0f/7.0f * a0 + 3.0f/7.0f * a1);
- palette[3] = (3.0f/7.0f * a0 + 4.0f/7.0f * a1);
- palette[4] = (2.0f/7.0f * a0 + 5.0f/7.0f * a1);
- palette[5] = (1.0f/7.0f * a0 + 6.0f/7.0f * a1);
-
- float total = 0.0f;
-
- for (uint i = 0; i < 16; i++)
- {
- float alpha = weights[i];
-
- float error = a0 - alpha;
- error = min(error, palette[0] - alpha);
- error = min(error, palette[1] - alpha);
- error = min(error, palette[2] - alpha);
- error = min(error, palette[3] - alpha);
- error = min(error, palette[4] - alpha);
- error = min(error, palette[5] - alpha);
- error = min(error, a1 - alpha);
-
- total += error;
- }
-
- return total;
-}
-
-inline __device__ uchar roundAndExpand(float a)
-{
- return rintf(__saturatef(a) * 255.0f);
-}
-*/
-/*
-__device__ void optimizeAlpha8(const float alphas[16], uchar & a0, uchar & a1)
-{
- float alpha2_sum = 0;
- float beta2_sum = 0;
- float alphabeta_sum = 0;
- float alphax_sum = 0;
- float betax_sum = 0;
-
- for (int i = 0; i < 16; i++)
- {
- uint idx = index[i];
- float alpha;
- if (idx < 2) alpha = 1.0f - idx;
- else alpha = (8.0f - idx) / 7.0f;
-
- float beta = 1 - alpha;
-
- alpha2_sum += alpha * alpha;
- beta2_sum += beta * beta;
- alphabeta_sum += alpha * beta;
- alphax_sum += alpha * alphas[i];
- betax_sum += beta * alphas[i];
- }
-
- const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- float a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor;
- float b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor;
-
- a0 = roundAndExpand8(a);
- a1 = roundAndExpand8(b);
-}
-*/
-/*
-__device__ void compressAlpha(const float alphas[16], uint4 * result)
-{
- const int tid = threadIdx.x;
-
- // Compress alpha block!
- // Brute force approach:
- // Try all color pairs: 256*256/2 = 32768, 32768/64 = 512 iterations?
-
- // Determine min & max alphas
-
- float A0, A1;
-
- if (tid < 16)
- {
- __shared__ uint s_alphas[16];
-
- s_alphas[tid] = alphas[tid];
- s_alphas[tid] = min(s_alphas[tid], s_alphas[tid^8]);
- s_alphas[tid] = min(s_alphas[tid], s_alphas[tid^4]);
- s_alphas[tid] = min(s_alphas[tid], s_alphas[tid^2]);
- s_alphas[tid] = min(s_alphas[tid], s_alphas[tid^1]);
- A0 = s_alphas[tid];
-
- s_alphas[tid] = alphas[tid];
- s_alphas[tid] = max(s_alphas[tid], s_alphas[tid^8]);
- s_alphas[tid] = max(s_alphas[tid], s_alphas[tid^4]);
- s_alphas[tid] = max(s_alphas[tid], s_alphas[tid^2]);
- s_alphas[tid] = max(s_alphas[tid], s_alphas[tid^1]);
- A1 = s_alphas[tid];
- }
-
- __syncthreads();
-
- int minIdx = 0;
-
- if (A1 - A0 > 8)
- {
- float bestError = FLT_MAX;
-
- // 64 threads -> 8x8
- // divide [A1-A0] in partitions.
- // test endpoints
-
- for (int i = 0; i < 128; i++)
- {
- uint idx = (i * NUM_THREADS + tid) * 4;
- uchar a0 = idx & 255;
- uchar a1 = idx >> 8;
-
- float error = computeError(alphas, a0, a1);
-
- if (error < bestError)
- {
- bestError = error;
- A0 = a0;
- A1 = a1;
- }
- }
-
- __shared__ float errors[NUM_THREADS];
- errors[tid] = bestError;
-
- // Minimize error.
- minIdx = findMinError(errors);
-
- }
-
- if (minIdx == tid)
- {
- // @@ Compute indices.
-
- // @@ Write alpha block.
- }
-}
-
-__global__ void compressDXT5(const uint * permutations, const uint * image, uint4 * result)
-{
- __shared__ float3 colors[16];
- __shared__ float3 sums[16];
- __shared__ float weights[16];
- __shared__ int xrefs[16];
-
- loadColorBlock(image, colors, sums, weights, xrefs);
-
- __syncthreads();
-
- compressAlpha(weights, result);
-
- ushort bestStart, bestEnd;
- uint bestPermutation;
-
- __shared__ float errors[NUM_THREADS];
-
- evalLevel4Permutations(colors, weights, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors);
-
- // Use a parallel reduction to find minimum error.
- int minIdx = findMinError(errors);
-
- // Only write the result of the winner thread.
- if (threadIdx.x == minIdx)
- {
- saveBlockDXT1(bestStart, bestEnd, bestPermutation, xrefs, (uint2 *)result);
- }
-}
-*/
-
-/*__device__ void evaluatePalette(uint alpha0, uint alpha1, uint alphas[8])
-{
- alpha[0] = alpha0;
- alpha[1] = alpha1;
- alpha[2] = (6 * alpha[0] + 1 * alpha[1]) / 7; // bit code 010
- alpha[3] = (5 * alpha[0] + 2 * alpha[1]) / 7; // bit code 011
- alpha[4] = (4 * alpha[0] + 3 * alpha[1]) / 7; // bit code 100
- alpha[5] = (3 * alpha[0] + 4 * alpha[1]) / 7; // bit code 101
- alpha[6] = (2 * alpha[0] + 5 * alpha[1]) / 7; // bit code 110
- alpha[7] = (1 * alpha[0] + 6 * alpha[1]) / 7; // bit code 111
-}
-
-__device__ uint computeAlphaError(const uint block[16], uint alpha0, uint alpha1, int bestError = INT_MAX)
-{
- uint8 alphas[8];
- evaluatePalette(alpha0, alpha1, alphas);
-
- int totalError = 0;
-
- for (uint i = 0; i < 16; i++)
- {
- uint8 alpha = block[i];
-
- // @@ It should be possible to do this much faster.
-
- int minDist = INT_MAX;
- for (uint p = 0; p < 8; p++)
- {
- int dist = alphaDistance(alpha, alphas[p]);
- minDist = min(dist, minDist);
- }
-
-
-
- totalError += minDist;
-
- if (totalError > bestError)
- {
- // early out
- return totalError;
- }
- }
-
- return totalError;
-}
-
-
-void compressDXT5A(uint alpha[16])
-{
- // Get min/max alpha.
- for (uint i = 0; i < 16; i++)
- {
- mina = min(mina, alpha[i]);
- maxa = max(maxa, alpha[i]);
- }
-
- dxtBlock->alpha0 = maxa;
- dxtBlock->alpha1 = mina;
-
- if (maxa - mina > 8)
- {
- int besterror = computeAlphaError(rgba, dxtBlock);
- int besta0 = maxa;
- int besta1 = mina;
-
- // Expand search space a bit.
- const int alphaExpand = 8;
- mina = (mina <= alphaExpand) ? 0 : mina - alphaExpand;
- maxa = (maxa <= 255-alphaExpand) ? 255 : maxa + alphaExpand;
-
- for (int a0 = mina+9; a0 < maxa; a0++)
- {
- for (int a1 = mina; a1 < a0-8; a1++)
- {
- nvDebugCheck(a0 - a1 > 8);
-
- dxtBlock->alpha0 = a0;
- dxtBlock->alpha1 = a1;
- int error = computeAlphaError(rgba, dxtBlock, besterror);
-
- if (error < besterror)
- {
- besterror = error;
- besta0 = a0;
- besta1 = a1;
- }
- }
- }
-
- dxtBlock->alpha0 = besta0;
- dxtBlock->alpha1 = besta1;
- }
-}
-
-__global__ void compressDXT5n(uint blockNum, uint2 * d_result)
-{
- uint idx = blockIdx.x * 128 + threadIdx.x;
-
- if (idx >= blockNum)
- {
- return;
- }
-
- // @@ Ideally we would load the data to shared mem to achieve coalesced global mem access.
- // @@ Blocks would require too much shared memory (8k) and limit occupancy.
-
- // @@ Ideally we should use SIMD processing, multiple threads (4-8) processing the same block.
- // That simplifies coalescing, and reduces divergence.
-
- // @@ Experiment with texture. That's probably the most simple approach.
-
- uint x[16];
- uint y[16];
-
-
-}
-*/
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Setup kernel
-////////////////////////////////////////////////////////////////////////////////
-
-extern "C" void setupCompressKernel(const float weights[3])
-{
- // Set constants.
- cudaMemcpyToSymbol(kColorMetric, weights, sizeof(float) * 3, 0);
-
- float weightsSqr[3];
- weightsSqr[0] = weights[0] * weights[0];
- weightsSqr[1] = weights[1] * weights[1];
- weightsSqr[2] = weights[2] * weights[2];
-
- cudaMemcpyToSymbol(kColorMetricSqr, weightsSqr, sizeof(float) * 3, 0);
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Launch kernel
-////////////////////////////////////////////////////////////////////////////////
-
-extern "C" void compressKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps)
-{
- compressDXT1<<<blockNum, NUM_THREADS>>>(d_bitmaps, d_data, (uint2 *)d_result);
-}
-
-extern "C" void compressKernelDXT1_Tex(uint bn, uint blockNum, uint w, cudaArray * d_data, uint * d_result, uint * d_bitmaps)
-{
- // Setup texture
- tex.normalized = false;
- tex.filterMode = cudaFilterModePoint;
- tex.addressMode[0] = cudaAddressModeClamp;
- tex.addressMode[1] = cudaAddressModeClamp;
-
- cudaBindTextureToArray(tex, d_data);
-
- compressDXT1_Tex<<<blockNum, NUM_THREADS>>>(bn, w, d_bitmaps, (uint2 *)d_result);
-}
-
-
-extern "C" void compressKernelDXT1_Level4(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps)
-{
- compressLevel4DXT1<<<blockNum, NUM_THREADS>>>(d_bitmaps, d_data, (uint2 *)d_result);
-}
-
-extern "C" void compressWeightedKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps)
-{
- compressWeightedDXT1<<<blockNum, NUM_THREADS>>>(d_bitmaps, d_data, (uint2 *)d_result);
-}
-
-extern "C" void compressNormalKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps)
-{
- compressNormalDXT1<<<blockNum, NUM_THREADS>>>(d_bitmaps, d_data, (uint2 *)d_result);
-}
-
-extern "C" void compressKernelCTX1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps)
-{
- compressCTX1<<<blockNum, NUM_THREADS>>>(d_bitmaps, d_data, (uint2 *)d_result);
-}
-
-extern "C" void compressKernelDXT5n(uint blockNum, cudaArray * d_data, uint * d_result)
-{
- // Setup texture
- tex.normalized = false;
- tex.filterMode = cudaFilterModePoint;
- tex.addressMode[0] = cudaAddressModeClamp;
- tex.addressMode[1] = cudaAddressModeClamp;
-
- cudaBindTextureToArray(tex, d_data);
-
-// compressDXT5n<<<blockNum/128, 128>>>(blockNum, (uint2 *)d_result);
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/ConvolveKernel.cu b/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/ConvolveKernel.cu
deleted file mode 100644
index 35f684da..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/ConvolveKernel.cu
+++ /dev/null
@@ -1,264 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include "CudaMath.h"
-
-#define TW 16
-#define TH 16
-
-#define THREAD_COUNT (TW * TH)
-
-#define MAX_KERNEL_WIDTH 32
-
-#define KW 4
-
-
-
-#if __DEVICE_EMULATION__
-#define __debugsync() __syncthreads()
-#else
-#define __debugsync()
-#endif
-
-#define TN 256
-#define WARP_COUNT (TN / 32)
-#define HWARP_COUNT (TN / 16)
-
-// Window size
-#define WS 20
-
-
-
-struct WrapClamp
-{
- int operator()(int i, int h)
- {
- i = min(max(i, 0), h-1);
- }
-};
-
-struct WrapRepeat
-{
- int operator()(int i, int h)
- {
- i = abs(i) % h; // :( Non power of two!
- }
-};
-
-struct WrapMirror
-{
- int operator()(int i, int h)
- {
- i = abs(i);
- while (i >= h) i = 2 * w - i - 2;
- }
-};
-
-
-// Vertical convolution filter that processes vertical strips.
-__global__ void convolveStrip(float * d_channel, float * d_kernel, int width, int height)
-{
- __shared__ float s_kernel[32 * WS];
-
- // Preload kernel in shared memory.
- for (int i = 0; i < 32 * WS / TN; i++)
- {
- int idx = i * TN + tid;
- if (idx < 32 * WS) s_kernel[idx] = d_kernel[idx];
- }
-
- __shared__ float s_strip[32 * WS]; // TN/32
-
- int wid = tid / 32 - WS/2;
-
- Mirror wrap;
- int row = wrap(wid);
-
- // Preload image block.
- for (int i = 0; i < 32 * WS / TN; i++)
- {
- }
-
- // @@ Apply kernel to TN/32 rows.
-
- // @@ Load
-
-
-}
-
-
-
-
-
-
-__constant__ float inputGamma, outputInverseGamma;
-__constant__ float kernel[MAX_KERNEL_WIDTH];
-
-// Use texture to access input?
-// That's the most simple approach.
-
-texture<> image;
-
-////////////////////////////////////////////////////////////////////////////////
-// Combined convolution filter
-////////////////////////////////////////////////////////////////////////////////
-
-__global__ void convolve(float4 * output)
-{
- // @@ Use morton order to assing threads.
- int x = threadIdx.x;
- int y = threadIdx.y;
-
- float4 color = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
-
- // texture coordinate.
- int2 t;
- t.x = 2 * (blockIdx.x * TW + x) - HW;
- t.y = blockIdx.y * TH + y;
-
- // @@ We might want to loop and process strips, to reuse the results of the horizontal convolutions.
-
- // Horizontal convolution. @@ Unroll loops.
- for (int e = HW; e > 0; e--)
- {
- t.x++;
- float w = kernel[e-1];
- color += w * tex2D(image, tc);
- }
-
- for (int e = 0; e < HW; e++)
- {
- t.x++;
- float w = kernel[e];
- color += w * tex2D(image, tc);
- }
-
- // Write color to shared memory.
- __shared__ float tile[4 * THREAD_COUNT];
-
- int tileIdx = y * TW + x;
- tile[tileIdx + 0 * THREAD_COUNT] = color.x;
- tile[tileIdx + 1 * THREAD_COUNT] = color.y;
- tile[tileIdx + 2 * THREAD_COUNT] = color.z;
- tile[tileIdx + 3 * THREAD_COUNT] = color.w;
-
- __syncthreads();
-
- // tile coordinate.
- t.x = x;
- t.y = y - HW;
-
- // Vertical convolution. @@ Unroll loops.
- for (int i = HW; i > 0; i--)
- {
- float w = kernel[i-1];
-
- t.y++;
- int idx = t.y * TW + t.x;
-
- color.x += w * tile[idx + 0 * THREAD_COUNT];
- color.y += w * tile[idx + 1 * THREAD_COUNT];
- color.z += w * tile[idx + 2 * THREAD_COUNT];
- color.w += w * tile[idx + 3 * THREAD_COUNT];
- }
-
- for (int i = 0; i < HW; i++)
- {
- float w = kernel[i];
-
- t.y++;
- int idx = t.y * TW + t.x;
-
- color.x += w * tile[idx + 0 * THREAD_COUNT];
- color.y += w * tile[idx + 1 * THREAD_COUNT];
- color.z += w * tile[idx + 2 * THREAD_COUNT];
- color.w += w * tile[idx + 3 * THREAD_COUNT];
- }
-
- it (x < w && y < h)
- {
- // @@ Prevent unaligned writes.
-
- output[y * w + h] = color;
- }
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Monophase X convolution filter
-////////////////////////////////////////////////////////////////////////////////
-
-__device__ void convolveY()
-{
-
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Mipmap convolution filter
-////////////////////////////////////////////////////////////////////////////////
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Gamma correction
-////////////////////////////////////////////////////////////////////////////////
-
-/*
-__device__ float toLinear(float f, float gamma = 2.2f)
-{
- return __pow(f, gamma);
-}
-
-__device__ float toGamma(float f, float gamma = 2.2f)
-{
- return pow(f, 1.0f / gamma);
-}
-*/
-
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Setup kernel
-////////////////////////////////////////////////////////////////////////////////
-
-extern "C" void setupConvolveKernel(const float * k, int w)
-{
- w = min(w, MAX_KERNEL_WIDTH);
- cudaMemcpyToSymbol(kernel, k, sizeof(float) * w, 0);
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Launch kernel
-////////////////////////////////////////////////////////////////////////////////
-
-
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaCompressDXT.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaCompressDXT.cpp
deleted file mode 100644
index 1d63a1a1..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaCompressDXT.cpp
+++ /dev/null
@@ -1,709 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvcore/Debug.h>
-#include <nvcore/Containers.h>
-#include <nvmath/Color.h>
-#include <nvimage/Image.h>
-#include <nvimage/ColorBlock.h>
-#include <nvimage/BlockDXT.h>
-#include <nvtt/CompressionOptions.h>
-#include <nvtt/OutputOptions.h>
-#include <nvtt/QuickCompressDXT.h>
-#include <nvtt/OptimalCompressDXT.h>
-
-#include "CudaCompressDXT.h"
-#include "CudaUtils.h"
-
-
-#if defined HAVE_CUDA
-#include <cuda_runtime_api.h>
-#endif
-
-#include <time.h>
-#include <stdio.h>
-
-using namespace nv;
-using namespace nvtt;
-
-#if defined HAVE_CUDA
-
-#define MAX_BLOCKS 8192U // 32768, 65535
-
-
-extern "C" void setupCompressKernel(const float weights[3]);
-extern "C" void compressKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps);
-extern "C" void compressKernelDXT1_Tex(uint bn, uint blockNum, uint w, cudaArray * d_data, uint * d_result, uint * d_bitmaps);
-extern "C" void compressKernelDXT1_Level4(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps);
-extern "C" void compressWeightedKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps);
-extern "C" void compressNormalKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps);
-extern "C" void compressKernelCTX1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps);
-
-
-#include "Bitmaps.h" // @@ Rename to BitmapTable.h
-
-// Convert linear image to block linear.
-static void convertToBlockLinear(const Image * image, uint * blockLinearImage)
-{
- const uint w = (image->width() + 3) / 4;
- const uint h = (image->height() + 3) / 4;
-
- for(uint by = 0; by < h; by++) {
- for(uint bx = 0; bx < w; bx++) {
- const uint bw = min(image->width() - bx * 4, 4U);
- const uint bh = min(image->height() - by * 4, 4U);
-
- for (uint i = 0; i < 16; i++) {
- const int x = (i % 4) % bw;
- const int y = (i / 4) % bh;
- blockLinearImage[(by * w + bx) * 16 + i] = image->pixel(bx * 4 + x, by * 4 + y).u;
- }
- }
- }
-}
-
-#endif
-
-
-CudaCompressor::CudaCompressor() : m_bitmapTable(NULL), m_bitmapTableCTX(NULL), m_data(NULL), m_result(NULL)
-{
-#if defined HAVE_CUDA
- // Allocate and upload bitmaps.
- cudaMalloc((void**) &m_bitmapTable, 992 * sizeof(uint));
- if (m_bitmapTable != NULL)
- {
- cudaMemcpy(m_bitmapTable, s_bitmapTable, 992 * sizeof(uint), cudaMemcpyHostToDevice);
- }
-
- cudaMalloc((void**) &m_bitmapTableCTX, 704 * sizeof(uint));
- if (m_bitmapTableCTX != NULL)
- {
- cudaMemcpy(m_bitmapTableCTX, s_bitmapTableCTX, 704 * sizeof(uint), cudaMemcpyHostToDevice);
- }
-
- // Allocate scratch buffers.
- cudaMalloc((void**) &m_data, MAX_BLOCKS * 64U);
- cudaMalloc((void**) &m_result, MAX_BLOCKS * 8U);
-#endif
-}
-
-CudaCompressor::~CudaCompressor()
-{
-#if defined HAVE_CUDA
- // Free device mem allocations.
- cudaFree(m_data);
- cudaFree(m_result);
- cudaFree(m_bitmapTable);
-#endif
-}
-
-bool CudaCompressor::isValid() const
-{
-#if defined HAVE_CUDA
- if (cudaGetLastError() != cudaSuccess)
- {
- return false;
- }
-#endif
- return m_data != NULL && m_result != NULL && m_bitmapTable != NULL;
-}
-
-// @@ This code is very repetitive and needs to be cleaned up.
-
-#if 0
-
-struct CudaCompressionKernel
-{
- virtual void setup(const CompressionOptions::Private & compressionOptions)
- {
- setupCompressKernel(compressionOptions.colorWeight.ptr());
- }
-
- virtual void setBitmapTable();
-
- virtual void runDeviceCode(int count);
-
- virtual void runHostCode(int count);
-
-};
-
-void CudaCompressor::compressKernel(CudaCompressionKernel * kernel)
-{
- nvDebugCheck(cuda::isHardwarePresent());
-#if defined HAVE_CUDA
-
- // Image size in blocks.
- const uint w = (image->width() + 3) / 4;
- const uint h = (image->height() + 3) / 4;
-
- uint imageSize = w * h * 16 * sizeof(Color32);
- uint * blockLinearImage = (uint *) malloc(imageSize);
- convertToBlockLinear(image, blockLinearImage); // @@ Do this in parallel with the GPU, or in the GPU!
-
- const uint blockNum = w * h;
- const uint compressedSize = blockNum * 8;
-
- clock_t start = clock();
-
- kernel->setup(compressionOptions);
- kernel->setBitmapTable(m_bitmapTable);
-
- // TODO: Add support for multiple GPUs.
- uint bn = 0;
- while(bn != blockNum)
- {
- uint count = min(blockNum - bn, MAX_BLOCKS);
-
- cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice);
-
- kernel->runDeviceCode(count, m_data, m_result);
-
- kernel->runHostCode(count);
-
- // Check for errors.
- cudaError_t err = cudaGetLastError();
- if (err != cudaSuccess)
- {
- nvDebug("CUDA Error: %s\n", cudaGetErrorString(err));
-
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
- }
-
- // Copy result to host, overwrite swizzled image.
- cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost);
-
- // Output result.
- kernel->outputResult(outputOptions.outputHandler);
-
- if (outputOptions.outputHandler != NULL)
- {
- outputOptions.outputHandler->writeData(blockLinearImage, count * 8);
- }
-
- bn += count;
- }
-
- clock_t end = clock();
- //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC);
-
- free(blockLinearImage);
-
-#else
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
-#endif
-}
-
-#endif // 0
-
-
-void CudaCompressor::setImage(const Image * image, nvtt::AlphaMode alphaMode)
-{
- m_image = image;
- m_alphaMode = alphaMode;
-}
-
-
-
-/// Compress image using CUDA.
-void CudaCompressor::compressDXT1(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
-{
- nvDebugCheck(cuda::isHardwarePresent());
-#if defined HAVE_CUDA
-
- // Image size in blocks.
- const uint w = (m_image->width() + 3) / 4;
- const uint h = (m_image->height() + 3) / 4;
-
- uint imageSize = w * h * 16 * sizeof(Color32);
- uint * blockLinearImage = (uint *) malloc(imageSize);
- convertToBlockLinear(m_image, blockLinearImage); // @@ Do this in parallel with the GPU, or in the GPU!
-
- const uint blockNum = w * h;
- const uint compressedSize = blockNum * 8;
-
- clock_t start = clock();
-
- setupCompressKernel(compressionOptions.colorWeight.ptr());
-
- // TODO: Add support for multiple GPUs.
- uint bn = 0;
- while(bn != blockNum)
- {
- uint count = min(blockNum - bn, MAX_BLOCKS);
-
- cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice);
-
- // Launch kernel.
- compressKernelDXT1(count, m_data, m_result, m_bitmapTable);
-
- // Check for errors.
- cudaError_t err = cudaGetLastError();
- if (err != cudaSuccess)
- {
- nvDebug("CUDA Error: %s\n", cudaGetErrorString(err));
-
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
- }
-
- // Copy result to host, overwrite swizzled image.
- cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost);
-
- // Output result.
- if (outputOptions.outputHandler != NULL)
- {
- outputOptions.outputHandler->writeData(blockLinearImage, count * 8);
- }
-
- bn += count;
- }
-
- clock_t end = clock();
- //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC);
-
- free(blockLinearImage);
-
-#else
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
-#endif
-}
-
-void CudaCompressor::compressDXT1_Tex(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
-{
- nvDebugCheck(cuda::isHardwarePresent());
-#if defined HAVE_CUDA
-
- // Allocate image as a cuda array.
- cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsigned);
-
- cudaArray * d_image;
- const int imageSize = m_image->width() * m_image->height() * sizeof(uint);
- cudaMallocArray(&d_image, &channelDesc, m_image->width(), m_image->height());
- cudaMemcpyToArray(d_image, 0, 0, m_image->pixels(), imageSize, cudaMemcpyHostToDevice);
-
- // Image size in blocks.
- const uint w = (m_image->width() + 3) / 4;
- const uint h = (m_image->height() + 3) / 4;
- const uint blockNum = w * h;
- const uint compressedSize = blockNum * 8;
-
- void * h_result = malloc(MAX_BLOCKS * 8);
-
- clock_t start = clock();
-
- setupCompressKernel(compressionOptions.colorWeight.ptr());
-
- uint bn = 0;
- while(bn != blockNum)
- {
- uint count = min(blockNum - bn, MAX_BLOCKS);
-
- // Launch kernel.
- compressKernelDXT1_Tex(bn, count, w, d_image, m_result, m_bitmapTable);
-
- // Check for errors.
- cudaError_t err = cudaGetLastError();
- if (err != cudaSuccess)
- {
- nvDebug("CUDA Error: %s\n", cudaGetErrorString(err));
-
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
- }
-
- // Copy result to host, overwrite swizzled image.
- cudaMemcpy(h_result, m_result, count * 8, cudaMemcpyDeviceToHost);
-
- // Output result.
- if (outputOptions.outputHandler != NULL)
- {
- outputOptions.outputHandler->writeData(h_result, count * 8);
- }
-
- bn += count;
- }
-
- clock_t end = clock();
- //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC);
-
- free(h_result);
-
-#else
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
-#endif
-}
-
-
-
-/// Compress image using CUDA.
-void CudaCompressor::compressDXT3(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
-{
- nvDebugCheck(cuda::isHardwarePresent());
-#if defined HAVE_CUDA
-
- // Image size in blocks.
- const uint w = (m_image->width() + 3) / 4;
- const uint h = (m_image->height() + 3) / 4;
-
- uint imageSize = w * h * 16 * sizeof(Color32);
- uint * blockLinearImage = (uint *) malloc(imageSize);
- convertToBlockLinear(m_image, blockLinearImage);
-
- const uint blockNum = w * h;
- const uint compressedSize = blockNum * 8;
-
- AlphaBlockDXT3 * alphaBlocks = NULL;
- alphaBlocks = (AlphaBlockDXT3 *)malloc(min(compressedSize, MAX_BLOCKS * 8U));
-
- setupCompressKernel(compressionOptions.colorWeight.ptr());
-
- clock_t start = clock();
-
- uint bn = 0;
- while(bn != blockNum)
- {
- uint count = min(blockNum - bn, MAX_BLOCKS);
-
- cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice);
-
- // Launch kernel.
- if (m_alphaMode == AlphaMode_Transparency)
- {
- compressWeightedKernelDXT1(count, m_data, m_result, m_bitmapTable);
- }
- else
- {
- compressKernelDXT1_Level4(count, m_data, m_result, m_bitmapTable);
- }
-
- // Compress alpha in parallel with the GPU.
- for (uint i = 0; i < count; i++)
- {
- ColorBlock rgba(blockLinearImage + (bn + i) * 16);
- OptimalCompress::compressDXT3A(rgba, alphaBlocks + i);
- }
-
- // Check for errors.
- cudaError_t err = cudaGetLastError();
- if (err != cudaSuccess)
- {
- nvDebug("CUDA Error: %s\n", cudaGetErrorString(err));
-
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
- }
-
- // Copy result to host, overwrite swizzled image.
- cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost);
-
- // Output result.
- if (outputOptions.outputHandler != NULL)
- {
- for (uint i = 0; i < count; i++)
- {
- outputOptions.outputHandler->writeData(alphaBlocks + i, 8);
- outputOptions.outputHandler->writeData(blockLinearImage + i * 2, 8);
- }
- }
-
- bn += count;
- }
-
- clock_t end = clock();
- //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC);
-
- free(alphaBlocks);
- free(blockLinearImage);
-
-#else
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
-#endif
-}
-
-
-/// Compress image using CUDA.
-void CudaCompressor::compressDXT5(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
-{
- nvDebugCheck(cuda::isHardwarePresent());
-#if defined HAVE_CUDA
-
- // Image size in blocks.
- const uint w = (m_image->width() + 3) / 4;
- const uint h = (m_image->height() + 3) / 4;
-
- uint imageSize = w * h * 16 * sizeof(Color32);
- uint * blockLinearImage = (uint *) malloc(imageSize);
- convertToBlockLinear(m_image, blockLinearImage);
-
- const uint blockNum = w * h;
- const uint compressedSize = blockNum * 8;
-
- AlphaBlockDXT5 * alphaBlocks = NULL;
- alphaBlocks = (AlphaBlockDXT5 *)malloc(min(compressedSize, MAX_BLOCKS * 8U));
-
- setupCompressKernel(compressionOptions.colorWeight.ptr());
-
- clock_t start = clock();
-
- uint bn = 0;
- while(bn != blockNum)
- {
- uint count = min(blockNum - bn, MAX_BLOCKS);
-
- cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice);
-
- // Launch kernel.
- if (m_alphaMode == AlphaMode_Transparency)
- {
- compressWeightedKernelDXT1(count, m_data, m_result, m_bitmapTable);
- }
- else
- {
- compressKernelDXT1_Level4(count, m_data, m_result, m_bitmapTable);
- }
-
- // Compress alpha in parallel with the GPU.
- for (uint i = 0; i < count; i++)
- {
- ColorBlock rgba(blockLinearImage + (bn + i) * 16);
- QuickCompress::compressDXT5A(rgba, alphaBlocks + i);
- }
-
- // Check for errors.
- cudaError_t err = cudaGetLastError();
- if (err != cudaSuccess)
- {
- nvDebug("CUDA Error: %s\n", cudaGetErrorString(err));
-
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
- }
-
- // Copy result to host, overwrite swizzled image.
- cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost);
-
- // Output result.
- if (outputOptions.outputHandler != NULL)
- {
- for (uint i = 0; i < count; i++)
- {
- outputOptions.outputHandler->writeData(alphaBlocks + i, 8);
- outputOptions.outputHandler->writeData(blockLinearImage + i * 2, 8);
- }
- }
-
- bn += count;
- }
-
- clock_t end = clock();
- //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC);
-
- free(alphaBlocks);
- free(blockLinearImage);
-
-#else
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
-#endif
-}
-
-
-void CudaCompressor::compressDXT1n(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions)
-{
- nvDebugCheck(cuda::isHardwarePresent());
-#if defined HAVE_CUDA
-
- // Image size in blocks.
- const uint w = (m_image->width() + 3) / 4;
- const uint h = (m_image->height() + 3) / 4;
-
- uint imageSize = w * h * 16 * sizeof(Color32);
- uint * blockLinearImage = (uint *) malloc(imageSize);
- convertToBlockLinear(m_image, blockLinearImage); // @@ Do this in parallel with the GPU, or in the GPU!
-
- const uint blockNum = w * h;
- const uint compressedSize = blockNum * 8;
-
- clock_t start = clock();
-
- setupCompressKernel(compressionOptions.colorWeight.ptr());
-
- // TODO: Add support for multiple GPUs.
- uint bn = 0;
- while(bn != blockNum)
- {
- uint count = min(blockNum - bn, MAX_BLOCKS);
-
- cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice);
-
- // Launch kernel.
- compressNormalKernelDXT1(count, m_data, m_result, m_bitmapTable);
-
- // Check for errors.
- cudaError_t err = cudaGetLastError();
- if (err != cudaSuccess)
- {
- nvDebug("CUDA Error: %s\n", cudaGetErrorString(err));
-
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
- }
-
- // Copy result to host, overwrite swizzled image.
- cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost);
-
- // Output result.
- if (outputOptions.outputHandler != NULL)
- {
- outputOptions.outputHandler->writeData(blockLinearImage, count * 8);
- }
-
- bn += count;
- }
-
- clock_t end = clock();
- //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC);
-
- free(blockLinearImage);
-
-#else
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
-#endif
-}
-
-
-void CudaCompressor::compressCTX1(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions)
-{
- nvDebugCheck(cuda::isHardwarePresent());
-#if defined HAVE_CUDA
-
- // Image size in blocks.
- const uint w = (m_image->width() + 3) / 4;
- const uint h = (m_image->height() + 3) / 4;
-
- uint imageSize = w * h * 16 * sizeof(Color32);
- uint * blockLinearImage = (uint *) malloc(imageSize);
- convertToBlockLinear(m_image, blockLinearImage); // @@ Do this in parallel with the GPU, or in the GPU!
-
- const uint blockNum = w * h;
- const uint compressedSize = blockNum * 8;
-
- clock_t start = clock();
-
- setupCompressKernel(compressionOptions.colorWeight.ptr());
-
- // TODO: Add support for multiple GPUs.
- uint bn = 0;
- while(bn != blockNum)
- {
- uint count = min(blockNum - bn, MAX_BLOCKS);
-
- cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice);
-
- // Launch kernel.
- compressKernelCTX1(count, m_data, m_result, m_bitmapTableCTX);
-
- // Check for errors.
- cudaError_t err = cudaGetLastError();
- if (err != cudaSuccess)
- {
- nvDebug("CUDA Error: %s\n", cudaGetErrorString(err));
-
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
- }
-
- // Copy result to host, overwrite swizzled image.
- cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost);
-
- // Output result.
- if (outputOptions.outputHandler != NULL)
- {
- outputOptions.outputHandler->writeData(blockLinearImage, count * 8);
- }
-
- bn += count;
- }
-
- clock_t end = clock();
- //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC);
-
- free(blockLinearImage);
-
-#else
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
-#endif
-}
-
-
-void CudaCompressor::compressDXT5n(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions)
-{
- nvDebugCheck(cuda::isHardwarePresent());
-#if defined HAVE_CUDA
-
- // @@ TODO
-
-#else
- if (outputOptions.errorHandler != NULL)
- {
- outputOptions.errorHandler->error(Error_CudaError);
- }
-#endif
-}
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaCompressDXT.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaCompressDXT.h
deleted file mode 100644
index 0dbca39b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaCompressDXT.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_CUDACOMPRESSDXT_H
-#define NV_TT_CUDACOMPRESSDXT_H
-
-#include <nvimage/nvimage.h>
-#include <nvtt/nvtt.h>
-
-namespace nv
-{
- class Image;
-
- class CudaCompressor
- {
- public:
- CudaCompressor();
- ~CudaCompressor();
-
- bool isValid() const;
-
- void setImage(const Image * image, nvtt::AlphaMode alphaMode);
-
- void compressDXT1(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT1_Tex(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT3(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT5(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT1n(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
- void compressCTX1(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
- void compressDXT5n(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
-
- private:
-
- uint * m_bitmapTable;
- uint * m_bitmapTableCTX;
- uint * m_data;
- uint * m_result;
-
- const Image * m_image;
- nvtt::AlphaMode m_alphaMode;
- };
-
-} // nv namespace
-
-
-#endif // NV_TT_CUDAUTILS_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaMath.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaMath.h
deleted file mode 100644
index fcd11a1d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaMath.h
+++ /dev/null
@@ -1,393 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-// Math functions and operators to be used with vector types.
-
-#ifndef CUDAMATH_H
-#define CUDAMATH_H
-
-
-
-inline __device__ __host__ float3 operator *(float3 a, float3 b)
-{
- return make_float3(a.x*b.x, a.y*b.y, a.z*b.z);
-}
-
-inline __device__ __host__ float3 operator *(float f, float3 v)
-{
- return make_float3(v.x*f, v.y*f, v.z*f);
-}
-
-inline __device__ __host__ float3 operator *(float3 v, float f)
-{
- return make_float3(v.x*f, v.y*f, v.z*f);
-}
-
-inline __device__ __host__ float3 operator +(float3 a, float3 b)
-{
- return make_float3(a.x+b.x, a.y+b.y, a.z+b.z);
-}
-
-inline __device__ __host__ void operator +=(float3 & b, float3 a)
-{
- b.x += a.x;
- b.y += a.y;
- b.z += a.z;
-}
-
-inline __device__ __host__ float3 operator -(float3 a, float3 b)
-{
- return make_float3(a.x-b.x, a.y-b.y, a.z-b.z);
-}
-
-inline __device__ __host__ void operator -=(float3 & b, float3 a)
-{
- b.x -= a.x;
- b.y -= a.y;
- b.z -= a.z;
-}
-
-inline __device__ __host__ float3 operator /(float3 v, float f)
-{
- float inv = 1.0f / f;
- return v * inv;
-}
-
-inline __device__ __host__ void operator /=(float3 & b, float f)
-{
- float inv = 1.0f / f;
- b.x *= inv;
- b.y *= inv;
- b.z *= inv;
-}
-
-inline __device__ __host__ bool operator ==(float3 a, float3 b)
-{
- return a.x == b.x && a.y == b.y && a.z == b.z;
-}
-
-
-// float2 operators
-inline __device__ __host__ float2 operator *(float2 a, float2 b)
-{
- return make_float2(a.x*b.x, a.y*b.y);
-}
-
-inline __device__ __host__ float2 operator *(float f, float2 v)
-{
- return make_float2(v.x*f, v.y*f);
-}
-
-inline __device__ __host__ float2 operator *(float2 v, float f)
-{
- return make_float2(v.x*f, v.y*f);
-}
-
-inline __device__ __host__ float2 operator +(float2 a, float2 b)
-{
- return make_float2(a.x+b.x, a.y+b.y);
-}
-
-inline __device__ __host__ void operator +=(float2 & b, float2 a)
-{
- b.x += a.x;
- b.y += a.y;
-}
-
-inline __device__ __host__ float2 operator -(float2 a, float2 b)
-{
- return make_float2(a.x-b.x, a.y-b.y);
-}
-
-inline __device__ __host__ void operator -=(float2 & b, float2 a)
-{
- b.x -= a.x;
- b.y -= a.y;
-}
-
-inline __device__ __host__ float2 operator /(float2 v, float f)
-{
- float inv = 1.0f / f;
- return v * inv;
-}
-
-inline __device__ __host__ void operator /=(float2 & b, float f)
-{
- float inv = 1.0f / f;
- b.x *= inv;
- b.y *= inv;
-}
-
-inline __device__ __host__ bool operator ==(float2 a, float2 b)
-{
- return a.x == b.x && a.y == b.y;
-}
-
-
-inline __device__ __host__ float dot(float2 a, float2 b)
-{
- return a.x * b.x + a.y * b.y;
-}
-
-inline __device__ __host__ float dot(float3 a, float3 b)
-{
- return a.x * b.x + a.y * b.y + a.z * b.z;
-}
-
-inline __device__ __host__ float dot(float4 a, float4 b)
-{
- return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
-}
-
-inline __device__ __host__ float clamp(float f, float a, float b)
-{
- return max(a, min(f, b));
-}
-
-inline __device__ __host__ float3 clamp(float3 v, float a, float b)
-{
- return make_float3(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b));
-}
-
-inline __device__ __host__ float3 clamp(float3 v, float3 a, float3 b)
-{
- return make_float3(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, a.z, b.z));
-}
-
-
-inline __device__ __host__ float3 normalize(float3 v)
-{
- float len = 1.0f / sqrtf(dot(v, v));
- return make_float3(v.x * len, v.y * len, v.z * len);
-}
-
-
-
-
-// Use power method to find the first eigenvector.
-// http://www.miislita.com/information-retrieval-tutorial/matrix-tutorial-3-eigenvalues-eigenvectors.html
-inline __device__ __host__ float3 firstEigenVector( float matrix[6] )
-{
- // 8 iterations seems to be more than enough.
-
- float3 v = make_float3(1.0f, 1.0f, 1.0f);
- for(int i = 0; i < 8; i++) {
- float x = v.x * matrix[0] + v.y * matrix[1] + v.z * matrix[2];
- float y = v.x * matrix[1] + v.y * matrix[3] + v.z * matrix[4];
- float z = v.x * matrix[2] + v.y * matrix[4] + v.z * matrix[5];
- float m = max(max(x, y), z);
- float iv = 1.0f / m;
- if (m == 0.0f) iv = 0.0f;
- v = make_float3(x*iv, y*iv, z*iv);
- }
-
- return v;
-}
-
-inline __device__ bool singleColor(const float3 * colors)
-{
-#if __DEVICE_EMULATION__
- bool sameColor = false;
- for (int i = 0; i < 16; i++)
- {
- sameColor &= (colors[i] == colors[0]);
- }
- return sameColor;
-#else
- __shared__ int sameColor[16];
-
- const int idx = threadIdx.x;
-
- sameColor[idx] = (colors[idx] == colors[0]);
- sameColor[idx] &= sameColor[idx^8];
- sameColor[idx] &= sameColor[idx^4];
- sameColor[idx] &= sameColor[idx^2];
- sameColor[idx] &= sameColor[idx^1];
-
- return sameColor[0];
-#endif
-}
-
-inline __device__ void colorSums(const float3 * colors, float3 * sums)
-{
-#if __DEVICE_EMULATION__
- float3 color_sum = make_float3(0.0f, 0.0f, 0.0f);
- for (int i = 0; i < 16; i++)
- {
- color_sum += colors[i];
- }
-
- for (int i = 0; i < 16; i++)
- {
- sums[i] = color_sum;
- }
-#else
-
- const int idx = threadIdx.x;
-
- sums[idx] = colors[idx];
- sums[idx] += sums[idx^8];
- sums[idx] += sums[idx^4];
- sums[idx] += sums[idx^2];
- sums[idx] += sums[idx^1];
-
-#endif
-}
-
-inline __device__ float3 bestFitLine(const float3 * colors, float3 color_sum, float3 colorMetric)
-{
- // Compute covariance matrix of the given colors.
-#if __DEVICE_EMULATION__
- float covariance[6] = {0, 0, 0, 0, 0, 0};
- for (int i = 0; i < 16; i++)
- {
- float3 a = (colors[i] - color_sum * (1.0f / 16.0f)) * colorMetric;
- covariance[0] += a.x * a.x;
- covariance[1] += a.x * a.y;
- covariance[2] += a.x * a.z;
- covariance[3] += a.y * a.y;
- covariance[4] += a.y * a.z;
- covariance[5] += a.z * a.z;
- }
-#else
-
- const int idx = threadIdx.x;
-
- float3 diff = (colors[idx] - color_sum * (1.0f / 16.0f)) * colorMetric;
-
- // @@ Eliminate two-way bank conflicts here.
- // @@ It seems that doing that and unrolling the reduction doesn't help...
- __shared__ float covariance[16*6];
-
- covariance[6 * idx + 0] = diff.x * diff.x; // 0, 6, 12, 2, 8, 14, 4, 10, 0
- covariance[6 * idx + 1] = diff.x * diff.y;
- covariance[6 * idx + 2] = diff.x * diff.z;
- covariance[6 * idx + 3] = diff.y * diff.y;
- covariance[6 * idx + 4] = diff.y * diff.z;
- covariance[6 * idx + 5] = diff.z * diff.z;
-
- for(int d = 8; d > 0; d >>= 1)
- {
- if (idx < d)
- {
- covariance[6 * idx + 0] += covariance[6 * (idx+d) + 0];
- covariance[6 * idx + 1] += covariance[6 * (idx+d) + 1];
- covariance[6 * idx + 2] += covariance[6 * (idx+d) + 2];
- covariance[6 * idx + 3] += covariance[6 * (idx+d) + 3];
- covariance[6 * idx + 4] += covariance[6 * (idx+d) + 4];
- covariance[6 * idx + 5] += covariance[6 * (idx+d) + 5];
- }
- }
-
-#endif
-
- // Compute first eigen vector.
- return firstEigenVector(covariance);
-}
-
-// @@ For 2D this may not be the most efficient method. It's a quadratic equation, right?
-inline __device__ __host__ float2 firstEigenVector2D( float matrix[3] )
-{
- // @@ 8 iterations is probably more than enough.
-
- float2 v = make_float2(1.0f, 1.0f);
- for(int i = 0; i < 8; i++) {
- float x = v.x * matrix[0] + v.y * matrix[1];
- float y = v.x * matrix[1] + v.y * matrix[2];
- float m = max(x, y);
- float iv = 1.0f / m;
- if (m == 0.0f) iv = 0.0f;
- v = make_float2(x*iv, y*iv);
- }
-
- return v;
-}
-
-inline __device__ void colorSums(const float2 * colors, float2 * sums)
-{
-#if __DEVICE_EMULATION__
- float2 color_sum = make_float2(0.0f, 0.0f);
- for (int i = 0; i < 16; i++)
- {
- color_sum += colors[i];
- }
-
- for (int i = 0; i < 16; i++)
- {
- sums[i] = color_sum;
- }
-#else
-
- const int idx = threadIdx.x;
-
- sums[idx] = colors[idx];
- sums[idx] += sums[idx^8];
- sums[idx] += sums[idx^4];
- sums[idx] += sums[idx^2];
- sums[idx] += sums[idx^1];
-
-#endif
-}
-
-inline __device__ float2 bestFitLine(const float2 * colors, float2 color_sum)
-{
- // Compute covariance matrix of the given colors.
-#if __DEVICE_EMULATION__
- float covariance[3] = {0, 0, 0};
- for (int i = 0; i < 16; i++)
- {
- float2 a = (colors[i] - color_sum * (1.0f / 16.0f));
- covariance[0] += a.x * a.x;
- covariance[1] += a.x * a.y;
- covariance[2] += a.y * a.y;
- }
-#else
-
- const int idx = threadIdx.x;
-
- float2 diff = (colors[idx] - color_sum * (1.0f / 16.0f));
-
- __shared__ float covariance[16*3];
-
- covariance[3 * idx + 0] = diff.x * diff.x;
- covariance[3 * idx + 1] = diff.x * diff.y;
- covariance[3 * idx + 2] = diff.y * diff.y;
-
- for(int d = 8; d > 0; d >>= 1)
- {
- if (idx < d)
- {
- covariance[3 * idx + 0] += covariance[3 * (idx+d) + 0];
- covariance[3 * idx + 1] += covariance[3 * (idx+d) + 1];
- covariance[3 * idx + 2] += covariance[3 * (idx+d) + 2];
- }
- }
-
-#endif
-
- // Compute first eigen vector.
- return firstEigenVector2D(covariance);
-}
-
-
-#endif // CUDAMATH_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaUtils.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaUtils.cpp
deleted file mode 100644
index cda6b9d5..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaUtils.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvcore/Debug.h>
-#include <nvcore/Library.h>
-#include "CudaUtils.h"
-
-#if defined HAVE_CUDA
-#include <cuda_runtime_api.h>
-#endif
-
-using namespace nv;
-using namespace cuda;
-
-#if NV_OS_WIN32
-
-#define WINDOWS_LEAN_AND_MEAN
-#include <windows.h>
-
-static bool isWindowsVista()
-{
- OSVERSIONINFO osvi;
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-
- ::GetVersionEx(&osvi);
- return osvi.dwMajorVersion >= 6;
-}
-
-
-typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
-
-static bool isWow32()
-{
- LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process");
-
- BOOL bIsWow64 = FALSE;
-
- if (NULL != fnIsWow64Process)
- {
- if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64))
- {
- // Assume 32 bits.
- return true;
- }
- }
-
- return !bIsWow64;
-}
-
-#endif
-
-#include <stdio.h>
-
-static bool isCudaDriverAvailable(uint version)
-{
-#if NV_OS_WIN32
- Library nvcuda("nvcuda.dll");
-#else
- Library nvcuda(NV_LIBRARY_NAME(cuda));
-#endif
-
- if (!nvcuda.isValid())
- {
- return false;
- }
-
- if (version >= 2000)
- {
- void * address = nvcuda.bindSymbol("cuStreamCreate");
- if (address == NULL) return false;
- }
-
- if (version >= 2010)
- {
- void * address = nvcuda.bindSymbol("cuModuleLoadDataEx");
- if (address == NULL) return false;
- }
-
- return true;
-}
-
-
-/// Determine if CUDA is available.
-bool nv::cuda::isHardwarePresent()
-{
-#if defined HAVE_CUDA
-#if NV_OS_WIN32
- //if (isWindowsVista()) return false;
- //if (isWindowsVista() || !isWow32()) return false;
-#endif
- int count = deviceCount();
- if (count == 1)
- {
- // Make sure it's not an emulation device.
- cudaDeviceProp deviceProp;
- cudaGetDeviceProperties(&deviceProp, 0);
-
- // deviceProp.name != Device Emulation (CPU)
- if (deviceProp.major == -1 || deviceProp.minor == -1)
- {
- return false;
- }
-
- // Make sure that CUDA driver matches CUDA runtime.
- if (!isCudaDriverAvailable(CUDART_VERSION))
- {
- return false;
- }
-
- // @@ Make sure that warp size == 32
- }
-
- return count > 0;
-#else
- return false;
-#endif
-}
-
-/// Get number of CUDA enabled devices.
-int nv::cuda::deviceCount()
-{
-#if defined HAVE_CUDA
- int gpuCount = 0;
-
- cudaError_t result = cudaGetDeviceCount(&gpuCount);
-
- if (result == cudaSuccess)
- {
- return gpuCount;
- }
-#endif
- return 0;
-}
-
-int nv::cuda::getFastestDevice()
-{
- int max_gflops_device = 0;
-#if defined HAVE_CUDA
- int max_gflops = 0;
-
- const int device_count = deviceCount();
- int current_device = 0;
- while (current_device < device_count)
- {
- cudaDeviceProp device_properties;
- cudaGetDeviceProperties(&device_properties, current_device);
- int gflops = device_properties.multiProcessorCount * device_properties.clockRate;
-
- if (device_properties.major != -1 && device_properties.minor != -1)
- {
- if( gflops > max_gflops )
- {
- max_gflops = gflops;
- max_gflops_device = current_device;
- }
- }
-
- current_device++;
- }
-#endif
- return max_gflops_device;
-}
-
-
-/// Activate the given devices.
-bool nv::cuda::setDevice(int i)
-{
- nvCheck(i < deviceCount());
-#if defined HAVE_CUDA
- cudaError_t result = cudaSetDevice(i);
- return result == cudaSuccess;
-#else
- return false;
-#endif
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaUtils.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaUtils.h
deleted file mode 100644
index 69659604..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/cuda/CudaUtils.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_CUDAUTILS_H
-#define NV_TT_CUDAUTILS_H
-
-namespace nv
-{
-
- namespace cuda
- {
- bool isHardwarePresent();
- int deviceCount();
- int getFastestDevice();
- bool setDevice(int i);
- };
-
-} // nv namespace
-
-
-#endif // NV_TT_CUDAUTILS_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/experimental/nvtt_experimental.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/experimental/nvtt_experimental.cpp
deleted file mode 100644
index 0c0525c5..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/experimental/nvtt_experimental.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-
-#include "nvtt_experimental.h"
-
-struct NvttTexture
-{
- NvttTexture() :
- m_constant(false),
- m_image(NULL),
- m_floatImage(NULL)
- {
- }
-
- ~NvttTexture()
- {
- if (m_constant && m_image) m_image->unwrap();
- delete m_image;
- delete m_floatImage;
- }
-
- bool m_constant;
- Image * m_image;
- FloatImage * m_floatImage;
-};
-
-NvttTexture * nvttCreateTexture()
-{
- return new NvttTexture();
-}
-
-void nvttDestroyTexture(NvttTexture * tex)
-{
- delete tex;
-}
-
-void nvttSetImageData(NvttImage * img, NvttInputFormat format, uint w, uint h, void * data)
-{
- nvCheck(img != NULL);
-
- if (format == NVTT_InputFormat_BGRA_8UB)
- {
- img->m_constant = false;
- img->m_image->allocate(w, h);
- memcpy(img->m_image->pixels(), data, w * h * 4);
- }
- else
- {
- nvCheck(false);
- }
-}
-
-void nvttCompressImage(NvttImage * img, NvttFormat format)
-{
- nvCheck(img != NULL);
-
- // @@ Invoke appropriate compressor.
-}
-
-
-
-#endif // NVTT_EXPERIMENTAL_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/experimental/nvtt_experimental.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/experimental/nvtt_experimental.h
deleted file mode 100644
index 1149ef0d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/experimental/nvtt_experimental.h
+++ /dev/null
@@ -1,103 +0,0 @@
-
-#ifndef NVTT_EXPERIMENTAL_H
-#define NVTT_EXPERIMENTAL_H
-
-#include <nvtt/nvtt.h>
-
-typedef struct NvttTexture NvttTexture;
-typedef struct NvttOutputOptions NvttOutputOptions;
-
-
-// Global functions
-void nvttInitialize(...);
-unsigned int nvttGetVersion();
-const char * nvttGetErrorString(unsigned int error);
-
-
-// Texture functions
-NvttTexture * nvttCreateTexture();
-void nvttDestroyTexture(NvttTexture * tex);
-
-void nvttSetTexture2D(NvttTexture * tex, NvttInputFormat format, uint w, uint h, uint idx, void * data);
-
-void nvttResize(NvttTexture * img, uint w, uint h);
-unsigned int nvttDownsample(NvttTexture * img);
-
-void nvttOutputCompressed(NvttTexture * img, NvttOutputFormat format);
-void nvttOutputPixelFormat(NvttTexture * img, NvttOutputFormat format);
-
-
-
-
-// How to control the compression parameters?
-
-// Using many arguments:
-// void nvttCompressImage(img, format, quality, r, g, b, a, ...);
-
-// Using existing compression option class:
-// compressionOptions = nvttCreateCompressionOptions();
-// nvttSetCompressionOptionsFormat(compressionOptions, format);
-// nvttSetCompressionOptionsQuality(compressionOptions, quality);
-// nvttSetCompressionOptionsQuality(compressionOptions, quality);
-// nvttSetCompressionOptionsColorWeights(compressionOptions, r, g, b, a);
-// ...
-// nvttCompressImage(img, compressionOptions);
-
-// Using thread local context state:
-// void nvttSetCompressionFormat(format);
-// void nvttSetCompressionQuality(quality);
-// void nvttSetCompressionColorWeights(r, g, b, a);
-// ...
-// nvttCompressImage(img);
-
-// Using thread local context state, but with GL style function arguments:
-// nvttCompressorParameteri(NVTT_FORMAT, format);
-// nvttCompressorParameteri(NVTT_QUALITY, quality);
-// nvttCompressorParameterf(NVTT_COLOR_WEIGHT_RED, r);
-// nvttCompressorParameterf(NVTT_COLOR_WEIGHT_GREEN, g);
-// nvttCompressorParameterf(NVTT_COLOR_WEIGHT_BLUE, b);
-// nvttCompressorParameterf(NVTT_COLOR_WEIGHT_ALPHA, a);
-// or nvttCompressorParameter4f(NVTT_COLOR_WEIGHTS, r, g, b, a);
-// ...
-// nvttCompressImage(img);
-
-// How do we get the compressed output?
-// - Using callbacks. (via new entrypoints, or through outputOptions)
-// - Return it explicitely from nvttCompressImage.
-// - Store it along the image, retrieve later explicitely with 'nvttGetCompressedData(img, ...)'
-
-/*
-
-// Global functions
-void nvttInitialize(...);
-unsigned int nvttGetVersion();
-const char * nvttGetErrorString(unsigned int error);
-
-// Context object
-void nvttCreateContext();
-void nvttDestroyContext();
-
-void nvttSetParameter1i(unsigned int name, int value);
-
-void nvttSetParameter1f(unsigned int name, float value);
-void nvttSetParameter2f(unsigned int name, float v0, float v1);
-void nvttSetParameter3f(unsigned int name, float v0, float v1, float v2);
-void nvttSetParameter4f(unsigned int name, float v0, float v1, float v2, float v3);
-
-// Image object
-NvttImage * nvttCreateImage();
-void nvttDestroyImage(NvttImage * img);
-
-void nvttSetImageData(NvttImage * image, NvttInputFormat format, unsigned int w, unsigned int h, void * data);
-
-void nvttSetImageParameter1i(NvttImage * image, unsigned int name, int value);
-void nvttSetImageParameter1f(NvttImage * image, unsigned int name, float value);
-
-void nvttResizeImage(NvttImage * image, unsigned int w, unsigned int h);
-void nvttQuantizeImage(NvttImage * image, bool dither, unsigned int rbits, unsigned int gbits, unsigned int bbits, unsigned int abits);
-void nvttCompressImage(NvttImage * image, void * buffer, int size);
-
-*/
-
-
-#endif // NVTT_EXPERIMENTAL_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/experimental/test.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/experimental/test.cpp
deleted file mode 100644
index a60ee613..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/experimental/test.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-
-#include "nvtt_experimental.h"
-
-/*
-Errors in the original API:
-- Too many memory copies.
-- Implementation too complicated.
-- Error output should not be in output options.
-- Data driven interface. Follows the dialog model. Provide all the data upfront.
-*/
-
-
-// Output texture with mipmaps
-void example0()
-{
- CompressionOptions compressionOptions;
- OutputOptions outputOptions;
-
- Texture img;
- img.setTexture2D(format, w, h, 0, data);
-
- Compressor context;
- context.outputHeader(outputOptions);
- context.outputCompressed(img, compressionOptions, outputOptions);
-
- img.toLinear(2.2);
- while (img.downsample(NVTT_FILTER_BOX))
- {
- img.toGamma(2.2);
- outputCompressed(img, compressionOptions, outputOptions);
- }
-}
-
-
-// Output texture with colored mipmaps
-void example1()
-{
- CompressionOptions compressionOptions;
- OutputOptions outputOptions;
-
- Texture img;
- img.setTexture2D(format, w, h, 0, data);
-
- Compressor context;
- context.outputHeader(outputOptions);
- context.outputCompressed(img, compressionOptions, outputOptions);
-
- img.toLinear(2.2);
- while (img.downsample(NVTT_FILTER_BOX))
- {
- img.toGamma(2.2);
-
- Texture mipmap = img;
- mipmap.blend(color[i].r, color[i].g, color[i].b, 0.5f);
-
- context.outputCompressed(mipmap, compressionOptions, outputOptions);
- }
-}
-
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt.cpp
deleted file mode 100644
index f72b7f88..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include "nvtt.h"
-
-using namespace nvtt;
-
-/// Return a string for the given error.
-const char * nvtt::errorString(Error e)
-{
- switch(e)
- {
- case Error_Unknown:
- return "Unknown error";
- case Error_InvalidInput:
- return "Invalid input";
- case Error_UnsupportedFeature:
- return "Unsupported feature";
- case Error_CudaError:
- return "CUDA error";
- case Error_FileOpen:
- return "Error opening file";
- case Error_FileWrite:
- return "Error writing through output handler";
- case Error_UnsupportedOutputFormat:
- return "The container file does not support the selected output format";
- }
-
- return "Invalid error";
-}
-
-/// Return NVTT version.
-unsigned int nvtt::version()
-{
- return NVTT_VERSION;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt.h
deleted file mode 100644
index fb281724..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt.h
+++ /dev/null
@@ -1,408 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NV_TT_H
-#define NV_TT_H
-
-// Function linkage
-#if NVTT_SHARED
-
-#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined __MINGW32__
-# ifdef NVTT_EXPORTS
-# define NVTT_API __declspec(dllexport)
-# else
-# define NVTT_API __declspec(dllimport)
-# endif
-#endif
-
-#if defined __GNUC__ >= 4
-# ifdef NVTT_EXPORTS
-# define NVTT_API __attribute__((visibility("default")))
-# endif
-#endif
-
-#endif // NVTT_SHARED
-
-#if !defined NVTT_API
-# define NVTT_API
-#endif
-
-#define NVTT_VERSION 201
-
-#define NVTT_FORBID_COPY(Class) \
- private: \
- Class(const Class &); \
- void operator=(const Class &); \
- public: \
-
-#define NVTT_DECLARE_PIMPL(Class) \
- public: \
- struct Private; \
- Private & m
-
-
-// Public interface.
-namespace nvtt
-{
- // Forward declarations.
- struct Texture;
-
- /// Supported compression formats.
- enum Format
- {
- // No compression.
- Format_RGB,
- Format_RGBA = Format_RGB,
-
- // DX9 formats.
- Format_DXT1,
- Format_DXT1a, // DXT1 with binary alpha.
- Format_DXT3,
- Format_DXT5,
- Format_DXT5n, // Compressed HILO: R=0, G=x, B=0, A=y
-
- // DX10 formats.
- Format_BC1 = Format_DXT1,
- Format_BC1a = Format_DXT1a,
- Format_BC2 = Format_DXT3,
- Format_BC3 = Format_DXT5,
- Format_BC3n = Format_DXT5n,
- Format_BC4, // ATI1
- Format_BC5, // 3DC, ATI2
-
- Format_DXT1n,
- Format_CTX1,
- };
-
- /// Pixel types.
- enum PixelType
- {
- PixelType_UnsignedNorm,
- PixelType_SignedNorm,
- PixelType_UnsignedInt,
- PixelType_SignedInt,
- PixelType_Float,
- };
-
- /// Quality modes.
- enum Quality
- {
- Quality_Fastest,
- Quality_Normal,
- Quality_Production,
- Quality_Highest,
- };
-
- /// Compression options. This class describes the desired compression format and other compression settings.
- struct CompressionOptions
- {
- NVTT_FORBID_COPY(CompressionOptions);
- NVTT_DECLARE_PIMPL(CompressionOptions);
-
- NVTT_API CompressionOptions();
- NVTT_API ~CompressionOptions();
-
- NVTT_API void reset();
-
- NVTT_API void setFormat(Format format);
- NVTT_API void setQuality(Quality quality);
- NVTT_API void setColorWeights(float red, float green, float blue, float alpha = 1.0f);
-
- NVTT_API void setExternalCompressor(const char * name);
-
- // Set color mask to describe the RGB/RGBA format.
- NVTT_API void setPixelFormat(unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask);
- NVTT_API void setPixelFormat(unsigned char rsize, unsigned char gsize, unsigned char bsize, unsigned char asize);
-
- NVTT_API void setPixelType(PixelType pixelType);
-
- NVTT_API void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold = 127);
- };
-
- /*
- // DXGI_FORMAT_R16G16_FLOAT
- compressionOptions.setPixelType(PixelType_Float);
- compressionOptions.setPixelFormat2(16, 16, 0, 0);
-
- // DXGI_FORMAT_R32G32B32A32_FLOAT
- compressionOptions.setPixelType(PixelType_Float);
- compressionOptions.setPixelFormat2(32, 32, 32, 32);
- */
-
-
- /// Wrap modes.
- enum WrapMode
- {
- WrapMode_Clamp,
- WrapMode_Repeat,
- WrapMode_Mirror,
- };
-
- /// Texture types.
- enum TextureType
- {
- TextureType_2D,
- TextureType_Cube,
- // TextureType_3D,
- };
-
- /// Input formats.
- enum InputFormat
- {
- InputFormat_BGRA_8UB,
- InputFormat_RGBA_32F,
- };
-
- /// Mipmap downsampling filters.
- enum MipmapFilter
- {
- MipmapFilter_Box, ///< Box filter is quite good and very fast.
- MipmapFilter_Triangle, ///< Triangle filter blurs the results too much, but that might be what you want.
- MipmapFilter_Kaiser, ///< Kaiser-windowed Sinc filter is the best downsampling filter.
- };
-
- /// Texture resize filters.
- enum ResizeFilter
- {
- ResizeFilter_Box,
- ResizeFilter_Triangle,
- ResizeFilter_Kaiser,
- ResizeFilter_Mitchell,
- };
-
- /// Color transformation.
- enum ColorTransform
- {
- ColorTransform_None,
- ColorTransform_Linear, ///< Not implemented.
- ColorTransform_Swizzle, ///< Not implemented.
- ColorTransform_YCoCg, ///< Transform into r=Co, g=Cg, b=0, a=Y
- ColorTransform_ScaledYCoCg, ///< Not implemented.
- };
-
- /// Extents rounding mode.
- enum RoundMode
- {
- RoundMode_None,
- RoundMode_ToNextPowerOfTwo,
- RoundMode_ToNearestPowerOfTwo,
- RoundMode_ToPreviousPowerOfTwo,
- };
-
- /// Alpha mode.
- enum AlphaMode
- {
- AlphaMode_None,
- AlphaMode_Transparency,
- AlphaMode_Premultiplied,
- };
-
- /// Input options. Specify format and layout of the input texture.
- struct InputOptions
- {
- NVTT_FORBID_COPY(InputOptions);
- NVTT_DECLARE_PIMPL(InputOptions);
-
- NVTT_API InputOptions();
- NVTT_API ~InputOptions();
-
- // Set default options.
- NVTT_API void reset();
-
- // Setup input layout.
- NVTT_API void setTextureLayout(TextureType type, int w, int h, int d = 1);
- NVTT_API void resetTextureLayout();
-
- // Set mipmap data. Copies the data.
- NVTT_API bool setMipmapData(const void * data, int w, int h, int d = 1, int face = 0, int mipmap = 0);
- NVTT_API bool setMipmapChannelData(const void * data, int channel, int w, int h, int d = 1, int face = 0, int mipmap = 0);
-
- // Describe the format of the input.
- NVTT_API void setFormat(InputFormat format);
-
- // Set the way the input alpha channel is interpreted. @@ Not implemented!
- NVTT_API void setAlphaMode(AlphaMode alphaMode);
-
- // Set gamma settings.
- NVTT_API void setGamma(float inputGamma, float outputGamma);
-
- // Set texture wrappign mode.
- NVTT_API void setWrapMode(WrapMode mode);
-
- // Set mipmapping options.
- NVTT_API void setMipmapFilter(MipmapFilter filter);
- NVTT_API void setMipmapGeneration(bool enabled, int maxLevel = -1);
- NVTT_API void setKaiserParameters(float width, float alpha, float stretch);
-
- // Set normal map options.
- NVTT_API void setNormalMap(bool b);
- NVTT_API void setConvertToNormalMap(bool convert);
- NVTT_API void setHeightEvaluation(float redScale, float greenScale, float blueScale, float alphaScale);
- NVTT_API void setNormalFilter(float sm, float medium, float big, float large);
- NVTT_API void setNormalizeMipmaps(bool b);
-
- // Set color transforms.
- NVTT_API void setColorTransform(ColorTransform t);
- NVTT_API void setLinearTransform(int channel, float w0, float w1, float w2, float w3);
- NVTT_API void setLinearTransform(int channel, float w0, float w1, float w2, float w3, float offset);
- NVTT_API void setSwizzleTransform(int x, int y, int z, int w);
-
- // Set resizing options.
- NVTT_API void setMaxExtents(int d);
- NVTT_API void setRoundMode(RoundMode mode);
-
- // Set whether or not to premultiply color by alpha
- NVTT_API void setPremultiplyAlpha(bool b);
- };
-
-
- /// Output handler.
- struct OutputHandler
- {
- virtual ~OutputHandler() {}
-
- /// Indicate the start of a new compressed image that's part of the final texture.
- virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel) = 0;
-
- /// Output data. Compressed data is output as soon as it's generated to minimize memory allocations.
- virtual bool writeData(const void * data, int size) = 0;
- };
-
- /// Error codes.
- enum Error
- {
- Error_Unknown,
- Error_InvalidInput,
- Error_UnsupportedFeature,
- Error_CudaError,
- Error_FileOpen,
- Error_FileWrite,
- Error_UnsupportedOutputFormat,
- };
-
- /// Error handler.
- struct ErrorHandler
- {
- virtual ~ErrorHandler() {}
-
- // Signal error.
- virtual void error(Error e) = 0;
- };
-
- /// Container.
- enum Container
- {
- Container_DDS,
- Container_DDS10,
- };
-
-
- /// Output Options. This class holds pointers to the interfaces that are used to report the output of
- /// the compressor to the user.
- struct OutputOptions
- {
- NVTT_FORBID_COPY(OutputOptions);
- NVTT_DECLARE_PIMPL(OutputOptions);
-
- NVTT_API OutputOptions();
- NVTT_API ~OutputOptions();
-
- // Set default options.
- NVTT_API void reset();
-
- NVTT_API void setFileName(const char * fileName);
-
- NVTT_API void setOutputHandler(OutputHandler * outputHandler);
- NVTT_API void setErrorHandler(ErrorHandler * errorHandler);
- NVTT_API void setOutputHeader(bool outputHeader);
- NVTT_API void setContainer(Container container);
- };
-
-
- /// Texture compressor.
- struct Compressor
- {
- NVTT_FORBID_COPY(Compressor);
- NVTT_DECLARE_PIMPL(Compressor);
-
- NVTT_API Compressor();
- NVTT_API ~Compressor();
-
- NVTT_API void enableCudaAcceleration(bool enable);
- NVTT_API bool isCudaAccelerationEnabled() const;
-
- // Main entrypoint of the compression library.
- NVTT_API bool process(const InputOptions & inputOptions, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const;
-
- // Estimate the size of compressing the input with the given options.
- NVTT_API int estimateSize(const InputOptions & inputOptions, const CompressionOptions & compressionOptions) const;
-
- NVTT_API void outputCompressed(const Texture & tex, const OutputOptions & outputOptions);
- };
-
-
- /// Texture data.
- struct Texture
- {
- NVTT_DECLARE_PIMPL(Texture);
-
- NVTT_API Texture();
- NVTT_API ~Texture();
-
- Texture(const Texture & tex);
- void operator=(const Texture & tex);
-
- NVTT_API bool load(const char * fileName); // @@ Input callbacks?
-
- NVTT_API void setType(TextureType type);
- NVTT_API void setTexture2D(InputFormat format, int w, int h, int idx, void * data);
-
- // Resizing
- NVTT_API void resize(int w, int h, ResizeFilter filter);
- NVTT_API bool buildMipmap(MipmapFilter filter);
-
- // Color transforms.
- NVTT_API void toLinear(float gamma);
- NVTT_API void toGamma(float gamma);
- NVTT_API void transform(const float w0[4], const float w1[4], const float w2[4], const float w3[4], const float offset[4]);
- NVTT_API void swizzle(int r, int g, int b, int a);
- NVTT_API void scaleBias(int channel, float scale, float bias);
- NVTT_API void normalize();
- NVTT_API void blend(float r, float g, float b, float a);
- NVTT_API void premultiplyAlpha();
- };
-
-
- // Return string for the given error code.
- NVTT_API const char * errorString(Error e);
-
- // Return NVTT version.
- NVTT_API unsigned int version();
-
- // Set callbacks.
- //NVTT_API void setErrorCallback(ErrorCallback callback);
- //NVTT_API void setMemoryCallbacks(...);
-
-} // nvtt namespace
-
-#endif // NV_TT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt_wrapper.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt_wrapper.cpp
deleted file mode 100644
index 136a99d7..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt_wrapper.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-
-#include "nvtt.h"
-#include "nvtt_wrapper.h"
-
-
-// InputOptions class.
-NvttInputOptions * nvttCreateInputOptions()
-{
- return new nvtt::InputOptions();
-}
-
-void nvttDestroyInputOptions(NvttInputOptions * inputOptions)
-{
- delete inputOptions;
-}
-
-void nvttSetInputOptionsTextureLayout(NvttInputOptions * inputOptions, NvttTextureType type, int w, int h, int d)
-{
- inputOptions->setTextureLayout((nvtt::TextureType)type, w, h, d);
-}
-
-void nvttResetInputOptionsTextureLayout(NvttInputOptions * inputOptions)
-{
- inputOptions->resetTextureLayout();
-}
-
-NvttBoolean nvttSetInputOptionsMipmapData(NvttInputOptions * inputOptions, const void * data, int w, int h, int d, int face, int mipmap)
-{
- return (NvttBoolean)inputOptions->setMipmapData(data, w, h, d, face, mipmap);
-}
-
-void nvttSetInputOptionsFormat(NvttInputOptions * inputOptions, NvttInputFormat format)
-{
- inputOptions->setFormat((nvtt::InputFormat)format);
-}
-
-void nvttSetInputOptionsAlphaMode(NvttInputOptions * inputOptions, NvttAlphaMode alphaMode)
-{
- inputOptions->setAlphaMode((nvtt::AlphaMode)alphaMode);
-}
-
-void nvttSetInputOptionsGamma(NvttInputOptions * inputOptions, float inputGamma, float outputGamma)
-{
- inputOptions->setGamma(inputGamma, outputGamma);
-}
-
-void nvttSetInputOptionsWrapMode(NvttInputOptions * inputOptions, NvttWrapMode mode)
-{
- inputOptions->setWrapMode((nvtt::WrapMode)mode);
-}
-
-void nvttSetInputOptionsMipmapFilter(NvttInputOptions * inputOptions, NvttMipmapFilter filter)
-{
- inputOptions->setMipmapFilter((nvtt::MipmapFilter)filter);
-}
-
-void nvttSetInputOptionsMipmapGeneration(NvttInputOptions * inputOptions, NvttBoolean enabled, int maxLevel)
-{
- inputOptions->setMipmapGeneration(enabled != NVTT_False, maxLevel);
-}
-
-void nvttSetInputOptionsKaiserParameters(NvttInputOptions * inputOptions, float width, float alpha, float stretch)
-{
- inputOptions->setKaiserParameters(width, alpha, stretch);
-}
-
-void nvttSetInputOptionsNormalMap(NvttInputOptions * inputOptions, NvttBoolean b)
-{
- inputOptions->setNormalMap(b != NVTT_False);
-}
-
-void nvttSetInputOptionsConvertToNormalMap(NvttInputOptions * inputOptions, NvttBoolean convert)
-{
- inputOptions->setConvertToNormalMap(convert != NVTT_False);
-}
-
-void nvttSetInputOptionsHeightEvaluation(NvttInputOptions * inputOptions, float redScale, float greenScale, float blueScale, float alphaScale)
-{
- inputOptions->setHeightEvaluation(redScale, greenScale, blueScale, alphaScale);
-}
-
-void nvttSetInputOptionsNormalFilter(NvttInputOptions * inputOptions, float small, float medium, float big, float large)
-{
- inputOptions->setNormalFilter(small, medium, big, large);
-}
-
-void nvttSetInputOptionsNormalizeMipmaps(NvttInputOptions * inputOptions, NvttBoolean b)
-{
- inputOptions->setNormalizeMipmaps(b != NVTT_False);
-}
-
-void nvttSetInputOptionsColorTransform(NvttInputOptions * inputOptions, NvttColorTransform t)
-{
- inputOptions->setColorTransform((nvtt::ColorTransform)t);
-}
-
-void nvttSetInputOptionsLinearTransfrom(NvttInputOptions * inputOptions, int channel, float w0, float w1, float w2, float w3)
-{
- inputOptions->setLinearTransform(channel, w0, w1, w2, w3);
-}
-
-void nvttSetInputOptionsMaxExtents(NvttInputOptions * inputOptions, int dim)
-{
- inputOptions->setMaxExtents(dim);
-}
-
-void nvttSetInputOptionsRoundMode(NvttInputOptions * inputOptions, NvttRoundMode mode)
-{
- inputOptions->setRoundMode((nvtt::RoundMode)mode);
-}
-
-
-// CompressionOptions class.
-NvttCompressionOptions * nvttCreateCompressionOptions()
-{
- return new nvtt::CompressionOptions();
-}
-
-void nvttDestroyCompressionOptions(NvttCompressionOptions * compressionOptions)
-{
- delete compressionOptions;
-}
-
-void nvttSetCompressionOptionsFormat(NvttCompressionOptions * compressionOptions, NvttFormat format)
-{
- compressionOptions->setFormat((nvtt::Format)format);
-}
-
-void nvttSetCompressionOptionsQuality(NvttCompressionOptions * compressionOptions, NvttQuality quality)
-{
- compressionOptions->setQuality((nvtt::Quality)quality);
-}
-
-void nvttSetCompressionOptionsColorWeights(NvttCompressionOptions * compressionOptions, float red, float green, float blue, float alpha)
-{
- compressionOptions->setColorWeights(red, green, blue, alpha);
-}
-
-/*void nvttEnableCompressionOptionsCudaCompression(NvttCompressionOptions * compressionOptions, NvttBoolean enable)
-{
- compressionOptions->enableCudaCompression(enable != NVTT_False);
-}*/
-
-void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask)
-{
- compressionOptions->setPixelFormat(bitcount, rmask, gmask, bmask, amask);
-}
-
-void nvttSetCompressionOptionsQuantization(NvttCompressionOptions * compressionOptions, NvttBoolean colorDithering, NvttBoolean alphaDithering, NvttBoolean binaryAlpha, int alphaThreshold)
-{
- compressionOptions->setQuantization(colorDithering != NVTT_False, alphaDithering != NVTT_False, binaryAlpha != NVTT_False, alphaThreshold);
-}
-
-
-// OutputOptions class.
-NvttOutputOptions * nvttCreateOutputOptions()
-{
- return new nvtt::OutputOptions();
-}
-
-void nvttDestroyOutputOptions(NvttOutputOptions * outputOptions)
-{
- delete outputOptions;
-}
-
-void nvttSetOutputOptionsFileName(NvttOutputOptions * outputOptions, const char * fileName)
-{
- outputOptions->setFileName(fileName);
-}
-
-void nvttSetOutputOptionsOutputHeader(NvttOutputOptions * outputOptions, NvttBoolean b)
-{
- outputOptions->setOutputHeader(b != NVTT_False);
-}
-/*
-void nvttSetOutputOptionsErrorHandler(NvttOutputOptions * outputOptions, nvttErrorHandler errorHandler)
-{
- outputOptions->setErrorHandler(errorHandler);
-}
-
-void nvttSetOutputOptionsOutputHandler(NvttOutputOptions * outputOptions, nvttOutputHandler outputHandler, nvttImageHandler imageHandler)
-{
-}
-*/
-
-
-// Compressor class.
-NvttBoolean nvttCompress(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions, const NvttOutputOptions * outputOptions)
-{
- return (NvttBoolean)compressor->process(*inputOptions, *compressionOptions, *outputOptions);
-}
-
-int nvttEstimateSize(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions)
-{
- return compressor->estimateSize(*inputOptions, *compressionOptions);
-}
-
-
-// Global functions.
-const char * nvttErrorString(NvttError e)
-{
- return nvtt::errorString((nvtt::Error)e);
-}
-
-unsigned int nvttVersion()
-{
- return nvtt::version();
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt_wrapper.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt_wrapper.h
deleted file mode 100644
index 977a14d3..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/nvtt_wrapper.h
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef NVTT_WRAPPER_H
-#define NVTT_WRAPPER_H
-
-// Function linkage
-#if NVTT_SHARED
-
-#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined __MINGW32__
-# ifdef NVTT_EXPORTS
-# define NVTT_API __declspec(dllexport)
-# else
-# define NVTT_API __declspec(dllimport)
-# endif
-#endif
-
-#if defined __GNUC__ >= 4
-# ifdef NVTT_EXPORTS
-# define NVTT_API __attribute__((visibility("default")))
-# endif
-#endif
-
-#endif // NVTT_SHARED
-
-#if !defined NVTT_API
-# define NVTT_API
-#endif
-
-#define NVTT_VERSION 201
-
-#ifdef __cplusplus
-typedef struct nvtt::InputOptions NvttInputOptions;
-typedef struct nvtt::CompressionOptions NvttCompressionOptions;
-typedef struct nvtt::OutputOptions NvttOutputOptions;
-typedef struct nvtt::Compressor NvttCompressor;
-#else
-typedef struct NvttInputOptions NvttInputOptions;
-typedef struct NvttCompressionOptions NvttCompressionOptions;
-typedef struct NvttOutputOptions NvttOutputOptions;
-typedef struct NvttCompressor NvttCompressor;
-#endif
-
-/// Supported compression formats.
-typedef enum
-{
- // No compression.
- NVTT_Format_RGB,
- NVTT_Format_RGBA = NVTT_Format_RGB,
-
- // DX9 formats.
- NVTT_Format_DXT1,
- NVTT_Format_DXT1a,
- NVTT_Format_DXT3,
- NVTT_Format_DXT5,
- NVTT_Format_DXT5n,
-
- // DX10 formats.
- NVTT_Format_BC1 = NVTT_Format_DXT1,
- NVTT_Format_BC1a = NVTT_Format_DXT1a,
- NVTT_Format_BC2 = NVTT_Format_DXT3,
- NVTT_Format_BC3 = NVTT_Format_DXT5,
- NVTT_Format_BC3n = NVTT_Format_DXT5n,
- NVTT_Format_BC4,
- NVTT_Format_BC5,
-} NvttFormat;
-
-/// Quality modes.
-typedef enum
-{
- NVTT_Quality_Fastest,
- NVTT_Quality_Normal,
- NVTT_Quality_Production,
- NVTT_Quality_Highest,
-} NvttQuality;
-
-/// Wrap modes.
-typedef enum
-{
- NVTT_WrapMode_Clamp,
- NVTT_WrapMode_Repeat,
- NVTT_WrapMode_Mirror,
-} NvttWrapMode;
-
-/// Texture types.
-typedef enum
-{
- NVTT_TextureType_2D,
- NVTT_TextureType_Cube,
-} NvttTextureType;
-
-/// Input formats.
-typedef enum
-{
- NVTT_InputFormat_BGRA_8UB,
-} NvttInputFormat;
-
-/// Mipmap downsampling filters.
-typedef enum
-{
- NVTT_MipmapFilter_Box,
- NVTT_MipmapFilter_Triangle,
- NVTT_MipmapFilter_Kaiser,
-} NvttMipmapFilter;
-
-/// Color transformation.
-typedef enum
-{
- NVTT_ColorTransform_None,
- NVTT_ColorTransform_Linear,
-} NvttColorTransform;
-
-/// Extents rounding mode.
-typedef enum
-{
- NVTT_RoundMode_None,
- NVTT_RoundMode_ToNextPowerOfTwo,
- NVTT_RoundMode_ToNearestPowerOfTwo,
- NVTT_RoundMode_ToPreviousPowerOfTwo,
-} NvttRoundMode;
-
-/// Alpha mode.
-typedef enum
-{
- NVTT_AlphaMode_None,
- NVTT_AlphaMode_Transparency,
- NVTT_AlphaMode_Premultiplied,
-} NvttAlphaMode;
-
-typedef enum
-{
- NVTT_Error_InvalidInput,
- NVTT_Error_UserInterruption,
- NVTT_Error_UnsupportedFeature,
- NVTT_Error_CudaError,
- NVTT_Error_Unknown,
- NVTT_Error_FileOpen,
- NVTT_Error_FileWrite,
- NVTT_Error_UnsupportedOutputFormat,
-} NvttError;
-
-typedef enum
-{
- NVTT_False,
- NVTT_True,
-} NvttBoolean;
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Callbacks
-//typedef void (* nvttErrorHandler)(NvttError e);
-//typedef void (* nvttOutputHandler)(const void * data, int size);
-//typedef void (* nvttImageHandler)(int size, int width, int height, int depth, int face, int miplevel);
-
-
-// InputOptions class.
-NVTT_API NvttInputOptions * nvttCreateInputOptions();
-NVTT_API void nvttDestroyInputOptions(NvttInputOptions * inputOptions);
-
-NVTT_API void nvttSetInputOptionsTextureLayout(NvttInputOptions * inputOptions, NvttTextureType type, int w, int h, int d);
-NVTT_API void nvttResetInputOptionsTextureLayout(NvttInputOptions * inputOptions);
-NVTT_API NvttBoolean nvttSetInputOptionsMipmapData(NvttInputOptions * inputOptions, const void * data, int w, int h, int d, int face, int mipmap);
-NVTT_API void nvttSetInputOptionsFormat(NvttInputOptions * inputOptions, NvttInputFormat format);
-NVTT_API void nvttSetInputOptionsAlphaMode(NvttInputOptions * inputOptions, NvttAlphaMode alphaMode);
-NVTT_API void nvttSetInputOptionsGamma(NvttInputOptions * inputOptions, float inputGamma, float outputGamma);
-NVTT_API void nvttSetInputOptionsWrapMode(NvttInputOptions * inputOptions, NvttWrapMode mode);
-NVTT_API void nvttSetInputOptionsMipmapFilter(NvttInputOptions * inputOptions, NvttMipmapFilter filter);
-NVTT_API void nvttSetInputOptionsMipmapGeneration(NvttInputOptions * inputOptions, NvttBoolean enabled, int maxLevel);
-NVTT_API void nvttSetInputOptionsKaiserParameters(NvttInputOptions * inputOptions, float width, float alpha, float stretch);
-NVTT_API void nvttSetInputOptionsNormalMap(NvttInputOptions * inputOptions, NvttBoolean b);
-NVTT_API void nvttSetInputOptionsConvertToNormalMap(NvttInputOptions * inputOptions, NvttBoolean convert);
-NVTT_API void nvttSetInputOptionsHeightEvaluation(NvttInputOptions * inputOptions, float redScale, float greenScale, float blueScale, float alphaScale);
-NVTT_API void nvttSetInputOptionsNormalFilter(NvttInputOptions * inputOptions, float sm, float medium, float big, float large);
-NVTT_API void nvttSetInputOptionsNormalizeMipmaps(NvttInputOptions * inputOptions, NvttBoolean b);
-NVTT_API void nvttSetInputOptionsColorTransform(NvttInputOptions * inputOptions, NvttColorTransform t);
-NVTT_API void nvttSetInputOptionsLinearTransform(NvttInputOptions * inputOptions, int channel, float w0, float w1, float w2, float w3);
-NVTT_API void nvttSetInputOptionsMaxExtents(NvttInputOptions * inputOptions, int dim);
-NVTT_API void nvttSetInputOptionsRoundMode(NvttInputOptions * inputOptions, NvttRoundMode mode);
-
-
-// CompressionOptions class.
-NVTT_API NvttCompressionOptions * nvttCreateCompressionOptions();
-NVTT_API void nvttDestroyCompressionOptions(NvttCompressionOptions * compressionOptions);
-
-NVTT_API void nvttSetCompressionOptionsFormat(NvttCompressionOptions * compressionOptions, NvttFormat format);
-NVTT_API void nvttSetCompressionOptionsQuality(NvttCompressionOptions * compressionOptions, NvttQuality quality);
-NVTT_API void nvttSetCompressionOptionsColorWeights(NvttCompressionOptions * compressionOptions, float red, float green, float blue, float alpha);
-NVTT_API void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask);
-NVTT_API void nvttSetCompressionOptionsQuantization(NvttCompressionOptions * compressionOptions, NvttBoolean colorDithering, NvttBoolean alphaDithering, NvttBoolean binaryAlpha, int alphaThreshold);
-
-
-// OutputOptions class.
-NVTT_API NvttOutputOptions * nvttCreateOutputOptions();
-NVTT_API void nvttDestroyOutputOptions(NvttOutputOptions * outputOptions);
-
-NVTT_API void nvttSetOutputOptionsFileName(NvttOutputOptions * outputOptions, const char * fileName);
-NVTT_API void nvttSetOutputOptionsOutputHeader(NvttOutputOptions * outputOptions, NvttBoolean b);
-//NVTT_API void nvttSetOutputOptionsErrorHandler(NvttOutputOptions * outputOptions, nvttErrorHandler errorHandler);
-//NVTT_API void nvttSetOutputOptionsOutputHandler(NvttOutputOptions * outputOptions, nvttOutputHandler outputHandler, nvttImageHandler imageHandler);
-
-
-// Compressor class.
-NVTT_API NvttCompressor * nvttCreateCompressor();
-NVTT_API void nvttDestroyCompressor(NvttCompressor * compressor);
-
-NVTT_API NvttBoolean nvttCompress(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions, const NvttOutputOptions * outputOptions);
-NVTT_API int nvttEstimateSize(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions);
-
-
-// Global functions.
-NVTT_API const char * nvttErrorString(NvttError e);
-NVTT_API unsigned int nvttVersion();
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // NVTT_WRAPPER_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/CMakeLists.txt b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/CMakeLists.txt
deleted file mode 100644
index 2edc683f..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-PROJECT(squish)
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-
-SET(SQUISH_SRCS
- fastclusterfit.cpp
- fastclusterfit.h
- weightedclusterfit.cpp
- weightedclusterfit.h
- colourblock.cpp
- colourblock.h
- colourfit.cpp
- colourfit.h
- colourset.cpp
- colourset.h
- config.h
- maths.cpp
- maths.h
- simd.h
- simd_sse.h
- simd_ve.h)
-
-ADD_LIBRARY(squish STATIC ${SQUISH_SRCS})
-
-IF(CMAKE_COMPILER_IS_GNUCXX)
- SET_TARGET_PROPERTIES(squish PROPERTIES COMPILE_FLAGS -fPIC)
-ENDIF(CMAKE_COMPILER_IS_GNUCXX)
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/ChangeLog b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/ChangeLog
deleted file mode 100644
index e074a891..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/ChangeLog
+++ /dev/null
@@ -1,38 +0,0 @@
-
-1.7
-* Fixed floating-point equality issue in clusterfit sort (x86 affected only)
-* Implemented proper SSE(2) floor function for 50% speedup on SSE builds
-* The range fit implementation now uses the correct colour metric
-
-1.6
-* Fixed bug in CompressImage where masked pixels were not skipped over
-* DXT3 and DXT5 alpha compression now properly use the mask to ignore pixels
-* Fixed major DXT1 bug that can generate unexpected transparent pixels
-
-1.5
-* Added CompressMasked function to handle incomplete DXT blocks more cleanly
-* Added kWeightColourByAlpha flag for better quality images when alpha blending
-
-1.4
-* Fixed stack overflow in rangefit
-
-1.3
-* Worked around SSE floor implementation bug, proper fix needed!
-* This release has visual studio and makefile builds that work
-
-1.2
-* Added provably optimal single colour compressor
-* Added extra/squishgen.cpp that generates single colour lookup tables
-
-1.1
-* Fixed a DXT1 colour output bug
-* Changed argument order for Decompress function to match Compress
-* Added GetStorageRequirements function
-* Added CompressImage function
-* Added DecompressImage function
-* Moved squishtool.cpp to extra/squishpng.cpp
-* Added extra/squishtest.cpp
-
-1.0
-* Initial release
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/Doxyfile b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/Doxyfile
deleted file mode 100644
index 3ec51e4b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/Doxyfile
+++ /dev/null
@@ -1,223 +0,0 @@
-# Doxyfile 1.4.6
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = squish
-PROJECT_NUMBER = 1.1
-OUTPUT_DIRECTORY = docs
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = YES
-STRIP_FROM_PATH =
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-SEPARATE_MEMBER_PAGES = NO
-TAB_SIZE = 4
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = NO
-OPTIMIZE_OUTPUT_JAVA = NO
-BUILTIN_STL_SUPPORT = NO
-DISTRIBUTE_GROUP_DOC = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = NO
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = NO
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-SHOW_DIRECTORIES = NO
-FILE_VERSION_FILTER =
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = YES
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_NO_PARAMDOC = NO
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = squish.h
-FILE_PATTERNS =
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-USE_HTAGS = NO
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = YES
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-GROUP_GRAPHS = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DIRECTORY_GRAPH = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH = /Applications/Graphviz.app/Contents/MacOS
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 0
-DOT_TRANSPARENT = NO
-DOT_MULTI_TARGETS = NO
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/README b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/README
deleted file mode 100644
index 62b26747..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/README
+++ /dev/null
@@ -1,35 +0,0 @@
-LICENSE
--------
-
-The squish library is distributed under the terms and conditions of the MIT
-license. This license is specified at the top of each source file and must be
-preserved in its entirety.
-
-BUILDING AND INSTALLING THE LIBRARY
------------------------------------
-
-If you are using Visual Studio 2003 or above under Windows then load the Visual
-Studio 2003 project in the vs7 folder. By default, the library is built using
-SSE optimisations. To change this either change or remove the SQUISH_USE_SSE=1
-from the preprocessor symbols.
-
-If you are using a Mac then load the Xcode 2.2 project in the distribution. By
-default, the library is built using Altivec optimisations. To change this
-either change or remove SQUISH_USE_ALTIVEC=1 from the preprocessor symbols. I
-guess I'll have to think about changing this for the new Intel Macs that are
-rolling out...
-
-If you are using unix then first edit the config file in the base directory of
-the distribution, enabling Altivec or SSE with the USE_ALTIVEC or USE_SSE
-variables, and editing the optimisation flags passed to the C++ compiler if
-necessary. Then make can be used to build the library, and make install (from
-the superuser account) can be used to install (into /usr/local by default).
-
-REPORTING BUGS OR FEATURE REQUESTS
-----------------------------------
-
-Feedback can be sent to Simon Brown (the developer) at si@sjbrown.co.uk
-
-New releases are announced on the squish library homepage at
-http://sjbrown.co.uk/?code=squish
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/alpha.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/alpha.cpp
deleted file mode 100644
index 4242bb8f..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/alpha.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "alpha.h"
-#include <algorithm>
-
-namespace squish {
-
-static int FloatToInt( float a, int limit )
-{
- // use ANSI round-to-zero behaviour to get round-to-nearest
- int i = ( int )( a + 0.5f );
-
- // clamp to the limit
- if( i < 0 )
- i = 0;
- else if( i > limit )
- i = limit;
-
- // done
- return i;
-}
-
-void CompressAlphaDxt3( u8 const* rgba, void* block )
-{
- u8* bytes = reinterpret_cast< u8* >( block );
-
- // quantise and pack the alpha values pairwise
- for( int i = 0; i < 8; ++i )
- {
- // quantise down to 4 bits
- float alpha1 = ( float )rgba[8*i + 3] * ( 15.0f/255.0f );
- float alpha2 = ( float )rgba[8*i + 7] * ( 15.0f/255.0f );
- int quant1 = FloatToInt( alpha1, 15 );
- int quant2 = FloatToInt( alpha2, 15 );
-
- // pack into the byte
- bytes[i] = ( u8 )( quant1 | ( quant2 << 4 ) );
- }
-}
-
-void DecompressAlphaDxt3( u8* rgba, void const* block )
-{
- u8 const* bytes = reinterpret_cast< u8 const* >( block );
-
- // unpack the alpha values pairwise
- for( int i = 0; i < 8; ++i )
- {
- // quantise down to 4 bits
- u8 quant = bytes[i];
-
- // unpack the values
- u8 lo = quant & 0x0f;
- u8 hi = quant & 0xf0;
-
- // convert back up to bytes
- rgba[8*i + 3] = lo | ( lo << 4 );
- rgba[8*i + 7] = hi | ( hi >> 4 );
- }
-}
-
-static void FixRange( int& min, int& max, int steps )
-{
- if( max - min < steps )
- max = std::min( min + steps, 255 );
- if( max - min < steps )
- min = std::max( 0, max - steps );
-}
-
-static int FitCodes( u8 const* rgba, u8 const* codes, u8* indices )
-{
- // fit each alpha value to the codebook
- int err = 0;
- for( int i = 0; i < 16; ++i )
- {
- // find the least error and corresponding index
- int value = rgba[4*i + 3];
- int least = INT_MAX;
- int index = 0;
- for( int j = 0; j < 8; ++j )
- {
- // get the squared error from this code
- int dist = ( int )value - ( int )codes[j];
- dist *= dist;
-
- // compare with the best so far
- if( dist < least )
- {
- least = dist;
- index = j;
- }
- }
-
- // save this index and accumulate the error
- indices[i] = ( u8 )index;
- err += least;
- }
-
- // return the total error
- return err;
-}
-
-static void WriteAlphaBlock( int alpha0, int alpha1, u8 const* indices, void* block )
-{
- u8* bytes = reinterpret_cast< u8* >( block );
-
- // write the first two bytes
- bytes[0] = ( u8 )alpha0;
- bytes[1] = ( u8 )alpha1;
-
- // pack the indices with 3 bits each
- u8* dest = bytes + 2;
- u8 const* src = indices;
- for( int i = 0; i < 2; ++i )
- {
- // pack 8 3-bit values
- int value = 0;
- for( int j = 0; j < 8; ++j )
- {
- int index = *src++;
- value |= ( index << 3*j );
- }
-
- // store in 3 bytes
- for( int j = 0; j < 3; ++j )
- {
- int byte = ( value >> 8*j ) & 0xff;
- *dest++ = ( u8 )byte;
- }
- }
-}
-
-static void WriteAlphaBlock5( int alpha0, int alpha1, u8 const* indices, void* block )
-{
- // check the relative values of the endpoints
- if( alpha0 > alpha1 )
- {
- // swap the indices
- u8 swapped[16];
- for( int i = 0; i < 16; ++i )
- {
- u8 index = indices[i];
- if( index == 0 )
- swapped[i] = 1;
- else if( index == 1 )
- swapped[i] = 0;
- else if( index <= 5 )
- swapped[i] = 7 - index;
- else
- swapped[i] = index;
- }
-
- // write the block
- WriteAlphaBlock( alpha1, alpha0, swapped, block );
- }
- else
- {
- // write the block
- WriteAlphaBlock( alpha0, alpha1, indices, block );
- }
-}
-
-static void WriteAlphaBlock7( int alpha0, int alpha1, u8 const* indices, void* block )
-{
- // check the relative values of the endpoints
- if( alpha0 < alpha1 )
- {
- // swap the indices
- u8 swapped[16];
- for( int i = 0; i < 16; ++i )
- {
- u8 index = indices[i];
- if( index == 0 )
- swapped[i] = 1;
- else if( index == 1 )
- swapped[i] = 0;
- else
- swapped[i] = 9 - index;
- }
-
- // write the block
- WriteAlphaBlock( alpha1, alpha0, swapped, block );
- }
- else
- {
- // write the block
- WriteAlphaBlock( alpha0, alpha1, indices, block );
- }
-}
-
-void CompressAlphaDxt5( u8 const* rgba, void* block )
-{
- // get the range for 5-alpha and 7-alpha interpolation
- int min5 = 255;
- int max5 = 0;
- int min7 = 255;
- int max7 = 0;
- for( int i = 0; i < 16; ++i )
- {
- // incorporate into the min/max
- int value = rgba[4*i + 3];
- if( value < min7 )
- min7 = value;
- if( value > max7 )
- max7 = value;
- if( value != 0 && value < min5 )
- min5 = value;
- if( value != 255 && value > max5 )
- max5 = value;
- }
-
- // handle the case that no valid range was found
- if( min5 > max5 )
- min5 = max5;
- if( min7 > max7 )
- min7 = max7;
-
- // fix the range to be the minimum in each case
- FixRange( min5, max5, 5 );
- FixRange( min7, max7, 7 );
-
- // set up the 5-alpha code book
- u8 codes5[8];
- codes5[0] = ( u8 )min5;
- codes5[1] = ( u8 )max5;
- for( int i = 1; i < 5; ++i )
- codes5[1 + i] = ( u8 )( ( ( 5 - i )*min5 + i*max5 )/5 );
- codes5[6] = 0;
- codes5[7] = 255;
-
- // set up the 7-alpha code book
- u8 codes7[8];
- codes7[0] = ( u8 )min7;
- codes7[1] = ( u8 )max7;
- for( int i = 1; i < 7; ++i )
- codes7[1 + i] = ( u8 )( ( ( 7 - i )*min7 + i*max7 )/7 );
-
- // fit the data to both code books
- u8 indices5[16];
- u8 indices7[16];
- int err5 = FitCodes( rgba, codes5, indices5 );
- int err7 = FitCodes( rgba, codes7, indices7 );
-
- // save the block with least error
- if( err5 <= err7 )
- WriteAlphaBlock5( min5, max5, indices5, block );
- else
- WriteAlphaBlock7( min7, max7, indices7, block );
-}
-
-void DecompressAlphaDxt5( u8* rgba, void const* block )
-{
- // get the two alpha values
- u8 const* bytes = reinterpret_cast< u8 const* >( block );
- int alpha0 = bytes[0];
- int alpha1 = bytes[1];
-
- // compare the values to build the codebook
- u8 codes[8];
- codes[0] = ( u8 )alpha0;
- codes[1] = ( u8 )alpha1;
- if( alpha0 <= alpha1 )
- {
- // use 5-alpha codebook
- for( int i = 1; i < 5; ++i )
- codes[1 + i] = ( u8 )( ( ( 5 - i )*alpha0 + i*alpha1 )/5 );
- codes[6] = 0;
- codes[7] = 255;
- }
- else
- {
- // use 7-alpha codebook
- for( int i = 1; i < 7; ++i )
- codes[1 + i] = ( u8 )( ( ( 7 - i )*alpha0 + i*alpha1 )/7 );
- }
-
- // decode the indices
- u8 indices[16];
- u8 const* src = bytes + 2;
- u8* dest = indices;
- for( int i = 0; i < 2; ++i )
- {
- // grab 3 bytes
- int value = 0;
- for( int j = 0; j < 3; ++j )
- {
- int byte = *src++;
- value |= ( byte << 8*j );
- }
-
- // unpack 8 3-bit values from it
- for( int j = 0; j < 8; ++j )
- {
- int index = ( value >> 3*j ) & 0x7;
- *dest++ = ( u8 )index;
- }
- }
-
- // write out the indexed codebook values
- for( int i = 0; i < 16; ++i )
- rgba[4*i + 3] = codes[indices[i]];
-}
-
-} // namespace squish
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/alpha.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/alpha.h
deleted file mode 100644
index d09ba0e9..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/alpha.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_ALPHA_H
-#define SQUISH_ALPHA_H
-
-#include <squish.h>
-
-namespace squish {
-
-void CompressAlphaDxt3( u8 const* rgba, void* block );
-void CompressAlphaDxt5( u8 const* rgba, void* block );
-
-void DecompressAlphaDxt3( u8* rgba, void const* block );
-void DecompressAlphaDxt5( u8* rgba, void const* block );
-
-} // namespace squish
-
-#endif // ndef SQUISH_ALPHA_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/clusterfit.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/clusterfit.cpp
deleted file mode 100644
index 17093465..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/clusterfit.cpp
+++ /dev/null
@@ -1,493 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "clusterfit.h"
-#include "colourset.h"
-#include "colourblock.h"
-#include <cfloat>
-
-namespace nvsquish {
-
-ClusterFit::ClusterFit()
-{
-}
-
-void ClusterFit::SetColourSet( ColourSet const* colours, int flags )
-{
- ColourFit::SetColourSet( colours, flags );
-
- // initialise the best error
-#if SQUISH_USE_SIMD
- m_besterror = VEC4_CONST( FLT_MAX );
- Vec3 metric = m_metric.GetVec3();
-#else
- m_besterror = FLT_MAX;
- Vec3 metric = m_metric;
-#endif
-
- // cache some values
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
-
- // get the covariance matrix
- Sym3x3 covariance = ComputeWeightedCovariance( count, values, m_colours->GetWeights(), metric );
-
- // compute the principle component
- Vec3 principle = ComputePrincipleComponent( covariance );
-
- // build the list of values
- float dps[16];
- for( int i = 0; i < count; ++i )
- {
- dps[i] = Dot( values[i], principle );
- m_order[i] = i;
- }
-
- // stable sort
- for( int i = 0; i < count; ++i )
- {
- for( int j = i; j > 0 && dps[j] < dps[j - 1]; --j )
- {
- std::swap( dps[j], dps[j - 1] );
- std::swap( m_order[j], m_order[j - 1] );
- }
- }
-
- // weight all the points
-#if SQUISH_USE_SIMD
- Vec4 const* unweighted = m_colours->GetPointsSimd();
- Vec4 const* weights = m_colours->GetWeightsSimd();
- m_xxsum = VEC4_CONST( 0.0f );
-#else
- Vec3 const* unweighted = m_colours->GetPoints();
- float const* weights = m_colours->GetWeights();
- m_xxsum = Vec3( 0.0f );
-#endif
- for( int i = 0; i < count; ++i )
- {
- int p = m_order[i];
- m_unweighted[i] = unweighted[p];
- m_weights[i] = weights[p];
- m_weighted[i] = weights[p]*unweighted[p];
- m_xxsum += m_weighted[i]*m_weighted[i];
- }
-}
-
-
-void ClusterFit::SetMetric(float r, float g, float b)
-{
-#if SQUISH_USE_SIMD
- m_metric = Vec4(r, g, b, 0);
-#else
- m_metric = Vec3(r, g, b);
-#endif
- m_metricSqr = m_metric * m_metric;
-}
-
-float ClusterFit::GetBestError() const
-{
-#if SQUISH_USE_SIMD
- return m_besterror.GetVec3().X();
-#else
- return m_besterror;
-#endif
-}
-
-
-void ClusterFit::Compress3( void* block )
-{
- // declare variables
- int const count = m_colours->GetCount();
-#if SQUISH_USE_SIMD
- Vec4 beststart = VEC4_CONST( 0.0f );
- Vec4 bestend = VEC4_CONST( 0.0f );
- Vec4 besterror = VEC4_CONST( FLT_MAX );
- Vec4 const half = VEC4_CONST( 0.5f );
- Vec4 const zero = VEC4_CONST( 0.0f );
-#else
- Vec3 beststart( 0.0f );
- Vec3 bestend( 0.0f );
- float besterror = FLT_MAX;
- float const half = 0.5f;
- float const zero = 0.0f;
-#endif
-
- // check all possible clusters for this total order
- u8 indices[16];
- u8 bestindices[16];
-
- // first cluster [0,i) is at the start
- for( int m = 0; m < count; ++m )
- {
- indices[m] = 0;
- m_alpha[m] = m_weights[m];
- m_beta[m] = zero;
- }
- for( int i = count; i >= 0; --i )
- {
- // second cluster [i,j) is half along
- for( int m = i; m < count; ++m )
- {
- indices[m] = 2;
- m_alpha[m] = m_beta[m] = half*m_weights[m];
- }
- for( int j = count; j > i; --j )
- {
- // last cluster [j,k) is at the end
- if( j < count )
- {
- indices[j] = 1;
- m_alpha[j] = zero;
- m_beta[j] = m_weights[j];
- }
-
- // solve a least squares problem to place the endpoints
-#if SQUISH_USE_SIMD
- Vec4 start, end;
- Vec4 error = SolveLeastSquares( start, end );
-#else
- Vec3 start, end;
- float error = SolveLeastSquares( start, end );
-#endif
-
- // keep the solution if it wins
-#if SQUISH_USE_SIMD
- if( CompareAnyLessThan( error, besterror ) )
-#else
- if( error < besterror )
-#endif
- {
- beststart = start;
- bestend = end;
- for( int m = 0; m < 16; ++m ) // TODO: make this faster?
- bestindices[m] = indices[m];
- besterror = error;
- }
- }
- }
-
- // save the block if necessary
-#if SQUISH_USE_SIMD
- if( CompareAnyLessThan( besterror, m_besterror ) )
-#else
- if( besterror < m_besterror )
-#endif
- {
- // remap the indices
- u8 unordered[16];
- for( int i = 0; i < count; ++i )
- unordered[m_order[i]] = bestindices[i];
- m_colours->RemapIndices( unordered, bestindices );
-
- // save the block
-#if SQUISH_USE_SIMD
- WriteColourBlock3( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );
-#else
- WriteColourBlock3( beststart, bestend, bestindices, block );
-#endif
-
- // save the error
- m_besterror = besterror;
- }
-}
-
-//static int run = 0;
-//static bool debug = false;
-
-void ClusterFit::Compress4( void* block )
-{
- //debug = (run == 1);
- //run++;
-
- // declare variables
- int const count = m_colours->GetCount();
-#if SQUISH_USE_SIMD
- Vec4 beststart = VEC4_CONST( 0.0f );
- Vec4 bestend = VEC4_CONST( 0.0f );
- Vec4 besterror = m_besterror;
- Vec4 const twothirds = VEC4_CONST( 2.0f/3.0f );
- Vec4 const onethird = VEC4_CONST( 1.0f/3.0f );
- Vec4 const zero = VEC4_CONST( 0.0f );
-#else
- Vec3 beststart( 0.0f );
- Vec3 bestend( 0.0f );
- float besterror = m_besterror;
- float const twothirds = 2.0f/3.0f;
- float const onethird = 1.0f/3.0f;
- float const zero = 0.0f;
-#endif
-
- // check all possible clusters for this total order
- u8 indices[16];
- u8 bestindices[16];
-
- // first cluster [0,i) is at the start
- for( int m = 0; m < count; ++m )
- {
- indices[m] = 0;
- m_alpha[m] = m_weights[m];
- m_beta[m] = zero;
- }
- for( int i = count; i >= 0; --i )
- {
- // second cluster [i,j) is one third along
- for( int m = i; m < count; ++m )
- {
- indices[m] = 2;
- m_alpha[m] = twothirds*m_weights[m];
- m_beta[m] = onethird*m_weights[m];
- }
- for( int j = count; j >= i; --j )
- {
- // third cluster [j,k) is two thirds along
- for( int m = j; m < count; ++m )
- {
- indices[m] = 3;
- m_alpha[m] = onethird*m_weights[m];
- m_beta[m] = twothirds*m_weights[m];
- }
- for( int k = count; k >= j; --k )
- {
- if (j + k == 0) continue;
-
- // last cluster [k,n) is at the end
- if( k < count )
- {
- indices[k] = 1;
- m_alpha[k] = zero;
- m_beta[k] = m_weights[k];
- }
-
- /*unsigned int permutation = 0;
- for(int p = 0; p < 16; p++) {
- permutation |= indices[p] << (p * 2);
- }
- if (debug) printf("%X:\t", permutation);
-
- if (debug && permutation == 0x55FFFFAA) __debugbreak();
- */
-
- // solve a least squares problem to place the endpoints
-#if SQUISH_USE_SIMD
- Vec4 start, end;
- Vec4 error = SolveLeastSquares( start, end );
-#else
- Vec3 start, end;
- float error = SolveLeastSquares( start, end );
-#endif
-
- // keep the solution if it wins
-#if SQUISH_USE_SIMD
- if( CompareAnyLessThan( error, besterror ) )
-#else
- if( error < besterror )
-#endif
- {
- beststart = start;
- bestend = end;
- for( int m = 0; m < 16; ++m ) // TODO: make this faster?
- bestindices[m] = indices[m];
- besterror = error;
- }
- }
- }
- }
-
- // save the block if necessary
-#if SQUISH_USE_SIMD
- if( CompareAnyLessThan( besterror, m_besterror ) )
-#else
- if( besterror < m_besterror )
-#endif
- {
- // remap the indices
- u8 unordered[16];
- for( int i = 0; i < count; ++i )
- unordered[m_order[i]] = bestindices[i];
- m_colours->RemapIndices( unordered, bestindices );
-
- // save the block
-#if SQUISH_USE_SIMD
- WriteColourBlock4( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );
-#else
- WriteColourBlock4( beststart, bestend, bestindices, block );
-#endif
-
- // save the error
- m_besterror = besterror;
- }
-}
-
-#if SQUISH_USE_SIMD
-Vec4 ClusterFit::SolveLeastSquares( Vec4& start, Vec4& end ) const
-{
- // accumulate all the quantities we need
- int const count = m_colours->GetCount();
- Vec4 alpha2_sum = VEC4_CONST( 0.0f );
- Vec4 beta2_sum = VEC4_CONST( 0.0f );
- Vec4 alphabeta_sum = VEC4_CONST( 0.0f );
- Vec4 alphax_sum = VEC4_CONST( 0.0f );
- Vec4 betax_sum = VEC4_CONST( 0.0f );
- for( int i = 0; i < count; ++i )
- {
- Vec4 alpha = m_alpha[i];
- Vec4 beta = m_beta[i];
- Vec4 x = m_weighted[i];
-
- alpha2_sum = MultiplyAdd( alpha, alpha, alpha2_sum );
- beta2_sum = MultiplyAdd( beta, beta, beta2_sum );
- alphabeta_sum = MultiplyAdd( alpha, beta, alphabeta_sum );
- alphax_sum = MultiplyAdd( alpha, x, alphax_sum );
- betax_sum = MultiplyAdd( beta, x, betax_sum );
- }
-
- // select the results
- Vec4 const zero = VEC4_CONST( 0.0f );
- Vec4 beta2_sum_zero = CompareEqual( beta2_sum, zero );
- Vec4 alpha2_sum_zero = CompareEqual( alpha2_sum, zero );
-
- Vec4 a1 = alphax_sum*Reciprocal( alpha2_sum );
- Vec4 b1 = betax_sum*Reciprocal( beta2_sum );
-
- Vec4 factor = Reciprocal( NegativeMultiplySubtract(
- alphabeta_sum, alphabeta_sum, alpha2_sum*beta2_sum
- ) );
- Vec4 a2 = NegativeMultiplySubtract(
- betax_sum, alphabeta_sum, alphax_sum*beta2_sum
- )*factor;
- Vec4 b2 = NegativeMultiplySubtract(
- alphax_sum, alphabeta_sum, betax_sum*alpha2_sum
- )*factor;
-
- Vec4 a = Select( Select( a2, a1, beta2_sum_zero ), zero, alpha2_sum_zero );
- Vec4 b = Select( Select( b2, b1, alpha2_sum_zero ), zero, beta2_sum_zero );
-
- // clamp the output to [0, 1]
- Vec4 const one = VEC4_CONST( 1.0f );
- Vec4 const half = VEC4_CONST( 0.5f );
- a = Min( one, Max( zero, a ) );
- b = Min( one, Max( zero, b ) );
-
- // clamp to the grid
- Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f );
-// Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f );
- Vec4 const gridrcp( 0.03227752766457f, 0.01583151765563f, 0.03227752766457f, 0.0f ); // IC: use approximate grid fitting.
- Vec4 const onethird = VEC4_CONST( 1.0f/3.0f );
- Vec4 const twothirds = VEC4_CONST( 2.0f/3.0f );
- a = Truncate( MultiplyAdd( grid, a, half ) )*gridrcp;
- b = Truncate( MultiplyAdd( grid, b, half ) )*gridrcp;
-
- // compute the error
- Vec4 const two = VEC4_CONST( 2.0 );
- Vec4 e1 = MultiplyAdd( b*b, beta2_sum, m_xxsum );
- Vec4 e2 = MultiplyAdd( a, alphax_sum, b*betax_sum );
- Vec4 e3 = MultiplyAdd( a*a, alpha2_sum, e1 );
- Vec4 e4 = MultiplyAdd( a*b*alphabeta_sum - e2, two, e3 );
-
- // apply the metric to the error term
- Vec4 e5 = e4*m_metricSqr;
- Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ();
-
- // save the start and end
- start = a;
- end = b;
- return error;
-}
-#else
-float ClusterFit::SolveLeastSquares( Vec3& start, Vec3& end ) const
-{
- // accumulate all the quantities we need
- int const count = m_colours->GetCount();
- float alpha2_sum = 0.0f;
- float beta2_sum = 0.0f;
- float alphabeta_sum = 0.0f;
- Vec3 alphax_sum( 0.0f );
- Vec3 betax_sum( 0.0f );
- for( int i = 0; i < count; ++i )
- {
- float alpha = m_alpha[i];
- float beta = m_beta[i];
- Vec3 const& x = m_weighted[i];
-
- alpha2_sum += alpha*alpha;
- beta2_sum += beta*beta;
- alphabeta_sum += alpha*beta;
- alphax_sum += alpha*x;
- betax_sum += beta*x;
- }
-
- //if (debug) printf("%f %f %f", alpha2_sum, beta2_sum, alphabeta_sum);
-
- // zero where non-determinate
- Vec3 a, b;
- if( beta2_sum == 0.0f )
- {
- a = alphax_sum/alpha2_sum;
- b = Vec3( 0.0f );
- }
- else if( alpha2_sum == 0.0f )
- {
- a = Vec3( 0.0f );
- b = betax_sum/beta2_sum;
- }
- else
- {
- float factor = 1.0f/( alpha2_sum*beta2_sum - alphabeta_sum*alphabeta_sum );
-
- a = ( alphax_sum*beta2_sum - betax_sum*alphabeta_sum )*factor;
- b = ( betax_sum*alpha2_sum - alphax_sum*alphabeta_sum )*factor;
- }
-
- // clamp the output to [0, 1]
- Vec3 const one( 1.0f );
- Vec3 const zero( 0.0f );
- a = Min( one, Max( zero, a ) );
- b = Min( one, Max( zero, b ) );
-
- // clamp to the grid
- Vec3 const grid( 31.0f, 63.0f, 31.0f );
- //Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f );
- Vec3 const gridrcp(0.03227752766457f, 0.01583151765563f, 0.03227752766457f); // IC: use approximate grid fitting.
- Vec3 const half( 0.5f );
- a = Floor( grid*a + half )*gridrcp;
- b = Floor( grid*b + half )*gridrcp;
-
- // compute the error
- Vec3 e1 = a*a*alpha2_sum + b*b*beta2_sum /*+ m_xxsum*/
- + 2.0f*( a*b*alphabeta_sum - a*alphax_sum - b*betax_sum );
-
- // apply the metric to the error term
- float error = Dot( e1, m_metricSqr );
-
- //if (debug) printf(" - %f\n", error);
-
- // save the start and end
- start = a;
- end = b;
- return error;
-}
-#endif
-
-} // namespace squish
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/clusterfit.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/clusterfit.h
deleted file mode 100644
index e115cd3e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/clusterfit.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef NV_SQUISH_CLUSTERFIT_H
-#define NV_SQUISH_CLUSTERFIT_H
-
-#include "squish.h"
-#include "maths.h"
-#include "simd.h"
-#include "colourfit.h"
-
-namespace nvsquish {
-
-class ClusterFit : public ColourFit
-{
-public:
- ClusterFit();
-
- void SetColourSet( ColourSet const* colours, int flags );
-
- void SetMetric(float r, float g, float b);
- float GetBestError() const;
-
-private:
- virtual void Compress3( void* block );
- virtual void Compress4( void* block );
-
- void Reorder( Vec3::Arg principle );
-
- Vec3 m_principle;
-#if SQUISH_USE_SIMD
- Vec4 SolveLeastSquares( Vec4& start, Vec4& end ) const;
-
- Vec4 m_weighted[16];
- Vec4 m_unweighted[16];
- Vec4 m_weights[16];
- Vec4 m_metric;
- Vec4 m_metricSqr;
- Vec4 m_alpha[16];
- Vec4 m_beta[16];
- Vec4 m_xxsum;
- Vec4 m_besterror;
-#else
- float SolveLeastSquares( Vec3& start, Vec3& end ) const;
-
- Vec3 m_weighted[16];
- Vec3 m_unweighted[16];
- float m_weights[16];
- Vec3 m_metric;
- Vec3 m_metricSqr;
- float m_alpha[16];
- float m_beta[16];
- Vec3 m_xxsum;
- float m_besterror;
-#endif
- int m_order[16];
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_CLUSTERFIT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourblock.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourblock.cpp
deleted file mode 100644
index 37e4b02d..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourblock.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "colourblock.h"
-
-namespace nvsquish {
-
-static int FloatToInt( float a, int limit )
-{
- // use ANSI round-to-zero behaviour to get round-to-nearest
- int i = ( int )( a + 0.5f );
-
- // clamp to the limit
- if( i < 0 )
- i = 0;
- else if( i > limit )
- i = limit;
-
- // done
- return i;
-}
-
-static int FloatTo565( Vec3::Arg colour )
-{
- // get the components in the correct range
- int r = FloatToInt( 31.0f*colour.X(), 31 );
- int g = FloatToInt( 63.0f*colour.Y(), 63 );
- int b = FloatToInt( 31.0f*colour.Z(), 31 );
-
- // pack into a single value
- return ( r << 11 ) | ( g << 5 ) | b;
-}
-
-static void WriteColourBlock( int a, int b, u8* indices, void* block )
-{
- // get the block as bytes
- u8* bytes = ( u8* )block;
-
- // write the endpoints
- bytes[0] = ( u8 )( a & 0xff );
- bytes[1] = ( u8 )( a >> 8 );
- bytes[2] = ( u8 )( b & 0xff );
- bytes[3] = ( u8 )( b >> 8 );
-
- // write the indices
- for( int i = 0; i < 4; ++i )
- {
- u8 const* ind = indices + 4*i;
- bytes[4 + i] = ind[0] | ( ind[1] << 2 ) | ( ind[2] << 4 ) | ( ind[3] << 6 );
- }
-}
-
-void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block )
-{
- // get the packed values
- int a = FloatTo565( start );
- int b = FloatTo565( end );
-
- // remap the indices
- u8 remapped[16];
- if( a <= b )
- {
- // use the indices directly
- for( int i = 0; i < 16; ++i )
- remapped[i] = indices[i];
- }
- else
- {
- // swap a and b
- std::swap( a, b );
- for( int i = 0; i < 16; ++i )
- {
- if( indices[i] == 0 )
- remapped[i] = 1;
- else if( indices[i] == 1 )
- remapped[i] = 0;
- else
- remapped[i] = indices[i];
- }
- }
-
- // write the block
- WriteColourBlock( a, b, remapped, block );
-}
-
-void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block )
-{
- // get the packed values
- int a = FloatTo565( start );
- int b = FloatTo565( end );
-
- // remap the indices
- u8 remapped[16];
- if( a < b )
- {
- // swap a and b
- std::swap( a, b );
- for( int i = 0; i < 16; ++i )
- remapped[i] = ( indices[i] ^ 0x1 ) & 0x3;
- }
- else if( a == b )
- {
- // use index 0
- for( int i = 0; i < 16; ++i )
- remapped[i] = 0;
- }
- else
- {
- // use the indices directly
- for( int i = 0; i < 16; ++i )
- remapped[i] = indices[i];
- }
-
- // write the block
- WriteColourBlock( a, b, remapped, block );
-}
-
-/*
-static void WriteColourBlock( int a, int b, uint indices, void* block )
-{
- // get the block as bytes
- u8* bytes = ( u8* )block;
-
- // write the endpoints
- bytes[0] = ( u8 )( a & 0xff );
- bytes[1] = ( u8 )( a >> 8 );
- bytes[2] = ( u8 )( b & 0xff );
- bytes[3] = ( u8 )( b >> 8 );
-
- // write the indices @@ Not sure that's correct...
- bytes[4] = ( u8 )((indices >> 24) & 0xff);
- bytes[5] = ( u8 )((indices >> 16) & 0xff);
- bytes[6] = ( u8 )((indices >> 8) & 0xff);
- bytes[7] = ( u8 )((indices >> 0) & 0xff);
-}
-
-void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, uint indices, void* block )
-{
- // get the packed values
- int a = FloatTo565( start );
- int b = FloatTo565( end );
-
- // remap the indices
- if( a > b )
- {
- // swap a and b
- std::swap( a, b );
- indices ^= (~indices >> 1) & 0x55555555;
- }
- else if ( a == b )
- {
- indices = 0;
- }
-
- // write the block
- WriteColourBlock( a, b, indices, block );
-}
-
-void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, uint indices, void* block )
-{
- // get the packed values
- int a = FloatTo565( start );
- int b = FloatTo565( end );
-
- // remap the indices
- if( a < b )
- {
- // swap a and b
- std::swap( a, b );
- indices ^= 0x55555555;
- }
- else if( a == b )
- {
- indices = 0;
- }
-
- // write the block
- WriteColourBlock( a, b, indices, block );
-}
-*/
-
-static int Unpack565( u8 const* packed, u8* colour )
-{
- // build the packed value
- int value = ( int )packed[0] | ( ( int )packed[1] << 8 );
-
- // get the components in the stored range
- u8 red = ( u8 )( ( value >> 11 ) & 0x1f );
- u8 green = ( u8 )( ( value >> 5 ) & 0x3f );
- u8 blue = ( u8 )( value & 0x1f );
-
- // scale up to 8 bits
- colour[0] = ( red << 3 ) | ( red >> 2 );
- colour[1] = ( green << 2 ) | ( green >> 4 );
- colour[2] = ( blue << 3 ) | ( blue >> 2 );
- colour[3] = 255;
-
- // return the value
- return value;
-}
-
-void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
-{
- // get the block bytes
- u8 const* bytes = reinterpret_cast< u8 const* >( block );
-
- // unpack the endpoints
- u8 codes[16];
- int a = Unpack565( bytes, codes );
- int b = Unpack565( bytes + 2, codes + 4 );
-
- // generate the midpoints
- for( int i = 0; i < 3; ++i )
- {
- int c = codes[i];
- int d = codes[4 + i];
-
- if( isDxt1 && a <= b )
- {
- codes[8 + i] = ( u8 )( ( c + d )/2 );
- codes[12 + i] = 0;
- }
- else
- {
- codes[8 + i] = ( u8 )( ( 2*c + d )/3 );
- codes[12 + i] = ( u8 )( ( c + 2*d )/3 );
- }
- }
-
- // fill in alpha for the intermediate values
- codes[8 + 3] = 255;
- codes[12 + 3] = ( isDxt1 && a <= b ) ? 0 : 255;
-
- // unpack the indices
- u8 indices[16];
- for( int i = 0; i < 4; ++i )
- {
- u8* ind = indices + 4*i;
- u8 packed = bytes[4 + i];
-
- ind[0] = packed & 0x3;
- ind[1] = ( packed >> 2 ) & 0x3;
- ind[2] = ( packed >> 4 ) & 0x3;
- ind[3] = ( packed >> 6 ) & 0x3;
- }
-
- // store out the colours
- for( int i = 0; i < 16; ++i )
- {
- u8 offset = 4*indices[i];
- for( int j = 0; j < 4; ++j )
- rgba[4*i + j] = codes[offset + j];
- }
-}
-
-} // namespace squish
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourblock.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourblock.h
deleted file mode 100644
index bb0c3b09..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourblock.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef NV_SQUISH_COLOURBLOCK_H
-#define NV_SQUISH_COLOURBLOCK_H
-
-#include "squish.h"
-#include "maths.h"
-
-namespace nvsquish {
-
-void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
-void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
-//void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, uint indices, void* block );
-//void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, uint indices, void* block );
-
-void DecompressColour( u8* rgba, void const* block, bool isDxt1 );
-
-} // namespace squish
-
-#endif // ndef SQUISH_COLOURBLOCK_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourfit.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourfit.cpp
deleted file mode 100644
index 7df70476..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourfit.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "colourfit.h"
-#include "colourset.h"
-
-namespace nvsquish {
-
-ColourFit::ColourFit()
-{
-}
-
-void ColourFit::SetColourSet( ColourSet const* colours, int flags )
-{
- m_colours = colours;
- m_flags = flags;
-}
-
-void ColourFit::Compress( void* block )
-{
- bool isDxt1 = ( ( m_flags & kDxt1 ) != 0 );
- if( isDxt1 )
- {
- Compress3( block );
-
- if( !m_colours->IsTransparent() )
- {
- Compress4( block );
- }
- }
- else
- {
- Compress4( block );
- }
-}
-
-} // namespace squish
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourfit.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourfit.h
deleted file mode 100644
index 4c4dc6b0..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourfit.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef NV_SQUISH_COLOURFIT_H
-#define NV_SQUISH_COLOURFIT_H
-
-#include "squish.h"
-#include "maths.h"
-
-namespace nvsquish {
-
-class ColourSet;
-
-class ColourFit
-{
-public:
- ColourFit();
-
- void SetColourSet( ColourSet const* colours, int flags );
-
- void Compress( void* block );
-
-protected:
- virtual void Compress3( void* block ) = 0;
- virtual void Compress4( void* block ) = 0;
-
- ColourSet const* m_colours;
- int m_flags;
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_COLOURFIT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourset.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourset.cpp
deleted file mode 100644
index d269da51..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourset.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "colourset.h"
-
-namespace nvsquish {
-
-// @@ Add flags:
-// - MatchTransparent
-// - WeightColorByAlpha
-
-
-ColourSet::ColourSet( u8 const* rgba, int flags, bool createMinimalSet/*=false*/ )
- : m_count( 0 ),
- m_transparent( false )
-{
- // check the compression mode for dxt1
- bool isDxt1 = ( ( flags & kDxt1 ) != 0 );
- bool weightByAlpha = ( ( flags & kWeightColourByAlpha ) != 0 );
-
- // create the minimal set
- for( int i = 0; i < 16; ++i )
- {
- if (createMinimalSet)
- {
- // check for transparent pixels when using dxt1
- if( isDxt1 && rgba[4*i + 3] == 0 )
- {
- m_remap[i] = -1;
- m_transparent = true;
- continue;
- }
-
- // loop over previous points for a match
- for( int j = 0;; ++j )
- {
- // allocate a new point
- if( j == i )
- {
- // normalise coordinates to [0,1]
- float x = ( float )rgba[4*i + 2] / 255.0f;
- float y = ( float )rgba[4*i + 1] / 255.0f;
- float z = ( float )rgba[4*i + 0] / 255.0f;
-
- // ensure there is always non-zero weight even for zero alpha
- float w = ( float )( rgba[4*i + 3] + 1 ) / 256.0f;
-
- // add the point
- m_points[m_count] = Vec3( x, y, z );
- m_weights[m_count] = ( weightByAlpha ? w : 1.0f );
- m_remap[i] = m_count;
-
- // advance
- ++m_count;
- break;
- }
-
- // check for a match
- bool match = ( rgba[4*i] == rgba[4*j] )
- && ( rgba[4*i + 1] == rgba[4*j + 1] )
- && ( rgba[4*i + 2] == rgba[4*j + 2] )
- && ( rgba[4*j + 3] != 0 || !isDxt1 ); // @@ I think this check is not necessary.
-
- if( match )
- {
- // get the index of the match
- int index = m_remap[j];
-
- // ensure there is always non-zero weight even for zero alpha
- float w = ( float )( rgba[4*i + 3] + 1 ) / 256.0f;
-
- // map to this point and increase the weight
- m_weights[index] += ( weightByAlpha ? w : 1.0f );
- m_remap[i] = index;
- break;
- }
- }
- }
- else
- {
- // check for transparent pixels when using dxt1
- if( isDxt1 && rgba[4*i + 3] == 0 )
- {
- m_remap[i] = -1;
- m_transparent = true;
- }
- else
- {
- m_remap[i] = m_count;
- }
-
- // normalise coordinates to [0,1]
- float x = ( float )rgba[4*i + 2] / 255.0f;
- float y = ( float )rgba[4*i + 1] / 255.0f;
- float z = ( float )rgba[4*i + 0] / 255.0f;
-
- // ensure there is always non-zero weight even for zero alpha
- float w = ( float )( rgba[4*i + 3] + 1 ) / 256.0f;
-
- // add the point
- m_points[m_count] = Vec3( x, y, z );
- m_weights[m_count] = ( weightByAlpha ? w : 1.0f );
-
- // advance
- ++m_count;
- }
- }
-
-#if SQUISH_USE_SIMD
- // generate vector values
- for( int i = 0; i < m_count; ++i )
- {
- m_points_simd[i] = Vec4(m_points[i].X(), m_points[i].Y(), m_points[i].Z(), 1);
- m_weights_simd[i] = VEC4_CONST(m_weights[i]);
- }
-#endif
-}
-
-void ColourSet::RemapIndices( u8 const* source, u8* target ) const
-{
- for( int i = 0; i < 16; ++i )
- {
- int j = m_remap[i];
- if( j == -1 )
- target[i] = 3;
- else
- target[i] = source[j];
- }
-}
-
-} // namespace squish
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourset.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourset.h
deleted file mode 100644
index 99586da9..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/colourset.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef NV_SQUISH_COLOURSET_H
-#define NV_SQUISH_COLOURSET_H
-
-#include "squish.h"
-#include "maths.h"
-#include "simd.h"
-
-namespace nvsquish {
-
-/*! @brief Represents a set of block colours
-*/
-class ColourSet
-{
-public:
- ColourSet( u8 const* rgba, int flags, bool createMinimalSet = false );
-
- int GetCount() const { return m_count; }
- Vec3 const* GetPoints() const { return m_points; }
- float const* GetWeights() const { return m_weights; }
- bool IsTransparent() const { return m_transparent; }
-
- void RemapIndices( u8 const* source, u8* target ) const;
-
-private:
- int m_count;
- Vec3 m_points[16];
- float m_weights[16];
- int m_remap[16];
- bool m_transparent;
-
-#if SQUISH_USE_SIMD
-public:
- Vec4 const* GetPointsSimd() const { return m_points_simd; }
- Vec4 const* GetWeightsSimd() const { return m_weights_simd; }
-
-private:
- Vec4 m_points_simd[16];
- Vec4 m_weights_simd[16];
-#endif
-};
-
-} // namespace sqish
-
-#endif // ndef SQUISH_COLOURSET_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/config b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/config
deleted file mode 100644
index 3f247da8..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/config
+++ /dev/null
@@ -1,22 +0,0 @@
-# config file used for the Makefile only
-
-# define to 1 to use altivec instructions
-USE_ALTIVEC ?= 0
-
-# define to 1 to use sse instructions
-USE_SSE ?= 0
-
-# default flags
-CXXFLAGS ?= -O2
-ifeq ($(USE_ALTIVEC),1)
-CPPFLAGS += -DSQUISH_USE_ALTIVEC=1
-CXXFLAGS += -maltivec
-endif
-ifeq ($(USE_SSE),1)
-CPPFLAGS += -DSQUISH_USE_SSE=1
-CXXFLAGS += -msse
-endif
-
-# where should we install to
-INSTALL_DIR ?= /usr/local
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/config.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/config.h
deleted file mode 100644
index 465aa895..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/config.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_CONFIG_H
-#define SQUISH_CONFIG_H
-
-// Set to 1 when building squish to use altivec instructions.
-#ifndef SQUISH_USE_ALTIVEC
-# define SQUISH_USE_ALTIVEC defined(__VEC__)
-#endif
-
-// Set to 1 when building squish to use sse instructions.
-#ifndef SQUISH_USE_SSE
-# if defined(__SSE2__)
-# define SQUISH_USE_SSE 2
-# elif defined(__SSE__)
-# define SQUISH_USE_SSE 1
-# else
-# define SQUISH_USE_SSE 0
-# endif
-#endif
-
-// Internally et SQUISH_USE_SIMD when either altivec or sse is available.
-#if SQUISH_USE_ALTIVEC && SQUISH_USE_SSE
-# error "Cannot enable both altivec and sse!"
-#endif
-#if SQUISH_USE_ALTIVEC || SQUISH_USE_SSE
-# define SQUISH_USE_SIMD 1
-#else
-# define SQUISH_USE_SIMD 0
-#endif
-
-#endif // ndef SQUISH_CONFIG_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishgen.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishgen.cpp
deleted file mode 100644
index e5bd88c2..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishgen.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include <iostream>
-
-struct SourceBlock
-{
- int start;
- int end;
- int error;
-};
-
-struct TargetValue
-{
- SourceBlock sources[4];
-};
-
-static void GenerateData( std::string const& name, int bits, int colours )
-{
- TargetValue values[256];
-
- // initialise the data
- for( int target = 0; target < 256; ++target )
- for( int index = 0; index < colours; ++index )
- values[target].sources[index].error = 255;
-
- // loop over all possible source points
- int count = ( 1 << bits );
- for( int value1 = 0; value1 < count; ++value1 )
- {
- for( int value2 = 0; value2 < count; ++value2 )
- {
- // compute the 8-bit endpoints
- int a = ( value1 << ( 8 - bits ) ) | ( value1 >> ( 2*bits - 8 ) );
- int b = ( value2 << ( 8 - bits ) ) | ( value2 >> ( 2*bits - 8 ) );
-
- // fill in the codebook with the these and intermediates
- int codes[4];
- codes[0] = a;
- codes[1] = b;
- if( colours == 3 )
- {
- codes[2] = ( a + b )/2;
- codes[3] = 0;
- }
- else
- {
- codes[2] = ( 2*a + b )/3;
- codes[3] = ( a + 2*b )/3;
- }
-
- // mark each target point with the endpoints and index needed for it
- for( int index = 0; index < colours; ++index )
- {
- int target = codes[index];
-
- SourceBlock& block = values[target].sources[index];
- if( block.error != 0 )
- {
- block.start = value1;
- block.end = value2;
- block.error = 0;
- }
- }
- }
- }
-
- // iteratively fill in the missing values
- for( ;; )
- {
- bool stable = true;
- for( int index = 0; index < colours; ++index )
- {
- for( int target = 0; target < 256; ++target )
- {
- if( target != 255 )
- {
- SourceBlock& current = values[target].sources[index];
- SourceBlock& next = values[target + 1].sources[index];
- if( current.error > next.error + 1 )
- {
- current.start = next.start;
- current.end = next.end;
- current.error = next.error + 1;
- stable = false;
- }
- }
- if( target != 0 )
- {
- SourceBlock& current = values[target].sources[index];
- SourceBlock& previous = values[target - 1].sources[index];
- if( current.error > previous.error + 1 )
- {
- current.start = previous.start;
- current.end = previous.end;
- current.error = previous.error + 1;
- stable = false;
- }
- }
- }
- }
- if( stable )
- break;
- }
-
- // debug
- std::cout << "\nstatic SingleColourLookup const " << name << "[] = \n{\n";
- for( int i = 0;; )
- {
- std::cout << "\t{ { ";
- for( int j = 0;; )
- {
- SourceBlock const& block = values[i].sources[j];
- if( j < colours )
- std::cout << "{ " << block.start << ", " << block.end << ", " << block.error << " }";
- else
- std::cout << "{ 0, 0, 0 }";
- if( ++j == 4 )
- break;
- std::cout << ", ";
- }
- std::cout << " } }";
- if( ++i == 256 )
- break;
- std::cout << ",\n";
- }
- std::cout << "\n};\n";
-}
-
-int main()
-{
- GenerateData( "lookup_5_3", 5, 3 );
- GenerateData( "lookup_6_3", 6, 3 );
- GenerateData( "lookup_5_4", 5, 4 );
- GenerateData( "lookup_6_4", 6, 4 );
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishgen2.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishgen2.cpp
deleted file mode 100644
index f613d0c4..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishgen2.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
- Copyright (c) 2008 Ignacio Castano castano@gmail.com
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include <stdio.h>
-#include <float.h>
-#include <math.h>
-
-struct Precomp {
- float alpha2_sum;
- float beta2_sum;
- float alphabeta_sum;
- float factor;
-};
-
-
-int main()
-{
- int i = 0;
-
- printf("struct Precomp {\n");
- printf("\tfloat alpha2_sum;\n");
- printf("\tfloat beta2_sum;\n");
- printf("\tfloat alphabeta_sum;\n");
- printf("\tfloat factor;\n");
- printf("};\n\n");
-
- printf("static const SQUISH_ALIGN_16 Precomp s_threeElement[153] = {\n");
-
- // Three element clusters:
- for( int c0 = 0; c0 <= 16; c0++) // At least two clusters.
- {
- for( int c1 = 0; c1 <= 16-c0; c1++)
- {
- int c2 = 16 - c0 - c1;
-
- Precomp p;
- p.alpha2_sum = c0 + c1 * 0.25f;
- p.beta2_sum = c2 + c1 * 0.25f;
- p.alphabeta_sum = c1 * 0.25f;
- p.factor = 1.0f / (p.alpha2_sum * p.beta2_sum - p.alphabeta_sum * p.alphabeta_sum);
-
- if (isfinite(p.factor))
- {
- printf("\t{ %ff, %ff, %ff, %ff }, // %d (%d %d %d)\n", p.alpha2_sum, p.beta2_sum, p.alphabeta_sum, p.factor, i, c0, c1, c2);
- }
- else
- {
- printf("\t{ %ff, %ff, %ff, FLT_MAX }, // %d (%d %d %d)\n", p.alpha2_sum, p.beta2_sum, p.alphabeta_sum, i, c0, c1, c2);
- }
-
- i++;
- }
- }
- printf("}; // %d three cluster elements\n\n", i);
-
- printf("static const SQUISH_ALIGN_16 Precomp s_fourElement[969] = {\n");
-
- // Four element clusters:
- i = 0;
- for( int c0 = 0; c0 <= 16; c0++)
- {
- for( int c1 = 0; c1 <= 16-c0; c1++)
- {
- for( int c2 = 0; c2 <= 16-c0-c1; c2++)
- {
- int c3 = 16 - c0 - c1 - c2;
-
- Precomp p;
- p.alpha2_sum = c0 + c1 * (4.0f/9.0f) + c2 * (1.0f/9.0f);
- p.beta2_sum = c3 + c2 * (4.0f/9.0f) + c1 * (1.0f/9.0f);
- p.alphabeta_sum = (c1 + c2) * (2.0f/9.0f);
- p.factor = 1.0f / (p.alpha2_sum * p.beta2_sum - p.alphabeta_sum * p.alphabeta_sum);
-
- if (isfinite(p.factor))
- {
- printf("\t{ %ff, %ff, %ff, %ff }, // %d (%d %d %d %d)\n", p.alpha2_sum, p.beta2_sum, p.alphabeta_sum, p.factor, i, c0, c1, c2, c3);
- }
- else
- {
- printf("\t{ %ff, %ff, %ff, FLT_MAX }, // %d (%d %d %d %d)\n", p.alpha2_sum, p.beta2_sum, p.alphabeta_sum, i, c0, c1, c2, c3);
- }
-
- i++;
- }
- }
- }
- printf("}; // %d four cluster elements\n\n", i);
-
- return 0;
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishpng.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishpng.cpp
deleted file mode 100644
index 81246e81..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishpng.cpp
+++ /dev/null
@@ -1,603 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-/*! @file
-
- @brief Example program that converts between the PNG and DXT formats.
-
- This program requires libpng for PNG input and output, and is designed
- to show how to prepare data for the squish library when it is not simply
- a contiguous block of memory.
-*/
-
-#include <iostream>
-#include <string>
-#include <sstream>
-#include <ctime>
-#include <cmath>
-#include <squish.h>
-#include <png.h>
-
-#ifdef _MSC_VER
-#pragma warning( disable: 4511 4512 )
-#endif // def _MSC_VER
-
-using namespace squish;
-
-//! Simple exception class.
-class Error : public std::exception
-{
-public:
- Error( std::string const& excuse ) : m_excuse( excuse ) {}
- ~Error() throw() {}
-
- virtual char const* what() const throw() { return m_excuse.c_str(); }
-
-private:
- std::string m_excuse;
-};
-
-//! Base class to make derived classes non-copyable
-class NonCopyable
-{
-public:
- NonCopyable() {}
-
-private:
- NonCopyable( NonCopyable const& );
- NonCopyable& operator=( NonCopyable const& );
-};
-
-//! Memory object.
-class Mem : NonCopyable
-{
-public:
- explicit Mem( int size ) : m_p( new u8[size] ) {}
- ~Mem() { delete[] m_p; }
-
- u8* Get() const { return m_p; }
-
-private:
- u8* m_p;
-};
-
-//! File object.
-class File : NonCopyable
-{
-public:
- explicit File( FILE* fp ) : m_fp( fp ) {}
- ~File() { if( m_fp ) fclose( m_fp ); }
-
- bool IsValid() const { return m_fp != 0; }
- FILE* Get() const { return m_fp; }
-
-private:
- FILE* m_fp;
-};
-
-//! PNG read object.
-class PngReadStruct : NonCopyable
-{
-public:
- PngReadStruct()
- : m_png( 0 ),
- m_info( 0 ),
- m_end( 0 )
- {
- m_png = png_create_read_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 );
- if( !m_png )
- throw Error( "failed to create png read struct" );
-
- m_info = png_create_info_struct( m_png );
- m_end = png_create_info_struct( m_png );
- if( !m_info || !m_end )
- {
- png_infopp info = m_info ? &m_info : 0;
- png_infopp end = m_end ? &m_end : 0;
- png_destroy_read_struct( &m_png, info, end );
- throw Error( "failed to create png info structs" );
- }
- }
-
- ~PngReadStruct()
- {
- png_destroy_read_struct( &m_png, &m_info, &m_end );
- }
-
- png_structp GetPng() const { return m_png; }
- png_infop GetInfo() const { return m_info; }
-
-private:
- png_structp m_png;
- png_infop m_info, m_end;
-};
-
-//! PNG write object.
-class PngWriteStruct : NonCopyable
-{
-public:
- PngWriteStruct()
- : m_png( 0 ),
- m_info( 0 )
- {
- m_png = png_create_write_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 );
- if( !m_png )
- throw Error( "failed to create png read struct" );
-
- m_info = png_create_info_struct( m_png );
- if( !m_info )
- {
- png_infopp info = m_info ? &m_info : 0;
- png_destroy_write_struct( &m_png, info );
- throw Error( "failed to create png info structs" );
- }
- }
-
- ~PngWriteStruct()
- {
- png_destroy_write_struct( &m_png, &m_info );
- }
-
- png_structp GetPng() const { return m_png; }
- png_infop GetInfo() const { return m_info; }
-
-private:
- png_structp m_png;
- png_infop m_info;
-};
-
-//! PNG rows object.
-class PngRows : NonCopyable
-{
-public:
- PngRows( int width, int height, int stride ) : m_width( width ), m_height( height )
- {
- m_rows = ( png_bytep* )malloc( m_height*sizeof( png_bytep ) );
- for( int i = 0; i < m_height; ++i )
- m_rows[i] = ( png_bytep )malloc( m_width*stride );
- }
-
- ~PngRows()
- {
- for( int i = 0; i < m_height; ++i )
- free( m_rows[i] );
- free( m_rows );
- }
-
- png_bytep* Get() const { return m_rows; }
-
-private:
- png_bytep* m_rows;
- int m_width, m_height;
-};
-
-class PngImage
-{
-public:
- explicit PngImage( std::string const& fileName );
-
- int GetWidth() const { return m_width; }
- int GetHeight() const { return m_height; }
- int GetStride() const { return m_stride; }
- bool IsColour() const { return m_colour; }
- bool IsAlpha() const { return m_alpha; }
-
- u8 const* GetRow( int row ) const { return ( u8* )m_rows[row]; }
-
-private:
- PngReadStruct m_png;
-
- int m_width;
- int m_height;
- int m_stride;
- bool m_colour;
- bool m_alpha;
-
- png_bytep* m_rows;
-};
-
-PngImage::PngImage( std::string const& fileName )
-{
- // open the source file
- File file( fopen( fileName.c_str(), "rb" ) );
- if( !file.IsValid() )
- {
- std::ostringstream oss;
- oss << "failed to open \"" << fileName << "\" for reading";
- throw Error( oss.str() );
- }
-
- // check the signature bytes
- png_byte header[8];
- fread( header, 1, 8, file.Get() );
- if( png_sig_cmp( header, 0, 8 ) )
- {
- std::ostringstream oss;
- oss << "\"" << fileName << "\" does not look like a png file";
- throw Error( oss.str() );
- }
-
- // read the image into memory
- png_init_io( m_png.GetPng(), file.Get() );
- png_set_sig_bytes( m_png.GetPng(), 8 );
- png_read_png( m_png.GetPng(), m_png.GetInfo(), PNG_TRANSFORM_EXPAND, 0 );
-
- // get the image info
- png_uint_32 width;
- png_uint_32 height;
- int bitDepth;
- int colourType;
- png_get_IHDR( m_png.GetPng(), m_png.GetInfo(), &width, &height, &bitDepth, &colourType, 0, 0, 0 );
-
- // check the image is 8 bit
- if( bitDepth != 8 )
- {
- std::ostringstream oss;
- oss << "cannot process " << bitDepth << "-bit image (bit depth must be 8)";
- throw Error( oss.str() );
- }
-
- // save the info
- m_width = width;
- m_height = height;
- m_colour = ( ( colourType & PNG_COLOR_MASK_COLOR ) != 0 );
- m_alpha = ( ( colourType & PNG_COLOR_MASK_ALPHA ) != 0 );
- m_stride = ( m_colour ? 3 : 1 ) + ( m_alpha ? 1 : 0 );
-
- // get the image rows
- m_rows = png_get_rows( m_png.GetPng(), m_png.GetInfo() );
- if( !m_rows )
- throw Error( "failed to get image rows" );
-}
-
-static void Compress( std::string const& sourceFileName, std::string const& targetFileName, int flags )
-{
- // load the source image
- PngImage sourceImage( sourceFileName );
-
- // get the image info
- int width = sourceImage.GetWidth();
- int height = sourceImage.GetHeight();
- int stride = sourceImage.GetStride();
- bool colour = sourceImage.IsColour();
- bool alpha = sourceImage.IsAlpha();
-
- // check the image dimensions
- if( ( width % 4 ) != 0 || ( height % 4 ) != 0 )
- {
- std::ostringstream oss;
- oss << "cannot compress " << width << "x" << height
- << "image (dimensions must be multiples of 4)";
- throw Error( oss.str() );
- }
-
- // create the target data
- int bytesPerBlock = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16;
- int targetDataSize = bytesPerBlock*width*height/16;
- Mem targetData( targetDataSize );
-
- // loop over blocks and compress them
- clock_t start = std::clock();
- u8* targetBlock = targetData.Get();
- for( int y = 0; y < height; y += 4 )
- {
- // process a row of blocks
- for( int x = 0; x < width; x += 4 )
- {
- // get the block data
- u8 sourceRgba[16*4];
- for( int py = 0, i = 0; py < 4; ++py )
- {
- u8 const* row = sourceImage.GetRow( y + py ) + x*stride;
- for( int px = 0; px < 4; ++px, ++i )
- {
- // get the pixel colour
- if( colour )
- {
- for( int j = 0; j < 3; ++j )
- sourceRgba[4*i + j] = *row++;
- }
- else
- {
- for( int j = 0; j < 3; ++j )
- sourceRgba[4*i + j] = *row;
- ++row;
- }
-
- // skip alpha for now
- if( alpha )
- sourceRgba[4*i + 3] = *row++;
- else
- sourceRgba[4*i + 3] = 255;
- }
- }
-
- // compress this block
- Compress( sourceRgba, targetBlock, flags );
-
- // advance
- targetBlock += bytesPerBlock;
- }
- }
- clock_t end = std::clock();
- double duration = ( double )( end - start ) / CLOCKS_PER_SEC;
- std::cout << "time taken: " << duration << " seconds" << std::endl;
-
- // open the target file
- File targetFile( fopen( targetFileName.c_str(), "wb" ) );
- if( !targetFile.IsValid() )
- {
- std::ostringstream oss;
- oss << "failed to open \"" << sourceFileName << "\" for writing";
- throw Error( oss.str() );
- }
-
- // write the header
- fwrite( &width, sizeof( int ), 1, targetFile.Get() );
- fwrite( &height, sizeof( int ), 1, targetFile.Get() );
-
- // write the data
- fwrite( targetData.Get(), 1, targetDataSize, targetFile.Get() );
-}
-
-static void Decompress( std::string const& sourceFileName, std::string const& targetFileName, int flags )
-{
- // open the source file
- File sourceFile( fopen( sourceFileName.c_str(), "rb" ) );
- if( !sourceFile.IsValid() )
- {
- std::ostringstream oss;
- oss << "failed to open \"" << sourceFileName << "\" for reading";
- throw Error( oss.str() );
- }
-
- // get the width and height
- int width, height;
- fread( &width, sizeof( int ), 1, sourceFile.Get() );
- fread( &height, sizeof( int ), 1, sourceFile.Get() );
-
- // work out the data size
- int bytesPerBlock = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16;
- int sourceDataSize = bytesPerBlock*width*height/16;
- Mem sourceData( sourceDataSize );
-
- // read the source data
- fread( sourceData.Get(), 1, sourceDataSize, sourceFile.Get() );
-
- // create the target rows
- PngRows targetRows( width, height, 4 );
-
- // loop over blocks and compress them
- u8 const* sourceBlock = sourceData.Get();
- for( int y = 0; y < height; y += 4 )
- {
- // process a row of blocks
- for( int x = 0; x < width; x += 4 )
- {
- // decompress back
- u8 targetRgba[16*4];
- Decompress( targetRgba, sourceBlock, flags );
-
- // write the data into the target rows
- for( int py = 0, i = 0; py < 4; ++py )
- {
- u8* row = ( u8* )targetRows.Get()[y + py] + x*4;
- for( int px = 0; px < 4; ++px, ++i )
- {
- for( int j = 0; j < 4; ++j )
- *row++ = targetRgba[4*i + j];
- }
- }
-
- // advance
- sourceBlock += bytesPerBlock;
- }
- }
-
- // create the target PNG
- PngWriteStruct targetPng;
-
- // set up the image
- png_set_IHDR(
- targetPng.GetPng(), targetPng.GetInfo(), width, height,
- 8, PNG_COLOR_TYPE_RGBA, PNG_INTERLACE_NONE,
- PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT
- );
-
- // open the target file
- File targetFile( fopen( targetFileName.c_str(), "wb" ) );
- if( !targetFile.IsValid() )
- {
- std::ostringstream oss;
- oss << "failed to open \"" << targetFileName << "\" for writing";
- throw Error( oss.str() );
- }
-
- // write the image
- png_set_rows( targetPng.GetPng(), targetPng.GetInfo(), targetRows.Get() );
- png_init_io( targetPng.GetPng(), targetFile.Get() );
- png_write_png( targetPng.GetPng(), targetPng.GetInfo(), PNG_TRANSFORM_IDENTITY, 0 );
-}
-
-static void Diff( std::string const& sourceFileName, std::string const& targetFileName )
-{
- // load the images
- PngImage sourceImage( sourceFileName );
- PngImage targetImage( targetFileName );
-
- // get the image info
- int width = sourceImage.GetWidth();
- int height = sourceImage.GetHeight();
- int sourceStride = sourceImage.GetStride();
- int targetStride = targetImage.GetStride();
- int stride = std::min( sourceStride, targetStride );
-
- // check they match
- if( width != targetImage.GetWidth() || height != targetImage.GetHeight() )
- throw Error( "source and target dimensions do not match" );
-
- // work out the error
- double error = 0.0;
- for( int y = 0; y < height; ++y )
- {
- u8 const* sourceRow = sourceImage.GetRow( y );
- u8 const* targetRow = targetImage.GetRow( y );
- for( int x = 0; x < width; ++x )
- {
- u8 const* sourcePixel = sourceRow + x*sourceStride;
- u8 const* targetPixel = targetRow + x*targetStride;
- for( int i = 0; i < stride; ++i )
- {
- int diff = ( int )sourcePixel[i] - ( int )targetPixel[i];
- error += ( double )( diff*diff );
- }
- }
- }
- error = std::sqrt( error / ( width*height ) );
-
- // print it out
- std::cout << "rms error: " << error << std::endl;
-}
-
-enum Mode
-{
- kCompress,
- kDecompress,
- kDiff
-};
-
-int main( int argc, char* argv[] )
-{
- try
- {
- // parse the command-line
- std::string sourceFileName;
- std::string targetFileName;
- Mode mode = kCompress;
- int method = kDxt1;
- int metric = kColourMetricPerceptual;
- int fit = kColourClusterFit;
- int extra = 0;
- bool help = false;
- bool arguments = true;
- for( int i = 1; i < argc; ++i )
- {
- // check for options
- char const* word = argv[i];
- if( arguments && word[0] == '-' )
- {
- for( int j = 1; word[j] != '\0'; ++j )
- {
- switch( word[j] )
- {
- case 'h': help = true; break;
- case 'c': mode = kCompress; break;
- case 'd': mode = kDecompress; break;
- case 'e': mode = kDiff; break;
- case '1': method = kDxt1; break;
- case '3': method = kDxt3; break;
- case '5': method = kDxt5; break;
- case 'u': metric = kColourMetricUniform; break;
- case 'r': fit = kColourRangeFit; break;
- case 'w': extra = kWeightColourByAlpha; break;
- case '-': arguments = false; break;
- default:
- std::cerr << "unknown option '" << word[j] << "'" << std::endl;
- return -1;
- }
- }
- }
- else
- {
- if( sourceFileName.empty() )
- sourceFileName.assign( word );
- else if( targetFileName.empty() )
- targetFileName.assign( word );
- else
- {
- std::cerr << "unexpected argument \"" << word << "\"" << std::endl;
- }
- }
- }
-
- // check arguments
- if( help )
- {
- std::cout
- << "SYNTAX" << std::endl
- << "\tsquishpng [-cde135] <source> <target>" << std::endl
- << "OPTIONS" << std::endl
- << "\t-c\tCompress source png to target raw dxt (default)" << std::endl
- << "\t-135\tSpecifies whether to use DXT1 (default), DXT3 or DXT5 compression" << std::endl
- << "\t-u\tUse a uniform colour metric during colour compression" << std::endl
- << "\t-r\tUse the fast but inferior range-based colour compressor" << std::endl
- << "\t-w\tWeight colour values by alpha in the cluster colour compressor" << std::endl
- << "\t-d\tDecompress source raw dxt to target png" << std::endl
- << "\t-e\tDiff source and target png" << std::endl
- ;
-
- return 0;
- }
- if( sourceFileName.empty() )
- {
- std::cerr << "no source file given" << std::endl;
- return -1;
- }
- if( targetFileName.empty() )
- {
- std::cerr << "no target file given" << std::endl;
- return -1;
- }
-
- // do the work
- switch( mode )
- {
- case kCompress:
- Compress( sourceFileName, targetFileName, method | metric | fit | extra );
- break;
-
- case kDecompress:
- Decompress( sourceFileName, targetFileName, method );
- break;
-
- case kDiff:
- Diff( sourceFileName, targetFileName );
- break;
-
- default:
- std::cerr << "unknown mode" << std::endl;
- throw std::exception();
- }
- }
- catch( std::exception& excuse )
- {
- // complain
- std::cerr << "squishpng error: " << excuse.what() << std::endl;
- return -1;
- }
-
- // done
- return 0;
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishtest.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishtest.cpp
deleted file mode 100644
index 594d8e25..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/extra/squishtest.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-/*! @file
-
- @brief This program tests the error for 1 and 2-colour DXT compression.
-
- This tests the effectiveness of the DXT compression algorithm for all
- possible 1 and 2-colour blocks of pixels.
-*/
-
-#include <squish.h>
-#include <iostream>
-#include <cmath>
-#include <cfloat>
-
-using namespace squish;
-
-double GetColourError( u8 const* a, u8 const* b )
-{
- double error = 0.0;
- for( int i = 0; i < 16; ++i )
- {
- for( int j = 0; j < 3; ++j )
- {
- int index = 4*i + j;
- int diff = ( int )a[index] - ( int )b[index];
- error += ( double )( diff*diff );
- }
- }
- return error / 16.0;
-}
-
-void TestOneColour( int flags )
-{
- u8 input[4*16];
- u8 output[4*16];
- u8 block[16];
-
- double avg = 0.0, min = DBL_MAX, max = -DBL_MAX;
- int counter = 0;
-
- // test all single-channel colours
- for( int i = 0; i < 16*4; ++i )
- input[i] = ( ( i % 4 ) == 3 ) ? 255 : 0;
- for( int channel = 0; channel < 3; ++channel )
- {
- for( int value = 0; value < 255; ++value )
- {
- // set the channnel value
- for( int i = 0; i < 16; ++i )
- input[4*i + channel] = ( u8 )value;
-
- // compress and decompress
- Compress( input, block, flags );
- Decompress( output, block, flags );
-
- // test the results
- double rm = GetColourError( input, output );
- double rms = std::sqrt( rm );
-
- // accumulate stats
- min = std::min( min, rms );
- max = std::max( max, rms );
- avg += rm;
- ++counter;
- }
-
- // reset the channel value
- for( int i = 0; i < 16; ++i )
- input[4*i + channel] = 0;
- }
-
- // finish stats
- avg = std::sqrt( avg/counter );
-
- // show stats
- std::cout << "one colour error (min, max, avg): "
- << min << ", " << max << ", " << avg << std::endl;
-}
-
-void TestOneColourRandom( int flags )
-{
- u8 input[4*16];
- u8 output[4*16];
- u8 block[16];
-
- double avg = 0.0, min = DBL_MAX, max = -DBL_MAX;
- int counter = 0;
-
- // test all single-channel colours
- for( int test = 0; test < 1000; ++test )
- {
- // set a constant random colour
- for( int channel = 0; channel < 3; ++channel )
- {
- u8 value = ( u8 )( rand() & 0xff );
- for( int i = 0; i < 16; ++i )
- input[4*i + channel] = value;
- }
- for( int i = 0; i < 16; ++i )
- input[4*i + 3] = 255;
-
- // compress and decompress
- Compress( input, block, flags );
- Decompress( output, block, flags );
-
- // test the results
- double rm = GetColourError( input, output );
- double rms = std::sqrt( rm );
-
- // accumulate stats
- min = std::min( min, rms );
- max = std::max( max, rms );
- avg += rm;
- ++counter;
- }
-
- // finish stats
- avg = std::sqrt( avg/counter );
-
- // show stats
- std::cout << "random one colour error (min, max, avg): "
- << min << ", " << max << ", " << avg << std::endl;
-}
-
-void TestTwoColour( int flags )
-{
- u8 input[4*16];
- u8 output[4*16];
- u8 block[16];
-
- double avg = 0.0, min = DBL_MAX, max = -DBL_MAX;
- int counter = 0;
-
- // test all single-channel colours
- for( int i = 0; i < 16*4; ++i )
- input[i] = ( ( i % 4 ) == 3 ) ? 255 : 0;
- for( int channel = 0; channel < 3; ++channel )
- {
- for( int value1 = 0; value1 < 255; ++value1 )
- {
- for( int value2 = value1 + 1; value2 < 255; ++value2 )
- {
- // set the channnel value
- for( int i = 0; i < 16; ++i )
- input[4*i + channel] = ( u8 )( ( i < 8 ) ? value1 : value2 );
-
- // compress and decompress
- Compress( input, block, flags );
- Decompress( output, block, flags );
-
- // test the results
- double rm = GetColourError( input, output );
- double rms = std::sqrt( rm );
-
- // accumulate stats
- min = std::min( min, rms );
- max = std::max( max, rms );
- avg += rm;
- ++counter;
- }
- }
-
- // reset the channel value
- for( int i = 0; i < 16; ++i )
- input[4*i + channel] = 0;
- }
-
- // finish stats
- avg = std::sqrt( avg/counter );
-
- // show stats
- std::cout << "two colour error (min, max, avg): "
- << min << ", " << max << ", " << avg << std::endl;
-}
-
-int main()
-{
- TestOneColourRandom( kDxt1 | kColourRangeFit );
- TestOneColour( kDxt1 );
- TestTwoColour( kDxt1 );
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/fastclusterfit.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/fastclusterfit.cpp
deleted file mode 100644
index 0b19150f..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/fastclusterfit.cpp
+++ /dev/null
@@ -1,600 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
- Copyright (c) 2006 Ignacio Castano icastano@nvidia.com
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "fastclusterfit.h"
-#include "colourset.h"
-#include "colourblock.h"
-#include <cfloat>
-
-#include "fastclusterlookup.inl"
-
-namespace nvsquish {
-
-FastClusterFit::FastClusterFit()
-{
-}
-
-void FastClusterFit::SetColourSet( ColourSet const* colours, int flags )
-{
- ColourFit::SetColourSet( colours, flags );
-
- // initialise the best error
-#if SQUISH_USE_SIMD
- m_besterror = VEC4_CONST( FLT_MAX );
- Vec3 metric = m_metric.GetVec3();
-#else
- m_besterror = FLT_MAX;
- Vec3 metric = m_metric;
-#endif
-
- // cache some values
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
-
- // get the covariance matrix
- Sym3x3 covariance = ComputeWeightedCovariance( count, values, m_colours->GetWeights(), metric );
-
- // compute the principle component
- Vec3 principle = ComputePrincipleComponent( covariance );
-
- // build the list of values
- float dps[16];
- for( int i = 0; i < count; ++i )
- {
- dps[i] = Dot( values[i], principle );
- m_order[i] = i;
- }
-
- // stable sort
- for( int i = 0; i < count; ++i )
- {
- for( int j = i; j > 0 && dps[j] < dps[j - 1]; --j )
- {
- std::swap( dps[j], dps[j - 1] );
- std::swap( m_order[j], m_order[j - 1] );
- }
- }
-
- // weight all the points
-#if SQUISH_USE_SIMD
- Vec4 const* unweighted = m_colours->GetPointsSimd();
- m_xxsum = VEC4_CONST( 0.0f );
- m_xsum = VEC4_CONST( 0.0f );
-#else
- Vec3 const* unweighted = m_colours->GetPoints();
- m_xxsum = Vec3( 0.0f );
- m_xsum = Vec3( 0.0f );
-#endif
-
- for( int i = 0; i < count; ++i )
- {
- int p = m_order[i];
- m_unweighted[i] = unweighted[p];
- m_xxsum += m_unweighted[i]*m_unweighted[i];
- m_xsum += m_unweighted[i];
- }
-}
-
-
-void FastClusterFit::SetMetric(float r, float g, float b)
-{
-#if SQUISH_USE_SIMD
- m_metric = Vec4(r, g, b, 0);
-#else
- m_metric = Vec3(r, g, b);
-#endif
- m_metricSqr = m_metric * m_metric;
-}
-
-float FastClusterFit::GetBestError() const
-{
-#if SQUISH_USE_SIMD
- Vec4 x = m_xxsum * m_metricSqr;
- Vec4 error = m_besterror + x.SplatX() + x.SplatY() + x.SplatZ();
- return error.GetVec3().X();
-#else
- return m_besterror + Dot(m_xxsum, m_metricSqr);
-#endif
-
-}
-
-#if SQUISH_USE_SIMD
-
-void FastClusterFit::Compress3( void* block )
-{
- Vec4 const one = VEC4_CONST(1.0f);
- Vec4 const zero = VEC4_CONST(0.0f);
- Vec4 const half = VEC4_CONST(0.5f);
- Vec4 const two = VEC4_CONST(2.0);
- Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f );
- Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f );
-
- // declare variables
- Vec4 beststart = VEC4_CONST( 0.0f );
- Vec4 bestend = VEC4_CONST( 0.0f );
- Vec4 besterror = VEC4_CONST( FLT_MAX );
-
- Vec4 x0 = zero;
- Vec4 x1;
- int b0 = 0, b1 = 0;
- int i = 0;
-
- // check all possible clusters for this total order
- for( int c0 = 0; c0 <= 16; c0++)
- {
- x1 = zero;
-
- for( int c1 = 0; c1 <= 16-c0; c1++)
- {
- Vec4 const constants = Vec4((const float *)&s_threeElement[i]);
- Vec4 const alpha2_sum = constants.SplatX();
- Vec4 const beta2_sum = constants.SplatY();
- Vec4 const alphabeta_sum = constants.SplatZ();
- Vec4 const factor = constants.SplatW();
- i++;
-
- Vec4 const alphax_sum = MultiplyAdd(half, x1, x0);
- Vec4 const betax_sum = m_xsum - alphax_sum;
-
- Vec4 a = NegativeMultiplySubtract(betax_sum, alphabeta_sum, alphax_sum*beta2_sum) * factor;
- Vec4 b = NegativeMultiplySubtract(alphax_sum, alphabeta_sum, betax_sum*alpha2_sum) * factor;
-
- // clamp to the grid
- a = Min( one, Max( zero, a ) );
- b = Min( one, Max( zero, b ) );
- a = Truncate( MultiplyAdd( grid, a, half ) ) * gridrcp;
- b = Truncate( MultiplyAdd( grid, b, half ) ) * gridrcp;
-
- // compute the error (we skip the constant xxsum)
- Vec4 e1 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum );
- Vec4 e2 = NegativeMultiplySubtract( a, alphax_sum, a*b*alphabeta_sum );
- Vec4 e3 = NegativeMultiplySubtract( b, betax_sum, e2 );
- Vec4 e4 = MultiplyAdd( two, e3, e1 );
-
- // apply the metric to the error term
- Vec4 e5 = e4 * m_metricSqr;
- Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ();
-
- // keep the solution if it wins
- if( CompareAnyLessThan( error, besterror ) )
- {
- besterror = error;
- beststart = a;
- bestend = b;
- b0 = c0;
- b1 = c1;
- }
-
- x1 += m_unweighted[c0+c1];
- }
-
- x0 += m_unweighted[c0];
- }
-
- // save the block if necessary
- if( CompareAnyLessThan( besterror, m_besterror ) )
- {
- // compute indices from cluster sizes.
- /*uint bestindices = 0;
- {
- int i = b0;
- for(; i < b0+b1; i++) {
- bestindices |= 2 << (2 * i);
- }
- for(; i < 16; i++) {
- bestindices |= 1 << (2 * i);
- }
- }*/
- u8 bestindices[16];
- {
- int i = 0;
- for(; i < b0; i++) {
- bestindices[i] = 0;
- }
- for(; i < b0+b1; i++) {
- bestindices[i] = 2;
- }
- for(; i < 16; i++) {
- bestindices[i] = 1;
- }
- }
-
- // remap the indices
- u8 ordered[16];
- for( int i = 0; i < 16; ++i )
- ordered[m_order[i]] = bestindices[i];
-
- m_colours->RemapIndices( ordered, bestindices ); // Set alpha indices.
-
- // save the block
- WriteColourBlock3( beststart.GetVec3(), bestend.GetVec3(), ordered, block );
-
- // save the error
- m_besterror = besterror;
- }
-}
-
-void FastClusterFit::Compress4( void* block )
-{
- Vec4 const one = VEC4_CONST(1.0f);
- Vec4 const zero = VEC4_CONST(0.0f);
- Vec4 const half = VEC4_CONST(0.5f);
- Vec4 const two = VEC4_CONST(2.0);
- Vec4 const onethird = VEC4_CONST( 1.0f/3.0f );
- Vec4 const twothirds = VEC4_CONST( 2.0f/3.0f );
-
- // declare variables
- Vec4 beststart = VEC4_CONST( 0.0f );
- Vec4 bestend = VEC4_CONST( 0.0f );
- Vec4 besterror = VEC4_CONST( FLT_MAX );
-
- Vec4 x0 = zero;
- int b0 = 0, b1 = 0, b2 = 0;
- int i = 0;
-
- // check all possible clusters for this total order
- for( int c0 = 0; c0 <= 16; c0++)
- {
- Vec4 x1 = zero;
-
- for( int c1 = 0; c1 <= 16-c0; c1++)
- {
- Vec4 x2 = zero;
-
- for( int c2 = 0; c2 <= 16-c0-c1; c2++)
- {
- Vec4 const constants = Vec4((const float *)&s_fourElement[i]);
- Vec4 const alpha2_sum = constants.SplatX();
- Vec4 const beta2_sum = constants.SplatY();
- Vec4 const alphabeta_sum = constants.SplatZ();
- Vec4 const factor = constants.SplatW();
- i++;
-
- Vec4 const alphax_sum = MultiplyAdd(x2, onethird, MultiplyAdd(x1, twothirds, x0));
- Vec4 const betax_sum = m_xsum - alphax_sum;
-
- Vec4 a = NegativeMultiplySubtract(betax_sum, alphabeta_sum, alphax_sum*beta2_sum) * factor;
- Vec4 b = NegativeMultiplySubtract(alphax_sum, alphabeta_sum, betax_sum*alpha2_sum) * factor;
-
- // clamp the output to [0, 1]
- a = Min( one, Max( zero, a ) );
- b = Min( one, Max( zero, b ) );
-
- // clamp to the grid
- Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f );
- Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f );
- a = Truncate( MultiplyAdd( grid, a, half ) ) * gridrcp;
- b = Truncate( MultiplyAdd( grid, b, half ) ) * gridrcp;
-
- // compute the error (we skip the constant xxsum)
- Vec4 e1 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum );
- Vec4 e2 = NegativeMultiplySubtract( a, alphax_sum, a*b*alphabeta_sum );
- Vec4 e3 = NegativeMultiplySubtract( b, betax_sum, e2 );
- Vec4 e4 = MultiplyAdd( two, e3, e1 );
-
- // apply the metric to the error term
- Vec4 e5 = e4 * m_metricSqr;
- Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ();
-
- // keep the solution if it wins
- if( CompareAnyLessThan( error, besterror ) )
- {
- besterror = error;
- beststart = a;
- bestend = b;
- b0 = c0;
- b1 = c1;
- b2 = c2;
- }
-
- x2 += m_unweighted[c0+c1+c2];
- }
-
- x1 += m_unweighted[c0+c1];
- }
-
- x0 += m_unweighted[c0];
- }
-
- // save the block if necessary
- if( CompareAnyLessThan( besterror, m_besterror ) )
- {
- // compute indices from cluster sizes.
- /*uint bestindices = 0;
- {
- int i = b0;
- for(; i < b0+b1; i++) {
- bestindices = 2 << (2 * m_order[i]);
- }
- for(; i < b0+b1+b2; i++) {
- bestindices = 3 << (2 * m_order[i]);
- }
- for(; i < 16; i++) {
- bestindices = 1 << (2 * m_order[i]);
- }
- }*/
- u8 bestindices[16];
- {
- int i = 0;
- for(; i < b0; i++) {
- bestindices[i] = 0;
- }
- for(; i < b0+b1; i++) {
- bestindices[i] = 2;
- }
- for(; i < b0+b1+b2; i++) {
- bestindices[i] = 3;
- }
- for(; i < 16; i++) {
- bestindices[i] = 1;
- }
- }
-
- // remap the indices
- u8 ordered[16];
- for( int i = 0; i < 16; ++i )
- ordered[m_order[i]] = bestindices[i];
-
- // save the block
- WriteColourBlock4( beststart.GetVec3(), bestend.GetVec3(), ordered, block );
-
- // save the error
- m_besterror = besterror;
- }
-}
-
-#else
-
-void FastClusterFit::Compress3( void* block )
-{
- Vec3 const one( 1.0f );
- Vec3 const zero( 0.0f );
- Vec3 const half( 0.5f );
- Vec3 const grid( 31.0f, 63.0f, 31.0f );
- Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f );
-
- // declare variables
- Vec3 beststart( 0.0f );
- Vec3 bestend( 0.0f );
- float besterror = FLT_MAX;
-
- Vec3 x0(0.0f);
- Vec3 x1;
- int b0 = 0, b1 = 0;
- int i = 0;
-
- // check all possible clusters for this total order
- for( int c0 = 0; c0 <= 16; c0++)
- {
- x1 = Vec3(0);
-
- for( int c1 = 0; c1 <= 16-c0; c1++)
- {
- float const alpha2_sum = s_threeElement[i].alpha2_sum;
- float const beta2_sum = s_threeElement[i].beta2_sum;
- float const alphabeta_sum = s_threeElement[i].alphabeta_sum;
- float const factor = s_threeElement[i].factor;
- i++;
-
- Vec3 const alphax_sum = x0 + x1 * 0.5f;
- Vec3 const betax_sum = m_xsum - alphax_sum;
-
- Vec3 a = (alphax_sum*beta2_sum - betax_sum*alphabeta_sum) * factor;
- Vec3 b = (betax_sum*alpha2_sum - alphax_sum*alphabeta_sum) * factor;
-
- // clamp to the grid
- a = Min( one, Max( zero, a ) );
- b = Min( one, Max( zero, b ) );
- a = Floor( grid*a + half )*gridrcp;
- b = Floor( grid*b + half )*gridrcp;
-
- // compute the error
- Vec3 e1 = a*a*alpha2_sum + b*b*beta2_sum + 2.0f*( a*b*alphabeta_sum - a*alphax_sum - b*betax_sum );
-
- // apply the metric to the error term
- float error = Dot( e1, m_metricSqr );
-
- // keep the solution if it wins
- if( error < besterror )
- {
- besterror = error;
- beststart = a;
- bestend = b;
- b0 = c0;
- b1 = c1;
- }
-
- x1 += m_unweighted[c0+c1];
- }
-
- x0 += m_unweighted[c0];
- }
-
- // save the block if necessary
- if( besterror < m_besterror )
- {
- // compute indices from cluster sizes.
- /*uint bestindices = 0;
- {
- int i = b0;
- for(; i < b0+b1; i++) {
- bestindices |= 2 << (2 * m_order[i]);
- }
- for(; i < 16; i++) {
- bestindices |= 1 << (2 * m_order[i]);
- }
- }*/
- u8 bestindices[16];
- {
- int i = 0;
- for(; i < b0; i++) {
- bestindices[i] = 0;
- }
- for(; i < b0+b1; i++) {
- bestindices[i] = 2;
- }
- for(; i < 16; i++) {
- bestindices[i] = 1;
- }
- }
-
- // remap the indices
- u8 ordered[16];
- for( int i = 0; i < 16; ++i )
- ordered[m_order[i]] = bestindices[i];
-
- // save the block
- WriteColourBlock3( beststart, bestend, ordered, block );
-
- // save the error
- m_besterror = besterror;
- }
-}
-
-void FastClusterFit::Compress4( void* block )
-{
- Vec3 const one( 1.0f );
- Vec3 const zero( 0.0f );
- Vec3 const half( 0.5f );
- Vec3 const grid( 31.0f, 63.0f, 31.0f );
- Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f );
-
- // declare variables
- Vec3 beststart( 0.0f );
- Vec3 bestend( 0.0f );
- float besterror = FLT_MAX;
-
- Vec3 x0(0.0f);
- Vec3 x1;
- Vec3 x2;
- int b0 = 0, b1 = 0, b2 = 0;
- int i = 0;
-
- // check all possible clusters for this total order
- for( int c0 = 0; c0 <= 16; c0++)
- {
- x1 = Vec3(0.0f);
-
- for( int c1 = 0; c1 <= 16-c0; c1++)
- {
- x2 = Vec3(0.0f);
-
- for( int c2 = 0; c2 <= 16-c0-c1; c2++)
- {
- float const alpha2_sum = s_fourElement[i].alpha2_sum;
- float const beta2_sum = s_fourElement[i].beta2_sum;
- float const alphabeta_sum = s_fourElement[i].alphabeta_sum;
- float const factor = s_fourElement[i].factor;
- i++;
-
- Vec3 const alphax_sum = x0 + x1 * (2.0f / 3.0f) + x2 * (1.0f / 3.0f);
- Vec3 const betax_sum = m_xsum - alphax_sum;
-
- Vec3 a = ( alphax_sum*beta2_sum - betax_sum*alphabeta_sum )*factor;
- Vec3 b = ( betax_sum*alpha2_sum - alphax_sum*alphabeta_sum )*factor;
-
- // clamp to the grid
- a = Min( one, Max( zero, a ) );
- b = Min( one, Max( zero, b ) );
- a = Floor( grid*a + half )*gridrcp;
- b = Floor( grid*b + half )*gridrcp;
-
- // compute the error
- Vec3 e1 = a*a*alpha2_sum + b*b*beta2_sum + 2.0f*( a*b*alphabeta_sum - a*alphax_sum - b*betax_sum );
-
- // apply the metric to the error term
- float error = Dot( e1, m_metricSqr );
-
- // keep the solution if it wins
- if( error < besterror )
- {
- besterror = error;
- beststart = a;
- bestend = b;
- b0 = c0;
- b1 = c1;
- b2 = c2;
- }
-
- x2 += m_unweighted[c0+c1+c2];
- }
-
- x1 += m_unweighted[c0+c1];
- }
-
- x0 += m_unweighted[c0];
- }
-
- // save the block if necessary
- if( besterror < m_besterror )
- {
- // compute indices from cluster sizes.
- /*uint bestindices = 0;
- {
- int i = b0;
- for(; i < b0+b1; i++) {
- bestindices = 2 << (2 * m_order[i]);
- }
- for(; i < b0+b1+b2; i++) {
- bestindices = 3 << (2 * m_order[i]);
- }
- for(; i < 16; i++) {
- bestindices = 1 << (2 * m_order[i]);
- }
- }*/
- u8 bestindices[16];
- {
- int i = 0;
- for(; i < b0; i++) {
- bestindices[i] = 0;
- }
- for(; i < b0+b1; i++) {
- bestindices[i] = 2;
- }
- for(; i < b0+b1+b2; i++) {
- bestindices[i] = 3;
- }
- for(; i < 16; i++) {
- bestindices[i] = 1;
- }
- }
-
- // remap the indices
- u8 ordered[16];
- for( int i = 0; i < 16; ++i )
- ordered[m_order[i]] = bestindices[i];
-
- // save the block
- WriteColourBlock4( beststart, bestend, ordered, block );
-
- // save the error
- m_besterror = besterror;
- }
-}
-
-#endif
-
-} // namespace squish
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/fastclusterfit.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/fastclusterfit.h
deleted file mode 100644
index cf36eb9e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/fastclusterfit.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
- Copyright (c) 2006 Ignacio Castano icastano@nvidia.com
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef NV_SQUISH_FASTCLUSTERFIT_H
-#define NV_SQUISH_FASTCLUSTERFIT_H
-
-#include "squish.h"
-#include "maths.h"
-#include "simd.h"
-#include "colourfit.h"
-
-namespace nvsquish {
-
-class FastClusterFit : public ColourFit
-{
-public:
- FastClusterFit();
-
- void SetColourSet( ColourSet const* colours, int flags );
-
- void SetMetric(float r, float g, float b);
- float GetBestError() const;
-
- // Make them public
- virtual void Compress3( void* block );
- virtual void Compress4( void* block );
-
-private:
-
- Vec3 m_principle;
-
-#if SQUISH_USE_SIMD
- Vec4 m_unweighted[16];
- Vec4 m_metric;
- Vec4 m_metricSqr;
- Vec4 m_xxsum;
- Vec4 m_xsum;
- Vec4 m_besterror;
-#else
- Vec3 m_unweighted[16];
- Vec3 m_metric;
- Vec3 m_metricSqr;
- Vec3 m_xxsum;
- Vec3 m_xsum;
- float m_besterror;
-#endif
-
- int m_order[16];
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_FASTCLUSTERFIT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/fastclusterlookup.inl b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/fastclusterlookup.inl
deleted file mode 100644
index acdd6801..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/fastclusterlookup.inl
+++ /dev/null
@@ -1,1135 +0,0 @@
-struct Precomp {
- float alpha2_sum;
- float beta2_sum;
- float alphabeta_sum;
- float factor;
-};
-
-static const SQUISH_ALIGN_16 Precomp s_threeElement[153] = {
- { 0.000000f, 16.000000f, 0.000000f, FLT_MAX }, // 0 (0 0 16)
- { 0.250000f, 15.250000f, 0.250000f, 0.266667f }, // 1 (0 1 15)
- { 0.500000f, 14.500000f, 0.500000f, 0.142857f }, // 2 (0 2 14)
- { 0.750000f, 13.750000f, 0.750000f, 0.102564f }, // 3 (0 3 13)
- { 1.000000f, 13.000000f, 1.000000f, 0.083333f }, // 4 (0 4 12)
- { 1.250000f, 12.250000f, 1.250000f, 0.072727f }, // 5 (0 5 11)
- { 1.500000f, 11.500000f, 1.500000f, 0.066667f }, // 6 (0 6 10)
- { 1.750000f, 10.750000f, 1.750000f, 0.063492f }, // 7 (0 7 9)
- { 2.000000f, 10.000000f, 2.000000f, 0.062500f }, // 8 (0 8 8)
- { 2.250000f, 9.250000f, 2.250000f, 0.063492f }, // 9 (0 9 7)
- { 2.500000f, 8.500000f, 2.500000f, 0.066667f }, // 10 (0 10 6)
- { 2.750000f, 7.750000f, 2.750000f, 0.072727f }, // 11 (0 11 5)
- { 3.000000f, 7.000000f, 3.000000f, 0.083333f }, // 12 (0 12 4)
- { 3.250000f, 6.250000f, 3.250000f, 0.102564f }, // 13 (0 13 3)
- { 3.500000f, 5.500000f, 3.500000f, 0.142857f }, // 14 (0 14 2)
- { 3.750000f, 4.750000f, 3.750000f, 0.266667f }, // 15 (0 15 1)
- { 4.000000f, 4.000000f, 4.000000f, FLT_MAX }, // 16 (0 16 0)
- { 1.000000f, 15.000000f, 0.000000f, 0.066667f }, // 17 (1 0 15)
- { 1.250000f, 14.250000f, 0.250000f, 0.056338f }, // 18 (1 1 14)
- { 1.500000f, 13.500000f, 0.500000f, 0.050000f }, // 19 (1 2 13)
- { 1.750000f, 12.750000f, 0.750000f, 0.045977f }, // 20 (1 3 12)
- { 2.000000f, 12.000000f, 1.000000f, 0.043478f }, // 21 (1 4 11)
- { 2.250000f, 11.250000f, 1.250000f, 0.042105f }, // 22 (1 5 10)
- { 2.500000f, 10.500000f, 1.500000f, 0.041667f }, // 23 (1 6 9)
- { 2.750000f, 9.750000f, 1.750000f, 0.042105f }, // 24 (1 7 8)
- { 3.000000f, 9.000000f, 2.000000f, 0.043478f }, // 25 (1 8 7)
- { 3.250000f, 8.250000f, 2.250000f, 0.045977f }, // 26 (1 9 6)
- { 3.500000f, 7.500000f, 2.500000f, 0.050000f }, // 27 (1 10 5)
- { 3.750000f, 6.750000f, 2.750000f, 0.056338f }, // 28 (1 11 4)
- { 4.000000f, 6.000000f, 3.000000f, 0.066667f }, // 29 (1 12 3)
- { 4.250000f, 5.250000f, 3.250000f, 0.085106f }, // 30 (1 13 2)
- { 4.500000f, 4.500000f, 3.500000f, 0.125000f }, // 31 (1 14 1)
- { 4.750000f, 3.750000f, 3.750000f, 0.266667f }, // 32 (1 15 0)
- { 2.000000f, 14.000000f, 0.000000f, 0.035714f }, // 33 (2 0 14)
- { 2.250000f, 13.250000f, 0.250000f, 0.033613f }, // 34 (2 1 13)
- { 2.500000f, 12.500000f, 0.500000f, 0.032258f }, // 35 (2 2 12)
- { 2.750000f, 11.750000f, 0.750000f, 0.031496f }, // 36 (2 3 11)
- { 3.000000f, 11.000000f, 1.000000f, 0.031250f }, // 37 (2 4 10)
- { 3.250000f, 10.250000f, 1.250000f, 0.031496f }, // 38 (2 5 9)
- { 3.500000f, 9.500000f, 1.500000f, 0.032258f }, // 39 (2 6 8)
- { 3.750000f, 8.750000f, 1.750000f, 0.033613f }, // 40 (2 7 7)
- { 4.000000f, 8.000000f, 2.000000f, 0.035714f }, // 41 (2 8 6)
- { 4.250000f, 7.250000f, 2.250000f, 0.038835f }, // 42 (2 9 5)
- { 4.500000f, 6.500000f, 2.500000f, 0.043478f }, // 43 (2 10 4)
- { 4.750000f, 5.750000f, 2.750000f, 0.050633f }, // 44 (2 11 3)
- { 5.000000f, 5.000000f, 3.000000f, 0.062500f }, // 45 (2 12 2)
- { 5.250000f, 4.250000f, 3.250000f, 0.085106f }, // 46 (2 13 1)
- { 5.500000f, 3.500000f, 3.500000f, 0.142857f }, // 47 (2 14 0)
- { 3.000000f, 13.000000f, 0.000000f, 0.025641f }, // 48 (3 0 13)
- { 3.250000f, 12.250000f, 0.250000f, 0.025157f }, // 49 (3 1 12)
- { 3.500000f, 11.500000f, 0.500000f, 0.025000f }, // 50 (3 2 11)
- { 3.750000f, 10.750000f, 0.750000f, 0.025157f }, // 51 (3 3 10)
- { 4.000000f, 10.000000f, 1.000000f, 0.025641f }, // 52 (3 4 9)
- { 4.250000f, 9.250000f, 1.250000f, 0.026490f }, // 53 (3 5 8)
- { 4.500000f, 8.500000f, 1.500000f, 0.027778f }, // 54 (3 6 7)
- { 4.750000f, 7.750000f, 1.750000f, 0.029630f }, // 55 (3 7 6)
- { 5.000000f, 7.000000f, 2.000000f, 0.032258f }, // 56 (3 8 5)
- { 5.250000f, 6.250000f, 2.250000f, 0.036036f }, // 57 (3 9 4)
- { 5.500000f, 5.500000f, 2.500000f, 0.041667f }, // 58 (3 10 3)
- { 5.750000f, 4.750000f, 2.750000f, 0.050633f }, // 59 (3 11 2)
- { 6.000000f, 4.000000f, 3.000000f, 0.066667f }, // 60 (3 12 1)
- { 6.250000f, 3.250000f, 3.250000f, 0.102564f }, // 61 (3 13 0)
- { 4.000000f, 12.000000f, 0.000000f, 0.020833f }, // 62 (4 0 12)
- { 4.250000f, 11.250000f, 0.250000f, 0.020942f }, // 63 (4 1 11)
- { 4.500000f, 10.500000f, 0.500000f, 0.021277f }, // 64 (4 2 10)
- { 4.750000f, 9.750000f, 0.750000f, 0.021858f }, // 65 (4 3 9)
- { 5.000000f, 9.000000f, 1.000000f, 0.022727f }, // 66 (4 4 8)
- { 5.250000f, 8.250000f, 1.250000f, 0.023952f }, // 67 (4 5 7)
- { 5.500000f, 7.500000f, 1.500000f, 0.025641f }, // 68 (4 6 6)
- { 5.750000f, 6.750000f, 1.750000f, 0.027972f }, // 69 (4 7 5)
- { 6.000000f, 6.000000f, 2.000000f, 0.031250f }, // 70 (4 8 4)
- { 6.250000f, 5.250000f, 2.250000f, 0.036036f }, // 71 (4 9 3)
- { 6.500000f, 4.500000f, 2.500000f, 0.043478f }, // 72 (4 10 2)
- { 6.750000f, 3.750000f, 2.750000f, 0.056338f }, // 73 (4 11 1)
- { 7.000000f, 3.000000f, 3.000000f, 0.083333f }, // 74 (4 12 0)
- { 5.000000f, 11.000000f, 0.000000f, 0.018182f }, // 75 (5 0 11)
- { 5.250000f, 10.250000f, 0.250000f, 0.018605f }, // 76 (5 1 10)
- { 5.500000f, 9.500000f, 0.500000f, 0.019231f }, // 77 (5 2 9)
- { 5.750000f, 8.750000f, 0.750000f, 0.020101f }, // 78 (5 3 8)
- { 6.000000f, 8.000000f, 1.000000f, 0.021277f }, // 79 (5 4 7)
- { 6.250000f, 7.250000f, 1.250000f, 0.022857f }, // 80 (5 5 6)
- { 6.500000f, 6.500000f, 1.500000f, 0.025000f }, // 81 (5 6 5)
- { 6.750000f, 5.750000f, 1.750000f, 0.027972f }, // 82 (5 7 4)
- { 7.000000f, 5.000000f, 2.000000f, 0.032258f }, // 83 (5 8 3)
- { 7.250000f, 4.250000f, 2.250000f, 0.038835f }, // 84 (5 9 2)
- { 7.500000f, 3.500000f, 2.500000f, 0.050000f }, // 85 (5 10 1)
- { 7.750000f, 2.750000f, 2.750000f, 0.072727f }, // 86 (5 11 0)
- { 6.000000f, 10.000000f, 0.000000f, 0.016667f }, // 87 (6 0 10)
- { 6.250000f, 9.250000f, 0.250000f, 0.017316f }, // 88 (6 1 9)
- { 6.500000f, 8.500000f, 0.500000f, 0.018182f }, // 89 (6 2 8)
- { 6.750000f, 7.750000f, 0.750000f, 0.019324f }, // 90 (6 3 7)
- { 7.000000f, 7.000000f, 1.000000f, 0.020833f }, // 91 (6 4 6)
- { 7.250000f, 6.250000f, 1.250000f, 0.022857f }, // 92 (6 5 5)
- { 7.500000f, 5.500000f, 1.500000f, 0.025641f }, // 93 (6 6 4)
- { 7.750000f, 4.750000f, 1.750000f, 0.029630f }, // 94 (6 7 3)
- { 8.000000f, 4.000000f, 2.000000f, 0.035714f }, // 95 (6 8 2)
- { 8.250000f, 3.250000f, 2.250000f, 0.045977f }, // 96 (6 9 1)
- { 8.500000f, 2.500000f, 2.500000f, 0.066667f }, // 97 (6 10 0)
- { 7.000000f, 9.000000f, 0.000000f, 0.015873f }, // 98 (7 0 9)
- { 7.250000f, 8.250000f, 0.250000f, 0.016736f }, // 99 (7 1 8)
- { 7.500000f, 7.500000f, 0.500000f, 0.017857f }, // 100 (7 2 7)
- { 7.750000f, 6.750000f, 0.750000f, 0.019324f }, // 101 (7 3 6)
- { 8.000000f, 6.000000f, 1.000000f, 0.021277f }, // 102 (7 4 5)
- { 8.250000f, 5.250000f, 1.250000f, 0.023952f }, // 103 (7 5 4)
- { 8.500000f, 4.500000f, 1.500000f, 0.027778f }, // 104 (7 6 3)
- { 8.750000f, 3.750000f, 1.750000f, 0.033613f }, // 105 (7 7 2)
- { 9.000000f, 3.000000f, 2.000000f, 0.043478f }, // 106 (7 8 1)
- { 9.250000f, 2.250000f, 2.250000f, 0.063492f }, // 107 (7 9 0)
- { 8.000000f, 8.000000f, 0.000000f, 0.015625f }, // 108 (8 0 8)
- { 8.250000f, 7.250000f, 0.250000f, 0.016736f }, // 109 (8 1 7)
- { 8.500000f, 6.500000f, 0.500000f, 0.018182f }, // 110 (8 2 6)
- { 8.750000f, 5.750000f, 0.750000f, 0.020101f }, // 111 (8 3 5)
- { 9.000000f, 5.000000f, 1.000000f, 0.022727f }, // 112 (8 4 4)
- { 9.250000f, 4.250000f, 1.250000f, 0.026490f }, // 113 (8 5 3)
- { 9.500000f, 3.500000f, 1.500000f, 0.032258f }, // 114 (8 6 2)
- { 9.750000f, 2.750000f, 1.750000f, 0.042105f }, // 115 (8 7 1)
- { 10.000000f, 2.000000f, 2.000000f, 0.062500f }, // 116 (8 8 0)
- { 9.000000f, 7.000000f, 0.000000f, 0.015873f }, // 117 (9 0 7)
- { 9.250000f, 6.250000f, 0.250000f, 0.017316f }, // 118 (9 1 6)
- { 9.500000f, 5.500000f, 0.500000f, 0.019231f }, // 119 (9 2 5)
- { 9.750000f, 4.750000f, 0.750000f, 0.021858f }, // 120 (9 3 4)
- { 10.000000f, 4.000000f, 1.000000f, 0.025641f }, // 121 (9 4 3)
- { 10.250000f, 3.250000f, 1.250000f, 0.031496f }, // 122 (9 5 2)
- { 10.500000f, 2.500000f, 1.500000f, 0.041667f }, // 123 (9 6 1)
- { 10.750000f, 1.750000f, 1.750000f, 0.063492f }, // 124 (9 7 0)
- { 10.000000f, 6.000000f, 0.000000f, 0.016667f }, // 125 (10 0 6)
- { 10.250000f, 5.250000f, 0.250000f, 0.018605f }, // 126 (10 1 5)
- { 10.500000f, 4.500000f, 0.500000f, 0.021277f }, // 127 (10 2 4)
- { 10.750000f, 3.750000f, 0.750000f, 0.025157f }, // 128 (10 3 3)
- { 11.000000f, 3.000000f, 1.000000f, 0.031250f }, // 129 (10 4 2)
- { 11.250000f, 2.250000f, 1.250000f, 0.042105f }, // 130 (10 5 1)
- { 11.500000f, 1.500000f, 1.500000f, 0.066667f }, // 131 (10 6 0)
- { 11.000000f, 5.000000f, 0.000000f, 0.018182f }, // 132 (11 0 5)
- { 11.250000f, 4.250000f, 0.250000f, 0.020942f }, // 133 (11 1 4)
- { 11.500000f, 3.500000f, 0.500000f, 0.025000f }, // 134 (11 2 3)
- { 11.750000f, 2.750000f, 0.750000f, 0.031496f }, // 135 (11 3 2)
- { 12.000000f, 2.000000f, 1.000000f, 0.043478f }, // 136 (11 4 1)
- { 12.250000f, 1.250000f, 1.250000f, 0.072727f }, // 137 (11 5 0)
- { 12.000000f, 4.000000f, 0.000000f, 0.020833f }, // 138 (12 0 4)
- { 12.250000f, 3.250000f, 0.250000f, 0.025157f }, // 139 (12 1 3)
- { 12.500000f, 2.500000f, 0.500000f, 0.032258f }, // 140 (12 2 2)
- { 12.750000f, 1.750000f, 0.750000f, 0.045977f }, // 141 (12 3 1)
- { 13.000000f, 1.000000f, 1.000000f, 0.083333f }, // 142 (12 4 0)
- { 13.000000f, 3.000000f, 0.000000f, 0.025641f }, // 143 (13 0 3)
- { 13.250000f, 2.250000f, 0.250000f, 0.033613f }, // 144 (13 1 2)
- { 13.500000f, 1.500000f, 0.500000f, 0.050000f }, // 145 (13 2 1)
- { 13.750000f, 0.750000f, 0.750000f, 0.102564f }, // 146 (13 3 0)
- { 14.000000f, 2.000000f, 0.000000f, 0.035714f }, // 147 (14 0 2)
- { 14.250000f, 1.250000f, 0.250000f, 0.056338f }, // 148 (14 1 1)
- { 14.500000f, 0.500000f, 0.500000f, 0.142857f }, // 149 (14 2 0)
- { 15.000000f, 1.000000f, 0.000000f, 0.066667f }, // 150 (15 0 1)
- { 15.250000f, 0.250000f, 0.250000f, 0.266667f }, // 151 (15 1 0)
- { 16.000000f, 0.000000f, 0.000000f, FLT_MAX }, // 152 (16 0 0)
-}; // 153 three cluster elements
-
-static const SQUISH_ALIGN_16 Precomp s_fourElement[969] = {
- { 0.000000f, 16.000000f, 0.000000f, FLT_MAX }, // 0 (0 0 0 16)
- { 0.111111f, 15.444445f, 0.222222f, 0.600000f }, // 1 (0 0 1 15)
- { 0.222222f, 14.888889f, 0.444444f, 0.321429f }, // 2 (0 0 2 14)
- { 0.333333f, 14.333333f, 0.666667f, 0.230769f }, // 3 (0 0 3 13)
- { 0.444444f, 13.777778f, 0.888889f, 0.187500f }, // 4 (0 0 4 12)
- { 0.555556f, 13.222222f, 1.111111f, 0.163636f }, // 5 (0 0 5 11)
- { 0.666667f, 12.666667f, 1.333333f, 0.150000f }, // 6 (0 0 6 10)
- { 0.777778f, 12.111111f, 1.555556f, 0.142857f }, // 7 (0 0 7 9)
- { 0.888889f, 11.555555f, 1.777778f, 0.140625f }, // 8 (0 0 8 8)
- { 1.000000f, 11.000000f, 2.000000f, 0.142857f }, // 9 (0 0 9 7)
- { 1.111111f, 10.444445f, 2.222222f, 0.150000f }, // 10 (0 0 10 6)
- { 1.222222f, 9.888889f, 2.444444f, 0.163636f }, // 11 (0 0 11 5)
- { 1.333333f, 9.333333f, 2.666667f, 0.187500f }, // 12 (0 0 12 4)
- { 1.444444f, 8.777778f, 2.888889f, 0.230769f }, // 13 (0 0 13 3)
- { 1.555556f, 8.222222f, 3.111111f, 0.321429f }, // 14 (0 0 14 2)
- { 1.666667f, 7.666667f, 3.333333f, 0.600000f }, // 15 (0 0 15 1)
- { 1.777778f, 7.111111f, 3.555556f, FLT_MAX }, // 16 (0 0 16 0)
- { 0.444444f, 15.111111f, 0.222222f, 0.150000f }, // 17 (0 1 0 15)
- { 0.555556f, 14.555555f, 0.444444f, 0.126761f }, // 18 (0 1 1 14)
- { 0.666667f, 14.000000f, 0.666667f, 0.112500f }, // 19 (0 1 2 13)
- { 0.777778f, 13.444445f, 0.888889f, 0.103448f }, // 20 (0 1 3 12)
- { 0.888889f, 12.888889f, 1.111111f, 0.097826f }, // 21 (0 1 4 11)
- { 1.000000f, 12.333333f, 1.333333f, 0.094737f }, // 22 (0 1 5 10)
- { 1.111111f, 11.777778f, 1.555556f, 0.093750f }, // 23 (0 1 6 9)
- { 1.222222f, 11.222222f, 1.777778f, 0.094737f }, // 24 (0 1 7 8)
- { 1.333333f, 10.666667f, 2.000000f, 0.097826f }, // 25 (0 1 8 7)
- { 1.444444f, 10.111111f, 2.222222f, 0.103448f }, // 26 (0 1 9 6)
- { 1.555556f, 9.555555f, 2.444444f, 0.112500f }, // 27 (0 1 10 5)
- { 1.666667f, 9.000000f, 2.666667f, 0.126761f }, // 28 (0 1 11 4)
- { 1.777778f, 8.444445f, 2.888889f, 0.150000f }, // 29 (0 1 12 3)
- { 1.888889f, 7.888889f, 3.111111f, 0.191489f }, // 30 (0 1 13 2)
- { 2.000000f, 7.333333f, 3.333333f, 0.281250f }, // 31 (0 1 14 1)
- { 2.111111f, 6.777778f, 3.555556f, 0.600000f }, // 32 (0 1 15 0)
- { 0.888889f, 14.222222f, 0.444444f, 0.080357f }, // 33 (0 2 0 14)
- { 1.000000f, 13.666667f, 0.666667f, 0.075630f }, // 34 (0 2 1 13)
- { 1.111111f, 13.111111f, 0.888889f, 0.072581f }, // 35 (0 2 2 12)
- { 1.222222f, 12.555555f, 1.111111f, 0.070866f }, // 36 (0 2 3 11)
- { 1.333333f, 12.000000f, 1.333333f, 0.070313f }, // 37 (0 2 4 10)
- { 1.444444f, 11.444445f, 1.555556f, 0.070866f }, // 38 (0 2 5 9)
- { 1.555556f, 10.888889f, 1.777778f, 0.072581f }, // 39 (0 2 6 8)
- { 1.666667f, 10.333333f, 2.000000f, 0.075630f }, // 40 (0 2 7 7)
- { 1.777778f, 9.777778f, 2.222222f, 0.080357f }, // 41 (0 2 8 6)
- { 1.888889f, 9.222222f, 2.444444f, 0.087379f }, // 42 (0 2 9 5)
- { 2.000000f, 8.666667f, 2.666667f, 0.097826f }, // 43 (0 2 10 4)
- { 2.111111f, 8.111111f, 2.888889f, 0.113924f }, // 44 (0 2 11 3)
- { 2.222222f, 7.555556f, 3.111111f, 0.140625f }, // 45 (0 2 12 2)
- { 2.333333f, 7.000000f, 3.333333f, 0.191489f }, // 46 (0 2 13 1)
- { 2.444444f, 6.444445f, 3.555556f, 0.321429f }, // 47 (0 2 14 0)
- { 1.333333f, 13.333333f, 0.666667f, 0.057692f }, // 48 (0 3 0 13)
- { 1.444444f, 12.777778f, 0.888889f, 0.056604f }, // 49 (0 3 1 12)
- { 1.555556f, 12.222222f, 1.111111f, 0.056250f }, // 50 (0 3 2 11)
- { 1.666667f, 11.666667f, 1.333333f, 0.056604f }, // 51 (0 3 3 10)
- { 1.777778f, 11.111111f, 1.555556f, 0.057692f }, // 52 (0 3 4 9)
- { 1.888889f, 10.555555f, 1.777778f, 0.059603f }, // 53 (0 3 5 8)
- { 2.000000f, 10.000000f, 2.000000f, 0.062500f }, // 54 (0 3 6 7)
- { 2.111111f, 9.444445f, 2.222222f, 0.066667f }, // 55 (0 3 7 6)
- { 2.222222f, 8.888889f, 2.444444f, 0.072581f }, // 56 (0 3 8 5)
- { 2.333333f, 8.333333f, 2.666667f, 0.081081f }, // 57 (0 3 9 4)
- { 2.444444f, 7.777778f, 2.888889f, 0.093750f }, // 58 (0 3 10 3)
- { 2.555556f, 7.222222f, 3.111111f, 0.113924f }, // 59 (0 3 11 2)
- { 2.666667f, 6.666667f, 3.333333f, 0.150000f }, // 60 (0 3 12 1)
- { 2.777778f, 6.111111f, 3.555556f, 0.230769f }, // 61 (0 3 13 0)
- { 1.777778f, 12.444445f, 0.888889f, 0.046875f }, // 62 (0 4 0 12)
- { 1.888889f, 11.888889f, 1.111111f, 0.047120f }, // 63 (0 4 1 11)
- { 2.000000f, 11.333333f, 1.333333f, 0.047872f }, // 64 (0 4 2 10)
- { 2.111111f, 10.777778f, 1.555556f, 0.049180f }, // 65 (0 4 3 9)
- { 2.222222f, 10.222222f, 1.777778f, 0.051136f }, // 66 (0 4 4 8)
- { 2.333333f, 9.666667f, 2.000000f, 0.053892f }, // 67 (0 4 5 7)
- { 2.444444f, 9.111111f, 2.222222f, 0.057692f }, // 68 (0 4 6 6)
- { 2.555556f, 8.555555f, 2.444444f, 0.062937f }, // 69 (0 4 7 5)
- { 2.666667f, 8.000000f, 2.666667f, 0.070313f }, // 70 (0 4 8 4)
- { 2.777778f, 7.444445f, 2.888889f, 0.081081f }, // 71 (0 4 9 3)
- { 2.888889f, 6.888889f, 3.111111f, 0.097826f }, // 72 (0 4 10 2)
- { 3.000000f, 6.333333f, 3.333333f, 0.126761f }, // 73 (0 4 11 1)
- { 3.111111f, 5.777778f, 3.555556f, 0.187500f }, // 74 (0 4 12 0)
- { 2.222222f, 11.555555f, 1.111111f, 0.040909f }, // 75 (0 5 0 11)
- { 2.333333f, 11.000000f, 1.333333f, 0.041860f }, // 76 (0 5 1 10)
- { 2.444444f, 10.444445f, 1.555556f, 0.043269f }, // 77 (0 5 2 9)
- { 2.555556f, 9.888889f, 1.777778f, 0.045226f }, // 78 (0 5 3 8)
- { 2.666667f, 9.333333f, 2.000000f, 0.047872f }, // 79 (0 5 4 7)
- { 2.777778f, 8.777778f, 2.222222f, 0.051429f }, // 80 (0 5 5 6)
- { 2.888889f, 8.222222f, 2.444444f, 0.056250f }, // 81 (0 5 6 5)
- { 3.000000f, 7.666667f, 2.666667f, 0.062937f }, // 82 (0 5 7 4)
- { 3.111111f, 7.111111f, 2.888889f, 0.072581f }, // 83 (0 5 8 3)
- { 3.222222f, 6.555556f, 3.111111f, 0.087379f }, // 84 (0 5 9 2)
- { 3.333333f, 6.000000f, 3.333333f, 0.112500f }, // 85 (0 5 10 1)
- { 3.444444f, 5.444445f, 3.555556f, 0.163636f }, // 86 (0 5 11 0)
- { 2.666667f, 10.666667f, 1.333333f, 0.037500f }, // 87 (0 6 0 10)
- { 2.777778f, 10.111111f, 1.555556f, 0.038961f }, // 88 (0 6 1 9)
- { 2.888889f, 9.555555f, 1.777778f, 0.040909f }, // 89 (0 6 2 8)
- { 3.000000f, 9.000000f, 2.000000f, 0.043478f }, // 90 (0 6 3 7)
- { 3.111111f, 8.444445f, 2.222222f, 0.046875f }, // 91 (0 6 4 6)
- { 3.222222f, 7.888889f, 2.444444f, 0.051429f }, // 92 (0 6 5 5)
- { 3.333333f, 7.333333f, 2.666667f, 0.057692f }, // 93 (0 6 6 4)
- { 3.444444f, 6.777778f, 2.888889f, 0.066667f }, // 94 (0 6 7 3)
- { 3.555556f, 6.222222f, 3.111111f, 0.080357f }, // 95 (0 6 8 2)
- { 3.666667f, 5.666667f, 3.333333f, 0.103448f }, // 96 (0 6 9 1)
- { 3.777778f, 5.111111f, 3.555556f, 0.150000f }, // 97 (0 6 10 0)
- { 3.111111f, 9.777778f, 1.555556f, 0.035714f }, // 98 (0 7 0 9)
- { 3.222222f, 9.222222f, 1.777778f, 0.037657f }, // 99 (0 7 1 8)
- { 3.333333f, 8.666667f, 2.000000f, 0.040179f }, // 100 (0 7 2 7)
- { 3.444444f, 8.111111f, 2.222222f, 0.043478f }, // 101 (0 7 3 6)
- { 3.555556f, 7.555555f, 2.444444f, 0.047872f }, // 102 (0 7 4 5)
- { 3.666667f, 7.000000f, 2.666667f, 0.053892f }, // 103 (0 7 5 4)
- { 3.777778f, 6.444445f, 2.888889f, 0.062500f }, // 104 (0 7 6 3)
- { 3.888889f, 5.888889f, 3.111111f, 0.075630f }, // 105 (0 7 7 2)
- { 4.000000f, 5.333333f, 3.333333f, 0.097826f }, // 106 (0 7 8 1)
- { 4.111111f, 4.777778f, 3.555556f, 0.142857f }, // 107 (0 7 9 0)
- { 3.555556f, 8.888889f, 1.777778f, 0.035156f }, // 108 (0 8 0 8)
- { 3.666667f, 8.333333f, 2.000000f, 0.037657f }, // 109 (0 8 1 7)
- { 3.777778f, 7.777778f, 2.222222f, 0.040909f }, // 110 (0 8 2 6)
- { 3.888889f, 7.222222f, 2.444444f, 0.045226f }, // 111 (0 8 3 5)
- { 4.000000f, 6.666667f, 2.666667f, 0.051136f }, // 112 (0 8 4 4)
- { 4.111111f, 6.111111f, 2.888889f, 0.059603f }, // 113 (0 8 5 3)
- { 4.222222f, 5.555555f, 3.111111f, 0.072581f }, // 114 (0 8 6 2)
- { 4.333333f, 5.000000f, 3.333333f, 0.094737f }, // 115 (0 8 7 1)
- { 4.444445f, 4.444445f, 3.555556f, 0.140625f }, // 116 (0 8 8 0)
- { 4.000000f, 8.000000f, 2.000000f, 0.035714f }, // 117 (0 9 0 7)
- { 4.111111f, 7.444445f, 2.222222f, 0.038961f }, // 118 (0 9 1 6)
- { 4.222222f, 6.888889f, 2.444444f, 0.043269f }, // 119 (0 9 2 5)
- { 4.333333f, 6.333333f, 2.666667f, 0.049180f }, // 120 (0 9 3 4)
- { 4.444445f, 5.777778f, 2.888889f, 0.057692f }, // 121 (0 9 4 3)
- { 4.555556f, 5.222222f, 3.111111f, 0.070866f }, // 122 (0 9 5 2)
- { 4.666667f, 4.666667f, 3.333333f, 0.093750f }, // 123 (0 9 6 1)
- { 4.777778f, 4.111111f, 3.555556f, 0.142857f }, // 124 (0 9 7 0)
- { 4.444445f, 7.111111f, 2.222222f, 0.037500f }, // 125 (0 10 0 6)
- { 4.555556f, 6.555555f, 2.444444f, 0.041860f }, // 126 (0 10 1 5)
- { 4.666667f, 6.000000f, 2.666667f, 0.047872f }, // 127 (0 10 2 4)
- { 4.777778f, 5.444445f, 2.888889f, 0.056604f }, // 128 (0 10 3 3)
- { 4.888889f, 4.888889f, 3.111111f, 0.070313f }, // 129 (0 10 4 2)
- { 5.000000f, 4.333333f, 3.333333f, 0.094737f }, // 130 (0 10 5 1)
- { 5.111111f, 3.777778f, 3.555556f, 0.150000f }, // 131 (0 10 6 0)
- { 4.888889f, 6.222222f, 2.444444f, 0.040909f }, // 132 (0 11 0 5)
- { 5.000000f, 5.666667f, 2.666667f, 0.047120f }, // 133 (0 11 1 4)
- { 5.111111f, 5.111111f, 2.888889f, 0.056250f }, // 134 (0 11 2 3)
- { 5.222222f, 4.555555f, 3.111111f, 0.070866f }, // 135 (0 11 3 2)
- { 5.333333f, 4.000000f, 3.333333f, 0.097826f }, // 136 (0 11 4 1)
- { 5.444445f, 3.444444f, 3.555556f, 0.163636f }, // 137 (0 11 5 0)
- { 5.333333f, 5.333333f, 2.666667f, 0.046875f }, // 138 (0 12 0 4)
- { 5.444445f, 4.777778f, 2.888889f, 0.056604f }, // 139 (0 12 1 3)
- { 5.555556f, 4.222222f, 3.111111f, 0.072581f }, // 140 (0 12 2 2)
- { 5.666667f, 3.666667f, 3.333333f, 0.103448f }, // 141 (0 12 3 1)
- { 5.777778f, 3.111111f, 3.555556f, 0.187500f }, // 142 (0 12 4 0)
- { 5.777778f, 4.444445f, 2.888889f, 0.057692f }, // 143 (0 13 0 3)
- { 5.888889f, 3.888889f, 3.111111f, 0.075630f }, // 144 (0 13 1 2)
- { 6.000000f, 3.333333f, 3.333333f, 0.112500f }, // 145 (0 13 2 1)
- { 6.111111f, 2.777778f, 3.555556f, 0.230769f }, // 146 (0 13 3 0)
- { 6.222222f, 3.555556f, 3.111111f, 0.080357f }, // 147 (0 14 0 2)
- { 6.333333f, 3.000000f, 3.333333f, 0.126761f }, // 148 (0 14 1 1)
- { 6.444445f, 2.444444f, 3.555556f, 0.321429f }, // 149 (0 14 2 0)
- { 6.666667f, 2.666667f, 3.333333f, 0.150000f }, // 150 (0 15 0 1)
- { 6.777778f, 2.111111f, 3.555556f, 0.600000f }, // 151 (0 15 1 0)
- { 7.111111f, 1.777778f, 3.555556f, FLT_MAX }, // 152 (0 16 0 0)
- { 1.000000f, 15.000000f, 0.000000f, 0.066667f }, // 153 (1 0 0 15)
- { 1.111111f, 14.444445f, 0.222222f, 0.062500f }, // 154 (1 0 1 14)
- { 1.222222f, 13.888889f, 0.444444f, 0.059603f }, // 155 (1 0 2 13)
- { 1.333333f, 13.333333f, 0.666667f, 0.057692f }, // 156 (1 0 3 12)
- { 1.444444f, 12.777778f, 0.888889f, 0.056604f }, // 157 (1 0 4 11)
- { 1.555556f, 12.222222f, 1.111111f, 0.056250f }, // 158 (1 0 5 10)
- { 1.666667f, 11.666667f, 1.333333f, 0.056604f }, // 159 (1 0 6 9)
- { 1.777778f, 11.111111f, 1.555556f, 0.057692f }, // 160 (1 0 7 8)
- { 1.888889f, 10.555555f, 1.777778f, 0.059603f }, // 161 (1 0 8 7)
- { 2.000000f, 10.000000f, 2.000000f, 0.062500f }, // 162 (1 0 9 6)
- { 2.111111f, 9.444445f, 2.222222f, 0.066667f }, // 163 (1 0 10 5)
- { 2.222222f, 8.888889f, 2.444444f, 0.072581f }, // 164 (1 0 11 4)
- { 2.333333f, 8.333333f, 2.666667f, 0.081081f }, // 165 (1 0 12 3)
- { 2.444444f, 7.777778f, 2.888889f, 0.093750f }, // 166 (1 0 13 2)
- { 2.555556f, 7.222222f, 3.111111f, 0.113924f }, // 167 (1 0 14 1)
- { 2.666667f, 6.666667f, 3.333333f, 0.150000f }, // 168 (1 0 15 0)
- { 1.444444f, 14.111111f, 0.222222f, 0.049180f }, // 169 (1 1 0 14)
- { 1.555556f, 13.555555f, 0.444444f, 0.047872f }, // 170 (1 1 1 13)
- { 1.666667f, 13.000000f, 0.666667f, 0.047120f }, // 171 (1 1 2 12)
- { 1.777778f, 12.444445f, 0.888889f, 0.046875f }, // 172 (1 1 3 11)
- { 1.888889f, 11.888889f, 1.111111f, 0.047120f }, // 173 (1 1 4 10)
- { 2.000000f, 11.333333f, 1.333333f, 0.047872f }, // 174 (1 1 5 9)
- { 2.111111f, 10.777778f, 1.555556f, 0.049180f }, // 175 (1 1 6 8)
- { 2.222222f, 10.222222f, 1.777778f, 0.051136f }, // 176 (1 1 7 7)
- { 2.333333f, 9.666667f, 2.000000f, 0.053892f }, // 177 (1 1 8 6)
- { 2.444444f, 9.111111f, 2.222222f, 0.057692f }, // 178 (1 1 9 5)
- { 2.555556f, 8.555555f, 2.444444f, 0.062937f }, // 179 (1 1 10 4)
- { 2.666667f, 8.000000f, 2.666667f, 0.070313f }, // 180 (1 1 11 3)
- { 2.777778f, 7.444445f, 2.888889f, 0.081081f }, // 181 (1 1 12 2)
- { 2.888889f, 6.888889f, 3.111111f, 0.097826f }, // 182 (1 1 13 1)
- { 3.000000f, 6.333333f, 3.333333f, 0.126761f }, // 183 (1 1 14 0)
- { 1.888889f, 13.222222f, 0.444444f, 0.040359f }, // 184 (1 2 0 13)
- { 2.000000f, 12.666667f, 0.666667f, 0.040179f }, // 185 (1 2 1 12)
- { 2.111111f, 12.111111f, 0.888889f, 0.040359f }, // 186 (1 2 2 11)
- { 2.222222f, 11.555555f, 1.111111f, 0.040909f }, // 187 (1 2 3 10)
- { 2.333333f, 11.000000f, 1.333333f, 0.041860f }, // 188 (1 2 4 9)
- { 2.444444f, 10.444445f, 1.555556f, 0.043269f }, // 189 (1 2 5 8)
- { 2.555556f, 9.888889f, 1.777778f, 0.045226f }, // 190 (1 2 6 7)
- { 2.666667f, 9.333333f, 2.000000f, 0.047872f }, // 191 (1 2 7 6)
- { 2.777778f, 8.777778f, 2.222222f, 0.051429f }, // 192 (1 2 8 5)
- { 2.888889f, 8.222222f, 2.444444f, 0.056250f }, // 193 (1 2 9 4)
- { 3.000000f, 7.666667f, 2.666667f, 0.062937f }, // 194 (1 2 10 3)
- { 3.111111f, 7.111111f, 2.888889f, 0.072581f }, // 195 (1 2 11 2)
- { 3.222222f, 6.555556f, 3.111111f, 0.087379f }, // 196 (1 2 12 1)
- { 3.333333f, 6.000000f, 3.333333f, 0.112500f }, // 197 (1 2 13 0)
- { 2.333333f, 12.333333f, 0.666667f, 0.035294f }, // 198 (1 3 0 12)
- { 2.444444f, 11.777778f, 0.888889f, 0.035714f }, // 199 (1 3 1 11)
- { 2.555556f, 11.222222f, 1.111111f, 0.036437f }, // 200 (1 3 2 10)
- { 2.666667f, 10.666667f, 1.333333f, 0.037500f }, // 201 (1 3 3 9)
- { 2.777778f, 10.111111f, 1.555556f, 0.038961f }, // 202 (1 3 4 8)
- { 2.888889f, 9.555555f, 1.777778f, 0.040909f }, // 203 (1 3 5 7)
- { 3.000000f, 9.000000f, 2.000000f, 0.043478f }, // 204 (1 3 6 6)
- { 3.111111f, 8.444445f, 2.222222f, 0.046875f }, // 205 (1 3 7 5)
- { 3.222222f, 7.888889f, 2.444444f, 0.051429f }, // 206 (1 3 8 4)
- { 3.333333f, 7.333333f, 2.666667f, 0.057692f }, // 207 (1 3 9 3)
- { 3.444444f, 6.777778f, 2.888889f, 0.066667f }, // 208 (1 3 10 2)
- { 3.555556f, 6.222222f, 3.111111f, 0.080357f }, // 209 (1 3 11 1)
- { 3.666667f, 5.666667f, 3.333333f, 0.103448f }, // 210 (1 3 12 0)
- { 2.777778f, 11.444445f, 0.888889f, 0.032258f }, // 211 (1 4 0 11)
- { 2.888889f, 10.888889f, 1.111111f, 0.033088f }, // 212 (1 4 1 10)
- { 3.000000f, 10.333333f, 1.333333f, 0.034221f }, // 213 (1 4 2 9)
- { 3.111111f, 9.777778f, 1.555556f, 0.035714f }, // 214 (1 4 3 8)
- { 3.222222f, 9.222222f, 1.777778f, 0.037657f }, // 215 (1 4 4 7)
- { 3.333333f, 8.666667f, 2.000000f, 0.040179f }, // 216 (1 4 5 6)
- { 3.444444f, 8.111111f, 2.222222f, 0.043478f }, // 217 (1 4 6 5)
- { 3.555556f, 7.555555f, 2.444444f, 0.047872f }, // 218 (1 4 7 4)
- { 3.666667f, 7.000000f, 2.666667f, 0.053892f }, // 219 (1 4 8 3)
- { 3.777778f, 6.444445f, 2.888889f, 0.062500f }, // 220 (1 4 9 2)
- { 3.888889f, 5.888889f, 3.111111f, 0.075630f }, // 221 (1 4 10 1)
- { 4.000000f, 5.333333f, 3.333333f, 0.097826f }, // 222 (1 4 11 0)
- { 3.222222f, 10.555555f, 1.111111f, 0.030508f }, // 223 (1 5 0 10)
- { 3.333333f, 10.000000f, 1.333333f, 0.031690f }, // 224 (1 5 1 9)
- { 3.444444f, 9.444445f, 1.555556f, 0.033210f }, // 225 (1 5 2 8)
- { 3.555556f, 8.888889f, 1.777778f, 0.035156f }, // 226 (1 5 3 7)
- { 3.666667f, 8.333333f, 2.000000f, 0.037657f }, // 227 (1 5 4 6)
- { 3.777778f, 7.777778f, 2.222222f, 0.040909f }, // 228 (1 5 5 5)
- { 3.888889f, 7.222222f, 2.444444f, 0.045226f }, // 229 (1 5 6 4)
- { 4.000000f, 6.666667f, 2.666667f, 0.051136f }, // 230 (1 5 7 3)
- { 4.111111f, 6.111111f, 2.888889f, 0.059603f }, // 231 (1 5 8 2)
- { 4.222222f, 5.555556f, 3.111111f, 0.072581f }, // 232 (1 5 9 1)
- { 4.333333f, 5.000000f, 3.333333f, 0.094737f }, // 233 (1 5 10 0)
- { 3.666667f, 9.666667f, 1.333333f, 0.029703f }, // 234 (1 6 0 9)
- { 3.777778f, 9.111111f, 1.555556f, 0.031250f }, // 235 (1 6 1 8)
- { 3.888889f, 8.555555f, 1.777778f, 0.033210f }, // 236 (1 6 2 7)
- { 4.000000f, 8.000000f, 2.000000f, 0.035714f }, // 237 (1 6 3 6)
- { 4.111111f, 7.444445f, 2.222222f, 0.038961f }, // 238 (1 6 4 5)
- { 4.222222f, 6.888889f, 2.444444f, 0.043269f }, // 239 (1 6 5 4)
- { 4.333333f, 6.333333f, 2.666667f, 0.049180f }, // 240 (1 6 6 3)
- { 4.444445f, 5.777778f, 2.888889f, 0.057692f }, // 241 (1 6 7 2)
- { 4.555555f, 5.222222f, 3.111111f, 0.070866f }, // 242 (1 6 8 1)
- { 4.666667f, 4.666667f, 3.333333f, 0.093750f }, // 243 (1 6 9 0)
- { 4.111111f, 8.777778f, 1.555556f, 0.029703f }, // 244 (1 7 0 8)
- { 4.222222f, 8.222222f, 1.777778f, 0.031690f }, // 245 (1 7 1 7)
- { 4.333333f, 7.666667f, 2.000000f, 0.034221f }, // 246 (1 7 2 6)
- { 4.444445f, 7.111111f, 2.222222f, 0.037500f }, // 247 (1 7 3 5)
- { 4.555555f, 6.555555f, 2.444444f, 0.041860f }, // 248 (1 7 4 4)
- { 4.666667f, 6.000000f, 2.666667f, 0.047872f }, // 249 (1 7 5 3)
- { 4.777778f, 5.444445f, 2.888889f, 0.056604f }, // 250 (1 7 6 2)
- { 4.888889f, 4.888889f, 3.111111f, 0.070313f }, // 251 (1 7 7 1)
- { 5.000000f, 4.333333f, 3.333333f, 0.094737f }, // 252 (1 7 8 0)
- { 4.555555f, 7.888889f, 1.777778f, 0.030508f }, // 253 (1 8 0 7)
- { 4.666667f, 7.333333f, 2.000000f, 0.033088f }, // 254 (1 8 1 6)
- { 4.777778f, 6.777778f, 2.222222f, 0.036437f }, // 255 (1 8 2 5)
- { 4.888889f, 6.222222f, 2.444444f, 0.040909f }, // 256 (1 8 3 4)
- { 5.000000f, 5.666667f, 2.666667f, 0.047120f }, // 257 (1 8 4 3)
- { 5.111111f, 5.111111f, 2.888889f, 0.056250f }, // 258 (1 8 5 2)
- { 5.222222f, 4.555555f, 3.111111f, 0.070866f }, // 259 (1 8 6 1)
- { 5.333333f, 4.000000f, 3.333333f, 0.097826f }, // 260 (1 8 7 0)
- { 5.000000f, 7.000000f, 2.000000f, 0.032258f }, // 261 (1 9 0 6)
- { 5.111111f, 6.444445f, 2.222222f, 0.035714f }, // 262 (1 9 1 5)
- { 5.222222f, 5.888889f, 2.444444f, 0.040359f }, // 263 (1 9 2 4)
- { 5.333333f, 5.333333f, 2.666667f, 0.046875f }, // 264 (1 9 3 3)
- { 5.444445f, 4.777778f, 2.888889f, 0.056604f }, // 265 (1 9 4 2)
- { 5.555556f, 4.222222f, 3.111111f, 0.072581f }, // 266 (1 9 5 1)
- { 5.666667f, 3.666667f, 3.333333f, 0.103448f }, // 267 (1 9 6 0)
- { 5.444445f, 6.111111f, 2.222222f, 0.035294f }, // 268 (1 10 0 5)
- { 5.555556f, 5.555555f, 2.444444f, 0.040179f }, // 269 (1 10 1 4)
- { 5.666667f, 5.000000f, 2.666667f, 0.047120f }, // 270 (1 10 2 3)
- { 5.777778f, 4.444445f, 2.888889f, 0.057692f }, // 271 (1 10 3 2)
- { 5.888889f, 3.888889f, 3.111111f, 0.075630f }, // 272 (1 10 4 1)
- { 6.000000f, 3.333333f, 3.333333f, 0.112500f }, // 273 (1 10 5 0)
- { 5.888889f, 5.222222f, 2.444444f, 0.040359f }, // 274 (1 11 0 4)
- { 6.000000f, 4.666667f, 2.666667f, 0.047872f }, // 275 (1 11 1 3)
- { 6.111111f, 4.111111f, 2.888889f, 0.059603f }, // 276 (1 11 2 2)
- { 6.222222f, 3.555556f, 3.111111f, 0.080357f }, // 277 (1 11 3 1)
- { 6.333333f, 3.000000f, 3.333333f, 0.126761f }, // 278 (1 11 4 0)
- { 6.333333f, 4.333333f, 2.666667f, 0.049180f }, // 279 (1 12 0 3)
- { 6.444445f, 3.777778f, 2.888889f, 0.062500f }, // 280 (1 12 1 2)
- { 6.555556f, 3.222222f, 3.111111f, 0.087379f }, // 281 (1 12 2 1)
- { 6.666667f, 2.666667f, 3.333333f, 0.150000f }, // 282 (1 12 3 0)
- { 6.777778f, 3.444444f, 2.888889f, 0.066667f }, // 283 (1 13 0 2)
- { 6.888889f, 2.888889f, 3.111111f, 0.097826f }, // 284 (1 13 1 1)
- { 7.000000f, 2.333333f, 3.333333f, 0.191489f }, // 285 (1 13 2 0)
- { 7.222222f, 2.555556f, 3.111111f, 0.113924f }, // 286 (1 14 0 1)
- { 7.333333f, 2.000000f, 3.333333f, 0.281250f }, // 287 (1 14 1 0)
- { 7.666667f, 1.666667f, 3.333333f, 0.600000f }, // 288 (1 15 0 0)
- { 2.000000f, 14.000000f, 0.000000f, 0.035714f }, // 289 (2 0 0 14)
- { 2.111111f, 13.444445f, 0.222222f, 0.035294f }, // 290 (2 0 1 13)
- { 2.222222f, 12.888889f, 0.444444f, 0.035156f }, // 291 (2 0 2 12)
- { 2.333333f, 12.333333f, 0.666667f, 0.035294f }, // 292 (2 0 3 11)
- { 2.444444f, 11.777778f, 0.888889f, 0.035714f }, // 293 (2 0 4 10)
- { 2.555556f, 11.222222f, 1.111111f, 0.036437f }, // 294 (2 0 5 9)
- { 2.666667f, 10.666667f, 1.333333f, 0.037500f }, // 295 (2 0 6 8)
- { 2.777778f, 10.111111f, 1.555556f, 0.038961f }, // 296 (2 0 7 7)
- { 2.888889f, 9.555555f, 1.777778f, 0.040909f }, // 297 (2 0 8 6)
- { 3.000000f, 9.000000f, 2.000000f, 0.043478f }, // 298 (2 0 9 5)
- { 3.111111f, 8.444445f, 2.222222f, 0.046875f }, // 299 (2 0 10 4)
- { 3.222222f, 7.888889f, 2.444444f, 0.051429f }, // 300 (2 0 11 3)
- { 3.333333f, 7.333333f, 2.666667f, 0.057692f }, // 301 (2 0 12 2)
- { 3.444444f, 6.777778f, 2.888889f, 0.066667f }, // 302 (2 0 13 1)
- { 3.555556f, 6.222222f, 3.111111f, 0.080357f }, // 303 (2 0 14 0)
- { 2.444444f, 13.111111f, 0.222222f, 0.031250f }, // 304 (2 1 0 13)
- { 2.555556f, 12.555555f, 0.444444f, 0.031359f }, // 305 (2 1 1 12)
- { 2.666667f, 12.000000f, 0.666667f, 0.031690f }, // 306 (2 1 2 11)
- { 2.777778f, 11.444445f, 0.888889f, 0.032258f }, // 307 (2 1 3 10)
- { 2.888889f, 10.888889f, 1.111111f, 0.033088f }, // 308 (2 1 4 9)
- { 3.000000f, 10.333333f, 1.333333f, 0.034221f }, // 309 (2 1 5 8)
- { 3.111111f, 9.777778f, 1.555556f, 0.035714f }, // 310 (2 1 6 7)
- { 3.222222f, 9.222222f, 1.777778f, 0.037657f }, // 311 (2 1 7 6)
- { 3.333333f, 8.666667f, 2.000000f, 0.040179f }, // 312 (2 1 8 5)
- { 3.444444f, 8.111111f, 2.222222f, 0.043478f }, // 313 (2 1 9 4)
- { 3.555556f, 7.555556f, 2.444444f, 0.047872f }, // 314 (2 1 10 3)
- { 3.666667f, 7.000000f, 2.666667f, 0.053892f }, // 315 (2 1 11 2)
- { 3.777778f, 6.444445f, 2.888889f, 0.062500f }, // 316 (2 1 12 1)
- { 3.888889f, 5.888889f, 3.111111f, 0.075630f }, // 317 (2 1 13 0)
- { 2.888889f, 12.222222f, 0.444444f, 0.028481f }, // 318 (2 2 0 12)
- { 3.000000f, 11.666667f, 0.666667f, 0.028939f }, // 319 (2 2 1 11)
- { 3.111111f, 11.111111f, 0.888889f, 0.029605f }, // 320 (2 2 2 10)
- { 3.222222f, 10.555555f, 1.111111f, 0.030508f }, // 321 (2 2 3 9)
- { 3.333333f, 10.000000f, 1.333333f, 0.031690f }, // 322 (2 2 4 8)
- { 3.444444f, 9.444445f, 1.555556f, 0.033210f }, // 323 (2 2 5 7)
- { 3.555556f, 8.888889f, 1.777778f, 0.035156f }, // 324 (2 2 6 6)
- { 3.666667f, 8.333333f, 2.000000f, 0.037657f }, // 325 (2 2 7 5)
- { 3.777778f, 7.777778f, 2.222222f, 0.040909f }, // 326 (2 2 8 4)
- { 3.888889f, 7.222222f, 2.444444f, 0.045226f }, // 327 (2 2 9 3)
- { 4.000000f, 6.666667f, 2.666667f, 0.051136f }, // 328 (2 2 10 2)
- { 4.111111f, 6.111111f, 2.888889f, 0.059603f }, // 329 (2 2 11 1)
- { 4.222222f, 5.555556f, 3.111111f, 0.072581f }, // 330 (2 2 12 0)
- { 3.333333f, 11.333333f, 0.666667f, 0.026786f }, // 331 (2 3 0 11)
- { 3.444444f, 10.777778f, 0.888889f, 0.027523f }, // 332 (2 3 1 10)
- { 3.555556f, 10.222222f, 1.111111f, 0.028481f }, // 333 (2 3 2 9)
- { 3.666667f, 9.666667f, 1.333333f, 0.029703f }, // 334 (2 3 3 8)
- { 3.777778f, 9.111111f, 1.555556f, 0.031250f }, // 335 (2 3 4 7)
- { 3.888889f, 8.555555f, 1.777778f, 0.033210f }, // 336 (2 3 5 6)
- { 4.000000f, 8.000000f, 2.000000f, 0.035714f }, // 337 (2 3 6 5)
- { 4.111111f, 7.444445f, 2.222222f, 0.038961f }, // 338 (2 3 7 4)
- { 4.222222f, 6.888889f, 2.444444f, 0.043269f }, // 339 (2 3 8 3)
- { 4.333333f, 6.333333f, 2.666667f, 0.049180f }, // 340 (2 3 9 2)
- { 4.444445f, 5.777778f, 2.888889f, 0.057692f }, // 341 (2 3 10 1)
- { 4.555555f, 5.222222f, 3.111111f, 0.070866f }, // 342 (2 3 11 0)
- { 3.777778f, 10.444445f, 0.888889f, 0.025862f }, // 343 (2 4 0 10)
- { 3.888889f, 9.888889f, 1.111111f, 0.026866f }, // 344 (2 4 1 9)
- { 4.000000f, 9.333333f, 1.333333f, 0.028125f }, // 345 (2 4 2 8)
- { 4.111111f, 8.777778f, 1.555556f, 0.029703f }, // 346 (2 4 3 7)
- { 4.222222f, 8.222222f, 1.777778f, 0.031690f }, // 347 (2 4 4 6)
- { 4.333333f, 7.666667f, 2.000000f, 0.034221f }, // 348 (2 4 5 5)
- { 4.444445f, 7.111111f, 2.222222f, 0.037500f }, // 349 (2 4 6 4)
- { 4.555555f, 6.555555f, 2.444444f, 0.041860f }, // 350 (2 4 7 3)
- { 4.666667f, 6.000000f, 2.666667f, 0.047872f }, // 351 (2 4 8 2)
- { 4.777778f, 5.444445f, 2.888889f, 0.056604f }, // 352 (2 4 9 1)
- { 4.888889f, 4.888889f, 3.111111f, 0.070313f }, // 353 (2 4 10 0)
- { 4.222222f, 9.555555f, 1.111111f, 0.025568f }, // 354 (2 5 0 9)
- { 4.333333f, 9.000000f, 1.333333f, 0.026866f }, // 355 (2 5 1 8)
- { 4.444445f, 8.444445f, 1.555556f, 0.028481f }, // 356 (2 5 2 7)
- { 4.555555f, 7.888889f, 1.777778f, 0.030508f }, // 357 (2 5 3 6)
- { 4.666667f, 7.333333f, 2.000000f, 0.033088f }, // 358 (2 5 4 5)
- { 4.777778f, 6.777778f, 2.222222f, 0.036437f }, // 359 (2 5 5 4)
- { 4.888889f, 6.222222f, 2.444444f, 0.040909f }, // 360 (2 5 6 3)
- { 5.000000f, 5.666667f, 2.666667f, 0.047120f }, // 361 (2 5 7 2)
- { 5.111111f, 5.111111f, 2.888889f, 0.056250f }, // 362 (2 5 8 1)
- { 5.222222f, 4.555556f, 3.111111f, 0.070866f }, // 363 (2 5 9 0)
- { 4.666667f, 8.666667f, 1.333333f, 0.025862f }, // 364 (2 6 0 8)
- { 4.777778f, 8.111111f, 1.555556f, 0.027523f }, // 365 (2 6 1 7)
- { 4.888889f, 7.555555f, 1.777778f, 0.029605f }, // 366 (2 6 2 6)
- { 5.000000f, 7.000000f, 2.000000f, 0.032258f }, // 367 (2 6 3 5)
- { 5.111111f, 6.444445f, 2.222222f, 0.035714f }, // 368 (2 6 4 4)
- { 5.222222f, 5.888889f, 2.444444f, 0.040359f }, // 369 (2 6 5 3)
- { 5.333333f, 5.333333f, 2.666667f, 0.046875f }, // 370 (2 6 6 2)
- { 5.444445f, 4.777778f, 2.888889f, 0.056604f }, // 371 (2 6 7 1)
- { 5.555555f, 4.222222f, 3.111111f, 0.072581f }, // 372 (2 6 8 0)
- { 5.111111f, 7.777778f, 1.555556f, 0.026786f }, // 373 (2 7 0 7)
- { 5.222222f, 7.222222f, 1.777778f, 0.028939f }, // 374 (2 7 1 6)
- { 5.333333f, 6.666667f, 2.000000f, 0.031690f }, // 375 (2 7 2 5)
- { 5.444445f, 6.111111f, 2.222222f, 0.035294f }, // 376 (2 7 3 4)
- { 5.555555f, 5.555555f, 2.444444f, 0.040179f }, // 377 (2 7 4 3)
- { 5.666667f, 5.000000f, 2.666667f, 0.047120f }, // 378 (2 7 5 2)
- { 5.777778f, 4.444445f, 2.888889f, 0.057692f }, // 379 (2 7 6 1)
- { 5.888889f, 3.888889f, 3.111111f, 0.075630f }, // 380 (2 7 7 0)
- { 5.555555f, 6.888889f, 1.777778f, 0.028481f }, // 381 (2 8 0 6)
- { 5.666667f, 6.333333f, 2.000000f, 0.031359f }, // 382 (2 8 1 5)
- { 5.777778f, 5.777778f, 2.222222f, 0.035156f }, // 383 (2 8 2 4)
- { 5.888889f, 5.222222f, 2.444444f, 0.040359f }, // 384 (2 8 3 3)
- { 6.000000f, 4.666667f, 2.666667f, 0.047872f }, // 385 (2 8 4 2)
- { 6.111111f, 4.111111f, 2.888889f, 0.059603f }, // 386 (2 8 5 1)
- { 6.222222f, 3.555556f, 3.111111f, 0.080357f }, // 387 (2 8 6 0)
- { 6.000000f, 6.000000f, 2.000000f, 0.031250f }, // 388 (2 9 0 5)
- { 6.111111f, 5.444445f, 2.222222f, 0.035294f }, // 389 (2 9 1 4)
- { 6.222222f, 4.888889f, 2.444444f, 0.040909f }, // 390 (2 9 2 3)
- { 6.333333f, 4.333333f, 2.666667f, 0.049180f }, // 391 (2 9 3 2)
- { 6.444445f, 3.777778f, 2.888889f, 0.062500f }, // 392 (2 9 4 1)
- { 6.555556f, 3.222222f, 3.111111f, 0.087379f }, // 393 (2 9 5 0)
- { 6.444445f, 5.111111f, 2.222222f, 0.035714f }, // 394 (2 10 0 4)
- { 6.555556f, 4.555555f, 2.444444f, 0.041860f }, // 395 (2 10 1 3)
- { 6.666667f, 4.000000f, 2.666667f, 0.051136f }, // 396 (2 10 2 2)
- { 6.777778f, 3.444444f, 2.888889f, 0.066667f }, // 397 (2 10 3 1)
- { 6.888889f, 2.888889f, 3.111111f, 0.097826f }, // 398 (2 10 4 0)
- { 6.888889f, 4.222222f, 2.444444f, 0.043269f }, // 399 (2 11 0 3)
- { 7.000000f, 3.666667f, 2.666667f, 0.053892f }, // 400 (2 11 1 2)
- { 7.111111f, 3.111111f, 2.888889f, 0.072581f }, // 401 (2 11 2 1)
- { 7.222222f, 2.555556f, 3.111111f, 0.113924f }, // 402 (2 11 3 0)
- { 7.333333f, 3.333333f, 2.666667f, 0.057692f }, // 403 (2 12 0 2)
- { 7.444445f, 2.777778f, 2.888889f, 0.081081f }, // 404 (2 12 1 1)
- { 7.555556f, 2.222222f, 3.111111f, 0.140625f }, // 405 (2 12 2 0)
- { 7.777778f, 2.444444f, 2.888889f, 0.093750f }, // 406 (2 13 0 1)
- { 7.888889f, 1.888889f, 3.111111f, 0.191489f }, // 407 (2 13 1 0)
- { 8.222222f, 1.555556f, 3.111111f, 0.321429f }, // 408 (2 14 0 0)
- { 3.000000f, 13.000000f, 0.000000f, 0.025641f }, // 409 (3 0 0 13)
- { 3.111111f, 12.444445f, 0.222222f, 0.025862f }, // 410 (3 0 1 12)
- { 3.222222f, 11.888889f, 0.444444f, 0.026239f }, // 411 (3 0 2 11)
- { 3.333333f, 11.333333f, 0.666667f, 0.026786f }, // 412 (3 0 3 10)
- { 3.444444f, 10.777778f, 0.888889f, 0.027523f }, // 413 (3 0 4 9)
- { 3.555556f, 10.222222f, 1.111111f, 0.028481f }, // 414 (3 0 5 8)
- { 3.666667f, 9.666667f, 1.333333f, 0.029703f }, // 415 (3 0 6 7)
- { 3.777778f, 9.111111f, 1.555556f, 0.031250f }, // 416 (3 0 7 6)
- { 3.888889f, 8.555555f, 1.777778f, 0.033210f }, // 417 (3 0 8 5)
- { 4.000000f, 8.000000f, 2.000000f, 0.035714f }, // 418 (3 0 9 4)
- { 4.111111f, 7.444445f, 2.222222f, 0.038961f }, // 419 (3 0 10 3)
- { 4.222222f, 6.888889f, 2.444444f, 0.043269f }, // 420 (3 0 11 2)
- { 4.333333f, 6.333333f, 2.666667f, 0.049180f }, // 421 (3 0 12 1)
- { 4.444445f, 5.777778f, 2.888889f, 0.057692f }, // 422 (3 0 13 0)
- { 3.444444f, 12.111111f, 0.222222f, 0.024000f }, // 423 (3 1 0 12)
- { 3.555556f, 11.555555f, 0.444444f, 0.024457f }, // 424 (3 1 1 11)
- { 3.666667f, 11.000000f, 0.666667f, 0.025070f }, // 425 (3 1 2 10)
- { 3.777778f, 10.444445f, 0.888889f, 0.025862f }, // 426 (3 1 3 9)
- { 3.888889f, 9.888889f, 1.111111f, 0.026866f }, // 427 (3 1 4 8)
- { 4.000000f, 9.333333f, 1.333333f, 0.028125f }, // 428 (3 1 5 7)
- { 4.111111f, 8.777778f, 1.555556f, 0.029703f }, // 429 (3 1 6 6)
- { 4.222222f, 8.222222f, 1.777778f, 0.031690f }, // 430 (3 1 7 5)
- { 4.333333f, 7.666667f, 2.000000f, 0.034221f }, // 431 (3 1 8 4)
- { 4.444445f, 7.111111f, 2.222222f, 0.037500f }, // 432 (3 1 9 3)
- { 4.555555f, 6.555556f, 2.444444f, 0.041860f }, // 433 (3 1 10 2)
- { 4.666667f, 6.000000f, 2.666667f, 0.047872f }, // 434 (3 1 11 1)
- { 4.777778f, 5.444445f, 2.888889f, 0.056604f }, // 435 (3 1 12 0)
- { 3.888889f, 11.222222f, 0.444444f, 0.023018f }, // 436 (3 2 0 11)
- { 4.000000f, 10.666667f, 0.666667f, 0.023684f }, // 437 (3 2 1 10)
- { 4.111111f, 10.111111f, 0.888889f, 0.024523f }, // 438 (3 2 2 9)
- { 4.222222f, 9.555555f, 1.111111f, 0.025568f }, // 439 (3 2 3 8)
- { 4.333333f, 9.000000f, 1.333333f, 0.026866f }, // 440 (3 2 4 7)
- { 4.444445f, 8.444445f, 1.555556f, 0.028481f }, // 441 (3 2 5 6)
- { 4.555555f, 7.888889f, 1.777778f, 0.030508f }, // 442 (3 2 6 5)
- { 4.666667f, 7.333333f, 2.000000f, 0.033088f }, // 443 (3 2 7 4)
- { 4.777778f, 6.777778f, 2.222222f, 0.036437f }, // 444 (3 2 8 3)
- { 4.888889f, 6.222222f, 2.444444f, 0.040909f }, // 445 (3 2 9 2)
- { 5.000000f, 5.666667f, 2.666667f, 0.047120f }, // 446 (3 2 10 1)
- { 5.111111f, 5.111111f, 2.888889f, 0.056250f }, // 447 (3 2 11 0)
- { 4.333333f, 10.333333f, 0.666667f, 0.022556f }, // 448 (3 3 0 10)
- { 4.444445f, 9.777778f, 0.888889f, 0.023438f }, // 449 (3 3 1 9)
- { 4.555555f, 9.222222f, 1.111111f, 0.024523f }, // 450 (3 3 2 8)
- { 4.666667f, 8.666667f, 1.333333f, 0.025862f }, // 451 (3 3 3 7)
- { 4.777778f, 8.111111f, 1.555556f, 0.027523f }, // 452 (3 3 4 6)
- { 4.888889f, 7.555555f, 1.777778f, 0.029605f }, // 453 (3 3 5 5)
- { 5.000000f, 7.000000f, 2.000000f, 0.032258f }, // 454 (3 3 6 4)
- { 5.111111f, 6.444445f, 2.222222f, 0.035714f }, // 455 (3 3 7 3)
- { 5.222222f, 5.888889f, 2.444444f, 0.040359f }, // 456 (3 3 8 2)
- { 5.333333f, 5.333333f, 2.666667f, 0.046875f }, // 457 (3 3 9 1)
- { 5.444445f, 4.777778f, 2.888889f, 0.056604f }, // 458 (3 3 10 0)
- { 4.777778f, 9.444445f, 0.888889f, 0.022556f }, // 459 (3 4 0 9)
- { 4.888889f, 8.888889f, 1.111111f, 0.023684f }, // 460 (3 4 1 8)
- { 5.000000f, 8.333333f, 1.333333f, 0.025070f }, // 461 (3 4 2 7)
- { 5.111111f, 7.777778f, 1.555556f, 0.026786f }, // 462 (3 4 3 6)
- { 5.222222f, 7.222222f, 1.777778f, 0.028939f }, // 463 (3 4 4 5)
- { 5.333333f, 6.666667f, 2.000000f, 0.031690f }, // 464 (3 4 5 4)
- { 5.444445f, 6.111111f, 2.222222f, 0.035294f }, // 465 (3 4 6 3)
- { 5.555555f, 5.555555f, 2.444444f, 0.040179f }, // 466 (3 4 7 2)
- { 5.666667f, 5.000000f, 2.666667f, 0.047120f }, // 467 (3 4 8 1)
- { 5.777778f, 4.444445f, 2.888889f, 0.057692f }, // 468 (3 4 9 0)
- { 5.222222f, 8.555555f, 1.111111f, 0.023018f }, // 469 (3 5 0 8)
- { 5.333333f, 8.000000f, 1.333333f, 0.024457f }, // 470 (3 5 1 7)
- { 5.444445f, 7.444445f, 1.555556f, 0.026239f }, // 471 (3 5 2 6)
- { 5.555555f, 6.888889f, 1.777778f, 0.028481f }, // 472 (3 5 3 5)
- { 5.666667f, 6.333333f, 2.000000f, 0.031359f }, // 473 (3 5 4 4)
- { 5.777778f, 5.777778f, 2.222222f, 0.035156f }, // 474 (3 5 5 3)
- { 5.888889f, 5.222222f, 2.444444f, 0.040359f }, // 475 (3 5 6 2)
- { 6.000000f, 4.666667f, 2.666667f, 0.047872f }, // 476 (3 5 7 1)
- { 6.111111f, 4.111111f, 2.888889f, 0.059603f }, // 477 (3 5 8 0)
- { 5.666667f, 7.666667f, 1.333333f, 0.024000f }, // 478 (3 6 0 7)
- { 5.777778f, 7.111111f, 1.555556f, 0.025862f }, // 479 (3 6 1 6)
- { 5.888889f, 6.555555f, 1.777778f, 0.028213f }, // 480 (3 6 2 5)
- { 6.000000f, 6.000000f, 2.000000f, 0.031250f }, // 481 (3 6 3 4)
- { 6.111111f, 5.444445f, 2.222222f, 0.035294f }, // 482 (3 6 4 3)
- { 6.222222f, 4.888889f, 2.444444f, 0.040909f }, // 483 (3 6 5 2)
- { 6.333333f, 4.333333f, 2.666667f, 0.049180f }, // 484 (3 6 6 1)
- { 6.444445f, 3.777778f, 2.888889f, 0.062500f }, // 485 (3 6 7 0)
- { 6.111111f, 6.777778f, 1.555556f, 0.025641f }, // 486 (3 7 0 6)
- { 6.222222f, 6.222222f, 1.777778f, 0.028125f }, // 487 (3 7 1 5)
- { 6.333333f, 5.666667f, 2.000000f, 0.031359f }, // 488 (3 7 2 4)
- { 6.444445f, 5.111111f, 2.222222f, 0.035714f }, // 489 (3 7 3 3)
- { 6.555555f, 4.555555f, 2.444444f, 0.041860f }, // 490 (3 7 4 2)
- { 6.666667f, 4.000000f, 2.666667f, 0.051136f }, // 491 (3 7 5 1)
- { 6.777778f, 3.444444f, 2.888889f, 0.066667f }, // 492 (3 7 6 0)
- { 6.555555f, 5.888889f, 1.777778f, 0.028213f }, // 493 (3 8 0 5)
- { 6.666667f, 5.333333f, 2.000000f, 0.031690f }, // 494 (3 8 1 4)
- { 6.777778f, 4.777778f, 2.222222f, 0.036437f }, // 495 (3 8 2 3)
- { 6.888889f, 4.222222f, 2.444444f, 0.043269f }, // 496 (3 8 3 2)
- { 7.000000f, 3.666667f, 2.666667f, 0.053892f }, // 497 (3 8 4 1)
- { 7.111111f, 3.111111f, 2.888889f, 0.072581f }, // 498 (3 8 5 0)
- { 7.000000f, 5.000000f, 2.000000f, 0.032258f }, // 499 (3 9 0 4)
- { 7.111111f, 4.444445f, 2.222222f, 0.037500f }, // 500 (3 9 1 3)
- { 7.222222f, 3.888889f, 2.444444f, 0.045226f }, // 501 (3 9 2 2)
- { 7.333333f, 3.333333f, 2.666667f, 0.057692f }, // 502 (3 9 3 1)
- { 7.444445f, 2.777778f, 2.888889f, 0.081081f }, // 503 (3 9 4 0)
- { 7.444445f, 4.111111f, 2.222222f, 0.038961f }, // 504 (3 10 0 3)
- { 7.555556f, 3.555556f, 2.444444f, 0.047872f }, // 505 (3 10 1 2)
- { 7.666667f, 3.000000f, 2.666667f, 0.062937f }, // 506 (3 10 2 1)
- { 7.777778f, 2.444444f, 2.888889f, 0.093750f }, // 507 (3 10 3 0)
- { 7.888889f, 3.222222f, 2.444444f, 0.051429f }, // 508 (3 11 0 2)
- { 8.000000f, 2.666667f, 2.666667f, 0.070313f }, // 509 (3 11 1 1)
- { 8.111111f, 2.111111f, 2.888889f, 0.113924f }, // 510 (3 11 2 0)
- { 8.333333f, 2.333333f, 2.666667f, 0.081081f }, // 511 (3 12 0 1)
- { 8.444445f, 1.777778f, 2.888889f, 0.150000f }, // 512 (3 12 1 0)
- { 8.777778f, 1.444444f, 2.888889f, 0.230769f }, // 513 (3 13 0 0)
- { 4.000000f, 12.000000f, 0.000000f, 0.020833f }, // 514 (4 0 0 12)
- { 4.111111f, 11.444445f, 0.222222f, 0.021277f }, // 515 (4 0 1 11)
- { 4.222222f, 10.888889f, 0.444444f, 0.021845f }, // 516 (4 0 2 10)
- { 4.333333f, 10.333333f, 0.666667f, 0.022556f }, // 517 (4 0 3 9)
- { 4.444445f, 9.777778f, 0.888889f, 0.023438f }, // 518 (4 0 4 8)
- { 4.555555f, 9.222222f, 1.111111f, 0.024523f }, // 519 (4 0 5 7)
- { 4.666667f, 8.666667f, 1.333333f, 0.025862f }, // 520 (4 0 6 6)
- { 4.777778f, 8.111111f, 1.555556f, 0.027523f }, // 521 (4 0 7 5)
- { 4.888889f, 7.555555f, 1.777778f, 0.029605f }, // 522 (4 0 8 4)
- { 5.000000f, 7.000000f, 2.000000f, 0.032258f }, // 523 (4 0 9 3)
- { 5.111111f, 6.444445f, 2.222222f, 0.035714f }, // 524 (4 0 10 2)
- { 5.222222f, 5.888889f, 2.444444f, 0.040359f }, // 525 (4 0 11 1)
- { 5.333333f, 5.333333f, 2.666667f, 0.046875f }, // 526 (4 0 12 0)
- { 4.444445f, 11.111111f, 0.222222f, 0.020270f }, // 527 (4 1 0 11)
- { 4.555555f, 10.555555f, 0.444444f, 0.020882f }, // 528 (4 1 1 10)
- { 4.666667f, 10.000000f, 0.666667f, 0.021635f }, // 529 (4 1 2 9)
- { 4.777778f, 9.444445f, 0.888889f, 0.022556f }, // 530 (4 1 3 8)
- { 4.888889f, 8.888889f, 1.111111f, 0.023684f }, // 531 (4 1 4 7)
- { 5.000000f, 8.333333f, 1.333333f, 0.025070f }, // 532 (4 1 5 6)
- { 5.111111f, 7.777778f, 1.555556f, 0.026786f }, // 533 (4 1 6 5)
- { 5.222222f, 7.222222f, 1.777778f, 0.028939f }, // 534 (4 1 7 4)
- { 5.333333f, 6.666667f, 2.000000f, 0.031690f }, // 535 (4 1 8 3)
- { 5.444445f, 6.111111f, 2.222222f, 0.035294f }, // 536 (4 1 9 2)
- { 5.555555f, 5.555556f, 2.444444f, 0.040179f }, // 537 (4 1 10 1)
- { 5.666667f, 5.000000f, 2.666667f, 0.047120f }, // 538 (4 1 11 0)
- { 4.888889f, 10.222222f, 0.444444f, 0.020089f }, // 539 (4 2 0 10)
- { 5.000000f, 9.666667f, 0.666667f, 0.020882f }, // 540 (4 2 1 9)
- { 5.111111f, 9.111111f, 0.888889f, 0.021845f }, // 541 (4 2 2 8)
- { 5.222222f, 8.555555f, 1.111111f, 0.023018f }, // 542 (4 2 3 7)
- { 5.333333f, 8.000000f, 1.333333f, 0.024457f }, // 543 (4 2 4 6)
- { 5.444445f, 7.444445f, 1.555556f, 0.026239f }, // 544 (4 2 5 5)
- { 5.555555f, 6.888889f, 1.777778f, 0.028481f }, // 545 (4 2 6 4)
- { 5.666667f, 6.333333f, 2.000000f, 0.031359f }, // 546 (4 2 7 3)
- { 5.777778f, 5.777778f, 2.222222f, 0.035156f }, // 547 (4 2 8 2)
- { 5.888889f, 5.222222f, 2.444444f, 0.040359f }, // 548 (4 2 9 1)
- { 6.000000f, 4.666667f, 2.666667f, 0.047872f }, // 549 (4 2 10 0)
- { 5.333333f, 9.333333f, 0.666667f, 0.020270f }, // 550 (4 3 0 9)
- { 5.444445f, 8.777778f, 0.888889f, 0.021277f }, // 551 (4 3 1 8)
- { 5.555555f, 8.222222f, 1.111111f, 0.022500f }, // 552 (4 3 2 7)
- { 5.666667f, 7.666667f, 1.333333f, 0.024000f }, // 553 (4 3 3 6)
- { 5.777778f, 7.111111f, 1.555556f, 0.025862f }, // 554 (4 3 4 5)
- { 5.888889f, 6.555555f, 1.777778f, 0.028213f }, // 555 (4 3 5 4)
- { 6.000000f, 6.000000f, 2.000000f, 0.031250f }, // 556 (4 3 6 3)
- { 6.111111f, 5.444445f, 2.222222f, 0.035294f }, // 557 (4 3 7 2)
- { 6.222222f, 4.888889f, 2.444444f, 0.040909f }, // 558 (4 3 8 1)
- { 6.333333f, 4.333333f, 2.666667f, 0.049180f }, // 559 (4 3 9 0)
- { 5.777778f, 8.444445f, 0.888889f, 0.020833f }, // 560 (4 4 0 8)
- { 5.888889f, 7.888889f, 1.111111f, 0.022113f }, // 561 (4 4 1 7)
- { 6.000000f, 7.333333f, 1.333333f, 0.023684f }, // 562 (4 4 2 6)
- { 6.111111f, 6.777778f, 1.555556f, 0.025641f }, // 563 (4 4 3 5)
- { 6.222222f, 6.222222f, 1.777778f, 0.028125f }, // 564 (4 4 4 4)
- { 6.333333f, 5.666667f, 2.000000f, 0.031359f }, // 565 (4 4 5 3)
- { 6.444445f, 5.111111f, 2.222222f, 0.035714f }, // 566 (4 4 6 2)
- { 6.555555f, 4.555555f, 2.444444f, 0.041860f }, // 567 (4 4 7 1)
- { 6.666667f, 4.000000f, 2.666667f, 0.051136f }, // 568 (4 4 8 0)
- { 6.222222f, 7.555555f, 1.111111f, 0.021845f }, // 569 (4 5 0 7)
- { 6.333333f, 7.000000f, 1.333333f, 0.023499f }, // 570 (4 5 1 6)
- { 6.444445f, 6.444445f, 1.555556f, 0.025568f }, // 571 (4 5 2 5)
- { 6.555555f, 5.888889f, 1.777778f, 0.028213f }, // 572 (4 5 3 4)
- { 6.666667f, 5.333333f, 2.000000f, 0.031690f }, // 573 (4 5 4 3)
- { 6.777778f, 4.777778f, 2.222222f, 0.036437f }, // 574 (4 5 5 2)
- { 6.888889f, 4.222222f, 2.444444f, 0.043269f }, // 575 (4 5 6 1)
- { 7.000000f, 3.666667f, 2.666667f, 0.053892f }, // 576 (4 5 7 0)
- { 6.666667f, 6.666667f, 1.333333f, 0.023438f }, // 577 (4 6 0 6)
- { 6.777778f, 6.111111f, 1.555556f, 0.025641f }, // 578 (4 6 1 5)
- { 6.888889f, 5.555555f, 1.777778f, 0.028481f }, // 579 (4 6 2 4)
- { 7.000000f, 5.000000f, 2.000000f, 0.032258f }, // 580 (4 6 3 3)
- { 7.111111f, 4.444445f, 2.222222f, 0.037500f }, // 581 (4 6 4 2)
- { 7.222222f, 3.888889f, 2.444444f, 0.045226f }, // 582 (4 6 5 1)
- { 7.333333f, 3.333333f, 2.666667f, 0.057692f }, // 583 (4 6 6 0)
- { 7.111111f, 5.777778f, 1.555556f, 0.025862f }, // 584 (4 7 0 5)
- { 7.222222f, 5.222222f, 1.777778f, 0.028939f }, // 585 (4 7 1 4)
- { 7.333333f, 4.666667f, 2.000000f, 0.033088f }, // 586 (4 7 2 3)
- { 7.444445f, 4.111111f, 2.222222f, 0.038961f }, // 587 (4 7 3 2)
- { 7.555555f, 3.555556f, 2.444444f, 0.047872f }, // 588 (4 7 4 1)
- { 7.666667f, 3.000000f, 2.666667f, 0.062937f }, // 589 (4 7 5 0)
- { 7.555555f, 4.888889f, 1.777778f, 0.029605f }, // 590 (4 8 0 4)
- { 7.666667f, 4.333333f, 2.000000f, 0.034221f }, // 591 (4 8 1 3)
- { 7.777778f, 3.777778f, 2.222222f, 0.040909f }, // 592 (4 8 2 2)
- { 7.888889f, 3.222222f, 2.444444f, 0.051429f }, // 593 (4 8 3 1)
- { 8.000000f, 2.666667f, 2.666667f, 0.070313f }, // 594 (4 8 4 0)
- { 8.000000f, 4.000000f, 2.000000f, 0.035714f }, // 595 (4 9 0 3)
- { 8.111111f, 3.444444f, 2.222222f, 0.043478f }, // 596 (4 9 1 2)
- { 8.222222f, 2.888889f, 2.444444f, 0.056250f }, // 597 (4 9 2 1)
- { 8.333333f, 2.333333f, 2.666667f, 0.081081f }, // 598 (4 9 3 0)
- { 8.444445f, 3.111111f, 2.222222f, 0.046875f }, // 599 (4 10 0 2)
- { 8.555555f, 2.555556f, 2.444444f, 0.062937f }, // 600 (4 10 1 1)
- { 8.666667f, 2.000000f, 2.666667f, 0.097826f }, // 601 (4 10 2 0)
- { 8.888889f, 2.222222f, 2.444444f, 0.072581f }, // 602 (4 11 0 1)
- { 9.000000f, 1.666667f, 2.666667f, 0.126761f }, // 603 (4 11 1 0)
- { 9.333333f, 1.333333f, 2.666667f, 0.187500f }, // 604 (4 12 0 0)
- { 5.000000f, 11.000000f, 0.000000f, 0.018182f }, // 605 (5 0 0 11)
- { 5.111111f, 10.444445f, 0.222222f, 0.018750f }, // 606 (5 0 1 10)
- { 5.222222f, 9.888889f, 0.444444f, 0.019438f }, // 607 (5 0 2 9)
- { 5.333333f, 9.333333f, 0.666667f, 0.020270f }, // 608 (5 0 3 8)
- { 5.444445f, 8.777778f, 0.888889f, 0.021277f }, // 609 (5 0 4 7)
- { 5.555555f, 8.222222f, 1.111111f, 0.022500f }, // 610 (5 0 5 6)
- { 5.666667f, 7.666667f, 1.333333f, 0.024000f }, // 611 (5 0 6 5)
- { 5.777778f, 7.111111f, 1.555556f, 0.025862f }, // 612 (5 0 7 4)
- { 5.888889f, 6.555555f, 1.777778f, 0.028213f }, // 613 (5 0 8 3)
- { 6.000000f, 6.000000f, 2.000000f, 0.031250f }, // 614 (5 0 9 2)
- { 6.111111f, 5.444445f, 2.222222f, 0.035294f }, // 615 (5 0 10 1)
- { 6.222222f, 4.888889f, 2.444444f, 0.040909f }, // 616 (5 0 11 0)
- { 5.444445f, 10.111111f, 0.222222f, 0.018182f }, // 617 (5 1 0 10)
- { 5.555555f, 9.555555f, 0.444444f, 0.018908f }, // 618 (5 1 1 9)
- { 5.666667f, 9.000000f, 0.666667f, 0.019780f }, // 619 (5 1 2 8)
- { 5.777778f, 8.444445f, 0.888889f, 0.020833f }, // 620 (5 1 3 7)
- { 5.888889f, 7.888889f, 1.111111f, 0.022113f }, // 621 (5 1 4 6)
- { 6.000000f, 7.333333f, 1.333333f, 0.023684f }, // 622 (5 1 5 5)
- { 6.111111f, 6.777778f, 1.555556f, 0.025641f }, // 623 (5 1 6 4)
- { 6.222222f, 6.222222f, 1.777778f, 0.028125f }, // 624 (5 1 7 3)
- { 6.333333f, 5.666667f, 2.000000f, 0.031359f }, // 625 (5 1 8 2)
- { 6.444445f, 5.111111f, 2.222222f, 0.035714f }, // 626 (5 1 9 1)
- { 6.555555f, 4.555556f, 2.444444f, 0.041860f }, // 627 (5 1 10 0)
- { 5.888889f, 9.222222f, 0.444444f, 0.018480f }, // 628 (5 2 0 9)
- { 6.000000f, 8.666667f, 0.666667f, 0.019397f }, // 629 (5 2 1 8)
- { 6.111111f, 8.111111f, 0.888889f, 0.020501f }, // 630 (5 2 2 7)
- { 6.222222f, 7.555555f, 1.111111f, 0.021845f }, // 631 (5 2 3 6)
- { 6.333333f, 7.000000f, 1.333333f, 0.023499f }, // 632 (5 2 4 5)
- { 6.444445f, 6.444445f, 1.555556f, 0.025568f }, // 633 (5 2 5 4)
- { 6.555555f, 5.888889f, 1.777778f, 0.028213f }, // 634 (5 2 6 3)
- { 6.666667f, 5.333333f, 2.000000f, 0.031690f }, // 635 (5 2 7 2)
- { 6.777778f, 4.777778f, 2.222222f, 0.036437f }, // 636 (5 2 8 1)
- { 6.888889f, 4.222222f, 2.444444f, 0.043269f }, // 637 (5 2 9 0)
- { 6.333333f, 8.333333f, 0.666667f, 0.019108f }, // 638 (5 3 0 8)
- { 6.444445f, 7.777778f, 0.888889f, 0.020270f }, // 639 (5 3 1 7)
- { 6.555555f, 7.222222f, 1.111111f, 0.021687f }, // 640 (5 3 2 6)
- { 6.666667f, 6.666667f, 1.333333f, 0.023438f }, // 641 (5 3 3 5)
- { 6.777778f, 6.111111f, 1.555556f, 0.025641f }, // 642 (5 3 4 4)
- { 6.888889f, 5.555555f, 1.777778f, 0.028481f }, // 643 (5 3 5 3)
- { 7.000000f, 5.000000f, 2.000000f, 0.032258f }, // 644 (5 3 6 2)
- { 7.111111f, 4.444445f, 2.222222f, 0.037500f }, // 645 (5 3 7 1)
- { 7.222222f, 3.888889f, 2.444444f, 0.045226f }, // 646 (5 3 8 0)
- { 6.777778f, 7.444445f, 0.888889f, 0.020134f }, // 647 (5 4 0 7)
- { 6.888889f, 6.888889f, 1.111111f, 0.021635f }, // 648 (5 4 1 6)
- { 7.000000f, 6.333333f, 1.333333f, 0.023499f }, // 649 (5 4 2 5)
- { 7.111111f, 5.777778f, 1.555556f, 0.025862f }, // 650 (5 4 3 4)
- { 7.222222f, 5.222222f, 1.777778f, 0.028939f }, // 651 (5 4 4 3)
- { 7.333333f, 4.666667f, 2.000000f, 0.033088f }, // 652 (5 4 5 2)
- { 7.444445f, 4.111111f, 2.222222f, 0.038961f }, // 653 (5 4 6 1)
- { 7.555555f, 3.555556f, 2.444444f, 0.047872f }, // 654 (5 4 7 0)
- { 7.222222f, 6.555555f, 1.111111f, 0.021687f }, // 655 (5 5 0 6)
- { 7.333333f, 6.000000f, 1.333333f, 0.023684f }, // 656 (5 5 1 5)
- { 7.444445f, 5.444445f, 1.555556f, 0.026239f }, // 657 (5 5 2 4)
- { 7.555555f, 4.888889f, 1.777778f, 0.029605f }, // 658 (5 5 3 3)
- { 7.666667f, 4.333333f, 2.000000f, 0.034221f }, // 659 (5 5 4 2)
- { 7.777778f, 3.777778f, 2.222222f, 0.040909f }, // 660 (5 5 5 1)
- { 7.888889f, 3.222222f, 2.444444f, 0.051429f }, // 661 (5 5 6 0)
- { 7.666667f, 5.666667f, 1.333333f, 0.024000f }, // 662 (5 6 0 5)
- { 7.777778f, 5.111111f, 1.555556f, 0.026786f }, // 663 (5 6 1 4)
- { 7.888889f, 4.555555f, 1.777778f, 0.030508f }, // 664 (5 6 2 3)
- { 8.000000f, 4.000000f, 2.000000f, 0.035714f }, // 665 (5 6 3 2)
- { 8.111111f, 3.444444f, 2.222222f, 0.043478f }, // 666 (5 6 4 1)
- { 8.222222f, 2.888889f, 2.444444f, 0.056250f }, // 667 (5 6 5 0)
- { 8.111111f, 4.777778f, 1.555556f, 0.027523f }, // 668 (5 7 0 4)
- { 8.222222f, 4.222222f, 1.777778f, 0.031690f }, // 669 (5 7 1 3)
- { 8.333333f, 3.666667f, 2.000000f, 0.037657f }, // 670 (5 7 2 2)
- { 8.444445f, 3.111111f, 2.222222f, 0.046875f }, // 671 (5 7 3 1)
- { 8.555555f, 2.555556f, 2.444444f, 0.062937f }, // 672 (5 7 4 0)
- { 8.555555f, 3.888889f, 1.777778f, 0.033210f }, // 673 (5 8 0 3)
- { 8.666667f, 3.333333f, 2.000000f, 0.040179f }, // 674 (5 8 1 2)
- { 8.777778f, 2.777778f, 2.222222f, 0.051429f }, // 675 (5 8 2 1)
- { 8.888889f, 2.222222f, 2.444444f, 0.072581f }, // 676 (5 8 3 0)
- { 9.000000f, 3.000000f, 2.000000f, 0.043478f }, // 677 (5 9 0 2)
- { 9.111111f, 2.444444f, 2.222222f, 0.057692f }, // 678 (5 9 1 1)
- { 9.222222f, 1.888889f, 2.444444f, 0.087379f }, // 679 (5 9 2 0)
- { 9.444445f, 2.111111f, 2.222222f, 0.066667f }, // 680 (5 10 0 1)
- { 9.555555f, 1.555556f, 2.444444f, 0.112500f }, // 681 (5 10 1 0)
- { 9.888889f, 1.222222f, 2.444444f, 0.163636f }, // 682 (5 11 0 0)
- { 6.000000f, 10.000000f, 0.000000f, 0.016667f }, // 683 (6 0 0 10)
- { 6.111111f, 9.444445f, 0.222222f, 0.017341f }, // 684 (6 0 1 9)
- { 6.222222f, 8.888889f, 0.444444f, 0.018145f }, // 685 (6 0 2 8)
- { 6.333333f, 8.333333f, 0.666667f, 0.019108f }, // 686 (6 0 3 7)
- { 6.444445f, 7.777778f, 0.888889f, 0.020270f }, // 687 (6 0 4 6)
- { 6.555555f, 7.222222f, 1.111111f, 0.021687f }, // 688 (6 0 5 5)
- { 6.666667f, 6.666667f, 1.333333f, 0.023438f }, // 689 (6 0 6 4)
- { 6.777778f, 6.111111f, 1.555556f, 0.025641f }, // 690 (6 0 7 3)
- { 6.888889f, 5.555555f, 1.777778f, 0.028481f }, // 691 (6 0 8 2)
- { 7.000000f, 5.000000f, 2.000000f, 0.032258f }, // 692 (6 0 9 1)
- { 7.111111f, 4.444445f, 2.222222f, 0.037500f }, // 693 (6 0 10 0)
- { 6.444445f, 9.111111f, 0.222222f, 0.017045f }, // 694 (6 1 0 9)
- { 6.555555f, 8.555555f, 0.444444f, 0.017893f }, // 695 (6 1 1 8)
- { 6.666667f, 8.000000f, 0.666667f, 0.018908f }, // 696 (6 1 2 7)
- { 6.777778f, 7.444445f, 0.888889f, 0.020134f }, // 697 (6 1 3 6)
- { 6.888889f, 6.888889f, 1.111111f, 0.021635f }, // 698 (6 1 4 5)
- { 7.000000f, 6.333333f, 1.333333f, 0.023499f }, // 699 (6 1 5 4)
- { 7.111111f, 5.777778f, 1.555556f, 0.025862f }, // 700 (6 1 6 3)
- { 7.222222f, 5.222222f, 1.777778f, 0.028939f }, // 701 (6 1 7 2)
- { 7.333333f, 4.666667f, 2.000000f, 0.033088f }, // 702 (6 1 8 1)
- { 7.444445f, 4.111111f, 2.222222f, 0.038961f }, // 703 (6 1 9 0)
- { 6.888889f, 8.222222f, 0.444444f, 0.017717f }, // 704 (6 2 0 8)
- { 7.000000f, 7.666667f, 0.666667f, 0.018789f }, // 705 (6 2 1 7)
- { 7.111111f, 7.111111f, 0.888889f, 0.020089f }, // 706 (6 2 2 6)
- { 7.222222f, 6.555555f, 1.111111f, 0.021687f }, // 707 (6 2 3 5)
- { 7.333333f, 6.000000f, 1.333333f, 0.023684f }, // 708 (6 2 4 4)
- { 7.444445f, 5.444445f, 1.555556f, 0.026239f }, // 709 (6 2 5 3)
- { 7.555555f, 4.888889f, 1.777778f, 0.029605f }, // 710 (6 2 6 2)
- { 7.666667f, 4.333333f, 2.000000f, 0.034221f }, // 711 (6 2 7 1)
- { 7.777778f, 3.777778f, 2.222222f, 0.040909f }, // 712 (6 2 8 0)
- { 7.333333f, 7.333333f, 0.666667f, 0.018750f }, // 713 (6 3 0 7)
- { 7.444445f, 6.777778f, 0.888889f, 0.020134f }, // 714 (6 3 1 6)
- { 7.555555f, 6.222222f, 1.111111f, 0.021845f }, // 715 (6 3 2 5)
- { 7.666667f, 5.666667f, 1.333333f, 0.024000f }, // 716 (6 3 3 4)
- { 7.777778f, 5.111111f, 1.555556f, 0.026786f }, // 717 (6 3 4 3)
- { 7.888889f, 4.555555f, 1.777778f, 0.030508f }, // 718 (6 3 5 2)
- { 8.000000f, 4.000000f, 2.000000f, 0.035714f }, // 719 (6 3 6 1)
- { 8.111111f, 3.444444f, 2.222222f, 0.043478f }, // 720 (6 3 7 0)
- { 7.777778f, 6.444445f, 0.888889f, 0.020270f }, // 721 (6 4 0 6)
- { 7.888889f, 5.888889f, 1.111111f, 0.022113f }, // 722 (6 4 1 5)
- { 8.000000f, 5.333333f, 1.333333f, 0.024457f }, // 723 (6 4 2 4)
- { 8.111111f, 4.777778f, 1.555556f, 0.027523f }, // 724 (6 4 3 3)
- { 8.222222f, 4.222222f, 1.777778f, 0.031690f }, // 725 (6 4 4 2)
- { 8.333333f, 3.666667f, 2.000000f, 0.037657f }, // 726 (6 4 5 1)
- { 8.444445f, 3.111111f, 2.222222f, 0.046875f }, // 727 (6 4 6 0)
- { 8.222222f, 5.555555f, 1.111111f, 0.022500f }, // 728 (6 5 0 5)
- { 8.333333f, 5.000000f, 1.333333f, 0.025070f }, // 729 (6 5 1 4)
- { 8.444445f, 4.444445f, 1.555556f, 0.028481f }, // 730 (6 5 2 3)
- { 8.555555f, 3.888889f, 1.777778f, 0.033210f }, // 731 (6 5 3 2)
- { 8.666667f, 3.333333f, 2.000000f, 0.040179f }, // 732 (6 5 4 1)
- { 8.777778f, 2.777778f, 2.222222f, 0.051429f }, // 733 (6 5 5 0)
- { 8.666667f, 4.666667f, 1.333333f, 0.025862f }, // 734 (6 6 0 4)
- { 8.777778f, 4.111111f, 1.555556f, 0.029703f }, // 735 (6 6 1 3)
- { 8.888889f, 3.555556f, 1.777778f, 0.035156f }, // 736 (6 6 2 2)
- { 9.000000f, 3.000000f, 2.000000f, 0.043478f }, // 737 (6 6 3 1)
- { 9.111111f, 2.444444f, 2.222222f, 0.057692f }, // 738 (6 6 4 0)
- { 9.111111f, 3.777778f, 1.555556f, 0.031250f }, // 739 (6 7 0 3)
- { 9.222222f, 3.222222f, 1.777778f, 0.037657f }, // 740 (6 7 1 2)
- { 9.333333f, 2.666667f, 2.000000f, 0.047872f }, // 741 (6 7 2 1)
- { 9.444445f, 2.111111f, 2.222222f, 0.066667f }, // 742 (6 7 3 0)
- { 9.555555f, 2.888889f, 1.777778f, 0.040909f }, // 743 (6 8 0 2)
- { 9.666667f, 2.333333f, 2.000000f, 0.053892f }, // 744 (6 8 1 1)
- { 9.777778f, 1.777778f, 2.222222f, 0.080357f }, // 745 (6 8 2 0)
- { 10.000000f, 2.000000f, 2.000000f, 0.062500f }, // 746 (6 9 0 1)
- { 10.111111f, 1.444444f, 2.222222f, 0.103448f }, // 747 (6 9 1 0)
- { 10.444445f, 1.111111f, 2.222222f, 0.150000f }, // 748 (6 10 0 0)
- { 7.000000f, 9.000000f, 0.000000f, 0.015873f }, // 749 (7 0 0 9)
- { 7.111111f, 8.444445f, 0.222222f, 0.016667f }, // 750 (7 0 1 8)
- { 7.222222f, 7.888889f, 0.444444f, 0.017613f }, // 751 (7 0 2 7)
- { 7.333333f, 7.333333f, 0.666667f, 0.018750f }, // 752 (7 0 3 6)
- { 7.444445f, 6.777778f, 0.888889f, 0.020134f }, // 753 (7 0 4 5)
- { 7.555555f, 6.222222f, 1.111111f, 0.021845f }, // 754 (7 0 5 4)
- { 7.666667f, 5.666667f, 1.333333f, 0.024000f }, // 755 (7 0 6 3)
- { 7.777778f, 5.111111f, 1.555556f, 0.026786f }, // 756 (7 0 7 2)
- { 7.888889f, 4.555555f, 1.777778f, 0.030508f }, // 757 (7 0 8 1)
- { 8.000000f, 4.000000f, 2.000000f, 0.035714f }, // 758 (7 0 9 0)
- { 7.444445f, 8.111111f, 0.222222f, 0.016575f }, // 759 (7 1 0 8)
- { 7.555555f, 7.555555f, 0.444444f, 0.017578f }, // 760 (7 1 1 7)
- { 7.666667f, 7.000000f, 0.666667f, 0.018789f }, // 761 (7 1 2 6)
- { 7.777778f, 6.444445f, 0.888889f, 0.020270f }, // 762 (7 1 3 5)
- { 7.888889f, 5.888889f, 1.111111f, 0.022113f }, // 763 (7 1 4 4)
- { 8.000000f, 5.333333f, 1.333333f, 0.024457f }, // 764 (7 1 5 3)
- { 8.111111f, 4.777778f, 1.555556f, 0.027523f }, // 765 (7 1 6 2)
- { 8.222222f, 4.222222f, 1.777778f, 0.031690f }, // 766 (7 1 7 1)
- { 8.333333f, 3.666667f, 2.000000f, 0.037657f }, // 767 (7 1 8 0)
- { 7.888889f, 7.222222f, 0.444444f, 0.017613f }, // 768 (7 2 0 7)
- { 8.000000f, 6.666667f, 0.666667f, 0.018908f }, // 769 (7 2 1 6)
- { 8.111111f, 6.111111f, 0.888889f, 0.020501f }, // 770 (7 2 2 5)
- { 8.222222f, 5.555555f, 1.111111f, 0.022500f }, // 771 (7 2 3 4)
- { 8.333333f, 5.000000f, 1.333333f, 0.025070f }, // 772 (7 2 4 3)
- { 8.444445f, 4.444445f, 1.555556f, 0.028481f }, // 773 (7 2 5 2)
- { 8.555555f, 3.888889f, 1.777778f, 0.033210f }, // 774 (7 2 6 1)
- { 8.666667f, 3.333333f, 2.000000f, 0.040179f }, // 775 (7 2 7 0)
- { 8.333333f, 6.333333f, 0.666667f, 0.019108f }, // 776 (7 3 0 6)
- { 8.444445f, 5.777778f, 0.888889f, 0.020833f }, // 777 (7 3 1 5)
- { 8.555555f, 5.222222f, 1.111111f, 0.023018f }, // 778 (7 3 2 4)
- { 8.666667f, 4.666667f, 1.333333f, 0.025862f }, // 779 (7 3 3 3)
- { 8.777778f, 4.111111f, 1.555556f, 0.029703f }, // 780 (7 3 4 2)
- { 8.888889f, 3.555556f, 1.777778f, 0.035156f }, // 781 (7 3 5 1)
- { 9.000000f, 3.000000f, 2.000000f, 0.043478f }, // 782 (7 3 6 0)
- { 8.777778f, 5.444445f, 0.888889f, 0.021277f }, // 783 (7 4 0 5)
- { 8.888889f, 4.888889f, 1.111111f, 0.023684f }, // 784 (7 4 1 4)
- { 9.000000f, 4.333333f, 1.333333f, 0.026866f }, // 785 (7 4 2 3)
- { 9.111111f, 3.777778f, 1.555556f, 0.031250f }, // 786 (7 4 3 2)
- { 9.222222f, 3.222222f, 1.777778f, 0.037657f }, // 787 (7 4 4 1)
- { 9.333333f, 2.666667f, 2.000000f, 0.047872f }, // 788 (7 4 5 0)
- { 9.222222f, 4.555555f, 1.111111f, 0.024523f }, // 789 (7 5 0 4)
- { 9.333333f, 4.000000f, 1.333333f, 0.028125f }, // 790 (7 5 1 3)
- { 9.444445f, 3.444444f, 1.555556f, 0.033210f }, // 791 (7 5 2 2)
- { 9.555555f, 2.888889f, 1.777778f, 0.040909f }, // 792 (7 5 3 1)
- { 9.666667f, 2.333333f, 2.000000f, 0.053892f }, // 793 (7 5 4 0)
- { 9.666667f, 3.666667f, 1.333333f, 0.029703f }, // 794 (7 6 0 3)
- { 9.777778f, 3.111111f, 1.555556f, 0.035714f }, // 795 (7 6 1 2)
- { 9.888889f, 2.555556f, 1.777778f, 0.045226f }, // 796 (7 6 2 1)
- { 10.000000f, 2.000000f, 2.000000f, 0.062500f }, // 797 (7 6 3 0)
- { 10.111111f, 2.777778f, 1.555556f, 0.038961f }, // 798 (7 7 0 2)
- { 10.222222f, 2.222222f, 1.777778f, 0.051136f }, // 799 (7 7 1 1)
- { 10.333333f, 1.666667f, 2.000000f, 0.075630f }, // 800 (7 7 2 0)
- { 10.555555f, 1.888889f, 1.777778f, 0.059603f }, // 801 (7 8 0 1)
- { 10.666667f, 1.333333f, 2.000000f, 0.097826f }, // 802 (7 8 1 0)
- { 11.000000f, 1.000000f, 2.000000f, 0.142857f }, // 803 (7 9 0 0)
- { 8.000000f, 8.000000f, 0.000000f, 0.015625f }, // 804 (8 0 0 8)
- { 8.111111f, 7.444445f, 0.222222f, 0.016575f }, // 805 (8 0 1 7)
- { 8.222222f, 6.888889f, 0.444444f, 0.017717f }, // 806 (8 0 2 6)
- { 8.333333f, 6.333333f, 0.666667f, 0.019108f }, // 807 (8 0 3 5)
- { 8.444445f, 5.777778f, 0.888889f, 0.020833f }, // 808 (8 0 4 4)
- { 8.555555f, 5.222222f, 1.111111f, 0.023018f }, // 809 (8 0 5 3)
- { 8.666667f, 4.666667f, 1.333333f, 0.025862f }, // 810 (8 0 6 2)
- { 8.777778f, 4.111111f, 1.555556f, 0.029703f }, // 811 (8 0 7 1)
- { 8.888889f, 3.555556f, 1.777778f, 0.035156f }, // 812 (8 0 8 0)
- { 8.444445f, 7.111111f, 0.222222f, 0.016667f }, // 813 (8 1 0 7)
- { 8.555555f, 6.555555f, 0.444444f, 0.017893f }, // 814 (8 1 1 6)
- { 8.666667f, 6.000000f, 0.666667f, 0.019397f }, // 815 (8 1 2 5)
- { 8.777778f, 5.444445f, 0.888889f, 0.021277f }, // 816 (8 1 3 4)
- { 8.888889f, 4.888889f, 1.111111f, 0.023684f }, // 817 (8 1 4 3)
- { 9.000000f, 4.333333f, 1.333333f, 0.026866f }, // 818 (8 1 5 2)
- { 9.111111f, 3.777778f, 1.555556f, 0.031250f }, // 819 (8 1 6 1)
- { 9.222222f, 3.222222f, 1.777778f, 0.037657f }, // 820 (8 1 7 0)
- { 8.888889f, 6.222222f, 0.444444f, 0.018145f }, // 821 (8 2 0 6)
- { 9.000000f, 5.666667f, 0.666667f, 0.019780f }, // 822 (8 2 1 5)
- { 9.111111f, 5.111111f, 0.888889f, 0.021845f }, // 823 (8 2 2 4)
- { 9.222222f, 4.555555f, 1.111111f, 0.024523f }, // 824 (8 2 3 3)
- { 9.333333f, 4.000000f, 1.333333f, 0.028125f }, // 825 (8 2 4 2)
- { 9.444445f, 3.444444f, 1.555556f, 0.033210f }, // 826 (8 2 5 1)
- { 9.555555f, 2.888889f, 1.777778f, 0.040909f }, // 827 (8 2 6 0)
- { 9.333333f, 5.333333f, 0.666667f, 0.020270f }, // 828 (8 3 0 5)
- { 9.444445f, 4.777778f, 0.888889f, 0.022556f }, // 829 (8 3 1 4)
- { 9.555555f, 4.222222f, 1.111111f, 0.025568f }, // 830 (8 3 2 3)
- { 9.666667f, 3.666667f, 1.333333f, 0.029703f }, // 831 (8 3 3 2)
- { 9.777778f, 3.111111f, 1.555556f, 0.035714f }, // 832 (8 3 4 1)
- { 9.888889f, 2.555556f, 1.777778f, 0.045226f }, // 833 (8 3 5 0)
- { 9.777778f, 4.444445f, 0.888889f, 0.023438f }, // 834 (8 4 0 4)
- { 9.888889f, 3.888889f, 1.111111f, 0.026866f }, // 835 (8 4 1 3)
- { 10.000000f, 3.333333f, 1.333333f, 0.031690f }, // 836 (8 4 2 2)
- { 10.111111f, 2.777778f, 1.555556f, 0.038961f }, // 837 (8 4 3 1)
- { 10.222222f, 2.222222f, 1.777778f, 0.051136f }, // 838 (8 4 4 0)
- { 10.222222f, 3.555556f, 1.111111f, 0.028481f }, // 839 (8 5 0 3)
- { 10.333333f, 3.000000f, 1.333333f, 0.034221f }, // 840 (8 5 1 2)
- { 10.444445f, 2.444444f, 1.555556f, 0.043269f }, // 841 (8 5 2 1)
- { 10.555555f, 1.888889f, 1.777778f, 0.059603f }, // 842 (8 5 3 0)
- { 10.666667f, 2.666667f, 1.333333f, 0.037500f }, // 843 (8 6 0 2)
- { 10.777778f, 2.111111f, 1.555556f, 0.049180f }, // 844 (8 6 1 1)
- { 10.888889f, 1.555556f, 1.777778f, 0.072581f }, // 845 (8 6 2 0)
- { 11.111111f, 1.777778f, 1.555556f, 0.057692f }, // 846 (8 7 0 1)
- { 11.222222f, 1.222222f, 1.777778f, 0.094737f }, // 847 (8 7 1 0)
- { 11.555555f, 0.888889f, 1.777778f, 0.140625f }, // 848 (8 8 0 0)
- { 9.000000f, 7.000000f, 0.000000f, 0.015873f }, // 849 (9 0 0 7)
- { 9.111111f, 6.444445f, 0.222222f, 0.017045f }, // 850 (9 0 1 6)
- { 9.222222f, 5.888889f, 0.444444f, 0.018480f }, // 851 (9 0 2 5)
- { 9.333333f, 5.333333f, 0.666667f, 0.020270f }, // 852 (9 0 3 4)
- { 9.444445f, 4.777778f, 0.888889f, 0.022556f }, // 853 (9 0 4 3)
- { 9.555555f, 4.222222f, 1.111111f, 0.025568f }, // 854 (9 0 5 2)
- { 9.666667f, 3.666667f, 1.333333f, 0.029703f }, // 855 (9 0 6 1)
- { 9.777778f, 3.111111f, 1.555556f, 0.035714f }, // 856 (9 0 7 0)
- { 9.444445f, 6.111111f, 0.222222f, 0.017341f }, // 857 (9 1 0 6)
- { 9.555555f, 5.555555f, 0.444444f, 0.018908f }, // 858 (9 1 1 5)
- { 9.666667f, 5.000000f, 0.666667f, 0.020882f }, // 859 (9 1 2 4)
- { 9.777778f, 4.444445f, 0.888889f, 0.023438f }, // 860 (9 1 3 3)
- { 9.888889f, 3.888889f, 1.111111f, 0.026866f }, // 861 (9 1 4 2)
- { 10.000000f, 3.333333f, 1.333333f, 0.031690f }, // 862 (9 1 5 1)
- { 10.111111f, 2.777778f, 1.555556f, 0.038961f }, // 863 (9 1 6 0)
- { 9.888889f, 5.222222f, 0.444444f, 0.019438f }, // 864 (9 2 0 5)
- { 10.000000f, 4.666667f, 0.666667f, 0.021635f }, // 865 (9 2 1 4)
- { 10.111111f, 4.111111f, 0.888889f, 0.024523f }, // 866 (9 2 2 3)
- { 10.222222f, 3.555556f, 1.111111f, 0.028481f }, // 867 (9 2 3 2)
- { 10.333333f, 3.000000f, 1.333333f, 0.034221f }, // 868 (9 2 4 1)
- { 10.444445f, 2.444444f, 1.555556f, 0.043269f }, // 869 (9 2 5 0)
- { 10.333333f, 4.333333f, 0.666667f, 0.022556f }, // 870 (9 3 0 4)
- { 10.444445f, 3.777778f, 0.888889f, 0.025862f }, // 871 (9 3 1 3)
- { 10.555555f, 3.222222f, 1.111111f, 0.030508f }, // 872 (9 3 2 2)
- { 10.666667f, 2.666667f, 1.333333f, 0.037500f }, // 873 (9 3 3 1)
- { 10.777778f, 2.111111f, 1.555556f, 0.049180f }, // 874 (9 3 4 0)
- { 10.777778f, 3.444444f, 0.888889f, 0.027523f }, // 875 (9 4 0 3)
- { 10.888889f, 2.888889f, 1.111111f, 0.033088f }, // 876 (9 4 1 2)
- { 11.000000f, 2.333333f, 1.333333f, 0.041860f }, // 877 (9 4 2 1)
- { 11.111111f, 1.777778f, 1.555556f, 0.057692f }, // 878 (9 4 3 0)
- { 11.222222f, 2.555556f, 1.111111f, 0.036437f }, // 879 (9 5 0 2)
- { 11.333333f, 2.000000f, 1.333333f, 0.047872f }, // 880 (9 5 1 1)
- { 11.444445f, 1.444444f, 1.555556f, 0.070866f }, // 881 (9 5 2 0)
- { 11.666667f, 1.666667f, 1.333333f, 0.056604f }, // 882 (9 6 0 1)
- { 11.777778f, 1.111111f, 1.555556f, 0.093750f }, // 883 (9 6 1 0)
- { 12.111111f, 0.777778f, 1.555556f, 0.142857f }, // 884 (9 7 0 0)
- { 10.000000f, 6.000000f, 0.000000f, 0.016667f }, // 885 (10 0 0 6)
- { 10.111111f, 5.444445f, 0.222222f, 0.018182f }, // 886 (10 0 1 5)
- { 10.222222f, 4.888889f, 0.444444f, 0.020089f }, // 887 (10 0 2 4)
- { 10.333333f, 4.333333f, 0.666667f, 0.022556f }, // 888 (10 0 3 3)
- { 10.444445f, 3.777778f, 0.888889f, 0.025862f }, // 889 (10 0 4 2)
- { 10.555555f, 3.222222f, 1.111111f, 0.030508f }, // 890 (10 0 5 1)
- { 10.666667f, 2.666667f, 1.333333f, 0.037500f }, // 891 (10 0 6 0)
- { 10.444445f, 5.111111f, 0.222222f, 0.018750f }, // 892 (10 1 0 5)
- { 10.555555f, 4.555555f, 0.444444f, 0.020882f }, // 893 (10 1 1 4)
- { 10.666667f, 4.000000f, 0.666667f, 0.023684f }, // 894 (10 1 2 3)
- { 10.777778f, 3.444444f, 0.888889f, 0.027523f }, // 895 (10 1 3 2)
- { 10.888889f, 2.888889f, 1.111111f, 0.033088f }, // 896 (10 1 4 1)
- { 11.000000f, 2.333333f, 1.333333f, 0.041860f }, // 897 (10 1 5 0)
- { 10.888889f, 4.222222f, 0.444444f, 0.021845f }, // 898 (10 2 0 4)
- { 11.000000f, 3.666667f, 0.666667f, 0.025070f }, // 899 (10 2 1 3)
- { 11.111111f, 3.111111f, 0.888889f, 0.029605f }, // 900 (10 2 2 2)
- { 11.222222f, 2.555556f, 1.111111f, 0.036437f }, // 901 (10 2 3 1)
- { 11.333333f, 2.000000f, 1.333333f, 0.047872f }, // 902 (10 2 4 0)
- { 11.333333f, 3.333333f, 0.666667f, 0.026786f }, // 903 (10 3 0 3)
- { 11.444445f, 2.777778f, 0.888889f, 0.032258f }, // 904 (10 3 1 2)
- { 11.555555f, 2.222222f, 1.111111f, 0.040909f }, // 905 (10 3 2 1)
- { 11.666667f, 1.666667f, 1.333333f, 0.056604f }, // 906 (10 3 3 0)
- { 11.777778f, 2.444444f, 0.888889f, 0.035714f }, // 907 (10 4 0 2)
- { 11.888889f, 1.888889f, 1.111111f, 0.047120f }, // 908 (10 4 1 1)
- { 12.000000f, 1.333333f, 1.333333f, 0.070313f }, // 909 (10 4 2 0)
- { 12.222222f, 1.555556f, 1.111111f, 0.056250f }, // 910 (10 5 0 1)
- { 12.333333f, 1.000000f, 1.333333f, 0.094737f }, // 911 (10 5 1 0)
- { 12.666667f, 0.666667f, 1.333333f, 0.150000f }, // 912 (10 6 0 0)
- { 11.000000f, 5.000000f, 0.000000f, 0.018182f }, // 913 (11 0 0 5)
- { 11.111111f, 4.444445f, 0.222222f, 0.020270f }, // 914 (11 0 1 4)
- { 11.222222f, 3.888889f, 0.444444f, 0.023018f }, // 915 (11 0 2 3)
- { 11.333333f, 3.333333f, 0.666667f, 0.026786f }, // 916 (11 0 3 2)
- { 11.444445f, 2.777778f, 0.888889f, 0.032258f }, // 917 (11 0 4 1)
- { 11.555555f, 2.222222f, 1.111111f, 0.040909f }, // 918 (11 0 5 0)
- { 11.444445f, 4.111111f, 0.222222f, 0.021277f }, // 919 (11 1 0 4)
- { 11.555555f, 3.555556f, 0.444444f, 0.024457f }, // 920 (11 1 1 3)
- { 11.666667f, 3.000000f, 0.666667f, 0.028939f }, // 921 (11 1 2 2)
- { 11.777778f, 2.444444f, 0.888889f, 0.035714f }, // 922 (11 1 3 1)
- { 11.888889f, 1.888889f, 1.111111f, 0.047120f }, // 923 (11 1 4 0)
- { 11.888889f, 3.222222f, 0.444444f, 0.026239f }, // 924 (11 2 0 3)
- { 12.000000f, 2.666667f, 0.666667f, 0.031690f }, // 925 (11 2 1 2)
- { 12.111111f, 2.111111f, 0.888889f, 0.040359f }, // 926 (11 2 2 1)
- { 12.222222f, 1.555556f, 1.111111f, 0.056250f }, // 927 (11 2 3 0)
- { 12.333333f, 2.333333f, 0.666667f, 0.035294f }, // 928 (11 3 0 2)
- { 12.444445f, 1.777778f, 0.888889f, 0.046875f }, // 929 (11 3 1 1)
- { 12.555555f, 1.222222f, 1.111111f, 0.070866f }, // 930 (11 3 2 0)
- { 12.777778f, 1.444444f, 0.888889f, 0.056604f }, // 931 (11 4 0 1)
- { 12.888889f, 0.888889f, 1.111111f, 0.097826f }, // 932 (11 4 1 0)
- { 13.222222f, 0.555556f, 1.111111f, 0.163636f }, // 933 (11 5 0 0)
- { 12.000000f, 4.000000f, 0.000000f, 0.020833f }, // 934 (12 0 0 4)
- { 12.111111f, 3.444444f, 0.222222f, 0.024000f }, // 935 (12 0 1 3)
- { 12.222222f, 2.888889f, 0.444444f, 0.028481f }, // 936 (12 0 2 2)
- { 12.333333f, 2.333333f, 0.666667f, 0.035294f }, // 937 (12 0 3 1)
- { 12.444445f, 1.777778f, 0.888889f, 0.046875f }, // 938 (12 0 4 0)
- { 12.444445f, 3.111111f, 0.222222f, 0.025862f }, // 939 (12 1 0 3)
- { 12.555555f, 2.555556f, 0.444444f, 0.031359f }, // 940 (12 1 1 2)
- { 12.666667f, 2.000000f, 0.666667f, 0.040179f }, // 941 (12 1 2 1)
- { 12.777778f, 1.444444f, 0.888889f, 0.056604f }, // 942 (12 1 3 0)
- { 12.888889f, 2.222222f, 0.444444f, 0.035156f }, // 943 (12 2 0 2)
- { 13.000000f, 1.666667f, 0.666667f, 0.047120f }, // 944 (12 2 1 1)
- { 13.111111f, 1.111111f, 0.888889f, 0.072581f }, // 945 (12 2 2 0)
- { 13.333333f, 1.333333f, 0.666667f, 0.057692f }, // 946 (12 3 0 1)
- { 13.444445f, 0.777778f, 0.888889f, 0.103448f }, // 947 (12 3 1 0)
- { 13.777778f, 0.444444f, 0.888889f, 0.187500f }, // 948 (12 4 0 0)
- { 13.000000f, 3.000000f, 0.000000f, 0.025641f }, // 949 (13 0 0 3)
- { 13.111111f, 2.444444f, 0.222222f, 0.031250f }, // 950 (13 0 1 2)
- { 13.222222f, 1.888889f, 0.444444f, 0.040359f }, // 951 (13 0 2 1)
- { 13.333333f, 1.333333f, 0.666667f, 0.057692f }, // 952 (13 0 3 0)
- { 13.444445f, 2.111111f, 0.222222f, 0.035294f }, // 953 (13 1 0 2)
- { 13.555555f, 1.555556f, 0.444444f, 0.047872f }, // 954 (13 1 1 1)
- { 13.666667f, 1.000000f, 0.666667f, 0.075630f }, // 955 (13 1 2 0)
- { 13.888889f, 1.222222f, 0.444444f, 0.059603f }, // 956 (13 2 0 1)
- { 14.000000f, 0.666667f, 0.666667f, 0.112500f }, // 957 (13 2 1 0)
- { 14.333333f, 0.333333f, 0.666667f, 0.230769f }, // 958 (13 3 0 0)
- { 14.000000f, 2.000000f, 0.000000f, 0.035714f }, // 959 (14 0 0 2)
- { 14.111111f, 1.444444f, 0.222222f, 0.049180f }, // 960 (14 0 1 1)
- { 14.222222f, 0.888889f, 0.444444f, 0.080357f }, // 961 (14 0 2 0)
- { 14.444445f, 1.111111f, 0.222222f, 0.062500f }, // 962 (14 1 0 1)
- { 14.555555f, 0.555556f, 0.444444f, 0.126761f }, // 963 (14 1 1 0)
- { 14.888889f, 0.222222f, 0.444444f, 0.321429f }, // 964 (14 2 0 0)
- { 15.000000f, 1.000000f, 0.000000f, 0.066667f }, // 965 (15 0 0 1)
- { 15.111111f, 0.444444f, 0.222222f, 0.150000f }, // 966 (15 0 1 0)
- { 15.444445f, 0.111111f, 0.222222f, 0.600000f }, // 967 (15 1 0 0)
- { 16.000000f, 0.000000f, 0.000000f, FLT_MAX }, // 968 (16 0 0 0)
-}; // 969 four cluster elements
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/maths.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/maths.cpp
deleted file mode 100644
index 4cf4fc2e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/maths.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "maths.h"
-#include <cfloat>
-
-namespace nvsquish {
-
-Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weights, Vec3::Arg metric )
-{
- // compute the centroid
- float total = 0.0f;
- Vec3 centroid( 0.0f );
- for( int i = 0; i < n; ++i )
- {
- total += weights[i];
- centroid += weights[i]*points[i];
- }
- centroid /= total;
-
- // accumulate the covariance matrix
- Sym3x3 covariance( 0.0f );
- for( int i = 0; i < n; ++i )
- {
- Vec3 a = (points[i] - centroid) * metric;
- Vec3 b = weights[i]*a;
-
- covariance[0] += a.X()*b.X();
- covariance[1] += a.X()*b.Y();
- covariance[2] += a.X()*b.Z();
- covariance[3] += a.Y()*b.Y();
- covariance[4] += a.Y()*b.Z();
- covariance[5] += a.Z()*b.Z();
- }
-
- // return it
- return covariance;
-}
-
-#if 1
-
-Vec3 ComputePrincipleComponent( Sym3x3 const& matrix )
-{
- const int NUM = 8;
-
- Vec3 v(1, 1, 1);
- for (int i = 0; i < NUM; i++)
- {
- float x = v.X() * matrix[0] + v.Y() * matrix[1] + v.Z() * matrix[2];
- float y = v.X() * matrix[1] + v.Y() * matrix[3] + v.Z() * matrix[4];
- float z = v.X() * matrix[2] + v.Y() * matrix[4] + v.Z() * matrix[5];
-
- float norm = std::max(std::max(x, y), z);
-
- float iv = 1.0f / norm;
- v = Vec3(x*iv, y*iv, z*iv);
- }
-
- return v;
-}
-
-#else
-
-static Vec3 GetMultiplicity1Evector( Sym3x3 const& matrix, float evalue )
-{
- // compute M
- Sym3x3 m;
- m[0] = matrix[0] - evalue;
- m[1] = matrix[1];
- m[2] = matrix[2];
- m[3] = matrix[3] - evalue;
- m[4] = matrix[4];
- m[5] = matrix[5] - evalue;
-
- // compute U
- Sym3x3 u;
- u[0] = m[3]*m[5] - m[4]*m[4];
- u[1] = m[2]*m[4] - m[1]*m[5];
- u[2] = m[1]*m[4] - m[2]*m[3];
- u[3] = m[0]*m[5] - m[2]*m[2];
- u[4] = m[1]*m[2] - m[4]*m[0];
- u[5] = m[0]*m[3] - m[1]*m[1];
-
- // find the largest component
- float mc = std::fabs( u[0] );
- int mi = 0;
- for( int i = 1; i < 6; ++i )
- {
- float c = std::fabs( u[i] );
- if( c > mc )
- {
- mc = c;
- mi = i;
- }
- }
-
- // pick the column with this component
- switch( mi )
- {
- case 0:
- return Vec3( u[0], u[1], u[2] );
-
- case 1:
- case 3:
- return Vec3( u[1], u[3], u[4] );
-
- default:
- return Vec3( u[2], u[4], u[5] );
- }
-}
-
-static Vec3 GetMultiplicity2Evector( Sym3x3 const& matrix, float evalue )
-{
- // compute M
- Sym3x3 m;
- m[0] = matrix[0] - evalue;
- m[1] = matrix[1];
- m[2] = matrix[2];
- m[3] = matrix[3] - evalue;
- m[4] = matrix[4];
- m[5] = matrix[5] - evalue;
-
- // find the largest component
- float mc = std::fabs( m[0] );
- int mi = 0;
- for( int i = 1; i < 6; ++i )
- {
- float c = std::fabs( m[i] );
- if( c > mc )
- {
- mc = c;
- mi = i;
- }
- }
-
- // pick the first eigenvector based on this index
- switch( mi )
- {
- case 0:
- case 1:
- return Vec3( -m[1], m[0], 0.0f );
-
- case 2:
- return Vec3( m[2], 0.0f, -m[0] );
-
- case 3:
- case 4:
- return Vec3( 0.0f, -m[4], m[3] );
-
- default:
- return Vec3( 0.0f, -m[5], m[4] );
- }
-}
-
-Vec3 ComputePrincipleComponent( Sym3x3 const& matrix )
-{
- // compute the cubic coefficients
- float c0 = matrix[0]*matrix[3]*matrix[5]
- + 2.0f*matrix[1]*matrix[2]*matrix[4]
- - matrix[0]*matrix[4]*matrix[4]
- - matrix[3]*matrix[2]*matrix[2]
- - matrix[5]*matrix[1]*matrix[1];
- float c1 = matrix[0]*matrix[3] + matrix[0]*matrix[5] + matrix[3]*matrix[5]
- - matrix[1]*matrix[1] - matrix[2]*matrix[2] - matrix[4]*matrix[4];
- float c2 = matrix[0] + matrix[3] + matrix[5];
-
- // compute the quadratic coefficients
- float a = c1 - ( 1.0f/3.0f )*c2*c2;
- float b = ( -2.0f/27.0f )*c2*c2*c2 + ( 1.0f/3.0f )*c1*c2 - c0;
-
- // compute the root count check
- float Q = 0.25f*b*b + ( 1.0f/27.0f )*a*a*a;
-
- // test the multiplicity
- if( FLT_EPSILON < Q )
- {
- // only one root, which implies we have a multiple of the identity
- return Vec3( 1.0f );
- }
- else if( Q < -FLT_EPSILON )
- {
- // three distinct roots
- float theta = std::atan2( std::sqrt( -Q ), -0.5f*b );
- float rho = std::sqrt( 0.25f*b*b - Q );
-
- float rt = std::pow( rho, 1.0f/3.0f );
- float ct = std::cos( theta/3.0f );
- float st = std::sin( theta/3.0f );
-
- float l1 = ( 1.0f/3.0f )*c2 + 2.0f*rt*ct;
- float l2 = ( 1.0f/3.0f )*c2 - rt*( ct + ( float )sqrt( 3.0f )*st );
- float l3 = ( 1.0f/3.0f )*c2 - rt*( ct - ( float )sqrt( 3.0f )*st );
-
- // pick the larger
- if( std::fabs( l2 ) > std::fabs( l1 ) )
- l1 = l2;
- if( std::fabs( l3 ) > std::fabs( l1 ) )
- l1 = l3;
-
- // get the eigenvector
- return GetMultiplicity1Evector( matrix, l1 );
- }
- else // if( -FLT_EPSILON <= Q && Q <= FLT_EPSILON )
- {
- // two roots
- float rt;
- if( b < 0.0f )
- rt = -std::pow( -0.5f*b, 1.0f/3.0f );
- else
- rt = std::pow( 0.5f*b, 1.0f/3.0f );
-
- float l1 = ( 1.0f/3.0f )*c2 + rt; // repeated
- float l2 = ( 1.0f/3.0f )*c2 - 2.0f*rt;
-
- // get the eigenvector
- if( std::fabs( l1 ) > std::fabs( l2 ) )
- return GetMultiplicity2Evector( matrix, l1 );
- else
- return GetMultiplicity1Evector( matrix, l2 );
- }
-}
-#endif
-
-
-} // namespace squish
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/maths.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/maths.h
deleted file mode 100644
index 19f1d9d3..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/maths.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef NV_SQUISH_MATHS_H
-#define NV_SQUISH_MATHS_H
-
-#include <cmath>
-#include <algorithm>
-#include "config.h"
-
-namespace nvsquish {
-
-class Vec3
-{
-public:
- typedef Vec3 const& Arg;
-
- Vec3()
- {
- }
-
- explicit Vec3( float a )
- {
- m_x = a;
- m_y = a;
- m_z = a;
- }
-
- Vec3( float a, float b, float c )
- {
- m_x = a;
- m_y = b;
- m_z = c;
- }
-
- float X() const { return m_x; }
- float Y() const { return m_y; }
- float Z() const { return m_z; }
-
- Vec3 operator-() const
- {
- return Vec3( -m_x, -m_y, -m_z );
- }
-
- Vec3& operator+=( Arg v )
- {
- m_x += v.m_x;
- m_y += v.m_y;
- m_z += v.m_z;
- return *this;
- }
-
- Vec3& operator-=( Arg v )
- {
- m_x -= v.m_x;
- m_y -= v.m_y;
- m_z -= v.m_z;
- return *this;
- }
-
- Vec3& operator*=( Arg v )
- {
- m_x *= v.m_x;
- m_y *= v.m_y;
- m_z *= v.m_z;
- return *this;
- }
-
- Vec3& operator*=( float s )
- {
- m_x *= s;
- m_y *= s;
- m_z *= s;
- return *this;
- }
-
- Vec3& operator/=( Arg v )
- {
- m_x /= v.m_x;
- m_y /= v.m_y;
- m_z /= v.m_z;
- return *this;
- }
-
- Vec3& operator/=( float s )
- {
- float t = 1.0f/s;
- m_x *= t;
- m_y *= t;
- m_z *= t;
- return *this;
- }
-
- friend Vec3 operator+( Arg left, Arg right )
- {
- Vec3 copy( left );
- return copy += right;
- }
-
- friend Vec3 operator+( Arg left, float right )
- {
- Vec3 copy( left );
- return copy += Vec3(right);
- }
-
- friend Vec3 operator-( Arg left, Arg right )
- {
- Vec3 copy( left );
- return copy -= right;
- }
-
- friend Vec3 operator*( Arg left, Arg right )
- {
- Vec3 copy( left );
- return copy *= right;
- }
-
- friend Vec3 operator*( Arg left, float right )
- {
- Vec3 copy( left );
- return copy *= right;
- }
-
- friend Vec3 operator*( float left, Arg right )
- {
- Vec3 copy( right );
- return copy *= left;
- }
-
- friend Vec3 operator/( Arg left, Arg right )
- {
- Vec3 copy( left );
- return copy /= right;
- }
-
- friend Vec3 operator/( Arg left, float right )
- {
- Vec3 copy( left );
- return copy /= right;
- }
-
- friend float Dot( Arg left, Arg right )
- {
- return left.m_x*right.m_x + left.m_y*right.m_y + left.m_z*right.m_z;
- }
-
- friend Vec3 Min( Arg left, Arg right )
- {
- return Vec3(
- std::min( left.m_x, right.m_x ),
- std::min( left.m_y, right.m_y ),
- std::min( left.m_z, right.m_z )
- );
- }
-
- friend Vec3 Max( Arg left, Arg right )
- {
- return Vec3(
- std::max( left.m_x, right.m_x ),
- std::max( left.m_y, right.m_y ),
- std::max( left.m_z, right.m_z )
- );
- }
-
- friend Vec3 Floor( Arg v )
- {
- return Vec3(
- std::floor( v.m_x ),
- std::floor( v.m_y ),
- std::floor( v.m_z )
- );
- }
-
-private:
- float m_x;
- float m_y;
- float m_z;
-};
-
-inline float LengthSquared( Vec3::Arg v )
-{
- return Dot( v, v );
-}
-
-class Sym3x3
-{
-public:
- Sym3x3()
- {
- }
-
- Sym3x3( float a )
- {
- for( int i = 0; i < 6; ++i )
- m_x[i] = a;
- }
-
- float operator[]( int index ) const
- {
- return m_x[index];
- }
-
- float& operator[]( int index )
- {
- return m_x[index];
- }
-
-private:
- float m_x[6];
-};
-
-Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weights, Vec3::Arg metric );
-Vec3 ComputePrincipleComponent( Sym3x3 const& matrix );
-
-} // namespace squish
-
-#endif // ndef SQUISH_MATHS_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/rangefit.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/rangefit.cpp
deleted file mode 100644
index 93c0a696..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/rangefit.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "rangefit.h"
-#include "colourset.h"
-#include "colourblock.h"
-#include <cfloat>
-
-namespace squish {
-
-RangeFit::RangeFit( ColourSet const* colours, int flags )
- : ColourFit( colours, flags )
-{
- // initialise the metric
- bool perceptual = ( ( m_flags & kColourMetricPerceptual ) != 0 );
- if( perceptual )
- m_metric = Vec3( 0.2126f, 0.7152f, 0.0722f );
- else
- m_metric = Vec3( 1.0f );
-
- // initialise the best error
- m_besterror = FLT_MAX;
-
- // cache some values
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
- float const* weights = m_colours->GetWeights();
-
- // get the covariance matrix
- Sym3x3 covariance = ComputeWeightedCovariance( count, values, weights );
-
- // compute the principle component
- Vec3 principle = ComputePrincipleComponent( covariance );
-
- // get the min and max range as the codebook endpoints
- Vec3 start( 0.0f );
- Vec3 end( 0.0f );
- if( count > 0 )
- {
- float min, max;
-
- // compute the range
- start = end = values[0];
- min = max = Dot( values[0], principle );
- for( int i = 1; i < count; ++i )
- {
- float val = Dot( values[i], principle );
- if( val < min )
- {
- start = values[i];
- min = val;
- }
- else if( val > max )
- {
- end = values[i];
- max = val;
- }
- }
- }
-
- // clamp the output to [0, 1]
- Vec3 const one( 1.0f );
- Vec3 const zero( 0.0f );
- start = Min( one, Max( zero, start ) );
- end = Min( one, Max( zero, end ) );
-
- // clamp to the grid and save
- Vec3 const grid( 31.0f, 63.0f, 31.0f );
- Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f );
- Vec3 const half( 0.5f );
- m_start = Floor( grid*start + half )*gridrcp;
- m_end = Floor( grid*end + half )*gridrcp;
-}
-
-void RangeFit::Compress3( void* block )
-{
- // cache some values
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
-
- // create a codebook
- Vec3 codes[3];
- codes[0] = m_start;
- codes[1] = m_end;
- codes[2] = 0.5f*m_start + 0.5f*m_end;
-
- // match each point to the closest code
- u8 closest[16];
- float error = 0.0f;
- for( int i = 0; i < count; ++i )
- {
- // find the closest code
- float dist = FLT_MAX;
- int idx = 0;
- for( int j = 0; j < 3; ++j )
- {
- float d = LengthSquared( m_metric*( values[i] - codes[j] ) );
- if( d < dist )
- {
- dist = d;
- idx = j;
- }
- }
-
- // save the index
- closest[i] = ( u8 )idx;
-
- // accumulate the error
- error += dist;
- }
-
- // save this scheme if it wins
- if( error < m_besterror )
- {
- // remap the indices
- u8 indices[16];
- m_colours->RemapIndices( closest, indices );
-
- // save the block
- WriteColourBlock3( m_start, m_end, indices, block );
-
- // save the error
- m_besterror = error;
- }
-}
-
-void RangeFit::Compress4( void* block )
-{
- // cache some values
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
-
- // create a codebook
- Vec3 codes[4];
- codes[0] = m_start;
- codes[1] = m_end;
- codes[2] = ( 2.0f/3.0f )*m_start + ( 1.0f/3.0f )*m_end;
- codes[3] = ( 1.0f/3.0f )*m_start + ( 2.0f/3.0f )*m_end;
-
- // match each point to the closest code
- u8 closest[16];
- float error = 0.0f;
- for( int i = 0; i < count; ++i )
- {
- // find the closest code
- float dist = FLT_MAX;
- int idx = 0;
- for( int j = 0; j < 4; ++j )
- {
- float d = LengthSquared( m_metric*( values[i] - codes[j] ) );
- if( d < dist )
- {
- dist = d;
- idx = j;
- }
- }
-
- // save the index
- closest[i] = ( u8 )idx;
-
- // accumulate the error
- error += dist;
- }
-
- // save this scheme if it wins
- if( error < m_besterror )
- {
- // remap the indices
- u8 indices[16];
- m_colours->RemapIndices( closest, indices );
-
- // save the block
- WriteColourBlock4( m_start, m_end, indices, block );
-
- // save the error
- m_besterror = error;
- }
-}
-
-} // namespace squish
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/rangefit.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/rangefit.h
deleted file mode 100644
index 79520199..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/rangefit.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_RANGEFIT_H
-#define SQUISH_RANGEFIT_H
-
-#include <squish.h>
-#include "colourfit.h"
-#include "maths.h"
-
-namespace squish {
-
-class ColourSet;
-
-class RangeFit : public ColourFit
-{
-public:
- RangeFit( ColourSet const* colours, int flags );
-
-private:
- virtual void Compress3( void* block );
- virtual void Compress4( void* block );
-
- Vec3 m_metric;
- Vec3 m_start;
- Vec3 m_end;
- float m_besterror;
-};
-
-} // squish
-
-#endif // ndef SQUISH_RANGEFIT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd.h
deleted file mode 100644
index 70668548..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef NV_SQUISH_SIMD_H
-#define NV_SQUISH_SIMD_H
-
-#include "maths.h"
-
-#ifdef __GNUC__
-# define SQUISH_ALIGN_16 __attribute__ ((__aligned__ (16)))
-#else
-# define SQUISH_ALIGN_16 __declspec(align(16))
-#endif
-
-#if SQUISH_USE_ALTIVEC
-#include "simd_ve.h"
-#endif
-
-#if SQUISH_USE_SSE
-#include "simd_sse.h"
-#endif
-
-#endif // ndef SQUISH_SIMD_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd_3dnow.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd_3dnow.h
deleted file mode 100644
index 2613630e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd_3dnow.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_SIMD_3DNOW_H
-#define SQUISH_SIMD_3DNOW_H
-
-//#include <xmmintrin.h>
-#include <mm3dnow.h>
-#include <cassert>
-
-//#define SQUISH_SSE_SPLAT( a ) \
- ( ( a ) | ( ( a ) << 2 ) | ( ( a ) << 4 ) | ( ( a ) << 6 ) )
-
-namespace squish {
-
-//#define VEC4_CONST( X ) Vec4( _mm_set1_ps( X ) )
-
-class Vec4
-{
-public:
- typedef Vec4 const& Arg;
-
- Vec4() {}
-
- Vec4( __m64 v0, __m64 v1 ) : m_v0( v0 ), m_v1( v1 ) {}
-
- Vec4( Vec4 const& arg ) : m_v0( arg.m_v0 ), m_v1( arg.m_v1 ) {}
-
- Vec4& operator=( Vec4 const& arg )
- {
- m_v0 = arg.m_v0;
- m_v1 = arg.m_v1;
- return *this;
- }
-
- Vec4( float x, float y, float z, float w )
- {
- m_v0 = _mm_set_pi32( *(int *)&x, *(int *)&y );
- m_v1 = _mm_set_pi32( *(int *)&z, *(int *)&w );
- }
-
-/* Vec3 GetVec3() const
- {
-#ifdef __GNUC__
- __attribute__ ((__aligned__ (16))) float c[4];
-#else
- __declspec(align(16)) float c[4];
-#endif
- //_mm_store_ps( c, m_v );
- return Vec3( c[0], c[1], c[2] );
- }
-*/
-// Vec4 SplatX() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 0 ) ) ); }
-// Vec4 SplatY() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 1 ) ) ); }
-// Vec4 SplatZ() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 2 ) ) ); }
-// Vec4 SplatW() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 3 ) ) ); }
-
- Vec4& operator+=( Arg v )
- {
- m_v0 = _m_pfadd( m_v0, v.m_v0 );
- m_v1 = _m_pfadd( m_v1, v.m_v1 );
- return *this;
- }
-
- Vec4& operator-=( Arg v )
- {
- m_v0 = _m_pfsub( m_v0, v.m_v0 );
- m_v1 = _m_pfsub( m_v1, v.m_v1 );
- return *this;
- }
-
- Vec4& operator*=( Arg v )
- {
- m_v0 = _m_pfmul( m_v0, v.m_v0 );
- m_v1 = _m_pfmul( m_v1, v.m_v1 );
- return *this;
- }
-
- friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4(
- _m_pfadd( left.m_v0, right.m_v0 ),
- _m_pfadd( left.m_v1, right.m_v1 ));
- }
-
- friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4(
- _m_pfsub( left.m_v0, right.m_v0 ),
- _m_pfsub( left.m_v1, right.m_v1 ));
- }
-
- friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4(
- _m_pfmul( left.m_v0, right.m_v0 ),
- _m_pfmul( left.m_v1, right.m_v1 ));
- }
-
- //! Returns a*b + c
- friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
- {
- return Vec4(
- _m_pfadd( _m_pfmul( a.m_v0, b.m_v0 ), c.m_v0 ),
- _m_pfadd( _m_pfmul( a.m_v1, b.m_v1 ), c.m_v1 ));
- }
-
- //! Returns -( a*b - c )
- friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
- {
- return Vec4(
- _m_pfsub( c.m_v0, _m_pfmul( a.m_v0, b.m_v0 ) ),
- _m_pfsub( c.m_v1, _m_pfmul( a.m_v1, b.m_v1 ) ));
- }
-
- friend Vec4 Reciprocal( Vec4::Arg v )
- {
- // get the reciprocal estimate
- __m64 x0 = _m_pfrcp(v.m_v0);
- __m64 y1 = _m_pfrcp(v.m_v1);
-
- // Newton-Rhaphson refinement
- __m64 x1 = _m_pfrcpit1(v.m_v0, x0);
- __m64 y1 = _m_pfrcpit1(v.m_v1, y0);
-
- __m64 x2 = _m_pfrcpit2(x1, x0);
- __m64 y2 = _m_pfrcpit2(y1, y0);
-
- return Vec4(x2, y2);
- }
-
- friend Vec4 Min( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4(
- _m_pfmin( left.m_v0, right.m_v0 ),
- _m_pfmin( left.m_v1, right.m_v1 ));
- }
-
- friend Vec4 Max( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4(
- _m_pfmax( left.m_v0, right.m_v0 ),
- _m_pfmax( left.m_v1, right.m_v1 ));
- }
-
- friend Vec4 Truncate( Vec4::Arg v )
- {
- // convert to ints
- __m64 i0 = _m_pf2id( v.m_v0 );
- __m64 i1 = _m_pf2id( v.m_v1 );
-
- // convert to floats
- __m64 f0 = _m_pi2fd( i0 );
- __m64 f1 = _m_pi2fd( i1 );
-
- // clear out the MMX multimedia state to allow FP calls later
- //_m_femms();
-
- return Vec4( f0, f1 );
- }
-
- friend Vec4 CompareEqual( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4(
- _m_pfcmpeq( left.m_v0, right.m_v0 ),
- _m_pfcmpeq( left.m_v1, right.m_v1 ));
- }
-/*
- friend Vec4 Select( Vec4::Arg off, Vec4::Arg on, Vec4::Arg bits )
- {
- __m128 a = _mm_andnot_ps( bits.m_v, off.m_v );
- __m128 b = _mm_and_ps( bits.m_v, on.m_v );
-
- return Vec4( _mm_or_ps( a, b ) );
- }
-*//*
- friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right )
- {
- __m128 bits = _mm_cmplt_ps( left.m_v, right.m_v );
- int value = _mm_movemask_ps( bits );
- return value != 0;
- }
-*/
-private:
- __m64 m_v0;
- __m64 m_v1;
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_SIMD_3DNOW_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd_sse.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd_sse.h
deleted file mode 100644
index aa0e7b72..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd_sse.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef NV_SQUISH_SIMD_SSE_H
-#define NV_SQUISH_SIMD_SSE_H
-
-#include <xmmintrin.h>
-#if ( SQUISH_USE_SSE > 1 )
-#include <emmintrin.h>
-#endif
-#include <cassert>
-
-#define SQUISH_SSE_SPLAT( a ) \
- ( ( a ) | ( ( a ) << 2 ) | ( ( a ) << 4 ) | ( ( a ) << 6 ) )
-
-namespace nvsquish {
-
-#define VEC4_CONST( X ) Vec4( _mm_set1_ps( X ) )
-
-class Vec4
-{
-public:
- typedef Vec4 const& Arg;
-
- Vec4() {}
-
- explicit Vec4( __m128 v ) : m_v( v ) {}
-
- Vec4( Vec4 const& arg ) : m_v( arg.m_v ) {}
-
- Vec4& operator=( Vec4 const& arg )
- {
- m_v = arg.m_v;
- return *this;
- }
-
- Vec4( const float * v )
- {
- m_v = _mm_load_ps( v );
- }
-
- Vec4( float x, float y, float z, float w )
- {
- m_v = _mm_setr_ps( x, y, z, w );
- }
-
- Vec3 GetVec3() const
- {
- SQUISH_ALIGN_16 float c[4];
- _mm_store_ps( c, m_v );
- return Vec3( c[0], c[1], c[2] );
- }
-
- Vec4 SplatX() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 0 ) ) ); }
- Vec4 SplatY() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 1 ) ) ); }
- Vec4 SplatZ() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 2 ) ) ); }
- Vec4 SplatW() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 3 ) ) ); }
-
- Vec4& operator+=( Arg v )
- {
- m_v = _mm_add_ps( m_v, v.m_v );
- return *this;
- }
-
- Vec4& operator-=( Arg v )
- {
- m_v = _mm_sub_ps( m_v, v.m_v );
- return *this;
- }
-
- Vec4& operator*=( Arg v )
- {
- m_v = _mm_mul_ps( m_v, v.m_v );
- return *this;
- }
-
- friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( _mm_add_ps( left.m_v, right.m_v ) );
- }
-
- friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( _mm_sub_ps( left.m_v, right.m_v ) );
- }
-
- friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( _mm_mul_ps( left.m_v, right.m_v ) );
- }
-
- //! Returns a*b + c
- friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
- {
- return Vec4( _mm_add_ps( _mm_mul_ps( a.m_v, b.m_v ), c.m_v ) );
- }
-
- //! Returns -( a*b - c )
- friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
- {
- return Vec4( _mm_sub_ps( c.m_v, _mm_mul_ps( a.m_v, b.m_v ) ) );
- }
-
- friend Vec4 Reciprocal( Vec4::Arg v )
- {
- // get the reciprocal estimate
- __m128 estimate = _mm_rcp_ps( v.m_v );
-
- // one round of Newton-Rhaphson refinement
- __m128 diff = _mm_sub_ps( _mm_set1_ps( 1.0f ), _mm_mul_ps( estimate, v.m_v ) );
- return Vec4( _mm_add_ps( _mm_mul_ps( diff, estimate ), estimate ) );
- }
-
- friend Vec4 Min( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( _mm_min_ps( left.m_v, right.m_v ) );
- }
-
- friend Vec4 Max( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( _mm_max_ps( left.m_v, right.m_v ) );
- }
-
- friend Vec4 Truncate( Vec4::Arg v )
- {
-#if ( SQUISH_USE_SSE == 1 )
- // convert to ints
- __m128 input = v.m_v;
- __m64 lo = _mm_cvttps_pi32( input );
- __m64 hi = _mm_cvttps_pi32( _mm_movehl_ps( input, input ) );
-
- // convert to floats
- __m128 part = _mm_movelh_ps( input, _mm_cvtpi32_ps( input, hi ) );
- __m128 truncated = _mm_cvtpi32_ps( part, lo );
-
- // clear out the MMX multimedia state to allow FP calls later
- _mm_empty();
- return Vec4( truncated );
-#else
- // use SSE2 instructions
- return Vec4( _mm_cvtepi32_ps( _mm_cvttps_epi32( v.m_v ) ) );
-#endif
- }
-
- friend Vec4 CompareEqual( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( _mm_cmpeq_ps( left.m_v, right.m_v ) );
- }
-
- friend Vec4 Select( Vec4::Arg off, Vec4::Arg on, Vec4::Arg bits )
- {
- __m128 a = _mm_andnot_ps( bits.m_v, off.m_v );
- __m128 b = _mm_and_ps( bits.m_v, on.m_v );
-
- return Vec4( _mm_or_ps( a, b ) );
- }
-
- friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right )
- {
- __m128 bits = _mm_cmplt_ps( left.m_v, right.m_v );
- int value = _mm_movemask_ps( bits );
- return value != 0;
- }
-
-private:
- __m128 m_v;
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_SIMD_SSE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd_ve.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd_ve.h
deleted file mode 100644
index 0f90a44c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/simd_ve.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_SIMD_VE_H
-#define SQUISH_SIMD_VE_H
-
-#ifndef __APPLE_ALTIVEC__
-#include <altivec.h>
-#undef bool
-#endif
-
-namespace squish {
-
-#define VEC4_CONST( X ) Vec4( ( vector float )( X ) )
-
-class Vec4
-{
-public:
- typedef Vec4 Arg;
-
- Vec4() {}
-
- explicit Vec4( vector float v ) : m_v( v ) {}
-
- Vec4( Vec4 const& arg ) : m_v( arg.m_v ) {}
-
- Vec4& operator=( Vec4 const& arg )
- {
- m_v = arg.m_v;
- return *this;
- }
-
- Vec4( const float * v )
- {
- union { vector float v; float c[4]; } u;
- u.c[0] = v[0];
- u.c[1] = v[1];
- u.c[2] = v[2];
- u.c[3] = v[3];
- m_v = u.v;
- }
-
- Vec4( float x, float y, float z, float w )
- {
- union { vector float v; float c[4]; } u;
- u.c[0] = x;
- u.c[1] = y;
- u.c[2] = z;
- u.c[3] = w;
- m_v = u.v;
- }
-
- Vec3 GetVec3() const
- {
- union { vector float v; float c[4]; } u;
- u.v = m_v;
- return Vec3( u.c[0], u.c[1], u.c[2] );
- }
-
- Vec4 SplatX() const { return Vec4( vec_splat( m_v, 0 ) ); }
- Vec4 SplatY() const { return Vec4( vec_splat( m_v, 1 ) ); }
- Vec4 SplatZ() const { return Vec4( vec_splat( m_v, 2 ) ); }
- Vec4 SplatW() const { return Vec4( vec_splat( m_v, 3 ) ); }
-
- Vec4& operator+=( Arg v )
- {
- m_v = vec_add( m_v, v.m_v );
- return *this;
- }
-
- Vec4& operator-=( Arg v )
- {
- m_v = vec_sub( m_v, v.m_v );
- return *this;
- }
-
- Vec4& operator*=( Arg v )
- {
- m_v = vec_madd( m_v, v.m_v, ( vector float )( -0.0f ) );
- return *this;
- }
-
- friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( vec_add( left.m_v, right.m_v ) );
- }
-
- friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( vec_sub( left.m_v, right.m_v ) );
- }
-
- friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( vec_madd( left.m_v, right.m_v, ( vector float )( -0.0f ) ) );
- }
-
- //! Returns a*b + c
- friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
- {
- return Vec4( vec_madd( a.m_v, b.m_v, c.m_v ) );
- }
-
- //! Returns -( a*b - c )
- friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
- {
- return Vec4( vec_nmsub( a.m_v, b.m_v, c.m_v ) );
- }
-
- friend Vec4 Reciprocal( Vec4::Arg v )
- {
- // get the reciprocal estimate
- vector float estimate = vec_re( v.m_v );
-
- // one round of Newton-Rhaphson refinement
- vector float diff = vec_nmsub( estimate, v.m_v, ( vector float )( 1.0f ) );
- return Vec4( vec_madd( diff, estimate, estimate ) );
- }
-
- friend Vec4 Min( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( vec_min( left.m_v, right.m_v ) );
- }
-
- friend Vec4 Max( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( vec_max( left.m_v, right.m_v ) );
- }
-
- friend Vec4 Truncate( Vec4::Arg v )
- {
- return Vec4( vec_trunc( v.m_v ) );
- }
-
- friend Vec4 CompareEqual( Vec4::Arg left, Vec4::Arg right )
- {
- return Vec4( ( vector float )vec_cmpeq( left.m_v, right.m_v ) );
- }
-
- friend Vec4 Select( Vec4::Arg off, Vec4::Arg on, Vec4::Arg bits )
- {
- return Vec4( vec_sel( off.m_v, on.m_v, ( vector unsigned int )bits.m_v ) );
- }
-
- friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right )
- {
- return vec_any_lt( left.m_v, right.m_v ) != 0;
- }
-
-private:
- vector float m_v;
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_SIMD_VE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlechannelfit.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlechannelfit.cpp
deleted file mode 100644
index 2abc9a2c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlechannelfit.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
- Copyright (c) 2006 Ignacio Castano castanyo@yahoo.es
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "singlechannelfit.h"
-#include "colourset.h"
-#include "colourblock.h"
-#include <cfloat>
-
-namespace squish {
-
-SingleChannelFit::SingleChannelFit( ColourSet const* colours, int const flags )
- : ColourFit( colours, flags )
-{
- // cache some values
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
-
- // Find bounds of the search space.
- m_g_min = 63;
- m_g_max = 0;
-
- for(uint i = 0; i < count; i++) {
-
- int grey = int(values[i].Y() * 255.0f); // @@ rounding?
- grey = std::min(grey, 255); // clamp to [0, 1)
- grey = std::max(grey, 0);
- m_greys[i] = u8(grey);
-
- m_g_min = std::min(m_g_min, grey >> 2);
- m_g_max = std::max(m_g_max, grey >> 2);
- }
-
- int const g_pad = m_g_max - m_g_min + 1;
-
- m_g_min = std::max(0, m_g_min - g_pad);
- m_g_max = std::min(63, m_g_max + g_pad);
-}
-
-void SingleChannelFit::Compress3( void* block )
-{
- // do not do anything.
-}
-
-void SingleChannelFit::Compress4( void* block )
-{
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
- float const* weights = m_colours->GetWeights();
-
- int best_g0;
- int best_g1;
- float best_error = FLT_MAX;
-
- // Brute force approach, try all the possible endpoints with g0 > g1.
- for(int g0 = m_g_min+1; g0 <= m_g_max; g0++) {
- for(int g1 = m_g_min; g1 < g0; g1++) {
-
- // Compute palette.
- const int c0 = (g0 << 2) | (g0 >> 4);
- const int c1 = (g1 << 2) | (g1 >> 4);
- const int c2 = (2 * c0 + c1) / 3;
- const int c3 = (2 * c1 + c0) / 3;
-
- // Evaluate palette error.
- float error = 0;
- for(int i = 0; i < count; i++) {
- const int grey = m_greys[i];
-
- int min_dist = abs(c0 - grey); // Use absolute distance, not squared.
- min_dist = std::min(min_dist, abs(c1 - grey));
- min_dist = std::min(min_dist, abs(c2 - grey));
- min_dist = std::min(min_dist, abs(c3 - grey));
-
- error += min_dist * weights[i];
- }
-
- if(error < best_error) {
- best_error = error;
- best_g0 = g0;
- best_g1 = g1;
- }
- }
- }
-
- // Compute best palette.
- const int best_c0 = (best_g0 << 2) | (best_g0 >> 4);
- const int best_c1 = (best_g1 << 2) | (best_g1 >> 4);
- const int best_c2 = (2 * best_c0 + best_c1) / 3;
- const int best_c3 = (2 * best_c1 + best_c0) / 3;
-
- // Compute best indices.
- u8 closest[16];
- for(int i = 0; i < count; i++) {
- const int grey = m_greys[i];
-
- int dist = abs(best_c0 - grey);
- int min_dist = dist;
- int min_i = 0;
-
- dist = abs(best_c1 - grey);
- if( dist < min_dist ) { min_dist = dist; min_i = 1; }
-
- dist = abs(best_c2 - grey);
- if( dist < min_dist ) { min_dist = dist; min_i = 2; }
-
- dist = abs(best_c3 - grey);
- if( dist < min_dist ) { min_dist = dist; min_i = 3; }
-
- closest[i] = min_i;
- }
-
- // remap the indices
- u8 indices[16];
- m_colours->RemapIndices( closest, indices );
-
- // Output block.
- WriteColourBlock(best_g0 << 5, best_g1 << 5, indices, block);
-}
-
-
-} // namespace squish
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlechannelfit.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlechannelfit.h
deleted file mode 100644
index 40de0a2a..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlechannelfit.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
- Copyright (c) 2006 Ignacio Castano castanyo@yahoo.es
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_SINGLECHANNELFIT_H
-#define SQUISH_SINGLECHANNELFIT_H
-
-#include <squish.h>
-#include "maths.h"
-#include "colourfit.h"
-
-namespace squish {
-
-class SingleChannelFit : public ColourFit
-{
-public:
- SingleChannelFit( ColourSet const* colours, int flags );
-
-private:
- virtual void Compress3( void* block );
- virtual void Compress4( void* block );
-
-private:
- u8 m_greys[16];
- int m_g_min;
- int m_g_max;
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_SINGLECHANNELFIT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlecolourfit.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlecolourfit.cpp
deleted file mode 100644
index 4e1bb9c3..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlecolourfit.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "singlecolourfit.h"
-#include "colourset.h"
-#include "colourblock.h"
-
-namespace squish {
-
-struct SourceBlock
-{
- u8 start;
- u8 end;
- u8 error;
-};
-
-struct SingleColourLookup
-{
- SourceBlock sources[4];
-};
-
-#include "singlecolourlookup.inl"
-
-static int FloatToInt( float a, int limit )
-{
- // use ANSI round-to-zero behaviour to get round-to-nearest
- int i = ( int )( a + 0.5f );
-
- // clamp to the limit
- if( i < 0 )
- i = 0;
- else if( i > limit )
- i = limit;
-
- // done
- return i;
-}
-
-SingleColourFit::SingleColourFit( ColourSet const* colours, int flags )
- : ColourFit( colours, flags )
-{
- // grab the single colour
- Vec3 const* values = m_colours->GetPoints();
- m_colour[0] = ( u8 )FloatToInt( 255.0f*values->X(), 255 );
- m_colour[1] = ( u8 )FloatToInt( 255.0f*values->Y(), 255 );
- m_colour[2] = ( u8 )FloatToInt( 255.0f*values->Z(), 255 );
-
- // initialise the best error
- m_besterror = INT_MAX;
-}
-
-void SingleColourFit::Compress3( void* block )
-{
- // build the table of lookups
- SingleColourLookup const* const lookups[] =
- {
- lookup_5_3,
- lookup_6_3,
- lookup_5_3
- };
-
- // find the best end-points and index
- ComputeEndPoints( 3, lookups );
-
- // build the block if we win
- if( m_error < m_besterror )
- {
- // remap the indices
- u8 indices[16];
- m_colours->RemapIndices( &m_index, indices );
-
- // save the block
- WriteColourBlock3( m_start, m_end, indices, block );
-
- // save the error
- m_besterror = m_error;
- }
-}
-
-void SingleColourFit::Compress4( void* block )
-{
- // build the table of lookups
- SingleColourLookup const* const lookups[] =
- {
- lookup_5_4,
- lookup_6_4,
- lookup_5_4
- };
-
- // find the best end-points and index
- ComputeEndPoints( 4, lookups );
-
- // build the block if we win
- if( m_error < m_besterror )
- {
- // remap the indices
- u8 indices[16];
- m_colours->RemapIndices( &m_index, indices );
-
- // save the block
- WriteColourBlock4( m_start, m_end, indices, block );
-
- // save the error
- m_besterror = m_error;
- }
-}
-
-void SingleColourFit::ComputeEndPoints( int count, SingleColourLookup const* const* lookups )
-{
- // check each index combination
- m_error = INT_MAX;
- for( int index = 0; index < count; ++index )
- {
- // check the error for this codebook index
- SourceBlock const* sources[3];
- int error = 0;
- for( int channel = 0; channel < 3; ++channel )
- {
- // grab the lookup table and index for this channel
- SingleColourLookup const* lookup = lookups[channel];
- int target = m_colour[channel];
-
- // store a pointer to the source for this channel
- sources[channel] = lookup[target].sources + index;
-
- // accumulate the error
- int diff = sources[channel]->error;
- error += diff*diff;
- }
-
- // keep it if the error is lower
- if( error < m_error )
- {
- m_start = Vec3(
- ( float )sources[0]->start/31.0f,
- ( float )sources[1]->start/63.0f,
- ( float )sources[2]->start/31.0f
- );
- m_end = Vec3(
- ( float )sources[0]->end/31.0f,
- ( float )sources[1]->end/63.0f,
- ( float )sources[2]->end/31.0f
- );
- m_index = ( u8 )index;
- m_error = error;
- }
- }
-}
-
-} // namespace squish
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlecolourfit.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlecolourfit.h
deleted file mode 100644
index 3c4a1a38..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlecolourfit.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef SQUISH_SINGLECOLOURFIT_H
-#define SQUISH_SINGLECOLOURFIT_H
-
-#include <squish.h>
-#include "colourfit.h"
-
-namespace squish {
-
-class ColourSet;
-struct SingleColourLookup;
-
-class SingleColourFit : public ColourFit
-{
-public:
- SingleColourFit( ColourSet const* colours, int flags );
-
-private:
- virtual void Compress3( void* block );
- virtual void Compress4( void* block );
-
- void ComputeEndPoints( int count, SingleColourLookup const* const* lookups );
-
- u8 m_colour[3];
- Vec3 m_start;
- Vec3 m_end;
- u8 m_index;
- int m_error;
- int m_besterror;
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_SINGLECOLOURFIT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlecolourlookup.inl b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlecolourlookup.inl
deleted file mode 100644
index 52800a82..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/singlecolourlookup.inl
+++ /dev/null
@@ -1,1040 +0,0 @@
-
-static SingleColourLookup const lookup_5_3[] =
-{
- { { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } } },
- { { { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 0 } } },
- { { { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 0 } } },
- { { { 0, 0, 3 }, { 0, 0, 3 }, { 0, 1, 1 }, { 0, 0, 0 } } },
- { { { 0, 0, 4 }, { 0, 0, 4 }, { 0, 1, 0 }, { 0, 0, 0 } } },
- { { { 1, 0, 3 }, { 0, 1, 3 }, { 0, 1, 1 }, { 0, 0, 0 } } },
- { { { 1, 0, 2 }, { 0, 1, 2 }, { 0, 1, 2 }, { 0, 0, 0 } } },
- { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 2, 1 }, { 0, 0, 0 } } },
- { { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 2, 0 }, { 0, 0, 0 } } },
- { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 2, 1 }, { 0, 0, 0 } } },
- { { { 1, 0, 2 }, { 0, 1, 2 }, { 0, 2, 2 }, { 0, 0, 0 } } },
- { { { 1, 0, 3 }, { 0, 1, 3 }, { 0, 3, 1 }, { 0, 0, 0 } } },
- { { { 1, 0, 4 }, { 0, 1, 4 }, { 0, 3, 0 }, { 0, 0, 0 } } },
- { { { 2, 0, 3 }, { 0, 2, 3 }, { 0, 3, 1 }, { 0, 0, 0 } } },
- { { { 2, 0, 2 }, { 0, 2, 2 }, { 0, 3, 2 }, { 0, 0, 0 } } },
- { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 4, 1 }, { 0, 0, 0 } } },
- { { { 2, 0, 0 }, { 0, 2, 0 }, { 0, 4, 0 }, { 0, 0, 0 } } },
- { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 4, 1 }, { 0, 0, 0 } } },
- { { { 2, 0, 2 }, { 0, 2, 2 }, { 0, 4, 2 }, { 0, 0, 0 } } },
- { { { 2, 0, 3 }, { 0, 2, 3 }, { 0, 5, 1 }, { 0, 0, 0 } } },
- { { { 2, 0, 4 }, { 0, 2, 4 }, { 0, 5, 0 }, { 0, 0, 0 } } },
- { { { 3, 0, 3 }, { 0, 3, 3 }, { 0, 5, 1 }, { 0, 0, 0 } } },
- { { { 3, 0, 2 }, { 0, 3, 2 }, { 0, 5, 2 }, { 0, 0, 0 } } },
- { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 6, 1 }, { 0, 0, 0 } } },
- { { { 3, 0, 0 }, { 0, 3, 0 }, { 0, 6, 0 }, { 0, 0, 0 } } },
- { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 6, 1 }, { 0, 0, 0 } } },
- { { { 3, 0, 2 }, { 0, 3, 2 }, { 0, 6, 2 }, { 0, 0, 0 } } },
- { { { 3, 0, 3 }, { 0, 3, 3 }, { 0, 7, 1 }, { 0, 0, 0 } } },
- { { { 3, 0, 4 }, { 0, 3, 4 }, { 0, 7, 0 }, { 0, 0, 0 } } },
- { { { 4, 0, 4 }, { 0, 4, 4 }, { 0, 7, 1 }, { 0, 0, 0 } } },
- { { { 4, 0, 3 }, { 0, 4, 3 }, { 0, 7, 2 }, { 0, 0, 0 } } },
- { { { 4, 0, 2 }, { 0, 4, 2 }, { 1, 7, 1 }, { 0, 0, 0 } } },
- { { { 4, 0, 1 }, { 0, 4, 1 }, { 1, 7, 0 }, { 0, 0, 0 } } },
- { { { 4, 0, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 0, 0 } } },
- { { { 4, 0, 1 }, { 0, 4, 1 }, { 0, 8, 1 }, { 0, 0, 0 } } },
- { { { 4, 0, 2 }, { 0, 4, 2 }, { 2, 7, 1 }, { 0, 0, 0 } } },
- { { { 4, 0, 3 }, { 0, 4, 3 }, { 2, 7, 0 }, { 0, 0, 0 } } },
- { { { 4, 0, 4 }, { 0, 4, 4 }, { 0, 9, 0 }, { 0, 0, 0 } } },
- { { { 5, 0, 3 }, { 0, 5, 3 }, { 0, 9, 1 }, { 0, 0, 0 } } },
- { { { 5, 0, 2 }, { 0, 5, 2 }, { 3, 7, 1 }, { 0, 0, 0 } } },
- { { { 5, 0, 1 }, { 0, 5, 1 }, { 3, 7, 0 }, { 0, 0, 0 } } },
- { { { 5, 0, 0 }, { 0, 5, 0 }, { 0, 10, 0 }, { 0, 0, 0 } } },
- { { { 5, 0, 1 }, { 0, 5, 1 }, { 0, 10, 1 }, { 0, 0, 0 } } },
- { { { 5, 0, 2 }, { 0, 5, 2 }, { 0, 10, 2 }, { 0, 0, 0 } } },
- { { { 5, 0, 3 }, { 0, 5, 3 }, { 0, 11, 1 }, { 0, 0, 0 } } },
- { { { 5, 0, 4 }, { 0, 5, 4 }, { 0, 11, 0 }, { 0, 0, 0 } } },
- { { { 6, 0, 3 }, { 0, 6, 3 }, { 0, 11, 1 }, { 0, 0, 0 } } },
- { { { 6, 0, 2 }, { 0, 6, 2 }, { 0, 11, 2 }, { 0, 0, 0 } } },
- { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 12, 1 }, { 0, 0, 0 } } },
- { { { 6, 0, 0 }, { 0, 6, 0 }, { 0, 12, 0 }, { 0, 0, 0 } } },
- { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 12, 1 }, { 0, 0, 0 } } },
- { { { 6, 0, 2 }, { 0, 6, 2 }, { 0, 12, 2 }, { 0, 0, 0 } } },
- { { { 6, 0, 3 }, { 0, 6, 3 }, { 0, 13, 1 }, { 0, 0, 0 } } },
- { { { 6, 0, 4 }, { 0, 6, 4 }, { 0, 13, 0 }, { 0, 0, 0 } } },
- { { { 7, 0, 3 }, { 0, 7, 3 }, { 0, 13, 1 }, { 0, 0, 0 } } },
- { { { 7, 0, 2 }, { 0, 7, 2 }, { 0, 13, 2 }, { 0, 0, 0 } } },
- { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 14, 1 }, { 0, 0, 0 } } },
- { { { 7, 0, 0 }, { 0, 7, 0 }, { 0, 14, 0 }, { 0, 0, 0 } } },
- { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 14, 1 }, { 0, 0, 0 } } },
- { { { 7, 0, 2 }, { 0, 7, 2 }, { 0, 14, 2 }, { 0, 0, 0 } } },
- { { { 7, 0, 3 }, { 0, 7, 3 }, { 0, 15, 1 }, { 0, 0, 0 } } },
- { { { 7, 0, 4 }, { 0, 7, 4 }, { 0, 15, 0 }, { 0, 0, 0 } } },
- { { { 8, 0, 4 }, { 0, 8, 4 }, { 0, 15, 1 }, { 0, 0, 0 } } },
- { { { 8, 0, 3 }, { 0, 8, 3 }, { 0, 15, 2 }, { 0, 0, 0 } } },
- { { { 8, 0, 2 }, { 0, 8, 2 }, { 1, 15, 1 }, { 0, 0, 0 } } },
- { { { 8, 0, 1 }, { 0, 8, 1 }, { 1, 15, 0 }, { 0, 0, 0 } } },
- { { { 8, 0, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 0, 0 } } },
- { { { 8, 0, 1 }, { 0, 8, 1 }, { 0, 16, 1 }, { 0, 0, 0 } } },
- { { { 8, 0, 2 }, { 0, 8, 2 }, { 2, 15, 1 }, { 0, 0, 0 } } },
- { { { 8, 0, 3 }, { 0, 8, 3 }, { 2, 15, 0 }, { 0, 0, 0 } } },
- { { { 8, 0, 4 }, { 0, 8, 4 }, { 0, 17, 0 }, { 0, 0, 0 } } },
- { { { 9, 0, 3 }, { 0, 9, 3 }, { 0, 17, 1 }, { 0, 0, 0 } } },
- { { { 9, 0, 2 }, { 0, 9, 2 }, { 3, 15, 1 }, { 0, 0, 0 } } },
- { { { 9, 0, 1 }, { 0, 9, 1 }, { 3, 15, 0 }, { 0, 0, 0 } } },
- { { { 9, 0, 0 }, { 0, 9, 0 }, { 0, 18, 0 }, { 0, 0, 0 } } },
- { { { 9, 0, 1 }, { 0, 9, 1 }, { 0, 18, 1 }, { 0, 0, 0 } } },
- { { { 9, 0, 2 }, { 0, 9, 2 }, { 0, 18, 2 }, { 0, 0, 0 } } },
- { { { 9, 0, 3 }, { 0, 9, 3 }, { 0, 19, 1 }, { 0, 0, 0 } } },
- { { { 9, 0, 4 }, { 0, 9, 4 }, { 0, 19, 0 }, { 0, 0, 0 } } },
- { { { 10, 0, 3 }, { 0, 10, 3 }, { 0, 19, 1 }, { 0, 0, 0 } } },
- { { { 10, 0, 2 }, { 0, 10, 2 }, { 0, 19, 2 }, { 0, 0, 0 } } },
- { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 20, 1 }, { 0, 0, 0 } } },
- { { { 10, 0, 0 }, { 0, 10, 0 }, { 0, 20, 0 }, { 0, 0, 0 } } },
- { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 20, 1 }, { 0, 0, 0 } } },
- { { { 10, 0, 2 }, { 0, 10, 2 }, { 0, 20, 2 }, { 0, 0, 0 } } },
- { { { 10, 0, 3 }, { 0, 10, 3 }, { 0, 21, 1 }, { 0, 0, 0 } } },
- { { { 10, 0, 4 }, { 0, 10, 4 }, { 0, 21, 0 }, { 0, 0, 0 } } },
- { { { 11, 0, 3 }, { 0, 11, 3 }, { 0, 21, 1 }, { 0, 0, 0 } } },
- { { { 11, 0, 2 }, { 0, 11, 2 }, { 0, 21, 2 }, { 0, 0, 0 } } },
- { { { 11, 0, 1 }, { 0, 11, 1 }, { 0, 22, 1 }, { 0, 0, 0 } } },
- { { { 11, 0, 0 }, { 0, 11, 0 }, { 0, 22, 0 }, { 0, 0, 0 } } },
- { { { 11, 0, 1 }, { 0, 11, 1 }, { 0, 22, 1 }, { 0, 0, 0 } } },
- { { { 11, 0, 2 }, { 0, 11, 2 }, { 0, 22, 2 }, { 0, 0, 0 } } },
- { { { 11, 0, 3 }, { 0, 11, 3 }, { 0, 23, 1 }, { 0, 0, 0 } } },
- { { { 11, 0, 4 }, { 0, 11, 4 }, { 0, 23, 0 }, { 0, 0, 0 } } },
- { { { 12, 0, 4 }, { 0, 12, 4 }, { 0, 23, 1 }, { 0, 0, 0 } } },
- { { { 12, 0, 3 }, { 0, 12, 3 }, { 0, 23, 2 }, { 0, 0, 0 } } },
- { { { 12, 0, 2 }, { 0, 12, 2 }, { 1, 23, 1 }, { 0, 0, 0 } } },
- { { { 12, 0, 1 }, { 0, 12, 1 }, { 1, 23, 0 }, { 0, 0, 0 } } },
- { { { 12, 0, 0 }, { 0, 12, 0 }, { 0, 24, 0 }, { 0, 0, 0 } } },
- { { { 12, 0, 1 }, { 0, 12, 1 }, { 0, 24, 1 }, { 0, 0, 0 } } },
- { { { 12, 0, 2 }, { 0, 12, 2 }, { 2, 23, 1 }, { 0, 0, 0 } } },
- { { { 12, 0, 3 }, { 0, 12, 3 }, { 2, 23, 0 }, { 0, 0, 0 } } },
- { { { 12, 0, 4 }, { 0, 12, 4 }, { 0, 25, 0 }, { 0, 0, 0 } } },
- { { { 13, 0, 3 }, { 0, 13, 3 }, { 0, 25, 1 }, { 0, 0, 0 } } },
- { { { 13, 0, 2 }, { 0, 13, 2 }, { 3, 23, 1 }, { 0, 0, 0 } } },
- { { { 13, 0, 1 }, { 0, 13, 1 }, { 3, 23, 0 }, { 0, 0, 0 } } },
- { { { 13, 0, 0 }, { 0, 13, 0 }, { 0, 26, 0 }, { 0, 0, 0 } } },
- { { { 13, 0, 1 }, { 0, 13, 1 }, { 0, 26, 1 }, { 0, 0, 0 } } },
- { { { 13, 0, 2 }, { 0, 13, 2 }, { 0, 26, 2 }, { 0, 0, 0 } } },
- { { { 13, 0, 3 }, { 0, 13, 3 }, { 0, 27, 1 }, { 0, 0, 0 } } },
- { { { 13, 0, 4 }, { 0, 13, 4 }, { 0, 27, 0 }, { 0, 0, 0 } } },
- { { { 14, 0, 3 }, { 0, 14, 3 }, { 0, 27, 1 }, { 0, 0, 0 } } },
- { { { 14, 0, 2 }, { 0, 14, 2 }, { 0, 27, 2 }, { 0, 0, 0 } } },
- { { { 14, 0, 1 }, { 0, 14, 1 }, { 0, 28, 1 }, { 0, 0, 0 } } },
- { { { 14, 0, 0 }, { 0, 14, 0 }, { 0, 28, 0 }, { 0, 0, 0 } } },
- { { { 14, 0, 1 }, { 0, 14, 1 }, { 0, 28, 1 }, { 0, 0, 0 } } },
- { { { 14, 0, 2 }, { 0, 14, 2 }, { 0, 28, 2 }, { 0, 0, 0 } } },
- { { { 14, 0, 3 }, { 0, 14, 3 }, { 0, 29, 1 }, { 0, 0, 0 } } },
- { { { 14, 0, 4 }, { 0, 14, 4 }, { 0, 29, 0 }, { 0, 0, 0 } } },
- { { { 15, 0, 3 }, { 0, 15, 3 }, { 0, 29, 1 }, { 0, 0, 0 } } },
- { { { 15, 0, 2 }, { 0, 15, 2 }, { 0, 29, 2 }, { 0, 0, 0 } } },
- { { { 15, 0, 1 }, { 0, 15, 1 }, { 0, 30, 1 }, { 0, 0, 0 } } },
- { { { 15, 0, 0 }, { 0, 15, 0 }, { 0, 30, 0 }, { 0, 0, 0 } } },
- { { { 15, 0, 1 }, { 0, 15, 1 }, { 0, 30, 1 }, { 0, 0, 0 } } },
- { { { 15, 0, 2 }, { 0, 15, 2 }, { 0, 30, 2 }, { 0, 0, 0 } } },
- { { { 15, 0, 3 }, { 0, 15, 3 }, { 0, 31, 1 }, { 0, 0, 0 } } },
- { { { 15, 0, 4 }, { 0, 15, 4 }, { 0, 31, 0 }, { 0, 0, 0 } } },
- { { { 16, 0, 4 }, { 0, 16, 4 }, { 0, 31, 1 }, { 0, 0, 0 } } },
- { { { 16, 0, 3 }, { 0, 16, 3 }, { 0, 31, 2 }, { 0, 0, 0 } } },
- { { { 16, 0, 2 }, { 0, 16, 2 }, { 1, 31, 1 }, { 0, 0, 0 } } },
- { { { 16, 0, 1 }, { 0, 16, 1 }, { 1, 31, 0 }, { 0, 0, 0 } } },
- { { { 16, 0, 0 }, { 0, 16, 0 }, { 4, 28, 0 }, { 0, 0, 0 } } },
- { { { 16, 0, 1 }, { 0, 16, 1 }, { 4, 28, 1 }, { 0, 0, 0 } } },
- { { { 16, 0, 2 }, { 0, 16, 2 }, { 2, 31, 1 }, { 0, 0, 0 } } },
- { { { 16, 0, 3 }, { 0, 16, 3 }, { 2, 31, 0 }, { 0, 0, 0 } } },
- { { { 16, 0, 4 }, { 0, 16, 4 }, { 4, 29, 0 }, { 0, 0, 0 } } },
- { { { 17, 0, 3 }, { 0, 17, 3 }, { 4, 29, 1 }, { 0, 0, 0 } } },
- { { { 17, 0, 2 }, { 0, 17, 2 }, { 3, 31, 1 }, { 0, 0, 0 } } },
- { { { 17, 0, 1 }, { 0, 17, 1 }, { 3, 31, 0 }, { 0, 0, 0 } } },
- { { { 17, 0, 0 }, { 0, 17, 0 }, { 4, 30, 0 }, { 0, 0, 0 } } },
- { { { 17, 0, 1 }, { 0, 17, 1 }, { 4, 30, 1 }, { 0, 0, 0 } } },
- { { { 17, 0, 2 }, { 0, 17, 2 }, { 4, 30, 2 }, { 0, 0, 0 } } },
- { { { 17, 0, 3 }, { 0, 17, 3 }, { 4, 31, 1 }, { 0, 0, 0 } } },
- { { { 17, 0, 4 }, { 0, 17, 4 }, { 4, 31, 0 }, { 0, 0, 0 } } },
- { { { 18, 0, 3 }, { 0, 18, 3 }, { 4, 31, 1 }, { 0, 0, 0 } } },
- { { { 18, 0, 2 }, { 0, 18, 2 }, { 4, 31, 2 }, { 0, 0, 0 } } },
- { { { 18, 0, 1 }, { 0, 18, 1 }, { 5, 31, 1 }, { 0, 0, 0 } } },
- { { { 18, 0, 0 }, { 0, 18, 0 }, { 5, 31, 0 }, { 0, 0, 0 } } },
- { { { 18, 0, 1 }, { 0, 18, 1 }, { 5, 31, 1 }, { 0, 0, 0 } } },
- { { { 18, 0, 2 }, { 0, 18, 2 }, { 5, 31, 2 }, { 0, 0, 0 } } },
- { { { 18, 0, 3 }, { 0, 18, 3 }, { 6, 31, 1 }, { 0, 0, 0 } } },
- { { { 18, 0, 4 }, { 0, 18, 4 }, { 6, 31, 0 }, { 0, 0, 0 } } },
- { { { 19, 0, 3 }, { 0, 19, 3 }, { 6, 31, 1 }, { 0, 0, 0 } } },
- { { { 19, 0, 2 }, { 0, 19, 2 }, { 6, 31, 2 }, { 0, 0, 0 } } },
- { { { 19, 0, 1 }, { 0, 19, 1 }, { 7, 31, 1 }, { 0, 0, 0 } } },
- { { { 19, 0, 0 }, { 0, 19, 0 }, { 7, 31, 0 }, { 0, 0, 0 } } },
- { { { 19, 0, 1 }, { 0, 19, 1 }, { 7, 31, 1 }, { 0, 0, 0 } } },
- { { { 19, 0, 2 }, { 0, 19, 2 }, { 7, 31, 2 }, { 0, 0, 0 } } },
- { { { 19, 0, 3 }, { 0, 19, 3 }, { 8, 31, 1 }, { 0, 0, 0 } } },
- { { { 19, 0, 4 }, { 0, 19, 4 }, { 8, 31, 0 }, { 0, 0, 0 } } },
- { { { 20, 0, 4 }, { 0, 20, 4 }, { 8, 31, 1 }, { 0, 0, 0 } } },
- { { { 20, 0, 3 }, { 0, 20, 3 }, { 8, 31, 2 }, { 0, 0, 0 } } },
- { { { 20, 0, 2 }, { 0, 20, 2 }, { 9, 31, 1 }, { 0, 0, 0 } } },
- { { { 20, 0, 1 }, { 0, 20, 1 }, { 9, 31, 0 }, { 0, 0, 0 } } },
- { { { 20, 0, 0 }, { 0, 20, 0 }, { 12, 28, 0 }, { 0, 0, 0 } } },
- { { { 20, 0, 1 }, { 0, 20, 1 }, { 12, 28, 1 }, { 0, 0, 0 } } },
- { { { 20, 0, 2 }, { 0, 20, 2 }, { 10, 31, 1 }, { 0, 0, 0 } } },
- { { { 20, 0, 3 }, { 0, 20, 3 }, { 10, 31, 0 }, { 0, 0, 0 } } },
- { { { 20, 0, 4 }, { 0, 20, 4 }, { 12, 29, 0 }, { 0, 0, 0 } } },
- { { { 21, 0, 3 }, { 0, 21, 3 }, { 12, 29, 1 }, { 0, 0, 0 } } },
- { { { 21, 0, 2 }, { 0, 21, 2 }, { 11, 31, 1 }, { 0, 0, 0 } } },
- { { { 21, 0, 1 }, { 0, 21, 1 }, { 11, 31, 0 }, { 0, 0, 0 } } },
- { { { 21, 0, 0 }, { 0, 21, 0 }, { 12, 30, 0 }, { 0, 0, 0 } } },
- { { { 21, 0, 1 }, { 0, 21, 1 }, { 12, 30, 1 }, { 0, 0, 0 } } },
- { { { 21, 0, 2 }, { 0, 21, 2 }, { 12, 30, 2 }, { 0, 0, 0 } } },
- { { { 21, 0, 3 }, { 0, 21, 3 }, { 12, 31, 1 }, { 0, 0, 0 } } },
- { { { 21, 0, 4 }, { 0, 21, 4 }, { 12, 31, 0 }, { 0, 0, 0 } } },
- { { { 22, 0, 3 }, { 0, 22, 3 }, { 12, 31, 1 }, { 0, 0, 0 } } },
- { { { 22, 0, 2 }, { 0, 22, 2 }, { 12, 31, 2 }, { 0, 0, 0 } } },
- { { { 22, 0, 1 }, { 0, 22, 1 }, { 13, 31, 1 }, { 0, 0, 0 } } },
- { { { 22, 0, 0 }, { 0, 22, 0 }, { 13, 31, 0 }, { 0, 0, 0 } } },
- { { { 22, 0, 1 }, { 0, 22, 1 }, { 13, 31, 1 }, { 0, 0, 0 } } },
- { { { 22, 0, 2 }, { 0, 22, 2 }, { 13, 31, 2 }, { 0, 0, 0 } } },
- { { { 22, 0, 3 }, { 0, 22, 3 }, { 14, 31, 1 }, { 0, 0, 0 } } },
- { { { 22, 0, 4 }, { 0, 22, 4 }, { 14, 31, 0 }, { 0, 0, 0 } } },
- { { { 23, 0, 3 }, { 0, 23, 3 }, { 14, 31, 1 }, { 0, 0, 0 } } },
- { { { 23, 0, 2 }, { 0, 23, 2 }, { 14, 31, 2 }, { 0, 0, 0 } } },
- { { { 23, 0, 1 }, { 0, 23, 1 }, { 15, 31, 1 }, { 0, 0, 0 } } },
- { { { 23, 0, 0 }, { 0, 23, 0 }, { 15, 31, 0 }, { 0, 0, 0 } } },
- { { { 23, 0, 1 }, { 0, 23, 1 }, { 15, 31, 1 }, { 0, 0, 0 } } },
- { { { 23, 0, 2 }, { 0, 23, 2 }, { 15, 31, 2 }, { 0, 0, 0 } } },
- { { { 23, 0, 3 }, { 0, 23, 3 }, { 16, 31, 1 }, { 0, 0, 0 } } },
- { { { 23, 0, 4 }, { 0, 23, 4 }, { 16, 31, 0 }, { 0, 0, 0 } } },
- { { { 24, 0, 4 }, { 0, 24, 4 }, { 16, 31, 1 }, { 0, 0, 0 } } },
- { { { 24, 0, 3 }, { 0, 24, 3 }, { 16, 31, 2 }, { 0, 0, 0 } } },
- { { { 24, 0, 2 }, { 0, 24, 2 }, { 17, 31, 1 }, { 0, 0, 0 } } },
- { { { 24, 0, 1 }, { 0, 24, 1 }, { 17, 31, 0 }, { 0, 0, 0 } } },
- { { { 24, 0, 0 }, { 0, 24, 0 }, { 20, 28, 0 }, { 0, 0, 0 } } },
- { { { 24, 0, 1 }, { 0, 24, 1 }, { 20, 28, 1 }, { 0, 0, 0 } } },
- { { { 24, 0, 2 }, { 0, 24, 2 }, { 18, 31, 1 }, { 0, 0, 0 } } },
- { { { 24, 0, 3 }, { 0, 24, 3 }, { 18, 31, 0 }, { 0, 0, 0 } } },
- { { { 24, 0, 4 }, { 0, 24, 4 }, { 20, 29, 0 }, { 0, 0, 0 } } },
- { { { 25, 0, 3 }, { 0, 25, 3 }, { 20, 29, 1 }, { 0, 0, 0 } } },
- { { { 25, 0, 2 }, { 0, 25, 2 }, { 19, 31, 1 }, { 0, 0, 0 } } },
- { { { 25, 0, 1 }, { 0, 25, 1 }, { 19, 31, 0 }, { 0, 0, 0 } } },
- { { { 25, 0, 0 }, { 0, 25, 0 }, { 20, 30, 0 }, { 0, 0, 0 } } },
- { { { 25, 0, 1 }, { 0, 25, 1 }, { 20, 30, 1 }, { 0, 0, 0 } } },
- { { { 25, 0, 2 }, { 0, 25, 2 }, { 20, 30, 2 }, { 0, 0, 0 } } },
- { { { 25, 0, 3 }, { 0, 25, 3 }, { 20, 31, 1 }, { 0, 0, 0 } } },
- { { { 25, 0, 4 }, { 0, 25, 4 }, { 20, 31, 0 }, { 0, 0, 0 } } },
- { { { 26, 0, 3 }, { 0, 26, 3 }, { 20, 31, 1 }, { 0, 0, 0 } } },
- { { { 26, 0, 2 }, { 0, 26, 2 }, { 20, 31, 2 }, { 0, 0, 0 } } },
- { { { 26, 0, 1 }, { 0, 26, 1 }, { 21, 31, 1 }, { 0, 0, 0 } } },
- { { { 26, 0, 0 }, { 0, 26, 0 }, { 21, 31, 0 }, { 0, 0, 0 } } },
- { { { 26, 0, 1 }, { 0, 26, 1 }, { 21, 31, 1 }, { 0, 0, 0 } } },
- { { { 26, 0, 2 }, { 0, 26, 2 }, { 21, 31, 2 }, { 0, 0, 0 } } },
- { { { 26, 0, 3 }, { 0, 26, 3 }, { 22, 31, 1 }, { 0, 0, 0 } } },
- { { { 26, 0, 4 }, { 0, 26, 4 }, { 22, 31, 0 }, { 0, 0, 0 } } },
- { { { 27, 0, 3 }, { 0, 27, 3 }, { 22, 31, 1 }, { 0, 0, 0 } } },
- { { { 27, 0, 2 }, { 0, 27, 2 }, { 22, 31, 2 }, { 0, 0, 0 } } },
- { { { 27, 0, 1 }, { 0, 27, 1 }, { 23, 31, 1 }, { 0, 0, 0 } } },
- { { { 27, 0, 0 }, { 0, 27, 0 }, { 23, 31, 0 }, { 0, 0, 0 } } },
- { { { 27, 0, 1 }, { 0, 27, 1 }, { 23, 31, 1 }, { 0, 0, 0 } } },
- { { { 27, 0, 2 }, { 0, 27, 2 }, { 23, 31, 2 }, { 0, 0, 0 } } },
- { { { 27, 0, 3 }, { 0, 27, 3 }, { 24, 31, 1 }, { 0, 0, 0 } } },
- { { { 27, 0, 4 }, { 0, 27, 4 }, { 24, 31, 0 }, { 0, 0, 0 } } },
- { { { 28, 0, 4 }, { 0, 28, 4 }, { 24, 31, 1 }, { 0, 0, 0 } } },
- { { { 28, 0, 3 }, { 0, 28, 3 }, { 24, 31, 2 }, { 0, 0, 0 } } },
- { { { 28, 0, 2 }, { 0, 28, 2 }, { 25, 31, 1 }, { 0, 0, 0 } } },
- { { { 28, 0, 1 }, { 0, 28, 1 }, { 25, 31, 0 }, { 0, 0, 0 } } },
- { { { 28, 0, 0 }, { 0, 28, 0 }, { 28, 28, 0 }, { 0, 0, 0 } } },
- { { { 28, 0, 1 }, { 0, 28, 1 }, { 28, 28, 1 }, { 0, 0, 0 } } },
- { { { 28, 0, 2 }, { 0, 28, 2 }, { 26, 31, 1 }, { 0, 0, 0 } } },
- { { { 28, 0, 3 }, { 0, 28, 3 }, { 26, 31, 0 }, { 0, 0, 0 } } },
- { { { 28, 0, 4 }, { 0, 28, 4 }, { 28, 29, 0 }, { 0, 0, 0 } } },
- { { { 29, 0, 3 }, { 0, 29, 3 }, { 28, 29, 1 }, { 0, 0, 0 } } },
- { { { 29, 0, 2 }, { 0, 29, 2 }, { 27, 31, 1 }, { 0, 0, 0 } } },
- { { { 29, 0, 1 }, { 0, 29, 1 }, { 27, 31, 0 }, { 0, 0, 0 } } },
- { { { 29, 0, 0 }, { 0, 29, 0 }, { 28, 30, 0 }, { 0, 0, 0 } } },
- { { { 29, 0, 1 }, { 0, 29, 1 }, { 28, 30, 1 }, { 0, 0, 0 } } },
- { { { 29, 0, 2 }, { 0, 29, 2 }, { 28, 30, 2 }, { 0, 0, 0 } } },
- { { { 29, 0, 3 }, { 0, 29, 3 }, { 28, 31, 1 }, { 0, 0, 0 } } },
- { { { 29, 0, 4 }, { 0, 29, 4 }, { 28, 31, 0 }, { 0, 0, 0 } } },
- { { { 30, 0, 3 }, { 0, 30, 3 }, { 28, 31, 1 }, { 0, 0, 0 } } },
- { { { 30, 0, 2 }, { 0, 30, 2 }, { 28, 31, 2 }, { 0, 0, 0 } } },
- { { { 30, 0, 1 }, { 0, 30, 1 }, { 29, 31, 1 }, { 0, 0, 0 } } },
- { { { 30, 0, 0 }, { 0, 30, 0 }, { 29, 31, 0 }, { 0, 0, 0 } } },
- { { { 30, 0, 1 }, { 0, 30, 1 }, { 29, 31, 1 }, { 0, 0, 0 } } },
- { { { 30, 0, 2 }, { 0, 30, 2 }, { 29, 31, 2 }, { 0, 0, 0 } } },
- { { { 30, 0, 3 }, { 0, 30, 3 }, { 30, 31, 1 }, { 0, 0, 0 } } },
- { { { 30, 0, 4 }, { 0, 30, 4 }, { 30, 31, 0 }, { 0, 0, 0 } } },
- { { { 31, 0, 3 }, { 0, 31, 3 }, { 30, 31, 1 }, { 0, 0, 0 } } },
- { { { 31, 0, 2 }, { 0, 31, 2 }, { 30, 31, 2 }, { 0, 0, 0 } } },
- { { { 31, 0, 1 }, { 0, 31, 1 }, { 31, 31, 1 }, { 0, 0, 0 } } },
- { { { 31, 0, 0 }, { 0, 31, 0 }, { 31, 31, 0 }, { 0, 0, 0 } } }
-};
-
-static SingleColourLookup const lookup_6_3[] =
-{
- { { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } } },
- { { { 0, 0, 1 }, { 0, 0, 1 }, { 0, 1, 1 }, { 0, 0, 0 } } },
- { { { 0, 0, 2 }, { 0, 0, 2 }, { 0, 1, 0 }, { 0, 0, 0 } } },
- { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 2, 1 }, { 0, 0, 0 } } },
- { { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 2, 0 }, { 0, 0, 0 } } },
- { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 3, 1 }, { 0, 0, 0 } } },
- { { { 1, 0, 2 }, { 0, 1, 2 }, { 0, 3, 0 }, { 0, 0, 0 } } },
- { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 4, 1 }, { 0, 0, 0 } } },
- { { { 2, 0, 0 }, { 0, 2, 0 }, { 0, 4, 0 }, { 0, 0, 0 } } },
- { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 5, 1 }, { 0, 0, 0 } } },
- { { { 2, 0, 2 }, { 0, 2, 2 }, { 0, 5, 0 }, { 0, 0, 0 } } },
- { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 6, 1 }, { 0, 0, 0 } } },
- { { { 3, 0, 0 }, { 0, 3, 0 }, { 0, 6, 0 }, { 0, 0, 0 } } },
- { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 7, 1 }, { 0, 0, 0 } } },
- { { { 3, 0, 2 }, { 0, 3, 2 }, { 0, 7, 0 }, { 0, 0, 0 } } },
- { { { 4, 0, 1 }, { 0, 4, 1 }, { 0, 8, 1 }, { 0, 0, 0 } } },
- { { { 4, 0, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 0, 0 } } },
- { { { 4, 0, 1 }, { 0, 4, 1 }, { 0, 9, 1 }, { 0, 0, 0 } } },
- { { { 4, 0, 2 }, { 0, 4, 2 }, { 0, 9, 0 }, { 0, 0, 0 } } },
- { { { 5, 0, 1 }, { 0, 5, 1 }, { 0, 10, 1 }, { 0, 0, 0 } } },
- { { { 5, 0, 0 }, { 0, 5, 0 }, { 0, 10, 0 }, { 0, 0, 0 } } },
- { { { 5, 0, 1 }, { 0, 5, 1 }, { 0, 11, 1 }, { 0, 0, 0 } } },
- { { { 5, 0, 2 }, { 0, 5, 2 }, { 0, 11, 0 }, { 0, 0, 0 } } },
- { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 12, 1 }, { 0, 0, 0 } } },
- { { { 6, 0, 0 }, { 0, 6, 0 }, { 0, 12, 0 }, { 0, 0, 0 } } },
- { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 13, 1 }, { 0, 0, 0 } } },
- { { { 6, 0, 2 }, { 0, 6, 2 }, { 0, 13, 0 }, { 0, 0, 0 } } },
- { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 14, 1 }, { 0, 0, 0 } } },
- { { { 7, 0, 0 }, { 0, 7, 0 }, { 0, 14, 0 }, { 0, 0, 0 } } },
- { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 15, 1 }, { 0, 0, 0 } } },
- { { { 7, 0, 2 }, { 0, 7, 2 }, { 0, 15, 0 }, { 0, 0, 0 } } },
- { { { 8, 0, 1 }, { 0, 8, 1 }, { 0, 16, 1 }, { 0, 0, 0 } } },
- { { { 8, 0, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 0, 0 } } },
- { { { 8, 0, 1 }, { 0, 8, 1 }, { 0, 17, 1 }, { 0, 0, 0 } } },
- { { { 8, 0, 2 }, { 0, 8, 2 }, { 0, 17, 0 }, { 0, 0, 0 } } },
- { { { 9, 0, 1 }, { 0, 9, 1 }, { 0, 18, 1 }, { 0, 0, 0 } } },
- { { { 9, 0, 0 }, { 0, 9, 0 }, { 0, 18, 0 }, { 0, 0, 0 } } },
- { { { 9, 0, 1 }, { 0, 9, 1 }, { 0, 19, 1 }, { 0, 0, 0 } } },
- { { { 9, 0, 2 }, { 0, 9, 2 }, { 0, 19, 0 }, { 0, 0, 0 } } },
- { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 20, 1 }, { 0, 0, 0 } } },
- { { { 10, 0, 0 }, { 0, 10, 0 }, { 0, 20, 0 }, { 0, 0, 0 } } },
- { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 21, 1 }, { 0, 0, 0 } } },
- { { { 10, 0, 2 }, { 0, 10, 2 }, { 0, 21, 0 }, { 0, 0, 0 } } },
- { { { 11, 0, 1 }, { 0, 11, 1 }, { 0, 22, 1 }, { 0, 0, 0 } } },
- { { { 11, 0, 0 }, { 0, 11, 0 }, { 0, 22, 0 }, { 0, 0, 0 } } },
- { { { 11, 0, 1 }, { 0, 11, 1 }, { 0, 23, 1 }, { 0, 0, 0 } } },
- { { { 11, 0, 2 }, { 0, 11, 2 }, { 0, 23, 0 }, { 0, 0, 0 } } },
- { { { 12, 0, 1 }, { 0, 12, 1 }, { 0, 24, 1 }, { 0, 0, 0 } } },
- { { { 12, 0, 0 }, { 0, 12, 0 }, { 0, 24, 0 }, { 0, 0, 0 } } },
- { { { 12, 0, 1 }, { 0, 12, 1 }, { 0, 25, 1 }, { 0, 0, 0 } } },
- { { { 12, 0, 2 }, { 0, 12, 2 }, { 0, 25, 0 }, { 0, 0, 0 } } },
- { { { 13, 0, 1 }, { 0, 13, 1 }, { 0, 26, 1 }, { 0, 0, 0 } } },
- { { { 13, 0, 0 }, { 0, 13, 0 }, { 0, 26, 0 }, { 0, 0, 0 } } },
- { { { 13, 0, 1 }, { 0, 13, 1 }, { 0, 27, 1 }, { 0, 0, 0 } } },
- { { { 13, 0, 2 }, { 0, 13, 2 }, { 0, 27, 0 }, { 0, 0, 0 } } },
- { { { 14, 0, 1 }, { 0, 14, 1 }, { 0, 28, 1 }, { 0, 0, 0 } } },
- { { { 14, 0, 0 }, { 0, 14, 0 }, { 0, 28, 0 }, { 0, 0, 0 } } },
- { { { 14, 0, 1 }, { 0, 14, 1 }, { 0, 29, 1 }, { 0, 0, 0 } } },
- { { { 14, 0, 2 }, { 0, 14, 2 }, { 0, 29, 0 }, { 0, 0, 0 } } },
- { { { 15, 0, 1 }, { 0, 15, 1 }, { 0, 30, 1 }, { 0, 0, 0 } } },
- { { { 15, 0, 0 }, { 0, 15, 0 }, { 0, 30, 0 }, { 0, 0, 0 } } },
- { { { 15, 0, 1 }, { 0, 15, 1 }, { 0, 31, 1 }, { 0, 0, 0 } } },
- { { { 15, 0, 2 }, { 0, 15, 2 }, { 0, 31, 0 }, { 0, 0, 0 } } },
- { { { 16, 0, 2 }, { 0, 16, 2 }, { 1, 31, 1 }, { 0, 0, 0 } } },
- { { { 16, 0, 1 }, { 0, 16, 1 }, { 1, 31, 0 }, { 0, 0, 0 } } },
- { { { 16, 0, 0 }, { 0, 16, 0 }, { 0, 32, 0 }, { 0, 0, 0 } } },
- { { { 16, 0, 1 }, { 0, 16, 1 }, { 2, 31, 0 }, { 0, 0, 0 } } },
- { { { 16, 0, 2 }, { 0, 16, 2 }, { 0, 33, 0 }, { 0, 0, 0 } } },
- { { { 17, 0, 1 }, { 0, 17, 1 }, { 3, 31, 0 }, { 0, 0, 0 } } },
- { { { 17, 0, 0 }, { 0, 17, 0 }, { 0, 34, 0 }, { 0, 0, 0 } } },
- { { { 17, 0, 1 }, { 0, 17, 1 }, { 4, 31, 0 }, { 0, 0, 0 } } },
- { { { 17, 0, 2 }, { 0, 17, 2 }, { 0, 35, 0 }, { 0, 0, 0 } } },
- { { { 18, 0, 1 }, { 0, 18, 1 }, { 5, 31, 0 }, { 0, 0, 0 } } },
- { { { 18, 0, 0 }, { 0, 18, 0 }, { 0, 36, 0 }, { 0, 0, 0 } } },
- { { { 18, 0, 1 }, { 0, 18, 1 }, { 6, 31, 0 }, { 0, 0, 0 } } },
- { { { 18, 0, 2 }, { 0, 18, 2 }, { 0, 37, 0 }, { 0, 0, 0 } } },
- { { { 19, 0, 1 }, { 0, 19, 1 }, { 7, 31, 0 }, { 0, 0, 0 } } },
- { { { 19, 0, 0 }, { 0, 19, 0 }, { 0, 38, 0 }, { 0, 0, 0 } } },
- { { { 19, 0, 1 }, { 0, 19, 1 }, { 8, 31, 0 }, { 0, 0, 0 } } },
- { { { 19, 0, 2 }, { 0, 19, 2 }, { 0, 39, 0 }, { 0, 0, 0 } } },
- { { { 20, 0, 1 }, { 0, 20, 1 }, { 9, 31, 0 }, { 0, 0, 0 } } },
- { { { 20, 0, 0 }, { 0, 20, 0 }, { 0, 40, 0 }, { 0, 0, 0 } } },
- { { { 20, 0, 1 }, { 0, 20, 1 }, { 10, 31, 0 }, { 0, 0, 0 } } },
- { { { 20, 0, 2 }, { 0, 20, 2 }, { 0, 41, 0 }, { 0, 0, 0 } } },
- { { { 21, 0, 1 }, { 0, 21, 1 }, { 11, 31, 0 }, { 0, 0, 0 } } },
- { { { 21, 0, 0 }, { 0, 21, 0 }, { 0, 42, 0 }, { 0, 0, 0 } } },
- { { { 21, 0, 1 }, { 0, 21, 1 }, { 12, 31, 0 }, { 0, 0, 0 } } },
- { { { 21, 0, 2 }, { 0, 21, 2 }, { 0, 43, 0 }, { 0, 0, 0 } } },
- { { { 22, 0, 1 }, { 0, 22, 1 }, { 13, 31, 0 }, { 0, 0, 0 } } },
- { { { 22, 0, 0 }, { 0, 22, 0 }, { 0, 44, 0 }, { 0, 0, 0 } } },
- { { { 22, 0, 1 }, { 0, 22, 1 }, { 14, 31, 0 }, { 0, 0, 0 } } },
- { { { 22, 0, 2 }, { 0, 22, 2 }, { 0, 45, 0 }, { 0, 0, 0 } } },
- { { { 23, 0, 1 }, { 0, 23, 1 }, { 15, 31, 0 }, { 0, 0, 0 } } },
- { { { 23, 0, 0 }, { 0, 23, 0 }, { 0, 46, 0 }, { 0, 0, 0 } } },
- { { { 23, 0, 1 }, { 0, 23, 1 }, { 0, 47, 1 }, { 0, 0, 0 } } },
- { { { 23, 0, 2 }, { 0, 23, 2 }, { 0, 47, 0 }, { 0, 0, 0 } } },
- { { { 24, 0, 1 }, { 0, 24, 1 }, { 0, 48, 1 }, { 0, 0, 0 } } },
- { { { 24, 0, 0 }, { 0, 24, 0 }, { 0, 48, 0 }, { 0, 0, 0 } } },
- { { { 24, 0, 1 }, { 0, 24, 1 }, { 0, 49, 1 }, { 0, 0, 0 } } },
- { { { 24, 0, 2 }, { 0, 24, 2 }, { 0, 49, 0 }, { 0, 0, 0 } } },
- { { { 25, 0, 1 }, { 0, 25, 1 }, { 0, 50, 1 }, { 0, 0, 0 } } },
- { { { 25, 0, 0 }, { 0, 25, 0 }, { 0, 50, 0 }, { 0, 0, 0 } } },
- { { { 25, 0, 1 }, { 0, 25, 1 }, { 0, 51, 1 }, { 0, 0, 0 } } },
- { { { 25, 0, 2 }, { 0, 25, 2 }, { 0, 51, 0 }, { 0, 0, 0 } } },
- { { { 26, 0, 1 }, { 0, 26, 1 }, { 0, 52, 1 }, { 0, 0, 0 } } },
- { { { 26, 0, 0 }, { 0, 26, 0 }, { 0, 52, 0 }, { 0, 0, 0 } } },
- { { { 26, 0, 1 }, { 0, 26, 1 }, { 0, 53, 1 }, { 0, 0, 0 } } },
- { { { 26, 0, 2 }, { 0, 26, 2 }, { 0, 53, 0 }, { 0, 0, 0 } } },
- { { { 27, 0, 1 }, { 0, 27, 1 }, { 0, 54, 1 }, { 0, 0, 0 } } },
- { { { 27, 0, 0 }, { 0, 27, 0 }, { 0, 54, 0 }, { 0, 0, 0 } } },
- { { { 27, 0, 1 }, { 0, 27, 1 }, { 0, 55, 1 }, { 0, 0, 0 } } },
- { { { 27, 0, 2 }, { 0, 27, 2 }, { 0, 55, 0 }, { 0, 0, 0 } } },
- { { { 28, 0, 1 }, { 0, 28, 1 }, { 0, 56, 1 }, { 0, 0, 0 } } },
- { { { 28, 0, 0 }, { 0, 28, 0 }, { 0, 56, 0 }, { 0, 0, 0 } } },
- { { { 28, 0, 1 }, { 0, 28, 1 }, { 0, 57, 1 }, { 0, 0, 0 } } },
- { { { 28, 0, 2 }, { 0, 28, 2 }, { 0, 57, 0 }, { 0, 0, 0 } } },
- { { { 29, 0, 1 }, { 0, 29, 1 }, { 0, 58, 1 }, { 0, 0, 0 } } },
- { { { 29, 0, 0 }, { 0, 29, 0 }, { 0, 58, 0 }, { 0, 0, 0 } } },
- { { { 29, 0, 1 }, { 0, 29, 1 }, { 0, 59, 1 }, { 0, 0, 0 } } },
- { { { 29, 0, 2 }, { 0, 29, 2 }, { 0, 59, 0 }, { 0, 0, 0 } } },
- { { { 30, 0, 1 }, { 0, 30, 1 }, { 0, 60, 1 }, { 0, 0, 0 } } },
- { { { 30, 0, 0 }, { 0, 30, 0 }, { 0, 60, 0 }, { 0, 0, 0 } } },
- { { { 30, 0, 1 }, { 0, 30, 1 }, { 0, 61, 1 }, { 0, 0, 0 } } },
- { { { 30, 0, 2 }, { 0, 30, 2 }, { 0, 61, 0 }, { 0, 0, 0 } } },
- { { { 31, 0, 1 }, { 0, 31, 1 }, { 0, 62, 1 }, { 0, 0, 0 } } },
- { { { 31, 0, 0 }, { 0, 31, 0 }, { 0, 62, 0 }, { 0, 0, 0 } } },
- { { { 31, 0, 1 }, { 0, 31, 1 }, { 0, 63, 1 }, { 0, 0, 0 } } },
- { { { 31, 0, 2 }, { 0, 31, 2 }, { 0, 63, 0 }, { 0, 0, 0 } } },
- { { { 32, 0, 2 }, { 0, 32, 2 }, { 1, 63, 1 }, { 0, 0, 0 } } },
- { { { 32, 0, 1 }, { 0, 32, 1 }, { 1, 63, 0 }, { 0, 0, 0 } } },
- { { { 32, 0, 0 }, { 0, 32, 0 }, { 16, 48, 0 }, { 0, 0, 0 } } },
- { { { 32, 0, 1 }, { 0, 32, 1 }, { 2, 63, 0 }, { 0, 0, 0 } } },
- { { { 32, 0, 2 }, { 0, 32, 2 }, { 16, 49, 0 }, { 0, 0, 0 } } },
- { { { 33, 0, 1 }, { 0, 33, 1 }, { 3, 63, 0 }, { 0, 0, 0 } } },
- { { { 33, 0, 0 }, { 0, 33, 0 }, { 16, 50, 0 }, { 0, 0, 0 } } },
- { { { 33, 0, 1 }, { 0, 33, 1 }, { 4, 63, 0 }, { 0, 0, 0 } } },
- { { { 33, 0, 2 }, { 0, 33, 2 }, { 16, 51, 0 }, { 0, 0, 0 } } },
- { { { 34, 0, 1 }, { 0, 34, 1 }, { 5, 63, 0 }, { 0, 0, 0 } } },
- { { { 34, 0, 0 }, { 0, 34, 0 }, { 16, 52, 0 }, { 0, 0, 0 } } },
- { { { 34, 0, 1 }, { 0, 34, 1 }, { 6, 63, 0 }, { 0, 0, 0 } } },
- { { { 34, 0, 2 }, { 0, 34, 2 }, { 16, 53, 0 }, { 0, 0, 0 } } },
- { { { 35, 0, 1 }, { 0, 35, 1 }, { 7, 63, 0 }, { 0, 0, 0 } } },
- { { { 35, 0, 0 }, { 0, 35, 0 }, { 16, 54, 0 }, { 0, 0, 0 } } },
- { { { 35, 0, 1 }, { 0, 35, 1 }, { 8, 63, 0 }, { 0, 0, 0 } } },
- { { { 35, 0, 2 }, { 0, 35, 2 }, { 16, 55, 0 }, { 0, 0, 0 } } },
- { { { 36, 0, 1 }, { 0, 36, 1 }, { 9, 63, 0 }, { 0, 0, 0 } } },
- { { { 36, 0, 0 }, { 0, 36, 0 }, { 16, 56, 0 }, { 0, 0, 0 } } },
- { { { 36, 0, 1 }, { 0, 36, 1 }, { 10, 63, 0 }, { 0, 0, 0 } } },
- { { { 36, 0, 2 }, { 0, 36, 2 }, { 16, 57, 0 }, { 0, 0, 0 } } },
- { { { 37, 0, 1 }, { 0, 37, 1 }, { 11, 63, 0 }, { 0, 0, 0 } } },
- { { { 37, 0, 0 }, { 0, 37, 0 }, { 16, 58, 0 }, { 0, 0, 0 } } },
- { { { 37, 0, 1 }, { 0, 37, 1 }, { 12, 63, 0 }, { 0, 0, 0 } } },
- { { { 37, 0, 2 }, { 0, 37, 2 }, { 16, 59, 0 }, { 0, 0, 0 } } },
- { { { 38, 0, 1 }, { 0, 38, 1 }, { 13, 63, 0 }, { 0, 0, 0 } } },
- { { { 38, 0, 0 }, { 0, 38, 0 }, { 16, 60, 0 }, { 0, 0, 0 } } },
- { { { 38, 0, 1 }, { 0, 38, 1 }, { 14, 63, 0 }, { 0, 0, 0 } } },
- { { { 38, 0, 2 }, { 0, 38, 2 }, { 16, 61, 0 }, { 0, 0, 0 } } },
- { { { 39, 0, 1 }, { 0, 39, 1 }, { 15, 63, 0 }, { 0, 0, 0 } } },
- { { { 39, 0, 0 }, { 0, 39, 0 }, { 16, 62, 0 }, { 0, 0, 0 } } },
- { { { 39, 0, 1 }, { 0, 39, 1 }, { 16, 63, 1 }, { 0, 0, 0 } } },
- { { { 39, 0, 2 }, { 0, 39, 2 }, { 16, 63, 0 }, { 0, 0, 0 } } },
- { { { 40, 0, 1 }, { 0, 40, 1 }, { 17, 63, 1 }, { 0, 0, 0 } } },
- { { { 40, 0, 0 }, { 0, 40, 0 }, { 17, 63, 0 }, { 0, 0, 0 } } },
- { { { 40, 0, 1 }, { 0, 40, 1 }, { 18, 63, 1 }, { 0, 0, 0 } } },
- { { { 40, 0, 2 }, { 0, 40, 2 }, { 18, 63, 0 }, { 0, 0, 0 } } },
- { { { 41, 0, 1 }, { 0, 41, 1 }, { 19, 63, 1 }, { 0, 0, 0 } } },
- { { { 41, 0, 0 }, { 0, 41, 0 }, { 19, 63, 0 }, { 0, 0, 0 } } },
- { { { 41, 0, 1 }, { 0, 41, 1 }, { 20, 63, 1 }, { 0, 0, 0 } } },
- { { { 41, 0, 2 }, { 0, 41, 2 }, { 20, 63, 0 }, { 0, 0, 0 } } },
- { { { 42, 0, 1 }, { 0, 42, 1 }, { 21, 63, 1 }, { 0, 0, 0 } } },
- { { { 42, 0, 0 }, { 0, 42, 0 }, { 21, 63, 0 }, { 0, 0, 0 } } },
- { { { 42, 0, 1 }, { 0, 42, 1 }, { 22, 63, 1 }, { 0, 0, 0 } } },
- { { { 42, 0, 2 }, { 0, 42, 2 }, { 22, 63, 0 }, { 0, 0, 0 } } },
- { { { 43, 0, 1 }, { 0, 43, 1 }, { 23, 63, 1 }, { 0, 0, 0 } } },
- { { { 43, 0, 0 }, { 0, 43, 0 }, { 23, 63, 0 }, { 0, 0, 0 } } },
- { { { 43, 0, 1 }, { 0, 43, 1 }, { 24, 63, 1 }, { 0, 0, 0 } } },
- { { { 43, 0, 2 }, { 0, 43, 2 }, { 24, 63, 0 }, { 0, 0, 0 } } },
- { { { 44, 0, 1 }, { 0, 44, 1 }, { 25, 63, 1 }, { 0, 0, 0 } } },
- { { { 44, 0, 0 }, { 0, 44, 0 }, { 25, 63, 0 }, { 0, 0, 0 } } },
- { { { 44, 0, 1 }, { 0, 44, 1 }, { 26, 63, 1 }, { 0, 0, 0 } } },
- { { { 44, 0, 2 }, { 0, 44, 2 }, { 26, 63, 0 }, { 0, 0, 0 } } },
- { { { 45, 0, 1 }, { 0, 45, 1 }, { 27, 63, 1 }, { 0, 0, 0 } } },
- { { { 45, 0, 0 }, { 0, 45, 0 }, { 27, 63, 0 }, { 0, 0, 0 } } },
- { { { 45, 0, 1 }, { 0, 45, 1 }, { 28, 63, 1 }, { 0, 0, 0 } } },
- { { { 45, 0, 2 }, { 0, 45, 2 }, { 28, 63, 0 }, { 0, 0, 0 } } },
- { { { 46, 0, 1 }, { 0, 46, 1 }, { 29, 63, 1 }, { 0, 0, 0 } } },
- { { { 46, 0, 0 }, { 0, 46, 0 }, { 29, 63, 0 }, { 0, 0, 0 } } },
- { { { 46, 0, 1 }, { 0, 46, 1 }, { 30, 63, 1 }, { 0, 0, 0 } } },
- { { { 46, 0, 2 }, { 0, 46, 2 }, { 30, 63, 0 }, { 0, 0, 0 } } },
- { { { 47, 0, 1 }, { 0, 47, 1 }, { 31, 63, 1 }, { 0, 0, 0 } } },
- { { { 47, 0, 0 }, { 0, 47, 0 }, { 31, 63, 0 }, { 0, 0, 0 } } },
- { { { 47, 0, 1 }, { 0, 47, 1 }, { 32, 63, 1 }, { 0, 0, 0 } } },
- { { { 47, 0, 2 }, { 0, 47, 2 }, { 32, 63, 0 }, { 0, 0, 0 } } },
- { { { 48, 0, 2 }, { 0, 48, 2 }, { 33, 63, 1 }, { 0, 0, 0 } } },
- { { { 48, 0, 1 }, { 0, 48, 1 }, { 33, 63, 0 }, { 0, 0, 0 } } },
- { { { 48, 0, 0 }, { 0, 48, 0 }, { 48, 48, 0 }, { 0, 0, 0 } } },
- { { { 48, 0, 1 }, { 0, 48, 1 }, { 34, 63, 0 }, { 0, 0, 0 } } },
- { { { 48, 0, 2 }, { 0, 48, 2 }, { 48, 49, 0 }, { 0, 0, 0 } } },
- { { { 49, 0, 1 }, { 0, 49, 1 }, { 35, 63, 0 }, { 0, 0, 0 } } },
- { { { 49, 0, 0 }, { 0, 49, 0 }, { 48, 50, 0 }, { 0, 0, 0 } } },
- { { { 49, 0, 1 }, { 0, 49, 1 }, { 36, 63, 0 }, { 0, 0, 0 } } },
- { { { 49, 0, 2 }, { 0, 49, 2 }, { 48, 51, 0 }, { 0, 0, 0 } } },
- { { { 50, 0, 1 }, { 0, 50, 1 }, { 37, 63, 0 }, { 0, 0, 0 } } },
- { { { 50, 0, 0 }, { 0, 50, 0 }, { 48, 52, 0 }, { 0, 0, 0 } } },
- { { { 50, 0, 1 }, { 0, 50, 1 }, { 38, 63, 0 }, { 0, 0, 0 } } },
- { { { 50, 0, 2 }, { 0, 50, 2 }, { 48, 53, 0 }, { 0, 0, 0 } } },
- { { { 51, 0, 1 }, { 0, 51, 1 }, { 39, 63, 0 }, { 0, 0, 0 } } },
- { { { 51, 0, 0 }, { 0, 51, 0 }, { 48, 54, 0 }, { 0, 0, 0 } } },
- { { { 51, 0, 1 }, { 0, 51, 1 }, { 40, 63, 0 }, { 0, 0, 0 } } },
- { { { 51, 0, 2 }, { 0, 51, 2 }, { 48, 55, 0 }, { 0, 0, 0 } } },
- { { { 52, 0, 1 }, { 0, 52, 1 }, { 41, 63, 0 }, { 0, 0, 0 } } },
- { { { 52, 0, 0 }, { 0, 52, 0 }, { 48, 56, 0 }, { 0, 0, 0 } } },
- { { { 52, 0, 1 }, { 0, 52, 1 }, { 42, 63, 0 }, { 0, 0, 0 } } },
- { { { 52, 0, 2 }, { 0, 52, 2 }, { 48, 57, 0 }, { 0, 0, 0 } } },
- { { { 53, 0, 1 }, { 0, 53, 1 }, { 43, 63, 0 }, { 0, 0, 0 } } },
- { { { 53, 0, 0 }, { 0, 53, 0 }, { 48, 58, 0 }, { 0, 0, 0 } } },
- { { { 53, 0, 1 }, { 0, 53, 1 }, { 44, 63, 0 }, { 0, 0, 0 } } },
- { { { 53, 0, 2 }, { 0, 53, 2 }, { 48, 59, 0 }, { 0, 0, 0 } } },
- { { { 54, 0, 1 }, { 0, 54, 1 }, { 45, 63, 0 }, { 0, 0, 0 } } },
- { { { 54, 0, 0 }, { 0, 54, 0 }, { 48, 60, 0 }, { 0, 0, 0 } } },
- { { { 54, 0, 1 }, { 0, 54, 1 }, { 46, 63, 0 }, { 0, 0, 0 } } },
- { { { 54, 0, 2 }, { 0, 54, 2 }, { 48, 61, 0 }, { 0, 0, 0 } } },
- { { { 55, 0, 1 }, { 0, 55, 1 }, { 47, 63, 0 }, { 0, 0, 0 } } },
- { { { 55, 0, 0 }, { 0, 55, 0 }, { 48, 62, 0 }, { 0, 0, 0 } } },
- { { { 55, 0, 1 }, { 0, 55, 1 }, { 48, 63, 1 }, { 0, 0, 0 } } },
- { { { 55, 0, 2 }, { 0, 55, 2 }, { 48, 63, 0 }, { 0, 0, 0 } } },
- { { { 56, 0, 1 }, { 0, 56, 1 }, { 49, 63, 1 }, { 0, 0, 0 } } },
- { { { 56, 0, 0 }, { 0, 56, 0 }, { 49, 63, 0 }, { 0, 0, 0 } } },
- { { { 56, 0, 1 }, { 0, 56, 1 }, { 50, 63, 1 }, { 0, 0, 0 } } },
- { { { 56, 0, 2 }, { 0, 56, 2 }, { 50, 63, 0 }, { 0, 0, 0 } } },
- { { { 57, 0, 1 }, { 0, 57, 1 }, { 51, 63, 1 }, { 0, 0, 0 } } },
- { { { 57, 0, 0 }, { 0, 57, 0 }, { 51, 63, 0 }, { 0, 0, 0 } } },
- { { { 57, 0, 1 }, { 0, 57, 1 }, { 52, 63, 1 }, { 0, 0, 0 } } },
- { { { 57, 0, 2 }, { 0, 57, 2 }, { 52, 63, 0 }, { 0, 0, 0 } } },
- { { { 58, 0, 1 }, { 0, 58, 1 }, { 53, 63, 1 }, { 0, 0, 0 } } },
- { { { 58, 0, 0 }, { 0, 58, 0 }, { 53, 63, 0 }, { 0, 0, 0 } } },
- { { { 58, 0, 1 }, { 0, 58, 1 }, { 54, 63, 1 }, { 0, 0, 0 } } },
- { { { 58, 0, 2 }, { 0, 58, 2 }, { 54, 63, 0 }, { 0, 0, 0 } } },
- { { { 59, 0, 1 }, { 0, 59, 1 }, { 55, 63, 1 }, { 0, 0, 0 } } },
- { { { 59, 0, 0 }, { 0, 59, 0 }, { 55, 63, 0 }, { 0, 0, 0 } } },
- { { { 59, 0, 1 }, { 0, 59, 1 }, { 56, 63, 1 }, { 0, 0, 0 } } },
- { { { 59, 0, 2 }, { 0, 59, 2 }, { 56, 63, 0 }, { 0, 0, 0 } } },
- { { { 60, 0, 1 }, { 0, 60, 1 }, { 57, 63, 1 }, { 0, 0, 0 } } },
- { { { 60, 0, 0 }, { 0, 60, 0 }, { 57, 63, 0 }, { 0, 0, 0 } } },
- { { { 60, 0, 1 }, { 0, 60, 1 }, { 58, 63, 1 }, { 0, 0, 0 } } },
- { { { 60, 0, 2 }, { 0, 60, 2 }, { 58, 63, 0 }, { 0, 0, 0 } } },
- { { { 61, 0, 1 }, { 0, 61, 1 }, { 59, 63, 1 }, { 0, 0, 0 } } },
- { { { 61, 0, 0 }, { 0, 61, 0 }, { 59, 63, 0 }, { 0, 0, 0 } } },
- { { { 61, 0, 1 }, { 0, 61, 1 }, { 60, 63, 1 }, { 0, 0, 0 } } },
- { { { 61, 0, 2 }, { 0, 61, 2 }, { 60, 63, 0 }, { 0, 0, 0 } } },
- { { { 62, 0, 1 }, { 0, 62, 1 }, { 61, 63, 1 }, { 0, 0, 0 } } },
- { { { 62, 0, 0 }, { 0, 62, 0 }, { 61, 63, 0 }, { 0, 0, 0 } } },
- { { { 62, 0, 1 }, { 0, 62, 1 }, { 62, 63, 1 }, { 0, 0, 0 } } },
- { { { 62, 0, 2 }, { 0, 62, 2 }, { 62, 63, 0 }, { 0, 0, 0 } } },
- { { { 63, 0, 1 }, { 0, 63, 1 }, { 63, 63, 1 }, { 0, 0, 0 } } },
- { { { 63, 0, 0 }, { 0, 63, 0 }, { 63, 63, 0 }, { 0, 0, 0 } } }
-};
-
-static SingleColourLookup const lookup_5_4[] =
-{
- { { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } } },
- { { { 0, 0, 1 }, { 0, 0, 1 }, { 0, 1, 1 }, { 1, 0, 1 } } },
- { { { 0, 0, 2 }, { 0, 0, 2 }, { 0, 1, 0 }, { 1, 0, 0 } } },
- { { { 0, 0, 3 }, { 0, 0, 3 }, { 0, 1, 1 }, { 1, 0, 1 } } },
- { { { 0, 0, 4 }, { 0, 0, 4 }, { 0, 2, 1 }, { 0, 1, 1 } } },
- { { { 1, 0, 3 }, { 0, 1, 3 }, { 0, 2, 0 }, { 0, 1, 0 } } },
- { { { 1, 0, 2 }, { 0, 1, 2 }, { 0, 2, 1 }, { 0, 1, 1 } } },
- { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 3, 1 }, { 1, 1, 1 } } },
- { { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 3, 0 }, { 1, 1, 0 } } },
- { { { 1, 0, 1 }, { 0, 1, 1 }, { 1, 2, 1 }, { 0, 2, 1 } } },
- { { { 1, 0, 2 }, { 0, 1, 2 }, { 1, 2, 0 }, { 0, 2, 0 } } },
- { { { 1, 0, 3 }, { 0, 1, 3 }, { 0, 4, 0 }, { 4, 0, 0 } } },
- { { { 1, 0, 4 }, { 0, 1, 4 }, { 0, 5, 1 }, { 1, 2, 1 } } },
- { { { 2, 0, 3 }, { 0, 2, 3 }, { 0, 5, 0 }, { 1, 2, 0 } } },
- { { { 2, 0, 2 }, { 0, 2, 2 }, { 0, 5, 1 }, { 1, 2, 1 } } },
- { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 6, 1 }, { 0, 3, 1 } } },
- { { { 2, 0, 0 }, { 0, 2, 0 }, { 0, 6, 0 }, { 0, 3, 0 } } },
- { { { 2, 0, 1 }, { 0, 2, 1 }, { 2, 3, 1 }, { 1, 3, 1 } } },
- { { { 2, 0, 2 }, { 0, 2, 2 }, { 2, 3, 0 }, { 1, 3, 0 } } },
- { { { 2, 0, 3 }, { 0, 2, 3 }, { 0, 7, 0 }, { 5, 1, 0 } } },
- { { { 2, 0, 4 }, { 0, 2, 4 }, { 1, 6, 1 }, { 2, 3, 1 } } },
- { { { 3, 0, 3 }, { 0, 3, 3 }, { 1, 6, 0 }, { 2, 3, 0 } } },
- { { { 3, 0, 2 }, { 0, 3, 2 }, { 0, 8, 0 }, { 0, 4, 0 } } },
- { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 9, 1 }, { 1, 4, 1 } } },
- { { { 3, 0, 0 }, { 0, 3, 0 }, { 0, 9, 0 }, { 1, 4, 0 } } },
- { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 9, 1 }, { 1, 4, 1 } } },
- { { { 3, 0, 2 }, { 0, 3, 2 }, { 0, 10, 1 }, { 0, 5, 1 } } },
- { { { 3, 0, 3 }, { 0, 3, 3 }, { 0, 10, 0 }, { 0, 5, 0 } } },
- { { { 3, 0, 4 }, { 0, 3, 4 }, { 2, 7, 1 }, { 5, 3, 1 } } },
- { { { 4, 0, 4 }, { 0, 4, 4 }, { 2, 7, 0 }, { 5, 3, 0 } } },
- { { { 4, 0, 3 }, { 0, 4, 3 }, { 0, 11, 0 }, { 1, 5, 0 } } },
- { { { 4, 0, 2 }, { 0, 4, 2 }, { 1, 10, 1 }, { 0, 6, 1 } } },
- { { { 4, 0, 1 }, { 0, 4, 1 }, { 1, 10, 0 }, { 0, 6, 0 } } },
- { { { 4, 0, 0 }, { 0, 4, 0 }, { 0, 12, 0 }, { 4, 4, 0 } } },
- { { { 4, 0, 1 }, { 0, 4, 1 }, { 0, 13, 1 }, { 1, 6, 1 } } },
- { { { 4, 0, 2 }, { 0, 4, 2 }, { 0, 13, 0 }, { 1, 6, 0 } } },
- { { { 4, 0, 3 }, { 0, 4, 3 }, { 0, 13, 1 }, { 1, 6, 1 } } },
- { { { 4, 0, 4 }, { 0, 4, 4 }, { 0, 14, 1 }, { 0, 7, 1 } } },
- { { { 5, 0, 3 }, { 0, 5, 3 }, { 0, 14, 0 }, { 0, 7, 0 } } },
- { { { 5, 0, 2 }, { 0, 5, 2 }, { 2, 11, 1 }, { 1, 7, 1 } } },
- { { { 5, 0, 1 }, { 0, 5, 1 }, { 2, 11, 0 }, { 1, 7, 0 } } },
- { { { 5, 0, 0 }, { 0, 5, 0 }, { 0, 15, 0 }, { 5, 5, 0 } } },
- { { { 5, 0, 1 }, { 0, 5, 1 }, { 1, 14, 1 }, { 2, 7, 1 } } },
- { { { 5, 0, 2 }, { 0, 5, 2 }, { 1, 14, 0 }, { 2, 7, 0 } } },
- { { { 5, 0, 3 }, { 0, 5, 3 }, { 0, 16, 0 }, { 0, 8, 0 } } },
- { { { 5, 0, 4 }, { 0, 5, 4 }, { 0, 17, 1 }, { 1, 8, 1 } } },
- { { { 6, 0, 3 }, { 0, 6, 3 }, { 0, 17, 0 }, { 1, 8, 0 } } },
- { { { 6, 0, 2 }, { 0, 6, 2 }, { 0, 17, 1 }, { 1, 8, 1 } } },
- { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 18, 1 }, { 0, 9, 1 } } },
- { { { 6, 0, 0 }, { 0, 6, 0 }, { 0, 18, 0 }, { 0, 9, 0 } } },
- { { { 6, 0, 1 }, { 0, 6, 1 }, { 2, 15, 1 }, { 5, 7, 1 } } },
- { { { 6, 0, 2 }, { 0, 6, 2 }, { 2, 15, 0 }, { 5, 7, 0 } } },
- { { { 6, 0, 3 }, { 0, 6, 3 }, { 0, 19, 0 }, { 1, 9, 0 } } },
- { { { 6, 0, 4 }, { 0, 6, 4 }, { 1, 18, 1 }, { 0, 10, 1 } } },
- { { { 7, 0, 3 }, { 0, 7, 3 }, { 1, 18, 0 }, { 0, 10, 0 } } },
- { { { 7, 0, 2 }, { 0, 7, 2 }, { 0, 20, 0 }, { 4, 8, 0 } } },
- { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 21, 1 }, { 1, 10, 1 } } },
- { { { 7, 0, 0 }, { 0, 7, 0 }, { 0, 21, 0 }, { 1, 10, 0 } } },
- { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 21, 1 }, { 1, 10, 1 } } },
- { { { 7, 0, 2 }, { 0, 7, 2 }, { 0, 22, 1 }, { 0, 11, 1 } } },
- { { { 7, 0, 3 }, { 0, 7, 3 }, { 0, 22, 0 }, { 0, 11, 0 } } },
- { { { 7, 0, 4 }, { 0, 7, 4 }, { 2, 19, 1 }, { 1, 11, 1 } } },
- { { { 8, 0, 4 }, { 0, 8, 4 }, { 2, 19, 0 }, { 1, 11, 0 } } },
- { { { 8, 0, 3 }, { 0, 8, 3 }, { 0, 23, 0 }, { 5, 9, 0 } } },
- { { { 8, 0, 2 }, { 0, 8, 2 }, { 1, 22, 1 }, { 2, 11, 1 } } },
- { { { 8, 0, 1 }, { 0, 8, 1 }, { 1, 22, 0 }, { 2, 11, 0 } } },
- { { { 8, 0, 0 }, { 0, 8, 0 }, { 0, 24, 0 }, { 0, 12, 0 } } },
- { { { 8, 0, 1 }, { 0, 8, 1 }, { 0, 25, 1 }, { 1, 12, 1 } } },
- { { { 8, 0, 2 }, { 0, 8, 2 }, { 0, 25, 0 }, { 1, 12, 0 } } },
- { { { 8, 0, 3 }, { 0, 8, 3 }, { 0, 25, 1 }, { 1, 12, 1 } } },
- { { { 8, 0, 4 }, { 0, 8, 4 }, { 0, 26, 1 }, { 0, 13, 1 } } },
- { { { 9, 0, 3 }, { 0, 9, 3 }, { 0, 26, 0 }, { 0, 13, 0 } } },
- { { { 9, 0, 2 }, { 0, 9, 2 }, { 2, 23, 1 }, { 5, 11, 1 } } },
- { { { 9, 0, 1 }, { 0, 9, 1 }, { 2, 23, 0 }, { 5, 11, 0 } } },
- { { { 9, 0, 0 }, { 0, 9, 0 }, { 0, 27, 0 }, { 1, 13, 0 } } },
- { { { 9, 0, 1 }, { 0, 9, 1 }, { 1, 26, 1 }, { 0, 14, 1 } } },
- { { { 9, 0, 2 }, { 0, 9, 2 }, { 1, 26, 0 }, { 0, 14, 0 } } },
- { { { 9, 0, 3 }, { 0, 9, 3 }, { 0, 28, 0 }, { 4, 12, 0 } } },
- { { { 9, 0, 4 }, { 0, 9, 4 }, { 0, 29, 1 }, { 1, 14, 1 } } },
- { { { 10, 0, 3 }, { 0, 10, 3 }, { 0, 29, 0 }, { 1, 14, 0 } } },
- { { { 10, 0, 2 }, { 0, 10, 2 }, { 0, 29, 1 }, { 1, 14, 1 } } },
- { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 30, 1 }, { 0, 15, 1 } } },
- { { { 10, 0, 0 }, { 0, 10, 0 }, { 0, 30, 0 }, { 0, 15, 0 } } },
- { { { 10, 0, 1 }, { 0, 10, 1 }, { 2, 27, 1 }, { 1, 15, 1 } } },
- { { { 10, 0, 2 }, { 0, 10, 2 }, { 2, 27, 0 }, { 1, 15, 0 } } },
- { { { 10, 0, 3 }, { 0, 10, 3 }, { 0, 31, 0 }, { 5, 13, 0 } } },
- { { { 10, 0, 4 }, { 0, 10, 4 }, { 1, 30, 1 }, { 2, 15, 1 } } },
- { { { 11, 0, 3 }, { 0, 11, 3 }, { 1, 30, 0 }, { 2, 15, 0 } } },
- { { { 11, 0, 2 }, { 0, 11, 2 }, { 4, 24, 0 }, { 0, 16, 0 } } },
- { { { 11, 0, 1 }, { 0, 11, 1 }, { 1, 31, 1 }, { 1, 16, 1 } } },
- { { { 11, 0, 0 }, { 0, 11, 0 }, { 1, 31, 0 }, { 1, 16, 0 } } },
- { { { 11, 0, 1 }, { 0, 11, 1 }, { 1, 31, 1 }, { 1, 16, 1 } } },
- { { { 11, 0, 2 }, { 0, 11, 2 }, { 2, 30, 1 }, { 0, 17, 1 } } },
- { { { 11, 0, 3 }, { 0, 11, 3 }, { 2, 30, 0 }, { 0, 17, 0 } } },
- { { { 11, 0, 4 }, { 0, 11, 4 }, { 2, 31, 1 }, { 5, 15, 1 } } },
- { { { 12, 0, 4 }, { 0, 12, 4 }, { 2, 31, 0 }, { 5, 15, 0 } } },
- { { { 12, 0, 3 }, { 0, 12, 3 }, { 4, 27, 0 }, { 1, 17, 0 } } },
- { { { 12, 0, 2 }, { 0, 12, 2 }, { 3, 30, 1 }, { 0, 18, 1 } } },
- { { { 12, 0, 1 }, { 0, 12, 1 }, { 3, 30, 0 }, { 0, 18, 0 } } },
- { { { 12, 0, 0 }, { 0, 12, 0 }, { 4, 28, 0 }, { 4, 16, 0 } } },
- { { { 12, 0, 1 }, { 0, 12, 1 }, { 3, 31, 1 }, { 1, 18, 1 } } },
- { { { 12, 0, 2 }, { 0, 12, 2 }, { 3, 31, 0 }, { 1, 18, 0 } } },
- { { { 12, 0, 3 }, { 0, 12, 3 }, { 3, 31, 1 }, { 1, 18, 1 } } },
- { { { 12, 0, 4 }, { 0, 12, 4 }, { 4, 30, 1 }, { 0, 19, 1 } } },
- { { { 13, 0, 3 }, { 0, 13, 3 }, { 4, 30, 0 }, { 0, 19, 0 } } },
- { { { 13, 0, 2 }, { 0, 13, 2 }, { 6, 27, 1 }, { 1, 19, 1 } } },
- { { { 13, 0, 1 }, { 0, 13, 1 }, { 6, 27, 0 }, { 1, 19, 0 } } },
- { { { 13, 0, 0 }, { 0, 13, 0 }, { 4, 31, 0 }, { 5, 17, 0 } } },
- { { { 13, 0, 1 }, { 0, 13, 1 }, { 5, 30, 1 }, { 2, 19, 1 } } },
- { { { 13, 0, 2 }, { 0, 13, 2 }, { 5, 30, 0 }, { 2, 19, 0 } } },
- { { { 13, 0, 3 }, { 0, 13, 3 }, { 8, 24, 0 }, { 0, 20, 0 } } },
- { { { 13, 0, 4 }, { 0, 13, 4 }, { 5, 31, 1 }, { 1, 20, 1 } } },
- { { { 14, 0, 3 }, { 0, 14, 3 }, { 5, 31, 0 }, { 1, 20, 0 } } },
- { { { 14, 0, 2 }, { 0, 14, 2 }, { 5, 31, 1 }, { 1, 20, 1 } } },
- { { { 14, 0, 1 }, { 0, 14, 1 }, { 6, 30, 1 }, { 0, 21, 1 } } },
- { { { 14, 0, 0 }, { 0, 14, 0 }, { 6, 30, 0 }, { 0, 21, 0 } } },
- { { { 14, 0, 1 }, { 0, 14, 1 }, { 6, 31, 1 }, { 5, 19, 1 } } },
- { { { 14, 0, 2 }, { 0, 14, 2 }, { 6, 31, 0 }, { 5, 19, 0 } } },
- { { { 14, 0, 3 }, { 0, 14, 3 }, { 8, 27, 0 }, { 1, 21, 0 } } },
- { { { 14, 0, 4 }, { 0, 14, 4 }, { 7, 30, 1 }, { 0, 22, 1 } } },
- { { { 15, 0, 3 }, { 0, 15, 3 }, { 7, 30, 0 }, { 0, 22, 0 } } },
- { { { 15, 0, 2 }, { 0, 15, 2 }, { 8, 28, 0 }, { 4, 20, 0 } } },
- { { { 15, 0, 1 }, { 0, 15, 1 }, { 7, 31, 1 }, { 1, 22, 1 } } },
- { { { 15, 0, 0 }, { 0, 15, 0 }, { 7, 31, 0 }, { 1, 22, 0 } } },
- { { { 15, 0, 1 }, { 0, 15, 1 }, { 7, 31, 1 }, { 1, 22, 1 } } },
- { { { 15, 0, 2 }, { 0, 15, 2 }, { 8, 30, 1 }, { 0, 23, 1 } } },
- { { { 15, 0, 3 }, { 0, 15, 3 }, { 8, 30, 0 }, { 0, 23, 0 } } },
- { { { 15, 0, 4 }, { 0, 15, 4 }, { 10, 27, 1 }, { 1, 23, 1 } } },
- { { { 16, 0, 4 }, { 0, 16, 4 }, { 10, 27, 0 }, { 1, 23, 0 } } },
- { { { 16, 0, 3 }, { 0, 16, 3 }, { 8, 31, 0 }, { 5, 21, 0 } } },
- { { { 16, 0, 2 }, { 0, 16, 2 }, { 9, 30, 1 }, { 2, 23, 1 } } },
- { { { 16, 0, 1 }, { 0, 16, 1 }, { 9, 30, 0 }, { 2, 23, 0 } } },
- { { { 16, 0, 0 }, { 0, 16, 0 }, { 12, 24, 0 }, { 0, 24, 0 } } },
- { { { 16, 0, 1 }, { 0, 16, 1 }, { 9, 31, 1 }, { 1, 24, 1 } } },
- { { { 16, 0, 2 }, { 0, 16, 2 }, { 9, 31, 0 }, { 1, 24, 0 } } },
- { { { 16, 0, 3 }, { 0, 16, 3 }, { 9, 31, 1 }, { 1, 24, 1 } } },
- { { { 16, 0, 4 }, { 0, 16, 4 }, { 10, 30, 1 }, { 0, 25, 1 } } },
- { { { 17, 0, 3 }, { 0, 17, 3 }, { 10, 30, 0 }, { 0, 25, 0 } } },
- { { { 17, 0, 2 }, { 0, 17, 2 }, { 10, 31, 1 }, { 5, 23, 1 } } },
- { { { 17, 0, 1 }, { 0, 17, 1 }, { 10, 31, 0 }, { 5, 23, 0 } } },
- { { { 17, 0, 0 }, { 0, 17, 0 }, { 12, 27, 0 }, { 1, 25, 0 } } },
- { { { 17, 0, 1 }, { 0, 17, 1 }, { 11, 30, 1 }, { 0, 26, 1 } } },
- { { { 17, 0, 2 }, { 0, 17, 2 }, { 11, 30, 0 }, { 0, 26, 0 } } },
- { { { 17, 0, 3 }, { 0, 17, 3 }, { 12, 28, 0 }, { 4, 24, 0 } } },
- { { { 17, 0, 4 }, { 0, 17, 4 }, { 11, 31, 1 }, { 1, 26, 1 } } },
- { { { 18, 0, 3 }, { 0, 18, 3 }, { 11, 31, 0 }, { 1, 26, 0 } } },
- { { { 18, 0, 2 }, { 0, 18, 2 }, { 11, 31, 1 }, { 1, 26, 1 } } },
- { { { 18, 0, 1 }, { 0, 18, 1 }, { 12, 30, 1 }, { 0, 27, 1 } } },
- { { { 18, 0, 0 }, { 0, 18, 0 }, { 12, 30, 0 }, { 0, 27, 0 } } },
- { { { 18, 0, 1 }, { 0, 18, 1 }, { 14, 27, 1 }, { 1, 27, 1 } } },
- { { { 18, 0, 2 }, { 0, 18, 2 }, { 14, 27, 0 }, { 1, 27, 0 } } },
- { { { 18, 0, 3 }, { 0, 18, 3 }, { 12, 31, 0 }, { 5, 25, 0 } } },
- { { { 18, 0, 4 }, { 0, 18, 4 }, { 13, 30, 1 }, { 2, 27, 1 } } },
- { { { 19, 0, 3 }, { 0, 19, 3 }, { 13, 30, 0 }, { 2, 27, 0 } } },
- { { { 19, 0, 2 }, { 0, 19, 2 }, { 16, 24, 0 }, { 0, 28, 0 } } },
- { { { 19, 0, 1 }, { 0, 19, 1 }, { 13, 31, 1 }, { 1, 28, 1 } } },
- { { { 19, 0, 0 }, { 0, 19, 0 }, { 13, 31, 0 }, { 1, 28, 0 } } },
- { { { 19, 0, 1 }, { 0, 19, 1 }, { 13, 31, 1 }, { 1, 28, 1 } } },
- { { { 19, 0, 2 }, { 0, 19, 2 }, { 14, 30, 1 }, { 0, 29, 1 } } },
- { { { 19, 0, 3 }, { 0, 19, 3 }, { 14, 30, 0 }, { 0, 29, 0 } } },
- { { { 19, 0, 4 }, { 0, 19, 4 }, { 14, 31, 1 }, { 5, 27, 1 } } },
- { { { 20, 0, 4 }, { 0, 20, 4 }, { 14, 31, 0 }, { 5, 27, 0 } } },
- { { { 20, 0, 3 }, { 0, 20, 3 }, { 16, 27, 0 }, { 1, 29, 0 } } },
- { { { 20, 0, 2 }, { 0, 20, 2 }, { 15, 30, 1 }, { 0, 30, 1 } } },
- { { { 20, 0, 1 }, { 0, 20, 1 }, { 15, 30, 0 }, { 0, 30, 0 } } },
- { { { 20, 0, 0 }, { 0, 20, 0 }, { 16, 28, 0 }, { 4, 28, 0 } } },
- { { { 20, 0, 1 }, { 0, 20, 1 }, { 15, 31, 1 }, { 1, 30, 1 } } },
- { { { 20, 0, 2 }, { 0, 20, 2 }, { 15, 31, 0 }, { 1, 30, 0 } } },
- { { { 20, 0, 3 }, { 0, 20, 3 }, { 15, 31, 1 }, { 1, 30, 1 } } },
- { { { 20, 0, 4 }, { 0, 20, 4 }, { 16, 30, 1 }, { 0, 31, 1 } } },
- { { { 21, 0, 3 }, { 0, 21, 3 }, { 16, 30, 0 }, { 0, 31, 0 } } },
- { { { 21, 0, 2 }, { 0, 21, 2 }, { 18, 27, 1 }, { 1, 31, 1 } } },
- { { { 21, 0, 1 }, { 0, 21, 1 }, { 18, 27, 0 }, { 1, 31, 0 } } },
- { { { 21, 0, 0 }, { 0, 21, 0 }, { 16, 31, 0 }, { 5, 29, 0 } } },
- { { { 21, 0, 1 }, { 0, 21, 1 }, { 17, 30, 1 }, { 2, 31, 1 } } },
- { { { 21, 0, 2 }, { 0, 21, 2 }, { 17, 30, 0 }, { 2, 31, 0 } } },
- { { { 21, 0, 3 }, { 0, 21, 3 }, { 20, 24, 0 }, { 8, 28, 0 } } },
- { { { 21, 0, 4 }, { 0, 21, 4 }, { 17, 31, 1 }, { 3, 31, 1 } } },
- { { { 22, 0, 3 }, { 0, 22, 3 }, { 17, 31, 0 }, { 3, 31, 0 } } },
- { { { 22, 0, 2 }, { 0, 22, 2 }, { 17, 31, 1 }, { 3, 31, 1 } } },
- { { { 22, 0, 1 }, { 0, 22, 1 }, { 18, 30, 1 }, { 4, 31, 1 } } },
- { { { 22, 0, 0 }, { 0, 22, 0 }, { 18, 30, 0 }, { 4, 31, 0 } } },
- { { { 22, 0, 1 }, { 0, 22, 1 }, { 18, 31, 1 }, { 5, 31, 1 } } },
- { { { 22, 0, 2 }, { 0, 22, 2 }, { 18, 31, 0 }, { 5, 31, 0 } } },
- { { { 22, 0, 3 }, { 0, 22, 3 }, { 20, 27, 0 }, { 9, 29, 0 } } },
- { { { 22, 0, 4 }, { 0, 22, 4 }, { 19, 30, 1 }, { 6, 31, 1 } } },
- { { { 23, 0, 3 }, { 0, 23, 3 }, { 19, 30, 0 }, { 6, 31, 0 } } },
- { { { 23, 0, 2 }, { 0, 23, 2 }, { 20, 28, 0 }, { 12, 28, 0 } } },
- { { { 23, 0, 1 }, { 0, 23, 1 }, { 19, 31, 1 }, { 7, 31, 1 } } },
- { { { 23, 0, 0 }, { 0, 23, 0 }, { 19, 31, 0 }, { 7, 31, 0 } } },
- { { { 23, 0, 1 }, { 0, 23, 1 }, { 19, 31, 1 }, { 7, 31, 1 } } },
- { { { 23, 0, 2 }, { 0, 23, 2 }, { 20, 30, 1 }, { 8, 31, 1 } } },
- { { { 23, 0, 3 }, { 0, 23, 3 }, { 20, 30, 0 }, { 8, 31, 0 } } },
- { { { 23, 0, 4 }, { 0, 23, 4 }, { 22, 27, 1 }, { 9, 31, 1 } } },
- { { { 24, 0, 4 }, { 0, 24, 4 }, { 22, 27, 0 }, { 9, 31, 0 } } },
- { { { 24, 0, 3 }, { 0, 24, 3 }, { 20, 31, 0 }, { 13, 29, 0 } } },
- { { { 24, 0, 2 }, { 0, 24, 2 }, { 21, 30, 1 }, { 10, 31, 1 } } },
- { { { 24, 0, 1 }, { 0, 24, 1 }, { 21, 30, 0 }, { 10, 31, 0 } } },
- { { { 24, 0, 0 }, { 0, 24, 0 }, { 24, 24, 0 }, { 16, 28, 0 } } },
- { { { 24, 0, 1 }, { 0, 24, 1 }, { 21, 31, 1 }, { 11, 31, 1 } } },
- { { { 24, 0, 2 }, { 0, 24, 2 }, { 21, 31, 0 }, { 11, 31, 0 } } },
- { { { 24, 0, 3 }, { 0, 24, 3 }, { 21, 31, 1 }, { 11, 31, 1 } } },
- { { { 24, 0, 4 }, { 0, 24, 4 }, { 22, 30, 1 }, { 12, 31, 1 } } },
- { { { 25, 0, 3 }, { 0, 25, 3 }, { 22, 30, 0 }, { 12, 31, 0 } } },
- { { { 25, 0, 2 }, { 0, 25, 2 }, { 22, 31, 1 }, { 13, 31, 1 } } },
- { { { 25, 0, 1 }, { 0, 25, 1 }, { 22, 31, 0 }, { 13, 31, 0 } } },
- { { { 25, 0, 0 }, { 0, 25, 0 }, { 24, 27, 0 }, { 17, 29, 0 } } },
- { { { 25, 0, 1 }, { 0, 25, 1 }, { 23, 30, 1 }, { 14, 31, 1 } } },
- { { { 25, 0, 2 }, { 0, 25, 2 }, { 23, 30, 0 }, { 14, 31, 0 } } },
- { { { 25, 0, 3 }, { 0, 25, 3 }, { 24, 28, 0 }, { 20, 28, 0 } } },
- { { { 25, 0, 4 }, { 0, 25, 4 }, { 23, 31, 1 }, { 15, 31, 1 } } },
- { { { 26, 0, 3 }, { 0, 26, 3 }, { 23, 31, 0 }, { 15, 31, 0 } } },
- { { { 26, 0, 2 }, { 0, 26, 2 }, { 23, 31, 1 }, { 15, 31, 1 } } },
- { { { 26, 0, 1 }, { 0, 26, 1 }, { 24, 30, 1 }, { 16, 31, 1 } } },
- { { { 26, 0, 0 }, { 0, 26, 0 }, { 24, 30, 0 }, { 16, 31, 0 } } },
- { { { 26, 0, 1 }, { 0, 26, 1 }, { 26, 27, 1 }, { 17, 31, 1 } } },
- { { { 26, 0, 2 }, { 0, 26, 2 }, { 26, 27, 0 }, { 17, 31, 0 } } },
- { { { 26, 0, 3 }, { 0, 26, 3 }, { 24, 31, 0 }, { 21, 29, 0 } } },
- { { { 26, 0, 4 }, { 0, 26, 4 }, { 25, 30, 1 }, { 18, 31, 1 } } },
- { { { 27, 0, 3 }, { 0, 27, 3 }, { 25, 30, 0 }, { 18, 31, 0 } } },
- { { { 27, 0, 2 }, { 0, 27, 2 }, { 28, 24, 0 }, { 24, 28, 0 } } },
- { { { 27, 0, 1 }, { 0, 27, 1 }, { 25, 31, 1 }, { 19, 31, 1 } } },
- { { { 27, 0, 0 }, { 0, 27, 0 }, { 25, 31, 0 }, { 19, 31, 0 } } },
- { { { 27, 0, 1 }, { 0, 27, 1 }, { 25, 31, 1 }, { 19, 31, 1 } } },
- { { { 27, 0, 2 }, { 0, 27, 2 }, { 26, 30, 1 }, { 20, 31, 1 } } },
- { { { 27, 0, 3 }, { 0, 27, 3 }, { 26, 30, 0 }, { 20, 31, 0 } } },
- { { { 27, 0, 4 }, { 0, 27, 4 }, { 26, 31, 1 }, { 21, 31, 1 } } },
- { { { 28, 0, 4 }, { 0, 28, 4 }, { 26, 31, 0 }, { 21, 31, 0 } } },
- { { { 28, 0, 3 }, { 0, 28, 3 }, { 28, 27, 0 }, { 25, 29, 0 } } },
- { { { 28, 0, 2 }, { 0, 28, 2 }, { 27, 30, 1 }, { 22, 31, 1 } } },
- { { { 28, 0, 1 }, { 0, 28, 1 }, { 27, 30, 0 }, { 22, 31, 0 } } },
- { { { 28, 0, 0 }, { 0, 28, 0 }, { 28, 28, 0 }, { 28, 28, 0 } } },
- { { { 28, 0, 1 }, { 0, 28, 1 }, { 27, 31, 1 }, { 23, 31, 1 } } },
- { { { 28, 0, 2 }, { 0, 28, 2 }, { 27, 31, 0 }, { 23, 31, 0 } } },
- { { { 28, 0, 3 }, { 0, 28, 3 }, { 27, 31, 1 }, { 23, 31, 1 } } },
- { { { 28, 0, 4 }, { 0, 28, 4 }, { 28, 30, 1 }, { 24, 31, 1 } } },
- { { { 29, 0, 3 }, { 0, 29, 3 }, { 28, 30, 0 }, { 24, 31, 0 } } },
- { { { 29, 0, 2 }, { 0, 29, 2 }, { 30, 27, 1 }, { 25, 31, 1 } } },
- { { { 29, 0, 1 }, { 0, 29, 1 }, { 30, 27, 0 }, { 25, 31, 0 } } },
- { { { 29, 0, 0 }, { 0, 29, 0 }, { 28, 31, 0 }, { 29, 29, 0 } } },
- { { { 29, 0, 1 }, { 0, 29, 1 }, { 29, 30, 1 }, { 26, 31, 1 } } },
- { { { 29, 0, 2 }, { 0, 29, 2 }, { 29, 30, 0 }, { 26, 31, 0 } } },
- { { { 29, 0, 3 }, { 0, 29, 3 }, { 29, 30, 1 }, { 26, 31, 1 } } },
- { { { 29, 0, 4 }, { 0, 29, 4 }, { 29, 31, 1 }, { 27, 31, 1 } } },
- { { { 30, 0, 3 }, { 0, 30, 3 }, { 29, 31, 0 }, { 27, 31, 0 } } },
- { { { 30, 0, 2 }, { 0, 30, 2 }, { 29, 31, 1 }, { 27, 31, 1 } } },
- { { { 30, 0, 1 }, { 0, 30, 1 }, { 30, 30, 1 }, { 28, 31, 1 } } },
- { { { 30, 0, 0 }, { 0, 30, 0 }, { 30, 30, 0 }, { 28, 31, 0 } } },
- { { { 30, 0, 1 }, { 0, 30, 1 }, { 30, 31, 1 }, { 29, 31, 1 } } },
- { { { 30, 0, 2 }, { 0, 30, 2 }, { 30, 31, 0 }, { 29, 31, 0 } } },
- { { { 30, 0, 3 }, { 0, 30, 3 }, { 30, 31, 1 }, { 29, 31, 1 } } },
- { { { 30, 0, 4 }, { 0, 30, 4 }, { 31, 30, 1 }, { 30, 31, 1 } } },
- { { { 31, 0, 3 }, { 0, 31, 3 }, { 31, 30, 0 }, { 30, 31, 0 } } },
- { { { 31, 0, 2 }, { 0, 31, 2 }, { 31, 30, 1 }, { 30, 31, 1 } } },
- { { { 31, 0, 1 }, { 0, 31, 1 }, { 31, 31, 1 }, { 31, 31, 1 } } },
- { { { 31, 0, 0 }, { 0, 31, 0 }, { 31, 31, 0 }, { 31, 31, 0 } } }
-};
-
-static SingleColourLookup const lookup_6_4[] =
-{
- { { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } } },
- { { { 0, 0, 1 }, { 0, 0, 1 }, { 0, 1, 0 }, { 1, 0, 0 } } },
- { { { 0, 0, 2 }, { 0, 0, 2 }, { 0, 2, 0 }, { 0, 1, 0 } } },
- { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 3, 1 }, { 1, 1, 1 } } },
- { { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 3, 0 }, { 1, 1, 0 } } },
- { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 4, 0 }, { 0, 2, 0 } } },
- { { { 1, 0, 2 }, { 0, 1, 2 }, { 0, 5, 0 }, { 1, 2, 0 } } },
- { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 6, 1 }, { 0, 3, 1 } } },
- { { { 2, 0, 0 }, { 0, 2, 0 }, { 0, 6, 0 }, { 0, 3, 0 } } },
- { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 7, 0 }, { 1, 3, 0 } } },
- { { { 2, 0, 2 }, { 0, 2, 2 }, { 0, 8, 0 }, { 0, 4, 0 } } },
- { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 9, 1 }, { 1, 4, 1 } } },
- { { { 3, 0, 0 }, { 0, 3, 0 }, { 0, 9, 0 }, { 1, 4, 0 } } },
- { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 10, 0 }, { 0, 5, 0 } } },
- { { { 3, 0, 2 }, { 0, 3, 2 }, { 0, 11, 0 }, { 1, 5, 0 } } },
- { { { 4, 0, 1 }, { 0, 4, 1 }, { 0, 12, 1 }, { 0, 6, 1 } } },
- { { { 4, 0, 0 }, { 0, 4, 0 }, { 0, 12, 0 }, { 0, 6, 0 } } },
- { { { 4, 0, 1 }, { 0, 4, 1 }, { 0, 13, 0 }, { 1, 6, 0 } } },
- { { { 4, 0, 2 }, { 0, 4, 2 }, { 0, 14, 0 }, { 0, 7, 0 } } },
- { { { 5, 0, 1 }, { 0, 5, 1 }, { 0, 15, 1 }, { 1, 7, 1 } } },
- { { { 5, 0, 0 }, { 0, 5, 0 }, { 0, 15, 0 }, { 1, 7, 0 } } },
- { { { 5, 0, 1 }, { 0, 5, 1 }, { 0, 16, 0 }, { 0, 8, 0 } } },
- { { { 5, 0, 2 }, { 0, 5, 2 }, { 1, 15, 0 }, { 1, 8, 0 } } },
- { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 17, 0 }, { 17, 0, 0 } } },
- { { { 6, 0, 0 }, { 0, 6, 0 }, { 0, 18, 0 }, { 0, 9, 0 } } },
- { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 19, 0 }, { 1, 9, 0 } } },
- { { { 6, 0, 2 }, { 0, 6, 2 }, { 3, 14, 0 }, { 0, 10, 0 } } },
- { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 20, 0 }, { 16, 2, 0 } } },
- { { { 7, 0, 0 }, { 0, 7, 0 }, { 0, 21, 0 }, { 1, 10, 0 } } },
- { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 22, 0 }, { 0, 11, 0 } } },
- { { { 7, 0, 2 }, { 0, 7, 2 }, { 4, 15, 0 }, { 1, 11, 0 } } },
- { { { 8, 0, 1 }, { 0, 8, 1 }, { 0, 23, 0 }, { 17, 3, 0 } } },
- { { { 8, 0, 0 }, { 0, 8, 0 }, { 0, 24, 0 }, { 0, 12, 0 } } },
- { { { 8, 0, 1 }, { 0, 8, 1 }, { 0, 25, 0 }, { 1, 12, 0 } } },
- { { { 8, 0, 2 }, { 0, 8, 2 }, { 6, 14, 0 }, { 0, 13, 0 } } },
- { { { 9, 0, 1 }, { 0, 9, 1 }, { 0, 26, 0 }, { 16, 5, 0 } } },
- { { { 9, 0, 0 }, { 0, 9, 0 }, { 0, 27, 0 }, { 1, 13, 0 } } },
- { { { 9, 0, 1 }, { 0, 9, 1 }, { 0, 28, 0 }, { 0, 14, 0 } } },
- { { { 9, 0, 2 }, { 0, 9, 2 }, { 7, 15, 0 }, { 1, 14, 0 } } },
- { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 29, 0 }, { 17, 6, 0 } } },
- { { { 10, 0, 0 }, { 0, 10, 0 }, { 0, 30, 0 }, { 0, 15, 0 } } },
- { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 31, 0 }, { 1, 15, 0 } } },
- { { { 10, 0, 2 }, { 0, 10, 2 }, { 9, 14, 0 }, { 2, 15, 0 } } },
- { { { 11, 0, 1 }, { 0, 11, 1 }, { 0, 32, 0 }, { 0, 16, 0 } } },
- { { { 11, 0, 0 }, { 0, 11, 0 }, { 0, 33, 0 }, { 1, 16, 0 } } },
- { { { 11, 0, 1 }, { 0, 11, 1 }, { 2, 30, 0 }, { 4, 15, 0 } } },
- { { { 11, 0, 2 }, { 0, 11, 2 }, { 0, 34, 0 }, { 0, 17, 0 } } },
- { { { 12, 0, 1 }, { 0, 12, 1 }, { 0, 35, 0 }, { 1, 17, 0 } } },
- { { { 12, 0, 0 }, { 0, 12, 0 }, { 0, 36, 0 }, { 0, 18, 0 } } },
- { { { 12, 0, 1 }, { 0, 12, 1 }, { 3, 31, 0 }, { 7, 15, 0 } } },
- { { { 12, 0, 2 }, { 0, 12, 2 }, { 0, 37, 0 }, { 1, 18, 0 } } },
- { { { 13, 0, 1 }, { 0, 13, 1 }, { 0, 38, 0 }, { 0, 19, 0 } } },
- { { { 13, 0, 0 }, { 0, 13, 0 }, { 0, 39, 0 }, { 1, 19, 0 } } },
- { { { 13, 0, 1 }, { 0, 13, 1 }, { 5, 30, 0 }, { 10, 15, 0 } } },
- { { { 13, 0, 2 }, { 0, 13, 2 }, { 0, 40, 0 }, { 0, 20, 0 } } },
- { { { 14, 0, 1 }, { 0, 14, 1 }, { 0, 41, 0 }, { 1, 20, 0 } } },
- { { { 14, 0, 0 }, { 0, 14, 0 }, { 0, 42, 0 }, { 0, 21, 0 } } },
- { { { 14, 0, 1 }, { 0, 14, 1 }, { 6, 31, 0 }, { 13, 15, 0 } } },
- { { { 14, 0, 2 }, { 0, 14, 2 }, { 0, 43, 0 }, { 1, 21, 0 } } },
- { { { 15, 0, 1 }, { 0, 15, 1 }, { 0, 44, 0 }, { 0, 22, 0 } } },
- { { { 15, 0, 0 }, { 0, 15, 0 }, { 0, 45, 0 }, { 1, 22, 0 } } },
- { { { 15, 0, 1 }, { 0, 15, 1 }, { 8, 30, 0 }, { 16, 15, 0 } } },
- { { { 15, 0, 2 }, { 0, 15, 2 }, { 0, 46, 0 }, { 0, 23, 0 } } },
- { { { 16, 0, 2 }, { 0, 16, 2 }, { 0, 47, 0 }, { 1, 23, 0 } } },
- { { { 16, 0, 1 }, { 0, 16, 1 }, { 1, 46, 0 }, { 0, 24, 0 } } },
- { { { 16, 0, 0 }, { 0, 16, 0 }, { 0, 48, 0 }, { 16, 16, 0 } } },
- { { { 16, 0, 1 }, { 0, 16, 1 }, { 0, 49, 0 }, { 1, 24, 0 } } },
- { { { 16, 0, 2 }, { 0, 16, 2 }, { 0, 50, 0 }, { 0, 25, 0 } } },
- { { { 17, 0, 1 }, { 0, 17, 1 }, { 2, 47, 0 }, { 1, 25, 0 } } },
- { { { 17, 0, 0 }, { 0, 17, 0 }, { 0, 51, 0 }, { 17, 17, 0 } } },
- { { { 17, 0, 1 }, { 0, 17, 1 }, { 0, 52, 0 }, { 0, 26, 0 } } },
- { { { 17, 0, 2 }, { 0, 17, 2 }, { 0, 53, 0 }, { 1, 26, 0 } } },
- { { { 18, 0, 1 }, { 0, 18, 1 }, { 4, 46, 0 }, { 0, 27, 0 } } },
- { { { 18, 0, 0 }, { 0, 18, 0 }, { 0, 54, 0 }, { 16, 19, 0 } } },
- { { { 18, 0, 1 }, { 0, 18, 1 }, { 0, 55, 0 }, { 1, 27, 0 } } },
- { { { 18, 0, 2 }, { 0, 18, 2 }, { 0, 56, 0 }, { 0, 28, 0 } } },
- { { { 19, 0, 1 }, { 0, 19, 1 }, { 5, 47, 0 }, { 1, 28, 0 } } },
- { { { 19, 0, 0 }, { 0, 19, 0 }, { 0, 57, 0 }, { 17, 20, 0 } } },
- { { { 19, 0, 1 }, { 0, 19, 1 }, { 0, 58, 0 }, { 0, 29, 0 } } },
- { { { 19, 0, 2 }, { 0, 19, 2 }, { 0, 59, 0 }, { 1, 29, 0 } } },
- { { { 20, 0, 1 }, { 0, 20, 1 }, { 7, 46, 0 }, { 0, 30, 0 } } },
- { { { 20, 0, 0 }, { 0, 20, 0 }, { 0, 60, 0 }, { 16, 22, 0 } } },
- { { { 20, 0, 1 }, { 0, 20, 1 }, { 0, 61, 0 }, { 1, 30, 0 } } },
- { { { 20, 0, 2 }, { 0, 20, 2 }, { 0, 62, 0 }, { 0, 31, 0 } } },
- { { { 21, 0, 1 }, { 0, 21, 1 }, { 8, 47, 0 }, { 1, 31, 0 } } },
- { { { 21, 0, 0 }, { 0, 21, 0 }, { 0, 63, 0 }, { 17, 23, 0 } } },
- { { { 21, 0, 1 }, { 0, 21, 1 }, { 1, 62, 0 }, { 0, 32, 0 } } },
- { { { 21, 0, 2 }, { 0, 21, 2 }, { 1, 63, 0 }, { 3, 31, 0 } } },
- { { { 22, 0, 1 }, { 0, 22, 1 }, { 10, 46, 0 }, { 1, 32, 0 } } },
- { { { 22, 0, 0 }, { 0, 22, 0 }, { 2, 62, 0 }, { 0, 33, 0 } } },
- { { { 22, 0, 1 }, { 0, 22, 1 }, { 2, 63, 0 }, { 1, 33, 0 } } },
- { { { 22, 0, 2 }, { 0, 22, 2 }, { 3, 62, 0 }, { 6, 31, 0 } } },
- { { { 23, 0, 1 }, { 0, 23, 1 }, { 11, 47, 0 }, { 0, 34, 0 } } },
- { { { 23, 0, 0 }, { 0, 23, 0 }, { 3, 63, 0 }, { 1, 34, 0 } } },
- { { { 23, 0, 1 }, { 0, 23, 1 }, { 4, 62, 0 }, { 0, 35, 0 } } },
- { { { 23, 0, 2 }, { 0, 23, 2 }, { 4, 63, 0 }, { 9, 31, 0 } } },
- { { { 24, 0, 1 }, { 0, 24, 1 }, { 13, 46, 0 }, { 1, 35, 0 } } },
- { { { 24, 0, 0 }, { 0, 24, 0 }, { 5, 62, 0 }, { 0, 36, 0 } } },
- { { { 24, 0, 1 }, { 0, 24, 1 }, { 5, 63, 0 }, { 1, 36, 0 } } },
- { { { 24, 0, 2 }, { 0, 24, 2 }, { 6, 62, 0 }, { 12, 31, 0 } } },
- { { { 25, 0, 1 }, { 0, 25, 1 }, { 14, 47, 0 }, { 0, 37, 0 } } },
- { { { 25, 0, 0 }, { 0, 25, 0 }, { 6, 63, 0 }, { 1, 37, 0 } } },
- { { { 25, 0, 1 }, { 0, 25, 1 }, { 7, 62, 0 }, { 0, 38, 0 } } },
- { { { 25, 0, 2 }, { 0, 25, 2 }, { 7, 63, 0 }, { 15, 31, 0 } } },
- { { { 26, 0, 1 }, { 0, 26, 1 }, { 16, 45, 0 }, { 1, 38, 0 } } },
- { { { 26, 0, 0 }, { 0, 26, 0 }, { 8, 62, 0 }, { 0, 39, 0 } } },
- { { { 26, 0, 1 }, { 0, 26, 1 }, { 8, 63, 0 }, { 1, 39, 0 } } },
- { { { 26, 0, 2 }, { 0, 26, 2 }, { 9, 62, 0 }, { 18, 31, 0 } } },
- { { { 27, 0, 1 }, { 0, 27, 1 }, { 16, 48, 0 }, { 0, 40, 0 } } },
- { { { 27, 0, 0 }, { 0, 27, 0 }, { 9, 63, 0 }, { 1, 40, 0 } } },
- { { { 27, 0, 1 }, { 0, 27, 1 }, { 10, 62, 0 }, { 0, 41, 0 } } },
- { { { 27, 0, 2 }, { 0, 27, 2 }, { 10, 63, 0 }, { 16, 33, 0 } } },
- { { { 28, 0, 1 }, { 0, 28, 1 }, { 16, 51, 0 }, { 1, 41, 0 } } },
- { { { 28, 0, 0 }, { 0, 28, 0 }, { 11, 62, 0 }, { 0, 42, 0 } } },
- { { { 28, 0, 1 }, { 0, 28, 1 }, { 11, 63, 0 }, { 1, 42, 0 } } },
- { { { 28, 0, 2 }, { 0, 28, 2 }, { 12, 62, 0 }, { 17, 34, 0 } } },
- { { { 29, 0, 1 }, { 0, 29, 1 }, { 16, 54, 0 }, { 0, 43, 0 } } },
- { { { 29, 0, 0 }, { 0, 29, 0 }, { 12, 63, 0 }, { 1, 43, 0 } } },
- { { { 29, 0, 1 }, { 0, 29, 1 }, { 13, 62, 0 }, { 0, 44, 0 } } },
- { { { 29, 0, 2 }, { 0, 29, 2 }, { 13, 63, 0 }, { 16, 36, 0 } } },
- { { { 30, 0, 1 }, { 0, 30, 1 }, { 16, 57, 0 }, { 1, 44, 0 } } },
- { { { 30, 0, 0 }, { 0, 30, 0 }, { 14, 62, 0 }, { 0, 45, 0 } } },
- { { { 30, 0, 1 }, { 0, 30, 1 }, { 14, 63, 0 }, { 1, 45, 0 } } },
- { { { 30, 0, 2 }, { 0, 30, 2 }, { 15, 62, 0 }, { 17, 37, 0 } } },
- { { { 31, 0, 1 }, { 0, 31, 1 }, { 16, 60, 0 }, { 0, 46, 0 } } },
- { { { 31, 0, 0 }, { 0, 31, 0 }, { 15, 63, 0 }, { 1, 46, 0 } } },
- { { { 31, 0, 1 }, { 0, 31, 1 }, { 24, 46, 0 }, { 0, 47, 0 } } },
- { { { 31, 0, 2 }, { 0, 31, 2 }, { 16, 62, 0 }, { 16, 39, 0 } } },
- { { { 32, 0, 2 }, { 0, 32, 2 }, { 16, 63, 0 }, { 1, 47, 0 } } },
- { { { 32, 0, 1 }, { 0, 32, 1 }, { 17, 62, 0 }, { 2, 47, 0 } } },
- { { { 32, 0, 0 }, { 0, 32, 0 }, { 25, 47, 0 }, { 0, 48, 0 } } },
- { { { 32, 0, 1 }, { 0, 32, 1 }, { 17, 63, 0 }, { 1, 48, 0 } } },
- { { { 32, 0, 2 }, { 0, 32, 2 }, { 18, 62, 0 }, { 0, 49, 0 } } },
- { { { 33, 0, 1 }, { 0, 33, 1 }, { 18, 63, 0 }, { 5, 47, 0 } } },
- { { { 33, 0, 0 }, { 0, 33, 0 }, { 27, 46, 0 }, { 1, 49, 0 } } },
- { { { 33, 0, 1 }, { 0, 33, 1 }, { 19, 62, 0 }, { 0, 50, 0 } } },
- { { { 33, 0, 2 }, { 0, 33, 2 }, { 19, 63, 0 }, { 1, 50, 0 } } },
- { { { 34, 0, 1 }, { 0, 34, 1 }, { 20, 62, 0 }, { 8, 47, 0 } } },
- { { { 34, 0, 0 }, { 0, 34, 0 }, { 28, 47, 0 }, { 0, 51, 0 } } },
- { { { 34, 0, 1 }, { 0, 34, 1 }, { 20, 63, 0 }, { 1, 51, 0 } } },
- { { { 34, 0, 2 }, { 0, 34, 2 }, { 21, 62, 0 }, { 0, 52, 0 } } },
- { { { 35, 0, 1 }, { 0, 35, 1 }, { 21, 63, 0 }, { 11, 47, 0 } } },
- { { { 35, 0, 0 }, { 0, 35, 0 }, { 30, 46, 0 }, { 1, 52, 0 } } },
- { { { 35, 0, 1 }, { 0, 35, 1 }, { 22, 62, 0 }, { 0, 53, 0 } } },
- { { { 35, 0, 2 }, { 0, 35, 2 }, { 22, 63, 0 }, { 1, 53, 0 } } },
- { { { 36, 0, 1 }, { 0, 36, 1 }, { 23, 62, 0 }, { 14, 47, 0 } } },
- { { { 36, 0, 0 }, { 0, 36, 0 }, { 31, 47, 0 }, { 0, 54, 0 } } },
- { { { 36, 0, 1 }, { 0, 36, 1 }, { 23, 63, 0 }, { 1, 54, 0 } } },
- { { { 36, 0, 2 }, { 0, 36, 2 }, { 24, 62, 0 }, { 0, 55, 0 } } },
- { { { 37, 0, 1 }, { 0, 37, 1 }, { 24, 63, 0 }, { 17, 47, 0 } } },
- { { { 37, 0, 0 }, { 0, 37, 0 }, { 32, 47, 0 }, { 1, 55, 0 } } },
- { { { 37, 0, 1 }, { 0, 37, 1 }, { 25, 62, 0 }, { 0, 56, 0 } } },
- { { { 37, 0, 2 }, { 0, 37, 2 }, { 25, 63, 0 }, { 1, 56, 0 } } },
- { { { 38, 0, 1 }, { 0, 38, 1 }, { 26, 62, 0 }, { 17, 48, 0 } } },
- { { { 38, 0, 0 }, { 0, 38, 0 }, { 32, 50, 0 }, { 0, 57, 0 } } },
- { { { 38, 0, 1 }, { 0, 38, 1 }, { 26, 63, 0 }, { 1, 57, 0 } } },
- { { { 38, 0, 2 }, { 0, 38, 2 }, { 27, 62, 0 }, { 0, 58, 0 } } },
- { { { 39, 0, 1 }, { 0, 39, 1 }, { 27, 63, 0 }, { 16, 50, 0 } } },
- { { { 39, 0, 0 }, { 0, 39, 0 }, { 32, 53, 0 }, { 1, 58, 0 } } },
- { { { 39, 0, 1 }, { 0, 39, 1 }, { 28, 62, 0 }, { 0, 59, 0 } } },
- { { { 39, 0, 2 }, { 0, 39, 2 }, { 28, 63, 0 }, { 1, 59, 0 } } },
- { { { 40, 0, 1 }, { 0, 40, 1 }, { 29, 62, 0 }, { 17, 51, 0 } } },
- { { { 40, 0, 0 }, { 0, 40, 0 }, { 32, 56, 0 }, { 0, 60, 0 } } },
- { { { 40, 0, 1 }, { 0, 40, 1 }, { 29, 63, 0 }, { 1, 60, 0 } } },
- { { { 40, 0, 2 }, { 0, 40, 2 }, { 30, 62, 0 }, { 0, 61, 0 } } },
- { { { 41, 0, 1 }, { 0, 41, 1 }, { 30, 63, 0 }, { 16, 53, 0 } } },
- { { { 41, 0, 0 }, { 0, 41, 0 }, { 32, 59, 0 }, { 1, 61, 0 } } },
- { { { 41, 0, 1 }, { 0, 41, 1 }, { 31, 62, 0 }, { 0, 62, 0 } } },
- { { { 41, 0, 2 }, { 0, 41, 2 }, { 31, 63, 0 }, { 1, 62, 0 } } },
- { { { 42, 0, 1 }, { 0, 42, 1 }, { 32, 61, 0 }, { 17, 54, 0 } } },
- { { { 42, 0, 0 }, { 0, 42, 0 }, { 32, 62, 0 }, { 0, 63, 0 } } },
- { { { 42, 0, 1 }, { 0, 42, 1 }, { 32, 63, 0 }, { 1, 63, 0 } } },
- { { { 42, 0, 2 }, { 0, 42, 2 }, { 41, 46, 0 }, { 2, 63, 0 } } },
- { { { 43, 0, 1 }, { 0, 43, 1 }, { 33, 62, 0 }, { 16, 56, 0 } } },
- { { { 43, 0, 0 }, { 0, 43, 0 }, { 33, 63, 0 }, { 3, 63, 0 } } },
- { { { 43, 0, 1 }, { 0, 43, 1 }, { 34, 62, 0 }, { 4, 63, 0 } } },
- { { { 43, 0, 2 }, { 0, 43, 2 }, { 42, 47, 0 }, { 5, 63, 0 } } },
- { { { 44, 0, 1 }, { 0, 44, 1 }, { 34, 63, 0 }, { 17, 57, 0 } } },
- { { { 44, 0, 0 }, { 0, 44, 0 }, { 35, 62, 0 }, { 6, 63, 0 } } },
- { { { 44, 0, 1 }, { 0, 44, 1 }, { 35, 63, 0 }, { 7, 63, 0 } } },
- { { { 44, 0, 2 }, { 0, 44, 2 }, { 44, 46, 0 }, { 8, 63, 0 } } },
- { { { 45, 0, 1 }, { 0, 45, 1 }, { 36, 62, 0 }, { 16, 59, 0 } } },
- { { { 45, 0, 0 }, { 0, 45, 0 }, { 36, 63, 0 }, { 9, 63, 0 } } },
- { { { 45, 0, 1 }, { 0, 45, 1 }, { 37, 62, 0 }, { 10, 63, 0 } } },
- { { { 45, 0, 2 }, { 0, 45, 2 }, { 45, 47, 0 }, { 11, 63, 0 } } },
- { { { 46, 0, 1 }, { 0, 46, 1 }, { 37, 63, 0 }, { 17, 60, 0 } } },
- { { { 46, 0, 0 }, { 0, 46, 0 }, { 38, 62, 0 }, { 12, 63, 0 } } },
- { { { 46, 0, 1 }, { 0, 46, 1 }, { 38, 63, 0 }, { 13, 63, 0 } } },
- { { { 46, 0, 2 }, { 0, 46, 2 }, { 47, 46, 0 }, { 14, 63, 0 } } },
- { { { 47, 0, 1 }, { 0, 47, 1 }, { 39, 62, 0 }, { 16, 62, 0 } } },
- { { { 47, 0, 0 }, { 0, 47, 0 }, { 39, 63, 0 }, { 15, 63, 0 } } },
- { { { 47, 0, 1 }, { 0, 47, 1 }, { 40, 62, 0 }, { 16, 63, 0 } } },
- { { { 47, 0, 2 }, { 0, 47, 2 }, { 48, 46, 0 }, { 32, 55, 0 } } },
- { { { 48, 0, 2 }, { 0, 48, 2 }, { 40, 63, 0 }, { 17, 63, 0 } } },
- { { { 48, 0, 1 }, { 0, 48, 1 }, { 41, 62, 0 }, { 18, 63, 0 } } },
- { { { 48, 0, 0 }, { 0, 48, 0 }, { 41, 63, 0 }, { 19, 63, 0 } } },
- { { { 48, 0, 1 }, { 0, 48, 1 }, { 48, 49, 0 }, { 33, 56, 0 } } },
- { { { 48, 0, 2 }, { 0, 48, 2 }, { 42, 62, 0 }, { 20, 63, 0 } } },
- { { { 49, 0, 1 }, { 0, 49, 1 }, { 42, 63, 0 }, { 21, 63, 0 } } },
- { { { 49, 0, 0 }, { 0, 49, 0 }, { 43, 62, 0 }, { 22, 63, 0 } } },
- { { { 49, 0, 1 }, { 0, 49, 1 }, { 48, 52, 0 }, { 32, 58, 0 } } },
- { { { 49, 0, 2 }, { 0, 49, 2 }, { 43, 63, 0 }, { 23, 63, 0 } } },
- { { { 50, 0, 1 }, { 0, 50, 1 }, { 44, 62, 0 }, { 24, 63, 0 } } },
- { { { 50, 0, 0 }, { 0, 50, 0 }, { 44, 63, 0 }, { 25, 63, 0 } } },
- { { { 50, 0, 1 }, { 0, 50, 1 }, { 48, 55, 0 }, { 33, 59, 0 } } },
- { { { 50, 0, 2 }, { 0, 50, 2 }, { 45, 62, 0 }, { 26, 63, 0 } } },
- { { { 51, 0, 1 }, { 0, 51, 1 }, { 45, 63, 0 }, { 27, 63, 0 } } },
- { { { 51, 0, 0 }, { 0, 51, 0 }, { 46, 62, 0 }, { 28, 63, 0 } } },
- { { { 51, 0, 1 }, { 0, 51, 1 }, { 48, 58, 0 }, { 32, 61, 0 } } },
- { { { 51, 0, 2 }, { 0, 51, 2 }, { 46, 63, 0 }, { 29, 63, 0 } } },
- { { { 52, 0, 1 }, { 0, 52, 1 }, { 47, 62, 0 }, { 30, 63, 0 } } },
- { { { 52, 0, 0 }, { 0, 52, 0 }, { 47, 63, 0 }, { 31, 63, 0 } } },
- { { { 52, 0, 1 }, { 0, 52, 1 }, { 48, 61, 0 }, { 33, 62, 0 } } },
- { { { 52, 0, 2 }, { 0, 52, 2 }, { 48, 62, 0 }, { 32, 63, 0 } } },
- { { { 53, 0, 1 }, { 0, 53, 1 }, { 56, 47, 0 }, { 33, 63, 0 } } },
- { { { 53, 0, 0 }, { 0, 53, 0 }, { 48, 63, 0 }, { 49, 55, 0 } } },
- { { { 53, 0, 1 }, { 0, 53, 1 }, { 49, 62, 0 }, { 34, 63, 0 } } },
- { { { 53, 0, 2 }, { 0, 53, 2 }, { 49, 63, 0 }, { 35, 63, 0 } } },
- { { { 54, 0, 1 }, { 0, 54, 1 }, { 58, 46, 0 }, { 36, 63, 0 } } },
- { { { 54, 0, 0 }, { 0, 54, 0 }, { 50, 62, 0 }, { 48, 57, 0 } } },
- { { { 54, 0, 1 }, { 0, 54, 1 }, { 50, 63, 0 }, { 37, 63, 0 } } },
- { { { 54, 0, 2 }, { 0, 54, 2 }, { 51, 62, 0 }, { 38, 63, 0 } } },
- { { { 55, 0, 1 }, { 0, 55, 1 }, { 59, 47, 0 }, { 39, 63, 0 } } },
- { { { 55, 0, 0 }, { 0, 55, 0 }, { 51, 63, 0 }, { 49, 58, 0 } } },
- { { { 55, 0, 1 }, { 0, 55, 1 }, { 52, 62, 0 }, { 40, 63, 0 } } },
- { { { 55, 0, 2 }, { 0, 55, 2 }, { 52, 63, 0 }, { 41, 63, 0 } } },
- { { { 56, 0, 1 }, { 0, 56, 1 }, { 61, 46, 0 }, { 42, 63, 0 } } },
- { { { 56, 0, 0 }, { 0, 56, 0 }, { 53, 62, 0 }, { 48, 60, 0 } } },
- { { { 56, 0, 1 }, { 0, 56, 1 }, { 53, 63, 0 }, { 43, 63, 0 } } },
- { { { 56, 0, 2 }, { 0, 56, 2 }, { 54, 62, 0 }, { 44, 63, 0 } } },
- { { { 57, 0, 1 }, { 0, 57, 1 }, { 62, 47, 0 }, { 45, 63, 0 } } },
- { { { 57, 0, 0 }, { 0, 57, 0 }, { 54, 63, 0 }, { 49, 61, 0 } } },
- { { { 57, 0, 1 }, { 0, 57, 1 }, { 55, 62, 0 }, { 46, 63, 0 } } },
- { { { 57, 0, 2 }, { 0, 57, 2 }, { 55, 63, 0 }, { 47, 63, 0 } } },
- { { { 58, 0, 1 }, { 0, 58, 1 }, { 56, 62, 1 }, { 48, 63, 1 } } },
- { { { 58, 0, 0 }, { 0, 58, 0 }, { 56, 62, 0 }, { 48, 63, 0 } } },
- { { { 58, 0, 1 }, { 0, 58, 1 }, { 56, 63, 0 }, { 49, 63, 0 } } },
- { { { 58, 0, 2 }, { 0, 58, 2 }, { 57, 62, 0 }, { 50, 63, 0 } } },
- { { { 59, 0, 1 }, { 0, 59, 1 }, { 57, 63, 1 }, { 51, 63, 1 } } },
- { { { 59, 0, 0 }, { 0, 59, 0 }, { 57, 63, 0 }, { 51, 63, 0 } } },
- { { { 59, 0, 1 }, { 0, 59, 1 }, { 58, 62, 0 }, { 52, 63, 0 } } },
- { { { 59, 0, 2 }, { 0, 59, 2 }, { 58, 63, 0 }, { 53, 63, 0 } } },
- { { { 60, 0, 1 }, { 0, 60, 1 }, { 59, 62, 1 }, { 54, 63, 1 } } },
- { { { 60, 0, 0 }, { 0, 60, 0 }, { 59, 62, 0 }, { 54, 63, 0 } } },
- { { { 60, 0, 1 }, { 0, 60, 1 }, { 59, 63, 0 }, { 55, 63, 0 } } },
- { { { 60, 0, 2 }, { 0, 60, 2 }, { 60, 62, 0 }, { 56, 63, 0 } } },
- { { { 61, 0, 1 }, { 0, 61, 1 }, { 60, 63, 1 }, { 57, 63, 1 } } },
- { { { 61, 0, 0 }, { 0, 61, 0 }, { 60, 63, 0 }, { 57, 63, 0 } } },
- { { { 61, 0, 1 }, { 0, 61, 1 }, { 61, 62, 0 }, { 58, 63, 0 } } },
- { { { 61, 0, 2 }, { 0, 61, 2 }, { 61, 63, 0 }, { 59, 63, 0 } } },
- { { { 62, 0, 1 }, { 0, 62, 1 }, { 62, 62, 1 }, { 60, 63, 1 } } },
- { { { 62, 0, 0 }, { 0, 62, 0 }, { 62, 62, 0 }, { 60, 63, 0 } } },
- { { { 62, 0, 1 }, { 0, 62, 1 }, { 62, 63, 0 }, { 61, 63, 0 } } },
- { { { 62, 0, 2 }, { 0, 62, 2 }, { 63, 62, 0 }, { 62, 63, 0 } } },
- { { { 63, 0, 1 }, { 0, 63, 1 }, { 63, 63, 1 }, { 63, 63, 1 } } },
- { { { 63, 0, 0 }, { 0, 63, 0 }, { 63, 63, 0 }, { 63, 63, 0 } } }
-};
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/squish.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/squish.cpp
deleted file mode 100644
index 6d9270e8..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/squish.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include <squish.h>
-#include "colourset.h"
-#include "maths.h"
-#include "rangefit.h"
-#include "clusterfit.h"
-#include "colourblock.h"
-#include "alpha.h"
-#include "singlecolourfit.h"
-
-namespace squish {
-
-static int FixFlags( int flags )
-{
- // grab the flag bits
- int method = flags & ( kDxt1 | kDxt3 | kDxt5 );
- int fit = flags & ( kColourClusterFit | kColourRangeFit );
- int metric = flags & ( kColourMetricPerceptual | kColourMetricUniform );
- int extra = flags & kWeightColourByAlpha;
-
- // set defaults
- if( method != kDxt3 && method != kDxt5 )
- method = kDxt1;
- if( fit != kColourRangeFit )
- fit = kColourClusterFit;
- if( metric != kColourMetricUniform )
- metric = kColourMetricPerceptual;
-
- // done
- return method | fit | metric | extra;
-}
-
-
-void Compress( u8 const* rgba, void* block, int flags )
-{
- // fix any bad flags
- flags = FixFlags( flags );
-
- // get the block locations
- void* colourBlock = block;
- void* alphaBock = block;
- if( ( flags & ( kDxt3 | kDxt5 ) ) != 0 )
- colourBlock = reinterpret_cast< u8* >( block ) + 8;
-
- // create the minimal point set
- ColourSet colours( rgba, flags );
-
- // check the compression type and compress colour
- if( colours.GetCount() == 1 )
- {
- // always do a single colour fit
- SingleColourFit fit( &colours, flags );
- fit.Compress( colourBlock );
- }
- else if( ( flags & kColourRangeFit ) != 0 )
- {
- // do a range fit
- RangeFit fit( &colours, flags );
- fit.Compress( colourBlock );
- }
- else
- {
- // default to a cluster fit
- ClusterFit fit( &colours, flags );
- fit.Compress( colourBlock );
- }
-
- // compress alpha separately if necessary
- if( ( flags & kDxt3 ) != 0 )
- CompressAlphaDxt3( rgba, alphaBock );
- else if( ( flags & kDxt5 ) != 0 )
- CompressAlphaDxt5( rgba, alphaBock );
-}
-
-
-void Decompress( u8* rgba, void const* block, int flags )
-{
- // fix any bad flags
- flags = FixFlags( flags );
-
- // get the block locations
- void const* colourBlock = block;
- void const* alphaBock = block;
- if( ( flags & ( kDxt3 | kDxt5 ) ) != 0 )
- colourBlock = reinterpret_cast< u8 const* >( block ) + 8;
-
- // decompress colour
- DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
-
- // decompress alpha separately if necessary
- if( ( flags & kDxt3 ) != 0 )
- DecompressAlphaDxt3( rgba, alphaBock );
- else if( ( flags & kDxt5 ) != 0 )
- DecompressAlphaDxt5( rgba, alphaBock );
-}
-
-int GetStorageRequirements( int width, int height, int flags )
-{
- // fix any bad flags
- flags = FixFlags( flags );
-
- // compute the storage requirements
- int blockcount = ( ( width + 3 )/4 ) * ( ( height + 3 )/4 );
- int blocksize = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16;
- return blockcount*blocksize;
-}
-
-void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags )
-{
- // fix any bad flags
- flags = FixFlags( flags );
-
- // initialise the block output
- u8* targetBlock = reinterpret_cast< u8* >( blocks );
- int bytesPerBlock = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16;
-
- int bh = std::min(width, 4);
- int bw = std::min(height, 4);
-
- // loop over blocks
- for( int y = 0; y < height; y += 4 )
- {
- for( int x = 0; x < width; x += 4 )
- {
- // build the 4x4 block of pixels
- u8 sourceRgba[16*4];
- u8* targetPixel = sourceRgba;
- for( int py = 0; py < 4; ++py )
- {
- for( int px = 0; px < 4; ++px )
- {
- // get the source pixel in the image
- int sx = x + (px % bw);
- int sy = y + (py % bh);
-
- // copy the rgba value
- u8 const* sourcePixel = rgba + 4*( width*sy + sx );
- for( int i = 0; i < 4; ++i )
- *targetPixel++ = *sourcePixel++;
- }
- }
-
- // compress it into the output
- Compress( sourceRgba, targetBlock, flags );
-
- // advance
- targetBlock += bytesPerBlock;
- }
- }
-}
-
-void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags )
-{
- // fix any bad flags
- flags = FixFlags( flags );
-
- // initialise the block input
- u8 const* sourceBlock = reinterpret_cast< u8 const* >( blocks );
- int bytesPerBlock = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16;
-
- // loop over blocks
- for( int y = 0; y < height; y += 4 )
- {
- for( int x = 0; x < width; x += 4 )
- {
- // decompress the block
- u8 targetRgba[4*16];
- Decompress( targetRgba, sourceBlock, flags );
-
- // write the decompressed pixels to the correct image locations
- u8 const* sourcePixel = targetRgba;
- for( int py = 0; py < 4; ++py )
- {
- for( int px = 0; px < 4; ++px )
- {
- // get the target location
- int sx = x + px;
- int sy = y + py;
- if( sx < width && sy < height )
- {
- u8* targetPixel = rgba + 4*( width*sy + sx );
-
- // copy the rgba value
- for( int i = 0; i < 4; ++i )
- *targetPixel++ = *sourcePixel++;
- }
- else
- {
- // skip this pixel as its outside the image
- sourcePixel += 4;
- }
- }
- }
-
- // advance
- sourceBlock += bytesPerBlock;
- }
- }
-}
-
-} // namespace squish
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/squish.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/squish.h
deleted file mode 100644
index 3dfd79a9..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/squish.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef NV_SQUISH_H
-#define NV_SQUISH_H
-
-//! All squish API functions live in this namespace.
-namespace nvsquish {
-
-// -----------------------------------------------------------------------------
-
-//! Typedef a quantity that is a single unsigned byte.
-typedef unsigned char u8;
-
-// -----------------------------------------------------------------------------
-
-enum
-{
- //! Use DXT1 compression.
- kDxt1 = ( 1 << 0 ),
-
- //! Use DXT3 compression.
- kDxt3 = ( 1 << 1 ),
-
- //! Use DXT5 compression.
- kDxt5 = ( 1 << 2 ),
-
- //! Use a slow but high quality colour compressor (the default).
- kColourClusterFit = ( 1 << 3 ),
-
- //! Use a fast but low quality colour compressor.
- kColourRangeFit = ( 1 << 4 ),
-
- //! Use a perceptual metric for colour error (the default).
- kColourMetricPerceptual = ( 1 << 5 ),
-
- //! Use a uniform metric for colour error.
- kColourMetricUniform = ( 1 << 6 ),
-
- //! Weight the colour by alpha during cluster fit (disabled by default).
- kWeightColourByAlpha = ( 1 << 7 )
-};
-
-// -----------------------------------------------------------------------------
-
-/*! @brief Compresses a 4x4 block of pixels.
-
- @param rgba The rgba values of the 16 source pixels.
- @param block Storage for the compressed DXT block.
- @param flags Compression flags.
-
- The source pixels should be presented as a contiguous array of 16 rgba
- values, with each component as 1 byte each. In memory this should be:
-
- { r1, g1, b1, a1, .... , r16, g16, b16, a16 }
-
- The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
- however, DXT1 will be used by default if none is specified. When using DXT1
- compression, 8 bytes of storage are required for the compressed DXT block.
- DXT3 and DXT5 compression require 16 bytes of storage per block.
-
- The flags parameter can also specify a preferred colour compressor and
- colour error metric to use when fitting the RGB components of the data.
- Possible colour compressors are: kColourClusterFit (the default) or
- kColourRangeFit. Possible colour error metrics are: kColourMetricPerceptual
- (the default) or kColourMetricUniform. If no flags are specified in any
- particular category then the default will be used. Unknown flags are
- ignored.
-
- When using kColourClusterFit, an additional flag can be specified to
- weight the colour of each pixel by its alpha value. For images that are
- rendered using alpha blending, this can significantly increase the
- perceived quality.
-*/
-void Compress( u8 const* rgba, void* block, int flags );
-
-// -----------------------------------------------------------------------------
-
-/*! @brief Compresses a 4x4 block of pixels.
-
- @param rgba The rgba values of the 16 source pixels.
- @param mask The valid pixel mask.
- @param block Storage for the compressed DXT block.
- @param flags Compression flags.
-
- The source pixels should be presented as a contiguous array of 16 rgba
- values, with each component as 1 byte each. In memory this should be:
-
- { r1, g1, b1, a1, .... , r16, g16, b16, a16 }
-
- The mask parameter enables only certain pixels within the block. The lowest
- bit enables the first pixel and so on up to the 16th bit. Bits beyond the
- 16th bit are ignored. Pixels that are not enabled are allowed to take
- arbitrary colours in the output block. An example of how this can be used
- is in the CompressImage function to disable pixels outside the bounds of
- the image when the width or height is not divisible by 4.
-
- The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
- however, DXT1 will be used by default if none is specified. When using DXT1
- compression, 8 bytes of storage are required for the compressed DXT block.
- DXT3 and DXT5 compression require 16 bytes of storage per block.
-
- The flags parameter can also specify a preferred colour compressor and
- colour error metric to use when fitting the RGB components of the data.
- Possible colour compressors are: kColourClusterFit (the default) or
- kColourRangeFit. Possible colour error metrics are: kColourMetricPerceptual
- (the default) or kColourMetricUniform. If no flags are specified in any
- particular category then the default will be used. Unknown flags are
- ignored.
-
- When using kColourClusterFit, an additional flag can be specified to
- weight the colour of each pixel by its alpha value. For images that are
- rendered using alpha blending, this can significantly increase the
- perceived quality.
-*/
-void CompressMasked( u8 const* rgba, int mask, void* block, int flags );
-
-// -----------------------------------------------------------------------------
-
-/*! @brief Decompresses a 4x4 block of pixels.
-
- @param rgba Storage for the 16 decompressed pixels.
- @param block The compressed DXT block.
- @param flags Compression flags.
-
- The decompressed pixels will be written as a contiguous array of 16 rgba
- values, with each component as 1 byte each. In memory this is:
-
- { r1, g1, b1, a1, .... , r16, g16, b16, a16 }
-
- The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
- however, DXT1 will be used by default if none is specified. All other flags
- are ignored.
-*/
-void Decompress( u8* rgba, void const* block, int flags );
-
-// -----------------------------------------------------------------------------
-
-/*! @brief Computes the amount of compressed storage required.
-
- @param width The width of the image.
- @param height The height of the image.
- @param flags Compression flags.
-
- The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
- however, DXT1 will be used by default if none is specified. All other flags
- are ignored.
-
- Most DXT images will be a multiple of 4 in each dimension, but this
- function supports arbitrary size images by allowing the outer blocks to
- be only partially used.
-*/
-int GetStorageRequirements( int width, int height, int flags );
-
-// -----------------------------------------------------------------------------
-
-/*! @brief Compresses an image in memory.
-
- @param rgba The pixels of the source.
- @param width The width of the source image.
- @param height The height of the source image.
- @param blocks Storage for the compressed output.
- @param flags Compression flags.
-
- The source pixels should be presented as a contiguous array of width*height
- rgba values, with each component as 1 byte each. In memory this should be:
-
- { r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height
-
- The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
- however, DXT1 will be used by default if none is specified. When using DXT1
- compression, 8 bytes of storage are required for each compressed DXT block.
- DXT3 and DXT5 compression require 16 bytes of storage per block.
-
- The flags parameter can also specify a preferred colour compressor and
- colour error metric to use when fitting the RGB components of the data.
- Possible colour compressors are: kColourClusterFit (the default) or
- kColourRangeFit. Possible colour error metrics are: kColourMetricPerceptual
- (the default) or kColourMetricUniform. If no flags are specified in any
- particular category then the default will be used. Unknown flags are
- ignored.
-
- When using kColourClusterFit, an additional flag can be specified to
- weight the colour of each pixel by its alpha value. For images that are
- rendered using alpha blending, this can significantly increase the
- perceived quality.
-
- Internally this function calls squish::Compress for each block. To see how
- much memory is required in the compressed image, use
- squish::GetStorageRequirements.
-*/
-void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags );
-
-// -----------------------------------------------------------------------------
-
-/*! @brief Decompresses an image in memory.
-
- @param rgba Storage for the decompressed pixels.
- @param width The width of the source image.
- @param height The height of the source image.
- @param blocks The compressed DXT blocks.
- @param flags Compression flags.
-
- The decompressed pixels will be written as a contiguous array of width*height
- 16 rgba values, with each component as 1 byte each. In memory this is:
-
- { r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height
-
- The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
- however, DXT1 will be used by default if none is specified. All other flags
- are ignored.
-
- Internally this function calls squish::Decompress for each block.
-*/
-void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags );
-
-// -----------------------------------------------------------------------------
-
-} // namespace squish
-
-#endif // ndef SQUISH_H
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/weightedclusterfit.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/weightedclusterfit.cpp
deleted file mode 100644
index f3781b15..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/weightedclusterfit.cpp
+++ /dev/null
@@ -1,593 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
- Copyright (c) 2006 Ignacio Castano icastano@nvidia.com
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#include "weightedclusterfit.h"
-#include "colourset.h"
-#include "colourblock.h"
-#include <cfloat>
-
-
-namespace nvsquish {
-
-WeightedClusterFit::WeightedClusterFit()
-{
-}
-
-void WeightedClusterFit::SetColourSet( ColourSet const* colours, int flags )
-{
- ColourFit::SetColourSet( colours, flags );
-
- // initialise the best error
-#if SQUISH_USE_SIMD
- m_besterror = VEC4_CONST( FLT_MAX );
- Vec3 metric = m_metric.GetVec3();
-#else
- m_besterror = FLT_MAX;
- Vec3 metric = m_metric;
-#endif
-
- // cache some values
- int const count = m_colours->GetCount();
- Vec3 const* values = m_colours->GetPoints();
-
- // get the covariance matrix
- Sym3x3 covariance = ComputeWeightedCovariance( count, values, m_colours->GetWeights(), metric );
-
- // compute the principle component
- Vec3 principle = ComputePrincipleComponent( covariance );
-
- // build the list of values
- float dps[16];
- for( int i = 0; i < count; ++i )
- {
- dps[i] = Dot( values[i], principle );
- m_order[i] = i;
- }
-
- // stable sort
- for( int i = 0; i < count; ++i )
- {
- for( int j = i; j > 0 && dps[j] < dps[j - 1]; --j )
- {
- std::swap( dps[j], dps[j - 1] );
- std::swap( m_order[j], m_order[j - 1] );
- }
- }
-
- // weight all the points
-#if SQUISH_USE_SIMD
- Vec4 const* unweighted = m_colours->GetPointsSimd();
- Vec4 const* weights = m_colours->GetWeightsSimd();
- m_xxsum = VEC4_CONST( 0.0f );
- m_xsum = VEC4_CONST( 0.0f );
-#else
- Vec3 const* unweighted = m_colours->GetPoints();
- float const* weights = m_colours->GetWeights();
- m_xxsum = Vec3( 0.0f );
- m_xsum = Vec3( 0.0f );
- m_wsum = 0.0f;
-#endif
-
- for( int i = 0; i < count; ++i )
- {
- int p = m_order[i];
- m_weighted[i] = weights[p] * unweighted[p];
- m_xxsum += m_weighted[i] * m_weighted[i];
- m_xsum += m_weighted[i];
-#if !SQUISH_USE_SIMD
- m_weights[i] = weights[p];
- m_wsum += m_weights[i];
-#endif
- }
-}
-
-
-void WeightedClusterFit::SetMetric(float r, float g, float b)
-{
-#if SQUISH_USE_SIMD
- m_metric = Vec4(r, g, b, 0);
-#else
- m_metric = Vec3(r, g, b);
-#endif
- m_metricSqr = m_metric * m_metric;
-}
-
-float WeightedClusterFit::GetBestError() const
-{
-#if SQUISH_USE_SIMD
- Vec4 x = m_xxsum * m_metricSqr;
- Vec4 error = m_besterror + x.SplatX() + x.SplatY() + x.SplatZ();
- return error.GetVec3().X();
-#else
- return m_besterror + Dot(m_xxsum, m_metricSqr);
-#endif
-
-}
-
-#if SQUISH_USE_SIMD
-
-void WeightedClusterFit::Compress3( void* block )
-{
- int const count = m_colours->GetCount();
- Vec4 const one = VEC4_CONST(1.0f);
- Vec4 const zero = VEC4_CONST(0.0f);
- Vec4 const half(0.5f, 0.5f, 0.5f, 0.25f);
- Vec4 const two = VEC4_CONST(2.0);
- Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f );
- Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f );
-
- // declare variables
- Vec4 beststart = VEC4_CONST( 0.0f );
- Vec4 bestend = VEC4_CONST( 0.0f );
- Vec4 besterror = VEC4_CONST( FLT_MAX );
-
- Vec4 x0 = zero;
-
- int b0 = 0, b1 = 0;
-
- // check all possible clusters for this total order
- for( int c0 = 0; c0 <= count; c0++)
- {
- Vec4 x1 = zero;
-
- for( int c1 = 0; c1 <= count-c0; c1++)
- {
- Vec4 const x2 = m_xsum - x1 - x0;
-
- //Vec3 const alphax_sum = x0 + x1 * 0.5f;
- //float const alpha2_sum = w0 + w1 * 0.25f;
- Vec4 const alphax_sum = MultiplyAdd(x1, half, x0); // alphax_sum, alpha2_sum
- Vec4 const alpha2_sum = alphax_sum.SplatW();
-
- //Vec3 const betax_sum = x2 + x1 * 0.5f;
- //float const beta2_sum = w2 + w1 * 0.25f;
- Vec4 const betax_sum = MultiplyAdd(x1, half, x2); // betax_sum, beta2_sum
- Vec4 const beta2_sum = betax_sum.SplatW();
-
- //float const alphabeta_sum = w1 * 0.25f;
- Vec4 const alphabeta_sum = (x1 * half).SplatW(); // alphabeta_sum
-
- // float const factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
- Vec4 const factor = Reciprocal( NegativeMultiplySubtract(alphabeta_sum, alphabeta_sum, alpha2_sum*beta2_sum) );
-
- Vec4 a = NegativeMultiplySubtract(betax_sum, alphabeta_sum, alphax_sum*beta2_sum) * factor;
- Vec4 b = NegativeMultiplySubtract(alphax_sum, alphabeta_sum, betax_sum*alpha2_sum) * factor;
-
- // clamp to the grid
- a = Min( one, Max( zero, a ) );
- b = Min( one, Max( zero, b ) );
- a = Truncate( MultiplyAdd( grid, a, half ) ) * gridrcp;
- b = Truncate( MultiplyAdd( grid, b, half ) ) * gridrcp;
-
- // compute the error (we skip the constant xxsum)
- Vec4 e1 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum );
- Vec4 e2 = NegativeMultiplySubtract( a, alphax_sum, a*b*alphabeta_sum );
- Vec4 e3 = NegativeMultiplySubtract( b, betax_sum, e2 );
- Vec4 e4 = MultiplyAdd( two, e3, e1 );
-
- // apply the metric to the error term
- Vec4 e5 = e4 * m_metricSqr;
- Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ();
-
- // keep the solution if it wins
- if( CompareAnyLessThan( error, besterror ) )
- {
- besterror = error;
- beststart = a;
- bestend = b;
- b0 = c0;
- b1 = c1;
- }
-
- x1 += m_weighted[c0+c1];
- }
-
- x0 += m_weighted[c0];
- }
-
- // save the block if necessary
- if( CompareAnyLessThan( besterror, m_besterror ) )
- {
- // compute indices from cluster sizes.
- u8 bestindices[16];
- {
- int i = 0;
- for(; i < b0; i++) {
- bestindices[i] = 0;
- }
- for(; i < b0+b1; i++) {
- bestindices[i] = 2;
- }
- for(; i < count; i++) {
- bestindices[i] = 1;
- }
- }
-
- // remap the indices
- u8 ordered[16];
- for( int i = 0; i < count; ++i )
- ordered[m_order[i]] = bestindices[i];
-
- m_colours->RemapIndices( ordered, bestindices );
-
-
- // save the block
- WriteColourBlock3( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );
-
- // save the error
- m_besterror = besterror;
- }
-}
-
-void WeightedClusterFit::Compress4( void* block )
-{
- int const count = m_colours->GetCount();
- Vec4 const one = VEC4_CONST(1.0f);
- Vec4 const zero = VEC4_CONST(0.0f);
- Vec4 const half = VEC4_CONST(0.5f);
- Vec4 const two = VEC4_CONST(2.0);
- Vec4 const onethird( 1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f, 1.0f/9.0f );
- Vec4 const twothirds( 2.0f/3.0f, 2.0f/3.0f, 2.0f/3.0f, 4.0f/9.0f );
- Vec4 const twonineths = VEC4_CONST( 2.0f/9.0f );
- Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f );
- Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f );
-
- // declare variables
- Vec4 beststart = VEC4_CONST( 0.0f );
- Vec4 bestend = VEC4_CONST( 0.0f );
- Vec4 besterror = VEC4_CONST( FLT_MAX );
-
- Vec4 x0 = zero;
- int b0 = 0, b1 = 0, b2 = 0;
-
- // check all possible clusters for this total order
- for( int c0 = 0; c0 <= count; c0++)
- {
- Vec4 x1 = zero;
-
- for( int c1 = 0; c1 <= count-c0; c1++)
- {
- Vec4 x2 = zero;
-
- for( int c2 = 0; c2 <= count-c0-c1; c2++)
- {
- Vec4 const x3 = m_xsum - x2 - x1 - x0;
-
- //Vec3 const alphax_sum = x0 + x1 * (2.0f / 3.0f) + x2 * (1.0f / 3.0f);
- //float const alpha2_sum = w0 + w1 * (4.0f/9.0f) + w2 * (1.0f/9.0f);
- Vec4 const alphax_sum = MultiplyAdd(x2, onethird, MultiplyAdd(x1, twothirds, x0)); // alphax_sum, alpha2_sum
- Vec4 const alpha2_sum = alphax_sum.SplatW();
-
- //Vec3 const betax_sum = x3 + x2 * (2.0f / 3.0f) + x1 * (1.0f / 3.0f);
- //float const beta2_sum = w3 + w2 * (4.0f/9.0f) + w1 * (1.0f/9.0f);
- Vec4 const betax_sum = MultiplyAdd(x2, twothirds, MultiplyAdd(x1, onethird, x3)); // betax_sum, beta2_sum
- Vec4 const beta2_sum = betax_sum.SplatW();
-
- //float const alphabeta_sum = (w1 + w2) * (2.0f/9.0f);
- Vec4 const alphabeta_sum = twonineths*( x1 + x2 ).SplatW(); // alphabeta_sum
-
- // float const factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
- Vec4 const factor = Reciprocal( NegativeMultiplySubtract(alphabeta_sum, alphabeta_sum, alpha2_sum*beta2_sum) );
-
- Vec4 a = NegativeMultiplySubtract(betax_sum, alphabeta_sum, alphax_sum*beta2_sum) * factor;
- Vec4 b = NegativeMultiplySubtract(alphax_sum, alphabeta_sum, betax_sum*alpha2_sum) * factor;
-
- // clamp to the grid
- a = Min( one, Max( zero, a ) );
- b = Min( one, Max( zero, b ) );
- a = Truncate( MultiplyAdd( grid, a, half ) ) * gridrcp;
- b = Truncate( MultiplyAdd( grid, b, half ) ) * gridrcp;
-
- // compute the error (we skip the constant xxsum)
- Vec4 e1 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum );
- Vec4 e2 = NegativeMultiplySubtract( a, alphax_sum, a*b*alphabeta_sum );
- Vec4 e3 = NegativeMultiplySubtract( b, betax_sum, e2 );
- Vec4 e4 = MultiplyAdd( two, e3, e1 );
-
- // apply the metric to the error term
- Vec4 e5 = e4 * m_metricSqr;
- Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ();
-
- // keep the solution if it wins
- if( CompareAnyLessThan( error, besterror ) )
- {
- besterror = error;
- beststart = a;
- bestend = b;
- b0 = c0;
- b1 = c1;
- b2 = c2;
- }
-
- x2 += m_weighted[c0+c1+c2];
- }
-
- x1 += m_weighted[c0+c1];
- }
-
- x0 += m_weighted[c0];
- }
-
- // save the block if necessary
- if( CompareAnyLessThan( besterror, m_besterror ) )
- {
- // compute indices from cluster sizes.
- u8 bestindices[16];
- {
- int i = 0;
- for(; i < b0; i++) {
- bestindices[i] = 0;
- }
- for(; i < b0+b1; i++) {
- bestindices[i] = 2;
- }
- for(; i < b0+b1+b2; i++) {
- bestindices[i] = 3;
- }
- for(; i < count; i++) {
- bestindices[i] = 1;
- }
- }
-
- // remap the indices
- u8 ordered[16];
- for( int i = 0; i < count; ++i )
- ordered[m_order[i]] = bestindices[i];
-
- m_colours->RemapIndices( ordered, bestindices );
-
- // save the block
- WriteColourBlock4( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );
-
- // save the error
- m_besterror = besterror;
- }
-}
-
-#else
-
-void WeightedClusterFit::Compress3( void* block )
-{
- int const count = m_colours->GetCount();
- Vec3 const one( 1.0f );
- Vec3 const zero( 0.0f );
- Vec3 const half( 0.5f );
- Vec3 const grid( 31.0f, 63.0f, 31.0f );
- Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f );
-
- // declare variables
- Vec3 beststart( 0.0f );
- Vec3 bestend( 0.0f );
- float besterror = FLT_MAX;
-
- Vec3 x0(0.0f);
- float w0 = 0.0f;
-
- int b0 = 0, b1 = 0;
-
- // check all possible clusters for this total order
- for( int c0 = 0; c0 <= count; c0++)
- {
- Vec3 x1(0.0f);
- float w1 = 0.0f;
-
- for( int c1 = 0; c1 <= count-c0; c1++)
- {
- float w2 = m_wsum - w0 - w1;
-
- // These factors could be entirely precomputed.
- float const alpha2_sum = w0 + w1 * 0.25f;
- float const beta2_sum = w2 + w1 * 0.25f;
- float const alphabeta_sum = w1 * 0.25f;
- float const factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- Vec3 const alphax_sum = x0 + x1 * 0.5f;
- Vec3 const betax_sum = m_xsum - alphax_sum;
-
- Vec3 a = (alphax_sum*beta2_sum - betax_sum*alphabeta_sum) * factor;
- Vec3 b = (betax_sum*alpha2_sum - alphax_sum*alphabeta_sum) * factor;
-
- // clamp to the grid
- a = Min( one, Max( zero, a ) );
- b = Min( one, Max( zero, b ) );
- a = Floor( grid*a + half )*gridrcp;
- b = Floor( grid*b + half )*gridrcp;
-
- // compute the error
- Vec3 e1 = a*a*alpha2_sum + b*b*beta2_sum + 2.0f*( a*b*alphabeta_sum - a*alphax_sum - b*betax_sum );
-
- // apply the metric to the error term
- float error = Dot( e1, m_metricSqr );
-
- // keep the solution if it wins
- if( error < besterror )
- {
- besterror = error;
- beststart = a;
- bestend = b;
- b0 = c0;
- b1 = c1;
- }
-
- x1 += m_weighted[c0+c1];
- w1 += m_weights[c0+c1];
- }
-
- x0 += m_weighted[c0];
- w0 += m_weights[c0];
- }
-
- // save the block if necessary
- if( besterror < m_besterror )
- {
- // compute indices from cluster sizes.
- u8 bestindices[16];
- {
- int i = 0;
- for(; i < b0; i++) {
- bestindices[i] = 0;
- }
- for(; i < b0+b1; i++) {
- bestindices[i] = 2;
- }
- for(; i < count; i++) {
- bestindices[i] = 1;
- }
- }
-
- // remap the indices
- u8 ordered[16];
- for( int i = 0; i < count; ++i )
- ordered[m_order[i]] = bestindices[i];
-
- m_colours->RemapIndices( ordered, bestindices );
-
- // save the block
- WriteColourBlock3( beststart, bestend, bestindices, block );
-
- // save the error
- m_besterror = besterror;
- }
-}
-
-void WeightedClusterFit::Compress4( void* block )
-{
- int const count = m_colours->GetCount();
- Vec3 const one( 1.0f );
- Vec3 const zero( 0.0f );
- Vec3 const half( 0.5f );
- Vec3 const grid( 31.0f, 63.0f, 31.0f );
- Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f );
-
- // declare variables
- Vec3 beststart( 0.0f );
- Vec3 bestend( 0.0f );
- float besterror = FLT_MAX;
-
- Vec3 x0(0.0f);
- float w0 = 0.0f;
- int b0 = 0, b1 = 0, b2 = 0;
-
- // check all possible clusters for this total order
- for( int c0 = 0; c0 <= count; c0++)
- {
- Vec3 x1(0.0f);
- float w1 = 0.0f;
-
- for( int c1 = 0; c1 <= count-c0; c1++)
- {
- Vec3 x2(0.0f);
- float w2 = 0.0f;
-
- for( int c2 = 0; c2 <= count-c0-c1; c2++)
- {
- float w3 = m_wsum - w0 - w1 - w2;
-
- float const alpha2_sum = w0 + w1 * (4.0f/9.0f) + w2 * (1.0f/9.0f);
- float const beta2_sum = w3 + w2 * (4.0f/9.0f) + w1 * (1.0f/9.0f);
- float const alphabeta_sum = (w1 + w2) * (2.0f/9.0f);
- float const factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum);
-
- Vec3 const alphax_sum = x0 + x1 * (2.0f / 3.0f) + x2 * (1.0f / 3.0f);
- Vec3 const betax_sum = m_xsum - alphax_sum;
-
- Vec3 a = ( alphax_sum*beta2_sum - betax_sum*alphabeta_sum )*factor;
- Vec3 b = ( betax_sum*alpha2_sum - alphax_sum*alphabeta_sum )*factor;
-
- // clamp to the grid
- a = Min( one, Max( zero, a ) );
- b = Min( one, Max( zero, b ) );
- a = Floor( grid*a + half )*gridrcp;
- b = Floor( grid*b + half )*gridrcp;
-
- // compute the error
- Vec3 e1 = a*a*alpha2_sum + b*b*beta2_sum + 2.0f*( a*b*alphabeta_sum - a*alphax_sum - b*betax_sum );
-
- // apply the metric to the error term
- float error = Dot( e1, m_metricSqr );
-
- // keep the solution if it wins
- if( error < besterror )
- {
- besterror = error;
- beststart = a;
- bestend = b;
- b0 = c0;
- b1 = c1;
- b2 = c2;
- }
-
- x2 += m_weighted[c0+c1+c2];
- w2 += m_weights[c0+c1+c2];
- }
-
- x1 += m_weighted[c0+c1];
- w1 += m_weights[c0+c1];
- }
-
- x0 += m_weighted[c0];
- w0 += m_weights[c0];
- }
-
- // save the block if necessary
- if( besterror < m_besterror )
- {
- // compute indices from cluster sizes.
- u8 bestindices[16];
- {
- int i = 0;
- for(; i < b0; i++) {
- bestindices[i] = 0;
- }
- for(; i < b0+b1; i++) {
- bestindices[i] = 2;
- }
- for(; i < b0+b1+b2; i++) {
- bestindices[i] = 3;
- }
- for(; i < count; i++) {
- bestindices[i] = 1;
- }
- }
-
- // remap the indices
- u8 ordered[16];
- for( int i = 0; i < count; ++i )
- ordered[m_order[i]] = bestindices[i];
-
- m_colours->RemapIndices( ordered, bestindices );
-
- // save the block
- WriteColourBlock4( beststart, bestend, bestindices, block );
-
- // save the error
- m_besterror = besterror;
- }
-}
-
-#endif
-
-} // namespace squish
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/weightedclusterfit.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/weightedclusterfit.h
deleted file mode 100644
index a0a45fb2..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/squish/weightedclusterfit.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
- Copyright (c) 2006 Ignacio Castano icastano@nvidia.com
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- -------------------------------------------------------------------------- */
-
-#ifndef NV_SQUISH_WEIGHTEDCLUSTERFIT_H
-#define NV_SQUISH_WEIGHTEDCLUSTERFIT_H
-
-#include "squish.h"
-#include "maths.h"
-#include "simd.h"
-#include "colourfit.h"
-
-namespace nvsquish {
-
-class WeightedClusterFit : public ColourFit
-{
-public:
- WeightedClusterFit();
-
- void SetColourSet( ColourSet const* colours, int flags );
-
- void SetMetric(float r, float g, float b);
- float GetBestError() const;
-
- // Make them public
- virtual void Compress3( void* block );
- virtual void Compress4( void* block );
-
-private:
-
- Vec3 m_principle;
-
-#if SQUISH_USE_SIMD
- Vec4 m_weighted[16];
- Vec4 m_metric;
- Vec4 m_metricSqr;
- Vec4 m_xxsum;
- Vec4 m_xsum;
- Vec4 m_besterror;
-#else
- Vec3 m_weighted[16];
- float m_weights[16];
- Vec3 m_metric;
- Vec3 m_metricSqr;
- Vec3 m_xxsum;
- Vec3 m_xsum;
- float m_wsum;
- float m_besterror;
-#endif
-
- int m_order[16];
-};
-
-} // namespace squish
-
-#endif // ndef SQUISH_WEIGHTEDCLUSTERFIT_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tests/ctest.c b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tests/ctest.c
deleted file mode 100644
index a2006410..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tests/ctest.c
+++ /dev/null
@@ -1,35 +0,0 @@
-
-#include <stdio.h>
-
-#include <nvtt/nvtt_wrapper.h>
-
-
-int main(void)
-{
- NvttInputOptions inputOptions = 0;
- NvttOutputOptions outputOptions = 0;
- NvttCompressionOptions compressionOptions = 0;
-
- const unsigned int img[16*16];
-
- memset(img, 0, sizeof(unsigned int) * 16 * 16);
-
- inputOptions = nvttCreateInputOptions();
- nvttSetInputOptionsTextureLayout(inputOptions, NVTT_TextureType_2D, 16, 16, 1);
- nvttSetInputOptionsMipmapData(inputOptions, img, 16, 16, 1, 0, 0);
-
- outputOptions = nvttCreateOutputOptions();
- nvttSetOutputOptionsFileName(outputOptions, "output.dds");
-
- compressionOptions = nvttCreateCompressionOptions();
- nvttSetCompressionOptionsFormat(compressionOptions, NVTT_Format_BC1);
-
- nvttCompress(inputOptions, outputOptions, compressionOptions);
-
- nvttDestroyCompressionOptions(compressionOptions);
- nvttDestroyOutputOptions(outputOptions);
- nvttDestroyInputOptions(inputOptions);
-
- return 0;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tests/filtertest.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tests/filtertest.cpp
deleted file mode 100644
index 2cb99e09..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tests/filtertest.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-
-#include <nvimage/Filter.h>
-#include "../tools/cmdline.h"
-
-#include <math.h>
-
-using namespace nv;
-
-int main(void)
-{
-// MyAssertHandler assertHandler;
- MyMessageHandler messageHandler;
-
- BoxFilter box1(0.5);
- Kernel1 k1(box1, 2);
- k1.debugPrint(); nvDebug("\n");
-
- BoxFilter box2(1);
- Kernel1 k2(box2, 2);
- k2.debugPrint(); nvDebug("\n");
-
- BoxFilter boxr3(1);
- Kernel1 k3(boxr3, 2);
- k3.debugPrint(); nvDebug("\n");
-
- KaiserFilter kai4(5);
- kai4.setParameters(4, 2);
- Kernel1 k4(kai4, 2);
- k4.debugPrint(); nvDebug("\n");
-
-/* Kernel1 k3(3);
- Kernel1 k4(9);
- Kernel1 k5(10);
-
-// k3.initFilter(Filter::Box);
-// k4.initFilter(Filter::Box);
-// k5.initFilter(Filter::Box);
-
-// nvDebug("Box Filter:\n");
-// k3.debugPrint(); nvDebug("\n");
-// k4.debugPrint(); nvDebug("\n");
-// k5.debugPrint(); nvDebug("\n");
-
- k3.initSinc(0.75);
- k4.initSinc(0.75);
- k5.initSinc(0.75);
-
- nvDebug("Sinc Filter:\n");
- k3.debugPrint(); nvDebug("\n");
- k4.debugPrint(); nvDebug("\n");
- k5.debugPrint(); nvDebug("\n");
-
- k3.initKaiser(4, 1, 100);
- k4.initKaiser(4, 1, 100);
- k5.initKaiser(4, 1, 100);
-
- nvDebug("Kaiser Filter:\n");
- k3.debugPrint(); nvDebug("\n");
- k4.debugPrint(); nvDebug("\n");
- k5.debugPrint(); nvDebug("\n");
-
- k3.initKaiser(4, 1, 10);
- k4.initKaiser(4, 1, 10);
- k5.initKaiser(4, 1, 10);
-
- nvDebug("Kaiser Filter 2:\n");
- k3.debugPrint(); nvDebug("\n");
- k4.debugPrint(); nvDebug("\n");
- k5.debugPrint(); nvDebug("\n");
-*/
- int l_start = 4;
- int l_end = 2;
-
- BoxFilter filter;
- PolyphaseKernel kp(kai4, l_start, l_end);
-
- kp.debugPrint();
-
- return 0;
-}
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tests/stress.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tests/stress.cpp
deleted file mode 100644
index ec2d7669..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tests/stress.cpp
+++ /dev/null
@@ -1,373 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvtt/nvtt.h>
-#include <nvimage/Image.h>
-#include <nvimage/ImageIO.h>
-#include <nvimage/BlockDXT.h>
-#include <nvimage/ColorBlock.h>
-#include <nvcore/Ptr.h>
-#include <nvcore/Debug.h>
-#include <nvcore/StrLib.h>
-#include <nvcore/StdStream.h>
-#include <nvcore/TextWriter.h>
-#include <nvcore/FileSystem.h>
-
-#include <stdlib.h> // free
-#include <string.h> // memcpy
-#include <time.h> // clock
-
-
-using namespace nv;
-
-static const char * s_fileNames[] = {
- // Kodak image set
- "kodim01.png",
- "kodim02.png",
- "kodim03.png",
- "kodim04.png",
- "kodim05.png",
- "kodim06.png",
- "kodim07.png",
- "kodim08.png",
- "kodim09.png",
- "kodim10.png",
- "kodim11.png",
- "kodim12.png",
- "kodim13.png",
- "kodim14.png",
- "kodim15.png",
- "kodim16.png",
- "kodim17.png",
- "kodim18.png",
- "kodim19.png",
- "kodim20.png",
- "kodim21.png",
- "kodim22.png",
- "kodim23.png",
- "kodim24.png",
- // Waterloo image set
- "clegg.png",
- "frymire.png",
- "lena.png",
- "monarch.png",
- "peppers.png",
- "sail.png",
- "serrano.png",
- "tulips.png",
- // Epic image set
- "Bradley1.png",
- "Gradient.png",
- "MoreRocks.png",
- "Wall.png",
- "Rainbow.png",
- "Text.png",
-};
-const int s_fileCount = sizeof(s_fileNames)/sizeof(s_fileNames[0]);
-
-
-struct MyOutputHandler : public nvtt::OutputHandler
-{
- MyOutputHandler() : m_data(NULL), m_ptr(NULL) {}
- ~MyOutputHandler()
- {
- free(m_data);
- }
-
- virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel)
- {
- m_size = size;
- m_width = width;
- m_height = height;
- free(m_data);
- m_data = (unsigned char *)malloc(size);
- m_ptr = m_data;
- }
-
- virtual bool writeData(const void * data, int size)
- {
- memcpy(m_ptr, data, size);
- m_ptr += size;
- return true;
- }
-
- Image * decompress(nvtt::Format format)
- {
- int bw = (m_width + 3) / 4;
- int bh = (m_height + 3) / 4;
-
- AutoPtr<Image> img( new Image() );
- img->allocate(m_width, m_height);
-
- if (format == nvtt::Format_BC1)
- {
- BlockDXT1 * block = (BlockDXT1 *)m_data;
-
- for (int y = 0; y < bh; y++)
- {
- for (int x = 0; x < bw; x++)
- {
- ColorBlock colors;
- block->decodeBlock(&colors);
-
- for (int yy = 0; yy < 4; yy++)
- {
- for (int xx = 0; xx < 4; xx++)
- {
- Color32 c = colors.color(xx, yy);
-
- if (x * 4 + xx < m_width && y * 4 + yy < m_height)
- {
- img->pixel(x * 4 + xx, y * 4 + yy) = c;
- }
- }
- }
-
- block++;
- }
- }
- }
-
- return img.release();
- }
-
- int m_size;
- int m_width;
- int m_height;
- unsigned char * m_data;
- unsigned char * m_ptr;
-};
-
-
-float rmsError(const Image * a, const Image * b)
-{
- nvCheck(a != NULL);
- nvCheck(b != NULL);
- nvCheck(a->width() == b->width());
- nvCheck(a->height() == b->height());
-
- int mse = 0;
-
- const uint count = a->width() * a->height();
-
- for (uint i = 0; i < count; i++)
- {
- Color32 c0 = a->pixel(i);
- Color32 c1 = b->pixel(i);
-
- int r = c0.r - c1.r;
- int g = c0.g - c1.g;
- int b = c0.b - c1.b;
- //int a = c0.a - c1.a;
-
- mse += r * r;
- mse += g * g;
- mse += b * b;
- }
-
- return sqrtf(float(mse) / count);
-}
-
-
-int main(int argc, char *argv[])
-{
- const uint version = nvtt::version();
- const uint major = version / 100;
- const uint minor = version % 100;
-
- printf("NVIDIA Texture Tools %u.%u - Copyright NVIDIA Corporation 2007 - 2008\n\n", major, minor);
-
- bool fast = false;
- bool nocuda = false;
- bool showHelp = false;
- const char * outPath = "output";
- const char * regressPath = NULL;
-
- // Parse arguments.
- for (int i = 1; i < argc; i++)
- {
- if (strcmp("-fast", argv[i]) == 0)
- {
- fast = true;
- }
- else if (strcmp("-nocuda", argv[i]) == 0)
- {
- nocuda = true;
- }
- else if (strcmp("-help", argv[i]) == 0)
- {
- showHelp = true;
- }
- else if (strcmp("-out", argv[i]) == 0)
- {
- if (i+1 < argc && argv[i+1][0] != '-') outPath = argv[i+1];
- }
- else if (strcmp("-regress", argv[i]) == 0)
- {
- if (i+1 < argc && argv[i+1][0] != '-') regressPath = argv[i+1];
- }
- }
-
- if (showHelp)
- {
- printf("usage: nvtestsuite [options]\n\n");
-
- printf("Input options:\n");
- printf(" -regress <path>\tRegression directory.\n");
-
- printf("Compression options:\n");
- printf(" -fast \tFast compression.\n");
- printf(" -nocuda \tDo not use cuda compressor.\n");
-
- printf("Output options:\n");
- printf(" -out <path> \tOutput directory.\n");
-
- return 1;
- }
-
- nvtt::InputOptions inputOptions;
- inputOptions.setMipmapGeneration(false);
-
- nvtt::CompressionOptions compressionOptions;
- compressionOptions.setFormat(nvtt::Format_BC1);
- if (fast)
- {
- compressionOptions.setQuality(nvtt::Quality_Fastest);
- }
- else
- {
- compressionOptions.setQuality(nvtt::Quality_Production);
- }
-
- nvtt::OutputOptions outputOptions;
- outputOptions.setOutputHeader(false);
-
- MyOutputHandler outputHandler;
- outputOptions.setOutputHandler(&outputHandler);
-
- nvtt::Compressor compressor;
- compressor.enableCudaAcceleration(!nocuda);
-
- FileSystem::createDirectory(outPath);
-
- Path csvFileName;
- csvFileName.format("%s/result.csv", outPath);
- StdOutputStream csvStream(csvFileName);
- TextWriter csvWriter(&csvStream);
-
- float totalTime = 0;
- float totalRMSE = 0;
- int failedTests = 0;
- float totalDiff = 0;
-
- for (int i = 0; i < s_fileCount; i++)
- {
- AutoPtr<Image> img( new Image() );
-
- if (!img->load(s_fileNames[i]))
- {
- printf("Input image '%s' not found.\n", s_fileNames[i]);
- return EXIT_FAILURE;
- }
-
- inputOptions.setTextureLayout(nvtt::TextureType_2D, img->width(), img->height());
- inputOptions.setMipmapData(img->pixels(), img->width(), img->height());
-
- printf("Compressing: \t'%s'\n", s_fileNames[i]);
-
- clock_t start = clock();
-
- compressor.process(inputOptions, compressionOptions, outputOptions);
-
- clock_t end = clock();
- printf(" Time: \t%.3f sec\n", float(end-start) / CLOCKS_PER_SEC);
- totalTime += float(end-start);
-
- AutoPtr<Image> img_out( outputHandler.decompress(nvtt::Format_BC1) );
-
- Path outputFileName;
- outputFileName.format("%s/%s", outPath, s_fileNames[i]);
- outputFileName.stripExtension();
- outputFileName.append(".tga");
- if (!ImageIO::save(outputFileName, img_out.ptr()))
- {
- printf("Error saving file '%s'.\n", outputFileName.str());
- }
-
- float rmse = rmsError(img.ptr(), img_out.ptr());
- totalRMSE += rmse;
-
- printf(" RMSE: \t%.4f\n", rmse);
-
- // Output csv file
- csvWriter << "\"" << s_fileNames[i] << "\"," << rmse << "\n";
-
- if (regressPath != NULL)
- {
- Path regressFileName;
- regressFileName.format("%s/%s", regressPath, s_fileNames[i]);
- regressFileName.stripExtension();
- regressFileName.append(".tga");
-
- AutoPtr<Image> img_reg( new Image() );
- if (!img_reg->load(regressFileName.str()))
- {
- printf("Regression image '%s' not found.\n", regressFileName.str());
- return EXIT_FAILURE;
- }
-
- float rmse_reg = rmsError(img.ptr(), img_reg.ptr());
-
- float diff = rmse_reg - rmse;
- totalDiff += diff;
-
- const char * text = "PASSED";
- if (equal(diff, 0)) text = "PASSED";
- else if (diff < 0) {
- text = "FAILED";
- failedTests++;
- }
-
- printf(" Diff: \t%.4f (%s)\n", diff, text);
- }
-
- fflush(stdout);
- }
-
- totalRMSE /= s_fileCount;
- totalDiff /= s_fileCount;
-
- printf("Total Results:\n");
- printf(" Total Time: \t%.3f sec\n", totalTime / CLOCKS_PER_SEC);
- printf(" Average RMSE:\t%.4f\n", totalRMSE);
-
- if (regressPath != NULL)
- {
- printf("Regression Results:\n");
- printf(" Diff: %.4f\n", totalDiff);
- printf(" %d/%d tests failed.\n", failedTests, s_fileCount);
- }
-
- return EXIT_SUCCESS;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/assemble.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/assemble.cpp
deleted file mode 100644
index 9c39a09e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/assemble.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvcore/StrLib.h>
-#include <nvcore/StdStream.h>
-
-#include <nvmath/Color.h>
-
-#include <nvimage/Image.h>
-#include <nvimage/ImageIO.h>
-#include <nvimage/DirectDrawSurface.h>
-
-#include "cmdline.h"
-
-// @@ Add decent error messages.
-// @@ Add option to resize images.
-// @@ Add support for reading DDS files with 2D images and possibly mipmaps.
-
-int main(int argc, char *argv[])
-{
- MyAssertHandler assertHandler;
- MyMessageHandler messageHandler;
-
- bool assembleCubeMap = true;
- bool assembleVolume = false;
- bool assembleTextureArray = false;
-
- nv::Array<nv::Path> files;
- nv::Path output = "output.dds";
-
- // Parse arguments.
- for (int i = 1; i < argc; i++)
- {
- // Input options.
- if (strcmp("-cube", argv[i]) == 0)
- {
- assembleCubeMap = true;
- assembleVolume = false;
- assembleTextureArray = false;
- }
- /*if (strcmp("-volume", argv[i]) == 0)
- {
- assembleCubeMap = false;
- assembleVolume = true;
- assembleTextureArray = false;
- }
- if (strcmp("-array", argv[i]) == 0)
- {
- assembleCubeMap = false;
- assembleVolume = false;
- assembleTextureArray = true;
- }*/
- else if (strcmp("-o", argv[i]) == 0)
- {
- i++;
- if (i < argc && argv[i][0] != '-')
- {
- output = argv[i];
- }
- }
- else if (argv[i][0] != '-')
- {
- files.append(argv[i]);
- }
- }
-
- if (files.count() == 0)
- {
- printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n");
- printf("usage: nvassemble [-cube|-volume|-array] 'file0' 'file1' ...\n\n");
- return 1;
- }
-
- if (nv::strCaseCmp(output.extension(), ".dds") != 0)
- {
- //output.stripExtension();
- output.append(".dds");
- }
-
- if (assembleCubeMap && files.count() != 6)
- {
- printf("*** error, 6 files expected, but got %d\n", files.count());
- return 1;
- }
-
- // Load all files.
- nv::Array<nv::Image> images;
-
- uint w = 0, h = 0;
- bool hasAlpha = false;
-
- const uint imageCount = files.count();
- images.resize(imageCount);
-
- for (uint i = 0; i < imageCount; i++)
- {
- if (!images[i].load(files[i]))
- {
- printf("*** error loading file\n");
- return 1;
- }
-
- if (i == 0)
- {
- w = images[i].width();
- h = images[i].height();
- }
- else if (images[i].width() != w || images[i].height() != h)
- {
- printf("*** error, size of image '%s' does not match\n", files[i].str());
- return 1;
- }
-
- if (images[i].format() == nv::Image::Format_ARGB)
- {
- hasAlpha = true;
- }
- }
-
-
- nv::StdOutputStream stream(output);
- if (stream.isError()) {
- printf("Error opening '%s' for writting\n", output.str());
- return 1;
- }
-
- // Output DDS header.
- nv::DDSHeader header;
- header.setWidth(w);
- header.setHeight(h);
-
- if (assembleCubeMap)
- {
- header.setTextureCube();
- }
- else if (assembleVolume)
- {
- header.setTexture3D();
- header.setDepth(imageCount);
- }
- else if (assembleTextureArray)
- {
- //header.setTextureArray(imageCount);
- }
-
- // @@ It always outputs 32 bpp.
- header.setPitch(4 * w);
- header.setPixelFormat(32, 0xFF0000, 0xFF00, 0xFF, hasAlpha ? 0xFF000000 : 0);
-
- stream << header;
-
- // Output images.
- for (uint i = 0; i < imageCount; i++)
- {
- const uint pixelCount = w * h;
- for (uint p = 0; p < pixelCount; p++)
- {
- nv::Color32 c = images[i].pixel(p);
- uint8 r = c.r;
- uint8 g = c.g;
- uint8 b = c.b;
- uint8 a = c.a;
- stream << b << g << r << a;
- }
- }
-
- return 0;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/benchmark.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/benchmark.cpp
deleted file mode 100644
index 347a3271..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/benchmark.cpp
+++ /dev/null
@@ -1,374 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvcore/StrLib.h>
-#include <nvcore/StdStream.h>
-
-#include <nvimage/Image.h>
-#include <nvimage/DirectDrawSurface.h>
-
-#include <nvtt/nvtt.h>
-
-#include "cmdline.h"
-
-#include <time.h> // clock
-
-
-struct MyErrorHandler : public nvtt::ErrorHandler
-{
- virtual void error(nvtt::Error e)
- {
- nvDebugBreak();
- }
-};
-
-
-// Set color to normal map conversion options.
-void setColorToNormalMap(nvtt::InputOptions & inputOptions)
-{
- inputOptions.setNormalMap(false);
- inputOptions.setConvertToNormalMap(true);
- inputOptions.setHeightEvaluation(1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f, 0.0f);
- //inputOptions.setNormalFilter(1.0f, 0, 0, 0);
- //inputOptions.setNormalFilter(0.0f, 0, 0, 1);
- inputOptions.setGamma(1.0f, 1.0f);
- inputOptions.setNormalizeMipmaps(true);
-}
-
-// Set options for normal maps.
-void setNormalMap(nvtt::InputOptions & inputOptions)
-{
- inputOptions.setNormalMap(true);
- inputOptions.setConvertToNormalMap(false);
- inputOptions.setGamma(1.0f, 1.0f);
- inputOptions.setNormalizeMipmaps(true);
-}
-
-// Set options for color maps.
-void setColorMap(nvtt::InputOptions & inputOptions)
-{
- inputOptions.setNormalMap(false);
- inputOptions.setConvertToNormalMap(false);
- inputOptions.setGamma(2.2f, 2.2f);
- inputOptions.setNormalizeMipmaps(false);
-}
-
-
-
-int main(int argc, char *argv[])
-{
- MyAssertHandler assertHandler;
- MyMessageHandler messageHandler;
-
- bool normal = false;
- bool color2normal = false;
- bool wrapRepeat = false;
- bool noMipmaps = false;
- bool fast = false;
- bool nocuda = false;
- bool silent = false;
- nvtt::Format format = nvtt::Format_BC1;
-
- const char * externalCompressor = NULL;
-
- nv::Path input;
- nv::Path output;
-
-
- // Parse arguments.
- for (int i = 1; i < argc; i++)
- {
- // Input options.
- if (strcmp("-color", argv[i]) == 0)
- {
- }
- else if (strcmp("-normal", argv[i]) == 0)
- {
- normal = true;
- }
- else if (strcmp("-tonormal", argv[i]) == 0)
- {
- color2normal = true;
- }
- else if (strcmp("-clamp", argv[i]) == 0)
- {
- }
- else if (strcmp("-repeat", argv[i]) == 0)
- {
- wrapRepeat = true;
- }
- else if (strcmp("-nomips", argv[i]) == 0)
- {
- noMipmaps = true;
- }
-
- // Compression options.
- else if (strcmp("-fast", argv[i]) == 0)
- {
- fast = true;
- }
- else if (strcmp("-nocuda", argv[i]) == 0)
- {
- nocuda = true;
- }
- else if (strcmp("-rgb", argv[i]) == 0)
- {
- format = nvtt::Format_RGB;
- }
- else if (strcmp("-bc1", argv[i]) == 0)
- {
- format = nvtt::Format_BC1;
- }
- else if (strcmp("-bc1a", argv[i]) == 0)
- {
- format = nvtt::Format_BC1a;
- }
- else if (strcmp("-bc2", argv[i]) == 0)
- {
- format = nvtt::Format_BC2;
- }
- else if (strcmp("-bc3", argv[i]) == 0)
- {
- format = nvtt::Format_BC3;
- }
- else if (strcmp("-bc3n", argv[i]) == 0)
- {
- format = nvtt::Format_BC3n;
- }
- else if (strcmp("-bc4", argv[i]) == 0)
- {
- format = nvtt::Format_BC4;
- }
- else if (strcmp("-bc5", argv[i]) == 0)
- {
- format = nvtt::Format_BC5;
- }
-
- // Undocumented option. Mainly used for testing.
- else if (strcmp("-ext", argv[i]) == 0)
- {
- if (i+1 < argc && argv[i+1][0] != '-') {
- externalCompressor = argv[i+1];
- i++;
- }
- }
-
- // Misc options
- else if (strcmp("-silent", argv[i]) == 0)
- {
- silent = true;
- }
-
- else if (argv[i][0] != '-')
- {
- input = argv[i];
-
- if (i+1 < argc && argv[i+1][0] != '-') {
- output = argv[i+1];
- }
- else
- {
- output.copy(input.str());
- output.stripExtension();
- output.append(".dds");
- }
-
- break;
- }
- }
-
- printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n");
-
- if (input.isNull())
- {
- printf("usage: nvttbenchmark [options] infile [outfile]\n\n");
-
- printf("Input options:\n");
- printf(" -color \tThe input image is a color map (default).\n");
- printf(" -normal \tThe input image is a normal map.\n");
- printf(" -tonormal\tConvert input to normal map.\n");
- printf(" -clamp \tClamp wrapping mode (default).\n");
- printf(" -repeat \tRepeat wrapping mode.\n");
- printf(" -nomips \tDisable mipmap generation.\n\n");
-
- printf("Compression options:\n");
- printf(" -fast \tFast compression.\n");
- printf(" -nocuda \tDo not use cuda compressor.\n");
- printf(" -rgb \tRGBA format\n");
- printf(" -bc1 \tBC1 format (DXT1)\n");
- printf(" -bc1a \tBC1 format with binary alpha (DXT1a)\n");
- printf(" -bc2 \tBC2 format (DXT3)\n");
- printf(" -bc3 \tBC3 format (DXT5)\n");
- printf(" -bc3n \tBC3 normal map format (DXT5nm)\n");
- printf(" -bc4 \tBC4 format (ATI1)\n");
- printf(" -bc5 \tBC5 format (3Dc/ATI2)\n\n");
-
- return 1;
- }
-
- // @@ Make sure input file exists.
-
- // Set input options.
- nvtt::InputOptions inputOptions;
-
- if (nv::strCaseCmp(input.extension(), ".dds") == 0)
- {
- // Load surface.
- nv::DirectDrawSurface dds(input);
- if (!dds.isValid())
- {
- fprintf(stderr, "The file '%s' is not a valid DDS file.\n", input.str());
- return 1;
- }
-
- if (!dds.isSupported() || dds.isTexture3D())
- {
- fprintf(stderr, "The file '%s' is not a supported DDS file.\n", input.str());
- return 1;
- }
-
- uint faceCount;
- if (dds.isTexture2D())
- {
- inputOptions.setTextureLayout(nvtt::TextureType_2D, dds.width(), dds.height());
- faceCount = 1;
- }
- else
- {
- nvDebugCheck(dds.isTextureCube());
- inputOptions.setTextureLayout(nvtt::TextureType_Cube, dds.width(), dds.height());
- faceCount = 6;
- }
-
- uint mipmapCount = dds.mipmapCount();
-
- nv::Image mipmap;
-
- for (uint f = 0; f < faceCount; f++)
- {
- for (uint m = 0; m <= mipmapCount; m++)
- {
- dds.mipmap(&mipmap, f, m);
-
- inputOptions.setMipmapData(mipmap.pixels(), mipmap.width(), mipmap.height(), 1, f, m);
- }
- }
- }
- else
- {
- // Regular image.
- nv::Image image;
- if (!image.load(input))
- {
- fprintf(stderr, "The file '%s' is not a supported image type.\n", input.str());
- return 1;
- }
-
- inputOptions.setTextureLayout(nvtt::TextureType_2D, image.width(), image.height());
- inputOptions.setMipmapData(image.pixels(), image.width(), image.height());
- }
-
- if (fast)
- {
- inputOptions.setMipmapping(true, nvtt::MipmapFilter_Box);
- }
- else
- {
- inputOptions.setMipmapping(true, nvtt::MipmapFilter_Box);
- //inputOptions.setMipmapping(true, nvtt::MipmapFilter_Kaiser);
- }
-
- if (wrapRepeat)
- {
- inputOptions.setWrapMode(nvtt::WrapMode_Repeat);
- }
- else
- {
- inputOptions.setWrapMode(nvtt::WrapMode_Clamp);
- }
-
- if (normal)
- {
- setNormalMap(inputOptions);
- }
- else if (color2normal)
- {
- setColorToNormalMap(inputOptions);
- }
- else
- {
- setColorMap(inputOptions);
- }
-
- if (noMipmaps)
- {
- inputOptions.setMipmapping(false);
- }
-
-
- nvtt::CompressionOptions compressionOptions;
- compressionOptions.setFormat(format);
- if (fast)
- {
- compressionOptions.setQuality(nvtt::Quality_Fastest);
- }
- else
- {
- compressionOptions.setQuality(nvtt::Quality_Normal);
- //compressionOptions.setQuality(nvtt::Quality_Production, 0.5f);
- //compressionOptions.setQuality(nvtt::Quality_Highest);
- }
- compressionOptions.enableHardwareCompression(!nocuda);
- compressionOptions.setColorWeights(1, 1, 1);
-
- if (externalCompressor != NULL)
- {
- compressionOptions.setExternalCompressor(externalCompressor);
- }
-
-
- MyErrorHandler errorHandler;
- nvtt::OutputOptions outputOptions(NULL, &errorHandler);
-
-// printf("Press ENTER.\n");
-// fflush(stdout);
-// getchar();
-
- clock_t start = clock();
-
- const int iterationCount = 20;
- for (int i = 0; i < iterationCount; i++)
- {
- nvtt::compress(inputOptions, outputOptions, compressionOptions);
- }
-
- clock_t end = clock();
-
- float seconds = float(end-start) / CLOCKS_PER_SEC
- printf("total time taken: %.3f seconds\n", seconds);
- printf("time taken per texture: %.3f seconds\n", seconds / iterationCount);
- printf("textures per second: %.3f T/s\n", iterationCount / seconds);
-
- return 0;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/cmdline.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/cmdline.h
deleted file mode 100644
index f4b48b6e..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/cmdline.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef CMDLINE_H
-#define CMDLINE_H
-
-#include <nvcore/Debug.h>
-
-#include <stdio.h> // stderr
-#include <stdlib.h> // exit
-#include <stdarg.h> // va_list
-
-
-struct MyMessageHandler : public nv::MessageHandler {
- MyMessageHandler() {
- nv::debug::setMessageHandler( this );
- }
- ~MyMessageHandler() {
- nv::debug::resetMessageHandler();
- }
-
- virtual void log( const char * str, va_list arg ) {
- va_list val;
- va_copy(val, arg);
- vfprintf(stderr, str, arg);
- va_end(val);
- }
-};
-
-
-struct MyAssertHandler : public nv::AssertHandler {
- MyAssertHandler() {
- nv::debug::setAssertHandler( this );
- }
- ~MyAssertHandler() {
- nv::debug::resetAssertHandler();
- }
-
- // Handler method, note that func might be NULL!
- virtual int assert( const char *exp, const char *file, int line, const char *func ) {
- fprintf(stderr, "Assertion failed: %s\nIn %s:%d\n", exp, file, line);
- nv::debug::dumpInfo();
- exit(1);
- }
-};
-
-
-#endif // CMDLINE_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/compress.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/compress.cpp
deleted file mode 100644
index 6eb0443b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/compress.cpp
+++ /dev/null
@@ -1,536 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include "cmdline.h"
-
-#include <nvtt/nvtt.h>
-
-#include <nvimage/Image.h> // @@ It might be a good idea to use FreeImage directly instead of ImageIO.
-#include <nvimage/ImageIO.h>
-#include <nvimage/FloatImage.h>
-#include <nvimage/DirectDrawSurface.h>
-
-#include <nvcore/Ptr.h>
-#include <nvcore/StrLib.h>
-#include <nvcore/StdStream.h>
-#include <nvcore/FileSystem.h>
-#include <nvcore/Timer.h>
-
-
-struct MyOutputHandler : public nvtt::OutputHandler
-{
- MyOutputHandler(const char * name) : total(0), progress(0), percentage(0), stream(new nv::StdOutputStream(name)) {}
- virtual ~MyOutputHandler() { delete stream; }
-
- void setTotal(int64 t)
- {
- total = t + 128;
- }
- void setDisplayProgress(bool b)
- {
- verbose = b;
- }
-
- virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel)
- {
- // ignore.
- }
-
- // Output data.
- virtual bool writeData(const void * data, int size)
- {
- nvDebugCheck(stream != NULL);
- stream->serialize(const_cast<void *>(data), size);
-
- progress += size;
- int p = int((100 * progress) / total);
- if (verbose && p != percentage)
- {
- nvCheck(p >= 0);
-
- percentage = p;
- printf("\r%d%%", percentage);
- fflush(stdout);
- }
-
- return true;
- }
-
- int64 total;
- int64 progress;
- int percentage;
- bool verbose;
- nv::StdOutputStream * stream;
-};
-
-struct MyErrorHandler : public nvtt::ErrorHandler
-{
- virtual void error(nvtt::Error e)
- {
-#if _DEBUG
- nvDebugBreak();
-#endif
- printf("Error: '%s'\n", nvtt::errorString(e));
- }
-};
-
-
-
-
-// Set color to normal map conversion options.
-void setColorToNormalMap(nvtt::InputOptions & inputOptions)
-{
- inputOptions.setNormalMap(false);
- inputOptions.setConvertToNormalMap(true);
- inputOptions.setHeightEvaluation(1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f, 0.0f);
- //inputOptions.setNormalFilter(1.0f, 0, 0, 0);
- //inputOptions.setNormalFilter(0.0f, 0, 0, 1);
- inputOptions.setGamma(1.0f, 1.0f);
- inputOptions.setNormalizeMipmaps(true);
-}
-
-// Set options for normal maps.
-void setNormalMap(nvtt::InputOptions & inputOptions)
-{
- inputOptions.setNormalMap(true);
- inputOptions.setConvertToNormalMap(false);
- inputOptions.setGamma(1.0f, 1.0f);
- inputOptions.setNormalizeMipmaps(true);
-}
-
-// Set options for color maps.
-void setColorMap(nvtt::InputOptions & inputOptions)
-{
- inputOptions.setNormalMap(false);
- inputOptions.setConvertToNormalMap(false);
- inputOptions.setGamma(2.2f, 2.2f);
- inputOptions.setNormalizeMipmaps(false);
-}
-
-
-
-int main(int argc, char *argv[])
-{
- MyAssertHandler assertHandler;
- MyMessageHandler messageHandler;
-
- bool normal = false;
- bool color2normal = false;
- bool wrapRepeat = false;
- bool noMipmaps = false;
- bool fast = false;
- bool nocuda = false;
- bool bc1n = false;
- nvtt::Format format = nvtt::Format_BC1;
- bool premultiplyAlpha = false;
- nvtt::MipmapFilter mipmapFilter = nvtt::MipmapFilter_Box;
- bool loadAsFloat = false;
-
- const char * externalCompressor = NULL;
-
- bool silent = false;
- bool dds10 = false;
-
- nv::Path input;
- nv::Path output;
-
-
- // Parse arguments.
- for (int i = 1; i < argc; i++)
- {
- // Input options.
- if (strcmp("-color", argv[i]) == 0)
- {
- }
- else if (strcmp("-normal", argv[i]) == 0)
- {
- normal = true;
- }
- else if (strcmp("-tonormal", argv[i]) == 0)
- {
- color2normal = true;
- }
- else if (strcmp("-clamp", argv[i]) == 0)
- {
- }
- else if (strcmp("-repeat", argv[i]) == 0)
- {
- wrapRepeat = true;
- }
- else if (strcmp("-nomips", argv[i]) == 0)
- {
- noMipmaps = true;
- }
- else if (strcmp("-premula", argv[i]) == 0)
- {
- premultiplyAlpha = true;
- }
- else if (strcmp("-mipfilter", argv[i]) == 0)
- {
- if (i+1 == argc) break;
- i++;
-
- if (strcmp("box", argv[i]) == 0) mipmapFilter = nvtt::MipmapFilter_Box;
- else if (strcmp("triangle", argv[i]) == 0) mipmapFilter = nvtt::MipmapFilter_Triangle;
- else if (strcmp("kaiser", argv[i]) == 0) mipmapFilter = nvtt::MipmapFilter_Kaiser;
- }
- else if (strcmp("-float", argv[i]) == 0)
- {
- loadAsFloat = true;
- }
-
- // Compression options.
- else if (strcmp("-fast", argv[i]) == 0)
- {
- fast = true;
- }
- else if (strcmp("-nocuda", argv[i]) == 0)
- {
- nocuda = true;
- }
- else if (strcmp("-rgb", argv[i]) == 0)
- {
- format = nvtt::Format_RGB;
- }
- else if (strcmp("-bc1", argv[i]) == 0)
- {
- format = nvtt::Format_BC1;
- }
- else if (strcmp("-bc1n", argv[i]) == 0)
- {
- format = nvtt::Format_BC1;
- bc1n = true;
- }
- else if (strcmp("-bc1a", argv[i]) == 0)
- {
- format = nvtt::Format_BC1a;
- }
- else if (strcmp("-bc2", argv[i]) == 0)
- {
- format = nvtt::Format_BC2;
- }
- else if (strcmp("-bc3", argv[i]) == 0)
- {
- format = nvtt::Format_BC3;
- }
- else if (strcmp("-bc3n", argv[i]) == 0)
- {
- format = nvtt::Format_BC3n;
- }
- else if (strcmp("-bc4", argv[i]) == 0)
- {
- format = nvtt::Format_BC4;
- }
- else if (strcmp("-bc5", argv[i]) == 0)
- {
- format = nvtt::Format_BC5;
- }
-
- // Undocumented option. Mainly used for testing.
- else if (strcmp("-ext", argv[i]) == 0)
- {
- if (i+1 < argc && argv[i+1][0] != '-') {
- externalCompressor = argv[i+1];
- i++;
- }
- }
-
- // Output options
- else if (strcmp("-silent", argv[i]) == 0)
- {
- silent = true;
- }
- else if (strcmp("-dds10", argv[i]) == 0)
- {
- dds10 = true;
- }
-
- else if (argv[i][0] != '-')
- {
- input = argv[i];
-
- if (i+1 < argc && argv[i+1][0] != '-') {
- output = argv[i+1];
- }
- else
- {
- output.copy(input.str());
- output.stripExtension();
- output.append(".dds");
- }
-
- break;
- }
- }
-
- const uint version = nvtt::version();
- const uint major = version / 100;
- const uint minor = version % 100;
-
-
- printf("NVIDIA Texture Tools %u.%u - Copyright NVIDIA Corporation 2007\n\n", major, minor);
-
- if (input.isNull())
- {
- printf("usage: nvcompress [options] infile [outfile]\n\n");
-
- printf("Input options:\n");
- printf(" -color \tThe input image is a color map (default).\n");
- printf(" -normal \tThe input image is a normal map.\n");
- printf(" -tonormal\tConvert input to normal map.\n");
- printf(" -clamp \tClamp wrapping mode (default).\n");
- printf(" -repeat \tRepeat wrapping mode.\n");
- printf(" -nomips \tDisable mipmap generation.\n");
- printf(" -premula \tPremultiply alpha into color channel.\n");
- printf(" -mipfilter \tMipmap filter. One of the following: box, triangle, kaiser.\n\n");
-
- printf("Compression options:\n");
- printf(" -fast \tFast compression.\n");
- printf(" -nocuda \tDo not use cuda compressor.\n");
- printf(" -rgb \tRGBA format\n");
- printf(" -bc1 \tBC1 format (DXT1)\n");
- printf(" -bc1n \tBC1 normal map format (DXT1nm)\n");
- printf(" -bc1a \tBC1 format with binary alpha (DXT1a)\n");
- printf(" -bc2 \tBC2 format (DXT3)\n");
- printf(" -bc3 \tBC3 format (DXT5)\n");
- printf(" -bc3n \tBC3 normal map format (DXT5nm)\n");
- printf(" -bc4 \tBC4 format (ATI1)\n");
- printf(" -bc5 \tBC5 format (3Dc/ATI2)\n\n");
-
- printf("Output options:\n");
- printf(" -silent \tDo not output progress messages\n");
- printf(" -dds10 \tUse DirectX 10 DDS format\n\n");
-
- return 1;
- }
-
- // Make sure input file exists.
- if (!nv::FileSystem::exists(input.str()))
- {
- fprintf(stderr, "The file '%s' does not exist.\n", input.str());
- return 1;
- }
-
- // Set input options.
- nvtt::InputOptions inputOptions;
-
- if (nv::strCaseCmp(input.extension(), ".dds") == 0)
- {
- // Load surface.
- nv::DirectDrawSurface dds(input);
- if (!dds.isValid())
- {
- fprintf(stderr, "The file '%s' is not a valid DDS file.\n", input.str());
- return 1;
- }
-
- if (!dds.isSupported() || dds.isTexture3D())
- {
- fprintf(stderr, "The file '%s' is not a supported DDS file.\n", input.str());
- return 1;
- }
-
- uint faceCount;
- if (dds.isTexture2D())
- {
- inputOptions.setTextureLayout(nvtt::TextureType_2D, dds.width(), dds.height());
- faceCount = 1;
- }
- else
- {
- nvDebugCheck(dds.isTextureCube());
- inputOptions.setTextureLayout(nvtt::TextureType_Cube, dds.width(), dds.height());
- faceCount = 6;
- }
-
- uint mipmapCount = dds.mipmapCount();
-
- nv::Image mipmap;
-
- for (uint f = 0; f < faceCount; f++)
- {
- for (uint m = 0; m < mipmapCount; m++)
- {
- dds.mipmap(&mipmap, f, m); // @@ Load as float.
-
- inputOptions.setMipmapData(mipmap.pixels(), mipmap.width(), mipmap.height(), 1, f, m);
- }
- }
- }
- else
- {
- if (nv::strCaseCmp(input.extension(), ".exr") == 0)
- {
- loadAsFloat = true;
- }
-
- if (loadAsFloat)
- {
- nv::AutoPtr<nv::FloatImage> image(nv::ImageIO::loadFloat(input));
-
- if (image == NULL)
- {
- fprintf(stderr, "The file '%s' is not a supported image type.\n", input.str());
- return 1;
- }
-
- inputOptions.setFormat(nvtt::InputFormat_RGBA_32F);
- inputOptions.setTextureLayout(nvtt::TextureType_2D, image->width(), image->height());
-
- for (uint i = 0; i < image->componentNum(); i++)
- {
- inputOptions.setMipmapChannelData(image->channel(i), i, image->width(), image->height());
- }
- }
- else
- {
- // Regular image.
- nv::Image image;
- if (!image.load(input))
- {
- fprintf(stderr, "The file '%s' is not a supported image type.\n", input.str());
- return 1;
- }
-
- inputOptions.setTextureLayout(nvtt::TextureType_2D, image.width(), image.height());
- inputOptions.setMipmapData(image.pixels(), image.width(), image.height());
- }
- }
-
- if (wrapRepeat)
- {
- inputOptions.setWrapMode(nvtt::WrapMode_Repeat);
- }
- else
- {
- inputOptions.setWrapMode(nvtt::WrapMode_Clamp);
- }
-
- if (normal)
- {
- setNormalMap(inputOptions);
- }
- else if (color2normal)
- {
- setColorToNormalMap(inputOptions);
- }
- else
- {
- setColorMap(inputOptions);
- }
-
- if (noMipmaps)
- {
- inputOptions.setMipmapGeneration(false);
- }
-
- if (premultiplyAlpha)
- {
- inputOptions.setPremultiplyAlpha(true);
- inputOptions.setAlphaMode(nvtt::AlphaMode_Premultiplied);
- }
-
- inputOptions.setMipmapFilter(mipmapFilter);
-
- nvtt::CompressionOptions compressionOptions;
- compressionOptions.setFormat(format);
-
- /*if (format == nvtt::Format_RGBA)
- {
- compressionOptions.setPixelType(nvtt::PixelType_Float);
- compressionOptions.setPixelFormat(16, 16, 16, 16);
- }*/
-
- if (fast)
- {
- compressionOptions.setQuality(nvtt::Quality_Fastest);
- }
- else
- {
- compressionOptions.setQuality(nvtt::Quality_Normal);
- //compressionOptions.setQuality(nvtt::Quality_Production);
- //compressionOptions.setQuality(nvtt::Quality_Highest);
- }
-
- if (bc1n)
- {
- compressionOptions.setColorWeights(1, 1, 0);
- }
-
- if (externalCompressor != NULL)
- {
- compressionOptions.setExternalCompressor(externalCompressor);
- }
-
-
- MyErrorHandler errorHandler;
- MyOutputHandler outputHandler(output);
- if (outputHandler.stream->isError())
- {
- fprintf(stderr, "Error opening '%s' for writting\n", output.str());
- return 1;
- }
-
- nvtt::Compressor compressor;
- compressor.enableCudaAcceleration(!nocuda);
-
- printf("CUDA acceleration ");
- if (compressor.isCudaAccelerationEnabled())
- {
- printf("ENABLED\n\n");
- }
- else
- {
- printf("DISABLED\n\n");
- }
-
- outputHandler.setTotal(compressor.estimateSize(inputOptions, compressionOptions));
- outputHandler.setDisplayProgress(!silent);
-
- nvtt::OutputOptions outputOptions;
- //outputOptions.setFileName(output);
- outputOptions.setOutputHandler(&outputHandler);
- outputOptions.setErrorHandler(&errorHandler);
-
- if (dds10)
- {
- outputOptions.setContainer(nvtt::Container_DDS10);
- }
-
-// printf("Press ENTER.\n");
-// fflush(stdout);
-// getchar();
-
- Timer timer;
- timer.start();
-
- bool success = compressor.process(inputOptions, compressionOptions, outputOptions);
-
- if (success)
- {
- printf("\rtime taken: %.3f seconds\n", float(timer.elapsed()) / 1000.0f);
- }
-
- return 0;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ddsinfo.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ddsinfo.cpp
deleted file mode 100644
index 984ed967..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ddsinfo.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvcore/StrLib.h>
-#include <nvcore/StdStream.h>
-
-#include <nvimage/Image.h>
-#include <nvimage/DirectDrawSurface.h>
-
-#include "cmdline.h"
-
-
-int main(int argc, char *argv[])
-{
- MyAssertHandler assertHandler;
- MyMessageHandler messageHandler;
-
- if (argc != 2)
- {
- printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n");
- printf("usage: nvddsinfo ddsfile\n\n");
- return 1;
- }
-
- // Load surface.
- nv::DirectDrawSurface dds(argv[1]);
- if (!dds.isValid())
- {
- printf("The file '%s' is not a valid DDS file.\n", argv[1]);
- return 1;
- }
-
- dds.printInfo();
-
- return 0;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/decompress.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/decompress.cpp
deleted file mode 100644
index d05ea6bb..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/decompress.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvcore/StrLib.h>
-#include <nvcore/StdStream.h>
-
-#include <nvimage/Image.h>
-#include <nvimage/DirectDrawSurface.h>
-
-#include <nvimage/ImageIO.h>
-
-#include "cmdline.h"
-
-#include <time.h> // clock
-
-int main(int argc, char *argv[])
-{
- MyAssertHandler assertHandler;
- MyMessageHandler messageHandler;
-
- bool forcenormal = false;
- bool mipmaps = false;
- bool faces = false;
-
- nv::Path input;
- nv::Path output;
-
- // Parse arguments.
- for (int i = 1; i < argc; i++)
- {
- if (strcmp("-forcenormal", argv[i]) == 0)
- {
- forcenormal = true;
- }
- else if (strcmp("-mipmaps", argv[i]) == 0)
- {
- mipmaps = true;
- }
- else if (strcmp("-faces", argv[i]) == 0)
- {
- faces = true;
- }
- else if (argv[i][0] != '-')
- {
- input = argv[i];
-
- if (i+1 < argc && argv[i+1][0] != '-')
- {
- output = argv[i+1];
- }
- else
- {
- output.copy(input.str());
- output.stripExtension();
- output.append(".tga");
- }
-
- break;
- }
- }
-
- printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n");
-
- if (input.isNull())
- {
- printf("usage: nvdecompress [options] infile [outfile]\n\n");
-
- printf("Note: the .tga extension is forced on outfile\n\n");
-
- printf("Input options:\n");
- printf(" -forcenormal \tThe input image is a normal map.\n");
- printf(" -mipmaps \tDecompress all mipmaps.\n");
- printf(" -faces \tDecompress all faces.\n");
-
- return 1;
- }
-
- // Load surface.
- nv::DirectDrawSurface dds(input);
- if (!dds.isValid())
- {
- fprintf(stderr, "The file '%s' is not a valid DDS file.\n", input.str());
- return 1;
- }
-
- if (!dds.isSupported() || dds.isTexture3D())
- {
- fprintf(stderr, "The file '%s' is not a supported DDS file.\n", input.str());
- return 1;
- }
-
- uint faceCount;
- if (dds.isTexture2D())
- {
- faceCount = 1;
- }
- else
- {
- nvCheck(dds.isTextureCube());
- faceCount = 6;
- }
-
- uint mipmapCount = dds.mipmapCount();
-
- clock_t start = clock();
-
- // apply arguments
- if (forcenormal)
- {
- dds.setNormalFlag(true);
- }
- if (!faces)
- {
- faceCount = 1;
- }
- if (!mipmaps)
- {
- mipmapCount = 1;
- }
-
- nv::Image mipmap;
- nv::Path name;
-
- // strip extension, we force the tga extension
- output.stripExtension();
-
- // extract faces and mipmaps
- for (uint f = 0; f < faceCount; f++)
- {
- for (uint m = 0; m < mipmapCount; m++)
- {
- dds.mipmap(&mipmap, f, m);
-
- // set output filename, if we are doing faces and/or mipmaps
- name.copy(output);
- if (faces) name.appendFormat("_face%d", f);
- if (mipmaps) name.appendFormat("_mipmap%d", m);
- name.append(".tga");
-
- nv::StdOutputStream stream(name.str());
- if (stream.isError()) {
- fprintf(stderr, "Error opening '%s' for writting\n", name.str());
- return 1;
- }
-
- nv::ImageIO::saveTGA(stream, &mipmap);
- }
- }
-
- clock_t end = clock();
- printf("\rtime taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC);
-
- return 0;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/imgdiff.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/imgdiff.cpp
deleted file mode 100644
index b04f3ccf..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/imgdiff.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvcore/StrLib.h>
-#include <nvcore/StdStream.h>
-#include <nvcore/Containers.h>
-
-#include <nvimage/Image.h>
-#include <nvimage/DirectDrawSurface.h>
-
-#include <nvmath/Color.h>
-#include <nvmath/Vector.h>
-
-#include <math.h>
-
-#include "cmdline.h"
-
-static bool loadImage(nv::Image & image, const char * fileName)
-{
- if (nv::strCaseCmp(nv::Path::extension(fileName), ".dds") == 0)
- {
- nv::DirectDrawSurface dds(fileName);
- if (!dds.isValid())
- {
- printf("The file '%s' is not a valid DDS file.\n", fileName);
- return false;
- }
-
- dds.mipmap(&image, 0, 0); // get first image
- }
- else
- {
- // Regular image.
- if (!image.load(fileName))
- {
- printf("The file '%s' is not a supported image type.\n", fileName);
- return false;
- }
- }
-
- return true;
-}
-
-// @@ Compute per-tile errors.
-struct Error
-{
- Error()
- {
- samples = 0;
- mabse = 0.0f;
- maxabse = 0.0f;
- mse = 0.0f;
- }
-
- void addSample(float e)
- {
- samples++;
- mabse += fabsf(e);
- maxabse = nv::max(maxabse, fabsf(e));
- mse += e * e;
- }
-
- void done()
- {
- mabse /= samples;
- mse /= samples;
- rmse = sqrt(mse);
- psnr = (rmse == 0) ? 999.0f : 20.0f * log10(255.0f / rmse);
- }
-
- void print()
- {
- printf(" Mean absolute error: %f\n", mabse);
- printf(" Max absolute error: %f\n", maxabse);
- printf(" Root mean squared error: %f\n", rmse);
- printf(" Peak signal to noise ratio in dB: %f\n", psnr);
- }
-
- int samples;
- float mabse;
- float maxabse;
- float mse;
- float rmse;
- float psnr;
-};
-
-struct NormalError
-{
- NormalError()
- {
- samples = 0;
- ade = 0.0f;
- mse = 0.0f;
- }
-
- void addSample(nv::Color32 o, nv::Color32 c)
- {
- nv::Vector3 vo = nv::Vector3(o.r, o.g, o.b);
- nv::Vector3 vc = nv::Vector3(c.r, c.g, c.b);
-
- // Unpack and normalize.
- vo = nv::normalize(2.0f * (vo / 255.0f) - 1.0f);
- vc = nv::normalize(2.0f * (vc / 255.0f) - 1.0f);
-
- ade += acosf(nv::clamp(dot(vo, vc), -1.0f, 1.0f));
- mse += length_squared((vo - vc) * (255 / 2.0f));
-
- samples++;
- }
-
- void done()
- {
- if (samples)
- {
- ade /= samples;
- mse /= samples * 3;
- rmse = sqrt(mse);
- psnr = (rmse == 0) ? 999.0f : 20.0f * log10(255.0f / rmse);
- }
- }
-
- void print()
- {
- printf(" Angular deviation error: %f\n", ade);
- printf(" Root mean squared error: %f\n", rmse);
- printf(" Peak signal to noise ratio in dB: %f\n", psnr);
- }
-
- int samples;
- float ade;
- float mse;
- float rmse;
- float psnr;
-};
-
-
-int main(int argc, char *argv[])
-{
- MyAssertHandler assertHandler;
- MyMessageHandler messageHandler;
-
- bool compareNormal = false;
- bool compareAlpha = false;
-
- nv::Path input0;
- nv::Path input1;
- nv::Path output;
-
- // Parse arguments.
- for (int i = 1; i < argc; i++)
- {
- // Input options.
- if (strcmp("-normal", argv[i]) == 0)
- {
- compareNormal = true;
- }
- if (strcmp("-alpha", argv[i]) == 0)
- {
- compareAlpha = true;
- }
-
- else if (argv[i][0] != '-')
- {
- input0 = argv[i];
-
- if (i+1 < argc && argv[i+1][0] != '-') {
- input1 = argv[i+1];
- }
-
- break;
- }
- }
-
- if (input0.isNull() || input1.isNull())
- {
- printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n");
-
- printf("usage: nvimgdiff [options] original_file updated_file [output]\n\n");
-
- printf("Diff options:\n");
- printf(" -normal \tCompare images as if they were normal maps.\n");
- printf(" -alpha \tCompare alpha weighted images.\n");
-
- return 1;
- }
-
- nv::Image image0, image1;
- if (!loadImage(image0, input0)) return 0;
- if (!loadImage(image1, input1)) return 0;
-
- const uint w0 = image0.width();
- const uint h0 = image0.height();
- const uint w1 = image1.width();
- const uint h1 = image1.height();
- const uint w = nv::min(w0, w1);
- const uint h = nv::min(h0, h1);
-
- // Compute errors.
- Error error_r;
- Error error_g;
- Error error_b;
- Error error_a;
- Error error_total;
- NormalError error_normal;
-
- for (uint i = 0; i < h; i++)
- {
- for (uint e = 0; e < w; e++)
- {
- const nv::Color32 c0(image0.pixel(e, i));
- const nv::Color32 c1(image1.pixel(e, i));
-
- float r = float(c0.r - c1.r);
- float g = float(c0.g - c1.g);
- float b = float(c0.b - c1.b);
- float a = float(c0.a - c1.a);
-
- error_r.addSample(r);
- error_g.addSample(g);
- error_b.addSample(b);
- error_a.addSample(a);
-
- if (compareNormal)
- {
- error_normal.addSample(c0, c1);
- }
-
- if (compareAlpha)
- {
- error_total.addSample(r * c0.a / 255.0f);
- error_total.addSample(g * c0.a / 255.0f);
- error_total.addSample(b * c0.a / 255.0f);
- }
- else
- {
- error_total.addSample(r);
- error_total.addSample(g);
- error_total.addSample(b);
- }
- }
- }
-
- error_r.done();
- error_g.done();
- error_b.done();
- error_a.done();
- error_total.done();
- error_normal.done();
-
-
- printf("Image size compared: %dx%d\n", w, h);
- if (w != w0 || w != w1 || h != h0 || h != h1) {
- printf("--- NOTE: only the overlap between the 2 images (%d,%d) and (%d,%d) was compared\n", w0, h0, w1, h1);
- }
- printf("Total pixels: %d\n", w*h);
-
- printf("Color:\n");
- error_total.print();
-
- if (compareNormal)
- {
- printf("Normal:\n");
- error_normal.print();
- }
-
- if (compareAlpha)
- {
- printf("Alpha:\n");
- error_a.print();
- }
-
- // @@ Write image difference.
-
- return 0;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/mpegenc.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/mpegenc.cpp
deleted file mode 100644
index e9335edf..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/mpegenc.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvcore/StrLib.h>
-#include <nvcore/StdStream.h>
-
-#include <nvmath/Color.h>
-
-#include <nvimage/Image.h>
-#include <nvimage/DirectDrawSurface.h>
-
-#include <nvtt/nvtt.h>
-
-#include "cmdline.h"
-
-extern "C" {
-#include <libavcodec/avcodec.h>
-//#include <libavformat/avformat.h>
-}
-
-// http://ffmpeg.mplayerhq.hu/general.html
-// http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/apiexample_8c-source.html
-
-
-using namespace nv;
-
-static float s_quality = 0.5f;
-
-static AVFrame * createPicture(const Image & image)
-{
- const uint w = image.width();
- const uint h = image.height();
- const uint size = w * h;
-
- AVFrame * picture = avcodec_alloc_frame();
-
- uint8_t * buffer = (uint8_t *)malloc((size * 3) / 2);
-
- picture->data[0] = buffer;
- picture->data[1] = buffer + size;
- picture->data[2] = buffer + size + size / 4;
- picture->linesize[0] = w;
- picture->linesize[1] = w / 2;
- picture->linesize[2] = w / 2;
-
- memset(buffer, 0, (size * 3) / 2);
-
- // Convert image to YCbCr 4:2:0
-
- // Y
- for (uint y=0;y<h;y++)
- {
- for (uint x=0;x<w;x++)
- {
- Color32 c = image.pixel(x, y);
-
- float R = (1 / 255.0f) * c.r;
- float G = (1 / 255.0f) * c.g;
- float B = (1 / 255.0f) * c.b;
-
- //float Y = 0.299f * R + 0.587f * G + 0.114f * B;
- float Y = 16 + (65.481f * R + 128.553f * G + 24.966f * B);
-
- picture->data[0][y * picture->linesize[0] + x] = (uint8)clamp(Y, 0.0f, 255.0f);
- }
- }
-
- // Cb and Cr
- for (uint y=0;y<h/2;y++)
- {
- for (uint x=0;x<w/2;x++)
- {
- Color32 c0 = image.pixel(2*x+0, 2*y+0);
- Color32 c1 = image.pixel(2*x+1, 2*y+0);
- Color32 c2 = image.pixel(2*x+0, 2*y+1);
- Color32 c3 = image.pixel(2*x+1, 2*y+1);
-
- float R = (1 / 255.0f) * 0.25f * (c0.r + c1.r + c2.r + c3.r);
- float G = (1 / 255.0f) * 0.25f * (c0.g + c1.g + c2.g + c3.g);
- float B = (1 / 255.0f) * 0.25f * (c0.b + c1.b + c2.b + c3.b);
-
- //float Pb = - 0.168736f * R - 0.331264f * G + 0.5f * B;
- //float Pr = + 0.5f * R - 0.418688f * G - 0.081312f * B;
- float Cb = 128 + (-37.797f * R - 74.203f * G + 112.0f * B);
- float Cr = 128 + (112.0f * R - 93.786 * G - 18.214f * B);
-
- picture->data[1][y * picture->linesize[1] + x] = (uint8)clamp(Cb, 0.0f, 255.0f);;
- picture->data[2][y * picture->linesize[2] + x] = (uint8)clamp(Cr, 0.0f, 255.0f);;
- }
- }
-
- return picture;
-}
-
-static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize, const char * filename)
-{
- FILE * f = fopen(filename, "w");
- fprintf(f,"P5\n%d %d\n%d\n",xsize, ysize, 255);
-
- for (int i = 0; i < ysize; i++)
- fwrite(buf + i * wrap,1,xsize,f);
-
- fclose(f);
-}
-
-static void savePicture(const AVFrame * picture, int w, int h)
-{
- // @@ Combine planes.
- pgm_save(picture->data[0], picture->linesize[0], w, h, "test_y.pgm");
- pgm_save(picture->data[1], picture->linesize[1], w/2, h/2, "test_u.pgm");
- pgm_save(picture->data[2], picture->linesize[2], w/2, h/2, "test_v.pgm");
-}
-
-static double psnr(double d) {
- return -10.0*log(d)/log(10.0);
-}
-
-
-static void encodeFrame(const Image & image, CodecID format, Array<uint8> & frame)
-{
- AVFrame * picture = createPicture(image);
-
- AVCodec * encoder = avcodec_find_encoder(format);
-
- if (encoder == NULL)
- {
- printf("MPEG encoder not found.\n");
- exit(1);
- }
-
- AVCodecContext * encoder_context = avcodec_alloc_context();
-
- //encoder_context->me_method = 0;
- encoder_context->width = image.width();
- encoder_context->height = image.height();
- encoder_context->pix_fmt = PIX_FMT_YUV420P;
- //encoder_context->pix_fmt = PIX_FMT_YUV422P;
- //encoder_context->pix_fmt = PIX_FMT_YUVJ420P;
-
- encoder_context->time_base = (AVRational){1,25}; // required parameter. 25 fps?
- encoder_context->bit_rate = 400000; // Quality?
- //encoder_context->bit_rate = 200000; // Default
- //encoder_context->bit_rate_tolerance = 20000;
- //encoder_context->qmin = ?;
- //encoder_context->qmax = ?;
- //encoder_context->qcompress = ?;
- //encoder_context->qblur = ?;
-
- encoder_context->flags |= CODEC_FLAG_PSNR;
- encoder_context->qcompress = s_quality;
- //encoder_context->qblur = 1.0f;
- //encoder_context->global_quality = FF_QP2LAMBDA * 0;
- //encoder_context->max_qdiff = 3;
-
-
-
-
- // Intra frames only
- encoder_context->gop_size = 0;
-
- if (avcodec_open(encoder_context, encoder) < 0)
- {
- printf("MPEG encoder initialization failed.\n");
- exit(1);
- }
-
- frame.resize(1024 * 1024, 0); // resize and initialize to 0.
-
- int out_size = avcodec_encode_video(encoder_context, frame.mutableBuffer(), frame.size(), picture);
- frame.resize(out_size);
-
- // Append sequence end code.
- frame.append(0x00);
- frame.append(0x00);
- frame.append(0x01);
- frame.append(0xb7);
-
- int in_size = image.width() * image.height() * 3;
- printf("Image size %d -> %d (1:%d)\n", in_size, out_size, in_size/out_size);
- printf("PSNR = %4.2f\n", psnr(encoder_context->coded_frame->error[0]/(encoder_context->width*encoder_context->height*255.0*255.0)));
-
-
- avcodec_close(encoder_context);
- av_free(encoder_context);
- av_free(picture);
-}
-
-static void decodeFrame(const Array<uint8> & frame, CodecID format)
-{
- AVCodec * decoder = avcodec_find_decoder(format);
- if (decoder == NULL) {
- printf("MPEG decoder not found.\n");
- exit(1);
- }
-
- AVCodecContext * decoder_context = avcodec_alloc_context();
- AVFrame * picture = avcodec_alloc_frame();
-
- if (decoder->capabilities & CODEC_CAP_TRUNCATED)
- decoder_context->flags |= CODEC_FLAG_TRUNCATED; /* we do not send complete frames */
-
-
- if (avcodec_open(decoder_context, decoder) < 0) {
- printf("MPEG decoder initialization failed.\n");
- exit(1);
- }
-
- //memset(picture->data[0], 0, in_size / 2);
-
- int got_picture = 0;
- int len = avcodec_decode_video(decoder_context, picture, &got_picture, frame.buffer(), frame.size());
-
- printf("decoded %d bytes\n", len);
-
- if (len < 0) {
- printf("Error while decoding frame.\n");
- exit(1);
- }
-
- if (!got_picture) {
- printf("Did not get any picture.\n");
- exit(1);
- }
-
- //nvDebugCheck(outbuf_size == len);
- //nvDebugCheck(got_picture == true);
-
- savePicture(picture, decoder_context->width, decoder_context->height);
-
- avcodec_close(decoder_context);
- av_free(decoder_context);
- av_free(picture);
-}
-
-
-
-int main(int argc, char *argv[])
-{
- MyAssertHandler assertHandler;
- MyMessageHandler messageHandler;
-
- nv::Path input;
- nv::Path output;
-
- // Parse arguments.
- for (int i = 1; i < argc; i++)
- {
- if (strcmp(argv[i], "-q") == 0 || strcmp(argv[i], "--quality") == 0)
- {
- if (i+1 < argc && argv[i+1][0] != '-')
- {
- s_quality = atof(argv[i+1]);
- i++;
- }
- }
-
- else if (argv[i][0] != '-')
- {
- input = argv[i];
-
- if (i+1 < argc && argv[i+1][0] != '-')
- {
- output = argv[i+1];
- i++;
- }
- else
- {
- output.copy(input.str());
- output.stripExtension();
- output.append(".mpeg");
- }
-
- break;
- }
- }
-
- printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007-2008\n\n");
-
- if (input.isNull())
- {
- printf("usage: nvmpegcompress [options] infile [outfile]\n\n");
-
- return 1;
- }
-
- // Load image.
- Image image;
- if (!image.load(input))
- {
- fprintf(stderr, "The file '%s' is not a supported image type.\n", input.str());
- return 1;
- }
-
- // Initialize codecs.
- avcodec_init();
- avcodec_register_all();
-
- //CodecID format = CODEC_ID_MPEG1VIDEO;
- CodecID format = CODEC_ID_MPEG2VIDEO;
- //CodecID format = CODEC_ID_MJPEG;
- //CodecID format = CODEC_ID_THEORA;
- //CodecID format = CODEC_ID_H264;
-
- // Encode frame.
- Array<uint8> frame;
- encodeFrame(image, format, frame);
-
- // Save resulting I-frame.
- StdOutputStream outputStream(output.str());
- if (outputStream.isError())
- {
- printf("Error opening '%s' for writing.\n", output.str());
- return 1;
- }
-
- outputStream.serialize(frame.mutableBuffer(), frame.size());
-
- //decodeFrame(frame, format);
-
- // @@ Compare image against original, and compute RMS.
-
- return 0;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/resize.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/resize.cpp
deleted file mode 100644
index 9b43cbf0..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/resize.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <nvcore/Ptr.h>
-#include <nvcore/StrLib.h>
-#include <nvcore/StdStream.h>
-#include <nvcore/Containers.h>
-
-#include <nvimage/Image.h>
-#include <nvimage/ImageIO.h>
-#include <nvimage/FloatImage.h>
-#include <nvimage/Filter.h>
-#include <nvimage/DirectDrawSurface.h>
-
-#include <nvmath/Color.h>
-#include <nvmath/Vector.h>
-
-#include <math.h>
-
-#include "cmdline.h"
-
-static bool loadImage(nv::Image & image, const char * fileName)
-{
- if (nv::strCaseCmp(nv::Path::extension(fileName), ".dds") == 0)
- {
- nv::DirectDrawSurface dds(fileName);
- if (!dds.isValid())
- {
- printf("The file '%s' is not a valid DDS file.\n", fileName);
- return false;
- }
-
- dds.mipmap(&image, 0, 0); // get first image
- }
- else
- {
- // Regular image.
- if (!image.load(fileName))
- {
- printf("The file '%s' is not a supported image type.\n", fileName);
- return false;
- }
- }
-
- return true;
-}
-
-
-int main(int argc, char *argv[])
-{
- //MyAssertHandler assertHandler;
- MyMessageHandler messageHandler;
-
- float scale = 0.5f;
- float gamma = 2.2f;
- nv::AutoPtr<nv::Filter> filter;
- nv::Path input;
- nv::Path output;
-
- nv::FloatImage::WrapMode wrapMode = nv::FloatImage::WrapMode_Mirror;
-
- // Parse arguments.
- for (int i = 1; i < argc; i++)
- {
- // Input options.
- if (strcmp("-s", argv[i]) == 0)
- {
- if (i+1 < argc && argv[i+1][0] != '-') {
- scale = (float)atof(argv[i+1]);
- i++;
- }
- }
- else if (strcmp("-g", argv[i]) == 0)
- {
- if (i+1 < argc && argv[i+1][0] != '-') {
- gamma = (float)atof(argv[i+1]);
- i++;
- }
- }
- else if (strcmp("-f", argv[i]) == 0)
- {
- if (i+1 == argc) break;
- i++;
-
- if (strcmp("box", argv[i]) == 0) filter = new nv::BoxFilter();
- else if (strcmp("triangle", argv[i]) == 0) filter = new nv::TriangleFilter();
- else if (strcmp("quadratic", argv[i]) == 0) filter = new nv::QuadraticFilter();
- else if (strcmp("bspline", argv[i]) == 0) filter = new nv::BSplineFilter();
- else if (strcmp("mitchell", argv[i]) == 0) filter = new nv::MitchellFilter();
- else if (strcmp("lanczos", argv[i]) == 0) filter = new nv::LanczosFilter();
- else if (strcmp("kaiser", argv[i]) == 0) {
- filter = new nv::KaiserFilter(3);
- ((nv::KaiserFilter *)filter.ptr())->setParameters(4.0f, 1.0f);
- }
- }
- else if (strcmp("-f", argv[i]) == 0)
- {
- if (i+1 == argc) break;
- i++;
-
- if (strcmp("mirror", argv[i]) == 0) wrapMode = nv::FloatImage::WrapMode_Mirror;
- else if (strcmp("repeat", argv[i]) == 0) wrapMode = nv::FloatImage::WrapMode_Repeat;
- else if (strcmp("clamp", argv[i]) == 0) wrapMode = nv::FloatImage::WrapMode_Clamp;
- }
- else if (argv[i][0] != '-')
- {
- input = argv[i];
-
- if (i+1 < argc && argv[i+1][0] != '-') {
- output = argv[i+1];
- }
-
- break;
- }
- }
-
- if (input.isNull() || output.isNull())
- {
- printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n");
-
- printf("usage: nvzoom [options] input [output]\n\n");
-
- printf("Options:\n");
- printf(" -s scale Scale factor (default = 0.5)\n");
- printf(" -g gamma Gamma correction (default = 2.2)\n");
- printf(" -f filter One of the following: (default = 'box')\n");
- printf(" * box\n");
- printf(" * triangle\n");
- printf(" * quadratic\n");
- printf(" * bspline\n");
- printf(" * mitchell\n");
- printf(" * lanczos\n");
- printf(" * kaiser\n");
- printf(" -w mode One of the following: (default = 'mirror')\n");
- printf(" * mirror\n");
- printf(" * repeat\n");
- printf(" * clamp\n");
-
- return 1;
- }
-
- if (filter == NULL)
- {
- filter = new nv::BoxFilter();
- }
-
- nv::Image image;
- if (!loadImage(image, input)) return 0;
-
- nv::FloatImage fimage(&image);
- fimage.toLinear(0, 3, gamma);
-
- nv::AutoPtr<nv::FloatImage> fresult(fimage.resize(*filter, uint(image.width() * scale), uint(image.height() * scale), wrapMode));
-
- nv::AutoPtr<nv::Image> result(fresult->createImageGammaCorrect(gamma));
- result->setFormat(nv::Image::Format_ARGB);
-
- nv::StdOutputStream stream(output);
- nv::ImageIO::saveTGA(stream, result.ptr()); // @@ Add generic save function. Add support for png too.
-
- return 0;
-}
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/configdialog.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/configdialog.cpp
deleted file mode 100644
index 885baa51..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/configdialog.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include "configdialog.h"
-
-#include <QtCore/QDebug>
-
-#include <QtGui/QImage>
-
-
-ConfigDialog::ConfigDialog(QWidget *parent/*=0*/) : QDialog(parent)
-{
- init();
-}
-
-ConfigDialog::ConfigDialog(const char * fileName, QWidget *parent/*=0*/) : QDialog(parent)
-{
- init();
-
- open(fileName);
-}
-
-void ConfigDialog::init()
-{
- ui.setupUi(this);
-
- connect(ui.openButton, SIGNAL(clicked()), this, SLOT(openClicked()));
- connect(ui.generateMipmapsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(generateMipmapsChanged(int)));
- connect(ui.mipmapFilterComboBox, SIGNAL(activated(QString)), this, SLOT(mipmapFilterChanged(QString)));
- //connect(ui.mipmapFilterSettings, SIGNAL(clicked()), this, SLOT(mipmapFilterSettingsShow()));
-
- connect(ui.redSpinBox, SIGNAL(valueChanged(double)), this, SLOT(colorWeightChanged()));
- connect(ui.greenSpinBox, SIGNAL(valueChanged(double)), this, SLOT(colorWeightChanged()));
- connect(ui.blueSpinBox, SIGNAL(valueChanged(double)), this, SLOT(colorWeightChanged()));
- connect(ui.uniformButton, SIGNAL(toggled(bool)), this, SLOT(uniformWeightToggled(bool)));
- connect(ui.luminanceButton, SIGNAL(toggled(bool)), this, SLOT(luminanceWeightToggled(bool)));
-
- //connect(ui.rgbMapRadioButton, SIGNAL(toggled(bool)), this, SLOT(colorModeChanged()));
- connect(ui.normalMapRadioButton, SIGNAL(toggled(bool)), this, SLOT(normalMapModeChanged(bool)));
-}
-
-
-void ConfigDialog::openClicked()
-{
- // @@ Open file dialog.
-
- QString fileName;
-
- open(fileName);
-}
-
-void ConfigDialog::generateMipmapsChanged(int state)
-{
- Q_UNUSED(state);
-
- bool generateMipmapEnabled = ui.generateMipmapsCheckBox->isChecked();
-
- ui.mipmapFilterLabel->setEnabled(generateMipmapEnabled);
- ui.mipmapFilterComboBox->setEnabled(generateMipmapEnabled);
- ui.limitMipmapsCheckBox->setEnabled(generateMipmapEnabled);
-
- bool enableFilterSettings = (ui.mipmapFilterComboBox->currentText() == "Kaiser");
- ui.mipmapFilterSettings->setEnabled(generateMipmapEnabled && enableFilterSettings);
-
- bool enableMaxLevel = ui.limitMipmapsCheckBox->isChecked();
- ui.maxLevelLabel->setEnabled(generateMipmapEnabled && enableMaxLevel);
- ui.maxLevelSpinBox->setEnabled(generateMipmapEnabled && enableMaxLevel);
-}
-
-void ConfigDialog::mipmapFilterChanged(QString name)
-{
- bool enableFilterSettings = (name == "Kaiser");
- ui.mipmapFilterSettings->setEnabled(enableFilterSettings);
-}
-
-
-void ConfigDialog::colorWeightChanged()
-{
- double r = ui.redSpinBox->value();
- double g = ui.greenSpinBox->value();
- double b = ui.blueSpinBox->value();
-
- bool uniform = (r == 1.0 && g == 1.0 && b == 1.0);
- bool luminance = (r == 0.3 && g == 0.59 && b == 0.11);
-
- ui.uniformButton->setChecked(uniform);
- ui.luminanceButton->setChecked(luminance);
-}
-
-void ConfigDialog::uniformWeightToggled(bool checked)
-{
- if (checked)
- {
- ui.redSpinBox->setValue(1.0);
- ui.greenSpinBox->setValue(1.0);
- ui.blueSpinBox->setValue(1.0);
- }
-}
-
-void ConfigDialog::luminanceWeightToggled(bool checked)
-{
- if (checked)
- {
- ui.redSpinBox->setValue(0.3);
- ui.greenSpinBox->setValue(0.59);
- ui.blueSpinBox->setValue(0.11);
- }
-}
-
-void ConfigDialog::normalMapModeChanged(bool checked)
-{
- ui.alphaModeGroupBox->setEnabled(!checked);
- ui.inputGammaSpinBox->setEnabled(!checked);
- ui.inputGammaLabel->setEnabled(!checked);
- ui.outputGammaSpinBox->setEnabled(!checked);
- ui.outputGammaLabel->setEnabled(!checked);
-}
-
-
-bool ConfigDialog::open(QString fileName)
-{
- // @@ Load image.
- QImage image;
-
- // @@ If success.
- {
- ui.imagePathLineEdit->setText(fileName);
-
- // @@ Set image in graphics view.
-
- // @@ Set image description.
-
- // @@ Provide image to nvtt.
-
- int w = image.width();
- int h = image.height();
- void * data = NULL;
-
- inputOptions.setTextureLayout(nvtt::TextureType_2D, w, h);
- inputOptions.setMipmapData(data, w, h);
-
- return true;
- }
-
- return false;
-}
-
-
-
-
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/configdialog.h b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/configdialog.h
deleted file mode 100644
index 3c44073c..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/configdialog.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef CONFIGDIALOG_H
-#define CONFIGDIALOG_H
-
-#include <QtGui/QDialog>
-
-#include "ui_configdialog.h"
-
-#include <nvtt/nvtt.h>
-
-
-class ConfigDialog : public QDialog
-{
- Q_OBJECT
-public:
- ConfigDialog(QWidget *parent = 0);
- ConfigDialog(const char * fileName, QWidget *parent = 0);
-
-protected slots:
-
- void openClicked();
- void generateMipmapsChanged(int state);
- void mipmapFilterChanged(QString name);
-
- void colorWeightChanged();
- void uniformWeightToggled(bool checked);
- void luminanceWeightToggled(bool checked);
-
- void normalMapModeChanged(bool checked);
-
- bool open(QString fileName);
-
-private:
-
- void init();
-
-private:
- Ui::ConfigDialog ui;
-
- nvtt::InputOptions inputOptions;
- nvtt::CompressionOptions compressionOptions;
- nvtt::OutputOptions outputOptions;
-
-};
-
-
-#endif // CONFIGDIALOG_H
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/configdialog.ui b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/configdialog.ui
deleted file mode 100644
index 42d2b49b..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/configdialog.ui
+++ /dev/null
@@ -1,1043 +0,0 @@
-<ui version="4.0" >
- <class>ConfigDialog</class>
- <widget class="QDialog" name="ConfigDialog" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>674</width>
- <height>475</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>NVIDIA Texture Tools</string>
- </property>
- <property name="sizeGripEnabled" >
- <bool>true</bool>
- </property>
- <layout class="QVBoxLayout" >
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <layout class="QVBoxLayout" >
- <item>
- <widget class="QListWidget" name="listWidget" >
- <property name="minimumSize" >
- <size>
- <width>64</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize" >
- <size>
- <width>128</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="horizontalScrollBarPolicy" >
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- <property name="movement" >
- <enum>QListView::Static</enum>
- </property>
- <property name="flow" >
- <enum>QListView::TopToBottom</enum>
- </property>
- <property name="isWrapping" stdset="0" >
- <bool>false</bool>
- </property>
- <property name="resizeMode" >
- <enum>QListView::Adjust</enum>
- </property>
- <property name="viewMode" >
- <enum>QListView::ListMode</enum>
- </property>
- <item>
- <property name="text" >
- <string>Input Options</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Compression Options</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Output Options</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Preview</string>
- </property>
- <property name="icon" >
- <iconset>../../../../../../castano-stuff/qshaderedit/src/images/colorpicker.png</iconset>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QStackedWidget" name="stackedWidget" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="currentIndex" >
- <number>3</number>
- </property>
- <widget class="QWidget" name="inputPage" >
- <layout class="QVBoxLayout" >
- <property name="spacing" >
- <number>-1</number>
- </property>
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget" >
- <property name="currentIndex" >
- <number>0</number>
- </property>
- <property name="elideMode" >
- <enum>Qt::ElideNone</enum>
- </property>
- <property name="usesScrollButtons" >
- <bool>false</bool>
- </property>
- <widget class="QWidget" name="widget" >
- <attribute name="title" >
- <string>File Path</string>
- </attribute>
- <layout class="QVBoxLayout" >
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLineEdit" name="imagePathLineEdit" />
- </item>
- <item>
- <widget class="QPushButton" name="openButton" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Open</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QGraphicsView" name="graphicsView" />
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="widget" >
- <attribute name="title" >
- <string>Image Settings</string>
- </attribute>
- <layout class="QVBoxLayout" >
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QGroupBox" name="groupBox" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title" >
- <string>Color Mode</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignHCenter</set>
- </property>
- <layout class="QVBoxLayout" >
- <property name="spacing" >
- <number>0</number>
- </property>
- <item>
- <widget class="QRadioButton" name="rgbRadioButton" >
- <property name="text" >
- <string>RGB</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="normalMapRadioButton" >
- <property name="text" >
- <string>Normal Map</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="alphaModeGroupBox" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title" >
- <string>Alpha Mode</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignHCenter</set>
- </property>
- <layout class="QVBoxLayout" >
- <property name="spacing" >
- <number>0</number>
- </property>
- <item>
- <widget class="QRadioButton" name="alphaNoneRadioButton" >
- <property name="text" >
- <string>None</string>
- </property>
- <property name="checked" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="alphaTransparencyRadioButton" >
- <property name="text" >
- <string>Transparency</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="alphaPremultipliedRadioButton" >
- <property name="text" >
- <string>Premultiplied</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <property name="spacing" >
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="wrapModeLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Wrap Mode:</string>
- </property>
- <property name="buddy" >
- <cstring>mipmapFilterComboBox</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="wrapModeComboBox" >
- <property name="maximumSize" >
- <size>
- <width>16777215</width>
- <height>26</height>
- </size>
- </property>
- <item>
- <property name="text" >
- <string>Mirror</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Repeat</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Clamp</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="inputGammaLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Input Gamma:</string>
- </property>
- <property name="buddy" >
- <cstring>inputGammaSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDoubleSpinBox" name="inputGammaSpinBox" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="buttonSymbols" >
- <enum>QAbstractSpinBox::UpDownArrows</enum>
- </property>
- <property name="minimum" >
- <double>0.050000000000000</double>
- </property>
- <property name="maximum" >
- <double>4.000000000000000</double>
- </property>
- <property name="singleStep" >
- <double>0.050000000000000</double>
- </property>
- <property name="value" >
- <double>2.200000000000000</double>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="outputGammaLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Output Gamma:</string>
- </property>
- <property name="buddy" >
- <cstring>inputGammaSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDoubleSpinBox" name="outputGammaSpinBox" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="buttonSymbols" >
- <enum>QAbstractSpinBox::UpDownArrows</enum>
- </property>
- <property name="minimum" >
- <double>0.050000000000000</double>
- </property>
- <property name="maximum" >
- <double>4.000000000000000</double>
- </property>
- <property name="singleStep" >
- <double>0.050000000000000</double>
- </property>
- <property name="value" >
- <double>2.200000000000000</double>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>433</width>
- <height>16</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="widget" >
- <attribute name="title" >
- <string>Mipmaps</string>
- </attribute>
- <layout class="QVBoxLayout" >
- <item>
- <widget class="QCheckBox" name="generateMipmapsCheckBox" >
- <property name="text" >
- <string>Generate mipmaps</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <property name="spacing" >
- <number>1</number>
- </property>
- <item>
- <widget class="QLabel" name="mipmapFilterLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Mipmap filter:</string>
- </property>
- <property name="buddy" >
- <cstring>mipmapFilterComboBox</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="mipmapFilterComboBox" >
- <property name="maximumSize" >
- <size>
- <width>16777215</width>
- <height>26</height>
- </size>
- </property>
- <item>
- <property name="text" >
- <string>Box</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Triangle</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Kaiser</string>
- </property>
- </item>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="mipmapFilterSettings" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize" >
- <size>
- <width>16777215</width>
- <height>24</height>
- </size>
- </property>
- <property name="autoFillBackground" >
- <bool>false</bool>
- </property>
- <property name="text" >
- <string>...</string>
- </property>
- <property name="toolButtonStyle" >
- <enum>Qt::ToolButtonTextOnly</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QCheckBox" name="limitMipmapsCheckBox" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Limit Mipmaps</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="maxLevelLabel" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Max Level:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="maxLevelSpinBox" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize" >
- <size>
- <width>80</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>204</width>
- <height>71</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="widget" >
- <attribute name="title" >
- <string>Normal Map</string>
- </attribute>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="compressionPage" >
- <layout class="QVBoxLayout" >
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="label_3" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Format:</string>
- </property>
- <property name="textFormat" >
- <enum>Qt::PlainText</enum>
- </property>
- <property name="textInteractionFlags" >
- <set>Qt::NoTextInteraction</set>
- </property>
- <property name="buddy" >
- <cstring>formatComboBox</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="formatComboBox" >
- <item>
- <property name="text" >
- <string>Uncompressed</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>BC1 (DXT1)</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>BC1a (DXT1a)</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>BC2 (DXT3)</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>BC3 (DXT5)</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>BC4</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>BC5</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="label_4" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Quality:</string>
- </property>
- <property name="textFormat" >
- <enum>Qt::PlainText</enum>
- </property>
- <property name="textInteractionFlags" >
- <set>Qt::NoTextInteraction</set>
- </property>
- <property name="buddy" >
- <cstring>formatComboBox</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="formatComboBox_2" >
- <property name="currentIndex" >
- <number>1</number>
- </property>
- <item>
- <property name="text" >
- <string>Fastest</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Normal</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Production</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Highest</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_6" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title" >
- <string>Color Weights</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignHCenter</set>
- </property>
- <layout class="QVBoxLayout" >
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="label_10" >
- <property name="text" >
- <string>Red</string>
- </property>
- <property name="buddy" >
- <cstring>redSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDoubleSpinBox" name="redSpinBox" >
- <property name="maximum" >
- <double>1.000000000000000</double>
- </property>
- <property name="singleStep" >
- <double>0.050000000000000</double>
- </property>
- <property name="value" >
- <double>1.000000000000000</double>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="label_11" >
- <property name="text" >
- <string>Green</string>
- </property>
- <property name="buddy" >
- <cstring>greenSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDoubleSpinBox" name="greenSpinBox" >
- <property name="maximum" >
- <double>1.000000000000000</double>
- </property>
- <property name="singleStep" >
- <double>0.050000000000000</double>
- </property>
- <property name="value" >
- <double>1.000000000000000</double>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="label_12" >
- <property name="text" >
- <string>Blue</string>
- </property>
- <property name="buddy" >
- <cstring>blueSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDoubleSpinBox" name="blueSpinBox" >
- <property name="maximum" >
- <double>1.000000000000000</double>
- </property>
- <property name="singleStep" >
- <double>0.050000000000000</double>
- </property>
- <property name="value" >
- <double>1.000000000000000</double>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QPushButton" name="uniformButton" >
- <property name="maximumSize" >
- <size>
- <width>16777215</width>
- <height>22</height>
- </size>
- </property>
- <property name="text" >
- <string>Uniform Weights</string>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="luminanceButton" >
- <property name="maximumSize" >
- <size>
- <width>16777215</width>
- <height>22</height>
- </size>
- </property>
- <property name="text" >
- <string>Luminance Weights</string>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>484</width>
- <height>31</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="outputPage" />
- <widget class="QWidget" name="previewPage" >
- <layout class="QVBoxLayout" >
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QGraphicsView" name="graphicsView_2" />
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QCheckBox" name="filterCheckBox" >
- <property name="text" >
- <string>Bilinear Filter</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="diffCheckBox" >
- <property name="text" >
- <string>View difference</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="Line" name="line" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QPushButton" name="pushButton_6" >
- <property name="text" >
- <string>Default</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QProgressBar" name="progressBar" >
- <property name="enabled" >
- <bool>true</bool>
- </property>
- <property name="value" >
- <number>0</number>
- </property>
- <property name="textVisible" >
- <bool>true</bool>
- </property>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="invertedAppearance" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButton" >
- <property name="text" >
- <string>Quit</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>listWidget</sender>
- <signal>currentRowChanged(int)</signal>
- <receiver>stackedWidget</receiver>
- <slot>setCurrentIndex(int)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>118</x>
- <y>193</y>
- </hint>
- <hint type="destinationlabel" >
- <x>154</x>
- <y>220</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>pushButton</sender>
- <signal>clicked()</signal>
- <receiver>ConfigDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>565</x>
- <y>491</y>
- </hint>
- <hint type="destinationlabel" >
- <x>582</x>
- <y>506</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>limitMipmapsCheckBox</sender>
- <signal>clicked(bool)</signal>
- <receiver>maxLevelSpinBox</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>451</x>
- <y>120</y>
- </hint>
- <hint type="destinationlabel" >
- <x>524</x>
- <y>120</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>limitMipmapsCheckBox</sender>
- <signal>clicked(bool)</signal>
- <receiver>maxLevelLabel</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>337</x>
- <y>120</y>
- </hint>
- <hint type="destinationlabel" >
- <x>482</x>
- <y>124</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/main.cpp b/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/main.cpp
deleted file mode 100644
index 48b95326..00000000
--- a/Libraries/nvidia-texture-tools-read-only/src/nvtt/tools/ui/main.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-
-#include <QtGui/QApplication>
-#include "configdialog.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- ConfigDialog dialog;
- return dialog.exec();
-}
-
-
diff --git a/Libraries/tinyxml/tinyxml.cpp b/Libraries/tinyxml/tinyxml.cpp
index f598003f..514ee90c 100644
--- a/Libraries/tinyxml/tinyxml.cpp
+++ b/Libraries/tinyxml/tinyxml.cpp
@@ -32,6 +32,7 @@ distribution.
#include "tinyxml.h"
+#include <Compat/platform.h>
#ifdef PLATFORM_WINDOWS
#include <windows.h>
#endif
diff --git a/Projects/CMakeLists.txt b/Projects/CMakeLists.txt
index fd81c15b..5be55093 100644
--- a/Projects/CMakeLists.txt
+++ b/Projects/CMakeLists.txt
@@ -232,7 +232,6 @@ if(LINUX)
SET(ARCH_OUT "amd64")
SET(TOOL_BIN_NAME "bin64")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
- ADD_DEFINITIONS(-DPLATFORM_64=1)
ELSE()
SET(LIB_SUFFIX "lib")
SET(BIN_SUFFIX ".bin.x86")
@@ -243,7 +242,6 @@ if(LINUX)
### Ensure LargeFileSupport on 32bit linux
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FILE_OFFSET_BITS=64")
- ADD_DEFINITIONS(-DPLATFORM_32=1)
ENDIF()
endif()
@@ -408,11 +406,7 @@ ELSE()
ENDIF()
# Add preprocessor definitions so that the code can use platform #ifdefs
-IF(UNIX)
- ADD_DEFINITIONS(-DPLATFORM_UNIX=1)
-ENDIF()
IF(LINUX)
- ADD_DEFINITIONS(-DPLATFORM_LINUX=1)
ADD_DEFINITIONS(${GTK2_DEFINITIONS})
#-no-strict-aliasing for the sake of angelscript
@@ -424,7 +418,6 @@ IF(LINUX)
ENDIF()
IF(APPLE)
- ADD_DEFINITIONS(-DPLATFORM_MACOSX=1)
#-no-strict-aliasing for the sake of angelscript
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -fno-strict-aliasing")
@@ -447,7 +440,6 @@ SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
#enable .pdb symbol generation for Release target on Windows
IF(WIN32)
#Disable warnings when using standard c functions in visual studio
- ADD_DEFINITIONS(-DPLATFORM_WINDOWS=1)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GF -D_CRT_SECURE_NO_WARNINGS -DNEED_SNPRINTF_ONLY /EHsc")
@@ -640,6 +632,7 @@ ADD_DEFINITIONS(
-DHAVE_MIXCFG_H
-DGLEW_STATIC
-DTIXML_USE_STL
+ -DIMGUI_ENABLE_FREETYPE
)
INCLUDE_DIRECTORIES(SYSTEM
@@ -765,6 +758,24 @@ if(APPLE)
ENDIF()
+SET(IMGUI_SRCS
+ ${LIBDIR}/imgui-1.85/imgui.cpp
+ ${LIBDIR}/imgui-1.85/imgui_demo.cpp
+ ${LIBDIR}/imgui-1.85/imgui_draw.cpp
+ ${LIBDIR}/imgui-1.85/imgui_widgets.cpp
+ ${LIBDIR}/imgui-1.85/imgui_tables.cpp
+ ${LIBDIR}/imgui-1.85/imgui_color_picker.cpp
+ ${LIBDIR}/imgui-1.85/implot.cpp
+ ${LIBDIR}/imgui-1.85/implot_items.cpp
+ ${LIBDIR}/imgui-1.85/misc/freetype/imgui_freetype.cpp
+)
+
+ADD_LIBRARY( imgui STATIC
+ ${IMGUI_SRCS}
+)
+
+SET_PROPERTY(TARGET imgui PROPERTY FOLDER "Support")
+
FILE(GLOB TINYXML_SRCS
${LIBDIR}/tinyxml/tinystr.cpp
${LIBDIR}/tinyxml/tinyxml.cpp
@@ -774,7 +785,6 @@ FILE(GLOB TINYXML_SRCS
${LIBDIR}/tinyxml/tinyxml.h
)
-
ADD_LIBRARY( tinyxml STATIC
${TINYXML_SRCS}
)
@@ -1137,6 +1147,7 @@ FILE(GLOB OVERGROWTH_INTERNAL_SRCS RELATIVE ${CMAKE_SOURCE_DIR}
${SRCDIR}/Compat/compat.h
${SRCDIR}/Compat/filepath.h
${SRCDIR}/Compat/hardware_info.h
+ ${SRCDIR}/Compat/time.cpp
${SRCDIR}/Compat/time.h
${SRCDIR}/Compat/os_dialogs.h
${SRCDIR}/Compat/fileio.cpp
@@ -1161,7 +1172,6 @@ IF(LINUX)
${SRCDIR}/Compat/Linux/linux_compat.cpp
${SRCDIR}/Compat/Linux/linux_compat.h
${SRCDIR}/Compat/Linux/linux_hardware_info.cpp
- ${SRCDIR}/Compat/Linux/linux_time.cpp
)
ENDIF()
@@ -1174,7 +1184,6 @@ IF(APPLE)
${SRCDIR}/Compat/Mac/mac_compat.mm
${SRCDIR}/Compat/Mac/mac_compat.h
${SRCDIR}/Compat/Mac/mac_hardware_info.cpp
- ${SRCDIR}/Compat/Mac/mac_time.cpp
)
ENDIF()
@@ -1185,7 +1194,6 @@ IF(WIN32)
${SRCDIR}/Compat/Win/win_compat.cpp
${SRCDIR}/Compat/Win/win_compat.h
${SRCDIR}/Compat/Win/win_hardware_info.cpp
- ${SRCDIR}/Compat/Win/win_time.cpp
)
IF(MSVC_VERSION LESS 1911)
@@ -1207,6 +1215,7 @@ LIST(APPEND OVERGROWTH_SRCS
)
SOURCE_GROUP(Internal FILES ${OVERGROWTH_INTERNAL_SRCS})
+SOURCE_GROUP(ImGui FILES ${IMGUI_SRCS})
SOURCE_GROUP(TinyXML FILES ${TINYXML_SRCS})
SOURCE_GROUP(Logging FILES ${LOGGING_SRCS})
@@ -1439,7 +1448,6 @@ IF(BUILD_OVERGROWTH)
CopyDLL("${LIBDIR}/zlib1.2.7/bin/${WINDOWS_LIB_DIR}/zlib1.dll" "zlib.dll")
CopyDLL("${LIBDIR}/freetype-windows-binaries-2.12.0/release_dll/win64/freetype.dll" "freetype.dll")
CopyDLL("${LIBDIR}/FreeImage/bin/${VERSION_DIR}/${WINDOWS_LIB_DIR}/FreeImage.dll" "")
- CopyDLL("${LIBDIR}/xinput/bin/xinput1_3.dll" "")
IF(ENABLE_RAD_TELEMETRY)
#IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebIn")
IF(64BIT_WINDOWS)
@@ -1540,6 +1548,7 @@ IF(BUILD_OVERGROWTH)
freeimage
triangle
angelscript
+ imgui
tinyxml
trex
logging
diff --git a/Source/Compat/Linux/linux_compat.cpp b/Source/Compat/Linux/linux_compat.cpp
index 90886da5..db59a47d 100644
--- a/Source/Compat/Linux/linux_compat.cpp
+++ b/Source/Compat/Linux/linux_compat.cpp
@@ -20,6 +20,7 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
+#include <Compat/platform.h>
#if !PLATFORM_LINUX
#error Do not compile this.
#endif
diff --git a/Source/Compat/Mac/mac_time.cpp b/Source/Compat/Mac/mac_time.cpp
deleted file mode 100644
index 6607b42a..00000000
--- a/Source/Compat/Mac/mac_time.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-//-----------------------------------------------------------------------------
-// Name: mac_time.cpp
-// Developer: Wolfire Games LLC
-// Description:
-// License: Read below
-//-----------------------------------------------------------------------------
-//
-// Copyright 2022 Wolfire Games LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-----------------------------------------------------------------------------
-#include <Compat/time.h>
-
-#include <CoreServices/CoreServices.h>
-
-uint64_t GetPrecisionTime() {
- AbsoluteTime upTime = UpTime();
- return *(uint64_t*)&upTime;
-}
-
-uint64_t ToNanoseconds(uint64_t time){
- Nanoseconds elapsedNano = AbsoluteToNanoseconds(*(AbsoluteTime*)&time );
- return *(uint64_t*)&elapsedNano;
-}
diff --git a/Source/Compat/UNIX/unix_compat.cpp b/Source/Compat/UNIX/unix_compat.cpp
index 90e095bb..f15073ad 100644
--- a/Source/Compat/UNIX/unix_compat.cpp
+++ b/Source/Compat/UNIX/unix_compat.cpp
@@ -20,6 +20,7 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
+#include <Compat/platform.h>
#if !PLATFORM_UNIX
#error Do not compile this.
#endif
diff --git a/Source/Compat/UNIX/unix_filepath.cpp b/Source/Compat/UNIX/unix_filepath.cpp
index ab66b591..a7e8eaea 100644
--- a/Source/Compat/UNIX/unix_filepath.cpp
+++ b/Source/Compat/UNIX/unix_filepath.cpp
@@ -20,6 +20,7 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
+#include <Compat/platform.h>
#if !PLATFORM_UNIX
#error Do not compile this.
#endif
diff --git a/Source/Compat/Win/win_compat.cpp b/Source/Compat/Win/win_compat.cpp
index 13c2a1c6..b06687be 100644
--- a/Source/Compat/Win/win_compat.cpp
+++ b/Source/Compat/Win/win_compat.cpp
@@ -20,6 +20,7 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
+#include <Compat/platform.h>
#if !PLATFORM_WINDOWS
#error Do not compile this.
#endif
diff --git a/Source/Compat/Win/win_filepath.cpp b/Source/Compat/Win/win_filepath.cpp
index 46c9c8b3..8f7f9bb1 100644
--- a/Source/Compat/Win/win_filepath.cpp
+++ b/Source/Compat/Win/win_filepath.cpp
@@ -20,6 +20,7 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
+#include <Compat/platform.h>
#if !PLATFORM_WINDOWS
#error Do not compile this.
#endif
diff --git a/Source/Compat/compat.h b/Source/Compat/compat.h
index c76ce5f2..038222e0 100644
--- a/Source/Compat/compat.h
+++ b/Source/Compat/compat.h
@@ -51,6 +51,7 @@ bool checkFileAccess(const char* path);
void createParentDirs(const char* abs_path);
bool areSame(const char* path1, const char* path2 );
+#include <Compat/platform.h>
#if PLATFORM_UNIX == 1 //This is shared on mac and linux.
#include <Compat/UNIX/unix_compat.h>
#endif
diff --git a/Source/Compat/Win/win_time.cpp b/Source/Compat/platform.h
index 6751fe7c..e70ef80f 100644
--- a/Source/Compat/Win/win_time.cpp
+++ b/Source/Compat/platform.h
@@ -1,7 +1,7 @@
//-----------------------------------------------------------------------------
-// Name: win_time.cpp
+// Name: compat.h
// Developer: Wolfire Games LLC
-// Description:
+// Description: Compiler macros to detect the target platform
// License: Read below
//-----------------------------------------------------------------------------
//
@@ -20,23 +20,31 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
-#include <Compat/time.h>
+#pragma once
-#define NOMINMAX
-#include <windows.h>
+// Check pointer size
+#if defined _M_X64 || defined _M_AMD64 || defined __amd64__ || defined __amd64 || defined __x86_64__ || defined __x86_64 || defined _WIN64 || defined __64BIT__ || defined __LP64 || defined _LP64 || defined __LP64__ || defined _ADDR64
+#define PLATFORM_64 1
+#else
+#define PLATFORM_32 1
+#endif
-uint64_t GetPrecisionTime() {
- LARGE_INTEGER tick;
- QueryPerformanceCounter(&tick);
- return (uint64_t)tick.QuadPart;
-}
+// Check windows
+#if defined _WIN32 || defined_WIN64
+#define PLATFORM_WINDOWS 1
+#endif
-uint64_t ToNanoseconds(uint64_t time){
- LARGE_INTEGER ticksPerSecond;
- QueryPerformanceFrequency(&ticksPerSecond);
-
- time *= 1000000000;
- time /= ticksPerSecond.QuadPart;
+// Check unix
+#if defined __unix__
+#define PLATFORM_UNIX 1
+#endif
- return time;
-}
+// Check Linux
+#if defined linux || defined __linux
+#define PLATFORM_LINUX 1
+#endif
+
+// Check macos
+#if defined __APPLE__
+#define PLATFORM_MACOSX 1
+#endif \ No newline at end of file
diff --git a/Source/Compat/platformsetup.h b/Source/Compat/platformsetup.h
index 52bdd945..807164e1 100644
--- a/Source/Compat/platformsetup.h
+++ b/Source/Compat/platformsetup.h
@@ -22,12 +22,12 @@
//-----------------------------------------------------------------------------
#pragma once
+#include <Compat/compat.h>
+
#if !PLATFORM_UNIX
#define _WIN32 1
#endif
-#include <Compat/compat.h>
-
//Disable console
#ifdef _WIN32
#pragma comment( linker, "/subsystem:\"windows\" \
diff --git a/Source/Compat/Linux/linux_time.cpp b/Source/Compat/time.cpp
index 8b10f287..a35da9c2 100644
--- a/Source/Compat/Linux/linux_time.cpp
+++ b/Source/Compat/time.cpp
@@ -1,5 +1,5 @@
//-----------------------------------------------------------------------------
-// Name: linux_time.cpp
+// Name: time.cpp
// Developer: Wolfire Games LLC
// Description:
// License: Read below
@@ -20,19 +20,16 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
-#include <Compat/time.h>
-
-#include <sys/time.h>
-#include <stdlib.h>
+#include "time.h"
+#include <SDL.h>
uint64_t GetPrecisionTime() {
- struct timeval time;
-
- gettimeofday(&time, NULL);
- return time.tv_usec +
- (time.tv_sec * 1000 * 1000);
+ return SDL_GetPerformanceCounter();
}
uint64_t ToNanoseconds(uint64_t time){
- return time * 1000;
+ uint64_t ticksPerSecond = SDL_GetPerformanceFrequency();
+
+ // Multiply with 1e9 to get nanoseconds
+ return time * 1e9 / ticksPerSecond;
}
diff --git a/Source/GUI/IMUI/imui.cpp b/Source/GUI/IMUI/imui.cpp
index 4c82d753..c3857554 100644
--- a/Source/GUI/IMUI/imui.cpp
+++ b/Source/GUI/IMUI/imui.cpp
@@ -187,7 +187,6 @@ void IMUIContext::Init() {
hot_ = -1;
active_ = -1;
lmb_state = kMouseStillUp;
- debug_viz_enabled_ = false;
gl_state.blend = true;
gl_state.cull_face = false;
@@ -202,13 +201,6 @@ bool IMUIContext::DoButton( int id, vec2 top_left, vec2 bottom_right, UIState& u
{
mouse_over = true;
}
-
- if(debug_viz_enabled_){
- debug_viz_squares.resize(debug_viz_squares.size() + 1);
- debug_viz_squares.back().top_left = top_left;
- debug_viz_squares.back().bottom_right = bottom_right;
- debug_viz_squares.back().ui_state = ui_state;
- }
return DoButtonMouseOver(id, mouse_over, ui_state);
}
@@ -269,74 +261,6 @@ void IMUIContext::UpdateControls() {
}
break;
}
- if(debug_viz_enabled_){
- Draw();
- }
-}
-
-
-void IMUIContext::Draw() {
- Graphics* gi = Graphics::Instance();
- gi->setGLState(gl_state);
- Shaders::Instance()->noProgram();
-
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, gi->window_dims[0],
- 0, gi->window_dims[1],
- -100,100);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
- glPushAttrib(GL_POLYGON_BIT);
-
- for(unsigned i=0; i<debug_viz_squares.size(); ++i){
- const DebugVizSquare &square = debug_viz_squares[i];
- switch(square.ui_state){
- case kActive:
- glColor4f(0.1f,0.1f,0.1f,0.5f); break;
- case kNothing:
- glColor4f(0.5f,0.5f,0.5f,0.5f); break;
- case kHot:
- glColor4f(0.8f,0.8f,0.8f,0.5f); break;
- }
- int border_offset_y = 2;
- int border_offset_x = 2;
- int x1 = (int)square.top_left[0];
- int x2 = (int)square.bottom_right[0];
- int y1 = (int)square.top_left[1];
- int y2 = (int)square.bottom_right[1];
- if (y2 > y1) border_offset_y *= -1;
- if (x2 < x1) border_offset_x *= -1;
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- //TODO: set stipple
- glBegin(GL_QUADS);
- glVertex3f((GLfloat)(x1+border_offset_x),(GLfloat)(y1-border_offset_y),0);
- glVertex3f((GLfloat)(x2-border_offset_x),(GLfloat)(y1-border_offset_y),0);
- glVertex3f((GLfloat)(x2-border_offset_x),(GLfloat)(y2+border_offset_y),0);
- glVertex3f((GLfloat)(x1+border_offset_x),(GLfloat)(y2+border_offset_y),0);
- glEnd();
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- Graphics::Instance()->SetLineWidth(2);
- glColor4f(0,0,0,1);
- glBegin(GL_QUADS);
- glVertex3f((GLfloat)x1,(GLfloat)y1,0);
- glVertex3f((GLfloat)x2,(GLfloat)y1,0);
- glVertex3f((GLfloat)x2,(GLfloat)y2,0);
- glVertex3f((GLfloat)x1,(GLfloat)y2,0);
- glEnd();
- }
- glPopAttrib();
- glPopMatrix();
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- debug_viz_squares.clear();
-}
-
-void IMUIContext::SetDebugVizEnabled( bool enabled ) {
- debug_viz_enabled_ = enabled;
}
vec2 IMUIContext::getMousePosition() {
diff --git a/Source/GUI/IMUI/imui.h b/Source/GUI/IMUI/imui.h
index e046e7ee..85622668 100644
--- a/Source/GUI/IMUI/imui.h
+++ b/Source/GUI/IMUI/imui.h
@@ -378,7 +378,6 @@ public:
bool DoButtonMouseOver( int id, bool mouse_over, UIState& ui_state);
void ClearHot();
void Init();
- void SetDebugVizEnabled(bool enabled);
vec2 getMousePosition();
ButtonState getLeftMouseState();
@@ -469,13 +468,11 @@ private:
vec2 top_left, bottom_right;
};
- bool debug_viz_enabled_;
int hot_;
int active_;
vec2 mouse_pos;
ButtonState lmb_state;
- std::vector<DebugVizSquare> debug_viz_squares;
std::vector<IMUIRenderableType*> renderables;
void Draw();
diff --git a/Source/GUI/dimgui/dimgui_impl.cpp b/Source/GUI/dimgui/dimgui_impl.cpp
deleted file mode 100644
index 849e0875..00000000
--- a/Source/GUI/dimgui/dimgui_impl.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-//-----------------------------------------------------------------------------
-// Name: dimgui_impl.cpp
-// Developer: Wolfire Games LLC
-// Description: This is the implementation file for Dear IMGUI, this is where
-// all the code in the project gets compiled for use in the
-// project.
-// License: Read below
-//-----------------------------------------------------------------------------
-//
-//
-// Copyright 2022 Wolfire Games LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-----------------------------------------------------------------------------
-#define IMGUI_ENABLE_FREETYPE
-#include <imgui.cpp>
-#include <imgui_demo.cpp>
-#include <imgui_draw.cpp>
-#include <imgui_widgets.cpp>
-#include <imgui_tables.cpp>
-#include <imgui_color_picker.cpp>
-#include <implot.cpp>
-#include <implot_items.cpp>
-#include <imgui_freetype.cpp> \ No newline at end of file
diff --git a/Source/Graphics/geometry.cpp b/Source/Graphics/geometry.cpp
index fa699d7c..cbccc682 100644
--- a/Source/Graphics/geometry.cpp
+++ b/Source/Graphics/geometry.cpp
@@ -311,91 +311,6 @@ void GetWireBoxVertArray( std::vector<vec3> &data )
}
}
-/*
- * Draws a solid sphere
- */
-void renderSolidSphere(GLdouble radius, GLint slices, GLint stacks)
-{
- int i,j;
-
- /* Adjust z and radius as stacks are drawn. */
-
- double z0,z1;
- double r0,r1;
-
- /* Pre-computed circle */
-
- double *sint1,*cost1;
- double *sint2,*cost2;
- circleTable(&sint1,&cost1,-slices);
- circleTable(&sint2,&cost2,stacks*2);
-
- /* The top stack is covered with a triangle fan */
-
- z0 = 1.0f;
- z1 = cost2[1];
- r0 = 0.0f;
- r1 = sint2[1];
-
- glBegin(GL_TRIANGLE_FAN);
-
- glNormal3d(0,0,1);
- glVertex3d(0,0,radius);
-
- for (j=slices; j>=0; j--)
- {
- glNormal3d(cost1[j]*r1, sint1[j]*r1, z1 );
- glVertex3d(cost1[j]*r1*radius, sint1[j]*r1*radius, z1*radius);
- }
-
- glEnd();
-
- /* Cover each stack with a quad strip, except the top and bottom stacks */
-
- for( i=1; i<stacks-1; i++ )
- {
- z0 = z1; z1 = cost2[i+1];
- r0 = r1; r1 = sint2[i+1];
-
- glBegin(GL_QUAD_STRIP);
-
- for(j=0; j<=slices; j++)
- {
- glNormal3d(cost1[j]*r1, sint1[j]*r1, z1 );
- glVertex3d(cost1[j]*r1*radius, sint1[j]*r1*radius, z1*radius);
- glNormal3d(cost1[j]*r0, sint1[j]*r0, z0 );
- glVertex3d(cost1[j]*r0*radius, sint1[j]*r0*radius, z0*radius);
- }
-
- glEnd();
- }
-
- /* The bottom stack is covered with a triangle fan */
-
- z0 = z1;
- r0 = r1;
-
- glBegin(GL_TRIANGLE_FAN);
-
- glNormal3d(0,0,-1);
- glVertex3d(0,0,-radius);
-
- for (j=0; j<=slices; j++)
- {
- glNormal3d(cost1[j]*r0, sint1[j]*r0, z0 );
- glVertex3d(cost1[j]*r0*radius, sint1[j]*r0*radius, z0*radius);
- }
-
- glEnd();
-
- /* Release sin and cos tables */
-
- OG_FREE(sint1);
- OG_FREE(cost1);
- OG_FREE(sint2);
- OG_FREE(cost2);
-}
-
// Get interleaved vert array (3 verts) for GL_LINES
void GetWireSphereVertArray(GLdouble radius, GLint slices, GLint stacks, std::vector<float> &data) {
double r,x,y,z;
@@ -563,247 +478,4 @@ void GetUnitBoxVertArray(std::vector<float> &verts, std::vector<unsigned> &faces
faces.push_back(1-1);
faces.push_back(4-1);
faces.push_back(8-1);
-}
-
-/*
- * Draws a solid cylinder
- */
-void renderSolidCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks)
-{
- int i,j;
-
- /* Step in z and radius as stacks are drawn. */
-
-
- double z0,z1;
- const double zStep = height/stacks;
-
- /* Pre-computed circle */
-
- double *sint,*cost;
- circleTable(&sint,&cost,-slices);
-
- /* Cover the base and top */
-
- glBegin(GL_TRIANGLE_FAN);
- glNormal3d(0.0f, 0.0f, -1.0f );
- glVertex3d(0.0f, 0.0f, -height/2 );
- for (j=0; j<=slices; j++)
- glVertex3d(cost[j]*radius, sint[j]*radius, -height/2);
- glEnd();
-
- glBegin(GL_TRIANGLE_FAN);
- glNormal3d(0.0f, 0.0f, 1.0f );
- glVertex3d(0.0f, 0.0f, height/2);
- for (j=slices; j>=0; j--)
- glVertex3d(cost[j]*radius, sint[j]*radius, height/2);
- glEnd();
-
- /* Do the stacks */
-
- z0 = -height/2;
- z1 = zStep-height/2;
-
- for (i=1; i<=stacks; i++)
- {
- if (i==stacks)
- z1 = height/2;
-
- glBegin(GL_QUAD_STRIP);
- for (j=0; j<=slices; j++ )
- {
- glNormal3d(cost[j], sint[j], 0.0f );
- glVertex3d(cost[j]*radius, sint[j]*radius, z0 );
- glVertex3d(cost[j]*radius, sint[j]*radius, z1 );
- }
- glEnd();
-
- z0 = z1; z1 += zStep;
- }
-
- /* Release sin and cos tables */
-
- OG_FREE(sint);
- OG_FREE(cost);
-}
-
-/*
- * Draws a wire cylinder
- */
-void renderWireCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks)
-{
- int i,j;
-
- /* Step in z and radius as stacks are drawn. */
-
- double z = 0.0f;
- const double zStep = height/stacks;
-
- /* Pre-computed circle */
-
- double *sint,*cost;
- circleTable(&sint,&cost,-slices);
-
- /* Draw the stacks... */
-
- for (i=0; i<=stacks; i++)
- {
- if (i==stacks)
- z = height;
-
- glBegin(GL_LINE_LOOP);
- for( j=0; j<slices; j++ ) {
- glNormal3d(cost[j], sint[j], 0.0f);
- glVertex3d(cost[j]*radius, sint[j]*radius, z );
- }
- glEnd();
-
- z += zStep;
- }
-
- /* Draw the slices */
-
- glBegin(GL_LINES);
-
- for (j=0; j<slices; j++)
- {
- glNormal3d(cost[j], sint[j], 0.0f );
- glVertex3d(cost[j]*radius, sint[j]*radius, 0.0f );
- glVertex3d(cost[j]*radius, sint[j]*radius, height);
- }
-
- glEnd();
-
- /* Release sin and cos tables */
-
- OG_FREE(sint);
- OG_FREE(cost);
-}
-
-
-#undef num_faces
-
-
-#ifdef _WIN32
-#define NOMINMAX
-#include <windows.h>
-#endif
-
-#include "opengl.h"
-
-GLuint GetBoxDisplayList( const vec3 &sides )
-{
- GLuint display_list = glGenLists(1);
- glNewList(display_list,GL_COMPILE);
- glBegin(GL_QUADS);
- glNormal3f(0,-1,0);
- glVertex3f(-sides[0]*0.5f,-sides[1]*0.5f,-sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f,-sides[1]*0.5f,-sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f,-sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f(-sides[0]*0.5f,-sides[1]*0.5f, sides[2]*0.5f);
-
- glNormal3f(0,1,0);
- glVertex3f(-sides[0]*0.5f, sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f, sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f, sides[1]*0.5f,-sides[2]*0.5f);
- glVertex3f(-sides[0]*0.5f, sides[1]*0.5f,-sides[2]*0.5f);
-
- glNormal3f(1,0,0);
- glVertex3f( sides[0]*0.5f,-sides[1]*0.5f,-sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f, sides[1]*0.5f,-sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f, sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f,-sides[1]*0.5f, sides[2]*0.5f);
-
- glNormal3f(-1,0,0);
- glVertex3f( -sides[0]*0.5f,-sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f( -sides[0]*0.5f, sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f( -sides[0]*0.5f, sides[1]*0.5f,-sides[2]*0.5f);
- glVertex3f( -sides[0]*0.5f,-sides[1]*0.5f,-sides[2]*0.5f);
-
- glNormal3f(0,0,-1);
- glVertex3f(-sides[0]*0.5f,-sides[1]*0.5f, -sides[2]*0.5f);
- glVertex3f(-sides[0]*0.5f, sides[1]*0.5f, -sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f, sides[1]*0.5f, -sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f,-sides[1]*0.5f, -sides[2]*0.5f);
-
- glNormal3f(0,0,1);
- glVertex3f( sides[0]*0.5f,-sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f, sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f(-sides[0]*0.5f, sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f(-sides[0]*0.5f,-sides[1]*0.5f, sides[2]*0.5f);
- glEnd();
- glEndList();
-
- return display_list;
-}
-
-
-
-GLuint GetMultiSphereDisplayList( const vec3 *positions, const float *radii, int num_spheres )
-{
- CHECK_GL_ERROR();
- GLuint display_list = glGenLists(1);
- CHECK_GL_ERROR();
- glNewList(display_list,GL_COMPILE);
- CHECK_GL_ERROR();
-
- for(int i=0; i<num_spheres; i++){
- glPushMatrix();
- glTranslatef(positions[i][0], positions[i][1], positions[i][2]);
- renderSolidSphere(radii[i],12,12);
- glPopMatrix();
- }
- CHECK_GL_ERROR();
- for(int i=0; i<num_spheres; i++){
- for(int j=i+1; j<num_spheres; j++){
- vec3 connection = normalize(positions[j]-positions[i]);
- vec3 right;// = normalize(vec3(1.0f,1.0f,1.0f));
- vec3 up;// = normalize(cross(right,connection));
- //right = normalize(cross(up,connection));
-
- PlaneSpace(connection, right, up);
-
- vec3 avg_pos = (positions[j]+positions[i])*0.5f;
-
- mat4 transform;
- transform.SetColumn(0,right);
- transform.SetColumn(1,up);
- transform.SetColumn(2,connection);
- transform.SetColumn(3,avg_pos);
-
- glPushMatrix();
- glMultMatrixf(transform);
- renderSolidCylinder(radii[i],
- distance(positions[i], positions[j]),
- 12,12);
- glPopMatrix();
- }
- }
- CHECK_GL_ERROR();
- glEndList();
- return display_list;
-}
-
-GLuint GetWireCylinderDisplayList( float radius, float height, GLint slices, GLint stacks )
-{
- GLuint display_list = glGenLists(1);
- glNewList(display_list,GL_COMPILE);
- glPushMatrix();
- glTranslatef(0.0f,height*0.5f,0.0f);
- glRotatef(90,1,0,0);
- renderWireCylinder(radius,height,slices,stacks);
- glPopMatrix();
- glEndList();
- return display_list;
-}
-
-GLuint GetSphereDisplayList( float radius )
-{
- GLuint display_list = glGenLists(1);
- glNewList(display_list,GL_COMPILE);
- glPushMatrix();
- renderSolidSphere(radius,12,12);
- glPopMatrix();
- glEndList();
- return display_list;
-}
+} \ No newline at end of file
diff --git a/Source/Graphics/geometry.h b/Source/Graphics/geometry.h
index a5f67670..cc89540b 100644
--- a/Source/Graphics/geometry.h
+++ b/Source/Graphics/geometry.h
@@ -171,17 +171,7 @@
#include <vector>
/* -- INTERFACE FUNCTION PROTOTYPES -------------------------------------------------- */
-
-GLuint GetBoxDisplayList(const vec3 &sides);
-GLuint GetSphereDisplayList(float radius);
-GLuint GetMultiSphereDisplayList(const vec3 *positions, const float *radii, int num_spheres);
-
-void renderSolidSphere(GLdouble radius, GLint slices, GLint stacks);
-
-void renderWireCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks);
-
-GLuint GetWireCylinderDisplayList( float radius, float height, GLint slices, GLint stacks );
-
+
void GetWireCylinderVertArray(GLint slices, std::vector<vec3> &data);
void GetWireSphereVertArray(GLdouble radius, GLint slices, GLint stacks, std::vector<float> &data);
void GetWireBoxVertArray( std::vector<vec3> &data );
diff --git a/Source/Graphics/texturepack.cpp b/Source/Graphics/texturepack.cpp
deleted file mode 100644
index 9862b81b..00000000
--- a/Source/Graphics/texturepack.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-//-----------------------------------------------------------------------------
-// Name: texturepack.cpp
-// Developer: Wolfire Games LLC
-// Description:
-// License: Read below
-//-----------------------------------------------------------------------------
-//
-//
-// Copyright 2022 Wolfire Games LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-----------------------------------------------------------------------------
-#include "texturepack.h"
-
-#include <Graphics/textures.h>
-#include <Graphics/graphics.h>
-#include <Graphics/shaders.h>
-
-#include <Math/vec2math.h>
-
-void DrawRect(const vec2 &rect_min, const vec2 &rect_max){
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(rect_min[0],rect_min[1],0.0f);
- glTexCoord2f(1,0);
- glVertex3f(rect_max[0],rect_min[1],0.0f);
- glTexCoord2f(1,1);
- glVertex3f(rect_max[0],rect_max[1],0.0f);
- glTexCoord2f(0,1);
- glVertex3f(rect_min[0],rect_max[1],0.0f);
- glEnd();
-}
-
-TexturePackNode::TexturePackNode():
- filled(false)
-{
- children[0] = NULL;
- children[1] = NULL;
-}
-
-void TexturePackNode::SetRect(const vec2 _rect_min , const vec2 _rect_max)
-{
- rect_min = _rect_min;
- rect_max = _rect_max;
-}
-
-TexturePackNode* TexturePackNode::Insert( const TextureAssetRef &texture )
-{
- TexturePackNode* new_node;
-
- //If node has children, try to insert in each child
- if(children[0]){
- new_node = children[0]->Insert(texture);
- if(new_node){
- return new_node;
- } else {
- return children[1]->Insert(texture);
- }
- // If node has no children, try to insert in this node
- } else {
- // If node is full, can't do anything here!
- if(filled){
- return NULL;
- }
-
- // If image is bigger than node, can't fit here!
- const vec2 rect_dimensions = rect_max - rect_min;
- const int texture_width = Textures::Instance()->getWidth(texture->GetTextureRef());
- const int texture_height = Textures::Instance()->getHeight(texture->GetTextureRef());
- if(texture_width > rect_dimensions[0] ||
- texture_height > rect_dimensions[1]){
- return NULL;
- }
-
- // If image is exactly the size of this node, draw it in!
- if(texture_width == rect_dimensions[0] &&
- texture_height == rect_dimensions[1]){
- Textures::Instance()->bindTexture(texture->GetTextureRef());
- DrawRect(rect_min,rect_max);
- filled = true;
- return this;
- }
-
- // Image fits inside, but not perfectly.
- // Time to split!
- children[0] = new TexturePackNode();
- children[1] = new TexturePackNode();
-
- int extra_width = (int)rect_dimensions[0] - texture_width;
- int extra_height = (int)rect_dimensions[1] - texture_height;
- if(extra_width > extra_height){
- children[0]->SetRect(rect_min, vec2(rect_min[0]+texture_width, rect_max[1]));
- children[1]->SetRect(vec2(rect_min[0]+texture_width, rect_min[1]), rect_max);
- } else {
- children[0]->SetRect(rect_min, vec2(rect_max[0], rect_min[1]+texture_height));
- children[1]->SetRect(vec2(rect_min[0], rect_min[1]+texture_height), rect_max);
- }
-
- // Insert in the correctly-sized child node
- return children[0]->Insert(texture);
- }
-}
-
-void TexturePackNode::Dispose()
-{
- if(children[0]){
- delete children[0];
- children[0] = NULL;
- }
- if(children[1]){
- delete children[1];
- children[1] = NULL;
- }
- filled = false;
-}
-
-TexturePackNode::~TexturePackNode()
-{
- Dispose();
-}
-
-const vec2& TexturePackNode::GetMin() const
-{
- return rect_min;
-}
-
-const vec2& TexturePackNode::GetMax() const
-{
- return rect_max;
-}
-
-TexturePack::TexturePack() {
-}
-
-
-struct TexturePackParamSort {
- TexturePackParam param;
- int area;
- int orig_id;
-};
-
-struct TextureSizeSorter {
- bool operator()(const TexturePackParamSort& a, const TexturePackParamSort& b){
- return a.area > b.area;
- }
-};
-
-void TexturePack::Create( int _size, std::vector<TexturePackParam> &textures )
-{
- Dispose();
-
- size = _size;
-
- int widest = 0;
- int tallest = 0;
-
- std::vector<TexturePackParamSort> sorted_textures(textures.size());
- for(unsigned i=0; i<sorted_textures.size(); i++){
- sorted_textures[i].param = textures[i];
- sorted_textures[i].orig_id = i;
- Textures::Instance()->EnsureInVRAM(textures[i].texture->GetTextureRef());
- sorted_textures[i].area = Textures::Instance()->getWidth(textures[i].texture->GetTextureRef())*
- Textures::Instance()->getHeight(textures[i].texture->GetTextureRef());
- textures[sorted_textures[i].orig_id].inserted = false;
- }
- sort(sorted_textures.begin(), sorted_textures.end(), TextureSizeSorter());
-
- int total_area_remaining = size*size;
- int cutoff = 0;
- for(int i=(int)sorted_textures.size()-1; i>=0; i--){
- total_area_remaining -= sorted_textures[i].area;
- if(total_area_remaining<0){
- cutoff = i+1;
- break;
- } else {
- widest = max(widest, Textures::Instance()->getWidth(textures[sorted_textures[i].orig_id].texture->GetTextureRef()));
- tallest = max(tallest, Textures::Instance()->getHeight(textures[sorted_textures[i].orig_id].texture->GetTextureRef()));
- }
- }
-
- const int area_used = size*size - total_area_remaining;
- while(area_used < size*size/4 && size >= widest*2 && size >= tallest*2){
- size/=2;
- }
-
- //pack_texture = Textures::Instance()->makeTextureColor(size,size);
- pack_texture = Textures::Instance()->makeTextureTestPattern(size,size);
- Textures::Instance()->SetTextureName(pack_texture, "Texture Pack");
-
- GLuint framebuffer;
- Graphics::Instance()->genFramebuffers(&framebuffer, "texture_pack");
- Graphics::Instance()->PushFramebuffer();
- Graphics::Instance()->bindFramebuffer(framebuffer);
- Graphics::Instance()->framebufferColorTexture2D(pack_texture);
-
- Shaders::Instance()->noProgram();
-
- GLState gl_state;
- gl_state.blend = false;
- gl_state.cull_face = false;
- gl_state.depth_test = false;
- gl_state.depth_write = false;
-
- Graphics::Instance()->setGLState(gl_state);
- glColor4f(1.0f,1.0f,1.0f,1.0f);
-
- Graphics::Instance()->PushViewport();
- Graphics::Instance()->setViewport(0,0,size,size);
-
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0,size,0,size,-100,100);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- root_node.SetRect(vec2(0.0f,0.0f),vec2((float)size,(float)size));
-
- TexturePackNode *inserted;
- for(unsigned i=cutoff; i<sorted_textures.size(); i++){
- inserted = root_node.Insert(sorted_textures[i].param.texture);
- if(inserted){
- textures[sorted_textures[i].orig_id].offset[0] = inserted->GetMin()[0]/(float)size;
- textures[sorted_textures[i].orig_id].offset[1] = inserted->GetMin()[1]/(float)size;
- textures[sorted_textures[i].orig_id].offset[2] = Textures::Instance()->getWidth(textures[sorted_textures[i].orig_id].texture->GetTextureRef())/(float)size;
- textures[sorted_textures[i].orig_id].offset[3] = Textures::Instance()->getHeight(textures[sorted_textures[i].orig_id].texture->GetTextureRef())/(float)size;
- textures[sorted_textures[i].orig_id].inserted = true;
- }
- }
-
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
-
- Graphics::Instance()->PopViewport();
- Graphics::Instance()->PopFramebuffer();
- Graphics::Instance()->deleteFramebuffer(&framebuffer);
-
- //Textures::Instance()->SetDebugTextureAssetRef(pack_texture);
- Textures::Instance()->DeleteUnusedTextures();
-}
-
-TexturePack::~TexturePack() {
- Dispose();
-}
-
-void TexturePack::Dispose()
-{
- root_node.Dispose();
-}
diff --git a/Source/Graphics/texturepack.h b/Source/Graphics/texturepack.h
deleted file mode 100644
index 31673c0c..00000000
--- a/Source/Graphics/texturepack.h
+++ /dev/null
@@ -1,70 +0,0 @@
-//-----------------------------------------------------------------------------
-// Name: texturepack.h
-// Developer: Wolfire Games LLC
-// Description:
-// License: Read below
-//-----------------------------------------------------------------------------
-//
-//
-// Copyright 2022 Wolfire Games LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include <Math/vec4.h>
-#include <Math/vec2.h>
-
-#include <Graphics/glstate.h>
-
-#include <Asset/Asset/texture.h>
-
-#include <vector>
-
-class TexturePackNode {
-private:
- bool filled;
- vec2 rect_min;
- vec2 rect_max;
- TexturePackNode* children[2];
-
-public:
- TexturePackNode* Insert(const TextureAssetRef &texture);
- void SetRect(const vec2 _rect_min , const vec2 _rect_max);
- const vec2& GetMin() const;
- const vec2& GetMax() const;
-
- TexturePackNode();
- void Dispose();
- ~TexturePackNode();
-};
-
-struct TexturePackParam {
- TextureAssetRef texture;
- vec4 offset; //(vec2 corner, vec2 dimensions)
- bool inserted;
-};
-
-class TexturePack {
- int size;
- TexturePackNode root_node;
-
-public:
- TextureRef pack_texture;
-
- void Create(int size, std::vector<TexturePackParam> &textures);
- TexturePack();
- void Dispose();
- ~TexturePack();
-};
diff --git a/Source/Internal/error.cpp b/Source/Internal/error.cpp
index 48e4b453..2318961d 100644
--- a/Source/Internal/error.cpp
+++ b/Source/Internal/error.cpp
@@ -32,6 +32,7 @@
#include <Graphics/graphics.h>
#include <Threading/thread_sanity.h>
#include <Compat/os_dialogs.h>
+#include <Compat/platform.h>
#include <Utility/stacktrace.h>
#include <map>
diff --git a/Source/Logging/logdata.h b/Source/Logging/logdata.h
index 9f8aebf4..2e0cd151 100644
--- a/Source/Logging/logdata.h
+++ b/Source/Logging/logdata.h
@@ -28,6 +28,7 @@
#include <cstring>
#include "Utility/compiler_macros.h"
+#include <Compat/platform.h>
#define LOGGER_LIMIT 4
diff --git a/Source/Main/scenegraph.h b/Source/Main/scenegraph.h
index 0a5bf178..d7f9160e 100644
--- a/Source/Main/scenegraph.h
+++ b/Source/Main/scenegraph.h
@@ -23,7 +23,6 @@
#pragma once
#include <Graphics/drawbatch.h>
-#include <Graphics/texturepack.h>
#include <Graphics/lightprobecollection.hpp>
#include <Graphics/dynamiclightcollection.hpp>
#include <Graphics/flares.h>
diff --git a/Source/Timing/timestamp.h b/Source/Timing/timestamp.h
index 598b1274..12576f6c 100644
--- a/Source/Timing/timestamp.h
+++ b/Source/Timing/timestamp.h
@@ -24,6 +24,8 @@
//-----------------------------------------------------------------------------
#pragma once
+#include <Compat/platform.h>
+
inline uint64_t GetTimestamp() {
// Use rdtsc instruction to get the tsc or Time Stamp Counter
#if (defined(PLATFORM_LINUX) || defined(PLATFORM_MACOSX)) && (defined(__i386__) || defined(__x86_64__))
diff --git a/Source/Utility/stacktrace.h b/Source/Utility/stacktrace.h
index dd0d69d1..c93e5843 100644
--- a/Source/Utility/stacktrace.h
+++ b/Source/Utility/stacktrace.h
@@ -22,6 +22,7 @@
//-----------------------------------------------------------------------------
#include <sstream>
+#include <Compat/platform.h>
#if PLATFORM_LINUX || PLATFORM_MACOSX
#include <Memory/allocation.h>
#include <sys/time.h>
diff --git a/Source/Utility/timing.h b/Source/Utility/timing.h
index 55363140..b72d8a40 100644
--- a/Source/Utility/timing.h
+++ b/Source/Utility/timing.h
@@ -22,6 +22,7 @@
//-----------------------------------------------------------------------------
#pragma once
+#include <Compat/platform.h>
#if defined(PLATFORM_WINDOWS) && _MSC_VER >= 1600
#include <intrin.h>
#endif